#!/bin/sh
#
# Script to replace sub_xxxxxxxx calls in boot.c, capt_seq.c and movie_rec
# with the coresponding task names found in stubs_entry.S
#
# This script requires a "PERFECT" stubs_entry.S file generated by finsig_dryos !!!
#
# Usage: ./hex2task.sh path_to_platform_sub_dir
#
# (c) nafraf
# GPLv3+
EXPECTED_ARGS=1
E_BADARGS=65
if [ $# -ne $EXPECTED_ARGS ]
then
echo "Usage: `basename $0` {path_to_platform_sub_dir}"
echo "Example: ./hex2task.sh ~/chdk-trunk/platform/a810/sub/100b"
exit $E_BADARGS
fi
#1) Create sed commands
grep ^NSTUB $1/stubs_entry.S | grep 0x'[0|f][0|f]'| \
awk '{ printf("s/sub_%s/_%s/\n",toupper(substr($2,4,8)),substr($1,7))}' > /tmp/hex2task.out
#2) Create patches
for file in boot.c capt_seq.c movie_rec.c
do
echo $1/$file
if [ -f $1/$file ]
then
sed --in-place=.orig -f /tmp/hex2task.out $1/$file
#Print the differences
diff $1/$file $1/$file.orig
fi
done
Advertisement
Skip to content
GPL:hex2task.sh
Advertisement