Bare Bones tutorial, grub2 says "no multiboot header found"

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
erynofwales
Posts: 1
Joined: Sat Jan 25, 2014 2:51 am

Bare Bones tutorial, grub2 says "no multiboot header found"

Post by erynofwales »

Hi all,

I'm working through the Bare Bones tutorial in C++. I've got all the code written and I'm trying to link it together. Two things are happening that I'm not sure how to fix. First, when I link with GNU ld, I get this:

Code: Select all

% ld -m elf_i386 -T linker.ld -o paisley.bin -nostdlib boot.o kernel.o

ld: warning: section `.bss' type changed to PROGBITS
Second, after I assemble the image and try to boot it (I'm using VMware for this), grub2 says this:

Code: Select all

error: no multiboot header found.
I'm not sure if the first part (the .bss section thing) is related at all, but I've never seen it before and googling doesn't turn up much.

Any thoughts?
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Bare Bones tutorial, grub2 says "no multiboot header fou

Post by Combuster »

erynofwales wrote:I'm working through the Bare Bones tutorial in C++
ld -m elf_i386
Apparently you're really bad in following a tutorial.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
handuel
Posts: 9
Joined: Thu Jul 05, 2012 10:44 am

Re: Bare Bones tutorial, grub2 says "no multiboot header fou

Post by handuel »

What tutorial are you using? What you're doing looks odd to me, so I wonder how good that tutorial is... If you want a C++ bare bones style of thing I would highly recommend following this tutorial: http://wiki.osdev.org/C%2B%2B_Bare_Bones on the wiki. That sets up the multiboot header properly, and should solve your problem.
User avatar
Bender
Member
Member
Posts: 449
Joined: Wed Aug 21, 2013 3:53 am
Libera.chat IRC: bender|
Location: Asia, Singapore

Re: Bare Bones tutorial, grub2 says "no multiboot header fou

Post by Bender »

Erm, according to the tutorial you need i586-gcc/i586-g++, not sure if this could help.
Barebones C++ wrote: With these components you can now actually build the final kernel. We use the compiler as the linker as it allows it greater control over the link process. Note that if your kernel is written in C++, you should use the C++ compiler instead. You can then link your kernel using:

Code: Select all

i586-elf-gcc -T linker.ld -o myos.bin -ffreestanding -O2 -nostdlib boot.o kernel.o -lgcc
U sure man?, you're following Barebones C++?
Cheers,
Sid
"In a time of universal deceit - telling the truth is a revolutionary act." -- George Orwell
(R3X Runtime VM)(CHIP8 Interpreter OS)
User avatar
sortie
Member
Member
Posts: 931
Joined: Wed Mar 21, 2012 3:01 pm
Libera.chat IRC: sortie

Re: Bare Bones tutorial, grub2 says "no multiboot header fou

Post by sortie »

As the others are trying to hint, you need a cross-compiler to carry out the Bares Bones tutorial.

@handuel: There is no special C++ Bare Bones tutorial, I collapsed them into a single tutorial to avoid a multiple maintenance problem. The regular Bare Bones tutorial has instructions for both C and C++.
Post Reply