You are not logged in.

#1 2008-11-10 13:40:02

paraflu
Member
Registered: 2008-02-23
Posts: 53

How to mount kernel26.img

Hello,

everyone

I would like mount the init-img of the kernel.
I`ve tried:
gunzip -dc /boot/kernel26.img >/anywhere/kernel26.dec.img
and then
mount -o loop /anywhere/kernel26.dec.img /elsewhere/
but didn`t have any success.
Then mount -t ext2 -o loop /anywhere/kernel26.dec.img /elsewhere/
Same here.

Is the init.img really a file system or something else.
I would like to look at the kinit-img.
Oh and between i looked and decompressed image with an hex
and it contains some path-like cleartext.
Can anybody help me here?

Offline

#2 2008-11-10 14:05:51

pyther
Member
Registered: 2008-01-21
Posts: 1,395
Website

Re: How to mount kernel26.img

Well file give this information on the uncompressed kernel26.img

uncopmress.img: ASCII cpio archive (SVR4 with no CRC)

However any attempt to uncompress it or list the files just fails.

Last edited by pyther (2008-11-10 14:08:19)


Website - Blog - arch-home
Arch User since March 2005

Offline

#3 2008-11-10 14:40:13

bender02
Member
From: UK
Registered: 2007-02-04
Posts: 1,328

Offline

#4 2008-11-10 14:42:39

paraflu
Member
Registered: 2008-02-23
Posts: 53

Re: How to mount kernel26.img

Thank you for your fast reply.
i`ve tried :
http://www.meinews.net/cpio-t170074.htm … 1359b1a6c&

with
$ mkdir work
$ cd work
$ zcat ../initird | cpio -iv

but it didn`t decompress the files and with directory parameter it
only says xxxx Blocks. By the way don`t try it as root, because the files have
absolute paths!
I could look into the degzipped file with archive-manager.
Which is enough at the moment, but in the above page, it is mentioned
that i could put in changes of the image back into a gzipped image as the original
one.
Maybe some has one idea or experience in this. Let`s wait.

Offline

#5 2008-11-10 15:46:58

bender02
Member
From: UK
Registered: 2007-02-04
Posts: 1,328

Re: How to mount kernel26.img

Once again: http://wiki.archlinux.org/index.php/Mki … r_the_hood
Both methods there work for me.

Offline

#6 2008-11-10 16:19:48

paraflu
Member
Registered: 2008-02-23
Posts: 53

Re: How to mount kernel26.img

Thank you,

bender02

As you mentioned "once again", i am a little bit ashamed.
I should have looked in the wiki, but i didn`t thought
this case would even be mentioned.
I didn`t have heard about cpio and for my excuse, i looked
for "mount kernel26.img". I thought it would be an image,
  overlayed by gzip. Very nice that you repeat this case again.
For completing the wiki or better say for extracting the files into
a chosen dir, it would be like that:
zcat /boot/kernel26.img | cpio -id --no-absolute-filenames "target-dir"
You help me a lot. If you can, could you tell my how to change the files
and then create a img like the original one with absolute paths, out of the
"target-dir"?

Thanks for your answers

Offline

#7 2008-11-10 23:23:28

bender02
Member
From: UK
Registered: 2007-02-04
Posts: 1,328

Re: How to mount kernel26.img

Sorry, I could have said that it's impossible to just mount the first time smile

For assembling it back (change the filenames as needed) (to be run as root) (make sure that you also extract the image as root in the first place, since it contains some device nodes, which regular users are not allowed to create):
cd /tmp/initrd
find . | cpio -o -H newc > /tmp/initrd.temp
gzip -c /tmp/initrd.temp > /boot/kernel26.img

EDIT: As far as editing files goes: once you extract the image, you can edit the extracted files normally, as any other files. After you're done editing, just compress it back with the method above.

Last edited by bender02 (2008-11-10 23:26:15)

Offline

Board footer

Powered by FluxBB