Add Multiboot Support to the Stage2 loader.
Quoted 4 lines
I was having trouble booting Haiku from a partition on my Acer Aspire One, so I added multiboot support to zbeos.
It uses the a.out kludge to load at0x100000(1mb) and then relocates itself down to0x10000, its expected location.
Nice
Quoted 3 lines
Loading
boot_loader_bios_ia32as ELF also works, but grub refuses to load it below 1MB, despite what the multiboot header says (ELF header has priority).
aout_kludge has priority. Just some forks of grub (e.g. the one supplied with Solaris) are buggy. USe grub2 or at very least grub-0.97
Quoted 10 lines
There is one downside to loading zbeos directly with GRUB: It won't find its boot volume, so the menu needs to be used to select it - I worked around this with a small shell script (meant to be run from a trunk checkout post build, passed the BIOS Drive ID in hex (80, 81, etc.) and the partition offset in sectors (the one makebootable outputs)) that manually patches zbeos.
The reason it needs to be run from a checkout/built copy is that it runs objdump on the built bootloader to find the address to write gBootDriveID and gBootPartitionOffset.
Quoted 3 lines
I tried adding a partition ID field, based on the multiboot info struct, but-
1) GRUB passes the ID/Drive of the partition the multiboot image was loaded from, so this would only be feasible with a GRUB bfs driver.
No. It corresponds to current root drive. Kernel can be loaded from another partition. E.g
root=hd0,1
multiboot (hd0,2)/kernel
Then hd0,1 will be passed as root
Additionally in my personal git you'll find a working BFS driver
Quoted 1 line
2) The bootloader's partition IDs are not equivalent to grub partition numbers.
Is it difficult to transform? Normally it shouldn't be. Actually passing root drive as a parameter may be more useful
Quoted 2 lines
Note that GRUB2 will not load a.out kludge multiboot files, only GRUB Legacy will. This appears to be a defect or limitation.
At least latest version of grub loads aout-kludges
Quoted 4 lines
This would all be more useful if:
GRUB could read bfs partitions and makebootable touched zbeos so this script didn't need to exist.
Currently, zbeos needs to be copied to a grub-bootable partition, obviously.
using mbi is much cleaner. patching loaded paylod is just a dirty fix
Quoted 4 lines
To be honest, I think this is a development into the wrong direction. I don't see any advantage in supporting multiboot. If you have trouble booting Haiku with the current boot method, it would be much better to fix the problems rather than adding another method.
multiboot can be useful in many situations. E.g. coreboot, VMs, booting from images or drives invisible from BIOS or alternative bootloaders for special cases (e.g. 'x' which loads from dos). Correct me if I'm wrong but unfortunately with this patch some of these benefits are inaccessible because stage2 bootloader still uses BIOS to find kernels. This can be solved by one of 2 ways:
1) making kernel support multiboot. If mbi doesn't contain enough info say which fields do you need and probably they can be added to either multiboot or currently WIP multiboot2. This step doesn't mean to abandon current stage2 booter. stage2 booter can comply with multiboot(2) which would allow it to load other kernels as well. Additionally multiboot2 is meant to be portable. I think users multibooting e.g. solaris and haiku would be happy to use haiku booter to load both. Another possibility is to make kernel accept both protocols like e.g. NetBSD does but this is probably harder to maintain.
2) passing all required files to stage2 booter as modules
Quoted 1 line
If anyone would like, I'd be glad to add cmdline support!
Command line is very important. It allows users to pass secondary booters seaminglessly and not waiting 5 seconds at every menu
Signature · 4 lines
Regards Vladimir 'phcoder' Serbinenko Personal git repository: http://repo.or.cz/w/grub2/phcoder.git