分享

u-boo-1.3+linux 2.6.24+NFS移植(FS2410)

 定慧图书馆 2012-01-25
 (2009-06-06 01:40)
分类: s3c2410移植

其实移植的参考例子已经很多了,只是在实际的移植过程中会出现很多意想不到的问题,在这里记下来,以方便参考。

平台:FS2410+NANDFLASH(K9F1208U0M)+64M SDRAM +CS8900
交叉编译arm-linux-gcc 4.3.1

由于是s3c2410的板子所以u-boot的移植不需要修改很大
1 u-boot的移植参考tekkaman大虾,过程很详细在这里就不在复述了(tekkman.cublog.cn)
有几点注意
1)
依照开发板的内存区的配置情况, 修改
修改board/wpneu/fs2410/lowlevel_init.S文件,这里我参考了FS2410开发板自带S3C2410_BIOS,代码如下:
#define BWSCON    0x48000000

/* BANK0CON */
#define B0_Tacs             0x3    /*  0clk */
#define B0_Tcos             0x3    /*  0clk */
#define B0_Tacc             0x7    /* 14clk */
#define B0_Tcoh             0x3    /*  0clk */
#define B0_Tah              0x3    /*  0clk */
#define B0_Tacp             0x1
#define B0_PMC              0x0    /* normal */

/* BANK1CON */
#define B1_Tacs             0x3    /*  0clk */
#define B1_Tcos             0x3    /*  0clk */
#define B1_Tacc             0x7    /* 14clk */
#define B1_Tcoh             0x3    /*  0clk */
#define B1_Tah              0x3    /*  0clk */
#define B1_Tacp             0x3
#define B1_PMC              0x0

#define B2_Tacs             0x0
#define B2_Tcos             0x0
#define B2_Tacc             0x7
#define B2_Tcoh             0x0
#define B2_Tah              0x0
#define B2_Tacp             0x0
#define B2_PMC              0x0

#define B3_Tacs             0x0    /*  0clk */
#define B3_Tcos             0x3    /*  4clk */
#define B3_Tacc             0x7    /* 14clk */
#define B3_Tcoh             0x1    /*  1clk */
#define B3_Tah              0x0    /*  0clk */
#define B3_Tacp             0x3     /*  6clk */
#define B3_PMC              0x0    /* normal */

#define B4_Tacs             0x1    /*  0clk */
#define B4_Tcos             0x1    /*  0clk */
#define B4_Tacc             0x6    /* 14clk */
#define B4_Tcoh             0x1    /*  0clk */
#define B4_Tah              0x1    /*  0clk */
#define B4_Tacp             0x0
#define B4_PMC              0x0    /* normal */

#define B5_Tacs             0x1    /*  0clk */
#define B5_Tcos             0x1    /*  0clk */
#define B5_Tacc             0x6    /* 14clk */
#define B5_Tcoh             0x1    /*  0clk */
#define B5_Tah              0x1    /*  0clk */
#define B5_Tacp             0x0
#define B5_PMC              0x0    /* normal */

2)
由于fs2410的网卡是cs8900,所以需要修改U-boot以支持CS8900网卡,而u-boot本身就对CS8900有很好的支持。
#define CONFIG_DRIVER_CS8900    1    /* we have a CS8900 on-board */
#define CS8900_BASE        0x19000300
#define CS8900_BUS16        1 /* the Linux driver does accesses as shorts */

编译应该就OK。

