Difference between revisions of "Initrd"

From Linuxintro
imported>ThorstenStaerk
(Created page with "This is how you modify an initrd: mkdir tmp cd tmp cp ../initrd ./initrd.gz gunzip initrd.gz mkdir tmp2 cd tmp2 cpio -id < ../initrd Do the needed changes now in this...")
 
imported>ThorstenStaerk
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
This is how you modify an initrd:
+
The [[Linux boot process]] will first mount an initial [[ramdisk]] to mount the [[harddisk]]s. This is how you modify an initrd:
  
 
  mkdir tmp
 
  mkdir tmp
 
  cd tmp
 
  cd tmp
  cp ../initrd ./initrd.gz
+
  cp /boot/initrd initrd.gz
 
  gunzip initrd.gz
 
  gunzip initrd.gz
 
  mkdir tmp2
 
  mkdir tmp2
 
  cd tmp2
 
  cd tmp2
  [[cpio]] -id < ../initrd
+
  [http://linux.die.net/man/1/cpio cpio] -id < ../initrd  
 
Do the needed changes now in this folder. Then pack the initrd again:
 
Do the needed changes now in this folder. Then pack the initrd again:
  [[find]] . | cpio --create --format='newc' > ../newinitrd
+
  /tmp/tmp2 # find . | cpio --create --format='newc' > ../newinitrd
  cd ..
+
  40242 blocks
  [[gzip]] newinitrd
+
/tmp/tmp2 # cd ..
 +
  /tmp # gzip newinitrd
 
Your new [[initrd]] is now called newinitrd.gz.
 
Your new [[initrd]] is now called newinitrd.gz.
  
 
= See also =
 
= See also =
 
* [[pXe]]
 
* [[pXe]]
 +
* http://unix.stackexchange.com/questions/89923/how-does-linux-load-the-initrd-image

Latest revision as of 11:26, 20 August 2014

The Linux boot process will first mount an initial ramdisk to mount the harddisks. This is how you modify an initrd:

mkdir tmp
cd tmp
cp /boot/initrd initrd.gz
gunzip initrd.gz
mkdir tmp2
cd tmp2
cpio -id < ../initrd 

Do the needed changes now in this folder. Then pack the initrd again:

/tmp/tmp2 # find . | cpio --create --format='newc' > ../newinitrd
40242 blocks
/tmp/tmp2 # cd ..
/tmp # gzip newinitrd

Your new initrd is now called newinitrd.gz.

See also