s3c2410 2.6.22.1内核移植

2.6.22.1内核移植文档。

移植成功,作个记号。嘎嘎。



下载2.6.22.1的内核,解压缩,没啥特别的,下载yaffs2源文件,解压缩,进入yaffs2文件夹,
执行"patch-ker.sh l kernelsource",给内核添加yaffs2支持。

进入kernelsource,编辑Makefile
ARCH ?=arm
CROSS_COMPILE ?=/opt/crosstool/gcc-3.4.5-glibc-2.3.6/arm-davinci-linux/bin/arm-davinci-linux-
这两个一个是指定编译平台,一个是指定交叉编译路径

修改kernelsouce/arch/arm/plat-s3c24xx/common-smdk.c中大概109行,
/* NAND parititon from 2.4.18-swl5 */

static struct mtd_partition smdk_default_nand_part[] = {
   
         
        [0] = {
        .name    = "Boot crazyer",
        .offset    = 0,
        .size    = SZ_512K,
    },
    [1] = {
        .name    = "param",
                .offset = SZ_512K,
                .size    = SZ_2M-SZ_512K,
    },
    [2] = {
        .name    = "kernel",
        .offset = SZ_2M,
        .size    = SZ_1M*3,
    },
    [3] = {
        .name    = "rootfs",
                .offset = SZ_1M*5,
                .size    = SZ_1M*30,
    },
        [4] = {
                .name   = "user",
                .offset = SZ_1M*35,
                .size   = SZ_1M*28,
        }
};

这个是用来指定nandflash分区信息的,如果你用的vivi做bootloader,这个地方指定的分区信息要和vivi中的一样哈,如果用uboot,就暂时不用关心,因为这个信息是内核引导的时候用的,主要是文件系统的位置。


然后make menuconfig
load个默认配置,arch/arm/configs/s3c2410_defconfig,在这个基础上选择自己需要的,记住选择串口支持中的s3c24xx串口支持,不然会在解压内核完成后,就是显示一排......................doen,booting kernel.后就没显示了.
内核配置很容易过的,如果需要NFS文件系统支持,就选上。




接下来,比较麻烦的就是网络cs8900驱动的移植了,参考网上的。
(1) #cp cs8900.c ./drivers/net/arm/
     #cp cs8900.h ./drivers/net/arm/
  
   并在cs8900_probe()函数中,memset (&priv,0,sizeof (cs8900_t));函数之后添加如下
两条语句:

__raw_writel(0x2211d110,S3C2410_BWSCON);
__raw_writel(0x1f7c,S3C2410_BANKCON3);
   至于这两个文件,估计也是从2.4中过来的,我做了一些修改,主要是cs8900.c中添加:
#include <linux/fs.h>

#ifdef CONFIG_ARCH_SMDK2410
#include <asm-arm/arch-s3c2410/regs-mem.h> //新加
#include <asm-arm/arch-s3c2410/regs-cs8900.h> //新加
//#include "asm/arch/smdk2410.h" 原来的,注释掉
#endif
下面这个文件结构体原来是2.4的写法,如:owner: THIS_MODULE,在2.6.22中是不支持这样的写法的,我改成了2.6推荐的。如下:
static struct file_operations cs8900_eeprom_fops = {
        .owner          =THIS_MODULE,
        .open           =cs8900_eeprom_fopen,
        .release        =cs8900_eeprom_frelease,
        .llseek         =cs8900_eeprom_fllseek,
        .read           =cs8900_eeprom_fread,
        .write           =cs8900_eeprom_fwrite,
};     

其实后面都可以看出,s3c2410中的cs8900是没有eeprom的,呵呵,这些关于eeprom的都可以干掉的。
eth0: CS8900A rev E at 0xe0000300 irq=53, no eeprom , addr: 08: 0:3E:26:0A:5B,看到了吧,no eeprom.

(2)修改drivers/net/arm/目录下的Kconfig文件,在最后添加如下内容:
Config ARM_CS8900
   tristate "CS8900 support"
   depends on NET_ETHERNET && ARM && ARCH_SMDK2410
help
   Support for CS8900A chipset based Ethernet cards. If you have a network
   (Ethernet) card of this type, say Y and read the Ethernet-HOWTO, available
   from as well as .
   To compile this driver as a module, choose M here and read
. The module will be
   called cs8900.o.
(3)修改drivers/net/arm/目录下的Makefile文件,在最后添加如下内容:

      obj-$(CONFIG_ARM_CS8900)    += cs8900.o


