u-boot 移植(一) 准备工作

本文介绍了如何将U-Boot 2012.04.01移植到JZ2440开发板,包括在boards.cfg中添加配置选项,复制并修改board目录下的代码,创建新的配置文件,以及执行编译命令。目前完成的是移植前的准备工作,后续还需修改代码以适配开发板。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

将u-boot 2012.04.01移植到JZ2440开发板 

拿到一个UBOOT,要知道怎样编译和修改可以看一看顶层目录下的README文件,其中有如下内容
Building the Software:
======================
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.

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

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.]
    
从上述英文中我们可以得知,要从源码中编译得到一个u-boot.bin文件,我们可以在顶层目录下执行如下命令
make distclean
make NAME_config
make all
当然make NAME_config中的NAME_config应该是此u-boot支持的类型,至于此u-boot支持哪种配置可以查看boards.cfg文件
这个文件中包含了此u-boot支持的所有的类型。

上面的编译是基于uboot直接支持的开发板,对于不能直接支持的开发板(我的JZ2440),则需要做相应修改
1、首先在顶层的boards.cfg中增加一个配置选项
smdk2410                     arm         arm920t     -                   samsung        s3c24x0
2、创建一个新的目录来存放你的开发板的相关代码,对于我的JZ2440来说就是在board/samsung目录下将smdk2410复制一份,并改名为smdk2440
进入刚刚创建的smdk2440目录,修改里面的文件,将smdk2410.c改名为smdk2440.c,然后进入smdk2440/目录下的Makefile
将COBJS := smdk2410.o flash.o中的smdk2410改为smdk2440。
3、创建一个新的配置文件include/configs/smdk2440.h,可以直接将smdk2410.h复制为smdk2440.h

这样就可以
make smdk2440_config
make all
不过此时的uboot还并不能支持我们的开发板,我们只是做了修改代码前的准备工作,这之后我们就可以在相应文件中修改代码以支持我们自己的开发板

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值