原文网址:http://blog.chinaunix.net/uid-29589379-id-4708909.html

四,LED驱动的添加

1, 将led.c驱动文件拷贝到linux-3.1.4/drivers/char/目录下

root@char# pwd

/change/linux-3.1.4/drivers/char

root@char#  cp /mnt/hgfs/fh/driver/my_driver/led.c ./

2, 修改当前目录下的配置文件,增加内核配置项

root@char# vim Kconfig

添加:

config ARCH_S3C2410_LED

tristate "s3c2410 led support"

default y

help

s3c2410 led support

3, 修改Makefile,添加内核配置

root@char# vim Makefile

obj-$(CONFIG_ARCH_S3C2410_LED)  +=led.o

4, 配置板文件资源

1)struct resource smdk2410_myres[] = {

[0] = {

.start = 0x56000054,

.end = 0x56000054,

.flags = IORESOURCE_MEM,

},              //GPFDAT

[1] = {

.start = 0x56000050,

.end = 0x56000050,

.flags = IORESOURCE_MEM,

},              //GPFCON

};

2)struct platform_device smdk2410_platdev = {

.name           ="led_driver",//驱动程序里面的设备名

.id             = 0,

.num_resources  = ARRAY_SIZE(smdk2410_myres),

.resource       = smdk2410_myres,

};

3)static struct platform_device *smdk2410_devices[] __initdata = {

&smdk2410_platdev,

}

注:我这里用的是fs2410开发板上的D12号led灯,配置其他的led灯同理。

5, 配置内核

root@linux-3.1.4#  make menuconfig

Device Drivers  --->

Character devices  --->

<*> s3c2410 led support (NEW)

6, 重新编译内核

Make zImage

五,蜂鸣器的驱动添加

蜂鸣器的驱动添加和led的驱动添加过程是一样的,过程如下:

1, root@char# cp /mnt/hgfs/fh/driver/my_driver/beep.c ./

2, 修改drivers/char/Kconfig,提供内核配置项

config ARCH_S3C2410_BEEP

tristate "s3c2410 beep support

default y

help

s3c2410 beep support

3, 修改Makefile

obj-$(CONFIG_ARCH_S3C2410_BEEP) += beep.o

4, 资源选配,和led的资源选配同理

5, 选配内核

root@linux-3.1.4#  make menuconfig

Device Drivers  --->

Character devices  --->

<*> s3c2410 beep support (NEW)

6, 编译内核

root@linux-3.1.4#  make zImage

六,LCD驱动的添加

在嵌入式系统中,lcd常作为交互使用,其移植步骤如下:

1, 在板文件arch/arm/mach-s3c2410/mach-smdk2310.c中添加下列的头文件

root@mach-s3c2410#  vim mach-smdk2410.c

#include <mach/fb.h>

#include <mach/regs-lcd.h>

2, 添加LCD相关的平台信息

root@mach-s3c2410#  vim mach-smdk2410.c

//相关的配置信息根据LCD屏相应的参数配置

static struct s3c2410fb_display s3c2410_lcd_cfg[] __initdata = {

{

.lcdcon5 = S3C2410_LCDCON5_FRM565   |

S3C2410_LCDCON5_INVVCLK  |

S3C2410_LCDCON5_INVVLINE |

S3C2410_LCDCON5_INVVFRAME|

S3C2410_LCDCON5_PWREN    |

S3C2410_LCDCON5_HWSWP,

.type = S3C2410_LCDCON1_TFT,

.width = 320,

.height = 240,

.pixclock = 100000,

.xres = 320,

.yres = 240,

.bpp = 16,

.left_margin = 20,//13,

.right_margin = 38,//8,

.hsync_len = 30,//4,

.upper_margin = 4,//2,

.lower_margin = 15,//7,

.vsync_len = 3,//4,

},

};

