xref: /linux/tools/testing/selftests/rcutorture/doc/rcu-test-image.txt (revision 24168c5e6dfbdd5b414f048f47f75d64533296ca)
1Normally, a minimal initrd is created automatically by the rcutorture
2scripting.  But minimal really does mean "minimal", namely just a single
3root directory with a single statically linked executable named "init":
4
5$ size tools/testing/selftests/rcutorture/initrd/init
6   text    data     bss     dec     hex filename
7    328       0       8     336     150 tools/testing/selftests/rcutorture/initrd/init
8
9Suppose you need to run some scripts, perhaps to monitor or control
10some aspect of the rcutorture testing.  This will require a more fully
11filled-out userspace, perhaps containing libraries, executables for
12the shell and other utilities, and soforth.  In that case, place your
13desired filesystem here:
14
15	tools/testing/selftests/rcutorture/initrd
16
17For example, your tools/testing/selftests/rcutorture/initrd/init might
18be a script that does any needed mount operations and starts whatever
19scripts need starting to properly monitor or control your testing.
20The next rcutorture build will then incorporate this filesystem into
21the kernel image that is passed to qemu.
22
23Or maybe you need a real root filesystem for some reason, in which case
24please read on!
25
26The remainder of this document describes one way to create the
27rcu-test-image file that contains the filesystem used by the guest-OS
28kernel.  There are probably much better ways of doing this, and this
29filesystem could no doubt be smaller.  It is probably also possible to
30simply 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=1
36mkfs.ext3 ./rcu-test-image
37sudo mount -o loop ./rcu-test-image /mnt
38
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/ubuntu
43cat << '___EOF___' | sudo dd of=/mnt/etc/fstab
44# UNCONFIGURED FSTAB FOR BASE SYSTEM
45#
46/dev/vda        /               ext3    defaults        1 1
47dev             /dev            tmpfs   rw              0 0
48tmpfs           /dev/shm        tmpfs   defaults        0 0
49devpts          /dev/pts        devpts  gid=5,mode=620  0 0
50sysfs           /sys            sysfs   defaults        0 0
51proc            /proc           proc    defaults        0 0
52___EOF___
53sudo umount /mnt
54------------------------------------------------------------------------
55
56
57References:
58
59	http://sripathikodi.blogspot.com/2010/02/creating-kvm-bootable-fedora-system.html
60	https://help.ubuntu.com/community/KVM/CreateGuests
61	https://help.ubuntu.com/community/JeOSVMBuilder
62	http://wiki.libvirt.org/page/UbuntuKVMWalkthrough
63	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.html
65	https://en.wikipedia.org/wiki/Initrd
66	https://en.wikipedia.org/wiki/Cpio
67	http://wiki.libvirt.org/page/UbuntuKVMWalkthrough
68