diff --git a/.gitignore b/.gitignore index a83872b..f112ff4 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ **/bg.inc **/bg.raw **/fox32os.img +**/fox32os.img.tmp diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..05cdcb6 --- /dev/null +++ b/Makefile @@ -0,0 +1,48 @@ +RYFS := $(CURDIR)/meta/ryfs/ryfs.py +FOX32ASM := ../fox32asm/target/release/fox32asm +GFX2INC := ../tools/gfx2inc/target/release/gfx2inc + +IMAGE_SIZE := 16777216 +BOOTLOADER := bootloader/bootloader.bin + +all: fox32os.img + +base_image: + mkdir -p base_image + +base_image/kernel.fxf: kernel/main.asm + $(FOX32ASM) $< $@ + +base_image/barclock.fxf: applications/barclock/main.asm + $(FOX32ASM) $< $@ + +base_image/terminal.fxf: applications/terminal/main.asm + $(FOX32ASM) $< $@ + +base_image/foxpaint.fxf: applications/foxpaint/main.asm + $(FOX32ASM) $< $@ + +base_image/bg.fxf: applications/bg/main.asm + $(FOX32ASM) $< $@ + +base_image/bg.raw: applications/bg/bg.inc + $(FOX32ASM) $< $@ + +applications/bg/bg.inc: applications/bg/bg.png + $(GFX2INC) 640 480 $< $@ + +bootloader/bootloader.bin: bootloader/main.asm + $(FOX32ASM) $< $@ + +FILES = \ + base_image/kernel.fxf \ + base_image/barclock.fxf \ + base_image/terminal.fxf \ + base_image/foxpaint.fxf \ + base_image/bg.fxf \ + base_image/bg.raw + +fox32os.img: $(BOOTLOADER) $(FILES) + $(RYFS) -s $(IMAGE_SIZE) -l fox32os -b $(BOOTLOADER) create fox32os.img.tmp + cd base_image; for file in *; do $(RYFS) add ../fox32os.img.tmp $$file; done + cp fox32os.img.tmp fox32os.img diff --git a/README.md b/README.md index 695ef0f..738232f 100644 --- a/README.md +++ b/README.md @@ -8,5 +8,11 @@ Stable releases are available on the [Releases page](https://github.com/fox32-arch/fox32os/releases). +## How to build + +- Download [tools](https://github.com/fox32-arch/tools) and [fox32asm](https://github.com/fox32-arch/fox32asm). + Either use the pre-built binaries or build them. +- Run `make` + ## License This project is licensed under the [MIT license](LICENSE). diff --git a/build.sh b/build.sh deleted file mode 100755 index 460d4af..0000000 --- a/build.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env bash - -set -e - -mkdir -p base_image - -# if fox32os.img doesn't exist, then create it -if [ ! -f fox32os.img ]; then - echo "fox32os.img not found, creating it" - - echo "assembling bootloader" - ../fox32asm/target/release/fox32asm bootloader/main.asm bootloader/bootloader.bin - - meta/ryfs/ryfs.py -s 16777216 -l fox32os -b bootloader/bootloader.bin create fox32os.img - - rm bootloader/bootloader.bin -fi - -echo "assembling kernel" -../fox32asm/target/release/fox32asm kernel/main.asm base_image/kernel.fxf - -echo "assembling barclock" -../fox32asm/target/release/fox32asm applications/barclock/main.asm base_image/barclock.fxf - -echo "assembling terminal" -../fox32asm/target/release/fox32asm applications/terminal/main.asm base_image/terminal.fxf - -echo "assembling foxpaint" -../fox32asm/target/release/fox32asm applications/foxpaint/main.asm base_image/foxpaint.fxf - -echo "assembling bg" -../fox32asm/target/release/fox32asm applications/bg/main.asm base_image/bg.fxf - -echo "creating bg.raw" -../tools/gfx2inc/target/release/gfx2inc 640 480 applications/bg/bg.png applications/bg/bg.inc -../fox32asm/target/release/fox32asm applications/bg/bg.inc base_image/bg.raw - -echo "adding files to fox32os.img" -cd base_image -for file in ./*; do - ../meta/ryfs/ryfs.py add ../fox32os.img $file -done