1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

is FreeBSD kernel a multiboot kernel ?

Discussion in 'FreeBSD Development' started by wsw1wsw2, Jul 17, 2009.

  1. wsw1wsw2

    wsw1wsw2 New Member

    Messages:
    11
    Likes Received:
    0
    Hi,
    Grub can boot FreeBSD by :
    Code:
    kernel /boot/<some kernel>
    boot
    Does this mean FreeBSD kernel is a multiboot kernel?
    I search the source tree and can not find any thing about multiboot. I think the grub maybe know something about the boot stages of FreeBSD. Am i right?

    Thanks.
     
  2. SirDice

    SirDice Moderator Staff Member Moderator

    Messages:
    17,365
    Likes Received:
    0
    The kernel has nothing to do with multiboot. That's the bootloader's job, which in your case is grub.
     
  3. Beastie

    Beastie Member

    Messages:
    1,916
    Likes Received:
    1
    The multiboot code is not in the kernel.
    By default, it's in boot0 (stored in the MBR if you chose it during the setup) and you can find it in src/sys/boot/i386/boot0/boot0.s (N.B. it's written in assembler).

    The boot process is very simple, which is why grub or any other boot manager can easily do it.
    Basically it just finds the first block (i.e. the boot loader) in a particular partition using the MBR's partition table and executes it. In FreeBSD this block is boot1.
     
  4. john_doe

    john_doe Guest

  5. dennylin93

    dennylin93 New Member

    Messages:
    784
    Likes Received:
    0
    I've been dual booting for a while with Grub (FreeBSD + Windows).

    Here's my configuration file:
    Code:
    default 0
    timeout 5
    
    title Windows XP SP2
    map (hd0) (hd1)
    map (hd1) (hd0)
    rootnoverify (hd1,0)
    chainloader +1
    
    title FreeBSD 7.2-RELEASE-p3
    rootnoverify (hd0,0)
    chainloader +1
    
     
  6. john_doe

    john_doe Guest

    I'm not asking about chainloading. For example, netbsd's boot(8) has a multiboot command. But looks like it can't boot freebsd's kernel.
     
  7. Oxyd

    Oxyd New Member

    Messages:
    167
    Likes Received:
    0
    You can use mbchk to check if a binary is multiboot-compliant (installed with GRUB):
    Code:
    /boot > mbchk loader
    loader: No Multiboot header.
    /boot > mbchk kernel
    kernel: No Multiboot header.
    So I think this is enough to conclude that neither FreeBSD kernel, nor loader are multiboot compliant.

    Oh, and for those wondering what this "multiboot" thing is and what the hell it has to do with the kernel itself: it's a specification that requires bootable binaries to have a special header, in order to allow arbitrary kernels to be loaded by arbitrary bootloaders.
     
  8. aragon

    aragon New Member

    Messages:
    2,031
    Likes Received:
    0
    This may be a naive comment, but the effort seems like too little too late. EFI will probably replace the BIOS soon, and I suspect that will render all this BIOS hackery obsolete. Either way, FreeBSD's chain loading process is elegant (more so than linux) and simply works. I can only see this being useful for someone writing a new OS and wanting to avoid the black art of writing a boot loader.
     
  9. fonz

    fonz Moderator Staff Member Moderator

    Messages:
    2,436
    Likes Received:
    5
    Actually, it's a proposal if I'm not mistaken.

    Alphons
     
  10. Oxyd

    Oxyd New Member

    Messages:
    167
    Likes Received:
    0
    Mistaken you are not:
     
  11. fonz

    fonz Moderator Staff Member Moderator

    Messages:
    2,436
    Likes Received:
    5
    So, do you happen to know which OSes/kernels currently comply to this proposed standard?

    Alphons
     
  12. Carpetsmoker

    Carpetsmoker Member

    Messages:
    919
    Likes Received:
    0
    I think the Hurd and NetBSD are pretty much the only one ... Surely two of the most popular operating systems out there.

    As far as I've understood is, the multiboot specs have pretty much failed to gain a wide acceptance.
     
  13. cpghost

    cpghost New Member

    Messages:
    3
    Likes Received:
    0
    Multiboot

    Some microkernels are multiboot compliant too, e.g. L4Ka:: Pistachio:

    http://l4ka.org/projects/pistachio/

    And, frankly, it would be nice if FreeBSD were multiboot compliant like NetBSD.
     
  14. aragon

    aragon New Member

    Messages:
    2,031
    Likes Received:
    0
    What does multiboot provide that EFI doesn't?