请问如何在335x平台的nand flash上增加新的分区?

yx19911127 ( 楼主 ) 2018-6-21 00:22:12  显示全部楼层
本帖最后由 一只耳朵怪 于 2018-6-21 08:53 编辑

各位好。
       如何在ti原有的flash分区基础上增加一个分区?要如何修改代码?
      我使用的是linux-3.2.0的代码,我修改arch/arm/mach-omap2/board-am335xevm.c文件的下面代码
static struct mtd_partition am335x_nand_partitions[] = [
/* All the partition sizes are listed in terms of NAND block size */
[
.name = "SPL",
.offset = 0, /* Offset = 0x0 */
.size = SZ_128K,
],
[
.name = "SPL.backup1",
.offset = MTDPART_OFS_APPEND, /* Offset = 0x20000 */
.size = SZ_128K,
],
[
.name = "SPL.backup2",
.offset = MTDPART_OFS_APPEND, /* Offset = 0x40000 */
.size = SZ_128K,
],
[
.name = "SPL.backup3",
.offset = MTDPART_OFS_APPEND, /* Offset = 0x60000 */
.size = SZ_128K,
],
[
.name = "U-Boot",
.offset = MTDPART_OFS_APPEND, /* Offset = 0x80000 */
.size = 15 * SZ_128K,
],
[
.name = "U-Boot Env",
.offset = MTDPART_OFS_APPEND, /* Offset = 0x260000 */
.size = 1 * SZ_128K,
],
[
.name = "Kernel",
.offset = MTDPART_OFS_APPEND, /* Offset = 0x280000 */
.size = 40 * SZ_128K,
],
#if 0  //这里是原始的分区方式
[
.name = "File System",
.offset = MTDPART_OFS_APPEND, /* Offset = 0x780000 */
.size = MTDPART_SIZ_FULL,
],
#else  //改成如下的分区方式,文件系统分区改为48m,剩下的flash空间给user使用
[
.name = "File System",
.offset = MTDPART_OFS_APPEND, /* Offset = 0x780000 */
.size = 3 * SZ_16M,
],
[
.name = "user",
.offset = MTDPART_OFS_APPEND,
];
如此修改完毕后,重新格式化flash,烧录代码到单板上电有如下错误:
[ 1.025115] Creating 9 MTD partitions on "omap2-nand.0":
[ 1.030670] 0x000000000000-0x000000020000 : "SPL"
[ 1.037048] 0x000000020000-0x000000040000 : "SPL.backup1"
[ 1.044219] 0x000000040000-0x000000060000 : "SPL.backup2"
[ 1.051147] 0x000000060000-0x000000080000 : "SPL.backup3"
[ 1.058135] 0x000000080000-0x000000260000 : "U-Boot"
[ 1.065307] 0x000000260000-0x000000280000 : "U-Boot Env"
[ 1.072052] 0x000000280000-0x000000780000 : "Kernel"
[ 1.080566] 0x000000780000-0x000003780000 : "File System"
[ 1.107299] 0x000003780000-0x000010000000 : "user"
[ 1.196746] OneNAND driver initializing
[ 1.201477] UBI: attaching mtd7 to ubi0
[ 1.205535] UBI: physical eraseblock size: 131072 bytes (128 KiB)
[ 1.212066] UBI: logical eraseblock size: 126976 bytes
[ 1.217712] UBI: smallest flash I/O unit: 2048
[ 1.222625] UBI: VID header offset: 2048 (aligned 2048)
[ 1.228881] UBI: data offset: 4096
[ 1.594604] UBI: max. sequence number: 0
[ 1.610443] UBI error: vtbl_check: volume table check failed: record 0, error 9
[ 1.618255] UBI error: ubi_init: cannot attach mtd7
[ 1.624176] CAN device driver interface
[ 1.628173] CAN bus driver for Bosch D_CAN controller 1.0
[ 1.682159] davinci_mdio davinci_mdio.0: davinci mdio revision 1.6
[ 1.688629] davinci_mdio davinci_mdio.0: detected phy mask fffffff8
[ 1.696929] davinci_mdio.0: probed
[ 1.700500] davinci_mdio davinci_mdio.0: phy[0]: device 0:00, driver unknown
[ 1.707855] davinci_mdio davinci_mdio.0: phy[1]: device 0:01, driver unknown
[ 1.715240] davinci_mdio davinci_mdio.0: phy[2]: device 0:02, driver unknown
[ 1.722961] usbcore: registered new interface driver zd1201
[ 1.728973] usbcore: registered new interface driver cdc_ether
[ 1.735229] usbcore: registered new interface driver cdc_eem
[ 1.741271] usbcore: registered new interface driver dm9601
[ 1.747131] cdc_ncm: 04-Aug-2011
[ 1.750671] usbcore: registered new interface driver cdc_ncm
[ 1.756622] Initializing USB Mass Storage driver...
[ 1.761962] usbcore: registered new interface driver usb-storage
[ 1.768249] USB Mass Storage support registered.
[ 1.773529] mousedev: PS/2 mouse device common for all mice
[ 1.780029] i2c /dev entries driver
[ 1.784088] Linux video capture interface: v2.00
[ 1.789245] usbcore: registered new interface driver uvcvideo
[ 1.795257] USB Video Class driver (1.1.1)
[ 1.801666] OMAP Watchdog Timer Rev 0x01: initial timeout 60 sec
[ 1.810272] cpuidle: using governor ladder
[ 1.815093] cpuidle: using governor menu
[ 1.821441] omap4_aes_mod_init: loading AM33X AES driver
[ 1.827117] omap4-aes omap4-aes: AM33X AES hw accel rev: 3.02
[ 1.833679] omap4_aes_probe: probe() done
[ 1.838104] omap4_sham_mod_init: loading AM33X SHA/MD5 driver
[ 1.844268] omap4-sham omap4-sham: AM33X SHA/MD5 hw accel rev: 4.03
[ 1.855895] omap4_sham_probe: probe() done
[ 1.862609] usbcore: registered new interface driver usbhid
[ 1.868438] usbhid: USB HID core driver
[ 1.873291] usbcore: registered new interface driver snd-usb-audio
[ 1.881347] ALSA device list:
[ 1.884490] No soundcards found.
[ 1.888031] oprofile: hardware counters not available
[ 1.893310] oprofile: using timer interrupt.
[ 1.897796] nf_conntrack version 0.5.0 (3957 buckets, 15828 max)
[ 1.904571] ip_tables: (C) 2000-2006 Netfilter Core Team
[ 1.910247] TCP cubic registered
[ 1.913635] NET: Registered protocol family 17
[ 1.918273] can: controller area network core (rev 20090105 abi 8)
[ 1.924835] NET: Registered protocol family 29
[ 1.929473] can: raw protocol (rev 20090105)
[ 1.933929] can: broadcast manager protocol (rev 20090105 t)
[ 1.939880] Registering the dns_resolver key type
[ 1.944854] VFP support v0.3: implementor 41 architecture 3 part 30 variant c rev 3
[ 1.952880] ThumbEE CPU extension supported.
[ 1.957397] mux: Failed to setup hwmod io irq -22
[ 1.962982] Power Management for AM33XX family
[ 1.967834] Trying to load am335x-pm-firmware.bin (60 secs timeout)
[ 1.974517] Copied the M3 firmware to UMEM
[ 1.978881] Cortex M3 Firmware Version = 0x181
[ 1.984100] sr_init: platform driver register failed
[ 1.992919] clock: disabling unused clocks to save power
[ 2.011199] Detected MACID=0:17:ea:a3:89:46
[ 2.016754] cpsw: Detected MACID = 00:17:ea:a3:89:47
[ 2.023071] drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
[ 2.030029] VFS: Cannot open root device "ubi0:rootfs" or unknown-block(0,0)
[ 2.037445] Please append a correct "root=" boot option; here are the available partitions:
[ 2.046203] 1f00 128 mtdblock0 (driver?)
[ 2.051483] 1f01 128 mtdblock1 (driver?)
[ 2.056762] 1f02 128 mtdblock2 (driver?)
[ 2.062042] 1f03 128 mtdblock3 (driver?)
[ 2.067321] 1f04 1920 mtdblock4 (driver?)
[ 2.072601] 1f05 128 mtdblock5 (driver?)
[ 2.077880] 1f06 5120 mtdblock6 (driver?)
[ 2.083160] 1f07 49152 mtdblock7 (driver?)
[ 2.088439] 1f08 205312 mtdblock8 (driver?)
[ 2.093719] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[ 2.102355] Backtrace:
[ 2.104949] [<c0017dbc>] (dump_backtrace+0x0/0x10c) from [<c041263c>] (dump_stack+0x18/0x1c)
[ 2.113739] r6:00008000 r5:c04f4e50 r4:c063b5c8 r3:c05f25cc
[ 2.119659] [<c0412624>] (dump_stack+0x0/0x1c) from [<c0412868>] (panic+0x64/0x194)
[ 2.127685] [<c0412804>] (panic+0x0/0x194) from [<c0595c88>] (mount_block_root+0x174/0x228)
[ 2.136413] r3:00000004 r2:00000000 r1:cf01df68 r0:c04f4e50
[ 2.142333] r7:c05c3060
[ 2.144989] [<c0595b14>] (mount_block_root+0x0/0x228) from [<c0595fa4>] (prepare_namespace+0x94/0x1c0)
[ 2.154693] [<c0595f10>] (prepare_namespace+0x0/0x1c0) from [<c05958fc>] (kernel_init+0xf4/0x120)
[ 2.163970] r5:c05cf2bc r4:c05cf2bc
[ 2.167724] [<c0595808>] (kernel_init+0x0/0x120) from [<c0040ac0>] (do_exit+0x0/0x65c)
[ 2.175994] r5:c0595808 r4:00000000
我查看了内核代码,UBI error: vtbl_check: volume table check failed: record 0, error 9这个错误貌似是说我分配的分区太大超过了flash大小,可我的flash是256m的,按原来分区上电看df -h 有空余170m大小空间给我使用,而这里分配给rootfs48m即报错(我曾经尝试你过64m,一样有问题),我的文件系统占用空间大小为30m左右,请大神帮忙看看到底哪里出了问题,要如何实现我的预想功能。

5个回复

yx19911127 发表于 2018-6-21 00:37:53
感觉在这个论坛问问题好难啊,基本上得不到答复。。。。。。
回复

举报 使用道具

yx19911127 发表于 2018-6-21 00:49:46
问题已解决,在这里回复下我的解决方法,留给有相同问题的人做参考:
我的问题是仅仅只修改了kernel代码,而uboot的mtdparts参数需要同步进行修改,制作ubi.img时的参数也同样需要进行修改,三者同时修改完毕后再格式化flash,重新烧写到flash就应该没问题了。
回复

举报 使用道具

yx19911127 发表于 2018-6-21 01:02:46
问题已解决,在这里回复下我的解决方法,留给有相同问题的人做参考:
我的问题是仅仅只修改了kernel代码,而uboot的mtdparts参数需要同步进行修改,制作ubi.img时的参数也同样需要进行修改,三者同时修改完毕后再格式化flash,重新烧写到flash就应该没问题了。
回复

举报 使用道具

hwjj940056201 发表于 2018-6-21 01:13:39
yx19911127 发表于 2018-6-21 01:02
问题已解决,在这里回复下我的解决方法,留给有相同问题的人做参考:
我的问题是仅仅只修改了kernel代码,而uboot的mtdparts参数需要同步进行修改,制作ubi.img时的参数也同样需要进行修改,三者同时修改完毕后再格式化flash,重新烧写到flash就应该没问题了。 ...

感谢分享~~
回复

举报 使用道具

jjjj830110 发表于 7 天前
yx19911127 发表于 2018-6-21 00:49
问题已解决,在这里回复下我的解决方法,留给有相同问题的人做参考:
我的问题是仅仅只修改了kernel代码,而uboot的mtdparts参数需要同步进行修改,制作ubi.img时的参数也同样需要进行修改,三者同时修改完毕后再格式化flash,重新烧写到flash就应该没问题了。 ...

感谢分享!!
回复

举报 使用道具

您需要登录后才可以回帖 登录 | 注册

本版积分规则


关闭

站长推荐上一条 /9 下一条

小黑屋|手机版|Archiver|电子发烧友 ( 粤ICP备14022951号-2 )

GMT+8, 2018-7-19 04:26 , Processed in 0.347556 second(s), 24 queries , Memcache On.

Powered by 电子发烧友网

© 2015 bbs.elecfans.com

微信扫描
快速回复 返回顶部 返回列表