mirror of
https://github.com/flatcar/scripts.git
synced 2026-05-04 11:51:14 +02:00
TMP #2
This commit is contained in:
parent
2abda355a2
commit
e4c2b8a014
38
common.sh
38
common.sh
@ -51,6 +51,9 @@ fi
|
||||
# Turn on bash debug support if available for backtraces.
|
||||
shopt -s extdebug 2>/dev/null
|
||||
|
||||
# Source qemu library path
|
||||
. /etc/profile.d/qemu-aarch64.sh 2> /dev/null || true
|
||||
|
||||
# Output a backtrace all the way back to the raw invocation, suppressing
|
||||
# only the _dump_trace frame itself.
|
||||
_dump_trace() {
|
||||
@ -989,3 +992,38 @@ BOAT
|
||||
echo -e "${V_VIDOFF}"
|
||||
die "$* failed"
|
||||
}
|
||||
|
||||
# The binfmt_misc support in the kernel is required.
|
||||
# The aarch64 binaries should be executed through
|
||||
# "/usr/bin/qemu-aarch64-static"
|
||||
setup_qemu_static() {
|
||||
local root_fs_dir="$1"
|
||||
case "${BOARD}" in
|
||||
amd64-usr) return 0;;
|
||||
arm64-usr)
|
||||
if [[ -f "${root_fs_dir}/sbin/ldconfig" ]]; then
|
||||
sudo cp /usr/bin/qemu-aarch64 "${root_fs_dir}"/usr/bin/qemu-aarch64-static
|
||||
echo export QEMU_LD_PREFIX=\"/build/arm64-usr/\" | sudo tee /etc/profile.d/qemu-aarch64.sh
|
||||
. /etc/profile.d/qemu-aarch64.sh
|
||||
else
|
||||
die "Missing basic layout in target rootfs"
|
||||
fi
|
||||
;;
|
||||
*) die "Unsupported arch" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
clean_qemu_static() {
|
||||
local root_fs_dir="$1"
|
||||
case "${BOARD}" in
|
||||
amd64-usr) return 0;;
|
||||
arm64-usr)
|
||||
if [[ -f "${root_fs_dir}/usr/bin/qemu-aarch64-static" ]]; then
|
||||
sudo rm "${root_fs_dir}"/usr/bin/qemu-aarch64-static
|
||||
else
|
||||
die "File not found"
|
||||
fi
|
||||
;;
|
||||
*) die "Unsupported arch" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
@ -367,6 +367,12 @@ if [[ ${FLAGS_regen_configs} -eq ${FLAGS_FALSE} ]]; then
|
||||
"${EMERGE_TOOLCHAIN_FLAGS[@]}" "${TOOLCHAIN_PKGS[@]}"
|
||||
fi
|
||||
|
||||
if [[ ${FLAGS_regen_configs_only} -eq ${FLAGS_FALSE} ]]; then
|
||||
:
|
||||
fi
|
||||
# Setup BOARD_ROOT for QEMU user emulation.
|
||||
setup_qemu_static "${BOARD_ROOT}"
|
||||
|
||||
if [ $FLAGS_default -eq $FLAGS_TRUE ] ; then
|
||||
echo $BOARD_VARIANT > "$GCLIENT_ROOT/src/scripts/.default_board"
|
||||
fi
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user