u-boot-2012.10 官方文档翻译--构建软件

构建软件


构建U-BOOT已经在许多本地构建环境和一些交叉构建环境下测试过。当然,我们不保证所有现存的版本支持所有的交叉开发工具。在工具链选择的问题上,我们推荐ELDK(可以看 http://www.denx.de/wiki/DULG/ELDK),它被广泛用于构建和测试U-BOOT。

如果你不使用本地环境,假设在你的路径下有GUN交叉编译工具。这种情况下,你必须在shell中设置环境变量CROSS_COMPILE。注意,要保证没有改变Makefile或者其它源文件。一个用于4xx CPU上ELDK的使用示例,输入:

$ CROSS_COMPILE=ppc_4xx-
$ export CROSS_COMPILE


注意:如果你想要生成Windows版的工具,你可以在工具目录下使用MinGW工具链。(http://www.mingw.org).  设置你的主机工具为MinGW工具链,并且执行'make tools'.例如:

$ make HOSTCC=i586-mingw32msvc-gcc HOSTSTRIP=i586-mingw32msvc-strip tools

二进制文件工具/mkimage.exe 将被创建,可以在运行Windows的电脑上执行。

U-Boot趋向简单的构建,在安装源码后,你必须指定一个板型配置U-Boot。要作这个,可以输入:

make NAME_config


"NAME_config"是一个现在有的配置组合,可以查看 boards.cfg 了解支持的名字。

注意:一些电路板的配置名可能已经存在,从电路板供应商那儿核对可用的附加信息,例如,要使 TQM823L 系统支持或不支持LCD,

你可以在选择配置的时候选择这种“功能”。

make TQM823L_config

将配置一个一般的 TQM823L,不支持LCD。


make TQM823L_LCD_config

将配置一个支持LCD的U-BOOT控制台的 TQM823L。

最后,输入"make all",你能得到一些U-BOOT 镜像文件,可以将这些文件下载/安装到你的系统上。

- "u-boot.bin"  是一个二进制镜像文件。
- "u-boot"  是一个ELF格式的二进制文件。
- "u-boot.srec"  是Motorola S-Record格式文件。


默认情况下,构建是在本地执行,并且项目文件是存放在源目录内。有两种方法可以改变这种行为,

让U-BOOT在一些外部目录构建:

1.增加 O= make命令行调用:

make O=/tmp/build distclean
make O=/tmp/build NAME_config
make O=/tmp/build all

2.设置环境变量 BUILD_DIR 指向理想的位置:

export BUILD_DIR=/tmp/build
make distclean
make NAME_config
make all

注意:命令行"O="的设置,会覆盖环境变量 BUILD_DIR 的值。


请注意,以上是假设你使用GUN make。比如你使用NetBSD的话,你需要用"gmake"代替这里的"make"。

如果你的系统板没有被列出来,你需要移植U-BOOT到你的硬件平台上。可以按照下面的步骤进行:


1.为你的板在根目录下增加一个新的配置文件"boards.cfg"file,使用已经存在的项目作为例子。

下面的指令应该在同一个板型上按顺序执行。

2.根据你的板子创建一个新的代码目录。添加你需要的文件。在你的板目录下,

至少需要"Makefile"、"<board>.c"、"flash.c"和"u-boot.lds"。

3.为你的板子创建一个新的配置文件"include/configs/<board>.h"。

4.如果你移植U-BOOT到一个新的CPU,还要根据你的CPU创建一个新的代码目录。然后添加你需要的文件。

5.使用你的新名字运行"make <board>_config"。

6.键入"make",你会获得一个用于安装在目标系统的"u-boot.srec"文件。

7.调试和解决可能出现的任何问题.

[当然,最后一步比听起来困难的多。]


Building the Software:
======================


Building U-Boot has been tested in several native build environments
and in many different cross environments. Of course we cannot support
all possibly existing versions of cross development tools in all
(potentially obsolete) versions. In case of tool chain problems we
recommend to use the ELDK (see http://www.denx.de/wiki/DULG/ELDK)
which is extensively used to build and test U-Boot.


If you are not using a native environment, it is assumed that you
have GNU cross compiling tools available in your path. In this case,
you must set the environment variable CROSS_COMPILE in your shell.
Note that no changes to the Makefile or any other source files are
necessary. For example using the ELDK on a 4xx CPU, please enter:


$ CROSS_COMPILE=ppc_4xx-
$ export CROSS_COMPILE


Note: If you wish to generate Windows versions of the utilities in
      the tools directory you can use the MinGW toolchain
      (http://www.mingw.org).  Set your HOST tools to the MinGW
      toolchain and execute 'make tools'.  For example:


       $ make HOSTCC=i586-mingw32msvc-gcc HOSTSTRIP=i586-mingw32msvc-strip tools


      Binaries such as tools/mkimage.exe will be created which can
      be executed on computers running Windows.


U-Boot is intended to be simple to build. After installing the
sources you must configure U-Boot for one specific board type. This
is done by typing:


make NAME_config


where "NAME_config" is the name of one of the existing configu-
rations; see boards.cfg for supported names.


Note: for some board special configuration names may exist; check if
      additional information is available from the board vendor; for
      instance, the TQM823L systems are available without (standard)
      or with LCD support. You can select such additional "features"
      when choosing the configuration, i. e.


      make TQM823L_config
- will configure for a plain TQM823L, i. e. no LCD support


      make TQM823L_LCD_config
- will configure for a TQM823L with U-Boot console on LCD


      etc.




Finally, type "make all", and you should get some working U-Boot
images ready for download to / installation on your system:


- "u-boot.bin" is a raw binary image
- "u-boot" is an image in ELF binary format
- "u-boot.srec" is in Motorola S-Record format


By default the build is performed locally and the objects are saved
in the source directory. One of the two methods can be used to change
this behavior and build U-Boot to some external directory:


1. Add O= to the make command line invocations:


make O=/tmp/build distclean
make O=/tmp/build NAME_config
make O=/tmp/build all


2. Set environment variable BUILD_DIR to point to the desired location:


export BUILD_DIR=/tmp/build
make distclean
make NAME_config
make all


Note that the command line "O=" setting overrides the BUILD_DIR environment
variable.




Please be aware that the Makefiles assume you are using GNU make, so
for instance on NetBSD you might need to use "gmake" instead of
native "make".




If the system board that you have is not listed, then you will need
to port U-Boot to your hardware platform. To do this, follow these
steps:


1.  Add a new configuration option for your board to the toplevel
    "boards.cfg" file, using the existing entries as examples.
    Follow the instructions there to keep the boards in order.
2.  Create a new directory to hold your board specific code. Add any
    files you need. In your board directory, you will need at least
    the "Makefile", a "<board>.c", "flash.c" and "u-boot.lds".
3.  Create a new configuration file "include/configs/<board>.h" for
    your board
3.  If you're porting U-Boot to a new CPU, then also create a new
    directory to hold your CPU specific code. Add any files you need.
4.  Run "make <board>_config" with your new name.
5.  Type "make", and you should get a working "u-boot.srec" file
    to be installed on your target system.
6.  Debug and solve any problems that might arise.
    [Of course, this last step is much harder than it sounds.]

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值