Quote:
Originally Posted by harrywertm
For various reasons -- one goal is smaller bootfiles -- I want to modify INITRD without using MKINITRD. I tried:
--copied INITRD.GZ to a workspace
--ungzipped it
--mounted the uncompressed INITRD as a loop device
--deleted some files
--made an image of the modified loop device [[dd if=loop device of=new image file]]
--compressed the new image with GZIP.-9
I succeeded booting until the boot process hit a necessary file intentionally deleted, proving I had modified INITRD.GZ without completely destroying it
Problem is, my new INITRD.GZ was nowhere near as small as it should have been, proving there is something basically wrong with this method of modification. What is wrong?
I used HAL91 for this experiment, an amazing one-floppy distro.
-Harry Wertmuller
|
First of all there is missing 'umount' between 'deleted some files' and 'made an image'.
Another problem is following.
When you delete some files it's doesn't destroy file content. So when you later gzip whole image you got initrd.gz nearky same size. In order to achieve better compression you have fill deleted files with nulls.
Let say you loop device mounted on /mnt
You can use command
Code:
dd if=/dev/zero of=/mnt/dummy
to fill with zero every free block on your loop device.
It should help to reduce .gz size
Or another option create new image file with
Code:
dd if=/dev/zero of=new_image_file bs=new_image_file_size
Create filesystem here, mount it and copy here only file that you need