Cannot compile kernel in Bran's Kernel Development 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.
Post Reply
crasher
Posts: 21
Joined: Mon Jan 21, 2008 4:02 am

Cannot compile kernel in Bran's Kernel Development Tutorial

Post by crasher »

Has anyone tried the small kernel developed in Bran's Kernel Development Tutorial. I tried it in Cygwin,using the downloaded bran's kernel package.
When I used the build.bat inside this package, I got
"start.o file not recognized". I thought this was because
nasm file format flag is "-f aout", so I changed it to "-f elf".
This time I got "cannot perform PE operation on non-PE file format". Other file formats were tried out but failed.

Did anyone experience this issue?
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Post by pcmattman »

Build a GCC_Cross_Compiler in Cygwin :wink: .
tigerfish
Posts: 12
Joined: Wed Jan 17, 2007 7:26 am

Post by tigerfish »

Use MinGW, leave nasm's output format as elf, and change LD's output to pei-i386.
ex. in link.ld

Code: Select all

OUTPUT_FORMAT("pei-i386") <---
ENTRY(_Init_Start)
_Data_Physical_Addr_Load = 0x00100000;
It works for me.
shadow00
Posts: 7
Joined: Wed Apr 02, 2008 5:40 pm

Post by shadow00 »

tigerfish wrote:Use MinGW, leave nasm's output format as elf, and change LD's output to pei-i386.
ex. in link.ld

Code: Select all

OUTPUT_FORMAT("pei-i386") <---
ENTRY(_Init_Start)
_Data_Physical_Addr_Load = 0x00100000;
It works for me.
On Vista it crashes ld.exe

(I'm starting to think god just doesn't want me to program an OS.)
User avatar
karloathian
Posts: 22
Joined: Fri Mar 28, 2008 12:09 am

Post by karloathian »

If you're using windows xp I personally recommand DJGPP as your compiler, LD supports the "binary" output format , and I think elf-i386 too , but you really only need the flat binary format that GRUB can understand directly.
User avatar
piranha
Member
Member
Posts: 1391
Joined: Thu Dec 21, 2006 7:42 pm
Location: Unknown. Momentum is pretty certain, however.
Contact:

Post by piranha »

(I'm starting to think god just doesn't want me to program an OS.)
This is normal.
Hang in there

-JL
SeaOS: Adding VT-x, networking, and ARM support
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io
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:

Post by Combuster »

Stick with cygwin and the cross compiler then :wink:
"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 ]
Post Reply