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.
6 That said, here are the commands:
8 ------------------------------------------------------------------------
9 cd tools/testing/selftests/rcutorture
10 zcat /initrd.img > /tmp/initrd.img.zcat
13 cpio -id < /tmp/initrd.img.zcat
14 ------------------------------------------------------------------------
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,
23 ------------------------------------------------------------------------
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
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
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
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
51 # compatibility symlink for the pre-oneiric locations
52 ln -s /run/initramfs /dev/.initramfs
54 # Export relevant variables
64 export init=/sbin/init
75 for i in /sys/devices/system/cpu/cpu*/online
78 '/sys/devices/system/cpu/cpu0/online')
80 '/sys/devices/system/cpu/cpu*/online')