OSDev.org
https://forum.osdev.org/

An additional suggestion for the 'Brans known bugs' page
https://forum.osdev.org/viewtopic.php?f=8&t=18302
Page 1 of 1

Author:  EddyDeegan [ Sun Nov 02, 2008 9:46 pm ]
Post subject:  An additional suggestion for the 'Brans known bugs' page

Hi,

Came across this (very cool) site after spending the last couple of days covering the basics, mainly using Bran's Kernel Development tutorial. I'm sure glad he took the time to write that! Anyway, one problem I had run into was my Grub loader not recognising the file format of my kernel binary when introducing strings into my main.c. I saw the note in the page http://wiki.osdev.org/Bran%27s_Known_Bugs regarding the .rodata section in the linker file, but in my case this appeared not to work (still getting a 1Mb+ sized binary and grub not recognising the format of the file). Examining the kernel binary using hexdump, I saw that the strings were still getting placed at location 0 rather than where they should be.

The fix is simple, and probably obvious to those in the know, but it took me a little while to solve it. Bran specifies the 'aout' format in the nasm command in his build.bat. By changing the output format of nasm from 'aout' to 'elf', as well as adding the .rodata line in the link.ld file everything works just fine.

Sorry if this has been done to death in the past, but not seeing anything on the 'known bugs' page I thought I'd mention it!

Eddy.

Author:  Troy Martin [ Sun Nov 02, 2008 10:17 pm ]
Post subject:  Re: An additional suggestion for the 'Brans known bugs' page

Hi Eddy,

Welcome to the OSDev forums! I've added your suggestion to the wiki.

BTW, you can use this as a way to link to the wiki:
Code:
[wiki]Page Name Here[/wiki]


~~Troy

Author:  EddyDeegan [ Sun Nov 02, 2008 10:38 pm ]
Post subject:  Re: An additional suggestion for the 'Brans known bugs' page

Thank you! ... and wiki link method duly noted.

Eddy

Author:  kindyroot [ Mon Nov 03, 2008 8:42 am ]
Post subject:  Re: An additional suggestion for the 'Brans known bugs' page

There are other errors in Bran's tutorial, here are some i know:
in the file scrn.c , the function settextcolor() has a ligne that misses a ';'
in the same file #include<system.h> is written with extra spaces: < system.h > (doesn't work like that).
in main.c the size_t type is not recognised!
... and i am still debugging as i go.
I think i should publish a corrected version of the sources when i fininish, as Bran doesn't seem to be interested in this **** anymore.
PS: what i don't understand is how can so many people claim that much of a success about such a bogueus code?! how do you guys do?

Edit: i found out! you should not use the main.c that was provided as a "solution" this one has like a dozen compile errors xD, use the one where you should fill you own stuff inside instead, the one that was in the page (not the link), ... i am still implementing the missing functions heheh.

Author:  Combuster [ Mon Nov 03, 2008 9:29 am ]
Post subject:  Re: An additional suggestion for the 'Brans known bugs' page

You're always going to get whitespace errors when copying from HTML pages. Better indeed to use the source archive.

Even better to use a more recent and maintained tutorial, like JamesM's series

Author:  EddyDeegan [ Mon Nov 03, 2008 9:53 am ]
Post subject:  Re: An additional suggestion for the 'Brans known bugs' page

Well I found a few pointer related issues, and some inconsistency in the use of const etc. Also, the tutorial assumes (indeed makes a point of stating) that the gcc output will contain leading underscores on externally visible functions (ie: in the ASM file you call _main rather than main) which is an old BSD standard. You can get around this by either using -fleading-underscore as an additional arg to gcc (which I wouldn't recommend) or you can just avoid using leading underscores altogether.

Basically I figured that all that stuff was not important. The tutorial is enough to get you started but if you have any difficulty resolving a few compiler warnings and basic language issues then you probably aren't ready to start writing your own kernel ;-)

Eddy

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/