Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src-draft/trunk]: src/distrib/utils/embedded embedded/mkimage: Pad image wit...
details: https://anonhg.NetBSD.org/src-all/rev/096918e5634c
branches: trunk
changeset: 949387:096918e5634c
user: Taylor R Campbell <riastradh%NetBSD.org@localhost>
date: Mon Dec 21 16:45:19 2020 +0000
description:
embedded/mkimage: Pad image with zeros to multiple of 4 MB plus 1 MB.
Otherwise, there may not be enough space after the ffs partition for a
gpt, leading to very confusing results.
diffstat:
distrib/utils/embedded/mkimage | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
diffs (30 lines):
diff -r f7ed97d7313b -r 096918e5634c distrib/utils/embedded/mkimage
--- a/distrib/utils/embedded/mkimage Mon Dec 21 16:39:27 2020 +0000
+++ b/distrib/utils/embedded/mkimage Mon Dec 21 16:45:19 2020 +0000
@@ -259,17 +259,17 @@
-F "$tmp/selected_sets" ${image} "${release}" "${mnt}"
fi
+cursize="$(getsize "${image}")"
if [ "${size}" = 0 ]; then
- size="$(getsize "${image}")"
+ size="${cursize}"
+ # Round up to a multiple of 4m and add 1m of slop.
+ alignunit=$((4*1024*1024))
+ alignsize=$((alignunit*((cursize + alignunit - 1)/alignunit)))
+ alignsize=$((alignsize + 1024*1024))
+ if [ $cursize -lt $alignsize ]; then
+ head -c "$((alignsize - cursize))" < /dev/zero >> "${image}"
+ fi
fi
-newsize=$((${size} / 2 / 1024))
-compare=$((${newsize} * 2 * 1024))
-while [ "${compare}" != "${size}" ]
-do
- size="$((size + size - compare))"
- newsize="$((${size} / 2 / 1024))"
- compare="$((${newsize} * 2 * 1024))"
-done
if $gpt; then
if $gpt_hybrid; then
Home |
Main Index |
Thread Index |
Old Index