嵌入式linux学习笔记(一)
来源:互联网 发布:淘宝手机怎么删除差评 编辑:程序博客网 时间:2024/05/22 23:10
最近开始学习linux驱动编写,目前直接使用jz2440已移植好的系统配合视频开始学习驱动编写,但是总是出现这样那样的问题。于是决定重头开始,先自己移植内核,在开始驱动学习。
今天参照《嵌入式linux完全应用手册》进行驱动移植。
cross_compile:4.9.3(下载地址:https://launchpad.net/gcc-arm-embedded/+download)。
kernel:2.6.22.6
1、先修改顶层目录下的Makefile文件:
ARCH = arm
CROSS_COMPILE = arm-none-eabi-
2、输入make s3c2410_defconfig进行编译,在编译的过程中发生错误。
CC fs/binfmt_aout.oIn file included from include/linux/spinlock.h:53:0, from include/linux/module.h:9, from fs/binfmt_aout.c:7:fs/binfmt_aout.c: In function 'load_aout_binary':include/linux/a.out.h:141:38: error: 'SEGMENT_SIZE' undeclared (first use in this function) #define _N_SEGMENT_ROUND(x) ALIGN(x, SEGMENT_SIZE) ^include/linux/kernel.h:36:37: note: in definition of macro '__ALIGN_MASK' #define __ALIGN_MASK(x,mask) (((x)+(mask))&~(mask)) ^include/linux/a.out.h:141:29: note: in expansion of macro 'ALIGN' #define _N_SEGMENT_ROUND(x) ALIGN(x, SEGMENT_SIZE) ^include/linux/a.out.h:148:9: note: in expansion of macro '_N_SEGMENT_ROUND' : (_N_SEGMENT_ROUND (_N_TXTENDADDR(x)))) ^fs/binfmt_aout.c:320:30: note: in expansion of macro 'N_DATADDR' (current->mm->start_data = N_DATADDR(ex)); ^include/linux/a.out.h:141:38: note: each undeclared identifier is reported only once for each function it appears in #define _N_SEGMENT_ROUND(x) ALIGN(x, SEGMENT_SIZE) ^include/linux/kernel.h:36:37: note: in definition of macro '__ALIGN_MASK' #define __ALIGN_MASK(x,mask) (((x)+(mask))&~(mask)) ^include/linux/a.out.h:141:29: note: in expansion of macro 'ALIGN' #define _N_SEGMENT_ROUND(x) ALIGN(x, SEGMENT_SIZE) ^include/linux/a.out.h:148:9: note: in expansion of macro '_N_SEGMENT_ROUND' : (_N_SEGMENT_ROUND (_N_TXTENDADDR(x)))) ^fs/binfmt_aout.c:320:30: note: in expansion of macro 'N_DATADDR' (current->mm->start_data = N_DATADDR(ex));make[1]: *** [fs/binfmt_aout.o] Error 1make: *** [fs] Error 2
SEGMENT_SIZE’ undeclared
解决方法:
修改为:
510: NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include) -Dlinux
3、修改arch/arm/mach-s3c2440/mach-s3c2440.c中的时钟初始化参数:
修改为:180 :s3c24xx_init_clocks(12000000);
4、修改mtd分区:
/* 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 = SZ_16M,
}
};
由于我是用的jz2440自带的u-boot其mtd分区如下:
device nand0 <nandflash0>, # parts = 4
#: name size offset mask_flags
0: bootloader 0x00040000 0x00000000 0
1: params 0x00020000 0x00040000 0
2: kernel 0x00200000 0x00060000 0
3: root 0x0fda0000 0x00260000 0
所以,修改为:
static struct mtd_partition smdk_default_nand_part[] = {
[0] = {
.name = "bootloader",
.size = 0x00040000,
.offset = 0,
},
[1] = {
.name = "params",
.offset = 0x00040000,
.size = 0x00020000,
},
[2] = {
.name = "kernel",
.offset = 0x00060000,
.size = 0x00200000,
},
[3] = {
.name = "root",
.offset =0x00260000,
.size = 0x0fda0000,
},
};
- 嵌入式linux学习笔记(一)
- 嵌入式Linux学习笔记(一)
- 嵌入式学习笔记(一)
- Linux及嵌入式学习笔记一
- 嵌入式linux学习笔记一--打补丁
- 初学嵌入式Linux开发,学习笔记一
- 嵌入式Linux学习(一)
- 嵌入式Linux学习笔记
- 嵌入式系统学习笔记(一)
- 嵌入式C学习笔记(一)嵌入式概述
- 嵌入式开发之Linux基础第二天学习笔记 linux系统命令(一)&其他
- 谈谈如何学习嵌入式Linux(一)
- 嵌入式Linux基础学习(一)
- 嵌入式Linux驱动学习笔记(一)------第一个LED驱动程序
- 嵌入式Linux学习笔记(1)
- 嵌入式Linux学习笔记(二)
- 嵌入式Linux实验笔记(一)
- 嵌入式学习笔记(2)--嵌入式Linux内核定制
- 杭电-2579Dating with girls(2)(bfs+三维标记)
- RANSAC笔记
- 2015年ACMICPC亚洲区域赛长春站F题-Almost Sorted Array
- UICollectionView
- 大学生就业那些事——招聘会感想
- 嵌入式linux学习笔记(一)
- [BZOJ1878] [SDOI2009]HH的项链
- UML第八集
- ios新手必看之手势
- 软件开发文档总结
- HDU 5510 KMP
- Parse教程三(利用Parse进行本地数据保存与使用)
- Timer与TimerTask的真正原理&使用介绍
- NSCalendar