Compare commits

..

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

11124 changed files with 929009 additions and 1315430 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 规则,创建时请删除
- 禁止有关 "GitHub Actions" 的提交
- 禁止使用 users.noreply.github.com 提交
Q你知道这是`pull request`吗?(使用 "x" 选择)
* [ ] 我知道

View File

@ -10,6 +10,8 @@ name: OpenWrt-CI
on:
schedule:
- cron: 0 20 * * *
release:
types: [published]
permissions:
contents: read
@ -18,43 +20,35 @@ jobs:
build_openwrt:
name: Build OpenWrt Firmware
permissions:
contents: write # for release creation
runs-on: ubuntu-22.04
name: Build OpenWrt firmware
runs-on: ubuntu-latest
if: github.event.repository.owner.id == github.event.sender.id
steps:
- name: Space cleanup and Initialization environment
- name: Checkout
uses: actions/checkout@v2
with:
ref: master
- name: Space cleanup
env:
DEBIAN_FRONTEND: noninteractive
run: |
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 -E apt-mark hold grub-efi-amd64-signed
sudo -E apt 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 -y full-upgrade
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 systemctl daemon-reload
sudo -E apt -y autoremove --purge
sudo -E apt clean
sudo -E timedatectl set-timezone "Asia/Shanghai"
sudo rm -rf /usr/share/dotnet /etc/mysql /etc/php /etc/apt/sources.list.d /usr/local/lib/android
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-get update
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-get -y autoremove --purge
sudo -E apt-get clean
- name: Checkout OpenWrt
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
df -h
- name: Update feeds
run: |
@ -65,8 +59,10 @@ jobs:
- name: Generate configuration file
run: make defconfig
- name: Download packages
run: make download -j16
- name: Make download
run: |
make download -j8
find dl -size -1024c -exec rm -f {} \;
- name: Compile firmware
run: |
@ -82,26 +78,38 @@ jobs:
- name: Prepare artifact
run: |
mkdir -p ./artifact/firmware
mkdir -p ./artifact/package
mkdir -p ./artifact/buildinfo
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/targets/ -type f -name "*.buildinfo" -o -name "*.manifest") ./artifact/buildinfo/
- name: Upload buildinfo
uses: actions/upload-artifact@v4
- name: Deliver buildinfo
uses: actions/upload-artifact@v2
with:
name: OpenWrt_buildinfo
path: ./artifact/buildinfo/
- name: Upload package
uses: actions/upload-artifact@v4
- name: Deliver package
uses: actions/upload-artifact@v2
with:
name: OpenWrt_package
path: ./artifact/package/
- name: Upload firmware
uses: actions/upload-artifact@v4
- name: Deliver firmware
uses: actions/upload-artifact@v2
with:
name: OpenWrt_firmware
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
mainmenu "LEDE Configuration"
mainmenu "OpenWrt Configuration"
config MODULES
modules
option modules
bool
default y
@ -13,14 +13,6 @@ config HAVE_DOT_CONFIG
bool
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 "config/Config-images.in"

View File

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

View File

