Compare commits

..

No commits in common. "master" and "openwrt-24.10" have entirely different histories.

2278 changed files with 14924 additions and 214874 deletions

1
.github/FUNDING.yml vendored Normal file
View File

@ -0,0 +1 @@
custom: [ 'https://openwrt.org/donate' ]

View File

@ -1,35 +0,0 @@
---
name: 反馈bug/问题
about: 如果是固件问题请提供固件版本号
title: "[BUG] [24.10.x]"
labels: ''
assignees: ''
---
## 1.关于你要提交的问题
为避免重复issue,请先搜索issue,确认没有类似issue再提交新issue;
注意搜索时**包括已关闭**的issue(删掉搜索框的的“is:open”条件);
Q:是否用关键词搜索了issue? (使用 "x" 选择)
* [ ] 没有类似的issue
## 2. 详细叙述
### (1) 具体问题
### (2) 路由器型号和固件版本
### (3) 详细日志和/或截图
### (4) 复现步骤
1.
2.
### (5) 当前行为
### (6) 预期行为

95
.github/ISSUE_TEMPLATE/bug-report.yml vendored Normal file
View File

@ -0,0 +1,95 @@
name: Bug report
description: Create a bug report to help us improve
labels:
- bug
- bug-report
- to-triage
body:
- type: textarea
id: description
attributes:
label: Describe the bug
description: A clear and concise description of the bug.
validations:
required: true
- type: input
id: version
attributes:
label: OpenWrt version
description: |
The OpenWrt release or commit hash where this bug occurs (use command below).
```. /etc/openwrt_release && echo $DISTRIB_REVISION```
validations:
required: true
- type: input
id: release
attributes:
label: OpenWrt release
description: |
The OpenWrt release or commit hash where this bug occurs (use command below).
```. /etc/openwrt_release && echo $DISTRIB_RELEASE```
validations:
required: true
- type: input
id: target
attributes:
label: OpenWrt target/subtarget
description: |
The OpenWrt target and subtarget where this bug is observed (use command below).
```. /etc/openwrt_release && echo $DISTRIB_TARGET```
validations:
required: true
- type: input
id: device
attributes:
label: Device
description: |
The device exhibiting this bug (if unsure, use command below).
```cat /tmp/sysinfo/model```
validations:
required: true
- type: dropdown
id: image_kind
attributes:
label: Image kind
options:
- Official downloaded image
- Self-built image
validations:
required: true
- type: textarea
id: reproduce
attributes:
label: Steps to reproduce
description: Steps to reproduce the reported behaviour.
- type: textarea
id: behaviour
attributes:
label: Actual behaviour
description: A clear and concise description of what actually happens.
- type: textarea
id: expected
attributes:
label: Expected behaviour
description: A clear and concise description of what you expected to happen.
- type: textarea
id: additional
attributes:
label: Additional info
description: Add any additional info you think might be helfpul.
- type: textarea
id: diffconfig
attributes:
label: Diffconfig
description: |
In case of a self-built image, please attach diffconfig.
```./scripts/diffconfig.sh```
render: text
- type: checkboxes
id: terms
attributes:
label: Terms
description: By submitting this issue, you agree to the terms below.
options:
- label: I am reporting an issue for OpenWrt, not an unsupported fork.
required: true

12
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@ -0,0 +1,12 @@
---
blank_issues_enabled: true
contact_links:
- name: Feature request
url: https://forum.openwrt.org/c/feature-requests
about: The OpenWrt project relies on volunteers. While we appreciate feature requests, we might lack the manpower to handle them. Ideally, you get familiar with the codebase and attempt to contribute the feature yourself. We recommend to post in the forum, as this is the most likely place to receive feedback on feature requests.
- name: OpenWrt community
url: https://openwrt.org/contact
about: Consider reaching out to our community to get help. OpenWrt is a complex software project with many pitfalls; there is a good chance someone can help you solve your issue in no time.
- name: OpenWrt documentation
url: https://openwrt.org/docs/start
about: The OpenWrt documentation contains a lot of valuable information.

View File

@ -1,10 +0,0 @@
---
name: 功能请求
about: 提供新的想法或功能需求
title: "[Feature]"
labels: ''
assignees: ''
---
## 建议或想法

249
.github/labeler.yml vendored Normal file
View File

@ -0,0 +1,249 @@
# target/*
"target/airoha":
- changed-files:
- any-glob-to-any-file:
- "target/linux/airoha/**"
"target/apm821xx":
- changed-files:
- any-glob-to-any-file:
- "target/linux/apm821xx/**"
"target/archs38":
- changed-files:
- any-glob-to-any-file:
- "target/linux/archs38/**"
"target/armsr":
- changed-files:
- any-glob-to-any-file:
- "target/linux/armsr/**"
"target/at91":
- changed-files:
- any-glob-to-any-file:
- "target/linux/at91/**"
- "package/boot/at91bootstrap/**"
- "package/boot/uboot-at91/**"
"target/ath79":
- changed-files:
- any-glob-to-any-file:
- "target/linux/ath79/**"
"target/bcm27xx":
- changed-files:
- any-glob-to-any-file:
- "target/linux/bcm27xx/**"
- "package/kernel/bcm27xx-gpu-fw/**"
- "package/utils/bcm27xx-utils/**"
"target/bcm47xx":
- changed-files:
- any-glob-to-any-file:
- "target/linux/bcm47xx/**"
"target/bcm4908":
- changed-files:
- any-glob-to-any-file:
- "target/linux/bcm4908/**"
- "package/boot/uboot-bcm4908/**"
- "package/boot/arm-trusted-firmware-bcm63xx/**"
"target/bcm53xx":
- changed-files:
- any-glob-to-any-file:
- "target/linux/bcm53xx/**"
- "package/boot/uboot-bcm53xx/**"
"target/bmips":
- changed-files:
- any-glob-to-any-file:
- "target/linux/bmips/**"
- "package/boot/uboot-bmips/**"
- "package/kernel/bcm63xx-cfe/**"
"target/d1":
- changed-files:
- any-glob-to-any-file:
- "target/linux/d1/**"
- "package/boot/uboot-d1/**"
- "package/boot/opensbi/**"
"target/gemini":
- changed-files:
- any-glob-to-any-file:
- "target/linux/gemini/**"
"target/imx":
- changed-files:
- any-glob-to-any-file:
- "target/linux/imx/**"
- "package/boot/imx-bootlets/**"
- "package/boot/uboot-imx/**"
"target/ipq40xx":
- changed-files:
- any-glob-to-any-file:
- "target/linux/ipq40xx/**"
"target/ipq806x":
- changed-files:
- any-glob-to-any-file:
- "target/linux/ipq806x/**"
"target/qualcommax":
- changed-files:
- any-glob-to-any-file:
- "target/linux/qualcommax/**"
"target/ixp4xx":
- changed-files:
- any-glob-to-any-file:
- "target/linux/ixp4xx/**"
- "package/boot/apex/Makefile/**"
- "package/firmware/ixp4xx-microcode/**"
"target/kirkwood":
- changed-files:
- any-glob-to-any-file:
- "target/linux/kirkwood/**"
- "package/boot/uboot-kirkwood/**"
"target/lantiq":
- changed-files:
- any-glob-to-any-file:
- "target/linux/lantiq/**"
- "package/kernel/lantiq/**"
- "package/firmware/lantiq/**"
- "package/boot/uboot-lantiq/**"
"target/layerscape":
- changed-files:
- any-glob-to-any-file:
- "target/linux/layerscape/**"
- "package/firmware/layerscape/**"
- "package/boot/tfa-layerscape/**"
- "package/boot/uboot-layerscape/**"
- "package/network/utils/layerscape/**"
"target/loongarch64":
- changed-files:
- any-glob-to-any-file:
- "target/linux/loongarch64/**"
"target/malta":
- changed-files:
- any-glob-to-any-file:
- "target/linux/malta/**"
"target/mediatek":
- changed-files:
- any-glob-to-any-file:
- "target/linux/mediatek/**"
- "package/boot/arm-trusted-firmware-mediatek/**"
- "package/boot/uboot-mediatek/**"
"target/mpc85xx":
- changed-files:
- any-glob-to-any-file:
- "target/linux/mpc85xx/**"
"target/mvebu":
- changed-files:
- any-glob-to-any-file:
- "target/linux/mvebu/**"
- "package/boot/arm-trusted-firmware-mvebu/**"
- "package/boot/uboot-mvebu/**"
"target/mxs":
- changed-files:
- any-glob-to-any-file:
- "target/linux/mxs/**"
- "package/boot/uboot-mxs/**"
"target/octeon":
- changed-files:
- any-glob-to-any-file:
- "target/linux/octeon/**"
"target/omap":
- changed-files:
- any-glob-to-any-file:
- "target/linux/omap/**"
- "package/boot/uboot-omap/**"
"target/pistachio":
- changed-files:
- any-glob-to-any-file:
- "target/linux/pistachio/**"
"target/qoriq":
- changed-files:
- any-glob-to-any-file:
- "target/linux/qoriq/**"
"target/ramips":
- changed-files:
- any-glob-to-any-file:
- "target/linux/ramips/**"
"target/realtek":
- changed-files:
- any-glob-to-any-file:
- "target/linux/realtek/**"
"target/rockchip":
- changed-files:
- any-glob-to-any-file:
- "target/linux/rockchip/**"
- "package/boot/arm-trusted-firmware-rockchip/**"
- "package/boot/uboot-rockchip/**"
"target/sifiveu":
- changed-files:
- any-glob-to-any-file:
- "target/linux/sifiveu/**"
- "package/boot/uboot-sifiveu/**"
- "package/boot/opensbi/**"
"target/siflower":
- changed-files:
- any-glob-to-any-file:
- "target/linux/siflower/**"
"target/starfive":
- changed-files:
- any-glob-to-any-file:
- "target/linux/starfive/**"
"target/stm32":
- changed-files:
- any-glob-to-any-file:
- "target/linux/stm32/**"
- "package/boot/arm-trusted-firmware-stm32/**"
- "package/boot/optee-os-stm32/**"
- "package/boot/uboot-stm32/**"
"target/sunxi":
- changed-files:
- any-glob-to-any-file:
- "target/linux/sunxi/**"
- "package/boot/arm-trusted-firmware-sunxi/**"
- "package/boot/uboot-sunxi/**"
"target/tegra":
- changed-files:
- any-glob-to-any-file:
- "target/linux/tegra/**"
- "package/boot/uboot-tegra/**"
"target/uml":
- changed-files:
- any-glob-to-any-file:
- "target/linux/uml/**"
"target/x86":
- changed-files:
- any-glob-to-any-file:
- "target/linux/x86/**"
"target/zynq":
- changed-files:
- any-glob-to-any-file:
- "target/linux/zynq/**"
- "package/boot/uboot-zynq/**"
# target/imagebuilder
"target/imagebuilder":
- changed-files:
- any-glob-to-any-file:
- "target/imagebuilder/**"
# kernel
"kernel":
- changed-files:
- any-glob-to-any-file:
- "target/linux/generic/**"
- "target/linux/**/config-*"
- "target/linux/**/patches-*"
- "target/linux/**/files/**"
- "package/kernel/linux/**"
# core packages
"core packages":
- changed-files:
- any-glob-to-any-file:
- "package/**"
# build/scripts/tools
"build/scripts/tools":
- changed-files:
- any-glob-to-any-file:
- "include/**"
- "scripts/**"
- "tools/**"
# toolchain
"toolchain":
- changed-files:
- any-glob-to-any-file:
- "toolchain/**"
# GitHub/CI
"GitHub/CI":
- changed-files:
- any-glob-to-any-file:
- ".github/**"

8
.github/pull_request_template vendored Normal file
View File

@ -0,0 +1,8 @@
Thanks for your contribution to OpenWrt!
To help keep the codebase consistent and readable,
and to help people review your contribution,
we ask you to follow the rules you find in the wiki at this link
https://openwrt.org/submitting-patches
Please remove this message before posting the pull request.

19
.github/workflows/coverity.yml vendored Normal file
View File

@ -0,0 +1,19 @@
name: Coverity scan build
on:
schedule:
- cron: '30 2 * * 6'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
jobs:
coverity_build:
name: Coverity x86/64 build
secrets:
coverity_api_token: ${{ secrets.COVERITY_API_TOKEN }}
permissions:
contents: read
packages: read
actions: write
uses: openwrt/actions-shared-workflows/.github/workflows/coverity.yml@main

12
.github/workflows/formal.yml vendored Normal file
View File

@ -0,0 +1,12 @@
name: Test Formalities
on:
pull_request:
permissions:
contents: read
jobs:
build:
name: Test Formalities
uses: openwrt/actions-shared-workflows/.github/workflows/formal.yml@main

24
.github/workflows/github-release.yml vendored Normal file
View File

@ -0,0 +1,24 @@
name: Create GitHub release
permissions:
contents: write
on:
push:
tags:
- "v*"
workflow_dispatch:
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Release
uses: softprops/action-gh-release@v1
with:
draft: true
prerelease: true

11
.github/workflows/issue-labeller.yml vendored Normal file
View File

@ -0,0 +1,11 @@
name: Issue Labeller
on:
issues:
types: [ opened ]
jobs:
label-component:
name: Validate and Tag Bug Report
permissions:
issues: write
uses: openwrt/actions-shared-workflows/.github/workflows/issue-labeller.yml@main

42
.github/workflows/kernel.yml vendored Normal file
View File

@ -0,0 +1,42 @@
name: Build Kernel
on:
pull_request:
paths:
- '.github/workflows/check-kernel-patches.yml'
- '.github/workflows/build.yml'
- '.github/workflows/kernel.yml'
- 'include/kernel*'
- 'package/kernel/**'
- 'target/linux/**'
push:
paths:
- '.github/workflows/check-kernel-patches.yml'
- '.github/workflows/build.yml'
- '.github/workflows/kernel.yml'
- 'include/kernel*'
- 'package/kernel/**'
- 'target/linux/**'
branches-ignore:
- master
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
build-kernels:
name: Build all affected Kernels
permissions:
contents: read
packages: read
actions: write
secrets:
ccache_s3_endpoint: ${{ secrets.CCACHE_S3_ENDPOINT }}
ccache_s3_bucket: ${{ secrets.CCACHE_S3_BUCKET }}
ccache_s3_access_key: ${{ secrets.CCACHE_S3_ACCESS_KEY }}
ccache_s3_secret_key: ${{ secrets.CCACHE_S3_SECRET_KEY }}
uses: openwrt/actions-shared-workflows/.github/workflows/kernel.yml@main

16
.github/workflows/label-kernel.yml vendored Normal file
View File

@ -0,0 +1,16 @@
# ci:kernel:x86:64 is going to trigger CI kernel check jobs for x86/64 target
name: Build kernel and check patches for target specified in labels
on:
pull_request:
types:
- labeled
jobs:
build-kernels-label:
name: Build all affected Kernels from defined label
permissions:
contents: read
packages: read
actions: write
uses: openwrt/actions-shared-workflows/.github/workflows/label-kernel.yml@main

16
.github/workflows/label-target.yml vendored Normal file
View File

@ -0,0 +1,16 @@
# ci:target:x86:64 is going to trigger CI target check jobs for x86/64 target
name: Build check target specified in labels
on:
pull_request:
types:
- labeled
jobs:
build-target-label:
name: Build target from defined label
permissions:
contents: read
packages: read
actions: write
uses: openwrt/actions-shared-workflows/.github/workflows/label-target.yml@main

33
.github/workflows/labeler.yml vendored Normal file
View File

@ -0,0 +1,33 @@
name: 'Pull Request Labeler'
on:
- pull_request_target
permissions:
contents: read
jobs:
labeler:
permissions:
contents: read # to determine modified files (actions/labeler)
pull-requests: write # to add labels to PRs (actions/labeler)
name: Pull Request Labeler
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v5
with:
repo-token: '${{ secrets.GITHUB_TOKEN }}'
- name: Check Branch
id: check-branch
run: |
if echo "${{ github.base_ref }}" | grep -q -E 'openwrt-[0-9][0-9]\.[0-9][0-9]'; then
echo "release-tag=$(echo ${{ github.base_ref }} | sed 's/openwrt-/release\//')" >> $GITHUB_OUTPUT
fi
- uses: buildsville/add-remove-label@v2.0.1
if: ${{ steps.check-branch.outputs.release-tag }}
with:
token: ${{secrets.GITHUB_TOKEN}}
labels: ${{ steps.check-branch.outputs.release-tag }}
type: add

42
.github/workflows/packages.yml vendored Normal file
View File

@ -0,0 +1,42 @@
name: Build all core packages
on:
pull_request:
paths:
- '.github/workflows/packages.yml'
- 'config/**'
- 'include/**'
- 'package/**'
- 'target/linux/generic/**'
- 'toolchain/**'
push:
paths:
- '.github/workflows/packages.yml'
- 'config/**'
- 'include/**'
- 'package/**'
- 'target/linux/generic/**'
- 'toolchain/**'
branches-ignore:
- master
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
build-packages:
name: Build all core packages for selected target
permissions:
contents: read
packages: read
actions: write
secrets:
ccache_s3_endpoint: ${{ secrets.CCACHE_S3_ENDPOINT }}
ccache_s3_bucket: ${{ secrets.CCACHE_S3_BUCKET }}
ccache_s3_access_key: ${{ secrets.CCACHE_S3_ACCESS_KEY }}
ccache_s3_secret_key: ${{ secrets.CCACHE_S3_SECRET_KEY }}
uses: openwrt/actions-shared-workflows/.github/workflows/packages.yml@main

28
.github/workflows/push-containers.yml vendored Normal file
View File

@ -0,0 +1,28 @@
name: Build and Push prebuilt tools container
on:
push:
paths:
- 'include/version.mk'
- 'include/cmake.mk'
- 'tools/**'
- '.github/workflows/push-containers.yml'
- 'toolchain/**'
branches-ignore:
- master
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-push-containers:
name: Build and Push all prebuilt containers
permissions:
contents: read
packages: write
actions: write
uses: openwrt/actions-shared-workflows/.github/workflows/push-containers.yml@main

26
.github/workflows/scripts/ci_helpers.sh vendored Normal file
View File

@ -0,0 +1,26 @@
#!/bin/sh
color_out() {
printf "\e[0;$1m%s\e[0;0m\n" "$2"
}
success() {
color_out 32 "$1"
}
info() {
color_out 36 "$1"
}
err() {
color_out 31 "$1"
}
warn() {
color_out 33 "$1"
}
err_die() {
err "$1"
exit 1
}

View File

@ -0,0 +1,15 @@
#!/bin/bash
original_exit_code="${ret:-1}"
log_dir_path="${1:-logs}"
context="${2:-10}"
show_make_build_errors() {
grep -slr 'make\[[[:digit:]]\+\].*Error [[:digit:]]\+$' "$log_dir_path" | while IFS= read -r log_file; do
printf "====== Make errors from %s ======\n" "$log_file";
grep -r -C"$context" 'make\[[[:digit:]]\+\].*Error [[:digit:]]\+$' "$log_file" ;
done
}
show_make_build_errors
exit "$original_exit_code"

29
.github/workflows/toolchain.yml vendored Normal file
View File

@ -0,0 +1,29 @@
name: Build Toolchains
on:
pull_request:
paths:
- '.github/workflows/toolchain.yml'
- 'toolchain/**'
push:
paths:
- '.github/workflows/toolchain.yml'
- 'toolchain/**'
branches-ignore:
- master
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
build-toolchains:
name: Build Toolchains for each target
permissions:
contents: read
packages: read
actions: write
uses: openwrt/actions-shared-workflows/.github/workflows/toolchain.yml@main

27
.github/workflows/tools.yml vendored Normal file
View File

@ -0,0 +1,27 @@
name: Build host tools
on:
pull_request:
paths:
- 'include/**'
- 'tools/**'
- '.github/workflows/tools.yml'
push:
paths:
- 'include/**'
- 'tools/**'
- '.github/workflows/tools.yml'
branches-ignore:
- master
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
build-tools:
name: Build host tools for linux and macos based systems
uses: openwrt/actions-shared-workflows/.github/workflows/tools.yml@main

2
.gitignore vendored
View File