static struct s3c2410fb_mach_info s3c2410_fb_info __initdata = {

.displays  = s3c2410_lcd_cfg,

.num_displays  = ARRAY_SIZE(s3c2410_lcd_cfg),

.default_display= 0,

.gpcup = 0xffffffff,

.gpcup_mask = 0xffffffff,

.gpccon = 0xaa9556a9,

.gpccon_mask = 0xffffffff,

.gpdup = 0xffffffff,

.gpdup_mask = 0xffffffff,

.gpdcon = 0xaaaaaaaa,

.gpdcon_mask = 0xffffffff,

.lpcsel = ((0xCE6) & ~7) | 1<<4,

};

static void __init smdk2410_init(void)

{

s3c24xx_fb_set_platdata(&s3c2410_fb_info);

}

3, 配置内核

root@linux-3.1.4#  make menuconfig

Device Drivers  --->

Graphics support  --->

<*> Support for frame buffer devices  --->

<*>   S3C2410 LCD framebuffer support

[*] Bootup logo  --->//LCD成功启动,就可以看见linuxLOGO^^

4,编译内核

make zImage

七,USB驱动的添加

1, 配置内核

root@linux-3.1.4#  make menuconfig

Device Drivers  --->

SCSI device support  --->

<*> SCSI disk support

<*> SCSI generic support

<*> SCSI media changer support

[*] USB support  --->

<*>   USB Mass Storage support

File systems  --->

-*- Native language support  --->

<*>   Codepage 437 (United States, Canada)

<*>   Simplified Chinese charset (CP936, GB2312)

<*>   ASCII (United States)

<*>   NLS ISO 8859-1  (Latin 1; Western European Languages)

2, 编译内核

make zImage

八,视频V4L2驱动的添加

1, 配置内核

Device Drivers  --->

<*> Multimedia support  --->

<*>   Video For Linux

[*]   Video capture adapters (NEW)  --->

[*]   V4L USB devices (NEW)  --->

<*>   USB Video Class (UVC)

[*]     UVC input events device support (NEW)

2,编译内核

make zImage

进过上面八个步骤的配置,我们可以在板子上面看见这样的打印信息:

Using CS8900-0 device

TFTP from server 192.168.2.201; our IP address is 192.168.2.200

Filename 'zImage'.

Load address: 0x30008000

Loading: #################################################################

#################################################################

####################################

done

Bytes transferred = 2430016 (251440 hex)

setup linux parameters at 0x30000100

linux command line is: "root=nfs nfsroot=192.168.2.201:/source/rootfs init=/linuxrc console=ttySAC0,115200 ip=192.168.2.200"

## Starting application at 0x30008000 ...

Uncompressing Linux... done, booting the kernel.

Linux version 3.1.4@genehang (root@ubuntu) (gcc version 4.4.3 (ctng-1.6.1) ) #7 Thu Jan 12 14:38:47 CST 2012

CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=00007177

CPU: VIVT data cache, VIVT instruction cache

Machine: fs2410@panzhh

ATAG_INITRD is deprecated; please update your bootloader.

Memory policy: ECC disabled, Data cache writeback

BUG: mapping for 0x19000000 at 0xe0000000 overlaps vmalloc space

CPU S3C2410A (id 0x32410002)

S3C24XX Clocks, Copyright 2004 Simtec Electronics

S3C2410: core 202.800 MHz, memory 101.400 MHz, peripheral 50.700 MHz

CLOCK: Slow mode (1.500 MHz), fast, MPLL on, UPLL on

Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 16256

Kernel command line: root=nfs nfsroot=192.168.2.201:/source/rootfs init=/linuxrc console=ttySAC0,115200 ip=192.168.2.200

PID hash table entries: 256 (order: -2, 1024 bytes)

Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)

Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)

Memory: 64MB = 64MB total

Memory: 60140k/60140k available, 5396k reserved, 0K highmem

Virtual kernel memory layout:

vector  : 0xffff0000 - 0xffff1000   (   4 kB)

fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)

