Compare commits

..

No commits in common. "master" and "20220716" have entirely different histories.

12290 changed files with 1114733 additions and 1478068 deletions

20
.github/ISSUE_TEMPLATE.md vendored Normal file
View File

@ -0,0 +1,20 @@
反馈bug/问题模板,提建议请删除
## 1.关于你要提交的问题
Q是否搜索了issue (使用 "x" 选择)
* [ ] 没有类似的issue
## 2. 详细叙述
### (1) 具体问题
A
### (2) 路由器型号和固件版本
A
### (3) 详细日志
A

View File

@ -1,32 +0,0 @@
name: 问题描述
description: 反馈问题模板
body:
- type: textarea
id: description
attributes:
label: 详细叙述
description: 详细叙述问题
validations:
required: true
- type: checkboxes
id: duplicate_issue
attributes:
label: 重复 issue
description: 是否搜索了 issues
options:
- label: 没有类似的 issue
required: true
- type: input
id: model_name
attributes:
label: 具体型号
description: 硬件型号
validations:
required: true
- type: textarea
id: details_log
attributes:
label: 详细日志
description: make V=s -j1 时的问题日志
validations:
required: true

View File

@ -1,6 +0,0 @@
---
blank_issues_enabled: false
contact_links:
- name: discussion
url: https://github.com/coolsnowwolf/lede/discussions
about: Please ask and answer questions here.

View File

@ -1,4 +1,2 @@
# Pull Request 规则,创建时请删除 Q你知道这是`pull request`吗?(使用 "x" 选择)
* [ ] 我知道
- 禁止有关 "GitHub Actions" 的提交
- 禁止使用 users.noreply.github.com 提交

View File

@ -10,51 +10,39 @@ name: OpenWrt-CI
on: on:
schedule: schedule:
- cron: 0 20 * * * - cron: 0 20 * * *
release:
permissions: types: [published]
contents: read
jobs: jobs:
build_openwrt: build_openwrt:
name: Build OpenWrt Firmware name: Build OpenWrt firmware
runs-on: ubuntu-22.04 runs-on: ubuntu-latest
if: github.event.repository.owner.id == github.event.sender.id
steps: steps:
- name: Space cleanup and Initialization environment
- name: Checkout
uses: actions/checkout@v2
with:
ref: master
- name: Space cleanup
env: env:
DEBIAN_FRONTEND: noninteractive DEBIAN_FRONTEND: noninteractive
run: | run: |
docker rmi `docker images -q` docker rmi `docker images -q`
sudo -E rm -rf /usr/share/dotnet /etc/mysql /etc/php /etc/apt/sources.list.d /usr/local/lib/android sudo rm -rf /usr/share/dotnet /etc/mysql /etc/php /etc/apt/sources.list.d /usr/local/lib/android
sudo -E apt-mark hold grub-efi-amd64-signed sudo -E apt-get -y purge azure-cli ghc* zulu* hhvm llvm* firefox google* dotnet* powershell openjdk* adoptopenjdk* mysql* php* mongodb* dotnet* moby* snapd* || true
sudo -E apt update sudo -E apt-get update
sudo -E apt -y purge azure-cli* docker* ghc* zulu* llvm* firefox google* dotnet* powershell* openjdk* mysql* php* mongodb* dotnet* snap* sudo -E apt-get -y install build-essential asciidoc binutils bzip2 gawk gettext git libncurses5-dev libz-dev patch python3 unzip zlib1g-dev lib32gcc1 libc6-dev-i386 subversion flex uglifyjs gcc-multilib g++-multilib p7zip p7zip-full msmtp libssl-dev texinfo libglib2.0-dev xmlto qemu-utils upx libelf-dev autoconf automake libtool autopoint device-tree-compiler antlr3 gperf swig
sudo -E apt -y full-upgrade sudo -E apt-get -y autoremove --purge
sudo -E apt -y install ack antlr3 asciidoc autoconf automake autopoint binutils bison build-essential bzip2 ccache clang cmake cpio curl device-tree-compiler flex gawk gcc-multilib g++-multilib gettext genisoimage git gperf haveged help2man intltool libc6-dev-i386 libelf-dev libfuse-dev libglib2.0-dev libgmp3-dev libltdl-dev libmpc-dev libmpfr-dev libncurses5-dev libncursesw5-dev libpython3-dev libreadline-dev libssl-dev libtool llvm lrzsz msmtp ninja-build p7zip p7zip-full patch pkgconf python3 python3-pyelftools python3-setuptools qemu-utils rsync scons squashfs-tools subversion swig texinfo uglifyjs upx-ucl unzip vim wget xmlto xxd zlib1g-dev sudo -E apt-get clean
sudo -E systemctl daemon-reload
sudo -E apt -y autoremove --purge
sudo -E apt clean
sudo -E timedatectl set-timezone "Asia/Shanghai"
- name: Checkout OpenWrt df -h
uses: actions/checkout@v4
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: true
# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: true
dotnet: true
haskell: true
large-packages: true
swap-storage: true
- name: Update feeds - name: Update feeds
run: | run: |
@ -65,8 +53,10 @@ jobs:
- name: Generate configuration file - name: Generate configuration file
run: make defconfig run: make defconfig
- name: Download packages - name: Make download
run: make download -j16 run: |
make download -j8
find dl -size -1024c -exec rm -f {} \;
- name: Compile firmware - name: Compile firmware
run: | run: |
@ -82,26 +72,38 @@ jobs:
- name: Prepare artifact - name: Prepare artifact
run: | run: |
mkdir -p ./artifact/firmware
mkdir -p ./artifact/package mkdir -p ./artifact/package
mkdir -p ./artifact/buildinfo mkdir -p ./artifact/buildinfo
rm -rf $(find ./bin/targets/ -type d -name "packages") rm -rf $(find ./bin/targets/ -type d -name "packages")
cp -rf $(find ./bin/targets/ -type f) ./artifact/firmware/
cp -rf $(find ./bin/packages/ -type f -name "*.ipk") ./artifact/package/ cp -rf $(find ./bin/packages/ -type f -name "*.ipk") ./artifact/package/
cp -rf $(find ./bin/targets/ -type f -name "*.buildinfo" -o -name "*.manifest") ./artifact/buildinfo/ cp -rf $(find ./bin/targets/ -type f -name "*.buildinfo" -o -name "*.manifest") ./artifact/buildinfo/
- name: Upload buildinfo - name: Deliver buildinfo
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v2
with: with:
name: OpenWrt_buildinfo name: OpenWrt_buildinfo
path: ./artifact/buildinfo/ path: ./artifact/buildinfo/
- name: Upload package - name: Deliver package
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v2
with: with:
name: OpenWrt_package name: OpenWrt_package
path: ./artifact/package/ path: ./artifact/package/
- name: Upload firmware - name: Deliver firmware
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v2
with: with:
name: OpenWrt_firmware name: OpenWrt_firmware
path: ./bin/targets/ path: ./bin/targets/
- name: Upload release asset
if: github.event == 'release'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.YOURTOKEN }}
file: ./artifact/firmware/*
tag: ${{ github.ref }}
file_glob: true

View File

@ -2,10 +2,10 @@
# #
# Copyright (C) 2006-2013 OpenWrt.org # Copyright (C) 2006-2013 OpenWrt.org
mainmenu "LEDE Configuration" mainmenu "OpenWrt Configuration"
config MODULES config MODULES
modules option modules
bool bool
default y default y
@ -13,14 +13,6 @@ config HAVE_DOT_CONFIG
bool bool
default y default y
HOST_OS := $(shell, uname)
config HOST_OS_LINUX
def_bool $(shell, ./config/check-uname.sh Linux)
config HOST_OS_MACOS
def_bool $(shell, ./config/check-uname.sh Darwin)
source "target/Config.in" source "target/Config.in"
source "config/Config-images.in" source "config/Config-images.in"

View File

@ -10,14 +10,12 @@ export TOPDIR LC_ALL LANG TZ
empty:= empty:=
space:= $(empty) $(empty) space:= $(empty) $(empty)
$(if $(findstring $(space),$(TOPDIR)),$(error ERROR: The path to the LEDE directory must not include any spaces)) $(if $(findstring $(space),$(TOPDIR)),$(error ERROR: The path to the OpenWrt directory must not include any spaces))
world: world:
DISTRO_PKG_CONFIG:=$(shell $(TOPDIR)/scripts/command_all.sh pkg-config | grep -e '/usr' -e '/nix/store' -m 1) DISTRO_PKG_CONFIG:=$(shell which -a pkg-config | grep -E '\/usr' | head -n 1)
export PATH:=$(TOPDIR)/staging_dir/host/bin:$(PATH)
export ORIG_PATH:=$(if $(ORIG_PATH),$(ORIG_PATH),$(PATH))
export PATH:=$(if $(STAGING_DIR),$(abspath $(STAGING_DIR)/../host/bin),$(TOPDIR)/staging_dir/host/bin):$(PATH)
ifneq ($(OPENWRT_BUILD),1) ifneq ($(OPENWRT_BUILD),1)
_SINGLE=export MAKEFLAGS=$(space); _SINGLE=export MAKEFLAGS=$(space);
@ -40,10 +38,7 @@ else
include tools/Makefile include tools/Makefile
include toolchain/Makefile include toolchain/Makefile
# Include the test suite Makefile if it exists $(toolchain/stamp-compile): $(tools/stamp-compile)
-include tests/Makefile
$(toolchain/stamp-compile): $(tools/stamp-compile) $(if $(CONFIG_BUILDBOT),toolchain_rebuild_check)
$(target/stamp-compile): $(toolchain/stamp-compile) $(tools/stamp-compile) $(BUILD_DIR)/.prepared $(target/stamp-compile): $(toolchain/stamp-compile) $(tools/stamp-compile) $(BUILD_DIR)/.prepared
$(package/stamp-compile): $(target/stamp-compile) $(package/stamp-cleanup) $(package/stamp-compile): $(target/stamp-compile) $(package/stamp-cleanup)
$(package/stamp-install): $(package/stamp-compile) $(package/stamp-install): $(package/stamp-compile)
@ -55,23 +50,14 @@ printdb:
prepare: $(target/stamp-compile) prepare: $(target/stamp-compile)
_clean: FORCE clean: FORCE
rm -rf $(BUILD_DIR) $(STAGING_DIR) $(BIN_DIR) $(OUTPUT_DIR)/packages/$(ARCH_PACKAGES) $(TOPDIR)/staging_dir/packages rm -rf $(BUILD_DIR) $(STAGING_DIR) $(BIN_DIR) $(OUTPUT_DIR)/packages/$(ARCH_PACKAGES) $(BUILD_LOG_DIR) $(TOPDIR)/staging_dir/packages
clean: _clean dirclean: clean
rm -rf $(BUILD_LOG_DIR) rm -rf $(STAGING_DIR_HOST) $(STAGING_DIR_HOSTPKG) $(TOOLCHAIN_DIR) $(BUILD_DIR_BASE)/host $(BUILD_DIR_BASE)/hostpkg $(BUILD_DIR_TOOLCHAIN)
targetclean: _clean
rm -rf $(TOOLCHAIN_DIR) $(BUILD_DIR_BASE)/hostpkg $(BUILD_DIR_TOOLCHAIN)
dirclean: targetclean clean
rm -rf $(STAGING_DIR_HOST) $(STAGING_DIR_HOSTPKG) $(BUILD_DIR_BASE)/host
rm -rf $(TMP_DIR) rm -rf $(TMP_DIR)
$(MAKE) -C $(TOPDIR)/scripts/config clean $(MAKE) -C $(TOPDIR)/scripts/config clean
toolchain_rebuild_check:
$(SCRIPT_DIR)/check-toolchain-clean.sh
cacheclean: cacheclean:
ifneq ($(CONFIG_CCACHE),) ifneq ($(CONFIG_CCACHE),)
$(STAGING_DIR_HOST)/bin/ccache -C $(STAGING_DIR_HOST)/bin/ccache -C

View File

@ -1,25 +1,6 @@
# 欢迎来到 Lean 的 LEDE 源码仓库 # 欢迎来到 Lean 的 Openwrt 源码仓库
为国产龙芯 LOONGSON SoC loongarch64 / 飞腾 Phytium 腾锐 D2000 系列架构添加支持 如何编译自己需要的 OpenWrt 固件 [English](./README_EN.md)
I18N: [English](README_EN.md) | [简体中文](README.md) | [日本語](README_JA.md)
## 官方讨论群
如有技术问题需要讨论或者交流,欢迎加入以下群:
1. QQ 讨论群Op 固件技术研究群,号码 891659613加群链接[点击加入](https://qm.qq.com/q/IMa6Yf2SgC "Op固件技术研究群")
2. TG 讨论群OP 编译官方大群,加群链接:[点击加入](https://t.me/JhKgAA6Hx1 "OP 编译官方大群")
## 软路由 ArmSoM Sige 系列介绍
ArmSoM-Sige 系列:软路由、单板计算机、小型服务器与智能家居的全能之选。
[商品介绍页面 - ArmSom 品牌店](https://shop518100695.taobao.com/)
购买链接:
[![sige1-zh](doc/sige-zh.jpg)](https://item.taobao.com/item.htm?id=721197662185)
## 注意 ## 注意
@ -29,7 +10,7 @@ ArmSoM-Sige 系列:软路由、单板计算机、小型服务器与智能家
## 编译命令 ## 编译命令
1. 首先装好 Linux 系统,推荐 Debian 或 Ubuntu LTS 1. 首先装好 Linux 系统,推荐 Debian 11 或 Ubuntu LTS
2. 安装编译依赖 2. 安装编译依赖
@ -37,12 +18,11 @@ ArmSoM-Sige 系列:软路由、单板计算机、小型服务器与智能家
sudo apt update -y sudo apt update -y
sudo apt full-upgrade -y sudo apt full-upgrade -y
sudo apt install -y ack antlr3 asciidoc autoconf automake autopoint binutils bison build-essential \ sudo apt install -y ack antlr3 asciidoc autoconf automake autopoint binutils bison build-essential \
bzip2 ccache clang cmake cpio curl device-tree-compiler flex gawk gcc-multilib g++-multilib gettext \ bzip2 ccache cmake cpio curl device-tree-compiler fastjar flex gawk gettext gcc-multilib g++-multilib \
genisoimage git gperf haveged help2man intltool libc6-dev-i386 libelf-dev libfuse-dev libglib2.0-dev \ git gperf haveged help2man intltool libc6-dev-i386 libelf-dev libglib2.0-dev libgmp3-dev libltdl-dev \
libgmp3-dev libltdl-dev libmpc-dev libmpfr-dev libncurses5-dev libncursesw5-dev libpython3-dev \ libmpc-dev libmpfr-dev libncurses5-dev libncursesw5-dev libreadline-dev libssl-dev libtool lrzsz \
libreadline-dev libssl-dev libtool llvm lrzsz msmtp ninja-build p7zip p7zip-full patch pkgconf \ mkisofs msmtp nano ninja-build p7zip p7zip-full patch pkgconf python2.7 python3 python3-pip libpython3-dev qemu-utils \
python3 python3-pyelftools python3-setuptools qemu-utils rsync scons squashfs-tools subversion \ rsync scons squashfs-tools subversion swig texinfo uglifyjs upx-ucl unzip vim wget xmlto xxd zlib1g-dev
swig texinfo uglifyjs upx-ucl unzip vim wget xmlto xxd zlib1g-dev
``` ```
3. 下载源代码,更新 feeds 并选择配置 3. 下载源代码,更新 feeds 并选择配置
@ -63,7 +43,7 @@ ArmSoM-Sige 系列:软路由、单板计算机、小型服务器与智能家
make V=s -j1 make V=s -j1
``` ```
本套代码保证肯定可以编译成功。里面包括了 R24 所有源代码,包括 IPK 的。 本套代码保证肯定可以编译成功。里面包括了 R21 所有源代码,包括 IPK 的。
你可以自由使用,但源码编译二次发布请注明我的 GitHub 仓库链接。谢谢合作! 你可以自由使用,但源码编译二次发布请注明我的 GitHub 仓库链接。谢谢合作!
@ -82,14 +62,14 @@ make V=s -j$(nproc)
如果需要重新配置: 如果需要重新配置:
```bash ```bash
rm -rf .config rm -rf ./tmp && rm -rf .config
make menuconfig make menuconfig
make V=s -j$(nproc) make V=s -j$(nproc)
``` ```
编译完成后输出路径bin/targets 编译完成后输出路径bin/targets
### 使用 WSL/WSL2 进行编译 ### 如果你使用 WSL/WSL2 进行编译
由于 WSL 的 PATH 中包含带有空格的 Windows 路径,有可能会导致编译失败,请在 `make` 前面加上: 由于 WSL 的 PATH 中包含带有空格的 Windows 路径,有可能会导致编译失败,请在 `make` 前面加上:
@ -97,23 +77,6 @@ make V=s -j$(nproc)
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
``` ```
由于默认情况下,装载到 WSL 发行版的 NTFS 格式的驱动器将不区分大小写,因此大概率在 WSL/WSL2 的编译检查中会返回以下错误:
```txt
Build dependency: OpenWrt can only be built on a case-sensitive filesystem
```
一个比较简洁的解决方法是,在 `git clone` 前先创建 Repository 目录,并为其启用大小写敏感:
```powershell
# 以管理员身份打开终端
PS > fsutil.exe file setCaseSensitiveInfo <your_local_lede_path> enable
# 将本项目 git clone 到开启了大小写敏感的目录 <your_local_lede_path>
PS > git clone https://github.com/coolsnowwolf/lede <your_local_lede_path>
```
> 对已经 `git clone` 完成的项目目录执行 `fsutil.exe` 命令无法生效,大小写敏感只对新增的文件变更有效。
### macOS 原生系统进行编译 ### macOS 原生系统进行编译
1. 在 AppStore 中安装 Xcode 1. 在 AppStore 中安装 Xcode
@ -121,10 +84,10 @@ PS > git clone https://github.com/coolsnowwolf/lede <your_local_lede_path>
2. 安装 Homebrew 2. 安装 Homebrew
```bash ```bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
``` ```
3. 使用 Homebrew 安装工具链、依赖与基础软件包 3. 使用 Homebrew 安装工具链、依赖与基础软件包:
```bash ```bash
brew unlink awk brew unlink awk
@ -134,8 +97,6 @@ PS > git clone https://github.com/coolsnowwolf/lede <your_local_lede_path>
4. 然后输入以下命令,添加到系统环境变量中: 4. 然后输入以下命令,添加到系统环境变量中:
- intel 芯片的 mac
```bash ```bash
echo 'export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"' >> ~/.bashrc echo 'export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"' >> ~/.bashrc
echo 'export PATH="/usr/local/opt/findutils/libexec/gnubin:$PATH"' >> ~/.bashrc echo 'export PATH="/usr/local/opt/findutils/libexec/gnubin:$PATH"' >> ~/.bashrc
@ -146,33 +107,30 @@ PS > git clone https://github.com/coolsnowwolf/lede <your_local_lede_path>
echo 'export PATH="/usr/local/opt/make/libexec/gnubin:$PATH"' >> ~/.bashrc echo 'export PATH="/usr/local/opt/make/libexec/gnubin:$PATH"' >> ~/.bashrc
``` ```
- apple 芯片的 mac
```zsh
echo 'export PATH="/opt/homebrew/opt/coreutils/libexec/gnubin:$PATH"' >> ~/.bashrc
echo 'export PATH="/opt/homebrew/opt/findutils/libexec/gnubin:$PATH"' >> ~/.bashrc
echo 'export PATH="/opt/homebrew/opt/gnu-getopt/bin:$PATH"' >> ~/.bashrc
echo 'export PATH="/opt/homebrew/opt/gnu-tar/libexec/gnubin:$PATH"' >> ~/.bashrc
echo 'export PATH="/opt/homebrew/opt/grep/libexec/gnubin:$PATH"' >> ~/.bashrc
echo 'export PATH="/opt/homebrew/opt/gnu-sed/libexec/gnubin:$PATH"' >> ~/.bashrc
echo 'export PATH="/opt/homebrew/opt/make/libexec/gnubin:$PATH"' >> ~/.bashrc
```
5. 重新加载一下 shell 启动文件 `source ~/.bashrc`,然后输入 `bash` 进入 bash shell就可以和 Linux 一样正常编译了 5. 重新加载一下 shell 启动文件 `source ~/.bashrc`,然后输入 `bash` 进入 bash shell就可以和 Linux 一样正常编译了
## 特别提示 ## 特别提示
1. 源代码中绝不含任何后门和可以监控或者劫持你的 HTTPS 的闭源软件, SSL 安全是互联网最后的壁垒,安全干净才是固件应该做到的。 1. 源代码中绝不含任何后门和可以监控或者劫持你的 HTTPS 的闭源软件, SSL 安全是互联网最后的壁垒。安全干净才是固件应该做到的;
2. 想学习 OpenWrt 开发,但是摸不着门道?自学没毅力?基础太差?怕太难学不会?跟着佐大学 OpenWrt 开发入门培训班助你能学有所成 2. 如有技术问题需要讨论,欢迎加入 QQ 讨论群: OP 共享技术交流群 ,号码 297253733 ,加群链接: 点击链接加入群聊【 OP 共享技术交流群】:[点击加入](https://jq.qq.com/?_wv=1027&k=5yCRuXL "OP共享技术交流群")
3. 想学习 OpenWrt 开发,但是摸不着门道?自学没毅力?基础太差?怕太难学不会?跟着佐大学 OpenWrt 开发入门培训班助你能学有所成
报名地址:[点击报名](http://forgotfun.org/2018/04/openwrt-training-2018.html "报名") 报名地址:[点击报名](http://forgotfun.org/2018/04/openwrt-training-2018.html "报名")
3. QCA IPQ60xx 开源仓库地址:<https://github.com/coolsnowwolf/openwrt-gl-ax1800> 4. QCA IPQ60xx 开源仓库地址:<https://github.com/coolsnowwolf/openwrt-gl-ax1800>
4. 存档版本仓库地址:<https://github.com/coolsnowwolf/openwrt> 5. 稳定版仓库地址:<https://github.com/coolsnowwolf/openwrt>
## 软路由介绍
友情推荐不恰饭:如果你在寻找一个低功耗小体积性能不错的 x86 / x64 路由器我个人建议可以考虑小马v1 的铝合金版本
(N3710 4千兆)[页面介绍](https://item.taobao.com/item.htm?spm=a230r.1.14.20.144c763fRkK0VZ&id=561126544764)
![xm1](doc/xm5.jpg) ![xm2](doc/xm6.jpg)
## 捐贈 ## 捐贈
如果你觉得此项目对你有帮助,可以捐助我们,以鼓励项目能持续发展,更加完善 如果你觉得此项目对你有帮助,可以捐助我们,以鼓励项目能持续发展,更加完善
![star](doc/star.png) 支付宝 ![alipay](doc/alipay_donate.jpg) 微信 ![wechat](doc/wechat_donate.jpg)

View File

@ -1,201 +1,88 @@
# Welcome to Lean's git source of OpenWrt and packages Welcome to Lean's git source of OpenWrt and packages
=
I18N: [English](README_EN.md) | [简体中文](README.md) | [日本語](README_JA.md) How to build your Openwrt firmware.
-
Note:
--
1. DO **NOT** USE **root** USER FOR COMPILING!!!
## Official Channels 2. Users within China should prepare proxy before building.
If you have technical questions for discussion or sharing, feel free to join the following channels: 3. Web admin panel default IP is 192.168.1.1 and default password is "password".
1. QQ Group: *OpenWRT Firmware Technical Research Group*, Group Number is `891659613`. Let's start!
Join the group: [Link](https://jq.qq.com/?_wv=1027&k=XL8SK5aC "Op固件技术研究群"). ---
- [Click to download QQ client](https://im.qq.com/pcqq). 1. First, install Ubuntu 64bit (Ubuntu 20.04 LTS x86 is recommended).
2. Telegram Group: *OpenWRT Firmware Technical Research Group*. 2. Run `sudo apt-get update` in the terminal, and then run
Join the group: [Link](https://t.me/JhKgAA6Hx1 "OP 编译官方大群"). `
sudo apt-get -y install build-essential asciidoc binutils bzip2 gawk gettext git libncurses5-dev libz-dev patch python3 python2.7 unzip zlib1g-dev lib32gcc1 libc6-dev-i386 subversion flex uglifyjs git-core gcc-multilib p7zip p7zip-full msmtp libssl-dev texinfo libglib2.0-dev xmlto qemu-utils upx libelf-dev autoconf automake libtool autopoint device-tree-compiler g++-multilib antlr3 gperf wget curl swig rsync
`
## ArmSoM Sige Board Series Introduction 3. Run `git clone https://github.com/coolsnowwolf/lede` to clone the source code, and then `cd lede` to enter the directory
ArmSoM-Sige Series: Your All-in-One Powerhouse for Soft Routing, SBCs, Mini Servers, and Home Automation. 4. ```bash
[ArmSoM Store](https://www.aliexpress.com/store/1102800175)
Buy Link
[![sige1-en](doc/sige-en.jpg)](https://aliexpress.com/item/3256807356692995.html)
## Notice
1. **Never compile OpenWRT as `root`**
2. If you are living in mainland China, please make sure you could visit the **REAL** Internet.
3. Default login IP is `192.168.1.1`, password is `password`.
## How to Compile
1. Install a Linux distribution, Debian or Ubuntu LTS is recommended.
2. Install dependencies:
```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 flex gawk gcc-multilib g++-multilib gettext \
git gperf haveged help2man intltool libc6-dev-i386 libelf-dev libfuse-dev libglib2.0-dev libgmp3-dev \
libltdl-dev libmpc-dev libmpfr-dev libncurses5-dev libncursesw5-dev libpython3-dev libreadline-dev \
libssl-dev libtool llvm lrzsz mkisofs msmtp nano ninja-build p7zip p7zip-full patch pkgconf python3 \
python3-pyelftools python3-setuptools qemu-utils rsync scons squashfs-tools subversion swig texinfo \
uglifyjs upx-ucl unzip vim wget xmlto xxd zlib1g-dev
```
3. Clone the source code, update `feeds` and configure:
```bash
git clone https://github.com/coolsnowwolf/lede
cd lede
./scripts/feeds update -a ./scripts/feeds update -a
./scripts/feeds install -a ./scripts/feeds install -a
make menuconfig make menuconfig
``` ```
4. Download libraries and compile firmware 5. Run `make -j8 download V=s` to download libraries and dependencies (user in China should use global proxy when possible)
> (`-j` is the thread count, single-thread is recommended for the first build):
```bash 6. Run `make -j1 V=s` (integer following -j is the thread count, single-thread is recommended for the first build) to start building your firmware.
make download -j8
make V=s -j1
```
These commands are supposed to compile the source code successfully. This source code is promised to be compiled successfully.
All source code of R23 is included, including IPK.
You can use this source code freely, but please link this GitHub repository when redistributing. You can use this source code freely, but please link this GitHub repository when redistributing. Thank you for your cooperation!
Thank you for your cooperation! =
Rebuild: Rebuild:
```bash ```bash
cd lede cd lede
git pull git pull
./scripts/feeds update -a ./scripts/feeds update -a && ./scripts/feeds install -a
./scripts/feeds install -a
make defconfig make defconfig
make download -j8 make -j8 download
make V=s -j$(nproc) make -j$(($(nproc) + 1)) V=s
``` ```
If reconfiguration is need: If reconfiguration is need:
```bash ```bash
rm -rf ./tmp && rm -rf .config rm -rf ./tmp && rm -rf .config
make menuconfig make menuconfig
make V=s -j$(nproc) make -j$(($(nproc) + 1)) V=s
``` ```
Build artifacts will be outputted to `bin/targets` directory. Build result will be produced to `bin/targets` directory.
### If you are using WSL/WSL2 as your build environment Special tips:
------
1. This source code doesn't contain any backdoors or close source applications that can monitor/capture your HTTPS traffic, SSL is the final castle of cyber security. Safety is what a firmware should achieve.
WSL's `PATH` potentially contain Windows paths with spaces, which may cause compilation failure. 2. If you have any technical problem, you may join the QQ discussion group: 297253733, link: click [here](https://jq.qq.com/?_wv=1027&k=5yCRuXL)
Please add the following lines to your local environment profiles before compiling:
```bash 3. Want to learn OpenWrt development but don't know how? Can't motivate yourself for self-learning? Not enough fundamental knowledge? Learn OpenWrt development with Mr. Zuo through his Beginner OpenWrt Training Course. Click [here](http://forgotfun.org/2018/04/openwrt-training-2018.html) to register.
# Update and reload your profile, ~/.bashrc for example.
cat << EOF >> ~/.bashrc
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH"
EOF
source ~/.bashrc
```
NTFS-formatted drives mounted to a WSL distribution will be case-insensitive by default. ## Router Recommendation
This will cause the following error when compiling in WSL/WSL2: Not Sponsored: If you are finding a low power consumption, small and performance promising x86/x64 router, I personally recommend the
EZPROv1 Alumium Edition (N3710 4000M): [Details](https://item.taobao.com/item.htm?spm=a230r.1.14.20.144c763fRkK0VZ&id=561126544764)
```txt ![xm1](doc/xm5.jpg)
Build dependency: OpenWrt can only be built on a case-sensitive filesystem ![xm2](doc/xm6.jpg)
```
A simple solution is to create a case-sensitive directory for the repository before `git clone`:
```powershell
# Open a terminal as administrator
PS > fsutil.exe file setCaseSensitiveInfo <your_local_lede_path> enable
# Clone this repository to the case-sensitive directory <your_local_lede_path>
PS > git clone git@github.com:coolsnowwolf/lede.git <your_local_lede_path>
```
> For directories that have already been `git clone`, `fsutil.exe` will not take effect.
> Case sensitivity will only be enabled for new changes in the directory.
### macOS Compilation
1. Install Xcode from AppStore
2. Install Homebrew:
```bash
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
```
3. Install toolchain, dependencies and packages with Homebrew:
```bash
brew unlink awk
brew install coreutils diffutils findutils gawk gnu-getopt gnu-tar grep make ncurses pkg-config wget quilt xz
brew install gcc@11
```
4. Update your system environment:
- mac with intel chip
```bash
echo 'export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"' >> ~/.bashrc
echo 'export PATH="/usr/local/opt/findutils/libexec/gnubin:$PATH"' >> ~/.bashrc
echo 'export PATH="/usr/local/opt/gnu-getopt/bin:$PATH"' >> ~/.bashrc
echo 'export PATH="/usr/local/opt/gnu-tar/libexec/gnubin:$PATH"' >> ~/.bashrc
echo 'export PATH="/usr/local/opt/grep/libexec/gnubin:$PATH"' >> ~/.bashrc
echo 'export PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH"' >> ~/.bashrc
echo 'export PATH="/usr/local/opt/make/libexec/gnubin:$PATH"' >> ~/.bashrc
```
- mac with apple chip
```zsh
echo 'export PATH="/opt/homebrew/opt/coreutils/libexec/gnubin:$PATH"' >> ~/.bashrc
echo 'export PATH="/opt/homebrew/opt/findutils/libexec/gnubin:$PATH"' >> ~/.bashrc
echo 'export PATH="/opt/homebrew/opt/gnu-getopt/bin:$PATH"' >> ~/.bashrc
echo 'export PATH="/opt/homebrew/opt/gnu-tar/libexec/gnubin:$PATH"' >> ~/.bashrc
echo 'export PATH="/opt/homebrew/opt/grep/libexec/gnubin:$PATH"' >> ~/.bashrc
echo 'export PATH="/opt/homebrew/opt/gnu-sed/libexec/gnubin:$PATH"' >> ~/.bashrc
echo 'export PATH="/opt/homebrew/opt/make/libexec/gnubin:$PATH"' >> ~/.bashrc
```
5. Reload your shell profile `source ~/.bashrc && bash`, then you can compile normally like Linux.
## Declaration
1. This source code doesn't contain any backdoors or closed source applications that can monitor/capture your HTTPS traffic. SSL security is the final castle of cyber security. Safety is what a firmware should do.
2. Want to learn OpenWRT development but don't know how to start? Can't motivate yourself for self-learning? Do not have enough fundamental knowledge? Learn OpenWRT development with Mr. Zuo through his Beginner OpenWRT Training Course. Click [here](http://forgotfun.org/2018/04/openwrt-training-2018.html) to register.
3. QCA IPQ60xx open source repository: <https://github.com/coolsnowwolf/openwrt-gl-ax1800>
4. OpenWRT Archive repository: <https://github.com/coolsnowwolf/openwrt>
## Introduction to Software Routers
Yingku R2 - N95/N300 Mini Four-Network HomeLab Server
(Introduction page - Yingku Technology (support AliPay Huabei)):
[Pre-sale link](https://item.taobao.com/item.htm?ft=t&id=719159813003)
<div align="left">
<a href="https://item.taobao.com/item.htm?ft=t&id=719159813003">
<img src="doc/r1.jpg" width = "600" alt="" align=center />
</a>
</div>
<br>
## Donation ## Donation
If this project did helped you, please consider donating to support the development of this project. If this project does help you, please consider donating to support the development of this project.
<div align="left"> ### Alipay
<img src="./doc/star.png" width = "400" alt="" align=center />
</div> ![alipay](doc/alipay_donate.jpg)
<br>
### WeChat
![wechat](doc/wechat_donate.jpg)
## Note: Addition Lean's private package source code in `./package/lean` directory. Use it under GPL v3.
## GPLv3 is compatible with more licenses than GPLv2: it allows you to make combinations with code that has specific kinds of additional requirements that are not in GPLv3 itself. Section 7 has more information about this, including the list of additional requirements that are permitted.

View File

@ -1,191 +0,0 @@
# OpenWrt とパッケージの Lean の git ソースへようこそ
I18N: [English](README_EN.md) | [简体中文](README.md) | [日本語](README_JA.md)
## 公式チャンネル
ディスカッションや共有したい技術的な質問がある場合は、以下のチャンネルにお気軽にご参加ください:
1. QQ グループ: *OpenWRT ファームウェア技術研究グループ*、グループ番号は `891659613` です。
グループに参加する: [リンク](https://jq.qq.com/?_wv=1027&k=XL8SK5aC "Op固件技术研究群")。
- [クリックして QQ クライアントをダウンロードする](https://im.qq.com/pcqq)。
2. Telegram グループ: *OpenWRT ファームウェア技術研究グループ*。グループに参加する: [リンク](https://t.me/JhKgAA6Hx1 "OP 编译官方大群")。
## 注意
1. **OpenWRT を決して `root` としてコンパイルしないこと**
2. 中国本土にお住まいの方は、ぜひ **REAL** インターネットをご覧ください。
3. デフォルトのログイン IP は `192.168.1.1` で、パスワードは `password` です。
## コンパイル方法
1. Linuxディストリビューションをインストールし、Debian または Ubuntu LTS を推奨します。
2. 依存関係をインストールする:
```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 flex gawk gcc-multilib g++-multilib gettext \
git gperf haveged help2man intltool libc6-dev-i386 libelf-dev libfuse-dev libglib2.0-dev libgmp3-dev \
libltdl-dev libmpc-dev libmpfr-dev libncurses5-dev libncursesw5-dev libpython3-dev libreadline-dev \
libssl-dev libtool llvm lrzsz mkisofs msmtp nano ninja-build p7zip p7zip-full patch pkgconf python3 \
python3-pyelftools python3-setuptools qemu-utils rsync scons squashfs-tools subversion swig texinfo \
uglifyjs upx-ucl unzip vim wget xmlto xxd zlib1g-dev
```
3. ソースコードをクローンし、`feeds` を更新し、設定する:
```bash
git clone https://github.com/coolsnowwolf/lede
cd lede
./scripts/feeds update -a
./scripts/feeds install -a
make menuconfig
```
4. ライブラリのダウンロードとファームウェアのコンパイル
> (`-j` はスレッドカウント、最初のビルドはシングルスレッドを推奨):
```bash
make download -j8
make V=s -j1
```
これらのコマンドは、ソースコードを正常にコンパイルするためのものです。
R23 のソースコードは IPK を含めてすべて含まれています。
このソースコードはご自由にお使いいただけますが、再配布の際はこの GitHub リポジトリをリンクしてください。
ご協力ありがとうございました!
リビルド:
```bash
cd lede
git pull
./scripts/feeds update -a
./scripts/feeds install -a
make defconfig
make download -j8
make V=s -j$(nproc)
```
再設定が必要な場合:
```bash
rm -rf ./tmp && rm -rf .config
make menuconfig
make V=s -j$(nproc)
```
ビルドの成果物は `bin/targets` ディレクトリに出力されます。
### WSL/WSL2 をビルド環境として使用している場合
WSL の `PATH` には、Windows のパスが空白で含まれている可能性があり、コンパイルに失敗することがあります。
コンパイルする前に、ローカルの環境プロファイルに以下の行を追加してください:
```bash
# 例えば、~/.bashrc などのプロファイルを更新した後、再読み込みを行う。
cat << EOF >> ~/.bashrc
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH"
EOF
source ~/.bashrc
```
WSL ディストリビューションにマウントされた NTFS フォーマットのドライブは、デフォルトで大文字と小文字が区別されません。
このため、WSL/WSL2 でコンパイルすると、次のようなエラーが発生します:
```txt
Build dependency: OpenWrt can only be built on a case-sensitive filesystem
```
単純な解決策は、`git clone` の前に大文字小文字を区別してリポジトリ用のディレクトリを作成することです:
```powershell
# 管理者としてターミナルを開く
PS > fsutil.exe file setCaseSensitiveInfo <your_local_lede_path> enable
# 大文字と小文字を区別して、このリポジトリを <your_local_lede_path> ディレクトリにクローンする
PS > git clone git@github.com:coolsnowwolf/lede.git <your_local_lede_path>
```
> すでに `git clone` されたディレクトリでは、`fsutil.exe` は有効になりません。
> 大文字小文字の区別はディレクトリの新しい変更に対してのみ有効になります。
### macOS コンパイル
1. AppStore から Xcode をインストールする
2. Homebrew をインストールする:
```bash
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
```
3. Homebrew でツールチェーン、依存関係、パッケージをインストールする:
```bash
brew unlink awk
brew install coreutils diffutils findutils gawk gnu-getopt gnu-tar grep make ncurses pkg-config wget quilt xz
brew install gcc@11
```
4. システム環境のアップデート:
- MacのIntelシリコンバージョン
```bash
echo 'export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"' >> ~/.bashrc
echo 'export PATH="/usr/local/opt/findutils/libexec/gnubin:$PATH"' >> ~/.bashrc
echo 'export PATH="/usr/local/opt/gnu-getopt/bin:$PATH"' >> ~/.bashrc
echo 'export PATH="/usr/local/opt/gnu-tar/libexec/gnubin:$PATH"' >> ~/.bashrc
echo 'export PATH="/usr/local/opt/grep/libexec/gnubin:$PATH"' >> ~/.bashrc
echo 'export PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH"' >> ~/.bashrc
echo 'export PATH="/usr/local/opt/make/libexec/gnubin:$PATH"' >> ~/.bashrc
```
- MacのAppleシリコンバージョン
```zsh
echo 'export PATH="/opt/homebrew/opt/coreutils/libexec/gnubin:$PATH"' >> ~/.bashrc
echo 'export PATH="/opt/homebrew/opt/findutils/libexec/gnubin:$PATH"' >> ~/.bashrc
echo 'export PATH="/opt/homebrew/opt/gnu-getopt/bin:$PATH"' >> ~/.bashrc
echo 'export PATH="/opt/homebrew/opt/gnu-tar/libexec/gnubin:$PATH"' >> ~/.bashrc
echo 'export PATH="/opt/homebrew/opt/grep/libexec/gnubin:$PATH"' >> ~/.bashrc
echo 'export PATH="/opt/homebrew/opt/gnu-sed/libexec/gnubin:$PATH"' >> ~/.bashrc
echo 'export PATH="/opt/homebrew/opt/make/libexec/gnubin:$PATH"' >> ~/.bashrc
```
5. シェルプロファイル `source ~/.bashrc && bash` を再読み込みすれば、Linux のように普通にコンパイルできます。
## 宣言
1. このソースコードには、HTTPS トラフィックを監視キャプチャできるバックドアやクローズドソースアプリケーションは含まれていません。SSL セキュリティはサイバーセキュリティの最後の城です。安全性はファームウェアがすべきことです。
2. OpenWRT の開発を学びたいが、何から始めたらいいかわからないですか?自己学習のモチベーションが上がらない?基礎知識が足りない?ズオ氏の初心者 OpenWRT トレーニングコースで一緒に OpenWRT 開発を学びましょう。お申し込みは[こちら](http://forgotfun.org/2018/04/openwrt-training-2018.html)をクリックしてください。
3. QCA IPQ60xx オープンソースリポジトリ: <https://github.com/coolsnowwolf/openwrt-gl-ax1800>
4. OpenWRT アーカイブリポジトリ: <https://github.com/coolsnowwolf/openwrt>
## ソフトウェアルーター入門
Yingku R2 - N95/N300 Mini Four-Network HomeLab Server
(紹介ページ - Yingku Technology (support AliPay Huabei)):
[先行販売リンク](https://item.taobao.com/item.htm?ft=t&id=719159813003)
<div align="left">
<a href="https://item.taobao.com/item.htm?ft=t&id=719159813003">
<img src="doc/r1.jpg" width = "600" alt="" align=center />
</a>
</div>
<br>
## 寄付
このプロジェクトがあなたのお役に立てたのであれば、このプロジェクトの発展を支援するための寄付をご検討ください。
<div align="left">
<img src="./doc/star.png" width = "400" alt="" align=center />
</div>
<br>

View File

@ -5,6 +5,7 @@
config EXPERIMENTAL config EXPERIMENTAL
bool "Enable experimental features by default" bool "Enable experimental features by default"
default n
help help
Set this option to build with latest bleeding edge features Set this option to build with latest bleeding edge features
which may or may not work as expected. which may or may not work as expected.
@ -20,20 +21,12 @@ menu "Global build settings"
config JSON_OVERVIEW_IMAGE_INFO config JSON_OVERVIEW_IMAGE_INFO
bool "Create JSON info file overview per target" bool "Create JSON info file overview per target"
default y default BUILDBOT
help help
Create a JSON info file called profiles.json in the target Create a JSON info file called profiles.json in the target
directory containing machine readable list of built profiles directory containing machine readable list of built profiles
and resulting images. and resulting images.
config JSON_CYCLONEDX_SBOM
bool "Create CycloneDX SBOM JSON"
default BUILDBOT
help
Create a JSON files *.bom.cdx.json in the build
directory containing Software Bill Of Materials in CycloneDX
format.
config ALL_NONSHARED config ALL_NONSHARED
bool "Select all target specific packages by default" bool "Select all target specific packages by default"
select ALL_KMODS select ALL_KMODS
@ -49,6 +42,7 @@ menu "Global build settings"
config BUILDBOT config BUILDBOT
bool "Set build defaults for automatic builds (e.g. via buildbot)" bool "Set build defaults for automatic builds (e.g. via buildbot)"
default n
help help
This option changes several defaults to be more suitable for This option changes several defaults to be more suitable for
automatic builds. This includes the following changes: automatic builds. This includes the following changes:
@ -64,15 +58,6 @@ menu "Global build settings"
bool "Enable signature checking in opkg" bool "Enable signature checking in opkg"
default SIGNED_PACKAGES default SIGNED_PACKAGES
config DOWNLOAD_CHECK_CERTIFICATE
bool "Enable TLS certificate verification during package download"
default y
config USE_APK
imply PACKAGE_apk-mbedtls
bool "Use APK instead of OPKG to build distribution (BROKEN)"
depends on BROKEN
comment "General build options" comment "General build options"
config TESTING_KERNEL config TESTING_KERNEL
@ -86,8 +71,10 @@ menu "Global build settings"
config DISPLAY_SUPPORT config DISPLAY_SUPPORT
bool "Show packages that require graphics support (local or remote)" bool "Show packages that require graphics support (local or remote)"
default n
config BUILD_PATENTED config BUILD_PATENTED
default n
bool "Compile with support for patented functionality" bool "Compile with support for patented functionality"
help help
When this option is disabled, software which provides patented functionality When this option is disabled, software which provides patented functionality
@ -95,6 +82,7 @@ menu "Global build settings"
functionality, this optional support will get disabled for this package. functionality, this optional support will get disabled for this package.
config BUILD_NLS config BUILD_NLS
default n
bool "Compile with full language support" bool "Compile with full language support"
help help
When this option is enabled, packages are built with the full versions of When this option is enabled, packages are built with the full versions of
@ -108,6 +96,7 @@ menu "Global build settings"
config CLEAN_IPKG config CLEAN_IPKG
bool bool
prompt "Remove ipkg/opkg status data files in final images" prompt "Remove ipkg/opkg status data files in final images"
default n
help help
This removes all ipkg/opkg status data files from the target directory This removes all ipkg/opkg status data files from the target directory
before building the root filesystem. before building the root filesystem.
@ -115,13 +104,14 @@ menu "Global build settings"
config IPK_FILES_CHECKSUMS config IPK_FILES_CHECKSUMS
bool bool
prompt "Record files checksums in package metadata" prompt "Record files checksums in package metadata"
depends on !USE_APK default n
help help
This makes file checksums part of package metadata. It increases size This makes file checksums part of package metadata. It increases size
but provides you with pkg_check command to check for flash corruptions. but provides you with pkg_check command to check for flash coruptions.
config INCLUDE_CONFIG config INCLUDE_CONFIG
bool "Include build configuration in firmware" if DEVEL bool "Include build configuration in firmware" if DEVEL
default n
help help
If enabled, buildinfo files will be stored in /etc/build.* of firmware. If enabled, buildinfo files will be stored in /etc/build.* of firmware.
@ -155,44 +145,22 @@ menu "Global build settings"
config DEBUG config DEBUG
bool bool
prompt "Compile packages with debugging info" prompt "Compile packages with debugging info"
default n
help help
Adds -g3 to the CFLAGS. Adds -g3 to the CFLAGS.
config USE_GC_SECTIONS
bool
prompt "Dead code and data elimination for all packages (EXPERIMENTAL)"
help
Places functions and data items into its own sections to use the linker's
garbage collection capabilites.
Packages can choose to opt-out via setting PKG_BUILD_FLAGS:=no-gc-sections
config USE_LTO
bool
prompt "Use the link-time optimizer for all packages (EXPERIMENTAL)"
help
Adds LTO flags to the CFLAGS and LDFLAGS.
Packages can choose to opt-out via setting PKG_BUILD_FLAGS:=no-lto
config MOLD
depends on (aarch64 || arm || i386 || i686 || m68k || powerpc || powerpc64 || sh4 || x86_64)
depends on !GCC_USE_VERSION_11
def_bool $(shell, ./config/check-hostcxx.sh 10 2 12)
config USE_MOLD
bool
prompt "Use the mold linker for all packages"
depends on MOLD
help
Link packages with mold, a modern linker
Packages can opt-out via setting PKG_BUILD_FLAGS:=no-mold
config IPV6 config IPV6
def_bool y bool
prompt "Enable IPv6 support in packages"
default y
help
Enables IPv6 support in kernel (builtin) and packages.
comment "Stripping options" comment "Stripping options"
choice choice
prompt "Binary stripping method" prompt "Binary stripping method"
default USE_STRIP if EXTERNAL_TOOLCHAIN
default USE_STRIP if USE_GLIBC default USE_STRIP if USE_GLIBC
default USE_SSTRIP default USE_SSTRIP
help help
@ -209,6 +177,7 @@ menu "Global build settings"
help help
This will install binaries stripped using strip from binutils. This will install binaries stripped using strip from binutils.
config USE_SSTRIP config USE_SSTRIP
bool "sstrip" bool "sstrip"
depends on !USE_GLIBC depends on !USE_GLIBC
@ -225,16 +194,16 @@ menu "Global build settings"
help help
Specifies arguments passed to the strip command when stripping binaries. Specifies arguments passed to the strip command when stripping binaries.
config SSTRIP_DISCARD_TRAILING_ZEROES config SSTRIP_ARGS
bool "Strip trailing zero bytes" string
depends on USE_SSTRIP && !USE_MOLD prompt "Sstrip arguments"
default y depends on USE_SSTRIP
default "-z"
help help
Use sstrip's -z option to discard trailing zero bytes Specifies arguments passed to the sstrip command when stripping binaries.
config STRIP_KERNEL_EXPORTS config STRIP_KERNEL_EXPORTS
bool "Strip unnecessary exports from the kernel image" bool "Strip unnecessary exports from the kernel image"
depends on BROKEN
help help
Reduces kernel size by stripping unused kernel exports from the kernel Reduces kernel size by stripping unused kernel exports from the kernel
image. Note that this might make the kernel incompatible with any kernel image. Note that this might make the kernel incompatible with any kernel
@ -248,6 +217,20 @@ menu "Global build settings"
make the system libraries incompatible with most of the packages that are make the system libraries incompatible with most of the packages that are
not selected during the build process. not selected during the build process.
choice
prompt "Preferred standard C++ library"
default USE_LIBSTDCXX if USE_GLIBC
default USE_UCLIBCXX
help
Select the preferred standard C++ library for all packages that support this.
config USE_UCLIBCXX
bool "uClibc++"
config USE_LIBSTDCXX
bool "libstdc++"
endchoice
comment "Hardening build options" comment "Hardening build options"
config PKG_CHECK_FORMAT_SECURITY config PKG_CHECK_FORMAT_SECURITY
@ -296,22 +279,10 @@ menu "Global build settings"
Enable GCC Stack Smashing Protection (SSP) for userspace applications Enable GCC Stack Smashing Protection (SSP) for userspace applications
config PKG_CC_STACKPROTECTOR_NONE config PKG_CC_STACKPROTECTOR_NONE
bool "None" bool "None"
help
No stack smashing protection.
config PKG_CC_STACKPROTECTOR_REGULAR config PKG_CC_STACKPROTECTOR_REGULAR
bool "Regular" bool "Regular"
help
Protects functions with vulnerable objects.
This includes functions with buffers larger than 8 bytes or calls to alloca.
config PKG_CC_STACKPROTECTOR_STRONG config PKG_CC_STACKPROTECTOR_STRONG
bool "Strong" bool "Strong"
help
Like Regular, but also protects functions with
local arrays or references to local frame addresses.
config PKG_CC_STACKPROTECTOR_ALL
bool "All"
help
Protects all functions.
endchoice endchoice
choice choice
@ -321,18 +292,10 @@ menu "Global build settings"
Enable GCC Stack-Smashing Protection (SSP) for the kernel Enable GCC Stack-Smashing Protection (SSP) for the kernel
config KERNEL_CC_STACKPROTECTOR_NONE config KERNEL_CC_STACKPROTECTOR_NONE
bool "None" bool "None"
help
No stack smashing protection.
config KERNEL_CC_STACKPROTECTOR_REGULAR config KERNEL_CC_STACKPROTECTOR_REGULAR
bool "Regular" bool "Regular"
help
Protects functions with vulnerable objects.
This includes functions with buffers larger than 8 bytes or calls to alloca.
config KERNEL_CC_STACKPROTECTOR_STRONG config KERNEL_CC_STACKPROTECTOR_STRONG
bool "Strong" bool "Strong"
help
Like Regular, but also protects functions with
local arrays or references to local frame addresses.
endchoice endchoice
config KERNEL_STACKPROTECTOR config KERNEL_STACKPROTECTOR
@ -423,16 +386,4 @@ menu "Global build settings"
endchoice endchoice
config SECCOMP
bool "Enable SECCOMP"
select KERNEL_SECCOMP
select PACKAGE_procd-seccomp
depends on (aarch64 || arm || armeb || mips || mipsel || mips64 || mips64el || i386 || powerpc || x86_64)
depends on !TARGET_uml
default y
help
This option enables seccomp kernel features to safely
execute untrusted bytecode and selects the seccomp-variants
of procd
endmenu endmenu

View File

@ -4,9 +4,11 @@
menuconfig DEVEL menuconfig DEVEL
bool "Advanced configuration options (for developers)" bool "Advanced configuration options (for developers)"
default n
config BROKEN config BROKEN
bool "Show broken platforms / packages / devices" if DEVEL bool "Show broken platforms / packages / devices" if DEVEL
default n
config BINARY_FOLDER config BINARY_FOLDER
string "Binary folder" if DEVEL string "Binary folder" if DEVEL
@ -15,20 +17,6 @@ menuconfig DEVEL
Store built firmware images and filesystem images in this directory. Store built firmware images and filesystem images in this directory.
If not set, uses './bin/$(BOARD)' If not set, uses './bin/$(BOARD)'
config DOWNLOAD_TOOL_CUSTOM
string "Use custom download tool" if DEVEL
default ""
help
Use and force custom download tool instead of relying on autoselection
between curl if available and wget as a fallback.
download.pl supports 3 tools officially aria2c, curl and wget.
If one of the tool is used in this config, download.pl will use the
default args to make use of them.
If the provided string is different than aria2c, curl or wget, the command
is used as is and the download url will be appended at the end of such command.
config DOWNLOAD_FOLDER config DOWNLOAD_FOLDER
string "Download folder" if DEVEL string "Download folder" if DEVEL
default "" default ""
@ -51,17 +39,12 @@ menuconfig DEVEL
config AUTOREMOVE config AUTOREMOVE
bool "Automatic removal of build directories" if DEVEL bool "Automatic removal of build directories" if DEVEL
default n
help help
Automatically delete build directories after make target completed. Automatically delete build directories after make target completed.
This allows you to symlink build_dir into a scratch location, e.g. a ramdisk, This allows you to symlink build_dir into a scratch location, e.g. a ramdisk,
which does not have enough space to keep a complete build_dir. which does not have enough space to keep a complete build_dir.
config BUILD_ALL_HOST_TOOLS
bool "Compile all host tools" if DEVEL
help
Compile all host host tools even if not needed. This is needed to prepare a
universal precompiled host tools archive to use in another buildroot.
config BUILD_SUFFIX config BUILD_SUFFIX
string "Build suffix to append to the target BUILD_DIR variable" if DEVEL string "Build suffix to append to the target BUILD_DIR variable" if DEVEL
default "" default ""
@ -80,6 +63,7 @@ menuconfig DEVEL
config CCACHE config CCACHE
bool "Use ccache" if DEVEL bool "Use ccache" if DEVEL
default n
help help
Compiler cache; see https://ccache.samba.org/ Compiler cache; see https://ccache.samba.org/
@ -90,11 +74,6 @@ menuconfig DEVEL
Store ccache in this directory. Store ccache in this directory.
If not set, uses './.ccache' If not set, uses './.ccache'
config KERNEL_CFLAGS
string "Kernel extra CFLAGS" if DEVEL
default "-falign-functions=32" if TARGET_bcm53xx
default ""
config EXTERNAL_KERNEL_TREE config EXTERNAL_KERNEL_TREE
string "Use external kernel tree" if DEVEL string "Use external kernel tree" if DEVEL
default "" default ""

View File

@ -17,7 +17,7 @@ menu "Target Images"
default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_lantiq default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_lantiq
default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_mpc85xx default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_mpc85xx
default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_ramips default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_ramips
default TARGET_INITRAMFS_COMPRESSION_ZSTD if TARGET_qualcommax default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_ipq40xx
default TARGET_INITRAMFS_COMPRESSION_XZ if USES_SEPARATE_INITRAMFS default TARGET_INITRAMFS_COMPRESSION_XZ if USES_SEPARATE_INITRAMFS
default TARGET_INITRAMFS_COMPRESSION_NONE default TARGET_INITRAMFS_COMPRESSION_NONE
depends on TARGET_ROOTFS_INITRAMFS depends on TARGET_ROOTFS_INITRAMFS
@ -37,16 +37,18 @@ menu "Target Images"
bool "lzma" bool "lzma"
config TARGET_INITRAMFS_COMPRESSION_LZO config TARGET_INITRAMFS_COMPRESSION_LZO
depends on !TARGET_ROOTFS_INITRAMFS_SEPARATE
bool "lzo" bool "lzo"
config TARGET_INITRAMFS_COMPRESSION_LZ4 config TARGET_INITRAMFS_COMPRESSION_LZ4
depends on !TARGET_ROOTFS_INITRAMFS_SEPARATE
bool "lz4" bool "lz4"
config TARGET_INITRAMFS_COMPRESSION_XZ config TARGET_INITRAMFS_COMPRESSION_XZ
bool "xz" bool "xz"
config TARGET_INITRAMFS_COMPRESSION_ZSTD config TARGET_INITRAMFS_COMPRESSION_ZSTD
depends on !LINUX_5_4 depends on !LINUX_5_4 && !LINUX_4_19
bool "zstd" bool "zstd"
endchoice endchoice
@ -150,17 +152,14 @@ menu "Target Images"
bool "squashfs" bool "squashfs"
default y if USES_SQUASHFS default y if USES_SQUASHFS
help help
Build a squashfs root filesystem. Build a squashfs-lzma root filesystem.
config TARGET_SQUASHFS_BLOCK_SIZE config TARGET_SQUASHFS_BLOCK_SIZE
int "Block size (in KiB)" int "Block size (in KiB)"
depends on TARGET_ROOTFS_SQUASHFS depends on TARGET_ROOTFS_SQUASHFS
default 64 if LOW_MEMORY_FOOTPRINT default 64 if LOW_MEMORY_FOOTPRINT
default 1024 if (SMALL_FLASH && !LOW_MEMORY_FOOTPRINT) default 1024 if (SMALL_FLASH && !LOW_MEMORY_FOOTPRINT)
default 256 default 1024
help
Select squashfs block size, must be one of:
4, 8, 16, 32, 64, 128, 256, 512, 1024
menuconfig TARGET_ROOTFS_UBIFS menuconfig TARGET_ROOTFS_UBIFS
bool "ubifs" bool "ubifs"
@ -198,23 +197,18 @@ menu "Target Images"
default "" default ""
config GRUB_IMAGES config GRUB_IMAGES
bool "Build GRUB images" bool "Build GRUB images (Linux x86 or x86_64 host only)"
depends on TARGET_x86 depends on TARGET_x86
depends on TARGET_ROOTFS_EXT4FS || TARGET_ROOTFS_JFFS2 || TARGET_ROOTFS_SQUASHFS depends on TARGET_ROOTFS_EXT4FS || TARGET_ROOTFS_JFFS2 || TARGET_ROOTFS_SQUASHFS
select PACKAGE_grub2 select PACKAGE_grub2
select PACKAGE_grub2-bios-setup
default n default n
config GRUB_EFI_IMAGES config GRUB_EFI_IMAGES
bool "Build GRUB EFI images" bool "Build GRUB EFI images (Linux x86 or x86_64 host only)"
depends on TARGET_x86 || TARGET_armvirt || TARGET_loongarch64 || TARGET_phytium depends on TARGET_x86
depends on TARGET_ROOTFS_EXT4FS || TARGET_ROOTFS_JFFS2 || TARGET_ROOTFS_SQUASHFS depends on TARGET_ROOTFS_EXT4FS || TARGET_ROOTFS_JFFS2 || TARGET_ROOTFS_SQUASHFS
select PACKAGE_grub2 if TARGET_x86 select PACKAGE_grub2
select PACKAGE_grub2-efi if TARGET_x86 select PACKAGE_grub2-efi
select PACKAGE_grub2-bios-setup if TARGET_x86
select PACKAGE_grub2-efi-arm if TARGET_armvirt
select PACKAGE_grub2-efi-arm if TARGET_phytium_armv8
select PACKAGE_grub2-efi-loongarch64 if TARGET_loongarch64
select PACKAGE_kmod-fs-vfat select PACKAGE_kmod-fs-vfat
default y default y
@ -279,8 +273,9 @@ menu "Target Images"
config VMDK_IMAGES config VMDK_IMAGES
bool "Build VMware image files (VMDK)" bool "Build VMware image files (VMDK)"
depends on TARGET_x86 || TARGET_armvirt depends on TARGET_x86
depends on GRUB_IMAGES || GRUB_EFI_IMAGES depends on GRUB_IMAGES || GRUB_EFI_IMAGES
default y
select PACKAGE_kmod-e1000 select PACKAGE_kmod-e1000
config VHDX_IMAGES config VHDX_IMAGES
@ -291,28 +286,24 @@ menu "Target Images"
config TARGET_IMAGES_GZIP config TARGET_IMAGES_GZIP
bool "GZip images" bool "GZip images"
depends on TARGET_ROOTFS_EXT4FS || TARGET_x86 || TARGET_armvirt || TARGET_malta || TARGET_loongarch64 depends on TARGET_ROOTFS_EXT4FS || TARGET_x86 || TARGET_armvirt || TARGET_malta
default y default n
comment "Image Options" comment "Image Options"
source "target/linux/*/image/Config.in" source "target/linux/*/image/Config.in"
source "target/linux/*/*/image/Config.in"
config TARGET_KERNEL_PARTSIZE config TARGET_KERNEL_PARTSIZE
int "Kernel partition size (in MiB)" int "Kernel partition size (in MB)"
depends on USES_BOOT_PART depends on USES_BOOT_PART
default 8 if TARGET_apm821xx_sata default 8 if TARGET_apm821xx_sata
default 64 if TARGET_bcm27xx default 64 if TARGET_bcm27xx
default 128 if TARGET_armvirt
default 32 if TARGET_rockchip default 32 if TARGET_rockchip
default 16 default 16
config TARGET_ROOTFS_PARTSIZE config TARGET_ROOTFS_PARTSIZE
int "Root filesystem partition size (in MiB)" int "Root filesystem partition size (in MB)"
depends on USES_ROOTFS_PART || TARGET_ROOTFS_EXT4FS depends on USES_ROOTFS_PART || TARGET_ROOTFS_EXT4FS || TARGET_omap || TARGET_sunxi || TARGET_uml
default 232 if TARGET_loongarch64
default 448 if TARGET_mediatek || TARGET_x86
default 160 default 160
help help
Select the root filesystem partition size. Select the root filesystem partition size.

View File

@ -24,6 +24,11 @@ config KERNEL_PRINTK
bool "Enable support for printk" bool "Enable support for printk"
default y default y
config KERNEL_CRASHLOG
bool "Crash logging"
depends on !(arm || powerpc || sparc || TARGET_uml || i386 || x86_64)
default y
config KERNEL_SWAP config KERNEL_SWAP
bool "Support for paging of anonymous memory (swap)" bool "Support for paging of anonymous memory (swap)"
default y if !SMALL_FLASH default y if !SMALL_FLASH
@ -43,29 +48,17 @@ config KERNEL_DEBUG_FS
config KERNEL_MIPS_FP_SUPPORT config KERNEL_MIPS_FP_SUPPORT
bool bool
default y if TARGET_pistachio default y
depends on (mips || mipsel || mips64 || mips64el)
config KERNEL_ARM_PMU config KERNEL_ARM_PMU
bool bool
default y if TARGET_armsr_armv8 default n
depends on (arm || aarch64) depends on (arm || aarch64)
config KERNEL_ARM_PMUV3
bool
default y if TARGET_armsr_armv8
depends on (arm_v7 || aarch64) && LINUX_6_6
config KERNEL_RISCV_PMU
bool
select KERNEL_RISCV_PMU_SBI
depends on riscv64
config KERNEL_RISCV_PMU_SBI
bool
depends on riscv64
config KERNEL_X86_VSYSCALL_EMULATION config KERNEL_X86_VSYSCALL_EMULATION
bool "Enable vsyscall emulation" bool "Enable vsyscall emulation"
default n
depends on x86_64 depends on x86_64
help help
This enables emulation of the legacy vsyscall page. Disabling This enables emulation of the legacy vsyscall page. Disabling
@ -83,22 +76,17 @@ config KERNEL_X86_VSYSCALL_EMULATION
config KERNEL_PERF_EVENTS config KERNEL_PERF_EVENTS
bool "Compile the kernel with performance events and counters" bool "Compile the kernel with performance events and counters"
default n
select KERNEL_ARM_PMU if (arm || aarch64) select KERNEL_ARM_PMU if (arm || aarch64)
select KERNEL_ARM_PMUV3 if (arm_v7 || aarch64) && LINUX_6_6
select KERNEL_RISCV_PMU if riscv64
config KERNEL_PROFILING config KERNEL_PROFILING
bool "Compile the kernel with profiling enabled" bool "Compile the kernel with profiling enabled"
default n
select KERNEL_PERF_EVENTS select KERNEL_PERF_EVENTS
help help
Enable the extended profiling support mechanisms used by profilers such Enable the extended profiling support mechanisms used by profilers such
as OProfile. as OProfile.
config KERNEL_RPI_AXIPERF
bool "Compile the kernel with RaspberryPi AXI Performance monitors"
default y
depends on KERNEL_PERF_EVENTS && TARGET_bcm27xx
config KERNEL_UBSAN config KERNEL_UBSAN
bool "Compile the kernel with undefined behaviour sanity checker" bool "Compile the kernel with undefined behaviour sanity checker"
help help
@ -127,16 +115,6 @@ config KERNEL_UBSAN_ALIGNMENT
Enabling this option on architectures that support unaligned Enabling this option on architectures that support unaligned
accesses may produce a lot of false positives. accesses may produce a lot of false positives.
config KERNEL_UBSAN_BOUNDS
bool "Perform array index bounds checking"
depends on KERNEL_UBSAN
help
This option enables detection of directly indexed out of bounds array
accesses, where the array size is known at compile time. Note that
this does not protect array overflows via bad calls to the
{str,mem}*cpy() family of functions (that is addressed by
FORTIFY_SOURCE).
config KERNEL_UBSAN_NULL config KERNEL_UBSAN_NULL
bool "Enable checking of null pointers" bool "Enable checking of null pointers"
depends on KERNEL_UBSAN depends on KERNEL_UBSAN
@ -144,23 +122,10 @@ config KERNEL_UBSAN_NULL
This option enables detection of memory accesses via a This option enables detection of memory accesses via a
null pointer. null pointer.
config KERNEL_UBSAN_TRAP
bool "On Sanitizer warnings, abort the running kernel code"
depends on KERNEL_UBSAN
help
Building kernels with Sanitizer features enabled tends to grow the
kernel size by around 5%, due to adding all the debugging text on
failure paths. To avoid this, Sanitizer instrumentation can just
issue a trap. This reduces the kernel size overhead but turns all
warnings (including potentially harmless conditions) into full
exceptions that abort the running kernel code (regardless of context,
locks held, etc), which may destabilize the system. For some system
builders this is an acceptable trade-off.
config KERNEL_KASAN config KERNEL_KASAN
bool "Compile the kernel with KASan: runtime memory debugger" bool "Compile the kernel with KASan: runtime memory debugger"
select KERNEL_SLUB_DEBUG select KERNEL_SLUB_DEBUG
depends on (x86_64 || aarch64 || arm || powerpc || riscv64) depends on (x86_64 || aarch64)
help help
Enables kernel address sanitizer - runtime memory debugger, Enables kernel address sanitizer - runtime memory debugger,
designed to find out-of-bounds accesses and use-after-free bugs. designed to find out-of-bounds accesses and use-after-free bugs.
@ -173,91 +138,20 @@ config KERNEL_KASAN
Currently CONFIG_KASAN doesn't work with CONFIG_DEBUG_SLAB Currently CONFIG_KASAN doesn't work with CONFIG_DEBUG_SLAB
(the resulting kernel does not boot). (the resulting kernel does not boot).
config KERNEL_KASAN_VMALLOC config KERNEL_KASAN_EXTRA
bool "Back mappings in vmalloc space with real shadow memory" bool "KAsan: extra checks"
depends on KERNEL_KASAN depends on KERNEL_KASAN && KERNEL_DEBUG_KERNEL
help help
By default, the shadow region for vmalloc space is the read-only This enables further checks in the kernel address sanitizer, for now
zero page. This means that KASAN cannot detect errors involving it only includes the address-use-after-scope check that can lead
vmalloc space. to excessive kernel stack usage, frame size warnings and longer
compile time.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81715 has more
Enabling this option will hook in to vmap/vmalloc and back those
mappings with real shadow memory allocated on demand. This allows
for KASAN to detect more sorts of errors (and to support vmapped
stacks), but at the cost of higher memory usage.
This option depends on HAVE_ARCH_KASAN_VMALLOC, but we can't
depend on that in here, so it is possible that enabling this
will have no effect.
if KERNEL_KASAN
choice
prompt "KASAN mode"
depends on KERNEL_KASAN
default KERNEL_KASAN_GENERIC
help
KASAN has three modes:
1. Generic KASAN (supported by many architectures, enabled with
CONFIG_KASAN_GENERIC, similar to userspace ASan),
2. Software Tag-Based KASAN (arm64 only, based on software memory
tagging, enabled with CONFIG_KASAN_SW_TAGS, similar to userspace
HWASan), and
3. Hardware Tag-Based KASAN (arm64 only, based on hardware memory
tagging, enabled with CONFIG_KASAN_HW_TAGS).
config KERNEL_KASAN_GENERIC
bool "Generic KASAN"
select KERNEL_SLUB_DEBUG
help
Enables Generic KASAN.
Consumes about 1/8th of available memory at kernel start and adds an
overhead of ~50% for dynamic allocations.
The performance slowdown is ~x3.
config KERNEL_KASAN_SW_TAGS
bool "Software Tag-Based KASAN"
depends on aarch64
select KERNEL_SLUB_DEBUG
help
Enables Software Tag-Based KASAN.
Supported only on arm64 CPUs and relies on Top Byte Ignore.
Consumes about 1/16th of available memory at kernel start and
add an overhead of ~20% for dynamic allocations.
May potentially introduce problems related to pointer casting and
comparison, as it embeds a tag into the top byte of each pointer.
config KERNEL_KASAN_HW_TAGS
bool "Hardware Tag-Based KASAN"
depends on aarch64
select KERNEL_SLUB_DEBUG
select KERNEL_ARM64_MTE
help
Enables Hardware Tag-Based KASAN.
Supported only on arm64 CPUs starting from ARMv8.5 and relies on
Memory Tagging Extension and Top Byte Ignore.
Consumes about 1/32nd of available memory.
May potentially introduce problems related to pointer casting and
comparison, as it embeds a tag into the top byte of each pointer.
endchoice
config KERNEL_ARM64_MTE
def_bool n
endif
choice choice
prompt "Instrumentation type" prompt "Instrumentation type"
depends on KERNEL_KASAN depends on KERNEL_KASAN
depends on !KERNEL_KASAN_HW_TAGS
default KERNEL_KASAN_OUTLINE default KERNEL_KASAN_OUTLINE
config KERNEL_KASAN_OUTLINE config KERNEL_KASAN_OUTLINE
@ -315,6 +209,7 @@ config KERNEL_KCOV_INSTRUMENT_ALL
config KERNEL_TASKSTATS config KERNEL_TASKSTATS
bool "Compile the kernel with task resource/io statistics and accounting" bool "Compile the kernel with task resource/io statistics and accounting"
default n
help help
Enable the collection and publishing of task/io statistics and Enable the collection and publishing of task/io statistics and
accounting. Enable this option to enable i/o monitoring in system accounting. Enable this option to enable i/o monitoring in system
@ -333,25 +228,6 @@ if KERNEL_TASKSTATS
endif endif
config KERNEL_PSI
bool "Compile the kernel with pressure stall information tracking"
help
Collect metrics that indicate how overcommitted the CPU, memory,
and IO capacity are in the system.
If you say Y here, the kernel will create /proc/pressure/ with the
pressure statistics files cpu, memory, and io. These will indicate
the share of walltime in which some or all tasks in the system are
delayed due to contention of the respective resource.
In kernels with cgroup support, cgroups (cgroup2 only) will
have cpu.pressure, memory.pressure, and io.pressure files,
which aggregate pressure stalls for the grouped tasks only.
For more details see Documentation/accounting/psi.rst.
Say N if unsure.
config KERNEL_KALLSYMS config KERNEL_KALLSYMS
bool "Compile the kernel with symbol table information" bool "Compile the kernel with symbol table information"
default y if !SMALL_FLASH default y if !SMALL_FLASH
@ -361,30 +237,37 @@ config KERNEL_KALLSYMS
config KERNEL_FTRACE config KERNEL_FTRACE
bool "Compile the kernel with tracing support" bool "Compile the kernel with tracing support"
depends on !TARGET_uml depends on !TARGET_uml
default n
config KERNEL_FTRACE_SYSCALLS config KERNEL_FTRACE_SYSCALLS
bool "Trace system calls" bool "Trace system calls"
depends on KERNEL_FTRACE depends on KERNEL_FTRACE
default n
config KERNEL_ENABLE_DEFAULT_TRACERS config KERNEL_ENABLE_DEFAULT_TRACERS
bool "Trace process context switches and events" bool "Trace process context switches and events"
depends on KERNEL_FTRACE depends on KERNEL_FTRACE
default n
config KERNEL_FUNCTION_TRACER config KERNEL_FUNCTION_TRACER
bool "Function tracer" bool "Function tracer"
depends on KERNEL_FTRACE depends on KERNEL_FTRACE
default n
config KERNEL_FUNCTION_GRAPH_TRACER config KERNEL_FUNCTION_GRAPH_TRACER
bool "Function graph tracer" bool "Function graph tracer"
depends on KERNEL_FUNCTION_TRACER depends on KERNEL_FUNCTION_TRACER
default n
config KERNEL_DYNAMIC_FTRACE config KERNEL_DYNAMIC_FTRACE
bool "Enable/disable function tracing dynamically" bool "Enable/disable function tracing dynamically"
depends on KERNEL_FUNCTION_TRACER depends on KERNEL_FUNCTION_TRACER
default n
config KERNEL_FUNCTION_PROFILER config KERNEL_FUNCTION_PROFILER
bool "Function profiler" bool "Function profiler"
depends on KERNEL_FUNCTION_TRACER depends on KERNEL_FUNCTION_TRACER
default n
config KERNEL_IRQSOFF_TRACER config KERNEL_IRQSOFF_TRACER
bool "Interrupts-off Latency Tracer" bool "Interrupts-off Latency Tracer"
@ -420,21 +303,9 @@ config KERNEL_PREEMPT_TRACER
enabled. This option and the irqs-off timing option can be enabled. This option and the irqs-off timing option can be
used together or separately.) used together or separately.)
config KERNEL_HIST_TRIGGERS
bool "Histogram triggers"
depends on KERNEL_FTRACE
help
Hist triggers allow one or more arbitrary trace event fields to be
aggregated into hash tables and dumped to stdout by reading a
debugfs/tracefs file. They're useful for gathering quick and dirty
(though precise) summaries of event activity as an initial guide for
further investigation using more advanced tools.
Inter-event tracing of quantities such as latencies is also
supported using hist triggers under this option.
config KERNEL_DEBUG_KERNEL config KERNEL_DEBUG_KERNEL
bool bool
default n
config KERNEL_DEBUG_INFO config KERNEL_DEBUG_INFO
bool "Compile the kernel with debug information" bool "Compile the kernel with debug information"
@ -443,61 +314,6 @@ config KERNEL_DEBUG_INFO
help help
This will compile your kernel and modules with debug information. This will compile your kernel and modules with debug information.
config KERNEL_DEBUG_INFO_BTF
bool "Enable additional BTF type information"
depends on !HOST_OS_MACOS
depends on KERNEL_DEBUG_INFO && !KERNEL_DEBUG_INFO_REDUCED
select DWARVES
help
Generate BPF Type Format (BTF) information from DWARF debug info.
Turning this on expects presence of pahole tool, which will convert
DWARF type info into equivalent deduplicated BTF type info.
Required to run BPF CO-RE applications.
config KERNEL_DEBUG_INFO_BTF_MODULES
def_bool y
depends on KERNEL_DEBUG_INFO_BTF
config KERNEL_MODULE_ALLOW_BTF_MISMATCH
bool "Allow loading modules with non-matching BTF type info"
depends on KERNEL_DEBUG_INFO_BTF_MODULES
help
For modules whose split BTF does not match vmlinux, load without
BTF rather than refusing to load. The default behavior with
module BTF enabled is to reject modules with such mismatches;
this option will still load module BTF where possible but ignore
it when a mismatch is found.
config KERNEL_DEBUG_INFO_REDUCED
bool "Reduce debugging information"
default y
depends on KERNEL_DEBUG_INFO
help
If you say Y here gcc is instructed to generate less debugging
information for structure types. This means that tools that
need full debugging information (like kgdb or systemtap) won't
be happy. But if you merely need debugging information to
resolve line numbers there is no loss. Advantage is that
build directory object sizes shrink dramatically over a full
DEBUG_INFO build and compile times are reduced too.
Only works with newer gcc versions.
config KERNEL_FRAME_WARN
int
range 0 8192
default 1280 if KERNEL_KASAN && !ARCH_64BIT
default 1024 if !ARCH_64BIT
default 2048 if ARCH_64BIT
help
Tell the compiler to warn at build time for stack frames larger than this.
Setting this too low will cause a lot of warnings.
Setting it to 0 disables the warning.
# KERNEL_DEBUG_LL symbols must have the default value set as otherwise
# KConfig wont evaluate them unless KERNEL_EARLY_PRINTK is selected
# which means that buildroot wont override the DEBUG_LL symbols in target
# kernel configurations and lead to devices that dont have working console
config KERNEL_DEBUG_LL_UART_NONE config KERNEL_DEBUG_LL_UART_NONE
bool bool
default n default n
@ -511,16 +327,10 @@ config KERNEL_DEBUG_LL
help help
ARM low level debugging. ARM low level debugging.
config KERNEL_DEBUG_VIRTUAL
bool "Compile the kernel with VM translations debugging"
select KERNEL_DEBUG_KERNEL
help
Enable checks sanity checks to catch invalid uses of
virt_to_phys()/phys_to_virt() against the non-linear address space.
config KERNEL_DYNAMIC_DEBUG config KERNEL_DYNAMIC_DEBUG
bool "Compile the kernel with dynamic printk" bool "Compile the kernel with dynamic printk"
select KERNEL_DEBUG_FS select KERNEL_DEBUG_FS
default n
help help
Compiles debug level messages into the kernel, which would not Compiles debug level messages into the kernel, which would not
otherwise be available at runtime. These messages can then be otherwise be available at runtime. These messages can then be
@ -532,6 +342,7 @@ config KERNEL_DYNAMIC_DEBUG
config KERNEL_EARLY_PRINTK config KERNEL_EARLY_PRINTK
bool "Compile the kernel with early printk" bool "Compile the kernel with early printk"
default y if TARGET_bcm53xx default y if TARGET_bcm53xx
default n
depends on arm depends on arm
select KERNEL_DEBUG_KERNEL select KERNEL_DEBUG_KERNEL
select KERNEL_DEBUG_LL if arm select KERNEL_DEBUG_LL if arm
@ -542,6 +353,7 @@ config KERNEL_EARLY_PRINTK
config KERNEL_KPROBES config KERNEL_KPROBES
bool "Compile the kernel with kprobes support" bool "Compile the kernel with kprobes support"
default n
select KERNEL_FTRACE select KERNEL_FTRACE
select KERNEL_PERF_EVENTS select KERNEL_PERF_EVENTS
help help
@ -556,32 +368,13 @@ config KERNEL_KPROBE_EVENTS
bool bool
default y if KERNEL_KPROBES default y if KERNEL_KPROBES
config KERNEL_BPF_EVENTS
bool "Compile the kernel with BPF event support"
select KERNEL_KPROBES
help
Allows to attach BPF programs to kprobe, uprobe and tracepoint events.
This is required to use BPF maps of type BPF_MAP_TYPE_PERF_EVENT_ARRAY
for sending data from BPF programs to user-space for post-processing
or logging.
config KERNEL_PROBE_EVENTS_BTF_ARGS
bool "Support BTF function arguments for probe events"
depends on KERNEL_DEBUG_INFO_BTF && KERNEL_KPROBE_EVENTS && LINUX_6_6
config KERNEL_BPF_KPROBE_OVERRIDE
bool
depends on KERNEL_KPROBES
default n
config KERNEL_AIO config KERNEL_AIO
bool "Compile the kernel with asynchronous IO support" bool "Compile the kernel with asynchronous IO support"
default y if !SMALL_FLASH default y if !SMALL_FLASH
config KERNEL_IO_URING config KERNEL_IO_URING
bool "Compile the kernel with io_uring support" bool "Compile the kernel with io_uring support"
depends on !SMALL_FLASH default y if !SMALL_FLASH
default y if (x86_64 || aarch64)
config KERNEL_FHANDLE config KERNEL_FHANDLE
bool "Compile the kernel with support for fhandle syscalls" bool "Compile the kernel with support for fhandle syscalls"
@ -593,6 +386,7 @@ config KERNEL_FANOTIFY
config KERNEL_BLK_DEV_BSG config KERNEL_BLK_DEV_BSG
bool "Compile the kernel with SCSI generic v4 support for any block device" bool "Compile the kernel with SCSI generic v4 support for any block device"
default n
config KERNEL_TRANSPARENT_HUGEPAGE config KERNEL_TRANSPARENT_HUGEPAGE
bool bool
@ -616,6 +410,7 @@ config KERNEL_HUGETLB_PAGE
bool "Compile the kernel with HugeTLB support" bool "Compile the kernel with HugeTLB support"
select KERNEL_TRANSPARENT_HUGEPAGE select KERNEL_TRANSPARENT_HUGEPAGE
select KERNEL_HUGETLBFS select KERNEL_HUGETLBFS
default n
config KERNEL_MAGIC_SYSRQ config KERNEL_MAGIC_SYSRQ
bool "Compile the kernel with SysRq support" bool "Compile the kernel with SysRq support"
@ -640,35 +435,36 @@ config KERNEL_ELF_CORE
config KERNEL_PROVE_LOCKING config KERNEL_PROVE_LOCKING
bool "Enable kernel lock checking" bool "Enable kernel lock checking"
select KERNEL_DEBUG_KERNEL select KERNEL_DEBUG_KERNEL
default n
config KERNEL_SOFTLOCKUP_DETECTOR config KERNEL_LOCKUP_DETECTOR
bool "Compile the kernel with detect Soft Lockups" bool "Compile the kernel with detect Hard and Soft Lockups"
depends on KERNEL_DEBUG_KERNEL depends on KERNEL_DEBUG_KERNEL
help help
Say Y here to enable the kernel to act as a watchdog to detect Say Y here to enable the kernel to act as a watchdog to detect
soft lockups. hard and soft lockups.
Softlockups are bugs that cause the kernel to loop in kernel Softlockups are bugs that cause the kernel to loop in kernel
mode for more than 20 seconds, without giving other tasks a mode for more than 20 seconds, without giving other tasks a
chance to run. The current stack trace is displayed upon chance to run. The current stack trace is displayed upon
detection and the system will stay locked up. detection and the system will stay locked up.
config KERNEL_HARDLOCKUP_DETECTOR
bool "Compile the kernel with detect Hard Lockups"
depends on KERNEL_DEBUG_KERNEL
help
Say Y here to enable the kernel to act as a watchdog to detect
hard lockups.
Hardlockups are bugs that cause the CPU to loop in kernel mode Hardlockups are bugs that cause the CPU to loop in kernel mode
for more than 10 seconds, without letting other interrupts have a for more than 10 seconds, without letting other interrupts have a
chance to run. The current stack trace is displayed upon detection chance to run. The current stack trace is displayed upon detection
and the system will stay locked up. and the system will stay locked up.
The overhead should be minimal. A periodic hrtimer runs to
generate interrupts and kick the watchdog task every 4 seconds.
An NMI is generated every 10 seconds or so to check for hardlockups.
The frequency of hrtimer and NMI events and the soft and hard lockup
thresholds can be controlled through the sysctl watchdog_thresh.
config KERNEL_DETECT_HUNG_TASK config KERNEL_DETECT_HUNG_TASK
bool "Compile the kernel with detect Hung Tasks" bool "Compile the kernel with detect Hung Tasks"
depends on KERNEL_DEBUG_KERNEL depends on KERNEL_DEBUG_KERNEL
default KERNEL_SOFTLOCKUP_DETECTOR default KERNEL_LOCKUP_DETECTOR
help help
Say Y here to enable the kernel to detect "hung tasks", Say Y here to enable the kernel to detect "hung tasks",
which are bugs that cause the task to be stuck in which are bugs that cause the task to be stuck in
@ -714,23 +510,10 @@ config KERNEL_PRINTK_TIME
default y default y
config KERNEL_SLUB_DEBUG config KERNEL_SLUB_DEBUG
bool "Enable SLUB debugging support" bool
help
This enables various debugging features:
- Accepts "slub_debug" kernel parameter
- Provides caches debugging options (e.g. tracing, validating)
- Adds /sys/kernel/slab/ attrs for reading amounts of *objects*
- Enables /proc/slabinfo support
- Prints info when running out of memory
Enabling this can result in a significant increase of code size.
config KERNEL_SLUB_DEBUG_ON config KERNEL_SLUB_DEBUG_ON
depends on KERNEL_SLUB_DEBUG bool
bool "Boot kernel with basic caches debugging enabled"
help
This enables by default sanity_checks, red_zone, poison and store_user
debugging options for all caches.
config KERNEL_SLABINFO config KERNEL_SLABINFO
select KERNEL_SLUB_DEBUG select KERNEL_SLUB_DEBUG
@ -766,9 +549,11 @@ config USE_RFKILL
config USE_SPARSE config USE_SPARSE
bool "Enable sparse check during kernel build" bool "Enable sparse check during kernel build"
default n
config KERNEL_DEVTMPFS config KERNEL_DEVTMPFS
bool "Compile the kernel with device tmpfs enabled" bool "Compile the kernel with device tmpfs enabled"
default n
help help
devtmpfs is a simple, kernel-managed /dev filesystem. The kernel creates devtmpfs is a simple, kernel-managed /dev filesystem. The kernel creates
devices nodes for all registered devices to simplify boot, but leaves more devices nodes for all registered devices to simplify boot, but leaves more
@ -778,6 +563,7 @@ if KERNEL_DEVTMPFS
config KERNEL_DEVTMPFS_MOUNT config KERNEL_DEVTMPFS_MOUNT
bool "Automatically mount devtmpfs after root filesystem is mounted" bool "Automatically mount devtmpfs after root filesystem is mounted"
default n
endif endif
@ -788,14 +574,17 @@ config KERNEL_KEYS
config KERNEL_PERSISTENT_KEYRINGS config KERNEL_PERSISTENT_KEYRINGS
bool "Enable kernel persistent keyrings" bool "Enable kernel persistent keyrings"
depends on KERNEL_KEYS depends on KERNEL_KEYS
default n
config KERNEL_KEYS_REQUEST_CACHE config KERNEL_KEYS_REQUEST_CACHE
bool "Enable temporary caching of the last request_key() result" bool "Enable temporary caching of the last request_key() result"
depends on KERNEL_KEYS depends on KERNEL_KEYS
default n
config KERNEL_BIG_KEYS config KERNEL_BIG_KEYS
bool "Enable large payload keys on kernel keyrings" bool "Enable large payload keys on kernel keyrings"
depends on KERNEL_KEYS depends on KERNEL_KEYS
default n
# #
# CGROUP support symbols # CGROUP support symbols
@ -809,6 +598,7 @@ if KERNEL_CGROUPS
config KERNEL_CGROUP_DEBUG config KERNEL_CGROUP_DEBUG
bool "Example debug cgroup subsystem" bool "Example debug cgroup subsystem"
default n
help help
This option enables a simple cgroup subsystem that This option enables a simple cgroup subsystem that
exports useful debugging information about the cgroups exports useful debugging information about the cgroups
@ -819,6 +609,7 @@ if KERNEL_CGROUPS
config KERNEL_CGROUP_FREEZER config KERNEL_CGROUP_FREEZER
bool "legacy Freezer cgroup subsystem" bool "legacy Freezer cgroup subsystem"
default n
select KERNEL_FREEZER select KERNEL_FREEZER
help help
Provides a way to freeze and unfreeze all tasks in a Provides a way to freeze and unfreeze all tasks in a
@ -828,6 +619,7 @@ if KERNEL_CGROUPS
config KERNEL_CGROUP_DEVICE config KERNEL_CGROUP_DEVICE
bool "legacy Device controller for cgroups" bool "legacy Device controller for cgroups"
default n
help help
Provides a cgroup implementing whitelists for devices which Provides a cgroup implementing whitelists for devices which
a process in the cgroup can mknod or open. a process in the cgroup can mknod or open.
@ -835,6 +627,7 @@ if KERNEL_CGROUPS
config KERNEL_CGROUP_HUGETLB config KERNEL_CGROUP_HUGETLB
bool "HugeTLB controller" bool "HugeTLB controller"
default n
select KERNEL_HUGETLB_PAGE select KERNEL_HUGETLB_PAGE
config KERNEL_CGROUP_PIDS config KERNEL_CGROUP_PIDS
@ -861,19 +654,9 @@ if KERNEL_CGROUPS
Memory Nodes and assigning tasks to run only within those sets. Memory Nodes and assigning tasks to run only within those sets.
This is primarily useful on large SMP or NUMA systems. This is primarily useful on large SMP or NUMA systems.
config KERNEL_CPUSETS_V1
bool "Legacy cgroup v1 cpusets controller"
depends on KERNEL_CPUSETS
default n
help
Legacy cgroup v1 cpusets controller which has been deprecated by
cgroup v2 implementation. The v1 is there for legacy applications
which haven't migrated to the new cgroup v2 interface yet. If you
do not have any such application then you are completely fine leaving
this option disabled.
config KERNEL_PROC_PID_CPUSET config KERNEL_PROC_PID_CPUSET
bool "Include legacy /proc/<pid>/cpuset file" bool "Include legacy /proc/<pid>/cpuset file"
default n
depends on KERNEL_CPUSETS depends on KERNEL_CPUSETS
config KERNEL_CGROUP_CPUACCT config KERNEL_CGROUP_CPUACCT
@ -898,7 +681,7 @@ if KERNEL_CGROUPS
bool "Memory Resource Controller for Control Groups" bool "Memory Resource Controller for Control Groups"
default y default y
select KERNEL_FREEZER select KERNEL_FREEZER
depends on KERNEL_RESOURCE_COUNTERS depends on KERNEL_RESOURCE_COUNTERS || !LINUX_3_18
help help
Provides a memory resource controller that manages both anonymous Provides a memory resource controller that manages both anonymous
memory and page cache. (See Documentation/cgroups/memory.txt) memory and page cache. (See Documentation/cgroups/memory.txt)
@ -939,6 +722,7 @@ if KERNEL_CGROUPS
config KERNEL_MEMCG_SWAP_ENABLED config KERNEL_MEMCG_SWAP_ENABLED
bool "Memory Resource Controller Swap Extension enabled by default" bool "Memory Resource Controller Swap Extension enabled by default"
default n
depends on KERNEL_MEMCG_SWAP depends on KERNEL_MEMCG_SWAP
help help
Memory Resource Controller Swap Extension comes with its price in Memory Resource Controller Swap Extension comes with its price in
@ -964,24 +748,10 @@ if KERNEL_CGROUPS
the kmem extension can use it to guarantee that no group of processes the kmem extension can use it to guarantee that no group of processes
will ever exhaust kernel resources alone. will ever exhaust kernel resources alone.
config KERNEL_MEMCG_V1
bool "Legacy cgroup v1 memory controller"
default n
depends on KERNEL_MEMCG
help
Legacy cgroup v1 memory controller which has been deprecated by
cgroup v2 implementation. The v1 is there for legacy applications
which haven't migrated to the new cgroup v2 interface yet. If you
do not have any such application then you are completely fine leaving
this option disabled.
Please note that feature set of the legacy memory controller is likely
going to shrink due to deprecation process. New deployments with v1
controller are highly discouraged.
config KERNEL_CGROUP_PERF config KERNEL_CGROUP_PERF
bool "Enable perf_event per-cpu per-container group (cgroup) monitoring" bool "Enable perf_event per-cpu per-container group (cgroup) monitoring"
select KERNEL_PERF_EVENTS select KERNEL_PERF_EVENTS
default n
help help
This option extends the per-cpu mode to restrict monitoring to This option extends the per-cpu mode to restrict monitoring to
threads which belong to the cgroup specified and run on the threads which belong to the cgroup specified and run on the
@ -1058,6 +828,7 @@ if KERNEL_CGROUPS
config KERNEL_DEBUG_BLK_CGROUP config KERNEL_DEBUG_BLK_CGROUP
bool "Enable Block IO controller debugging" bool "Enable Block IO controller debugging"
default n
depends on KERNEL_BLK_CGROUP depends on KERNEL_BLK_CGROUP
help help
Enable some debugging help. Currently it exports additional stat Enable some debugging help. Currently it exports additional stat
@ -1065,12 +836,15 @@ if KERNEL_CGROUPS
config KERNEL_NET_CLS_CGROUP config KERNEL_NET_CLS_CGROUP
bool "legacy Control Group Classifier" bool "legacy Control Group Classifier"
default n
config KERNEL_CGROUP_NET_CLASSID config KERNEL_CGROUP_NET_CLASSID
bool "legacy Network classid cgroup" bool "legacy Network classid cgroup"
default n
config KERNEL_CGROUP_NET_PRIO config KERNEL_CGROUP_NET_PRIO
bool "legacy Network priority cgroup" bool "legacy Network priority cgroup"
default n
endif endif
@ -1170,19 +944,6 @@ config KERNEL_IP_MROUTE
Multicast routing requires a multicast routing daemon in Multicast routing requires a multicast routing daemon in
addition to kernel support. addition to kernel support.
if KERNEL_IP_MROUTE
config KERNEL_IP_MROUTE_MULTIPLE_TABLES
def_bool y
config KERNEL_IP_PIMSM_V1
def_bool y
config KERNEL_IP_PIMSM_V2
def_bool y
endif
# #
# IPv6 configuration # IPv6 configuration
# #
@ -1205,15 +966,8 @@ if KERNEL_IPV6
Multicast routing requires a multicast routing daemon in Multicast routing requires a multicast routing daemon in
addition to kernel support. addition to kernel support.
if KERNEL_IPV6_MROUTE
config KERNEL_IPV6_MROUTE_MULTIPLE_TABLES
def_bool y
config KERNEL_IPV6_PIMSM_V2 config KERNEL_IPV6_PIMSM_V2
def_bool y def_bool n
endif
config KERNEL_IPV6_SEG6_LWTUNNEL config KERNEL_IPV6_SEG6_LWTUNNEL
bool "Enable support for lightweight tunnels" bool "Enable support for lightweight tunnels"
@ -1226,45 +980,6 @@ if KERNEL_IPV6
endif endif
#
# Miscellaneous network configuration
#
config KERNEL_NET_L3_MASTER_DEV
bool "L3 Master device support"
default y if !SMALL_FLASH
help
This module provides glue between core networking code and device
drivers to support L3 master devices like VRF.
Increases the compressed kernel size by ~4kB (as of Linux 6.6).
config KERNEL_XDP_SOCKETS
bool "XDP sockets support"
help
XDP sockets allows a channel between XDP programs and
userspace applications.
config KERNEL_PAGE_POOL
def_bool n
config KERNEL_PAGE_POOL_STATS
bool "Page pool stats support"
depends on KERNEL_PAGE_POOL
config KERNEL_MPTCP
bool "Multi-Path TCP support"
default y if !SMALL_FLASH
help
Select this option to enable support for Multi-Path TCP.
Increases the compressed kernel size by ~214kB (as of Linux 6.6).
if KERNEL_IPV6
config KERNEL_MPTCP_IPV6
bool "IPv6 support for Multipath TCP"
depends on KERNEL_MPTCP
default KERNEL_MPTCP
endif
# #
# NFS related symbols # NFS related symbols
# #
@ -1299,20 +1014,14 @@ if KERNEL_IP_PNP
endif endif
config KERNEL_BTRFS_FS
bool "Compile the kernel with built-in BTRFS support"
help
Say Y here if you want to make the kernel to be able to boot off a
BTRFS partition.
menu "Filesystem ACL and attr support options" menu "Filesystem ACL and attr support options"
config USE_FS_ACL_ATTR config USE_FS_ACL_ATTR
bool "Use filesystem ACL and attr support by default" bool "Use filesystem ACL and attr support by default"
default y if !SMALL_FLASH default n
help help
Make using ACLs (e.g. POSIX ACL, NFSv4 ACL) the default Make using ACLs (e.g. POSIX ACL, NFSv4 ACL) the default
for kernel and packages, except old NFS. for kernel and packages, except tmpfs, flash filesystems,
Also enable userspace extended attribute support and old NFS. Also enable userspace extended attribute support
by default. (OpenWrt already has an expection it will be by default. (OpenWrt already has an expection it will be
present in the kernel). present in the kernel).
@ -1333,17 +1042,17 @@ menu "Filesystem ACL and attr support options"
config KERNEL_F2FS_FS_POSIX_ACL config KERNEL_F2FS_FS_POSIX_ACL
bool "Enable POSIX ACL for F2FS Filesystems" bool "Enable POSIX ACL for F2FS Filesystems"
select KERNEL_FS_POSIX_ACL select KERNEL_FS_POSIX_ACL
default y if USE_FS_ACL_ATTR default n
config KERNEL_JFFS2_FS_POSIX_ACL config KERNEL_JFFS2_FS_POSIX_ACL
bool "Enable POSIX ACL for JFFS2 Filesystems" bool "Enable POSIX ACL for JFFS2 Filesystems"
select KERNEL_FS_POSIX_ACL select KERNEL_FS_POSIX_ACL
default y if USE_FS_ACL_ATTR default n
config KERNEL_TMPFS_POSIX_ACL config KERNEL_TMPFS_POSIX_ACL
bool "Enable POSIX ACL for TMPFS Filesystems" bool "Enable POSIX ACL for TMPFS Filesystems"
select KERNEL_FS_POSIX_ACL select KERNEL_FS_POSIX_ACL
default y if USE_FS_ACL_ATTR default n
config KERNEL_CIFS_ACL config KERNEL_CIFS_ACL
bool "Enable CIFS ACLs" bool "Enable CIFS ACLs"
@ -1366,12 +1075,15 @@ menu "Filesystem ACL and attr support options"
config KERNEL_NFS_V3_ACL_SUPPORT config KERNEL_NFS_V3_ACL_SUPPORT
bool "Enable ACLs for NFSv3" bool "Enable ACLs for NFSv3"
default n
config KERNEL_NFSD_V2_ACL_SUPPORT config KERNEL_NFSD_V2_ACL_SUPPORT
bool "Enable ACLs for NFSDv2" bool "Enable ACLs for NFSDv2"
default n
config KERNEL_NFSD_V3_ACL_SUPPORT config KERNEL_NFSD_V3_ACL_SUPPORT
bool "Enable ACLs for NFSDv3" bool "Enable ACLs for NFSDv3"
default n
config KERNEL_REISER_FS_POSIX_ACL config KERNEL_REISER_FS_POSIX_ACL
bool "Enable POSIX ACLs for ReiserFS" bool "Enable POSIX ACLs for ReiserFS"
@ -1413,7 +1125,7 @@ config KERNEL_SQUASHFS_XATTR
bool "Squashfs XATTR support" bool "Squashfs XATTR support"
# #
# compile optimization setting # compile optimiziation setting
# #
choice choice
prompt "Compiler optimization level" prompt "Compiler optimization level"
@ -1480,30 +1192,12 @@ config KERNEL_LSM
config KERNEL_EXT4_FS_SECURITY config KERNEL_EXT4_FS_SECURITY
bool "Ext4 Security Labels" bool "Ext4 Security Labels"
default y if !SMALL_FLASH
config KERNEL_F2FS_FS_SECURITY config KERNEL_F2FS_FS_SECURITY
bool "F2FS Security Labels" bool "F2FS Security Labels"
default y if !SMALL_FLASH
config KERNEL_UBIFS_FS_SECURITY config KERNEL_UBIFS_FS_SECURITY
bool "UBIFS Security Labels" bool "UBIFS Security Labels"
default y if !SMALL_FLASH
config KERNEL_JFFS2_FS_SECURITY config KERNEL_JFFS2_FS_SECURITY
bool "JFFS2 Security Labels" bool "JFFS2 Security Labels"
default y if !SMALL_FLASH
config KERNEL_WERROR
bool "Compile the kernel with warnings as errors"
help
A kernel build should not cause any compiler warnings, and this
enables the '-Werror' (for C) and '-Dwarnings' (for Rust) flags
to enforce that rule by default. Certain warnings from other tools
such as the linker may be upgraded to errors with this option as
well.
However, if you have a new (or very old) compiler or linker with odd
and unusual warnings, or you have some architecture with problems,
you may need to disable this config option in order to
successfully build the kernel.

View File

@ -1,12 +0,0 @@
cat << EOF | "$STAGING_DIR_HOST/bin/g++" -c -x c++ -o /dev/null - >/dev/null 2>&1
#if __clang__
#if __clang_major__ < $3
#error "clang too old"
#endif
#else
#if __GNUC__ < $1 || (__GNUC__ == $1 && (__GNUC_MINOR__ < $2))
#error "gcc too old"
#endif
#endif
EOF
[ $? -eq 0 ] && echo y || echo n

View File

@ -1 +0,0 @@
[ "$(uname)" = "$1" ] && echo y || echo n

BIN
doc/alipay_donate.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 126 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 163 KiB

BIN
doc/wechat_donate.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

BIN
doc/xm5.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

BIN
doc/xm6.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

View File

@ -1,10 +1,7 @@
src-git packages https://github.com/coolsnowwolf/packages src-git packages https://github.com/coolsnowwolf/packages
#src-git luci https://github.com/coolsnowwolf/luci src-git luci https://github.com/coolsnowwolf/luci
src-git luci https://github.com/coolsnowwolf/luci.git;openwrt-23.05
src-git routing https://github.com/coolsnowwolf/routing src-git routing https://github.com/coolsnowwolf/routing
src-git telephony https://github.com/coolsnowwolf/telephony.git src-git telephony https://git.openwrt.org/feed/telephony.git
#src-git helloworld https://github.com/fw876/helloworld.git
#src-git oui https://github.com/zhaojh329/oui.git
#src-git video https://github.com/openwrt/video.git #src-git video https://github.com/openwrt/video.git
#src-git targets https://github.com/openwrt/targets.git #src-git targets https://github.com/openwrt/targets.git
#src-git oldpackages http://git.openwrt.org/packages.git #src-git oldpackages http://git.openwrt.org/packages.git

View File

@ -23,8 +23,7 @@ AM_TOOL_PATHS:= \
LIBTOOLIZE=$(STAGING_DIR_HOST)/bin/libtoolize \ LIBTOOLIZE=$(STAGING_DIR_HOST)/bin/libtoolize \
LIBTOOL=$(STAGING_DIR_HOST)/bin/libtool \ LIBTOOL=$(STAGING_DIR_HOST)/bin/libtool \
M4=$(STAGING_DIR_HOST)/bin/m4 \ M4=$(STAGING_DIR_HOST)/bin/m4 \
AUTOPOINT=true \ AUTOPOINT=true
GTKDOCIZE=true
# 1: build dir # 1: build dir
# 2: remove files # 2: remove files
@ -36,7 +35,7 @@ define autoreconf
$(patsubst %,rm -f %;,$(2)) \ $(patsubst %,rm -f %;,$(2)) \
$(foreach p,$(3), \ $(foreach p,$(3), \
if [ -f $(p)/configure.ac ] || [ -f $(p)/configure.in ]; then \ if [ -f $(p)/configure.ac ] || [ -f $(p)/configure.in ]; then \
[ -d $(p)/autom4te.cache ] && rm -rf $(p)/autom4te.cache; \ [ -d $(p)/autom4te.cache ] && rm -rf autom4te.cache; \
[ -e $(p)/config.rpath ] || \ [ -e $(p)/config.rpath ] || \
ln -s $(SCRIPT_DIR)/config.rpath $(p)/config.rpath; \ ln -s $(SCRIPT_DIR)/config.rpath $(p)/config.rpath; \
touch NEWS AUTHORS COPYING ABOUT-NLS ChangeLog; \ touch NEWS AUTHORS COPYING ABOUT-NLS ChangeLog; \
@ -114,7 +113,7 @@ ifneq ($(filter patch-libtool,$(PKG_FIXUP)),)
endif endif
ifneq ($(filter libtool,$(PKG_FIXUP)),) ifneq ($(filter libtool,$(PKG_FIXUP)),)
PKG_BUILD_DEPENDS += libtool PKG_BUILD_DEPENDS += libtool gettext libiconv
ifeq ($(filter no-autoreconf,$(PKG_FIXUP)),) ifeq ($(filter no-autoreconf,$(PKG_FIXUP)),)
Hooks/Configure/Pre += autoreconf_target Hooks/Configure/Pre += autoreconf_target
endif endif
@ -125,7 +124,7 @@ ifneq ($(filter libtool-abiver,$(PKG_FIXUP)),)
endif endif
ifneq ($(filter libtool-ucxx,$(PKG_FIXUP)),) ifneq ($(filter libtool-ucxx,$(PKG_FIXUP)),)
PKG_BUILD_DEPENDS += libtool PKG_BUILD_DEPENDS += libtool gettext libiconv
ifeq ($(filter no-autoreconf,$(PKG_FIXUP)),) ifeq ($(filter no-autoreconf,$(PKG_FIXUP)),)
Hooks/Configure/Pre += autoreconf_target Hooks/Configure/Pre += autoreconf_target
endif endif

View File

@ -63,15 +63,13 @@ BPF_CFLAGS := \
-Wno-unused-label \ -Wno-unused-label \
-O2 -emit-llvm -Xclang -disable-llvm-passes -O2 -emit-llvm -Xclang -disable-llvm-passes
ifneq ($(CONFIG_HAS_BPF_TOOLCHAIN),) ifeq ($(DUMP),)
ifeq ($(DUMP)$(filter download refresh,$(MAKECMDGOALS)),)
CLANG_VER:=$(shell $(CLANG) -dM -E - < /dev/null | grep __clang_major__ | cut -d' ' -f3) CLANG_VER:=$(shell $(CLANG) -dM -E - < /dev/null | grep __clang_major__ | cut -d' ' -f3)
CLANG_VER_VALID:=$(shell [ "$(CLANG_VER)" -ge "$(CLANG_MIN_VER)" ] && echo 1 ) CLANG_VER_VALID:=$(shell [ "$(CLANG_VER)" -ge "$(CLANG_MIN_VER)" ] && echo 1 )
ifeq ($(CLANG_VER_VALID),) ifeq ($(CLANG_VER_VALID),)
$(error ERROR: LLVM/clang version too old. Minimum required: $(CLANG_MIN_VER), found: $(CLANG_VER)) $(error ERROR: LLVM/clang version too old. Minimum required: $(CLANG_MIN_VER), found: $(CLANG_VER))
endif endif
endif endif
endif
define CompileBPF define CompileBPF
$(CLANG) -g -target $(BPF_ARCH)-linux-gnu $(BPF_CFLAGS) $(2) \ $(CLANG) -g -target $(BPF_ARCH)-linux-gnu $(BPF_CFLAGS) $(2) \

View File

@ -18,13 +18,12 @@ endif
CMAKE_BINARY_DIR = $(PKG_BUILD_DIR)$(if $(CMAKE_BINARY_SUBDIR),/$(CMAKE_BINARY_SUBDIR)) CMAKE_BINARY_DIR = $(PKG_BUILD_DIR)$(if $(CMAKE_BINARY_SUBDIR),/$(CMAKE_BINARY_SUBDIR))
CMAKE_SOURCE_DIR = $(PKG_BUILD_DIR)$(if $(CMAKE_SOURCE_SUBDIR),/$(CMAKE_SOURCE_SUBDIR)) CMAKE_SOURCE_DIR = $(PKG_BUILD_DIR)$(if $(CMAKE_SOURCE_SUBDIR),/$(CMAKE_SOURCE_SUBDIR))
HOST_CMAKE_SOURCE_DIR = $(HOST_BUILD_DIR)$(if $(CMAKE_SOURCE_SUBDIR),/$(CMAKE_SOURCE_SUBDIR)) HOST_CMAKE_SOURCE_DIR = $(HOST_BUILD_DIR)$(if $(CMAKE_SOURCE_SUBDIR),/$(CMAKE_SOURCE_SUBDIR))
HOST_CMAKE_BINARY_DIR = $(HOST_BUILD_DIR)$(if $(CMAKE_BINARY_SUBDIR),/$(CMAKE_BINARY_SUBDIR))
MAKE_PATH = $(firstword $(CMAKE_BINARY_SUBDIR) .) MAKE_PATH = $(firstword $(CMAKE_BINARY_SUBDIR) .)
ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),) ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
cmake_tool=$(TOOLCHAIN_DIR)/bin/$(1) cmake_tool=$(TOOLCHAIN_DIR)/bin/$(1)
else else
cmake_tool=$(shell command -v $(1)) cmake_tool=$(shell which $(1))
endif endif
ifeq ($(CONFIG_CCACHE),) ifeq ($(CONFIG_CCACHE),)
@ -52,21 +51,20 @@ CMAKE_RANLIB:=$(call cmake_tool,$(TARGET_RANLIB))
CMAKE_FIND_ROOT_PATH:=$(STAGING_DIR)/usr;$(TOOLCHAIN_DIR)$(if $(CONFIG_EXTERNAL_TOOLCHAIN),;$(CONFIG_TOOLCHAIN_ROOT)) CMAKE_FIND_ROOT_PATH:=$(STAGING_DIR)/usr;$(TOOLCHAIN_DIR)$(if $(CONFIG_EXTERNAL_TOOLCHAIN),;$(CONFIG_TOOLCHAIN_ROOT))
CMAKE_HOST_FIND_ROOT_PATH:=$(STAGING_DIR)/host;$(STAGING_DIR_HOSTPKG);$(STAGING_DIR_HOST) CMAKE_HOST_FIND_ROOT_PATH:=$(STAGING_DIR)/host;$(STAGING_DIR_HOSTPKG);$(STAGING_DIR_HOST)
CMAKE_SHARED_LDFLAGS:=-Wl,-Bsymbolic-functions CMAKE_SHARED_LDFLAGS:=-Wl,-Bsymbolic-functions
CMAKE_HOST_INSTALL_PREFIX = $(HOST_BUILD_PREFIX)
ifeq ($(HOST_USE_NINJA),1) ifeq ($(HOST_USE_NINJA),1)
CMAKE_HOST_OPTIONS += -DCMAKE_GENERATOR="Ninja" CMAKE_HOST_OPTIONS += -DCMAKE_GENERATOR="Ninja"
define Host/Compile/Default define Host/Compile/Default
+$(NINJA) -C $(HOST_CMAKE_BINARY_DIR) $(1) +$(NINJA) -C $(HOST_BUILD_DIR) $(1)
endef endef
define Host/Install/Default define Host/Install/Default
+$(NINJA) -C $(HOST_CMAKE_BINARY_DIR) install +$(NINJA) -C $(HOST_BUILD_DIR) install
endef endef
define Host/Uninstall/Default define Host/Uninstall/Default
+$(NINJA) -C $(HOST_CMAKE_BINARY_DIR) uninstall +$(NINJA) -C $(HOST_BUILD_DIR) uninstall
endef endef
endif endif
@ -135,8 +133,7 @@ endef
Build/InstallDev = $(if $(CMAKE_INSTALL),$(Build/InstallDev/cmake)) Build/InstallDev = $(if $(CMAKE_INSTALL),$(Build/InstallDev/cmake))
define Host/Configure/Default define Host/Configure/Default
mkdir -p "$(HOST_CMAKE_BINARY_DIR)" (cd $(HOST_BUILD_DIR); \
(cd $(HOST_CMAKE_BINARY_DIR); \
CFLAGS="$(HOST_CFLAGS)" \ CFLAGS="$(HOST_CFLAGS)" \
CXXFLAGS="$(HOST_CFLAGS)" \ CXXFLAGS="$(HOST_CFLAGS)" \
LDFLAGS="$(HOST_LDFLAGS)" \ LDFLAGS="$(HOST_LDFLAGS)" \
@ -158,7 +155,7 @@ define Host/Configure/Default
-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \ -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \
-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY \ -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY \
-DCMAKE_STRIP=: \ -DCMAKE_STRIP=: \
-DCMAKE_INSTALL_PREFIX=$(CMAKE_HOST_INSTALL_PREFIX) \ -DCMAKE_INSTALL_PREFIX=$(HOST_BUILD_PREFIX) \
-DCMAKE_PREFIX_PATH=$(HOST_BUILD_PREFIX) \ -DCMAKE_PREFIX_PATH=$(HOST_BUILD_PREFIX) \
-DCMAKE_SKIP_RPATH=TRUE \ -DCMAKE_SKIP_RPATH=TRUE \
-DCMAKE_INSTALL_LIBDIR=lib \ -DCMAKE_INSTALL_LIBDIR=lib \

View File

@ -12,7 +12,6 @@
DEP_FINDPARAMS := -x "*/.svn*" -x ".*" -x "*:*" -x "*\!*" -x "* *" -x "*\\\#*" -x "*/.*_check" -x "*/.*.swp" -x "*/.pkgdir*" DEP_FINDPARAMS := -x "*/.svn*" -x ".*" -x "*:*" -x "*\!*" -x "* *" -x "*\\\#*" -x "*/.*_check" -x "*/.*.swp" -x "*/.pkgdir*"
find_md5=find $(wildcard $(1)) -type f $(patsubst -x,-and -not -path,$(DEP_FINDPARAMS) $(2)) -printf "%p%T@\n" | sort | $(MKHASH) md5 find_md5=find $(wildcard $(1)) -type f $(patsubst -x,-and -not -path,$(DEP_FINDPARAMS) $(2)) -printf "%p%T@\n" | sort | $(MKHASH) md5
find_md5_reproducible=find $(wildcard $(1)) -type f $(patsubst -x,-and -not -path,$(DEP_FINDPARAMS) $(2)) -print0 | xargs -0 $(MKHASH) md5 | sort | $(MKHASH) md5
define rdep define rdep
.PRECIOUS: $(2) .PRECIOUS: $(2)
@ -28,7 +27,7 @@ ifneq ($(wildcard $(2)),)
{ [ \! -f "$(3)" ] || diff $(3) $(3).1 >/dev/null; } && \ { [ \! -f "$(3)" ] || diff $(3) $(3).1 >/dev/null; } && \
) \ ) \
{ \ { \
[ -f "$(2)_check.1" ] && mv "$(2)_check.1" "$(2)_check"; \ [ -f "$(2)_check.1" ] && mv "$(2)_check.1"; \
$(TOPDIR)/scripts/timestamp.pl $(DEP_FINDPARAMS) $(4) -n $(2) $(1) && { \ $(TOPDIR)/scripts/timestamp.pl $(DEP_FINDPARAMS) $(4) -n $(2) $(1) && { \
$(call debug_eval,$(SUBDIR),r,echo "No need to rebuild $(2)";) \ $(call debug_eval,$(SUBDIR),r,echo "No need to rebuild $(2)";) \
touch -r "$(2)" "$(2)_check"; \ touch -r "$(2)" "$(2)_check"; \

View File

@ -18,10 +18,6 @@ endif
DOWNLOAD_RDEP=$(STAMP_PREPARED) $(HOST_STAMP_PREPARED) DOWNLOAD_RDEP=$(STAMP_PREPARED) $(HOST_STAMP_PREPARED)
# Export options for download.pl
export DOWNLOAD_CHECK_CERTIFICATE:=$(CONFIG_DOWNLOAD_CHECK_CERTIFICATE)
export DOWNLOAD_TOOL_CUSTOM:=$(CONFIG_DOWNLOAD_TOOL_CUSTOM)
define dl_method_git define dl_method_git
$(if $(filter https://github.com/% git://github.com/%,$(1)),github_archive,git) $(if $(filter https://github.com/% git://github.com/%,$(1)),github_archive,git)
endef endef
@ -63,21 +59,6 @@ define dl_tar_pack
$$$${TAR_TIMESTAMP:+--mtime="$$$$TAR_TIMESTAMP"} -c $(2) | $(call dl_pack,$(1)) $$$${TAR_TIMESTAMP:+--mtime="$$$$TAR_TIMESTAMP"} -c $(2) | $(call dl_pack,$(1))
endef endef
gen_sha256sum = $(shell $(MKHASH) sha256 $(DL_DIR)/$(1))
# Used in Build/CoreTargets and HostBuild/Core as an integrity check for
# downloaded files. It will add a FORCE rule if the sha256 hash does not
# match, so that the download can be more thoroughly handled by download.pl.
define check_download_integrity
expected_hash:=$(strip $(if $(filter-out x,$(HASH)),$(HASH),$(MIRROR_HASH)))
$$(if $$(and $(FILE),$$(wildcard $(DL_DIR)/$(FILE)), \
$$(filter undefined,$$(flavor DownloadChecked/$(FILE)))), \
$$(eval DownloadChecked/$(FILE):=1) \
$$(if $$(filter-out $$(call gen_sha256sum,$(FILE)),$$(expected_hash)), \
$(DL_DIR)/$(FILE): FORCE) \
)
endef
ifdef CHECK ifdef CHECK
check_escape=$(subst ','\'',$(1)) check_escape=$(subst ','\'',$(1))
#') #')
@ -93,6 +74,8 @@ else
check_warn = $(if $(filter-out undefined,$(origin F_$(1))),$(filter ,$(shell $(call F_$(1),$(2),$(3),$(4)) >&2)),$(check_warn_nofix)) check_warn = $(if $(filter-out undefined,$(origin F_$(1))),$(filter ,$(shell $(call F_$(1),$(2),$(3),$(4)) >&2)),$(check_warn_nofix))
endif endif
gen_sha256sum = $(shell $(MKHASH) sha256 $(DL_DIR)/$(1))
ifdef FIXUP ifdef FIXUP
F_hash_deprecated = $(SCRIPT_DIR)/fixup-makefile.pl $(CURDIR)/Makefile fix-hash $(3) $(call gen_sha256sum,$(1)) $(2) F_hash_deprecated = $(SCRIPT_DIR)/fixup-makefile.pl $(CURDIR)/Makefile fix-hash $(3) $(call gen_sha256sum,$(1)) $(2)
F_hash_mismatch = $(F_hash_deprecated) F_hash_mismatch = $(F_hash_deprecated)

View File

@ -21,7 +21,7 @@ include $(INCLUDE_DIR)/depends.mk
include $(INCLUDE_DIR)/quilt.mk include $(INCLUDE_DIR)/quilt.mk
BUILD_TYPES += host BUILD_TYPES += host
HOST_STAMP_PREPARED=$(HOST_BUILD_DIR)/.prepared$(if $(HOST_QUILT)$(DUMP),,$(shell $(call $(if $(CONFIG_AUTOREMOVE),find_md5_reproducible,find_md5),${CURDIR} $(PKG_FILE_DEPENDS),))_$(call confvar,CONFIG_AUTOREMOVE $(HOST_PREPARED_DEPENDS))) HOST_STAMP_PREPARED=$(HOST_BUILD_DIR)/.prepared$(if $(HOST_QUILT)$(DUMP),,$(shell $(call find_md5,${CURDIR} $(PKG_FILE_DEPENDS),))_$(call confvar,CONFIG_AUTOREMOVE $(HOST_PREPARED_DEPENDS)))
HOST_STAMP_CONFIGURED:=$(HOST_BUILD_DIR)/.configured HOST_STAMP_CONFIGURED:=$(HOST_BUILD_DIR)/.configured
HOST_STAMP_BUILT:=$(HOST_BUILD_DIR)/.built HOST_STAMP_BUILT:=$(HOST_BUILD_DIR)/.built
HOST_BUILD_PREFIX?=$(if $(IS_PACKAGE_BUILD),$(STAGING_DIR_HOSTPKG),$(STAGING_DIR_HOST)) HOST_BUILD_PREFIX?=$(if $(IS_PACKAGE_BUILD),$(STAGING_DIR_HOSTPKG),$(STAGING_DIR_HOST))
@ -34,31 +34,23 @@ include $(INCLUDE_DIR)/autotools.mk
_host_target:=$(if $(HOST_QUILT),,.) _host_target:=$(if $(HOST_QUILT),,.)
Host/Patch:=$(Host/Patch/Default) Host/Patch:=$(Host/Patch/Default)
ifneq ($(strip $(HOST_UNPACK)),)
define Host/Prepare/Default define Host/Prepare/Default
$(if $(strip $(HOST_UNPACK)),$(HOST_UNPACK)) $(HOST_UNPACK)
[ ! -d ./src/ ] || $(CP) ./src/* $(HOST_BUILD_DIR) [ ! -d ./src/ ] || $(CP) ./src/* $(HOST_BUILD_DIR)
$(Host/Patch) $(Host/Patch)
endef endef
endif
define Host/Prepare define Host/Prepare
$(call Host/Prepare/Default) $(call Host/Prepare/Default)
endef endef
define Host/Gnulib/Prepare
$(STAGING_DIR_HOST)/bin/gnulib-tool \
--local-dir=$(STAGING_DIR_HOST)/share/gnulib \
--source-base=$(PKG_GNULIB_BASE) \
$(PKG_GNULIB_ARGS) \
$(PKG_GNULIB_MODS) \
;
endef
HOST_CONFIGURE_VARS = \ HOST_CONFIGURE_VARS = \
CC="$(HOSTCC)" \ CC="$(HOSTCC)" \
CFLAGS="$(HOST_CFLAGS)" \ CFLAGS="$(HOST_CFLAGS)" \
CXX="$(HOSTCXX)" \ CXX="$(HOSTCXX)" \
CPPFLAGS="$(HOST_CPPFLAGS)" \ CPPFLAGS="$(HOST_CPPFLAGS)" \
CXXFLAGS="$(HOST_CXXFLAGS)" \
LDFLAGS="$(HOST_LDFLAGS)" \ LDFLAGS="$(HOST_LDFLAGS)" \
CONFIG_SHELL="$(SHELL)" CONFIG_SHELL="$(SHELL)"
@ -116,10 +108,6 @@ define Host/Compile
$(call Host/Compile/Default) $(call Host/Compile/Default)
endef endef
define Host/Gnulib/Compile
$(call Host/Compile/Default,SUBDIRS='$$$$(wildcard $(PKG_GNULIB_BASE))')
endef
define Host/Install/Default define Host/Install/Default
$(call Host/Compile/Default,install) $(call Host/Compile/Default,install)
endef endef
@ -192,7 +180,7 @@ ifndef DUMP
clean-build: host-clean-build clean-build: host-clean-build
endif endif
$(call check_download_integrity) $(DL_DIR)/$(FILE): FORCE
$(_host_target)host-prepare: $(HOST_STAMP_PREPARED) $(_host_target)host-prepare: $(HOST_STAMP_PREPARED)
$(_host_target)host-configure: $(HOST_STAMP_CONFIGURED) $(_host_target)host-configure: $(HOST_STAMP_CONFIGURED)
@ -209,17 +197,13 @@ ifndef DUMP
ifneq ($(CONFIG_AUTOREMOVE),) ifneq ($(CONFIG_AUTOREMOVE),)
host-compile: host-compile:
$(FIND) $(HOST_BUILD_DIR) -mindepth 1 -maxdepth 1 -not '(' -type f -and -name '.*' -and -size 0 ')' -print0 | \ $(FIND) $(HOST_BUILD_DIR) -mindepth 1 -maxdepth 1 -not '(' -type f -and -name '.*' -and -size 0 ')' | \
$(XARGS) -0 rm -rf $(XARGS) rm -rf
endif endif
endef endef
endif endif
define HostBuild define HostBuild
$(HostBuild/Core) $(HostBuild/Core)
$(if $(if $(PKG_HOST_ONLY),,$(if $(and $(filter host-%,$(MAKECMDGOALS)),$(PKG_SKIP_DOWNLOAD)),,$(STAMP_PREPARED))),, $(if $(if $(PKG_HOST_ONLY),,$(STAMP_PREPARED)),,$(if $(strip $(PKG_SOURCE_URL)),$(call Download,default)))
$(if $(and $(CONFIG_AUTOREMOVE), $(wildcard $(HOST_STAMP_INSTALLED), $(wildcard $(HOST_STAMP_BUILT)))),,
$(if $(strip $(PKG_SOURCE_URL)),$(call Download,default))
)
)
endef endef

View File

@ -4,7 +4,7 @@ IMAGE_KERNEL = $(word 1,$^)
IMAGE_ROOTFS = $(word 2,$^) IMAGE_ROOTFS = $(word 2,$^)
define ModelNameLimit16 define ModelNameLimit16
$(shell printf %.16s "$(word 2, $(subst _, ,$(1)))") $(shell expr substr "$(word 2, $(subst _, ,$(1)))" 1 16)
endef endef
define rootfs_align define rootfs_align
@ -27,21 +27,8 @@ define Build/append-kernel
dd if=$(IMAGE_KERNEL) >> $@ dd if=$(IMAGE_KERNEL) >> $@
endef endef
define Build/package-kernel-ubifs
mkdir $@.kernelubifs
cp $@ $@.kernelubifs/kernel
$(STAGING_DIR_HOST)/bin/mkfs.ubifs \
$(KERNEL_UBIFS_OPTS) \
-r $@.kernelubifs $@
rm -r $@.kernelubifs
endef
define Build/append-image define Build/append-image
cp "$(BIN_DIR)/$(DEVICE_IMG_PREFIX)-$(1)" "$@.stripmeta" dd if=$(BIN_DIR)/$(DEVICE_IMG_PREFIX)-$(1) >> $@
fwtool -s /dev/null -t "$@.stripmeta" || :
fwtool -i /dev/null -t "$@.stripmeta" || :
dd if="$@.stripmeta" >> "$@"
rm "$@.stripmeta"
endef endef
ifdef IB ifdef IB
@ -50,13 +37,8 @@ define Build/append-image-stage
endef endef
else else
define Build/append-image-stage define Build/append-image-stage
cp "$(BIN_DIR)/$(DEVICE_IMG_PREFIX)-$(1)" "$@.stripmeta" dd if=$(BIN_DIR)/$(DEVICE_IMG_PREFIX)-$(1) of=$(STAGING_DIR_IMAGE)/$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))-$(DEVICE_NAME)-$(1)
fwtool -s /dev/null -t "$@.stripmeta" || : dd if=$(BIN_DIR)/$(DEVICE_IMG_PREFIX)-$(1) >> $@
fwtool -i /dev/null -t "$@.stripmeta" || :
mkdir -p "$(STAGING_DIR_IMAGE)"
dd if="$@.stripmeta" of="$(STAGING_DIR_IMAGE)/$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))-$(DEVICE_NAME)-$(1)"
dd if="$@.stripmeta" >> "$@"
rm "$@.stripmeta"
endef endef
endif endif
@ -90,7 +72,6 @@ metadata_json = \
define Build/append-metadata define Build/append-metadata
$(if $(SUPPORTED_DEVICES),-echo $(call metadata_json) | fwtool -I - $@) $(if $(SUPPORTED_DEVICES),-echo $(call metadata_json) | fwtool -I - $@)
sha256sum "$@" | cut -d" " -f1 > "$@.sha256sum"
[ ! -s "$(BUILD_KEY)" -o ! -s "$(BUILD_KEY).ucert" -o ! -s "$@" ] || { \ [ ! -s "$(BUILD_KEY)" -o ! -s "$(BUILD_KEY).ucert" -o ! -s "$@" ] || { \
cp "$(BUILD_KEY).ucert" "$@.ucert" ;\ cp "$(BUILD_KEY).ucert" "$@.ucert" ;\
usign -S -m "$@" -s "$(BUILD_KEY)" -x "$@.sig" ;\ usign -S -m "$@" -s "$(BUILD_KEY)" -x "$@.sig" ;\
@ -113,15 +94,6 @@ define Build/append-squashfs-fakeroot-be
cat $@.fakesquashfs >> $@ cat $@.fakesquashfs >> $@
endef endef
define Build/append-squashfs4-fakeroot
rm -rf $@.fakefs $@.fakesquashfs
mkdir $@.fakefs
$(STAGING_DIR_HOST)/bin/mksquashfs4 \
$@.fakefs $@.fakesquashfs \
-nopad -noappend -root-owned
cat $@.fakesquashfs >> $@
endef
define Build/append-string define Build/append-string
echo -n $(1) >> $@ echo -n $(1) >> $@
endef endef
@ -131,7 +103,7 @@ define Build/append-ubi
$(if $(UBOOTENV_IN_UBI),--uboot-env) \ $(if $(UBOOTENV_IN_UBI),--uboot-env) \
$(if $(KERNEL_IN_UBI),--kernel $(IMAGE_KERNEL)) \ $(if $(KERNEL_IN_UBI),--kernel $(IMAGE_KERNEL)) \
$(foreach part,$(UBINIZE_PARTS),--part $(part)) \ $(foreach part,$(UBINIZE_PARTS),--part $(part)) \
--rootfs $(IMAGE_ROOTFS) \ $(IMAGE_ROOTFS) \
$@.tmp \ $@.tmp \
-p $(BLOCKSIZE:%k=%KiB) -m $(PAGESIZE) \ -p $(BLOCKSIZE:%k=%KiB) -m $(PAGESIZE) \
$(if $(SUBPAGESIZE),-s $(SUBPAGESIZE)) \ $(if $(SUBPAGESIZE),-s $(SUBPAGESIZE)) \
@ -141,18 +113,6 @@ define Build/append-ubi
rm $@.tmp rm $@.tmp
endef endef
define Build/ubinize-kernel
cp $@ $@.tmp
sh $(TOPDIR)/scripts/ubinize-image.sh \
--kernel $@.tmp \
$@ \
-p $(BLOCKSIZE:%k=%KiB) -m $(PAGESIZE) \
$(if $(SUBPAGESIZE),-s $(SUBPAGESIZE)) \
$(if $(VID_HDR_OFFSET),-O $(VID_HDR_OFFSET)) \
$(UBINIZE_OPTS)
rm $@.tmp
endef
define Build/append-uboot define Build/append-uboot
dd if=$(UBOOT_PATH) >> $@ dd if=$(UBOOT_PATH) >> $@
endef endef
@ -210,20 +170,11 @@ define Build/check-size
@imagesize="$$(stat -c%s $@)"; \ @imagesize="$$(stat -c%s $@)"; \
limitsize="$$(($(subst k,* 1024,$(subst m, * 1024k,$(if $(1),$(1),$(IMAGE_SIZE))))))"; \ limitsize="$$(($(subst k,* 1024,$(subst m, * 1024k,$(if $(1),$(1),$(IMAGE_SIZE))))))"; \
[ $$limitsize -ge $$imagesize ] || { \ [ $$limitsize -ge $$imagesize ] || { \
$(call ERROR_MESSAGE, WARNING: Image file $@ is too big: $$imagesize > $$limitsize); \ echo "WARNING: Image file $@ is too big: $$imagesize > $$limitsize" >&2; \
rm -f $@; \ rm -f $@; \
} }
endef endef
define Build/copy-file
cat "$(1)" > "$@"
endef
define Build/edimax-header
$(STAGING_DIR_HOST)/bin/mkedimaximg -i $@ -o $@.new $(1)
@mv $@.new $@
endef
define Build/elecom-product-header define Build/elecom-product-header
$(eval product=$(word 1,$(1))) $(eval product=$(word 1,$(1)))
$(eval fw=$(if $(word 2,$(1)),$(word 2,$(1)),$@)) $(eval fw=$(if $(word 2,$(1)),$(word 2,$(1)),$@))
@ -236,19 +187,6 @@ define Build/elecom-product-header
mv $(fw).new $(fw) mv $(fw).new $(fw)
endef endef
define Build/elecom-wrc-gs-factory
$(eval product=$(word 1,$(1)))
$(eval version=$(word 2,$(1)))
$(eval hash_opt=$(word 3,$(1)))
$(MKHASH) md5 $(hash_opt) $@ >> $@
( \
echo -n "ELECOM $(product) v$(version)" | \
dd bs=32 count=1 conv=sync; \
dd if=$@; \
) > $@.new
mv $@.new $@
endef
define Build/elx-header define Build/elx-header
$(eval hw_id=$(word 1,$(1))) $(eval hw_id=$(word 1,$(1)))
$(eval xor_pattern=$(word 2,$(1))) $(eval xor_pattern=$(word 2,$(1)))
@ -277,9 +215,7 @@ endef
define Build/initrd_compression define Build/initrd_compression
$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_BZIP2),.bzip2) \ $(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_BZIP2),.bzip2) \
$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_GZIP),.gzip) \ $(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_GZIP),.gzip) \
$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZ4),.lz4) \
$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZMA),.lzma) \ $(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZMA),.lzma) \
$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZO),.lzo) \
$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_XZ),.xz) \ $(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_XZ),.xz) \
$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_ZSTD),.zstd) $(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_ZSTD),.zstd)
endef endef
@ -287,10 +223,8 @@ endef
define Build/fit define Build/fit
$(TOPDIR)/scripts/mkits.sh \ $(TOPDIR)/scripts/mkits.sh \
-D $(DEVICE_NAME) -o $@.its -k $@ \ -D $(DEVICE_NAME) -o $@.its -k $@ \
-C $(word 1,$(1)) \ -C $(word 1,$(1)) $(if $(word 2,$(1)),\
$(if $(word 2,$(1)),\ $(if $(DEVICE_DTS_OVERLAY),-d $(KERNEL_BUILD_DIR)/image-$$(basename $(word 2,$(1))),\
$(if $(findstring 11,$(if $(DEVICE_DTS_OVERLAY),1)$(if $(findstring $(KERNEL_BUILD_DIR)/image-,$(word 2,$(1))),,1)), \
-d $(KERNEL_BUILD_DIR)/image-$$(basename $(word 2,$(1))), \
-d $(word 2,$(1)))) \ -d $(word 2,$(1)))) \
$(if $(findstring with-rootfs,$(word 3,$(1))),-r $(IMAGE_ROOTFS)) \ $(if $(findstring with-rootfs,$(word 3,$(1))),-r $(IMAGE_ROOTFS)) \
$(if $(findstring with-initrd,$(word 3,$(1))), \ $(if $(findstring with-initrd,$(word 3,$(1))), \
@ -298,9 +232,7 @@ define Build/fit
-i $(KERNEL_BUILD_DIR)/initrd.cpio$(strip $(call Build/initrd_compression)))) \ -i $(KERNEL_BUILD_DIR)/initrd.cpio$(strip $(call Build/initrd_compression)))) \
-a $(KERNEL_LOADADDR) -e $(if $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \ -a $(KERNEL_LOADADDR) -e $(if $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \
$(if $(DEVICE_FDT_NUM),-n $(DEVICE_FDT_NUM)) \ $(if $(DEVICE_FDT_NUM),-n $(DEVICE_FDT_NUM)) \
$(if $(DEVICE_DTS_DELIMITER),-l $(DEVICE_DTS_DELIMITER)) \ $(if $(DEVICE_DTS_OVERLAY),$(foreach dtso,$(DEVICE_DTS_OVERLAY), -O $(dtso):$(KERNEL_BUILD_DIR)/image-$(dtso).dtb)) \
$(if $(DEVICE_DTS_LOADADDR),-s $(DEVICE_DTS_LOADADDR)) \
$(if $(DEVICE_DTS_OVERLAY),$(foreach dtso,$(DEVICE_DTS_OVERLAY), -O $(dtso):$(KERNEL_BUILD_DIR)/image-$(dtso).dtbo)) \
-c $(if $(DEVICE_DTS_CONFIG),$(DEVICE_DTS_CONFIG),"config-1") \ -c $(if $(DEVICE_DTS_CONFIG),$(DEVICE_DTS_CONFIG),"config-1") \
-A $(LINUX_KARCH) -v $(LINUX_VERSION) -A $(LINUX_KARCH) -v $(LINUX_VERSION)
PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage $(if $(findstring external,$(word 3,$(1))),\ PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage $(if $(findstring external,$(word 3,$(1))),\
@ -308,25 +240,11 @@ define Build/fit
@mv $@.new $@ @mv $@.new $@
endef endef
define Build/libdeflate-gzip
$(STAGING_DIR_HOST)/bin/libdeflate-gzip -f -12 -c $@ $(1) > $@.new
@mv $@.new $@
endef
define Build/gzip define Build/gzip
$(STAGING_DIR_HOST)/bin/gzip -f -9n -c $@ $(1) > $@.new gzip -f -9n -c $@ $(1) > $@.new
@mv $@.new $@ @mv $@.new $@
endef endef
define Build/gzip-filename
@mkdir -p $@.tmp
@cp $@ $@.tmp/$(word 1,$(1))
$(if $(SOURCE_DATE_EPOCH),touch -hcd "@$(SOURCE_DATE_EPOCH)" $@.tmp/$(word 1,$(1)) $(word 2,$(1)))
$(STAGING_DIR_HOST)/bin/gzip -f -9 -N -c $@.tmp/$(word 1,$(1)) $(word 2,$(1)) > $@.new
@mv $@.new $@
@rm -rf $@.tmp
endef
define Build/install-dtb define Build/install-dtb
$(call locked, \ $(call locked, \
$(foreach dts,$(DEVICE_DTS), \ $(foreach dts,$(DEVICE_DTS), \
@ -338,16 +256,6 @@ define Build/install-dtb
) )
endef endef
define Build/iptime-crc32
$(STAGING_DIR_HOST)/bin/iptime-crc32 $(1) $@ $@.new
mv $@.new $@
endef
define Build/iptime-naspkg
$(STAGING_DIR_HOST)/bin/iptime-naspkg $(1) $@ $@.new
mv $@.new $@
endef
define Build/jffs2 define Build/jffs2
rm -rf $(KDIR_TMP)/$(DEVICE_NAME)/jffs2 && \ rm -rf $(KDIR_TMP)/$(DEVICE_NAME)/jffs2 && \
mkdir -p $(KDIR_TMP)/$(DEVICE_NAME)/jffs2/$$(dirname $(1)) && \ mkdir -p $(KDIR_TMP)/$(DEVICE_NAME)/jffs2/$$(dirname $(1)) && \
@ -410,19 +318,6 @@ define Build/netgear-dni
mv $@.new $@ mv $@.new $@
endef endef
define Build/netgear-encrypted-factory
$(TOPDIR)/scripts/netgear-encrypted-factory.py \
--input-file $@ \
--output-file $@ \
--model $(NETGEAR_ENC_MODEL) \
--region $(NETGEAR_ENC_REGION) \
--version V1.0.0.0.$(VERSION_DIST).$(firstword $(subst -, ,$(REVISION))) \
--encryption-block-size 0x20000 \
--openssl-bin "$(STAGING_DIR_HOST)/bin/openssl" \
--key 6865392d342b4d212964363d6d7e7765312c7132613364316e26322a5a5e2538 \
--iv 4a253169516c38243d6c6d2d3b384145
endef
define Build/openmesh-image define Build/openmesh-image
$(TOPDIR)/scripts/om-fwupgradecfg-gen.sh \ $(TOPDIR)/scripts/om-fwupgradecfg-gen.sh \
"$(call param_get_default,ce_type,$(1),$(DEVICE_NAME))" \ "$(call param_get_default,ce_type,$(1),$(DEVICE_NAME))" \
@ -475,16 +370,16 @@ define Build/qemu-image
fi fi
endef endef
define Build/qsdk-ipq-factory-nand define Build/qsdk-ipq-factory-mmc
$(TOPDIR)/scripts/mkits-qsdk-ipq-image.sh \ $(TOPDIR)/scripts/mkits-qsdk-ipq-image.sh \
$@.its ubi $@ $@.its kernel $(IMAGE_KERNEL) rootfs $(IMAGE_ROOTFS)
PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $@.its $@.new PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $@.its $@.new
@mv $@.new $@ @mv $@.new $@
endef endef
define Build/qsdk-ipq-factory-mmc define Build/qsdk-ipq-factory-nand
$(TOPDIR)/scripts/mkits-qsdk-ipq-image.sh \ $(TOPDIR)/scripts/mkits-qsdk-ipq-image.sh \
$@.its kernel $(IMAGE_KERNEL) rootfs $(IMAGE_ROOTFS) $@.its ubi $@
PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $@.its $@.new PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $@.its $@.new
@mv $@.new $@ @mv $@.new $@
endef endef
@ -581,7 +476,6 @@ define Build/tplink-v2-image
endef endef
define Build/uImage define Build/uImage
$(if $(UIMAGE_TIME),SOURCE_DATE_EPOCH="$(UIMAGE_TIME)") \
mkimage \ mkimage \
-A $(LINUX_KARCH) \ -A $(LINUX_KARCH) \
-O linux \ -O linux \
@ -602,12 +496,12 @@ define Build/xor-image
endef endef
define Build/zip define Build/zip
rm -rf $@.tmp
mkdir $@.tmp mkdir $@.tmp
mv $@ $@.tmp/$(word 1,$(1)) mv $@ $@.tmp/$(1)
TZ=UTC $(STAGING_DIR_HOST)/bin/zip -j -X \
$(wordlist 2,$(words $(1)),$(1)) \ zip -j -X \
$@ $@.tmp/$(if $(word 1,$(1)),$(word 1,$(1)),$$(basename $@)) $(if $(SOURCE_DATE_EPOCH),--mtime="$(SOURCE_DATE_EPOCH)") \
$@ $@.tmp/$(if $(1),$(1),$@)
rm -rf $@.tmp rm -rf $@.tmp
endef endef

View File

@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-only # SPDX-License-Identifier: GPL-2.0-only
# #
# Copyright (C) 2006-2020 LEDE.org # Copyright (C) 2006-2020 OpenWrt.org
override TARGET_BUILD= override TARGET_BUILD=
include $(INCLUDE_DIR)/prereq.mk include $(INCLUDE_DIR)/prereq.mk
@ -137,6 +137,14 @@ define Image/BuildKernel/MkuImage
-n '$(call toupper,$(ARCH)) $(VERSION_DIST) Linux-$(LINUX_VERSION)' -d $(4) $(5) -n '$(call toupper,$(ARCH)) $(VERSION_DIST) Linux-$(LINUX_VERSION)' -d $(4) $(5)
endef endef
define Image/BuildKernel/MkFIT
$(TOPDIR)/scripts/mkits.sh \
-D $(1) -o $(KDIR)/fit-$(1).its -k $(2) $(if $(3),-d $(3)) -C $(4) -a $(5) -e $(6) \
-c $(if $(DEVICE_DTS_CONFIG),$(DEVICE_DTS_CONFIG),"config-1") \
-A $(LINUX_KARCH) -v $(LINUX_VERSION)
PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $(KDIR)/fit-$(1).its $(KDIR)/fit-$(1)$(7).itb
endef
ifdef CONFIG_TARGET_IMAGES_GZIP ifdef CONFIG_TARGET_IMAGES_GZIP
define Image/Gzip define Image/Gzip
rm -f $(1).gz rm -f $(1).gz
@ -146,7 +154,7 @@ endif
# Disable noisy checks by default as in upstream # Disable noisy checks by default as in upstream
DTC_WARN_FLAGS := \ DTC_FLAGS += \
-Wno-unit_address_vs_reg \ -Wno-unit_address_vs_reg \
-Wno-simple_bus_reg \ -Wno-simple_bus_reg \
-Wno-unit_address_format \ -Wno-unit_address_format \
@ -159,9 +167,6 @@ DTC_WARN_FLAGS := \
-Wno-graph_port \ -Wno-graph_port \
-Wno-unique_unit_address -Wno-unique_unit_address
DTC_FLAGS += $(DTC_WARN_FLAGS)
DTCO_FLAGS += $(DTC_WARN_FLAGS)
define Image/pad-to define Image/pad-to
dd if=$(1) of=$(1).new bs=$(2) conv=sync dd if=$(1) of=$(1).new bs=$(2) conv=sync
mv $(1).new $(1) mv $(1).new $(1)
@ -177,30 +182,20 @@ endef
# $(2) target dtb file # $(2) target dtb file
# $(3) extra CPP flags # $(3) extra CPP flags
# $(4) extra DTC flags # $(4) extra DTC flags
define Image/BuildDTB/sub define Image/BuildDTB
$(TARGET_CROSS)cpp -nostdinc -x assembler-with-cpp \ $(TARGET_CROSS)cpp -nostdinc -x assembler-with-cpp \
$(DTS_CPPFLAGS) \
-I$(DTS_DIR) \ -I$(DTS_DIR) \
-I$(DTS_DIR)/include \ -I$(DTS_DIR)/include \
-I$(LINUX_DIR)/include/ \ -I$(LINUX_DIR)/include/ \
-I$(LINUX_DIR)/scripts/dtc/include-prefixes \
-undef -D__DTS__ $(3) \ -undef -D__DTS__ $(3) \
-o $(2).tmp $(1) -o $(2).tmp $(1)
$(LINUX_DIR)/scripts/dtc/dtc -O dtb \ $(LINUX_DIR)/scripts/dtc/dtc -O dtb \
-i$(dir $(1)) $(4) \ -i$(dir $(1)) $(DTC_FLAGS) $(4) \
$(if $(CONFIG_HAS_DT_OVERLAY_SUPPORT),-@) \ $(if $(CONFIG_HAS_DT_OVERLAY_SUPPORT),-@) \
-o $(2) $(2).tmp -o $(2) $(2).tmp
$(RM) $(2).tmp $(RM) $(2).tmp
endef endef
define Image/BuildDTB
$(call Image/BuildDTB/sub,$(1),$(2),$(3),$(DTC_FLAGS) $(DEVICE_DTC_FLAGS) $(4))
endef
define Image/BuildDTBO
$(call Image/BuildDTB/sub,$(1),$(2),$(3),$(DTCO_FLAGS) $(DEVICE_DTCO_FLAGS) $(4))
endef
define Image/mkfs/jffs2/sub-raw define Image/mkfs/jffs2/sub-raw
$(STAGING_DIR_HOST)/bin/mkfs.jffs2 \ $(STAGING_DIR_HOST)/bin/mkfs.jffs2 \
$(2) \ $(2) \
@ -234,7 +229,8 @@ $(eval $(foreach S,$(NAND_BLOCKSIZE),$(call Image/mkfs/jffs2-nand/template,$(S))
define Image/mkfs/squashfs-common define Image/mkfs/squashfs-common
$(STAGING_DIR_HOST)/bin/mksquashfs4 $(call mkfs_target_dir,$(1)) $@ \ $(STAGING_DIR_HOST)/bin/mksquashfs4 $(call mkfs_target_dir,$(1)) $@ \
-nopad -noappend -root-owned \ -nopad -noappend -root-owned \
-comp $(SQUASHFSCOMP) $(SQUASHFSOPT) -comp $(SQUASHFSCOMP) $(SQUASHFSOPT) \
-processors $(shell nproc)
endef endef
ifeq ($(CONFIG_TARGET_ROOTFS_SECURITY_LABELS),y) ifeq ($(CONFIG_TARGET_ROOTFS_SECURITY_LABELS),y)
@ -345,8 +341,6 @@ define Device/InitProfile
DEVICE_ALT0_TITLE = $$(DEVICE_ALT0_VENDOR) $$(DEVICE_ALT0_MODEL)$$(if $$(DEVICE_ALT0_VARIANT), $$(DEVICE_ALT0_VARIANT)) DEVICE_ALT0_TITLE = $$(DEVICE_ALT0_VENDOR) $$(DEVICE_ALT0_MODEL)$$(if $$(DEVICE_ALT0_VARIANT), $$(DEVICE_ALT0_VARIANT))
DEVICE_ALT1_TITLE = $$(DEVICE_ALT1_VENDOR) $$(DEVICE_ALT1_MODEL)$$(if $$(DEVICE_ALT1_VARIANT), $$(DEVICE_ALT1_VARIANT)) DEVICE_ALT1_TITLE = $$(DEVICE_ALT1_VENDOR) $$(DEVICE_ALT1_MODEL)$$(if $$(DEVICE_ALT1_VARIANT), $$(DEVICE_ALT1_VARIANT))
DEVICE_ALT2_TITLE = $$(DEVICE_ALT2_VENDOR) $$(DEVICE_ALT2_MODEL)$$(if $$(DEVICE_ALT2_VARIANT), $$(DEVICE_ALT2_VARIANT)) DEVICE_ALT2_TITLE = $$(DEVICE_ALT2_VENDOR) $$(DEVICE_ALT2_MODEL)$$(if $$(DEVICE_ALT2_VARIANT), $$(DEVICE_ALT2_VARIANT))
DEVICE_ALT3_TITLE = $$(DEVICE_ALT3_VENDOR) $$(DEVICE_ALT3_MODEL)$$(if $$(DEVICE_ALT3_VARIANT), $$(DEVICE_ALT3_VARIANT))
DEVICE_ALT4_TITLE = $$(DEVICE_ALT4_VENDOR) $$(DEVICE_ALT4_MODEL)$$(if $$(DEVICE_ALT4_VARIANT), $$(DEVICE_ALT4_VARIANT))
DEVICE_VENDOR := DEVICE_VENDOR :=
DEVICE_MODEL := DEVICE_MODEL :=
DEVICE_VARIANT := DEVICE_VARIANT :=
@ -359,12 +353,6 @@ define Device/InitProfile
DEVICE_ALT2_VENDOR := DEVICE_ALT2_VENDOR :=
DEVICE_ALT2_MODEL := DEVICE_ALT2_MODEL :=
DEVICE_ALT2_VARIANT := DEVICE_ALT2_VARIANT :=
DEVICE_ALT3_VENDOR :=
DEVICE_ALT3_MODEL :=
DEVICE_ALT3_VARIANT :=
DEVICE_ALT4_VENDOR :=
DEVICE_ALT4_MODEL :=
DEVICE_ALT4_VARIANT :=
DEVICE_PACKAGES := DEVICE_PACKAGES :=
DEVICE_DESCRIPTION = Build firmware images for $$(DEVICE_TITLE) DEVICE_DESCRIPTION = Build firmware images for $$(DEVICE_TITLE)
endef endef
@ -379,7 +367,6 @@ define Device/Init
ARTIFACTS := ARTIFACTS :=
DEVICE_IMG_PREFIX := $(IMG_PREFIX)-$(1) DEVICE_IMG_PREFIX := $(IMG_PREFIX)-$(1)
DEVICE_IMG_NAME = $$(DEVICE_IMG_PREFIX)-$$(1)-$$(2) DEVICE_IMG_NAME = $$(DEVICE_IMG_PREFIX)-$$(1)-$$(2)
FACTORY_IMG_NAME :=
IMAGE_SIZE := IMAGE_SIZE :=
KERNEL_PREFIX = $$(DEVICE_IMG_PREFIX) KERNEL_PREFIX = $$(DEVICE_IMG_PREFIX)
KERNEL_SUFFIX := -kernel.bin KERNEL_SUFFIX := -kernel.bin
@ -407,19 +394,14 @@ define Device/Init
DEVICE_DTS := DEVICE_DTS :=
DEVICE_DTS_CONFIG := DEVICE_DTS_CONFIG :=
DEVICE_DTS_DELIMITER :=
DEVICE_DTS_DIR := DEVICE_DTS_DIR :=
DEVICE_DTS_LOADADDR :=
DEVICE_DTS_OVERLAY := DEVICE_DTS_OVERLAY :=
DEVICE_FDT_NUM := DEVICE_FDT_NUM :=
DEVICE_DTC_FLAGS :=
DEVICE_DTCO_FLAGS :=
SOC := SOC :=
BOARD_NAME := BOARD_NAME :=
UIMAGE_MAGIC := UIMAGE_MAGIC :=
UIMAGE_NAME := UIMAGE_NAME :=
UIMAGE_TIME :=
DEVICE_COMPAT_VERSION := 1.0 DEVICE_COMPAT_VERSION := 1.0
DEVICE_COMPAT_MESSAGE := DEVICE_COMPAT_MESSAGE :=
SUPPORTED_DEVICES := $(subst _,$(comma),$(1)) SUPPORTED_DEVICES := $(subst _,$(comma),$(1))
@ -436,20 +418,16 @@ endef
DEFAULT_DEVICE_VARS := \ DEFAULT_DEVICE_VARS := \
DEVICE_NAME KERNEL KERNEL_INITRAMFS KERNEL_INITRAMFS_IMAGE KERNEL_SIZE \ DEVICE_NAME KERNEL KERNEL_INITRAMFS KERNEL_INITRAMFS_IMAGE KERNEL_SIZE \
CMDLINE UBOOTENV_IN_UBI KERNEL_IN_UBI BLOCKSIZE PAGESIZE SUBPAGESIZE \ CMDLINE UBOOTENV_IN_UBI KERNEL_IN_UBI BLOCKSIZE PAGESIZE SUBPAGESIZE \
VID_HDR_OFFSET UBINIZE_OPTS UBINIZE_PARTS MKUBIFS_OPTS DEVICE_DTC_FLAGS \ VID_HDR_OFFSET UBINIZE_OPTS UBINIZE_PARTS MKUBIFS_OPTS DEVICE_DTS \
DEVICE_DTCO_FLAGS DEVICE_DTS DEVICE_DTS_CONFIG DEVICE_DTS_DELIMITER \ DEVICE_DTS_CONFIG DEVICE_DTS_DIR DEVICE_DTS_OVERLAY DEVICE_FDT_NUM \
DEVICE_DTS_DIR DEVICE_DTS_OVERLAY DEVICE_DTS_LOADADDR \ DEVICE_IMG_PREFIX SOC BOARD_NAME UIMAGE_MAGIC UIMAGE_NAME \
DEVICE_FDT_NUM DEVICE_IMG_PREFIX SOC BOARD_NAME UIMAGE_MAGIC UIMAGE_NAME \ SUPPORTED_DEVICES IMAGE_METADATA KERNEL_ENTRY KERNEL_LOADADDR \
UIMAGE_TIME SUPPORTED_DEVICES IMAGE_METADATA KERNEL_ENTRY KERNEL_LOADADDR \
UBOOT_PATH IMAGE_SIZE \ UBOOT_PATH IMAGE_SIZE \
FACTORY_IMG_NAME FACTORY_SIZE \
DEVICE_PACKAGES DEVICE_COMPAT_VERSION DEVICE_COMPAT_MESSAGE \ DEVICE_PACKAGES DEVICE_COMPAT_VERSION DEVICE_COMPAT_MESSAGE \
DEVICE_VENDOR DEVICE_MODEL DEVICE_VARIANT \ DEVICE_VENDOR DEVICE_MODEL DEVICE_VARIANT \
DEVICE_ALT0_VENDOR DEVICE_ALT0_MODEL DEVICE_ALT0_VARIANT \ DEVICE_ALT0_VENDOR DEVICE_ALT0_MODEL DEVICE_ALT0_VARIANT \
DEVICE_ALT1_VENDOR DEVICE_ALT1_MODEL DEVICE_ALT1_VARIANT \ DEVICE_ALT1_VENDOR DEVICE_ALT1_MODEL DEVICE_ALT1_VARIANT \
DEVICE_ALT2_VENDOR DEVICE_ALT2_MODEL DEVICE_ALT2_VARIANT \ DEVICE_ALT2_VENDOR DEVICE_ALT2_MODEL DEVICE_ALT2_VARIANT
DEVICE_ALT3_VENDOR DEVICE_ALT3_MODEL DEVICE_ALT3_VARIANT \
DEVICE_ALT4_VENDOR DEVICE_ALT4_MODEL DEVICE_ALT4_VARIANT
define Device/ExportVar define Device/ExportVar
$(1) : $(2):=$$($(2)) $(1) : $(2):=$$($(2))
@ -502,9 +480,6 @@ define Device/Build/initramfs
$(KDIR)/$$(KERNEL_INITRAMFS_NAME):: image_prepare $(KDIR)/$$(KERNEL_INITRAMFS_NAME):: image_prepare
$(1)-images: $$(if $$(KERNEL_INITRAMFS),$(BIN_DIR)/$$(KERNEL_INITRAMFS_IMAGE)) $(1)-images: $$(if $$(KERNEL_INITRAMFS),$(BIN_DIR)/$$(KERNEL_INITRAMFS_IMAGE))
.IGNORE: $(BIN_DIR)/$$(KERNEL_INITRAMFS_IMAGE)
$(BIN_DIR)/$$(KERNEL_INITRAMFS_IMAGE): $(KDIR)/tmp/$$(KERNEL_INITRAMFS_IMAGE) $(BIN_DIR)/$$(KERNEL_INITRAMFS_IMAGE): $(KDIR)/tmp/$$(KERNEL_INITRAMFS_IMAGE)
cp $$^ $$@ cp $$^ $$@
@ -517,11 +492,11 @@ define Device/Build/initramfs
$(BUILD_DIR)/json_info_files/$$(KERNEL_INITRAMFS_IMAGE).json: $(BIN_DIR)/$$(KERNEL_INITRAMFS_IMAGE) $(BUILD_DIR)/json_info_files/$$(KERNEL_INITRAMFS_IMAGE).json: $(BIN_DIR)/$$(KERNEL_INITRAMFS_IMAGE)
@mkdir -p $$(shell dirname $$@) @mkdir -p $$(shell dirname $$@)
DEVICE_ID="$(1)" \ DEVICE_ID="$(1)" \
BIN_DIR="$(BIN_DIR)" \
SOURCE_DATE_EPOCH=$(SOURCE_DATE_EPOCH) \ SOURCE_DATE_EPOCH=$(SOURCE_DATE_EPOCH) \
FILE_NAME="$$(notdir $$^)" \ DEVICE_IMG_NAME="$$(notdir $$^)" \
FILE_DIR="$(KDIR)/tmp" \ IMAGE_TYPE="kernel" \
FILE_TYPE="kernel" \ IMAGE_FILESYSTEM="initramfs" \
FILE_FILESYSTEM="initramfs" \
DEVICE_IMG_PREFIX="$$(DEVICE_IMG_PREFIX)" \ DEVICE_IMG_PREFIX="$$(DEVICE_IMG_PREFIX)" \
DEVICE_VENDOR="$$(DEVICE_VENDOR)" \ DEVICE_VENDOR="$$(DEVICE_VENDOR)" \
DEVICE_MODEL="$$(DEVICE_MODEL)" \ DEVICE_MODEL="$$(DEVICE_MODEL)" \
@ -535,12 +510,6 @@ define Device/Build/initramfs
DEVICE_ALT2_VENDOR="$$(DEVICE_ALT2_VENDOR)" \ DEVICE_ALT2_VENDOR="$$(DEVICE_ALT2_VENDOR)" \
DEVICE_ALT2_MODEL="$$(DEVICE_ALT2_MODEL)" \ DEVICE_ALT2_MODEL="$$(DEVICE_ALT2_MODEL)" \
DEVICE_ALT2_VARIANT="$$(DEVICE_ALT2_VARIANT)" \ DEVICE_ALT2_VARIANT="$$(DEVICE_ALT2_VARIANT)" \
DEVICE_ALT3_VENDOR="$$(DEVICE_ALT3_VENDOR)" \
DEVICE_ALT3_MODEL="$$(DEVICE_ALT3_MODEL)" \
DEVICE_ALT3_VARIANT="$$(DEVICE_ALT3_VARIANT)" \
DEVICE_ALT4_VENDOR="$$(DEVICE_ALT4_VENDOR)" \
DEVICE_ALT4_MODEL="$$(DEVICE_ALT4_MODEL)" \
DEVICE_ALT4_VARIANT="$$(DEVICE_ALT4_VARIANT)" \
DEVICE_TITLE="$$(DEVICE_TITLE)" \ DEVICE_TITLE="$$(DEVICE_TITLE)" \
DEVICE_PACKAGES="$$(DEVICE_PACKAGES)" \ DEVICE_PACKAGES="$$(DEVICE_PACKAGES)" \
TARGET="$(BOARD)" \ TARGET="$(BOARD)" \
@ -555,8 +524,7 @@ endif
define Device/Build/compile define Device/Build/compile
$$(_COMPILE_TARGET): $(KDIR)/$(1) $$(_COMPILE_TARGET): $(KDIR)/$(1)
$(eval $(call Device/Export,$(KDIR)/$(1))) $(eval $(call Device/Export,$(KDIR)/$(1)))
$(KDIR)/$(1): FORCE $(KDIR)/$(1):
rm -f $(KDIR)/$(1)
$$(call concat_cmd,$(COMPILE/$(1))) $$(call concat_cmd,$(COMPILE/$(1)))
endef endef
@ -568,36 +536,19 @@ define Device/Build/dtb
$(KDIR)/image-$(1).dtb: FORCE $(KDIR)/image-$(1).dtb: FORCE
$(call Image/BuildDTB,$(strip $(2))/$(strip $(3)).dts,$$@) $(call Image/BuildDTB,$(strip $(2))/$(strip $(3)).dts,$$@)
compile-dtb: $(KDIR)/image-$(1).dtb image_prepare: $(KDIR)/image-$(1).dtb
endif
endef
define Device/Build/dtbo
ifndef BUILD_DTSO_$(1)
BUILD_DTSO_$(1) := 1
$(KDIR)/image-$(1).dtbo: FORCE
$(call Image/BuildDTBO,$(strip $(2))/$(strip $(3)).dtso,$$@)
compile-dtb: $(KDIR)/image-$(1).dtbo
endif endif
endef endef
endif endif
define Device/Build/kernel define Device/Build/kernel
$$(eval $$(foreach dts,$$(DEVICE_DTS), \ $$(eval $$(foreach dts,$$(DEVICE_DTS) $$(DEVICE_DTS_OVERLAY), \
$$(call Device/Build/dtb,$$(notdir $$(dts)), \ $$(call Device/Build/dtb,$$(notdir $$(dts)), \
$$(if $$(DEVICE_DTS_DIR),$$(DEVICE_DTS_DIR),$$(DTS_DIR)), \ $$(if $$(DEVICE_DTS_DIR),$$(DEVICE_DTS_DIR),$$(DTS_DIR)), \
$$(dts) \ $$(dts) \
) \ ) \
)) ))
$$(eval $$(foreach dtso,$$(DEVICE_DTS_OVERLAY), \
$$(call Device/Build/dtbo,$$(notdir $$(dtso)), \
$$(if $$(DEVICE_DTS_DIR),$$(DEVICE_DTS_DIR),$$(DTS_DIR)), \
$$(dtso) \
) \
))
$(KDIR)/$$(KERNEL_NAME):: image_prepare $(KDIR)/$$(KERNEL_NAME):: image_prepare
$$(_TARGET): $$(if $$(KERNEL_INSTALL),$(BIN_DIR)/$$(KERNEL_IMAGE)) $$(_TARGET): $$(if $$(KERNEL_INSTALL),$(BIN_DIR)/$$(KERNEL_IMAGE))
@ -648,11 +599,11 @@ define Device/Build/image
$(BUILD_DIR)/json_info_files/$(call DEVICE_IMG_NAME,$(1),$(2)).json: $(BIN_DIR)/$(call DEVICE_IMG_NAME,$(1),$(2))$$(GZ_SUFFIX) $(BUILD_DIR)/json_info_files/$(call DEVICE_IMG_NAME,$(1),$(2)).json: $(BIN_DIR)/$(call DEVICE_IMG_NAME,$(1),$(2))$$(GZ_SUFFIX)
@mkdir -p $$(shell dirname $$@) @mkdir -p $$(shell dirname $$@)
DEVICE_ID="$(DEVICE_NAME)" \ DEVICE_ID="$(DEVICE_NAME)" \
BIN_DIR="$(BIN_DIR)" \
SOURCE_DATE_EPOCH=$(SOURCE_DATE_EPOCH) \ SOURCE_DATE_EPOCH=$(SOURCE_DATE_EPOCH) \
FILE_NAME="$(DEVICE_IMG_NAME)" \ DEVICE_IMG_NAME="$(DEVICE_IMG_NAME)" \
FILE_DIR="$(KDIR)/tmp" \ IMAGE_TYPE=$(word 1,$(subst ., ,$(2))) \
FILE_TYPE=$(word 1,$(subst ., ,$(2))) \ IMAGE_FILESYSTEM="$(1)" \
FILE_FILESYSTEM="$(1)" \
DEVICE_IMG_PREFIX="$(DEVICE_IMG_PREFIX)" \ DEVICE_IMG_PREFIX="$(DEVICE_IMG_PREFIX)" \
DEVICE_VENDOR="$(DEVICE_VENDOR)" \ DEVICE_VENDOR="$(DEVICE_VENDOR)" \
DEVICE_MODEL="$(DEVICE_MODEL)" \ DEVICE_MODEL="$(DEVICE_MODEL)" \
@ -666,12 +617,6 @@ define Device/Build/image
DEVICE_ALT2_VENDOR="$(DEVICE_ALT2_VENDOR)" \ DEVICE_ALT2_VENDOR="$(DEVICE_ALT2_VENDOR)" \
DEVICE_ALT2_MODEL="$(DEVICE_ALT2_MODEL)" \ DEVICE_ALT2_MODEL="$(DEVICE_ALT2_MODEL)" \
DEVICE_ALT2_VARIANT="$(DEVICE_ALT2_VARIANT)" \ DEVICE_ALT2_VARIANT="$(DEVICE_ALT2_VARIANT)" \
DEVICE_ALT3_VENDOR="$(DEVICE_ALT3_VENDOR)" \
DEVICE_ALT3_MODEL="$(DEVICE_ALT3_MODEL)" \
DEVICE_ALT3_VARIANT="$(DEVICE_ALT3_VARIANT)" \
DEVICE_ALT4_VENDOR="$(DEVICE_ALT4_VENDOR)" \
DEVICE_ALT4_MODEL="$(DEVICE_ALT4_MODEL)" \
DEVICE_ALT4_VARIANT="$(DEVICE_ALT4_VARIANT)" \
DEVICE_TITLE="$(DEVICE_TITLE)" \ DEVICE_TITLE="$(DEVICE_TITLE)" \
DEVICE_PACKAGES="$(DEVICE_PACKAGES)" \ DEVICE_PACKAGES="$(DEVICE_PACKAGES)" \
TARGET="$(BOARD)" \ TARGET="$(BOARD)" \
@ -684,9 +629,7 @@ define Device/Build/image
endef endef
define Device/Build/artifact define Device/Build/artifact
$$(_TARGET): $(if $(CONFIG_JSON_OVERVIEW_IMAGE_INFO), \ $$(_TARGET): $(BIN_DIR)/$(DEVICE_IMG_PREFIX)-$(1)
$(BUILD_DIR)/json_info_files/$(DEVICE_IMG_PREFIX)-$(1).json, \
$(BIN_DIR)/$(DEVICE_IMG_PREFIX)-$(1))
$(eval $(call Device/Export,$(KDIR)/tmp/$(DEVICE_IMG_PREFIX)-$(1))) $(eval $(call Device/Export,$(KDIR)/tmp/$(DEVICE_IMG_PREFIX)-$(1)))
$(KDIR)/tmp/$(DEVICE_IMG_PREFIX)-$(1): $$(KDIR_KERNEL_IMAGE) $(2)-images $(KDIR)/tmp/$(DEVICE_IMG_PREFIX)-$(1): $$(KDIR_KERNEL_IMAGE) $(2)-images
@rm -f $$@ @rm -f $$@
@ -697,41 +640,6 @@ define Device/Build/artifact
$(BIN_DIR)/$(DEVICE_IMG_PREFIX)-$(1): $(KDIR)/tmp/$(DEVICE_IMG_PREFIX)-$(1) $(BIN_DIR)/$(DEVICE_IMG_PREFIX)-$(1): $(KDIR)/tmp/$(DEVICE_IMG_PREFIX)-$(1)
cp $$^ $$@ cp $$^ $$@
$(BUILD_DIR)/json_info_files/$(DEVICE_IMG_PREFIX)-$(1).json: $(BIN_DIR)/$(DEVICE_IMG_PREFIX)-$(1)
@mkdir -p $$(shell dirname $$@)
DEVICE_ID="$(DEVICE_NAME)" \
SOURCE_DATE_EPOCH=$(SOURCE_DATE_EPOCH) \
FILE_NAME="$(DEVICE_IMG_PREFIX)-$(1)" \
FILE_DIR="$(KDIR)/tmp" \
FILE_TYPE="$(1)" \
DEVICE_IMG_PREFIX="$(DEVICE_IMG_PREFIX)" \
DEVICE_VENDOR="$(DEVICE_VENDOR)" \
DEVICE_MODEL="$(DEVICE_MODEL)" \
DEVICE_VARIANT="$(DEVICE_VARIANT)" \
DEVICE_ALT0_VENDOR="$(DEVICE_ALT0_VENDOR)" \
DEVICE_ALT0_MODEL="$(DEVICE_ALT0_MODEL)" \
DEVICE_ALT0_VARIANT="$(DEVICE_ALT0_VARIANT)" \
DEVICE_ALT1_VENDOR="$(DEVICE_ALT1_VENDOR)" \
DEVICE_ALT1_MODEL="$(DEVICE_ALT1_MODEL)" \
DEVICE_ALT1_VARIANT="$(DEVICE_ALT1_VARIANT)" \
DEVICE_ALT2_VENDOR="$(DEVICE_ALT2_VENDOR)" \
DEVICE_ALT2_MODEL="$(DEVICE_ALT2_MODEL)" \
DEVICE_ALT2_VARIANT="$(DEVICE_ALT2_VARIANT)" \
DEVICE_ALT3_VENDOR="$(DEVICE_ALT3_VENDOR)" \
DEVICE_ALT3_MODEL="$(DEVICE_ALT3_MODEL)" \
DEVICE_ALT3_VARIANT="$(DEVICE_ALT3_VARIANT)" \
DEVICE_ALT4_VENDOR="$(DEVICE_ALT4_VENDOR)" \
DEVICE_ALT4_MODEL="$(DEVICE_ALT4_MODEL)" \
DEVICE_ALT4_VARIANT="$(DEVICE_ALT4_VARIANT)" \
DEVICE_TITLE="$(DEVICE_TITLE)" \
DEVICE_PACKAGES="$(DEVICE_PACKAGES)" \
TARGET="$(BOARD)" \
SUBTARGET="$(if $(SUBTARGET),$(SUBTARGET),generic)" \
VERSION_NUMBER="$(VERSION_NUMBER)" \
VERSION_CODE="$(VERSION_CODE)" \
SUPPORTED_DEVICES="$(SUPPORTED_DEVICES)" \
$(TOPDIR)/scripts/json_add_image_info.py $$@
endef endef
define Device/Build define Device/Build
@ -764,8 +672,6 @@ $(if $(strip $(DEVICE_ALT0_TITLE)),Alternative device titles:
- $(DEVICE_ALT0_TITLE)) - $(DEVICE_ALT0_TITLE))
$(if $(strip $(DEVICE_ALT1_TITLE)),- $(DEVICE_ALT1_TITLE)) $(if $(strip $(DEVICE_ALT1_TITLE)),- $(DEVICE_ALT1_TITLE))
$(if $(strip $(DEVICE_ALT2_TITLE)),- $(DEVICE_ALT2_TITLE)) $(if $(strip $(DEVICE_ALT2_TITLE)),- $(DEVICE_ALT2_TITLE))
$(if $(strip $(DEVICE_ALT3_TITLE)),- $(DEVICE_ALT3_TITLE))
$(if $(strip $(DEVICE_ALT4_TITLE)),- $(DEVICE_ALT4_TITLE))
@@ @@
endef endef
@ -783,14 +689,6 @@ ifneq ($$(strip $$(DEVICE_ALT2_TITLE)),)
DEVICE_DISPLAY = $$(DEVICE_ALT2_TITLE) ($$(DEVICE_TITLE)) DEVICE_DISPLAY = $$(DEVICE_ALT2_TITLE) ($$(DEVICE_TITLE))
$$(info $$(call Device/DumpInfo,$(1))) $$(info $$(call Device/DumpInfo,$(1)))
endif endif
ifneq ($$(strip $$(DEVICE_ALT3_TITLE)),)
DEVICE_DISPLAY = $$(DEVICE_ALT3_TITLE) ($$(DEVICE_TITLE))
$$(info $$(call Device/DumpInfo,$(1)))
endif
ifneq ($$(strip $$(DEVICE_ALT4_TITLE)),)
DEVICE_DISPLAY = $$(DEVICE_ALT4_TITLE) ($$(DEVICE_TITLE))
$$(info $$(call Device/DumpInfo,$(1)))
endif
DEVICE_DISPLAY = $$(DEVICE_TITLE) DEVICE_DISPLAY = $$(DEVICE_TITLE)
$$(eval $$(if $$(DEVICE_TITLE),$$(info $$(call Device/DumpInfo,$(1))))) $$(eval $$(if $$(DEVICE_TITLE),$$(info $$(call Device/DumpInfo,$(1)))))
endef endef
@ -816,27 +714,24 @@ define BuildImage
download: download:
prepare: prepare:
compile: compile:
compile-dtb:
clean: clean:
image_prepare: image_prepare:
ifeq ($(IB),) ifeq ($(IB),)
.PHONY: download prepare compile compile-dtb clean image_prepare kernel_prepare install install-images .PHONY: download prepare compile clean image_prepare kernel_prepare install install-images
compile: compile:
$(call Build/Compile) $(call Build/Compile)
clean: clean:
$(call Build/Clean) $(call Build/Clean)
compile-dtb: image_prepare: compile
image_prepare: compile compile-dtb
mkdir -p $(BIN_DIR) $(KDIR)/tmp mkdir -p $(BIN_DIR) $(KDIR)/tmp
rm -rf $(BUILD_DIR)/json_info_files rm -rf $(BUILD_DIR)/json_info_files
$(call Image/Prepare) $(call Image/Prepare)
else else
image_prepare: image_prepare:
rm -rf $(KDIR)/tmp
mkdir -p $(BIN_DIR) $(KDIR)/tmp mkdir -p $(BIN_DIR) $(KDIR)/tmp
endif endif

View File

@ -1,2 +1,2 @@
LINUX_VERSION-5.10 = .236 LINUX_VERSION-5.10 = .127
LINUX_KERNEL_HASH-5.10.236 = 6da5cc8f7d39ed3acb4d59129a3f1570d981526ebbf58ea82595b7b6e000fb89 LINUX_KERNEL_HASH-5.10.127 = 419233ee0b1ee1dc2be8abf1b241545d10dad19d95f237180d6ccdc0cd221580

View File

@ -1,2 +1,2 @@
LINUX_VERSION-5.15 = .180 LINUX_VERSION-5.15 = .55
LINUX_KERNEL_HASH-5.15.180 = f51f68b8bbe60aca5e1ff3781f7e5d2ca6a31dd299c8446c39bf880bfff1cd39 LINUX_KERNEL_HASH-5.15.55 = 1ef6bd508b6c3af3bef2d5b337e4477254dba284c79e329aa38f9763ae3bfdcc

2
include/kernel-5.18 Normal file
View File

@ -0,0 +1,2 @@
LINUX_VERSION-5.18 = .12
LINUX_KERNEL_HASH-5.18.12 = 40b74d0942f255da07481710e1083412d06e37e45b8f9d9e34ae856db37b9527

View File

@ -1,2 +1,2 @@
LINUX_VERSION-5.4 = .292 LINUX_VERSION-5.4 = .203
LINUX_KERNEL_HASH-5.4.292 = 0bcbf580d1ea623ac5879d0f2d69796c82431b3f653c4749e63766dbf737be85 LINUX_KERNEL_HASH-5.4.203 = fc933f5b13066cfa54aacb5e86747a167bad1d8d23972e4a03ab5ee36c29798a

View File

@ -1,2 +0,0 @@
LINUX_VERSION-6.1 = .134
LINUX_KERNEL_HASH-6.1.134 = 60c70cdd70ddee384c004242e67844e3dd1fe28f75b26b3586859fff0a07bd23

View File

@ -1,2 +0,0 @@
LINUX_VERSION-6.12 = .23
LINUX_KERNEL_HASH-6.12.23 = d8d95404f8deeb7ff6992c0df855025062e9e8182bca6daa27ef2e9275d27749

View File

@ -1,2 +0,0 @@
LINUX_VERSION-6.6 = .87
LINUX_KERNEL_HASH-6.6.87 = 8957e5c2dacdbc47a16dbf1f6303ca7088409be6197a3881f752313275357ac6

View File

@ -10,7 +10,7 @@ ifneq ($(DUMP),1)
endif endif
KERNEL_FILE_DEPENDS=$(GENERIC_BACKPORT_DIR) $(GENERIC_PATCH_DIR) $(GENERIC_HACK_DIR) $(PATCH_DIR) $(GENERIC_FILES_DIR) $(FILES_DIR) KERNEL_FILE_DEPENDS=$(GENERIC_BACKPORT_DIR) $(GENERIC_PATCH_DIR) $(GENERIC_HACK_DIR) $(PATCH_DIR) $(GENERIC_FILES_DIR) $(FILES_DIR)
STAMP_PREPARED=$(LINUX_DIR)/.prepared$(if $(QUILT)$(DUMP),,_$(shell $(call $(if $(CONFIG_AUTOREMOVE),find_md5_reproducible,find_md5),$(KERNEL_FILE_DEPENDS),))) STAMP_PREPARED=$(LINUX_DIR)/.prepared$(if $(QUILT)$(DUMP),,_$(shell $(call find_md5,$(KERNEL_FILE_DEPENDS),)))
STAMP_CONFIGURED:=$(LINUX_DIR)/.configured STAMP_CONFIGURED:=$(LINUX_DIR)/.configured
include $(INCLUDE_DIR)/download.mk include $(INCLUDE_DIR)/download.mk
include $(INCLUDE_DIR)/quilt.mk include $(INCLUDE_DIR)/quilt.mk
@ -156,10 +156,6 @@ define BuildKernel
compile: $(LINUX_DIR)/.modules compile: $(LINUX_DIR)/.modules
$(MAKE) -C image compile TARGET_BUILD= $(MAKE) -C image compile TARGET_BUILD=
dtb: $(STAMP_CONFIGURED)
$(_SINGLE)$(KERNEL_MAKE) scripts_dtc
$(MAKE) -C image compile-dtb TARGET_BUILD=
oldconfig menuconfig nconfig xconfig: $(STAMP_PREPARED) $(STAMP_CHECKED) FORCE oldconfig menuconfig nconfig xconfig: $(STAMP_PREPARED) $(STAMP_CHECKED) FORCE
rm -f $(LINUX_DIR)/.config.prev rm -f $(LINUX_DIR)/.config.prev
rm -f $(STAMP_CONFIGURED) rm -f $(STAMP_CONFIGURED)

View File

@ -21,7 +21,7 @@ Kernel/Patch:=$(Kernel/Patch/Default)
ifneq (,$(findstring .xz,$(LINUX_SOURCE))) ifneq (,$(findstring .xz,$(LINUX_SOURCE)))
LINUX_CAT:=xzcat LINUX_CAT:=xzcat
else else
LINUX_CAT:=$(STAGING_DIR_HOST)/bin/libdeflate-gzip -dc LINUX_CAT:=gzip -dc
endif endif
ifeq ($(strip $(CONFIG_EXTERNAL_KERNEL_TREE)),"") ifeq ($(strip $(CONFIG_EXTERNAL_KERNEL_TREE)),"")
@ -75,7 +75,6 @@ endif
rm -f $(LINUX_DIR)/.config.prev rm -f $(LINUX_DIR)/.config.prev
mv $(LINUX_DIR)/.config $(LINUX_DIR)/.config.old mv $(LINUX_DIR)/.config $(LINUX_DIR)/.config.old
$(call Kernel/SetInitramfs/PreConfigure) $(call Kernel/SetInitramfs/PreConfigure)
echo "# CONFIG_INITRAMFS_PRESERVE_MTIME is not set" >> $(LINUX_DIR)/.config
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS_SEPARATE),y) ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS_SEPARATE),y)
echo 'CONFIG_INITRAMFS_ROOT_UID=$(shell id -u)' >> $(LINUX_DIR)/.config echo 'CONFIG_INITRAMFS_ROOT_UID=$(shell id -u)' >> $(LINUX_DIR)/.config
echo 'CONFIG_INITRAMFS_ROOT_GID=$(shell id -g)' >> $(LINUX_DIR)/.config echo 'CONFIG_INITRAMFS_ROOT_GID=$(shell id -g)' >> $(LINUX_DIR)/.config
@ -100,7 +99,6 @@ define Kernel/SetNoInitramfs
grep -v INITRAMFS $(LINUX_DIR)/.config.old > $(LINUX_DIR)/.config.set grep -v INITRAMFS $(LINUX_DIR)/.config.old > $(LINUX_DIR)/.config.set
echo 'CONFIG_INITRAMFS_SOURCE=""' >> $(LINUX_DIR)/.config.set echo 'CONFIG_INITRAMFS_SOURCE=""' >> $(LINUX_DIR)/.config.set
echo '# CONFIG_INITRAMFS_FORCE is not set' >> $(LINUX_DIR)/.config.set echo '# CONFIG_INITRAMFS_FORCE is not set' >> $(LINUX_DIR)/.config.set
echo "# CONFIG_INITRAMFS_PRESERVE_MTIME is not set" >> $(LINUX_DIR)/.config.set
endef endef
define Kernel/Configure/Default define Kernel/Configure/Default
@ -119,7 +117,7 @@ define Kernel/Configure/Default
cp $(LINUX_DIR)/.config.set $(LINUX_DIR)/.config; \ cp $(LINUX_DIR)/.config.set $(LINUX_DIR)/.config; \
cp $(LINUX_DIR)/.config.set $(LINUX_DIR)/.config.prev; \ cp $(LINUX_DIR)/.config.set $(LINUX_DIR)/.config.prev; \
} }
$(_SINGLE) [ -d $(LINUX_DIR)/user_headers ] || $(KERNEL_MAKE) $(if $(findstring uml,$(BOARD)),ARCH=$(ARCH)) INSTALL_HDR_PATH=$(LINUX_DIR)/user_headers headers_install $(_SINGLE) [ -d $(LINUX_DIR)/user_headers ] || $(KERNEL_MAKE) INSTALL_HDR_PATH=$(LINUX_DIR)/user_headers headers_install
grep '=[ym]' $(LINUX_DIR)/.config.set | LC_ALL=C sort | $(MKHASH) md5 > $(LINUX_DIR)/.vermagic grep '=[ym]' $(LINUX_DIR)/.config.set | LC_ALL=C sort | $(MKHASH) md5 > $(LINUX_DIR)/.vermagic
endef endef
@ -131,10 +129,6 @@ define Kernel/CompileModules/Default
rm -f $(LINUX_DIR)/vmlinux $(LINUX_DIR)/System.map rm -f $(LINUX_DIR)/vmlinux $(LINUX_DIR)/System.map
+$(KERNEL_MAKE) olddefconfig +$(KERNEL_MAKE) olddefconfig
+$(KERNEL_MAKE) $(if $(KERNELNAME),$(KERNELNAME),all) modules +$(KERNEL_MAKE) $(if $(KERNELNAME),$(KERNELNAME),all) modules
# If .config did not change, use the previous timestamp to avoid package rebuilds
cmp -s $(LINUX_DIR)/.config $(LINUX_DIR)/.config.modules.save && \
mv $(LINUX_DIR)/.config.modules.save $(LINUX_DIR)/.config; \
$(CP) $(LINUX_DIR)/.config $(LINUX_DIR)/.config.modules.save
endef endef
OBJCOPY_STRIP = -R .reginfo -R .notes -R .note -R .comment -R .mdebug -R .note.gnu.build-id OBJCOPY_STRIP = -R .reginfo -R .notes -R .note -R .comment -R .mdebug -R .note.gnu.build-id
@ -171,21 +165,20 @@ ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
define Kernel/CompileImage/Initramfs define Kernel/CompileImage/Initramfs
$(call Kernel/Configure/Initramfs) $(call Kernel/Configure/Initramfs)
$(CP) $(GENERIC_PLATFORM_DIR)/other-files/init $(TARGET_DIR)/init $(CP) $(GENERIC_PLATFORM_DIR)/other-files/init $(TARGET_DIR)/init
$(if $(SOURCE_DATE_EPOCH),touch -hcd "@$(SOURCE_DATE_EPOCH)" $(TARGET_DIR) $(TARGET_DIR)/init) $(if $(SOURCE_DATE_EPOCH),touch -hcd "@$(SOURCE_DATE_EPOCH)" $(TARGET_DIR)/init)
rm -rf $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)/usr/initramfs_data.cpio* rm -rf $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)/usr/initramfs_data.cpio*
ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS_SEPARATE),y) ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS_SEPARATE),y)
ifneq ($(qstrip $(CONFIG_EXTERNAL_CPIO)),) ifeq ($(CONFIG_EXTERNAL_CPIO),y)
$(CP) $(CONFIG_EXTERNAL_CPIO) $(KERNEL_BUILD_DIR)/initrd.cpio $(CP) $(CONFIG_EXTERNAL_CPIO) $(KERNEL_BUILD_DIR)/initrd.cpio
else else
( cd $(TARGET_DIR); find . | LC_ALL=C sort | $(STAGING_DIR_HOST)/bin/cpio --reproducible -o -H newc -R 0:0 > $(KERNEL_BUILD_DIR)/initrd.cpio ) ( cd $(TARGET_DIR); find . | $(STAGING_DIR_HOST)/bin/cpio -o -H newc -R 0:0 > $(KERNEL_BUILD_DIR)/initrd.cpio )
endif endif
$(if $(SOURCE_DATE_EPOCH),touch -hcd "@$(SOURCE_DATE_EPOCH)" $(KERNEL_BUILD_DIR)/initrd.cpio)
$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_BZIP2),bzip2 -9 -c < $(KERNEL_BUILD_DIR)/initrd.cpio > $(KERNEL_BUILD_DIR)/initrd.cpio.bzip2) $(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_BZIP2),bzip2 -9 -c < $(KERNEL_BUILD_DIR)/initrd.cpio > $(KERNEL_BUILD_DIR)/initrd.cpio.bzip2)
$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_GZIP),gzip -n -f -S .gzip -9n $(KERNEL_BUILD_DIR)/initrd.cpio) $(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_GZIP),gzip -f -S .gzip -9n $(KERNEL_BUILD_DIR)/initrd.cpio)
$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZ4),$(STAGING_DIR_HOST)/bin/lz4c -l -c1 -fz --favor-decSpeed $(KERNEL_BUILD_DIR)/initrd.cpio)
$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZMA),$(STAGING_DIR_HOST)/bin/lzma e -lc1 -lp2 -pb2 $(KERNEL_BUILD_DIR)/initrd.cpio $(KERNEL_BUILD_DIR)/initrd.cpio.lzma) $(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZMA),$(STAGING_DIR_HOST)/bin/lzma e -lc1 -lp2 -pb2 $(KERNEL_BUILD_DIR)/initrd.cpio $(KERNEL_BUILD_DIR)/initrd.cpio.lzma)
$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZO),$(STAGING_DIR_HOST)/bin/lzop -9 -f $(KERNEL_BUILD_DIR)/initrd.cpio) # ? $(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZO),)
$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_XZ),$(STAGING_DIR_HOST)/bin/xz -T$(if $(filter 1,$(NPROC)),2,0) -9 -fz --check=crc32 $(KERNEL_BUILD_DIR)/initrd.cpio) $(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_XZ),$(STAGING_DIR_HOST)/bin/xz -9 -fz --check=crc32 $(KERNEL_BUILD_DIR)/initrd.cpio)
# ? $(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZ4),)
$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_ZSTD),$(STAGING_DIR_HOST)/bin/zstd -T0 -f -o $(KERNEL_BUILD_DIR)/initrd.cpio.zstd $(KERNEL_BUILD_DIR)/initrd.cpio) $(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_ZSTD),$(STAGING_DIR_HOST)/bin/zstd -T0 -f -o $(KERNEL_BUILD_DIR)/initrd.cpio.zstd $(KERNEL_BUILD_DIR)/initrd.cpio)
endif endif
+$(KERNEL_MAKE) $(KERNEL_MAKEOPTS_IMAGE) $(if $(KERNELNAME),$(KERNELNAME),all) modules +$(KERNEL_MAKE) $(KERNEL_MAKEOPTS_IMAGE) $(if $(KERNELNAME),$(KERNELNAME),all) modules

View File

@ -13,15 +13,6 @@ endif
include $(KERNEL_DETAILS_FILE) include $(KERNEL_DETAILS_FILE)
ifdef KERNEL_TESTING_PATCHVER
KERNEL_TESTING_DETAILS_FILE=$(INCLUDE_DIR)/kernel-$(KERNEL_TESTING_PATCHVER)
ifeq ($(wildcard $(KERNEL_TESTING_DETAILS_FILE)),)
$(error Missing kernel version/hash file for $(KERNEL_TESTING_PATCHVER). Please create $(KERNEL_TESTING_DETAILS_FILE))
endif
include $(KERNEL_TESTING_DETAILS_FILE)
endif
remove_uri_prefix=$(subst git://,,$(subst http://,,$(subst https://,,$(1)))) remove_uri_prefix=$(subst git://,,$(subst http://,,$(subst https://,,$(1))))
sanitize_uri=$(call qstrip,$(subst @,_,$(subst :,_,$(subst .,_,$(subst -,_,$(subst /,_,$(1))))))) sanitize_uri=$(call qstrip,$(subst @,_,$(subst :,_,$(subst .,_,$(subst -,_,$(subst /,_,$(1)))))))

View File

@ -70,7 +70,11 @@ else
LINUX_UNAME_VERSION:=$(strip $(shell cat $(LINUX_DIR)/include/config/kernel.release 2>/dev/null)) LINUX_UNAME_VERSION:=$(strip $(shell cat $(LINUX_DIR)/include/config/kernel.release 2>/dev/null))
endif endif
ifeq (,$(findstring -android,$(LINUX_VERSION)))
MODULES_SUBDIR:=lib/modules/$(LINUX_UNAME_VERSION) MODULES_SUBDIR:=lib/modules/$(LINUX_UNAME_VERSION)
else
MODULES_SUBDIR:=lib/modules/$(LINUX_UNAME_VERSION)-android
endif
TARGET_MODULES_DIR:=$(LINUX_TARGET_DIR)/$(MODULES_SUBDIR) TARGET_MODULES_DIR:=$(LINUX_TARGET_DIR)/$(MODULES_SUBDIR)
ifneq ($(TARGET_BUILD),1) ifneq ($(TARGET_BUILD),1)
@ -86,14 +90,10 @@ else ifneq (,$(findstring $(ARCH) , arceb ))
LINUX_KARCH := arc LINUX_KARCH := arc
else ifneq (,$(findstring $(ARCH) , armeb )) else ifneq (,$(findstring $(ARCH) , armeb ))
LINUX_KARCH := arm LINUX_KARCH := arm
else ifneq (,$(findstring $(ARCH) , loongarch64 ))
LINUX_KARCH := loongarch
else ifneq (,$(findstring $(ARCH) , mipsel mips64 mips64el )) else ifneq (,$(findstring $(ARCH) , mipsel mips64 mips64el ))
LINUX_KARCH := mips LINUX_KARCH := mips
else ifneq (,$(findstring $(ARCH) , powerpc64 )) else ifneq (,$(findstring $(ARCH) , powerpc64 ))
LINUX_KARCH := powerpc LINUX_KARCH := powerpc
else ifneq (,$(findstring $(ARCH) , riscv64 ))
LINUX_KARCH := riscv
else ifneq (,$(findstring $(ARCH) , sh2 sh3 sh4 )) else ifneq (,$(findstring $(ARCH) , sh2 sh3 sh4 ))
LINUX_KARCH := sh LINUX_KARCH := sh
else ifneq (,$(findstring $(ARCH) , i386 x86_64 )) else ifneq (,$(findstring $(ARCH) , i386 x86_64 ))
@ -105,7 +105,7 @@ endif
KERNEL_MAKE = $(MAKE) $(KERNEL_MAKEOPTS) KERNEL_MAKE = $(MAKE) $(KERNEL_MAKEOPTS)
KERNEL_MAKE_FLAGS = \ KERNEL_MAKE_FLAGS = \
KCFLAGS="$(call iremap,$(BUILD_DIR),$(notdir $(BUILD_DIR))) $(filter-out -fno-plt,$(call qstrip,$(CONFIG_EXTRA_OPTIMIZATION))) $(call qstrip,$(CONFIG_KERNEL_CFLAGS))" \ KCFLAGS="$(call iremap,$(BUILD_DIR),$(notdir $(BUILD_DIR)))" \
HOSTCFLAGS="$(HOST_CFLAGS) -Wall -Wmissing-prototypes -Wstrict-prototypes" \ HOSTCFLAGS="$(HOST_CFLAGS) -Wall -Wmissing-prototypes -Wstrict-prototypes" \
CROSS_COMPILE="$(KERNEL_CROSS)" \ CROSS_COMPILE="$(KERNEL_CROSS)" \
ARCH="$(LINUX_KARCH)" \ ARCH="$(LINUX_KARCH)" \
@ -129,17 +129,17 @@ ifeq ($(call qstrip,$(CONFIG_EXTERNAL_KERNEL_TREE))$(call qstrip,$(CONFIG_KERNEL
KERNELRELEASE=$(LINUX_VERSION) KERNELRELEASE=$(LINUX_VERSION)
endif endif
ifneq ($(HOST_OS),Linux) KERNEL_MAKEOPTS := -C $(LINUX_DIR) $(KERNEL_MAKE_FLAGS)
KERNEL_MAKE_FLAGS += CONFIG_STACK_VALIDATION=
export SKIP_STACK_VALIDATION:=1
endif
KERNEL_MAKEOPTS = -C $(LINUX_DIR) $(KERNEL_MAKE_FLAGS)
ifdef CONFIG_USE_SPARSE ifdef CONFIG_USE_SPARSE
KERNEL_MAKEOPTS += C=1 CHECK=$(STAGING_DIR_HOST)/bin/sparse KERNEL_MAKEOPTS += C=1 CHECK=$(STAGING_DIR_HOST)/bin/sparse
endif endif
ifneq ($(HOST_OS),Linux)
KERNEL_MAKEOPTS += CONFIG_STACK_VALIDATION=
export SKIP_STACK_VALIDATION:=1
endif
PKG_EXTMOD_SUBDIRS ?= . PKG_EXTMOD_SUBDIRS ?= .
PKG_SYMVERS_DIR = $(KERNEL_BUILD_DIR)/symvers PKG_SYMVERS_DIR = $(KERNEL_BUILD_DIR)/symvers
@ -238,7 +238,7 @@ $(call KernelPackage/$(1)/config)
$(call KernelPackage/depends) $(call KernelPackage/depends)
$(call KernelPackage/hooks) $(call KernelPackage/hooks)
ifneq ($(if $(filter-out %=y %=n %=m,$(KCONFIG)),$(filter m y,$(foreach c,$(call version_filter,$(filter-out %=y %=n %=m,$(KCONFIG))),$($(c)))),.),) ifneq ($(if $(filter-out %=y %=n %=m,$(KCONFIG)),$(filter m y,$(foreach c,$(filter-out %=y %=n %=m,$(KCONFIG)),$($(c)))),.),)
define Package/kmod-$(1)/install define Package/kmod-$(1)/install
@for mod in $$(call version_filter,$$(FILES)); do \ @for mod in $$(call version_filter,$$(FILES)); do \
if grep -q "$$$$$$$${mod##$(LINUX_DIR)/}" "$(LINUX_DIR)/modules.builtin"; then \ if grep -q "$$$$$$$${mod##$(LINUX_DIR)/}" "$(LINUX_DIR)/modules.builtin"; then \

View File

@ -19,6 +19,7 @@
# #
# Host packages are built in the same fashion, just use these vars instead: # Host packages are built in the same fashion, just use these vars instead:
# #
# HOST_BUILD_DEPENDS:=meson/host
# MESON_HOST_ARGS+=-Dfoo -Dbar=baz # MESON_HOST_ARGS+=-Dfoo -Dbar=baz
# MESON_HOST_VARS+=FOO=bar # MESON_HOST_VARS+=FOO=bar
@ -55,14 +56,8 @@ else
MESON_CPU:="$(CPU_TYPE)$(if $(CPU_SUBTYPE),+$(CPU_SUBTYPE))" MESON_CPU:="$(CPU_TYPE)$(if $(CPU_SUBTYPE),+$(CPU_SUBTYPE))"
endif endif
ifeq ($(MESON_USE_STAGING_PYTHON),)
PYTHON_BIN:=$(STAGING_DIR_HOST)/bin/$(PYTHON)
else
PYTHON_BIN:=$(STAGING_DIR_HOSTPKG)/bin/$(PYTHON)
endif
define Meson define Meson
$(2) $(PYTHON_BIN) $(STAGING_DIR_HOST)/bin/meson.py $(1) $(2) $(STAGING_DIR_HOST)/bin/$(PYTHON) $(MESON_DIR)/meson.py $(1)
endef endef
define Meson/CreateNativeFile define Meson/CreateNativeFile
@ -70,8 +65,6 @@ define Meson/CreateNativeFile
-e "s|@CC@|$(foreach BIN,$(HOSTCC),'$(BIN)',)|" \ -e "s|@CC@|$(foreach BIN,$(HOSTCC),'$(BIN)',)|" \
-e "s|@CXX@|$(foreach BIN,$(HOSTCXX),'$(BIN)',)|" \ -e "s|@CXX@|$(foreach BIN,$(HOSTCXX),'$(BIN)',)|" \
-e "s|@PKGCONFIG@|$(PKG_CONFIG)|" \ -e "s|@PKGCONFIG@|$(PKG_CONFIG)|" \
-e "s|@CMAKE@|$(STAGING_DIR_HOST)/bin/cmake|" \
-e "s|@PYTHON@|$(PYTHON_BIN)|" \
-e "s|@CFLAGS@|$(foreach FLAG,$(HOST_CFLAGS) $(HOST_CPPFLAGS),'$(FLAG)',)|" \ -e "s|@CFLAGS@|$(foreach FLAG,$(HOST_CFLAGS) $(HOST_CPPFLAGS),'$(FLAG)',)|" \
-e "s|@CXXFLAGS@|$(foreach FLAG,$(HOST_CXXFLAGS) $(HOST_CPPFLAGS),'$(FLAG)',)|" \ -e "s|@CXXFLAGS@|$(foreach FLAG,$(HOST_CXXFLAGS) $(HOST_CPPFLAGS),'$(FLAG)',)|" \
-e "s|@LDFLAGS@|$(foreach FLAG,$(HOST_LDFLAGS),'$(FLAG)',)|" \ -e "s|@LDFLAGS@|$(foreach FLAG,$(HOST_LDFLAGS),'$(FLAG)',)|" \
@ -84,13 +77,10 @@ define Meson/CreateCrossFile
$(STAGING_DIR_HOST)/bin/sed \ $(STAGING_DIR_HOST)/bin/sed \
-e "s|@CC@|$(foreach BIN,$(TARGET_CC),'$(BIN)',)|" \ -e "s|@CC@|$(foreach BIN,$(TARGET_CC),'$(BIN)',)|" \
-e "s|@CXX@|$(foreach BIN,$(TARGET_CXX),'$(BIN)',)|" \ -e "s|@CXX@|$(foreach BIN,$(TARGET_CXX),'$(BIN)',)|" \
-e "s|@LD@|$(foreach FLAG,$(TARGET_LINKER),'$(FLAG)',)|" \
-e "s|@AR@|$(TARGET_AR)|" \ -e "s|@AR@|$(TARGET_AR)|" \
-e "s|@STRIP@|$(TARGET_CROSS)strip|" \ -e "s|@STRIP@|$(TARGET_CROSS)strip|" \
-e "s|@NM@|$(TARGET_NM)|" \ -e "s|@NM@|$(TARGET_NM)|" \
-e "s|@PKGCONFIG@|$(PKG_CONFIG)|" \ -e "s|@PKGCONFIG@|$(PKG_CONFIG)|" \
-e "s|@CMAKE@|$(STAGING_DIR_HOST)/bin/cmake|" \
-e "s|@PYTHON@|$(PYTHON_BIN)|" \
-e "s|@CFLAGS@|$(foreach FLAG,$(TARGET_CFLAGS) $(EXTRA_CFLAGS) $(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS),'$(FLAG)',)|" \ -e "s|@CFLAGS@|$(foreach FLAG,$(TARGET_CFLAGS) $(EXTRA_CFLAGS) $(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS),'$(FLAG)',)|" \
-e "s|@CXXFLAGS@|$(foreach FLAG,$(TARGET_CXXFLAGS) $(EXTRA_CXXFLAGS) $(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS),'$(FLAG)',)|" \ -e "s|@CXXFLAGS@|$(foreach FLAG,$(TARGET_CXXFLAGS) $(EXTRA_CXXFLAGS) $(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS),'$(FLAG)',)|" \
-e "s|@LDFLAGS@|$(foreach FLAG,$(TARGET_LDFLAGS) $(EXTRA_LDFLAGS),'$(FLAG)',)|" \ -e "s|@LDFLAGS@|$(foreach FLAG,$(TARGET_LDFLAGS) $(EXTRA_LDFLAGS),'$(FLAG)',)|" \
@ -104,17 +94,15 @@ endef
define Host/Configure/Meson define Host/Configure/Meson
$(call Meson/CreateNativeFile,$(HOST_BUILD_DIR)/openwrt-native.txt) $(call Meson/CreateNativeFile,$(HOST_BUILD_DIR)/openwrt-native.txt)
$(call Meson, \ $(call Meson, \
setup \
--native-file $(HOST_BUILD_DIR)/openwrt-native.txt \ --native-file $(HOST_BUILD_DIR)/openwrt-native.txt \
-Ddefault_library=static \
$(MESON_HOST_ARGS) \ $(MESON_HOST_ARGS) \
$(MESON_HOST_BUILD_DIR) \ $(MESON_HOST_BUILD_DIR) \
$(MESON_HOST_BUILD_DIR)/.., \ $(HOST_BUILD_DIR), \
$(MESON_HOST_VARS)) $(MESON_HOST_VARS))
endef endef
define Host/Compile/Meson define Host/Compile/Meson
+$(MESON_HOST_VARS) $(NINJA) -C $(MESON_HOST_BUILD_DIR) $(1) +$(NINJA) -C $(MESON_HOST_BUILD_DIR) $(1)
endef endef
define Host/Install/Meson define Host/Install/Meson
@ -129,11 +117,9 @@ define Build/Configure/Meson
$(call Meson/CreateNativeFile,$(PKG_BUILD_DIR)/openwrt-native.txt) $(call Meson/CreateNativeFile,$(PKG_BUILD_DIR)/openwrt-native.txt)
$(call Meson/CreateCrossFile,$(PKG_BUILD_DIR)/openwrt-cross.txt) $(call Meson/CreateCrossFile,$(PKG_BUILD_DIR)/openwrt-cross.txt)
$(call Meson, \ $(call Meson, \
setup \ --buildtype plain \
--buildtype $(if $(CONFIG_DEBUG),debug,plain) \
--native-file $(PKG_BUILD_DIR)/openwrt-native.txt \ --native-file $(PKG_BUILD_DIR)/openwrt-native.txt \
--cross-file $(PKG_BUILD_DIR)/openwrt-cross.txt \ --cross-file $(PKG_BUILD_DIR)/openwrt-cross.txt \
-Ddefault_library=both \
$(MESON_ARGS) \ $(MESON_ARGS) \
$(MESON_BUILD_DIR) \ $(MESON_BUILD_DIR) \
$(MESON_BUILD_DIR)/.., \ $(MESON_BUILD_DIR)/.., \
@ -141,7 +127,7 @@ define Build/Configure/Meson
endef endef
define Build/Compile/Meson define Build/Compile/Meson
+$(MESON_VARS) $(NINJA) -C $(MESON_BUILD_DIR) $(1) +$(NINJA) -C $(MESON_BUILD_DIR) $(1)
endef endef
define Build/Install/Meson define Build/Install/Meson

View File

@ -48,6 +48,9 @@ $(eval $(call nf_add,IPT_CORE,CONFIG_NETFILTER_XT_MATCH_COMMENT, $(P_XT)xt_comme
$(eval $(call nf_add,IPT_CLUSTER,CONFIG_NETFILTER_XT_MATCH_CLUSTER, $(P_XT)xt_cluster)) $(eval $(call nf_add,IPT_CLUSTER,CONFIG_NETFILTER_XT_MATCH_CLUSTER, $(P_XT)xt_cluster))
$(eval $(call nf_add,IPT_CORE,CONFIG_NETFILTER_XT_TARGET_LOG, $(P_XT)xt_LOG)) $(eval $(call nf_add,IPT_CORE,CONFIG_NETFILTER_XT_TARGET_LOG, $(P_XT)xt_LOG))
$(eval $(call nf_add,IPT_CORE,CONFIG_NETFILTER_XT_TARGET_LOG, $(P_XT)nf_log_common, lt 5.13))
$(eval $(call nf_add,IPT_CORE,CONFIG_NETFILTER_XT_TARGET_LOG, $(P_V4)nf_log_ipv4, lt 5.13))
$(eval $(call nf_add,IPT_CORE,CONFIG_NETFILTER_XT_TARGET_LOG, $(P_XT)nf_log_syslog, ge 5.13))
$(eval $(call nf_add,IPT_CORE,CONFIG_NETFILTER_XT_TARGET_TCPMSS, $(P_XT)xt_TCPMSS)) $(eval $(call nf_add,IPT_CORE,CONFIG_NETFILTER_XT_TARGET_TCPMSS, $(P_XT)xt_TCPMSS))
$(eval $(call nf_add,IPT_CORE,CONFIG_IP_NF_TARGET_REJECT, $(P_V4)ipt_REJECT)) $(eval $(call nf_add,IPT_CORE,CONFIG_IP_NF_TARGET_REJECT, $(P_V4)ipt_REJECT))
$(eval $(call nf_add,IPT_CORE,CONFIG_NETFILTER_XT_MATCH_TIME, $(P_XT)xt_time)) $(eval $(call nf_add,IPT_CORE,CONFIG_NETFILTER_XT_MATCH_TIME, $(P_XT)xt_time))
@ -170,13 +173,6 @@ $(eval $(call nf_add,IPT_IPV6_EXTRA,CONFIG_IP6_NF_MATCH_OPTS, $(P_V6)ip6t_hbh))
$(eval $(call nf_add,IPT_IPV6_EXTRA,CONFIG_IP6_NF_MATCH_FRAG, $(P_V6)ip6t_frag)) $(eval $(call nf_add,IPT_IPV6_EXTRA,CONFIG_IP6_NF_MATCH_FRAG, $(P_V6)ip6t_frag))
$(eval $(call nf_add,IPT_IPV6_EXTRA,CONFIG_IP6_NF_MATCH_RT, $(P_V6)ip6t_rt)) $(eval $(call nf_add,IPT_IPV6_EXTRA,CONFIG_IP6_NF_MATCH_RT, $(P_V6)ip6t_rt))
# log
$(eval $(call nf_add,NF_LOG,CONFIG_NF_LOG_COMMON, $(P_XT)nf_log_common, lt 5.13))
$(eval $(call nf_add,NF_LOG,CONFIG_NF_LOG_IPV4, $(P_V4)nf_log_ipv4, lt 5.13))
$(eval $(call nf_add,NF_LOG,CONFIG_NF_LOG_SYSLOG, $(P_XT)nf_log_syslog, ge 5.13))
# $(eval $(if $(NF_KMOD),$(call nf_add,NF_LOG6,CONFIG_NF_LOG_IPV6, $(P_V6)nf_log_ipv6,lt 5.13),))
# nat # nat
# kernel only # kernel only
@ -230,6 +226,11 @@ $(eval $(call nf_add,NF_NATHELPER_EXTRA,CONFIG_NF_CONNTRACK_IRC, $(P_XT)nf_connt
$(eval $(call nf_add,NF_NATHELPER_EXTRA,CONFIG_NF_NAT_IRC, $(P_XT)nf_nat_irc)) $(eval $(call nf_add,NF_NATHELPER_EXTRA,CONFIG_NF_NAT_IRC, $(P_XT)nf_nat_irc))
# ulog
$(eval $(call nf_add,IPT_ULOG,CONFIG_IP_NF_TARGET_ULOG, $(P_V4)ipt_ULOG))
# nflog # nflog
$(eval $(call nf_add,IPT_NFLOG,CONFIG_NETFILTER_XT_TARGET_NFLOG, $(P_XT)xt_NFLOG)) $(eval $(call nf_add,IPT_NFLOG,CONFIG_NETFILTER_XT_TARGET_NFLOG, $(P_XT)xt_NFLOG))
@ -244,15 +245,14 @@ $(eval $(call nf_add,IPT_NFQUEUE,CONFIG_NETFILTER_XT_TARGET_NFQUEUE, $(P_XT)xt_N
$(eval $(call nf_add,IPT_DEBUG,CONFIG_NETFILTER_XT_TARGET_TRACE, $(P_XT)xt_TRACE)) $(eval $(call nf_add,IPT_DEBUG,CONFIG_NETFILTER_XT_TARGET_TRACE, $(P_XT)xt_TRACE))
# socket
$(eval $(call nf_add,NF_SOCKET,CONFIG_NF_SOCKET_IPV4, $(P_V4)nf_socket_ipv4))
$(eval $(call nf_add,NF_SOCKET,CONFIG_NF_SOCKET_IPV6, $(P_V6)nf_socket_ipv6))
$(eval $(call nf_add,IPT_SOCKET,CONFIG_NETFILTER_XT_MATCH_SOCKET, $(P_XT)xt_socket))
# tproxy # tproxy
$(eval $(call nf_add,NF_TPROXY,CONFIG_NF_TPROXY_IPV4, $(P_V4)nf_tproxy_ipv4))
$(eval $(call nf_add,NF_TPROXY,CONFIG_NF_TPROXY_IPV6, $(P_V6)nf_tproxy_ipv6)) $(eval $(call nf_add,IPT_TPROXY,CONFIG_NETFILTER_XT_MATCH_SOCKET, $(P_XT)xt_socket))
$(eval $(call nf_add,IPT_TPROXY,CONFIG_NF_SOCKET_IPV4, $(P_V4)nf_socket_ipv4))
$(eval $(call nf_add,IPT_TPROXY,CONFIG_NF_SOCKET_IPV6, $(P_V6)nf_socket_ipv6))
$(eval $(call nf_add,IPT_TPROXY,CONFIG_NETFILTER_XT_TARGET_TPROXY, $(P_XT)xt_TPROXY)) $(eval $(call nf_add,IPT_TPROXY,CONFIG_NETFILTER_XT_TARGET_TPROXY, $(P_XT)xt_TPROXY))
$(eval $(call nf_add,IPT_TPROXY,CONFIG_NF_TPROXY_IPV4, $(P_V4)nf_tproxy_ipv4))
$(eval $(call nf_add,IPT_TPROXY,CONFIG_NF_TPROXY_IPV6, $(P_V6)nf_tproxy_ipv6))
# led # led
$(eval $(call nf_add,IPT_LED,CONFIG_NETFILTER_XT_TARGET_LED, $(P_XT)xt_LED)) $(eval $(call nf_add,IPT_LED,CONFIG_NETFILTER_XT_TARGET_LED, $(P_XT)xt_LED))
@ -316,6 +316,7 @@ $(eval $(call nf_add,EBTABLES_IP4,CONFIG_BRIDGE_EBT_SNAT, $(P_EBT)ebt_snat))
# watchers # watchers
$(eval $(call nf_add,EBTABLES_WATCHERS,CONFIG_BRIDGE_EBT_LOG, $(P_EBT)ebt_log)) $(eval $(call nf_add,EBTABLES_WATCHERS,CONFIG_BRIDGE_EBT_LOG, $(P_EBT)ebt_log))
$(eval $(call nf_add,EBTABLES_WATCHERS,CONFIG_BRIDGE_EBT_ULOG, $(P_EBT)ebt_ulog))
$(eval $(call nf_add,EBTABLES_WATCHERS,CONFIG_BRIDGE_EBT_NFLOG, $(P_EBT)ebt_nflog)) $(eval $(call nf_add,EBTABLES_WATCHERS,CONFIG_BRIDGE_EBT_NFLOG, $(P_EBT)ebt_nflog))
$(eval $(call nf_add,EBTABLES_WATCHERS,CONFIG_BRIDGE_EBT_NFQUEUE, $(P_EBT)ebt_nfqueue)) $(eval $(call nf_add,EBTABLES_WATCHERS,CONFIG_BRIDGE_EBT_NFQUEUE, $(P_EBT)ebt_nfqueue))
@ -337,7 +338,6 @@ $(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_REJECT_INET, $(P_XT)nft
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_BRIDGE,CONFIG_NFT_BRIDGE_META, $(P_EBT)nft_meta_bridge),)) $(eval $(if $(NF_KMOD),$(call nf_add,NFT_BRIDGE,CONFIG_NFT_BRIDGE_META, $(P_EBT)nft_meta_bridge),))
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_BRIDGE,CONFIG_NFT_BRIDGE_REJECT, $(P_EBT)nft_reject_bridge),)) $(eval $(if $(NF_KMOD),$(call nf_add,NFT_BRIDGE,CONFIG_NFT_BRIDGE_REJECT, $(P_EBT)nft_reject_bridge),))
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_BRIDGE,CONFIG_NF_CONNTRACK_BRIDGE, $(P_EBT)nf_conntrack_bridge),))
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_NAT,CONFIG_NFT_NAT, $(P_XT)nft_nat),)) $(eval $(if $(NF_KMOD),$(call nf_add,NFT_NAT,CONFIG_NFT_NAT, $(P_XT)nft_nat),))
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_NAT,CONFIG_NFT_NAT, $(P_XT)nft_chain_nat),)) $(eval $(if $(NF_KMOD),$(call nf_add,NFT_NAT,CONFIG_NFT_NAT, $(P_XT)nft_chain_nat),))
@ -355,14 +355,6 @@ $(eval $(if $(NF_KMOD),$(call nf_add,NFT_FIB,CONFIG_NFT_FIB_IPV6, $(P_V6)nft_fib
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_QUEUE,CONFIG_NFT_QUEUE, $(P_XT)nft_queue),)) $(eval $(if $(NF_KMOD),$(call nf_add,NFT_QUEUE,CONFIG_NFT_QUEUE, $(P_XT)nft_queue),))
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_SOCKET,CONFIG_NFT_SOCKET, $(P_XT)nft_socket),))
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_TPROXY,CONFIG_NFT_TPROXY, $(P_XT)nft_tproxy),))
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_COMPAT,CONFIG_NFT_COMPAT, $(P_XT)nft_compat),))
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_XFRM,CONFIG_NFT_XFRM, $(P_XT)nft_xfrm),))
# userland only # userland only
IPT_BUILTIN += $(NF_IPT-y) $(NF_IPT-m) IPT_BUILTIN += $(NF_IPT-y) $(NF_IPT-m)
IPT_BUILTIN += $(IPT_CORE-y) $(IPT_CORE-m) IPT_BUILTIN += $(IPT_CORE-y) $(IPT_CORE-m)
@ -387,6 +379,7 @@ IPT_BUILTIN += $(IPT_NAT6-y)
IPT_BUILTIN += $(IPT_NAT_EXTRA-y) IPT_BUILTIN += $(IPT_NAT_EXTRA-y)
IPT_BUILTIN += $(NF_NATHELPER-y) IPT_BUILTIN += $(NF_NATHELPER-y)
IPT_BUILTIN += $(NF_NATHELPER_EXTRA-y) IPT_BUILTIN += $(NF_NATHELPER_EXTRA-y)
IPT_BUILTIN += $(IPT_ULOG-y)
IPT_BUILTIN += $(IPT_TPROXY-y) IPT_BUILTIN += $(IPT_TPROXY-y)
IPT_BUILTIN += $(NFNETLINK-y) IPT_BUILTIN += $(NFNETLINK-y)
IPT_BUILTIN += $(NFNETLINK_LOG-y) IPT_BUILTIN += $(NFNETLINK_LOG-y)

View File

@ -10,38 +10,27 @@ ifeq ($(CONFIG_BUILD_NLS),y)
INTL_PREFIX:=$(STAGING_DIR)/usr/lib/libintl-full INTL_PREFIX:=$(STAGING_DIR)/usr/lib/libintl-full
INTL_FULL:=1 INTL_FULL:=1
CMAKE_OPTIONS += -DCMAKE_PREFIX_PATH="$(ICONV_PREFIX);$(INTL_PREFIX)" # iconv stub
else else
ICONV_PREFIX:= ICONV_PREFIX:=$(STAGING_DIR)/usr/lib/libiconv-stub
ICONV_FULL:= ICONV_FULL:=
INTL_PREFIX:= INTL_PREFIX:=$(STAGING_DIR)/usr/lib/libintl-stub
INTL_FULL:= INTL_FULL:=
endif endif
PKG_CONFIG_DEPENDS += CONFIG_BUILD_NLS PKG_CONFIG_DEPENDS += CONFIG_BUILD_NLS
PKG_BUILD_DEPENDS += !BUILD_NLS:libiconv !BUILD_NLS:gettext
ICONV_DEPENDS:=+BUILD_NLS:libiconv-full ICONV_DEPENDS:=+BUILD_NLS:libiconv-full
ifeq ($(CONFIG_BUILD_NLS),y)
ICONV_CFLAGS:=-I$(ICONV_PREFIX)/include ICONV_CFLAGS:=-I$(ICONV_PREFIX)/include
ICONV_CPPFLAGS:=-I$(ICONV_PREFIX)/include ICONV_CPPFLAGS:=-I$(ICONV_PREFIX)/include
ICONV_LDFLAGS:=-L$(ICONV_PREFIX)/lib -Wl,-rpath-link=$(ICONV_PREFIX)/lib ICONV_LDFLAGS:=-L$(ICONV_PREFIX)/lib -Wl,-rpath-link=$(ICONV_PREFIX)/lib
else
ICONV_CFLAGS:=
ICONV_CPPFLAGS:=
ICONV_LDFLAGS:=
endif
INTL_DEPENDS:=+BUILD_NLS:libintl-full INTL_DEPENDS:=+BUILD_NLS:libintl-full
ifeq ($(CONFIG_BUILD_NLS),y)
INTL_CFLAGS:=-I$(INTL_PREFIX)/include INTL_CFLAGS:=-I$(INTL_PREFIX)/include
INTL_CPPFLAGS:=-I$(INTL_PREFIX)/include INTL_CPPFLAGS:=-I$(INTL_PREFIX)/include
INTL_LDFLAGS:=-L$(INTL_PREFIX)/lib -Wl,-rpath-link=$(INTL_PREFIX)/lib INTL_LDFLAGS:=-L$(INTL_PREFIX)/lib -Wl,-rpath-link=$(INTL_PREFIX)/lib
else
INTL_CFLAGS:=
INTL_CPPFLAGS:=
INTL_LDFLAGS:=
endif
TARGET_CFLAGS += $(ICONV_CFLAGS) $(INTL_CFLAGS) TARGET_CFLAGS += $(ICONV_CFLAGS) $(INTL_CFLAGS)
TARGET_CPPFLAGS += $(ICONV_CPPFLAGS) $(INTL_CPPFLAGS) TARGET_CPPFLAGS += $(ICONV_CPPFLAGS) $(INTL_CPPFLAGS)

50
include/openssl-engine.mk Normal file
View File

@ -0,0 +1,50 @@
# SPDX-License-Identifier: GPL-2.0-only
#
# Copyright (C) 2022 Enéas Ulir de Queiroz
ENGINES_DIR=engines-1.1
define Package/openssl/engine/Default
SECTION:=libs
CATEGORY:=Libraries
SUBMENU:=SSL
DEPENDS:=libopenssl @OPENSSL_ENGINE +libopenssl-conf
endef
# 1 = engine name
# 2 - package name, defaults to libopenssl-$(1)
define Package/openssl/add-engine
OSSL_ENG_PKG:=$(if $(2),$(2),libopenssl-$(1))
Package/$$(OSSL_ENG_PKG)/conffiles:=/etc/ssl/engines.cnf.d/$(1).cnf
define Package/$$(OSSL_ENG_PKG)/install
$$(INSTALL_DIR) $$(1)/usr/lib/$(ENGINES_DIR)
$$(INSTALL_BIN) $$(PKG_INSTALL_DIR)/usr/lib/$(ENGINES_DIR)/$(1).so \
$$(1)/usr/lib/$(ENGINES_DIR)
$$(INSTALL_DIR) $$(1)/etc/ssl/engines.cnf.d
$$(INSTALL_DATA) ./files/$(1).cnf $$(1)/etc/ssl/engines.cnf.d/
endef
define Package/$$(OSSL_ENG_PKG)/postinst :=
#!/bin/sh
OPENSSL_UCI="$$$${IPKG_INSTROOT}/etc/config/openssl"
[ -z "$$$${IPKG_INSTROOT}" ] && uci -q get openssl.$(1) >/dev/null && exit 0
cat << EOF >> "$$$${OPENSSL_UCI}"
config engine '$(1)'
option enabled '1'
EOF
[ -n "$$$${IPKG_INSTROOT}" ] || /etc/init.d/openssl reload
endef
define Package/$$(OSSL_ENG_PKG)/postrm :=
#!/bin/sh
[ -n "$$$${IPKG_INSTROOT}" ] && exit 0
uci delete openssl.$(1)
uci commit openssl
/etc/init.d/openssl reload
endef
endef

View File

@ -1,79 +0,0 @@
# SPDX-License-Identifier: GPL-2.0-only
#
# Copyright (C) 2022-2023 Enéas Ulir de Queiroz
ENGINES_DIR=engines-3
define Package/openssl/module/Default
SECTION:=libs
CATEGORY:=Libraries
SUBMENU:=SSL
DEPENDS:=libopenssl +libopenssl-conf
endef
define Package/openssl/engine/Default
$(Package/openssl/module/Default)
DEPENDS+=@OPENSSL_ENGINE
endef
# 1 = moudule type (engine|provider)
# 2 = module name
# 3 = directory to save .so file
# 4 = [ package name, defaults to libopenssl-$(2) ]
define Package/openssl/add-module
$(eval MOD_TYPE:=$(1))
$(eval MOD_NAME:=$(2))
$(eval MOD_DIR:=$(3))
$(eval OSSL_PKG:=$(if $(4),$(4),libopenssl-$(MOD_NAME)))
$(info Package/openssl/add-module 1='$(1)'; 2='$(2)'; 3='$(3)' 4='$(4)')
$(info MOD_TYPE='$(MOD_TYPE)'; MOD_NAME='$(MOD_NAME)'; MOD_DIR='$(MOD_DIR)' OSSL_PKG='$(OSSL_PKG)')
Package/$(OSSL_PKG)/conffiles:=/etc/ssl/modules.cnf.d/$(MOD_NAME).cnf
define Package/$(OSSL_PKG)/install
$$(INSTALL_DIR) $$(1)/$(MOD_DIR)
$$(INSTALL_BIN) $$(PKG_INSTALL_DIR)/$(MOD_DIR)/$(MOD_NAME).so \
$$(1)/$(MOD_DIR)
$$(INSTALL_DIR) $$(1)/etc/ssl/modules.cnf.d
$$(INSTALL_DATA) ./files/$(MOD_NAME).cnf $$(1)/etc/ssl/modules.cnf.d/
endef
define Package/$(OSSL_PKG)/postinst
#!/bin/sh
OPENSSL_UCI="$$$${IPKG_INSTROOT}/etc/config/openssl"
[ -z "$$$${IPKG_INSTROOT}" ] \
&& uci -q get openssl.$(MOD_NAME) >/dev/null \
&& exit 0
cat << EOF >> "$$$${OPENSSL_UCI}"
config $(MOD_TYPE) '$(MOD_NAME)'
option enabled '1'
EOF
[ -n "$$$${IPKG_INSTROOT}" ] || /etc/init.d/openssl reload
exit 0
endef
define Package/$(OSSL_PKG)/postrm
#!/bin/sh
[ -n "$$$${IPKG_INSTROOT}" ] && exit 0
uci -q delete openssl.$(MOD_NAME) && uci commit openssl
/etc/init.d/openssl reload
exit 0
endef
endef
# 1 = engine name
# 2 - package name, defaults to libopenssl-$(1)
define Package/openssl/add-engine
$(call Package/openssl/add-module,engine,$(1),/usr/lib/$(ENGINES_DIR),$(2))
endef
# 1 = provider name
# 2 = [ package name, defaults to libopenssl-$(1) ]
define Package/openssl/add-provider
$(call Package/openssl/add-module,provider,$(1),/usr/lib/ossl-modules,$(2))
endef

View File

@ -4,8 +4,7 @@
ifeq ($(DUMP),) ifeq ($(DUMP),)
define BuildTarget/bin define BuildTarget/bin
TARGET_VARIANT=$(if $(ALL_VARIANTS),$(if $(VARIANT),$(filter-out *,$(VARIANT)),$(firstword $(ALL_VARIANTS)))) ifeq ($(if $(VARIANT),$(BUILD_VARIANT)),$(VARIANT))
ifeq ($(if $(TARGET_VARIANT),$(BUILD_VARIANT)),$(TARGET_VARIANT))
ifdef Package/$(1)/install ifdef Package/$(1)/install
ifneq ($(CONFIG_PACKAGE_$(1))$(DEVELOPER),) ifneq ($(CONFIG_PACKAGE_$(1))$(DEVELOPER),)
$(_pkg_target)compile: $(PKG_BUILD_DIR)/.pkgdir/$(1).installed $(_pkg_target)compile: $(PKG_BUILD_DIR)/.pkgdir/$(1).installed

View File

@ -2,7 +2,7 @@
# #
# Copyright (C) 2006-2020 OpenWrt.org # Copyright (C) 2006-2020 OpenWrt.org
PKG_DEFAULT_DEPENDS = +libc PKG_DEFAULT_DEPENDS = +libc +USE_GLIBC:librt +USE_GLIBC:libpthread
ifneq ($(PKG_NAME),toolchain) ifneq ($(PKG_NAME),toolchain)
PKG_FIXUP_DEPENDS = $(if $(filter kmod-%,$(1)),$(2),$(PKG_DEFAULT_DEPENDS) $(filter-out $(PKG_DEFAULT_DEPENDS),$(2))) PKG_FIXUP_DEPENDS = $(if $(filter kmod-%,$(1)),$(2),$(PKG_DEFAULT_DEPENDS) $(filter-out $(PKG_DEFAULT_DEPENDS),$(2)))

View File

@ -105,8 +105,7 @@ ifeq ($(DUMP),)
IDIR_$(1):=$(PKG_BUILD_DIR)/ipkg-$(PKGARCH)/$(1) IDIR_$(1):=$(PKG_BUILD_DIR)/ipkg-$(PKGARCH)/$(1)
KEEP_$(1):=$(strip $(call Package/$(1)/conffiles)) KEEP_$(1):=$(strip $(call Package/$(1)/conffiles))
TARGET_VARIANT:=$$(if $(ALL_VARIANTS),$$(if $$(VARIANT),$$(filter-out *,$$(VARIANT)),$(firstword $(ALL_VARIANTS)))) ifeq ($(BUILD_VARIANT),$$(if $$(VARIANT),$$(VARIANT),$(BUILD_VARIANT)))
ifeq ($(BUILD_VARIANT),$$(if $$(TARGET_VARIANT),$$(TARGET_VARIANT),$(BUILD_VARIANT)))
do_install= do_install=
ifdef Package/$(1)/install ifdef Package/$(1)/install
do_install=yes do_install=yes
@ -264,7 +263,7 @@ $(_endef)
endif endif
$(INSTALL_DIR) $$(PDIR_$(1)) $(INSTALL_DIR) $$(PDIR_$(1))
$(FAKEROOT) $(STAGING_DIR_HOST)/bin/bash $(SCRIPT_DIR)/ipkg-build -m "$(FILE_MODES)" $$(IDIR_$(1)) $$(PDIR_$(1)) $(FAKEROOT) $(SCRIPT_DIR)/ipkg-build -m "$(FILE_MODES)" $$(IDIR_$(1)) $$(PDIR_$(1))
@[ -f $$(IPKG_$(1)) ] @[ -f $$(IPKG_$(1)) ]
$(1)-clean: $(1)-clean:

View File

@ -11,7 +11,8 @@ include $(INCLUDE_DIR)/download.mk
PKG_BUILD_DIR ?= $(BUILD_DIR)/$(if $(BUILD_VARIANT),$(PKG_NAME)-$(BUILD_VARIANT)/)$(PKG_NAME)$(if $(PKG_VERSION),-$(PKG_VERSION)) PKG_BUILD_DIR ?= $(BUILD_DIR)/$(if $(BUILD_VARIANT),$(PKG_NAME)-$(BUILD_VARIANT)/)$(PKG_NAME)$(if $(PKG_VERSION),-$(PKG_VERSION))
PKG_INSTALL_DIR ?= $(PKG_BUILD_DIR)/ipkg-install PKG_INSTALL_DIR ?= $(PKG_BUILD_DIR)/ipkg-install
PKG_BUILD_PARALLEL ?= PKG_BUILD_PARALLEL ?=
PKG_SKIP_DOWNLOAD=$(USE_SOURCE_DIR)$(USE_GIT_TREE)$(USE_GIT_SRC_CHECKOUT) PKG_USE_MIPS16 ?= 1
PKG_IREMAP ?= 1
MAKE_J:=$(if $(MAKE_JOBSERVER),$(MAKE_JOBSERVER) $(if $(filter 3.% 4.0 4.1,$(MAKE_VERSION)),-j)) MAKE_J:=$(if $(MAKE_JOBSERVER),$(MAKE_JOBSERVER) $(if $(filter 3.% 4.0 4.1,$(MAKE_VERSION)),-j))
@ -22,50 +23,15 @@ PKG_JOBS?=-j1
else else
PKG_JOBS?=$(if $(PKG_BUILD_PARALLEL),$(MAKE_J),-j1) PKG_JOBS?=$(if $(PKG_BUILD_PARALLEL),$(MAKE_J),-j1)
endif endif
PKG_BUILD_FLAGS?=
# TODO remove this when all packages moved to PKG_BUILD_FLAGS=no-mips16
PKG_USE_MIPS16?=1
ifneq ($(strip $(PKG_USE_MIPS16)),1)
PKG_BUILD_FLAGS+=no-mips16
endif
__unknown_flags=$(filter-out no-iremap no-mips16 gc-sections no-gc-sections lto no-lto no-mold,$(PKG_BUILD_FLAGS))
ifneq ($(__unknown_flags),)
$(error unknown PKG_BUILD_FLAGS: $(__unknown_flags))
endif
# $1=flagname, $2=default (0/1)
define pkg_build_flag
$(if $(filter no-$(1),$(PKG_BUILD_FLAGS)),0,$(if $(filter $(1),$(PKG_BUILD_FLAGS)),1,$(2)))
endef
ifeq ($(call pkg_build_flag,iremap,1),1)
IREMAP_CFLAGS = $(call iremap,$(PKG_BUILD_DIR),$(notdir $(PKG_BUILD_DIR)))
TARGET_CFLAGS += $(IREMAP_CFLAGS)
endif
ifdef CONFIG_USE_MIPS16 ifdef CONFIG_USE_MIPS16
ifeq ($(call pkg_build_flag,mips16,1),1) ifeq ($(strip $(PKG_USE_MIPS16)),1)
TARGET_ASFLAGS_DEFAULT = $(filter-out -mips16 -minterlink-mips16,$(TARGET_CFLAGS)) TARGET_ASFLAGS_DEFAULT = $(filter-out -mips16 -minterlink-mips16,$(TARGET_CFLAGS))
TARGET_CFLAGS += -mips16 -minterlink-mips16 TARGET_CFLAGS += -mips16 -minterlink-mips16
TARGET_CXXFLAGS += -mips16 -minterlink-mips16
endif endif
endif endif
ifeq ($(call pkg_build_flag,gc-sections,$(if $(CONFIG_USE_GC_SECTIONS),1,0)),1) ifeq ($(strip $(PKG_IREMAP)),1)
TARGET_CFLAGS+= -ffunction-sections -fdata-sections IREMAP_CFLAGS = $(call iremap,$(PKG_BUILD_DIR),$(notdir $(PKG_BUILD_DIR)))
TARGET_CXXFLAGS+= -ffunction-sections -fdata-sections TARGET_CFLAGS += $(IREMAP_CFLAGS)
TARGET_LDFLAGS+= -Wl,--gc-sections
endif
ifeq ($(call pkg_build_flag,lto,$(if $(CONFIG_USE_LTO),1,0)),1)
TARGET_CFLAGS+= -flto=auto -fno-fat-lto-objects
TARGET_CXXFLAGS+= -flto=auto -fno-fat-lto-objects
TARGET_LDFLAGS+= -flto=auto -fuse-linker-plugin
endif
ifdef CONFIG_USE_MOLD
ifeq ($(call pkg_build_flag,mold,1),1)
TARGET_LINKER:=mold
endif
endif endif
include $(INCLUDE_DIR)/hardening.mk include $(INCLUDE_DIR)/hardening.mk
@ -118,7 +84,7 @@ ifneq ($(PREV_STAMP_PREPARED),)
STAMP_PREPARED:=$(PREV_STAMP_PREPARED) STAMP_PREPARED:=$(PREV_STAMP_PREPARED)
CONFIG_AUTOREBUILD:= CONFIG_AUTOREBUILD:=
else else
STAMP_PREPARED=$(PKG_BUILD_DIR)/.prepared$(if $(QUILT)$(DUMP),,_$(shell $(call $(if $(CONFIG_AUTOREMOVE),find_md5_reproducible,find_md5),${CURDIR} $(PKG_FILE_DEPENDS),))_$(call confvar,CONFIG_AUTOREMOVE $(PKG_PREPARED_DEPENDS))) STAMP_PREPARED=$(PKG_BUILD_DIR)/.prepared$(if $(QUILT)$(DUMP),,_$(shell $(call find_md5,${CURDIR} $(PKG_FILE_DEPENDS),))_$(call confvar,CONFIG_AUTOREMOVE $(PKG_PREPARED_DEPENDS)))
endif endif
STAMP_CONFIGURED=$(PKG_BUILD_DIR)/.configured$(if $(DUMP),,_$(call confvar,$(PKG_CONFIG_DEPENDS))) STAMP_CONFIGURED=$(PKG_BUILD_DIR)/.configured$(if $(DUMP),,_$(call confvar,$(PKG_CONFIG_DEPENDS)))
STAMP_CONFIGURED_WILDCARD=$(PKG_BUILD_DIR)/.configured_* STAMP_CONFIGURED_WILDCARD=$(PKG_BUILD_DIR)/.configured_*
@ -217,7 +183,7 @@ define Build/CoreTargets
$(call Build/Autoclean) $(call Build/Autoclean)
$(call DefaultTargets) $(call DefaultTargets)
$(call check_download_integrity) $(DL_DIR)/$(FILE): FORCE
download: download:
$(foreach hook,$(Hooks/Download), $(foreach hook,$(Hooks/Download),
@ -292,13 +258,13 @@ define Build/CoreTargets
ifneq ($(CONFIG_AUTOREMOVE),) ifneq ($(CONFIG_AUTOREMOVE),)
compile: compile:
-touch -r $(PKG_BUILD_DIR)/.built $(PKG_BUILD_DIR)/.autoremove 2>/dev/null >/dev/null -touch -r $(PKG_BUILD_DIR)/.built $(PKG_BUILD_DIR)/.autoremove 2>/dev/null >/dev/null
$(FIND) $(PKG_BUILD_DIR) -mindepth 1 -maxdepth 1 -not '(' -type f -and -name '.*' -and -size 0 ')' -and -not -name '.pkgdir' -print0 | \ $(FIND) $(PKG_BUILD_DIR) -mindepth 1 -maxdepth 1 -not '(' -type f -and -name '.*' -and -size 0 ')' -and -not -name '.pkgdir' | \
$(XARGS) -0 rm -rf $(XARGS) rm -rf
endif endif
endef endef
define Build/DefaultTargets define Build/DefaultTargets
$(if $(PKG_SKIP_DOWNLOAD),,$(if $(strip $(PKG_SOURCE_URL)),$(call Download,default))) $(if $(USE_SOURCE_DIR)$(USE_GIT_TREE)$(USE_GIT_SRC_CHECKOUT),,$(if $(strip $(PKG_SOURCE_URL)),$(call Download,default)))
$(if $(DUMP),,$(Build/CoreTargets)) $(if $(DUMP),,$(Build/CoreTargets))
define Build/DefaultTargets define Build/DefaultTargets

View File

@ -15,7 +15,7 @@ $(eval $(call TestHostCommand,working-make, \
$(MAKE) -v | grep -E 'Make (4\.[1-9]|[5-9]\.)')) $(MAKE) -v | grep -E 'Make (4\.[1-9]|[5-9]\.)'))
$(eval $(call TestHostCommand,case-sensitive-fs, \ $(eval $(call TestHostCommand,case-sensitive-fs, \
LEDE can only be built on a case-sensitive filesystem, \ OpenWrt can only be built on a case-sensitive filesystem, \
rm -f $(TMP_DIR)/test.*; touch $(TMP_DIR)/test.fs; \ rm -f $(TMP_DIR)/test.*; touch $(TMP_DIR)/test.fs; \
test ! -f $(TMP_DIR)/test.FS)) test ! -f $(TMP_DIR)/test.FS))
@ -49,16 +49,10 @@ $(eval $(call TestHostCommand,working-g++, \
g++ -x c++ -o $(TMP_DIR)/a.out - -lstdc++ && \ g++ -x c++ -o $(TMP_DIR)/a.out - -lstdc++ && \
$(TMP_DIR)/a.out)) $(TMP_DIR)/a.out))
$(eval $(call RequireCHeader,ncurses.h, \ $(eval $(call TestHostCommand,ncurses, \
Please install ncurses. (Missing libncurses.so or ncurses.h), \ Please install ncurses. (Missing libncurses.so or ncurses.h), \
initscr(), -lncurses)) echo 'int main(int argc, char **argv) { initscr(); return 0; }' | \
gcc -include ncurses.h -x c -o $(TMP_DIR)/a.out - -lncurses))
$(eval $(call SetupHostCommand,git,Please install Git (git-core) >= 1.7.12.2, \
git --exec-path | xargs -I % -- grep -q -- --recursive %/git-submodule, \
git submodule --help | grep -- --recursive))
$(eval $(call SetupHostCommand,rsync,Please install 'rsync', \
rsync --version </dev/null))
endif # IB endif # IB
ifeq ($(HOST_OS),Linux) ifeq ($(HOST_OS),Linux)
@ -136,21 +130,13 @@ $(eval $(call SetupHostCommand,getopt, \
Please install an extended getopt version that supports --long, \ Please install an extended getopt version that supports --long, \
gnugetopt -o t --long test -- --test | grep '^ *--test *--', \ gnugetopt -o t --long test -- --test | grep '^ *--test *--', \
getopt -o t --long test -- --test | grep '^ *--test *--', \ getopt -o t --long test -- --test | grep '^ *--test *--', \
/usr/local/opt/gnu-getopt/bin/getopt -o t --long test -- --test | grep '^ *--test *--', \ /usr/local/opt/gnu-getopt/bin/getopt -o t --long test -- --test | grep '^ *--test *--'))
/opt/local/bin/getopt -o t --long test -- --test | grep '^ *--test *--'))
$(eval $(call SetupHostCommand,realpath,Please install a 'realpath' utility, \
grealpath /, \
realpath /))
$(eval $(call SetupHostCommand,stat,Cannot find a file stat utility, \ $(eval $(call SetupHostCommand,stat,Cannot find a file stat utility, \
gnustat -c%s $(TOPDIR)/Makefile, \ gnustat -c%s $(TOPDIR)/Makefile, \
gstat -c%s $(TOPDIR)/Makefile, \ gstat -c%s $(TOPDIR)/Makefile, \
stat -c%s $(TOPDIR)/Makefile)) stat -c%s $(TOPDIR)/Makefile))
$(eval $(call SetupHostCommand,gzip,Please install 'gzip', \
gzip --version </dev/null))
$(eval $(call SetupHostCommand,unzip,Please install 'unzip', \ $(eval $(call SetupHostCommand,unzip,Please install 'unzip', \
unzip 2>&1 | grep zipfile, \ unzip 2>&1 | grep zipfile, \
unzip)) unzip))
@ -171,62 +157,43 @@ $(eval $(call SetupHostCommand,perl,Please install Perl 5.x, \
$(eval $(call CleanupPython2)) $(eval $(call CleanupPython2))
$(eval $(call SetupHostCommand,python,Please install Python >= 3.6, \ $(eval $(call SetupHostCommand,python,Please install Python >= 3.6, \
python3.11 -V 2>&1 | grep 'Python 3', \
python3.10 -V 2>&1 | grep 'Python 3', \ python3.10 -V 2>&1 | grep 'Python 3', \
python3.9 -V 2>&1 | grep 'Python 3', \ python3.9 -V 2>&1 | grep 'Python 3', \
python3.8 -V 2>&1 | grep 'Python 3', \ python3.8 -V 2>&1 | grep 'Python 3', \
python3.7 -V 2>&1 | grep 'Python 3', \ python3.7 -V 2>&1 | grep 'Python 3', \
python3.6 -V 2>&1 | grep 'Python 3', \ python3.6 -V 2>&1 | grep 'Python 3', \
python3 -V 2>&1 | grep -E 'Python 3\.([6-9]|[0-9][0-9])\.?')) python3 -V 2>&1 | grep -E 'Python 3\.([6-9]|10)\.?'))
$(eval $(call SetupHostCommand,python3,Please install Python >= 3.6, \ $(eval $(call SetupHostCommand,python3,Please install Python >= 3.6, \
python3.11 -V 2>&1 | grep 'Python 3', \
python3.10 -V 2>&1 | grep 'Python 3', \ python3.10 -V 2>&1 | grep 'Python 3', \
python3.9 -V 2>&1 | grep 'Python 3', \ python3.9 -V 2>&1 | grep 'Python 3', \
python3.8 -V 2>&1 | grep 'Python 3', \ python3.8 -V 2>&1 | grep 'Python 3', \
python3.7 -V 2>&1 | grep 'Python 3', \ python3.7 -V 2>&1 | grep 'Python 3', \
python3.6 -V 2>&1 | grep 'Python 3', \ python3.6 -V 2>&1 | grep 'Python 3', \
python3 -V 2>&1 | grep -E 'Python 3\.([6-9]|[0-9][0-9])\.?')) python3 -V 2>&1 | grep -E 'Python 3\.([6-9]|10)\.?'))
$(eval $(call TestHostCommand,python3-distutils, \ $(eval $(call TestHostCommand,python3-distutils, \
Please install the Python3 distutils module, \ Please install the Python3 distutils module, \
$(STAGING_DIR_HOST)/bin/python3 -c 'from distutils import util')) $(STAGING_DIR_HOST)/bin/python3 -c 'import distutils'))
$(eval $(call TestHostCommand,python3-stdlib, \ $(eval $(call SetupHostCommand,git,Please install Git (git-core) >= 1.7.12.2, \
Please install the Python3 stdlib module, \ git --exec-path | xargs -I % -- grep -q -- --recursive %/git-submodule))
$(STAGING_DIR_HOST)/bin/python3 -c 'import ntpath'))
$(eval $(call SetupHostCommand,file,Please install the 'file' package, \ $(eval $(call SetupHostCommand,file,Please install the 'file' package, \
file --version 2>&1 | grep file)) file --version 2>&1 | grep file))
$(eval $(call SetupHostCommand,rsync,Please install 'rsync', \
rsync --version </dev/null))
$(eval $(call SetupHostCommand,which,Please install 'which', \ $(eval $(call SetupHostCommand,which,Please install 'which', \
/usr/bin/which which, \ which which | grep which))
/bin/which which, \
which which))
ifeq ($(HOST_OS),Linux)
$(eval $(call RequireCHeader,argp.h, \
Missing argp.h Please install the argp-standalone package if musl libc))
$(eval $(call RequireCHeader,fts.h, \
Missing fts.h Please install the musl-fts-dev package if musl libc))
$(eval $(call RequireCHeader,obstack.h, \
Missing obstack.h Please install the musl-obstack-dev package if musl libc))
$(eval $(call RequireCHeader,libintl.h, \
Missing libintl.h Please install the musl-libintl package if musl libc))
endif
$(STAGING_DIR_HOST)/bin/mkhash: $(SCRIPT_DIR)/mkhash.c $(STAGING_DIR_HOST)/bin/mkhash: $(SCRIPT_DIR)/mkhash.c
mkdir -p $(dir $@) mkdir -p $(dir $@)
$(CC) -O2 -I$(TOPDIR)/tools/include -o $@ $< $(CC) -O2 -I$(TOPDIR)/tools/include -o $@ $<
$(STAGING_DIR_HOST)/bin/xxd: $(SCRIPT_DIR)/xxdi.pl prereq: $(STAGING_DIR_HOST)/bin/mkhash
$(LN) $< $@
prereq: $(STAGING_DIR_HOST)/bin/mkhash $(STAGING_DIR_HOST)/bin/xxd
# Install ldconfig stub # Install ldconfig stub
$(eval $(call TestHostCommand,ldconfig-stub,Failed to install stub, \ $(eval $(call TestHostCommand,ldconfig-stub,Failed to install stub, \
$(LN) $(SCRIPT_DIR)/noop.sh $(STAGING_DIR_HOST)/bin/ldconfig)) $(LN) /bin/true $(STAGING_DIR_HOST)/bin/ldconfig))

View File

@ -49,7 +49,7 @@ endef
define RequireCommand define RequireCommand
define Require/$(1) define Require/$(1)
command -v $(1) which $(1)
endef endef
$$(eval $$(call Require,$(1),$(2))) $$(eval $$(call Require,$(1),$(2)))
@ -63,18 +63,6 @@ define RequireHeader
$$(eval $$(call Require,$(1),$(2))) $$(eval $$(call Require,$(1),$(2)))
endef endef
# 1: header to test
# 2: failure message
# 3: optional compile time test
# 4: optional link library test (example -lncurses)
define RequireCHeader
define Require/$(1)
echo 'int main(int argc, char **argv) { $(3); return 0; }' | gcc -include $(1) -x c -o $(TMP_DIR)/a.out - $(4)
endef
$$(eval $$(call Require,$(1),$(2)))
endef
define CleanupPython2 define CleanupPython2
define Require/python2-cleanup define Require/python2-cleanup
if [ -f "$(STAGING_DIR_HOST)/bin/python" ] && \ if [ -f "$(STAGING_DIR_HOST)/bin/python" ] && \
@ -115,7 +103,7 @@ define SetupHostCommand
$(call QuoteHostCommand,$(11)) $(call QuoteHostCommand,$(12)); do \ $(call QuoteHostCommand,$(11)) $(call QuoteHostCommand,$(12)); do \
if [ -n "$$$$$$$$cmd" ]; then \ if [ -n "$$$$$$$$cmd" ]; then \
bin="$$$$$$$$(PATH="$(subst $(space),:,$(filter-out $(STAGING_DIR_HOST)/%,$(subst :,$(space),$(PATH))))" \ bin="$$$$$$$$(PATH="$(subst $(space),:,$(filter-out $(STAGING_DIR_HOST)/%,$(subst :,$(space),$(PATH))))" \
command -v "$$$$$$$${cmd%% *}")"; \ which "$$$$$$$${cmd%% *}")"; \
if [ -x "$$$$$$$$bin" ] && eval "$$$$$$$$cmd" >/dev/null 2>/dev/null; then \ if [ -x "$$$$$$$$bin" ] && eval "$$$$$$$$cmd" >/dev/null 2>/dev/null; then \
mkdir -p "$(STAGING_DIR_HOST)/bin"; \ mkdir -p "$(STAGING_DIR_HOST)/bin"; \
ln -sf "$$$$$$$$bin" "$(STAGING_DIR_HOST)/bin/$(strip $(1))"; \ ln -sf "$$$$$$$$bin" "$(STAGING_DIR_HOST)/bin/$(strip $(1))"; \

View File

@ -116,7 +116,7 @@ define Quilt/RefreshDir
endef endef
define Quilt/Refresh/Host define Quilt/Refresh/Host
$(call Quilt/RefreshDir,$(HOST_BUILD_DIR),$(HOST_PATCH_DIR)) $(call Quilt/RefreshDir,$(HOST_BUILD_DIR),$(PATCH_DIR))
endef endef
define Quilt/Refresh/Package define Quilt/Refresh/Package

View File

@ -11,7 +11,7 @@ TARGET_STAMP:=$(TMP_DIR)/info/.files-$(SCAN_TARGET).stamp
FILELIST:=$(TMP_DIR)/info/.files-$(SCAN_TARGET)-$(SCAN_COOKIE) FILELIST:=$(TMP_DIR)/info/.files-$(SCAN_TARGET)-$(SCAN_COOKIE)
OVERRIDELIST:=$(TMP_DIR)/info/.overrides-$(SCAN_TARGET)-$(SCAN_COOKIE) OVERRIDELIST:=$(TMP_DIR)/info/.overrides-$(SCAN_TARGET)-$(SCAN_COOKIE)
export PATH:=$(STAGING_DIR_HOST)/bin:$(PATH) export PATH:=$(TOPDIR)/staging_dir/host/bin:$(PATH)
define feedname define feedname
$(if $(patsubst feeds/%,,$(1)),,$(word 2,$(subst /, ,$(1)))) $(if $(patsubst feeds/%,,$(1)),,$(word 2,$(subst /, ,$(1))))
@ -72,7 +72,7 @@ endif
$(FILELIST): $(OVERRIDELIST) $(FILELIST): $(OVERRIDELIST)
rm -f $(TMP_DIR)/info/.files-$(SCAN_TARGET)-* rm -f $(TMP_DIR)/info/.files-$(SCAN_TARGET)-*
find -L $(SCAN_DIR) -mindepth 1 $(if $(SCAN_DEPTH),-maxdepth $(SCAN_DEPTH)) $(SCAN_EXTRA) -name Makefile | xargs grep -aHE 'call $(GREP_STRING)' | sed -e 's#^$(SCAN_DIR)/##' -e 's#/Makefile:.*##' | uniq | awk -v of=$(OVERRIDELIST) -f include/scan.awk > $@ find -L $(SCAN_DIR) $(SCAN_EXTRA) -mindepth 1 $(if $(SCAN_DEPTH),-maxdepth $(SCAN_DEPTH)) -name Makefile | xargs grep -aHE 'call $(GREP_STRING)' | sed -e 's#^$(SCAN_DIR)/##' -e 's#/Makefile:.*##' | uniq | awk -v of=$(OVERRIDELIST) -f include/scan.awk > $@
$(TMP_DIR)/info/.files-$(SCAN_TARGET).mk: $(FILELIST) $(TMP_DIR)/info/.files-$(SCAN_TARGET).mk: $(FILELIST)
( \ ( \

View File

@ -1,30 +0,0 @@
#!/bin/sh
. $TOPDIR/include/site/linux
ac_cv_c_littleendian=${ac_cv_c_littleendian=yes}
ac_cv_c_bigendian=${ac_cv_c_bigendian=no}
ac_cv_sizeof___int64=0
ac_cv_sizeof_char=1
ac_cv_sizeof_int=4
ac_cv_sizeof_int16_t=2
ac_cv_sizeof_int32_t=4
ac_cv_sizeof_int64_t=8
ac_cv_sizeof_long_int=8
ac_cv_sizeof_long_long=8
ac_cv_sizeof_long=8
ac_cv_sizeof_off_t=8
ac_cv_sizeof_short_int=2
ac_cv_sizeof_short=2
ac_cv_sizeof_size_t=8
ac_cv_sizeof_ssize_t=8
ac_cv_sizeof_u_int16_t=2
ac_cv_sizeof_u_int32_t=4
ac_cv_sizeof_u_int64_t=8
ac_cv_sizeof_uint16_t=2
ac_cv_sizeof_uint32_t=4
ac_cv_sizeof_uint64_t=8
ac_cv_sizeof_unsigned_int=4
ac_cv_sizeof_unsigned_long=8
ac_cv_sizeof_unsigned_long_long=8
ac_cv_sizeof_unsigned_short=2
ac_cv_sizeof_void_p=8

View File

@ -1,30 +0,0 @@
#!/bin/sh
. $TOPDIR/include/site/linux
ac_cv_c_littleendian=${ac_cv_c_littleendian=yes}
ac_cv_c_bigendian=${ac_cv_c_bigendian=no}
ac_cv_sizeof___int64=8
ac_cv_sizeof_char=1
ac_cv_sizeof_int=4
ac_cv_sizeof_int16_t=2
ac_cv_sizeof_int32_t=4
ac_cv_sizeof_int64_t=8
ac_cv_sizeof_long_int=8
ac_cv_sizeof_long_long=8
ac_cv_sizeof_long=8
ac_cv_sizeof_off_t=8
ac_cv_sizeof_short_int=2
ac_cv_sizeof_short=2
ac_cv_sizeof_size_t=8
ac_cv_sizeof_ssize_t=8
ac_cv_sizeof_u_int16_t=2
ac_cv_sizeof_u_int32_t=4
ac_cv_sizeof_u_int64_t=8
ac_cv_sizeof_uint16_t=2
ac_cv_sizeof_uint32_t=4
ac_cv_sizeof_uint64_t=8
ac_cv_sizeof_unsigned_int=4
ac_cv_sizeof_unsigned_long=8
ac_cv_sizeof_unsigned_long_long=8
ac_cv_sizeof_unsigned_short=2
ac_cv_sizeof_void_p=8

View File

@ -5,9 +5,6 @@
ifeq ($(MAKECMDGOALS),prereq) ifeq ($(MAKECMDGOALS),prereq)
SUBTARGETS:=prereq SUBTARGETS:=prereq
PREREQ_ONLY:=1 PREREQ_ONLY:=1
# For target/linux related target add dtb to selectively compile dtbs
else ifneq ($(filter target/linux/%,$(MAKECMDGOALS)),)
SUBTARGETS:=$(DEFAULT_SUBDIR_TARGETS) dtb
else else
SUBTARGETS:=$(DEFAULT_SUBDIR_TARGETS) SUBTARGETS:=$(DEFAULT_SUBDIR_TARGETS)
endif endif
@ -30,16 +27,14 @@ lastdir=$(word $(words $(subst /, ,$(1))),$(subst /, ,$(1)))
diralias=$(if $(findstring $(1),$(call lastdir,$(1))),,$(call lastdir,$(1))) diralias=$(if $(findstring $(1),$(call lastdir,$(1))),,$(call lastdir,$(1)))
subdir_make_opts = \ subdir_make_opts = \
$(if $(SUBDIR_MAKE_DEBUG),-d) -r -C $(1) \ -r -C $(1) \
BUILD_SUBDIR="$(1)" \ BUILD_SUBDIR="$(1)" \
BUILD_VARIANT="$(4)" \ BUILD_VARIANT="$(4)"
ALL_VARIANTS="$(5)"
# 1: subdir # 1: subdir
# 2: target # 2: target
# 3: build type # 3: build type
# 4: build variant # 4: build variant
# 5: all variants
log_make = \ log_make = \
$(if $(call debug,$(1),v),,@)+ \ $(if $(call debug,$(1),v),,@)+ \
$(if $(BUILD_LOG), \ $(if $(BUILD_LOG), \
@ -67,15 +62,15 @@ define subdir
$(foreach target,$(SUBTARGETS) $($(1)/subtargets), $(foreach target,$(SUBTARGETS) $($(1)/subtargets),
$(foreach btype,$(buildtypes-$(bd)), $(foreach btype,$(buildtypes-$(bd)),
$(call warn_eval,$(1)/$(bd),t,T,$(1)/$(bd)/$(btype)/$(target): $(if $(NO_DEPS)$(QUILT),,$($(1)/$(bd)/$(btype)/$(target)) $(call $(1)//$(btype)/$(target),$(1)/$(bd)/$(btype)))) $(call warn_eval,$(1)/$(bd),t,T,$(1)/$(bd)/$(btype)/$(target): $(if $(NO_DEPS)$(QUILT),,$($(1)/$(bd)/$(btype)/$(target)) $(call $(1)//$(btype)/$(target),$(1)/$(bd)/$(btype))))
$(call log_make,$(1)/$(bd),$(target),$(btype),$(filter-out __default,$(variant)),$($(1)/$(bd)/variants)) \ $(call log_make,$(1)/$(bd),$(target),$(btype),$(filter-out __default,$(variant))) \
|| $(call ERROR,$(2), ERROR: $(1)/$(bd) [$(btype)] failed to build.,$(findstring $(bd),$($(1)/builddirs-ignore-$(btype)-$(target)))) || $(call ERROR,$(2), ERROR: $(1)/$(bd) [$(btype)] failed to build.,$(findstring $(bd),$($(1)/builddirs-ignore-$(btype)-$(target))))
$(if $(call diralias,$(bd)),$(call warn_eval,$(1)/$(bd),l,T,$(1)/$(call diralias,$(bd))/$(btype)/$(target): $(1)/$(bd)/$(btype)/$(target))) $(if $(call diralias,$(bd)),$(call warn_eval,$(1)/$(bd),l,T,$(1)/$(call diralias,$(bd))/$(btype)/$(target): $(1)/$(bd)/$(btype)/$(target)))
) )
$(call warn_eval,$(1)/$(bd),t,T,$(1)/$(bd)/$(target): $(if $(NO_DEPS)$(QUILT),,$($(1)/$(bd)/$(target)) $(call $(1)//$(target),$(1)/$(bd)))) $(call warn_eval,$(1)/$(bd),t,T,$(1)/$(bd)/$(target): $(if $(NO_DEPS)$(QUILT),,$($(1)/$(bd)/$(target)) $(call $(1)//$(target),$(1)/$(bd))))
$(foreach variant,$(filter-out *,$(if $(BUILD_VARIANT),$(BUILD_VARIANT),$(if $(strip $($(1)/$(bd)/variants)),$($(1)/$(bd)/variants),$(if $($(1)/$(bd)/default-variant),$($(1)/$(bd)/default-variant),__default)))), $(foreach variant,$(if $(BUILD_VARIANT),$(BUILD_VARIANT),$(if $(strip $($(1)/$(bd)/variants)),$($(1)/$(bd)/variants),$(if $($(1)/$(bd)/default-variant),$($(1)/$(bd)/default-variant),__default))),
$(if $(BUILD_LOG),@mkdir -p $(BUILD_LOG_DIR)/$(1)/$(bd)/$(filter-out __default,$(variant))) $(if $(BUILD_LOG),@mkdir -p $(BUILD_LOG_DIR)/$(1)/$(bd)/$(filter-out __default,$(variant)))
$(if $($(1)/autoremove),$(call rebuild_check,$(1)/$(bd),$(target),,$(filter-out __default,$(variant)),$($(1)/$(bd)/variants))) $(if $($(1)/autoremove),$(call rebuild_check,$(1)/$(bd),$(target),,$(filter-out __default,$(variant))))
$(call log_make,$(1)/$(bd),$(target),,$(filter-out __default,$(variant)),$($(1)/$(bd)/variants)) \ $(call log_make,$(1)/$(bd),$(target),,$(filter-out __default,$(variant))) \
|| $(call ERROR,$(1), ERROR: $(1)/$(bd) failed to build$(if $(filter-out __default,$(variant)), (build variant: $(variant))).,$(findstring $(bd),$($(1)/builddirs-ignore-$(target)))) || $(call ERROR,$(1), ERROR: $(1)/$(bd) failed to build$(if $(filter-out __default,$(variant)), (build variant: $(variant))).,$(findstring $(bd),$($(1)/builddirs-ignore-$(target))))
) )
$(if $(PREREQ_ONLY)$(DUMP_TARGET_DB),, $(if $(PREREQ_ONLY)$(DUMP_TARGET_DB),,

View File

@ -12,7 +12,6 @@ DEVICE_TYPE?=router
# Default packages - the really basic set # Default packages - the really basic set
DEFAULT_PACKAGES:=\ DEFAULT_PACKAGES:=\
base-files \ base-files \
ca-bundle \
dropbear \ dropbear \
fstools \ fstools \
libc \ libc \
@ -24,8 +23,7 @@ DEFAULT_PACKAGES:=\
opkg \ opkg \
uci \ uci \
uclient-fetch \ uclient-fetch \
urandom-seed \ urandom-seed
urngd
ifneq ($(CONFIG_SELINUX),) ifneq ($(CONFIG_SELINUX),)
DEFAULT_PACKAGES+=busybox-selinux procd-selinux DEFAULT_PACKAGES+=busybox-selinux procd-selinux
@ -33,16 +31,6 @@ else
DEFAULT_PACKAGES+=busybox procd DEFAULT_PACKAGES+=busybox procd
endif endif
# include ujail on systems with enough storage
ifeq ($(CONFIG_SMALL_FLASH),)
DEFAULT_PACKAGES+=procd-ujail
endif
# include seccomp ld-preload hooks if kernel supports it
ifneq ($(CONFIG_SECCOMP),)
DEFAULT_PACKAGES+=procd-seccomp
endif
# For the basic set # For the basic set
DEFAULT_PACKAGES.basic:= DEFAULT_PACKAGES.basic:=
# For nas targets # For nas targets
@ -53,9 +41,9 @@ DEFAULT_PACKAGES.nas:=\
mdadm mdadm
# For router targets # For router targets
DEFAULT_PACKAGES.router:=\ DEFAULT_PACKAGES.router:=\
dnsmasq-full firewall iptables ppp ppp-mod-pppoe odhcp6c odhcpd-ipv6only ip6tables libip6tc kmod-ipt-nat6 \ dnsmasq-full firewall iptables ppp ppp-mod-pppoe \
block-mount coremark kmod-nf-nathelper kmod-nf-nathelper-extra kmod-ipt-raw kmod-tun \ block-mount coremark kmod-nf-nathelper kmod-nf-nathelper-extra kmod-ipt-raw kmod-tun \
iptables-mod-tproxy iptables-mod-extra ipset ip-full default-settings luci luci-proto-ipv6 \ iptables-mod-tproxy iptables-mod-extra ipset ip-full default-settings luci luci-newapi \
ddns-scripts_aliyun ddns-scripts_dnspod luci-app-ddns luci-app-upnp luci-app-autoreboot \ ddns-scripts_aliyun ddns-scripts_dnspod luci-app-ddns luci-app-upnp luci-app-autoreboot \
luci-app-arpbind luci-app-filetransfer luci-app-vsftpd luci-app-ssr-plus luci-app-vlmcsd \ luci-app-arpbind luci-app-filetransfer luci-app-vsftpd luci-app-ssr-plus luci-app-vlmcsd \
luci-app-accesscontrol luci-app-nlbwmon luci-app-turboacc luci-app-wol curl ca-certificates luci-app-accesscontrol luci-app-nlbwmon luci-app-turboacc luci-app-wol curl ca-certificates
@ -66,7 +54,7 @@ endif
target_conf=$(subst .,_,$(subst -,_,$(subst /,_,$(1)))) target_conf=$(subst .,_,$(subst -,_,$(subst /,_,$(1))))
ifeq ($(DUMP),) ifeq ($(DUMP),)
PLATFORM_DIR:=$(firstword $(wildcard $(TOPDIR)/target/linux/feeds/$(BOARD) $(TOPDIR)/target/linux/$(BOARD))) PLATFORM_DIR:=$(TOPDIR)/target/linux/$(BOARD)
SUBTARGET:=$(strip $(foreach subdir,$(patsubst $(PLATFORM_DIR)/%/target.mk,%,$(wildcard $(PLATFORM_DIR)/*/target.mk)),$(if $(CONFIG_TARGET_$(call target_conf,$(BOARD)_$(subdir))),$(subdir)))) SUBTARGET:=$(strip $(foreach subdir,$(patsubst $(PLATFORM_DIR)/%/target.mk,%,$(wildcard $(PLATFORM_DIR)/*/target.mk)),$(if $(CONFIG_TARGET_$(call target_conf,$(BOARD)_$(subdir))),$(subdir))))
else else
PLATFORM_DIR:=${CURDIR} PLATFORM_DIR:=${CURDIR}
@ -171,30 +159,22 @@ USE_SUBTARGET_CONFIG = $(if $(wildcard $(LINUX_TARGET_CONFIG)),,$(if $(LINUX_SUB
LINUX_RECONFIG_LIST = $(wildcard $(GENERIC_LINUX_CONFIG) $(LINUX_TARGET_CONFIG) $(if $(USE_SUBTARGET_CONFIG),$(LINUX_SUBTARGET_CONFIG))) LINUX_RECONFIG_LIST = $(wildcard $(GENERIC_LINUX_CONFIG) $(LINUX_TARGET_CONFIG) $(if $(USE_SUBTARGET_CONFIG),$(LINUX_SUBTARGET_CONFIG)))
LINUX_RECONFIG_TARGET = $(if $(USE_SUBTARGET_CONFIG),$(LINUX_SUBTARGET_CONFIG),$(LINUX_TARGET_CONFIG)) LINUX_RECONFIG_TARGET = $(if $(USE_SUBTARGET_CONFIG),$(LINUX_SUBTARGET_CONFIG),$(LINUX_TARGET_CONFIG))
CFG_TARGET = $(CONFIG_TARGET)
ifeq ($(CFG_TARGET),platform)
CFG_TARGET = target
$(warning Deprecation warning: use CONFIG_TARGET=target instead.)
else ifeq ($(CFG_TARGET),subtarget_platform)
CFG_TARGET = subtarget_target
$(warning Deprecation warning: use CONFIG_TARGET=subtarget_target instead.)
endif
# select the config file to be changed by kernel_menuconfig/kernel_oldconfig # select the config file to be changed by kernel_menuconfig/kernel_oldconfig
ifeq ($(CFG_TARGET),target) ifeq ($(CONFIG_TARGET),platform)
LINUX_RECONFIG_LIST = $(wildcard $(GENERIC_LINUX_CONFIG) $(LINUX_TARGET_CONFIG)) LINUX_RECONFIG_LIST = $(wildcard $(GENERIC_LINUX_CONFIG) $(LINUX_TARGET_CONFIG))
LINUX_RECONFIG_TARGET = $(LINUX_TARGET_CONFIG) LINUX_RECONFIG_TARGET = $(LINUX_TARGET_CONFIG)
else ifeq ($(CFG_TARGET),subtarget) endif
ifeq ($(CONFIG_TARGET),subtarget)
LINUX_RECONFIG_LIST = $(wildcard $(GENERIC_LINUX_CONFIG) $(LINUX_TARGET_CONFIG) $(LINUX_SUBTARGET_CONFIG)) LINUX_RECONFIG_LIST = $(wildcard $(GENERIC_LINUX_CONFIG) $(LINUX_TARGET_CONFIG) $(LINUX_SUBTARGET_CONFIG))
LINUX_RECONFIG_TARGET = $(LINUX_SUBTARGET_CONFIG) LINUX_RECONFIG_TARGET = $(LINUX_SUBTARGET_CONFIG)
else ifeq ($(CFG_TARGET),subtarget_target) endif
ifeq ($(CONFIG_TARGET),subtarget_platform)
LINUX_RECONFIG_LIST = $(wildcard $(GENERIC_LINUX_CONFIG) $(LINUX_SUBTARGET_CONFIG) $(LINUX_TARGET_CONFIG)) LINUX_RECONFIG_LIST = $(wildcard $(GENERIC_LINUX_CONFIG) $(LINUX_SUBTARGET_CONFIG) $(LINUX_TARGET_CONFIG))
LINUX_RECONFIG_TARGET = $(LINUX_TARGET_CONFIG) LINUX_RECONFIG_TARGET = $(LINUX_TARGET_CONFIG)
else ifeq ($(CFG_TARGET),env) endif
ifeq ($(CONFIG_TARGET),env)
LINUX_RECONFIG_LIST = $(LINUX_KCONFIG_LIST) LINUX_RECONFIG_LIST = $(LINUX_KCONFIG_LIST)
LINUX_RECONFIG_TARGET = $(TOPDIR)/env/kernel-config LINUX_RECONFIG_TARGET = $(TOPDIR)/env/kernel-config
else ifneq ($(strip $(CFG_TARGET)),)
$(error CONFIG_TARGET=$(CFG_TARGET) is invalid. Valid: target|subtarget|subtarget_target|env)
endif endif
__linux_confcmd = $(2) $(patsubst %,+,$(wordlist 2,9999,$(1))) $(1) __linux_confcmd = $(2) $(patsubst %,+,$(wordlist 2,9999,$(1))) $(1)
@ -233,14 +213,12 @@ ifeq ($(DUMP),1)
ifeq ($(ARCH),powerpc) ifeq ($(ARCH),powerpc)
CPU_CFLAGS_603e:=-mcpu=603e CPU_CFLAGS_603e:=-mcpu=603e
CPU_CFLAGS_8540:=-mcpu=8540 CPU_CFLAGS_8540:=-mcpu=8540
CPU_CFLAGS_8548:=-mcpu=8548
CPU_CFLAGS_405:=-mcpu=405 CPU_CFLAGS_405:=-mcpu=405
CPU_CFLAGS_440:=-mcpu=440 CPU_CFLAGS_440:=-mcpu=440
CPU_CFLAGS_464fp:=-mcpu=464fp CPU_CFLAGS_464fp:=-mcpu=464fp
endif endif
ifeq ($(ARCH),powerpc64) ifeq ($(ARCH),powerpc64)
CPU_TYPE ?= powerpc64 CPU_TYPE ?= powerpc64
CPU_CFLAGS_e5500:=-mcpu=e5500
CPU_CFLAGS_powerpc64:=-mcpu=powerpc64 CPU_CFLAGS_powerpc64:=-mcpu=powerpc64
endif endif
ifeq ($(ARCH),sparc) ifeq ($(ARCH),sparc)
@ -258,15 +236,6 @@ ifeq ($(DUMP),1)
CPU_CFLAGS_arc700 = -mcpu=arc700 CPU_CFLAGS_arc700 = -mcpu=arc700
CPU_CFLAGS_archs = -mcpu=archs CPU_CFLAGS_archs = -mcpu=archs
endif endif
ifeq ($(ARCH),riscv64)
CPU_TYPE ?= riscv64
CPU_CFLAGS_riscv64:=-mabi=lp64d -march=rv64imafdc
endif
ifeq ($(ARCH),loongarch64)
CPU_TYPE ?= generic
CPU_CFLAGS := -O2 -pipe
CPU_CFLAGS_generic:=-march=loongarch64
endif
ifneq ($(CPU_TYPE),) ifneq ($(CPU_TYPE),)
ifndef CPU_CFLAGS_$(CPU_TYPE) ifndef CPU_CFLAGS_$(CPU_TYPE)
$(warning CPU_TYPE "$(CPU_TYPE)" doesn't correspond to a known type) $(warning CPU_TYPE "$(CPU_TYPE)" doesn't correspond to a known type)

View File

@ -18,6 +18,6 @@ define FixupLibdir
mkdir -p $(1)/lib; \ mkdir -p $(1)/lib; \
mv $(1)/lib64/* $(1)/lib/; \ mv $(1)/lib64/* $(1)/lib/; \
rm -rf $(1)/lib64; \ rm -rf $(1)/lib64; \
ln -sf lib $(1)/lib64; \
fi fi
ln -sf lib $(1)/lib64
endef endef

View File

@ -51,12 +51,11 @@ path:=$(subst :,$(space),$(PATH))
path:=$(filter-out .%,$(path)) path:=$(filter-out .%,$(path))
path:=$(subst $(space),:,$(path)) path:=$(subst $(space),:,$(path))
export PATH:=$(path) export PATH:=$(path)
export STAGING_DIR_HOST:=$(if $(STAGING_DIR),$(abspath $(STAGING_DIR)/../host),$(TOPDIR)/staging_dir/host)
unexport TAR_OPTIONS unexport TAR_OPTIONS
ifeq ($(FORCE),) ifeq ($(FORCE),)
.config scripts/config/conf scripts/config/mconf: $(STAGING_DIR_HOST)/.prereq-build .config scripts/config/conf scripts/config/mconf: staging_dir/host/.prereq-build
endif endif
SCAN_COOKIE?=$(shell echo $$$$) SCAN_COOKIE?=$(shell echo $$$$)
@ -66,7 +65,7 @@ SUBMAKE:=umask 022; $(SUBMAKE)
ULIMIT_FIX=_limit=`ulimit -n`; [ "$$_limit" = "unlimited" -o "$$_limit" -ge 1024 ] || ulimit -n 1024; ULIMIT_FIX=_limit=`ulimit -n`; [ "$$_limit" = "unlimited" -o "$$_limit" -ge 1024 ] || ulimit -n 1024;
prepare-mk: $(STAGING_DIR_HOST)/.prereq-build FORCE ; prepare-mk: staging_dir/host/.prereq-build FORCE ;
ifdef SDK ifdef SDK
IGNORE_PACKAGES = linux IGNORE_PACKAGES = linux
@ -75,10 +74,10 @@ endif
_ignore = $(foreach p,$(IGNORE_PACKAGES),--ignore $(p)) _ignore = $(foreach p,$(IGNORE_PACKAGES),--ignore $(p))
prepare-tmpinfo: FORCE prepare-tmpinfo: FORCE
@+$(MAKE) -r -s $(STAGING_DIR_HOST)/.prereq-build $(PREP_MK) @+$(MAKE) -r -s staging_dir/host/.prereq-build $(PREP_MK)
mkdir -p tmp/info mkdir -p tmp/info
$(_SINGLE)$(NO_TRACE_MAKE) -j1 -r -s -f include/scan.mk SCAN_TARGET="packageinfo" SCAN_DIR="package" SCAN_NAME="package" SCAN_DEPTH=5 SCAN_EXTRA="" $(_SINGLE)$(NO_TRACE_MAKE) -j1 -r -s -f include/scan.mk SCAN_TARGET="packageinfo" SCAN_DIR="package" SCAN_NAME="package" SCAN_DEPTH=5 SCAN_EXTRA=""
$(_SINGLE)$(NO_TRACE_MAKE) -j1 -r -s -f include/scan.mk SCAN_TARGET="targetinfo" SCAN_DIR="target/linux" SCAN_NAME="target" SCAN_DEPTH=3 SCAN_EXTRA="" SCAN_MAKEOPTS="TARGET_BUILD=1" $(_SINGLE)$(NO_TRACE_MAKE) -j1 -r -s -f include/scan.mk SCAN_TARGET="targetinfo" SCAN_DIR="target/linux" SCAN_NAME="target" SCAN_DEPTH=2 SCAN_EXTRA="" SCAN_MAKEOPTS="TARGET_BUILD=1"
for type in package target; do \ for type in package target; do \
f=tmp/.$${type}info; t=tmp/.config-$${type}.in; \ f=tmp/.$${type}info; t=tmp/.config-$${type}.in; \
[ "$$t" -nt "$$f" ] || ./scripts/$${type}-metadata.pl $(_ignore) config "$$f" > "$$t" || { rm -f "$$t"; echo "Failed to build $$t"; false; break; }; \ [ "$$t" -nt "$$f" ] || ./scripts/$${type}-metadata.pl $(_ignore) config "$$f" > "$$t" || { rm -f "$$t"; echo "Failed to build $$t"; false; break; }; \
@ -102,7 +101,7 @@ ifneq ($(DISTRO_PKG_CONFIG),)
scripts/config/%onf: export PATH:=$(dir $(DISTRO_PKG_CONFIG)):$(PATH) scripts/config/%onf: export PATH:=$(dir $(DISTRO_PKG_CONFIG)):$(PATH)
endif endif
scripts/config/%onf: CFLAGS+= -O2 scripts/config/%onf: CFLAGS+= -O2
scripts/config/%onf: FORCE scripts/config/%onf:
@$(_SINGLE)$(SUBMAKE) $(if $(findstring s,$(OPENWRT_VERBOSE)),,-s) \ @$(_SINGLE)$(SUBMAKE) $(if $(findstring s,$(OPENWRT_VERBOSE)),,-s) \
-C scripts/config $(notdir $@) -C scripts/config $(notdir $@)
@ -152,7 +151,7 @@ xconfig: scripts/config/qconf prepare-tmpinfo FORCE
prepare_kernel_conf: .config toolchain/install FORCE prepare_kernel_conf: .config toolchain/install FORCE
ifeq ($(wildcard $(STAGING_DIR_HOST)/bin/quilt),) ifeq ($(wildcard staging_dir/host/bin/quilt),)
prepare_kernel_conf: prepare_kernel_conf:
@+$(SUBMAKE) -r tools/quilt/compile @+$(SUBMAKE) -r tools/quilt/compile
else else
@ -176,7 +175,7 @@ kernel_nconfig: prepare_kernel_conf
kernel_xconfig: prepare_kernel_conf kernel_xconfig: prepare_kernel_conf
$(_SINGLE)$(NO_TRACE_MAKE) -C target/linux xconfig $(_SINGLE)$(NO_TRACE_MAKE) -C target/linux xconfig
$(STAGING_DIR_HOST)/.prereq-build: include/prereq-build.mk staging_dir/host/.prereq-build: include/prereq-build.mk
mkdir -p tmp mkdir -p tmp
@$(_SINGLE)$(NO_TRACE_MAKE) -j1 -r -s -f $(TOPDIR)/include/prereq-build.mk prereq 2>/dev/null || { \ @$(_SINGLE)$(NO_TRACE_MAKE) -j1 -r -s -f $(TOPDIR)/include/prereq-build.mk prereq 2>/dev/null || { \
echo "Prerequisite check failed. Use FORCE=1 to override."; \ echo "Prerequisite check failed. Use FORCE=1 to override."; \
@ -199,7 +198,7 @@ else
DOWNLOAD_DIRS = package/download DOWNLOAD_DIRS = package/download
endif endif
download: .config FORCE $(if $(wildcard $(STAGING_DIR_HOST)/bin/flock),,tools/flock/compile) download: .config FORCE $(if $(wildcard $(TOPDIR)/staging_dir/host/bin/flock),,tools/flock/compile)
@+$(foreach dir,$(DOWNLOAD_DIRS),$(SUBMAKE) $(dir);) @+$(foreach dir,$(DOWNLOAD_DIRS),$(SUBMAKE) $(dir);)
clean dirclean: .config clean dirclean: .config
@ -263,7 +262,7 @@ distclean:
@$(_SINGLE)$(SUBMAKE) -C scripts/config clean @$(_SINGLE)$(SUBMAKE) -C scripts/config clean
ifeq ($(findstring v,$(DEBUG)),) ifeq ($(findstring v,$(DEBUG)),)
.SILENT: symlinkclean clean dirclean distclean config-clean download help tmpinfo-clean .config scripts/config/mconf scripts/config/conf menuconfig $(STAGING_DIR_HOST)/.prereq-build tmp/.prereq-package prepare-tmpinfo .SILENT: symlinkclean clean dirclean distclean config-clean download help tmpinfo-clean .config scripts/config/mconf scripts/config/conf menuconfig staging_dir/host/.prereq-build tmp/.prereq-package prepare-tmpinfo
endif endif
.PHONY: help FORCE .PHONY: help FORCE
.NOTPARALLEL: .NOTPARALLEL:

View File

@ -1,9 +1,9 @@
PKG_NAME ?= trusted-firmware-a PKG_NAME ?= trusted-firmware-a
PKG_CPE_ID ?= cpe:/a:arm:trusted_firmware-a PKG_CPE_ID ?= cpe:/a:arm:arm_trusted_firmware
ifndef PKG_SOURCE_PROTO ifndef PKG_SOURCE_PROTO
PKG_SOURCE = trusted-firmware-a-$(PKG_VERSION).tar.gz PKG_SOURCE = trusted-firmware-a-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/TrustedFirmware-A/trusted-firmware-a/tar.gz/v$(PKG_VERSION)? PKG_SOURCE_URL:=https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/snapshot
endif endif
PKG_BUILD_DIR = $(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) PKG_BUILD_DIR = $(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
@ -68,20 +68,13 @@ define Build/Trusted-Firmware-A/Target
endef endef
endef endef
define Build/Configure/Trusted-Firmware-A
$(INSTALL_DIR) $(STAGING_DIR)/usr/include
endef
DTC=$(wildcard $(LINUX_DIR)/scripts/dtc/dtc)
define Build/Compile/Trusted-Firmware-A define Build/Compile/Trusted-Firmware-A
+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \ +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
CROSS_COMPILE=$(TARGET_CROSS) \ CROSS_COMPILE=$(TARGET_CROSS) \
OPENSSL_DIR=$(STAGING_DIR_HOST) \ OPENSSL_DIR=$(STAGING_DIR_HOST) \
$(if $(DTC),DTC="$(DTC)") \
PLAT=$(PLAT) \ PLAT=$(PLAT) \
BUILD_STRING="OpenWrt v$(PKG_VERSION)-$(PKG_RELEASE) ($(VARIANT))" \ BUILD_STRING="OpenWrt v$(PKG_VERSION)-$(PKG_RELEASE) ($(VARIANT))" \
$(if $(CONFIG_BINUTILS_VERSION_2_37)$(CONFIG_BINUTILS_VERSION_2_38),,LDFLAGS="-no-warn-rwx-segments") \
$(TFA_MAKE_FLAGS) $(TFA_MAKE_FLAGS)
endef endef

View File

@ -16,7 +16,7 @@ PKG_FLAGS:=nonshared
PKG_LICENSE:=GPL-2.0 GPL-2.0+ PKG_LICENSE:=GPL-2.0 GPL-2.0+
PKG_LICENSE_FILES:=Licenses/README PKG_LICENSE_FILES:=Licenses/README
PKG_BUILD_PARALLEL ?= 1 PKG_BUILD_PARALLEL:=1
export GCC_HONOUR_COPTS=s export GCC_HONOUR_COPTS=s
@ -45,11 +45,6 @@ UBOOT_MAKE_FLAGS = \
HOSTCC="$(HOSTCC)" \ HOSTCC="$(HOSTCC)" \
HOSTCFLAGS="$(HOST_CFLAGS) $(HOST_CPPFLAGS) -std=gnu11" \ HOSTCFLAGS="$(HOST_CFLAGS) $(HOST_CPPFLAGS) -std=gnu11" \
HOSTLDFLAGS="$(HOST_LDFLAGS)" \ HOSTLDFLAGS="$(HOST_LDFLAGS)" \
LOCALVERSION="-OpenWrt-$(REVISION)" \
STAGING_PREFIX="$(STAGING_DIR_HOST)" \
PKG_CONFIG_PATH="$(STAGING_DIR_HOST)/lib/pkgconfig" \
PKG_CONFIG_LIBDIR="$(STAGING_DIR_HOST)/lib/pkgconfig" \
PKG_CONFIG_EXTRAARGS="--static" \
$(if $(findstring c,$(OPENWRT_VERBOSE)),V=1,V='') $(if $(findstring c,$(OPENWRT_VERBOSE)),V=1,V='')
define Build/U-Boot/Target define Build/U-Boot/Target

View File

@ -1,2 +1,16 @@
$(warn uclibc++.mk is deprecated. Please remove it and CXX_DEPENDS) ifndef DUMP
CXX_DEPENDS = +libstdcpp ifdef __package_mk
$(error uclibc++.mk must be included before package.mk)
endif
endif
PKG_PREPARED_DEPENDS += CONFIG_USE_UCLIBCXX
CXX_DEPENDS = +USE_UCLIBCXX:uclibcxx +USE_LIBSTDCXX:libstdcpp
ifneq ($(CONFIG_USE_UCLIBCXX),)
ifneq ($(CONFIG_CCACHE),)
TARGET_CXX_NOCACHE=g++-uc
else
TARGET_CXX=g++-uc
endif
endif

View File

@ -18,7 +18,7 @@ ifeq ($(strip $(UNPACK_CMD)),)
ifeq ($(filter gz tgz,$(EXT)),$(EXT)) ifeq ($(filter gz tgz,$(EXT)),$(EXT))
EXT:=$(call ext,$(PKG_SOURCE:.$(EXT)=)) EXT:=$(call ext,$(PKG_SOURCE:.$(EXT)=))
DECOMPRESS_CMD:=$(STAGING_DIR_HOST)/bin/libdeflate-gzip -dc $(DL_DIR)/$(PKG_SOURCE) | DECOMPRESS_CMD:=gzip -dc $(DL_DIR)/$(PKG_SOURCE) |
endif endif
ifeq ($(filter bzip2 bz2 bz tbz2 tbz,$(EXT)),$(EXT)) ifeq ($(filter bzip2 bz2 bz tbz2 tbz,$(EXT)),$(EXT))
EXT:=$(call ext,$(PKG_SOURCE:.$(EXT)=)) EXT:=$(call ext,$(PKG_SOURCE:.$(EXT)=))
@ -56,7 +56,7 @@ ifeq ($(strip $(UNPACK_CMD)),)
endif endif
# replace zcat with $(ZCAT), because some system don't support it properly # replace zcat with $(ZCAT), because some system don't support it properly
ifeq ($(PKG_CAT),zcat) ifeq ($(PKG_CAT),zcat)
UNPACK_CMD=$(STAGING_DIR_HOST)/bin/libdeflate-gzip -dc $(DL_DIR)/$(PKG_SOURCE) | $(TAR_CMD) UNPACK_CMD=gzip -dc $(DL_DIR)/$(PKG_SOURCE) | $(TAR_CMD)
endif endif
endif endif
endif endif

View File

@ -29,15 +29,15 @@ ifeq ($(IS_TTY),1)
endif endif
endif endif
define ERROR_MESSAGE
printf "$(_R)%s$(_N)\n" "$(1)" >&8
endef
ifeq ($(findstring s,$(OPENWRT_VERBOSE)),) ifeq ($(findstring s,$(OPENWRT_VERBOSE)),)
define MESSAGE define MESSAGE
printf "$(_Y)%s$(_N)\n" "$(1)" >&8 printf "$(_Y)%s$(_N)\n" "$(1)" >&8
endef endef
define ERROR_MESSAGE
printf "$(_R)%s$(_N)\n" "$(1)" >&8
endef
ifeq ($(QUIET),1) ifeq ($(QUIET),1)
ifneq ($(CURDIR),$(TOPDIR)) ifneq ($(CURDIR),$(TOPDIR))
_DIR:=$(patsubst $(TOPDIR)/%,%,${CURDIR}) _DIR:=$(patsubst $(TOPDIR)/%,%,${CURDIR})
@ -60,4 +60,5 @@ else
define MESSAGE define MESSAGE
printf "%s\n" "$(1)" printf "%s\n" "$(1)"
endef endef
ERROR_MESSAGE=$(MESSAGE)
endif endif

View File

@ -23,13 +23,13 @@ PKG_CONFIG_DEPENDS += \
sanitize = $(call tolower,$(subst _,-,$(subst $(space),-,$(1)))) sanitize = $(call tolower,$(subst _,-,$(subst $(space),-,$(1))))
VERSION_NUMBER:=$(call qstrip,$(CONFIG_VERSION_NUMBER)) VERSION_NUMBER:=$(call qstrip,$(CONFIG_VERSION_NUMBER))
VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),24.10.1) VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),SNAPSHOT)
VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE)) VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE))
VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),$(REVISION)) VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),$(REVISION))
VERSION_REPO:=$(call qstrip,$(CONFIG_VERSION_REPO)) VERSION_REPO:=$(call qstrip,$(CONFIG_VERSION_REPO))
VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/24.10.1) VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/snapshots)
VERSION_DIST:=$(call qstrip,$(CONFIG_VERSION_DIST)) VERSION_DIST:=$(call qstrip,$(CONFIG_VERSION_DIST))
VERSION_DIST:=$(if $(VERSION_DIST),$(VERSION_DIST),OpenWrt) VERSION_DIST:=$(if $(VERSION_DIST),$(VERSION_DIST),OpenWrt)

View File

@ -23,7 +23,6 @@ PKG_LICENSE:=GPL-2.0
PKG_CONFIG_DEPENDS += \ PKG_CONFIG_DEPENDS += \
CONFIG_SIGNED_PACKAGES CONFIG_TARGET_INIT_PATH CONFIG_TARGET_PREINIT_DISABLE_FAILSAFE \ CONFIG_SIGNED_PACKAGES CONFIG_TARGET_INIT_PATH CONFIG_TARGET_PREINIT_DISABLE_FAILSAFE \
CONFIG_NAND_SUPPORT \ CONFIG_NAND_SUPPORT \
CONFIG_LEGACY_SDCARD_SUPPORT \
CONFIG_EMMC_SUPPORT \ CONFIG_EMMC_SUPPORT \
CONFIG_CLEAN_IPKG \ CONFIG_CLEAN_IPKG \
CONFIG_PER_FEED_REPO \ CONFIG_PER_FEED_REPO \
@ -40,7 +39,7 @@ define Package/base-files
SECTION:=base SECTION:=base
CATEGORY:=Base system CATEGORY:=Base system
DEPENDS:=+netifd +libc +jsonfilter +SIGNED_PACKAGES:usign +SIGNED_PACKAGES:openwrt-keyring +NAND_SUPPORT:ubi-utils +fstools +fwtool DEPENDS:=+netifd +libc +jsonfilter +SIGNED_PACKAGES:usign +SIGNED_PACKAGES:openwrt-keyring +NAND_SUPPORT:ubi-utils +fstools +fwtool
TITLE:=Base filesystem for LEDE TITLE:=Base filesystem for OpenWrt
URL:=http://openwrt.org/ URL:=http://openwrt.org/
VERSION:=$(PKG_RELEASE)-$(REVISION) VERSION:=$(PKG_RELEASE)-$(REVISION)
endef endef
@ -49,6 +48,7 @@ define Package/base-files/conffiles
/etc/config/ /etc/config/
/etc/config/network /etc/config/network
/etc/config/system /etc/config/system
/etc/crontabs/
/etc/dropbear/ /etc/dropbear/
/etc/ethers /etc/ethers
/etc/group /etc/group
@ -89,19 +89,6 @@ define ImageConfigOptions
echo 'pi_preinit_net_messages="$(CONFIG_TARGET_PREINIT_SHOW_NETMSG)"' >>$(1)/lib/preinit/00_preinit.conf echo 'pi_preinit_net_messages="$(CONFIG_TARGET_PREINIT_SHOW_NETMSG)"' >>$(1)/lib/preinit/00_preinit.conf
echo 'pi_preinit_no_failsafe_netmsg="$(CONFIG_TARGET_PREINIT_SUPPRESS_FAILSAFE_NETMSG)"' >>$(1)/lib/preinit/00_preinit.conf echo 'pi_preinit_no_failsafe_netmsg="$(CONFIG_TARGET_PREINIT_SUPPRESS_FAILSAFE_NETMSG)"' >>$(1)/lib/preinit/00_preinit.conf
echo 'pi_preinit_no_failsafe="$(CONFIG_TARGET_PREINIT_DISABLE_FAILSAFE)"' >>$(1)/lib/preinit/00_preinit.conf echo 'pi_preinit_no_failsafe="$(CONFIG_TARGET_PREINIT_DISABLE_FAILSAFE)"' >>$(1)/lib/preinit/00_preinit.conf
ifeq ($(CONFIG_TARGET_DEFAULT_LAN_IP_FROM_PREINIT),y)
mkdir -p $(1)/etc/board.d
echo '. /lib/functions/uci-defaults.sh' >$(1)/etc/board.d/99-lan-ip
echo 'logger -t 99-lan-ip "setting custom default LAN IP"' >>$(1)/etc/board.d/99-lan-ip
echo 'board_config_update' >>$(1)/etc/board.d/99-lan-ip
echo 'json_select network' >>$(1)/etc/board.d/99-lan-ip
echo 'json_select lan' >>$(1)/etc/board.d/99-lan-ip
echo 'json_add_string ipaddr $(if $(CONFIG_TARGET_PREINIT_IP),$(CONFIG_TARGET_PREINIT_IP),"192.168.1.1")' >>$(1)/etc/board.d/99-lan-ip
echo 'json_add_string netmask $(if $(CONFIG_TARGET_PREINIT_NETMASK),$(CONFIG_TARGET_PREINIT_NETMASK),"255.255.255.0")' >>$(1)/etc/board.d/99-lan-ip
echo 'json_select ..' >>$(1)/etc/board.d/99-lan-ip
echo 'json_select ..' >>$(1)/etc/board.d/99-lan-ip
echo 'board_config_flush' >>$(1)/etc/board.d/99-lan-ip
endif
endef endef
define Build/Prepare define Build/Prepare
@ -138,12 +125,6 @@ ifeq ($(CONFIG_NAND_SUPPORT),)
endef endef
endif endif
ifeq ($(CONFIG_LEGACY_SDCARD_SUPPORT),)
define Package/base-files/legacy-sdcard-support
rm -f $(1)/lib/upgrade/legacy-sdcard.sh
endef
endif
ifeq ($(CONFIG_EMMC_SUPPORT),) ifeq ($(CONFIG_EMMC_SUPPORT),)
define Package/base-files/emmc-support define Package/base-files/emmc-support
rm -f $(1)/lib/upgrade/emmc.sh rm -f $(1)/lib/upgrade/emmc.sh
@ -154,7 +135,6 @@ define Package/base-files/install
$(CP) ./files/* $(1)/ $(CP) ./files/* $(1)/
$(Package/base-files/install-key) $(Package/base-files/install-key)
$(Package/base-files/nand-support) $(Package/base-files/nand-support)
$(Package/base-files/legacy-sdcard-support)
$(Package/base-files/emmc-support) $(Package/base-files/emmc-support)
if [ -d $(GENERIC_PLATFORM_DIR)/base-files/. ]; then \ if [ -d $(GENERIC_PLATFORM_DIR)/base-files/. ]; then \
$(CP) $(GENERIC_PLATFORM_DIR)/base-files/* $(1)/; \ $(CP) $(GENERIC_PLATFORM_DIR)/base-files/* $(1)/; \
@ -238,10 +218,6 @@ endif
$(if $(CONFIG_TARGET_PREINIT_DISABLE_FAILSAFE), \ $(if $(CONFIG_TARGET_PREINIT_DISABLE_FAILSAFE), \
rm -f $(1)/etc/banner.failsafe,) rm -f $(1)/etc/banner.failsafe,)
if [ -f $(TOPDIR)/feeds/luci/package.json ]; then \
$(CP) ./luci2/* $(1)/; \
fi
endef endef
ifneq ($(DUMP),1) ifneq ($(DUMP),1)

View File

@ -192,15 +192,6 @@ generate_network() {
EOF EOF
} }
;; ;;
ncm|\
qmi|\
mbim)
uci -q batch <<-EOF
set network.$1.proto='${protocol}'
set network.$1.pdptype='ipv4'
EOF
;;
esac esac
} }
@ -296,7 +287,7 @@ generate_static_system() {
uci -q batch <<-EOF uci -q batch <<-EOF
delete system.@system[0] delete system.@system[0]
add system system add system system
set system.@system[-1].hostname='LEDE' set system.@system[-1].hostname='OpenWrt'
set system.@system[-1].timezone='UTC' set system.@system[-1].timezone='UTC'
set system.@system[-1].ttylogin='0' set system.@system[-1].ttylogin='0'
set system.@system[-1].log_size='64' set system.@system[-1].log_size='64'
@ -305,11 +296,11 @@ generate_static_system() {
delete system.ntp delete system.ntp
set system.ntp='timeserver' set system.ntp='timeserver'
set system.ntp.enabled='1' set system.ntp.enabled='1'
set system.ntp.enable_server='1' set system.ntp.enable_server='0'
add_list system.ntp.server='time.apple.com' add_list system.ntp.server='ntp.aliyun.com'
add_list system.ntp.server='time.google.com' add_list system.ntp.server='time1.cloud.tencent.com'
add_list system.ntp.server='time.windows.com' add_list system.ntp.server='time.ustc.edu.cn'
add_list system.ntp.server='time.cloudflare.com' add_list system.ntp.server='cn.pool.ntp.org'
EOF EOF
if json_is_a system object; then if json_is_a system object; then

View File

@ -1,5 +1,6 @@
#!/usr/bin/awk -f #!/bin/sh
awk -f - $* <<EOF
function bitcount(c) { function bitcount(c) {
c=and(rshift(c, 1),0x55555555)+and(c,0x55555555) c=and(rshift(c, 1),0x55555555)+and(c,0x55555555)
c=and(rshift(c, 2),0x33333333)+and(c,0x33333333) c=and(rshift(c, 2),0x33333333)+and(c,0x33333333)
@ -10,20 +11,14 @@ function bitcount(c) {
} }
function ip2int(ip) { function ip2int(ip) {
ret=0 for (ret=0,n=split(ip,a,"\."),x=1;x<=n;x++) ret=or(lshift(ret,8),a[x])
n=split(ip,a,"\\.")
for (x=1;x<=n;x++)
ret=or(lshift(ret,8),a[x])
return ret return ret
} }
function int2ip(ip,ret,x) { function int2ip(ip,ret,x) {
ret=and(ip,255) ret=and(ip,255)
ip=rshift(ip,8) ip=rshift(ip,8)
for(;x<3;x++) { for(;x<3;ret=and(ip,255)"."ret,ip=rshift(ip,8),x++);
ret=and(ip,255)"."ret
ip=rshift(ip,8)
}
return ret return ret
} }
@ -49,40 +44,28 @@ BEGIN {
} }
network=and(ipaddr,netmask) network=and(ipaddr,netmask)
prefix=32-bitcount(compl32(netmask))
broadcast=or(network,compl32(netmask)) broadcast=or(network,compl32(netmask))
start=or(network,and(ip2int(ARGV[3]),compl32(netmask)))
limit=network+1
if (start<limit) start=limit
end=start+ARGV[4]
limit=or(network,compl32(netmask))-1
if (end>limit) end=limit
print "IP="int2ip(ipaddr) print "IP="int2ip(ipaddr)
print "NETMASK="int2ip(netmask) print "NETMASK="int2ip(netmask)
print "BROADCAST="int2ip(broadcast) print "BROADCAST="int2ip(broadcast)
print "NETWORK="int2ip(network) print "NETWORK="int2ip(network)
print "PREFIX="prefix print "PREFIX="32-bitcount(compl32(netmask))
# range calculations: # range calculations:
# ipcalc <ip> <netmask> <start> <num> # ipcalc <ip> <netmask> <start> <num>
if (ARGC <= 3) if (ARGC > 3) {
exit(0)
start=or(network,and(ip2int(ARGV[3]),compl32(netmask)))
limit=network+1
if (start<limit) start=limit
if (start==ipaddr) start=ipaddr+1
end=start+ARGV[4]
limit=or(network,compl32(netmask))-1
if (end>limit) end=limit
if (end==ipaddr) end=ipaddr-1
if (start>end) {
print "network ("int2ip(network)"/"prefix") too small" > "/dev/stderr"
exit(1)
}
if (ipaddr > start && ipaddr < end) {
print "warning: ipaddr inside range - this might not be supported in future releases of Openwrt" > "/dev/stderr"
}
print "START="int2ip(start) print "START="int2ip(start)
print "END="int2ip(end) print "END="int2ip(end)
} }
}
EOF

View File

@ -48,7 +48,6 @@ boot() {
/bin/config_generate /bin/config_generate
uci_apply_defaults uci_apply_defaults
sync
# temporary hack until configd exists # temporary hack until configd exists
/sbin/reload_config /sbin/reload_config

View File

@ -29,7 +29,7 @@ load_led() {
config_get delay $1 delay "150" config_get delay $1 delay "150"
config_get message $1 message "" config_get message $1 message ""
config_get gpio $1 gpio "0" config_get gpio $1 gpio "0"
config_get_bool inverted $1 inverted "0" config_get inverted $1 inverted "0"
# execute application led trigger # execute application led trigger
[ -f "/usr/libexec/led-trigger/${trigger}" ] && { [ -f "/usr/libexec/led-trigger/${trigger}" ] && {
@ -69,10 +69,6 @@ load_led() {
return 1 return 1
} }
case "$trigger" in case "$trigger" in
"heartbeat")
echo "${inverted}" > "/sys/class/leds/${sysfs}/invert"
;;
"netdev") "netdev")
[ -n "$dev" ] && { [ -n "$dev" ] && {
echo $dev > /sys/class/leds/${sysfs}/device_name echo $dev > /sys/class/leds/${sysfs}/device_name

View File

@ -8,33 +8,23 @@ RTC_DEV=/dev/rtc0
HWCLOCK=/sbin/hwclock HWCLOCK=/sbin/hwclock
boot() { boot() {
hwclock_load start && exit 0
local maxtime="$(find_max_time)"
local maxtime="$(maxtime)"
local curtime="$(date +%s)" local curtime="$(date +%s)"
if [ $curtime -lt $maxtime ]; then [ $curtime -lt $maxtime ] && date -s @$maxtime
date -s @$maxtime
hwclock_save
fi
} }
start() { start() {
hwclock_load
}
stop() {
hwclock_save
}
hwclock_load() {
[ -e "$RTC_DEV" ] && [ -e "$HWCLOCK" ] && $HWCLOCK -s -u -f $RTC_DEV [ -e "$RTC_DEV" ] && [ -e "$HWCLOCK" ] && $HWCLOCK -s -u -f $RTC_DEV
} }
hwclock_save(){ stop() {
[ -e "$RTC_DEV" ] && [ -e "$HWCLOCK" ] && $HWCLOCK -w -u -f $RTC_DEV && \ [ -e "$RTC_DEV" ] && [ -e "$HWCLOCK" ] && $HWCLOCK -w -u -f $RTC_DEV && \
logger -t sysfixtime "saved '$(date)' to $RTC_DEV" logger -t sysfixtime "saved '$(date)' to $RTC_DEV"
} }
find_max_time() { maxtime() {
local file newest local file newest
for file in $( find /etc -type f ) ; do for file in $( find /etc -type f ) ; do

View File

@ -4,9 +4,10 @@
START=10 START=10
USE_PROCD=1 USE_PROCD=1
validate_system_section() { validate_system_section()
{
uci_load_validate system system "$1" "$2" \ uci_load_validate system system "$1" "$2" \
'hostname:string:LEDE' \ 'hostname:string:OpenWrt' \
'conloglevel:uinteger' \ 'conloglevel:uinteger' \
'buffersize:uinteger' \ 'buffersize:uinteger' \
'timezone:string:UTC' \ 'timezone:string:UTC' \
@ -22,9 +23,8 @@ system_config() {
echo "$hostname" > /proc/sys/kernel/hostname echo "$hostname" > /proc/sys/kernel/hostname
[ -z "$conloglevel" -a -z "$buffersize" ] || dmesg ${conloglevel:+-n $conloglevel} ${buffersize:+-s $buffersize} [ -z "$conloglevel" -a -z "$buffersize" ] || dmesg ${conloglevel:+-n $conloglevel} ${buffersize:+-s $buffersize}
echo "$timezone" > /tmp/TZ echo "$timezone" > /tmp/TZ
[ -n "$zonename" ] && [ -f "/usr/share/zoneinfo/${zonename// /_}" ] \ [ -n "$zonename" ] && [ -f "/usr/share/zoneinfo/$zonename" ] && \
&& ln -sf "/usr/share/zoneinfo/${zonename// /_}" /tmp/localtime \ ln -sf "/usr/share/zoneinfo/$zonename" /tmp/localtime && rm -f /tmp/TZ
&& rm -f /tmp/TZ
# apply timezone to kernel # apply timezone to kernel
hwclock -u --systz hwclock -u --systz
@ -35,7 +35,8 @@ reload_service() {
config_foreach validate_system_section system system_config config_foreach validate_system_section system system_config
} }
service_triggers() { service_triggers()
{
procd_add_reload_trigger "system" procd_add_reload_trigger "system"
procd_add_validation validate_system_section procd_add_validation validate_system_section
} }

View File

@ -3,7 +3,7 @@
[ -f /etc/banner ] && cat /etc/banner [ -f /etc/banner ] && cat /etc/banner
[ -n "$FAILSAFE" ] && cat /etc/banner.failsafe [ -n "$FAILSAFE" ] && cat /etc/banner.failsafe
grep -Fsq '/ overlay ro,' /proc/mounts && { fgrep -sq '/ overlay ro,' /proc/mounts && {
echo 'Your JFFS2-partition seems full and overlayfs is mounted read-only.' echo 'Your JFFS2-partition seems full and overlayfs is mounted read-only.'
echo 'Please try to remove files from /overlay/upper/... and reboot!' echo 'Please try to remove files from /overlay/upper/... and reboot!'
} }

View File

@ -55,12 +55,7 @@ enable() {
enabled() { enabled() {
name="$(basename "${initscript}")" name="$(basename "${initscript}")"
name="${name##[SK][0-9][0-9]}" [ -x "$IPKG_INSTROOT/etc/rc.d/S${START}${name##S[0-9][0-9]}" ]
{
[ -z "${START:-}" ] || [ -L "$IPKG_INSTROOT/etc/rc.d/S${START}$name" ]
} && {
[ -z "${STOP:-}" ] || [ -L "$IPKG_INSTROOT/etc/rc.d/K${STOP}$name" ]
}
} }
depends() { depends() {
@ -105,9 +100,9 @@ service_data() {
} }
service_running() { service_running() {
local instance="${1:-*}" local service="${1:-$(basename $initscript)}"
local instance="${2:-*}"
procd_running "$(basename $initscript)" "$instance" procd_running "$service" "$instance" "$@"
} }
${INIT_TRACE:+set -x} ${INIT_TRACE:+set -x}
@ -126,7 +121,6 @@ extra_command "enabled" "Check if service is started on boot"
extra_command "running" "Check if service is running" extra_command "running" "Check if service is running"
extra_command "status" "Service status" extra_command "status" "Service status"
extra_command "trace" "Start with syscall trace" extra_command "trace" "Start with syscall trace"
extra_command "info" "Dump procd service info"
. $IPKG_INSTROOT/lib/functions/procd.sh . $IPKG_INSTROOT/lib/functions/procd.sh
basescript=$(readlink "$initscript") basescript=$(readlink "$initscript")
@ -150,13 +144,6 @@ extra_command "enabled" "Check if service is started on boot"
start "$@" start "$@"
} }
info() {
json_init
json_add_string name "$(basename ${basescript:-$initscript})"
json_add_boolean verbose "1"
_procd_ubus_call list
}
stop() { stop() {
procd_lock procd_lock
stop_service "$@" stop_service "$@"

View File

@ -1,4 +1,4 @@
root:::0:99999:7::: root::0:0:99999:7:::
daemon:*:0:0:99999:7::: daemon:*:0:0:99999:7:::
ftp:*:0:0:99999:7::: ftp:*:0:0:99999:7:::
network:*:0:0:99999:7::: network:*:0:0:99999:7:::

View File

@ -8,5 +8,26 @@ alias ll='ls -alF --color=auto'
[ -x /usr/bin/arp -o -x /sbin/arp ] || arp() { cat /proc/net/arp; } [ -x /usr/bin/arp -o -x /sbin/arp ] || arp() { cat /proc/net/arp; }
[ -x /usr/bin/ldd ] || ldd() { LD_TRACE_LOADED_OBJECTS=1 $*; } [ -x /usr/bin/ldd ] || ldd() { LD_TRACE_LOADED_OBJECTS=1 $*; }
service() {
if [ -f "/etc/init.d/$1" ]; then
/etc/init.d/$@
else
echo "Usage: service <service> [command]"
if [ -n "$1" ]; then
echo "Service "'"'"$1"'"'" not found, the following services are available:"
else
echo "The following services are available:"
fi
for F in /etc/init.d/* ; do
printf "%-30s\t%10s\t%10s\n" "$F" \
$( $($F enabled) && echo "enabled" || echo "disabled" ) \
$( [ "$(ubus call service list "{ 'verbose': true, 'name': '$(basename $F)' }" \
| jsonfilter -q -e "@['$(basename $F)'].instances[*].running" | uniq)" = "true" ] \
&& echo "running" || echo "stopped" )
done;
return 1
fi
}
[ -n "$KSH_VERSION" -o \! -s "$HOME/.shinit" ] || . "$HOME/.shinit" [ -n "$KSH_VERSION" -o \! -s "$HOME/.shinit" ] || . "$HOME/.shinit"
[ -z "$KSH_VERSION" -o \! -s "$HOME/.mkshrc" ] || . "$HOME/.mkshrc" [ -z "$KSH_VERSION" -o \! -s "$HOME/.mkshrc" ] || . "$HOME/.mkshrc"

View File

@ -1,5 +1 @@
# Defaults are configured in /etc/sysctl.d/* and can be customized in this file # Defaults are configured in /etc/sysctl.d/* and can be customized in this file
net.bridge.bridge-nf-call-arptables = 0
net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 0

View File

@ -9,7 +9,6 @@ fs.protected_hardlinks=1
fs.protected_symlinks=1 fs.protected_symlinks=1
net.core.bpf_jit_enable=1 net.core.bpf_jit_enable=1
net.core.bpf_jit_kallsyms=1
net.ipv4.conf.default.arp_ignore=1 net.ipv4.conf.default.arp_ignore=1
net.ipv4.conf.all.arp_ignore=1 net.ipv4.conf.all.arp_ignore=1

View File

@ -209,10 +209,10 @@ add_group_and_user() {
if [ -n "$rusers" ]; then if [ -n "$rusers" ]; then
local tuple oIFS="$IFS" local tuple oIFS="$IFS"
for tuple in $rusers; do for tuple in $rusers; do
local uid gid uname gname addngroups addngroup addngname addngid local uid gid uname gname
IFS=":" IFS=":"
set -- $tuple; uname="$1"; gname="$2"; addngroups="$3" set -- $tuple; uname="$1"; gname="$2"
IFS="=" IFS="="
set -- $uname; uname="$1"; uid="$2" set -- $uname; uname="$1"; uid="$2"
set -- $gname; gname="$1"; gid="$2" set -- $gname; gname="$1"; gid="$2"
@ -232,24 +232,7 @@ add_group_and_user() {
group_add_user "$gname" "$uname" group_add_user "$gname" "$uname"
fi fi
if [ -n "$uname" ] && [ -n "$addngroups" ]; then unset uid gid uname gname
oIFS="$IFS"
IFS=","
for addngroup in $addngroups ; do
IFS="="
set -- $addngroup; addngname="$1"; addngid="$2"
if [ -n "$addngid" ]; then
group_exists "$addngname" || group_add "$addngname" "$addngid"
else
group_add_next "$addngname"
fi
group_add_user "$addngname" "$uname"
done
IFS="$oIFS"
fi
unset uid gid uname gname addngroups addngroup addngname addngid
done done
fi fi
} }
@ -262,6 +245,11 @@ default_postinst() {
add_group_and_user "${pkgname}" add_group_and_user "${pkgname}"
if [ -f "$root/usr/lib/opkg/info/${pkgname}.postinst-pkg" ]; then
( . "$root/usr/lib/opkg/info/${pkgname}.postinst-pkg" )
ret=$?
fi
if [ -d "$root/rootfs-overlay" ]; then if [ -d "$root/rootfs-overlay" ]; then
cp -R $root/rootfs-overlay/. $root/ cp -R $root/rootfs-overlay/. $root/
rm -fR $root/rootfs-overlay/ rm -fR $root/rootfs-overlay/
@ -287,11 +275,6 @@ default_postinst() {
rm -f /tmp/luci-indexcache rm -f /tmp/luci-indexcache
fi fi
if [ -f "$root/usr/lib/opkg/info/${pkgname}.postinst-pkg" ]; then
( . "$root/usr/lib/opkg/info/${pkgname}.postinst-pkg" )
ret=$?
fi
local shell="$(command -v bash)" local shell="$(command -v bash)"
for i in $(grep -s "^/etc/init.d/" "$root$filelist"); do for i in $(grep -s "^/etc/init.d/" "$root$filelist"); do
if [ -n "$root" ]; then if [ -n "$root" ]; then
@ -371,7 +354,7 @@ group_add_next() {
return return
fi fi
gids=$(cut -d: -f3 ${IPKG_INSTROOT}/etc/group) gids=$(cut -d: -f3 ${IPKG_INSTROOT}/etc/group)
gid=32768 gid=65536
while echo "$gids" | grep -q "^$gid$"; do while echo "$gids" | grep -q "^$gid$"; do
gid=$((gid + 1)) gid=$((gid + 1))
done done
@ -386,9 +369,6 @@ group_add_user() {
echo "$grp" | grep -q ":$" && delim="" echo "$grp" | grep -q ":$" && delim=""
[ -n "$IPKG_INSTROOT" ] || lock /var/lock/passwd [ -n "$IPKG_INSTROOT" ] || lock /var/lock/passwd
sed -i "s/$grp/$grp$delim$2/g" ${IPKG_INSTROOT}/etc/group sed -i "s/$grp/$grp$delim$2/g" ${IPKG_INSTROOT}/etc/group
if [ -z "$IPKG_INSTROOT" ] && [ -x /usr/sbin/selinuxenabled ] && selinuxenabled; then
restorecon /etc/group
fi
[ -n "$IPKG_INSTROOT" ] || lock -u /var/lock/passwd [ -n "$IPKG_INSTROOT" ] || lock -u /var/lock/passwd
} }
@ -402,7 +382,7 @@ user_add() {
local rc local rc
[ -z "$uid" ] && { [ -z "$uid" ] && {
uids=$(cut -d: -f3 ${IPKG_INSTROOT}/etc/passwd) uids=$(cut -d: -f3 ${IPKG_INSTROOT}/etc/passwd)
uid=32768 uid=65536
while echo "$uids" | grep -q "^$uid$"; do while echo "$uids" | grep -q "^$uid$"; do
uid=$((uid + 1)) uid=$((uid + 1))
done done

View File

@ -11,36 +11,6 @@ get_dt_led_path() {
echo "$ledpath" echo "$ledpath"
} }
get_dt_led_color_func() {
local enum
local func
local idx
local label
[ -e "$1/function" ] && func=$(cat "$1/function")
[ -e "$1/color" ] && idx=$((0x$(hexdump -n 4 -e '4/1 "%02x"' "$1/color")))
[ -e "$1/function-enumerator" ] && \
enum=$((0x$(hexdump -n 4 -e '4/1 "%02x"' "$1/function-enumerator")))
[ -z "$idx" ] && [ -z "$func" ] && return 2
if [ -n "$idx" ]; then
for color in "white" "red" "green" "blue" "amber" \
"violet" "yellow" "ir" "multicolor" "rgb" \
"purple" "orange" "pink" "cyan" "lime"
do
[ $idx -eq 0 ] && label="$color" && break
idx=$((idx-1))
done
fi
label="$label:$func"
[ -n "$enum" ] && label="$label-$enum"
echo "$label"
return 0
}
get_dt_led() { get_dt_led() {
local label local label
local ledpath=$(get_dt_led_path $1) local ledpath=$(get_dt_led_path $1)
@ -48,7 +18,6 @@ get_dt_led() {
[ -n "$ledpath" ] && \ [ -n "$ledpath" ] && \
label=$(cat "$ledpath/label" 2>/dev/null) || \ label=$(cat "$ledpath/label" 2>/dev/null) || \
label=$(cat "$ledpath/chan-name" 2>/dev/null) || \ label=$(cat "$ledpath/chan-name" 2>/dev/null) || \
label=$(get_dt_led_color_func "$ledpath") || \
label=$(basename "$ledpath") label=$(basename "$ledpath")
echo "$label" echo "$label"

View File

@ -90,13 +90,6 @@ network_get_prefix6() {
__network_ifstatus "$1" "$2" "['ipv6-prefix'][0]['address','mask']" "/" __network_ifstatus "$1" "$2" "['ipv6-prefix'][0]['address','mask']" "/"
} }
# determine first IPv6 prefix assignment of given logical interface
# 1: destination variable
# 2: interface
network_get_prefix_assignment6() {
__network_ifstatus "$1" "$2" "['ipv6-prefix-assignment'][0]['address','mask']" "/"
}
# determine all IPv4 addresses of given logical interface # determine all IPv4 addresses of given logical interface
# 1: destination variable # 1: destination variable
# 2: interface # 2: interface
@ -194,13 +187,6 @@ network_get_prefixes6() {
__network_ifstatus "$1" "$2" "['ipv6-prefix'][*]['address','mask']" "/ " __network_ifstatus "$1" "$2" "['ipv6-prefix'][*]['address','mask']" "/ "
} }
# determine all IPv6 prefix assignments of given logical interface
# 1: destination variable
# 2: interface
network_get_prefix_assignments6() {
__network_ifstatus "$1" "$2" "['ipv6-prefix-assignment'][*]['address','mask']" "/ "
}
# determine IPv4 gateway of given logical interface # determine IPv4 gateway of given logical interface
# 1: destination variable # 1: destination variable
# 2: interface # 2: interface

View File

@ -61,21 +61,11 @@ find_mtd_chardev() {
echo "${INDEX:+$PREFIX$INDEX}" echo "${INDEX:+$PREFIX$INDEX}"
} }
get_mac_ascii() {
local part="$1"
local key="$2"
local mac_dirty
mac_dirty=$(strings "$part" | sed -n 's/^'"$key"'=//p')
# "canonicalize" mac
[ -n "$mac_dirty" ] && macaddr_canonicalize "$mac_dirty"
}
mtd_get_mac_ascii() { mtd_get_mac_ascii() {
local mtdname="$1" local mtdname="$1"
local key="$2" local key="$2"
local part local part
local mac_dirty
part=$(find_mtd_part "$mtdname") part=$(find_mtd_part "$mtdname")
if [ -z "$part" ]; then if [ -z "$part" ]; then
@ -83,75 +73,35 @@ mtd_get_mac_ascii() {
return return
fi fi
get_mac_ascii "$part" "$key" mac_dirty=$(strings "$part" | sed -n 's/^'"$key"'=//p')
}
mtd_get_mac_encrypted_arcadyan() {
local iv="00000000000000000000000000000000"
local key="2A4B303D7644395C3B2B7053553C5200"
local mac_dirty
local mtdname="$1"
local part
local size
part=$(find_mtd_part "$mtdname")
if [ -z "$part" ]; then
echo "mtd_get_mac_encrypted_arcadyan: partition $mtdname not found!" >&2
return
fi
# Config decryption and getting mac. Trying uencrypt and openssl utils.
size=$((0x$(dd if=$part skip=9 bs=1 count=4 2>/dev/null | hexdump -v -e '1/4 "%08x"')))
if [[ -f "/usr/bin/uencrypt" ]]; then
mac_dirty=$(dd if=$part bs=1 count=$size skip=$((0x100)) 2>/dev/null | \
uencrypt -d -n -k $key -i $iv | grep mac | cut -c 5-)
elif [[ -f "/usr/bin/openssl" ]]; then
mac_dirty=$(dd if=$part bs=1 count=$size skip=$((0x100)) 2>/dev/null | \
openssl aes-128-cbc -d -nopad -K $key -iv $iv | grep mac | cut -c 5-)
else
echo "mtd_get_mac_encrypted_arcadyan: Neither uencrypt nor openssl was found!" >&2
return
fi
# "canonicalize" mac # "canonicalize" mac
[ -n "$mac_dirty" ] && macaddr_canonicalize "$mac_dirty" [ -n "$mac_dirty" ] && macaddr_canonicalize "$mac_dirty"
} }
mtd_get_mac_encrypted_deco() { mtd_get_mac_ascii_mmc() {
local mtdname="$1" local mtdname="$1"
local key="$2"
local part
local mac_dirty
if ! [ -e "$mtdname" ]; then part=$(find_mmc_part "$mtdname")
echo "mtd_get_mac_encrypted_deco: file $mtdname not found!" >&2 if [ -z "$part" ]; then
echo "mtd_get_mac_ascii: partition $mtdname not found!" >&2
return return
fi fi
tplink_key="3336303032384339" mac_dirty=$(strings "$part" | sed -n 's/^'"$key"'=//p')
key=$(dd if=$mtdname bs=1 skip=16 count=8 2>/dev/null | \ # "canonicalize" mac
uencrypt -n -d -k $tplink_key -c des-ecb | hexdump -v -n 8 -e '1/1 "%02x"') [ -n "$mac_dirty" ] && macaddr_canonicalize "$mac_dirty"
macaddr=$(dd if=$mtdname bs=1 skip=32 count=8 2>/dev/null | \
uencrypt -n -d -k $key -c des-ecb | hexdump -v -n 6 -e '5/1 "%02x:" 1/1 "%02x"')
echo $macaddr
}
mtd_get_mac_uci_config_ubi() {
local volumename="$1"
. /lib/upgrade/nand.sh
local ubidev=$(nand_attach_ubi $CI_UBIPART)
local part=$(nand_find_volume $ubidev $volumename)
cat "/dev/$part" | sed -n 's/^\s*option macaddr\s*'"'"'\?\([0-9A-F:]\+\)'"'"'\?/\1/Ip'
} }
mtd_get_mac_text() { mtd_get_mac_text() {
local mtdname="$1" local mtdname=$1
local offset=$((${2:-0})) local offset=$(($2))
local length="${3:-17}"
local part local part
local mac_dirty
part=$(find_mtd_part "$mtdname") part=$(find_mtd_part "$mtdname")
if [ -z "$part" ]; then if [ -z "$part" ]; then
@ -159,9 +109,15 @@ mtd_get_mac_text() {
return return
fi fi
[ $((offset + length)) -le $(mtd_get_part_size "$mtdname") ] || return if [ -z "$offset" ]; then
echo "mtd_get_mac_text: offset missing!" >&2
return
fi
macaddr_canonicalize $(dd bs=1 if="$part" skip="$offset" count="$length" 2>/dev/null) mac_dirty=$(dd if="$part" bs=1 skip="$offset" count=17 2>/dev/null)
# "canonicalize" mac
[ -n "$mac_dirty" ] && macaddr_canonicalize "$mac_dirty"
} }
mtd_get_mac_binary() { mtd_get_mac_binary() {
@ -185,6 +141,15 @@ mtd_get_mac_binary_ubi() {
get_mac_binary "/dev/$part" "$offset" get_mac_binary "/dev/$part" "$offset"
} }
mtd_get_mac_binary_mmc() {
local mtdname="$1"
local offset="$2"
local part
part=$(find_mmc_part "$mtdname")
get_mac_binary "$part" "$offset"
}
mtd_get_part_size() { mtd_get_part_size() {
local part_name=$1 local part_name=$1
local first dev size erasesize name local first dev size erasesize name
@ -197,29 +162,6 @@ mtd_get_part_size() {
done < /proc/mtd done < /proc/mtd
} }
mmc_get_mac_ascii() {
local part_name="$1"
local key="$2"
local part
part=$(find_mmc_part "$part_name")
if [ -z "$part" ]; then
echo "mmc_get_mac_ascii: partition $part_name not found!" >&2
return
fi
get_mac_ascii "$part" "$key"
}
mmc_get_mac_binary() {
local part_name="$1"
local offset="$2"
local part
part=$(find_mmc_part "$part_name")
get_mac_binary "$part" "$offset"
}
macaddr_add() { macaddr_add() {
local mac=$1 local mac=$1
local val=$2 local val=$2
@ -230,14 +172,6 @@ macaddr_add() {
echo $oui:$nic echo $oui:$nic
} }
macaddr_generate_from_mmc_cid() {
local mmc_dev=$1
local sd_hash=$(sha256sum /sys/class/block/$mmc_dev/device/cid)
local mac_base=$(macaddr_canonicalize "$(echo "${sd_hash}" | dd bs=1 count=12 2>/dev/null)")
echo "$(macaddr_unsetbit_mc "$(macaddr_setbit_la "${mac_base}")")"
}
macaddr_geteui() { macaddr_geteui() {
local mac=$1 local mac=$1
local sep=$2 local sep=$2
@ -317,7 +251,3 @@ macaddr_canonicalize() {
printf "%02x:%02x:%02x:%02x:%02x:%02x" 0x${canon// / 0x} 2>/dev/null printf "%02x:%02x:%02x:%02x:%02x:%02x" 0x${canon// / 0x} 2>/dev/null
} }
dt_is_enabled() {
grep -q okay "/proc/device-tree/$1/status"
}

View File

@ -96,7 +96,7 @@ ucidef_set_interfaces_lan_wan() {
ucidef_set_bridge_device() { ucidef_set_bridge_device() {
json_select_object bridge json_select_object bridge
json_add_string name "${1:-switch0}" json_add_string name "${1:switch0}"
json_select .. json_select ..
} }
@ -418,15 +418,6 @@ ucidef_set_led_default() {
json_select .. json_select ..
} }
ucidef_set_led_heartbeat() {
_ucidef_set_led_common "$1" "$2" "$3"
json_add_string trigger heartbeat
json_select ..
json_select ..
}
ucidef_set_led_gpio() { ucidef_set_led_gpio() {
local gpio="$4" local gpio="$4"
local inverted="$5" local inverted="$5"
@ -638,21 +629,6 @@ ucidef_set_ntpserver() {
json_select .. json_select ..
} }
ucidef_add_wlan() {
local path="$1"; shift
ucidef_wlan_idx=${ucidef_wlan_idx:-0}
json_select_object wlan
json_select_object "wl$ucidef_wlan_idx"
json_add_string path "$path"
json_add_fields "$@"
json_select ..
json_select ..
ucidef_wlan_idx="$((ucidef_wlan_idx + 1))"
}
board_config_update() { board_config_update() {
json_init json_init
[ -f ${CFG} ] && json_load "$(cat ${CFG})" [ -f ${CFG} ] && json_load "$(cat ${CFG})"

View File

@ -18,9 +18,6 @@ preinit_ip_config() {
fi fi
ip link set dev $netdev up ip link set dev $netdev up
if [ -n "$vid" ]; then
ip link set dev $1 up
fi
ip -4 address add $pi_ip/$pi_netmask broadcast $pi_broadcast dev $1 ip -4 address add $pi_ip/$pi_netmask broadcast $pi_broadcast dev $1
} }
@ -94,8 +91,6 @@ preinit_config_board() {
else else
# trim any vlan ids # trim any vlan ids
ifname=${ifname%\.*} ifname=${ifname%\.*}
# trim any vlan modifiers like :t
ifname=${ifname%\:*}
fi fi
pi_ifname=$ifname pi_ifname=$ifname

View File

@ -40,12 +40,9 @@ fs_wait_for_key () {
rm -f $keypress_wait rm -f $keypress_wait
} & } &
local consoles="$(sed -e 's/ /\n/g' /proc/cmdline | grep '^console=' | sed -e 's/^console=//' -e 's/,.*//')" [ "$pi_preinit_no_failsafe" != "y" ] && echo "Press the [$1] key and hit [enter] $2"
[ -n "$consoles" ] || consoles=console echo "Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level"
for console in $consoles; do # if we're on the console we wait for input
[ -c "/dev/$console" ] || continue
[ "$pi_preinit_no_failsafe" != "y" ] && echo "Press the [$1] key and hit [enter] $2" > "/dev/$console"
echo "Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level" > "/dev/$console"
{ {
while [ -r $keypress_wait ]; do while [ -r $keypress_wait ]; do
timer="$(cat $keypress_sec)" timer="$(cat $keypress_sec)"
@ -55,7 +52,7 @@ fs_wait_for_key () {
[ $timer -ge 1 ] || timer=1 [ $timer -ge 1 ] || timer=1
do_keypress="" do_keypress=""
{ {
read -t "$timer" do_keypress < "/dev/$console" read -t "$timer" do_keypress
case "$do_keypress" in case "$do_keypress" in
$1) $1)
echo "true" >$keypress_true echo "true" >$keypress_true
@ -71,8 +68,7 @@ fs_wait_for_key () {
rm -f $keypress_wait rm -f $keypress_wait
} }
done done
} & }
done
lock -w $keypress_wait lock -w $keypress_wait
keypressed=1 keypressed=1

View File

@ -9,7 +9,7 @@ missing_lines() {
IFS=":" IFS=":"
while read line; do while read line; do
set -- $line set -- $line
grep -q "^$1:" "$file2" || echo "$line" grep -q "^$1:" "$file2" || echo "$*"
done < "$file1" done < "$file1"
IFS="$oIFS" IFS="$oIFS"
} }
@ -17,7 +17,6 @@ missing_lines() {
do_mount_root() { do_mount_root() {
mount_root mount_root
boot_run_hook preinit_mount_root boot_run_hook preinit_mount_root
[ ! -f /etc/bench.log ] && touch /etc/bench.log
[ -f /sysupgrade.tgz -o -f /tmp/sysupgrade.tar ] && { [ -f /sysupgrade.tgz -o -f /tmp/sysupgrade.tar ] && {
echo "- config restore -" echo "- config restore -"
cp /etc/passwd /etc/group /etc/shadow /tmp cp /etc/passwd /etc/group /etc/shadow /tmp

View File

@ -2,14 +2,13 @@
# Copyright (C) 2010 Vertical Communications # Copyright (C) 2010 Vertical Communications
failsafe_shell() { failsafe_shell() {
local consoles="$(sed -e 's/ /\n/g' /proc/cmdline | grep '^console=' | sed -e 's/^console=//' -e 's/,.*//')" local console="$(sed -e 's/ /\n/g' /proc/cmdline | grep '^console=' | head -1 | sed -e 's/^console=//' -e 's/,.*//')"
[ -n "$consoles" ] || consoles=console [ -n "$console" ] || console=console
for console in $consoles; do [ -c "/dev/$console" ] || return 0
[ -c "/dev/$console" ] && while true; do while true; do
ash --login <"/dev/$console" >"/dev/$console" 2>"/dev/$console" ash --login <"/dev/$console" >"/dev/$console" 2>"/dev/$console"
sleep 1 sleep 1
done & done &
done
} }
boot_hook_add failsafe failsafe_shell boot_hook_add failsafe failsafe_shell

View File

@ -65,9 +65,16 @@ _v() {
[ -n "$VERBOSE" ] && [ "$VERBOSE" -ge 1 ] && echo "$*" >&2 [ -n "$VERBOSE" ] && [ "$VERBOSE" -ge 1 ] && echo "$*" >&2
} }
_vn() {
[ -n "$VERBOSE" ] && [ "$VERBOSE" -ge 1 ] && echo -n "$*" >&2
}
v() { v() {
_v "$(date) upgrade: $@" _v "$(date) upgrade: $@"
logger -p info -t upgrade "$@" }
vn() {
_vn "$(date) upgrade: $@"
} }
json_string() { json_string() {
@ -88,7 +95,8 @@ get_image() { # <source> [ <command> ]
if [ -z "$cmd" ]; then if [ -z "$cmd" ]; then
local magic="$(dd if="$from" bs=2 count=1 2>/dev/null | hexdump -n 2 -e '1/1 "%02x"')" local magic="$(dd if="$from" bs=2 count=1 2>/dev/null | hexdump -n 2 -e '1/1 "%02x"')"
case "$magic" in case "$magic" in
1f8b) cmd="busybox zcat";; 1f8b) cmd="zcat";;
425a) cmd="bzcat";;
*) cmd="cat";; *) cmd="cat";;
esac esac
fi fi
@ -127,33 +135,6 @@ get_magic_fat32() {
(get_image "$@" | dd bs=1 count=5 skip=82) 2>/dev/null (get_image "$@" | dd bs=1 count=5 skip=82) 2>/dev/null
} }
identify_magic_long() {
local magic=$1
case "$magic" in
"55424923")
echo "ubi"
;;
"31181006")
echo "ubifs"
;;
"68737173")
echo "squashfs"
;;
"d00dfeed")
echo "fit"
;;
"4349"*)
echo "combined"
;;
"1f8b"*)
echo "gzip"
;;
*)
echo "unknown $magic"
;;
esac
}
part_magic_efi() { part_magic_efi() {
local magic=$(get_magic_gpt "$@") local magic=$(get_magic_gpt "$@")
[ "$magic" = "EFI PART" ] [ "$magic" = "EFI PART" ]
@ -165,23 +146,6 @@ part_magic_fat() {
[ "$magic" = "FAT" ] || [ "$magic_fat32" = "FAT32" ] [ "$magic" = "FAT" ] || [ "$magic_fat32" = "FAT32" ]
} }
fitblk_get_bootdev() {
[ -e /sys/firmware/devicetree/base/chosen/rootdisk ] || return
local rootdisk="$(cat /sys/firmware/devicetree/base/chosen/rootdisk)"
local handle bootdev
for handle in /sys/class/block/*/of_node/phandle /sys/class/block/*/device/of_node/phandle; do
[ ! -e "$handle" ] && continue
if [ "$rootdisk" = "$(cat $handle)" ]; then
bootdev="${handle%/of_node/phandle}"
bootdev="${bootdev%/device}"
bootdev="${bootdev#/sys/class/block/}"
echo "$bootdev"
break
fi
done
}
export_bootdevice() { export_bootdevice() {
local cmdline uuid blockdev uevent line class local cmdline uuid blockdev uevent line class
local MAJOR MINOR DEVNAME DEVTYPE local MAJOR MINOR DEVNAME DEVTYPE
@ -199,11 +163,9 @@ export_bootdevice() {
fi fi
done done
;; ;;
PARTUUID=????????-????-????-????-??????????0?/PARTNROFF=1 | \
PARTUUID=????????-????-????-????-??????????02) PARTUUID=????????-????-????-????-??????????02)
uuid="${rootpart#PARTUUID=}" uuid="${rootpart#PARTUUID=}"
uuid="${uuid%/PARTNROFF=1}" uuid="${uuid%02}00"
uuid="${uuid%0?}00"
for disk in $(find /dev -type b); do for disk in $(find /dev -type b); do
set -- $(dd if=$disk bs=1 skip=568 count=16 2>/dev/null | hexdump -v -e '8/1 "%02x "" "2/1 "%02x""-"6/1 "%02x"') set -- $(dd if=$disk bs=1 skip=568 count=16 2>/dev/null | hexdump -v -e '8/1 "%02x "" "2/1 "%02x""-"6/1 "%02x"')
if [ "$4$3$2$1-$6$5-$8$7-$9" = "$uuid" ]; then if [ "$4$3$2$1-$6$5-$8$7-$9" = "$uuid" ]; then
@ -213,7 +175,6 @@ export_bootdevice() {
done done
;; ;;
/dev/*) /dev/*)
[ "$rootpart" = "/dev/fit0" ] && rootpart="$(fitblk_get_bootdev)"
uevent="/sys/class/block/${rootpart##*/}/../uevent" uevent="/sys/class/block/${rootpart##*/}/../uevent"
;; ;;
0x[a-f0-9][a-f0-9][a-f0-9] | 0x[a-f0-9][a-f0-9][a-f0-9][a-f0-9] | \ 0x[a-f0-9][a-f0-9][a-f0-9] | 0x[a-f0-9][a-f0-9][a-f0-9][a-f0-9] | \
@ -250,7 +211,7 @@ export_partdevice() {
while read line; do while read line; do
export -n "$line" export -n "$line"
done < "$uevent" done < "$uevent"
if [ "$BOOTDEV_MAJOR" = "$MAJOR" -a $(($BOOTDEV_MINOR + $offset)) = "$MINOR" -a -b "/dev/$DEVNAME" ]; then if [ $BOOTDEV_MAJOR = $MAJOR -a $(($BOOTDEV_MINOR + $offset)) = $MINOR -a -b "/dev/$DEVNAME" ]; then
export "$var=$DEVNAME" export "$var=$DEVNAME"
return 0 return 0
fi fi
@ -267,6 +228,15 @@ hex_le32_to_cpu() {
echo "$@" echo "$@"
} }
get_partition_by_name() {
for partname in /sys/class/block/$1/*/name; do
[ "$(cat ${partname})" = "$2" ] && {
basename ${partname%%/name}
break
}
done
}
get_partitions() { # <device> <filename> get_partitions() { # <device> <filename>
local disk="$1" local disk="$1"
local filename="$2" local filename="$2"

View File

@ -19,11 +19,8 @@ emmc_upgrade_tar() {
[ "$has_kernel" = 1 -a "$EMMC_KERN_DEV" ] && [ "$has_kernel" = 1 -a "$EMMC_KERN_DEV" ] &&
export EMMC_KERNEL_BLOCKS=$(($(tar xf "$tar_file" ${board_dir}/kernel -O | dd of="$EMMC_KERN_DEV" bs=512 2>&1 | grep "records out" | cut -d' ' -f1))) export EMMC_KERNEL_BLOCKS=$(($(tar xf "$tar_file" ${board_dir}/kernel -O | dd of="$EMMC_KERN_DEV" bs=512 2>&1 | grep "records out" | cut -d' ' -f1)))
[ "$has_rootfs" = 1 -a "$EMMC_ROOT_DEV" ] && { [ "$has_rootfs" = 1 -a "$EMMC_ROOT_DEV" ] &&
export EMMC_ROOTFS_BLOCKS=$(($(tar xf "$tar_file" ${board_dir}/root -O | dd of="$EMMC_ROOT_DEV" bs=512 2>&1 | grep "records out" | cut -d' ' -f1))) export EMMC_ROOTFS_BLOCKS=$(($(tar xf "$tar_file" ${board_dir}/root -O | dd of="$EMMC_ROOT_DEV" bs=512 2>&1 | grep "records out" | cut -d' ' -f1)))
# Account for 64KiB ROOTDEV_OVERLAY_ALIGN in libfstools
EMMC_ROOTFS_BLOCKS=$(((EMMC_ROOTFS_BLOCKS + 127) & ~127))
}
if [ -z "$UPGRADE_BACKUP" ]; then if [ -z "$UPGRADE_BACKUP" ]; then
if [ "$EMMC_DATA_DEV" ]; then if [ "$EMMC_DATA_DEV" ]; then
@ -58,7 +55,7 @@ emmc_copy_config() {
} }
emmc_do_upgrade() { emmc_do_upgrade() {
local file_type=$(identify_magic_long "$(get_magic_long "$1")") local file_type=$(identify $1)
case "$file_type" in case "$file_type" in
"fit") emmc_upgrade_fit $1;; "fit") emmc_upgrade_fit $1;;

View File

@ -71,7 +71,6 @@ fwtool_check_image() {
# minor compat version -> sysupgrade with -n required # minor compat version -> sysupgrade with -n required
if [ "${devicecompat#.*}" != "${imagecompat#.*}" ] && [ "$SAVE_CONFIG" = "1" ]; then if [ "${devicecompat#.*}" != "${imagecompat#.*}" ] && [ "$SAVE_CONFIG" = "1" ]; then
[ "$IGNORE_MINOR_COMPAT" = 1 ] && return 0
v "The device is supported, but the config is incompatible to the new image ($devicecompat->$imagecompat). Please upgrade without keeping config (sysupgrade -n)." v "The device is supported, but the config is incompatible to the new image ($devicecompat->$imagecompat). Please upgrade without keeping config (sysupgrade -n)."
[ -n "$compatmessage" ] && v "$compatmessage" [ -n "$compatmessage" ] && v "$compatmessage"
return 1 return 1

View File

@ -1,91 +0,0 @@
legacy_sdcard_check_image() {
local file="$1"
local diskdev partdev diff
export_bootdevice && export_partdevice diskdev 0 || {
v "Unable to determine upgrade device"
return 1
}
get_partitions "/dev/$diskdev" bootdisk
v "Extract boot sector from the image"
get_image_dd "$1" of=/tmp/image.bs count=1 bs=512b
get_partitions /tmp/image.bs image
#compare tables
diff="$(grep -F -x -v -f /tmp/partmap.bootdisk /tmp/partmap.image)"
rm -f /tmp/image.bs /tmp/partmap.bootdisk /tmp/partmap.image
if [ -n "$diff" ]; then
v "Partition layout has changed. Full image will be written."
ask_bool 0 "Abort" && exit 1
return 0
fi
}
legacy_sdcard_do_upgrade() {
local board=$(board_name)
local diskdev partdev diff
export_bootdevice && export_partdevice diskdev 0 || {
v "Unable to determine upgrade device"
return 1
}
sync
if [ "$UPGRADE_OPT_SAVE_PARTITIONS" = "1" ]; then
get_partitions "/dev/$diskdev" bootdisk
v "Extract boot sector from the image"
get_image_dd "$1" of=/tmp/image.bs count=1 bs=512b
get_partitions /tmp/image.bs image
#compare tables
diff="$(grep -F -x -v -f /tmp/partmap.bootdisk /tmp/partmap.image)"
else
diff=1
fi
if [ -n "$diff" ]; then
get_image_dd "$1" of="/dev/$diskdev" bs=4096 conv=fsync
# Separate removal and addtion is necessary; otherwise, partition 1
# will be missing if it overlaps with the old partition 2
partx -d - "/dev/$diskdev"
partx -a - "/dev/$diskdev"
else
v "Writing bootloader to /dev/$diskdev"
get_image_dd "$1" of="$diskdev" bs=512 skip=1 seek=1 count=2048 conv=fsync
#iterate over each partition from the image and write it to the boot disk
while read part start size; do
if export_partdevice partdev $part; then
v "Writing image to /dev/$partdev..."
get_image_dd "$1" of="/dev/$partdev" ibs="512" obs=1M skip="$start" count="$size" conv=fsync
else
v "Unable to find partition $part device, skipped."
fi
done < /tmp/partmap.image
v "Writing new UUID to /dev/$diskdev..."
get_image_dd "$1" of="/dev/$diskdev" bs=1 skip=440 count=4 seek=440 conv=fsync
fi
sleep 1
}
legacy_sdcard_copy_config() {
local partdev
if export_partdevice partdev 1; then
mkdir -p /boot
[ -f /boot/kernel.img ] || mount -o rw,noatime /dev/$partdev /boot
cp -af "$UPGRADE_BACKUP" "/boot/$BACKUP_FILE"
sync
umount /boot
fi
}

View File

@ -7,8 +7,6 @@
CI_KERNPART="${CI_KERNPART:-kernel}" CI_KERNPART="${CI_KERNPART:-kernel}"
# 'ubi' partition on NAND contains UBI # 'ubi' partition on NAND contains UBI
# There are also CI_KERN_UBIPART and CI_ROOT_UBIPART if kernel
# and rootfs are on separated UBIs.
CI_UBIPART="${CI_UBIPART:-ubi}" CI_UBIPART="${CI_UBIPART:-ubi}"
# 'rootfs' UBI volume on NAND contains the rootfs # 'rootfs' UBI volume on NAND contains the rootfs
@ -28,7 +26,7 @@ ubi_mknod() {
nand_find_volume() { nand_find_volume() {
local ubidevdir ubivoldir local ubidevdir ubivoldir
ubidevdir="/sys/class/ubi/" ubidevdir="/sys/devices/virtual/ubi/$1"
[ ! -d "$ubidevdir" ] && return 1 [ ! -d "$ubidevdir" ] && return 1
for ubivoldir in $ubidevdir/${1}_*; do for ubivoldir in $ubidevdir/${1}_*; do
[ ! -d "$ubivoldir" ] && continue [ ! -d "$ubivoldir" ] && continue
@ -41,12 +39,13 @@ nand_find_volume() {
} }
nand_find_ubi() { nand_find_ubi() {
local ubidevdir ubidev mtdnum cmtdnum local ubidevdir ubidev mtdnum
mtdnum="$( find_mtd_index $1 )" mtdnum="$( find_mtd_index $1 )"
[ ! "$mtdnum" ] && return 1 [ ! "$mtdnum" ] && return 1
for ubidevdir in /sys/class/ubi/ubi*; do for ubidevdir in /sys/devices/virtual/ubi/ubi*; do
[ ! -e "$ubidevdir/mtd_num" ] && continue [ ! -d "$ubidevdir" ] && continue
cmtdnum="$( cat $ubidevdir/mtd_num )" cmtdnum="$( cat $ubidevdir/mtd_num )"
[ ! "$mtdnum" ] && continue
if [ "$mtdnum" = "$cmtdnum" ]; then if [ "$mtdnum" = "$cmtdnum" ]; then
ubidev=$( basename $ubidevdir ) ubidev=$( basename $ubidevdir )
ubi_mknod "$ubidevdir" ubi_mknod "$ubidevdir"
@ -57,125 +56,62 @@ nand_find_ubi() {
} }
nand_get_magic_long() { nand_get_magic_long() {
(${3}cat "$1" | dd bs=4 "skip=${2:-0}" count=1 | hexdump -v -n 4 -e '1/1 "%02x"') 2> /dev/null dd if="$1" skip=$2 bs=4 count=1 2>/dev/null | hexdump -v -n 4 -e '1/1 "%02x"'
} }
get_magic_long_tar() { get_magic_long_tar() {
(tar xO${3}f "$1" "$2" | dd bs=4 count=1 | hexdump -v -n 4 -e '1/1 "%02x"') 2> /dev/null ( tar xf $1 $2 -O | dd bs=4 count=1 | hexdump -v -n 4 -e '1/1 "%02x"') 2> /dev/null
} }
identify_magic() {
local magic=$1
case "$magic" in
"55424923")
echo "ubi"
;;
"31181006")
echo "ubifs"
;;
"68737173")
echo "squashfs"
;;
"d00dfeed")
echo "fit"
;;
"4349"*)
echo "combined"
;;
*)
echo "unknown $magic"
;;
esac
}
identify() { identify() {
identify_magic_long $(nand_get_magic_long "$@") identify_magic $(nand_get_magic_long "$1" "${2:-0}")
} }
identify_tar() { identify_tar() {
identify_magic_long $(get_magic_long_tar "$@") identify_magic $(get_magic_long_tar "$1" "$2")
}
identify_if_gzip() {
if [ "$(identify "$1")" = gzip ]; then echo -n z; fi
} }
nand_restore_config() { nand_restore_config() {
local ubidev=$( nand_find_ubi "${CI_ROOT_UBIPART:-$CI_UBIPART}" ) sync
local ubidev=$( nand_find_ubi $CI_UBIPART )
local ubivol="$( nand_find_volume $ubidev rootfs_data )" local ubivol="$( nand_find_volume $ubidev rootfs_data )"
if [ ! "$ubivol" ]; then [ ! "$ubivol" ] &&
ubivol="$( nand_find_volume $ubidev "$CI_ROOTPART" )" ubivol="$( nand_find_volume $ubidev $CI_ROOTPART )"
if [ ! "$ubivol" ]; then
echo "cannot find ubifs data volume"
return 1
fi
fi
mkdir /tmp/new_root mkdir /tmp/new_root
if ! mount -t ubifs /dev/$ubivol /tmp/new_root; then if ! mount -t ubifs /dev/$ubivol /tmp/new_root; then
echo "cannot mount ubifs volume $ubivol" echo "mounting ubifs $ubivol failed"
rmdir /tmp/new_root rmdir /tmp/new_root
return 1 return 1
fi fi
if mv "$1" "/tmp/new_root/$BACKUP_FILE"; then mv "$1" "/tmp/new_root/$BACKUP_FILE"
if umount /tmp/new_root; then
echo "configuration saved"
rmdir /tmp/new_root
return 0
fi
else
umount /tmp/new_root umount /tmp/new_root
fi sync
echo "could not save configuration to ubifs volume $ubivol"
rmdir /tmp/new_root rmdir /tmp/new_root
return 1
}
nand_remove_ubiblock() {
local ubivol="$1"
local ubiblk="ubiblock${ubivol:3}"
if [ -e "/dev/$ubiblk" ]; then
umount "/dev/$ubiblk" && echo "unmounted /dev/$ubiblk" || :
if ! ubiblock -r "/dev/$ubivol"; then
echo "cannot remove $ubiblk"
return 1
fi
fi
}
nand_attach_ubi() {
local ubipart="$1"
local has_env="${2:-0}"
local mtdnum="$( find_mtd_index "$ubipart" )"
if [ ! "$mtdnum" ]; then
>&2 echo "cannot find ubi mtd partition $ubipart"
return 1
fi
local ubidev="$( nand_find_ubi "$ubipart" )"
if [ ! "$ubidev" ]; then
>&2 ubiattach -m "$mtdnum"
ubidev="$( nand_find_ubi "$ubipart" )"
if [ ! "$ubidev" ]; then
>&2 ubiformat /dev/mtd$mtdnum -y
>&2 ubiattach -m "$mtdnum"
ubidev="$( nand_find_ubi "$ubipart" )"
if [ ! "$ubidev" ]; then
>&2 echo "cannot attach ubi mtd partition $ubipart"
return 1
fi
if [ "$has_env" -gt 0 ]; then
>&2 ubimkvol /dev/$ubidev -n 0 -N ubootenv -s 1MiB
>&2 ubimkvol /dev/$ubidev -n 1 -N ubootenv2 -s 1MiB
fi
fi
fi
echo "$ubidev"
return 0
}
nand_detach_ubi() {
local ubipart="$1"
local mtdnum="$( find_mtd_index "$ubipart" )"
if [ ! "$mtdnum" ]; then
echo "cannot find ubi mtd partition $ubipart"
return 1
fi
local ubidev="$( nand_find_ubi "$ubipart" )"
if [ "$ubidev" ]; then
for ubivol in $(find /dev -name "${ubidev}_*" -maxdepth 1 | sort); do
ubivol="${ubivol:5}"
nand_remove_ubiblock "$ubivol" || :
umount "/dev/$ubivol" && echo "unmounted /dev/$ubivol" || :
done
if ! ubidetach -m "$mtdnum"; then
echo "cannot detach ubi mtd partition $ubipart"
return 1
fi
fi
} }
nand_upgrade_prepare_ubi() { nand_upgrade_prepare_ubi() {
@ -186,46 +122,62 @@ nand_upgrade_prepare_ubi() {
local kernel_length="$3" local kernel_length="$3"
local has_env="${4:-0}" local has_env="${4:-0}"
local kern_ubidev
local root_ubidev
[ -n "$rootfs_length" -o -n "$kernel_length" ] || return 1 [ -n "$rootfs_length" -o -n "$kernel_length" ] || return 1
if [ -n "$CI_KERN_UBIPART" -a -n "$CI_ROOT_UBIPART" ]; then local mtdnum="$( find_mtd_index "$CI_UBIPART" )"
kern_ubidev="$( nand_attach_ubi "$CI_KERN_UBIPART" "$has_env" )" if [ ! "$mtdnum" ]; then
[ -n "$kern_ubidev" ] || return 1 echo "cannot find ubi mtd partition $CI_UBIPART"
root_ubidev="$( nand_attach_ubi "$CI_ROOT_UBIPART" )" return 1
[ -n "$root_ubidev" ] || return 1
else
kern_ubidev="$( nand_attach_ubi "$CI_UBIPART" "$has_env" )"
[ -n "$kern_ubidev" ] || return 1
root_ubidev="$kern_ubidev"
fi fi
local kern_ubivol="$( nand_find_volume $kern_ubidev "$CI_KERNPART" )" local ubidev="$( nand_find_ubi "$CI_UBIPART" )"
local root_ubivol="$( nand_find_volume $root_ubidev "$CI_ROOTPART" )" if [ ! "$ubidev" ]; then
local data_ubivol="$( nand_find_volume $root_ubidev rootfs_data )" ubiattach -m "$mtdnum"
[ "$root_ubivol" = "$kern_ubivol" ] && root_ubivol= sync
ubidev="$( nand_find_ubi "$CI_UBIPART" )"
fi
# remove ubiblocks if [ ! "$ubidev" ]; then
[ "$kern_ubivol" ] && { nand_remove_ubiblock $kern_ubivol || return 1; } ubiformat /dev/mtd$mtdnum -y
[ "$root_ubivol" ] && { nand_remove_ubiblock $root_ubivol || return 1; } ubiattach -m "$mtdnum"
[ "$data_ubivol" ] && { nand_remove_ubiblock $data_ubivol || return 1; } sync
ubidev="$( nand_find_ubi "$CI_UBIPART" )"
[ "$has_env" -gt 0 ] && {
ubimkvol /dev/$ubidev -n 0 -N ubootenv -s 1MiB
ubimkvol /dev/$ubidev -n 1 -N ubootenv2 -s 1MiB
}
fi
local kern_ubivol="$( nand_find_volume $ubidev $CI_KERNPART )"
local root_ubivol="$( nand_find_volume $ubidev $CI_ROOTPART )"
local data_ubivol="$( nand_find_volume $ubidev rootfs_data )"
local ubiblk ubiblkvol
for ubiblk in /dev/ubiblock*_? ; do
[ -e "$ubiblk" ] || continue
echo "removing ubiblock${ubiblk:13}"
ubiblkvol=ubi${ubiblk:13}
if ! ubiblock -r /dev/$ubiblkvol; then
echo "cannot remove $ubiblk"
return 1
fi
done
# kill volumes # kill volumes
[ "$kern_ubivol" ] && ubirmvol /dev/$kern_ubidev -N "$CI_KERNPART" || : [ "$kern_ubivol" ] && ubirmvol /dev/$ubidev -N $CI_KERNPART || true
[ "$root_ubivol" ] && ubirmvol /dev/$root_ubidev -N "$CI_ROOTPART" || : [ "$root_ubivol" -a "$root_ubivol" != "$kern_ubivol" ] && ubirmvol /dev/$ubidev -N $CI_ROOTPART || true
[ "$data_ubivol" ] && ubirmvol /dev/$root_ubidev -N rootfs_data || : [ "$data_ubivol" ] && ubirmvol /dev/$ubidev -N rootfs_data || true
# create kernel vol # update kernel
if [ -n "$kernel_length" ]; then if [ -n "$kernel_length" ]; then
if ! ubimkvol /dev/$kern_ubidev -N "$CI_KERNPART" -s $kernel_length; then if ! ubimkvol /dev/$ubidev -N $CI_KERNPART -s $kernel_length; then
echo "cannot create kernel volume" echo "cannot create kernel volume"
return 1; return 1;
fi fi
fi fi
# create rootfs vol # update rootfs
if [ -n "$rootfs_length" ]; then if [ -n "$rootfs_length" ]; then
local rootfs_size_param local rootfs_size_param
if [ "$rootfs_type" = "ubifs" ]; then if [ "$rootfs_type" = "ubifs" ]; then
@ -233,224 +185,157 @@ nand_upgrade_prepare_ubi() {
else else
rootfs_size_param="-s $rootfs_length" rootfs_size_param="-s $rootfs_length"
fi fi
if ! ubimkvol /dev/$root_ubidev -N "$CI_ROOTPART" $rootfs_size_param; then if ! ubimkvol /dev/$ubidev -N $CI_ROOTPART $rootfs_size_param; then
echo "cannot create rootfs volume" echo "cannot create rootfs volume"
return 1; return 1;
fi fi
fi fi
# create rootfs_data vol for non-ubifs rootfs # create rootfs_data for non-ubifs rootfs
if [ "$rootfs_type" != "ubifs" ]; then if [ "$rootfs_type" != "ubifs" ]; then
local availeb=$(cat /sys/devices/virtual/ubi/$ubidev/avail_eraseblocks)
local ebsize=$(cat /sys/devices/virtual/ubi/$ubidev/eraseblock_size)
local avail_size=$((availeb * ebsize))
local rootfs_data_size_param="-m" local rootfs_data_size_param="-m"
if [ -n "$rootfs_data_max" ]; then if [ -n "$rootfs_data_max" ] &&
[ "$rootfs_data_max" != "0" ] &&
[ "$rootfs_data_max" -le "$avail_size" ]; then
rootfs_data_size_param="-s $rootfs_data_max" rootfs_data_size_param="-s $rootfs_data_max"
fi fi
if ! ubimkvol /dev/$root_ubidev -N rootfs_data $rootfs_data_size_param; then if ! ubimkvol /dev/$ubidev -N rootfs_data $rootfs_data_size_param; then
if ! ubimkvol /dev/$root_ubidev -N rootfs_data -m; then
echo "cannot initialize rootfs_data volume" echo "cannot initialize rootfs_data volume"
return 1 return 1
fi fi
fi fi
fi sync
return 0 return 0
} }
# Write the UBI image to MTD ubi partition nand_do_upgrade_success() {
local conf_tar="/tmp/sysupgrade.tgz"
sync
[ -f "$conf_tar" ] && nand_restore_config "$conf_tar"
echo "sysupgrade successful"
umount -a
reboot -f
}
# Flash the UBI image to MTD partition
nand_upgrade_ubinized() { nand_upgrade_ubinized() {
local ubi_file="$1" local ubi_file="$1"
local gz="$2"
local ubi_length=$( (${gz}cat "$ubi_file" | wc -c) 2> /dev/null)
nand_detach_ubi "$CI_UBIPART" || return 1
local mtdnum="$(find_mtd_index "$CI_UBIPART")" local mtdnum="$(find_mtd_index "$CI_UBIPART")"
${gz}cat "$ubi_file" | ubiformat "/dev/mtd$mtdnum" -S "$ubi_length" -y -f - && ubiattach -m "$mtdnum"
[ ! "$mtdnum" ] && {
CI_UBIPART="rootfs"
mtdnum="$(find_mtd_index "$CI_UBIPART")"
} }
# Write the UBIFS image to UBI rootfs volume if [ ! "$mtdnum" ]; then
echo "cannot find mtd device $CI_UBIPART"
umount -a
reboot -f
fi
local mtddev="/dev/mtd${mtdnum}"
ubidetach -p "${mtddev}" || true
sync
ubiformat "${mtddev}" -y -f "${ubi_file}"
ubiattach -p "${mtddev}"
nand_do_upgrade_success
}
# Write the UBIFS image to UBI volume
nand_upgrade_ubifs() { nand_upgrade_ubifs() {
local ubifs_file="$1" local rootfs_length=$( (cat $1 | wc -c) 2> /dev/null)
local gz="$2"
local ubifs_length=$( (${gz}cat "$ubifs_file" | wc -c) 2> /dev/null) nand_upgrade_prepare_ubi "$rootfs_length" "ubifs" "" ""
nand_upgrade_prepare_ubi "$ubifs_length" "ubifs" "" "" || return 1
local ubidev="$( nand_find_ubi "$CI_UBIPART" )" local ubidev="$( nand_find_ubi "$CI_UBIPART" )"
local root_ubivol="$(nand_find_volume $ubidev "$CI_ROOTPART")" local root_ubivol="$(nand_find_volume $ubidev $CI_ROOTPART)"
${gz}cat "$ubifs_file" | ubiupdatevol /dev/$root_ubivol -s "$ubifs_length" - ubiupdatevol /dev/$root_ubivol -s $rootfs_length $1
nand_do_upgrade_success
} }
# Write the FIT image to UBI kernel volume
nand_upgrade_fit() { nand_upgrade_fit() {
local fit_file="$1" local fit_file="$1"
local gz="$2" local fit_length="$(wc -c < "$fit_file")"
local fit_length=$( (${gz}cat "$fit_file" | wc -c) 2> /dev/null) nand_upgrade_prepare_ubi "" "" "$fit_length" "1"
nand_upgrade_prepare_ubi "" "" "$fit_length" "1" || return 1
local fit_ubidev="$(nand_find_ubi "$CI_UBIPART")" local fit_ubidev="$(nand_find_ubi "$CI_UBIPART")"
local fit_ubivol="$(nand_find_volume $fit_ubidev "$CI_KERNPART")" local fit_ubivol="$(nand_find_volume $fit_ubidev "$CI_KERNPART")"
${gz}cat "$fit_file" | ubiupdatevol /dev/$fit_ubivol -s "$fit_length" - ubiupdatevol /dev/$fit_ubivol -s $fit_length $fit_file
nand_do_upgrade_success
} }
# Write images in the TAR file to MTD partitions and/or UBI volumes as required
nand_upgrade_tar() { nand_upgrade_tar() {
local tar_file="$1" local tar_file="$1"
local gz="$2" local kernel_mtd="$(find_mtd_index $CI_KERNPART)"
local jffs2_markers="${CI_JFFS2_CLEAN_MARKERS:-0}"
# WARNING: This fails if tar contains more than one 'sysupgrade-*' directory. local board_dir=$(tar tf "$tar_file" | grep -m 1 '^sysupgrade-.*/$')
local board_dir="$(tar t${gz}f "$tar_file" | grep -m 1 '^sysupgrade-.*/$')" board_dir=${board_dir%/}
board_dir="${board_dir%/}"
local kernel_mtd kernel_length kernel_length=$( (tar xf "$tar_file" ${board_dir}/kernel -O | wc -c) 2> /dev/null)
if [ "$CI_KERNPART" != "none" ]; then local has_rootfs=0
kernel_mtd="$(find_mtd_index "$CI_KERNPART")" local rootfs_length
kernel_length=$( (tar xO${gz}f "$tar_file" "$board_dir/kernel" | wc -c) 2> /dev/null)
[ "$kernel_length" = 0 ] && kernel_length=
fi
local rootfs_length=$( (tar xO${gz}f "$tar_file" "$board_dir/root" | wc -c) 2> /dev/null)
[ "$rootfs_length" = 0 ] && rootfs_length=
local rootfs_type local rootfs_type
[ "$rootfs_length" ] && rootfs_type="$(identify_tar "$tar_file" "$board_dir/root" "$gz")"
local ubi_kernel_length tar tf "$tar_file" ${board_dir}/root 1>/dev/null 2>/dev/null && has_rootfs=1
if [ "$kernel_length" ]; then [ "$has_rootfs" = "1" ] && {
if [ "$kernel_mtd" ]; then rootfs_length=$( (tar xf "$tar_file" ${board_dir}/root -O | wc -c) 2> /dev/null)
# On some devices, the raw kernel and ubi partitions overlap. rootfs_type="$(identify_tar "$tar_file" ${board_dir}/root)"
# These devices brick if the kernel partition is erased. }
# Hence only invalidate kernel for now.
dd if=/dev/zero bs=4096 count=1 2> /dev/null | \
mtd write - "$CI_KERNPART"
else
ubi_kernel_length="$kernel_length"
fi
fi
local has_kernel=1
local has_env=0 local has_env=0
nand_upgrade_prepare_ubi "$rootfs_length" "$rootfs_type" "$ubi_kernel_length" "$has_env" || return 1
if [ "$rootfs_length" ]; then [ "$kernel_length" != 0 -a -n "$kernel_mtd" ] && {
local ubidev="$( nand_find_ubi "${CI_ROOT_UBIPART:-$CI_UBIPART}" )" tar xf "$tar_file" ${board_dir}/kernel -O | mtd write - $CI_KERNPART
local root_ubivol="$( nand_find_volume $ubidev "$CI_ROOTPART" )" }
tar xO${gz}f "$tar_file" "$board_dir/root" | \ [ "$kernel_length" = 0 -o ! -z "$kernel_mtd" ] && has_kernel=
ubiupdatevol /dev/$root_ubivol -s "$rootfs_length" -
fi
if [ "$kernel_length" ]; then
if [ "$kernel_mtd" ]; then
if [ "$jffs2_markers" = 1 ]; then
flash_erase -j "/dev/mtd${kernel_mtd}" 0 0
tar xO${gz}f "$tar_file" "$board_dir/kernel" | \
nandwrite "/dev/mtd${kernel_mtd}" -
else
tar xO${gz}f "$tar_file" "$board_dir/kernel" | \
mtd write - "$CI_KERNPART"
fi
else
local ubidev="$( nand_find_ubi "${CI_KERN_UBIPART:-$CI_UBIPART}" )"
local kern_ubivol="$( nand_find_volume $ubidev "$CI_KERNPART" )"
tar xO${gz}f "$tar_file" "$board_dir/kernel" | \
ubiupdatevol /dev/$kern_ubivol -s "$kernel_length" -
fi
fi
return 0 nand_upgrade_prepare_ubi "$rootfs_length" "$rootfs_type" "${has_kernel:+$kernel_length}" "$has_env"
local ubidev="$( nand_find_ubi "$CI_UBIPART" )"
[ "$has_kernel" = "1" ] && {
local kern_ubivol="$( nand_find_volume $ubidev $CI_KERNPART )"
tar xf "$tar_file" ${board_dir}/kernel -O | \
ubiupdatevol /dev/$kern_ubivol -s $kernel_length -
} }
nand_verify_if_gzip_file() { [ "$has_rootfs" = "1" ] && {
local file="$1" local root_ubivol="$( nand_find_volume $ubidev $CI_ROOTPART )"
local gz="$2" tar xf "$tar_file" ${board_dir}/root -O | \
ubiupdatevol /dev/$root_ubivol -s $rootfs_length -
if [ "$gz" = z ]; then
echo "verifying compressed sysupgrade file integrity"
if ! gzip -t "$file"; then
echo "corrupted compressed sysupgrade file"
return 1
fi
fi
} }
nand_do_upgrade_success
nand_verify_tar_file() {
local file="$1"
local gz="$2"
echo "verifying sysupgrade tar file integrity"
if ! tar xO${gz}f "$file" > /dev/null; then
echo "corrupted sysupgrade tar file"
return 1
fi
}
nand_do_flash_file() {
local file="$1"
local gz="$(identify_if_gzip "$file")"
local file_type="$(identify "$file" "" "$gz")"
[ ! "$(find_mtd_index "$CI_UBIPART")" ] && CI_UBIPART=rootfs
case "$file_type" in
"fit")
nand_verify_if_gzip_file "$file" "$gz" || return 1
nand_upgrade_fit "$file" "$gz"
;;
"ubi")
nand_verify_if_gzip_file "$file" "$gz" || return 1
nand_upgrade_ubinized "$file" "$gz"
;;
"ubifs")
nand_verify_if_gzip_file "$file" "$gz" || return 1
nand_upgrade_ubifs "$file" "$gz"
;;
*)
nand_verify_tar_file "$file" "$gz" || return 1
nand_upgrade_tar "$file" "$gz"
;;
esac
}
nand_do_restore_config() {
local conf_tar="/tmp/sysupgrade.tgz"
[ ! -f "$conf_tar" ] || nand_restore_config "$conf_tar"
} }
# Recognize type of passed file and start the upgrade process # Recognize type of passed file and start the upgrade process
nand_do_upgrade() { nand_do_upgrade() {
local file="$1" local file_type=$(identify $1)
sync [ ! "$(find_mtd_index "$CI_UBIPART")" ] && CI_UBIPART="rootfs"
nand_do_flash_file "$file" && nand_do_upgrade_success
nand_do_upgrade_failed case "$file_type" in
"fit") nand_upgrade_fit $1;;
"ubi") nand_upgrade_ubinized $1;;
"ubifs") nand_upgrade_ubifs $1;;
*) nand_upgrade_tar $1;;
esac
} }
nand_do_upgrade_success() { # Check if passed file is a valid one for NAND sysupgrade. Currently it accepts
if nand_do_restore_config && sync; then # 3 types of files:
echo "sysupgrade successful" # 1) UBI - should contain an ubinized image, header is checked for the proper
umount -a # MAGIC
reboot -f # 2) UBIFS - should contain UBIFS partition that will replace "rootfs" volume,
fi # header is checked for the proper MAGIC
nand_do_upgrade_failed # 3) TAR - archive has to include "sysupgrade-BOARD" directory with a non-empty
} # "CONTROL" file (at this point its content isn't verified)
nand_do_upgrade_failed() {
sync
echo "sysupgrade failed"
# Should we reboot or bring up some failsafe mode instead?
umount -a
reboot -f
}
# Check if passed file is a valid one for NAND sysupgrade.
# Currently it accepts 4 types of files:
# 1) UBI: a ubinized image containing required UBI volumes.
# 2) UBIFS: a UBIFS rootfs volume image.
# 3) FIT: a FIT image containing kernel and rootfs.
# 4) TAR: an archive that includes directory "sysupgrade-${BOARD_NAME}" containing
# a non-empty "CONTROL" file and required partition and/or volume images.
# #
# You usually want to call this function in platform_check_image. # You usually want to call this function in platform_check_image.
# #
@ -458,25 +343,14 @@ nand_do_upgrade_failed() {
# $(2): file to be checked # $(2): file to be checked
nand_do_platform_check() { nand_do_platform_check() {
local board_name="$1" local board_name="$1"
local file="$2" local tar_file="$2"
local control_length=$( (tar xf $tar_file sysupgrade-$board_name/CONTROL -O | wc -c) 2> /dev/null)
local file_type="$(identify $2)"
local gz="$(identify_if_gzip "$file")" [ "$control_length" = 0 -a "$file_type" != "ubi" -a "$file_type" != "ubifs" -a "$file_type" != "fit" ] && {
local file_type="$(identify "$file" "" "$gz")" echo "Invalid sysupgrade file."
local control_length=$( (tar xO${gz}f "$file" "sysupgrade-${board_name//,/_}/CONTROL" | wc -c) 2> /dev/null)
if [ "$control_length" = 0 ]; then
control_length=$( (tar xO${gz}f "$file" "sysupgrade-${board_name//_/,}/CONTROL" | wc -c) 2> /dev/null)
fi
if [ "$control_length" != 0 ]; then
nand_verify_tar_file "$file" "$gz" || return 1
else
nand_verify_if_gzip_file "$file" "$gz" || return 1
if [ "$file_type" != "fit" -a "$file_type" != "ubi" -a "$file_type" != "ubifs" ]; then
echo "invalid sysupgrade file"
return 1 return 1
fi }
fi
return 0 return 0
} }

View File

@ -39,26 +39,20 @@ switch_to_ramfs() {
for binary in \ for binary in \
/bin/busybox /bin/ash /bin/sh /bin/mount /bin/umount \ /bin/busybox /bin/ash /bin/sh /bin/mount /bin/umount \
pivot_root mount_root reboot sync kill sleep \ pivot_root mount_root reboot sync kill sleep \
md5sum hexdump cat zcat dd tar gzip \ md5sum hexdump cat zcat bzcat dd tar \
ls basename find cp mv rm mkdir rmdir mknod touch chmod \ ls basename find cp mv rm mkdir rmdir mknod touch chmod \
'[' printf wc grep awk sed cut sort tail \ '[' printf wc grep awk sed cut \
mtd partx losetup mkfs.ext4 nandwrite flash_erase \ mtd partx losetup mkfs.ext4 nandwrite flash_erase \
ubiupdatevol ubiattach ubiblock ubiformat \ ubiupdatevol ubiattach ubiblock ubiformat \
ubidetach ubirsvol ubirmvol ubimkvol \ ubidetach ubirsvol ubirmvol ubimkvol \
snapshot snapshot_tool date logger \ snapshot snapshot_tool date \
/usr/sbin/fw_printenv /usr/bin/fwtool \
$RAMFS_COPY_LOSETUP $RAMFS_COPY_LVM \ $RAMFS_COPY_LOSETUP $RAMFS_COPY_LVM \
$RAMFS_COPY_BIN $RAMFS_COPY_BIN
do do
local file="$(command -v "$binary" 2>/dev/null)" local file="$(command -v "$binary" 2>/dev/null)"
[ -n "$file" ] && install_bin "$file" [ -n "$file" ] && install_bin "$file"
done done
install_file /etc/resolv.conf /lib/*.sh /lib/functions/*.sh \ install_file /etc/resolv.conf /lib/*.sh /lib/functions/*.sh /lib/upgrade/*.sh /lib/upgrade/do_stage2 /usr/share/libubox/jshn.sh $RAMFS_COPY_DATA
/lib/upgrade/*.sh /lib/upgrade/do_stage2 \
/usr/share/libubox/jshn.sh /usr/sbin/fw_setenv \
/etc/fw_env.config $RAMFS_COPY_DATA
mkdir -p $RAM_ROOT/var/lock
[ -L "/lib64" ] && ln -s /lib $RAM_ROOT/lib64 [ -L "/lib64" ] && ln -s /lib $RAM_ROOT/lib64
@ -70,10 +64,6 @@ switch_to_ramfs() {
/bin/mount -o remount,ro /mnt /bin/mount -o remount,ro /mnt
/bin/umount -l /mnt /bin/umount -l /mnt
grep -e "^/dev/dm-.*" -e "^/dev/loop.*" /proc/mounts | while read bdev mp _r; do
umount $mp
done
[ "$RAMFS_COPY_LOSETUP" ] && losetup -D [ "$RAMFS_COPY_LOSETUP" ] && losetup -D
[ "$RAMFS_COPY_LVM" ] && { [ "$RAMFS_COPY_LVM" ] && {
mkdir -p /tmp/lvm/cache mkdir -p /tmp/lvm/cache
@ -95,7 +85,7 @@ kill_remaining() { # [ <signal> [ <loop> ] ]
local stat local stat
local proc_ppid=$(cut -d' ' -f4 /proc/$$/stat) local proc_ppid=$(cut -d' ' -f4 /proc/$$/stat)
v "Sending $sig to remaining processes ..." vn "Sending $sig to remaining processes ..."
while $run; do while $run; do
run=false run=false
@ -103,62 +93,45 @@ kill_remaining() { # [ <signal> [ <loop> ] ]
[ -f "$stat" ] || continue [ -f "$stat" ] || continue
local pid name state ppid rest local pid name state ppid rest
read pid rest < $stat read pid name state ppid rest < $stat
name="${rest#\(}" ; rest="${name##*\) }" ; name="${name%\)*}" name="${name#(}"; name="${name%)}"
set -- $rest ; state="$1" ; ppid="$2"
# Skip PID1, our parent, ourself and our children # Skip PID1, our parent, ourself and our children
[ $pid -ne 1 -a $pid -ne $proc_ppid -a $pid -ne $$ -a $ppid -ne $$ ] || continue [ $pid -ne 1 -a $pid -ne $proc_ppid -a $pid -ne $$ -a $ppid -ne $$ ] || continue
[ -f "/proc/$pid/cmdline" ] || continue
local cmdline local cmdline
read cmdline < /proc/$pid/cmdline read cmdline < /proc/$pid/cmdline
# Skip kernel threads # Skip kernel threads
[ -n "$cmdline" ] || continue [ -n "$cmdline" ] || continue
v "Sending signal $sig to $name ($pid)" _vn " $name"
kill -$sig $pid 2>/dev/null kill -$sig $pid 2>/dev/null
[ $loop -eq 1 ] && sleep 2 && run=true [ $loop -eq 1 ] && run=true
done done
let loop_limit-- let loop_limit--
[ $loop_limit -eq 0 ] && { [ $loop_limit -eq 0 ] && {
_v
v "Failed to kill all processes." v "Failed to kill all processes."
exit 1 exit 1
} }
done done
_v
} }
indicate_upgrade indicate_upgrade
while read -r a b c; do killall -9 telnetd
case "$a" in killall -9 dropbear
MemT*) mem="$b" ;; esac killall -9 ash
done < /proc/meminfo
[ "$mem" -gt 32768 ] && \
skip_services="dnsmasq log network"
for service in /etc/init.d/*; do
service=${service##*/}
case " $skip_services " in
*" $service "*) continue ;; esac
ubus call service delete '{ "name": "'"$service"'" }' 2>/dev/null
done
killall -9 telnetd 2>/dev/null
killall -9 dropbear 2>/dev/null
killall -9 ash 2>/dev/null
kill_remaining TERM kill_remaining TERM
sleep 4 sleep 3
kill_remaining KILL 1 kill_remaining KILL 1
sleep 6 sleep 1
echo 3 > /proc/sys/vm/drop_caches echo 3 > /proc/sys/vm/drop_caches

View File

@ -19,7 +19,6 @@ export CONF_IMAGE=
export CONF_BACKUP_LIST=0 export CONF_BACKUP_LIST=0
export CONF_BACKUP= export CONF_BACKUP=
export CONF_RESTORE= export CONF_RESTORE=
export IGNORE_MINOR_COMPAT=0
export NEED_IMAGE= export NEED_IMAGE=
export HELP=0 export HELP=0
export FORCE=0 export FORCE=0
@ -45,7 +44,6 @@ while [ -n "$1" ]; do
-F|--force) export FORCE=1;; -F|--force) export FORCE=1;;
-T|--test) export TEST=1;; -T|--test) export TEST=1;;
-h|--help) export HELP=1; break;; -h|--help) export HELP=1; break;;
--ignore-minor-compat-version) export IGNORE_MINOR_COMPAT=1;;
-*) -*)
echo "Invalid option: $1" >&2 echo "Invalid option: $1" >&2
exit 1 exit 1
@ -82,8 +80,6 @@ upgrade-option:
Verify image and config .tar.gz but do not actually flash. Verify image and config .tar.gz but do not actually flash.
-F | --force -F | --force
Flash image even if image checks fail, this is dangerous! Flash image even if image checks fail, this is dangerous!
--ignore-minor-compat-version
Flash image even if the minor compat version is incompatible.
-q less verbose -q less verbose
-v more verbose -v more verbose
-h | --help display this help -h | --help display this help

View File

@ -6,7 +6,7 @@
usage() { usage() {
cat <<EOF cat <<EOF
Usage: $0 [config|up|down|reconf|reload|status|isup] Usage: $0 [config|up|down|reconf|reload|status]
enables (default), disables or configures devices not yet configured. enables (default), disables or configures devices not yet configured.
EOF EOF
exit 1 exit 1
@ -21,22 +21,6 @@ ubus_wifi_cmd() {
ubus call network.wireless "$1" "$(json_dump)" ubus call network.wireless "$1" "$(json_dump)"
} }
wifi_isup() {
local dev="$1"
json_load "$(ubus_wifi_cmd "status" "$dev")"
json_get_keys devices
for device in $devices; do
json_select "$device"
json_get_var up up
[ $up -eq 0 ] && return 1
json_select ..
done
return 0
}
find_net_config() {( find_net_config() {(
local vif="$1" local vif="$1"
local cfg local cfg
@ -144,14 +128,14 @@ wifi_updown() {
[ enable = "$1" ] && { [ enable = "$1" ] && {
_wifi_updown disable "$2" _wifi_updown disable "$2"
ubus_wifi_cmd "$cmd" "$2" ubus_wifi_cmd "$cmd" "$2"
ubus call network reload
scan_wifi scan_wifi
cmd=up cmd=up
ubus call network reload
} }
[ reconf = "$1" ] && { [ reconf = "$1" ] && {
ubus call network reload
scan_wifi scan_wifi
cmd=reconf cmd=reconf
ubus call network reload
} }
ubus_wifi_cmd "$cmd" "$2" ubus_wifi_cmd "$cmd" "$2"
_wifi_updown "$@" _wifi_updown "$@"
@ -261,7 +245,6 @@ case "$1" in
detect) wifi_detect_notice ;; detect) wifi_detect_notice ;;
config) wifi_config ;; config) wifi_config ;;
status) ubus_wifi_cmd "status" "$2";; status) ubus_wifi_cmd "status" "$2";;
isup) wifi_isup "$2"; exit $?;;
reload) wifi_reload "$2";; reload) wifi_reload "$2";;
reload_legacy) wifi_reload_legacy "$2";; reload_legacy) wifi_reload_legacy "$2";;
--help|help) usage;; --help|help) usage;;

Some files were not shown because too many files have changed in this diff Show More