Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
echo $PATH

- name: build
run: ./build.sh auto allimages
run: ./build.sh auto ext allimages

- name: upload
uses: actions/upload-artifact@v4
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

ifndef TOPDIR
$(error TOPDIR is not defined; did you mean to run './build.sh' instead?)
$(error TOPDIR is not defined; run '. ./env.sh' then './build.sh' to build toolchain)
endif

include $(TOPDIR)/Make.defs
Expand Down
28 changes: 20 additions & 8 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
#!/usr/bin/env bash

# This build script is called in main.yml by GitHub Continuous Integration
# Full build (including the cross tool chain)

# Arguments:
# - 'auto' : continuous integration context
# ELKS System Builder
# This build script is also called in main.yml for GitHub Continuous Integration
#
# Usage: ./build.sh [auto [[ext] [[[allimages]]]]]
# <no args>: user build: build cross-compiler, menuconfig kernel and standard apps
# auto github CI build:: just IBM PC, 8018X, NECV25 kernel and standard apps
# ext also build external apps (requires OpenWatcom C installed)
# allimages also build all floppy and HD disk images
#
# After building the system once, the following can be used to rebuild the system:
# $ make clean
# $ make
# $ ./buildext.sh all # optionally build specified external apps (OpenWatcom reqd)
# $ ./qemu.sh
#
set -e

SCRIPTDIR="$(dirname "$0")"
Expand Down Expand Up @@ -63,12 +73,14 @@ if [ "$1" != "auto" ]; then
echo "Building all..."
make -j1 all || clean_exit 5

echo "Building external applications..."
./buildext.sh all || clean_exit 51
if [ "$2" = "ext" ]; then
echo "Building external applications..."
./buildext.sh all || clean_exit 51
fi

# Possibly build all images

if [ "$2" = "allimages" ]; then
if [ "$3" = "allimages" ]; then
echo "Building FD images..."
cd image
make -j1 images-minix images-fat || clean_exit 6
Expand Down
3 changes: 3 additions & 0 deletions elks/tools/mtools/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ all: mtools-4.0.23/Makefile

mtools-4.0.23/Makefile:
cd mtools-4.0.23; ./configure --disable-floppyd; cd ..
case `uname -s` in Darwin) \
sed -i.bak 's/^#define HAVE_STAT64 1//' mtools-4.0.23/config.h && \
rm -f mtools-4.0.23/config.h.bak ;; esac

clean:
make -C mtools-4.0.23 clean
2 changes: 1 addition & 1 deletion qemu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ ACCEL_V9="-accel tcg,one-insn-per-tb=on"
ACCEL_HVF="-accel hvf"

ACCEL=$ACCEL_SSTP
if [[ `$QEMU -version` =~ "version 9" ]]; then
if [[ `$QEMU -version` =~ "version 9" || `$QEMU -version` =~ "version 10" ]]; then
ACCEL=$ACCEL_V9
fi
if [[ $QEMU =~ "x86_64" && $UNAME =~ "Darwin" && $UNAME =~ "x86_64" ]]; then
Expand Down
33 changes: 29 additions & 4 deletions tools/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ BUILDDIR=$(CROSSDIR)/build

# BINUTILS for IA16

BINUTILS_VER=cc5f1a9d7437051c3aae6ec16fca27c3b2d31f6c
BINUTILS_VER=69e12ea2c125ff830580abbe4699d35ba002148b
BINUTILS_DIST=binutils-ia16-$(BINUTILS_VER)

$(DISTDIR)/$(BINUTILS_DIST).tar.gz:
Expand All @@ -45,6 +45,13 @@ $(BUILDDIR)/.binutils.src: $(DISTDIR)/$(BINUTILS_DIST).tar.gz
cd $(BUILDDIR) && tar -xzf $(DISTDIR)/$(BINUTILS_DIST).tar.gz
rm -rf $(BUILDDIR)/binutils-src
cd $(BUILDDIR) && mv $(BINUTILS_DIST) binutils-src
case `uname -s` in Darwin) \
cd $(BUILDDIR)/binutils-src/zlib && \
sed -i.bak 's/defined(MACOS) || defined(TARGET_OS_MAC)/defined(MACOS)/' zutil.h && \
rm -f zutil.h.bak ;; esac
cd $(BUILDDIR)/binutils-src/bfd && \
sed -i.bak 's/development=.*/development=false/' development.sh && \
rm -f development.sh.bak
touch $(BUILDDIR)/.binutils.src

$(BUILDDIR)/.binutils.build: $(BUILDDIR)/.binutils.src
Expand Down Expand Up @@ -99,7 +106,7 @@ $(DISTDIR)/$(MPC_DIST).tar.gz:

