symbol `kernel_main' undefined
Of course. So why doesnt: (as boot.s -o boot.o) get the same error?. boot.s has the same undefined symbol yet it assembles fine.
BARE BONES 'as' format boot.s
.set ALIGN, 1<<0 # align loaded modules on page boundaries
.set MEMINFO, 1<<1 # provide memory map
.set FLAGS, ALIGN | MEMINFO # this is the Multiboot 'flag' field
.set MAGIC, 0x1BADB002 # 'magic number' lets bootloader find the header
.set CHECKSUM, -(MAGIC + FLAGS) # checksum of above, to prove we are multiboot
.section .multiboot
.align 4
.long MAGIC
.long FLAGS
.long CHECKSUM
.section .bootstrap_stack, "aw", @nobits
stack_bottom:
.skip 16384 # 16 KiB
stack_top:
.section .text
.global _start
.type _start, @function
_start:
call kernel_main
cli
hlt
.Lhang:
jmp .Lhang
.size _start, . - _start
Thanks. Bill S.NASM format: boot.asm:
FLAGS EQU 3
MAGIC EQU 0x1badb002
CHECKSUM EQU -(MAGIC + FLAGS)
SECTION .multiboot
align 4
dd MAGIC
dd FLAGS
dd CHECKSUM
SECTION bootstrap_stack nobits
stack_bottom:
resb 16384 ; 16 KiB
stack_top:
SECTION .text
global _start
_start:
call kernel_main
cli
hlt
Lhang:
jmp Lhang