0
点赞
收藏
分享

微信扫一扫

嵌入式 Linux 内核驱动开发【The first day: 36093万字】

嵌入式 Linux 内核驱动开发【1】


由于篇幅太大,以章分块,按天写

嵌入式 Linux 内核驱动开发前言



本篇一共分 11 章,各章标题和内容概要如下:


本篇的内容涵盖了嵌入式 Linux 产品开发过程中底层开发的大部分工作,给出的实例也都具有很强的参考意义。


第1章 Linux 内核裁剪和定制

【1】Linux 内核开发简介

  • 具备操作系统的基本知识,理解操作系统原理,最好了解 ~~Linux 操作系统~~ ;
  • 内核绝大部分都是 C 语言编写的,~~C 语言~~ 是必备技能;
  • 内核是用 ~~GNU C 编写的~~ ,尽管符合 ISO C89 标准,但还是使用了一些 GNU 扩展,所以对 GNU C 的一些扩展也必须有所了解;
  • 对 ~~Linux 内核源码~~ 基本分布有大致了解;
  • 产品级的内核开发通常还包括一些内核驱动工作,对~~外设工作原理和驱动编写~~ 也必须有一定的了解。

【2】 Linux 源码阅读工具

【1.2.1】Source Insight

注意:蓝色字体的超链接是我改过的为了好看而已
安装 Source Insight 软件后,新建一个工程,取名并指定数据存放位置,如图 1.1 所示。
在这里插入图片描述
在这里插入图片描述
然后添加源码。浏览选中 Linux 内核源码文件夹后,点击“Add Tree”按钮,将内核源码树的全部文件添加到工程中,如图 1.3 所示。
在这里插入图片描述
添加完成,即可在 Source Insight 中进行源码阅读和编辑了,如图 1.4 所示。
在这里插入图片描述

【1.2.2 Eclipse】

创建内核源码工程。点击 FileNewProject,开始创建工程,在工程创建界面选择创建 C 工程,如图 1.5 所示。
在这里插入图片描述
点击 Next,在 C Project 界面的 Project name 栏中填写工程名称,去掉“Use default location”的勾,点击 Browse 将 Location 设置为 Linux 内核源码目录,如图 1.6 所示。如果不在 Eclipse中编译内核,则使用 Linux GCC 即可,否则请使用安装好的 Cross GCC
在这里插入图片描述
然后点击 Finish,完成 Linux 内核源码导入,在 Eclipse 中即可进行代码阅读和编辑了,如图 1.7 所示。
在这里插入图片描述

【1.2.3】 vim+ctags+cscope

1. Taglist

2. Ctags

$ sudo apt-get install exuberant-ctags 

3. 源码阅读和跟踪

$ ctags -R 

注意如果修改了源码,代码行号发生了变化,需要重新生成 tags 文件。

【1.2.4】 LXR

【3】Linux 内核源码

【1.3.1 目录树概览】

各个目录文件的简要说明如表 1.1 所列。

目录内容
arch/包含各体系结构特定的代码,如 arm、x86、ia64、mips 等,在每个体系结构目录下通常都有: -boot 内核需要的特定平台代码 -kernel 体系结构特有的代码 -lib 通用函数在特定体系结构的实现 -math-emu 模拟 FPU 的代码,在 ARM 中,使用 mach-xxx 代替 -mm 特定体系结构的内存管理实现 -include 特定体系的头文件
block/存放块设备相关代码
crypto/存放加密、压缩、CRC 校验等算法相关代码
Documentation/存放相关说明文档,很多实用文档,包括驱动编写
drivers/存放 Linux 内核设备驱动程序源码。驱动源码在 Linux 内核源码中站了很大比例,常见外设几乎都有可参考源码,对驱动开发而言,该目录非常重要。该目录包含众多驱动,目录按照设备类别进行分类,如 char、block、input、i2c、spi、pci、usb
firmware/存放处理器相关的一些特殊固件
fs/存放所有文件系统代码,如 fat、ext2、ext3、ext4、ubifs、nfs、sysfs
include/存放内核所需、与平台无关的头文件,与平台相关的头文件已经被移动到 arch 平台的include 目录,如 ARM 的头文件目录<arch/arm/include/asm/>
init/包含内核初始化代码
ipc/存放进程间通信代码
kernel/包含 Linux 内核管理代码
lib/库文件代码实现
mm/存放内存管理代码
net/存放网络相关代码
samples/存放提供的一些内核编程范例,如 kfifo;后者相关用户态编程范例,如 hidraw
srcipts/存放一些脚本文件,如 menuconfig 脚本
security/存放系统安全性相关代码
sound存放声音、声卡相关驱动
tools/编译过程中一些主机必要工具
usr/cpio 相关实现
virt/内核虚拟机 KVM

