亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費(fèi)注冊(cè) 查看新帖 |

Chinaunix

  平臺(tái) 論壇 博客 文庫(kù)
最近訪問(wèn)板塊 發(fā)新帖
查看: 14650 | 回復(fù): 8
打印 上一主題 下一主題

[操作系統(tǒng)] 如何給nand flash分區(qū) [復(fù)制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報(bào)告]
發(fā)表于 2012-06-28 10:55 |只看該作者 |倒序?yàn)g覽
本帖最后由 zehn_w 于 2012-07-03 16:12 編輯

開(kāi)發(fā)板是dm3730
想要給nand flash分區(qū)存放備份。
做法:
修改內(nèi)核源碼中 arch/arm/mach-omap2/borad-omap3stalker.c
  1. /*nand
  2. **------------------------------------------------------------------------------
  3. */
  4. static struct mtd_partition omap3stalker_nand_partitions[] = {
  5.        /* All the partition sizes are listed in terms of NAND block size */
  6.        {
  7.                .name           = "X-Loader",
  8.                .offset         = 0,
  9.                .size           = 4*(SZ_128K),
  10.                .mask_flags     = MTD_WRITEABLE
  11.        },
  12.        {
  13.                .name           = "U-Boot",
  14.                .offset         = MTDPART_OFS_APPEND,
  15.                .size           = 15*(SZ_128K),
  16.                .mask_flags     = MTD_WRITEABLE
  17.        },
  18.        {
  19.                .name           = "U-Boot Env",
  20.                .offset         = MTDPART_OFS_APPEND,
  21.                .size           = 1*(SZ_128K)
  22.        },
  23.        {
  24.                .name           = "Kernel",
  25.                .offset         = MTDPART_OFS_APPEND,
  26.                .size           = 32*(SZ_128K)
  27.        },
  28.        {
  29.                .name           = "File System",
  30.                .offset         = MTDPART_OFS_APPEND,
  31.                .size           = 1*(SZ_64M),
  32.        },

  33.        /* 添加部分 */
  34.        {
  35.                .name           = "Backup File System",
  36.                .offset         = MTDPART_OFS_APPEND,
  37.                .size           = MTDPART_SIZ_FULL,
  38.        },
  39. };
復(fù)制代碼
重新編譯并燒寫(xiě)

設(shè)置uboot參數(shù):
  1. setenv mtdparts 'mtdparts=nand:512k(x-loader),1920k(u-boot),128k(u-boot-env),4m(kernel),64m(fs),-(fs2)'
復(fù)制代碼
重新啟動(dòng)失敗,錯(cuò)誤提示:
  1. [   12.645446] UBIFS error (pid 1): ubifs_get_sb: cannot open "ubi0:rootfs", error -19
  2. [   12.653228] VFS: Cannot open root device "ubi0:rootfs" or unknown-block(0,0)
  3. [   12.660339] Please append a correct "root=" boot option; here are the available partitions:
  4. [   12.668823] 1f00             512 mtdblock0 (driver?)
  5. [   12.673828] 1f01            1920 mtdblock1 (driver?)
  6. [   12.678863] 1f02             128 mtdblock2 (driver?)
  7. [   12.683837] 1f03            4096 mtdblock3 (driver?)
  8. [   12.688873] 1f04           65536 mtdblock4 (driver?)
  9. [   12.693847] 1f05          189952 mtdblock5 (driver?)
  10. [   12.698883] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
復(fù)制代碼
求指導(dǎo)!

論壇徽章:
0
2 [報(bào)告]
發(fā)表于 2012-07-03 15:21 |只看該作者
本帖最后由 zehn_w 于 2012-09-24 13:44 編輯

重新再次還原
  1.        {
  2.                .name           = "File System",
  3.                .offset         = MTDPART_OFS_APPEND,
  4.                .size           = 1*(SZ_64M),
  5.        },
