From 2173d144b10a75fbfca1fe0d3245db12228c9014 Mon Sep 17 00:00:00 2001 From: Braiden Vasco Date: Sun, 5 Nov 2017 18:24:19 +0000 Subject: [PATCH] Add two dummy modules --- .gitignore | 2 -- Makefile | 2 +- iso/Makefile | 4 ++-- iso/rootfs/boot/grub/grub.cfg | 4 +++- modules/Makefile | 10 +++++++--- modules/{dummy.asm => dummy1.asm} | 5 +---- modules/dummy2.asm | 11 +++++++++++ 7 files changed, 25 insertions(+), 13 deletions(-) rename modules/{dummy.asm => dummy1.asm} (67%) create mode 100644 modules/dummy2.asm diff --git a/.gitignore b/.gitignore index 10d43b6..c5a55f8 100644 --- a/.gitignore +++ b/.gitignore @@ -5,7 +5,5 @@ /arch/kernel /libk/libk.a -/modules/dummy /iso/image.iso /iso/rootfs/boot/kernelmq -/iso/rootfs/boot/dummy diff --git a/Makefile b/Makefile index 34bf467..08a1c7e 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ include config.mk export INCLUDE = $(shell pwd)/include export KERNEL = $(shell pwd)/arch/kernel export LIBK = $(shell pwd)/libk/libk.a -export DUMMY = $(shell pwd)/modules/dummy +export MODULES = $(addprefix $(shell pwd)/modules/, dummy1.bin dummy2.bin) run: run-iso diff --git a/iso/Makefile b/iso/Makefile index c73be41..e0013ca 100644 --- a/iso/Makefile +++ b/iso/Makefile @@ -4,8 +4,8 @@ run: all all: grub-file --is-x86-multiboot2 "$(KERNEL)" cp "$(KERNEL)" rootfs/boot/kernelmq - cp "$(DUMMY)" rootfs/boot/dummy + cp $(MODULES) rootfs/boot/ grub-mkrescue rootfs -o image.iso clean: - rm -f image.iso rootfs/boot/kernelmq rootfs/boot/dummy + rm -f image.iso rootfs/boot/kernelmq rootfs/boot/*.bin diff --git a/iso/rootfs/boot/grub/grub.cfg b/iso/rootfs/boot/grub/grub.cfg index ad3f35c..7c815dc 100644 --- a/iso/rootfs/boot/grub/grub.cfg +++ b/iso/rootfs/boot/grub/grub.cfg @@ -1,4 +1,6 @@ menuentry "KernelMQ" { multiboot2 /boot/kernelmq hello kernel - module2 /boot/dummy qwe rty + + module2 /boot/dummy1.bin foo bar + module2 /boot/dummy2.bin car cdr } diff --git a/modules/Makefile b/modules/Makefile index 0a88f91..590e10b 100644 --- a/modules/Makefile +++ b/modules/Makefile @@ -1,5 +1,9 @@ -all: - nasm -f bin dummy.asm -o dummy +BINS = dummy1.bin dummy2.bin + +all: $(BINS) clean: - rm -f dummy + rm -f $(BINS) + +%.bin: %.asm + nasm -f bin $< -o $@ diff --git a/modules/dummy.asm b/modules/dummy1.asm similarity index 67% rename from modules/dummy.asm rename to modules/dummy1.asm index 3e0017c..18be24f 100644 --- a/modules/dummy.asm +++ b/modules/dummy1.asm @@ -1,10 +1,7 @@ [BITS 32] main: - mov eax, 512 - int 0x80 - - mov eax, 35000 + mov eax, 123 int 0x80 mov eax, 0 ; exit diff --git a/modules/dummy2.asm b/modules/dummy2.asm new file mode 100644 index 0000000..55401ae --- /dev/null +++ b/modules/dummy2.asm @@ -0,0 +1,11 @@ +[BITS 32] + +main: + mov eax, 456 + int 0x80 + + mov eax, 0 ; exit + mov ebx, 0 ; error code + int 0x80 + + ret