68 lines · plain
1Normally, a minimal initrd is created automatically by the rcutorture2scripting. But minimal really does mean "minimal", namely just a single3root directory with a single statically linked executable named "init":4 5$ size tools/testing/selftests/rcutorture/initrd/init6 text data bss dec hex filename7 328 0 8 336 150 tools/testing/selftests/rcutorture/initrd/init8 9Suppose you need to run some scripts, perhaps to monitor or control10some aspect of the rcutorture testing. This will require a more fully11filled-out userspace, perhaps containing libraries, executables for12the shell and other utilities, and soforth. In that case, place your13desired filesystem here:14 15 tools/testing/selftests/rcutorture/initrd16 17For example, your tools/testing/selftests/rcutorture/initrd/init might18be a script that does any needed mount operations and starts whatever19scripts need starting to properly monitor or control your testing.20The next rcutorture build will then incorporate this filesystem into21the kernel image that is passed to qemu.22 23Or maybe you need a real root filesystem for some reason, in which case24please read on!25 26The remainder of this document describes one way to create the27rcu-test-image file that contains the filesystem used by the guest-OS28kernel. There are probably much better ways of doing this, and this29filesystem could no doubt be smaller. It is probably also possible to30simply download an appropriate image from any number of places.31 32That said, here are the commands:33 34------------------------------------------------------------------------35dd if=/dev/zero of=rcu-test-image bs=400M count=136mkfs.ext3 ./rcu-test-image37sudo mount -o loop ./rcu-test-image /mnt38 39# Replace "precise" below with your favorite Ubuntu release.40# Empirical evidence says this image will work for 64-bit, but...41# Note that debootstrap does take a few minutes to run. Or longer.42sudo debootstrap --verbose --arch i386 precise /mnt http://archive.ubuntu.com/ubuntu43cat << '___EOF___' | sudo dd of=/mnt/etc/fstab44# UNCONFIGURED FSTAB FOR BASE SYSTEM45#46/dev/vda / ext3 defaults 1 147dev /dev tmpfs rw 0 048tmpfs /dev/shm tmpfs defaults 0 049devpts /dev/pts devpts gid=5,mode=620 0 050sysfs /sys sysfs defaults 0 051proc /proc proc defaults 0 052___EOF___53sudo umount /mnt54------------------------------------------------------------------------55 56 57References:58 59 http://sripathikodi.blogspot.com/2010/02/creating-kvm-bootable-fedora-system.html60 https://help.ubuntu.com/community/KVM/CreateGuests61 https://help.ubuntu.com/community/JeOSVMBuilder62 http://wiki.libvirt.org/page/UbuntuKVMWalkthrough63 http://www.moe.co.uk/2011/01/07/pci_add_option_rom-failed-to-find-romfile-pxe-rtl8139-bin/ -- "apt-get install kvm-pxe"64 https://www.landley.net/writing/rootfs-howto.html65 https://en.wikipedia.org/wiki/Initrd66 https://en.wikipedia.org/wiki/Cpio67 http://wiki.libvirt.org/page/UbuntuKVMWalkthrough68