×
单片机 > 单片机程序设计 > 详情

#嵌入式Linux最小系统移植# mini2440内核4.0.8移植记录

发布时间:2024-04-30 发布时间:
|

/*移植内核Linux4.0.8*/


1.机器码匹配(linux/arch/arm/tools/mach-types)

# machine_is_xxx CONFIG_xxxx MACH_TYPE_xxx number

mini2440 MACH_MINI2440 MINI2440 1999

oluan2440 MACH_OLUAN2440 OLUAN2440 1999


MACH_TYPE_xxx 与MACHINE_START中匹配

CONFIG_xxxx 与linux/arch/arm/mach-s3c2440中的Kconfig、Makefile匹配


2.修改:MACHINE_START(S3C2440, "SMDK2440")

为: MACHINE_START(OLUAN, "Hello Hulin oluan!")


3.修改晶振频率:

s3c2440_init_clocks(12000000); //友善之臂开发板晶振频率为12MHz


4.修改Makefile和Kconfig

修改Kconfig,添加

config MACH_OLUAN2440

bool "OLUAN2440 Test Hello xiaozeng"

select EEPROM_AT24 if I2C

select LEDS_CLASS

select LEDS_TRIGGERS

select LEDS_TRIGGER_BACKLIGHT

select NEW_LEDS

select S3C_DEV_NAND

select S3C_DEV_USB_HOST

select S3C_SETUP_CAMIF

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.



5.make mini2440_defconfig


6.make menuconfig

配置system type


7.make zImage

移植出错:“MACH_TYPE_OLUAN” undeclared here (not in a function)

解决: MACHINE_START(OLUAN, "Hello Hulin oluan!")写错

该写为 (OLUAN2440, "Hello Hulin oluan!")


再次make zImage


(等待较长时间...)


Kernel: arch/arm/boot/zImage is ready 大小:2.8 MB


8.将zImage烧入开发板,错误:no os found

将fs_mini一并烧入开发板,错误:串口信息停止在Load Kernel...


9.在移植内核中修改Nand Flash分区表


/*下面开始分析smdk2440_machine_init(void)*/


1.添加


2.make menuconfig


3.make zImage

编译错误:undefined reference to 'smdk_machine_init'

解决: 注释:

//smdk_machine_init()

自己添加相关函数:

s3c_nand_set_platdata(&oluan2440_nand_info);

platform_add_devices(oluan_devices, ARRAY_SIZE(oluan_devices));


编译错误:arch/arm/mach-s3c24xx/mach-oluan2440.c:214: error: array type has incomplete element type

arch/arm/mach-s3c24xx/mach-oluan2440.c:215: error: array index in non-array initializer

解决: 添加头文件:

#include

#include


4.Kernel: arch/arm/boot/zImage is ready 大小:2.8 MB


5.将fs_mini一并烧入开发板,错误仍然为:串口信息停止在Load Kernel...



/*换了开源的uboot

E:嵌入式Linux【申嵌培训】u-boot移植与开发班

【申嵌培训】u-boot实战移植篇srcu-boot-2010.03-embedclub-menuu-boot-2010.03

*/

1.make uImage

编译错误:"mkimage" command not found - U-Boot images will not be built

解决: mkimage

bash: mkimage: 未找到命令...

安装软件包“uboot-tools”以提供命令“mkimage”? [N/y] y


2.make uImage

Image Name: Linux-4.0.8

Created: Mon Dec 5 02:38:32 2016

Image Type: ARM Linux Kernel Image (uncompressed)

Data Size: 2772696 Bytes = 2707.71 kB = 2.64 MB

Load Address: 30008000

Entry Point: 30008000

Image arch/arm/boot/uImage is ready


3.把uImage(linux4.0.8)烧入开发板


[u-boot@SMDK2440A]# bootm

## Booting kernel from Legacy Image at 30008000 ...

Image Name: Linux-4.0.8

Created: 2016-12-04 18:38:32 UTC

Image Type: ARM Linux Kernel Image (uncompressed)

Data Size: 2772696 Bytes = 2.6 MB

Load Address: 30008000

Entry Point: 30008000

Verifying Checksum ... OK

XIP Kernel Image ... OK

OK


Starting kernel ...


data abort

pc : [<30008008>] lr : [<33fa6cac>]

sp : 33f3d64c ip : 00000000 fp : 30008000

