Hi all,
I’m currently working on porting OpenWrt to the Aruba AP-325, and while it’s mostly working so far (LAN, WLAN, LEDs, buttons etc.), I’m not certain how to handle the NAND flash layout.
Short device summary:
- SoC: Qualcomm Atheros IPQ8068
- Radio: 2x QCA9990 (one for 2.4G, one for 5G, each 4x4-MIMO)
- LAN: 2x 1GbE
- DRAM: 512 MB
- SPI Flash: 4 MB (MX25U3235F)
- NAND Flash: 128 MB (W29N01HZ)
The SPI Flash has the usual platform stuff (SBL, Calibration, TZ, APPSBL etc.) and boots into “APBoot”, which appears to be a vendor-specific, heavily customized U-Boot fork.
The NAND Flash has three MTD partitions: aos0 (32 MB), aos1 (32 MB) and ubifs (64 MB). Each of them is formatted as UBI and contains one volume with the same name.
The bootloader verifies the existence of all three volumes and re-formats if they’re not detected. It then proceeds to read aos0, verifies a vendor-specific header and boots into the uImage following the header. If the verification fails, it tries the same with aos1. On top of that, it has some helper commands - e.g. osinfo shows version info embedded in the vendor header, upgrade os fetches an image per TFTP and flashes it into aos0 , clear cache wipes ubifs etc.
The vendor firmware bundles all applications, configuration etc. into the initramfs and has no dedicated rootfs. Therefore, the aos0/aos1 partitions are self-contained, and ubifs is used as the persistence overlay.
So far, so good. I’m now at the point where I have an initramfs image that boots fine if I load it via TFTP or flash it onto aos0, but I’m struggling with the best way of partitioning the device to make the sysupgrade process elegant without breaking the bootloader’s expectations.
The best I’ve come up with so far is:
- Shrink the
aos0UBI volume in theaos0partition to ~4 MB and write the kernel into it - Create an additional
rootfsUBI volume in the same partition and write the rootfs into it - Shrink the
ubifsUBI volume in theubifspartition to 1 sector - Create an additional
rootfs_dataUBI volume in the same partition
This boots fine, but is incompatible with the current nand.sh sysupgrade logic since that expects the rootfs and rootfs_data to be on the same partition. Additionally, it seems silly to maintain the dummy ubifs volume just to make the bootloader happy, it’d be better to just make OpenWrt use the ubifs volume at the rootfs_data.
On top of all that, there’s the question of how to make proper use of the dual-image layout. The kernel part is easy since the bootloader will pick one, but it’s unclear how to make them pick the right rootfs.
Bad solutions I can think of so far:
- Write custom sysupgrade logic for the device
- Build a patched bootloader to disable the repartitioning logic
- Build a patched bootloader to support setting kernel arguments based on active partition
- Patch the kernel for this device to pick the correct rootfs
- Just ignore the whole dual image thing
So, my questions for now would be:
- Is there a way to change the name of rootfs_data?
- Is there a way to just append the rootfs to the kernel instead of having a separate partition/volume for it?
- Does this sound similar to an existing device that I could look at for reference (I couldn’t find any)?
Any other input/suggestions/etc. is of course also welcome!