Tabs to spaces, proper ubootscr flavor detection
This commit is contained in:
parent
02fee4d567
commit
dff8a1fdac
@ -25,7 +25,7 @@ UBI_PREFIX="chip"
|
||||
UBI_SUFFIX="ubi.sparse"
|
||||
UBI_TYPE="400000-4000"
|
||||
|
||||
while getopts "sgpbhB:N:F:" opt; do
|
||||
while getopts "sgpbfhB:N:F:" opt; do
|
||||
case $opt in
|
||||
s)
|
||||
echo "== Server selected =="
|
||||
@ -43,6 +43,10 @@ while getopts "sgpbhB:N:F:" opt; do
|
||||
echo "== Buildroot selected =="
|
||||
FLAVOR=buildroot
|
||||
;;
|
||||
f)
|
||||
echo "== Force clean and download =="
|
||||
rm -rf .dl/ .new/
|
||||
;;
|
||||
B)
|
||||
BRANCH="$OPTARG"
|
||||
echo "== ${BRANCH} branch selected =="
|
||||
@ -63,6 +67,7 @@ while getopts "sgpbhB:N:F:" opt; do
|
||||
echo " -g -- GUI [Debian + XFCE]"
|
||||
echo " -p -- PocketCHIP"
|
||||
echo " -b -- Buildroot"
|
||||
echo " -f -- Force clean"
|
||||
echo " -B -- Branch(optional) [eg. -B testing]"
|
||||
echo " -N -- Build#(optional) [eg. -N 150]"
|
||||
echo " -F -- Format(optional) [eg. -F Toshiba_4G_MLC]"
|
||||
@ -85,74 +90,74 @@ function require_directory {
|
||||
|
||||
function dl_probe {
|
||||
|
||||
if [ -z $CACHENUM ]; then
|
||||
CACHENUM=$(curl -s $DL_URL/$BRANCH/$FLAVOR/latest)
|
||||
fi
|
||||
if [ -z $CACHENUM ]; then
|
||||
CACHENUM=$(curl -s $DL_URL/$BRANCH/$FLAVOR/latest)
|
||||
fi
|
||||
|
||||
if [[ ! -d "$DL_DIR/$BRANCH-$FLAVOR-b${CACHENUM}" ]]; then
|
||||
echo "== New image available =="
|
||||
|
||||
rm -rf $DL_DIR/$BRANCH-$FLAVOR*
|
||||
|
||||
mkdir -p $DL_DIR/${BRANCH}-${FLAVOR}-b${CACHENUM}
|
||||
pushd $DL_DIR/${BRANCH}-${FLAVOR}-b${CACHENUM} > /dev/null
|
||||
|
||||
echo "== Downloading.. =="
|
||||
for FILE in ${PROBES[@]}; do
|
||||
if ! $WGET $DL_URL/$BRANCH/$FLAVOR/${CACHENUM}/$FILE; then
|
||||
echo "!! download of $BRANCH-$FLAVOR-$METHOD-b${CACHENUM} failed !!"
|
||||
exit $?
|
||||
fi
|
||||
done
|
||||
popd > /dev/null
|
||||
else
|
||||
echo "== Cached probe files located =="
|
||||
fi
|
||||
if [[ ! -d "$DL_DIR/$BRANCH-$FLAVOR-b${CACHENUM}" ]]; then
|
||||
echo "== New image available =="
|
||||
|
||||
rm -rf $DL_DIR/$BRANCH-$FLAVOR*
|
||||
|
||||
mkdir -p $DL_DIR/${BRANCH}-${FLAVOR}-b${CACHENUM}
|
||||
pushd $DL_DIR/${BRANCH}-${FLAVOR}-b${CACHENUM} > /dev/null
|
||||
|
||||
echo "== Downloading.. =="
|
||||
for FILE in ${PROBES[@]}; do
|
||||
if ! $WGET $DL_URL/$BRANCH/$FLAVOR/${CACHENUM}/$FILE; then
|
||||
echo "!! download of $BRANCH-$FLAVOR-$METHOD-b${CACHENUM} failed !!"
|
||||
exit $?
|
||||
fi
|
||||
done
|
||||
popd > /dev/null
|
||||
else
|
||||
echo "== Cached probe files located =="
|
||||
fi
|
||||
|
||||
echo "== Staging for NAND probe =="
|
||||
ln -s ../../$DL_DIR/${BRANCH}-${FLAVOR}-b${CACHENUM}/ $IMAGESDIR
|
||||
if [[ -f ${IMAGESDIR}/ubi_type ]]; then rm ${IMAGESDIR}/ubi_type; fi
|
||||
echo "== Staging for NAND probe =="
|
||||
ln -s ../../$DL_DIR/${BRANCH}-${FLAVOR}-b${CACHENUM}/ $IMAGESDIR
|
||||
if [[ -f ${IMAGESDIR}/ubi_type ]]; then rm ${IMAGESDIR}/ubi_type; fi
|
||||
|
||||
if [ -z $FORMAT ]; then
|
||||
detect_nand
|
||||
else
|
||||
case $FORMAT in
|
||||
"Hynix_8G_MLC")
|
||||
export nand_erasesize=400000
|
||||
export nand_oobsize=680
|
||||
export nand_writesize=4000
|
||||
UBI_TYPE="400000-4000"
|
||||
;;
|
||||
"Toshiba_4G_MLC")
|
||||
export nand_erasesize=400000
|
||||
export nand_oobsize=500
|
||||
export nand_writesize=4000
|
||||
UBI_TYPE="400000-4000"
|
||||
;;
|
||||
"Toshiba_512M_MLC")
|
||||
export nand_erasesize=40000
|
||||
export nand_oobsize=100
|
||||
export nand_writesize=1000
|
||||
UBI_TYPE="400000-1000"
|
||||
;;
|
||||
\?)
|
||||
echo "== Invalid format: $FORMAT ==" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if [ -z $FORMAT ]; then
|
||||
detect_nand
|
||||
else
|
||||
case $FORMAT in
|
||||
"Hynix_8G_MLC")
|
||||
export nand_erasesize=400000
|
||||
export nand_oobsize=680
|
||||
export nand_writesize=4000
|
||||
UBI_TYPE="400000-4000"
|
||||
;;
|
||||
"Toshiba_4G_MLC")
|
||||
export nand_erasesize=400000
|
||||
export nand_oobsize=500
|
||||
export nand_writesize=4000
|
||||
UBI_TYPE="400000-4000"
|
||||
;;
|
||||
"Toshiba_512M_MLC")
|
||||
export nand_erasesize=40000
|
||||
export nand_oobsize=100
|
||||
export nand_writesize=1000
|
||||
UBI_TYPE="400000-1000"
|
||||
;;
|
||||
\?)
|
||||
echo "== Invalid format: $FORMAT ==" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if [[ ! -f "$DL_DIR/$BRANCH-$FLAVOR-b${CACHENUM}/$UBI_PREFIX-$UBI_TYPE.$UBI_SUFFIX" ]]; then
|
||||
echo "== Downloading new UBI, this will be cached for future flashes. =="
|
||||
pushd $DL_DIR/${BRANCH}-${FLAVOR}-b${CACHENUM} > /dev/null
|
||||
if ! $WGET $DL_URL/$BRANCH/$FLAVOR/${CACHENUM}/$UBI_PREFIX-$UBI_TYPE.$UBI_SUFFIX; then
|
||||
echo "!! download of $BRANCH-$FLAVOR-$METHOD-b${CACHENUM} failed !!"
|
||||
exit $?
|
||||
fi
|
||||
popd > /dev/null
|
||||
else
|
||||
echo "== Cached UBI located =="
|
||||
fi
|
||||
if [[ ! -f "$DL_DIR/$BRANCH-$FLAVOR-b${CACHENUM}/$UBI_PREFIX-$UBI_TYPE.$UBI_SUFFIX" ]]; then
|
||||
echo "== Downloading new UBI, this will be cached for future flashes. =="
|
||||
pushd $DL_DIR/${BRANCH}-${FLAVOR}-b${CACHENUM} > /dev/null
|
||||
if ! $WGET $DL_URL/$BRANCH/$FLAVOR/${CACHENUM}/$UBI_PREFIX-$UBI_TYPE.$UBI_SUFFIX; then
|
||||
echo "!! download of $BRANCH-$FLAVOR-$METHOD-b${CACHENUM} failed !!"
|
||||
exit $?
|
||||
fi
|
||||
popd > /dev/null
|
||||
else
|
||||
echo "== Cached UBI located =="
|
||||
fi
|
||||
}
|
||||
|
||||
echo == preparing images ==
|
||||
|
@ -136,7 +136,7 @@ flash_images() {
|
||||
echo "setenv splashpos m,m" >> $ubootcmds
|
||||
|
||||
echo "echo Configuring Video Mode" >> $ubootcmds
|
||||
if [ "$PLATFORM" = "PocketCHIP" ]; then
|
||||
if [ "$FLAVOR" = "pocketchip" ]; then
|
||||
echo "setenv bootargs root=ubi0:rootfs rootfstype=ubifs rw ubi.mtd=4 quiet lpj=501248 loglevel=3 splash plymouth.ignore-serial-consoles" >> $ubootcmds
|
||||
echo "setenv bootpaths 'initrd noinitrd'" >> $ubootcmds
|
||||
echo "setenv bootcmd 'run test_fastboot; if test -n \${fel_booted} && test -n \${scriptaddr}; then echo (FEL boot); source \${scriptaddr}; fi; for path in \${bootpaths}; do run boot_\$path; done'" >> $ubootcmds
|
||||
@ -157,7 +157,7 @@ flash_images() {
|
||||
echo "fastboot 0" >> $ubootcmds
|
||||
echo "reset" >> $ubootcmds
|
||||
|
||||
mkimage -A arm -T script -C none -n "flash $PLATFORM" -d $ubootcmds $ubootscr
|
||||
mkimage -A arm -T script -C none -n "flash $FLAVOR" -d $ubootcmds $ubootscr
|
||||
|
||||
if ! wait_for_fel; then
|
||||
echo "ERROR: please make sure CHIP is connected and jumpered in FEL mode"
|
||||
|
Loading…
Reference in New Issue
Block a user