技术标签: 在s3c2440上linux镜像在nand flash中吗
1、主机环境:VMare下Ubuntu10.04 ,1G内存。
2、编译编译环境:arm-linux-gcc
3、开发板:Micro2440,2M nor flash,256M nand flash。
4、u-boot-version:u-boot-2010.06
5、linux -version:Linux-2.6.39
一、下载并解压内核源码
a)在命令行终端中可以通过下列方式下载,当然用其它下载工具下载
root@bootloader:/home/eilian/development/Android#cd ../Linux
root@bootloader:/home/eilian/development/Linux# wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.39.tar.gz
b)解压源码
root@bootloader:/home/eilian/development/Linux#
root@bootloader:/home/eilian/development/Linux# tar zxvf linux-2.6.39.tar.gz
root@bootloader:/home/eilian/development/Linux# ls
linux-2.6.32.2 linux-2.6.36.2.tar.gzlinux-2.6.39linux-2.6.39.tar.gz
root@bootloader:/home/eilian/development/Linux# cd linux-2.6.39
root@bootloader:/home/eilian/development/Linux/linux-2.6.39#
c)指定交叉编译器
移植目的让 Linux-2.6.39 可以在mini2440 上运行。首先,使得Linux-2.6.39的缺省目标平台成为ARM 的平台,修改主目录下的Makefile。
用vi打开Makefile,定位到196行,修改如下:
root@bootloader:/home/eilian/development/Linux/linux-2.6.39# vi Makefile
# Default value for CROSS_COMPILE is not to prefix executables
# Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile
export KBUILD_BUILDHOST := $(SUBARCH)
ARCH ?= arm
CROSS_COMPILE ?= arm-linux-
# Architecture as present in compile.h
UTS_MACHINE := $(ARCH)
SRCARCH := $(ARCH)
修改完成后退出保存
/********************************************************************************************************************************/
d)创建目标平台
个性移植从SMDK2440到eilian240
root@bootloader:/home/eilian/development/Linux/linux-2.6.39#cd arch/arm/mach-s3c2440
root@bootloader:/home/eilian/development/Linux/linux-2.6.39/arch/arm/mach-s3c2440#cp mach-smd2440.c mach-eilian240.c
将mach-eilian240.c文件中的所有smdk2440改成eilian240
root@bootloader:/home/eilian/development/Linux/linux-2.6.39/arch/arm/mach-s3c2440#vi mach-eilian240.c
操作如下:在vi的命令模式下输入
修改mach-s3c2440目录下的Makefile,打开Makefile定位到38行做如下修改
obj-$(CONFIG_MACH_ANUBIS) += mach-anubis.o
obj-$(CONFIG_MACH_OSIRIS) += mach-osiris.o
obj-$(CONFIG_MACH_RX3715) += mach-rx3715.o
obj-$(CONFIG_ARCH_S3C2440) += mach-smdk2440.o
obj-$(CONFIG_MACH_NEXCODER_2440) += mach-nexcoder.o
obj-$(CONFIG_MACH_AT2440EVB) += mach-at2440evb.o
obj-$(CONFIG_MACH_MINI2440) += mach-mini2440.o
obj-$(CONFIG_MACH_NEO1973_GTA02) += mach-gta02.o
obj-$(CONFIG_MACH_RX1950) += mach-rx1950.o
obj-$(CONFIG_MACH_MINI2440) += mach-eilian240.o#为何这样修改呢?后面慢慢解释
修改mach-s3c2440目录下的Kconfig 添加如下代码
config MACH_MINI2440
bool "MINI2440 development board"
select CPU_S3C2440
select EEPROM_AT24
select NEW_LEDS
select LEDS_CLASS
select LEDS_TRIGGER
select LEDS_TRIGGER_BACKLIGHT
select S3C_DEV_NAND
select S3C_DEV_USB_HOST
help
Say Y here to select support for the MINI2440. Is a 10cm x 10cm board
available via various sources. It can come with a 3.5" or 7" touch LCD.
config MACH_EILIAN240bool "eilian240 development board"select CPU_S3C2440select EEPROM_AT24select NEW_LEDSselect LEDS_CLASSselect LEDS_TRIGGERselect LEDS_TRIGGER_BACKLIGHTselect S3C_DEV_NANDselect S3C_DEV_USB_HOSThelpSay Y here to select support for the eilian240. Is a 10cm x 10cm boardavailable via various sources. It can come with a 3.5" or 7" touch LCD.
这样修改之后在选择配置缺省文件的时候直接选择mini2440_defconfig了
除此之外,还有一个地方需要改动,在eilian240_machine_init(void)函数中,把smdk_machine_init()函数调用注释掉,因为我们后面会编写自己的初始化函数,不需要调用smdk2440 原来的,同时修改时钟频率,修改如下:
static void __init eilian240_machine_init(void)
{
s3c24xx_fb_set_platdata(&eilian240_fb_info);
s3c_i2c0_set_platdata(NULL);
s3c_nand_set_platdata(&eilian240_nand_info);
platform_add_devices(eilian240_devices, ARRAY_SIZE(eilian240_devices));// smdk_machine_init();}
修改时钟频率
static void __init eilian240_map_io(void)
{
s3c24xx_init_io(eilian240_iodesc, ARRAY_SIZE(eilian240_iodesc));s3c24xx_init_clocks(12000000);s3c24xx_init_uarts(eilian240_uartcfgs, ARRAY_SIZE(eilian240_uartcfgs));
}
e)关于机器码
首先,很关键的一点,内核在启动时,是通过bootloader 传入的机器码(MACH_TYPE)确定应启动哪种目标平台的。
打开/arch/arm/tools/mach-types 定位到最后一行添加机器码(深蓝色部分):
ctbu_gen2 MACH_CTBU_GEN2 CTBU_GEN2 3410
kmp_am17_01 MACH_KMP_AM17_01 KMP_AM17_01 3411
wtplug MACH_WTPLUG WTPLUG 3412
mx27su2 MACH_MX27SU2 MX27SU2 3413
nb31 MACH_NB31 NB31 3414
hjsdu MACH_HJSDU HJSDU 3415
td3_rev1 MACH_TD3_REV1 TD3_REV1 3416
eag_ci4000 MACH_EAG_CI4000 EAG_CI4000 3417
net5big_nand_v2 MACH_NET5BIG_NAND_V2 NET5BIG_NAND_V2 3418
cpx2 MACH_CPX2 CPX2 3419
net2big_nand_v2 MACH_NET2BIG_NAND_V2 NET2BIG_NAND_V2 3420
ecuv5 MACH_ECUV5 ECUV5 3421
hsgx6d MACH_HSGX6D HSGX6D 3422
dawad7 MACH_DAWAD7 DAWAD7 3423
sam9repeater MACH_SAM9REPEATER SAM9REPEATER 3424
eilian240 MACH_EILIAN240 EILIAN240 8000
在u-boot-2010.06/arch/arm/include/asm/mach-types.h 中定义相对应的机器码,这里注意这个机器码是我自己移植UBOOT的时候定义的
#define MACH_TYPE_CAYENNE 2874
#define MACH_TYPE_FUJI 2875
#define MACH_TYPE_SYNOLOGY_6282 2876
#define MACH_TYPE_EM1SY 2877
#define MACH_TYPE_M502 2878
#define MACH_TYPE_MATRIX518 2879
#define MACH_TYPE_TINY_GURNARD 2880
#define MACH_TYPE_SPEAR1310 2881#define MACH_TYPE_EILIAN240 8000
这需要两者相匹配,如果内核的机器码和bootloader 传入的不匹配,就会经常出现下面的错误:
Uncompressing Linux................................................................................................................................. done, booting
the kernel. 不动了
接着修改linux-2.6.39/arch/arm/mach-s3c2440/eilian240.c定位到文件末尾处MACHINE_START(S3C2440, "SMDK2440") , 将其修改为MACHINE_START(EILIAN240, "eilian240 development board")
notes:开发板运行后,在命令行终端输入:cat /proc/cpuinfo 可以看到我们添加的开发板信息,当然这个信息可以定制成我们需要的信息。
f)内核配置菜单中的MINI2440 选项和实际代码是如何关联的
在开始移植其他驱动之前,了解一些看起来比较“神秘”的常识,那就是运行make menuconfig 时,内核配置菜单中的MINI2440 选项是如何出现的。
加载缺省文件因为在x86平台下下执行此操作,系统默认的是x86平台,操作如下:
root@bootloader:/home/eilian/development/Linux/linux-2.6.39#cp arch/arm/configs/mini2440_defconfig .config
root@bootloader:/home/eilian/development/Linux/linux-2.6.39#make menuconfig
出现下图所示内核配置根菜单
按上下箭头键移动到 System Type,按回车进入该子菜单,如图
再找到S3C2440 Machines,按回车进入该子菜单,如图
这样明白上面修改Linux-2.6.39/arch/arm/mach-s3c2440/目录下的Makefile和Kconfig为什么那样修改了吧。。
再打开 Linux-2.6.39/arch/arm/mach-s3c2440/Kconfig 看看
config MACH_EILIAN240
bool "eilian240 development board"
select CPU_S3C2440
select EEPROM_AT24
select NEW_LEDS
select LEDS_CLASS
select LEDS_TRIGGER
select LEDS_TRIGGER_BACKLIGHT
select S3C_DEV_NAND
select S3C_DEV_USB_HOST
help
Say Y here to select support for the eilian240. Is a 10cm x 10cm board
available via various sources. It can come with a 3.5" or 7" touch LCD.
现在明白了吧“eilian240 development board”正是在这个Kconfig 文件中定义说明的,当然你可以根据自己的喜好改为其他显示信息。这里的显示信息只是在内核配置菜单中出现的,记住“要让选择的配置实际起效,还需要根据此配置在Makefile 中添加相应的代码文件”再次打开Makefile看看:
# Machine support
obj-$(CONFIG_MACH_ANUBIS) += mach-anubis.o
obj-$(CONFIG_MACH_OSIRIS) += mach-osiris.o
obj-$(CONFIG_MACH_RX3715) += mach-rx3715.o
obj-$(CONFIG_ARCH_S3C2440) += mach-smdk2440.o
obj-$(CONFIG_MACH_NEXCODER_2440) += mach-nexcoder.o
obj-$(CONFIG_MACH_AT2440EVB) += mach-at2440evb.o
obj-$(CONFIG_MACH_MINI2440) += mach-mini2440.o
obj-$(CONFIG_MACH_NEO1973_GTA02) += mach-gta02.o
obj-$(CONFIG_MACH_RX1950) += mach-rx1950.o
obj-$(CONFIG_MACH_EILIAN240) += mach-eilian240.o
# extra machine support
这样,配置文件就跟实际的代码文件通过配置定义联系在一起了,这里的配置定义是“CONFIG_MACH_EILIAN240”,内核中还有很多类似的配置定义,并且有的配置定义还存在依赖关系,我们在此就不对它们详细说明了,随着对内核代码结构的不断熟悉,你就会逐渐学会分析和查找你所需要的各种配置和定义等。
g)移植Nand 驱动并更改分区信息(我总感觉NANDFLASH是linux设备驱动中比较复杂的了)
g.1:了解释内核已经支持的NANDFLASH类型
Linux2.6.39 已经自带了大部分Nand Flash 驱动,在linux-2.6.39/drivers/mtd/nand/nand_ids.c 文件中,定义了所支持的各种Nand Flash 类型
struct nand_flash_dev nand_flash_ids[] = {
#ifdef CONFIG_MTD_NAND_MUSEUM_IDS
{"NAND 1MiB 5V 8-bit", 0x6e, 256, 1, 0x1000, 0},
{"NAND 2MiB 5V 8-bit", 0x64, 256, 2, 0x1000, 0},
{"NAND 4MiB 5V 8-bit", 0x6b, 512, 4, 0x2000, 0},
{"NAND 1MiB 3,3V 8-bit", 0xe8, 256, 1, 0x1000, 0},
{"NAND 1MiB 3,3V 8-bit", 0xec, 256, 1, 0x1000, 0},
{"NAND 2MiB 3,3V 8-bit", 0xea, 256, 2, 0x1000, 0},
{"NAND 4MiB 3,3V 8-bit", 0xd5, 512, 4, 0x2000, 0},
{"NAND 4MiB 3,3V 8-bit", 0xe3, 512, 4, 0x2000, 0},
{"NAND 4MiB 3,3V 8-bit", 0xe5, 512, 4, 0x2000, 0},
{"NAND 8MiB 3,3V 8-bit", 0xd6, 512, 8, 0x2000, 0},
{"NAND 8MiB 1,8V 8-bit", 0x39, 512, 8, 0x2000, 0},
{"NAND 8MiB 3,3V 8-bit", 0xe6, 512, 8, 0x2000, 0},
{"NAND 8MiB 1,8V 16-bit", 0x49, 512, 8, 0x2000, NAND_BUSWIDTH_16},
{"NAND 8MiB 3,3V 16-bit", 0x59, 512, 8, 0x2000, NAND_BUSWIDTH_16},
#endif
{"NAND 16MiB 1,8V 8-bit", 0x33, 512, 16, 0x4000, 0},
{"NAND 16MiB 3,3V 8-bit", 0x73, 512, 16, 0x4000, 0},
{"NAND 16MiB 1,8V 16-bit", 0x43, 512, 16, 0x4000, NAND_BUSWIDTH_16},
{"NAND 16MiB 3,3V 16-bit", 0x53, 512, 16, 0x4000, NAND_BUSWIDTH_16},
{"NAND 32MiB 1,8V 8-bit", 0x35, 512, 32, 0x4000, 0},
{"NAND 32MiB 3,3V 8-bit", 0x75, 512, 32, 0x4000, 0},
{"NAND 32MiB 1,8V 16-bit", 0x45, 512, 32, 0x4000, NAND_BUSWIDTH_16},
{"NAND 32MiB 3,3V 16-bit", 0x55, 512, 32, 0x4000, NAND_BUSWIDTH_16},
{"NAND 64MiB 1,8V 8-bit", 0x36, 512, 64, 0x4000, 0},
{"NAND 64MiB 3,3V 8-bit", 0x76, 512, 64, 0x4000, 0},
{"NAND 64MiB 1,8V 16-bit", 0x46, 512, 64, 0x4000, NAND_BUSWIDTH_16},
{"NAND 64MiB 3,3V 16-bit", 0x56, 512, 64, 0x4000, NAND_BUSWIDTH_16},
{"NAND 128MiB 1,8V 8-bit", 0x78, 512, 128, 0x4000, 0},
{"NAND 128MiB 1,8V 8-bit", 0x39, 512, 128, 0x4000, 0},
{"NAND 128MiB 3,3V 8-bit", 0x79, 512, 128, 0x4000, 0},
{"NAND 128MiB 1,8V 16-bit", 0x72, 512, 128, 0x4000, NAND_BUSWIDTH_16},
{"NAND 128MiB 1,8V 16-bit", 0x49, 512, 128, 0x4000, NAND_BUSWIDTH_16},
{"NAND 128MiB 3,3V 16-bit", 0x74, 512, 128, 0x4000, NAND_BUSWIDTH_16},
{"NAND 128MiB 3,3V 16-bit", 0x59, 512, 128, 0x4000, NAND_BUSWIDTH_16},
{"NAND 256MiB 3,3V 8-bit", 0x71, 512, 256, 0x4000, 0},
/*
* These are the new chips with large page size. The pagesize and the
* erasesize is determined from the extended id bytes,对于我们的是大页的NANDFLASH
*/
#define LP_OPTIONS (NAND_SAMSUNG_LP_OPTIONS | NAND_NO_READRDY | NAND_NO_AUTOINCR)
#define LP_OPTIONS16 (LP_OPTIONS | NAND_BUSWIDTH_16)
/*512 Megabit */
{"NAND 64MiB 1,8V 8-bit", 0xA2, 0, 64, 0, LP_OPTIONS},
{"NAND 64MiB 1,8V 8-bit", 0xA0, 0, 64, 0, LP_OPTIONS},
{"NAND 64MiB 3,3V 8-bit", 0xF2, 0, 64, 0, LP_OPTIONS},
{"NAND 64MiB 3,3V 8-bit", 0xD0, 0, 64, 0, LP_OPTIONS},
{"NAND 64MiB 1,8V 16-bit", 0xB2, 0, 64, 0, LP_OPTIONS16},
{"NAND 64MiB 1,8V 16-bit", 0xB0, 0, 64, 0, LP_OPTIONS16},
{"NAND 64MiB 3,3V 16-bit", 0xC2, 0, 64, 0, LP_OPTIONS16},
{"NAND 64MiB 3,3V 16-bit", 0xC0, 0, 64, 0, LP_OPTIONS16},
/* 1 Gigabit */
{"NAND 128MiB 1,8V 8-bit", 0xA1, 0, 128, 0, LP_OPTIONS},
{"NAND 128MiB 3,3V 8-bit", 0xF1, 0, 128, 0, LP_OPTIONS},
{"NAND 128MiB 3,3V 8-bit", 0xD1, 0, 128, 0, LP_OPTIONS},
{"NAND 128MiB 1,8V 16-bit", 0xB1, 0, 128, 0, LP_OPTIONS16},
{"NAND 128MiB 3,3V 16-bit", 0xC1, 0, 128, 0, LP_OPTIONS16},
{"NAND 128MiB 1,8V 16-bit", 0xAD, 0, 128, 0, LP_OPTIONS16},
/* 2 Gigabit */
{"NAND 256MiB 1,8V 8-bit", 0xAA, 0, 256, 0, LP_OPTIONS},
{"NAND 256MiB 3,3V 8-bit", 0xDA, 0, 256, 0, LP_OPTIONS},
{"NAND 256MiB 1,8V 16-bit", 0xBA, 0, 256, 0, LP_OPTIONS16},
{"NAND 256MiB 3,3V 16-bit", 0xCA, 0, 256, 0, LP_OPTIONS16},
/* 4 Gigabit */
{"NAND 512MiB 1,8V 8-bit", 0xAC, 0, 512, 0, LP_OPTIONS},
{"NAND 512MiB 3,3V 8-bit", 0xDC, 0, 512, 0, LP_OPTIONS},
{"NAND 512MiB 1,8V 16-bit", 0xBC, 0, 512, 0, LP_OPTIONS16},
{"NAND 512MiB 3,3V 16-bit", 0xCC, 0, 512, 0, LP_OPTIONS16},
/* 8 Gigabit */
{"NAND 1GiB 1,8V 8-bit", 0xA3, 0, 1024, 0, LP_OPTIONS},
{"NAND 1GiB 3,3V 8-bit", 0xD3, 0, 1024, 0, LP_OPTIONS},
{"NAND 1GiB 1,8V 16-bit", 0xB3, 0, 1024, 0, LP_OPTIONS16},
{"NAND 1GiB 3,3V 16-bit", 0xC3, 0, 1024, 0, LP_OPTIONS16},
/* 16 Gigabit */
{"NAND 2GiB 1,8V 8-bit", 0xA5, 0, 2048, 0, LP_OPTIONS},
{"NAND 2GiB 3,3V 8-bit", 0xD5, 0, 2048, 0, LP_OPTIONS},
{"NAND 2GiB 1,8V 16-bit", 0xB5, 0, 2048, 0, LP_OPTIONS16},
{"NAND 2GiB 3,3V 16-bit", 0xC5, 0, 2048, 0, LP_OPTIONS16},
/* 32 Gigabit */
{"NAND 4GiB 1,8V 8-bit", 0xA7, 0, 4096, 0, LP_OPTIONS},
{"NAND 4GiB 3,3V 8-bit", 0xD7, 0, 4096, 0, LP_OPTIONS},
{"NAND 4GiB 1,8V 16-bit", 0xB7, 0, 4096, 0, LP_OPTIONS16},
{"NAND 4GiB 3,3V 16-bit", 0xC7, 0, 4096, 0, LP_OPTIONS16},
/* 64 Gigabit */
{"NAND 8GiB 1,8V 8-bit", 0xAE, 0, 8192, 0, LP_OPTIONS},
{"NAND 8GiB 3,3V 8-bit", 0xDE, 0, 8192, 0, LP_OPTIONS},
{"NAND 8GiB 1,8V 16-bit", 0xBE, 0, 8192, 0, LP_OPTIONS16},
{"NAND 8GiB 3,3V 16-bit", 0xCE, 0, 8192, 0, LP_OPTIONS16},
/* 128 Gigabit */
{"NAND 16GiB 1,8V 8-bit", 0x1A, 0, 16384, 0, LP_OPTIONS},
{"NAND 16GiB 3,3V 8-bit", 0x3A, 0, 16384, 0, LP_OPTIONS},
{"NAND 16GiB 1,8V 16-bit", 0x2A, 0, 16384, 0, LP_OPTIONS16},
{"NAND 16GiB 3,3V 16-bit", 0x4A, 0, 16384, 0, LP_OPTIONS16},
/* 256 Gigabit */
{"NAND 32GiB 1,8V 8-bit", 0x1C, 0, 32768, 0, LP_OPTIONS},
{"NAND 32GiB 3,3V 8-bit", 0x3C, 0, 32768, 0, LP_OPTIONS},
{"NAND 32GiB 1,8V 16-bit", 0x2C, 0, 32768, 0, LP_OPTIONS16},
{"NAND 32GiB 3,3V 16-bit", 0x4C, 0, 32768, 0, LP_OPTIONS16},
/* 512 Gigabit */
{"NAND 64GiB 1,8V 8-bit", 0x1E, 0, 65536, 0, LP_OPTIONS},
{"NAND 64GiB 3,3V 8-bit", 0x3E, 0, 65536, 0, LP_OPTIONS},
{"NAND 64GiB 1,8V 16-bit", 0x2E, 0, 65536, 0, LP_OPTIONS16},
{"NAND 64GiB 3,3V 16-bit", 0x4E, 0, 65536, 0, LP_OPTIONS16},
/*
* Renesas AND 1 Gigabit. Those chips do not support extended id and
* have a strange page/block layout ! The chosen minimum erasesize is
* 4 * 2 * 2048 = 16384 Byte, as those chips have an array of 4 page
* planes 1 block = 2 pages, but due to plane arrangement the blocks
* 0-3 consists of page 0 + 4,1 + 5, 2 + 6, 3 + 7 Anyway JFFS2 would
* increase the eraseblock size so we chose a combined one which can be
* erased in one go There are more speed improvements for reads and
* writes possible, but not implemented now
*/
{"AND 128MiB 3,3V 8-bit", 0x01, 2048, 128, 0x4000,
NAND_IS_AND | NAND_NO_AUTOINCR |NAND_NO_READRDY | NAND_4PAGE_ARRAY |
BBT_AUTO_REFRESH
},
{NULL,}
};
/*
* Manufacturer ID list
*/
struct nand_manufacturers nand_manuf_ids[] = {
{NAND_MFR_TOSHIBA, "Toshiba"},
{NAND_MFR_SAMSUNG, "Samsung"},
{NAND_MFR_FUJITSU, "Fujitsu"},
{NAND_MFR_NATIONAL, "National"},
{NAND_MFR_RENESAS, "Renesas"},
{NAND_MFR_STMICRO, "ST Micro"},
{NAND_MFR_HYNIX, "Hynix"},
{NAND_MFR_MICRON, "Micron"},
{NAND_MFR_AMD, "AMD"},
{0x0, "Unknown"}
};
既然对于ARM920T的核,Linux内核已经对大部分的NANDFLASH完美支持了,那还需修改什么呢?分区系统虽然对NANDFLASH进行了默认的分区,但这可能不是我们想要的,我们的分区得和UBOOT中对NANDFLASH的分区保持一致
g.2修改Nand Flash 分区表:那我怎么知道如何分啊?参考系统默认的,那系统默认的分区又在那里定义了?
对于S3C24XX这个CPU ,对于NANDFLASH这样的平台设备打开arch/arm/plat-s3c24xx/comm-smdk.c
/* NAND parititon from 2.4.18-swl5 */
static struct mtd_partition smdk_default_nand_part[] = {
[0] = {
.name = "Boot Agent",
.size = SZ_16K,
.offset = 0,
},
[1] = {
.name = "S3C2410 flash partition 1",
.offset = 0,
.size = SZ_2M,
},
[2] = {
.name = "S3C2410 flash partition 2",
.offset = SZ_4M,
.size = SZ_4M,
},
[3] = {
.name = "S3C2410 flash partition 3",
.offset = SZ_8M,
.size = SZ_2M,
},
[4] = {
.name = "S3C2410 flash partition 4",
.offset = SZ_1M * 10,
.size = SZ_4M,
},
[5] = {
.name = "S3C2410 flash partition 5",
.offset = SZ_1M * 14,
.size = SZ_1M * 10,
},
[6] = {
.name = "S3C2410 flash partition 6",
.offset = SZ_1M * 24,
.size = SZ_1M * 24,
},
[7] = {
.name = "S3C2410 flash partition 7",
.offset = SZ_1M * 48,
.size = MTDPART_SIZ_FULL,
}
};
static struct s3c2410_nand_set smdk_nand_sets[] = {
[0] = {
.name = "NAND",
.nr_chips = 1,
.nr_partitions = ARRAY_SIZE(smdk_default_nand_part),
.partitions = smdk_default_nand_part,
},
};
/* choose a set of timings which should suit most 512Mbit
* chips and beyond.
*/
static struct s3c2410_platform_nand smdk_nand_info = {
.tacls = 20,
.twrph0 = 60,
.twrph1 = 20,
.nr_sets = ARRAY_SIZE(smdk_nand_sets),
.sets = smdk_nand_sets,
};
好了不多想了直接参考这个依葫芦画瓢的修改回到自己的板层文件
root@bootloader:/home/eilian/development/Linux/linux-2.6.39/arch/arm/mach-s3c2440#
打开mach-eilian240.c根据自己移植的UBOOT在里面添加对NANDFLASH分区的代码,代码如下
/* NAND Flash on eilian240 board */static struct mtd_partition eilian240_nand_part[] __initdata = {[0] = {.name = "bootloader",.size = SZ_1M, //UBOOT大小1M.offset = 0,},[1] = {.name = "params", //存放参数.size = SZ_128K,.offset = SZ_1M,},[2] = {.name = "kernel",.size = 0x00500000,.offset = SZ_1M + SZ_128K, //内核},[3] = {.name = "root",.offset = SZ_1M + SZ_128K + 0x00500000,//根文件系统.size = 1024 * 1024 * 1024,},[4] = {.name = "nand",.offset = 0,.size = SZ_256M, //整个NANDFLASH 可有可无},};static struct s3c2410_nand_set eilian240_nand_sets[] __initdata = {[0] = {.name = "nand",.nr_chips = 1,.nr_partitions = ARRAY_SIZE(eilian240_nand_part),.partitions = eilian240_nand_part,.flash_bbt = 1, /* we use u-boot to create a BBT */},};static struct s3c2410_platform_nand eilian240_nand_info __initdata = {.tacls = 20,.twrph0 = 60,.twrph1 = 20,.nr_sets = ARRAY_SIZE(eilian240_nand_sets),.sets = eilian240_nand_sets,.ignore_unset_ecc = 1,};
将nand flash 设备注册到系统中
static struct platform_device *eilian240_devices[] __initdata = {
&s3c_device_ohci,
&s3c_device_lcd,
&s3c_device_wdt,
&s3c_device_i2c0,
&s3c_device_iis,
&s3c_device_nand,
};
传入eilian240_nand_info结构体��始化参数到内核中去
static void __init eilian240_machine_init(void)
{
s3c24xx_fb_set_platdata(&eilian240_fb_info);
s3c_i2c0_set_platdata(NULL);
s3c_nand_set_platdata(&eilian240_nand_info);
platform_add_devices(eilian240_devices, ARRAY_SIZE(eilian240_devices));
// smdk_machine_init();
}
加入必要的头文件
/*********nand*****/#include #include #include #include #include /*********nand*****/
保存退出
h)编译测试
root@bootloader:/home/eilian/development/Linux/linux-2.6.39# make uImage
等待很久!!!!!!!!
Kernel: arch/arm/boot/Image is ready
AS arch/arm/boot/compressed/head.o
GZIP arch/arm/boot/compressed/piggy.gzip
AS arch/arm/boot/compressed/piggy.gzip.o
CC arch/arm/boot/compressed/misc.o
CC arch/arm/boot/compressed/decompress.o
SHIPPED arch/arm/boot/compressed/lib1funcs.S
AS arch/arm/boot/compressed/lib1funcs.o
LD arch/arm/boot/compressed/vmlinux
OBJCOPY arch/arm/boot/zImage
Kernel: arch/arm/boot/zImage is ready
UIMAGE arch/arm/boot/uImage
Image Name: Linux-2.6.39
Created: Fri Dec 2 02:55:06 2011
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 2144304 Bytes = 2094.05 kB = 2.04 MB
Load Address: 30008000
Entry Point: 30008000
Image arch/arm/boot/uImage is ready
root@bootloader:/home/eilian/development/Linux/linux-2.6.39# cparch/arm/boot/uImage /tftpboot
下载uImage到板子上运行
打开超级终端(我这已经将uboot烧入到NANDFLASH)
U-Boot 2010.06 (Nov 29 2011 - 21:13:28)
DRAM: 64 MiB
Flash: 512 KiB
NAND: dev_id = 218
NAND 256MiB 3,3V 8-bit256 MiB
In: serial
Out: serial
Err: serial
Net: dm9000
Device nand0 not found!
Hit any key to stop autoboot: 0
bootloader# tftp 32000000 uImage
dm9000 i/o: 0x20000300, id: 0x90000a46
DM9000: running in 16 bit mode
MAC: 08:00:3e:26:0a:5b
operating at unknown: 0 mode
Using dm9000 device
TFTP from server 211.67.217.136; our IP address is 211.67.217.138
Filename 'uImage'.
Load address: 0x32000000
Loading: T #################T ################################################
#################################################################
#############################################################T ##T ##
#############################################T #################T ###
##T ###################T ############################################
##############T ############T ################################T #######T
#############################
done
Bytes transferred = 2144368 (20b870 hex)
bootloader# bootm 32000000
## Booting kernel from Legacy Image at 32000000 ...
Image Name: Linux-2.6.39
Created: 2011-12-01 18:55:06 UTC
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 2144304 Bytes = 2 MiB
Load Address: 30008000
Entry Point: 30008000
Verifying Checksum ... OK
Loading Kernel Image ... OK
OK
Starting kernel ...
Uncompressing Linux... done, booting the kernel.
Linux version 2.6.39 (root@bootloader) (gcc version 4.3.2 (Sourcery G++ Lite 2008q3-72) ) #1 Fri Dec 2 02:54:32 CST 2011
CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0007177
CPU: VIVT data cache, VIVT instruction cache
Machine: eilian240 development board
Memory policy: ECC disabled, Data cache writeback
CPU S3C2440A (id 0x32440001)
S3C24XX Clocks, Copyright 2004 Simtec Electronics
S3C244X: core 405.000 MHz, memory 101.250 MHz, peripheral 50.625 MHz
CLOCK: Slow mode (1.500 MHz), fast, MPLL on, UPLL on
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256
Kernel command line: noinitrd root=/dev/mtdblock2 init=/linuxrc console=ttySAC0 mem=64M
PID hash table entries: 256 (order: -2, 1024 bytes)
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 64MB = 64MB total
Memory: 60464k/60464k available, 5072k reserved, 0K highmem
Virtual kernel memory layout:
vector : 0xffff0000 - 0xffff1000 ( 4 kB)
fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
DMA : 0xffc00000 - 0xffe00000 ( 2 MB)
vmalloc : 0xc4800000 - 0xf6000000 ( 792 MB)
lowmem : 0xc0000000 - 0xc4000000 ( 64 MB)
modules : 0xbf000000 - 0xc0000000 ( 16 MB)
.init : 0xc0008000 - 0xc0029000 ( 132 kB)
.text : 0xc0029000 - 0xc03f7f30 (3900 kB)
.data : 0xc03f8000 - 0xc041bc80 ( 144 kB)
SLUB: Genslabs=13, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
NR_IRQS:85
irq: clearing subpending status 00000003
irq: clearing subpending status 00000002
Console: colour dummy device 80x30
console [ttySAC0] enabled
Calibrating delay loop... 201.52 BogoMIPS (lpj=503808)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
gpiochip_add: gpios 288..303 (GPIOK) failed to register
gpiochip_add: gpios 320..334 (GPIOL) failed to register
gpiochip_add: gpios 352..353 (GPIOM) failed to register
NET: Registered protocol family 16
S3C2440: Initialising architecture
S3C2440: IRQ Support
S3C244X: Clock Support, DVS off
bio: create slab at 0
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
s3c-i2c s3c2440-i2c: slave address 0x10
s3c-i2c s3c2440-i2c: bus frequency set to 98 KHz
s3c-i2c s3c2440-i2c: i2c-0: S3C I2C adapter
Advanced Linux Sound Architecture Driver Version 1.0.24.
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 2048 (order: 2, 16384 bytes)
TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
TCP reno registered
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
NET: Registered protocol family 1
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
JFFS2 version 2.2. (NAND) Â 2001-2006 Red Hat, Inc.
ROMFS MTD (C) 2007 Red Hat, Inc.
msgmni has been set to 118
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
Console: switching to colour frame buffer device 60x53
fb0: s3c2410fb frame buffer device
s3c2440-uart.0: ttySAC0 at MMIO 0x50000000 (irq = 70) is a S3C2440
s3c2440-uart.1: ttySAC1 at MMIO 0x50004000 (irq = 73) is a S3C2440
s3c2440-uart.2: ttySAC2 at MMIO 0x50008000 (irq = 76) is a S3C2440
brd: module loaded
S3C24XX NAND Driver, (c) 2004 Simtec Electronics
s3c24xx-nand s3c2440-nand: Tacls=3, 29ns Twrph0=7 69ns, Twrph1=3 29nss3c24xx-nand s3c2440-nand: NAND soft ECCNAND device: Manufacturer ID: 0xec, Chip ID: 0xda (Samsung NAND 256MiB 3,3V 8-bit)Creating 5 MTD partitions on "nand":0x000000000000-0x000000100000 : "bootloader"uncorrectable error :0x000000100000-0x000000120000 : "params"ftl_cs: FTL header not found.0x000000120000-0x000000620000 : "kernel"ftl_cs: FTL header not found.0x000000620000-0x000040620000 : "root"
mtd: partition "root" extends beyond the end of device "nand" -- size truncated to 0xf9e0000ftl_cs: FTL header not found.0x000000000000-0x000040000000 : "nand"mtd: partition "nand" extends beyond the end of device "nand" -- size truncated to 0x10000000uncorrectable error :
dm9000 Ethernet Driver, V1.31
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
s3c2410-ohci s3c2410-ohci: S3C24XX OHCI
s3c2410-ohci s3c2410-ohci: new USB bus registered, assigned bus number 1
s3c2410-ohci s3c2410-ohci: irq 42, io mem 0x49000000
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 2 ports detected
usbcore: registered new interface driver libusual
mousedev: PS/2 mouse device common for all mice
S3C24XX RTC, (c) 2004,2006 Simtec Electronics
i2c /dev entries driver
S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics
s3c2410-wdt s3c2410-wdt: watchdog inactive, reset disabled, irq enabled
cpuidle: using governor ladder
sdhci: Secure Digital Host Controller Interface driver
sdhci: Copyright(c) Pierre Ossman
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
ALSA device list:
No soundcards found.
TCP cubic registered
NET: Registered protocol family 17
Registering the dns_resolver key type
drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
List of all partitions:
1f00 1024 mtdblock0 (driver?)1f01 128 mtdblock1 (driver?)1f02 5120 mtdblock2 (driver?)1f03 255872 mtdblock3 (driver?)1f04 262144 mtdblock4 (driver?) //因为没有文件系统所以出错啊
No filesystem could mount root, tried: ext3 cramfs vfat msdos romfs
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,2)
[] (unwind_backtrace+0x0/0xec) from [] (panic+0x54/0x184)
[] (panic+0x54/0x184) from [] (mount_block_root+0x1d0/0x210)
[] (mount_block_root+0x1d0/0x210) from [] (mount_root+0xa0/0xc0)
[] (mount_root+0xa0/0xc0) from [] (prepare_namespace+0x164/0x1bc)
[] (prepare_namespace+0x164/0x1bc) from [] (kernel_init+0xfc/0x138)
[] (kernel_init+0xfc/0x138) from [] (kernel_thread_exit+0x0/0x8)
/*********************************************************************************************************************************
关注上面深蓝色字体哈。。是否发现点什么。。。
文章浏览阅读290次,点赞8次,收藏10次。1.背景介绍稀疏编码是一种用于处理稀疏数据的编码技术,其主要应用于信息传输、存储和处理等领域。稀疏数据是指数据中大部分元素为零或近似于零的数据,例如文本、图像、音频、视频等。稀疏编码的核心思想是将稀疏数据表示为非零元素和它们对应的位置信息,从而减少存储空间和计算复杂度。稀疏编码的研究起源于1990年代,随着大数据时代的到来,稀疏编码技术的应用范围和影响力不断扩大。目前,稀疏编码已经成为计算...
文章浏览阅读217次。EasyGBS - GB28181 国标方案安装使用文档下载安装包下载,正式使用需商业授权, 功能一致在线演示在线API架构图EasySIPCMSSIP 中心信令服务, 单节点, 自带一个 Redis Server, 随 EasySIPCMS 自启动, 不需要手动运行EasySIPSMSSIP 流媒体服务, 根..._easygbs-windows-2.6.0-23042316使用文档
文章浏览阅读1.2k次,点赞27次,收藏7次。2023巅峰极客 BabyURL之前AliyunCTF Bypassit I这题考查了这样一条链子:其实就是Jackson的原生反序列化利用今天复现的这题也是大同小异,一起来整一下。_原生jackson 反序列化链子
文章浏览阅读734次,点赞9次,收藏7次。微服务架构简单的说就是将单体应用进一步拆分,拆分成更小的服务,每个服务都是一个可以独立运行的项目。这么多小服务,如何管理他们?(服务治理 注册中心[服务注册 发现 剔除])这么多小服务,他们之间如何通讯?这么多小服务,客户端怎么访问他们?(网关)这么多小服务,一旦出现问题了,应该如何自处理?(容错)这么多小服务,一旦出现问题了,应该如何排错?(链路追踪)对于上面的问题,是任何一个微服务设计者都不能绕过去的,因此大部分的微服务产品都针对每一个问题提供了相应的组件来解决它们。_spring cloud
文章浏览阅读5.9k次,点赞6次,收藏20次。Js实现图片点击切换与轮播图片点击切换<!DOCTYPE html><html> <head> <meta charset="UTF-8"> <title></title> <script type="text/ja..._点击图片进行轮播图切换
文章浏览阅读10w+次,点赞245次,收藏1.5k次。在开始安装前,如果你的电脑装过tensorflow,请先把他们卸载干净,包括依赖的包(tensorflow-estimator、tensorboard、tensorflow、keras-applications、keras-preprocessing),不然后续安装了tensorflow-gpu可能会出现找不到cuda的问题。cuda、cudnn。..._tensorflow gpu版本安装
文章浏览阅读243次。0x00 简介权限滥用漏洞一般归类于逻辑问题,是指服务端功能开放过多或权限限制不严格,导致攻击者可以通过直接或间接调用的方式达到攻击效果。随着物联网时代的到来,这种漏洞已经屡见不鲜,各种漏洞组合利用也是千奇百怪、五花八门,这里总结漏洞是为了更好地应对和预防,如有不妥之处还请业内人士多多指教。0x01 背景2014年4月,在比特币飞涨的时代某网站曾经..._使用物联网漏洞的使用者
文章浏览阅读786次。A. Epipolar geometry and triangulationThe epipolar geometry mainly adopts the feature point method, such as SIFT, SURF and ORB, etc. to obtain the feature points corresponding to two frames of images. As shown in Figure 1, let the first image be and th_normalized plane coordinates
文章浏览阅读708次,点赞2次,收藏3次。开放信息抽取(OIE)系统(三)-- 第二代开放信息抽取系统(人工规则, rule-based, 先关系再实体)一.第二代开放信息抽取系统背景 第一代开放信息抽取系统(Open Information Extraction, OIE, learning-based, 自学习, 先抽取实体)通常抽取大量冗余信息,为了消除这些冗余信息,诞生了第二代开放信息抽取系统。二.第二代开放信息抽取系统历史第二代开放信息抽取系统着眼于解决第一代系统的三大问题: 大量非信息性提取(即省略关键信息的提取)、_语义角色增强的关系抽取
文章浏览阅读1.1w次,点赞6次,收藏51次。快速完成网页设计,10个顶尖响应式HTML5网页模板助你一臂之力为了寻找一个优质的网页模板,网页设计师和开发者往往可能会花上大半天的时间。不过幸运的是,现在的网页设计师和开发人员已经开始共享HTML5,Bootstrap和CSS3中的免费网页模板资源。鉴于网站模板的灵活性和强大的功能,现在广大设计师和开发者对html5网站的实际需求日益增长。为了造福大众,Mockplus的小伙伴整理了2018年最..._html欢迎页面
文章浏览阅读282次。原标题:2018全国计算机等级考试调整,一、二级都增加了考试科目全国计算机等级考试将于9月15-17日举行。在备考的最后冲刺阶段,小编为大家整理了今年新公布的全国计算机等级考试调整方案,希望对备考的小伙伴有所帮助,快随小编往下看吧!从2018年3月开始,全国计算机等级考试实施2018版考试大纲,并按新体系开考各个考试级别。具体调整内容如下:一、考试级别及科目1.一级新增“网络安全素质教育”科目(代..._计算机二级增报科目什么意思
文章浏览阅读240次。conan简单使用。_apt install conan