Compare commits

..

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

9019 changed files with 550264 additions and 1129644 deletions

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

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

View File

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

View File

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

View File

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

View File

@ -20,7 +20,7 @@ jobs:
name: Build OpenWrt Firmware name: Build OpenWrt Firmware
runs-on: ubuntu-22.04 runs-on: ubuntu-latest
steps: steps:
- name: Space cleanup and Initialization environment - name: Space cleanup and Initialization environment
@ -31,30 +31,16 @@ jobs:
sudo -E rm -rf /usr/share/dotnet /etc/mysql /etc/php /etc/apt/sources.list.d /usr/local/lib/android 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-mark hold grub-efi-amd64-signed
sudo -E apt update 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 purge azure-cli* docker* ghc* zulu* llvm* firefox google* dotnet* powershell* openjdk* mysql* php* mongodb* dotnet* moby* snap*
sudo -E apt -y full-upgrade 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 apt -y install ack antlr3 aria2 asciidoc autoconf automake autopoint binutils bison build-essential 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 python3 python3-pip libpython3-dev 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 systemctl daemon-reload
sudo -E apt -y autoremove --purge sudo -E apt -y autoremove --purge
sudo -E apt clean sudo -E apt clean
sudo -E timedatectl set-timezone "Asia/Shanghai" sudo -E timedatectl set-timezone "Asia/Shanghai"
- name: Checkout OpenWrt - name: Checkout OpenWrt
uses: actions/checkout@v4 uses: actions/checkout@v3
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: true
# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: true
dotnet: true
haskell: true
large-packages: true
swap-storage: true
- name: Update feeds - name: Update feeds
run: | run: |
@ -89,19 +75,19 @@ jobs:
cp -rf $(find ./bin/targets/ -type f -name "*.buildinfo" -o -name "*.manifest") ./artifact/buildinfo/ cp -rf $(find ./bin/targets/ -type f -name "*.buildinfo" -o -name "*.manifest") ./artifact/buildinfo/
- name: Upload buildinfo - name: Upload buildinfo
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v3
with: with:
name: OpenWrt_buildinfo name: OpenWrt_buildinfo
path: ./artifact/buildinfo/ path: ./artifact/buildinfo/
- name: Upload package - name: Upload package
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v3
with: with:
name: OpenWrt_package name: OpenWrt_package
path: ./artifact/package/ path: ./artifact/package/
- name: Upload firmware - name: Upload firmware
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v3
with: with:
name: OpenWrt_firmware name: OpenWrt_firmware
path: ./bin/targets/ path: ./bin/targets/

View File

@ -2,7 +2,7 @@
# #
# Copyright (C) 2006-2013 OpenWrt.org # Copyright (C) 2006-2013 OpenWrt.org
mainmenu "LEDE Configuration" mainmenu "OpenWrt Configuration"
config MODULES config MODULES
modules modules

View File

@ -10,13 +10,11 @@ export TOPDIR LC_ALL LANG TZ
empty:= empty:=
space:= $(empty) $(empty) space:= $(empty) $(empty)
$(if $(findstring $(space),$(TOPDIR)),$(error ERROR: The path to the LEDE directory must not include any spaces)) $(if $(findstring $(space),$(TOPDIR)),$(error ERROR: The path to the OpenWrt directory must not include any spaces))
world: world:
DISTRO_PKG_CONFIG:=$(shell $(TOPDIR)/scripts/command_all.sh pkg-config | grep -e '/usr' -e '/nix/store' -m 1) DISTRO_PKG_CONFIG:=$(shell $(TOPDIR)/scripts/command_all.sh pkg-config | grep '/usr' -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) export PATH:=$(if $(STAGING_DIR),$(abspath $(STAGING_DIR)/../host/bin),$(TOPDIR)/staging_dir/host/bin):$(PATH)
ifneq ($(OPENWRT_BUILD),1) ifneq ($(OPENWRT_BUILD),1)
@ -40,9 +38,6 @@ else
include tools/Makefile include tools/Makefile
include toolchain/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) $(if $(CONFIG_BUILDBOT),toolchain_rebuild_check)
$(target/stamp-compile): $(toolchain/stamp-compile) $(tools/stamp-compile) $(BUILD_DIR)/.prepared $(target/stamp-compile): $(toolchain/stamp-compile) $(tools/stamp-compile) $(BUILD_DIR)/.prepared
$(package/stamp-compile): $(target/stamp-compile) $(package/stamp-cleanup) $(package/stamp-compile): $(target/stamp-compile) $(package/stamp-cleanup)

View File

