summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSerge Schneider <serge@raspberrypi.com>2024-10-29 15:33:28 +0000
committerSerge Schneider <serge@raspberrypi.com>2024-10-29 15:33:28 +0000
commit150246acda0b29dcdeed865f7ec0e82602774aef (patch)
treea34683db024c22658df2f3a15385d90e66dc2dd7
parent19fd60cef735784267b2a48ff358291d09909854 (diff)
parentdf6d0e2a25d920aa32f8f90fe7662ba8b98d2e4a (diff)
Merge branch 'master' into arm64
-rwxr-xr-xbuild.sh41
1 files changed, 24 insertions, 17 deletions
diff --git a/build.sh b/build.sh
index dc2697c..f051727 100755
--- a/build.sh
+++ b/build.sh
@@ -123,6 +123,20 @@ run_stage(){
log "End ${STAGE_DIR}"
}
+term() {
+ if [ "$?" -ne 0 ]; then
+ log "Build failed"
+ else
+ log "Build finished"
+ fi
+ unmount "${STAGE_WORK_DIR}"
+ if [ "$STAGE" = "export-image" ]; then
+ for img in "${STAGE_WORK_DIR}/"*.img; do
+ unmount_image "$img"
+ done
+ fi
+}
+
if [ "$(id -u)" != "0" ]; then
echo "Please run as root" 1>&2
exit 1
@@ -157,22 +171,6 @@ do
esac
done
-term() {
- if [ "$?" -ne 0 ]; then
- log "Build failed"
- else
- log "Build finished"
- fi
- unmount "${STAGE_WORK_DIR}"
- if [ "$STAGE" = "export-image" ]; then
- for img in "${STAGE_WORK_DIR}/"*.img; do
- unmount_image "$img"
- done
- fi
-}
-
-trap term EXIT INT TERM
-
export PI_GEN=${PI_GEN:-pi-gen}
export PI_GEN_REPO=${PI_GEN_REPO:-https://github.com/RPi-Distro/pi-gen}
export PI_GEN_RELEASE=${PI_GEN_RELEASE:-Raspberry Pi reference}
@@ -252,6 +250,9 @@ if [ "$SETFCAP" != "1" ]; then
export CAPSH_ARG="--drop=cap_setfcap"
fi
+mkdir -p "${WORK_DIR}"
+trap term EXIT INT TERM
+
dependencies_check "${BASE_DIR}/depends"
echo "Checking native $ARCH executable support..."
@@ -259,6 +260,13 @@ if ! arch-test -n "$ARCH"; then
echo "WARNING: Only a native build environment is supported. Checking emulated support..."
if ! arch-test "$ARCH"; then
echo "No fallback mechanism found. Ensure your OS has binfmt_misc support enabled and configured."
+ PAGESIZE=$(getconf PAGESIZE)
+ if [ "$ARCH" == "armhf" ] && [ "$PAGESIZE" != "4096" ]; then
+ echo
+ echo "Building an $ARCH image requires a kernel with a 4k page size"
+ echo "Current pagesize: $PAGESIZE"
+ echo "On Raspberry Pi OS, you can switch to a suitable kernel by adding kernel=kernel8.img to /boot/firmware/config.txt and rebooting"
+ fi
exit 1
fi
fi
@@ -295,7 +303,6 @@ if [[ "${PUBKEY_ONLY_SSH}" = "1" && -z "${PUBKEY_SSH_FIRST_USER}" ]]; then
exit 1
fi
-mkdir -p "${WORK_DIR}"
log "Begin ${BASE_DIR}"
STAGE_LIST=${STAGE_LIST:-${BASE_DIR}/stage*}