Page 1 of 1

Errors following the Bare Bones tutorial

Posted: Sat May 17, 2014 5:22 am
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

Re: Errors following the Bare Bones tutorial

Posted: Sat May 17, 2014 5:56 am
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.

Re: Errors following the Bare Bones tutorial

Posted: Sat May 17, 2014 6:22 am
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.

Re: Errors following the Bare Bones tutorial

Posted: Sat May 17, 2014 6:41 am
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?

Re: Errors following the Bare Bones tutorial

Posted: Sat May 17, 2014 7:03 am
by Combuster
sortie wrote:Post the exaxt boot.s you used.
As a file, that is.

Re: Errors following the Bare Bones tutorial

Posted: Sat May 17, 2014 11:59 am
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

Re: Errors following the Bare Bones tutorial

Posted: Sat May 17, 2014 12:08 pm
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.

Re: Errors following the Bare Bones tutorial

Posted: Sat May 17, 2014 12:46 pm
by lm
Well, that was stupid... I feel quite newbie now.

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