@ -1,25 +1,15 @@
# 欢迎来到 Lean 的 LEDE 源码仓库 # 欢迎来到 Lean 的 LEDE 源码仓库
为国产龙芯 LOONGSON SoC loongarch64 / 飞腾 Phytium 腾锐 D2000 系列架构添加支持 如何编译自己需要的 LEDE 固件 [How to build your LEDE firmware](./README_EN.md)
I18N: [English](README_EN.md) | [简体中文](README.md) | [日本語](README_JA.md)
## 官方讨论群 ## 官方讨论群
如有技术问题需要讨论或者交流,欢迎加入以下群: 如有技术问题需要讨论或者交流,欢迎加入以下群:
1. QQ 讨论群: Op固件技术研究群 ,号码 891659613 ,加群链接:[点击加入](https://jq.qq.com/?_wv=1027&k=XL8SK5aC "Op固件技术研究群")
2. TG 讨论群: OP 编译官方大群 ,加群链接:[点击加入](https://t.me/JhKgAA6Hx1 "OP 编译官方大群")
3. Rockchip RK3568 预编译固件发布 Release 下载更新地址 (包括 H68K )<https://github.com/coolsnowwolf/lede/releases/tag/20220716>
1. QQ 讨论群Op 固件技术研究群,号码 891659613加群链接[点击加入](https://qm.qq.com/q/IMa6Yf2SgC "Op固件技术研究群") <a href ="https://item.taobao.com/item.htm?spm=a230r.1.14.11.4bb55247rdHEAP&id=702787603594&ns=1&abbucket=17#detail
2. TG 讨论群OP 编译官方大群,加群链接:[点击加入](https://t.me/JhKgAA6Hx1 "OP 编译官方大群") "><img src="https://github.com/coolsnowwolf/lede/blob/master/doc/h68k.jpg?raw=true" width=600 /></a>
## 软路由 ArmSoM Sige 系列介绍
ArmSoM-Sige 系列:软路由、单板计算机、小型服务器与智能家居的全能之选。
[商品介绍页面 - ArmSom 品牌店](https://shop518100695.taobao.com/)
购买链接:
[![sige1-zh](doc/sige-zh.jpg)](https://item.taobao.com/item.htm?id=721197662185)
## 注意 ## 注意
@ -29,20 +19,19 @@ ArmSoM-Sige 系列:软路由、单板计算机、小型服务器与智能家
## 编译命令 ## 编译命令
1. 首先装好 Linux 系统,推荐 Debian 或 Ubuntu LTS 1. 首先装好 Linux 系统,推荐 Debian 11 或 Ubuntu LTS
2. 安装编译依赖 2. 安装编译依赖
```bash ```bash
sudo apt update -y sudo apt update -y
sudo apt full-upgrade -y sudo apt full-upgrade -y
sudo apt install -y ack antlr3 asciidoc autoconf automake autopoint binutils bison build-essential \ sudo apt install -y ack antlr3 aria2 asciidoc autoconf automake autopoint binutils bison build-essential \
bzip2 ccache clang cmake cpio curl device-tree-compiler flex gawk gcc-multilib g++-multilib gettext \ bzip2 ccache cmake cpio curl device-tree-compiler fastjar flex gawk gettext gcc-multilib g++-multilib \
genisoimage git gperf haveged help2man intltool libc6-dev-i386 libelf-dev libfuse-dev libglib2.0-dev \ git gperf haveged help2man intltool libc6-dev-i386 libelf-dev libglib2.0-dev libgmp3-dev libltdl-dev \
libgmp3-dev libltdl-dev libmpc-dev libmpfr-dev libncurses5-dev libncursesw5-dev libpython3-dev \ libmpc-dev libmpfr-dev libncurses5-dev libncursesw5-dev libreadline-dev libssl-dev libtool lrzsz \
libreadline-dev libssl-dev libtool llvm lrzsz msmtp ninja-build p7zip p7zip-full patch pkgconf \ mkisofs msmtp nano ninja-build p7zip p7zip-full patch pkgconf python2.7 python3 python3-pip libpython3-dev qemu-utils \
python3 python3-pyelftools python3-setuptools qemu-utils rsync scons squashfs-tools subversion \ rsync scons squashfs-tools subversion swig texinfo uglifyjs upx-ucl unzip vim wget xmlto xxd zlib1g-dev
swig texinfo uglifyjs upx-ucl unzip vim wget xmlto xxd zlib1g-dev
``` ```
3. 下载源代码,更新 feeds 并选择配置 3. 下载源代码,更新 feeds 并选择配置
@ -63,7 +52,7 @@ ArmSoM-Sige 系列:软路由、单板计算机、小型服务器与智能家
make V=s -j1 make V=s -j1
``` ```
本套代码保证肯定可以编译成功。里面包括了 R24 所有源代码,包括 IPK 的。 本套代码保证肯定可以编译成功。里面包括了 R23 所有源代码,包括 IPK 的。
你可以自由使用,但源码编译二次发布请注明我的 GitHub 仓库链接。谢谢合作! 你可以自由使用,但源码编译二次发布请注明我的 GitHub 仓库链接。谢谢合作!
@ -82,14 +71,14 @@ make V=s -j$(nproc)
如果需要重新配置: 如果需要重新配置:
```bash ```bash
rm -rf .config rm -rf ./tmp && rm -rf .config
make menuconfig make menuconfig
make V=s -j$(nproc) make V=s -j$(nproc)
``` ```
编译完成后输出路径bin/targets 编译完成后输出路径bin/targets
### 使用 WSL/WSL2 进行编译 ### 如果你使用 WSL/WSL2 进行编译
由于 WSL 的 PATH 中包含带有空格的 Windows 路径,有可能会导致编译失败,请在 `make` 前面加上: 由于 WSL 的 PATH 中包含带有空格的 Windows 路径,有可能会导致编译失败,请在 `make` 前面加上:
@ -97,23 +86,6 @@ make V=s -j$(nproc)
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
``` ```
由于默认情况下,装载到 WSL 发行版的 NTFS 格式的驱动器将不区分大小写,因此大概率在 WSL/WSL2 的编译检查中会返回以下错误:
```txt
Build dependency: OpenWrt can only be built on a case-sensitive filesystem
```
一个比较简洁的解决方法是,在 `git clone` 前先创建 Repository 目录,并为其启用大小写敏感:
```powershell
# 以管理员身份打开终端
PS > fsutil.exe file setCaseSensitiveInfo <your_local_lede_path> enable
# 将本项目 git clone 到开启了大小写敏感的目录 <your_local_lede_path>
PS > git clone https://github.com/coolsnowwolf/lede <your_local_lede_path>
```
> 对已经 `git clone` 完成的项目目录执行 `fsutil.exe` 命令无法生效,大小写敏感只对新增的文件变更有效。
### macOS 原生系统进行编译 ### macOS 原生系统进行编译
1. 在 AppStore 中安装 Xcode 1. 在 AppStore 中安装 Xcode
@ -121,10 +93,10 @@ PS > git clone https://github.com/coolsnowwolf/lede <your_local_lede_path>
2. 安装 Homebrew 2. 安装 Homebrew
```bash ```bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
``` ```
3. 使用 Homebrew 安装工具链、依赖与基础软件包 3. 使用 Homebrew 安装工具链、依赖与基础软件包:
```bash ```bash
brew unlink awk brew unlink awk
@ -134,8 +106,6 @@ PS > git clone https://github.com/coolsnowwolf/lede <your_local_lede_path>
4. 然后输入以下命令,添加到系统环境变量中: 4. 然后输入以下命令,添加到系统环境变量中:
- intel 芯片的 mac
```bash ```bash
echo 'export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"' >> ~/.bashrc echo 'export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"' >> ~/.bashrc
echo 'export PATH="/usr/local/opt/findutils/libexec/gnubin:$PATH"' >> ~/.bashrc echo 'export PATH="/usr/local/opt/findutils/libexec/gnubin:$PATH"' >> ~/.bashrc
@ -146,23 +116,11 @@ PS > git clone https://github.com/coolsnowwolf/lede <your_local_lede_path>
echo 'export PATH="/usr/local/opt/make/libexec/gnubin:$PATH"' >> ~/.bashrc echo 'export PATH="/usr/local/opt/make/libexec/gnubin:$PATH"' >> ~/.bashrc
``` ```
- apple 芯片的 mac
```zsh
echo 'export PATH="/opt/homebrew/opt/coreutils/libexec/gnubin:$PATH"' >> ~/.bashrc
echo 'export PATH="/opt/homebrew/opt/findutils/libexec/gnubin:$PATH"' >> ~/.bashrc
echo 'export PATH="/opt/homebrew/opt/gnu-getopt/bin:$PATH"' >> ~/.bashrc
echo 'export PATH="/opt/homebrew/opt/gnu-tar/libexec/gnubin:$PATH"' >> ~/.bashrc
echo 'export PATH="/opt/homebrew/opt/grep/libexec/gnubin:$PATH"' >> ~/.bashrc
echo 'export PATH="/opt/homebrew/opt/gnu-sed/libexec/gnubin:$PATH"' >> ~/.bashrc
echo 'export PATH="/opt/homebrew/opt/make/libexec/gnubin:$PATH"' >> ~/.bashrc
```
5. 重新加载一下 shell 启动文件 `source ~/.bashrc`,然后输入 `bash` 进入 bash shell就可以和 Linux 一样正常编译了 5. 重新加载一下 shell 启动文件 `source ~/.bashrc`,然后输入 `bash` 进入 bash shell就可以和 Linux 一样正常编译了
## 特别提示 ## 特别提示
1. 源代码中绝不含任何后门和可以监控或者劫持你的 HTTPS 的闭源软件, SSL 安全是互联网最后的壁垒,安全干净才是固件应该做到的。 1. 源代码中绝不含任何后门和可以监控或者劫持你的 HTTPS 的闭源软件, SSL 安全是互联网最后的壁垒。安全干净才是固件应该做到的;
2. 想学习 OpenWrt 开发,但是摸不着门道?自学没毅力?基础太差?怕太难学不会?跟着佐大学 OpenWrt 开发入门培训班助你能学有所成 2. 想学习 OpenWrt 开发,但是摸不着门道?自学没毅力?基础太差?怕太难学不会?跟着佐大学 OpenWrt 开发入门培训班助你能学有所成
报名地址:[点击报名](http://forgotfun.org/2018/04/openwrt-training-2018.html "报名") 报名地址:[点击报名](http://forgotfun.org/2018/04/openwrt-training-2018.html "报名")
@ -171,6 +129,16 @@ PS > git clone https://github.com/coolsnowwolf/lede <your_local_lede_path>
4. 存档版本仓库地址:<https://github.com/coolsnowwolf/openwrt> 4. 存档版本仓库地址:<https://github.com/coolsnowwolf/openwrt>
## 软路由介绍
iKOOLCORE 硬酷R1 多网口小主机 - N5105/N6005 : Cube box, rest fun. 方寸之间,尽享乐趣
(商品介绍页面 - 硬酷科技(支持花呗))
[优惠券链接](https://taoquan.taobao.com/coupon/unify_apply.htm?sellerId=2208215115814&activityId=85fbaf791c4b45e9aaf5ec8e3d1cb2a9)
[下单链接](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`. Let's start!
Join the group: [Link](https://jq.qq.com/?_wv=1027&k=XL8SK5aC "Op固件技术研究群"). ---
- [Click to download QQ client](https://im.qq.com/pcqq). 1. First, install Ubuntu 64bit (Ubuntu 20.04 LTS x86 is recommended).
2. Telegram Group: *OpenWRT Firmware Technical Research Group*. 2. Run `sudo apt-get update` in the terminal, and then run
Join the group: [Link](https://t.me/JhKgAA6Hx1 "OP 编译官方大群"). `
sudo apt-get -y install build-essential asciidoc binutils bzip2 gawk gettext git libncurses5-dev libz-dev patch python3 python2.7 unzip zlib1g-dev lib32gcc1 libc6-dev-i386 subversion flex uglifyjs git-core gcc-multilib p7zip p7zip-full msmtp libssl-dev texinfo libglib2.0-dev xmlto qemu-utils upx libelf-dev autoconf automake libtool autopoint device-tree-compiler g++-multilib antlr3 gperf wget curl swig rsync
`
## ArmSoM Sige Board Series Introduction 3. Run `git clone https://github.com/coolsnowwolf/lede` to clone the source code, and then `cd lede` to enter the directory
ArmSoM-Sige Series: Your All-in-One Powerhouse for Soft Routing, SBCs, Mini Servers, and Home Automation. 4. ```bash
[ArmSoM Store](https://www.aliexpress.com/store/1102800175)
Buy Link
[![sige1-en](doc/sige-en.jpg)](https://aliexpress.com/item/3256807356692995.html)
## Notice
1. **Never compile OpenWRT as `root`**
2. If you are living in mainland China, please make sure you could visit the **REAL** Internet.
3. Default login IP is `192.168.1.1`, password is `password`.
## How to Compile
1. Install a Linux distribution, Debian or Ubuntu LTS is recommended.
2. Install dependencies:
```bash
sudo apt update -y
sudo apt full-upgrade -y
sudo apt install -y ack antlr3 asciidoc autoconf automake autopoint binutils bison build-essential \
bzip2 ccache clang cmake cpio curl device-tree-compiler flex gawk gcc-multilib g++-multilib gettext \
git gperf haveged help2man intltool libc6-dev-i386 libelf-dev libfuse-dev libglib2.0-dev libgmp3-dev \
libltdl-dev libmpc-dev libmpfr-dev libncurses5-dev libncursesw5-dev libpython3-dev libreadline-dev \
libssl-dev libtool llvm lrzsz mkisofs msmtp nano ninja-build p7zip p7zip-full patch pkgconf python3 \
python3-pyelftools python3-setuptools qemu-utils rsync scons squashfs-tools subversion swig texinfo \
uglifyjs upx-ucl unzip vim wget xmlto xxd zlib1g-dev
```
3. Clone the source code, update `feeds` and configure:
```bash
git clone https://github.com/coolsnowwolf/lede
cd lede
./scripts/feeds update -a ./scripts/feeds update -a
./scripts/feeds install -a ./scripts/feeds install -a
make menuconfig make menuconfig
``` ```
4. Download libraries and compile firmware 5. Run `make -j8 download V=s` to download libraries and dependencies (user in China should use global proxy when possible)
> (`-j` is the thread count, single-thread is recommended for the first build):
```bash 6. Run `make -j1 V=s` (integer following -j is the thread count, single-thread is recommended for the first build) to start building your firmware.
make download -j8
make V=s -j1
```
These commands are supposed to compile the source code successfully. This source code is promised to be compiled successfully.
All source code of R23 is included, including IPK.
You can use this source code freely, but please link this GitHub repository when redistributing. You can use this source code freely, but please link this GitHub repository when redistributing. Thank you for your cooperation!
Thank you for your cooperation! =
Rebuild: Rebuild:
```bash ```bash
cd lede cd lede
git pull git pull
./scripts/feeds update -a ./scripts/feeds update -a && ./scripts/feeds install -a
./scripts/feeds install -a
make defconfig make defconfig
make download -j8 make -j8 download
make V=s -j$(nproc) make -j$(($(nproc) + 1)) V=s
``` ```
If reconfiguration is need: If reconfiguration is need:
```bash ```bash
rm -rf ./tmp && rm -rf .config rm -rf ./tmp && rm -rf .config
make menuconfig make menuconfig
make V=s -j$(nproc) make -j$(($(nproc) + 1)) V=s
``` ```
Build artifacts will be outputted to `bin/targets` directory. Build result will be produced to `bin/targets` directory.
### If you are using WSL/WSL2 as your build environment Special tips:
------
1. This source code doesn't contain any backdoors or close source applications that can monitor/capture your HTTPS traffic, SSL is the final castle of cyber security. Safety is what a firmware should achieve.
WSL's `PATH` potentially contain Windows paths with spaces, which may cause compilation failure. 2. If you have any technical problem, you may join the QQ discussion group: 297253733, link: click [here](https://jq.qq.com/?_wv=1027&k=5yCRuXL)
Please add the following lines to your local environment profiles before compiling:
```bash 3. Want to learn OpenWrt development but don't know how? Can't motivate yourself for self-learning? Not enough fundamental knowledge? Learn OpenWrt development with Mr. Zuo through his Beginner OpenWrt Training Course. Click [here](http://forgotfun.org/2018/04/openwrt-training-2018.html) to register.
# Update and reload your profile, ~/.bashrc for example.
cat << EOF >> ~/.bashrc
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH"
EOF
source ~/.bashrc
```
NTFS-formatted drives mounted to a WSL distribution will be case-insensitive by default. ## Router Recommendation
This will cause the following error when compiling in WSL/WSL2: Not Sponsored: If you are finding a low power consumption, small and performance promising x86/x64 router, I personally recommend the
EZPROv1 Alumium Edition (N3710 4000M): [Details](https://item.taobao.com/item.htm?spm=a230r.1.14.20.144c763fRkK0VZ&id=561126544764)
```txt ![xm1](doc/xm5.jpg)
Build dependency: OpenWrt can only be built on a case-sensitive filesystem ![xm2](doc/xm6.jpg)
```
A simple solution is to create a case-sensitive directory for the repository before `git clone`:
```powershell
# Open a terminal as administrator
PS > fsutil.exe file setCaseSensitiveInfo <your_local_lede_path> enable
# Clone this repository to the case-sensitive directory <your_local_lede_path>
PS > git clone git@github.com:coolsnowwolf/lede.git <your_local_lede_path>
```
> For directories that have already been `git clone`, `fsutil.exe` will not take effect.
> Case sensitivity will only be enabled for new changes in the directory.
### macOS Compilation
1. Install Xcode from AppStore
2. Install Homebrew:
```bash
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
```
3. Install toolchain, dependencies and packages with Homebrew:
```bash
brew unlink awk
brew install coreutils diffutils findutils gawk gnu-getopt gnu-tar grep make ncurses pkg-config wget quilt xz
brew install gcc@11
```
4. Update your system environment:
- mac with intel chip
```bash
echo 'export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"' >> ~/.bashrc
echo 'export PATH="/usr/local/opt/findutils/libexec/gnubin:$PATH"' >> ~/.bashrc
echo 'export PATH="/usr/local/opt/gnu-getopt/bin:$PATH"' >> ~/.bashrc
echo 'export PATH="/usr/local/opt/gnu-tar/libexec/gnubin:$PATH"' >> ~/.bashrc
echo 'export PATH="/usr/local/opt/grep/libexec/gnubin:$PATH"' >> ~/.bashrc
echo 'export PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH"' >> ~/.bashrc
echo 'export PATH="/usr/local/opt/make/libexec/gnubin:$PATH"' >> ~/.bashrc
```
- mac with apple chip
```zsh
echo 'export PATH="/opt/homebrew/opt/coreutils/libexec/gnubin:$PATH"' >> ~/.bashrc
echo 'export PATH="/opt/homebrew/opt/findutils/libexec/gnubin:$PATH"' >> ~/.bashrc
echo 'export PATH="/opt/homebrew/opt/gnu-getopt/bin:$PATH"' >> ~/.bashrc
echo 'export PATH="/opt/homebrew/opt/gnu-tar/libexec/gnubin:$PATH"' >> ~/.bashrc
echo 'export PATH="/opt/homebrew/opt/grep/libexec/gnubin:$PATH"' >> ~/.bashrc
echo 'export PATH="/opt/homebrew/opt/gnu-sed/libexec/gnubin:$PATH"' >> ~/.bashrc
echo 'export PATH="/opt/homebrew/opt/make/libexec/gnubin:$PATH"' >> ~/.bashrc
```
5. Reload your shell profile `source ~/.bashrc && bash`, then you can compile normally like Linux.
## Declaration
1. This source code doesn't contain any backdoors or closed source applications that can monitor/capture your HTTPS traffic. SSL security is the final castle of cyber security. Safety is what a firmware should do.
2. Want to learn OpenWRT development but don't know how to start? Can't motivate yourself for self-learning? Do not have enough fundamental knowledge? Learn OpenWRT development with Mr. Zuo through his Beginner OpenWRT Training Course. Click [here](http://forgotfun.org/2018/04/openwrt-training-2018.html) to register.
3. QCA IPQ60xx open source repository: <https://github.com/coolsnowwolf/openwrt-gl-ax1800>
4. OpenWRT Archive repository: <https://github.com/coolsnowwolf/openwrt>
## Introduction to Software Routers
Yingku R2 - N95/N300 Mini Four-Network HomeLab Server
(Introduction page - Yingku Technology (support AliPay Huabei)):
[Pre-sale link](https://item.taobao.com/item.htm?ft=t&id=719159813003)
<div align="left">
<a href="https://item.taobao.com/item.htm?ft=t&id=719159813003">
<img src="doc/r1.jpg" width = "600" alt="" align=center />
</a>
</div>
<br>
## Donation ## Donation
If this project did helped you, please consider donating to support the development of this project. If this project does help you, please consider donating to support the development of this project.
<div align="left"> ### Alipay
<img src="./doc/star.png" width = "400" alt="" align=center />
</div> ![alipay](doc/alipay_donate.jpg)
<br>
### WeChat
![wechat](doc/wechat_donate.jpg)
## Note: Addition Lean's private package source code in `./package/lean` directory. Use it under GPL v3.
## GPLv3 is compatible with more licenses than GPLv2: it allows you to make combinations with code that has specific kinds of additional requirements that are not in GPLv3 itself. Section 7 has more information about this, including the list of additional requirements that are permitted.

View File

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

View File

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

View File

@ -4,9 +4,11 @@
menuconfig DEVEL menuconfig DEVEL
bool "Advanced configuration options (for developers)" bool "Advanced configuration options (for developers)"
default n
config BROKEN config BROKEN
bool "Show broken platforms / packages / devices" if DEVEL bool "Show broken platforms / packages / devices" if DEVEL
default n
config BINARY_FOLDER config BINARY_FOLDER
string "Binary folder" if DEVEL string "Binary folder" if DEVEL
@ -51,6 +53,7 @@ menuconfig DEVEL
config AUTOREMOVE config AUTOREMOVE
bool "Automatic removal of build directories" if DEVEL bool "Automatic removal of build directories" if DEVEL
default n
help help
Automatically delete build directories after make target completed. Automatically delete build directories after make target completed.
This allows you to symlink build_dir into a scratch location, e.g. a ramdisk, This allows you to symlink build_dir into a scratch location, e.g. a ramdisk,
@ -58,6 +61,7 @@ menuconfig DEVEL
config BUILD_ALL_HOST_TOOLS config BUILD_ALL_HOST_TOOLS
bool "Compile all host tools" if DEVEL bool "Compile all host tools" if DEVEL
default n
help help
Compile all host host tools even if not needed. This is needed to prepare a 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. universal precompiled host tools archive to use in another buildroot.
@ -80,6 +84,7 @@ menuconfig DEVEL
config CCACHE config CCACHE
bool "Use ccache" if DEVEL bool "Use ccache" if DEVEL
default n
help help
Compiler cache; see https://ccache.samba.org/ Compiler cache; see https://ccache.samba.org/

View File

@ -17,7 +17,7 @@ menu "Target Images"
default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_lantiq default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_lantiq
default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_mpc85xx default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_mpc85xx
default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_ramips default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_ramips
default TARGET_INITRAMFS_COMPRESSION_ZSTD if TARGET_qualcommax default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_ipq40xx
default TARGET_INITRAMFS_COMPRESSION_XZ if USES_SEPARATE_INITRAMFS default TARGET_INITRAMFS_COMPRESSION_XZ if USES_SEPARATE_INITRAMFS
default TARGET_INITRAMFS_COMPRESSION_NONE default TARGET_INITRAMFS_COMPRESSION_NONE
depends on TARGET_ROOTFS_INITRAMFS depends on TARGET_ROOTFS_INITRAMFS
@ -157,7 +157,7 @@ menu "Target Images"
depends on TARGET_ROOTFS_SQUASHFS depends on TARGET_ROOTFS_SQUASHFS
default 64 if LOW_MEMORY_FOOTPRINT default 64 if LOW_MEMORY_FOOTPRINT
default 1024 if (SMALL_FLASH && !LOW_MEMORY_FOOTPRINT) default 1024 if (SMALL_FLASH && !LOW_MEMORY_FOOTPRINT)
default 256 default 1024
help help
Select squashfs block size, must be one of: Select squashfs block size, must be one of:
4, 8, 16, 32, 64, 128, 256, 512, 1024 4, 8, 16, 32, 64, 128, 256, 512, 1024
@ -198,23 +198,18 @@ menu "Target Images"
default "" default ""
config GRUB_IMAGES config GRUB_IMAGES
bool "Build GRUB images" bool "Build GRUB images (Linux x86 or x86_64 host only)"
depends on TARGET_x86 depends on TARGET_x86
depends on TARGET_ROOTFS_EXT4FS || TARGET_ROOTFS_JFFS2 || TARGET_ROOTFS_SQUASHFS depends on TARGET_ROOTFS_EXT4FS || TARGET_ROOTFS_JFFS2 || TARGET_ROOTFS_SQUASHFS
select PACKAGE_grub2 select PACKAGE_grub2
select PACKAGE_grub2-bios-setup
default n default n
config GRUB_EFI_IMAGES config GRUB_EFI_IMAGES
bool "Build GRUB EFI images" bool "Build GRUB EFI images (Linux x86 or x86_64 host only)"
depends on TARGET_x86 || TARGET_armvirt || TARGET_loongarch64 || TARGET_phytium depends on TARGET_x86
depends on TARGET_ROOTFS_EXT4FS || TARGET_ROOTFS_JFFS2 || TARGET_ROOTFS_SQUASHFS depends on TARGET_ROOTFS_EXT4FS || TARGET_ROOTFS_JFFS2 || TARGET_ROOTFS_SQUASHFS
select PACKAGE_grub2 if TARGET_x86 select PACKAGE_grub2
select PACKAGE_grub2-efi if TARGET_x86 select PACKAGE_grub2-efi
select PACKAGE_grub2-bios-setup if TARGET_x86
select PACKAGE_grub2-efi-arm if TARGET_armvirt
select PACKAGE_grub2-efi-arm if TARGET_phytium_armv8
select PACKAGE_grub2-efi-loongarch64 if TARGET_loongarch64
select PACKAGE_kmod-fs-vfat select PACKAGE_kmod-fs-vfat
default y default y
@ -279,8 +274,9 @@ menu "Target Images"
config VMDK_IMAGES config VMDK_IMAGES
bool "Build VMware image files (VMDK)" bool "Build VMware image files (VMDK)"
depends on TARGET_x86 || TARGET_armvirt depends on TARGET_x86
depends on GRUB_IMAGES || GRUB_EFI_IMAGES depends on GRUB_IMAGES || GRUB_EFI_IMAGES
default y
select PACKAGE_kmod-e1000 select PACKAGE_kmod-e1000
config VHDX_IMAGES config VHDX_IMAGES
@ -291,28 +287,25 @@ menu "Target Images"
config TARGET_IMAGES_GZIP config TARGET_IMAGES_GZIP
bool "GZip images" bool "GZip images"
depends on TARGET_ROOTFS_EXT4FS || TARGET_x86 || TARGET_armvirt || TARGET_malta || TARGET_loongarch64 depends on TARGET_ROOTFS_EXT4FS || TARGET_x86 || TARGET_armvirt || TARGET_malta
default y default y
comment "Image Options" comment "Image Options"
source "target/linux/*/image/Config.in" source "target/linux/*/image/Config.in"
source "target/linux/*/*/image/Config.in"
config TARGET_KERNEL_PARTSIZE config TARGET_KERNEL_PARTSIZE
int "Kernel partition size (in MiB)" int "Kernel partition size (in MiB)"
depends on USES_BOOT_PART depends on USES_BOOT_PART
default 8 if TARGET_apm821xx_sata default 8 if TARGET_apm821xx_sata
default 64 if TARGET_bcm27xx default 64 if TARGET_bcm27xx
default 128 if TARGET_armvirt
default 32 if TARGET_rockchip default 32 if TARGET_rockchip
default 16 default 16
config TARGET_ROOTFS_PARTSIZE config TARGET_ROOTFS_PARTSIZE
int "Root filesystem partition size (in MiB)" int "Root filesystem partition size (in MiB)"
depends on USES_ROOTFS_PART || TARGET_ROOTFS_EXT4FS depends on USES_ROOTFS_PART || TARGET_ROOTFS_EXT4FS
default 232 if TARGET_loongarch64 default 400 if TARGET_x86
default 448 if TARGET_mediatek || TARGET_x86
default 160 default 160
help help
Select the root filesystem partition size. Select the root filesystem partition size.

View File

@ -47,25 +47,12 @@ config KERNEL_MIPS_FP_SUPPORT
config KERNEL_ARM_PMU config KERNEL_ARM_PMU
bool bool
default y if TARGET_armsr_armv8 default n
depends on (arm || aarch64) depends on (arm || aarch64)
config KERNEL_ARM_PMUV3
bool
default y if TARGET_armsr_armv8
depends on (arm_v7 || aarch64) && LINUX_6_6
config KERNEL_RISCV_PMU
bool
select KERNEL_RISCV_PMU_SBI
depends on riscv64
config KERNEL_RISCV_PMU_SBI
bool
depends on riscv64
config KERNEL_X86_VSYSCALL_EMULATION config KERNEL_X86_VSYSCALL_EMULATION
bool "Enable vsyscall emulation" bool "Enable vsyscall emulation"
default n
depends on x86_64 depends on x86_64
help help
This enables emulation of the legacy vsyscall page. Disabling This enables emulation of the legacy vsyscall page. Disabling
@ -83,12 +70,12 @@ config KERNEL_X86_VSYSCALL_EMULATION
config KERNEL_PERF_EVENTS config KERNEL_PERF_EVENTS
bool "Compile the kernel with performance events and counters" bool "Compile the kernel with performance events and counters"
default n
select KERNEL_ARM_PMU if (arm || aarch64) select KERNEL_ARM_PMU if (arm || aarch64)
select KERNEL_ARM_PMUV3 if (arm_v7 || aarch64) && LINUX_6_6
select KERNEL_RISCV_PMU if riscv64
config KERNEL_PROFILING config KERNEL_PROFILING
bool "Compile the kernel with profiling enabled" bool "Compile the kernel with profiling enabled"
default n
select KERNEL_PERF_EVENTS select KERNEL_PERF_EVENTS
help help
Enable the extended profiling support mechanisms used by profilers such Enable the extended profiling support mechanisms used by profilers such
@ -160,7 +147,7 @@ config KERNEL_UBSAN_TRAP
config KERNEL_KASAN config KERNEL_KASAN
bool "Compile the kernel with KASan: runtime memory debugger" bool "Compile the kernel with KASan: runtime memory debugger"
select KERNEL_SLUB_DEBUG select KERNEL_SLUB_DEBUG
depends on (x86_64 || aarch64 || arm || powerpc || riscv64) depends on (x86_64 || aarch64)
help help
Enables kernel address sanitizer - runtime memory debugger, Enables kernel address sanitizer - runtime memory debugger,
designed to find out-of-bounds accesses and use-after-free bugs. designed to find out-of-bounds accesses and use-after-free bugs.
@ -173,6 +160,16 @@ config KERNEL_KASAN
Currently CONFIG_KASAN doesn't work with CONFIG_DEBUG_SLAB Currently CONFIG_KASAN doesn't work with CONFIG_DEBUG_SLAB
(the resulting kernel does not boot). (the resulting kernel does not boot).
config KERNEL_KASAN_EXTRA
bool "KAsan: extra checks"
depends on KERNEL_KASAN && KERNEL_DEBUG_KERNEL
help
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
config KERNEL_KASAN_VMALLOC config KERNEL_KASAN_VMALLOC
bool "Back mappings in vmalloc space with real shadow memory" bool "Back mappings in vmalloc space with real shadow memory"
depends on KERNEL_KASAN depends on KERNEL_KASAN
@ -191,73 +188,16 @@ config KERNEL_KASAN_VMALLOC
will have no effect. will have no effect.
if KERNEL_KASAN if KERNEL_KASAN
choice config KERNEL_KASAN_GENERIC
prompt "KASAN mode" def_bool y
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
config KERNEL_KASAN_SW_TAGS
def_bool n
endif endif
choice choice
prompt "Instrumentation type" prompt "Instrumentation type"
depends on KERNEL_KASAN depends on KERNEL_KASAN
depends on !KERNEL_KASAN_HW_TAGS
default KERNEL_KASAN_OUTLINE default KERNEL_KASAN_OUTLINE
config KERNEL_KASAN_OUTLINE config KERNEL_KASAN_OUTLINE
@ -315,6 +255,7 @@ config KERNEL_KCOV_INSTRUMENT_ALL
config KERNEL_TASKSTATS config KERNEL_TASKSTATS
bool "Compile the kernel with task resource/io statistics and accounting" bool "Compile the kernel with task resource/io statistics and accounting"
default n
help help
Enable the collection and publishing of task/io statistics and Enable the collection and publishing of task/io statistics and
accounting. Enable this option to enable i/o monitoring in system accounting. Enable this option to enable i/o monitoring in system
@ -333,25 +274,6 @@ if KERNEL_TASKSTATS
endif endif
config KERNEL_PSI
bool "Compile the kernel with pressure stall information tracking"
help
Collect metrics that indicate how overcommitted the CPU, memory,
and IO capacity are in the system.
If you say Y here, the kernel will create /proc/pressure/ with the
pressure statistics files cpu, memory, and io. These will indicate
the share of walltime in which some or all tasks in the system are
delayed due to contention of the respective resource.
In kernels with cgroup support, cgroups (cgroup2 only) will
have cpu.pressure, memory.pressure, and io.pressure files,
which aggregate pressure stalls for the grouped tasks only.
For more details see Documentation/accounting/psi.rst.
Say N if unsure.
config KERNEL_KALLSYMS config KERNEL_KALLSYMS
bool "Compile the kernel with symbol table information" bool "Compile the kernel with symbol table information"
default y if !SMALL_FLASH default y if !SMALL_FLASH
@ -361,30 +283,37 @@ config KERNEL_KALLSYMS
config KERNEL_FTRACE config KERNEL_FTRACE
bool "Compile the kernel with tracing support" bool "Compile the kernel with tracing support"
depends on !TARGET_uml depends on !TARGET_uml
default n
config KERNEL_FTRACE_SYSCALLS config KERNEL_FTRACE_SYSCALLS
bool "Trace system calls" bool "Trace system calls"
depends on KERNEL_FTRACE depends on KERNEL_FTRACE
default n
config KERNEL_ENABLE_DEFAULT_TRACERS config KERNEL_ENABLE_DEFAULT_TRACERS
bool "Trace process context switches and events" bool "Trace process context switches and events"
depends on KERNEL_FTRACE depends on KERNEL_FTRACE
default n
config KERNEL_FUNCTION_TRACER config KERNEL_FUNCTION_TRACER
bool "Function tracer" bool "Function tracer"
depends on KERNEL_FTRACE depends on KERNEL_FTRACE
default n
config KERNEL_FUNCTION_GRAPH_TRACER config KERNEL_FUNCTION_GRAPH_TRACER
bool "Function graph tracer" bool "Function graph tracer"
depends on KERNEL_FUNCTION_TRACER depends on KERNEL_FUNCTION_TRACER
default n
config KERNEL_DYNAMIC_FTRACE config KERNEL_DYNAMIC_FTRACE
bool "Enable/disable function tracing dynamically" bool "Enable/disable function tracing dynamically"
depends on KERNEL_FUNCTION_TRACER depends on KERNEL_FUNCTION_TRACER
default n
config KERNEL_FUNCTION_PROFILER config KERNEL_FUNCTION_PROFILER
bool "Function profiler" bool "Function profiler"
depends on KERNEL_FUNCTION_TRACER depends on KERNEL_FUNCTION_TRACER
default n
config KERNEL_IRQSOFF_TRACER config KERNEL_IRQSOFF_TRACER
bool "Interrupts-off Latency Tracer" bool "Interrupts-off Latency Tracer"
@ -435,6 +364,7 @@ config KERNEL_HIST_TRIGGERS
config KERNEL_DEBUG_KERNEL config KERNEL_DEBUG_KERNEL
bool bool
default n
config KERNEL_DEBUG_INFO config KERNEL_DEBUG_INFO
bool "Compile the kernel with debug information" bool "Compile the kernel with debug information"
@ -444,7 +374,9 @@ config KERNEL_DEBUG_INFO
This will compile your kernel and modules with debug information. This will compile your kernel and modules with debug information.
config KERNEL_DEBUG_INFO_BTF config KERNEL_DEBUG_INFO_BTF
bool "Enable additional BTF type information" bool "Enable additional BTF type information"
default n
depends on !HOST_OS_MACOS depends on !HOST_OS_MACOS
depends on KERNEL_DEBUG_INFO && !KERNEL_DEBUG_INFO_REDUCED depends on KERNEL_DEBUG_INFO && !KERNEL_DEBUG_INFO_REDUCED
select DWARVES select DWARVES
@ -455,20 +387,6 @@ config KERNEL_DEBUG_INFO_BTF
Required to run BPF CO-RE applications. 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 config KERNEL_DEBUG_INFO_REDUCED
bool "Reduce debugging information" bool "Reduce debugging information"
default y default y
@ -483,21 +401,6 @@ config KERNEL_DEBUG_INFO_REDUCED
DEBUG_INFO build and compile times are reduced too. DEBUG_INFO build and compile times are reduced too.
Only works with newer gcc versions. Only works with newer gcc versions.
config KERNEL_FRAME_WARN
int
range 0 8192
default 1280 if KERNEL_KASAN && !ARCH_64BIT
default 1024 if !ARCH_64BIT
default 2048 if ARCH_64BIT
help
Tell the compiler to warn at build time for stack frames larger than this.
Setting this too low will cause a lot of warnings.
Setting it to 0 disables the warning.
# KERNEL_DEBUG_LL symbols must have the default value set as otherwise
# KConfig wont evaluate them unless KERNEL_EARLY_PRINTK is selected
# which means that buildroot wont override the DEBUG_LL symbols in target
# kernel configurations and lead to devices that dont have working console
config KERNEL_DEBUG_LL_UART_NONE config KERNEL_DEBUG_LL_UART_NONE
bool bool
default n default n
@ -514,6 +417,7 @@ config KERNEL_DEBUG_LL
config KERNEL_DEBUG_VIRTUAL config KERNEL_DEBUG_VIRTUAL
bool "Compile the kernel with VM translations debugging" bool "Compile the kernel with VM translations debugging"
select KERNEL_DEBUG_KERNEL select KERNEL_DEBUG_KERNEL
default n
help help
Enable checks sanity checks to catch invalid uses of Enable checks sanity checks to catch invalid uses of
virt_to_phys()/phys_to_virt() against the non-linear address space. virt_to_phys()/phys_to_virt() against the non-linear address space.
@ -521,6 +425,7 @@ config KERNEL_DEBUG_VIRTUAL
config KERNEL_DYNAMIC_DEBUG config KERNEL_DYNAMIC_DEBUG
bool "Compile the kernel with dynamic printk" bool "Compile the kernel with dynamic printk"
select KERNEL_DEBUG_FS select KERNEL_DEBUG_FS
default n
help help
Compiles debug level messages into the kernel, which would not Compiles debug level messages into the kernel, which would not
otherwise be available at runtime. These messages can then be otherwise be available at runtime. These messages can then be
@ -532,6 +437,7 @@ config KERNEL_DYNAMIC_DEBUG
config KERNEL_EARLY_PRINTK config KERNEL_EARLY_PRINTK
bool "Compile the kernel with early printk" bool "Compile the kernel with early printk"
default y if TARGET_bcm53xx default y if TARGET_bcm53xx
default n
depends on arm depends on arm
select KERNEL_DEBUG_KERNEL select KERNEL_DEBUG_KERNEL
select KERNEL_DEBUG_LL if arm select KERNEL_DEBUG_LL if arm
@ -542,6 +448,7 @@ config KERNEL_EARLY_PRINTK
config KERNEL_KPROBES config KERNEL_KPROBES
bool "Compile the kernel with kprobes support" bool "Compile the kernel with kprobes support"
default n
select KERNEL_FTRACE select KERNEL_FTRACE
select KERNEL_PERF_EVENTS select KERNEL_PERF_EVENTS
help help
@ -558,6 +465,7 @@ config KERNEL_KPROBE_EVENTS
config KERNEL_BPF_EVENTS config KERNEL_BPF_EVENTS
bool "Compile the kernel with BPF event support" bool "Compile the kernel with BPF event support"
default n
select KERNEL_KPROBES select KERNEL_KPROBES
help help
Allows to attach BPF programs to kprobe, uprobe and tracepoint events. Allows to attach BPF programs to kprobe, uprobe and tracepoint events.
@ -565,14 +473,10 @@ config KERNEL_BPF_EVENTS
for sending data from BPF programs to user-space for post-processing for sending data from BPF programs to user-space for post-processing
or logging. 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 config KERNEL_BPF_KPROBE_OVERRIDE
bool bool
depends on KERNEL_KPROBES
default n default n
depends on KERNEL_KPROBES
config KERNEL_AIO config KERNEL_AIO
bool "Compile the kernel with asynchronous IO support" bool "Compile the kernel with asynchronous IO support"
@ -580,8 +484,7 @@ config KERNEL_AIO
config KERNEL_IO_URING config KERNEL_IO_URING
bool "Compile the kernel with io_uring support" bool "Compile the kernel with io_uring support"
depends on !SMALL_FLASH default y if !SMALL_FLASH
default y if (x86_64 || aarch64)
config KERNEL_FHANDLE config KERNEL_FHANDLE
bool "Compile the kernel with support for fhandle syscalls" bool "Compile the kernel with support for fhandle syscalls"
@ -593,6 +496,7 @@ config KERNEL_FANOTIFY
config KERNEL_BLK_DEV_BSG config KERNEL_BLK_DEV_BSG
bool "Compile the kernel with SCSI generic v4 support for any block device" bool "Compile the kernel with SCSI generic v4 support for any block device"
default n
config KERNEL_TRANSPARENT_HUGEPAGE config KERNEL_TRANSPARENT_HUGEPAGE
bool bool
@ -616,6 +520,7 @@ config KERNEL_HUGETLB_PAGE
bool "Compile the kernel with HugeTLB support" bool "Compile the kernel with HugeTLB support"
select KERNEL_TRANSPARENT_HUGEPAGE select KERNEL_TRANSPARENT_HUGEPAGE
select KERNEL_HUGETLBFS select KERNEL_HUGETLBFS
default n
config KERNEL_MAGIC_SYSRQ config KERNEL_MAGIC_SYSRQ
bool "Compile the kernel with SysRq support" bool "Compile the kernel with SysRq support"
@ -640,6 +545,7 @@ config KERNEL_ELF_CORE
config KERNEL_PROVE_LOCKING config KERNEL_PROVE_LOCKING
bool "Enable kernel lock checking" bool "Enable kernel lock checking"
select KERNEL_DEBUG_KERNEL select KERNEL_DEBUG_KERNEL
default n
config KERNEL_SOFTLOCKUP_DETECTOR config KERNEL_SOFTLOCKUP_DETECTOR
bool "Compile the kernel with detect Soft Lockups" bool "Compile the kernel with detect Soft Lockups"
@ -653,18 +559,6 @@ config KERNEL_SOFTLOCKUP_DETECTOR
chance to run. The current stack trace is displayed upon chance to run. The current stack trace is displayed upon
detection and the system will stay locked up. detection and the system will stay locked up.
config KERNEL_HARDLOCKUP_DETECTOR
bool "Compile the kernel with detect Hard Lockups"
depends on KERNEL_DEBUG_KERNEL
help
Say Y here to enable the kernel to act as a watchdog to detect
hard lockups.
Hardlockups are bugs that cause the CPU to loop in kernel mode
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.
config KERNEL_DETECT_HUNG_TASK config KERNEL_DETECT_HUNG_TASK
bool "Compile the kernel with detect Hung Tasks" bool "Compile the kernel with detect Hung Tasks"
depends on KERNEL_DEBUG_KERNEL depends on KERNEL_DEBUG_KERNEL
@ -714,23 +608,10 @@ config KERNEL_PRINTK_TIME
default y default y
config KERNEL_SLUB_DEBUG config KERNEL_SLUB_DEBUG
bool "Enable SLUB debugging support" bool
help
This enables various debugging features:
- Accepts "slub_debug" kernel parameter
- Provides caches debugging options (e.g. tracing, validating)
- Adds /sys/kernel/slab/ attrs for reading amounts of *objects*
- Enables /proc/slabinfo support
- Prints info when running out of memory
Enabling this can result in a significant increase of code size.
config KERNEL_SLUB_DEBUG_ON config KERNEL_SLUB_DEBUG_ON
depends on KERNEL_SLUB_DEBUG bool
bool "Boot kernel with basic caches debugging enabled"
help
This enables by default sanity_checks, red_zone, poison and store_user
debugging options for all caches.
config KERNEL_SLABINFO config KERNEL_SLABINFO
select KERNEL_SLUB_DEBUG select KERNEL_SLUB_DEBUG
@ -762,13 +643,16 @@ config KERNEL_CRASH_DUMP
config USE_RFKILL config USE_RFKILL
bool "Enable rfkill support" bool "Enable rfkill support"
default y if TARGET_rockchip
default RFKILL_SUPPORT default RFKILL_SUPPORT
config USE_SPARSE config USE_SPARSE
bool "Enable sparse check during kernel build" bool "Enable sparse check during kernel build"
default n
config KERNEL_DEVTMPFS config KERNEL_DEVTMPFS
bool "Compile the kernel with device tmpfs enabled" bool "Compile the kernel with device tmpfs enabled"
default n
help help
devtmpfs is a simple, kernel-managed /dev filesystem. The kernel creates devtmpfs is a simple, kernel-managed /dev filesystem. The kernel creates
devices nodes for all registered devices to simplify boot, but leaves more devices nodes for all registered devices to simplify boot, but leaves more
@ -778,6 +662,7 @@ if KERNEL_DEVTMPFS
config KERNEL_DEVTMPFS_MOUNT config KERNEL_DEVTMPFS_MOUNT
bool "Automatically mount devtmpfs after root filesystem is mounted" bool "Automatically mount devtmpfs after root filesystem is mounted"
default n
endif endif
@ -788,14 +673,17 @@ config KERNEL_KEYS
config KERNEL_PERSISTENT_KEYRINGS config KERNEL_PERSISTENT_KEYRINGS
bool "Enable kernel persistent keyrings" bool "Enable kernel persistent keyrings"
depends on KERNEL_KEYS depends on KERNEL_KEYS
default n
config KERNEL_KEYS_REQUEST_CACHE config KERNEL_KEYS_REQUEST_CACHE
bool "Enable temporary caching of the last request_key() result" bool "Enable temporary caching of the last request_key() result"
depends on KERNEL_KEYS depends on KERNEL_KEYS
default n
config KERNEL_BIG_KEYS config KERNEL_BIG_KEYS
bool "Enable large payload keys on kernel keyrings" bool "Enable large payload keys on kernel keyrings"
depends on KERNEL_KEYS depends on KERNEL_KEYS
default n
# #
# CGROUP support symbols # CGROUP support symbols
@ -809,6 +697,7 @@ if KERNEL_CGROUPS
config KERNEL_CGROUP_DEBUG config KERNEL_CGROUP_DEBUG
bool "Example debug cgroup subsystem" bool "Example debug cgroup subsystem"
default n
help help
This option enables a simple cgroup subsystem that This option enables a simple cgroup subsystem that
exports useful debugging information about the cgroups exports useful debugging information about the cgroups
@ -819,6 +708,7 @@ if KERNEL_CGROUPS
config KERNEL_CGROUP_FREEZER config KERNEL_CGROUP_FREEZER
bool "legacy Freezer cgroup subsystem" bool "legacy Freezer cgroup subsystem"
default n
select KERNEL_FREEZER select KERNEL_FREEZER
help help
Provides a way to freeze and unfreeze all tasks in a Provides a way to freeze and unfreeze all tasks in a
@ -828,6 +718,7 @@ if KERNEL_CGROUPS
config KERNEL_CGROUP_DEVICE config KERNEL_CGROUP_DEVICE
bool "legacy Device controller for cgroups" bool "legacy Device controller for cgroups"
default n
help help
Provides a cgroup implementing whitelists for devices which Provides a cgroup implementing whitelists for devices which
a process in the cgroup can mknod or open. a process in the cgroup can mknod or open.
@ -835,6 +726,7 @@ if KERNEL_CGROUPS
config KERNEL_CGROUP_HUGETLB config KERNEL_CGROUP_HUGETLB
bool "HugeTLB controller" bool "HugeTLB controller"
default n
select KERNEL_HUGETLB_PAGE select KERNEL_HUGETLB_PAGE
config KERNEL_CGROUP_PIDS config KERNEL_CGROUP_PIDS
@ -861,19 +753,9 @@ if KERNEL_CGROUPS
Memory Nodes and assigning tasks to run only within those sets. Memory Nodes and assigning tasks to run only within those sets.
This is primarily useful on large SMP or NUMA systems. This is primarily useful on large SMP or NUMA systems.
config KERNEL_CPUSETS_V1
bool "Legacy cgroup v1 cpusets controller"
depends on KERNEL_CPUSETS
default n
help
Legacy cgroup v1 cpusets controller which has been deprecated by
cgroup v2 implementation. The v1 is there for legacy applications
which haven't migrated to the new cgroup v2 interface yet. If you
do not have any such application then you are completely fine leaving
this option disabled.
config KERNEL_PROC_PID_CPUSET config KERNEL_PROC_PID_CPUSET
bool "Include legacy /proc/<pid>/cpuset file" bool "Include legacy /proc/<pid>/cpuset file"
default n
depends on KERNEL_CPUSETS depends on KERNEL_CPUSETS
config KERNEL_CGROUP_CPUACCT config KERNEL_CGROUP_CPUACCT
@ -939,6 +821,7 @@ if KERNEL_CGROUPS
config KERNEL_MEMCG_SWAP_ENABLED config KERNEL_MEMCG_SWAP_ENABLED
bool "Memory Resource Controller Swap Extension enabled by default" bool "Memory Resource Controller Swap Extension enabled by default"
default n
depends on KERNEL_MEMCG_SWAP depends on KERNEL_MEMCG_SWAP
help help
Memory Resource Controller Swap Extension comes with its price in Memory Resource Controller Swap Extension comes with its price in
@ -964,24 +847,10 @@ if KERNEL_CGROUPS
the kmem extension can use it to guarantee that no group of processes the kmem extension can use it to guarantee that no group of processes
will ever exhaust kernel resources alone. will ever exhaust kernel resources alone.
config KERNEL_MEMCG_V1
bool "Legacy cgroup v1 memory controller"
default n
depends on KERNEL_MEMCG
help
Legacy cgroup v1 memory controller which has been deprecated by
cgroup v2 implementation. The v1 is there for legacy applications
which haven't migrated to the new cgroup v2 interface yet. If you
do not have any such application then you are completely fine leaving
this option disabled.
Please note that feature set of the legacy memory controller is likely
going to shrink due to deprecation process. New deployments with v1
controller are highly discouraged.
config KERNEL_CGROUP_PERF config KERNEL_CGROUP_PERF
bool "Enable perf_event per-cpu per-container group (cgroup) monitoring" bool "Enable perf_event per-cpu per-container group (cgroup) monitoring"
select KERNEL_PERF_EVENTS select KERNEL_PERF_EVENTS
default n
help help
This option extends the per-cpu mode to restrict monitoring to This option extends the per-cpu mode to restrict monitoring to
threads which belong to the cgroup specified and run on the threads which belong to the cgroup specified and run on the
@ -1058,6 +927,7 @@ if KERNEL_CGROUPS
config KERNEL_DEBUG_BLK_CGROUP config KERNEL_DEBUG_BLK_CGROUP
bool "Enable Block IO controller debugging" bool "Enable Block IO controller debugging"
default n
depends on KERNEL_BLK_CGROUP depends on KERNEL_BLK_CGROUP
help help
Enable some debugging help. Currently it exports additional stat Enable some debugging help. Currently it exports additional stat
@ -1065,12 +935,15 @@ if KERNEL_CGROUPS
config KERNEL_NET_CLS_CGROUP config KERNEL_NET_CLS_CGROUP
bool "legacy Control Group Classifier" bool "legacy Control Group Classifier"
default n
config KERNEL_CGROUP_NET_CLASSID config KERNEL_CGROUP_NET_CLASSID
bool "legacy Network classid cgroup" bool "legacy Network classid cgroup"
default n
config KERNEL_CGROUP_NET_PRIO config KERNEL_CGROUP_NET_PRIO
bool "legacy Network priority cgroup" bool "legacy Network priority cgroup"
default n
endif endif
@ -1232,17 +1105,9 @@ endif
config KERNEL_NET_L3_MASTER_DEV config KERNEL_NET_L3_MASTER_DEV
bool "L3 Master device support" bool "L3 Master device support"
default y if !SMALL_FLASH
help help
This module provides glue between core networking code and device This module provides glue between core networking code and device
drivers to support L3 master devices like VRF. 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 config KERNEL_PAGE_POOL
def_bool n def_bool n
@ -1250,20 +1115,7 @@ config KERNEL_PAGE_POOL
config KERNEL_PAGE_POOL_STATS config KERNEL_PAGE_POOL_STATS
bool "Page pool stats support" bool "Page pool stats support"
depends on KERNEL_PAGE_POOL depends on KERNEL_PAGE_POOL
depends on !(LINUX_5_4||LINUX_5_10)
config KERNEL_MPTCP
bool "Multi-Path TCP support"
default y if !SMALL_FLASH
help
Select this option to enable support for Multi-Path TCP.
Increases the compressed kernel size by ~214kB (as of Linux 6.6).
if KERNEL_IPV6
config KERNEL_MPTCP_IPV6
bool "IPv6 support for Multipath TCP"
depends on KERNEL_MPTCP
default KERNEL_MPTCP
endif
# #
# NFS related symbols # NFS related symbols
@ -1299,20 +1151,14 @@ if KERNEL_IP_PNP
endif endif
config KERNEL_BTRFS_FS
bool "Compile the kernel with built-in BTRFS support"
help
Say Y here if you want to make the kernel to be able to boot off a
BTRFS partition.
menu "Filesystem ACL and attr support options" menu "Filesystem ACL and attr support options"
config USE_FS_ACL_ATTR config USE_FS_ACL_ATTR
bool "Use filesystem ACL and attr support by default" bool "Use filesystem ACL and attr support by default"
default y if !SMALL_FLASH default n
help help
Make using ACLs (e.g. POSIX ACL, NFSv4 ACL) the default Make using ACLs (e.g. POSIX ACL, NFSv4 ACL) the default
for kernel and packages, except old NFS. for kernel and packages, except tmpfs, flash filesystems,
Also enable userspace extended attribute support and old NFS. Also enable userspace extended attribute support
by default. (OpenWrt already has an expection it will be by default. (OpenWrt already has an expection it will be
present in the kernel). present in the kernel).
@ -1333,17 +1179,17 @@ menu "Filesystem ACL and attr support options"
config KERNEL_F2FS_FS_POSIX_ACL config KERNEL_F2FS_FS_POSIX_ACL
bool "Enable POSIX ACL for F2FS Filesystems" bool "Enable POSIX ACL for F2FS Filesystems"
select KERNEL_FS_POSIX_ACL select KERNEL_FS_POSIX_ACL
default y if USE_FS_ACL_ATTR default n
config KERNEL_JFFS2_FS_POSIX_ACL config KERNEL_JFFS2_FS_POSIX_ACL
bool "Enable POSIX ACL for JFFS2 Filesystems" bool "Enable POSIX ACL for JFFS2 Filesystems"
select KERNEL_FS_POSIX_ACL select KERNEL_FS_POSIX_ACL
default y if USE_FS_ACL_ATTR default n
config KERNEL_TMPFS_POSIX_ACL config KERNEL_TMPFS_POSIX_ACL
bool "Enable POSIX ACL for TMPFS Filesystems" bool "Enable POSIX ACL for TMPFS Filesystems"
select KERNEL_FS_POSIX_ACL select KERNEL_FS_POSIX_ACL
default y if USE_FS_ACL_ATTR default n
config KERNEL_CIFS_ACL config KERNEL_CIFS_ACL
bool "Enable CIFS ACLs" bool "Enable CIFS ACLs"
@ -1366,12 +1212,15 @@ menu "Filesystem ACL and attr support options"
config KERNEL_NFS_V3_ACL_SUPPORT config KERNEL_NFS_V3_ACL_SUPPORT
bool "Enable ACLs for NFSv3" bool "Enable ACLs for NFSv3"
default n
config KERNEL_NFSD_V2_ACL_SUPPORT config KERNEL_NFSD_V2_ACL_SUPPORT
bool "Enable ACLs for NFSDv2" bool "Enable ACLs for NFSDv2"
default n
config KERNEL_NFSD_V3_ACL_SUPPORT config KERNEL_NFSD_V3_ACL_SUPPORT
bool "Enable ACLs for NFSDv3" bool "Enable ACLs for NFSDv3"
default n
config KERNEL_REISER_FS_POSIX_ACL config KERNEL_REISER_FS_POSIX_ACL
bool "Enable POSIX ACLs for ReiserFS" bool "Enable POSIX ACLs for ReiserFS"
@ -1480,30 +1329,12 @@ config KERNEL_LSM
config KERNEL_EXT4_FS_SECURITY config KERNEL_EXT4_FS_SECURITY
bool "Ext4 Security Labels" bool "Ext4 Security Labels"
default y if !SMALL_FLASH
config KERNEL_F2FS_FS_SECURITY config KERNEL_F2FS_FS_SECURITY
bool "F2FS Security Labels" bool "F2FS Security Labels"
default y if !SMALL_FLASH
config KERNEL_UBIFS_FS_SECURITY config KERNEL_UBIFS_FS_SECURITY
bool "UBIFS Security Labels" bool "UBIFS Security Labels"
default y if !SMALL_FLASH
config KERNEL_JFFS2_FS_SECURITY config KERNEL_JFFS2_FS_SECURITY
bool "JFFS2 Security Labels" bool "JFFS2 Security Labels"
default y if !SMALL_FLASH
config KERNEL_WERROR
bool "Compile the kernel with warnings as errors"
help
A kernel build should not cause any compiler warnings, and this
enables the '-Werror' (for C) and '-Dwarnings' (for Rust) flags
to enforce that rule by default. Certain warnings from other tools
such as the linker may be upgraded to errors with this option as
well.
However, if you have a new (or very old) compiler or linker with odd
and unusual warnings, or you have some architecture with problems,
you may need to disable this config option in order to
successfully build the kernel.

View File

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 126 KiB

View File

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

View File

@ -23,8 +23,7 @@ AM_TOOL_PATHS:= \
LIBTOOLIZE=$(STAGING_DIR_HOST)/bin/libtoolize \ LIBTOOLIZE=$(STAGING_DIR_HOST)/bin/libtoolize \
LIBTOOL=$(STAGING_DIR_HOST)/bin/libtool \ LIBTOOL=$(STAGING_DIR_HOST)/bin/libtool \
M4=$(STAGING_DIR_HOST)/bin/m4 \ M4=$(STAGING_DIR_HOST)/bin/m4 \
AUTOPOINT=true \ AUTOPOINT=true
GTKDOCIZE=true
# 1: build dir # 1: build dir
# 2: remove files # 2: remove files

View File

@ -34,25 +34,18 @@ include $(INCLUDE_DIR)/autotools.mk
_host_target:=$(if $(HOST_QUILT),,.) _host_target:=$(if $(HOST_QUILT),,.)
Host/Patch:=$(Host/Patch/Default) Host/Patch:=$(Host/Patch/Default)
define Host/Prepare/Default ifneq ($(strip $(HOST_UNPACK)),)
$(if $(strip $(HOST_UNPACK)),$(HOST_UNPACK)) define Host/Prepare/Default
$(HOST_UNPACK)
[ ! -d ./src/ ] || $(CP) ./src/* $(HOST_BUILD_DIR) [ ! -d ./src/ ] || $(CP) ./src/* $(HOST_BUILD_DIR)
$(Host/Patch) $(Host/Patch)
endef endef
endif
define Host/Prepare define Host/Prepare
$(call Host/Prepare/Default) $(call Host/Prepare/Default)
endef endef
define Host/Gnulib/Prepare
$(STAGING_DIR_HOST)/bin/gnulib-tool \
--local-dir=$(STAGING_DIR_HOST)/share/gnulib \
--source-base=$(PKG_GNULIB_BASE) \
$(PKG_GNULIB_ARGS) \
$(PKG_GNULIB_MODS) \
;
endef
HOST_CONFIGURE_VARS = \ HOST_CONFIGURE_VARS = \
CC="$(HOSTCC)" \ CC="$(HOSTCC)" \
CFLAGS="$(HOST_CFLAGS)" \ CFLAGS="$(HOST_CFLAGS)" \
@ -116,10 +109,6 @@ define Host/Compile
$(call Host/Compile/Default) $(call Host/Compile/Default)
endef endef
define Host/Gnulib/Compile
$(call Host/Compile/Default,SUBDIRS='$$$$(wildcard $(PKG_GNULIB_BASE))')
endef
define Host/Install/Default define Host/Install/Default
$(call Host/Compile/Default,install) $(call Host/Compile/Default,install)
endef endef

View File

@ -300,7 +300,7 @@ define Build/fit
$(if $(DEVICE_FDT_NUM),-n $(DEVICE_FDT_NUM)) \ $(if $(DEVICE_FDT_NUM),-n $(DEVICE_FDT_NUM)) \
$(if $(DEVICE_DTS_DELIMITER),-l $(DEVICE_DTS_DELIMITER)) \ $(if $(DEVICE_DTS_DELIMITER),-l $(DEVICE_DTS_DELIMITER)) \
$(if $(DEVICE_DTS_LOADADDR),-s $(DEVICE_DTS_LOADADDR)) \ $(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") \ -c $(if $(DEVICE_DTS_CONFIG),$(DEVICE_DTS_CONFIG),"config-1") \
-A $(LINUX_KARCH) -v $(LINUX_VERSION) -A $(LINUX_KARCH) -v $(LINUX_VERSION)
PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage $(if $(findstring external,$(word 3,$(1))),\ PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage $(if $(findstring external,$(word 3,$(1))),\
@ -581,7 +581,6 @@ define Build/tplink-v2-image
endef endef
define Build/uImage define Build/uImage
$(if $(UIMAGE_TIME),SOURCE_DATE_EPOCH="$(UIMAGE_TIME)") \
mkimage \ mkimage \
-A $(LINUX_KARCH) \ -A $(LINUX_KARCH) \
-O linux \ -O linux \

View File

@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-only # SPDX-License-Identifier: GPL-2.0-only
# #
# Copyright (C) 2006-2020 LEDE.org # Copyright (C) 2006-2020 OpenWrt.org
override TARGET_BUILD= override TARGET_BUILD=
include $(INCLUDE_DIR)/prereq.mk include $(INCLUDE_DIR)/prereq.mk
@ -146,7 +146,7 @@ endif
# Disable noisy checks by default as in upstream # Disable noisy checks by default as in upstream
DTC_WARN_FLAGS := \ DTC_FLAGS += \
-Wno-unit_address_vs_reg \ -Wno-unit_address_vs_reg \
-Wno-simple_bus_reg \ -Wno-simple_bus_reg \
-Wno-unit_address_format \ -Wno-unit_address_format \
@ -159,9 +159,6 @@ DTC_WARN_FLAGS := \
-Wno-graph_port \ -Wno-graph_port \
-Wno-unique_unit_address -Wno-unique_unit_address
DTC_FLAGS += $(DTC_WARN_FLAGS)
DTCO_FLAGS += $(DTC_WARN_FLAGS)
define Image/pad-to define Image/pad-to
dd if=$(1) of=$(1).new bs=$(2) conv=sync dd if=$(1) of=$(1).new bs=$(2) conv=sync
mv $(1).new $(1) mv $(1).new $(1)
@ -177,30 +174,21 @@ endef
# $(2) target dtb file # $(2) target dtb file
# $(3) extra CPP flags # $(3) extra CPP flags
# $(4) extra DTC flags # $(4) extra DTC flags
define Image/BuildDTB/sub define Image/BuildDTB
$(TARGET_CROSS)cpp -nostdinc -x assembler-with-cpp \ $(TARGET_CROSS)cpp -nostdinc -x assembler-with-cpp \
$(DTS_CPPFLAGS) \ $(DTS_CPPFLAGS) \
-I$(DTS_DIR) \ -I$(DTS_DIR) \
-I$(DTS_DIR)/include \ -I$(DTS_DIR)/include \
-I$(LINUX_DIR)/include/ \ -I$(LINUX_DIR)/include/ \
-I$(LINUX_DIR)/scripts/dtc/include-prefixes \
-undef -D__DTS__ $(3) \ -undef -D__DTS__ $(3) \
-o $(2).tmp $(1) -o $(2).tmp $(1)
$(LINUX_DIR)/scripts/dtc/dtc -O dtb \ $(LINUX_DIR)/scripts/dtc/dtc -O dtb \
-i$(dir $(1)) $(4) \ -i$(dir $(1)) $(DTC_FLAGS) $(4) \
$(if $(CONFIG_HAS_DT_OVERLAY_SUPPORT),-@) \ $(if $(CONFIG_HAS_DT_OVERLAY_SUPPORT),-@) \
-o $(2) $(2).tmp -o $(2) $(2).tmp
$(RM) $(2).tmp $(RM) $(2).tmp
endef endef
define Image/BuildDTB
$(call Image/BuildDTB/sub,$(1),$(2),$(3),$(DTC_FLAGS) $(DEVICE_DTC_FLAGS) $(4))
endef
define Image/BuildDTBO
$(call Image/BuildDTB/sub,$(1),$(2),$(3),$(DTCO_FLAGS) $(DEVICE_DTCO_FLAGS) $(4))
endef
define Image/mkfs/jffs2/sub-raw define Image/mkfs/jffs2/sub-raw
$(STAGING_DIR_HOST)/bin/mkfs.jffs2 \ $(STAGING_DIR_HOST)/bin/mkfs.jffs2 \
$(2) \ $(2) \
@ -412,14 +400,11 @@ define Device/Init
DEVICE_DTS_LOADADDR := DEVICE_DTS_LOADADDR :=
DEVICE_DTS_OVERLAY := DEVICE_DTS_OVERLAY :=
DEVICE_FDT_NUM := DEVICE_FDT_NUM :=
DEVICE_DTC_FLAGS :=
DEVICE_DTCO_FLAGS :=
SOC := SOC :=
BOARD_NAME := BOARD_NAME :=
UIMAGE_MAGIC := UIMAGE_MAGIC :=
UIMAGE_NAME := UIMAGE_NAME :=
UIMAGE_TIME :=
DEVICE_COMPAT_VERSION := 1.0 DEVICE_COMPAT_VERSION := 1.0
DEVICE_COMPAT_MESSAGE := DEVICE_COMPAT_MESSAGE :=
SUPPORTED_DEVICES := $(subst _,$(comma),$(1)) SUPPORTED_DEVICES := $(subst _,$(comma),$(1))
@ -436,11 +421,11 @@ endef
DEFAULT_DEVICE_VARS := \ DEFAULT_DEVICE_VARS := \
DEVICE_NAME KERNEL KERNEL_INITRAMFS KERNEL_INITRAMFS_IMAGE KERNEL_SIZE \ DEVICE_NAME KERNEL KERNEL_INITRAMFS KERNEL_INITRAMFS_IMAGE KERNEL_SIZE \
CMDLINE UBOOTENV_IN_UBI KERNEL_IN_UBI BLOCKSIZE PAGESIZE SUBPAGESIZE \ CMDLINE UBOOTENV_IN_UBI KERNEL_IN_UBI BLOCKSIZE PAGESIZE SUBPAGESIZE \
VID_HDR_OFFSET UBINIZE_OPTS UBINIZE_PARTS MKUBIFS_OPTS DEVICE_DTC_FLAGS \ VID_HDR_OFFSET UBINIZE_OPTS UBINIZE_PARTS MKUBIFS_OPTS DEVICE_DTS \
DEVICE_DTCO_FLAGS DEVICE_DTS DEVICE_DTS_CONFIG DEVICE_DTS_DELIMITER \ DEVICE_DTS_CONFIG DEVICE_DTS_DELIMITER DEVICE_DTS_DIR DEVICE_DTS_OVERLAY \
DEVICE_DTS_DIR DEVICE_DTS_OVERLAY DEVICE_DTS_LOADADDR \ DEVICE_DTS_LOADADDR \
DEVICE_FDT_NUM DEVICE_IMG_PREFIX SOC BOARD_NAME UIMAGE_MAGIC UIMAGE_NAME \ DEVICE_FDT_NUM DEVICE_IMG_PREFIX SOC BOARD_NAME UIMAGE_MAGIC UIMAGE_NAME \
UIMAGE_TIME SUPPORTED_DEVICES IMAGE_METADATA KERNEL_ENTRY KERNEL_LOADADDR \ SUPPORTED_DEVICES IMAGE_METADATA KERNEL_ENTRY KERNEL_LOADADDR \
UBOOT_PATH IMAGE_SIZE \ UBOOT_PATH IMAGE_SIZE \
FACTORY_IMG_NAME FACTORY_SIZE \ FACTORY_IMG_NAME FACTORY_SIZE \
DEVICE_PACKAGES DEVICE_COMPAT_VERSION DEVICE_COMPAT_MESSAGE \ DEVICE_PACKAGES DEVICE_COMPAT_VERSION DEVICE_COMPAT_MESSAGE \
@ -502,9 +487,6 @@ define Device/Build/initramfs
$(KDIR)/$$(KERNEL_INITRAMFS_NAME):: image_prepare $(KDIR)/$$(KERNEL_INITRAMFS_NAME):: image_prepare
$(1)-images: $$(if $$(KERNEL_INITRAMFS),$(BIN_DIR)/$$(KERNEL_INITRAMFS_IMAGE)) $(1)-images: $$(if $$(KERNEL_INITRAMFS),$(BIN_DIR)/$$(KERNEL_INITRAMFS_IMAGE))
.IGNORE: $(BIN_DIR)/$$(KERNEL_INITRAMFS_IMAGE)
$(BIN_DIR)/$$(KERNEL_INITRAMFS_IMAGE): $(KDIR)/tmp/$$(KERNEL_INITRAMFS_IMAGE) $(BIN_DIR)/$$(KERNEL_INITRAMFS_IMAGE): $(KDIR)/tmp/$$(KERNEL_INITRAMFS_IMAGE)
cp $$^ $$@ cp $$^ $$@
@ -568,36 +550,19 @@ define Device/Build/dtb
$(KDIR)/image-$(1).dtb: FORCE $(KDIR)/image-$(1).dtb: FORCE
$(call Image/BuildDTB,$(strip $(2))/$(strip $(3)).dts,$$@) $(call Image/BuildDTB,$(strip $(2))/$(strip $(3)).dts,$$@)
compile-dtb: $(KDIR)/image-$(1).dtb image_prepare: $(KDIR)/image-$(1).dtb
endif
endef
define Device/Build/dtbo
ifndef BUILD_DTSO_$(1)
BUILD_DTSO_$(1) := 1
$(KDIR)/image-$(1).dtbo: FORCE
$(call Image/BuildDTBO,$(strip $(2))/$(strip $(3)).dtso,$$@)
compile-dtb: $(KDIR)/image-$(1).dtbo
endif endif
endef endef
endif endif
define Device/Build/kernel define Device/Build/kernel
$$(eval $$(foreach dts,$$(DEVICE_DTS), \ $$(eval $$(foreach dts,$$(DEVICE_DTS) $$(DEVICE_DTS_OVERLAY), \
$$(call Device/Build/dtb,$$(notdir $$(dts)), \ $$(call Device/Build/dtb,$$(notdir $$(dts)), \
$$(if $$(DEVICE_DTS_DIR),$$(DEVICE_DTS_DIR),$$(DTS_DIR)), \ $$(if $$(DEVICE_DTS_DIR),$$(DEVICE_DTS_DIR),$$(DTS_DIR)), \
$$(dts) \ $$(dts) \
) \ ) \
)) ))
$$(eval $$(foreach dtso,$$(DEVICE_DTS_OVERLAY), \
$$(call Device/Build/dtbo,$$(notdir $$(dtso)), \
$$(if $$(DEVICE_DTS_DIR),$$(DEVICE_DTS_DIR),$$(DTS_DIR)), \
$$(dtso) \
) \
))
$(KDIR)/$$(KERNEL_NAME):: image_prepare $(KDIR)/$$(KERNEL_NAME):: image_prepare
$$(_TARGET): $$(if $$(KERNEL_INSTALL),$(BIN_DIR)/$$(KERNEL_IMAGE)) $$(_TARGET): $$(if $$(KERNEL_INSTALL),$(BIN_DIR)/$$(KERNEL_IMAGE))
@ -816,20 +781,18 @@ define BuildImage
download: download:
prepare: prepare:
compile: compile:
compile-dtb:
clean: clean:
image_prepare: image_prepare:
ifeq ($(IB),) ifeq ($(IB),)
.PHONY: download prepare compile compile-dtb clean image_prepare kernel_prepare install install-images .PHONY: download prepare compile clean image_prepare kernel_prepare install install-images
compile: compile:
$(call Build/Compile) $(call Build/Compile)
clean: clean:
$(call Build/Clean) $(call Build/Clean)
compile-dtb: image_prepare: compile
image_prepare: compile compile-dtb
mkdir -p $(BIN_DIR) $(KDIR)/tmp mkdir -p $(BIN_DIR) $(KDIR)/tmp
rm -rf $(BUILD_DIR)/json_info_files rm -rf $(BUILD_DIR)/json_info_files
$(call Image/Prepare) $(call Image/Prepare)

View File

@ -1,2 +1,2 @@
LINUX_VERSION-5.10 = .236 LINUX_VERSION-5.10 = .176
LINUX_KERNEL_HASH-5.10.236 = 6da5cc8f7d39ed3acb4d59129a3f1570d981526ebbf58ea82595b7b6e000fb89 LINUX_KERNEL_HASH-5.10.176 = ce072c60ba04173e05b2a1de3fefdeba5ac8b28b1958d92d21bdbf9b736ef793

View File

@ -1,2 +1,2 @@
LINUX_VERSION-5.15 = .180 LINUX_VERSION-5.15 = .104
LINUX_KERNEL_HASH-5.15.180 = f51f68b8bbe60aca5e1ff3781f7e5d2ca6a31dd299c8446c39bf880bfff1cd39 LINUX_KERNEL_HASH-5.15.104 = 71c532ce09992e470f3259ffeb38d2b5bba990c243a559e4726a57412bd36b54

View File

@ -1,2 +1,2 @@
LINUX_VERSION-5.4 = .292 LINUX_VERSION-5.4 = .238
LINUX_KERNEL_HASH-5.4.292 = 0bcbf580d1ea623ac5879d0f2d69796c82431b3f653c4749e63766dbf737be85 LINUX_KERNEL_HASH-5.4.238 = 70a2b2da85598eba6a73cdc0749e441cbdf3011d9babcb7028a46aa8d98aa91f

View File

@ -1,2 +1,2 @@
LINUX_VERSION-6.1 = .134 LINUX_VERSION-6.1 = .22
LINUX_KERNEL_HASH-6.1.134 = 60c70cdd70ddee384c004242e67844e3dd1fe28f75b26b3586859fff0a07bd23 LINUX_KERNEL_HASH-6.1.22 = 2be89141cef74d0e5a55540d203eb8010dfddb3c82d617e66b058f20b19cfda8

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

@ -156,10 +156,6 @@ define BuildKernel
compile: $(LINUX_DIR)/.modules compile: $(LINUX_DIR)/.modules
$(MAKE) -C image compile TARGET_BUILD= $(MAKE) -C image compile TARGET_BUILD=
dtb: $(STAMP_CONFIGURED)
$(_SINGLE)$(KERNEL_MAKE) scripts_dtc
$(MAKE) -C image compile-dtb TARGET_BUILD=
oldconfig menuconfig nconfig xconfig: $(STAMP_PREPARED) $(STAMP_CHECKED) FORCE oldconfig menuconfig nconfig xconfig: $(STAMP_PREPARED) $(STAMP_CHECKED) FORCE
rm -f $(LINUX_DIR)/.config.prev rm -f $(LINUX_DIR)/.config.prev
rm -f $(STAMP_CONFIGURED) rm -f $(STAMP_CONFIGURED)

View File

@ -75,7 +75,6 @@ endif
rm -f $(LINUX_DIR)/.config.prev rm -f $(LINUX_DIR)/.config.prev
mv $(LINUX_DIR)/.config $(LINUX_DIR)/.config.old mv $(LINUX_DIR)/.config $(LINUX_DIR)/.config.old
$(call Kernel/SetInitramfs/PreConfigure) $(call Kernel/SetInitramfs/PreConfigure)
echo "# CONFIG_INITRAMFS_PRESERVE_MTIME is not set" >> $(LINUX_DIR)/.config
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS_SEPARATE),y) ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS_SEPARATE),y)
echo 'CONFIG_INITRAMFS_ROOT_UID=$(shell id -u)' >> $(LINUX_DIR)/.config echo 'CONFIG_INITRAMFS_ROOT_UID=$(shell id -u)' >> $(LINUX_DIR)/.config
echo 'CONFIG_INITRAMFS_ROOT_GID=$(shell id -g)' >> $(LINUX_DIR)/.config echo 'CONFIG_INITRAMFS_ROOT_GID=$(shell id -g)' >> $(LINUX_DIR)/.config
@ -100,7 +99,6 @@ define Kernel/SetNoInitramfs
grep -v INITRAMFS $(LINUX_DIR)/.config.old > $(LINUX_DIR)/.config.set grep -v INITRAMFS $(LINUX_DIR)/.config.old > $(LINUX_DIR)/.config.set
echo 'CONFIG_INITRAMFS_SOURCE=""' >> $(LINUX_DIR)/.config.set echo 'CONFIG_INITRAMFS_SOURCE=""' >> $(LINUX_DIR)/.config.set
echo '# CONFIG_INITRAMFS_FORCE is not set' >> $(LINUX_DIR)/.config.set echo '# CONFIG_INITRAMFS_FORCE is not set' >> $(LINUX_DIR)/.config.set
echo "# CONFIG_INITRAMFS_PRESERVE_MTIME is not set" >> $(LINUX_DIR)/.config.set
endef endef
define Kernel/Configure/Default define Kernel/Configure/Default

View File

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

View File

@ -86,14 +86,10 @@ else ifneq (,$(findstring $(ARCH) , arceb ))
LINUX_KARCH := arc LINUX_KARCH := arc
else ifneq (,$(findstring $(ARCH) , armeb )) else ifneq (,$(findstring $(ARCH) , armeb ))
LINUX_KARCH := arm LINUX_KARCH := arm
else ifneq (,$(findstring $(ARCH) , loongarch64 ))
LINUX_KARCH := loongarch
else ifneq (,$(findstring $(ARCH) , mipsel mips64 mips64el )) else ifneq (,$(findstring $(ARCH) , mipsel mips64 mips64el ))
LINUX_KARCH := mips LINUX_KARCH := mips
else ifneq (,$(findstring $(ARCH) , powerpc64 )) else ifneq (,$(findstring $(ARCH) , powerpc64 ))
LINUX_KARCH := powerpc LINUX_KARCH := powerpc
else ifneq (,$(findstring $(ARCH) , riscv64 ))
LINUX_KARCH := riscv
else ifneq (,$(findstring $(ARCH) , sh2 sh3 sh4 )) else ifneq (,$(findstring $(ARCH) , sh2 sh3 sh4 ))
LINUX_KARCH := sh LINUX_KARCH := sh
else ifneq (,$(findstring $(ARCH) , i386 x86_64 )) else ifneq (,$(findstring $(ARCH) , i386 x86_64 ))
@ -238,7 +234,7 @@ $(call KernelPackage/$(1)/config)
$(call KernelPackage/depends) $(call KernelPackage/depends)
$(call KernelPackage/hooks) $(call KernelPackage/hooks)
ifneq ($(if $(filter-out %=y %=n %=m,$(KCONFIG)),$(filter m y,$(foreach c,$(call version_filter,$(filter-out %=y %=n %=m,$(KCONFIG))),$($(c)))),.),) ifneq ($(if $(filter-out %=y %=n %=m,$(KCONFIG)),$(filter m y,$(foreach c,$(filter-out %=y %=n %=m,$(KCONFIG)),$($(c)))),.),)
define Package/kmod-$(1)/install define Package/kmod-$(1)/install
@for mod in $$(call version_filter,$$(FILES)); do \ @for mod in $$(call version_filter,$$(FILES)); do \
if grep -q "$$$$$$$${mod##$(LINUX_DIR)/}" "$(LINUX_DIR)/modules.builtin"; then \ if grep -q "$$$$$$$${mod##$(LINUX_DIR)/}" "$(LINUX_DIR)/modules.builtin"; then \

View File

@ -55,14 +55,8 @@ else
MESON_CPU:="$(CPU_TYPE)$(if $(CPU_SUBTYPE),+$(CPU_SUBTYPE))" MESON_CPU:="$(CPU_TYPE)$(if $(CPU_SUBTYPE),+$(CPU_SUBTYPE))"
endif endif
ifeq ($(MESON_USE_STAGING_PYTHON),)
PYTHON_BIN:=$(STAGING_DIR_HOST)/bin/$(PYTHON)
else
PYTHON_BIN:=$(STAGING_DIR_HOSTPKG)/bin/$(PYTHON)
endif
define Meson define Meson
$(2) $(PYTHON_BIN) $(STAGING_DIR_HOST)/bin/meson.py $(1) $(2) $(STAGING_DIR_HOST)/bin/$(PYTHON) $(STAGING_DIR_HOST)/bin/meson.py $(1)
endef endef
define Meson/CreateNativeFile define Meson/CreateNativeFile
@ -71,7 +65,7 @@ define Meson/CreateNativeFile
-e "s|@CXX@|$(foreach BIN,$(HOSTCXX),'$(BIN)',)|" \ -e "s|@CXX@|$(foreach BIN,$(HOSTCXX),'$(BIN)',)|" \
-e "s|@PKGCONFIG@|$(PKG_CONFIG)|" \ -e "s|@PKGCONFIG@|$(PKG_CONFIG)|" \
-e "s|@CMAKE@|$(STAGING_DIR_HOST)/bin/cmake|" \ -e "s|@CMAKE@|$(STAGING_DIR_HOST)/bin/cmake|" \
-e "s|@PYTHON@|$(PYTHON_BIN)|" \ -e "s|@PYTHON@|$(STAGING_DIR_HOST)/bin/python3|" \
-e "s|@CFLAGS@|$(foreach FLAG,$(HOST_CFLAGS) $(HOST_CPPFLAGS),'$(FLAG)',)|" \ -e "s|@CFLAGS@|$(foreach FLAG,$(HOST_CFLAGS) $(HOST_CPPFLAGS),'$(FLAG)',)|" \
-e "s|@CXXFLAGS@|$(foreach FLAG,$(HOST_CXXFLAGS) $(HOST_CPPFLAGS),'$(FLAG)',)|" \ -e "s|@CXXFLAGS@|$(foreach FLAG,$(HOST_CXXFLAGS) $(HOST_CPPFLAGS),'$(FLAG)',)|" \
-e "s|@LDFLAGS@|$(foreach FLAG,$(HOST_LDFLAGS),'$(FLAG)',)|" \ -e "s|@LDFLAGS@|$(foreach FLAG,$(HOST_LDFLAGS),'$(FLAG)',)|" \
@ -84,13 +78,12 @@ define Meson/CreateCrossFile
$(STAGING_DIR_HOST)/bin/sed \ $(STAGING_DIR_HOST)/bin/sed \
-e "s|@CC@|$(foreach BIN,$(TARGET_CC),'$(BIN)',)|" \ -e "s|@CC@|$(foreach BIN,$(TARGET_CC),'$(BIN)',)|" \
-e "s|@CXX@|$(foreach BIN,$(TARGET_CXX),'$(BIN)',)|" \ -e "s|@CXX@|$(foreach BIN,$(TARGET_CXX),'$(BIN)',)|" \
-e "s|@LD@|$(foreach FLAG,$(TARGET_LINKER),'$(FLAG)',)|" \
-e "s|@AR@|$(TARGET_AR)|" \ -e "s|@AR@|$(TARGET_AR)|" \
-e "s|@STRIP@|$(TARGET_CROSS)strip|" \ -e "s|@STRIP@|$(TARGET_CROSS)strip|" \
-e "s|@NM@|$(TARGET_NM)|" \ -e "s|@NM@|$(TARGET_NM)|" \
-e "s|@PKGCONFIG@|$(PKG_CONFIG)|" \ -e "s|@PKGCONFIG@|$(PKG_CONFIG)|" \
-e "s|@CMAKE@|$(STAGING_DIR_HOST)/bin/cmake|" \ -e "s|@CMAKE@|$(STAGING_DIR_HOST)/bin/cmake|" \
-e "s|@PYTHON@|$(PYTHON_BIN)|" \ -e "s|@PYTHON@|$(STAGING_DIR_HOST)/bin/python3|" \
-e "s|@CFLAGS@|$(foreach FLAG,$(TARGET_CFLAGS) $(EXTRA_CFLAGS) $(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS),'$(FLAG)',)|" \ -e "s|@CFLAGS@|$(foreach FLAG,$(TARGET_CFLAGS) $(EXTRA_CFLAGS) $(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS),'$(FLAG)',)|" \
-e "s|@CXXFLAGS@|$(foreach FLAG,$(TARGET_CXXFLAGS) $(EXTRA_CXXFLAGS) $(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS),'$(FLAG)',)|" \ -e "s|@CXXFLAGS@|$(foreach FLAG,$(TARGET_CXXFLAGS) $(EXTRA_CXXFLAGS) $(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS),'$(FLAG)',)|" \
-e "s|@LDFLAGS@|$(foreach FLAG,$(TARGET_LDFLAGS) $(EXTRA_LDFLAGS),'$(FLAG)',)|" \ -e "s|@LDFLAGS@|$(foreach FLAG,$(TARGET_LDFLAGS) $(EXTRA_LDFLAGS),'$(FLAG)',)|" \
@ -104,9 +97,7 @@ endef
define Host/Configure/Meson define Host/Configure/Meson
$(call Meson/CreateNativeFile,$(HOST_BUILD_DIR)/openwrt-native.txt) $(call Meson/CreateNativeFile,$(HOST_BUILD_DIR)/openwrt-native.txt)
$(call Meson, \ $(call Meson, \
setup \
--native-file $(HOST_BUILD_DIR)/openwrt-native.txt \ --native-file $(HOST_BUILD_DIR)/openwrt-native.txt \
-Ddefault_library=static \
$(MESON_HOST_ARGS) \ $(MESON_HOST_ARGS) \
$(MESON_HOST_BUILD_DIR) \ $(MESON_HOST_BUILD_DIR) \
$(MESON_HOST_BUILD_DIR)/.., \ $(MESON_HOST_BUILD_DIR)/.., \
@ -114,7 +105,7 @@ define Host/Configure/Meson
endef endef
define Host/Compile/Meson define Host/Compile/Meson
+$(MESON_HOST_VARS) $(NINJA) -C $(MESON_HOST_BUILD_DIR) $(1) +$(NINJA) -C $(MESON_HOST_BUILD_DIR) $(1)
endef endef
define Host/Install/Meson define Host/Install/Meson
@ -129,11 +120,9 @@ define Build/Configure/Meson
$(call Meson/CreateNativeFile,$(PKG_BUILD_DIR)/openwrt-native.txt) $(call Meson/CreateNativeFile,$(PKG_BUILD_DIR)/openwrt-native.txt)
$(call Meson/CreateCrossFile,$(PKG_BUILD_DIR)/openwrt-cross.txt) $(call Meson/CreateCrossFile,$(PKG_BUILD_DIR)/openwrt-cross.txt)
$(call Meson, \ $(call Meson, \
setup \ --buildtype plain \
--buildtype $(if $(CONFIG_DEBUG),debug,plain) \
--native-file $(PKG_BUILD_DIR)/openwrt-native.txt \ --native-file $(PKG_BUILD_DIR)/openwrt-native.txt \
--cross-file $(PKG_BUILD_DIR)/openwrt-cross.txt \ --cross-file $(PKG_BUILD_DIR)/openwrt-cross.txt \
-Ddefault_library=both \
$(MESON_ARGS) \ $(MESON_ARGS) \
$(MESON_BUILD_DIR) \ $(MESON_BUILD_DIR) \
$(MESON_BUILD_DIR)/.., \ $(MESON_BUILD_DIR)/.., \
@ -141,7 +130,7 @@ define Build/Configure/Meson
endef endef
define Build/Compile/Meson define Build/Compile/Meson
+$(MESON_VARS) $(NINJA) -C $(MESON_BUILD_DIR) $(1) +$(NINJA) -C $(MESON_BUILD_DIR) $(1)
endef endef
define Build/Install/Meson define Build/Install/Meson

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

@ -11,6 +11,8 @@ include $(INCLUDE_DIR)/download.mk
PKG_BUILD_DIR ?= $(BUILD_DIR)/$(if $(BUILD_VARIANT),$(PKG_NAME)-$(BUILD_VARIANT)/)$(PKG_NAME)$(if $(PKG_VERSION),-$(PKG_VERSION)) PKG_BUILD_DIR ?= $(BUILD_DIR)/$(if $(BUILD_VARIANT),$(PKG_NAME)-$(BUILD_VARIANT)/)$(PKG_NAME)$(if $(PKG_VERSION),-$(PKG_VERSION))
PKG_INSTALL_DIR ?= $(PKG_BUILD_DIR)/ipkg-install PKG_INSTALL_DIR ?= $(PKG_BUILD_DIR)/ipkg-install
PKG_BUILD_PARALLEL ?= PKG_BUILD_PARALLEL ?=
PKG_USE_MIPS16 ?= 1
PKG_IREMAP ?= 1
PKG_SKIP_DOWNLOAD=$(USE_SOURCE_DIR)$(USE_GIT_TREE)$(USE_GIT_SRC_CHECKOUT) PKG_SKIP_DOWNLOAD=$(USE_SOURCE_DIR)$(USE_GIT_TREE)$(USE_GIT_SRC_CHECKOUT)
MAKE_J:=$(if $(MAKE_JOBSERVER),$(MAKE_JOBSERVER) $(if $(filter 3.% 4.0 4.1,$(MAKE_VERSION)),-j)) MAKE_J:=$(if $(MAKE_JOBSERVER),$(MAKE_JOBSERVER) $(if $(filter 3.% 4.0 4.1,$(MAKE_VERSION)),-j))
@ -22,50 +24,15 @@ PKG_JOBS?=-j1
else else
PKG_JOBS?=$(if $(PKG_BUILD_PARALLEL),$(MAKE_J),-j1) PKG_JOBS?=$(if $(PKG_BUILD_PARALLEL),$(MAKE_J),-j1)
endif endif
PKG_BUILD_FLAGS?=
# TODO remove this when all packages moved to PKG_BUILD_FLAGS=no-mips16
PKG_USE_MIPS16?=1
ifneq ($(strip $(PKG_USE_MIPS16)),1)
PKG_BUILD_FLAGS+=no-mips16
endif
__unknown_flags=$(filter-out no-iremap no-mips16 gc-sections no-gc-sections lto no-lto no-mold,$(PKG_BUILD_FLAGS))
ifneq ($(__unknown_flags),)
$(error unknown PKG_BUILD_FLAGS: $(__unknown_flags))
endif
# $1=flagname, $2=default (0/1)
define pkg_build_flag
$(if $(filter no-$(1),$(PKG_BUILD_FLAGS)),0,$(if $(filter $(1),$(PKG_BUILD_FLAGS)),1,$(2)))
endef
ifeq ($(call pkg_build_flag,iremap,1),1)
IREMAP_CFLAGS = $(call iremap,$(PKG_BUILD_DIR),$(notdir $(PKG_BUILD_DIR)))
TARGET_CFLAGS += $(IREMAP_CFLAGS)
endif
ifdef CONFIG_USE_MIPS16 ifdef CONFIG_USE_MIPS16
ifeq ($(call pkg_build_flag,mips16,1),1) ifeq ($(strip $(PKG_USE_MIPS16)),1)
TARGET_ASFLAGS_DEFAULT = $(filter-out -mips16 -minterlink-mips16,$(TARGET_CFLAGS)) TARGET_ASFLAGS_DEFAULT = $(filter-out -mips16 -minterlink-mips16,$(TARGET_CFLAGS))
TARGET_CFLAGS += -mips16 -minterlink-mips16 TARGET_CFLAGS += -mips16 -minterlink-mips16
TARGET_CXXFLAGS += -mips16 -minterlink-mips16
endif endif
endif endif
ifeq ($(call pkg_build_flag,gc-sections,$(if $(CONFIG_USE_GC_SECTIONS),1,0)),1) ifeq ($(strip $(PKG_IREMAP)),1)
TARGET_CFLAGS+= -ffunction-sections -fdata-sections IREMAP_CFLAGS = $(call iremap,$(PKG_BUILD_DIR),$(notdir $(PKG_BUILD_DIR)))
TARGET_CXXFLAGS+= -ffunction-sections -fdata-sections TARGET_CFLAGS += $(IREMAP_CFLAGS)
TARGET_LDFLAGS+= -Wl,--gc-sections
endif
ifeq ($(call pkg_build_flag,lto,$(if $(CONFIG_USE_LTO),1,0)),1)
TARGET_CFLAGS+= -flto=auto -fno-fat-lto-objects
TARGET_CXXFLAGS+= -flto=auto -fno-fat-lto-objects
TARGET_LDFLAGS+= -flto=auto -fuse-linker-plugin
endif
ifdef CONFIG_USE_MOLD
ifeq ($(call pkg_build_flag,mold,1),1)
TARGET_LINKER:=mold
endif
endif endif
include $(INCLUDE_DIR)/hardening.mk include $(INCLUDE_DIR)/hardening.mk

View File

@ -15,7 +15,7 @@ $(eval $(call TestHostCommand,working-make, \
$(MAKE) -v | grep -E 'Make (4\.[1-9]|[5-9]\.)')) $(MAKE) -v | grep -E 'Make (4\.[1-9]|[5-9]\.)'))
$(eval $(call TestHostCommand,case-sensitive-fs, \ $(eval $(call TestHostCommand,case-sensitive-fs, \
LEDE can only be built on a case-sensitive filesystem, \ OpenWrt can only be built on a case-sensitive filesystem, \
rm -f $(TMP_DIR)/test.*; touch $(TMP_DIR)/test.fs; \ rm -f $(TMP_DIR)/test.*; touch $(TMP_DIR)/test.fs; \
test ! -f $(TMP_DIR)/test.FS)) test ! -f $(TMP_DIR)/test.FS))
@ -229,4 +229,4 @@ prereq: $(STAGING_DIR_HOST)/bin/mkhash $(STAGING_DIR_HOST)/bin/xxd
# Install ldconfig stub # Install ldconfig stub
$(eval $(call TestHostCommand,ldconfig-stub,Failed to install stub, \ $(eval $(call TestHostCommand,ldconfig-stub,Failed to install stub, \
$(LN) $(SCRIPT_DIR)/noop.sh $(STAGING_DIR_HOST)/bin/ldconfig)) $(LN) $(firstword $(wildcard /bin/true /usr/bin/true)) $(STAGING_DIR_HOST)/bin/ldconfig))

View File

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

View File

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

View File

@ -5,9 +5,6 @@
ifeq ($(MAKECMDGOALS),prereq) ifeq ($(MAKECMDGOALS),prereq)
SUBTARGETS:=prereq SUBTARGETS:=prereq
PREREQ_ONLY:=1 PREREQ_ONLY:=1
# For target/linux related target add dtb to selectively compile dtbs
else ifneq ($(filter target/linux/%,$(MAKECMDGOALS)),)
SUBTARGETS:=$(DEFAULT_SUBDIR_TARGETS) dtb
else else
SUBTARGETS:=$(DEFAULT_SUBDIR_TARGETS) SUBTARGETS:=$(DEFAULT_SUBDIR_TARGETS)
endif endif

View File

@ -53,9 +53,9 @@ DEFAULT_PACKAGES.nas:=\
mdadm mdadm
# For router targets # For router targets
DEFAULT_PACKAGES.router:=\ DEFAULT_PACKAGES.router:=\
dnsmasq-full firewall iptables ppp ppp-mod-pppoe odhcp6c odhcpd-ipv6only ip6tables libip6tc kmod-ipt-nat6 \ dnsmasq-full firewall iptables ppp ppp-mod-pppoe \
block-mount coremark kmod-nf-nathelper kmod-nf-nathelper-extra kmod-ipt-raw kmod-tun \ block-mount coremark kmod-nf-nathelper kmod-nf-nathelper-extra kmod-ipt-raw kmod-tun \
iptables-mod-tproxy iptables-mod-extra ipset ip-full default-settings luci luci-proto-ipv6 \ iptables-mod-tproxy iptables-mod-extra ipset ip-full default-settings luci luci-newapi \
ddns-scripts_aliyun ddns-scripts_dnspod luci-app-ddns luci-app-upnp luci-app-autoreboot \ ddns-scripts_aliyun ddns-scripts_dnspod luci-app-ddns luci-app-upnp luci-app-autoreboot \
luci-app-arpbind luci-app-filetransfer luci-app-vsftpd luci-app-ssr-plus luci-app-vlmcsd \ luci-app-arpbind luci-app-filetransfer luci-app-vsftpd luci-app-ssr-plus luci-app-vlmcsd \
luci-app-accesscontrol luci-app-nlbwmon luci-app-turboacc luci-app-wol curl ca-certificates luci-app-accesscontrol luci-app-nlbwmon luci-app-turboacc luci-app-wol curl ca-certificates
@ -258,15 +258,6 @@ ifeq ($(DUMP),1)
CPU_CFLAGS_arc700 = -mcpu=arc700 CPU_CFLAGS_arc700 = -mcpu=arc700
CPU_CFLAGS_archs = -mcpu=archs CPU_CFLAGS_archs = -mcpu=archs
endif endif
ifeq ($(ARCH),riscv64)
CPU_TYPE ?= riscv64
CPU_CFLAGS_riscv64:=-mabi=lp64d -march=rv64imafdc
endif
ifeq ($(ARCH),loongarch64)
CPU_TYPE ?= generic
CPU_CFLAGS := -O2 -pipe
CPU_CFLAGS_generic:=-march=loongarch64
endif
ifneq ($(CPU_TYPE),) ifneq ($(CPU_TYPE),)
ifndef CPU_CFLAGS_$(CPU_TYPE) ifndef CPU_CFLAGS_$(CPU_TYPE)
$(warning CPU_TYPE "$(CPU_TYPE)" doesn't correspond to a known type) $(warning CPU_TYPE "$(CPU_TYPE)" doesn't correspond to a known type)

View File

@ -3,7 +3,7 @@ PKG_CPE_ID ?= cpe:/a:arm:trusted_firmware-a
ifndef PKG_SOURCE_PROTO ifndef PKG_SOURCE_PROTO
PKG_SOURCE = trusted-firmware-a-$(PKG_VERSION).tar.gz PKG_SOURCE = trusted-firmware-a-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/TrustedFirmware-A/trusted-firmware-a/tar.gz/v$(PKG_VERSION)? PKG_SOURCE_URL:=https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/snapshot
endif endif
PKG_BUILD_DIR = $(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) PKG_BUILD_DIR = $(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)

View File

@ -16,7 +16,7 @@ PKG_FLAGS:=nonshared
PKG_LICENSE:=GPL-2.0 GPL-2.0+ PKG_LICENSE:=GPL-2.0 GPL-2.0+
PKG_LICENSE_FILES:=Licenses/README PKG_LICENSE_FILES:=Licenses/README
PKG_BUILD_PARALLEL ?= 1 PKG_BUILD_PARALLEL:=1
export GCC_HONOUR_COPTS=s export GCC_HONOUR_COPTS=s

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -6,7 +6,7 @@ USE_PROCD=1
validate_system_section() { validate_system_section() {
uci_load_validate system system "$1" "$2" \ uci_load_validate system system "$1" "$2" \
'hostname:string:LEDE' \ 'hostname:string:OpenWrt' \
'conloglevel:uinteger' \ 'conloglevel:uinteger' \
'buffersize:uinteger' \ 'buffersize:uinteger' \
'timezone:string:UTC' \ 'timezone:string:UTC' \

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -418,15 +418,6 @@ ucidef_set_led_default() {
json_select .. json_select ..
} }
ucidef_set_led_heartbeat() {
_ucidef_set_led_common "$1" "$2" "$3"
json_add_string trigger heartbeat
json_select ..
json_select ..
}
ucidef_set_led_gpio() { ucidef_set_led_gpio() {
local gpio="$4" local gpio="$4"
local inverted="$5" local inverted="$5"

View File

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

View File

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

View File

@ -9,7 +9,7 @@ missing_lines() {
IFS=":" IFS=":"
while read line; do while read line; do
set -- $line set -- $line
grep -q "^$1:" "$file2" || echo "$line" grep -q "^$1:" "$file2" || echo "$*"
done < "$file1" done < "$file1"
IFS="$oIFS" IFS="$oIFS"
} }
@ -17,7 +17,10 @@ missing_lines() {
do_mount_root() { do_mount_root() {
mount_root mount_root
boot_run_hook preinit_mount_root boot_run_hook preinit_mount_root
[ ! -f /etc/bench.log ] && touch /etc/bench.log have_ro_ext4=$(/bin/cat /proc/mounts |/bin/grep ' / ext4'|/bin/grep 'ro'|/usr/bin/wc -l)
if [ "$have_ro_ext4" != "0" ]; then
/usr/bin/mount -o remount,rw,noatime /
fi
[ -f /sysupgrade.tgz -o -f /tmp/sysupgrade.tar ] && { [ -f /sysupgrade.tgz -o -f /tmp/sysupgrade.tar ] && {
echo "- config restore -" echo "- config restore -"
cp /etc/passwd /etc/group /etc/shadow /tmp cp /etc/passwd /etc/group /etc/shadow /tmp

View File

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

View File

@ -165,23 +165,6 @@ part_magic_fat() {
[ "$magic" = "FAT" ] || [ "$magic_fat32" = "FAT32" ] [ "$magic" = "FAT" ] || [ "$magic_fat32" = "FAT32" ]
} }
fitblk_get_bootdev() {
[ -e /sys/firmware/devicetree/base/chosen/rootdisk ] || return
local rootdisk="$(cat /sys/firmware/devicetree/base/chosen/rootdisk)"
local handle bootdev
for handle in /sys/class/block/*/of_node/phandle /sys/class/block/*/device/of_node/phandle; do
[ ! -e "$handle" ] && continue
if [ "$rootdisk" = "$(cat $handle)" ]; then
bootdev="${handle%/of_node/phandle}"
bootdev="${bootdev%/device}"
bootdev="${bootdev#/sys/class/block/}"
echo "$bootdev"
break
fi
done
}
export_bootdevice() { export_bootdevice() {
local cmdline uuid blockdev uevent line class local cmdline uuid blockdev uevent line class
local MAJOR MINOR DEVNAME DEVTYPE local MAJOR MINOR DEVNAME DEVTYPE
@ -213,7 +196,6 @@ export_bootdevice() {
done done
;; ;;
/dev/*) /dev/*)
[ "$rootpart" = "/dev/fit0" ] && rootpart="$(fitblk_get_bootdev)"
uevent="/sys/class/block/${rootpart##*/}/../uevent" uevent="/sys/class/block/${rootpart##*/}/../uevent"
;; ;;
0x[a-f0-9][a-f0-9][a-f0-9] | 0x[a-f0-9][a-f0-9][a-f0-9][a-f0-9] | \ 0x[a-f0-9][a-f0-9][a-f0-9] | 0x[a-f0-9][a-f0-9][a-f0-9][a-f0-9] | \

View File

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

View File

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

View File

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

View File

@ -7,8 +7,6 @@
CI_KERNPART="${CI_KERNPART:-kernel}" CI_KERNPART="${CI_KERNPART:-kernel}"
# 'ubi' partition on NAND contains UBI # 'ubi' partition on NAND contains UBI
# There are also CI_KERN_UBIPART and CI_ROOT_UBIPART if kernel
# and rootfs are on separated UBIs.
CI_UBIPART="${CI_UBIPART:-ubi}" CI_UBIPART="${CI_UBIPART:-ubi}"
# 'rootfs' UBI volume on NAND contains the rootfs # 'rootfs' UBI volume on NAND contains the rootfs
@ -28,7 +26,7 @@ ubi_mknod() {
nand_find_volume() { nand_find_volume() {
local ubidevdir ubivoldir local ubidevdir ubivoldir
ubidevdir="/sys/class/ubi/" ubidevdir="/sys/devices/virtual/ubi/$1"
[ ! -d "$ubidevdir" ] && return 1 [ ! -d "$ubidevdir" ] && return 1
for ubivoldir in $ubidevdir/${1}_*; do for ubivoldir in $ubidevdir/${1}_*; do
[ ! -d "$ubivoldir" ] && continue [ ! -d "$ubivoldir" ] && continue
@ -41,12 +39,13 @@ nand_find_volume() {
} }
nand_find_ubi() { nand_find_ubi() {
local ubidevdir ubidev mtdnum cmtdnum local ubidevdir ubidev mtdnum
mtdnum="$( find_mtd_index $1 )" mtdnum="$( find_mtd_index $1 )"
[ ! "$mtdnum" ] && return 1 [ ! "$mtdnum" ] && return 1
for ubidevdir in /sys/class/ubi/ubi*; do for ubidevdir in /sys/devices/virtual/ubi/ubi*; do
[ ! -e "$ubidevdir/mtd_num" ] && continue [ ! -d "$ubidevdir" ] && continue
cmtdnum="$( cat $ubidevdir/mtd_num )" cmtdnum="$( cat $ubidevdir/mtd_num )"
[ ! "$mtdnum" ] && continue
if [ "$mtdnum" = "$cmtdnum" ]; then if [ "$mtdnum" = "$cmtdnum" ]; then
ubidev=$( basename $ubidevdir ) ubidev=$( basename $ubidevdir )
ubi_mknod "$ubidevdir" ubi_mknod "$ubidevdir"
@ -57,175 +56,128 @@ nand_find_ubi() {
} }
nand_get_magic_long() { nand_get_magic_long() {
(${3}cat "$1" | dd bs=4 "skip=${2:-0}" count=1 | hexdump -v -n 4 -e '1/1 "%02x"') 2> /dev/null dd if="$1" skip=$2 bs=4 count=1 2>/dev/null | hexdump -v -n 4 -e '1/1 "%02x"'
} }
get_magic_long_tar() { get_magic_long_tar() {
(tar xO${3}f "$1" "$2" | dd bs=4 count=1 | hexdump -v -n 4 -e '1/1 "%02x"') 2> /dev/null ( tar xf $1 $2 -O | dd bs=4 count=1 | hexdump -v -n 4 -e '1/1 "%02x"') 2> /dev/null
} }
identify_magic() {
local magic=$1
case "$magic" in
"55424923")
echo "ubi"
;;
"31181006")
echo "ubifs"
;;
"68737173")
echo "squashfs"
;;
"d00dfeed")
echo "fit"
;;
"4349"*)
echo "combined"
;;
*)
echo "unknown $magic"
;;
esac
}
identify() { identify() {
identify_magic_long $(nand_get_magic_long "$@") identify_magic $(nand_get_magic_long "$1" "${2:-0}")
} }
identify_tar() { identify_tar() {
identify_magic_long $(get_magic_long_tar "$@") identify_magic $(get_magic_long_tar "$1" "$2")
}
identify_if_gzip() {
if [ "$(identify "$1")" = gzip ]; then echo -n z; fi
} }
nand_restore_config() { nand_restore_config() {
local ubidev=$( nand_find_ubi "${CI_ROOT_UBIPART:-$CI_UBIPART}" ) sync
local ubidev=$( nand_find_ubi $CI_UBIPART )
local ubivol="$( nand_find_volume $ubidev rootfs_data )" local ubivol="$( nand_find_volume $ubidev rootfs_data )"
if [ ! "$ubivol" ]; then [ ! "$ubivol" ] &&
ubivol="$( nand_find_volume $ubidev "$CI_ROOTPART" )" ubivol="$( nand_find_volume $ubidev $CI_ROOTPART )"
if [ ! "$ubivol" ]; then
echo "cannot find ubifs data volume"
return 1
fi
fi
mkdir /tmp/new_root mkdir /tmp/new_root
if ! mount -t ubifs /dev/$ubivol /tmp/new_root; then if ! mount -t ubifs /dev/$ubivol /tmp/new_root; then
echo "cannot mount ubifs volume $ubivol" echo "mounting ubifs $ubivol failed"
rmdir /tmp/new_root rmdir /tmp/new_root
return 1 return 1
fi fi
if mv "$1" "/tmp/new_root/$BACKUP_FILE"; then mv "$1" "/tmp/new_root/$BACKUP_FILE"
if umount /tmp/new_root; then umount /tmp/new_root
echo "configuration saved" sync
rmdir /tmp/new_root
return 0
fi
else
umount /tmp/new_root
fi
echo "could not save configuration to ubifs volume $ubivol"
rmdir /tmp/new_root rmdir /tmp/new_root
return 1
}
nand_remove_ubiblock() {
local ubivol="$1"
local ubiblk="ubiblock${ubivol:3}"
if [ -e "/dev/$ubiblk" ]; then
umount "/dev/$ubiblk" && echo "unmounted /dev/$ubiblk" || :
if ! ubiblock -r "/dev/$ubivol"; then
echo "cannot remove $ubiblk"
return 1
fi
fi
}
nand_attach_ubi() {
local ubipart="$1"
local has_env="${2:-0}"
local mtdnum="$( find_mtd_index "$ubipart" )"
if [ ! "$mtdnum" ]; then
>&2 echo "cannot find ubi mtd partition $ubipart"
return 1
fi
local ubidev="$( nand_find_ubi "$ubipart" )"
if [ ! "$ubidev" ]; then
>&2 ubiattach -m "$mtdnum"
ubidev="$( nand_find_ubi "$ubipart" )"
if [ ! "$ubidev" ]; then
>&2 ubiformat /dev/mtd$mtdnum -y
>&2 ubiattach -m "$mtdnum"
ubidev="$( nand_find_ubi "$ubipart" )"
if [ ! "$ubidev" ]; then
>&2 echo "cannot attach ubi mtd partition $ubipart"
return 1
fi
if [ "$has_env" -gt 0 ]; then
>&2 ubimkvol /dev/$ubidev -n 0 -N ubootenv -s 1MiB
>&2 ubimkvol /dev/$ubidev -n 1 -N ubootenv2 -s 1MiB
fi
fi
fi
echo "$ubidev"
return 0
}
nand_detach_ubi() {
local ubipart="$1"
local mtdnum="$( find_mtd_index "$ubipart" )"
if [ ! "$mtdnum" ]; then
echo "cannot find ubi mtd partition $ubipart"
return 1
fi
local ubidev="$( nand_find_ubi "$ubipart" )"
if [ "$ubidev" ]; then
for ubivol in $(find /dev -name "${ubidev}_*" -maxdepth 1 | sort); do
ubivol="${ubivol:5}"
nand_remove_ubiblock "$ubivol" || :
umount "/dev/$ubivol" && echo "unmounted /dev/$ubivol" || :
done
if ! ubidetach -m "$mtdnum"; then
echo "cannot detach ubi mtd partition $ubipart"
return 1
fi
fi
} }
nand_upgrade_prepare_ubi() { nand_upgrade_prepare_ubi() {
local rootfs_length="$1" local rootfs_length="$1"
local rootfs_type="$2" 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)) [ -n "$rootfs_data_max" ] && rootfs_data_max=$((rootfs_data_max))
local kernel_length="$3" local kernel_length="$3"
local has_env="${4:-0}" local has_env="${4:-0}"
local kern_ubidev
local root_ubidev
[ -n "$rootfs_length" -o -n "$kernel_length" ] || return 1 [ -n "$rootfs_length" -o -n "$kernel_length" ] || return 1
if [ -n "$CI_KERN_UBIPART" -a -n "$CI_ROOT_UBIPART" ]; then local mtdnum="$( find_mtd_index "$CI_UBIPART" )"
kern_ubidev="$( nand_attach_ubi "$CI_KERN_UBIPART" "$has_env" )" if [ ! "$mtdnum" ]; then
[ -n "$kern_ubidev" ] || return 1 echo "cannot find ubi mtd partition $CI_UBIPART"
root_ubidev="$( nand_attach_ubi "$CI_ROOT_UBIPART" )" return 1
[ -n "$root_ubidev" ] || return 1
else
kern_ubidev="$( nand_attach_ubi "$CI_UBIPART" "$has_env" )"
[ -n "$kern_ubidev" ] || return 1
root_ubidev="$kern_ubidev"
fi fi
local kern_ubivol="$( nand_find_volume $kern_ubidev "$CI_KERNPART" )" local ubidev="$( nand_find_ubi "$CI_UBIPART" )"
local root_ubivol="$( nand_find_volume $root_ubidev "$CI_ROOTPART" )" if [ ! "$ubidev" ]; then
local data_ubivol="$( nand_find_volume $root_ubidev rootfs_data )" ubiattach -m "$mtdnum"
[ "$root_ubivol" = "$kern_ubivol" ] && root_ubivol= sync
ubidev="$( nand_find_ubi "$CI_UBIPART" )"
fi
# remove ubiblocks if [ ! "$ubidev" ]; then
[ "$kern_ubivol" ] && { nand_remove_ubiblock $kern_ubivol || return 1; } ubiformat /dev/mtd$mtdnum -y
[ "$root_ubivol" ] && { nand_remove_ubiblock $root_ubivol || return 1; } ubiattach -m "$mtdnum"
[ "$data_ubivol" ] && { nand_remove_ubiblock $data_ubivol || return 1; } sync
ubidev="$( nand_find_ubi "$CI_UBIPART" )"
[ "$has_env" -gt 0 ] && {
ubimkvol /dev/$ubidev -n 0 -N ubootenv -s 1MiB
ubimkvol /dev/$ubidev -n 1 -N ubootenv2 -s 1MiB
}
fi
local kern_ubivol="$( nand_find_volume $ubidev $CI_KERNPART )"
local root_ubivol="$( nand_find_volume $ubidev $CI_ROOTPART )"
local data_ubivol="$( nand_find_volume $ubidev rootfs_data )"
local ubiblk ubiblkvol
for ubiblk in /dev/ubiblock*_? ; do
[ -e "$ubiblk" ] || continue
echo "removing ubiblock${ubiblk:13}"
ubiblkvol=ubi${ubiblk:13}
if ! ubiblock -r /dev/$ubiblkvol; then
echo "cannot remove $ubiblk"
return 1
fi
done
# kill volumes # kill volumes
[ "$kern_ubivol" ] && ubirmvol /dev/$kern_ubidev -N "$CI_KERNPART" || : [ "$kern_ubivol" ] && ubirmvol /dev/$ubidev -N $CI_KERNPART || true
[ "$root_ubivol" ] && ubirmvol /dev/$root_ubidev -N "$CI_ROOTPART" || : [ "$root_ubivol" -a "$root_ubivol" != "$kern_ubivol" ] && ubirmvol /dev/$ubidev -N $CI_ROOTPART || true
[ "$data_ubivol" ] && ubirmvol /dev/$root_ubidev -N rootfs_data || : [ "$data_ubivol" ] && ubirmvol /dev/$ubidev -N rootfs_data || true
# create kernel vol # update kernel
if [ -n "$kernel_length" ]; then if [ -n "$kernel_length" ]; then
if ! ubimkvol /dev/$kern_ubidev -N "$CI_KERNPART" -s $kernel_length; then if ! ubimkvol /dev/$ubidev -N $CI_KERNPART -s $kernel_length; then
echo "cannot create kernel volume" echo "cannot create kernel volume"
return 1; return 1;
fi fi
fi fi
# create rootfs vol # update rootfs
if [ -n "$rootfs_length" ]; then if [ -n "$rootfs_length" ]; then
local rootfs_size_param local rootfs_size_param
if [ "$rootfs_type" = "ubifs" ]; then if [ "$rootfs_type" = "ubifs" ]; then
@ -233,224 +185,157 @@ nand_upgrade_prepare_ubi() {
else else
rootfs_size_param="-s $rootfs_length" rootfs_size_param="-s $rootfs_length"
fi fi
if ! ubimkvol /dev/$root_ubidev -N "$CI_ROOTPART" $rootfs_size_param; then if ! ubimkvol /dev/$ubidev -N $CI_ROOTPART $rootfs_size_param; then
echo "cannot create rootfs volume" echo "cannot create rootfs volume"
return 1; return 1;
fi fi
fi fi
# create rootfs_data vol for non-ubifs rootfs # create rootfs_data for non-ubifs rootfs
if [ "$rootfs_type" != "ubifs" ]; then if [ "$rootfs_type" != "ubifs" ]; then
local availeb=$(cat /sys/devices/virtual/ubi/$ubidev/avail_eraseblocks)
local ebsize=$(cat /sys/devices/virtual/ubi/$ubidev/eraseblock_size)
local avail_size=$((availeb * ebsize))
local rootfs_data_size_param="-m" local rootfs_data_size_param="-m"
if [ -n "$rootfs_data_max" ]; then if [ -n "$rootfs_data_max" ] &&
[ "$rootfs_data_max" != "0" ] &&
[ "$rootfs_data_max" -le "$avail_size" ]; then
rootfs_data_size_param="-s $rootfs_data_max" rootfs_data_size_param="-s $rootfs_data_max"
fi fi
if ! ubimkvol /dev/$root_ubidev -N rootfs_data $rootfs_data_size_param; then if ! ubimkvol /dev/$ubidev -N rootfs_data $rootfs_data_size_param; then
if ! ubimkvol /dev/$root_ubidev -N rootfs_data -m; then echo "cannot initialize rootfs_data volume"
echo "cannot initialize rootfs_data volume"
return 1
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"
return 1 return 1
fi fi
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 sync
nand_do_flash_file "$file" && nand_do_upgrade_success return 0
nand_do_upgrade_failed
} }
nand_do_upgrade_success() { nand_do_upgrade_success() {
if nand_do_restore_config && sync; then local conf_tar="/tmp/sysupgrade.tgz"
echo "sysupgrade successful"
umount -a
reboot -f
fi
nand_do_upgrade_failed
}
nand_do_upgrade_failed() {
sync sync
echo "sysupgrade failed" [ -f "$conf_tar" ] && nand_restore_config "$conf_tar"
# Should we reboot or bring up some failsafe mode instead? echo "sysupgrade successful"
umount -a umount -a
reboot -f reboot -f
} }
# Check if passed file is a valid one for NAND sysupgrade. # Flash the UBI image to MTD partition
# Currently it accepts 4 types of files: nand_upgrade_ubinized() {
# 1) UBI: a ubinized image containing required UBI volumes. local ubi_file="$1"
# 2) UBIFS: a UBIFS rootfs volume image. local mtdnum="$(find_mtd_index "$CI_UBIPART")"
# 3) FIT: a FIT image containing kernel and rootfs.
# 4) TAR: an archive that includes directory "sysupgrade-${BOARD_NAME}" containing [ ! "$mtdnum" ] && {
# a non-empty "CONTROL" file and required partition and/or volume images. 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. # You usually want to call this function in platform_check_image.
# #
@ -458,25 +343,14 @@ nand_do_upgrade_failed() {
# $(2): file to be checked # $(2): file to be checked
nand_do_platform_check() { nand_do_platform_check() {
local board_name="$1" local board_name="$1"
local file="$2" local tar_file="$2"
local control_length=$( (tar xf $tar_file sysupgrade-$board_name/CONTROL -O | wc -c) 2> /dev/null)
local file_type="$(identify $2)"
local gz="$(identify_if_gzip "$file")" [ "$control_length" = 0 -a "$file_type" != "ubi" -a "$file_type" != "ubifs" -a "$file_type" != "fit" ] && {
local file_type="$(identify "$file" "" "$gz")" echo "Invalid sysupgrade file."
local control_length=$( (tar xO${gz}f "$file" "sysupgrade-${board_name//,/_}/CONTROL" | wc -c) 2> /dev/null) return 1
}
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
return 0 return 0
} }

View File

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

View File

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

View File

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

View File

@ -5,13 +5,6 @@
# See /LICENSE for more information. # 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 menuconfig PREINITOPT
bool "Preinit configuration options" if IMAGEOPT bool "Preinit configuration options" if IMAGEOPT
default n default n
@ -165,7 +158,7 @@ if VERSIONOPT
config VERSION_DIST config VERSION_DIST
string string
prompt "Release distribution" prompt "Release distribution"
default "LEDE" default "OpenWrt"
help help
This is the name of the release distribution. This is the name of the release distribution.
If unspecified, it defaults to OpenWrt. If unspecified, it defaults to OpenWrt.
@ -190,7 +183,7 @@ if VERSIONOPT
config VERSION_REPO config VERSION_REPO
string string
prompt "Release repository" prompt "Release repository"
default "https://downloads.openwrt.org/releases/24.10.1" default "https://downloads.openwrt.org/snapshots"
help help
This is the repository address embedded in the image, it defaults This is the repository address embedded in the image, it defaults
to the trunk snapshot repo; the url may contain the following placeholders: 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 %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, uppercase
%c .. Configured release revision code or value of %R, lowercase %c .. Configured release revision code or value of %R, lowercase
%D .. Distribution name or "LEDE", uppercase %D .. Distribution name or "OpenWrt", uppercase
%d .. Distribution name or "lede", lowercase %d .. Distribution name or "openwrt", lowercase
%T .. Target name %T .. Target name
%S .. Target/Subtarget name %S .. Target/Subtarget name
%A .. Package architecture %A .. Package architecture
%t .. Build taint flags, e.g. "no-all busybox" %t .. Build taint flags, e.g. "no-all busybox"
%M .. Manufacturer name or "LEDE" %M .. Manufacturer name or "OpenWrt"
%P .. Product name or "Generic" %P .. Product name or "Generic"
%h .. Hardware revision or "v0" %h .. Hardware revision or "v0"
@ -266,7 +259,7 @@ if VERSIONOPT
config VERSION_CODE_FILENAMES config VERSION_CODE_FILENAMES
bool bool
prompt "Revision code in filenames" prompt "Revision code in filenames"
default n default y
help help
Enable this to include the revision identifier or the configured Enable this to include the revision identifier or the configured
version code into the firmware image, SDK- and Image Builder archive 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) 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. # This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information. # See /LICENSE for more information.
@ -9,13 +9,13 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=arm-trusted-firmware-mediatek PKG_NAME:=arm-trusted-firmware-mediatek
PKG_RELEASE:=2 PKG_RELEASE:=$(AUTORELEASE)
PKG_SOURCE_PROTO:=git PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=https://github.com/mtk-openwrt/arm-trusted-firmware.git PKG_SOURCE_URL=https://github.com/mtk-openwrt/arm-trusted-firmware.git
PKG_SOURCE_DATE:=2024-01-17 PKG_SOURCE_DATE:=2022-08-31
PKG_SOURCE_VERSION:=bacca82a8cac369470df052a9d801a0ceb9b74ca PKG_SOURCE_VERSION:=7539348480af57c6d0db95aba6381f3ee7483779
PKG_MIRROR_HASH:=d035c1b63a9bd71d752c90540361b66d290e7cf42dcca73259d0950af3569c79 PKG_MIRROR_HASH:=125090124d77753acc379b3b124100978c1ecb3da37c4983ba9644b433b7eb08
PKG_MAINTAINER:=Daniel Golle <daniel@makrotopia.org> PKG_MAINTAINER:=Daniel Golle <daniel@makrotopia.org>
@ -30,9 +30,6 @@ define Trusted-Firmware-A/Default
DDR3_FLYBY:= DDR3_FLYBY:=
DDR_TYPE:= DDR_TYPE:=
NAND_TYPE:= NAND_TYPE:=
BOARD_QFN:=
DRAM_USE_COMB:=
USE_UBI:=
endef endef
define Trusted-Firmware-A/mt7622-nor-1ddr define Trusted-Firmware-A/mt7622-nor-1ddr
@ -57,14 +54,6 @@ define Trusted-Firmware-A/mt7622-snand-1ddr
BOOT_DEVICE:=snand BOOT_DEVICE:=snand
endef 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 define Trusted-Firmware-A/mt7622-snand-2ddr
NAME:=MediaTek MT7622 (SPI-NAND, 2x DDR3) NAME:=MediaTek MT7622 (SPI-NAND, 2x DDR3)
BUILD_SUBTARGET:=mt7622 BUILD_SUBTARGET:=mt7622
@ -73,15 +62,6 @@ define Trusted-Firmware-A/mt7622-snand-2ddr
DDR3_FLYBY:=1 DDR3_FLYBY:=1
endef 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 define Trusted-Firmware-A/mt7622-emmc-1ddr
NAME:=MediaTek MT7622 (eMMC, 1x DDR3) NAME:=MediaTek MT7622 (eMMC, 1x DDR3)
BUILD_SUBTARGET:=mt7622 BUILD_SUBTARGET:=mt7622
@ -112,79 +92,6 @@ define Trusted-Firmware-A/mt7622-sdmmc-2ddr
DDR3_FLYBY:=1 DDR3_FLYBY:=1
endef 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 define Trusted-Firmware-A/mt7986-nor-ddr4
NAME:=MediaTek MT7986 (SPI-NOR, DDR4) NAME:=MediaTek MT7986 (SPI-NOR, DDR4)
BOOT_DEVICE:=nor BOOT_DEVICE:=nor
@ -226,25 +133,6 @@ define Trusted-Firmware-A/mt7986-spim-nand-ddr4
NAND_TYPE:=spim:2k+64 NAND_TYPE:=spim:2k+64
endef 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 define Trusted-Firmware-A/mt7986-nor-ddr3
NAME:=MediaTek MT7986 (SPI-NOR, DDR3) NAME:=MediaTek MT7986 (SPI-NOR, DDR3)
BOOT_DEVICE:=nor BOOT_DEVICE:=nor
@ -285,164 +173,15 @@ define Trusted-Firmware-A/mt7986-spim-nand-ddr3
DDR_TYPE:=ddr3 DDR_TYPE:=ddr3
endef 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:= \ TFA_TARGETS:= \
mt7622-nor-1ddr \ mt7622-nor-1ddr \
mt7622-nor-2ddr \ mt7622-nor-2ddr \
mt7622-snand-1ddr \ mt7622-snand-1ddr \
mt7622-snand-ubi-1ddr \
mt7622-snand-2ddr \ mt7622-snand-2ddr \
mt7622-snand-ubi-2ddr \
mt7622-emmc-1ddr \ mt7622-emmc-1ddr \
mt7622-emmc-2ddr \ mt7622-emmc-2ddr \
mt7622-sdmmc-1ddr \ mt7622-sdmmc-1ddr \
mt7622-sdmmc-2ddr \ 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-emmc-ddr3 \
mt7986-nor-ddr3 \ mt7986-nor-ddr3 \
mt7986-sdmmc-ddr3 \ mt7986-sdmmc-ddr3 \
@ -452,38 +191,15 @@ TFA_TARGETS:= \
mt7986-nor-ddr4 \ mt7986-nor-ddr4 \
mt7986-sdmmc-ddr4 \ mt7986-sdmmc-ddr4 \
mt7986-snand-ddr4 \ mt7986-snand-ddr4 \
mt7986-spim-nand-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
TFA_MAKE_FLAGS += \ TFA_MAKE_FLAGS += \
BOOT_DEVICE=$(BOOT_DEVICE) \ BOOT_DEVICE=$(BOOT_DEVICE) \
USE_MKIMAGE=1 MKIMAGE=$(STAGING_DIR_HOST)/bin/mkimage \ USE_MKIMAGE=1 MKIMAGE=$(STAGING_DIR_HOST)/bin/mkimage \
$(if $(findstring ddr4,$(DDR_TYPE)),DRAM_USE_DDR4=1) \ $(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)) \ $(if $(NAND_TYPE),NAND_TYPE=$(NAND_TYPE)) \
HAVE_DRAM_OBJ_FILE=yes \ HAVE_DRAM_OBJ_FILE=yes \
$(if $(DDR3_FLYBY),DDR3_FLYBY=1) \ $(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 all
define Package/trusted-firmware-a/install define Package/trusted-firmware-a/install

View File

@ -1,23 +0,0 @@
From fb2a2b669ec9bbf5c448d4b56499bc83de075c93 Mon Sep 17 00:00:00 2001
From: Daniel Golle <daniel@makrotopia.org>
Date: Thu, 29 Feb 2024 18:01:08 +0000
Subject: [PATCH 1/3] mediatek: snfi: FM35Q1GA is x4-only
Dont allow x2 read and cache read operations on FM35Q1GA.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
plat/mediatek/apsoc_common/drivers/snfi/mtk-snand-ids.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/plat/mediatek/apsoc_common/drivers/snfi/mtk-snand-ids.c
+++ b/plat/mediatek/apsoc_common/drivers/snfi/mtk-snand-ids.c
@@ -423,7 +423,7 @@ static const struct snand_flash_info sna
SNAND_INFO("FM35Q1GA", SNAND_ID(SNAND_ID_DYMMY, 0xe5, 0x71),
SNAND_MEMORG_1G_2K_64,
- &snand_cap_read_from_cache_x4,
+ &snand_cap_read_from_cache_x4_only,
&snand_cap_program_load_x4),
SNAND_INFO("PN26G01A", SNAND_ID(SNAND_ID_DYMMY, 0xa1, 0xe1),

View File

@ -1,99 +0,0 @@
From 6470986f037880ce76960c369d6e5a5270e7ce32 Mon Sep 17 00:00:00 2001
From: Daniel Golle <daniel@makrotopia.org>
Date: Sun, 10 Mar 2024 15:39:07 +0000
Subject: [PATCH 2/3] mediatek: snfi: adjust pin drive strength for Fidelix
SPI-NAND
It seems like we might need to adjust the pin driver strength to 12mA
for Fidelix SPI-NAND chip on MT7622 to avoid SPI data corruption on
some devices.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
.../apsoc_common/drivers/snfi/mtk-snand-def.h | 7 +++++
.../apsoc_common/drivers/snfi/mtk-snand-ids.c | 4 ++-
.../apsoc_common/drivers/snfi/mtk-snand.c | 30 +++++++++++++++++++
3 files changed, 40 insertions(+), 1 deletion(-)
--- a/plat/mediatek/apsoc_common/drivers/snfi/mtk-snand-def.h
+++ b/plat/mediatek/apsoc_common/drivers/snfi/mtk-snand-def.h
@@ -86,6 +86,12 @@ struct snand_mem_org {
typedef int (*snand_select_die_t)(struct mtk_snand *snf, uint32_t dieidx);
+enum snand_drv {
+ SNAND_DRV_NO_CHANGE = 0,
+ SNAND_DRV_8mA = 8,
+ SNAND_DRV_12mA = 12,
+};
+
struct snand_flash_info {
const char *model;
struct snand_id id;
@@ -93,6 +99,7 @@ struct snand_flash_info {
const struct snand_io_cap *cap_rd;
const struct snand_io_cap *cap_pl;
snand_select_die_t select_die;
+ enum snand_drv drv;
};
#define SNAND_INFO(_model, _id, _memorg, _cap_rd, _cap_pl, ...) \
--- a/plat/mediatek/apsoc_common/drivers/snfi/mtk-snand-ids.c
+++ b/plat/mediatek/apsoc_common/drivers/snfi/mtk-snand-ids.c
@@ -424,7 +424,9 @@ static const struct snand_flash_info sna
SNAND_INFO("FM35Q1GA", SNAND_ID(SNAND_ID_DYMMY, 0xe5, 0x71),
SNAND_MEMORG_1G_2K_64,
&snand_cap_read_from_cache_x4_only,
- &snand_cap_program_load_x4),
+ &snand_cap_program_load_x4,
+ NULL,
+ SNAND_DRV_12mA),
SNAND_INFO("PN26G01A", SNAND_ID(SNAND_ID_DYMMY, 0xa1, 0xe1),
SNAND_MEMORG_1G_2K_128,
--- a/plat/mediatek/apsoc_common/drivers/snfi/mtk-snand.c
+++ b/plat/mediatek/apsoc_common/drivers/snfi/mtk-snand.c
@@ -1845,6 +1845,33 @@ static int mtk_snand_id_probe(struct mtk
return -EINVAL;
}
+#define MT7622_GPIO_BASE (void *)0x10211000
+#define MT7622_GPIO_DRIV(x) (MT7622_GPIO_BASE + 0x900 + 0x10 * x)
+
+void mtk_mt7622_snand_adjust_drive(void *dev, enum snand_drv drv)
+{
+ uint32_t e4, e8;
+
+ e4 = readl(MT7622_GPIO_DRIV(6)) & ~(0x3f00);
+ e8 = readl(MT7622_GPIO_DRIV(7)) & ~(0x3f00);
+
+ switch (drv) {
+ case SNAND_DRV_8mA:
+ e4 |= 0x3f00;
+ break;
+ case SNAND_DRV_12mA:
+ e8 |= 0x3f00;
+ break;
+ default:
+ return;
+ }
+
+ snand_log_chip(dev, "adjusting SPI-NAND pin drive strength to %umA\n", drv);
+
+ writel(e4, MT7622_GPIO_DRIV(6));
+ writel(e8, MT7622_GPIO_DRIV(7));
+}
+
int mtk_snand_init(void *dev, const struct mtk_snand_platdata *pdata,
struct mtk_snand **psnf)
{
@@ -1888,6 +1915,9 @@ int mtk_snand_init(void *dev, const stru
if (ret)
return ret;
+ if (pdata->soc == SNAND_SOC_MT7622 && snand_info->drv)
+ mtk_mt7622_snand_adjust_drive(dev, snand_info->drv);
+
rawpage_size = snand_info->memorg.pagesize +
snand_info->memorg.sparesize;

View File

@ -1,135 +0,0 @@
From 40a3661bebb3d738ab95b7de66e9d8382d5b9ab1 Mon Sep 17 00:00:00 2001
From: Daniel Golle <daniel@makrotopia.org>
Date: Sun, 10 Mar 2024 17:48:09 +0000
Subject: [PATCH 3/3] mediatek: snfi: adjust drive strength to 12mA like old
loader does
In addition to FM35X1GA, also change the driver strength to 12mA for
all chips where this is done by the old/legacy U-Boot:
* Winbond 512Mb
* Winbond 1Gb
* Winbond 2Gb
* GD5F4GQ4UBYIG
* GD5F4GQ4UAYIG
* GD5F1GQ4UX
* GD5F1GQ4UE
* GD5F2GQ4UX
* GD5F2GQ4UE
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
.../apsoc_common/drivers/snfi/mtk-snand-ids.c | 59 ++++++++++++++-----
1 file changed, 44 insertions(+), 15 deletions(-)
--- a/plat/mediatek/apsoc_common/drivers/snfi/mtk-snand-ids.c
+++ b/plat/mediatek/apsoc_common/drivers/snfi/mtk-snand-ids.c
@@ -80,65 +80,94 @@ static const struct snand_flash_info sna
SNAND_INFO("W25N512GV", SNAND_ID(SNAND_ID_DYMMY, 0xef, 0xaa, 0x20),
SNAND_MEMORG_512M_2K_64,
&snand_cap_read_from_cache_quad,
- &snand_cap_program_load_x4),
+ &snand_cap_program_load_x4,
+ NULL,
+ SNAND_DRV_12mA),
SNAND_INFO("W25N01GV", SNAND_ID(SNAND_ID_DYMMY, 0xef, 0xaa, 0x21),
SNAND_MEMORG_1G_2K_64,
&snand_cap_read_from_cache_quad,
- &snand_cap_program_load_x4),
+ &snand_cap_program_load_x4,
+ NULL,
+ SNAND_DRV_12mA),
SNAND_INFO("W25M02GV", SNAND_ID(SNAND_ID_DYMMY, 0xef, 0xab, 0x21),
SNAND_MEMORG_2G_2K_64_2D,
&snand_cap_read_from_cache_quad,
&snand_cap_program_load_x4,
- mtk_snand_winbond_select_die),
+ mtk_snand_winbond_select_die,
+ SNAND_DRV_12mA),
SNAND_INFO("W25N02KV", SNAND_ID(SNAND_ID_DYMMY, 0xef, 0xaa, 0x22),
SNAND_MEMORG_2G_2K_128,
&snand_cap_read_from_cache_quad,
- &snand_cap_program_load_x4),
+ &snand_cap_program_load_x4,
+ NULL,
+ SNAND_DRV_12mA),
SNAND_INFO("GD5F1GQ4UAWxx", SNAND_ID(SNAND_ID_ADDR, 0xc8, 0x10),
SNAND_MEMORG_1G_2K_64,
&snand_cap_read_from_cache_quad_q2d,
- &snand_cap_program_load_x4),
+ &snand_cap_program_load_x4,
+ NULL,
+ SNAND_DRV_12mA),
SNAND_INFO("GD5F1GQ4UExIG", SNAND_ID(SNAND_ID_ADDR, 0xc8, 0xd1),
SNAND_MEMORG_1G_2K_128,
&snand_cap_read_from_cache_quad_q2d,
- &snand_cap_program_load_x4),
+ &snand_cap_program_load_x4,
+ NULL,
+ SNAND_DRV_12mA),
SNAND_INFO("GD5F1GQ4UExxH", SNAND_ID(SNAND_ID_ADDR, 0xc8, 0xd9),
SNAND_MEMORG_1G_2K_64,
&snand_cap_read_from_cache_quad_q2d,
- &snand_cap_program_load_x4),
+ &snand_cap_program_load_x4,
+ NULL,
+ SNAND_DRV_12mA),
SNAND_INFO("GD5F1GQ4xAYIG", SNAND_ID(SNAND_ID_ADDR, 0xc8, 0xf1),
SNAND_MEMORG_1G_2K_64,
&snand_cap_read_from_cache_quad_q2d,
- &snand_cap_program_load_x4),
+ &snand_cap_program_load_x4,
+ NULL,
+ SNAND_DRV_12mA),
SNAND_INFO("GD5F2GQ4UExIG", SNAND_ID(SNAND_ID_ADDR, 0xc8, 0xd2),
SNAND_MEMORG_2G_2K_128,
&snand_cap_read_from_cache_quad_q2d,
- &snand_cap_program_load_x4),
+ &snand_cap_program_load_x4,
+ NULL,
+ SNAND_DRV_12mA),
SNAND_INFO("GD5F2GQ5UExxH", SNAND_ID(SNAND_ID_ADDR, 0xc8, 0x32),
SNAND_MEMORG_2G_2K_64,
&snand_cap_read_from_cache_quad_a8d,
- &snand_cap_program_load_x4),
+ &snand_cap_program_load_x4,
+ NULL,
+ SNAND_DRV_12mA),
SNAND_INFO("GD5F2GQ4xAYIG", SNAND_ID(SNAND_ID_ADDR, 0xc8, 0xf2),
SNAND_MEMORG_2G_2K_64,
&snand_cap_read_from_cache_quad_q2d,
- &snand_cap_program_load_x4),
+ &snand_cap_program_load_x4,
+ NULL,
+ SNAND_DRV_12mA),
SNAND_INFO("GD5F4GQ4UBxIG", SNAND_ID(SNAND_ID_ADDR, 0xc8, 0xd4),
SNAND_MEMORG_4G_4K_256,
&snand_cap_read_from_cache_quad_q2d,
- &snand_cap_program_load_x4),
+ &snand_cap_program_load_x4,
+ NULL,
+ SNAND_DRV_12mA),
SNAND_INFO("GD5F4GQ4xAYIG", SNAND_ID(SNAND_ID_ADDR, 0xc8, 0xf4),
SNAND_MEMORG_4G_2K_64,
&snand_cap_read_from_cache_quad_q2d,
- &snand_cap_program_load_x4),
+ &snand_cap_program_load_x4,
+ NULL,
+ SNAND_DRV_12mA),
SNAND_INFO("GD5F2GQ5UExxG", SNAND_ID(SNAND_ID_DYMMY, 0xc8, 0x52),
SNAND_MEMORG_2G_2K_128,
&snand_cap_read_from_cache_quad_a8d,
- &snand_cap_program_load_x4),
+ &snand_cap_program_load_x4,
+ NULL,
+ SNAND_DRV_12mA),
SNAND_INFO("GD5F4GQ4UCxIG", SNAND_ID(SNAND_ID_DYMMY, 0xc8, 0xb4),
SNAND_MEMORG_4G_4K_256,
&snand_cap_read_from_cache_quad_q2d,
- &snand_cap_program_load_x4),
+ &snand_cap_program_load_x4,
+ NULL,
+ SNAND_DRV_12mA),
SNAND_INFO("MX35LF1GE4AB", SNAND_ID(SNAND_ID_DYMMY, 0xc2, 0x12),
SNAND_MEMORG_1G_2K_64,

View File

@ -0,0 +1,81 @@
# SPDX-License-Identifier: GPL-2.0-only
#
# Copyright (C) 2022 ImmortalWrt.org
include $(TOPDIR)/rules.mk
PKG_NAME:=arm-trusted-firmware-rockchip-vendor
PKG_RELEASE:=$(AUTORELEASE)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=https://github.com/rockchip-linux/rkbin.git
PKG_SOURCE_DATE:=2022-08-01
PKG_SOURCE_VERSION:=b0c100f1a260d807df450019774993c761beb79d
PKG_MIRROR_HASH:=17723ac8f6ec446c759444ee29ba4fe544cebb3785e26d8e10c91c54b9df3f1a
PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
MAKE_PATH:=$(PKG_NAME)
include $(INCLUDE_DIR)/package.mk
define Package/arm-trusted-firmware-rockchip-vendor
SECTION:=boot
CATEGORY:=Boot Loaders
TITLE:=ARM Trusted Firmware for Rockchip
endef
define Package/arm-trusted-firmware-rk3328
$(Package/arm-trusted-firmware-rockchip-vendor)
DEPENDS:=@TARGET_rockchip_armv8
VARIANT:=rk3328
endef
define Package/arm-trusted-firmware-rk3399
$(Package/arm-trusted-firmware-rockchip-vendor)
DEPENDS:=@TARGET_rockchip_armv8
VARIANT:=rk3399
endef
define Package/arm-trusted-firmware-rk3568
$(Package/arm-trusted-firmware-rockchip-vendor)
DEPENDS:=@TARGET_rockchip_armv8
VARIANT:=rk3568
endef
define Package/arm-trusted-firmware-rk3588
$(Package/arm-trusted-firmware-rockchip-vendor)
DEPENDS:=@TARGET_rockchip_armv8
VARIANT:=rk3588
endef
define Build/Configure
$(SED) 's,$$$$(PKG_BUILD_DIR),$(PKG_BUILD_DIR),g' $(PKG_BUILD_DIR)/trust.ini
$(SED) 's,$$$$(VARIANT),$(BUILD_VARIANT),g' $(PKG_BUILD_DIR)/trust.ini
$(call Build/Configure/Default)
endef
define Build/Compile
$(CURDIR)/pack-firmware.sh build $(BUILD_VARIANT) '$(PKG_BUILD_DIR)'
endef
define Build/InstallDev
$(CURDIR)/pack-firmware.sh install $(BUILD_VARIANT) '$(PKG_BUILD_DIR)' '$(STAGING_DIR_IMAGE)'
endef
define Package/arm-trusted-firmware-rk3328/install
endef
define Package/arm-trusted-firmware-rk3399/install
endef
define Package/arm-trusted-firmware-rk3568/install
endef
define Package/arm-trusted-firmware-rk3588/install
endef
$(eval $(call BuildPackage,arm-trusted-firmware-rk3328))
$(eval $(call BuildPackage,arm-trusted-firmware-rk3399))
$(eval $(call BuildPackage,arm-trusted-firmware-rk3568))
$(eval $(call BuildPackage,arm-trusted-firmware-rk3588))

View File

@ -0,0 +1,60 @@
#!/bin/bash
# Copyright (C) 2021 ImmortalWrt.org
ACTION="$1"
VARIANT="$2"
PKG_BUILD_DIR="$3"
STAGING_DIR_IMAGE="$4"
case "$VARIANT" in
"rk3328")
ATF="rk33/rk322xh_bl31_v1.49.elf"
DDR="rk33/rk3328_ddr_333MHz_v1.19.bin"
LOADER="rk33/rk322xh_miniloader_v2.50.bin"
;;
"rk3399")
ATF="rk33/rk3399_bl31_v1.35.elf"
DDR="rk33/rk3399_ddr_800MHz_v1.27.bin"
LOADER="rk33/rk3399_miniloader_v1.26.bin"
;;
"rk3568")
ATF="rk35/rk3568_bl31_v1.28.elf"
DDR="rk35/rk3568_ddr_1560MHz_v1.13.bin"
;;
"rk3588")
ATF="rk35/rk3588_bl31_v1.27.elf"
DDR="rk35/rk3588_ddr_lp4_2112MHz_lp5_2736MHz_v1.08.bin"
;;
*)
echo -e "Not compatible with your platform: $VARIANT."
exit 1
;;
esac
set -x
if [ "$ACTION" == "build" ]; then
case "$VARIANT" in
rk33*)
"$PKG_BUILD_DIR"/tools/mkimage -n "$VARIANT" -T "rksd" -d "$PKG_BUILD_DIR/bin/$DDR" "$PKG_BUILD_DIR/$VARIANT-idbloader.bin"
cat "$PKG_BUILD_DIR/bin/$LOADER" >> "$PKG_BUILD_DIR/$VARIANT-idbloader.bin"
"$PKG_BUILD_DIR/tools/trust_merger" --replace "bl31.elf" "$PKG_BUILD_DIR/bin/$ATF" "$PKG_BUILD_DIR/trust.ini"
;;
esac
elif [ "$ACTION" == "install" ]; then
mkdir -p "$STAGING_DIR_IMAGE"
cp -fp "$PKG_BUILD_DIR/bin/$ATF" "$STAGING_DIR_IMAGE"/
case "$VARIANT" in
rk33*)
cp -fp "$PKG_BUILD_DIR/tools/loaderimage" "$STAGING_DIR_IMAGE"/
cp -fp "$PKG_BUILD_DIR/$VARIANT-idbloader.bin" "$STAGING_DIR_IMAGE"/
cp -fp "$PKG_BUILD_DIR/$VARIANT-trust.bin" "$STAGING_DIR_IMAGE"/
;;
rk35*)
cp -fp "$PKG_BUILD_DIR/bin/$DDR" "$STAGING_DIR_IMAGE"/
;;
esac
else
echo -e "Unknown operation: $ACTION."
exit 1
fi
set +x

