I trying boot kernel by grub multiboot, but my boot code for some reason it doesn't work.I using NASM for boot.asm compiling, GCC for c compiling andQEMU.
While loading in qemu the grub throws error: no multiboot header found.
Source code
boot.asm
BITS 32MAGIC equ 0xE85250D6ARCH equ 0BOOT_SIZE equ (mlt_end - mlt_start)section .multiboot_headermlt_start: dd MAGIC dd ARCH dd BOOT_SIZE dd 0x100000000 - (MAGIC + ARCH + BOOT_SIZE) dw 0 dw 0 dd 8mlt_end:global start ; start entryextern kmain ; kernel entrysection .textstart: cli mov esp, stack_top call kmainsysloop: hlt jmp sysloopend:section .bssresb 8192stack_top:
kernel.ld
ENTRY(start)SECTION { . = 1M; .boot : { *(.multiboot_header) } .text : { *(.text) } .bss : { *(.bss) }}
make
BIN := ./binBIN_KERNEL := ./bin/kernelISO := ./isoall: krnl ld grubkrnl: @nasm -f elf32 boot.asm -o $(BIN)/boot.o @gcc -m32 -c ./kernel/kernel.c -o $(BIN_KERNEL)/kernel.old: @ld -m elf_i386 -T kernel.ld -o kernel.bin $(BIN)/boot.o $(BIN_KERNEL)/kernel.ogrub: @cp kernel.bin $(ISO)/boot/kernel.bin @grub-mkrescue -o os.iso $(ISO)
What's wrong?