打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
转 u-boot-2015.01在TQ2440上移植过程分享
http://www.linuxidc.com/Linux/2015-02/112934.htm

[日期:2015-02-05]来源:Linux社区  作者:彭东林 QQ: 405728433

开发板:    tq2440 

工具:      Win7 + VMware + Debian6 

U-boot版本: u-boot-2015.01 

Linux版本:  天嵌自带的 linux-2.6.30.4 

GCC版本:    gcc version 4.3.3 (Sourcery G++ Lite 2009q1-176) 

之前由于移植过u-boot-2014.04到tq2440上,现在移植u-boot-2015.01的时候就不说那么详细了,因为之前已经说的很详细了,现在简略移植一下。 

在移植的时候,基本上是参考移植u-boot-2014.04时写的文档,可以到这里下载:http://www.linuxidc.com/Linux/2015-02/112933.htm 

首先说明一下u-boot-2015.01跟之前版本的差别
从 http://www.linuxidc.com/Linux/2011-07/38897.htm 下载最新的u-boot版本,目前最新的是 u-boot-2015.01.tar.bz2 

下面是解压后得到的文件: 

 

可以看到目录内容跟u-boot-2014.04不同了,下面是u-boot-2014.04的顶层目录内容:

 

 

其中最不同的就是我们所熟悉的在u-boot-2014.04中的boards.cfg和mkconfig没有了,而同时又在u-boot-2015.01的顶层目录下多出了一个configs目录,还有一个Kconfig文件(这不是Linux内核所特有的吗?),可以看到u-boot一直在学习Linux内核的配置和编译方法。

 

在configs目录下有很多默认的配置文件:

 

 

在Linux的arch/arm/configs下面也有很多默认的配置文件,Linux内核在配置的时候可以使用 make xxx_defconfig 来配置,

 

看样子,u-boot也可以使用make xxx_defconfig,Linux内核还可以使用make menuconfig来配置,u-boot也可以使用make menuconfig来配置,下面我们用smdk2410为例实验一下:

 

在u-boot-2015.01的configs目录下有一个叫做smd2410_defconfig的配置文件,那么执行 make smd2410_defconfig

 

 

然后我们再执行make menuconfig试试:

 

 

果然如此。

 

我们选择的是smdk2410的配置文件,在这里体现出来:

 

 

然后就可以编译了, 直接执行 make 即可,刚开始会报错:

 

 

原因是我们没有指定交叉编译工具链的名字,修改顶层的Makefile即可:

 

 

然后再执行make就可以编译成功。

 

在以前的u-boot配置是总是有什么ARCH、CPU、BOARD和SOC之类的变量,同时编译完成后会在include下生成一个叫做config.mk的文件,其中对这几个变量赋值了,如:

 

 

但是在u-boot-2015.01编译完成后,在include下面却没有config.mk了,只有autoconf.mk了,那它是怎么做的呢?

 

在u-boot-2015.01中执行完make smdk2410_defconfig后,会在顶层目录中生成一个.config文件,我们大致看一下其中的内容:

 

 

可以看到,在.config中还是有ARCH、CPU、SOC以及BOARD之类的配置项,在顶层目录下的config.mk中会使用.config中的配置:

 

 

在arch/Kconfig中对这几个配置进行了说明:

 

config SYS_ARCH 
    string 
    help 
      This option should contain the architecture name to build the 
      appropriate arch/<CONFIG_SYS_ARCH> directory. 
      All the architectures should specify this option correctly.

 

config SYS_CPU 
    string 
    help 
      This option should contain the CPU name to build the correct 
      arch/<CONFIG_SYS_ARCH>/cpu/<CONFIG_SYS_CPU> directory.

 

      This is optional.  For those targets without the CPU directory, 
      leave this option empty.

 

config SYS_SOC 
    string 
    help 
      This option should contain the SoC name to build the directory 
      arch/<CONFIG_SYS_ARCH>/cpu/<CONFIG_SYS_CPU>/<CONFIG_SYS_SOC>.

 

      This is optional.  For those targets without the SoC directory, 
      leave this option empty.

 

config SYS_VENDOR 
    string 
    help 
      This option should contain the vendor name of the target board. 
      If it is set and 
      board/<CONFIG_SYS_VENDOR>/common/Makefile exists, the vendor common 
      directory is compiled. 
      If CONFIG_SYS_BOARD is also set, the sources under 
      board/<CONFIG_SYS_VENDOR>/<CONFIG_SYS_BOARD> directory are compiled.

 

      This is optional.  For those targets without the vendor directory, 
      leave this option empty.

 

config SYS_BOARD 
    string 
    help 
      This option should contain the name of the target board. 
      If it is set, either board/<CONFIG_SYS_VENDOR>/<CONFIG_SYS_BOARD> 
      or board/<CONFIG_SYS_BOARD> directory is compiled depending on 
      whether CONFIG_SYS_VENDOR is set or not.

 

      This is optional.  For those targets without the board directory, 
      leave this option empty.

 

config SYS_CONFIG_NAME 
    string 
    help 
      This option should contain the base name of board header file. 
      The header file include/configs/<CONFIG_SYS_CONFIG_NAME>.h 
      should be included from include/config.h.

 


同时在arch/Kconfig中又会加载其他目录下的Kconfig,如 source “arch/arm/Kconfig”,在arch/arm/Kconfig中又会加载board目录下的Kconfig,如 source “board/samsung/smdk2410/Kconfig”,下面我们看一下board/samsung/smdk2410/Kconfig中的内容:

 

 

不错,就是在这里对.config中的那几个配置赋了值,可以看到,第一个行用TARGET_SMDK2410进行了判断,这个在arch/arm/Kconfig中:

 

 

意思是: 如果选择的是smd2410,TARGET_SMDK2410会被选择,然后board/samsung/smdk2410/Kconfig会对CONFIG_SYS_CPU、CONFIG_SYS_SOC、CONFIG_SYS_VENDOR、CONFIG_SYS_BOARD、CONFIG_SYS_CONFIG_NAME赋值:

 

先说到这里吧。

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
U-Boot启动流程(Linux内核)的分析
u-boot源码配置原理分析
U-Boot编译过程分析
U-boot移植步骤
UBOOT 学习心得(UBOOT流程分析)
uboot 中的 config ,make config是怎么来的。
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服