• Tiny4412 uboot Makefile 分析


    * Build uboot

    a) 安装好toolchain (arm-linux-gcc-4.5.1-v6-vfp-20120301.tgz)并设置好
    环境变量PATH,保证可以正常使用。
    b) 解压 uboot_tiny4412-20130729.tgz 并进入相应的目录
    tar xzf uboot_tiny4412-20130729.tgz
    c) 配置 uboot 并编译
    cd uboot_tiny4412
    make tiny4412_config
    make
    d) 编译 用于生成bl2 的工具
    make -C sd_fuse
    或者
    cd sd_fuse; make

    * uboot Makefile 分析

    执行 make tiny4412_config 时,在 Makefile 中匹配到的规则为:

    %_config:: unconfig
    @$(MKCONFIG) -A $(@:_config=)

    在Makefile中%为通配符,代表任意长度的任何字符,因此%_config就匹配到
    tiny4412_config,双::表示强制执行下面的命令。命令前的@抑制回显。
    $(@:_config=)使用了替代引用规则,所谓替代引用规则为
    $(variable:search=replace),:号后为搜索字符串,=号后为用于替代的字符串,
    $@为目标,也就是 tiny4412_config,搜索字符串为"_config",用于替代的字符
    串为空串,因此$(@:_config=)最后就被解析为"tiny4412"。

    MKCONFIG在前面定义为:
    MKCONFIG := $(SRCTREE)/mkconfig
    SRCTREE := $(CURDIR)

    这样命令最后被解析为:mkconfig -A tiny4412

    转而去执行mkconfig脚本。

    ** mkconfig -A tiny4412

    1) if [ xxx -a yyy ] 中的 -a 表示“逻辑与”相当于 &&
    2) $# 表示明令后的参数个数
    3) 在boards.cfg文件中搜索以"tiny4412"开头的行,找到其中的这一行:
    tiny4412 arm armv7 tiny4412 samsung exynos
    4) 对这一行进行分析得到:
    board = "tiny4412"
    arch = "arm"
    cpu = "armv7"
    vender = "samsung"
    soc = "exynos"
    5) 打印消息 Configuring for tiny4412 board...
    6) 执行命令:
    cd ./include
    rm -f asm
    ln -s ../arch/arm/include/asm asm
    7) ln -s arch-exynos asm/arch
    8) 在 include/ 目录下生成 config.mk,内容为:
    ARCH = arm
    CPU = armv7
    BOARD = tiny4412
    VENDOR = samsung
    SOC = exynos
    9) 在 include/ 目录下生成 config.h,内容为:
    /* Automatically generated - do not edit */
    #define CONFIG_BOARDDIR board/samsung/tiny4412
    #include <config_defaults.h>
    #include <configs/tiny4412.h>
    #include <asm/config.h>

  • 相关阅读:
    poj 3125 Printer Queue(STL注意事项)
    poj 2823 Sliding Window (STL超时版)
    poj 1088 滑雪 详解
    poj 2983 Is the Information Reliable?
    poj 2524 Ubiquitous Religions (STL与非STL的对比)
    高精度算法集合
    zTree v2.6 v3.0 初始化 / 方法对比
    下面是关于rownum的介绍(oracle)
    web性能优化
    jQueryEasyui,DataGrid几个常用的操作
  • 原文地址:https://www.cnblogs.com/brep/p/4188753.html
Copyright © 2020-2023  润新知