首先
内核配置需要打开MTD选项
Memory Technology Devices (MTD) --->
如果是NOR Flash,需要选择Common Flash Interface (CFI)
相关的选项;而且需要配置映射首地址(和uboot中配置的flash首地址一致)、映射地址大小和位宽
<*> CFI Flash device in physical memory map
(0xff800000) Physical start address of flash mapping
(0x2000000) Physical length of flash mapping
(2) Bank width in octets
如果是NAND Flash,需要选择NAND Flash
相关的选项
修改内核文件
linux-2.6.15.b/drivers/mtd/maps/physmap.c
//linux
#define FLASH_PARTITION1_ADDR 0x00000000 //偏移地址
#define FLASH_PARTITION1_SIZE 0x001C0000 //大小
//ramdisk
#define FLASH_PARTITION2_ADDR 0x001C0000
#define FLASH_PARTITION2_SIZE 0x00240000
//ramdisk reserve
#define FLASH_PARTITION3_ADDR 0x00400000
#define FLASH_PARTITION3_SIZE 0x00380000
//uboot Environment
#define FLASH_PARTITION4_ADDR 0x00780000
#define FLASH_PARTITION4_SIZE 0x00020000
//uboot
#define FLASH_PARTITION0_ADDR 0x007A0000
#define FLASH_PARTITION0_SIZE 0x00060000
static struct mtd_partition mtd_parts[] = {
{
.name = "Bootloader",
.offset = FLASH_PARTITION0_ADDR,
.size = FLASH_PARTITION0_SIZE
},
{
.name = "Kernel image",
.offset = FLASH_PARTITION1_ADDR,
.size = FLASH_PARTITION1_SIZE
},
{
.name = "Initial ramdisk image",
.offset = FLASH_PARTITION2_ADDR,
.size = FLASH_PARTITION2_SIZE
},
{
.name = "ramdisk reserve",
.offset = FLASH_PARTITION3_ADDR,
.size = FLASH_PARTITION3_SIZE
},
{
.name = "uboot Environment",
.offset = FLASH_PARTITION4_ADDR,
.size = FLASH_PARTITION4_SIZE
},
};
#define PARTITION_COUNT (sizeof(mtd_parts)/sizeof(struct mtd_partition))
可参考地址
:https://blog.csdn.net/wenlifu71022/article/details/4334962