@ -20,7 +20,6 @@
/package/openwrt-packages
/*.patch
/llvm-bpf*
/.vermagic
key-build*
private-key.pem
public-key.pem
@ -36,4 +35,3 @@ git-src
.cproject
.ccache
.vscode*
.config.bak

View File

@ -1,12 +1,3 @@
iStoreOS 是入门级的路由系统,也是入门级的 NAS 系统,
基于原版 OpenWRT,在 ARS2 上经过长期迭代,最终开放适配到多个硬件平台
更多信息请参阅 https://github.com/istoreos
以下是 OpenWRT 原始的 README
--------
![OpenWrt logo](include/logo.png)
OpenWrt Project is a Linux operating system targeting embedded devices. Instead

View File

@ -176,7 +176,6 @@ menu "Global build settings"
config MOLD
depends on (aarch64 || arm || i386 || i686 || m68k || powerpc || powerpc64 || sh4 || x86_64)
depends on !GCC_USE_VERSION_11
depends on !HOST_OS_MACOS
def_bool $(shell, ./config/check-hostcxx.sh 10 2 12)
config USE_MOLD
@ -424,11 +423,11 @@ menu "Global build settings"
endchoice
config USE_SECCOMP
config SECCOMP
bool "Enable SECCOMP"
select KERNEL_SECCOMP
select PACKAGE_procd-seccomp
depends on (aarch64 || arm || armeb || mips || mipsel || mips64 || mips64el || i386 || loongarch64 || powerpc || x86_64)
depends on (aarch64 || arm || armeb || mips || mipsel || mips64 || mips64el || i386 || powerpc || x86_64)
depends on !TARGET_uml
default y
help

View File

@ -247,7 +247,7 @@ menu "Target Images"
config GRUB_TITLE
string "Title for the menu entry in GRUB"
depends on GRUB_IMAGES || GRUB_EFI_IMAGES
default "iStoreOS"
default "OpenWrt"
help
This is the title of the GRUB menu entry.
If unspecified, it defaults to OpenWrt.

View File

@ -1,8 +1,4 @@
src-git packages https://github.com/jjm2473/packages.git;istoreos-24.10
src-git luci https://github.com/jjm2473/luci.git;istoreos-24.10
src-git routing https://github.com/openwrt/routing.git;openwrt-24.10
src-git telephony https://github.com/openwrt/telephony.git;openwrt-24.10
# istore
src-git store https://github.com/linkease/istore.git;main
# argon, etc.
src-git third https://github.com/jjm2473/openwrt-third.git;main
src-git packages https://git.openwrt.org/feed/packages.git;openwrt-24.10
src-git luci https://git.openwrt.org/project/luci.git;openwrt-24.10
src-git routing https://git.openwrt.org/feed/routing.git;openwrt-24.10
src-git telephony https://git.openwrt.org/feed/telephony.git;openwrt-24.10

View File

@ -1,40 +1,30 @@
BPF_DEPENDS := @HAS_BPF_TOOLCHAIN +@NEED_BPF_TOOLCHAIN
BPF_DEPENDS := @HAS_BPF_TOOLCHAIN
LLVM_VER:=
CLANG_MIN_VER:=12
ifneq ($(CONFIG_USE_LLVM_HOST),)
find-llvm-tool=$(firstword $(shell PATH='$(BPF_PATH)' command -v $(1) || echo '$(firstword $(1))-not-found'))
BPF_TOOLCHAIN_HOST_PATH:=$(call qstrip,$(CONFIG_BPF_TOOLCHAIN_HOST_PATH))
ifneq ($(BPF_TOOLCHAIN_HOST_PATH),)
BPF_PATH:=$(BPF_TOOLCHAIN_HOST_PATH)/bin:$(PATH)
else
BPF_PATH:=$(PATH)
endif
CLANG:=$(call find-llvm-tool,clang clang-13 clang-12)
CLANG:=$(firstword $(shell PATH='$(BPF_PATH)' command -v clang clang-13 clang-12 clang-11))
LLVM_VER:=$(subst clang,,$(notdir $(CLANG)))
BPF_PATH:=$(dir $(CLANG)):$(BPF_PATH)
LLVM_LLC:=$(call find-llvm-tool,llc$(LLVM_VER))
LLVM_DIS:=$(call find-llvm-tool,llvm-dis$(LLVM_VER))
LLVM_OPT:=$(call find-llvm-tool,opt$(LLVM_VER))
LLVM_STRIP:=$(call find-llvm-tool,llvm-strip$(LLVM_VER))
else
LLVM_PATH:=/invalid
ifneq ($(CONFIG_USE_LLVM_PREBUILT),)
LLVM_PATH:=$(TOPDIR)/llvm-bpf/bin
endif
ifneq ($(CONFIG_USE_LLVM_BUILD),)
LLVM_PATH:=$(STAGING_DIR_HOST)/llvm-bpf/bin
endif
CLANG:=$(LLVM_PATH)/clang
LLVM_LLC:=$(LLVM_PATH)/llc
LLVM_DIS:=$(LLVM_PATH)/llvm-dis
LLVM_OPT:=$(LLVM_PATH)/opt
LLVM_STRIP:=$(LLVM_PATH)/llvm-strip
endif
ifneq ($(CONFIG_USE_LLVM_PREBUILT),)
CLANG:=$(TOPDIR)/llvm-bpf/bin/clang
endif
ifneq ($(CONFIG_USE_LLVM_BUILD),)
CLANG:=$(STAGING_DIR_HOST)/llvm-bpf/bin/clang
endif
LLVM_PATH:=$(dir $(CLANG))
LLVM_LLC:=$(LLVM_PATH)/llc$(LLVM_VER)
LLVM_DIS:=$(LLVM_PATH)/llvm-dis$(LLVM_VER)
LLVM_OPT:=$(LLVM_PATH)/opt$(LLVM_VER)
LLVM_STRIP:=$(LLVM_PATH)/llvm-strip$(LLVM_VER)
BPF_KARCH:=mips
BPF_ARCH:=mips$(if $(CONFIG_ARCH_64BIT),64)$(if $(CONFIG_BIG_ENDIAN),,el)

View File

@ -1,5 +0,0 @@
ifneq ($(CONFIG_USE_APK),)
DEFAULT_PACKAGES += apk-mbedtls
else
DEFAULT_PACKAGES += opkg
endif

View File

@ -232,9 +232,7 @@ define DownloadMethod/rawgit
echo "Generating formal git archive (apply .gitattributes rules)" && \
(cd $(SUBDIR) && git config core.abbrev 8 && \
git archive --format=tar HEAD --output=../$(SUBDIR).tar.git) && \
$(if $(filter skip,$(SUBMODULES)),true, \
$(TAR) --numeric-owner --owner=0 --group=0 --ignore-failed-read -C $(SUBDIR) -f $(SUBDIR).tar.git -r .git .gitmodules 2>/dev/null \
) && \
$(if $(filter skip,$(SUBMODULES)),true,$(TAR) --ignore-failed-read -C $(SUBDIR) -f $(SUBDIR).tar.git -r .git .gitmodules 2>/dev/null) && \
rm -rf $(SUBDIR) && mkdir $(SUBDIR) && \
$(TAR) -C $(SUBDIR) -xf $(SUBDIR).tar.git && \
(cd $(SUBDIR) && $(if $(filter skip,$(SUBMODULES)),true,git submodule update --init --recursive -- $(SUBMODULES) && \

View File

@ -37,7 +37,7 @@ define FeedSourcesAppendOPKG
echo 'src/gz %d_core %U/targets/%S/packages'; \
$(strip $(if $(CONFIG_PER_FEED_REPO), \
echo 'src/gz %d_base %U/packages/%A/base'; \
$(if y, \
$(if $(CONFIG_BUILDBOT), \
echo 'src/gz %d_kmods %U/targets/%S/kmods/$(LINUX_VERSION)-$(LINUX_RELEASE)-$(LINUX_VERMAGIC)';) \
$(foreach feed,$(FEEDS_AVAILABLE), \
$(if $(CONFIG_FEED_$(feed)), \
@ -51,7 +51,7 @@ define FeedSourcesAppendAPK
echo '%U/targets/%S/packages/packages.adb'; \
$(strip $(if $(CONFIG_PER_FEED_REPO), \
echo '%U/packages/%A/base/packages.adb'; \
$(if y, \
$(if $(CONFIG_BUILDBOT), \
echo '%U/targets/%S/kmods/$(LINUX_VERSION)-$(LINUX_RELEASE)-$(LINUX_VERMAGIC)/packages.adb';) \
$(foreach feed,$(FEEDS_AVAILABLE), \
$(if $(CONFIG_FEED_$(feed)), \

View File

@ -391,9 +391,8 @@ define Build/fit
$(if $(DEVICE_DTS_OVERLAY),$(foreach dtso,$(DEVICE_DTS_OVERLAY), -O $(dtso):$(KERNEL_BUILD_DIR)/image-$(dtso).dtbo)) \
-c $(if $(DEVICE_DTS_CONFIG),$(DEVICE_DTS_CONFIG),"config-1") \
-A $(LINUX_KARCH) -v $(LINUX_VERSION), gen-cpio$(if $(TARGET_PER_DEVICE_ROOTFS),.$(ROOTFS_ID/$(DEVICE_NAME))))
$(call locked,PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage $(if $(findstring external,$(word 3,$(1))),\
-E -B 0x1000 $(if $(findstring static,$(word 3,$(1))),-p 0x1000)) -f $@.its $@.new, \
gen-cpio$(if $(TARGET_PER_DEVICE_ROOTFS),.$(ROOTFS_ID/$(DEVICE_NAME))))
PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage $(if $(findstring external,$(word 3,$(1))),\
-E -B 0x1000 $(if $(findstring static,$(word 3,$(1))),-p 0x1000)) -f $@.its $@.new
@mv $@.new $@
endef
@ -733,10 +732,6 @@ define Build/zip
rm -rf $@.tmp
endef
define Build/zyimage
$(STAGING_DIR_HOST)/bin/zyimage $(1) $@
endef
define Build/zyxel-ras-image
let \
newsize="$(call exp_units,$(RAS_ROOTFS_SIZE))"; \

View File

@ -49,8 +49,8 @@ IMG_PREFIX:=$(VERSION_DIST_SANITIZED)-$(IMG_PREFIX_VERNUM)$(IMG_PREFIX_VERCODE)$
IMG_ROOTFS:=$(IMG_PREFIX)-rootfs
IMG_COMBINED:=$(IMG_PREFIX)-combined
ifeq ($(DUMP),)
IMG_PART_SIGNATURE:=$(shell echo $(SOURCE_DATE_EPOCH)$(REVISION)$(LINUX_VERMAGIC) | $(MKHASH) md5 | cut -b1-8)
IMG_PART_DISKGUID:=$(shell echo $(SOURCE_DATE_EPOCH)$(REVISION)$(LINUX_VERMAGIC) | $(MKHASH) md5 | sed -E 's/(.{8})(.{4})(.{4})(.{4})(.{10})../\1-\2-\3-\4-\500/')
IMG_PART_SIGNATURE:=$(shell echo $(SOURCE_DATE_EPOCH)$(LINUX_VERMAGIC) | $(MKHASH) md5 | cut -b1-8)
IMG_PART_DISKGUID:=$(shell echo $(SOURCE_DATE_EPOCH)$(LINUX_VERMAGIC) | $(MKHASH) md5 | sed -E 's/(.{8})(.{4})(.{4})(.{4})(.{10})../\1-\2-\3-\4-\500/')
endif
MKFS_DEVTABLE_OPT := -D $(INCLUDE_DIR)/device_table.txt
@ -569,15 +569,6 @@ endef
define Device/Check/Common
_PROFILE_SET = $$(strip $$(foreach profile,$$(PROFILES) DEVICE_$(1),$$(call DEVICE_CHECK_PROFILE,$$(profile))))
# Check if device is disabled and if so do not mark to be installed when ImageBuilder is used
ifeq ($(IB),1)
ifeq ($$(DEFAULT),n)
_PROFILE_SET :=
endif
ifeq ($$(BROKEN),y)
_PROFILE_SET :=
endif
endif
DEVICE_PACKAGES += $$(call extra_packages,$$(DEVICE_PACKAGES))
ifdef TARGET_PER_DEVICE_ROOTFS
$$(eval $$(call merge_packages,_PACKAGES,$$(DEVICE_PACKAGES) $$(call DEVICE_EXTRA_PACKAGES,$(1))))

View File

@ -1,2 +1,2 @@
LINUX_VERSION-6.6 = .119
LINUX_KERNEL_HASH-6.6.119 = 3da09b980bb404cc28793479bb2d6c636522679215ffa65a04c893575253e5e8
LINUX_VERSION-6.6 = .67
LINUX_KERNEL_HASH-6.6.67 = e41da482ec42a3b0e2b8ed2574c1d327e3dcf95cdf025c55a356b04307113e1a

View File

@ -184,6 +184,4 @@ define BuildKernel
prereq: image-prereq
image: $(LINUX_DIR)/.image
endef

View File

@ -127,7 +127,7 @@ define Kernel/Configure/Default
cp $(LINUX_DIR)/.config.set $(LINUX_DIR)/.config.prev; \
}
$(_SINGLE) [ -d $(LINUX_DIR)/user_headers ] || $(KERNEL_MAKE) $(if $(findstring uml,$(BOARD)),ARCH=$(ARCH)) INSTALL_HDR_PATH=$(LINUX_DIR)/user_headers headers_install
[ -f $(TOPDIR)/.vermagic ] && cat $(TOPDIR)/.vermagic > $(LINUX_DIR)/.vermagic || grep '=[ym]' $(LINUX_DIR)/.config.set | LC_ALL=C sort | $(MKHASH) md5 > $(LINUX_DIR)/.vermagic
grep '=[ym]' $(LINUX_DIR)/.config.set | LC_ALL=C sort | $(MKHASH) md5 > $(LINUX_DIR)/.vermagic
endef
define Kernel/Configure/Initramfs
@ -175,6 +175,7 @@ define Kernel/PrepareConfigPerRootfs
[ ! -d "$(1)" ] || rm -rf $(1); \
mkdir $(1) && $(CP) -T $(LINUX_DIR) $(1); \
touch $(1)/.config; \
rm -rf $(1)/usr/initramfs_data.cpio*; \
}
endef
@ -189,7 +190,6 @@ define Kernel/CompileImage/Initramfs
$(call Kernel/Configure/Initramfs,$(if $(1),$(1),$(TARGET_DIR)),$(LINUX_DIR)$(2)); \
$(CP) $(GENERIC_PLATFORM_DIR)/other-files/init $(if $(1),$(1),$(TARGET_DIR))/init; \
$(if $(SOURCE_DATE_EPOCH),touch -hcd "@$(SOURCE_DATE_EPOCH)" $(if $(1),$(1),$(TARGET_DIR)) $(if $(1),$(1),$(TARGET_DIR))/init;) \
rm -rf $(LINUX_DIR)$(2)/usr/initramfs_data.cpio*; \
$(if $(CONFIG_TARGET_ROOTFS_INITRAMFS_SEPARATE), \
$(call locked,{ \
$(if $(call qstrip,$(CONFIG_EXTERNAL_CPIO)), \

View File

@ -216,7 +216,6 @@ define KernelPackage
EXTRA_DEPENDS:=kernel (=$(LINUX_VERSION)~$(LINUX_VERMAGIC)-r$(LINUX_RELEASE))
VERSION:=$(LINUX_VERSION)$(if $(PKG_VERSION),.$(PKG_VERSION))-r$(if $(PKG_RELEASE),$(PKG_RELEASE),$(LINUX_RELEASE))
PKGFLAGS:=$(PKGFLAGS)
PKG_FLAGS:=hold
$(call KernelPackage/$(1))
$(call KernelPackage/$(1)/$(BOARD))
$(call KernelPackage/$(1)/$(BOARD)/$(SUBTARGET))

View File

@ -85,7 +85,7 @@ endef
define Build/Compile/Optee-os
+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
PATH=$(LINUX_DIR)/scripts/dtc/:$(STAGING_DIR_HOST)/bin:$(PATH) \
PATH=$(LINUX_DIR)/scripts/dtc/:$(PATH) \
CROSS_COMPILE=$(TARGET_CROSS) \
CROSS_COMPILE_core="$(TARGET_CROSS)" \
CROSS_COMPILE_ta_arm64="$(TARGET_CROSS)" \

View File

@ -181,7 +181,7 @@ $$(call addfield,Depends,$$(Package/$(1)/DEPENDS)
)$$(call addfield,Provides,$$(call mergelist,$$(filter-out $(1)$$(ABIV_$(1)),$(PROVIDES)$$(if $$(ABIV_$(1)), $(1) $(foreach provide,$(PROVIDES),$(provide)$$(ABIV_$(1))))))
)$$(call addfield,Alternatives,$$(call mergelist,$(ALTERNATIVES))
)$$(call addfield,Source,$(SOURCE)
)$$(call addfield,SourceName,$(1)
)$$(call addfield,SourceName,$(PKG_NAME)
)$$(call addfield,License,$(LICENSE)
)$$(call addfield,LicenseFiles,$(LICENSE_FILES)
)$$(call addfield,Section,$(SECTION)
@ -248,7 +248,7 @@ endif
)
endif
$(INSTALL_DIR) $$(PDIR_$(1))
$(INSTALL_DIR) $$(PDIR_$(1))/tmp
ifeq ($(CONFIG_USE_APK),)
mkdir -p $$(IDIR_$(1))/CONTROL

View File

@ -90,18 +90,50 @@ else
endif
endif
ifneq ($(DUMP),)
# Parse generic config that might be set before a .config is generated to modify the
# default package configuration
# Keep DYNAMIC_DEF_PKG_CONF in sync with toplevel.mk to reflect the same configs
DYNAMIC_DEF_PKG_CONF := CONFIG_USE_APK CONFIG_SELINUX CONFIG_SMALL_FLASH CONFIG_SECCOMP
$(foreach config, $(DYNAMIC_DEF_PKG_CONF), \
$(eval $(config) := $(shell grep "$(config)=y" $(TOPDIR)/.config 2>/dev/null)) \
)
# The config options that are enabled by default and where other default
# packages depends on needs to be set if they are missing in the .config.
ifeq ($(shell grep "CONFIG_SECCOMP" $(TOPDIR)/.config 2>/dev/null),)
ifeq ($(filter $(BOARD), uml),)
ifneq ($(filter $(ARCH), aarch64 arm armeb mips mipsel mips64 mips64el i386 powerpc x86_64),)
CONFIG_SECCOMP := y
endif
endif
endif
endif
ifneq ($(CONFIG_USE_APK),)
DEFAULT_PACKAGES+=apk-mbedtls
else
DEFAULT_PACKAGES+=opkg
endif
ifneq ($(CONFIG_SELINUX),)
DEFAULT_PACKAGES+=busybox-selinux procd-selinux
else
DEFAULT_PACKAGES+=busybox procd
endif
# include ujail on systems with enough storage
ifeq ($(filter small_flash,$(FEATURES)),)
DEFAULT_PACKAGES+=procd-ujail
ifeq ($(CONFIG_SMALL_FLASH),)
DEFAULT_PACKAGES+=procd-ujail
endif
# include seccomp ld-preload hooks if kernel supports it
ifneq ($(CONFIG_SECCOMP),)
DEFAULT_PACKAGES+=procd-seccomp
endif
# Add device specific packages (here below to allow device type set from subtarget)
DEFAULT_PACKAGES += $(DEFAULT_PACKAGES.$(DEVICE_TYPE))
ifneq ($(filter aarch64 x86_64,$(ARCH)),)
DEFAULT_PACKAGES += luci-app-store
endif
##@
# @brief Filter out packages, prepended with `-`.
#

View File

@ -75,7 +75,22 @@ endif
_ignore = $(foreach p,$(IGNORE_PACKAGES),--ignore $(p))
prepare-tmpinfo: FORCE
# Config that will invalidate the .targetinfo as they will affect
# DEFAULT_PACKAGES.
# Keep DYNAMIC_DEF_PKG_CONF in sync with target.mk to reflect the same configs
DYNAMIC_DEF_PKG_CONF := CONFIG_USE_APK CONFIG_SELINUX CONFIG_SMALL_FLASH CONFIG_SECCOMP
check-dynamic-def-pkg: FORCE
@+DEF_PKG_CONFS=""; \
if [ -f $(TOPDIR)/.config ]; then \
for config in $(DYNAMIC_DEF_PKG_CONF); do \
DEF_PKG_CONFS="$$DEF_PKG_CONFS "$$(grep "$$config"=y $(TOPDIR)/.config); \
done; \
fi; \
[ ! -f tmp/.packagedynamicdefault ] || OLD_DEF_PKG_CONFS=$$(cat tmp/.packagedynamicdefault); \
[ "$$DEF_PKG_CONFS" = "$$OLD_DEF_PKG_CONFS" ] || rm -rf tmp/info/.targetinfo*; \
mkdir -p tmp && echo "$$DEF_PKG_CONFS" > tmp/.packagedynamicdefault;
prepare-tmpinfo: check-dynamic-def-pkg FORCE
@+$(MAKE) -r -s $(STAGING_DIR_HOST)/.prereq-build $(PREP_MK)
mkdir -p tmp/info feeds
[ -e $(TOPDIR)/feeds/base ] || ln -sf $(TOPDIR)/package $(TOPDIR)/feeds/base
@ -168,7 +183,6 @@ ifneq ($(DISTRO_PKG_CONFIG),)
kernel_menuconfig: export PATH:=$(dir $(DISTRO_PKG_CONFIG)):$(PATH)
kernel_nconfig: export PATH:=$(dir $(DISTRO_PKG_CONFIG)):$(PATH)
kernel_xconfig: export PATH:=$(dir $(DISTRO_PKG_CONFIG)):$(PATH)
kernel_image: export PATH:=$(dir $(DISTRO_PKG_CONFIG)):$(PATH)
endif
kernel_menuconfig: prepare_kernel_conf
$(_SINGLE)$(NO_TRACE_MAKE) -C target/linux menuconfig
@ -179,9 +193,6 @@ kernel_nconfig: prepare_kernel_conf
kernel_xconfig: prepare_kernel_conf
$(_SINGLE)$(NO_TRACE_MAKE) -C target/linux xconfig
kernel_image: prepare_kernel_conf
$(_SINGLE)$(NO_TRACE_MAKE) -C target/linux image
$(STAGING_DIR_HOST)/.prereq-build: include/prereq-build.mk
mkdir -p tmp
@$(_SINGLE)$(NO_TRACE_MAKE) -j1 -r -s -f $(TOPDIR)/include/prereq-build.mk prereq 2>/dev/null || { \
@ -205,7 +216,7 @@ else
DOWNLOAD_DIRS = package/download
endif
download: .config FORCE $(if $(wildcard $(STAGING_DIR_HOST)/bin/flock),,tools/flock/compile) $(if $(wildcard $(STAGING_DIR_HOST)/bin/zstd),,tools/zstd/compile)
download: .config FORCE $(if $(wildcard $(STAGING_DIR_HOST)/bin/flock),,tools/flock/compile)
@+$(foreach dir,$(DOWNLOAD_DIRS),$(SUBMAKE) $(dir);)
clean dirclean: .config

View File

@ -1,21 +1,13 @@
PKG_NAME ?= trusted-firmware-a
PKG_CPE_ID ?= cpe:/a:arm:trusted_firmware-a
PKG_LTS ?=
ifneq ($(PKG_LTS),)
PKG_VERSION_PREFIX:=lts-v
PKG_BUILD_DIR = $(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION_PREFIX)$(PKG_VERSION)
else
PKG_VERSION_PREFIX:=v
PKG_BUILD_DIR = $(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
endif
ifndef PKG_SOURCE_PROTO
PKG_SOURCE = trusted-firmware-a-$(PKG_VERSION_PREFIX)$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/TrustedFirmware-A/trusted-firmware-a/tar.gz/$(PKG_VERSION_PREFIX)$(PKG_VERSION)?
PKG_SOURCE = trusted-firmware-a-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/snapshot
endif
PKG_BUILD_DIR = $(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
PKG_TARGETS := bin
PKG_FLAGS:=nonshared
@ -90,7 +82,7 @@ define Build/Compile/Trusted-Firmware-A
OPENSSL_DIR=$(STAGING_DIR_HOST) \
$(if $(DTC),DTC="$(DTC)") \
PLAT=$(PLAT) \
BUILD_STRING="OpenWrt $(PKG_VERSION_PREFIX)$(PKG_VERSION)-$(PKG_RELEASE) ($(VARIANT))" \
BUILD_STRING="OpenWrt v$(PKG_VERSION)-$(PKG_RELEASE) ($(VARIANT))" \
$(if $(CONFIG_BINUTILS_VERSION_2_37)$(CONFIG_BINUTILS_VERSION_2_38),,LDFLAGS="-no-warn-rwx-segments") \
$(TFA_MAKE_FLAGS)
endef

View File

@ -23,16 +23,16 @@ PKG_CONFIG_DEPENDS += \
sanitize = $(call tolower,$(subst _,-,$(subst $(space),-,$(1))))
VERSION_NUMBER:=$(call qstrip,$(CONFIG_VERSION_NUMBER))
VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),24.10.5)
VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),24.10-SNAPSHOT)
VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE))
VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),$(REVISION))
VERSION_REPO:=$(call qstrip,$(CONFIG_VERSION_REPO))
VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/24.10.5)
VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/24.10-SNAPSHOT)
VERSION_DIST:=$(call qstrip,$(CONFIG_VERSION_DIST))
VERSION_DIST:=$(if $(VERSION_DIST),$(VERSION_DIST),iStoreOS)
VERSION_DIST:=$(if $(VERSION_DIST),$(VERSION_DIST),OpenWrt)
VERSION_DIST_SANITIZED:=$(call sanitize,$(VERSION_DIST))
VERSION_MANUFACTURER:=$(call qstrip,$(CONFIG_VERSION_MANUFACTURER))
@ -42,10 +42,10 @@ VERSION_MANUFACTURER_URL:=$(call qstrip,$(CONFIG_VERSION_MANUFACTURER_URL))
VERSION_MANUFACTURER_URL:=$(if $(VERSION_MANUFACTURER_URL),$(VERSION_MANUFACTURER_URL),https://openwrt.org/)
VERSION_BUG_URL:=$(call qstrip,$(CONFIG_VERSION_BUG_URL))
VERSION_BUG_URL:=$(if $(VERSION_BUG_URL),$(VERSION_BUG_URL),https://github.com/istoreos/istoreos/issues)
VERSION_BUG_URL:=$(if $(VERSION_BUG_URL),$(VERSION_BUG_URL),https://bugs.openwrt.org/)
VERSION_HOME_URL:=$(call qstrip,$(CONFIG_VERSION_HOME_URL))
VERSION_HOME_URL:=$(if $(VERSION_HOME_URL),$(VERSION_HOME_URL),https://github.com/istoreos)
VERSION_HOME_URL:=$(if $(VERSION_HOME_URL),$(VERSION_HOME_URL),https://openwrt.org/)
VERSION_SUPPORT_URL:=$(call qstrip,$(CONFIG_VERSION_SUPPORT_URL))
VERSION_SUPPORT_URL:=$(if $(VERSION_SUPPORT_URL),$(VERSION_SUPPORT_URL),https://forum.openwrt.org/)

View File

@ -142,7 +142,10 @@ else
$(call ERROR_MESSAGE,WARNING: Applying padding in $$d/Packages to workaround usign SHA-512 bug!); \
{ echo ""; echo ""; } >> Packages;; \
esac; \
$(SCRIPT_DIR)/make-index-json.py -f opkg -a "$(ARCH_PACKAGES)" Packages > index.json; \
echo -n '{"architecture": "$(ARCH_PACKAGES)", "packages":{' > index.json; \
sed -n -e 's/^Package: \(.*\)$$/"\1":/p' -e 's/^Version: \(.*\)$$/"\1",/p' Packages | tr '\n' ' ' >> index.json; \
echo '}}' >> index.json; \
sed -i 's/, }}/}}/' index.json; \
gzip -9nc Packages > Packages.gz; \
); done
ifdef CONFIG_SIGNED_PACKAGES

View File

@ -12,7 +12,7 @@ include $(INCLUDE_DIR)/version.mk
include $(INCLUDE_DIR)/feeds.mk
PKG_NAME:=base-files
PKG_FLAGS:=hold essential nonshared
PKG_FLAGS:=nonshared
PKG_RELEASE:=$(COMMITCOUNT)
PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/
@ -39,12 +39,7 @@ endif
define Package/base-files
SECTION:=base
CATEGORY:=Base system
DEPENDS:= \
+netifd +libc +jsonfilter +SIGNED_PACKAGES:usign +SIGNED_PACKAGES:openwrt-keyring \
+NAND_SUPPORT:ubi-utils +fstools +fwtool \
+blkid +mount-utils +e2fsprogs +tune2fs +resize2fs +attr +block-mount \
+SELINUX:procd-selinux +!SELINUX:procd +USE_SECCOMP:procd-seccomp \
+SELINUX:busybox-selinux +!SELINUX:busybox
DEPENDS:=+netifd +libc +jsonfilter +SIGNED_PACKAGES:usign +SIGNED_PACKAGES:openwrt-keyring +NAND_SUPPORT:ubi-utils +fstools +fwtool
TITLE:=Base filesystem for OpenWrt
URL:=http://openwrt.org/
VERSION:=$(PKG_RELEASE)~$(lastword $(subst -, ,$(REVISION)))
@ -82,7 +77,7 @@ endef
define ImageConfigOptions
mkdir -p $(1)/lib/preinit
echo 'pi_suppress_stderr="$(CONFIG_TARGET_PREINIT_SUPPRESS_STDERR)"' >$(1)/lib/preinit/00_preinit.conf
echo 'fs_failsafe_wait_timeout=$(if $(CONFIG_TARGET_PREINIT_TIMEOUT),$(CONFIG_TARGET_PREINIT_TIMEOUT),2)' >>$(1)/lib/preinit/00_preinit.conf
echo 'fs_failsafe_wait_timeout=$(if $(CONFIG_TARGET_PREINIT_TIMEOUT),$(CONFIG_TARGET_PREINIT_TIMEOUT),4)' >>$(1)/lib/preinit/00_preinit.conf
echo 'pi_init_path="$(TARGET_INIT_PATH)"' >>$(1)/lib/preinit/00_preinit.conf
echo 'pi_init_env=$(if $(CONFIG_TARGET_INIT_ENV),$(CONFIG_TARGET_INIT_ENV),"")' >>$(1)/lib/preinit/00_preinit.conf
echo 'pi_init_cmd=$(if $(CONFIG_TARGET_INIT_CMD),$(CONFIG_TARGET_INIT_CMD),"/sbin/init")' >>$(1)/lib/preinit/00_preinit.conf
@ -216,8 +211,6 @@ define Package/base-files/install
mkdir -p -m 750 \
$(1)/root
touch $(1)/etc/config/ucitrack
$(LN) /proc/mounts $(1)/etc/mtab
$(if $(LIB_SUFFIX),-$(LN) lib $(1)/lib$(LIB_SUFFIX))
$(if $(LIB_SUFFIX),-$(LN) lib $(1)/usr/lib$(LIB_SUFFIX))
@ -234,9 +227,6 @@ endif
chmod 0600 $(1)/etc/shadow
chmod 1777 $(1)/tmp
$(LN) /tmp/run $(1)/run
mkdir -p $(1)/ext_overlay
$(call ImageConfigOptions,$(1))
$(call Package/base-files/install-target,$(1))
for conffile in $(1)/etc/config/*; do \

View File

@ -2,7 +2,7 @@
CFG=/etc/board.json
. /lib/functions/system.sh
. /usr/share/libubox/jshn.sh
[ -s $CFG ] || /bin/board_detect || exit 1
[ -s /etc/config/network -a -s /etc/config/system ] && exit 0
@ -123,7 +123,6 @@ generate_network() {
set network.@device[-1].name='$port'
set network.@device[-1].macaddr='$macaddr'
EOF
macaddr=$(macaddr_add "$macaddr" 2)
done
}
device=br-$1
@ -217,13 +216,6 @@ generate_network() {
set network.$1.pdptype='ipv4'
EOF
;;
*)
uci -q batch <<-EOF
set network.$1.proto='${protocol}'
set network.$1.auto='0'
EOF
;;
esac
}

View File

@ -1,11 +1,8 @@
▀ ▄▄▄▄ ▄ ▄▄▄▄ ▄▄▄▄
▄▄▄ █▀ ▀ ▄▄█▄▄ ▄▄▄ ▄ ▄▄ ▄▄▄ ▄▀ ▀▄ █▀ ▀
█ ▀█▄▄▄ █ █▀ ▀█ █▀ ▀ █▀ █ █ █ ▀█▄▄▄
█ ▀█ █ █ █ █ █▀▀▀▀ █ █ ▀█
▄▄█▄▄ ▀▄▄▄█▀ ▀▄▄ ▀█▄█▀ █ ▀█▄▄▀ █▄▄█ ▀▄▄▄█▀
Powered by OpenWRT
-------------------------------------------------------
_______ ________ __
| |.-----.-----.-----.| | | |.----.| |_
| - || _ | -__| || | | || _|| _|
|_______|| __|_____|__|__||________||__| |____|
|__| W I R E L E S S F R E E D O M
-----------------------------------------------------
%D %V, %C
-------------------------------------------------------
-----------------------------------------------------

View File

@ -1,3 +0,0 @@
[ "$ACTION" = "stratum" ] || exit 0
touch /var/state/ntp_last_sync

View File

@ -48,8 +48,6 @@ boot() {
sleep 1
}
[ -x /lib/board/init.sh ] && /lib/board/init.sh
mkdir -p /tmp/.uci
[ -f /etc/uci-defaults/30_uboot-envtools ] && (. /etc/uci-defaults/30_uboot-envtools)
/bin/config_generate

View File

@ -22,17 +22,14 @@ start() {
}
stop() {
[ -e /var/state/ntp_last_sync ] && touch /etc/.last_saved_time
hwclock_save
}
hwclock_load() {
[ -e "/dev/rtc" ] && RTC_DEV=/dev/rtc
[ -e "$RTC_DEV" ] && [ -e "$HWCLOCK" ] && $HWCLOCK -s -u -f $RTC_DEV
}
hwclock_save(){
[ -e "/dev/rtc" ] && RTC_DEV=/dev/rtc
[ -e "$RTC_DEV" ] && [ -e "$HWCLOCK" ] && $HWCLOCK -w -u -f $RTC_DEV && \
logger -t sysfixtime "saved '$(date)' to $RTC_DEV"
}

View File

@ -1,57 +0,0 @@
#!/bin/sh /etc/rc.common
START=80
USE_PROCD=1
register_init() {
local config="$1"
local init="$2"
shift; shift
if [ -x "$init" ] && "$init" enabled && ! grep -sqE 'USE_PROCD=.' "$init"; then
logger -t "ucitrack_compat" "Setting up /etc/config/$config reload trigger for non-procd $init"
procd_add_config_trigger "config.change" "$config" "$init" "$@"
fi
}
register_trigger() {
local sid="$1"
local config init exec affects affected
config_get config "$sid" TYPE
config_get init "$sid" init
config_get exec "$sid" exec
config_get affects "$sid" affects
if [ -n "$init" ]; then
register_init "$config" "/etc/init.d/$init" "reload"
fi
if [ -n "$exec" ]; then
case "$exec" in
/etc/init.d/*)
set -- $exec
register_init "$config" "$@"
;;
*)
logger -t "ucitrack_compat" "Setting up non-init /etc/config/$config reload handler: $exec"
procd_add_config_trigger "config.change" "$config" $exec
;;
esac
fi
for affected in $affects; do
logger -t "ucitrack_compat" "Setting up /etc/config/$affected reload dependency on /etc/config/$config"
procd_add_config_trigger "config.change" "$config" \
ubus call service event \
"$(printf '{"type":"config.change","data":{"package":"%s"}}' $affected)"
done
}
service_triggers() {
config_foreach register_trigger
}
start_service() {
config_load ucitrack
}

View File

@ -23,7 +23,7 @@ released)
elif [ "$SEEN" -ge 5 -a -n "$OVERLAY" ]
then
echo "FACTORY RESET" > /dev/console
firstboot -y && reboot &
jffs2reset -y && reboot &
fi
;;
esac

View File

@ -346,7 +346,6 @@ default_postinst() {
local filelist="${root}/usr/lib/opkg/info/${pkgname}.list"
[ -f "$root/lib/apk/packages/${pkgname}.list" ] && filelist="$root/lib/apk/packages/${pkgname}.list"
local ret=0
local ucitrack_before
if [ -e "${root}/usr/lib/opkg/info/${pkgname}.list" ]; then
filelist="${root}/usr/lib/opkg/info/${pkgname}.list"
@ -358,9 +357,6 @@ default_postinst() {
update_alternatives install "${pkgname}"
fi
[ -z "$root" ] && grep -m1 -q -s "^/etc/uci-defaults/" "$filelist" && \
ucitrack_before=`{ md5sum /etc/config/ucitrack 2>/dev/null || echo "empty"; } | cut -d ' ' -f 1`
if [ -d "$root/rootfs-overlay" ]; then
cp -R $root/rootfs-overlay/. $root/
rm -fR $root/rootfs-overlay/
@ -375,7 +371,7 @@ default_postinst() {
/etc/init.d/sysctl restart
fi
if [ -n "$ucitrack_before" ]; then
if grep -m1 -q -s "^/etc/uci-defaults/" "$filelist"; then
[ -d /tmp/.uci ] || mkdir -p /tmp/.uci
for i in $(grep -s "^/etc/uci-defaults/" "$filelist"); do
( [ -f "$i" ] && cd "$(dirname $i)" && . "$i" ) && rm -f "$i"
@ -383,20 +379,7 @@ default_postinst() {
uci commit
fi
if grep -m1 -q -s "^/usr/share/rpcd/acl\\.d/" "$filelist"; then
/etc/init.d/rpcd reload 2>/dev/null
fi
if grep -m1 -q -s "^/usr/lib/lua/luci/" "$filelist"; then
if grep -m1 -q -s "^/usr/lib/lua/luci/i18n/" "$filelist"; then
/etc/init.d/fix_luci_lang boot 2>/dev/null
touch /tmp/luci-i18n-mtime
fi
rm -rf /tmp/luci-indexcache /tmp/luci-modulecache /tmp/luci-indexcache.*
fi
if grep -m1 -q -s "^/usr/share/luci/menu.d/" "$filelist"; then
rm -f /tmp/luci-indexcache.*
fi
rm -f /tmp/luci-indexcache
fi
if [ -f "$root/usr/lib/opkg/info/${pkgname}.postinst-pkg" ]; then
@ -416,13 +399,6 @@ default_postinst() {
fi
done
if [ -n "$ucitrack_before" ]; then
local after=`{ md5sum /etc/config/ucitrack 2>/dev/null || echo "empty"; } | cut -d ' ' -f 1`
if [ "x$after" != "x$ucitrack_before" ]; then
/etc/init.d/ucitrack_compat reload
fi
fi
return $ret
}

View File

@ -125,8 +125,8 @@ caldata_valid() {
caldata_patch_data() {
local data=$1
local data_count=$((${#1} / 2))
[ -n "$2" ] && local data_offset=$(($2))
[ -n "$3" ] && local chksum_offset=$(($3))
local data_offset=$(($2))
local chksum_offset=$(($3))
local target=$4
local fw_data
local fw_chksum

View File

@ -1,118 +0,0 @@
# > getbootdisk
# mmcblk0
_getbootdisk()
{
local rootpart="`grep -Fm1 ' - squashfs /dev/root ' /proc/self/mountinfo | cut -d' ' -f3`"
[ -z "$rootpart" ] && return 1
local devpath="`readlink /sys/dev/block/$rootpart`"
[ -z "$devpath" ] && return 1
rootpart="${devpath##*/}"
devpath="${devpath%%/$rootpart}"
local rootdisk="${devpath##*/}"
echo "$rootdisk"
}
# > getbootdisk_lvm
# dm-0
_getbootdisk_lvm()
{
local rootpart
if [ -e /rom/note ]; then
rootpart="`grep -Fm1 ' / / ' /proc/self/mountinfo | grep -F ' - squashfs ' | cut -d' ' -f3`"
else
rootpart="`grep -Fm1 ' / /rom ' /proc/self/mountinfo | grep -F ' - squashfs ' | cut -d' ' -f3`"
fi
[ -z "$rootpart" ] && return 1
local major=${rootpart%%:*}
local minor=${rootpart##*:}
minor="$(( $minor & 0xfffc ))"
local devpath="`readlink /sys/dev/block/$major:$minor`"
[ -z "$devpath" ] && return 1
local rootdisk="${devpath##*/}"
echo "$rootdisk"
}
# > getpartofdisk sda 3
# sda3
# > getpartofdisk mmcblk0 3
# mmcblk0p3
_getpartofdisk()
{
local disk="$1" offset="$2" part
if [[ "$offset" = 0 ]]; then
echo "$disk"
else
part="$disk"
echo "$part" | grep -q '^.*[0-9]$' && part="${part}p"
part="${part}"$(( ${offset} ))
if [ ! -b "/dev/$part" ]; then
# lvm
local line
local MAJOR MINOR DEVNAME DEVTYPE
while read line; do
export -n "$line"
done < "/sys/block/$disk/uevent"
local devpath="`readlink /sys/dev/block/$MAJOR:$(($MINOR + $offset))`"
if [ -n "$devpath" ]; then
part="${devpath##*/}"
fi
fi
echo "$part"
fi
return 0
}
_get_overlay_partition_default()
{
local bootdisk="`_getbootdisk`"
[ -z "$bootdisk" ] && {
log "getbootdisk failed, try lvm"
bootdisk="`_getbootdisk_lvm`"
}
[ -z "$bootdisk" ] && {
log "getbootdisk_lvm failed"
return 1
}
if [ ! -e "/sys/block/$bootdisk/uevent" ]; then
log "/sys/block/$bootdisk/uevent does not exist"
return 1
fi
if [ -e /rom/note ]; then
# we are in mount_root if /rom/note exists
cat "/sys/block/$bootdisk/uevent" > /tmp/.bootdisk
fi
local overlay_dev="`_getpartofdisk $bootdisk 3`"
[ -z "$overlay_dev" ] && {
log "getpartofdisk $bootdisk 3 failed"
return 1
}
OVERLAY_DEV="/dev/$overlay_dev"
return 0
}
_get_overlay_partition_fallback()
{
log "get_overlay_partition_fallback"
rm -f /tmp/.bootdisk >/dev/null 2>&1
local overlay_dev=$(
. /lib/functions.sh
. /lib/upgrade/common.sh
export_bootdevice && export_partdevice overlay_dev 3 && echo $overlay_dev
)
[ -z "$overlay_dev" ] && return 1
OVERLAY_DEV="/dev/$overlay_dev"
return 0
}
get_overlay_partition()
{
[ -e /.dockerenv ] && {
log "No overlay partition in Docker"
return 1
}
_get_overlay_partition_default || _get_overlay_partition_fallback || {
log "Unable to determine overlay partition"
return 1
}
return 0
}

View File

@ -66,7 +66,7 @@ get_mac_ascii() {
local key="$2"
local mac_dirty
mac_dirty=$(strings "$part" | tr -d ' \t' | sed -n 's/^'"$key"'=//p' | head -n 1)
mac_dirty=$(strings "$part" | sed -n 's/^'"$key"'=//p')
# "canonicalize" mac
[ -n "$mac_dirty" ] && macaddr_canonicalize "$mac_dirty"
@ -315,10 +315,3 @@ macaddr_canonicalize() {
dt_is_enabled() {
grep -q okay "/proc/device-tree/$1/status"
}
get_linux_version() {
local ver=$(uname -r)
local minor=${ver%\.*}
printf "%d%02d%03d" ${ver%%\.*} ${minor#*\.} ${ver##*\.} 2>/dev/null
}

View File

@ -67,7 +67,6 @@ _v() {
v() {
_v "$(date) upgrade: $@"
[ "$SAVE_LOG" = "1" ] && echo "$@" >>/overlay/upgrade.log
logger -p info -t upgrade "$@"
}
@ -169,16 +168,6 @@ part_magic_fat() {
export_bootdevice() {
local cmdline uuid blockdev uevent line class
local MAJOR MINOR DEVNAME DEVTYPE
if [ -f /tmp/.bootdisk ]; then
while read line; do
export -n "$line"
done < /tmp/.bootdisk
export BOOTDEV_MAJOR=$MAJOR
export BOOTDEV_MINOR=$MINOR
export BOOTDEV_DEVNAME=$DEVNAME
return 0
fi
local rootpart="$(cmdline_get_var root)"
case "$rootpart" in
@ -229,7 +218,6 @@ export_bootdevice() {
done < "$uevent"
export BOOTDEV_MAJOR=$MAJOR
export BOOTDEV_MINOR=$MINOR
export BOOTDEV_DEVNAME=$DEVNAME
return 0
fi
@ -237,27 +225,18 @@ export_bootdevice() {
}
export_partdevice() {
local var="$1" offset="$2" part
offset=$(( ${offset} ))
if [[ "$offset" = 0 ]]; then
export "$var=$BOOTDEV_DEVNAME"
return 0
else
part="$BOOTDEV_DEVNAME"
echo "$part" | grep -q '^.*[0-9]$' && part="${part}p"
part="${part}${offset}"
if [ -b "/dev/$part" ]; then
export "$var=$part"
local var="$1" offset="$2"
local uevent line MAJOR MINOR DEVNAME DEVTYPE
for uevent in /sys/class/block/*/uevent; do
while read line; do
export -n "$line"
done < "$uevent"
if [ "$BOOTDEV_MAJOR" = "$MAJOR" -a $(($BOOTDEV_MINOR + $offset)) = "$MINOR" -a -b "/dev/$DEVNAME" ]; then
export "$var=$DEVNAME"
return 0
else
# ventoy
local devpath="`readlink /sys/dev/block/$BOOTDEV_MAJOR:$(($BOOTDEV_MINOR + $offset))`"
[ -n "$devpath" ] && {
export "$var=${devpath##*/}"
return 0
}
fi
fi
done
return 1
}

View File

@ -16,12 +16,6 @@ if [ -n "$UPGRADE_BACKUP" ] && type 'platform_copy_config' >/dev/null 2>/dev/nul
fi
v "Upgrade completed"
grep /overlay /proc/mounts > /dev/null && {
/bin/mount -o noatime,remount,ro /overlay
/usr/bin/umount -R -d -l /overlay 2>/dev/null || /bin/umount -l /overlay
}
sleep 1
v "Rebooting system..."

View File

@ -18,21 +18,17 @@ include /lib/upgrade
supivot() { # <new_root> <old_root>
/bin/mount | grep "on $1 type" 2>&- 1>&- || /bin/mount -o bind $1 $1
mkdir -p $1$2 $1/proc $1/sys $1/dev $1/tmp $1/overlay $1/ext_overlay && \
/bin/mount -o noatime,rbind /proc $1/proc && \
mkdir -p $1$2 $1/proc $1/sys $1/dev $1/tmp $1/overlay && \
/bin/mount -o noatime,move /proc $1/proc && \
pivot_root $1 $1$2 || {
/bin/umount -l $1 $1
return 1
}
/bin/mount -o noatime,move $2/sys /sys || /bin/mount -o noatime,rbind $2/sys /sys
/bin/mount -o noatime,move $2/dev /dev || /bin/mount -o noatime,rbind $2/dev /dev
/bin/mount -o noatime,move $2/tmp /tmp || /bin/mount -o noatime,bind $2/tmp /tmp
/bin/mount -o noatime,move $2/sys /sys
/bin/mount -o noatime,move $2/dev /dev
/bin/mount -o noatime,move $2/tmp /tmp
/bin/mount -o noatime,move $2/overlay /overlay 2>&-
/bin/mount -o noatime,move $2/ext_overlay /ext_overlay 2>&-
/bin/umount -l $2/proc $2/sys $2/dev $2/tmp $2/overlay $2/ext_overlay 2>&-
/bin/umount -l $2/boot 2>&-
/bin/umount -l $2/boot 2>&- # some platforms like x86 have rebinded /boot
return 0
}
@ -51,7 +47,6 @@ switch_to_ramfs() {
ubidetach ubirsvol ubirmvol ubimkvol \
snapshot snapshot_tool date logger \
/usr/sbin/fw_printenv /usr/bin/fwtool \
/usr/bin/umount \
$RAMFS_COPY_LOSETUP $RAMFS_COPY_LVM \
$RAMFS_COPY_BIN
do
@ -67,21 +62,13 @@ switch_to_ramfs() {
[ -L "/lib64" ] && ln -s /lib $RAM_ROOT/lib64
# avoid shared rootfs, which makes `/bin/mount -o noatime,move * *` fail
# https://github.com/istoreos/istoreos/issues/1200
mount --make-private / 2>&-
mount --make-private /tmp 2>&-
mount --make-private /mnt 2>&-
mount --make-private /overlay 2>&-
mount --make-private /ext_overlay 2>&-
supivot $RAM_ROOT /mnt || {
v "Failed to switch over to ramfs. Please reboot."
exit 1
}
/bin/mount -o remount,ro /mnt
/usr/bin/umount -R -d -l /mnt 2>&- || /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
@ -92,6 +79,11 @@ switch_to_ramfs() {
mkdir -p /tmp/lvm/cache
$RAMFS_COPY_LVM vgchange -aln --ignorelockingfailure
}
grep /overlay /proc/mounts > /dev/null && {
/bin/mount -o noatime,remount,ro /overlay
/bin/umount -l /overlay
}
}
kill_remaining() { # [ <signal> [ <loop> ] ]
@ -140,51 +132,6 @@ kill_remaining() { # [ <signal> [ <loop> ] ]
done
}
istoreos_pre_upgrade() {
if [ -n "$UPGRADE_BACKUP" ]; then
local running_ver=$(grep 'DISTRIB_RELEASE=' /rom/etc/openwrt_release /etc/openwrt_release 2>/dev/null | head -n1 | sed -E "s/.*='(.+)'.*/\1/")
touch /usr/lib/opkg/.upgrading 2>/dev/null && sync /
# reset rom uuid in ext_overlay
if [ -e /ext_overlay/etc ]; then
[ -f /ext_overlay/upper/usr/lib/opkg/.upgrading ] || {
rm -f /ext_overlay/upper/usr/lib/opkg/.upgrading
mkdir -p /ext_overlay/upper/usr/lib/opkg
touch /ext_overlay/upper/usr/lib/opkg/.upgrading 2>/dev/null
}
echo "$running_ver" >/ext_overlay/.upgrading
[ -f /ext_overlay/upper/usr/lib/opkg/.upgrading ] && rm -f /ext_overlay/etc/.extroot-uuid
sync /ext_overlay
fi
echo "$running_ver" >/overlay/.upgrading
[ -f /overlay/upper/usr/lib/opkg/.upgrading ] || {
rm -f /overlay/upper/usr/lib/opkg/.upgrading
mkdir -p /overlay/upper/usr/lib/opkg
touch /overlay/upper/usr/lib/opkg/.upgrading 2>/dev/null
}
sync /overlay
fi
}
istoreos_show_new_firmware_version() {
local dist version revision
json_load "$(cat /tmp/sysupgrade.meta)" || {
return 1
}
json_select "version"
json_get_var dist "dist"
json_get_var version "version"
json_get_var revision "revision"
v "Flashing Version: '$dist $version $revision'"
}
date '+%Y-%m-%d %H:%M:%S' >/overlay/upgrade.log
export SAVE_LOG=1
v "Running Version: $(grep DISTRIB_DESCRIPTION= /rom/etc/openwrt_release /etc/openwrt_release 2>/dev/null | head -n1 | cut -d= -f2)"
if [ -s /tmp/sysupgrade.meta ]; then
(istoreos_show_new_firmware_version)
fi
indicate_upgrade
while read -r a b c; do
@ -209,36 +156,20 @@ killall -9 ash 2>/dev/null
kill_remaining TERM
sleep 4
sync
kill_remaining KILL 1
sleep 6
echo 3 > /proc/sys/vm/drop_caches
[ -n "$IMAGE" ] && istoreos_pre_upgrade
if [ -n "$IMAGE" ] && type 'platform_pre_upgrade' >/dev/null 2>/dev/null; then
platform_pre_upgrade "$IMAGE"
fi
ROOTFS_TYPE=$(rootfs_type)
if [ -n "$ROOTFS_TYPE" -a "$ROOTFS_TYPE" != "tmpfs" -a "$ROOTFS_TYPE" != "rootfs" ]; then
if [ -n "$(rootfs_type)" ]; then
v "Switching to ramdisk..."
switch_to_ramfs
fi
grep /ext_overlay /proc/mounts > /dev/null && {
/bin/mount -o noatime,remount,ro /ext_overlay
/usr/bin/umount -R -d -l /ext_overlay 2>/dev/null || /bin/umount -l /ext_overlay
}
if [ -z "$UPGRADE_BACKUP" ]; then
grep /overlay /proc/mounts > /dev/null && {
/bin/mount -o noatime,remount,ro /overlay
/usr/bin/umount -R -d -l /overlay 2>/dev/null || /bin/umount -l /overlay
}
fi
# Exec new shell from ramfs
exec /bin/busybox ash -c "$COMMAND"

View File

@ -1,92 +1,3 @@
#!/bin/sh
# Copyright (C) 2022 jjm2473@gmail.com
DEFAULT_OVERLAY_FS="ext4"
OVERLAY_LABEL="etc"
OVERLAY_FS=${DEFAULT_OVERLAY_FS}
OVERLAY_DEV=
log() {
echo "$1" >&2
}
inlog() {
$@ >&2
}
. /lib/functions/istoreos-boot.sh
CONFIRM=n
REBOOT=n
confirm()
{
[ "$1" = "y" ] && return 0
echo "This will erase all settings and remove any installed packages. Are you sure? [N/y]"
read CONFIRM
[ "$CONFIRM" = "y" -o "$CONFIRM" = "Y" ] && return 0
return 1
}
do_reset_nofs()
{
get_overlay_partition || exit 1
if [ -z "$OVERLAY_DEV" ]; then
echo "Unable to determine overlay partition" >&2
return 1
fi
if [ "RESET" = "$FSTYPE" ]; then
echo "Already resetted" >&2
return 1
fi
# if ! blkid -o device -t LABEL=$OVERLAY_LABEL "$OVERLAY_DEV" >/dev/null; then
# echo "Overlay partition $OVERLAY_DEV not labeled $OVERLAY_LABEL" >&2
# return 1
# fi
echo "RESET000" | dd of="$OVERLAY_DEV" bs=512 count=1 conv=notrunc,sync,fsync 2>/dev/null
echo 3 > /proc/sys/vm/drop_caches
return 0
}
do_reset_ext_overlay()
{
[ -d /ext_overlay ] && mountpoint -q /ext_overlay || return 0
rm -f /ext_overlay/etc/.extroot-uuid
touch /ext_overlay/.reset
sync /ext_overlay
}
do_reset()
{
if [ -f /.recovery_mode ]; then
mount_root || ( echo "/overlay mount failed!" ; exit 1 )
rm -rf /overlay/upper
mkdir /overlay/upper
sync /overlay
else
do_reset_nofs
do_reset_ext_overlay
fi
if [ -f /lib/upgrade/keep.d/grub ]; then
cat /lib/upgrade/keep.d/grub | while read; do
rm -f "$REPLY"
done
fi
[ "$REBOOT" = "y" ] && reboot
exit 0
}
while [[ $# -gt 0 ]]; do
key="$1"
case $key in
-y) CONFIRM=y ;;
-r) REBOOT=y ;;
esac
shift
done
confirm $CONFIRM && do_reset
exit 0
/sbin/jffs2reset $@

View File

@ -20,7 +20,6 @@ CONF_IMAGE=
CONF_BACKUP_LIST=0
CONF_BACKUP=
CONF_RESTORE=
USE_CURR_PART=0
NEED_IMAGE=
HELP=0
TEST=0
@ -51,7 +50,6 @@ while [ -n "$1" ]; do
-r|--restore-backup) CONF_RESTORE="$2" NEED_IMAGE=1; shift;;
-l|--list-backup) CONF_BACKUP_LIST=1;;
-f) CONF_IMAGE="$2"; shift;;
-s) USE_CURR_PART=1;;
-F|--force) export FORCE=1;;
-T|--test) TEST=1;;
-h|--help) HELP=1; break;;
@ -81,7 +79,6 @@ upgrade-option:
-p do not attempt to restore the partition table after flash.
-k include in backup a list of current installed packages at
$INSTALLED_PACKAGES
-s stay on current partition (for dual firmware devices)
-T | --test
Verify image and config .tar.gz but do not actually flash.
-F | --force
@ -419,7 +416,6 @@ else
json_add_string command "$COMMAND"
json_add_object options
json_add_int save_partitions "$SAVE_PARTITIONS"
[ $USE_CURR_PART -eq 1 ] && json_add_boolean use_curr_part 1
json_close_object
ubus call system sysupgrade "$(json_dump)"

View File

@ -1,528 +0,0 @@
#!/bin/sh
# Copyright (C) 2010 OpenWrt.org
# Copyright (C) 2020-2023 jjm2473@gmail.com
DEFAULT_OVERLAY_FS="ext4"
OVERLAY_LABEL="etc"
OVERLAY_FS=${DEFAULT_OVERLAY_FS}
OVERLAY_DEV=
log() {
echo "<1>mount_root: $1" >/dev/kmsg
}
inlog() {
$@ >/dev/kmsg 2>&1
}
. /lib/functions/istoreos-boot.sh
validate_overlay_partition()
{
log "- mount overlayfs -"
# Check device existence
[ ! -e "$OVERLAY_DEV" ] && \
log "overlay: $OVERLAY_DEV not found" && return 1
[ -n "$FSTYPE" ] && return 0
# get filesystem
if dd if="$OVERLAY_DEV" bs=5 count=1 2>/dev/null | grep -qF RESET; then
FSTYPE=RESET
log "overlay: $OVERLAY_DEV marked as RESET, format later"
return 0
elif blkid -o device -t LABEL=$OVERLAY_LABEL "$OVERLAY_DEV" >/dev/null; then
FSTYPE=`blkid -o value -s TYPE $OVERLAY_DEV`
else
FSTYPE=RESET
log "overlay: $OVERLAY_DEV not labeled, format later"
return 0
fi
if [ -z "$FSTYPE" ]; then
log "overlay: no valid filesystem"
else
log "overlay: filesystem $FSTYPE found"
fi
}
format_overlay_partition()
{
local RET
[ "$FSTYPE" = "$OVERLAY_FS" ] && return 0
log "overlay: try to format $OVERLAY_DEV as $OVERLAY_FS partition"
case "$OVERLAY_FS" in
ext4)
mkfs.ext4 -q -j -FF -L $OVERLAY_LABEL "$OVERLAY_DEV"
RET=$?
[ $RET -ne 0 ] || tune2fs -o '^user_xattr,^acl' -r 1024 "$OVERLAY_DEV"
;;
*)
log "overlay: unhandled fs type : $OVERLAY_FS"
RET=1
;;
esac
if [ $RET -ne 0 ]; then
log "overlay: format command failed ret: $RET"
else
echo 3 > /proc/sys/vm/drop_caches
FSTYPE=$OVERLAY_FS
fi
return $RET
}
check_overlay_partition()
{
case "$FSTYPE" in
ext4)
fsck.ext4 -y "$OVERLAY_DEV" >/dev/null
sync
resize2fs "$OVERLAY_DEV"
sync
;;
esac
}
mount_overlay_partition()
{
local RET
mount -t $OVERLAY_FS "$OVERLAY_DEV" /overlay
RET=$?
[ $RET -ne 0 ] && \
log "overlay: failed to mount $OVERLAY_DEV as $OVERLAY_FS partition ret: $RET" && return $RET
log 'overlay: successfully mounted'
}
OVERLAYFS_XATTR=""
is_overlayfs_use_xattr() {
# only linux 4.13 or above
[ -z "$OVERLAYFS_XATTR" ] && OVERLAYFS_XATTR=$([ "0$((`uname -r | cut -d. -f1-2 | sed 's/\./ * 100 + /'`))" -ge 413 ] && echo 1 || echo 0)
[ "$OVERLAYFS_XATTR" = "1" ]
}
ROOTFS_UUID=""
rootfs_uuid() {
if [ -z "$ROOTFS_UUID" ]; then
ROOTFS_UUID=`block info | grep -Fw 'MOUNT="/"' | sed -E 's/.* UUID="([^"]+)" .*/\1/'`
[ -z "$ROOTFS_UUID" ] && ROOTFS_UUID="UNKNOWN"
fi
echo "$ROOTFS_UUID"
}
update_overlay_lower_uuid() {
local realuuid=`rootfs_uuid`
local lastuuid="NULL"
if [ -f "$1/.rootfs-uuid" ]; then
lastuuid=`cat "$1/.rootfs-uuid"`
fi
if [ "$realuuid" != "$lastuuid" ]; then
echo "$realuuid" >"$1/.rootfs-uuid"
return 0
fi
return 1
}
clean_overlayfs_origin() {
local line
cd "$1"
getfattr -R -P -h --match='trusted.overlay.origin' . 2>/dev/null | grep '^# file: ' | cut -c9- | while read; do
line="$REPLY"
setfattr -x "trusted.overlay.origin" -h "$line" 2>/dev/null
done
cd - >/dev/null 2>&1
}
clean_overlayfs_redundant_opaque() {
local line
cd "$1"
getfattr -R -P -h --match='trusted.overlay.opaque' . 2>/dev/null | grep '^# file: ' | cut -c9- | while read; do
line="$REPLY"
[ -z "$line" -o -d "/$line" ] && continue
setfattr -x "trusted.overlay.opaque" -h "$line" 2>/dev/null
done
cd - >/dev/null 2>&1
}
clean_overlayfs_redundant_whiteout_marker()
{
local line
cd "$1"
find upper -xdev -path 'upper/opt' -prune ! -type d -o -type c -perm 0 -user 0 -group 0 | sed 's#^upper/#/#g' | while read; do
line="$REPLY"
[ ! -e "$line" -a \( -z "$2" -o ! -e "$2/upper$line" \) ] && \
rm -f "upper$line"
done
cd - >/dev/null 2>&1
}
clean_overlayfs_redundant_whiteout_marker_luci()
{
local line
[ -d "$1/upper/usr/lib/lua/luci" ] || return 0
cd "$1/upper/usr/lib/lua"
find luci -xdev -type c -perm 0 -user 0 -group 0 | while read; do
line="$REPLY"
[ ! -e "/usr/lib/lua/$line" -a \( -z "$2" -o ! -e "$2/upper/usr/lib/lua/$line" \) ] && \
rm -f "$line"
done
cd - >/dev/null 2>&1
}
clean_os_version_files()
{
cd "$1"
rm -f upper/etc/openwrt_release \
upper/etc/openwrt_version \
upper/usr/lib/os-release
cd - >/dev/null 2>&1
}
nonconf_files_of_pkg() {
local pkgname="$1"
if [ -s /usr/lib/opkg/info/${pkgname}.conffiles ]; then
grep -hvxFf /usr/lib/opkg/info/${pkgname}.conffiles \
/usr/lib/opkg/info/${pkgname}.list
else
cat /usr/lib/opkg/info/${pkgname}.list
fi
}
clean_pkg_content() {
local overlay="$1"
local pkgname="$2"
local line
if [ -f /usr/lib/opkg/info/${pkgname}.control ]; then
if [ -f /usr/lib/opkg/info/${pkgname}.list ]; then
nonconf_files_of_pkg "${pkgname}" | grep -v '^/etc/uci-defaults/' | while read; do
line="$REPLY"
rm -f "$overlay/upper/${line}"
done
rm -f $overlay/upper/usr/lib/opkg/info/${pkgname}.list
fi
rm -f $overlay/upper/usr/lib/opkg/info/${pkgname}.*
fi
}
pkg_depends_rec() {
local pkgname="$1"
local line
local dep
local deps
echo "${pkgname}" | grep -q '^kmod-' && return
if [ -f /usr/lib/opkg/info/${pkgname}.control -a ! -f /tmp/reset_core_packages/${pkgname} ]; then
deps=`grep '^Depends: ' /usr/lib/opkg/info/${pkgname}.control | sed -e 's/^Depends: //' -e 's/ ([^)]*)//g' -e 's/,/ /g'`
touch /tmp/reset_core_packages/${pkgname}
for dep in $deps ; do
pkg_depends_rec "$dep"
done
fi
}
list_core_packages()
{
local pkg
mkdir -p /tmp/reset_core_packages
for pkg in \
luci-compat luci-lua-runtime luci-lib-base luci-base uhttpd luci-ssl-openssl luci-ssl \
rpcd procd \
netifd dnsmasq-full dnsmasq firewall4 \
block-mount \
curl \
ttyd dropbear kernel
do
pkg_depends_rec $pkg
done
}
reset_core_packages()
{
local overlay="$1"
local running_ver=$(grep 'DISTRIB_RELEASE=' /etc/openwrt_release 2>/dev/null | sed -E "s/.*='(.+)'.*/\1/")
[ "v$(cat "$overlay/.upgrading" 2>/dev/null)" = "v$running_ver" ] && return
local pkg
[ -d /tmp/reset_core_packages ] || list_core_packages
echo "Reset packages in $overlay: `ls /tmp/reset_core_packages/ | xargs echo`" | dd bs=960 2>/dev/null
ls /tmp/reset_core_packages/ | while read; do
pkg="$REPLY"
clean_pkg_content "$overlay" $pkg
done
}
clean_kmods()
{
local DUMMY_VERSION=0.0.0-r1
if [ -d "$1/upper/usr/lib/opkg/info" ]; then
local compat=`grep -m1 '^Version: ' /usr/lib/opkg/info/kernel.control | sed 's/^Version: //'`
if [ -n "$compat" ]; then
cd "$1/upper/usr/lib/opkg/info"
# ignore processed
grep -Lm1 '^Version: '$DUMMY_VERSION'$' kmod-*.control 2>/dev/null | sed 's/.control$//' > /tmp/cand_kmods.txt
if [ -s /tmp/cand_kmods.txt ]; then
grep -LFm1 "kernel (=$compat)" kmod-*.control | sed 's/.control$//' | grep -Fxf /tmp/cand_kmods.txt > /tmp/del_kmods.txt
grep -lFm1 "kernel (=$compat)" kmod-*.control | sed 's/.control$//' | grep -Fxf /tmp/cand_kmods.txt > /tmp/safe_kmods.txt
else
> /tmp/del_kmods.txt
fi
rm -f /tmp/cand_kmods.txt
# remove duplicated
if [ -s /tmp/safe_kmods.txt ]; then
( cd /usr/lib/opkg/info && ls kmod-*.control 2>/dev/null | sed 's/.control$//' ) | grep -Fxf /tmp/safe_kmods.txt >> /tmp/del_kmods.txt
fi
rm -f /tmp/safe_kmods.txt
if [ -s /tmp/del_kmods.txt ]; then
echo "Clean kmods in $1: `cat /tmp/del_kmods.txt | xargs echo`" | dd bs=960 2>/dev/null
cat /tmp/del_kmods.txt | sed 's/$/.list/' | xargs cat | sed "s#^/#$1/upper/#" | xargs -r rm -f
cat /tmp/del_kmods.txt | xargs -rn1 sh -c 'rm -f $0.list $0.prerm $0.postinst'
cat /tmp/del_kmods.txt | sed 's/$/.control/' | xargs -r sed -i 's/^Version: .*$/Version: '$DUMMY_VERSION'/g'
fi
rm -f /tmp/del_kmods.txt
cd - >/dev/null 2>&1
return 0
fi
else
return 0
fi
# rm -rf $1/upper/lib/modules $1/upper/etc/modules-boot.d \
# $1/upper/etc/modules.d $1/upper/usr/lib/opkg/info/kmod-* \
# $1/upper/usr/lib/opkg/info/kernel.* 2>/dev/null
}
prepare_primary_overlay()
{
if [ -f /overlay/.reset ]; then
rm -rf /overlay/upper /overlay/work
rm -f /overlay/.reset
sync /overlay
fi
}
prepare_primary_overlay_after_merge()
{
if [ -d /overlay/upper ]; then
if update_overlay_lower_uuid /overlay || [ -f /overlay/.upgrading ] ; then
clean_os_version_files /overlay
reset_core_packages /overlay
touch /overlay/.upgrading
fi
if [ -f /overlay/.upgrading -o -f /overlay/.merged ] ; then
if is_overlayfs_use_xattr ; then
clean_overlayfs_origin /overlay/upper
clean_overlayfs_redundant_opaque /overlay/upper
fi
clean_overlayfs_redundant_whiteout_marker /overlay
else
clean_overlayfs_redundant_whiteout_marker_luci /overlay
fi
else
update_overlay_lower_uuid /overlay
fi
if [ -f /overlay/upper/usr/lib/opkg/.upgrading ]; then
clean_kmods /overlay
fi
rm -f /overlay/.upgrading /overlay/.merged
mkdir -p /overlay/upper /overlay/work
}
pivot_root_to_overlayfs()
{
# pivot
mount --move /proc /mnt/proc
pivot_root /mnt /mnt/rom || return 1
mount --move /rom/dev /dev
mount --move /rom/tmp /tmp
mount --move /rom/sys /sys
mount --move /rom/overlay /overlay
}
mount_extroot()
{
[ -f /overlay/upper/etc/config/fstab ] || return 1
# let `block extroot` read /overlay/upper/etc/config/fstab
mount --bind /overlay/upper/etc/config /etc/config || return 1
block extroot
local ret=$?
umount /etc/config
return $ret
}
apply_overlayfs_opaque() {
local line
local dest="$2"
cd "$1"
if is_overlayfs_use_xattr; then
getfattr -R -P -h --match='trusted.overlay.opaque' upper 2>/dev/null | grep '^# file: ' | cut -c9- | while read; do
line="$REPLY"
rm -rf "$dest/$line"
done
fi
find upper -xdev -type c | while read; do
line="$REPLY"
rm -rf "$dest/$line"
done
cd - >/dev/null 2>&1
}
prepare_ext_overlay()
{
local newoverlaydir=$1
local overlaydir=$2
if [ -f "$newoverlaydir/.reset" ]; then
rm -rf "$newoverlaydir/upper"
rm -f "$newoverlaydir/.commit" "$newoverlaydir/.reset"
elif [ -f "$newoverlaydir/.commit" ]; then
if [ -d "$newoverlaydir/upper" ]; then
apply_overlayfs_opaque "$newoverlaydir" "$overlaydir"
fi
cp -a "$newoverlaydir/upper/." "$overlaydir/upper" && {
touch "$overlaydir/.merged"
rmdir "$overlaydir/upper/ext_overlay"
rm -rf "$newoverlaydir/upper"
mkdir -m 0755 -p "$newoverlaydir/upper/ext_overlay"
}
rm -f "$newoverlaydir/.commit"
else
prepare_primary_overlay_after_merge
touch "$overlaydir/.clean"
if [ -f "$newoverlaydir/upper/usr/lib/opkg/.upgrading" ]; then
clean_kmods "$newoverlaydir"
fi
if [ -f "$newoverlaydir/.upgrading" ]; then
clean_os_version_files "$newoverlaydir"
reset_core_packages "$newoverlaydir"
is_overlayfs_use_xattr && clean_overlayfs_origin "$newoverlaydir/upper"
fi
if [ -d "$newoverlaydir/upper" -a \( -f "$newoverlaydir/upper/usr/lib/opkg/.upgrading" -o ! -f "$overlaydir/.sandbox" \) ]; then
clean_overlayfs_redundant_whiteout_marker "$newoverlaydir" "$overlaydir"
else
clean_overlayfs_redundant_whiteout_marker_luci "$newoverlaydir" "$overlaydir"
fi
fi
rm -f "$newoverlaydir/.upgrading"
( mkdir -m 0755 -p $newoverlaydir/upper/ext_overlay && \
mkdir -m 0755 -p $newoverlaydir/work ) || return 1
return 0
}
prepare_mnt()
{
rm -rf /tmp/reset_core_packages
prepare_primary_overlay
if mount_extroot && mountpoint -q /tmp/extroot/mnt; then
local dir
for dir in proc dev tmp sys overlay rom root; do
mkdir -m 0755 /tmp/extroot/mnt/$dir
done
if mount --move /tmp/extroot/mnt /mnt; then
# writeable extroot existed, we don't need overlay
umount /tmp/extroot/overlay
return 0
fi
umount /tmp/extroot/mnt
fi
local lowerdir=/
local overlaydir=/overlay
if mountpoint -q /tmp/extroot/overlay; then
# use ext overlay as upper layer
local newoverlaydir=/tmp/extroot/overlay
if [ `mountpoint -x "$OVERLAY_DEV"` != `mountpoint -d $newoverlaydir` ] && \
prepare_ext_overlay $newoverlaydir $overlaydir && \
mount --move /tmp/extroot/overlay /ext_overlay; then
lowerdir=$overlaydir/upper:$lowerdir
overlaydir=/ext_overlay
else
umount /tmp/extroot/overlay
fi
fi
if [ -f /overlay/.clean ]; then
rm -f /overlay/.clean
else
prepare_primary_overlay_after_merge
fi
rm -rf /tmp/reset_core_packages
mount -o noatime,lowerdir=$lowerdir,upperdir=$overlaydir/upper,workdir=$overlaydir/work \
-t overlay "overlayfs:/overlay" /mnt \
|| return 1
if [ "$overlaydir" = "/ext_overlay" ]; then
[ -f "/overlay/.sandbox" ] || touch "/overlay/.sandbox"
else
rm -f "/overlay/.sandbox"
fi
sync
return 0
}
post_extroot()
{
mountpoint -q /rom/ext_overlay && mount --move /rom/ext_overlay /ext_overlay
mountpoint -q /tmp/extroot/overlay && umount /tmp/extroot/overlay
rmdir /tmp/extroot/overlay
mountpoint -q /tmp/extroot/mnt && umount /tmp/extroot/mnt
rmdir /tmp/extroot/mnt
rmdir /tmp/extroot
mountpoint -q /rom/dev && umount /rom/dev
}
do_mount_overlayfs()
{
[ ! -e /rom/note ] && return 0
inlog get_overlay_partition || return 1
inlog validate_overlay_partition || return 1
inlog format_overlay_partition || return 1
inlog check_overlay_partition
inlog mount_overlay_partition || return 1
# if we are in recovery mode, just skip pivot_root
if [ -f /.recovery_mode ]; then
rm -f /rom/note >/dev/null 2>&1
return 0
fi
inlog prepare_mnt || return 1
inlog pivot_root_to_overlayfs || return 1
post_extroot >/dev/null 2>&1
inlog mount --make-shared -t tmpfs -o size=4M tmpfs /mnt
return 0
}
[ -n "$1" -a "$1" != "start" ] || ( do_mount_overlayfs && exit 0 )