【1.3.2】 快速确定主板关联代码

1. 基础代码

确定主板名称和默认配置文件。

确定对应的主板文件。


# Intel/Marvell Dev Platforms 
obj-$(CONFIG_ARCH_LUBBOCK) += lubbock.o 
obj-$(CONFIG_MACH_MAINSTONE) += mainstone.o 
obj-$(CONFIG_MACH_ZYLONITE300) += zylonite.o zylonite_pxa300.o 

2. 驱动代码

【4】 Linux 内核中的 Makefile 文件

【1.4.1】 顶层 Makefile

1. 内核版本号
打开顶层 Makefile,开头的几行记录了内核源码的版本号,通常如下所示:

VERSION = 2 
PATCHLEVEL = 6 
SUBLEVEL = 35 
EXTRAVERSION =3 
# uname -a 
Linux boy 2.6.35.3-571-gcca29a0-gd431b3d-dirty #22 PREEMPT Tue Oct 27 20:12:33 CST 2015 armv5tejl 
GNU/Linux

2. 编译控制

  • (1)体系结构
ARCH ?= $(SUBARCH) 
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/ \ 
 -e s/sh[234].*/sh/ ) 
$make ARCH=arm 
  • (2)编译器
CROSS_COMPILE ?= $(CONFIG_CROSS_COMPILE:"%"=%) 
…… 
AS = $(CROSS_COMPILE)as 
LD = $(CROSS_COMPILE)ld 
CC = $(CROSS_COMPILE)gcc 
CPP = $(CC) –E 
AR = $(CROSS_COMPILE)ar 
NM = $(CROSS_COMPILE)nm 
STRIP = $(CROSS_COMPILE)strip 
OBJCOPY = $(CROSS_COMPILE)objcopy 
OBJDUMP = $(CROSS_COMPILE)objdump 

$ make ARCH=arm CROSS_COMPILE= arm-linux-gnueabihf- 
CROSS_COMPILE = arm-linux-gnueabihf- 

注意CROSS_COMPILE 指定的交叉编译器必须事先安装并正确设置系统环境变量;如果没有设置环境变量,则需使用绝对地址,例如:

CROSS_COMPILE =/home/ctools/linux-devkit/bin/arm-linux-gnueabihf- 

【1.4.2】 子目录的 Makefile

obj-y += usb-host.o # 默认编译 usb-host.c 文件 
obj-y += gpio/ # 默认编译 gpio 目录 
obj-$(CONFIG_WDT) += wdt.o # wdt.c 编译控制 
obj-$(CONFIG_PCI) += pci/ # pci 目录编译控制 

【5】 Linux 内核中的 Kconfig 文件

【1.5.1】 Kconfig 基本语法

menu "Character devices" 
 
source "drivers/tty/Kconfig" 
 
config DEVKMEM 
 bool "/dev/kmem virtual device support" 
 default y 
 help 
 Say Y here if you want to support the /dev/kmem device. The 
 /dev/kmem device is rarely used, but can be used for certain 
 kind of kernel debugging operations. 
 When in doubt, say "N". 
 …… 
