Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

jor1k ships a vmlinux.bin. I think there is an initrd inside, cause I don't know where else it would be. I am trying to extract the filesystem image so I can change it, but I don't know how to.

I tried using extract-vmlinux from the Linux source distribution, but it Cannot find vmlinux.

share|improve this question

2 Answers 2

up vote 5 down vote accepted

You can look for the cpio newc header (starting with 0707010):

$ grep -abo 0707010 vmlinux.bin | head -n1
2531404:0707010

The -a (for all files even binary ones), -b (for byte offset), and -o (for only the matching part (and report the byte offset of the matching part instead of the line containing the matching part)) are non-standard GNU extensions to grep but are handy to find out where a given string is to be found in a file (contrary to many other grep implementations, GNU grep also supports non-text files (that is, that may contain 0 byte values may have arbitrarily long sequence of bytes between two LF characters, may not end in a LF characters or may contain bytes or sequences of bytes that don't make valid characters in the current locale) which is a requirement in that regard.

$ tail -c +2531405 vmlinux.bin| cpio -t | head
bin
bin/sleep
bin/kill
bin/watch
bin/deluser
bin/getopt
bin/uname
bin/nice
bin/zcat
bin/cpio

(grep -b offsets start at 0, while tail -c ones start at 1).

share|improve this answer
    
Thanks! I was searching for ext2 headers (0xEF53) manually, but I got false positives. Tried flipping the byte order, got other false positives. That demotivated me. Surprising how extract-vmlinux can't find CPIO initramfs'es, but I'm sure there is an explanation. –  Janus Troelsen Apr 29 '13 at 7:42

The first step is file vmlinux.bin.

Sorry, but "vmlinux.bin: data" usually means so much for this. If file doesn't recognize a file then the standard utilities will not be able to help you.

But from reading the download page it seems that this is the OpenRISC 1000 version of the Linux kernel. Thus it makes perfect sense that file does not recognize it.

I don't know OpenRISC 1000 but I guess that in such a special case there is no need for an initrd.

share|improve this answer
    
yes, I tried that. returns: "vmlinux.bin: data". try it out, I linked it. –  Janus Troelsen Apr 28 '13 at 23:50

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.