NOR FLASH掛載jfss2檔案系統

來源:互聯網
上載者:User

 

前段時間忙著找工作。項目的事情又拖了好一陣子,今天正好趁著ZTE面試的間隙把掛載JFFS2可寫檔案系統的事情解決一下,其實挺快的,半天時間理清了思路,實踐成功了呵呵

具體步驟如下:

1.核心配置:根據官網上面的兩篇文章

http://docs.blackfin.uclinux.org/doku.php?id=linux-kernel:mtd

http://docs.blackfin.uclinux.org/doku.php?id=linux-kernel:jffs

Device Drivers  --->
  Memory Technology Devices (MTD)  --->
    <*> Memory Technology Device (MTD) 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
<*> Support for RAM chips in bus mapping

<*> Support for ROM chips in bus mapping

Mapping drivers for chip access  --->
  <*> CFI Flash device in physical memory map
         (the address/length options are ignored)

File systems   --->
  Miscellaneous filesystems  --->
    <*> Journalling Flash File System v2 (JFFS2) support
           (sub-options are up to you)

以上4個子步驟完成了核心對MTD配置以及JFSS2支援的配置

2.user下面的MTD utils配置

Flash Tools   --->
  [*] mtd-utils
  [*]   erase

  [*]   eraseall
  [*]   mkfs.jff2

3.修改uClinux-dist-2008R1-RC8/linux-2.6.x/arch/blackfin/mach-bf561/boards中對應的板子初始設定檔案efevm.c

相應的mtd劃分改為

static struct mtd_partition ezkit_partitions[] = {
        {
                .name       = "Bootloader",/*uboot 256KB*/
                .size       = 0x40000,
                .offset     = 0,
        }, {
                .name       = "Kernel",/*kernel 896KB*/
                .size       = 0xE0000,
                .offset     = MTDPART_OFS_APPEND,
        }, {
                .name       = "RootFS",/*rootfs  6MB*/
                .size       = 0x600000,
                .offset     = MTDPART_OFS_APPEND,
        }, {
                .name       = "jffs2-njupt",/*jffs2 896KB*/
                .size       = MTDPART_SIZ_FULL,
                .offset     = MTDPART_OFS_APPEND,
        }
};

4.make產生核心加檔案系統的鏡像

5.uboot載入剛編譯完的核心加檔案系統

root:/> cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00040000 00020000 "bootloader"
mtd1: 000E0000 00020000 "kernel"
mtd2: 00600000 00020000 "romfs"
mtd3: 000e0000 00020000 "jffs2-njupt"

NOR FLASH分了4塊,對應mtd0至mtd3

root:/> eraseall /dev/mtd3 擦除相應的存放jffs2檔案系統的塊

root:~> mount -t jffs2 /dev/mtdblock3 /mnt/ 把該塊以jffs2格式掛載到mnt下

這樣在mnt目錄下面就能執行任何寫操作了。

6.掉電重啟,需要重新執行一遍mount -t jffs2 /dev/mtdblock3 /mnt/

把mtd3掛載到mnt下,可以發現原先建立的檔案沒有丟失!!可以把mount的部分載入到rc中,這樣每次自啟動的時候直接把mtd3掛載到mnt下面了

至此,NOR FLASH開闢空間完成JFFS2格式寫儲存的工作全部完成。:)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.