View File

@ -1,69 +0,0 @@
#!/bin/sh
# Copyright (C) 2022 jjm2473@gmail.com
action=${1}
shift
disable_if_sandbox()
{
local enabled
local target
config_get target $1 "target" "/tmp/null"
[ "$target" = "/overlay" ] || return
config_get_bool enabled $1 "enabled" "0"
[ "$enabled" = 1 ] && uci_set fstab $1 "enabled" "0"
}
disable_all_sandbox()
{
. /lib/functions.sh
uci_load "fstab"
config_foreach disable_if_sandbox mount
uci_commit "fstab"
}
exit_sandbox()
{
UCI_CONFIG_DIR=/overlay/upper/etc/config disable_all_sandbox
}
reset_sandbox()
{
touch /ext_overlay/.reset && sync /ext_overlay
}
commit_sandbox()
{
touch /ext_overlay/.commit && sync /ext_overlay
}
usage() {
echo "Usage: sandbox sub-command"
echo "where sub-command is one of:"
echo " reset Reset sandbox"
echo " commit Commit sandbox"
echo " exit Exit sandbox"
}
if grep '^overlayfs:/overlay / ' /proc/mounts | grep -Fq 'upperdir=/ext_overlay/upper'; then
case $action in
"reset")
reset_sandbox
;;
"commit")
commit_sandbox
;;
"exit")
exit_sandbox
;;
"status")
exit 0
;;
*)
usage >&2
exit 1
;;
esac
else
echo "Not sandbox environment" >&2
exit 1
fi

