Multiboot issues & complaints
Multiboot issues & complaints
I don't often post here, I mostly read the wiki and lurk, but I've an idea I'd like to throw out. Recently, I've been working with the Multiboot Specification, and at first glance, it's very useful and complete. However, once I got into it, it seemed to me that several things either are extraneous or not provided for.
First, several things seem outdated, specifically, long mode is not supported in any way. It's actually required that paging be disabled. (U)EFI is similarly disregarded.
Another issue is the lack of requirements on the loader pertaining to memory usage. The only thing I know for sure about a Multiboot compliant loader is that it didn't load anything where my kernel (including BSS area) is. I don't know where it's safe to put things, as the loader's structures don't seem to be represented on the memory map. I believe a reasonable solution to this would be to restrict all loader information that is passed to the kernel from being above 1MB.
Finally, I think there are some fields that the spec doesn't provide, and some that aren't needed. A lot of modular kernels need at least one module loaded at boot time, and this isn't provided in the kernel's header. To be able to load the kernel, the user has to handle some loader-specific method of loading a module with the kernel. For an example of misplaced or unnecessary data, I point to the symbols table. The point of the spec is to allow one loader to load many different types of kernels, regardless of file format. Putting a.out and/or ELF specific data in the spec without doing the same for other formats such as PE seems to imply that the creators were biased toward certain formats, and it makes no sense to make a spec that is designed to be independent of file formats while accommodating one or two of your favorites.
I wanted to share this to get some opinions. Is it just me?
First, several things seem outdated, specifically, long mode is not supported in any way. It's actually required that paging be disabled. (U)EFI is similarly disregarded.
Another issue is the lack of requirements on the loader pertaining to memory usage. The only thing I know for sure about a Multiboot compliant loader is that it didn't load anything where my kernel (including BSS area) is. I don't know where it's safe to put things, as the loader's structures don't seem to be represented on the memory map. I believe a reasonable solution to this would be to restrict all loader information that is passed to the kernel from being above 1MB.
Finally, I think there are some fields that the spec doesn't provide, and some that aren't needed. A lot of modular kernels need at least one module loaded at boot time, and this isn't provided in the kernel's header. To be able to load the kernel, the user has to handle some loader-specific method of loading a module with the kernel. For an example of misplaced or unnecessary data, I point to the symbols table. The point of the spec is to allow one loader to load many different types of kernels, regardless of file format. Putting a.out and/or ELF specific data in the spec without doing the same for other formats such as PE seems to imply that the creators were biased toward certain formats, and it makes no sense to make a spec that is designed to be independent of file formats while accommodating one or two of your favorites.
I wanted to share this to get some opinions. Is it just me?
Re: Multiboot issues & complaints
I share your opinion. The multiboot spec is highly targeted to Linux needs, and largely disregards the needs of other environments.
When I made my multiboot interface I actually had to create an imaginary "kernel" (I call it grubload). The real kernel is loaded as a module in memory. The imaginary loader would then contain a loader that complies with my kernel.
The multiboot standard not only does not comply with long-mode, it doesn't comply with segmentation either. It was designed only to support a 32-bit flat memory model based on Linux ELF kernel needs.
When I made my multiboot interface I actually had to create an imaginary "kernel" (I call it grubload). The real kernel is loaded as a module in memory. The imaginary loader would then contain a loader that complies with my kernel.
The multiboot standard not only does not comply with long-mode, it doesn't comply with segmentation either. It was designed only to support a 32-bit flat memory model based on Linux ELF kernel needs.
- Love4Boobies
- Member
- Posts: 2111
- Joined: Fri Mar 07, 2008 5:36 pm
- Location: Bucharest, Romania
Re: Multiboot issues & complaints
Without going into much detail, as this has been discussed over and over again on these forums:
- Multiboot does not disregard (U)EFI, OFW, or other non-BIOS firmware; or long mode. It was just defined a really long time ago. The document is dated last year due to small revisions and recent clarifications.
- The paging bit makes sense because the kernel would need to define its own page tables anyway.
- Multiboot is not Linux-specific. In fact, Linux is not a Multiboot kernel, it has its own protocol.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
[ Project UDI ]
Re: Multiboot issues & complaints
Multiboot 2 looks like it's making zero progress, and it may not be Linux specific, but it definitely has leanings toward UNIX-type OSs in general, and that has absolutely no place in a spec that's designed to allow portability.Love4Boobies wrote:
- Multiboot is not Linux-specific. In fact, Linux is not a Multiboot kernel, it has its own protocol.
- Love4Boobies
- Member
- Posts: 2111
- Joined: Fri Mar 07, 2008 5:36 pm
- Location: Bucharest, Romania
Re: Multiboot issues & complaints
Please elaborate, you are being very vague.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
[ Project UDI ]
Re: Multiboot issues & complaints
I was referring to the symbols table, which is only applicable to ELF and a.out, while not supporting other formats like PE. Besides, isn't the point to make the loader independent of the file format?
- Love4Boobies
- Member
- Posts: 2111
- Joined: Fri Mar 07, 2008 5:36 pm
- Location: Bucharest, Romania
Re: Multiboot issues & complaints
ELF and a.out are not UNIX-specific, although they are indeed used by most UNIX ABIs. You can load other executable formats (such as PE) using a Multiboot kludge, which is the file format independence mechanism you were talking about.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
[ Project UDI ]
Re: Multiboot issues & complaints
A boot loader should make no assumptions about how the executable file is organized. It should simply load some modules into memory, and then transfer execution to some type of entry-point. For x86-systems, the best would be to pass control while still in real-mode, and let the OS setup its memory model itself. A boot-loader should not make assumptions about the memory-model used by the OS either.
So it is really simple. Take out the ELF/a.out support completely, and pass control to the OS in real-mode for x86-systems.
So it is really simple. Take out the ELF/a.out support completely, and pass control to the OS in real-mode for x86-systems.
Re: Multiboot issues & complaints
Without using a known format (like ELF or a.out) and making no assumptions about the EXE file format, how would the boot loader know the load addresses ? And the entry point ?It should simply load some modules into memory, and then transfer execution to some type of entry-point.
I'm no great fan of Multiboot or Grub, but some standard needs to be created so that progress can be made.
If a trainstation is where trains stop, what is a workstation ?
Re: Multiboot issues & complaints
From the multiboot header, of course.gerryg400 wrote:Without using a known format (like ELF or a.out) and making no assumptions about the EXE file format, how would the boot loader know the load addresses ? And the entry point ?It should simply load some modules into memory, and then transfer execution to some type of entry-point.
The simplest solution would be to define a fixed entry-point where the primary boot-image is loaded and then control is transfered much the same way as BIOS does. That would support any type of OS. Any serious OS project eventually need to make it's own boot-loader that works on its own, and providing support for a new variant of real-mode booting is trivial.
Re: Multiboot issues & complaints
But as you know the Multiboot spec supports that and Grub implements it. You simply set bit 16 in the flags field of the Multiboot header.From the multiboot header, of course.
It seems like you are proposing that functionality be removed from Multiboot. Why is it necessary when those who don't need ELF can switch it off and simply ignore it ?
If a trainstation is where trains stop, what is a workstation ?
Re: Multiboot issues & complaints
Bit 16 in flag field does NOT make grub pass control to the OS-image in real-mode. It still passes control to the OS-image in 32-bit flat mode, and thus I still need an intermediate loader that restarts the boot process.gerryg400 wrote:But as you know the Multiboot spec supports that and Grub implements it. You simply set bit 16 in the flags field of the Multiboot header.From the multiboot header, of course.
It seems like you are proposing that functionality be removed from Multiboot. Why is it necessary when those who don't need ELF can switch it off and simply ignore it ?
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: Multiboot issues & complaints
Can we make this forum read-only for you so that you quit posting nonsense?Any serious OS project eventually need to make it's own boot-loader
Linux practically never uses its own bootloader for starters. It's all third party software (lilo/grub)
Re: Multiboot issues & complaints
I didn't write "need to use". I wrote "need to make". These are completely different issues, and Linux does have it's own boot-loader.Combuster wrote:Can we make this forum read-only for you so that you quit posting nonsense?Any serious OS project eventually need to make it's own boot-loader
Linux practically never uses its own bootloader for starters. It's all third party software (lilo/grub)
- Love4Boobies
- Member
- Posts: 2111
- Joined: Fri Mar 07, 2008 5:36 pm
- Location: Bucharest, Romania
Re: Multiboot issues & complaints
Cool, except it makes even less sense now.rdos wrote:I didn't write "need to use". I wrote "need to make".
Spelling isn't the only problem with your argumentrdos wrote:These are completely different issues, and Linux does have it's own boot-loader.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
[ Project UDI ]