make.sh: support objdump tpl/spl elf file

Example:
	./make.sh elf tpl  --- objdump u-boot-tpl
	./make.sh elf spl  --- objdump u-boot-spl
	./make.sh elf      --- objdump u-boot

Change-Id: I8dca1cfce207b98e755db8841f3d614cfad9bfb4
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
This commit is contained in:
Joseph Chen 2019-06-20 11:56:14 +08:00 committed by Jianhong Chen
parent 89514e0a47
commit 34bdfea0a0
1 changed files with 14 additions and 7 deletions

21
make.sh
View File

@ -230,18 +230,25 @@ select_toolchain()
sub_commands() sub_commands()
{ {
local cmd=${SUBCMD%-*} opt=${SUBCMD#*-} local cmd=${SUBCMD%-*} opt=${SUBCMD#*-}
local elf=${OUTDIR}/u-boot map=${OUTDIR}/u-boot.map sym=${OUTDIR}/u-boot.sym
if [ "$FILE" == "tpl" -o "$FILE" == "spl" ]; then
elf=`find -name u-boot-${FILE}`
map=`find -name u-boot-${FILE}.map`
sym=`find -name u-boot-${FILE}.sym`
fi
case $cmd in case $cmd in
elf) elf)
if [ ! -f ${OUTDIR}/u-boot ]; then if [ -o ! -f ${elf} ]; then
echo "Can't find elf file: ${OUTDIR}/u-boot" echo "Can't find elf file: ${elf}"
exit 1 exit 1
else else
# default 'cmd' without option, use '-D' # default 'cmd' without option, use '-D'
if [ "${cmd}" = 'elf' -a "${opt}" = 'elf' ]; then if [ "${cmd}" = 'elf' -a "${opt}" = 'elf' ]; then
opt=D opt=D
fi fi
${TOOLCHAIN_OBJDUMP} -${opt} ${OUTDIR}/u-boot | less ${TOOLCHAIN_OBJDUMP} -${opt} ${elf} | less
exit 0 exit 0
fi fi
;; ;;
@ -252,12 +259,12 @@ sub_commands()
;; ;;
map) map)
cat ${OUTDIR}/u-boot.map | less cat ${map} | less
exit 0 exit 0
;; ;;
sym) sym)
cat ${OUTDIR}/u-boot.sym | less cat ${sym} | less
exit 0 exit 0
;; ;;
@ -311,8 +318,8 @@ sub_commands()
fi fi
echo echo
sed -n "/${FUNCADDR}/p" ${OUTDIR}/u-boot.sym sed -n "/${FUNCADDR}/p" ${sym}
${TOOLCHAIN_ADDR2LINE} -e ${OUTDIR}/u-boot ${FUNCADDR} ${TOOLCHAIN_ADDR2LINE} -e ${elf} ${FUNCADDR}
exit 0 exit 0
fi fi
;; ;;