View File

@ -44,7 +44,7 @@ config TARGET_PREINIT_DISABLE_FAILSAFE
config TARGET_PREINIT_TIMEOUT
int
prompt "Failsafe/Debug wait timeout" if PREINITOPT
default 2
default 4
help
How long to wait for failsafe mode to be entered or for
a debug option to be pressed before continuing with a
@ -117,7 +117,7 @@ menuconfig INITOPT
config TARGET_INIT_PATH
string
prompt "PATH for regular boot" if INITOPT
default "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
default "/usr/sbin:/usr/bin:/sbin:/bin"
help
Default PATH used during normal operation
@ -165,7 +165,7 @@ if VERSIONOPT
config VERSION_DIST
string
prompt "Release distribution"
default "iStoreOS"
default "OpenWrt"
help
This is the name of the release distribution.
If unspecified, it defaults to OpenWrt.
@ -190,7 +190,7 @@ if VERSIONOPT
config VERSION_REPO
string
prompt "Release repository"
default "https://downloads.openwrt.org/releases/24.10.5"
default "https://downloads.openwrt.org/releases/24.10-SNAPSHOT"
help
This is the repository address embedded in the image, it defaults
to the trunk snapshot repo; the url may contain the following placeholders:

View File

@ -35,8 +35,6 @@ define Trusted-Firmware-A/Default
DRAM_USE_COMB:=
RAM_BOOT_UART_DL:=
USE_UBI:=
FIP_OFFSET:=
FIP_SIZE:=
endef
define Trusted-Firmware-A/mt7622-nor-1ddr
@ -223,16 +221,6 @@ define Trusted-Firmware-A/mt7981-spim-nand-ddr3
DDR_TYPE:=ddr3
endef
define Trusted-Firmware-A/mt7981-cudy-tr3000-v1
NAME:=Cudy TR3000 v1 (SPI-NAND via SPIM, DDR3)
BOOT_DEVICE:=spim-nand
BUILD_SUBTARGET:=filogic
PLAT:=mt7981
DDR_TYPE:=ddr3
FIP_OFFSET:=0x3c0000
FIP_SIZE:=0x200000
endef
define Trusted-Firmware-A/mt7986-ram-ddr4
NAME:=MediaTek MT7986 (RAM, DDR4)
BOOT_DEVICE:=ram
@ -546,7 +534,6 @@ TFA_TARGETS:= \
mt7981-ram-ddr4 \
mt7981-emmc-ddr4 \
mt7981-spim-nand-ddr4 \
mt7981-cudy-tr3000-v1 \
mt7986-ram-ddr3 \
mt7986-emmc-ddr3 \
mt7986-nor-ddr3 \
@ -594,8 +581,6 @@ TFA_MAKE_FLAGS += \
$(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)) \
$(if $(USE_UBI),UBI=1 $(if $(findstring mt7986,$(PLAT)),OVERRIDE_UBI_START_ADDR=0x200000)) \
$(if $(FIP_OFFSET),OVERRIDE_FIP_BASE=$(FIP_OFFSET)) \
$(if $(FIP_SIZE),OVERRIDE_FIP_SIZE=$(FIP_SIZE)) \
$(if $(RAM_BOOT_UART_DL),bl2,all)
define Package/trusted-firmware-a-ram/install

