U-Boot和Kernel有关NAND的MTD分区的信息以哪个为准

187 views
Skip to first unread message

Luke

unread,
Jun 11, 2010, 2:19:38 AM6/11/10
to linux-...@zh-kernel.org
正在用友善之臂的2440开发板作开发,有关MTD分区的问题,不是很清楚。
有关NAND的分区信息,看起来有两个来源,一个来自于U-Boot,另一个来自于smdk设备初始化时在内核源码写死。
来源:U-Boot
在U-Boot中,用户能够设置U-Boot环境变量mtdparts,用来规定NAND的分区。如:
mtdids=nand0=nandflash0
mtdparts=mtdparts=nandflash0:2m@0(kernel),8m(jffs2),-(yaffs)
partition=nand0,0
U-Boot应该是将这些环境变量作为参数传给Kernel(?),Kernel应该能够对这些参数进行处理,如在内核代码drivers/mtd/cmdlinepart.c中,能够对环境变量所设置的分区信息进行处理。

来源:内核源码
在mtd的nand驱动代码drivers/mtd/nand/s3c2410.c中,对于nand的platform_driver,其probe函数s3c24xx_nand_probe()最终能够对nand进行分区,其中的分区信息来自于arch/arm/plat-s3c24xx/common-smdk.c中定义的smdk_default_nand_part[],因为NAND的默认分区在smdk_mach_init()时就作为该machine的nand初始化就确定了。

那么,实际中的分区到底用哪个?

--
Regards,
Luke
_______________________________________________
Linux 内核开发中文邮件列表
Linux-...@zh-kernel.org
http://zh-kernel.org/mailman/listinfo/linux-kernel
Linux 内核开发中文社区: http://zh-kernel.org

Jianbin Kang

unread,
Jun 11, 2010, 2:29:50 AM6/11/10
to Luke, linux-...@zh-kernel.org
在 2010年6月11日 下午2:19,Luke <ease...@gmail.com> 写道:
> 正在用友善之臂的2440开发板作开发,有关MTD分区的问题,不是很清楚。
> 有关NAND的分区信息,看起来有两个来源,一个来自于U-Boot,另一个来自于smdk设备初始化时在内核源码写死。
> 来源:U-Boot
> 在U-Boot中,用户能够设置U-Boot环境变量mtdparts,用来规定NAND的分区。如:
> mtdids=nand0=nandflash0
> mtdparts=mtdparts=nandflash0:2m@0(kernel),8m(jffs2),-(yaffs)
> partition=nand0,0
> U-Boot应该是将这些环境变量作为参数传给Kernel(?),Kernel应该能够对这些参数进行处理,如在内核代码drivers/mtd/cmdlinepart.c中,能够对环境变量所设置的分区信息进行处理。
>
> 来源:内核源码
> 在mtd的nand驱动代码drivers/mtd/nand/s3c2410.c中,对于nand的platform_driver,其probe函数s3c24xx_nand_probe()最终能够对nand进行分区,其中的分区信息来自于arch/arm/plat-s3c24xx/common-smdk.c中定义的smdk_default_nand_part[],因为NAND的默认分区在smdk_mach_init()时就作为该machine的nand初始化就确定了。
>
> 那么,实际中的分区到底用哪个?
>
我在mini2440上测试是,如果选中了命令行支持,u-boot的参数会覆盖内核定义的

Wan ZongShun

unread,
Jun 28, 2010, 9:21:23 AM6/28/10
to Jianbin Kang, linux-...@zh-kernel.org
在 2010年6月11日 下午2:29,Jianbin Kang <kjb...@gmail.com> 写道:
> 在 2010年6月11日 下午2:19,Luke <ease...@gmail.com> 写道:
>> 正在用友善之臂的2440开发板作开发,有关MTD分区的问题,不是很清楚。
>> 有关NAND的分区信息,看起来有两个来源,一个来自于U-Boot,另一个来自于smdk设备初始化时在内核源码写死。
>> 来源:U-Boot
>> 在U-Boot中,用户能够设置U-Boot环境变量mtdparts,用来规定NAND的分区。如:
>> mtdids=nand0=nandflash0
>> mtdparts=mtdparts=nandflash0:2m@0(kernel),8m(jffs2),-(yaffs)
>> partition=nand0,0
>> U-Boot应该是将这些环境变量作为参数传给Kernel(?),Kernel应该能够对这些参数进行处理,如在内核代码drivers/mtd/cmdlinepart.c中,能够对环境变量所设置的分区信息进行处理。
>>
>> 来源:内核源码
>> 在mtd的nand驱动代码drivers/mtd/nand/s3c2410.c中,对于nand的platform_driver,其probe函数s3c24xx_nand_probe()最终能够对nand进行分区,其中的分区信息来自于arch/arm/plat-s3c24xx/common-smdk.c中定义的smdk_default_nand_part[],因为NAND的默认分区在smdk_mach_init()时就作为该machine的nand初始化就确定了。
>>
>> 那么,实际中的分区到底用哪个?
>>
> 我在mini2440上测试是,如果选中了命令行支持,u-boot的参数会覆盖内核定义的

Seriously speaking, it shoud be according to 'y' of add_mtd_partitions(x,y,z);
Of course, you can parse the args to 'y' from uboot and kernel.

This function report your partitions in Nand driver, so check the second arg 'y'
, its value will be your correct partition info, no matter uboot or kernel.


> _______________________________________________
> Linux 内核开发中文邮件列表
> Linux-...@zh-kernel.org
> http://zh-kernel.org/mailman/listinfo/linux-kernel
> Linux 内核开发中文社区: http://zh-kernel.org

--
*linux-arm-kernel mailing list
mail addr:linux-ar...@lists.infradead.org
you can subscribe by:
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

* linux-arm-NUC900 mailing list
mail addr:NUC...@googlegroups.com
main web: https://groups.google.com/group/NUC900
you can subscribe it by sending me mail:
mcuo...@gmail.com

Reply all
Reply to author
Forward
0 new messages