How to modify NAND device blocks size from 4096 to 2048 at run-time

369 views
Skip to first unread message

Elvis Dowson

unread,
Apr 2, 2010, 8:10:10 AM4/2/10
to android-porting
Hi,
I am having a problem where at run-time, android starts using a
4096 block size, whereas the on-board NAND device is 2048.

When I try to run df command after booting from NAND, just after
android init executes, I get the following output:

# df
/dev: 110764K total, 0K used, 110764K available (block size 4096)
/sqlite_stmt_journals: 4096K total, 0K used, 4096K available (block
size 4096)
/system: 163840K total, 41612K used, 122228K available (block size
4096)
/data: 32768K total, 1972K used, 30796K available (block size 4096)
/cache: 32768K total, 1412K used, 31356K available (block size 4096)

As you can see, the block size being use is 4096 instead of 2048,
which is the block size of my Micron NAND memory used on the gumstix
overo.

As as result, I get a D/dalvikvm( 902): DexOpt: incorrect opt magic
number (0xff ff ff ff) error, as soon as it starts to access the /
system partition and starts to process and optimize the dex files.

When I boot the system from MMC and write the data to the NAND, and
when the android linux kernel uses the ramdisk at boot up from NAND,
it uses a block size of 2048.

However, the moment android init takes over and the /system partition
is accessed, the block size changes to 4096.

Would anyone happen to know which source file I need to look at to
change this to 2048 ?

I am using a TI OMAP 3503 device, which has a Micron NAND device.

Running

# mtd_debug info /dev/mtd0

reports the following:

mtd.type = MTD_NANDFLASH
mtd.flags = MTD_CAP_ROM
mtd.size = 524288 (512K)
mtd.erasesize = 131072 (128K)
mtd.writesize = 2048 (2K)
mtd.oobsize = 64
regions = 0

So this corresponds to a blocksize (aka erasesize) of 128K which is
made up of 64 x 2K pages (aka writesize).

So, I think the NAND settings are correct at the moment, since the
block / erasesize match up (hex values)

Creating 7 MTD partitions on "omap2-nand":
0x000000000000-0x000000080000 : "xloader"
0x000000080000-0x000000240000 : "uboot"
0x000000240000-0x000000280000 : "uboot environment"
0x000000280000-0x000000680000 : "linux"
0x000000680000-0x00000a680000 : "system"
0x00000a680000-0x00000c680000 : "userdata"
0x00000c680000-0x00000e680000 : "cache"

root@overo:/# cat /proc/mtd
dev: offset size erasesize name
mtd0: 0x000000000000 00080000 00020000 "xloader"
mtd1: 0x000000080000 001c0000 00020000 "uboot"
mtd2: 0x000000240000 00040000 00020000 "uboot environment"
mtd3: 0x000000280000 00400000 00020000 "linux"
mtd4: 0x000000680000 0a000000 00020000 "system"
mtd5: 0x00000a680000 02000000 00020000 "userdata"
mtd6: 0x00000c680000 02000000 00020000 "cache"


best regards,

Elvis

Elvis Dowson

unread,
Apr 2, 2010, 8:52:42 AM4/2/10
to android-porting
Here is an excerpt from the Micron datasheet

NAND Flash-Specific Features
Organization • Page size
– x8: 2112 bytes (2048 + 64 bytes)
– x16: 1056 words (1024 + 32 words) • Block size: 64 pages (128K + 4K
bytes)

There is an x16 and an x8 organization. What files should I modify to
get android init to work correctly, at run-time?

Neo

unread,
Apr 5, 2010, 5:24:49 AM4/5/10
to android-porting

Not too sure but isn't this constrained by the FS used like yaffs/ext2
etc?

Reply all
Reply to author
Forward
0 new messages