Add testing facilities

This commit is contained in:
mintsuki 2020-03-24 23:39:02 +01:00
parent 225a7c238d
commit 5c36fac374
6 changed files with 53 additions and 1 deletions

View File

@ -1,7 +1,18 @@
.PHONY: all clean .PHONY: all clean test
all: all:
$(MAKE) -C src all $(MAKE) -C src all
clean: clean:
$(MAKE) -C src 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

2
test/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
test.o
test.elf

3
test/Makefile Normal file
View File

@ -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

22
test/linker.ld Normal file
View File

@ -0,0 +1,22 @@
ENTRY(_start)
SECTIONS {
. = 0x100000;
.text : {
*(.text*)
}
.rodata : {
*(.rodata*)
}
.data : {
*(.data*)
}
.bss : {
*(.bss*)
*(COMMON)
}
}

4
test/qloader2.cfg Normal file
View File

@ -0,0 +1,4 @@
KERNEL_DRIVE=128
KERNEL_PARTITION=0
KERNEL_PATH=test.elf
KERNEL_CMDLINE=none

10
test/test.asm Normal file
View File

@ -0,0 +1,10 @@
; This is a compliant "kernel" meant for testing purposes.
; Header
section .text
; Entry point
_start: