Home arrow Forums
OSDEV Forums  


<< Start < Previous 1 2 Next > End >>
gaf
User

Platinum Osdever
Posts: 153
graph
Karma: 10  
Re:Something that cannot be described in a subject - 2006/09/02 10:40 Nope, although I do have an ICQ account that I never use: Last time I logged-in, some people just couldn't believe that I'm still alive

My mail is cosmo86(dot)trion(at)gmx(dot)de and I actually check it quite frequently. Just don't expect any instant answers as you unfortunately happen to live on the wrong side of the globe.

cheers,
gaf
  | | The administrator has disabled public write access.
OSDEV
Community
Advertisement
   
Mike359
User

Senior Osdever
Posts: 27
graphgraph
Karma: 1  
Re:Something that cannot be described in a subject - 2006/09/04 22:48 Fuck Jloc and Watcom (For OS Deving).
Im going to use GCC and its LD linker. Maybye I can actually make all my time writing my entire C/C++ kernel pay off now.

Does GCC follow the ANSI C/C++ draft?
  | | The administrator has disabled public write access.
gaf
User

Platinum Osdever
Posts: 153
graph
Karma: 10  
Re:Something that cannot be described in a subject - 2006/09/05 10:06 I guess the guys at mega-tokyo are right when they suggest you to use a cross-compiler. If you just follow the instructions in the FAQ (only need step one for the moment) you should actually have your compiler in some 30-60 minutes. Most of the time is eaten up by download and compiling:

- Get the cygwin installer and set-up a basic cygwin system. During the installing process you'll have to choose which packages to include. It's necessary to at least add "make", "gcc-core" and "gcc-g++" (all in "development") to the list of packages.
- After the cygwin installation has completed, you need to download some gcc source to build the cross-compiler (binutils (13.2 MiB ), gcc-core (16.3 MiB ), gcc-g++) (3.6 MiB ).
- Now extract all archives to /cygwin/usr/src (or any other location that you think is appropriate). If your Zip program can't handle .bz2 archives, you might want to have a look at 7zip.
- Start cygwin (click /cygwin/cygwin.bat) and type in the instructions from the FAQ to build the crosscompiler.

Code:

 export PREFIX=/usr/cross // target of the installation export TARGET=i586-elf   // pentium (i586) or pentium pro (i686) ? cd /usr/src mkdir build-binutils build-gcc cd /usr/src/build-binutils ../binutils-2.17/configure --target=$TARGET --prefix=$PREFIX --disable-nls make all install cd /usr/src/build-gcc export PATH=$PATH:$PREFIX/bin ../gcc-4.1.1/configure --target=$TARGET --prefix=$PREFIX --disable-nls --enable-languages=c,c++ --without-headers --with-newlib make all-gcc install-gcc



If everything worked out, you should now have a cross-compiler. Don't forget deleting the source in /usr/src/ unless think that you might need them later.

To compile your kernel you'll now have to create an ld linker script (/home/user/OS/link.ld):

Code:

 OUTPUT_FORMAT("binary") ENTRY(start) SECTIONS {     .text 0x10000 :     {         *(.text)         *(.rodata*)     }     .data :     {         *(.data)     }     .bss :     {         *(.bss*)         *(.comment*)     } }



Start must be a global symbol that points to the beginning of your assembler stub code. I've actually never used the binary format and thus can't be quite sure whether the script will already be sufficient. The idea is that ld detects that 'start' is the enrtypoint and thus makes sure that it's also the first instruction. If this doesn't work, and your assembler code gets moved somewhere else, you might have to add some more trickery to the script.

Compiling the OS should now be straight forward:

Code:

 i586-elf-gcc kernel.cpp -fno-builtin -nostdlib -nostdinc -fno-rtti -fno-exceptions -nostartfiles i586-elf-gcc video.cpp -fno-builtin -nostdlib -nostdinc -fno-rtti -fno-exceptions -nostartfiles nasm -f elf startup.asm i586-elf-ld -T linker.ld startup.o kernel.o video.o



You could also create your own makefile to reduce the amount of typing needed..

regards,
gaf
  | | The administrator has disabled public write access.
Mike359
User

Senior Osdever
Posts: 27
graphgraph
Karma: 1  
Re:Something that cannot be described in a subject - 2006/09/05 16:54
Well alright this looks good. Can I compile from the Windows Command prompt (My Build batch file)?

I also want to compile to plain binary for now and target all IA32 platforms.
  | | The administrator has disabled public write access.
Mike359
User

Senior Osdever
Posts: 27
graphgraph
Karma: 1  
Re:Something that cannot be described in a subject - 2006/09/05 22:36 OSDever has some good articles about GCC
Arggh its been 2 hours now and im still compling. Let this be a lesson to upgrade.
  | | The administrator has disabled public write access.
Mike359
User

Senior Osdever
Posts: 27
graphgraph
Karma: 1  
Re:Something that cannot be described in a subject - 2006/09/05 23:33 What the hell does this mean?
echo timestamp > stmp-fixproto
make[1]: *** No rule to make target `/usr/cross/bin/i386-elf-as.exe', needed by
`stamp-as'. Stop.
make[1]: Leaving directory `/usr/src/build-gcc/gcc'
make: *** [all-gcc] Error 2
  | | The administrator has disabled public write access.
gaf
User

Platinum Osdever
Posts: 153
graph
Karma: 10  
Re:Something that cannot be described in a subject - 2006/09/06 15:41 As my own toolchain was kind of outdated I decided to just give it a try myself. The compilation worked perfectly fine, so that I've frankly no idea why it didn't work for you. Maybe you just made some typo during the configuration ?

I've uploaded the toolchain's binaries to my sourceforge project (link). Just download the archive and unpack it to /cygwin/usr/local/. The compiler should then detect the toolchain by itself ("i686-elf-gcc" should be a valid command).

regards,
gaf
  | | The administrator has disabled public write access.
Mike359
User

Senior Osdever
Posts: 27
graphgraph
Karma: 1  
Re:Something that cannot be described in a subject - 2006/09/07 20:28 So do I place all the binaries that were made in cygwinusrcrossbin and put them in the cygwin folder where all the DLLS are?

Since their i586 can they still execute on an i386? Sorry for the stupid question I have never used GCC.
  | | The administrator has disabled public write access.
gaf
User

Platinum Osdever
Posts: 153
graph
Karma: 10  
Re:Something that cannot be described in a subject - 2006/09/08 08:35 So do I place all the binaries that were made in cygwin/usr/cross/bin and put them in the cygwin folder where all the DLLS are?
Cygwin uses the environmental variable $PATH to locate its tools. Normally you can thus inform the compiler about the new toolchain by just adding its directory to the path: "PATH=/usr/cross/bin:$PATH". As cygwin however doesn't seem to store the path for any longer than the current session, you might be better off by just copying all directories in /usr/cross/ to /usr/local/. The local directory is by default part of $PATH, so that the binaries should get detected automatically.

If we're talking about my build: "Just download the archive and unpack it (reads: all directories it includes) to /cygwin/usr/local/"

Since their i586 can they still execute on an i386
As the two architectures are quite similiar I guess that it's possible to generate i386 code. Just make sure that you include -march=i386 in you gcc command and then check if it works on real hardware.

regards,
gaf
  | | The administrator has disabled public write access.
<< Start < Previous 1 2 Next > End >>

A WebArticles site. Sponsored by Evoleto. Motorola V525 / Business Directory / Delaware Incorporation / Home Made Bazaar