Kernel modules (presentation)
From RHLUG
Contents |
[edit] TLDP Docs
The documentation available at TLDP is very useful and easy to understand..
[edit] Scripts
Here are some useful scripts that can be useful when working with other partitions.
- Note, on my computer /dev/sda4 is mounted to /mnt/slack and is a minimal Slackware 11 install. You will most likely need to change this.
[edit] install.sh
Install kernel modules from the current directory to a different partition.
- Note that the VM's partition needs to be mounted with -o sync
File: install.sh
#!/bin/bash
if mount | grep slack 2>&1 > /dev/null; then
sudo mount -o remount,sync,exec /mnt/slack
else
sudo mount -o sync,exec /mnt/slack
fi
sudo rm /mnt/slack/tmp/*
for obj in *.ko; do # test-scall
cp $obj /tmp
sudo cp /tmp/$obj /mnt/slack/tmp
done
sudo umount /mnt/slack
[edit] run.sh
Run install the kernel modules to the virtual machines partition and boot the VM.
File: run.sh
#!/bin/bash
./install.sh
sudo \
qemu -snapshot -kernel-kqemu \
-kernel /usr/src/linux-dev/arch/i386/boot/bzImage \
-hda /dev/sda4 \
-append "root=/dev/hda"
[edit] chroot.sh
Simple script to automate binding and chrooting into a different partition.
File: chroot.sh
#!/bin/bash
if mount | grep slack 2>&1 > /dev/null; then
sudo mount -o remount,sync,exec /mnt/slack
else
sudo mount -o sync,exec /mnt/slack
fi
for i in dev proc sys; do
sudo mount -o bind /$i /mnt/slack/$i
done
sudo /bin/chroot /mnt/slack /bin/zsh -ls
sudo umount /mnt/slack/{dev,proc,sys}
sudo umount /mnt/slack
>

