Updated April 16, 2003
Created April 16, 2003


Autogenerated Site Map
Search this Site!:
Search this site powered by FreeFind


The other day we needed to modify the vmlinux portion of a vmlinuz file. We used the following tool (/usr/src/linux-2.4/arch/i386/boot/tools/build.c) to do that. It was a little difficult to use that tool, so we created an interim solution (which isn't fully tested so user beware). Here's the download and the notes for it:

The bzImage consists of three parts
boot block: This is a 512 bytes with the signature 55aa in offset 510 and 511, respectively.
setup block: This is boot code that comprehends "gunzipping" what is following.
vmlinux: This is the code which is generated on the top level of the kernel source and can be disassembled with objdump.

This tool vmlinuz.tgz which contains the following files:
mkvmlinux
lxbuild.c

will accomplish assembling and disassembling those pieces from/to bzImage.

Syntax:
mkvmlinux [-b] [-i | -o] bzImage bootsect setup vmlinux [rootdev]

-b : Hint that this is a big kernel (not needed)
-i : Input mode: Reads bzImage and produces bootsect setup vmlinux
-o: Output mode: Reads bootset, setup, vmlinux and write bzImage
rootdev: either CURRENT FLOPPY (will put a signature into bootblock for either current device node or floppy device node).

Caveat emptor: Not much testing done. Is loosely based on the build.c in the arch/i386/boot/tools directory.
Maybe, it will be handy.


The reason we needed to modify the vmlinux was that we built a new kernel, but the versioning information was all wrong (modversions) if I wanted to use our current CD-Roms that already have modules built for the kernel we are replacing. i.e. The new kernel with the new versioning info would refuse to load the modules on the CD-Rom that were built for the prior kernel with the prior versioning info. You may well say "just burn another CD-Rom", but for us that isn't that simple, so basically that's not an option for us at this late date in time. Using the following method we were able to make the new kernel work with the old modules. Hooray!

This tool works for both vmlinux and .o files. It may take a while to run, but it sure is worth it in our case by not having to remaster the CD-Rom with the old modules on there.

more details to follow (4/16/03) ...







Search this Site!:
Search this site powered by FreeFind

Homepage: http://www.cpqlinux.com
Site Map: http://www.cpqlinux.com/sitemap.html