An additional suggestion for the 'Brans known bugs' page

All about the OSDev Wiki. Discussions about the organization and general structure of articles and how to use the wiki. Request changes here if you don't know how to use the wiki.
Post Reply
EddyDeegan
Posts: 11
Joined: Sun Nov 02, 2008 9:27 pm

An additional suggestion for the 'Brans known bugs' page

Post by EddyDeegan »

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.
User avatar
Troy Martin
Member
Member
Posts: 1686
Joined: Fri Apr 18, 2008 4:40 pm
Location: Langley, Vancouver, BC, Canada
Contact:

Re: An additional suggestion for the 'Brans known bugs' page

Post by Troy Martin »

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: Select all

[wiki]Page Name Here[/wiki]
~~Troy
Image
Image
Solar wrote:It keeps stunning me how friendly we - as a community - are towards people who start programming "their first OS" who don't even have a solid understanding of pointers, their compiler, or how a OS is structured.
I wish I could add more tex
EddyDeegan
Posts: 11
Joined: Sun Nov 02, 2008 9:27 pm

Re: An additional suggestion for the 'Brans known bugs' page

Post by EddyDeegan »

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

Eddy
kindyroot
Posts: 12
Joined: Sun Oct 19, 2008 3:57 am

Re: An additional suggestion for the 'Brans known bugs' page

Post by kindyroot »

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.
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: An additional suggestion for the 'Brans known bugs' page

Post by Combuster »

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
"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 ]
EddyDeegan
Posts: 11
Joined: Sun Nov 02, 2008 9:27 pm

Re: An additional suggestion for the 'Brans known bugs' page

Post by EddyDeegan »

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
Post Reply