Chinaunix首页 | 论坛 | 博客
  • 博客访问: 143210
  • 博文数量: 49
  • 博客积分: 2010
  • 博客等级: 大尉
  • 技术积分: 576
  • 用 户 组: 普通用户
  • 注册时间: 2009-09-17 11:27
文章分类

全部博文(49)

文章存档

2011年(1)

2010年(15)

2009年(33)

我的朋友

分类: 嵌入式

2009-10-07 10:30:51

解压了好长时间,解压出来的目录好大阿
30,823 items, totalling 333.5 MB
3万多文件,300多MB。比起kernel-2.6.13大多了。
make uImage之后,371.3 MB


1。
看看readme,gcc,make什么的版本ok不?

lzd@lzd-laptop:~$ udevinfo -V
udevinfo, version 117
lzd@lzd-laptop:~$ make --version
GNU Make 3.81
lzd@lzd-laptop:~$ ld -v
GNU ld (GNU Binutils for Ubuntu) 2.18.0.20080103
lzd@lzd-laptop:~$ depmod -V
module-init-tools 3.3-pre11
lzd@lzd-laptop:~$ showmount --version
showmount for 1.1.2
lzd@lzd-laptop:~$ arm-linux-gcc -v
gcc version 3.4.1
lzd@lzd-laptop:~$ arm-linux-ld -v
GNU ld version 2.15
lzd@lzd-laptop:~$
没有问题,可以放心的使用。


2。
修改Makefile,到顶层Makefile的183行。交叉编译给arm用的内核。

#ARCH        ?= $(SUBARCH)
#CROSS_COMPILE    ?=
ARCH        ?= arm
CROSS_COMPILE    ?= /usr/local/arm/3.4.1/bin/arm-linux-


3。
配置linux内核
Configuration
-------------

  To set the default configuration, use `make smdk2440_defconfig` which
  will configure the common features of this board, or use
  `make s3c2410_config` (写错了,nnd。)to include support for all s3c2410/s3c2440 machines
上面是/document/arm/下的SMDK2440.txt文件的内容。可是

lzd@lzd-laptop:~/linux-2.6.31$ make smdk2440_defconfig
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/basic/docproc
  HOSTCC  scripts/basic/hash
  HOSTCC  scripts/kconfig/conf.o
  HOSTCC  scripts/kconfig/kxgettext.o
  HOSTCC  scripts/kconfig/zconf.tab.o
  HOSTLD  scripts/kconfig/conf
***
*** Can't find default configuration "arch/arm/configs/smdk2440_defconfig"!
***
make[1]: *** [smdk2440_defconfig] Error 1
make: *** [smdk2440_defconfig] Error 2
lzd@lzd-laptop:~/linux-2.6.31$

A generic S3C2410 configuration is provided, and can be used as the
  default by `make s3c2410_defconfig`. This configuration has support
  for all the machines, and the commonly used features on them.

根本就没有所谓的smdk2440_defconfig配置,文件,只能 make s3c2410_defconfig,这样就把 arch/arm/configs/smdk2410_defconfig
拷贝到了当前目录下的.config了。

make s3c2410_defconfig
make menuconfig
make uImage

