It dosent work...

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.
hms117

It dosent work...

Post by hms117 »

Hi,

Sry i couldnt do a better title. but problem is as follows:

Im following the Bran's Kernel Development tut. First you write the kernel in a start.asm file. then you do the link script.

Ok i follow the tut carefully and then...

When i execute the batch script NASM works fine and make the .o file but the ld.exe linker says this:

start.o : File not found : File format not recognzined

how do i come trough this?
AR

Re:It dosent work...

Post by AR »

That means that the object file is in a format not supported by the linker, ie. you ran nasm with "-f elf" or something then tried to run it through MinGW/Cygwin/DJGPP which only support COFF/PE. The solution is to add [or replace] "-f coff".
JAAman

Re:It dosent work...

Post by JAAman »

hms117 wrote: Hi,


When i execute the batch script NASM works fine and make the .o file but the ld.exe linker says this:

start.o : File not found : File format not recognzined

how do i come trough this?
this error means ld doesn't understand your object format


a quick look at the tutorial told me you might be assembling to aout? (nasm -f aout -o start.o start.asm)

if your using cygwin then you might have better luck with using PE format (since cygwin is windows, which uses PE)

i'm not sure what object formats the default build of ld understands
Phugoid

Re:It dosent work...

Post by Phugoid »

Of course, if you don't want to use PE/COFF, you can build a cross compiler (see the FAQ).
slash

Re:It dosent work...

Post by slash »

This only happens when you are using Mingw. It's ld has some problems. Switch to DJGPP and everything will be fine.
AR

Re:It dosent work...

Post by AR »

This only happens when you are using Mingw. It's ld has some problems. Switch to DJGPP and everything will be fine.
<sarcasm>Yes, reverting to an outdated GCC version running on a compatibility layer inside a compatibility layer is a much more effective solution then just changing the compiler/assembler flags</sarcasm> :)

Seriously, it is a much better idea to use a Windows build (Cygwin [native/cross] or MinGW32) unless you're actually developing in DOS, of course.
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Re:It dosent work...

Post by Candy »

Switch to DJGPP and everything will be fine.
Switch to DJGPP and you'll be able to make 16-bit COFF files with DOS-based 32-bit emulation. Use MingW and you'll be able to create 32-bit PE files without emulation. Use a cross compiler and you'll be able to make whatever type you specify without emulation.

It's your choice, but I doubt everything will be fine with DJGPP. Know what you say before you say it.
hms117

Re:It dosent work...

Post by hms117 »

The problem is i dindt even came so long that i needed a C compiler so MigGW insent the problem.

I cant right now but i'll try at home chaning the Object format.
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Re:It dosent work...

Post by Candy »

hms117 wrote: The problem is i dindt even came so long that i needed a C compiler so MigGW insent the problem.

I cant right now but i'll try at home chaning the Object format.
MingW is a compiler collection however, and includes the ld.exe file you use. The target and source object types depend on the compiler collection you're using. Your LD has been tuned to the C compiler in front of it and it probably only accepts COFF and/or PE files.

Try making a cross compiler as described in the OS FAQ (click the big bar reading "MEGA-TOKYO.COM" in orange and green at the top of the page and search for CROSS on that page). That one can be set to whatever format you want to use. First, decide which you want to use :).
slash

Re:It dosent work...

Post by slash »

In Bran's kernel dev tut it is clearly mentioned that DJGPP be used to compile the sources.
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:It dosent work...

Post by Solar »

In Bran's kernel dev tut it is clearly mentioned that DJGPP be used to compile the sources.
That's fine and dandy for Bran's kernel dev tut. This is the OS-DEV forum, where the people hang around that work on and by the OS-DEV FAQ, which says on the DJGPP page:
While DJGPP has been widely used for OS development in the past, it's close connection to MS-DOS and compatibility problems with Windows XP have caused most Windows users to shift to Cygwin or MinGW. DJGPP must be considered obsolete by now.
And on the MinGW page:
Really, you're advised not to use MinGW for OSDeving, but instead to use Cygwin. MinGW has a collection of issues that make it poorly suited for our needs...
We also created the GCC Cross-Compiler page, which reads:
Doing Step 1 below to get a dedicated (cross-) compiler for your OS development work can save you many headaches. When your system compiler drags in references to alloca() or other OS-dependent things, your compiler and your assembler can't agree on binary formats, or your bootloader stubbornly insists that it cannot read your kernel binary, the easiest solution could be setting up a dedicated Step 1 cross-compiler. If anything, it places you on the same playground as other users: You can rest assured that any problems you might yet encounter are not specific to your compiler setup.
I'm not sure how we could make it yet more prominent, but this is what the old hands on the forum came to recommend whenever someone reports problems with the dev-environment of his.
Every good solution is obvious once you've found it.
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Re:It dosent work...

Post by Candy »

In Bran's kernel dev tut it is clearly mentioned that DJGPP be used to compile the sources.
Using DJGPP will get you to the end of the tutorial. Is that what you finally want to reach at the end of the line?
Doing Step 1 below to get a dedicated (cross-) compiler for your OS development work can save you many headaches. When your system compiler drags in references to alloca() or other OS-dependent things, your compiler and your assembler can't agree on binary formats, or your bootloader stubbornly insists that it cannot read your kernel binary, the easiest solution could be setting up a dedicated Step 1 cross-compiler. If anything, it places you on the same playground as other users: You can rest assured that any problems you might yet encounter are not specific to your compiler setup.
Emphasis mine.
distantvoices
Member
Member
Posts: 1600
Joined: Wed Oct 18, 2006 11:59 am
Location: Vienna/Austria
Contact:

Re:It dosent work...

Post by distantvoices »

In Bran's kernel dev tut it is clearly mentioned that DJGPP be used to compile the sources.
Bran's text is a rough followme I daresay. It isn't what I for one call the ideal tutorial for it gives too much away to just copy'n'paste instead of giving *pointers* saying "Here I tell you how you can do it, for a more indepth explanation on this subject please check ... blah. ..." Less is more despite every next noob (not all, take care) requesting the most detailed source code about how to print hex numbers (and that's, "ned b?s sein", PROGRAMMING NITTY_GRITTY - sorry for the shouting) In other words: That tutorial pre-chews too much and saves one from deeper thinking about the subject. Just my opinion. Others mileages might vary.

Other way round: If someone tells you to jump into the maw of an erupting volcano, 'd you jump without considering things?

Stay safe.
... the osdever formerly known as beyond infinity ...
BlueillusionOS iso image
hms117

Re:It dosent work...

Post by hms117 »

First of all : I do very much to understand the code and i got the first part.

Second: I got DJGPP installed finally! It works now but comes whitd a warning about a symbol or somthing...
distantvoices
Member
Member
Posts: 1600
Joined: Wed Oct 18, 2006 11:59 am
Location: Vienna/Austria
Contact:

Re:It dosent work...

Post by distantvoices »

[edit]changed, for the guy has found the stuff by himself after all - as shows the time of his edit. My apologies[/edit]

http://www.osdever.net/downloads.php
... the osdever formerly known as beyond infinity ...
BlueillusionOS iso image
Post Reply