WinXP
WinXP
This has probably been done to death, but is it possible to do OS development under Windows XP? I've tried numerous times and get the surprise of being able to assemble the object file but upon linking I get errors of it not being able to use the object file. Something about unrecognized format. On my PC I have Windows XP with MinGW (GCC) and I use NASM and Bochs for my x86 emulator. I followed numerous tuts and got the same odd error concerning the object file. Any help would be greatly appreciated. I will post the example I have tested to get the error when I get home later (at college courses right now before class).
- kataklinger
- Member
- Posts: 381
- Joined: Fri Nov 04, 2005 12:00 am
- Location: Serbia
Re:WinXP
If you tell us more about errors you are getting, maybe we could help you. And what options do you use to compile source and to link object files?
I'm using Windows XP for development and it is a good platform for system development like Linux. I use Microsoft (this one is free), Intel C/C++ compilers and NASM without problems. And I'm not very familiar with MinGW/DJGPP/Cygwin/GCC.
I'm using Windows XP for development and it is a good platform for system development like Linux. I use Microsoft (this one is free), Intel C/C++ compilers and NASM without problems. And I'm not very familiar with MinGW/DJGPP/Cygwin/GCC.
- Kevin McGuire
- Member
- Posts: 843
- Joined: Tue Nov 09, 2004 12:00 am
- Location: United States
- Contact:
Re:WinXP
Which target does your version of ld support? (ld --help)
Which target are you asking it to link for in the linker script? (binary?)
You may find the last few posts in this thread useful: http://www.mega-tokyo.com/forum/index.php?board=1;action=display;threadid=8790
Which target are you asking it to link for in the linker script? (binary?)
You may find the last few posts in this thread useful: http://www.mega-tokyo.com/forum/index.php?board=1;action=display;threadid=8790
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:WinXP
More specifically, you should check your linker supports "aout" or compile the 'nasm' file to something else (presumably coff)Phugoid wrote: Which target does your version of ld support? (ld --help)
look out for output like
Code: Select all
ld: supported targets: elf32-i386 a.out-i386-linux efi-app-ia32 elf32-little elf32-big elf64-x86-64 elf64-little elf64-big srec symbolsrec tekhex binary ihex trad-core
ld: supported emulations: elf_i386 i386linux elf_x86_64
* use cygwin as it is provided, and adapt your tools/build system to work with COFF standards (e.g. -fno-leading-underscore, AOUT kludge for GRUB, etc.)
* create a cross-compiler out of cygwin, for instance, that will exactly suit your needs.
* use microsoft tools, with some customization to make them produce useful bits.
Note that each path has its drawbacks and that you'll need to check the tutorials you follow are compatible with your working environment, or adapt (either the tutorial or the environment) to make them match.
lol ;D it'd be pretty pathetic otherwise, no ?Yep. I use Microsoft Visual C++ to write mine. I like it, works nice with Windows.
- kataklinger
- Member
- Posts: 381
- Joined: Fri Nov 04, 2005 12:00 am
- Location: Serbia
Re:WinXP
@DeathGauge:
If you only use NASM, it can produce binary format without linking.
[tt]nasmw -o kernel.bin start.asm[/tt]
@Pype:
;D
He probbably tought that it works nice for OS development under Windows
If you only use NASM, it can produce binary format without linking.
[tt]nasmw -o kernel.bin start.asm[/tt]
@Pype:
;D
He probbably tought that it works nice for OS development under Windows
Re:WinXP
Yeah I'm linking binary in my script. And the output form ld -help is as follows:
Code: Select all
ld: supported targets: pe-i386 pei-i386 elf32-i386 elf32-little elf32-big srec s
ymbolsrec tekhex binary ihex
ld: supported emulations: i386pe
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:WinXP
if that's the case, "nasm -f elf ..." should do the trick when you'll have several files to link together (since elf32-i386 is supported)
Re:WinXP
DJGPP doesn't support ELF. Try some other output format for nasm, say, PE.DeathGauge wrote: I'm going to try something different. The linker seems to be the problem and the djgpp ld supports a lot more of that stuff. When I do as you said I get a new message.
nasm -f elf -o start.o start.asm
ld -T link.ld -o kernel.bin start.o
ld: PE operations on non PE file
Might I hint at a cross-compiler, as described in the OS FAQ? You can reach it by clicking on the "MEGA-TOKYO.COM" banner at the top.
Re:WinXP
I found the problem. MinGW's implements GCC differently than DJGPP. DJGPP works perfectly for OS development though. So I copied DJGPP's ld linker and renamed it to djld. So when I do this:
nasm -f aout -o start.o start.asm
djld -T link.ld -o kernel.bin start.o
It compiles perfectly:).
nasm -f aout -o start.o start.asm
djld -T link.ld -o kernel.bin start.o
It compiles perfectly:).
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:WinXP
i cannot promise it will change your life, but you could want to use cygwin instead of mingw/djgpp: they're in many ways too much targetted at DOS/windows apps respectively to be convenient for OSDev.