r10: 33fc4008 r9 : 000007cf r8 : 33f3ffe0

r7 : 33f3ffc4 r6 : 33f412ad r5 : 30000100 r4 : 00000000

r3 : 00000000 r2 : 30000100 r1 : 000007cf r0 : 00000000

Flags: nzCv IRQs off FIQs off Mode SVC_32

Resetting CPU ...


resetting ...


解决:手动法:/zixunimg/eeworldimg/blog.csdn.net/zgrjkflmkyc/article/details/8975750

自动法:/zixunimg/eeworldimg/blog.chinaunix.net/uid-28382924-id-3421282.html



4.内核正常启动信息:

## Booting kernel from Legacy Image at 30008000 ...

Image Name: Linux kernel www.embedclub.com

Created: 2011-08-17 6:24:43 UTC

Image Type: ARM Linux Kernel Image (uncompressed)

Data Size: 2266616 Bytes = 2.2 MB

Load Address: 30008000

Entry Point: 30008040

Verifying Checksum ... OK

XIP Kernel Image ... OK

OK


Starting kernel ...


Uncompressing Linux.....................................................

.............................................. done, booting the kernel.



5.出错: Starting kernel ... 之后串口输出全是乱码

解决: 修改串口波特率

set bootargs noinitrd root=/dev/mtdblock3 rootfstype=yaffs2 init=/linuxrc console=ttySAC0,115200

save


出错: ftl_cs: FTL header not found的解决办法

解决: /zixunimg/eeworldimg/blog.chinaunix.net/uid-20665047-id-3451562.html


出错: 企鹅图标没有


6.


挂载root时候出错:

end_request: I/O error, dev mtdblock3, sector 0

Buffer I/O error on device mtdblock3, logical block 0

end_request: I/O error, dev mtdblock3, sector 0

Buffer I/O error on device mtdblock3, logical block 0

end_request: I/O error, dev mtdblock3, sector 8


解决:Kernel command line: 出错

bootargs noinitrd root=/dev/mtdblock4 rootfstype=yaffs2 init=/linuxrc console=ttySAC0,115200

少了rootfstype

在uboot下

set bootargs noinitrd root=/dev/mtdblock3 rootfstype=yaffs2 init=/linuxrc console=ttySAC0,115200;save



7. 烧写内核: nand erase 0x60000 0x500000; nand write 0x30008000 0x60000 0x500000

烧写root: nand erase 0x560000 $filesize; nand write.yaffs 0x30008000 0x560000 $filesize


出错:VFS: Cannot open root device "mtdblock3" or unknown-block(31,3): error -19

Please append a correct "root=" boot option; here are the available partitions:

解决:给内核打上yaffs2补丁


8.打yaffs2补丁


# git clone git://www.aleph1.co.uk/yaffs2

# cd yaffs2/

# ./patch-ker.sh c /home/invoker/akernel4.0/linux-4.0.8

# make menuconfig 将添加yaffs2至内核

# make uImage


出错:In function 'yaffs_readpage_nolock': ///zixunimg/eeworldimg/www.2cto.com/kf/201608/533812.html

struct file has no member named 'f_dentry'

解决:在yaffs_vfs.c中添加:

#define f_dentry f_path.dentry

#define f_vfsmnt f_path.mnt


出错:fs/yaffs2/yaffs_endian.h:31: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'swap_loff_t'

解决:在yaffs_endian.h中添加:

#ifndef Y_LOFF_T

#define Y_LOFF_T loff_t

#endif


出错:conflicting types for 'nval_del'

解决:error: conflicting types for ‘nval_del’,查看nval_del几个函数,这里我看不出有什么类型冲突错误,

网上搜了下主要是第一个WARNING那里引起的.

在yaffs_nameval.h中,结构体struct yaffs_dev的定义出现在参数列表中,

而在此之前没有定义,这样会导致函数不识别这个结构体引发上面的错误,

查询了下struct yaffs_dev在”yaffs_guts.h”中被定义,

因此在yaffs_nameval.h文件中include下”yaffs_guts.h”就OK了


出错:yaffs_guts.c:line: undefined reference to function

解决:在Makefile下面添加:yaffs-y += yaffs_endian.o

[1] [2]
嵌入式Linux最小系统移植mini2440内核48

『本文转载自网络,版权归原作者所有,如有侵权请联系删除』

热门文章 更多
单片机电子密码锁仿真 可修改密码