Skip to content

Commit

Permalink
scripts: fix link-vmlinux.sh bash-ism
Browse files Browse the repository at this point in the history
While building linux with dash shell:
  LINK    vmlinux
trap: SIGHUP: bad trap
/src/linux-4.0/Makefile:933: recipe for target 'vmlinux' failed
make[1]: *** [vmlinux] Error 1

See the following document for behavior of posix shell trap instruction:
http://pubs.opengroup.org/onlinepubs/000095399/utilities/trap.html

Cc: Ingo Molnar <[email protected]>
Signed-off-by: Sylvain BERTRAND <[email protected]>
Signed-off-by: Michal Marek <[email protected]>
  • Loading branch information
sylware authored and michal42 committed May 7, 2015
1 parent ee4eb20 commit ab160db
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions scripts/link-vmlinux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ sortextable()
}

# Delete output files in case of error
trap cleanup SIGHUP SIGINT SIGQUIT SIGTERM ERR
cleanup()
{
rm -f .old_version
Expand All @@ -124,6 +123,20 @@ cleanup()
rm -f vmlinux.o
}

on_exit()
{
if [ $? -ne 0 ]; then
cleanup
fi
}
trap on_exit EXIT

on_signals()
{
exit 1
}
trap on_signals HUP INT QUIT TERM

#
#
# Use "make V=1" to debug this script
Expand Down Expand Up @@ -231,7 +244,6 @@ if [ -n "${CONFIG_KALLSYMS}" ]; then
if ! cmp -s System.map .tmp_System.map; then
echo >&2 Inconsistent kallsyms data
echo >&2 Try "make KALLSYMS_EXTRA_PASS=1" as a workaround
cleanup
exit 1
fi
fi
Expand Down

0 comments on commit ab160db

Please sign in to comment.