L23※vps编译 openwrt 系统固件

1> 注意

1. 不要用 root 用户进行编译

2. 默认登陆IP 192.168.1.1 密码 password

2> 编译命令

① 首先装好 Linux 系统,推荐 Debian 11 或 Ubuntu LTS

② 安装编译依赖

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

③ 下载源代码

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

④ 缝合一些其他插件

插件原地址:https://github.com/kenzok8/openwrt-packages;
添加下面代码复制到 lede源码根目录 feeds.conf.default 文件

src-git opentopd  https://github.com/sirpdboy/sirpdboy-package
src-git kenzo https://github.com/kenzok8/openwrt-packages
src-git small https://github.com/kenzok8/small
src-git zerotier https://github.com/mwarning/zerotier-openwrt.git
# 推荐脚本
sed -i '1i src-git kenzo https://github.com/kenzok8/openwrt-packages' feeds.conf.default
sed -i '2i src-git small https://github.com/kenzok8/small' feeds.conf.default
# 脚本添加1
echo 'src-git opentopd  https://github.com/sirpdboy/sirpdboy-package' >> feeds.conf.default
echo 'src-git kenzo https://github.com/kenzok8/openwrt-packages' >> feeds.conf.default
echo 'src-git small https://github.com/kenzok8/small' >> feeds.conf.default
echo 'src-git helloworld https://github.com/fw876/helloworld' >> feeds.conf.default
echo 'src-git passwall https://github.com/xiaorouji/openwrt-passwall' >> feeds.conf.default
# 脚本添加2
cat >> feeds.conf.default <<EOF
src-git opentopd  https://github.com/sirpdboy/sirpdboy-package
src-git kenzo https://github.com/kenzok8/openwrt-packages
src-git small https://github.com/kenzok8/small
src-git helloworld https://github.com/fw876/helloworld
src-git passwall https://github.com/xiaorouji/openwrt-passwall
EOF

⑤ 更新 feeds 并选择配置

./scripts/feeds update -a
./scripts/feeds install -a
make menuconfig
参数R2SGL-MT1300
Target SystemRockchipMediaTek Ralink MiPS
SubtargetRK33xx boards (64 bit)MT7621 based boards
Target ProfileFriendlyARM NanoPi R2sGL.iNet GL-MT1300
Target Imagessquashfs
[*] ext4
[*] squashfs (NEW)
[*] GZip images (NEW)
(128) Kernel partition size (in MB) (NEW)
(512) Root filesystem partition size (in MB) (NEW)

⑥ 下载 dl 库,编译固件 (-j 后面是线程数,第一次编译推荐用单线程)

make download -j8  或 make download V=s -j1
make V=s -j1

3> 二次编译:

cd lede
sed -i '1i src-git kenzo https://github.com/kenzok8/openwrt-packages' feeds.conf.default
sed -i '2i src-git small https://github.com/kenzok8/small' feeds.conf.default
git pull
./scripts/feeds update -a
./scripts/feeds install -a
make defconfig
make download -j8
make V=s -j$(nproc)

4> shell自动编译:

#!/bin/bash

cd /home/ubuntu/lede
git pull
./scripts/feeds update -a
./scripts/feeds install -a
make defconfig
make download -j8
make V=s -j$(nproc)

rm -rf /home/ubuntu/lede/build_dir
rm -rf /home/ubuntu/lede/dl
rm -rf /home/ubuntu/lede/feeds
rm -rf /home/ubuntu/lede/staging_dir
rm -rf /home/ubuntu/lede/tmp
rm -rf /home/ubuntu/lede/bin/targets/rockchip/armv8/packages

编译完成后输出路径:bin/targets

5> 更改 LAN 口的默认 ip 地址

cd lede
vim package/base-files/files/bin/config_generate  # 大概在150行找到我们默认的原IP地址(192.168.1.1)

6> 常用插件

——————————————————————————————-

