Digging into an initrd File



Please refer to Redhat disk mod for complete information. That page will eventually replace this page.




Unpacking an initrd


# Make and change to a temporary directory
mkdir /tmp/initrdtesting
cd /tmp/initrdtesting

# Grab an initrd you want to work with
cp /boot/initrd.img .

# Rename the initrd
mv initrd.img initrd.ext2.gz

# Unzip the initrd
gunzip initrd.ext2.gz

# Create a blank directory to mount the initrd to
mkdir initrd.dir

# Mount the initrd filesystem
mount initrd.ext2 initrd.dir -o loop

# Investigate your initrd
cd initrd.dir


Inspecting the initrd

When initrd boots, it immediately runs /linuxrc

SCSI modules are located in the /lib directory

bin
insmod
sash
dev
console (5,1)
null (1,3)
ram (1,1)
systty (4,0)
tty1 (4,1)
tty2 (4,2)
tty3 (4,3)
tty4 (4,4)
etc
lib
ncr53c8xx.o
linuxrc
loopfs

Contents of linuxrc
#!/bin/sash

aliasall

echo "Loading ncr53c8xx module"
insmod /lib/ncr53c8xx.o



Repacking the initrd

Leave a Comment