aboutsummaryrefslogtreecommitdiff
path: root/rcutorture/doc/initrd.txt
blob: 49d134c25c04e684dfcf6a9aa278c742a9074843 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
This document describes one way to create the initrd directory hierarchy
in order to allow an initrd to be built into your kernel.  The trick
here is to steal the initrd file used on your Linux laptop, Ubuntu in
this case.  There are probably much better ways of doing this.

That said, here are the commands:

------------------------------------------------------------------------
zcat /initrd.img > /tmp/initrd.img.zcat
mkdir initrd
cd initrd
cpio -id < /tmp/initrd.img.zcat
------------------------------------------------------------------------

Interestingly enough, if you are running rcutorture, you don't really
need userspace in many cases.  Running without userspace has the
advantage of allowing you to test your kernel independently of the
distro in place, the root-filesystem layout, and so on.  To make this
happen, put the following script in the initrd's tree's "/init" file,
with 0755 mode.

------------------------------------------------------------------------
#!/bin/sh

[ -d /dev ] || mkdir -m 0755 /dev
[ -d /root ] || mkdir -m 0700 /root
[ -d /sys ] || mkdir /sys
[ -d /proc ] || mkdir /proc
[ -d /tmp ] || mkdir /tmp
mkdir -p /var/lock
mount -t sysfs -o nodev,noexec,nosuid sysfs /sys
mount -t proc -o nodev,noexec,nosuid proc /proc
# Some things don't work properly without /etc/mtab.
ln -sf /proc/mounts /etc/mtab

# Note that this only becomes /dev on the real filesystem if udev's scripts
# are used; which they will be, but it's worth pointing out
if ! mount -t devtmpfs -o mode=0755 udev /dev; then
	echo "W: devtmpfs not available, falling back to tmpfs for /dev"
	mount -t tmpfs -o mode=0755 udev /dev
	[ -e /dev/console ] || mknod --mode=600 /dev/console c 5 1
	[ -e /dev/kmsg ] || mknod --mode=644 /dev/kmsg c 1 11
	[ -e /dev/null ] || mknod --mode=666 /dev/null c 1 3
fi

mkdir /dev/pts
mount -t devpts -o noexec,nosuid,gid=5,mode=0620 devpts /dev/pts || true
mount -t tmpfs -o "nosuid,size=20%,mode=0755" tmpfs /run
mkdir /run/initramfs
# compatibility symlink for the pre-oneiric locations
ln -s /run/initramfs /dev/.initramfs

# Export relevant variables
export ROOT=
export ROOTDELAY=
export ROOTFLAGS=
export ROOTFSTYPE=
export IP=
export BOOT=
export BOOTIF=
export UBIMTD=
export break=
export init=/sbin/init
export quiet=n
export readonly=y
export rootmnt=/root
export debug=
export panic=
export blacklist=
export resume=
export resume_offset=
export recovery=

for i in /sys/devices/system/cpu/cpu*/online
do
	case $i in
	'/sys/devices/system/cpu/cpu0/online')
		;;
	'/sys/devices/system/cpu/cpu*/online')
		;;
	*)
		echo 1 > $i
		;;
	esac
done

while :
do
	sleep 10
done