(4)在/arch/arm/mach-s3c2410/mach-smdk2410.c文件中,
添加头文件
#include "asm-arm/arch-s3c2410/regs-cs8900.h",这个地方一定要注意引号和尖括号的区别哈,用了尖括号你就可以over了,会报告找不到这个头文件的,至于这个头文件呢,是我们自己创建的,我放在了kernelsource中include/asm-arm/arch-s3c2410/下,你也可以放在别的地方,只要include进来就可以了。这个文件中的内容呢,见下面:
#ifndef _INCLUDE_SMDK2410_H_
#define _INCLUDE_SMDK2410_H_
//#include <linux/config.h>这句提示下哈,网上的是有这句的,估计是从2.4内核中直接cp出来的,但是在2.6的内核中,不需要这句的,有了这句你就挂吧你,干掉就行了。
#define pSMDK2410_ETH_IO __phys_to_pfn(0x19000000)//这句就是用来虚拟地址和物理地址转换的。这个0x19000000就是cs8900的物理地址,在s3c2410中,cs8900是挂在nGCS3上面的,看datasheet,地址是0x18000000,但是驱动中用的是实际是0x19000000,都不知道是哪个牛人发现的,好像是最开始韩国的那份移植文档。
#define vSMDK2410_ETH_IO 0xE0000000
#define SMDK2410_ETH_IRQ   IRQ_EINT9
#endif


接着找到smdk2410_iodesc[]结构
数组,添加如下如下内容:

{vSMDK2410_ETH_IO, 0x19000000, SZ_1M, MT_DEVICE}
强烈注释:网上的这句是有问题的,会挂掉哈,应该是
{vSMDK2410_ETH_IO,pSMDK2410_ETH_IO, SZ_1M, MT_DEVICE}
顺便强烈BS下那些直接cp过来就是说成功的人。

修改之后变成了:

static struct map_desc smdk2410_iodesc[] __initdata = {
       /* nothing here yet */
        /* Map the ethernet controller CS8900A */      
        {vSMDK2410_ETH_IO, pSMDK2410_ETH_IO, SZ_1M, MT_DEVICE}
};



好了,重新配置内核,选上这个cs8900就行了。
U-Boot 1.1.4 (Jan 26 2008 - 17:41:52)

U-Boot code: 33F80000 -> 33F9DCAC  BSS: -> 33FA2344
RAM Configuration:
Bank #0: 30000000 64 MB
Nor Flash:  1 MB
Nand Flash:    64 MB

