Saturday, November 18, 2006

How to open slackware's initramfs image file

Here are a step by step what I've done when try to open an initramfs file which come with slackware installation stuff (either using CD/DVD installation or an iso image). I just want to know what are on an initrd.img file (an initramfs itself) which located in directory isolinux.
Before I give the command, I would like to explain you how an initramfs image created with slackware. There is a tool to do this, mkinitrd, and it's only a bash script file. A part of source which exactly generate an initramfs image is on a build_initrd_image() procedure. Here is the source:

# Wrap the initrd as an initramfs image and move it into place:
( cd $SOURCE_TREE
rm -f $OUTPUT_IMAGE
find . | cpio -o -H newc | gzip -9c > $OUTPUT_IMAGE
)

Now we know how an initramfs image created, and we can simply extract it with a gunzip tool first and followed with a cpio tool. a complete command is looks like this:

gunzip -c initrd.img | cpio -i -d -H newc --no-absolute-filenames

I prefer if you doing all of this activity in new directory. first, copy an initrd.img's file into your new directory
and make sure you have write access on that directory. And now, you can run that command inside that directory.
If there is an error message like this : "cpio: Operation not permitted", you can try to run the command with user root.


hope this helpful.

No comments:

Post a Comment