View File

@ -7,88 +7,43 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_VERSION:=2.12 PKG_NAME:=arm-trusted-firmware-rockchip
PKG_VERSION:=2.3
PKG_RELEASE:=1 PKG_RELEASE:=1
PKG_HASH:=b4c047493cac1152203e1ba121ae57267e4899b7bf56eb365e22a933342d31c9 PKG_SOURCE:=atf-v$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://github.com/atf-builds/atf/releases/download/v$(PKG_VERSION)/atf-v$(PKG_VERSION).tar.gz?
PKG_HASH:=bf352298743aed594cf2958dd588e06ab6713fc514bb6f809bf55a85a87134c1
PKG_LICENSE:=BSD-3-Clause
PKG_LICENSE_FILES:=license.md
PKG_MAINTAINER:=Tobias Maedel <openwrt@tbspace.de> PKG_MAINTAINER:=Tobias Maedel <openwrt@tbspace.de>
include $(INCLUDE_DIR)/kernel.mk MAKE_PATH:=$(PKG_NAME)
include $(INCLUDE_DIR)/trusted-firmware-a.mk
include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/package.mk
define Trusted-Firmware-A/Default define Package/arm-trusted-firmware-rockchip
NAME:=Rockchip $(1) SoCs SECTION:=boot
BUILD_TARGET:=rockchip CATEGORY:=Boot Loaders
TITLE:=ARM Trusted Firmware for Rockchip
DEPENDS:=@TARGET_rockchip_armv8
endef endef
define Trusted-Firmware-A/rk3328 define Build/Prepare
BUILD_SUBTARGET:=armv8 $(TAR) -C $(PKG_BUILD_DIR) -xf $(DL_DIR)/$(PKG_SOURCE)
PLAT=rk3328
endef endef
define Trusted-Firmware-A/rk3399
BUILD_SUBTARGET:=armv8
PLAT:=rk3399
endef
define Trusted-Firmware-A/rk3568
BUILD_SUBTARGET:=armv8
PLAT:=rk3568
endef
define Trusted-Firmware-A/rk3588
BUILD_SUBTARGET:=armv8
PLAT:=rk3588
endef
TFA_TARGETS:= \
rk3328 \
rk3399 \
rk3568 \
rk3588
ifeq ($(BUILD_VARIANT),rk3399)
M0_GCC_NAME:=gcc-arm
M0_GCC_RELEASE:=11.2-2022.02
M0_GCC_VERSION:=$(HOST_ARCH)-arm-none-eabi
M0_GCC_SOURCE:=$(M0_GCC_NAME)-$(M0_GCC_RELEASE)-$(M0_GCC_VERSION).tar.xz
define Download/m0-gcc
FILE:=$(M0_GCC_SOURCE)
URL:=https://developer.arm.com/-/media/Files/downloads/gnu/$(M0_GCC_RELEASE)/binrel
ifeq ($(HOST_ARCH),aarch64)
HASH:=ef1d82e5894e3908cb7ed49c5485b5b95deefa32872f79c2b5f6f5447cabf55f
else
HASH:=8c5acd5ae567c0100245b0556941c237369f210bceb196edfe5a2e7532c60326
endif
endef
define Build/Prepare
$(eval $(call Download,m0-gcc))
$(call Build/Prepare/Default)
xzcat $(DL_DIR)/$(M0_GCC_SOURCE) | $(HOST_TAR) -C $(PKG_BUILD_DIR)/ $(TAR_OPTIONS)
endef
TFA_MAKE_FLAGS+= \
M0_CROSS_COMPILE=$(PKG_BUILD_DIR)/$(M0_GCC_NAME)-$(M0_GCC_RELEASE)-$(M0_GCC_VERSION)/bin/arm-none-eabi-
endif
define Build/Compile define Build/Compile
+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
CROSS_COMPILE=$(TARGET_CROSS) \
OPENSSL_DIR=$(STAGING_DIR_HOST) \
$(if $(DTC),DTC="$(DTC)") \
PLAT=$(PLAT) \
BUILD_STRING="OpenWrt ($(VARIANT))" \
$(TFA_MAKE_FLAGS)
endef endef
define Package/trusted-firmware-a/install define Build/InstallDev
$(INSTALL_DIR) $(STAGING_DIR_IMAGE) $(INSTALL_DIR) -p $(STAGING_DIR_IMAGE)
$(INSTALL_DATA) $(PKG_BUILD_DIR)/build/$(PLAT)/release/bl31/bl31.elf $(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)_bl31.elf $(CP) $(PKG_BUILD_DIR)/rk*.elf $(STAGING_DIR_IMAGE)/
endef endef
$(eval $(call BuildPackage/Trusted-Firmware-A)) define Package/arm-trusted-firmware-rockchip/install
endef
$(eval $(call BuildPackage,arm-trusted-firmware-rockchip))

