Higher half kernel grub error 28: selected item cannot fit..
Posted: Wed Jun 19, 2013 5:51 am
Hello all,
I'm working on my first kernel and hoping to construct a higher-half multiboot kernel (32-bit) having followed JamesM's kernel tutorials.
I have a link script that looks like this (taken from the wiki page, with adjustment):
which gives me the following output from objdump -h:
Which is as far as I can see correct. The low VMA of the mboot section is less than ideal, but since this only contains the multiboot header and the LMA is 1MB, if I understand things right this is okay.
When I boot my kernel using JamesM's grub floppy, I end up with an "error 28: selected item cannot fit into memory". Incidentally, if I set my kernel to load at an LMA less than 1MB by adjusting KERNEL_LMA_OFFSET, I produce an error 7: cannot load below 1MB error as you'd expect.
My makefile runs mbchk, which reports:
So I'm at a bit of a loss as to where I have gone wrong. Is there something I am missing?
If it helps, I am running my kernel under bochs (as available in Fedora 18) using the bochsrc from JamesM's tutorials.
Thanks for your help, A
I'm working on my first kernel and hoping to construct a higher-half multiboot kernel (32-bit) having followed JamesM's kernel tutorials.
I have a link script that looks like this (taken from the wiki page, with adjustment):
Code: Select all
OUTPUT_FORMAT(elf32-i386)
ENTRY(start)
KERNEL_MBOOT = 0x400;
KERNEL_VMA = 0xC0000000;
KERNEL_LMA_OFFSET = 0xBFF00000;
PHDRS
{
headers PT_PHDR PHDRS ;
mboot PT_LOAD FILEHDR ;
text PT_LOAD FILEHDR ;
data PT_LOAD ;
}
SECTIONS
{
. = KERNEL_MBOOT;
.mboot : AT(KERNEL_VMA - KERNEL_LMA_OFFSET)
{
*(.mboot)
} : mboot
. = KERNEL_VMA;
.text : AT(ADDR(.text)+ADDR(.mboot) - KERNEL_LMA_OFFSET)
{
code = .; _code = .; __code = .;*/
*(.text)
*(.rodata*)
} : text
.data ALIGN (0x1000) : AT(ADDR(.data) - KERNEL_LMA_OFFSET)
{
data = .; _data = .; __data = .;
*(.data)
*(.rodata)
} : data
.bss : AT(ADDR(.bss) - KERNEL_LMA_OFFSET)
{
bss = .; _bss = .; __bss = .;
*(.bss)
*(COMMON)
ebss = .;
} : data
end = .; _end = .; __end = .;
}
Code: Select all
file format elf32-i386
Sections:
Idx Name Size VMA LMA File off Algn
0 .mboot 0000000c 00000400 00100000 00000400 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
1 .text 0000002e c0000000 00100400 00001000 2**4
CONTENTS, ALLOC, LOAD, READONLY, CODE
2 .data 00000001 c0001000 00101000 00002000 2**12
CONTENTS, ALLOC, LOAD, DATA
3 .bss 00004000 c0001020 00101020 00002001 2**5
ALLOC
When I boot my kernel using JamesM's grub floppy, I end up with an "error 28: selected item cannot fit into memory". Incidentally, if I set my kernel to load at an LMA less than 1MB by adjusting KERNEL_LMA_OFFSET, I produce an error 7: cannot load below 1MB error as you'd expect.
My makefile runs mbchk, which reports:
Code: Select all
kernel: The Multiboot header is found at the offset 1024.
kernel: Page alignment is turned on.
kernel: Memory information is turned on.
kernel: Address fields is turned off.
kernel: All checks passed.
If it helps, I am running my kernel under bochs (as available in Fedora 18) using the bochsrc from JamesM's tutorials.
Thanks for your help, A