OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Mar 19, 2024 3:39 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Wrong Placement of the Multiboot-Header
PostPosted: Sun Jul 14, 2019 1:03 am 
Offline

Joined: Sun Jul 14, 2019 12:52 am
Posts: 2
Hey folks,

yesterday I added some code to my kernel after I followed the Bare Bones tutorial (https://wiki.osdev.org/Bare_Bones). Afterwards I got the error that GRUB is not anymore able to find the multiboot header. I checked the .bin file and saw that for some reasons the multiboot header is placed after the actual kernel code. At least I am guessing that it is placed after the kernel code because I see "Hello World" some bytes before.

I currently have the feeling that something is off with my linker configuration, but I have no clue what. Maybe someone of you could give my some insights:

Code:
ENTRY(_start)

SECTIONS {

    . = 1M;

    .text BLOCK(4K) : ALIGN(4K)
    {
        *(.multiboot)
        *(.text)
    }

    .rodata BLOCK(4K) : ALIGN(4K)
    {
        *(.rodata)
    }

    .data BLOCK(4K) : ALIGN(4K)
    {
        *(.data)
    }

    .bss BLOCK(4K) : ALIGN(4K)
    {
        *(COMMON)
        *(.bss)
    }

}


Code:
.set ALIGN, 1<<0
.set MEMINFO, 1<<1
.set FLAGS, ALIGN | MEMINFO
.set MAGIC, 0x1BADB002
.set CHECKSUM, -(MAGIC + FLAGS)

.section multiboot
.align 4
.long MAGIC
.long FLAGS
.long CHECKSUM

.section .bss
.align 16

stack_bottom:
.skip 16384
stack_top:

.section .text
.global _start
.type _start, @function
_start:
    mov $stack_top, %esp
   
    call kernel_main

    cli
1:  hlt
    jmp 1b

.size _start, . - _start


Attachment:
multibootheader.PNG
multibootheader.PNG [ 12.46 KiB | Viewed 661 times ]


Thanks for your help!


Top
 Profile  
 
 Post subject: Re: Wrong Placement of the Multiboot-Header
PostPosted: Sun Jul 14, 2019 3:04 am 
Offline

Joined: Sun Jul 14, 2019 12:52 am
Posts: 2
I fixed it, was missing a dot in the assembly code

Code:
.section .multiboot


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

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], SemrushBot [Bot] and 20 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