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 zcat /initrd.img > /tmp/initrd.img.zcat
12 cpio -id < /tmp/initrd.img.zcat
13 ------------------------------------------------------------------------
15 Interestingly enough, if you are running rcutorture, you don't really
16 need userspace in many cases. Running without userspace has the
17 advantage of allowing you to test your kernel independently of the
18 distro in place, the root-filesystem layout, and so on. To make this
19 happen, put the following script in the initrd's tree's "/init" file,
22 ------------------------------------------------------------------------
25 [ -d /dev ] || mkdir -m 0755 /dev
26 [ -d /root ] || mkdir -m 0700 /root
27 [ -d /sys ] || mkdir /sys
28 [ -d /proc ] || mkdir /proc
29 [ -d /tmp ] || mkdir /tmp
31 mount -t sysfs -o nodev,noexec,nosuid sysfs /sys
32 mount -t proc -o nodev,noexec,nosuid proc /proc
33 # Some things don't work properly without /etc/mtab.
34 ln -sf /proc/mounts /etc/mtab
36 # Note that this only becomes /dev on the real filesystem if udev's scripts
37 # are used; which they will be, but it's worth pointing out
38 if ! mount -t devtmpfs -o mode=0755 udev /dev; then
39 echo "W: devtmpfs not available, falling back to tmpfs for /dev"
40 mount -t tmpfs -o mode=0755 udev /dev
41 [ -e /dev/console ] || mknod --mode=600 /dev/console c 5 1
42 [ -e /dev/kmsg ] || mknod --mode=644 /dev/kmsg c 1 11
43 [ -e /dev/null ] || mknod --mode=666 /dev/null c 1 3
47 mount -t devpts -o noexec,nosuid,gid=5,mode=0620 devpts /dev/pts || true
48 mount -t tmpfs -o "nosuid,size=20%,mode=0755" tmpfs /run
50 # compatibility symlink for the pre-oneiric locations
51 ln -s /run/initramfs /dev/.initramfs
53 # Export relevant variables
63 export init=/sbin/init
74 for i in /sys/devices/system/cpu/cpu*/online
77 '/sys/devices/system/cpu/cpu0/online')
79 '/sys/devices/system/cpu/cpu*/online')