How to use cross-compiler on Brian Tutorial

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.
Candamir

Re:How to use cross-compiler on Brian Tutorial

Post by Candamir »

Well, if you want to know if it worked... just put it on a boot disk (there is a boot disk image in the zip from bkerndev) and see if everything's ok. You should be able to input text from your keyboard and every second, a message should appear on the screen.

Candamir
jason7007

Re:How to use cross-compiler on Brian Tutorial

Post by jason7007 »

Hi,

Candamir, thank you very much. I will do your suggestion.
Pixion
Posts: 16
Joined: Thu Oct 25, 2007 8:18 pm

Post by Pixion »

Hi,

I went through the same stages, but on a Mac.

Here a wrap up that is working for me:

-I assume you have a working cross-compiler and binutils (target: ELF)

-As mentioned earlier in this thread, the leading underscores in the start.asm need to be removed (all of them!) as otherwise they result in 'undefined' functions or variables.

-change, as mentioned the linker script (see attached)

-Also, as the output file is ELF and not aout formatted (as Brian's kernel is assuming), start.asm need a few more changes, see attachement.

-Further, make sure you use the -f elf option in nasm, and not the -f aout option (again, we need an ELF file, not a aout)

-A batch file can easily be transferred to a build.sh script, see attachement.

-Also, using the cross-binutil objdump -f or -h can be used to check the correct ELF format of all generated intermediate .o files, respectively, verify wether symbols are defined in thos object files. Also, if you move through the tutorial, and add more *.c sources, make sure you add the resulting *. files to the command line of the linker! Otherwise, you get again 'undefined function' build errors.

Hope this helps,

Sebastian
Attachments
start.asm
(8.48 KiB) Downloaded 75 times
Brians kernel w Xcompiler.rar
(3 KiB) Downloaded 72 times
Post Reply