3)
编译u-boot遇到的问题:
(1)
lib_arm/libarm.a(_udivsi3.o)(.text+0x8c):/u-boot-1.3/lib_arm/_udivsi3.S:67: relocation truncated to fit: R_ARM_PLT32 __div0
lib_arm/libarm.a(_umodsi3.o)(.text+0xa:/u-boot-1.3/lib_arm/_umodsi3.S:79: relocation truncated to fit: R_ARM_PLT32 __div0
应该是交叉编译器的库问题

有两个方法
1、继续用3.4.1,如下修改lib_arm/_umodsi3.S、lib_arm/_udivsi3.S即可编译通过:
bl __div0 (PLT) ===> bl __div0
2、改用2.95.3,不过要留意其目录问题,/usr/local/arm/2.95.3


(2)如下问题:
Starting kernel ...

Uncompressing Linux..................................................................................................... done, booting the kernel.

刚开始我编译内核的时候在kernel配置文件中设置了CONFIG_CMDLINE,而在u-boot中也打开了宏CONFIG_BOOTARGS,出现上述情况。这是因为u-boot中的CONFIG_BOOTARGS宏定义(include/configs/smdk2410.h)与kernel的配置文件中的CONFIG_CMDLINE(.config)宏定义不匹配。
统一的解决方法: 在u-boot中不设置CONFIG_BOOTARGS,在kernel中也不设置CONFIG_CMDLINE。将他们的设置统一放在u-boot启动后,设置bootargs.
FS2410 # setenv bootargs root=/dev/nfs rw nfsroot=10.0.0.1:/home/wangping/embeded/rootfs ip=10.0.0.2:10.0.0.1:10.0.0.1:255.0.0.0:wpneu:eth0:off console=ttySAC0,115200 init=/linuxrc noinitrd

注意还有串口console=ttySAC0一定要写正确了:。
刚开始写为ttyS0,出现ERROR: s3c2410x_io_write_word(0x54000000) = 0x000000e0
(3)使用mkimage 制作uImage映像以便使用bootm命令(关于uImage的详细使用可以参见luofuchong大虾的文章http://www./luofuchong/archive/2007/01/12/21834.html)

mkimage在制作映象文件的时候,是在原来的可执行映象文件的前面加上一个0x40字节的头,记录参数所指定的信息,这样uboot才能识别这个映象是针对哪个CPU体系结构的,哪个OS的,哪种类型,加载内存中的哪个位置, 入口点在内存的那个位置以及映象名是什么
在u-boot/toos/下会生成一个mkimage工具。
然后利用如下命令生成uImage映像
mkimage -n 'linux-2.6.24' -A arm -O linux -T kernel -C none -a 0x30008000 -e 0x30008000 -d zImage uImage

FS2410 # bootm 0x30000000
## Booting image at 30000000 ...
   Image Name:   Linux-2.6.24
   Created:      2009-05-31  19:30:43 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    1543080 Bytes =  1.5 MB
   Load Address: 30008000
   Entry Point:  30008000
   Verifying Checksum ... OK
OK

Starting kernel ...
......


2 linux 2.6.24的移植
交叉编译工具arm-none-linux-gnueabi-gcc-4.3.3
1)支持cs8900
具体可以参考如下:
http://blog./u2/63560/showart_514147.html

2)使用arm-linux-gcc 3.4.1编译出错改用arm-none-linux-gnueabi-gcc-4.3.3
编译出现如下错误
kernel/built-in.o: In function `timespec_add_ns':
/home/wangping/embeded/linux-2.6.24/include/linux/time.h:174: undefined reference to `__udivdi3'
/home/wangping/embeded/linux-2.6.24/include/linux/time.h:179: undefined reference to `__umoddi3'
/home/wangping/embeded/linux-2.6.24/include/linux/time.h:174: undefined reference to `__udivdi3'
/home/wangping/embeded/linux-2.6.24/include/linux/time.h:179: undefined reference to `__umoddi3'
make: *** [.tmp_vmlinux1] Error 1
gcc4.3在编译内核时会用到libgcc未定义的函数,修改方法
在顶层Makefile中的CFLAGS中添加-fno-tree-scev-cprop 即可

3)make uImage不能够生成uImage
  LD      arch/arm/boot/compressed/vmlinux
  OBJCOPY arch/arm/boot/zImage
  Kernel: arch/arm/boot/zImage is ready
  UIMAGE  arch/arm/boot/uImage
"mkimage" command not found - U-Boot images will not be built
  Image arch/arm/boot/uImage is ready
解决办法:将mkimage拷贝到交叉编译器的安装目录下即可( /usr/local/arm/arm-2009q1/bin/ )

3 根文件系统制作
基于busybox-1.14.1(参考http://blog./u1/58780/showart_1080300.html)
1、在本机修改/etc/export文件,重启NFS服务:
[root@wangping embeded]# vi /etc/exports
/home/wangping/embeded/rootfs 10.0.0.*(rw,sync,no_root_squash)
[root@Sure rootfs]# service nfs restart

2、在Bootloader中传递以下参数给Kernel:
root=/dev/nfs rw nfsroot=10.0.0.1:/home/wangping/embeded/rootfs ip=10.0.0.2:10.0.0.1:10.0.0.1:255.0.0.0:wpneu:eth0:off console=ttySAC0,115200 init=/linuxrc noinitrd

这一步基本没有太大问题。

然后利用fs2410自带的bootloader将u-boot烧到flash中reset板子,利用tftp测试u-boot上CS8900移植是否好使

U-Boot 1.3.0 (May 30 2009 - 22:41:08)

DRAM:  64 MB
Flash: 512 kB
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Hit any key to stop autoboot:  0
FS2410 # tftp 0x30000000 uImage
TFTP from server 10.0.0.1; our IP address is 10.0.0.110
Filename 'uImage'.
Load address: 0x30000000
Loading: checksum bad
checksum bad
#################################################################
         #################################################################
         #################################################################
         #################################################################
         ##########################################
done
Bytes transferred = 1543144 (178be8 hex)
FS2410 # bootm 0x30000000        
## Booting image at 30000000 ...
   Image Name:   Linux-2.6.24
   Created:      2009-05-31  19:30:43 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    1543080 Bytes =  1.5 MB
   Load Address: 30008000
   Entry Point:  30008000
   Verifying Checksum ... OK
OK

Starting kernel ...

Uncompressing Linux..................................................................................................... done, booting the kernel.
Linux version 2.6.24 (root@wangping) (gcc version 4.3.3 (Sourcery G++ Lite 2009q1-203) ) #6 Mon Jun 1 03:29:44 CST 2009
CPU: ARM920T [41009200] revision 0 (ARMvundefined/unknown), cr=00003177
Machine: SMDK2410
Memory policy: ECC disabled, Data cache writeback
CPU S3C2410 (id 0x32410000)
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 in Zone order, mobility grouping on.  Total pages: 16256
Kernel command line: root=/dev/nfs rw nfsroot=10.0.0.1:/home/wangping/embeded/rootfs ip=10.0.0.2:10.0.0.1:10.0.0.1:255.0.0.0:wpneu:eth0:off console=ttySAC0,115200 init=/linuxrc noinitrd
irq: clearing pending status 00004000
irq: clearing pending status 00008000
irq: clearing pending status 00800000
irq: clearing pending status 10000000
irq: clearing subpending status 00000093
PID hash table entries: 256 (order: 8, 1024 bytes)
timer tcon=00500000, tcnt a509, tcfg 00000200,00000000, usec 00001e4c
Console: colour dummy device 80x30
console [ttySAC0] enabled
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: 61580KB available (2844K code, 314K data, 128K init)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
net_namespace: 64 bytes
NET: Registered protocol family 16
S3C2410 Power Management, (c) 2004 Simtec Electronics
S3C2410: Initialising architecture
S3C24XX DMA Driver, (c) 2003-2004,2006 Simtec Electronics
DMA channel 0 at c4800000, irq 33
DMA channel 1 at c4800040, irq 34
DMA channel 2 at c4800080, irq 35
DMA channel 3 at c48000c0, irq 36
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
NetWinder Floating Point Emulator V0.97 (double precision)
JFFS2 version 2.2. (NAND) 漏 2001-2006 Red Hat, Inc.
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
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 4096K size 1024 blocksize
loop: module loaded
Cirrus Logic CS8900A driver for Linux (Modified for SMDK2410)
eth0: CS8900A rev D at 0xe0000300 irq=53, addr: 00: 0:3E:26:0A: 0
Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2
ide: Assuming 50MHz system bus speed for PIO modes; override with idebus=xx
BAST NOR-Flash Driver, (c) 2004 Simtec Electronics
S3C24XX NAND Driver, (c) 2004 Simtec Electronics
s3c2410-nand s3c2410-nand: Tacls=3, 29ns Twrph0=7 69ns, Twrph1=3 29ns
ERROR: s3c2410x_io_write_word(0x4e000000) = 0x00008262
ERROR: s3c2410x_io_write_word(0x4e000000) = 0xfffff7ff
ERROR: s3c2410x_io_write_word(0x4e000004) = 0x00000090
ERROR: s3c2410x_io_write_word(0x4e000008) = 0x00000000
No NAND device found!!!
ERROR: s3c2410x_io_write_word(0x4e000000) = 0xffffffff
usbmon: debugfs is not available
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
ERROR: s3c2410x_io_write_word(0x49000010) = 0x40000000
ERROR: s3c2410x_io_write_word(0x49000008) = 0x00000008
s3c2410-ohci s3c2410-ohci: USB HC takeover failed!  (BIOS/SMM bug)
s3c2410-ohci s3c2410-ohci: startup error -16
s3c2410-ohci s3c2410-ohci: USB bus 1 deregistered
s3c2410-ohci: probe of s3c2410-ohci failed with error -16
mice: PS/2 mouse device common for all mice
S3C24XX RTC, (c) 2004,2006 Simtec Electronics
ERROR: s3c2410x_io_write_word(0x54000008) = 0x00000010
s3c2410-i2c s3c2410-i2c: slave address 0x10
s3c2410-i2c s3c2410-i2c: bus frequency set to 99 KHz
ERROR: s3c2410x_io_write_word(0x54000000) = 0x000000e0
s3c2410-i2c s3c2410-i2c: i2c-0: S3C I2C adapter
S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics
s3c2410-wdt s3c2410-wdt: watchdog inactive, reset disabled, irq enabled
TCP cubic registered
NET: Registered protocol family 1
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
IP-Config: Complete:
      device=eth0, addr=10.0.0.2, mask=255.255.255.0, gw=10.0.0.1,
     host=10.0.0.2, domain=, nis-domain=(none),
     bootserver=10.0.0.1, rootserver=10.0.0.1, rootpath=
Looking up port of RPC 100003/2 on 10.0.0.1
Looking up port of RPC 100005/1 on 10.0.0.1
VFS: Mounted root (nfs filesystem).
Freeing init memory: 128K
init started: BusyBox v1.14.1 (2009-06-06 17:44:21 CST)
starting pid 789, tty '': '/etc/init.d/rcS'
Processing etc/init.d/rc.S
  Mount all
  Start mdev....
****************************************************
              RootFS by NFS, s3c2410
         Created by wpneu @ 2009.06.06
                   Enjoy
****************************************************

starting pid 793, tty '': '-/bin/sh'
Processing /etc/profile
  Set search library path
  Set user path
  Set PS1
All

[root@wpneu/]# ls
bin dev home linuxrc proc sbin tmp var
boot etc lib mnt root sys usr


    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多