移植Linux内核到norflash 联系客服

发布时间 : 星期一 文章移植Linux内核到norflash更新完毕开始阅读

},

/*2: Rootfs(jffs2): 0x240000-0x7f0000 0x5b0000=5824KB=5.6875MB*/ {

.name = “Rootfs(jffs2)”, .size = 0x5b0000, .offset = 0x240000, },

/*3: U-Boot Parameters: 0x7f0000-0x800000 0x10000=64KB*/ {.name = “Parameter”, .size = 0x010000, .offset = 0x7f0000, }, };

//static const char *probes[] = { “RedBoot”, “cmdlinepart”, NULL };

static const char *probes[] = { NULL }; #endif

static int mtd_parts_nb = 0;

static struct mtd_partition *mtd_parts = 0; int __init init_s3c2440nor(void) {

static const char *rom_probe_types[] = PROBETYPES; const char **type; const char *part_type = 0;

printk(KERN_NOTICE MSG_PREFIX “0xx at 0xxn”, WINDOW_SIZE, WINDOW_ADDR);

s3c2440nor_map.virt = ioremap(WINDOW_ADDR, WINDOW_SIZE);

if (!s3c2440nor_map.virt) {

printk(MSG_PREFIX “failed to ioremapn”); return -EIO; }

simple_map_init(&s3c2440nor_map); mymtd = 0;

type = rom_probe_types; for(; !mymtd && *type; type++) {

mymtd = do_map_probe(*type, &s3c2440nor_map); flash_debug(“func:%s[%d] mymtd:%x type:%sn”, __func__, __LINE__, mymtd, *type); }

if (mymtd) {

mymtd->owner = THIS_MODULE;

#ifdef CONFIG_MTD_PARTITIONS

mtd_parts_nb = parse_mtd_partitions(mymtd, probes, &mtd_parts, MTDID);

if (mtd_parts_nb > 0) part_type = “detected”;

if (mtd_parts_nb == 0){ mtd_parts = static_partitions;

mtd_parts_nb = ARRAY_SIZE(static_partitions); part_type = “static”; }

#endif add_mtd_device(mymtd);

if (mtd_parts_nb == 0)

printk(KERN_NOTICE MSG_PREFIX “no partition info availablen”); else{

printk(KERN_NOTICE MSG_PREFIX

“using %s partition definitionn”, part_type); add_mtd_partitions(mymtd, mtd_parts, mtd_parts_nb); }

return 0; }

iounmap((void *)s3c2440nor_map.virt);

return -ENXIO; }

static void __exit cleanup_s3c2440nor(void) {

if (mymtd) {

del_mtd_device(mymtd); map_destroy(mymtd); }

if (s3c2440nor_map.virt) {

iounmap((void *)s3c2440nor_map.virt); s3c2440nor_map.virt = 0; } }

module_init(init_s3c2440nor); module_exit(cleanup_s3c2440nor); MODULE_LICENSE(“GPL”);

MODULE_AUTHOR(“GengYaoJun “);

MODULE_DESCRIPTION(“Generic configurable MTD map driver”);