HELP NEEDED!!!!!!!

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.
Post Reply
hanumant
Posts: 21
Joined: Mon Jul 23, 2007 10:16 pm

HELP NEEDED!!!!!!!

Post by hanumant »

HI
i was running into support issues with DJGPP, so i switched to cygwin
and installed the gcc cross compiler as shown in teh wiki page , however
now when i run the make file it gives the following error

/usr/cross/bin/i586-elf-ld: target elf32-i586 not found
make: *** [kernel] Error 1

everything else compiles . This error was teh reason i switched from DJGPP to cygwin , still i am stuck at the same place. Please help :(


this is my makefile
# Use the cross-compiler...
CC = /usr/cross/bin/i586-elf-gcc-4.1.1

CFLAGS += -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin

kernel.img: kernel bootfloppy.img menu.cfg
cp bootfloppy.img $@
chmod +w $@
mcopy -o -i $@ $< ::/boot
mcopy -o -i $@ menu.cfg ::/boot

kernel: link.ld start.o main.o scrn.o gdt.o idt.o isrs.o irq.o timer.o kb.o mmg.o
/usr/cross/bin/i586-elf-ld -T $^ -o $@


start.o: start.asm
nasm -f elf $< -o $@



main.o : main.c
$(CC) $(CFlAGS) -o $@ -I./include -c $<


scrn.o : screen.c
$(CC) $(CFLAGS) -o $@ -I./include -c $<


gdt.o : gdt.c
$(CC) $(CFLAGS) -o $@ -I./include -c $<



idt.o : idt.c
$(CC) $(CFLAGS) -o $@ -I./include -c $<


isrs.o : isrs.c
$(CC) $(CFLAGS) -o $@ -I./include -c $<


irq.o : irq.c
$(CC) $(CFLAGS) -o $@ -I./include -c $<

timer.o: timer.c
$(CC) $(CFLAGS) -o $@ -I./include -c $<


kb.o: kb.c
$(CC) $(CFLAGS) -o $@ -I./include -c $<


mmg.o: mmg.c
$(CC) $(CFLAGS) -o $@ -I./include -c $<



.PHONY: clean

"Makefile" 61 lines, 1066 characters
jnc100
Member
Member
Posts: 775
Joined: Mon Apr 09, 2007 12:10 pm
Location: London, UK
Contact:

Post by jnc100 »

In link.ld, do you have the line OUTPUT_FORMAT ( elf32-i586 )? If so, change the elf32-i586 to elf32-i386 and it should work. The i386 refers to a 32-bit version of the ELF format for Intel compatibles, you are still generating i586 code from your cross-compiled gcc. You can get a list of the supported targets by running i586-elf-ld --help.

Regards,
John.
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Post by Candy »

Code: Select all

# Use the cross-compiler...
CC = /usr/cross/bin/i586-elf-gcc-4.1.1

CFLAGS += -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin
OBJECTS = start.o main.o scrn.o gdt.o idt.o isrs.o irq.o timer.o kb.o mmg.o

kernel.img: kernel bootfloppy.img menu.cfg
cp bootfloppy.img $@
chmod +w $@
mcopy -o -i $@ $< ::/boot
mcopy -o -i $@ menu.cfg ::/boot

kernel: link.ld makefile

kernel: $(OBJECTS)
    /usr/cross/bin/i586-elf-ld -T link.ld $^-o $@

%.o: %.asm
nasm -f elf $< -o $@

%.o : %.c
$(CC) $(CFLAGS) -o $@ -I./include -c $<

.PHONY: clean
The rest of your question should be solved by the previous answer. This makefile is more maintainable and does the same.
Post Reply