|
NUC980 Chili Board + Linux 5.10 + Buildroot 2024 This article documents a working setup to use UBIFS as the root filesystem on SPI NOR flash (Winbond W25Q256, 32 MB) on the NUC980 Chili board.
1. Preparation Strongly recommended: clone a fresh Buildroot repository to avoid residual kernel / rootfs artifacts inflating the image. $ git clone https://github.com/OpenNuvoton/buildroot_2024
$ cd buildroot_2024
$ make nuvoton_nuc980_chili_defconfig
2. Buildroot Configuration (RootFS = UBIFS) Enter Buildroot menuconfig: $ make menuconfig 2.1 Remove RAM filesystem (initramfs) Disable initramfs completely: Filesystem images --->
[ ] initial RAM filesystem linked into linux kernel
[ ] cpio the root filesystem (for use as an initial RAM filesystem) 2.2 Enable UBIFS image Enable UBIFS as the root filesystem: Filesystem images --->
ubi image containing an ubifs root filesystem 2.3 UBIFS parameters for W25Q256 (SPI NOR, 32 MB) Configure UBIFS with parameters matching the SPI NOR erase geometry:
64 KB erase sector (W25Q256)
Maximum logical eraseblock count
Additional mkfs.ubifs options
These settings are critical. If they don’t match the flash erase size, UBIFS will fail at mount time.
3. Linux Kernel Configuration (5.10) $ make linux-menuconfig 3.1 Remove initramfs support General setup --->
[ ] Boot config support
[ ] Initial RAM filesystem and RAM disk (initramfs/initrd) support Kernel must not expect an initramfs since rootfs lives on SPI NOR. 3.2 Enable MTD / UBI / SPI NOR Device Drivers --->
Memory Technology Device (MTD) support --->
Partition parsers --->
<*> Command line partition table parsing
Enable UBI - Unsorted block images --->
UBI Fastmap (experimental feature)
SPI NOR device support --->
[ ] Use small 4096 B erase sectors Key points: - Command line partition parsing is required for ubi.mtd=.
- Disable 4K erase sectors – W25Q256 uses 64 KB erase blocks.
- UBI Fastmap significantly improves mount time on NOR.
4. Device Tree: SPI NOR Partition Layout Edit the buildroot_2024/output/build/linux-custom/arch/arm/boot/dts/nuc980-chili.dts to define SPI NOR partitions in the DTS. qspi0: spi@b0060000 {
status = "okay";
flash: flash@0 {
compatible = "jedec,spi-nor";
#address-cells = <1>;
#size-cells = <1>;
reg = <0>;
spi-max-frequency = <30000000>;
partition@0 {
label = "uboot";
reg = <0x00000000 0x00100000>;
};
partition@1 {
label = "kernel";
reg = <0x00200000 0x00600000>;
};
partition@2 {
label = "rootfs";
reg = <0x00800000 0x01800000>;
};
};
}; 5. U-Boot Environment (env.txt) Create a env.txt file with the following contents: baudrate=115200
bootdelay=1
stderr=serial
stdin=serial
stdout=serial
setspi=sf probe 0 30000000
loadkernel=sf read 0x7fc0 0x200000 0x600000
loaddtb=sf read 0x1800000 0xA0000 0x10000
bootcmd=run setspi;run loadkernel;run loaddtb;bootm 0x7fc0 - 0x1800000
bootargs=noinitrd ubi.mtd=2 root=ubi0:rootfs rootfstype=ubifs rw console=ttyS0 rdinit=/sbin/init mem=64M Notes - ubi.mtd=2 → rootfs is partition@2
- noinitrd → mandatory
- root=ubi0:rootfs → UBIFS volume name
- Kernel loads from SPI NOR, no RAM disk involved
6. Build and Flash Images Build everything: $ make After build completes, flash the following images to SPI NOR:
7. Result If everything is configured correctly: - UBI attaches to mtd2
- UBIFS mounts as /
- No initramfs
- Stable rootfs on W25Q256
- UBIFS has approximately 10% to 15% additional overhead, so with 24MB of space, you'll have 20MB of usable space.
|