Loader moved into new build workflow
This commit is contained in:
parent
ee7e44fbaf
commit
044d5a75b5
1
.gitignore
vendored
1
.gitignore
vendored
@ -9,3 +9,4 @@ rand/
|
|||||||
COM1.out
|
COM1.out
|
||||||
bx_enh_dbg.ini
|
bx_enh_dbg.ini
|
||||||
.vscode/
|
.vscode/
|
||||||
|
build/
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
; since we have no stack we have to create one for the OS
|
; Since we have no stack we have to create one for the OS
|
||||||
|
|
||||||
global loader
|
global loader
|
||||||
|
|
||||||
@ -7,7 +7,7 @@ MAGIC_NUMBER equ 0x1BADB002
|
|||||||
FLAGS equ 0x0
|
FLAGS equ 0x0
|
||||||
CHECKSUM equ -MAGIC_NUMBER
|
CHECKSUM equ -MAGIC_NUMBER
|
||||||
|
|
||||||
extern kmain
|
; extern kmain
|
||||||
|
|
||||||
section .text
|
section .text
|
||||||
; align all instructions to 4 byte boundary by the x86 instruction set law
|
; align all instructions to 4 byte boundary by the x86 instruction set law
|
||||||
@ -19,11 +19,13 @@ align 4
|
|||||||
|
|
||||||
; sets up our gdt and segment selectors for later use
|
; sets up our gdt and segment selectors for later use
|
||||||
|
|
||||||
loader:
|
;loader:
|
||||||
call kmain
|
; call kmain
|
||||||
|
|
||||||
.loop:
|
loader:
|
||||||
|
.loop:
|
||||||
mov eax, 0xfeedbeef
|
mov eax, 0xfeedbeef
|
||||||
jmp .loop
|
jmp .loop
|
||||||
mov eax, 0xfeedbeef
|
mov eax, 0xfeedbeef
|
||||||
|
|
||||||
|
|
24
makefile
24
makefile
@ -3,19 +3,21 @@ ASM=nasm
|
|||||||
LINK=ld
|
LINK=ld
|
||||||
ISO=genisoimage
|
ISO=genisoimage
|
||||||
|
|
||||||
OBJECTS=mem.o kernel.o gdt_seg.o gdt.o interrupts.o loader.o serial.o \
|
BUILD_DIR=build
|
||||||
framebuffer.o ports.o stlio.o tests.o interrupt_entry.o pit.o kbd.o\
|
|
||||||
shell.o
|
COMPONENTS=loader
|
||||||
|
# Rebuild the components var to be usable in recipes
|
||||||
|
OBJECTS := $(addprefix build/,$(addsuffix .o,$(COMPONENTS)))
|
||||||
|
|
||||||
AFLAGS=-f elf32
|
AFLAGS=-f elf32
|
||||||
CFLAGS=-masm=intel -O2 -m32 -nostdlib -nostdinc -fno-builtin -fno-stack-protector -nostartfiles \
|
CFLAGS=-masm=intel -O2 -m32 -nostdlib -nostdinc -fno-builtin -fno-stack-protector -nostartfiles \
|
||||||
-nodefaultlibs -Wall -Wextra -c #-Werror -c
|
-nodefaultlibs -Wall -Wextra -c #-Werror -c
|
||||||
|
|
||||||
all: kernel.elf
|
compile: kernel.elf
|
||||||
|
|
||||||
# Link objects together to produce the kernel object
|
# Link objects together to produce the kernel object
|
||||||
kernel.elf: $(OBJECTS)
|
kernel.elf: $(COMPONENTS)
|
||||||
$(LINK) -T link.ld -melf_i386 $(OBJECTS) -o kernel.elf
|
$(LINK) -T link.ld -melf_i386 $(OBJECTS) -o build/$@
|
||||||
|
|
||||||
# Builds image of our os
|
# Builds image of our os
|
||||||
jos.iso: kernel.elf
|
jos.iso: kernel.elf
|
||||||
@ -30,17 +32,15 @@ jos.iso: kernel.elf
|
|||||||
-o jos.iso \
|
-o jos.iso \
|
||||||
iso
|
iso
|
||||||
|
|
||||||
# Builind asm objects
|
# Components which make up the OS
|
||||||
%.o: %.s
|
loader: loader/main.s
|
||||||
$(ASM) $(AFLAGS) $< -o $@
|
$(ASM) $(AFLAGS) $< -o $(BUILD_DIR)/$@.o
|
||||||
|
|
||||||
# Building C objecets
|
|
||||||
%.o: %.c
|
|
||||||
$(CC) $(CFLAGS) $< -o $@
|
|
||||||
|
|
||||||
# Running (no recipes called)
|
# Running (no recipes called)
|
||||||
run: jos.iso
|
run: jos.iso
|
||||||
bochs -f bochsrc.conf -q
|
bochs -f bochsrc.conf -q
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
rm -f build/*
|
||||||
rm -rf *.o kernel.elf jos.iso bochslog.txt
|
rm -rf *.o kernel.elf jos.iso bochslog.txt
|
||||||
|
Loading…
Reference in New Issue
Block a user