endmenu 

1. 子菜单

config DEVKMEM 
 bool "/dev/kmem virtual device support" 
[*] /dev/kmem virtual device support 

2. 属性


 [*] /dev/kmem virtual device support 

对于三态选项,在配置界面用< >表示:

 <*> Kernel .config support 
menuconfig GENERIC_PWM 
 tristate "PWM Support" 
 default n 
 help 
 Enables PWM device support implemented via a generic 
 framework. If unsure, say N. 

在配置界面表现为:

 < > PWM Support ---> 
config ARM 
 bool 
 default y 
 select HAVE_AOUT 
config NR_CPUS 
 int "Maximum number of CPUs (2-32)" 
 range 2 32 
 depends on SMP 
 default "4" 

3. 目录层次迭代

【1.5.2】 配置项和配置开关

obj-$(CONFIG_BAR) += file_bar.o 
#if defined (CONFIG_BAR) 
 实际处理代码 
#endif 
#if defined (CONFIG_BAR) || defined (CONFIG_BAR_MODULE) 
 实际处理代码 
#endif 

【6】 配置和编译 Linux 内核

【1.6.1】 快速配置内核

$ make ARCH=arm menuconfig 

在这里插入图片描述
在这里插入图片描述

$ cp .config config-bak 
$ cp config-bak .config 
$ make m3352_defconfig 或者 
$ make ARCH=arm CROSS_COMPILE= arm-linux-gnueabihf- m3352_defconfig 

【1.6.2】 内核配置详情

Linux 内核配置菜单比较复杂,下面对一些比较重要的配置界面进行介绍,更多的详细配置,建议进行实际操作。另外,由于 Linux 内核版本差异,实际看到的内核配置界面可能与本节的介绍有所差异。
图 1.12 所示的内核配置主界面,实际包含了如表 1.4 所列的各项一级菜单。
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

1. 通用设置

2. 内核特性

3. 启动选项

(root=/dev/mmcblk0p2 rootwait console=ttyO0,115200) Default kernel command string 
( ) Use bootloader kernel arguments if available 
( ) Extend bootloader kernel arguments 
( ) Always use the default kernel command string 

4. 网络支持


[*] TCP/IP networking 
[*] IP: multicasting 
[*] IP: advanced router 
[*] FIB TRIE statistics 
[*] IP: policy routing 
[*] IP: equal cost multipath 
[*] IP: verbose route monitoring 
[*] IP: kernel level autoconfiguration 
[*] IP: DHCP support 
[*] IP: BOOTP support 
[*] IP: RARP support 
<*> IP: tunneling 
<*> IP: GRE demultiplexer 
<*> IP: GRE tunnels over IP 
[*] IP: broadcast GRE over IP 
[*] IP: multicast routing 
[*] IP: multicast policy routing 
[*] IP: PIM-SM version 1 support 
[*] IP: PIM-SM version 2 support 
[*] IP: ARP daemon support 
[*] IP: TCP syncookie support 
<*> IP: AH transformation 
<*> IP: ESP transformation 
<*> IP: IPComp transformation 
<*> IP: IPsec transport mode 
<*> IP: IPsec tunnel mode 
<*> IP: IPsec BEET mode 
<*> Large Receive Offload (ipv4/tcp) 
<*> INET: socket monitoring interface 
[*] TCP: advanced congestion control ---> 
[*] TCP: MD5 Signature Option support (RFC2385) (EXPERIMENTAL) 
<M> The IPv6 protocol ---> 

5. 设备驱动

6. 文件系统

【1.6.3】 编译内核

$ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- 
$ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- -j8 

1. zImage

cmd_arch/arm/boot/zImage := /home/ctools/i686-arago-linux/usr/bin/arm-linux-gnueabihf-objcopy -O binary 
-R .comment -S arch/arm/boot/compressed/vmlinux arch/arm/boot/zImage 

