移植U-BOOT到S3C2410X并用SKYEYE仿真
本人初学u-boot,一下是我的一点实践:如果你有什么问题,相互交流学习。如果你想了解更多UBOOT可以到我空间看看其他bootloader文档。
原博客地址:
http://student.csdn.net/space.php
一.
源码准备
a)
U-BOOT源代码
u-boot-2009.06-rc3.tar.bz2
官方最新版
b)
Skyeye源代码
skyeye-1.2.4_Rel.tar.gz
c)
交叉编译器
arm-linux-gcc-3.4.1.tar.bz2
二.
建立交叉编译环境
1.
将
arm-linux-gcc-3.4.1.tar.bz2
拷贝到系统的根目录
#tar zxvf
arm-linux-gcc-3.4.1.tar.bz2
源码会自动解压到/usr/local/arm/../bin目录下
2
#ivi /etc/profile
在最后加入
export PATH=$PATH:/usr/local/arm/3.4.1/bin/:.
然后注销系统,重新登陆
#arm-linux-gcc
�C
v查看配置是否成功
三.
编译u-boot,生成U-BOOT.BIN文件
1.
#tar jxvf
u-boot-2009.06-rc3.tar.bz2
2.
#cd
u-boot-2009.06-rc3
3.
建立自己的开发板,我的取名为paul2410
#vi Makefile 为paul2410建立编译相
加入paul2410_config: unconfig
@./mkconfig $(@:_config=) arm arm920t paul2410 NULL s3c24x0
先在board目录中建立paul2410目录并执行以下命令
#cp board/samsung/smdk2410/* board/paul2410
�C
fr
#cd board/paul2410
#mv smdk2410.c teach2410.c
#修改paul2410目录下的Makefile将smdk改为paul
注:我就是没有该这个,在编译的时候出错了,无法建立.depend依赖等相关信息
在include/configs/目录中
#cp smdk2410.h paul2410.h
编译
#make paul2410_config
#make CROSS_COMPILE=arm-linux-
等一小会你就 会开到你成功了
看到有u-boot.bin文件的生成,呵呵,我高兴坏了,就以上工作我就搞了老半天,编译老出错,
补充:我的这个uboot版本编译出现这种问题:在paul2410目录u-boot.lds文件中
. = ALIGN(4);
/*.rodata :{*(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) }*/
这是原本的代码,但是编译说语法错误,后来我找了一个u-boot.1.1.6的u-boot.lds一看,代码如下,我便修改之:
.
rodata : { *(.rodata)}
重新编译成功了。
四.
由于我的开发板上2440,只好用skyeye来模拟了,但效果一样不差。
先在u-boot目录下建立文件skyeye.conf内容如下:
# skyeye config file for S3C2410X
cpu: arm920t
mach: s3c2410x
# physical memory
#mem_bank: map=M, type=RW, addr=0x00000000, size=0x00100000
mem_bank: map=M, type=RW, addr=0x30000000, size=0x04000000
#mem_bank: map=M, type=RW, addr=0xC0000000, size=0x04000000,file=./vmlinux
#mem_bank: map=M, type=RW, addr=0x30000000, size=0x03F80000
#mem_bank: map=M, type=RW, addr=0x33F80000, size=0x00080000,
file=./u-boot.bin,boot=yes
#mem_bank: map=M, type=RW, addr=0xc1000000, size=0x01000000
# all peripherals I/O mapping area
mem_bank: map=I, type=RW, addr=0x48000000, size=0x20000000
mem_bank: map=I, type=RW, addr=0x19000300, size=0x00000020
#net: type=cs8900a, base=0x19000300, size=0x20,int=9, mac=08:00:3E:26:0A:5B, ethmod=tuntap, hostip=10.0.0.1
#nandflash: type=s3c2410x,name=K9F1208U0B,dump=./nand.dump
#lcd: type=s3c2410x, mod=gtk
dbct:state=on
安装skyeye:
#tar zxvf
skyeye-1.2.4_Rel.tar.gz
#cd skyeye-1.2.4
#make
make NO_DBCT=1
注:如果你是新手,请看readme,那里写得很详细
编译完成,你将会看到enjoy it 那你已经编译成功了
五.
测试u-boot
# /skyeye-1.2.4/binary/skyeye
�C
e ./u-boot
一下是我机子上的:
[root@localhost u-boot-2009.06-rc3]# /skyeye-1.2.4/binary/skyeye -e ./u-boot.bin
check format of ./u-boot.bin error: File format not recognized
big_endian is false.
arch: arm
cpu info: armv4, arm920t, 41009200, ff00fff0, 2
mach info: name s3c2410x, mach_init addr 0x805cbf4
dbct info: Note: DBCT not compiled in. This option will be ignored
uart_mod:0, desc_in:, desc_out:, converter:
SKYEYE: use arm920t mmu ops
check format of ./u-boot.bin error: File format not recognized
load "./u-boot.bin" error
[root@localhost u-boot-2009.06-rc3]# /skyeye-1.2.4/binary/skyeye -e ./u-boot
big_endian is false.
arch: arm
cpu info: armv4, arm920t, 41009200, ff00fff0, 2
mach info: name s3c2410x, mach_init addr 0x805cbf4
dbct info: Note: DBCT not compiled in. This option will be ignored
uart_mod:0, desc_in:, desc_out:, converter:
SKYEYE: use arm920t mmu ops
exec file "./u-boot"'s format is elf32-little.
load section .text: addr = 0x33f80000 size = 0x000131b4.
load section .glue_7: addr = 0x33f931b4 size = 0x00000000.
load section .glue_7t: addr = 0x33f931b4 size = 0x00000000.
load section .rodata: addr = 0x33f931b4 size = 0x00000720.
load section .rodata.str1.4: addr = 0x33f938d4 size = 0x0000417b.
load section .data: addr = 0x33f97a50 size = 0x00000c2c.
load section .u_boot_cmd: addr = 0x33f9867c size = 0x00000468.
not load section .bss: addr = 0x33f98ae4 size = 0x000048ac .
not load section .debug_line: addr = 0x00000000 size = 0x000063e3 .
not load section .debug_info: addr = 0x00000000 size = 0x000159cf .
not load section .debug_abbrev: addr = 0x00000000 size = 0x00005b37 .
not load section .debug_aranges: addr = 0x00000000 size = 0x00000800 .
not load section .debug_frame: addr = 0x00000000 size = 0x00002c90 .
not load section .debug_pubnames: addr = 0x00000000 size = 0x00002209 .
not load section .debug_str: addr = 0x00000000 size = 0x000040ef .
not load section .comment: addr = 0x00000000 size = 0x00000426 .
not load section .debug_ranges: addr = 0x00000000 size = 0x00000608 .
call ARMul_InitSymTable,kernel filename is ./u-boot.
start addr is set to 0x33f80000 by exec file.
ERROR: s3c2410x_io_write_word(0x4c000000) = 0x00ffffff
ERROR: s3c2410x_io_write_word(0x4c000008) = 0x00048032
U-Boot 2009.06-rc3 ( 7月 09 2009 - 22:13:35)
DRAM: 64 MB
Flash: 512 kB
*** Warning - bad CRC, using default environment
In: serial
Out: serial
Err: serial
ERROR: s3c2410x_io_write_word(0x1900030a) = 0x0000000
0
SMDK2410 #
到这你已经成功了
SMDK2410 # ls
Unknown command 'ls' - try 'help'
SMDK2410 # help
? - alias for 'help'
autoscr - DEPRECATED - use "source" command instead
base - print or set address offset
bdinfo - print Board Info structure
boot - boot default, i.e., run 'bootcmd'
bootd - boot default, i.e., run 'bootcmd'
bootelf - Boot from an ELF image in memory
bootm - boot application image from memory
bootp - boot image via network using BOOTP/TFTP protocol
bootvx - Boot vxWorks from an ELF image
cmp - memory compare
coninfo - print console devices and information
cp - memory copy
crc32 - checksum calculation
date - get/set/reset date & time
dcache - enable or disable data cache
echo - echo args to console
erase - erase FLASH memory
flinfo - print FLASH memory information
go - start application at address 'addr'
help - print online help
icache - enable or disable instruction cache
iminfo - print header information for application image
imls - list all images found in flash
imxtract- extract a part of a multi-image
itest - return true/false on integer compare
loadb - load binary file over serial line (kermit mode)
loads - load S-Record file over serial line
loady - load binary file over serial line (ymodem mode)
loop - infinite loop on address range
md - memory display
mm - memory modify (auto-incrementing)
mtest - simple RAM test
mw - memory write (fill)
nfs - boot image via network using NFS protocol
nm - memory modify (constant address)
printenv- print environment variables
protect - enable or disable FLASH write protection
rarpboot- boot image via network using RARP/TFTP protocol
reset - Perform RESET of the CPU
run - run commands in an environment variable
saveenv - save environment variables to persistent storage
setenv - set environment variables
sleep - delay execution for some time
source - run script from memory
tftpboot- boot image via network using TFTP protocol
version - print monitor version
SMDK2410 # ls
Unknown command 'ls' - try 'help'
SMDK2410 # help
? - alias for 'help'
autoscr - DEPRECATED - use "source" command instead
base - print or set address offset
bdinfo - print Board Info structure
boot - boot default, i.e., run 'bootcmd'
bootd - boot default, i.e., run 'bootcmd'
bootelf - Boot from an ELF image in memory
bootm - boot application image from memory
bootp - boot image via network using BOOTP/TFTP protocol
bootvx - Boot vxWorks from an ELF image
cmp - memory compare
coninfo - print console devices and information
cp - memory copy
crc32 - checksum calculation
date - get/set/reset date & time
dcache - enable or disable data cache
echo - echo args to console
erase - erase FLASH memory
flinfo - print FLASH memory information
go - start application at address 'addr'
help - print online help
icache - enable or disable instruction cache
iminfo - print header information for application image
imls - list all images found in flash
imxtract- extract a part of a multi-image
itest - return true/false on integer compare
loadb - load binary file over serial line (kermit mode)
loads - load S-Record file over serial line
loady - load binary file over serial line (ymodem mode)
loop - infinite loop on address range
md - memory display
mm - memory modify (auto-incrementing)
mtest - simple RAM test
mw - memory write (fill)
nfs - boot image via network using NFS protocol
nm - memory modify (constant address)
printenv- print environment variables
protect - enable or disable FLASH write protection
rarpboot- boot image via network using RARP/TFTP protocol
reset - Perform RESET of the CPU
run - run commands in an environment variable
saveenv - save environment variables to persistent storage
setenv - set environment variables
sleep - delay execution for some time
source - run script from memory
tftpboot- boot image via network using TFTP protocol
version - print monitor version
SMDK2410 # date
ERROR: s3c2410x_io_write_word(0x57000040) = 0xffffffff
ERROR: s3c2410x_io_write_word(0x57000040) = 0xfffffffe
Date: 2065-25-45 (unknown day) Time: 45:85:85
SMDK2410 #
注:skyeye是开源软件,现在可以模拟很多种ARM,同时可以调试linux等操作系统,这对于没有开发板的嵌入式学习者是个很好的选择。