Skip to content

Commit 3e943ab

Browse files
Tom Deweytdewey-rpi
authored andcommitted
1.3.6: Always sparse the rootfs
Observed time to flash Raspberry Pi OS 64-bit (Desktop reduced from ~334s to ~227s). Savings likely exacerbated on small images going into largere storage devices.
1 parent bcce13d commit 3e943ab

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

debian/changelog

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
1+
rpi-sb-provisioner (1.3.6) unstable; urgency=medium
2+
3+
* provisioner: Always sparse the rootfs for improved transfer speeds
4+
5+
-- Tom Dewey <[email protected]> Wed, 12 Feb 2025 15:15:00 +0000
6+
17
rpi-sb-provisioner (1.3.5) unstable; urgency=medium
28

39
* provisioner: Fixup ethernet handling
410
* provisioner: Move device keypair retreival to earlier phase
511
* provisioner: Fix up 64-bit serial handling
612
* provisioner: Fix up multi-device provisioning
713

8-
-- Tom Dewey <[email protected]> Mon, 10 Feb 2025 16:15:00 +0000
14+
-- Tom Dewey <[email protected]> Wed, 12 Feb 2025 14:15:00 +0000
915

1016
rpi-sb-provisioner (1.3.4) unstable; urgency=medium
1117

service/rpi-sb-provisioner.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ die() {
7676
exit 1
7777
}
7878

79+
simg_expanded_size() {
80+
echo "$(($(simg_dump "$1" | sed -E 's/.*?Total of ([0-9]+) ([0-9]+)-byte .*/\1 * \2/')))"
81+
}
82+
7983
keywriter_log() {
8084
echo "$@" >> /var/log/rpi-sb-provisioner/"${TARGET_DEVICE_SERIAL}"/keywriter.log
8185
}
@@ -636,6 +640,7 @@ check_command_exists mount
636640

637641
# Fastboot is used as a transfer mechanism to get images and metadata to and from the Raspberry Pi device
638642
check_command_exists fastboot
643+
check_command_exists simg_dump
639644

640645
check_command_exists blockdev
641646

@@ -969,12 +974,12 @@ announce_start "Resizing OS images"
969974
# https://dl.google.com/android/repository/platform-tools-latest-darwin.zip
970975
# https://dl.google.com/android/repository/platform-tools-latest-windows.zip
971976
TARGET_STORAGE_ROOT_EXTENT="$(get_variable partition-size:mapper/cryptroot)"
972-
if [ -f "${RPI_SB_WORKDIR}/rootfs-temporary.simg" ] && [ "$((TARGET_STORAGE_ROOT_EXTENT))" -eq "$(stat -c%s "${RPI_SB_WORKDIR}"/rootfs-temporary.simg)" ]; then
977+
if [ -f "${RPI_SB_WORKDIR}/rootfs-temporary.simg" ] && [ "$((TARGET_STORAGE_ROOT_EXTENT))" -eq "$(simg_expanded_size "${RPI_SB_WORKDIR}"/rootfs-temporary.simg)" ]; then
973978
announce_stop "Resizing OS images: Not required, already the correct size"
974979
else
975-
mke2fs -t ext4 -b 4096 -d "${TMP_DIR}"/rpi-rootfs-img-mount "${RPI_SB_WORKDIR}"/rootfs-temporary.simg $((TARGET_STORAGE_ROOT_EXTENT / 4096))
976-
#TODO: Re-enable android_sparse
977-
#mke2fs -t ext4 -b 4096 -d ${TMP_DIR}/rpi-rootfs-img-mount -E android_sparse ${RPI_SB_WORKDIR}/rootfs-temporary.simg $((TARGET_STORAGE_ROOT_EXTENT / 4096))
980+
mke2fs -t ext4 -b 4096 -d "${TMP_DIR}"/rpi-rootfs-img-mount "${RPI_SB_WORKDIR}"/rootfs-temporary.img $((TARGET_STORAGE_ROOT_EXTENT / 4096))
981+
img2simg -s "${RPI_SB_WORKDIR}"/rootfs-temporary.img "${RPI_SB_WORKDIR}"/rootfs-temporary.simg
982+
rm -f "${RPI_SB_WORKDIR}"/rootfs-temporary.img
978983
announce_stop "Resizing OS images: Resized to $((TARGET_STORAGE_ROOT_EXTENT))"
979984
fi
980985

0 commit comments

Comments
 (0)