Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/distrib/utils/embedded Be more precise about exactly what fa...
details: https://anonhg.NetBSD.org/src/rev/bbd0fe38fdcf
branches: trunk
changeset: 357792:bbd0fe38fdcf
user: kre <kre%NetBSD.org@localhost>
date: Tue Nov 28 02:56:44 2017 +0000
description:
Be more precise about exactly what fails when something does.
Relying upon set -e to abort things is sort of OK (it is not
a recommended option to use in general - too many odd special cases),
but only if user can work out from the "build failed" what actually
went wrong.
Tested only on amd64 build (for this, i386 is the same) - if anyone
has problems on builds for other systems, please let me know. However
the changes affect only failure paths, the most likely problem would
be for a build to fail to halt on an error, and I hope I have avoided
that. There should be no difference at all to error-free builds.
diffstat:
distrib/utils/embedded/conf/armv7.conf | 5 +++--
distrib/utils/embedded/conf/rpi.conf | 12 ++++++------
distrib/utils/embedded/conf/rpi_inst.conf | 8 ++++----
distrib/utils/embedded/conf/x86.conf | 5 +++--
distrib/utils/embedded/mkimage | 8 +++++++-
5 files changed, 23 insertions(+), 15 deletions(-)
diffs (127 lines):
diff -r 910b773ad228 -r bbd0fe38fdcf distrib/utils/embedded/conf/armv7.conf
--- a/distrib/utils/embedded/conf/armv7.conf Tue Nov 28 00:24:08 2017 +0000
+++ b/distrib/utils/embedded/conf/armv7.conf Tue Nov 28 02:56:44 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: armv7.conf,v 1.19 2017/11/09 21:36:46 skrll Exp $
+# $NetBSD: armv7.conf,v 1.20 2017/11/28 02:56:44 kre Exp $
# ARMv7 customization script used by mkimage
#
board=armv7
@@ -150,7 +150,8 @@
*)
cp "${k}" "${mnt}/boot/${tgt}"
;;
- esac
+ esac ||
+ fail "Copy of ${k} to ${mnt}/boot/${tgt} failed"
done
# board specific configuration
diff -r 910b773ad228 -r bbd0fe38fdcf distrib/utils/embedded/conf/rpi.conf
--- a/distrib/utils/embedded/conf/rpi.conf Tue Nov 28 00:24:08 2017 +0000
+++ b/distrib/utils/embedded/conf/rpi.conf Tue Nov 28 02:56:44 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: rpi.conf,v 1.31 2017/11/09 21:36:46 skrll Exp $
+# $NetBSD: rpi.conf,v 1.32 2017/11/28 02:56:44 kre Exp $
# Raspberry Pi customization script used by mkimage
#
@@ -72,7 +72,7 @@
*)
cp ${kernel} ${mnt}/boot/kernel.img
;;
- esac
+ esac || fail "copy of ${kernel} to ${mnt}/boot/kernel.img failed"
echo "${bar} installing RPI2 kernel ${bar}"
case ${rpi2_kernel} in
@@ -80,16 +80,16 @@
gzip -dc ${rpi2_kernel} > ${mnt}/boot/kernel7.img
;;
*)
- cp ${rpi_kernel} ${mnt}/boot/kernel7.img
+ cp ${rpi2_kernel} ${mnt}/boot/kernel7.img
;;
- esac
+ esac || fail "Copy of ${rpi2_kernel} to ${mnt}/boot/kernel7.img failed"
echo "${bar} installing firmware files ${bar}"
(cd ${mnt}/boot &&
for f in ${firmwarefiles}; do
echo " $f"
- cp ${firmwaredir}/${f} .
+ cp ${firmwaredir}/${f} . || exit 1
done
- )
+ ) || fail "Copy of firmeware into ${mnt}/boot failed"
}
diff -r 910b773ad228 -r bbd0fe38fdcf distrib/utils/embedded/conf/rpi_inst.conf
--- a/distrib/utils/embedded/conf/rpi_inst.conf Tue Nov 28 00:24:08 2017 +0000
+++ b/distrib/utils/embedded/conf/rpi_inst.conf Tue Nov 28 02:56:44 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: rpi_inst.conf,v 1.9 2017/07/31 16:34:22 jmcneill Exp $
+# $NetBSD: rpi_inst.conf,v 1.10 2017/11/28 02:56:44 kre Exp $
# Raspberry Pi customization script used by mkimage
#
@@ -102,14 +102,14 @@
*)
cp ${kernel} ${mnt}/boot/kernel.img
;;
- esac
+ esac || fail "copy of ${kernel} to ${mnt}/boot/kernel.img failed"
echo "${bar} installing firmware files ${bar}"
(cd ${mnt}/boot &&
for f in ${firmwarefiles}; do
echo " $f"
- cp ${firmwaredir}/${f} .
+ cp ${firmwaredir}/${f} . || exit 1
done
- )
+ ) || fail "Copy of firmware to ${mnt}/boot failed"
}
diff -r 910b773ad228 -r bbd0fe38fdcf distrib/utils/embedded/conf/x86.conf
--- a/distrib/utils/embedded/conf/x86.conf Tue Nov 28 00:24:08 2017 +0000
+++ b/distrib/utils/embedded/conf/x86.conf Tue Nov 28 02:56:44 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: x86.conf,v 1.7 2015/01/29 14:54:06 skrll Exp $
+# $NetBSD: x86.conf,v 1.8 2017/11/28 02:56:44 kre Exp $
# x86 shared config
#
@@ -140,7 +140,8 @@
echo ${PROG}: Missing ${bootfile} 1>&2
exit 1
fi
- cp ${bootfile} ${mnt}/boot
+ cp ${bootfile} ${mnt}/boot ||
+ fail "copy of ${bootfile} to ${mnt}/boot failed"
echo "./netbsd type=file uname=root gname=wheel mode=0755" \
>> "$tmp/selected_sets"
diff -r 910b773ad228 -r bbd0fe38fdcf distrib/utils/embedded/mkimage
--- a/distrib/utils/embedded/mkimage Tue Nov 28 00:24:08 2017 +0000
+++ b/distrib/utils/embedded/mkimage Tue Nov 28 02:56:44 2017 +0000
@@ -1,5 +1,5 @@
#!/bin/sh
-# $NetBSD: mkimage,v 1.68 2017/11/28 00:24:08 kre Exp $
+# $NetBSD: mkimage,v 1.69 2017/11/28 02:56:44 kre Exp $
#
# Copyright (c) 2013, 2014 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -78,6 +78,12 @@
esac
}
+fail() {
+ IFS=' '
+ echo >&2 "${PROG}: $*"
+ exit 1
+}
+
getsize() {
set -- $(ls -l $1)
echo $5
Home |
Main Index |
Thread Index |
Old Index