ImmortalWrt

https://github.com/immortalwrt/immortalwrt

换源 https://mirrors.ustc.edu.cn/help/immortalwrt.html

sed -e 's|https://downloads.immortalwrt.org|https://mirrors.ustc.edu.cn/immortalwrt|g' \
    -e 's|https://mirrors.vsean.net/openwrt|https://mirrors.ustc.edu.cn/immortalwrt|g' \
    -i.old /etc/opkg/distfeeds.conf

包管理

opkg update
opkg install <package>

编译

sudo apt update -y
sudo apt full-upgrade -y
sudo apt install -y ack antlr3 asciidoc autoconf automake autopoint binutils bison build-essential \
  bzip2 ccache clang cmake cpio curl device-tree-compiler ecj fastjar flex gawk gettext gcc-multilib \
  g++-multilib git gnutls-dev gperf haveged help2man intltool lib32gcc-s1 libc6-dev-i386 libelf-dev \
  libglib2.0-dev libgmp3-dev libltdl-dev libmpc-dev libmpfr-dev libncurses-dev libpython3-dev \
  libreadline-dev libssl-dev libtool libyaml-dev libz-dev lld llvm lrzsz mkisofs msmtp nano \
  ninja-build p7zip p7zip-full patch pkgconf python3 python3-pip python3-ply python3-docutils \
  python3-pyelftools qemu-utils re2c rsync scons squashfs-tools subversion swig texinfo uglifyjs \
  upx-ucl unzip vim wget xmlto xxd zlib1g-dev zstd
 
git clone -b openwrt-24.10 --single-branch --filter=blob:none https://github.com/immortalwrt/immortalwrt
cd immortalwrt
./scripts/feeds update -a # 获取最新的包定义
./scripts/feeds install -a # 下载安装
make menuconfig
make download -j$(nproc) V= # 下载依赖
make -j$(nproc) || make -j1 || make -j1 V=s # 编译

WSL2编译命令

PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin make -j$(($(nproc) + 1)) || PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin make -j1 V=s

固件下载 https://firmware-selector.immortalwrt.org/

Newifi D2 使用U盘扩展空间 安装USB驱动

opkg install block-mount e2fsprogs kmod-fs-ext4 kmod-usb-storage kmod-usb2 kmod-usb3

格式化U盘

mkfs.ext4 -F /dev/sda1

自动挂载

block detect | uci import fstab  
uci set fstab.@mount[0].enabled='1'  
uci set fstab.@global[0].anon_mount='1'  
uci commit fstab  
/etc/init.d/fstab restart

bootloader

breed

https://breed.hackpascal.net/ 作者: https://github.com/hackpascal TLDR;

breed

有些官方升级固件自带 bootloader,如果从官方固件升级,会导致现有 bootloader 被覆盖。而当 Breed 更新固件时,它会自动删除固件附带的引导加载程序,因此可以防止 Breed 被覆盖。因此通过breed更新固件可以保障设备不变砖。

多设备检测

Ref: https://sunbk201public.notion.site/OpenWrt-f59ae1a76741486092c27bc24dbadc59

UA3F https://blog.sunbk201.site/posts/ua3f/ https://github.com/SunBK201/UA3F

UA修改检测 http://ua-check.stagoh.com http://ua.233996.xyz

ShellCrash https://github.com/juewuy/ShellCrash/blob/dev/README_CN.md

nft规则 /etc/nftables.d/10-custom-filter-chains.nft

# force set ttl to 64
chain mangle_postrouting_ttl64 {
   type filter hook postrouting priority 300; policy accept;
   counter ip ttl set 64
}
 
chain mangle_prerouting_ttl64 {
   type filter hook prerouting priority 300; policy accept;
   counter ip ttl set 64
}
 
# force redirect NTP requests
chain ntp_force_local {
   ip daddr { 0.0.0.0/8, 127.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16 } return comment "Skip NTP redirect for private/reserved IPv4 destinations"
   ip saddr 172.16.0.0/12 dnat to 172.16.1.1 comment "Redirect LAN NTP requests to 192.168.1.1"
}
 
chain dstnat_redirect_ntp {
   type nat hook prerouting priority dstnat; policy accept;
   udp dport 123 jump ntp_force_local comment "Jump to custom ntp_force_local chain for NTP"
}

路由器

Cudy TR1200

刷中间固件 https://www.cudy.com/zh-cn/blogs/faq/openwrt-software-download

刷回官方固件 https://www.cudy.com/zh-cn/blogs/faq/how-to-recovery-the-cudy-router-from-openwrt-firmware-to-cudy-official-firmware

Newifi D2

https://firmware-selector.immortalwrt.org/ CH341A上位机: NeoProgrammer

Cr8808

Flash型号:ESMT F50D1G41LB 1.8V 1 Gbit SPI-NAND Flash Memory 编程器:CH347T,或CH341A→1.8V转换座。 上位机:sNANDer https://github.com/Droid-MAX/SNANDer

刷机 https://www.right.com.cn/forum/thread-8444159-1-2.html 恢复原厂固件 https://www.right.com.cn/forum/thread-8280964-1-2.html

qsdk https://github.com/hzyitc/openwrt-redmi-ax3000