历史上的今天
今天是:2024年08月30日(星期五)
2021年08月30日 | linux-2.6.38到tiny6410的移植手册(连载1)__nand flash
2021-08-30 来源:eefocus
2440的linux移植手册满天飞,到了6410怎么就没有了呢?
既然源码都给了,为什么不把移植步骤写出来,好让大家学习呢?
今日,小弟自搞奋勇,想自己移植一遍linux-2.6.38,参考友善给的源码,觉得既然源码都有了,想发掘移植步骤应该不难吧,嘿嘿
环境 VirtualBox+ubuntu 10.04
编译器,友善自带arm-linux-gcc-4.5.1-v6-vfp-20101103.tgz
硬件,tiny6410,核心板号1107
linux-2.6.38到tiny6410的移植手册(连载2)__网卡&NF
http://www.arm9home.net/read.php?tid-14211.html
linux-2.6.38到tiny6410的移植手册(连载3)__ LCD&触摸屏
http://www.arm9home.net/read.php?tid=14261
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
第186行
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,
}
};
分区可以改成自己想要的。
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 */
mtd->writesize = 2048 << (extid & 0x03);
extid >>= 2;
/* Calc oobsize */
- switch (extid & 0x03) {
- case 1:
- mtd->oobsize = 128;
- break;
- case 2:
- mtd->oobsize = 218;
- break;
- case 3:
- mtd->oobsize = 400;
- break;
- default:
+ if (extid & 0x10) {
mtd->oobsize = 436;
- break;
+ } else {
+ mtd->oobsize = __oobsz[(extid & 0x03)];
}
extid >>= 2;
/* Calc blocksize */
@@ -3099,16 +3113,21 @@
/* Calculate the address shift from the page size */
chip->page_shift = ffs(mtd->writesize) - 1;
+
/* Convert chipsize to number of pages per chip -1. */
- chip->pagemask = (chip->chipsize >> chip->page_shift) - 1;
+ if (!chip->pagemask) {
+ chip->pagemask = (chip->chipsize >> chip->page_shift) - 1;
+ }
chip->bbt_erase_shift = chip->phys_erase_shift =
ffs(mtd->erasesize) - 1;
- if (chip->chipsize & 0xffffffff)
- chip->chip_shift = ffs((unsigned)chip->chipsize) - 1;
- else {
- chip->chip_shift = ffs((unsigned)(chip->chipsize >> 32));
- chip->chip_shift += 32 - 1;
+ if (!chip->chip_shift) {
+ if (chip->chipsize & 0xffffffff)
+ chip->chip_shift = ffs((unsigned)chip->chipsize) - 1;
+ else {
+ chip->chip_shift = ffs((unsigned)(chip->chipsize >> 32));
+ chip->chip_shift += 32 - 1;
+ }
}
/* Set the bad block position */
@@ -3126,8 +3145,11 @@
*/
if ((chip->cellinfo & NAND_CI_CELLTYPE_MSK) &&
(*maf_id == NAND_MFR_SAMSUNG ||
- *maf_id == NAND_MFR_HYNIX))
- chip->options |= NAND_BBT_SCANLASTPAGE;
+ *maf_id == NAND_MFR_HYNIX)) {
+ if (mtd->writesize < 4096) {
+ chip->options |= NAND_BBT_SCANLASTPAGE;
+ }
+ }
else if ((!(chip->cellinfo & NAND_CI_CELLTYPE_MSK) &&
(*maf_id == NAND_MFR_SAMSUNG ||
*maf_id == NAND_MFR_HYNIX ||
然后修改drivers/mtd/nand/Kconfig和drivers/mtd/nand/Makefile文件
在drivers/mtd/nand/Kconfig 238行增加
config MTD_NAND_S3C
tristate "NAND Flash support for S3C SoC"
depends on (ARCH_S3C64XX || ARCH_S5P64XX || ARCH_S5PC1XX) && MTD_NAND
help
This enables the NAND flash controller on the S3C.
No board specfic support is done by this driver, each board
must advertise a platform_device for the driver to attach.
config MTD_NAND_S3C_DEBUG
bool "S3C NAND driver debug"
depends on MTD_NAND_S3C
help
Enable debugging of the S3C NAND driver
configMTD_NAND_S3C_HWECC
bool "S3C NAND Hardware ECC"
depends on MTD_NAND_S3C
help
Enable the use of the S3C's internal ECC generator when
using NAND. Early versions of the chip have had problems with
incorrect ECC generation, and if using these, the default of
software ECC is preferable.
If you lay down a device with the hardware ECC, then you will
currently not be able to switch to software, as there is no
implementation for ECC method used by the S3C
drivers/mtd/nand/Makefile中20行增加
obj-$(CONFIG_MTD_NAND_S3C) += s3c_nand.o
末尾再增加
S3C_NAND_MLC_SRC = $(shell ls drivers/mtd/nand/s3c_nand_mlc.c 2>/dev/null)
ifeq ($(S3C_NAND_MLC_SRC),)
obj-$(CONFIG_MTD_NAND_S3C) += s3c_nand_mlc.fo
else
obj-$(CONFIG_MTD_NAND_S3C) += s3c_nand_mlc.o
endif
然后再make menuconfig
Device Drivers--->
<*> Memory Technology Device (MTD) support --->
[*] MTD partitioning support
[*] Command line partition table parsing
<*> Direct char device access to MTD devices
<*> Caching block device access to MTD devices
<*> NAND Device Support --->
< > NAND Flash support for Samsung S3C SoCs 去掉不要选
<*> NAND Flash support for S3C SoC
[*] S3C NAND Hardware ECC
make zImage
编译出来了,nand flash就可以用了。
史海拾趣
|
本公司需要做仿真键盘,和普通键盘没有多大区别。 1.采用USB接口,USB接口供电,也可以独立供电。 2.即仿DCS系统键盘,也可以称作工业键盘,只是比普通的键盘多几个专用的键和灯。 &nbs ...… 查看全部问答> |
|
xd 在debug MIPS 平台下的 一个问题, 麻烦xdjm们 看看, 死得莫名其妙的, 谢谢了。 Cause: Exception code: 2 Regs r0: 0x801d57c8 0x801d0000 0x00000001 0x2748f376 r4: 0x801d7c60 0xd8d7f210 0x00000000 0x00000000 r8: 0x8044d9d8 0x80 ...… 查看全部问答> |
|
C51编译环境。 main.h文件内容如下: #ifndef MAIN_H #define MAIN_H typedef unsigned int u16_t; typedef u16_t ip4addr_t[2]; typedef ip4addr_t ipaddr_t; #define IPADDR0 192 ...… 查看全部问答> |
|
CString 是不是有长度限制,每次到1000以上时,CEdit上就无法显示更多的内容了? CString 是不是有长度限制,每次到1000以上时,CEdit上就无法显示更多的内容了? 我将CString里的字显示到CEdit上,但是当读出的字符串长度上1000的时候就无法显示更多的了。 这是CString的问题,还是CEdit的问题? 如何解决呢? 我希望显示最 ...… 查看全部问答> |
|
卖ARM9开发板一套,源码、芯片资料俱全,可供从事开发人员或者想从事嵌入式开发的人员使用。如有意,信箱联系:ruyon@163.com 卖ARM9开发板一套,源码、芯片资料俱全,可供从事开发人员或者想从事嵌入式开发的人员使用。如有意,信箱联系:ruyon@163.com… 查看全部问答> |
|
学校实验室打算买一些ARM11的开发板,感觉OK6410不错,就是不知道核心板稳定性好不好,核心板结构 有何利弊?麻烦工程师们指点,谢谢!我们看中的是飞凌的叫S3C6410 OK6410的这个开发板,有用过的朋友给点儿建议吧。… 查看全部问答> |
|
新手分享,高手繞行! 這禮拜拿到AM335X 開發板,玩了幾天終於可以透過Frame Buffer 顯示畫面了 跟大家分享一下!! 1. Coding (testfb0.c) 2.COMPILE arm-linux-gnueabihf-gcc testfb0.c -o testfb0 3. PUT TO SDCARD cp testfb0 /media/r ...… 查看全部问答> |