# GCC for IA16

GCC_VER=43408af9d4127b884ab39dcff6a829e86008e587
GCC_VER=ca893320926dc93552390b892a202e9373d040c0
GCC_DIST=gcc-ia16-$(GCC_VER)

$(DISTDIR)/$(GCC_DIST).tar.gz:
Expand Down Expand Up @@ -130,12 +137,30 @@ $(BUILDDIR)/.gcc.src: $(DISTDIR)/$(GCC_DIST).tar.gz \
cd $(BUILDDIR)/gcc-src && ln -s $(MPFR_DIST) mpfr
cd $(BUILDDIR)/gcc-src && tar -xzf $(DISTDIR)/$(MPC_DIST).tar.gz
cd $(BUILDDIR)/gcc-src && ln -s $(MPC_DIST) mpc
case `uname -s` in Darwin) \
cd $(BUILDDIR)/gcc-src/zlib && \
sed -i.bak 's/defined(MACOS) || defined(TARGET_OS_MAC)/defined(MACOS)/' zutil.h && \
rm -f zutil.h.bak ;; esac
cd $(BUILDDIR)/gcc-src/gcc && \
sed -i.bak 's/heapb->min->compare (heapa->min)/heapb->m_min->compare (heapa->m_min)/' fibonacci_heap.h && \
rm -f fibonacci_heap.h.bak
case `uname -s`-`uname -m` in Darwin-arm64) \
cd $(BUILDDIR)/gcc-src/gcc/config && \
sed -i.bak 's/aligned (4096)/aligned (16384)/' host-darwin.c && \
rm -f host-darwin.c.bak && \
cd $(BUILDDIR)/gcc-src/gcc && \
awk '/i\[34567\]86-\*-darwin\* \| x86_64-\*-darwin\*\)/{print " aarch64-*-darwin* | arm-*-darwin*)"; print " out_host_hook_obj=\"$${out_host_hook_obj} host-aarch64-darwin.o\""; print " host_xmake_file=\"$${host_xmake_file} aarch64/x-darwin\""; print " ;;"} {print}' config.host > config.host.tmp && \
mv config.host.tmp config.host && \
printf 'host-aarch64-darwin.o : $$(srcdir)/config/aarch64/host-aarch64-darwin.c\n\t$$(COMPILE) $$<\n\t$$(POSTCOMPILE)\n' \
> $(BUILDDIR)/gcc-src/gcc/config/aarch64/x-darwin && \
printf '/* aarch64-darwin host-specific hook definitions. */\n#include "config.h"\n#include "system.h"\n#include "coretypes.h"\n#include "hosthooks.h"\n#include "hosthooks-def.h"\n#include "config/host-darwin.h"\nconst struct host_hooks host_hooks = HOST_HOOKS_INITIALIZER;\n' \
> $(BUILDDIR)/gcc-src/gcc/config/aarch64/host-aarch64-darwin.c ;; esac
touch $(BUILDDIR)/.gcc.src

$(BUILDDIR)/.gcc.build: $(BUILDDIR)/.gcc.src $(BUILDDIR)/.binutils.build
cd $(BUILDDIR) && rm -rf gcc-build
mkdir $(BUILDDIR)/gcc-build
cd $(BUILDDIR)/gcc-build && ../gcc-src/configure --target=ia16-elf --prefix="$(CROSSDIR)" --without-headers --enable-languages=c --disable-libssp --without-isl
cd $(BUILDDIR)/gcc-build && LC_ALL=C ../gcc-src/configure --target=ia16-elf --prefix="$(CROSSDIR)" --without-headers --enable-languages=c --disable-libssp --without-isl --disable-nls
# If there are any obsolete multilib directories (which are no longer
# used) in the installation directory, remove them, so that they do
# not clutter up the installation directory. This is a bit of a hack.
Expand All @@ -145,7 +170,7 @@ $(BUILDDIR)/.gcc.build: $(BUILDDIR)/.gcc.src $(BUILDDIR)/.binutils.build
$(CROSSDIR)/lib/gcc/ia16-elf/6.3.0/regparmcall/size \
$(CROSSDIR)/lib/gcc/ia16-elf/6.3.0/regparmcall/any_186/size
# Now build.
$(MAKE) -C $(BUILDDIR)/gcc-build $(PARALLEL)
LC_ALL=C $(MAKE) -C $(BUILDDIR)/gcc-build $(PARALLEL)
touch $(BUILDDIR)/.gcc.build

$(CROSSDIR)/.gcc.install: $(BUILDDIR)/.gcc.build
Expand Down