From 1b0da72e5a8419015cdb2f78dff76ba31c9b58f4 Mon Sep 17 00:00:00 2001 From: josh Date: Thu, 25 Jun 2009 18:03:39 +0000 Subject: [PATCH] moved PLATFORM and associated definitions from Makefile to kernel/Makefile so the kernel can be built by itself git-svn-id: svn://anubis/hos/trunk@17 5b3e749e-e535-0410-8002-a9bb6afbdfca --- Makefile | 19 ++----------------- kernel/Makefile | 17 +++++++++++++++++ kernel/boot.asm | 4 ++++ 3 files changed, 23 insertions(+), 17 deletions(-) diff --git a/Makefile b/Makefile index f520966..393f600 100644 --- a/Makefile +++ b/Makefile @@ -3,21 +3,6 @@ KERNEL_FILE := hos.gz MKISOFS := genisoimage ISO := hos.iso QEMU := qemu-system-x86_64 -export PLATFORM := $(shell if [[ `uname` =~ "CYGWIN" ]]; then \ - echo cygwin; \ - else \ - echo unix; \ - fi) -ifeq ($(PLATFORM), cygwin) -export LD := i586-elf-ld -export CC := i586-elf-gcc -export CXX := i586-elf-g++ -else -export LD := ld -export CC := gcc -export CXX := g++ -endif -export NASM := nasm # default target: build the kernel and ISO image all: kernel iso @@ -25,7 +10,7 @@ all: kernel iso # build the kernel .PHONY: kernel kernel: - make -C $@ + $(MAKE) -C $@ # build the ISO image .PHONY: iso @@ -42,5 +27,5 @@ qemu: iso .PHONY: clean clean: - make -C kernel clean + $(MAKE) -C kernel clean -rm -f $(ISO) iso/boot/$(KERNEL_FILE) diff --git a/kernel/Makefile b/kernel/Makefile index 5aa9f1f..a8058f6 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -2,6 +2,23 @@ KERNEL := hos LDFLAGS := -T link.ld +export PLATFORM := $(shell if [[ `uname` =~ "CYGWIN" ]]; then \ + echo cygwin; \ + else \ + echo unix; \ + fi) +ifeq ($(PLATFORM), cygwin) +export LD := i586-elf-ld +export CC := i586-elf-gcc +export CXX := i586-elf-g++ +else +export LD := ld +export CC := gcc +export CXX := g++ +endif +export NASM := nasm + + .PHONY: all all: $(KERNEL).gz diff --git a/kernel/boot.asm b/kernel/boot.asm index e05b9fd..aba9108 100644 --- a/kernel/boot.asm +++ b/kernel/boot.asm @@ -12,9 +12,13 @@ %define TEMPORARY_STACK_PHYSICAL 0x01000000-4 ; top of first 16MB %define TEMPORARY_STACK_VIRTUAL TEMPORARY_STACK_PHYSICAL + VIRTUAL_OFFSET +%define PAGE_SIZE 0x1000 ; 4KB pages + ; Get these symbols from the linker extern _end, _bss + +;------------------------------------------------------- [section .text] ;************************************************************************** ;* This is the first symbol in the .text section *