2. uImage

$ cd arch/arm/boot 
$ ls -la Image zImage uImage 
-rwxrwxr-x 1 chenxibing chenxibing 6460852 Jul 25 09:24 Image 
-rw-rw-r-- 1 chenxibing chenxibing 3135544 Jul 25 09:24 uImage 
-rwxrwxr-x 1 chenxibing chenxibing 3135480 Jul 25 09:24 zImage 

3. mkimage 工具

$ ./mkimage 或者 mkimage 
Usage: ./mkimage -l image 
 -l ==> list image header information 
 ./mkimage [-x] -A arch -O os -T type -C comp -a addr -e ep -n name -d data_file[:data_file...] image 
 -A ==> set architecture to 'arch' 
 -O ==> set operating system to 'os' 
 -T ==> set image type to 'type' 
 -C ==> set compression type 'comp' 
 -a ==> set load address to 'addr' (hex) 
 -e ==> set entry point to 'ep' (hex) 
 -n ==> set image name to 'name' 
 -d ==> use image data from 'datafile' 
 -x ==> set XIP (execute in place) 
 ./mkimage [-D dtc_options] -f fit-image.its fit-image 
 ./mkimage -V ==> print version information and exit 

$ mkimage [-x] -A arch -O os -T type -C comp -a addr -e ep -n name -d data_file[:data_file...] image 
$ mkimage -A arm -O linux -T kernel -C none -a 0x40008000 -e 0x40008000 -n 'Linux-2.6.35' -d 
arch/arm/boot/zImage arch/arm/boot/uImage 
$ mkimage -l uImage_file 
$ mkimage -l uImage 
Image Name: Linux-2.6.35.3-571-gcca29a0-g191 
Created: Tue Nov 17 11:57:47 2015 
Image Type: ARM Linux Kernel Image (uncompressed) 
Data Size: 2572336 Bytes = 2512.05 kB = 2.45 MB 
Load Address: 40008000 
Entry Point: 40008000 
quiet_cmd_uimage = UIMAGE $@ 
 cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A arm -O linux -T kernel \ 
 -C none -a $(LOADADDR) -e $(STARTADDR) \ 
 -n 'Linux-$(KERNELRELEASE)' -d $< $@ 
$ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- -j8 uImage 
cmd_arch/arm/boot/uImage := /bin/bash /home/vmuser/prj/m28x/kernel/linux-2.6.35.3/scripts/mkuboot.sh -A arm 
-O linux -T kernel -C none -a 0x40008000 -e 0x40008000 -n 'Linux-2.6.35.3-571-gcca29a0-g1914ba0' -d 
arch/arm/boot/zImage arch/arm/boot/uImage 

4. 编译内核模块

$ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- modules
$ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabiINSTALL_MOD_PATH=/home/chenxibing/work/rootfs
modules_install 

kernel/drivers/net/bonding/bonding.ko: (1) 
kernel/drivers/usb/serial/usbserial.ko: (2) 
kernel/drivers/usb/serial/ftdi_sio.ko:kernel/drivers/usb/serial/usbserial.ko (3) 
# insmod kernel/drivers/net/bonding/bonding.ko 
# modprobe bonding 
# indmod kernel/drivers/usb/serial/usbserial.ko 
# insmod kernel/drivers/usb/serial/ftdi_sio.ko 
# modprobe ftdi_sio 

1.6.4 运行内核

# tftp 40007fc0 uImage 
# bootm 40007fc0 
## Booting kernel from Legacy Image at 40007fc0 ... 
 Image Name: Linux-2.6.35.3-571-gcca29a0-gd43 
 Image Type: ARM Linux Kernel Image (uncompressed) 
 Data Size: 2653928 Bytes = 2.5 MB 
 Load Address: 40008000 
 Entry Point: 40008000 
 Verifying Checksum ... OK 
 Loading Kernel Image ... OK 
OK 
 
