1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- 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:
- ------------------------------------------------------------------------
- cd tools/testing/selftests/rcutorture
- 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
|