ImmortalWrt 编译指南
本文档详细介绍了 ImmortalWrt 的编译步骤和配置方法。
ImmortalWrt 是 OpenWrt 的一个分支,是一个为中国用户优化和增强的 OpenWrt 版本。
因为与 openwrt 的编译步骤没区别,所以只列出不同的地方。
在决定自己编译 ImmortalWrt 前,建议先阅读 OpenWrt 的官方文档:
https://openwrt.org/docs/guide-developer/toolchain/use-buildsystem
- 确保构建目录的完整路径中没有空格。
- 所有操作都是以普通权限用户进行,不需要用root权限。( 安装编译环境除外 )
我之前写了一个非常详细的 openwrt 编译指南,在拉取完源代码后建议跳转
准备编译环境
安装Ubuntu虚拟机,建议内存 8g 或以上,存储 60g 或以上。
首先更新系统并安装必要的依赖包:
sudo apt update
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
下载源码
克隆最新的23.05分支
下载其他版本修改git命令即可,可以去 Github 查看其他版本号Github Branches
建议:下载路径中不要包含中文
mkdir ~/ImmortalWrt
setfacl -d --set u::rwx,g::rx,o::rx ~/ImmortalWrt
cd ImmortalWrt
git clone -b openwrt-23.05 --single-branch --filter=blob:none https://github.com/immortalwrt/immortalwrt
查看拉取的版本
git branch
修改软件源
可以修改feeds.conf.default文件来配置软件源
编辑 feeds 配置文件:
nano feeds.conf.default
src-git packages https://github.com/immortalwrt/packages.git;openwrt-23.05
src-git luci https://github.com/immortalwrt/luci.git;openwrt-23.05
src-git routing https://github.com/openwrt/routing.git;openwrt-23.05
src-git telephony https://github.com/openwrt/telephony.git;openwrt-23.05
# 可选软件源
# iStore
src-git istore https://github.com/linkease/istore;main
# openClash
src-git openclash https://github.com/vernesong/OpenClash.git
# helloworld
# src-git helloworld https://github.com/fw876/helloworld.git
# taskplan
src-git taskplan https://github.com/sirpdboy/luci-app-taskplan
# 第三方源
# src-git nas https://github.com/linkease/nas-packages.git;master
# src-git nas_luci https://github.com/linkease/nas-packages-luci.git;main
src-git smpackage https://github.com/kenzok8/small-package
# src-git kenzo https://github.com/kenzok8/openwrt-packages
# src-git small https://github.com/kenzok8/small
添加默认插件下载源
在编译根目录创建源配置文件 files/etc/opkg/distfeeds.conf
mkdir -p files/etc/opkg
# 注意型号需要改为适配自己的
cat > files/etc/opkg/distfeeds.conf << 'EOF'
src/gz istore_compat https://istore.istoreos.com/repo/all/compat
src/gz immortalwrt_core https://mirrors.vsean.net/openwrt/releases/23.05.7/targets/mediatek/filogic/packages
src/gz immortalwrt_base https://mirrors.vsean.net/openwrt/releases/23.05.7/packages/aarch64_cortex-a53/base
src/gz immortalwrt_luci https://mirrors.vsean.net/openwrt/releases/23.05.7/packages/aarch64_cortex-a53/luci
src/gz immortalwrt_packages https://mirrors.vsean.net/openwrt/releases/23.05.7/packages/aarch64_cortex-a53/packages
src/gz immortalwrt_routing https://mirrors.vsean.net/openwrt/releases/23.05.7/packages/aarch64_cortex-a53/routing
src/gz immortalwrt_telephony https://mirrors.vsean.net/openwrt/releases/23.05.7/packages/aarch64_cortex-a53/telephony
EOF
