Uboot Study of the second----the four----of master makefile two methods of compiling: in-place compilation and individual output folder compilation

Source: Internet
Author: User

第57-123 Line:

# U-boot build supports producing a object files to the separate external # directory. Both use cases is supported:60 # 1) Add o= to the Do command line + # ' make O=/tmp/build all ' # 2) S   ET environement variable build_dir to point-to-the-desired location # ' Export Build_dir=/tmp/build ' [# ' make ' 67 # The second approach can also is used with a Makeall script # ' Export build_dir=/tmp/build ' # './makeall ' 7  1 # # # Command line ' o= ' setting overrides build_dir environent variable. When none of the above methods was used the local build is performed and the object files were placed in th  E source directory. * ifdef o ifeq ("$ (Origin O)", "command Line") Build_dir: = $ (O) Bayi endif-endif83 ($ (B  Uild_dir),) Saved-output: = $ (build_dir) * Attempt to create a output directory. $ (shell [-D ${build_dir}] | | mkdir-p ${build_dir}) # Verify if it was successful.  Build_dir: = $ (Shell CD $ (build_dir) &&/bin/pwd) $ (if $ (build_dir), $ (Error output Directory "$ (Saved-ou Tput) "does not exist)" EndIf # IFNEQ ($ (build_dir),) 94: = $ (if $ (objtree), $ (Build_dir), $ (build_dir DIR)) Srctree: = $ (CURDIR) Topdir: = $ (srctree) 98 Lndir: = $ (Objtree) The TOP of the export DIR srctree objtree 101 Mkconfig: = $ (srctree)/mkconfig 102 Export Mkconfig 103 104 IFNEQ ($ (Objtree), $ (srctr EE)) Remote_build: = 1 106 Export Remote_build 107 endif 108 109 # $ (obj) and (SRC) is defined in CONFIG.MK but he Re in main Makefile # We also need them before config.mk are included which are the case for 111 # some targets like UNC Onfig, clean, clobber, Distclean, etc. FNEQ ($ (Objtree), $ (srctree)) 113 obj: = $ (Objtree)/£ º SRC: = $ (srctree)/115 else: = 117 src: = 118 endif 119 Export obj src + 121 # Make sure Cdpath settings don ' t interfere 122 unexport  Cdpath 123

Compiling complex projects: Makefile provides two compile management methods, which are compiled in place by default.

Disadvantages of In-place compilation:

First: Source Files directory. Second: A set of source code can only be processed according to one configuration and compilation method, and cannot maintain more than two or more than two configuration compilation methods at the same time.

Output Folder compilation:

In order to solve the above shortcomings, the use of separate output folder compilation, Linux kernel support Such a method, the implementation of the idea is: all the compiled. o File or

All other files are output to the specified directory. Uboot also learned such a method.

Specific practices:

See 57 Lines---76 lines of comments:

  ① make o= output directory at command-line compilation (note that the o= output directory is also added to the configuration)

  ' Make o=/tmp/build all '
For example, we create an output folder in [email Protected]:/usr/local/arm/qt_x210v3/uboot, which is used as the export directory:
Three steps: Make O=output/distclean
Make O=output/x210_sd_config
This step is an error:

Workaround: Manually create this file after entering the output folder:

[Email protected]:/usr/local/arm/qt_x210v3/uboot/output# mkdir board/samsung/x210-p

and then reconfigure.

Make O=output/all

Finally found that there is still a problem. It should be the whole uboot transplant or not. We will later use the Samsung version of the uboot for transplant and then to study.

 ② Setting the environment variable BUILD_DIR indicates the desired output directory.

  ' Export build_dir=/tmp/build ' make '

The second method can also be implemented through the Makeall script.

' Export Build_dir=/tmp/build '  
Make o= output directory will overwrite Build_dir


Many BSP developers use this approach, so it is helpful to learn later.

The Makefile code implementation of the two methods of compiling---123 lines

Uboot Study of the second----the four----of master makefile two methods of compiling: in-place compilation and individual output folder compilation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.