From 19c1456a981c3002b2e47d95befdcb33d7ae2107 Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Wed, 5 Nov 2025 10:15:02 +0800 Subject: [PATCH 01/78] Update 00-prepare_base.sh --- scripts/00-prepare_base.sh | 389 +++++++++++++++++++++++++------------ 1 file changed, 260 insertions(+), 129 deletions(-) diff --git a/scripts/00-prepare_base.sh b/scripts/00-prepare_base.sh index 69e10ee..75dcae0 100644 --- a/scripts/00-prepare_base.sh +++ b/scripts/00-prepare_base.sh @@ -4,168 +4,299 @@ # Enable compiler optimizations at O2 level for enhanced performance and efficiency sed -i 's/Os/O2/g' include/target.mk -# Integrates UPX toolchain support for executable compression. -patch -p1 < ../OpenBox/generic-24.10/0001-tools-add-upx-tools.patch +# Rockchip - rkbin & u-boot +rm -rf package/boot/rkbin package/boot/uboot-rockchip package/boot/arm-trusted-firmware-rockchip +git clone -b openwrt-24.10 https://$git_name:$git_password@gitea.kejizero.xyz/zhao/uboot-rockchip package/boot/uboot-rockchip +git clone -b openwrt-24.10 https://$git_name:$git_password@gitea.kejizero.xyz/zhao/arm-trusted-firmware-rockchip package/boot/arm-trusted-firmware-rockchip -# Enables firmware-wide UPX compression for reduced binary footprint. -patch -p1 < ../OpenBox/generic-24.10/0002-rootfs-add-upx-compression-support.patch +# Generic Patch +curl -s $mirror/openwrt/patch/generic-24.10/0001-kernel-update-Config-kernel.in-for-Linux-6.12-support.patch | patch -p1 +curl -s $mirror/openwrt/patch/generic-24.10/0001-tools-add-upx-tools.patch | patch -p1 +curl -s $mirror/openwrt/patch/generic-24.10/0002-rootfs-add-upx-compression-support.patch | patch -p1 +curl -s $mirror/openwrt/patch/generic-24.10/0003-rootfs-add-r-w-permissions-for-UCI-configuration-fil.patch | patch -p1 +curl -s $mirror/openwrt/patch/generic-24.10/0004-rootfs-Add-support-for-local-kmod-installation-sourc.patch | patch -p1 +curl -s $mirror/openwrt/patch/generic-24.10/0013-kernel-add-olddefconfig-before-compilemodules.patch | patch -p1 -# Grants persistent read/write access to UCI config files. -patch -p1 < ../OpenBox/generic-24.10/0003-rootfs-add-r-w-permissions-for-UCI-configuration-fil.patch +# Dwarves 1.25 +rm -rf tools/dwarves +git clone https://$github/sbwml/tools_dwarves tools/dwarves -# Facilitates local kmod installation from custom sources. -patch -p1 < ../OpenBox/generic-24.10/0004-rootfs-Add-support-for-local-kmod-installation-sourc.patch +# X86 - disable mitigations +sed -i 's/noinitrd/noinitrd mitigations=off/g' target/linux/x86/image/grub-efi.cfg -# Kernel Vermagic Handling(Extracts the HASH from kernel metadata, computes its MD5 checksum,and stores it in the .vermagic file to ensure build consistency and module compatibility) -sed -ie 's/^\(.\).*vermagic$/\1cp $(TOPDIR)\/.vermagic $(LINUX_DIR)\/.vermagic/' include/kernel-defaults.mk -grep HASH include/kernel-6.6 | awk -F'HASH-' '{print $2}' | awk '{print $1}' | md5sum | awk '{print $1}' > .vermagic - -# Kernel Version Configuration: apply a specific video module patch to the kernel source to enhance multimedia support -cp -rf ../OpenBox/kernel-6.6/kernel/0001-linux-module-video.patch ./package/0001-linux-module-video.patch -git apply package/0001-linux-module-video.patch -rm -rf package/0001-linux-module-video.patch - -# Rust Build Fix: disable CI LLVM to prevent compilation errors -sed -i 's/ci-llvm=true/ci-llvm=false/g' feeds/packages/lang/rust/Makefile - -### FW4 ### -# Integrate custom Firewall4 with extended nft command support -cp -rf ../OpenBox/firewall4/Makefile ./package/network/config/firewall4/Makefile -sed -i 's|$(PROJECT_GIT)/project|https://github.com/openwrt|g' package/network/config/firewall4/Makefile -mkdir -p package/network/config/firewall4/patches -patch -p1 < ../OpenBox/firewall4/100-openwrt-firewall4-add-custom-nft-command-support.patch -cp -rf ../OpenBox/firewall4/firewall4_patches package/network/config/firewall4/patches/ - -# libnftnl patches -# Apply required patches to libnftnl library to enhance nftables functionality -mkdir -p package/libs/libnftnl/patches -cp -f ../OpenBox/firewall4/libnftnl/*.patch ./package/libs/libnftnl/patches/ - -# nftables patches -# Integrate customized nftables patches for improved firewall capabilities -mkdir -p package/network/utils/nftables/patches -cp -f ../OpenBox/firewall4/nftables/*.patch ./package/network/utils/nftables/patches/ - -# Kernel patches -# Apply architecture-specific and network kernel patches for optimized performance -cp -f ../OpenBox/kernel-6.6/btf/*.patch ./target/linux/generic/hack-6.6/ -cp -f ../OpenBox/kernel-6.6/arm/*.patch ./target/linux/generic/hack-6.6/ -cp -f ../OpenBox/kernel-6.6/net/*.patch ./target/linux/generic/hack-6.6/ - -# FullCone NAT module -# Clone the FullCone NAT module for enhanced network address translation -git clone https://git.cooluc.com/sbwml/nft-fullcone package/new/nft-fullcone - -# IPv6 NAT support -# Integrate IPv6 NAT packages for dual-stack environments -git clone https://github.com/sbwml/packages_new_nat6 package/new/nat6 - -# Natflow support -# Integrate Natflow for dynamic network flow management -git clone https://github.com/sbwml/package_new_natflow package/new/natflow - -# Shortcut Forwarding Engine -# Include Shortcut Forwarding Engine to accelerate packet forwarding -git clone https://git.cooluc.com/sbwml/shortcut-fe package/new/shortcut-fe - -# BBRv3 congestion control -# Apply BBRv3 kernel backports for improved network throughput and latency -cp -rf ../OpenBox/kernel-6.6/bbr3/* ./target/linux/generic/backport-6.6/ - -# LRNG (Linux Random Number Generator) -# Apply LRNG kernel patches and enable secure random number generation features -cp -rf ../OpenBox/kernel-6.6/lrng/* ./target/linux/generic/hack-6.6/ -echo ' -# CONFIG_RANDOM_DEFAULT_IMPL is not set -CONFIG_LRNG=y -CONFIG_LRNG_DEV_IF=y -# CONFIG_LRNG_IRQ is not set -CONFIG_LRNG_JENT=y -CONFIG_LRNG_CPU=y -# CONFIG_LRNG_SCHED is not set -CONFIG_LRNG_SELFTEST=y -# CONFIG_LRNG_SELFTEST_PANIC is not set -' >>./target/linux/generic/config-6.6 - -# Kernel PPP performance patches -wget https://github.com/torvalds/linux/commit/95d0d094ba26432ec467e2260f4bf553053f1f8f.patch -O target/linux/generic/pending-6.6/999-1-95d0d09.patch -wget https://github.com/torvalds/linux/commit/1a3e9b7a6b09e8ab3d2af019e4a392622685855e.patch -O target/linux/generic/pending-6.6/999-2-1a3e9b7.patch -wget https://github.com/torvalds/linux/commit/7eebd219feda99df8292a97faff895a5da8159d6.patch -O target/linux/generic/pending-6.6/999-3-7eebd21.patch - -# PPP fix applied directly from ImmortalWrt upstream commit -wget -qO - https://github.com/immortalwrt/immortalwrt/commit/9d852a05bd50b1c332301eecbcac1fa71be637d6.patch | patch -p1 - -### Other Kernel Hacks ### -# Apply the kernel default configuration for enhanced stability and consistency -patch -p1 < ../OpenBox/kernel-6.6/kernel/0003-include-kernel-defaults.mk.patch - -# Apply IGC network driver fixes to ensure reliable Ethernet performance -cp -rf ../OpenBox/kernel-6.6/igc-fix/* ./target/linux/x86/patches-6.6/ - -# Apply BTF (BPF Type Format) enhancements to improve kernel introspection and debugging -cp -rf ../OpenBox/kernel-6.6/btf/* ./target/linux/generic/hack-6.6/ - -### Personalized modifications ### -# Update LAN gateway, branding, and banner to custom ZeroWrt settings +# Default LAN IP sed -i "s/192.168.1.1/10.0.0.1/g" package/base-files/files/bin/config_generate +# Default Hostname sed -i 's/OpenWrt/ZeroWrt/' package/base-files/files/bin/config_generate -cp -rf ../OpenBox/doc/base-files/etc/banner ./package/base-files/files/etc/banner +# Default Password +default_password=$(openssl passwd -5 password) +sed -i "s|^root:[^:]*:|root:${default_password}:|" package/base-files/files/etc/shadow -# Luci modules enhancements for Firewall, NAT, and FullCone support +# Use nginx instead of uhttpd +sed -i 's/+uhttpd /+luci-nginx /g' feeds/luci/collections/luci/Makefile +sed -i 's/+uhttpd-mod-ubus //' feeds/luci/collections/luci/Makefile +sed -i 's/+uhttpd /+luci-nginx /g' feeds/luci/collections/luci-light/Makefile +sed -i "s/+luci /+luci-nginx /g" feeds/luci/collections/luci-ssl-openssl/Makefile +sed -i "s/+luci /+luci-nginx /g" feeds/luci/collections/luci-ssl/Makefile +sed -i 's/+uhttpd +uhttpd-mod-ubus /+luci-nginx /g' feeds/packages/net/wg-installer/Makefile +sed -i '/uhttpd-mod-ubus/d' feeds/luci/collections/luci-light/Makefile +sed -i 's/+luci-nginx \\$/+luci-nginx/' feeds/luci/collections/luci-light/Makefile + +# Libubox +sed -i '/TARGET_CFLAGS/ s/$/ -Os/' package/libs/libubox/Makefile + +# Fstools +rm -rf package/system/fstools +git clone https://$github/sbwml/package_system_fstools -b openwrt-24.10 package/system/fstools + +# Util-linux +rm -rf package/utils/util-linux +git clone https://$gitea/zhao/package_utils_util-linux -b openwrt-24.10 package/utils/util-linux + +# Shortcut Forwarding Engine +git clone https://$gitea/zhao/shortcut-fe package/new/shortcut-fe + +### Patch FireWall 4 ### +# firewall4 +sed -i 's|$(PROJECT_GIT)/project|https://github.com/openwrt|g' package/network/config/firewall4/Makefile +mkdir -p package/network/config/firewall4/patches +# fix ct status dnat +curl -s $mirror/openwrt/patch/firewall4/firewall4_patches/990-unconditionally-allow-ct-status-dnat.patch > package/network/config/firewall4/patches/990-unconditionally-allow-ct-status-dnat.patch +# fullcone +curl -s $mirror/openwrt/patch/firewall4/firewall4_patches/999-01-firewall4-add-fullcone-support.patch > package/network/config/firewall4/patches/999-01-firewall4-add-fullcone-support.patch +# bcm fullcone +curl -s $mirror/openwrt/patch/firewall4/firewall4_patches/999-02-firewall4-add-bcm-fullconenat-support.patch > package/network/config/firewall4/patches/999-02-firewall4-add-bcm-fullconenat-support.patch +# kernel version +curl -s $mirror/openwrt/patch/firewall4/firewall4_patches/002-fix-fw4.uc-adept-kernel-version-type-of-x.x.patch > package/network/config/firewall4/patches/002-fix-fw4.uc-adept-kernel-version-type-of-x.x.patch +# fix flow offload +curl -s $mirror/openwrt/patch/firewall4/firewall4_patches/001-fix-fw4-flow-offload.patch > package/network/config/firewall4/patches/001-fix-fw4-flow-offload.patch +# add custom nft command support +curl -s $mirror/openwrt/patch/firewall4/100-openwrt-firewall4-add-custom-nft-command-support.patch | patch -p1 +# libnftnl +mkdir -p package/libs/libnftnl/patches +curl -s $mirror/openwrt/patch/firewall4/libnftnl/0001-libnftnl-add-fullcone-expression-support.patch > package/libs/libnftnl/patches/0001-libnftnl-add-fullcone-expression-support.patch +curl -s $mirror/openwrt/patch/firewall4/libnftnl/0002-libnftnl-add-brcm-fullcone-support.patch > package/libs/libnftnl/patches/0002-libnftnl-add-brcm-fullcone-support.patch +# nftables +mkdir -p package/network/utils/nftables/patches +curl -s $mirror/openwrt/patch/firewall4/nftables/0001-nftables-add-fullcone-expression-support.patch > package/network/utils/nftables/patches/0001-nftables-add-fullcone-expression-support.patch +curl -s $mirror/openwrt/patch/firewall4/nftables/0002-nftables-add-brcm-fullconenat-support.patch > package/network/utils/nftables/patches/0002-nftables-add-brcm-fullconenat-support.patch +curl -s $mirror/openwrt/patch/firewall4/nftables/0003-drop-rej-file.patch > package/network/utils/nftables/patches/0003-drop-rej-file.patch + +# FullCone module +git clone https://$gitea/zhao/nft-fullcone package/new/nft-fullcone + +# IPv6 NAT +git clone https://$github/sbwml/packages_new_nat6 package/new/nat6 + +# natflow +git clone https://$github/sbwml/package_new_natflow package/new/natflow + +# Patch Luci add nft_fullcone/bcm_fullcone & shortcut-fe & natflow & ipv6-nat & custom nft command option pushd feeds/luci -patch -p1 <../../../OpenBox/firewall4/luci-24.10/0001-luci-app-firewall-add-nft-fullcone-and-bcm-fullcone-.patch -patch -p1 <../../../OpenBox/firewall4/luci-24.10/0002-luci-app-firewall-add-shortcut-fe-option.patch -patch -p1 <../../../OpenBox/firewall4/luci-24.10/0003-luci-app-firewall-add-ipv6-nat-option.patch -patch -p1 <../../../OpenBox/firewall4/luci-24.10/0004-luci-add-firewall-add-custom-nft-rule-support.patch -patch -p1 <../../../OpenBox/firewall4/luci-24.10/0005-luci-app-firewall-add-natflow-offload-support.patch -patch -p1 <../../../OpenBox/firewall4/luci-24.10/0006-luci-app-firewall-enable-hardware-offload-only-on-de.patch -patch -p1 <../../../OpenBox/firewall4/luci-24.10/0007-luci-app-firewall-add-fullcone6-option-for-nftables-.patch + curl -s $mirror/openwrt/patch/firewall4/luci-24.10/0001-luci-app-firewall-add-nft-fullcone-and-bcm-fullcone-.patch | patch -p1 + curl -s $mirror/openwrt/patch/firewall4/luci-24.10/0002-luci-app-firewall-add-shortcut-fe-option.patch | patch -p1 + curl -s $mirror/openwrt/patch/firewall4/luci-24.10/0003-luci-app-firewall-add-ipv6-nat-option.patch | patch -p1 + curl -s $mirror/openwrt/patch/firewall4/luci-24.10/0004-luci-add-firewall-add-custom-nft-rule-support.patch | patch -p1 + curl -s $mirror/openwrt/patch/firewall4/luci-24.10/0005-luci-app-firewall-add-natflow-offload-support.patch | patch -p1 + curl -s $mirror/openwrt/patch/firewall4/luci-24.10/0006-luci-app-firewall-enable-hardware-offload-only-on-de.patch | patch -p1 + curl -s $mirror/openwrt/patch/firewall4/luci-24.10/0007-luci-app-firewall-add-fullcone6-option-for-nftables-.patch | patch -p1 popd -# Additional Luci enhancements for system status, modal dialogs, and storage display optimizations -pushd feeds/luci -patch -p1 <../../../OpenBox/luci/0001-luci-mod-system-add-modal-overlay-dialog-to-reboot.patch -patch -p1 <../../../OpenBox/luci/0002-luci-mod-status-displays-actual-process-memory-usage.patch -patch -p1 <../../../OpenBox/luci/0003-luci-mod-status-storage-index-applicable-only-to-val.patch -patch -p1 <../../../OpenBox/luci/0004-luci-mod-status-firewall-disable-legacy-firewall-rul.patch -patch -p1 <../../../OpenBox/luci/0005-luci-mod-system-add-refresh-interval-setting.patch -patch -p1 <../../../OpenBox/luci/0006-luci-mod-system-mounts-add-docker-directory-mount-po.patch -patch -p1 <../../../OpenBox/luci/0007-luci-mod-system-add-ucitrack-luci-mod-system-zram.js.patch +# openssl +OPENSSL_VERSION=3.0.17 +OPENSSL_HASH=dfdd77e4ea1b57ff3a6dbde6b0bdc3f31db5ac99e7fdd4eaf9e1fbb6ec2db8ce +sed -ri "s/(PKG_VERSION:=)[^\"]*/\1$OPENSSL_VERSION/;s/(PKG_HASH:=)[^\"]*/\1$OPENSSL_HASH/" package/libs/openssl/Makefile + +# openssl - quictls +pushd package/libs/openssl/patches + curl -sO $mirror/openwrt/patch/openssl/quic/0001-QUIC-Add-support-for-BoringSSL-QUIC-APIs.patch + curl -sO $mirror/openwrt/patch/openssl/quic/0002-QUIC-New-method-to-get-QUIC-secret-length.patch + curl -sO $mirror/openwrt/patch/openssl/quic/0003-QUIC-Make-temp-secret-names-less-confusing.patch + curl -sO $mirror/openwrt/patch/openssl/quic/0004-QUIC-Move-QUIC-transport-params-to-encrypted-extensi.patch + curl -sO $mirror/openwrt/patch/openssl/quic/0005-QUIC-Use-proper-secrets-for-handshake.patch + curl -sO $mirror/openwrt/patch/openssl/quic/0006-QUIC-Handle-partial-handshake-messages.patch + curl -sO $mirror/openwrt/patch/openssl/quic/0007-QUIC-Fix-quic_transport-constructors-parsers.patch + curl -sO $mirror/openwrt/patch/openssl/quic/0008-QUIC-Reset-init-state-in-SSL_process_quic_post_hands.patch + curl -sO $mirror/openwrt/patch/openssl/quic/0009-QUIC-Don-t-process-an-incomplete-message.patch + curl -sO $mirror/openwrt/patch/openssl/quic/0010-QUIC-Quick-fix-s2c-to-c2s-for-early-secret.patch + curl -sO $mirror/openwrt/patch/openssl/quic/0011-QUIC-Add-client-early-traffic-secret-storage.patch + curl -sO $mirror/openwrt/patch/openssl/quic/0012-QUIC-Add-OPENSSL_NO_QUIC-wrapper.patch + curl -sO $mirror/openwrt/patch/openssl/quic/0013-QUIC-Correctly-disable-middlebox-compat.patch + curl -sO $mirror/openwrt/patch/openssl/quic/0014-QUIC-Move-QUIC-code-out-of-tls13_change_cipher_state.patch + curl -sO $mirror/openwrt/patch/openssl/quic/0015-QUIC-Tweeks-to-quic_change_cipher_state.patch + curl -sO $mirror/openwrt/patch/openssl/quic/0016-QUIC-Add-support-for-more-secrets.patch + curl -sO $mirror/openwrt/patch/openssl/quic/0017-QUIC-Fix-resumption-secret.patch + curl -sO $mirror/openwrt/patch/openssl/quic/0018-QUIC-Handle-EndOfEarlyData-and-MaxEarlyData.patch + curl -sO $mirror/openwrt/patch/openssl/quic/0019-QUIC-Fall-through-for-0RTT.patch + curl -sO $mirror/openwrt/patch/openssl/quic/0020-QUIC-Some-cleanup-for-the-main-QUIC-changes.patch + curl -sO $mirror/openwrt/patch/openssl/quic/0021-QUIC-Prevent-KeyUpdate-for-QUIC.patch + curl -sO $mirror/openwrt/patch/openssl/quic/0022-QUIC-Test-KeyUpdate-rejection.patch + curl -sO $mirror/openwrt/patch/openssl/quic/0023-QUIC-Buffer-all-provided-quic-data.patch + curl -sO $mirror/openwrt/patch/openssl/quic/0024-QUIC-Enforce-consistent-encryption-level-for-handsha.patch + curl -sO $mirror/openwrt/patch/openssl/quic/0025-QUIC-add-v1-quic_transport_parameters.patch + curl -sO $mirror/openwrt/patch/openssl/quic/0026-QUIC-return-success-when-no-post-handshake-data.patch + curl -sO $mirror/openwrt/patch/openssl/quic/0027-QUIC-__owur-makes-no-sense-for-void-return-values.patch + curl -sO $mirror/openwrt/patch/openssl/quic/0028-QUIC-remove-SSL_R_BAD_DATA_LENGTH-unused.patch + curl -sO $mirror/openwrt/patch/openssl/quic/0029-QUIC-SSLerr-ERR_raise-ERR_LIB_SSL.patch + curl -sO $mirror/openwrt/patch/openssl/quic/0030-QUIC-Add-compile-run-time-checking-for-QUIC.patch + curl -sO $mirror/openwrt/patch/openssl/quic/0031-QUIC-Add-early-data-support.patch + curl -sO $mirror/openwrt/patch/openssl/quic/0032-QUIC-Make-SSL_provide_quic_data-accept-0-length-data.patch + curl -sO $mirror/openwrt/patch/openssl/quic/0033-QUIC-Process-multiple-post-handshake-messages-in-a-s.patch + curl -sO $mirror/openwrt/patch/openssl/quic/0034-QUIC-Fix-CI.patch + curl -sO $mirror/openwrt/patch/openssl/quic/0035-QUIC-Break-up-header-body-processing.patch + curl -sO $mirror/openwrt/patch/openssl/quic/0036-QUIC-Don-t-muck-with-FIPS-checksums.patch + curl -sO $mirror/openwrt/patch/openssl/quic/0037-QUIC-Update-RFC-references.patch + curl -sO $mirror/openwrt/patch/openssl/quic/0038-QUIC-revert-white-space-change.patch + curl -sO $mirror/openwrt/patch/openssl/quic/0039-QUIC-use-SSL_IS_QUIC-in-more-places.patch + curl -sO $mirror/openwrt/patch/openssl/quic/0040-QUIC-Error-when-non-empty-session_id-in-CH.patch + curl -sO $mirror/openwrt/patch/openssl/quic/0041-QUIC-Update-SSL_clear-to-clear-quic-data.patch + curl -sO $mirror/openwrt/patch/openssl/quic/0042-QUIC-Better-SSL_clear.patch + curl -sO $mirror/openwrt/patch/openssl/quic/0043-QUIC-Fix-extension-test.patch + curl -sO $mirror/openwrt/patch/openssl/quic/0044-QUIC-Update-metadata-version.patch popd -# OPKG patches integration -mkdir -p package/system/opkg/patches -cp -rf ../OpenBox/opkg/* ./package/system/opkg/patches/ +# openssl benchmarks +pushd package/libs/openssl/patches + curl -sO $mirror/openwrt/patch/openssl/901-Revert-speed-Pass-IV-to-EVP_CipherInit_ex-for-evp-ru.patch + curl -sO $mirror/openwrt/patch/openssl/902-Revert-apps-speed.c-Fix-the-benchmarking-for-AEAD-ci.patch +popd -# TTYD menu and logging enhancements +# openssl urandom +sed -i "/-openwrt/iOPENSSL_OPTIONS += enable-ktls '-DDEVRANDOM=\"\\\\\"/dev/urandom\\\\\"\"\'\n" package/libs/openssl/Makefile + +# nghttp3 +rm -rf feeds/packages/libs/nghttp3 +git clone https://$github/sbwml/package_libs_nghttp3 package/libs/nghttp3 + +# ngtcp2 +rm -rf feeds/packages/libs/ngtcp2 +git clone https://$github/sbwml/package_libs_ngtcp2 package/libs/ngtcp2 + +# curl - fix passwall `time_pretransfer` check +rm -rf feeds/packages/net/curl +git clone https://$github/sbwml/feeds_packages_net_curl feeds/packages/net/curl + +# Docker +rm -rf feeds/luci/applications/luci-app-dockerman +git clone https://$gitea/zhao/luci-app-dockerman -b openwrt-24.10 feeds/luci/applications/luci-app-dockerman +rm -rf feeds/packages/utils/{docker,dockerd,containerd,runc} +git clone https://$github/sbwml/packages_utils_docker feeds/packages/utils/docker +git clone https://$github/sbwml/packages_utils_dockerd feeds/packages/utils/dockerd +git clone https://$github/sbwml/packages_utils_containerd feeds/packages/utils/containerd +git clone https://$github/sbwml/packages_utils_runc feeds/packages/utils/runc + +# cgroupfs-mount +# fix unmount hierarchical mount +pushd feeds/packages + curl -s $mirror/openwrt/patch/cgroupfs-mount/0001-fix-cgroupfs-mount.patch | patch -p1 +popd +# mount cgroup v2 hierarchy to /sys/fs/cgroup/cgroup2 +mkdir -p feeds/packages/utils/cgroupfs-mount/patches +curl -s $mirror/openwrt/patch/cgroupfs-mount/900-mount-cgroup-v2-hierarchy-to-sys-fs-cgroup-cgroup2.patch > feeds/packages/utils/cgroupfs-mount/patches/900-mount-cgroup-v2-hierarchy-to-sys-fs-cgroup-cgroup2.patch +curl -s $mirror/openwrt/patch/cgroupfs-mount/901-fix-cgroupfs-umount.patch > feeds/packages/utils/cgroupfs-mount/patches/901-fix-cgroupfs-umount.patch +# docker systemd support +curl -s $mirror/openwrt/patch/cgroupfs-mount/902-mount-sys-fs-cgroup-systemd-for-docker-systemd-suppo.patch > feeds/packages/utils/cgroupfs-mount/patches/902-mount-sys-fs-cgroup-systemd-for-docker-systemd-suppo.patch + +# procps-ng - top +sed -i 's/enable-skill/enable-skill --disable-modern-top/g' feeds/packages/utils/procps-ng/Makefile + +# TTYD sed -i 's/services/system/g' feeds/luci/applications/luci-app-ttyd/root/usr/share/luci/menu.d/luci-app-ttyd.json sed -i '3 a\\t\t"order": 50,' feeds/luci/applications/luci-app-ttyd/root/usr/share/luci/menu.d/luci-app-ttyd.json sed -i 's/procd_set_param stdout 1/procd_set_param stdout 0/g' feeds/packages/utils/ttyd/files/ttyd.init sed -i 's/procd_set_param stderr 1/procd_set_param stderr 0/g' feeds/packages/utils/ttyd/files/ttyd.init -# Shell profile and PATH customization for enhanced UX +# UPnP +rm -rf feeds/{packages/net/miniupnpd,luci/applications/luci-app-upnp} +git clone https://$gitea/zhao/miniupnpd feeds/packages/net/miniupnpd -b v2.3.9 +git clone https://$gitea/zhao/luci-app-upnp feeds/luci/applications/luci-app-upnp -b openwrt-24.10 + +# nginx - latest version +rm -rf feeds/packages/net/nginx +git clone https://$github/sbwml/feeds_packages_net_nginx feeds/packages/net/nginx -b openwrt-24.10 +sed -i 's/procd_set_param stdout 1/procd_set_param stdout 0/g;s/procd_set_param stderr 1/procd_set_param stderr 0/g' feeds/packages/net/nginx/files/nginx.init + +# nginx - ubus +sed -i 's/ubus_parallel_req 2/ubus_parallel_req 6/g' feeds/packages/net/nginx/files-luci-support/60_nginx-luci-support +sed -i '/ubus_parallel_req/a\ ubus_script_timeout 300;' feeds/packages/net/nginx/files-luci-support/60_nginx-luci-support + +# nginx - config +curl -s $mirror/openwrt/nginx/luci.locations > feeds/packages/net/nginx/files-luci-support/luci.locations +curl -s $mirror/openwrt/nginx/uci.conf.template > feeds/packages/net/nginx-util/files/uci.conf.template + +# opkg +mkdir -p package/system/opkg/patches +curl -s $mirror/openwrt/patch/opkg/900-opkg-download-disable-hsts.patch > package/system/opkg/patches/900-opkg-download-disable-hsts.patch +curl -s $mirror/openwrt/patch/opkg/901-libopkg-opkg_install-copy-conffiles-to-the-system-co.patch > package/system/opkg/patches/901-libopkg-opkg_install-copy-conffiles-to-the-system-co.patch + +# uwsgi - fix timeout +sed -i '$a cgi-timeout = 600' feeds/packages/net/uwsgi/files-luci-support/luci-*.ini +sed -i '/limit-as/c\limit-as = 5000' feeds/packages/net/uwsgi/files-luci-support/luci-webui.ini +# disable error log +sed -i "s/procd_set_param stderr 1/procd_set_param stderr 0/g" feeds/packages/net/uwsgi/files/uwsgi.init + +# uwsgi - performance +sed -i 's/threads = 1/threads = 2/g' feeds/packages/net/uwsgi/files-luci-support/luci-webui.ini +sed -i 's/processes = 3/processes = 4/g' feeds/packages/net/uwsgi/files-luci-support/luci-webui.ini +sed -i 's/cheaper = 1/cheaper = 2/g' feeds/packages/net/uwsgi/files-luci-support/luci-webui.ini + +# rpcd - fix timeout +sed -i 's/option timeout 30/option timeout 60/g' package/system/rpcd/files/rpcd.config +sed -i 's#20) \* 1000#60) \* 1000#g' feeds/luci/modules/luci-base/htdocs/luci-static/resources/rpc.js + +# luci-mod extra +pushd feeds/luci + curl -s $mirror/openwrt/patch/luci/0001-luci-mod-system-add-modal-overlay-dialog-to-reboot.patch | patch -p1 + curl -s $mirror/openwrt/patch/luci/0002-luci-mod-status-displays-actual-process-memory-usage.patch | patch -p1 + curl -s $mirror/openwrt/patch/luci/0003-luci-mod-status-storage-index-applicable-only-to-val.patch | patch -p1 + curl -s $mirror/openwrt/patch/luci/0004-luci-mod-status-firewall-disable-legacy-firewall-rul.patch | patch -p1 + curl -s $mirror/openwrt/patch/luci/0005-luci-mod-system-add-refresh-interval-setting.patch | patch -p1 + curl -s $mirror/openwrt/patch/luci/0006-luci-mod-system-mounts-add-docker-directory-mount-po.patch | patch -p1 + curl -s $mirror/openwrt/patch/luci/0007-luci-mod-system-add-ucitrack-luci-mod-system-zram.js.patch | patch -p1 +popd + +# Luci diagnostics.js +sed -i "s/openwrt.org/www.qq.com/g" feeds/luci/modules/luci-mod-network/htdocs/luci-static/resources/view/network/diagnostics.js + +# luci-compat - remove extra line breaks from description +sed -i '/
/d' feeds/luci/modules/luci-compat/luasrc/view/cbi/full_valuefooter.htm + +# urngd - 2020-01-21 +rm -rf package/system/urngd +git clone https://$github/sbwml/package_system_urngd package/system/urngd + +# zlib - 1.3 +ZLIB_VERSION=1.3.1 +ZLIB_HASH=38ef96b8dfe510d42707d9c781877914792541133e1870841463bfa73f883e32 +sed -ri "s/(PKG_VERSION:=)[^\"]*/\1$ZLIB_VERSION/;s/(PKG_HASH:=)[^\"]*/\1$ZLIB_HASH/" package/libs/zlib/Makefile + +# profile sed -i 's#\\u@\\h:\\w\\\$#\\[\\e[32;1m\\][\\u@\\h\\[\\e[0m\\] \\[\\033[01;34m\\]\\W\\[\\033[00m\\]\\[\\e[32;1m\\]]\\[\\e[0m\\]\\\$#g' package/base-files/files/etc/profile sed -ri 's/(export PATH=")[^"]*/\1%PATH%:\/opt\/bin:\/opt\/sbin:\/opt\/usr\/bin:\/opt\/usr\/sbin/' package/base-files/files/etc/profile sed -i '/ENV/i\export TERM=xterm-color' package/base-files/files/etc/profile -# Default shell set to bash with HISTCONTROL optimization +# bash sed -i 's#ash#bash#g' package/base-files/files/etc/passwd sed -i '\#export ENV=/etc/shinit#a export HISTCONTROL=ignoredups' package/base-files/files/etc/profile +mkdir -p files/root +curl -so files/root/.bash_profile $mirror/openwrt/files/root/.bash_profile +curl -so files/root/.bashrc $mirror/openwrt/files/root/.bashrc -# Copy custom files with execution permissions -mkdir files -cp -rf ../OpenBox/files/* ./files/ -chmod -R +x files +# rootfs files +mkdir -p files/etc/sysctl.d +curl -so files/etc/sysctl.d/10-default.conf $mirror/openwrt/files/etc/sysctl.d/10-default.conf +curl -so files/etc/sysctl.d/15-vm-swappiness.conf $mirror/openwrt/files/etc/sysctl.d/15-vm-swappiness.conf +curl -so files/etc/sysctl.d/16-udp-buffer-size.conf $mirror/openwrt/files/etc/sysctl.d/16-udp-buffer-size.conf -# NTP server customization for faster and more reliable time sync +# NTP sed -i 's/0.openwrt.pool.ntp.org/ntp1.aliyun.com/g' package/base-files/files/bin/config_generate sed -i 's/1.openwrt.pool.ntp.org/ntp2.aliyun.com/g' package/base-files/files/bin/config_generate sed -i 's/2.openwrt.pool.ntp.org/time1.cloud.tencent.com/g' package/base-files/files/bin/config_generate sed -i 's/3.openwrt.pool.ntp.org/time2.cloud.tencent.com/g' package/base-files/files/bin/config_generate -# Luci-theme-bootstrap font-size enhancement for better readability +# luci-theme-bootstrap sed -i 's/font-size: 13px/font-size: 14px/g' feeds/luci/themes/luci-theme-bootstrap/htdocs/luci-static/bootstrap/cascade.css sed -i 's/9.75px/10.75px/g' feeds/luci/themes/luci-theme-bootstrap/htdocs/luci-static/bootstrap/cascade.css From 7297589851267c52a4df974b112c85d381ced821 Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Wed, 5 Nov 2025 10:17:13 +0800 Subject: [PATCH 02/78] Create 01-prepare_base-mainline.sh --- scripts/01-prepare_base-mainline.sh | 171 ++++++++++++++++++++++++++++ 1 file changed, 171 insertions(+) create mode 100644 scripts/01-prepare_base-mainline.sh diff --git a/scripts/01-prepare_base-mainline.sh b/scripts/01-prepare_base-mainline.sh new file mode 100644 index 0000000..1e8b212 --- /dev/null +++ b/scripts/01-prepare_base-mainline.sh @@ -0,0 +1,171 @@ +#!/bin/bash -e + +# autocore +git clone https://$github/sbwml/autocore-arm -b openwrt-24.10 package/system/autocore + +# rockchip - target - 6.12 +rm -rf target/linux/rockchip +git clone -b openwrt-24.10 https://$git_name:$git_password@$gitea/zhao/target_linux_rockchip target/linux/rockchip + +# bpf-headers - 6.12 +sed -ri "s/(PKG_PATCHVER:=)[^\"]*/\16.12/" package/kernel/bpf-headers/Makefile + +# x86_64 - target 6.12 +curl -s $mirror/openwrt/patch/openwrt-6.x/x86/64/config-6.12 > target/linux/x86/64/config-6.12 +curl -s $mirror/openwrt/patch/openwrt-6.x/x86/config-6.12 > target/linux/x86/config-6.12 +mkdir -p target/linux/x86/patches-6.12 +curl -s $mirror/openwrt/patch/openwrt-6.x/x86/patches-6.12/100-fix_cs5535_clockevt.patch > target/linux/x86/patches-6.12/100-fix_cs5535_clockevt.patch +curl -s $mirror/openwrt/patch/openwrt-6.x/x86/patches-6.12/103-pcengines_apu6_platform.patch > target/linux/x86/patches-6.12/103-pcengines_apu6_platform.patch +# x86_64 - target +sed -ri "s/(KERNEL_PATCHVER:=)[^\"]*/\16.12/" target/linux/x86/Makefile +sed -i '/KERNEL_PATCHVER/a\KERNEL_TESTING_PATCHVER:=6.6' target/linux/x86/Makefile +curl -s $mirror/openwrt/patch/openwrt-6.x/x86/base-files/etc/board.d/01_leds > target/linux/x86/base-files/etc/board.d/01_leds +curl -s $mirror/openwrt/patch/openwrt-6.x/x86/base-files/etc/board.d/02_network > target/linux/x86/base-files/etc/board.d/02_network + +# kernel - 6.12 +curl -s $mirror/tags/kernel-6.12 > include/kernel-6.12 + +# kenrel Vermagic +sed -ie 's/^\(.\).*vermagic$/\1cp $(TOPDIR)\/.vermagic $(LINUX_DIR)\/.vermagic/' include/kernel-defaults.mk +grep HASH include/kernel-6.12 | awk -F'HASH-' '{print $2}' | awk '{print $1}' | md5sum | awk '{print $1}' > .vermagic + +# generic - target - 6.12 +rm -rf target/linux/generic +git clone -b openwrt-24.10 https://$git_name:$git_password@$gitea/zhao/target_linux_generic target/linux/generic + +# kernel modules +rm -rf package/kernel/linux +git checkout package/kernel/linux +pushd package/kernel/linux/modules + rm -f [a-z]*.mk + curl -Os $mirror/openwrt/patch/openwrt-6.x/modules/block.mk + curl -Os $mirror/openwrt/patch/openwrt-6.x/modules/can.mk + curl -Os $mirror/openwrt/patch/openwrt-6.x/modules/crypto.mk + curl -Os $mirror/openwrt/patch/openwrt-6.x/modules/firewire.mk + curl -Os $mirror/openwrt/patch/openwrt-6.x/modules/fs.mk + curl -Os $mirror/openwrt/patch/openwrt-6.x/modules/gpio.mk + curl -Os $mirror/openwrt/patch/openwrt-6.x/modules/hwmon.mk + curl -Os $mirror/openwrt/patch/openwrt-6.x/modules/i2c.mk + curl -Os $mirror/openwrt/patch/openwrt-6.x/modules/iio.mk + curl -Os $mirror/openwrt/patch/openwrt-6.x/modules/input.mk + curl -Os $mirror/openwrt/patch/openwrt-6.x/modules/leds.mk + curl -Os $mirror/openwrt/patch/openwrt-6.x/modules/lib.mk + curl -Os $mirror/openwrt/patch/openwrt-6.x/modules/multiplexer.mk + curl -Os $mirror/openwrt/patch/openwrt-6.x/modules/netdevices.mk + curl -Os $mirror/openwrt/patch/openwrt-6.x/modules/netfilter.mk + curl -Os $mirror/openwrt/patch/openwrt-6.x/modules/netsupport.mk + curl -Os $mirror/openwrt/patch/openwrt-6.x/modules/nls.mk + curl -Os $mirror/openwrt/patch/openwrt-6.x/modules/other.mk + curl -Os $mirror/openwrt/patch/openwrt-6.x/modules/pcmcia.mk + curl -Os $mirror/openwrt/patch/openwrt-6.x/modules/rtc.mk + curl -Os $mirror/openwrt/patch/openwrt-6.x/modules/sound.mk + curl -Os $mirror/openwrt/patch/openwrt-6.x/modules/spi.mk + curl -Os $mirror/openwrt/patch/openwrt-6.x/modules/usb.mk + curl -Os $mirror/openwrt/patch/openwrt-6.x/modules/video.mk + curl -Os $mirror/openwrt/patch/openwrt-6.x/modules/virt.mk + curl -Os $mirror/openwrt/patch/openwrt-6.x/modules/w1.mk + curl -Os $mirror/openwrt/patch/openwrt-6.x/modules/wpan.mk +popd + +# BBRv3 - linux-6.12 +pushd target/linux/generic/backport-6.12 + curl -Os $mirror/openwrt/patch/kernel-6.12/bbr3/010-bbr3-0001-net-tcp_bbr-broaden-app-limited-rate-sample-detectio.patch + curl -Os $mirror/openwrt/patch/kernel-6.12/bbr3/010-bbr3-0002-net-tcp_bbr-v2-shrink-delivered_mstamp-first_tx_msta.patch + curl -Os $mirror/openwrt/patch/kernel-6.12/bbr3/010-bbr3-0003-net-tcp_bbr-v2-snapshot-packets-in-flight-at-transmi.patch + curl -Os $mirror/openwrt/patch/kernel-6.12/bbr3/010-bbr3-0004-net-tcp_bbr-v2-count-packets-lost-over-TCP-rate-samp.patch + curl -Os $mirror/openwrt/patch/kernel-6.12/bbr3/010-bbr3-0005-net-tcp_bbr-v2-export-FLAG_ECE-in-rate_sample.is_ece.patch + curl -Os $mirror/openwrt/patch/kernel-6.12/bbr3/010-bbr3-0006-net-tcp_bbr-v2-introduce-ca_ops-skb_marked_lost-CC-m.patch + curl -Os $mirror/openwrt/patch/kernel-6.12/bbr3/010-bbr3-0007-net-tcp_bbr-v2-adjust-skb-tx.in_flight-upon-merge-in.patch + curl -Os $mirror/openwrt/patch/kernel-6.12/bbr3/010-bbr3-0008-net-tcp_bbr-v2-adjust-skb-tx.in_flight-upon-split-in.patch + curl -Os $mirror/openwrt/patch/kernel-6.12/bbr3/010-bbr3-0009-net-tcp-add-new-ca-opts-flag-TCP_CONG_WANTS_CE_EVENT.patch + curl -Os $mirror/openwrt/patch/kernel-6.12/bbr3/010-bbr3-0010-net-tcp-re-generalize-TSO-sizing-in-TCP-CC-module-AP.patch + curl -Os $mirror/openwrt/patch/kernel-6.12/bbr3/010-bbr3-0011-net-tcp-add-fast_ack_mode-1-skip-rwin-check-in-tcp_f.patch + curl -Os $mirror/openwrt/patch/kernel-6.12/bbr3/010-bbr3-0012-net-tcp_bbr-v2-record-app-limited-status-of-TLP-repa.patch + curl -Os $mirror/openwrt/patch/kernel-6.12/bbr3/010-bbr3-0013-net-tcp_bbr-v2-inform-CC-module-of-losses-repaired-b.patch + curl -Os $mirror/openwrt/patch/kernel-6.12/bbr3/010-bbr3-0014-net-tcp_bbr-v2-introduce-is_acking_tlp_retrans_seq-i.patch + curl -Os $mirror/openwrt/patch/kernel-6.12/bbr3/010-bbr3-0015-tcp-introduce-per-route-feature-RTAX_FEATURE_ECN_LOW.patch + curl -Os $mirror/openwrt/patch/kernel-6.12/bbr3/010-bbr3-0016-net-tcp_bbr-v3-update-TCP-bbr-congestion-control-mod.patch + curl -Os $mirror/openwrt/patch/kernel-6.12/bbr3/010-bbr3-0017-net-tcp_bbr-v3-ensure-ECN-enabled-BBR-flows-set-ECT-.patch + curl -Os $mirror/openwrt/patch/kernel-6.12/bbr3/010-bbr3-0018-tcp-export-TCPI_OPT_ECN_LOW-in-tcp_info-tcpi_options.patch + curl -Os $mirror/openwrt/patch/kernel-6.12/bbr3/010-bbr3-0019-x86-cfi-bpf-Add-tso_segs-and-skb_marked_lost-to-bpf_.patch + curl -Os $mirror/openwrt/patch/kernel-6.12/bbr3/010-bbr3-0020-net-tcp_bbr-v3-silence-Wconstant-logical-operand.patch +popd + +# LRNG - 6.12 +pushd target/linux/generic/hack-6.12 + curl -Os $mirror/openwrt/patch/kernel-6.12/lrng/011-LRNG-0001-LRNG-Entropy-Source-and-DRNG-Manager.patch + curl -Os $mirror/openwrt/patch/kernel-6.12/lrng/011-LRNG-0002-LRNG-allocate-one-DRNG-instance-per-NUMA-node.patch + curl -Os $mirror/openwrt/patch/kernel-6.12/lrng/011-LRNG-0003-LRNG-proc-interface.patch + curl -Os $mirror/openwrt/patch/kernel-6.12/lrng/011-LRNG-0004-LRNG-add-switchable-DRNG-support.patch + curl -Os $mirror/openwrt/patch/kernel-6.12/lrng/011-LRNG-0005-LRNG-add-common-generic-hash-support.patch + curl -Os $mirror/openwrt/patch/kernel-6.12/lrng/011-LRNG-0006-crypto-DRBG-externalize-DRBG-functions-for-LRNG.patch + curl -Os $mirror/openwrt/patch/kernel-6.12/lrng/011-LRNG-0007-LRNG-add-SP800-90A-DRBG-extension.patch + curl -Os $mirror/openwrt/patch/kernel-6.12/lrng/011-LRNG-0008-LRNG-add-kernel-crypto-API-PRNG-extension.patch + curl -Os $mirror/openwrt/patch/kernel-6.12/lrng/011-LRNG-0009-LRNG-add-atomic-DRNG-implementation.patch + curl -Os $mirror/openwrt/patch/kernel-6.12/lrng/011-LRNG-0010-LRNG-add-common-timer-based-entropy-source-code.patch + curl -Os $mirror/openwrt/patch/kernel-6.12/lrng/011-LRNG-0011-LRNG-add-interrupt-entropy-source.patch + curl -Os $mirror/openwrt/patch/kernel-6.12/lrng/011-LRNG-0012-scheduler-add-entropy-sampling-hook.patch + curl -Os $mirror/openwrt/patch/kernel-6.12/lrng/011-LRNG-0013-LRNG-add-scheduler-based-entropy-source.patch + curl -Os $mirror/openwrt/patch/kernel-6.12/lrng/011-LRNG-0014-LRNG-add-SP800-90B-compliant-health-tests.patch + curl -Os $mirror/openwrt/patch/kernel-6.12/lrng/011-LRNG-0015-LRNG-add-random.c-entropy-source-support.patch + curl -Os $mirror/openwrt/patch/kernel-6.12/lrng/011-LRNG-0016-LRNG-CPU-entropy-source.patch + curl -Os $mirror/openwrt/patch/kernel-6.12/lrng/011-LRNG-0017-LRNG-add-Jitter-RNG-fast-noise-source.patch + curl -Os $mirror/openwrt/patch/kernel-6.12/lrng/011-LRNG-0018-LRNG-add-option-to-enable-runtime-entropy-rate-confi.patch + curl -Os $mirror/openwrt/patch/kernel-6.12/lrng/011-LRNG-0019-LRNG-add-interface-for-gathering-of-raw-entropy.patch + curl -Os $mirror/openwrt/patch/kernel-6.12/lrng/011-LRNG-0020-LRNG-add-power-on-and-runtime-self-tests.patch + curl -Os $mirror/openwrt/patch/kernel-6.12/lrng/011-LRNG-0021-LRNG-sysctls-and-proc-interface.patch + curl -Os $mirror/openwrt/patch/kernel-6.12/lrng/011-LRNG-0022-LRMG-add-drop-in-replacement-random-4-API.patch + curl -Os $mirror/openwrt/patch/kernel-6.12/lrng/011-LRNG-0023-LRNG-add-kernel-crypto-API-interface.patch + curl -Os $mirror/openwrt/patch/kernel-6.12/lrng/011-LRNG-0024-LRNG-add-dev-lrng-device-file-support.patch + curl -Os $mirror/openwrt/patch/kernel-6.12/lrng/011-LRNG-0025-LRNG-add-hwrand-framework-interface.patch +popd + +# linux-rt - i915 +pushd target/linux/generic/hack-6.12 + curl -Os $mirror/openwrt/patch/kernel-6.12/linux-rt/012-0001-drm-i915-Use-preempt_disable-enable_rt-where-recomme.patch + curl -Os $mirror/openwrt/patch/kernel-6.12/linux-rt/012-0002-drm-i915-Don-t-disable-interrupts-on-PREEMPT_RT-duri.patch + curl -Os $mirror/openwrt/patch/kernel-6.12/linux-rt/012-0003-drm-i915-Don-t-check-for-atomic-context-on-PREEMPT_R.patch + curl -Os $mirror/openwrt/patch/kernel-6.12/linux-rt/012-0004-drm-i915-Disable-tracing-points-on-PREEMPT_RT.patch + curl -Os $mirror/openwrt/patch/kernel-6.12/linux-rt/012-0005-drm-i915-gt-Use-spin_lock_irq-instead-of-local_irq_d.patch + curl -Os $mirror/openwrt/patch/kernel-6.12/linux-rt/012-0006-drm-i915-Drop-the-irqs_disabled-check.patch + curl -Os $mirror/openwrt/patch/kernel-6.12/linux-rt/012-0007-drm-i915-guc-Consider-also-RCU-depth-in-busy-loop.patch + curl -Os $mirror/openwrt/patch/kernel-6.12/linux-rt/012-0008-Revert-drm-i915-Depend-on-PREEMPT_RT.patch +popd + +# iproute2 - bbr3 +curl -s $mirror/openwrt/patch/iproute2/900-ss-output-TCP-BBRv3-diag-information.patch > package/network/utils/iproute2/patches/900-ss-output-TCP-BBRv3-diag-information.patch +curl -s $mirror/openwrt/patch/iproute2/901-ip-introduce-the-ecn_low-per-route-feature.patch > package/network/utils/iproute2/patches/901-ip-introduce-the-ecn_low-per-route-feature.patch +curl -s $mirror/openwrt/patch/iproute2/902-ss-display-ecn_low-if-tcp_info-tcpi_options-TCPI_OPT.patch > package/network/utils/iproute2/patches/902-ss-display-ecn_low-if-tcp_info-tcpi_options-TCPI_OPT.patch + +# linux-firmware +rm -rf package/firmware/linux-firmware +git clone https://$gitea/zhao/package_firmware_linux-firmware package/firmware/linux-firmware + +# mt76 +rm -rf package/kernel/mt76 +git clone https://$gitea/zhao/package_kernel_mt76 package/kernel/mt76 + +# wireless-regdb +curl -s $mirror/openwrt/patch/openwrt-6.x/500-world-regd-5GHz.patch > package/firmware/wireless-regdb/patches/500-world-regd-5GHz.patch + +# mac80211 +rm -rf package/kernel/mac80211 +git clone https://$gitea/zhao/package_kernel_mac80211 package/kernel/mac80211 -b openwrt-24.10 + +# ath10k-ct +rm -rf package/kernel/ath10k-ct +git clone https://$github/sbwml/package_kernel_ath10k-ct package/kernel/ath10k-ct -b v6.15 + +### kernel patch ### +# btf: silence btf module warning messages +curl -s $mirror/openwrt/patch/kernel-6.12/btf/990-btf-silence-btf-module-warning-messages.patch > target/linux/generic/hack-6.12/990-btf-silence-btf-module-warning-messages.patch +# cpu model +curl -s $mirror/openwrt/patch/kernel-6.12/arm64/312-arm64-cpuinfo-Add-model-name-in-proc-cpuinfo-for-64bit-ta.patch > target/linux/generic/hack-6.12/312-arm64-cpuinfo-Add-model-name-in-proc-cpuinfo-for-64bit-ta.patch +# fullcone +curl -s $mirror/openwrt/patch/kernel-6.12/net/952-net-conntrack-events-support-multiple-registrant.patch > target/linux/generic/hack-6.12/952-net-conntrack-events-support-multiple-registrant.patch +# bcm-fullcone +curl -s $mirror/openwrt/patch/kernel-6.12/net/982-add-bcm-fullcone-support.patch > target/linux/generic/hack-6.12/982-add-bcm-fullcone-support.patch +curl -s $mirror/openwrt/patch/kernel-6.12/net/983-add-bcm-fullcone-nft_masq-support.patch > target/linux/generic/hack-6.12/983-add-bcm-fullcone-nft_masq-support.patch +# shortcut-fe +curl -s $mirror/openwrt/patch/kernel-6.12/net/601-netfilter-export-udp_get_timeouts-function.patch > target/linux/generic/hack-6.12/601-netfilter-export-udp_get_timeouts-function.patch +curl -s $mirror/openwrt/patch/kernel-6.12/net/953-net-patch-linux-kernel-to-support-shortcut-fe.patch > target/linux/generic/hack-6.12/953-net-patch-linux-kernel-to-support-shortcut-fe.patch From 89062ffa66582a9e1c2d511266b1d301d48cd3b2 Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Wed, 5 Nov 2025 10:17:50 +0800 Subject: [PATCH 03/78] Update and rename 01-prepare_package.sh to 02-prepare_package.sh --- scripts/01-prepare_package.sh | 124 ------------------------- scripts/02-prepare_package.sh | 170 ++++++++++++++++++++++++++++++++++ 2 files changed, 170 insertions(+), 124 deletions(-) delete mode 100644 scripts/01-prepare_package.sh create mode 100644 scripts/02-prepare_package.sh diff --git a/scripts/01-prepare_package.sh b/scripts/01-prepare_package.sh deleted file mode 100644 index 8245356..0000000 --- a/scripts/01-prepare_package.sh +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/bash -e - -# Replace package -rm -rf feeds/packages/net/{xray-core,v2ray-core,v2ray-geodata,sing-box,samba4,miniupnpd,aria2,nginx} -rm -rf feeds/luci/applications/{luci-app-sqm,luci-app-upnp,luci-app-dockerman,luci-app-aria2} -rm -rf feeds/packages/utils/{unzip,docker,dockerd,containerd,runc,coremark} -rm -rf feeds/packages/lang/{node,golang} - -# golang 1.25 -git clone https://github.com/sbwml/packages_lang_golang -b 25.x feeds/packages/lang/golang - -# node - prebuilt -git clone https://github.com/sbwml/feeds_packages_lang_node-prebuilt feeds/packages/lang/node -b packages-24.10 - -# quickwrt packages -git clone https://github.com/QuickWrt/openwrt_packages package/new/openwrt_packages - -# luci-app-sqm -git clone https://git.cooluc.com/sbwml/luci-app-sqm feeds/luci/applications/luci-app-sqm - -# unzip -git clone https://github.com/sbwml/feeds_packages_utils_unzip feeds/packages/utils/unzip - -# UPnP -git clone https://git.cooluc.com/sbwml/miniupnpd feeds/packages/net/miniupnpd -b v2.3.9 -git clone https://git.cooluc.com/sbwml/luci-app-upnp feeds/luci/applications/luci-app-upnp -b openwrt-24.10 - -# Docker -git clone https://git.cooluc.com/sbwml/luci-app-dockerman -b openwrt-24.10 feeds/luci/applications/luci-app-dockerman -git clone https://github.com/sbwml/packages_utils_docker feeds/packages/utils/docker -git clone https://github.com/sbwml/packages_utils_dockerd feeds/packages/utils/dockerd -git clone https://github.com/sbwml/packages_utils_containerd feeds/packages/utils/containerd -git clone https://github.com/sbwml/packages_utils_runc feeds/packages/utils/runc - -# aria2 & ariaNG -git clone https://github.com/sbwml/ariang-nginx package/new/ariang-nginx -git clone https://github.com/sbwml/feeds_packages_net_aria2 -b 22.03 feeds/packages/net/aria2 - -# ddns - fix boot -sed -i '/boot()/,+2d' feeds/packages/net/ddns-scripts/files/etc/init.d/ddns - -# Use nginx instead of uhttpd -sed -i 's/+uhttpd /+luci-nginx /g' feeds/luci/collections/luci/Makefile -sed -i 's/+uhttpd-mod-ubus //' feeds/luci/collections/luci/Makefile -sed -i 's/+uhttpd /+luci-nginx /g' feeds/luci/collections/luci-light/Makefile -sed -i "s/+luci /+luci-nginx /g" feeds/luci/collections/luci-ssl-openssl/Makefile -sed -i "s/+luci /+luci-nginx /g" feeds/luci/collections/luci-ssl/Makefile -sed -i 's/+uhttpd +uhttpd-mod-ubus /+luci-nginx /g' feeds/packages/net/wg-installer/Makefile -sed -i '/uhttpd-mod-ubus/d' feeds/luci/collections/luci-light/Makefile -sed -i 's/+luci-nginx \\$/+luci-nginx/' feeds/luci/collections/luci-light/Makefile - -# nginx - latest version -git clone https://github.com/sbwml/feeds_packages_net_nginx feeds/packages/net/nginx -b openwrt-24.10 -sed -i 's/procd_set_param stdout 1/procd_set_param stdout 0/g;s/procd_set_param stderr 1/procd_set_param stderr 0/g' feeds/packages/net/nginx/files/nginx.init - -# nginx - ubus -sed -i 's/ubus_parallel_req 2/ubus_parallel_req 6/g' feeds/packages/net/nginx/files-luci-support/60_nginx-luci-support -sed -i '/ubus_parallel_req/a\ ubus_script_timeout 300;' feeds/packages/net/nginx/files-luci-support/60_nginx-luci-support - -# nginx - config -cp -rf ../OpenBox/doc/nginx/luci.locations ./feeds/packages/net/nginx/files-luci-support/ -cp -rf ../OpenBox/doc/nginx/uci.conf.template ./feeds/packages/net/nginx-util/files/ - -# uwsgi - fix timeout -sed -i '$a cgi-timeout = 600' feeds/packages/net/uwsgi/files-luci-support/luci-*.ini -sed -i '/limit-as/c\limit-as = 5000' feeds/packages/net/uwsgi/files-luci-support/luci-webui.ini -# disable error log -sed -i "s/procd_set_param stderr 1/procd_set_param stderr 0/g" feeds/packages/net/uwsgi/files/uwsgi.init - -# uwsgi - performance -sed -i 's/threads = 1/threads = 2/g' feeds/packages/net/uwsgi/files-luci-support/luci-webui.ini -sed -i 's/processes = 3/processes = 4/g' feeds/packages/net/uwsgi/files-luci-support/luci-webui.ini -sed -i 's/cheaper = 1/cheaper = 2/g' feeds/packages/net/uwsgi/files-luci-support/luci-webui.ini - -# rpcd - fix timeout -sed -i 's/option timeout 30/option timeout 60/g' package/system/rpcd/files/rpcd.config -sed -i 's#20) \* 1000#60) \* 1000#g' feeds/luci/modules/luci-base/htdocs/luci-static/resources/rpc.js - -# frpc -sed -i 's/procd_set_param stdout $stdout/procd_set_param stdout 0/g' feeds/packages/net/frp/files/frpc.init -sed -i 's/procd_set_param stderr $stderr/procd_set_param stderr 0/g' feeds/packages/net/frp/files/frpc.init -sed -i 's/stdout stderr //g' feeds/packages/net/frp/files/frpc.init -sed -i '/stdout:bool/d;/stderr:bool/d' feeds/packages/net/frp/files/frpc.init -sed -i '/stdout/d;/stderr/d' feeds/packages/net/frp/files/frpc.config -sed -i 's/env conf_inc/env conf_inc enable/g' feeds/packages/net/frp/files/frpc.init -sed -i "s/'conf_inc:list(string)'/& \\\\/" feeds/packages/net/frp/files/frpc.init -sed -i "/conf_inc:list/a\\\t\t\'enable:bool:0\'" feeds/packages/net/frp/files/frpc.init -sed -i '/procd_open_instance/i\\t\[ "$enable" -ne 1 \] \&\& return 1\n' feeds/packages/net/frp/files/frpc.init -patch -p1 < ../OpenBox/luci/applications/luci-app-frpc/001-luci-app-frpc-hide-token.patch -patch -p1 < ../OpenBox/luci/applications/luci-app-frpc/002-luci-app-frpc-add-enable-flag.patch - -# natmap -sed -i 's/log_stdout:bool:1/log_stdout:bool:0/g;s/log_stderr:bool:1/log_stderr:bool:0/g' feeds/packages/net/natmap/files/natmap.init -pushd feeds/luci -patch -p1 <../../../OpenBox/luci/applications/luci-app-natmap/0001-luci-app-natmap-add-default-STUN-server-lists.patch -popd - -# samba4 - bump version -git clone https://github.com/sbwml/feeds_packages_net_samba4 feeds/packages/net/samba4 -# enable multi-channel -sed -i '/workgroup/a \\n\t## enable multi-channel' feeds/packages/net/samba4/files/smb.conf.template -sed -i '/enable multi-channel/a \\tserver multi channel support = yes' feeds/packages/net/samba4/files/smb.conf.template -# default config -sed -i 's/#aio read size = 0/aio read size = 0/g' feeds/packages/net/samba4/files/smb.conf.template -sed -i 's/#aio write size = 0/aio write size = 0/g' feeds/packages/net/samba4/files/smb.conf.template -sed -i 's/invalid users = root/#invalid users = root/g' feeds/packages/net/samba4/files/smb.conf.template -sed -i 's/bind interfaces only = yes/bind interfaces only = no/g' feeds/packages/net/samba4/files/smb.conf.template -sed -i 's/#create mask/create mask/g' feeds/packages/net/samba4/files/smb.conf.template -sed -i 's/#directory mask/directory mask/g' feeds/packages/net/samba4/files/smb.conf.template -sed -i 's/0666/0644/g;s/0744/0755/g;s/0777/0755/g' feeds/luci/applications/luci-app-samba4/htdocs/luci-static/resources/view/samba4.js -sed -i 's/0666/0644/g;s/0777/0755/g' feeds/packages/net/samba4/files/samba.config -sed -i 's/0666/0644/g;s/0777/0755/g' feeds/packages/net/samba4/files/smb.conf.template - -# iperf3 -sed -i "s/D_GNU_SOURCE/D_GNU_SOURCE -funroll-loops/g" feeds/packages/net/iperf3/Makefile - -# luci-compat - fix translation -sed -i 's/<%:Up%>/<%:Move up%>/g' feeds/luci/modules/luci-compat/luasrc/view/cbi/tblsection.htm -sed -i 's/<%:Down%>/<%:Move down%>/g' feeds/luci/modules/luci-compat/luasrc/view/cbi/tblsection.htm - -# frpc translation -sed -i 's,发送,Transmission,g' feeds/luci/applications/luci-app-transmission/po/zh_Hans/transmission.po -sed -i 's,frp 服务器,Frp 服务器,g' feeds/luci/applications/luci-app-frps/po/zh_Hans/frps.po -sed -i 's,frp 客户端,Frp 客户端,g' feeds/luci/applications/luci-app-frpc/po/zh_Hans/frpc.po diff --git a/scripts/02-prepare_package.sh b/scripts/02-prepare_package.sh new file mode 100644 index 0000000..264800e --- /dev/null +++ b/scripts/02-prepare_package.sh @@ -0,0 +1,170 @@ +#!/bin/bash -e + +# golang 1.25 +rm -rf feeds/packages/lang/golang +git clone https://$github/sbwml/packages_lang_golang -b 25.x feeds/packages/lang/golang + +# node - prebuilt +rm -rf feeds/packages/lang/node +git clone https://$github/sbwml/feeds_packages_lang_node-prebuilt feeds/packages/lang/node -b packages-24.10 + +# default settings +git clone https://$github/QuickWrt/default-settings package/new/default-settings -b openwrt-24.10 + +# wwan +git clone https://$github/sbwml/wwan-packages package/new/wwan --depth=1 + +# luci-app-filemanager +rm -rf feeds/luci/applications/luci-app-filemanager +git clone https://$github/sbwml/luci-app-filemanager package/new/luci-app-filemanager + +# luci-app-quickfile +git clone https://$github/sbwml/luci-app-quickfile package/new/quickfile + +# luci-app-airplay2 +git clone https://$github/sbwml/luci-app-airplay2 package/new/airplay2 + +# luci-app-webdav +git clone https://$github/sbwml/luci-app-webdav package/new/luci-app-webdav + +# ddns - fix boot +sed -i '/boot()/,+2d' feeds/packages/net/ddns-scripts/files/etc/init.d/ddns + +# nlbwmon - disable syslog +sed -i 's/stderr 1/stderr 0/g' feeds/packages/net/nlbwmon/files/nlbwmon.init + +# pcre - 8.45 +mkdir -p package/libs/pcre +curl -s $mirror/openwrt/patch/pcre/Makefile > package/libs/pcre/Makefile +curl -s $mirror/openwrt/patch/pcre/Config.in > package/libs/pcre/Config.in + +# lrzsz - 0.12.20 +rm -rf feeds/packages/utils/lrzsz +git clone https://$github/sbwml/packages_utils_lrzsz package/new/lrzsz + +# irqbalance: disable build with numa +curl -s $mirror/openwrt/patch/irqbalance/011-meson-numa.patch > feeds/packages/utils/irqbalance/patches/011-meson-numa.patch +sed -i '/-Dcapng=disabled/i\\t-Dnuma=disabled \\' feeds/packages/utils/irqbalance/Makefile + +# frpc +sed -i 's/procd_set_param stdout $stdout/procd_set_param stdout 0/g' feeds/packages/net/frp/files/frpc.init +sed -i 's/procd_set_param stderr $stderr/procd_set_param stderr 0/g' feeds/packages/net/frp/files/frpc.init +sed -i 's/stdout stderr //g' feeds/packages/net/frp/files/frpc.init +sed -i '/stdout:bool/d;/stderr:bool/d' feeds/packages/net/frp/files/frpc.init +sed -i '/stdout/d;/stderr/d' feeds/packages/net/frp/files/frpc.config +sed -i 's/env conf_inc/env conf_inc enable/g' feeds/packages/net/frp/files/frpc.init +sed -i "s/'conf_inc:list(string)'/& \\\\/" feeds/packages/net/frp/files/frpc.init +sed -i "/conf_inc:list/a\\\t\t\'enable:bool:0\'" feeds/packages/net/frp/files/frpc.init +sed -i '/procd_open_instance/i\\t\[ "$enable" -ne 1 \] \&\& return 1\n' feeds/packages/net/frp/files/frpc.init +curl -s $mirror/openwrt/patch/luci/applications/luci-app-frpc/001-luci-app-frpc-hide-token.patch | patch -p1 +curl -s $mirror/openwrt/patch/luci/applications/luci-app-frpc/002-luci-app-frpc-add-enable-flag.patch | patch -p1 + +# natmap +sed -i 's/log_stdout:bool:1/log_stdout:bool:0/g;s/log_stderr:bool:1/log_stderr:bool:0/g' feeds/packages/net/natmap/files/natmap.init +pushd feeds/luci + curl -s $mirror/openwrt/patch/luci/applications/luci-app-natmap/0001-luci-app-natmap-add-default-STUN-server-lists.patch | patch -p1 +popd + +# samba4 - bump version +rm -rf feeds/packages/net/samba4 +git clone https://$github/sbwml/feeds_packages_net_samba4 feeds/packages/net/samba4 +# enable multi-channel +sed -i '/workgroup/a \\n\t## enable multi-channel' feeds/packages/net/samba4/files/smb.conf.template +sed -i '/enable multi-channel/a \\tserver multi channel support = yes' feeds/packages/net/samba4/files/smb.conf.template +# default config +sed -i 's/#aio read size = 0/aio read size = 0/g' feeds/packages/net/samba4/files/smb.conf.template +sed -i 's/#aio write size = 0/aio write size = 0/g' feeds/packages/net/samba4/files/smb.conf.template +sed -i 's/invalid users = root/#invalid users = root/g' feeds/packages/net/samba4/files/smb.conf.template +sed -i 's/bind interfaces only = yes/bind interfaces only = no/g' feeds/packages/net/samba4/files/smb.conf.template +sed -i 's/#create mask/create mask/g' feeds/packages/net/samba4/files/smb.conf.template +sed -i 's/#directory mask/directory mask/g' feeds/packages/net/samba4/files/smb.conf.template +sed -i 's/0666/0644/g;s/0744/0755/g;s/0777/0755/g' feeds/luci/applications/luci-app-samba4/htdocs/luci-static/resources/view/samba4.js +sed -i 's/0666/0644/g;s/0777/0755/g' feeds/packages/net/samba4/files/samba.config +sed -i 's/0666/0644/g;s/0777/0755/g' feeds/packages/net/samba4/files/smb.conf.template + +# zerotier +rm -rf feeds/packages/net/zerotier +git clone https://$github/sbwml/feeds_packages_net_zerotier feeds/packages/net/zerotier + +# aria2 & ariaNG +rm -rf feeds/packages/net/ariang +rm -rf feeds/luci/applications/luci-app-aria2 +git clone https://$github/sbwml/ariang-nginx package/new/ariang-nginx +rm -rf feeds/packages/net/aria2 +git clone https://$github/sbwml/feeds_packages_net_aria2 -b 22.03 feeds/packages/net/aria2 + +# airconnect +git clone https://$github/sbwml/luci-app-airconnect package/new/airconnect --depth=1 + +# netkit-ftp +git clone https://$github/sbwml/package_new_ftp package/new/ftp + +# nethogs +git clone https://$github/sbwml/package_new_nethogs package/new/nethogs + +# SSRP & Passwall +rm -rf feeds/packages/net/{xray-core,v2ray-core,v2ray-geodata,sing-box} +git clone https://$github/sbwml/openwrt_helloworld package/new/helloworld -b v5 + +# openlist +git clone https://$github/sbwml/luci-app-openlist2 package/new/openlist --depth=1 + +# netdata +sed -i 's/syslog/none/g' feeds/packages/admin/netdata/files/netdata.conf + +# qBittorrent +git clone https://$github/sbwml/luci-app-qbittorrent package/new/qbittorrent --depth=1 + +# unblockneteasemusic +git clone https://$github/UnblockNeteaseMusic/luci-app-unblockneteasemusic package/new/luci-app-unblockneteasemusic --depth=1 +sed -i 's/解除网易云音乐播放限制/网易云音乐解锁/g' package/new/luci-app-unblockneteasemusic/root/usr/share/luci/menu.d/luci-app-unblockneteasemusic.json + +# Theme +git clone https://$github/sbwml/luci-theme-argon package/new/luci-theme-argon --depth=1 + +# Mosdns +git clone https://$github/sbwml/luci-app-mosdns -b v5 package/new/mosdns --depth=1 + +# OpenAppFilter +git clone https://$github/sbwml/OpenAppFilter --depth=1 package/new/OpenAppFilter -b v6 + +# iperf3 +sed -i "s/D_GNU_SOURCE/D_GNU_SOURCE -funroll-loops/g" feeds/packages/net/iperf3/Makefile + +# nlbwmon +sed -i 's/services/network/g' feeds/luci/applications/luci-app-nlbwmon/root/usr/share/luci/menu.d/luci-app-nlbwmon.json +sed -i 's/services/network/g' feeds/luci/applications/luci-app-nlbwmon/htdocs/luci-static/resources/view/nlbw/config.js + +# mentohust +git clone https://$github/sbwml/luci-app-mentohust package/new/mentohust + +# custom packages +rm -rf feeds/packages/utils/coremark +git clone https://$github/sbwml/openwrt_pkgs package/new/custom --depth=1 + +# luci-compat - fix translation +sed -i 's/<%:Up%>/<%:Move up%>/g' feeds/luci/modules/luci-compat/luasrc/view/cbi/tblsection.htm +sed -i 's/<%:Down%>/<%:Move down%>/g' feeds/luci/modules/luci-compat/luasrc/view/cbi/tblsection.htm + +# frpc translation +sed -i 's,发送,Transmission,g' feeds/luci/applications/luci-app-transmission/po/zh_Hans/transmission.po +sed -i 's,frp 服务器,Frp 服务器,g' feeds/luci/applications/luci-app-frps/po/zh_Hans/frps.po +sed -i 's,frp 客户端,Frp 客户端,g' feeds/luci/applications/luci-app-frpc/po/zh_Hans/frpc.po + +# luci-app-sqm +rm -rf feeds/luci/applications/luci-app-sqm +git clone https://$gitea/zhao/luci-app-sqm feeds/luci/applications/luci-app-sqm + +# unzip +rm -rf feeds/packages/utils/unzip +git clone https://$github/sbwml/feeds_packages_utils_unzip feeds/packages/utils/unzip + +# tcp-brutal +git clone https://$github/sbwml/package_kernel_tcp-brutal package/kernel/tcp-brutal + +# watchcat - clean config +true > feeds/packages/utils/watchcat/files/watchcat.config + +# libpcap +rm -rf package/libs/libpcap +git clone https://$github/sbwml/package_libs_libpcap package/libs/libpcap From 4a9aec9391dfed2e3e1b25e4065e9bf3fd059cb4 Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Wed, 5 Nov 2025 10:18:22 +0800 Subject: [PATCH 04/78] Create 03-convert_translation.sh --- scripts/03-convert_translation.sh | 51 +++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 scripts/03-convert_translation.sh diff --git a/scripts/03-convert_translation.sh b/scripts/03-convert_translation.sh new file mode 100644 index 0000000..23232a7 --- /dev/null +++ b/scripts/03-convert_translation.sh @@ -0,0 +1,51 @@ +#!/bin/bash +# [CTCGFW]immortalwrt +# Use it under GPLv3, please. +# -------------------------------------------------------- +# Convert translation files zh-cn to zh_Hans +# The script is still in testing, welcome to report bugs. + +po_file="$({ find |grep -E "[a-z0-9]+\.zh\-cn.+po"; } 2>"/dev/null")" +for a in ${po_file} +do + [ -n "$(grep "Language: zh_CN" "$a")" ] && sed -i "s/Language: zh_CN/Language: zh_Hans/g" "$a" + po_new_file="$(echo -e "$a"|sed "s/zh-cn/zh_Hans/g")" + mv "$a" "${po_new_file}" 2>"/dev/null" +done + +po_file2="$({ find |grep "/zh-cn/" |grep "\.po"; } 2>"/dev/null")" +for b in ${po_file2} +do + [ -n "$(grep "Language: zh_CN" "$b")" ] && sed -i "s/Language: zh_CN/Language: zh_Hans/g" "$b" + po_new_file2="$(echo -e "$b"|sed "s/zh-cn/zh_Hans/g")" + mv "$b" "${po_new_file2}" 2>"/dev/null" +done + +lmo_file="$({ find |grep -E "[a-z0-9]+\.zh_Hans.+lmo"; } 2>"/dev/null")" +for c in ${lmo_file} +do + lmo_new_file="$(echo -e "$c"|sed "s/zh_Hans/zh-cn/g")" + mv "$c" "${lmo_new_file}" 2>"/dev/null" +done + +lmo_file2="$({ find |grep "/zh_Hans/" |grep "\.lmo"; } 2>"/dev/null")" +for d in ${lmo_file2} +do + lmo_new_file2="$(echo -e "$d"|sed "s/zh_Hans/zh-cn/g")" + mv "$d" "${lmo_new_file2}" 2>"/dev/null" +done + +po_dir="$({ find |grep "/zh-cn" |sed "/\.po/d" |sed "/\.lmo/d"; } 2>"/dev/null")" +for e in ${po_dir} +do + po_new_dir="$(echo -e "$e"|sed "s/zh-cn/zh_Hans/g")" + mv "$e" "${po_new_dir}" 2>"/dev/null" +done + +makefile_file="$({ find|grep Makefile |sed "/Makefile./d"; } 2>"/dev/null")" +for f in ${makefile_file} +do + [ -n "$(grep "zh-cn" "$f")" ] && sed -i "s/zh-cn/zh_Hans/g" "$f" + [ -n "$(grep "zh_Hans.lmo" "$f")" ] && sed -i "s/zh_Hans.lmo/zh-cn.lmo/g" "$f" +done +exit 0 From da231ab0fb90d654fe5a4f173e629858d00e883c Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Wed, 5 Nov 2025 10:19:33 +0800 Subject: [PATCH 05/78] Create 04-fix_kmod.sh --- scripts/04-fix_kmod.sh | 67 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 scripts/04-fix_kmod.sh diff --git a/scripts/04-fix_kmod.sh b/scripts/04-fix_kmod.sh new file mode 100644 index 0000000..f2e260b --- /dev/null +++ b/scripts/04-fix_kmod.sh @@ -0,0 +1,67 @@ +#!/bin/bash -e + +# Fix build for 6.12 + +### BROKEN +sed -i 's/^\([[:space:]]*DEPENDS:=.*\)$/\1 @BROKEN/' package/kernel/rtl8812au-ct/Makefile + +# cryptodev-linux +mkdir -p package/kernel/cryptodev-linux/patches +curl -s $mirror/openwrt/patch/packages-patches/cryptodev-linux/6.12/0005-Fix-cryptodev_verbosity-sysctl-for-Linux-6.11-rc1.patch > package/kernel/cryptodev-linux/patches/0005-Fix-cryptodev_verbosity-sysctl-for-Linux-6.11-rc1.patch +curl -s $mirror/openwrt/patch/packages-patches/cryptodev-linux/6.12/0006-Exclude-unused-struct-since-Linux-6.5.patch > package/kernel/cryptodev-linux/patches/0006-Exclude-unused-struct-since-Linux-6.5.patch + +# gpio-button-hotplug +curl -s $mirror/openwrt/patch/packages-patches/gpio-button-hotplug/fix-linux-6.12.patch | patch -p1 + +# jool +curl -s $mirror/openwrt/patch/packages-patches/jool/Makefile > feeds/packages/net/jool/Makefile + +# ovpn-dco +mkdir -p feeds/packages/kernel/ovpn-dco/patches +curl -s $mirror/openwrt/patch/packages-patches/ovpn-dco/901-fix-linux-6.11.patch > feeds/packages/kernel/ovpn-dco/patches/901-fix-linux-6.11.patch +curl -s $mirror/openwrt/patch/packages-patches/ovpn-dco/902-fix-linux-6.12.patch > feeds/packages/kernel/ovpn-dco/patches/902-fix-linux-6.12.patch + +# libpfring +rm -rf feeds/packages/libs/libpfring +mkdir -p feeds/packages/libs/libpfring/patches +curl -s $mirror/openwrt/patch/packages-patches/libpfring/Makefile > feeds/packages/libs/libpfring/Makefile +pushd feeds/packages/libs/libpfring/patches + curl -Os $mirror/openwrt/patch/packages-patches/libpfring/patches/0001-fix-cross-compiling.patch + curl -Os $mirror/openwrt/patch/packages-patches/libpfring/patches/100-fix-compilation-warning.patch + curl -Os $mirror/openwrt/patch/packages-patches/libpfring/patches/900-fix-linux-6.6.patch +popd + +# nat46 +mkdir -p package/kernel/nat46/patches +curl -s $mirror/openwrt/patch/packages-patches/nat46/100-fix-build-with-kernel-6.9.patch > package/kernel/nat46/patches/100-fix-build-with-kernel-6.9.patch +curl -s $mirror/openwrt/patch/packages-patches/nat46/101-fix-build-with-kernel-6.12.patch > package/kernel/nat46/patches/101-fix-build-with-kernel-6.12.patch + +# openvswitch +sed -i '/ovs_kmod_openvswitch_depends/a\\t\ \ +kmod-sched-act-sample \\' feeds/packages/net/openvswitch/Makefile + +# rtpengine +curl -s $mirror/openwrt/patch/packages-patches/rtpengine/900-fix-linux-6.12-11.5.1.18.patch > feeds/telephony/net/rtpengine/patches/900-fix-linux-6.12-11.5.1.18.patch + +# ubootenv-nvram - 6.12 +mkdir -p package/kernel/ubootenv-nvram/patches +curl -s $mirror/openwrt/patch/packages-patches/ubootenv-nvram/010-make-ubootenv_remove-return-void-for-linux-6.12.patch > package/kernel/ubootenv-nvram/patches/010-make-ubootenv_remove-return-void-for-linux-6.12.patch + +# usb-serial-xr_usb_serial_common: remove package +# Now that we have packaged the upstream driver[1] and only board[2] that +# includes it by default has been switched to it, remove this out-of-tree +# driver that is broken on 6.12 anyway. +rm -rf feeds/packages/libs/xr_usb_serial_common + +# xtables-addons +curl -s $mirror/openwrt/patch/packages-patches/xtables-addons/301-fix-build-with-linux-6.12.patch > feeds/packages/net/xtables-addons/patches/301-fix-build-with-linux-6.12.patch +curl -s $mirror/openwrt/patch/packages-patches/xtables-addons/302-fix-build-for-linux-6.12rc2.patch > feeds/packages/net/xtables-addons/patches/302-fix-build-for-linux-6.12rc2.patch + +# telephony +pushd feeds/telephony + # dahdi-linux + rm -rf libs/dahdi-linux + git clone https://$github/sbwml/feeds_telephony_libs_dahdi-linux libs/dahdi-linux +popd + +# routing - batman-adv fix build with linux-6.12 +curl -s $mirror/openwrt/patch/packages-patches/batman-adv/901-fix-linux-6.12rc2-builds.patch > feeds/routing/batman-adv/patches/901-fix-linux-6.12rc2-builds.patch From f06e722c7648eb46ece56ae27b7c900a5db2af57 Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Wed, 5 Nov 2025 10:21:27 +0800 Subject: [PATCH 06/78] Create 05-fix-source.sh --- scripts/05-fix-source.sh | 122 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 scripts/05-fix-source.sh diff --git a/scripts/05-fix-source.sh b/scripts/05-fix-source.sh new file mode 100644 index 0000000..88b570e --- /dev/null +++ b/scripts/05-fix-source.sh @@ -0,0 +1,122 @@ +#!/bin/bash + +# apk-tools +curl -s $mirror/openwrt/patch/apk-tools/9999-hack-for-linux-pre-releases.patch > package/system/apk/patches/9999-hack-for-linux-pre-releases.patch + +# libsodium - fix build with lto (GNU BUG - 89147) +sed -i "/CONFIGURE_ARGS/i\TARGET_CFLAGS += -ffat-lto-objects\n" feeds/packages/libs/libsodium/Makefile + +# haproxy - fix build with quictls +sed -i '/USE_QUIC_OPENSSL_COMPAT/d' feeds/packages/net/haproxy/Makefile + +# xdp-tools +rm -rf package/network/utils/xdp-tools +git clone https://$github/sbwml/package_network_utils_xdp-tools package/network/utils/xdp-tools + +# fix gcc14 +if [ "$USE_GCC14" = y ] || [ "$USE_GCC15" = y ]; then + # linux-atm + rm -rf package/network/utils/linux-atm + git clone https://$github/sbwml/package_network_utils_linux-atm package/network/utils/linux-atm +fi + +# fix gcc-15 +if [ "$USE_GCC15" = y ]; then + sed -i '/TARGET_CFLAGS/ s/$/ -Wno-error=unterminated-string-initialization/' package/libs/mbedtls/Makefile + # elfutils + curl -s $mirror/openwrt/patch/openwrt-6.x/gcc-15/elfutils/901-backends-fix-string-initialization-error-on-gcc15.patch > package/libs/elfutils/patches/901-backends-fix-string-initialization-error-on-gcc15.patch + # libwebsockets + mkdir -p feeds/packages/libs/libwebsockets/patches + curl -s $mirror/openwrt/patch/openwrt-6.x/gcc-15/libwebsockets/901-fix-string-initialization-error-on-gcc15.patch > feeds/packages/libs/libwebsockets/patches/901-fix-string-initialization-error-on-gcc15.patch + # libxcrypt + mkdir -p feeds/packages/libs/libxcrypt/patches + curl -s $mirror/openwrt/patch/openwrt-6.x/gcc-15/libxcrypt/901-fix-string-initialization-error-on-gcc15.patch > feeds/packages/libs/libxcrypt/patches/901-fix-string-initialization-error-on-gcc15.patch +fi + +# fix gcc-15.0.1 C23 +if [ "$USE_GCC15" = y ]; then + # gmp + mkdir -p package/libs/gmp/patches + curl -s $mirror/openwrt/patch/openwrt-6.x/gcc-15-c23/gmp/001-fix-build-with-gcc-15.patch > package/libs/gmp/patches/001-fix-build-with-gcc-15.patch + # libtirpc + sed -i '/TARGET_CFLAGS/i TARGET_CFLAGS += -std=gnu17\n' feeds/packages/libs/libtirpc/Makefile + # libsepol + sed -i '/HOST_MAKE_FLAGS/i TARGET_CFLAGS += -std=gnu17\n' package/libs/libsepol/Makefile + # tree + sed -i '/MAKE_FLAGS/i TARGET_CFLAGS += -std=gnu17\n' feeds/packages/utils/tree/Makefile + # gdbm + sed -i '/CONFIGURE_ARGS/i TARGET_CFLAGS += -std=gnu17\n' feeds/packages/libs/gdbm/Makefile + # libical + sed -i '/CMAKE_OPTIONS/i TARGET_CFLAGS += -std=gnu17\n' feeds/packages/libs/libical/Makefile + # libconfig + sed -i '/CONFIGURE_ARGS/i TARGET_CFLAGS += -std=gnu17\n' package/feeds/packages/libconfig/Makefile + # lsof + sed -i '/CONFIGURE_ARGS/i TARGET_CFLAGS += -std=gnu17\n' feeds/packages/utils/lsof/Makefile + # screen + sed -i '/CONFIGURE_ARGS/i TARGET_CFLAGS += -std=gnu17\n' feeds/packages/utils/screen/Makefile + # ppp + sed -i '/CONFIGURE_VARS/i \\nTARGET_CFLAGS += -std=gnu17\n' package/network/services/ppp/Makefile + # vim + sed -i '/CONFIGURE_ARGS/i TARGET_CFLAGS += -std=gnu17\n' feeds/packages/utils/vim/Makefile + # mtd + sed -i '/target=/i TARGET_CFLAGS += -std=gnu17\n' package/system/mtd/Makefile + # libselinux + sed -i '/MAKE_FLAGS/i TARGET_CFLAGS += -std=gnu17\n' package/libs/libselinux/Makefile + # avahi + sed -i '/TARGET_CFLAGS +=/i TARGET_CFLAGS += -std=gnu17\n' feeds/packages/libs/avahi/Makefile + # bash + sed -i '/CONFIGURE_ARGS/i TARGET_CFLAGS += -std=gnu17\n' feeds/packages/utils/bash/Makefile + # xl2tpd + sed -i '/ifneq (0,0)/i TARGET_CFLAGS += -std=gnu17\n' feeds/packages/net/xl2tpd/Makefile + # dnsmasq + sed -i '/MAKE_FLAGS/i TARGET_CFLAGS += -std=gnu17\n' package/network/services/dnsmasq/Makefile + # bluez + sed -i '/CONFIGURE_ARGS/i TARGET_CFLAGS += -std=gnu17\n' feeds/packages/utils/bluez/Makefile + # e2fsprogs + sed -i '/CONFIGURE_ARGS/i TARGET_CFLAGS += -std=gnu17\n' package/utils/e2fsprogs/Makefile + # f2fs-tools + sed -i '/CONFIGURE_ARGS/i TARGET_CFLAGS += -std=gnu17\n' package/utils/f2fs-tools/Makefile + # krb5 + sed -i '/CONFIGURE_VARS/i TARGET_CFLAGS += -std=gnu17\n' feeds/packages/net/krb5/Makefile + # parted + sed -i '/CONFIGURE_ARGS/i TARGET_CFLAGS += -std=gnu17\n' feeds/packages/utils/parted/Makefile + # iperf3 + sed -i '/CONFIGURE_ARGS/i TARGET_CFLAGS += -std=gnu17\n' feeds/packages/net/iperf3/Makefile + # db + sed -i '/CONFIGURE_ARGS/i TARGET_CFLAGS += -std=gnu17\n' feeds/packages/libs/db/Makefile + # python3 + sed -i '/TARGET_CONFIGURE_OPTS/i TARGET_CFLAGS += -std=gnu17\n' feeds/packages/lang/python/python3/Makefile + # uwsgi + sed -i '/MAKE_VARS/i TARGET_CFLAGS += -std=gnu17\n' feeds/packages/net/uwsgi/Makefile + # perl + sed -i '/Target perl/i TARGET_CFLAGS += -std=gnu17\n' feeds/packages/lang/perl/Makefile + # rsync + sed -i '/CONFIGURE_ARGS/i TARGET_CFLAGS += -std=gnu17\n' feeds/packages/net/rsync/Makefile + # shine + sed -i '/Build\/InstallDev/i TARGET_CFLAGS += -std=gnu17\n' feeds/packages/sound/shine/Makefile + # jq + sed -i '/CONFIGURE_ARGS/i TARGET_CFLAGS += -std=gnu17\n' feeds/packages/utils/jq/Makefile +fi + +# ksmbd luci +sed -i 's/0666/0644/g;s/0777/0755/g' feeds/luci/applications/luci-app-ksmbd/htdocs/luci-static/resources/view/ksmbd.js + +# ksmbd tools +sed -i 's/0666/0644/g;s/0777/0755/g' feeds/packages/net/ksmbd-tools/files/ksmbd.config.example +sed -i 's/bind interfaces only = yes/bind interfaces only = no/g' feeds/packages/net/ksmbd-tools/files/ksmbd.conf.template + +# vim - fix E1187: Failed to source defaults.vim +pushd feeds/packages + curl -s $mirror/openwrt/patch/vim/0001-vim-fix-renamed-defaults-config-file.patch | patch -p1 +popd + +# perf +curl -s $mirror/openwrt/patch/openwrt-6.x/musl/990-add-typedefs-for-Elf64_Relr-and-Elf32_Relr.patch > toolchain/musl/patches/990-add-typedefs-for-Elf64_Relr-and-Elf32_Relr.patch +curl -s $mirror/openwrt/patch/openwrt-6.x/perf/Makefile > package/devel/perf/Makefile + +# kselftests-bpf +curl -s $mirror/openwrt/patch/packages-patches/kselftests-bpf/Makefile > package/devel/kselftests-bpf/Makefile + +# sms-tools +mkdir -p feeds/packages/utils/sms-tool/patches +curl -s $mirror/openwrt/patch/packages-patches/sms-tools/900-fix-incompatible-pointer-type-error-for-signal-function.patch > feeds/packages/utils/sms-tool/patches/900-fix-incompatible-pointer-type-error-for-signal-function.patch From 21134f855141fe54cd11dfbc330a8aa2f23f3bbd Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Wed, 5 Nov 2025 10:25:55 +0800 Subject: [PATCH 07/78] Update 00-prepare_base.sh --- scripts/00-prepare_base.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/scripts/00-prepare_base.sh b/scripts/00-prepare_base.sh index 75dcae0..b0d40df 100644 --- a/scripts/00-prepare_base.sh +++ b/scripts/00-prepare_base.sh @@ -44,6 +44,33 @@ sed -i 's/+uhttpd +uhttpd-mod-ubus /+luci-nginx /g' feeds/packages/net/wg-instal sed -i '/uhttpd-mod-ubus/d' feeds/luci/collections/luci-light/Makefile sed -i 's/+luci-nginx \\$/+luci-nginx/' feeds/luci/collections/luci-light/Makefile +# Use specific optimizations +if [ "$platform" = "x86_64" ]; then + sed -i 's/O2/O2 -march=x86-64-v2/g' include/target.mk + sed -i 's,no-mips16 no-lto,no-mips16,g' feeds/packages/libs/libsodium/Makefile + echo '#!/bin/sh + # Put your custom commands here that should be executed once + # the system init finished. By default this file does nothing. + + if ! grep "Default string" /tmp/sysinfo/model > /dev/null; then + echo should be fine + else + echo "Generic PC" > /tmp/sysinfo/model + fi + + status=$(cat /sys/devices/system/cpu/intel_pstate/status) + + if [ "$status" = "passive" ]; then + echo "active" | tee /sys/devices/system/cpu/intel_pstate/status + fi + + exit 0 + '> ./package/base-files/files/etc/rc.local +elif [ "$platform" = "rockchip" ]; then + sed -i 's,-mcpu=generic,-march=armv8-a+crc+crypto,g' include/target.mk + sed -i 's,kmod-r8168,kmod-r8169,g' target/linux/rockchip/image/armv8.mk +fi + # Libubox sed -i '/TARGET_CFLAGS/ s/$/ -Os/' package/libs/libubox/Makefile From 8f31191d1e8fc7005e03ebc5a67b479baa6aec58 Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Wed, 5 Nov 2025 10:27:12 +0800 Subject: [PATCH 08/78] Delete scripts/02-x86_64_target_only.sh --- scripts/02-x86_64_target_only.sh | 25 ------------------------- 1 file changed, 25 deletions(-) delete mode 100644 scripts/02-x86_64_target_only.sh diff --git a/scripts/02-x86_64_target_only.sh b/scripts/02-x86_64_target_only.sh deleted file mode 100644 index 4b9719c..0000000 --- a/scripts/02-x86_64_target_only.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -e - -sed -i 's/O2/O2 -march=x86-64-v2/g' include/target.mk - -# libsodium -sed -i 's,no-mips16 no-lto,no-mips16,g' feeds/packages/libs/libsodium/Makefile - -echo '#!/bin/sh -# Put your custom commands here that should be executed once -# the system init finished. By default this file does nothing. - -if ! grep "Default string" /tmp/sysinfo/model > /dev/null; then - echo should be fine -else - echo "Generic PC" > /tmp/sysinfo/model -fi - -status=$(cat /sys/devices/system/cpu/intel_pstate/status) - -if [ "$status" = "passive" ]; then - echo "active" | tee /sys/devices/system/cpu/intel_pstate/status -fi - -exit 0 -'> ./package/base-files/files/etc/rc.local From f3930d305474ef16bffebdb6f620e1f79266ab82 Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Wed, 5 Nov 2025 10:27:21 +0800 Subject: [PATCH 09/78] Delete scripts/02-rockchip_target_only.sh --- scripts/02-rockchip_target_only.sh | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 scripts/02-rockchip_target_only.sh diff --git a/scripts/02-rockchip_target_only.sh b/scripts/02-rockchip_target_only.sh deleted file mode 100644 index dbff93d..0000000 --- a/scripts/02-rockchip_target_only.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -e - -# 使用特定的优化 -sed -i 's,-mcpu=generic,-march=armv8-a+crc+crypto,g' include/target.mk -sed -i 's,kmod-r8168,kmod-r8169,g' target/linux/rockchip/image/armv8.mk From 5cefc9bfc6530e177e8280b9547648e5878aaf02 Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Wed, 5 Nov 2025 15:07:27 +0800 Subject: [PATCH 10/78] Update build.sh --- build.sh | 985 +++---------------------------------------------------- 1 file changed, 44 insertions(+), 941 deletions(-) diff --git a/build.sh b/build.sh index 527dcac..dbb5626 100644 --- a/build.sh +++ b/build.sh @@ -1,131 +1,40 @@ -#!/usr/bin/env bash -set -euo pipefail +#!/bin/bash -e -# ============================================================================= -# 颜色和样式配置 -# ============================================================================= -readonly RED_COLOR='\033[1;31m' -readonly GREEN_COLOR='\033[1;32m' -readonly YELLOW_COLOR='\033[1;33m' -readonly BLUE_COLOR='\033[1;34m' -readonly MAGENTA_COLOR='\033[1;35m' -readonly CYAN_COLOR='\033[1;36m' -readonly BOLD='\033[1m' -readonly RESET='\033[0m' +# 定义全局颜色 +export RED_COLOR='\e[1;31m' +export GREEN_COLOR='\e[1;32m' +export YELLOW_COLOR='\e[1;33m' +export BLUE_COLOR='\e[1;34m' +export MAGENTA_COLOR='\e[1;35m' +export CYAN_COLOR='\e[1;36m' +export BOLD='\e[1m' +export RESET='\e[0m' -# ============================================================================= -# 全局常量定义 -# ============================================================================= -readonly SCRIPT_NAME="OpenWRT 构建系统" -readonly SCRIPT_VERSION="2.0.1" -readonly AUTHOR="OPPEN321" -readonly BLOG="www.kejizero.online" -readonly MIRROR="https://raw.githubusercontent.com/QuickWrt/QuickWrt/refs/heads/master" -readonly SUPPORTED_ARCHITECTURES=("rockchip" "x86_64") -readonly REQUIRED_USER="zhao" -readonly BUILD_MODES=("accelerated" "normal" "toolchain-only") +# 当前脚本版本号 +VERSION='v1.2.0 (2025.11.04)' -# ============================================================================= -# 全局变量 -# ============================================================================= -GROUP_FLAG=false -START_TIME=$(date +%s) -CPU_CORES=$(nproc) -BUILD_MODE="normal" -TOOLCHAIN_ARCH="" -CURRENT_DATE=$(date +%s) - -# ============================================================================= -# 函数定义 -# ============================================================================= - -# 打印带颜色的消息 -print_color() { - local color=$1 - shift - echo -e "${color}$*${RESET}" -} - -# 打印错误消息并退出 -error_exit() { - print_color "$RED_COLOR" "❌ 错误: $1" - exit 1 -} - -# 打印警告消息 -print_warning() { - print_color "$YELLOW_COLOR" "⚠️ 警告: $1" -} - -# 打印成功消息 -print_success() { - print_color "$GREEN_COLOR" "✅ $1" -} - -# 打印信息消息 -print_info() { - print_color "$BLUE_COLOR" "ℹ️ 信息: $1" -} - -# 显示使用帮助 -show_usage() { - echo -e "\n${BOLD}使用方法:${RESET}" - echo -e " bash $0 [build_mode]" - echo -e "\n${BOLD}支持的架构:${RESET}" - for arch in "${SUPPORTED_ARCHITECTURES[@]}"; do - echo -e " • ${GREEN_COLOR}$arch${RESET}" - done - echo -e "\n${BOLD}支持的编译模式:${RESET}" - echo -e " • ${GREEN_COLOR}accelerated${RESET} - 加速编译(下载预编译工具链)" - echo -e " • ${GREEN_COLOR}normal${RESET} - 普通编译(完整编译所有组件)" - echo -e " • ${GREEN_COLOR}toolchain-only${RESET} - 仅编译工具链(用于缓存)" - echo -e "\n${BOLD}示例:${RESET}" - echo -e " bash $0 v24 x86_64 accelerated" - echo -e " bash $0 v24 rockchip normal" - echo -e " bash $0 v24 x86_64 toolchain-only" -} - -# 验证参数 -validate_arguments() { - local version="$1" - local arch="$2" - local mode="${3:-normal}" - - if [[ -z "$version" ]]; then - error_exit "未指定版本号" - fi - - if [[ -z "$arch" ]]; then - error_exit "未指定目标架构" - fi - - # 验证架构 - local valid_arch=false - for supported_arch in "${SUPPORTED_ARCHITECTURES[@]}"; do - if [[ "$arch" == "$supported_arch" ]]; then - valid_arch=true - break - fi - done - - if [[ "$valid_arch" == false ]]; then - error_exit "不支持的架构: '$arch'" - fi - - # 验证编译模式 - local valid_mode=false - for supported_mode in "${BUILD_MODES[@]}"; do - if [[ "$mode" == "$supported_mode" ]]; then - valid_mode=true - BUILD_MODE="$mode" - break - fi - done - - if [[ "$valid_mode" == false ]]; then - error_exit "不支持的编译模式: '$mode'" - fi -} +# 各变量默认值 +export AUTHOR="OPPEN321" +export BLOG="www.kejizero.online" +export MIRROR="https://openwrt.kejizero.xyz" +export ARCH=("rockchip" "x86_64") +export BUILD_MODE="${1:-accelerated}" +export CPU_CORES=$(nproc) +export GCC_VERSION=14 +case "$1" in + "accelerated") + export BUILD_MODE="加速编译" + ;; + "normal") + export BUILD_MODE="普通编译" + ;; + "toolchain-only") + export BUILD_MODE="仅工具链" + ;; + *) + export BUILD_MODE="加速编译" + ;; +esac show_banner() { clear @@ -143,825 +52,19 @@ show_banner() { echo -e "${BOLD}${BLUE_COLOR}║${RESET}${BOLD}${YELLOW_COLOR} Open Source · Tailored · High Performance ${RESET}${BOLD}${BLUE_COLOR}║${RESET}" echo -e "${BOLD}${BLUE_COLOR}║${RESET} ${BOLD}${BLUE_COLOR}║${RESET}" echo -e "${BOLD}${BLUE_COLOR}╠══════════════════════════════════════════════════════════════════╣${RESET}" - - printf "${BOLD}${BLUE_COLOR}║${RESET} %-8s %-50s ${BOLD}${BLUE_COLOR} ║${RESET}\n" "🛠️ 开发者:" "OPPEN321" - printf "${BOLD}${BLUE_COLOR}║${RESET} %-8s %-50s ${BOLD}${BLUE_COLOR} ║${RESET}\n" "🌐 博客:" "www.kejizero.online" - printf "${BOLD}${BLUE_COLOR}║${RESET} %-8s %-50s ${BOLD}${BLUE_COLOR} ║${RESET}\n" "💡 理念:" "开源 · 定制化 · 高性能" - printf "${BOLD}${BLUE_COLOR}║${RESET} %-8s %-50s ${BOLD}${BLUE_COLOR} ║${RESET}\n" "📦 版本:" "2.0.0" + echo -e "${BOLD}${BLUE_COLOR}║${RESET} 🛠️ 开发者: $AUTHOR ${BOLD}${BLUE_COLOR}║${RESET}" + echo -e "${BOLD}${BLUE_COLOR}║${RESET} 🌐 博客: $BLOG ${BOLD}${BLUE_COLOR}║${RESET}" + echo -e "${BOLD}${BLUE_COLOR}║${RESET} 💡 理念: 开源 · 定制化 · 高性能 ${BOLD}${BLUE_COLOR}║${RESET}" + echo -e "${BOLD}${BLUE_COLOR}║${RESET} 📦 版本: $VERSION ${BOLD}${BLUE_COLOR}║${RESET}" echo -e "${BOLD}${BLUE_COLOR}╠══════════════════════════════════════════════════════════════════╣${RESET}" - - printf "${BOLD}${BLUE_COLOR}║${RESET} %-8s %-50s ${BOLD}${BLUE_COLOR} ║${RESET}\n" "🔧 构建开始:" "$(date '+%Y-%m-%d %H:%M:%S')" - printf "${BOLD}${BLUE_COLOR}║${RESET} %-8s %-50s ${BOLD}${BLUE_COLOR}║${RESET}\n" "⚡ 处理器核心:" "$CPU_CORES 个" - printf "${BOLD}${BLUE_COLOR}║${RESET} %-8s %-50s ${BOLD}${BLUE_COLOR} ║${RESET}\n" "🐧 系统用户:" "$(whoami)" - - local mode_display - case "$BUILD_MODE" in - "accelerated") mode_display="加速编译" ;; - "normal") mode_display="普通编译" ;; - "toolchain-only") mode_display="仅工具链" ;; - *) mode_display="$BUILD_MODE" ;; - esac - printf "${BOLD}${BLUE_COLOR}║${RESET} %-8s %-50s ${BOLD}${BLUE_COLOR} ║${RESET}\n" "🚀 编译模式:" "$mode_display" - + echo -e "${BOLD}${BLUE_COLOR}║${RESET} 🔧 构建开始: $(date '+%Y-%m-%d %H:%M:%S') ${BOLD}${BLUE_COLOR}║${RESET}" + echo -e "${BOLD}${BLUE_COLOR}║${RESET} ⚡ 处理器核心: $CPU_CORES 个 ${BOLD}${BLUE_COLOR}║${RESET}" + echo -e "${BOLD}${BLUE_COLOR}║${RESET} 🐧 系统用户: $(whoami) ${BOLD}${BLUE_COLOR}║${RESET}" + echo -e "${BOLD}${BLUE_COLOR}║${RESET} 🔬 GCC 版本: $GCC_VERSION ${BOLD}${BLUE_COLOR}║${RESET}" + echo -e "${BOLD}${BLUE_COLOR}║${RESET} 🚀 编译模式: $BUILD_MODE ${BOLD}${BLUE_COLOR}║${RESET}" echo -e "${BOLD}${BLUE_COLOR}╚══════════════════════════════════════════════════════════════════╝${RESET}" echo -e "" } -# 初始化构建环境 -setup_build_environment() { - if [[ "$(id -u)" == "0" ]]; then - export FORCE_UNSAFE_CONFIGURE=1 - export FORCE=1 - print_warning "以 root 权限运行,已启用强制不安全配置" - fi -} - -# 设置下载进度条 -setup_curl_progress() { - if curl --help | grep -q progress-bar; then - CURL_OPTIONS="--progress-bar" - else - CURL_OPTIONS="--silent" - fi - export CURL_OPTIONS -} - -# 设置工具链架构 -setup_toolchain_arch() { - local arch="$1" - case "$arch" in - "x86_64") - TOOLCHAIN_ARCH="x86_64" - ;; - "rockchip") - TOOLCHAIN_ARCH="aarch64_generic" - ;; - *) - error_exit "未知架构: $arch" - ;; - esac - export TOOLCHAIN_ARCH - print_success "工具链架构设置为: $TOOLCHAIN_ARCH" -} - -# 编译脚本 - 准备源代码 -prepare_source_code() { - print_info "开始查询最新 OpenWRT 版本..." - tag_version="$(curl -s https://github.com/openwrt/openwrt/tags | grep -Eo "v[0-9\.]+\-*r*c*[0-9]*.tar.gz" | sed -n '/[2-9][4-9]/p' | sed -n 1p | sed 's/v//g' | sed 's/.tar.gz//g')" - export tag_version="$tag_version" - print_success "检测到最新版本: $tag_version" - - print_info "开始克隆源代码仓库..." - git -c advice.detachedHead=false clone --depth=1 --branch "v$tag_version" --single-branch --quiet https://github.com/openwrt/openwrt - git clone --depth=1 --quiet -b openwrt-24.10 https://github.com/immortalwrt/immortalwrt - git clone --depth=1 --quiet -b openwrt-24.10 https://github.com/openwrt/openwrt openwrt_snap - - print_info "正在进行源代码处理..." - find openwrt/package/* -maxdepth 0 ! -name 'firmware' ! -name 'kernel' ! -name 'base-files' ! -name 'Makefile' -exec rm -rf {} + - rm -rf ./openwrt_snap/package/firmware ./openwrt_snap/package/kernel ./openwrt_snap/package/base-files ./openwrt_snap/package/Makefile - cp -rf ./openwrt_snap/package/* ./openwrt/package/ - - print_info "为 Rockchip 架构替换 ImmortalWRT 组件以增强设备兼容性..." - rm -rf openwrt/package/boot/{rkbin,uboot-rockchip,arm-trusted-firmware-rockchip} - rm -rf openwrt/target/linux/rockchip - cp -rf immortalwrt/target/linux/rockchip openwrt/target/linux/rockchip - cp -rf immortalwrt/package/boot/uboot-rockchip openwrt/package/boot/uboot-rockchip - cp -rf immortalwrt/package/boot/arm-trusted-firmware-rockchip openwrt/package/boot/arm-trusted-firmware-rockchip - - print_info "正在克隆 OpenBox 仓库以支持后续编译" - git clone --depth=1 --quiet -b main https://github.com/QuickWrt/OpenBox - cp -rf ./OpenBox/doc/feeds/feeds.conf.default ./openwrt/feeds.conf.default - - print_info "正在复制密钥文件..." - if [ -d "openwrt" ]; then - cd openwrt || error_exit "进入 openwrt 目录失败" - - if cp -rf ../OpenBox/key.tar.gz ./key.tar.gz; then - if tar zxf key.tar.gz; then - rm -f key.tar.gz - print_info "密钥已复制并解压完成" - else - error_exit "解压 key.tar.gz 失败" - fi - else - error_exit "复制 key.tar.gz 失败" - fi - else - error_exit "未找到 openwrt 源码目录,下载源码失败" - fi - - print_info "正在更新软件源 feeds..." - echo -e "${BLUE_COLOR}├─ 更新软件包列表...${RESET}" - if ./scripts/feeds update -a > /dev/null 2>&1; then - echo -e "${GREEN_COLOR}├─ 软件包列表更新成功${RESET}" - else - error_exit "feeds 更新失败" - fi - - echo -e "${BLUE_COLOR}├─ 安装软件包依赖...${RESET}" - if ./scripts/feeds install -a > /dev/null 2>&1; then - echo -e "${GREEN_COLOR}└─ 软件包依赖安装完成${RESET}" - print_success "Feeds 更新和安装完成" - else - error_exit "feeds 安装失败" - fi -} - -# 执行构建脚本 -execute_build_scripts() { - local arch="$1" - - print_info "下载并执行构建脚本..." - local scripts=( - 00-prepare_base.sh - 01-prepare_package.sh - 02-rockchip_target_only.sh - 02-x86_64_target_only.sh - ) - - # 下载所有脚本 - echo -e "${BLUE_COLOR}├─ 下载构建脚本...${RESET}" - for script in "${scripts[@]}"; do - if curl -sO "$MIRROR/scripts/$script"; then - echo -e "${GREEN_COLOR}│ ✓ 已下载: $script${RESET}" - else - error_exit "下载脚本 $script 失败" - fi - done - - echo -e "${BLUE_COLOR}├─ 设置脚本执行权限...${RESET}" - if chmod 0755 ./*.sh; then - echo -e "${GREEN_COLOR}│ ✓ 权限设置完成${RESET}" - else - error_exit "设置脚本权限失败" - fi - - # 执行基础准备脚本 - echo -e "${BLUE_COLOR}├─ 执行基础环境准备...${RESET}" - local base_scripts=( - "00-prepare_base.sh" - "01-prepare_package.sh" - ) - - for script in "${base_scripts[@]}"; do - echo -e "${BLUE_COLOR}│ ├─ 执行: $script${RESET}" - if bash "$script" > /dev/null 2>&1; then - echo -e "${GREEN_COLOR}│ │ ✓ 完成${RESET}" - else - error_exit "脚本 $script 执行失败" - fi - done - - # 执行架构特定脚本 - echo -e "${BLUE_COLOR}├─ 执行架构特定配置...${RESET}" - if [[ "$arch" == "rockchip" ]]; then - echo -e "${BLUE_COLOR}│ ├─ 配置 Rockchip 架构${RESET}" - if bash 02-rockchip_target_only.sh > /dev/null 2>&1; then - echo -e "${GREEN_COLOR}│ │ ✓ Rockchip 架构配置完成${RESET}" - print_success "Rockchip 架构配置完成" - else - error_exit "Rockchip 架构配置脚本执行失败" - fi - elif [[ "$arch" == "x86_64" ]]; then - echo -e "${BLUE_COLOR}│ ├─ 配置 x86_64 架构${RESET}" - if bash 02-x86_64_target_only.sh > /dev/null 2>&1; then - echo -e "${GREEN_COLOR}│ │ ✓ x86_64 架构配置完成${RESET}" - print_success "x86_64 架构配置完成" - else - error_exit "x86_64 架构配置脚本执行失败" - fi - fi - - # 清理临时脚本文件 - echo -e "${BLUE_COLOR}├─ 清理临时文件...${RESET}" - if rm -f 0*-*.sh; then - echo -e "${GREEN_COLOR}└─ ✓ 临时文件清理完成${RESET}" - else - print_warning "清理临时文件时出现警告,但可继续执行" - fi - - print_success "构建环境准备完成" -} - -# 加载配置文件 -load_configuration() { - local arch="$1" - local config_file="" - - print_info "加载配置文件..." - - # 根据架构选择配置文件 - case "$arch" in - rockchip) - config_file="../OpenBox/config/config-rockchip" - echo -e "${BLUE_COLOR}├─ 选择 Rockchip 架构配置${RESET}" - ;; - x86_64) - config_file="../OpenBox/config/config-x86_64" - echo -e "${BLUE_COLOR}├─ 选择 x86_64 架构配置${RESET}" - ;; - esac - - # 复制配置文件 - if [[ -n "$config_file" ]] && cp -rf "$config_file" ./.config; then - echo -e "${GREEN_COLOR}└─ ✓ 配置文件加载完成${RESET}" - print_success "$arch 架构配置文件已加载" - fi - - # 更新版本号 - if [[ -n "$tag_version" ]]; then - echo -e "${BLUE_COLOR}├─ 更新版本信息...${RESET}" - sed -i "s|^CONFIG_VERSION_NUMBER=\".*\"|CONFIG_VERSION_NUMBER=\"$tag_version\"|" .config - sed -i "s|^CONFIG_VERSION_REPO=\".*\"|CONFIG_VERSION_REPO=\"https://downloads.openwrt.org/releases/$tag_version\"|" .config - echo -e "${GREEN_COLOR}└─ ✓ 已更新版本号为:$tag_version${RESET}" - fi -} - -# 生成 Config 文件 -generate_config_file() { - print_info "生成 Config 文件..." - - echo -e "${BLUE_COLOR}├─ 清理临时目录...${RESET}" - if [ -d tmp ]; then - if rm -rf tmp/*; then - echo -e "${GREEN_COLOR}│ ✓ 临时目录已清理${RESET}" - else - print_warning "清理临时目录时出现警告" - fi - else - echo -e "${YELLOW_COLOR}│ ⚠ 未找到 tmp 目录,跳过清理${RESET}" - fi - - echo -e "${BLUE_COLOR}├─ 执行 make defconfig...${RESET}" - if make defconfig > /dev/null 2>&1; then - echo -e "${GREEN_COLOR}└─ ✓ Config 文件生成完成${RESET}" - else - error_exit "执行 make defconfig 失败" - fi - - print_success "Config 文件生成完成" -} - -# 下载预编译工具链(加速模式) -download_prebuilt_toolchain() { - print_info "下载预编译工具链(加速模式)..." - - echo -e "${BLUE_COLOR}├─ 检测系统信息...${RESET}" - if [[ -f /etc/os-release ]]; then - source /etc/os-release - echo -e "${GREEN_COLOR}│ ✓ 检测到系统: $PRETTY_NAME${RESET}" - else - echo -e "${YELLOW_COLOR}│ ⚠ 无法检测系统信息${RESET}" - fi - - echo -e "${BLUE_COLOR}├─ 下载工具链文件...${RESET}" - local TOOLCHAIN_URL="https://github.com/QuickWrt/ZeroWrt/releases/download/Toolchain-Cache" - local toolchain_file="toolchain_musl_${TOOLCHAIN_ARCH}_gcc-13.tar.zst" - - if curl -L "${TOOLCHAIN_URL}/${toolchain_file}" -o toolchain.tar.zst ${CURL_OPTIONS}; then - echo -e "${GREEN_COLOR}│ ✓ 工具链下载完成${RESET}" - else - error_exit "工具链下载失败" - fi - - echo -e "${BLUE_COLOR}├─ 解压工具链...${RESET}" - if command -v zstd >/dev/null 2>&1; then - if tar -I "zstd" -xf toolchain.tar.zst; then - echo -e "${GREEN_COLOR}│ ✓ 工具链解压完成${RESET}" - else - error_exit "工具链解压失败" - fi - else - error_exit "未找到 zstd 命令,请先安装 zstd" - fi - - echo -e "${BLUE_COLOR}├─ 清理临时文件...${RESET}" - if rm -f toolchain.tar.zst; then - echo -e "${GREEN_COLOR}│ ✓ 临时文件清理完成${RESET}" - else - print_warning "清理临时文件时出现警告" - fi - - echo -e "${BLUE_COLOR}├─ 创建目录结构...${RESET}" - if mkdir -p bin; then - echo -e "${GREEN_COLOR}│ ✓ 目录创建完成${RESET}" - else - error_exit "创建目录失败" - fi - - echo -e "${BLUE_COLOR}├─ 更新文件时间戳...${RESET}" - if find ./staging_dir/ -name '*' -exec touch {} \; >/dev/null 2>&1 && \ - find ./tmp/ -name '*' -exec touch {} \; >/dev/null 2>&1; then - echo -e "${GREEN_COLOR}└─ ✓ 文件时间戳更新完成${RESET}" - else - print_warning "更新文件时间戳时出现警告" - fi - - print_success "预编译工具链准备完成" -} - -# 编译工具链(普通模式或工具链模式) -compile_toolchain() { - print_info "开始编译工具链..." - local starttime=$(date +'%Y-%m-%d %H:%M:%S') - - echo -e "${BLUE_COLOR}├─ 编译工具链...${RESET}" - if make -j"$CPU_CORES" toolchain/compile || make -j"$CPU_CORES" toolchain/compile V=s; then - echo -e "${GREEN_COLOR}│ ✓ 工具链编译完成${RESET}" - else - error_exit "工具链编译失败" - fi - - # 如果是工具链模式,打包并退出 - if [[ "$BUILD_MODE" == "toolchain-only" ]]; then - echo -e "${BLUE_COLOR}├─ 打包工具链缓存...${RESET}" - if mkdir -p toolchain-cache && \ - tar -I "zstd -19 -T$(nproc --all)" -cf "toolchain-cache/toolchain_musl_${TOOLCHAIN_ARCH}_gcc-13.tar.zst" \ - ./build_dir ./dl ./staging_dir ./tmp; then - echo -e "${GREEN_COLOR}│ ✓ 工具链缓存完成${RESET}" - else - error_exit "工具链缓存打包失败" - fi - - local endtime=$(date +'%Y-%m-%d %H:%M:%S') - local start_seconds=$(date --date="$starttime" +%s) - local end_seconds=$(date --date="$endtime" +%s) - local SEC=$((end_seconds-start_seconds)) - - echo -e "${GREEN_COLOR}└─ ✓ 工具链任务完成,耗时: $(( SEC / 3600 ))h,$(( (SEC % 3600) / 60 ))m,$(( (SEC % 3600) % 60 ))s${RESET}" - exit 0 - fi - - print_success "工具链编译完成" -} - -# 编译 OpenWRT -compile_openwrt() { - print_info "开始编译 OpenWRT..." - local starttime=$(date +'%Y-%m-%d %H:%M:%S') - - echo -e "${BLUE_COLOR}├─ 更新 os-release 构建日期...${RESET}" - sed -i "/BUILD_DATE/d" package/base-files/files/usr/lib/os-release - sed -i "/BUILD_ID/aBUILD_DATE=\"$CURRENT_DATE\"" package/base-files/files/usr/lib/os-release - - echo -e "${BLUE_COLOR}├─ 执行 make 编译...${RESET}" - if make -j"$CPU_CORES" IGNORE_ERRORS="n m"; then - echo -e "${GREEN_COLOR}│ ✓ 编译过程完成${RESET}" - else - error_exit "OpenWrt 编译失败" - fi - - # 计算编译时间 - local endtime=$(date +'%Y-%m-%d %H:%M:%S') - local start_seconds=$(date --date="$starttime" +%s) - local end_seconds=$(date --date="$endtime" +%s) - local SEC=$((end_seconds-start_seconds)) - - echo -e "${BLUE_COLOR}├─ 检查编译结果...${RESET}" - if [ -f bin/targets/*/*/sha256sums ]; then - echo -e "${GREEN_COLOR}│ ✓ Build success! ${RESET}" - else - echo -e "${RED_COLOR}│ ✗ Build error... ${RESET}" - echo -e "${BLUE_COLOR}└─ 编译耗时: $(( SEC / 3600 ))h,$(( (SEC % 3600) / 60 ))m,$(( (SEC % 3600) % 60 ))s${RESET}" - exit 1 - fi - - echo -e "${BLUE_COLOR}└─ 编译耗时: $(( SEC / 3600 ))h,$(( (SEC % 3600) / 60 ))m,$(( (SEC % 3600) % 60 ))s${RESET}" -} - -# 获取内核版本并设置 kmod 包名 -setup_kmod_package_name() { - print_info "设置 KMOD 包名..." - - # 检查本地内核版本文件是否存在 - if [ ! -f "include/kernel-6.6" ]; then - error_exit "内核版本文件 include/kernel-6.6 不存在" - fi - - echo -e "${BLUE_COLOR}├─ 读取内核版本信息...${RESET}" - get_kernel_version=$(cat include/kernel-6.6) - - if [ -z "$get_kernel_version" ]; then - error_exit "无法读取内核版本信息" - fi - - echo -e "${BLUE_COLOR}├─ 计算 KMOD 哈希值...${RESET}" - kmod_hash=$(echo -e "$get_kernel_version" | awk -F'HASH-' '{print $2}' | awk '{print $1}' | tail -1 | md5sum | awk '{print $1}') - - if [ -z "$kmod_hash" ]; then - error_exit "KMOD 哈希值计算失败" - fi - - kmodpkg_name=$(echo $(echo -e "$get_kernel_version" | awk -F'HASH-' '{print $2}' | awk '{print $1}')~$(echo $kmod_hash)-r1) - - if [ -z "$kmodpkg_name" ]; then - error_exit "KMOD 包名生成失败" - fi - - echo -e "${GREEN_COLOR}└─ ✓ KMOD 包名设置为: $kmodpkg_name${RESET}" - print_success "KMOD 包配置完成" -} - -# 打包和生成OTA文件 -package_and_generate_ota() { - local architecture="$1" - - print_info "开始打包和生成OTA文件..." - - if [ "$architecture" = "x86_64" ]; then - process_x86_64 - elif [ "$architecture" = "rockchip" ]; then - process_rockchip - else - print_warning "未知架构: $architecture,跳过打包和OTA生成" - fi - - print_success "打包和OTA生成完成" -} - -# 处理 x86_64 架构 -process_x86_64() { - - print_info "处理 x86_64 架构的打包..." - - # KMOD 包处理 - echo -e "${BLUE_COLOR}├─ 准备 KMOD 包...${RESET}" - if cp -a bin/targets/x86/*/packages $kmodpkg_name/ && \ - rm -f $kmodpkg_name/Packages* && \ - cp -a bin/packages/x86_64/base/rtl88*a-firmware*.ipk $kmodpkg_name/ && \ - cp -a bin/packages/x86_64/base/natflow*.ipk $kmodpkg_name/; then - echo -e "${GREEN_COLOR}│ ✓ KMOD 文件复制完成${RESET}" - else - print_warning "KMOD 文件复制过程中出现警告" - fi - - echo -e "${BLUE_COLOR}├─ 签名 KMOD 包...${RESET}" - if [ -f "kmod-sign" ] && bash kmod-sign $kmodpkg_name; then - echo -e "${GREEN_COLOR}│ ✓ KMOD 包签名完成${RESET}" - else - print_warning "跳过 KMOD 签名(未找到 kmod-sign 脚本)" - fi - - echo -e "${BLUE_COLOR}├─ 打包 KMOD...${RESET}" - if tar zcf x86_64-$kmodpkg_name.tar.gz $kmodpkg_name; then - echo -e "${GREEN_COLOR}│ ✓ KMOD 打包完成${RESET}" - else - error_exit "KMOD 打包失败" - fi - - echo -e "${BLUE_COLOR}├─ 清理临时文件...${RESET}" - rm -rf $kmodpkg_name - echo -e "${GREEN_COLOR}└─ ✓ 临时文件清理完成${RESET}" - - # 生成 OTA JSON - generate_x86_64_ota_json "$version" -} - -# 生成 x86_64 OTA JSON -generate_x86_64_ota_json() { - - print_info "生成 x86_64 OTA JSON 文件..." - - echo -e "${BLUE_COLOR}├─ 创建 OTA 目录...${RESET}" - mkdir -p ota - - echo -e "${BLUE_COLOR}├─ 计算 SHA256 校验和...${RESET}" - local OTA_URL="https://github.com/QuickWrt/ZeroWrt/releases/download" - local VERSION_NUMBER=$(echo "$tag_version" | sed 's/v//g') - local SHA256=$(sha256sum bin/targets/x86/64*/*-generic-squashfs-combined-efi.img.gz | awk '{print $1}') - - echo -e "${BLUE_COLOR}├─ 生成 JSON 文件...${RESET}" - cat > ota/x86_64.json < ota/rockchip.json < Date: Wed, 5 Nov 2025 15:39:05 +0800 Subject: [PATCH 11/78] Update build.sh --- build.sh | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/build.sh b/build.sh index dbb5626..4b358ad 100644 --- a/build.sh +++ b/build.sh @@ -17,11 +17,24 @@ VERSION='v1.2.0 (2025.11.04)' export AUTHOR="OPPEN321" export BLOG="www.kejizero.online" export MIRROR="https://openwrt.kejizero.xyz" -export ARCH=("rockchip" "x86_64") -export BUILD_MODE="${1:-accelerated}" export CPU_CORES=$(nproc) -export GCC_VERSION=14 +export GCC_VERSION=${gcc_version:-13} + +# 设备类型 case "$1" in + "rockchip") + export ARCH="rockchip" + ;; + "x86_64") + export ARCH "x86_64" + ;; + *) + export ARCH="x86_64" + ;; +esac + +# 编译模式 +case "$2" in "accelerated") export BUILD_MODE="加速编译" ;; @@ -62,6 +75,7 @@ show_banner() { echo -e "${BOLD}${BLUE_COLOR}║${RESET} ⚡ 处理器核心: $CPU_CORES 个 ${BOLD}${BLUE_COLOR}║${RESET}" echo -e "${BOLD}${BLUE_COLOR}║${RESET} 🐧 系统用户: $(whoami) ${BOLD}${BLUE_COLOR}║${RESET}" echo -e "${BOLD}${BLUE_COLOR}║${RESET} 🔬 GCC 版本: $GCC_VERSION ${BOLD}${BLUE_COLOR}║${RESET}" + echo -e "${BOLD}${BLUE_COLOR}║${RESET} 🏗️ 构建类型: $ARCH ${BOLD}${BLUE_COLOR}║${RESET}" echo -e "${BOLD}${BLUE_COLOR}║${RESET} 🚀 编译模式: $BUILD_MODE ${BOLD}${BLUE_COLOR}║${RESET}" echo -e "${BOLD}${BLUE_COLOR}╚══════════════════════════════════════════════════════════════════╝${RESET}" echo -e "" From 9cef442222c7927b10a7a2bc2d0248bf8517aba1 Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Wed, 5 Nov 2025 15:56:59 +0800 Subject: [PATCH 12/78] Update build.sh --- build.sh | 66 +++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 49 insertions(+), 17 deletions(-) diff --git a/build.sh b/build.sh index 4b358ad..cbdc3ee 100644 --- a/build.sh +++ b/build.sh @@ -19,20 +19,7 @@ export BLOG="www.kejizero.online" export MIRROR="https://openwrt.kejizero.xyz" export CPU_CORES=$(nproc) export GCC_VERSION=${gcc_version:-13} - -# 设备类型 -case "$1" in - "rockchip") - export ARCH="rockchip" - ;; - "x86_64") - export ARCH "x86_64" - ;; - *) - export ARCH="x86_64" - ;; -esac - +export PASSWORD="MzE4MzU3M2p6" # 编译模式 case "$2" in "accelerated") @@ -49,6 +36,52 @@ case "$2" in ;; esac +validate_password() { + clear + local attempts=0 + local max_attempts=3 + + while [ $attempts -lt $max_attempts ]; do + echo -e "${BOLD}${MAGENTA}════════════════════════════════════════════════════════════════${RESET}" + echo -e "${BOLD}${CYAN} 🔐 ZeroWrt 私有系统访问验证 🔐${RESET}" + echo -e "${BOLD}${MAGENTA}════════════════════════════════════════════════════════════════${RESET}" + echo "" + echo -e "${BOLD}${YELLOW}⚠️ 此系统为授权用户专用,请验证您的身份${RESET}" + echo "" + echo -e "${BOLD}${GOLD}请输入访问密码:${RESET}" + echo -n -e "${BOLD}${GREEN}➤ ${RESET}" + read -s user_input + echo "" + + local reversed_input=$(echo "$user_input" | rev) + local encoded_reversed_input=$(echo -n "$reversed_input" | base64) + encoded_reversed_input=$(echo -n "$encoded_reversed_input" | tr -d '\n') + + if [ "$encoded_reversed_input" = "$ENCODED_REVERSED_PASSWORD" ]; then + echo "" + echo -e "${BOLD}${GREEN}✅ 身份验证成功!正在加载系统...${RESET}" + echo -e "${BOLD}${MAGENTA}════════════════════════════════════════════════════════════════${RESET}" + sleep 1 + return 0 + else + attempts=$((attempts + 1)) + remaining=$((max_attempts - attempts)) + echo "" + echo -e "${BOLD}${RED}❌ 密码错误!剩余尝试次数: ${remaining}${RESET}" + + if [ $attempts -eq $max_attempts ]; then + echo "" + echo -e "${BOLD}${RED}🚫 验证失败次数过多,系统退出!${RESET}" + echo -e "${BOLD}${YELLOW}📞 请联系系统管理员获取访问权限${RESET}" + echo -e "${BOLD}${MAGENTA}════════════════════════════════════════════════════════════════${RESET}" + exit 1 + fi + sleep 2 + clear + fi + done +} + show_banner() { clear echo -e "" @@ -68,17 +101,16 @@ show_banner() { echo -e "${BOLD}${BLUE_COLOR}║${RESET} 🛠️ 开发者: $AUTHOR ${BOLD}${BLUE_COLOR}║${RESET}" echo -e "${BOLD}${BLUE_COLOR}║${RESET} 🌐 博客: $BLOG ${BOLD}${BLUE_COLOR}║${RESET}" echo -e "${BOLD}${BLUE_COLOR}║${RESET} 💡 理念: 开源 · 定制化 · 高性能 ${BOLD}${BLUE_COLOR}║${RESET}" - echo -e "${BOLD}${BLUE_COLOR}║${RESET} 📦 版本: $VERSION ${BOLD}${BLUE_COLOR}║${RESET}" - + echo -e "${BOLD}${BLUE_COLOR}║${RESET} 📦 版本: $VERSION ${BOLD}${BLUE_COLOR}║${RESET}" echo -e "${BOLD}${BLUE_COLOR}╠══════════════════════════════════════════════════════════════════╣${RESET}" echo -e "${BOLD}${BLUE_COLOR}║${RESET} 🔧 构建开始: $(date '+%Y-%m-%d %H:%M:%S') ${BOLD}${BLUE_COLOR}║${RESET}" echo -e "${BOLD}${BLUE_COLOR}║${RESET} ⚡ 处理器核心: $CPU_CORES 个 ${BOLD}${BLUE_COLOR}║${RESET}" echo -e "${BOLD}${BLUE_COLOR}║${RESET} 🐧 系统用户: $(whoami) ${BOLD}${BLUE_COLOR}║${RESET}" echo -e "${BOLD}${BLUE_COLOR}║${RESET} 🔬 GCC 版本: $GCC_VERSION ${BOLD}${BLUE_COLOR}║${RESET}" - echo -e "${BOLD}${BLUE_COLOR}║${RESET} 🏗️ 构建类型: $ARCH ${BOLD}${BLUE_COLOR}║${RESET}" echo -e "${BOLD}${BLUE_COLOR}║${RESET} 🚀 编译模式: $BUILD_MODE ${BOLD}${BLUE_COLOR}║${RESET}" echo -e "${BOLD}${BLUE_COLOR}╚══════════════════════════════════════════════════════════════════╝${RESET}" echo -e "" } +validate_password show_banner From e747e098a712620c2ab96b2298210c77dd15569c Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Wed, 5 Nov 2025 15:58:06 +0800 Subject: [PATCH 13/78] Update build.sh --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index cbdc3ee..84e7421 100644 --- a/build.sh +++ b/build.sh @@ -57,7 +57,7 @@ validate_password() { local encoded_reversed_input=$(echo -n "$reversed_input" | base64) encoded_reversed_input=$(echo -n "$encoded_reversed_input" | tr -d '\n') - if [ "$encoded_reversed_input" = "$ENCODED_REVERSED_PASSWORD" ]; then + if [ "$encoded_reversed_input" = "$PASSWORD" ]; then echo "" echo -e "${BOLD}${GREEN}✅ 身份验证成功!正在加载系统...${RESET}" echo -e "${BOLD}${MAGENTA}════════════════════════════════════════════════════════════════${RESET}" From 623b21e7dcd07e6ab77d3ede625b7c6ebb3be377 Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Wed, 5 Nov 2025 16:00:04 +0800 Subject: [PATCH 14/78] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E5=AF=86=E7=A0=81?= =?UTF-8?q?=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.sh | 41 +++++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/build.sh b/build.sh index 84e7421..499ec73 100644 --- a/build.sh +++ b/build.sh @@ -7,6 +7,7 @@ export YELLOW_COLOR='\e[1;33m' export BLUE_COLOR='\e[1;34m' export MAGENTA_COLOR='\e[1;35m' export CYAN_COLOR='\e[1;36m' +export GOLD_COLOR='\e[1;33m' export BOLD='\e[1m' export RESET='\e[0m' @@ -20,6 +21,7 @@ export MIRROR="https://openwrt.kejizero.xyz" export CPU_CORES=$(nproc) export GCC_VERSION=${gcc_version:-13} export PASSWORD="MzE4MzU3M2p6" + # 编译模式 case "$2" in "accelerated") @@ -42,14 +44,14 @@ validate_password() { local max_attempts=3 while [ $attempts -lt $max_attempts ]; do - echo -e "${BOLD}${MAGENTA}════════════════════════════════════════════════════════════════${RESET}" - echo -e "${BOLD}${CYAN} 🔐 ZeroWrt 私有系统访问验证 🔐${RESET}" - echo -e "${BOLD}${MAGENTA}════════════════════════════════════════════════════════════════${RESET}" + echo -e "${BOLD}${MAGENTA_COLOR}════════════════════════════════════════════════════════════════${RESET}" + echo -e "${BOLD}${CYAN_COLOR} 🔐 ZeroWrt 私有系统访问验证 🔐${RESET}" + echo -e "${BOLD}${MAGENTA_COLOR}════════════════════════════════════════════════════════════════${RESET}" echo "" - echo -e "${BOLD}${YELLOW}⚠️ 此系统为授权用户专用,请验证您的身份${RESET}" + echo -e "${BOLD}${YELLOW_COLOR}⚠️ 此系统为授权用户专用,请验证您的身份${RESET}" echo "" - echo -e "${BOLD}${GOLD}请输入访问密码:${RESET}" - echo -n -e "${BOLD}${GREEN}➤ ${RESET}" + echo -e "${BOLD}${GOLD_COLOR}请输入访问密码:${RESET}" + echo -n -e "${BOLD}${GREEN_COLOR}➤ ${RESET}" read -s user_input echo "" @@ -59,23 +61,24 @@ validate_password() { if [ "$encoded_reversed_input" = "$PASSWORD" ]; then echo "" - echo -e "${BOLD}${GREEN}✅ 身份验证成功!正在加载系统...${RESET}" - echo -e "${BOLD}${MAGENTA}════════════════════════════════════════════════════════════════${RESET}" - sleep 1 + echo -e "${BOLD}${GREEN_COLOR}✅ 身份验证成功!正在加载系统...${RESET}" + echo -e "${BOLD}${MAGENTA_COLOR}════════════════════════════════════════════════════════════════${RESET}" + sleep 2 return 0 else attempts=$((attempts + 1)) remaining=$((max_attempts - attempts)) echo "" - echo -e "${BOLD}${RED}❌ 密码错误!剩余尝试次数: ${remaining}${RESET}" + echo -e "${BOLD}${RED_COLOR}❌ 密码错误!剩余尝试次数: ${remaining}${RESET}" if [ $attempts -eq $max_attempts ]; then echo "" - echo -e "${BOLD}${RED}🚫 验证失败次数过多,系统退出!${RESET}" - echo -e "${BOLD}${YELLOW}📞 请联系系统管理员获取访问权限${RESET}" - echo -e "${BOLD}${MAGENTA}════════════════════════════════════════════════════════════════${RESET}" + echo -e "${BOLD}${RED_COLOR}🚫 验证失败次数过多,系统退出!${RESET}" + echo -e "${BOLD}${YELLOW_COLOR}📞 请联系系统管理员获取访问权限${RESET}" + echo -e "${BOLD}${MAGENTA_COLOR}════════════════════════════════════════════════════════════════${RESET}" exit 1 fi + echo -e "${BOLD}${YELLOW_COLOR}⏳ 2秒后重新尝试...${RESET}" sleep 2 clear fi @@ -101,7 +104,8 @@ show_banner() { echo -e "${BOLD}${BLUE_COLOR}║${RESET} 🛠️ 开发者: $AUTHOR ${BOLD}${BLUE_COLOR}║${RESET}" echo -e "${BOLD}${BLUE_COLOR}║${RESET} 🌐 博客: $BLOG ${BOLD}${BLUE_COLOR}║${RESET}" echo -e "${BOLD}${BLUE_COLOR}║${RESET} 💡 理念: 开源 · 定制化 · 高性能 ${BOLD}${BLUE_COLOR}║${RESET}" - echo -e "${BOLD}${BLUE_COLOR}║${RESET} 📦 版本: $VERSION ${BOLD}${BLUE_COLOR}║${RESET}" + echo -e "${BOLD}${BLUE_COLOR}║${RESET} 📦 版本: $VERSION ${BOLD}${BLUE_COLOR}║${RESET}" + echo -e "${BOLD}${BLUE_COLOR}╠══════════════════════════════════════════════════════════════════╣${RESET}" echo -e "${BOLD}${BLUE_COLOR}║${RESET} 🔧 构建开始: $(date '+%Y-%m-%d %H:%M:%S') ${BOLD}${BLUE_COLOR}║${RESET}" echo -e "${BOLD}${BLUE_COLOR}║${RESET} ⚡ 处理器核心: $CPU_CORES 个 ${BOLD}${BLUE_COLOR}║${RESET}" @@ -112,5 +116,10 @@ show_banner() { echo -e "" } -validate_password -show_banner +# 主执行逻辑 +main() { + validate_password + show_banner +} + +main "$@" From 62f2bb9414864bf60bdac3b6f05002fd777c45ed Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Wed, 5 Nov 2025 16:34:45 +0800 Subject: [PATCH 15/78] Update build.sh --- build.sh | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/build.sh b/build.sh index 499ec73..82d8e2a 100644 --- a/build.sh +++ b/build.sh @@ -38,6 +38,7 @@ case "$2" in ;; esac +# 密码验证 validate_password() { clear local attempts=0 @@ -85,6 +86,7 @@ validate_password() { done } +# 打印 show_banner() { clear echo -e "" @@ -116,10 +118,86 @@ show_banner() { echo -e "" } +# 初始化构建环境 +setup_build_environment() { + if [[ "$(id -u)" == "0" ]]; then + export FORCE_UNSAFE_CONFIGURE=1 FORCE=1 + echo -e "${BOLD}${RED_COLOR}以 root 权限运行,已启用强制不安全配置${RESET}" + fi +} + +# 设置下载进度条 +setup_curl_progress() { + if curl --help | grep -q progress-bar; then + CURL_OPTIONS="--progress-bar" + else + CURL_OPTIONS="--silent" + fi + export CURL_OPTIONS +} + +# 编译脚本 - 克隆源代码 +prepare_source_code() { + ### 第一步:查询版本 ### + clear + echo -e "${BOLD}${BLUE_COLOR}■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" + echo -e "${BOLD}${WHITE} 准备源代码 [1/4]${RESET}" + echo -e "${BOLD}${BLUE_COLOR}■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" + echo "" + echo -e " ${BOLD}${CYAN_COLOR}⟳${RESET} ${BOLD}查询最新 OpenWRT 版本${RESET}" + + # 获取版本号 + tag_version="$(curl -s https://github.com/openwrt/openwrt/tags | grep -Eo "v[0-9\.]+\-*r*c*[0-9]*.tar.gz" | sed -n '/[2-9][4-9]/p' | sed -n 1p | sed 's/v//g' | sed 's/.tar.gz//g')" + export tag_version="$tag_version" + + echo -e " ${BOLD}${GREEN_COLOR}✓${RESET} ${BOLD}版本检测完成${RESET}" + echo -e " ${BOLD}${YELLOW_COLOR}➤${RESET} ${BOLD}最新版本: ${GREEN_COLOR}$tag_version${RESET}" + echo "" + + ### 第二步:克隆代码 ### + clear + echo -e "${BOLD}${BLUE_COLOR}■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" + echo -e "${BOLD}${WHITE} 克隆源代码 [2/4]${RESET}" + echo -e "${BOLD}${BLUE_COLOR}■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" + echo "" + + echo -e " ${BOLD}${CYAN_COLOR}⟳${RESET} ${BOLD}开始克隆源代码仓库...${RESET}" + echo -e " ${BOLD}${MAGENTA_COLOR}│${RESET}" + echo -e " ${BOLD}${MAGENTA_COLOR}├─ 📦 仓库: ${CYAN_COLOR}https://github.com/openwrt/openwrt${RESET}" + echo -e " ${BOLD}${MAGENTA_COLOR}├─ 🏷️ 版本: ${YELLOW_COLOR}v$tag_version${RESET}" + echo -e " ${BOLD}${MAGENTA_COLOR}│${RESET}" + + # 显示克隆进度 + echo -e " ${BOLD}${CYAN_COLOR}⟳${RESET} ${BOLD}正在下载源代码,请稍候...${RESET}" + + # 克隆源代码(隐藏所有错误输出) + if git -c advice.detachedHead=false clone --depth=1 --branch "v$tag_version" --single-branch --quiet https://github.com/openwrt/openwrt 2>/dev/null; then + echo -e " ${BOLD}${MAGENTA_COLOR}│${RESET}" + echo -e " ${BOLD}${GREEN_COLOR}✓${RESET} ${BOLD}源代码克隆成功${RESET}" + echo -e " ${BOLD}${YELLOW_COLOR}➤${RESET} ${BOLD}存储位置: ${GREEN_COLOR}$(pwd)/openwrt${RESET}" + echo -e " ${BOLD}${YELLOW_COLOR}➤${RESET} ${BOLD}分支版本: ${GREEN_COLOR}v$tag_version${RESET}" + else + echo -e " ${BOLD}${MAGENTA_COLOR}│${RESET}" + echo -e " ${BOLD}${RED_COLOR}✗${RESET} ${BOLD}源代码克隆失败${RESET}" + return 1 + fi + echo "" + + ### 第三步:更新 feeds.conf.default ### + clear + echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" + echo -e "${BOLD}${WHITE} 更新 feeds.conf.default [3/4]${RESET}" + echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" + echo "" +} + # 主执行逻辑 main() { validate_password show_banner + setup_build_environment + setup_curl_progress + prepare_source_code } main "$@" From 3c037ed4a3a57be5313e0ee70e0575799104431d Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Wed, 5 Nov 2025 16:36:11 +0800 Subject: [PATCH 16/78] Update build.sh --- build.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/build.sh b/build.sh index 82d8e2a..bfeadc9 100644 --- a/build.sh +++ b/build.sh @@ -106,8 +106,7 @@ show_banner() { echo -e "${BOLD}${BLUE_COLOR}║${RESET} 🛠️ 开发者: $AUTHOR ${BOLD}${BLUE_COLOR}║${RESET}" echo -e "${BOLD}${BLUE_COLOR}║${RESET} 🌐 博客: $BLOG ${BOLD}${BLUE_COLOR}║${RESET}" echo -e "${BOLD}${BLUE_COLOR}║${RESET} 💡 理念: 开源 · 定制化 · 高性能 ${BOLD}${BLUE_COLOR}║${RESET}" - echo -e "${BOLD}${BLUE_COLOR}║${RESET} 📦 版本: $VERSION ${BOLD}${BLUE_COLOR}║${RESET}" - + echo -e "${BOLD}${BLUE_COLOR}║${RESET} 📦 版本: $VERSION ${BOLD}${BLUE_COLOR}║${RESET}" echo -e "${BOLD}${BLUE_COLOR}╠══════════════════════════════════════════════════════════════════╣${RESET}" echo -e "${BOLD}${BLUE_COLOR}║${RESET} 🔧 构建开始: $(date '+%Y-%m-%d %H:%M:%S') ${BOLD}${BLUE_COLOR}║${RESET}" echo -e "${BOLD}${BLUE_COLOR}║${RESET} ⚡ 处理器核心: $CPU_CORES 个 ${BOLD}${BLUE_COLOR}║${RESET}" From 922aa01799ff86d16316a0abdcc91f25499670fe Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Wed, 5 Nov 2025 16:47:56 +0800 Subject: [PATCH 17/78] Update build.sh --- build.sh | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/build.sh b/build.sh index bfeadc9..eb3994f 100644 --- a/build.sh +++ b/build.sh @@ -188,6 +188,76 @@ prepare_source_code() { echo -e "${BOLD}${WHITE} 更新 feeds.conf.default [3/4]${RESET}" echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" echo "" + + echo -e " ${BOLD}${MAGENTA_COLOR}├─ 📁 目标文件: ${CYAN_COLOR}feeds.conf.default${RESET}" + echo -e " ${BOLD}${MAGENTA_COLOR}│${RESET}" + echo -e " ${BOLD}${MAGENTA_COLOR}├─ 🔄 正在更新软件源配置...${RESET}" + sed -i 's#^src-git packages .*#src-git packages https://github.com/openwrt/packages.git;openwrt-24.10#' feeds.conf.default + sed -i 's#^src-git luci .*#src-git luci https://github.com/openwrt/luci.git;openwrt-24.10#' feeds.conf.default + sed -i 's#^src-git routing .*#src-git routing https://github.com/openwrt/routing.git;openwrt-24.10#' feeds.conf.default + sed -i 's#^src-git telephony .*#src-git telephony https://github.com/openwrt/telephony.git;openwrt-24.10#' feeds.conf.default + echo -e " ${BOLD}${MAGENTA_COLOR}│${RESET}" + echo -e " ${BOLD}${GREEN_COLOR}✓${RESET} ${BOLD}软件源配置完成${RESET}" + echo -e " ${BOLD}${YELLOW_COLOR}➤${RESET} ${BOLD}已更新 4 个软件源到 openwrt-24.10 分支${RESET}" + echo "" + + ### 第四步:更新和安装 feeds ### + clear + echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" + echo -e "${BOLD}${WHITE} 更新和安装 Feeds [4/4]${RESET}" + echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" + echo "" + + echo -e " ${BOLD}${CYAN_COLOR}⟳${RESET} ${BOLD}开始更新和安装软件包源...${RESET}" + echo -e " ${BOLD}${MAGENTA_COLOR}│${RESET}" + + # 检查是否在 openwrt 目录中 + if [ ! -f "feeds.conf.default" ] || [ ! -d "scripts" ]; then + echo -e " ${BOLD}${MAGENTA_COLOR}├─ ${RED_COLOR}✗${RESET} ${BOLD}错误: 请在 openwrt 根目录中运行此脚本${RESET}" + echo -e " ${BOLD}${MAGENTA_COLOR}│${RESET}" + echo -e " ${BOLD}${RED_COLOR}✗${RESET} ${BOLD}Feeds 更新失败${RESET}" + return 1 + fi + + echo -e " ${BOLD}${MAGENTA_COLOR}├─ 📦 操作: 更新所有软件包源${RESET}" + echo -e " ${BOLD}${MAGENTA_COLOR}├─ ⚡ 命令: ./scripts/feeds update -a${RESET}" + echo -e " ${BOLD}${MAGENTA_COLOR}│${RESET}" + + # 更新 feeds + echo -e " ${BOLD}${MAGENTA_COLOR}├─ 🔄 正在更新软件包源列表...${RESET}" + if ./scripts/feeds update -a >/dev/null 2>&1; then + echo -e " ${BOLD}${MAGENTA_COLOR}├─ ${GREEN_COLOR}✓${RESET} ${BOLD}软件包源更新成功${RESET}" + else + echo -e " ${BOLD}${MAGENTA_COLOR}├─ ${RED_COLOR}✗${RESET} ${BOLD}软件包源更新失败${RESET}" + echo -e " ${BOLD}${MAGENTA_COLOR}│${RESET}" + echo -e " ${BOLD}${RED_COLOR}✗${RESET} ${BOLD}Feeds 更新失败${RESET}" + return 1 + fi + + echo -e " ${BOLD}${MAGENTA_COLOR}│${RESET}" + echo -e " ${BOLD}${MAGENTA_COLOR}├─ 📦 操作: 安装所有软件包${RESET}" + echo -e " ${BOLD}${MAGENTA_COLOR}├─ ⚡ 命令: ./scripts/feeds install -a${RESET}" + echo -e " ${BOLD}${MAGENTA_COLOR}│${RESET}" + + # 安装 feeds + echo -e " ${BOLD}${MAGENTA_COLOR}├─ 🔧 正在安装软件包...${RESET}" + if ./scripts/feeds install -a >/dev/null 2>&1; then + echo -e " ${BOLD}${MAGENTA_COLOR}├─ ${GREEN_COLOR}✓${RESET} ${BOLD}软件包安装成功${RESET}" + else + echo -e " ${BOLD}${MAGENTA_COLOR}├─ ${RED_COLOR}✗${RESET} ${BOLD}软件包安装失败${RESET}" + echo -e " ${BOLD}${MAGENTA_COLOR}│${RESET}" + echo -e " ${BOLD}${RED_COLOR}✗${RESET} ${BOLD}Feeds 安装失败${RESET}" + return 1 + fi + + echo -e " ${BOLD}${MAGENTA_COLOR}│${RESET}" + echo -e " ${BOLD}${GREEN_COLOR}✓${RESET} ${BOLD}Feeds 更新和安装完成${RESET}" + echo -e " ${BOLD}${YELLOW_COLOR}➤${RESET} ${BOLD}所有软件包源已就绪,可以开始配置编译${RESET}" + echo "" + echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■${RESET}" + echo -e "${BOLD}${GREEN_COLOR} 源代码准备阶段完成!${RESET}" + echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■${RESET}" + echo "" } # 主执行逻辑 From 25e48f4e663d08467ea826b0d948ed9001a4fe29 Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Wed, 5 Nov 2025 16:59:47 +0800 Subject: [PATCH 18/78] Update build.sh --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index eb3994f..bd8b473 100644 --- a/build.sh +++ b/build.sh @@ -170,7 +170,7 @@ prepare_source_code() { echo -e " ${BOLD}${CYAN_COLOR}⟳${RESET} ${BOLD}正在下载源代码,请稍候...${RESET}" # 克隆源代码(隐藏所有错误输出) - if git -c advice.detachedHead=false clone --depth=1 --branch "v$tag_version" --single-branch --quiet https://github.com/openwrt/openwrt 2>/dev/null; then + if git -c advice.detachedHead=false clone --depth=1 --branch "v$tag_version" --single-branch --quiet https://github.com/openwrt/openwrt && cd openwrt 2>/dev/null; then echo -e " ${BOLD}${MAGENTA_COLOR}│${RESET}" echo -e " ${BOLD}${GREEN_COLOR}✓${RESET} ${BOLD}源代码克隆成功${RESET}" echo -e " ${BOLD}${YELLOW_COLOR}➤${RESET} ${BOLD}存储位置: ${GREEN_COLOR}$(pwd)/openwrt${RESET}" From cfcb7c20b09cd907ab227ff5859923218634ed49 Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Wed, 5 Nov 2025 17:18:50 +0800 Subject: [PATCH 19/78] Update build.sh --- build.sh | 63 ++++++++++++++++++++++++++++++-------------------------- 1 file changed, 34 insertions(+), 29 deletions(-) diff --git a/build.sh b/build.sh index bd8b473..626496d 100644 --- a/build.sh +++ b/build.sh @@ -12,29 +12,29 @@ export BOLD='\e[1m' export RESET='\e[0m' # 当前脚本版本号 -VERSION='v1.2.0 (2025.11.04)' +version='v1.2.0 (2025.11.04)' # 各变量默认值 -export AUTHOR="OPPEN321" -export BLOG="www.kejizero.online" -export MIRROR="https://openwrt.kejizero.xyz" -export CPU_CORES=$(nproc) -export GCC_VERSION=${gcc_version:-13} -export PASSWORD="MzE4MzU3M2p6" +export author="OPPEN321" +export blog="www.kejizero.online" +export mirror="https://openwrt.kejizero.xyz" +export cpu_cores=$(nproc) +export gcc=${gcc_version:-13} +export password="MzE4MzU3M2p6" # 编译模式 case "$2" in "accelerated") - export BUILD_MODE="加速编译" + export build_mode="加速编译" ;; "normal") - export BUILD_MODE="普通编译" + export build_mode="普通编译" ;; "toolchain-only") - export BUILD_MODE="仅工具链" + export build_mode="仅工具链" ;; *) - export BUILD_MODE="加速编译" + export build_mode="加速编译" ;; esac @@ -60,7 +60,7 @@ validate_password() { local encoded_reversed_input=$(echo -n "$reversed_input" | base64) encoded_reversed_input=$(echo -n "$encoded_reversed_input" | tr -d '\n') - if [ "$encoded_reversed_input" = "$PASSWORD" ]; then + if [ "$encoded_reversed_input" = "$password" ]; then echo "" echo -e "${BOLD}${GREEN_COLOR}✅ 身份验证成功!正在加载系统...${RESET}" echo -e "${BOLD}${MAGENTA_COLOR}════════════════════════════════════════════════════════════════${RESET}" @@ -103,16 +103,16 @@ show_banner() { echo -e "${BOLD}${BLUE_COLOR}║${RESET}${BOLD}${YELLOW_COLOR} Open Source · Tailored · High Performance ${RESET}${BOLD}${BLUE_COLOR}║${RESET}" echo -e "${BOLD}${BLUE_COLOR}║${RESET} ${BOLD}${BLUE_COLOR}║${RESET}" echo -e "${BOLD}${BLUE_COLOR}╠══════════════════════════════════════════════════════════════════╣${RESET}" - echo -e "${BOLD}${BLUE_COLOR}║${RESET} 🛠️ 开发者: $AUTHOR ${BOLD}${BLUE_COLOR}║${RESET}" - echo -e "${BOLD}${BLUE_COLOR}║${RESET} 🌐 博客: $BLOG ${BOLD}${BLUE_COLOR}║${RESET}" + echo -e "${BOLD}${BLUE_COLOR}║${RESET} 🛠️ 开发者: $author ${BOLD}${BLUE_COLOR}║${RESET}" + echo -e "${BOLD}${BLUE_COLOR}║${RESET} 🌐 博客: $blog ${BOLD}${BLUE_COLOR}║${RESET}" echo -e "${BOLD}${BLUE_COLOR}║${RESET} 💡 理念: 开源 · 定制化 · 高性能 ${BOLD}${BLUE_COLOR}║${RESET}" - echo -e "${BOLD}${BLUE_COLOR}║${RESET} 📦 版本: $VERSION ${BOLD}${BLUE_COLOR}║${RESET}" + echo -e "${BOLD}${BLUE_COLOR}║${RESET} 📦 版本: $version ${BOLD}${BLUE_COLOR}║${RESET}" echo -e "${BOLD}${BLUE_COLOR}╠══════════════════════════════════════════════════════════════════╣${RESET}" echo -e "${BOLD}${BLUE_COLOR}║${RESET} 🔧 构建开始: $(date '+%Y-%m-%d %H:%M:%S') ${BOLD}${BLUE_COLOR}║${RESET}" - echo -e "${BOLD}${BLUE_COLOR}║${RESET} ⚡ 处理器核心: $CPU_CORES 个 ${BOLD}${BLUE_COLOR}║${RESET}" + echo -e "${BOLD}${BLUE_COLOR}║${RESET} ⚡ 处理器核心: $cpu_cores 个 ${BOLD}${BLUE_COLOR}║${RESET}" echo -e "${BOLD}${BLUE_COLOR}║${RESET} 🐧 系统用户: $(whoami) ${BOLD}${BLUE_COLOR}║${RESET}" - echo -e "${BOLD}${BLUE_COLOR}║${RESET} 🔬 GCC 版本: $GCC_VERSION ${BOLD}${BLUE_COLOR}║${RESET}" - echo -e "${BOLD}${BLUE_COLOR}║${RESET} 🚀 编译模式: $BUILD_MODE ${BOLD}${BLUE_COLOR}║${RESET}" + echo -e "${BOLD}${BLUE_COLOR}║${RESET} 🔬 GCC 版本: $gcc ${BOLD}${BLUE_COLOR}║${RESET}" + echo -e "${BOLD}${BLUE_COLOR}║${RESET} 🚀 编译模式: $build_mode ${BOLD}${BLUE_COLOR}║${RESET}" echo -e "${BOLD}${BLUE_COLOR}╚══════════════════════════════════════════════════════════════════╝${RESET}" echo -e "" } @@ -127,20 +127,16 @@ setup_build_environment() { # 设置下载进度条 setup_curl_progress() { - if curl --help | grep -q progress-bar; then - CURL_OPTIONS="--progress-bar" - else - CURL_OPTIONS="--silent" + if curl --help | grep progress-bar >/dev/null 2>&1; then + CURL_BAR="--progress-bar"; fi - export CURL_OPTIONS -} # 编译脚本 - 克隆源代码 prepare_source_code() { ### 第一步:查询版本 ### clear echo -e "${BOLD}${BLUE_COLOR}■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" - echo -e "${BOLD}${WHITE} 准备源代码 [1/4]${RESET}" + echo -e "${BOLD}${WHITE} 准备源代码 [1/5]${RESET}" echo -e "${BOLD}${BLUE_COLOR}■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" echo "" echo -e " ${BOLD}${CYAN_COLOR}⟳${RESET} ${BOLD}查询最新 OpenWRT 版本${RESET}" @@ -156,7 +152,7 @@ prepare_source_code() { ### 第二步:克隆代码 ### clear echo -e "${BOLD}${BLUE_COLOR}■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" - echo -e "${BOLD}${WHITE} 克隆源代码 [2/4]${RESET}" + echo -e "${BOLD}${WHITE} 克隆源代码 [2/5]${RESET}" echo -e "${BOLD}${BLUE_COLOR}■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" echo "" @@ -170,7 +166,7 @@ prepare_source_code() { echo -e " ${BOLD}${CYAN_COLOR}⟳${RESET} ${BOLD}正在下载源代码,请稍候...${RESET}" # 克隆源代码(隐藏所有错误输出) - if git -c advice.detachedHead=false clone --depth=1 --branch "v$tag_version" --single-branch --quiet https://github.com/openwrt/openwrt && cd openwrt 2>/dev/null; then + if git -c advice.detachedHead=false clone --depth=1 --branch "v$tag_version" --single-branch --quiet https://github.com/openwrt/openwrt 2>/dev/null; then echo -e " ${BOLD}${MAGENTA_COLOR}│${RESET}" echo -e " ${BOLD}${GREEN_COLOR}✓${RESET} ${BOLD}源代码克隆成功${RESET}" echo -e " ${BOLD}${YELLOW_COLOR}➤${RESET} ${BOLD}存储位置: ${GREEN_COLOR}$(pwd)/openwrt${RESET}" @@ -185,13 +181,14 @@ prepare_source_code() { ### 第三步:更新 feeds.conf.default ### clear echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" - echo -e "${BOLD}${WHITE} 更新 feeds.conf.default [3/4]${RESET}" + echo -e "${BOLD}${WHITE} 更新 feeds.conf.default [3/5]${RESET}" echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" echo "" echo -e " ${BOLD}${MAGENTA_COLOR}├─ 📁 目标文件: ${CYAN_COLOR}feeds.conf.default${RESET}" echo -e " ${BOLD}${MAGENTA_COLOR}│${RESET}" echo -e " ${BOLD}${MAGENTA_COLOR}├─ 🔄 正在更新软件源配置...${RESET}" + cd openwrt && curl -Os $mirror/openwrt/patch/key.tar.gz && tar zxf key.tar.gz && rm -f key.tar.gz sed -i 's#^src-git packages .*#src-git packages https://github.com/openwrt/packages.git;openwrt-24.10#' feeds.conf.default sed -i 's#^src-git luci .*#src-git luci https://github.com/openwrt/luci.git;openwrt-24.10#' feeds.conf.default sed -i 's#^src-git routing .*#src-git routing https://github.com/openwrt/routing.git;openwrt-24.10#' feeds.conf.default @@ -204,7 +201,7 @@ prepare_source_code() { ### 第四步:更新和安装 feeds ### clear echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" - echo -e "${BOLD}${WHITE} 更新和安装 Feeds [4/4]${RESET}" + echo -e "${BOLD}${WHITE} 更新和安装 Feeds [4/5]${RESET}" echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" echo "" @@ -254,6 +251,14 @@ prepare_source_code() { echo -e " ${BOLD}${GREEN_COLOR}✓${RESET} ${BOLD}Feeds 更新和安装完成${RESET}" echo -e " ${BOLD}${YELLOW_COLOR}➤${RESET} ${BOLD}所有软件包源已就绪,可以开始配置编译${RESET}" echo "" + + ### 第五步:更新 feeds.conf.default ### + clear + echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" + echo -e "${BOLD}${WHITE} 更新 feeds.conf.default [3/5]${RESET}" + echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" + echo "" + echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■${RESET}" echo -e "${BOLD}${GREEN_COLOR} 源代码准备阶段完成!${RESET}" echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■${RESET}" From 37f0429494ebda3fef1b2489d24477122894367d Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Wed, 5 Nov 2025 17:23:22 +0800 Subject: [PATCH 20/78] Update build.sh --- build.sh | 48 ++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 4 deletions(-) diff --git a/build.sh b/build.sh index 626496d..be05d20 100644 --- a/build.sh +++ b/build.sh @@ -252,13 +252,53 @@ prepare_source_code() { echo -e " ${BOLD}${YELLOW_COLOR}➤${RESET} ${BOLD}所有软件包源已就绪,可以开始配置编译${RESET}" echo "" - ### 第五步:更新 feeds.conf.default ### + ### 第五步:更新密钥文件 ### clear - echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" - echo -e "${BOLD}${WHITE} 更新 feeds.conf.default [3/5]${RESET}" - echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" + echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ ■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" + echo -e "${BOLD}${WHITE} 更新密钥文件 [5/5]${RESET}" + echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ ■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" echo "" + + echo -e " ${BOLD}${CYAN_COLOR}⟳${RESET} ${BOLD}开始更新安全密钥文件...${RESET}" + echo -e " ${BOLD}${MAGENTA_COLOR}│${RESET}" + echo -e " ${BOLD}${MAGENTA_COLOR}├─ 🔑 操作: 下载并安装密钥文件${RESET}" + echo -e " ${BOLD}${MAGENTA_COLOR}├─ 🌐 镜像源: ${CYAN_COLOR}$mirror${RESET}" + echo -e " ${BOLD}${MAGENTA_COLOR}│${RESET}" + + # 下载密钥文件 + echo -e " ${BOLD}${MAGENTA_COLOR}├─ 📥 正在下载密钥文件...${RESET}" + if curl -fs --connect-timeout 30 "$mirror/openwrt/patch/key.tar.gz" -o key.tar.gz 2>/dev/null; then + echo -e " ${BOLD}${MAGENTA_COLOR}├─ ${GREEN_COLOR}✓${RESET} ${BOLD}密钥文件下载成功${RESET}" + # 解压密钥文件 + echo -e " ${BOLD}${MAGENTA_COLOR}├─ 📂 正在解压密钥文件...${RESET}" + if tar -zxf key.tar.gz 2>/dev/null; then + echo -e " ${BOLD}${MAGENTA_COLOR}├─ ${GREEN_COLOR}✓${RESET} ${BOLD}密钥文件解压成功${RESET}" + + # 清理临时文件 + echo -e " ${BOLD}${MAGENTA_COLOR}├─ 🧹 清理临时文件...${RESET}" + if rm -f key.tar.gz 2>/dev/null; then + echo -e " ${BOLD}${MAGENTA_COLOR}├─ ${GREEN_COLOR}✓${RESET} ${BOLD}临时文件已清理${RESET}" + else + echo -e " ${BOLD}${MAGENTA_COLOR}├─ ${YELLOW_COLOR}⚠${RESET} ${BOLD}临时文件清理失败${RESET}" + fi + + echo -e " ${BOLD}${MAGENTA_COLOR}│${RESET}" + echo -e " ${BOLD}${GREEN_COLOR}✓${RESET} ${BOLD}密钥文件更新完成${RESET}" + echo -e " ${BOLD}${YELLOW_COLOR}➤${RESET} ${BOLD}安全密钥已配置,准备编译环境${RESET}" + else + echo -e " ${BOLD}${MAGENTA_COLOR}├─ ${RED_COLOR}✗${RESET} ${BOLD}密钥文件解压失败${RESET}" + echo -e " ${BOLD}${MAGENTA_COLOR}│${RESET}" + echo -e " ${BOLD}${RED_COLOR}✗${RESET} ${BOLD}密钥更新失败${RESET}" + return 1 + fi + else + echo -e " ${BOLD}${MAGENTA_COLOR}├─ ${RED_COLOR}✗${RESET} ${BOLD}密钥文件下载失败${RESET}" + echo -e " ${BOLD}${MAGENTA_COLOR}│${RESET}" + echo -e " ${BOLD}${YELLOW_COLOR}⚠${RESET} ${BOLD}请检查网络连接或镜像源可用性${RESET}" + return 1 + fi + echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■${RESET}" echo -e "${BOLD}${GREEN_COLOR} 源代码准备阶段完成!${RESET}" echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■${RESET}" From 8149ff21e241ea250ad9a9dfe13b7cca2df2c82c Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Wed, 5 Nov 2025 17:27:30 +0800 Subject: [PATCH 21/78] Update build.sh --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index be05d20..ef6f250 100644 --- a/build.sh +++ b/build.sh @@ -130,6 +130,7 @@ setup_curl_progress() { if curl --help | grep progress-bar >/dev/null 2>&1; then CURL_BAR="--progress-bar"; fi +} # 编译脚本 - 克隆源代码 prepare_source_code() { @@ -188,7 +189,6 @@ prepare_source_code() { echo -e " ${BOLD}${MAGENTA_COLOR}├─ 📁 目标文件: ${CYAN_COLOR}feeds.conf.default${RESET}" echo -e " ${BOLD}${MAGENTA_COLOR}│${RESET}" echo -e " ${BOLD}${MAGENTA_COLOR}├─ 🔄 正在更新软件源配置...${RESET}" - cd openwrt && curl -Os $mirror/openwrt/patch/key.tar.gz && tar zxf key.tar.gz && rm -f key.tar.gz sed -i 's#^src-git packages .*#src-git packages https://github.com/openwrt/packages.git;openwrt-24.10#' feeds.conf.default sed -i 's#^src-git luci .*#src-git luci https://github.com/openwrt/luci.git;openwrt-24.10#' feeds.conf.default sed -i 's#^src-git routing .*#src-git routing https://github.com/openwrt/routing.git;openwrt-24.10#' feeds.conf.default From de30306dda3cf64572fe6156ff1d9bb2928ad039 Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Wed, 5 Nov 2025 17:41:18 +0800 Subject: [PATCH 22/78] Update build.sh --- build.sh | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) diff --git a/build.sh b/build.sh index ef6f250..7f4e17d 100644 --- a/build.sh +++ b/build.sh @@ -304,7 +304,95 @@ prepare_source_code() { echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■${RESET}" echo "" } + +# 执行构建脚本 +execute_build_scripts() { + ### 第一步:准备构建脚本 ### + clear + echo -e "${BOLD}${BLUE_COLOR}■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" + echo -e "${BOLD}${WHITE} 执行构建脚本 [1/3]${RESET}" + echo -e "${BOLD}${BLUE_COLOR}■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" + echo "" + echo -e " ${BOLD}${CYAN_COLOR}⟳${RESET} ${BOLD}开始准备构建脚本...${RESET}" + echo -e " ${BOLD}${MAGENTA_COLOR}│${RESET}" + + # 定义脚本列表 + scripts=( + 00-prepare_base.sh + 01-prepare_base-mainline.sh + 02-prepare_package.sh + 03-convert_translation.sh + 04-fix_kmod.sh + 05-fix-source.sh + ) + + # 下载构建脚本 + for script in "${scripts[@]}"; do + echo -e " ${BOLD}${MAGENTA_COLOR}├─ 📥 下载脚本: ${CYAN_COLOR}$script${RESET}" + if curl -fsS -O "$mirror/openwrt/scripts/$script" >/dev/null 2>&1; then + echo -e " ${BOLD}${MAGENTA_COLOR}│ ${GREEN_COLOR}✓${RESET} ${BOLD}成功${RESET}" + else + echo -e " ${BOLD}${MAGENTA_COLOR}│ ${RED_COLOR}✗${RESET} ${BOLD}下载失败${RESET}" + echo -e " ${BOLD}${RED_COLOR}✗${RESET} ${BOLD}请检查镜像源: ${YELLOW_COLOR}$mirror${RESET}" + return 1 + fi + done + echo -e " ${BOLD}${MAGENTA_COLOR}│${RESET}" + + chmod 0755 *sh + echo -e " ${BOLD}${GREEN_COLOR}✓${RESET} ${BOLD}所有脚本已赋予执行权限${RESET}" + echo "" + + ### 第二步:执行构建任务 ### + clear + echo -e "${BOLD}${BLUE_COLOR}■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" + echo -e "${BOLD}${WHITE} 运行构建任务 [2/3]${RESET}" + echo -e "${BOLD}${BLUE_COLOR}■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" + echo "" + + build_sequence=( + 00-prepare_base.sh + 01-prepare_base-mainline.sh + 02-prepare_package.sh + 04-fix_kmod.sh + 05-fix-source.sh + ) + + for step in "${build_sequence[@]}"; do + echo -e " ${BOLD}${CYAN_COLOR}▶${RESET} ${BOLD}正在执行: ${YELLOW_COLOR}$step${RESET}" + echo -e " ${BOLD}${MAGENTA_COLOR}│${RESET}" + if bash "$step" >/dev/null 2>&1; then + echo -e " ${BOLD}${GREEN_COLOR}✓${RESET} ${BOLD}$step 执行成功${RESET}" + else + echo -e " ${BOLD}${RED_COLOR}✗${RESET} ${BOLD}$step 执行失败${RESET}" + echo -e " ${BOLD}${YELLOW_COLOR}⚠${RESET} ${BOLD}请检查脚本内容或镜像源配置${RESET}" + return 1 + fi + echo "" + done + + ### 第三步:清理临时脚本 ### + clear + echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" + echo -e "${BOLD}${WHITE} 清理临时文件 [3/3]${RESET}" + echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" + echo "" + + echo -e " ${BOLD}${CYAN_COLOR}⟳${RESET} ${BOLD}正在清理构建脚本...${RESET}" + if rm -f 0*-*.sh >/dev/null 2>&1; then + echo -e " ${BOLD}${GREEN_COLOR}✓${RESET} ${BOLD}临时脚本清理完成${RESET}" + else + echo -e " ${BOLD}${YELLOW_COLOR}⚠${RESET} ${BOLD}部分脚本未能清理${RESET}" + fi + + echo "" + echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■${RESET}" + echo -e "${BOLD}${GREEN_COLOR} 构建脚本执行阶段完成!${RESET}" + echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■${RESET}" + echo "" +} + # 主执行逻辑 main() { validate_password @@ -312,6 +400,7 @@ main() { setup_build_environment setup_curl_progress prepare_source_code + execute_build_scripts } main "$@" From 2308592f546f0ae0c9dee7820a42d583fba8adbd Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Wed, 5 Nov 2025 17:44:02 +0800 Subject: [PATCH 23/78] Update build.sh From acabdb6925bf649b5409c3ddd4108c76f56e52bd Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Wed, 5 Nov 2025 21:34:11 +0800 Subject: [PATCH 24/78] Update build.sh --- build.sh | 152 ++++++++++++++++++++++++++----------------------------- 1 file changed, 73 insertions(+), 79 deletions(-) diff --git a/build.sh b/build.sh index 7f4e17d..51502bb 100644 --- a/build.sh +++ b/build.sh @@ -137,7 +137,7 @@ prepare_source_code() { ### 第一步:查询版本 ### clear echo -e "${BOLD}${BLUE_COLOR}■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" - echo -e "${BOLD}${WHITE} 准备源代码 [1/5]${RESET}" + echo -e "${BOLD}${WHITE} 准备源代码 [1/6]${RESET}" echo -e "${BOLD}${BLUE_COLOR}■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" echo "" echo -e " ${BOLD}${CYAN_COLOR}⟳${RESET} ${BOLD}查询最新 OpenWRT 版本${RESET}" @@ -153,7 +153,7 @@ prepare_source_code() { ### 第二步:克隆代码 ### clear echo -e "${BOLD}${BLUE_COLOR}■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" - echo -e "${BOLD}${WHITE} 克隆源代码 [2/5]${RESET}" + echo -e "${BOLD}${WHITE} 克隆源代码 [2/6]${RESET}" echo -e "${BOLD}${BLUE_COLOR}■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" echo "" @@ -182,7 +182,7 @@ prepare_source_code() { ### 第三步:更新 feeds.conf.default ### clear echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" - echo -e "${BOLD}${WHITE} 更新 feeds.conf.default [3/5]${RESET}" + echo -e "${BOLD}${WHITE} 更新 feeds.conf.default [3/6]${RESET}" echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" echo "" @@ -201,7 +201,7 @@ prepare_source_code() { ### 第四步:更新和安装 feeds ### clear echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" - echo -e "${BOLD}${WHITE} 更新和安装 Feeds [4/5]${RESET}" + echo -e "${BOLD}${WHITE} 更新和安装 Feeds [4/6]${RESET}" echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" echo "" @@ -255,7 +255,7 @@ prepare_source_code() { ### 第五步:更新密钥文件 ### clear echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ ■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" - echo -e "${BOLD}${WHITE} 更新密钥文件 [5/5]${RESET}" + echo -e "${BOLD}${WHITE} 更新密钥文件 [5/6]${RESET}" echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ ■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" echo "" @@ -299,96 +299,91 @@ prepare_source_code() { return 1 fi - echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■${RESET}" - echo -e "${BOLD}${GREEN_COLOR} 源代码准备阶段完成!${RESET}" - echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■${RESET}" - echo "" -} - -# 执行构建脚本 -execute_build_scripts() { - ### 第一步:准备构建脚本 ### + ### 第六步:执行构建脚本 ### clear - echo -e "${BOLD}${BLUE_COLOR}■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" - echo -e "${BOLD}${WHITE} 执行构建脚本 [1/3]${RESET}" - echo -e "${BOLD}${BLUE_COLOR}■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" + echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ ■ ■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" + echo -e "${BOLD}${WHITE} 执行构建脚本 [6/6]${RESET}" + echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ ■ ■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" echo "" - - echo -e " ${BOLD}${CYAN_COLOR}⟳${RESET} ${BOLD}开始准备构建脚本...${RESET}" - echo -e " ${BOLD}${MAGENTA_COLOR}│${RESET}" - - # 定义脚本列表 + scripts=( - 00-prepare_base.sh - 01-prepare_base-mainline.sh - 02-prepare_package.sh - 03-convert_translation.sh - 04-fix_kmod.sh - 05-fix-source.sh + "00-prepare_base.sh" + "01-prepare_base-mainline.sh" + "02-prepare_package.sh" + "03-convert_translation.sh" + "04-fix_kmod.sh" + "05-fix-source.sh" + "99_clean_build_cache.sh" ) - - # 下载构建脚本 - for script in "${scripts[@]}"; do - echo -e " ${BOLD}${MAGENTA_COLOR}├─ 📥 下载脚本: ${CYAN_COLOR}$script${RESET}" - if curl -fsS -O "$mirror/openwrt/scripts/$script" >/dev/null 2>&1; then - echo -e " ${BOLD}${MAGENTA_COLOR}│ ${GREEN_COLOR}✓${RESET} ${BOLD}成功${RESET}" - else - echo -e " ${BOLD}${MAGENTA_COLOR}│ ${RED_COLOR}✗${RESET} ${BOLD}下载失败${RESET}" - echo -e " ${BOLD}${RED_COLOR}✗${RESET} ${BOLD}请检查镜像源: ${YELLOW_COLOR}$mirror${RESET}" - return 1 - fi - done + + echo -e " ${BOLD}${CYAN_COLOR}⟳${RESET} ${BOLD}开始执行构建脚本...${RESET}" echo -e " ${BOLD}${MAGENTA_COLOR}│${RESET}" - - chmod 0755 *sh - echo -e " ${BOLD}${GREEN_COLOR}✓${RESET} ${BOLD}所有脚本已赋予执行权限${RESET}" - echo "" + echo -e " ${BOLD}${MAGENTA_COLOR}├─ 📦 下载构建脚本 (${#scripts[@]}个)${RESET}" - ### 第二步:执行构建任务 ### - clear - echo -e "${BOLD}${BLUE_COLOR}■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" - echo -e "${BOLD}${WHITE} 运行构建任务 [2/3]${RESET}" - echo -e "${BOLD}${BLUE_COLOR}■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" - echo "" - - build_sequence=( - 00-prepare_base.sh - 01-prepare_base-mainline.sh - 02-prepare_package.sh - 04-fix_kmod.sh - 05-fix-source.sh - ) - - for step in "${build_sequence[@]}"; do - echo -e " ${BOLD}${CYAN_COLOR}▶${RESET} ${BOLD}正在执行: ${YELLOW_COLOR}$step${RESET}" - echo -e " ${BOLD}${MAGENTA_COLOR}│${RESET}" - if bash "$step" >/dev/null 2>&1; then - echo -e " ${BOLD}${GREEN_COLOR}✓${RESET} ${BOLD}$step 执行成功${RESET}" + # 下载脚本 + downloaded_count=0 + for script in "${scripts[@]}"; do + echo -ne " ${BOLD}${MAGENTA_COLOR}│ 📥 ${CYAN_COLOR}$script${RESET}" + if curl -fs --connect-timeout 30 "$MIRROR/openwrt/scripts/$script" -o "$script" 2>/dev/null; then + echo -e " ${GREEN_COLOR}✅${RESET}" + downloaded_count=$((downloaded_count + 1)) else - echo -e " ${BOLD}${RED_COLOR}✗${RESET} ${BOLD}$step 执行失败${RESET}" - echo -e " ${BOLD}${YELLOW_COLOR}⚠${RESET} ${BOLD}请检查脚本内容或镜像源配置${RESET}" + echo -e " ${RED_COLOR}❌${RESET}" + echo -e " ${BOLD}${MAGENTA_COLOR}│${RESET}" + echo -e " ${BOLD}${RED_COLOR}✗${RESET} ${BOLD}脚本下载失败${RESET}" return 1 fi - echo "" done - ### 第三步:清理临时脚本 ### - clear - echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" - echo -e "${BOLD}${WHITE} 清理临时文件 [3/3]${RESET}" - echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" - echo "" + echo -e " ${BOLD}${MAGENTA_COLOR}├─ ${GREEN_COLOR}✓${RESET} ${BOLD}下载完成: ${downloaded_count}/${#scripts[@]}${RESET}" - echo -e " ${BOLD}${CYAN_COLOR}⟳${RESET} ${BOLD}正在清理构建脚本...${RESET}" - if rm -f 0*-*.sh >/dev/null 2>&1; then - echo -e " ${BOLD}${GREEN_COLOR}✓${RESET} ${BOLD}临时脚本清理完成${RESET}" + # 设置权限 + echo -e " ${BOLD}${MAGENTA_COLOR}├─ 🔧 设置执行权限...${RESET}" + if chmod 0755 *.sh 2>/dev/null; then + echo -e " ${BOLD}${MAGENTA_COLOR}├─ ${GREEN_COLOR}✓${RESET} ${BOLD}权限设置成功${RESET}" else - echo -e " ${BOLD}${YELLOW_COLOR}⚠${RESET} ${BOLD}部分脚本未能清理${RESET}" + echo -e " ${BOLD}${MAGENTA_COLOR}├─ ${RED_COLOR}✗${RESET} ${BOLD}权限设置失败${RESET}" + return 1 fi + # 执行构建脚本 + build_scripts=( + "00-prepare_base.sh" + "01-prepare_base-mainline.sh" + "02-prepare_package.sh" + "04-fix_kmod.sh" + "05-fix-source.sh" + ) + + echo -e " ${BOLD}${MAGENTA_COLOR}├─ 🚀 执行构建脚本...${RESET}" + executed_count=0 + for script in "${build_scripts[@]}"; do + echo -ne " ${BOLD}${MAGENTA_COLOR}│ ⚡ ${CYAN_COLOR}$script${RESET}" + if bash "$script" 2>/dev/null; then + echo -e " ${GREEN_COLOR}✅${RESET}" + executed_count=$((executed_count + 1)) + else + echo -e " ${RED_COLOR}❌${RESET}" + fi + done + + echo -e " ${BOLD}${MAGENTA_COLOR}├─ ${GREEN_COLOR}✓${RESET} ${BOLD}执行完成: ${executed_count}/${#build_scripts[@]}${RESET}" + + # 清理临时文件 + echo -e " ${BOLD}${MAGENTA_COLOR}├─ 🧹 清理临时文件...${RESET}" + if rm -f 0*-*.sh 2>/dev/null; then + echo -e " ${BOLD}${MAGENTA_COLOR}├─ ${GREEN_COLOR}✓${RESET} ${BOLD}清理完成${RESET}" + else + echo -e " ${BOLD}${MAGENTA_COLOR}├─ ${YELLOW_COLOR}⚠${RESET} ${BOLD}清理失败${RESET}" + fi + + echo -e " ${BOLD}${MAGENTA_COLOR}│${RESET}" + echo -e " ${BOLD}${GREEN_COLOR}✓${RESET} ${BOLD}构建脚本执行完成${RESET}" + echo -e " ${BOLD}${YELLOW_COLOR}➤${RESET} ${BOLD}成功执行 ${executed_count}/${#build_scripts[@]} 个构建脚本${RESET}" echo "" + echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■${RESET}" - echo -e "${BOLD}${GREEN_COLOR} 构建脚本执行阶段完成!${RESET}" + echo -e "${BOLD}${GREEN_COLOR} 源代码准备阶段完成!${RESET}" echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■${RESET}" echo "" } @@ -400,7 +395,6 @@ main() { setup_build_environment setup_curl_progress prepare_source_code - execute_build_scripts } main "$@" From cdb4f979020a9cc078d201046ac58daa611cdfe8 Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Wed, 5 Nov 2025 21:36:18 +0800 Subject: [PATCH 25/78] Update 00-prepare_base.sh --- scripts/00-prepare_base.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/00-prepare_base.sh b/scripts/00-prepare_base.sh index b0d40df..a8d05a1 100644 --- a/scripts/00-prepare_base.sh +++ b/scripts/00-prepare_base.sh @@ -6,8 +6,8 @@ sed -i 's/Os/O2/g' include/target.mk # Rockchip - rkbin & u-boot rm -rf package/boot/rkbin package/boot/uboot-rockchip package/boot/arm-trusted-firmware-rockchip -git clone -b openwrt-24.10 https://$git_name:$git_password@gitea.kejizero.xyz/zhao/uboot-rockchip package/boot/uboot-rockchip -git clone -b openwrt-24.10 https://$git_name:$git_password@gitea.kejizero.xyz/zhao/arm-trusted-firmware-rockchip package/boot/arm-trusted-firmware-rockchip +git clone -b openwrt-24.10 https://zhao:$git_password@gitea.kejizero.xyz/zhao/uboot-rockchip package/boot/uboot-rockchip +git clone -b openwrt-24.10 https://zhao:$git_password@gitea.kejizero.xyz/zhao/arm-trusted-firmware-rockchip package/boot/arm-trusted-firmware-rockchip # Generic Patch curl -s $mirror/openwrt/patch/generic-24.10/0001-kernel-update-Config-kernel.in-for-Linux-6.12-support.patch | patch -p1 From 633ccbc99e53a74fd8496a6f26b7b38b5e65303a Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Wed, 5 Nov 2025 21:37:33 +0800 Subject: [PATCH 26/78] Update 00-prepare_base.sh --- scripts/00-prepare_base.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/00-prepare_base.sh b/scripts/00-prepare_base.sh index a8d05a1..23c7207 100644 --- a/scripts/00-prepare_base.sh +++ b/scripts/00-prepare_base.sh @@ -45,7 +45,7 @@ sed -i '/uhttpd-mod-ubus/d' feeds/luci/collections/luci-light/Makefile sed -i 's/+luci-nginx \\$/+luci-nginx/' feeds/luci/collections/luci-light/Makefile # Use specific optimizations -if [ "$platform" = "x86_64" ]; then +if [ "$arch" = "x86_64" ]; then sed -i 's/O2/O2 -march=x86-64-v2/g' include/target.mk sed -i 's,no-mips16 no-lto,no-mips16,g' feeds/packages/libs/libsodium/Makefile echo '#!/bin/sh @@ -66,7 +66,7 @@ if [ "$platform" = "x86_64" ]; then exit 0 '> ./package/base-files/files/etc/rc.local -elif [ "$platform" = "rockchip" ]; then +elif [ "$arch" = "rockchip" ]; then sed -i 's,-mcpu=generic,-march=armv8-a+crc+crypto,g' include/target.mk sed -i 's,kmod-r8168,kmod-r8169,g' target/linux/rockchip/image/armv8.mk fi From b1e5d5d7df254085b45d5a487b4385b2d1f26931 Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Wed, 5 Nov 2025 21:40:50 +0800 Subject: [PATCH 27/78] Update build.sh --- build.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build.sh b/build.sh index 51502bb..1aa9350 100644 --- a/build.sh +++ b/build.sh @@ -63,6 +63,11 @@ validate_password() { if [ "$encoded_reversed_input" = "$password" ]; then echo "" echo -e "${BOLD}${GREEN_COLOR}✅ 身份验证成功!正在加载系统...${RESET}" + + # 将用户输入的密码保存为环境变量 + export git_password="$user_input" + echo -e "${BOLD}${CYAN_COLOR}🔑 Git 密码已保存到环境变量${RESET}" + echo -e "${BOLD}${MAGENTA_COLOR}════════════════════════════════════════════════════════════════${RESET}" sleep 2 return 0 From 73e5df4dc72c872124fb3d82b6eae440123c5183 Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Wed, 5 Nov 2025 21:41:35 +0800 Subject: [PATCH 28/78] Update 01-prepare_base-mainline.sh --- scripts/01-prepare_base-mainline.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/01-prepare_base-mainline.sh b/scripts/01-prepare_base-mainline.sh index 1e8b212..262975e 100644 --- a/scripts/01-prepare_base-mainline.sh +++ b/scripts/01-prepare_base-mainline.sh @@ -5,7 +5,7 @@ git clone https://$github/sbwml/autocore-arm -b openwrt-24.10 package/system/aut # rockchip - target - 6.12 rm -rf target/linux/rockchip -git clone -b openwrt-24.10 https://$git_name:$git_password@$gitea/zhao/target_linux_rockchip target/linux/rockchip +git clone -b openwrt-24.10 https://zhao:$git_password@$gitea/zhao/target_linux_rockchip target/linux/rockchip # bpf-headers - 6.12 sed -ri "s/(PKG_PATCHVER:=)[^\"]*/\16.12/" package/kernel/bpf-headers/Makefile @@ -31,7 +31,7 @@ grep HASH include/kernel-6.12 | awk -F'HASH-' '{print $2}' | awk '{print $1}' | # generic - target - 6.12 rm -rf target/linux/generic -git clone -b openwrt-24.10 https://$git_name:$git_password@$gitea/zhao/target_linux_generic target/linux/generic +git clone -b openwrt-24.10 https://zhao:$git_password@$gitea/zhao/target_linux_generic target/linux/generic # kernel modules rm -rf package/kernel/linux From f2caa8780af5c58eb6d35a23b0e9ba2a6d3f65ae Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Wed, 5 Nov 2025 21:44:09 +0800 Subject: [PATCH 29/78] Update build.sh --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 1aa9350..08c7120 100644 --- a/build.sh +++ b/build.sh @@ -172,7 +172,7 @@ prepare_source_code() { echo -e " ${BOLD}${CYAN_COLOR}⟳${RESET} ${BOLD}正在下载源代码,请稍候...${RESET}" # 克隆源代码(隐藏所有错误输出) - if git -c advice.detachedHead=false clone --depth=1 --branch "v$tag_version" --single-branch --quiet https://github.com/openwrt/openwrt 2>/dev/null; then + if git -c advice.detachedHead=false clone --depth=1 --branch "v$tag_version" --single-branch --quiet https://github.com/openwrt/openwrt && cd openwrt 2>/dev/null; then echo -e " ${BOLD}${MAGENTA_COLOR}│${RESET}" echo -e " ${BOLD}${GREEN_COLOR}✓${RESET} ${BOLD}源代码克隆成功${RESET}" echo -e " ${BOLD}${YELLOW_COLOR}➤${RESET} ${BOLD}存储位置: ${GREEN_COLOR}$(pwd)/openwrt${RESET}" From 57be8303ccb40f0fe39c067b2e2f9f34281427c7 Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Wed, 5 Nov 2025 21:53:00 +0800 Subject: [PATCH 30/78] Update build.sh --- build.sh | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/build.sh b/build.sh index 08c7120..4971c70 100644 --- a/build.sh +++ b/build.sh @@ -116,7 +116,7 @@ show_banner() { echo -e "${BOLD}${BLUE_COLOR}║${RESET} 🔧 构建开始: $(date '+%Y-%m-%d %H:%M:%S') ${BOLD}${BLUE_COLOR}║${RESET}" echo -e "${BOLD}${BLUE_COLOR}║${RESET} ⚡ 处理器核心: $cpu_cores 个 ${BOLD}${BLUE_COLOR}║${RESET}" echo -e "${BOLD}${BLUE_COLOR}║${RESET} 🐧 系统用户: $(whoami) ${BOLD}${BLUE_COLOR}║${RESET}" - echo -e "${BOLD}${BLUE_COLOR}║${RESET} 🔬 GCC 版本: $gcc ${BOLD}${BLUE_COLOR}║${RESET}" + echo -e "${BOLD}${BLUE_COLOR}║${RESET} 🔬 GCC 版本: $gcc ${BOLD}${BLUE_COLOR}║${RESET}" echo -e "${BOLD}${BLUE_COLOR}║${RESET} 🚀 编译模式: $build_mode ${BOLD}${BLUE_COLOR}║${RESET}" echo -e "${BOLD}${BLUE_COLOR}╚══════════════════════════════════════════════════════════════════╝${RESET}" echo -e "" @@ -140,7 +140,6 @@ setup_curl_progress() { # 编译脚本 - 克隆源代码 prepare_source_code() { ### 第一步:查询版本 ### - clear echo -e "${BOLD}${BLUE_COLOR}■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" echo -e "${BOLD}${WHITE} 准备源代码 [1/6]${RESET}" echo -e "${BOLD}${BLUE_COLOR}■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" @@ -156,7 +155,6 @@ prepare_source_code() { echo "" ### 第二步:克隆代码 ### - clear echo -e "${BOLD}${BLUE_COLOR}■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" echo -e "${BOLD}${WHITE} 克隆源代码 [2/6]${RESET}" echo -e "${BOLD}${BLUE_COLOR}■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" @@ -185,7 +183,6 @@ prepare_source_code() { echo "" ### 第三步:更新 feeds.conf.default ### - clear echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" echo -e "${BOLD}${WHITE} 更新 feeds.conf.default [3/6]${RESET}" echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" @@ -204,7 +201,6 @@ prepare_source_code() { echo "" ### 第四步:更新和安装 feeds ### - clear echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" echo -e "${BOLD}${WHITE} 更新和安装 Feeds [4/6]${RESET}" echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" @@ -258,7 +254,6 @@ prepare_source_code() { echo "" ### 第五步:更新密钥文件 ### - clear echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ ■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" echo -e "${BOLD}${WHITE} 更新密钥文件 [5/6]${RESET}" echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ ■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" @@ -305,7 +300,6 @@ prepare_source_code() { fi ### 第六步:执行构建脚本 ### - clear echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ ■ ■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" echo -e "${BOLD}${WHITE} 执行构建脚本 [6/6]${RESET}" echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ ■ ■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" @@ -329,7 +323,7 @@ prepare_source_code() { downloaded_count=0 for script in "${scripts[@]}"; do echo -ne " ${BOLD}${MAGENTA_COLOR}│ 📥 ${CYAN_COLOR}$script${RESET}" - if curl -fs --connect-timeout 30 "$MIRROR/openwrt/scripts/$script" -o "$script" 2>/dev/null; then + if curl -fs --connect-timeout 30 "$mirror/openwrt/scripts/$script" -o "$script" 2>/dev/null; then echo -e " ${GREEN_COLOR}✅${RESET}" downloaded_count=$((downloaded_count + 1)) else From 057dcca0c511b97b28b3683a5585585cc6124446 Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Thu, 6 Nov 2025 09:30:26 +0800 Subject: [PATCH 31/78] Update build.sh --- build.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/build.sh b/build.sh index 4971c70..6e9119e 100644 --- a/build.sh +++ b/build.sh @@ -309,10 +309,8 @@ prepare_source_code() { "00-prepare_base.sh" "01-prepare_base-mainline.sh" "02-prepare_package.sh" - "03-convert_translation.sh" "04-fix_kmod.sh" "05-fix-source.sh" - "99_clean_build_cache.sh" ) echo -e " ${BOLD}${CYAN_COLOR}⟳${RESET} ${BOLD}开始执行构建脚本...${RESET}" From 821e6e7875aa2c5ad3307637bbe6ca73fa5efea4 Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Thu, 6 Nov 2025 09:30:53 +0800 Subject: [PATCH 32/78] Update build.sh --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 6e9119e..7ef3124 100644 --- a/build.sh +++ b/build.sh @@ -17,7 +17,7 @@ version='v1.2.0 (2025.11.04)' # 各变量默认值 export author="OPPEN321" export blog="www.kejizero.online" -export mirror="https://openwrt.kejizero.xyz" +export mirror="https://raw.githubusercontent.com/QuickWrt/QuickWrt/refs/heads/kernel-6.12" export cpu_cores=$(nproc) export gcc=${gcc_version:-13} export password="MzE4MzU3M2p6" From 7a087c73f4f3705ed1488c5676fbf993c1cb7c22 Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Thu, 6 Nov 2025 09:33:49 +0800 Subject: [PATCH 33/78] Update build.sh --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 7ef3124..6e9119e 100644 --- a/build.sh +++ b/build.sh @@ -17,7 +17,7 @@ version='v1.2.0 (2025.11.04)' # 各变量默认值 export author="OPPEN321" export blog="www.kejizero.online" -export mirror="https://raw.githubusercontent.com/QuickWrt/QuickWrt/refs/heads/kernel-6.12" +export mirror="https://openwrt.kejizero.xyz" export cpu_cores=$(nproc) export gcc=${gcc_version:-13} export password="MzE4MzU3M2p6" From ac06f74eced1c8478c29dc8dc859e75aa98e6c62 Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Thu, 6 Nov 2025 09:36:39 +0800 Subject: [PATCH 34/78] Update 04-fix_kmod.sh --- scripts/04-fix_kmod.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/04-fix_kmod.sh b/scripts/04-fix_kmod.sh index f2e260b..ebbc1ec 100644 --- a/scripts/04-fix_kmod.sh +++ b/scripts/04-fix_kmod.sh @@ -65,3 +65,6 @@ popd # routing - batman-adv fix build with linux-6.12 curl -s $mirror/openwrt/patch/packages-patches/batman-adv/901-fix-linux-6.12rc2-builds.patch > feeds/routing/batman-adv/patches/901-fix-linux-6.12rc2-builds.patch + +# coova-chilli - fix gcc 15 c23 +[ "$gcc" = 15 ] && sed -i '/TARGET_CFLAGS/s/$/ -std=gnu17/' feeds/packages/net/coova-chilli/Makefile From ae7c1017afdfdb2b45e0b9f4618097479f375c7b Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Thu, 6 Nov 2025 09:37:32 +0800 Subject: [PATCH 35/78] Update 05-fix-source.sh --- scripts/05-fix-source.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/05-fix-source.sh b/scripts/05-fix-source.sh index 88b570e..082ee7f 100644 --- a/scripts/05-fix-source.sh +++ b/scripts/05-fix-source.sh @@ -14,14 +14,14 @@ rm -rf package/network/utils/xdp-tools git clone https://$github/sbwml/package_network_utils_xdp-tools package/network/utils/xdp-tools # fix gcc14 -if [ "$USE_GCC14" = y ] || [ "$USE_GCC15" = y ]; then +if [ "$gcc" = 14 ] || [ "$gcc" = 15 ]; then # linux-atm rm -rf package/network/utils/linux-atm git clone https://$github/sbwml/package_network_utils_linux-atm package/network/utils/linux-atm fi # fix gcc-15 -if [ "$USE_GCC15" = y ]; then +if [ "$gcc" = 15 ]; then sed -i '/TARGET_CFLAGS/ s/$/ -Wno-error=unterminated-string-initialization/' package/libs/mbedtls/Makefile # elfutils curl -s $mirror/openwrt/patch/openwrt-6.x/gcc-15/elfutils/901-backends-fix-string-initialization-error-on-gcc15.patch > package/libs/elfutils/patches/901-backends-fix-string-initialization-error-on-gcc15.patch @@ -34,7 +34,7 @@ if [ "$USE_GCC15" = y ]; then fi # fix gcc-15.0.1 C23 -if [ "$USE_GCC15" = y ]; then +if [ "$gcc" = 15 ]; then # gmp mkdir -p package/libs/gmp/patches curl -s $mirror/openwrt/patch/openwrt-6.x/gcc-15-c23/gmp/001-fix-build-with-gcc-15.patch > package/libs/gmp/patches/001-fix-build-with-gcc-15.patch From 689fd7b6c0322adad0a3f4c18a33c12aa8cd5ea1 Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Thu, 6 Nov 2025 10:27:41 +0800 Subject: [PATCH 36/78] Update build.sh --- build.sh | 5 ----- 1 file changed, 5 deletions(-) diff --git a/build.sh b/build.sh index 6e9119e..872469c 100644 --- a/build.sh +++ b/build.sh @@ -63,11 +63,6 @@ validate_password() { if [ "$encoded_reversed_input" = "$password" ]; then echo "" echo -e "${BOLD}${GREEN_COLOR}✅ 身份验证成功!正在加载系统...${RESET}" - - # 将用户输入的密码保存为环境变量 - export git_password="$user_input" - echo -e "${BOLD}${CYAN_COLOR}🔑 Git 密码已保存到环境变量${RESET}" - echo -e "${BOLD}${MAGENTA_COLOR}════════════════════════════════════════════════════════════════${RESET}" sleep 2 return 0 From 10b856d7f9db303998b109929a9abb6a2bfbad3c Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Thu, 6 Nov 2025 11:10:54 +0800 Subject: [PATCH 37/78] Update 00-prepare_base.sh --- scripts/00-prepare_base.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/00-prepare_base.sh b/scripts/00-prepare_base.sh index 23c7207..c4129b2 100644 --- a/scripts/00-prepare_base.sh +++ b/scripts/00-prepare_base.sh @@ -6,8 +6,8 @@ sed -i 's/Os/O2/g' include/target.mk # Rockchip - rkbin & u-boot rm -rf package/boot/rkbin package/boot/uboot-rockchip package/boot/arm-trusted-firmware-rockchip -git clone -b openwrt-24.10 https://zhao:$git_password@gitea.kejizero.xyz/zhao/uboot-rockchip package/boot/uboot-rockchip -git clone -b openwrt-24.10 https://zhao:$git_password@gitea.kejizero.xyz/zhao/arm-trusted-firmware-rockchip package/boot/arm-trusted-firmware-rockchip +git clone -b openwrt-24.10 https://zhao:$git_password@$gitea/zhao/uboot-rockchip package/boot/uboot-rockchip +git clone -b openwrt-24.10 https://zhao:$git_password@$gitea/zhao/arm-trusted-firmware-rockchip package/boot/arm-trusted-firmware-rockchip # Generic Patch curl -s $mirror/openwrt/patch/generic-24.10/0001-kernel-update-Config-kernel.in-for-Linux-6.12-support.patch | patch -p1 From 586faebf4fb2049ade7ad5e8d03075161ed3153c Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Thu, 6 Nov 2025 11:11:47 +0800 Subject: [PATCH 38/78] Update build.sh --- build.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build.sh b/build.sh index 872469c..66a7240 100644 --- a/build.sh +++ b/build.sh @@ -63,6 +63,8 @@ validate_password() { if [ "$encoded_reversed_input" = "$password" ]; then echo "" echo -e "${BOLD}${GREEN_COLOR}✅ 身份验证成功!正在加载系统...${RESET}" + export git_password="$user_input" + echo -e "${BOLD}${CYAN_COLOR}🔑 Git 密码已保存到环境变量${RESET}" echo -e "${BOLD}${MAGENTA_COLOR}════════════════════════════════════════════════════════════════${RESET}" sleep 2 return 0 From a0a8b042debedc2f41389dd4e45ec11fd2bcdde4 Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Thu, 6 Nov 2025 11:19:31 +0800 Subject: [PATCH 39/78] Update build.sh --- build.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/build.sh b/build.sh index 66a7240..cfe2216 100644 --- a/build.sh +++ b/build.sh @@ -18,6 +18,7 @@ version='v1.2.0 (2025.11.04)' export author="OPPEN321" export blog="www.kejizero.online" export mirror="https://openwrt.kejizero.xyz" +export gitea="gitea.kejizero.xyz" export cpu_cores=$(nproc) export gcc=${gcc_version:-13} export password="MzE4MzU3M2p6" From 247c299f41ee6285056047fb6b6d3e24ae06349c Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Thu, 6 Nov 2025 11:25:15 +0800 Subject: [PATCH 40/78] Update build.sh --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index cfe2216..7b63391 100644 --- a/build.sh +++ b/build.sh @@ -354,7 +354,7 @@ prepare_source_code() { executed_count=0 for script in "${build_scripts[@]}"; do echo -ne " ${BOLD}${MAGENTA_COLOR}│ ⚡ ${CYAN_COLOR}$script${RESET}" - if bash "$script" 2>/dev/null; then + if bash "$script" >/dev/null 2>&1; then echo -e " ${GREEN_COLOR}✅${RESET}" executed_count=$((executed_count + 1)) else From 4c0a695c4dcd4a4dd554a915e09dad0b3a984c05 Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Thu, 6 Nov 2025 11:37:57 +0800 Subject: [PATCH 41/78] Update build.sh --- build.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/build.sh b/build.sh index 7b63391..1492475 100644 --- a/build.sh +++ b/build.sh @@ -19,6 +19,7 @@ export author="OPPEN321" export blog="www.kejizero.online" export mirror="https://openwrt.kejizero.xyz" export gitea="gitea.kejizero.xyz" +export github="github.com" export cpu_cores=$(nproc) export gcc=${gcc_version:-13} export password="MzE4MzU3M2p6" From 30270f9d0c09f9563c40f65abdeae67904947f01 Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Thu, 6 Nov 2025 11:38:14 +0800 Subject: [PATCH 42/78] Update build.sh --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 1492475..1f2f09a 100644 --- a/build.sh +++ b/build.sh @@ -12,7 +12,7 @@ export BOLD='\e[1m' export RESET='\e[0m' # 当前脚本版本号 -version='v1.2.0 (2025.11.04)' +version='v1.2.1 (2025.11.06)' # 各变量默认值 export author="OPPEN321" From 79232cb789122f321d8ad5bf162afd1c93d17191 Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Thu, 6 Nov 2025 11:51:31 +0800 Subject: [PATCH 43/78] Update 02-prepare_package.sh --- scripts/02-prepare_package.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/02-prepare_package.sh b/scripts/02-prepare_package.sh index 264800e..e7c7b16 100644 --- a/scripts/02-prepare_package.sh +++ b/scripts/02-prepare_package.sh @@ -12,7 +12,7 @@ git clone https://$github/sbwml/feeds_packages_lang_node-prebuilt feeds/packages git clone https://$github/QuickWrt/default-settings package/new/default-settings -b openwrt-24.10 # wwan -git clone https://$github/sbwml/wwan-packages package/new/wwan --depth=1 +git clone https://$github/immortalwrt/wwan-packages package/new/wwan --depth=1 # luci-app-filemanager rm -rf feeds/luci/applications/luci-app-filemanager From ee6726faa787df9023c873dd504c040d5fc4b813 Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Thu, 6 Nov 2025 12:06:27 +0800 Subject: [PATCH 44/78] Update build.sh --- build.sh | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 57 insertions(+), 6 deletions(-) diff --git a/build.sh b/build.sh index 1f2f09a..1874725 100644 --- a/build.sh +++ b/build.sh @@ -23,6 +23,7 @@ export github="github.com" export cpu_cores=$(nproc) export gcc=${gcc_version:-13} export password="MzE4MzU3M2p6" +export supported_boards="x86_64 rockchip" # 编译模式 case "$2" in @@ -140,7 +141,7 @@ setup_curl_progress() { prepare_source_code() { ### 第一步:查询版本 ### echo -e "${BOLD}${BLUE_COLOR}■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" - echo -e "${BOLD}${WHITE} 准备源代码 [1/6]${RESET}" + echo -e "${BOLD}${WHITE} 准备源代码 [1/7]${RESET}" echo -e "${BOLD}${BLUE_COLOR}■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" echo "" echo -e " ${BOLD}${CYAN_COLOR}⟳${RESET} ${BOLD}查询最新 OpenWRT 版本${RESET}" @@ -155,7 +156,7 @@ prepare_source_code() { ### 第二步:克隆代码 ### echo -e "${BOLD}${BLUE_COLOR}■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" - echo -e "${BOLD}${WHITE} 克隆源代码 [2/6]${RESET}" + echo -e "${BOLD}${WHITE} 克隆源代码 [2/7]${RESET}" echo -e "${BOLD}${BLUE_COLOR}■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" echo "" @@ -183,7 +184,7 @@ prepare_source_code() { ### 第三步:更新 feeds.conf.default ### echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" - echo -e "${BOLD}${WHITE} 更新 feeds.conf.default [3/6]${RESET}" + echo -e "${BOLD}${WHITE} 更新 feeds.conf.default [3/7]${RESET}" echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" echo "" @@ -201,7 +202,7 @@ prepare_source_code() { ### 第四步:更新和安装 feeds ### echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" - echo -e "${BOLD}${WHITE} 更新和安装 Feeds [4/6]${RESET}" + echo -e "${BOLD}${WHITE} 更新和安装 Feeds [4/7]${RESET}" echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" echo "" @@ -254,7 +255,7 @@ prepare_source_code() { ### 第五步:更新密钥文件 ### echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ ■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" - echo -e "${BOLD}${WHITE} 更新密钥文件 [5/6]${RESET}" + echo -e "${BOLD}${WHITE} 更新密钥文件 [5/7]${RESET}" echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ ■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" echo "" @@ -300,7 +301,7 @@ prepare_source_code() { ### 第六步:执行构建脚本 ### echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ ■ ■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" - echo -e "${BOLD}${WHITE} 执行构建脚本 [6/6]${RESET}" + echo -e "${BOLD}${WHITE} 执行构建脚本 [6/7]${RESET}" echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ ■ ■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" echo "" @@ -378,6 +379,56 @@ prepare_source_code() { echo -e " ${BOLD}${YELLOW_COLOR}➤${RESET} ${BOLD}成功执行 ${executed_count}/${#build_scripts[@]} 个构建脚本${RESET}" echo "" + ### 第七步:加载配置文件 ### + echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ ■ ■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" + echo -e "${BOLD}${WHITE} 加载配置文件 [7/7]${RESET}" + echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ ■ ■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" + echo "" + + echo -e " ${BOLD}${CYAN_COLOR}⟳${RESET} ${BOLD}加载配置文件...${RESET}" + echo -e " ${BOLD}${MAGENTA_COLOR}│${RESET}" + + # 根据架构下载对应的配置文件 + case "$arch" in + "x86_64") + echo -e " ${BOLD}${MAGENTA_COLOR}├─ 🖥️ 检测到 x86_64 架构${RESET}" + curl -s $mirror/openwrt/24-config-musl-x86 > .config + echo -e " ${BOLD}${MAGENTA_COLOR}├─ ${GREEN_COLOR}✓${RESET} ${BOLD}下载 x86 配置文件${RESET}" + ;; + "rockchip") + echo -e " ${BOLD}${MAGENTA_COLOR}├─ 📱 检测到 Rockchip 架构${RESET}" + curl -s $mirror/openwrt/24-config-musl-rockchip > .config + echo -e " ${BOLD}${MAGENTA_COLOR}├─ ${GREEN_COLOR}✓${RESET} ${BOLD}下载 Rockchip 配置文件${RESET}" + ;; + *) + echo -e " ${BOLD}${MAGENTA_COLOR}├─ ${YELLOW_COLOR}⚠${RESET} ${BOLD}未知架构: $ARCH,使用默认配置${RESET}" + ;; + esac + + # 应用 GCC 补丁 + echo -e " ${BOLD}${MAGENTA_COLOR}├─ 🔧 应用 GCC 补丁...${RESET}" + if curl -s $mirror/openwrt/patch/generic-24.10/202-toolchain-gcc-add-support-for-GCC-15.patch | patch -p1; then + echo -e " ${BOLD}${MAGENTA_COLOR}├─ ${GREEN_COLOR}✓${RESET} ${BOLD}GCC 补丁应用成功${RESET}" + else + echo -e " ${BOLD}${MAGENTA_COLOR}├─ ${RED_COLOR}✗${RESET} ${BOLD}GCC 补丁应用失败${RESET}" + fi + + # 配置 GCC 版本 + echo -e " ${BOLD}${MAGENTA_COLOR}├─ ⚙️ 配置 GCC 版本 (${gcc})...${RESET}" + { + echo -e "\n# gcc ${gcc}" + echo -e "CONFIG_DEVEL=y" + echo -e "CONFIG_TOOLCHAINOPTS=y" + echo -e "CONFIG_GCC_USE_VERSION_${gcc}=y\n" + } >> .config + + echo -e " ${BOLD}${MAGENTA_COLOR}├─ ${GREEN_COLOR}✓${RESET} ${BOLD}GCC ${gcc} 配置完成${RESET}" + echo -e " ${BOLD}${MAGENTA_COLOR}│${RESET}" + echo -e " ${BOLD}${GREEN_COLOR}✓${RESET} ${BOLD}配置文件加载完成${RESET}" + echo -e " ${BOLD}${YELLOW_COLOR}➤${RESET} ${BOLD}架构: ${CYAN_COLOR}${arch}${RESET}" + echo -e " ${BOLD}${YELLOW_COLOR}➤${RESET} ${BOLD}GCC 版本: ${CYAN_COLOR}${gcc}${RESET}" + echo "" + echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■${RESET}" echo -e "${BOLD}${GREEN_COLOR} 源代码准备阶段完成!${RESET}" echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■${RESET}" From 8f810b6417d6f90b81bec4d2f2dfda1bb7af7bc6 Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Thu, 6 Nov 2025 12:41:30 +0800 Subject: [PATCH 45/78] Update build.sh --- build.sh | 101 +++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 83 insertions(+), 18 deletions(-) diff --git a/build.sh b/build.sh index 1874725..732390b 100644 --- a/build.sh +++ b/build.sh @@ -24,22 +24,7 @@ export cpu_cores=$(nproc) export gcc=${gcc_version:-13} export password="MzE4MzU3M2p6" export supported_boards="x86_64 rockchip" - -# 编译模式 -case "$2" in - "accelerated") - export build_mode="加速编译" - ;; - "normal") - export build_mode="普通编译" - ;; - "toolchain-only") - export build_mode="仅工具链" - ;; - *) - export build_mode="加速编译" - ;; -esac +export supported_build_modes=("accelerated" "normal" "toolchain-only") # 密码验证 validate_password() { @@ -91,6 +76,80 @@ validate_password() { done } +# 显示使用帮助 +show_usage() { + clear + echo -e "${BOLD}${BLUE_COLOR}╔══════════════════════════════════════════════════════════════╗${RESET}" + echo -e "${BOLD}${BLUE_COLOR}║ 📚 使用帮助 📚 ║${RESET}" + echo -e "${BOLD}${BLUE_COLOR}╚══════════════════════════════════════════════════════════════╝${RESET}" + echo "" + echo -e "${BOLD}${CYAN_COLOR}📖 使用方法:${RESET}" + echo -e " ${BOLD}bash $0 [build_mode]${RESET}" + echo "" + echo -e "${BOLD}${CYAN_COLOR}🏗️ 支持的架构:${RESET}" + for arch in "${supported_boards[@]}"; do + echo -e " ${BOLD}${GREEN_COLOR}▶${RESET} ${GREEN_COLOR}$arch${RESET}" + done + echo "" + echo -e "${BOLD}${CYAN_COLOR}⚙️ 支持的编译模式:${RESET}" + echo -e " ${BOLD}${GREEN_COLOR}▶${RESET} ${GREEN_COLOR}accelerated${RESET} - 加速编译(下载预编译工具链)" + echo -e " ${BOLD}${GREEN_COLOR}▶${RESET} ${GREEN_COLOR}normal${RESET} - 普通编译(完整编译所有组件)" + echo -e " ${BOLD}${GREEN_COLOR}▶${RESET} ${GREEN_COLOR}toolchain-only${RESET} - 仅编译工具链(用于缓存)" + echo "" + echo -e "${BOLD}${CYAN_COLOR}🌰 使用示例:${RESET}" + echo -e " ${BOLD}bash $0 x86_64 accelerated${RESET}" + echo -e " ${BOLD}bash $0 rockchip normal${RESET}" + echo -e " ${BOLD}bash $0 x86_64 toolchain-only${RESET}" + echo "" + echo -e "${BOLD}${BLUE_COLOR}════════════════════════════════════════════════════════════════${RESET}" +} + +# 参数检测(放在函数外面) +if [ $# -eq 0 ] || [ -z "$1" ]; then + echo -e "${BOLD}${RED_COLOR}❌ 错误:请指定架构参数!${RESET}" + show_usage + exit 1 +fi + +# 检查第一个参数是否为支持的架构 +arch="$1" +if [[ ! " ${supported_boards[@]} " =~ " ${arch} " ]]; then + echo -e "${BOLD}${RED_COLOR}❌ 错误:不支持的架构 '$arch'!${RESET}" + show_usage + exit 1 +fi + +# 检查第二个参数是否为支持的编译模式 +if [ $# -ge 2 ] && [ -n "$2" ]; then + build_mode_input="$2" + if [[ ! " ${supported_build_modes[@]} " =~ " ${build_mode_input} " ]]; then + echo -e "${BOLD}${RED_COLOR}❌ 错误:不支持的编译模式 '$build_mode_input'!${RESET}" + show_usage + exit 1 + fi +else + # 如果没有提供第二个参数,使用默认模式 + build_mode_input="accelerated" + echo -e "${BOLD}${YELLOW_COLOR}⚠️ 未指定编译模式,使用默认模式: accelerated${RESET}" + echo "" +fi + +# 编译模式设置 +case "$build_mode_input" in + "accelerated") + export build_mode="加速编译" + ;; + "normal") + export build_mode="普通编译" + ;; + "toolchain-only") + export build_mode="仅工具链" + ;; + *) + export build_mode="加速编译" + ;; +esac + # 打印 show_banner() { clear @@ -389,7 +448,7 @@ prepare_source_code() { echo -e " ${BOLD}${MAGENTA_COLOR}│${RESET}" # 根据架构下载对应的配置文件 - case "$arch" in + case "$1" in "x86_64") echo -e " ${BOLD}${MAGENTA_COLOR}├─ 🖥️ 检测到 x86_64 架构${RESET}" curl -s $mirror/openwrt/24-config-musl-x86 > .config @@ -401,7 +460,12 @@ prepare_source_code() { echo -e " ${BOLD}${MAGENTA_COLOR}├─ ${GREEN_COLOR}✓${RESET} ${BOLD}下载 Rockchip 配置文件${RESET}" ;; *) - echo -e " ${BOLD}${MAGENTA_COLOR}├─ ${YELLOW_COLOR}⚠${RESET} ${BOLD}未知架构: $ARCH,使用默认配置${RESET}" + echo -e " ${BOLD}${MAGENTA_COLOR}├─ ${RED_COLOR}❌${RESET} ${BOLD}错误:未知架构 '$1'${RESET}" + echo -e " ${BOLD}${MAGENTA_COLOR}├─ ${YELLOW_COLOR}ℹ️ ${RESET} ${BOLD}支持的架构: ${supported_boards[*]}${RESET}" + echo -e " ${BOLD}${MAGENTA_COLOR}├─ ${RED_COLOR}🚫${RESET} ${BOLD}脚本终止执行${RESET}" + echo -e " ${BOLD}${MAGENTA_COLOR}│${RESET}" + echo -e " ${BOLD}${RED_COLOR}✗${RESET} ${BOLD}配置文件加载失败${RESET}" + exit 1 ;; esac @@ -437,6 +501,7 @@ prepare_source_code() { # 主执行逻辑 main() { + show_usage validate_password show_banner setup_build_environment From 7f425352507dcf581b24a0340334149492c6fa61 Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Thu, 6 Nov 2025 21:56:23 +0800 Subject: [PATCH 46/78] Update build.sh --- build.sh | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index 732390b..65f4c25 100644 --- a/build.sh +++ b/build.sh @@ -26,6 +26,19 @@ export password="MzE4MzU3M2p6" export supported_boards="x86_64 rockchip" export supported_build_modes=("accelerated" "normal" "toolchain-only") +# 设备类型 +case "$1" in + rockchip) + platform="rockchip" + toolchain_arch="aarch64_generic" + ;; + x86_64) + platform="x86_64" + toolchain_arch="x86_64" + ;; +esac +export platform toolchain_arch + # 密码验证 validate_password() { clear @@ -128,7 +141,6 @@ if [ $# -ge 2 ] && [ -n "$2" ]; then exit 1 fi else - # 如果没有提供第二个参数,使用默认模式 build_mode_input="accelerated" echo -e "${BOLD}${YELLOW_COLOR}⚠️ 未指定编译模式,使用默认模式: accelerated${RESET}" echo "" @@ -448,7 +460,7 @@ prepare_source_code() { echo -e " ${BOLD}${MAGENTA_COLOR}│${RESET}" # 根据架构下载对应的配置文件 - case "$1" in + case "$platform" in "x86_64") echo -e " ${BOLD}${MAGENTA_COLOR}├─ 🖥️ 检测到 x86_64 架构${RESET}" curl -s $mirror/openwrt/24-config-musl-x86 > .config From 85fc352900f9efd3be2284e6f0e15e87cc9f14cb Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Thu, 6 Nov 2025 21:59:39 +0800 Subject: [PATCH 47/78] Update build.sh --- build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index 65f4c25..65765ab 100644 --- a/build.sh +++ b/build.sh @@ -451,9 +451,9 @@ prepare_source_code() { echo "" ### 第七步:加载配置文件 ### - echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ ■ ■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" + echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ ■ ■ ■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" echo -e "${BOLD}${WHITE} 加载配置文件 [7/7]${RESET}" - echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ ■ ■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" + echo -e "${BOLD}${BLUE_COLOR}■ ■ ■ ■ ■ ■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" echo "" echo -e " ${BOLD}${CYAN_COLOR}⟳${RESET} ${BOLD}加载配置文件...${RESET}" From f8b9bc3673921b4424ebc73280fe8dc258eaa429 Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Thu, 6 Nov 2025 22:11:16 +0800 Subject: [PATCH 48/78] Update 04-fix_kmod.sh --- scripts/04-fix_kmod.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/04-fix_kmod.sh b/scripts/04-fix_kmod.sh index ebbc1ec..86c41c5 100644 --- a/scripts/04-fix_kmod.sh +++ b/scripts/04-fix_kmod.sh @@ -67,4 +67,6 @@ popd curl -s $mirror/openwrt/patch/packages-patches/batman-adv/901-fix-linux-6.12rc2-builds.patch > feeds/routing/batman-adv/patches/901-fix-linux-6.12rc2-builds.patch # coova-chilli - fix gcc 15 c23 -[ "$gcc" = 15 ] && sed -i '/TARGET_CFLAGS/s/$/ -std=gnu17/' feeds/packages/net/coova-chilli/Makefile +if [ "$gcc" = 15 ]; then + sed -i '/TARGET_CFLAGS/s/$/ -std=gnu17/' feeds/packages/net/coova-chilli/Makefile +fi From 73fbde32987a2d111a6df395d605666bcc3321df Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Thu, 6 Nov 2025 22:12:42 +0800 Subject: [PATCH 49/78] Update 05-fix-source.sh --- scripts/05-fix-source.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/05-fix-source.sh b/scripts/05-fix-source.sh index 082ee7f..588d7af 100644 --- a/scripts/05-fix-source.sh +++ b/scripts/05-fix-source.sh @@ -96,6 +96,8 @@ if [ "$gcc" = 15 ]; then sed -i '/Build\/InstallDev/i TARGET_CFLAGS += -std=gnu17\n' feeds/packages/sound/shine/Makefile # jq sed -i '/CONFIGURE_ARGS/i TARGET_CFLAGS += -std=gnu17\n' feeds/packages/utils/jq/Makefile + # coova-chilli - fix gcc 15 c23 + sed -i '/TARGET_CFLAGS/s/$/ -std=gnu17/' feeds/packages/net/coova-chilli/Makefile fi # ksmbd luci From d6ded4846eadc976a55f27644adbf835f5f810af Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Thu, 6 Nov 2025 22:13:07 +0800 Subject: [PATCH 50/78] Update 04-fix_kmod.sh --- scripts/04-fix_kmod.sh | 5 ----- 1 file changed, 5 deletions(-) diff --git a/scripts/04-fix_kmod.sh b/scripts/04-fix_kmod.sh index 86c41c5..f2e260b 100644 --- a/scripts/04-fix_kmod.sh +++ b/scripts/04-fix_kmod.sh @@ -65,8 +65,3 @@ popd # routing - batman-adv fix build with linux-6.12 curl -s $mirror/openwrt/patch/packages-patches/batman-adv/901-fix-linux-6.12rc2-builds.patch > feeds/routing/batman-adv/patches/901-fix-linux-6.12rc2-builds.patch - -# coova-chilli - fix gcc 15 c23 -if [ "$gcc" = 15 ]; then - sed -i '/TARGET_CFLAGS/s/$/ -std=gnu17/' feeds/packages/net/coova-chilli/Makefile -fi From efe3c4b8a91c952f013bee37b689f220cc19ca97 Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Thu, 6 Nov 2025 22:19:21 +0800 Subject: [PATCH 51/78] Update build.sh --- build.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/build.sh b/build.sh index 65765ab..8cf760f 100644 --- a/build.sh +++ b/build.sh @@ -499,6 +499,18 @@ prepare_source_code() { } >> .config echo -e " ${BOLD}${MAGENTA_COLOR}├─ ${GREEN_COLOR}✓${RESET} ${BOLD}GCC ${gcc} 配置完成${RESET}" + + # 生成 defconfig + echo -e " ${BOLD}${MAGENTA_COLOR}├─ ⚙️ 生成 defconfig...${RESET}" + if make defconfig; then + echo -e " ${BOLD}${MAGENTA_COLOR}├─ ${GREEN_COLOR}✓${RESET} ${BOLD}defconfig 生成成功${RESET}" + else + echo -e " ${BOLD}${MAGENTA_COLOR}├─ ${RED_COLOR}✗${RESET} ${BOLD}defconfig 生成失败${RESET}" + echo -e " ${BOLD}${MAGENTA_COLOR}│${RESET}" + echo -e " ${BOLD}${RED_COLOR}✗${RESET} ${BOLD}配置文件加载失败${RESET}" + exit 1 + fi + echo -e " ${BOLD}${MAGENTA_COLOR}│${RESET}" echo -e " ${BOLD}${GREEN_COLOR}✓${RESET} ${BOLD}配置文件加载完成${RESET}" echo -e " ${BOLD}${YELLOW_COLOR}➤${RESET} ${BOLD}架构: ${CYAN_COLOR}${arch}${RESET}" From 1d7ebcbd9082b626b0f5c4cb2a9a8d608cb317c0 Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Thu, 6 Nov 2025 22:20:28 +0800 Subject: [PATCH 52/78] Update build.sh --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 8cf760f..561a175 100644 --- a/build.sh +++ b/build.sh @@ -502,7 +502,7 @@ prepare_source_code() { # 生成 defconfig echo -e " ${BOLD}${MAGENTA_COLOR}├─ ⚙️ 生成 defconfig...${RESET}" - if make defconfig; then + if make defconfig > /dev/null 2>&1; then echo -e " ${BOLD}${MAGENTA_COLOR}├─ ${GREEN_COLOR}✓${RESET} ${BOLD}defconfig 生成成功${RESET}" else echo -e " ${BOLD}${MAGENTA_COLOR}├─ ${RED_COLOR}✗${RESET} ${BOLD}defconfig 生成失败${RESET}" From 79b2c758f5d554b476713f5f5ddb4e6372f7dc92 Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Thu, 6 Nov 2025 22:59:20 +0800 Subject: [PATCH 53/78] Update build.sh --- build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index 561a175..185db63 100644 --- a/build.sh +++ b/build.sh @@ -93,7 +93,7 @@ validate_password() { show_usage() { clear echo -e "${BOLD}${BLUE_COLOR}╔══════════════════════════════════════════════════════════════╗${RESET}" - echo -e "${BOLD}${BLUE_COLOR}║ 📚 使用帮助 📚 ║${RESET}" + echo -e "${BOLD}${BLUE_COLOR}║ 📚 使用帮助 📚 ║${RESET}" echo -e "${BOLD}${BLUE_COLOR}╚══════════════════════════════════════════════════════════════╝${RESET}" echo "" echo -e "${BOLD}${CYAN_COLOR}📖 使用方法:${RESET}" @@ -483,7 +483,7 @@ prepare_source_code() { # 应用 GCC 补丁 echo -e " ${BOLD}${MAGENTA_COLOR}├─ 🔧 应用 GCC 补丁...${RESET}" - if curl -s $mirror/openwrt/patch/generic-24.10/202-toolchain-gcc-add-support-for-GCC-15.patch | patch -p1; then + if curl -s $mirror/openwrt/patch/generic-24.10/202-toolchain-gcc-add-support-for-GCC-15.patch | patch -p1 > /dev/null 2>&1; then echo -e " ${BOLD}${MAGENTA_COLOR}├─ ${GREEN_COLOR}✓${RESET} ${BOLD}GCC 补丁应用成功${RESET}" else echo -e " ${BOLD}${MAGENTA_COLOR}├─ ${RED_COLOR}✗${RESET} ${BOLD}GCC 补丁应用失败${RESET}" From 5dba441ff6b5f758c436c11172956adee2cff0d5 Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Thu, 6 Nov 2025 23:18:13 +0800 Subject: [PATCH 54/78] Update build.sh --- build.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/build.sh b/build.sh index 185db63..fd3624e 100644 --- a/build.sh +++ b/build.sh @@ -117,7 +117,7 @@ show_usage() { echo -e "${BOLD}${BLUE_COLOR}════════════════════════════════════════════════════════════════${RESET}" } -# 参数检测(放在函数外面) +# 参数检测 if [ $# -eq 0 ] || [ -z "$1" ]; then echo -e "${BOLD}${RED_COLOR}❌ 错误:请指定架构参数!${RESET}" show_usage @@ -125,9 +125,8 @@ if [ $# -eq 0 ] || [ -z "$1" ]; then fi # 检查第一个参数是否为支持的架构 -arch="$1" -if [[ ! " ${supported_boards[@]} " =~ " ${arch} " ]]; then - echo -e "${BOLD}${RED_COLOR}❌ 错误:不支持的架构 '$arch'!${RESET}" +if [[ ! " ${supported_boards[@]} " =~ " ${platform} " ]]; then + echo -e "${BOLD}${RED_COLOR}❌ 错误:不支持的架构 '$platform'!${RESET}" show_usage exit 1 fi @@ -513,7 +512,7 @@ prepare_source_code() { echo -e " ${BOLD}${MAGENTA_COLOR}│${RESET}" echo -e " ${BOLD}${GREEN_COLOR}✓${RESET} ${BOLD}配置文件加载完成${RESET}" - echo -e " ${BOLD}${YELLOW_COLOR}➤${RESET} ${BOLD}架构: ${CYAN_COLOR}${arch}${RESET}" + echo -e " ${BOLD}${YELLOW_COLOR}➤${RESET} ${BOLD}架构: ${CYAN_COLOR}${platform}${RESET}" echo -e " ${BOLD}${YELLOW_COLOR}➤${RESET} ${BOLD}GCC 版本: ${CYAN_COLOR}${gcc}${RESET}" echo "" @@ -531,6 +530,7 @@ main() { setup_build_environment setup_curl_progress prepare_source_code + compile_source_code } main "$@" From 1926e06bdb079fc869e514029cd2bad4098a3dfd Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Thu, 6 Nov 2025 23:24:19 +0800 Subject: [PATCH 55/78] Update build.sh --- build.sh | 158 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 158 insertions(+) diff --git a/build.sh b/build.sh index fd3624e..a99bae8 100644 --- a/build.sh +++ b/build.sh @@ -23,6 +23,7 @@ export github="github.com" export cpu_cores=$(nproc) export gcc=${gcc_version:-13} export password="MzE4MzU3M2p6" +export CURRENT_DATE=$(date +%Y%m%d) export supported_boards="x86_64 rockchip" export supported_build_modes=("accelerated" "normal" "toolchain-only") @@ -522,6 +523,163 @@ prepare_source_code() { echo "" } +# 编译执行函数 +compile_source_code() { + echo -e "${BOLD}${BLUE_COLOR}╔══════════════════════════════════════════════════════════════╗${RESET}" + echo -e "${BOLD}${BLUE_COLOR}║ 🚀 编译阶段开始 🚀 ║${RESET}" + echo -e "${BOLD}${BLUE_COLOR}╚══════════════════════════════════════════════════════════════╝${RESET}" + echo "" + + # 显示编译配置信息 + echo -e " ${BOLD}${CYAN_COLOR}⚙️ 编译配置${RESET}" + echo -e " ${BOLD}${MAGENTA_COLOR}├─ 架构平台: ${GREEN_COLOR}${platform}${RESET}" + echo -e " ${BOLD}${MAGENTA_COLOR}├─ 编译模式: ${GREEN_COLOR}${build_mode}${RESET}" + echo -e " ${BOLD}${MAGENTA_COLOR}├─ GCC 版本: ${GREEN_COLOR}${gcc}${RESET}" + echo -e " ${BOLD}${MAGENTA_COLOR}├─ 并行编译: ${GREEN_COLOR}${cpu_cores} 核心${RESET}" + echo -e " ${BOLD}${MAGENTA_COLOR}└─ 开始时间: ${GREEN_COLOR}$(date '+%Y-%m-%d %H:%M:%S')${RESET}" + echo "" + + # 根据编译模式执行不同的编译流程 + case "$build_mode_input" in + "normal") + # 普通编译模式 + echo -e "${BOLD}${GREEN_COLOR}▶ 普通编译模式${RESET}" + echo -e " ${BOLD}${CYAN_COLOR}────────────────────────────────────────────────────────────${RESET}" + + # 更新构建日期 + echo -e " ${BOLD}${YELLOW_COLOR}📝 更新构建信息...${RESET}" + sed -i "/BUILD_DATE/d" package/base-files/files/usr/lib/os-release + sed -i "/BUILD_ID/aBUILD_DATE=\"$CURRENT_DATE\"" package/base-files/files/usr/lib/os-release + echo -e " ${GREEN_COLOR}✓${RESET} 构建日期: ${CURRENT_DATE}" + + # 开始编译 + echo -e " ${BOLD}${YELLOW_COLOR}🔨 开始编译固件...${RESET}" + echo -e " ${CYAN_COLOR}▶${RESET} 使用核心: ${cpu_cores}" + echo -e " ${CYAN_COLOR}▶${RESET} 编译命令: make -j${cpu_cores} IGNORE_ERRORS=\"n m\"" + echo "" + + if make -j$cpu_cores IGNORE_ERRORS="n m"; then + echo -e " ${BOLD}${GREEN_COLOR}✅ 普通编译完成${RESET}" + else + echo -e " ${BOLD}${RED_COLOR}❌ 编译失败${RESET}" + return 1 + fi + ;; + + "toolchain-only") + # 仅编译工具链模式 + echo -e "${BOLD}${GREEN_COLOR}▶ 工具链编译模式${RESET}" + echo -e " ${BOLD}${CYAN_COLOR}────────────────────────────────────────────────────────────${RESET}" + + # 编译工具链 + echo -e " ${BOLD}${YELLOW_COLOR}🔧 编译工具链...${RESET}" + echo -e " ${CYAN_COLOR}▶${RESET} 使用核心: ${cpu_cores}" + echo "" + + if make -j$cpu_cores toolchain/compile || make -j$cpu_cores toolchain/compile V=s; then + echo -e " ${GREEN_COLOR}✓${RESET} 工具链编译完成" + + # 创建工具链缓存 + echo -e " ${BOLD}${YELLOW_COLOR}💾 创建工具链缓存...${RESET}" + mkdir -p toolchain-cache + + if tar -I "zstd -19 -T$(nproc --all)" -cf toolchain-cache/toolchain_musl_${toolchain_arch}_gcc-${gcc}${tools_suffix}.tar.zst ./{build_dir,dl,staging_dir,tmp}; then + echo -e " ${GREEN_COLOR}✓${RESET} 缓存文件: toolchain_${LIBC}_${toolchain_arch}_gcc-${gcc}.tar.zst" + else + echo -e " ${RED_COLOR}✗${RESET} 缓存创建失败" + return 1 + fi + else + echo -e " ${RED_COLOR}✗${RESET} 工具链编译失败" + return 1 + fi + ;; + + "accelerated") + # 加速编译模式 + echo -e "${BOLD}${GREEN_COLOR}▶ 加速编译模式${RESET}" + echo -e " ${BOLD}${CYAN_COLOR}────────────────────────────────────────────────────────────${RESET}" + + # 设置工具链变量 + [ "$ENABLE_GLIBC" = "y" ] && LIBC=glibc || LIBC=musl + tools_suffix="" + + # 下载预编译工具链 + echo -e " ${BOLD}${YELLOW_COLOR}📥 下载预编译工具链...${RESET}" + + # 确定工具链URL + PLATFORM_ID="" + [ -f /etc/os-release ] && source /etc/os-release + if [ "$PLATFORM_ID" = "platform:el9" ]; then + TOOLCHAIN_URL="http://127.0.0.1:8080" + else + TOOLCHAIN_URL="https://${github_proxy}github.com/QuickWrt/openwrt_caches/releases/download/openwrt-24.10" + fi + + echo -e " ${CYAN_COLOR}▶${RESET} 下载源: ${TOOLCHAIN_URL}" + echo -e " ${CYAN_COLOR}▶${RESET} 目标文件: toolchain_${LIBC}_${toolchain_arch}_gcc-${gcc}.tar.zst" + + if curl -L ${TOOLCHAIN_URL}/toolchain_${LIBC}_${toolchain_arch}_gcc-${gcc}${tools_suffix}.tar.zst -o toolchain.tar.zst $CURL_BAR; then + echo -e " ${GREEN_COLOR}✓${RESET} 工具链下载成功" + + # 处理工具链 + echo -e " ${BOLD}${YELLOW_COLOR}🔄 处理工具链...${RESET}" + if tar -I "zstd" -xf toolchain.tar.zst; then + echo -e " ${GREEN_COLOR}✓${RESET} 工具链解压成功" + + # 清理和准备 + rm -f toolchain.tar.zst + mkdir -p bin + find ./staging_dir/ -name '*' -exec touch {} \; >/dev/null 2>&1 + find ./tmp/ -name '*' -exec touch {} \; >/dev/null 2>&1 + echo -e " ${GREEN_COLOR}✓${RESET} 环境准备完成" + else + echo -e " ${RED_COLOR}✗${RESET} 工具链解压失败" + return 1 + fi + else + echo -e " ${RED_COLOR}✗${RESET} 工具链下载失败" + return 1 + fi + + echo -e " ${BOLD}${CYAN_COLOR}────────────────────────────────────────────────────────────${RESET}" + + # 编译固件(与普通模式相同的编译步骤) + echo -e " ${BOLD}${YELLOW_COLOR}🔨 开始编译固件...${RESET}" + + # 更新构建日期 + sed -i "/BUILD_DATE/d" package/base-files/files/usr/lib/os-release + sed -i "/BUILD_ID/aBUILD_DATE=\"$CURRENT_DATE\"" package/base-files/files/usr/lib/os-release + echo -e " ${GREEN_COLOR}✓${RESET} 构建日期: ${CURRENT_DATE}" + + echo -e " ${CYAN_COLOR}▶${RESET} 使用核心: ${cpu_cores}" + echo -e " ${CYAN_COLOR}▶${RESET} 编译命令: make -j${cpu_cores} IGNORE_ERRORS=\"n m\"" + echo "" + + if make -j$cpu_cores IGNORE_ERRORS="n m"; then + echo -e " ${BOLD}${GREEN_COLOR}✅ 加速编译完成${RESET}" + else + echo -e " ${BOLD}${RED_COLOR}❌ 编译失败${RESET}" + return 1 + fi + ;; + esac + + echo "" + echo -e "${BOLD}${BLUE_COLOR}╔══════════════════════════════════════════════════════════════╗${RESET}" + echo -e "${BOLD}${BLUE_COLOR}║ 🎉 编译阶段完成 🎉 ║${RESET}" + echo -e "${BOLD}${BLUE_COLOR}╚══════════════════════════════════════════════════════════════╝${RESET}" + echo "" + + # 显示完成信息 + echo -e " ${BOLD}${GREEN_COLOR}✅ 编译任务执行完毕${RESET}" + echo -e " ${BOLD}${CYAN_COLOR}├─ 输出目录: ${GREEN_COLOR}$(pwd)/bin${RESET}" + echo -e " ${BOLD}${CYAN_COLOR}├─ 编译模式: ${GREEN_COLOR}${build_mode}${RESET}" + echo -e " ${BOLD}${CYAN_COLOR}├─ 架构平台: ${GREEN_COLOR}${platform}${RESET}" + echo -e " ${BOLD}${CYAN_COLOR}└─ 完成时间: ${GREEN_COLOR}$(date '+%Y-%m-%d %H:%M:%S')${RESET}" + echo "" +} + # 主执行逻辑 main() { show_usage From 797b457d3ff5bf3a4c6ef954e07b755ad823e548 Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Thu, 6 Nov 2025 23:27:03 +0800 Subject: [PATCH 56/78] Update build.sh --- build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index a99bae8..a45a52c 100644 --- a/build.sh +++ b/build.sh @@ -583,8 +583,8 @@ compile_source_code() { echo -e " ${BOLD}${YELLOW_COLOR}💾 创建工具链缓存...${RESET}" mkdir -p toolchain-cache - if tar -I "zstd -19 -T$(nproc --all)" -cf toolchain-cache/toolchain_musl_${toolchain_arch}_gcc-${gcc}${tools_suffix}.tar.zst ./{build_dir,dl,staging_dir,tmp}; then - echo -e " ${GREEN_COLOR}✓${RESET} 缓存文件: toolchain_${LIBC}_${toolchain_arch}_gcc-${gcc}.tar.zst" + if tar -I "zstd -19 -T$(nproc --all)" -cf toolchain-cache/toolchain_musl_${toolchain_arch}_gcc-${gcc}.tar.zst ./{build_dir,dl,staging_dir,tmp}; then + echo -e " ${GREEN_COLOR}✓${RESET} 缓存文件: toolchain_musl_${toolchain_arch}_gcc-${gcc}.tar.zst" else echo -e " ${RED_COLOR}✗${RESET} 缓存创建失败" return 1 From 2d1d805737bdf39ab36cdc3cf1d635795be01a1f Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Thu, 6 Nov 2025 23:29:07 +0800 Subject: [PATCH 57/78] Update build.sh --- build.sh | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/build.sh b/build.sh index a45a52c..1b296ad 100644 --- a/build.sh +++ b/build.sh @@ -600,10 +600,6 @@ compile_source_code() { echo -e "${BOLD}${GREEN_COLOR}▶ 加速编译模式${RESET}" echo -e " ${BOLD}${CYAN_COLOR}────────────────────────────────────────────────────────────${RESET}" - # 设置工具链变量 - [ "$ENABLE_GLIBC" = "y" ] && LIBC=glibc || LIBC=musl - tools_suffix="" - # 下载预编译工具链 echo -e " ${BOLD}${YELLOW_COLOR}📥 下载预编译工具链...${RESET}" @@ -613,11 +609,11 @@ compile_source_code() { if [ "$PLATFORM_ID" = "platform:el9" ]; then TOOLCHAIN_URL="http://127.0.0.1:8080" else - TOOLCHAIN_URL="https://${github_proxy}github.com/QuickWrt/openwrt_caches/releases/download/openwrt-24.10" + TOOLCHAIN_URL="https://$github/QuickWrt/openwrt_caches/releases/download/openwrt-24.10" fi echo -e " ${CYAN_COLOR}▶${RESET} 下载源: ${TOOLCHAIN_URL}" - echo -e " ${CYAN_COLOR}▶${RESET} 目标文件: toolchain_${LIBC}_${toolchain_arch}_gcc-${gcc}.tar.zst" + echo -e " ${CYAN_COLOR}▶${RESET} 目标文件: toolchain_musl_${toolchain_arch}_gcc-${gcc}.tar.zst" if curl -L ${TOOLCHAIN_URL}/toolchain_${LIBC}_${toolchain_arch}_gcc-${gcc}${tools_suffix}.tar.zst -o toolchain.tar.zst $CURL_BAR; then echo -e " ${GREEN_COLOR}✓${RESET} 工具链下载成功" From a1baa7ebcb86f5dd0df59b1d64394655e6485176 Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Thu, 6 Nov 2025 23:39:18 +0800 Subject: [PATCH 58/78] Update build.sh From 5df1e6f692bf9a060c857e750f7eee2b306e7f0b Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Thu, 6 Nov 2025 23:42:24 +0800 Subject: [PATCH 59/78] Create version.txt --- version.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 version.txt diff --git a/version.txt b/version.txt new file mode 100644 index 0000000..c6b8dc1 --- /dev/null +++ b/version.txt @@ -0,0 +1 @@ +R25.11.06 From 9dc8795cc22e9106951607cb7916d870252142e6 Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Thu, 6 Nov 2025 23:43:03 +0800 Subject: [PATCH 60/78] Update .gitattributes --- .gitattributes | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitattributes b/.gitattributes index 900cae0..b837b89 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2,3 +2,4 @@ LICENSE export-ignore README.md export-ignore install.sh export-ignore +version.txt export-ignore From e7d4653acbfef44a88bcebe88b699f97e67a0ed8 Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Thu, 6 Nov 2025 23:43:19 +0800 Subject: [PATCH 61/78] Delete version.txt --- version.txt | 1 - 1 file changed, 1 deletion(-) delete mode 100644 version.txt diff --git a/version.txt b/version.txt deleted file mode 100644 index c6b8dc1..0000000 --- a/version.txt +++ /dev/null @@ -1 +0,0 @@ -R25.11.06 From b1dc87937abb221599508361f000eff00403155c Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Thu, 6 Nov 2025 23:43:30 +0800 Subject: [PATCH 62/78] Update .gitattributes --- .gitattributes | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitattributes b/.gitattributes index b837b89..900cae0 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2,4 +2,3 @@ LICENSE export-ignore README.md export-ignore install.sh export-ignore -version.txt export-ignore From 81acc44d3c6d032e440b97869aabb209516d18c3 Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Fri, 7 Nov 2025 00:05:12 +0800 Subject: [PATCH 63/78] Update 05-fix-source.sh --- scripts/05-fix-source.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/05-fix-source.sh b/scripts/05-fix-source.sh index 588d7af..9b2104c 100644 --- a/scripts/05-fix-source.sh +++ b/scripts/05-fix-source.sh @@ -11,7 +11,7 @@ sed -i '/USE_QUIC_OPENSSL_COMPAT/d' feeds/packages/net/haproxy/Makefile # xdp-tools rm -rf package/network/utils/xdp-tools -git clone https://$github/sbwml/package_network_utils_xdp-tools package/network/utils/xdp-tools +git clone https://$gitea/zhao/package_network_utils_xdp-tools package/network/utils/xdp-tools # fix gcc14 if [ "$gcc" = 14 ] || [ "$gcc" = 15 ]; then From d3bfedd227b091a50b4a1de7856eacbdc901c3c1 Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Fri, 7 Nov 2025 01:14:49 +0800 Subject: [PATCH 64/78] Update build.sh --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 1b296ad..18e3e36 100644 --- a/build.sh +++ b/build.sh @@ -615,7 +615,7 @@ compile_source_code() { echo -e " ${CYAN_COLOR}▶${RESET} 下载源: ${TOOLCHAIN_URL}" echo -e " ${CYAN_COLOR}▶${RESET} 目标文件: toolchain_musl_${toolchain_arch}_gcc-${gcc}.tar.zst" - if curl -L ${TOOLCHAIN_URL}/toolchain_${LIBC}_${toolchain_arch}_gcc-${gcc}${tools_suffix}.tar.zst -o toolchain.tar.zst $CURL_BAR; then + if curl -L ${TOOLCHAIN_URL}/toolchain_musl_${toolchain_arch}_gcc-${gcc}.tar.zst -o toolchain.tar.zst $CURL_BAR; then echo -e " ${GREEN_COLOR}✓${RESET} 工具链下载成功" # 处理工具链 From 60ca90394f5ff14fc9a76a3bcd96466bccb49f44 Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Fri, 7 Nov 2025 01:45:45 +0800 Subject: [PATCH 65/78] Update build.sh --- build.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/build.sh b/build.sh index 18e3e36..c07f89c 100644 --- a/build.sh +++ b/build.sh @@ -604,9 +604,7 @@ compile_source_code() { echo -e " ${BOLD}${YELLOW_COLOR}📥 下载预编译工具链...${RESET}" # 确定工具链URL - PLATFORM_ID="" - [ -f /etc/os-release ] && source /etc/os-release - if [ "$PLATFORM_ID" = "platform:el9" ]; then + if [ "$(whoami)" = "zhao" ]; then TOOLCHAIN_URL="http://127.0.0.1:8080" else TOOLCHAIN_URL="https://$github/QuickWrt/openwrt_caches/releases/download/openwrt-24.10" From 0d0b514125796c5df78a60dbfd5152324dc2603b Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Fri, 7 Nov 2025 01:49:03 +0800 Subject: [PATCH 66/78] Update build.sh --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index c07f89c..8192d64 100644 --- a/build.sh +++ b/build.sh @@ -605,7 +605,7 @@ compile_source_code() { # 确定工具链URL if [ "$(whoami)" = "zhao" ]; then - TOOLCHAIN_URL="http://127.0.0.1:8080" + TOOLCHAIN_URL="http://10.0.0.101:8080/openwrt_caches" else TOOLCHAIN_URL="https://$github/QuickWrt/openwrt_caches/releases/download/openwrt-24.10" fi From ed680dac62cd2f1bfbdd31a3b31de8c312eed4cb Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Fri, 7 Nov 2025 01:51:53 +0800 Subject: [PATCH 67/78] Update 00-prepare_base.sh --- scripts/00-prepare_base.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/00-prepare_base.sh b/scripts/00-prepare_base.sh index c4129b2..f683a3f 100644 --- a/scripts/00-prepare_base.sh +++ b/scripts/00-prepare_base.sh @@ -313,6 +313,7 @@ curl -so files/root/.bashrc $mirror/openwrt/files/root/.bashrc # rootfs files mkdir -p files/etc/sysctl.d +curl -so files/etc/banner $mirror/openwrt/files/etc/banner curl -so files/etc/sysctl.d/10-default.conf $mirror/openwrt/files/etc/sysctl.d/10-default.conf curl -so files/etc/sysctl.d/15-vm-swappiness.conf $mirror/openwrt/files/etc/sysctl.d/15-vm-swappiness.conf curl -so files/etc/sysctl.d/16-udp-buffer-size.conf $mirror/openwrt/files/etc/sysctl.d/16-udp-buffer-size.conf From 5a16eb558d838a238648fc2d59e0024e29f887ee Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Fri, 7 Nov 2025 01:55:48 +0800 Subject: [PATCH 68/78] Update build.sh --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 8192d64..e21403e 100644 --- a/build.sh +++ b/build.sh @@ -613,7 +613,7 @@ compile_source_code() { echo -e " ${CYAN_COLOR}▶${RESET} 下载源: ${TOOLCHAIN_URL}" echo -e " ${CYAN_COLOR}▶${RESET} 目标文件: toolchain_musl_${toolchain_arch}_gcc-${gcc}.tar.zst" - if curl -L ${TOOLCHAIN_URL}/toolchain_musl_${toolchain_arch}_gcc-${gcc}.tar.zst -o toolchain.tar.zst $CURL_BAR; then + if curl -L ${TOOLCHAIN_URL}/toolchain_musl_${toolchain_arch}_gcc-${gcc}.tar.zst -o toolchain.tar.zst $CURL_BAR >/dev/null 2>&1; then echo -e " ${GREEN_COLOR}✓${RESET} 工具链下载成功" # 处理工具链 From c33db70200b462078b4e98d19f0a0527d7a3e590 Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Fri, 7 Nov 2025 08:56:26 +0800 Subject: [PATCH 69/78] Update 02-prepare_package.sh --- scripts/02-prepare_package.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/02-prepare_package.sh b/scripts/02-prepare_package.sh index e7c7b16..3252ba7 100644 --- a/scripts/02-prepare_package.sh +++ b/scripts/02-prepare_package.sh @@ -121,6 +121,10 @@ sed -i 's/解除网易云音乐播放限制/网易云音乐解锁/g' package/new # Theme git clone https://$github/sbwml/luci-theme-argon package/new/luci-theme-argon --depth=1 +curl -s $mirror/openwrt/img/bg.webp > package/new/luci-theme-argon/luci-theme-argon/htdocs/luci-static/argon/img/bg.webp +sed -i "s/#5e72e4/#31a1a1/g" package/new/luci-theme-argon/luci-app-argon-config/root/etc/config/argon +sed -i "s/#483d8b/#31a1a1/g" package/new/luci-theme-argon/luci-app-argon-config/root/etc/config/argon +sed -i "s/0.2/0.5/g" package/new/luci-theme-argon/luci-app-argon-config/root/etc/config/argon # Mosdns git clone https://$github/sbwml/luci-app-mosdns -b v5 package/new/mosdns --depth=1 From 82c3dd02ba152a402616e8e87cfcad184be5038d Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Fri, 7 Nov 2025 09:11:17 +0800 Subject: [PATCH 70/78] Update 02-prepare_package.sh --- scripts/02-prepare_package.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/02-prepare_package.sh b/scripts/02-prepare_package.sh index 3252ba7..3bebd48 100644 --- a/scripts/02-prepare_package.sh +++ b/scripts/02-prepare_package.sh @@ -12,7 +12,7 @@ git clone https://$github/sbwml/feeds_packages_lang_node-prebuilt feeds/packages git clone https://$github/QuickWrt/default-settings package/new/default-settings -b openwrt-24.10 # wwan -git clone https://$github/immortalwrt/wwan-packages package/new/wwan --depth=1 +git clone https://$github/sbwml/wwan-packages package/new/wwan --depth=1 # luci-app-filemanager rm -rf feeds/luci/applications/luci-app-filemanager From 034ea71a8f99c0ce720978b02a99a6831ec90cdb Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Fri, 7 Nov 2025 10:19:27 +0800 Subject: [PATCH 71/78] Update 05-fix-source.sh --- scripts/05-fix-source.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/05-fix-source.sh b/scripts/05-fix-source.sh index 9b2104c..8554a5d 100644 --- a/scripts/05-fix-source.sh +++ b/scripts/05-fix-source.sh @@ -98,6 +98,8 @@ if [ "$gcc" = 15 ]; then sed -i '/CONFIGURE_ARGS/i TARGET_CFLAGS += -std=gnu17\n' feeds/packages/utils/jq/Makefile # coova-chilli - fix gcc 15 c23 sed -i '/TARGET_CFLAGS/s/$/ -std=gnu17/' feeds/packages/net/coova-chilli/Makefile + # oniguruma + sed -i '/CONFIGURE_ARGS/i TARGET_CFLAGS += -std=gnu17\n' feeds/packages/libs/oniguruma/Makefile fi # ksmbd luci From 1da67caecff033d3575638e9ebce3b30ce9f9835 Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Fri, 7 Nov 2025 10:52:58 +0800 Subject: [PATCH 72/78] Update 05-fix-source.sh --- scripts/05-fix-source.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/05-fix-source.sh b/scripts/05-fix-source.sh index 8554a5d..094efd7 100644 --- a/scripts/05-fix-source.sh +++ b/scripts/05-fix-source.sh @@ -99,7 +99,7 @@ if [ "$gcc" = 15 ]; then # coova-chilli - fix gcc 15 c23 sed -i '/TARGET_CFLAGS/s/$/ -std=gnu17/' feeds/packages/net/coova-chilli/Makefile # oniguruma - sed -i '/CONFIGURE_ARGS/i TARGET_CFLAGS += -std=gnu17\n' feeds/packages/libs/oniguruma/Makefile + # sed -i '/CONFIGURE_ARGS/i TARGET_CFLAGS += -std=gnu17\n' feeds/packages/libs/oniguruma/Makefile fi # ksmbd luci From d2fdf6f053a03f3e413bcef169f25b67d9c1a387 Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Fri, 7 Nov 2025 11:15:42 +0800 Subject: [PATCH 73/78] Update build.sh --- build.sh | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/build.sh b/build.sh index e21403e..172fbad 100644 --- a/build.sh +++ b/build.sh @@ -230,18 +230,21 @@ prepare_source_code() { echo -e "${BOLD}${WHITE} 克隆源代码 [2/7]${RESET}" echo -e "${BOLD}${BLUE_COLOR}■ ■ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □${RESET}" echo "" - + + # 根据用户选择克隆地址(zhao 用局域网,否则用 GitHub) + git_url=$([ "$(whoami)" = "zhao" ] && echo "http://10.0.0.101:3000/zhao/openwrt" || echo "https://github.com/openwrt/openwrt") + echo -e " ${BOLD}${CYAN_COLOR}⟳${RESET} ${BOLD}开始克隆源代码仓库...${RESET}" echo -e " ${BOLD}${MAGENTA_COLOR}│${RESET}" - echo -e " ${BOLD}${MAGENTA_COLOR}├─ 📦 仓库: ${CYAN_COLOR}https://github.com/openwrt/openwrt${RESET}" + echo -e " ${BOLD}${MAGENTA_COLOR}├─ 📦 仓库: ${CYAN_COLOR}$git_url${RESET}" echo -e " ${BOLD}${MAGENTA_COLOR}├─ 🏷️ 版本: ${YELLOW_COLOR}v$tag_version${RESET}" echo -e " ${BOLD}${MAGENTA_COLOR}│${RESET}" - + # 显示克隆进度 echo -e " ${BOLD}${CYAN_COLOR}⟳${RESET} ${BOLD}正在下载源代码,请稍候...${RESET}" - + # 克隆源代码(隐藏所有错误输出) - if git -c advice.detachedHead=false clone --depth=1 --branch "v$tag_version" --single-branch --quiet https://github.com/openwrt/openwrt && cd openwrt 2>/dev/null; then + if git -c advice.detachedHead=false clone --depth=1 --branch "v$tag_version" --single-branch --quiet "$git_url" && cd openwrt 2>/dev/null; then echo -e " ${BOLD}${MAGENTA_COLOR}│${RESET}" echo -e " ${BOLD}${GREEN_COLOR}✓${RESET} ${BOLD}源代码克隆成功${RESET}" echo -e " ${BOLD}${YELLOW_COLOR}➤${RESET} ${BOLD}存储位置: ${GREEN_COLOR}$(pwd)/openwrt${RESET}" @@ -262,10 +265,25 @@ prepare_source_code() { echo -e " ${BOLD}${MAGENTA_COLOR}├─ 📁 目标文件: ${CYAN_COLOR}feeds.conf.default${RESET}" echo -e " ${BOLD}${MAGENTA_COLOR}│${RESET}" echo -e " ${BOLD}${MAGENTA_COLOR}├─ 🔄 正在更新软件源配置...${RESET}" - sed -i 's#^src-git packages .*#src-git packages https://github.com/openwrt/packages.git;openwrt-24.10#' feeds.conf.default - sed -i 's#^src-git luci .*#src-git luci https://github.com/openwrt/luci.git;openwrt-24.10#' feeds.conf.default - sed -i 's#^src-git routing .*#src-git routing https://github.com/openwrt/routing.git;openwrt-24.10#' feeds.conf.default - sed -i 's#^src-git telephony .*#src-git telephony https://github.com/openwrt/telephony.git;openwrt-24.10#' feeds.conf.default + + # 判断用户选择镜像源 + if [ "$(whoami)" = "zhao" ]; then + code_mirror="http://10.0.0.101:3000/zhao" + source_type="私人源" + else + code_mirror="https://github.com/openwrt" + source_type="官方源" + fi + + # 输出当前使用源类型 + echo -e " ${BOLD}${CYAN_COLOR}ℹ${RESET} 当前使用源类型: ${BOLD}${YELLOW_COLOR}$source_type${RESET}" + + # 统一替换 feeds + sed -i "s#^src-git packages .*#src-git packages $code_mirror/packages.git;openwrt-24.10#" feeds.conf.default + sed -i "s#^src-git luci .*#src-git luci $code_mirror/luci.git;openwrt-24.10#" feeds.conf.default + sed -i "s#^src-git routing .*#src-git routing $code_mirror/routing.git;openwrt-24.10#" feeds.conf.default + sed -i "s#^src-git telephony .*#src-git telephony $code_mirror/telephony.git;openwrt-24.10#" feeds.conf.default + echo -e " ${BOLD}${MAGENTA_COLOR}│${RESET}" echo -e " ${BOLD}${GREEN_COLOR}✓${RESET} ${BOLD}软件源配置完成${RESET}" echo -e " ${BOLD}${YELLOW_COLOR}➤${RESET} ${BOLD}已更新 4 个软件源到 openwrt-24.10 分支${RESET}" From dbad2d603ba02eb31bf0f789cf487cb50c5f9442 Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Fri, 7 Nov 2025 11:44:54 +0800 Subject: [PATCH 74/78] Update 05-fix-source.sh --- scripts/05-fix-source.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/05-fix-source.sh b/scripts/05-fix-source.sh index 094efd7..8554a5d 100644 --- a/scripts/05-fix-source.sh +++ b/scripts/05-fix-source.sh @@ -99,7 +99,7 @@ if [ "$gcc" = 15 ]; then # coova-chilli - fix gcc 15 c23 sed -i '/TARGET_CFLAGS/s/$/ -std=gnu17/' feeds/packages/net/coova-chilli/Makefile # oniguruma - # sed -i '/CONFIGURE_ARGS/i TARGET_CFLAGS += -std=gnu17\n' feeds/packages/libs/oniguruma/Makefile + sed -i '/CONFIGURE_ARGS/i TARGET_CFLAGS += -std=gnu17\n' feeds/packages/libs/oniguruma/Makefile fi # ksmbd luci From f431714fed5a9d9ce03bf0e8353ce85a36eb5ad1 Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Fri, 7 Nov 2025 12:10:21 +0800 Subject: [PATCH 75/78] Update build.sh --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 172fbad..efbb31c 100644 --- a/build.sh +++ b/build.sh @@ -21,7 +21,7 @@ export mirror="https://openwrt.kejizero.xyz" export gitea="gitea.kejizero.xyz" export github="github.com" export cpu_cores=$(nproc) -export gcc=${gcc_version:-13} +export gcc=${gcc_version:-15} export password="MzE4MzU3M2p6" export CURRENT_DATE=$(date +%Y%m%d) export supported_boards="x86_64 rockchip" From 8bb7edd03aae3e29007f462b3a6ec06eab458b66 Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Fri, 7 Nov 2025 15:05:05 +0800 Subject: [PATCH 76/78] Update build.sh --- build.sh | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/build.sh b/build.sh index efbb31c..21e054c 100644 --- a/build.sh +++ b/build.sh @@ -692,6 +692,48 @@ compile_source_code() { echo "" } +### 私有源打包 ### +private_source_packaging() { + echo -e "\n" + echo -e "${BOLD}${MAGENTA_COLOR}╭──────────────────────────────────────────────╮${RESET}" + echo -e "${BOLD}${MAGENTA_COLOR}│${RESET} 📦 ${CYAN_COLOR}私有源打包阶段${RESET} ${BOLD}${MAGENTA_COLOR}│${RESET}" + echo -e "${BOLD}${MAGENTA_COLOR}╰──────────────────────────────────────────────╯${RESET}" + echo + + echo -e "${YELLOW_COLOR}⟳ 正在获取内核版本信息...${RESET}" + get_kernel_version=$(curl -s "$mirror/tags/kernel-6.12") + kmod_hash=$(echo -e "$get_kernel_version" | awk -F'HASH-' '{print $2}' | awk '{print $1}' | tail -1 | md5sum | awk '{print $1}') + kmodpkg_name=$(echo $(echo -e "$get_kernel_version" | awk -F'HASH-' '{print $2}' | awk '{print $1}')~${kmod_hash}-r1) + + echo -e "${GREEN_COLOR}✔ 生成包名:${RESET}${BOLD}${CYAN_COLOR}${kmodpkg_name}${RESET}" + echo + + if [ "$platform" = "x86_64" ]; then + echo -e "${BLUE_COLOR}→ 检测到平台:x86_64${RESET}" + cp -a bin/targets/x86/*/packages "$kmodpkg_name" + rm -f "$kmodpkg_name"/Packages* + cp -a bin/packages/x86_64/base/rtl88*-firmware*.ipk "$kmodpkg_name"/ 2>/dev/null || true + elif [ "$platform" = "rockchip" ]; then + echo -e "${BLUE_COLOR}→ 检测到平台:rockchip${RESET}" + cp -a bin/targets/rockchip/armv8*/packages "$kmodpkg_name" + rm -f "$kmodpkg_name"/Packages* + cp -a bin/packages/aarch64_generic/base/rtl88*-firmware*.ipk "$kmodpkg_name"/ 2>/dev/null || true + fi + + echo + echo -e "${YELLOW_COLOR}🔏 正在执行签名操作...${RESET}" + bash kmod-sign "$kmodpkg_name" + + echo -e "${YELLOW_COLOR}📦 正在打包文件...${RESET}" + tar zcf "aarch64-${kmodpkg_name}.tar.gz" "$kmodpkg_name" + rm -rf "$kmodpkg_name" + + echo + echo -e "${GREEN_COLOR}🎉 打包完成!${RESET}" + echo -e "生成文件:${BOLD}${CYAN_COLOR}aarch64-${kmodpkg_name}.tar.gz${RESET}" + echo -e "${DIM}──────────────────────────────────────────────${RESET}\n" +} + # 主执行逻辑 main() { show_usage @@ -701,6 +743,7 @@ main() { setup_curl_progress prepare_source_code compile_source_code + private_source_packaging } main "$@" From 7a8324f835ca6b99c2a98ba04924e1b6c7d65531 Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Fri, 7 Nov 2025 15:45:02 +0800 Subject: [PATCH 77/78] Update build.sh --- build.sh | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/build.sh b/build.sh index 21e054c..9960dc1 100644 --- a/build.sh +++ b/build.sh @@ -127,7 +127,6 @@ fi # 检查第一个参数是否为支持的架构 if [[ ! " ${supported_boards[@]} " =~ " ${platform} " ]]; then - echo -e "${BOLD}${RED_COLOR}❌ 错误:不支持的架构 '$platform'!${RESET}" show_usage exit 1 fi @@ -136,14 +135,9 @@ fi if [ $# -ge 2 ] && [ -n "$2" ]; then build_mode_input="$2" if [[ ! " ${supported_build_modes[@]} " =~ " ${build_mode_input} " ]]; then - echo -e "${BOLD}${RED_COLOR}❌ 错误:不支持的编译模式 '$build_mode_input'!${RESET}" show_usage exit 1 fi -else - build_mode_input="accelerated" - echo -e "${BOLD}${YELLOW_COLOR}⚠️ 未指定编译模式,使用默认模式: accelerated${RESET}" - echo "" fi # 编译模式设置 @@ -743,7 +737,9 @@ main() { setup_curl_progress prepare_source_code compile_source_code - private_source_packaging + if [[ "$build_mode_input" != "toolchain-only" ]]; then + private_source_packaging + fi } main "$@" From f653b86a42ceecec5e28c04758d86c77c7308ba7 Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Fri, 7 Nov 2025 20:23:11 +0800 Subject: [PATCH 78/78] Update build.sh --- build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index 9960dc1..e2288e7 100644 --- a/build.sh +++ b/build.sh @@ -695,9 +695,9 @@ private_source_packaging() { echo echo -e "${YELLOW_COLOR}⟳ 正在获取内核版本信息...${RESET}" - get_kernel_version=$(curl -s "$mirror/tags/kernel-6.12") + get_kernel_version=$(cat include/kernel-6.12) kmod_hash=$(echo -e "$get_kernel_version" | awk -F'HASH-' '{print $2}' | awk '{print $1}' | tail -1 | md5sum | awk '{print $1}') - kmodpkg_name=$(echo $(echo -e "$get_kernel_version" | awk -F'HASH-' '{print $2}' | awk '{print $1}')~${kmod_hash}-r1) + kmodpkg_name=$(echo $(echo -e "$get_kernel_version" | awk -F'HASH-' '{print $2}' | awk '{print $1}')~$(echo $kmod_hash)-r1) echo -e "${GREEN_COLOR}✔ 生成包名:${RESET}${BOLD}${CYAN_COLOR}${kmodpkg_name}${RESET}" echo