mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-22 06:01:41 +02:00
common.sh: add arm64 chroot utility functions
By copying and removing the relevant qemu static executable the functions enable and disable the chroot environment for arm64 rootfs. Signed-off-by: Andrej Rosano <andrej@inversepath.com>
This commit is contained in:
parent
8f41f9e87d
commit
21925e99d4
33
common.sh
33
common.sh
@ -992,3 +992,36 @@ BOAT
|
|||||||
echo -e "${V_VIDOFF}"
|
echo -e "${V_VIDOFF}"
|
||||||
die "$* failed"
|
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
|
||||||
|
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
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user