Michael Schierl <[EMAIL PROTECTED]> writes:

> Eric W. Biederman schrieb:
>> Horms <[EMAIL PROTECTED]> writes:
>>
>>> On Tue, Jun 13, 2006 at 09:24:34PM +0200, Michael Schierl wrote:
>>>> [please cc: me since I am not subscribed on the list]
>>>>
>>>> Hi,
>>>>
>>>> First, If this is the wrong list to discuss kexec, please tell me. It is
>>>> hard to find any homepage or documentation about kexec in the web.
>>>>
>>>> I am trying to use kexec to run some X86 real-mode code from Linux. I tried
>>>> to mimic a bzImage file, but although GRUB and ISOLINUX load it, kexec (the
>>>> userland program from kexec-tools) does not like to load the image at all 
>>>> (I
>>>> used the --real-mode switch but it did not help).
>
> To clarify a bit (if it has been unclear before): the kexec userland complains
> about a malformed bzImage when I try to run the "kexec ..." command. It might 
> be
> that the BIOS will put more spokes in my wheel, but my first problem is kexec
> (the userland utility) which does not like my bzImage:
>
> [EMAIL PROTECTED]:/home/michael# kexec hello.bin
> Cannot determine the file type of hello.bin
> [EMAIL PROTECTED]:/home/michael# kexec -t bzImage hello.bin
> Cannot determine the file type of hello.bin
> [EMAIL PROTECTED]:/home/michael# kexec -t bzImage --real-mode hello.bin
> Cannot determine the file type of hello.bin
>
> Loading a "real" kernel works (and kexec autodetects the format properly).

Well reading through the relevant code would probably help, it
lists fairly clearly which subset of the kernel format I support.
Basically It must be at least protocol version 2.0 and it must
be a bzImage (not a zImage), and it must have all of the appropriate
magic numbers.  ISO linux and grub support older revisions of
the linux boot protocol.

It may be possible to support older revisions of the protocol I
don't recall off hand.

Most non-linux things want to user an older revision of the boot
protocol and that is likely a problem.

int bzImage_probe(const char *buf, off_t len)
{
        struct x86_linux_header header;
        if (len < sizeof(header)) {
                return -1;
        }
        memcpy(&header, buf, sizeof(header));
        if (memcmp(header.header_magic, "HdrS", 4) != 0) {
                if (probe_debug) {
                        fprintf(stderr, "Not a bzImage\n");
                }
                return -1;
        }
        if (header.boot_sector_magic != 0xAA55) {
                if (probe_debug) {
                        fprintf(stderr, "No x86 boot sector present\n");
                }
                /* No x86 boot sector present */
                return -1;
        }
        if (header.protocol_version < 0x0200) {
                if (probe_debug) {
                        fprintf(stderr, "Must be at least protocol version 
2.00\n");
                }
                /* Must be at least protocol version 2.00 */
                return -1;
        }
        if ((header.loadflags & 1) == 0) {
                if (probe_debug) {
                        fprintf(stderr, "zImage not a bzImage\n");
                }
                /* Not a bzImage */
                return -1;
        }
        /* I've got a bzImage */
        if (probe_debug) {
                fprintf(stderr, "It's a bzImage\n");
        }
        return 0;
}

Eric
_______________________________________________
fastboot mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/fastboot

Reply via email to