I can't see what could be happening as I've done nothing to my boot file and for some strange reason LD isn't linking this file with my main file which is driving me nuts ( even though there might be some extremely simple reason behind it. ) I've Googled for a cure and one said to change "_start" to "start" but I already had the latter.
The warning is:
Code: Select all
ld: warning: cannot find entry symbol start; defaulting to 0000000000100000
Code: Select all
; boot.asm -- Kernel entry point
global start ; Make entry point visible to the linker
global magic ; Used in kmain
global mbd ; Also used in kmain
extern kmain ; kmain is defined in kmain.c
section .__mbHeader
BITS 32 ; Instructions are 32 bit
; Set up the Multiboot header
MBOOT_PAGE_ALIGN equ 1<<0 ; Align modules on page boundaries
MBOOT_MEM_INFO equ 1<<1 ; Provide memory map to kernel
MBOOT_HEADER_FLAGS equ MBOOT_PAGE_ALIGN | MBOOT_MEM_INFO
MBOOT_HEADER_MAGIC equ 0x1BADB002 ; Required by GRUB
MBOOT_CHECKSUM equ -(MBOOT_HEADER_FLAGS + MBOOT_HEADER_MAGIC)
align 4
dd MBOOT_HEADER_MAGIC
dd MBOOT_HEADER_FLAGS
dd MBOOT_HEADER_CHECKSUM
section .text
; Reserve initial stack space
STACKSIZE equ 0x4000 ; That's 16k
start:
mov esp, stack + STACKSIZE ; Set up the stack
mov [magic], eax ; Multiboot header number
mov [mbd], ebx ; Multiboot info structure
call kmain ; Call the kernel
cli
.hang:
hlt ; Halt the machine should kernel return
jmp .hang
section .bss
align 4
stack: resb STACKSIZE ; Reserve 16k stack on a doubleword boundary
magic: resd 1
mbd: resd 1
Code: Select all
ENTRY(start)
OUTPUT_FORMAT(elf32-i386)
phys = 0x00100000;
SECTIONS
{
/*Set the virtual address:*/
. = phys;
/*
* http://wiki.osdev.org/Grub_Error_13
*/
/* .__mbHeader will begin @ 'phys' */
.__mbHeader : AT ( ADDR( .__mbHeader ) ) {
/* mboot = .;*/
*(.__mbHeader)
}
.text ALIGN(4096) : AT(ADDR(.text)) {
code = .;
*(.text)
*(.rodata)
}
.data ALIGN(4096) : AT(ADDR(.data)) /*Voila*/
{
data = .;
*(.data)
}
.bss ALIGN(4096) : AT ( ADDR (.bss) )
{
bss = .;
*(.bss)
}
end = .;
}
Any idea's?
Thanks.