-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from albertarielw/v2
V2
- Loading branch information
Showing
16 changed files
with
24 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +0,0 @@ | ||
build/** | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,29 @@ | ||
ASM = nasm | ||
CC = gcc | ||
|
||
SRC_DIR = src | ||
BUILD_DIR = build | ||
|
||
BOOTSTRAP_FILE = bootstrap.asm | ||
INIT_KERNEL_FILES = starter.asm | ||
KERNEL_FILES = main.c | ||
KERNEL_FLAGS = -Wall -m32 -c -ffreestanding -fno-asynchronous-unwind-tables -fno-pie | ||
KERNEL_OBJECT = -o kernel.elf | ||
KERNEL_OBJECT = kernel.elf | ||
|
||
.PHONY: build link run clean | ||
|
||
build: $(SRC_DIR)/$(BOOTSTRAP_FILE) $(BUILD_DIR)/$(KERNEL_FILE) | ||
$(ASM) -f bin $(SRC_DIR)/$(BOOTSTRAP_FILE) -o $(BUILD_DIR)/bootstrap.o | ||
$(ASM) -f elf32 $(SRC_DIR)/$(INIT_KERNEL_FILES) -o $(BUILD_DIR)/starter.o | ||
$(CC) $(KERNEL_FLAGS) $(SRC_DIR)/$(KERNEL_FILES) -o $(BUILD_DIR)/$(KERNEL_OBJECT) | ||
ld -melf_i386 -Tlinker.ld $(BUILD_DIR)/starter.o $(BUILD_DIR)/kernel.elf -o $(BUILD_DIR)/minios.elf | ||
objcopy -O binary $(BUILD_DIR)/minios.elf $(BUILD_DIR)/minios.bin | ||
dd if=$(BUILD_DIR)/bootstrap.o of=$(BUILD_DIR)/kernel.img | ||
dd seek=1 conv=sync if=$(BUILD_DIR)/minios.bin of=$(BUILD_DIR)/kernel.img bs=512 count=5 | ||
dd seek=6 conv=sync if=/dev/zero of=$(BUILD_DIR)/kernel.img bs=512 count=2046 | ||
|
||
run: | ||
qemu-system-x86_64 -s $(BUILD_DIR)/kernel.img | ||
|
||
build: $(BOOTSTRAP_FILE) $(KERNEL_FILE) | ||
$(ASM) -f bin $(BOOTSTRAP_FILE) -o bootstrap.o | ||
$(ASM) -f elf32 $(INIT_KERNEL_FILES) -o starter.o | ||
$(CC) $(KERNEL_FLAGS) $(KERNEL_FILES) $(KERNEL_OBJECT) | ||
ld -melf_i386 -Tlinker.ld starter.o kernel.elf -o minios.elf | ||
objcopy -O binary minios.elf minios.bin | ||
dd if=bootstrap.o of=kernel.img | ||
dd seek=1 conv=sync if=minios.bin of=kernel.img bs=512 count=5 | ||
dd seek=6 conv=sync if=/dev/zero of=kernel.img bs=512 count=2046 | ||
qemu-system-x86_64 -s kernel.img | ||
clean: | ||
rm -rf $(BUILD_DIR)/*.o $(BUILD_DIR)/*.img $(BUILD_DIR)/*.bin $(BUILD_DIR)/*.elf |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
File renamed without changes.
Binary file not shown.
File renamed without changes.
Binary file not shown.
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters