Openwrt | 編譯openwrt源碼




openwrt源碼的編譯相對簡單,部分編譯過程當中出現問題多是因爲用的是root用戶,若是切換成普通用戶下載並編譯可能會更順利一些。
css


下載openwrt源碼 python

$ git clone https://gitee.com/mirrors/openwrt.git

當下載好openwrt源碼後,進入openwrt文件夾
git

$ cd openwrt/

查看openwrt文件夾內容
shell

$ ls

列出文件夾的內容以下
vim

BSDmakefile  config  Config.in  feeds.conf.default  include  LICENSE  Makefile  package  README  rules.mk  scripts  target  toolchain  tools

對於上述出現的文件,首先第一步要看的內容就是  READMEruby

$ vim README

出現內容以下所示
微信

 _______ ________ __ | |.-----.-----.-----.| | | |.----.| |_ | - || _ | -__| || | | || _|| _| |_______|| __|_____|__|__||________||__| |____| |__| W I R E L E S S F R E E D O M -----------------------------------------------------
This is the buildsystem for the OpenWrt Linux distribution.
To build your own firmware you need a Linux, BSD or MacOSX system (casesensitive filesystem required). Cygwin is unsupported because of the lackof a case sensitive file system.
You need gcc, binutils, bzip2, flex, python3.5+, perl, make, find, grep, diff,unzip, gawk, getopt, subversion, libz-dev and libc headers installed.
1. Run "./scripts/feeds update -a" to obtain all the latest package definitionsdefined in feeds.conf / feeds.conf.default
2. Run "./scripts/feeds install -a" to install symlinks for all obtainedpackages into package/feeds/
3. Run "make menuconfig" to select your preferred configuration for thetoolchain, target system & firmware packages.
4. Run "make" to build your firmware. This will download all sources, buildthe cross-compile toolchain and then cross-compile the Linux kernel & allchosen applications for your target system.
Sunshine! Your OpenWrt Community http://www.openwrt.org


"README" 34L, 1299C 1,1 All


閱讀README內容,出現步驟1.2.3.4.共四步。這四步就是openwrt源碼的編譯步驟。app


以下
flex

一、ui

$ ./scripts/feeds update -a

二、

$ ./scripts/feeds update -a

三、

$ make menuconfig

當運行到這步的時候會出現openwrt的配置界面

各類參數便可經過這裏設置。


將Target Profile 設置爲 TP-LINK TL-WR710N V1(本文以硬件路由器 TP-LINK TL-WR710N V1爲例),退出並保存

四、最後 make 編譯 便可。

$ make


等待漫長的編譯過程 完成後 進入文件夾

$ cd bin/targets/ar71xx/generic/
$ ls


會看到以下關於 TP-LINK TL-WR710N V1  固件文件

openwrt-ar71xx-generic-tl-wr710n-v1.manifestopenwrt-ar71xx-generic-tl-wr710n-v1-squashfs-factory.binopenwrt-ar71xx-generic-tl-wr710n-v1-squashfs-sysupgrade.bin


通常狀況下使用的是以下文件

openwrt-ar71xx-generic-tl-wr710n-v1-squashfs-sysupgrade.bin


                  


本文分享自微信公衆號 - 嵌入式軟硬件愛好者(qrsfan)。
若有侵權,請聯繫 support@oschina.cn 刪除。
本文參與「OSC源創計劃」,歡迎正在閱讀的你也加入,一塊兒分享。

相關文章
相關標籤/搜索