2023-06-26  2024-09-18    570 字  2 分钟

平台

  • Ubuntu 20.04.6 LTS

编译环境

1sudo apt update -y
2sudo apt full-upgrade -y
3sudo apt install -y ack antlr3 asciidoc autoconf automake autopoint binutils bison build-essential \
4bzip2 ccache cmake cpio curl device-tree-compiler fastjar flex gawk gettext gcc-multilib g++-multilib \
5git gperf haveged help2man intltool libc6-dev-i386 libelf-dev libglib2.0-dev libgmp3-dev libltdl-dev \
6libmpc-dev libmpfr-dev libncurses5-dev libncursesw5-dev libreadline-dev libssl-dev libtool lrzsz \
7mkisofs msmtp nano ninja-build p7zip p7zip-full patch pkgconf python2.7 python3 python3-pyelftools \
8libpython3-dev qemu-utils rsync scons squashfs-tools subversion swig texinfo uglifyjs upx-ucl unzip \
9vim wget xmlto xxd zlib1g-dev

编译OpenWrt

 1# 下载
 2git clone https://github.com/coolsnowwolf/lede && cd lede
 3
 4# 添加其他源
 5echo "src-git kenzo https://github.com/kenzok8/openwrt-packages" >> feeds.conf.default
 6echo "src-git small https://github.com/kenzok8/small" >> feeds.conf.default
 7
 8# 更新源
 9./scripts/feeds update -a
10./scripts/feeds install -a
11
12# 修改默认IP为 10.0.0.2
13sed -i 's/192.168.1.1/172.16.1.1/g' package/base-files/files/bin/config_generate
14
15# 修改默认主机名
16sed -i '/uci commit system/i\uci set system.@system[0].hostname='op'' package/lean/default-settings/files/zzz-default-settings
17
18# 加入编译者信息
19sed -i "s/OpenWrt /Akvicor build $(TZ=UTC-8 date "+%Y.%m.%d") @ OpenWrt /g" package/lean/default-settings/files/zzz-default-settings
20
21# 修改banner
22echo -e "-------------------------------------------\n %D %V, %C\n-------------------------------------------" > package/base-files/files/etc/banner
23
24# 修改IPSec VPN账户名
25sed -i "s/ 'lean'/ 'akvicor'/g" feeds/luci/applications/luci-app-ipsec-vpnd/root/etc/config/ipsec
26
27# 配置
28make menuconfig
29
30# 修改分区大小
31Target Images -> Kernel partition size -> 64
32Target Images -> Root filesystem partition size -> 4096
33
34# 添加编程语言支持
35Languages -> Go -> golang -> on
36
37# 关闭adbyby plus
38LuCI -> 3. Applications -> luci-app-adbyby-plus -> off
39
40# 添加AdguardHome
41LuCI -> 3. Applications -> luci-app-adguardhome -> on
42
43# 添加EQOS
44LuCI -> 3. Applications -> luci-app-eqos -> on
45
46# 添加Passwall代理
47LuCI -> 3. Applications -> luci-app-passwall -> on
48
49# 添加方糖气球 serverchan
50LuCI -> 3. Applications -> luci-app-serverchan -> on
51
52# 添加watchcat
53LuCI -> 3. Applications -> luci-app-watchcat -> on
54
55# 关闭迅雷快鸟
56LuCI -> 3. Applications -> luci-app-xlnetacc -> off
57
58# 关闭zerotier (一个开源VPN服务,但是需要通过第三方网站使用
59LuCI -> 3. Applications -> luci-app-zerotier -> off
60
61# 下载
62make download -j8
63
64# 编译
65screen -S build
66make V=s -j1

在esxi测试

 1# 上传vmdk文件
 2# ssh连接esxi
 3cd /vmfs/volumes/hhd/op
 4ls *.vmdk
 5vmkfstools -i openwrt-x86-64-generic-squashfs-combined-efi.vmdk opd.vmdk
 6vmkfstools -X 5120M opd.vmdk # 需大于源文件大小
 7# 更换op虚拟机的硬盘文件
 8
 9# 配置测试网络
10vim /etc/config/network
11# 修改lan的ip地址
12# 重启网络,通过浏览器访问
13/etc/init.d/network restart

除另有声明外本博客文章均采用 知识共享 (Creative Commons) 署名 4.0 国际许可协议 进行许可转载请注明原作者与文章出处