資源描述:
《移植Linux內(nèi)核到norflash》由會(huì)員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在教育資源-天天文庫(kù)。
1、開發(fā)板上只有Nor?Flash,所以為了實(shí)現(xiàn)層次文件系統(tǒng),需要為L(zhǎng)inux2.6.20增加Nor?Flash?MTD驅(qū)動(dòng)支持。其實(shí)工作量并不大,因?yàn)橐呀?jīng)有現(xiàn)成的程序可供參考。?????MTD的驅(qū)動(dòng)程序都集中在drivers/mtd里面。我們需要做的,僅僅是在drivers/mtd/maps下增加自己的分區(qū)表。因?yàn)橛袇⒖嫉拇a,所以比較容易。?(1)構(gòu)建配置選項(xiàng)?????首先,根據(jù)edb7312.c構(gòu)建自己的mtd分區(qū)表驅(qū)動(dòng)(根據(jù)cfi_flagadm.c這個(gè)文件也可以?shī)W,看情況吧!)。?$cd?drivers/mtd/m
2、aps/$cp?edb7312.c?at91rm9200.c?????然后,修改drivers/mtd/maps/Kconfig,增加自己的配置選項(xiàng)。?//拷貝過EDB7312稍作修改即可config?MTD_AT91RM9200????????tristate?"CFI?Flash?device?mapped?on?AT91RM9200"????????depends?on?ARM?&&?MTD_CFI????????help??????????This?enables?access?to?the?CFI?Flash?
3、on?the?ATMEL?AT91RM9200DK?board.??????????If?you?have?such?a?board,?say?'Y'?here.?????最后,修改Makefile,增加編譯項(xiàng)目。obj-$(CONFIG_MTD_EDB7312)?+=?edb7312.oobj-$(CONFIG_MTD_AT91RM9200)?+=?at91rm9200.o?????這樣,自己建立的MTD分區(qū)表驅(qū)動(dòng)就可以編譯進(jìn)內(nèi)核了。?(2)修改分區(qū)表信息?????因?yàn)榈谝徊降墓ぷ髦?,at91rm9200.c實(shí)際上還是
4、edb7312.c的內(nèi)容,所以需要根據(jù)自己的開發(fā)板nor?flash的配置做一下修改。?#include?#include?#include?#include?#include?#include?#include?#ifdef?CONFIG_MTD_PARTITIONS#include?5、titions.h>#endif#define?WINDOW_ADDR?0x10000000?/*?physical?properties?of?flash?*/#define?WINDOW_SIZE?0x00800000?/*?intel?28F640J3A?8MB?*/#define?BUSWIDTH?2?/*?data?bus?width?16bits?*//*?can?be?"cfi_probe",?"jedec_probe",?"map_rom",?NULL?};?*/#define?PROBETYPES?{?
6、"cfi_probe",?NULL?}#define?MSG_PREFIX?"AT91RM9200-NOR:"?/*?prefix?for?our?printk()'s?*/#define?MTDID?"at91rm9200-%d"?/*?for?mtdparts=?partitioning?*/static?struct?mtd_info?*mymtd;struct?map_info?at91rm9200nor_map?=?{????????.name?=?"NOR?flash?on?AT91RM9200DK",???
7、?????.size?=?WINDOW_SIZE,????????.bankwidth?=?BUSWIDTH,????????.phys?=?WINDOW_ADDR,};#ifdef?CONFIG_MTD_PARTITIONS/*?*?MTD?partitioning?stuff?*/static?struct?mtd_partition?at91rm9200nor_partitions[5]?={????????{????????????????//?U-boot?128KB????????????????.name?
8、=?"U-boot",????????????????.size?=?0x20000,????????????????.offset?=?0????????},????????{????????????????//?uImage?2MB????????????????.name?=?"Kernel",????????