View File

@ -7,11 +7,10 @@
include $(TOPDIR)/rules.mk
PKG_VERSION:=2.10.17
PKG_VERSION:=2.10
PKG_RELEASE:=1
PKG_LTS:=1
PKG_HASH:=2558b2579dd1c45db6de89c49e647c109022d45da03eb74e0f6123c294295099
PKG_HASH:=88215a62291b9ba87da8e50b077741103cdc08fb6c9e1ebd34dfaace746d3201
PKG_MAINTAINER:=Thomas Richard <thomas.richard@bootlin.com>
include $(INCLUDE_DIR)/kernel.mk

View File

@ -201,9 +201,4 @@ define Build/Compile
CROSS_COMPILE=$(TARGET_CROSS)
endef
define Build/InstallDev
$(INSTALL_DIR) $(STAGING_DIR_IMAGE)
$(INSTALL_DATA) $(PKG_BUILD_DIR)/$(BINARIES_DIR)/at91bootstrap.bin $(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-at91bootstrap.bin
endef
$(eval $(call BuildPackage/AT91Bootstrap))

View File

@ -129,28 +129,28 @@ define Package/grub2/install
-O i386-pc \
-c $(PKG_BUILD_DIR)/grub-early.cfg \
-o $(STAGING_DIR_IMAGE)/grub2/gpt-core.img \
at_keyboard biosdisk boot chain configfile echo fat linux loadenv ls part_gpt reboot search serial test vga
at_keyboard biosdisk boot chain configfile fat linux ls part_gpt reboot search serial test vga
$(STAGING_DIR_HOST)/bin/grub-mkimage \
-d $(PKG_BUILD_DIR)/grub-core \
-p /boot/grub \
-O i386-pc \
-c ./files/grub-early.cfg \
-o $(STAGING_DIR_IMAGE)/grub2/generic-core.img \
at_keyboard biosdisk boot chain configfile echo ext2 linux loadenv ls part_msdos reboot search serial test vga
at_keyboard biosdisk boot chain configfile ext2 linux ls part_msdos reboot search serial test vga
$(STAGING_DIR_HOST)/bin/grub-mkimage \
-d $(PKG_BUILD_DIR)/grub-core \
-p /boot/grub \
-O i386-pc \
-c ./files/grub-early.cfg \
-o $(STAGING_DIR_IMAGE)/grub2/eltorito.img \
at_keyboard biosdisk boot chain configfile echo iso9660 linux loadenv ls part_msdos reboot search serial test vga
at_keyboard biosdisk boot chain configfile iso9660 linux ls part_msdos reboot search serial test vga
$(STAGING_DIR_HOST)/bin/grub-mkimage \
-d $(PKG_BUILD_DIR)/grub-core \
-p /boot/grub \
-O i386-pc \
-c ./files/grub-early.cfg \
-o $(STAGING_DIR_IMAGE)/grub2/legacy-core.img \
biosdisk boot chain configfile echo ext2 linux loadenv ls part_msdos reboot search serial vga
biosdisk boot chain configfile ext2 linux ls part_msdos reboot search serial vga
endef
define Package/grub2-efi/install
@ -161,14 +161,14 @@ define Package/grub2-efi/install
-O $(CONFIG_ARCH)-efi \
-c $(PKG_BUILD_DIR)/grub-early.cfg \
-o $(STAGING_DIR_IMAGE)/grub2/boot$(if $(CONFIG_x86_64),x64,ia32).efi \
at_keyboard boot chain configfile echo fat linux loadenv ls part_gpt reboot search serial test efi_gop efi_uga
at_keyboard boot chain configfile fat linux ls part_gpt reboot serial test efi_gop efi_uga
$(STAGING_DIR_HOST)/bin/grub-mkimage \
-d $(PKG_BUILD_DIR)/grub-core \
-p /boot/grub \
-O $(CONFIG_ARCH)-efi \
-c ./files/grub-early.cfg \
-o $(STAGING_DIR_IMAGE)/grub2/iso-boot$(if $(CONFIG_x86_64),x64,ia32).efi \
boot chain configfile echo fat iso9660 linux loadenv ls part_msdos part_gpt reboot serial test efi_gop efi_uga
boot chain configfile fat iso9660 linux ls part_msdos part_gpt reboot serial test efi_gop efi_uga
endef
define Package/grub2-efi-arm/install
@ -181,7 +181,7 @@ define Package/grub2-efi-arm/install
-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 test efi_gop lsefi minicmd ext2
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 \

View File

@ -63,40 +63,13 @@ define Trusted-Firmware-A/rk3588
TPL:=rk35/rk3588_ddr_lp4_2112MHz_lp5_2400MHz_v1.16.bin
endef
define Trusted-Firmware-A/rk3528
BUILD_SUBTARGET:=armv8
ATF:=rk35/rk3528_bl31_v1.17.elf
TPL:=rk35/rk3528_ddr_1056MHz_v1.09.bin
endef
define Trusted-Firmware-A/rk3576
BUILD_SUBTARGET:=armv8
ATF:=rk35/$$(ATF_FILE)
TPL:=rk35/$$(TPL_FILE)
endef
define Trusted-Firmware-A/rk3588-lp4-1866
$(call Trusted-Firmware-A/rk3588,$(1))
TPL:=$$(MOD_TPL)
endef
define Trusted-Firmware-A/rk3588-uart2-115200
$(call Trusted-Firmware-A/rk3588,$(1))
TPL:=$$(MOD_TPL)
endef
TFA_TARGETS:= \
rk3308 \
rk3308-rock-pi-s \
rk3528 \
rk3566 \
rk3568 \
rk3568-e25 \
rk3576 \
rk3588 \
rk3588-lp4-1866 \
rk3588-uart2-115200
rk3588
ifeq ($(BUILD_VARIANT),rk3308-rock-pi-s)
TPL_FILE:=rk3308_ddr_589MHz_uart0_m0_v2.07.bin
@ -130,58 +103,6 @@ ifeq ($(BUILD_VARIANT),rk3568-e25)
endef
endif
ifeq ($(BUILD_VARIANT),rk3576)
ATF_FILE:=rk3576_bl31_v1.15.elf
TPL_FILE:=rk3576_ddr_lp4_2112MHz_lp5_2736MHz_v1.09.bin
define Download/rk3576-atf
FILE:=$(ATF_FILE)
URL:=https://github.com/rockchip-linux/rkbin/raw/f43a462e7a1429a9d407ae52b4745033034a6cf9/bin/rk35/
HASH:=86c1c3e449612bd4ed045da187e58042e3dfb582f14bf5bd3e0954874095a581
endef
define Download/rk3576-tpl
FILE:=$(TPL_FILE)
URL:=https://github.com/rockchip-linux/rkbin/raw/f43a462e7a1429a9d407ae52b4745033034a6cf9/bin/rk35/
HASH:=79bdf7eb259274eec83ea2f6330214b0c0035255bc5563746871f6f8ce7cf089
endef
define Build/Prepare
$(eval $(call Download,rk3576-atf))
$(eval $(call Download,rk3576-tpl))
$(call Build/Prepare/Default)
$(CP) $(DL_DIR)/$(ATF_FILE) $(PKG_BUILD_DIR)/bin/rk35/
$(CP) $(DL_DIR)/$(TPL_FILE) $(PKG_BUILD_DIR)/bin/rk35/
endef
endif
ifeq ($(BUILD_VARIANT),rk3588-lp4-1866)
$(eval $(call Trusted-Firmware-A/rk3588,$(BUILD_VARIANT)))
SRC_TPL:=$(TPL)
MOD_TPL:=$(subst _lp4_2112MHz_,_lp4_1866MHz_,$(TPL))
define Build/Prepare
$(call Build/Prepare/Default)
$(STAGING_DIR_HOST)/bin/sed 's/^lp4_freq=.*/lp4_freq=1866/' $(PKG_BUILD_DIR)/tools/ddrbin_param.txt > $(PKG_BUILD_DIR)/tools/ddrbin_param_lp4-1866.txt
$(CP) $(PKG_BUILD_DIR)/bin/$(SRC_TPL) $(PKG_BUILD_DIR)/bin/$(MOD_TPL)
$(PKG_BUILD_DIR)/tools/ddrbin_tool rk3588 $(PKG_BUILD_DIR)/tools/ddrbin_param_lp4-1866.txt $(PKG_BUILD_DIR)/bin/$(MOD_TPL)
endef
endif
ifeq ($(BUILD_VARIANT),rk3588-uart2-115200)
$(eval $(call Trusted-Firmware-A/rk3588,$(BUILD_VARIANT)))
SRC_TPL:=$(TPL)
MOD_TPL:=$(subst MHz_v,MHz_uart2_115200_v,$(TPL))
define Build/Prepare
$(call Build/Prepare/Default)
$(STAGING_DIR_HOST)/bin/sed 's/^uart baudrate=.*/uart baudrate=115200/' $(PKG_BUILD_DIR)/tools/ddrbin_param.txt > $(PKG_BUILD_DIR)/tools/ddrbin_param_uart2-115200.txt
$(CP) $(PKG_BUILD_DIR)/bin/$(SRC_TPL) $(PKG_BUILD_DIR)/bin/$(MOD_TPL)
$(PKG_BUILD_DIR)/tools/ddrbin_tool rk3588 $(PKG_BUILD_DIR)/tools/ddrbin_param_uart2-115200.txt $(PKG_BUILD_DIR)/bin/$(MOD_TPL)
endef
endif
define Build/Compile
endef

View File

@ -43,7 +43,6 @@ endef
define Trusted-Firmware-A/Default
BUILD_TARGET:=layerscape
BUILD_SUBTARGET:=armv8_64b
BUILD_DEVICES:=fsl_$(1)
DEPENDS:=+layerscape-rcw +u-boot-fsl_$(1)
endef

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:=git-20240315
PKG_RELEASE:=$(AUTORELEASE)
PKG_SOURCE_PROTO:=default
PKG_SOURCE:=ophub-uboot-prebuilt-$(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:=jjm2473
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:=meson
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

@ -179,9 +179,4 @@ define Build/Compile
$(UBOOT_MAKE_FLAGS)
endef
define Build/InstallDev
$(INSTALL_DIR) $(STAGING_DIR_IMAGE)
$(INSTALL_DATA) $(PKG_BUILD_DIR)/$(UBOOT_IMAGE) $(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-$(UBOOT_IMAGE)
endef
$(eval $(call BuildPackage/U-Boot))

View File

@ -1,21 +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
gw,imx8m*|\
gateworks,imx8m*)
# board boots from emmc boot0 hardware partition
ubootenv_add_uci_config /dev/mmcblk2boot0 0x3f0000 0x8000
ubootenv_add_uci_config /dev/mmcblk2boot0 0x3f8000 0x8000
esac
config_load ubootenv
config_foreach ubootenv_add_app_config ubootenv
exit 0

View File

@ -34,14 +34,10 @@ ubootenv_add_ubi_default() {
case "$board" in
abt,asr3000|\
cmcc,a10-ubootmod|\
cudy,tr3000-v1-ubootmod|\
h3c,magic-nx30-pro|\
jcg,q30-pro|\
konka,komi-a31|\
mercusys,mr90x-v1-ubi|\
netcore,n60|\
netis,nx31|\
nokia,ea0326gmp|\
qihoo,360t7|\
routerich,ax3000-ubootmod|\
@ -61,8 +57,7 @@ acer,vero-w6m|\
glinet,gl-mt2500|\
glinet,gl-mt6000|\
glinet,gl-x3000|\
glinet,gl-xe3000|\
huasifei,wh3000)
glinet,gl-xe3000)
local envdev=$(find_mmc_part "u-boot-env")
ubootenv_add_uci_config "$envdev" "0x0" "0x80000"
;;
@ -110,10 +105,8 @@ gatonetworks,gdsp)
glinet,gl-mt3000)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x20000"
;;
mercusys,mr80x-v3|\
mercusys,mr90x-v1|\
routerich,ax3000|\
routerich,ax3000-v1|\
tplink,re6000xd)
local envdev=/dev/mtd$(find_mtd_index "u-boot-env")
ubootenv_add_uci_config "$envdev" "0x0" "0x20000" "0x20000" "1"
@ -131,9 +124,6 @@ smartrg,sdg-8734)
local envdev=$(find_mmc_part "u-boot-env" "mmcblk0")
ubootenv_add_uci_config "$envdev" "0x0" "0x8000" "0x8000"
;;
tplink,archer-ax80-v1)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000" "8"
;;
ubnt,unifi-6-plus)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x10000"
;;

View File

@ -29,11 +29,6 @@ edimax,cax1800)
[ -n "$idx" ] && \
ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x10000" "0x20000"
;;
linksys,homewrk)
idx="$(find_mtd_index 0:appsblenv)"
[ -n "$idx" ] && \
ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x40000" "0x40000"
;;
linksys,mx4200v1|\
linksys,mx4200v2|\
linksys,mx5300|\
@ -42,11 +37,6 @@ linksys,mx8500)
[ -n "$idx" ] && \
ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x40000" "0x20000" "2"
;;
linksys,mx4300)
idx="$(find_mtd_index u_env)"
[ -n "$idx" ] && \
ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x40000" "0x40000" "1"
;;
netgear,sxr80|\
netgear,sxs80|\
tplink,eap660hd-v1)

View File

@ -19,10 +19,8 @@ alfa-network,r36m-e4g|\
alfa-network,tube-e4g|\
engenius,epg600|\
engenius,esr600h|\
hongdian,h8922-v30|\
linksys,re7000|\
meig,slt866|\
qding,qc202|\
sitecom,wlr-4100-v1-002|\
zyxel,keenetic-lite-iii-a)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x1000"
@ -64,7 +62,6 @@ kroks,kndrt31r19|\
mediatek,linkit-smart-7688|\
samknows,whitebox-v8|\
xiaomi,mi-router-4c|\
xiaomi,miwifi-3a|\
xiaomi,miwifi-nano|\
zbtlink,zbt-wg2626|\
zte,mf283plus)
@ -150,8 +147,7 @@ xiaomi,mi-router-cr6608|\
xiaomi,mi-router-cr6609)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x20000"
;;
dna,valokuitu-plus-ex400|\
genexis,pulse-ex400)
dna,valokuitu-plus-ex400)
ubootenv_add_uci_config "/dev/ubi0_0" "0x0" "0x1f000" "0x1f000" "1"
ubootenv_add_uci_config "/dev/ubi0_1" "0x0" "0x1f000" "0x1f000" "1"
;;

View File

@ -28,7 +28,6 @@ zyxel,gs1900-10hp|\
zyxel,gs1900-16|\
zyxel,gs1900-24-v1|\
zyxel,gs1900-24e|\
zyxel,gs1900-24ep|\
zyxel,gs1900-24hp-v1|\
zyxel,gs1900-24hp-v2)
idx="$(find_mtd_index u-boot-env)"

View File

@ -231,18 +231,6 @@ define U-Boot/mt7981_abt_asr3000
DEPENDS:=+trusted-firmware-a-mt7981-spim-nand-ddr3
endef
define U-Boot/mt7981_cmcc_a10
NAME:=CMCC A10
BUILD_SUBTARGET:=filogic
BUILD_DEVICES:=cmcc_a10-ubootmod
UBOOT_CONFIG:=mt7981_cmcc_a10
UBOOT_IMAGE:=u-boot.fip
BL2_BOOTDEV:=spim-nand
BL2_SOC:=mt7981
BL2_DDRTYPE:=ddr3
DEPENDS:=+trusted-firmware-a-mt7981-spim-nand-ddr3
endef
define U-Boot/mt7981_cmcc_rax3000m-emmc
NAME:=CMCC RAX3000M
BUILD_SUBTARGET:=filogic
@ -267,17 +255,6 @@ define U-Boot/mt7981_cmcc_rax3000m-nand
DEPENDS:=+trusted-firmware-a-mt7981-spim-nand-ddr4
endef
define U-Boot/mt7981_cudy_tr3000-v1
NAME:=Cudy TR3000 v1
BUILD_SUBTARGET:=filogic
BUILD_DEVICES:=cudy_tr3000-v1-ubootmod
UBOOT_CONFIG:=mt7981_cudy_tr3000-v1
UBOOT_IMAGE:=u-boot.fip
BL2_BOOTDEV:=cudy-tr3000-v1
BL2_SOC:=mt7981
DEPENDS:=+trusted-firmware-a-mt7981-cudy-tr3000-v1
endef
define U-Boot/mt7981_glinet_gl-x3000
NAME:=GL.iNet GL-X3000
BUILD_SUBTARGET:=filogic
@ -326,30 +303,6 @@ define U-Boot/mt7981_jcg_q30-pro
DEPENDS:=+trusted-firmware-a-mt7981-spim-nand-ddr3
endef
define U-Boot/mt7981_konka_komi-a31
NAME:=Konka KOMI A31
BUILD_SUBTARGET:=filogic
BUILD_DEVICES:=konka_komi-a31
UBOOT_CONFIG:=mt7981_konka_komi-a31
UBOOT_IMAGE:=u-boot.fip
BL2_BOOTDEV:=spim-nand
BL2_SOC:=mt7981
BL2_DDRTYPE:=ddr3
DEPENDS:=+trusted-firmware-a-mt7981-spim-nand-ddr3
endef
define U-Boot/mt7981_netis_nx31
NAME:=netis NX31
BUILD_SUBTARGET:=filogic
BUILD_DEVICES:=netis_nx31
UBOOT_CONFIG:=mt7981_netis_nx31
UBOOT_IMAGE:=u-boot.fip
BL2_BOOTDEV:=spim-nand
BL2_SOC:=mt7981
BL2_DDRTYPE:=ddr3
DEPENDS:=+trusted-firmware-a-mt7981-spim-nand-ddr3
endef
define U-Boot/mt7981_nokia_ea0326gmp
NAME:=Nokia EA0326GMP
BUILD_SUBTARGET:=filogic
@ -879,17 +832,13 @@ UBOOT_TARGETS := \
mt7628_ravpower_rp-wd009 \
mt7629_rfb \
mt7981_abt_asr3000 \
mt7981_cmcc_a10 \
mt7981_cmcc_rax3000m-emmc \
mt7981_cmcc_rax3000m-nand \
mt7981_cudy_tr3000-v1 \
mt7981_gatonetworks_gdsp \
mt7981_glinet_gl-x3000 \
mt7981_glinet_gl-xe3000 \
mt7981_h3c_magic-nx30-pro \
mt7981_jcg_q30-pro \
mt7981_konka_komi-a31 \
mt7981_netis_nx31 \
mt7981_nokia_ea0326gmp \
mt7981_openwrt_one-snand \
mt7981_openwrt_one-nor \

View File

