Compare commits
1 Commits
4e05efaa6b
...
trunk
| Author | SHA1 | Date | |
|---|---|---|---|
| 528e3d69fe |
2
.github/workflows/daily.yaml
vendored
2
.github/workflows/daily.yaml
vendored
@@ -3,7 +3,7 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches: [ $default-branch ]
|
branches: [ $default-branch ]
|
||||||
schedule:
|
schedule:
|
||||||
- cron: "0 7 * * *" # daily 07:00
|
- cron: "0 7 * * 1" # mondays at 07:00
|
||||||
workflow_dispatch: {}
|
workflow_dispatch: {}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|||||||
141
Makefile
141
Makefile
@@ -13,93 +13,74 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
INCDIR := include
|
include := './include'
|
||||||
BUILD_DIR := build
|
|
||||||
IMG := $(BUILD_DIR)/disk.img
|
mbr_source_files := $(wildcard src/mbr/*.nasm)
|
||||||
IMGZ := $(BUILD_DIR)/disk.img.gz
|
vbr_source_files := $(wildcard src/vbr/*.nasm)
|
||||||
DEP_DIR := $(BUILD_DIR)/deps
|
stage2_source_files := $(wildcard src/stage2/*.nasm)
|
||||||
|
boottest_source_files := $(wildcard src/miniboot32/*.nasm)
|
||||||
|
|
||||||
|
mbr_binary_files := $(patsubst src/mbr/%.nasm, build/%.bin, $(mbr_source_files))
|
||||||
|
vbr_binary_files := $(patsubst src/vbr/%.nasm, build/%.bin, $(vbr_source_files))
|
||||||
|
stage2_binary_files := $(patsubst src/stage2/%.nasm, build/%.bin, $(stage2_source_files))
|
||||||
|
boottest_binary_files := $(patsubst src/miniboot32/%.nasm, build/%.bin, $(boottest_source_files))
|
||||||
|
|
||||||
|
build_dir := 'build'
|
||||||
|
|
||||||
# Get current Git version (tag) and hash
|
# Get current Git version (tag) and hash
|
||||||
GIT_VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo unknown)
|
GIT_VERSION := $(shell git describe --tags)
|
||||||
GIT_HASH := $(shell git rev-parse HEAD 2>/dev/null || echo unknown)
|
GIT_HASH := $(shell git rev-parse HEAD)
|
||||||
GIT_NASM_DEFINES := -D __GIT_VER__='"$(GIT_VERSION)"' -D __GIT_HASH__='"$(GIT_HASH)"'
|
GIT_NASM_DEFINES := -D __GIT_VER__='"$(GIT_VERSION)"' -D __GIT_HASH__='"$(GIT_HASH)"'
|
||||||
|
|
||||||
NASMFLAGS := -Wall -f bin -i$(INCDIR)/ $(GIT_NASM_DEFINES)
|
iso := 'build/disk.img'
|
||||||
|
isoz := 'build/output/disk.img.gz'
|
||||||
|
|
||||||
QEMU ?= qemu-system-i386
|
qemu_args := -L ./bin/ -bios bios.bin -cpu pentium3 -m 128 -S -s -monitor stdio -nic none
|
||||||
QEMU_OPTS ?= -L ./bin/ -bios bios.bin -cpu pentium3 -m 64 -S -s -monitor stdio -nic none
|
.PHONY: all mbr vbr stage2 boottest clean run run_bochs iso isoz
|
||||||
|
|
||||||
MBR_SRCS := $(wildcard src/mbr/*.nasm)
|
all: $(iso) $(isoz) $(mbr_binary_files) $(vbr_binary_files) $(stage2_binary_files)
|
||||||
VBR_SRCS := $(wildcard src/vbr/*.nasm)
|
mbr: $(mbr_binary_files)
|
||||||
STAGE2_SRCS := $(wildcard src/stage2/*.nasm)
|
vbr: $(vbr_binary_files)
|
||||||
BOOTTEST_SRCS := $(wildcard src/miniboot32/*.nasm)
|
stage2: $(stage2_binary_files)
|
||||||
|
boottest: $(boottest_binary_files)
|
||||||
MBR_BINS := $(patsubst src/mbr/%.nasm, $(BUILD_DIR)/mbr/%.bin, $(MBR_SRCS))
|
|
||||||
VBR_BINS := $(patsubst src/vbr/%.nasm, $(BUILD_DIR)/vbr/%.bin, $(VBR_SRCS))
|
|
||||||
STAGE2_BINS := $(patsubst src/stage2/%.nasm, $(BUILD_DIR)/stage2/%.bin, $(STAGE2_SRCS))
|
|
||||||
BOOTTEST_BINS := $(patsubst src/miniboot32/%.nasm, $(BUILD_DIR)/miniboot32/%.bin, $(BOOTTEST_SRCS))
|
|
||||||
|
|
||||||
ALL_BINS := $(MBR_BINS) $(VBR_BINS) $(STAGE2_BINS) $(BOOTTEST_BINS)
|
|
||||||
|
|
||||||
.DEFAULT_GOAL := all
|
|
||||||
.DELETE_ON_ERROR:
|
|
||||||
|
|
||||||
.PHONY: all mbr vbr stage2 boottest clean run run_qemu run_bochs img imgz help
|
|
||||||
all: $(IMG) $(IMGZ) $(ALL_BINS)
|
|
||||||
mbr: $(MBR_BINS)
|
|
||||||
vbr: $(VBR_BINS)
|
|
||||||
stage2: $(STAGE2_BINS)
|
|
||||||
boottest: $(BOOTTEST_BINS)
|
|
||||||
|
|
||||||
# Build Rules
|
|
||||||
|
|
||||||
$(BUILD_DIR)/mbr/%.bin: src/mbr/%.nasm | $(DEP_DIR)
|
|
||||||
@mkdir -p $(@D)
|
|
||||||
@nasm $(NASMFLAGS) -MD $(DEP_DIR)/$*.d -MT $@ $< -o $@
|
|
||||||
|
|
||||||
$(BUILD_DIR)/vbr/%.bin: src/vbr/%.nasm | $(DEP_DIR)
|
|
||||||
@mkdir -p $(@D)
|
|
||||||
@nasm $(NASMFLAGS) -MD $(DEP_DIR)/$*.d -MT $@ $< -o $@
|
|
||||||
|
|
||||||
$(BUILD_DIR)/stage2/%.bin: src/stage2/%.nasm | $(DEP_DIR)
|
|
||||||
@mkdir -p $(@D)
|
|
||||||
@nasm $(NASMFLAGS) -MD $(DEP_DIR)/$*.d -MT $@ $< -o $@
|
|
||||||
|
|
||||||
$(BUILD_DIR)/miniboot32/%.bin: src/miniboot32/%.nasm | $(DEP_DIR)
|
|
||||||
@mkdir -p $(@D)
|
|
||||||
@nasm $(NASMFLAGS) -MD $(DEP_DIR)/$*.d -MT $@ $< -o $@
|
|
||||||
|
|
||||||
|
|
||||||
$(DEP_DIR):
|
|
||||||
@mkdir -p $@
|
|
||||||
|
|
||||||
# Disk image's
|
|
||||||
|
|
||||||
$(IMG): $(ALL_BINS) | $(@D) scripts/create-disk.sh
|
|
||||||
@scripts/create-disk.sh
|
|
||||||
|
|
||||||
$(IMGZ): $(IMG)
|
|
||||||
@gzip -9kc $(IMG) > $(IMGZ)
|
|
||||||
|
|
||||||
img: $(IMG)
|
|
||||||
@file $(IMG)
|
|
||||||
|
|
||||||
imgz: $(IMGZ)
|
|
||||||
@file $(IMGZ)
|
|
||||||
|
|
||||||
# Helpers
|
|
||||||
|
|
||||||
run: $(IMG)
|
|
||||||
@$(QEMU) $(QEMU_OPTS) -hda $(IMG)
|
|
||||||
|
|
||||||
run_bochs: $(IMG)
|
|
||||||
@bochs -q
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@$(RM) -rv $(BUILD_DIR)/
|
@rm -v $(build_dir)/*.bin
|
||||||
|
@rm -v $(build_dir)/*.map
|
||||||
|
@rm -v $(build_dir)/*.img
|
||||||
|
@rm -v $(build_dir)/output/*.img.gz
|
||||||
|
@rm -v $(build_dir)/output/*.tar.gz
|
||||||
|
|
||||||
help:
|
run: $(iso)
|
||||||
@awk '/^[A-Za-z0-9_%-]+:/{print $$1}' $(MAKEFILE_LIST) | sed 's/:$$//' | sort -u
|
@sudo qemu-system-i386 $(qemu_args) -hda $(iso)
|
||||||
|
|
||||||
# Include header deps
|
run_bochs: $(iso)
|
||||||
-include $(wildcard $(DEP_DIR)/*.d)
|
@bochs -q
|
||||||
|
|
||||||
|
iso: $(iso)
|
||||||
|
@file $(iso)
|
||||||
|
|
||||||
|
isoz: $(isoz)
|
||||||
|
@file $(isoz)
|
||||||
|
|
||||||
|
build/%.bin: src/mbr/%.nasm
|
||||||
|
@mkdir -p $(shell dirname $@)
|
||||||
|
@nasm -i$(include) -Wall -f bin $(GIT_NASM_DEFINES) $< -o $@
|
||||||
|
|
||||||
|
build/%.bin: src/vbr/%.nasm
|
||||||
|
@mkdir -p $(shell dirname $@)
|
||||||
|
@nasm -i$(include) -Wall -f bin $(GIT_NASM_DEFINES) $< -o $@
|
||||||
|
|
||||||
|
build/%.bin: src/stage2/%.nasm
|
||||||
|
@mkdir -p $(shell dirname $@)
|
||||||
|
@nasm -i$(include) -Wall -f bin $(GIT_NASM_DEFINES) $< -o $@
|
||||||
|
|
||||||
|
build/%.bin: src/miniboot32/%.nasm
|
||||||
|
@mkdir -p $(shell dirname $@)
|
||||||
|
@nasm -i$(include) -Wall -f bin $(GIT_NASM_DEFINES) $< -o $@
|
||||||
|
|
||||||
|
$(iso): $(mbr_binary_files) $(vbr_binary_files) $(stage2_binary_files) $(boottest_binary_files)
|
||||||
|
@scripts/create-disk.sh
|
||||||
|
|
||||||
|
$(isoz): $(iso)
|
||||||
|
@gzip -9kc $(iso) > $(isoz)
|
||||||
|
|||||||
@@ -21,10 +21,10 @@ if [ $(id -u) = 0 ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# paths to bootcode
|
# paths to bootcode
|
||||||
mbr_file=build/mbr/mbr.bin
|
mbr_file=build/mbr.bin
|
||||||
vbr_file=build/vbr/vbr.bin
|
vbr_file=build/vbr.bin
|
||||||
stage2_file=build/stage2/stage2.bin
|
stage2_file=build/stage2.bin
|
||||||
boottest_file=build/miniboot32/BOOTi686.bin
|
boottest_file=build/BOOTi686.bin
|
||||||
|
|
||||||
# Disk creation options
|
# Disk creation options
|
||||||
disk_img=build/disk.img
|
disk_img=build/disk.img
|
||||||
@@ -161,14 +161,9 @@ if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
|||||||
dd if="$part_img" of="$disk_img" bs=$disk_sector_size seek=$part_start conv=notrunc
|
dd if="$part_img" of="$disk_img" bs=$disk_sector_size seek=$part_start conv=notrunc
|
||||||
|
|
||||||
echo " *** Outputing disk images will be in ./build/output/* *** "
|
echo " *** Outputing disk images will be in ./build/output/* *** "
|
||||||
|
|
||||||
if [ ! -d ./build/output ]; then
|
|
||||||
echo "./build/output does not exist. creating"
|
|
||||||
mkdir -p ./build/output
|
|
||||||
fi
|
|
||||||
gzip -9c "$disk_img" > "$disk_img_final"
|
gzip -9c "$disk_img" > "$disk_img_final"
|
||||||
gzip -9c "$part_img" > "$part_img_final"
|
gzip -9c "$part_img" > "$part_img_final"
|
||||||
tar caf "$artifacts_archive" --exclude ./build/output ./build/
|
tar caf "$artifacts_archive" build/*.bin build/*.map
|
||||||
else
|
else
|
||||||
# Unknown.
|
# Unknown.
|
||||||
echo "Unknown OS type! Supported build hosts systems are GNU/Linux (& WSL)"
|
echo "Unknown OS type! Supported build hosts systems are GNU/Linux (& WSL)"
|
||||||
|
|||||||
Reference in New Issue
Block a user