From 1377e903b864673138908165572a18933400e8eb Mon Sep 17 00:00:00 2001 From: Vasilis Tsiligiannis Date: Thu, 4 Jan 2024 13:05:51 +0200 Subject: [PATCH 01/40] 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 --- export-image/prerun.sh | 1 + export-noobs/prerun.sh | 1 + scripts/common | 14 ++++++++++++++ 3 files changed, 16 insertions(+) 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/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 74c7938..cda5551 100644 --- a/scripts/common +++ b/scripts/common @@ -110,3 +110,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 From c5fdb01eac6a802957ad1eed5b6b9d4f06f791c4 Mon Sep 17 00:00:00 2001 From: Serge Schneider Date: Fri, 8 Dec 2023 07:58:19 +0000 Subject: [PATCH 02/40] Update release notes --- export-noobs/00-release/files/release_notes.txt | 2 ++ 1 file changed, 2 insertions(+) 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 From ec04064a552372b64a2cb7a1feb1bbda0c86ecac Mon Sep 17 00:00:00 2001 From: Serge Schneider Date: Mon, 18 Dec 2023 11:01:37 +0000 Subject: [PATCH 03/40] stage0: Only disable initramfs updates if update-initramfs.conf exists --- stage0/02-firmware/02-run.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/stage0/02-firmware/02-run.sh b/stage0/02-firmware/02-run.sh index 0b2bca9..9cf9154 100755 --- a/stage0/02-firmware/02-run.sh +++ b/stage0/02-firmware/02-run.sh @@ -1,3 +1,5 @@ #!/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 From a143895f0a465ffcd20323264e648cba3f39ccc6 Mon Sep 17 00:00:00 2001 From: Serge Schneider Date: Mon, 18 Dec 2023 11:04:13 +0000 Subject: [PATCH 04/40] stage0: Check whether foreign architecture is needed --- stage0/00-configure-apt/00-run.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/stage0/00-configure-apt/00-run.sh b/stage0/00-configure-apt/00-run.sh index fa4f59f..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 arm64 -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 From 30fa760eb166cfe8a8f1350b1cfd7d356c3753de Mon Sep 17 00:00:00 2001 From: Serge Schneider Date: Wed, 17 Jan 2024 17:30:10 +0000 Subject: [PATCH 05/40] stage0: prevent kernel packages from creating useless symlinks --- stage0/02-firmware/02-run.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/stage0/02-firmware/02-run.sh b/stage0/02-firmware/02-run.sh index 9cf9154..677cd81 100755 --- a/stage0/02-firmware/02-run.sh +++ b/stage0/02-firmware/02-run.sh @@ -3,3 +3,8 @@ 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}* From e682f62aed71be53fd8d49ac94c4d11f01996efe Mon Sep 17 00:00:00 2001 From: Serge Schneider Date: Wed, 17 Jan 2024 17:34:49 +0000 Subject: [PATCH 06/40] stage3: add vulkan support --- stage3/00-install-packages/00-packages | 1 + 1 file changed, 1 insertion(+) diff --git a/stage3/00-install-packages/00-packages b/stage3/00-install-packages/00-packages index cc18081..9175bcc 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 From a12534473182eb234a1751da7348f784b9271f42 Mon Sep 17 00:00:00 2001 From: Serge Schneider Date: Mon, 22 Jan 2024 14:48:55 +0000 Subject: [PATCH 07/40] Remove cmdline.txt and config.txt symlinks --- stage1/00-boot-files/00-run.sh | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) 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 From 0425477d19bf6f8fdfff17b57deafff92029f998 Mon Sep 17 00:00:00 2001 From: Serge Schneider Date: Tue, 23 Jan 2024 13:36:24 +0000 Subject: [PATCH 08/40] stage2: rc.local drop-in no longer required, since Debian ships its own version --- stage2/01-sys-tweaks/01-run.sh | 3 --- stage2/01-sys-tweaks/files/ttyoutput.conf | 2 -- 2 files changed, 5 deletions(-) delete mode 100644 stage2/01-sys-tweaks/files/ttyoutput.conf 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 From c20ce09facaaadcc480a7bbda4fe100fcacdee12 Mon Sep 17 00:00:00 2001 From: Serge Schneider Date: Tue, 30 Jan 2024 14:43:13 +0000 Subject: [PATCH 09/40] export-image: make sure initramfs is created Fixes #749 --- export-image/05-finalise/01-run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 69037ce9fe9abe51cc6510971b3fb307745b1ef9 Mon Sep 17 00:00:00 2001 From: Tom Dewey <146750643+tdewey-rpi@users.noreply.github.com> Date: Mon, 19 Feb 2024 14:32:58 +0000 Subject: [PATCH 10/40] Update README.md (#755) Remove references to 'Raspbian', and instead refer to 'Raspberry Pi OS'. Additionally, a first pass of editing for conciseness. Replace bookworm instructions with bullseye --- README.md | 90 ++++++++++++++++++++++++++----------------------------- 1 file changed, 42 insertions(+), 48 deletions(-) diff --git a/README.md b/README.md index 2fdb65e..e19b2b3 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,18 @@ # pi-gen -Tool used to create Raspberry Pi OS images. (Previously known as Raspbian). +Tool used to create Raspberry Pi OS images, and custom images based on Raspberry Pi OS, +which was in turn derived from the Raspbian project. +**Note**: Raspberry Pi OS 32 bit images are based primarily on Raspbian, while +Raspberry Pi OS 64 bit images are based primarily on Debian. ## Dependencies -pi-gen runs on Debian-based operating systems. Currently it is only supported on -either Debian Buster or Ubuntu Xenial and is known to have issues building on -earlier releases of these systems. On other Linux distributions it may be possible -to use the Docker build described below. +pi-gen runs on Debian-based operating systems released after 2017, and we +always advise you use the latest OS for security reasons. + +On other Linux distributions it may be possible to use the Docker build described +below. To install the required dependencies for `pi-gen` you should run: @@ -50,17 +54,16 @@ The following environment variables are supported: * `IMG_NAME` **required** (Default: unset) - The name of the image to build with the current stage directories. Setting - `IMG_NAME=Raspbian` is logical for an unmodified RPi-Distro/pi-gen build, - but you should use something else for a customized version. Export files - in stages may add suffixes to `IMG_NAME`. + The name of the image to build with the current stage directories. Use this + variable to set the root name of your OS, eg `IMG_NAME=Frobulator`. + Export files in stages may add suffixes to `IMG_NAME`. * `PI_GEN_RELEASE` (Default: `Raspberry Pi reference`) The release name to use in `/etc/issue.txt`. The default should only be used for official Raspberry Pi builds. -* `USE_QCOW2` **EXPERIMENTAL** (Default: `0` ) + * `USE_QCOW2` **EXPERIMENTAL** (Default: `0` ) Instead of using traditional way of building the rootfs of every stage in single subdirectories and copying over the previous one to the next one, @@ -73,14 +76,12 @@ The following environment variables are supported: * `BASE_QCOW2_SIZE` (Default: 12G) Size of the virtual qcow2 disk. - Note: it will not actually use that much of space at once but defines the - maximum size of the virtual disk. If you change the build process by adding - a lot of bigger packages or additional build stages, it can be necessary to - increase the value because the virtual disk can run out of space like a normal - hard drive would. - - **CAUTION:** Although the qcow2 build mechanism will run fine inside Docker, it can happen - that the network block device is not disconnected correctly after the Docker process has + Note: This is a maximum size - not a guaranteed allocation size. You may need + to increase the default size if you are building a particularly full image, containing + many packages or pre-built artefacts. + + **CAUTION:** Although the qcow2 build mechanism will run inside Docker, there is a known issue + where the network block device is not disconnected correctly after the Docker process has ended abnormally. In that case see [Disconnect an image if something went wrong](#Disconnect-an-image-if-something-went-wrong) * `RELEASE` (Default: bookworm) @@ -89,7 +90,7 @@ The following environment variables are supported: Debian release. However, since different releases will have different sets of packages available, you'll need to either modify your stages accordingly, or checkout the appropriate branch. For example, if you'd like to build a - `buster` image, you should do so from the `buster` branch. + `bullseye` image, you should do so from the `bullseye` branch. * `APT_PROXY` (Default: unset) @@ -231,10 +232,10 @@ The following environment variables are supported: If set, then instead of working through the numeric stages in order, this list will be followed. For example setting to `"stage0 stage1 mystage stage2"` will run the contents of `mystage` before stage2. Note that quotes are needed around the list. An absolute or relative path can be given for stages outside the pi-gen directory. -A simple example for building Raspbian: +A simple example for building Raspberry Pi OS: ```bash -IMG_NAME='Raspbian' +IMG_NAME='raspios' ``` The config file can also be specified on the command line as an argument the `build.sh` or `build-docker.sh` scripts. @@ -249,17 +250,17 @@ This is parsed after `config` so can be used to override values set there. The following process is followed to build images: - * Loop through all of the stage directories in alphanumeric order + * Interate through all of the stage directories in alphanumeric order - * Move on to the next directory if this stage directory contains a file called + * Bypass a stage directory if it contains a file called "SKIP" * Run the script ```prerun.sh``` which is generally just used to copy the build directory between stages. - * In each stage directory loop through each subdirectory and then run each of the - install scripts it contains, again in alphanumeric order. These need to be named - with a two digit padded number at the beginning. + * In each stage directory iterate through each subdirectory and then run each of the + install scripts it contains, again in alphanumeric order. **These need to be named + with a two digit padded number at the beginning.** There are a number of different files and directories which can be used to control different parts of the build process: @@ -294,7 +295,7 @@ It is recommended to examine build.sh for finer details. Docker can be used to perform the build inside a container. This partially isolates the build from the host system, and allows using the script on non-debian based -systems (e.g. Fedora Linux). The isolate is not complete due to the need to use +systems (e.g. Fedora Linux). The isolation is not complete due to the need to use some kernel level services for arm emulation (binfmt) and loop devices (losetup). To build: @@ -307,7 +308,7 @@ vi config # Edit your config file. See above. If everything goes well, your finished image will be in the `deploy/` folder. You can then remove the build container with `docker rm -v pigen_work` -If something breaks along the line, you can edit the corresponding scripts, and +If you encounter errors during the build, you can edit the corresponding scripts, and continue: ```bash @@ -351,43 +352,36 @@ maintenance and allows for more easy customization. `debootstrap`, which creates a minimal filesystem suitable for use as a base.tgz on Debian systems. This stage also configures apt settings and installs `raspberrypi-bootloader` which is missed by debootstrap. The - minimal core is installed but not configured, and the system will not quite - boot yet. + minimal core is installed but not configured. As a result, this stage will not boot. - **Stage 1** - truly minimal system. This stage makes the system bootable by installing system files like `/etc/fstab`, configures the bootloader, makes the network operable, and installs packages like raspi-config. At this stage the system should boot to a local console from which you have the means to perform basic tasks needed to configure and install the system. - This is as minimal as a system can possibly get, and its arguably not - really usable yet in a traditional sense yet. Still, if you want minimal, - this is minimal and the rest you could reasonably do yourself as sysadmin. - - **Stage 2** - lite system. This stage produces the Raspbian-Lite image. It - installs some optimized memory functions, sets timezone and charmap + - **Stage 2** - lite system. This stage produces the Raspberry Pi OS Lite image. + Stage 2 installs some optimized memory functions, sets timezone and charmap defaults, installs fake-hwclock and ntp, wireless LAN and bluetooth support, dphys-swapfile, and other basics for managing the hardware. It also creates necessary groups and gives the pi user access to sudo and the standard console hardware permission groups. - There are a few tools that may not make a whole lot of sense here for - development purposes on a minimal system such as basic Python and Lua - packages as well as the `build-essential` package. They are lumped right - in with more essential packages presently, though they need not be with - pi-gen. These are understandable for Raspbian's target audience, but if - you were looking for something between truly minimal and Raspbian-Lite, - here's where you start trimming. + Note: Raspberry Pi OS Lite contains a number of tools for development, + including `Python`, `Lua` and the `build-essential` package. If you are + creating an image to deploy in products, be sure to remove extraneous development + tools before deployment. - **Stage 3** - desktop system. Here's where you get the full desktop system - with X11 and LXDE, web browsers, git for development, Raspbian custom UI + with X11 and LXDE, web browsers, git for development, Raspberry Pi OS custom UI enhancements, etc. This is a base desktop system, with some development tools installed. - - **Stage 4** - Normal Raspbian image. System meant to fit on a 4GB card. This is the - stage that installs most things that make Raspbian friendly to new - users like system documentation. + - **Stage 4** - Normal Raspberry Pi OS image. System meant to fit on a 4GB card. + This is the stage that installs most things that make Raspberry Pi OS friendly + to new users - e.g. system documentation. - - **Stage 5** - The Raspbian Full image. More development + - **Stage 5** - The Raspberry Pi OS Full image. More development tools, an email client, learning tools like Scratch, specialized packages like sonic-pi, office productivity, etc. @@ -402,7 +396,7 @@ to `./stage2` (if building a minimal system). ```bash # Example for building a lite system -echo "IMG_NAME='Raspbian'" > config +echo "IMG_NAME='raspios'" > config touch ./stage3/SKIP ./stage4/SKIP ./stage5/SKIP touch ./stage4/SKIP_IMAGES ./stage5/SKIP_IMAGES sudo ./build.sh # or ./build-docker.sh From 502e5fa0e3e1342ac7eedaea964b40ec55d7adb4 Mon Sep 17 00:00:00 2001 From: Mark Spatz Date: Thu, 22 Feb 2024 23:19:10 -0500 Subject: [PATCH 11/40] Remove QCOW2 build mechanism (#648) --- Dockerfile | 2 +- README.md | 88 +-------- build-docker.sh | 3 - build.sh | 131 +------------ depends | 2 - export-image/04-set-partuuid/00-run.sh | 18 +- export-image/05-finalise/01-run.sh | 23 +-- export-image/prerun.sh | 104 +++++----- export-noobs/00-release/00-run.sh | 6 +- export-noobs/prerun.sh | 4 - imagetool.sh | 114 ----------- scripts/qcow2_handling | 256 ------------------------- stage0/prerun.sh | 2 +- 13 files changed, 78 insertions(+), 675 deletions(-) delete mode 100755 imagetool.sh delete mode 100644 scripts/qcow2_handling diff --git a/Dockerfile b/Dockerfile index 2a5d8fe..673f756 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,7 @@ RUN apt-get -y update && \ 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\ + binfmt-support ca-certificates fdisk gpg pigz\ && rm -rf /var/lib/apt/lists/* COPY . /pi-gen/ diff --git a/README.md b/README.md index e19b2b3..3529770 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ To install the required dependencies for `pi-gen` you should run: ```bash apt-get install coreutils quilt parted qemu-user-static debootstrap zerofree zip \ dosfstools libarchive-tools libcap2-bin grep rsync xz-utils file git curl bc \ -qemu-utils kpartx gpg pigz +gpg pigz ``` The file `depends` contains a list of tools needed. The format of this @@ -63,27 +63,6 @@ The following environment variables are supported: The release name to use in `/etc/issue.txt`. The default should only be used for official Raspberry Pi builds. - * `USE_QCOW2` **EXPERIMENTAL** (Default: `0` ) - - Instead of using traditional way of building the rootfs of every stage in - single subdirectories and copying over the previous one to the next one, - qcow2 based virtual disks with backing images are used in every stage. - This speeds up the build process and reduces overall space consumption - significantly. - - Additional optional parameters regarding qcow2 build: - - * `BASE_QCOW2_SIZE` (Default: 12G) - - Size of the virtual qcow2 disk. - Note: This is a maximum size - not a guaranteed allocation size. You may need - to increase the default size if you are building a particularly full image, containing - many packages or pre-built artefacts. - - **CAUTION:** Although the qcow2 build mechanism will run inside Docker, there is a known issue - where the network block device is not disconnected correctly after the Docker process has - ended abnormally. In that case see [Disconnect an image if something went wrong](#Disconnect-an-image-if-something-went-wrong) - * `RELEASE` (Default: bookworm) The release version to build images against. Valid values are any supported @@ -423,71 +402,6 @@ follows: * Once you're happy with the image you can remove the SKIP_IMAGES files and export your image to test -# Regarding Qcow2 image building - -### Get infos about the image in use - -If you issue the two commands shown in the example below in a second command shell while a build -is running you can find out, which network block device is currently being used and which qcow2 image -is bound to it. - -Example: - -```bash -root@build-machine:~/$ lsblk | grep nbd -nbd1 43:32 0 10G 0 disk -├─nbd1p1 43:33 0 10G 0 part -└─nbd1p1 253:0 0 10G 0 part - -root@build-machine:~/$ ps xa | grep qemu-nbd - 2392 pts/6 S+ 0:00 grep --color=auto qemu-nbd -31294 ? Ssl 0:12 qemu-nbd --discard=unmap -c /dev/nbd1 image-stage4.qcow2 -``` - -Here you can see, that the qcow2 image `image-stage4.qcow2` is currently connected to `/dev/nbd1` with -the associated partition map `/dev/mapper/nbd1p1`. Don't worry that `lsblk` shows two entries. It is totally fine, because the device map is accessible via `/dev/mapper/nbd1p1` and also via `/dev/dm-0`. This is all part of the device mapper functionality of the kernel. See `dmsetup` for further information. - -### Mount a qcow2 image - -If you want to examine the content of a a single stage, you can simply mount the qcow2 image found in the `WORK_DIR` directory with the tool `./imagetool.sh`. - -See `./imagetool.sh -h` for further details on how to use it. - -### Disconnect an image if something went wrong - -It can happen, that your build stops in case of an error. Normally `./build.sh` should handle image disconnection appropriately, but in rare cases, especially during a Docker build, this may not work as expected. If that happens, starting a new build will fail and you may have to disconnect the image and/or device yourself. - -A typical message indicating that there are some orphaned device mapper entries is this: - -``` -Failed to set NBD socket -Disconnect client, due to: Unexpected end-of-file before all bytes were read -``` - -If that happens go through the following steps: - -1. First, check if the image is somehow mounted to a directory entry and umount it as you would any other block device, like i.e. a hard disk or USB stick. - -2. Second, to disconnect an image from `qemu-nbd`, the QEMU Disk Network Block Device Server, issue the following command (be sure to change the device name to the one actually used): - - ```bash - sudo qemu-nbd -d /dev/nbd1 - ``` - - Note: if you use Docker build, normally no active `qemu-nbd` process exists anymore as it will be terminated when the Docker container stops. - -3. To disconnect a device partition map from the network block device, execute: - - ```bash - sudo kpartx -d /dev/nbd1 - or - sudo ./imagetool.sh --cleanup - ``` - - Note: The `imagetool.sh` command will cleanup any /dev/nbdX that is not connected to a running `qemu-nbd` daemon. Be careful if you use network block devices for other tasks utilizing NBDs on your build machine as well. - -Now you should be able to start a new build without running into troubles again. Most of the time, especially when using Docker build, you will only need no. 3 to get everything up and running again. - # Troubleshooting ## `64 Bit Systems` diff --git a/build-docker.sh b/build-docker.sh index 83e76a5..41e341f 100755 --- a/build-docker.sh +++ b/build-docker.sh @@ -144,9 +144,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}" \ diff --git a/build.sh b/build.sh index 7d7bc40..f34adfc 100755 --- a/build.sh +++ b/build.sh @@ -23,11 +23,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 @@ -38,11 +33,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 @@ -99,16 +89,7 @@ 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 @@ -116,7 +97,7 @@ run_stage(){ 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 @@ -133,14 +114,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}" @@ -184,10 +158,7 @@ do done term() { - if [ "${USE_QCOW2}" = "1" ]; then - log "Unloading image" - unload_qimage - fi + true; #TODO: Cleanup } trap term EXIT INT TERM @@ -270,18 +241,6 @@ 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 @@ -336,98 +295,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}" diff --git a/depends b/depends index db88171..10fcdd4 100644 --- a/depends +++ b/depends @@ -17,7 +17,5 @@ file git lsmod:kmod bc -qemu-nbd:qemu-utils -kpartx gpg pigz diff --git a/export-image/04-set-partuuid/00-run.sh b/export-image/04-set-partuuid/00-run.sh index 2694295..99500f3 100755 --- a/export-image/04-set-partuuid/00-run.sh +++ b/export-image/04-set-partuuid/00-run.sh @@ -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" diff --git a/export-image/05-finalise/01-run.sh b/export-image/05-finalise/01-run.sh index 3b56b20..8310e87 100755 --- a/export-image/05-finalise/01-run.sh +++ b/export-image/05-finalise/01-run.sh @@ -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="$(mount | grep "${ROOTFS_DIR} " | cut -f1 -d' ')" -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) @@ -121,3 +114,5 @@ none | *) cp "$IMG_FILE" "$DEPLOY_DIR/" ;; esac + +cp "$INFO_FILE" "$DEPLOY_DIR/" diff --git a/export-image/prerun.sh b/export-image/prerun.sh index d042c6a..b95fe36 100755 --- a/export-image/prerun.sh +++ b/export-image/prerun.sh @@ -1,68 +1,66 @@ #!/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" - unmount_image "${IMG_FILE}" +unmount_image "${IMG_FILE}" - rm -f "${IMG_FILE}" +rm -f "${IMG_FILE}" - rm -rf "${ROOTFS_DIR}" - mkdir -p "${ROOTFS_DIR}" +rm -rf "${ROOTFS_DIR}" +mkdir -p "${ROOTFS_DIR}" - BOOT_SIZE="$((512 * 1024 * 1024))" - ROOT_SIZE=$(du --apparent-size -s "${EXPORT_ROOTFS_DIR}" --exclude var/cache/apt/archives --exclude boot/firmware --block-size=1 | cut -f 1) +BOOT_SIZE="$((512 * 1024 * 1024))" +ROOT_SIZE=$(du --apparent-size -s "${EXPORT_ROOTFS_DIR}" --exclude var/cache/apt/archives --exclude boot/firmware --block-size=1 | cut -f 1) - # All partition sizes and starts will be aligned to this size - ALIGN="$((4 * 1024 * 1024))" - # Add this much space to the calculated file size. This allows for - # some overhead (since actual space usage is usually rounded up to the - # filesystem block size) and gives some free space on the resulting - # image. - ROOT_MARGIN="$(echo "($ROOT_SIZE * 0.2 + 200 * 1024 * 1024) / 1" | bc)" +# All partition sizes and starts will be aligned to this size +ALIGN="$((4 * 1024 * 1024))" +# Add this much space to the calculated file size. This allows for +# some overhead (since actual space usage is usually rounded up to the +# filesystem block size) and gives some free space on the resulting +# image. +ROOT_MARGIN="$(echo "($ROOT_SIZE * 0.2 + 200 * 1024 * 1024) / 1" | bc)" - BOOT_PART_START=$((ALIGN)) - BOOT_PART_SIZE=$(((BOOT_SIZE + ALIGN - 1) / ALIGN * ALIGN)) - ROOT_PART_START=$((BOOT_PART_START + BOOT_PART_SIZE)) - ROOT_PART_SIZE=$(((ROOT_SIZE + ROOT_MARGIN + ALIGN - 1) / ALIGN * ALIGN)) - IMG_SIZE=$((BOOT_PART_START + BOOT_PART_SIZE + ROOT_PART_SIZE)) +BOOT_PART_START=$((ALIGN)) +BOOT_PART_SIZE=$(((BOOT_SIZE + ALIGN - 1) / ALIGN * ALIGN)) +ROOT_PART_START=$((BOOT_PART_START + BOOT_PART_SIZE)) +ROOT_PART_SIZE=$(((ROOT_SIZE + ROOT_MARGIN + ALIGN - 1) / ALIGN * ALIGN)) +IMG_SIZE=$((BOOT_PART_START + BOOT_PART_SIZE + ROOT_PART_SIZE)) - truncate -s "${IMG_SIZE}" "${IMG_FILE}" +truncate -s "${IMG_SIZE}" "${IMG_FILE}" - parted --script "${IMG_FILE}" mklabel msdos - parted --script "${IMG_FILE}" unit B mkpart primary fat32 "${BOOT_PART_START}" "$((BOOT_PART_START + BOOT_PART_SIZE - 1))" - parted --script "${IMG_FILE}" unit B mkpart primary ext4 "${ROOT_PART_START}" "$((ROOT_PART_START + ROOT_PART_SIZE - 1))" +parted --script "${IMG_FILE}" mklabel msdos +parted --script "${IMG_FILE}" unit B mkpart primary fat32 "${BOOT_PART_START}" "$((BOOT_PART_START + BOOT_PART_SIZE - 1))" +parted --script "${IMG_FILE}" unit B mkpart primary ext4 "${ROOT_PART_START}" "$((ROOT_PART_START + ROOT_PART_SIZE - 1))" - echo "Creating loop device..." - cnt=0 - until ensure_next_loopdev && LOOP_DEV="$(losetup --show --find --partscan "$IMG_FILE")"; do - if [ $cnt -lt 5 ]; then - cnt=$((cnt + 1)) - echo "Error in losetup. Retrying..." - sleep 5 - else - echo "ERROR: losetup failed; exiting" - exit 1 - fi - done - - ensure_loopdev_partitions "$LOOP_DEV" - BOOT_DEV="${LOOP_DEV}p1" - ROOT_DEV="${LOOP_DEV}p2" - - ROOT_FEATURES="^huge_file" - for FEATURE in 64bit; do - if grep -q "$FEATURE" /etc/mke2fs.conf; then - ROOT_FEATURES="^$FEATURE,$ROOT_FEATURES" +echo "Creating loop device..." +cnt=0 +until ensure_next_loopdev && LOOP_DEV="$(losetup --show --find --partscan "$IMG_FILE")"; do + if [ $cnt -lt 5 ]; then + cnt=$((cnt + 1)) + echo "Error in losetup. Retrying..." + sleep 5 + else + echo "ERROR: losetup failed; exiting" + exit 1 fi - done - mkdosfs -n bootfs -F 32 -s 4 -v "$BOOT_DEV" > /dev/null - mkfs.ext4 -L rootfs -O "$ROOT_FEATURES" "$ROOT_DEV" > /dev/null +done - mount -v "$ROOT_DEV" "${ROOTFS_DIR}" -t ext4 - mkdir -p "${ROOTFS_DIR}/boot/firmware" - mount -v "$BOOT_DEV" "${ROOTFS_DIR}/boot/firmware" -t vfat +ensure_loopdev_partitions "$LOOP_DEV" +BOOT_DEV="${LOOP_DEV}p1" +ROOT_DEV="${LOOP_DEV}p2" - rsync -aHAXx --exclude /var/cache/apt/archives --exclude /boot/firmware "${EXPORT_ROOTFS_DIR}/" "${ROOTFS_DIR}/" - rsync -rtx "${EXPORT_ROOTFS_DIR}/boot/firmware/" "${ROOTFS_DIR}/boot/firmware/" +ROOT_FEATURES="^huge_file" +for FEATURE in 64bit; do +if grep -q "$FEATURE" /etc/mke2fs.conf; then + ROOT_FEATURES="^$FEATURE,$ROOT_FEATURES" fi +done +mkdosfs -n bootfs -F 32 -s 4 -v "$BOOT_DEV" > /dev/null +mkfs.ext4 -L rootfs -O "$ROOT_FEATURES" "$ROOT_DEV" > /dev/null + +mount -v "$ROOT_DEV" "${ROOTFS_DIR}" -t ext4 +mkdir -p "${ROOTFS_DIR}/boot/firmware" +mount -v "$BOOT_DEV" "${ROOTFS_DIR}/boot/firmware" -t vfat + +rsync -aHAXx --exclude /var/cache/apt/archives --exclude /boot/firmware "${EXPORT_ROOTFS_DIR}/" "${ROOTFS_DIR}/" +rsync -rtx "${EXPORT_ROOTFS_DIR}/boot/firmware/" "${ROOTFS_DIR}/boot/firmware/" diff --git a/export-noobs/00-release/00-run.sh b/export-noobs/00-release/00-run.sh index bfaea9f..513cbfd 100755 --- a/export-noobs/00-release/00-run.sh +++ b/export-noobs/00-release/00-run.sh @@ -41,8 +41,4 @@ sed "${NOOBS_DIR}/os.json" -i -e "s|KERNEL|$(cat "${STAGE_WORK_DIR}/kernel_versi sed "${NOOBS_DIR}/release_notes.txt" -i -e "s|UNRELEASED|${IMG_DATE}|" -if [ "${USE_QCOW2}" = "1" ]; then - mv "${NOOBS_DIR}" "${DEPLOY_DIR}/" -else - cp -a "${NOOBS_DIR}" "${DEPLOY_DIR}/" -fi +cp -a "${NOOBS_DIR}" "${DEPLOY_DIR}/" diff --git a/export-noobs/prerun.sh b/export-noobs/prerun.sh index 80cbb8e..8e55c9e 100755 --- a/export-noobs/prerun.sh +++ b/export-noobs/prerun.sh @@ -41,8 +41,4 @@ bsdtar --numeric-owner --format gnutar -C "${STAGE_WORK_DIR}/rootfs/boot" -cpf - umount "${STAGE_WORK_DIR}/rootfs/boot" bsdtar --numeric-owner --format gnutar -C "${STAGE_WORK_DIR}/rootfs" --one-file-system -cpf - . | xz -T0 > "${NOOBS_DIR}/root.tar.xz" -if [ "${USE_QCOW2}" = "1" ]; then - rm "$ROOTFS_DIR/etc/systemd/system/multi-user.target.wants/apply_noobs_os_config.service" -fi - unmount_image "${IMG_FILE}" diff --git a/imagetool.sh b/imagetool.sh deleted file mode 100755 index 002b50b..0000000 --- a/imagetool.sh +++ /dev/null @@ -1,114 +0,0 @@ -#!/bin/bash - -if [ "$(id -u)" != "0" ]; then - echo "Please run as root" 1>&2 - exit 1 -fi - -progname=$(basename $0) - -function usage() -{ - cat << HEREDOC - -Usage: - Mount Image : $progname [--mount] [--image-name ] [--mount-point ] - Umount Image: $progname [--umount] [--mount-point ] - Cleanup NBD : $progname [--cleanup] - - arguments: - -h, --help show this help message and exit - -c, --cleanup cleanup orphaned device mappings - -m, --mount mount image - -u, --umount umount image - -i, --image-name path to qcow2 image - -p, --mount-point mount point for image - - This tool will use /dev/nbd1 as default for mounting an image. If you want to use another device, execute like this: - NBD_DEV=/dev/nbd2 ./$progname --mount --image-name --mount-point - -HEREDOC -} - -MOUNT=0 -UMOUNT=0 -IMAGE="" -MOUNTPOINT="" - -nbd_cleanup() { - DEVS="$(lsblk | grep nbd | grep disk | cut -d" " -f1)" - if [ ! -z "${DEVS}" ]; then - for d in $DEVS; do - if [ ! -z "${d}" ]; then - QDEV="$(ps xa | grep $d | grep -v grep)" - if [ -z "${QDEV}" ]; then - kpartx -d /dev/$d && echo "Unconnected device map removed: /dev/$d" - fi - fi - done - fi -} - -# As long as there is at least one more argument, keep looping -while [[ $# -gt 0 ]]; do - key="$1" - case "$key" in - -h|--help) - usage - exit - ;; - -c|--cleanup) - nbd_cleanup - ;; - -m|--mount) - MOUNT=1 - ;; - -u|--umount) - UMOUNT=1 - ;; - -i|--image-name) - shift - IMAGE="$1" - ;; - -p|--mount-point) - shift - MOUNTPOINT="$1" - ;; - *) - echo "Unknown option '$key'" - usage - exit - ;; - esac - # Shift after checking all the cases to get the next option - shift -done - -if [ "${MOUNT}" = "1" ] && [ "${UMOUNT}" = "1" ]; then - usage - echo "Concurrent mount options not possible." - exit -fi - -if [ "${MOUNT}" = "1" ] && ([ -z "${IMAGE}" ] || [ -z "${MOUNTPOINT}" ]); then - usage - echo "Can not mount image. Image path and/or mount point missing." - exit -fi - -if [ "${UMOUNT}" = "1" ] && [ -z "${MOUNTPOINT}" ]; then - usage - echo "Can not umount. Mount point parameter missing." - exit -fi - -export NBD_DEV="${NBD_DEV:-/dev/nbd1}" -export MAP_BOOT_DEV=/dev/mapper/nbd1p1 -export MAP_ROOT_DEV=/dev/mapper/nbd1p2 -source scripts/qcow2_handling - -if [ "${MOUNT}" = "1" ]; then - mount_qimage "${IMAGE}" "${MOUNTPOINT}" -elif [ "${UMOUNT}" = "1" ]; then - umount_qimage "${MOUNTPOINT}" -fi diff --git a/scripts/qcow2_handling b/scripts/qcow2_handling deleted file mode 100644 index 66708e7..0000000 --- a/scripts/qcow2_handling +++ /dev/null @@ -1,256 +0,0 @@ -#!/bin/bash - -# QCOW2 Routines - -export CURRENT_IMAGE -export CURRENT_MOUNTPOINT - -export NBD_DEV -export MAP_BOOT_DEV -export MAP_ROOT_DEV - -# set in build.sh -# should be fairly enough for the beginning -# overwrite here by uncommenting following lines -# BASE_QCOW2_SIZE=12G - -# find and initialize free block device nodes -init_nbd() { - modprobe nbd max_part=16 - if [ -z "${NBD_DEV}" ]; then - for x in /sys/class/block/nbd* ; do - S=`cat $x/size` - if [ "$S" == "0" ] ; then - NBD_DEV=/dev/$(basename $x) - MAP_BOOT_DEV=/dev/mapper/$(basename $x)p1 - MAP_ROOT_DEV=/dev/mapper/$(basename $x)p2 - break - fi - done - fi -} -export -f init_nbd - -# connect image to block device -connect_blkdev() { - init_nbd - qemu-nbd --discard=unmap -c $NBD_DEV "$1" - sync - kpartx -as $NBD_DEV - sync - CURRENT_IMAGE="$1" -} -export -f connect_blkdev - -# disconnect image from block device -disconnect_blkdev() { - kpartx -d $NBD_DEV - qemu-nbd -d $NBD_DEV - NBD_DEV= - MAP_BOOT_DEV= - MAP_ROOT_DEV= - CURRENT_IMAGE= -} -export -f disconnect_blkdev - -# mount qcow2 image: mount_image -mount_qimage() { - connect_blkdev "$1" - mount -v -t ext4 $MAP_ROOT_DEV "$2" - mkdir -p "${ROOTFS_DIR}/boot" - mount -v -t vfat $MAP_BOOT_DEV "$2/boot" - CURRENT_MOUNTPOINT="$2" -} -export -f mount_qimage - -# umount qcow2 image: umount_image -umount_qimage() { - sync - #umount "$1/boot" - while mount | grep -q "$1"; do - local LOCS - LOCS=$(mount | grep "$1" | cut -f 3 -d ' ' | sort -r) - for loc in $LOCS; do - echo "$loc" - while mountpoint -q "$loc" && ! umount "$loc"; do - sleep 0.1 - done - done - done - CURRENT_MOUNTPOINT= - disconnect_blkdev -} -export -f umount_qimage - -# create base image / backing image / mount image -load_qimage() { - if [ -z "${CURRENT_MOUNTPOINT}" ]; then - if [ ! -d "${ROOTFS_DIR}" ]; then - mkdir -p "${ROOTFS_DIR}"; - fi - - if [ "${CLEAN}" = "1" ] && [ -f "${WORK_DIR}/image-${STAGE}.qcow2" ]; then - rm -f "${WORK_DIR}/image-${STAGE}.qcow2"; - fi - - if [ ! -f "${WORK_DIR}/image-${STAGE}.qcow2" ]; then - pushd ${WORK_DIR} > /dev/null - init_nbd - if [ -z "${PREV_STAGE}" ]; then - echo "Creating base image: image-${STAGE}.qcow2" - # -o preallocation=falloc - qemu-img create -f qcow2 image-${STAGE}.qcow2 $BASE_QCOW2_SIZE - sync - qemu-nbd --discard=unmap -c $NBD_DEV image-${STAGE}.qcow2 - sync - sfdisk $NBD_DEV << EOF -4MiB,250MiB,c,* -254MiB,,83; -EOF - sync - kpartx -as $NBD_DEV - mkdosfs -n boot -F 32 -s 4 -v $MAP_BOOT_DEV - mkfs.ext4 -L rootfs -O "^huge_file,^64bit" $MAP_ROOT_DEV - sync - else - if [ ! -f "${WORK_DIR}/image-${PREV_STAGE}.qcow2" ]; then - exit 1; - fi - echo "Creating backing image: image-${STAGE}.qcow2 <- ${WORK_DIR}/image-${PREV_STAGE}.qcow2" - qemu-img create -f qcow2 \ - -o backing_file=${WORK_DIR}/image-${PREV_STAGE}.qcow2 \ - ${WORK_DIR}/image-${STAGE}.qcow2 - sync - qemu-nbd --discard=unmap -c $NBD_DEV image-${STAGE}.qcow2 - sync - kpartx -as $NBD_DEV - fi - - mount -v -t ext4 $MAP_ROOT_DEV "${ROOTFS_DIR}" - mkdir -p "${ROOTFS_DIR}/boot" - mount -v -t vfat $MAP_BOOT_DEV "${ROOTFS_DIR}/boot" - CURRENT_IMAGE=${WORK_DIR}/image-${STAGE}.qcow2 - CURRENT_MOUNTPOINT=${ROOTFS_DIR} - popd > /dev/null - else - mount_qimage "${WORK_DIR}/image-${STAGE}.qcow2" "${ROOTFS_DIR}" - fi - echo "Current image in use: ${CURRENT_IMAGE} (MP: ${CURRENT_MOUNTPOINT})" - fi -} -export -f load_qimage - -# umount current image and refresh mount point env var -unload_qimage() { - if [ ! -z "${CURRENT_MOUNTPOINT}" ]; then - fstrim -v "${CURRENT_MOUNTPOINT}" || true - umount_qimage "${CURRENT_MOUNTPOINT}" - fi -} -export -f unload_qimage - -# based on: https://github.com/SirLagz/RaspberryPi-ImgAutoSizer -# helper function for make_bootable_image, do not call directly -function resize_qcow2() { - if [ -z "$CALL_FROM_MBI" ]; then - echo "resize_qcow2: cannot be called directly, use make_bootable_image instead" - return 1 - fi - - # ROOT_MARGIN=$((800*1024*1024)) - ROOT_MARGIN=$((1*1024*1024)) - PARTED_OUT=`parted -s -m "$NBD_DEV" unit B print` - PART_NO=`echo "$PARTED_OUT" | grep ext4 | awk -F: ' { print $1 } '` - PART_START=`echo "$PARTED_OUT" | grep ext4 | awk -F: ' { print substr($2,1,length($2)-1) } '` - - e2fsck -y -f $MAP_ROOT_DEV || true - - DATA_SIZE=`resize2fs -P $MAP_ROOT_DEV | awk -F': ' ' { print $2 } '` - BLOCK_SIZE=$(dumpe2fs -h $MAP_ROOT_DEV | grep 'Block size' | awk -F': ' ' { print $2 }') - BLOCK_SIZE=${BLOCK_SIZE// /} - - let DATA_SIZE=$DATA_SIZE+$ROOT_MARGIN/$BLOCK_SIZE - resize2fs -p $MAP_ROOT_DEV $DATA_SIZE - sleep 1 - - let PART_NEW_SIZE=$DATA_SIZE*$BLOCK_SIZE - let PART_NEW_END=$PART_START+$PART_NEW_SIZE - ACT1=`parted -s "$NBD_DEV" rm 2` - ACT2=`parted -s "$NBD_DEV" unit B mkpart primary $PART_START $PART_NEW_END` - NEW_IMG_SIZE=`parted -s -m "$NBD_DEV" unit B print free | tail -1 | awk -F: ' { print substr($2,1,length($2)-1) } '` -} -export -f resize_qcow2 - -# create raw img from qcow2: make_bootable_image -function make_bootable_image() { - - EXPORT_QCOW2="$1" - EXPORT_IMAGE="$2" - - echo "Connect block device to source qcow2" - connect_blkdev "${EXPORT_QCOW2}" - - echo "Resize fs and partition" - CALL_FROM_MBI=1 - resize_qcow2 - sync - CALL_FROM_MBI= - - echo "Disconnect block device" - disconnect_blkdev - - if [ -z "$NEW_IMG_SIZE" ]; then - echo "NEW_IMG_SIZE could not be calculated, cannot process image. Exit." - exit 1 - fi - - echo "Shrinking qcow2 image" - qemu-img resize --shrink "${EXPORT_QCOW2}" $NEW_IMG_SIZE - sync - - echo "Convert qcow2 to raw image" - qemu-img convert -f qcow2 -O raw "${EXPORT_QCOW2}" "${EXPORT_IMAGE}" - sync - - echo "Get PARTUUIDs from image" - IMGID="$(blkid -o value -s PTUUID "${EXPORT_IMAGE}")" - - BOOT_PARTUUID="${IMGID}-01" - echo "Boot: $BOOT_PARTUUID" - ROOT_PARTUUID="${IMGID}-02" - echo "Root: $ROOT_PARTUUID" - - echo "Mount image" - MOUNTROOT=${WORK_DIR}/tmpimage - mkdir -p $MOUNTROOT - - MOUNTPT=$MOUNTROOT - PARTITION=2 - mount "${EXPORT_IMAGE}" "$MOUNTPT" -o loop,offset=$[ `/sbin/sfdisk -d "${EXPORT_IMAGE}" | grep "start=" | head -n $PARTITION | tail -n1 | sed 's/.*start=[ ]*//' | sed 's/,.*//'` * 512 ],sizelimit=$[ `/sbin/sfdisk -d "${EXPORT_IMAGE}" | grep "start=" | head -n $PARTITION | tail -n1 | sed 's/.*size=[ ]*//' | sed 's/,.*//'` * 512 ] || exit 1 - - MOUNTPT=$MOUNTROOT/boot - PARTITION=1 - mount "${EXPORT_IMAGE}" "$MOUNTPT" -o loop,offset=$[ `/sbin/sfdisk -d "${EXPORT_IMAGE}" | grep "start=" | head -n $PARTITION | tail -n1 | sed 's/.*start=[ ]*//' | sed 's/,.*//'` * 512 ],sizelimit=$[ `/sbin/sfdisk -d "${EXPORT_IMAGE}" | grep "start=" | head -n $PARTITION | tail -n1 | sed 's/.*size=[ ]*//' | sed 's/,.*//'` * 512 ] || exit 1 - - if [ ! -d "${MOUNTROOT}/root" ]; then - echo "Image damaged or not mounted. Exit." - exit 1 - fi - - echo "Setup PARTUUIDs" - if [ ! -z "$BOOT_PARTUUID" ] && [ ! -z "$ROOT_PARTUUID" ]; then - echo "Set UUIDs to make it bootable" - sed -i "s/BOOTDEV/PARTUUID=${BOOT_PARTUUID}/" "${MOUNTROOT}/etc/fstab" - sed -i "s/ROOTDEV/PARTUUID=${ROOT_PARTUUID}/" "${MOUNTROOT}/etc/fstab" - sed -i "s/ROOTDEV/PARTUUID=${ROOT_PARTUUID}/" "${MOUNTROOT}/boot/cmdline.txt" - fi - - echo "Umount image" - sync - umount "${MOUNTROOT}/boot" || exit 1 - umount "${MOUNTROOT}" || exit 1 - - echo "Remove qcow2 export image" - rm -f "${EXPORT_QCOW2}" -} -export -f make_bootable_image diff --git a/stage0/prerun.sh b/stage0/prerun.sh index 0252071..5f0bd2c 100755 --- a/stage0/prerun.sh +++ b/stage0/prerun.sh @@ -5,6 +5,6 @@ if [ "$RELEASE" != "bookworm" ]; then echo " Please check the relevant README.md section." fi -if [ ! -d "${ROOTFS_DIR}" ] || [ "${USE_QCOW2}" = "1" ]; then +if [ ! -d "${ROOTFS_DIR}" ]; then bootstrap ${RELEASE} "${ROOTFS_DIR}" http://raspbian.raspberrypi.com/raspbian/ fi From 94cbf476a57bfc7483d1ce08f2ddbe28e4949ffe Mon Sep 17 00:00:00 2001 From: Serge Schneider Date: Wed, 14 Feb 2024 13:25:42 +0000 Subject: [PATCH 12/40] Create .gitlab-ci.yml file --- .gitlab-ci.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..32f2688 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,4 @@ +include: + - project: serge/pi-gen + ref: ci + file: 'pi-gen.yml' From c029146a132b613f538b1368fd0706cc93fd88b9 Mon Sep 17 00:00:00 2001 From: Serge Schneider Date: Thu, 15 Feb 2024 21:27:39 +0000 Subject: [PATCH 13/40] ensure_loopdev_partitions: let udev settle --- scripts/common | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/common b/scripts/common index cda5551..6150f2b 100644 --- a/scripts/common +++ b/scripts/common @@ -122,5 +122,7 @@ ensure_loopdev_partitions() { mknod "/dev/$partition" b "${majmin%:*}" "${majmin#*:}" fi done + command -v udevadm >/dev/null 2>&1 || return 0 + udevadm settle 10 } export -f ensure_loopdev_partitions From 82e5642ad16453f47fbbaeb11f8b63d4ccf17d81 Mon Sep 17 00:00:00 2001 From: Christian Kuhtz Date: Mon, 26 Feb 2024 06:12:43 -0800 Subject: [PATCH 14/40] README.md: Add xxd dependency (#750) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3529770..136e892 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ To install the required dependencies for `pi-gen` you should run: ```bash apt-get install coreutils quilt parted qemu-user-static debootstrap zerofree zip \ dosfstools libarchive-tools libcap2-bin grep rsync xz-utils file git curl bc \ -gpg pigz +gpg pigz xxd ``` The file `depends` contains a list of tools needed. The format of this From 1ce1f1c913d06485ef5baf17143c1d326ae40d4d Mon Sep 17 00:00:00 2001 From: Serge Schneider Date: Mon, 4 Mar 2024 08:54:17 +0000 Subject: [PATCH 15/40] Replace libcamera-apps with rpicam-apps --- stage2/01-sys-tweaks/00-packages-nr | 2 +- stage3/00-install-packages/00-packages | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/stage2/01-sys-tweaks/00-packages-nr b/stage2/01-sys-tweaks/00-packages-nr index 6bdb600..15c0f66 100644 --- a/stage2/01-sys-tweaks/00-packages-nr +++ b/stage2/01-sys-tweaks/00-packages-nr @@ -1,3 +1,3 @@ cifs-utils -libcamera-apps-lite +rpicam-apps-lite mkvtoolnix diff --git a/stage3/00-install-packages/00-packages b/stage3/00-install-packages/00-packages index 9175bcc..69f8c45 100644 --- a/stage3/00-install-packages/00-packages +++ b/stage3/00-install-packages/00-packages @@ -13,7 +13,7 @@ fonts-liberation2 obconf arandr libcamera-tools -libcamera-apps +rpicam-apps python3-picamera2 python3-pyqt5 python3-opengl From 57c641a64d1ff161cf043b3003fcfe63059eb508 Mon Sep 17 00:00:00 2001 From: Serge Schneider Date: Thu, 7 Mar 2024 23:17:56 +0000 Subject: [PATCH 16/40] Update release notes --- .../00-release/files/release_notes.txt | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/export-noobs/00-release/files/release_notes.txt b/export-noobs/00-release/files/release_notes.txt index d305e33..30afa90 100644 --- a/export-noobs/00-release/files/release_notes.txt +++ b/export-noobs/00-release/files/release_notes.txt @@ -1,4 +1,31 @@ UNRELEASED: + * Added setting of headless resolution to Screen Configuration + * Removed setting of headless resolution for Wayland from Raspberry Pi Configuration + * Improved handling of power button on Raspberry Pi 5 + * Popover windows from taskbar replaced with conventional windows + * Shutdown assistant now closes all user processes when logging out + * Wayvnc updated to improve compatibility with various VNC clients + * Wayvnc now controlled by systemd + * Audio icon on taskbar hidden if no audio devices connected + * Alternative mouse cursor shown during drag-and-drop operations + * raspi-config now allows EEPROM to be upgraded + * Speed improvement when opening bluetooth and network menus + * Tweaks to display of some widgets under dark theme + * Improved compatibility with alternative window managers + * Bug fix - prevent multiple file manager confirm dialogs being overlaid + * Bug fix - drag-and-drop in file manager causing incorrect files to move + * Bug fix - memory leaks in volume and bluetooth menus + * Bug fix - GPU load sometimes not correctly reported in plugin and task manager + * Bug fix - crash when closing windows with non-GTK headerbars + * Bug fix - spurious button hover highlights on touchscreens + * Bug fix - windows on other monitors being hidden from taskbar + * Bug fix - corrected power monitoring brownout detection + * Bug fix - wayfire keyboard layout settings sometimes not loading + * Chromium updated to 122.0.6261.89 + * Firefox updated to 123.0 + * Raspberry Pi firmware 6e0ae774407d68659b50cfbeb9f493ed16718866 + * Linux kernel 6.6.20 - 6f16847710cc0502450788b9f12f0a14d3429668 +2023-12-11: * 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 From 4ce1f1fa8981c4de70a654899781192f2c64adb4 Mon Sep 17 00:00:00 2001 From: Serge Schneider Date: Mon, 11 Mar 2024 14:49:23 +0000 Subject: [PATCH 17/40] stage3: Remove fbturbo --- stage3/00-install-packages/00-packages-nr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stage3/00-install-packages/00-packages-nr b/stage3/00-install-packages/00-packages-nr index 66f3004..bd310cf 100644 --- a/stage3/00-install-packages/00-packages-nr +++ b/stage3/00-install-packages/00-packages-nr @@ -1,4 +1,4 @@ -xserver-xorg-video-fbdev xserver-xorg xinit xserver-xorg-video-fbturbo +xserver-xorg-video-fbdev xserver-xorg xinit mousepad eom lxde lxtask menu-xdg From e8d8670b6c2b5d7e2aa28f410c96e50bd68c2662 Mon Sep 17 00:00:00 2001 From: Serge Schneider Date: Mon, 11 Mar 2024 14:52:14 +0000 Subject: [PATCH 18/40] Update release notes --- export-noobs/00-release/files/release_notes.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/export-noobs/00-release/files/release_notes.txt b/export-noobs/00-release/files/release_notes.txt index 30afa90..b5afa30 100644 --- a/export-noobs/00-release/files/release_notes.txt +++ b/export-noobs/00-release/files/release_notes.txt @@ -21,6 +21,7 @@ UNRELEASED: * Bug fix - windows on other monitors being hidden from taskbar * Bug fix - corrected power monitoring brownout detection * Bug fix - wayfire keyboard layout settings sometimes not loading + * Removed fbturbo xorg video driver as it is no longer useful * Chromium updated to 122.0.6261.89 * Firefox updated to 123.0 * Raspberry Pi firmware 6e0ae774407d68659b50cfbeb9f493ed16718866 From 99e19802c37ec4e1f37cc42bb7f026fb7718226e Mon Sep 17 00:00:00 2001 From: Serge Schneider Date: Wed, 13 Mar 2024 15:14:05 +0000 Subject: [PATCH 19/40] stage4: remove disable-pwr-button substage Desktop is now started with systemd-inhibit --- stage4/07-disable-pwr-button/00-run.sh | 3 --- 1 file changed, 3 deletions(-) delete mode 100755 stage4/07-disable-pwr-button/00-run.sh diff --git a/stage4/07-disable-pwr-button/00-run.sh b/stage4/07-disable-pwr-button/00-run.sh deleted file mode 100755 index 44646bd..0000000 --- a/stage4/07-disable-pwr-button/00-run.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -e - -sed -i 's/^.*HandlePowerKey=.*$/HandlePowerKey=ignore/' "${ROOTFS_DIR}/etc/systemd/logind.conf" From d92bef11f4382498e089c0bd7895a937134f4e53 Mon Sep 17 00:00:00 2001 From: Serge Schneider Date: Wed, 13 Mar 2024 15:44:52 +0000 Subject: [PATCH 20/40] stage4: add meson --- stage4/00-install-packages/00-packages | 3 +++ 1 file changed, 3 insertions(+) diff --git a/stage4/00-install-packages/00-packages b/stage4/00-install-packages/00-packages index 2307752..69b1f8f 100644 --- a/stage4/00-install-packages/00-packages +++ b/stage4/00-install-packages/00-packages @@ -19,3 +19,6 @@ rp-prefapps ffmpeg vlc rpi-imager + +# ninja-build needed for vscode pico extension +meson From b829737d2a07b6f971b1c0d97b6962110cc8c46c Mon Sep 17 00:00:00 2001 From: Serge Schneider Date: Wed, 13 Mar 2024 15:46:00 +0000 Subject: [PATCH 21/40] Update release notes --- export-noobs/00-release/files/release_notes.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/export-noobs/00-release/files/release_notes.txt b/export-noobs/00-release/files/release_notes.txt index b5afa30..d3eab8c 100644 --- a/export-noobs/00-release/files/release_notes.txt +++ b/export-noobs/00-release/files/release_notes.txt @@ -1,4 +1,6 @@ UNRELEASED: + * +2024-03-12: * Added setting of headless resolution to Screen Configuration * Removed setting of headless resolution for Wayland from Raspberry Pi Configuration * Improved handling of power button on Raspberry Pi 5 From 3b5e214f5ec4e23323bdd489b999536c487fcd12 Mon Sep 17 00:00:00 2001 From: Serge Schneider Date: Wed, 13 Mar 2024 18:16:30 +0000 Subject: [PATCH 22/40] export-image: format boot partition with appropriate FAT size --- export-image/prerun.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/export-image/prerun.sh b/export-image/prerun.sh index b95fe36..d9778d1 100755 --- a/export-image/prerun.sh +++ b/export-image/prerun.sh @@ -55,7 +55,14 @@ if grep -q "$FEATURE" /etc/mke2fs.conf; then ROOT_FEATURES="^$FEATURE,$ROOT_FEATURES" fi done -mkdosfs -n bootfs -F 32 -s 4 -v "$BOOT_DEV" > /dev/null + +if [ "$BOOT_SIZE" -lt 134742016 ]; then + FAT_SIZE=16 +else + FAT_SIZE=32 +fi + +mkdosfs -n bootfs -F "$FAT_SIZE" -s 4 -v "$BOOT_DEV" > /dev/null mkfs.ext4 -L rootfs -O "$ROOT_FEATURES" "$ROOT_DEV" > /dev/null mount -v "$ROOT_DEV" "${ROOTFS_DIR}" -t ext4 From af5a88a20a0327a292ff546f1d852c6a31f7dc76 Mon Sep 17 00:00:00 2001 From: Serge Schneider Date: Wed, 13 Mar 2024 19:53:05 +0000 Subject: [PATCH 23/40] stage4: add openocd --- stage4/00-install-packages/00-packages | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stage4/00-install-packages/00-packages b/stage4/00-install-packages/00-packages index 69b1f8f..89fb59a 100644 --- a/stage4/00-install-packages/00-packages +++ b/stage4/00-install-packages/00-packages @@ -20,5 +20,5 @@ ffmpeg vlc rpi-imager -# ninja-build needed for vscode pico extension -meson +# ninja-build and openocd needed for vscode pico extension +meson openocd From 11096428148f0f2be3985ef3126ee71f99c7f1c2 Mon Sep 17 00:00:00 2001 From: Serge Schneider Date: Fri, 15 Mar 2024 14:32:31 +0000 Subject: [PATCH 24/40] Update release notes --- export-noobs/00-release/files/release_notes.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/export-noobs/00-release/files/release_notes.txt b/export-noobs/00-release/files/release_notes.txt index d3eab8c..63aab16 100644 --- a/export-noobs/00-release/files/release_notes.txt +++ b/export-noobs/00-release/files/release_notes.txt @@ -1,5 +1,11 @@ UNRELEASED: - * + * Audio streams will now not be interrupted when other audio devices are connected or disconnected + * Keyboard shortcut to install Orca no longer prompts for password, and will now wait for clock synchronisation rather than failing silently + * Orca screen reader updated to version 45 with various additional small bug fixes + * Obsolete fbturbo video driver removed + * Bug fix - saved display resolution settings not reloading under X + * Raspberry Pi firmware 6e0ae774407d68659b50cfbeb9f493ed16718866 + * Linux kernel 6.6.20 - 6f16847710cc0502450788b9f12f0a14d3429668 2024-03-12: * Added setting of headless resolution to Screen Configuration * Removed setting of headless resolution for Wayland from Raspberry Pi Configuration From 7ce2538bca367f87547f50649d4e806d8ebcd087 Mon Sep 17 00:00:00 2001 From: Serge Schneider Date: Tue, 9 Apr 2024 15:27:24 +0100 Subject: [PATCH 25/40] Revert "Added docker-compose.yml for easy apt-cacher-ng startup" This reverts commit fe45b739871c2eba65ec520e00816299abbfbc5b. It's probably a bad idea to reference docker containers from unofficial sources --- .gitignore | 1 - README.md | 6 ------ docker-compose.yml | 10 ---------- 3 files changed, 17 deletions(-) delete mode 100644 docker-compose.yml diff --git a/.gitignore b/.gitignore index a6883c2..f01ee89 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,3 @@ SKIP SKIP_IMAGES .pc *-pc -apt-cacher-ng/ diff --git a/README.md b/README.md index 136e892..c48e708 100644 --- a/README.md +++ b/README.md @@ -77,12 +77,6 @@ The following environment variables are supported: will not be included in the image, making it safe to use an `apt-cacher` or similar package for development. - If you have Docker installed, you can set up a local apt caching proxy to - like speed up subsequent builds like this: - - docker-compose up -d - echo 'APT_PROXY=http://172.17.0.1:3142' >> config - * `BASE_DIR` (Default: location of `build.sh`) **CAUTION**: Currently, changing this value will probably break build.sh diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index f733860..0000000 --- a/docker-compose.yml +++ /dev/null @@ -1,10 +0,0 @@ -version: '2' - -services: - apt-cacher-ng: - restart: unless-stopped - image: sameersbn/apt-cacher-ng:latest - ports: - - "3142:3142" - volumes: - - ./apt-cacher-ng:/var/cache/apt-cacher-ng From c70f96f1464497bd03108385ed1e40fbf39aba94 Mon Sep 17 00:00:00 2001 From: Serge Schneider Date: Tue, 9 Apr 2024 15:51:44 +0100 Subject: [PATCH 26/40] stage5: smartsim has been removed from recommended apps --- stage5/00-install-extras/00-packages | 1 - 1 file changed, 1 deletion(-) diff --git a/stage5/00-install-extras/00-packages b/stage5/00-install-extras/00-packages index ad5dcad..85474dd 100644 --- a/stage5/00-install-extras/00-packages +++ b/stage5/00-install-extras/00-packages @@ -1,6 +1,5 @@ mu-editor scratch nuscratch scratch3 -smartsim wolfram-engine claws-mail realvnc-vnc-viewer From 165e9602376b1ee25d8599389e5ae5643dd9754c Mon Sep 17 00:00:00 2001 From: Serge Schneider Date: Thu, 18 Apr 2024 11:29:40 +0100 Subject: [PATCH 27/40] Fix keyboard configuration keyboard-configuration scripts ignores debconf settings if it doesn't detect an attached keyboard. Instead, it sets XKBOPTIONS to lv3:ralt_switch, which is not a desired option. It also considers an empty XKBOPTIONS string to be unset. This workaround sets it to a placeholder value which is removed later. dpkg-reconfigure is run so that debconf-get-selections prints the correct values. --- stage2/01-sys-tweaks/00-debconf | 2 ++ stage2/01-sys-tweaks/01-run.sh | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/stage2/01-sys-tweaks/00-debconf b/stage2/01-sys-tweaks/00-debconf index c13e3b1..884db93 100644 --- a/stage2/01-sys-tweaks/00-debconf +++ b/stage2/01-sys-tweaks/00-debconf @@ -24,3 +24,5 @@ keyboard-configuration keyboard-configuration/ctrl_alt_bksp boolean true # Keyboard layout: # Choices: English (UK), English (UK) - English (UK\, Colemak), English (UK) - English (UK\, Dvorak with UK punctuation), English (UK) - English (UK\, Dvorak), English (UK) - English (UK\, Macintosh international), English (UK) - English (UK\, Macintosh), English (UK) - English (UK\, extended WinKeys), English (UK) - English (UK\, international with dead keys), Other keyboard-configuration keyboard-configuration/variant select ${KEYBOARD_LAYOUT} +# for internal use +keyboard-configuration keyboard-configuration/optionscode string PLACEHOLDER diff --git a/stage2/01-sys-tweaks/01-run.sh b/stage2/01-sys-tweaks/01-run.sh index 59988b2..897463e 100755 --- a/stage2/01-sys-tweaks/01-run.sh +++ b/stage2/01-sys-tweaks/01-run.sh @@ -67,3 +67,8 @@ usermod --pass='*' root EOF rm -f "${ROOTFS_DIR}/etc/ssh/"ssh_host_*_key* + +sed -i "s/PLACEHOLDER//" "${ROOTFS_DIR}/etc/default/keyboard" +on_chroot << EOF +DEBIAN_FRONTEND=noninteractive dpkg-reconfigure keyboard-configuration +EOF From 5780b1ff6428965ee4cc3ed1f470481417494b37 Mon Sep 17 00:00:00 2001 From: Kristof Nachtergaele Date: Thu, 25 Apr 2024 14:31:24 +0200 Subject: [PATCH 28/40] export stage list --- build.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/build.sh b/build.sh index f34adfc..054b3f5 100755 --- a/build.sh +++ b/build.sh @@ -283,6 +283,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}") From f1c166a2833950a7c44fe19b01780723635a7aa3 Mon Sep 17 00:00:00 2001 From: Serge Schneider Date: Mon, 29 Apr 2024 14:34:52 +0100 Subject: [PATCH 29/40] export-image: run du with -x to avoid crossing filesystem boundaries Fixes #537 --- export-image/prerun.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/export-image/prerun.sh b/export-image/prerun.sh index d9778d1..6a5309a 100755 --- a/export-image/prerun.sh +++ b/export-image/prerun.sh @@ -10,7 +10,7 @@ rm -rf "${ROOTFS_DIR}" mkdir -p "${ROOTFS_DIR}" BOOT_SIZE="$((512 * 1024 * 1024))" -ROOT_SIZE=$(du --apparent-size -s "${EXPORT_ROOTFS_DIR}" --exclude var/cache/apt/archives --exclude boot/firmware --block-size=1 | cut -f 1) +ROOT_SIZE=$(du -x --apparent-size -s "${EXPORT_ROOTFS_DIR}" --exclude var/cache/apt/archives --exclude boot/firmware --block-size=1 | cut -f 1) # All partition sizes and starts will be aligned to this size ALIGN="$((4 * 1024 * 1024))" From e95e00f879e24c0f087763ec471fb9bdf9a8f92b Mon Sep 17 00:00:00 2001 From: Serge Schneider Date: Mon, 13 May 2024 15:24:21 +0100 Subject: [PATCH 30/40] Set a default IMG_NAME This also adds the 'ARCH' environment variable, which will help reduce the delta between master and arm64 branches. --- README.md | 2 +- build.sh | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index c48e708..c584825 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ environment variables. The following environment variables are supported: - * `IMG_NAME` **required** (Default: unset) + * `IMG_NAME` (Default: raspios-$RELEASE-$ARCH, for example: "raspios-bookworm-armhf") The name of the image to build with the current stage directories. Use this variable to set the root name of your OS, eg `IMG_NAME=Frobulator`. diff --git a/build.sh b/build.sh index 054b3f5..3cb10e7 100755 --- a/build.sh +++ b/build.sh @@ -167,10 +167,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=armhf +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)"}" @@ -198,7 +197,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}" @@ -215,7 +213,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 From d87f764fcbc2e9bdbfd407d2cbf9b5faf5600df1 Mon Sep 17 00:00:00 2001 From: Serge Schneider Date: Mon, 13 May 2024 15:54:28 +0100 Subject: [PATCH 31/40] build.sh: Warn user of unsupported build environment architecture and fail early if binfmt_misc isn't working as expected --- Dockerfile | 4 ++-- README.md | 2 +- build.sh | 9 +++++++++ depends | 1 + 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 673f756..0e6d86d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 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/ diff --git a/README.md b/README.md index c584825..279baaa 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ To install the required dependencies for `pi-gen` you should run: ```bash apt-get install coreutils quilt parted qemu-user-static debootstrap zerofree zip \ dosfstools libarchive-tools libcap2-bin grep rsync xz-utils file git curl bc \ -gpg pigz xxd +gpg pigz xxd arch-test ``` The file `depends` contains a list of tools needed. The format of this diff --git a/build.sh b/build.sh index 3cb10e7..d094eee 100755 --- a/build.sh +++ b/build.sh @@ -244,6 +244,15 @@ 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" diff --git a/depends b/depends index 10fcdd4..acbb5cd 100644 --- a/depends +++ b/depends @@ -19,3 +19,4 @@ lsmod:kmod bc gpg pigz +arch-test From 72b2dfd634295ec068562d4efadc50e4a30bf5ce Mon Sep 17 00:00:00 2001 From: Serge Schneider Date: Mon, 13 May 2024 16:28:34 +0100 Subject: [PATCH 32/40] build.sh: set ARCH to arm64 --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index d094eee..99d5340 100755 --- a/build.sh +++ b/build.sh @@ -167,7 +167,7 @@ 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} -export ARCH=armhf +export ARCH=arm64 export RELEASE=${RELEASE:-bookworm} # Don't forget to update stage0/prerun.sh export IMG_NAME="${IMG_NAME:-raspios-$RELEASE-$ARCH}" From 9917c869a7fed6fb210cbd82bda5cb4a28d4119f Mon Sep 17 00:00:00 2001 From: Serge Schneider Date: Mon, 13 May 2024 16:40:54 +0100 Subject: [PATCH 33/40] README.md: Consistent formatting of 'Default' values --- README.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 279baaa..53e1fb9 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ environment variables. The following environment variables are supported: - * `IMG_NAME` (Default: raspios-$RELEASE-$ARCH, for example: "raspios-bookworm-armhf") + * `IMG_NAME` (Default: `raspios-$RELEASE-$ARCH`, for example: `raspios-bookworm-armhf`) The name of the image to build with the current stage directories. Use this variable to set the root name of your OS, eg `IMG_NAME=Frobulator`. @@ -63,7 +63,7 @@ The following environment variables are supported: The release name to use in `/etc/issue.txt`. The default should only be used for official Raspberry Pi builds. -* `RELEASE` (Default: bookworm) +* `RELEASE` (Default: `bookworm`) The release version to build images against. Valid values are any supported Debian release. However, since different releases will have different sets of @@ -84,7 +84,7 @@ The following environment variables are supported: Top-level directory for `pi-gen`. Contains stage directories, build scripts, and by default both work and deployment directories. - * `WORK_DIR` (Default: `"$BASE_DIR/work"`) + * `WORK_DIR` (Default: `$BASE_DIR/work`) Directory in which `pi-gen` builds the target system. This value can be changed if you have a suitably large, fast storage location for stages to @@ -94,7 +94,7 @@ The following environment variables are supported: **CAUTION**: If your working directory is on an NTFS partition you probably won't be able to build: make sure this is a proper Linux filesystem. - * `DEPLOY_DIR` (Default: `"$BASE_DIR/deploy"`) + * `DEPLOY_DIR` (Default: `$BASE_DIR/deploy`) Output directory for target system images and NOOBS bundles. @@ -121,20 +121,20 @@ The following environment variables are supported: information on this. Usually 0 is no compression but very fast, up to 9 with the best compression but very slow ). - * `USE_QEMU` (Default: `"0"`) + * `USE_QEMU` (Default: `0`) Setting to '1' enables the QEMU mode - creating an image that can be mounted via QEMU for an emulated environment. These images include "-qemu" in the image file name. - * `LOCALE_DEFAULT` (Default: "en_GB.UTF-8" ) + * `LOCALE_DEFAULT` (Default: 'en_GB.UTF-8' ) Default system locale. - * `TARGET_HOSTNAME` (Default: "raspberrypi" ) + * `TARGET_HOSTNAME` (Default: 'raspberrypi' ) Setting the hostname to the specified value. - * `KEYBOARD_KEYMAP` (Default: "gb" ) + * `KEYBOARD_KEYMAP` (Default: 'gb' ) Default keyboard keymap. @@ -142,7 +142,7 @@ The following environment variables are supported: keyboard-configuration` and look at the `keyboard-configuration/xkb-keymap` value. - * `KEYBOARD_LAYOUT` (Default: "English (UK)" ) + * `KEYBOARD_LAYOUT` (Default: 'English (UK)' ) Default keyboard layout. @@ -150,7 +150,7 @@ The following environment variables are supported: keyboard-configuration` and look at the `keyboard-configuration/variant` value. - * `TIMEZONE_DEFAULT` (Default: "Europe/London" ) + * `TIMEZONE_DEFAULT` (Default: 'Europe/London' ) Default keyboard layout. From d790fed832188d41c1fb5d8506d833d053e4a81c Mon Sep 17 00:00:00 2001 From: Pev Date: Wed, 15 May 2024 15:45:43 +0100 Subject: [PATCH 34/40] Compare mount output using base of dirname (#771) * Compare mount output using base of dirname If you're building from a bind-mounted directory, the build will fail as it will find two entries to unmount, but a single unmount will remove them both causing an error. Adding a space means that the mountpoint will only match with a single mount entry ; the expected path, rather than the pre bind-mount. * Switch to awk instead of mount, grep, cut pipes Retry unmount 5 times and give up, letting the user know that they need to resolve the issue manually --------- Co-authored-by: David Peverley Co-authored-by: Serge Schneider --- export-image/05-finalise/01-run.sh | 2 +- scripts/common | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/export-image/05-finalise/01-run.sh b/export-image/05-finalise/01-run.sh index 8310e87..771aa7a 100755 --- a/export-image/05-finalise/01-run.sh +++ b/export-image/05-finalise/01-run.sh @@ -83,7 +83,7 @@ cp "$ROOTFS_DIR/etc/rpi-issue" "$INFO_FILE" dpkg -l --root "$ROOTFS_DIR" } >> "$INFO_FILE" -ROOT_DEV="$(mount | grep "${ROOTFS_DIR} " | cut -f1 -d' ')" +ROOT_DEV="$(awk "\$2 == \"${ROOTFS_DIR}\" {print \$1}" /etc/mtab)" unmount "${ROOTFS_DIR}" zerofree "${ROOT_DEV}" diff --git a/scripts/common b/scripts/common index 6150f2b..c305ee2 100644 --- a/scripts/common +++ b/scripts/common @@ -44,12 +44,15 @@ unmount(){ DIR=$1 fi - while mount | grep -q "$DIR"; do - local LOCS - LOCS=$(mount | grep "$DIR" | cut -f 3 -d ' ' | sort -r) - for loc in $LOCS; do - umount "$loc" - done + for i in {1..6}; do + if awk "\$2 ~ /^${DIR//\//\\/}/ {print \$2}" /etc/mtab | sort -r | xargs -r umount; then + break + elif [ "$i" -eq 6 ]; then + log "Failed to unmount ${DIR}. Do not try to delete this directory while it contains mountpoints!" + return 1 + fi + log "Retrying ($i/5)..." + sleep 1 done } export -f unmount From fb48183f0d49df3d069f0086263d829efa899c70 Mon Sep 17 00:00:00 2001 From: Tom Dewey <146750643+tdewey-rpi@users.noreply.github.com> Date: Wed, 15 May 2024 15:50:40 +0100 Subject: [PATCH 35/40] Expand trap cleanup function (#773) * build.sh: Unmount intermediates on trap Iterate through image files which might be in use and detach them Avoid silent failures - let the user know whether the build failed * common: update unmount_image Use udevadm settle instead of sleep if possible Use losetup's -j option to find the loop device associated with a give image file * build.sh: update clean-up trap term --------- Co-authored-by: Serge Schneider --- build.sh | 12 +++++++++++- scripts/common | 9 ++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/build.sh b/build.sh index d094eee..a96f4e4 100755 --- a/build.sh +++ b/build.sh @@ -158,7 +158,17 @@ do done term() { - true; #TODO: Cleanup + 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 diff --git a/scripts/common b/scripts/common index c305ee2..702576f 100644 --- a/scripts/common +++ b/scripts/common @@ -58,9 +58,12 @@ unmount(){ export -f unmount unmount_image(){ - sync - sleep 1 - LOOP_DEVICE=$(losetup --list | grep "$1" | cut -f1 -d' ') + if command -v udevadm >/dev/null 2>&1; then + udevadm settle 10 + else + sleep 1 + fi + LOOP_DEVICE=$(losetup -n -O NAME -j "$1") if [ -n "$LOOP_DEVICE" ]; then for part in "$LOOP_DEVICE"p*; do if DIR=$(findmnt -n -o target -S "$part"); then From 75fe47c7571c533ad52c43e03b440b0116a157ea Mon Sep 17 00:00:00 2001 From: Serge Schneider Date: Mon, 27 May 2024 13:48:11 +0100 Subject: [PATCH 36/40] Increase default swap size to 200 --- stage2/01-sys-tweaks/00-patches/02-swap.diff | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stage2/01-sys-tweaks/00-patches/02-swap.diff b/stage2/01-sys-tweaks/00-patches/02-swap.diff index 745a344..f542ec2 100644 --- a/stage2/01-sys-tweaks/00-patches/02-swap.diff +++ b/stage2/01-sys-tweaks/00-patches/02-swap.diff @@ -7,7 +7,7 @@ Index: jessie-stage2/rootfs/etc/dphys-swapfile # set size to absolute value, leaving empty (default) then uses computed value # you most likely don't want this, unless you have an special disk situation -#CONF_SWAPSIZE= -+CONF_SWAPSIZE=100 ++CONF_SWAPSIZE=200 # set size to computed value, this times RAM size, dynamically adapts, # guarantees that there is enough swap without wasting disk space on excess From 07ab46485360dea437c3696022436c19ff36bf5a Mon Sep 17 00:00:00 2001 From: Serge Schneider Date: Mon, 10 Jun 2024 13:53:24 +0100 Subject: [PATCH 37/40] stage4: Pre-install labwc --- stage4/00-install-packages/00-packages | 1 + 1 file changed, 1 insertion(+) diff --git a/stage4/00-install-packages/00-packages b/stage4/00-install-packages/00-packages index 89fb59a..3c526b8 100644 --- a/stage4/00-install-packages/00-packages +++ b/stage4/00-install-packages/00-packages @@ -19,6 +19,7 @@ rp-prefapps ffmpeg vlc rpi-imager +labwc # ninja-build and openocd needed for vscode pico extension meson openocd From 9b17be9621b5ba5f946e7435e75c66a31390d573 Mon Sep 17 00:00:00 2001 From: Serge Schneider Date: Mon, 10 Jun 2024 15:46:05 +0100 Subject: [PATCH 38/40] Update release notes --- .../00-release/files/release_notes.txt | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/export-noobs/00-release/files/release_notes.txt b/export-noobs/00-release/files/release_notes.txt index 63aab16..3512df2 100644 --- a/export-noobs/00-release/files/release_notes.txt +++ b/export-noobs/00-release/files/release_notes.txt @@ -1,4 +1,43 @@ UNRELEASED: + * pipanel - allow customisation of more than 2 desktops + * pipanel - add customisation for labwc + * gui-pkinst - add whitelist to restrict installation to specified packages only + * pixflat-theme - add theme settings for labwc + * pishutdown - revert to original use of pkill to close desktop + * piclone - fix for potential buffer overflow vulnerability (that would never have actually happened…) + * lp-connection-editor - fix dialog icons on taskbar + * rp-prefapps - add Raspberry Pi Connect; remove SmartSim + * piwiz - add page to enable / disable Raspberry Pi Connect + * wf-panel-pi - constrain main menu to fit on small screens + * wf-panel-pi - fix dialog icons on taskbar + * wf-panel-pi - fix keyboard handling and icon highlighting for taskbar buttons + * raspberrypi-ui-mods - add configuration for labwc + * raspberrypi-ui-mods - add support for new touchscreens + * raspberrypi-ui-mods - systemd-inhibit used to override hardware power key on Pi 5 + * rc-gui - add configuration of alternate keyboard layout + * rc-gui - add switching for Raspberry Pi Connect + * arandr - add brightness control for DSI displays + * arandr - more reliable method to detect virtual displays + * raspi-config - add setting of keyboard options + * raspi-config - add setting of PCIe speed + * raspi-config - add switching for Raspberry Pi Connect + * wayvnc - better handling for virtual displays + * wayvnc - improved encryption support + * GTK-3 - add keyboard shortcuts in combo boxes + * pcmanfm - allow customisation of more than 2 desktops + * pcmanfm - fix bug causing crash and inconsistent behaviour on certain drag and drop operations + * raspberrypi-sys-mods - add udev rule to allow backlight change + * raspberrypi-sys-mods - increase swapfile size + * raspberrypi-sys-mods - remove symlinks from paths in initramfs scripts + * wayfire - fix for crash when opening multiple Xwayland windows + * wayfire - fix for touchscreen bug when touching areas without windows + * labwc compositor installed as an alternative to wayfire; can be enabled in raspi-config + * various small bug fixes and tweaks + * Chromium updated to 125.0.6422.133 + * Firefox updated to 126.0 + * Raspberry Pi firmware 3590de0c181d433af368a95f15bc480bdaff8b47 + * Linux kernel 6.6.31 - c1432b4bae5b6582f4d32ba381459f33c34d1424 +2024-03-15: * Audio streams will now not be interrupted when other audio devices are connected or disconnected * Keyboard shortcut to install Orca no longer prompts for password, and will now wait for clock synchronisation rather than failing silently * Orca screen reader updated to version 45 with various additional small bug fixes From ca5eb625d8892212838c4b3b972d9e7e03bfcb29 Mon Sep 17 00:00:00 2001 From: Serge Schneider Date: Mon, 24 Jun 2024 10:43:37 +0100 Subject: [PATCH 39/40] Enable DWC2 host mode support for CM5 by default --- stage1/00-boot-files/files/config.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/stage1/00-boot-files/files/config.txt b/stage1/00-boot-files/files/config.txt index 621637a..2a64594 100644 --- a/stage1/00-boot-files/files/config.txt +++ b/stage1/00-boot-files/files/config.txt @@ -42,5 +42,7 @@ arm_boost=1 # (e.g. for USB device mode) or if USB support is not required. otg_mode=1 -[all] +[cm5] +dtoverlay=dwc2,dr_mode=host +[all] From 0b115f302a8f1e5bd3523614d7f45b9d447434c7 Mon Sep 17 00:00:00 2001 From: Serge Schneider Date: Wed, 19 Jun 2024 12:24:07 +0100 Subject: [PATCH 40/40] stage4: Pre-install rpi-connect --- stage4/00-install-packages/00-packages | 1 + 1 file changed, 1 insertion(+) diff --git a/stage4/00-install-packages/00-packages b/stage4/00-install-packages/00-packages index 3c526b8..ebd1af4 100644 --- a/stage4/00-install-packages/00-packages +++ b/stage4/00-install-packages/00-packages @@ -18,6 +18,7 @@ piwiz rp-prefapps ffmpeg vlc +rpi-connect rpi-imager labwc