LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-09-2009, 04:06 AM   #1
harrywertm
LQ Newbie
 
Registered: May 2009
Posts: 1

Rep: Reputation: 0
Modify INITRD without MKINITRD?


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
 
Old 05-10-2009, 01:35 AM   #2
Valery Reznic
ELF Statifier author
 
Registered: Oct 2007
Posts: 676

Rep: Reputation: 137Reputation: 137
Quote:
Originally Posted by harrywertm View Post
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
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to create new initrd.gz (or initrd.img) file? kkpal Programming 2 12-10-2007 08:38 AM
Failed to symbolic-link boot/initrd.img-2.6.18-4-486 to initrd.img Scotteh Linux - Software 8 06-01-2007 11:24 PM
mkinitrd ? anti.corp Slackware 1 11-27-2005 01:51 PM
How to modify the library path variable?modify the Electronkz Linux - Newbie 1 04-13-2004 06:18 AM
modify file access & modify timestamps i2itstud Linux - General 1 05-20-2003 03:34 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:55 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration