Skip to content

Commit

Permalink
fix: gen_recovery_image.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
mingzhangqun committed Oct 30, 2024
1 parent 042910a commit 98be637
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions external/build/tools/common/sd_tools/sd_gen_recovery_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,9 @@ function size2sectors() {
}

part_label="RESERVED"
part_cap=600M
part_start=2048
part_size=$(size2sectors ${part_cap})
img_size=$((part_start+part_size))
part_start="2048"
part_size=$(size2sectors "600M")
img_size=$((part_start+part_size)) # sectors
echo "Image size: ${img_size} sectors $part_size"

function create_disk_mbr() {
Expand All @@ -61,8 +60,8 @@ function create_disk_mbr() {
echo "label: dos"
echo "label-id: 0x48617373"
echo "unit: sectors"
echo "boot : start= ${part_start}, size= ${img_size}, type=c, bootable" #create the boot partition
) | sfdisk ${image}
echo "boot: start=${part_start}, size=${part_size}, type=c,bootable" # create the boot partition
) | sfdisk ${image}
#> sfdisk --force -uS ${image}

echo "${FUNCNAME[0]} ok"
Expand All @@ -76,7 +75,6 @@ function write_boot_part() {
fi

local part=$(mktemp)

dd if=/dev/zero of=${part} bs=512 count=${part_size}
mkfs.vfat -n ${part_label} ${part}

Expand All @@ -102,4 +100,4 @@ write_boot_part $image_name || exit 1

zip -j ${target}.zip ${image_name}
rm -rf ${image_name}
popd
popd

0 comments on commit 98be637

Please sign in to comment.