Create images with different sized UBIs
This commit is contained in:
parent
2166a2871a
commit
e5a6b2726a
@ -22,10 +22,12 @@ prepare_ubi() {
|
|||||||
local eraseblocksize="$5"
|
local eraseblocksize="$5"
|
||||||
local pagesize="$6"
|
local pagesize="$6"
|
||||||
local subpagesize="$7"
|
local subpagesize="$7"
|
||||||
|
local oobsize="$8"
|
||||||
local ebsize=`printf %x $eraseblocksize`
|
local ebsize=`printf %x $eraseblocksize`
|
||||||
local psize=`printf %x $pagesize`
|
local psize=`printf %x $pagesize`
|
||||||
local ubi=$outputdir/chip-$ebsize-$psize.ubi
|
local osize=`printf %x $oobsize`
|
||||||
local sparseubi=$outputdir/chip-$ebsize-$psize.ubi.sparse
|
local ubi=$outputdir/chip-$ebsize-$psize-$osize.ubi
|
||||||
|
local sparseubi=$outputdir/chip-$ebsize-$psize-$osize.ubi.sparse
|
||||||
local mlcopts=""
|
local mlcopts=""
|
||||||
|
|
||||||
if [ -z $subpagesize ]; then
|
if [ -z $subpagesize ]; then
|
||||||
@ -41,18 +43,30 @@ prepare_ubi() {
|
|||||||
lebsize=$((eraseblocksize-pagesize*2))
|
lebsize=$((eraseblocksize-pagesize*2))
|
||||||
fi
|
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
|
mkdir -p $rootfs
|
||||||
tar -xf $rootfstar -C $rootfs
|
tar -xf $rootfstar -C $rootfs
|
||||||
mkfs.ubifs -d $rootfs -m $pagesize -e $lebsize -c $maxlebcount -o $ubifs
|
mkfs.ubifs -d $rootfs -m $pagesize -e $lebsize -c $maxlebcount -o $ubifs
|
||||||
echo "[rootfs]
|
echo "[rootfs]
|
||||||
mode=ubi
|
mode=ubi
|
||||||
vol_id=0
|
vol_id=0
|
||||||
|
vol_size=$volsize
|
||||||
vol_type=dynamic
|
vol_type=dynamic
|
||||||
vol_name=rootfs
|
vol_name=rootfs
|
||||||
vol_alignment=1
|
vol_alignment=1
|
||||||
vol_flags=autoresize
|
|
||||||
image=$ubifs" > $ubicfg
|
image=$ubifs" > $ubicfg
|
||||||
|
|
||||||
|
|
||||||
ubinize -o $ubi -p $eraseblocksize -m $pagesize -s $subpagesize $mlcopts $ubicfg
|
ubinize -o $ubi -p $eraseblocksize -m $pagesize -s $subpagesize $mlcopts $ubicfg
|
||||||
img2simg $ubi $sparseubi $eraseblocksize
|
img2simg $ubi $sparseubi $eraseblocksize
|
||||||
rm -rf $tmpdir
|
rm -rf $tmpdir
|
||||||
@ -118,9 +132,11 @@ cp $ROOTFSTAR $OUTPUTDIR/
|
|||||||
|
|
||||||
## prepare ubi images ##
|
## prepare ubi images ##
|
||||||
# Toshiba SLC image:
|
# Toshiba SLC image:
|
||||||
prepare_ubi $OUTPUTDIR $ROOTFSTAR "slc" 2048 262144 4096 1024
|
prepare_ubi $OUTPUTDIR $ROOTFSTAR "slc" 2048 262144 4096 1024 256
|
||||||
# Toshiba/Hynix MLC image:
|
# Toshiba MLC image:
|
||||||
prepare_ubi $OUTPUTDIR $ROOTFSTAR "mlc" 4096 4194304 16384 16384
|
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 ##
|
## prepare spl images ##
|
||||||
# Toshiba SLC image:
|
# Toshiba SLC image:
|
||||||
|
@ -23,7 +23,7 @@ PROBES=(spl-40000-1000-100.bin
|
|||||||
|
|
||||||
UBI_PREFIX="chip"
|
UBI_PREFIX="chip"
|
||||||
UBI_SUFFIX="ubi.sparse"
|
UBI_SUFFIX="ubi.sparse"
|
||||||
UBI_TYPE="400000-4000"
|
UBI_TYPE="400000-4000-680"
|
||||||
|
|
||||||
while getopts "sgpbfnhB:N:F:" opt; do
|
while getopts "sgpbfnhB:N:F:" opt; do
|
||||||
case $opt in
|
case $opt in
|
||||||
@ -130,19 +130,19 @@ function dl_probe {
|
|||||||
export nand_erasesize=400000
|
export nand_erasesize=400000
|
||||||
export nand_oobsize=680
|
export nand_oobsize=680
|
||||||
export nand_writesize=4000
|
export nand_writesize=4000
|
||||||
UBI_TYPE="400000-4000"
|
UBI_TYPE="400000-4000-680"
|
||||||
;;
|
;;
|
||||||
"Toshiba_4G_MLC")
|
"Toshiba_4G_MLC")
|
||||||
export nand_erasesize=400000
|
export nand_erasesize=400000
|
||||||
export nand_oobsize=500
|
export nand_oobsize=500
|
||||||
export nand_writesize=4000
|
export nand_writesize=4000
|
||||||
UBI_TYPE="400000-4000"
|
UBI_TYPE="400000-4000-500"
|
||||||
;;
|
;;
|
||||||
"Toshiba_512M_MLC")
|
"Toshiba_512M_MLC")
|
||||||
export nand_erasesize=40000
|
export nand_erasesize=40000
|
||||||
export nand_oobsize=100
|
export nand_oobsize=100
|
||||||
export nand_writesize=1000
|
export nand_writesize=1000
|
||||||
UBI_TYPE="400000-1000"
|
UBI_TYPE="400000-1000-100"
|
||||||
;;
|
;;
|
||||||
\?)
|
\?)
|
||||||
echo "== Invalid format: $FORMAT ==" >&2
|
echo "== Invalid format: $FORMAT ==" >&2
|
||||||
|
@ -103,7 +103,7 @@ reset" > $ubootcmds
|
|||||||
|
|
||||||
echo "NAND detected:"
|
echo "NAND detected:"
|
||||||
cat $tmpdir/nand-info || RC=1
|
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
|
echo "${UBI_TYPE}" > $IMAGESDIR/ubi_type || RC=1
|
||||||
source $tmpdir/nand-info || RC=1
|
source $tmpdir/nand-info || RC=1
|
||||||
|
|
||||||
@ -196,7 +196,7 @@ flash_images() {
|
|||||||
$FEL exe $UBOOTMEMADDR || RC=1
|
$FEL exe $UBOOTMEMADDR || RC=1
|
||||||
|
|
||||||
if wait_for_fastboot; then
|
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
|
else
|
||||||
echo "failed to flash the UBI image"
|
echo "failed to flash the UBI image"
|
||||||
RC=1
|
RC=1
|
||||||
|
Loading…
Reference in New Issue
Block a user