参数说明
luci-app-accesscontrol访问时间控制
luci-app-adbyby-plus广告屏蔽大师Plus +
luci-app-aliyundrive-webdav阿里云盘 WebDAV 服务
luci-app-argon-configArgon主题设置
luci-app-arpbindIP/MAC绑定
luci-app-autoreboot支持计划重启
luci-app-ddns动态域名 DNS(集成阿里DDNS客户端)
luci-app-eqos根据IP控制网速
luci-app-filetransfer文件传输(可web安装ipk包)
luci-app-firewall添加防火墙
luci-app-frpc内网穿透 Frp
luci-app-nlbwmon网络带宽监视器
luci-app-pushbot微信/钉钉推送
luci-app-ramfree释放内存
luci-app-samba网络共享(Samba)
luci-app-turboaccTurbo ACC 网络加速(支持 Fast Path 或者 硬件 NAT)
luci-app-unblockmusic解锁网易云灰色歌曲3合1新版本
luci-app-upnp通用即插即用UPnP(端口自动转发)
luci-app-vlmcsdKMS服务器设置
luci-app-vsftpdFTP服务器
luci-app-watchcat断网检测功能与定时重启
luci-app-wifischeduleWiFi 计划
luci-app-wireless-regdbWiFi无线
luci-app-wolWOL网络唤醒
luci-app-xlnetacc迅雷快鸟
luci-app-zerotierZeroTier内网穿透

——————————————————————————————-

7> 如何添加SD_Card

① 增加sd card 驱动支持

执行 make menuconfig命令后,修改如下参数:

Kernel modules —> Other modules —>
-*- kmod-sdhci……
<*> kmod-sdhci-mt7620

② 增加语言模块支持

执行 make menuconfig命令后,修改如下参数:

Kernel modules —> Native Language Support
     <*> kmod-nls-cp437
     <*> kmod-nls-iso8859-1
     <*> kmod-nls-utf8

③ 对于增加对ext4和vfat文件系统的支持

# 1、执行 make menuconfig
Kernel modules ->
     Filesystems —>
         <*>kmod-fs-vfat
         <*>kmod-fs-ext4
# 2、执行 make kernel_menuconfig
     File systems —> DOS/FAT/NT Filesystems —>
         <*>VFAT fs support
     File systems —> <*>ext4 fs support

8> 添加sftp

Network->File Transfer->vsftpd
Network->SSH->openssh-sftp-server

9> cannot found -liconv

修改lede/build_dir/target-x86_64_musl/lm-sensors-3-6-0/prog/sensors/Module.mk里面的下述代码

LIBICONV := $(shell if /sbin/ldconfig -p | grep -q '/libiconv\.so$$' ; then echo \-liconv; else echo; fi)
LIBICONV := $(shell if /sbin/ldconfig -p | grep -q '/libiconv\.so$$' ; then echo; else echo; fi)

10> 升级go版本

rm -rf feeds/packages/lang/golang
git clone https://github.com/sbwml/packages_lang_golang -b 23.x feeds/packages/lang/golang

11> 修改更新源

vim /etc/opkg/distfeeds.conf

src/gz openwrt_core https://mirrors.condor.vip/lede/r2s/latest/targets/rockchip/armv8/packages
src/gz openwrt_base https://mirrors.condor.vip/lede/r2s/latest/packages/aarch64_generic/base
src/gz openwrt_kenzo https://mirrors.condor.vip/lede/r2s/latest/packages/aarch64_generic/kenzo
src/gz openwrt_luci https://mirrors.condor.vip/lede/r2s/latest/packages/aarch64_generic/luci
src/gz openwrt_packages https://mirrors.condor.vip/lede/r2s/latest/packages/aarch64_generic/packages
src/gz openwrt_routing https://mirrors.condor.vip/lede/r2s/latest/packages/aarch64_generic/routing
src/gz openwrt_small https://mirrors.condor.vip/lede/r2s/latest/packages/aarch64_generic/small
src/gz openwrt_telephony https://mirrors.condor.vip/lede/r2s/latest/packages/aarch64_generic/telephony
src/gz openwrt_core https://mirrors.condor.vip/lede/x86/latest/targets/x86/64/packages
src/gz openwrt_base https://mirrors.condor.vip/lede/x86/latest/packages/x86_64/base
src/gz openwrt_kenzo https://mirrors.condor.vip/lede/x86/latest/packages/x86_64/kenzo
src/gz openwrt_luci https://mirrors.condor.vip/lede/x86/latest/packages/x86_64/luci
src/gz openwrt_packages https://mirrors.condor.vip/lede/x86/latest/packages/x86_64/packages
src/gz openwrt_routing https://mirrors.condor.vip/lede/x86/latest/packages/x86_64/routing
src/gz openwrt_small https://mirrors.condor.vip/lede/x86/latest/packages/x86_64/small
src/gz openwrt_telephony https://mirrors.condor.vip/lede/x86/latest/packages/x86_64/telephony

12> 更新系统所有软件包

opkg list-upgradable | grep luci- | cut -f 1 -d ' ' | xargs opkg upgrade
opkg list-upgradable | cut -f 1 -d ' ' | xargs opkg upgrade
© 版权声明
THE END
喜欢就支持一下吧
点赞1 分享