DMA     : 0xffc00000 - 0xffe00000   (   2 MB)

vmalloc : 0xc4800000 - 0xf6000000   ( 792 MB)

lowmem  : 0xc0000000 - 0xc4000000   (  64 MB)

modules : 0xbf000000 - 0xc0000000   (  16 MB)

.text : 0xc0008000 - 0xc0439a60   (4295 kB)

.init : 0xc043a000 - 0xc045d000   ( 140 kB)

.data : 0xc045e000 - 0xc04864e0   ( 162 kB)

.bss : 0xc0486504 - 0xc04aead4   ( 162 kB)

NR_IRQS:85

irq: clearing subpending status 00000002

Console: colour dummy device 80x30

Calibrating delay loop... 50.17 BogoMIPS (lpj=125440)

pid_max: default: 32768 minimum: 301

Mount-cache hash table entries: 512

CPU: Testing write buffer coherency: ok

gpiochip_add: gpios 256..271 (GPIOJ) failed to register

gpiochip_add: gpios 288..303 (GPIOK) failed to register

gpiochip_add: gpios 320..334 (GPIOL) failed to register

gpiochip_add: gpios 352..353 (GPIOM) failed to register

NET: Registered protocol family 16

S3C Power Management, Copyright 2004 Simtec Electronics

S3C2410: Initialising architecture

bio: create slab <bio-0> at 0

SCSI subsystem initialized

usbcore: registered new interface driver usbfs

usbcore: registered new interface driver hub

usbcore: registered new device driver usb

NET: Registered protocol family 2

IP route cache hash table entries: 1024 (order: 0, 4096 bytes)

TCP established hash table entries: 2048 (order: 2, 16384 bytes)

TCP bind hash table entries: 2048 (order: 1, 8192 bytes)

TCP: Hash tables configured (established 2048 bind 2048)

TCP reno registered

UDP hash table entries: 256 (order: 0, 4096 bytes)

UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)

NET: Registered protocol family 1

RPC: Registered named UNIX socket transport module.

RPC: Registered udp transport module.

RPC: Registered tcp transport module.

RPC: Registered tcp NFSv4.1 backchannel transport module.

NetWinder Floating Point Emulator V0.97 (extended precision)

s3c-adc s3c24xx-adc: attached adc driver

JFFS2 version 2.2. (NAND) (SUMMARY)  漏 2001-2006 Red Hat, Inc.

ROMFS MTD (C) 2007 Red Hat, Inc.

msgmni has been set to 117

io scheduler noop registered

io scheduler deadline registered

io scheduler cfq registered (default)

Console: switching to colour frame buffer device 40x30

fb0: s3c2410fb frame buffer device

Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled

s3c2410-uart.0: ttySAC0 at MMIO 0x50000000 (irq = 70) is a S3C2410

console [ttySAC0] enabled

s3c2410-uart.1: ttySAC1 at MMIO 0x50004000 (irq = 73) is a S3C2410

lp: driver loaded but no devices found

==========beep==============

==========led=============

ppdev: user-space parallel port driver

brd: module loaded

loop: module loaded

Uniform Multi-Platform E-IDE driver

ide-gd driver 1.18

ide-cd driver 5.00

SCSI Media Changer driver v0.25

S3C24XX NAND Driver, (c) 2004 Simtec Electronics

s3c24xx-nand s3c2410-nand: Tacls=3, 29ns Twrph0=7 69ns, Twrph1=3 29ns

s3c24xx-nand s3c2410-nand: NAND hardware ECC

NAND device: Manufacturer ID: 0xec, Chip ID: 0x76 (Samsung NAND 64MiB 3,3V 8-bit)

Scanning device for bad blocks

Creating 4 MTD partitions on "NAND":

0x000000000000-0x000000040000 : "uBoot"

0x000000040000-0x000000440000 : "kernel"

0x000000440000-0x000000c40000 : "fs"

0x000000c40000-0x000004000000 : "extern fs"

