openwrt源码的编译相对简单,部分编译过程当中出现问题多是因为用的是root用户,若是切换成普通用户下载并编译可能会更顺利一些。
css
下载openwrt源码 python
clone https://gitee.com/mirrors/openwrt.git 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源创计划”,欢迎正在阅读的你也加入,一块儿分享。