Skip to content
lonelysoul edited this page May 16, 2024 · 16 revisions

Build system setup(x86)on ubuntu 20.04 ,Debian 10:

Prerequisites

#!/bin/bash

# 定义依赖项列表
dependencies=(
    ack antlr3 asciidoc autoconf automake autopoint binutils bison build-essential bzip2 ccache 
    clang cmake cpio curl device-tree-compiler ecj fakeroot fastjar flex gawk gettext genisoimage 
    git gnutls-dev gperf haveged help2man intltool jq libc6-dev-i386 libelf-dev libfuse-dev 
    libglib2.0-dev libgmp3-dev libltdl-dev libmpc-dev libmpfr-dev libncurses5-dev libncursesw5 
    libncursesw5-dev libpython3-dev libreadline-dev libssl-dev libtool libyaml-dev libz-dev lrzsz 
    lld llvm mkisofs msmtp nano ninja-build p7zip p7zip-full patch pkgconf python2.7 python3 
    python3-docutils python3-pip python3-ply python3-pyelftools python3-setuptools qemu-utils 
    quilt re2c rsync scons squashfs-tools subversion swig texinfo uglifyjs unzip upx-ucl vim wget 
    xmlto xxd zlib1g-dev zstd lib32gcc-s1
)

# 更新软件包列表并安装依赖项
sudo apt update -y
sudo apt install -y "${dependencies[@]}"

Initial Compilation

#!/bin/bash

# 克隆 OpenWrt 仓库并切换到指定分支
git clone -b master --single-branch --filter=blob:none https://github.com/immortalwrt/immortalwrt 
# 进入 Immortalwrt 目录
cd immortalwrt

# 更新和安装 feeds
./scripts/feeds update -a
./scripts/feeds install -a

# 复制 UPX 到指定目录
cp /usr/bin/upx staging_dir/host/bin
cp /usr/bin/upx-ucl staging_dir/host/bin

# 再次更新和安装 feeds
./scripts/feeds update -a
./scripts/feeds install -a

# 下载可选的配置文件(如果需要的话)
# wget https://raw.githubusercontent.com/lonelysoul/openwrt-origin/main/.config

# 配置构建
make menuconfig

# 下载并构建固件
make -j8 download V=s
make -j1 V=s

Subsequent Compilation

#!/bin/bash

# 进入 Immortal 目录,更新源码和软件包
cd immortalwrt && git pull && ./scripts/feeds update -a && ./scripts/feeds install -a

# 配置构建
make menuconfig

# 下载并构建固件
make -j8 download
make -j$(( $(nproc) + 1 )) V=s

Reconfigure and Compile

#!/bin/bash

# 移除临时文件和配置文件
rm -rf ./tmp && rm -rf .config

# 配置构建
make menuconfig

# 下载并构建固件
make -j8 download
make -j$(( $(nproc) + 1 )) V=s

V2raya start

For OpenWrt 23.05.0 you have to run:

wget -O /usr/share/xray/geoip.dat https://github.com/v2fly/geoip/releases/latest/download/geoip.dat
wget -O /usr/share/xray/geosite.dat https://github.com/v2fly/domain-list-community/releases/latest/download/dlc.dat

V2raya WhiltList

default: proxy
# 国外域名即使有中国IP也要优先代理
# 注意,LoyalsoldierSite.dat 文件需要预先通过 v2rayA 下载
# 或者手动去它的仓库下载,然后保存为 LoyalsoldierSite.dat
# 仓库地址:https://github.com/Loyalsoldier/v2ray-rules-dat
# domain(ext:"LoyalsoldierSite.dat:geolocation-!cn")->proxy
source(192.168.1.10) -> direct
source(192.168.1.11) -> direct
domain(geosite:apple)->direct
domain(geosite:geolocation-!cn)->proxy
# scholar sites
domain(geosite:google-scholar)->proxy
domain(geosite:category-scholar-!cn, geosite:category-scholar-cn)->direct
domain(geosite:cn)->direct
ip(geoip:hk,geoip:mo)->proxy
ip(geoip:private, geoip:cn)->direct