[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RFC][PATCH] vmlinux/vmlinux.bin loading capability

From: Maciek Nowacki
Subject: [RFC][PATCH] vmlinux/vmlinux.bin loading capability
Date: Thu, 03 Aug 2006 00:57:00 -0600
User-agent: Mutt/1.5.12-2006-07-14


Here is an attempt at a patch to load and execute a vmlinux kernel image,
only tested with QEMU for x86_64. It is very preliminary, excludes a large
amount of planned functionality, and so far only boots the raw vmlinux.bin
file found in arch/[x86_64,i386]/boot/vmlinux.bin after compiling Linux with
the 'make vmlinux' target (and 'make bzImage' as well). This means that the
user must supply the entry point of the kernel on the GRUB command line. This
nastiness will be easily removed once vmlinux is used in place of

vmlinux.bin is a derivative of the vmlinux kernel executable that is produced

objcopy -O binary linux-2.6.xx/vmlinux vmlinux.bin

My reasons for doing this are:
- eliminating real-mode code from the kernel image (and ultimately 32-bit
  code, in x86-64)
- allowing GRUB to have more control over the boot process
- removing the decompression code from the kernel image - instead delegating
  decompression to the bootloader, as an optional feature
- simplying Linux compilation by making all targets aside from
  vmlinux/modules redundant (indeed, even is redundant with a full
  vmlinux present).

If vmlinux is too large, it is always possible to strip(1). With compression,
it becomes very close to the size of a bzImage:

$ gzip -9c vmlinux > vmlinux.gz
$ bzip2 -9c vmlinux > vmlinux.bz2
$ strip -o vmlinux_str vmlinux
$ gzip -9c vmlinux_str > vmlinux_str.gz
$ bzip2 -9c vmlinux_str > vmlinux_str.bz2
$ ls -ltcr vmlinux*
-rwxrwxr-x 1 maciek maciek 47308143 Jul 30 21:53 vmlinux*
-rw-rw-r-- 1 maciek maciek 19453585 Aug  3 00:47 vmlinux.gz
-rw-rw-r-- 1 maciek maciek 16795427 Aug  3 00:47 vmlinux.bz2
-rwxrwxr-x 1 maciek maciek  7140752 Aug  3 00:47 vmlinux_str*
-rw-rw-r-- 1 maciek maciek  1856381 Aug  3 00:48 vmlinux_str.gz
-rw-rw-r-- 1 maciek maciek  1757941 Aug  3 00:48 vmlinux_str.bz2
$ ls -l arch/x86_64/boot/bzImage
-rw-rw-r-- 1 maciek maciek 1832285 Jul  9 18:51 arch/x86_64/boot/bzImage

(bzImage and vmlinux are not representative of the same .config - but it is
very close. Admittedly the vmlinux .config defines a slightly smaller
kernel image.)

Of course I am aware that GRUB does not currently support bzip2
decompression. However, should it gain this feature, the kernel on-disk size
would decrease compared to bzImage.

Please let me know what you think. I have included an updated version of my bash script which includes an example invocation of the vmlinux
loader (however, it seems that GRUB truncates the command line...? I have not
yet investigated this).


Attachment: vmlinux.patch
Description: Text document

Description: Bourne shell script

reply via email to

[Prev in Thread] Current Thread [Next in Thread]