您尚未登录。

楼主 #1 2019-12-23 16:09:16

notepad--
会员
注册时间: 2019-12-07
已发帖子: 24
积分: 24

分享一个V3s bsp Linux 3.4 spi nor flash 修改分区参数的方法, 抛砖引玉,请问有没有更好的方法

分享一个V3s bsp Linux 3.4 spi nor flash 修改分区参数的方法, 抛砖引玉,请问有没有更好的方法,

比如主线Linux那种 bootargs 后者 dts 传参自动生成分区?


这个帖子太长了: licheepi zero BSP 内核(linux3.4) 编译教程 https://whycan.cn/t_682.html

重起一个新的

/* Register the whole NorFlash as a partition. */
static int partition_register(struct mtd_info *mtd, struct mtd_part_parser_data *ppdata)
{
        struct mtd_partition partitions[] = {
                {
                .name = "NorFlash part0",
                .offset = 0,
                .size = MTDPART_SIZ_FULL
                }};

        return mtd_device_parse_register(mtd, NULL, ppdata, partitions, 1);
}

根据板子实际情况,改成如下即可 ===>

/* Register the whole NorFlash as a partition. */
static int partition_register(struct mtd_info *mtd, struct mtd_part_parser_data *ppdata)
{
        struct mtd_partition partitions[] = {
                {
                        .name = "u-boot",
                        .offset = 0,
                        .size = SZ_512K
                },
                {
                        .name = "sys_config",
                        .offset = 0x80000,
                        .size = SZ_512K
                },
                {
                        .name = "kernel",
                        .offset = 0x100000,
                        .size = 3*SZ_1M
                },
                {
                        .name = "rootfs",
                        .offset = 0x400000,
                        .size = 12*SZ_1M
                }
        };

        return mtd_device_parse_register(mtd, NULL, ppdata, partitions, sizeof(partitions)/sizeof(struct mtd_partition));
}

离线

#2 2020-09-22 18:37:25

henman
会员
注册时间: 2020-09-10
已发帖子: 23
积分: 23

Re: 分享一个V3s bsp Linux 3.4 spi nor flash 修改分区参数的方法, 抛砖引玉,请问有没有更好的方法

选中:Device Drivers  ---><*> Memory Technology Device (MTD) support  ---> [*]   Command line partition table parsing
uboot中设置环境变量:setenv bootargs 'console=ttyS0,115200 root=/dev/mtdblock4 rootfstype=squashfs mtdparts=spi0.0:992K(uboot),32K(ubootenv),64K(dtb),4032K(kernel),11M(rootfs)'
启动时候内核打印以下信息就算是ok了。忽略我的size异常导致的打印吧。
[    0.833578] 5 cmdlinepart partitions found on MTD device spi0.0
[    0.840254] Creating 5 MTD partitions on "spi0.0":
[    0.845754] 0x000000000000-0x0000000f8000 : "uboot"
[    0.851279] mtd: partition "uboot" doesn't end on an erase block -- force read-only
[    0.860979] 0x0000000f8000-0x000000100000 : "ubootenv"
[    0.866815] mtd: partition "ubootenv" doesn't start on an erase block boundary -- force read-only
[    0.877720] 0x000000100000-0x000000110000 : "dtb"
[    0.884033] 0x000000110000-0x000000500000 : "kernel"
[    0.890646] 0x000000500000-0x000001000000 : "rootfs"

离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn