Containerfile: creating a fat32 formatted third partition on airgap.iso

to allow for arbitrary user data.
This commit is contained in:
Sam Ebstein 2024-09-19 09:41:42 -07:00
parent 1f26de8fc1
commit 8378ddad95
Signed by: sam.ebstein
GPG Key ID: 6418F27A5E20ADD7
2 changed files with 28 additions and 2 deletions

View File

@ -179,6 +179,28 @@ RUN <<-EOF
iso/ iso/
EOF EOF
# Need sfdisk from util-linux
COPY --from=util-linux . .
RUN <<-EOF
set -eux
# Increase the size of the ISO by X 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 ## Minimal Autorun SD card image
COPY sdcard sdcard COPY sdcard sdcard
RUN <<-EOF RUN <<-EOF

View File

@ -55,7 +55,9 @@ vm-bios: out/airgap.iso
-usbdevice tablet \ -usbdevice tablet \
-drive id=external,if=none,format=raw,file=out/sdcard.img \ -drive id=external,if=none,format=raw,file=out/sdcard.img \
-display gtk,show-menubar=off,zoom-to-fit=on \ -display gtk,show-menubar=off,zoom-to-fit=on \
-cdrom "out/airgap.iso" -device usb-storage,drive=usbdrive \
-drive id=usbdrive,if=none,format=raw,file=out/airgap.iso \
-boot order=c
.PHONY: vm-efi .PHONY: vm-efi
vm-efi: out/airgap.iso vm-efi: out/airgap.iso
@ -70,7 +72,9 @@ vm-efi: out/airgap.iso
-usbdevice tablet \ -usbdevice tablet \
-drive id=external,if=none,format=raw,file=out/sdcard.img \ -drive id=external,if=none,format=raw,file=out/sdcard.img \
-display gtk,show-menubar=off,zoom-to-fit=on \ -display gtk,show-menubar=off,zoom-to-fit=on \
-cdrom "out/airgap.iso" -device usb-storage,drive=usbdrive \
-drive id=usbdrive,if=none,format=raw,file=airgap.iso \
-boot order=c
## Signing, Verification, and Release Targets ## Signing, Verification, and Release Targets