Fix partition sizes

Fixes #56, #58.
This commit is contained in:
Johan Gunnarsson 2023-06-25 09:01:12 +02:00
parent b152f093f0
commit 13df092fe6
4 changed files with 25 additions and 6 deletions

View File

@ -96,8 +96,8 @@ jobs:
- name: Test qemu_x86_virt + ${{ matrix.suite }} ${{ matrix.arch }} - name: Test qemu_x86_virt + ${{ matrix.suite }} ${{ matrix.arch }}
timeout-minutes: 15 timeout-minutes: 15
run: | run: |
./test/qemu.sh $RUNNER_TEMP/boot-qemu_x86_virt.bin.gz \ sudo ./test/qemu.sh $RUNNER_TEMP/boot-qemu_x86_virt.bin.gz \
$RUNNER_TEMP/${{ matrix.os }}-${{ matrix.suite }}-${{ matrix.arch }}-*.bin.gz $RUNNER_TEMP/${{ matrix.os }}-${{ matrix.suite }}-${{ matrix.arch }}-*.bin.gz
build-docker: build-docker:
runs-on: ubuntu-latest runs-on: ubuntu-latest

View File

@ -181,10 +181,10 @@ ln -sf /run/systemd/resolve/stub-resolv.conf debian/etc/resolv.conf
find debian ! -type d -printf "/%P\n" | sort > files.txt find debian ! -type d -printf "/%P\n" | sort > files.txt
# Make a ext4 filesystem of this and put it into the image # Make a ext4 filesystem of this and put it into the image
# >>> 3800000000 - (32 * 1024 * 1024) # >>> ((3800000000 - 32 * 1024 * 1024) // (1024 * 1024)) * (1024 * 1024)
# 3766445568 # 3765436416
rm -f ext4.img rm -f ext4.img
fallocate -l 3766445568 ext4.img fallocate -l 3765436416 ext4.img
mkfs.ext4 -d debian ext4.img mkfs.ext4 -d debian ext4.img
pigz ext4.img pigz ext4.img

View File

@ -12,7 +12,7 @@ rm -f "${IMAGE}"
fallocate -v -l 3800000000 "${IMAGE}" # 3,800,000,000 bytes fallocate -v -l 3800000000 "${IMAGE}" # 3,800,000,000 bytes
parted -s "${IMAGE}" mklabel msdos parted -s "${IMAGE}" mklabel msdos
parted -s "${IMAGE}" mkpart primary fat32 -- 4MiB 32MiB # 28 MiB (50,331,648 bytes) parted -s "${IMAGE}" mkpart primary fat32 -- 4MiB 32MiB # 28 MiB (29,360,128 bytes)
parted -s "${IMAGE}" mkpart primary ext2 -- 32MiB -1 parted -s "${IMAGE}" mkpart primary ext2 -- 32MiB -1
parted -s "${IMAGE}" set 2 boot on parted -s "${IMAGE}" set 2 boot on

View File

@ -20,12 +20,31 @@ echo "Using password ${SSHPASS}"
# Build image # Build image
zcat "${BOOT}" "${DEBIAN}" > image.bin zcat "${BOOT}" "${DEBIAN}" > image.bin
# Check integrity
LOOP1=$(losetup -f -P --show image.bin) && {
trap 'losetup -d "${LOOP1}"' ERR
fsck.vfat -p -f "${LOOP1}p1"
fsck.ext4 -p -f "${LOOP1}p2"
trap '-' ERR
losetup -d "${LOOP1}"
}
# Assume 8GB virtual disk # Assume 8GB virtual disk
fallocate -l 8GB image.bin fallocate -l 8GB image.bin
# Extend second partition # Extend second partition
parted -s -a opt image.bin "resizepart 2 100%" parted -s -a opt image.bin "resizepart 2 100%"
# Check integrity again
LOOP2=$(losetup -f -P --show image.bin) && {
trap 'losetup -d "${LOOP2}"' ERR
fsck.vfat -p -f "${LOOP2}p1"
fsck.ext4 -p -f "${LOOP2}p2"
resize2fs "${LOOP2}p2"
trap '-' ERR
losetup -d "${LOOP2}"
}
# Extract U-Boot (u-boot.rom in x86 case) # Extract U-Boot (u-boot.rom in x86 case)
dd if=image.bin of=bios.bin count=2048 skip=16 dd if=image.bin of=bios.bin count=2048 skip=16