zoukankan      html  css  js  c++  java
  • 基于cygwin构建u-boot(一)环境搭建

    从本文开始,更系统的描述基于cygwin构建u-boot。

    之前《痛苦的版本对齐》系列,对于cygwin环境下Sourcery CodeBench,u-boot-1.1.6的构建有侧面的说明,本文主要是对u-boot-2010.09进行说明

    一、编译环境

    1、cygwin环境参数如下(cygcheck -c),仅截取核心模块。

     1 $ cygcheck -c
     2 Cygwin Package Information
     3 Package              Version              Status
     4 bash                 4.1.10-4             OK
     5 binutils             2.22.51-2            OK
     6 coreutils            8.15-1               OK
     7 cygutils             1.4.10-2             OK
     8 cygwin               1.7.15-1             OK
     9 gawk                 4.0.1-1              OK
    10 gcc4-core            4.5.3-3              OK
    11 libgcc1              4.5.3-3              OK
    12 make                 3.82.90-1            OK
    13 sed                  4.2.1-2              OK
    14 tar                  1.25-1               OK

    2、编译工具链,

    CodeSourcery G++ Lite 2009q1-203,

    http://www.codesourcery.com/,目前,已经为mentor graphics公司的http://www.mentor.com/embedded-software/codesourcery

    下载,lite-edition。基于GCC的版本为 gcc-4.3.3

    linux下版本:arm-2009q1-203-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2

    windows下版本:arm-2009q1-203-arm-none-linux-gnueabi-i686-mingw32.tar.bz2

     在 cygwin窗口下,需要 配置环境变量,set CYGPATH=D:/cygwin/bin/cygpath

    注释:原因参见《痛苦的版本对齐(2) 和时间的相关性》http://www.cnblogs.com/yvivid/p/3541142.html

    3、u-boot版本:

    从u-boot官网上下载,u-boot-2010.09

    下载链接:ftp://ftp.denx.de/pub/u-boot/

    4、上述版本状态,是我尝试的,如果是其他情况,需要自己确认。

    二、说在前面

    1、可以先在Linux系统下验证。

      1)由于u-boot版本是在linux下维护的,虽然支持cygwin,但根据我的验证,问题仍然较多。

      2)可以通过虚拟机构建,如VirtualBox。

      3)上面版本组合,我已经验证

    2、U-boot产品开发,建议在linux系统下进行。

      cygwin下,u-boot还是有各种细节问题需要解决(本系列会介绍),但如果要成熟快速开发,Linux是首选。

    三、初次验证(首次运行的失败,cygwin路径问题)

    1、编译命令及错误信息

     1 D:cygwinu-boot-2010.09u-boot-2010.09>set CYGPATH=D:/cygwin/bin/cygpath
     2 
     3 D:cygwinu-boot-2010.09u-boot-2010.09>make CROSS_COMPILE=D:/cygwin/arm-2009q1/bin/arm-none-linux-gnueabi- distclean
     4 
     5 D:cygwinu-boot-2010.09u-boot-2010.09>make CROSS_COMPILE=D:/cygwin/arm-2009q1/bin/arm-none-linux-gnueabi- omap1610inn_config
     6 Configuring for omap1610inn board...
     7 
     8 D:cygwinu-boot-2010.09u-boot-2010.09>make CROSS_COMPILE=D:/cygwin/arm-2009q1/bin/arm-none-linux-gnueabi-
     9 Generating include/autoconf.mk
    10 Generating include/autoconf.mk.dep
    11 include/autoconf.mk.dep:1: *** multiple target patterns.  Stop.

    2、原因
    参见《痛苦的版本对齐(3) cygwin下的路径引用》http://www.cnblogs.com/yvivid/p/3546649.html

    【原因】make 无法处理异常的冒号 (autoconf.mk.dep中,由于gcc工具产生的windows路径导致)

    尝试修改解决

    找到 autoconf.mk.dep文件,如下:

     1 include/autoconf.mk: include/common.h 
     2   /u-boot-2010.09/u-boot-2010.09/include/config.h 
     3   /u-boot-2010.09/u-boot-2010.09/include/config_defaults.h 
     4   /u-boot-2010.09/u-boot-2010.09/include/configs/omap1610inn.h 
     5   /u-boot-2010.09/u-boot-2010.09/include/config_cmd_default.h 
     6   /u-boot-2010.09/u-boot-2010.09/include/configs/omap1510.h 
     7   /u-boot-2010.09/u-boot-2010.09/include/asm/arch/sizes.h 
     8   /u-boot-2010.09/u-boot-2010.09/include/asm/config.h 
     9   /u-boot-2010.09/u-boot-2010.09/include/linux/bitops.h 
    10   /u-boot-2010.09/u-boot-2010.09/include/asm/types.h 
    11   /u-boot-2010.09/u-boot-2010.09/include/asm/bitops.h 
    12   /u-boot-2010.09/u-boot-2010.09/include/asm/proc/system.h 
    13   /u-boot-2010.09/u-boot-2010.09/include/linux/config.h 
    14   /u-boot-2010.09/u-boot-2010.09/include/linux/types.h 
    15   /u-boot-2010.09/u-boot-2010.09/include/linux/posix_types.h 
    16   /u-boot-2010.09/u-boot-2010.09/include/linux/stddef.h 
    17   /u-boot-2010.09/u-boot-2010.09/include/asm/posix_types.h 
    18   /u-boot-2010.09/u-boot-2010.09/include/linux/string.h 
    19   /u-boot-2010.09/u-boot-2010.09/include/asm/string.h 
    20   /u-boot-2010.09/u-boot-2010.09/include/asm/ptrace.h 
    21   /u-boot-2010.09/u-boot-2010.09/include/asm/proc/ptrace.h 
    22   d:/cygwin/arm-2009q1/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.3/include/stdarg.h 

    找到 autoconf.mk.dep的构建(在主文件夹Makefile中)

    可以增加 sed 处理: sed -i 's/d:///cygdrive/d//g' $@

    1 $(obj)include/autoconf.mk.dep: $(obj)include/config.h include/common.h
    2     @$(XECHO) Generating $@ ; 
    3     set -e ; 
    4     : Generate the dependancies ; 
    5     $(CC) -x c -DDO_DEPS_ONLY -M $(HOSTCFLAGS) $(CPPFLAGS) 
    6         -MQ $(obj)include/autoconf.mk include/common.h > $@
    7     sed -i 's/d:///cygdrive/d//g' $@

    3、还是错误,而且,从distclean都开始错误。

    1 D:cygwinu-boot-2010.09u-boot-2010.09>make CROSS_COMPILE=D:/cygwin/arm-2009q1/bin/arm-none-linux-gnueabi- distclean
    2 include/autoconf.mk.dep:1: *** multiple target patterns.  Stop.
    3 
    4 D:cygwinu-boot-2010.09u-boot-2010.09>make CROSS_COMPILE=D:/cygwin/arm-2009q1/bin/arm-none-linux-gnueabi- omap1610inn_config
    5 include/autoconf.mk.dep:1: *** multiple target patterns.  Stop.
    6 
    7 D:cygwinu-boot-2010.09u-boot-2010.09>make CROSS_COMPILE=D:/cygwin/arm-2009q1/bin/arm-none-linux-gnueabi-
    8 include/autoconf.mk.dep:1: *** multiple target patterns.  Stop.

    4、分析并解决,

    由于 Makefile会 sinclude autoconf.mk.dep,而多余的冒号:直接导致makefile严重的语法错误,而无法执行。

    所以需要手动删除 include文件夹下的autoconf.mk.dep,

    再编译,该模块就可以通过该错误告警了。

    ===【未完待续】=== 

  • 相关阅读:
    Qt之JSON生成与解析
    Qt的QLineEdit显示密码
    Ubuntu14.04 64位运行32位程序
    Xcode 7在支持ipad的设备中需要支持分屏!
    「模板」平衡树
    [NOI2016]区间 题解(决策单调性+线段树优化)
    [NOIP模拟测试12]题解
    [笔记乱写]0/1分数规划
    [NOIP模拟测试11] 题解
    [SCOI2014]方伯伯的玉米田 题解(树状数组优化dp)
  • 原文地址:https://www.cnblogs.com/yvivid/p/3561420.html
Copyright © 2011-2022 走看看