@ -1,68 +0,0 @@
Subject: [PATCH] mtd: spinand: esmt: add support for F50L1G41LC
This adds support for ESMT F50L1G41LC, which appears to be an updated
version of the already supported F50L1G41LB.
Add esmt_8c SPI_NAND manufacturer to account for the newly used vendor
ID with support for the ESMT F50L1G41LC chip.
--- a/drivers/mtd/nand/spi/core.c
+++ b/drivers/mtd/nand/spi/core.c
@@ -834,6 +834,7 @@ static const struct spinand_manufacturer
&toshiba_spinand_manufacturer,
&winbond_spinand_manufacturer,
&esmt_c8_spinand_manufacturer,
+ &esmt_8c_spinand_manufacturer,
&xtx_spinand_manufacturer,
};
--- a/drivers/mtd/nand/spi/esmt.c
+++ b/drivers/mtd/nand/spi/esmt.c
@@ -13,6 +13,7 @@
/* ESMT uses GigaDevice 0xc8 JECDEC ID on some SPI NANDs */
#define SPINAND_MFR_ESMT_C8 0xc8
+#define SPINAND_MFR_ESMT_8C 0x8c
static SPINAND_OP_VARIANTS(read_cache_variants,
SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0),
@@ -104,6 +105,18 @@ static const struct mtd_ooblayout_ops f5
.rfree = f50l1g41lb_ooblayout_free,
};
+static const struct spinand_info esmt_8c_spinand_table[] = {
+ SPINAND_INFO("F50L1G41LC",
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0x2C),
+ NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1),
+ NAND_ECCREQ(1, 512),
+ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
+ &write_cache_variants,
+ &update_cache_variants),
+ 0,
+ SPINAND_ECCINFO(&f50l1g41lb_ooblayout, NULL)),
+};
+
static const struct spinand_info esmt_c8_spinand_table[] = {
SPINAND_INFO("F50L1G41LB",
SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0x01),
@@ -135,3 +148,11 @@ const struct spinand_manufacturer esmt_c
.nchips = ARRAY_SIZE(esmt_c8_spinand_table),
.ops = &esmt_spinand_manuf_ops,
};
+
+const struct spinand_manufacturer esmt_8c_spinand_manufacturer = {
+ .id = SPINAND_MFR_ESMT_8C,
+ .name = "ESMT",
+ .chips = esmt_8c_spinand_table,
+ .nchips = ARRAY_SIZE(esmt_8c_spinand_table),
+ .ops = &esmt_spinand_manuf_ops,
+};
--- a/include/linux/mtd/spinand.h
+++ b/include/linux/mtd/spinand.h
@@ -252,6 +252,7 @@ extern const struct spinand_manufacturer
extern const struct spinand_manufacturer toshiba_spinand_manufacturer;
extern const struct spinand_manufacturer winbond_spinand_manufacturer;
extern const struct spinand_manufacturer esmt_c8_spinand_manufacturer;
+extern const struct spinand_manufacturer esmt_8c_spinand_manufacturer;
extern const struct spinand_manufacturer xtx_spinand_manufacturer;
/**

View File

@ -187,12 +187,13 @@
leds {
compatible = "gpio-leds";
@@ -109,6 +122,18 @@
@@ -109,6 +122,19 @@
};
};
+ key_pins_a: keys-alt {
+ mux {
+ function = "gpio";
+ groups = "msdc3";
+ };
+

View File

@ -503,7 +503,7 @@
+ compatible = "ethernet-phy-id03a2.a411";
+ reg = <14>;
+
+ airoha,pnswap-rx;
+ airoha,rx-pol-reverse;
+
+ reset-gpios = <&gpio 49 GPIO_ACTIVE_LOW>;
+ reset-assert-us = <10000>;

View File

@ -1,330 +0,0 @@
--- /dev/null
+++ b/configs/mt7981_cudy_tr3000-v1_defconfig
@@ -0,0 +1,107 @@
+CONFIG_ARM=y
+CONFIG_SYS_HAS_NONCACHED_MEMORY=y
+CONFIG_POSITION_INDEPENDENT=y
+CONFIG_ARCH_MEDIATEK=y
+CONFIG_TEXT_BASE=0x41e00000
+CONFIG_SYS_MALLOC_F_LEN=0x4000
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_DEFAULT_DEVICE_TREE="mt7981-cudy-tr3000-v1"
+CONFIG_OF_LIBFDT_OVERLAY=y
+CONFIG_TARGET_MT7981=y
+CONFIG_PRE_CON_BUF_ADDR=0x4007EF00
+CONFIG_DEBUG_UART_BASE=0x11002000
+CONFIG_DEBUG_UART_CLOCK=40000000
+CONFIG_SYS_LOAD_ADDR=0x46000000
+CONFIG_DEBUG_UART=y
+CONFIG_FIT=y
+CONFIG_BOOTDELAY=30
+CONFIG_AUTOBOOT_KEYED=y
+CONFIG_AUTOBOOT_MENU_SHOW=y
+CONFIG_DEFAULT_FDT_FILE="mediatek/mt7981-cudy-tr3000-v1.dtb"
+CONFIG_LOGLEVEL=7
+CONFIG_PRE_CONSOLE_BUFFER=y
+CONFIG_LOG=y
+CONFIG_BOARD_LATE_INIT=y
+CONFIG_HUSH_PARSER=y
+CONFIG_SYS_PROMPT="MT7981> "
+CONFIG_CMD_CPU=y
+CONFIG_CMD_LICENSE=y
+CONFIG_CMD_BOOTMENU=y
+CONFIG_CMD_ASKENV=y
+CONFIG_CMD_ERASEENV=y
+CONFIG_CMD_ENV_FLAGS=y
+CONFIG_CMD_STRINGS=y
+CONFIG_CMD_DM=y
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_GPT=y
+CONFIG_CMD_MTD=y
+CONFIG_CMD_PART=y
+CONFIG_CMD_DHCP=y
+CONFIG_CMD_TFTPSRV=y
+CONFIG_CMD_RARP=y
+CONFIG_CMD_PING=y
+CONFIG_CMD_CDP=y
+CONFIG_CMD_SNTP=y
+CONFIG_CMD_DNS=y
+CONFIG_CMD_LINK_LOCAL=y
+CONFIG_CMD_PXE=y
+CONFIG_CMD_CACHE=y
+CONFIG_CMD_PSTORE=y
+CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000
+CONFIG_CMD_UUID=y
+CONFIG_CMD_HASH=y
+CONFIG_CMD_SMC=y
+CONFIG_CMD_UBI=y
+CONFIG_CMD_UBI_RENAME=y
+CONFIG_OF_EMBED=y
+CONFIG_ENV_OVERWRITE=y
+CONFIG_ENV_IS_IN_UBI=y
+CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
+CONFIG_ENV_UBI_PART="ubi"
+CONFIG_ENV_UBI_VOLUME="ubootenv"
+CONFIG_ENV_UBI_VOLUME_REDUND="ubootenv2"
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_USE_DEFAULT_ENV_FILE=y
+CONFIG_DEFAULT_ENV_FILE="cudy_tr3000-v1_env"
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
+CONFIG_VERSION_VARIABLE=y
+CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_NETCONSOLE=y
+CONFIG_USE_IPADDR=y
+CONFIG_IPADDR="192.168.1.1"
+CONFIG_USE_SERVERIP=y
+CONFIG_SERVERIP="192.168.1.254"
+CONFIG_REGMAP=y
+CONFIG_SYSCON=y
+CONFIG_BUTTON=y
+CONFIG_BUTTON_GPIO=y
+CONFIG_CLK=y
+CONFIG_GPIO_HOG=y
+CONFIG_LED=y
+CONFIG_LED_BLINK=y
+CONFIG_LED_GPIO=y
+# CONFIG_MMC is not set
+CONFIG_MTD=y
+CONFIG_DM_MTD=y
+CONFIG_MTD_SPI_NAND=y
+CONFIG_MTD_UBI_FASTMAP=y
+CONFIG_PHY_FIXED=y
+CONFIG_MEDIATEK_ETH=y
+CONFIG_PHY=y
+CONFIG_PINCTRL=y
+CONFIG_PINCONF=y
+CONFIG_PINCTRL_MT7981=y
+CONFIG_POWER_DOMAIN=y
+CONFIG_MTK_POWER_DOMAIN=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_DM_REGULATOR_GPIO=y
+CONFIG_RAM=y
+CONFIG_DM_SERIAL=y
+CONFIG_MTK_SERIAL=y
+CONFIG_SPI=y
+CONFIG_DM_SPI=y
+CONFIG_MTK_SPIM=y
+CONFIG_ZSTD=y
+CONFIG_HEXDUMP=y
+CONFIG_LMB_MAX_REGIONS=64
--- /dev/null
+++ b/arch/arm/dts/mt7981-cudy-tr3000-v1.dts
@@ -0,0 +1,160 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+/dts-v1/;
+#include "mt7981.dtsi"
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/linux-event-codes.h>
+
+/ {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ model = "Cudy TR3000 v1";
+ compatible = "mediatek,mt7981", "mediatek,mt7981-rfb";
+
+ chosen {
+ stdout-path = &uart0;
+ tick-timer = &timer0;
+ };
+
+ memory@40000000 {
+ device_type = "memory";
+ reg = <0x40000000 0x20000000>;
+ };
+
+ gpio-keys {
+ compatible = "gpio-keys";
+
+ button-reset {
+ label = "reset";
+ linux,code = <KEY_RESTART>;
+ gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
+ };
+
+ button-mode {
+ label = "mode";
+ linux,code = <EV_SW>;
+ linux,input-type = <BTN_0>;
+ gpios = <&gpio 0 GPIO_ACTIVE_HIGH>;
+ debounce-interval = <60>;
+ };
+ };
+
+ gpio-leds {
+ compatible = "gpio-leds";
+
+ led_status: led-0 {
+ label = "red:power";
+ gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
+ default-state = "on";
+ };
+
+ led-1 {
+ label = "white:status";
+ gpios = <&gpio 10 GPIO_ACTIVE_LOW>;
+ default-state = "off";
+ };
+ };
+};
+
+&eth {
+ status = "okay";
+ mediatek,gmac-id = <1>;
+ phy-mode = "gmii";
+ phy-handle = <&phy0>;
+
+ mdio {
+ phy0: ethernet-phy@0 {
+ compatible = "ethernet-phy-id03a2.9461";
+ reg = <0x0>;
+ phy-mode = "gmii";
+ };
+ };
+};
+
+&pinctrl {
+ spi_flash_pins: spi0-pins-func-1 {
+ mux {
+ function = "flash";
+ groups = "spi0", "spi0_wp_hold";
+ };
+
+ conf-pu {
+ pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP";
+ drive-strength = <MTK_DRIVE_8mA>;
+ bias-pull-up = <MTK_PUPD_SET_R1R0_00>;
+ };
+
+ conf-pd {
+ pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO";
+ drive-strength = <MTK_DRIVE_8mA>;
+ bias-pull-down = <MTK_PUPD_SET_R1R0_00>;
+ };
+ };
+};
+
+&spi0 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&spi_flash_pins>;
+ status = "okay";
+ must_tx;
+ enhance_timing;
+ dma_ext;
+ ipm_design;
+ support_quad;
+ tick_dly = <2>;
+ sample_sel = <0>;
+
+ spi_nand@0 {
+ compatible = "spi-nand";
+ reg = <0>;
+ spi-max-frequency = <52000000>;
+
+ partitions {
+ compatible = "fixed-partitions";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ partition@0 {
+ label = "bl2";
+ reg = <0x0 0x100000>;
+ };
+
+ partition@100000 {
+ label = "u-boot-env";
+ reg = <0x100000 0x80000>;
+ };
+
+ partition@180000 {
+ label = "factory";
+ reg = <0x180000 0x200000>;
+ };
+
+ partition@380000 {
+ label = "bdinfo";
+ reg = <0x380000 0x40000>;
+ };
+
+ partition@3c0000 {
+ label = "fip";
+ reg = <0x3c0000 0x200000>;
+ };
+
+ partition@5c0000 {
+ label = "ubi";
+ reg = <0x5c0000 0x7a40000>;
+ compatible = "linux,ubi";
+ };
+ };
+ };
+};
+
+&uart0 {
+ mediatek,force-highspeed;
+ status = "okay";
+};
+
+&watchdog {
+ status = "disabled";
+};
--- /dev/null
+++ b/cudy_tr3000-v1_env
@@ -0,0 +1,54 @@
+ipaddr=192.168.1.1
+serverip=192.168.1.254
+loadaddr=0x46000000
+console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0
+bootcmd=if pstore check ; then run boot_recovery ; else run boot_ubi ; fi
+bootconf=config-1
+bootdelay=0
+bootfile=openwrt-mediatek-filogic-cudy_tr3000-v1-ubootmod-initramfs-recovery.itb
+bootfile_bl2=openwrt-mediatek-filogic-cudy_tr3000-v1-ubootmod-preloader.bin
+bootfile_fip=openwrt-mediatek-filogic-cudy_tr3000-v1-ubootmod-bl31-uboot.fip
+bootfile_upg=openwrt-mediatek-filogic-cudy_tr3000-v1-ubootmod-squashfs-sysupgrade.itb
+bootled_pwr=red:power
+bootled_rec=white:status
+bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60
+bootmenu_default=0
+bootmenu_delay=0
+bootmenu_title= ( ( ( OpenWrt ) ) )
+bootmenu_0=Initialize environment.=run _firstboot
+bootmenu_0d=Run default boot command.=run boot_default
+bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return
+bootmenu_2=Boot production system from NAND.=run boot_production ; run bootmenu_confirm_return
+bootmenu_3=Boot recovery system from NAND.=run boot_recovery ; run bootmenu_confirm_return
+bootmenu_4=Load production system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
+bootmenu_5=Load recovery system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
+bootmenu_6=Load BL31+U-Boot FIP via TFTP then write to NAND.=run boot_tftp_write_fip ; run bootmenu_confirm_return
+bootmenu_7=Load BL2 preloader via TFTP then write to NAND.=run boot_tftp_write_bl2 ; run bootmenu_confirm_return
+bootmenu_8=Reboot.=reset
+bootmenu_9=Reset all settings to factory defaults.=run reset_factory ; reset
+boot_first=if button reset ; then led $bootled_rec on ; run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu
+boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever
+boot_production=led $bootled_pwr on ; run ubi_read_production && bootm $loadaddr#$bootconf ; led $bootled_pwr off
+boot_recovery=led $bootled_rec on ; run ubi_read_recovery && bootm $loadaddr#$bootconf ; led $bootled_rec off
+boot_ubi=run boot_production ; run boot_recovery ; run boot_tftp_forever
+boot_tftp_forever=led $bootled_rec on ; while true ; do run boot_tftp_recovery ; sleep 1 ; done
+boot_tftp_production=tftpboot $loadaddr $bootfile_upg && env exists replacevol && iminfo $loadaddr && run ubi_write_production ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
+boot_tftp_recovery=tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run ubi_write_recovery ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
+boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf
+boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run mtd_write_fip && run reset_factory
+boot_tftp_write_bl2=tftpboot $loadaddr $bootfile_bl2 && run mtd_write_bl2
+reset_factory=ubi part ubi ; mw $loadaddr 0x0 0x800 ; ubi write $loadaddr ubootenv 0x800 ; ubi write $loadaddr ubootenv2 0x800
+mtd_write_fip=mtd erase fip && mtd write fip $loadaddr
+mtd_write_bl2=mtd erase bl2 && mtd write bl2 $loadaddr
+ubi_create_env=ubi check ubootenv || ubi create ubootenv 0x100000 dynamic || run ubi_format ; ubi check ubootenv2 || ubi create ubootenv2 0x100000 dynamic || run ubi_format
+ubi_format=ubi detach ; mtd erase ubi && ubi part ubi ; reset
+ubi_prepare_rootfs=if ubi check rootfs_data ; then else if env exists rootfs_data_max ; then ubi create rootfs_data $rootfs_data_max dynamic || ubi create rootfs_data - dynamic ; else ubi create rootfs_data - dynamic ; fi ; fi
+ubi_read_production=ubi read $loadaddr fit && iminfo $loadaddr && run ubi_prepare_rootfs
+ubi_read_recovery=ubi check recovery && ubi read $loadaddr recovery
+ubi_remove_rootfs=ubi check rootfs_data && ubi remove rootfs_data
+ubi_write_production=ubi check fit && ubi remove fit ; run ubi_remove_rootfs ; ubi create fit $filesize dynamic && ubi write $loadaddr fit $filesize
+ubi_write_recovery=ubi check recovery && ubi remove recovery ; run ubi_remove_rootfs ; ubi create recovery $filesize dynamic && ubi write $loadaddr recovery $filesize
+_init_env=setenv _init_env ; run ubi_create_env ; saveenv ; saveenv
+_firstboot=setenv _firstboot ; run _switch_to_menu ; run _init_env ; run boot_first
+_switch_to_menu=setenv _switch_to_menu ; setenv bootdelay 3 ; setenv bootmenu_delay 3 ; setenv bootmenu_0 $bootmenu_0d ; setenv bootmenu_0d ; run _bootmenu_update_title
+_bootmenu_update_title=setenv _bootmenu_update_title ; setenv bootmenu_title "$bootmenu_title $ver"

View File

@ -1,334 +0,0 @@
--- /dev/null
+++ b/configs/mt7981_netis_nx31_defconfig
@@ -0,0 +1,106 @@
+CONFIG_ARM=y
+CONFIG_SYS_HAS_NONCACHED_MEMORY=y
+CONFIG_POSITION_INDEPENDENT=y
+CONFIG_ARCH_MEDIATEK=y
+CONFIG_TEXT_BASE=0x41e00000
+CONFIG_SYS_MALLOC_F_LEN=0x4000
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_DEFAULT_DEVICE_TREE="mt7981-netis_nx31"
+CONFIG_OF_LIBFDT_OVERLAY=y
+CONFIG_TARGET_MT7981=y
+CONFIG_SYS_LOAD_ADDR=0x46000000
+CONFIG_PRE_CON_BUF_ADDR=0x4007ef00
+CONFIG_DEBUG_UART_BASE=0x11002000
+CONFIG_DEBUG_UART_CLOCK=40000000
+CONFIG_DEBUG_UART=y
+CONFIG_FIT=y
+CONFIG_BOOTDELAY=30
+CONFIG_AUTOBOOT_KEYED=y
+CONFIG_AUTOBOOT_MENU_SHOW=y
+CONFIG_DEFAULT_FDT_FILE="mediatek/mt7981-netis_nx31.dtb"
+CONFIG_LOGLEVEL=7
+CONFIG_PRE_CONSOLE_BUFFER=y
+CONFIG_LOG=y
+CONFIG_BOARD_LATE_INIT=y
+CONFIG_HUSH_PARSER=y
+CONFIG_SYS_PROMPT="MT7981> "
+CONFIG_CMD_CPU=y
+CONFIG_CMD_LICENSE=y
+CONFIG_CMD_BOOTMENU=y
+CONFIG_CMD_ASKENV=y
+CONFIG_CMD_ERASEENV=y
+CONFIG_CMD_ENV_FLAGS=y
+CONFIG_CMD_STRINGS=y
+CONFIG_CMD_DM=y
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_GPT=y
+CONFIG_CMD_MTD=y
+CONFIG_CMD_PART=y
+CONFIG_CMD_TFTPSRV=y
+CONFIG_CMD_RARP=y
+CONFIG_CMD_CDP=y
+CONFIG_CMD_SNTP=y
+CONFIG_CMD_LINK_LOCAL=y
+CONFIG_CMD_DHCP=y
+CONFIG_CMD_DNS=y
+CONFIG_CMD_PING=y
+CONFIG_CMD_PXE=y
+CONFIG_CMD_CACHE=y
+CONFIG_CMD_PSTORE=y
+CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000
+CONFIG_CMD_UUID=y
+CONFIG_CMD_HASH=y
+CONFIG_CMD_SMC=y
+CONFIG_CMD_UBI=y
+CONFIG_CMD_UBI_RENAME=y
+CONFIG_OF_EMBED=y
+CONFIG_ENV_OVERWRITE=y
+CONFIG_ENV_IS_IN_UBI=y
+CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
+CONFIG_ENV_UBI_PART="ubi"
+CONFIG_ENV_UBI_VOLUME="ubootenv"
+CONFIG_ENV_UBI_VOLUME_REDUND="ubootenv2"
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_USE_DEFAULT_ENV_FILE=y
+CONFIG_DEFAULT_ENV_FILE="defenvs/netis_nx31_env"
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
+CONFIG_VERSION_VARIABLE=y
+CONFIG_NETCONSOLE=y
+CONFIG_USE_IPADDR=y
+CONFIG_IPADDR="192.168.1.1"
+CONFIG_USE_SERVERIP=y
+CONFIG_SERVERIP="192.168.1.254"
+CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_BUTTON=y
+CONFIG_BUTTON_GPIO=y
+CONFIG_CLK=y
+CONFIG_GPIO_HOG=y
+CONFIG_LED=y
+CONFIG_LED_BLINK=y
+CONFIG_LED_GPIO=y
+# CONFIG_MMC is not set
+CONFIG_MTD=y
+CONFIG_DM_MTD=y
+CONFIG_MTD_SPI_NAND=y
+CONFIG_MTD_UBI_FASTMAP=y
+CONFIG_PHY_FIXED=y
+CONFIG_MEDIATEK_ETH=y
+CONFIG_PHY=y
+CONFIG_PHY_MTK_TPHY=y
+CONFIG_PINCTRL=y
+CONFIG_PINCONF=y
+CONFIG_PINCTRL_MT7981=y
+CONFIG_POWER_DOMAIN=y
+CONFIG_MTK_POWER_DOMAIN=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_DM_REGULATOR_GPIO=y
+CONFIG_RAM=y
+CONFIG_DM_SERIAL=y
+CONFIG_SERIAL_RX_BUFFER=y
+CONFIG_MTK_SERIAL=y
+CONFIG_SPI=y
+CONFIG_DM_SPI=y
+CONFIG_MTK_SPIM=y
+CONFIG_ZSTD=y
+CONFIG_HEXDUMP=y
--- /dev/null
+++ b/arch/arm/dts/mt7981-netis_nx31.dts
@@ -0,0 +1,162 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2025
+ * Author: Mikhail Zhilkin <csharper2005@gmail.com>
+ */
+
+/dts-v1/;
+#include "mt7981.dtsi"
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/linux-event-codes.h>
+
+/ {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ model = "netis NX31";
+ compatible = "netis,nx31", "mediatek,mt7981";
+
+ chosen {
+ stdout-path = &uart0;
+ tick-timer = &timer0;
+ };
+
+ memory@40000000 {
+ device_type = "memory";
+ reg = <0x40000000 0x10000000>;
+ };
+
+ keys {
+ compatible = "gpio-keys";
+
+ button-0 {
+ label = "mesh";
+ linux,code = <BTN_0>;
+ gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
+ };
+
+ button-1 {
+ label = "reset";
+ linux,code = <KEY_RESTART>;
+ gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
+ };
+ };
+
+ leds {
+ compatible = "gpio-leds";
+
+ led-0 {
+ label = "blue:wlan2g";
+ gpios = <&gpio 5 GPIO_ACTIVE_LOW>;
+ };
+
+ led-1 {
+ label = "blue:status";
+ gpios = <&gpio 7 GPIO_ACTIVE_LOW>;
+ };
+
+ led-2 {
+ label = "blue:wan";
+ gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
+ };
+
+ led-3 {
+ label = "blue:wlan5g";
+ gpios = <&gpio 34 GPIO_ACTIVE_LOW>;
+ };
+ };
+};
+
+&uart0 {
+ mediatek,force-highspeed;
+ status = "okay";
+};
+
+&eth {
+ status = "okay";
+ mediatek,gmac-id = <0>;
+ phy-mode = "2500base-x";
+ mediatek,switch = "mt7531";
+ reset-gpios = <&gpio 39 GPIO_ACTIVE_HIGH>;
+
+ fixed-link {
+ speed = <2500>;
+ full-duplex;
+ };
+};
+
+&pinctrl {
+ spi_flash_pins: spi0-pins-func-1 {
+ mux {
+ function = "flash";
+ groups = "spi0", "spi0_wp_hold";
+ };
+
+ conf-pu {
+ pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP";
+ drive-strength = <MTK_DRIVE_8mA>;
+ bias-pull-up = <MTK_PUPD_SET_R1R0_11>;
+ };
+
+ conf-pd {
+ pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO";
+ drive-strength = <MTK_DRIVE_8mA>;
+ bias-pull-down = <MTK_PUPD_SET_R1R0_11>;
+ };
+ };
+};
+
+&spi0 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&spi_flash_pins>;
+ status = "okay";
+ must_tx;
+ enhance_timing;
+ dma_ext;
+ ipm_design;
+ support_quad;
+ tick_dly = <2>;
+ sample_sel = <0>;
+
+ spi_nand@0 {
+ compatible = "spi-nand";
+ reg = <0>;
+ spi-max-frequency = <52000000>;
+
+ partitions {
+ compatible = "fixed-partitions";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ partition@0 {
+ label = "BL2";
+ reg = <0x0 0x100000>;
+ };
+
+ partition@100000 {
+ label = "u-boot-env (unused)";
+ reg = <0x100000 0x80000>;
+ };
+
+ partition@160000 {
+ label = "Factory";
+ reg = <0x180000 0x200000>;
+ };
+
+ partition@380000 {
+ label = "FIP";
+ reg = <0x380000 0x200000>;
+ };
+
+ partition@580000 {
+ label = "ubi";
+ reg = <0x580000 0x7a80000>;
+ };
+ };
+ };
+};
+
+&watchdog {
+ status = "disabled";
+};
--- /dev/null
+++ b/defenvs/netis_nx31_env
@@ -0,0 +1,57 @@
+ipaddr=192.168.1.1
+serverip=192.168.1.254
+loadaddr=0x46000000
+console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0
+bootcmd=run check_buttons ; if pstore check ; then run boot_recovery ; else run boot_ubi ; fi
+bootconf=config-1
+bootdelay=0
+bootfile=openwrt-mediatek-filogic-netis_nx31-initramfs-recovery.itb
+bootfile_bl2=openwrt-mediatek-filogic-netis_nx31-preloader.bin
+bootfile_fip=openwrt-mediatek-filogic-netis_nx31-bl31-uboot.fip
+bootfile_upg=openwrt-mediatek-filogic-netis_nx31-squashfs-sysupgrade.itb
+bootled_status=blue:status
+bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60
+bootmenu_default=0
+bootmenu_delay=0
+bootmenu_title= ( ( ( OpenWrt ) ) )
+bootmenu_0=Initialize environment.=run _firstboot
+bootmenu_0d=Run default boot command.=run boot_default
+bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return
+bootmenu_2=Boot production system from NAND.=run boot_production ; run bootmenu_confirm_return
+bootmenu_3=Boot recovery system from NAND.=run boot_recovery ; run bootmenu_confirm_return
+bootmenu_4=Load production system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
+bootmenu_5=Load recovery system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
+bootmenu_6=Load BL31+U-Boot FIP via TFTP then write to NAND.=run boot_tftp_write_fip ; run bootmenu_confirm_return
+bootmenu_7=Load BL2 preloader via TFTP then write to NAND.=run boot_tftp_write_bl2 ; run bootmenu_confirm_return
+bootmenu_8=Reboot.=reset
+bootmenu_9=Reset all settings to factory defaults.=run reset_factory ; reset
+boot_first=if button reset ; then led $bootled_status on ; run boot_default ; fi ; bootmenu
+boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever
+boot_production=led $bootled_status on ; run ubi_read_production && bootm $loadaddr#$bootconf ; led bootled_status off
+boot_recovery=led $bootled_status on ; run ubi_read_recovery && bootm $loadaddr#$bootconf ; led bootled_status off
+boot_ubi=run boot_production ; run boot_recovery ; run boot_tftp_forever
+boot_tftp_forever=led $bootled_status on ; while true ; do run boot_tftp ; sleep 1 ; done
+boot_tftp_production=tftpboot $loadaddr $bootfile_upg && env exists replacevol && iminfo $loadaddr && run ubi_write_production ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
+boot_tftp_recovery=tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run ubi_write_recovery ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
+boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf
+boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run mtd_write_fip && run reset_factory
+boot_tftp_write_bl2=tftpboot $loadaddr $bootfile_bl2 && run mtd_write_bl2
+check_buttons=if button reset ; then run boot_tftp ; fi
+ethaddr_factory=mtd read Factory 0x40080000 0x1e0000 0x20000 && env readmem -b ethaddr 0x4009ef20 0x6 ; setenv ethaddr_factory
+part_default=production
+part_recovery=recovery
+reset_factory=ubi part ubi ; mw $loadaddr 0x0 0x800 ; ubi write $loadaddr ubootenv 0x800 ; ubi write $loadaddr ubootenv2 0x800
+mtd_write_fip=mtd erase FIP && mtd write FIP $loadaddr
+mtd_write_bl2=mtd erase BL2 && mtd write BL2 $loadaddr
+ubi_create_env=ubi check ubootenv || ubi create ubootenv 0x100000 dynamic || run ubi_format ; ubi check ubootenv2 || ubi create ubootenv2 0x100000 dynamic || run ubi_format
+ubi_format=ubi detach ; mtd erase ubi && ubi part ubi ; reset
+ubi_prepare_rootfs=if ubi check rootfs_data ; then else if env exists rootfs_data_max ; then ubi create rootfs_data $rootfs_data_max dynamic || ubi create rootfs_data - dynamic ; else ubi create rootfs_data - dynamic ; fi ; fi
+ubi_read_production=ubi read $loadaddr fit && iminfo $loadaddr && run ubi_prepare_rootfs
+ubi_read_recovery=ubi check recovery && ubi read $loadaddr recovery
+ubi_remove_rootfs=ubi check rootfs_data && ubi remove rootfs_data
+ubi_write_production=ubi check fit && ubi remove fit ; run ubi_remove_rootfs ; ubi create fit $filesize dynamic && ubi write $loadaddr fit $filesize
+ubi_write_recovery=ubi check recovery && ubi remove recovery ; run ubi_remove_rootfs ; ubi create recovery $filesize dynamic && ubi write $loadaddr recovery $filesize
+_init_env=setenv _init_env ; run ubi_create_env ; saveenv ; saveenv
+_firstboot=setenv _firstboot ; run ethaddr_factory ; run _switch_to_menu ; run _init_env ; run boot_first
+_switch_to_menu=setenv _switch_to_menu ; setenv bootdelay 3 ; setenv bootmenu_delay 3 ; setenv bootmenu_0 $bootmenu_0d ; setenv bootmenu_0d ; run _bootmenu_update_title
+_bootmenu_update_title=setenv _bootmenu_update_title ; setenv bootmenu_title "$bootmenu_title $ver"

