Support flashing a specific device

This commit is contained in:
Wynter Woods 2015-12-02 18:10:09 -08:00
parent 76f4a4c29f
commit 80e91d3e85
1 changed files with 16 additions and 10 deletions

View File

@ -13,7 +13,7 @@ done
############################################################## ##############################################################
# main # main
############################################################## ##############################################################
TEMP=`getopt -o "sflu:" --long "fel,fastboot,loop-after-flash,stage:" -- "$@"` TEMP=`getopt -o "sflu:n:" --long "fel,fastboot,loop-after-flash,stage:,chip-path:" -- "$@"`
eval set -- "$TEMP" eval set -- "$TEMP"
while true; do while true; do
@ -49,6 +49,15 @@ while true; do
shift shift
shift shift
;; ;;
-n|--chip-path)
CHIP_PATH=$2
FEL_DEVICE="--dev $(udevadm info ${CHIP_PATH} | grep "E\: BUSNUM" | awk -F "=" '{ print $NF }'):$(udevadm info ${CHIP_PATH} | grep "E\: DEVNUM" | awk -F "=" '{ print $NF }')"
FASTBOOT_PORT="-s usb:$(udevadm info ${CHIP_PATH} | grep "P\:" | awk -F "/" '{print $NF}')"
echo "Fastboot port: ${FASTBOOT_PORT}"
echo "FEL device: ${FEL_DEVICE}"
shift
shift
;;
--) --)
shift; break;; shift; break;;
*) *)
@ -69,7 +78,7 @@ if ${RUN_ALL_STAGES}; then
done done
fi fi
FEL=fel FEL="fel ${FEL_DEVICE}"
METHOD=${METHOD:-fastboot} METHOD=${METHOD:-fastboot}
AFTER_FLASHING=${AFTER_FLASHING:-wait} AFTER_FLASHING=${AFTER_FLASHING:-wait}
@ -234,8 +243,7 @@ if [[ "${METHOD}" == "fel" ]]; then
echo == execute the main u-boot binary == echo == execute the main u-boot binary ==
${FEL} exe $UBOOT_MEM_ADDR ${FEL} exe $UBOOT_MEM_ADDR
fi fi
rm -rf "${TMPDIR}"
echo == write ubi ==
else else
if ${stage[4]}; then if ${stage[4]}; then
echo == execute the main u-boot binary == echo == execute the main u-boot binary ==
@ -243,23 +251,21 @@ else
assert_error 132 assert_error 132
fi fi
if ${stage[5]}; then if ${stage[5]}; then
echo == creating sparse image == echo == creating sparse image ==
img2simg ${UBI} ${SPARSE_UBI} $((2*1024*1024)) img2simg ${UBI} ${SPARSE_UBI} $((2*1024*1024))
assert_error 133 assert_error 133
echo == waiting for fastboot == echo == waiting for fastboot ==
if wait_for_fastboot; then if wait_for_fastboot; then
fastboot -i 0x1f3a -u flash UBI ${SPARSE_UBI} fastboot ${FASTBOOT_PORT} -i 0x1f3a -u flash UBI ${SPARSE_UBI}
assert_error 134 assert_error 134
fastboot -i 0x1f3a continue fastboot ${FASTBOOT_PORT} -i 0x1f3a continue
assert_error 135 assert_error 135
else else
rm -rf "${TMPDIR}"
exit 1 exit 1
fi fi
rm -rf "${TMPDIR}"
fi fi
fi fi
rm -rf "${TMPDIR}"