Starting kernel ... 
 
Uncompressing Linux... done, booting the kernel. 
…… 
以下省略 

【7】 Linux 内核裁剪实例

 基于某一个最接近的主板配置来修改; 
 必须的、能确定的选项选中; 
 不能确定的则不要改变原来配置; 
 可选可不选的,建议根据 help 信息决定或者不选; 
 一次改动不要太多,渐进式修改和验证; 
 注意及时备份配置文件,出现意外可以回退恢复。 

【1.7.1】 GPIO 子系统配置

$ make ARCH=arm menuconfig 
 [*] Networking support ---> 
 Device Drivers ---> 
 File systems ---> 
 Kernel hacking ---> 
 [*] SPI support ---> 
 PPS support ---> 
 PTP clock support 
 -*- GPIO Support ---> 
 <*> PWM Support ---> 
--- GPIO Support 
 [*] /sys/class/gpio/... (sysfs interface) 
 *** Memory mapped GPIO drivers: *** 

【1.7.2 】LED 子系统配置

<*> MMC/SD/SDIO card support ---> 
< > Sony MemoryStick card support (EXPERIMENTAL) ---> 
[*] LED Support ---> 
[ ] Accessibility support ---> 
--- LED Support 
[*] LED Class Support 
 *** LED drivers *** 
... 
[*] LED Trigger support 
 *** LED Triggers *** 
<*> LED Timer Trigger 
<*> LED Heartbeat Trigger 
< > LED backlight Trigger 
<*> LED GPIO Trigger 
<*> LED Default ON Trigger 

【1.7.3】 串口配置

Input device support ---> 
 Character devices ---> 
 -*- I2C support ---> 
[*] /dev/kmem virtual device support 
 Serial drivers ---> 
 [ ] ARM JTAG DCC console 
<M> 8250/16550 and compatible serial support 
 *** Non-8250 serial port support *** 
<*> i.MXS debug serial port support 
<*> i.MXS Application serial port support 

【1.7.4】 USB Host 驱动配置

1. 使用 U 盘

[*] Block devices ---> 
[*] Misc devices ---> 
 SCSI device support ---> 
< > Serial ATA and Parallel ATA drivers ---> 
< > RAID Transport Class 
<*> SCSI device support 
< > SCSI target support 
[*] legacy /proc/scsi/ support 
 *** SCSI support type (disk, tape, CD-ROM) *** 
<*> SCSI disk support 
< > SCSI tape support 
< > SCSI OnStream SC-x0 tape support 
< > Sound card support ---> 
[ ] HID Devices ---> 
[*] USB support ---> 
<*> MMC/SD/SDIO card support ---> 
--- USB support 
<*> Support for Host-side USB 
[*] USB device filesystem (DEPRECATED) 
[*] USB device class-devices (DEPRECATED) 
[*] USB runtime power management (suspend/resume and wakeup) 
<*> EHCI HCD (USB 2.0) support 
[*] Support for Freescale controller 
[*] Support for Host1 port on Freescale controller 
[*] Support for DR host port on Freescale controller 
[*] Root Hub Transaction Translators 
<*> USB Mass Storage support 
[ ] USB Mass Storage verbose debug 
File systems ---> 
 DOS/FAT/NT Filesystems ---> 
 <*> MSDOS fs support 
 <*> VFAT (Windows-95) fs support 
 (437) Default codepage for FAT 
 (iso8859-1) Default iocharset for FAT 
 < > NTFS file system support 

2. 使用 USB 键盘和鼠标

<*> Sound card support ---> 
[*] HID Devices ---> 
[*] USB support ---> 
<*> MMC/SD/SDIO card support ---> 
--- HID Devices 
-*- Generic HID support 
[ ] /dev/hidraw raw HID device support 
 *** USB Input Devices *** 
<*> USB Human Interface Device (full HID) support 
[ ] PID device support 
[ ] /dev/hiddev raw HID device support 
 Special HID drivers ---> 
