The first thing you need to do is download the LZMA lzma compressor/decompressor which is part of the LZMA SDK.
http://prdownloads.s...ar.bz2?downloadThen follow the steps in the link I posted to compile and install the compressor/decompressor.
CODE
mkdir lzma
cd lzma
tar xvjf ../lzma432.tar.bz2
cd SRC/7zip/Compress/LZMA_Alone
dos2unix makefile
make
This should give you a executable called
lzma. Copy this somewhere in your path (I copied it to /usr/local/bin).
Then to decompress the initrd.7z, saving the result as initrd:
CODE
lzma d initrd.7z initrd
Then to mount the initrd and make changes use:
CODE
mkdir loop
mount -o loop -t ext2 initrd loop
This should mount the initrd in the loop directory. You can then look at / edit the contents by manipulating the files in the loop directory. When you are done unmount this directory (umount loop).
Finally to recompress the initrd use:
CODE
lzma e initrd initrd.7z -d16
The actual script I use to create the image is below. It's slightly different to the procedure outlined above because
1) I already have the contents of the initrd in a directory (called source).
2) I recreate the initrd image each time from the source directory rather than editing the exiting one. This is to make sure no space is wasted.
CODE
#!/bin/sh
# Make a blank image
dd if=/dev/zero of=initrd bs=1024k count=4
# Format image as ext2
mke2fs -F -N 8192 -m0 -b 1024 initrd
# Mount ext2 image
mkdir loop
mount -t ext2 -o loop initrd loop
# Copy source files to ext2 image
cp -a source/* loop
umount initrd
rm -r loop
# Compress ext2 image using lzma
lzma e initrd initrd.7z -d16
# Cleanup
rm initrd
Because dealing with lzma compressed files is a bit of a hassle I've uploaded also
gzip'd version of the ext2 initrd. The contents are exactly the same, the only difference is the compression method. You might find it easier to modify this since you don't need to install the LZMA SDK.