View File

@ -7,10 +7,14 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_VERSION:=2.10 PKG_NAME:=arm-trusted-firmware-sunxi
PKG_RELEASE:=1 PKG_RELEASE:=1
PKG_HASH:=88215a62291b9ba87da8e50b077741103cdc08fb6c9e1ebd34dfaace746d3201 PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=https://github.com/ARM-software/arm-trusted-firmware
PKG_SOURCE_DATE:=2020-11-17
PKG_SOURCE_VERSION:=e2c509a39c6cc4dda8734e6509cdbe6e3603cdfc
PKG_MIRROR_HASH:=b212d369a5286ebbf6a5616486efa05fa54d4294fd6e9ba2e54fdfae9eda918d
PKG_LICENSE:=BSD-3-Clause PKG_LICENSE:=BSD-3-Clause
PKG_LICENSE_FILES:=license.md PKG_LICENSE_FILES:=license.md
@ -36,15 +40,9 @@ define Trusted-Firmware-A/sunxi-h6
PLAT:=sun50i_h6 PLAT:=sun50i_h6
endef endef
define Trusted-Firmware-A/sunxi-h616
NAME:=Allwinner H616
PLAT:=sun50i_h616
endef
TFA_TARGETS:= \ TFA_TARGETS:= \
sunxi-a64 \ sunxi-a64 \
sunxi-h6 \ sunxi-h6
sunxi-h616
define Package/trusted-firmware-a/install define Package/trusted-firmware-a/install
$(INSTALL_DIR) $(STAGING_DIR_IMAGE) $(INSTALL_DIR) $(STAGING_DIR_IMAGE)