< > Telephony support ---> 
 Input device support ---> 
 Character devices ---> 
-*- I2C support ---> 
< > Joystick interface 
<*> Event interface 
< > Event debugging 
`当然,还需要 USB Host 支持,参考前面“使用 U 盘”配置部分配置好 USB 控制器。
保存配置并编译内核,使用新内核的系统即可支持 USB 键盘和鼠标。`

【1.7.5】 USB Gadget 驱动配置

Device Drivers ---> 
 [*] USB support ---> 
 <*> USB Gadget Support ---> 
<*> USB Peripheral Controller (Inventra HDRC USB Peripheral (TI, ADI, ...)) ---> 
<M> USB Gadget Drivers 
< > Gadget Zero (DEVELOPMENT) 
< > Audio Gadget (EXPERIMENTAL) 
<M> Ethernet Gadget (with CDC Ethernet support) 
[*] RNDIS support 
... 
<M> File-backed Storage Gadget (DEPRECATED) 
[ ] File-backed Storage Gadget testing version 
<M> Mass Storage Gadget 
< > Serial Gadget (with CDC ACM and CDC OBEX support) 

【1.7.6】 SD/MMC 驱动配置

Device Drivers ---> 
 <*> MMC/SD/SDIO card support ---> 
--- MMC/SD/SDIO card support 
... 
*** MMC/SD/SDIO Card Drivers *** 
<*> MMC block device driver 
(8) Number of minors per block device 
[*] Use bounce buffer for simple hosts 
< > SDIO UART/GPS class support 
< > MMC host test driver 
 *** MMC/SD/SDIO Host Controller Drivers *** 
... 
[*] Freescale i.MX Secure Digital Host Controller Interface 
<*> MXS MMC support 
File systems ---> 
 <*> Second extended fs support 
 <*> Ext3 journalling file system support 
 <*> The Extended 4 (ext4) filesystem 

【1.7.7】 网卡驱动配置

Power management options ---> 
[*] Networking support ---> 
 Device Drivers ---> 
 File systems ---> 
为了正常使用网络,通常还需在“`Networking options`”中配置 `TCP/IP`
[*] Networking support ---> 
 Networking options ---> 
 <*> Packet socket 
 <*> Unix domain sockets 
 < > PF_KEY sockets 
 [*] TCP/IP networking 
 [*] IP: multicasting 
 [ ] IP: advanced router 
 [*] IP: kernel level autoconfiguration 
 [*] IP: DHCP support 
 [*] IP: BOOTP support 
 [*] IP: RARP support 
Device Drivers ---> 
 [ ] Multiple devices driver support (RAID and LVM) ---> 
 < > Generic Target Core Mod (TCM) and ConfigFS Infrastructure ---> 
[*] Network device support ---> 
 [ ] ISDN support ---> 
 < > Telephony support ---> 
 Input device support ---> 
[*] --- Ethernet (10 or 100Mbit) ---><*> FEC ethernet controller (of ColdFire and some i.MX CPUs) 
[*] Second FEC ethernet controller (on some ColdFire CPUs) 

【1.7.8】 NFS Client 配置

File systems ---> 
 [*] Network File Systems ---> 
 <*> NFS client support 
 [*] NFS client support for NFS version 3 
 [*] NFS client support for the NFSv3 ACL protocol extension 
 [*] NFS client support for NFS version 4 
 [*] NFS client support for NFSv4.1 (EXPERIMENTAL) 
 [*] Root file system on NFS 

【1.7.9】 PPP 拨号配置

Device Drivers ---> 
 [*] Network device support ---> 
 <M> PPP (point-to-point protocol) support 
 <M> PPP BSD-Compress compression 
 <M> PPP Deflate compression 
 [*] PPP filtering 
 <M> PPP MPPE compression (encryption) (EXPERIMENTAL) 
 [*] PPP multilink support (EXPERIMENTAL) 
 <M> PPP over Ethernet (EXPERIMENTAL) 
 <M> PPP support for async serial ports 
 <M> PPP support for sync tty ports 
