1 AUTHOR: Jim Gifford <lfs-hints at jg555.com>
5 LICENSE: GNU Free Documentation License Version 1.2
7 SYNOPSIS: initrd for LFS that will check and repair
8 ext2 and ext3 file system errors
10 DESCRIPTION: This hint will assist you in creating a initrd
11 for your LFS system, that will check for file
14 PREREQUISITES: SCSI and USB Modules must be in modules.conf
15 Linux built with modules.
16 RAM Disk support built in
18 Root Filesystem must be compiled in
23 Introduction to Initial RAMDisk
25 This hint will help you configure an LFS system for Initial RAMDisk.
26 Which will allow you to add modules at start-up instead of compiling them
29 The script will auto-detect all SCSI, IDE and USB modules and add them
30 to the initial ramdisk. It will also detect the root from the fstab file
32 The above items, upon research are best if configured into the kernel.
33 You can look at the help of each of the items for more information.
36 Assumptions Made in this document
38 I have made the following assumptions in this document.
39 Files have been downloaded.
42 Kernel Configuration for 2.4
44 You will need to make sure the following items are configured
45 in your kernel. With out these, the initrd will not work
49 <M> Loopback device support (or <*>)
51 (4096) Default RAM disk size
52 [*] Initial RAM disk (initrd) support
54 The root and initrd file system must be compiled into the kernel.
57 Kernel Configuration for 2.6
59 You will need to make sure the following items are configured
60 in your kernel. With out these, the initrd will not work
65 <M> Loopback device support (or <*>)
67 (4096) Default RAM disk size
68 [*] Initial RAM disk (initrd) support
70 The root and initrd file system must be compiled into the kernel.
76 The script has 2 choices of file systems.
79 ext2 and ext3 are the most common file systems
80 in use, but the initrd is usually bigger.
81 My initrd with ext3 was only 439k. Compressed with
90 Build as normal, but after install issue these commands
92 cp e2fsck/e2fsck.static /sbin/e2fsck.static
93 strip --strip-debug /sbin/e2fsck.static
99 http://busybox.net/downloads/busybox-1.00-pre3.tar.bz2
104 Busybox has changed the way the configure the shell. It now
105 uses a menu driven option very similar to make menuconfig
108 Here is the list of the options needed. Anything else
109 will add to the size of your initrd.
111 General Configuration --->
112 [*] Support for devfs
113 NOTE - only if you using devfs
115 [*] Build BusyBox as a static binary (no shared libs)
117 [*] echo (basic SUSv3 version taking no options
119 Linux Module Utilities --->
121 [*] Support version 2.1.x to 2.4.x Linux kernels
122 NOTE - only if your using a 2.4 kernel
123 [*] Support version 2.6.x Linux kernels
124 NOTE - only if your using a 2.6 kernel
125 Another Bourne-like Shell --->
126 [*] Enable alias support
127 [*] Optimize for size instead of speed
129 Linux System Utilities --->
133 The build size on my system was 502k, considerably smaller than
136 After running make menuconfig you will need to run the
140 cp busybox /bin/busybox.static.fsck
145 For those who do not want to type out the script. It is
146 available on my CVS server at
147 http://cvs.jg555.com/viewcvs.cgi/scripts/system
149 This script will create the initial RAM Disk image file.
150 By default this script creates /boot/initrd-fsck-{kernelversion}.img
152 I have sent a mkinitrd file to be placed
153 in the hints attachments at
154 http://www.linuxfromscratch.org/hints/downloads/attachments.
156 The default location for this file is /sbin
158 There are options on the new script, it will not just create
159 a initrd anymore. The kernel_version= is the only mandatory
162 Options are the following:
165 --kernel_version={version} = use kernel version
168 --ide = remove ide modules
169 --scsi = remove scsi modules
170 --usb = remove usb modules
171 --devfs = remove devfs settings from initrd
172 --initrdfs={ext2|ext3} = use either ext2 or ext3
173 --remove-module={module} = remove module
174 --add-module={module} = add module
179 The following script needs to placed in /etc/rc.d/init.d.
180 If you already have this script added, you do not need to
181 add it again. This is the same one from the initrd hint.
183 You will then need to link it to rcsysinit.d.
185 It is recommended that this script be run right after
188 To link the script change to the /etc/rc.d/rcsysinit.d
189 directory and issue the following command.
191 ln -sf ../init.d/initrd S41initrd
194 # Begin $rc_base/init.d/initrd
196 # Based on sysklogd script from LFS-3.1 and earlier.
197 # Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org
199 source /etc/sysconfig/rc
202 echo "Clearing Initial RAM Disk..."
203 if [ -e /initrd/dev/.devfsd ]
209 blockdev --flushbufs /dev/ram0
211 # End $rc_base/init.d/initrd
216 In order to use the initrd.img file is to add the
217 following entry to you lilo.conf file.
219 initrd=/boot/initrd-fsck.img
221 So your lilo.conf should look something like this.
223 image=/boot/vmlinuz-2.4.18
225 initrd=/boot/initrd-fsck-2.4.18.img
228 If you are just testing. You should make a separate
229 entry in lilo.conf. This will still allow you to boot.
234 In order to use the initrd.img file is to add the
235 following entry to you menu.lst file.
237 initrd /boot/initrd-fsck-2.4.18.img
239 So your menu.lst should look something like this.
243 kernel /boot/vmlinuz-2.4.18
244 initrd /boot/initrd-fsck-2.4.18.img
249 In order to use the initrd.img file is to add the
250 following to syslinux.cfg file.
252 append initrd=initrd-fsck-2.4.18.img
254 So your syslinux.cfg should look something like this.
258 append root=/dev/ram0 initrd=initrd-fsck.img
264 CHANGELOG: 1.3 Updated Configurations
265 1.2 Updated for 2.6 Kernel
269 New Version of this document can be viewed from http://cvs.jg555.com/viewcvs.cgi/lfs-hints