View File

@ -8,9 +8,9 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=arm-trusted-firmware-tools PKG_NAME:=arm-trusted-firmware-tools
PKG_VERSION:=2.9 PKG_VERSION:=2.7
PKG_RELEASE:=1 PKG_RELEASE:=1
PKG_HASH:=76a66a1de0c01aeb83dfc7b72b51173fe62c6e51d6fca17cc562393117bed08b PKG_HASH:=53422dc649153838e03820330ba17cb10afe3e330ecde0db11e4d5f1361a33e6
PKG_MAINTAINER:=Daniel Golle <daniel@makrotopia.org> PKG_MAINTAINER:=Daniel Golle <daniel@makrotopia.org>
PKG_HOST_ONLY:=1 PKG_HOST_ONLY:=1

View File

@ -6,12 +6,12 @@ include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=grub PKG_NAME:=grub
PKG_VERSION:=2.12 PKG_VERSION:=2.06
PKG_RELEASE:=6 PKG_RELEASE:=$(AUTORELEASE)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=@GNU/grub PKG_SOURCE_URL:=@GNU/grub
PKG_HASH:=f3c97391f7c4eaa677a78e090c7e97e6dc47b16f655f04683ebd37bef7fe0faa PKG_HASH:=b79ea44af91b93d17cd3fe80bdae6ed43770678a9a5ae192ccea803ebb657ee1
PKG_LICENSE:=GPL-3.0-or-later PKG_LICENSE:=GPL-3.0-or-later
PKG_CPE_ID:=cpe:/a:gnu:grub2 PKG_CPE_ID:=cpe:/a:gnu:grub2
@ -25,7 +25,6 @@ ifneq ($(BUILD_VARIANT),none)
endif endif
PKG_FLAGS:=nonshared PKG_FLAGS:=nonshared
PKG_BUILD_FLAGS:=no-gc-sections no-lto no-mold
include $(INCLUDE_DIR)/host-build.mk include $(INCLUDE_DIR)/host-build.mk
include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/package.mk
@ -33,18 +32,14 @@ include $(INCLUDE_DIR)/package.mk
define Package/grub2/Default define Package/grub2/Default
CATEGORY:=Boot Loaders CATEGORY:=Boot Loaders
SECTION:=boot SECTION:=boot
TITLE:=GRand Unified Bootloader ($(2)) TITLE:=GRand Unified Bootloader ($(1))
URL:=http://www.gnu.org/software/grub/ URL:=http://www.gnu.org/software/grub/
DEPENDS:=@(TARGET_x86||TARGET_armsr||TARGET_armvirt||TARGET_phytium_armv8||TARGET_loongarch64) DEPENDS:=@TARGET_x86
VARIANT:=$(2) VARIANT:=$(1)
endef endef
Package/grub2=$(call Package/grub2/Default,x86,pc) Package/grub2=$(call Package/grub2/Default,pc)
Package/grub2-efi=$(call Package/grub2/Default,x86,efi) Package/grub2-efi=$(call Package/grub2/Default,efi)
Package/grub2-efi-arm=$(call Package/grub2/Default,armsr,efi)
Package/grub2-efi-arm=$(call Package/grub2/Default,armvirt,efi)
Package/grub2-efi-arm=$(call Package/grub2/Default,phytium_armv8,efi)
Package/grub2-efi-loongarch64=$(call Package/grub2/Default,loongarch64,efi)
define Package/grub2-editenv define Package/grub2-editenv
CATEGORY:=Utilities CATEGORY:=Utilities
@ -111,10 +106,6 @@ ifneq ($(BUILD_VARIANT),none)
MAKE_PATH := grub-core MAKE_PATH := grub-core
endif endif
ifeq ($(CONFIG_arm),y)
TARGET_CFLAGS := $(filter-out -mfloat-abi=hard,$(TARGET_CFLAGS))
endif
define Host/Configure define Host/Configure
$(SED) 's,(RANLIB),(TARGET_RANLIB),' $(HOST_BUILD_DIR)/grub-core/Makefile.in $(SED) 's,(RANLIB),(TARGET_RANLIB),' $(HOST_BUILD_DIR)/grub-core/Makefile.in
$(Host/Configure/Default) $(Host/Configure/Default)
@ -131,14 +122,14 @@ define Package/grub2/install
-O i386-pc \ -O i386-pc \
-c $(PKG_BUILD_DIR)/grub-early.cfg \ -c $(PKG_BUILD_DIR)/grub-early.cfg \
-o $(STAGING_DIR_IMAGE)/grub2/gpt-core.img \ -o $(STAGING_DIR_IMAGE)/grub2/gpt-core.img \
at_keyboard biosdisk boot chain configfile fat linux ls part_gpt reboot search serial test vga at_keyboard biosdisk boot chain configfile fat linux ls part_gpt reboot search serial vga
$(STAGING_DIR_HOST)/bin/grub-mkimage \ $(STAGING_DIR_HOST)/bin/grub-mkimage \
-d $(PKG_BUILD_DIR)/grub-core \ -d $(PKG_BUILD_DIR)/grub-core \
-p /boot/grub \ -p /boot/grub \
-O i386-pc \ -O i386-pc \
-c ./files/grub-early.cfg \ -c ./files/grub-early.cfg \
-o $(STAGING_DIR_IMAGE)/grub2/generic-core.img \ -o $(STAGING_DIR_IMAGE)/grub2/generic-core.img \
at_keyboard biosdisk boot chain configfile ext2 linux ls part_msdos reboot search serial test vga at_keyboard biosdisk boot chain configfile ext2 linux ls part_msdos reboot search serial vga
$(STAGING_DIR_HOST)/bin/grub-mkimage \ $(STAGING_DIR_HOST)/bin/grub-mkimage \
-d $(PKG_BUILD_DIR)/grub-core \ -d $(PKG_BUILD_DIR)/grub-core \
-p /boot/grub \ -p /boot/grub \
@ -163,51 +154,16 @@ define Package/grub2-efi/install
-O $(CONFIG_ARCH)-efi \ -O $(CONFIG_ARCH)-efi \
-c $(PKG_BUILD_DIR)/grub-early.cfg \ -c $(PKG_BUILD_DIR)/grub-early.cfg \
-o $(STAGING_DIR_IMAGE)/grub2/boot$(if $(CONFIG_x86_64),x64,ia32).efi \ -o $(STAGING_DIR_IMAGE)/grub2/boot$(if $(CONFIG_x86_64),x64,ia32).efi \
at_keyboard boot chain configfile fat linux ls part_gpt reboot serial test efi_gop efi_uga at_keyboard boot chain configfile fat linux ls part_gpt reboot serial efi_gop efi_uga
$(STAGING_DIR_HOST)/bin/grub-mkimage \ $(STAGING_DIR_HOST)/bin/grub-mkimage \
-d $(PKG_BUILD_DIR)/grub-core \ -d $(PKG_BUILD_DIR)/grub-core \
-p /boot/grub \ -p /boot/grub \
-O $(CONFIG_ARCH)-efi \ -O $(CONFIG_ARCH)-efi \
-c ./files/grub-early.cfg \ -c ./files/grub-early.cfg \
-o $(STAGING_DIR_IMAGE)/grub2/iso-boot$(if $(CONFIG_x86_64),x64,ia32).efi \ -o $(STAGING_DIR_IMAGE)/grub2/iso-boot$(if $(CONFIG_x86_64),x64,ia32).efi \
boot chain configfile fat iso9660 linux ls part_msdos part_gpt reboot serial test efi_gop efi_uga at_keyboard boot chain configfile fat iso9660 linux ls part_msdos part_gpt reboot serial test efi_gop efi_uga
endef endef
define Package/grub2-efi-arm/install
$(INSTALL_DIR) $(STAGING_DIR_IMAGE)/grub2
cp ./files/grub-early-gpt.cfg $(PKG_BUILD_DIR)/grub-early.cfg
$(STAGING_DIR_HOST)/bin/grub-mkimage \
-d $(PKG_BUILD_DIR)/grub-core \
-p /boot/grub \
-O arm$(if $(CONFIG_aarch64),64,)-efi \
-c $(PKG_BUILD_DIR)/grub-early.cfg \
-o $(STAGING_DIR_IMAGE)/grub2/boot$(if $(CONFIG_aarch64),aa64,arm).efi \
boot chain configfile fat linux ls part_gpt part_msdos reboot search \
search_fs_uuid search_label serial efi_gop lsefi minicmd ext2
$(STAGING_DIR_HOST)/bin/grub-mkimage \
-d $(PKG_BUILD_DIR)/grub-core \
-p /boot/grub \
-O arm$(if $(CONFIG_aarch64),64,)-efi \
-c ./files/grub-early.cfg \
-o $(STAGING_DIR_IMAGE)/grub2/iso-bootaa$(if $(CONFIG_aarch64),aa64,arm).efi \
boot chain configfile fat iso9660 linux ls lsefi minicmd part_msdos part_gpt \
reboot serial test efi_gop
endef
define Package/grub2-efi-loongarch64/install
$(INSTALL_DIR) $(STAGING_DIR_IMAGE)/grub2
cp ./files/grub-early-gpt.cfg $(PKG_BUILD_DIR)/grub-early.cfg
$(STAGING_DIR_HOST)/bin/grub-mkimage \
-d $(PKG_BUILD_DIR)/grub-core \
-p /boot/grub \
-O loongarch64-efi \
-c $(PKG_BUILD_DIR)/grub-early.cfg \
-o $(STAGING_DIR_IMAGE)/grub2/bootloongarch64.efi \
boot chain configfile fat linux ls lsefi minicmd part_gpt part_msdos reboot search \
search_fs_uuid search_label serial efi_gop all_video gfxterm ext2
endef
define Package/grub2-editenv/install define Package/grub2-editenv/install
$(INSTALL_DIR) $(1)/usr/sbin $(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/grub-editenv $(1)/usr/sbin/ $(INSTALL_BIN) $(PKG_BUILD_DIR)/grub-editenv $(1)/usr/sbin/
@ -221,7 +177,5 @@ endef
$(eval $(call HostBuild)) $(eval $(call HostBuild))
$(eval $(call BuildPackage,grub2)) $(eval $(call BuildPackage,grub2))
$(eval $(call BuildPackage,grub2-efi)) $(eval $(call BuildPackage,grub2-efi))
$(eval $(call BuildPackage,grub2-efi-arm))
$(eval $(call BuildPackage,grub2-efi-loongarch64))
$(eval $(call BuildPackage,grub2-editenv)) $(eval $(call BuildPackage,grub2-editenv))
$(eval $(call BuildPackage,grub2-bios-setup)) $(eval $(call BuildPackage,grub2-bios-setup))

View File

@ -1,2 +0,0 @@
search --set=root --label kernel
configfile ($root)/efi/openwrt/grub.cfg

View File

@ -1,36 +0,0 @@
From 4d4dae6a52b1749642261a15f5dcc1e3d4150b36 Mon Sep 17 00:00:00 2001
From: Julien Olivain <ju.o@free.fr>
Date: Fri, 22 Dec 2023 19:02:53 +0100
Subject: [PATCH] Add missing grub-core/extra_deps.lst file in release tarball
A file is missing in the grub-2.12 release tarballs (both .gz and .xz).
See [1]. The issue was reported in [2] and fixed upstream in [3].
This patch adds the missing file, on top of the release tarball. This
patch won't apply on upstream git, since the file is present in the
source repository. Since the issue is fixed upstream in [3], it is
expected upcoming releases tarballs will include the file.
The file content was fetched from the upstream git repo:
https://git.savannah.gnu.org/gitweb/?p=grub.git;a=blob_plain;f=grub-core/extra_deps.lst;hb=refs/tags/grub-2.12
[1] https://ftp.gnu.org/gnu/grub/grub-2.12.tar.xz
[2] https://lists.gnu.org/archive/html/grub-devel/2023-12/msg00054.html
[3] https://git.savannah.gnu.org/gitweb/?p=grub.git;a=commit;h=b835601c7639ed1890f2d3db91900a8506011a8e
Signed-off-by: Julien Olivain <ju.o@free.fr>
Upstream: Fixed by: https://git.savannah.gnu.org/gitweb/?p=grub.git;a=commit;h=b835601c7639ed1890f2d3db91900a8506011a8e
---
grub-core/extra_deps.lst | 1 +
1 file changed, 1 insertion(+)
create mode 100644 grub-core/extra_deps.lst
diff --git a/grub-core/extra_deps.lst b/grub-core/extra_deps.lst
new file mode 100644
index 0000000..f44ad6a
--- /dev/null
+++ b/grub-core/extra_deps.lst
@@ -0,0 +1 @@
+depends bli part_gpt
--
2.43.0

View File

@ -1,63 +0,0 @@
# SPDX-License-Identifier: GPL-2.0-only
#
# Copyright (C) 2022 OpenWrt.org
#
include $(TOPDIR)/rules.mk
PKG_NAME:=opensbi
PKG_RELEASE:=1.2
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=https://github.com/riscv/opensbi
PKG_SOURCE_DATE:=2022-12-24
PKG_SOURCE_VERSION:=6b5188ca14e59ce7bf71afe4e7d3d557c3d31bf8
PKG_MIRROR_HASH:=edcdd99da6c62975171981c0aa2b73a27091067da11ccd49816b5ad27d000858
PKG_BUILD_DIR=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
PKG_TARGETS:=bin
PKG_FLAGS:=nonshared
PKG_LICENSE:=BSD-2-Clause
PKG_LICENSE_FILES:=COPYING.BSD
PKG_BUILD_PARALLEL:=1
PKG_MAINTAINER:=Zoltan HERPAI <wigyori@uid0.hu>
include $(INCLUDE_DIR)/package.mk
define Package/opensbi
SECTION:=boot
CATEGORY:=Boot Loaders
DEPENDS:=@TARGET_sifiveu
URL:=https://github.com/riscv/opensbi/blob/master/README.md
VARIANT:=$(subst _,/,$(subst opensbi_,,$(1)))
TITLE:=OpenSBI generic
OPENSBI_IMAGE:=
PLAT:=
endef
define Package/opensbi_generic
$(Package/opensbi)
TITLE:=OpenSBI generic
OPENSBI_IMAGE:=fw_dynamic.bin
PLAT:=generic
endef
export GCC_HONOUR_COPTS=s
MAKE_VARS = \
CROSS_COMPILE="$(TARGET_CROSS)"
define Build/Compile
$(eval $(Package/opensbi_$(BUILD_VARIANT))) \
+$(MAKE_VARS) $(MAKE) -C $(PKG_BUILD_DIR) \
PLATFORM=$(PLAT)
endef
define Build/InstallDev
$(INSTALL_DIR) $(STAGING_DIR_IMAGE)
$(CP) $(PKG_BUILD_DIR)/build/platform/$(PLAT)/firmware/fw_dynamic.bin $(STAGING_DIR_IMAGE)/fw_dynamic-${BUILD_VARIANT}.bin
endef
$(eval $(call BuildPackage,opensbi_generic))

View File

@ -1,129 +0,0 @@
# SPDX-License-Identifier: GPL-2.0-only
#
# Copyright (C) 2021-2023 ImmortalWrt.org
include $(TOPDIR)/rules.mk
PKG_NAME:=rkbin
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/rockchip-linux/rkbin.git
PKG_SOURCE_DATE:=2024-10-18
PKG_SOURCE_VERSION:=12660714c81be85350a4092542e2ff599aa5adcb
PKG_MIRROR_HASH:=30f8ba3ca250dac4c60d1b642e7b3436daf091ace67f600a3bfdd5983bfa98a6
PKG_LICENSE_FILES:=LICENSE
PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
include $(INCLUDE_DIR)/package.mk
define Build/rkbin/Target
$(eval $(call rkbin/Default,$(1)))
$(eval $(call rkbin/$(1),$(1)))
define Package/rkbin-$(1)
SECTION:=boot
CATEGORY:=Boot Loaders
TITLE:=Rockchip rkbin for $(1) SoCs
DEPENDS:=$(DEPENDS)
VARIANT:=$(1)
endef
define Package/rkbin-$(1)/install
$$(Package/rkbin/install)
endef
endef
define rkbin/rk3328
DEPENDS:=@TARGET_rockchip_armv8
ATF:=rk33/rk322xh_bl31_v1.49.elf
TPL:=rk33/rk3328_ddr_333MHz_v1.19.bin
SPL:=rk33/rk322xh_miniloader_v2.50.bin
endef
define rkbin/rk3399
DEPENDS:=@TARGET_rockchip_armv8
ATF:=rk33/rk3399_bl31_v1.36.elf
TPL:=rk33/rk3399_ddr_800MHz_v1.30.bin
SPL:=rk33/rk3399_miniloader_v1.30.bin
endef
define rkbin/rk3528
DEPENDS:=@TARGET_rockchip_armv8
ATF:=rk35/rk3528_bl31_v1.17.elf
TPL:=rk35/rk3528_ddr_1056MHz_v1.10.bin
endef
define rkbin/rk3566
DEPENDS:=@TARGET_rockchip_armv8
ATF:=rk35/rk3568_bl31_v1.44.elf
TPL:=rk35/rk3566_ddr_1056MHz_v1.23.bin
endef
define rkbin/rk3568
DEPENDS:=@TARGET_rockchip_armv8
ATF:=rk35/rk3568_bl31_v1.44.elf
TPL:=rk35/rk3568_ddr_1560MHz_v1.23.bin
endef
define rkbin/rk3576
DEPENDS:=@TARGET_rockchip_armv8
ATF:=rk35/rk3576_bl31_v1.12.elf
TPL:=rk35/rk3576_ddr_lp4_2112MHz_lp5_2736MHz_v1.08.bin
endef
define rkbin/rk3588
DEPENDS:=@TARGET_rockchip_armv8
ATF:=rk35/rk3588_bl31_v1.47.elf
TPL:=rk35/rk3588_ddr_lp4_2112MHz_lp5_2400MHz_v1.18.bin
endef
VARIANTS:= \
rk3328 \
rk3399 \
rk3528 \
rk3566 \
rk3568 \
rk3576 \
rk3588
define Build/Compile
@echo Building idbLoader from Rockchip rkbin project...
ifneq ($(SPL),)
( \
pushd $(PKG_BUILD_DIR) ; \
$(SED) 's,$$$$(PKG_BUILD_DIR),$(PKG_BUILD_DIR),g' trust.ini ; \
$(SED) 's,$$$$(VARIANT),$(BUILD_VARIANT),g' trust.ini ; \
./tools/mkimage -n $(BUILD_VARIANT) -T rksd -d bin/$(TPL) \
$(BUILD_VARIANT)-idbloader.bin ; \
cat bin/$(SPL) >> $(BUILD_VARIANT)-idbloader.bin ; \
./tools/trust_merger --replace bl31.elf bin/$(ATF) trust.ini ; \
popd ; \
)
endif
endef
define BuildPackage/rkbin
$(foreach type,$(if $(DUMP),$(VARIANTS),$(BUILD_VARIANT)), \
$(eval $(call Build/rkbin/Target,$(type)))
)
$(eval $(call Build/DefaultTargets))
$(foreach type,$(if $(DUMP),$(VARIANTS),$(BUILD_VARIANT)), \
$(call BuildPackage,rkbin-$(type))
)
endef
define Package/rkbin/install
$(INSTALL_DIR) $(STAGING_DIR_IMAGE)
$(CP) $(PKG_BUILD_DIR)/bin/$(ATF) $(STAGING_DIR_IMAGE)/
$(CP) $(PKG_BUILD_DIR)/bin/$(TPL) $(STAGING_DIR_IMAGE)/
ifneq ($(SPL),)
$(CP) $(PKG_BUILD_DIR)/tools/loaderimage $(STAGING_DIR_IMAGE)/
$(CP) $(PKG_BUILD_DIR)/$(BUILD_VARIANT)-idbloader.bin $(STAGING_DIR_IMAGE)/
$(CP) $(PKG_BUILD_DIR)/$(BUILD_VARIANT)-trust.bin $(STAGING_DIR_IMAGE)/
endif
endef
$(eval $(call BuildPackage/rkbin))

View File

@ -1,57 +0,0 @@
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_VERSION:=20240315
PKG_RELEASE:=$(AUTORELEASE)
PKG_SOURCE_PROTO:=default
PKG_SOURCE:=ophub-uboot-prebuilt-git-$(PKG_VERSION).tar.gz
PKG_SOURCE_VERSION:=abe491ab386607f9ab0d66728e5766bc5d7e8a20
PKG_SOURCE_URL_FILE:=$(PKG_SOURCE_VERSION).tar.gz
PKG_SOURCE_URL:=https://github.com/ophub/u-boot/archive/
PKG_HASH:=3f98f5728f48d13f33cf4fd21fb6032a625ad3c61aa2e8073dda821f71f067ec
PKG_MAINTAINER:=ophub
include $(INCLUDE_DIR)/u-boot.mk
include $(INCLUDE_DIR)/package.mk
TAR_OPTIONS:=--strip-components 1 $(TAR_OPTIONS)
TAR_CMD=$(HOST_TAR) -C $(1) $(TAR_OPTIONS)
define U-Boot/Default
BUILD_TARGET:=amlogic
UENV:=default
HIDDEN:=1
DEFAULT:=y
endef
define U-Boot/phicomm-n1
NAME:=Phicomm N1
OVERLAY:=u-boot-n1.bin
BUILD_SUBTARGET:=mesongx
BUILD_DEVICES:=phicomm_n1
endef
UBOOT_TARGETS := phicomm-n1
define Build/Configure
true
endef
define Build/Compile
true
endef
define Build/InstallDev
$(INSTALL_DIR) $(STAGING_DIR_IMAGE)
$(CP) $(PKG_BUILD_DIR)/u-boot/amlogic/overload/$(OVERLAY) $(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-u-boot-overlay.bin
endef
define Package/u-boot/install/default
endef
$(eval $(call BuildPackage/U-Boot))

View File

@ -19,7 +19,6 @@ alfa-network,n5q|\
alfa-network,pi-wifi4|\ alfa-network,pi-wifi4|\
alfa-network,r36a|\ alfa-network,r36a|\
alfa-network,tube-2hq|\ alfa-network,tube-2hq|\
alibaba,ap121-db|\
allnet,all-wap02860ac|\ allnet,all-wap02860ac|\
araknis,an-300-ap-i-n|\ araknis,an-300-ap-i-n|\
araknis,an-500-ap-i-ac|\ araknis,an-500-ap-i-ac|\
@ -86,7 +85,6 @@ yuncore,a930|\
yuncore,xd3200|\ yuncore,xd3200|\
yuncore,xd4200|\ yuncore,xd4200|\
ziking,cpe46b|\ ziking,cpe46b|\
zte,e8820|\
zyxel,nbg6616) zyxel,nbg6616)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x10000" ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x10000"
;; ;;