Cirrus Logic CS8900A driver for Linux (Modified for SMDK2410)

eth0: CS8900A rev E at 0xe0000300 irq=53, addr: 00: 0:3E:26:0A: 0

ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver

s3c2410-ohci s3c2410-ohci: S3C24XX OHCI

s3c2410-ohci s3c2410-ohci: new USB bus registered, assigned bus number 1

s3c2410-ohci s3c2410-ohci: irq 42, io mem 0x49000000

hub 1-0:1.0: USB hub found

hub 1-0:1.0: 2 ports detected

Initializing USB Mass Storage driver...

usbcore: registered new interface driver usb-storage

USB Mass Storage support registered.

usbcore: registered new interface driver libusual

usbcore: registered new interface driver usbserial

USB Serial support registered for generic

usbcore: registered new interface driver usbserial_generic

usbserial: USB Serial Driver core

USB Serial support registered for FTDI USB Serial Device

usbcore: registered new interface driver ftdi_sio

ftdi_sio: v1.6.0:USB FTDI Serial Converters Driver

USB Serial support registered for pl2303

usbcore: registered new interface driver pl2303

pl2303: Prolific PL2303 USB to serial adaptor driver

mousedev: PS/2 mouse device common for all mice

S3C24XX RTC, (c) 2004,2006 Simtec Electronics

s3c-rtc s3c2410-rtc: rtc disabled, re-enabling

s3c-rtc s3c2410-rtc: rtc core: registered s3c as rtc0

Linux video capture interface: v2.00

usbcore: registered new interface driver uvcvideo

USB Video Class driver (1.1.1)

S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics

s3c2410-wdt s3c2410-wdt: watchdog inactive, reset disabled, irq enabled

s3c-sdi s3c2410-sdi: powered down.

s3c-sdi s3c2410-sdi: mmc0 - using pio, sw SDIO IRQ

TCP cubic registered

NET: Registered protocol family 17

s3c-rtc s3c2410-rtc: setting system clock to 2003-12-26 11:23:28 UTC (1072437808)

cs8900_start

enable the ethernet controlle

request_irq

IP-Config: Guessing netmask 255.255.255.0

IP-Config: Complete:

device=eth0, addr=192.168.2.200, mask=255.255.255.0, gw=255.255.255.255,

host=192.168.2.200, domain=, nis-domain=(none),

bootserver=255.255.255.255, rootserver=192.168.2.201, rootpath=

VFS: Mounted root (nfs filesystem) on device 0:12.

Freeing init memory: 140K

Please press Enter to activate this console.

[root@$ /]#usb 1-1: new full speed USB device number 2 using s3c2410-ohci

uvcvideo: Found UVC 1.00 device USB2.0 Camera (1871:0316)

input: USB2.0 Camera as /devices/platform/s3c2410-ohci/usb1/1-1/1-1:1.0/input/input0

[root@$ /]#ls

beep_app  dev       home      linuxrc   root      tmp

bin       etc       led_app   mnt       sbin      usr

boot      fun       lib       proc      sys       var

