Ubuntu 16.04下配置openWRT开发环境

标签(空格分隔):硬件开发 Linux


说明:本次主要参考了百度经验-ubuntu16.04编译OpenWrt环境搭建,个人觉得还有优化的地方。

安装依赖

经过测试,发现大部分在ubuntu16.04系统中就已经安装好了,只需再安装以下几个依赖:

sudo apt-get install flex
sudo apt-get install bison 
sudo apt-get install autoconf 
sudo apt-get install texinfo 
sudo apt-get install subversion 
sudo apt-get install libncurses5-dev 
sudo apt-get install  git-core
sudo apt-get install asciidoc

下载源码

从官方源下载:
git clone git://git.openwrt.org/15.05/openwrt.git,下载时间比较漫长,请耐心等待。

下载完成后需要修改目录的权限,sudo chmod 777 openwrt

添加软件扩展包:
cd openwrt
可以找到feeds.conf.default文件,将feeds.conf.default修改为feeds.conf,使用以下命令:cp feeds.conf.default feeds.conf得到feeds.conf文件

更新扩展,安装扩展:

./scripts/feeds update -a
./scripts/feeds install -a

系统提示:

WARNING: No feed for package 'librt' found, maybe it's already part of the standard packages?
WARNING: No feed for package 'libpthread' found, maybe it's already part of the standard packages?
WARNING: No feed for package 'lua' found, maybe it's already part of the standard packages?
WARNING: No feed for package 'libc' found, maybe it's already part of the standard packages?
WARNING: No feed for package 'libssp' found, maybe it's already part of the standard packages?

编译源码

测试下编译环境,使用命令:
make defconfig
系统提示:

Build dependency: Please install the openssl library (with development headers)
/home/kevinfan/openwrt/openwrt/include/prereq.mk:12: recipe for target 'prereq' failed
Prerequisite check failed. Use FORCE=1 to override.
/home/kevinfan/openwrt/openwrt/include/toplevel.mk:151: recipe for target 'staging_dir/host/.prereq-build' failed
make: *** [staging_dir/host/.prereq-build] Error 1

请安装openssl库:

sudo apt-get install openssl
sudo apt-get install libssl-dev

重新测试下编译环境,使用命令:
make defconfig
系统提示:configuration written to .config(配置写入config)

接着我们输入命令:
make menuconfig
如果一切正常,会出现一个配置菜单,可以选择要编译的固件平台、型号,还能选择固件中要添加的功能和组件,至此编译环境就搭建好了。

你可能感兴趣的:(Ubuntu 16.04下配置openWRT开发环境)