View File

@ -32,8 +32,6 @@ ubootenv_mtdinfo () {
case "$board" in case "$board" in
alfa-network,ap120c-ac|\ alfa-network,ap120c-ac|\
alibaba,ap4220-48m|\
alibaba,ap4220-128m|\
devolo,magic-2-wifi-next|\ devolo,magic-2-wifi-next|\
edgecore,ecw5211|\ edgecore,ecw5211|\
glinet,gl-a1300 |\ glinet,gl-a1300 |\

View File

@ -0,0 +1,47 @@
[ -e /etc/config/ubootenv ] && exit 0
touch /etc/config/ubootenv
. /lib/uboot-envtools.sh
. /lib/functions.sh
board=$(board_name)
case "$board" in
dynalink,dl-wrx36)
idx="$(find_mtd_index 0:appsblenv)"
[ -n "$idx" ] && \
ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x40000" "0x20000" "2"
;;
edgecore,eap102|\
zyxel,nbg7815)
idx="$(find_mtd_index 0:appsblenv)"
[ -n "$idx" ] && \
ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x10000" "0x10000" "1"
;;
edimax,cax1800)
idx="$(find_mtd_index 0:appsblenv)"
[ -n "$idx" ] && \
ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x10000" "0x20000"
;;
redmi,ax6|\
xiaomi,ax3600|\
xiaomi,ax9000)
idx="$(find_mtd_index 0:appsblenv)"
[ -n "$idx" ] && \
ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x10000" "0x20000"
idx2="$(find_mtd_index bdata)"
[ -n "$idx2" ] && \
ubootenv_add_uci_sys_config "/dev/mtd$idx2" "0x0" "0x10000" "0x20000"
;;
qnap,301w)
idx="$(find_mtd_index 0:appsblenv)"
[ -n "$idx" ] && \
ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x20000" "0x20000" "1"
;;
esac
config_load ubootenv
config_foreach ubootenv_add_app_config
exit 0

