[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC][PATCH] vmlinux/vmlinux.bin loading capability
From: |
Hollis Blanchard |
Subject: |
Re: [RFC][PATCH] vmlinux/vmlinux.bin loading capability |
Date: |
Sun, 06 Aug 2006 19:52:58 -0500 |
On Thu, 2006-08-03 at 00:57 -0600, Maciek Nowacki wrote:
>
> 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.
>
> vmlinux.bin is a derivative of the vmlinux kernel executable that is produced
> by:
>
> objcopy -O binary linux-2.6.xx/vmlinux vmlinux.bin
I have no comments on your motivation, but I do think that a binary
loader would be valuable. In that case, it might make sense to refactor
this code into a "binary" loader that exports a function that your Linux
binary loader calls. Then you can isolate all this "linux_kernel_header"
stuff from the binary loader.
You want to combine these lines:
+ asm( "movl %0,%%esi" :: "m" (lh) );
+ asm("jmp *%0" :: "m" (begin));
into a single asm statement (and make it volatile too). Otherwise, the
compiler can insert instructions between the asm statements (especially
at -O0), making you a very sad debugger.
There are pretty flagrant coding style violations all over the place, so
I won't comment on those. I will however say that "/* notes: grub leaks
memory. */" is an extraordinarily bad way to submit a bug report.
Finally, please don't call this a "vmlinux" loader. vmlinux is an ELF
file. What you're loading is not.
-Hollis