From 37a76e0950ff204722a1e2c45b289af09b70a4f0 Mon Sep 17 00:00:00 2001 From: Andrei Radulescu Date: Mon, 19 Aug 2024 23:17:48 +0300 Subject: [PATCH] image creation cleanup (#317) * cleaning * remove resize2fs shrinking * [upload] * updated ROOTFS_IMAGE_SIZE comment about resize2fs -M --- Dockerfile.builder | 1 - build_system.sh | 20 ++++++++------------ 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/Dockerfile.builder b/Dockerfile.builder index 2a23ae04..e32c9bed 100644 --- a/Dockerfile.builder +++ b/Dockerfile.builder @@ -19,7 +19,6 @@ RUN apt-get update && \ ccache \ libcap2-bin \ android-sdk-libsparse-utils \ - e2fsprogs \ && rm -rf /var/lib/apt/lists/* RUN if [ ${UID:-0} -ne 0 ] && [ ${GID:-0} -ne 0 ]; then \ diff --git a/build_system.sh b/build_system.sh index fb3095f0..a899588a 100755 --- a/build_system.sh +++ b/build_system.sh @@ -15,11 +15,11 @@ OUTPUT_DIR="$DIR/output" ROOTFS_DIR="$BUILD_DIR/agnos-rootfs" ROOTFS_IMAGE="$BUILD_DIR/system.img" -SKIP_CHUNKS_IMAGE="$OUTPUT_DIR/system-skip-chunks.img" +OUT_IMAGE="$OUTPUT_DIR/system.img" +OUT_SKIP_CHUNKS_IMAGE="$OUTPUT_DIR/system-skip-chunks.img" # the partition is 10G, but openpilot's updater didn't always handle the full size -# - the size will also get shrunk with "resize2fs -M" -# - openpilot fix, shipped in 0.9.8 (8/18/24): https://github.com/commaai/openpilot/pull/33320 +# openpilot fix, shipped in 0.9.8 (8/18/24): https://github.com/commaai/openpilot/pull/33320 ROOTFS_IMAGE_SIZE=5G # Create temp dir if non-existent @@ -132,20 +132,16 @@ exec_as_root bash -c "set -e; export ROOTFS_DIR=$ROOTFS_DIR GIT_HASH=$GIT_HASH; echo "Unmount filesystem" exec_as_root umount -l $ROOTFS_DIR -# Make image with skipped chunks -echo "Sparsify image $(basename $SKIP_CHUNKS_IMAGE)" +# Make system image with skipped chunks +echo "Sparsifying image $(basename $OUT_SKIP_CHUNKS_IMAGE)" exec_as_user bash -c "\ TMP_SPARSE=\$(mktemp); \ img2simg $ROOTFS_IMAGE \$TMP_SPARSE; \ TMP_SKIP=\$(mktemp); \ -$DIR/tools/simg2dontcare.py $TMP_SPARSE \$TMP_SKIP; \ -mv \$TMP_SKIP $SKIP_CHUNKS_IMAGE" - -# Reduce system image to the minimum size -exec_as_user e2fsck -fy $ROOTFS_IMAGE -exec_as_user resize2fs -M $ROOTFS_IMAGE +$DIR/tools/simg2dontcare.py \$TMP_SPARSE \$TMP_SKIP; \ +mv \$TMP_SKIP $OUT_SKIP_CHUNKS_IMAGE" # Copy system image to output -cp $ROOTFS_IMAGE $OUTPUT_DIR +cp $ROOTFS_IMAGE $OUT_IMAGE echo "Done!"