Linux2.6.36移植到飛凌S3C6410開發(fā)板 步驟
一、 移植環(huán)境
主 機:VMWare-Ubuntu
開發(fā)板:飛凌OK6410 nandflash,Kernel:2.6.36.2
編譯器:arm-linux-gcc-4.3.2.tgz
u-boot:u-boot-1.1.6
注:編譯器和u-boot 都是飛凌開發(fā)板自帶的
二、 源碼獲得
三、 移植步驟:
1.將Linux2.6.34.2內核源碼放到工作目錄文件夾下,并解壓。
#tar xzvf linux2.6.36.2.tar.gz –c /
#pwd
/
# cd linux2.6.36.2
......
#SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/
# -e s/arm.*/arm/ -e s/sa110/arm/
# -e s/s390x/s390/ -e s/parisc64/parisc/
# -e s/ppc.*/powerpc/ -e s/mips.*/mips/ )
......
#ARCH ?= $(SUBARCH)
#CROSS_COMPILE ?=
ARCH = arm
CROSS_COMPILE = /usr/local/arm/usr/local/arm/4.3.2/bin/arm-none-linux- gnueabi-
3添加NandFlash分區(qū)信息.
修改arch/arm/mach-s3c64xx/mach-smdk6410.c文件,添加Nand Flash的分區(qū)信息和Nand Flash的硬件信息。(藍色字體為添加部分)
#pwd
// 注意:此處的nandflash分區(qū)信息是飛凌自帶的2.6.28的內核設置,由于此處要用到uboot是飛凌的,所以分區(qū)信息也要按人家的來
添加頭文件
#include
#include
#include
#include
struct mtd_partition s3c_partition_info[] = {
#if defined (CONFIG_SPLIT_ROOT_FILESYSTEM)
#endif
};
static struct s3c2410_nand_set s3c_nandset[]={
};
static struct s3c2410_platform_nand s3c_platform={
//add here…
static struct platform_device *smdk6410_devices[] __initdata = {
#ifdef CONFIG_SMDK6410_SD_CH0
#endif
#ifdef CONFIG_SMDK6410_SD_CH1
#endif
}
static void __init smdk6410_map_io(void){
…
}
static void __init smdk6410_machine_init(void){
}
5.配置內核。(arch/arm/configs/目錄下是一般內核的默認配置)
支持NandFlash
Device Drivers --->
<*> Memory Technology Device (MTD) support --->
MTD partitioning support
<*> NAND Device Support --->
<*> NAND Flash support for S3C/S3C SoC
device drivers ->
Memory Technology Device (MTD) support --->
Caching block device access to MTD devices
(此出勾選可防止出現(xiàn):VFS: Cannot open root device "mtdblock2" or unknown-block(2,0) 錯誤)
保存退出
復制config文件,編譯內核
#pwd
#/linux2.6.34.2
#cp –f arch/arm/configs/s3c6400_defconfig .config
可以使用make menuconfig對剛剛配置的內核根據(jù)具體的情況進行修改,開始我沒有進行修改直接make zImage,最后在arch/arm/boot/目錄下生成zImage鏡像文件。
6.編譯內核 make zImage
…………………………………..
CPU: Testing write buffer coherency: ok
s3c6400-nand: failed to claim resource 0
WARNING: at drivers/base/core.c:130 device_release+0x70/0x84()
…………………………………………………….
------------[ cut here ]------------
WARNING: at drivers/base/core.c:130 device_release+0x70/0x84()
Device s3c64xx-rtc does not have a release() function, it is broken and must be fixed.
Modules linked in:
……………………………………………………….
[
---[ end trace 1b75b31a2719ed1e ]---
------------[ cut here ]------------
WARNING: at drivers/base/core.c:130 device_release+0x70/0x84()
Device s3c64xx-pata.0 does not have a release() function, it is broken and must be fixed.
Modules linked in:
……………………………………………………………………………..
這個問題就是在mach-smdk6410.c 中的static struct platform_device *smdk6410_devices[] __initdata = {
……………………………………………….
}; 結構體中所有設備都找不到釋放函數(shù),經過分析,可能是這些板級設備初始化時出現(xiàn)問題,所以系統(tǒng)調用釋放資源的函數(shù),可是內核中沒有這些函數(shù)(可能是沒有必要吧,所以內核中沒有定義!此上純屬個人胡猜,希望高手指正),所以出現(xiàn)如上問題,通過我大量的分析,問題在static struct resource s3c_nand_resource[](路徑:arch./arm/plat-samsung) 這個機構體中,
static struct resource s3c_nand_resource[] = {
};
所以解決方法就是修改arch./arm/plat-samsung/dev-nand.c 中的
static struct resource s3c_nand_resource[] = {
};
.end = S3C_PA_NAND + SZ_1M-1, 減去一就行了
7.再次編譯內核,下載運行:
…………………………………
ifconfig: socket: Function not implemented
Try to bring eth0 interface up......ifconfig: socket: Function not implemented
ifconfig: socket: Function not implemented
ifconfig: socket: Function not implemented
route: socket: Function not implemented
Done
Starting Qtopia, please waiting...
Please press Enter to activate this console. touch...
說明內核已經成功引導啟動文件系統(tǒng),只不過現(xiàn)在的內核沒有觸摸板驅動,下一步你就可以移植一下觸摸板驅動了
此教程只是本人所遇到問題的總結,一些問題只做參考,交流,并不具備通用性,如按照上述步驟遇到問題,聯(lián)系我,可以幫著一起解決,本人菜鳥,教程制作倉卒,如有錯誤,請大家見諒,
引用文章:
http://hi.baidu.com/serial_story ... fd0edd267fb500.html
http://www.linuxidc.com/Linux/2010-08/27828p3.htm
http://www.witech.com.cn
評論