Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependencies and merge from upstream #23

Closed
wants to merge 65 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
1377e90
Ensure loop device partition nodes are created (#741)
acinonyx Jan 4, 2024
c5fdb01
Update release notes
XECDesign Dec 8, 2023
ec04064
stage0: Only disable initramfs updates if update-initramfs.conf exists
XECDesign Dec 18, 2023
a143895
stage0: Check whether foreign architecture is needed
XECDesign Dec 18, 2023
30fa760
stage0: prevent kernel packages from creating useless symlinks
XECDesign Jan 17, 2024
e682f62
stage3: add vulkan support
XECDesign Jan 17, 2024
94bb866
Merge branch 'master' into arm64
XECDesign Jan 17, 2024
a125344
Remove cmdline.txt and config.txt symlinks
XECDesign Jan 22, 2024
62eeab3
Merge branch 'master' into arm64
XECDesign Jan 22, 2024
0425477
stage2: rc.local drop-in no longer required, since Debian ships its o…
XECDesign Jan 23, 2024
a34bf65
Merge branch 'master' into arm64
XECDesign Jan 23, 2024
c20ce09
export-image: make sure initramfs is created
XECDesign Jan 30, 2024
5714954
Merge branch 'master' into arm64
XECDesign Jan 30, 2024
69037ce
Update README.md (#755)
tdewey-rpi Feb 19, 2024
502e5fa
Remove QCOW2 build mechanism (#648)
mmmspatz Feb 23, 2024
94cbf47
Create .gitlab-ci.yml file
XECDesign Feb 14, 2024
c029146
ensure_loopdev_partitions: let udev settle
XECDesign Feb 15, 2024
82e5642
README.md: Add xxd dependency (#750)
ckuhtz Feb 26, 2024
b4f2aea
Merge branch 'master' into arm64
XECDesign Feb 26, 2024
1ce1f1c
Replace libcamera-apps with rpicam-apps
XECDesign Mar 4, 2024
6fb311e
Merge branch 'master' into arm64
XECDesign Mar 4, 2024
57c641a
Update release notes
XECDesign Mar 7, 2024
ff2fd50
Merge branch 'master' into arm64
XECDesign Mar 7, 2024
4ce1f1f
stage3: Remove fbturbo
XECDesign Mar 11, 2024
e8d8670
Update release notes
XECDesign Mar 11, 2024
9a13a81
Merge branch 'master' into arm64
XECDesign Mar 11, 2024
99e1980
stage4: remove disable-pwr-button substage
XECDesign Mar 13, 2024
d92bef1
stage4: add meson
XECDesign Mar 13, 2024
b829737
Update release notes
XECDesign Mar 13, 2024
3358eb3
Merge branch 'master' into arm64
XECDesign Mar 13, 2024
3b5e214
export-image: format boot partition with appropriate FAT size
XECDesign Mar 13, 2024
dd93d62
Merge branch 'master' into arm64
XECDesign Mar 13, 2024
af5a88a
stage4: add openocd
XECDesign Mar 13, 2024
8273e85
Merge branch 'master' into arm64
XECDesign Mar 13, 2024
1109642
Update release notes
XECDesign Mar 15, 2024
f19ee21
Merge branch 'master' into arm64
XECDesign Mar 15, 2024
7ce2538
Revert "Added docker-compose.yml for easy apt-cacher-ng startup"
XECDesign Apr 9, 2024
56916d4
Merge branch 'master' into arm64
XECDesign Apr 9, 2024
c70f96f
stage5: smartsim has been removed from recommended apps
XECDesign Apr 9, 2024
8056aa3
Merge branch 'master' into arm64
XECDesign Apr 9, 2024
165e960
Fix keyboard configuration
XECDesign Apr 18, 2024
7dd5b7d
Merge branch 'master' into arm64
XECDesign Apr 18, 2024
5780b1f
export stage list
Apr 25, 2024
2c29fc2
Merge branch 'master' into arm64
XECDesign Apr 29, 2024
f1c166a
export-image: run du with -x to avoid crossing filesystem boundaries
XECDesign Apr 29, 2024
64e2057
Merge branch 'master' into arm64
XECDesign Apr 29, 2024
e95e00f
Set a default IMG_NAME
XECDesign May 13, 2024
d87f764
build.sh: Warn user of unsupported build environment architecture and…
XECDesign May 13, 2024
2327c5e
Merge branch 'master' into arm64
XECDesign May 13, 2024
72b2dfd
build.sh: set ARCH to arm64
XECDesign May 13, 2024
9917c86
README.md: Consistent formatting of 'Default' values
XECDesign May 13, 2024
97aa847
Merge branch 'master' into arm64
XECDesign May 13, 2024
d790fed
Compare mount output using base of dirname (#771)
pevsonic May 15, 2024
fb48183
Expand trap cleanup function (#773)
tdewey-rpi May 15, 2024
0755b07
Merge branch 'master' into arm64
XECDesign May 15, 2024
75fe47c
Increase default swap size to 200
XECDesign May 27, 2024
a63eb86
Merge branch 'master' into arm64
XECDesign May 27, 2024
07ab464
stage4: Pre-install labwc
XECDesign Jun 10, 2024
9b17be9
Update release notes
XECDesign Jun 10, 2024
ca5eb62
Enable DWC2 host mode support for CM5 by default
XECDesign Jun 24, 2024
0b115f3
stage4: Pre-install rpi-connect
XECDesign Jun 19, 2024
48efb5f
Merge branch 'master' into arm64
XECDesign Jun 24, 2024
e4db647
added python3-dev dependency for framegrab netifaces requirement
robotrapta Jul 18, 2024
dc4042c
fixed broken readme link
robotrapta Jul 18, 2024
c53e72e
Merge from upstream 2024-07
f-wright Jul 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ SKIP
SKIP_IMAGES
.pc
*-pc
apt-cacher-ng/


#
Expand Down
4 changes: 4 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
include:
- project: serge/pi-gen
ref: ci
file: 'pi-gen.yml'
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ RUN apt-get -y update && \
apt-get -y install --no-install-recommends \
git vim parted \
quilt coreutils qemu-user-static debootstrap zerofree zip dosfstools \
libarchive-tools libcap2-bin rsync grep udev xz-utils curl xxd file kmod bc\
binfmt-support ca-certificates qemu-utils kpartx fdisk gpg pigz\
libarchive-tools libcap2-bin rsync grep udev xz-utils curl xxd file kmod bc \
binfmt-support ca-certificates fdisk gpg pigz arch-test \
&& rm -rf /var/lib/apt/lists/*

COPY . /pi-gen/
Expand Down
2 changes: 1 addition & 1 deletion GL-README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ There are several different images available, depending on your needs, from smal

## Source Code

This build system is based on [pi-gen](https://github.com/RPi-Distro/pi-gen). Refer to its [original README](/README.md) for how everything works. The (`gl-config`)[gl-config] file is the key source of control. (What is called "config" in the original.)
This build system is based on [pi-gen](https://github.com/RPi-Distro/pi-gen). Refer to its [original README](/README.md) for how everything works. The [`gl-config`](gl-config) file is the key source of control. (What is called "config" in the original.)

Note that we're tracking the `arm64` branch, not main. (If we build off the main branch, we hit [an issue with missing `arm/v8` docker images](https://github.com/groundlight/monitoring-notification-server/issues/39) and likely others, because we make these funky machines with a 64-bit kernel, but 32-bit applications.)

Expand Down
190 changes: 46 additions & 144 deletions README.md

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions build-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,6 @@ time ${DOCKER} run \
$DOCKER_CMDLINE_PRE \
--name "${DOCKER_CMDLINE_NAME}" \
--privileged \
--cap-add=ALL \
-v /dev:/dev \
-v /lib/modules:/lib/modules \
${PIGEN_DOCKER_OPTS} \
--volume "${CONFIG_FILE}":/config:ro \
-e "GIT_HASH=${GIT_HASH}" \
Expand Down
158 changes: 29 additions & 129 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ EOF
on_chroot << EOF
apt-get -o Acquire::Retries=3 install --no-install-recommends -y $PACKAGES
EOF
if [ "${USE_QCOW2}" = "1" ]; then
on_chroot << EOF
apt-get clean
EOF
fi
fi
log "End ${SUB_STAGE_DIR}/${i}-packages-nr"
fi
Expand All @@ -39,11 +34,6 @@ EOF
on_chroot << EOF
apt-get -o Acquire::Retries=3 install -y $PACKAGES
EOF
if [ "${USE_QCOW2}" = "1" ]; then
on_chroot << EOF
apt-get clean
EOF
fi
fi
log "End ${SUB_STAGE_DIR}/${i}-packages"
fi
Expand Down Expand Up @@ -102,24 +92,15 @@ run_stage(){
STAGE_WORK_DIR="${WORK_DIR}/${STAGE}"
ROOTFS_DIR="${STAGE_WORK_DIR}"/rootfs

if [ "${USE_QCOW2}" = "1" ]; then
if [ ! -f SKIP ]; then
load_qimage
fi
else
# make sure we are not umounting during export-image stage
if [ "${USE_QCOW2}" = "0" ] && [ "${NO_PRERUN_QCOW2}" = "0" ]; then
unmount "${WORK_DIR}/${STAGE}"
fi
fi
unmount "${WORK_DIR}/${STAGE}"

if [ ! -f SKIP_IMAGES ]; then
if [ -f "${STAGE_DIR}/EXPORT_IMAGE" ]; then
EXPORT_DIRS="${EXPORT_DIRS} ${STAGE_DIR}"
fi
fi
if [ ! -f SKIP ]; then
if [ "${CLEAN}" = "1" ] && [ "${USE_QCOW2}" = "0" ] ; then
if [ "${CLEAN}" = "1" ]; then
if [ -d "${ROOTFS_DIR}" ]; then
rm -rf "${ROOTFS_DIR}"
fi
Expand All @@ -136,14 +117,7 @@ run_stage(){
done
fi

if [ "${USE_QCOW2}" = "1" ]; then
unload_qimage
else
# make sure we are not umounting during export-image stage
if [ "${USE_QCOW2}" = "0" ] && [ "${NO_PRERUN_QCOW2}" = "0" ]; then
unmount "${WORK_DIR}/${STAGE}"
fi
fi
unmount "${WORK_DIR}/${STAGE}"

PREV_STAGE="${STAGE}"
PREV_STAGE_DIR="${STAGE_DIR}"
Expand Down Expand Up @@ -187,9 +161,16 @@ do
done

term() {
if [ "${USE_QCOW2}" = "1" ]; then
log "Unloading image"
unload_qimage
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
}

Expand All @@ -199,10 +180,9 @@ 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}

if [ -z "${IMG_NAME}" ]; then
echo "IMG_NAME not set" 1>&2
exit 1
fi
export ARCH=arm64
export RELEASE=${RELEASE:-bookworm} # Don't forget to update stage0/prerun.sh
export IMG_NAME="${IMG_NAME:-raspios-$RELEASE-$ARCH}"

export USE_QEMU="${USE_QEMU:-0}"
export IMG_DATE="${IMG_DATE:-"$(date +%Y-%m-%d)"}"
Expand Down Expand Up @@ -230,7 +210,6 @@ export TARGET_HOSTNAME=${TARGET_HOSTNAME:-raspberrypi}
export FIRST_USER_NAME=${FIRST_USER_NAME:-pi}
export FIRST_USER_PASS
export DISABLE_FIRST_BOOT_USER_RENAME=${DISABLE_FIRST_BOOT_USER_RENAME:-0}
export RELEASE=${RELEASE:-bookworm} # Don't forget to update stage0/prerun.sh
export WPA_COUNTRY
export ENABLE_SSH="${ENABLE_SSH:-0}"
export PUBKEY_ONLY_SSH="${PUBKEY_ONLY_SSH:-0}"
Expand All @@ -247,7 +226,6 @@ export GIT_HASH=${GIT_HASH:-"$(git rev-parse HEAD)"}
export PUBKEY_SSH_FIRST_USER

export CLEAN
export IMG_NAME
export APT_PROXY

export STAGE
Expand All @@ -273,24 +251,21 @@ source "${SCRIPT_DIR}/common"
# shellcheck source=scripts/dependencies_check
source "${SCRIPT_DIR}/dependencies_check"

export NO_PRERUN_QCOW2="${NO_PRERUN_QCOW2:-1}"
export USE_QCOW2="${USE_QCOW2:-0}"
export BASE_QCOW2_SIZE=${BASE_QCOW2_SIZE:-12G}
source "${SCRIPT_DIR}/qcow2_handling"
if [ "${USE_QCOW2}" = "1" ]; then
NO_PRERUN_QCOW2=1
else
NO_PRERUN_QCOW2=0
fi

export NO_PRERUN_QCOW2="${NO_PRERUN_QCOW2:-1}"

if [ "$SETFCAP" != "1" ]; then
export CAPSH_ARG="--drop=cap_setfcap"
fi

dependencies_check "${BASE_DIR}/depends"

echo "Checking native $ARCH executable support..."
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."
exit 1
fi
fi

#check username is valid
if [[ ! "$FIRST_USER_NAME" =~ ^[a-z][-a-z0-9_]*$ ]]; then
echo "Invalid FIRST_USER_NAME: $FIRST_USER_NAME"
Expand Down Expand Up @@ -327,6 +302,7 @@ mkdir -p "${WORK_DIR}"
log "Begin ${BASE_DIR}"

STAGE_LIST=${STAGE_LIST:-${BASE_DIR}/stage*}
export STAGE_LIST

for STAGE_DIR in $STAGE_LIST; do
STAGE_DIR=$(realpath "${STAGE_DIR}")
Expand All @@ -339,98 +315,22 @@ for EXPORT_DIR in ${EXPORT_DIRS}; do
# shellcheck source=/dev/null
source "${EXPORT_DIR}/EXPORT_IMAGE"
EXPORT_ROOTFS_DIR=${WORK_DIR}/$(basename "${EXPORT_DIR}")/rootfs
if [ "${USE_QCOW2}" = "1" ]; then
USE_QCOW2=0
EXPORT_NAME="${IMG_FILENAME}${IMG_SUFFIX}"
echo "------------------------------------------------------------------------"
echo "Running export stage for ${EXPORT_NAME}"
rm -f "${WORK_DIR}/export-image/${EXPORT_NAME}.img" || true
rm -f "${WORK_DIR}/export-image/${EXPORT_NAME}.qcow2" || true
rm -f "${WORK_DIR}/${EXPORT_NAME}.img" || true
rm -f "${WORK_DIR}/${EXPORT_NAME}.qcow2" || true
EXPORT_STAGE=$(basename "${EXPORT_DIR}")
for s in $STAGE_LIST; do
TMP_LIST=${TMP_LIST:+$TMP_LIST }$(basename "${s}")
done
FIRST_STAGE=${TMP_LIST%% *}
FIRST_IMAGE="image-${FIRST_STAGE}.qcow2"

pushd "${WORK_DIR}" > /dev/null
echo "Creating new base "${EXPORT_NAME}.qcow2" from ${FIRST_IMAGE}"
cp "./${FIRST_IMAGE}" "${EXPORT_NAME}.qcow2"

ARR=($TMP_LIST)
# rebase stage images to new export base
for CURR_STAGE in "${ARR[@]}"; do
if [ "${CURR_STAGE}" = "${FIRST_STAGE}" ]; then
PREV_IMG="${EXPORT_NAME}"
continue
fi
echo "Rebasing image-${CURR_STAGE}.qcow2 onto ${PREV_IMG}.qcow2"
qemu-img rebase -f qcow2 -u -b ${PREV_IMG}.qcow2 image-${CURR_STAGE}.qcow2
if [ "${CURR_STAGE}" = "${EXPORT_STAGE}" ]; then
break
fi
PREV_IMG="image-${CURR_STAGE}"
done

# commit current export stage into base export image
echo "Committing image-${EXPORT_STAGE}.qcow2 to ${EXPORT_NAME}.qcow2"
qemu-img commit -f qcow2 -p -b "${EXPORT_NAME}.qcow2" image-${EXPORT_STAGE}.qcow2

# rebase stage images back to original first stage for easy re-run
for CURR_STAGE in "${ARR[@]}"; do
if [ "${CURR_STAGE}" = "${FIRST_STAGE}" ]; then
PREV_IMG="image-${CURR_STAGE}"
continue
fi
echo "Rebasing back image-${CURR_STAGE}.qcow2 onto ${PREV_IMG}.qcow2"
qemu-img rebase -f qcow2 -u -b ${PREV_IMG}.qcow2 image-${CURR_STAGE}.qcow2
if [ "${CURR_STAGE}" = "${EXPORT_STAGE}" ]; then
break
fi
PREV_IMG="image-${CURR_STAGE}"
done
popd > /dev/null

mkdir -p "${WORK_DIR}/export-image/rootfs"
mv "${WORK_DIR}/${EXPORT_NAME}.qcow2" "${WORK_DIR}/export-image/"
echo "Mounting image ${WORK_DIR}/export-image/${EXPORT_NAME}.qcow2 to rootfs ${WORK_DIR}/export-image/rootfs"
mount_qimage "${WORK_DIR}/export-image/${EXPORT_NAME}.qcow2" "${WORK_DIR}/export-image/rootfs"

CLEAN=0
run_stage
CLEAN=1
USE_QCOW2=1

else
run_stage
fi
run_stage
if [ "${USE_QEMU}" != "1" ]; then
if [ -e "${EXPORT_DIR}/EXPORT_NOOBS" ]; then
# shellcheck source=/dev/null
source "${EXPORT_DIR}/EXPORT_NOOBS"
STAGE_DIR="${BASE_DIR}/export-noobs"
if [ "${USE_QCOW2}" = "1" ]; then
USE_QCOW2=0
run_stage
USE_QCOW2=1
else
run_stage
fi
run_stage
fi
fi
done

if [ -x postrun.sh ]; then
if [ -x "${BASE_DIR}/postrun.sh" ]; then
log "Begin postrun.sh"
cd "${BASE_DIR}"
./postrun.sh
log "End postrun.sh"
fi

if [ "${USE_QCOW2}" = "1" ]; then
unload_qimage
fi

log "End ${BASE_DIR}"
3 changes: 1 addition & 2 deletions depends
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ file
git
lsmod:kmod
bc
qemu-nbd:qemu-utils
kpartx
gpg
pigz
arch-test
10 changes: 0 additions & 10 deletions docker-compose.yml

This file was deleted.

18 changes: 7 additions & 11 deletions export-image/04-set-partuuid/00-run.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
#!/bin/bash -e

if [ "${NO_PRERUN_QCOW2}" = "0" ]; then
IMG_FILE="${STAGE_WORK_DIR}/${IMG_FILENAME}${IMG_SUFFIX}.img"

IMG_FILE="${STAGE_WORK_DIR}/${IMG_FILENAME}${IMG_SUFFIX}.img"
IMGID="$(dd if="${IMG_FILE}" skip=440 bs=1 count=4 2>/dev/null | xxd -e | cut -f 2 -d' ')"

IMGID="$(dd if="${IMG_FILE}" skip=440 bs=1 count=4 2>/dev/null | xxd -e | cut -f 2 -d' ')"
BOOT_PARTUUID="${IMGID}-01"
ROOT_PARTUUID="${IMGID}-02"

BOOT_PARTUUID="${IMGID}-01"
ROOT_PARTUUID="${IMGID}-02"

sed -i "s/BOOTDEV/PARTUUID=${BOOT_PARTUUID}/" "${ROOTFS_DIR}/etc/fstab"
sed -i "s/ROOTDEV/PARTUUID=${ROOT_PARTUUID}/" "${ROOTFS_DIR}/etc/fstab"

sed -i "s/ROOTDEV/PARTUUID=${ROOT_PARTUUID}/" "${ROOTFS_DIR}/boot/firmware/cmdline.txt"
fi
sed -i "s/BOOTDEV/PARTUUID=${BOOT_PARTUUID}/" "${ROOTFS_DIR}/etc/fstab"
sed -i "s/ROOTDEV/PARTUUID=${ROOT_PARTUUID}/" "${ROOTFS_DIR}/etc/fstab"

sed -i "s/ROOTDEV/PARTUUID=${ROOT_PARTUUID}/" "${ROOTFS_DIR}/boot/firmware/cmdline.txt"
23 changes: 9 additions & 14 deletions export-image/05-finalise/01-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,24 +83,17 @@ cp "$ROOTFS_DIR/etc/rpi-issue" "$INFO_FILE"
dpkg -l --root "$ROOTFS_DIR"
} >> "$INFO_FILE"

mkdir -p "${DEPLOY_DIR}"
ROOT_DEV="$(awk "\$2 == \"${ROOTFS_DIR}\" {print \$1}" /etc/mtab)"

rm -f "${DEPLOY_DIR}/${ARCHIVE_FILENAME}${IMG_SUFFIX}.*"
rm -f "${DEPLOY_DIR}/${IMG_FILENAME}${IMG_SUFFIX}.img"
unmount "${ROOTFS_DIR}"
zerofree "${ROOT_DEV}"

mv "$INFO_FILE" "$DEPLOY_DIR/"
unmount_image "${IMG_FILE}"

if [ "${USE_QCOW2}" = "0" ] && [ "${NO_PRERUN_QCOW2}" = "0" ]; then
ROOT_DEV="$(mount | grep "${ROOTFS_DIR} " | cut -f1 -d' ')"

unmount "${ROOTFS_DIR}"
zerofree "${ROOT_DEV}"
mkdir -p "${DEPLOY_DIR}"

unmount_image "${IMG_FILE}"
else
unload_qimage
make_bootable_image "${STAGE_WORK_DIR}/${IMG_FILENAME}${IMG_SUFFIX}.qcow2" "$IMG_FILE"
fi
rm -f "${DEPLOY_DIR}/${ARCHIVE_FILENAME}${IMG_SUFFIX}.*"
rm -f "${DEPLOY_DIR}/${IMG_FILENAME}${IMG_SUFFIX}.img"

case "${DEPLOY_COMPRESSION}" in
zip)
Expand All @@ -121,3 +114,5 @@ none | *)
cp "$IMG_FILE" "$DEPLOY_DIR/"
;;
esac

cp "$INFO_FILE" "$DEPLOY_DIR/"
Loading