自己动手编译最新OpenWrt稳定版

点击注册订购clash/ssr/v2ray小火箭等机场节点。69折优惠码:XN2023

1.安装ubuntu 20.04.3

sudo apt-get update -y

​sudo apt-get -y install build-essential asciidoc binutils bzip2 gawk gettext git libncurses5-dev libz-dev patch python3 python2.7 unzip zlib1g-dev lib32gcc1 libc6-dev-i386 subversion flex uglifyjs git-core gcc-multilib p7zip p7zip-full msmtp libssl-dev texinfo libglib2.0-dev xmlto qemu-utils upx libelf-dev autoconf automake libtool autopoint device-tree-compiler g++-multilib antlr3 gperf wget curl swig rsync​

​2.下载源码:​

git clone https://github.com/coolsnowwolf/lede

git clone https://github.com/openwrt/openwrt

3.查看并切换到新的稳定版tag(分支):

cd openwrt

git tag

git checkout v21.02.2

4.​自定义要安装的包,修改openwrt的include/target.mk文件,​

vi include/target.mk

​在​

DEFAULT_PACKAGES:=\

base-files \

ca-bundle \

dropbear \

fstools \

libc \

libgcc \

libustream-wolfssl \

logd \

mtd \

netifd \

opkg \

uci \

uclient-fetch \

urandom-seed \

urngd

​ 后面加上自己想要编译的内容:​

​DEFAULT_PACKAGES:=base-files libc libgcc busybox dropbear mtd uci opkg netifd fstools uclient-fetch logd default-settings luci luci-app-aliddns luci-app-upnp luci-app-adbyby-plus luci-app-autoreboot luci-app-ssr-plus ddns-scripts_aliyun luci-app-vlmcsd luci-app-ramfree luci-app-flowoffload​

​删除ipv6软件包:​

自己动手编译最新OpenWrt稳定版_openwrt_04

将ip6tables,odhcp6c,odhpcd-ipv6only 删除,将dnsmasq改为:dnsmasq-full

自己动手编译最新OpenWrt稳定版_openwrt_05

添加所需软件包:

git clone https://github.com/mchome/openwrt-vlmcsd.git package/vlmcsd

git clone https://github.com/mchome/luci-app-vlmcsd.git package/luci-app-vlmcsd

git clone https://github.com/kenzok8/small-package package/small-package

自己动手编译最新OpenWrt稳定版_openwrt_06

git clone https://github.com/siropboy/sirpdboy-package package/sirpdboy-package

git clone https://github.com/xiaorouji/openwrt-passwall.git  package/passwall

git clone https://github.com/destan19/OpenAppFilter.git package/OpenAppFilter

git clone https://github.com/esirplayground/luci-app-poweroff.git  package/luci-app-poweroff

git clone https://github.com/KimJungWha/default-settings  package/default-settings

vi package/default-settings/files/zzz-default-settings

自己动手编译最新OpenWrt稳定版_openwrt_07

自己动手编译最新OpenWrt稳定版_openwrt_08

自己动手编译最新OpenWrt稳定版_openwrt_09

在编译前指定内核版本号:

#查看Openwrt官方源内核版本:

wget https://downloads.openwrt.org/releases/21.02.2/targets/x86/64/packages/Packages.gz

zgrep -m 1 “Depends: kernel (=.*)$” Packages.gz | sed -e ‘s/.*-\(.*\))/\1/’ > .vermagic

cat .vermagic

自己动手编译最新OpenWrt稳定版_openwrt_10

#取而代之

sed -i -e ‘s/^\(.\).*vermagic$/\1cp $(TOPDIR)\/.vermagic $(LINUX_DIR)\/.vermagic/’ include/kernel-defaults.mk

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

make menuconfig

Target System –>x86

自己动手编译最新OpenWrt稳定版_openwrt_11

Subtarget —> x86_64

自己动手编译最新OpenWrt稳定版_openwrt_12

自己动手编译最新OpenWrt稳定版_openwrt_13

自己动手编译最新OpenWrt稳定版_openwrt_14

自己动手编译最新OpenWrt稳定版_openwrt_15

取消IPv6 支持:

自己动手编译最新OpenWrt稳定版_openwrt_16

选择支持vmxnet3驱动,Kernel Module–>Network Devices:

自己动手编译最新OpenWrt稳定版_openwrt_17

LuCI 支持中文: LuCI –>2.Modules>Translations

自己动手编译最新OpenWrt稳定版_openwrt_18

自己动手编译最新OpenWrt稳定版_openwrt_19

自己动手编译最新OpenWrt稳定版_openwrt_20

自己动手编译最新OpenWrt稳定版_openwrt_21

自己动手编译最新OpenWrt稳定版_openwrt_22

自己动手编译最新OpenWrt稳定版_openwrt_23

自己动手编译最新OpenWrt稳定版_openwrt_24

make -j8 download V=s 下载dl库(国内请尽量全局科学上网)

输入 make -j1 V=s (-j1 后面是线程数。第一次编译推荐用单线程)即可开始编译你要的固件了。

Compile OpenWrt参考资料:​

​​https://github.com/openwrt/openwrt​​​​​​​​​​​https://github.com/coolsnowwolf/lede​​​​​​​如何编译移植lean的固件到官方固件:​​

​​https://www.bandwh.com/net/38.html​​

​​

科学上网插件:​

​​https://github.com/kenzok8/small-package​​

编译Openwrt固件安装软件内核版本不一致问题解决:​

​​https://www.haiyun.me/archives/1075.html​​

添加部分插件源,例如Helloword,(不需要的可跳过这步)

以下方式二选一

下载仓库方式:命令行输入以下命令”git clone https://github.com/fw876/helloworld.git package/lean/luci-app-ssr-plus”

添加feeds方式:命令行输入以下命令”echo ‘src-git helloworld https://github.com/fw876/helloworld’ >>feeds.conf.default”

cd openwrt

git tag

git checkout v19.07.0

vi include/target.mk

./scripts/feeds update -a

./scripts/feeds install -a

make menuconfig

git clone https://github.com/fw876/helloworld.git package/lean/luci-app-ssr-plus

vi feeds.conf.default

src-git helloworld https://github.com/fw876/helloworld

src-git lienol https://github.com/xiaorouji/openwrt-passwall

git clone -b 19.07 https://github.com/kenzok8/small-package

wget https://downloads.openwrt.org/releases/19.07.8/targets/x86/64/openwrt-19.07.8-x86-64-generic.manifest

#查看Openwrt官方源内核版本:

wget https://downloads.openwrt.org/releases/21.02.2/targets/x86/64/packages/Packages.gz

zgrep -m 1 “Depends: kernel (=.*)$” Packages.gz | sed -e ‘s/.*-\(.*\))/\1/’ > .vermagic

#取而代之

sed -i -e ‘s/^\(.\).*vermagic$/\1cp $(TOPDIR)\/.vermagic $(LINUX_DIR)\/.vermagic/’ include/kernel-defaults.mk

编译后指定内核版本:

sed -i ‘s/eac88df3cb49b94d68ac3bc78be57f95/68143adfcb7fc62a239c4be112fe40de/’ /usr/lib/opkg/status


比丘资源网 » 自己动手编译最新OpenWrt稳定版

发表回复

提供最优质的资源集合

立即查看 了解详情