Chinaunix首页 | 论坛 | 博客
  • 博客访问: 559276
  • 博文数量: 105
  • 博客积分: 3274
  • 博客等级: 中校
  • 技术积分: 1161
  • 用 户 组: 普通用户
  • 注册时间: 2010-02-21 12:14
文章分类

全部博文(105)

文章存档

2011年(1)

2010年(104)

分类: LINUX

2010-07-01 21:20:40

接下来就是u-boot了。
先下载一个最新的u-boot程序----u-boot-1.3.4,以及atmel官网上对应的补丁u-boot-1.3.4
-exp.5。
首先解压缩
[zhh@localhost ~]$ sudo tar xjvf ./u-boot-1.3.4.tar.bz2
解压缩成功后,如下
[zhh@localhost ~]$ ls
2.6.27-at91.patch                                               cramfs.img      
linux-2.6.27.cramfs.tar.gz   ramdisk40M.gz      u-boot-1.3.4-exp.5.diff
arm-2007q1                                                      cvs             
linux-2.6.27.ramdisk.tar.gz  ramdisk40M.gz.bak  u-boot-1.3.4.tar.bz2
arm-2007q3-51-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2  cvs-root.tar.gz 
linux-2.6.27.tar.gz          ramdisk40M.gzdf    u-boot.tar.gz
arm-softfloat-linux-gnu                                         Desktop         
linux-2.6.28-omap            rootfs             udev-114
backup                                                          Documents       
my_rootfs                    test               udev-114.tar.gz
busybox-1.14.1                                                  Download        
my_rootfs.tar.gz.ramdisk     u-boot-1.1.5-at91
busybox-1.14.1.tar.tar                                          linux-2.6.27    
ramdisk40M---                u-boot-1.3.4
[zhh@localhost ~]$
多了一个u-boot-1.3.4的文件夹,这里要注意,U-boot-1.3.4-exp.5.diff与u-boot-1.3.4在
同一级目录下。
接下来进入u-boot-1.3.4
[zhh@localhost ~]$ cd ./u-boot-1.3.4
然后打补丁
[zhh@localhost u-boot-1.3.4]$ sudo cat ../u-boot-1.3.4-exp.5.diff | patch -p1
patching file cpu/arm926ejs/at91sam9/usb.c
patch: **** Can't rename file /tmp/po74444y to cpu/arm926ejs/at91sam9/usb.c :
Permission denied
[zhh@localhost u-boot-1.3.4]$
出现了错误,权限不够,换成root用户
[zhh@localhost u-boot-1.3.4]$ su root
Password:
[root@localhost u-boot-1.3.4]#
然后再解压缩
[root@localhost u-boot-1.3.4]# sudo cat ../u-boot-1.3.4-exp.5.diff | patch -p1
patching file cpu/arm926ejs/at91sam9/usb.c
patching file lib_arm/board.c
patching file doc/README.at91
patching file Makefile
patching file include/asm-arm/arch-at91sam9/at91_wdt.h
patching file include/asm-arm/arch-at91sam9/hardware.h
patching file include/asm-arm/arch-at91sam9/at91sam9g45_matrix.h
patching file include/asm-arm/arch-at91sam9/at91sam9g45.h
patching file include/asm-arm/mach-types.h
patching file include/configs/at91sam9g10ek.h
patching file include/configs/at91sam9m10g45ek.h
patching file include/configs/at91sam9rlek.h
patching file include/configs/at91sam9g20ek.h
patching file include/configs/at91sam9263ek.h
patching file include/configs/at91sam9260ek.h
patching file include/configs/at91sam9261ek.h
patching file net/eth.c
patching file board/atmel/at91sam9260ek/at91sam9260ek.c
patching file board/atmel/at91sam9g10ek/at91sam9g10ek.c
patching file board/atmel/at91sam9g10ek/nand.c
patching file board/atmel/at91sam9g10ek/led.c
patching file board/atmel/at91sam9g10ek/partition.c
patching file board/atmel/at91sam9g10ek/config.mk
patching file board/atmel/at91sam9g10ek/Makefile
patching file board/atmel/at91sam9g20ek/nand.c
patching file board/atmel/at91sam9g20ek/at91sam9g20ek.c
patching file board/atmel/at91sam9g20ek/led.c
patching file board/atmel/at91sam9g20ek/partition.c
patching file board/atmel/at91sam9g20ek/config.mk
patching file board/atmel/at91sam9g20ek/Makefile
patching file board/atmel/at91sam9263ek/at91sam9263ek.c
patching file board/atmel/at91sam9m10g45ek/nand.c
patching file board/atmel/at91sam9m10g45ek/led.c
patching file board/atmel/at91sam9m10g45ek/at91sam9m10g45ek.c
patching file board/atmel/at91sam9m10g45ek/partition.c
patching file board/atmel/at91sam9m10g45ek/config.mk
patching file board/atmel/at91sam9m10g45ek/Makefile
patching file common/main.c
patching file drivers/serial/atmel_usart.c
patching file drivers/net/macb.c
patching file drivers/watchdog/at91sam9_wdt.c
patching file drivers/watchdog/Makefile
[root@localhost u-boot-1.3.4]#
用root用户操作可不是好习惯,所以换回去。
第一步当然是看README文件了,简单的了解下该怎么编译成你所想要的文件。
其实主要是2个操作:
1,打开目录下的Makefile文件,把交叉编译器改成本机linux下装的交叉编译器;
2,配置u-boot成你所想要的板子,因为大多数板子都是以官方开发板为基础的,所以即使你
的板子不是标准的官方开发板,你也可以根据手头的板子与官方板子上的异同简单修改下,
就可以使用。
这是原文
For all supported boards there are ready-to-use default
configurations available; just type "make _config".
 
Example: For a TQM823L module type:
 
        cd u-boot
        make TQM823L_config
 
For the Cogent platform, you need to specify the CPU type as well;
e.g. "make cogent_mpc8xx_config". And also configure the cogent
directory according to the instructions in cogent/README.

所以先修改Makefile
找到
ifeq ($(ARCH),arm)
CROSS_COMPILE = arm-linux-
endif
修改成
#CROSS_COMPILE = arm-linux-
CROSS_COMPILE = /home/zhh/arm-softfloat-linux-gnu/bin/arm-softfloat-linux-gnu-
endif
这里为什么要写全目录名呢,因为我用了好几个交叉编译器,所以只能这样了。
继续往下看,因为我使用的是TE-9263,所以找到at91sam9263相关的配置,如下
at91sam9263ek_nandflash_config \
at91sam9263ek_dataflash_config \
at91sam9263ek_dataflash_cs0_config \
at91sam9263ek_config    :       unconfig
        @mkdir -p $(obj)include
        @if [ "$(findstring _nandflash,$@)" ] ; then \
                echo "#define CFG_USE_NANDFLASH 1"      >>$(obj)include/config.h
; \
                $(XECHO) "... with environment variable in NAND FLASH" ; \
        else \
                echo "#define CFG_USE_DATAFLASH 1"      >>$(obj)include/config.h
; \
                $(XECHO) "... with environment variable in SPI DATAFLASH CS0" ; \
        fi;
        @$(MKCONFIG) -a at91sam9263ek arm arm926ejs at91sam9263ek atmel at91sam9
因为要使用dataflash,如下
[root@localhost u-boot-1.3.4]# sudo make at91sam9263ek_dataflash_config
... with environment variable in SPI DATAFLASH CS0
Configuring for at91sam9263ek board...
[root@localhost u-boot-1.3.4]#
然后make
不出意外就会生成u-boot.bin
阅读(5792) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~