View File

@ -1,327 +0,0 @@
--- /dev/null
+++ b/configs/mt7981_cmcc_a10_defconfig
@@ -0,0 +1,107 @@
+CONFIG_ARM=y
+CONFIG_SYS_HAS_NONCACHED_MEMORY=y
+CONFIG_POSITION_INDEPENDENT=y
+CONFIG_ARCH_MEDIATEK=y
+CONFIG_TEXT_BASE=0x41e00000
+CONFIG_SYS_MALLOC_F_LEN=0x4000
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_DEFAULT_DEVICE_TREE="mt7981-cmcc-a10"
+CONFIG_OF_LIBFDT_OVERLAY=y
+CONFIG_TARGET_MT7981=y
+CONFIG_PRE_CON_BUF_ADDR=0x4007EF00
+CONFIG_DEBUG_UART_BASE=0x11002000
+CONFIG_DEBUG_UART_CLOCK=40000000
+CONFIG_SYS_LOAD_ADDR=0x46000000
+CONFIG_DEBUG_UART=y
+CONFIG_FIT=y
+CONFIG_BOOTDELAY=30
+CONFIG_AUTOBOOT_KEYED=y
+CONFIG_AUTOBOOT_MENU_SHOW=y
+CONFIG_DEFAULT_FDT_FILE="mediatek/mt7981-cmcc-a10.dtb"
+CONFIG_LOGLEVEL=7
+CONFIG_PRE_CONSOLE_BUFFER=y
+CONFIG_LOG=y
+CONFIG_BOARD_LATE_INIT=y
+CONFIG_HUSH_PARSER=y
+CONFIG_SYS_PROMPT="MT7981> "
+CONFIG_CMD_CPU=y
+CONFIG_CMD_LICENSE=y
+CONFIG_CMD_BOOTMENU=y
+CONFIG_CMD_ASKENV=y
+CONFIG_CMD_ERASEENV=y
+CONFIG_CMD_ENV_FLAGS=y
+CONFIG_CMD_STRINGS=y
+CONFIG_CMD_DM=y
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_GPT=y
+CONFIG_CMD_MTD=y
+CONFIG_CMD_PART=y
+CONFIG_CMD_DHCP=y
+CONFIG_CMD_TFTPSRV=y
+CONFIG_CMD_RARP=y
+CONFIG_CMD_PING=y
+CONFIG_CMD_CDP=y
+CONFIG_CMD_SNTP=y
+CONFIG_CMD_DNS=y
+CONFIG_CMD_LINK_LOCAL=y
+CONFIG_CMD_PXE=y
+CONFIG_CMD_CACHE=y
+CONFIG_CMD_PSTORE=y
+CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000
+CONFIG_CMD_UUID=y
+CONFIG_CMD_HASH=y
+CONFIG_CMD_SMC=y
+CONFIG_CMD_UBI=y
+CONFIG_CMD_UBI_RENAME=y
+CONFIG_OF_EMBED=y
+CONFIG_ENV_OVERWRITE=y
+CONFIG_ENV_IS_IN_UBI=y
+CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
+CONFIG_ENV_UBI_PART="ubi"
+CONFIG_ENV_UBI_VOLUME="ubootenv"
+CONFIG_ENV_UBI_VOLUME_REDUND="ubootenv2"
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_USE_DEFAULT_ENV_FILE=y
+CONFIG_DEFAULT_ENV_FILE="cmcc_a10_env"
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
+CONFIG_VERSION_VARIABLE=y
+CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_NETCONSOLE=y
+CONFIG_USE_IPADDR=y
+CONFIG_IPADDR="192.168.1.1"
+CONFIG_USE_SERVERIP=y
+CONFIG_SERVERIP="192.168.1.254"
+CONFIG_REGMAP=y
+CONFIG_SYSCON=y
+CONFIG_BUTTON=y
+CONFIG_BUTTON_GPIO=y
+CONFIG_CLK=y
+CONFIG_GPIO_HOG=y
+CONFIG_LED=y
+CONFIG_LED_BLINK=y
+CONFIG_LED_GPIO=y
+# CONFIG_MMC is not set
+CONFIG_MTD=y
+CONFIG_DM_MTD=y
+CONFIG_MTD_SPI_NAND=y
+CONFIG_MTD_UBI_FASTMAP=y
+CONFIG_PHY_FIXED=y
+CONFIG_MEDIATEK_ETH=y
+CONFIG_PHY=y
+CONFIG_PINCTRL=y
+CONFIG_PINCONF=y
+CONFIG_PINCTRL_MT7981=y
+CONFIG_POWER_DOMAIN=y
+CONFIG_MTK_POWER_DOMAIN=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_DM_REGULATOR_GPIO=y
+CONFIG_RAM=y
+CONFIG_DM_SERIAL=y
+CONFIG_MTK_SERIAL=y
+CONFIG_SPI=y
+CONFIG_DM_SPI=y
+CONFIG_MTK_SPIM=y
+CONFIG_ZSTD=y
+CONFIG_HEXDUMP=y
+CONFIG_LMB_MAX_REGIONS=64
--- /dev/null
+++ b/arch/arm/dts/mt7981-cmcc-a10.dts
@@ -0,0 +1,157 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+/dts-v1/;
+#include "mt7981.dtsi"
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/linux-event-codes.h>
+
+/ {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ model = "CMCC A10";
+ compatible = "mediatek,mt7981", "mediatek,mt7981-rfb";
+
+ chosen {
+ stdout-path = &uart0;
+ tick-timer = &timer0;
+ };
+
+ memory@40000000 {
+ device_type = "memory";
+ reg = <0x40000000 0x10000000>;
+ };
+
+ gpio-keys {
+ compatible = "gpio-keys";
+
+ button-reset {
+ label = "reset";
+ linux,code = <KEY_RESTART>;
+ gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
+ };
+
+ button-wps {
+ label = "wps";
+ linux,code = <KEY_WPS_BUTTON>;
+ gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
+ };
+ };
+
+ gpio-leds {
+ compatible = "gpio-leds";
+
+ led-0 {
+ label = "blue:status";
+ gpios = <&gpio 9 GPIO_ACTIVE_LOW>;
+ default-state = "off";
+ };
+
+ running_led: led-1 {
+ label = "green:status";
+ gpios = <&gpio 10 GPIO_ACTIVE_LOW>;
+ default-state = "off";
+ };
+
+ boot_led: led-2 {
+ label = "red:status";
+ gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
+ default-state = "on";
+ };
+ };
+};
+
+&eth {
+ status = "okay";
+ mediatek,gmac-id = <0>;
+ phy-mode = "2500base-x";
+ mediatek,switch = "mt7531";
+ reset-gpios = <&gpio 39 GPIO_ACTIVE_HIGH>;
+
+ fixed-link {
+ speed = <2500>;
+ full-duplex;
+ };
+};
+
+&pinctrl {
+ spi_flash_pins: spi0-pins-func-1 {
+ mux {
+ function = "flash";
+ groups = "spi0", "spi0_wp_hold";
+ };
+
+ conf-pu {
+ pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP";
+ drive-strength = <MTK_DRIVE_8mA>;
+ bias-pull-up = <MTK_PUPD_SET_R1R0_00>;
+ };
+
+ conf-pd {
+ pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO";
+ drive-strength = <MTK_DRIVE_8mA>;
+ bias-pull-down = <MTK_PUPD_SET_R1R0_00>;
+ };
+ };
+};
+
+&spi0 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&spi_flash_pins>;
+ status = "okay";
+ must_tx;
+ enhance_timing;
+ dma_ext;
+ ipm_design;
+ support_quad;
+ tick_dly = <2>;
+ sample_sel = <0>;
+
+ spi_nand@0 {
+ compatible = "spi-nand";
+ reg = <0>;
+ spi-max-frequency = <52000000>;
+
+ partitions {
+ compatible = "fixed-partitions";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ partition@0 {
+ label = "bl2";
+ reg = <0x0 0x100000>;
+ };
+
+ partition@100000 {
+ label = "u-boot-env";
+ reg = <0x100000 0x80000>;
+ };
+
+ partition@180000 {
+ label = "factory";
+ reg = <0x180000 0x200000>;
+ };
+
+ partition@380000 {
+ label = "fip";
+ reg = <0x380000 0x200000>;
+ };
+
+ partition@580000 {
+ label = "ubi";
+ reg = <0x580000 0x7a80000>;
+ compatible = "linux,ubi";
+ };
+ };
+ };
+};
+
+&uart0 {
+ mediatek,force-highspeed;
+ status = "okay";
+};
+
+&watchdog {
+ status = "disabled";
+};
--- /dev/null
+++ b/cmcc_a10_env
@@ -0,0 +1,54 @@
+ipaddr=192.168.1.1
+serverip=192.168.1.254
+loadaddr=0x46000000
+console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0
+bootcmd=if pstore check ; then run boot_recovery ; else run boot_ubi ; fi
+bootconf=config-1
+bootdelay=0
+bootfile=openwrt-mediatek-filogic-cmcc_a10-ubootmod-initramfs-recovery.itb
+bootfile_bl2=openwrt-mediatek-filogic-cmcc_a10-ubootmod-preloader.bin
+bootfile_fip=openwrt-mediatek-filogic-cmcc_a10-ubootmod-bl31-uboot.fip
+bootfile_upg=openwrt-mediatek-filogic-cmcc_a10-ubootmod-squashfs-sysupgrade.itb
+bootled_pwr=red:status
+bootled_rec=blue:status
+bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60
+bootmenu_default=0
+bootmenu_delay=0
+bootmenu_title= ( ( ( OpenWrt ) ) )
+bootmenu_0=Initialize environment.=run _firstboot
+bootmenu_0d=Run default boot command.=run boot_default
+bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return
+bootmenu_2=Boot production system from NAND.=run boot_production ; run bootmenu_confirm_return
+bootmenu_3=Boot recovery system from NAND.=run boot_recovery ; run bootmenu_confirm_return
+bootmenu_4=Load production system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
+bootmenu_5=Load recovery system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
+bootmenu_6=Load BL31+U-Boot FIP via TFTP then write to NAND.=run boot_tftp_write_fip ; run bootmenu_confirm_return
+bootmenu_7=Load BL2 preloader via TFTP then write to NAND.=run boot_tftp_write_bl2 ; run bootmenu_confirm_return
+bootmenu_8=Reboot.=reset
+bootmenu_9=Reset all settings to factory defaults.=run reset_factory ; reset
+boot_first=if button reset ; then led $bootled_rec on ; run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu
+boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever
+boot_production=led $bootled_pwr on ; run ubi_read_production && bootm $loadaddr#$bootconf ; led $bootled_pwr off
+boot_recovery=led $bootled_rec on ; run ubi_read_recovery && bootm $loadaddr#$bootconf ; led $bootled_rec off
+boot_ubi=run boot_production ; run boot_recovery ; run boot_tftp_forever
+boot_tftp_forever=led $bootled_rec on ; while true ; do run boot_tftp_recovery ; sleep 1 ; done
+boot_tftp_production=tftpboot $loadaddr $bootfile_upg && env exists replacevol && iminfo $loadaddr && run ubi_write_production ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
+boot_tftp_recovery=tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run ubi_write_recovery ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
+boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf
+boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run mtd_write_fip && run reset_factory
+boot_tftp_write_bl2=tftpboot $loadaddr $bootfile_bl2 && run mtd_write_bl2
+reset_factory=ubi part ubi ; mw $loadaddr 0x0 0x800 ; ubi write $loadaddr ubootenv 0x800 ; ubi write $loadaddr ubootenv2 0x800
+mtd_write_fip=mtd erase fip && mtd write fip $loadaddr
+mtd_write_bl2=mtd erase bl2 && mtd write bl2 $loadaddr
+ubi_create_env=ubi check ubootenv || ubi create ubootenv 0x100000 dynamic || run ubi_format ; ubi check ubootenv2 || ubi create ubootenv2 0x100000 dynamic || run ubi_format
+ubi_format=ubi detach ; mtd erase ubi && ubi part ubi ; reset
+ubi_prepare_rootfs=if ubi check rootfs_data ; then else if env exists rootfs_data_max ; then ubi create rootfs_data $rootfs_data_max dynamic || ubi create rootfs_data - dynamic ; else ubi create rootfs_data - dynamic ; fi ; fi
+ubi_read_production=ubi read $loadaddr fit && iminfo $loadaddr && run ubi_prepare_rootfs
+ubi_read_recovery=ubi check recovery && ubi read $loadaddr recovery
+ubi_remove_rootfs=ubi check rootfs_data && ubi remove rootfs_data
+ubi_write_production=ubi check fit && ubi remove fit ; run ubi_remove_rootfs ; ubi create fit $filesize dynamic && ubi write $loadaddr fit $filesize
+ubi_write_recovery=ubi check recovery && ubi remove recovery ; run ubi_remove_rootfs ; ubi create recovery $filesize dynamic && ubi write $loadaddr recovery $filesize
+_init_env=setenv _init_env ; run ubi_create_env ; saveenv ; saveenv
+_firstboot=setenv _firstboot ; run _switch_to_menu ; run _init_env ; run boot_first
+_switch_to_menu=setenv _switch_to_menu ; setenv bootdelay 3 ; setenv bootmenu_delay 3 ; setenv bootmenu_0 $bootmenu_0d ; setenv bootmenu_0d ; run _bootmenu_update_title
+_bootmenu_update_title=setenv _bootmenu_update_title ; setenv bootmenu_title "$bootmenu_title $ver"

View File

@ -1,328 +0,0 @@
--- /dev/null
+++ b/configs/mt7981_konka_komi-a31_defconfig
@@ -0,0 +1,107 @@
+CONFIG_ARM=y
+CONFIG_SYS_HAS_NONCACHED_MEMORY=y
+CONFIG_POSITION_INDEPENDENT=y
+CONFIG_ARCH_MEDIATEK=y
+CONFIG_TEXT_BASE=0x41e00000
+CONFIG_SYS_MALLOC_F_LEN=0x4000
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_DEFAULT_DEVICE_TREE="mt7981-konka-komi-a31"
+CONFIG_OF_LIBFDT_OVERLAY=y
+CONFIG_TARGET_MT7981=y
+CONFIG_PRE_CON_BUF_ADDR=0x4007EF00
+CONFIG_DEBUG_UART_BASE=0x11002000
+CONFIG_DEBUG_UART_CLOCK=40000000
+CONFIG_SYS_LOAD_ADDR=0x46000000
+CONFIG_DEBUG_UART=y
+CONFIG_FIT=y
+CONFIG_BOOTDELAY=30
+CONFIG_AUTOBOOT_KEYED=y
+CONFIG_AUTOBOOT_MENU_SHOW=y
+CONFIG_DEFAULT_FDT_FILE="mediatek/mt7981-konka-komi-a31.dtb"
+CONFIG_LOGLEVEL=7
+CONFIG_PRE_CONSOLE_BUFFER=y
+CONFIG_LOG=y
+CONFIG_BOARD_LATE_INIT=y
+CONFIG_HUSH_PARSER=y
+CONFIG_SYS_PROMPT="MT7981> "
+CONFIG_CMD_CPU=y
+CONFIG_CMD_LICENSE=y
+CONFIG_CMD_BOOTMENU=y
+CONFIG_CMD_ASKENV=y
+CONFIG_CMD_ERASEENV=y
+CONFIG_CMD_ENV_FLAGS=y
+CONFIG_CMD_STRINGS=y
+CONFIG_CMD_DM=y
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_GPT=y
+CONFIG_CMD_MTD=y
+CONFIG_CMD_PART=y
+CONFIG_CMD_DHCP=y
+CONFIG_CMD_TFTPSRV=y
+CONFIG_CMD_RARP=y
+CONFIG_CMD_PING=y
+CONFIG_CMD_CDP=y
+CONFIG_CMD_SNTP=y
+CONFIG_CMD_DNS=y
+CONFIG_CMD_LINK_LOCAL=y
+CONFIG_CMD_PXE=y
+CONFIG_CMD_CACHE=y
+CONFIG_CMD_PSTORE=y
+CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000
+CONFIG_CMD_UUID=y
+CONFIG_CMD_HASH=y
+CONFIG_CMD_SMC=y
+CONFIG_CMD_UBI=y
+CONFIG_CMD_UBI_RENAME=y
+CONFIG_OF_EMBED=y
+CONFIG_ENV_OVERWRITE=y
+CONFIG_ENV_IS_IN_UBI=y
+CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
+CONFIG_ENV_UBI_PART="ubi"
+CONFIG_ENV_UBI_VOLUME="ubootenv"
+CONFIG_ENV_UBI_VOLUME_REDUND="ubootenv2"
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_USE_DEFAULT_ENV_FILE=y
+CONFIG_DEFAULT_ENV_FILE="konka_komi-a31_env"
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
+CONFIG_VERSION_VARIABLE=y
+CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_NETCONSOLE=y
+CONFIG_USE_IPADDR=y
+CONFIG_IPADDR="192.168.1.1"
+CONFIG_USE_SERVERIP=y
+CONFIG_SERVERIP="192.168.1.254"
+CONFIG_REGMAP=y
+CONFIG_SYSCON=y
+CONFIG_BUTTON=y
+CONFIG_BUTTON_GPIO=y
+CONFIG_CLK=y
+CONFIG_GPIO_HOG=y
+CONFIG_LED=y
+CONFIG_LED_BLINK=y
+CONFIG_LED_GPIO=y
+# CONFIG_MMC is not set
+CONFIG_MTD=y
+CONFIG_DM_MTD=y
+CONFIG_MTD_SPI_NAND=y
+CONFIG_MTD_UBI_FASTMAP=y
+CONFIG_PHY_FIXED=y
+CONFIG_MEDIATEK_ETH=y
+CONFIG_PHY=y
+CONFIG_PINCTRL=y
+CONFIG_PINCONF=y
+CONFIG_PINCTRL_MT7981=y
+CONFIG_POWER_DOMAIN=y
+CONFIG_MTK_POWER_DOMAIN=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_DM_REGULATOR_GPIO=y
+CONFIG_RAM=y
+CONFIG_DM_SERIAL=y
+CONFIG_MTK_SERIAL=y
+CONFIG_SPI=y
+CONFIG_DM_SPI=y
+CONFIG_MTK_SPIM=y
+CONFIG_ZSTD=y
+CONFIG_HEXDUMP=y
+CONFIG_LMB_MAX_REGIONS=64
--- /dev/null
+++ b/arch/arm/dts/mt7981-konka-komi-a31.dts
@@ -0,0 +1,158 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+/dts-v1/;
+#include "mt7981.dtsi"
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/linux-event-codes.h>
+
+/ {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ model = "Konka KOMI A31";
+ compatible = "mediatek,mt7981", "mediatek,mt7981-rfb";
+
+ chosen {
+ stdout-path = &uart0;
+ tick-timer = &timer0;
+ };
+
+ memory@40000000 {
+ device_type = "memory";
+ reg = <0x40000000 0x10000000>;
+ };
+
+ gpio-keys {
+ compatible = "gpio-keys";
+
+ button-mesh {
+ label = "mesh";
+ linux,code = <BTN_9>;
+ linux,input-type = <EV_SW>;
+ gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
+ };
+
+ button-reset {
+ label = "reset";
+ linux,code = <KEY_RESTART>;
+ gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
+ };
+ };
+
+ gpio-leds {
+ compatible = "gpio-leds";
+
+ green_led: led-0 {
+ label = "green:status";
+ gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
+ default-state = "off";
+ };
+
+ led-1 {
+ label = "blue:status";
+ gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
+ default-state = "off";
+ };
+
+ red_led: led-2 {
+ label = "red:status";
+ gpios = <&gpio 34 GPIO_ACTIVE_HIGH>;
+ default-state = "on";
+ };
+ };
+};
+
+&eth {
+ status = "okay";
+ mediatek,gmac-id = <0>;
+ phy-mode = "2500base-x";
+ mediatek,switch = "mt7531";
+ reset-gpios = <&gpio 39 GPIO_ACTIVE_HIGH>;
+
+ fixed-link {
+ speed = <2500>;
+ full-duplex;
+ };
+};
+
+&pinctrl {
+ spi_flash_pins: spi0-pins-func-1 {
+ mux {
+ function = "flash";
+ groups = "spi0", "spi0_wp_hold";
+ };
+
+ conf-pu {
+ pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP";
+ drive-strength = <MTK_DRIVE_8mA>;
+ bias-pull-up = <MTK_PUPD_SET_R1R0_00>;
+ };
+
+ conf-pd {
+ pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO";
+ drive-strength = <MTK_DRIVE_8mA>;
+ bias-pull-down = <MTK_PUPD_SET_R1R0_00>;
+ };
+ };
+};
+
+&spi0 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&spi_flash_pins>;
+ status = "okay";
+ must_tx;
+ enhance_timing;
+ dma_ext;
+ ipm_design;
+ support_quad;
+ tick_dly = <2>;
+ sample_sel = <0>;
+
+ spi_nand@0 {
+ compatible = "spi-nand";
+ reg = <0>;
+ spi-max-frequency = <52000000>;
+
+ partitions {
+ compatible = "fixed-partitions";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ partition@0 {
+ label = "bl2";
+ reg = <0x0 0x100000>;
+ };
+
+ partition@100000 {
+ label = "u-boot-env";
+ reg = <0x100000 0x80000>;
+ };
+
+ partition@180000 {
+ label = "factory";
+ reg = <0x180000 0x200000>;
+ };
+
+ partition@380000 {
+ label = "fip";
+ reg = <0x380000 0x200000>;
+ };
+
+ partition@580000 {
+ label = "ubi";
+ reg = <0x580000 0x7a80000>;
+ compatible = "linux,ubi";
+ };
+ };
+ };
+};
+
+&uart0 {
+ mediatek,force-highspeed;
+ status = "okay";
+};
+
+&watchdog {
+ status = "disabled";
+};
--- /dev/null
+++ b/konka_komi-a31_env
@@ -0,0 +1,54 @@
+ipaddr=192.168.1.1
+serverip=192.168.1.254
+loadaddr=0x46000000
+console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0
+bootcmd=if pstore check ; then run boot_recovery ; else run boot_ubi ; fi
+bootconf=config-1
+bootdelay=0
+bootfile=openwrt-mediatek-filogic-konka_komi-a31-initramfs-recovery.itb
+bootfile_bl2=openwrt-mediatek-filogic-konka_komi-a31-preloader.bin
+bootfile_fip=openwrt-mediatek-filogic-konka_komi-a31-bl31-uboot.fip
+bootfile_upg=openwrt-mediatek-filogic-konka_komi-a31-squashfs-sysupgrade.itb
+bootled_pwr=red:status
+bootled_rec=blue:status
+bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60
+bootmenu_default=0
+bootmenu_delay=0
+bootmenu_title= ( ( ( OpenWrt ) ) )
+bootmenu_0=Initialize environment.=run _firstboot
+bootmenu_0d=Run default boot command.=run boot_default
+bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return
+bootmenu_2=Boot production system from NAND.=run boot_production ; run bootmenu_confirm_return
+bootmenu_3=Boot recovery system from NAND.=run boot_recovery ; run bootmenu_confirm_return
+bootmenu_4=Load production system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
+bootmenu_5=Load recovery system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
+bootmenu_6=Load BL31+U-Boot FIP via TFTP then write to NAND.=run boot_tftp_write_fip ; run bootmenu_confirm_return
+bootmenu_7=Load BL2 preloader via TFTP then write to NAND.=run boot_tftp_write_bl2 ; run bootmenu_confirm_return
+bootmenu_8=Reboot.=reset
+bootmenu_9=Reset all settings to factory defaults.=run reset_factory ; reset
+boot_first=if button reset ; then led $bootled_rec on ; run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu
+boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever
+boot_production=led $bootled_pwr on ; run ubi_read_production && bootm $loadaddr#$bootconf ; led $bootled_pwr off
+boot_recovery=led $bootled_rec on ; run ubi_read_recovery && bootm $loadaddr#$bootconf ; led $bootled_rec off
+boot_ubi=run boot_production ; run boot_recovery ; run boot_tftp_forever
+boot_tftp_forever=led $bootled_rec on ; while true ; do run boot_tftp_recovery ; sleep 1 ; done
+boot_tftp_production=tftpboot $loadaddr $bootfile_upg && env exists replacevol && iminfo $loadaddr && run ubi_write_production ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
+boot_tftp_recovery=tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run ubi_write_recovery ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
+boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf
+boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run mtd_write_fip && run reset_factory
+boot_tftp_write_bl2=tftpboot $loadaddr $bootfile_bl2 && run mtd_write_bl2
+reset_factory=ubi part ubi ; mw $loadaddr 0x0 0x800 ; ubi write $loadaddr ubootenv 0x800 ; ubi write $loadaddr ubootenv2 0x800
+mtd_write_fip=mtd erase fip && mtd write fip $loadaddr
+mtd_write_bl2=mtd erase bl2 && mtd write bl2 $loadaddr
+ubi_create_env=ubi check ubootenv || ubi create ubootenv 0x100000 dynamic || run ubi_format ; ubi check ubootenv2 || ubi create ubootenv2 0x100000 dynamic || run ubi_format
+ubi_format=ubi detach ; mtd erase ubi && ubi part ubi ; reset
+ubi_prepare_rootfs=if ubi check rootfs_data ; then else if env exists rootfs_data_max ; then ubi create rootfs_data $rootfs_data_max dynamic || ubi create rootfs_data - dynamic ; else ubi create rootfs_data - dynamic ; fi ; fi
+ubi_read_production=ubi read $loadaddr fit && iminfo $loadaddr && run ubi_prepare_rootfs
+ubi_read_recovery=ubi check recovery && ubi read $loadaddr recovery
+ubi_remove_rootfs=ubi check rootfs_data && ubi remove rootfs_data
+ubi_write_production=ubi check fit && ubi remove fit ; run ubi_remove_rootfs ; ubi create fit $filesize dynamic && ubi write $loadaddr fit $filesize
+ubi_write_recovery=ubi check recovery && ubi remove recovery ; run ubi_remove_rootfs ; ubi create recovery $filesize dynamic && ubi write $loadaddr recovery $filesize
+_init_env=setenv _init_env ; run ubi_create_env ; saveenv ; saveenv
+_firstboot=setenv _firstboot ; run _switch_to_menu ; run _init_env ; run boot_first
+_switch_to_menu=setenv _switch_to_menu ; setenv bootdelay 3 ; setenv bootmenu_delay 3 ; setenv bootmenu_0 $bootmenu_0d ; setenv bootmenu_0d ; run _bootmenu_update_title
+_bootmenu_update_title=setenv _bootmenu_update_title ; setenv bootmenu_title "$bootmenu_title $ver"

