2.2. 存储配置

存储是编译的固件是否可刷机的最重要的原因,但存储的更换要修改的地方比较多,因此我们建议的方案就是按照现存的工程仿写需要 Bringup 的开发板

2.2.1. SPINAND

2.2.1.1. 型号选择

SDK 默认支持了几种 SPINAND,编译之前需要确认开发板的型号被选中支持,如果不在支持列表中, 则需要参考 SPINAND 移植指南 进行移植

uboot 和 SPL 分区一般都比较小,开启的 SPINAND 型号过多的话存储容易越界,因此建议只打开需要用到的型号即可

2.2.1.1.1. uboot

参考快速入门 - 编译概述 - Bootloader配置,进入uboot的功能配置: Device Drivers –> MTD Support 选择

(0x240000) Offset of bbt in nand
(0x40000) Range of bbt in nand
[*] Define U-boot binaries locations in SPI NAND
(0x100000) Location in SPI NAND to read U-Boot from
[ ] Support Micron SPI NAND
[ ] Support Macronix SPI NAND
[*] Support Winbond SPI NAND
[ ] Support Winbond SPI NAND CONTINUOUS READ MODE
[*] Support GigaDevice SPI NAND
[ ] Support Toshiba SPI NAND
[*] Support FudanMicro SPI NAND
[*] Support Foresee SPI NAND
[*] Support Zbit SPI NAND
[ ] Support Elite SPI NAND
[ ] Support ESMT SPI NAND
[ ] Support UMTEK SPI NAND
SPI Flash Support  --->
UBI support  --->

2.2.1.1.2. kernel

kernel 分区比较大,默认打开了 SDK 支持的所有型号,因此不用选择。

2.2.1.2. 文件系统

SPINAND 文件系统采用 UBIFS, 以 ZXM47D00 工程为例,默认会生成固件:

  • m4_ZXM47D00_nand_page_2k_block_128k_v1.0.0: page size 为 2K,大部分 SPINAND 为此类型

备注

调整分区大小时,需要同时调整固件的大小来和分区匹配

2.2.1.3. 分区

分区信息在 target/linux/m4/nand/ZXM47D00/image_cfg.json 中

"spi-nand": { // Device, The name should be the same with string in image:info:media:type
        "size": "128m", // Size of SPI NAND
        "partitions": {
            "spl":      { "size": "1m" },
            "uboot":    { "size": "1m" },
            "userid":   { "size": "256k" },
            "bbt":      { "size": "256k" },
            "env":      { "size": "256k" },
            "env_r":    { "size": "256k" },
            "falcon":   { "size": "256k" },
            "logo":     { "size": "768K" },
            "kernel":   { "size": "12m" },
            "recovery": { "size": "10m" },
            "ubiroot":  {
                "size": "32m",                          //分区大小为32m
                "ubi": { // Volume in UBI device
                    "rootfs": { "size": "-" },
                },
            },
            "ubisystem": {
                "size": "-",
                "ubi": { // Volume in UBI device
                    "ota":   { "size": "48m" },
                    "user":   { "size": "-" },
                },
            },
        }
    },

2.2.2. 成果

正确的存储配置应该能够成功支持固件烧录