From c439a2a0a86aca1ef5dd06d10a56c4dec1de5c07 Mon Sep 17 00:00:00 2001 From: robotrapta <79607467+robotrapta@users.noreply.github.com> Date: Mon, 5 Feb 2024 09:29:14 -0800 Subject: [PATCH] Merge from upstream 2024-02 (#19) * Ensure loop device partition nodes are created (#741) Although the loop block device is created before attaching the image to it, the devices for the partition that the image contains are still not created. This patch creates those devices as well, when they are not already available. Fixes #482 Signed-off-by: Vasilis Tsiligiannis * Update release notes * stage0: Only disable initramfs updates if update-initramfs.conf exists * stage0: Check whether foreign architecture is needed * stage0: prevent kernel packages from creating useless symlinks * stage3: add vulkan support * Remove cmdline.txt and config.txt symlinks * stage2: rc.local drop-in no longer required, since Debian ships its own version * export-image: make sure initramfs is created Fixes #749 * README on how to merge from upstream. --------- Signed-off-by: Vasilis Tsiligiannis Co-authored-by: Vasilis Tsiligiannis Co-authored-by: Serge Schneider --- GL-README.md | 14 +++++++++++++- export-image/05-finalise/01-run.sh | 2 +- export-image/prerun.sh | 1 + export-noobs/00-release/files/release_notes.txt | 2 ++ export-noobs/prerun.sh | 1 + scripts/common | 14 ++++++++++++++ stage0/00-configure-apt/00-run.sh | 13 +++++++++---- stage0/02-firmware/02-run.sh | 9 ++++++++- stage1/00-boot-files/00-run.sh | 11 ++++------- stage2/01-sys-tweaks/01-run.sh | 3 --- stage2/01-sys-tweaks/files/ttyoutput.conf | 2 -- stage3/00-install-packages/00-packages | 1 + 12 files changed, 54 insertions(+), 19 deletions(-) delete mode 100644 stage2/01-sys-tweaks/files/ttyoutput.conf diff --git a/GL-README.md b/GL-README.md index a127817..201328a 100644 --- a/GL-README.md +++ b/GL-README.md @@ -117,4 +117,16 @@ export PASSWORD= ## What's up with this file? -This file is called `GL-README.md` and is elevated to the github repo homepage by a symlink `.github/README.md`. \ No newline at end of file +This file is called `GL-README.md` and is elevated to the github repo homepage by a symlink `.github/README.md`. + +## Merging from upstream + +Here's the process + +``` +git remote add upstream https://github.com/RPi-Distro/pi-gen +git fetch upstream +git merge upstream/arm64 +``` + +Then test test test. diff --git a/export-image/05-finalise/01-run.sh b/export-image/05-finalise/01-run.sh index 826198f..3b56b20 100755 --- a/export-image/05-finalise/01-run.sh +++ b/export-image/05-finalise/01-run.sh @@ -6,7 +6,7 @@ INFO_FILE="${STAGE_WORK_DIR}/${IMG_FILENAME}${IMG_SUFFIX}.info" sed -i 's/^update_initramfs=.*/update_initramfs=all/' "${ROOTFS_DIR}/etc/initramfs-tools/update-initramfs.conf" on_chroot << EOF -update-initramfs -u +update-initramfs -k all -c if [ -x /etc/init.d/fake-hwclock ]; then /etc/init.d/fake-hwclock stop fi diff --git a/export-image/prerun.sh b/export-image/prerun.sh index a5f94e9..d042c6a 100755 --- a/export-image/prerun.sh +++ b/export-image/prerun.sh @@ -46,6 +46,7 @@ if [ "${NO_PRERUN_QCOW2}" = "0" ]; then fi done + ensure_loopdev_partitions "$LOOP_DEV" BOOT_DEV="${LOOP_DEV}p1" ROOT_DEV="${LOOP_DEV}p2" diff --git a/export-noobs/00-release/files/release_notes.txt b/export-noobs/00-release/files/release_notes.txt index 6507e59..d305e33 100644 --- a/export-noobs/00-release/files/release_notes.txt +++ b/export-noobs/00-release/files/release_notes.txt @@ -1,4 +1,6 @@ UNRELEASED: + * Fix Raspberry Pi Imager's WLAN configuration for lite images +2023-12-05: * Serial port switching in rc_gui and raspi-config modified to support Raspberry Pi 5 * Touch screens now identified with unique per-device strings to enable correct association with display devices * Compatibility with RP1 displays added diff --git a/export-noobs/prerun.sh b/export-noobs/prerun.sh index 6282836..80cbb8e 100755 --- a/export-noobs/prerun.sh +++ b/export-noobs/prerun.sh @@ -22,6 +22,7 @@ until ensure_next_loopdev && LOOP_DEV="$(losetup --show --find --partscan "$IMG_ fi done +ensure_loopdev_partitions "$LOOP_DEV" BOOT_DEV="${LOOP_DEV}p1" ROOT_DEV="${LOOP_DEV}p2" diff --git a/scripts/common b/scripts/common index e33ae6e..c290585 100644 --- a/scripts/common +++ b/scripts/common @@ -111,3 +111,17 @@ ensure_next_loopdev() { [[ -b "$loopdev" ]] || mknod "$loopdev" b 7 "$loopmaj" } export -f ensure_next_loopdev + +ensure_loopdev_partitions() { + local line + local partition + local majmin + lsblk -r -n -o "NAME,MAJ:MIN" "$1" | grep -v "^${1#/dev/} " | while read -r line; do + partition="${line%% *}" + majmin="${line#* }" + if [ ! -b "/dev/$partition" ]; then + mknod "/dev/$partition" b "${majmin%:*}" "${majmin#*:}" + fi + done +} +export -f ensure_loopdev_partitions diff --git a/stage0/00-configure-apt/00-run.sh b/stage0/00-configure-apt/00-run.sh index c962c35..926c4c6 100755 --- a/stage0/00-configure-apt/00-run.sh +++ b/stage0/00-configure-apt/00-run.sh @@ -14,8 +14,13 @@ fi cat files/raspberrypi.gpg.key | gpg --dearmor > "${STAGE_WORK_DIR}/raspberrypi-archive-stable.gpg" install -m 644 "${STAGE_WORK_DIR}/raspberrypi-archive-stable.gpg" "${ROOTFS_DIR}/etc/apt/trusted.gpg.d/" -on_chroot << EOF -dpkg --add-architecture armhf -apt-get update -apt-get dist-upgrade -y +on_chroot <<- \EOF + ARCH="$(dpkg --print-architecture)" + if [ "$ARCH" = "armhf" ]; then + dpkg --add-architecture arm64 + elif [ "$ARCH" = "arm64" ]; then + dpkg --add-architecture armhf + fi + apt-get update + apt-get dist-upgrade -y EOF diff --git a/stage0/02-firmware/02-run.sh b/stage0/02-firmware/02-run.sh index 0b2bca9..677cd81 100755 --- a/stage0/02-firmware/02-run.sh +++ b/stage0/02-firmware/02-run.sh @@ -1,3 +1,10 @@ #!/bin/bash -e -sed -i 's/^update_initramfs=.*/update_initramfs=no/' "${ROOTFS_DIR}/etc/initramfs-tools/update-initramfs.conf" +if [ -f "${ROOTFS_DIR}/etc/initramfs-tools/update-initramfs.conf" ]; then + sed -i 's/^update_initramfs=.*/update_initramfs=no/' "${ROOTFS_DIR}/etc/initramfs-tools/update-initramfs.conf" +fi + +if [ ! -f "${ROOTFS_DIR}/etc/kernel-img.conf" ]; then + echo "do_symlinks=0" > "${ROOTFS_DIR}/etc/kernel-img.conf" +fi +rm -f "${ROOTFS_DIR}/"{vmlinuz,initrd.img}* diff --git a/stage1/00-boot-files/00-run.sh b/stage1/00-boot-files/00-run.sh index ddb0f5b..8f1f823 100755 --- a/stage1/00-boot-files/00-run.sh +++ b/stage1/00-boot-files/00-run.sh @@ -7,11 +7,8 @@ if ! [ -L "${ROOTFS_DIR}/boot/overlays" ]; then fi install -m 644 files/cmdline.txt "${ROOTFS_DIR}/boot/firmware/" -if ! [ -L "${ROOTFS_DIR}/boot/cmdline.txt" ]; then - ln -s firmware/cmdline.txt "${ROOTFS_DIR}/boot/cmdline.txt" -fi - install -m 644 files/config.txt "${ROOTFS_DIR}/boot/firmware/" -if ! [ -L "${ROOTFS_DIR}/boot/config.txt" ]; then - ln -s firmware/config.txt "${ROOTFS_DIR}/boot/config.txt" -fi + +for file in cmdline.txt config.txt; do + printf "DO NOT EDIT THIS FILE\n\nThe file you are looking for has moved to %s\n" "/boot/firmware/${file}" > "${ROOTFS_DIR}/boot/${file}" +done diff --git a/stage2/01-sys-tweaks/01-run.sh b/stage2/01-sys-tweaks/01-run.sh index 294a0ec..59988b2 100755 --- a/stage2/01-sys-tweaks/01-run.sh +++ b/stage2/01-sys-tweaks/01-run.sh @@ -2,9 +2,6 @@ install -m 755 files/resize2fs_once "${ROOTFS_DIR}/etc/init.d/" -install -d "${ROOTFS_DIR}/etc/systemd/system/rc-local.service.d" -install -m 644 files/ttyoutput.conf "${ROOTFS_DIR}/etc/systemd/system/rc-local.service.d/" - install -m 644 files/50raspi "${ROOTFS_DIR}/etc/apt/apt.conf.d/" install -m 644 files/console-setup "${ROOTFS_DIR}/etc/default/" diff --git a/stage2/01-sys-tweaks/files/ttyoutput.conf b/stage2/01-sys-tweaks/files/ttyoutput.conf deleted file mode 100644 index 6a396a4..0000000 --- a/stage2/01-sys-tweaks/files/ttyoutput.conf +++ /dev/null @@ -1,2 +0,0 @@ -[Service] -StandardOutput=tty diff --git a/stage3/00-install-packages/00-packages b/stage3/00-install-packages/00-packages index 79d2c6a..6a48535 100644 --- a/stage3/00-install-packages/00-packages +++ b/stage3/00-install-packages/00-packages @@ -17,3 +17,4 @@ libcamera-apps python3-picamera2 python3-pyqt5 python3-opengl +vulkan-tools mesa-vulkan-drivers