Create images with different sized UBIs

chip/stable
computermouth 6 years ago
parent 2166a2871a
commit e5a6b2726a
  1. 28
      chip-create-nand-images.sh
  2. 8
      chip-update-firmware.sh
  3. 4
      common.sh

@ -22,10 +22,12 @@ prepare_ubi() {
local eraseblocksize="$5"
local pagesize="$6"
local subpagesize="$7"
local oobsize="$8"
local ebsize=`printf %x $eraseblocksize`
local psize=`printf %x $pagesize`
local ubi=$outputdir/chip-$ebsize-$psize.ubi
local sparseubi=$outputdir/chip-$ebsize-$psize.ubi.sparse
local osize=`printf %x $oobsize`
local ubi=$outputdir/chip-$ebsize-$psize-$osize.ubi
local sparseubi=$outputdir/chip-$ebsize-$psize-$osize.ubi.sparse
local mlcopts=""
if [ -z $subpagesize ]; then
@ -40,6 +42,17 @@ prepare_ubi() {
else
lebsize=$((eraseblocksize-pagesize*2))
fi
if [ "$oobsize" = "100" ]; then
#TOSH_512_SLC
volsize="448MiB"
elif [ "$oobsize" = "500" ]; then
#TOSH_4GB_MLC
volsize="3584MiB"
else
#HYNI_8GB_MLC
volsize="7168MiB"
fi
mkdir -p $rootfs
tar -xf $rootfstar -C $rootfs
@ -47,12 +60,13 @@ prepare_ubi() {
echo "[rootfs]
mode=ubi
vol_id=0
vol_size=$volsize
vol_type=dynamic
vol_name=rootfs
vol_alignment=1
vol_flags=autoresize
image=$ubifs" > $ubicfg
ubinize -o $ubi -p $eraseblocksize -m $pagesize -s $subpagesize $mlcopts $ubicfg
img2simg $ubi $sparseubi $eraseblocksize
rm -rf $tmpdir
@ -118,9 +132,11 @@ cp $ROOTFSTAR $OUTPUTDIR/
## prepare ubi images ##
# Toshiba SLC image:
prepare_ubi $OUTPUTDIR $ROOTFSTAR "slc" 2048 262144 4096 1024
# Toshiba/Hynix MLC image:
prepare_ubi $OUTPUTDIR $ROOTFSTAR "mlc" 4096 4194304 16384 16384
prepare_ubi $OUTPUTDIR $ROOTFSTAR "slc" 2048 262144 4096 1024 256
# Toshiba MLC image:
prepare_ubi $OUTPUTDIR $ROOTFSTAR "mlc" 4096 4194304 16384 16384 1280
# Hynix MLC image:
prepare_ubi $OUTPUTDIR $ROOTFSTAR "mlc" 4096 4194304 16384 16384 1664
## prepare spl images ##
# Toshiba SLC image:

@ -23,7 +23,7 @@ PROBES=(spl-40000-1000-100.bin
UBI_PREFIX="chip"
UBI_SUFFIX="ubi.sparse"
UBI_TYPE="400000-4000"
UBI_TYPE="400000-4000-680"
while getopts "sgpbfnhB:N:F:" opt; do
case $opt in
@ -130,19 +130,19 @@ function dl_probe {
export nand_erasesize=400000
export nand_oobsize=680
export nand_writesize=4000
UBI_TYPE="400000-4000"
UBI_TYPE="400000-4000-680"
;;
"Toshiba_4G_MLC")
export nand_erasesize=400000
export nand_oobsize=500
export nand_writesize=4000
UBI_TYPE="400000-4000"
UBI_TYPE="400000-4000-500"
;;
"Toshiba_512M_MLC")
export nand_erasesize=40000
export nand_oobsize=100
export nand_writesize=1000
UBI_TYPE="400000-1000"
UBI_TYPE="400000-1000-100"
;;
\?)
echo "== Invalid format: $FORMAT ==" >&2

@ -103,7 +103,7 @@ reset" > $ubootcmds
echo "NAND detected:"
cat $tmpdir/nand-info || RC=1
UBI_TYPE="$(cat $tmpdir/nand-info | awk -F= '/erase/ {print $2}')-$(cat $tmpdir/nand-info | awk -F= '/write/ {print $2}')"
UBI_TYPE="$(cat $tmpdir/nand-info | awk -F= '/erase/ {print $2}')-$(cat $tmpdir/nand-info | awk -F= '/write/ {print $2}')-$(cat $tmpdir/nand-info | awk -F= '/oob/ {print $2}')"
echo "${UBI_TYPE}" > $IMAGESDIR/ubi_type || RC=1
source $tmpdir/nand-info || RC=1
@ -196,7 +196,7 @@ flash_images() {
$FEL exe $UBOOTMEMADDR || RC=1
if wait_for_fastboot; then
fastboot -i 0x1f3a -u flash UBI $IMAGESDIR/chip-$nand_erasesize-$nand_writesize.ubi.sparse || RC=1
fastboot -i 0x1f3a -u flash UBI $IMAGESDIR/chip-$nand_erasesize-$nand_writesize-$nand_oobsize.ubi.sparse || RC=1
else
echo "failed to flash the UBI image"
RC=1

Loading…
Cancel
Save