Centos7下編譯openwrt

來源:互聯網
上載者:User

Centos7下編譯openwrt
1.下載openwrt最新源碼

git clone https://github.com/openwrt/openwrt.git
2.下載feeds
執行$ ./scripts/feeds update -a$ ./scripts/feeds install -a
3.配置環境
make defconfig可檢查所需依賴$sudo yum -y install gcc binutils patch bzip2 flex bison make autoconf gettext texinfo unzip sharutils libncurses5-dev ncurses-term zlib1g-dev wget perl-Thread-Queue openssl-devel zlib-static ncurses-devel gcc-c++$ make prereq$ make menuconfig

通過文本對話方塊進行選項配置,最主要的配置項有:

Target system(目標系統類別型)

Package selection(軟體包選擇)

Build system settings (編譯系統設定)

Kernel modules (核心模組)

[*]表示:這個包裹選中編譯,並安裝在firmware中;

[M]表示:這個軟體包選中編譯,但並不安裝在firmware中。

在退出Menuconfig的時,會提示是否儲存配置。

4.編譯
  • 一般情況,使用一個簡單的命令:

    $ make
  • 在多核處理器系統上為提高速度,可使用(例如用3核處理器):

    $ make –j 3
  • 在後台進行編譯,使用閒置I/O資源和CPU效能,可使用(例如使用雙核處理器)

    $ onice -c 3 nice -n 20 make -j 2
  • 編譯一個單獨的軟體包(例如在cups軟體包):

    $ make package/cups/compile V=99
  • 如果特殊原因需要分析編譯報錯資訊:

    $ make V=99 2>&1 |tee build.log |grep -i error

    說明:將編譯的所有輸出資訊儲存在build.log中,將error資訊列印在螢幕上。

  • 一個複雜指令的應用

    $ ionice -c 3 nice -n 20 make -j 2 V=99 CONFIG_DEBUG_SECTION_MISMATCH=y 2>&1 |tee build.log |egrep -i '(warn|error)'

    說明:將編譯的所有輸出資訊儲存在build.log中,將error和warning資訊列印在螢幕上。編譯過程使用雙核CPU,佔用後台資源。

5.產生鏡像(Image)位置

新產生的鏡像會預設放在建立的一個bin目錄下。

$ ls bin/*
6.清理工作
$ make clean 

除了清除產生的目錄,還想清除交叉編譯工具(以及工具鏈目錄)

$ make dirclean

清除所有相關的東西,包括下載的軟體包,設定檔,feed內容等:

$ make distclean
7.安裝openwrt

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.