Add the rt linux 4.1.3-rt3 as base
[kvmfornfv.git] / kernel / tools / testing / selftests / rcutorture / doc / initrd.txt
1 This document describes one way to create the initrd directory hierarchy
2 in order to allow an initrd to be built into your kernel.  The trick
3 here is to steal the initrd file used on your Linux laptop, Ubuntu in
4 this case.  There are probably much better ways of doing this.
5
6 That said, here are the commands:
7
8 ------------------------------------------------------------------------
9 cd tools/testing/selftests/rcutorture
10 zcat /initrd.img > /tmp/initrd.img.zcat
11 mkdir initrd
12 cd initrd
13 cpio -id < /tmp/initrd.img.zcat
14 ------------------------------------------------------------------------
15
16 Interestingly enough, if you are running rcutorture, you don't really
17 need userspace in many cases.  Running without userspace has the
18 advantage of allowing you to test your kernel independently of the
19 distro in place, the root-filesystem layout, and so on.  To make this
20 happen, put the following script in the initrd's tree's "/init" file,
21 with 0755 mode.
22
23 ------------------------------------------------------------------------
24 #!/bin/sh
25
26 [ -d /dev ] || mkdir -m 0755 /dev
27 [ -d /root ] || mkdir -m 0700 /root
28 [ -d /sys ] || mkdir /sys
29 [ -d /proc ] || mkdir /proc
30 [ -d /tmp ] || mkdir /tmp
31 mkdir -p /var/lock
32 mount -t sysfs -o nodev,noexec,nosuid sysfs /sys
33 mount -t proc -o nodev,noexec,nosuid proc /proc
34 # Some things don't work properly without /etc/mtab.
35 ln -sf /proc/mounts /etc/mtab
36
37 # Note that this only becomes /dev on the real filesystem if udev's scripts
38 # are used; which they will be, but it's worth pointing out
39 if ! mount -t devtmpfs -o mode=0755 udev /dev; then
40         echo "W: devtmpfs not available, falling back to tmpfs for /dev"
41         mount -t tmpfs -o mode=0755 udev /dev
42         [ -e /dev/console ] || mknod --mode=600 /dev/console c 5 1
43         [ -e /dev/kmsg ] || mknod --mode=644 /dev/kmsg c 1 11
44         [ -e /dev/null ] || mknod --mode=666 /dev/null c 1 3
45 fi
46
47 mkdir /dev/pts
48 mount -t devpts -o noexec,nosuid,gid=5,mode=0620 devpts /dev/pts || true
49 mount -t tmpfs -o "nosuid,size=20%,mode=0755" tmpfs /run
50 mkdir /run/initramfs
51 # compatibility symlink for the pre-oneiric locations
52 ln -s /run/initramfs /dev/.initramfs
53
54 # Export relevant variables
55 export ROOT=
56 export ROOTDELAY=
57 export ROOTFLAGS=
58 export ROOTFSTYPE=
59 export IP=
60 export BOOT=
61 export BOOTIF=
62 export UBIMTD=
63 export break=
64 export init=/sbin/init
65 export quiet=n
66 export readonly=y
67 export rootmnt=/root
68 export debug=
69 export panic=
70 export blacklist=
71 export resume=
72 export resume_offset=
73 export recovery=
74
75 for i in /sys/devices/system/cpu/cpu*/online
76 do
77         case $i in
78         '/sys/devices/system/cpu/cpu0/online')
79                 ;;
80         '/sys/devices/system/cpu/cpu*/online')
81                 ;;
82         *)
83                 echo 1 > $i
84                 ;;
85         esac
86 done
87
88 while :
89 do
90         sleep 10
91 done