[GRUB] Error 7: Loading below 1MB is not supported
Posted: Fri Mar 07, 2008 11:40 am
Dear board members,
after four hours of debugging attempts, I gave up and decided to register here in order to ask you for help for my current "pet OS" problem.
My Kernel's bootloader is based on JamesM's bootloader tutorial, using GRUB. The Kernel itself is written in C.
After adding a few minor functions to the kernel code, the Kernel wouldn't be recognized by GRUB anymore.
Due to the increasing code size, the multiboot loader header was shifted out of reach for GRUB. So I modified the boot loader by adding a section called .mboot:
And I modified my linker script link.ld accordingly, so the header information is reachable again, for GRUB.
After these modifications, however, I get following GRUB error message:
I'm pretty much stuck now, since I cannot see which section is about to be loaded below 1MB.
Here's the objdump output:
I'd appreciate a helping hand here, since solutions to similar problems on this board unfortunately don't seem to apply to my situation
Many thanks in advance!
Paw
after four hours of debugging attempts, I gave up and decided to register here in order to ask you for help for my current "pet OS" problem.
My Kernel's bootloader is based on JamesM's bootloader tutorial, using GRUB. The Kernel itself is written in C.
After adding a few minor functions to the kernel code, the Kernel wouldn't be recognized by GRUB anymore.
Due to the increasing code size, the multiboot loader header was shifted out of reach for GRUB. So I modified the boot loader by adding a section called .mboot:
Code: Select all
MBOOT_PAGE_ALIGN equ 1<<0 ; Load kernel and modules on a page boundary
MBOOT_MEM_INFO equ 1<<1 ; Provide your kernel with memory info
MBOOT_HEADER_MAGIC equ 0x1BADB002 ; Multiboot Magic value
; NOTE: We do not use MBOOT_AOUT_KLUDGE. It means that GRUB does not
; pass us a symbol table.
MBOOT_HEADER_FLAGS equ MBOOT_PAGE_ALIGN | MBOOT_MEM_INFO
MBOOT_CHECKSUM equ -(MBOOT_HEADER_MAGIC + MBOOT_HEADER_FLAGS)
[BITS 32] ; All instructions should be 32-bit.
[GLOBAL mboot] ; Make 'mboot' accessible from C.
[EXTERN code] ; Start of the '.text' section.
[EXTERN bss] ; Start of the .bss section.
[EXTERN end] ; End of the last loadable section.
SECTION .mboot ALIGN 4
mboot:
dd MBOOT_HEADER_MAGIC ; GRUB will search for this value on each
; 4-byte boundary in your kernel file
dd MBOOT_HEADER_FLAGS ; How GRUB should load your file / settings
dd MBOOT_CHECKSUM ; To ensure that the above values are correct
dd mboot ; Location of this descriptor
dd code ; Start of kernel '.text' (code) section.
dd bss ; End of kernel '.data' section.
dd end ; End of kernel.
dd start ; Kernel entry point (initial EIP).
[GLOBAL start] ; Kernel entry point.
[EXTERN kmain] ; This is the entry point of our C code
SECTION .text ALIGN 4096
start:
push ebx ; Load multiboot header location
; Execute the kernel:
cli ; Disable interrupts.
call kmain ; call our main() function.
jmp $ ; Enter an infinite loop, to stop the processor
; executing whatever rubbish is in the memory
; after our kernel!
Code: Select all
ENTRY(start)
phys = 0x00100000;
SECTIONS {
start = .;
.text ALIGN(4096) : AT(phys) {
code = .;
*(.mboot)
*(.text)
*(.rodata)
}
.data ALIGN(4096) : {
data = .;
*(.data)
}
.bss ALIGN(4096) : {
bss = .;
*(.bss)
}
end = .;
}
Code: Select all
Error 7: Loading below 1MB is not supported
Here's the objdump output:
Code: Select all
kernel.bin: file format elf32-i386
Sections:
Idx Name Size VMA LMA File off Algn
0 .text 00001320 00000000 00100000 00001000 2**4
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .data 0000000c 00002000 00102000 00003000 2**2
CONTENTS, ALLOC, LOAD, DATA
2 .comment 00000174 00000000 00000000 0000300c 2**0
CONTENTS, READONLY
Many thanks in advance!
Paw