ARM: 8750/1: deflate_xip_data.sh: minor fixes
Send nm complaints about broken pipe (when sed exits early) to /dev/null. All errors should be printed to stderr. Don't trap on normal exit so the trap can return an error code. Signed-off-by: Nicolas Pitre <nico@linaro.org> Tested-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
This commit is contained in:
parent
73b9160d0d
commit
1b8837b617
@ -30,7 +30,7 @@ esac
|
|||||||
|
|
||||||
sym_val() {
|
sym_val() {
|
||||||
# extract hex value for symbol in $1
|
# extract hex value for symbol in $1
|
||||||
local val=$($NM "$VMLINUX" | sed -n "/ $1$/{s/ .*$//p;q}")
|
local val=$($NM "$VMLINUX" 2>/dev/null | sed -n "/ $1\$/{s/ .*$//p;q}")
|
||||||
[ "$val" ] || { echo "can't find $1 in $VMLINUX" 1>&2; exit 1; }
|
[ "$val" ] || { echo "can't find $1 in $VMLINUX" 1>&2; exit 1; }
|
||||||
# convert from hex to decimal
|
# convert from hex to decimal
|
||||||
echo $((0x$val))
|
echo $((0x$val))
|
||||||
@ -48,12 +48,12 @@ data_end=$(($_edata_loc - $base_offset))
|
|||||||
file_end=$(stat -c "%s" "$XIPIMAGE")
|
file_end=$(stat -c "%s" "$XIPIMAGE")
|
||||||
if [ "$file_end" != "$data_end" ]; then
|
if [ "$file_end" != "$data_end" ]; then
|
||||||
printf "end of xipImage doesn't match with _edata_loc (%#x vs %#x)\n" \
|
printf "end of xipImage doesn't match with _edata_loc (%#x vs %#x)\n" \
|
||||||
$(($file_end + $base_offset)) $_edata_loc 2>&1
|
$(($file_end + $base_offset)) $_edata_loc 1>&2
|
||||||
exit 1;
|
exit 1;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# be ready to clean up
|
# be ready to clean up
|
||||||
trap 'rm -f "$XIPIMAGE.tmp"' 0 1 2 3
|
trap 'rm -f "$XIPIMAGE.tmp"; exit 1' 1 2 3
|
||||||
|
|
||||||
# substitute the data section by a compressed version
|
# substitute the data section by a compressed version
|
||||||
$DD if="$XIPIMAGE" count=$data_start iflag=count_bytes of="$XIPIMAGE.tmp"
|
$DD if="$XIPIMAGE" count=$data_start iflag=count_bytes of="$XIPIMAGE.tmp"
|
||||||
|
Loading…
Reference in New Issue
Block a user