设为首页 加入收藏

TOP

Linux-2.6.38到Tiny6410的移植手册(一)
2014-11-24 14:49:04 来源: 作者: 【 】 浏览:104
Tags:Linux-2.6.38 Tiny6410 移植 手册

想自己移植一遍linux-2.6.38,参考友善给的源码,觉得既然源码都有了,想发掘移植步骤应该不难吧,嘿嘿


编译器,友善自带arm-linux-gcc-4.5.1-v6-vfp-20101103.tgz


硬件,tiny6410,核心板号1107


1、下载linux-2.6.38的源码,ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.38.tar.bz2
2、解压 tar xvfj /mnt/ubuntu/linux-2.6.38.tar.bz2 -C .
3、vi Makefile 191行改为 ARCH = arm
4、cp arch/arm/configs/s3c6400_defconfig .config
5、make menuconfig
5、General setup->(/usr/4.5.1/bin/arm-linux-) Cross-compiler tool prefix 我将编译器解压到了/usr/4.5.1目录
System Type->[*] MINI6410 选上,其他的可以去掉,不确定的可以参考友善之臂的


这样编译出来的内核是可以被uboot引导的,然后是增加nand flash支持
vi arch/arm/mach-s3c64xx/mach-mini6410.c
第117行
struct mtd_partition mini6410_nand_part[] = {
{
.name = "Bootloader",
.offset = 0,
.size = (4 * 128 *SZ_1K),
.mask_flags = MTD_CAP_NANDFLASH,
},
{
.name = "Kernel",
.offset = (4 * 128 *SZ_1K),
.size = (5*SZ_1M) ,
.mask_flags = MTD_CAP_NANDFLASH,
},
{
.name = "File System",
.offset = MTDPART_OFS_APPEND,
.size = MTDPART_SIZ_FULL,
}
}; //update at 2011-8-26 经过测试发现,这里改完后根本不起作用,甚至将整个注释也无妨,估计分区已经固死在后面的s3c_nand_mlc.fo中


drivers/mtd/nand/s3c_nand.c和arch/arm/plat-samsung/include/plat/regs-nand.h两个文件可以从友善的源码中
拷贝过来,这是他们自己写的,当然drivers/mtd/nand/s3c_nand_mlc.fo也要拷贝过来,这是友善没有开源的一个驱动之一,
所以不用研究了,拷过来就是了。
修改drivers/mtd/nand/nand_base.c文件


修改方法如下,“-”就是要去掉的内容,“+”就是要增加的内容,@@后面的是行号,
嫌麻烦的的直接将drivers/mtd/nand/nand_base.c拷过来覆盖掉


嘿嘿,下面是我diff出来的东西。



@@ -342,7 +342,7 @@
*/
static int nand_block_bad(struct mtd_info *mtd, loff_t ofs, int getchip)
{
- int page, chipnr, res = 0;
+ int page, res = 0;
struct nand_chip *chip = mtd->priv;
u16 bad;


@@ -351,6 +351,8 @@


page = (int)(ofs >> chip->page_shift) & chip->pagemask;


+#if 0
+ /* Moved to nand_block_checkbad() for chip specify support */
if (getchip) {
chipnr = (int)(ofs >> chip->chip_shift);


@@ -359,6 +361,7 @@
/* Select the NAND device */
chip->select_chip(mtd, chipnr);
}
+#endif


if (chip->options & NAND_BUSWIDTH_16) {
chip->cmdfunc(mtd, NAND_CMD_READOOB, chip->badblockpos & 0xFE,
@@ -378,8 +381,10 @@
else
res = hweight8(bad) < chip->badblockbits;


+#if 0
if (getchip)
nand_release_device(mtd);
+#endif


return res;
}
@@ -477,9 +482,26 @@
int allowbbt)
{
struct nand_chip *chip = mtd->priv;
+ int chipnr, res = 0;
+
+ /* Chip specify block_bad() support */
+ if (!chip->bbt) {
+ if (getchip) {
+ chipnr = (int)(ofs >> chip->chip_shift);


- if (!chip->bbt)
- return chip->block_bad(mtd, ofs, getchip);
+ nand_get_device(chip, mtd, FL_READING);
+
+ /* Select the NAND device */
+ chip->select_chip(mtd, chipnr);
+ }
+
+ res = chip->block_bad(mtd, ofs, getchip);
+
+ if (getchip)
+ nand_release_device(mtd);
+
+ return res;
+ }


/* Return info from the table */
return nand_isbad_bbt(mtd, ofs, allowbbt);
@@ -3002,23 +3024,15 @@
id_data[0] == NAND_MFR_SAMSUNG &&
(chip->cellinfo & NAND_CI_CELLTYPE_MSK) &&
id_data[5] != 0x00) {
+ int __oobsz[] = { 0, 128, 218, 400 };
/* Calc pagesize */

首页 上一页 1 2 3 下一页 尾页 1/3/3
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇Tiny6410 编译Linux内核的问题(L.. 下一篇Tiny6410 关于zImage 不能编译的..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: