Skip to content

Instantly share code, notes, and snippets.

@iav
Created December 5, 2020 04:05
Show Gist options
  • Save iav/53cbc0b8605084765a4005f16a2e7898 to your computer and use it in GitHub Desktop.
Save iav/53cbc0b8605084765a4005f16a2e7898 to your computer and use it in GitHub Desktop.
x64chroot
diff --git a/lib/compilation.sh b/lib/compilation.sh
index 5faca0be..ba3a019f 100644
--- a/lib/compilation.sh
+++ b/lib/compilation.sh
@@ -622,6 +622,35 @@ install_rkbin_tools()
install -m 755 tools/trust_merger /usr/local/bin/
improved_git rev-parse @ 2>/dev/null > .commit_id
fi
+
+ X64CHROOT="${SRC}"/cache/x64chroot
+ if [[ $(dpkg --print-architecture) == arm64 && ! -f /tmp/.x64chroot_created ]]; then
+ X64CHROOT=$(mktemp -d "${SRC}"/cache/x64chroot.XXXXXX)
+
+
+ display_alert "Installing x64 system" "Stage 1/2" "info"
+ eval 'debootstrap --variant=minbase \
+ --arch=amd64 --foreign stretch $X64CHROOT/ ' \
+ ${PROGRESS_LOG_TO_FILE:+' | tee -a $DEST/debug/debootstrap_x64.log'} \
+ ${OUTPUT_DIALOG:+' | dialog --backtitle "$backtitle" --progressbox "Debootstrap x64 (stage 1/2)..." $TTY_Y $TTY_X'} \
+ ${OUTPUT_VERYSILENT:+' >/dev/null 2>/dev/null'}
+
+ [[ ${PIPESTATUS[0]} -ne 0 || ! -f $X64CHROOT/debootstrap/debootstrap ]] && exit_with_error "Debootstrap x64 system first stage failed"
+
+ cp /usr/bin/$QEMU_BINARY $X64CHROOT/usr/bin/
+
+ display_alert "Installing x64 system" "Stage 2/2" "info"
+ eval 'chroot $X64CHROOT /bin/bash -c "/debootstrap/debootstrap --second-stage"' \
+ ${PROGRESS_LOG_TO_FILE:+' | tee -a $DEST/debug/debootstrap_x64.log'} \
+ ${OUTPUT_DIALOG:+' | dialog --backtitle "$backtitle" --progressbox "Debootstrap x64 (stage 2/2)..." $TTY_Y $TTY_X'} \
+ ${OUTPUT_VERYSILENT:+' >/dev/null 2>/dev/null'}
+
+ [[ ${PIPESTATUS[0]} -ne 0 || ! -f $X64CHROOT/bin/bash ]] && exit_with_error "Debootstrap x64 system second stage failed"
+ #eval 'LC_ALL=C LANG=C chroot $X64CHROOT /bin/bash -c "dpkg add -y "'
+ install -m 755 tools/loaderimage $X64CHROOT/usr/local/bin/
+ install -m 755 tools/trust_merger $X64CHROOT/usr/local/bin/
+ touch /tmp/.x64chroot_created
+ fi
}
grab_version()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment