OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 8:03 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Weird issues when migrating from custom bootloader to GRUB
PostPosted: Thu Mar 09, 2023 3:05 am 
Offline

Joined: Fri Nov 11, 2022 10:28 pm
Posts: 10
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:
Code:
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.


Attachments:
Capture.PNG
Capture.PNG [ 19.87 KiB | Viewed 852 times ]
Capture.PNG
Capture.PNG [ 19.88 KiB | Viewed 852 times ]
Top
 Profile  
 
 Post subject: Re: Weird issues when migrating from custom bootloader to GR
PostPosted: Thu Mar 09, 2023 3:41 am 
Offline
Member
Member

Joined: Wed Mar 30, 2011 12:31 am
Posts: 676
It looks like you’re trying to build a shared object, but a multiboot kernel should be an executable.

_________________
toaruos on github | toaruos.org | gitlab | twitter | bim - a text editor


Top
 Profile  
 
 Post subject: Re: Weird issues when migrating from custom bootloader to GR
PostPosted: Thu Mar 09, 2023 4:21 am 
Offline

Joined: Fri Nov 11, 2022 10:28 pm
Posts: 10
Thanks for the help, removing the -shared flag fixed my issue. It however, caused more issues with the actual OS itself, but ill fix that myself. Thanks!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], SemrushBot [Bot] and 59 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group