diff --git a/Makefile b/Makefile index 590a11c..5b13490 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ MKISOFS = genisoimage ISO = $(HOS).iso QEMU = qemu-system-x86_64 -.PHONY: kernel clean qemu +.PHONY: kernel clean qemu iso # default target: build the kernel and ISO image all: kernel iso @@ -14,6 +14,8 @@ kernel: make -C kernel # build the ISO image +iso: $(ISO) + $(ISO): kernel cp kernel/$(HOS) iso/boot $(MKISOFS) -R -b boot/grub/stage2_eltorito -no-emul-boot \ diff --git a/kernel/Makefile b/kernel/Makefile index 745f3b3..703e179 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -1,12 +1,14 @@ KERNEL = hos -TARGET = elf32-i386 +LOAD_ADDRESS = 0x100000 +LDTARGET = elf32-i386 +LDFLAGS = -Ttext $(LOAD_ADDRESS) --oformat $(LDTARGET) .PHONY: clean all: nasm -f elf -o boot.o boot.asm - ld --oformat $(TARGET) -o $(KERNEL) boot.o + ld $(LDFLAGS) -o $(KERNEL) boot.o clean: -rm -f *~ $(KERNEL) *.o