summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbootstrap70
-rwxr-xr-xsetup-packages2
-rwxr-xr-xsetup-preimage6
3 files changed, 61 insertions, 17 deletions
diff --git a/bootstrap b/bootstrap
index 009e2f9..20d095e 100755
--- a/bootstrap
+++ b/bootstrap
@@ -5,7 +5,7 @@
# Purpose : Bootstraps Adélie from source for any architecture.
# Authors : Zach van Rijn <me@zv.io>
# License : MIT
-# Revision : 20230919
+# Revision : 20240111
#===============================================================
#===============================================================
@@ -324,18 +324,36 @@ EOF
#
# ARCH is translated to canonical GCC and QEMU machine types.
#
+# GCC configure flags are also specified here.
+#
case "${1}" in
# adelie gcc qemu
# ------ --- ----
- aarch64) m=aarch64: ; q=aarch64 ; ;;
- armv7) m=armv7l:eabihf ; q=arm ; ;;
- ppc) m=powerpc: ; q=ppc ; ;;
- ppc64) m=powerpc64: ; q=ppc64 ; ;;
- riscv64) m=riscv64: ; q=riscv64 ; ;;
- x86_64) m=x86_64: ; q=x86_64 ; ;;
- pmmx) m=i586: ; q=i386 ; ;;
-
- s390x) m=s390x: ; q=s390x ; ;;
+ aarch64) m=aarch64: ; q=aarch64 ;
+ g="--with-arch=armv8-a --with-abi=lp64 --enable-fix-cortex-a53-835769 --enable-fix-cortex-a53-843419";
+ ;;
+ armv7) m=armv7l:eabihf ; q=arm ;
+ g="--with-arch=armv7-a --with-tune=generic-armv7-a --with-fpu=vfpv3-d16 --with-float=hard --with-abi=aapcs-linux --with-mode=thumb";
+ ;;
+ ppc) m=powerpc: ; q=ppc ;
+ g="--enable-secureplt --enable-decimal-float=no";
+ ;;
+ ppc64) m=powerpc64: ; q=ppc64 ;
+ g="--with-abi=elfv2 --enable-secureplt --enable-decimal-float=no";
+ ;;
+ x86_64) m=x86_64: ; q=x86_64 ;
+ g=""; # (none needed)
+ ;;
+ pmmx) m=i586: ; q=i386 ;
+ g="--with-arch=i586 --with-tune=pentium2 --enable-cld --enable-mmx";
+ ;;
+
+ riscv64) m=riscv64: ; q=riscv64 ;
+ g="--with-arch=rv64gc --with-abi=lp64d --enable-autolink-libatomic";
+ ;;
+ s390x) m=s390x: ; q=s390x ;
+ g="--with-arch=z196 --with-tune=zEC12 --with-zarch --with-long-double-128 --enable-decimal-float";
+ ;;
*) usage ;;
esac
@@ -416,7 +434,8 @@ if ! test -d "${MTOOLS}"/sys/emus/bin; then # FIXME: no hard code
# self-reliant, except for some build deps for QEMU.
#
# We copy 'config.mak' from mcmtools bootstrap to the rootfs
- # so that when we build "real" toolchain they are the same.
+ # so that when we build "real" toolchain they are the same,
+ # except for target-specific GCC configure options above.
#
DEST="${MTOOLS}" \
ARCH=${BUILDS} \
@@ -426,6 +445,12 @@ if ! test -d "${MTOOLS}"/sys/emus/bin; then # FIXME: no hard code
cp "${MTOOLS}"/tmp/musl-cross-make/config.mak \
"${MTOOLS}"/config.mak \
;
+ sent=HAVE_GCC_CONFIG; # sentinel
+ grep ${sent} "${MTOOLS}"/config.mak >/dev/null || \
+ cat >> "${MTOOLS}"/config.mak <<EOF
+GCC_CONFIG += ${g}
+# ${sent}
+EOF
# cleaning
(
cd "${MTOOLS}";
@@ -693,15 +718,29 @@ if ! test -f rootfs-${TARGET}-patched.tgz; then
;
##
- # Replace with explicit '/' ('/foo/bar/baz' --> '/' instead
- # of the empty string) to avoid gotchas. Assumes '//' is the
- # same as '/'. I can't think of a counterexample.
+ # Replace needle with the empty string.
#
x="${BASE}"/mcmtools-${TARGET}/sys;
grep -rl "${x}" ${t} | while read k; do
- ./binsub ${k} "${x}" "/";
+ # exceptions
+
+ case "${k}" in
+ "${t}"/bin/perl) continue; ;; # @INC fuckery
+ esac
+
+ # delete needle
+ ./binsub ${k} "${x}"; # alternatively use "/"
+
done
+ ##
+ # Create a compatibility symlink so that any tools excepted
+ # above can still find the file(s) they need.
+ #
+ mkdir -p "${t}/${x%/*}";
+ ln -s / "${t}/${x}"; # compat symlink for exceptions
+
+
tar -C "${t}" \
-pczf rootfs-${TARGET}-patched.tgz \
. \
@@ -764,7 +803,6 @@ if ! test -f rootfs-${TARGET}-packages.tgz; then # FIXME: no hard code
PROOT_NO_SECCOMP=1 \
PATH="${DEF_PATH}" \
SHELL=/bin/sh \
-TARGET_ARCH=${TARGET} \
CURL_CA_BUNDLE=/cacert.pem \
${MTOOLS}/sys/emus/bin/proot \
-R "${BASE}"/rootfs-${TARGET}-packages \
diff --git a/setup-packages b/setup-packages
index ea449dc..4206b58 100755
--- a/setup-packages
+++ b/setup-packages
@@ -6,7 +6,7 @@ pwd;
git clone https://git.adelielinux.org/adelie/packages.git;
cd packages;
-git checkout 198e0130d845f7466c09a61f3829905d95313c06;
+git checkout current;
# FIXME: this script needs a lot of work
#./scripts/bootstrap.sh ${TARGET_ARCH};
diff --git a/setup-preimage b/setup-preimage
index 7892a0d..7099227 100755
--- a/setup-preimage
+++ b/setup-preimage
@@ -33,3 +33,9 @@ EOF
# maybe not necessary?
chown -R 1000:300 root etc;
+
+# FIXME: see setup-abuild script
+mkdir -p sbin;
+ln -s /usr/local/bin/apk sbin/apk;
+
+# FIXME: add /etc/resolv.conf? let user do it?