Module Name: src Committed By: rin Date: Wed Dec 23 10:35:18 UTC 2020
Modified Files: src/distrib/utils/embedded: mkimage src/distrib/utils/embedded/conf: evbarm.conf evbmips.conf x86.conf Log Message: Fix fallout from mkimage rev 1.76. For mkimage: - Update "size" if auto-calculated. - Use "dd bs=1" instead of non-portable "head -c". - Some style nits. For MD make_label() functions: - Stop using "newsize" as image size in MB, use "size" instead. To generate a diff of this commit: cvs rdiff -u -r1.76 -r1.77 src/distrib/utils/embedded/mkimage cvs rdiff -u -r1.37 -r1.38 src/distrib/utils/embedded/conf/evbarm.conf cvs rdiff -u -r1.1 -r1.2 src/distrib/utils/embedded/conf/evbmips.conf cvs rdiff -u -r1.8 -r1.9 src/distrib/utils/embedded/conf/x86.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/distrib/utils/embedded/mkimage diff -u src/distrib/utils/embedded/mkimage:1.76 src/distrib/utils/embedded/mkimage:1.77 --- src/distrib/utils/embedded/mkimage:1.76 Mon Dec 21 16:38:02 2020 +++ src/distrib/utils/embedded/mkimage Wed Dec 23 10:35:18 2020 @@ -1,5 +1,5 @@ #!/bin/sh -# $NetBSD: mkimage,v 1.76 2020/12/21 16:38:02 riastradh Exp $ +# $NetBSD: mkimage,v 1.77 2020/12/23 10:35:18 rin Exp $ # # Copyright (c) 2013, 2014 The NetBSD Foundation, Inc. # All rights reserved. @@ -259,15 +259,16 @@ if [ -z "${bootonly}" ]; then -F "$tmp/selected_sets" ${image} "${release}" "${mnt}" fi -cursize="$(getsize "${image}")" if [ "${size}" = 0 ]; then - size="${cursize}" + size="$(getsize "${image}")" # Round up to a multiple of 4m and add 1m of slop. alignunit=$((4*1024*1024)) - alignsize=$((alignunit*((cursize + alignunit - 1)/alignunit))) + alignsize=$((alignunit*((size + alignunit - 1)/alignunit))) alignsize=$((alignsize + 1024*1024)) - if [ $cursize -lt $alignsize ]; then - head -c "$((alignsize - cursize))" < /dev/zero >> "${image}" + if [ "${size}" -lt "${alignsize}" ]; then + dd bs=1 count="$((alignsize - size))" if=/dev/zero \ + >> "${image}" 2> /dev/null + size="${alignsize}" fi fi Index: src/distrib/utils/embedded/conf/evbarm.conf diff -u src/distrib/utils/embedded/conf/evbarm.conf:1.37 src/distrib/utils/embedded/conf/evbarm.conf:1.38 --- src/distrib/utils/embedded/conf/evbarm.conf:1.37 Fri Jul 17 15:16:34 2020 +++ src/distrib/utils/embedded/conf/evbarm.conf Wed Dec 23 10:35:18 2020 @@ -1,4 +1,4 @@ -# $NetBSD: evbarm.conf,v 1.37 2020/07/17 15:16:34 jmcneill Exp $ +# $NetBSD: evbarm.conf,v 1.38 2020/12/23 10:35:18 rin Exp $ # evbarm shared config # image=$HOME/${board}.img @@ -23,7 +23,7 @@ mkdir -p ${mnt}/boot make_label_evbarm() { # compute all sizes in terms of sectors - local totalsize=$(( ${newsize} * 1024 * 2 / 512 )) + local totalsize=$(( ${size} / 512 )) local bootsize=$(( ${boot} * 1024 )) Index: src/distrib/utils/embedded/conf/evbmips.conf diff -u src/distrib/utils/embedded/conf/evbmips.conf:1.1 src/distrib/utils/embedded/conf/evbmips.conf:1.2 --- src/distrib/utils/embedded/conf/evbmips.conf:1.1 Fri Jul 17 15:16:34 2020 +++ src/distrib/utils/embedded/conf/evbmips.conf Wed Dec 23 10:35:18 2020 @@ -1,4 +1,4 @@ -# $NetBSD: evbmips.conf,v 1.1 2020/07/17 15:16:34 jmcneill Exp $ +# $NetBSD: evbmips.conf,v 1.2 2020/12/23 10:35:18 rin Exp $ # evbmips shared config # image=$HOME/${board}.img @@ -23,7 +23,7 @@ mkdir -p ${mnt}/boot make_label_evbmips() { # compute all sizes in terms of sectors - local totalsize=$(( ${newsize} * 1024 * 2 / 512 )) + local totalsize=$(( ${size} / 512 )) local bootsize=$(( ${boot} * 1024 )) Index: src/distrib/utils/embedded/conf/x86.conf diff -u src/distrib/utils/embedded/conf/x86.conf:1.8 src/distrib/utils/embedded/conf/x86.conf:1.9 --- src/distrib/utils/embedded/conf/x86.conf:1.8 Tue Nov 28 02:56:44 2017 +++ src/distrib/utils/embedded/conf/x86.conf Wed Dec 23 10:35:18 2020 @@ -1,4 +1,4 @@ -# $NetBSD: x86.conf,v 1.8 2017/11/28 02:56:44 kre Exp $ +# $NetBSD: x86.conf,v 1.9 2020/12/23 10:35:18 rin Exp $ # x86 shared config # @@ -15,7 +15,7 @@ ffsoffset=${init}b make_label() { # compute all sizes in terms of sectors - local totalsize=$(( ${newsize} * 1024 * 2 / 512 )) + local totalsize=$(( ${size} / 512 )) local aoffset=${init} local asize=$(( ${totalsize} - ${aoffset} ))