1This document describes one way to create the initrd directory hierarchy
2in order to allow an initrd to be built into your kernel.  The trick
3here is to steal the initrd file used on your Linux laptop, Ubuntu in
4this case.  There are probably much better ways of doing this.
5
6That said, here are the commands:
7
8------------------------------------------------------------------------
9cd tools/testing/selftests/rcutorture
10zcat /initrd.img > /tmp/initrd.img.zcat
11mkdir initrd
12cd initrd
13cpio -id < /tmp/initrd.img.zcat
14------------------------------------------------------------------------
15
16Interestingly enough, if you are running rcutorture, you don't really
17need userspace in many cases.  Running without userspace has the
18advantage of allowing you to test your kernel independently of the
19distro in place, the root-filesystem layout, and so on.  To make this
20happen, put the following script in the initrd's tree's "/init" file,
21with 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
31mkdir -p /var/lock
32mount -t sysfs -o nodev,noexec,nosuid sysfs /sys
33mount -t proc -o nodev,noexec,nosuid proc /proc
34# Some things don't work properly without /etc/mtab.
35ln -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
39if ! 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
45fi
46
47mkdir /dev/pts
48mount -t devpts -o noexec,nosuid,gid=5,mode=0620 devpts /dev/pts || true
49mount -t tmpfs -o "nosuid,size=20%,mode=0755" tmpfs /run
50mkdir /run/initramfs
51# compatibility symlink for the pre-oneiric locations
52ln -s /run/initramfs /dev/.initramfs
53
54# Export relevant variables
55export ROOT=
56export ROOTDELAY=
57export ROOTFLAGS=
58export ROOTFSTYPE=
59export IP=
60export BOOT=
61export BOOTIF=
62export UBIMTD=
63export break=
64export init=/sbin/init
65export quiet=n
66export readonly=y
67export rootmnt=/root
68export debug=
69export panic=
70export blacklist=
71export resume=
72export resume_offset=
73export recovery=
74
75for i in /sys/devices/system/cpu/cpu*/online
76do
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
86done
87
88while :
89do
90	sleep 10
91done
92