diff options
Diffstat (limited to 'bootstrap')
-rwxr-xr-x | bootstrap | 46 |
1 files changed, 33 insertions, 13 deletions
@@ -5,7 +5,7 @@ # Purpose : Bootstraps Adélie from source for any architecture. # Authors : Zach van Rijn <me@zv.io> # License : MIT -# Revision : 20221225 +# Revision : 20230919 #=============================================================== #=============================================================== @@ -37,7 +37,7 @@ # # * One-click bootstrap. Just start the script and walk away. # -# $ ./bootstrap.sh ppc64 /path/to/new/scratch/dir +# $ ./bootstrap ppc64 /path/to/new/scratch/dir # # * Can be done without root privileges: no 'chroot(8)'. # @@ -334,6 +334,9 @@ case "${1}" in riscv64) m=riscv64: ; q=riscv64 ; ;; x86_64) m=x86_64: ; q=x86_64 ; ;; pmmx) m=i586: ; q=i386 ; ;; + + s390x) m=s390x: ; q=s390x ; ;; + *) usage ;; esac shift; @@ -405,7 +408,7 @@ if ! test -d "${MTOOLS}"/sys/emus/bin; then # FIXME: no hard code test -d bootstrap \ || git clone ${CHAINS}/bootstrap.git; cd bootstrap; - git checkout 6834829d499e823e776368ce02691be2caac1727; + git checkout f7a470d4a6a56991af44d64419d59d6b58130429; ## seed rootfs # @@ -485,8 +488,21 @@ if ! test -d "${MTOOLS}"/sys/tc/native; then # FIXME: no hard code ## # Ensure consistent 'config.mak' for all toolchain builds. + # Everything remains the same except for build/host/target. # cp "${MTOOLS}"/config.mak config.mak; + sed -i \ + -E 's/(--(build|host|target)=)[-_[:alnum:]]+(\s|$)/\1 /g' \ + config.mak \ + ; + sed -i \ + -E 's/(--(build|host|target)=)/\1__TARGET__/g' \ + config.mak \ + ; + sed -i \ + -e "s/__TARGET__/${TARGET}/g" \ + config.mak \ + ; ## musl toolchains # @@ -659,13 +675,14 @@ fi ## # Some paths are hard-coded into various binaries. Since we need -# to "relocate" everything to run at '/', we can decompress the -# '.tar' file and perform the appropriate substititons at once. +# to "relocate" everything to run at '/' but patching the '.tar' +# file at once is apparently not valid, we must patch each file +# individually and compress the output to a usable rootfs image. # cd "${BASE}"; if ! test -f rootfs-${TARGET}-patched.tgz; then - rm -f rootfs-${TARGET}.tar; - gzip -dk rootfs-${TARGET}.tgz; + t=$(mktemp -d); + tar -C "${t}" -xf rootfs-${TARGET}.tgz; ## # Build 'binsub', a string patch tool. @@ -680,13 +697,16 @@ if ! test -f rootfs-${TARGET}-patched.tgz; then # of the empty string) to avoid gotchas. Assumes '//' is the # same as '/'. I can't think of a counterexample. # - ./binsub rootfs-${TARGET}.tar \ - "${BASE}"/mcmtools-${TARGET}/sys \ - / \ - ; + x="${BASE}"/mcmtools-${TARGET}/sys; + grep -rl "${x}" ${t} | while read k; do + ./binsub ${k} "${x}" "/"; + done - gzip -c9 rootfs-${TARGET}.tar > rootfs-${TARGET}-patched.tgz; - rm -f rootfs-${TARGET}.tar; + tar -C "${t}" \ + -pczf rootfs-${TARGET}-patched.tgz \ + . \ + ; + rm -fr "${t}"; fi |