How to change the partitions of Nandflsh & at91sam9g25

Discussion around AT91RM9200 and SAM9 Series Products.

Moderator: nferre

Posts: 1
Joined: Thu Jun 30, 2016 10:32 am

How to change the partitions of Nandflsh & at91sam9g25

Thu Jun 30, 2016 11:13 am


I have a product using the at91sam9g25 running Linux 3.10 and I would like to change the partition of NandFlash.

The previous patition of Nand can be found in booting information outputed like this :
8 cmdlinepart partitions found on MTD device atmel_nand
Creating 8 MTD partitions on "atmel_nand":

0x000000000000-0x000000040000 : "bootstrap"
0x000000040000-0x0000000c0000 : "uboot"
0x0000000c0000-0x000000100000 : "env"
0x000000100000-0x000000140000 : "env_redundant"
0x000000140000-0x000000180000 : "spare"
0x000000180000-0x000000200000 : "dtb"
0x000000200000-0x000000800000 : "kernel"
0x000000800000-0x000020000000 : "rootfs"

Now, I want to change the position of one or more sections in Nand flash. And I don't know what should I change in uboot and kernel source code .
If anyone has got know something about this question, please share with me. You can share at here or send emil to me <> I will be very grateful to you. Thanks very much.
Location: USA
Posts: 1882
Joined: Thu Apr 19, 2007 10:15 pm

Re: How to change the partitions of Nandflsh

Fri Jul 01, 2016 2:44 am

Frank_song wrote:Now, I want to change the position of one or more sections in Nand flash.
Change how?
You are aware that NAND partitions must be aligned to erase blocks, right?

Since you're deviating from the conventional NAND partitions that Atmel uses, then also consider storing the kernel and dtb files in the /boot directory of the root filesystem. Those partitions can then be deleted and those blocks consolidated into the rootfs.
The advantages include availability of several versions of dtb files and kernel images instead of just one of each.
If you're updating the kernel and dtb frequently, then these file operations will involve the wear-leveling mechanism, instead of reusing the same NAND blocks.
A failed update will not necessarily brick the board, since you don't have to erase/delete the original in order to commence the update.
U-Boot will require MTD and filesystem capabilities for such a configuration.
Frank_song wrote:And I don't know what should I change in uboot and kernel source code .
We don't know either, since we don't know exactly what you have.
U-Boot normally doesn't pay any attention to MTD partitions. NAND I/O typically uses the raw device (e.g. with NAND addresses).
If you access a filesystem in NAND, then you first have to mount that filesystem, which in turn requires defining the MTD partitions for U-Boot.

If the MTD partition information is passed to the kernel using the kernel command line, then there will be one (bootargs) or more U-Boot environment variables involved.
If the rootfs is a NAND filesystem and if its partition number has changed, then the salient parameters (e.g. "rootfs=...") in bootargs require updating.

Within the Linux kernel source, MTD partitions can be defined in Device Tree files and/or board files.
You'll have to determine what you have.
Frank_song wrote: ...send emil to me <songdongjob at>
That's an inappropriate request. How To Ask Questions The Smart Way


Return to “SAM9 ARM9 MPU”

Who is online

Users browsing this forum: No registered users and 6 guests