View File

@ -12,9 +12,7 @@ touch /etc/config/ubootenv
board=$(board_name) board=$(board_name)
case "$board" in case "$board" in
bananapi,bpi-r3|\ bananapi,bpi-r3)
bananapi,bpi-r4|\
bananapi,bpi-r4-poe)
case "$(cmdline_get_var root)" in case "$(cmdline_get_var root)" in
/dev/mmc*) /dev/mmc*)
local envdev=$(find_mmc_part "ubootenv" $rootdev) local envdev=$(find_mmc_part "ubootenv" $rootdev)
@ -36,24 +34,6 @@ bananapi,bpi-r4-poe)
;; ;;
esac esac
;; ;;
cetron,ct3003|\
imou,lc-hx3001)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000"
;;
glinet,gl-mt2500|\
glinet,gl-mt6000)
local envdev=$(find_mmc_part "u-boot-env")
ubootenv_add_uci_config "$envdev" "0x0" "0x80000"
;;
glinet,gl-mt3000)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x20000"
;;
openembed,som7981)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x80000"
ubootenv_add_uci_sys_config "/dev/mtd3" "0x0" "0x100000" "0x100000"
;;
xiaomi,mi-router-wr30u|\
xiaomi,mi-router-ax3000t|\
xiaomi,redmi-router-ax6000) xiaomi,redmi-router-ax6000)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x20000" ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x20000"
ubootenv_add_uci_sys_config "/dev/mtd2" "0x0" "0x10000" "0x20000" ubootenv_add_uci_sys_config "/dev/mtd2" "0x0" "0x10000" "0x20000"

