Compile OpenWRT

I compiled OpenWRT in a VM inside of PVE. It's the same if you do it in a dedicated PC. (I used Ubuntu 22.04 x86_64 in a VM on PVE)

If your internet is not good, try to set a local http/https proxy.

export HTTP_PROXY=http://IP_OF_YOUR_PC:PORT
export HTTPS_PROXY=http://IP_OF_YOUR_PC:PORT

Then your terminal session will reach to internet via your HTTP Proxy.

 

Compile for the first time

Instead I used this repo for the reason it supports Linux kerneal 6.1.28 by the time of writting.

https://github.com/coolsnowwolf/lede

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

make -j8 download

make -j1 V=s

 

It has tutorials. Just follow it. You can do "make -j8 download". But I encountered errors when I compiled it for the first time with "make -j4 V=s". SO COMPILE IT WITH 1 thread for the frist time! "make -j1 V=s"

It will take several hours to finish. You will receive img files in path "./bin/targets/x86/64/" , such as openwrt-x86-64-generic-squashfs-combined-efi.img and etc..

 

Compile for the second time with more packages

By default this repo doesn't have lots of packages in the LUCI applications. 

So you can add a "package" inside of it. : https://github.com/kenzok8/small-package

使用方式(三选一):

  1. 先cd进package目录,然后执行
 git clone https://github.com/kenzok8/small-package
  1. 或者添加下面代码到feeds.conf.default文件
 src-git small8 https://github.com/kenzok8/small-package
  1. lede/下运行 或者openwrt/下运行
git clone https://github.com/kenzok8/small-package package/small-package

Personally I choose method 2. 

Then re-do 

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

it will install new packages added from "kenzok8/small-package" which is called small8

Then with "make menuconfig", go to LUCI -> Applications -> Select some apps you need.

Then you are SAFE to compile with -j8 flags (8 threads) or -j$(nproc)

make -j8 download
make -j$(nproc) V=s

 

Compiling for the second time costs less than the first time because you had already compiled the most packages in advance.

You will receive files such as openwrt-x86-64-generic-squashfs-combined-efi.img, openwrt-x86-64-generic-squashfs-combined.img, openwrt-x86-64-generic-squashfs-rootfs.img, openwrt-x86-64-generic-squashfs-combined-efi.vmdk

*.vmdk is for virtual machine such as VirtualBox and VMware.

 

Then follow this tutorial that I wrote to install OpenWRT in a VM on PVE.

https://www.cnblogs.com/spaceship9/p/17410748.html

 

posted @ 2023-05-18 00:39  spaceship9  阅读(40)  评论(0编辑  收藏  举报