code style

2017年7月6日 星期四

Buildroot (3)常用指令及基本觀念

make list-defconfigs:
列出所有的defconfig,如果這裡有廠商給的config,請放在configs資料夾下,Buildroot才會
偵測到

make help:
使用說明

make clean:
當toolchain變動時或任何大的變動,請下這指令,會刪除所有build產生的東西(including build directories, host, staging and target trees, the images and the toolchain)

make distclean:
刪除所有的檔案,除了source files。注意! 當ccache 開啟時,make clean or make distclean不會刪除cache。

何時要rebuild:
Buildroot不會偵測在make menuconfig, make xconfig後的變動,user要自已判斷需不需要rebuild。關於rebuild判斷的參考:

(1)target architecture configuration變動時,整個rebuild

(2)toolchain configuration變動時,整個rebuild

(3)新增package時,不需要整個rebuild。
a.如果Buildroot 偵測到package沒有built過,則會build it。
b.如果這package是其它package的可選library時,且它已build過,Buildroot不會自動重build這 package。
c.自已手動reubild package或整個Buildroot

Ex:例如我們原本built了一個ctorrent package,裡面不含openssl 。但後來想要支援openssl,我們就在設定裡新增openssl,此時Buildroot只會built新的openssl,不會rebuild
ctorrent! 這時需要我們手動rebuild ctorrent或者整個rebuild。

(4)移除一個package時,Buildroot並不會去刪時它,除非你整個rebuild

(5)package的設定變動時,Buildroot並不會去rebuild這個package

(6)當root filesystem的框架變動時,需要整個rebuild

如何rebuild一個package或移除一個package時不用整個rebuild?移除一個package時,並須要整個rebuild。而最簡單的rebuild一個package的方法是刪除output/build/<package>這個資料夾,可以下 make <package>dirclean來進行移除的動作。

make <package>-rebuild:
重新compilation and installation,這個指令會執行package裡面的makefile。

make <package>-reconfig:
重新configuration, compilation and installation,這個指令會執行package裡面的makefile。

Building out-of-tree:
預設輸出會在output資料夾下,如果想要更改輸出資料夾,請參考下述指令
make O=/tmp/build
or
cd /tmp/build
make O=$PWD -C path/to/buildroot
如果/tmp/build資料夾不存在的話,Buildroot會建立,最終結果會產生在這資料夾下。
這裡可以使用絕對位置和相對位置,相對位置是指相對於 Buildroot source directory。
這裡要注意的是,.config也會移到你改變輸出的位置。

Environment variables:
HOSTCXX =>host C++ Compiler
HOSTCC => host C Compiler
UBLIBC_CONFIG_FILE=<path/to/.config>=>uClibc configuration的位置
BUSYBOX_CONFIG_FILE=<path/to/.config>=>BusyBox configuration的位置
BR2_CCACHE_DIR=>ccache 的位置
BR2_DL_DIR=> 下載下來的檔案位置
BR2_GRAPH_XXX=>產生graph的相關設定

Buildroot 圖片分析指令:
要先確認有安裝graphviz工具,sudo apt-get install graphviz。
make graph-depends:
產生整個Buildroot的depends圖片,位置在output/graphs/graph-depends.pdf 

make <pkg>-graph-depends:
產生單一package的depends圖片,位置在output/graphs/<pkg>-graph-depends.pdf 

make graph-build:
產生整個Buildroot中要build每個package所花費的時間,位置在output/graphs/
  • build.hist-build.pdf, a histogram of the build time for each package, ordered in the build order.
  • build.hist-duration.pdf, a histogram of the build time for each package, ordered by duration (longest first)
  • build.hist-name.pdf, a histogram of the build time for each package, order by package name.
  • build.pie-packages.pdf, a pie chart of the build time per package
  • build.pie-steps.pdf, a pie chart of the global time spent in each step of the packages build process
make graph-size:
產生整個Buildroot中要build每個package所花費的時間,位置在output/graphs/




沒有留言:

張貼留言