From 934fb903dde818fe74b713937b54e969f626e76e Mon Sep 17 00:00:00 2001 From: "Lance R. Vick" Date: Thu, 3 Oct 2024 04:37:17 -0700 Subject: [PATCH] fix: determinism on appended fat32 partition --- Containerfile | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/Containerfile b/Containerfile index 0b406a8..37d5996 100644 --- a/Containerfile +++ b/Containerfile @@ -65,7 +65,6 @@ COPY --from=cpio . / COPY --from=mtools . / COPY --from=xz . / COPY --from=grub . / -COPY --from=util-linux . / FROM base as dev COPY --from=gcc . / @@ -198,6 +197,8 @@ FROM build AS install ENV SOURCE_DATE_EPOCH=1 RUN <<-EOF set -eux + dd if=/dev/zero bs=1M count=10 >> user.img + mformat -v user -i user.img -N 0 :: find iso -exec touch -hcd "@0" "{}" + xorrisofs \ -output airgap.iso \ @@ -217,24 +218,8 @@ RUN <<-EOF -no-emul-boot \ -isohybrid-gpt-basdat \ -follow-links \ + -append_partition 3 0xb user.img \ iso/ - - # Increase ISO size by 512 MB to create space for the third partition - dd if=/dev/zero bs=1M count=512 >> airgap.iso - - # Append a new partition that uses the additional space - echo ", +" | sfdisk --append airgap.iso - - # Set the newly added third partition to FAT32 - sfdisk --part-type airgap.iso 3 b - - # Calculate the byte offset of the third partition - # This is done by finding the end of the first partition using fdisk, - # adding 1 sector, and multiplying by 512 (since each sector is 512 bytes). - OFFSET=$(fdisk -l airgap.iso | awk '/^airgap.iso1/ {print ($4 + 1) * 512}') - - # Format the third partition as FAT32 and label it 'USER' - mformat -v USER -i airgap.iso@@$OFFSET :: EOF ## Minimal Autorun SD card image -- 2.40.1