#!/bin/sh

#
# mkffs -- make flash filesystem for AC8300 NAND
#
# Create and partition a UBI flash region over most of the nand flash.
# This is best for UBI, we want bad blocking and wear leveling over most
# of the flash for best results.
#

MTDEVICE=/dev/mtd2
UBINUM=0
UBIDEVICE=/dev/ubi0

# Check if we are running from mounted root on UBI first?

#
# Creat and attach the single large UBI region.
#
ubiformat $MTDEVICE
ubiattach -p $MTDEVICE -d $UBINUM

#
# Create the filesystem partitions we want.
#
ubimkvol $UBIDEVICE -N recover -s 16MiB
ubimkvol $UBIDEVICE -N image -s 48MiB
ubimkvol $UBIDEVICE -N config -s 16MiB

exit 0
