[syslinux] [PATCH] Fix support for Linux kernel images with no protected mode code

Matt Fleming matt at console-pimps.org
Wed Apr 3 04:13:02 PDT 2013


On 27/03/13 21:50, Josh Triplett wrote:
> Some kernel images use the Linux kernel boot protocol and header
> structure, but do not actually have any protected-mode code.  For
> instance, grub's 1024-byte lnxboot.img consists of 1024 real-mode bytes
> and 0 protected-mode bytes; you can concatenate it with a full grub
> core.img to produce a self-contained bootable kernel, but you can also
> use it standalone as the kernel with the core.img loaded as an initrd.
> 
> syslinux 4 supports this, but it no longer works with syslinux 5: the
> memmap functions do not correctly handle a request to work with a 0-byte
> region.  With lnxboot.img, this would cause syslinux to bail because it
> thinks it has no space at the 1M load location but cannot relocate
> lnxboot.img.  (In bailing, it gives the confusing error message "Bad
> file descriptor", not because that error actually occurred when
> attempting to boot the kernel, but because errno has that value on entry
> to syslinux_boot_linux and nothing clears or sets it.)
> 
> Fix the regression by handling the corner case of no protected-mode code
> explicitly.
> 
> Signed-off-by: Josh Triplett <josh at joshtriplett.org>
> Signed-off-by: Burt Triplett <burt at pbjtriplett.org>
> ---
> 
> This patch applies to the "elflink" branch for syslinux 5.

Looks good to me. I'll apply it unless Peter has any objections.

> Found because people started trying to use syslinux 5 to boot BITS,
> which uses lnxboot.img as kernel and core.img as initrd, and it failed
> to boot with the mysterious "Bad file descriptor" message mentioned
> above.

Oh yeah, that old chestnut. I'll fix that up. Thanks!

-- 
Matt Fleming, Intel Open Source Technology Center


More information about the Syslinux mailing list