enable sparse image & define vendor id for fastboot

chip/stable
Alex Kaplan 7 years ago
parent 34f162379c
commit 3479cab875
  1. 2
      chip-fel-fastboot.sh
  2. 28
      chip-fel-flash.sh
  3. 7
      chip-update-firmware.sh
  4. 3
      common.sh

@ -79,7 +79,7 @@ prepare_uboot_script() {
echo "saveenv" >> "${UBOOT_SCRIPT_SRC}"
echo "echo going to fastboot mode" >>"${UBOOT_SCRIPT_SRC}"
echo "fastboot" >>"${UBOOT_SCRIPT_SRC}"
echo "fastboot 0" >>"${UBOOT_SCRIPT_SRC}"
echo "echo " >>"${UBOOT_SCRIPT_SRC}"
echo "echo *****************[ BOOT ]*****************" >>"${UBOOT_SCRIPT_SRC}"
echo "echo " >>"${UBOOT_SCRIPT_SRC}"

@ -53,6 +53,7 @@ PADDED_UBOOT="$TMPDIR/padded-uboot"
PADDED_UBOOT_SIZE=0xc0000
UBOOT_MEM_ADDR=0x4a000000
UBI="$BUILDROOT_OUTPUT_DIR/images/rootfs.ubi"
SPARSE_UBI="${TMPDIR}/rootfs.ubi.sparse"
UBI_MEM_ADDR=0x4b000000
UBI_SIZE=`filesize $UBI | xargs printf "0x%08x"`
@ -85,25 +86,23 @@ prepare_uboot_script() {
else
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 "echo nand write.raw.noverify $SPL_MEM_ADDR 0x0 $PADDED_SPL_SIZE" >> "${UBOOT_SCRIPT_SRC}"
echo "nand write.raw.noverify $SPL_MEM_ADDR 0x0 $PADDED_SPL_SIZE" >> "${UBOOT_SCRIPT_SRC}"
echo "echo nand write.raw.noverify $SPL_MEM_ADDR 0x400000 $PADDED_SPL_SIZE" >> "${UBOOT_SCRIPT_SRC}"
echo "nand write.raw.noverify $SPL_MEM_ADDR 0x400000 $PADDED_SPL_SIZE" >> "${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 "nand write.slc-mode.trimffs $UBI_MEM_ADDR 0x1000000 $UBI_SIZE" >> "${UBOOT_SCRIPT_SRC}"
echo "mw \${scriptaddr} 0x0" >> "${UBOOT_SCRIPT_SRC}"
else
echo "echo going to fastboot mode" >>"${UBOOT_SCRIPT_SRC}"
echo "fastboot" >>"${UBOOT_SCRIPT_SRC}"
echo "fastboot 0" >>"${UBOOT_SCRIPT_SRC}"
fi
if [[ "${AFTER_FLASHING}" == "boot" ]]; then
@ -155,11 +154,14 @@ if [[ "${METHOD}" == "fel" ]]; then
else
echo == execute the main u-boot binary ==
${FEL} exe $UBOOT_MEM_ADDR
echo == creating sparse image ==
img2simg ${UBI} ${SPARSE_UBI} $((2*1024*1024))
echo == waiting for fastboot ==
if wait_for_fastboot; then
fastboot -S 0 -u flash UBI ${BUILDROOT_OUTPUT_DIR}/images/rootfs.ubi
fastboot continue
fastboot -i 0x1f3a -u flash UBI ${SPARSE_UBI}
fastboot -i 0x1f3a continue
else
rm -rf "${TMPDIR}"
exit 1

@ -3,6 +3,12 @@
SCRIPTDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
source $SCRIPTDIR/common.sh
if ! wait_for_fel; then
echo "ERROR: please jumper your CHIP in FEL mode then power on"
exit 1
fi
FLASH_SCRIPT=./chip-fel-flash.sh
WHAT=buildroot
BRANCH=stable
@ -120,7 +126,6 @@ BUILDROOT_OUTPUT_DIR="${FW_DIR}" ${FLASH_SCRIPT} ${FLASH_SCRIPT_OPTION} || echo
if ! wait_for_linuxboot; then
echo "ERROR: could not flash"
rm -rf ${TMPDIR}
exit 1
else
${SCRIPTDIR}/verify.sh

@ -1,6 +1,7 @@
#!/bin/bash
TIMEOUT=30
FEL=fel
#------------------------------------------------------------
onMac() {
@ -24,7 +25,7 @@ filesize() {
wait_for_fastboot() {
echo -n "waiting for fastboot...";
for ((i=$TIMEOUT; i>0; i--)) {
if [[ ! -z "$(fastboot devices)" ]]; then
if [[ ! -z "$(fastboot -i 0x1f3a devices)" ]]; then
echo "OK";
return 0;
fi

Loading…
Cancel
Save