diff --git a/Makefile b/Makefile index 3082b2e7..a6e5be1f 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,18 @@ -.PHONY: all clean +.PHONY: all clean test all: $(MAKE) -C src all clean: $(MAKE) -C src clean + +test: + $(MAKE) -C test + dd if=/dev/zero bs=1M count=0 seek=64 of=test.img + parted -s test.img mklabel msdos + parted -s test.img mkpart primary 1 100% + echfs-utils -m -p0 test.img quick-format 32768 + echfs-utils -m -p0 test.img import test/test.elf test.elf + echfs-utils -m -p0 test.img import test/qloader2.cfg qloader2.cfg + ./qloader2-install test.img + qemu-system-x86_64 -hda test.img diff --git a/test/.gitignore b/test/.gitignore new file mode 100644 index 00000000..4ce83ce5 --- /dev/null +++ b/test/.gitignore @@ -0,0 +1,2 @@ +test.o +test.elf diff --git a/test/Makefile b/test/Makefile new file mode 100644 index 00000000..e822929d --- /dev/null +++ b/test/Makefile @@ -0,0 +1,3 @@ +test.elf: + nasm test.asm -felf32 -o test.o + ../toolchain/bin/i386-elf-ld test.o -nostdlib -T ./linker.ld -o test.elf diff --git a/test/linker.ld b/test/linker.ld new file mode 100644 index 00000000..92cdcf66 --- /dev/null +++ b/test/linker.ld @@ -0,0 +1,22 @@ +ENTRY(_start) + +SECTIONS { + . = 0x100000; + + .text : { + *(.text*) + } + + .rodata : { + *(.rodata*) + } + + .data : { + *(.data*) + } + + .bss : { + *(.bss*) + *(COMMON) + } +} diff --git a/test/qloader2.cfg b/test/qloader2.cfg new file mode 100644 index 00000000..5d729370 --- /dev/null +++ b/test/qloader2.cfg @@ -0,0 +1,4 @@ +KERNEL_DRIVE=128 +KERNEL_PARTITION=0 +KERNEL_PATH=test.elf +KERNEL_CMDLINE=none diff --git a/test/test.asm b/test/test.asm new file mode 100644 index 00000000..037d08b2 --- /dev/null +++ b/test/test.asm @@ -0,0 +1,10 @@ +; This is a compliant "kernel" meant for testing purposes. + +; Header + + +section .text + +; Entry point +_start: +