Errors following the Bare Bones tutorial

Programming, for all ages and all languages.
Post Reply
lm
Posts: 3
Joined: Sat May 17, 2014 5:09 am

Errors following the Bare Bones tutorial

Post by lm »

Hello!

This is my first post in your community so, hi everybody! =D

I'm introducing myself to the world of OS development and, after reading the introductory entries at the wiki, I have arrived at the Bare Bones tutorial.

I have produced a current version of binutils of gcc, and then I have used them to produce the i686-elf cross compiler. I have checked everything is in place and my PATH is correct and I'm calling the correct files.

So, finally, I arrive to the first file we have to assemble, boot.s. I copy it to a new file and I try to assemble it with the new tool, obtaining this error:

Code: Select all

lm@gaia:~/build/src/bbones$ i686-elf-as boot.s -o boot.o
boot.s: Assembler messages:
boot.s:57: Error: invalid operands (*UND* and *UND* sections) for `%'
that line number corresponds to

Code: Select all

movl $stack_top, %esp
Does anybody knows what I'm doing wrong?

Thanks!
lm
Octocontrabass
Member
Member
Posts: 5513
Joined: Mon Mar 25, 2013 7:01 pm

Re: Errors following the Bare Bones tutorial

Post by Octocontrabass »

While I am not fluent in AT&T syntax, I don't see anything immediately wrong with that line. Have you checked previous lines for errors? Are you sure "stack_top" is defined?

Edit: Hold on.

Code: Select all

i686-elf-as
Try using i686-elf-gcc instead.
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: Errors following the Bare Bones tutorial

Post by Combuster »

Actually, I just tested the wiki's code against binutils 2.23.2 (you shouldn't need gcc) and it just built as expected.

I'm guessing you added some additional garbage to the file that causes the assembler to trip over it.
"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 ]
User avatar
sortie
Member
Member
Posts: 931
Joined: Wed Mar 21, 2012 3:01 pm
Libera.chat IRC: sortie

Re: Errors following the Bare Bones tutorial

Post by sortie »

Post the exaxt boot.s you used. Can you post a log of you using the terminal and typing the commands and what they say?
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: Errors following the Bare Bones tutorial

Post by Combuster »

sortie wrote:Post the exaxt boot.s you used.
As a file, that is.
"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 ]
lm
Posts: 3
Joined: Sat May 17, 2014 5:09 am

Re: Errors following the Bare Bones tutorial

Post by lm »

wow, that was fast :)

I'm attaching the boot.s file I'm using, and here it's a log of my term.

Code: Select all

lm@gaia:~$ export PATH=/home/lm/build/cross/bin/:$PATH
lm@gaia:~$ i686-elf-as --version
GNU assembler (GNU Binutils) 2.24
Copyright 2013 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or later.
This program has absolutely no warranty.
This assembler was configured for a target of `i686-elf'.
lm@black:~$ i686-elf-as boot.s -o boot.o
Assembler messages:
Error: can't open boot.s for reading: No existe el fichero o el directorio
lm@gaia:~$
I guess my toolchain is incorrectly working. Something funny, if I try the nasm example, I also receive assembly errors.

I'm using Debian 7.5 stable.

Thanks!
lm
Attachments

[The extension s has been deactivated and can no longer be displayed.]

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: Errors following the Bare Bones tutorial

Post by Combuster »

Code: Select all

censored@daphnis ~/incoming $ i386-elf-as lm_bb.s -o lm_bb.o
lm_bb.s: Assembler messages:
lm_bb.s:57: Error: undefined symbol `��' in operation
lm_bb.s:57: Error: undefined symbol `esp' in operation
And there was indeed garbage unicode(?) present on that line, and getting rid of that one instance fixed the rest. I suggest you type it out manually before trying it again.
"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 ]
lm
Posts: 3
Joined: Sat May 17, 2014 5:09 am

Re: Errors following the Bare Bones tutorial

Post by lm »

Well, that was stupid... I feel quite newbie now.

Thanks for your help! The assembler doesn't comply anymore :)
Post Reply