復(fù)制代碼
在之前的錯(cuò)誤之上,發(fā)現(xiàn)如下錯(cuò)誤:
  1. [   11.231201] omap2-nand driver initializing
  2. [   11.235565] NAND device: Manufacturer ID: 0x2c, Chip ID: 0xba (Micron NAND 25                                                                                                  6MiB 1,8V 16-bit)
  3. [   11.244445] Creating 6 MTD partitions on "omap2-nand.0":
  4. [   11.249816] 0x000000000000-0x000000080000 : "X-Loader"
  5. [   11.256561] 0x000000080000-0x000000260000 : "U-Boot"
  6. [   11.263366] 0x000000260000-0x000000280000 : "U-Boot Env"
  7. [   11.269836] 0x000000280000-0x000000680000 : "Kernel"
  8. [   11.277465] 0x000000680000-0x000004680000 : "File System"
  9. [   11.307373] 0x000004680000-0x000010000000 : "Backup File System"
  10. [   11.383666] UBI: attaching mtd4 to ubi0
  11. [   11.387603] UBI: physical eraseblock size:   131072 bytes (128 KiB)
  12. [   11.393920] UBI: logical eraseblock size:    129024 bytes
  13. [   11.399383] UBI: smallest flash I/O unit:    2048
  14. [   11.404174] UBI: sub-page size:              512
  15. [   11.408813] UBI: VID header offset:          512 (aligned 512)
  16. [   11.414703] UBI: data offset:                2048
  17. [   11.538208] UBI error: ubi_read_volume_table: the layout volume was not found
  18. [   11.545654] UBI error: ubi_init: cannot attach mtd4
  19. [   11.551055] UBI error: ubi_init: UBI error: cannot initialize UBI, error -22
復(fù)制代碼
另發(fā)現(xiàn)直接設(shè)置內(nèi)核目錄中的mtd分區(qū)信息就可以實(shí)現(xiàn)分區(qū),無(wú)需配置(u-boot-env)mtdparts參數(shù)。

請(qǐng)問(wèn):
a.內(nèi)核目錄中的mtd分區(qū)信息和u-boot中的mtdparts關(guān)系是什么?
b.mtd分區(qū)對(duì)于相關(guān)參數(shù)有什么限制?

論壇徽章:
0
3 [報(bào)告]
發(fā)表于 2012-07-03 16:10 |只看該作者
在u-boot源碼目錄中include/asm-genric/errno.h
查找錯(cuò)誤碼:
  1. #define ENODEV          19      /* No such device */
  2. #define EINVAL          22      /* Invalid argument */
復(fù)制代碼
看出應(yīng)該是參數(shù)設(shè)置錯(cuò)誤,導(dǎo)致找不到ubifs
我的u-boot參數(shù)如下:

  1. bootcmd=if mmc init; then if run loadbootscript; then run bootscript; else if run loaduimage; then run mmcboot; else run nandboot; fi; fi; else run nandboot; fi
  2. bootdelay=3
  3. baudrate=115200
  4. netmask=255.255.255.0
  5. bootfile=uImage
  6. loadaddr=0x82000000
  7. console=ttyS0,115200n8
  8. vram=12M
  9. dvimode=1024x768MR-16@60
  10. defaultdisplay=dvi
  11. mpurate=600
  12. boardmodel=EVM35X-B3-1880-LUNC0
  13. mmcroot=/dev/mmcblk0p2 rw
  14. mmcrootfstype=ext3 rootwait
  15. nandroot=ubi0:rootfs ubi.mtd=4
  16. nandrootfstype=ubifs
  17. mmcargs=setenv bootargs console=${console} vram=${vram} omapfb.mode=dvi:${dvimode} omapfb.video_mode=dvi:${dvimode} omapdss.def_disp=${defaultdisplay} omap-dss.def_disp=${defaultdisplay} root=${mmcroot} init=/init mpurate=${mpurate} boardmodel=${boardmodel} rootfstype=${mmcrootfstype}
  18. loadbootscript=fatload mmc 0 ${loadaddr} boot.scr
  19. bootscript=echo Running bootscript from mmc ...; source ${loadaddr}
  20. loaduimage=fatload mmc 0 ${loadaddr} uImage
  21. mmcboot=echo Booting from mmc ...; run mmcargs; bootm ${loadaddr}
  22. nandboot=echo Booting from nand ...; run nandargs; nand read ${loadaddr} 280000 400000; bootm ${loadaddr}
  23. ethaddr=02:0d:03:02:00:0a
  24. dieid#=058400029e3800000163810d0302000a
  25. ethact=smc911x-0
  26. ipaddr=192.168.0.110
  27. serverip=192.168.0.111
  28. gatewayip=192.168.0.1
  29. mtdids=nand0=nand

  30. stdin=serial
  31. stdout=serial
  32. stderr=serial
  33. bootargs=console=ttyS0,115200n8 vram=12M omapfb.vram=0:12M omapfb.mode=dvi: omapdss.def_disp=tv root=ubi0:rootfs ubi.mtd=4 rw init=/init mpurate=1000 rootfstype=ubifs rootwait boardmodel=SBC3730-A1-2990-LUAC0 mem=54M@0x80000000 mem=128M@0x88000000
  34. nandargs=bootargs
  35. mtdparts=mtdparts=nand:512k(x-loader),1920k(u-boot),128k(u-boot-env),4m(kernel),64m(fs),-(backupfs)
