How to compile .bin using GCC

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
Trixoloc
Posts: 2
Joined: Mon Jun 03, 2013 10:30 pm

How to compile .bin using GCC

Post by Trixoloc »

Hello to all here...I'm new to OSDev and I when tried the bare bones[C] I tried to compile the src[which outputs string 'Hello' World to in protected mode using....] but when I tried to compile the file it only output .obj file[pe-i386]......

Platform:win32[xp]/mingw32

Can somebody guide me here...


Thank you for giviving your precious time to this post
User avatar
xenos
Member
Member
Posts: 1121
Joined: Thu Aug 11, 2005 11:00 pm
Libera.chat IRC: xenos1984
Location: Tartu, Estonia
Contact:

Re: How to compile .bin using GCC

Post by xenos »

Obviously you didn't correctly follow the Bare Bones tutorial, as it says you need to build a GCC Cross-Compiler first.
Programmers' Hardware Database // GitHub user: xenos1984; OS project: NOS
Trixoloc
Posts: 2
Joined: Mon Jun 03, 2013 10:30 pm

Re: How to compile .bin using GCC

Post by Trixoloc »

actually I already have GCC build version 4.7.2 in MinGW envoirment with Orwvell forked dev gcc
User avatar
sortie
Member
Member
Posts: 931
Joined: Wed Mar 21, 2012 3:01 pm
Libera.chat IRC: sortie

Re: How to compile .bin using GCC

Post by sortie »

Read the tutorial. You need a i586-elf cross-compiler to complete it. The gcc that comes with your operating system/mingw is not intended to work with operating systems development. In this case, it's even worse, because your system compiler creates PE files rather than ELF files.

In addition, you fail to describe the errors you are having. Please use better english and post the errors you are having. Are you saying that you get an object file when you do gcc -c foo.c -o foo.o? Because that's normal. You need to link the kernel first. Follow the tutorial.
User avatar
xenos
Member
Member
Posts: 1121
Joined: Thu Aug 11, 2005 11:00 pm
Libera.chat IRC: xenos1984
Location: Tartu, Estonia
Contact:

Re: How to compile .bin using GCC

Post by xenos »

Just to clarify this: the GCC that comes with your OS is not a cross compiler.
Programmers' Hardware Database // GitHub user: xenos1984; OS project: NOS
Post Reply