在 Debian 9.x(stretch) 下编译 Lede

6/22/2022 OpenWRTLinux

# 下载源码

git clone https://github.com/coolsnowwolf/lede
1

git clone -b openwrt-18.06 https://github.com/openwrt/openwrt.git
1

# Shortcut FE

make kernel_menuconfig
[*] Enables kernel network stack path for Shortcut Forwarding Engine
1
2

或修改配置文件 .config

CONFIG_PACKAGE_luci-app-turboacc_INCLUDE_SHORTCUT_FE = y
1

# 编译依赖

加入 sid 源

echo 'deb http://mirrors.tencent.com/debian sid main contrib non-free' >> /etc/apt/sources.list 
apt update
1
2

安装依赖

apt -y install \
    build-essential asciidoc binutils bzip2 gawk gettext git \
    libncurses5-dev libz-dev patch python3.5 unzip zlib1g-dev \
    lib32gcc1 libc6-dev-i386 subversion flex uglifyjs p7zip \
    p7zip-full msmtp libssl-dev texinfo libglib2.0-dev xmlto \
    qemu-utils upx libelf-dev autoconf automake libtool \
    autopoint device-tree-compiler linux-libc-dev gcc-11 rsync bc mkisofs
1
2
3
4
5
6
7

# Feeds

./scripts/feeds update -a ./scripts/feeds install -a make menuconfig
1

# 开始编译

非 root 用户

make -j $(nproc) V=s
1

root 用户

export FORCE_UNSAFE_CONFIGURE=1 && make -j $(nproc) V=s
1

打印详细的错误信息

make V=99
1

忽略HASH检查

make PKG_HASH=skip
1

# [可选] 设置内核版本为 5.4

修改 target/linux/x86/Makefile 设置内核版本为 5.4

KERNEL_PATCHVER := 5.4
KERNEL_TESTING_PATCHVER := 5.4
1
2

回退到 87e2f2 以避免部分编译错误

git reset --hard 87e2f2912806ab7d8cc5dd90fd3069f1ff9c5fcb
1

# [可选] 提前下载依赖

make download 
1

# 增加 Feed 的方法

https://openwrt.org/docs/guide-developer/helloworld/chapter4 (opens new window)

cp feeds.conf.default feeds.conf
echo "src-git feedname https://github.com/feedname/feedname" >> feeds.conf
1
2

# 其他

# 禁用文件系统检查

编辑 include/prereq-build.mk

# $(eval $(call TestHostCommand,case-sensitive-fs, \
#	OpenWrt can only be built on a case-sensitive filesystem, \
#	rm -f $(TMP_DIR)/test.*; touch $(TMP_DIR)/test.fs; \
#		test ! -f $(TMP_DIR)/test.FS))
1
2
3
4

# 忽略git的SSL验证

export GIT_SSL_NO_VERIFY=1
1

git config --global http.sslVerify false
1

export http_proxy=socks5://127.0.0.1:30801
https_proxy=socks5://127.0.0.1:30801
all_proxy=socks5://127.0.0.1:30801

Last Updated: 2/11/2023, 2:30:05 AM