Merge pull request #134 from kinvolk/jepio/arm64-sdk-support

bootstrap_sdk: enable arm64 sdk bootstrap
This commit is contained in:
Jeremi Piotrowski 2021-08-03 12:18:01 +02:00 committed by GitHub
commit a8a57c733b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 5 deletions

View File

@ -92,7 +92,11 @@ if [[ "$STAGES" =~ stage4 ]]; then
libdir=$(get_sdk_libdir) libdir=$(get_sdk_libdir)
mkdir -p "${ROOT_OVERLAY}/usr/${libdir}" mkdir -p "${ROOT_OVERLAY}/usr/${libdir}"
if [[ "${libdir}" != lib ]]; then if [[ "${libdir}" != lib ]]; then
if [[ "$(get_sdk_symlink_lib)" == "yes" ]]; then
ln -s "${libdir}" "${ROOT_OVERLAY}/usr/lib" ln -s "${libdir}" "${ROOT_OVERLAY}/usr/lib"
else
mkdir -p "${ROOT_OVERLAY}/usr/lib"
fi
fi fi
"${BUILD_LIBRARY_DIR}/set_lsb_release" \ "${BUILD_LIBRARY_DIR}/set_lsb_release" \
--root "${ROOT_OVERLAY}" --root "${ROOT_OVERLAY}"

View File

@ -167,6 +167,10 @@ get_sdk_libdir() {
portageq envvar "LIBDIR_$(get_sdk_arch)" portageq envvar "LIBDIR_$(get_sdk_arch)"
} }
get_sdk_symlink_lib() {
portageq envvar "SYMLINK_LIB"
}
# Usage: get_sdk_binhost [version...] # Usage: get_sdk_binhost [version...]
# If no versions are specified the current and SDK versions are used. # If no versions are specified the current and SDK versions are used.
get_sdk_binhost() { get_sdk_binhost() {
@ -289,6 +293,7 @@ install_cross_toolchain() {
local cross_flags=( --gdb '[stable]' --ex-gdb --stable --target "${cross_chost}" ) local cross_flags=( --gdb '[stable]' --ex-gdb --stable --target "${cross_chost}" )
local cross_cfg="/usr/${cross_chost}/etc/portage/${cross_chost}-crossdev" local cross_cfg="/usr/${cross_chost}/etc/portage/${cross_chost}-crossdev"
local cross_cfg_data=$(_crossdev_info "${cross_flags[@]}") local cross_cfg_data=$(_crossdev_info "${cross_flags[@]}")
local cbuild="$(portageq envvar CBUILD)"
local emerge_flags=( "$@" --binpkg-respect-use=y --update --newuse ) local emerge_flags=( "$@" --binpkg-respect-use=y --update --newuse )
# Forcing binary packages for toolchain packages breaks crossdev since it # Forcing binary packages for toolchain packages breaks crossdev since it
@ -332,8 +337,8 @@ install_cross_toolchain() {
echo "Installing existing binaries" echo "Installing existing binaries"
$sudo emerge "${emerge_flags[@]}" \ $sudo emerge "${emerge_flags[@]}" \
"cross-${cross_chost}/gdb" "${cross_pkgs[@]}" "cross-${cross_chost}/gdb" "${cross_pkgs[@]}"
if [ "${cross_chost}" = aarch64-cros-linux-gnu ] && \ if [ "${cbuild}" = "x86_64-pc-linux-gnu" ] && [ "${cross_chost}" = aarch64-cros-linux-gnu ] && \
[ ! -d /usr/lib64/rust-*/rustlib/aarch64-unknown-linux-gnu ] && [ ! -d /usr/lib64/rustlib/aarch64-unknown-linux-gnu ]; then [ ! -d /usr/lib/rust-*/rustlib/aarch64-unknown-linux-gnu ] && [ ! -d /usr/lib/rustlib/aarch64-unknown-linux-gnu ]; then
# If no aarch64 folder exists, warn about the situation but don't compile Rust here or download it as binary package # If no aarch64 folder exists, warn about the situation but don't compile Rust here or download it as binary package
echo "WARNING: No aarch64 cross-compilation Rust libraries found!" echo "WARNING: No aarch64 cross-compilation Rust libraries found!"
echo "In case building fails, make sure the old Rust version is deleted with: sudo emerge -C virtual/rust dev-lang/rust" echo "In case building fails, make sure the old Rust version is deleted with: sudo emerge -C virtual/rust dev-lang/rust"
@ -395,6 +400,7 @@ install_cross_libs() {
install_cross_rust() { install_cross_rust() {
local cross_chost="$1"; shift local cross_chost="$1"; shift
local emerge_flags=( "$@" --binpkg-respect-use=y --update ) local emerge_flags=( "$@" --binpkg-respect-use=y --update )
local cbuild="$(portageq envvar CBUILD)"
# may be called from either catalyst (root) or upgrade_chroot (user) # may be called from either catalyst (root) or upgrade_chroot (user)
local sudo="env" local sudo="env"
@ -402,10 +408,10 @@ install_cross_rust() {
sudo="sudo -E" sudo="sudo -E"
fi fi
if [ "${cross_chost}" = "aarch64-cros-linux-gnu" ]; then if [ "${cbuild}" = "x86_64-pc-linux-gnu" ] && [ "${cross_chost}" = "aarch64-cros-linux-gnu" ]; then
echo "Building Rust for arm64" echo "Building Rust for arm64"
# If no aarch64 folder exists, try to remove any existing Rust packages. # If no aarch64 folder exists, try to remove any existing Rust packages.
[ ! -d /usr/lib/rust-*/rustlib/aarch64-unknown-linux-gnu ] && ($sudo emerge -C dev-lang/rust || true) [ ! -d /usr/lib/rustlib/aarch64-unknown-linux-gnu ] && ($sudo emerge -C dev-lang/rust || true)
$sudo emerge "${emerge_flags[@]}" dev-lang/rust $sudo emerge "${emerge_flags[@]}" dev-lang/rust
fi fi
} }