歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux綜合 >> 學習Linux >> Centos7下編譯openwrt

Centos7下編譯openwrt

日期:2017/3/3 17:45:45   编辑:學習Linux

Centos7下編譯openwrt

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

http://xxxxxx/Linuxjc/1184812.html TechArticle

Copyright © Linux教程網 All Rights Reserved