Page 1 of 1

HELP NEEDED!!!!!!!

Posted: Sun Jul 29, 2007 4:01 pm
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

Posted: Sun Jul 29, 2007 4:18 pm
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.

Posted: Tue Jul 31, 2007 3:18 pm
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.