NAND flash (SBC-i.MX51)

 

https://support.bluetechnix.at/wiki/NAND_flash_(SBC-i.MX51)

 

NAND flash (SBC-i.MX51)

From BlueWiki

Jump to: navigation , search
This page is work in progress , and may be incomplete and/or unreliable.

The SBC provides 2 GiB of NAND flash.

Contents

[hide ]

1 Linux kernel configuration

System Type  --->
Freescale MXC Implementations --->
MX51 Options --->
[*] MXC NFC Hardware Version 3
[*] MXC NFC Hardware Version 3.2
Device Drivers --->
<*> Memory Technology Device (MTD) support --->
[*] MTD partitioning support
[*] Command line partition table parsing
<*> Direct char device access to MTD devices
-*- Common interface to block layer for MTD 'translation layers'
<*> Caching block device access to MTD devices
<*> NAND Device Support --->
<*> MXC NAND Version 3 support

2 Setting partitions on NAND flash

The default partitions on the NAND flash are as follows:

Name Size Offset
bootloader 0x300000 (3 MiB) 0x0
nand.kernel 0x500000 (5 MiB) 0x300000
nand.rootfs 0x40000000 (1 GiB) 0x800000
nand.userfs1 0x3E800000 (1000 MiB) 0x40800000

There are 2 ways to customize this layout:

  • Edit the Linux source code
    • Open the file btmxc-linux/arch/arm/mach-mx51
    • Search for the following struct and edit it according to your wishes.
      NOTE: Leave at least 2 MiB (0x200000) bytes unassigned at the end of the flash. This is the location where the bad block table (BBT) and its copy are usually stored by Linux and Redboot.
static struct mtd_partition nand_flash_partitions[] = {
{
.name = "bootloader",
.offset = 0,
.size = 3 * 1024 * 1024,
},
{
.name = "nand.kernel",
.offset = MTDPART_OFS_APPEND,
.size = 5 * 1024 * 1024,
},
{
.name = "nand.rootfs",
.offset = MTDPART_OFS_APPEND,
.size = 1024 * 1024 * 1024,
},
{
.name = "nand.userfs1",
.offset = MTDPART_OFS_APPEND,
.size = 1000 * 1024 * 1024,
},
};
  • Supply a boot argument to the kernel
    • TODO

3 Test in Linux

We will copy some test file to the 4th partition (nand.userfs1).

  • Use some test file (e.g. 32 MiB large) and copy it to the SBC. "/randomfile" is assumed from now on.
  • Have a look at the available partitions:
cat /proc/mtd
cat /proc/partitions
  • Create a jffs2 file system by deleting the contents and simply mounting it:
mkdir /mnt/nanduserfs
mount -t jffs2 /dev/mtdblock3 /mnt/nanduserfs
  • Copy the file to this partition 10 times:
for i in `seq 1 10` ; do cp /randomfile /mnt/nanduserfs/file${i} ; done
  • Check files:
for i in `seq 1 10` ; do diff /randomfile /mnt/nanduserfs/file${i} ; done

Diff must not output anything, which means the files are all identical.

4 Boot from NAND flash (default)

TODO link to page

 

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值