In:    serial
Out:   serial
Err:   serial
Hit any key to stop autoboot:  0
crazyer2410=> tftpboot
TFTP from server 192.168.61.111; our IP address is 192.168.61.200
Filename 'zImage'.
Load address: 0x30008000
Loading: #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         ###########################################
done
Bytes transferred = 2215384 (21cdd8 hex)
crazyer2410=> go 30008000
## Starting application at 0x30008000 ...
Uncompressing Linux..........................................................................
Linux version 2.6.22.1 (root@crazyer) (gcc version 3.4.5) #2 Fri Feb 8 19:56:53 CST 2008
CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=00007177
Machine: SMDK2410
ATAG_INITRD is deprecated; please update your bootloader.
Memory policy: ECC disabled, Data cache writeback
CPU S3C2410A (id 0x32410002)
S3C2410: core 202.800 MHz, memory 101.400 MHz, peripheral 50.700 MHz
S3C24XX Clocks, (c) 2004 Simtec Electronics
CLOCK: Slow mode (1.500 MHz), fast, MPLL on, UPLL on
CPU0: D VIVT write-back cache
CPU0: I cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets
CPU0: D cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets
Built 1 zonelists.  Total pages: 16256
Kernel command line: console=ttySAC0 root=/dev/nfs nfsroot=192.168.61.111:/back/2410/rootfs f
irq: clearing subpending status 00000002
PID hash table entries: 256 (order: 8, 1024 bytes)
timer tcon=00500000, tcnt a509, tcfg 00000200,00000000, usec 00001e4c
Console: colour dummy device 80x30
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: 60160KB available (4156K code, 414K data, 136K init)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
NET: Registered protocol family 16
S3C2410 Power Management, (c) 2004 Simtec Electronics
S3C2410: Initialising architecture
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
Sangoma WANPIPE Router v1.1 (c) 1995-2000 Sangoma Technologies Inc.
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
NetWinder Floating Point Emulator V0.97 (extended precision)
audit: initializing netlink socket (disabled)
audit(0.380:1): initialized
Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
NTFS driver 2.1.28 [Flags: R/O].
JFFS2 version 2.2. (NAND) (SUMMARY)  �© 2001-2006 Red Hat, Inc.
fuse init (API version 7.8)
JFS: nTxBlock = 470, nTxLock = 3764
yaffs Feb  8 2008 19:03:32 Installing.
io scheduler noop registered
io scheduler anticipatory registered (default)
io scheduler deadline registered
io scheduler cfq registered
s3c2410-lcd s3c2410-lcd: no platform data for lcd, cannot attach
s3c2410-lcd: probe of s3c2410-lcd failed with error -22
lp: driver loaded but no devices found
ppdev: user-space parallel port driver
Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing enabled
s3c2410-uart.0: s3c2410_serial0 at MMIO 0x50000000 (irq = 70) is a S3C2410
s3c2410-uart.1: s3c2410_serial1 at MMIO 0x50004000 (irq = 73) is a S3C2410
s3c2410-uart.2: s3c2410_serial2 at MMIO 0x50008000 (irq = 76) is a S3C2410
RAMDISK driver initialized: 16 RAM disks of 8192K size 1024 blocksize
loop: module loaded
nbd: registered device at major 43
PPP generic driver version 2.4.2
PPP Deflate Compression module registered
PPP BSD Compression module registered
PPP MPPE Compression module registered
NET: Registered protocol family 24
Cirrus Logic CS8900A driver for Linux (Modified for SMDK2410)
eth0: CS8900A rev E at 0xe0000300 irq=53, no eeprom , addr: 08: 0:3E:26:0A:5B
netconsole: not configured, aborting
Linux video capture interface: v2.00
em28xx v4l2 driver version 0.0.1 loaded
usbcore: registered new interface driver em28xx
usbcore: registered new interface driver usbvision
USBVision USB Video Device Driver for Linux : 0.9.9
aoe: AoE v32 initialised.
usbmon: debugfs is not available
mice: PS/2 mouse device common for all mice
rtc-test rtc-test.0: rtc core: registered test as rtc0
rtc-test rtc-test.1: rtc core: registered test as rtc1
usbcore: registered new interface driver usbhid
drivers/hid/usbhid/hid-core.c: v2.6:USB HID core driver
GRE over IPv4 tunneling driver
IPVS: Registered protocols ()
IPVS: Connection hash table configured (size=4096, memory=32Kbytes)
IPVS: ipvs loaded.
TCP cubic registered
NET: Registered protocol family 1
rtc-test rtc-test.0: setting the system clock to 1970-01-01 00:00:02 (2)
IP-Config: Complete:
      device=eth0, addr=192.168.61.200, mask=255.255.255.0, gw=192.168.61.254,
     host=luofuchong, domain=, nis-domain=(none),
     bootserver=192.168.61.254, rootserver=192.168.61.111, rootpath=
Looking up port of RPC 100003/2 on 192.168.61.111
Looking up port of RPC 100005/1 on 192.168.61.111
VFS: Mounted root (nfs filesystem).
Freeing init memory: 136K
e Starting System
/etc/init.d/rcS: line 3: /bin/ifconfig: not found
/etc/init.d/rcS: line 4: /binifconfig: not found
mount: cannot read /etc/mtab: No such file or directory
mount: no /etc/mtab
mount: no /etc/mtab
mount: no /etc/mtab

Please press Enter to activate this console.

/ #
/ #
/ #
/ # ls
bin      etc      lib      mnt      root     sys      usr
dev      home     linuxrc  proc     sbin     tmp
/ # ifconfig
eth0      Link encap:Ethernet  HWaddr 08:00:3E:26:0A:5B 
          inet addr:192.168.61.200  Bcast:192.168.61.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1054 errors:9 dropped:9 overruns:0 frame:0
          TX packets:417 errors:0 dropped:0 overruns:0 carrier:0
          collisions:650 txqueuelen:1000
          RX bytes:1396881 (1.3 MiB)  TX bytes:67662 (66.0 KiB)
          Interrupt:53 Base address:0x300

lo        Link encap:Local Loopback 
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

/ #
/ # ping 192.168.61.254
PING 192.168.61.254 (192.168.61.254): 56 data bytes
64 bytes from 192.168.61.254: seq=0 ttl=64 time=3.098 ms
64 bytes from 192.168.61.254: seq=1 ttl=64 time=1.376 ms
64 bytes from 192.168.61.254: seq=2 ttl=64 time=1.406 ms

--- 192.168.61.254 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 1.376/1.960/3.098 ms
/ #

文件系统是nfs的,呵呵,测试方便。
用的是uboot,支持NAND启动。
common-smdk.c  cs8900.h  mach-smdk2410.c  s3c2410_config
cs8900.c    regs-cs8900.h    u-boot.bin
这几个文件我以经打包上传了,可以搜索我的资源文件,有提示的哈,也可以联系我索取,完全免费哈,QQ:45877415,EMAIL:zhangmi7079@163.com

 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值