diff --git a/.github/workflows/build_zeal8bitos.yml b/.github/workflows/build_zeal8bitos.yml index 1a2042a..351ebdb 100644 --- a/.github/workflows/build_zeal8bitos.yml +++ b/.github/workflows/build_zeal8bitos.yml @@ -36,11 +36,7 @@ jobs: - name: Build Zeal 8-bit OS (zeal8bit target) shell: bash run: | - make alldefconfig - echo 'CONFIG_ENABLE_EMULATION_HOSTFS=y' >> os.conf - make asmconf - z88dk-z80asm - make + make config=configs/zealemu.default mv build/os_with_romdisk.img build/$(git describe --tags).img - name: Update index.json diff --git a/Makefile b/Makefile index 1ad39d4..660c75c 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,18 @@ ifndef PYTHON_BIN endif export PATH := $(realpath packer)/:$(PATH) # Kconfig related -export KCONFIG_CONFIG = os.conf +export KCONFIG_CONFIG = configs/zeal8bit.default +ifneq ("$(wildcard os.conf)", "") + export KCONFIG_CONFIG = os.conf +endif +ifdef config + export KCONFIG_CONFIG = $(config) +else + ifdef ZOS_CONFIG + export KCONFIG_CONFIG = $(ZOS_CONFIG) + endif +endif + export MENUCONFIG_STYLE = aquatic export OSCONFIG_ASM = include/osconfig.asm export ZOS_PATH := $(PWD) @@ -88,7 +99,7 @@ endef # If the target is not defined, no os.conf file was created. # In that case, do not try to evaluate the build depenendies. ifdef CONFIG_TARGET -$(eval $(call IMPORT_subunitmk,ASMSRCS,INCLUDEDIRS,PRECMD,POSTCMD)) + $(eval $(call IMPORT_subunitmk,ASMSRCS,INCLUDEDIRS,PRECMD,POSTCMD)) endif # Generate the .o files out of the .c files @@ -103,11 +114,14 @@ LINKERFILE_BUILT=$(BINDIR)/$(LINKERFILE_OBJ) .PHONY: check menuconfig $(SUBDIRS) version packer asmconf -all:$(KCONFIG_CONFIG) version packer precmd $(LINKERFILE_OBJ) $(OBJS) +all:$(KCONFIG_CONFIG) asmconf version packer precmd $(LINKERFILE_OBJ) $(OBJS) $(CC) $(ASMFLAGS) -o$(FULLBIN) -b -m -s $(LINKERFILE_BUILT) $(BUILTOBJS) @mv $(BINDIR)/$(BIN_GENERATED) $(FULLBIN) - @echo "OS binary: $(FULLBIN)" @echo "Executing post commands..." + @echo "Config: $(KCONFIG_CONFIG)" + @echo "Kernel Physical Address: $(CONFIG_KERNEL_PHYS_ADDRESS)" + @echo "Host FS: $(CONFIG_ENABLE_EMULATION_HOSTFS)" + @echo "OS binary: $(FULLBIN)" $(POSTCMD) # Generate a version file that will be used as a boilerplate when the system starts @@ -115,7 +129,7 @@ all:$(KCONFIG_CONFIG) version packer precmd $(LINKERFILE_OBJ) $(OBJS) version: @echo Zeal 8-bit OS `git describe --tags` > version.txt @[ -z "$(CONFIG_KERNEL_REPRODUCIBLE_BUILD)" ] && \ - echo Build time: `date +"%Y-%m-%d %H:%M"` >> version.txt || true + echo Build time: `date +"%Y-%m-%d %H:%M"` >> version.txt || true packer: @echo "Building packer" @@ -147,13 +161,13 @@ check: # DEFM "test", 0 # ENDM define CONVERT_config_asm = - echo -e "IFNDEF OSCONFIG_H\nDEFINE OSCONFIG_H\n" > $2 && \ - cat $1 | \ - grep "^CONFIG_" | \ - sed 's/=y/=1/g' | sed 's/=n/=0/g' | \ - sed 's/\(.*\)=\(".*"\)/MACRO \1\n DEFM \2\nENDM/g' | \ - sed 's/^CONFIG/DEFC CONFIG/g' >> $2 && \ - echo -e "\nENDIF" >> $2 + echo -e "IFNDEF OSCONFIG_H\nDEFINE OSCONFIG_H\n" > $2 && \ + cat $1 | \ + grep "^CONFIG_" | \ + sed 's/=y/=1/g' | sed 's/=n/=0/g' | \ + sed 's/\(.*\)=\(".*"\)/MACRO \1\n DEFM \2\nENDM/g' | \ + sed 's/^CONFIG/DEFC CONFIG/g' >> $2 && \ + echo -e "\nENDIF" >> $2 endef asmconf: $(KCONFIG_CONFIG) @@ -161,14 +175,12 @@ asmconf: $(KCONFIG_CONFIG) @$(call CONVERT_config_asm,$(KCONFIG_CONFIG), $(OSCONFIG_ASM)) menuconfig: + @test -e os.conf || cp $(KCONFIG_CONFIG) os.conf + $(eval export KCONFIG_CONFIG = os.conf) $(MENUCONFIG) - @echo "Converting $(KCONFIG_CONFIG) to $(OSCONFIG_ASM) ..." - @$(call CONVERT_config_asm,$(KCONFIG_CONFIG), $(OSCONFIG_ASM)) alldefconfig: $(ALLDEFCONFIG) - @echo "Converting $(KCONFIG_CONFIG) to $(OSCONFIG_ASM) ..." - @$(call CONVERT_config_asm,$(KCONFIG_CONFIG), $(OSCONFIG_ASM)) prepare_dirs: @mkdir -p $(BINDIR) @@ -180,4 +192,4 @@ fdump: $(DISASSEMBLER) -o 0x0000 -x $(BINDIR)/$(MAPFILE) $(BINDIR)/$(BIN) > $(BINDIR)/os.dump clean: - rm -rf $(OSCONFIG_ASM) $(BINDIR) $(KCONFIG_CONFIG) version.txt + rm -rf $(OSCONFIG_ASM) $(BINDIR) version.txt diff --git a/configs/zeal8bit.default b/configs/zeal8bit.default new file mode 100644 index 0000000..7cf1d6f --- /dev/null +++ b/configs/zeal8bit.default @@ -0,0 +1,52 @@ +CONFIG_CPU_FREQ=10000000 +CONFIG_TARGET="zeal8bit" +CONFIG_TARGET_ZEAL_8_BIT=y +# CONFIG_TARGET_TRS_80 is not set +# CONFIG_TARGET_AGON_LIGHT is not set + +# +# Zeal 8-bit Computer configuration +# +CONFIG_TARGET_NUMBER=1 +CONFIG_TARGET_HAS_MMU=y +CONFIG_TARGET_HAS_DRIVERS_HOOK=y +CONFIG_KERNEL_RAM_PHYS_ADDRESS=0x88000 +CONFIG_ROMDISK_ADDRESS=0x8000 +CONFIG_KERNEL_PHYS_ADDRESS=0x4000 +CONFIG_KERNEL_TARGET_HAS_MMU=y +CONFIG_TARGET_ENABLE_COMPACTFLASH=y + +# +# CompactFlash driver configuration +# +CONFIG_TARGET_COMPACTFLASH_ADDRESS=0x70 +CONFIG_TARGET_COMPACTFLASH_TIMEOUT=30 +# end of CompactFlash driver configuration + +# CONFIG_ENABLE_EMULATION_HOSTFS is not set +CONFIG_TARGET_ENABLE_VIDEO=y +CONFIG_TARGET_STDOUT_VIDEO=y +# CONFIG_TARGET_STDOUT_UART is not set +CONFIG_TARGET_KEYBOARD_QWERTY=y +# CONFIG_TARGET_KEYBOARD_DVORAK is not set +# end of Zeal 8-bit Computer configuration + +# +# Kernel configuration +# +# CONFIG_KERNEL_REPRODUCIBLE_BUILD is not set +CONFIG_KERNEL_STACK_ADDR=0xFFFF +CONFIG_KERNEL_RAM_START=0xC000 +# CONFIG_KERNEL_COLDBOOT_HOOK is not set +# CONFIG_KERNEL_EXIT_HOOK is not set +CONFIG_KERNEL_DRIVERS_HOOK=y +CONFIG_KERNEL_MAX_NESTED_PROGRAMS=3 +CONFIG_KERNEL_MAX_LOADED_DRIVERS=16 +CONFIG_KERNEL_MAX_OPENED_DEVICES=16 +CONFIG_KERNEL_MAX_OPENED_FILES=16 +CONFIG_KERNEL_PATH_MAX=128 +CONFIG_KERNEL_INIT_EXECUTABLE="A:/init.bin" +CONFIG_KERNEL_INIT_EXECUTABLE_ADDR=0x4000 +CONFIG_KERNEL_LOG_BOOT_MOUNTED_DISKS=y +CONFIG_KERNEL_ENABLE_ZEALFS_SUPPORT=y +# end of Kernel configuration diff --git a/configs/zealemu.default b/configs/zealemu.default new file mode 100644 index 0000000..0ffca1f --- /dev/null +++ b/configs/zealemu.default @@ -0,0 +1,52 @@ +CONFIG_CPU_FREQ=10000000 +CONFIG_TARGET="zeal8bit" +CONFIG_TARGET_ZEAL_8_BIT=y +# CONFIG_TARGET_TRS_80 is not set +# CONFIG_TARGET_AGON_LIGHT is not set + +# +# Zeal 8-bit Computer configuration +# +CONFIG_TARGET_NUMBER=1 +CONFIG_TARGET_HAS_MMU=y +CONFIG_TARGET_HAS_DRIVERS_HOOK=y +CONFIG_KERNEL_RAM_PHYS_ADDRESS=0x88000 +CONFIG_ROMDISK_ADDRESS=0x8000 +CONFIG_KERNEL_PHYS_ADDRESS=0x0000 +CONFIG_KERNEL_TARGET_HAS_MMU=y +CONFIG_TARGET_ENABLE_COMPACTFLASH=y + +# +# CompactFlash driver configuration +# +CONFIG_TARGET_COMPACTFLASH_ADDRESS=0x70 +CONFIG_TARGET_COMPACTFLASH_TIMEOUT=30 +# end of CompactFlash driver configuration + +CONFIG_ENABLE_EMULATION_HOSTFS=y +CONFIG_TARGET_ENABLE_VIDEO=y +CONFIG_TARGET_STDOUT_VIDEO=y +# CONFIG_TARGET_STDOUT_UART is not set +CONFIG_TARGET_KEYBOARD_QWERTY=y +# CONFIG_TARGET_KEYBOARD_DVORAK is not set +# end of Zeal 8-bit Computer configuration + +# +# Kernel configuration +# +# CONFIG_KERNEL_REPRODUCIBLE_BUILD is not set +CONFIG_KERNEL_STACK_ADDR=0xFFFF +CONFIG_KERNEL_RAM_START=0xC000 +# CONFIG_KERNEL_COLDBOOT_HOOK is not set +# CONFIG_KERNEL_EXIT_HOOK is not set +CONFIG_KERNEL_DRIVERS_HOOK=y +CONFIG_KERNEL_MAX_NESTED_PROGRAMS=3 +CONFIG_KERNEL_MAX_LOADED_DRIVERS=16 +CONFIG_KERNEL_MAX_OPENED_DEVICES=16 +CONFIG_KERNEL_MAX_OPENED_FILES=16 +CONFIG_KERNEL_PATH_MAX=128 +CONFIG_KERNEL_INIT_EXECUTABLE="A:/init.bin" +CONFIG_KERNEL_INIT_EXECUTABLE_ADDR=0x4000 +CONFIG_KERNEL_LOG_BOOT_MOUNTED_DISKS=y +CONFIG_KERNEL_ENABLE_ZEALFS_SUPPORT=y +# end of Kernel configuration