- UID
- 1023166
- 性别
- 男
- 来自
- 燕山大学
|
关键词: 内核
linux内核:
1.linux内核目录结构
开发板的配置信息文件存放位置:
linux-2.6.32.2/arch/arm/configs
内核映像默认存放位置:
linux-2.6.32.2/arch/arm/boot
板级存放位置:
linux-2.6.32.2/arch/arm/mach-s3c2440
CPU平台相关文件存放位置:
linux-2.6.32.2/arch/arm/plat-s3c
linux-2.6.32.2/arch/arm/plat-s3c34xx
常用文件系统:
cramfs,fat,nfs,ntfs,proc,sysfs[内存],yaffs,jffs2,ext2,ext3,ext4.
2.linux裁剪方法
1)修改交叉编译器:打开顶层Makefie,搜索ARCH,CROSS_COMPILE,修改如下:
183 ARCH = arm
184 # CROSS_COMPILE = arm-linux-
185 CROSS_COMPILE = arm-none-linux-gnueabi-
2)配置,裁剪功能。
a.参考相近的配置文件,在此基础上进行修改。
[root@dhua linux-2.6.32.2]# make help 把所有配置都列出来
只列出包含2440的配置文件
[root@dhua linux-2.6.32.2]# make help | grep 2440
mini2440_defconfig - Build for mini2440
b.备份配置好的文件,把.config文件保存为config_back[这步的前提是你配置好过内核]
[root@dhua linux-2.6.32.2]# cp .config config_back
c.4种配置方法:
(1)make config:询问式的
(2)make xconfig:窗口模式,比较适合使用鼠标的人使用
(3)make menuconfig:终端中显示菜单,比较适合熟悉键盘的人使用
(4)直接使用vi编辑器/文本编辑器修改.config文件
===========================================================================================
参考mini2440_defconfig,把mini2440_defconfig的配置文件覆盖.config,
[root@dhua linux-2.6.32.2]# make mini2440_defconfig
HOSTLD scripts/kconfig/conf
#
# configuration written to .config
#
[root@dhua linux-2.6.32.2]# make menuconfig
改版本号:在General setup 后面的local.....里加
system type--ARM system type选对
--s3c2440 machines--SMDK2440
kernel features--Memory split选3G/1G
选上EABI
boot options--kernel execute-in-place for rom在u-boot那里的那一场串环境变量
userspace binary for---kernel support for ELF binaries
重点配置对象:
device drivers---网卡支持:network device support--10 or 100--dm9000
---character--ledl beep
---graphices support--LCD:帧缓冲设备--s3c2410 lcd
lcd select--
---企鹅Bootup logo[console display d support--framebuffer console support]
u盘usb support--usb mass storge support
文件系统file system---network file system--
语言native language support--简体中文 NLS UTF-8选上
==============================================================================================
make -j2
然后在u-boot-1.3.4/tools/将mkimage拷到系统的bin目录下或者交叉编译器的目录下去,
然后:make uImage,编译出uIamge内核镜像
3.linux内核映像制作
4.添加菜单
每一个目录都有一个Kconfig和Makefile,Kconfig管理本层菜单,Makefile管理相应的c文件。
有子菜单的选项使用menu作为关键字,如下:
上层菜单包含下层菜单的Kconfig
menu "Device Drivers"
source "drivers/base/Kconfig"
source "drivers/connector/Kconfig"
一下是内部子菜单的书写格式:
menu "Generic Driver Options" #菜单名
#子菜单关键字是string ,表示菜单式输文字的
config UEVENT_HELPER_PATH #菜单对于宏
string "path to uevent helper" #子菜单名
depends on HOTPLUG #依赖条件
default "/sbin/hotplug" #默认值
help #帮组信息
Path to uevent helper program forked by the kernel for
every uevent.
#子菜单关键字是bool ,表示这个选项只有选中和不选中两中状态。
config DEVTMPFS
bool "Create a kernel maintained /dev tmpfs (EXPERIMENTAL)"
depends on HOTPLUG && SHMEM && TMPFS
help
This creates a tmpfs filesystem, and mounts it at bootup
and mounts it at /dev. The kernel driver core creates device
nodes for all registered devices in that filesystem. All device
nodes are owned by root and have the default mode of 0600.
Userspace can add and delete the nodes as needed. This is
intended to simplify bootup, and make it possible to delay
the initial coldplug at bootup done by udev in userspace.
It should also provide a simpler way for rescue systems
to bring up a kernel with dynamic major/minor numbers.
Meaningful symlinks, permissions and device ownership must
still be handled by userspace.
If unsure, say N here.
#关键字是tristate,有3种选择,分别是编译进内核,编译出模块[M],不选中[]。
config LEDS_S3C2440
tristate "LED Support for S3C2440 GPIO LEDs"
depends on ARCH_S3C2410
default y if ARCH_S3C2410
help
This option enables support for LEDs connected to GPIO lines
on S3C2440 boards.
-------------------------------------------------------------
Kconfig和.config的关系:
每选中一项会在.config文件中把生成一个宏名:CONFIG_加上Kconfig对应菜单宏名
比如Kconfig有如下选项:
config LEDS_S3C2440
tristate "LED Support for S3C2440 GPIO LEDs"
depends on ARCH_S3C2410 #CONFIG_ARCH_S3C2410也是Kconfig中的一个菜单宏名,如果ARCH_S3C2410选中,这项菜单才会显示出来,
default y if ARCH_S3C2410 #显示出来的默认状态:y 显示 * ;m 显示 M ,n 显示不选中
help
This option enables support for LEDs connected to GPIO lines
on S3C2440 boards.
选中时(*)后,对应.config的名字为:
CONFIG_LEDS_S3C2440=y
选中时(M)后,对应.config的名字为:
CONFIG_LEDS_S3C2440=m
不选中时,对应.config的名字为:
#CONFIG_LEDS_S3C2440 is not set
深圳专业嵌入式技术实训,QQ754634522
-----------------------------------------------------------
.config和Makefie的关系:
在driver/char/Makefie有以下语句:
############################################################################
obj-$(CONFIG_LEDS_S3C2440) += s3c2440_leds.o #$为在后面累加字符串
obj-$(CONFIG_S3C2440_BUTTONS) += s3c2440_buttons.o
obj-$(CONFIG_S3C2440_BUZZER) += s3c2440_pwm.o
obj-$(CONFIG_S3C2440_ADC) += s3c2440_adc.o
|
|
|