编译了10多分钟就ok
生成uimage,bootm后,还是乱码
8�{��_s�;7'D�3G���37���7���#�p�C�7�ܸ��_s�;7't�3G�8�t4t[_7�����G4�G�� �
似乎跟以前的情况一样,看了一个关于移植内核的pdf 的资料,原来是晶振不对。

打开
linux-2.6.31/arch/arm/mach-s3c2440/mach-smdk2440.c

static void __init smdk2440_map_io(void)
{
    s3c24xx_init_io(smdk2440_iodesc, ARRAY_SIZE(smdk2440_iodesc));
    s3c24xx_init_clocks(12000000);
修改之后重新编译。
ok果然是这个问题。


4。移植dm9000网卡。
但是smdk2440不能用dm9000网卡。
IP-Config: Device `eth0' not found.                                             
Looking up port of RPC 100003/2 on 10.107.4.145                                 
rpcbind: server 10.107.4.145 not responding, timed out                          
Root-NFS: Unable to get nfsd port number from server, using default             
Looking up port of RPC 100005/1 on 10.107.4.145                                 
rpcbind: server 10.107.4.145 not responding, timed out                          
Root-NFS: Unable to get mountd port number from server, using default

现在只用mini2440试试,mini2440支持了网卡,应该不会有问题吧?

修改head.S同目录下的head-common.S的__lookup_machine_type
为    
b    2f                @ found
重新编译。
出了好多错误,放弃了。

解决网卡问题,在driver/net/下,只有dm9000.c文件,但是kernel-2.6.13下还有个dm9000x.c文件。
把他弄过来,看看ok不?

先把dm9000x.c 和 dm9000x.h文件拷贝过来。在修改makefile
obj-$(CONFIG_DM9000) += dm9000.o 换成
obj-$(CONFIG_DM9000) += dm9000x.o
重新编译
很多错误,原因是netdevice.h这个头文件的net_device结构体发生了翻天覆地的变化。nnd。难道要自己移植网卡???

借鉴mini2440的做法
在match-smdk2440.c中,加入match-mini2440.c的一些东西。
看看ok不?结果好像ok了,但是挂载不成功。

eth0: link up, 100Mbps, full-duplex, lpa 0x45E1                                 
IP-Config: Complete:                                                            
     device=eth0, addr=10.107.4.147, mask=255.255.255.0, gw=10.107.4.145,       
     host=sbc2440, domain=, nis-domain=arm9.net,                                
     bootserver=10.107.4.145, rootserver=10.107.4.145, rootpath=                
Looking up port of RPC 100003/2 on 10.107.4.145                                 
Root-NFS: Unable to get nfsd port number from server, using default             
Looking up port of RPC 100005/1 on 10.107.4.145                                 
rpcbind: server 10.107.4.145 not responding, timed out                          
Root-NFS: Unable to get mountd port number from server, using default           
Root-NFS: Server returned error -5 while mounting /home/lzd/nfs                 
VFS: Unable to mount root fs via NFS, trying floppy.                            
VFS: Cannot open root device "nfs" or unknown-block(2,0)       
网卡的数据流指示灯在闪。
他在工作了,只是很不稳定。

网上找了下,哦,原来是网卡驱动没有成功的初始化。
参考了 木椅子 的文章
http://blog.chinaunix.net/u3/101219/showart_2058344.html
只需要在dm9000.c文件中加上

//add by lzd
#include "dm9000.h"
#include
#include    // important for s3c2410_gpio_cfgpin...
#include
#include
#include
#include
#include
#define DM9000_IRQ    IRQ_EINT7
在probe里加上
//add by lzd
    unsigned int value;
    value = __raw_readl(S3C2410_BWSCON);
    value &= ~(S3C2410_BWSCON_WS4|
    S3C2410_BWSCON_ST4|S3C2410_BWSCON_DW4_32);
    value |= (S3C2410_BWSCON_ST4|S3C2410_BWSCON_DW4_16);
    __raw_writel(value, S3C2410_BWSCON);
//config the bankcon4
    value = 0;
    value = (S3C2410_BANKCON_Tacs4|S3C2410_BANKCON_Tcos4|S3C2410_BANKCON_Tacc14|S3C2410_BANKCON_Tcoh4| \
    S3C2410_BANKCON_Tcah4|S3C2410_BANKCON_Tacp6|S3C2410_BANKCON_PMCnorm);
    __raw_writel(value,S3C2410_BANKCON4);
    //config the irq pin (for mini2440)
    set_irq_type(DM9000_IRQ,IRQ_TYPE_LEVEL_HIGH);
//    s3c2410_gpio_cfgpin(S3C2410_GPF7, S3C2410_GPF7_EINT7);
//    s3c2410_gpio_pullup(S3C2410_GPF7, 0);
就ok了,

VFS: Mounted root (nfs filesystem) on device 0:11.                              
Freeing init memory: 128K                                                       
init started: BusyBox v1.7.0 (2009-09-04 15:50:14 CST)                          
starting pid 775, tty '': '/etc/init.d/rcS'                                     
hwclock: can't open '/dev/misc/rtc': No such file or directory    显然rtc驱动没加上              
eth0: link down                                                                 
eth0: link up, 100Mbps, full-duplex, lpa 0x45E1                                 
qq2440_leds: version magic '2.6.13 preempt ARMv4 gcc-3.4' should be '2.6.31 mod_
unload ARMv4 '                                                                  
insmod: cannot insert '/lib/modules/qq2440_leds.ko': Invalid module format (-1):
 Exec format error                                                              
                                                                                
Please press Enter to activate this console. MPEG Audio Decoder 0.15.2 (beta) -
Copyright (C) 2000-2004 Robert Leslie et al.                                    
audio: /dev/dsp: No such file or directory  声卡驱动没有加上。

不管怎么样,到这里已经能挂载nfs根文件系统了。^_^
阅读(1267) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~