#insmod slhc.ko 
#insmod ppp_generic.ko 
#insmod pppox.ko 
#insmod pppoe.ko 
插入模块后,生成/dev/ppp 设备节点,通过 ppp 拨号脚本即可进行拨号了。

【1.7.10】 MTD 配置

< > Connector - unified userspace <-> kernelspace linker ---> 
<*> Memory Technology Device (MTD) support ---> 
 Device Tree and Open Firmware support ---> 
< > Parallel port support ---> 
--- Memory Technology Device (MTD) support 
< > MTD tests support (DANGEROUS) 
< > RedBoot partition table parsing 
[*] Command line partition table parsing 
... 
<*> Direct char device access to MTD devices 
-*- Common interface to block layer for MTD 'translation layers' 
<*> Caching block device access to MTD devices 
… 
<*> NAND Device Support ---> 

--- NAND Device Support 
[ ] Verify NAND page writes 
[ ] Support software BCH ECC 
[ ] Enable chip ids for obsolete ancient NAND devices 
< > GPIO NAND Flash driver 
<*> NAND Flash device on OMAP2, OMAP3 and OMAP4
[root@M283 ~] # cat /proc/mtd 
dev: size erasesize name 
mtd0: 00c00000 00020000 "reserve" 
mtd1: 00080000 00020000 "reserve" 
mtd2: 00080000 00020000 "reserve" 
mtd3: 00080000 00020000 "reserve" 
mtd4: 00080000 00020000 "reserve" 
mtd5: 04000000 00020000 "rootfs" 
mtd6: 02e00000 00020000 "opt" 

【1.7.11】 UBIFS 文件系统配置

Device Drivers ---> 
 <*> Memory Technology Device (MTD) support ---> 
 <*> Enable UBI - Unsorted block images ---> 
--- Enable UBI - Unsorted block images 
(4096) UBI wear-leveling threshold 
(1) Percentage of reserved eraseblocks for bad eraseblocks handling 
< > MTD devices emulation driver (gluebi) 
[ ] UBI debugging 
File systems ---> 
 [*] Miscellaneous filesystems ---> 
 <*> UBIFS file system support 
 [*] Extended attributes support 
 [*] Advanced compression options 
 [*] LZO compression support (NEW) 
 [*] ZLIB compression support (NEW) 

【1.7.12】 CAN 驱动配置

 Power management options ---> 
[*] Networking support ---> 
 Device Drivers ---> 
 File systems ---> 
 --- Networking support 
 Networking options ---> 
[ ] Amateur Radio support ---> 
<*> CAN bus subsystem support ---> 
< > IrDA (infrared) subsystem support ---> 
--- CAN bus subsystem support 
<*> Raw CAN Protocol (raw access with CAN-ID filtering) 
<*> Broadcast Manager CAN Protocol (with content filtering) 
< > CAN Gateway/Router (with netlink configuration) (NEW) 
 CAN Device Drivers ---> 
CAN Device Drivers ---> 
 <*> Virtual Local CAN Interface (vcan) (NEW) 
 <> Serial / USB serial CAN Adaptors (slcan) (NEW) 
 < > Platform CAN drivers with Netlink support (NEW) 
 <*> Freescale FlexCAN 

【8】 EPC-28x 平台内核快速编译

1. 解压缩

vmuser@Linux-host ~$ tar -vxjf EPC-28x.xxxxx.tar.bz2 

2. 编译内核

vmuser@Linux-host ~$ cd linux-2.6.35.3 
vmuser@Linux-host ~/ linux-2.6.35.3$ make uImage 
vmuser@Linux-host ~/ linux-2.6.35.3$cp .config config-bak 

第二章,等你
在这里插入图片描述

举报

相关推荐

0 条评论