Weird issues when migrating from custom bootloader to GRUB
Posted: Thu Mar 09, 2023 3:05 am
I am having trouble migrating my OS from a custom boot loader to GRUB. When i load up the ISO file in QEMU, GRUB loads perfectly fine but when i enter into my OS it boots from the DVD/CD and then just loads up GRUB again (image attached). Due to the output of my linker, i feel as if the linker may be the problem.
I tested loading another, more basic os/kernel i made into GRUB, and it works perfectly fine so i feel confident that it isnt NASM or GCC or grub-mkrescue
I also tried only loading just the main function with the boot asm, nothing else, and it still doesn't work...
Compiling with arch on WSL with gcc, nasm and grub-mkrescue; running with QEMU as cdrom.
Repo: https://github.com/lochyj/OS
Sorry is this is a really simple solution, i am just getting into OSDev and i dont really know that much. Thanks in advance!
Build output:
I tested loading another, more basic os/kernel i made into GRUB, and it works perfectly fine so i feel confident that it isnt NASM or GCC or grub-mkrescue
I also tried only loading just the main function with the boot asm, nothing else, and it still doesn't work...
Compiling with arch on WSL with gcc, nasm and grub-mkrescue; running with QEMU as cdrom.
Repo: https://github.com/lochyj/OS
Sorry is this is a really simple solution, i am just getting into OSDev and i dont really know that much. Thanks in advance!
Build output:
Code: Select all
ld: ./out/boot.out: warning: relocation in read-only section `.text'
ld: warning: creating DT_TEXTREL in a shared object
xorriso 1.5.4 : RockRidge filesystem manipulator, libburnia project.
Drive current: -outdev 'stdio:./out/image/BlinkOS.iso'
Media current: stdio file, overwriteable
Media status : is blank
Media summary: 0 sessions, 0 data blocks, 0 data, 175g free
Added to ISO image: directory '/'='/tmp/grub.FqJ8ew'
xorriso : UPDATE : 976 files added in 1 seconds
Added to ISO image: directory '/'='/mnt/c/Users/me/OS/isodir'
xorriso : UPDATE : 980 files added in 1 seconds
xorriso : NOTE : Copying to System Area: 512 bytes from file '/usr/lib/grub/i386-pc/boot_hybrid.img'
xorriso : UPDATE : 73.80% done
ISO image produced: 13398 sectors
Written to medium : 13398 sectors at LBA 0
Writing to 'stdio:./out/image/BlinkOS.iso' completed successfully.