云题海 - 专业文章范例文档资料分享平台

当前位置:首页 > 移植Linux内核到norflash

移植Linux内核到norflash

  • 62 次阅读
  • 3 次下载
  • 2026/1/10 23:57:48

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

mymtd = do_map_probe(*type, &at91rm9200nor_map); }

if (mymtd) {

mymtd->owner = THIS_MODULE;

#ifdef CONFIG_MTD_PARTITIONS

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

if (mtd_parts_nb > 0) part_type = \;

if (mtd_parts_nb == 0) {

mtd_parts = at91rm9200nor_partitions; mtd_parts_nb = ARRAY_SIZE(at91rm9200nor_partitions);

part_type = \; } #endif

add_mtd_device(mymtd); if (mtd_parts_nb == 0)

printk(KERN_NOTICE MSG_PREFIX \partition info available\\n\);

else {

printk(KERN_NOTICE MSG_PREFIX

\%s partition definition\\n\, part_type);

//mymtd为master mtd_info它不被添加到数组mtd_table[]中,它只用于初始化 //每一个分区的mtd_info。而后将每一个分区对应的mtd_info添加到数组mtd_table[] //供上层调用。MTD原始设备驱动层的主要工作就是向 mtd_table[]中添加mtd_info。

add_mtd_partitions(mymtd, mtd_parts, mtd_parts_nb);

}

return 0; }

iounmap((void *)at91rm9200nor_map.virt); return -ENXIO; }

static void __exit cleanup_at91rm9200nor(void) {

if (mymtd) {

del_mtd_device(mymtd); map_destroy(mymtd); }

if (at91rm9200nor_map.virt) {

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

module_init(init_at91rm9200nor); module_exit(cleanup_at91rm9200nor);

MODULE_LICENSE(\);

MODULE_AUTHOR(\Groeger \);

MODULE_DESCRIPTION(\configurable MTD map driver\);

(3)配置内核

增加MTD,和相应的文件系统的支持。

Devices Drivers --->

Memory Technology Devices (MTD) --->

<*> Memory Technology Device(MTD) support <*> MTD partitioning support

<*> Direct char device access to MTD devices <*> Caching block device access to MTD devices RAM/ROM/Flash chip drivers --->

<*> Detect flash chips by Common Flash Interface(CFI) probe <*> Support for Intel/Sharp flash chips Mapping drivers for chip access ---> <*> CFI Flash device mapped on AT91RM9200 File Systems --->

Miscellaneous filesystems --->

<*>Journalling Flash File System v2 (JFFS2) support

<*>Compressed ROM file system support (cramfs)

这里选择cramfs或者Jffs2的支持。

(4)编译,然后加载

make Image编译,然后制作成uImage。

这是JFFS2作为根文件系统的信息:

TOPDIR=$($(which pwd)) TMP=$TOPDIR/linux.bin TARGET=$TOPDIR/uImage

arm-linux-objcopy -O binary -S vmlinux $TMP && gzip -v9 $TMP && \\ mkimage -n 'RAM disk' -A arm -O linux -T kernel -C gzip \\

-a 0x20008000 -e 0x20008000 -d $TMP.gz $TARGET && \\ cp $TARGET /mnt/hgfs/common && \\ rm -f $TMP*

可以看到MTD分区信息。进入shell界面,然后查看/proc/mtd,如下:

AT91RM9200-NOR:0x00800000 at 0x10000000

NOR flash on AT91RM9200DK: Found 1 x16 devices at 0x0 in 16-bit bank Intel/Sharp Extended Query Table at 0x0031 Using buffer write method

cfi_cmdset_0001: Erase suspend on write enabled AT91RM9200-NOR:using static partition definition

Creating 5 MTD partitions on \flash on AT91RM9200DK\: 0x00000000-0x00020000 : \ 0x00020000-0x00220000 : \ 0x00220000-0x00520000 : \ 0x00520000-0x007e0000 : \ 0x007e0000-0x00800000 : \

可以看到加载是正确的。

搜索更多关于: 移植Linux内核到norflash 的文档
  • 收藏
  • 违规举报
  • 版权认领
下载文档10.00 元 加入VIP免费下载
推荐下载
本文作者:...

共分享92篇相关文档

文档简介:

for(; !mymtd && *type; type++) { mymtd = do_map_probe(*type, &at91rm9200nor_map); } if (mymtd) { mymtd->owner = THIS_MODULE; #ifdef CONFIG_MTD_PARTITIONS mtd_parts_nb = parse_mtd_partitions(mymtd, probes, &mtd_parts, 0); if (mtd_parts_nb > 0) part_

× 游客快捷下载通道(下载后可以自由复制和排版)
单篇付费下载
限时特价:10 元/份 原价:20元
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219
Copyright © 云题海 All Rights Reserved. 苏ICP备16052595号-3 网站地图 客服QQ:370150219 邮箱:370150219@qq.com