


編譯『OpenWrt』要部『Ubuntu』電腦.編譯過程吾單祗時間長,仲錯誤多.
係『Windows10』用命令行模式埶行SSH指令,遠程登錄『Ubuntu』,
ssh username@hostname |
填賬戶密碼
password: |
執行下載命令.
sudo apt-get update |
sudo apt-get install gcc g++ binutils patch bzip2 flex bison make autoconf gettext texinfo unzip sharutils subversion libncurses-dev ncurses-term gawk asciidoc zlib1g-dev git rar meson |
sudo apt-get install git |
sudo apt-get install rar |
sudo apt-get install meson |
sudo apt-get install fakeroot |
訪問根目錄
cd / |
創建openwrt資料夾
sudo mkdir /openwrt |
下載openwrt源碼
sudo git clone https://git.openwrt.org/openwrt/openwrt.git |
改『/openwrt』資料夾下冚辦爛讀寫權限
sudo chmod 777 -R /openwrt |
下載後安装feeds程式包.『feeds』係指外圍程式包. 下載到『feeds/』資料夾.
sudo /openwrt/scripts/feeds update -a |
sudo /openwrt/scripts/feeds install -a |
登入openwrt程式編譯配置清單
sudo make menuconfig |
撳鍵盤上下鍵更换選項,『—>』代表有子清單.
撳鍵盤左右鍵更换功能.『save存儲』『exit退出』『load載入』.
Enter鍵 | 登入清單 |
ESC鍵 | 返回清單 |
SPACE鍵 | 切换選擇『*編譯』『N吾編譯』『M動態編譯』. |
/鍵 | 搜尋 |
OpenWrt Configuration | 編譯配置清單 |
Target System | 目標系統 |
Subtarget | 系統子類 |
Target Profile | |
Target Images | 固件格式 |
Enable experimental features by default | 啟用實驗功能 |
Global build settings | 編譯参數 |
Advanced configuration options | 高級配置選項. |
Builds the OpenWrt Image Builder | 編譯固件環境編譯 |
Builds the OpenWrt SDK | 編譯OpenWrt SDK |
Builds the OpenWrt based Toolchain | 編譯交叉編譯架撑 |
Image configuration | 固件配置選項. |
Package features | 程式包特性 |
Base system | 基礎系統命令程式包 |
Administration | 高級管理命令程式包 |
Boot Loaders | 引導程序 |
Development | 開發架撑包 |
Extra packages | |
Firmware | 外圍芯片固件 |
Fonts | |
Kernel modules | 內核編譯參數 |
Languages | 編程語言程式包 |
Libraries | 庫程式包 |
LuCI | 網絡後臺圖形界面 |
電郵程式包 | |
Multimedia | 多媒體程式包 |
Network | 網絡程式包 |
Sound | 聲音程式包 |
Utilities | 架撑程式包 |
Xorg | 圖形界面 |
冚辦爛勾選,編譯時間極長, 而可能磁碟容量吾够.祇能根據系統應用蒞擇. 清單選擇可揀『*』或『M』. 撳『space』鍵切換. 撳『esc』鍵返回.
清單選擇 | |
* | build-in绑定,直接編譯入固件. |
M | module模塊.動態編譯,opkg命令安装 |
Target System | 目標系統 |
x86 | pc系統 |
subtarget | 系統子類 |
X86_64 | 64bit-cpu,2007年後出所CPU都係64BIT. |
Generic | i586體系, Pentium 4及之後32BIT-CPU. |
Legacy | i386體系, Pentium 4之前32BIT-CPU- |
AMD Geode based systems | 定制老舊網絡設備. |
登入openwrt內核編譯配置清單,埶行『sudo make menuconfig』命令之後埶行.
sudo make kernel_menuconfig |
Kernel Configuration | 內核配置清單 |
64-bit kernel | 64bit 內核 |
Processor type and features | 處理器類型和功能 |
Mitigations for CPU vulnerabilities | CPU漏洞緩解措施 |
Power management and ACPI options | 電源管理仝ACPI選項 |
Bus options (PCI etc.) | PCI匯流排選項 |
Binary Emulations | 二進位模擬 |
Virtualization | 虛擬化 |
General architecture-dependent options | 通用架構相關選項 |
Enable loadable module support | 可加載模塊支持 |
Enable the block layer | 啟用塊層 |
ASN1 | |
Executable file formats | 可執行檔案格式 |
Memory Management options | 記憶體管理選項 |
Networking support | 網路支援 |
Device Drivers | 設備驅動程序 |
File systems | 檔案系統 |
Security options | |
Cryptographic API | |
Library routines | |
Kernel hacking |
設定掂就編譯, 時間可能
編譯 | |
sudo make V=sc FORCE_UNSAFE_CONFIGURE=1 | 前臺顯示詳細信息. |
sudo make v=99 FORCE_UNSAFE_CONFIGURE=1 | 單核編譯,前臺顯示信息. |
sudo make v=99 -j2 FORCE_UNSAFE_CONFIGURE=1 | 雙核編譯,前臺顯示信息. |
sudo make menuconfig | 程式編譯配置 |
sudo make kernel_menuconfig | 內核編譯配置 |
- 首先編譯『交叉編譯架撑』
- 再用『交叉編譯架撑』分别編譯『內核』仝『程式包』
- 将編譯好『內核』仝『程式包』打包成『固件bin』
- 生成固件
編譯掂後係『/openwrt/bin』穩出『openwrt-x86-64-generic-ext4-combined-efi.img.gz』解壓『openwrt-x86-64-generic-ext4-combined-efi.img』檔. 佢就係編譯『openwrt』鏡像.
/openwrt/bin/targets/x86/64/openwrt-x86-64-generic-ext4-combined-efi.img.gz |
清除編譯 | |
sudo make clean | 清除 『固件bin』 『程式包』 |
sudo make dirclean | 清除『交叉編譯架撑』『固件bin』『程式包』 |
sudo make distclean | 冚辦爛清除, 返回配置原始状態. |
簡介 | |
Build編譯 | 将源代碼生成CPU可執行二進制代碼. |
Based Toolchain交叉編譯 | 係WINDOWS平臺編譯LINUX/ANDROID代碼 |
宿主機HOST | 編譯平臺 |
目標機TARGET | 執行平臺 |
feeds | 係指外圍程式包. |
* | 編譯 |
M | 動態編譯,opkg命令安装 |