xref: /OK3568_Linux_fs/kernel/tools/testing/selftests/rcutorture/doc/rcu-test-image.txt (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593SmuzhiyunNormally, a minimal initrd is created automatically by the rcutorture
2*4882a593Smuzhiyunscripting.  But minimal really does mean "minimal", namely just a single
3*4882a593Smuzhiyunroot directory with a single statically linked executable named "init":
4*4882a593Smuzhiyun
5*4882a593Smuzhiyun$ size tools/testing/selftests/rcutorture/initrd/init
6*4882a593Smuzhiyun   text    data     bss     dec     hex filename
7*4882a593Smuzhiyun    328       0       8     336     150 tools/testing/selftests/rcutorture/initrd/init
8*4882a593Smuzhiyun
9*4882a593SmuzhiyunSuppose you need to run some scripts, perhaps to monitor or control
10*4882a593Smuzhiyunsome aspect of the rcutorture testing.  This will require a more fully
11*4882a593Smuzhiyunfilled-out userspace, perhaps containing libraries, executables for
12*4882a593Smuzhiyunthe shell and other utilities, and soforth.  In that case, place your
13*4882a593Smuzhiyundesired filesystem here:
14*4882a593Smuzhiyun
15*4882a593Smuzhiyun	tools/testing/selftests/rcutorture/initrd
16*4882a593Smuzhiyun
17*4882a593SmuzhiyunFor example, your tools/testing/selftests/rcutorture/initrd/init might
18*4882a593Smuzhiyunbe a script that does any needed mount operations and starts whatever
19*4882a593Smuzhiyunscripts need starting to properly monitor or control your testing.
20*4882a593SmuzhiyunThe next rcutorture build will then incorporate this filesystem into
21*4882a593Smuzhiyunthe kernel image that is passed to qemu.
22*4882a593Smuzhiyun
23*4882a593SmuzhiyunOr maybe you need a real root filesystem for some reason, in which case
24*4882a593Smuzhiyunplease read on!
25*4882a593Smuzhiyun
26*4882a593SmuzhiyunThe remainder of this document describes one way to create the
27*4882a593Smuzhiyunrcu-test-image file that contains the filesystem used by the guest-OS
28*4882a593Smuzhiyunkernel.  There are probably much better ways of doing this, and this
29*4882a593Smuzhiyunfilesystem could no doubt be smaller.  It is probably also possible to
30*4882a593Smuzhiyunsimply download an appropriate image from any number of places.
31*4882a593Smuzhiyun
32*4882a593SmuzhiyunThat said, here are the commands:
33*4882a593Smuzhiyun
34*4882a593Smuzhiyun------------------------------------------------------------------------
35*4882a593Smuzhiyundd if=/dev/zero of=rcu-test-image bs=400M count=1
36*4882a593Smuzhiyunmkfs.ext3 ./rcu-test-image
37*4882a593Smuzhiyunsudo mount -o loop ./rcu-test-image /mnt
38*4882a593Smuzhiyun
39*4882a593Smuzhiyun# Replace "precise" below with your favorite Ubuntu release.
40*4882a593Smuzhiyun# Empirical evidence says this image will work for 64-bit, but...
41*4882a593Smuzhiyun# Note that debootstrap does take a few minutes to run.  Or longer.
42*4882a593Smuzhiyunsudo debootstrap --verbose --arch i386 precise /mnt http://archive.ubuntu.com/ubuntu
43*4882a593Smuzhiyuncat << '___EOF___' | sudo dd of=/mnt/etc/fstab
44*4882a593Smuzhiyun# UNCONFIGURED FSTAB FOR BASE SYSTEM
45*4882a593Smuzhiyun#
46*4882a593Smuzhiyun/dev/vda        /               ext3    defaults        1 1
47*4882a593Smuzhiyundev             /dev            tmpfs   rw              0 0
48*4882a593Smuzhiyuntmpfs           /dev/shm        tmpfs   defaults        0 0
49*4882a593Smuzhiyundevpts          /dev/pts        devpts  gid=5,mode=620  0 0
50*4882a593Smuzhiyunsysfs           /sys            sysfs   defaults        0 0
51*4882a593Smuzhiyunproc            /proc           proc    defaults        0 0
52*4882a593Smuzhiyun___EOF___
53*4882a593Smuzhiyunsudo umount /mnt
54*4882a593Smuzhiyun------------------------------------------------------------------------
55*4882a593Smuzhiyun
56*4882a593Smuzhiyun
57*4882a593SmuzhiyunReferences:
58*4882a593Smuzhiyun
59*4882a593Smuzhiyun	http://sripathikodi.blogspot.com/2010/02/creating-kvm-bootable-fedora-system.html
60*4882a593Smuzhiyun	https://help.ubuntu.com/community/KVM/CreateGuests
61*4882a593Smuzhiyun	https://help.ubuntu.com/community/JeOSVMBuilder
62*4882a593Smuzhiyun	http://wiki.libvirt.org/page/UbuntuKVMWalkthrough
63*4882a593Smuzhiyun	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*4882a593Smuzhiyun	https://www.landley.net/writing/rootfs-howto.html
65*4882a593Smuzhiyun	https://en.wikipedia.org/wiki/Initrd
66*4882a593Smuzhiyun	https://en.wikipedia.org/wiki/Cpio
67*4882a593Smuzhiyun	http://wiki.libvirt.org/page/UbuntuKVMWalkthrough
68