blob: ae4e786fc89dfe4d1d2b9dc755c0dc69ef43953d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#!/bin/sh
AS_BOOT="nasm -felf32 -Isrc/boot/"
AS_KERN="nasm -felf32 -Isrc/boot/ -Isrc/kernel/"
SRC_DIR="src"
DST_DIR="dst"
LD="ld -T linker.ld -m elf_i386 -nostdlib"
LD_FILE="$DST_DIR/linked.o"
IMG_FILE="disk.img"
ISO_FILE="disk.iso"
NAME="kotoriforth"
clean()
{
rm -f $IMG_FILE
rm -f $ISO_FILE
rm -rf $DST_DIR
}
build()
{
clean
mkdir -p $DST_DIR/boot
mkdir -p $DST_DIR/objs
$AS_BOOT $SRC_DIR/boot/boot.stage1.asm -o $DST_DIR/objs/s1_boot.o
$AS_BOOT $SRC_DIR/boot/boot.stage2.asm -o $DST_DIR/objs/s2_boot.o
$AS_KERN $SRC_DIR/kernel/kernel.asm -o $DST_DIR/objs/kernel.o
$LD $DST_DIR/objs/s1_boot.o \
$DST_DIR/objs/s2_boot.o \
$DST_DIR/objs/kernel.o \
-o $LD_FILE
objcopy -O binary $LD_FILE $DST_DIR/$IMG_FILE
}
run()
{
qemu-system-i386 -cdrom $IMG_FILE
}
debug()
{
qemu-system-i386 -cdrom $IMG_FILE -S -s
}
case $1 in
"clean") clean ;;
"build") build ;;
"run") run ;;
"debug") debug ;;
*) echo "Use clean|build|run|debug" ;;
esac
|