Code: Select all
OUTPUT_FORMAT("elf32-i386")
OUTPUT_ARCH("i386")
ENTRY(start) /* Kernel starts at "start" symbol. */
PHYS_ADDR = 0X00100000;
VIRT_ADDR = 0XC0100000;
SECTIONS {
. = PHYS_ADDR;
.__mbHeader : AT ( ADDR( .__mbHeader ) ) {
_start = .;
_mboot = .;
*(.__mbHeader)
. = ALIGN(4);
}
.text VIRT_ADDR : AT(PHYS_ADDR) {
*(.text)
*(.rodata) *(.rodata.*)
. = ALIGN(4096);
} = 0x90
.data : {
_data = .;
*(.data)
. = ALIGN(4096);
}
/* BSS (zero-initialized data) is after everything else. */
.bss : {
_start_bss = .;
*(.bss)
. = ALIGN(4096);
_end_bss = .;
}
_end = .;
}
Code: Select all
../build/toy: The Multiboot header is found at the offset 4101.
../build/toy: Page alignment is turned on.
../build/toy: Memory information is turned on.
../build/toy: Address fields is turned on.
header_addr = 0x100005
load_addr = 0x100000
load_end_addr = 0xC0103000
bss_end_addr = 0xC0104000
entry_addr = 0xC01003EC
../build/toy: All checks passed.
Then I load the kernel using grub and it gives me the horrible 13 ERROR
Yes, this one:
http://wiki.osdev.org/Grub_Error_13
I use GNU Gas Assembler... so I used the code from the especification to create my multiboot header... that's "ok" according to the multiboot checker.
This is the header:
Code: Select all
.equ MBOOT_PAGE_ALIGN, 1<<0 // Load kernel and modules on a page boundary
.equ MBOOT_MEM_INFO, 1<<1 // Provide your kernel with memory info
.equ MBOOT_ADDRESS_FIELD, 1<<16
.equ MBOOT_HEADER_MAGIC, 0x1BADB002 // Multiboot Magic value
.equ MBOOT_HEADER_FLAGS, MBOOT_MEM_INFO | MBOOT_ADDRESS_FIELD | MBOOT_PAGE_ALIGN
.equ MBOOT_CHECKSUM, -(MBOOT_HEADER_MAGIC + MBOOT_HEADER_FLAGS)
.global mboot,bss,end,_start,start
.section .__mbHeader
.align 4
_start:
jmp start
_mboot:
.long MBOOT_HEADER_MAGIC
.long MBOOT_HEADER_FLAGS
.long MBOOT_CHECKSUM
// AOUT kludge - must be physical addresses. Make a note of these:
// The linker script fills in the data for these ones!
.long _mboot
.long _start
.long _start_bss
.long _end_bss
.long start
.section .text
.func start
start:
Thanks in advance. Any suggestion is appreciatted. I can succesfully boot the OS under Lguest. I have a "nice" command console... And I wanted to "port" it to a regular PC too. but I'm stuck at the very first step.