Booting FreeBSD with Syslinux

Teske, Devin Devin.Teske at
Wed Jul 31 16:15:21 UTC 2013

On Jul 31, 2013, at 6:38 AM, Daniel O'Connor wrote:

> Hi,
> I am trying to make a FreeBSD 9.2 hybrid image (ie ISO & USB from the same file) and as part of that I need to use syslinux. Unfortunately I can't get Syslinux's mboot.c32 to run the kernel or loader as suggested at - it reports "Invalid Multiboot image: neither ELF header nor a.out kludge found".
> I suspect I would be able to use memdisk as I have used that in the past with syslinux (for 7.x) however this was seems a lot cleaner and easier to generate.
> Has anyone had any success with this?


You can download and dissect the following to show you how it's done...

It uses syslinux, as you can see here:

As you can see, I use the memdisk.c32 module.

Notice that I append "iso raw" as options to memdisk.c32.

You may then be asking yourself... if the thing to do is to use memdisk with an ISO... what's in said ISO?


1. Kernel
2. Boot Forth
3. mfsroot

All that goes into an ISO. When memdisk initiates the ISO, "/boot/cdboot" then gets invoked.

>From there, /boot/loader gets invoked.
>From there, the /boot/loader.rc is loaded.
>From there, loader.4th is loaded.
>From there, loader.conf is loaded.

In a normal FreeBSD boot process, then the kernel gets loaded (I've modified that to not load the kernel until later -- because my Forth boot menu presents a kernel selection option)

>From there, beastie.4th is loaded.
>From there, beastie-start is called and then the beastie menu is drawn.

NOTE: I've skipped a whole bunch of other Forth modules that were loaded "at-once" indirectly

>From there, the user makes any boot option choices, and presses ENTER to boot.
>From there, mfsroot.gz is loaded.
>From there, /stand/sysinstall gets invoked.
>From there, /install.cfg gets invoked.
>From there, /stand/fis gets invoked.
>From there, /dev/iso9660/druid gets mounted onto /cdrom (this ISO9660 volume is actually _not_ the ISO that memdisk booted, but rather this is the actual CDROM (or DVD) that you booted from (which contains both the syslinux boot loader *and* the ISO it booted *and* anything else you want to access).

At this point, /cdrom is your ticket to freedom, busting out of the double-encapsulation (first encapsulation is wrapping the kernel+forth+mfsroot into an ISO, second level of encapsulation is from within the mfsroot; from within the mfsroot, the GEOM provided /dev/iso9660/<VOLID> is an escape hatch to the level *above* the ISO the mfsroot was embedded within).

The information contained in this message is proprietary and/or confidential. If you are not the intended recipient, please: (i) delete the message and all copies; (ii) do not disclose, distribute or use the message in any manner; and (iii) notify the sender immediately. In addition, please be aware that any message addressed to our domain is subject to archiving and review by persons other than the intended recipient. Thank you.

More information about the freebsd-stable mailing list