So, the day before I could not sleep. It was close to the morning and at the time it sounded like a good idea to start developing my own OS. After reading pages on the net and the wiki here I finally started with the GCC cross compiler. I don't use linux, so I am not very familiar with a lot of things. But I got trough installing cygwin and setting up binutils and gcc cross compiler, probably successfully. I now have a cygwin installation with a GCC 4.4.0 i586 cross compiler, and binutils. I only have the GAS assembly, could not find the nasm.
Anyway, so I moved on to compiling the C bare bone to see if everything is working, http://wiki.osdev.org/Bare_bones. I used the GAS assembly, no errors. I compiled the kernel.c without any problems, except a warning for unused variable, but that is all. All this done using the cross compiler and assembly. Then I used the linker from the same cross compiler tools, to link them all. Now I got myself a nice 2.2k kernel.bin file.
Then I prepared my floppy image and started bochs. GRUB loaded but my kernel did not. I got an "invalid or unsupported executable format" error.
I re-compiled, and relinked a few times, double checking everything. I did not get any errors and I did use the cross compiler. I know there is not enough information here to find the problem, but can anyone give me any pointers?
I am thinking of starting fresh from the start again, to make sure the cross compiler is done correctly. But it takes hours to make, don't want to go trough all that just to find out it was something else.
Beginner Question
Re: Beginner Question
You said you double-checked everything. Well... tripple-check?
Use the 'file' command on your executable, and your object files, to check their respective formats.
Use the 'file' command on your executable, and your object files, to check their respective formats.
Every good solution is obvious once you've found it.
Re: Beginner Question
Thanks for that tip, the file command was really helpful.
Before trying this on bochs, I tried it on a real machine, repeatedly. And I tried linking and compiling in any way I could think of. I think the last thing I tried was to use the host linker, so it was not in the correct format. Now I re-linked it and it works in bochs.
Any tips on using USB to boot my image? I tried using usbnetbootin and super grub, but could not get it to work correctly.
Before trying this on bochs, I tried it on a real machine, repeatedly. And I tried linking and compiling in any way I could think of. I think the last thing I tried was to use the host linker, so it was not in the correct format. Now I re-linked it and it works in bochs.
Any tips on using USB to boot my image? I tried using usbnetbootin and super grub, but could not get it to work correctly.
- alethiophile
- Member
- Posts: 90
- Joined: Sat May 30, 2009 10:28 am
Re: Beginner Question
I think that Cygwin's gcc will automatically make executables in Microsoft's .exe format. Maybe try booting from a Linux livecd and seeing what happens there?
If I had an OS, there would be a link here.