Cross-build: arm64 support
Work together with Emanuele Rocca during MiniDebCamp Hamburg 2024 * rebuild: New command line option: --architecture * installer: Enable the GTK installer * bootloader: Set a default bootloader * no qemu-binary in chroot
This commit is contained in:
parent
4a35ad2954
commit
2f1acabc41
|
@ -314,6 +314,11 @@ Prepare_config ()
|
|||
LB_BOOTLOADER_EFI="${LB_BOOTLOADER_EFI:-grub-efi}"
|
||||
fi
|
||||
;;
|
||||
arm64)
|
||||
if ! In_list "${LB_IMAGE_TYPE}" hdd netboot; then
|
||||
LB_BOOTLOADER_EFI="${LB_BOOTLOADER_EFI:-grub-efi}"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
# Command line option combines BIOS and EFI selection in one.
|
||||
# Also, need to support old config files that held `LB_BOOTLOADERS`.
|
||||
|
@ -485,7 +490,7 @@ Prepare_config ()
|
|||
if [ -n "${LB_BOOTSTRAP_QEMU_ARCHITECTURES}" ]; then
|
||||
LB_BOOTSTRAP_QEMU_ARCHITECTURE="${LB_BOOTSTRAP_QEMU_ARCHITECTURES}"
|
||||
unset LB_BOOTSTRAP_QEMU_ARCHITECTURES
|
||||
Echo_warning "LB_BOOTSTRAP_QEMU_ARCHITECTURES was renamed to LB_BOOTSTRAP_QEMU_ARCHITECTURE, please updated your config."
|
||||
Echo_warning "LB_BOOTSTRAP_QEMU_ARCHITECTURES was renamed to LB_BOOTSTRAP_QEMU_ARCHITECTURE, please update your config."
|
||||
fi
|
||||
LB_BOOTSTRAP_QEMU_ARCHITECTURE="${LB_BOOTSTRAP_QEMU_ARCHITECTURE:-}"
|
||||
LB_BOOTSTRAP_QEMU_EXCLUDE="${LB_BOOTSTRAP_QEMU_EXCLUDE:-}"
|
||||
|
@ -749,6 +754,22 @@ Validate_config_permitted_values ()
|
|||
Echo_error "You have specified an invalid value for LB_UEFI_SECURE_BOOT (--uefi-secure-boot)."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -n "${LB_BOOTSTRAP_QEMU_ARCHITECTURE}" ]; then
|
||||
if [ -z "${LB_BOOTSTRAP_QEMU_STATIC}" ]; then
|
||||
Echo_error "You have not specified the qemu-static binary for ${LB_BOOTSTRAP_QEMU_ARCHITECTURE} (--bootstrap-qemu-static)"
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -e "${LB_BOOTSTRAP_QEMU_STATIC}" ]; then
|
||||
Echo_error "The qemu-static binary (${LB_BOOTSTRAP_QEMU_STATIC}) for ${LB_BOOTSTRAP_QEMU_ARCHITECTURE} was not found on the host"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -x "${LB_BOOTSTRAP_QEMU_STATIC}" ]; then
|
||||
Echo_error "The qemu-static binary (${LB_BOOTSTRAP_QEMU_STATIC}) for ${LB_BOOTSTRAP_QEMU_ARCHITECTURE} is not executable on the host"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Check option combinations and other extra stuff
|
||||
|
|
|
@ -100,7 +100,7 @@ Print_breakage
|
|||
Echo_message "Running debootstrap..."
|
||||
|
||||
# Run appropriate bootstrap, i.e. foreign or regular bootstrap
|
||||
if [ "${LB_BOOTSTRAP_QEMU_ARCHITECTURE}" = "${LB_ARCHITECTURE}" ]; then
|
||||
if [ -n "${LB_BOOTSTRAP_QEMU_ARCHITECTURE}" ]; then
|
||||
|
||||
if [ -n "${LB_BOOTSTRAP_QEMU_EXCLUDE}" ]
|
||||
then
|
||||
|
@ -111,7 +111,6 @@ if [ "${LB_BOOTSTRAP_QEMU_ARCHITECTURE}" = "${LB_ARCHITECTURE}" ]; then
|
|||
debootstrap ${DEBOOTSTRAP_OPTIONS} --foreign "${LB_PARENT_DISTRIBUTION_CHROOT}" chroot "${LB_PARENT_MIRROR_BOOTSTRAP}" ${DEBOOTSTRAP_SCRIPT}
|
||||
|
||||
Echo_message "Running debootstrap second stage under QEMU"
|
||||
cp ${LB_BOOTSTRAP_QEMU_STATIC} chroot/usr/bin
|
||||
Chroot chroot /bin/sh /debootstrap/debootstrap --second-stage ${FOREIGN_DEBOOTSTRAP_OPTIONS}
|
||||
else
|
||||
debootstrap ${DEBOOTSTRAP_OPTIONS} "${LB_PARENT_DISTRIBUTION_CHROOT}" chroot "${LB_PARENT_MIRROR_BOOTSTRAP}" ${DEBOOTSTRAP_SCRIPT}
|
||||
|
|
|
@ -353,7 +353,7 @@ DOWNLOAD_GTK_INSTALLER=false
|
|||
if [ "${LB_DEBIAN_INSTALLER_GUI}" = "true" ]
|
||||
then
|
||||
case "${LB_ARCHITECTURE}" in
|
||||
amd64|i386)
|
||||
amd64|i386|arm64)
|
||||
DOWNLOAD_GTK_INSTALLER=true
|
||||
;;
|
||||
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
# Rebuild an ISO image for a given timestamp
|
||||
#
|
||||
# Copyright 2021-2022 Holger Levsen <holger@layer-acht.org>
|
||||
# Copyright 2021-2023 Roland Clobus <rclobus@rclobus.nl>
|
||||
# Copyright 2021-2024 Roland Clobus <rclobus@rclobus.nl>
|
||||
# Copyright 2024 Emanuele Rocca <ema@debian.org>
|
||||
# released under the GPLv2
|
||||
|
||||
# Environment variables:
|
||||
|
@ -59,6 +60,7 @@ EOF
|
|||
|
||||
show_help() {
|
||||
echo "--help, --usage: This help text"
|
||||
echo "--architecture: Optional, specifies the architecture (e.g. for cross-building)"
|
||||
echo "--configuration: Mandatory, specifies the configuration (desktop environment)"
|
||||
echo "--debian-version: Mandatory, e.g. trixie, sid"
|
||||
echo "--debian-version-number: The version number, e.g. 13.0.1"
|
||||
|
@ -77,7 +79,7 @@ show_help() {
|
|||
parse_commandline_arguments() {
|
||||
|
||||
# In alphabetical order
|
||||
local LONGOPTS="configuration:,debian-version:,debian-version-number:,debug,disk-info,generate-source,help,installer-origin:,timestamp:,usage"
|
||||
local LONGOPTS="architecture:,configuration:,debian-version:,debian-version-number:,debug,disk-info,generate-source,help,installer-origin:,timestamp:,usage"
|
||||
|
||||
local ARGUMENTS
|
||||
local ERR=0
|
||||
|
@ -98,6 +100,11 @@ parse_commandline_arguments() {
|
|||
local ARG="${1}"
|
||||
# In alphabetical order
|
||||
case "${ARG}" in
|
||||
--architecture)
|
||||
shift
|
||||
ARCHITECTURE=$1
|
||||
shift
|
||||
;;
|
||||
--configuration)
|
||||
shift
|
||||
CONFIGURATION=$1
|
||||
|
@ -226,6 +233,36 @@ parse_commandline_arguments() {
|
|||
;;
|
||||
esac
|
||||
|
||||
if command -v dpkg >/dev/null; then
|
||||
HOST_ARCH="$(dpkg --print-architecture)"
|
||||
else
|
||||
HOST_ARCH="$(uname -m)"
|
||||
fi
|
||||
# Use host architecture as default, if no architecture is provided
|
||||
if [ -z "${ARCHITECTURE}" ]; then
|
||||
ARCHITECTURE=${HOST_ARCH}
|
||||
fi
|
||||
|
||||
if [ "${ARCHITECTURE}" != "${HOST_ARCH}" ]; then
|
||||
output_echo "Cross-building ${ARCHITECTURE} image on ${HOST_ARCH}"
|
||||
case "${ARCHITECTURE}" in
|
||||
"amd64")
|
||||
QEMU_STATIC_EXECUTABLE=qemu-x86_64-static
|
||||
;;
|
||||
"i386")
|
||||
QEMU_STATIC_EXECUTABLE=qemu-i386-static
|
||||
;;
|
||||
"arm64")
|
||||
QEMU_STATIC_EXECUTABLE=qemu-aarch64-static
|
||||
;;
|
||||
*)
|
||||
output_echo "Error: Unknown architecture ${ARCHITECTURE}"
|
||||
exit 5
|
||||
;;
|
||||
esac
|
||||
ARCHITECTURE_OPTIONS="--bootstrap-qemu-arch ${ARCHITECTURE} --bootstrap-qemu-static /usr/bin/${QEMU_STATIC_EXECUTABLE}"
|
||||
fi
|
||||
|
||||
BUILD_LATEST="archive"
|
||||
BUILD_LATEST_DESC="yes, from the main Debian archive"
|
||||
if [ ! -z "${TIMESTAMP}" ]; then
|
||||
|
@ -270,11 +307,12 @@ parse_commandline_arguments() {
|
|||
# Differentiate between lxqt and lxde
|
||||
CONFIGURATION_SHORT=$(echo ${CONFIGURATION} | cut -c1,3)
|
||||
fi
|
||||
ISO_VOLUME="d-live ${DEBIAN_VERSION_NUMBER} ${CONFIGURATION_SHORT} amd64"
|
||||
ISO_VOLUME="d-live ${DEBIAN_VERSION_NUMBER} ${CONFIGURATION_SHORT} ${ARCHITECTURE}"
|
||||
|
||||
# Tracing this generator script
|
||||
REBUILD_SHA256SUM=$(sha256sum ${BASH_SOURCE} | cut -f1 -d" ")
|
||||
|
||||
echo "ARCHITECTURE = ${ARCHITECTURE}"
|
||||
echo "CONFIGURATION = ${CONFIGURATION}"
|
||||
echo "DEBIAN_VERSION = ${DEBIAN_VERSION}"
|
||||
echo "DEBIAN_VERSION_NUMBER = ${DEBIAN_VERSION_NUMBER}"
|
||||
|
@ -421,6 +459,8 @@ lb config \
|
|||
--cache-packages false \
|
||||
--archive-areas "main ${FIRMWARE_ARCHIVE_AREA}" \
|
||||
--iso-volume "${ISO_VOLUME}" \
|
||||
--architecture ${ARCHITECTURE} \
|
||||
${ARCHITECTURE_OPTIONS} \
|
||||
${GENERATE_SOURCE} \
|
||||
2>&1 | tee $LB_OUTPUT
|
||||
|
||||
|
@ -608,7 +648,7 @@ if [ ${BUILD_RESULT} -ne 0 ]; then
|
|||
fi
|
||||
|
||||
# Calculate the checksum
|
||||
SHA256SUM=$(sha256sum live-image-amd64.hybrid.iso | cut -f 1 -d " ")
|
||||
SHA256SUM=$(sha256sum live-image-${ARCHITECTURE}.hybrid.iso | cut -f 1 -d " ")
|
||||
|
||||
if [ ${BUILD_LATEST} == "archive" ]; then
|
||||
SNAPSHOT_TIMESTAMP_OLD=${SNAPSHOT_TIMESTAMP}
|
||||
|
|
Loading…
Reference in New Issue