2018年4月30日星期一

OpenWRT 编译基础


官方代码:
openwrt   LEDE   

第三方代码:
Lean   


编译环境:
OS: Ubuntu X64
$ sudo apt-get update
$ sudo apt-get install build-essential asciidoc binutils bzip2 gawk gettext git libncurses5-dev libz-dev patch unzip zlib1g-dev lib32gcc1 libc6-dev-i386 subversion flex uglifyjs git-core gcc-multilib p7zip p7zip-full msmtp libssl-dev texinfo libglib2.0-dev

下载代码:
git clone https://github.com/openwrt/openwrt    (官方)
git clone https://github.com/lede-project/source   (官方)
git clone https://github.com/coolsnowwolf/lede   (lean)

进入目录:例如
   $ cd lede 
       
安装feeds:
   $ ./scripts/feeds update -a 
   $ ./scripts/feeds install -a

配置:
   $ make menuconfig 

下载包:
   $make download -j8 V=s

编译:
   $ make -jN V=s  {N=[cpu线程数+1],首次编译使用 -j1}

清理:
   $ make clean   {编译错误执行}

*******************************其他操作***********************************
同步git代码:
$ git pull   
更新feeds
$ ./scripts/feeds update -a && ./scripts/feeds install -a
恢复默认配置:
$ rm -rf ./tmp && rm -rf .config
***********************************************************************

x84 例子:
 
$ make menuconfig 
 1. Target System & Subtarget ====> x86
 2. Target Images ====> 
3. Global build settings ====>
4. Base system ====>
5. LuCI ---> Collections ---> luci
6. LuCI ---> Modules ---> Translations ---> Chinese (zh-cn)
7. LuCI ---> Applications --->
8. LuCI ---> Themes ---> 
9. Network ---> File Transfer ---> Aria2 configuration ---> Enable bittorrent support (NEW)
10.Utilities ---> Compression --->
11. Utilities ---> Editors --->nano vim
12.Utilities ---> Filesystem --->
13. Utilities ---> disc
14 Utilities ---> lrzsz usbutils



$ make -j1 V=s  开始编译
 
编译结束后,固件存放在 项目 lede/bin/targets/x86
 
虚拟机测试:
virtualbox




#root uci set network.lan.ipaddr=192.168.56.2
#root uci commit
#root /etc/init.d/network restart

0 评论:

发表评论