OpenWRT 编译基础

编译环境: Ubuntu X64

1.安装依赖

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
2.下载代码:
git clone https://github.com/openwrt/openwrt    (官方)
git clone https://github.com/lede-project/source   (官方)
git clone https://github.com/coolsnowwolf/lede   (lean)

3.编译

#安装feeds:
cd lede 
./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
***********************************************************************

4.示例(x86_64):

#配置
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

#开始编译
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

猜你喜欢

转载自blog.csdn.net/2401_85413796/article/details/139471441