Code: Select all
[mike@pc-00065 kernel3]$ gcc -c kernel.c -o kernel.o
[mike@pc-00065 kernel3]$ nasm -f aout k_entry.asm -o k_entry.o
[mike@pc-00065 kernel3]$ ld -T kernel.ld k_entry.o kernel.o
k_entry.o(.text+0x16):k_entry.o: undefined reference to `_k_main'
Thanks
Part of the kernel entry asm is:
Code: Select all
[BITS 32]
[global start]
[extern _k_main] ; this is in the c file
start:
; stop using bootloader GDT, and load new GDT
lgdt [gdt_ptr]
mov ax,LINEAR_DATA_SEL
mov ds,ax
mov es,ax
mov ss,ax
mov fs,ax
mov gs,ax
call _k_main
jmp $ ; crash
Code: Select all
void k_main(void) // like main
{
k_clear_screen();
k_printf("Welcome to Simplified OS.", 0);
update_cursor(1, 0);
k_printf("Right now the kernel is loaded at 1MB physical,/nbut mapped at FF800000 hex.", 3);
update_cursor(5, 0);
k_printf("Remapping the PIC...", 6);
update_cursor(7,0);
remap_pics(0x20, 0x28); // irq 0 20h irq 8 28h
k_printf("PIC remapped starting at 20 hex.", 7);
update_cursor(8,0);
};