added some quotes to serve directory names containing whitespaces

This commit is contained in:
Alex Kaplan 2015-10-23 16:43:53 -07:00
parent 27489a4fd1
commit b2d88f7134
2 changed files with 70 additions and 72 deletions

View File

@ -35,8 +35,8 @@ prepare_images() {
local in=$SPL
local out=$PADDED_SPL
if [ -e $out ]; then
rm $out
if [ -e "$out" ]; then
rm "$out"
fi
# The BROM cannot read 16K pages: it only reads 8k of data at most.
@ -59,33 +59,33 @@ prepare_images() {
prepare_uboot_script() {
if [ "$NAND_ERASE_BB" = true ] ; then
echo "nand scrub -y 0x0 0x200000000" > $UBOOT_SCRIPT_SRC
echo "nand scrub -y 0x0 0x200000000" > "${UBOOT_SCRIPT_SRC}"
else
echo "nand erase 0x0 0x200000000" > $UBOOT_SCRIPT_SRC
echo "nand erase 0x0 0x200000000" > "${UBOOT_SCRIPT_SRC}"
fi
echo "sunxi_nand config spl" >> $UBOOT_SCRIPT_SRC
echo "nand write $SPL_MEM_ADDR 0x0 $PADDED_SPL_SIZE" >> $UBOOT_SCRIPT_SRC
echo "nand write $SPL_MEM_ADDR 0x100000 $PADDED_SPL_SIZE" >> $UBOOT_SCRIPT_SRC
echo "nand write $SPL_MEM_ADDR 0x200000 $PADDED_SPL_SIZE" >> $UBOOT_SCRIPT_SRC
echo "nand write $SPL_MEM_ADDR 0x300000 $PADDED_SPL_SIZE" >> $UBOOT_SCRIPT_SRC
echo "nand write $SPL_MEM_ADDR 0x400000 $PADDED_SPL_SIZE" >> $UBOOT_SCRIPT_SRC
echo "nand write $SPL_MEM_ADDR 0x500000 $PADDED_SPL_SIZE" >> $UBOOT_SCRIPT_SRC
echo "nand write $SPL_MEM_ADDR 0x600000 $PADDED_SPL_SIZE" >> $UBOOT_SCRIPT_SRC
echo "nand write $SPL_MEM_ADDR 0x700000 $PADDED_SPL_SIZE" >> $UBOOT_SCRIPT_SRC
echo "sunxi_nand config default" >> $UBOOT_SCRIPT_SRC
echo "nand write $UBOOT_MEM_ADDR 0x800000 $PADDED_UBOOT_SIZE" >> $UBOOT_SCRIPT_SRC
echo "setenv bootargs root=ubi0:rootfs rootfstype=ubifs rw earlyprintk ubi.mtd=4" >> $UBOOT_SCRIPT_SRC
echo "setenv bootcmd 'source \${scriptaddr}; nand slc-mode on; mtdparts; ubi part UBI; ubifsmount ubi0:rootfs; ubifsload \$fdt_addr_r /boot/sun5i-r8-chip.dtb; ubifsload \$kernel_addr_r /boot/zImage; bootz \$kernel_addr_r - \$fdt_addr_r'" >> $UBOOT_SCRIPT_SRC
echo "saveenv" >> $UBOOT_SCRIPT_SRC
echo "sunxi_nand config spl" >> "${UBOOT_SCRIPT_SRC}"
echo "nand write $SPL_MEM_ADDR 0x0 $PADDED_SPL_SIZE" >> "${UBOOT_SCRIPT_SRC}"
echo "nand write $SPL_MEM_ADDR 0x100000 $PADDED_SPL_SIZE" >> "${UBOOT_SCRIPT_SRC}"
echo "nand write $SPL_MEM_ADDR 0x200000 $PADDED_SPL_SIZE" >> "${UBOOT_SCRIPT_SRC}"
echo "nand write $SPL_MEM_ADDR 0x300000 $PADDED_SPL_SIZE" >> "${UBOOT_SCRIPT_SRC}"
echo "nand write $SPL_MEM_ADDR 0x400000 $PADDED_SPL_SIZE" >> "${UBOOT_SCRIPT_SRC}"
echo "nand write $SPL_MEM_ADDR 0x500000 $PADDED_SPL_SIZE" >> "${UBOOT_SCRIPT_SRC}"
echo "nand write $SPL_MEM_ADDR 0x600000 $PADDED_SPL_SIZE" >> "${UBOOT_SCRIPT_SRC}"
echo "nand write $SPL_MEM_ADDR 0x700000 $PADDED_SPL_SIZE" >> "${UBOOT_SCRIPT_SRC}"
echo "sunxi_nand config default" >> "${UBOOT_SCRIPT_SRC}"
echo "nand write $UBOOT_MEM_ADDR 0x800000 $PADDED_UBOOT_SIZE" >> "${UBOOT_SCRIPT_SRC}"
echo "setenv bootargs root=ubi0:rootfs rootfstype=ubifs rw earlyprintk ubi.mtd=4" >> "${UBOOT_SCRIPT_SRC}"
echo "setenv bootcmd 'source \${scriptaddr}; nand slc-mode on; mtdparts; ubi part UBI; ubifsmount ubi0:rootfs; ubifsload \$fdt_addr_r /boot/sun5i-r8-chip.dtb; ubifsload \$kernel_addr_r /boot/zImage; bootz \$kernel_addr_r - \$fdt_addr_r'" >> "${UBOOT_SCRIPT_SRC}"
echo "saveenv" >> "${UBOOT_SCRIPT_SRC}"
echo "echo going to fastboot mode" >>$UBOOT_SCRIPT_SRC
echo "fastboot" >>$UBOOT_SCRIPT_SRC
echo "echo " >>$UBOOT_SCRIPT_SRC
echo "echo *****************[ BOOT ]*****************" >>$UBOOT_SCRIPT_SRC
echo "echo " >>$UBOOT_SCRIPT_SRC
echo "boot" >>$UBOOT_SCRIPT_SRC
echo "echo going to fastboot mode" >>"${UBOOT_SCRIPT_SRC}"
echo "fastboot" >>"${UBOOT_SCRIPT_SRC}"
echo "echo " >>"${UBOOT_SCRIPT_SRC}"
echo "echo *****************[ BOOT ]*****************" >>"${UBOOT_SCRIPT_SRC}"
echo "echo " >>"${UBOOT_SCRIPT_SRC}"
echo "boot" >>"${UBOOT_SCRIPT_SRC}"
mkimage -A arm -T script -C none -n "flash CHIP" -d $UBOOT_SCRIPT_SRC $UBOOT_SCRIPT
mkimage -A arm -T script -C none -n "flash CHIP" -d "$UBOOT_SCRIPT_SRC" "$UBOOT_SCRIPT"
}
wait_for_fastboot() {
@ -113,20 +113,20 @@ ${FEL} spl $SPL
sleep 1 # wait for DRAM initialization to complete
echo == upload spl ==
${FEL} write $SPL_MEM_ADDR $PADDED_SPL
${FEL} write $SPL_MEM_ADDR "$PADDED_SPL"
echo == upload u-boot ==
${FEL} write $UBOOT_MEM_ADDR $PADDED_UBOOT
${FEL} write $UBOOT_MEM_ADDR "$PADDED_UBOOT"
echo == upload u-boot script ==
${FEL} write $UBOOT_SCRIPT_MEM_ADDR $UBOOT_SCRIPT
${FEL} write $UBOOT_SCRIPT_MEM_ADDR "$UBOOT_SCRIPT"
echo == execute the main u-boot binary ==
${FEL} exe $UBOOT_MEM_ADDR
echo == waiting for fastboot ==
if wait_for_fastboot; then
fastboot -S 0 -u flash UBI ${BUILDROOT_OUTPUT_DIR}/images/rootfs.ubi
fastboot -S 0 -u flash UBI "${BUILDROOT_OUTPUT_DIR}/images/rootfs.ubi"
fastboot continue
else
rm -rf ${TMPDIR}
rm -rf "${TMPDIR}"
exit 1
fi

View File

@ -42,63 +42,61 @@ prepare_images() {
rm $out
fi
echo ${SCRIPTDIR}/spl-image-builder -d -r 3 -u 4096 -o 1664 -p 16384 -c 1024 -s 64 $in $out
if [[ ! -e ${SCRIPTDIR}/spl-image-builder ]]; then
pushd ${SCRIPTDIR}
if [[ ! -e "${SCRIPTDIR}/spl-image-builder" ]]; then
pushd "${SCRIPTDIR}"
make
popd
fi
${SCRIPTDIR}/spl-image-builder -d -r 3 -u 4096 -o 1664 -p 16384 -c 1024 -s 64 $in $out
"${SCRIPTDIR}/spl-image-builder" -d -r 3 -u 4096 -o 1664 -p 16384 -c 1024 -s 64 "$in" "$out"
#PADDED_SPL_SIZE in pages
PADDED_SPL_SIZE=$(filesize $out)
PADDED_SPL_SIZE=$(filesize "$out")
PADDED_SPL_SIZE=$(($PADDED_SPL_SIZE / ($PAGE_SIZE + $OOB_SIZE)))
PADDED_SPL_SIZE=$(echo $PADDED_SPL_SIZE | xargs printf "0x%08x")
echo "filesize= $(filesize $out)"
echo "filesize= $(filesize "$out")"
echo "PADDED_SPL_SIZE=$PADDED_SPL_SIZE"
# Align the u-boot image on a page boundary
dd if=$UBOOT of=$PADDED_UBOOT bs=16k conv=sync
UBOOT_SIZE=`filesize $PADDED_UBOOT | xargs printf "0x%08x"`
dd if=/dev/urandom of=$PADDED_UBOOT seek=$((UBOOT_SIZE / 0x4000)) bs=16k count=$(((PADDED_UBOOT_SIZE - UBOOT_SIZE) / 0x4000))
dd if="$UBOOT" of="$PADDED_UBOOT" bs=16k conv=sync
UBOOT_SIZE=`filesize "$PADDED_UBOOT" | xargs printf "0x%08x"`
dd if=/dev/urandom of="$PADDED_UBOOT" seek=$((UBOOT_SIZE / 0x4000)) bs=16k count=$(((PADDED_UBOOT_SIZE - UBOOT_SIZE) / 0x4000))
}
prepare_uboot_script() {
if [ "$NAND_ERASE_BB" = true ] ; then
echo "nand scrub -y 0x0 0x200000000" > $UBOOT_SCRIPT_SRC
echo "nand scrub -y 0x0 0x200000000" > "${UBOOT_SCRIPT_SRC}"
else
echo "nand erase 0x0 0x200000000" > $UBOOT_SCRIPT_SRC
echo "nand erase 0x0 0x200000000" > "${UBOOT_SCRIPT_SRC}"
fi
echo "echo sunxi_nand config spl" >> $UBOOT_SCRIPT_SRC
echo "sunxi_nand config spl" >> $UBOOT_SCRIPT_SRC
echo "echo nand write.raw $SPL_MEM_ADDR 0x0 $PADDED_SPL_SIZE" >> $UBOOT_SCRIPT_SRC
echo "nand write.raw $SPL_MEM_ADDR 0x0 $PADDED_SPL_SIZE" >> $UBOOT_SCRIPT_SRC
echo "echo nand write.raw $SPL_MEM_ADDR 0x400000 $PADDED_SPL_SIZE" >> $UBOOT_SCRIPT_SRC
echo "nand write.raw $SPL_MEM_ADDR 0x400000 $PADDED_SPL_SIZE" >> $UBOOT_SCRIPT_SRC
echo "sunxi_nand config default" >> $UBOOT_SCRIPT_SRC
echo "nand write $UBOOT_MEM_ADDR 0x800000 $PADDED_UBOOT_SIZE" >> $UBOOT_SCRIPT_SRC
echo "setenv bootargs root=ubi0:rootfs rootfstype=ubifs rw earlyprintk ubi.mtd=4" >> $UBOOT_SCRIPT_SRC
echo "setenv bootcmd 'source \${scriptaddr}; nand slc-mode on; mtdparts; ubi part UBI; ubifsmount ubi0:rootfs; ubifsload \$fdt_addr_r /boot/sun5i-r8-chip.dtb; ubifsload \$kernel_addr_r /boot/zImage; bootz \$kernel_addr_r - \$fdt_addr_r'" >> $UBOOT_SCRIPT_SRC
echo "saveenv" >> $UBOOT_SCRIPT_SRC
echo "echo sunxi_nand config spl" >> "${UBOOT_SCRIPT_SRC}"
echo "sunxi_nand config spl" >> "${UBOOT_SCRIPT_SRC}"
echo "echo nand write.raw $SPL_MEM_ADDR 0x0 $PADDED_SPL_SIZE" >> "${UBOOT_SCRIPT_SRC}"
echo "nand write.raw $SPL_MEM_ADDR 0x0 $PADDED_SPL_SIZE" >> "${UBOOT_SCRIPT_SRC}"
echo "echo nand write.raw $SPL_MEM_ADDR 0x400000 $PADDED_SPL_SIZE" >> "${UBOOT_SCRIPT_SRC}"
echo "nand write.raw $SPL_MEM_ADDR 0x400000 $PADDED_SPL_SIZE" >> "${UBOOT_SCRIPT_SRC}"
echo "sunxi_nand config default" >> "${UBOOT_SCRIPT_SRC}"
echo "nand write $UBOOT_MEM_ADDR 0x800000 $PADDED_UBOOT_SIZE" >> "${UBOOT_SCRIPT_SRC}"
echo "setenv bootargs root=ubi0:rootfs rootfstype=ubifs rw earlyprintk ubi.mtd=4" >> "${UBOOT_SCRIPT_SRC}"
echo "setenv bootcmd 'source \${scriptaddr}; nand slc-mode on; mtdparts; ubi part UBI; ubifsmount ubi0:rootfs; ubifsload \$fdt_addr_r /boot/sun5i-r8-chip.dtb; ubifsload \$kernel_addr_r /boot/zImage; bootz \$kernel_addr_r - \$fdt_addr_r'" >> "${UBOOT_SCRIPT_SRC}"
echo "saveenv" >> "${UBOOT_SCRIPT_SRC}"
if [[ "${METHOD}" == "fel" ]]; then
echo "nand slc-mode on" >> $UBOOT_SCRIPT_SRC
echo "nand write.trimffs $UBI_MEM_ADDR 0x1000000 $UBI_SIZE" >> $UBOOT_SCRIPT_SRC
echo "mw \${scriptaddr} 0x0" >> $UBOOT_SCRIPT_SRC
echo "boot" >> $UBOOT_SCRIPT_SRC
echo "nand slc-mode on" >> "${UBOOT_SCRIPT_SRC}"
echo "nand write.trimffs $UBI_MEM_ADDR 0x1000000 $UBI_SIZE" >> "${UBOOT_SCRIPT_SRC}"
echo "mw \${scriptaddr} 0x0" >> "${UBOOT_SCRIPT_SRC}"
echo "boot" >> "${UBOOT_SCRIPT_SRC}"
else
echo "echo going to fastboot mode" >>$UBOOT_SCRIPT_SRC
echo "fastboot" >>$UBOOT_SCRIPT_SRC
echo "echo " >>$UBOOT_SCRIPT_SRC
echo "echo *****************[ BOOT ]*****************" >>$UBOOT_SCRIPT_SRC
echo "echo " >>$UBOOT_SCRIPT_SRC
echo "echo " >>$UBOOT_SCRIPT_SRC
echo "boot" >>$UBOOT_SCRIPT_SRC
echo "echo going to fastboot mode" >>"${UBOOT_SCRIPT_SRC}"
echo "fastboot" >>"${UBOOT_SCRIPT_SRC}"
echo "echo " >>"${UBOOT_SCRIPT_SRC}"
echo "echo *****************[ BOOT ]*****************" >>"${UBOOT_SCRIPT_SRC}"
echo "echo " >>"${UBOOT_SCRIPT_SRC}"
echo "echo " >>"${UBOOT_SCRIPT_SRC}"
echo "boot" >>"${UBOOT_SCRIPT_SRC}"
fi
mkimage -A arm -T script -C none -n "flash CHIP" -d $UBOOT_SCRIPT_SRC $UBOOT_SCRIPT
mkimage -A arm -T script -C none -n "flash CHIP" -d "${UBOOT_SCRIPT_SRC}" "${UBOOT_SCRIPT}"
}
@ -127,22 +125,22 @@ echo == upload the SPL to SRAM and execute it ==
if ! wait_for_fel; then
echo "ERROR: please make sure CHIP is connected and jumpered in FEL mode"
fi
${FEL} spl $SPL
${FEL} spl "${SPL}"
sleep 1 # wait for DRAM initialization to complete
echo == upload spl ==
${FEL} write $SPL_MEM_ADDR $PADDED_SPL
${FEL} write $SPL_MEM_ADDR "${PADDED_SPL}"
echo == upload u-boot ==
${FEL} write $UBOOT_MEM_ADDR $PADDED_UBOOT
${FEL} write $UBOOT_MEM_ADDR "${PADDED_UBOOT}"
echo == upload u-boot script ==
${FEL} write $UBOOT_SCRIPT_MEM_ADDR $UBOOT_SCRIPT
${FEL} write $UBOOT_SCRIPT_MEM_ADDR "${UBOOT_SCRIPT}"
if [[ "${METHOD}" == "fel" ]]; then
echo == upload ubi ==
${FEL} --progress write $UBI_MEM_ADDR $UBI
${FEL} --progress write $UBI_MEM_ADDR "${UBI}"
echo == execute the main u-boot binary ==
${FEL} exe $UBOOT_MEM_ADDR
@ -157,9 +155,9 @@ else
fastboot -S 0 -u flash UBI ${BUILDROOT_OUTPUT_DIR}/images/rootfs.ubi
fastboot continue
else
rm -rf ${TMPDIR}
rm -rf "${TMPDIR}"
exit 1
fi
fi
rm -rf ${TMPDIR}
rm -rf "${TMPDIR}"