I am currently writing my kernel in C, and compiling it with i686-elf toolchain, and until now I used to create "exhaustive object files list" in my makefile, like this :
Code: Select all
LD := i686-elf-ld
LDFLAGS := -Ttext 0x1000 --oformat binary -e _start
ASM := nasm
ASMFLAGS := -f elf
CC := i686-elf-gcc
CFLAGS := -Wall -Wextra -c -nostdlib -fno-builtin
all: kernel.bin
kernel.bin: bootstrp.o kernel.o gdt.o idt.o pic.o keyboard.o ps2.o disk.o interrupt.o mouse.o string.o screen.o isr.o
$(LD) $(LDFLAGS) $^ -o $@
%.o: %.asm
$(ASM) $(ASMFLAGS) $< -o $@
%.o: %.c
$(CC) $(CFLAGS) $< -o $@
clean:
rm kernel.bin *.o
So today I decided to replace this list with wildcards, like this :
Code: Select all
LD := i686-elf-ld
LDFLAGS := -Ttext 0x1000 --oformat binary -e _start
ASM := nasm
ASMFLAGS := -f elf
CC := i686-elf-gcc
CFLAGS := -Wall -Wextra -c -nostdlib -fno-builtin
SRC_C := $(wildcard *.c)
SRC_ASM := $(wildcard *.asm)
OBJ := $(SRC_ASM:.asm=.o) $(SRC_C:.c=.o)
all: kernel.bin
kernel.bin: $(OBJ)
$(LD) $(LDFLAGS) $^ -o $@
%.o: %.asm
$(ASM) $(ASMFLAGS) $< -o $@
%.o: %.c
$(CC) $(CFLAGS) $< -o $@
clean:
rm kernel.bin *.o
Here is the code of bootstrp.asm :
Code: Select all
; Multiboot bootstrap
global _start
extern Kernel_start
_start:
jmp $ ;for debugging
push ebx
call Kernel_start
align 4
dd 0x1BADB002
dd 0x00000003
dd -(0x1BADB002 + 0x00000003)
Code: Select all
00001740 EBFE jmp short 0x1740
00001742 53 push ebx
00001743 E8D1E9FFFF call dword 0x119
I don't know what I am doing wrong here, can somebody help me ?
Thanks by advance,
Ankeraout.