diff --git a/sys/tools/fdt/embed_dtb.sh b/sys/tools/fdt/embed_dtb.sh --- a/sys/tools/fdt/embed_dtb.sh +++ b/sys/tools/fdt/embed_dtb.sh @@ -33,13 +33,13 @@ # $1: kernel filename # $2: device tree blob filename -dtbsize=`ls -l $2 | awk '{print $5}'` -obs=`strings -at d $1 | grep "Device Tree Blob STARTS here" | awk '{print $1}'` -eol=`strings -at d $1 | grep "Device Tree Blob STOPS here" | awk '{print $1}'` +dtbsize=$(stat -f "%z" ${2}) +obs=$(strings -at d "${1}" | awk '/Device Tree Blob STARTS here/ {print $1}') +eol=$(strings -at d "${1}" | awk '/Device Tree Blob STOPS here/ {print $1}') sz=$((eol - obs)); -if [ $sz -lt $dtbsize ] +if [ ${sz} -lt "${dtbsize}" ] then echo "Selected blob is too big to reembed. Please rebuild the kernel." exit fi -dd if=$2 ibs=${dtbsize} of=$1 obs=${obs} oseek=1 conv=notrunc 2> /dev/null +dd if="${2}" ibs="${dtbsize}" of="${1}" obs="${obs}" oseek=1 conv=notrunc 2> /dev/null diff --git a/sys/tools/fdt/make_dtbh.sh b/sys/tools/fdt/make_dtbh.sh --- a/sys/tools/fdt/make_dtbh.sh +++ b/sys/tools/fdt/make_dtbh.sh @@ -4,5 +4,5 @@ # Script generates a $2/fdt_static_dtb.h file. -dtb_base_name=`basename $1 .dts` -echo '#define FDT_DTB_FILE "'${dtb_base_name}.dtb'"' > $2/fdt_static_dtb.h +dtb_base_name=$(basename "${1}" .dts) +echo '#define FDT_DTB_FILE "'${dtb_base_name}.dtb'"' > "${2}/fdt_static_dtb.h"