开发者

Compiling the Linux kernel as non-ELF

recently some distributions started to pack the vmlinuz file together with the initrd in an "ELF-Boot" imagine that arguably has some advantages. Well, I need to compile a new kernel using the old format for the vmlinuz file. Does anyone know how can I achieve this? I'm using Oracle Enterprise Linux and if I run, for example, "make bzImage", the result is an ELF file that I cannot use.

Alternatively, is there a way to unpa开发者_如何学Gock an ELF-Boot image and extract the conventional vmlinuz file?

To clarify, what I get now when I do a "file /boot/vmlinuz" is:

vmlinuz: ELF 64-bit LSB shared object, AMD x86-64, version 1, stripped

What I want to obtain, however, is something like:

vmlinuz: Linux/x86 Kernel, Setup Version 0x20a, bzImage, Version 2.6.37, Version 2.6.37-40, RO-rootFS, root_dev 0x301, swap_dev 0x4, Normal VGA

Thanks for any help!


1.Modify the Makefile and add -O binary to the objcopy cmd, such as follow:

in linux-3.7.4/arch/x86/boot/compressed/Makefile:

OBJCOPYFLAGS_vmlinux.bin := -R .comment -S **-O binary**

    $(obj)/vmlinux.bin: vmlinux FORCE 

        $(call if_changed,objcopy)

2.Comment parse_elf, such as follow:

in linux-3.7.4/arch/x86/boot/compressed/misc.c

asmlinkage void decompress_kernel(...)

{

    ...

    decompress(input_data, input_len, ...);

    /* parse_elf(output); */

    ...

}


Linux uses ELF kernel images for quite some time, this is not some recent development. So why do you think you can't use a ELF image?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