Thanks a lot! I later found this dts file and a more detailed flash layout of WRT1900ACS.
After about 20h's investigation, I finally made it to use the whole NAND and not recompiling the openwrt.
I'll enclose an instruction here for those who needed.
WARNING: these instruction are for expert users only. Serial connection is needed. Sysupgrade will be unusable. U-Boot could be destroyed, leading to bricked device if you operated on the wrong NAND device. Please don't follow the instruction unless you fully understand what's going on.
- First of all, backup everything(sysdiag and syscfg): use either use the mtd command manually or use the backup feature in LuCI, in case they are useful.
- To make our life easier, we also backup the ubi volumes here using the following commands
dd if=/dev/ubi0_0 of=/tmp/ubi0_0.img
dd if=/dev/ubi0_1 of=/tmp/ubi0_1.img
- If you had a look at the sysdiag volume you can see that there's nothing (all of 0xFF), so things become easy now as we can merge everything into a big rootfs
- Access the U-Boot console through TTL serial, and first of all we disable the auto_recovery feature
setenv auto_recovery no
save
- Then we'll execute the mtdparts to partition our flash
setenv mtdids
setenv mtdparts
setenv mtdids nand1=spi0.1
mtdparts add nand1 0x8000000 kernel
mtdparts add nand1 0x7d00000@0x300000 rootfs
(note the nand1 here is from the output of nand info)
- After partition we'll make the ubi volume and ubifs
ubi part rootfs
ubi create rootfs 0x26c000
ubi create rootfs_data
You can see the following output if successful:
(EA6350v3) # ubi create rootfs 0x26c000
Creating dynamic volume rootfs of size 2539520
(EA6350v3) # ubi create rootfs_data
No size specified -> Using max size (122658816)
Creating dynamic volume rootfs_data of size 122658816
(EA6350v3) # ubi info l
UBI: volume information dump:
UBI: vol_id 0
UBI: reserved_pebs 20
UBI: alignment 1
UBI: data_pad 0
UBI: vol_type 3
UBI: name_len 6
UBI: usable_leb_size 126976
UBI: used_ebs 20
UBI: used_bytes 2539520
UBI: last_eb_bytes 126976
UBI: corrupted 0
UBI: upd_marker 0
UBI: name rootfs
UBI: volume information dump:
UBI: vol_id 1
UBI: reserved_pebs 966
UBI: alignment 1
UBI: data_pad 0
UBI: vol_type 3
UBI: name_len 11
UBI: usable_leb_size 126976
UBI: used_ebs 966
UBI: used_bytes 122658816
UBI: last_eb_bytes 126976
UBI: corrupted 0
UBI: upd_marker 0
UBI: name rootfs_data
UBI: volume information dump:
UBI: vol_id 2147479551
UBI: reserved_pebs 2
UBI: alignment 1
UBI: data_pad 0
UBI: vol_type 3
UBI: name_len 13
UBI: usable_leb_size 126976
UBI: used_ebs 2
UBI: used_bytes 253952
UBI: last_eb_bytes 2
UBI: corrupted 0
UBI: upd_marker 0
UBI: name layout volume
- Then we can recover our backup of ubifs
tftpboot 82000000 test_0_0.ubi
ubi write 82000000 rootfs 26c000
tftpboot 83000000 test_0_1.ubi
ubi write 83000000 rootfs_data 1e84000
- Then we need to setup the bootargs
# First we backup the old bootart
setenv partbootargs_old $partbootargs
# Then we overwrite with new one
setenv partbootargs_old "init=/sbin/init $mtdparts ubi.mtd=11,2048 ubi.block=0,0 root=/dev/ubiblock0_0 rootwait ro"
save
- Now we can try to boot again
run bootpart1
- As you can see, the ubi volume is resized, however the fs refused to resize, so I entered the failsafe mode and did a full copy
# In failsafe console
mkdir /tmp/ubi01
mount -t ubifs /dev/ubi0_1 /tmp/ubi01
mkdir /tmp/ubi01_bak
cp -a /tmp/ubi01 /tmp/ubi01_bak
umount /tmp/ubi01
ubiupdatevol /dev/ubi0_1 -t
mount -t ubifs /dev/ubi0_1 /tmp/ubi01
cp -a /tmp/ubi01_bak/* /tmp
umount /tmp/ubi01
(I'm not that familiar with cp command and please adapt your command accordingly)
- Done!