飞牛NAS本地编译ImmortalWrt保姆级教学 & 懒人包分享

编译完成的路径: /home/xiaochen/immortalwrt/bin/targets

出处https://github.com/immortalwrt/immortalwrt

构建要求 (Requirements)

要构建此项目,推荐使用 Debian 11 系统。此外,您需要满足以下硬件条件:

  • CPU: 基于 AMD64 架构
  • 内存 (RAM): 至少 4GB
  • 磁盘空间: 至少 25GB 可用空间
  • 网络: 确保互联网访问通畅

编译 ImmortalWrt 需要以下工具链,不同 Linux 发行版的软件包名称可能会有所不同。以下是面向 Debian/Ubuntu 用户的安装示例:

方法一:通过 APT 安装依赖

Bash

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

方法二:使用一键脚本环境配置

Bash

sudo bash -c 'bash <(curl -s https://build-scripts.immortalwrt.org/init_build_environment.sh)'

注意事项 (Note):

  • 权限警告: 所有操作请使用普通用户权限执行,切勿使用 root 用户,也不要加 sudo
  • CPU 架构: 使用其他架构的 CPU 理论上也可以编译 ImmortalWrt,但这需要更多额外的代码调整——我们对此不提供任何保证。
  • 路径规范: 您的系统 PATH 环境变量或工作目录路径中,绝不能包含空格或非 ASCII 字符(如中文字符)。
  • WSL 用户: 如果您使用的是 Windows Subsystem for Linux (WSL),则必须从 PATH 中移除 Windows 系统文件夹,详情请参阅“构建系统设置 WSL”文档。
  • macOS 用户: 不推荐使用 macOS 作为宿主编译系统。我们对此不提供任何保证。您可以从“构建系统设置 macOS”文档中获取相关提示。
  • 更多详情,请参阅“构建系统设置”文档。

快速上手 (Quickstart)

  1. 克隆源码: 运行以下命令克隆源代码(请将 <branch> 替换为您想要编译的分支,例如 masteropenwrt-23.05):Bashgit clone -b <branch> --single-branch --filter=blob:none https://github.com/immortalwrt/immortalwrt
  2. 进入目录: 运行以下命令进入源码目录:Bashcd immortalwrt
  3. 更新软件源 (Feeds): 运行以下命令,获取 feeds.conf / feeds.conf.default 中定义的所有最新软件包:./scripts/feeds update -a
  4. 安装软链接: 运行以下命令,将获取到的所有软件包软链接安装到 package/feeds/ 目录下:./scripts/feeds install -a
  5. 配置固件: 运行以下命令,打开配置菜单,选择您需要的工具链、目标系统(路由器型号)以及固件包含的软件包:make menuconfig
  6. 开始编译: 运行以下命令构建您的固件:Bashmake 系统将自动下载所有源代码,构建交叉编译工具链,然后为您的目标系统交叉编译 GNU/Linux 内核以及所有选定的应用程序。

Requirements

To build with this project, Debian 11 is preferred. And you need use the CPU based on AMD64 architecture, with at least 4GB RAM and 25 GB available disk space. Make sure the Internet is accessible.

The following tools are needed to compile ImmortalWrt, the package names vary between distributions.

  • Here is an example for Debian/Ubuntu users:
    • Method 1:Setup dependencies via APTsudo 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
    • Method 2:sudo bash -c ‘bash <(curl -s https://build-scripts.immortalwrt.org/init_build_environment.sh)’

Note:

  • Do everything as an unprivileged user, not root, without sudo.
  • Using CPUs based on other architectures should be fine to compile ImmortalWrt, but more hacks are needed – No warranty at all.
  • You must not have spaces or non-ascii characters in PATH or in the work folders on the drive.
  • If you’re using Windows Subsystem for Linux (or WSL), removing Windows folders from PATH is required, please see Build system setup WSL documentation.
  • Using macOS as the host build OS is not recommended. No warranty at all. You can get tips from Build system setup macOS documentation.
  • For more details, please see Build system setup documentation.

Quickstart

  1. Run git clone -b <branch> --single-branch --filter=blob:none https://github.com/immortalwrt/immortalwrt to clone the source code.
  2. Run cd immortalwrt to enter source directory.
  3. Run ./scripts/feeds update -a to obtain all the latest package definitions defined in feeds.conf / feeds.conf.default
  4. Run ./scripts/feeds install -a to install symlinks for all obtained packages into package/feeds/
  5. Run make menuconfig to select your preferred configuration for the toolchain, target system & firmware packages.
  6. Run make to build your firmware. This will download all sources, build the cross-compile toolchain and then cross-compile the GNU/Linux kernel & all chosen applications for your target system.
英文插件名 (LuCI -> Applications)中文/通俗名称核心功能简介
adguardhomeAdGuard Home全网去广告、防追踪 DNS 拦截工具
aria2Aria2 下载器高速多线程下载神器
autoreboot自动重启定时重启路由器释放内存
ddns动态 DNS绑定动态公网 IP 到固定域名
dockermanDocker 管理路由器的 Docker 容器可视化管理工具
frpc / frpsFrp 内网穿透常见的内网穿透工具 (分为客户端/服务端)
hd-idle硬盘休眠让挂载的机械硬盘在不使用时停转,省电保护
mosdnsMosDNS非常强大的 DNS 转发和防污染工具
mwan3多线多拨 / 负载均衡支持多条宽带叠加网速,或单线多拨
qbittorrentqBittorrent目前最火的 BT/PT 种子下载工具
samba4Samba 网络共享在电脑上像访问本地硬盘一样访问路由器 U盘
smartdnsSmartDNS测速并优选最快的 DNS IP,加快网页打开速度
sqmSQM Qos 控制改善游戏延迟,防止下载时占用全部带宽
tailscaleTailscale目前非常火的 Mesh VPN 异地组网神器
transmissionTransmission老牌的 BT/PT 种子下载器
ttyd网页终端直接在网页浏览器里使用 SSH 命令行界面
turboaccTurbo ACC 网络加速DNS加速、BBR加速、软硬流控
upnpUPnP 即插即用改善 P2P 下载速度,提升主机游戏联机 NAT 类型
watchcat断网自动重启检测到网络断开时自动重启路由器或光猫
wireguardWireGuard新一代的高性能 VPN 工具
wol网络唤醒远程开机局域网内的电脑或 NAS
zerotierZeroTier 内网穿透异地组网,在外网访问家里局域网设备
¥ 打赏支持
微信扫一扫
微信打赏二维码
感谢您的支持!让我有持续更新的动力
© 版权声明
THE END
点赞2 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片快捷回复

    暂无评论内容