Page 1 of 1

Problem with makefile and cygwin

Posted: Wed Apr 28, 2004 11:24 am
by beyondsociety
I am having sort of a problem with getting cygwin to cooperate with my makefile. Basicly it assembles my bootsector to binary and then assembles the second stage loader and all other assembly files to gnuwin32. I then compile my c files to .o files and then link it to a .exe format. I then convert it using objcopy to binary.

Every things fine at this point. I then write the two binary files to a floppy disk and boot it with bochs. Bochs loads it, but nothing gets displayed on the screen. I check the bochs_dump and it shows that everything is loaded fine except the EIP address is always at a higher address.

My code uses an linker script that loads to the 1MB mark and has an output_format of pei-i386. I have disassembled the files and checked to see that they are linked and loaded corectly.

Does anybody know what could be causing my problem?

Re:Problem with makefile and cygwin

Posted: Wed Apr 28, 2004 12:40 pm
by Tim
Do you have a working version of your code using some other compiler/linker? If so, build it using both, disassemble them, then diff the results. Hopefully the differences should be obvious.

Re:Problem with makefile and cygwin

Posted: Wed Apr 28, 2004 7:08 pm
by beyondsociety
Tim Robinson wrote: Do you have a working version of your code using some other compiler/linker? If so, build it using both, disassemble them, then diff the results. Hopefully the differences should be obvious.
Yes, it works on djgpp. Well, I'll do what you suggest and get back to you when I've narrowed my problem done.

Thanks for the help.

Re:Problem with makefile and cygwin

Posted: Wed May 05, 2004 7:53 am
by beyondsociety
I have finally figured out my problem. Last night I did a basic test kernel of my code to see what was wrong. So I goto test it and I get the same problem. I do a objdump of the stub file and check the pe headers. It shows that Im linked to start at 1MB but it was reporting the start address as 0MB. So I open the linker script and looked through it. I soon realized that my problem was because I actually added a period to the end of the .text section. Once I removed it, it started working.

Code: Select all

.text :
{
        kernel_text = .;
        *(.text.)
}

Should of been:
.text :
{
        kernel_text = .;
        *(.text);
}
Do I feel like an idiot. Thanks for the help Tim.