分享一个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));
}
离线