View File

@ -519,7 +519,7 @@
+_bootmenu_update_title=setenv _bootmenu_update_title ; setenv bootmenu_title "$bootmenu_title $ver"
--- /dev/null
+++ b/openwrt-one-spi-nand_env
@@ -0,0 +1,61 @@
@@ -0,0 +1,60 @@
+ethaddr_factory=mtd read factory 0x46000000 0x0 0x20000 && env readmem -b ethaddr 0x4600002a 0x6 ; setenv ethaddr_factory
+ipaddr=192.168.11.11
+serverip=192.168.11.23
@ -561,7 +561,6 @@
+check_buttons=if button front ; then run boot_recovery ; run boot_tftp ; run led_loop_error ; else if button back ; then ; run usb_recover ; run led_loop_error ; fi ; fi
+led_boot=led green on ; led white on ; led red on
+led_done=led green on ; led white off ; led red off
+led_loop_done=led white off ; led green on ; echo done ; while true ; do sleep 1 ; done
+led_loop_error=led white off ; led green off ; while true ; do led red on ; sleep 1 ; led red off ; sleep 1 ; done
+led_start=led white on ; led green off ; led red off
+preboot=run led_boot

View File

@ -13,7 +13,7 @@ Signed-off-by: Enrico Mioso <mrkiko.rs@gmail.com>
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -651,19 +651,13 @@ static init_fnc_t init_sequence_r[] = {
@@ -663,19 +663,13 @@ static init_fnc_t init_sequence_r[] = {
serial_initialize,
initr_announce,
dm_announce,
@ -33,7 +33,7 @@ Signed-off-by: Enrico Mioso <mrkiko.rs@gmail.com>
#if defined(CONFIG_PCI_INIT_R) && defined(CONFIG_SYS_EARLY_PCI_INIT)
/*
* Do early PCI configuration _before_ the flash gets initialised,
@@ -678,7 +672,6 @@ static init_fnc_t init_sequence_r[] = {
@@ -690,7 +684,6 @@ static init_fnc_t init_sequence_r[] = {
#ifdef CONFIG_MTD_NOR_FLASH
initr_flash,
#endif
@ -41,7 +41,7 @@ Signed-off-by: Enrico Mioso <mrkiko.rs@gmail.com>
#if defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_X86)
/* initialize higher level parts of CPU like time base and timers */
cpu_init_r,
@@ -707,6 +700,10 @@ static init_fnc_t init_sequence_r[] = {
@@ -719,6 +712,10 @@ static init_fnc_t init_sequence_r[] = {
#ifdef CONFIG_PVBLOCK
initr_pvblock,
#endif

View File

@ -1,6 +1,6 @@
--- /dev/null
+++ b/configs/mt7981_routerich_ax3000_defconfig
@@ -0,0 +1,108 @@
@@ -0,0 +1,107 @@
+CONFIG_ARM=y
+CONFIG_SYS_HAS_NONCACHED_MEMORY=y
+CONFIG_POSITION_INDEPENDENT=y

View File

@ -1,103 +0,0 @@
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_VERSION:=2017.09.20241018
PKG_RELEASE:=$(AUTORELEASE)
PKG_SOURCE_PROTO:=default
PKG_SOURCE:=rkuboot-$(PKG_VERSION).tar.gz
PKG_SOURCE_VERSION:=2687dce2617032930f2c43fef349bdea694c6f68
PKG_SOURCE_URL_FILE:=$(PKG_SOURCE_VERSION).tar.gz
PKG_SOURCE_URL:=https://github.com/rockchip-linux/u-boot/archive/
PKG_HASH:=6c723ebd3f0732472e707ac3317847e038e606e7632d5a686f8278d333e5ef78
PKG_MAINTAINER:=jjm2473
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:=rockchip
UENV:=default
HIDDEN:=1
BUILD_SUBTARGET:=armv8
DEFAULT:=y
PKG_BUILD_DEPENDS:=rkbin
endef
# RK3528 boards
define U-Boot/easepi-rk3528
NAME:=RK3528 Generic
DEPENDS:=+PACKAGE_u-boot-$(1):trusted-firmware-a-rk3528
ATF:=rk3528_bl31_v1.17.elf
TPL:=rk3528_ddr_1056MHz_v1.09.bin
SOC:=rk3528
endef
# RK3576 boards
define U-Boot/easepi-rk3576
NAME:=RK3576 Generic
DEPENDS:=+PACKAGE_u-boot-$(1):trusted-firmware-a-rk3576
ATF:=rk3576_bl31_v1.15.elf
TPL:=rk3576_ddr_lp4_2112MHz_lp5_2736MHz_v1.09.bin
SOC:=rk3576
IDB:=$$(IDB_FILE)
endef
UBOOT_TARGETS := easepi-rk3528 easepi-rk3576
UBOOT_CONFIGURE_VARS += USE_PRIVATE_LIBGCC=yes
UBOOT_MAKE_FLAGS += \
IDB_SOC=$(SOC) \
TPL_BIN=$(STAGING_DIR_IMAGE)/$(TPL) \
u-boot.itb $(if $(IDB),,idbloader.img)
ifeq ($(BUILD_VARIANT),easepi-rk3576)
# The idbloader.img built from uboot cannot boot from sd card, so use the pre-built one
IDB_FILE:=easepi-rk3576-idbloader_v1.09.107.img
define Download/rk3576-idbloader
FILE:=$(IDB_FILE)
URL:=https://github.com/jjm2473/uboot-nanopi/releases/download/rk3576-v1.0/
HASH:=c55404e27f595942be438a52e1e6b58eb9c577b25615c7d9b68202d4af390971
endef
define Build/Prepare
$(eval $(call Download,rk3576-idbloader))
$(call Build/Prepare/Default)
endef
endif
define Build/Configure
$(call Build/Configure/U-Boot)
$(SED) 's/CONFIG_TOOLS_LIBCRYPTO=y/# CONFIG_TOOLS_LIBCRYPTO is not set/' $(PKG_BUILD_DIR)/.config
$(SED) 's#CONFIG_MKIMAGE_DTC_PATH=.*#CONFIG_MKIMAGE_DTC_PATH="$(PKG_BUILD_DIR)/scripts/dtc/dtc"#g' $(PKG_BUILD_DIR)/.config
echo 'CONFIG_IDENT_STRING=" OpenWrt"' >> $(PKG_BUILD_DIR)/.config
$(CP) $(STAGING_DIR_IMAGE)/$(ATF) $(PKG_BUILD_DIR)/bl31.elf
ifneq ($(IDB),)
$(CP) $(DL_DIR)/$(IDB) $(PKG_BUILD_DIR)/idbloader.img
endif
endef
define Build/InstallDev
$(INSTALL_DIR) $(STAGING_DIR_IMAGE)
dd if=/dev/zero of=$(PKG_BUILD_DIR)/u-boot-rockchip.bin bs=512 count=16320
dd if=$(PKG_BUILD_DIR)/idbloader.img of=$(PKG_BUILD_DIR)/u-boot-rockchip.bin conv=notrunc
dd if=$(PKG_BUILD_DIR)/u-boot.itb of=$(PKG_BUILD_DIR)/u-boot-rockchip.bin seek=16320 conv=notrunc
$(CP) $(PKG_BUILD_DIR)/u-boot-rockchip.bin $(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-u-boot-rockchip.bin
endef
define Package/u-boot/install/default
endef
$(eval $(call BuildPackage/U-Boot))

View File

@ -1,31 +0,0 @@
Index: rk-u-boot/cmd/Kconfig
===================================================================
--- rk-u-boot.orig/cmd/Kconfig
+++ rk-u-boot/cmd/Kconfig
@@ -589,6 +589,14 @@ config CMD_ARMFLASH
help
ARM Ltd reference designs flash partition access
+config CMD_ADC
+ bool "adc - Access Analog to Digital Converters info and data"
+ select ADC
+ depends on DM_REGULATOR
+ help
+ Shows ADC device info and permit printing one-shot analog converted
+ data from a named Analog to Digital Converter.
+
config CMD_CLK
bool "clk - Show clock frequencies"
help
Index: rk-u-boot/cmd/Makefile
===================================================================
--- rk-u-boot.orig/cmd/Makefile
+++ rk-u-boot/cmd/Makefile
@@ -13,6 +13,7 @@ obj-y += help.o
obj-y += version.o
# command
+obj-$(CONFIG_CMD_ADC) += adc.o
obj-$(CONFIG_CMD_AES) += aes.o
obj-$(CONFIG_CMD_AMBAPP) += ambapp.o
obj-$(CONFIG_CMD_ANDROID_AB_SELECT) += android_ab_select.o android_cmds.o

View File

@ -1,46 +0,0 @@
Index: rk-u-boot/drivers/adc/adc-uclass.c
===================================================================
--- rk-u-boot.orig/drivers/adc/adc-uclass.c
+++ rk-u-boot/drivers/adc/adc-uclass.c
@@ -84,6 +84,18 @@ int adc_data_mask(struct udevice *dev, u
return 0;
}
+int adc_channel_mask(struct udevice *dev, unsigned int *channel_mask)
+{
+ struct adc_uclass_platdata *uc_pdata = dev_get_uclass_platdata(dev);
+
+ if (!uc_pdata)
+ return -ENOSYS;
+
+ *channel_mask = uc_pdata->channel_mask;
+
+ return 0;
+}
+
int adc_stop(struct udevice *dev)
{
const struct adc_ops *ops = dev_get_driver_ops(dev);
Index: rk-u-boot/include/adc.h
===================================================================
--- rk-u-boot.orig/include/adc.h
+++ rk-u-boot/include/adc.h
@@ -220,6 +220,18 @@ int adc_channels_data(struct udevice *de
int adc_data_mask(struct udevice *dev, unsigned int *data_mask);
/**
+ * adc_channel_mask() - get channel mask for given ADC device
+ *
+ * This can be used if adc uclass platform data is filled.
+ *
+ * @dev: ADC device to check
+ * @channel_mask: pointer to the returned channel bitmask
+ * @return: 0 if OK, -ve on error
+ */
+int adc_channel_mask(struct udevice *dev, unsigned int *channel_mask);
+
+
+/**
* adc_channel_single_shot() - get output data of conversion for the ADC
* device's channel. This function searches for the device with the given name,
* starts the given channel conversion and returns the output data.

View File

@ -1,62 +0,0 @@
Index: rk-u-boot/drivers/adc/adc-uclass.c
===================================================================
--- rk-u-boot.orig/drivers/adc/adc-uclass.c
+++ rk-u-boot/drivers/adc/adc-uclass.c
@@ -7,6 +7,7 @@
#include <common.h>
#include <errno.h>
+#include <div64.h>
#include <dm.h>
#include <dm/lists.h>
#include <dm/device-internal.h>
@@ -365,6 +366,30 @@ nodev:
return 0;
}
+
+int adc_raw_to_uV(struct udevice *dev, unsigned int raw, int *uV)
+{
+ unsigned int data_mask;
+ int ret, val, vref;
+ u64 raw64 = raw;
+
+ ret = adc_vdd_value(dev, &vref);
+ if (ret)
+ return ret;
+
+ if (!adc_vss_value(dev, &val))
+ vref -= val;
+
+ ret = adc_data_mask(dev, &data_mask);
+ if (ret)
+ return ret;
+
+ raw64 *= vref;
+ do_div(raw64, data_mask);
+ *uV = raw64;
+
+ return 0;
+}
static int adc_vdd_platdata_set(struct udevice *dev)
{
Index: rk-u-boot/include/adc.h
===================================================================
--- rk-u-boot.orig/include/adc.h
+++ rk-u-boot/include/adc.h
@@ -297,4 +297,14 @@ int adc_vss_value(struct udevice *dev, i
*/
int adc_stop(struct udevice *dev);
+/**
+ * adc_raw_to_uV() - converts raw value to microvolts for given ADC device.
+ *
+ * @dev: ADC device used from conversion
+ * @raw: raw value to convert
+ * @uV: converted value in microvolts
+ * @return: 0 on success or -ve on error
+ */
+int adc_raw_to_uV(struct udevice *dev, unsigned int raw, int *uV);
+
#endif

View File

@ -1,36 +0,0 @@
From 34bfaa17488e5fd933dad63eacfef4f1c86ebd58 Mon Sep 17 00:00:00 2001
From: Liangbin Lian <jjm2473@gmail.com>
Date: Fri, 26 May 2023 14:25:07 +0800
Subject: [PATCH] disable adc to volt convert
---
drivers/adc/rockchip-saradc-v2.c | 2 ++
drivers/adc/rockchip-saradc.c | 2 ++
2 files changed, 4 insertions(+)
Index: rk-u-boot/drivers/adc/rockchip-saradc-v2.c
===================================================================
--- rk-u-boot.orig/drivers/adc/rockchip-saradc-v2.c
+++ rk-u-boot/drivers/adc/rockchip-saradc-v2.c
@@ -216,6 +216,8 @@ static int rockchip_saradc_ofdata_to_pla
uc_pdata->data_format = ADC_DATA_FORMAT_BIN;
uc_pdata->data_timeout_us = SARADC_TIMEOUT / 5;
uc_pdata->channel_mask = (1 << priv->data->num_channels) - 1;
+ uc_pdata->vdd_microvolts = -ENODATA;
+ uc_pdata->vss_microvolts = -ENODATA;
return 0;
}
Index: rk-u-boot/drivers/adc/rockchip-saradc.c
===================================================================
--- rk-u-boot.orig/drivers/adc/rockchip-saradc.c
+++ rk-u-boot/drivers/adc/rockchip-saradc.c
@@ -134,6 +134,8 @@ int rockchip_saradc_ofdata_to_platdata(s
uc_pdata->data_format = ADC_DATA_FORMAT_BIN;
uc_pdata->data_timeout_us = SARADC_TIMEOUT / 5;
uc_pdata->channel_mask = (1 << priv->data->num_channels) - 1;
+ uc_pdata->vdd_microvolts = -ENODATA;
+ uc_pdata->vss_microvolts = -ENODATA;
return 0;
}

View File

@ -1,26 +0,0 @@
Index: rk-u-boot/drivers/adc/rockchip-saradc.c
===================================================================
--- rk-u-boot.orig/drivers/adc/rockchip-saradc.c
+++ rk-u-boot/drivers/adc/rockchip-saradc.c
@@ -164,6 +164,12 @@ static const struct rockchip_saradc_data
.clk_rate = 1000000,
};
+static const struct rockchip_saradc_data rk3568_saradc_data = {
+ .num_bits = 10,
+ .num_channels = 8,
+ .clk_rate = 1000000,
+};
+
static const struct udevice_id rockchip_saradc_ids[] = {
{ .compatible = "rockchip,saradc",
.data = (ulong)&saradc_data },
@@ -171,6 +177,8 @@ static const struct udevice_id rockchip_
.data = (ulong)&rk3066_tsadc_data },
{ .compatible = "rockchip,rk3399-saradc",
.data = (ulong)&rk3399_saradc_data },
+ { .compatible = "rockchip,rk3568-saradc",
+ .data = (ulong)&rk3568_saradc_data },
{ }
};

View File

@ -1,40 +0,0 @@
From 40361189b449992e14ff0bd0be18c92167ff8d00 Mon Sep 17 00:00:00 2001
From: jjm2473 <1129525450@qq.com>
Date: Tue, 6 Jun 2023 12:27:39 +0800
Subject: [PATCH] fix efi detection
---
disk/part_efi.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
Index: rk-u-boot/disk/part_efi.c
===================================================================
--- rk-u-boot.orig/disk/part_efi.c
+++ rk-u-boot/disk/part_efi.c
@@ -371,7 +371,7 @@ int part_get_info_efi(struct blk_desc *d
return 0;
}
-#ifdef CONFIG_RKIMG_BOOTLOADER
+#if 0
#if defined(CONFIG_SPL_KERNEL_BOOT) || !defined(CONFIG_SPL_BUILD)
static void gpt_entry_modify(struct blk_desc *dev_desc,
gpt_entry *gpt_pte,
@@ -504,7 +504,7 @@ static int part_test_efi(struct blk_desc
|| (is_pmbr_valid(legacymbr) != 1)) {
return -1;
}
-#ifdef CONFIG_RKIMG_BOOTLOADER
+#if 0
#if defined(CONFIG_SPL_KERNEL_BOOT) || !defined(CONFIG_SPL_BUILD)
gpt_entry *h_gpt_pte = NULL;
gpt_header *h_gpt_head = NULL;
@@ -1147,7 +1147,7 @@ static int is_pmbr_valid(legacy_mbr * mb
{
int i = 0;
-#ifdef CONFIG_ARCH_ROCKCHIP
+#if 0
/*
* In sd-update card, we use RKPARM partition in bootloader to load
* firmware, and use MS-DOS partition in recovery to update system.

View File

@ -1,22 +0,0 @@
From 600dbd1d1ca42e82aa11540954725a7c19952bef Mon Sep 17 00:00:00 2001
From: jjm2473 <1129525450@qq.com>
Date: Mon, 5 Jun 2023 16:58:02 +0800
Subject: [PATCH] supports legacy image
---
include/configs/rockchip-common.h | 2 ++
1 file changed, 2 insertions(+)
Index: rk-u-boot/include/configs/rockchip-common.h
===================================================================
--- rk-u-boot.orig/include/configs/rockchip-common.h
+++ rk-u-boot/include/configs/rockchip-common.h
@@ -180,6 +180,8 @@
"run distro_bootcmd;"
#endif
+#define CONFIG_IMAGE_FORMAT_LEGACY /* enable also legacy image format */
+
#endif /* CONFIG_SPL_BUILD */
#define CONFIG_DISPLAY_BOARDINFO_LATE

View File

@ -1,23 +0,0 @@
From fba85cc35e748ce82af8d23c8ae6b7594a927ca1 Mon Sep 17 00:00:00 2001
From: jjm2473 <1129525450@qq.com>
Date: Mon, 5 Jun 2023 17:36:35 +0800
Subject: [PATCH] fix source cmd bug introduced by rk
11a331d232dea79e25443776ebc3044cbe91d259
---
cmd/source.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: rk-u-boot/cmd/source.c
===================================================================
--- rk-u-boot.orig/cmd/source.c
+++ rk-u-boot/cmd/source.c
@@ -87,7 +87,7 @@ source (ulong addr, const char *fit_unam
* past the zero-terminated sequence of image lengths to get
* to the actual image data
*/
- while (*data++ != IMAGE_PARAM_INVAL);
+ while (*data++);
break;
#endif
#if defined(CONFIG_FIT)

View File

@ -1,29 +0,0 @@
From ca4343eb308b019c6bc6930361b56306cd3ba55d Mon Sep 17 00:00:00 2001
From: jjm2473 <1129525450@qq.com>
Date: Mon, 5 Jun 2023 18:48:45 +0800
Subject: [PATCH] fix boorargs not in effect
---
arch/arm/mach-rockchip/board.c | 2 ++
1 file changed, 2 insertions(+)
Index: rk-u-boot/arch/arm/mach-rockchip/board.c
===================================================================
--- rk-u-boot.orig/arch/arm/mach-rockchip/board.c
+++ rk-u-boot/arch/arm/mach-rockchip/board.c
@@ -1399,6 +1399,7 @@ static void bootargs_add_dtb_dtbo(void *
}
}
+#ifdef CONFIG_CMD_BOOT_ANDROID
char *board_fdt_chosen_bootargs(void *fdt)
{
int verbose = is_hotkey(HK_CMDLINE);
@@ -1442,6 +1443,7 @@ char *board_fdt_chosen_bootargs(void *fd
return (char *)bootargs;
}
+#endif
int ft_verify_fdt(void *fdt)
{

View File

@ -1,36 +0,0 @@
From 07015a9f00f8cafb0985ff88bf8beb2731a45559 Mon Sep 17 00:00:00 2001
From: jjm2473 <1129525450@qq.com>
Date: Mon, 5 Jun 2023 21:39:00 +0800
Subject: [PATCH] fix CE without RKIMG_BOOTLOADER
---
common/image-android.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
Index: rk-u-boot/common/image-android.c
===================================================================
--- rk-u-boot.orig/common/image-android.c
+++ rk-u-boot/common/image-android.c
@@ -38,6 +38,7 @@ DECLARE_GLOBAL_DATA_PTR;
static char andr_tmp_str[ANDR_BOOT_ARGS_SIZE + 1];
static u32 android_kernel_comp_type = IH_COMP_NONE;
+#ifdef CONFIG_RKIMG_BOOTLOADER
static int android_version_init(void)
{
struct andr_img_hdr *hdr = NULL;
@@ -72,11 +73,13 @@ static int android_version_init(void)
return (os_version >> 25) & 0x7f;
}
+#endif
u32 android_bcb_msg_sector_offset(void)
{
+#ifdef CONFIG_RKIMG_BOOTLOADER
static int android_version = -1; /* static */
-
+#endif
/*
* get android os version:
*

View File

@ -1,32 +0,0 @@
From 6928b3a2b8397bea88add5174821e7a9c6f405d9 Mon Sep 17 00:00:00 2001
From: jjm2473 <jjm2473@gmail.com>
Date: Wed, 11 Jun 2025 14:16:45 +0800
Subject: [PATCH] fix CE without CMD_BOOT_ANDROID
---
arch/arm/mach-rockchip/board.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/arm/mach-rockchip/board.c b/arch/arm/mach-rockchip/board.c
index f98eaca8..7714345d 100644
--- a/arch/arm/mach-rockchip/board.c
+++ b/arch/arm/mach-rockchip/board.c
@@ -1217,6 +1217,7 @@ int board_rng_seed(struct abuf *buf)
return 0;
}
+#ifdef CONFIG_CMD_BOOT_ANDROID
/*
* Pass fwver when any available.
*/
@@ -1398,6 +1399,7 @@ static void bootargs_add_dtb_dtbo(void *fdt, bool verbose)
#endif
}
}
+#endif
#ifdef CONFIG_CMD_BOOT_ANDROID
char *board_fdt_chosen_bootargs(void *fdt)
--
2.46.0

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