Editing the initrd

Miscellaneous tools
Post Reply
Message
Author
User avatar
LazY Puppy
Posts: 1934
Joined: Fri 21 Nov 2014, 18:14
Location: Germany

Editing the initrd

#1 Post by LazY Puppy »

Hi.

This Program is a new improved version of Edit-Initrdgz-1.4.pet including its right-click version, Edit-Initrdgz-rtc-0.3.pet.

I have combined them and updated this for the use of initrd.xz (like in Lighthouse64) and for the use of initrd (like in FatDog64). Both, GUI and right-click Action, are now able to unpack and repack the files initrd, initrd.gz and initrd.xz.

Edit-Initrdgz-1.4.pet has been downloaded 994 Times and Edit-Initrdgz-rtc-0.3.pet has been downloaded 453 Times by now. Looks like these have been very useful Tools in the past.

Since I'm owning now a 64 bit machine, I'm currently testing some of the available 64 bit Puppies and trying to do some work on these. For this to do I've had needed first a tool to unpack and repack the different types of the initrd file.

So here it is: Edit-Initrdgz-1.5.pet

The initrd file will be expanded to /root/Init_rd_tmp.
Attachments
Edit-Initrdgz-1.5.pet
Unpack and repack the files initrd, initrd.gz and initrd.xz
(11.29 KiB) Downloaded 684 times
Last edited by LazY Puppy on Thu 15 Jan 2015, 15:15, edited 1 time in total.
RSH

"you only wanted to work your Puppies in German", "you are a separatist in that you want Germany to secede from Europe" (musher0) :lol:

No, but I gave my old drum kit away for free to a music store collecting instruments for refugees! :wink:

User avatar
LazY Puppy
Posts: 1934
Joined: Fri 21 Nov 2014, 18:14
Location: Germany

#2 Post by LazY Puppy »

stemsee wrote:@LazyPuppY

initrd.img? DebianDog also initrd1.img .xz.gz
He wrote this in the FatDog Topic, which I won't hijack, so I put this here.

There is also initrd.lzo, used by rufwoof and probably some more. I'm willing to extend and to update this again, but I need code examples of how to pack and unpack:

- .xz.gz
- .img
- .lzo

Just post some code examples for it and I will include it into the next version of Edit-Initrdgz package.
RSH

"you only wanted to work your Puppies in German", "you are a separatist in that you want Germany to secede from Europe" (musher0) :lol:

No, but I gave my old drum kit away for free to a music store collecting instruments for refugees! :wink:

Dry Falls
Posts: 616
Joined: Tue 16 Dec 2014, 23:37
Location: Upper Columbia

initrd-edit

#3 Post by Dry Falls »

There's also this within the initrd.xz and on Lighthouse development tools:
http://www.murga-linux.com/puppy/viewto ... c91bd84060
Initrd.gz isn't actually a compressed filesystem anymore (definitely since 3.00, possibly since 2.17). It's now a compressed cpio archive. To extract it, do something like this:

[Updated 110922] Lighthouse 64 5.13+ uses xz to compress instead of gzip:

Code: Select all

mkdir initrd-tree; cd initrd-tree/; xzcat ../initrd.xz | cpio -d -i -m
That assumes you're using a terminal in the same place as the initrd.xz file.
It dumps the innards into a directory named initrd-tree/ in that location.

To put it back together, run these from inside that initrd-tree/ directory:

Code: Select all

mv ../initrd.xz ../initrd.xz.`date +"%Y.%m.%d_%T"
` # to save prior version

Code: Select all

find . | cpio -o -H newc | xz --check=crc32 --x86 --lzma2=dict=512KiB > ../initrd.xz
ps, I really liked LazyPuppy -- my second pup after lupu5.28 and a great learning tool. Thanks.

df

User avatar
rufwoof
Posts: 3690
Joined: Mon 24 Feb 2014, 17:47

#4 Post by rufwoof »

It's similar to unpack a lzo

mkdir initrd-tree
cd initrd-tree
lzopcat ../initrd.lzo | cpio -id

to repack

find | cpio -o -H newc | lzop -c1 >../initrd.lzo.new

(assuming level 1 compression, which I find to be about the best all-rounder. Not so tight on fast (level 1) compression, but still decent (around 20% larger than gzip). But (much) quicker on decompression speed - typically > x2 faster. i.e. would you rather have one person with 10 boxes to open that averages 10 seconds per box, or another person with 12 boxes to open that averages less than 5 seconds per box).

Post Reply