Developing OS under Mac OS X
Developing OS under Mac OS X
Hello everbody of the forum!
I'm an italian engineering student and i'm trying to develop my own s.o. I follow the Bran's Kernel Development Tutorial and i finished it.
But now i decide to re-write my o.s.. I'm a MacBook user and i don't like to use virtual machine to emulate windows or linux. So i decide to use the Mac os X compiler, the gcc. With .c files and .asm files there aren't any problem but when i use the linker (the same code of the tutorial) i've got some problem and so i can't get the .bin file.
does anyone use leopard or tiger to develop his os? can anyone help me? maybe there is a tutorial on how to set up for example net beans or similar... thanks for your help..
I'm an italian engineering student and i'm trying to develop my own s.o. I follow the Bran's Kernel Development Tutorial and i finished it.
But now i decide to re-write my o.s.. I'm a MacBook user and i don't like to use virtual machine to emulate windows or linux. So i decide to use the Mac os X compiler, the gcc. With .c files and .asm files there aren't any problem but when i use the linker (the same code of the tutorial) i've got some problem and so i can't get the .bin file.
does anyone use leopard or tiger to develop his os? can anyone help me? maybe there is a tutorial on how to set up for example net beans or similar... thanks for your help..
- Combuster
- 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: Developing OS under Mac OS X
I haven't got a Mac, but you should try making a GCC Cross-Compiler, which should help. After that you can just set your favorite editor to use the generated applications.
Re: Developing OS under Mac OS X
yes, i had the same kind of trouble. a cross-compiler sorted my problem out though so try that.
i can verify that gcc 4.2.4 and the latest binutils both compile without any errors using the wiki tutorial and the Mac terminal.
Good Luck!
James.
i can verify that gcc 4.2.4 and the latest binutils both compile without any errors using the wiki tutorial and the Mac terminal.
Good Luck!
James.
Re: Developing OS under Mac OS X
but the gcc that is already installed in leopard (installing Xcode) is ok to compile the o.s.?
Re: Developing OS under Mac OS X
What executable format does Mac use? elf? If so, yes, if not, probably no.Srowen wrote:but the gcc that is already installed in leopard (installing Xcode) is ok to compile the o.s.?
JAL
- Colonel Kernel
- Member
- Posts: 1437
- Joined: Tue Oct 17, 2006 6:06 pm
- Location: Vancouver, BC, Canada
- Contact:
Re: Developing OS under Mac OS X
No, you will need to create a gcc cross-compiler.Srowen wrote:but the gcc that is already installed in leopard (installing Xcode) is ok to compile the o.s.?
Top three reasons why my OS project died:
- Too much overtime at work
- Got married
- My brain got stuck in an infinite loop while trying to design the memory manager
Re: Developing OS under Mac OS X
You'll need a cross compiler, unless you plan on using the Mach-O format. The GCC that's installed by default is only capable of producing Mach-O files (and Universal Binaries, of course). I use GCC 4.2.4 and Binutils 2.18 without any problems. The cross-compiler tutorial on the wiki works without any problems, provided you of course follow the instructions.jal wrote:What executable format does Mac use? elf? If so, yes, if not, probably no.Srowen wrote:but the gcc that is already installed in leopard (installing Xcode) is ok to compile the o.s.?
JAL
If you have problems though, I can create a generic i586-elf and x86_64-elf toolchain for OS X, throw it into a DMG and send it your way. Earlier this week I took my script that does the cross-tools compilation and made it work with macports.
Speaking of macports, you may be able to install a gcc from there that will create ELF files, but I haven't tried it yet, so it may not work.
Re: Developing OS under Mac OS X
Just checked this out... GCC 4.0.1 is default on OS X 10.5. If you have macports installed, the easiest way to get an i386-elf cross compiler is to do this:quok wrote: Speaking of macports, you may be able to install a gcc from there that will create ELF files, but I haven't tried it yet, so it may not work.
Code: Select all
$ port install i386-elf-gcc
$ port install i386-elf-binutils
Re: Developing OS under Mac OS X
i've got some problem with the mac ports.. if you can create the dmg file you make me a very happy man!
i also tired with the tutorial but i think to do something wrong..
i also tired with the tutorial but i think to do something wrong..
- Steve the Pirate
- Member
- Posts: 152
- Joined: Fri Dec 15, 2006 7:01 am
- Location: Brisbane, Australia
- Contact:
Re: Developing OS under Mac OS X
I followed the tutorial, and it was very easy - what exactly was your problem with it?
Re: Developing OS under Mac OS X
When i try to do the command
it say:
and also before, when i build the binutilis, it say, at the end, after the command "make install":
Code: Select all
../gcc-x.x.x/configure --target=$TARGET --prefix=$PREFIX --disable-nls
--enable-languages=c,c++ --without-headers
it say:
Code: Select all
configure: error: Building GCC requires GMP 4.1+ and MPFR 2.3.0+.
Try the --with-gmp and/or --with-mpfr options to specify their locations.
Copies of these libraries' source code can be found at their respective
hosting sites as well as at ftp://gcc.gnu.org/pub/gcc/infrastructure/.
See also http://gcc.gnu.org/install/prerequisites.html for additional info.
If you obtained GMP and/or MPFR from a vendor distribution package, make
sure that you have installed both the libraries and the header files.
They may be located in separate packages.
Code: Select all
make[3]: Nothing to be done for `install'.
make[1]: Nothing to be done for `install-target'.
Re: Developing OS under Mac OS X
Hi,
To build the latest versions of GCC (4.3.+, I think), you need GMP and MPFR - the versions that come with Cygwin are too old. There is a note about that in the Cross Compiler article along with a link to a page showing you how to build GMP and MPFR.
Cheers,
Adam
To build the latest versions of GCC (4.3.+, I think), you need GMP and MPFR - the versions that come with Cygwin are too old. There is a note about that in the Cross Compiler article along with a link to a page showing you how to build GMP and MPFR.
Cheers,
Adam
- Steve the Pirate
- Member
- Posts: 152
- Joined: Fri Dec 15, 2006 7:01 am
- Location: Brisbane, Australia
- Contact:
Re: Developing OS under Mac OS X
i tried the gcc version 3.3 and now, at the command "make all-gcc" it say:
Code: Select all
../../gcc-3.3/gcc/crtstuff.c: In function `frame_dummy':
../../gcc-3.3/gcc/crtstuff.c:316: warning: passing arg 1 of `__register_frame_info' discards qualifiers from pointer target type
make[1]: *** [crtbegin.o] Error 1
make: *** [all-gcc] Error 2
Re: Developing OS under Mac OS X
mmm.. i had
now i think to have compiled it...no error message..
Code: Select all
../gcc-x.x.x/configure --target=$TARGET --prefix=$PREFIX --disable-nls \
--enable-languages=c,c++ --without-headers --with-newlib