openwrt编译环境
① openwrt安装桌面环境
1. 环境说明 本文安装在windows下的vm中,做为旁路路由使用
2. 下载固件 镜像参考阿里巴巴开源镜像站
我这里增加了一个lx的用户,一般用普通用户编译openwrt, 首先passwd root 设置root 密码,然后安装apt install sudo 来安装sudo命令。之后⽤adser lx 增加lx⽤户,passwd root 设置root 密码,我这⾥⽤户密码和root密码均为lx。
② OpenWRT(一)开发环境搭建
1、安装git工具(现在一般是使用git去下载源码)
2、安装依赖的库文件(一起装比较容易出现漏装,建议逐个装)
sudo apt-get install gcc g++ binutils patch bzip2 flex bison make autoconf gettext texinfo unzip sharutils ncurses-term zlib1g-dev libncurses5-dev gawk libssl-dev subversion
或者逐个安装:
sudo apt-get install gcc
sudo apt-get install g++
sudo apt-get install binutils
sudo apt-get install patch
sudo apt-get install bzip2
sudo apt-get install flex
sudo apt-get install bison
sudo apt-get install make
sudo apt-get install autoconf
sudo apt-get install gettext
sudo apt-get install texinfo
sudo apt-get install unzip
sudo apt-get install sharutils
sudo apt-get install ncurses-term
sudo apt-get install zlib1g-dev
sudo apt-get install libncurses5-dev
sudo apt-get install gawk
sudo apt-get install libssl-dev
sudo apt-get install subversion
3、下载OpenWRT源码
先创建OpenWRT目录来保存源码
mkdir OpenWRT
cd OpenWRT
git clone https://github.com/openwrt-mirror/openwrt.git (下载源码)
4、更新源码上的软件
为了使 OpenWrt 支持更多的软件,需要更新和安装其它源上面的软件
cd openwrt
./scripts/feeds update -a
./scripts/feeds install -a
5、进行OpenWRT配置
make menuconfig
1). 选择 CPU 型号
Target System -> Ralink RT288x/RT3xxx
2). 选择 CPU 子型号
Subtarget -> RT3x5x/RT5350 based boards
3). 选择具体路由器型号
Target profile -> HAME-MPR-A2
保存退出
6、编译源码
make V=99
注意:编译过程要联网哦,如果编译出错大部分都是由于网络不好。所以重新编译就OK了
烧录文件在哪? openwrt/bin/ramips/openwrt-ramips-rt305x-mpr-a2-squashfs-sysupgrade.bin
更多精彩文章,欢迎关注微信公众号"嵌入式软件开发交流"
③ openwrt编译环境出现这个是什么意思
一个是测试编译环境时出现的,我的用户已经是非root用户了
/home/king/openwrt/backfire/include/prereq-build.mk:17: recipe for target 'prereq-non-root' failed
④ Ubuntu环境下编译openwrt 出现如下错误怎么办
首先, 安装完依赖(并不是所有的依赖都被脚本检查), 请参考 OpenWrt Buildroot
然后, 请使用较新的linux发行版, 因为openwrt比较新, 所以相应的host编译主机也要比较新才行.
最后, 在网络通畅情况下编译, 再运行一次make V=s试试.