【转】 linux内核移植和驱动添加(三)的更多相关文章

  1. 基于tiny4412的Linux内核移植 -- MMA7660驱动移植(九)

    作者信息 作者: 彭东林 邮箱:pengdonglin137@163.com QQ:405728433 平台简介 开发板:tiny4412ADK + S700 + 4GB Flash 要移植的内核版本 ...

  2. 基于tiny4412的Linux内核移植 -- MMA7660驱动移植(九-2)

    作者信息 作者: 彭东林 邮箱:pengdonglin137@163.com QQ:405728433 平台简介 开发板:tiny4412ADK + S700 + 4GB Flash 要移植的内核版本 ...

  3. 基于tiny4412的Linux内核移植 -- eMMC驱动移植(六)

    作者信息 作者: 彭东林 邮箱:pengdonglin137@163.com QQ:405728433 平台简介 开发板:tiny4412ADK + S700 + 4GB Flash 要移植的内核版本 ...

  4. linux内核SPI总线驱动分析(一)(转)

    linux内核SPI总线驱动分析(一)(转) 下面有两个大的模块: 一个是SPI总线驱动的分析            (研究了具体实现的过程) 另一个是SPI总线驱动的编写(不用研究具体的实现过程) ...

  5. linux 内核移植和根文件系统的制作【转载】

    原文地址:http://www.cnblogs.com/hnrainll/archive/2011/06/09/2076214.html 1.1 Linux内核基础知识 在动手进行Linux内核移植之 ...

  6. linux 内核移植和根文件系统的制作

    1.1 Linux内核基础知识 在动手进行Linux内核移植之前,非常有必要对Linux内核进行一定的了解,下面从Linux内核的版本和分类说起. 1.1.1  Linux版本 Linux内核的版本号 ...

  7. LINUX内核设计与实现第三周读书笔记

    LINUX内核设计与实现第三周读书笔记 第一章 LINUX内核简介 1.1 Unix的历史 1969年的夏天,贝尔实验室的程序员们在一台PDR-7型机上实现了Unix这个全新的操作系统. 1973年, ...

  8. Linux内核调用I2C驱动_驱动嵌套驱动方法

    禁止转载!!!! Linux内核调用I2C驱动_以MPU6050为例 0. 导语 最近一段时间都在恶补数据结构和C++,加上导师的事情比较多,Linux内核驱动的学习进程总是被阻碍.不过,十一假期终于 ...

  9. 【转】 linux内核移植和网卡驱动(二)

    原文网址:http://blog.chinaunix.net/uid-29589379-id-4708911.html 一,内核移植步骤: 1, 修改顶层目录下的Makefile ARCH       ...

随机推荐

  1. Sliding Window Maximum 解答

    Question Given an array of n integer with duplicate number, and a moving window(size k), move the wi ...

  2. Micro Python - Python for microcontrollers

    Micro Python - Python for microcontrollers MicroPython

  3. 高仿qq聊天界面

    高仿qq聊天界面,给有需要的人,界面效果如下: 真心觉得做界面非常痛苦,给有需要的朋友. chat.xml <?xml version="1.0" encoding=&quo ...

  4. [Linux] killall 、kill 、pkill 命令详解

    killall 命令 Linux系统中的killall命令用于杀死指定名字的进程(kill processes by name).我们可以使用kill命令杀死指定进程PID的进程,如果要找到我们需要杀 ...

  5. linux下部署svn服务器

    系统Linux debian 2.6.32-5-686 先安装svn工具:apt-get install subversion,耐心等待安装完成.安装完成后svn客户端.服务器都有了. 接者建立svn ...

  6. Bom和Dom编程以及js中prototype的详解

    一.Bom编程: 1.事件练习: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "h ...

  7. iOS开发- 界面传值(1)-通知模式(广播)

    之后的几篇博客, 记录下不同界面间传值的经常使用办法. 这篇文章记录广播的方式. iOS的设计模式中,通知模式也是当中重要的模式之中的一个,Notification直译为通知,事实上本人认为叫做广播模 ...

  8. Java中出现“错误: 编码GBK的不可映射字符”的解决方法

    我的java文件里出现中文,是这样一个文件: import java.io.*; public class Test { public static void main(String[] args) ...

  9. HTML与CSS入门——第二章 发布Web内容

    知识点: 1.使用文本编辑器创建一个基本的HTML文件的方法 2.使用FTP将文件传送到你的Web服务器的方法 3.文件在Web服务器上应该存储的位置 4.在没有Web服务器的情况下分发Web内容的方 ...

  10. jquery在火狐浏览中上传图片并显示

    由于火狐浏览器有很多代码无法兼容,特别是图片的显示,下面我介绍一种是我亲自测试过可以实现的方法 <script> function setImagePreview() { //var ix ...