From bf801b82fdda3f8f91d95aa6e2e946c7ee7ea3e1 Mon Sep 17 00:00:00 2001 From: manzerbredes Date: Sun, 19 Jul 2015 11:52:01 +0400 Subject: [PATCH] Adapt Makefile, modify some comments --- kernel/Makefile | 11 +++++++++-- kernel/entry.asm | 8 ++++---- kernel/main.c | 3 +++ 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/kernel/Makefile b/kernel/Makefile index 0550f6d..02c92c2 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -1,5 +1,12 @@ -kernel.bin: - touch kernel.bin + +kernel.bin:entry.o main.o + ld -m elf_i386 --entry=_start -Ttext=0x1000 -o $@ $^ + +entry.o:entry.asm + nasm -f elf $^ +main.o:main.c + gcc -m32 -c $^ -o $@ clean: + rm ./*.o rm kernel.bin diff --git a/kernel/entry.asm b/kernel/entry.asm index fce89bf..cb41910 100644 --- a/kernel/entry.asm +++ b/kernel/entry.asm @@ -1,14 +1,14 @@ [BITS 32] -;Define extern symbole +;Define extern symbol extern main -;Define global symbole +;Define entry point as global for linking global _start ;Define kernel entry point _start: - jmp begin ;Go to begin and run main kernel function + jmp begin ;Go to begin (for skip Multiboot Specification Header) ;----- Multiboot Specification Header ----- @@ -20,5 +20,5 @@ dd 0x1BADB002 begin: - call main ;Run main function + call main ;Start kernel diff --git a/kernel/main.c b/kernel/main.c index 4487d56..e0e9ebf 100644 --- a/kernel/main.c +++ b/kernel/main.c @@ -1,4 +1,7 @@ + +//----- PiegOS kernel main ----- + void main(){ while(1);