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.
astrocrep
Member
Posts: 127 Joined: Sat Apr 21, 2007 7:21 pm
Post
by astrocrep » Mon Apr 23, 2007 7:03 pm
Makefile:
Code: Select all
CC=gcc
CFLAGS=-Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -o
LD=ld
LDFLAGS=-T link.ld -o
ASM=nasm
ASMFLAGS=-f aout -o
SOURCES=start.asm main.c scrn.c gdt.c idt.c isrs.c irq.c timer.c kb.c
OBJS=start.o main.o scrn.o gdt.o idt.o isrs.o irq.o timer.o kb.o
EXECUTABLE=kernel32.sys
all: $(EXECUTABLE)
$(EXECUTABLE) : $(OBJECTS)
$(LD) $(LDFLAGS) $(BUILDNAME) $(OBJS)
start.o : start.asm
$(ASM) $(ASMFLAGS) start.o start.asm
main.o : main.c
$(CC) $(CFLAGS) main.o main.c
scrn.o : scrn.c
$(CC) $(CFLAGS) scrn.o scrn.c
gdt.o : gdt.c
$(CC) $(CFLAGS) gdt.o gdt.c
idt.o : idt.c
$(CC) $(CFLAGS) idt.o idt.c
isrs.o : isrs.c
$(CC) $(CFLAGS) isrs.o isrs.c
irq.o : irq.c
$(CC) $(CFLAGS) irq.o irq.c
timer.o : timer.c
$(CC) $(CFLAGS) timer.o timer.c
kb.o : kb.c
$(CC) $(CFLAGS) kb.o kb.c
If I do make all or make kernel32.sys it tells me ld fails cause it cannot find an object.
I can do make main.o and it runs fine. If all the .o's are build then it makes kernel32.sys fine...
Why doesn't it know to make the missing *.o files???
Thanks,
Rich
B.E
Member
Posts: 275 Joined: Sat Oct 21, 2006 5:29 pm
Location: Brisbane Australia
Contact:
Post
by B.E » Mon Apr 23, 2007 7:25 pm
you got some variables that arnt defined (i.e spelt incorrectly):
replace
with
Microsoft: "let everyone run after us. We'll just INNOV~1"
astrocrep
Member
Posts: 127 Joined: Sat Apr 21, 2007 7:21 pm
Post
by astrocrep » Tue Apr 24, 2007 4:46 am
Ok, so I fixed that and it will build all of the .o files except for the ASM one.
When I type make the first thing I see is:
but no start.o is produced.
If I manually run the code above at the prompt it build the .o fine.
But make still fails all of the place because it cannot find the references help in start.o
Code: Select all
ld -Tlink.ld -o start.o main.o scrn.o gdt.o idt.o isrs.o irq.o timer.o kb.o
ld: warning: cannot find entry symbol start; defaulting to 0000000000100000
Followed by a slew of other errors that are trying to find a couple of other things in start.o, mainly the isr handlers.
Thanks in advance.
Rich
astrocrep
Member
Posts: 127 Joined: Sat Apr 21, 2007 7:21 pm
Post
by astrocrep » Tue Apr 24, 2007 4:48 am
Nevermind....
Another stupid bug in my makefile...
And a change to the nasm output to elf format...
Everything works!
and it boots perfect.
Thanks all!
-Rich
Solar
Member
Posts: 7615 Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:
Post
by Solar » Wed Apr 25, 2007 6:05 am
Another hint: Use ":=" instead of "=" if you define immutable lists. Variables defined by "=" have their contents evaluated every time they're used, while ":="-defined variables do so only once.
Every good solution is obvious once you've found it.