View File

@ -1,61 +0,0 @@
[ -e /etc/config/ubootenv ] && exit 0
touch /etc/config/ubootenv
. /lib/uboot-envtools.sh
. /lib/functions.sh
board=$(board_name)
case "$board" in
compex,wpq873|\
edgecore,eap102|\
zyxel,nbg7815)
idx="$(find_mtd_index 0:appsblenv)"
[ -n "$idx" ] && \
ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x10000" "0x10000" "1"
;;
dynalink,dl-wrx36|\
glinet,gl-ax1800|\
glinet,gl-axt1800|\
netgear,rax120v2|\
netgear,wax218|\
netgear,wax620|\
netgear,wax630)
idx="$(find_mtd_index 0:appsblenv)"
[ -n "$idx" ] && \
ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x40000" "0x20000" "2"
;;
edimax,cax1800)
idx="$(find_mtd_index 0:appsblenv)"
[ -n "$idx" ] && \
ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x10000" "0x20000"
;;
linksys,mr7350|\
linksys,mx4200v1|\
linksys,mx4200v2)
idx="$(find_mtd_index u_env)"
[ -n "$idx" ] && \
ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x40000" "0x20000" "2"
;;
prpl,haze)
mmcpart="$(find_mmc_part 0:APPSBLENV)"
[ -n "$mmcpart" ] && \
ubootenv_add_uci_config "$mmcpart" "0x0" "0x40000" "0x400" "0x100"
;;
qnap,301w)
idx="$(find_mtd_index 0:appsblenv)"
[ -n "$idx" ] && \
ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x20000" "0x20000" "1"
;;
redmi,ax5-jdcloud)
mmcpart="$(find_mmc_part 0:APPSBLENV)"
[ -n "$mmcpart" ] && \
ubootenv_add_uci_config "$mmcpart" "0x0" "0x40000" "0x20000" "2"
;;
esac
config_load ubootenv
config_foreach ubootenv_add_app_config
exit 0

View File

@ -34,7 +34,6 @@ beeline,smartbox-turbo-plus)
;; ;;
buffalo,wsr-1166dhp|\ buffalo,wsr-1166dhp|\
buffalo,wsr-600dhp|\ buffalo,wsr-600dhp|\
huasifei,mt7621dtu|\
mediatek,linkit-smart-7688|\ mediatek,linkit-smart-7688|\
samknows,whitebox-v8|\ samknows,whitebox-v8|\
xiaomi,mi-router-4c|\ xiaomi,mi-router-4c|\
@ -43,18 +42,16 @@ zbtlink,zbt-wg2626|\
zte,mf283plus) zte,mf283plus)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x10000" ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x10000"
;; ;;
h3c,tx1800-plus|\
h3c,tx1801-plus|\
h3c,tx1806|\
jcg,q20)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000"
;;
hootoo,ht-tm05|\ hootoo,ht-tm05|\
ravpower,rp-wd03) ravpower,rp-wd03)
idx="$(find_mtd_index u-boot-env)" idx="$(find_mtd_index u-boot-env)"
[ -n "$idx" ] && \ [ -n "$idx" ] && \
ubootenv_add_uci_config "/dev/mtd$idx" "0x4000" "0x1000" "0x1000" ubootenv_add_uci_config "/dev/mtd$idx" "0x4000" "0x1000" "0x1000"
;; ;;
c-life,xg1|\
jcg,q20)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000"
;;
linksys,ea7300-v1|\ linksys,ea7300-v1|\
linksys,ea7500-v2|\ linksys,ea7500-v2|\
linksys,ea8100-v1|\ linksys,ea8100-v1|\

View File

@ -1,22 +0,0 @@
#
# Copyright (C) 2023 OpenWrt.org
#
[ -e /etc/config/ubootenv ] && exit 0
touch /etc/config/ubootenv
. /lib/uboot-envtools.sh
. /lib/functions.sh
board=$(board_name)
case "$board" in
lyt,t68m)
ubootenv_add_uci_config "/dev/mmcblk0" "0x3f8000" "0x8000"
;;
esac
config_load ubootenv
config_foreach ubootenv_add_app_config
exit 0

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