From be11b50252634c28981f2e7bdb99b001532ada09 Mon Sep 17 00:00:00 2001 From: Andrew Bird Date: Sun, 11 Feb 2024 18:14:28 +0000 Subject: [PATCH 1/7] Share: Update submodule --- share | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share b/share index f2efe19f..47f3d425 160000 --- a/share +++ b/share @@ -1 +1 @@ -Subproject commit f2efe19f234eb752de57c633c5147d7e060d9cfa +Subproject commit 47f3d42527256fa46a00fe84cdb46d90f2e66f50 From 4c58d4c7e2e7e94293f11bd2b7484219c89b1c6b Mon Sep 17 00:00:00 2001 From: Andrew Bird Date: Wed, 7 Feb 2024 18:40:30 +0000 Subject: [PATCH 2/7] CI: Add DOS builds 1/ Watcom 1.9 a) Kernel and other directories building fine b) Share doesn't support Watcom for TSR. 2/ Turbo C 2.01 a) Kernel build needs some functions that are missing. b) Sys not building for the same reason, c) Share building nicely. d) Need to figure out how to get tc201 compiler to Github Actions 3/ IA16-GCC a) not currently supported by build.bat so commented out --- .github/workflows/ci-build.yml | 5 +-- ci_build.sh | 78 +++++++++++++++++++++++++++++++--- ci_prereq.sh | 63 +++++++++++++++++++++++++++ 3 files changed, 137 insertions(+), 9 deletions(-) create mode 100755 ci_prereq.sh diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 37e16a5b..74348dda 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -23,10 +23,7 @@ jobs: submodules: recursive - name: Package install - run: | - sudo add-apt-repository ppa:tkchia/build-ia16 - sudo apt update - sudo apt install gcc-ia16-elf libi86-ia16-elf nasm upx qemu-system-x86 mtools util-linux bash + run: ./ci_prereq.sh - name: build run: ./ci_build.sh diff --git a/ci_build.sh b/ci_build.sh index 2ddc95f5..2edbf634 100755 --- a/ci_build.sh +++ b/ci_build.sh @@ -15,15 +15,20 @@ OWTAR=ow-snapshot.tar.xz # GCC mkdir _output/gcc -git clean -x -d -f -e test -e _output -e _watcom -e $OWTAR +git clean -x -d -f -e test -e _output -e _downloads -e _watcom -e $OWTAR make -C country clean make all COMPILER=gcc mv -n bin/KGC*.map bin/KGC*.sys _output/gcc/. mv -n bin/country.sys _output/gcc/. # GCC share -(cd share && make clobber && env COMPILER=gcc ./build.sh) -mv -n share/share.com _output/gcc/. -mv -n share/share.map _output/gcc/. +( + cd share + git submodule update --init --recursive + git clean -x -d -f + env COMPILER=gcc ./build.sh +) +mv -n share/src/share.com _output/gcc/. +mv -n share/src/share.map _output/gcc/. # Watcom if [ ! -d _watcom ] ; then @@ -37,10 +42,73 @@ export PATH=$BUILD_DIR/bin:$PATH:$BUILD_DIR/_watcom/binl64 export WATCOM=$BUILD_DIR/_watcom mkdir _output/wc -git clean -x -d -f -e test -e _output -e _watcom -e $OWTAR +git clean -x -d -f -e test -e _output -e _downloads -e _watcom -e $OWTAR make -C country clean make all COMPILER=owlinux mv -n bin/KWC*.map bin/KWC*.sys _output/wc/. mv -n bin/country.sys _output/wc/. +## DOS (GCC) +#mkdir _output/gcc_dos +#git clean -x -d -f -e test -e _output -e _downloads -e _watcom -e $OWTAR +#{ +# echo set COMPILER=GCC +# echo set MAKE=make +# echo set XCPU=386 +# echo set XFAT=32 +# echo set XNASM='C:\\devel\\nasm\\nasm' +# echo set OLDPATH=%PATH% +# echo set PATH='C:\\devel\\i16gnu\\bin;C:\\bin;%OLDPATH%' +#} | unix2dos > config.bat + +#dosemu -td -q -K . -E "build.bat" + +# DOS (Watcom) +mkdir _output/wc_dos +git clean -x -d -f -e test -e _output -e _downloads -e _watcom -e $OWTAR +{ + echo set COMPILER=WATCOM + echo set WATCOM='C:\\devel\\watcomc' + echo set MAKE=wmake /ms + echo set XCPU=386 + echo set XFAT=32 + echo set XNASM='C:\\devel\\nasm\\nasm' + echo set OLDPATH=%PATH% + echo set PATH='C:\\devel\\watcomc\\binw;C:\\bin;%OLDPATH%' +} | unix2dos > config.bat + +dosemu -td -q -K . -E "build.bat" +mv -n bin/KWC*.map bin/KWC*.sys _output/wc_dos/. +mv -n bin/country.sys _output/wc_dos/. + + +# DOS (Turbo C 2.01) +if [ -d ${HOME}/.dosemu/drive_c/tc201 ] ; then + mkdir _output/tc_dos + git clean -x -d -f -e test -e _output -e _downloads -e _watcom -e $OWTAR + { + echo set COMPILER=TC2 + echo set TC2_BASE='C:\\tc201' + echo set MAKE=make + echo set XCPU=386 + echo set XFAT=32 + echo set XNASM=nasm + echo set OLDPATH=%PATH% + echo set PATH='%TC2_BASE%;C:\\devel\\nasm;C:\\bin;%OLDPATH%' + } | unix2dos > config.bat + + dosemu -td -q -K . -E "build.bat lfn" + mv -n bin/KTC*.map bin/KTC*.sys _output/tc_dos/. + mv -n bin/country.sys _output/tc_dos/. + # TC share + ( + cd share + git submodule update --init --recursive + git clean -x -d -f + env COMPILER=tcc2-emu ./build.sh + ) + mv -n share/src/share.com _output/tc_dos/. + mv -n share/src/share.map _output/tc_dos/. +fi + echo done diff --git a/ci_prereq.sh b/ci_prereq.sh new file mode 100755 index 00000000..e5d2e80d --- /dev/null +++ b/ci_prereq.sh @@ -0,0 +1,63 @@ +#!/bin/sh + +set -e + +sudo add-apt-repository -y ppa:tkchia/build-ia16 +sudo add-apt-repository -y ppa:dosemu2/ppa +sudo apt update + +# for cross building +sudo apt install gcc-ia16-elf libi86-ia16-elf nasm upx qemu-system-x86 mtools util-linux bash + +# for building with DOS using an emulator +sudo apt install dosemu2 dos2unix +# Perhaps later we should build using Freecom from published package + +mkdir -p _downloads +cd _downloads + +HERE=$(pwd) + +#IBIBLIO_PATH='http://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/distributions/1.2/repos/devel' +IBIBLIO_PATH='https://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/repositories/1.3/devel' + +# get gnumake for DOS +[ -f djgpp_mk.zip ] || wget --no-verbose ${IBIBLIO_PATH}/djgpp_mk.zip + +# get nasm for DOS +[ -f nasm.zip ] || wget --no-verbose ${IBIBLIO_PATH}/nasm.zip + +# get upx for DOS +[ -f upx.zip ] || wget --no-verbose ${IBIBLIO_PATH}/upx.zip + +# grab ia16-gcc from ibiblio.org +#[ -f i16gcc.zip ] || wget --no-verbose ${IBIBLIO_PATH}/i16gcc.zip +#[ -f i16newli.zip ] || wget --no-verbose ${IBIBLIO_PATH}/i16newli.zip +#[ -f i16butil.zip ] || wget --no-verbose ${IBIBLIO_PATH}/i16butil.zip +#[ -f i16lbi86.zip ] || wget --no-verbose ${IBIBLIO_PATH}/i16lbi86.zip + +# get watcom for DOS +[ -f watcomc.zip ] || wget --no-verbose ${IBIBLIO_PATH}/watcomc.zip + +mkdir -p ${HOME}/.dosemu/drive_c +cd ${HOME}/.dosemu/drive_c && ( + + mkdir -p bin + unzip -L -q ${HERE}/djgpp_mk.zip + cp -p devel/djgpp/bin/make.exe bin/. + unzip -L -q ${HERE}/upx.zip + cp -p devel/upx/upx.exe bin/. + echo PATH to make and upx binaries is 'c:/bin' + + unzip -L -q ${HERE}/nasm.zip + echo PATH to nasm binary is 'c:/devel/nasm' + +# unzip -L -q ${HERE}/i16gcc.zip +# unzip -L -q ${HERE}/i16newli.zip +# unzip -L -q ${HERE}/i16butil.zip +# unzip -L -q ${HERE}/i16lbi86.zip +# echo PATH to ia16 binaries is 'c:/devel/i16gnu/bin' + + unzip -L -q ${HERE}/watcomc.zip + echo PATH to watcom binaries is 'c:/devel/watcomc/binw' +) From 3c97674cbf47dfa48b7d839e9a8276f452db839f Mon Sep 17 00:00:00 2001 From: Andrew Bird Date: Sun, 11 Feb 2024 21:50:48 +0000 Subject: [PATCH 3/7] Country: Update submodule --- country | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/country b/country index a170a550..13587a32 160000 --- a/country +++ b/country @@ -1 +1 @@ -Subproject commit a170a5508430cd861754b9064d7e1a081d8b3101 +Subproject commit 13587a32d6fda6cf1a1ce9bd9c3da7d3ae5a8dd5 From 6092afc74d08ebd797476c5c434c43712c0bf62d Mon Sep 17 00:00:00 2001 From: Andrew Bird Date: Sun, 11 Feb 2024 21:57:56 +0000 Subject: [PATCH 4/7] Build: Country submodule now has production target When country was converted to a submodule (by me) the production installation target was hacked onto the kernel subdirectory Makefile which wasn't ideal. Introduce a production target into the country Makefile that does the installation. Since we want the submodule to be buildable standalone, we can't include the variable definitions from the upper level, such as $(DIRSEP) and $(CP), so the caller has to pass those in at build time if using the production target. Tested on Linux (GCC + Watcom) and DOS (Watcom) --- build.bat | 7 +++++++ kernel/makefile | 8 +------- makefile | 7 +++++++ 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/build.bat b/build.bat index c0a627ac..f638dfcf 100644 --- a/build.bat +++ b/build.bat @@ -118,6 +118,13 @@ cd ..\kernel %MAKE% production if errorlevel 1 goto abort-cd +echo. +echo Process COUNTRY +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +echo. +cd ..\country +%MAKE% DIRSEP=\ CP=copy production +if errorlevel 1 goto abort-cd + echo. echo Process SETVER +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ echo. diff --git a/kernel/makefile b/kernel/makefile index 3018b414..4f5fe9ea 100644 --- a/kernel/makefile +++ b/kernel/makefile @@ -27,7 +27,7 @@ OBJS=$(OBJS1) $(OBJS2) $(OBJS3) $(OBJS4) $(OBJS5) $(OBJS6) $(OBJS7) $(OBJS8) # *Explicit Rules* -production: ../bin/$(TARGET).sys ../bin/country.sys +production: ../bin/$(TARGET).sys ../bin/$(TARGET).sys: kernel.sys $(CP) kernel.sys ..$(DIRSEP)bin @@ -42,12 +42,6 @@ kernel.sys: kernel.exe ../utils/exeflat.exe ../utils/upxentry.bin ../utils/upxde kernel.exe: $(TARGET).lnk $(OBJS) $(LIBS) $(LINK) @$(TARGET).lnk; -../bin/country.sys: - # warning, both cd and -C options required, cd for wmake, -C for gmake - cd ..$(DIRSEP)country - $(MAKE) -C ..$(DIRSEP)country all - $(CP) ..$(DIRSEP)country$(DIRSEP)country.sys ..$(DIRSEP)bin$(DIRSEP)country.sys - clobber: clean -$(RM) kernel.exe kernel.sys status.me diff --git a/makefile b/makefile index 0f1aeb0a..fd3e58bd 100644 --- a/makefile +++ b/makefile @@ -67,8 +67,12 @@ export ifeq ($(OS),Windows_NT) BUILDENV ?= windows +DIRSEP=\ +CP=copy else BUILDENV ?= linux +DIRSEP=/ +CP=cp endif ifeq ($(BUILDENV),windows) @@ -115,6 +119,7 @@ all: cd boot && $(MAKE) production cd sys && $(MAKE) production cd kernel && $(MAKE) production + cd country && $(MAKE) DIRSEP=$(DIRSEP) CP=$(CP) production cd setver && $(MAKE) production $(MAKEREMOVE) @@ -126,6 +131,7 @@ clean: cd boot && $(MAKE) clean cd sys && $(MAKE) clean cd kernel && $(MAKE) clean + cd country && $(MAKE) clean cd setver && $(MAKE) clean $(MAKEREMOVE) @@ -137,5 +143,6 @@ clobber: cd boot && $(MAKE) clobber cd sys && $(MAKE) clobber cd kernel && $(MAKE) clobber + cd country && $(MAKE) clobber cd setver && $(MAKE) clobber $(MAKEREMOVE) From 92f9a5125ebd84e2cf1020e7b8a43ff6ca5cae78 Mon Sep 17 00:00:00 2001 From: Andrew Bird Date: Sun, 11 Feb 2024 22:21:41 +0000 Subject: [PATCH 5/7] CI: Test DOS built kernels for existence and boot --- ci_test.sh | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/ci_test.sh b/ci_test.sh index 8e511a87..6f0b6391 100755 --- a/ci_test.sh +++ b/ci_test.sh @@ -12,7 +12,17 @@ if [ ! -f _output/wc/KWC${KVER}.sys ] ; then exit 1 fi -echo GCC and Watcom kernels have all been built +if [ ! -f _output/wc_dos/KWC38632.sys ] ; then + echo Watcom DOS built kernel not present + exit 1 +fi + +if [ ! -f _output/tc_dos/KTC38632.sys ] && [ -d ${HOME}/.dosemu/drive_c/tc201 ] ; then + echo Turbo C 2.01 built kernel not present + exit 1 +fi + +echo Kernels have all been built find _output -ls cd test @@ -26,5 +36,17 @@ then echo OpenWatcom boot test failed exit 2 fi +if ! ./test.sh ../_output/wc_dos/KWC38632.sys diskwcd bootwcd 'boot wcd: ' +then + echo 'OpenWatcom(DOS) boot test failed' + exit 2 +fi +if [ -d ${HOME}/.dosemu/drive_c/tc201 ] ; then + if ! ./test.sh ../_output/tc_dos/KTC38632.sys disktcd boottcd 'boot tcd: ' + then + echo 'Turbo C 2.01 boot test failed' + exit 2 + fi +fi cd .. exit 0 From 5b87617f661328c9ab668faec0654dc110f78603 Mon Sep 17 00:00:00 2001 From: Andrew Bird Date: Fri, 23 Feb 2024 15:17:03 +0000 Subject: [PATCH 6/7] CI: No need to rerun the workflow if PR is edited --- .github/workflows/ci-build.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 74348dda..ed4bc31a 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -3,7 +3,6 @@ on: pull_request: types: - opened - - edited - ready_for_review - reopened - synchronize From d8ecb409a9d299575bb620c9b4f42d77acc4994f Mon Sep 17 00:00:00 2001 From: Andrew Bird Date: Sat, 24 Feb 2024 16:47:58 +0000 Subject: [PATCH 7/7] CI: Use FreeDOS kernel and FreeCOM --- ci_prereq.sh | 39 +++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/ci_prereq.sh b/ci_prereq.sh index e5d2e80d..5d507206 100755 --- a/ci_prereq.sh +++ b/ci_prereq.sh @@ -18,31 +18,50 @@ cd _downloads HERE=$(pwd) -#IBIBLIO_PATH='http://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/distributions/1.2/repos/devel' -IBIBLIO_PATH='https://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/repositories/1.3/devel' +#IBIBLIO_PATH='http://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/distributions/1.2/repos' +IBIBLIO_PATH='https://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/repositories/1.3' + +BASE=${IBIBLIO_PATH}/base + +# get FreeDOS kernel +[ -f kernel.zip ] || wget --no-verbose ${BASE}/kernel.zip + +# get FreeCOM +[ -f freecom.zip ] || wget --no-verbose ${BASE}/freecom.zip + +DEVEL=${IBIBLIO_PATH}/devel # get gnumake for DOS -[ -f djgpp_mk.zip ] || wget --no-verbose ${IBIBLIO_PATH}/djgpp_mk.zip +[ -f djgpp_mk.zip ] || wget --no-verbose ${DEVEL}/djgpp_mk.zip # get nasm for DOS -[ -f nasm.zip ] || wget --no-verbose ${IBIBLIO_PATH}/nasm.zip +[ -f nasm.zip ] || wget --no-verbose ${DEVEL}/nasm.zip # get upx for DOS -[ -f upx.zip ] || wget --no-verbose ${IBIBLIO_PATH}/upx.zip +[ -f upx.zip ] || wget --no-verbose ${DEVEL}/upx.zip # grab ia16-gcc from ibiblio.org -#[ -f i16gcc.zip ] || wget --no-verbose ${IBIBLIO_PATH}/i16gcc.zip -#[ -f i16newli.zip ] || wget --no-verbose ${IBIBLIO_PATH}/i16newli.zip -#[ -f i16butil.zip ] || wget --no-verbose ${IBIBLIO_PATH}/i16butil.zip -#[ -f i16lbi86.zip ] || wget --no-verbose ${IBIBLIO_PATH}/i16lbi86.zip +#[ -f i16gcc.zip ] || wget --no-verbose ${DEVEL}/i16gcc.zip +#[ -f i16newli.zip ] || wget --no-verbose ${DEVEL}/i16newli.zip +#[ -f i16butil.zip ] || wget --no-verbose ${DEVEL}/i16butil.zip +#[ -f i16lbi86.zip ] || wget --no-verbose ${DEVEL}/i16lbi86.zip # get watcom for DOS -[ -f watcomc.zip ] || wget --no-verbose ${IBIBLIO_PATH}/watcomc.zip +[ -f watcomc.zip ] || wget --no-verbose ${DEVEL}/watcomc.zip mkdir -p ${HOME}/.dosemu/drive_c cd ${HOME}/.dosemu/drive_c && ( mkdir -p bin + + # Boot files + unzip -L -q ${HERE}/kernel.zip + cp -p bin/kernl386.sys ./kernel.sys + unzip -L -q ${HERE}/freecom.zip + cp -p bin/command.com ./command.com + cp -p /usr/share/dosemu/dosemu2-cmds-0.3/c/fdconfig.sys . + + # Development files unzip -L -q ${HERE}/djgpp_mk.zip cp -p devel/djgpp/bin/make.exe bin/. unzip -L -q ${HERE}/upx.zip