xref: /linux/tools/testing/selftests/rcutorture/doc/initrd.txt (revision 38e630424ba304dbe07ae52aa78d1ed6d38d9f75)
1*38e63042SPaul E. McKenneyThe rcutorture scripting tools automatically create the needed initrd
2*38e63042SPaul E. McKenneydirectory using dracut.  Failing that, this tool will create an initrd
3*38e63042SPaul E. McKenneycontaining a single statically linked binary named "init" that loops
4*38e63042SPaul E. McKenneyover a very long sleep() call.  In both cases, this creation is done
5*38e63042SPaul E. McKenneyby tools/testing/selftests/rcutorture/bin/mkinitrd.sh.
6c87b9c60SPaul E. McKenney
7*38e63042SPaul E. McKenneyHowever, if you are attempting to run rcutorture on a system that does
8*38e63042SPaul E. McKenneynot have dracut installed, and if you don't like the notion of static
9*38e63042SPaul E. McKenneylinking, you might wish to press an existing initrd into service:
10c87b9c60SPaul E. McKenney
11c87b9c60SPaul E. McKenney------------------------------------------------------------------------
12616fd166SPaul E. McKenneycd tools/testing/selftests/rcutorture
13c87b9c60SPaul E. McKenneyzcat /initrd.img > /tmp/initrd.img.zcat
14c87b9c60SPaul E. McKenneymkdir initrd
15c87b9c60SPaul E. McKenneycd initrd
16c87b9c60SPaul E. McKenneycpio -id < /tmp/initrd.img.zcat
17*38e63042SPaul E. McKenney# Manually verify that initrd contains needed binaries and libraries.
18e5731b58SBoqun Feng------------------------------------------------------------------------
19e5731b58SBoqun Feng
20c87b9c60SPaul E. McKenneyInterestingly enough, if you are running rcutorture, you don't really
21c87b9c60SPaul E. McKenneyneed userspace in many cases.  Running without userspace has the
22c87b9c60SPaul E. McKenneyadvantage of allowing you to test your kernel independently of the
23c87b9c60SPaul E. McKenneydistro in place, the root-filesystem layout, and so on.  To make this
24c87b9c60SPaul E. McKenneyhappen, put the following script in the initrd's tree's "/init" file,
25c87b9c60SPaul E. McKenneywith 0755 mode.
26c87b9c60SPaul E. McKenney
27c87b9c60SPaul E. McKenney------------------------------------------------------------------------
28c87b9c60SPaul E. McKenney#!/bin/sh
29c87b9c60SPaul E. McKenney
30c87b9c60SPaul E. McKenneywhile :
31c87b9c60SPaul E. McKenneydo
32c87b9c60SPaul E. McKenney	sleep 10
33c87b9c60SPaul E. McKenneydone
34e5731b58SBoqun Feng------------------------------------------------------------------------
35e5731b58SBoqun Feng
36*38e63042SPaul E. McKenneyThis approach also allows most of the binaries and libraries in the
37*38e63042SPaul E. McKenneyinitrd filesystem to be dispensed with, which can save significant
38*38e63042SPaul E. McKenneyspace in rcutorture's "res" directory.
39