Skip to content

Commit

Permalink
Merge pull request kata-containers#8436 from Lu-Biao/main
Browse files Browse the repository at this point in the history
image-builder: bugfix incorrect partition location
  • Loading branch information
fidencio authored Dec 5, 2023
2 parents 2cd0031 + b816dca commit b056683
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tools/osbuilder/image-builder/image_builder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -406,15 +406,20 @@ create_disk() {
# The partition is the rootfs content
info "Creating partitions"

if [ "${rootfs_end}" == "-1" ]; then
rootfs_end_unit="s"
else
rootfs_end_unit="MiB"
fi
if [ "${MEASURED_ROOTFS}" == "yes" ]; then
info "Creating partitions with hash device"
# The hash data will take less than one percent disk space to store
hash_start=$(echo $img_size | awk '{print $1 * 0.99}' |cut -d $(locale decimal_point) -f 1)
partition_param="mkpart primary ${fs_type} ${part_start}M ${hash_start}M "
partition_param+="mkpart primary ${fs_type} ${hash_start}M ${rootfs_end}M "
partition_param="mkpart primary ${fs_type} ${part_start}MiB ${hash_start}MiB "
partition_param+="mkpart primary ${fs_type} ${hash_start}MiB ${rootfs_end}${rootfs_end_unit} "
partition_param+="set 1 boot on"
else
partition_param="mkpart primary ${fs_type} ${part_start}M ${rootfs_end}M"
partition_param="mkpart primary ${fs_type} ${part_start}MiB ${rootfs_end}${rootfs_end_unit}"
fi

parted -s -a optimal "${image}" -- \
Expand Down

0 comments on commit b056683

Please sign in to comment.