1
0
Fork 0
mirror of https://github.com/tailix/loadwarka.git synced 2024-12-02 14:05:11 -05:00

Add build system, stages 1 & 2

This commit is contained in:
Alex Kotov 2022-01-27 01:19:39 +05:00
parent 7c373b767a
commit d241701b21
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08
5 changed files with 109 additions and 7 deletions

2
.gitignore vendored
View file

@ -3,7 +3,9 @@
##########################
*.a
*.bin
*.c.d
*.img
*.o
.deps/

13
build.sh Executable file
View file

@ -0,0 +1,13 @@
#!/bin/sh
set -e
BIN='../cross/root/bin'
CROSS="$BIN/i386-elf-"
${CROSS}as -c src/x86_stage1.S -o src/x86_stage1.o
${CROSS}as -c src/x86_stage2.S -o src/x86_stage2.o
${CROSS}ld -Ttext 200000 --oformat binary -o src/x86_stage1.bin src/x86_stage1.o
${CROSS}ld -Ttext 200000 --oformat binary -o src/x86_stage2.bin src/x86_stage2.o
./testyboot mbr mbr.bin src/x86_stage1.bin
cat mbr.bin src/x86_stage2.bin > disk.img

5
clean.sh Executable file
View file

@ -0,0 +1,5 @@
#!/bin/sh
set -e
rm -fv disk.img mbr.bin src/*.bin src/*.o

View file

@ -1,9 +1,19 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
.code16
.global _start
.section .text
_start:
mov $0x02, %ah
mov $1, %al /* Sectors count */
mov $0x80, %dl /* Drive */
mov $0, %ch /* Cylinder */
mov $0, %dh /* Head */
mov $2, %cl /* Cylinder and sector */
mov $0x7e00, %bx /* Address */
int $0x13
mov $0x0E, %ah
mov $'H', %al
int $0x10
@ -15,19 +25,31 @@ _start:
int $0x10
mov $'o', %al
int $0x10
mov $',', %al
int $0x10
mov $' ', %al
int $0x10
mov $'W', %al
int $0x10
mov $'o', %al
mov $'f', %al
int $0x10
mov $'r', %al
int $0x10
mov $'l', %al
mov $'o', %al
int $0x10
mov $'d', %al
mov $'m', %al
int $0x10
mov $' ', %al
int $0x10
mov $'S', %al
int $0x10
mov $'t', %al
int $0x10
mov $'a', %al
int $0x10
mov $'g', %al
int $0x10
mov $'e', %al
int $0x10
mov $' ', %al
int $0x10
mov $'1', %al
int $0x10
mov $'!', %al
int $0x10
@ -35,5 +57,10 @@ _start:
int $0x10
mov $'\n', %al
int $0x10
ljmp $0, $0x7e00
_loop:
cli
hlt
jmp _loop

55
src/x86_stage2.S Normal file
View file

@ -0,0 +1,55 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
.code16
.global _start
.section .text
_start:
mov $0x0E, %ah
mov $'H', %al
int $0x10
mov $'e', %al
int $0x10
mov $'l', %al
int $0x10
mov $'l', %al
int $0x10
mov $'o', %al
int $0x10
mov $' ', %al
int $0x10
mov $'f', %al
int $0x10
mov $'r', %al
int $0x10
mov $'o', %al
int $0x10
mov $'m', %al
int $0x10
mov $' ', %al
int $0x10
mov $'S', %al
int $0x10
mov $'t', %al
int $0x10
mov $'a', %al
int $0x10
mov $'g', %al
int $0x10
mov $'e', %al
int $0x10
mov $' ', %al
int $0x10
mov $'2', %al
int $0x10
mov $'!', %al
int $0x10
mov $'\r', %al
int $0x10
mov $'\n', %al
int $0x10
_loop:
cli
hlt
jmp _loop