@ -1,25 +1,11 @@
# 欢迎来到 Lean 的 LEDE 源码仓库
# 欢迎来到 Lean 的 Openwrt 源码仓库
为国产龙芯 LOONGSON SoC loongarch64 / 飞腾 Phytium 腾锐 D2000 系列架构添加支持
I18N: [English](README_EN.md) | [简体中文](README.md) | [日本語](README_JA.md)
如何编译自己需要的 OpenWrt 固件 [How to build your Openwrt firmware](./README_EN.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)
1. QQ 讨论群: Op固件技术研究群 ,号码 891659613 ,加群链接:[点击加入](https://jq.qq.com/?_wv=1027&k=XL8SK5aC "Op固件技术研究群")
2. TG 讨论群: OP 编译官方大群 ,加群链接:[点击加入](https://t.me/JhKgAA6Hx1 "OP 编译官方大群")
## 注意
@ -29,7 +15,7 @@ ArmSoM-Sige 系列:软路由、单板计算机、小型服务器与智能家
## 编译命令
1. 首先装好 Linux 系统,推荐 Debian 或 Ubuntu LTS
1. 首先装好 Linux 系统,推荐 Debian 11 或 Ubuntu LTS
2. 安装编译依赖
@ -37,12 +23,11 @@ ArmSoM-Sige 系列:软路由、单板计算机、小型服务器与智能家
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 \
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
bzip2 ccache cmake cpio curl device-tree-compiler fastjar flex gawk gettext gcc-multilib g++-multilib \
git gperf haveged help2man intltool libc6-dev-i386 libelf-dev libglib2.0-dev libgmp3-dev libltdl-dev \
libmpc-dev libmpfr-dev libncurses5-dev libncursesw5-dev libreadline-dev libssl-dev libtool lrzsz \
mkisofs msmtp nano ninja-build p7zip p7zip-full patch pkgconf python2.7 python3 python3-pip libpython3-dev qemu-utils \
rsync scons squashfs-tools subversion swig texinfo uglifyjs upx-ucl unzip vim wget xmlto xxd zlib1g-dev
```
3. 下载源代码,更新 feeds 并选择配置
@ -63,7 +48,7 @@ ArmSoM-Sige 系列:软路由、单板计算机、小型服务器与智能家
make V=s -j1
```
本套代码保证肯定可以编译成功。里面包括了 R24 所有源代码,包括 IPK 的。
本套代码保证肯定可以编译成功。里面包括了 R22 所有源代码,包括 IPK 的。
你可以自由使用,但源码编译二次发布请注明我的 GitHub 仓库链接。谢谢合作!
@ -82,14 +67,14 @@ make V=s -j$(nproc)
如果需要重新配置:
```bash
rm -rf .config
rm -rf ./tmp && rm -rf .config
make menuconfig
make V=s -j$(nproc)
```
编译完成后输出路径bin/targets
### 使用 WSL/WSL2 进行编译
### 如果你使用 WSL/WSL2 进行编译
由于 WSL 的 PATH 中包含带有空格的 Windows 路径,有可能会导致编译失败,请在 `make` 前面加上:
@ -97,23 +82,6 @@ make V=s -j$(nproc)
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 原生系统进行编译
1. 在 AppStore 中安装 Xcode
@ -121,10 +89,10 @@ PS > git clone https://github.com/coolsnowwolf/lede <your_local_lede_path>
2. 安装 Homebrew
```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
brew unlink awk
@ -134,8 +102,6 @@ PS > git clone https://github.com/coolsnowwolf/lede <your_local_lede_path>
4. 然后输入以下命令,添加到系统环境变量中:
- intel 芯片的 mac
```bash
echo 'export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"' >> ~/.bashrc
echo 'export PATH="/usr/local/opt/findutils/libexec/gnubin:$PATH"' >> ~/.bashrc
@ -146,23 +112,11 @@ PS > git clone https://github.com/coolsnowwolf/lede <your_local_lede_path>
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 一样正常编译了
## 特别提示
1. 源代码中绝不含任何后门和可以监控或者劫持你的 HTTPS 的闭源软件, SSL 安全是互联网最后的壁垒,安全干净才是固件应该做到的。
1. 源代码中绝不含任何后门和可以监控或者劫持你的 HTTPS 的闭源软件, SSL 安全是互联网最后的壁垒。安全干净才是固件应该做到的;
2. 想学习 OpenWrt 开发,但是摸不着门道?自学没毅力?基础太差?怕太难学不会?跟着佐大学 OpenWrt 开发入门培训班助你能学有所成
报名地址:[点击报名](http://forgotfun.org/2018/04/openwrt-training-2018.html "报名")
@ -171,6 +125,21 @@ PS > git clone https://github.com/coolsnowwolf/lede <your_local_lede_path>
4. 存档版本仓库地址:<https://github.com/coolsnowwolf/openwrt>
## 软路由介绍
iKOOLCORE 硬酷R1 多网口小主机 - N5105/N6005 : Cube box, rest fun. 方寸之间,尽是乐趣
(商品介绍页面 - 深圳市硬酷科技)
[Lean用户R1专属券](https://taoquan.taobao.com/coupon/unify_apply.htm?sellerId=1981117776&activityId=3eb8a2ad3c8945ed831b203f44dc218b)
[N5105下单链接](https://item.taobao.com/item.htm?ft=t&id=682987219699)
[N6005下单链接](https://item.taobao.com/item.htm?ft=t&id=682672722483)
(商品介绍页面 - 硬酷科技(支持花呗))
[Lean用户R1专属券](https://taoquan.taobao.com/coupon/unify_apply.htm?sellerId=2208215115814&activityId=e013790422b849edb3a71e4e6aa46ff3)
[下单链接](https://item.taobao.com/item.htm?ft=t&id=682987219699)
[![r1](doc/r1.jpg)](https://item.taobao.com/item.htm?ft=t&id=682025492099)
## 捐贈
如果你觉得此项目对你有帮助,可以捐助我们,以鼓励项目能持续发展,更加完善

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`.
Join the group: [Link](https://jq.qq.com/?_wv=1027&k=XL8SK5aC "Op固件技术研究群").
- [Click to download QQ client](https://im.qq.com/pcqq).
Let's start!
---
1. First, install Ubuntu 64bit (Ubuntu 20.04 LTS x86 is recommended).
2. Telegram Group: *OpenWRT Firmware Technical Research Group*.
Join the group: [Link](https://t.me/JhKgAA6Hx1 "OP 编译官方大群").
2. Run `sudo apt-get update` in the terminal, and then run
`
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.
[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
4. ```bash
./scripts/feeds update -a
./scripts/feeds install -a
make menuconfig
```
4. Download libraries and compile firmware
> (`-j` is the thread count, single-thread is recommended for the first build):
5. Run `make -j8 download V=s` to download libraries and dependencies (user in China should use global proxy when possible)
```bash
make download -j8
make V=s -j1
```
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.
These commands are supposed to compile the source code successfully.
All source code of R23 is included, including IPK.
This source code is promised to be compiled successfully.
You can use this source code freely, but please link this GitHub repository when redistributing.
Thank you for your cooperation!
You can use this source code freely, but please link this GitHub repository when redistributing. Thank you for your cooperation!
=
Rebuild:
```bash
cd lede
git pull
./scripts/feeds update -a
./scripts/feeds install -a
./scripts/feeds update -a && ./scripts/feeds install -a
make defconfig
make download -j8
make V=s -j$(nproc)
make -j8 download
make -j$(($(nproc) + 1)) V=s
```
If reconfiguration is need:
```bash
rm -rf ./tmp && rm -rf .config
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.
Please add the following lines to your local environment profiles before compiling:
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)
```bash
# 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
```
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.
NTFS-formatted drives mounted to a WSL distribution will be case-insensitive by default.
This will cause the following error when compiling in WSL/WSL2:
## Router Recommendation
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
Build dependency: OpenWrt can only be built on a case-sensitive filesystem
```
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>
![xm1](doc/xm5.jpg)
![xm2](doc/xm6.jpg)
## 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">
<img src="./doc/star.png" width = "400" alt="" align=center />
</div>
<br>
### Alipay
![alipay](doc/alipay_donate.jpg)
### 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
bool "Enable experimental features by default"
default n
help
Set this option to build with latest bleeding edge features
which may or may not work as expected.
@ -20,20 +21,12 @@ menu "Global build settings"
config JSON_OVERVIEW_IMAGE_INFO
bool "Create JSON info file overview per target"
default y
default BUILDBOT
help
Create a JSON info file called profiles.json in the target
directory containing machine readable list of built profiles
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
bool "Select all target specific packages by default"
select ALL_KMODS
@ -49,6 +42,7 @@ menu "Global build settings"
config BUILDBOT
bool "Set build defaults for automatic builds (e.g. via buildbot)"
default n
help
This option changes several defaults to be more suitable for
automatic builds. This includes the following changes:
@ -68,11 +62,6 @@ menu "Global build settings"
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"
config TESTING_KERNEL
@ -86,8 +75,10 @@ menu "Global build settings"
config DISPLAY_SUPPORT
bool "Show packages that require graphics support (local or remote)"
default n
config BUILD_PATENTED
default n
bool "Compile with support for patented functionality"
help
When this option is disabled, software which provides patented functionality
@ -95,6 +86,7 @@ menu "Global build settings"
functionality, this optional support will get disabled for this package.
config BUILD_NLS
default n
bool "Compile with full language support"
help
When this option is enabled, packages are built with the full versions of
@ -108,6 +100,7 @@ menu "Global build settings"
config CLEAN_IPKG
bool
prompt "Remove ipkg/opkg status data files in final images"
default n
help
This removes all ipkg/opkg status data files from the target directory
before building the root filesystem.
@ -115,13 +108,14 @@ menu "Global build settings"
config IPK_FILES_CHECKSUMS
bool
prompt "Record files checksums in package metadata"
depends on !USE_APK
default n
help
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
bool "Include build configuration in firmware" if DEVEL
default n
help
If enabled, buildinfo files will be stored in /etc/build.* of firmware.
@ -155,44 +149,22 @@ menu "Global build settings"
config DEBUG
bool
prompt "Compile packages with debugging info"
default n
help
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
def_bool y
bool
prompt "Enable IPv6 support in packages"
default y
help
Enables IPv6 support in kernel (builtin) and packages.
comment "Stripping options"
choice
prompt "Binary stripping method"
default USE_STRIP if EXTERNAL_TOOLCHAIN
default USE_STRIP if USE_GLIBC
default USE_SSTRIP
help
@ -209,6 +181,7 @@ menu "Global build settings"
help
This will install binaries stripped using strip from binutils.
config USE_SSTRIP
bool "sstrip"
depends on !USE_GLIBC
@ -225,16 +198,16 @@ menu "Global build settings"
help
Specifies arguments passed to the strip command when stripping binaries.
config SSTRIP_DISCARD_TRAILING_ZEROES
bool "Strip trailing zero bytes"
depends on USE_SSTRIP && !USE_MOLD
default y
config SSTRIP_ARGS
string
prompt "Sstrip arguments"
depends on USE_SSTRIP
default "-z"
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
bool "Strip unnecessary exports from the kernel image"
depends on BROKEN
help
Reduces kernel size by stripping unused kernel exports from the kernel
image. Note that this might make the kernel incompatible with any kernel
@ -248,6 +221,20 @@ menu "Global build settings"
make the system libraries incompatible with most of the packages that are
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"
config PKG_CHECK_FORMAT_SECURITY
@ -296,22 +283,10 @@ menu "Global build settings"
Enable GCC Stack Smashing Protection (SSP) for userspace applications
config PKG_CC_STACKPROTECTOR_NONE
bool "None"
help
No stack smashing protection.
config PKG_CC_STACKPROTECTOR_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
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
choice
@ -321,18 +296,10 @@ menu "Global build settings"
Enable GCC Stack-Smashing Protection (SSP) for the kernel
config KERNEL_CC_STACKPROTECTOR_NONE
bool "None"
help
No stack smashing protection.
config KERNEL_CC_STACKPROTECTOR_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
bool "Strong"
help
Like Regular, but also protects functions with
local arrays or references to local frame addresses.
endchoice
config KERNEL_STACKPROTECTOR
@ -423,16 +390,4 @@ menu "Global build settings"
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

View File

@ -4,9 +4,11 @@
menuconfig DEVEL
bool "Advanced configuration options (for developers)"
default n
config BROKEN
bool "Show broken platforms / packages / devices" if DEVEL
default n
config BINARY_FOLDER
string "Binary folder" if DEVEL
@ -15,20 +17,6 @@ menuconfig DEVEL
Store built firmware images and filesystem images in this directory.
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
string "Download folder" if DEVEL
default ""
@ -51,17 +39,12 @@ menuconfig DEVEL
config AUTOREMOVE
bool "Automatic removal of build directories" if DEVEL
default n
help
Automatically delete build directories after make target completed.
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.
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
string "Build suffix to append to the target BUILD_DIR variable" if DEVEL
default ""
@ -80,6 +63,7 @@ menuconfig DEVEL
config CCACHE
bool "Use ccache" if DEVEL
default n
help
Compiler cache; see https://ccache.samba.org/
@ -90,11 +74,6 @@ menuconfig DEVEL
Store ccache in this directory.
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
string "Use external kernel tree" if DEVEL
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_mpc85xx
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_NONE
depends on TARGET_ROOTFS_INITRAMFS
@ -37,16 +37,18 @@ menu "Target Images"
bool "lzma"
config TARGET_INITRAMFS_COMPRESSION_LZO
depends on !TARGET_ROOTFS_INITRAMFS_SEPARATE
bool "lzo"
config TARGET_INITRAMFS_COMPRESSION_LZ4
depends on !TARGET_ROOTFS_INITRAMFS_SEPARATE
bool "lz4"
config TARGET_INITRAMFS_COMPRESSION_XZ
bool "xz"
config TARGET_INITRAMFS_COMPRESSION_ZSTD
depends on !LINUX_5_4
depends on !LINUX_5_4 && !LINUX_4_19
bool "zstd"
endchoice
@ -150,17 +152,14 @@ menu "Target Images"
bool "squashfs"
default y if USES_SQUASHFS
help
Build a squashfs root filesystem.
Build a squashfs-lzma root filesystem.
config TARGET_SQUASHFS_BLOCK_SIZE
int "Block size (in KiB)"
depends on TARGET_ROOTFS_SQUASHFS
default 64 if LOW_MEMORY_FOOTPRINT
default 1024 if (SMALL_FLASH && !LOW_MEMORY_FOOTPRINT)
default 256
help
Select squashfs block size, must be one of:
4, 8, 16, 32, 64, 128, 256, 512, 1024
default 1024
menuconfig TARGET_ROOTFS_UBIFS
bool "ubifs"
@ -198,23 +197,18 @@ menu "Target Images"
default ""
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_ROOTFS_EXT4FS || TARGET_ROOTFS_JFFS2 || TARGET_ROOTFS_SQUASHFS
select PACKAGE_grub2
select PACKAGE_grub2-bios-setup
default n
config GRUB_EFI_IMAGES
bool "Build GRUB EFI images"
depends on TARGET_x86 || TARGET_armvirt || TARGET_loongarch64 || TARGET_phytium
bool "Build GRUB EFI images (Linux x86 or x86_64 host only)"
depends on TARGET_x86
depends on TARGET_ROOTFS_EXT4FS || TARGET_ROOTFS_JFFS2 || TARGET_ROOTFS_SQUASHFS
select PACKAGE_grub2 if TARGET_x86
select PACKAGE_grub2-efi if TARGET_x86
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_grub2
select PACKAGE_grub2-efi
select PACKAGE_kmod-fs-vfat
default y
@ -279,8 +273,9 @@ menu "Target Images"
config VMDK_IMAGES
bool "Build VMware image files (VMDK)"
depends on TARGET_x86 || TARGET_armvirt
depends on TARGET_x86
depends on GRUB_IMAGES || GRUB_EFI_IMAGES
default y
select PACKAGE_kmod-e1000
config VHDX_IMAGES
@ -291,29 +286,25 @@ menu "Target Images"
config TARGET_IMAGES_GZIP
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
comment "Image Options"
source "target/linux/*/image/Config.in"
source "target/linux/*/*/image/Config.in"
config TARGET_KERNEL_PARTSIZE
int "Kernel partition size (in MiB)"
int "Kernel partition size (in MB)"
depends on USES_BOOT_PART
default 8 if TARGET_apm821xx_sata
default 64 if TARGET_bcm27xx
default 128 if TARGET_armvirt
default 32 if TARGET_rockchip
default 64 if TARGET_rockchip
default 16
config TARGET_ROOTFS_PARTSIZE
int "Root filesystem partition size (in MiB)"
depends on USES_ROOTFS_PART || TARGET_ROOTFS_EXT4FS
default 232 if TARGET_loongarch64
default 448 if TARGET_mediatek || TARGET_x86
default 160
int "Root filesystem partition size (in MB)"
depends on USES_ROOTFS_PART || TARGET_ROOTFS_EXT4FS || TARGET_omap || TARGET_sunxi || TARGET_uml
default 400
help
Select the root filesystem partition size.

View File

@ -24,6 +24,11 @@ config KERNEL_PRINTK
bool "Enable support for printk"
default y
config KERNEL_CRASHLOG
bool "Crash logging"
depends on !(arm || powerpc || sparc || TARGET_uml || i386 || x86_64)
default y
config KERNEL_SWAP
bool "Support for paging of anonymous memory (swap)"
default y if !SMALL_FLASH
@ -43,29 +48,17 @@ config KERNEL_DEBUG_FS
config KERNEL_MIPS_FP_SUPPORT
bool
default y if TARGET_pistachio
default y
depends on (mips || mipsel || mips64 || mips64el)
config KERNEL_ARM_PMU
bool
default y if TARGET_armsr_armv8
default n
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
bool "Enable vsyscall emulation"
default n
depends on x86_64
help
This enables emulation of the legacy vsyscall page. Disabling
@ -83,22 +76,17 @@ config KERNEL_X86_VSYSCALL_EMULATION
config KERNEL_PERF_EVENTS
bool "Compile the kernel with performance events and counters"
default n
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
bool "Compile the kernel with profiling enabled"
default n
select KERNEL_PERF_EVENTS
help
Enable the extended profiling support mechanisms used by profilers such
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
bool "Compile the kernel with undefined behaviour sanity checker"
help
@ -127,16 +115,6 @@ config KERNEL_UBSAN_ALIGNMENT
Enabling this option on architectures that support unaligned
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
bool "Enable checking of null pointers"
depends on KERNEL_UBSAN
@ -144,23 +122,10 @@ config KERNEL_UBSAN_NULL
This option enables detection of memory accesses via a
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
bool "Compile the kernel with KASan: runtime memory debugger"
select KERNEL_SLUB_DEBUG
depends on (x86_64 || aarch64 || arm || powerpc || riscv64)
depends on (x86_64 || aarch64)
help
Enables kernel address sanitizer - runtime memory debugger,
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
(the resulting kernel does not boot).
config KERNEL_KASAN_VMALLOC
bool "Back mappings in vmalloc space with real shadow memory"
depends on KERNEL_KASAN
config KERNEL_KASAN_EXTRA
bool "KAsan: extra checks"
depends on KERNEL_KASAN && KERNEL_DEBUG_KERNEL
help
By default, the shadow region for vmalloc space is the read-only
zero page. This means that KASAN cannot detect errors involving
vmalloc space.
This enables further checks in the kernel address sanitizer, for now
it only includes the address-use-after-scope check that can lead
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
prompt "Instrumentation type"
depends on KERNEL_KASAN
depends on !KERNEL_KASAN_HW_TAGS
default KERNEL_KASAN_OUTLINE
config KERNEL_KASAN_OUTLINE
@ -315,6 +209,7 @@ config KERNEL_KCOV_INSTRUMENT_ALL
config KERNEL_TASKSTATS
bool "Compile the kernel with task resource/io statistics and accounting"
default n
help
Enable the collection and publishing of task/io statistics and
accounting. Enable this option to enable i/o monitoring in system
@ -333,25 +228,6 @@ if KERNEL_TASKSTATS
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
bool "Compile the kernel with symbol table information"
default y if !SMALL_FLASH
@ -361,30 +237,37 @@ config KERNEL_KALLSYMS
config KERNEL_FTRACE
bool "Compile the kernel with tracing support"
depends on !TARGET_uml
default n
config KERNEL_FTRACE_SYSCALLS
bool "Trace system calls"
depends on KERNEL_FTRACE
default n
config KERNEL_ENABLE_DEFAULT_TRACERS
bool "Trace process context switches and events"
depends on KERNEL_FTRACE
default n
config KERNEL_FUNCTION_TRACER
bool "Function tracer"
depends on KERNEL_FTRACE
default n
config KERNEL_FUNCTION_GRAPH_TRACER
bool "Function graph tracer"
depends on KERNEL_FUNCTION_TRACER
default n
config KERNEL_DYNAMIC_FTRACE
bool "Enable/disable function tracing dynamically"
depends on KERNEL_FUNCTION_TRACER
default n
config KERNEL_FUNCTION_PROFILER
bool "Function profiler"
depends on KERNEL_FUNCTION_TRACER
default n
config KERNEL_IRQSOFF_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
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
bool
default n
config KERNEL_DEBUG_INFO
bool "Compile the kernel with debug information"
@ -443,61 +314,6 @@ config KERNEL_DEBUG_INFO
help
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
bool
default n
@ -511,16 +327,10 @@ config KERNEL_DEBUG_LL
help
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
bool "Compile the kernel with dynamic printk"
select KERNEL_DEBUG_FS
default n
help
Compiles debug level messages into the kernel, which would not
otherwise be available at runtime. These messages can then be
@ -532,6 +342,7 @@ config KERNEL_DYNAMIC_DEBUG
config KERNEL_EARLY_PRINTK
bool "Compile the kernel with early printk"
default y if TARGET_bcm53xx
default n
depends on arm
select KERNEL_DEBUG_KERNEL
select KERNEL_DEBUG_LL if arm
@ -542,6 +353,7 @@ config KERNEL_EARLY_PRINTK
config KERNEL_KPROBES
bool "Compile the kernel with kprobes support"
default n
select KERNEL_FTRACE
select KERNEL_PERF_EVENTS
help
@ -556,32 +368,13 @@ config KERNEL_KPROBE_EVENTS
bool
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
bool "Compile the kernel with asynchronous IO support"
default y if !SMALL_FLASH
config KERNEL_IO_URING
bool "Compile the kernel with io_uring support"
depends on !SMALL_FLASH
default y if (x86_64 || aarch64)
default y if !SMALL_FLASH
config KERNEL_FHANDLE
bool "Compile the kernel with support for fhandle syscalls"
@ -593,6 +386,7 @@ config KERNEL_FANOTIFY
config KERNEL_BLK_DEV_BSG
bool "Compile the kernel with SCSI generic v4 support for any block device"
default n
config KERNEL_TRANSPARENT_HUGEPAGE
bool
@ -616,6 +410,7 @@ config KERNEL_HUGETLB_PAGE
bool "Compile the kernel with HugeTLB support"
select KERNEL_TRANSPARENT_HUGEPAGE
select KERNEL_HUGETLBFS
default n
config KERNEL_MAGIC_SYSRQ
bool "Compile the kernel with SysRq support"
@ -640,35 +435,36 @@ config KERNEL_ELF_CORE
config KERNEL_PROVE_LOCKING
bool "Enable kernel lock checking"
select KERNEL_DEBUG_KERNEL
default n
config KERNEL_SOFTLOCKUP_DETECTOR
bool "Compile the kernel with detect Soft Lockups"
config KERNEL_LOCKUP_DETECTOR
bool "Compile the kernel with detect Hard and Soft Lockups"
depends on KERNEL_DEBUG_KERNEL
help
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
mode for more than 20 seconds, without giving other tasks a
chance to run. The current stack trace is displayed upon
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
for more than 10 seconds, without letting other interrupts have a
chance to run. The current stack trace is displayed upon detection
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
bool "Compile the kernel with detect Hung Tasks"
depends on KERNEL_DEBUG_KERNEL
default KERNEL_SOFTLOCKUP_DETECTOR
default KERNEL_LOCKUP_DETECTOR
help
Say Y here to enable the kernel to detect "hung tasks",
which are bugs that cause the task to be stuck in
@ -714,23 +510,10 @@ config KERNEL_PRINTK_TIME
default y
config KERNEL_SLUB_DEBUG
bool "Enable SLUB debugging support"
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.
bool
config KERNEL_SLUB_DEBUG_ON
depends on KERNEL_SLUB_DEBUG
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.
bool
config KERNEL_SLABINFO
select KERNEL_SLUB_DEBUG
@ -766,9 +549,11 @@ config USE_RFKILL
config USE_SPARSE
bool "Enable sparse check during kernel build"
default n
config KERNEL_DEVTMPFS
bool "Compile the kernel with device tmpfs enabled"
default n
help
devtmpfs is a simple, kernel-managed /dev filesystem. The kernel creates
devices nodes for all registered devices to simplify boot, but leaves more
@ -778,6 +563,7 @@ if KERNEL_DEVTMPFS
config KERNEL_DEVTMPFS_MOUNT
bool "Automatically mount devtmpfs after root filesystem is mounted"
default n
endif
@ -788,14 +574,17 @@ config KERNEL_KEYS
config KERNEL_PERSISTENT_KEYRINGS
bool "Enable kernel persistent keyrings"
depends on KERNEL_KEYS
default n
config KERNEL_KEYS_REQUEST_CACHE
bool "Enable temporary caching of the last request_key() result"
depends on KERNEL_KEYS
default n
config KERNEL_BIG_KEYS
bool "Enable large payload keys on kernel keyrings"
depends on KERNEL_KEYS
default n
#
# CGROUP support symbols
@ -809,6 +598,7 @@ if KERNEL_CGROUPS
config KERNEL_CGROUP_DEBUG
bool "Example debug cgroup subsystem"
default n
help
This option enables a simple cgroup subsystem that
exports useful debugging information about the cgroups
@ -819,6 +609,7 @@ if KERNEL_CGROUPS
config KERNEL_CGROUP_FREEZER
bool "legacy Freezer cgroup subsystem"
default n
select KERNEL_FREEZER
help
Provides a way to freeze and unfreeze all tasks in a
@ -828,6 +619,7 @@ if KERNEL_CGROUPS
config KERNEL_CGROUP_DEVICE
bool "legacy Device controller for cgroups"
default n
help
Provides a cgroup implementing whitelists for devices which
a process in the cgroup can mknod or open.
@ -835,6 +627,7 @@ if KERNEL_CGROUPS
config KERNEL_CGROUP_HUGETLB
bool "HugeTLB controller"
default n
select KERNEL_HUGETLB_PAGE
config KERNEL_CGROUP_PIDS
@ -861,19 +654,9 @@ if KERNEL_CGROUPS
Memory Nodes and assigning tasks to run only within those sets.
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
bool "Include legacy /proc/<pid>/cpuset file"
default n
depends on KERNEL_CPUSETS
config KERNEL_CGROUP_CPUACCT
@ -898,7 +681,7 @@ if KERNEL_CGROUPS
bool "Memory Resource Controller for Control Groups"
default y
select KERNEL_FREEZER
depends on KERNEL_RESOURCE_COUNTERS
depends on KERNEL_RESOURCE_COUNTERS || !LINUX_3_18
help
Provides a memory resource controller that manages both anonymous
memory and page cache. (See Documentation/cgroups/memory.txt)
@ -939,6 +722,7 @@ if KERNEL_CGROUPS
config KERNEL_MEMCG_SWAP_ENABLED
bool "Memory Resource Controller Swap Extension enabled by default"
default n
depends on KERNEL_MEMCG_SWAP
help
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
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
bool "Enable perf_event per-cpu per-container group (cgroup) monitoring"
select KERNEL_PERF_EVENTS
default n
help
This option extends the per-cpu mode to restrict monitoring to
threads which belong to the cgroup specified and run on the
@ -1058,6 +828,7 @@ if KERNEL_CGROUPS
config KERNEL_DEBUG_BLK_CGROUP
bool "Enable Block IO controller debugging"
default n
depends on KERNEL_BLK_CGROUP
help
Enable some debugging help. Currently it exports additional stat
@ -1065,12 +836,15 @@ if KERNEL_CGROUPS
config KERNEL_NET_CLS_CGROUP
bool "legacy Control Group Classifier"
default n
config KERNEL_CGROUP_NET_CLASSID
bool "legacy Network classid cgroup"
default n
config KERNEL_CGROUP_NET_PRIO
bool "legacy Network priority cgroup"
default n
endif
@ -1170,19 +944,6 @@ config KERNEL_IP_MROUTE
Multicast routing requires a multicast routing daemon in
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
#
@ -1205,15 +966,8 @@ if KERNEL_IPV6
Multicast routing requires a multicast routing daemon in
addition to kernel support.
if KERNEL_IPV6_MROUTE
config KERNEL_IPV6_MROUTE_MULTIPLE_TABLES
def_bool y
config KERNEL_IPV6_PIMSM_V2
def_bool y
endif
config KERNEL_IPV6_PIMSM_V2
def_bool n
config KERNEL_IPV6_SEG6_LWTUNNEL
bool "Enable support for lightweight tunnels"
@ -1226,45 +980,6 @@ if KERNEL_IPV6
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
#
@ -1299,20 +1014,14 @@ if KERNEL_IP_PNP
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"
config USE_FS_ACL_ATTR
bool "Use filesystem ACL and attr support by default"
default y if !SMALL_FLASH
default n
help
Make using ACLs (e.g. POSIX ACL, NFSv4 ACL) the default
for kernel and packages, except old NFS.
Also enable userspace extended attribute support
for kernel and packages, except tmpfs, flash filesystems,
and old NFS. Also enable userspace extended attribute support
by default. (OpenWrt already has an expection it will be
present in the kernel).
@ -1333,17 +1042,17 @@ menu "Filesystem ACL and attr support options"
config KERNEL_F2FS_FS_POSIX_ACL
bool "Enable POSIX ACL for F2FS Filesystems"
select KERNEL_FS_POSIX_ACL
default y if USE_FS_ACL_ATTR
default n
config KERNEL_JFFS2_FS_POSIX_ACL
bool "Enable POSIX ACL for JFFS2 Filesystems"
select KERNEL_FS_POSIX_ACL
default y if USE_FS_ACL_ATTR
default n
config KERNEL_TMPFS_POSIX_ACL
bool "Enable POSIX ACL for TMPFS Filesystems"
select KERNEL_FS_POSIX_ACL
default y if USE_FS_ACL_ATTR
default n
config KERNEL_CIFS_ACL
bool "Enable CIFS ACLs"
@ -1366,12 +1075,15 @@ menu "Filesystem ACL and attr support options"
config KERNEL_NFS_V3_ACL_SUPPORT
bool "Enable ACLs for NFSv3"
default n
config KERNEL_NFSD_V2_ACL_SUPPORT
bool "Enable ACLs for NFSDv2"
default n
config KERNEL_NFSD_V3_ACL_SUPPORT
bool "Enable ACLs for NFSDv3"
default n
config KERNEL_REISER_FS_POSIX_ACL
bool "Enable POSIX ACLs for ReiserFS"
@ -1413,7 +1125,7 @@ config KERNEL_SQUASHFS_XATTR
bool "Squashfs XATTR support"
#
# compile optimization setting
# compile optimiziation setting
#
choice
prompt "Compiler optimization level"
@ -1480,30 +1192,12 @@ config KERNEL_LSM
config KERNEL_EXT4_FS_SECURITY
bool "Ext4 Security Labels"
default y if !SMALL_FLASH
config KERNEL_F2FS_FS_SECURITY
bool "F2FS Security Labels"
default y if !SMALL_FLASH
config KERNEL_UBIFS_FS_SECURITY
bool "UBIFS Security Labels"
default y if !SMALL_FLASH
config KERNEL_JFFS2_FS_SECURITY
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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 125 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 126 KiB

View File

@ -1,10 +1,7 @@
src-git packages https://github.com/coolsnowwolf/packages
#src-git luci https://github.com/coolsnowwolf/luci
src-git luci https://github.com/coolsnowwolf/luci.git;openwrt-23.05
src-git luci https://github.com/coolsnowwolf/luci
src-git routing https://github.com/coolsnowwolf/routing
src-git telephony https://github.com/coolsnowwolf/telephony.git
#src-git helloworld https://github.com/fw876/helloworld.git
#src-git oui https://github.com/zhaojh329/oui.git
src-git telephony https://git.openwrt.org/feed/telephony.git
#src-git video https://github.com/openwrt/video.git
#src-git targets https://github.com/openwrt/targets.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 \
LIBTOOL=$(STAGING_DIR_HOST)/bin/libtool \
M4=$(STAGING_DIR_HOST)/bin/m4 \
AUTOPOINT=true \
GTKDOCIZE=true
AUTOPOINT=true
# 1: build dir
# 2: remove files
@ -36,7 +35,7 @@ define autoreconf
$(patsubst %,rm -f %;,$(2)) \
$(foreach p,$(3), \
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 ] || \
ln -s $(SCRIPT_DIR)/config.rpath $(p)/config.rpath; \
touch NEWS AUTHORS COPYING ABOUT-NLS ChangeLog; \
@ -114,7 +113,7 @@ ifneq ($(filter patch-libtool,$(PKG_FIXUP)),)
endif
ifneq ($(filter libtool,$(PKG_FIXUP)),)
PKG_BUILD_DEPENDS += libtool
PKG_BUILD_DEPENDS += libtool gettext libiconv
ifeq ($(filter no-autoreconf,$(PKG_FIXUP)),)
Hooks/Configure/Pre += autoreconf_target
endif
@ -125,7 +124,7 @@ ifneq ($(filter libtool-abiver,$(PKG_FIXUP)),)
endif
ifneq ($(filter libtool-ucxx,$(PKG_FIXUP)),)
PKG_BUILD_DEPENDS += libtool
PKG_BUILD_DEPENDS += libtool gettext libiconv
ifeq ($(filter no-autoreconf,$(PKG_FIXUP)),)
Hooks/Configure/Pre += autoreconf_target
endif

View File

@ -63,15 +63,13 @@ BPF_CFLAGS := \
-Wno-unused-label \
-O2 -emit-llvm -Xclang -disable-llvm-passes
ifneq ($(CONFIG_HAS_BPF_TOOLCHAIN),)
ifeq ($(DUMP)$(filter download refresh,$(MAKECMDGOALS)),)
ifeq ($(DUMP),)
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 )
ifeq ($(CLANG_VER_VALID),)
$(error ERROR: LLVM/clang version too old. Minimum required: $(CLANG_MIN_VER), found: $(CLANG_VER))
endif
endif
endif
define CompileBPF
$(CLANG) -g -target $(BPF_ARCH)-linux-gnu $(BPF_CFLAGS) $(2) \

View File

@ -52,7 +52,7 @@ CMAKE_RANLIB:=$(call cmake_tool,$(TARGET_RANLIB))
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_SHARED_LDFLAGS:=-Wl,-Bsymbolic-functions
CMAKE_HOST_INSTALL_PREFIX = $(HOST_BUILD_PREFIX)
CMAKE_HOST_INSTALL_PREFIX ?= $(HOST_BUILD_PREFIX)
ifeq ($(HOST_USE_NINJA),1)
CMAKE_HOST_OPTIONS += -DCMAKE_GENERATOR="Ninja"

View File

@ -12,7 +12,6 @@
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_reproducible=find $(wildcard $(1)) -type f $(patsubst -x,-and -not -path,$(DEP_FINDPARAMS) $(2)) -print0 | xargs -0 $(MKHASH) md5 | sort | $(MKHASH) md5
define rdep
.PRECIOUS: $(2)
@ -28,7 +27,7 @@ ifneq ($(wildcard $(2)),)
{ [ \! -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) && { \
$(call debug_eval,$(SUBDIR),r,echo "No need to rebuild $(2)";) \
touch -r "$(2)" "$(2)_check"; \

View File

@ -18,10 +18,6 @@ endif
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
$(if $(filter https://github.com/% git://github.com/%,$(1)),github_archive,git)
endef
@ -63,21 +59,6 @@ define dl_tar_pack
$$$${TAR_TIMESTAMP:+--mtime="$$$$TAR_TIMESTAMP"} -c $(2) | $(call dl_pack,$(1))
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
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))
endif
gen_sha256sum = $(shell $(MKHASH) sha256 $(DL_DIR)/$(1))
ifdef FIXUP
F_hash_deprecated = $(SCRIPT_DIR)/fixup-makefile.pl $(CURDIR)/Makefile fix-hash $(3) $(call gen_sha256sum,$(1)) $(2)
F_hash_mismatch = $(F_hash_deprecated)

View File

@ -21,7 +21,7 @@ include $(INCLUDE_DIR)/depends.mk
include $(INCLUDE_DIR)/quilt.mk
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_BUILT:=$(HOST_BUILD_DIR)/.built
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/Patch:=$(Host/Patch/Default)
define Host/Prepare/Default
$(if $(strip $(HOST_UNPACK)),$(HOST_UNPACK))
ifneq ($(strip $(HOST_UNPACK)),)
define Host/Prepare/Default
$(HOST_UNPACK)
[ ! -d ./src/ ] || $(CP) ./src/* $(HOST_BUILD_DIR)
$(Host/Patch)
endef
endef
endif
define Host/Prepare
$(call Host/Prepare/Default)
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 = \
CC="$(HOSTCC)" \
CFLAGS="$(HOST_CFLAGS)" \
CXX="$(HOSTCXX)" \
CPPFLAGS="$(HOST_CPPFLAGS)" \
CXXFLAGS="$(HOST_CXXFLAGS)" \
LDFLAGS="$(HOST_LDFLAGS)" \
CONFIG_SHELL="$(SHELL)"
@ -116,10 +108,6 @@ define Host/Compile
$(call Host/Compile/Default)
endef
define Host/Gnulib/Compile
$(call Host/Compile/Default,SUBDIRS='$$$$(wildcard $(PKG_GNULIB_BASE))')
endef
define Host/Install/Default
$(call Host/Compile/Default,install)
endef
@ -192,7 +180,7 @@ ifndef DUMP
clean-build: host-clean-build
endif
$(call check_download_integrity)
$(DL_DIR)/$(FILE): FORCE
$(_host_target)host-prepare: $(HOST_STAMP_PREPARED)
$(_host_target)host-configure: $(HOST_STAMP_CONFIGURED)
@ -209,17 +197,13 @@ ifndef DUMP
ifneq ($(CONFIG_AUTOREMOVE),)
host-compile:
$(FIND) $(HOST_BUILD_DIR) -mindepth 1 -maxdepth 1 -not '(' -type f -and -name '.*' -and -size 0 ')' -print0 | \
$(XARGS) -0 rm -rf
$(FIND) $(HOST_BUILD_DIR) -mindepth 1 -maxdepth 1 -not '(' -type f -and -name '.*' -and -size 0 ')' | \
$(XARGS) rm -rf
endif
endef
endif
define HostBuild
$(HostBuild/Core)
$(if $(if $(PKG_HOST_ONLY),,$(if $(and $(filter host-%,$(MAKECMDGOALS)),$(PKG_SKIP_DOWNLOAD)),,$(STAMP_PREPARED))),,
$(if $(and $(CONFIG_AUTOREMOVE), $(wildcard $(HOST_STAMP_INSTALLED), $(wildcard $(HOST_STAMP_BUILT)))),,
$(if $(strip $(PKG_SOURCE_URL)),$(call Download,default))
)
)
$(if $(if $(PKG_HOST_ONLY),,$(STAMP_PREPARED)),,$(if $(strip $(PKG_SOURCE_URL)),$(call Download,default)))
endef

View File

@ -4,7 +4,7 @@ IMAGE_KERNEL = $(word 1,$^)
IMAGE_ROOTFS = $(word 2,$^)
define ModelNameLimit16
$(shell printf %.16s "$(word 2, $(subst _, ,$(1)))")
$(shell expr substr "$(word 2, $(subst _, ,$(1)))" 1 16)
endef
define rootfs_align
@ -27,21 +27,8 @@ define Build/append-kernel
dd if=$(IMAGE_KERNEL) >> $@
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
cp "$(BIN_DIR)/$(DEVICE_IMG_PREFIX)-$(1)" "$@.stripmeta"
fwtool -s /dev/null -t "$@.stripmeta" || :
fwtool -i /dev/null -t "$@.stripmeta" || :
dd if="$@.stripmeta" >> "$@"
rm "$@.stripmeta"
dd if=$(BIN_DIR)/$(DEVICE_IMG_PREFIX)-$(1) >> $@
endef
ifdef IB
@ -50,13 +37,8 @@ define Build/append-image-stage
endef
else
define Build/append-image-stage
cp "$(BIN_DIR)/$(DEVICE_IMG_PREFIX)-$(1)" "$@.stripmeta"
fwtool -s /dev/null -t "$@.stripmeta" || :
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"
dd if=$(BIN_DIR)/$(DEVICE_IMG_PREFIX)-$(1) of=$(STAGING_DIR_IMAGE)/$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))-$(DEVICE_NAME)-$(1)
dd if=$(BIN_DIR)/$(DEVICE_IMG_PREFIX)-$(1) >> $@
endef
endif
@ -90,7 +72,6 @@ metadata_json = \
define Build/append-metadata
$(if $(SUPPORTED_DEVICES),-echo $(call metadata_json) | fwtool -I - $@)
sha256sum "$@" | cut -d" " -f1 > "$@.sha256sum"
[ ! -s "$(BUILD_KEY)" -o ! -s "$(BUILD_KEY).ucert" -o ! -s "$@" ] || { \
cp "$(BUILD_KEY).ucert" "$@.ucert" ;\
usign -S -m "$@" -s "$(BUILD_KEY)" -x "$@.sig" ;\
@ -113,15 +94,6 @@ define Build/append-squashfs-fakeroot-be
cat $@.fakesquashfs >> $@
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
echo -n $(1) >> $@
endef
@ -131,7 +103,7 @@ define Build/append-ubi
$(if $(UBOOTENV_IN_UBI),--uboot-env) \
$(if $(KERNEL_IN_UBI),--kernel $(IMAGE_KERNEL)) \
$(foreach part,$(UBINIZE_PARTS),--part $(part)) \
--rootfs $(IMAGE_ROOTFS) \
$(IMAGE_ROOTFS) \
$@.tmp \
-p $(BLOCKSIZE:%k=%KiB) -m $(PAGESIZE) \
$(if $(SUBPAGESIZE),-s $(SUBPAGESIZE)) \
@ -141,18 +113,6 @@ define Build/append-ubi
rm $@.tmp
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
dd if=$(UBOOT_PATH) >> $@
endef
@ -210,20 +170,11 @@ define Build/check-size
@imagesize="$$(stat -c%s $@)"; \
limitsize="$$(($(subst k,* 1024,$(subst m, * 1024k,$(if $(1),$(1),$(IMAGE_SIZE))))))"; \
[ $$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 $@; \
}
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
$(eval product=$(word 1,$(1)))
$(eval fw=$(if $(word 2,$(1)),$(word 2,$(1)),$@))
@ -236,19 +187,6 @@ define Build/elecom-product-header
mv $(fw).new $(fw)
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
$(eval hw_id=$(word 1,$(1)))
$(eval xor_pattern=$(word 2,$(1)))
@ -277,9 +215,7 @@ endef
define Build/initrd_compression
$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_BZIP2),.bzip2) \
$(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_LZO),.lzo) \
$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_XZ),.xz) \
$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_ZSTD),.zstd)
endef
@ -287,20 +223,16 @@ endef
define Build/fit
$(TOPDIR)/scripts/mkits.sh \
-D $(DEVICE_NAME) -o $@.its -k $@ \
-C $(word 1,$(1)) \
$(if $(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)))) \
-C $(word 1,$(1)) $(if $(word 2,$(1)),\
$(if $(DEVICE_DTS_OVERLAY),-d $(KERNEL_BUILD_DIR)/image-$$(basename $(word 2,$(1))),\
-d $(word 2,$(1)))) \
$(if $(findstring with-rootfs,$(word 3,$(1))),-r $(IMAGE_ROOTFS)) \
$(if $(findstring with-initrd,$(word 3,$(1))), \
$(if $(CONFIG_TARGET_ROOTFS_INITRAMFS_SEPARATE), \
-i $(KERNEL_BUILD_DIR)/initrd.cpio$(strip $(call Build/initrd_compression)))) \
-a $(KERNEL_LOADADDR) -e $(if $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \
$(if $(DEVICE_FDT_NUM),-n $(DEVICE_FDT_NUM)) \
$(if $(DEVICE_DTS_DELIMITER),-l $(DEVICE_DTS_DELIMITER)) \
$(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)) \
$(if $(DEVICE_DTS_OVERLAY),$(foreach dtso,$(DEVICE_DTS_OVERLAY), -O $(dtso):$(KERNEL_BUILD_DIR)/image-$(dtso).dtb)) \
-c $(if $(DEVICE_DTS_CONFIG),$(DEVICE_DTS_CONFIG),"config-1") \
-A $(LINUX_KARCH) -v $(LINUX_VERSION)
PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage $(if $(findstring external,$(word 3,$(1))),\
@ -308,25 +240,11 @@ define Build/fit
@mv $@.new $@
endef
define Build/libdeflate-gzip
$(STAGING_DIR_HOST)/bin/libdeflate-gzip -f -12 -c $@ $(1) > $@.new
@mv $@.new $@
endef
define Build/gzip
$(STAGING_DIR_HOST)/bin/gzip -f -9n -c $@ $(1) > $@.new
gzip -f -9n -c $@ $(1) > $@.new
@mv $@.new $@
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
$(call locked, \
$(foreach dts,$(DEVICE_DTS), \
@ -338,16 +256,6 @@ define Build/install-dtb
)
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
rm -rf $(KDIR_TMP)/$(DEVICE_NAME)/jffs2 && \
mkdir -p $(KDIR_TMP)/$(DEVICE_NAME)/jffs2/$$(dirname $(1)) && \
@ -410,19 +318,6 @@ define Build/netgear-dni
mv $@.new $@
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
$(TOPDIR)/scripts/om-fwupgradecfg-gen.sh \
"$(call param_get_default,ce_type,$(1),$(DEVICE_NAME))" \
@ -475,16 +370,16 @@ define Build/qemu-image
fi
endef
define Build/qsdk-ipq-factory-nand
define Build/qsdk-ipq-factory-mmc
$(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
@mv $@.new $@
endef
define Build/qsdk-ipq-factory-mmc
define Build/qsdk-ipq-factory-nand
$(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
@mv $@.new $@
endef
@ -581,7 +476,6 @@ define Build/tplink-v2-image
endef
define Build/uImage
$(if $(UIMAGE_TIME),SOURCE_DATE_EPOCH="$(UIMAGE_TIME)") \
mkimage \
-A $(LINUX_KARCH) \
-O linux \
@ -602,12 +496,12 @@ define Build/xor-image
endef
define Build/zip
rm -rf $@.tmp
mkdir $@.tmp
mv $@ $@.tmp/$(word 1,$(1))
TZ=UTC $(STAGING_DIR_HOST)/bin/zip -j -X \
$(wordlist 2,$(words $(1)),$(1)) \
$@ $@.tmp/$(if $(word 1,$(1)),$(word 1,$(1)),$$(basename $@))
mv $@ $@.tmp/$(1)
zip -j -X \
$(if $(SOURCE_DATE_EPOCH),--mtime="$(SOURCE_DATE_EPOCH)") \
$@ $@.tmp/$(if $(1),$(1),$@)
rm -rf $@.tmp
endef

View File

@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-only
#
# Copyright (C) 2006-2020 LEDE.org
# Copyright (C) 2006-2020 OpenWrt.org
override TARGET_BUILD=
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)
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
define Image/Gzip
rm -f $(1).gz
@ -146,7 +154,7 @@ endif
# Disable noisy checks by default as in upstream
DTC_WARN_FLAGS := \
DTC_FLAGS += \
-Wno-unit_address_vs_reg \
-Wno-simple_bus_reg \
-Wno-unit_address_format \
@ -159,9 +167,6 @@ DTC_WARN_FLAGS := \
-Wno-graph_port \
-Wno-unique_unit_address
DTC_FLAGS += $(DTC_WARN_FLAGS)
DTCO_FLAGS += $(DTC_WARN_FLAGS)
define Image/pad-to
dd if=$(1) of=$(1).new bs=$(2) conv=sync
mv $(1).new $(1)
@ -177,30 +182,20 @@ endef
# $(2) target dtb file
# $(3) extra CPP flags
# $(4) extra DTC flags
define Image/BuildDTB/sub
define Image/BuildDTB
$(TARGET_CROSS)cpp -nostdinc -x assembler-with-cpp \
$(DTS_CPPFLAGS) \
-I$(DTS_DIR) \
-I$(DTS_DIR)/include \
-I$(LINUX_DIR)/include/ \
-I$(LINUX_DIR)/scripts/dtc/include-prefixes \
-undef -D__DTS__ $(3) \
-o $(2).tmp $(1)
$(LINUX_DIR)/scripts/dtc/dtc -O dtb \
-i$(dir $(1)) $(4) \
-i$(dir $(1)) $(DTC_FLAGS) $(4) \
$(if $(CONFIG_HAS_DT_OVERLAY_SUPPORT),-@) \
-o $(2) $(2).tmp
$(RM) $(2).tmp
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
$(STAGING_DIR_HOST)/bin/mkfs.jffs2 \
$(2) \
@ -234,7 +229,8 @@ $(eval $(foreach S,$(NAND_BLOCKSIZE),$(call Image/mkfs/jffs2-nand/template,$(S))
define Image/mkfs/squashfs-common
$(STAGING_DIR_HOST)/bin/mksquashfs4 $(call mkfs_target_dir,$(1)) $@ \
-nopad -noappend -root-owned \
-comp $(SQUASHFSCOMP) $(SQUASHFSOPT)
-comp $(SQUASHFSCOMP) $(SQUASHFSOPT) \
-processors $(shell nproc)
endef
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_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_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_MODEL :=
DEVICE_VARIANT :=
@ -359,12 +353,6 @@ define Device/InitProfile
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 :=
DEVICE_PACKAGES :=
DEVICE_DESCRIPTION = Build firmware images for $$(DEVICE_TITLE)
endef
@ -379,7 +367,6 @@ define Device/Init
ARTIFACTS :=
DEVICE_IMG_PREFIX := $(IMG_PREFIX)-$(1)
DEVICE_IMG_NAME = $$(DEVICE_IMG_PREFIX)-$$(1)-$$(2)
FACTORY_IMG_NAME :=
IMAGE_SIZE :=
KERNEL_PREFIX = $$(DEVICE_IMG_PREFIX)
KERNEL_SUFFIX := -kernel.bin
@ -407,19 +394,14 @@ define Device/Init
DEVICE_DTS :=
DEVICE_DTS_CONFIG :=
DEVICE_DTS_DELIMITER :=
DEVICE_DTS_DIR :=
DEVICE_DTS_LOADADDR :=
DEVICE_DTS_OVERLAY :=
DEVICE_FDT_NUM :=
DEVICE_DTC_FLAGS :=
DEVICE_DTCO_FLAGS :=
SOC :=
BOARD_NAME :=
UIMAGE_MAGIC :=
UIMAGE_NAME :=
UIMAGE_TIME :=
DEVICE_COMPAT_VERSION := 1.0
DEVICE_COMPAT_MESSAGE :=
SUPPORTED_DEVICES := $(subst _,$(comma),$(1))
@ -436,20 +418,16 @@ endef
DEFAULT_DEVICE_VARS := \
DEVICE_NAME KERNEL KERNEL_INITRAMFS KERNEL_INITRAMFS_IMAGE KERNEL_SIZE \
CMDLINE UBOOTENV_IN_UBI KERNEL_IN_UBI BLOCKSIZE PAGESIZE SUBPAGESIZE \
VID_HDR_OFFSET UBINIZE_OPTS UBINIZE_PARTS MKUBIFS_OPTS DEVICE_DTC_FLAGS \
DEVICE_DTCO_FLAGS DEVICE_DTS DEVICE_DTS_CONFIG DEVICE_DTS_DELIMITER \
DEVICE_DTS_DIR DEVICE_DTS_OVERLAY DEVICE_DTS_LOADADDR \
DEVICE_FDT_NUM DEVICE_IMG_PREFIX SOC BOARD_NAME UIMAGE_MAGIC UIMAGE_NAME \
UIMAGE_TIME SUPPORTED_DEVICES IMAGE_METADATA KERNEL_ENTRY KERNEL_LOADADDR \
VID_HDR_OFFSET UBINIZE_OPTS UBINIZE_PARTS MKUBIFS_OPTS DEVICE_DTS \
DEVICE_DTS_CONFIG DEVICE_DTS_DIR DEVICE_DTS_OVERLAY DEVICE_FDT_NUM \
DEVICE_IMG_PREFIX SOC BOARD_NAME UIMAGE_MAGIC UIMAGE_NAME \
SUPPORTED_DEVICES IMAGE_METADATA KERNEL_ENTRY KERNEL_LOADADDR \
UBOOT_PATH IMAGE_SIZE \
FACTORY_IMG_NAME FACTORY_SIZE \
DEVICE_PACKAGES DEVICE_COMPAT_VERSION DEVICE_COMPAT_MESSAGE \
DEVICE_VENDOR DEVICE_MODEL DEVICE_VARIANT \
DEVICE_ALT0_VENDOR DEVICE_ALT0_MODEL DEVICE_ALT0_VARIANT \
DEVICE_ALT1_VENDOR DEVICE_ALT1_MODEL DEVICE_ALT1_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
DEVICE_ALT2_VENDOR DEVICE_ALT2_MODEL DEVICE_ALT2_VARIANT
define Device/ExportVar
$(1) : $(2):=$$($(2))
@ -502,9 +480,6 @@ define Device/Build/initramfs
$(KDIR)/$$(KERNEL_INITRAMFS_NAME):: image_prepare
$(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)
cp $$^ $$@
@ -517,11 +492,11 @@ define Device/Build/initramfs
$(BUILD_DIR)/json_info_files/$$(KERNEL_INITRAMFS_IMAGE).json: $(BIN_DIR)/$$(KERNEL_INITRAMFS_IMAGE)
@mkdir -p $$(shell dirname $$@)
DEVICE_ID="$(1)" \
BIN_DIR="$(BIN_DIR)" \
SOURCE_DATE_EPOCH=$(SOURCE_DATE_EPOCH) \
FILE_NAME="$$(notdir $$^)" \
FILE_DIR="$(KDIR)/tmp" \
FILE_TYPE="kernel" \
FILE_FILESYSTEM="initramfs" \
DEVICE_IMG_NAME="$$(notdir $$^)" \
IMAGE_TYPE="kernel" \
IMAGE_FILESYSTEM="initramfs" \
DEVICE_IMG_PREFIX="$$(DEVICE_IMG_PREFIX)" \
DEVICE_VENDOR="$$(DEVICE_VENDOR)" \
DEVICE_MODEL="$$(DEVICE_MODEL)" \
@ -535,12 +510,6 @@ define Device/Build/initramfs
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)" \
@ -555,8 +524,7 @@ endif
define Device/Build/compile
$$(_COMPILE_TARGET): $(KDIR)/$(1)
$(eval $(call Device/Export,$(KDIR)/$(1)))
$(KDIR)/$(1): FORCE
rm -f $(KDIR)/$(1)
$(KDIR)/$(1):
$$(call concat_cmd,$(COMPILE/$(1)))
endef
@ -568,36 +536,19 @@ define Device/Build/dtb
$(KDIR)/image-$(1).dtb: FORCE
$(call Image/BuildDTB,$(strip $(2))/$(strip $(3)).dts,$$@)
compile-dtb: $(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
image_prepare: $(KDIR)/image-$(1).dtb
endif
endef
endif
define Device/Build/kernel
$$(eval $$(foreach dts,$$(DEVICE_DTS), \
$$(eval $$(foreach dts,$$(DEVICE_DTS) $$(DEVICE_DTS_OVERLAY), \
$$(call Device/Build/dtb,$$(notdir $$(dts)), \
$$(if $$(DEVICE_DTS_DIR),$$(DEVICE_DTS_DIR),$$(DTS_DIR)), \
$$(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
$$(_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)
@mkdir -p $$(shell dirname $$@)
DEVICE_ID="$(DEVICE_NAME)" \
BIN_DIR="$(BIN_DIR)" \
SOURCE_DATE_EPOCH=$(SOURCE_DATE_EPOCH) \
FILE_NAME="$(DEVICE_IMG_NAME)" \
FILE_DIR="$(KDIR)/tmp" \
FILE_TYPE=$(word 1,$(subst ., ,$(2))) \
FILE_FILESYSTEM="$(1)" \
DEVICE_IMG_NAME="$(DEVICE_IMG_NAME)" \
IMAGE_TYPE=$(word 1,$(subst ., ,$(2))) \
IMAGE_FILESYSTEM="$(1)" \
DEVICE_IMG_PREFIX="$(DEVICE_IMG_PREFIX)" \
DEVICE_VENDOR="$(DEVICE_VENDOR)" \
DEVICE_MODEL="$(DEVICE_MODEL)" \
@ -666,12 +617,6 @@ define Device/Build/image
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)" \
@ -684,9 +629,7 @@ define Device/Build/image
endef
define Device/Build/artifact
$$(_TARGET): $(if $(CONFIG_JSON_OVERVIEW_IMAGE_INFO), \
$(BUILD_DIR)/json_info_files/$(DEVICE_IMG_PREFIX)-$(1).json, \
$(BIN_DIR)/$(DEVICE_IMG_PREFIX)-$(1))
$$(_TARGET): $(BIN_DIR)/$(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
@rm -f $$@
@ -697,41 +640,6 @@ define Device/Build/artifact
$(BIN_DIR)/$(DEVICE_IMG_PREFIX)-$(1): $(KDIR)/tmp/$(DEVICE_IMG_PREFIX)-$(1)
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
define Device/Build
@ -764,8 +672,6 @@ $(if $(strip $(DEVICE_ALT0_TITLE)),Alternative device titles:
- $(DEVICE_ALT0_TITLE))
$(if $(strip $(DEVICE_ALT1_TITLE)),- $(DEVICE_ALT1_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
@ -783,14 +689,6 @@ ifneq ($$(strip $$(DEVICE_ALT2_TITLE)),)
DEVICE_DISPLAY = $$(DEVICE_ALT2_TITLE) ($$(DEVICE_TITLE))
$$(info $$(call Device/DumpInfo,$(1)))
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)
$$(eval $$(if $$(DEVICE_TITLE),$$(info $$(call Device/DumpInfo,$(1)))))
endef
@ -816,27 +714,24 @@ define BuildImage
download:
prepare:
compile:
compile-dtb:
clean:
image_prepare:
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:
$(call Build/Compile)
clean:
$(call Build/Clean)
compile-dtb:
image_prepare: compile compile-dtb
image_prepare: compile
mkdir -p $(BIN_DIR) $(KDIR)/tmp
rm -rf $(BUILD_DIR)/json_info_files
$(call Image/Prepare)
else
image_prepare:
rm -rf $(KDIR)/tmp
mkdir -p $(BIN_DIR) $(KDIR)/tmp
endif

View File

@ -1,2 +1,2 @@
LINUX_VERSION-5.10 = .236
LINUX_KERNEL_HASH-5.10.236 = 6da5cc8f7d39ed3acb4d59129a3f1570d981526ebbf58ea82595b7b6e000fb89
LINUX_VERSION-5.10 = .145
LINUX_KERNEL_HASH-5.10.145 = fc5990f3e57479369eaf193bd7760b84f26d2b670c2d88e473101cb679c5ac61

View File

@ -1,2 +1,2 @@
LINUX_VERSION-5.15 = .180
LINUX_KERNEL_HASH-5.15.180 = f51f68b8bbe60aca5e1ff3781f7e5d2ca6a31dd299c8446c39bf880bfff1cd39
LINUX_VERSION-5.15 = .70
LINUX_KERNEL_HASH-5.15.70 = 1a7c26f0253407bb222786c8cbf2ee6235acebe8ea641fe0bc2360acce970d76

2
include/kernel-5.19 Normal file
View File

@ -0,0 +1,2 @@
LINUX_VERSION-5.19 = .11
LINUX_KERNEL_HASH-5.19.11 = 5554d2f90b806bb3454fcf3432882cf85077d660a89db5a4e8d7375271e3d973

View File

@ -1,2 +1,2 @@
LINUX_VERSION-5.4 = .292
LINUX_KERNEL_HASH-5.4.292 = 0bcbf580d1ea623ac5879d0f2d69796c82431b3f653c4749e63766dbf737be85
LINUX_VERSION-5.4 = .214
LINUX_KERNEL_HASH-5.4.214 = 9abc79b4808c827eb82f8a44313ce6d3ade255949989bb98c11acda7ca3bc5db

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
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
include $(INCLUDE_DIR)/download.mk
include $(INCLUDE_DIR)/quilt.mk
@ -156,10 +156,6 @@ define BuildKernel
compile: $(LINUX_DIR)/.modules
$(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
rm -f $(LINUX_DIR)/.config.prev
rm -f $(STAMP_CONFIGURED)

View File

@ -21,7 +21,7 @@ Kernel/Patch:=$(Kernel/Patch/Default)
ifneq (,$(findstring .xz,$(LINUX_SOURCE)))
LINUX_CAT:=xzcat
else
LINUX_CAT:=$(STAGING_DIR_HOST)/bin/libdeflate-gzip -dc
LINUX_CAT:=gzip -dc
endif
ifeq ($(strip $(CONFIG_EXTERNAL_KERNEL_TREE)),"")
@ -75,7 +75,6 @@ endif
rm -f $(LINUX_DIR)/.config.prev
mv $(LINUX_DIR)/.config $(LINUX_DIR)/.config.old
$(call Kernel/SetInitramfs/PreConfigure)
echo "# CONFIG_INITRAMFS_PRESERVE_MTIME is not set" >> $(LINUX_DIR)/.config
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS_SEPARATE),y)
echo 'CONFIG_INITRAMFS_ROOT_UID=$(shell id -u)' >> $(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
echo 'CONFIG_INITRAMFS_SOURCE=""' >> $(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
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.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
endef
@ -131,10 +129,6 @@ define Kernel/CompileModules/Default
rm -f $(LINUX_DIR)/vmlinux $(LINUX_DIR)/System.map
+$(KERNEL_MAKE) olddefconfig
+$(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
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
$(call Kernel/Configure/Initramfs)
$(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*
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
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
$(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_GZIP),gzip -n -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_GZIP),gzip -f -S .gzip -9n $(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_LZO),$(STAGING_DIR_HOST)/bin/lzop -9 -f $(KERNEL_BUILD_DIR)/initrd.cpio)
$(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_LZO),)
$(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)
endif
+$(KERNEL_MAKE) $(KERNEL_MAKEOPTS_IMAGE) $(if $(KERNELNAME),$(KERNELNAME),all) modules

View File

@ -13,15 +13,6 @@ endif
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))))
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))
endif
MODULES_SUBDIR:=lib/modules/$(LINUX_UNAME_VERSION)
ifeq (,$(findstring -android,$(LINUX_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)
ifneq ($(TARGET_BUILD),1)
@ -86,14 +90,10 @@ else ifneq (,$(findstring $(ARCH) , arceb ))
LINUX_KARCH := arc
else ifneq (,$(findstring $(ARCH) , armeb ))
LINUX_KARCH := arm
else ifneq (,$(findstring $(ARCH) , loongarch64 ))
LINUX_KARCH := loongarch
else ifneq (,$(findstring $(ARCH) , mipsel mips64 mips64el ))
LINUX_KARCH := mips
else ifneq (,$(findstring $(ARCH) , powerpc64 ))
LINUX_KARCH := powerpc
else ifneq (,$(findstring $(ARCH) , riscv64 ))
LINUX_KARCH := riscv
else ifneq (,$(findstring $(ARCH) , sh2 sh3 sh4 ))
LINUX_KARCH := sh
else ifneq (,$(findstring $(ARCH) , i386 x86_64 ))
@ -105,7 +105,7 @@ endif
KERNEL_MAKE = $(MAKE) $(KERNEL_MAKEOPTS)
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" \
CROSS_COMPILE="$(KERNEL_CROSS)" \
ARCH="$(LINUX_KARCH)" \
@ -129,17 +129,17 @@ ifeq ($(call qstrip,$(CONFIG_EXTERNAL_KERNEL_TREE))$(call qstrip,$(CONFIG_KERNEL
KERNELRELEASE=$(LINUX_VERSION)
endif
ifneq ($(HOST_OS),Linux)
KERNEL_MAKE_FLAGS += CONFIG_STACK_VALIDATION=
export SKIP_STACK_VALIDATION:=1
endif
KERNEL_MAKEOPTS = -C $(LINUX_DIR) $(KERNEL_MAKE_FLAGS)
KERNEL_MAKEOPTS := -C $(LINUX_DIR) $(KERNEL_MAKE_FLAGS)
ifdef CONFIG_USE_SPARSE
KERNEL_MAKEOPTS += C=1 CHECK=$(STAGING_DIR_HOST)/bin/sparse
endif
ifneq ($(HOST_OS),Linux)
KERNEL_MAKEOPTS += CONFIG_STACK_VALIDATION=
export SKIP_STACK_VALIDATION:=1
endif
PKG_EXTMOD_SUBDIRS ?= .
PKG_SYMVERS_DIR = $(KERNEL_BUILD_DIR)/symvers
@ -238,7 +238,7 @@ $(call KernelPackage/$(1)/config)
$(call KernelPackage/depends)
$(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
@for mod in $$(call version_filter,$$(FILES)); do \
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_BUILD_DEPENDS:=meson/host
# MESON_HOST_ARGS+=-Dfoo -Dbar=baz
# MESON_HOST_VARS+=FOO=bar
@ -55,14 +56,8 @@ else
MESON_CPU:="$(CPU_TYPE)$(if $(CPU_SUBTYPE),+$(CPU_SUBTYPE))"
endif
ifeq ($(MESON_USE_STAGING_PYTHON),)
PYTHON_BIN:=$(STAGING_DIR_HOST)/bin/$(PYTHON)
else
PYTHON_BIN:=$(STAGING_DIR_HOSTPKG)/bin/$(PYTHON)
endif
define Meson
$(2) $(PYTHON_BIN) $(STAGING_DIR_HOST)/bin/meson.py $(1)
$(2) $(STAGING_DIR_HOST)/bin/$(PYTHON) $(MESON_DIR)/meson.py $(1)
endef
define Meson/CreateNativeFile
@ -70,8 +65,6 @@ define Meson/CreateNativeFile
-e "s|@CC@|$(foreach BIN,$(HOSTCC),'$(BIN)',)|" \
-e "s|@CXX@|$(foreach BIN,$(HOSTCXX),'$(BIN)',)|" \
-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|@CXXFLAGS@|$(foreach FLAG,$(HOST_CXXFLAGS) $(HOST_CPPFLAGS),'$(FLAG)',)|" \
-e "s|@LDFLAGS@|$(foreach FLAG,$(HOST_LDFLAGS),'$(FLAG)',)|" \
@ -84,13 +77,10 @@ define Meson/CreateCrossFile
$(STAGING_DIR_HOST)/bin/sed \
-e "s|@CC@|$(foreach BIN,$(TARGET_CC),'$(BIN)',)|" \
-e "s|@CXX@|$(foreach BIN,$(TARGET_CXX),'$(BIN)',)|" \
-e "s|@LD@|$(foreach FLAG,$(TARGET_LINKER),'$(FLAG)',)|" \
-e "s|@AR@|$(TARGET_AR)|" \
-e "s|@STRIP@|$(TARGET_CROSS)strip|" \
-e "s|@NM@|$(TARGET_NM)|" \
-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|@CXXFLAGS@|$(foreach FLAG,$(TARGET_CXXFLAGS) $(EXTRA_CXXFLAGS) $(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS),'$(FLAG)',)|" \
-e "s|@LDFLAGS@|$(foreach FLAG,$(TARGET_LDFLAGS) $(EXTRA_LDFLAGS),'$(FLAG)',)|" \
@ -104,17 +94,15 @@ endef
define Host/Configure/Meson
$(call Meson/CreateNativeFile,$(HOST_BUILD_DIR)/openwrt-native.txt)
$(call Meson, \
setup \
--native-file $(HOST_BUILD_DIR)/openwrt-native.txt \
-Ddefault_library=static \
$(MESON_HOST_ARGS) \
$(MESON_HOST_BUILD_DIR) \
$(MESON_HOST_BUILD_DIR)/.., \
$(HOST_BUILD_DIR), \
$(MESON_HOST_VARS))
endef
define Host/Compile/Meson
+$(MESON_HOST_VARS) $(NINJA) -C $(MESON_HOST_BUILD_DIR) $(1)
+$(NINJA) -C $(MESON_HOST_BUILD_DIR) $(1)
endef
define Host/Install/Meson
@ -129,11 +117,9 @@ define Build/Configure/Meson
$(call Meson/CreateNativeFile,$(PKG_BUILD_DIR)/openwrt-native.txt)
$(call Meson/CreateCrossFile,$(PKG_BUILD_DIR)/openwrt-cross.txt)
$(call Meson, \
setup \
--buildtype $(if $(CONFIG_DEBUG),debug,plain) \
--buildtype plain \
--native-file $(PKG_BUILD_DIR)/openwrt-native.txt \
--cross-file $(PKG_BUILD_DIR)/openwrt-cross.txt \
-Ddefault_library=both \
$(MESON_ARGS) \
$(MESON_BUILD_DIR) \
$(MESON_BUILD_DIR)/.., \
@ -141,7 +127,7 @@ define Build/Configure/Meson
endef
define Build/Compile/Meson
+$(MESON_VARS) $(NINJA) -C $(MESON_BUILD_DIR) $(1)
+$(NINJA) -C $(MESON_BUILD_DIR) $(1)
endef
define Build/Install/Meson

View File

@ -153,7 +153,6 @@ $(eval $(if $(NF_KMOD),$(call nf_add,NF_IPT6,CONFIG_IP6_NF_IPTABLES, $(P_V6)ip6_
$(eval $(if $(NF_KMOD),$(call nf_add,NF_CONNTRACK,CONFIG_NF_DEFRAG_IPV6, $(P_V6)nf_defrag_ipv6),))
$(eval $(if $(NF_KMOD),$(call nf_add,IPT_IPV6,CONFIG_IP6_NF_FILTER, $(P_V6)ip6table_filter),))
$(eval $(if $(NF_KMOD),$(call nf_add,IPT_IPV6,CONFIG_IP6_NF_MANGLE, $(P_V6)ip6table_mangle),))
$(eval $(if $(NF_KMOD),$(call nf_add,IPT_IPV6,CONFIG_NF_LOG_IPV6, $(P_V6)nf_log_ipv6,lt 5.13),))
$(eval $(if $(NF_KMOD),,$(call nf_add,IPT_IPV6,CONFIG_IP6_NF_IPTABLES, ip6t_icmp6)))
@ -230,6 +229,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))
# ulog
$(eval $(call nf_add,IPT_ULOG,CONFIG_IP_NF_TARGET_ULOG, $(P_V4)ipt_ULOG))
# nflog
$(eval $(call nf_add,IPT_NFLOG,CONFIG_NETFILTER_XT_TARGET_NFLOG, $(P_XT)xt_NFLOG))
@ -316,6 +320,7 @@ $(eval $(call nf_add,EBTABLES_IP4,CONFIG_BRIDGE_EBT_SNAT, $(P_EBT)ebt_snat))
# watchers
$(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_NFQUEUE, $(P_EBT)ebt_nfqueue))
@ -387,6 +392,7 @@ IPT_BUILTIN += $(IPT_NAT6-y)
IPT_BUILTIN += $(IPT_NAT_EXTRA-y)
IPT_BUILTIN += $(NF_NATHELPER-y)
IPT_BUILTIN += $(NF_NATHELPER_EXTRA-y)
IPT_BUILTIN += $(IPT_ULOG-y)
IPT_BUILTIN += $(IPT_TPROXY-y)
IPT_BUILTIN += $(NFNETLINK-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_FULL:=1
CMAKE_OPTIONS += -DCMAKE_PREFIX_PATH="$(ICONV_PREFIX);$(INTL_PREFIX)"
# iconv stub
else
ICONV_PREFIX:=
ICONV_PREFIX:=$(STAGING_DIR)/usr/lib/libiconv-stub
ICONV_FULL:=
INTL_PREFIX:=
INTL_PREFIX:=$(STAGING_DIR)/usr/lib/libintl-stub
INTL_FULL:=
endif
PKG_CONFIG_DEPENDS += CONFIG_BUILD_NLS
PKG_BUILD_DEPENDS += !BUILD_NLS:libiconv !BUILD_NLS:gettext
ICONV_DEPENDS:=+BUILD_NLS:libiconv-full
ifeq ($(CONFIG_BUILD_NLS),y)
ICONV_CFLAGS:=-I$(ICONV_PREFIX)/include
ICONV_CPPFLAGS:=-I$(ICONV_PREFIX)/include
ICONV_LDFLAGS:=-L$(ICONV_PREFIX)/lib -Wl,-rpath-link=$(ICONV_PREFIX)/lib
else
ICONV_CFLAGS:=
ICONV_CPPFLAGS:=
ICONV_LDFLAGS:=
endif
ICONV_CFLAGS:=-I$(ICONV_PREFIX)/include
ICONV_CPPFLAGS:=-I$(ICONV_PREFIX)/include
ICONV_LDFLAGS:=-L$(ICONV_PREFIX)/lib -Wl,-rpath-link=$(ICONV_PREFIX)/lib
INTL_DEPENDS:=+BUILD_NLS:libintl-full
ifeq ($(CONFIG_BUILD_NLS),y)
INTL_CFLAGS:=-I$(INTL_PREFIX)/include
INTL_CPPFLAGS:=-I$(INTL_PREFIX)/include
INTL_LDFLAGS:=-L$(INTL_PREFIX)/lib -Wl,-rpath-link=$(INTL_PREFIX)/lib
else
INTL_CFLAGS:=
INTL_CPPFLAGS:=
INTL_LDFLAGS:=
endif
INTL_CFLAGS:=-I$(INTL_PREFIX)/include
INTL_CPPFLAGS:=-I$(INTL_PREFIX)/include
INTL_LDFLAGS:=-L$(INTL_PREFIX)/lib -Wl,-rpath-link=$(INTL_PREFIX)/lib
TARGET_CFLAGS += $(ICONV_CFLAGS) $(INTL_CFLAGS)
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),)
define BuildTarget/bin
TARGET_VARIANT=$(if $(ALL_VARIANTS),$(if $(VARIANT),$(filter-out *,$(VARIANT)),$(firstword $(ALL_VARIANTS))))
ifeq ($(if $(TARGET_VARIANT),$(BUILD_VARIANT)),$(TARGET_VARIANT))
ifeq ($(if $(VARIANT),$(BUILD_VARIANT)),$(VARIANT))
ifdef Package/$(1)/install
ifneq ($(CONFIG_PACKAGE_$(1))$(DEVELOPER),)
$(_pkg_target)compile: $(PKG_BUILD_DIR)/.pkgdir/$(1).installed

View File

@ -2,7 +2,7 @@
#
# Copyright (C) 2006-2020 OpenWrt.org
PKG_DEFAULT_DEPENDS = +libc
PKG_DEFAULT_DEPENDS = +libc +USE_GLIBC:librt +USE_GLIBC:libpthread
ifneq ($(PKG_NAME),toolchain)
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)
KEEP_$(1):=$(strip $(call Package/$(1)/conffiles))
TARGET_VARIANT:=$$(if $(ALL_VARIANTS),$$(if $$(VARIANT),$$(filter-out *,$$(VARIANT)),$(firstword $(ALL_VARIANTS))))
ifeq ($(BUILD_VARIANT),$$(if $$(TARGET_VARIANT),$$(TARGET_VARIANT),$(BUILD_VARIANT)))
ifeq ($(BUILD_VARIANT),$$(if $$(VARIANT),$$(VARIANT),$(BUILD_VARIANT)))
do_install=
ifdef Package/$(1)/install
do_install=yes

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_INSTALL_DIR ?= $(PKG_BUILD_DIR)/ipkg-install
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))
@ -22,50 +23,15 @@ PKG_JOBS?=-j1
else
PKG_JOBS?=$(if $(PKG_BUILD_PARALLEL),$(MAKE_J),-j1)
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
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_CFLAGS += -mips16 -minterlink-mips16
TARGET_CXXFLAGS += -mips16 -minterlink-mips16
endif
endif
ifeq ($(call pkg_build_flag,gc-sections,$(if $(CONFIG_USE_GC_SECTIONS),1,0)),1)
TARGET_CFLAGS+= -ffunction-sections -fdata-sections
TARGET_CXXFLAGS+= -ffunction-sections -fdata-sections
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
ifeq ($(strip $(PKG_IREMAP)),1)
IREMAP_CFLAGS = $(call iremap,$(PKG_BUILD_DIR),$(notdir $(PKG_BUILD_DIR)))
TARGET_CFLAGS += $(IREMAP_CFLAGS)
endif
include $(INCLUDE_DIR)/hardening.mk
@ -118,7 +84,7 @@ ifneq ($(PREV_STAMP_PREPARED),)
STAMP_PREPARED:=$(PREV_STAMP_PREPARED)
CONFIG_AUTOREBUILD:=
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
STAMP_CONFIGURED=$(PKG_BUILD_DIR)/.configured$(if $(DUMP),,_$(call confvar,$(PKG_CONFIG_DEPENDS)))
STAMP_CONFIGURED_WILDCARD=$(PKG_BUILD_DIR)/.configured_*
@ -217,7 +183,7 @@ define Build/CoreTargets
$(call Build/Autoclean)
$(call DefaultTargets)
$(call check_download_integrity)
$(DL_DIR)/$(FILE): FORCE
download:
$(foreach hook,$(Hooks/Download),
@ -292,13 +258,13 @@ define Build/CoreTargets
ifneq ($(CONFIG_AUTOREMOVE),)
compile:
-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 | \
$(XARGS) -0 rm -rf
$(FIND) $(PKG_BUILD_DIR) -mindepth 1 -maxdepth 1 -not '(' -type f -and -name '.*' -and -size 0 ')' -and -not -name '.pkgdir' | \
$(XARGS) rm -rf
endif
endef
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))
define Build/DefaultTargets

View File

@ -15,7 +15,7 @@ $(eval $(call TestHostCommand,working-make, \
$(MAKE) -v | grep -E 'Make (4\.[1-9]|[5-9]\.)'))
$(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; \
test ! -f $(TMP_DIR)/test.FS))
@ -49,16 +49,10 @@ $(eval $(call TestHostCommand,working-g++, \
g++ -x c++ -o $(TMP_DIR)/a.out - -lstdc++ && \
$(TMP_DIR)/a.out))
$(eval $(call RequireCHeader,ncurses.h, \
$(eval $(call TestHostCommand,ncurses, \
Please install ncurses. (Missing libncurses.so or ncurses.h), \
initscr(), -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))
echo 'int main(int argc, char **argv) { initscr(); return 0; }' | \
gcc -include ncurses.h -x c -o $(TMP_DIR)/a.out - -lncurses))
endif # IB
ifeq ($(HOST_OS),Linux)
@ -136,21 +130,13 @@ $(eval $(call SetupHostCommand,getopt, \
Please install an extended getopt version that supports --long, \
gnugetopt -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 *--', \
/opt/local/bin/getopt -o t --long test -- --test | grep '^ *--test *--'))
$(eval $(call SetupHostCommand,realpath,Please install a 'realpath' utility, \
grealpath /, \
realpath /))
/usr/local/opt/gnu-getopt/bin/getopt -o t --long test -- --test | grep '^ *--test *--'))
$(eval $(call SetupHostCommand,stat,Cannot find a file stat utility, \
gnustat -c%s $(TOPDIR)/Makefile, \
gstat -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', \
unzip 2>&1 | grep zipfile, \
unzip))
@ -171,52 +157,36 @@ $(eval $(call SetupHostCommand,perl,Please install Perl 5.x, \
$(eval $(call CleanupPython2))
$(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.9 -V 2>&1 | grep 'Python 3', \
python3.8 -V 2>&1 | grep 'Python 3', \
python3.7 -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, \
python3.11 -V 2>&1 | grep 'Python 3', \
python3.10 -V 2>&1 | grep 'Python 3', \
python3.9 -V 2>&1 | grep 'Python 3', \
python3.8 -V 2>&1 | grep 'Python 3', \
python3.7 -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, \
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, \
Please install the Python3 stdlib module, \
$(STAGING_DIR_HOST)/bin/python3 -c 'import ntpath'))
$(eval $(call SetupHostCommand,git,Please install Git (git-core) >= 1.7.12.2, \
git --exec-path | xargs -I % -- grep -q -- --recursive %/git-submodule))
$(eval $(call SetupHostCommand,file,Please install the 'file' package, \
file --version 2>&1 | grep file))
$(eval $(call SetupHostCommand,rsync,Please install 'rsync', \
rsync --version </dev/null))
$(eval $(call SetupHostCommand,which,Please install 'which', \
/usr/bin/which 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
which which | grep which))
$(STAGING_DIR_HOST)/bin/mkhash: $(SCRIPT_DIR)/mkhash.c
mkdir -p $(dir $@)
@ -229,4 +199,4 @@ prereq: $(STAGING_DIR_HOST)/bin/mkhash $(STAGING_DIR_HOST)/bin/xxd
# Install ldconfig 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 Require/$(1)
command -v $(1)
which $(1)
endef
$$(eval $$(call Require,$(1),$(2)))
@ -63,18 +63,6 @@ define RequireHeader
$$(eval $$(call Require,$(1),$(2)))
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 Require/python2-cleanup
if [ -f "$(STAGING_DIR_HOST)/bin/python" ] && \
@ -115,7 +103,7 @@ define SetupHostCommand
$(call QuoteHostCommand,$(11)) $(call QuoteHostCommand,$(12)); do \
if [ -n "$$$$$$$$cmd" ]; then \
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 \
mkdir -p "$(STAGING_DIR_HOST)/bin"; \
ln -sf "$$$$$$$$bin" "$(STAGING_DIR_HOST)/bin/$(strip $(1))"; \

View File

@ -116,7 +116,7 @@ define Quilt/RefreshDir
endef
define Quilt/Refresh/Host
$(call Quilt/RefreshDir,$(HOST_BUILD_DIR),$(HOST_PATCH_DIR))
$(call Quilt/RefreshDir,$(HOST_BUILD_DIR),$(PATCH_DIR))
endef
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)
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
$(if $(patsubst feeds/%,,$(1)),,$(word 2,$(subst /, ,$(1))))
@ -72,7 +72,7 @@ endif
$(FILELIST): $(OVERRIDELIST)
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)
( \

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)
SUBTARGETS:=prereq
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
SUBTARGETS:=$(DEFAULT_SUBDIR_TARGETS)
endif
@ -30,16 +27,14 @@ lastdir=$(word $(words $(subst /, ,$(1))),$(subst /, ,$(1)))
diralias=$(if $(findstring $(1),$(call lastdir,$(1))),,$(call lastdir,$(1)))
subdir_make_opts = \
$(if $(SUBDIR_MAKE_DEBUG),-d) -r -C $(1) \
-r -C $(1) \
BUILD_SUBDIR="$(1)" \
BUILD_VARIANT="$(4)" \
ALL_VARIANTS="$(5)"
BUILD_VARIANT="$(4)"
# 1: subdir
# 2: target
# 3: build type
# 4: build variant
# 5: all variants
log_make = \
$(if $(call debug,$(1),v),,@)+ \
$(if $(BUILD_LOG), \
@ -67,15 +62,15 @@ define subdir
$(foreach target,$(SUBTARGETS) $($(1)/subtargets),
$(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 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))))
$(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))))
$(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 $($(1)/autoremove),$(call rebuild_check,$(1)/$(bd),$(target),,$(filter-out __default,$(variant)),$($(1)/$(bd)/variants)))
$(call log_make,$(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))) \
|| $(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),,

View File

@ -12,7 +12,6 @@ DEVICE_TYPE?=router
# Default packages - the really basic set
DEFAULT_PACKAGES:=\
base-files \
ca-bundle \
dropbear \
fstools \
libc \
@ -24,8 +23,7 @@ DEFAULT_PACKAGES:=\
opkg \
uci \
uclient-fetch \
urandom-seed \
urngd
urandom-seed
ifneq ($(CONFIG_SELINUX),)
DEFAULT_PACKAGES+=busybox-selinux procd-selinux
@ -33,16 +31,6 @@ else
DEFAULT_PACKAGES+=busybox procd
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
DEFAULT_PACKAGES.basic:=
# For nas targets
@ -53,9 +41,9 @@ DEFAULT_PACKAGES.nas:=\
mdadm
# For router targets
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 \
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 \
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
@ -66,7 +54,7 @@ endif
target_conf=$(subst .,_,$(subst -,_,$(subst /,_,$(1))))
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))))
else
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_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
ifeq ($(CFG_TARGET),target)
ifeq ($(CONFIG_TARGET),platform)
LINUX_RECONFIG_LIST = $(wildcard $(GENERIC_LINUX_CONFIG) $(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_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_TARGET = $(LINUX_TARGET_CONFIG)
else ifeq ($(CFG_TARGET),env)
endif
ifeq ($(CONFIG_TARGET),env)
LINUX_RECONFIG_LIST = $(LINUX_KCONFIG_LIST)
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
__linux_confcmd = $(2) $(patsubst %,+,$(wordlist 2,9999,$(1))) $(1)
@ -233,14 +213,12 @@ ifeq ($(DUMP),1)
ifeq ($(ARCH),powerpc)
CPU_CFLAGS_603e:=-mcpu=603e
CPU_CFLAGS_8540:=-mcpu=8540
CPU_CFLAGS_8548:=-mcpu=8548
CPU_CFLAGS_405:=-mcpu=405
CPU_CFLAGS_440:=-mcpu=440
CPU_CFLAGS_464fp:=-mcpu=464fp
endif
ifeq ($(ARCH),powerpc64)
CPU_TYPE ?= powerpc64
CPU_CFLAGS_e5500:=-mcpu=e5500
CPU_CFLAGS_powerpc64:=-mcpu=powerpc64
endif
ifeq ($(ARCH),sparc)
@ -258,15 +236,6 @@ ifeq ($(DUMP),1)
CPU_CFLAGS_arc700 = -mcpu=arc700
CPU_CFLAGS_archs = -mcpu=archs
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),)
ifndef CPU_CFLAGS_$(CPU_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; \
mv $(1)/lib64/* $(1)/lib/; \
rm -rf $(1)/lib64; \
ln -sf lib $(1)/lib64; \
fi
ln -sf lib $(1)/lib64
endef

View File

@ -51,12 +51,11 @@ path:=$(subst :,$(space),$(PATH))
path:=$(filter-out .%,$(path))
path:=$(subst $(space),:,$(path))
export PATH:=$(path)
export STAGING_DIR_HOST:=$(if $(STAGING_DIR),$(abspath $(STAGING_DIR)/../host),$(TOPDIR)/staging_dir/host)
unexport TAR_OPTIONS
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
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;
prepare-mk: $(STAGING_DIR_HOST)/.prereq-build FORCE ;
prepare-mk: staging_dir/host/.prereq-build FORCE ;
ifdef SDK
IGNORE_PACKAGES = linux
@ -75,10 +74,10 @@ endif
_ignore = $(foreach p,$(IGNORE_PACKAGES),--ignore $(p))
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
$(_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 \
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; }; \
@ -102,7 +101,7 @@ ifneq ($(DISTRO_PKG_CONFIG),)
scripts/config/%onf: export PATH:=$(dir $(DISTRO_PKG_CONFIG)):$(PATH)
endif
scripts/config/%onf: CFLAGS+= -O2
scripts/config/%onf: FORCE
scripts/config/%onf:
@$(_SINGLE)$(SUBMAKE) $(if $(findstring s,$(OPENWRT_VERBOSE)),,-s) \
-C scripts/config $(notdir $@)
@ -152,7 +151,7 @@ xconfig: scripts/config/qconf prepare-tmpinfo 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:
@+$(SUBMAKE) -r tools/quilt/compile
else
@ -176,7 +175,7 @@ kernel_nconfig: prepare_kernel_conf
kernel_xconfig: prepare_kernel_conf
$(_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
@$(_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."; \
@ -199,7 +198,7 @@ else
DOWNLOAD_DIRS = package/download
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);)
clean dirclean: .config
@ -263,7 +262,7 @@ distclean:
@$(_SINGLE)$(SUBMAKE) -C scripts/config clean
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
.PHONY: help FORCE
.NOTPARALLEL:

View File

@ -1,9 +1,9 @@
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
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
PKG_BUILD_DIR = $(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
@ -68,9 +68,6 @@ define Build/Trusted-Firmware-A/Target
endef
endef
define Build/Configure/Trusted-Firmware-A
$(INSTALL_DIR) $(STAGING_DIR)/usr/include
endef
DTC=$(wildcard $(LINUX_DIR)/scripts/dtc/dtc)
@ -81,7 +78,6 @@ define Build/Compile/Trusted-Firmware-A
$(if $(DTC),DTC="$(DTC)") \
PLAT=$(PLAT) \
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)
endef

View File

@ -16,7 +16,7 @@ PKG_FLAGS:=nonshared
PKG_LICENSE:=GPL-2.0 GPL-2.0+
PKG_LICENSE_FILES:=Licenses/README
PKG_BUILD_PARALLEL ?= 1
PKG_BUILD_PARALLEL:=1
export GCC_HONOUR_COPTS=s
@ -45,11 +45,6 @@ UBOOT_MAKE_FLAGS = \
HOSTCC="$(HOSTCC)" \
HOSTCFLAGS="$(HOST_CFLAGS) $(HOST_CPPFLAGS) -std=gnu11" \
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='')
define Build/U-Boot/Target

View File

@ -1,2 +1,16 @@
$(warn uclibc++.mk is deprecated. Please remove it and CXX_DEPENDS)
CXX_DEPENDS = +libstdcpp
ifndef DUMP
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))
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
ifeq ($(filter bzip2 bz2 bz tbz2 tbz,$(EXT)),$(EXT))
EXT:=$(call ext,$(PKG_SOURCE:.$(EXT)=))
@ -56,7 +56,7 @@ ifeq ($(strip $(UNPACK_CMD)),)
endif
# replace zcat with $(ZCAT), because some system don't support it properly
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

View File

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

View File

@ -23,13 +23,13 @@ PKG_CONFIG_DEPENDS += \
sanitize = $(call tolower,$(subst _,-,$(subst $(space),-,$(1))))
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:=$(if $(VERSION_CODE),$(VERSION_CODE),$(REVISION))
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:=$(if $(VERSION_DIST),$(VERSION_DIST),OpenWrt)

View File

@ -23,7 +23,6 @@ PKG_LICENSE:=GPL-2.0
PKG_CONFIG_DEPENDS += \
CONFIG_SIGNED_PACKAGES CONFIG_TARGET_INIT_PATH CONFIG_TARGET_PREINIT_DISABLE_FAILSAFE \
CONFIG_NAND_SUPPORT \
CONFIG_LEGACY_SDCARD_SUPPORT \
CONFIG_EMMC_SUPPORT \
CONFIG_CLEAN_IPKG \
CONFIG_PER_FEED_REPO \
@ -40,7 +39,7 @@ define Package/base-files
SECTION:=base
CATEGORY:=Base system
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/
VERSION:=$(PKG_RELEASE)-$(REVISION)
endef
@ -49,6 +48,7 @@ define Package/base-files/conffiles
/etc/config/
/etc/config/network
/etc/config/system
/etc/crontabs/
/etc/dropbear/
/etc/ethers
/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_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
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
define Build/Prepare
@ -138,12 +125,6 @@ ifeq ($(CONFIG_NAND_SUPPORT),)
endef
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),)
define Package/base-files/emmc-support
rm -f $(1)/lib/upgrade/emmc.sh
@ -154,7 +135,6 @@ define Package/base-files/install
$(CP) ./files/* $(1)/
$(Package/base-files/install-key)
$(Package/base-files/nand-support)
$(Package/base-files/legacy-sdcard-support)
$(Package/base-files/emmc-support)
if [ -d $(GENERIC_PLATFORM_DIR)/base-files/. ]; then \
$(CP) $(GENERIC_PLATFORM_DIR)/base-files/* $(1)/; \
@ -238,10 +218,6 @@ endif
$(if $(CONFIG_TARGET_PREINIT_DISABLE_FAILSAFE), \
rm -f $(1)/etc/banner.failsafe,)
if [ -f $(TOPDIR)/feeds/luci/package.json ]; then \
$(CP) ./luci2/* $(1)/; \
fi
endef
ifneq ($(DUMP),1)

View File

@ -192,15 +192,6 @@ generate_network() {
EOF
}
;;
ncm|\
qmi|\
mbim)
uci -q batch <<-EOF
set network.$1.proto='${protocol}'
set network.$1.pdptype='ipv4'
EOF
;;
esac
}
@ -296,7 +287,7 @@ generate_static_system() {
uci -q batch <<-EOF
delete system.@system[0]
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].ttylogin='0'
set system.@system[-1].log_size='64'
@ -306,10 +297,10 @@ generate_static_system() {
set system.ntp='timeserver'
set system.ntp.enabled='1'
set system.ntp.enable_server='1'
add_list system.ntp.server='time.apple.com'
add_list system.ntp.server='time.google.com'
add_list system.ntp.server='time.windows.com'
add_list system.ntp.server='time.cloudflare.com'
add_list system.ntp.server='ntp.aliyun.com'
add_list system.ntp.server='time1.cloud.tencent.com'
add_list system.ntp.server='time.ustc.edu.cn'
add_list system.ntp.server='cn.pool.ntp.org'
EOF
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) {
c=and(rshift(c, 1),0x55555555)+and(c,0x55555555)
c=and(rshift(c, 2),0x33333333)+and(c,0x33333333)
@ -10,20 +11,14 @@ function bitcount(c) {
}
function ip2int(ip) {
ret=0
n=split(ip,a,"\\.")
for (x=1;x<=n;x++)
ret=or(lshift(ret,8),a[x])
for (ret=0,n=split(ip,a,"\."),x=1;x<=n;x++) ret=or(lshift(ret,8),a[x])
return ret
}
function int2ip(ip,ret,x) {
ret=and(ip,255)
ip=rshift(ip,8)
for(;x<3;x++) {
ret=and(ip,255)"."ret
ip=rshift(ip,8)
}
for(;x<3;ret=and(ip,255)"."ret,ip=rshift(ip,8),x++);
return ret
}
@ -49,40 +44,28 @@ BEGIN {
}
network=and(ipaddr,netmask)
prefix=32-bitcount(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 "NETMASK="int2ip(netmask)
print "BROADCAST="int2ip(broadcast)
print "NETWORK="int2ip(network)
print "PREFIX="prefix
print "PREFIX="32-bitcount(compl32(netmask))
# range calculations:
# ipcalc <ip> <netmask> <start> <num>
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 (ARGC > 3) {
print "START="int2ip(start)
print "END="int2ip(end)
}
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 "END="int2ip(end)
}
EOF

View File

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

View File

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

View File

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

View File

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

View File

@ -3,7 +3,7 @@
[ -f /etc/banner ] && cat /etc/banner
[ -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 'Please try to remove files from /overlay/upper/... and reboot!'
}

View File

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

View File

@ -1,4 +1,4 @@
root:::0:99999:7:::
root::0:0:99999:7:::
daemon:*:0:0:99999:7:::
ftp:*: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/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"
[ -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
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
net.core.bpf_jit_enable=1
net.core.bpf_jit_kallsyms=1
net.ipv4.conf.default.arp_ignore=1
net.ipv4.conf.all.arp_ignore=1

View File

@ -209,10 +209,10 @@ add_group_and_user() {
if [ -n "$rusers" ]; then
local tuple oIFS="$IFS"
for tuple in $rusers; do
local uid gid uname gname addngroups addngroup addngname addngid
local uid gid uname gname
IFS=":"
set -- $tuple; uname="$1"; gname="$2"; addngroups="$3"
set -- $tuple; uname="$1"; gname="$2"
IFS="="
set -- $uname; uname="$1"; uid="$2"
set -- $gname; gname="$1"; gid="$2"
@ -232,24 +232,7 @@ add_group_and_user() {
group_add_user "$gname" "$uname"
fi
if [ -n "$uname" ] && [ -n "$addngroups" ]; then
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
unset uid gid uname gname
done
fi
}
@ -262,6 +245,11 @@ default_postinst() {
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
cp -R $root/rootfs-overlay/. $root/
rm -fR $root/rootfs-overlay/
@ -287,11 +275,6 @@ default_postinst() {
rm -f /tmp/luci-indexcache
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)"
for i in $(grep -s "^/etc/init.d/" "$root$filelist"); do
if [ -n "$root" ]; then
@ -371,7 +354,7 @@ group_add_next() {
return
fi
gids=$(cut -d: -f3 ${IPKG_INSTROOT}/etc/group)
gid=32768
gid=65536
while echo "$gids" | grep -q "^$gid$"; do
gid=$((gid + 1))
done
@ -386,9 +369,6 @@ group_add_user() {
echo "$grp" | grep -q ":$" && delim=""
[ -n "$IPKG_INSTROOT" ] || lock /var/lock/passwd
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
}
@ -402,7 +382,7 @@ user_add() {
local rc
[ -z "$uid" ] && {
uids=$(cut -d: -f3 ${IPKG_INSTROOT}/etc/passwd)
uid=32768
uid=65536
while echo "$uids" | grep -q "^$uid$"; do
uid=$((uid + 1))
done

View File

@ -11,36 +11,6 @@ get_dt_led_path() {
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() {
local label
local ledpath=$(get_dt_led_path $1)
@ -48,7 +18,6 @@ get_dt_led() {
[ -n "$ledpath" ] && \
label=$(cat "$ledpath/label" 2>/dev/null) || \
label=$(cat "$ledpath/chan-name" 2>/dev/null) || \
label=$(get_dt_led_color_func "$ledpath") || \
label=$(basename "$ledpath")
echo "$label"

View File

@ -90,13 +90,6 @@ network_get_prefix6() {
__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
# 1: destination variable
# 2: interface
@ -194,13 +187,6 @@ network_get_prefixes6() {
__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
# 1: destination variable
# 2: interface

View File

@ -61,21 +61,11 @@ find_mtd_chardev() {
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() {
local mtdname="$1"
local key="$2"
local part
local mac_dirty
part=$(find_mtd_part "$mtdname")
if [ -z "$part" ]; then
@ -83,75 +73,35 @@ mtd_get_mac_ascii() {
return
fi
get_mac_ascii "$part" "$key"
}
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
mac_dirty=$(strings "$part" | sed -n 's/^'"$key"'=//p')
# "canonicalize" mac
[ -n "$mac_dirty" ] && macaddr_canonicalize "$mac_dirty"
}
mtd_get_mac_encrypted_deco() {
mtd_get_mac_ascii_mmc() {
local mtdname="$1"
local key="$2"
local part
local mac_dirty
if ! [ -e "$mtdname" ]; then
echo "mtd_get_mac_encrypted_deco: file $mtdname not found!" >&2
part=$(find_mmc_part "$mtdname")
if [ -z "$part" ]; then
echo "mtd_get_mac_ascii: partition $mtdname not found!" >&2
return
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 | \
uencrypt -n -d -k $tplink_key -c des-ecb | hexdump -v -n 8 -e '1/1 "%02x"')
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'
# "canonicalize" mac
[ -n "$mac_dirty" ] && macaddr_canonicalize "$mac_dirty"
}
mtd_get_mac_text() {
local mtdname="$1"
local offset=$((${2:-0}))
local length="${3:-17}"
local mtdname=$1
local offset=$(($2))
local part
local mac_dirty
part=$(find_mtd_part "$mtdname")
if [ -z "$part" ]; then
@ -159,9 +109,15 @@ mtd_get_mac_text() {
return
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() {
@ -185,6 +141,15 @@ mtd_get_mac_binary_ubi() {
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() {
local part_name=$1
local first dev size erasesize name
@ -197,29 +162,6 @@ mtd_get_part_size() {
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() {
local mac=$1
local val=$2
@ -230,14 +172,6 @@ macaddr_add() {
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() {
local mac=$1
local sep=$2
@ -317,7 +251,3 @@ macaddr_canonicalize() {
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() {
json_select_object bridge
json_add_string name "${1:-switch0}"
json_add_string name "${1:switch0}"
json_select ..
}
@ -418,15 +418,6 @@ ucidef_set_led_default() {
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() {
local gpio="$4"
local inverted="$5"
@ -638,21 +629,6 @@ ucidef_set_ntpserver() {
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() {
json_init
[ -f ${CFG} ] && json_load "$(cat ${CFG})"

View File

@ -18,9 +18,6 @@ preinit_ip_config() {
fi
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
}
@ -94,8 +91,6 @@ preinit_config_board() {
else
# trim any vlan ids
ifname=${ifname%\.*}
# trim any vlan modifiers like :t
ifname=${ifname%\:*}
fi
pi_ifname=$ifname

View File

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

View File

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

View File

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

View File

@ -65,9 +65,16 @@ _v() {
[ -n "$VERBOSE" ] && [ "$VERBOSE" -ge 1 ] && echo "$*" >&2
}
_vn() {
[ -n "$VERBOSE" ] && [ "$VERBOSE" -ge 1 ] && echo -n "$*" >&2
}
v() {
_v "$(date) upgrade: $@"
logger -p info -t upgrade "$@"
}
vn() {
_vn "$(date) upgrade: $@"
}
json_string() {
@ -88,7 +95,8 @@ get_image() { # <source> [ <command> ]
if [ -z "$cmd" ]; then
local magic="$(dd if="$from" bs=2 count=1 2>/dev/null | hexdump -n 2 -e '1/1 "%02x"')"
case "$magic" in
1f8b) cmd="busybox zcat";;
1f8b) cmd="zcat";;
425a) cmd="bzcat";;
*) cmd="cat";;
esac
fi
@ -127,33 +135,6 @@ get_magic_fat32() {
(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() {
local magic=$(get_magic_gpt "$@")
[ "$magic" = "EFI PART" ]
@ -165,23 +146,6 @@ part_magic_fat() {
[ "$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() {
local cmdline uuid blockdev uevent line class
local MAJOR MINOR DEVNAME DEVTYPE
@ -199,11 +163,9 @@ export_bootdevice() {
fi
done
;;
PARTUUID=????????-????-????-????-??????????0?/PARTNROFF=1 | \
PARTUUID=????????-????-????-????-??????????02)
uuid="${rootpart#PARTUUID=}"
uuid="${uuid%/PARTNROFF=1}"
uuid="${uuid%0?}00"
uuid="${uuid%02}00"
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"')
if [ "$4$3$2$1-$6$5-$8$7-$9" = "$uuid" ]; then
@ -213,7 +175,6 @@ export_bootdevice() {
done
;;
/dev/*)
[ "$rootpart" = "/dev/fit0" ] && rootpart="$(fitblk_get_bootdev)"
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] | \
@ -250,7 +211,7 @@ export_partdevice() {
while read line; do
export -n "$line"
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"
return 0
fi
@ -267,6 +228,15 @@ hex_le32_to_cpu() {
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>
local disk="$1"
local filename="$2"

View File

@ -19,11 +19,8 @@ emmc_upgrade_tar() {
[ "$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)))
[ "$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)))
# Account for 64KiB ROOTDEV_OVERLAY_ALIGN in libfstools
EMMC_ROOTFS_BLOCKS=$(((EMMC_ROOTFS_BLOCKS + 127) & ~127))
}
if [ -z "$UPGRADE_BACKUP" ]; then
if [ "$EMMC_DATA_DEV" ]; then
@ -58,7 +55,7 @@ emmc_copy_config() {
}
emmc_do_upgrade() {
local file_type=$(identify_magic_long "$(get_magic_long "$1")")
local file_type=$(identify $1)
case "$file_type" in
"fit") emmc_upgrade_fit $1;;

View File

@ -71,7 +71,6 @@ fwtool_check_image() {
# minor compat version -> sysupgrade with -n required
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)."
[ -n "$compatmessage" ] && v "$compatmessage"
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}"
# '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}"
# 'rootfs' UBI volume on NAND contains the rootfs
@ -28,7 +26,7 @@ ubi_mknod() {
nand_find_volume() {
local ubidevdir ubivoldir
ubidevdir="/sys/class/ubi/"
ubidevdir="/sys/devices/virtual/ubi/$1"
[ ! -d "$ubidevdir" ] && return 1
for ubivoldir in $ubidevdir/${1}_*; do
[ ! -d "$ubivoldir" ] && continue
@ -41,12 +39,13 @@ nand_find_volume() {
}
nand_find_ubi() {
local ubidevdir ubidev mtdnum cmtdnum
local ubidevdir ubidev mtdnum
mtdnum="$( find_mtd_index $1 )"
[ ! "$mtdnum" ] && return 1
for ubidevdir in /sys/class/ubi/ubi*; do
[ ! -e "$ubidevdir/mtd_num" ] && continue
for ubidevdir in /sys/devices/virtual/ubi/ubi*; do
[ ! -d "$ubidevdir" ] && continue
cmtdnum="$( cat $ubidevdir/mtd_num )"
[ ! "$mtdnum" ] && continue
if [ "$mtdnum" = "$cmtdnum" ]; then
ubidev=$( basename $ubidevdir )
ubi_mknod "$ubidevdir"
@ -57,175 +56,128 @@ nand_find_ubi() {
}
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() {
(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_magic_long $(nand_get_magic_long "$@")
identify_magic $(nand_get_magic_long "$1" "${2:-0}")
}
identify_tar() {
identify_magic_long $(get_magic_long_tar "$@")
}
identify_if_gzip() {
if [ "$(identify "$1")" = gzip ]; then echo -n z; fi
identify_magic $(get_magic_long_tar "$1" "$2")
}
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 )"
if [ ! "$ubivol" ]; then
ubivol="$( nand_find_volume $ubidev "$CI_ROOTPART" )"
if [ ! "$ubivol" ]; then
echo "cannot find ubifs data volume"
return 1
fi
fi
[ ! "$ubivol" ] &&
ubivol="$( nand_find_volume $ubidev $CI_ROOTPART )"
mkdir /tmp/new_root
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
return 1
fi
if mv "$1" "/tmp/new_root/$BACKUP_FILE"; then
if umount /tmp/new_root; then
echo "configuration saved"
rmdir /tmp/new_root
return 0
fi
else
umount /tmp/new_root
fi
echo "could not save configuration to ubifs volume $ubivol"
mv "$1" "/tmp/new_root/$BACKUP_FILE"
umount /tmp/new_root
sync
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() {
local rootfs_length="$1"
local rootfs_type="$2"
local rootfs_data_max="$(fw_printenv -n rootfs_data_max 2> /dev/null)"
local rootfs_data_max="$(fw_printenv -n rootfs_data_max 2>/dev/null)"
[ -n "$rootfs_data_max" ] && rootfs_data_max=$((rootfs_data_max))
local kernel_length="$3"
local has_env="${4:-0}"
local kern_ubidev
local root_ubidev
[ -n "$rootfs_length" -o -n "$kernel_length" ] || return 1
if [ -n "$CI_KERN_UBIPART" -a -n "$CI_ROOT_UBIPART" ]; then
kern_ubidev="$( nand_attach_ubi "$CI_KERN_UBIPART" "$has_env" )"
[ -n "$kern_ubidev" ] || return 1
root_ubidev="$( nand_attach_ubi "$CI_ROOT_UBIPART" )"
[ -n "$root_ubidev" ] || return 1
else
kern_ubidev="$( nand_attach_ubi "$CI_UBIPART" "$has_env" )"
[ -n "$kern_ubidev" ] || return 1
root_ubidev="$kern_ubidev"
local mtdnum="$( find_mtd_index "$CI_UBIPART" )"
if [ ! "$mtdnum" ]; then
echo "cannot find ubi mtd partition $CI_UBIPART"
return 1
fi
local kern_ubivol="$( nand_find_volume $kern_ubidev "$CI_KERNPART" )"
local root_ubivol="$( nand_find_volume $root_ubidev "$CI_ROOTPART" )"
local data_ubivol="$( nand_find_volume $root_ubidev rootfs_data )"
[ "$root_ubivol" = "$kern_ubivol" ] && root_ubivol=
local ubidev="$( nand_find_ubi "$CI_UBIPART" )"
if [ ! "$ubidev" ]; then
ubiattach -m "$mtdnum"
sync
ubidev="$( nand_find_ubi "$CI_UBIPART" )"
fi
# remove ubiblocks
[ "$kern_ubivol" ] && { nand_remove_ubiblock $kern_ubivol || return 1; }
[ "$root_ubivol" ] && { nand_remove_ubiblock $root_ubivol || return 1; }
[ "$data_ubivol" ] && { nand_remove_ubiblock $data_ubivol || return 1; }
if [ ! "$ubidev" ]; then
ubiformat /dev/mtd$mtdnum -y
ubiattach -m "$mtdnum"
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
[ "$kern_ubivol" ] && ubirmvol /dev/$kern_ubidev -N "$CI_KERNPART" || :
[ "$root_ubivol" ] && ubirmvol /dev/$root_ubidev -N "$CI_ROOTPART" || :
[ "$data_ubivol" ] && ubirmvol /dev/$root_ubidev -N rootfs_data || :
[ "$kern_ubivol" ] && ubirmvol /dev/$ubidev -N $CI_KERNPART || true
[ "$root_ubivol" -a "$root_ubivol" != "$kern_ubivol" ] && ubirmvol /dev/$ubidev -N $CI_ROOTPART || true
[ "$data_ubivol" ] && ubirmvol /dev/$ubidev -N rootfs_data || true
# create kernel vol
# update kernel
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"
return 1;
fi
fi
# create rootfs vol
# update rootfs
if [ -n "$rootfs_length" ]; then
local rootfs_size_param
if [ "$rootfs_type" = "ubifs" ]; then
@ -233,224 +185,157 @@ nand_upgrade_prepare_ubi() {
else
rootfs_size_param="-s $rootfs_length"
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"
return 1;
fi
fi
# create rootfs_data vol for non-ubifs rootfs
# create rootfs_data for non-ubifs rootfs
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"
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"
fi
if ! ubimkvol /dev/$root_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"
return 1
fi
fi
fi
return 0
}
# Write the UBI image to MTD ubi partition
nand_upgrade_ubinized() {
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" )"
${gz}cat "$ubi_file" | ubiformat "/dev/mtd$mtdnum" -S "$ubi_length" -y -f - && ubiattach -m "$mtdnum"
}
# Write the UBIFS image to UBI rootfs volume
nand_upgrade_ubifs() {
local ubifs_file="$1"
local gz="$2"
local ubifs_length=$( (${gz}cat "$ubifs_file" | wc -c) 2> /dev/null)
nand_upgrade_prepare_ubi "$ubifs_length" "ubifs" "" "" || return 1
local ubidev="$( nand_find_ubi "$CI_UBIPART" )"
local root_ubivol="$(nand_find_volume $ubidev "$CI_ROOTPART")"
${gz}cat "$ubifs_file" | ubiupdatevol /dev/$root_ubivol -s "$ubifs_length" -
}
# Write the FIT image to UBI kernel volume
nand_upgrade_fit() {
local fit_file="$1"
local gz="$2"
local fit_length=$( (${gz}cat "$fit_file" | wc -c) 2> /dev/null)
nand_upgrade_prepare_ubi "" "" "$fit_length" "1" || return 1
local fit_ubidev="$(nand_find_ubi "$CI_UBIPART")"
local fit_ubivol="$(nand_find_volume $fit_ubidev "$CI_KERNPART")"
${gz}cat "$fit_file" | ubiupdatevol /dev/$fit_ubivol -s "$fit_length" -
}
# Write images in the TAR file to MTD partitions and/or UBI volumes as required
nand_upgrade_tar() {
local tar_file="$1"
local gz="$2"
local jffs2_markers="${CI_JFFS2_CLEAN_MARKERS:-0}"
# WARNING: This fails if tar contains more than one 'sysupgrade-*' directory.
local board_dir="$(tar t${gz}f "$tar_file" | grep -m 1 '^sysupgrade-.*/$')"
board_dir="${board_dir%/}"
local kernel_mtd kernel_length
if [ "$CI_KERNPART" != "none" ]; then
kernel_mtd="$(find_mtd_index "$CI_KERNPART")"
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
[ "$rootfs_length" ] && rootfs_type="$(identify_tar "$tar_file" "$board_dir/root" "$gz")"
local ubi_kernel_length
if [ "$kernel_length" ]; then
if [ "$kernel_mtd" ]; then
# On some devices, the raw kernel and ubi partitions overlap.
# 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_env=0
nand_upgrade_prepare_ubi "$rootfs_length" "$rootfs_type" "$ubi_kernel_length" "$has_env" || return 1
if [ "$rootfs_length" ]; then
local ubidev="$( nand_find_ubi "${CI_ROOT_UBIPART:-$CI_UBIPART}" )"
local root_ubivol="$( nand_find_volume $ubidev "$CI_ROOTPART" )"
tar xO${gz}f "$tar_file" "$board_dir/root" | \
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_verify_if_gzip_file() {
local file="$1"
local gz="$2"
if [ "$gz" = z ]; then
echo "verifying compressed sysupgrade file integrity"
if ! gzip -t "$file"; then
echo "corrupted compressed sysupgrade file"
if ! ubimkvol /dev/$ubidev -N rootfs_data $rootfs_data_size_param; then
echo "cannot initialize rootfs_data volume"
return 1
fi
fi
}
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
nand_do_upgrade() {
local file="$1"
sync
nand_do_flash_file "$file" && nand_do_upgrade_success
nand_do_upgrade_failed
return 0
}
nand_do_upgrade_success() {
if nand_do_restore_config && sync; then
echo "sysupgrade successful"
umount -a
reboot -f
fi
nand_do_upgrade_failed
}
local conf_tar="/tmp/sysupgrade.tgz"
nand_do_upgrade_failed() {
sync
echo "sysupgrade failed"
# Should we reboot or bring up some failsafe mode instead?
[ -f "$conf_tar" ] && nand_restore_config "$conf_tar"
echo "sysupgrade successful"
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.
# Flash the UBI image to MTD partition
nand_upgrade_ubinized() {
local ubi_file="$1"
local mtdnum="$(find_mtd_index "$CI_UBIPART")"
[ ! "$mtdnum" ] && {
CI_UBIPART="rootfs"
mtdnum="$(find_mtd_index "$CI_UBIPART")"
}
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() {
local rootfs_length=$( (cat $1 | wc -c) 2> /dev/null)
nand_upgrade_prepare_ubi "$rootfs_length" "ubifs" "" ""
local ubidev="$( nand_find_ubi "$CI_UBIPART" )"
local root_ubivol="$(nand_find_volume $ubidev $CI_ROOTPART)"
ubiupdatevol /dev/$root_ubivol -s $rootfs_length $1
nand_do_upgrade_success
}
nand_upgrade_fit() {
local fit_file="$1"
local fit_length="$(wc -c < "$fit_file")"
nand_upgrade_prepare_ubi "" "" "$fit_length" "1"
local fit_ubidev="$(nand_find_ubi "$CI_UBIPART")"
local fit_ubivol="$(nand_find_volume $fit_ubidev "$CI_KERNPART")"
ubiupdatevol /dev/$fit_ubivol -s $fit_length $fit_file
nand_do_upgrade_success
}
nand_upgrade_tar() {
local tar_file="$1"
local kernel_mtd="$(find_mtd_index $CI_KERNPART)"
local board_dir=$(tar tf "$tar_file" | grep -m 1 '^sysupgrade-.*/$')
board_dir=${board_dir%/}
kernel_length=$( (tar xf "$tar_file" ${board_dir}/kernel -O | wc -c) 2> /dev/null)
local has_rootfs=0
local rootfs_length
local rootfs_type
tar tf "$tar_file" ${board_dir}/root 1>/dev/null 2>/dev/null && has_rootfs=1
[ "$has_rootfs" = "1" ] && {
rootfs_length=$( (tar xf "$tar_file" ${board_dir}/root -O | wc -c) 2> /dev/null)
rootfs_type="$(identify_tar "$tar_file" ${board_dir}/root)"
}
local has_kernel=1
local has_env=0
[ "$kernel_length" != 0 -a -n "$kernel_mtd" ] && {
tar xf "$tar_file" ${board_dir}/kernel -O | mtd write - $CI_KERNPART
}
[ "$kernel_length" = 0 -o ! -z "$kernel_mtd" ] && has_kernel=
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 -
}
[ "$has_rootfs" = "1" ] && {
local root_ubivol="$( nand_find_volume $ubidev $CI_ROOTPART )"
tar xf "$tar_file" ${board_dir}/root -O | \
ubiupdatevol /dev/$root_ubivol -s $rootfs_length -
}
nand_do_upgrade_success
}
# Recognize type of passed file and start the upgrade process
nand_do_upgrade() {
local file_type=$(identify $1)
[ ! "$(find_mtd_index "$CI_UBIPART")" ] && CI_UBIPART="rootfs"
case "$file_type" in
"fit") nand_upgrade_fit $1;;
"ubi") nand_upgrade_ubinized $1;;
"ubifs") nand_upgrade_ubifs $1;;
*) nand_upgrade_tar $1;;
esac
}
# Check if passed file is a valid one for NAND sysupgrade. Currently it accepts
# 3 types of files:
# 1) UBI - should contain an ubinized image, header is checked for the proper
# MAGIC
# 2) UBIFS - should contain UBIFS partition that will replace "rootfs" volume,
# header is checked for the proper MAGIC
# 3) TAR - archive has to include "sysupgrade-BOARD" directory with a non-empty
# "CONTROL" file (at this point its content isn't verified)
#
# You usually want to call this function in platform_check_image.
#
@ -458,25 +343,14 @@ nand_do_upgrade_failed() {
# $(2): file to be checked
nand_do_platform_check() {
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")"
local file_type="$(identify "$file" "" "$gz")"
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
fi
fi
[ "$control_length" = 0 -a "$file_type" != "ubi" -a "$file_type" != "ubifs" -a "$file_type" != "fit" ] && {
echo "Invalid sysupgrade file."
return 1
}
return 0
}

View File

@ -39,26 +39,20 @@ switch_to_ramfs() {
for binary in \
/bin/busybox /bin/ash /bin/sh /bin/mount /bin/umount \
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 \
'[' printf wc grep awk sed cut sort tail \
'[' printf wc grep awk sed cut \
mtd partx losetup mkfs.ext4 nandwrite flash_erase \
ubiupdatevol ubiattach ubiblock ubiformat \
ubidetach ubirsvol ubirmvol ubimkvol \
snapshot snapshot_tool date logger \
/usr/sbin/fw_printenv /usr/bin/fwtool \
snapshot snapshot_tool date \
$RAMFS_COPY_LOSETUP $RAMFS_COPY_LVM \
$RAMFS_COPY_BIN
do
local file="$(command -v "$binary" 2>/dev/null)"
[ -n "$file" ] && install_bin "$file"
done
install_file /etc/resolv.conf /lib/*.sh /lib/functions/*.sh \
/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
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
[ -L "/lib64" ] && ln -s /lib $RAM_ROOT/lib64
@ -70,10 +64,6 @@ switch_to_ramfs() {
/bin/mount -o remount,ro /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_LVM" ] && {
mkdir -p /tmp/lvm/cache
@ -95,7 +85,7 @@ kill_remaining() { # [ <signal> [ <loop> ] ]
local stat
local proc_ppid=$(cut -d' ' -f4 /proc/$$/stat)
v "Sending $sig to remaining processes ..."
vn "Sending $sig to remaining processes ..."
while $run; do
run=false
@ -103,62 +93,45 @@ kill_remaining() { # [ <signal> [ <loop> ] ]
[ -f "$stat" ] || continue
local pid name state ppid rest
read pid rest < $stat
name="${rest#\(}" ; rest="${name##*\) }" ; name="${name%\)*}"
set -- $rest ; state="$1" ; ppid="$2"
read pid name state ppid rest < $stat
name="${name#(}"; name="${name%)}"
# Skip PID1, our parent, ourself and our children
[ $pid -ne 1 -a $pid -ne $proc_ppid -a $pid -ne $$ -a $ppid -ne $$ ] || continue
[ -f "/proc/$pid/cmdline" ] || continue
local cmdline
read cmdline < /proc/$pid/cmdline
# Skip kernel threads
[ -n "$cmdline" ] || continue
v "Sending signal $sig to $name ($pid)"
_vn " $name"
kill -$sig $pid 2>/dev/null
[ $loop -eq 1 ] && sleep 2 && run=true
[ $loop -eq 1 ] && run=true
done
let loop_limit--
[ $loop_limit -eq 0 ] && {
_v
v "Failed to kill all processes."
exit 1
}
done
_v
}
indicate_upgrade
while read -r a b c; do
case "$a" in
MemT*) mem="$b" ;; esac
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
killall -9 telnetd
killall -9 dropbear
killall -9 ash
kill_remaining TERM
sleep 4
sleep 3
kill_remaining KILL 1
sleep 6
sleep 1
echo 3 > /proc/sys/vm/drop_caches

View File

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

View File

@ -6,7 +6,7 @@
usage() {
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.
EOF
exit 1
@ -21,22 +21,6 @@ ubus_wifi_cmd() {
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() {(
local vif="$1"
local cfg
@ -144,14 +128,14 @@ wifi_updown() {
[ enable = "$1" ] && {
_wifi_updown disable "$2"
ubus_wifi_cmd "$cmd" "$2"
ubus call network reload
scan_wifi
cmd=up
ubus call network reload
}
[ reconf = "$1" ] && {
ubus call network reload
scan_wifi
cmd=reconf
ubus call network reload
}
ubus_wifi_cmd "$cmd" "$2"
_wifi_updown "$@"
@ -261,7 +245,6 @@ case "$1" in
detect) wifi_detect_notice ;;
config) wifi_config ;;
status) ubus_wifi_cmd "status" "$2";;
isup) wifi_isup "$2"; exit $?;;
reload) wifi_reload "$2";;
reload_legacy) wifi_reload_legacy "$2";;
--help|help) usage;;

View File

@ -5,13 +5,6 @@
# See /LICENSE for more information.
#
config TARGET_DEFAULT_LAN_IP_FROM_PREINIT
bool "Use preinit IP configuration as default LAN IP" if IMAGEOPT
default n
help
Enabling this will set the default LAN IP address and netmask
to the preinit values set in the image config.
menuconfig PREINITOPT
bool "Preinit configuration options" if IMAGEOPT
default n
@ -165,7 +158,7 @@ if VERSIONOPT
config VERSION_DIST
string
prompt "Release distribution"
default "LEDE"
default "OpenWrt"
help
This is the name of the release distribution.
If unspecified, it defaults to OpenWrt.
@ -190,7 +183,7 @@ if VERSIONOPT
config VERSION_REPO
string
prompt "Release repository"
default "https://downloads.openwrt.org/releases/24.10.1"
default "https://downloads.openwrt.org/snapshots"
help
This is the repository address embedded in the image, it defaults
to the trunk snapshot repo; the url may contain the following placeholders:
@ -199,13 +192,13 @@ if VERSIONOPT
%v .. Configured release version number or "snapshot", lowercase
%C .. Configured release revision code or value of %R, uppercase
%c .. Configured release revision code or value of %R, lowercase
%D .. Distribution name or "LEDE", uppercase
%d .. Distribution name or "lede", lowercase
%D .. Distribution name or "OpenWrt", uppercase
%d .. Distribution name or "openwrt", lowercase
%T .. Target name
%S .. Target/Subtarget name
%A .. Package architecture
%t .. Build taint flags, e.g. "no-all busybox"
%M .. Manufacturer name or "LEDE"
%M .. Manufacturer name or "OpenWrt"
%P .. Product name or "Generic"
%h .. Hardware revision or "v0"
@ -266,7 +259,7 @@ if VERSIONOPT
config VERSION_CODE_FILENAMES
bool
prompt "Revision code in filenames"
default n
default y
help
Enable this to include the revision identifier or the configured
version code into the firmware image, SDK- and Image Builder archive

View File

@ -1,542 +0,0 @@
#!/bin/sh
CFG=/etc/board.json
. /usr/share/libubox/jshn.sh
[ -s $CFG ] || /bin/board_detect || exit 1
[ -s /etc/config/network -a -s /etc/config/system ] && exit 0
generate_bridge() {
local name=$1
local macaddr=$2
uci -q batch <<-EOF
set network.$name=device
set network.$name.name=$name
set network.$name.type=bridge
EOF
if [ -n "$macaddr" ]; then
uci -q batch <<-EOF
set network.$name.macaddr=$macaddr
EOF
fi
}
bridge_vlan_id=0
generate_bridge_vlan() {
local name=$1_vlan
local device=$2
local ports="$3"
local vlan="$4"
uci -q batch <<-EOF
set network.$name=bridge-vlan
set network.$name.device='$device'
set network.$name.vlan='$vlan'
set network.$name.ports='$ports'
EOF
}
generate_static_network() {
uci -q batch <<-EOF
delete network.loopback
set network.loopback='interface'
set network.loopback.device='lo'
set network.loopback.proto='static'
set network.loopback.ipaddr='127.0.0.1'
set network.loopback.netmask='255.0.0.0'
EOF
[ -e /proc/sys/net/ipv6 ] && {
uci -q batch <<-EOF
delete network.globals
set network.globals='globals'
set network.globals.ula_prefix='auto'
EOF
}
if json_is_a dsl object; then
json_select dsl
if json_is_a atmbridge object; then
json_select atmbridge
local vpi vci encaps payload nameprefix
json_get_vars vpi vci encaps payload nameprefix
uci -q batch <<-EOF
delete network.atm
set network.atm='atm-bridge'
set network.atm.vpi='$vpi'
set network.atm.vci='$vci'
set network.atm.encaps='$encaps'
set network.atm.payload='$payload'
set network.atm.nameprefix='$nameprefix'
EOF
json_select ..
fi
if json_is_a modem object; then
json_select modem
local type annex firmware tone xfer_mode
json_get_vars type annex firmware tone xfer_mode
uci -q batch <<-EOF
delete network.dsl
set network.dsl='dsl'
set network.dsl.annex='$annex'
set network.dsl.firmware='$firmware'
set network.dsl.tone='$tone'
set network.dsl.xfer_mode='$xfer_mode'
EOF
json_select ..
fi
json_select ..
fi
}
addr_offset=2
generate_network() {
local ports device macaddr protocol type ipaddr netmask vlan
local bridge=$2
json_select network
json_select "$1"
json_get_vars device macaddr metric protocol ipaddr netmask vlan
json_get_values ports ports
json_select ..
json_select ..
[ -n "$device" -o -n "$ports" ] || return
# Force bridge for "lan" as it may have other devices (e.g. wireless)
# bridged
[ "$1" = "lan" -a -z "$ports" ] && {
ports="$device"
}
[ -n "$ports" -a -z "$bridge" ] && {
uci -q batch <<-EOF
add network device
set network.@device[-1].name='br-$1'
set network.@device[-1].type='bridge'
EOF
for port in $ports; do uci add_list network.@device[-1].ports="$port"; done
[ -n "$macaddr" ] && {
for port in $ports; do
uci -q batch <<-EOF
add network device
set network.@device[-1].name='$port'
set network.@device[-1].macaddr='$macaddr'
EOF
done
}
device=br-$1
type=
macaddr=""
}
[ -n "$bridge" ] && {
[ -z "$ports" ] && ports="$device"
if [ -z "$vlan" ]; then
bridge_vlan_id=$((bridge_vlan_id + 1))
vlan=$bridge_vlan_id
fi
generate_bridge_vlan $1 $bridge "$ports" $vlan
device=$bridge.$vlan
type=""
}
if [ -n "$macaddr" ]; then
uci -q batch <<-EOF
add network device
set network.@device[-1].name='$device'
set network.@device[-1].macaddr='$macaddr'
EOF
fi
uci -q batch <<-EOF
delete network.$1
set network.$1='interface'
set network.$1.type='$type'
set network.$1.device='$device'
set network.$1.metric='$metric'
set network.$1.proto='none'
EOF
case "$protocol" in
static)
local ipad
case "$1" in
lan) ipad=${ipaddr:-"192.168.1.1"} ;;
*) ipad=${ipaddr:-"192.168.$((addr_offset++)).1"} ;;
esac
netm=${netmask:-"255.255.255.0"}
uci -q batch <<-EOF
set network.$1.proto='static'
set network.$1.ipaddr='$ipad'
set network.$1.netmask='$netm'
EOF
[ -e /proc/sys/net/ipv6 ] && uci set network.$1.ip6assign='60'
;;
dhcp)
# fixup IPv6 slave interface if parent is a bridge
[ "$type" = "bridge" ] && device="br-$1"
uci set network.$1.proto='dhcp'
[ -e /proc/sys/net/ipv6 ] && {
uci -q batch <<-EOF
delete network.${1}6
set network.${1}6='interface'
set network.${1}6.device='$device'
set network.${1}6.proto='dhcpv6'
EOF
}
;;
pppoe)
uci -q batch <<-EOF
set network.$1.proto='pppoe'
set network.$1.username='username'
set network.$1.password='password'
EOF
[ -e /proc/sys/net/ipv6 ] && {
uci -q batch <<-EOF
set network.$1.ipv6='1'
delete network.${1}6
set network.${1}6='interface'
set network.${1}6.device='@${1}'
set network.${1}6.proto='dhcpv6'
EOF
}
;;
ncm|\
qmi|\
mbim)
uci -q batch <<-EOF
set network.$1.proto='${protocol}'
set network.$1.pdptype='ipv4'
EOF
;;
esac
}
generate_switch_vlans_ports() {
local switch="$1"
local port ports role roles num attr val
#
# autogenerate vlans
#
if json_is_a roles array; then
json_get_keys roles roles
json_select roles
for role in $roles; do
json_select "$role"
json_get_vars ports
json_select ..
uci -q batch <<-EOF
add network switch_vlan
set network.@switch_vlan[-1].device='$switch'
set network.@switch_vlan[-1].vlan='$role'
set network.@switch_vlan[-1].ports='$ports'
EOF
done
json_select ..
fi
#
# write port specific settings
#
if json_is_a ports array; then
json_get_keys ports ports
json_select ports
for port in $ports; do
json_select "$port"
json_get_vars num
if json_is_a attr object; then
json_get_keys attr attr
json_select attr
uci -q batch <<-EOF
add network switch_port
set network.@switch_port[-1].device='$switch'
set network.@switch_port[-1].port=$num
EOF
for attr in $attr; do
json_get_var val "$attr"
uci -q set network.@switch_port[-1].$attr="$val"
done
json_select ..
fi
json_select ..
done
json_select ..
fi
}
generate_switch() {
local key="$1"
local vlans
json_select switch
json_select "$key"
json_get_vars enable reset blinkrate cpu_port \
ar8xxx_mib_type ar8xxx_mib_poll_interval
uci -q batch <<-EOF
add network switch
set network.@switch[-1].name='$key'
set network.@switch[-1].reset='$reset'
set network.@switch[-1].enable_vlan='$enable'
set network.@switch[-1].blinkrate='$blinkrate'
set network.@switch[-1].ar8xxx_mib_type='$ar8xxx_mib_type'
set network.@switch[-1].ar8xxx_mib_poll_interval='$ar8xxx_mib_poll_interval'
EOF
generate_switch_vlans_ports "$1"
json_select ..
json_select ..
}
generate_static_system() {
uci -q batch <<-EOF
delete system.@system[0]
add system system
set system.@system[-1].hostname='LEDE'
set system.@system[-1].timezone='UTC'
set system.@system[-1].ttylogin='0'
set system.@system[-1].log_size='64'
set system.@system[-1].urandom_seed='0'
delete system.ntp
set system.ntp='timeserver'
set system.ntp.enabled='1'
set system.ntp.enable_server='0'
add_list system.ntp.server='0.openwrt.pool.ntp.org'
add_list system.ntp.server='1.openwrt.pool.ntp.org'
add_list system.ntp.server='2.openwrt.pool.ntp.org'
add_list system.ntp.server='3.openwrt.pool.ntp.org'
EOF
if json_is_a system object; then
json_select system
local hostname
if json_get_var hostname hostname; then
uci -q set "system.@system[-1].hostname=$hostname"
fi
local compat_version
if json_get_var compat_version compat_version; then
uci -q set "system.@system[-1].compat_version=$compat_version"
else
uci -q set "system.@system[-1].compat_version=1.0"
fi
if json_is_a ntpserver array; then
local keys key
json_get_keys keys ntpserver
json_select ntpserver
uci -q delete "system.ntp.server"
for key in $keys; do
local server
if json_get_var server "$key"; then
uci -q add_list "system.ntp.server=$server"
fi
done
json_select ..
fi
json_select ..
fi
}
generate_rssimon() {
local key="$1"
local cfg="rssid_$key"
local refresh threshold
json_select rssimon
json_select "$key"
json_get_vars refresh threshold
json_select ..
json_select ..
uci -q batch <<-EOF
delete system.$cfg
set system.$cfg='rssid'
set system.$cfg.dev='$key'
set system.$cfg.refresh='$refresh'
set system.$cfg.threshold='$threshold'
EOF
}
generate_led() {
local key="$1"
local cfg="led_$key"
json_select led
json_select "$key"
json_get_vars name sysfs type trigger default
uci -q batch <<-EOF
delete system.$cfg
set system.$cfg='led'
set system.$cfg.name='$name'
set system.$cfg.sysfs='$sysfs'
set system.$cfg.trigger='$trigger'
set system.$cfg.default='$default'
EOF
case "$type" in
gpio)
local gpio inverted
json_get_vars gpio inverted
uci -q batch <<-EOF
set system.$cfg.trigger='gpio'
set system.$cfg.gpio='$gpio'
set system.$cfg.inverted='$inverted'
EOF
;;
netdev)
local device mode
json_get_vars device mode
uci -q batch <<-EOF
set system.$cfg.trigger='netdev'
set system.$cfg.mode='$mode'
set system.$cfg.dev='$device'
EOF
;;
usb)
local device
json_get_vars device
uci -q batch <<-EOF
set system.$cfg.trigger='usbdev'
set system.$cfg.interval='50'
set system.$cfg.dev='$device'
EOF
;;
usbport)
local ports port
json_get_values ports ports
uci set system.$cfg.trigger='usbport'
for port in $ports; do
uci add_list system.$cfg.port=$port
done
;;
rssi)
local iface minq maxq offset factor
json_get_vars iface minq maxq offset factor
uci -q batch <<-EOF
set system.$cfg.trigger='rssi'
set system.$cfg.iface='rssid_$iface'
set system.$cfg.minq='$minq'
set system.$cfg.maxq='$maxq'
set system.$cfg.offset='$offset'
set system.$cfg.factor='$factor'
EOF
;;
switch)
local port_mask speed_mask mode
json_get_vars port_mask speed_mask mode
uci -q batch <<-EOF
set system.$cfg.port_mask='$port_mask'
set system.$cfg.speed_mask='$speed_mask'
set system.$cfg.mode='$mode'
EOF
;;
portstate)
local port_state
json_get_vars port_state
uci -q batch <<-EOF
set system.$cfg.port_state='$port_state'
EOF
;;
timer|oneshot)
local delayon delayoff
json_get_vars delayon delayoff
uci -q batch <<-EOF
set system.$cfg.trigger='$type'
set system.$cfg.delayon='$delayon'
set system.$cfg.delayoff='$delayoff'
EOF
;;
esac
json_select ..
json_select ..
}
generate_gpioswitch() {
local cfg="$1"
json_select gpioswitch
json_select "$cfg"
local name pin default
json_get_vars name pin default
uci -q batch <<-EOF
delete system.$cfg
set system.$cfg='gpio_switch'
set system.$cfg.name='$name'
set system.$cfg.gpio_pin='$pin'
set system.$cfg.value='$default'
EOF
json_select ..
json_select ..
}
json_init
json_load "$(cat ${CFG})"
umask 077
if [ ! -s /etc/config/network ]; then
bridge_name=""
touch /etc/config/network
generate_static_network
json_get_vars bridge
[ -n "$bridge" ] && {
json_select bridge
json_get_vars name macaddr
generate_bridge "$name" "$macaddr"
json_select ..
bridge_name=$name
}
json_get_keys keys network
for key in $keys; do generate_network $key $bridge_name; done
json_get_keys keys switch
for key in $keys; do generate_switch $key; done
fi
if [ ! -s /etc/config/system ]; then
touch /etc/config/system
generate_static_system
json_get_keys keys rssimon
for key in $keys; do generate_rssimon $key; done
json_get_keys keys gpioswitch
for key in $keys; do generate_gpioswitch $key; done
json_get_keys keys led
for key in $keys; do generate_led $key; done
fi
uci commit

View File

@ -1,681 +0,0 @@
. /lib/functions.sh
. /usr/share/libubox/jshn.sh
json_select_array() {
local _json_no_warning=1
json_select "$1"
[ $? = 0 ] && return
json_add_array "$1"
json_close_array
json_select "$1"
}
json_select_object() {
local _json_no_warning=1
json_select "$1"
[ $? = 0 ] && return
json_add_object "$1"
json_close_object
json_select "$1"
}
ucidef_set_interface() {
local network=$1; shift
[ -z "$network" ] && return
json_select_object network
json_select_object "$network"
while [ -n "$1" ]; do
local opt=$1; shift
local val=$1; shift
[ -n "$opt" -a -n "$val" ] || break
[ "$opt" = "device" -a "$val" != "${val/ //}" ] && {
json_select_array "ports"
for e in $val; do json_add_string "" "$e"; done
json_close_array
} || {
json_add_string "$opt" "$val"
}
done
if ! json_is_a protocol string; then
case "$network" in
lan) json_add_string protocol static ;;
wan) json_add_string protocol dhcp ;;
*) json_add_string protocol none ;;
esac
fi
json_select ..
json_select ..
}
ucidef_set_board_id() {
json_select_object model
json_add_string id "$1"
json_select ..
}
ucidef_set_model_name() {
json_select_object model
json_add_string name "$1"
json_select ..
}
ucidef_set_compat_version() {
json_select_object system
json_add_string compat_version "${1:-1.0}"
json_select ..
}
ucidef_set_interface_lan() {
ucidef_set_interface "lan" device "$1" protocol "${2:-static}"
}
ucidef_set_interface_wan() {
ucidef_set_interface "wan" device "$1" protocol "${2:-dhcp}"
}
ucidef_set_interfaces_lan_wan() {
local lan_if="$1"
local wan_if="$2"
ucidef_set_interface_lan "$lan_if"
ucidef_set_interface_wan "$wan_if"
}
ucidef_set_bridge_device() {
json_select_object bridge
json_add_string name "${1:-switch0}"
json_select ..
}
ucidef_set_bridge_mac() {
json_select_object bridge
json_add_string macaddr "${1}"
json_select ..
}
ucidef_set_network_device_mac() {
json_select_object "network_device"
json_select_object "${1}"
json_add_string macaddr "${2}"
json_select ..
json_select ..
}
ucidef_set_network_device_path() {
json_select_object "network_device"
json_select_object "$1"
json_add_string path "$2"
json_select ..
json_select ..
}
_ucidef_add_switch_port() {
# inherited: $num $device $need_tag $want_untag $role $index $prev_role
# inherited: $n_cpu $n_ports $n_vlan $cpu0 $cpu1 $cpu2 $cpu3 $cpu4 $cpu5
n_ports=$((n_ports + 1))
json_select_array ports
json_add_object
json_add_int num "$num"
[ -n "$device" ] && json_add_string device "$device"
[ -n "$need_tag" ] && json_add_boolean need_tag "$need_tag"
[ -n "$want_untag" ] && json_add_boolean want_untag "$want_untag"
[ -n "$role" ] && json_add_string role "$role"
[ -n "$index" ] && json_add_int index "$index"
json_close_object
json_select ..
# record pointer to cpu entry for lookup in _ucidef_finish_switch_roles()
[ -n "$device" ] && {
export "cpu$n_cpu=$n_ports"
n_cpu=$((n_cpu + 1))
}
# create/append object to role list
[ -n "$role" ] && {
json_select_array roles
if [ "$role" != "$prev_role" ]; then
json_add_object
json_add_string role "$role"
json_add_string ports "$num"
json_close_object
prev_role="$role"
n_vlan=$((n_vlan + 1))
else
json_select_object "$n_vlan"
json_get_var port ports
json_add_string ports "$port $num"
json_select ..
fi
json_select ..
}
}
_ucidef_finish_switch_roles() {
# inherited: $name $n_cpu $n_vlan $cpu0 $cpu1 $cpu2 $cpu3 $cpu4 $cpu5
local index role roles num device need_tag want_untag port ports
json_select switch
json_select "$name"
json_get_keys roles roles
json_select ..
json_select ..
for index in $roles; do
eval "port=\$cpu$(((index - 1) % n_cpu))"
json_select switch
json_select "$name"
json_select ports
json_select "$port"
json_get_vars num device need_tag want_untag
json_select ..
json_select ..
if [ ${need_tag:-0} -eq 1 -o ${want_untag:-0} -ne 1 ]; then
num="${num}t"
device="${device}.${index}"
fi
json_select roles
json_select "$index"
json_get_vars role ports
json_add_string ports "$ports $num"
json_add_string device "$device"
json_select ..
json_select ..
json_select ..
json_select ..
json_select_object network
local devices
json_select_object "$role"
# attach previous interfaces (for multi-switch devices)
json_get_var devices device
if ! list_contains devices "$device"; then
devices="${devices:+$devices }$device"
fi
json_select ..
json_select ..
ucidef_set_interface "$role" device "$devices"
done
}
ucidef_set_ar8xxx_switch_mib() {
local name="$1"
local type="$2"
local interval="$3"
json_select_object switch
json_select_object "$name"
json_add_int ar8xxx_mib_type $type
json_add_int ar8xxx_mib_poll_interval $interval
json_select ..
json_select ..
}
ucidef_add_switch() {
local name="$1"; shift
local port num role device index need_tag prev_role
local cpu0 cpu1 cpu2 cpu3 cpu4 cpu5
local n_cpu=0 n_vlan=0 n_ports=0
json_select_object switch
json_select_object "$name"
json_add_boolean enable 1
json_add_boolean reset 1
for port in "$@"; do
case "$port" in
[0-9]*@*)
num="${port%%@*}"
device="${port##*@}"
need_tag=0
want_untag=0
[ "${num%t}" != "$num" ] && {
num="${num%t}"
need_tag=1
}
[ "${num%u}" != "$num" ] && {
num="${num%u}"
want_untag=1
}
;;
[0-9]*:*:[0-9]*)
num="${port%%:*}"
index="${port##*:}"
role="${port#[0-9]*:}"; role="${role%:*}"
;;
[0-9]*:*)
num="${port%%:*}"
role="${port##*:}"
;;
esac
if [ -n "$num" ] && [ -n "$device$role" ]; then
_ucidef_add_switch_port
fi
unset num device role index need_tag want_untag
done
json_select ..
json_select ..
_ucidef_finish_switch_roles
}
ucidef_add_switch_attr() {
local name="$1"
local key="$2"
local val="$3"
json_select_object switch
json_select_object "$name"
case "$val" in
true|false) [ "$val" != "true" ]; json_add_boolean "$key" $? ;;
[0-9]) json_add_int "$key" "$val" ;;
*) json_add_string "$key" "$val" ;;
esac
json_select ..
json_select ..
}
ucidef_add_switch_port_attr() {
local name="$1"
local port="$2"
local key="$3"
local val="$4"
local ports i num
json_select_object switch
json_select_object "$name"
json_get_keys ports ports
json_select_array ports
for i in $ports; do
json_select "$i"
json_get_var num num
if [ -n "$num" ] && [ $num -eq $port ]; then
json_select_object attr
case "$val" in
true|false) [ "$val" != "true" ]; json_add_boolean "$key" $? ;;
[0-9]) json_add_int "$key" "$val" ;;
*) json_add_string "$key" "$val" ;;
esac
json_select ..
fi
json_select ..
done
json_select ..
json_select ..
json_select ..
}
ucidef_set_interface_macaddr() {
local network="$1"
local macaddr="$2"
ucidef_set_interface "$network" macaddr "$macaddr"
}
ucidef_set_label_macaddr() {
local macaddr="$1"
json_select_object system
json_add_string label_macaddr "$macaddr"
json_select ..
}
ucidef_add_atm_bridge() {
local vpi="$1"
local vci="$2"
local encaps="$3"
local payload="$4"
local nameprefix="$5"
json_select_object dsl
json_select_object atmbridge
json_add_int vpi "$vpi"
json_add_int vci "$vci"
json_add_string encaps "$encaps"
json_add_string payload "$payload"
json_add_string nameprefix "$nameprefix"
json_select ..
json_select ..
}
ucidef_add_adsl_modem() {
local annex="$1"
local firmware="$2"
json_select_object dsl
json_select_object modem
json_add_string type "adsl"
json_add_string annex "$annex"
json_add_string firmware "$firmware"
json_select ..
json_select ..
}
ucidef_add_vdsl_modem() {
local annex="$1"
local tone="$2"
local xfer_mode="$3"
json_select_object dsl
json_select_object modem
json_add_string type "vdsl"
json_add_string annex "$annex"
json_add_string tone "$tone"
json_add_string xfer_mode "$xfer_mode"
json_select ..
json_select ..
}
ucidef_set_led_ataport() {
_ucidef_set_led_trigger "$1" "$2" "$3" ata"$4"
}
_ucidef_set_led_common() {
local cfg="led_$1"
local name="$2"
local sysfs="$3"
json_select_object led
json_select_object "$1"
json_add_string name "$name"
json_add_string sysfs "$sysfs"
}
ucidef_set_led_default() {
local default="$4"
_ucidef_set_led_common "$1" "$2" "$3"
json_add_string default "$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() {
local gpio="$4"
local inverted="$5"
_ucidef_set_led_common "$1" "$2" "$3"
json_add_string trigger "$trigger"
json_add_string type gpio
json_add_int gpio "$gpio"
json_add_boolean inverted "$inverted"
json_select ..
json_select ..
}
ucidef_set_led_ide() {
_ucidef_set_led_trigger "$1" "$2" "$3" disk-activity
}
ucidef_set_led_netdev() {
local dev="$4"
local mode="${5:-link tx rx}"
_ucidef_set_led_common "$1" "$2" "$3"
json_add_string type netdev
json_add_string device "$dev"
json_add_string mode "$mode"
json_select ..
json_select ..
}
ucidef_set_led_oneshot() {
_ucidef_set_led_timer $1 $2 $3 "oneshot" $4 $5
}
ucidef_set_led_portstate() {
local port_state="$4"
_ucidef_set_led_common "$1" "$2" "$3"
json_add_string trigger port_state
json_add_string type portstate
json_add_string port_state "$port_state"
json_select ..
json_select ..
}
ucidef_set_led_rssi() {
local iface="$4"
local minq="$5"
local maxq="$6"
local offset="${7:-0}"
local factor="${8:-1}"
_ucidef_set_led_common "$1" "$2" "$3"
json_add_string type rssi
json_add_string name "$name"
json_add_string iface "$iface"
json_add_string minq "$minq"
json_add_string maxq "$maxq"
json_add_string offset "$offset"
json_add_string factor "$factor"
json_select ..
json_select ..
}
ucidef_set_led_switch() {
local trigger_name="$4"
local port_mask="$5"
local speed_mask="$6"
local mode="$7"
_ucidef_set_led_common "$1" "$2" "$3"
json_add_string trigger "$trigger_name"
json_add_string type switch
json_add_string mode "$mode"
json_add_string port_mask "$port_mask"
json_add_string speed_mask "$speed_mask"
json_select ..
json_select ..
}
_ucidef_set_led_timer() {
local trigger_name="$4"
local delayon="$5"
local delayoff="$6"
_ucidef_set_led_common "$1" "$2" "$3"
json_add_string type "$trigger_name"
json_add_string trigger "$trigger_name"
json_add_int delayon "$delayon"
json_add_int delayoff "$delayoff"
json_select ..
json_select ..
}
ucidef_set_led_timer() {
_ucidef_set_led_timer $1 $2 $3 "timer" $4 $5
}
_ucidef_set_led_trigger() {
local trigger_name="$4"
_ucidef_set_led_common "$1" "$2" "$3"
json_add_string trigger "$trigger_name"
json_select ..
json_select ..
}
ucidef_set_led_usbdev() {
local dev="$4"
_ucidef_set_led_common "$1" "$2" "$3"
json_add_string type usb
json_add_string device "$dev"
json_select ..
json_select ..
}
ucidef_set_led_usbhost() {
_ucidef_set_led_trigger "$1" "$2" "$3" usb-host
}
ucidef_set_led_usbport() {
local obj="$1"
local name="$2"
local sysfs="$3"
shift
shift
shift
_ucidef_set_led_common "$obj" "$name" "$sysfs"
json_add_string type usbport
json_select_array ports
for port in "$@"; do
json_add_string port "$port"
done
json_select ..
json_select ..
json_select ..
}
ucidef_set_led_wlan() {
_ucidef_set_led_trigger "$1" "$2" "$3" "$4"
}
ucidef_set_rssimon() {
local dev="$1"
local refresh="$2"
local threshold="$3"
json_select_object rssimon
json_select_object "$dev"
[ -n "$refresh" ] && json_add_int refresh "$refresh"
[ -n "$threshold" ] && json_add_int threshold "$threshold"
json_select ..
json_select ..
}
ucidef_add_gpio_switch() {
local cfg="$1"
local name="$2"
local pin="$3"
local default="${4:-0}"
json_select_object gpioswitch
json_select_object "$cfg"
json_add_string name "$name"
json_add_string pin "$pin"
json_add_int default "$default"
json_select ..
json_select ..
}
ucidef_set_hostname() {
local hostname="$1"
json_select_object system
json_add_string hostname "$hostname"
json_select ..
}
ucidef_set_ntpserver() {
local server
json_select_object system
json_select_array ntpserver
for server in "$@"; do
json_add_string "" "$server"
done
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() {
json_init
[ -f ${CFG} ] && json_load "$(cat ${CFG})"
# auto-initialize model id and name if applicable
if ! json_is_a model object; then
json_select_object model
[ -f "/tmp/sysinfo/board_name" ] && \
json_add_string id "$(cat /tmp/sysinfo/board_name)"
[ -f "/tmp/sysinfo/model" ] && \
json_add_string name "$(cat /tmp/sysinfo/model)"
json_select ..
fi
}
board_config_flush() {
json_dump -i -o ${CFG}
}

View File

@ -1,207 +0,0 @@
# Copyright (C) 2006 OpenWrt.org
# Copyright (C) 2010 Vertical Communications
preinit_ip_config() {
local netdev vid
netdev=${1%\.*}
vid=${1#*\.}
if [ "$vid" = "$netdev" ]; then
vid=
fi
grep -q "$netdev" /proc/net/dev || return
if [ -n "$vid" ]; then
ip link add link $netdev name $1 type vlan id $vid
fi
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
}
preinit_config_switch() {
local role roles ports device enable reset
local name=$1
local lan_if=$2
json_select switch
json_select $name
json_get_vars enable reset
if [ "$reset" -eq "1" ]; then
swconfig dev $name set reset
fi
swconfig dev $name set enable_vlan $enable
if json_is_a roles array; then
json_get_keys roles roles
json_select roles
for role in $roles; do
json_select "$role"
json_get_vars ports device
json_select ..
if [ "$device" = "$lan_if" ]; then
swconfig dev $name vlan $role set ports "$ports"
fi
done
json_select ..
fi
swconfig dev $name set apply
json_select ..
json_select ..
}
preinit_config_port() {
local original
local netdev="$1"
local path="$2"
[ -d "/sys/devices/$path/net" ] || return
original="$(ls "/sys/devices/$path/net" | head -1)"
[ "$netdev" = "$original" ] && return
ip link set "$original" name "$netdev"
}
preinit_config_board() {
/bin/board_detect /tmp/board.json
[ -f "/tmp/board.json" ] || return
. /usr/share/libubox/jshn.sh
json_init
json_load "$(cat /tmp/board.json)"
# Find the current highest eth*
max_eth=$(grep -o '^ *eth[0-9]*:' /proc/net/dev | tr -dc '[0-9]\n' | sort -n | tail -1)
# Find and move netdevs using eth*s we are configuring
json_get_keys keys "network_device"
for netdev in $keys; do
json_select "network_device"
json_select "$netdev"
json_get_vars path path
if [ -n "$path" -a -h "/sys/class/net/$netdev" ]; then
ip link set "$netdev" down
ip link set "$netdev" name eth$((++max_eth))
fi
json_select ..
json_select ..
done
# Move interfaces by path to their netdev name
json_get_keys keys "network_device"
for netdev in $keys; do
json_select "network_device"
json_select "$netdev"
json_get_vars path path
[ -n "$path" ] && preinit_config_port "$netdev" "$path"
json_select ..
json_select ..
done
json_select network
json_select "lan"
json_get_vars device
json_get_values ports ports
json_select ..
json_select ..
[ -n "$device" -o -n "$ports" ] || return
# swconfig uses $device and DSA uses ports
[ -z "$ports" ] && {
ports="$device"
}
# only use the first one
ifname=${ports%% *}
if [ -x /sbin/swconfig ]; then
# configure the switch, if present
json_get_keys keys switch
for key in $keys; do
preinit_config_switch $key $ifname
done
else
# trim any vlan ids
ifname=${ifname%\.*}
# trim any vlan modifiers like :t
ifname=${ifname%\:*}
fi
pi_ifname=$ifname
preinit_ip_config $pi_ifname
}
preinit_ip() {
[ "$pi_preinit_no_failsafe" = "y" ] && return
# if the preinit interface isn't specified and ifname is set in
# preinit.arch use that interface
if [ -z "$pi_ifname" ]; then
pi_ifname=$ifname
fi
if [ -n "$pi_ifname" ]; then
preinit_ip_config $pi_ifname
elif [ -d "/etc/board.d/" ]; then
preinit_config_board
fi
preinit_net_echo "Doing OpenWrt Preinit\n"
}
preinit_ip_deconfig() {
[ -n "$pi_ifname" ] && grep -q "$pi_ifname" /proc/net/dev && {
local netdev vid
netdev=${pi_ifname%\.*}
vid=${pi_ifname#*\.}
if [ "$vid" = "$netdev" ]; then
vid=
fi
ip -4 address flush dev $pi_ifname
ip link set dev $netdev down
if [ -n "$vid" ]; then
ip link delete $pi_ifname
fi
}
}
preinit_net_echo() {
[ -n "$pi_ifname" ] && grep -q "$pi_ifname" /proc/net/dev && {
{
[ "$pi_preinit_net_messages" = "y" ] || {
[ "$pi_failsafe_net_message" = "true" ] &&
[ "$pi_preinit_no_failsafe_netmsg" != "y" ]
}
} && netmsg $pi_broadcast "$1"
}
}
pi_indicate_preinit() {
set_state preinit
}
boot_hook_add preinit_main preinit_ip
boot_hook_add preinit_main pi_indicate_preinit

View File

@ -1,6 +1,6 @@
#
# Copyright (C) 2017 Hauke Mehrtens
# Copyright (C) 2021-2023 Daniel Golle
# Copyright (C) 2021 Daniel Golle
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
@ -9,13 +9,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=arm-trusted-firmware-mediatek
PKG_RELEASE:=2
PKG_RELEASE:=$(AUTORELEASE)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=https://github.com/mtk-openwrt/arm-trusted-firmware.git
PKG_SOURCE_DATE:=2024-01-17
PKG_SOURCE_VERSION:=bacca82a8cac369470df052a9d801a0ceb9b74ca
PKG_MIRROR_HASH:=d035c1b63a9bd71d752c90540361b66d290e7cf42dcca73259d0950af3569c79
PKG_SOURCE_DATE:=2022-08-31
PKG_SOURCE_VERSION:=7539348480af57c6d0db95aba6381f3ee7483779
PKG_MIRROR_HASH:=125090124d77753acc379b3b124100978c1ecb3da37c4983ba9644b433b7eb08
PKG_MAINTAINER:=Daniel Golle <daniel@makrotopia.org>
@ -30,9 +30,6 @@ define Trusted-Firmware-A/Default
DDR3_FLYBY:=
DDR_TYPE:=
NAND_TYPE:=
BOARD_QFN:=
DRAM_USE_COMB:=
USE_UBI:=
endef
define Trusted-Firmware-A/mt7622-nor-1ddr
@ -57,14 +54,6 @@ define Trusted-Firmware-A/mt7622-snand-1ddr
BOOT_DEVICE:=snand
endef
define Trusted-Firmware-A/mt7622-snand-ubi-1ddr
NAME:=MediaTek MT7622 (SPI-NAND using UBI, 1x DDR3)
BUILD_SUBTARGET:=mt7622
PLAT:=mt7622
BOOT_DEVICE:=snand
USE_UBI:=1
endef
define Trusted-Firmware-A/mt7622-snand-2ddr
NAME:=MediaTek MT7622 (SPI-NAND, 2x DDR3)
BUILD_SUBTARGET:=mt7622
@ -73,15 +62,6 @@ define Trusted-Firmware-A/mt7622-snand-2ddr
DDR3_FLYBY:=1
endef
define Trusted-Firmware-A/mt7622-snand-ubi-2ddr
NAME:=MediaTek MT7622 (SPI-NAND using UBI, 2x DDR3)
BUILD_SUBTARGET:=mt7622
PLAT:=mt7622
BOOT_DEVICE:=snand
DDR3_FLYBY:=1
USE_UBI:=1
endef
define Trusted-Firmware-A/mt7622-emmc-1ddr
NAME:=MediaTek MT7622 (eMMC, 1x DDR3)
BUILD_SUBTARGET:=mt7622
@ -112,79 +92,6 @@ define Trusted-Firmware-A/mt7622-sdmmc-2ddr
DDR3_FLYBY:=1
endef
define Trusted-Firmware-A/mt7981-nor-ddr4
NAME:=MediaTek MT7981 (SPI-NOR, DDR4)
BOOT_DEVICE:=nor
BUILD_SUBTARGET:=filogic
PLAT:=mt7981
DDR_TYPE:=ddr4
endef
define Trusted-Firmware-A/mt7981-emmc-ddr4
NAME:=MediaTek MT7981 (eMMC, DDR4)
BOOT_DEVICE:=emmc
BUILD_SUBTARGET:=filogic
PLAT:=mt7981
DDR_TYPE:=ddr4
endef
define Trusted-Firmware-A/mt7981-spim-nand-ddr4
NAME:=MediaTek MT7981 (SPI-NAND via SPIM, DDR4)
BOOT_DEVICE:=spim-nand
BUILD_SUBTARGET:=filogic
PLAT:=mt7981
DDR_TYPE:=ddr4
endef
define Trusted-Firmware-A/mt7981-nor-ddr3
NAME:=MediaTek MT7981 (SPI-NOR, DDR3)
BOOT_DEVICE:=nor
BUILD_SUBTARGET:=filogic
PLAT:=mt7981
DDR_TYPE:=ddr3
endef
define Trusted-Firmware-A/mt7981-emmc-ddr3
NAME:=MediaTek MT7981 (eMMC, DDR3)
BOOT_DEVICE:=emmc
BUILD_SUBTARGET:=filogic
PLAT:=mt7981
DDR_TYPE:=ddr3
endef
define Trusted-Firmware-A/mt7981-sdmmc-ddr3
NAME:=MediaTek MT7981 (SD card, DDR3)
BOOT_DEVICE:=sdmmc
BUILD_SUBTARGET:=filogic
PLAT:=mt7981
DDR_TYPE:=ddr3
endef
define Trusted-Firmware-A/mt7981-snand-ddr3
NAME:=MediaTek MT7981 (SPI-NAND via SNFI, DDR3)
BOOT_DEVICE:=snand
BUILD_SUBTARGET:=filogic
PLAT:=mt7981
DDR_TYPE:=ddr3
endef
define Trusted-Firmware-A/mt7981-spim-nand-ddr3
NAME:=MediaTek MT7981 (SPI-NAND via SPIM, DDR3)
BOOT_DEVICE:=spim-nand
BUILD_SUBTARGET:=filogic
PLAT:=mt7981
DDR_TYPE:=ddr3
endef
define Trusted-Firmware-A/mt7981-spim-nand-ubi-ddr4
NAME:=MediaTek MT7981 (SPI-NAND via SPIM, DDR4)
BOOT_DEVICE:=spim-nand
BUILD_SUBTARGET:=filogic
PLAT:=mt7981
DDR_TYPE:=ddr4
USE_UBI:=1
endef
define Trusted-Firmware-A/mt7986-nor-ddr4
NAME:=MediaTek MT7986 (SPI-NOR, DDR4)
BOOT_DEVICE:=nor
@ -226,25 +133,6 @@ define Trusted-Firmware-A/mt7986-spim-nand-ddr4
NAND_TYPE:=spim:2k+64
endef
define Trusted-Firmware-A/mt7986-spim-nand-ubi-ddr4
NAME:=MediaTek MT7986 (SPI-NAND via SPIM using UBI, DDR4)
BOOT_DEVICE:=spim-nand
BUILD_SUBTARGET:=filogic
PLAT:=mt7986
DDR_TYPE:=ddr4
NAND_TYPE:=spim:2k+64
USE_UBI:=1
endef
define Trusted-Firmware-A/mt7986-spim-nand-4k-ddr4
NAME:=MediaTek MT7986 (SPI-NAND via SPIM, DDR4)
BOOT_DEVICE:=spim-nand
BUILD_SUBTARGET:=filogic
PLAT:=mt7986
DDR_TYPE:=ddr4
NAND_TYPE:=spim:4k+256
endef
define Trusted-Firmware-A/mt7986-nor-ddr3
NAME:=MediaTek MT7986 (SPI-NOR, DDR3)
BOOT_DEVICE:=nor
@ -285,164 +173,15 @@ define Trusted-Firmware-A/mt7986-spim-nand-ddr3
DDR_TYPE:=ddr3
endef
define Trusted-Firmware-A/mt7988-nor-ddr3
NAME:=MediaTek MT7988 (SPI-NOR, DDR3)
BOOT_DEVICE:=nor
BUILD_SUBTARGET:=filogic
PLAT:=mt7988
DDR_TYPE:=ddr3
endef
define Trusted-Firmware-A/mt7988-emmc-ddr3
NAME:=MediaTek MT7988 (eMMC, DDR3)
BOOT_DEVICE:=emmc
BUILD_SUBTARGET:=filogic
PLAT:=mt7988
DDR_TYPE:=ddr3
endef
define Trusted-Firmware-A/mt7988-sdmmc-ddr3
NAME:=MediaTek MT7988 (SD card, DDR3)
BOOT_DEVICE:=sdmmc
BUILD_SUBTARGET:=filogic
PLAT:=mt7988
DDR_TYPE:=ddr3
endef
define Trusted-Firmware-A/mt7988-snand-ddr3
NAME:=MediaTek MT7988 (SPI-NAND via SNFI, DDR3)
BOOT_DEVICE:=snand
BUILD_SUBTARGET:=filogic
PLAT:=mt7988
DDR_TYPE:=ddr3
endef
define Trusted-Firmware-A/mt7988-spim-nand-ddr3
NAME:=MediaTek MT7988 (SPI-NAND via SPIM, DDR3)
BOOT_DEVICE:=spim-nand
BUILD_SUBTARGET:=filogic
PLAT:=mt7988
DDR_TYPE:=ddr3
endef
define Trusted-Firmware-A/mt7988-nor-ddr4
NAME:=MediaTek MT7988 (SPI-NOR, DDR4)
BOOT_DEVICE:=nor
BUILD_SUBTARGET:=filogic
PLAT:=mt7988
DDR_TYPE:=ddr4
endef
define Trusted-Firmware-A/mt7988-emmc-ddr4
NAME:=MediaTek MT7988 (eMMC, DDR4)
BOOT_DEVICE:=emmc
BUILD_SUBTARGET:=filogic
PLAT:=mt7988
DDR_TYPE:=ddr4
endef
define Trusted-Firmware-A/mt7988-sdmmc-ddr4
NAME:=MediaTek MT7988 (SD card, DDR4)
BOOT_DEVICE:=sdmmc
BUILD_SUBTARGET:=filogic
PLAT:=mt7988
DDR_TYPE:=ddr4
endef
define Trusted-Firmware-A/mt7988-snand-ddr4
NAME:=MediaTek MT7988 (SPI-NAND via SNFI, DDR4)
BOOT_DEVICE:=snand
BUILD_SUBTARGET:=filogic
PLAT:=mt7988
DDR_TYPE:=ddr4
endef
define Trusted-Firmware-A/mt7988-spim-nand-ddr4
NAME:=MediaTek MT7988 (SPI-NAND via SPIM, DDR4)
BOOT_DEVICE:=spim-nand
BUILD_SUBTARGET:=filogic
PLAT:=mt7988
DDR_TYPE:=ddr4
endef
define Trusted-Firmware-A/mt7988-nor-comb
NAME:=MediaTek MT7988 (SPI-NOR)
BOOT_DEVICE:=nor
BUILD_SUBTARGET:=filogic
PLAT:=mt7988
DRAM_USE_COMB:=1
endef
define Trusted-Firmware-A/mt7988-emmc-comb
NAME:=MediaTek MT7988 (eMMC)
BOOT_DEVICE:=emmc
BUILD_SUBTARGET:=filogic
PLAT:=mt7988
DRAM_USE_COMB:=1
endef
define Trusted-Firmware-A/mt7988-sdmmc-comb
NAME:=MediaTek MT7988 (SD card)
BOOT_DEVICE:=sdmmc
BUILD_SUBTARGET:=filogic
PLAT:=mt7988
DRAM_USE_COMB:=1
endef
define Trusted-Firmware-A/mt7988-snand-comb
NAME:=MediaTek MT7988 (SPI-NAND via SNFI)
BOOT_DEVICE:=snand
BUILD_SUBTARGET:=filogic
PLAT:=mt7988
DRAM_USE_COMB:=1
endef
define Trusted-Firmware-A/mt7988-snand-ubi-comb
NAME:=MediaTek MT7988 (SPI-NAND via SNFI, UBI)
BOOT_DEVICE:=snand
BUILD_SUBTARGET:=filogic
PLAT:=mt7988
DRAM_USE_COMB:=1
USE_UBI:=1
endef
define Trusted-Firmware-A/mt7988-spim-nand-comb
NAME:=MediaTek MT7988 (SPI-NAND via SPIM)
BOOT_DEVICE:=spim-nand
BUILD_SUBTARGET:=filogic
PLAT:=mt7988
DRAM_USE_COMB:=1
endef
define Trusted-Firmware-A/mt7988-spim-nand-ubi-comb
NAME:=MediaTek MT7988 (SPI-NAND via SPIM, UBI)
BOOT_DEVICE:=spim-nand
BUILD_SUBTARGET:=filogic
PLAT:=mt7988
DRAM_USE_COMB:=1
USE_UBI:=1
endef
TFA_TARGETS:= \
mt7622-nor-1ddr \
mt7622-nor-2ddr \
mt7622-snand-1ddr \
mt7622-snand-ubi-1ddr \
mt7622-snand-2ddr \
mt7622-snand-ubi-2ddr \
mt7622-emmc-1ddr \
mt7622-emmc-2ddr \
mt7622-sdmmc-1ddr \
mt7622-sdmmc-2ddr \
mt7981-emmc-ddr3 \
mt7981-nor-ddr3 \
mt7981-sdmmc-ddr3 \
mt7981-snand-ddr3 \
mt7981-spim-nand-ddr3 \
mt7981-spim-nand-ubi-ddr4 \
mt7981-emmc-ddr4 \
mt7981-nor-ddr4 \
mt7981-spim-nand-ddr4 \
mt7986-emmc-ddr3 \
mt7986-nor-ddr3 \
mt7986-sdmmc-ddr3 \
@ -452,38 +191,15 @@ TFA_TARGETS:= \
mt7986-nor-ddr4 \
mt7986-sdmmc-ddr4 \
mt7986-snand-ddr4 \
mt7986-spim-nand-ddr4 \
mt7986-spim-nand-ubi-ddr4 \
mt7986-spim-nand-4k-ddr4 \
mt7988-emmc-ddr3 \
mt7988-nor-ddr3 \
mt7988-sdmmc-ddr3 \
mt7988-snand-ddr3 \
mt7988-spim-nand-ddr3 \
mt7988-emmc-ddr4 \
mt7988-nor-ddr4 \
mt7988-sdmmc-ddr4 \
mt7988-snand-ddr4 \
mt7988-spim-nand-ddr4 \
mt7988-emmc-comb \
mt7988-nor-comb \
mt7988-sdmmc-comb \
mt7988-snand-comb \
mt7988-snand-ubi-comb \
mt7988-spim-nand-comb \
mt7988-spim-nand-ubi-comb
mt7986-spim-nand-ddr4
TFA_MAKE_FLAGS += \
BOOT_DEVICE=$(BOOT_DEVICE) \
USE_MKIMAGE=1 MKIMAGE=$(STAGING_DIR_HOST)/bin/mkimage \
$(if $(findstring ddr4,$(DDR_TYPE)),DRAM_USE_DDR4=1) \
$(if $(BOARD_QFN),BOARD_QFN=1,BOARD_BGA=1) \
$(if $(NAND_TYPE),NAND_TYPE=$(NAND_TYPE)) \
HAVE_DRAM_OBJ_FILE=yes \
$(if $(DDR3_FLYBY),DDR3_FLYBY=1) \
$(if $(DRAM_USE_COMB),DRAM_USE_COMB=1) \
$(if $(USE_UBI),UBI=1 $(if $(findstring mt7622,$(PLAT)),OVERRIDE_UBI_START_ADDR=0x80000)) \
$(if $(USE_UBI),UBI=1 $(if $(findstring mt7981,$(PLAT)),OVERRIDE_UBI_START_ADDR=0x100000)) \
all
define Package/trusted-firmware-a/install

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