Fix DFU variable setting in arm64 host image
This was breaking a few things in the script, notably the
environment partition was failing to transfer unless it
wa the only partition that was being loaded. This change
also cleans up some superfluous '&&' and replaces them
with cleaner explicit checks.
Bug: 144812375
Test: local build and DFU transfer of all partitions
Change-Id: I72cbefc0e9318700468811983edea03466a54b09
diff --git a/tools/create_base_image_arm.sh b/tools/create_base_image_arm.sh
index d79334b..00ebb2c 100755
--- a/tools/create_base_image_arm.sh
+++ b/tools/create_base_image_arm.sh
@@ -219,11 +219,11 @@
setenv serverip ${TftpServer}
setenv loadaddr 0x00200000
mmc dev 0 0;
- file=$TplSplImg; offset=0x40; size=0x1f80; run tftpget1; setenv TplSplImg
- file=$UbootItb; offset=0x4000; size=0x2000; run tftpget1; setenv UbootItb
- file=$TrustImg; offset=0x6000; size=0x2000; run tftpget1; setenv TrustImg
- file=$RootfsImg; offset=0x8000; size=0; run tftpget1; setenv RootfsImg
- file=$UbootEnv; offset=0x1fc0; size=0x40; run tftpget1; setenv UbootEnv
+ setenv file $TplSplImg; offset=0x40; size=0x1f80; run tftpget1; setenv TplSplImg
+ setenv file $UbootItb; offset=0x4000; size=0x2000; run tftpget1; setenv UbootItb
+ setenv file $TrustImg; offset=0x6000; size=0x2000; run tftpget1; setenv TrustImg
+ setenv file $RootfsImg; offset=0x8000; size=0; run tftpget1; setenv RootfsImg
+ setenv file $UbootEnv; offset=0x1fc0; size=0x40; run tftpget1; setenv UbootEnv
mw.b ${scriptaddr} 0 0x8000
env export -b ${scriptaddr} 0x8000
mmc write ${scriptaddr} 0x1fc0 0x40
@@ -237,11 +237,11 @@
setenv serverip ${TftpServer}
setenv loadaddr 0x00200000
mmc dev 0 0;
- file=$TplSplImg; offset=0x40; size=0x1f80; run tftpget1; setenv TplSplImg
- file=$UbootItb; offset=0x4000; size=0x2000; run tftpget1; setenv UbootItb
- file=$TrustImg; offset=0x6000; size=0x2000; run tftpget1; setenv TrustImg
- file=$RootfsImg; offset=0x8000; size=0; run tftpget1; setenv RootfsImg
- file=$UbootEnv; offset=0x1fc0; size=0x40; run tftpget1; setenv UbootEnv
+ setenv file $TplSplImg; offset=0x40; size=0x1f80; run tftpget1; setenv TplSplImg
+ setenv file $UbootItb; offset=0x4000; size=0x2000; run tftpget1; setenv UbootItb
+ setenv file $TrustImg; offset=0x6000; size=0x2000; run tftpget1; setenv TrustImg
+ setenv file $RootfsImg; offset=0x8000; size=0; run tftpget1; setenv RootfsImg
+ setenv file $UbootEnv; offset=0x1fc0; size=0x40; run tftpget1; setenv UbootEnv
mw.b ${scriptaddr} 0 0x8000
env export -b ${scriptaddr} 0x8000
mmc write ${scriptaddr} 0x1fc0 0x40
@@ -249,32 +249,39 @@
echo "Already have ${Sha}. Booting..."
fi
else
- echo "Update ${Sha} isn't for me. Booting..."
+ echo "Update ${Sha} is not for me. Booting..."
fi'
-setenv tftpget1 "
-mw.b ${loadaddr} 0 0x400000
-&& tftp ${file}
-&& isGz=0 && setexpr isGz sub .*\\.gz\$ 1 ${file}
-&& if test $isGz = 1; then
- setexpr boffset ${offset} * 0x200
- && gzwrite mmc 0 ${loadaddr} 0x${filesize} 100000 ${boffset}
- && echo Updated: ${bootfile}
-elif test ${file} = boot.env; then
- env import -b ${loadaddr}
- && echo Updated: boot.env
-else
- && if test $size = 0; then
- setexpr x $filesize - 1
- && setexpr x $x / 0x1000
- && setexpr x $x + 1
- && setexpr x $x * 0x1000
- && setexpr x $x / 0x200
- && size=0x${x}
+setenv tftpget1 '
+if test "$file" != ""; then
+ mw.b ${loadaddr} 0 0x400000
+ tftp ${file}
+ if test $? = 0; then
+ setenv isGz 0 && setexpr isGz sub .*\\.gz\$ 1 ${file}
+ if test $isGz = 1; then
+ if test ${file} = ${UbootEnv}; then
+ echo "** gzipped env unsupported **"
+ else
+ setexpr boffset ${offset} * 0x200
+ gzwrite mmc 0 ${loadaddr} 0x${filesize} 100000 ${boffset} && echo Updated: ${file}
+ fi
+ elif test ${file} = ${UbootEnv}; then
+ env import -b ${loadaddr} && echo Updated: ${file}
+ else
+ if test $size = 0; then
+ setexpr x $filesize - 1
+ setexpr x $x / 0x1000
+ setexpr x $x + 1
+ setexpr x $x * 0x1000
+ setexpr x $x / 0x200
+ size=0x${x}
+ fi
+ mmc write ${loadaddr} ${offset} ${size} && echo Updated: ${file}
+ fi
fi
- && mmc write ${loadaddr} ${offset} ${size}
- && echo Updated: ${bootfile}
-fi
-|| echo ** UPDATE FAILED: ${bootfile} **"
+ if test $? != 0; then
+ echo ** UPDATE FAILED: ${file} **
+ fi
+fi'
if mmc dev 1 0; then; else
run bootcmd_dhcp;
fi