Skip to content

Commit

Permalink
fix raspi build (#2472)
Browse files Browse the repository at this point in the history
* fix raspi build

* Update build.sh
  • Loading branch information
dr-bonez authored Oct 24, 2023
1 parent 6e92a7d commit a96467c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/startos-iso.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ jobs:
format(
'["ubuntu-22.04", "{0}"]',
fromJson('{
"x86_64": "buildjet-32vcpu-ubuntu-2204",
"x86_64-nonfree": "buildjet-32vcpu-ubuntu-2204",
"x86_64": "buildjet-8vcpu-ubuntu-2204",
"x86_64-nonfree": "buildjet-8vcpu-ubuntu-2204",
"aarch64": "buildjet-8vcpu-ubuntu-2204-arm",
"aarch64-nonfree": "buildjet-8vcpu-ubuntu-2204-arm",
"raspberrypi": "buildjet-8vcpu-ubuntu-2204-arm",
Expand Down
29 changes: 26 additions & 3 deletions image-recipe/build.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
set -e

MAX_IMG_SECTORS=8388608 # 4GB
MAX_IMG_SECTORS=7217792 # 4GB

echo "==== StartOS Image Build ===="

Expand Down Expand Up @@ -273,7 +273,7 @@ elif [ "${IMAGE_TYPE}" = img ]; then
fi
}

ROOT_PART_END=7217792
ROOT_PART_END=$MAX_IMG_SECTORS
TARGET_NAME=$prep_results_dir/${IMAGE_BASENAME}.img
TARGET_SIZE=$[($ROOT_PART_END+1)*512]
truncate -s $TARGET_SIZE $TARGET_NAME
Expand Down Expand Up @@ -317,8 +317,31 @@ elif [ "${IMAGE_TYPE}" = img ]; then

umount $TMPDIR/boot
umount $TMPDIR

e2fsck -fy `partition_for ${OUTPUT_DEVICE} 2`
resize2fs -M `partition_for ${OUTPUT_DEVICE} 2`

BLOCK_COUNT=$(dumpe2fs -h `partition_for ${OUTPUT_DEVICE} 2` | awk '/^Block count:/ { print $3 }')
BLOCK_SIZE=$(dumpe2fs -h `partition_for ${OUTPUT_DEVICE} 2` | awk '/^Block size:/ { print $3 }')
SECTOR_LEN=$[$BLOCK_COUNT*$BLOCK_SIZE/512]

losetup -d $OUTPUT_DEVICE

mv $prep_results_dir/${IMAGE_BASENAME}.img $RESULTS_DIR/$IMAGE_BASENAME.iso
(
echo d
echo 2
echo n
echo p
echo 2
echo 526336
echo +$SECTOR_LEN
echo w
) | fdisk $TARGET_NAME

ROOT_PART_END=$[526336+$SECTOR_LEN]
TARGET_SIZE=$[($ROOT_PART_END+1)*512]
truncate -s $TARGET_SIZE $TARGET_NAME

mv $TARGET_NAME $RESULTS_DIR/$IMAGE_BASENAME.img

fi

0 comments on commit a96467c

Please sign in to comment.