Hello guys! It's quite a generic story - I'm writing a microkernel and use a nice feature of GRUB called "Multiboot kluge". I use RDOFF2, a NASM home-grown binary format. In its current version (0.98.31) RDOFF linker 'ldrdf' supports multiboot header "right out of the box" using a special technique, namely "hardcode the trampoline code into the linker" :)
It's actually a quick-and-dirty hack which I would like to get rid of. Instead, multiboot header and trampoline code will be in a separate file, that can be embedded into the kernel header at linking stage. The problem is that trampoline doesn't know the size of target kernel image in advance; therefore, it's impossible to initialize 'load_end' and 'bss_end' fields in the MB header to the correct values. It would be great if I could specify something like '-1' for these values. It might be a hint for the boot loader to load *entire* kernel file and assume there is no BSS. I.e. if (load_end_addr == -1) load_end_addr = load_addr + filemax; if (bss_end_addr == -1) bss_end_addr = load_end_addr; I think it's not hard to implement such a feature - only a few lines in 'boot.c' and 'mbchk.c' need to be changed. If you consider it might be useful for the future 0.7 Multiboot specification - I would be glad to send a patch against grub-0.92. Thanks. P.S. (in case you're wondering why I need this. RDOFF is Relocatable Dynamic format; it means that kernel needs to be relocated to its working area before start. Moreover, kernel lives in low memory; that's why a special setup code is needed. It's a plain binary, linked absolutely with org=100000h and it's just glued to the kernel image. To move this setup to 100000h a special 24-byte trampoline is used, which is embedded into the kernel together with a multiboot header.. %-) 73! -- Regards, Yuri Zaporogets.
msg05851/pgp00000.pgp
Description: PGP signature