zoukankan      html  css  js  c++  java
  • uboot的静默编译、指定编译目录、多核编译

    最近在移植uboot,发现每次看源代码,都有编译留下的.o 等各种文件,在百度中,找到了解决方法。

    在顶层的Makefile文件中,大概80多行,有这么几句注释,

    # kbuild supports saving output files in a separate directory.
    # To locate output files in a separate directory two syntaxes are supported.
    # In both cases the working directory must be the root of the kernel src.
    # 1) O=
    # Use "make O=dir/to/store/output/files/"
    #
    # 2) Set KBUILD_OUTPUT
    # Set the environment variable KBUILD_OUTPUT to point to the directory
    # where the output files shall be placed.
    # export KBUILD_OUTPUT=dir/to/store/output/files/
    # make
    #
    # The O= assignment takes precedence over the KBUILD_OUTPUT environment
    # variable.

    注释上讲有两种方法可以把编译过程产生的文件输出到指定的文件夹里

    第一种:使用 O=xxxx   ,(可以不是绝对路径)

      注意:

        1. 经过实际操作,O必须是大写,否则没用(虽然没报错)。

        2. 在 make xxx_config时,必须加上 O=xxxx, 否则也没用。

        3. 在符合以上两条后,执行 make O=xxxx, 才会输出到指定文件夹。(如果操作了第二步,第三步没加 O=xxx, 也会报错)

    第二种:export KBUILD_OUTPUT=xxxx

      执行命令后,直接操作,就会把编译后的文件输出到指定文件夹中。

      效果和第一种相同。

      

    静默编译:在Makefile的第302行,有下面的注释

    # If the user is running make -s (silent mode), suppress echoing of

    # commands

    ifneq ($(filter s% -s%,$(MAKEFLAGS)),)
    quiet=silent_
    endif

    export quiet Q KBUILD_VERBOSE

    执行命令加上 -s / s ,(小写),不会输出打印

    例子:

      make smdk2410_config

      make -s

     我的静默编译和指定编译目录不能同时使用(我也不知道为什么),如果你知道原因,请留言,谢谢您!

    多核编译:

    在配置好板卡信息后,准备make时,加上 -jn  (n=你想要多少核参与编译) (n<= 实际的cpu核芯数)

     " - ",不能去掉," j ", 必须小写。

    例子:

      make -j4

    参考博客:https://blog.csdn.net/linux_rookie/article/details/73603573

  • 相关阅读:
    Document
    Document
    Document
    Document
    Document
    Document
    Document
    Document
    C#中的委托是什么
    C# Lambda表达式Contains方法 like
  • 原文地址:https://www.cnblogs.com/yddeboke/p/8798029.html
Copyright © 2011-2022 走看看