復(fù)制代碼

論壇徽章:
0
4 [報(bào)告]
發(fā)表于 2012-07-04 00:54 |只看該作者
本帖最后由 daniel_kohler 于 2012-07-04 00:54 編輯

回復(fù) 2# zehn_w


    1. U-Boot的分區(qū)會(huì)被Linux的分區(qū)覆蓋掉的,
    2. 參數(shù)沒(méi)有特定的限制,只要不相互覆蓋,不超出flash的大小就行了。

論壇徽章:
0
5 [報(bào)告]
發(fā)表于 2012-07-04 11:52 |只看該作者
本帖最后由 zehn_w 于 2012-07-04 11:57 編輯

回復(fù) 4# daniel_kohler

RE 1:mtdparts在何種情況下是有意義的呢?(影響到mtd設(shè)置)
RE 2:嘗試發(fā)現(xiàn)文件系統(tǒng)分區(qū)分配的大小是有最小限制的(必須大于最小的某個(gè)值),這個(gè)有說(shuō)明文檔么?或是否了解?


   

論壇徽章:
0
6 [報(bào)告]
發(fā)表于 2012-07-05 01:11 |只看該作者
本帖最后由 daniel_kohler 于 2012-07-05 01:15 編輯

回復(fù) 5# zehn_w


    RE, RE 1:mtdparts這個(gè)參數(shù)在u-Boot設(shè)置后,kernel start時(shí)會(huì)按照這個(gè)參數(shù)進(jìn)行MTD分區(qū);
    RE, RE 2:要看你使用的是什么格式的文件系統(tǒng)了,每個(gè)文件系統(tǒng)都會(huì)留有一個(gè)最小的空間給自己。

論壇徽章:
0
7 [報(bào)告]
發(fā)表于 2012-07-05 11:31 |只看該作者
本帖最后由 zehn_w 于 2012-07-05 11:33 編輯

回復(fù) 6# daniel_kohler
最后的分區(qū)結(jié)果依然依據(jù)內(nèi)核的分區(qū)表來(lái)完成。但是mtdparts參數(shù)即使和內(nèi)核中的分區(qū)表不一致,也不會(huì)造成沖突嗎?之前說(shuō)會(huì)被內(nèi)核分區(qū)所覆蓋,有點(diǎn)矛盾啊。
是不是這樣理解的,內(nèi)核啟動(dòng)后根據(jù)mtdparts進(jìn)行分區(qū),如果分析參數(shù)不一樣,內(nèi)核會(huì)根據(jù)自己的分區(qū)信息覆蓋掉mtdparts。
這樣的話(huà),麻煩指點(diǎn)一下這部分代碼在哪個(gè)文件里?


   

論壇徽章:
0
8 [報(bào)告]
發(fā)表于 2012-07-05 12:27 |只看該作者
回復(fù) 7# zehn_w


    kernel3.5.2 , driver/mtd/cmdlinepart.c ,line 376;

論壇徽章:
0
9 [報(bào)告]
發(fā)表于 2012-07-05 14:41 |只看該作者
daniel_kohler 發(fā)表于 2012-07-05 12:27
回復(fù) 7# zehn_w


感謝!
您需要登錄后才可以回帖 登錄 | 注冊(cè)

本版積分規(guī)則 發(fā)表回復(fù)

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號(hào)-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號(hào):11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報(bào)專(zhuān)區(qū)
中國(guó)互聯(lián)網(wǎng)協(xié)會(huì)會(huì)員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過(guò)ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請(qǐng)注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP