mirror of
git://git.openwrt.org/openwrt/openwrt.git
synced 2026-06-15 17:56:18 -04:00
Compare commits
176 Commits
linking-re
...
v24.10.0-r
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
66e76aa94f | ||
|
|
ea17e958b9 | ||
|
|
5601274444 | ||
|
|
41714984df | ||
|
|
d276b4c91a | ||
|
|
c981096416 | ||
|
|
de8a1a1e3a | ||
|
|
17bdccb4a5 | ||
|
|
2c3d036fe7 | ||
|
|
7eec852c06 | ||
|
|
8c616ccf24 | ||
|
|
9e73f794ad | ||
|
|
c312295b56 | ||
|
|
ba95a01cbf | ||
|
|
fd7b1f60ea | ||
|
|
0a0950614b | ||
|
|
67269ae51e | ||
|
|
1b2adb8000 | ||
|
|
888e879d7f | ||
|
|
2544e03d10 | ||
|
|
005f086752 | ||
|
|
4779e954fa | ||
|
|
60e21548e5 | ||
|
|
d491100f01 | ||
|
|
fd0f608d66 | ||
|
|
a07c241b81 | ||
|
|
25973eab22 | ||
|
|
0b4d831886 | ||
|
|
1e0f790d23 | ||
|
|
50ee6adc5a | ||
|
|
1b513604c3 | ||
|
|
35b7bbf355 | ||
|
|
b2f3713801 | ||
|
|
58f4667a37 | ||
|
|
4eb85c47bd | ||
|
|
e654d55446 | ||
|
|
c584683a7f | ||
|
|
27afd9e1ca | ||
|
|
2f99171de3 | ||
|
|
0f301db3ff | ||
|
|
2950e189ce | ||
|
|
956bb0c2a4 | ||
|
|
72bf1db35c | ||
|
|
c3db0cca0f | ||
|
|
911b25d618 | ||
|
|
d921c2db0b | ||
|
|
fd9de585d7 | ||
|
|
c93e7700d4 | ||
|
|
480aed0c72 | ||
|
|
fb4088cdec | ||
|
|
8eb07120a2 | ||
|
|
2d3ad35537 | ||
|
|
7a945bf88b | ||
|
|
f93bba30d7 | ||
|
|
77de80d9db | ||
|
|
b17413117d | ||
|
|
ac2d91329e | ||
|
|
7afbe22599 | ||
|
|
9a09c54449 | ||
|
|
57ac0965cf | ||
|
|
69eecbef91 | ||
|
|
908975850d | ||
|
|
7142e35777 | ||
|
|
4b9739a0f1 | ||
|
|
2884aded40 | ||
|
|
dae203bd94 | ||
|
|
abf78dd5d8 | ||
|
|
05989f69d8 | ||
|
|
b1c01cd4b5 | ||
|
|
16eb043062 | ||
|
|
1eade612f9 | ||
|
|
9591c1631d | ||
|
|
d5e45df9c2 | ||
|
|
4166aaf98a | ||
|
|
d4a26ffd1a | ||
|
|
994a95584a | ||
|
|
4c22224bcc | ||
|
|
be082a7c7e | ||
|
|
7d4be068da | ||
|
|
71d60c6983 | ||
|
|
756c955a9c | ||
|
|
f59c665660 | ||
|
|
77af73050c | ||
|
|
f2a40e1117 | ||
|
|
7d9fc260a1 | ||
|
|
2226546e1c | ||
|
|
8f0d52d8c4 | ||
|
|
2942ee0a8d | ||
|
|
11d36818b9 | ||
|
|
03984356bd | ||
|
|
7424f58eb6 | ||
|
|
9d44e00fc5 | ||
|
|
655874713e | ||
|
|
96ab90a9aa | ||
|
|
25427d7942 | ||
|
|
67da3d33f3 | ||
|
|
62690e3b51 | ||
|
|
2af51fbdab | ||
|
|
69fd722edd | ||
|
|
f05d49cfbd | ||
|
|
68465e524b | ||
|
|
79c711a035 | ||
|
|
d582b369c3 | ||
|
|
14880209d5 | ||
|
|
1c934c7dc7 | ||
|
|
a5efcbd327 | ||
|
|
1fd7e5124e | ||
|
|
c2cde63ae6 | ||
|
|
4b9e9a0310 | ||
|
|
c4c1bb523f | ||
|
|
70ee25f70f | ||
|
|
ec774fafe6 | ||
|
|
e5a20b0f49 | ||
|
|
0cf557876a | ||
|
|
3451a70356 | ||
|
|
fbe50c67c6 | ||
|
|
7ef734deac | ||
|
|
39d6d318a6 | ||
|
|
0de3c201b1 | ||
|
|
634ac989e9 | ||
|
|
1d612c33de | ||
|
|
79dafe4ad1 | ||
|
|
141ccfd548 | ||
|
|
a5b291116b | ||
|
|
7402e7dd86 | ||
|
|
610652090d | ||
|
|
a2e7d8761b | ||
|
|
d665be7c1e | ||
|
|
b506c964a2 | ||
|
|
c279ca8b79 | ||
|
|
1abaf051d2 | ||
|
|
5ad5677067 | ||
|
|
112adbee68 | ||
|
|
3ecfc24c51 | ||
|
|
585eb0d6c8 | ||
|
|
2d465fbf57 | ||
|
|
faebcc61eb | ||
|
|
3e094777e7 | ||
|
|
740052e84e | ||
|
|
fe048b5e87 | ||
|
|
13f166763f | ||
|
|
c02af3fd85 | ||
|
|
1fdc4b144b | ||
|
|
e39f5d4b36 | ||
|
|
d83ae23d08 | ||
|
|
92eb867873 | ||
|
|
4b413687e6 | ||
|
|
7a1815f64d | ||
|
|
c0a50b1d59 | ||
|
|
983a753f38 | ||
|
|
f3359da4b8 | ||
|
|
a82b097635 | ||
|
|
49d8f4b833 | ||
|
|
7763c5aabc | ||
|
|
0d97e775ac | ||
|
|
895f30e31a | ||
|
|
5b7357e0a1 | ||
|
|
ccd30b9ed7 | ||
|
|
4b4e307a01 | ||
|
|
de3dfe5714 | ||
|
|
f4b62a6b28 | ||
|
|
ab5c090077 | ||
|
|
0f6aafcc24 | ||
|
|
7c8bfc0be5 | ||
|
|
4ec95518de | ||
|
|
a923d1f9ec | ||
|
|
de3d57a60c | ||
|
|
547feaca2c | ||
|
|
d92306d020 | ||
|
|
6bc930c47d | ||
|
|
92fd12e7fd | ||
|
|
e3bbeabe92 | ||
|
|
a4f3e17029 | ||
|
|
05b3adc0db | ||
|
|
07e5dd4c4f | ||
|
|
4ae45b1f4a |
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -1,2 +1 @@
|
||||
* -text
|
||||
*.patch whitespace=-indent-with-non-tab,-space-before-tab,-tab-in-indent,-trailing-space
|
||||
|
||||
14
.github/labeler.yml
vendored
14
.github/labeler.yml
vendored
@@ -7,6 +7,10 @@
|
||||
- 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:
|
||||
@@ -54,10 +58,6 @@
|
||||
- "target/linux/d1/**"
|
||||
- "package/boot/uboot-d1/**"
|
||||
- "package/boot/opensbi/**"
|
||||
"target/econet":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "target/linux/econet/**"
|
||||
"target/gemini":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
@@ -80,12 +80,6 @@
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "target/linux/qualcommax/**"
|
||||
- "package/kernel/qca-ssdk/**"
|
||||
- "package/kernel/qca-nss-dp/**"
|
||||
"target/qualcommbe":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "target/linux/qualcommbe/**"
|
||||
"target/ixp4xx":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
|
||||
164
.github/workflows/build-on-comment.yml
vendored
164
.github/workflows/build-on-comment.yml
vendored
@@ -1,164 +0,0 @@
|
||||
name: Build on Comment
|
||||
|
||||
on:
|
||||
issue_comment:
|
||||
types: [created, edited]
|
||||
|
||||
permissions:
|
||||
pull-requests: write
|
||||
|
||||
concurrency:
|
||||
group: build-on-comment-${{ github.event.issue.number || github.event.pull_request.number }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
check-and-build:
|
||||
if: github.event.issue.pull_request != null
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Check if user is in reviewers team
|
||||
id: check-reviewer
|
||||
run: |
|
||||
USERNAME="${{ github.event.comment.user.login }}"
|
||||
|
||||
STATUS_CODE=$(curl -s -H "Authorization: token ${{ secrets.LOOKUP_MEMBERS }}" \
|
||||
-o response.json -w "%{http_code}" \
|
||||
https://api.github.com/orgs/openwrt/teams/reviewers/memberships/$USERNAME)
|
||||
|
||||
if grep -q '"state": "active"' response.json && [ "$STATUS_CODE" -eq 200 ]; then
|
||||
echo "authorized=true" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "authorized=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Parse build command
|
||||
if: steps.check-reviewer.outputs.authorized == 'true'
|
||||
id: parse-command
|
||||
run: |
|
||||
COMMENT="${{ github.event.comment.body }}"
|
||||
if echo "$COMMENT" | grep -q "build [a-zA-Z0-9_-]\+/[a-zA-Z0-9_-]\+/[a-zA-Z0-9_-]\+"; then
|
||||
BUILD_PATH=$(echo "$COMMENT" | grep -o "build [a-zA-Z0-9_-]\+/[a-zA-Z0-9_-]\+/[a-zA-Z0-9_-]\+" | sed 's/build //')
|
||||
TARGET=$(echo "$BUILD_PATH" | cut -d'/' -f1)
|
||||
SUBTARGET=$(echo "$BUILD_PATH" | cut -d'/' -f2)
|
||||
PROFILE=$(echo "$BUILD_PATH" | cut -d'/' -f3)
|
||||
echo "build_requested=true" >> $GITHUB_OUTPUT
|
||||
echo "target=$TARGET" >> $GITHUB_OUTPUT
|
||||
echo "subtarget=$SUBTARGET" >> $GITHUB_OUTPUT
|
||||
echo "profile=$PROFILE" >> $GITHUB_OUTPUT
|
||||
echo "build_path=$BUILD_PATH" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "build_requested=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Find existing build comment
|
||||
if: steps.parse-command.outputs.build_requested == 'true'
|
||||
id: find-comment
|
||||
uses: peter-evans/find-comment@v2
|
||||
with:
|
||||
issue-number: ${{ github.event.pull_request.number || github.event.issue.number }}
|
||||
comment-author: "github-actions[bot]"
|
||||
|
||||
- name: Create early build comment
|
||||
if: steps.parse-command.outputs.build_requested == 'true'
|
||||
id: start-comment
|
||||
uses: peter-evans/create-or-update-comment@v3
|
||||
with:
|
||||
issue-number: ${{ github.event.pull_request.number || github.event.issue.number }}
|
||||
comment-id: ${{ steps.find-comment.outputs.comment-id }}
|
||||
body: |
|
||||
🚧 **Build in progress for** `${{ steps.parse-command.outputs.build_path }}`...
|
||||
|
||||
You can follow progress [here](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})
|
||||
|
||||
*Triggered by: @${{ github.event.comment.user.login }}*
|
||||
edit-mode: replace
|
||||
|
||||
- name: Checkout repository
|
||||
if: steps.parse-command.outputs.build_requested == 'true'
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
fetch-depth: 0
|
||||
ref: refs/pull/${{ github.event.issue.number }}/merge
|
||||
|
||||
- name: Setup build environment
|
||||
if: steps.parse-command.outputs.build_requested == 'true'
|
||||
continue-on-error: true
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y build-essential libncurses5-dev gawk git subversion libssl-dev gettext zlib1g-dev swig unzip time rsync
|
||||
|
||||
- name: Build target
|
||||
if: steps.parse-command.outputs.build_requested == 'true'
|
||||
id: build
|
||||
run: |
|
||||
make defconfig
|
||||
echo "CONFIG_DEVEL=y" > .config
|
||||
echo "CONFIG_BPF_TOOLCHAIN_HOST=y" >> .config
|
||||
echo "CONFIG_TARGET_${{ steps.parse-command.outputs.target }}=y" >> .config
|
||||
echo "CONFIG_TARGET_${{ steps.parse-command.outputs.target }}_${{ steps.parse-command.outputs.subtarget }}=y" >> .config
|
||||
echo "CONFIG_TARGET_${{ steps.parse-command.outputs.target }}_${{ steps.parse-command.outputs.subtarget }}_DEVICE_${{ steps.parse-command.outputs.profile }}=y" >> .config
|
||||
|
||||
make defconfig
|
||||
make -j$(nproc) BUILD_LOG=1
|
||||
|
||||
echo "build_success=true" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Upload log
|
||||
uses: actions/upload-artifact@v4
|
||||
if: steps.check-reviewer.outputs.authorized == 'true' && (success() || failure())
|
||||
with:
|
||||
name: build-log-${{ steps.parse-command.outputs.target }}-${{ steps.parse-command.outputs.subtarget }}-${{ steps.parse-command.outputs.profile }}
|
||||
path: logs/
|
||||
|
||||
- name: Create artifact archive
|
||||
if: steps.build.outputs.build_success == 'true'
|
||||
run: |
|
||||
cd bin/
|
||||
tar -czf ../build-artifacts.tar.gz *
|
||||
cd ..
|
||||
|
||||
- name: Upload build artifacts
|
||||
if: steps.build.outputs.build_success == 'true'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: build-${{ steps.parse-command.outputs.target }}-${{ steps.parse-command.outputs.subtarget }}-${{ steps.parse-command.outputs.profile }}
|
||||
path: build-artifacts.tar.gz
|
||||
|
||||
- name: Update comment with build results
|
||||
if: steps.build.outputs.build_success == 'true'
|
||||
uses: peter-evans/create-or-update-comment@v3
|
||||
with:
|
||||
comment-id: ${{ steps.start-comment.outputs.comment-id }}
|
||||
issue-number: ${{ github.event.pull_request.number || github.event.issue.number }}
|
||||
body: |
|
||||
## Build Results for `${{ steps.parse-command.outputs.build_path }}`
|
||||
|
||||
✅ **Build completed successfully!**
|
||||
|
||||
**Target:** `${{ steps.parse-command.outputs.target }}`
|
||||
**Subtarget:** `${{ steps.parse-command.outputs.subtarget }}`
|
||||
**Profile:** `${{ steps.parse-command.outputs.profile }}`
|
||||
|
||||
📦 **Artifacts:** [Download build-${{ steps.parse-command.outputs.target }}-${{ steps.parse-command.outputs.subtarget }}-${{ steps.parse-command.outputs.profile }}](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})
|
||||
|
||||
*Build triggered by: @${{ github.event.comment.user.login }}*
|
||||
*Last updated: ${{ github.event.comment.created_at }}*
|
||||
edit-mode: replace
|
||||
|
||||
- name: Update comment on build failure
|
||||
if: steps.parse-command.outputs.build_requested == 'true' && steps.build.outputs.build_success == 'false'
|
||||
uses: peter-evans/create-or-update-comment@v3
|
||||
with:
|
||||
comment-id: ${{ steps.start-comment.outputs.comment-id }}
|
||||
issue-number: ${{ github.event.pull_request.number || github.event.issue.number }}
|
||||
body: |
|
||||
## Build Results for `${{ steps.parse-command.outputs.build_path }}`
|
||||
|
||||
❌ **Build failed!**
|
||||
|
||||
Please check the [action logs](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) for more details.
|
||||
|
||||
*Build triggered by: @${{ github.event.comment.user.login }}*
|
||||
edit-mode: replace
|
||||
@@ -70,8 +70,8 @@ menu "Global build settings"
|
||||
|
||||
config USE_APK
|
||||
imply PACKAGE_apk-mbedtls
|
||||
bool "Use APK instead of OPKG to build distribution"
|
||||
default y
|
||||
bool "Use APK instead of OPKG to build distribution (BROKEN)"
|
||||
depends on BROKEN
|
||||
|
||||
comment "General build options"
|
||||
|
||||
@@ -174,8 +174,8 @@ menu "Global build settings"
|
||||
Packages can choose to opt-out via setting PKG_BUILD_FLAGS:=no-lto
|
||||
|
||||
config MOLD
|
||||
depends on (aarch64 || arm || i386 || i686 || loongarch64 || m68k || powerpc || powerpc64 || riscv64 || sh4 || x86_64)
|
||||
depends on !HOST_OS_MACOS
|
||||
depends on (aarch64 || arm || i386 || i686 || m68k || powerpc || powerpc64 || sh4 || x86_64)
|
||||
depends on !GCC_USE_VERSION_11
|
||||
def_bool $(shell, ./config/check-hostcxx.sh 10 2 12)
|
||||
|
||||
config USE_MOLD
|
||||
@@ -358,11 +358,9 @@ menu "Global build settings"
|
||||
config PKG_FORTIFY_SOURCE_NONE
|
||||
bool "None"
|
||||
config PKG_FORTIFY_SOURCE_1
|
||||
bool "Conservative Level 1"
|
||||
bool "Conservative"
|
||||
config PKG_FORTIFY_SOURCE_2
|
||||
bool "Aggressive Level 2"
|
||||
config PKG_FORTIFY_SOURCE_3
|
||||
bool "Aggressive Level 3"
|
||||
bool "Aggressive"
|
||||
endchoice
|
||||
|
||||
choice
|
||||
@@ -383,19 +381,9 @@ menu "Global build settings"
|
||||
bool "Full"
|
||||
endchoice
|
||||
|
||||
config PKG_DT_RELR
|
||||
bool "Link with relative relocations (RELR)"
|
||||
depends on (aarch64 || i386 || loongarch64 || x86_64)
|
||||
default y
|
||||
help
|
||||
Link all applications with -Wl,-z,pack-relative-relocs.
|
||||
This will reduce the size of many applications.
|
||||
This is only supported on a limited number of architectures.
|
||||
|
||||
config TARGET_ROOTFS_SECURITY_LABELS
|
||||
bool
|
||||
select KERNEL_SQUASHFS_XATTR
|
||||
select KERNEL_EROFS_FS_SECURITY
|
||||
select KERNEL_EXT4_FS_SECURITY
|
||||
select KERNEL_F2FS_FS_SECURITY
|
||||
select KERNEL_UBIFS_FS_SECURITY
|
||||
@@ -435,10 +423,11 @@ menu "Global build settings"
|
||||
|
||||
endchoice
|
||||
|
||||
config USE_SECCOMP
|
||||
config SECCOMP
|
||||
bool "Enable SECCOMP"
|
||||
select KERNEL_SECCOMP
|
||||
depends on (aarch64 || arm || armeb || mips || mipsel || mips64 || mips64el || i386 || loongarch64 || powerpc || x86_64)
|
||||
select PACKAGE_procd-seccomp
|
||||
depends on (aarch64 || arm || armeb || mips || mipsel || mips64 || mips64el || i386 || powerpc || x86_64)
|
||||
depends on !TARGET_uml
|
||||
default y
|
||||
help
|
||||
|
||||
@@ -62,60 +62,6 @@ menuconfig DEVEL
|
||||
Compile all host host tools even if not needed. This is needed to prepare a
|
||||
universal precompiled host tools archive to use in another buildroot.
|
||||
|
||||
menuconfig OPTIMIZE_HOST_TOOLS
|
||||
bool "Host Tools compile options" if DEVEL
|
||||
|
||||
if OPTIMIZE_HOST_TOOLS
|
||||
|
||||
config HOST_FLAGS_OPT
|
||||
string "Host Tools optimization flags"
|
||||
default "-O2"
|
||||
help
|
||||
Compiler flags which are used to build host tools.
|
||||
|
||||
E.g.: "-O2", "-O3 -fno-tree-vectorize".
|
||||
|
||||
Default is "-O2".
|
||||
|
||||
config HOST_TOOLS_STRIP
|
||||
bool "Strip Host Tools"
|
||||
help
|
||||
Instructs compiler/linker to use flags from HOST_FLAGS_STRIP
|
||||
in order to reduce binary size of host tools.
|
||||
|
||||
config HOST_FLAGS_STRIP
|
||||
string "Host Tools compiler/linker flags for stripping symbols"
|
||||
depends on HOST_TOOLS_STRIP
|
||||
default "-Wl,-s"
|
||||
help
|
||||
Compiler flags which are used to strip symbols from host tools.
|
||||
|
||||
Each flag should be prefixed with "-Wl," string
|
||||
because compiler (GCC) passes this value to linker.
|
||||
|
||||
Default is "-Wl,-s" which means "strip all symbols" - specifically,
|
||||
debug symbols and other symbols not needed for relocation processing.
|
||||
|
||||
comment "Host Tools miscellaneous flags"
|
||||
|
||||
config HOST_EXTRA_CFLAGS
|
||||
string "Host Tools extra CFLAGS"
|
||||
default ""
|
||||
|
||||
config HOST_EXTRA_CXXFLAGS
|
||||
string "Host Tools extra CXXFLAGS"
|
||||
default ""
|
||||
|
||||
config HOST_EXTRA_CPPFLAGS
|
||||
string "Host Tools extra CPPFLAGS"
|
||||
default ""
|
||||
|
||||
config HOST_EXTRA_LDFLAGS
|
||||
string "Host Tools extra LDFLAGS"
|
||||
default ""
|
||||
|
||||
endif
|
||||
|
||||
config BUILD_SUFFIX
|
||||
string "Build suffix to append to the target BUILD_DIR variable" if DEVEL
|
||||
default ""
|
||||
|
||||
@@ -87,23 +87,6 @@ menu "Target Images"
|
||||
|
||||
comment "Root filesystem images"
|
||||
|
||||
menuconfig TARGET_ROOTFS_EROFS
|
||||
bool "erofs"
|
||||
default y if USES_EROFS
|
||||
select KERNEL_EROFS_FS
|
||||
help
|
||||
Build a EROFS root filesystem.
|
||||
|
||||
config TARGET_EROFS_PCLUSTER_SIZE
|
||||
int "physical cluster size (in KiB)"
|
||||
depends on TARGET_ROOTFS_EROFS
|
||||
default 64 if LOW_MEMORY_FOOTPRINT
|
||||
default 1024 if (SMALL_FLASH && !LOW_MEMORY_FOOTPRINT)
|
||||
default 256
|
||||
help
|
||||
Specify the EROFS physical cluster size (must be equal
|
||||
to or a multiple of the filesystem block size).
|
||||
|
||||
menuconfig TARGET_ROOTFS_EXT4FS
|
||||
bool "ext4"
|
||||
default y if USES_EXT4
|
||||
@@ -177,22 +160,6 @@ menu "Target Images"
|
||||
Select squashfs block size, must be one of:
|
||||
4, 8, 16, 32, 64, 128, 256, 512, 1024
|
||||
|
||||
config TARGET_SQUASHFS_BLOCK_READERS
|
||||
int "mksquashfs tool parallel block reader threads"
|
||||
depends on TARGET_ROOTFS_SQUASHFS
|
||||
default 4
|
||||
help
|
||||
Specify the number of parallel block reader threads
|
||||
(for files equal or larger than the squashfs block size).
|
||||
|
||||
config TARGET_SQUASHFS_SMALL_READERS
|
||||
int "mksquashfs tool parallel small file reader threads"
|
||||
depends on TARGET_ROOTFS_SQUASHFS
|
||||
default 4
|
||||
help
|
||||
Specify the number of parallel small file reader threads
|
||||
(for files less than the squashfs block size).
|
||||
|
||||
menuconfig TARGET_ROOTFS_UBIFS
|
||||
bool "ubifs"
|
||||
default y if USES_UBIFS
|
||||
@@ -231,7 +198,7 @@ menu "Target Images"
|
||||
config GRUB_IMAGES
|
||||
bool "Build GRUB images (Linux x86 or x86_64 host only)"
|
||||
depends on TARGET_x86
|
||||
depends on TARGET_ROOTFS_EXT4FS || TARGET_ROOTFS_JFFS2 || TARGET_ROOTFS_SQUASHFS || TARGET_ROOTFS_EROFS
|
||||
depends on TARGET_ROOTFS_EXT4FS || TARGET_ROOTFS_JFFS2 || TARGET_ROOTFS_SQUASHFS
|
||||
select PACKAGE_grub2
|
||||
select PACKAGE_grub2-bios-setup
|
||||
default y
|
||||
@@ -239,7 +206,7 @@ menu "Target Images"
|
||||
config GRUB_EFI_IMAGES
|
||||
bool "Build GRUB EFI images"
|
||||
depends on TARGET_x86 || TARGET_armsr || TARGET_loongarch64
|
||||
depends on TARGET_ROOTFS_EXT4FS || TARGET_ROOTFS_JFFS2 || TARGET_ROOTFS_SQUASHFS || TARGET_ROOTFS_EROFS
|
||||
depends on TARGET_ROOTFS_EXT4FS || TARGET_ROOTFS_JFFS2 || TARGET_ROOTFS_SQUASHFS
|
||||
select PACKAGE_grub2 if TARGET_x86
|
||||
select PACKAGE_grub2-efi if TARGET_x86
|
||||
select PACKAGE_grub2-bios-setup if TARGET_x86
|
||||
|
||||
@@ -53,7 +53,7 @@ config KERNEL_ARM_PMU
|
||||
config KERNEL_ARM_PMUV3
|
||||
bool
|
||||
default y if TARGET_armsr_armv8
|
||||
depends on (arm_v7 || aarch64)
|
||||
depends on (arm_v7 || aarch64) && LINUX_6_6
|
||||
|
||||
config KERNEL_RISCV_PMU
|
||||
bool
|
||||
@@ -84,7 +84,7 @@ config KERNEL_X86_VSYSCALL_EMULATION
|
||||
config KERNEL_PERF_EVENTS
|
||||
bool "Compile the kernel with performance events and counters"
|
||||
select KERNEL_ARM_PMU if (arm || aarch64)
|
||||
select KERNEL_ARM_PMUV3 if (arm_v7 || aarch64)
|
||||
select KERNEL_ARM_PMUV3 if (arm_v7 || aarch64) && LINUX_6_6
|
||||
select KERNEL_RISCV_PMU if riscv64
|
||||
|
||||
config KERNEL_PROFILING
|
||||
@@ -137,6 +137,13 @@ config KERNEL_UBSAN_BOUNDS
|
||||
{str,mem}*cpy() family of functions (that is addressed by
|
||||
FORTIFY_SOURCE).
|
||||
|
||||
config KERNEL_UBSAN_NULL
|
||||
bool "Enable checking of null pointers"
|
||||
depends on KERNEL_UBSAN
|
||||
help
|
||||
This option enables detection of memory accesses via a
|
||||
null pointer.
|
||||
|
||||
config KERNEL_UBSAN_TRAP
|
||||
bool "On Sanitizer warnings, abort the running kernel code"
|
||||
depends on KERNEL_UBSAN
|
||||
@@ -491,10 +498,16 @@ config KERNEL_FRAME_WARN
|
||||
# KConfig wont evaluate them unless KERNEL_EARLY_PRINTK is selected
|
||||
# which means that buildroot wont override the DEBUG_LL symbols in target
|
||||
# kernel configurations and lead to devices that dont have working console
|
||||
config KERNEL_DEBUG_LL_UART_NONE
|
||||
bool
|
||||
default n
|
||||
depends on arm
|
||||
|
||||
config KERNEL_DEBUG_LL
|
||||
bool
|
||||
default n
|
||||
depends on arm
|
||||
select KERNEL_DEBUG_LL_UART_NONE
|
||||
help
|
||||
ARM low level debugging.
|
||||
|
||||
@@ -554,7 +567,7 @@ config KERNEL_BPF_EVENTS
|
||||
|
||||
config KERNEL_PROBE_EVENTS_BTF_ARGS
|
||||
bool "Support BTF function arguments for probe events"
|
||||
depends on KERNEL_DEBUG_INFO_BTF && KERNEL_KPROBE_EVENTS
|
||||
depends on KERNEL_DEBUG_INFO_BTF && KERNEL_KPROBE_EVENTS && LINUX_6_6
|
||||
|
||||
config KERNEL_BPF_KPROBE_OVERRIDE
|
||||
bool
|
||||
@@ -594,19 +607,8 @@ choice
|
||||
|
||||
config KERNEL_TRANSPARENT_HUGEPAGE_MADVISE
|
||||
bool "madvise"
|
||||
|
||||
config KERNEL_TRANSPARENT_HUGEPAGE_NEVER
|
||||
bool "never"
|
||||
depends on !LINUX_6_6
|
||||
endchoice
|
||||
|
||||
config KERNEL_ARM64_CONTPTE
|
||||
bool "Compile the kernel with Contiguous PTE mappings for user memory"
|
||||
depends on KERNEL_ARM64
|
||||
depends on KERNEL_TRANSPARENT_HUGEPAGE
|
||||
depends on !LINUX_6_6
|
||||
default y
|
||||
|
||||
config KERNEL_HUGETLBFS
|
||||
bool
|
||||
|
||||
@@ -730,10 +732,10 @@ config KERNEL_SLUB_DEBUG_ON
|
||||
This enables by default sanity_checks, red_zone, poison and store_user
|
||||
debugging options for all caches.
|
||||
|
||||
config KERNEL_STACKDEPOT_MAX_FRAMES
|
||||
int
|
||||
default 64
|
||||
depends on KERNEL_SLUB_DEBUG
|
||||
config KERNEL_SLABINFO
|
||||
select KERNEL_SLUB_DEBUG
|
||||
select KERNEL_SLUB_DEBUG_ON
|
||||
bool "Enable /proc slab debug info"
|
||||
|
||||
config KERNEL_PROC_PAGE_MONITOR
|
||||
bool "Enable /proc page monitoring"
|
||||
@@ -859,18 +861,6 @@ if KERNEL_CGROUPS
|
||||
Memory Nodes and assigning tasks to run only within those sets.
|
||||
This is primarily useful on large SMP or NUMA systems.
|
||||
|
||||
config KERNEL_CPUSETS_V1
|
||||
bool "Legacy cgroup v1 cpusets controller"
|
||||
depends on KERNEL_CPUSETS
|
||||
depends on !LINUX_6_6
|
||||
default n
|
||||
help
|
||||
Legacy cgroup v1 cpusets controller which has been deprecated by
|
||||
cgroup v2 implementation. The v1 is there for legacy applications
|
||||
which haven't migrated to the new cgroup v2 interface yet. If you
|
||||
do not have any such application then you are completely fine leaving
|
||||
this option disabled.
|
||||
|
||||
config KERNEL_PROC_PID_CPUSET
|
||||
bool "Include legacy /proc/<pid>/cpuset file"
|
||||
depends on KERNEL_CPUSETS
|
||||
@@ -882,10 +872,22 @@ if KERNEL_CGROUPS
|
||||
Provides a simple Resource Controller for monitoring the
|
||||
total CPU consumed by the tasks in a cgroup.
|
||||
|
||||
config KERNEL_RESOURCE_COUNTERS
|
||||
bool "Resource counters"
|
||||
default y
|
||||
help
|
||||
This option enables controller independent resource accounting
|
||||
infrastructure that works with cgroups.
|
||||
|
||||
config KERNEL_MM_OWNER
|
||||
bool
|
||||
default y if KERNEL_MEMCG
|
||||
|
||||
config KERNEL_MEMCG
|
||||
bool "Memory Resource Controller for Control Groups"
|
||||
default y
|
||||
select KERNEL_FREEZER
|
||||
depends on KERNEL_RESOURCE_COUNTERS
|
||||
help
|
||||
Provides a memory resource controller that manages both anonymous
|
||||
memory and page cache. (See Documentation/cgroups/memory.txt)
|
||||
@@ -905,6 +907,40 @@ if KERNEL_CGROUPS
|
||||
This config option also selects MM_OWNER config option, which
|
||||
could in turn add some fork/exit overhead.
|
||||
|
||||
config KERNEL_MEMCG_SWAP
|
||||
bool "Memory Resource Controller Swap Extension"
|
||||
default y
|
||||
depends on KERNEL_MEMCG
|
||||
help
|
||||
Add swap management feature to memory resource controller. When you
|
||||
enable this, you can limit mem+swap usage per cgroup. In other words,
|
||||
when you disable this, memory resource controller has no cares to
|
||||
usage of swap...a process can exhaust all of the swap. This extension
|
||||
is useful when you want to avoid exhaustion swap but this itself
|
||||
adds more overheads and consumes memory for remembering information.
|
||||
Especially if you use 32bit system or small memory system, please
|
||||
be careful about enabling this. When memory resource controller
|
||||
is disabled by boot option, this will be automatically disabled and
|
||||
there will be no overhead from this. Even when you set this config=y,
|
||||
if boot option "swapaccount=0" is set, swap will not be accounted.
|
||||
Now, memory usage of swap_cgroup is 2 bytes per entry. If swap page
|
||||
size is 4096bytes, 512k per 1Gbytes of swap.
|
||||
|
||||
config KERNEL_MEMCG_SWAP_ENABLED
|
||||
bool "Memory Resource Controller Swap Extension enabled by default"
|
||||
depends on KERNEL_MEMCG_SWAP
|
||||
help
|
||||
Memory Resource Controller Swap Extension comes with its price in
|
||||
a bigger memory consumption. General purpose distribution kernels
|
||||
which want to enable the feature but keep it disabled by default
|
||||
and let the user enable it by swapaccount boot command line
|
||||
parameter should have this option unselected.
|
||||
|
||||
Those who want to have the feature enabled by default should
|
||||
select this option (if, for some reason, they need to disable it,
|
||||
then swapaccount=0 does the trick).
|
||||
|
||||
|
||||
config KERNEL_MEMCG_KMEM
|
||||
bool "Memory Resource Controller Kernel Memory accounting (EXPERIMENTAL)"
|
||||
default y
|
||||
@@ -916,22 +952,6 @@ if KERNEL_CGROUPS
|
||||
Memory Controller, which are page-based, and can be swapped. Users of
|
||||
the kmem extension can use it to guarantee that no group of processes
|
||||
will ever exhaust kernel resources alone.
|
||||
|
||||
config KERNEL_MEMCG_V1
|
||||
bool "Legacy cgroup v1 memory controller"
|
||||
default n
|
||||
depends on KERNEL_MEMCG
|
||||
depends on !LINUX_6_6
|
||||
help
|
||||
Legacy cgroup v1 memory controller which has been deprecated by
|
||||
cgroup v2 implementation. The v1 is there for legacy applications
|
||||
which haven't migrated to the new cgroup v2 interface yet. If you
|
||||
do not have any such application then you are completely fine leaving
|
||||
this option disabled.
|
||||
|
||||
Please note that feature set of the legacy memory controller is likely
|
||||
going to shrink due to deprecation process. New deployments with v1
|
||||
controller are highly discouraged.
|
||||
|
||||
config KERNEL_CGROUP_PERF
|
||||
bool "Enable perf_event per-cpu per-container group (cgroup) monitoring"
|
||||
@@ -1076,6 +1096,16 @@ if KERNEL_NAMESPACES
|
||||
|
||||
endif
|
||||
|
||||
config KERNEL_DEVPTS_MULTIPLE_INSTANCES
|
||||
bool "Support multiple instances of devpts"
|
||||
default y if !SMALL_FLASH
|
||||
help
|
||||
Enable support for multiple instances of devpts filesystem.
|
||||
If you want to have isolated PTY namespaces (eg: in containers),
|
||||
say Y here. Otherwise, say N. If enabled, each mount of devpts
|
||||
filesystem with the '-o newinstance' option will create an
|
||||
independent PTY namespace.
|
||||
|
||||
config KERNEL_POSIX_MQUEUE
|
||||
bool "POSIX Message Queues"
|
||||
default y if !SMALL_FLASH
|
||||
@@ -1182,28 +1212,6 @@ config KERNEL_NET_L3_MASTER_DEV
|
||||
drivers to support L3 master devices like VRF.
|
||||
Increases the compressed kernel size by ~4kB (as of Linux 6.6).
|
||||
|
||||
config KERNEL_DCB
|
||||
bool "Data Center Bridging support"
|
||||
default y if TARGET_armsr_armv8
|
||||
default y if TARGET_x86_64
|
||||
help
|
||||
This enables support for configuring Data Center Bridging (DCB)
|
||||
features on DCB capable Ethernet adapters via rtnetlink. Say 'Y'
|
||||
if you have a DCB capable Ethernet adapter which supports this
|
||||
interface and you are connected to a DCB capable switch.
|
||||
|
||||
DCB is a collection of Ethernet enhancements which allow DCB capable
|
||||
NICs and switches to support network traffic with differing
|
||||
requirements (highly reliable, no drops vs. best effort vs. low
|
||||
latency) to co-exist on Ethernet.
|
||||
|
||||
DCB features include:
|
||||
Enhanced Transmission Selection (aka Priority Grouping) - provides a
|
||||
framework for assigning bandwidth guarantees to traffic classes.
|
||||
Priority-based Flow Control (PFC) - a MAC control pause frame which
|
||||
works at the granularity of the 802.1p priority instead of the
|
||||
link (802.3x).
|
||||
|
||||
config KERNEL_XDP_SOCKETS
|
||||
bool "XDP sockets support"
|
||||
help
|
||||
@@ -1231,13 +1239,6 @@ config KERNEL_MPTCP_IPV6
|
||||
default KERNEL_MPTCP
|
||||
endif
|
||||
|
||||
config KERNEL_NF_CONNTRACK_TIMEOUT
|
||||
bool "Per-connection connection tracking timeout"
|
||||
default y if !SMALL_FLASH
|
||||
help
|
||||
Select this option to enable support for per-connection conntrack timeouts.
|
||||
Increases the (uncompressed) size of nf_conntrack.ko by ~8kB.
|
||||
|
||||
#
|
||||
# NFS related symbols
|
||||
#
|
||||
@@ -1278,23 +1279,6 @@ config KERNEL_BTRFS_FS
|
||||
Say Y here if you want to make the kernel to be able to boot off a
|
||||
BTRFS partition.
|
||||
|
||||
config KERNEL_EROFS_FS
|
||||
bool "Compile the kernel with built-in EROFS support"
|
||||
help
|
||||
Say Y here if you want to make the kernel to be able to boot off a
|
||||
EROFS partition.
|
||||
|
||||
config KERNEL_EROFS_FS_XATTR
|
||||
bool "EROFS XATTR support"
|
||||
|
||||
config KERNEL_EROFS_FS_ZIP
|
||||
bool
|
||||
default y if KERNEL_EROFS_FS
|
||||
|
||||
config KERNEL_EROFS_FS_ZIP_LZMA
|
||||
bool
|
||||
default y if KERNEL_EROFS_FS
|
||||
|
||||
menu "Filesystem ACL and attr support options"
|
||||
config USE_FS_ACL_ATTR
|
||||
bool "Use filesystem ACL and attr support by default"
|
||||
@@ -1315,11 +1299,6 @@ menu "Filesystem ACL and attr support options"
|
||||
select KERNEL_FS_POSIX_ACL
|
||||
default y if USE_FS_ACL_ATTR
|
||||
|
||||
config KERNEL_EROFS_FS_POSIX_ACL
|
||||
bool "Enable POSIX ACL for EROFS Filesystems"
|
||||
select KERNEL_FS_POSIX_ACL
|
||||
default y if USE_FS_ACL_ATTR
|
||||
|
||||
config KERNEL_EXT4_FS_POSIX_ACL
|
||||
bool "Enable POSIX ACL for Ext4 Filesystems"
|
||||
select KERNEL_FS_POSIX_ACL
|
||||
@@ -1392,6 +1371,13 @@ config KERNEL_DEVMEM
|
||||
The /dev/mem device is used to access areas of physical
|
||||
memory.
|
||||
|
||||
config KERNEL_DEVKMEM
|
||||
bool "/dev/kmem virtual device support"
|
||||
help
|
||||
Say Y here if you want to support the /dev/kmem device. The
|
||||
/dev/kmem device is rarely used, but can be used for certain
|
||||
kind of kernel debugging operations.
|
||||
|
||||
config KERNEL_SQUASHFS_FRAGMENT_CACHE_SIZE
|
||||
int "Number of squashfs fragments cached"
|
||||
default 2 if (SMALL_FLASH && !LOW_MEMORY_FOOTPRINT)
|
||||
@@ -1442,6 +1428,10 @@ config KERNEL_SECURITY_SELINUX_BOOTPARAM
|
||||
depends on KERNEL_SECURITY_SELINUX
|
||||
default y
|
||||
|
||||
config KERNEL_SECURITY_SELINUX_DISABLE
|
||||
bool "NSA SELinux runtime disable"
|
||||
depends on KERNEL_SECURITY_SELINUX
|
||||
|
||||
config KERNEL_SECURITY_SELINUX_DEVELOP
|
||||
bool "NSA SELinux Development Support"
|
||||
depends on KERNEL_SECURITY_SELINUX
|
||||
@@ -1462,11 +1452,6 @@ config KERNEL_LSM
|
||||
default "lockdown,yama,loadpin,safesetid,integrity,selinux"
|
||||
depends on KERNEL_SECURITY_SELINUX
|
||||
|
||||
config KERNEL_EROFS_FS_SECURITY
|
||||
bool "EROFS Security Labels"
|
||||
default y if !SMALL_FLASH
|
||||
select KERNEL_EROFS_FS_XATTR
|
||||
|
||||
config KERNEL_EXT4_FS_SECURITY
|
||||
bool "Ext4 Security Labels"
|
||||
default y if !SMALL_FLASH
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
src-git packages https://git.openwrt.org/feed/packages.git
|
||||
src-git luci https://git.openwrt.org/project/luci.git
|
||||
src-git routing https://git.openwrt.org/feed/routing.git
|
||||
src-git telephony https://git.openwrt.org/feed/telephony.git
|
||||
src-git video https://github.com/openwrt/video.git
|
||||
#src-git targets https://github.com/openwrt/targets.git
|
||||
#src-git oldpackages http://git.openwrt.org/packages.git
|
||||
#src-link custom /usr/src/openwrt/custom-feed
|
||||
src-git packages https://git.openwrt.org/feed/packages.git^b5f11b79d2b0538d57103a8da05e7a7a87981ff3
|
||||
src-git luci https://git.openwrt.org/project/luci.git^e76155d09484602e2b02e84bb8ffafa4848798f0
|
||||
src-git routing https://git.openwrt.org/feed/routing.git^3f15699240c076d5ee9ed697fa5ef45355423f6f
|
||||
src-git telephony https://git.openwrt.org/feed/telephony.git^fd605af7143165a2490681ec1752f259873b9147
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -97,7 +97,7 @@ define Build/Configure/Default
|
||||
-DCMAKE_SYSTEM_NAME=Linux \
|
||||
-DCMAKE_SYSTEM_VERSION=1 \
|
||||
-DCMAKE_SYSTEM_PROCESSOR=$(ARCH) \
|
||||
-DCMAKE_BUILD_TYPE=$(if $(CONFIG_DEBUG),RelWithDebInfo,Release) \
|
||||
-DCMAKE_BUILD_TYPE=$(if $(CONFIG_DEBUG),Debug,Release) \
|
||||
-DCMAKE_C_FLAGS_RELEASE="-DNDEBUG" \
|
||||
-DCMAKE_CXX_FLAGS_RELEASE="-DNDEBUG" \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER="$(CMAKE_C_COMPILER_LAUNCHER)" \
|
||||
@@ -113,7 +113,7 @@ define Build/Configure/Default
|
||||
-DCMAKE_NM="$(CMAKE_NM)" \
|
||||
-DCMAKE_RANLIB="$(CMAKE_RANLIB)" \
|
||||
-DCMAKE_FIND_ROOT_PATH="$(CMAKE_FIND_ROOT_PATH)" \
|
||||
-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER \
|
||||
-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=BOTH \
|
||||
-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \
|
||||
-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY \
|
||||
-DCMAKE_STRIP=: \
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
ifneq ($(CONFIG_USE_APK),)
|
||||
DEFAULT_PACKAGES += apk-mbedtls
|
||||
else
|
||||
DEFAULT_PACKAGES += opkg
|
||||
endif
|
||||
@@ -154,17 +154,7 @@ endef
|
||||
# $(2): "PKG_" if <name> as in Download/<name> is "default", otherwise "Download/<name>:"
|
||||
# $(3): shell command sequence to do the download
|
||||
define wrap_mirror
|
||||
$(if $(if $(MIRROR), \
|
||||
$(filter-out x,$(MIRROR_HASH))),$(SCRIPT_DIR)/download.pl "$(DL_DIR)" "$(FILE)" "$(MIRROR_HASH)" "" || \
|
||||
( $(3) ) \
|
||||
$(if $(filter-out x,$(MIRROR_HASH)), && ( \
|
||||
file_hash="$$$$($(MKHASH) sha256 "$(DL_DIR)/$(FILE)")"; \
|
||||
[ "$$$$file_hash" = "$(MIRROR_HASH)" ] || [ "$(MIRROR_HASH)" = "skip" ] || { \
|
||||
echo "Hash mismatch for file $(FILE): expected $(MIRROR_HASH), got $$$$file_hash"; \
|
||||
false; \
|
||||
}; \
|
||||
)),
|
||||
$(3)) \
|
||||
$(if $(if $(MIRROR),$(filter-out x,$(MIRROR_HASH))),$(SCRIPT_DIR)/download.pl "$(DL_DIR)" "$(FILE)" "$(MIRROR_HASH)" "" || ( $(3) ),$(3)) \
|
||||
$(if $(filter check,$(1)), \
|
||||
$(call check_hash,$(FILE),$(MIRROR_HASH),$(2)MIRROR_$(call hash_var,$(MIRROR_MD5SUM))) \
|
||||
$(call check_md5,$(MIRROR_MD5SUM),$(2)MIRROR_MD5SUM,$(2)MIRROR_HASH) \
|
||||
@@ -238,13 +228,11 @@ define DownloadMethod/rawgit
|
||||
[ \! -d $(SUBDIR) ] && \
|
||||
git clone $(OPTS) $(URL) $(SUBDIR) && \
|
||||
(cd $(SUBDIR) && git checkout $(SOURCE_VERSION)) && \
|
||||
export TAR_TIMESTAMP=`cd $(SUBDIR) && git log -1 --no-show-signature --format='@%ct'` && \
|
||||
export TAR_TIMESTAMP=`cd $(SUBDIR) && git log -1 --format='@%ct'` && \
|
||||
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) && \
|
||||
|
||||
@@ -20,7 +20,7 @@ opkg_package_files = $(wildcard \
|
||||
|
||||
apk_package_files = $(wildcard \
|
||||
$(foreach dir,$(PACKAGE_SUBDIRS), \
|
||||
$(foreach pkg,$(1), $(dir)/$(pkg)-*.apk)))
|
||||
$(foreach pkg,$(1), $(dir)/$(pkg)_*.apk)))
|
||||
|
||||
# 1: package name
|
||||
define FeedPackageDir
|
||||
|
||||
@@ -8,7 +8,6 @@ PKG_ASLR_PIE_REGULAR ?= 0
|
||||
PKG_SSP ?= 1
|
||||
PKG_FORTIFY_SOURCE ?= 1
|
||||
PKG_RELRO ?= 1
|
||||
PKG_DT_RELR ?= 1
|
||||
|
||||
ifdef CONFIG_PKG_CHECK_FORMAT_SECURITY
|
||||
ifeq ($(strip $(PKG_CHECK_FORMAT_SECURITY)),1)
|
||||
@@ -52,11 +51,6 @@ ifdef CONFIG_PKG_FORTIFY_SOURCE_2
|
||||
TARGET_CFLAGS += -D_FORTIFY_SOURCE=2
|
||||
endif
|
||||
endif
|
||||
ifdef CONFIG_PKG_FORTIFY_SOURCE_3
|
||||
ifeq ($(strip $(PKG_FORTIFY_SOURCE)),1)
|
||||
TARGET_CFLAGS += -D_FORTIFY_SOURCE=3
|
||||
endif
|
||||
endif
|
||||
ifdef CONFIG_PKG_RELRO_PARTIAL
|
||||
ifeq ($(strip $(PKG_RELRO)),1)
|
||||
TARGET_CFLAGS += -Wl,-z,relro
|
||||
@@ -70,10 +64,3 @@ ifdef CONFIG_PKG_RELRO_FULL
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef CONFIG_PKG_DT_RELR
|
||||
ifeq ($(strip $(PKG_DT_RELR)),1)
|
||||
TARGET_CFLAGS += -Wl,-z,pack-relative-relocs
|
||||
TARGET_LDFLAGS += -zpack-relative-relocs
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
@@ -99,64 +99,6 @@ define Build/append-metadata
|
||||
}
|
||||
endef
|
||||
|
||||
metadata_gl_json = \
|
||||
'{ $(if $(IMAGE_METADATA),$(IMAGE_METADATA)$(comma)) \
|
||||
"metadata_version": "1.1", \
|
||||
"compat_version": "$(call json_quote,$(compat_version))", \
|
||||
$(if $(DEVICE_COMPAT_MESSAGE),"compat_message": "$(call json_quote,$(DEVICE_COMPAT_MESSAGE))"$(comma)) \
|
||||
$(if $(filter-out 1.0,$(compat_version)),"new_supported_devices": \
|
||||
[$(call metadata_devices,$(SUPPORTED_DEVICES))]$(comma) \
|
||||
"supported_devices": ["$(call json_quote,$(legacy_supported_message))"]$(comma)) \
|
||||
$(if $(filter 1.0,$(compat_version)),"supported_devices":[$(call metadata_devices,$(SUPPORTED_DEVICES))]$(comma)) \
|
||||
"version": { \
|
||||
"release": "$(call json_quote,$(VERSION_NUMBER))", \
|
||||
"date": "$(shell TZ='Asia/Chongqing' date '+%Y%m%d%H%M%S')", \
|
||||
"dist": "$(call json_quote,$(VERSION_DIST))", \
|
||||
"version": "$(call json_quote,$(VERSION_NUMBER))", \
|
||||
"revision": "$(call json_quote,$(REVISION))", \
|
||||
"target": "$(call json_quote,$(TARGETID))", \
|
||||
"board": "$(call json_quote,$(if $(BOARD_NAME),$(BOARD_NAME),$(DEVICE_NAME)))" \
|
||||
} \
|
||||
}'
|
||||
|
||||
define Build/append-gl-metadata
|
||||
$(if $(SUPPORTED_DEVICES),-echo $(call metadata_gl_json,$(SUPPORTED_DEVICES)) | fwtool -I - $@)
|
||||
sha256sum "$@" | cut -d" " -f1 > "$@.sha256sum"
|
||||
[ ! -s "$(BUILD_KEY)" -o ! -s "$(BUILD_KEY).ucert" -o ! -s "$@" ] || { \
|
||||
cp "$(BUILD_KEY).ucert" "$@.ucert" ;\
|
||||
usign -S -m "$@" -s "$(BUILD_KEY)" -x "$@.sig" ;\
|
||||
ucert -A -c "$@.ucert" -x "$@.sig" ;\
|
||||
fwtool -S "$@.ucert" "$@" ;\
|
||||
}
|
||||
endef
|
||||
|
||||
define Build/append-teltonika-metadata
|
||||
echo \
|
||||
'{$(if $(IMAGE_METADATA),$(IMAGE_METADATA)$(comma)) \
|
||||
"metadata_version": "1.1", \
|
||||
"compat_version": "$(call json_quote,$(compat_version))", \
|
||||
"version":"$(call json_quote,$(VERSION_DIST))-$(call json_quote,$(VERSION_NUMBER))-$(call json_quote,$(REVISION))", \
|
||||
"device_code": [".*"], \
|
||||
"hwver": [".*"], \
|
||||
"batch": [".*"], \
|
||||
"serial": [".*"], \
|
||||
$(if $(DEVICE_COMPAT_MESSAGE),"compat_message": "$(call json_quote,$(DEVICE_COMPAT_MESSAGE))"$(comma)) \
|
||||
$(if $(filter-out 1.0,$(compat_version)),"new_supported_devices": \
|
||||
[$(call metadata_devices,$(SUPPORTED_TELTONIKA_DEVICES))]$(comma) \
|
||||
"supported_devices": ["$(call json_quote,$(legacy_supported_message))"]$(comma)) \
|
||||
$(if $(filter 1.0,$(compat_version)),"supported_devices":[$(call metadata_devices,$(SUPPORTED_TELTONIKA_DEVICES))]$(comma)) \
|
||||
"version_wrt": { \
|
||||
"dist": "$(call json_quote,$(VERSION_DIST))", \
|
||||
"version": "$(call json_quote,$(VERSION_NUMBER))", \
|
||||
"revision": "$(call json_quote,$(REVISION))", \
|
||||
"target": "$(call json_quote,$(TARGETID))", \
|
||||
"board": "$(call json_quote,$(if $(BOARD_NAME),$(BOARD_NAME),$(DEVICE_NAME)))" \
|
||||
}, \
|
||||
"hw_support": {}, \
|
||||
"hw_mods": {$(shell i=1; for mod in $(SUPPORTED_TELTONIKA_HW_MODS); do [ $$i -gt 1 ] && echo -n ,; echo -n "\"mod$$i\": \"$$mod\""; i=$$((i+1)); done)} \
|
||||
}' | fwtool -I - $@
|
||||
endef
|
||||
|
||||
define Build/append-rootfs
|
||||
dd if=$(IMAGE_ROOTFS) >> $@
|
||||
endef
|
||||
@@ -431,10 +373,7 @@ define Build/initrd_compression
|
||||
endef
|
||||
|
||||
define Build/fit
|
||||
$(if $(findstring with-rootfs,$(word 3,$(1))), \
|
||||
$(call locked,dd if=$(IMAGE_ROOTFS) of=$(IMAGE_ROOTFS).pagesync bs=4096 conv=sync, \
|
||||
gen-cpio$(if $(TARGET_PER_DEVICE_ROOTFS),.$(ROOTFS_ID/$(DEVICE_NAME)))))
|
||||
$(TOPDIR)/scripts/mkits.sh \
|
||||
$(call locked,$(TOPDIR)/scripts/mkits.sh \
|
||||
-D $(DEVICE_NAME) -o $@.its -k $@ \
|
||||
-C $(word 1,$(1)) \
|
||||
$(if $(word 2,$(1)),\
|
||||
@@ -451,10 +390,9 @@ define Build/fit
|
||||
$(if $(DEVICE_DTS_LOADADDR),-s $(DEVICE_DTS_LOADADDR)) \
|
||||
$(if $(DEVICE_DTS_OVERLAY),$(foreach dtso,$(DEVICE_DTS_OVERLAY), -O $(dtso):$(KERNEL_BUILD_DIR)/image-$(dtso).dtbo)) \
|
||||
-c $(if $(DEVICE_DTS_CONFIG),$(DEVICE_DTS_CONFIG),"config-1") \
|
||||
-A $(LINUX_KARCH) -v $(LINUX_VERSION)
|
||||
$(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))))
|
||||
-A $(LINUX_KARCH) -v $(LINUX_VERSION), 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
|
||||
|
||||
@@ -500,14 +438,13 @@ endef
|
||||
|
||||
define Build/jffs2
|
||||
rm -rf $(KDIR_TMP)/$(DEVICE_NAME)/jffs2 && \
|
||||
mkdir -p $(KDIR_TMP)/$(DEVICE_NAME)/jffs2/$$(dirname $(word 1,$(1))) && \
|
||||
cp $@ $(KDIR_TMP)/$(DEVICE_NAME)/jffs2/$(word 1,$(1)) && \
|
||||
mkdir -p $(KDIR_TMP)/$(DEVICE_NAME)/jffs2/$$(dirname $(1)) && \
|
||||
cp $@ $(KDIR_TMP)/$(DEVICE_NAME)/jffs2/$(1) && \
|
||||
$(STAGING_DIR_HOST)/bin/mkfs.jffs2 --pad \
|
||||
$(if $(CONFIG_BIG_ENDIAN),--big-endian,--little-endian) \
|
||||
--squash-uids -v -e $(patsubst %k,%KiB,$(BLOCKSIZE)) \
|
||||
-o $@.new \
|
||||
-d $(KDIR_TMP)/$(DEVICE_NAME)/jffs2 \
|
||||
$(wordlist 2,$(words $(1)),$(1)) \
|
||||
2>&1 1>/dev/null | awk '/^.+$$$$/' && \
|
||||
$(STAGING_DIR_HOST)/bin/padjffs2 $@.new -J $(patsubst %k,,$(BLOCKSIZE))
|
||||
-rm -rf $(KDIR_TMP)/$(DEVICE_NAME)/jffs2/
|
||||
@@ -523,7 +460,7 @@ define Build/yaffs-filesystem
|
||||
filesystem_size="filesystem_blocks * 64 * 1024" \
|
||||
filesystem_size_with_reserve="(filesystem_blocks + 2) * 64 * 1024"; \
|
||||
head -c $$filesystem_size_with_reserve /dev/zero | tr "\000" "\377" > $@.img \
|
||||
&& yafut -d $@.img -w -i $@ -o $(if $(findstring v7,$@),bootimage,kernel) -C 1040 -B 64k -E -P -S $(1) \
|
||||
&& yafut -d $@.img -w -i $@ -o kernel -C 1040 -B 64k -E -P -S $(1) \
|
||||
&& truncate -s $$filesystem_size $@.img \
|
||||
&& mv $@.img $@
|
||||
endef
|
||||
@@ -533,39 +470,6 @@ define Build/kernel-bin
|
||||
cp $< $@
|
||||
endef
|
||||
|
||||
define Build/gl-qsdk-factory
|
||||
$(eval GL_NAME := $(call param_get_default,type,$(1),$(DEVICE_NAME)))
|
||||
$(eval GL_IMGK := $(KDIR_TMP)/$(DEVICE_IMG_PREFIX)-squashfs-factory.img)
|
||||
$(eval GL_ITS := $(KDIR_TMP)/$(GL_NAME).its)
|
||||
$(eval GL_UBI := "ubi")
|
||||
|
||||
$(CP) $(BOOT_SCRIPT) $(KDIR_TMP)/
|
||||
$(shell mv $(GL_IMGK) $(GL_IMGK).tmp)
|
||||
|
||||
sed -i "s/rootfs_size/`wc -c $(GL_IMGK) | \
|
||||
cut -d " " -f 1 | xargs printf "0x%x"`/g" $(KDIR_TMP)/$(BOOT_SCRIPT);
|
||||
|
||||
$(TOPDIR)/scripts/mkits-qsdk-ipq-image.sh \
|
||||
$(GL_ITS) \
|
||||
$(BOOT_SCRIPT) \
|
||||
$(GL_UBI) \
|
||||
$(GL_IMGK)
|
||||
|
||||
PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f \
|
||||
$(GL_ITS) \
|
||||
$(GL_IMGK)
|
||||
|
||||
$(RM) \
|
||||
$(GL_ITS) \
|
||||
$(GL_IMGK).tmp \
|
||||
$(KDIR_TMP)/$(notdir $(BOOT_SCRIPT))
|
||||
endef
|
||||
|
||||
define Build/kernel-pack-npk
|
||||
$(STAGING_DIR_HOST)/bin/npk_pack_kernel $@ $@.npk
|
||||
mv $@.npk $@
|
||||
endef
|
||||
|
||||
define Build/linksys-image
|
||||
let \
|
||||
size="$$(stat -c%s $@)" \
|
||||
@@ -644,19 +548,6 @@ define Build/openmesh-image
|
||||
"$(call param_get_default,rootfs,$(1),$@)" "rootfs"
|
||||
endef
|
||||
|
||||
define Build/dualboot-datachk-nand-image
|
||||
$(TOPDIR)/scripts/nand-fwupgradecfg-gen.sh \
|
||||
"$(call param_get_default,ce_type,$(1),$(DEVICE_NAME))" \
|
||||
"$@-fwupgrade.cfg" \
|
||||
"$(call param_get_default,kernel,$(1),$(IMAGE_KERNEL))" \
|
||||
"$(call param_get_default,rootfs,$(1),$@)"
|
||||
$(TOPDIR)/scripts/combined-ext-image.sh \
|
||||
"$(call param_get_default,ce_type,$(1),$(DEVICE_NAME))" "$@" \
|
||||
"$@-fwupgrade.cfg" "fwupgrade.cfg" \
|
||||
"$(call param_get_default,kernel,$(1),$(IMAGE_KERNEL))" "kernel" \
|
||||
"$(call param_get_default,rootfs,$(1),$@)" "rootfs"
|
||||
endef
|
||||
|
||||
define Build/pad-extra
|
||||
dd if=/dev/zero bs=$(1) count=1 >> $@
|
||||
endef
|
||||
@@ -728,23 +619,13 @@ define Build/senao-header
|
||||
endef
|
||||
|
||||
define Build/sysupgrade-tar
|
||||
$(eval dtb=$(call param_get,dtb,$(1)))
|
||||
sh $(TOPDIR)/scripts/sysupgrade-tar.sh \
|
||||
--board $(if $(BOARD_NAME),$(BOARD_NAME),$(DEVICE_NAME)) \
|
||||
--kernel $(call param_get_default,kernel,$(1),$(IMAGE_KERNEL)) \
|
||||
--rootfs $(call param_get_default,rootfs,$(1),$(IMAGE_ROOTFS)) \
|
||||
$(if $(dtb),--dtb $(dtb)) \
|
||||
$@
|
||||
endef
|
||||
|
||||
define Build/tplink-image-2022
|
||||
$(TOPDIR)/scripts/tplink-mkimage-2022.py \
|
||||
--create $@.new \
|
||||
--rootfs $@ \
|
||||
--support "$(TPLINK_SUPPORT_STRING)"
|
||||
@mv $@.new $@
|
||||
endef
|
||||
|
||||
define Build/tplink-safeloader
|
||||
-$(STAGING_DIR_HOST)/bin/tplink-safeloader \
|
||||
-B $(TPLINK_BOARD_ID) \
|
||||
@@ -851,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))"; \
|
||||
|
||||
@@ -86,8 +86,6 @@ SQUASHFS_BLOCKSIZE := $(CONFIG_TARGET_SQUASHFS_BLOCK_SIZE)k
|
||||
SQUASHFSOPT := -b $(SQUASHFS_BLOCKSIZE)
|
||||
SQUASHFSOPT += -p '/dev d 755 0 0' -p '/dev/console c 600 0 0 5 1'
|
||||
SQUASHFSOPT += $(if $(CONFIG_SELINUX),-xattrs,-no-xattrs)
|
||||
SQUASHFSOPT += -block-readers $(CONFIG_TARGET_SQUASHFS_BLOCK_READERS)
|
||||
SQUASHFSOPT += -small-readers $(CONFIG_TARGET_SQUASHFS_SMALL_READERS)
|
||||
SQUASHFSCOMP := gzip
|
||||
LZMA_XZ_OPTIONS := -Xpreset 9 -Xe -Xlc 0 -Xlp 2 -Xpb 2
|
||||
ifeq ($(CONFIG_SQUASHFS_XZ),y)
|
||||
@@ -99,21 +97,11 @@ endif
|
||||
|
||||
JFFS2_BLOCKSIZE ?= 64k 128k
|
||||
|
||||
EROFS_PCLUSTERSIZE = $(shell echo $$(($(CONFIG_TARGET_EROFS_PCLUSTER_SIZE)*1024)))
|
||||
EROFSOPT := -Efragments,dedupe,ztailpacking -Uclear --all-root
|
||||
EROFSOPT += $(if $(SOURCE_DATE_EPOCH),-T$(SOURCE_DATE_EPOCH) --ignore-mtime)
|
||||
EROFSOPT += $(if $(CONFIG_SELINUX),,-x-1)
|
||||
EROFSCOMP := lz4hc,12
|
||||
ifeq ($(CONFIG_EROFS_FS_ZIP_LZMA),y)
|
||||
EROFSCOMP := lzma,109
|
||||
endif
|
||||
|
||||
fs-types-$(CONFIG_TARGET_ROOTFS_SQUASHFS) += squashfs
|
||||
fs-types-$(CONFIG_TARGET_ROOTFS_JFFS2) += $(addprefix jffs2-,$(JFFS2_BLOCKSIZE))
|
||||
fs-types-$(CONFIG_TARGET_ROOTFS_JFFS2_NAND) += $(addprefix jffs2-nand-,$(NAND_BLOCKSIZE))
|
||||
fs-types-$(CONFIG_TARGET_ROOTFS_EXT4FS) += ext4
|
||||
fs-types-$(CONFIG_TARGET_ROOTFS_UBIFS) += ubifs
|
||||
fs-types-$(CONFIG_TARGET_ROOTFS_EROFS) += erofs
|
||||
fs-subtypes-$(CONFIG_TARGET_ROOTFS_JFFS2) += $(addsuffix -raw,$(addprefix jffs2-,$(JFFS2_BLOCKSIZE)))
|
||||
|
||||
TARGET_FILESYSTEMS := $(fs-types-y)
|
||||
@@ -319,17 +307,10 @@ define Image/mkfs/ext4
|
||||
$@ $(call mkfs_target_dir,$(1))/
|
||||
endef
|
||||
|
||||
# Don't use the mkfs.erofs builtin $SOURCE_DATE_EPOCH behavior
|
||||
define Image/mkfs/erofs
|
||||
env -u SOURCE_DATE_EPOCH $(STAGING_DIR_HOST)/bin/mkfs.erofs -z$(EROFSCOMP) \
|
||||
-C$(EROFS_PCLUSTERSIZE) $(EROFSOPT) \
|
||||
$@ $(call mkfs_target_dir,$(1))
|
||||
endef
|
||||
|
||||
define Image/Manifest
|
||||
$(if $(CONFIG_USE_APK), \
|
||||
$(call apk,$(TARGET_DIR_ORIG)) list --quiet --manifest --no-network \
|
||||
--repositories-file /dev/null | sort | sed 's/ / - /' > \
|
||||
--repositories-file /dev/zero | sort | sed 's/ / - /' > \
|
||||
$(BIN_DIR)/$(IMG_PREFIX)$(if $(PROFILE_SANITIZED),-$(PROFILE_SANITIZED)).manifest, \
|
||||
$(call opkg,$(TARGET_DIR_ORIG)) list-installed > \
|
||||
$(BIN_DIR)/$(IMG_PREFIX)$(if $(PROFILE_SANITIZED),-$(PROFILE_SANITIZED)).manifest \
|
||||
@@ -384,17 +365,19 @@ opkg_target = \
|
||||
|
||||
apk_target = \
|
||||
$(call apk,$(mkfs_cur_target_dir)) --no-scripts \
|
||||
--repositories-file /dev/null --repository file://$(PACKAGE_DIR_ALL)/packages.adb
|
||||
--repositories-file /dev/zero --repository file://$(PACKAGE_DIR_ALL)/packages.adb
|
||||
|
||||
|
||||
target-dir-%: FORCE
|
||||
ifneq ($(CONFIG_USE_APK),)
|
||||
rm -rf $(mkfs_cur_target_dir)
|
||||
$(CP) $(TARGET_DIR_ORIG) $(mkfs_cur_target_dir)
|
||||
mv $(mkfs_cur_target_dir)/etc/apk/repositories $(mkfs_cur_target_dir).repositories
|
||||
$(if $(mkfs_packages_remove), \
|
||||
-$(apk_target) del $(mkfs_packages_remove))
|
||||
$(apk_target) del $(mkfs_packages_remove))
|
||||
$(if $(mkfs_packages_add), \
|
||||
$(apk_target) add $(mkfs_packages_add))
|
||||
mv $(mkfs_cur_target_dir).repositories $(mkfs_cur_target_dir)/etc/apk/repositories
|
||||
else
|
||||
rm -rf $(mkfs_cur_target_dir) $(mkfs_cur_target_dir).opkg
|
||||
$(CP) $(TARGET_DIR_ORIG) $(mkfs_cur_target_dir)
|
||||
@@ -586,15 +569,7 @@ 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))))
|
||||
ROOTFS_ID/$(1) := $$(if $$(_PROFILE_SET),$$(call mkfs_packages_id,$$(_PACKAGES)))
|
||||
@@ -674,8 +649,6 @@ define Device/Build/initramfs
|
||||
VERSION_NUMBER="$(VERSION_NUMBER)" \
|
||||
VERSION_CODE="$(VERSION_CODE)" \
|
||||
SUPPORTED_DEVICES="$$(SUPPORTED_DEVICES)" \
|
||||
KERNEL_SIZE="$$(KERNEL_SIZE)" \
|
||||
IMAGE_SIZE="$$(IMAGE_SIZE)" \
|
||||
$(TOPDIR)/scripts/json_add_image_info.py $$@
|
||||
endef
|
||||
endif
|
||||
@@ -810,8 +783,6 @@ define Device/Build/image
|
||||
VERSION_NUMBER="$(VERSION_NUMBER)" \
|
||||
VERSION_CODE="$(VERSION_CODE)" \
|
||||
SUPPORTED_DEVICES="$(SUPPORTED_DEVICES)" \
|
||||
KERNEL_SIZE="$(KERNEL_SIZE)" \
|
||||
IMAGE_SIZE="$(IMAGE_SIZE)" \
|
||||
$(TOPDIR)/scripts/json_add_image_info.py $$@
|
||||
|
||||
endef
|
||||
@@ -866,8 +837,6 @@ define Device/Build/artifact
|
||||
VERSION_NUMBER="$(VERSION_NUMBER)" \
|
||||
VERSION_CODE="$(VERSION_CODE)" \
|
||||
SUPPORTED_DEVICES="$(SUPPORTED_DEVICES)" \
|
||||
KERNEL_SIZE="$(KERNEL_SIZE)" \
|
||||
IMAGE_SIZE="$(IMAGE_SIZE)" \
|
||||
$(TOPDIR)/scripts/json_add_image_info.py $$@
|
||||
|
||||
endef
|
||||
|
||||
2
include/kernel-6.6
Normal file
2
include/kernel-6.6
Normal file
@@ -0,0 +1,2 @@
|
||||
LINUX_VERSION-6.6 = .63
|
||||
LINUX_KERNEL_HASH-6.6.63 = d1054ab4803413efe2850f50f1a84349c091631ec50a1cf9e891d1b1f9061835
|
||||
@@ -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)), \
|
||||
|
||||
@@ -6,7 +6,7 @@ ifdef CONFIG_TESTING_KERNEL
|
||||
KERNEL_PATCHVER:=$(KERNEL_TESTING_PATCHVER)
|
||||
endif
|
||||
|
||||
KERNEL_DETAILS_FILE=$(GENERIC_PLATFORM_DIR)/kernel-$(KERNEL_PATCHVER)
|
||||
KERNEL_DETAILS_FILE=$(INCLUDE_DIR)/kernel-$(KERNEL_PATCHVER)
|
||||
ifeq ($(wildcard $(KERNEL_DETAILS_FILE)),)
|
||||
$(error Missing kernel version/hash file for $(KERNEL_PATCHVER). Please create $(KERNEL_DETAILS_FILE))
|
||||
endif
|
||||
@@ -14,7 +14,7 @@ endif
|
||||
include $(KERNEL_DETAILS_FILE)
|
||||
|
||||
ifdef KERNEL_TESTING_PATCHVER
|
||||
KERNEL_TESTING_DETAILS_FILE=$(GENERIC_PLATFORM_DIR)/kernel-$(KERNEL_TESTING_PATCHVER)
|
||||
KERNEL_TESTING_DETAILS_FILE=$(INCLUDE_DIR)/kernel-$(KERNEL_TESTING_PATCHVER)
|
||||
ifeq ($(wildcard $(KERNEL_TESTING_DETAILS_FILE)),)
|
||||
$(error Missing kernel version/hash file for $(KERNEL_TESTING_PATCHVER). Please create $(KERNEL_TESTING_DETAILS_FILE))
|
||||
endif
|
||||
|
||||
@@ -55,14 +55,8 @@ else
|
||||
MESON_CPU:="$(CPU_TYPE)$(if $(CPU_SUBTYPE),+$(CPU_SUBTYPE))"
|
||||
endif
|
||||
|
||||
ifeq ($(MESON_USE_STAGING_PYTHON),)
|
||||
PYTHON_BIN:=$(STAGING_DIR_HOST)/bin/$(PYTHON)
|
||||
else
|
||||
PYTHON_BIN:=$(STAGING_DIR_HOSTPKG)/bin/$(PYTHON)
|
||||
endif
|
||||
|
||||
define Meson
|
||||
$(2) $(PYTHON_BIN) $(STAGING_DIR_HOST)/bin/meson.py $(1)
|
||||
$(2) $(STAGING_DIR_HOST)/bin/$(PYTHON) $(STAGING_DIR_HOST)/bin/meson.py $(1)
|
||||
endef
|
||||
|
||||
define Meson/CreateNativeFile
|
||||
@@ -71,7 +65,7 @@ define Meson/CreateNativeFile
|
||||
-e "s|@CXX@|$(foreach BIN,$(HOSTCXX),'$(BIN)',)|" \
|
||||
-e "s|@PKGCONFIG@|$(PKG_CONFIG)|" \
|
||||
-e "s|@CMAKE@|$(STAGING_DIR_HOST)/bin/cmake|" \
|
||||
-e "s|@PYTHON@|$(PYTHON_BIN)|" \
|
||||
-e "s|@PYTHON@|$(STAGING_DIR_HOST)/bin/python3|" \
|
||||
-e "s|@CFLAGS@|$(foreach FLAG,$(HOST_CFLAGS) $(HOST_CPPFLAGS),'$(FLAG)',)|" \
|
||||
-e "s|@CXXFLAGS@|$(foreach FLAG,$(HOST_CXXFLAGS) $(HOST_CPPFLAGS),'$(FLAG)',)|" \
|
||||
-e "s|@LDFLAGS@|$(foreach FLAG,$(HOST_LDFLAGS),'$(FLAG)',)|" \
|
||||
@@ -90,7 +84,7 @@ define Meson/CreateCrossFile
|
||||
-e "s|@NM@|$(TARGET_NM)|" \
|
||||
-e "s|@PKGCONFIG@|$(PKG_CONFIG)|" \
|
||||
-e "s|@CMAKE@|$(STAGING_DIR_HOST)/bin/cmake|" \
|
||||
-e "s|@PYTHON@|$(PYTHON_BIN)|" \
|
||||
-e "s|@PYTHON@|$(STAGING_DIR_HOST)/bin/python3|" \
|
||||
-e "s|@CFLAGS@|$(foreach FLAG,$(TARGET_CFLAGS) $(EXTRA_CFLAGS) $(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS),'$(FLAG)',)|" \
|
||||
-e "s|@CXXFLAGS@|$(foreach FLAG,$(TARGET_CXXFLAGS) $(EXTRA_CXXFLAGS) $(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS),'$(FLAG)',)|" \
|
||||
-e "s|@LDFLAGS@|$(foreach FLAG,$(TARGET_LDFLAGS) $(EXTRA_LDFLAGS),'$(FLAG)',)|" \
|
||||
@@ -114,7 +108,7 @@ define Host/Configure/Meson
|
||||
endef
|
||||
|
||||
define Host/Compile/Meson
|
||||
+$(MESON_HOST_VARS) $(NINJA) -C $(MESON_HOST_BUILD_DIR) $(1)
|
||||
+$(NINJA) -C $(MESON_HOST_BUILD_DIR) $(1)
|
||||
endef
|
||||
|
||||
define Host/Install/Meson
|
||||
@@ -141,7 +135,7 @@ define Build/Configure/Meson
|
||||
endef
|
||||
|
||||
define Build/Compile/Meson
|
||||
+$(MESON_VARS) $(NINJA) -C $(MESON_BUILD_DIR) $(1)
|
||||
+$(NINJA) -C $(MESON_BUILD_DIR) $(1)
|
||||
endef
|
||||
|
||||
define Build/Install/Meson
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
# Copyright (C) 2022-2023 Enéas Ulir de Queiroz
|
||||
|
||||
ENGINES_DIR=engines-3
|
||||
MODULES_DIR=ossl-modules
|
||||
|
||||
define Package/openssl/module/Default
|
||||
SECTION:=libs
|
||||
@@ -75,6 +74,6 @@ endef
|
||||
# 1 = provider name
|
||||
# 2 = [ package name, defaults to libopenssl-$(1) ]
|
||||
define Package/openssl/add-provider
|
||||
$(call Package/openssl/add-module,provider,$(1),/usr/lib/$(MODULES_DIR),$(2))
|
||||
$(call Package/openssl/add-module,provider,$(1),/usr/lib/ossl-modules,$(2))
|
||||
endef
|
||||
|
||||
|
||||
@@ -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)" \
|
||||
|
||||
@@ -20,7 +20,7 @@ define Package/Default
|
||||
PROVIDES:=
|
||||
EXTRA_DEPENDS:=
|
||||
MAINTAINER:=$(PKG_MAINTAINER)
|
||||
SOURCE:=$(patsubst $(TOPDIR)/%,%,$(if $(__pkg_source_makefile),$(__pkg_source_makefile),$(CURDIR)))
|
||||
SOURCE:=$(patsubst $(TOPDIR)/%,%,$(patsubst $(TOPDIR)/package/%,feeds/base/%,$(CURDIR)))
|
||||
ifneq ($(PKG_VERSION),)
|
||||
ifneq ($(PKG_RELEASE),)
|
||||
VERSION:=$(PKG_VERSION)-r$(PKG_RELEASE)
|
||||
|
||||
@@ -8,30 +8,16 @@ endif
|
||||
|
||||
IPKG_STATE_DIR:=$(TARGET_DIR)/usr/lib/opkg
|
||||
|
||||
define description_escape
|
||||
$(subst `,\`,$(subst $$,\$$,$(subst ",\",$(subst \,\\,$(1)))))
|
||||
endef
|
||||
|
||||
# Generates a make statement to return a wildcard for candidate ipkg files
|
||||
# 1: package name
|
||||
define gen_package_wildcard
|
||||
$(1)$$(if $$(filter -%,$$(ABIV_$(1))),,[^a-z$(if $(CONFIG_USE_APK),,-)])*
|
||||
endef
|
||||
|
||||
# 1: command and initial arguments
|
||||
# 2: arguments list
|
||||
# 3: tmp filename
|
||||
define maybe_use_xargs
|
||||
$(if $(word 512,$(2)), \
|
||||
$(file >$(3),$(2)) $(XARGS) $(1) < "$(3)"; rm "$(3)", \
|
||||
$(1) $(2))
|
||||
$(1)$$(if $$(filter -%,$$(ABIV_$(1))),,[^a-z-])*
|
||||
endef
|
||||
|
||||
# 1: package name
|
||||
# 2: candidate ipk files
|
||||
define remove_ipkg_files
|
||||
$(if $(strip $(2)), \
|
||||
$(call maybe_use_xargs,$(SCRIPT_DIR)/ipkg-remove $(1),$(2),$(TMP_DIR)/$(1).in))
|
||||
$(if $(strip $(2)),$(SCRIPT_DIR)/ipkg-remove $(1) $(2))
|
||||
endef
|
||||
|
||||
# 1: package name
|
||||
@@ -121,23 +107,6 @@ endif
|
||||
ADIR_$(1):=$(PKG_BUILD_DIR)/apk-$(PKGARCH)/$(1)
|
||||
KEEP_$(1):=$(strip $(call Package/$(1)/conffiles))
|
||||
|
||||
APK_SCRIPTS_$(1):=
|
||||
|
||||
ifdef Package/$(1)/preinst
|
||||
APK_SCRIPTS_$(1)+=--script "pre-install:$$(ADIR_$(1))/preinst"
|
||||
endif
|
||||
APK_SCRIPTS_$(1)+=--script "post-install:$$(ADIR_$(1))/post-install"
|
||||
|
||||
ifdef Package/$(1)/preinst
|
||||
APK_SCRIPTS_$(1)+=--script "pre-upgrade:$$(ADIR_$(1))/pre-upgrade"
|
||||
endif
|
||||
APK_SCRIPTS_$(1)+=--script "post-upgrade:$$(ADIR_$(1))/post-upgrade"
|
||||
|
||||
APK_SCRIPTS_$(1)+=--script "pre-deinstall:$$(ADIR_$(1))/pre-deinstall"
|
||||
ifdef Package/$(1)/postrm
|
||||
APK_SCRIPTS_$(1)+=--script "post-deinstall:$$(ADIR_$(1))/postrm"
|
||||
endif
|
||||
|
||||
TARGET_VARIANT:=$$(if $(ALL_VARIANTS),$$(if $$(VARIANT),$$(filter-out *,$$(VARIANT)),$(firstword $(ALL_VARIANTS))))
|
||||
ifeq ($(BUILD_VARIANT),$$(if $$(TARGET_VARIANT),$$(TARGET_VARIANT),$(BUILD_VARIANT)))
|
||||
do_install=
|
||||
@@ -232,7 +201,6 @@ $(_endef)
|
||||
$$(PACK_$(1)) : export DESCRIPTION=$$(Package/$(1)/description)
|
||||
$$(PACK_$(1)) : export PATH=$$(TARGET_PATH_PKG)
|
||||
$$(PACK_$(1)) : export PKG_SOURCE_DATE_EPOCH:=$(PKG_SOURCE_DATE_EPOCH)
|
||||
$$(PACK_$(1)) : export SOURCE_DATE_EPOCH:=$(PKG_SOURCE_DATE_EPOCH)
|
||||
$(PKG_INFO_DIR)/$(1).provides $$(PACK_$(1)): $(STAMP_BUILT) $(INCLUDE_DIR)/package-pack.mk
|
||||
rm -rf $$(IDIR_$(1))
|
||||
ifeq ($$(CONFIG_USE_APK),)
|
||||
@@ -322,39 +290,23 @@ else
|
||||
echo 'export root="$$$${IPKG_INSTROOT}"'; \
|
||||
echo 'export pkgname="$(1)"'; \
|
||||
echo "add_group_and_user"; \
|
||||
[ ! -f $$(ADIR_$(1))/postinst-pkg ] || cat "$$(ADIR_$(1))/postinst-pkg"; \
|
||||
echo "default_postinst"; \
|
||||
[ ! -f $$(ADIR_$(1))/postinst-pkg ] || sed -z 's/^\s*#!/#!/' "$$(ADIR_$(1))/postinst-pkg"; \
|
||||
) > $$(ADIR_$(1))/post-install;
|
||||
|
||||
ifdef Package/$(1)/preinst
|
||||
( \
|
||||
echo "#!/bin/sh"; \
|
||||
echo 'export PKG_UPGRADE=1'; \
|
||||
[ ! -f $$(ADIR_$(1))/preinst ] || sed -z 's/^\s*#!/#!/' "$$(ADIR_$(1))/preinst"; \
|
||||
) > $$(ADIR_$(1))/pre-upgrade;
|
||||
endif
|
||||
|
||||
( \
|
||||
echo "#!/bin/sh"; \
|
||||
echo 'export PKG_UPGRADE=1'; \
|
||||
[ ! -f $$(ADIR_$(1))/post-install ] || sed -z 's/^\s*#!/#!/' "$$(ADIR_$(1))/post-install"; \
|
||||
) > $$(ADIR_$(1))/post-upgrade;
|
||||
|
||||
( \
|
||||
echo "#!/bin/sh"; \
|
||||
echo "[ -s "\$$$${IPKG_INSTROOT}/lib/functions.sh" ] || exit 0"; \
|
||||
echo ". \$$$${IPKG_INSTROOT}/lib/functions.sh"; \
|
||||
echo 'export root="$$$${IPKG_INSTROOT}"'; \
|
||||
echo 'export pkgname="$(1)"'; \
|
||||
[ ! -f $$(ADIR_$(1))/prerm-pkg ] || cat "$$(ADIR_$(1))/prerm-pkg"; \
|
||||
echo "default_prerm"; \
|
||||
[ ! -f $$(ADIR_$(1))/prerm-pkg ] || sed -z 's/^\s*#!/#!/' "$$(ADIR_$(1))/prerm-pkg"; \
|
||||
) > $$(ADIR_$(1))/pre-deinstall;
|
||||
|
||||
[ ! -f $$(ADIR_$(1))/postrm ] || sed -zi 's/^\s*#!/#!/' "$$(ADIR_$(1))/postrm";
|
||||
|
||||
if [ -n "$(USERID)" ]; then echo $(USERID) > $$(IDIR_$(1))/lib/apk/packages/$(1).rusers; fi;
|
||||
if [ -n "$(ALTERNATIVES)" ]; then echo $(ALTERNATIVES) > $$(IDIR_$(1))/lib/apk/packages/$(1).alternatives; fi;
|
||||
(cd $$(IDIR_$(1)) && find . -type f,l -printf "/%P\n" | sort > $(TMP_DIR)/$(1).list && mv $(TMP_DIR)/$(1).list $$(IDIR_$(1))/lib/apk/packages/$(1).list)
|
||||
(cd $$(IDIR_$(1)) && find . -type f,l -printf "/%P\n" > $$(IDIR_$(1))/lib/apk/packages/$(1).list)
|
||||
# Move conffiles to IDIR and build conffiles_static with csums
|
||||
if [ -f $$(ADIR_$(1))/conffiles ]; then \
|
||||
mv -f $$(ADIR_$(1))/conffiles $$(IDIR_$(1))/lib/apk/packages/$(1).conffiles; \
|
||||
@@ -387,9 +339,8 @@ else
|
||||
$(FAKEROOT) $(STAGING_DIR_HOST)/bin/apk mkpkg \
|
||||
--info "name:$(1)$$(ABIV_$(1))" \
|
||||
--info "version:$(VERSION)" \
|
||||
$$(if $$(ABIV_$(1)),--info "tags:openwrt:abiversion=$$(ABIV_$(1))") \
|
||||
--info "description:$$(call description_escape,$$(strip $$(Package/$(1)/description)))" \
|
||||
$(if $(findstring all,$(PKGARCH)),--info "arch:noarch",--info "arch:$(PKGARCH)") \
|
||||
--info "description:$$(strip $$(Package/$(1)/description))" \
|
||||
--info "arch:$(PKGARCH)" \
|
||||
--info "license:$(LICENSE)" \
|
||||
--info "origin:$(SOURCE)" \
|
||||
--info "url:$(URL)" \
|
||||
@@ -404,11 +355,13 @@ else
|
||||
) \
|
||||
), \
|
||||
$$(prov) )" \
|
||||
$(if $(DEFAULT_VARIANT),--info "provider-priority:100",$(if $(PROVIDES),--info "provider-priority:1")) \
|
||||
$$(APK_SCRIPTS_$(1)) \
|
||||
$(if $(DEFAULT_VARIANT),--info "provider-priority:100") \
|
||||
--script "post-install:$$(ADIR_$(1))/post-install" \
|
||||
--script "pre-deinstall:$$(ADIR_$(1))/pre-deinstall" \
|
||||
--info "depends:$$(foreach depends,$$(subst $$(comma),$$(space),$$(subst $$(space),,$$(subst $$(paren_right),,$$(subst $$(paren_left),,$$(Package/$(1)/DEPENDS))))),$$(depends))" \
|
||||
--files "$$(IDIR_$(1))" \
|
||||
--output "$$(PACK_$(1))"
|
||||
--output "$$(PACK_$(1))" \
|
||||
--sign "$(BUILD_KEY_APK_SEC)"
|
||||
endif
|
||||
|
||||
@[ -f $$(PACK_$(1)) ]
|
||||
|
||||
@@ -134,35 +134,6 @@ endef
|
||||
|
||||
PKG_INSTALL_STAMP:=$(PKG_INFO_DIR)/$(PKG_DIR_NAME).$(if $(BUILD_VARIANT),$(BUILD_VARIANT),default).install
|
||||
|
||||
# Normalize package SOURCE entry to pack reproducible package
|
||||
# If we are packing a package with OpenWrt buildroot:
|
||||
# - Replace package/... with feeds/base/...
|
||||
# If we are packing a package with SDK:
|
||||
# - Replace feeds/.*_root/... with feeds/.*/... and remove
|
||||
# the intermediate directory to reflect what the symbolic link
|
||||
# points to.
|
||||
# Example:
|
||||
# Feed link: feeds/base_root/package -> feeds/base
|
||||
# Package: feeds/base_root/package/system/uci -> feeds/base/system/uci
|
||||
ifeq ($(DUMP),)
|
||||
__pkg_base_path:=$(patsubst $(TOPDIR)/%,%,$(CURDIR))
|
||||
__pkg_provider_path:=$(word 1,$(subst /, ,$(__pkg_base_path)))
|
||||
ifeq ($(__pkg_provider_path), feeds)
|
||||
__pkg_feed_path:=$(word 2,$(subst /, ,$(__pkg_base_path)))
|
||||
__pkg_feed_name:=$(patsubst %_root,%,$(__pkg_feed_path))
|
||||
ifneq (__pkg_feed_path, __pkg_feed_name)
|
||||
__pkg_feed_realpath:=$(realpath $(TOPDIR)/feeds/$(__pkg_feed_name))
|
||||
__pkg_feed_dir:=$(patsubst $(TOPDIR)/feeds/$(__pkg_feed_path)/%,%,$(__pkg_feed_realpath))
|
||||
__pkg_path:=$(patsubst feeds/$(__pkg_feed_path)/$(__pkg_feed_dir)/%,%,$(__pkg_base_path))
|
||||
else
|
||||
__pkg_path:=$(patsubst feeds/$(__pkg_feed_path)/%,%,$(__pkg_base_path))
|
||||
endif
|
||||
__pkg_source_makefile:=$(TOPDIR)/feeds/$(__pkg_feed_name)/$(__pkg_path)
|
||||
else ifeq ($(__pkg_provider_path), package)
|
||||
__pkg_source_makefile:=$(TOPDIR)/feeds/base/$(patsubst package/%,%,$(__pkg_base_path))
|
||||
endif
|
||||
endif
|
||||
|
||||
include $(INCLUDE_DIR)/package-defaults.mk
|
||||
include $(INCLUDE_DIR)/package-dumpinfo.mk
|
||||
include $(INCLUDE_DIR)/package-pack.mk
|
||||
|
||||
@@ -9,11 +9,11 @@ SHELL:=sh
|
||||
PKG_NAME:=Build dependency
|
||||
|
||||
$(eval $(call TestHostCommand,true, \
|
||||
Please install 'coreutils', \
|
||||
Please install GNU 'coreutils', \
|
||||
$(TRUE)))
|
||||
|
||||
$(eval $(call TestHostCommand,false, \
|
||||
Please install 'coreutils', \
|
||||
Please install GNU 'coreutils', \
|
||||
$(FALSE); [ $$$$$$$$? = 1 ] && $(TRUE)))
|
||||
|
||||
# Required for the toolchain
|
||||
@@ -97,7 +97,7 @@ $(eval $(call TestHostCommand,perl-thread-queue, \
|
||||
perl -MThread::Queue -e 1))
|
||||
|
||||
$(eval $(call TestHostCommand,perl-ipc-cmd, \
|
||||
Please install the Perl IPC::Cmd module, \
|
||||
Please install the Perl IPC:Cmd module, \
|
||||
perl -MIPC::Cmd -e 1))
|
||||
|
||||
$(eval $(call SetupHostCommand,tar,Please install GNU 'tar', \
|
||||
@@ -126,12 +126,10 @@ $(eval $(call SetupHostCommand,diff,Please install GNU diffutils, \
|
||||
diff --version 2>&1 | grep GNU))
|
||||
|
||||
$(eval $(call SetupHostCommand,cp,Please install GNU fileutils, \
|
||||
$(TOPDIR)/staging_dir/host/bin/gcp --help 2>&1 | grep 'Copy SOURCE', \
|
||||
gcp --help 2>&1 | grep 'Copy SOURCE', \
|
||||
cp --help 2>&1 | grep 'Copy SOURCE'))
|
||||
|
||||
$(eval $(call SetupHostCommand,seq,Please install seq, \
|
||||
$(TOPDIR)/staging_dir/host/bin/gseq --version, \
|
||||
gseq --version, \
|
||||
seq --version 2>&1 | grep seq))
|
||||
|
||||
@@ -155,12 +153,10 @@ $(eval $(call SetupHostCommand,getopt, \
|
||||
/opt/local/bin/getopt -o t --long test -- --test | grep '^ *--test *--'))
|
||||
|
||||
$(eval $(call SetupHostCommand,realpath,Please install a 'realpath' utility, \
|
||||
$(TOPDIR)/staging_dir/host/bin/grealpath /, \
|
||||
grealpath /, \
|
||||
realpath /))
|
||||
|
||||
$(eval $(call SetupHostCommand,stat,Cannot find a file stat utility, \
|
||||
$(TOPDIR)/staging_dir/host/bin/gstat -c%s $(TOPDIR)/Makefile, \
|
||||
gnustat -c%s $(TOPDIR)/Makefile, \
|
||||
gstat -c%s $(TOPDIR)/Makefile, \
|
||||
stat -c%s $(TOPDIR)/Makefile))
|
||||
@@ -178,16 +174,14 @@ $(eval $(call SetupHostCommand,bzip2,Please install 'bzip2', \
|
||||
$(eval $(call SetupHostCommand,wget,Please install GNU 'wget', \
|
||||
wget --version | grep GNU))
|
||||
|
||||
$(eval $(call SetupHostCommand,install,Please install 'install', \
|
||||
$(TOPDIR)/staging_dir/host/bin/ginstall --version | grep GNU, \
|
||||
install --version | grep 'GNU\|uutils', \
|
||||
$(eval $(call SetupHostCommand,install,Please install GNU 'install', \
|
||||
install --version | grep GNU, \
|
||||
ginstall --version | grep GNU))
|
||||
|
||||
$(eval $(call SetupHostCommand,perl,Please install Perl 5.x, \
|
||||
perl --version | grep "perl.*v5"))
|
||||
|
||||
$(eval $(call SetupHostCommand,python,Please install Python >= 3.7, \
|
||||
python3.13 -V 2>&1 | grep 'Python 3', \
|
||||
python3.12 -V 2>&1 | grep 'Python 3', \
|
||||
python3.11 -V 2>&1 | grep 'Python 3', \
|
||||
python3.10 -V 2>&1 | grep 'Python 3', \
|
||||
@@ -197,7 +191,6 @@ $(eval $(call SetupHostCommand,python,Please install Python >= 3.7, \
|
||||
python3 -V 2>&1 | grep -E 'Python 3\.([7-9]|[0-9][0-9])\.?'))
|
||||
|
||||
$(eval $(call SetupHostCommand,python3,Please install Python >= 3.7, \
|
||||
python3.13 -V 2>&1 | grep 'Python 3', \
|
||||
python3.12 -V 2>&1 | grep 'Python 3', \
|
||||
python3.11 -V 2>&1 | grep 'Python 3', \
|
||||
python3.10 -V 2>&1 | grep 'Python 3', \
|
||||
@@ -239,7 +232,7 @@ endif
|
||||
|
||||
$(STAGING_DIR_HOST)/bin/mkhash: $(SCRIPT_DIR)/mkhash.c
|
||||
mkdir -p $(dir $@)
|
||||
$(STAGING_DIR_HOST)/bin/gcc -O2 -I$(TOPDIR)/tools/include -o $@ $<
|
||||
$(CC) -O2 -I$(TOPDIR)/tools/include -o $@ $<
|
||||
|
||||
$(STAGING_DIR_HOST)/bin/xxd: $(SCRIPT_DIR)/xxdi.pl
|
||||
$(LN) $< $@
|
||||
|
||||
@@ -71,7 +71,7 @@ endef
|
||||
# 4: optional link library test (example -lncurses)
|
||||
define RequireCHeader
|
||||
define Require/$(1)
|
||||
echo 'int main(int argc, char **argv) { $(3); return 0; }' | $(STAGING_DIR_HOST)/bin/gcc -include $(1) -x c -o $(TMP_DIR)/a.out - $(4)
|
||||
echo 'int main(int argc, char **argv) { $(3); return 0; }' | gcc -include $(1) -x c -o $(TMP_DIR)/a.out - $(4)
|
||||
endef
|
||||
|
||||
$$(eval $$(call Require,$(1),$(2)))
|
||||
@@ -113,7 +113,7 @@ define SetupHostCommand
|
||||
[ -x "$(STAGING_DIR_HOST)/bin/$(strip $(1))" ] && exit 0 \
|
||||
;; \
|
||||
esac; \
|
||||
ln -sf "$$$$$$$${bin#$(STAGING_DIR_HOST)/bin/}" "$(STAGING_DIR_HOST)/bin/$(strip $(1))"; \
|
||||
ln -sf "$$$$$$$$bin" "$(STAGING_DIR_HOST)/bin/$(strip $(1))"; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
fi; \
|
||||
|
||||
@@ -48,6 +48,7 @@ apk = \
|
||||
$(FAKEROOT) $(STAGING_DIR_HOST)/bin/apk \
|
||||
--root $(1) \
|
||||
--keys-dir $(if $(APK_KEYS),$(APK_KEYS),$(TOPDIR)) \
|
||||
--no-cache \
|
||||
--no-logfile \
|
||||
--preserve-env
|
||||
|
||||
|
||||
@@ -90,9 +90,45 @@ 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)
|
||||
@@ -105,6 +141,13 @@ DEFAULT_PACKAGES += $(DEFAULT_PACKAGES.$(DEVICE_TYPE))
|
||||
##
|
||||
filter_packages = $(filter-out -% $(patsubst -%,%,$(filter -%,$(1))),$(1))
|
||||
|
||||
##@
|
||||
# @brief Append extra package dependencies.
|
||||
#
|
||||
# @param 1: Package list.
|
||||
##
|
||||
extra_packages = $(if $(filter wpad wpad-% nas,$(1)),iwinfo)
|
||||
|
||||
define ProfileDefault
|
||||
NAME:=
|
||||
PRIORITY:=
|
||||
@@ -121,7 +164,7 @@ define Profile
|
||||
echo "Target-Profile: $(1)"; \
|
||||
$(if $(PRIORITY), echo "Target-Profile-Priority: $(PRIORITY)"; ) \
|
||||
echo "Target-Profile-Name: $(NAME)"; \
|
||||
echo "Target-Profile-Packages: $(PACKAGES)"; \
|
||||
echo "Target-Profile-Packages: $(PACKAGES) $(call extra_packages,$(DEFAULT_PACKAGES) $(PACKAGES))"; \
|
||||
echo "Target-Profile-Description:"; \
|
||||
echo "$$$$$$$$$(call shvar,Profile/$(1)/Description)"; \
|
||||
echo "@@"; \
|
||||
@@ -148,12 +191,11 @@ ifeq ($(TARGET_BUILD),1)
|
||||
endif
|
||||
endif
|
||||
|
||||
GENERIC_PLATFORM_DIR := $(TOPDIR)/target/linux/generic
|
||||
|
||||
ifneq ($(TARGET_BUILD)$(if $(DUMP),,1),)
|
||||
include $(INCLUDE_DIR)/kernel-version.mk
|
||||
endif
|
||||
|
||||
GENERIC_PLATFORM_DIR := $(TOPDIR)/target/linux/generic
|
||||
GENERIC_BACKPORT_DIR := $(GENERIC_PLATFORM_DIR)/backport$(if $(wildcard $(GENERIC_PLATFORM_DIR)/backport-$(KERNEL_PATCHVER)),-$(KERNEL_PATCHVER))
|
||||
GENERIC_PATCH_DIR := $(GENERIC_PLATFORM_DIR)/pending$(if $(wildcard $(GENERIC_PLATFORM_DIR)/pending-$(KERNEL_PATCHVER)),-$(KERNEL_PATCHVER))
|
||||
GENERIC_HACK_DIR := $(GENERIC_PLATFORM_DIR)/hack$(if $(wildcard $(GENERIC_PLATFORM_DIR)/hack-$(KERNEL_PATCHVER)),-$(KERNEL_PATCHVER))
|
||||
@@ -268,8 +310,8 @@ ifeq ($(DUMP),1)
|
||||
CPU_CFLAGS_archs = -mcpu=archs
|
||||
endif
|
||||
ifeq ($(ARCH),riscv64)
|
||||
CPU_TYPE ?= generic
|
||||
CPU_CFLAGS_generic:=-mabi=lp64d -march=rv64gc
|
||||
CPU_TYPE ?= riscv64
|
||||
CPU_CFLAGS_riscv64:=-mabi=lp64d -march=rv64imafdc
|
||||
endif
|
||||
ifeq ($(ARCH),loongarch64)
|
||||
CPU_TYPE ?= generic
|
||||
@@ -308,15 +350,6 @@ ifeq ($(DUMP),1)
|
||||
ifneq ($(CONFIG_PCIEPORTBUS),)
|
||||
FEATURES += pcie
|
||||
endif
|
||||
ifneq ($(CONFIG_PINCTRL),)
|
||||
FEATURES += pinctrl
|
||||
endif
|
||||
ifneq ($(CONFIG_PM),)
|
||||
FEATURES += pm
|
||||
endif
|
||||
ifneq ($(CONFIG_PWM),)
|
||||
FEATURES += pwm
|
||||
endif
|
||||
ifneq ($(CONFIG_USB)$(CONFIG_USB_SUPPORT),)
|
||||
ifneq ($(CONFIG_USB_ARCH_HAS_HCD)$(CONFIG_USB_EHCI_HCD),)
|
||||
FEATURES += usb
|
||||
@@ -378,11 +411,10 @@ define BuildTargets/DumpCurrent
|
||||
echo 'Target-Description:'; \
|
||||
echo "$$$$DESCRIPTION"; \
|
||||
echo '@@'; \
|
||||
$(if $(DEFAULT_PROFILE),echo 'Target-Default-Profile: $(DEFAULT_PROFILE)';) \
|
||||
echo 'Default-Packages: $(DEFAULT_PACKAGES)'; \
|
||||
echo 'Default-Packages: $(DEFAULT_PACKAGES) $(call extra_packages,$(DEFAULT_PACKAGES))'; \
|
||||
$(DUMPINFO)
|
||||
$(if $(CUR_SUBTARGET),$(SUBMAKE) -r --no-print-directory -C image -s DUMP=1 SUBTARGET=$(CUR_SUBTARGET))
|
||||
$(if $(SUBTARGET),,@$(foreach SUBTARGET,$(SUBTARGETS),$(SUBMAKE) --no-print-directory -s DUMP=1 SUBTARGET=$(SUBTARGET); ))
|
||||
$(if $(SUBTARGET),,@$(foreach SUBTARGET,$(SUBTARGETS),$(SUBMAKE) -s DUMP=1 SUBTARGET=$(SUBTARGET); ))
|
||||
endef
|
||||
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
@@ -75,10 +75,25 @@ 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 ../package $(TOPDIR)/feeds/base
|
||||
[ -e $(TOPDIR)/feeds/base ] || ln -sf $(TOPDIR)/package $(TOPDIR)/feeds/base
|
||||
$(_SINGLE)$(NO_TRACE_MAKE) -j1 -r -s -f include/scan.mk SCAN_TARGET="packageinfo" SCAN_DIR="package" SCAN_NAME="package" SCAN_DEPTH=5 SCAN_EXTRA=""
|
||||
$(_SINGLE)$(NO_TRACE_MAKE) -j1 -r -s -f include/scan.mk SCAN_TARGET="targetinfo" SCAN_DIR="target/linux" SCAN_NAME="target" SCAN_DEPTH=3 SCAN_EXTRA="" SCAN_MAKEOPTS="TARGET_BUILD=1"
|
||||
for type in package target; do \
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -85,13 +77,13 @@ endef
|
||||
DTC=$(wildcard $(LINUX_DIR)/scripts/dtc/dtc)
|
||||
|
||||
define Build/Compile/Trusted-Firmware-A
|
||||
+unset CC; \
|
||||
$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
|
||||
+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
|
||||
CROSS_COMPILE=$(TARGET_CROSS) \
|
||||
OPENSSL_DIR=$(STAGING_DIR_HOST) \
|
||||
$(if $(DTC),DTC="$(DTC)") \
|
||||
PLAT=$(PLAT) \
|
||||
BUILD_STRING="OpenWrt $(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
|
||||
|
||||
|
||||
@@ -29,8 +29,6 @@ endif
|
||||
ifdef UBOOT_USE_INTREE_DTC
|
||||
$(eval $(call TestHostCommand,python3-dev, \
|
||||
Please install the python3-dev package, \
|
||||
python3.13-config --includes 2>&1 | grep 'python3', \
|
||||
python3.12-config --includes 2>&1 | grep 'python3', \
|
||||
python3.11-config --includes 2>&1 | grep 'python3', \
|
||||
python3.10-config --includes 2>&1 | grep 'python3', \
|
||||
python3.9-config --includes 2>&1 | grep 'python3', \
|
||||
@@ -80,7 +78,6 @@ UBOOT_MAKE_FLAGS = \
|
||||
PKG_CONFIG_PATH="$(STAGING_DIR_HOST)/lib/pkgconfig" \
|
||||
PKG_CONFIG_LIBDIR="$(STAGING_DIR_HOST)/lib/pkgconfig" \
|
||||
PKG_CONFIG_EXTRAARGS="--static" \
|
||||
$(if $(KBUILD_CFLAGS),KCFLAGS="$(KBUILD_CFLAGS)") \
|
||||
$(if $(findstring c,$(OPENWRT_VERBOSE)),V=1,V='')
|
||||
|
||||
define Build/U-Boot/Target
|
||||
@@ -113,11 +110,7 @@ define Build/U-Boot/Target
|
||||
endef
|
||||
|
||||
define Build/Configure/U-Boot
|
||||
+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
|
||||
CROSS_COMPILE=$(TARGET_CROSS) \
|
||||
$(UBOOT_CONFIGURE_VARS) \
|
||||
$(firstword $(UBOOT_CONFIG))_config \
|
||||
$(wordlist 2,$(words $(UBOOT_CONFIG)),$(UBOOT_CONFIG:%=%.config))
|
||||
+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) CROSS_COMPILE=$(TARGET_CROSS) $(UBOOT_CONFIGURE_VARS) $(UBOOT_CONFIG)_config
|
||||
$(if $(strip $(UBOOT_CUSTOMIZE_CONFIG)),
|
||||
$(PKG_BUILD_DIR)/scripts/config --file $(PKG_BUILD_DIR)/.config $(UBOOT_CUSTOMIZE_CONFIG)
|
||||
+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) CROSS_COMPILE=$(TARGET_CROSS) $(UBOOT_CONFIGURE_VARS) oldconfig)
|
||||
|
||||
@@ -6,9 +6,6 @@
|
||||
# Substituted by SDK, do not remove
|
||||
# REVISION:=x
|
||||
# SOURCE_DATE_EPOCH:=x
|
||||
# BASE_FILES_VERSION:=x
|
||||
# KERNEL_VERSION:=x
|
||||
# LIBC_VERSION:=x
|
||||
|
||||
PKG_CONFIG_DEPENDS += \
|
||||
CONFIG_VERSION_HOME_URL \
|
||||
@@ -21,19 +18,18 @@ PKG_CONFIG_DEPENDS += \
|
||||
CONFIG_VERSION_MANUFACTURER_URL \
|
||||
CONFIG_VERSION_PRODUCT \
|
||||
CONFIG_VERSION_SUPPORT_URL \
|
||||
CONFIG_VERSION_FIRMWARE_URL \
|
||||
CONFIG_VERSION_HWREV \
|
||||
|
||||
sanitize = $(call tolower,$(subst _,-,$(subst $(space),-,$(1))))
|
||||
|
||||
VERSION_NUMBER:=$(call qstrip,$(CONFIG_VERSION_NUMBER))
|
||||
VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),SNAPSHOT)
|
||||
VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),24.10.0-rc2)
|
||||
|
||||
VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE))
|
||||
VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),$(REVISION))
|
||||
VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),r28161-ea17e958b9)
|
||||
|
||||
VERSION_REPO:=$(call qstrip,$(CONFIG_VERSION_REPO))
|
||||
VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/snapshots)
|
||||
VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/24.10.0-rc2)
|
||||
|
||||
VERSION_DIST:=$(call qstrip,$(CONFIG_VERSION_DIST))
|
||||
VERSION_DIST:=$(if $(VERSION_DIST),$(VERSION_DIST),OpenWrt)
|
||||
@@ -54,9 +50,6 @@ VERSION_HOME_URL:=$(if $(VERSION_HOME_URL),$(VERSION_HOME_URL),https://openwrt.o
|
||||
VERSION_SUPPORT_URL:=$(call qstrip,$(CONFIG_VERSION_SUPPORT_URL))
|
||||
VERSION_SUPPORT_URL:=$(if $(VERSION_SUPPORT_URL),$(VERSION_SUPPORT_URL),https://forum.openwrt.org/)
|
||||
|
||||
VERSION_FIRMWARE_URL:=$(call qstrip,$(CONFIG_VERSION_FIRMWARE_URL))
|
||||
VERSION_FIRMWARE_URL:=$(if $(VERSION_FIRMWARE_URL),$(VERSION_FIRMWARE_URL),https://downloads.openwrt.org/)
|
||||
|
||||
VERSION_PRODUCT:=$(call qstrip,$(CONFIG_VERSION_PRODUCT))
|
||||
VERSION_PRODUCT:=$(if $(VERSION_PRODUCT),$(VERSION_PRODUCT),Generic)
|
||||
|
||||
@@ -110,7 +103,7 @@ VERSION_SED_SCRIPT:=$(SED) 's,%U,$(call sed_escape,$(VERSION_REPO)),g' \
|
||||
-e 's,%b,$(call sed_escape,$(VERSION_BUG_URL)),g' \
|
||||
-e 's,%u,$(call sed_escape,$(VERSION_HOME_URL)),g' \
|
||||
-e 's,%s,$(call sed_escape,$(VERSION_SUPPORT_URL)),g' \
|
||||
-e 's,%f,$(call sed_escape,$(VERSION_FIRMWARE_URL)),g' \
|
||||
-e 's,%P,$(call sed_escape,$(VERSION_PRODUCT)),g' \
|
||||
-e 's,%h,$(call sed_escape,$(VERSION_HWREV)),g' \
|
||||
-e 's,%B,$(call sed_escape,$(SOURCE_DATE_EPOCH)),g'
|
||||
|
||||
|
||||
@@ -70,8 +70,7 @@ ifneq ($(CONFIG_USE_APK),)
|
||||
(cd $(PACKAGE_DIR_ALL) && $(STAGING_DIR_HOST)/bin/apk mkndx \
|
||||
--root $(TOPDIR) \
|
||||
--keys-dir $(TOPDIR) \
|
||||
--allow-untrusted \
|
||||
$(if $(CONFIG_SIGNED_PACKAGES),--sign $(BUILD_KEY_APK_SEC),) \
|
||||
--sign $(BUILD_KEY_APK_SEC) \
|
||||
--output packages.adb \
|
||||
*.apk; \
|
||||
)
|
||||
@@ -99,15 +98,9 @@ $(curdir)/install: $(TMP_DIR)/.build $(curdir)/merge $(curdir)/merge-index
|
||||
ifneq ($(CONFIG_USE_APK),)
|
||||
$(file >$(TMP_DIR)/apk_install_list,\
|
||||
$(foreach pkg,$(shell cat $(PACKAGE_INSTALL_FILES) 2>/dev/null),$(pkg)$(call GetABISuffix,$(pkg))))
|
||||
$(call apk,$(TARGET_DIR)) add --no-cache --initdb --no-scripts --arch $(ARCH_PACKAGES) \
|
||||
--repositories-file /dev/null --repository file://$(PACKAGE_DIR_ALL)/packages.adb \
|
||||
$(if $(CONFIG_SIGNED_PACKAGES),,--allow-untrusted) \
|
||||
$$(cat $(TMP_DIR)/apk_install_list) \
|
||||
"base-files=$(shell cat $(TMP_DIR)/base-files.version)" \
|
||||
"libc=$(shell cat $(TMP_DIR)/libc.version)" \
|
||||
"kernel=$(shell cat $(TMP_DIR)/kernel.version)"
|
||||
|
||||
rm -rf $(TARGET_DIR)/run
|
||||
$(call apk,$(TARGET_DIR)) add --initdb --no-scripts --arch $(ARCH_PACKAGES) \
|
||||
--repositories-file /dev/zero --repository file://$(PACKAGE_DIR_ALL)/packages.adb \
|
||||
$$(cat $(TMP_DIR)/apk_install_list)
|
||||
else
|
||||
$(file >$(TMP_DIR)/opkg_install_list,\
|
||||
$(call opkg_package_files,\
|
||||
@@ -135,12 +128,9 @@ ifneq ($(CONFIG_USE_APK),)
|
||||
$(STAGING_DIR_HOST)/bin/apk mkndx \
|
||||
--root $(TOPDIR) \
|
||||
--keys-dir $(TOPDIR) \
|
||||
--allow-untrusted \
|
||||
$(if $(CONFIG_SIGNED_PACKAGES),--sign $(BUILD_KEY_APK_SEC),) \
|
||||
--sign $(BUILD_KEY_APK_SEC) \
|
||||
--output packages.adb \
|
||||
*.apk; \
|
||||
$(STAGING_DIR_HOST)/bin/apk adbdump --format json packages.adb | \
|
||||
$(SCRIPT_DIR)/make-index-json.py -f apk -a "$(ARCH_PACKAGES)" - > index.json; \
|
||||
$$(ls *.apk | grep -v 'kernel\|libc'); \
|
||||
done
|
||||
else
|
||||
@for d in $(PACKAGE_SUBDIRS); do ( \
|
||||
@@ -152,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
|
||||
@@ -172,7 +165,6 @@ ifdef CONFIG_JSON_CYCLONEDX_SBOM
|
||||
); done
|
||||
endif
|
||||
endif
|
||||
$(call sha256sums,$(OUTPUT_DIR)/packages/$(ARCH_PACKAGES),1)
|
||||
|
||||
$(curdir)/flags-install:= -j1
|
||||
|
||||
|
||||
@@ -39,11 +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 \
|
||||
+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)))
|
||||
@@ -250,13 +246,12 @@ endif
|
||||
rm -f $(1)/etc/banner.failsafe,)
|
||||
|
||||
ifneq ($(CONFIG_USE_APK),)
|
||||
mkdir -p $(1)/etc/apk/repositories.d
|
||||
$(call FeedSourcesAppendAPK,$(1)/etc/apk/repositories.d/distfeeds.list)
|
||||
$(VERSION_SED_SCRIPT) $(1)/etc/apk/repositories.d/distfeeds.list
|
||||
mkdir -p $(1)/etc/apk/
|
||||
$(call FeedSourcesAppendAPK,$(1)/etc/apk/repositories)
|
||||
$(VERSION_SED_SCRIPT) $(1)/etc/apk/repositories
|
||||
|
||||
rm -f $(1)/etc/uci-defaults/13_fix-group-user
|
||||
rm -f $(1)/sbin/pkg_check
|
||||
echo $(PKG_RELEASE)~$(lastword $(subst -, ,$(REVISION))) >$(TMP_DIR)/base-files.version
|
||||
else
|
||||
$(if $(CONFIG_CLEAN_IPKG),, \
|
||||
mkdir -p $(1)/etc/opkg; \
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
CFG=/etc/board.json
|
||||
|
||||
. /usr/share/libubox/jshn.sh
|
||||
. /lib/functions/ipv4.sh
|
||||
|
||||
[ -s $CFG ] || /bin/board_detect || exit 1
|
||||
[ -s /etc/config/network -a -s /etc/config/system ] && exit 0
|
||||
@@ -43,16 +42,16 @@ generate_static_network() {
|
||||
set network.loopback='interface'
|
||||
set network.loopback.device='lo'
|
||||
set network.loopback.proto='static'
|
||||
add_list network.loopback.ipaddr='127.0.0.1/8'
|
||||
delete network.globals
|
||||
set network.globals='globals'
|
||||
set network.globals.dhcp_default_duid='auto'
|
||||
set network.loopback.ipaddr='127.0.0.1'
|
||||
set network.loopback.netmask='255.0.0.0'
|
||||
EOF
|
||||
[ -e /proc/sys/net/ipv6 ] && {
|
||||
uci -q batch <<-EOF
|
||||
set network.globals.ula_prefix='auto'
|
||||
EOF
|
||||
}
|
||||
[ -e /proc/sys/net/ipv6 ] && {
|
||||
uci -q batch <<-EOF
|
||||
delete network.globals
|
||||
set network.globals='globals'
|
||||
set network.globals.ula_prefix='auto'
|
||||
EOF
|
||||
}
|
||||
|
||||
if json_is_a dsl object; then
|
||||
json_select dsl
|
||||
@@ -161,19 +160,18 @@ generate_network() {
|
||||
|
||||
case "$protocol" in
|
||||
static)
|
||||
local ipad netm prefix
|
||||
local ipad
|
||||
case "$1" in
|
||||
lan) ipad=${ipaddr:-"192.168.1.1"} ;;
|
||||
*) ipad=${ipaddr:-"192.168.$((addr_offset++)).1"} ;;
|
||||
esac
|
||||
|
||||
netm=${netmask:-"255.255.255.0"}
|
||||
str2ip netm "$netm"
|
||||
netmask2prefix prefix "$netm"
|
||||
|
||||
uci -q batch <<-EOF
|
||||
set network.$1.proto='static'
|
||||
add_list network.$1.ipaddr='$ipad/$prefix'
|
||||
set network.$1.ipaddr='$ipad'
|
||||
set network.$1.netmask='$netm'
|
||||
EOF
|
||||
[ -e /proc/sys/net/ipv6 ] && uci set network.$1.ip6assign='60'
|
||||
;;
|
||||
@@ -314,8 +312,7 @@ generate_static_system() {
|
||||
delete system.@system[0]
|
||||
add system system
|
||||
set system.@system[-1].hostname='OpenWrt'
|
||||
set system.@system[-1].timezone='GMT0'
|
||||
set system.@system[-1].zonename='UTC'
|
||||
set system.@system[-1].timezone='UTC'
|
||||
set system.@system[-1].ttylogin='0'
|
||||
set system.@system[-1].log_size='128'
|
||||
set system.@system[-1].urandom_seed='0'
|
||||
|
||||
@@ -133,7 +133,8 @@ _ip2str START "$start"
|
||||
_ip2str END "$end"
|
||||
|
||||
if [ "$start" -le "$ipaddr" ] && [ "$ipaddr" -le "$end" ]; then
|
||||
echo "warning: address $IP inside range $START..$END" >&2
|
||||
echo "error: address $IP inside range $START..$END" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "START=$START"
|
||||
|
||||
@@ -10,13 +10,10 @@ uci_apply_defaults() {
|
||||
cd /etc/uci-defaults || return 0
|
||||
files="$(ls)"
|
||||
[ -z "$files" ] && return 0
|
||||
applied=""
|
||||
for file in $files; do
|
||||
( . "./$(basename $file)" ) && applied="$applied $file"
|
||||
( . "./$(basename $file)" ) && rm -f "$file"
|
||||
done
|
||||
uci commit
|
||||
sync
|
||||
rm -f $applied
|
||||
}
|
||||
|
||||
boot() {
|
||||
|
||||
@@ -5,7 +5,6 @@ START=95
|
||||
boot() {
|
||||
mount_root done
|
||||
rm -f /sysupgrade.tgz && sync
|
||||
rm -f /tmp/sysupgrade.tar && sync
|
||||
|
||||
# process user commands
|
||||
[ -f /etc/rc.local ] && {
|
||||
|
||||
@@ -3,10 +3,6 @@
|
||||
|
||||
START=96
|
||||
|
||||
extra_command "turnon" "Put the LEDs into their default state"
|
||||
extra_command "turnoff" "Turn all LEDs off"
|
||||
extra_command "blink" "Blink all LEDs"
|
||||
|
||||
led_color_set() {
|
||||
local cfg="$1"
|
||||
local sysfs="$2"
|
||||
@@ -51,7 +47,6 @@ load_led() {
|
||||
local delayon
|
||||
local delayoff
|
||||
local interval
|
||||
local brightness
|
||||
|
||||
config_get sysfs $1 sysfs
|
||||
config_get name $1 name "$sysfs"
|
||||
@@ -68,7 +63,6 @@ load_led() {
|
||||
config_get message $1 message ""
|
||||
config_get gpio $1 gpio "0"
|
||||
config_get_bool inverted $1 inverted "0"
|
||||
config_get brightness $1 brightness
|
||||
|
||||
[ "$2" ] && [ "$sysfs" != "$2" ] && return
|
||||
|
||||
@@ -106,10 +100,8 @@ load_led() {
|
||||
[ "$default" = 0 ] &&
|
||||
echo 0 >/sys/class/leds/${sysfs}/brightness
|
||||
|
||||
[ "$default" = 1 ] && {
|
||||
[ -z "$brightness" ] && brightness="$(cat /sys/class/leds/${sysfs}/max_brightness)"
|
||||
echo "$brightness" > /sys/class/leds/${sysfs}/brightness
|
||||
}
|
||||
[ $default = 1 ] &&
|
||||
cat /sys/class/leds/${sysfs}/max_brightness > /sys/class/leds/${sysfs}/brightness
|
||||
|
||||
led_color_set "$1" "$sysfs"
|
||||
|
||||
@@ -176,31 +168,7 @@ load_led() {
|
||||
}
|
||||
}
|
||||
|
||||
turnoff() {
|
||||
for led in `ls /sys/class/leds/`; do
|
||||
echo 0 > /sys/class/leds/$led/brightness
|
||||
done
|
||||
}
|
||||
|
||||
turnon() {
|
||||
turnoff
|
||||
. /etc/diag.sh
|
||||
set_state done
|
||||
start
|
||||
}
|
||||
|
||||
blink() {
|
||||
for led in `ls /sys/class/leds/`; do
|
||||
echo 0 > /sys/class/leds/$led/brightness
|
||||
echo timer > /sys/class/leds/$led/trigger
|
||||
done
|
||||
}
|
||||
|
||||
start() {
|
||||
[ "$(uci -q get system.@system[-1].leds_off)" = '1' ] && {
|
||||
turnoff
|
||||
exit 0
|
||||
}
|
||||
[ -e /sys/class/leds/ ] && {
|
||||
[ -s /var/run/led.state ] && {
|
||||
local led trigger brightness color
|
||||
|
||||
@@ -9,8 +9,8 @@ validate_system_section() {
|
||||
'hostname:string:OpenWrt' \
|
||||
'conloglevel:uinteger' \
|
||||
'buffersize:uinteger' \
|
||||
'timezone:string:GMT0' \
|
||||
'zonename:string:UTC'
|
||||
'timezone:string:UTC' \
|
||||
'zonename:string'
|
||||
}
|
||||
|
||||
system_config() {
|
||||
|
||||
@@ -38,24 +38,3 @@ in order to prevent unauthorized SSH logins.
|
||||
--------------------------------------------------
|
||||
EOF
|
||||
fi
|
||||
|
||||
if [ -x /usr/bin/apk ]; then
|
||||
cat << EOF
|
||||
|
||||
OpenWrt recently switched to the "apk" package manager!
|
||||
|
||||
OPKG Command APK Equivalent Description
|
||||
------------------------------------------------------------------
|
||||
opkg install <pkg> apk add <pkg> Install a package
|
||||
opkg remove <pkg> apk del <pkg> Remove a package
|
||||
opkg upgrade apk upgrade Upgrade all packages
|
||||
opkg files <pkg> apk info -L <pkg> List package contents
|
||||
opkg list-installed apk info List installed packages
|
||||
opkg update apk update Update package lists
|
||||
opkg search <pkg> apk search <pkg> Search for packages
|
||||
------------------------------------------------------------------
|
||||
|
||||
For more https://openwrt.org/docs/guide-user/additional-software/opkg-to-apk-cheatsheet
|
||||
|
||||
EOF
|
||||
fi
|
||||
|
||||
@@ -23,7 +23,7 @@ released)
|
||||
elif [ "$SEEN" -ge 5 -a -n "$OVERLAY" ]
|
||||
then
|
||||
echo "FACTORY RESET" > /dev/console
|
||||
factoryreset -y && reboot &
|
||||
jffs2reset -y && reboot &
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -100,6 +100,10 @@ service_triggers() {
|
||||
return 0
|
||||
}
|
||||
|
||||
service_data() {
|
||||
return 0
|
||||
}
|
||||
|
||||
service_running() {
|
||||
local instance="${1:-*}"
|
||||
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
[ "$(uci -q get network.globals.dhcp_default_duid)" != "auto" ] && exit 0
|
||||
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
# DUID-UUID - RFC6355
|
||||
set network.globals.dhcp_default_duid="$(printf '%s%s' '0004' $(cat /proc/sys/kernel/random/uuid | sed -e 's/-//g'))"
|
||||
commit network
|
||||
EOF
|
||||
|
||||
exit 0
|
||||
@@ -216,10 +216,6 @@ default_prerm() {
|
||||
local filelist="${root}/usr/lib/opkg/info/${pkgname}.list"
|
||||
[ -f "$root/lib/apk/packages/${pkgname}.list" ] && filelist="$root/lib/apk/packages/${pkgname}.list"
|
||||
|
||||
if [ -e "$root/lib/apk/packages/${pkgname}.alternatives" ]; then
|
||||
update_alternatives remove "${pkgname}"
|
||||
fi
|
||||
|
||||
if [ -f "$root/usr/lib/opkg/info/${pkgname}.prerm-pkg" ]; then
|
||||
( . "$root/usr/lib/opkg/info/${pkgname}.prerm-pkg" )
|
||||
ret=$?
|
||||
@@ -356,7 +352,8 @@ default_postinst() {
|
||||
add_group_and_user "${pkgname}"
|
||||
fi
|
||||
|
||||
if [ -e "${root}/lib/apk/packages/${pkgname}.alternatives" ]; then
|
||||
if [ -e "${root}/lib/apk/packages/${pkgname}.list" ]; then
|
||||
filelist="${root}/lib/apk/packages/${pkgname}.list"
|
||||
update_alternatives install "${pkgname}"
|
||||
fi
|
||||
|
||||
@@ -447,7 +444,7 @@ find_mmc_part() {
|
||||
fi
|
||||
|
||||
for DEVNAME in /sys/block/$ROOTDEV/mmcblk*p*; do
|
||||
PARTNAME="$(grep PARTNAME ${DEVNAME}/uevent | cut -f2 -d'=' 2>/dev/null)"
|
||||
PARTNAME="$(grep PARTNAME ${DEVNAME}/uevent | cut -f2 -d'=')"
|
||||
[ "$PARTNAME" = "$1" ] && echo "/dev/$(basename $DEVNAME)" && return 0
|
||||
done
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -771,27 +771,6 @@ ucidef_add_wlan() {
|
||||
ucidef_wlan_idx="$((ucidef_wlan_idx + 1))"
|
||||
}
|
||||
|
||||
ucidef_set_interface_netdev_range() {
|
||||
local interface="$1"
|
||||
local base_netdev="$2"
|
||||
local start="$3"
|
||||
local stop="$4"
|
||||
local netdevs
|
||||
local i
|
||||
|
||||
if [ "$stop" -ge "$start" ]; then
|
||||
i="$start"
|
||||
netdevs="$base_netdev$i"
|
||||
|
||||
while [ "$i" -lt "$stop" ]; do
|
||||
i=$((i + 1))
|
||||
netdevs="$netdevs $base_netdev$i"
|
||||
done
|
||||
|
||||
ucidef_set_interface "$interface" device "$netdevs"
|
||||
fi
|
||||
}
|
||||
|
||||
board_config_update() {
|
||||
json_init
|
||||
[ -f ${CFG} ] && json_load "$(cat ${CFG})"
|
||||
|
||||
@@ -8,20 +8,13 @@ emmc_upgrade_tar() {
|
||||
[ "$CI_KERNPART" -a -z "$EMMC_KERN_DEV" ] && export EMMC_KERN_DEV="$(find_mmc_part $CI_KERNPART $CI_ROOTDEV)"
|
||||
[ "$CI_ROOTPART" -a -z "$EMMC_ROOT_DEV" ] && export EMMC_ROOT_DEV="$(find_mmc_part $CI_ROOTPART $CI_ROOTDEV)"
|
||||
[ "$CI_DATAPART" -a -z "$EMMC_DATA_DEV" ] && export EMMC_DATA_DEV="$(find_mmc_part $CI_DATAPART $CI_ROOTDEV)"
|
||||
[ "$CI_DTBPART" -a -z "$EMMC_DTB_DEV" ] && export EMMC_DTB_DEV="$(find_mmc_part $CI_DTBPART $CI_ROOTDEV)"
|
||||
local has_kernel
|
||||
local has_rootfs
|
||||
local has_dtb
|
||||
local gz
|
||||
local board_dir
|
||||
[ "$(identify_magic_long $(get_magic_long "$tar_file" cat))" = "gzip" ] && \
|
||||
gz="z"
|
||||
board_dir=$(tar t${gz}f "$tar_file" | grep -m 1 '^sysupgrade-.*/$')
|
||||
local board_dir=$(tar tf "$tar_file" | grep -m 1 '^sysupgrade-.*/$')
|
||||
board_dir=${board_dir%/}
|
||||
|
||||
tar t${gz}f "$tar_file" ${board_dir}/kernel 1>/dev/null 2>/dev/null && has_kernel=1
|
||||
tar t${gz}f "$tar_file" ${board_dir}/root 1>/dev/null 2>/dev/null && has_rootfs=1
|
||||
tar t${gz}f "$tar_file" ${board_dir}/dtb 1>/dev/null 2>/dev/null && has_dtb=1
|
||||
tar tf "$tar_file" ${board_dir}/kernel 1>/dev/null 2>/dev/null && has_kernel=1
|
||||
tar tf "$tar_file" ${board_dir}/root 1>/dev/null 2>/dev/null && has_rootfs=1
|
||||
|
||||
[ "$has_rootfs" = 1 -a "$EMMC_ROOT_DEV" ] && {
|
||||
# Invalidate kernel image while rootfs is being written
|
||||
@@ -30,16 +23,14 @@ emmc_upgrade_tar() {
|
||||
sync
|
||||
}
|
||||
|
||||
export EMMC_ROOTFS_BLOCKS=$(($(tar x${gz}f "$tar_file" ${board_dir}/root -O | dd of="$EMMC_ROOT_DEV" bs=512 2>&1 | grep "records out" | cut -d' ' -f1)))
|
||||
export EMMC_ROOTFS_BLOCKS=$(($(tar xf "$tar_file" ${board_dir}/root -O | dd of="$EMMC_ROOT_DEV" bs=512 2>&1 | grep "records out" | cut -d' ' -f1)))
|
||||
# Account for 64KiB ROOTDEV_OVERLAY_ALIGN in libfstools
|
||||
EMMC_ROOTFS_BLOCKS=$(((EMMC_ROOTFS_BLOCKS + 127) & ~127))
|
||||
sync
|
||||
}
|
||||
[ "$has_dtb" = 1 -a "$EMMC_DTB_DEV" ] &&
|
||||
export EMMC_DTB_BLOCKS=$(($(tar x${gz}f "$tar_file" ${board_dir}/dtb -O | dd of="$EMMC_DTB_DEV" bs=512 2>&1 | grep "records out" | cut -d' ' -f1)))
|
||||
|
||||
[ "$has_kernel" = 1 -a "$EMMC_KERN_DEV" ] &&
|
||||
export EMMC_KERNEL_BLOCKS=$(($(tar x${gz}f "$tar_file" ${board_dir}/kernel -O | dd of="$EMMC_KERN_DEV" bs=512 2>&1 | grep "records out" | cut -d' ' -f1)))
|
||||
export EMMC_KERNEL_BLOCKS=$(($(tar xf "$tar_file" ${board_dir}/kernel -O | dd of="$EMMC_KERN_DEV" bs=512 2>&1 | grep "records out" | cut -d' ' -f1)))
|
||||
|
||||
if [ -z "$UPGRADE_BACKUP" ]; then
|
||||
if [ "$EMMC_DATA_DEV" ]; then
|
||||
|
||||
@@ -42,9 +42,7 @@ fwtool_check_image() {
|
||||
v "Invalid image metadata"
|
||||
return 1
|
||||
}
|
||||
# Step 1. check if oem_name file exist and is not empty
|
||||
# If the above is true store the contents (b3000) in $oem value for later
|
||||
[ -s /tmp/sysinfo/oem_name ] && oem="$(cat /tmp/sysinfo/oem_name)"
|
||||
|
||||
device="$(cat /tmp/sysinfo/board_name)"
|
||||
devicecompat="$(uci -q get system.@system[0].compat_version)"
|
||||
[ -n "$devicecompat" ] || devicecompat="1.0"
|
||||
@@ -63,16 +61,7 @@ fwtool_check_image() {
|
||||
json_get_keys dev_keys
|
||||
for k in $dev_keys; do
|
||||
json_get_var dev "$k"
|
||||
# Step 2.
|
||||
# lets start with the original case [ "$dev" = "$device" ]
|
||||
# if the evaluated firmware is vanila openwrt, this evals as true -ie
|
||||
# [ ("$dev" == "glinet.gl-b3000") == ("$device" == "glinet,gl-b3000") ]
|
||||
# however if the firmware is oem then $dev = b3000 and the above check fails resulting
|
||||
# in the erroneous warnings.
|
||||
# so we add the secondary check [ "$dev" = "$oem" ];
|
||||
# If in Step 1 the oem_file was found and valid, the $oem == "b3000" so
|
||||
# [ ("$dev" == "b3000) == ("$oem" == "b3000") ] so firmware is valid oem
|
||||
if [ "$dev" = "$device" ] || [ "$dev" = "$oem" ]; then
|
||||
if [ "$dev" = "$device" ]; then
|
||||
# major compat version -> no sysupgrade
|
||||
if [ "${devicecompat%.*}" != "${imagecompat%.*}" ]; then
|
||||
v "The device is supported, but this image is incompatible for sysupgrade based on the image version ($devicecompat->$imagecompat)."
|
||||
@@ -81,16 +70,7 @@ fwtool_check_image() {
|
||||
fi
|
||||
|
||||
# minor compat version -> sysupgrade with -n required
|
||||
# Step 3.
|
||||
# here we must check if $dev == $oem to use this native compatability check
|
||||
# so we add the check for [ "$dev" = "$oem" ]
|
||||
if (([ "${devicecompat#.*}" != "${imagecompat#.*}" ] || [ "$dev" = "$oem" ])) && [ "$SAVE_CONFIG" = "1" ]; then
|
||||
# Step 4.
|
||||
# here we have to gaurd against the default case, oem may exsist and default will pass
|
||||
# the original check [ "${devicecompat#.*}" != "${imagecompat#.*}" ] so we must
|
||||
# explicitly check $dev == $oem, if it is we update(reuse) the $devicecompat and imagecompat
|
||||
# variable to reflect the case - ( Openwrt -> OEM )
|
||||
[ "$dev" = "$oem" ] && devicecompat="Openwrt " && imagecompat=" OEM"
|
||||
if [ "${devicecompat#.*}" != "${imagecompat#.*}" ] && [ "$SAVE_CONFIG" = "1" ]; then
|
||||
[ "$IGNORE_MINOR_COMPAT" = 1 ] && return 0
|
||||
v "The device is supported, but the config is incompatible to the new image ($devicecompat->$imagecompat). Please upgrade without keeping config (sysupgrade -n)."
|
||||
[ -n "$compatmessage" ] && v "$compatmessage"
|
||||
|
||||
@@ -217,16 +217,6 @@ nand_upgrade_prepare_ubi() {
|
||||
[ "$root_ubivol" ] && ubirmvol /dev/$root_ubidev -N "$CI_ROOTPART" || :
|
||||
[ "$data_ubivol" ] && ubirmvol /dev/$root_ubidev -N rootfs_data || :
|
||||
|
||||
# create provisioning vol
|
||||
if [ "${UPGRADE_OPT_ADD_PROVISIONING:-0}" -gt 0 ]; then
|
||||
[ -n "$(nand_find_volume $root_ubidev provisioning)" ] || {
|
||||
if ! ubimkvol /dev/$root_ubidev -N provisioning -s 131072; then
|
||||
echo "cannot create provisioning volume"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
fi
|
||||
|
||||
# create kernel vol
|
||||
if [ -n "$kernel_length" ]; then
|
||||
if ! ubimkvol /dev/$kern_ubidev -N "$CI_KERNPART" -s $kernel_length; then
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
/sbin/factoryreset $@
|
||||
/sbin/jffs2reset $@
|
||||
|
||||
@@ -11,7 +11,6 @@ INSTALLED_PACKAGES=${ETCBACKUP_DIR}/installed_packages.txt
|
||||
COMMAND=/lib/upgrade/do_stage2
|
||||
|
||||
# File-local globals
|
||||
ADD_PROVISIONING=0
|
||||
SAVE_OVERLAY=0
|
||||
SAVE_OVERLAY_PATH=
|
||||
SAVE_PARTITIONS=1
|
||||
@@ -21,7 +20,6 @@ CONF_IMAGE=
|
||||
CONF_BACKUP_LIST=0
|
||||
CONF_BACKUP=
|
||||
CONF_RESTORE=
|
||||
USE_CURR_PART=0
|
||||
NEED_IMAGE=
|
||||
HELP=0
|
||||
TEST=0
|
||||
@@ -46,14 +44,12 @@ while [ -n "$1" ]; do
|
||||
-c) SAVE_OVERLAY=1 SAVE_OVERLAY_PATH=/etc;;
|
||||
-o) SAVE_OVERLAY=1 SAVE_OVERLAY_PATH=/;;
|
||||
-p) SAVE_PARTITIONS=0;;
|
||||
-P) ADD_PROVISIONING=1;;
|
||||
-k) SAVE_INSTALLED_PKGS=1;;
|
||||
-u) SKIP_UNCHANGED=1;;
|
||||
-b|--create-backup) CONF_BACKUP="$2" NEED_IMAGE=1; shift;;
|
||||
-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;;
|
||||
@@ -70,7 +66,7 @@ done
|
||||
print_help() {
|
||||
cat <<EOF
|
||||
Usage: $0 [<upgrade-option>...] <image file or URL>
|
||||
$0 [-q] [-i] [-c] [-u] [-o] [-k] [-P] <backup-command> <file>
|
||||
$0 [-q] [-i] [-c] [-u] [-o] [-k] <backup-command> <file>
|
||||
|
||||
upgrade-option:
|
||||
-f <config> restore configuration from .tar.gz (file or url)
|
||||
@@ -83,9 +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)
|
||||
-P create provisioning partition to keep sensitive data across
|
||||
factory resets.
|
||||
-T | --test
|
||||
Verify image and config .tar.gz but do not actually flash.
|
||||
-F | --force
|
||||
@@ -273,12 +266,12 @@ create_backup_archive() {
|
||||
|
||||
if [ $ret -eq 0 ]; then
|
||||
for service in /etc/init.d/*; do
|
||||
if ! $service enabled >/dev/null 2>&1; then
|
||||
if ! $service enabled; then
|
||||
disabled="$disabled$service disable\n"
|
||||
fi
|
||||
done
|
||||
disabled="$disabled\nexit 0"
|
||||
tar_print_member "/etc/uci-defaults/10_disable_services" "$(echo -e $disabled)" "$(date -r /etc/rc.d "+%s")" || ret=1
|
||||
tar_print_member "/etc/uci-defaults/10_disable_services" "$(echo -e $disabled)" || ret=1
|
||||
fi
|
||||
|
||||
# Part of archive with installed packages info
|
||||
@@ -286,19 +279,11 @@ create_backup_archive() {
|
||||
if [ "$SAVE_INSTALLED_PKGS" -eq 1 ]; then
|
||||
# Format: pkg-name<TAB>{rom,overlay,unknown}
|
||||
# rom is used for pkgs in /rom, even if updated later
|
||||
if [ -d "/usr/lib/opkg/info" ]; then
|
||||
tar_print_member "$INSTALLED_PACKAGES" "$(find /usr/lib/opkg/info -name "*.control" \( \
|
||||
\( -exec test -f /rom/{} \; -exec echo {} rom \; \) -o \
|
||||
\( -exec test -f /overlay/upper/{} \; -exec echo {} overlay \; \) -o \
|
||||
\( -exec echo {} unknown \; \) \
|
||||
\) | sed -e 's,.*/,,;s/\.control /\t/')" || ret=1
|
||||
elif [ -d "/lib/apk/packages" ]; then
|
||||
tar_print_member "$INSTALLED_PACKAGES" "$(find /lib/apk/packages -name "*.list" \( \
|
||||
\( -exec test -f /rom/{} \; -exec echo {} rom \; \) -o \
|
||||
\( -exec test -f /overlay/upper/{} \; -exec echo {} overlay \; \) -o \
|
||||
\( -exec echo {} unknown \; \) \
|
||||
\) | sed -e 's,.*/,,;s/\.list /\t/')" || ret=1
|
||||
fi
|
||||
tar_print_member "$INSTALLED_PACKAGES" "$(find /usr/lib/opkg/info -name "*.control" \( \
|
||||
\( -exec test -f /rom/{} \; -exec echo {} rom \; \) -o \
|
||||
\( -exec test -f /overlay/upper/{} \; -exec echo {} overlay \; \) -o \
|
||||
\( -exec echo {} unknown \; \) \
|
||||
\) | sed -e 's,.*/,,;s/\.control /\t/')" || ret=1
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -384,9 +369,8 @@ json_load "$(/usr/libexec/validate_firmware_image "$IMAGE")" || {
|
||||
exit 1
|
||||
}
|
||||
json_get_var valid "valid"
|
||||
json_get_var forceable "forceable"
|
||||
[ "$valid" -eq 0 ] && {
|
||||
if [ $FORCE -eq 1 ] && [ "$forceable" -eq 1 ]; then
|
||||
if [ $FORCE -eq 1 ]; then
|
||||
echo "Image check failed but --force given - will update anyway!" >&2
|
||||
else
|
||||
echo "Image check failed." >&2
|
||||
@@ -432,8 +416,6 @@ else
|
||||
json_add_string command "$COMMAND"
|
||||
json_add_object options
|
||||
json_add_int save_partitions "$SAVE_PARTITIONS"
|
||||
json_add_int add_provisioning "$ADD_PROVISIONING"
|
||||
[ $USE_CURR_PART -eq 1 ] && json_add_boolean use_curr_part 1
|
||||
json_close_object
|
||||
|
||||
ubus call system sysupgrade "$(json_dump)"
|
||||
|
||||
@@ -7,7 +7,6 @@ VERSION_ID="%v"
|
||||
HOME_URL="%u"
|
||||
BUG_URL="%b"
|
||||
SUPPORT_URL="%s"
|
||||
FIRMWARE_URL="%f"
|
||||
BUILD_ID="%R"
|
||||
OPENWRT_BOARD="%S"
|
||||
OPENWRT_ARCH="%A"
|
||||
|
||||
@@ -56,17 +56,7 @@ json_init
|
||||
# Call platform_check_image() here so it can add its test
|
||||
# results and still mark image properly.
|
||||
json_set_namespace $old_ns
|
||||
platform_check_image "$1" >&2
|
||||
case "$?" in
|
||||
0)
|
||||
;;
|
||||
74)
|
||||
notify_firmware_broken
|
||||
;;
|
||||
*)
|
||||
notify_firmware_invalid
|
||||
;;
|
||||
esac
|
||||
platform_check_image "$1" >&2 || notify_firmware_invalid
|
||||
json_set_namespace validate_firmware_image old_ns
|
||||
json_close_object
|
||||
json_add_boolean valid "$VALID"
|
||||
|
||||
@@ -190,7 +190,7 @@ if VERSIONOPT
|
||||
config VERSION_REPO
|
||||
string
|
||||
prompt "Release repository"
|
||||
default "https://downloads.openwrt.org/snapshots"
|
||||
default "https://downloads.openwrt.org/releases/24.10.0-rc2"
|
||||
help
|
||||
This is the repository address embedded in the image, it defaults
|
||||
to the trunk snapshot repo; the url may contain the following placeholders:
|
||||
@@ -241,12 +241,6 @@ if VERSIONOPT
|
||||
help
|
||||
This an URL to provide users seeking support
|
||||
|
||||
config VERSION_FIRMWARE_URL
|
||||
string
|
||||
prompt "Firmware URL"
|
||||
help
|
||||
This is an URL to provide users for downloading firmware
|
||||
|
||||
config VERSION_PRODUCT
|
||||
string
|
||||
prompt "Product name"
|
||||
@@ -272,7 +266,7 @@ if VERSIONOPT
|
||||
config VERSION_CODE_FILENAMES
|
||||
bool
|
||||
prompt "Revision code in filenames"
|
||||
default y
|
||||
default n
|
||||
help
|
||||
Enable this to include the revision identifier or the configured
|
||||
version code into the firmware image, SDK- and Image Builder archive
|
||||
|
||||
@@ -33,7 +33,6 @@ TFA_TARGETS:= \
|
||||
bcm4908
|
||||
|
||||
TFA_MAKE_FLAGS += \
|
||||
$(if $(CONFIG_BINUTILS_VERSION_2_37)$(CONFIG_BINUTILS_VERSION_2_38),,LDFLAGS="-no-warn-rwx-segments") \
|
||||
BRCM_CHIP=$(BRCM_CHIP)
|
||||
|
||||
define Package/trusted-firmware-a/install
|
||||
|
||||
@@ -9,13 +9,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=arm-trusted-firmware-mediatek
|
||||
PKG_RELEASE:=1
|
||||
PKG_RELEASE:=3
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL=https://github.com/mtk-openwrt/arm-trusted-firmware.git
|
||||
PKG_SOURCE_DATE:=2025-07-11
|
||||
PKG_SOURCE_VERSION:=78a0dfd927bb00ce973a1f8eb4079df0f755887a
|
||||
PKG_MIRROR_HASH:=72a5f3f00f9e368226bb779dc098aac6195a312b48cc22172987d494ccd135d1
|
||||
PKG_SOURCE_DATE:=2024-01-17
|
||||
PKG_SOURCE_VERSION:=bacca82a8cac369470df052a9d801a0ceb9b74ca
|
||||
PKG_MIRROR_HASH:=1138649f64ac3982330925c38c795ca6860289adbd95755991f80afa30ebdea7
|
||||
|
||||
PKG_MAINTAINER:=Daniel Golle <daniel@makrotopia.org>
|
||||
|
||||
@@ -29,16 +29,12 @@ define Trusted-Firmware-A/Default
|
||||
HIDDEN:=y
|
||||
BOOT_DEVICE:=
|
||||
DDR3_FLYBY:=
|
||||
DDR3_FREQ_1866:=
|
||||
DDR_TYPE:=
|
||||
NAND_TYPE:=
|
||||
BOARD_QFN:=
|
||||
DRAM_USE_COMB:=
|
||||
RAM_BOOT_UART_DL:=
|
||||
USE_UBI:=
|
||||
FIP_OFFSET:=
|
||||
FIP_SIZE:=
|
||||
SPIM_CTRL:=
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7622-nor-1ddr
|
||||
@@ -180,7 +176,6 @@ define Trusted-Firmware-A/mt7981-ram-ddr3
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7981
|
||||
DDR_TYPE:=ddr3
|
||||
DDR3_FREQ_1866:=1
|
||||
RAM_BOOT_UART_DL:=1
|
||||
HIDDEN:=
|
||||
DEFAULT:=TARGET_mediatek_filogic
|
||||
@@ -202,15 +197,6 @@ define Trusted-Firmware-A/mt7981-emmc-ddr3
|
||||
DDR_TYPE:=ddr3
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7981-emmc-ddr3-1866mhz
|
||||
NAME:=MediaTek MT7981 (eMMC, DDR3 1866 MHz)
|
||||
BOOT_DEVICE:=emmc
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7981
|
||||
DDR_TYPE:=ddr3
|
||||
DDR3_FREQ_1866:=1
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7981-sdmmc-ddr3
|
||||
NAME:=MediaTek MT7981 (SD card, DDR3)
|
||||
BOOT_DEVICE:=sdmmc
|
||||
@@ -235,25 +221,6 @@ define Trusted-Firmware-A/mt7981-spim-nand-ddr3
|
||||
DDR_TYPE:=ddr3
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7981-spim-nand-ddr3-1866mhz
|
||||
NAME:=MediaTek MT7981 (SPI-NAND via SPIM, DDR3 1866 MHz)
|
||||
BOOT_DEVICE:=spim-nand
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7981
|
||||
DDR_TYPE:=ddr3
|
||||
DDR3_FREQ_1866:=1
|
||||
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
|
||||
@@ -385,70 +352,6 @@ define Trusted-Firmware-A/mt7986-spim-nand-ddr3
|
||||
DDR_TYPE:=ddr3
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7986-spim-nand-ubi-ddr3
|
||||
NAME:=MediaTek MT7986 (SPI-NAND via SPIM using UBI, DDR3)
|
||||
BOOT_DEVICE:=spim-nand
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7986
|
||||
DDR_TYPE:=ddr3
|
||||
USE_UBI:=1
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7987-emmc-comb
|
||||
NAME:=MediaTek MT7987 (eMMC)
|
||||
BOOT_DEVICE:=emmc
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7987
|
||||
DRAM_USE_COMB:=1
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7987-nor-comb
|
||||
NAME:=MediaTek MT7987 (NOR)
|
||||
BOOT_DEVICE:=nor
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7987
|
||||
DRAM_USE_COMB:=1
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7987-sdmmc-comb
|
||||
NAME:=MediaTek MT7987 (SD card)
|
||||
BOOT_DEVICE:=sdmmc
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7987
|
||||
DRAM_USE_COMB:=1
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7987-spim-nand0-ubi-comb
|
||||
NAME:=MediaTek MT7987 (SPI-NAND via SPIM, UBI)
|
||||
BOOT_DEVICE:=spim-nand
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7987
|
||||
DRAM_USE_COMB:=1
|
||||
USE_UBI:=1
|
||||
SPIM_CTRL:=0
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7987-spim-nand2-ubi-comb
|
||||
NAME:=MediaTek MT7987 (SPI-NAND via SPIM, UBI)
|
||||
BOOT_DEVICE:=spim-nand
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7987
|
||||
DRAM_USE_COMB:=1
|
||||
USE_UBI:=1
|
||||
SPIM_CTRL:=2
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7987-ram-comb
|
||||
NAME:=MediaTek MT7987 (RAM)
|
||||
BOOT_DEVICE:=ram
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7987
|
||||
DRAM_USE_COMB:=1
|
||||
RAM_BOOT_UART_DL:=1
|
||||
HIDDEN:=
|
||||
DEFAULT:=TARGET_mediatek_filogic
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7988-nor-ddr3
|
||||
NAME:=MediaTek MT7988 (SPI-NOR, DDR3)
|
||||
BOOT_DEVICE:=nor
|
||||
@@ -540,17 +443,6 @@ define Trusted-Firmware-A/mt7988-ram-comb
|
||||
DEFAULT:=TARGET_mediatek_filogic
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7988-ram-ddr4
|
||||
NAME:=MediaTek MT7988 (RAM/ddr4)
|
||||
BOOT_DEVICE:=ram
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7988
|
||||
RAM_BOOT_UART_DL:=1
|
||||
HIDDEN:=
|
||||
DEFAULT:=TARGET_mediatek_filogic
|
||||
DDR_TYPE:=ddr4
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7988-nor-comb
|
||||
NAME:=MediaTek MT7988 (SPI-NOR)
|
||||
BOOT_DEVICE:=nor
|
||||
@@ -609,15 +501,6 @@ define Trusted-Firmware-A/mt7988-spim-nand-ubi-comb
|
||||
USE_UBI:=1
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7988-spim-nand-ubi-ddr4
|
||||
NAME:=MediaTek MT7988 (SPI-NAND via SPIM, DDR4)
|
||||
BOOT_DEVICE:=spim-nand
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7988
|
||||
DDR_TYPE:=ddr4
|
||||
USE_UBI:=1
|
||||
endef
|
||||
|
||||
TFA_TARGETS:= \
|
||||
mt7622-nor-1ddr \
|
||||
mt7622-nor-2ddr \
|
||||
@@ -633,25 +516,21 @@ TFA_TARGETS:= \
|
||||
mt7622-sdmmc-2ddr \
|
||||
mt7981-ram-ddr3 \
|
||||
mt7981-emmc-ddr3 \
|
||||
mt7981-emmc-ddr3-1866mhz \
|
||||
mt7981-nor-ddr3 \
|
||||
mt7981-nor-ddr4 \
|
||||
mt7981-sdmmc-ddr3 \
|
||||
mt7981-snand-ddr3 \
|
||||
mt7981-spim-nand-ddr3 \
|
||||
mt7981-spim-nand-ddr3-1866mhz \
|
||||
mt7981-spim-nand-ubi-ddr4 \
|
||||
mt7981-ram-ddr4 \
|
||||
mt7981-emmc-ddr4 \
|
||||
mt7981-spim-nand-ddr4 \
|
||||
mt7981-cudy-tr3000-v1 \
|
||||
mt7986-ram-ddr3 \
|
||||
mt7986-emmc-ddr3 \
|
||||
mt7986-nor-ddr3 \
|
||||
mt7986-sdmmc-ddr3 \
|
||||
mt7986-snand-ddr3 \
|
||||
mt7986-spim-nand-ddr3 \
|
||||
mt7986-spim-nand-ubi-ddr3 \
|
||||
mt7986-ram-ddr4 \
|
||||
mt7986-emmc-ddr4 \
|
||||
mt7986-nor-ddr4 \
|
||||
@@ -660,12 +539,6 @@ TFA_TARGETS:= \
|
||||
mt7986-spim-nand-ddr4 \
|
||||
mt7986-spim-nand-ubi-ddr4 \
|
||||
mt7986-spim-nand-4k-ddr4 \
|
||||
mt7987-emmc-comb \
|
||||
mt7987-nor-comb \
|
||||
mt7987-sdmmc-comb \
|
||||
mt7987-spim-nand0-ubi-comb \
|
||||
mt7987-spim-nand2-ubi-comb \
|
||||
mt7987-ram-comb \
|
||||
mt7988-emmc-ddr3 \
|
||||
mt7988-nor-ddr3 \
|
||||
mt7988-sdmmc-ddr3 \
|
||||
@@ -677,15 +550,13 @@ TFA_TARGETS:= \
|
||||
mt7988-snand-ddr4 \
|
||||
mt7988-spim-nand-ddr4 \
|
||||
mt7988-ram-comb \
|
||||
mt7988-ram-ddr4 \
|
||||
mt7988-emmc-comb \
|
||||
mt7988-nor-comb \
|
||||
mt7988-sdmmc-comb \
|
||||
mt7988-snand-comb \
|
||||
mt7988-snand-ubi-comb \
|
||||
mt7988-spim-nand-comb \
|
||||
mt7988-spim-nand-ubi-comb \
|
||||
mt7988-spim-nand-ubi-ddr4
|
||||
mt7988-spim-nand-ubi-comb
|
||||
|
||||
TFA_MAKE_FLAGS += \
|
||||
BOOT_DEVICE=$(BOOT_DEVICE) \
|
||||
@@ -695,15 +566,10 @@ TFA_MAKE_FLAGS += \
|
||||
$(if $(NAND_TYPE),NAND_TYPE=$(NAND_TYPE)) \
|
||||
HAVE_DRAM_OBJ_FILE=yes \
|
||||
$(if $(DDR3_FLYBY),DDR3_FLYBY=1) \
|
||||
$(if $(DDR3_FREQ_1866),DDR3_FREQ_1866=1) \
|
||||
$(if $(DRAM_USE_COMB),DRAM_USE_COMB=1) \
|
||||
$(if $(RAM_BOOT_UART_DL),RAM_BOOT_UART_DL=1) \
|
||||
$(if $(USE_UBI),UBI=1 $(if $(findstring mt7622,$(PLAT)),OVERRIDE_UBI_START_ADDR=0x80000)) \
|
||||
$(if $(USE_UBI),UBI=1 $(if $(findstring mt7981,$(PLAT)),OVERRIDE_UBI_START_ADDR=0x100000)) \
|
||||
$(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 $(SPIM_CTRL),SPIM_CTRL=$(SPIM_CTRL)) \
|
||||
$(if $(RAM_BOOT_UART_DL),bl2,all)
|
||||
|
||||
define Package/trusted-firmware-a-ram/install
|
||||
@@ -716,9 +582,7 @@ Package/trusted-firmware-a-mt7981-ram-ddr3/install = $(Package/trusted-firmware-
|
||||
Package/trusted-firmware-a-mt7981-ram-ddr4/install = $(Package/trusted-firmware-a-ram/install)
|
||||
Package/trusted-firmware-a-mt7986-ram-ddr3/install = $(Package/trusted-firmware-a-ram/install)
|
||||
Package/trusted-firmware-a-mt7986-ram-ddr4/install = $(Package/trusted-firmware-a-ram/install)
|
||||
Package/trusted-firmware-a-mt7987-ram-comb/install = $(Package/trusted-firmware-a-ram/install)
|
||||
Package/trusted-firmware-a-mt7988-ram-comb/install = $(Package/trusted-firmware-a-ram/install)
|
||||
Package/trusted-firmware-a-mt7988-ram-ddr4/install = $(Package/trusted-firmware-a-ram/install)
|
||||
|
||||
define Package/trusted-firmware-a/install
|
||||
$(INSTALL_DIR) $(STAGING_DIR_IMAGE)
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
From fd057aba83aea8458986e11c81dbb75a69468b84 Mon Sep 17 00:00:00 2001
|
||||
From: Mikhail Zhilkin <csharper2005@gmail.com>
|
||||
Date: Wed, 13 Aug 2025 22:46:54 +0300
|
||||
Subject: arm-trusted-firmware-mediatek: add FudanMicro manufacturer
|
||||
|
||||
Add FudanMicro manufacturer.
|
||||
|
||||
Signed-off-by: Mikhail Zhilkin <csharper2005@gmail.com>
|
||||
---
|
||||
|
||||
--- a/plat/mediatek/apsoc_common/drivers/spi_nand/mtk_spi_nand.c
|
||||
+++ b/plat/mediatek/apsoc_common/drivers/spi_nand/mtk_spi_nand.c
|
||||
@@ -21,6 +21,7 @@
|
||||
#define SPI_NAND_MAX_ID_LEN 4U
|
||||
#define DELAY_US_400MS 400000U
|
||||
#define ETRON_ID 0xD5U
|
||||
+#define FUDAN_ID 0xA1U
|
||||
#define GIGADEVICE_ID 0xC8U
|
||||
#define MACRONIX_ID 0xC2U
|
||||
#define MICRON_ID 0x2CU
|
||||
@@ -146,7 +147,8 @@ static int spi_nand_quad_enable(uint8_t
|
||||
if (manufacturer_id != MACRONIX_ID &&
|
||||
manufacturer_id != GIGADEVICE_ID &&
|
||||
manufacturer_id != ETRON_ID &&
|
||||
- manufacturer_id != FORESEE_ID) {
|
||||
+ manufacturer_id != FORESEE_ID &&
|
||||
+ manufacturer_id != FUDAN_ID) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -543,6 +545,10 @@ static int spi_nand_check_pp(struct para
|
||||
INFO("PP COPY %d CRC read: 0x%x, compute: 0x%x\n",
|
||||
i, crc, crc_compute);
|
||||
|
||||
+ // FUDAN integrity CRC (bytes 254-255) is reversed
|
||||
+ if (crc != crc_compute)
|
||||
+ crc = htobe16(pp->integrity_crc);
|
||||
+
|
||||
if (crc != crc_compute) {
|
||||
ret = -EBADMSG;
|
||||
continue;
|
||||
@@ -0,0 +1,27 @@
|
||||
From 94802b344195d3574701ca6ab5122f6b7615a6eb Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Golle <daniel@makrotopia.org>
|
||||
Date: Sun, 11 Aug 2024 23:12:33 +0100
|
||||
Subject: [PATCH] mediatek: snfi: fix return code when reading
|
||||
|
||||
Return 0 on succesful read, which may contain correctable bitflips.
|
||||
|
||||
Fixes: #10
|
||||
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
---
|
||||
plat/mediatek/apsoc_common/bl2/bl2_dev_snfi_init.c | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/plat/mediatek/apsoc_common/bl2/bl2_dev_snfi_init.c
|
||||
+++ b/plat/mediatek/apsoc_common/bl2/bl2_dev_snfi_init.c
|
||||
@@ -29,8 +29,10 @@ static int snfi_mtd_read_page(struct nan
|
||||
int ret;
|
||||
|
||||
ret = mtk_snand_read_page(snf, addr, (void *)buffer, NULL, false);
|
||||
- if (ret == -EBADMSG)
|
||||
+ if (ret > 0) {
|
||||
+ NOTICE("corrected %d bitflips while reading page %u\n", ret, page);
|
||||
ret = 0;
|
||||
+ }
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -1,128 +0,0 @@
|
||||
From e2e43103c00b5f7ccedbdbdece0f622cb420b4a5 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Golle <daniel@makrotopia.org>
|
||||
Date: Fri, 3 Oct 2025 12:53:10 +0100
|
||||
Subject: [PATCH] mt7987: make SPI controller configurable
|
||||
|
||||
Allow selecting the SPI controller used for SPIM-NAND or SPI-NOR boot
|
||||
devices (either SPI0 or SPI2).
|
||||
|
||||
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
---
|
||||
plat/mediatek/apsoc_common/Config.in | 1 +
|
||||
plat/mediatek/mt7987/Config.in | 29 +++++++++++++++++++++
|
||||
plat/mediatek/mt7987/bl2/bl2.mk | 12 +++++++++
|
||||
plat/mediatek/mt7987/bl2/bl2_dev_spi_nand.c | 10 ++++++-
|
||||
plat/mediatek/mt7987/platform.mk | 4 +--
|
||||
5 files changed, 53 insertions(+), 3 deletions(-)
|
||||
create mode 100644 plat/mediatek/mt7987/Config.in
|
||||
|
||||
--- a/plat/mediatek/apsoc_common/Config.in
|
||||
+++ b/plat/mediatek/apsoc_common/Config.in
|
||||
@@ -783,6 +783,7 @@ config ENABLE_BL31_RUNTIME_LOG
|
||||
default 1
|
||||
depends on _ENABLE_BL31_RUNTIME_LOG
|
||||
|
||||
+source "plat/mediatek/mt7987/Config.in"
|
||||
source "plat/mediatek/mt7988/Config.in"
|
||||
|
||||
endmenu # Platform configurations
|
||||
--- /dev/null
|
||||
+++ b/plat/mediatek/mt7987/Config.in
|
||||
@@ -0,0 +1,29 @@
|
||||
+# SPDX-License-Identifier: BSD-3-Clause
|
||||
+#
|
||||
+# Copyright (c) 2025 Daniel Golle <daniel@makrotopia.org>
|
||||
+#
|
||||
+# MT7987 platform-specific configurations
|
||||
+#
|
||||
+
|
||||
+if _PLAT_MT7987
|
||||
+
|
||||
+choice
|
||||
+ prompt "SPI controller"
|
||||
+ depends on (_BOOT_DEVICE_SPIM_NAND || _BOOT_DEVICE_SPI_NOR)
|
||||
+ default _SPIM_CTRL_0 if _BOOT_DEVICE_SPIM_NAND
|
||||
+ default _SPIM_CTRL_2 if _BOOT_DEVICE_SPI_NOR
|
||||
+
|
||||
+ config _SPIM_CTRL_0
|
||||
+ bool "0"
|
||||
+
|
||||
+ config _SPIM_CTRL_2
|
||||
+ bool "2"
|
||||
+
|
||||
+endchoice
|
||||
+
|
||||
+config SPIM_CTRL
|
||||
+ int
|
||||
+ default 0 if _SPIM_CTRL_0
|
||||
+ default 2 if _SPIM_CTRL_2
|
||||
+
|
||||
+endif # _PLAT_MT7987
|
||||
--- a/plat/mediatek/mt7987/bl2/bl2.mk
|
||||
+++ b/plat/mediatek/mt7987/bl2/bl2.mk
|
||||
@@ -91,7 +91,11 @@ endif # END OF BOOT_DEVICE = ram
|
||||
ifeq ($(BOOT_DEVICE),nor)
|
||||
$(eval $(call BL2_BOOT_NOR))
|
||||
BL2_SOURCES += $(MTK_PLAT_SOC)/bl2/bl2_dev_spi_nor.c
|
||||
+ifeq ($(SPIM_CTRL),0)
|
||||
+DTS_NAME := mt7987-spi0
|
||||
+else
|
||||
DTS_NAME := mt7987-spi2
|
||||
+endif
|
||||
endif # END OF BOOTDEVICE = nor
|
||||
|
||||
ifeq ($(BOOT_DEVICE),emmc)
|
||||
@@ -112,10 +116,18 @@ ifeq ($(BOOT_DEVICE),spim-nand)
|
||||
$(eval $(call BL2_BOOT_SPI_NAND,0,0))
|
||||
BL2_SOURCES += $(MTK_PLAT_SOC)/bl2/bl2_dev_spi_nand.c
|
||||
NAND_TYPE ?= spim:2k+64
|
||||
+ifeq ($(SPIM_CTRL),2)
|
||||
+DTS_NAME := mt7987-spi2
|
||||
+else
|
||||
DTS_NAME := mt7987-spi0
|
||||
+endif
|
||||
$(eval $(call BL2_BOOT_NAND_TYPE_CHECK,$(NAND_TYPE),spim:2k+64 spim:2k+128 spim:4k+256))
|
||||
endif # END OF BOOTDEVICE = spim-nand
|
||||
|
||||
+ifneq ($(SPIM_CTRL),)
|
||||
+BL2_CPPFLAGS += -DSPIM_CTRL=$(SPIM_CTRL)
|
||||
+endif
|
||||
+
|
||||
ifeq ($(BROM_HEADER_TYPE),)
|
||||
$(error BOOT_DEVICE has invalid value. Please re-check.)
|
||||
endif
|
||||
--- a/plat/mediatek/mt7987/bl2/bl2_dev_spi_nand.c
|
||||
+++ b/plat/mediatek/mt7987/bl2/bl2_dev_spi_nand.c
|
||||
@@ -12,10 +12,18 @@
|
||||
|
||||
#define MTK_QSPI_SRC_CLK CB_MPLL_D2
|
||||
|
||||
+#if SPIM_CTRL == 0
|
||||
+#define SELECTED_SPIM SPIM0
|
||||
+#elif SPIM_CTRL == 2
|
||||
+#define SELECTED_SPIM SPIM2
|
||||
+#else
|
||||
+#error "Invalid SPI controller selection"
|
||||
+#endif
|
||||
+
|
||||
uint32_t mtk_plat_get_qspi_src_clk(void)
|
||||
{
|
||||
/* config GPIO pinmux to spi mode */
|
||||
- mtk_spi_gpio_init(SPIM0);
|
||||
+ mtk_spi_gpio_init(SELECTED_SPIM);
|
||||
|
||||
/* select 208M clk */
|
||||
mtk_spi_source_clock_select(MTK_QSPI_SRC_CLK);
|
||||
--- a/plat/mediatek/mt7987/platform.mk
|
||||
+++ b/plat/mediatek/mt7987/platform.mk
|
||||
@@ -56,8 +56,8 @@ include make_helpers/dep.mk
|
||||
|
||||
$(call GEN_DEP_RULES,bl2,emicfg bl2_boot_ram bl2_boot_nand_nmbm bl2_dev_mmc bl2_plat_init bl2_plat_setup mt7987_gpio dtb)
|
||||
$(call MAKE_DEP,bl2,emicfg,DDR4_4BG_MODE DRAM_DEBUG_LOG DDR3_FREQ_2133 DDR3_FREQ_1866 DDR4_FREQ_3200 DDR4_FREQ_2666)
|
||||
-$(call MAKE_DEP,bl2,bl2_plat_init,BL2_COMPRESS)
|
||||
-$(call MAKE_DEP,bl2,bl2_plat_setup,BOOT_DEVICE TRUSTED_BOARD_BOOT BL32_TZRAM_BASE BL32_TZRAM_SIZE BL32_LOAD_OFFSET)
|
||||
+$(call MAKE_DEP,bl2,bl2_plat_init,BL2_COMPRESS SPIM_CTRL)
|
||||
+$(call MAKE_DEP,bl2,bl2_plat_setup,BOOT_DEVICE TRUSTED_BOARD_BOOT BL32_TZRAM_BASE BL32_TZRAM_SIZE BL32_LOAD_OFFSET SPIM_CTRL)
|
||||
$(call MAKE_DEP,bl2,bl2_dev_mmc,BOOT_DEVICE)
|
||||
$(call MAKE_DEP,bl2,bl2_boot_ram,RAM_BOOT_DEBUGGER_HOOK RAM_BOOT_UART_DL)
|
||||
$(call MAKE_DEP,bl2,bl2_boot_nand_nmbm,NMBM_MAX_RATIO NMBM_MAX_RESERVED_BLOCKS NMBM_DEFAULT_LOG_LEVEL)
|
||||
@@ -1,24 +0,0 @@
|
||||
From 0a09912eb336bee788443b919ea5b99b195f5a91 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Golle <daniel@makrotopia.org>
|
||||
Date: Sat, 4 Oct 2025 22:13:49 +0100
|
||||
Subject: [PATCH] hack: mt7987: mmc: use 4-bit bus-width for eMMC
|
||||
|
||||
The BananaPi R4 Lite has broken DAT5 signal of the MMC bus, which
|
||||
results in 8-bit buswidth not working well for the eMMC.
|
||||
Reduce to 4-bit buswidth fixes it (and makes all other boards with
|
||||
eMMC a tiny bit slower to boot, but it's in the milliseconds).
|
||||
---
|
||||
plat/mediatek/mt7987/bl2/bl2_dev_mmc.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/plat/mediatek/mt7987/bl2/bl2_dev_mmc.c
|
||||
+++ b/plat/mediatek/mt7987/bl2/bl2_dev_mmc.c
|
||||
@@ -74,7 +74,7 @@ static const struct mt7987_msdc_conf {
|
||||
{
|
||||
.base = MSDC0_BASE,
|
||||
.top_base = MSDC0_TOP_BASE,
|
||||
- .bus_width = MMC_BUS_WIDTH_8,
|
||||
+ .bus_width = MMC_BUS_WIDTH_4,
|
||||
.type = MMC_IS_EMMC,
|
||||
.src_clk = 200000000,
|
||||
.dev_comp = &mt7987_msdc_compat,
|
||||
@@ -1,27 +0,0 @@
|
||||
From 6725bb3c2aa9330f37a591e1e539badf67021b47 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Golle <daniel@makrotopia.org>
|
||||
Date: Sat, 4 Oct 2025 23:59:54 +0100
|
||||
Subject: [PATCH] hack: mt7987: bl2: move FIP offset to 0x100000
|
||||
|
||||
There is no use in allocating more than 2MB to the factory partition.
|
||||
After all, even for WiFi 7 tri-band devices the calibration data is
|
||||
still in the kilobytes range.
|
||||
Move FIP offset to 0x100000 to not waste so much space on small NOR
|
||||
flash.
|
||||
|
||||
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
---
|
||||
plat/mediatek/mt7987/bl2/bl2_dev_spi_nor.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/plat/mediatek/mt7987/bl2/bl2_dev_spi_nor.c
|
||||
+++ b/plat/mediatek/mt7987/bl2/bl2_dev_spi_nor.c
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <stdint.h>
|
||||
#include <boot_spi.h>
|
||||
|
||||
-#define FIP_BASE 0x250000
|
||||
+#define FIP_BASE 0x100000
|
||||
#define FIP_SIZE 0x80000
|
||||
|
||||
#define MTK_QSPI_SRC_CLK CB_MPLL_D2
|
||||
@@ -119,7 +119,6 @@ TFA_TARGETS:= \
|
||||
edpu
|
||||
|
||||
TFA_MAKE_FLAGS += \
|
||||
$(if $(CONFIG_BINUTILS_VERSION_2_37)$(CONFIG_BINUTILS_VERSION_2_38),,LDFLAGS="-no-warn-rwx-segments") \
|
||||
CROSS_CM3=$(BUILD_DIR)/$(CM3_GCC_NAME)-$(CM3_GCC_RELEASE)-$(CM3_GCC_VERSION)/bin/arm-none-eabi- \
|
||||
BL33=$(STAGING_DIR_IMAGE)/$(UBOOT)-u-boot.bin \
|
||||
MV_DDR_PATH=$(BUILD_DIR)/$(MV_DDR_NAME) \
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_VERSION:=2.13
|
||||
PKG_VERSION:=2.10
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_HASH:=afb5c408392fcec840bd30de9b02a236b0108142024f9853b542b596b0d894e3
|
||||
PKG_HASH:=88215a62291b9ba87da8e50b077741103cdc08fb6c9e1ebd34dfaace746d3201
|
||||
|
||||
PKG_MAINTAINER:=Sarah Maedel <openwrt@tbspace.de>
|
||||
|
||||
@@ -33,25 +33,13 @@ define Trusted-Firmware-A/rk3399
|
||||
PLAT:=rk3399
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/rk3576
|
||||
BUILD_SUBTARGET:=armv8
|
||||
PLAT:=rk3576
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/rk3588
|
||||
BUILD_SUBTARGET:=armv8
|
||||
PLAT:=rk3588
|
||||
endef
|
||||
|
||||
TFA_TARGETS:= \
|
||||
rk3328 \
|
||||
rk3399 \
|
||||
rk3576 \
|
||||
rk3588
|
||||
rk3399
|
||||
|
||||
ifeq ($(BUILD_VARIANT),rk3399)
|
||||
M0_GCC_NAME:=arm-gnu-toolchain
|
||||
M0_GCC_RELEASE:=12.3.rel1
|
||||
M0_GCC_NAME:=gcc-arm
|
||||
M0_GCC_RELEASE:=11.2-2022.02
|
||||
M0_GCC_VERSION:=$(HOST_ARCH)-arm-none-eabi
|
||||
M0_GCC_SOURCE:=$(M0_GCC_NAME)-$(M0_GCC_RELEASE)-$(M0_GCC_VERSION).tar.xz
|
||||
|
||||
@@ -59,9 +47,9 @@ ifeq ($(BUILD_VARIANT),rk3399)
|
||||
FILE:=$(M0_GCC_SOURCE)
|
||||
URL:=https://developer.arm.com/-/media/Files/downloads/gnu/$(M0_GCC_RELEASE)/binrel
|
||||
ifeq ($(HOST_ARCH),aarch64)
|
||||
HASH:=14c0487d5753f6071d24e568881f7c7e67f80dd83165dec5164b3731394af431
|
||||
HASH:=ef1d82e5894e3908cb7ed49c5485b5b95deefa32872f79c2b5f6f5447cabf55f
|
||||
else
|
||||
HASH:=12a2815644318ebcceaf84beabb665d0924b6e79e21048452c5331a56332b309
|
||||
HASH:=8c5acd5ae567c0100245b0556941c237369f210bceb196edfe5a2e7532c60326
|
||||
endif
|
||||
endef
|
||||
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_VERSION:=2.12
|
||||
PKG_RELEASE:=2
|
||||
PKG_VERSION:=2.10
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_HASH:=b4c047493cac1152203e1ba121ae57267e4899b7bf56eb365e22a933342d31c9
|
||||
PKG_HASH:=88215a62291b9ba87da8e50b077741103cdc08fb6c9e1ebd34dfaace746d3201
|
||||
PKG_MAINTAINER:=Thomas Richard <thomas.richard@bootlin.com>
|
||||
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
@@ -38,20 +38,7 @@ define Trusted-Firmware-A/stm32mp135f-dk
|
||||
DTB_FILE_NAME=stm32mp135f-dk.dtb
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/stm32mp157c-dk2
|
||||
$(call Trusted-Firmware-A/stm32mp1)
|
||||
NAME:=STM32MP157C-DK2
|
||||
DTB_FILE_NAME=stm32mp157c-dk2.dtb
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/stm32mp157c-dk2-scmi
|
||||
$(call Trusted-Firmware-A/stm32mp157c-dk2)
|
||||
NAME:=STM32MP157C-DK2 (SCMI)
|
||||
endef
|
||||
|
||||
TFA_TARGETS := stm32mp135f-dk \
|
||||
stm32mp157c-dk2 \
|
||||
stm32mp157c-dk2-scmi
|
||||
TFA_TARGETS := stm32mp135f-dk
|
||||
|
||||
TFA_MAKE_FLAGS += \
|
||||
ARCH=aarch32 AARCH32_SP=optee \
|
||||
@@ -67,7 +54,7 @@ TFA_MAKE_FLAGS += \
|
||||
|
||||
define Package/trusted-firmware-a/install
|
||||
$(INSTALL_DIR) $(STAGING_DIR_IMAGE)
|
||||
$(CP) $(PKG_BUILD_DIR)/build/$(PLAT)/release/tf-a-$(subst -scmi,,$(BUILD_VARIANT)).stm32 \
|
||||
$(CP) $(PKG_BUILD_DIR)/build/$(PLAT)/release/tf-a-$(BUILD_VARIANT).stm32 \
|
||||
$(STAGING_DIR_IMAGE)/tf-a-$(BUILD_VARIANT).stm32
|
||||
$(CP) $(PKG_BUILD_DIR)/build/$(PLAT)/release/fip.bin \
|
||||
$(STAGING_DIR_IMAGE)/fip-$(BUILD_VARIANT).bin
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
From 33573ea6842198cfdb5b3fdd320db9e2045855e9 Mon Sep 17 00:00:00 2001
|
||||
From: Valentin Caron <valentin.caron@foss.st.com>
|
||||
Date: Wed, 11 Dec 2024 11:20:04 +0100
|
||||
Subject: [PATCH] fix(stm32mp1-fdts): re-enable RTC clock
|
||||
|
||||
On STM32MP15 ST boards, RTC clock configuration by OPTEE is not ready
|
||||
yet. Re-enable it temporary to get LSE as clock source of RTC.
|
||||
|
||||
Signed-off-by: Valentin Caron <valentin.caron@foss.st.com>
|
||||
Change-Id: Ib6071229552e456faffb4fdfc8db9808140d54a7
|
||||
---
|
||||
fdts/stm32mp157c-ed1.dts | 2 ++
|
||||
fdts/stm32mp15xx-dkx.dtsi | 2 ++
|
||||
2 files changed, 4 insertions(+)
|
||||
|
||||
--- a/fdts/stm32mp157c-ed1.dts
|
||||
+++ b/fdts/stm32mp157c-ed1.dts
|
||||
@@ -194,6 +194,7 @@
|
||||
CLK_MPU_PLL1P
|
||||
CLK_AXI_PLL2P
|
||||
CLK_MCU_PLL3P
|
||||
+ CLK_RTC_LSE
|
||||
CLK_MCO1_DISABLED
|
||||
CLK_MCO2_DISABLED
|
||||
CLK_CKPER_HSE
|
||||
@@ -242,6 +243,7 @@
|
||||
DIV(DIV_APB3, 1)
|
||||
DIV(DIV_APB4, 1)
|
||||
DIV(DIV_APB5, 2)
|
||||
+ DIV(DIV_RTC, 23)
|
||||
DIV(DIV_MCO1, 0)
|
||||
DIV(DIV_MCO2, 0)
|
||||
>;
|
||||
--- a/fdts/stm32mp15xx-dkx.dtsi
|
||||
+++ b/fdts/stm32mp15xx-dkx.dtsi
|
||||
@@ -198,6 +198,7 @@
|
||||
CLK_MPU_PLL1P
|
||||
CLK_AXI_PLL2P
|
||||
CLK_MCU_PLL3P
|
||||
+ CLK_RTC_LSE
|
||||
CLK_MCO1_DISABLED
|
||||
CLK_MCO2_DISABLED
|
||||
CLK_CKPER_HSE
|
||||
@@ -246,6 +247,7 @@
|
||||
DIV(DIV_APB3, 1)
|
||||
DIV(DIV_APB4, 1)
|
||||
DIV(DIV_APB5, 2)
|
||||
+ DIV(DIV_RTC, 23)
|
||||
DIV(DIV_MCO1, 0)
|
||||
DIV(DIV_MCO2, 0)
|
||||
>;
|
||||
@@ -46,9 +46,6 @@ TFA_TARGETS:= \
|
||||
sunxi-h6 \
|
||||
sunxi-h616
|
||||
|
||||
TFA_MAKE_FLAGS+= \
|
||||
$(if $(CONFIG_BINUTILS_VERSION_2_37)$(CONFIG_BINUTILS_VERSION_2_38),,LDFLAGS="-no-warn-rwx-segments")
|
||||
|
||||
define Package/trusted-firmware-a/install
|
||||
$(INSTALL_DIR) $(STAGING_DIR_IMAGE)
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/build/$(PLAT)/release/bl31.bin $(STAGING_DIR_IMAGE)/bl31_$(BUILD_VARIANT).bin
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=arm-trusted-firmware-tools
|
||||
PKG_VERSION:=2.12
|
||||
PKG_VERSION:=2.9
|
||||
PKG_RELEASE:=1
|
||||
PKG_HASH:=b4c047493cac1152203e1ba121ae57267e4899b7bf56eb365e22a933342d31c9
|
||||
PKG_HASH:=76a66a1de0c01aeb83dfc7b72b51173fe62c6e51d6fca17cc562393117bed08b
|
||||
|
||||
PKG_MAINTAINER:=Daniel Golle <daniel@makrotopia.org>
|
||||
PKG_HOST_ONLY:=1
|
||||
@@ -33,8 +33,7 @@ define Host/Compile
|
||||
$(MAKE) -C \
|
||||
$(HOST_BUILD_DIR)/tools/fiptool \
|
||||
CPPFLAGS="$(HOST_CFLAGS)" \
|
||||
LDFLAGS="$(HOST_LDFLAGS)" \
|
||||
OPENSSL_DIR="$(STAGING_DIR_HOST)"
|
||||
LDFLAGS="$(HOST_LDFLAGS)"
|
||||
endef
|
||||
|
||||
define Host/Install
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
--- a/tools/fiptool/Makefile
|
||||
+++ b/tools/fiptool/Makefile
|
||||
@@ -74,7 +74,7 @@ all: --openssl ${PROJECT}
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
${PROJECT}: ${OBJECTS} Makefile
|
||||
$(s)echo " HOSTLD $@"
|
||||
- $(q)$(host-cc) ${OBJECTS} -o $@ $(LDOPTS)
|
||||
+ $(q)$(host-cc) ${OBJECTS} -o $@ $(LDOPTS) $(LDFLAGS)
|
||||
$(s)echo
|
||||
$(s)echo "Built $@ successfully"
|
||||
$(s)echo
|
||||
@echo " HOSTLD $@"
|
||||
- ${Q}${HOSTCC} ${OBJECTS} -o $@ ${LDLIBS}
|
||||
+ ${Q}${HOSTCC} ${OBJECTS} -o $@ ${LDLIBS} $(LDFLAGS)
|
||||
@${ECHO_BLANK_LINE}
|
||||
@echo "Built $@ successfully"
|
||||
@${ECHO_BLANK_LINE}
|
||||
|
||||
@@ -1,6 +1,15 @@
|
||||
--- a/tools/fiptool/fiptool.c
|
||||
+++ b/tools/fiptool/fiptool.c
|
||||
@@ -19,6 +19,9 @@
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
-
|
||||
+#define _DARWIN_C_SOURCE
|
||||
#ifndef _MSC_VER
|
||||
#include <sys/mount.h>
|
||||
#endif
|
||||
@@ -18,6 +18,9 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -10,13 +19,3 @@
|
||||
|
||||
#include "fiptool.h"
|
||||
#include "tbbr_config.h"
|
||||
--- a/tools/fiptool/fiptool_platform.h
|
||||
+++ b/tools/fiptool/fiptool_platform.h
|
||||
@@ -12,6 +12,7 @@
|
||||
#ifndef FIPTOOL_PLATFORM_H
|
||||
#define FIPTOOL_PLATFORM_H
|
||||
|
||||
+#define _DARWIN_C_SOURCE
|
||||
#ifndef _MSC_VER
|
||||
|
||||
/* Not Visual Studio, so include Posix Headers. */
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=at91bootstrap
|
||||
PKG_VERSION:=v4.0.10
|
||||
PKG_SOURCE_VERSION:=c123c68d1f5b13a55a8e164b03be866491ce3049
|
||||
PKG_MIRROR_HASH:=0c2d6a8a81a179c29227ad2f880b403f86095d3671f176ff1d2a21ba4e09c858
|
||||
PKG_VERSION:=v4.0.3
|
||||
PKG_MIRROR_HASH:=9c1d42337294b549e6c229ae4c9996efd21e00ae5f968bd780d352e054e24cb7
|
||||
PKG_SOURCE_VERSION:=1d9e673698d9db4a4f2301559f481274de2e75ae
|
||||
BINARIES_DIR:=build/binaries
|
||||
PKG_CPE_ID:=cpe:/a:linux4sam:at91bootstrap
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -7,11 +7,11 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=imx-bootlets
|
||||
PKG_VERSION:=10.12.01
|
||||
PKG_VERSION:=10.05.02
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=http://trabant.uid0.hu/openwrt/
|
||||
PKG_HASH:=f7c98cbc41e15184cad61c56115e840e34ac3ebb4a162fadeea905e5038fd65b
|
||||
PKG_HASH:=09ecd81a64db5166a235932146faf08d0689bfc7ac04ac9fcc3a5bd809fba74a
|
||||
|
||||
PKG_FLAGS:=nonshared
|
||||
|
||||
@@ -37,7 +37,7 @@ define Package/imx-bootlets/install
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/boot_prep/boot_prep $(STAGING_DIR)/boot_prep
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/linux_prep/output-target/linux_prep $(STAGING_DIR)/linux_prep
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/power_prep/power_prep $(STAGING_DIR)/power_prep
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/linux_ivt.bd $(STAGING_DIR)/linux_ivt.bd
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/linux_prebuilt.db $(STAGING_DIR)/linux_prebuilt.db
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,imx-bootlets))
|
||||
|
||||
@@ -1,22 +1,18 @@
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -37,13 +37,13 @@ ifeq "$(DFT_IMAGE)" "$(wildcard $(DFT_IM
|
||||
elftosb -z -c ./uboot.bd -o i$(ARCH)_uboot.sb
|
||||
elftosb -z -f imx28 -c ./uboot_ivt.bd -o i$(ARCH)_ivt_uboot.sb
|
||||
@@ -32,10 +32,11 @@ ifeq "$(DFT_IMAGE)" "$(wildcard $(DFT_IM
|
||||
sed -i 's,[^ *]image.*;,\timage="$(DFT_UBOOT)";,' uboot.db
|
||||
elftosb2 -z -c ./uboot.db -o i$(ARCH)_uboot.sb
|
||||
else
|
||||
- @echo "by using the pre-built kernel"
|
||||
- elftosb -z -c ./linux.bd -o i$(ARCH)_linux.sb
|
||||
- elftosb -z -f imx28 -c ./linux_ivt.bd -o i$(ARCH)_ivt_linux.sb
|
||||
+ @echo "... not generating any image for now."
|
||||
+ #elftosb -z -c ./linux.bd -o i$(ARCH)_linux.sb
|
||||
+ #elftosb -z -f imx28 -c ./linux_ivt.bd -o i$(ARCH)_ivt_linux.sb
|
||||
|
||||
- elftosb2 -z -c ./linux_prebuilt.db -o i$(ARCH)_linux.sb
|
||||
- @echo "generating U-Boot boot stream image"
|
||||
- elftosb -z -c ./uboot.bd -o i$(ARCH)_uboot.sb
|
||||
- elftosb -z -f imx28 -c ./uboot_ivt.bd -o i$(ARCH)_ivt_uboot.sb
|
||||
- elftosb2 -z -c ./uboot_prebuilt.db -o i$(ARCH)_uboot.sb
|
||||
+ @echo "... not generating any image for now."
|
||||
+ #@echo "by using the pre-built kernel"
|
||||
+ #elftosb2 -z -c ./linux_prebuilt.db -o i$(ARCH)_linux.sb
|
||||
+ #@echo "generating U-Boot boot stream image"
|
||||
+ #elftosb -z -c ./uboot.bd -o i$(ARCH)_uboot.sb
|
||||
+ #elftosb -z -f imx28 -c ./uboot_ivt.bd -o i$(ARCH)_ivt_uboot.sb
|
||||
+ #elftosb2 -z -c ./uboot_prebuilt.db -o i$(ARCH)_uboot.sb
|
||||
endif
|
||||
#@echo "generating kernel bootstream file sd_mmc_bootstream.raw"
|
||||
#Please use cfimager to burn xxx_linux.sb. The below way will no
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
--- a/linux_ivt.bd
|
||||
+++ b/linux_ivt.bd
|
||||
--- a/linux_prebuilt.db
|
||||
+++ b/linux_prebuilt.db
|
||||
@@ -4,10 +4,10 @@ options {
|
||||
flags = 0x01;
|
||||
}
|
||||
@@ -7,11 +7,11 @@
|
||||
- power_prep="./power_prep/power_prep";
|
||||
- sdram_prep="./boot_prep/boot_prep";
|
||||
- linux_prep="./linux_prep/output-target/linux_prep";
|
||||
- zImage="./zImage";
|
||||
- zImage = "./zImage";
|
||||
+ power_prep="./power_prep";
|
||||
+ sdram_prep="./boot_prep";
|
||||
+ linux_prep="./linux_prep";
|
||||
+ zImage="./zImage_dtb";
|
||||
+ zImage = "./zImage_dtb";
|
||||
}
|
||||
|
||||
section (0) {
|
||||
|
||||
@@ -121,7 +121,7 @@
|
||||
|
||||
all: build_prep gen_bootstream
|
||||
|
||||
@@ -101,6 +104,8 @@ distclean: clean
|
||||
@@ -94,6 +97,8 @@ distclean: clean
|
||||
clean:
|
||||
-rm -rf *.sb
|
||||
rm -f sd_mmc_bootstream.raw
|
||||
@@ -130,3 +130,14 @@
|
||||
$(MAKE) -C linux_prep clean ARCH=$(ARCH)
|
||||
$(MAKE) -C boot_prep clean ARCH=$(ARCH)
|
||||
$(MAKE) -C power_prep clean ARCH=$(ARCH)
|
||||
--- a/uboot.db
|
||||
+++ b/uboot.db
|
||||
@@ -3,7 +3,7 @@
|
||||
sources {
|
||||
power_prep="./power_prep/power_prep";
|
||||
sdram_prep="./boot_prep/boot_prep";
|
||||
- image="/home/b18647/repos/ltib_latest/rootfs/boot/u-boot";
|
||||
+ image="../boot/u-boot";
|
||||
}
|
||||
|
||||
section (0) {
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
--- a/linux_prep/core/cmdlines.S
|
||||
+++ b/linux_prep/core/cmdlines.S
|
||||
@@ -14,7 +14,7 @@
|
||||
#define CMDLINES_FILE "output-target/command_lines_stripped.txt"
|
||||
#endif
|
||||
|
||||
- .section .cmdlines, #alloc
|
||||
+ .section .cmdlines, "a"
|
||||
.globl cmdlines_start
|
||||
cmdlines_start:
|
||||
.incbin CMDLINES_FILE
|
||||
@@ -15,10 +15,6 @@ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
|
||||
PKG_SOURCE_URL:=@KERNEL/linux/utils/kernel/kexec
|
||||
PKG_HASH:=d2f0ef872f39e2fe4b1b01feb62b0001383207239b9f8041f98a95564161d053
|
||||
|
||||
PKG_LICENSE:=GPL-2.0-only
|
||||
PKG_LICENSE_FILES:=COPYING
|
||||
PKG_CPE_ID:=cpe:/a:kernel:kexec-tools
|
||||
|
||||
PKG_CONFIG_DEPENDS := CONFIG_KEXEC_ZLIB CONFIG_KEXEC_LZMA
|
||||
|
||||
PKG_BUILD_FLAGS:=gc-sections
|
||||
@@ -28,7 +24,7 @@ include $(INCLUDE_DIR)/package.mk
|
||||
define Package/kexec-tools/Default
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
URL:=https://github.com/horms/kexec-tools
|
||||
URL:=http://kernel.org/pub/linux/kernel/people/horms/kexec-tools/
|
||||
endef
|
||||
|
||||
define Package/kexec-tools
|
||||
|
||||
@@ -6,13 +6,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=opensbi
|
||||
PKG_RELEASE:=1.6
|
||||
PKG_RELEASE:=1.4
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL=https://github.com/riscv/opensbi
|
||||
PKG_SOURCE_DATE:=2024-12-24
|
||||
PKG_SOURCE_VERSION:=bd613dd92113f683052acfb23d9dc8ba60029e0a
|
||||
PKG_MIRROR_HASH:=19593a340e4346ed953f17664a15744f9efdc68340a89ec6831c5e0e4dc5656d
|
||||
PKG_SOURCE_DATE:=2023-12-24
|
||||
PKG_SOURCE_VERSION:=a2b255b88918715173942f2c5e1f97ac9e90c877
|
||||
PKG_MIRROR_HASH:=a81d7b3622feba80b2a45fe0d38600be73cfbee64a0426be82a71545c10c54d3
|
||||
|
||||
PKG_BUILD_DIR=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_VERSION:=4.7.0
|
||||
PKG_VERSION:=4.3.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_HASH:=976b9c184678516038d4e79766608e81d10bf136f76fd0db2dc48f90f994fbd9
|
||||
PKG_HASH:=390b271905c828d6def9fa6a77bbaa425f3b434d733c8eb18f582ccbc6896096
|
||||
PKG_MAINTAINER:=Thomas Richard <thomas.richard@bootlin.com>
|
||||
|
||||
OPTEE_USE_INTREE_DTC:=1
|
||||
@@ -34,22 +34,7 @@ define Optee-os/stm32mp135f-dk
|
||||
PLAT_FLAVOR:=135F_DK
|
||||
endef
|
||||
|
||||
define Optee-os/stm32mp157c-dk2
|
||||
$(call Optee-os/stm32mp1)
|
||||
NAME:=STM32MP157C-DK2
|
||||
PLAT_FLAVOR:=157C_DK2
|
||||
endef
|
||||
|
||||
define Optee-os/stm32mp157c-dk2-scmi
|
||||
$(call Optee-os/stm32mp1)
|
||||
NAME:=STM32MP157C-DK2 (SCMI)
|
||||
PLAT_FLAVOR:=157C_DK2_SCMI
|
||||
endef
|
||||
|
||||
OPTEE_TARGETS := \
|
||||
stm32mp135f-dk \
|
||||
stm32mp157c-dk2 \
|
||||
stm32mp157c-dk2-scmi
|
||||
OPTEE_TARGETS := stm32mp135f-dk
|
||||
|
||||
define Package/optee-os/install/default
|
||||
endef
|
||||
|
||||
@@ -9,9 +9,9 @@ PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/rockchip-linux/rkbin.git
|
||||
PKG_SOURCE_DATE:=2025-06-13
|
||||
PKG_SOURCE_VERSION:=74213af1e952c4683d2e35952507133b61394862
|
||||
PKG_MIRROR_HASH:=4b801b1301ae297f660340617b5f398b23a3f0b43bc7f0ef42c21f0f43eb8990
|
||||
PKG_SOURCE_DATE:=2024-02-22
|
||||
PKG_SOURCE_VERSION:=a2a0b89b6c8c612dca5ed9ed8a68db8a07f68bc0
|
||||
PKG_MIRROR_HASH:=39f15e5f8fac02026065b6747b355b93f4e06202783ae448c43607763211597c
|
||||
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
|
||||
@@ -27,91 +27,79 @@ endef
|
||||
|
||||
define Trusted-Firmware-A/rk3308
|
||||
BUILD_SUBTARGET:=armv8
|
||||
ATF:=rk33/rk3308_bl31_v2.27.elf
|
||||
TPL:=rk33/rk3308_ddr_589MHz_uart2_m1_v2.10.bin
|
||||
ATF:=rk33/rk3308_bl31_v2.26.elf
|
||||
TPL:=rk33/rk3308_ddr_589MHz_uart2_m1_v2.07.bin
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/rk3308-tpl-rock-pi-s
|
||||
NAME:=Radxa ROCK Pi S board
|
||||
define Trusted-Firmware-A/rk3308-rock-pi-s
|
||||
NAME:=Radxa ROCK Pi S
|
||||
BUILD_SUBTARGET:=armv8
|
||||
TPL:=rk33/rk3308_ddr_589MHz_uart0_m0_v2.10.bin
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/rk3528
|
||||
BUILD_SUBTARGET:=armv8
|
||||
ATF:=rk35/rk3528_bl31_v1.20.elf
|
||||
TPL:=rk35/rk3528_ddr_1056MHz_v1.11.bin
|
||||
ATF:=rk33/rk3308_bl31_v2.26.elf
|
||||
TPL:=rk33/rk3308_ddr_589MHz_uart0_m0_v2.07.bin
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/rk3566
|
||||
BUILD_SUBTARGET:=armv8
|
||||
ATF:=rk35/rk3568_bl31_v1.45.elf
|
||||
TPL:=rk35/rk3566_ddr_1056MHz_v1.23.bin
|
||||
ATF:=rk35/rk3568_bl31_v1.44.elf
|
||||
TPL:=rk35/rk3566_ddr_1056MHz_v1.21.bin
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/rk3568
|
||||
BUILD_SUBTARGET:=armv8
|
||||
ATF:=rk35/rk3568_bl31_v1.45.elf
|
||||
TPL:=rk35/rk3568_ddr_1560MHz_v1.23.bin
|
||||
ATF:=rk35/rk3568_bl31_v1.44.elf
|
||||
TPL:=rk35/rk3568_ddr_1560MHz_v1.21.bin
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/rk3568-tpl-e25
|
||||
define Trusted-Firmware-A/rk3568-e25
|
||||
NAME:=Radxa E25 board
|
||||
BUILD_SUBTARGET:=armv8
|
||||
TPL:=rk35/rk3568_ddr_1560MHz_uart2_m0_115200_v1.23.bin
|
||||
ATF:=rk35/rk3568_bl31_v1.44.elf
|
||||
TPL:=rk35/rk3568_ddr_1560MHz_uart2_m0_115200_v1.21.bin
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/rk3576-tpl
|
||||
NAME:=Rockchip RK3576 SoCs
|
||||
define Trusted-Firmware-A/rk3588
|
||||
BUILD_SUBTARGET:=armv8
|
||||
TPL:=rk35/rk3576_ddr_lp4_2112MHz_lp5_2736MHz_v1.09.bin
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/rk3588-tpl
|
||||
NAME:=Rockchip RK3588 SoCs
|
||||
BUILD_SUBTARGET:=armv8
|
||||
TPL:=rk35/rk3588_ddr_lp4_2112MHz_lp5_2400MHz_v1.19.bin
|
||||
ATF:=rk35/rk3588_bl31_v1.45.elf
|
||||
TPL:=rk35/rk3588_ddr_lp4_2112MHz_lp5_2400MHz_v1.16.bin
|
||||
endef
|
||||
|
||||
TFA_TARGETS:= \
|
||||
rk3308 \
|
||||
rk3308-tpl-rock-pi-s \
|
||||
rk3528 \
|
||||
rk3308-rock-pi-s \
|
||||
rk3566 \
|
||||
rk3568 \
|
||||
rk3568-tpl-e25 \
|
||||
rk3576-tpl \
|
||||
rk3588-tpl
|
||||
rk3568-e25 \
|
||||
rk3588
|
||||
|
||||
ifeq ($(BUILD_VARIANT),rk3308-tpl-rock-pi-s)
|
||||
ifeq ($(BUILD_VARIANT),rk3308-rock-pi-s)
|
||||
TPL_FILE:=rk3308_ddr_589MHz_uart0_m0_v2.07.bin
|
||||
define Download/rk3308-tpl-rock-pi-s
|
||||
FILE:=$(notdir $(TPL))
|
||||
URL_FILE:=$(TPL)
|
||||
URL:=https://github.com/radxa/rkbin/raw/2b54df9d062ef91a9fffbc85472b070c9220c4cf/bin/
|
||||
HASH:=45af030ed2cb322cc5a91c32350130fc1f1ea9508794fa4b5d309eadf70e3d04
|
||||
FILE:=$(TPL_FILE)
|
||||
URL:=https://github.com/radxa/rkbin/raw/5696fab20dcac57c1458f72dc7604ba60e553adf/bin/rk33/
|
||||
HASH:=8a1a42df23cccb86a2dabc14a5c0e9227d64a51b9b83e9968ef5af3b30787f7d
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
$(eval $(call Download,rk3308-tpl-rock-pi-s))
|
||||
$(call Build/Prepare/Default)
|
||||
|
||||
$(CP) $(DL_DIR)/$(notdir $(TPL)) $(PKG_BUILD_DIR)/bin/$(TPL)
|
||||
$(CP) $(DL_DIR)/$(TPL_FILE) $(PKG_BUILD_DIR)/bin/rk33/
|
||||
endef
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD_VARIANT),rk3568-tpl-e25)
|
||||
ifeq ($(BUILD_VARIANT),rk3568-e25)
|
||||
TPL_FILE:=rk3568_ddr_1560MHz_uart2_m0_115200_v1.21.bin
|
||||
define Download/rk3568-tpl-e25
|
||||
FILE:=$(notdir $(TPL))
|
||||
URL_FILE:=$(TPL)
|
||||
URL:=https://github.com/radxa/rkbin/raw/2e77c53ab0279585b09ecdaa54fe3e2bf80f9475/bin/
|
||||
HASH:=1bb9f92a6515a70b91c0f8bd3aa4dc31432afc4317b9408f82c43ca63cb10ab6
|
||||
FILE:=$(TPL_FILE)
|
||||
URL:=https://github.com/radxa/rkbin/raw/5696fab20dcac57c1458f72dc7604ba60e553adf/bin/rk35/
|
||||
HASH:=1815f9649dc5661a3ef184b052da39286e51453a66f6ff53cc3e345d65dfabd4
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
$(eval $(call Download,rk3568-tpl-e25))
|
||||
$(call Build/Prepare/Default)
|
||||
|
||||
$(CP) $(DL_DIR)/$(notdir $(TPL)) $(PKG_BUILD_DIR)/bin/$(TPL)
|
||||
$(CP) $(DL_DIR)/$(TPL_FILE) $(PKG_BUILD_DIR)/bin/rk35/
|
||||
endef
|
||||
endif
|
||||
|
||||
@@ -121,9 +109,7 @@ endef
|
||||
define Package/trusted-firmware-a/install
|
||||
$(INSTALL_DIR) $(STAGING_DIR_IMAGE)
|
||||
|
||||
ifneq ($(ATF),)
|
||||
$(CP) $(PKG_BUILD_DIR)/bin/$(ATF) $(STAGING_DIR_IMAGE)/
|
||||
endif
|
||||
$(CP) $(PKG_BUILD_DIR)/bin/$(TPL) $(STAGING_DIR_IMAGE)/
|
||||
endef
|
||||
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=tfa-layerscape
|
||||
PKG_VERSION:=6.12.20.2.0.0
|
||||
PKG_RELEASE:=1
|
||||
PKG_VERSION:=6.6.23.2.0.0
|
||||
PKG_RELEASE:=2
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/nxp-qoriq/atf
|
||||
PKG_SOURCE_VERSION:=lf-6.12.20-2.0.0
|
||||
PKG_MIRROR_HASH:=1e1c74900113a8d4354c06fdcedfff2cd6b0899b4a063d393de98f8ca358dfd2
|
||||
PKG_SOURCE_VERSION:=lf-6.6.23-2.0.0
|
||||
PKG_MIRROR_HASH:=628a95ba60a593ae0575ee9ede1154445ec3a86a07b18e4947e06e13c2b67859
|
||||
PKG_BUILD_DEPENDS:=tfa-layerscape/host
|
||||
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
@@ -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
|
||||
|
||||
@@ -162,7 +161,6 @@ TFA_TARGETS := \
|
||||
lx2160a-rdb-sdboot
|
||||
|
||||
TFA_MAKE_FLAGS += \
|
||||
$(if $(CONFIG_BINUTILS_VERSION_2_37)$(CONFIG_BINUTILS_VERSION_2_38),,LDFLAGS="-Wl,--no-warn-rwx-segments") \
|
||||
fip pbl \
|
||||
BOOT_MODE=$(BOOT_MODE) \
|
||||
RCW=$(STAGING_DIR_IMAGE)/fsl_$(BUILD_VARIANT)-rcw.bin \
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -105,10 +105,6 @@ CRTTOOL ?= ${CRTTOOLPATH}/cert_create$
|
||||
@@ -128,10 +128,6 @@ CRTTOOL ?= ${CRTTOOLPATH}/cert_create$
|
||||
ENCTOOLPATH ?= tools/encrypt_fw
|
||||
ENCTOOL ?= ${ENCTOOLPATH}/encrypt_fw${BIN_EXT}
|
||||
|
||||
@@ -11,55 +11,55 @@
|
||||
# Variables for use with sptool
|
||||
SPTOOLPATH ?= tools/sptool
|
||||
SPTOOL ?= ${SPTOOLPATH}/sptool.py
|
||||
@@ -1622,13 +1618,6 @@ endif #(CHECKPATCH)
|
||||
@@ -1597,13 +1593,6 @@ endif #(CHECKPATCH)
|
||||
clean:
|
||||
$(s)echo " CLEAN"
|
||||
@echo " CLEAN"
|
||||
$(call SHELL_REMOVE_DIR,${BUILD_PLAT})
|
||||
-ifdef UNIX_MK
|
||||
- $(q)${MAKE} --no-print-directory -C ${FIPTOOLPATH} clean
|
||||
- ${Q}${MAKE} --no-print-directory -C ${FIPTOOLPATH} clean
|
||||
-else
|
||||
-# Clear the MAKEFLAGS as we do not want
|
||||
-# to pass the gnumake flags to nmake.
|
||||
- $(q)set MAKEFLAGS= && ${MSVC_NMAKE} /nologo /f ${FIPTOOLPATH}/Makefile.msvc FIPTOOLPATH=$(subst /,\,$(FIPTOOLPATH)) FIPTOOL=$(subst /,\,$(FIPTOOL)) clean
|
||||
- ${Q}set MAKEFLAGS= && ${MSVC_NMAKE} /nologo /f ${FIPTOOLPATH}/Makefile.msvc FIPTOOLPATH=$(subst /,\,$(FIPTOOLPATH)) FIPTOOL=$(subst /,\,$(FIPTOOL)) clean
|
||||
-endif #(UNIX_MK)
|
||||
$(q)${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} clean
|
||||
$(q)${MAKE} PLAT=${PLAT} --no-print-directory -C ${ENCTOOLPATH} clean
|
||||
$(q)${MAKE} --no-print-directory -C ${ROMLIBPATH} clean
|
||||
@@ -1637,13 +1626,6 @@ realclean distclean:
|
||||
$(s)echo " REALCLEAN"
|
||||
${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} clean
|
||||
${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${ENCTOOLPATH} clean
|
||||
${Q}${MAKE} --no-print-directory -C ${ROMLIBPATH} clean
|
||||
@@ -1612,13 +1601,6 @@ realclean distclean:
|
||||
@echo " REALCLEAN"
|
||||
$(call SHELL_REMOVE_DIR,${BUILD_BASE})
|
||||
$(call SHELL_DELETE_ALL, ${CURDIR}/cscope.*)
|
||||
-ifdef UNIX_MK
|
||||
- $(q)${MAKE} --no-print-directory -C ${FIPTOOLPATH} clean
|
||||
- ${Q}${MAKE} --no-print-directory -C ${FIPTOOLPATH} clean
|
||||
-else
|
||||
-# Clear the MAKEFLAGS as we do not want
|
||||
-# to pass the gnumake flags to nmake.
|
||||
- $(q)set MAKEFLAGS= && ${MSVC_NMAKE} /nologo /f ${FIPTOOLPATH}/Makefile.msvc FIPTOOLPATH=$(subst /,\,$(FIPTOOLPATH)) FIPTOOL=$(subst /,\,$(FIPTOOL)) realclean
|
||||
- ${Q}set MAKEFLAGS= && ${MSVC_NMAKE} /nologo /f ${FIPTOOLPATH}/Makefile.msvc FIPTOOLPATH=$(subst /,\,$(FIPTOOLPATH)) FIPTOOL=$(subst /,\,$(FIPTOOL)) realclean
|
||||
-endif #(UNIX_MK)
|
||||
$(q)${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} realclean
|
||||
$(q)${MAKE} PLAT=${PLAT} --no-print-directory -C ${ENCTOOLPATH} realclean
|
||||
$(q)${MAKE} --no-print-directory -C ${ROMLIBPATH} clean
|
||||
@@ -1698,7 +1680,7 @@ certificates: ${CRT_DEPS} ${CRTTOOL}
|
||||
$(s)echo
|
||||
${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} realclean
|
||||
${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${ENCTOOLPATH} realclean
|
||||
${Q}${MAKE} --no-print-directory -C ${ROMLIBPATH} clean
|
||||
@@ -1674,7 +1656,7 @@ certificates: ${CRT_DEPS} ${CRTTOOL}
|
||||
@${ECHO_BLANK_LINE}
|
||||
endif #(GENERATE_COT)
|
||||
|
||||
-${BUILD_PLAT}/${FIP_NAME}: ${FIP_DEPS} ${FIPTOOL}
|
||||
+${BUILD_PLAT}/${FIP_NAME}: ${FIP_DEPS}
|
||||
$(eval ${CHECK_FIP_CMD})
|
||||
$(q)${FIPTOOL} create ${FIP_ARGS} $@
|
||||
$(q)${FIPTOOL} info $@
|
||||
@@ -1715,7 +1697,7 @@ fwu_certificates: ${FWU_CRT_DEPS} ${CRTT
|
||||
$(s)echo
|
||||
${Q}${FIPTOOL} create ${FIP_ARGS} $@
|
||||
${Q}${FIPTOOL} info $@
|
||||
@@ -1691,7 +1673,7 @@ fwu_certificates: ${FWU_CRT_DEPS} ${CRTT
|
||||
@${ECHO_BLANK_LINE}
|
||||
endif #(GENERATE_COT)
|
||||
|
||||
-${BUILD_PLAT}/${FWU_FIP_NAME}: ${FWU_FIP_DEPS} ${FIPTOOL}
|
||||
+${BUILD_PLAT}/${FWU_FIP_NAME}: ${FWU_FIP_DEPS}
|
||||
$(eval ${CHECK_FWU_FIP_CMD})
|
||||
$(q)${FIPTOOL} create ${FWU_FIP_ARGS} $@
|
||||
$(q)${FIPTOOL} info $@
|
||||
@@ -1723,19 +1705,9 @@ ${BUILD_PLAT}/${FWU_FIP_NAME}: ${FWU_FIP
|
||||
$(s)echo "Built $@ successfully"
|
||||
$(s)echo
|
||||
${Q}${FIPTOOL} create ${FWU_FIP_ARGS} $@
|
||||
${Q}${FIPTOOL} info $@
|
||||
@@ -1699,19 +1681,9 @@ ${BUILD_PLAT}/${FWU_FIP_NAME}: ${FWU_FIP
|
||||
@echo "Built $@ successfully"
|
||||
@${ECHO_BLANK_LINE}
|
||||
|
||||
-fiptool: ${FIPTOOL}
|
||||
fip: ${BUILD_PLAT}/${FIP_NAME}
|
||||
@@ -67,27 +67,27 @@
|
||||
|
||||
-${FIPTOOL}: FORCE
|
||||
-ifdef UNIX_MK
|
||||
- $(q)${MAKE} PLAT=${PLAT} CPPFLAGS="-DVERSION='\"${VERSION_STRING}\"'" FIPTOOL=${FIPTOOL} OPENSSL_DIR=${OPENSSL_DIR} DEBUG=${DEBUG} --no-print-directory -C ${FIPTOOLPATH} all
|
||||
- ${Q}${MAKE} CPPFLAGS="-DVERSION='\"${VERSION_STRING}\"'" FIPTOOL=${FIPTOOL} OPENSSL_DIR=${OPENSSL_DIR} DEBUG=${DEBUG} V=${V} --no-print-directory -C ${FIPTOOLPATH} all
|
||||
-else
|
||||
-# Clear the MAKEFLAGS as we do not want
|
||||
-# to pass the gnumake flags to nmake.
|
||||
- $(q)set MAKEFLAGS= && ${MSVC_NMAKE} /nologo /f ${FIPTOOLPATH}/Makefile.msvc FIPTOOLPATH=$(subst /,\,$(FIPTOOLPATH)) FIPTOOL=$(subst /,\,$(FIPTOOL))
|
||||
- ${Q}set MAKEFLAGS= && ${MSVC_NMAKE} /nologo /f ${FIPTOOLPATH}/Makefile.msvc FIPTOOLPATH=$(subst /,\,$(FIPTOOLPATH)) FIPTOOL=$(subst /,\,$(FIPTOOL))
|
||||
-endif #(UNIX_MK)
|
||||
-
|
||||
romlib.bin: libraries FORCE
|
||||
$(q)${MAKE} PLAT_DIR=${PLAT_DIR} BUILD_PLAT=${BUILD_PLAT} ENABLE_BTI=${ENABLE_BTI} ARM_ARCH_MINOR=${ARM_ARCH_MINOR} INCLUDES=$(call escape-shell,$(INCLUDES)) DEFINES=$(call escape-shell,$(DEFINES)) --no-print-directory -C ${ROMLIBPATH} all
|
||||
${Q}${MAKE} PLAT_DIR=${PLAT_DIR} BUILD_PLAT=${BUILD_PLAT} ENABLE_BTI=${ENABLE_BTI} ARM_ARCH_MINOR=${ARM_ARCH_MINOR} INCLUDES='${INCLUDES}' DEFINES='${DEFINES}' --no-print-directory -C ${ROMLIBPATH} all
|
||||
|
||||
--- a/tools/fiptool/Makefile
|
||||
+++ b/tools/fiptool/Makefile
|
||||
@@ -74,7 +74,7 @@ all: --openssl ${PROJECT}
|
||||
@@ -81,7 +81,7 @@ all: --openssl ${PROJECT}
|
||||
|
||||
${PROJECT}: ${OBJECTS} Makefile
|
||||
$(s)echo " HOSTLD $@"
|
||||
- $(q)$(host-cc) ${OBJECTS} -o $@ $(LDOPTS)
|
||||
+ $(q)$(host-cc) ${OBJECTS} -o $@ $(LDOPTS) $(LDFLAGS)
|
||||
$(s)echo
|
||||
$(s)echo "Built $@ successfully"
|
||||
$(s)echo
|
||||
@echo " HOSTLD $@"
|
||||
- ${Q}${HOSTCC} ${OBJECTS} -o $@ $(LDOPTS)
|
||||
+ ${Q}${HOSTCC} ${OBJECTS} -o $@ $(LDOPTS) $(LDFLAGS)
|
||||
@${ECHO_BLANK_LINE}
|
||||
@echo "Built $@ successfully"
|
||||
@${ECHO_BLANK_LINE}
|
||||
--- a/tools/fiptool/plat_fiptool/nxp/plat_fiptool.mk
|
||||
+++ b/tools/fiptool/plat_fiptool/nxp/plat_fiptool.mk
|
||||
@@ -21,11 +21,11 @@ INCLUDE_PATHS += -I${PLAT_DEF_UUID_OID_C
|
||||
|
||||
@@ -16,17 +16,17 @@ Signed-off-by: Biwen Li <biwen.li@nxp.com>
|
||||
@@ -19,8 +19,6 @@ ifeq ($(RCW),"")
|
||||
else
|
||||
# Generate header for bl2.bin
|
||||
$(q)$(CST_DIR)/create_hdr_isbc --in ${BUILD_PLAT}/bl2.bin --out ${BUILD_PLAT}/hdr_bl2 ${BL2_INPUT_FILE}
|
||||
$(Q)$(CST_DIR)/create_hdr_isbc --in ${BUILD_PLAT}/bl2.bin --out ${BUILD_PLAT}/hdr_bl2 ${BL2_INPUT_FILE}
|
||||
- # Compile create_pbl tool
|
||||
- $(q)${MAKE} CPPFLAGS="-DVERSION='\"${VERSION_STRING}\"'" --no-print-directory -C ${CREATE_PBL_TOOL_PATH};\
|
||||
- ${Q}${MAKE} CPPFLAGS="-DVERSION='\"${VERSION_STRING}\"'" --no-print-directory -C ${CREATE_PBL_TOOL_PATH};\
|
||||
# Add bl2.bin to RCW
|
||||
${CREATE_PBL} -r ${RCW} -i ${BUILD_PLAT}/bl2.bin -b ${BOOT_MODE} -c ${SOC_NUM} -d ${BL2_BASE} -e ${BL2_BASE}\
|
||||
-o ${BUILD_PLAT}/bl2_${BOOT_MODE}.pbl ;\
|
||||
@@ -42,7 +40,6 @@ ifeq ($(RCW),"")
|
||||
$(s)echo "Platform ${PLAT} requires rcw file. Please set RCW to point to the right RCW file for boot mode ${BOOT_MODE}"
|
||||
${Q}echo "Platform ${PLAT} requires rcw file. Please set RCW to point to the right RCW file for boot mode ${BOOT_MODE}"
|
||||
else
|
||||
# -a option appends the image for Chassis 3 devices in case of non secure boot
|
||||
- $(q)${MAKE} CPPFLAGS="-DVERSION='\"${VERSION_STRING}\"'" --no-print-directory -C ${CREATE_PBL_TOOL_PATH};
|
||||
- ${Q}${MAKE} CPPFLAGS="-DVERSION='\"${VERSION_STRING}\"'" --no-print-directory -C ${CREATE_PBL_TOOL_PATH};
|
||||
${CREATE_PBL} -r ${RCW} -i ${BUILD_PLAT}/bl2.bin -b ${BOOT_MODE} -c ${SOC_NUM} -d ${BL2_BASE} -e ${BL2_BASE} \
|
||||
-o ${BUILD_PLAT}/bl2_${BOOT_MODE}.pbl ;
|
||||
# Swapping of RCW is required for QSPi Chassis 2 devices
|
||||
@@ -34,19 +34,19 @@ Signed-off-by: Biwen Li <biwen.li@nxp.com>
|
||||
+++ b/tools/nxp/create_pbl/pbl_ch3.mk
|
||||
@@ -26,9 +26,6 @@ else
|
||||
# Generate header for bl2.bin
|
||||
$(q)$(CST_DIR)/create_hdr_isbc --in ${BUILD_PLAT}/bl2.bin --out ${BUILD_PLAT}/hdr_bl2 ${BL2_INPUT_FILE}
|
||||
$(Q)$(CST_DIR)/create_hdr_isbc --in ${BUILD_PLAT}/bl2.bin --out ${BUILD_PLAT}/hdr_bl2 ${BL2_INPUT_FILE}
|
||||
|
||||
- # Compile create_pbl tool
|
||||
- $(q)${MAKE} CPPFLAGS="-DVERSION='\"${VERSION_STRING}\"'" --no-print-directory -C ${CREATE_PBL_TOOL_PATH};\
|
||||
- ${Q}${MAKE} CPPFLAGS="-DVERSION='\"${VERSION_STRING}\"'" --no-print-directory -C ${CREATE_PBL_TOOL_PATH};\
|
||||
-
|
||||
# Add Block Copy command for bl2.bin to RCW
|
||||
${CREATE_PBL} -r ${RCW} -i ${BUILD_PLAT}/bl2.bin -b ${BOOT_MODE} -c ${SOC_NUM} -d ${BL2_BASE} -e ${BL2_BASE}\
|
||||
-o ${BUILD_PLAT}/bl2_${BOOT_MODE}.pbl -f ${BL2_SRC_OFFSET};\
|
||||
@@ -56,8 +53,6 @@ else #SECURE_BOOT
|
||||
ifeq ($(RCW),"")
|
||||
$(s)echo "Platform ${PLAT} requires rcw file. Please set RCW to point to the right RCW file for boot mode ${BOOT_MODE}"
|
||||
${Q}echo "Platform ${PLAT} requires rcw file. Please set RCW to point to the right RCW file for boot mode ${BOOT_MODE}"
|
||||
else
|
||||
- $(q)${MAKE} CPPFLAGS="-DVERSION='\"${VERSION_STRING}\"'" --no-print-directory -C ${CREATE_PBL_TOOL_PATH};
|
||||
- ${Q}${MAKE} CPPFLAGS="-DVERSION='\"${VERSION_STRING}\"'" --no-print-directory -C ${CREATE_PBL_TOOL_PATH};
|
||||
-
|
||||
# Add Block Copy command and populate boot loc ptrfor bl2.bin to RCW
|
||||
${CREATE_PBL} -r ${RCW} -i ${BUILD_PLAT}/bl2.bin -b ${BOOT_MODE} -c ${SOC_NUM} -d ${BL2_BASE} -e ${BL2_BASE} \
|
||||
|
||||
@@ -1,94 +0,0 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_VERSION:=2025.07
|
||||
PKG_HASH:=0f933f6c5a426895bf306e93e6ac53c60870e4b54cda56d95211bec99e63bec7
|
||||
PKG_BUILD_DEPENDS:=arm-trusted-firmware-tools/host
|
||||
|
||||
UBOOT_USE_INTREE_DTC:=1
|
||||
|
||||
include $(INCLUDE_DIR)/u-boot.mk
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
|
||||
define U-Boot/Default
|
||||
BUILD_TARGET:=airoha
|
||||
FIP_COMPRESS:=1
|
||||
endef
|
||||
|
||||
define U-Boot/an7581_rfb
|
||||
NAME:=AN7581 Reference Board
|
||||
UBOOT_CONFIG:=an7581_evb
|
||||
BUILD_DEVICES:=airoha_an7581-evb
|
||||
BUILD_SUBTARGET:=an7581
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_IMAGE:=an7581-bl2.bin
|
||||
BL31_IMAGE:=an7581-bl31.bin
|
||||
endef
|
||||
|
||||
define U-Boot/an7583_rfb
|
||||
NAME:=AN7583 Reference Board
|
||||
UBOOT_CONFIG:=an7583_evb
|
||||
BUILD_DEVICES:=airoha_an7583-evb
|
||||
BUILD_SUBTARGET:=an7583
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_IMAGE:=an7583-bl2.bin
|
||||
BL31_IMAGE:=an7583-bl31.bin
|
||||
endef
|
||||
|
||||
UBOOT_TARGETS := \
|
||||
an7581_rfb \
|
||||
an7583_rfb
|
||||
|
||||
UBOOT_CUSTOMIZE_CONFIG := \
|
||||
--disable TOOLS_KWBIMAGE \
|
||||
--disable TOOLS_LIBCRYPTO \
|
||||
--disable TOOLS_MKEFICAPSULE \
|
||||
--enable SERIAL_RX_BUFFER \
|
||||
--set-val SERIAL_RX_BUFFER_SIZE 256
|
||||
|
||||
define Build/fip-image-bl2
|
||||
$(STAGING_DIR_HOST)/bin/fiptool create \
|
||||
--tb-fw files/$(BL2_IMAGE) \
|
||||
$(PKG_BUILD_DIR)/bl2.fip
|
||||
endef
|
||||
|
||||
define Build/fip-image
|
||||
$(if $(FIP_COMPRESS), $(STAGING_DIR_HOST)/bin/lzma e \
|
||||
$(PKG_BUILD_DIR)/u-boot.bin \
|
||||
$(PKG_BUILD_DIR)/u-boot.bin.lzma)
|
||||
$(if $(FIP_COMPRESS), $(STAGING_DIR_HOST)/bin/lzma e \
|
||||
files/$(BL31_IMAGE) \
|
||||
$(PKG_BUILD_DIR)/bl31.bin.lzma)
|
||||
$(STAGING_DIR_HOST)/bin/fiptool create \
|
||||
--soc-fw $(PKG_BUILD_DIR)/bl31.bin$(if $(FIP_COMPRESS),.lzma) \
|
||||
--nt-fw $(PKG_BUILD_DIR)/u-boot.bin$(if $(FIP_COMPRESS),.lzma) \
|
||||
$(PKG_BUILD_DIR)/u-boot.fip
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
$(call Build/Configure/U-Boot)
|
||||
sed -i 's/CONFIG_TOOLS_LIBCRYPTO=y/# CONFIG_TOOLS_LIBCRYPTO is not set/' $(PKG_BUILD_DIR)/.config
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(call Build/Compile/U-Boot)
|
||||
ifeq ($(UBOOT_IMAGE),u-boot.fip)
|
||||
$(call Build/fip-image-bl2)
|
||||
$(call Build/fip-image)
|
||||
endif
|
||||
endef
|
||||
|
||||
# don't stage files to bindir, let target/linux/airoha/image/*.mk do that
|
||||
define Package/u-boot/install
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(STAGING_DIR_IMAGE)
|
||||
ifeq ($(UBOOT_IMAGE),u-boot.fip)
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/bl2.fip $(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-bl2.fip
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/u-boot.fip $(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-bl31-u-boot.fip
|
||||
endif
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage/U-Boot))
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,55 +0,0 @@
|
||||
From 4f1fcf5281ee4e22b1e89a62bd0417878bcbeca5 Mon Sep 17 00:00:00 2001
|
||||
From: Christian Marangi <ansuelsmth@gmail.com>
|
||||
Date: Tue, 3 Jun 2025 10:41:18 +0200
|
||||
Subject: [PATCH 1/2] linux/bitfield.h: import FIELD_PREP_CONST macro from
|
||||
Linux Kernel
|
||||
|
||||
Import FIELD_PREP_CONST macro from Linux Kernel to permit usage of
|
||||
FIELD_PREP with scenario where a constant value is needed.
|
||||
|
||||
Refer to commit e2192de59e45 ("bitfield: add FIELD_PREP_CONST()") in
|
||||
Linux kernel for extensive explaination of why this is useful.
|
||||
|
||||
This is also to better align with the Linux Kernel for easier porting of
|
||||
driver.
|
||||
|
||||
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
||||
---
|
||||
include/linux/bitfield.h | 26 ++++++++++++++++++++++++++
|
||||
1 file changed, 26 insertions(+)
|
||||
|
||||
--- a/include/linux/bitfield.h
|
||||
+++ b/include/linux/bitfield.h
|
||||
@@ -90,6 +90,32 @@
|
||||
((typeof(_mask))(_val) << __bf_shf(_mask)) & (_mask); \
|
||||
})
|
||||
|
||||
+#define __BF_CHECK_POW2(n) BUILD_BUG_ON_ZERO(((n) & ((n) - 1)) != 0)
|
||||
+
|
||||
+/**
|
||||
+ * FIELD_PREP_CONST() - prepare a constant bitfield element
|
||||
+ * @_mask: shifted mask defining the field's length and position
|
||||
+ * @_val: value to put in the field
|
||||
+ *
|
||||
+ * FIELD_PREP_CONST() masks and shifts up the value. The result should
|
||||
+ * be combined with other fields of the bitfield using logical OR.
|
||||
+ *
|
||||
+ * Unlike FIELD_PREP() this is a constant expression and can therefore
|
||||
+ * be used in initializers. Error checking is less comfortable for this
|
||||
+ * version, and non-constant masks cannot be used.
|
||||
+ */
|
||||
+#define FIELD_PREP_CONST(_mask, _val) \
|
||||
+ ( \
|
||||
+ /* mask must be non-zero */ \
|
||||
+ BUILD_BUG_ON_ZERO((_mask) == 0) + \
|
||||
+ /* check if value fits */ \
|
||||
+ BUILD_BUG_ON_ZERO(~((_mask) >> __bf_shf(_mask)) & (_val)) + \
|
||||
+ /* check if mask is contiguous */ \
|
||||
+ __BF_CHECK_POW2((_mask) + (1ULL << __bf_shf(_mask))) + \
|
||||
+ /* and create the value */ \
|
||||
+ (((typeof(_mask))(_val) << __bf_shf(_mask)) & (_mask)) \
|
||||
+ )
|
||||
+
|
||||
/**
|
||||
* FIELD_GET() - extract a bitfield element
|
||||
* @_mask: shifted mask defining the field's length and position
|
||||
@@ -1,56 +0,0 @@
|
||||
From 00e8038b8be74d599f7bc8078731cc2505832f57 Mon Sep 17 00:00:00 2001
|
||||
From: Christian Marangi <ansuelsmth@gmail.com>
|
||||
Date: Tue, 3 Jun 2025 10:47:15 +0200
|
||||
Subject: [PATCH 2/2] mtd: spinand: winbond: add Winbond W25N04KV flash support
|
||||
|
||||
Add Winbond W25N04KV flash support that use a different value to detect
|
||||
ECC bitflip.
|
||||
|
||||
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
||||
---
|
||||
drivers/mtd/nand/spi/winbond.c | 13 +++++++++++++
|
||||
1 file changed, 13 insertions(+)
|
||||
|
||||
--- a/drivers/mtd/nand/spi/winbond.c
|
||||
+++ b/drivers/mtd/nand/spi/winbond.c
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <linux/device.h>
|
||||
#include <linux/kernel.h>
|
||||
#endif
|
||||
+#include <linux/bitfield.h>
|
||||
#include <linux/bug.h>
|
||||
#include <linux/mtd/spinand.h>
|
||||
|
||||
@@ -18,6 +19,8 @@
|
||||
|
||||
#define WINBOND_CFG_BUF_READ BIT(3)
|
||||
|
||||
+#define W25N04KV_STATUS_ECC_5_8_BITFLIPS FIELD_PREP_CONST(STATUS_ECC_MASK, 0x3)
|
||||
+
|
||||
static SPINAND_OP_VARIANTS(read_cache_variants,
|
||||
SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 2, NULL, 0),
|
||||
SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0),
|
||||
@@ -121,6 +124,7 @@ static int w25n02kv_ecc_get_status(struc
|
||||
return -EBADMSG;
|
||||
|
||||
case STATUS_ECC_HAS_BITFLIPS:
|
||||
+ case W25N04KV_STATUS_ECC_5_8_BITFLIPS:
|
||||
/*
|
||||
* Let's try to retrieve the real maximum number of bitflips
|
||||
* in order to avoid forcing the wear-leveling layer to move
|
||||
@@ -169,6 +173,15 @@ static const struct spinand_info winbond
|
||||
NAND_ECCREQ(8, 512),
|
||||
SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
|
||||
&write_cache_variants,
|
||||
+ &update_cache_variants),
|
||||
+ 0,
|
||||
+ SPINAND_ECCINFO(&w25n02kv_ooblayout, w25n02kv_ecc_get_status)),
|
||||
+ SPINAND_INFO("W25N04KV",
|
||||
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xaa, 0x23),
|
||||
+ NAND_MEMORG(1, 2048, 128, 64, 4096, 40, 2, 1, 1),
|
||||
+ NAND_ECCREQ(8, 512),
|
||||
+ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
|
||||
+ &write_cache_variants,
|
||||
&update_cache_variants),
|
||||
0,
|
||||
SPINAND_ECCINFO(&w25n02kv_ooblayout, w25n02kv_ecc_get_status)),
|
||||
@@ -1,320 +0,0 @@
|
||||
From f45ae9019afb838979792e4237e344003151fbf7 Mon Sep 17 00:00:00 2001
|
||||
From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
|
||||
Date: Sun, 12 Nov 2023 20:57:52 +0300
|
||||
Subject: [PATCH 1/5] mtd: spinand: Use the spi-mem dirmap API
|
||||
|
||||
Make use of the spi-mem direct mapping API to let advanced controllers
|
||||
optimize read/write operations when they support direct mapping.
|
||||
|
||||
Based on a linux commit 981d1aa0697c ("mtd: spinand: Use the spi-mem dirmap API")
|
||||
created by Boris Brezillon <bbrezillon@kernel.org> with additional
|
||||
fixes taken from Linux 6.10.
|
||||
|
||||
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
|
||||
Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
|
||||
---
|
||||
drivers/mtd/nand/spi/core.c | 185 +++++++++++++++++-------------------
|
||||
include/linux/mtd/spinand.h | 7 ++
|
||||
2 files changed, 95 insertions(+), 97 deletions(-)
|
||||
|
||||
diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c
|
||||
index f5ddfbf4b83..ea00cd7dcf0 100644
|
||||
--- a/drivers/mtd/nand/spi/core.c
|
||||
+++ b/drivers/mtd/nand/spi/core.c
|
||||
@@ -41,21 +41,6 @@ struct spinand_plat {
|
||||
/* SPI NAND index visible in MTD names */
|
||||
static int spi_nand_idx;
|
||||
|
||||
-static void spinand_cache_op_adjust_colum(struct spinand_device *spinand,
|
||||
- const struct nand_page_io_req *req,
|
||||
- u16 *column)
|
||||
-{
|
||||
- struct nand_device *nand = spinand_to_nand(spinand);
|
||||
- unsigned int shift;
|
||||
-
|
||||
- if (nand->memorg.planes_per_lun < 2)
|
||||
- return;
|
||||
-
|
||||
- /* The plane number is passed in MSB just above the column address */
|
||||
- shift = fls(nand->memorg.pagesize);
|
||||
- *column |= req->pos.plane << shift;
|
||||
-}
|
||||
-
|
||||
static int spinand_read_reg_op(struct spinand_device *spinand, u8 reg, u8 *val)
|
||||
{
|
||||
struct spi_mem_op op = SPINAND_GET_FEATURE_OP(reg,
|
||||
@@ -249,27 +234,21 @@ static int spinand_load_page_op(struct spinand_device *spinand,
|
||||
static int spinand_read_from_cache_op(struct spinand_device *spinand,
|
||||
const struct nand_page_io_req *req)
|
||||
{
|
||||
- struct spi_mem_op op = *spinand->op_templates.read_cache;
|
||||
struct nand_device *nand = spinand_to_nand(spinand);
|
||||
struct mtd_info *mtd = nanddev_to_mtd(nand);
|
||||
- struct nand_page_io_req adjreq = *req;
|
||||
+ struct spi_mem_dirmap_desc *rdesc;
|
||||
unsigned int nbytes = 0;
|
||||
void *buf = NULL;
|
||||
u16 column = 0;
|
||||
- int ret;
|
||||
+ ssize_t ret;
|
||||
|
||||
if (req->datalen) {
|
||||
- adjreq.datalen = nanddev_page_size(nand);
|
||||
- adjreq.dataoffs = 0;
|
||||
- adjreq.databuf.in = spinand->databuf;
|
||||
buf = spinand->databuf;
|
||||
- nbytes = adjreq.datalen;
|
||||
+ nbytes = nanddev_page_size(nand);
|
||||
+ column = 0;
|
||||
}
|
||||
|
||||
if (req->ooblen) {
|
||||
- adjreq.ooblen = nanddev_per_page_oobsize(nand);
|
||||
- adjreq.ooboffs = 0;
|
||||
- adjreq.oobbuf.in = spinand->oobbuf;
|
||||
nbytes += nanddev_per_page_oobsize(nand);
|
||||
if (!buf) {
|
||||
buf = spinand->oobbuf;
|
||||
@@ -277,28 +256,19 @@ static int spinand_read_from_cache_op(struct spinand_device *spinand,
|
||||
}
|
||||
}
|
||||
|
||||
- spinand_cache_op_adjust_colum(spinand, &adjreq, &column);
|
||||
- op.addr.val = column;
|
||||
+ rdesc = spinand->dirmaps[req->pos.plane].rdesc;
|
||||
|
||||
- /*
|
||||
- * Some controllers are limited in term of max RX data size. In this
|
||||
- * case, just repeat the READ_CACHE operation after updating the
|
||||
- * column.
|
||||
- */
|
||||
while (nbytes) {
|
||||
- op.data.buf.in = buf;
|
||||
- op.data.nbytes = nbytes;
|
||||
- ret = spi_mem_adjust_op_size(spinand->slave, &op);
|
||||
- if (ret)
|
||||
+ ret = spi_mem_dirmap_read(rdesc, column, nbytes, buf);
|
||||
+ if (ret < 0)
|
||||
return ret;
|
||||
|
||||
- ret = spi_mem_exec_op(spinand->slave, &op);
|
||||
- if (ret)
|
||||
- return ret;
|
||||
+ if (!ret || ret > nbytes)
|
||||
+ return -EIO;
|
||||
|
||||
- buf += op.data.nbytes;
|
||||
- nbytes -= op.data.nbytes;
|
||||
- op.addr.val += op.data.nbytes;
|
||||
+ nbytes -= ret;
|
||||
+ column += ret;
|
||||
+ buf += ret;
|
||||
}
|
||||
|
||||
if (req->datalen)
|
||||
@@ -322,14 +292,12 @@ static int spinand_read_from_cache_op(struct spinand_device *spinand,
|
||||
static int spinand_write_to_cache_op(struct spinand_device *spinand,
|
||||
const struct nand_page_io_req *req)
|
||||
{
|
||||
- struct spi_mem_op op = *spinand->op_templates.write_cache;
|
||||
struct nand_device *nand = spinand_to_nand(spinand);
|
||||
struct mtd_info *mtd = nanddev_to_mtd(nand);
|
||||
- struct nand_page_io_req adjreq = *req;
|
||||
- unsigned int nbytes = 0;
|
||||
- void *buf = NULL;
|
||||
- u16 column = 0;
|
||||
- int ret;
|
||||
+ struct spi_mem_dirmap_desc *wdesc;
|
||||
+ unsigned int nbytes, column = 0;
|
||||
+ void *buf = spinand->databuf;
|
||||
+ ssize_t ret;
|
||||
|
||||
/*
|
||||
* Looks like PROGRAM LOAD (AKA write cache) does not necessarily reset
|
||||
@@ -338,19 +306,12 @@ static int spinand_write_to_cache_op(struct spinand_device *spinand,
|
||||
* the data portion of the page, otherwise we might corrupt the BBM or
|
||||
* user data previously programmed in OOB area.
|
||||
*/
|
||||
- memset(spinand->databuf, 0xff,
|
||||
- nanddev_page_size(nand) +
|
||||
- nanddev_per_page_oobsize(nand));
|
||||
+ nbytes = nanddev_page_size(nand) + nanddev_per_page_oobsize(nand);
|
||||
+ memset(spinand->databuf, 0xff, nbytes);
|
||||
|
||||
- if (req->datalen) {
|
||||
+ if (req->datalen)
|
||||
memcpy(spinand->databuf + req->dataoffs, req->databuf.out,
|
||||
req->datalen);
|
||||
- adjreq.dataoffs = 0;
|
||||
- adjreq.datalen = nanddev_page_size(nand);
|
||||
- adjreq.databuf.out = spinand->databuf;
|
||||
- nbytes = adjreq.datalen;
|
||||
- buf = spinand->databuf;
|
||||
- }
|
||||
|
||||
if (req->ooblen) {
|
||||
if (req->mode == MTD_OPS_AUTO_OOB)
|
||||
@@ -361,52 +322,21 @@ static int spinand_write_to_cache_op(struct spinand_device *spinand,
|
||||
else
|
||||
memcpy(spinand->oobbuf + req->ooboffs, req->oobbuf.out,
|
||||
req->ooblen);
|
||||
-
|
||||
- adjreq.ooblen = nanddev_per_page_oobsize(nand);
|
||||
- adjreq.ooboffs = 0;
|
||||
- nbytes += nanddev_per_page_oobsize(nand);
|
||||
- if (!buf) {
|
||||
- buf = spinand->oobbuf;
|
||||
- column = nanddev_page_size(nand);
|
||||
- }
|
||||
}
|
||||
|
||||
- spinand_cache_op_adjust_colum(spinand, &adjreq, &column);
|
||||
-
|
||||
- op = *spinand->op_templates.write_cache;
|
||||
- op.addr.val = column;
|
||||
+ wdesc = spinand->dirmaps[req->pos.plane].wdesc;
|
||||
|
||||
- /*
|
||||
- * Some controllers are limited in term of max TX data size. In this
|
||||
- * case, split the operation into one LOAD CACHE and one or more
|
||||
- * LOAD RANDOM CACHE.
|
||||
- */
|
||||
while (nbytes) {
|
||||
- op.data.buf.out = buf;
|
||||
- op.data.nbytes = nbytes;
|
||||
-
|
||||
- ret = spi_mem_adjust_op_size(spinand->slave, &op);
|
||||
- if (ret)
|
||||
- return ret;
|
||||
-
|
||||
- ret = spi_mem_exec_op(spinand->slave, &op);
|
||||
- if (ret)
|
||||
+ ret = spi_mem_dirmap_write(wdesc, column, nbytes, buf);
|
||||
+ if (ret < 0)
|
||||
return ret;
|
||||
|
||||
- buf += op.data.nbytes;
|
||||
- nbytes -= op.data.nbytes;
|
||||
- op.addr.val += op.data.nbytes;
|
||||
+ if (!ret || ret > nbytes)
|
||||
+ return -EIO;
|
||||
|
||||
- /*
|
||||
- * We need to use the RANDOM LOAD CACHE operation if there's
|
||||
- * more than one iteration, because the LOAD operation resets
|
||||
- * the cache to 0xff.
|
||||
- */
|
||||
- if (nbytes) {
|
||||
- column = op.addr.val;
|
||||
- op = *spinand->op_templates.update_cache;
|
||||
- op.addr.val = column;
|
||||
- }
|
||||
+ nbytes -= ret;
|
||||
+ column += ret;
|
||||
+ buf += ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -819,6 +749,59 @@ static int spinand_mtd_block_isreserved(struct mtd_info *mtd, loff_t offs)
|
||||
return ret;
|
||||
}
|
||||
|
||||
+static int spinand_create_dirmap(struct spinand_device *spinand,
|
||||
+ unsigned int plane)
|
||||
+{
|
||||
+ struct nand_device *nand = spinand_to_nand(spinand);
|
||||
+ struct spi_mem_dirmap_info info = {
|
||||
+ .length = nanddev_page_size(nand) +
|
||||
+ nanddev_per_page_oobsize(nand),
|
||||
+ };
|
||||
+ struct spi_mem_dirmap_desc *desc;
|
||||
+
|
||||
+ /* The plane number is passed in MSB just above the column address */
|
||||
+ info.offset = plane << fls(nand->memorg.pagesize);
|
||||
+
|
||||
+ info.op_tmpl = *spinand->op_templates.update_cache;
|
||||
+ desc = spi_mem_dirmap_create(spinand->slave, &info);
|
||||
+ if (IS_ERR(desc))
|
||||
+ return PTR_ERR(desc);
|
||||
+
|
||||
+ spinand->dirmaps[plane].wdesc = desc;
|
||||
+
|
||||
+ info.op_tmpl = *spinand->op_templates.read_cache;
|
||||
+ desc = spi_mem_dirmap_create(spinand->slave, &info);
|
||||
+ if (IS_ERR(desc)) {
|
||||
+ spi_mem_dirmap_destroy(spinand->dirmaps[plane].wdesc);
|
||||
+ return PTR_ERR(desc);
|
||||
+ }
|
||||
+
|
||||
+ spinand->dirmaps[plane].rdesc = desc;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int spinand_create_dirmaps(struct spinand_device *spinand)
|
||||
+{
|
||||
+ struct nand_device *nand = spinand_to_nand(spinand);
|
||||
+ int i, ret;
|
||||
+
|
||||
+ spinand->dirmaps = devm_kzalloc(spinand->slave->dev,
|
||||
+ sizeof(*spinand->dirmaps) *
|
||||
+ nand->memorg.planes_per_lun,
|
||||
+ GFP_KERNEL);
|
||||
+ if (!spinand->dirmaps)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ for (i = 0; i < nand->memorg.planes_per_lun; i++) {
|
||||
+ ret = spinand_create_dirmap(spinand, i);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static const struct nand_ops spinand_ops = {
|
||||
.erase = spinand_erase,
|
||||
.markbad = spinand_markbad,
|
||||
@@ -1116,6 +1099,14 @@ static int spinand_init(struct spinand_device *spinand)
|
||||
goto err_free_bufs;
|
||||
}
|
||||
|
||||
+ ret = spinand_create_dirmaps(spinand);
|
||||
+ if (ret) {
|
||||
+ dev_err(spinand->slave->dev,
|
||||
+ "Failed to create direct mappings for read/write operations (err = %d)\n",
|
||||
+ ret);
|
||||
+ goto err_manuf_cleanup;
|
||||
+ }
|
||||
+
|
||||
/* After power up, all blocks are locked, so unlock them here. */
|
||||
for (i = 0; i < nand->memorg.ntargets; i++) {
|
||||
ret = spinand_select_target(spinand, i);
|
||||
diff --git a/include/linux/mtd/spinand.h b/include/linux/mtd/spinand.h
|
||||
index 6fe6fd520a4..163269313f6 100644
|
||||
--- a/include/linux/mtd/spinand.h
|
||||
+++ b/include/linux/mtd/spinand.h
|
||||
@@ -363,6 +363,11 @@ struct spinand_info {
|
||||
__VA_ARGS__ \
|
||||
}
|
||||
|
||||
+struct spinand_dirmap {
|
||||
+ struct spi_mem_dirmap_desc *wdesc;
|
||||
+ struct spi_mem_dirmap_desc *rdesc;
|
||||
+};
|
||||
+
|
||||
/**
|
||||
* struct spinand_device - SPI NAND device instance
|
||||
* @base: NAND device instance
|
||||
@@ -406,6 +411,8 @@ struct spinand_device {
|
||||
const struct spi_mem_op *update_cache;
|
||||
} op_templates;
|
||||
|
||||
+ struct spinand_dirmap *dirmaps;
|
||||
+
|
||||
int (*select_target)(struct spinand_device *spinand,
|
||||
unsigned int target);
|
||||
unsigned int cur_target;
|
||||
--
|
||||
2.51.0
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
From 1e29cf13c183ee457ed70055f5cbff60ff56a726 Mon Sep 17 00:00:00 2001
|
||||
From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
|
||||
Date: Sat, 7 Jun 2025 07:18:12 +0300
|
||||
Subject: [PATCH 2/5] spi: airoha: remove unnecessary operation adjust_op_size
|
||||
|
||||
This operation is not needed because airoha_snand_write_data() and
|
||||
airoha_snand_read_data() will properly handle data transfers above
|
||||
SPI_MAX_TRANSFER_SIZE.
|
||||
|
||||
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
|
||||
---
|
||||
drivers/spi/airoha_snfi_spi.c | 16 ----------------
|
||||
1 file changed, 16 deletions(-)
|
||||
|
||||
diff --git a/drivers/spi/airoha_snfi_spi.c b/drivers/spi/airoha_snfi_spi.c
|
||||
index 3ea25b293d1..4eb01038404 100644
|
||||
--- a/drivers/spi/airoha_snfi_spi.c
|
||||
+++ b/drivers/spi/airoha_snfi_spi.c
|
||||
@@ -525,21 +525,6 @@ static int airoha_snand_nfi_config(struct airoha_snand_priv *priv)
|
||||
SPI_NFI_CUS_SEC_SIZE, val);
|
||||
}
|
||||
|
||||
-static int airoha_snand_adjust_op_size(struct spi_slave *slave,
|
||||
- struct spi_mem_op *op)
|
||||
-{
|
||||
- size_t max_len;
|
||||
-
|
||||
- max_len = 1 + op->addr.nbytes + op->dummy.nbytes;
|
||||
- if (max_len >= 160)
|
||||
- return -EOPNOTSUPP;
|
||||
-
|
||||
- if (op->data.nbytes > 160 - max_len)
|
||||
- op->data.nbytes = 160 - max_len;
|
||||
-
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
static bool airoha_snand_supports_op(struct spi_slave *slave,
|
||||
const struct spi_mem_op *op)
|
||||
{
|
||||
@@ -691,7 +676,6 @@ static int airoha_snand_nfi_setup(struct spi_slave *slave,
|
||||
}
|
||||
|
||||
static const struct spi_controller_mem_ops airoha_snand_mem_ops = {
|
||||
- .adjust_op_size = airoha_snand_adjust_op_size,
|
||||
.supports_op = airoha_snand_supports_op,
|
||||
.exec_op = airoha_snand_exec_op,
|
||||
};
|
||||
--
|
||||
2.51.0
|
||||
|
||||
@@ -1,262 +0,0 @@
|
||||
From fe8c32af9d8c8ff8875efece82001680fc300ad5 Mon Sep 17 00:00:00 2001
|
||||
From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
|
||||
Date: Sat, 7 Jun 2025 09:09:38 +0300
|
||||
Subject: [PATCH 3/5] spi: airoha: add support of dual/quad wires spi modes
|
||||
to exec_op() handler
|
||||
|
||||
Booting without this patch and disabled dirmap support results in
|
||||
|
||||
[ 2.980719] spi-nand spi0.0: Micron SPI NAND was found.
|
||||
[ 2.986040] spi-nand spi0.0: 256 MiB, block size: 128 KiB, page size: 2048, OOB size: 128
|
||||
[ 2.994709] 2 fixed-partitions partitions found on MTD device spi0.0
|
||||
[ 3.001075] Creating 2 MTD partitions on "spi0.0":
|
||||
[ 3.005862] 0x000000000000-0x000000020000 : "bl2"
|
||||
[ 3.011272] 0x000000020000-0x000010000000 : "ubi"
|
||||
...
|
||||
[ 6.195594] ubi0: attaching mtd1
|
||||
[ 13.338398] ubi0: scanning is finished
|
||||
[ 13.342188] ubi0 error: ubi_read_volume_table: the layout volume was not found
|
||||
[ 13.349784] ubi0 error: ubi_attach_mtd_dev: failed to attach mtd1, error -22
|
||||
[ 13.356897] UBI error: cannot attach mtd1
|
||||
|
||||
If dirmap is disabled or not supported in the spi driver, the dirmap requests
|
||||
will be executed via exec_op() handler. Thus, if the hardware supports
|
||||
dual/quad spi modes, then corresponding requests will be sent to exec_op()
|
||||
handler. Current driver does not support such requests, so error is arrised.
|
||||
As result the flash can't be read/write.
|
||||
|
||||
This patch adds support of dual and quad wires spi modes to exec_op() handler.
|
||||
|
||||
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
|
||||
---
|
||||
drivers/spi/airoha_snfi_spi.c | 143 +++++++++++++++++++++++++++-------
|
||||
1 file changed, 117 insertions(+), 26 deletions(-)
|
||||
|
||||
diff --git a/drivers/spi/airoha_snfi_spi.c b/drivers/spi/airoha_snfi_spi.c
|
||||
index 4eb01038404..7cd409ba44a 100644
|
||||
--- a/drivers/spi/airoha_snfi_spi.c
|
||||
+++ b/drivers/spi/airoha_snfi_spi.c
|
||||
@@ -186,6 +186,14 @@
|
||||
#define SPI_NAND_OP_RESET 0xff
|
||||
#define SPI_NAND_OP_DIE_SELECT 0xc2
|
||||
|
||||
+/* SNAND FIFO commands */
|
||||
+#define SNAND_FIFO_TX_BUSWIDTH_SINGLE 0x08
|
||||
+#define SNAND_FIFO_TX_BUSWIDTH_DUAL 0x09
|
||||
+#define SNAND_FIFO_TX_BUSWIDTH_QUAD 0x0a
|
||||
+#define SNAND_FIFO_RX_BUSWIDTH_SINGLE 0x0c
|
||||
+#define SNAND_FIFO_RX_BUSWIDTH_DUAL 0x0e
|
||||
+#define SNAND_FIFO_RX_BUSWIDTH_QUAD 0x0f
|
||||
+
|
||||
#define SPI_NAND_CACHE_SIZE (SZ_4K + SZ_256)
|
||||
#define SPI_MAX_TRANSFER_SIZE 511
|
||||
|
||||
@@ -380,10 +388,26 @@ static int airoha_snand_set_mode(struct airoha_snand_priv *priv,
|
||||
return regmap_write(priv->regmap_ctrl, REG_SPI_CTRL_DUMMY, 0);
|
||||
}
|
||||
|
||||
-static int airoha_snand_write_data(struct airoha_snand_priv *priv, u8 cmd,
|
||||
- const u8 *data, int len)
|
||||
+static int airoha_snand_write_data(struct airoha_snand_priv *priv,
|
||||
+ const u8 *data, int len, int buswidth)
|
||||
{
|
||||
int i, data_len;
|
||||
+ u8 cmd;
|
||||
+
|
||||
+ switch (buswidth) {
|
||||
+ case 0:
|
||||
+ case 1:
|
||||
+ cmd = SNAND_FIFO_TX_BUSWIDTH_SINGLE;
|
||||
+ break;
|
||||
+ case 2:
|
||||
+ cmd = SNAND_FIFO_TX_BUSWIDTH_DUAL;
|
||||
+ break;
|
||||
+ case 4:
|
||||
+ cmd = SNAND_FIFO_TX_BUSWIDTH_QUAD;
|
||||
+ break;
|
||||
+ default:
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
|
||||
for (i = 0; i < len; i += data_len) {
|
||||
int err;
|
||||
@@ -402,16 +426,32 @@ static int airoha_snand_write_data(struct airoha_snand_priv *priv, u8 cmd,
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static int airoha_snand_read_data(struct airoha_snand_priv *priv, u8 *data,
|
||||
- int len)
|
||||
+static int airoha_snand_read_data(struct airoha_snand_priv *priv,
|
||||
+ u8 *data, int len, int buswidth)
|
||||
{
|
||||
int i, data_len;
|
||||
+ u8 cmd;
|
||||
+
|
||||
+ switch (buswidth) {
|
||||
+ case 0:
|
||||
+ case 1:
|
||||
+ cmd = SNAND_FIFO_RX_BUSWIDTH_SINGLE;
|
||||
+ break;
|
||||
+ case 2:
|
||||
+ cmd = SNAND_FIFO_RX_BUSWIDTH_DUAL;
|
||||
+ break;
|
||||
+ case 4:
|
||||
+ cmd = SNAND_FIFO_RX_BUSWIDTH_QUAD;
|
||||
+ break;
|
||||
+ default:
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
|
||||
for (i = 0; i < len; i += data_len) {
|
||||
int err;
|
||||
|
||||
data_len = min(len - i, SPI_MAX_TRANSFER_SIZE);
|
||||
- err = airoha_snand_set_fifo_op(priv, 0xc, data_len);
|
||||
+ err = airoha_snand_set_fifo_op(priv, cmd, data_len);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
@@ -525,6 +565,38 @@ static int airoha_snand_nfi_config(struct airoha_snand_priv *priv)
|
||||
SPI_NFI_CUS_SEC_SIZE, val);
|
||||
}
|
||||
|
||||
+static bool airoha_snand_is_page_ops(const struct spi_mem_op *op)
|
||||
+{
|
||||
+ if (op->addr.nbytes != 2)
|
||||
+ return false;
|
||||
+
|
||||
+ if (op->addr.buswidth != 1 && op->addr.buswidth != 2 &&
|
||||
+ op->addr.buswidth != 4)
|
||||
+ return false;
|
||||
+
|
||||
+ switch (op->data.dir) {
|
||||
+ case SPI_MEM_DATA_IN:
|
||||
+ if (op->dummy.nbytes * BITS_PER_BYTE / op->dummy.buswidth > 0xf)
|
||||
+ return false;
|
||||
+
|
||||
+ /* quad in / quad out */
|
||||
+ if (op->addr.buswidth == 4)
|
||||
+ return op->data.buswidth == 4;
|
||||
+
|
||||
+ if (op->addr.buswidth == 2)
|
||||
+ return op->data.buswidth == 2;
|
||||
+
|
||||
+ /* standard spi */
|
||||
+ return op->data.buswidth == 4 || op->data.buswidth == 2 ||
|
||||
+ op->data.buswidth == 1;
|
||||
+ case SPI_MEM_DATA_OUT:
|
||||
+ return !op->dummy.nbytes && op->addr.buswidth == 1 &&
|
||||
+ (op->data.buswidth == 4 || op->data.buswidth == 1);
|
||||
+ default:
|
||||
+ return false;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static bool airoha_snand_supports_op(struct spi_slave *slave,
|
||||
const struct spi_mem_op *op)
|
||||
{
|
||||
@@ -534,6 +606,9 @@ static bool airoha_snand_supports_op(struct spi_slave *slave,
|
||||
if (op->cmd.buswidth != 1)
|
||||
return false;
|
||||
|
||||
+ if (airoha_snand_is_page_ops(op))
|
||||
+ return true;
|
||||
+
|
||||
return (!op->addr.nbytes || op->addr.buswidth == 1) &&
|
||||
(!op->dummy.nbytes || op->dummy.buswidth == 1) &&
|
||||
(!op->data.nbytes || op->data.buswidth == 1);
|
||||
@@ -542,13 +617,29 @@ static bool airoha_snand_supports_op(struct spi_slave *slave,
|
||||
static int airoha_snand_exec_op(struct spi_slave *slave,
|
||||
const struct spi_mem_op *op)
|
||||
{
|
||||
- u8 data[8], cmd, opcode = op->cmd.opcode;
|
||||
struct udevice *bus = slave->dev->parent;
|
||||
struct airoha_snand_priv *priv;
|
||||
+ int op_len, addr_len, dummy_len;
|
||||
+ u8 buf[20], *data;
|
||||
int i, err;
|
||||
|
||||
priv = dev_get_priv(bus);
|
||||
|
||||
+ op_len = op->cmd.nbytes;
|
||||
+ addr_len = op->addr.nbytes;
|
||||
+ dummy_len = op->dummy.nbytes;
|
||||
+
|
||||
+ if (op_len + dummy_len + addr_len > sizeof(buf))
|
||||
+ return -EIO;
|
||||
+
|
||||
+ data = buf;
|
||||
+ for (i = 0; i < op_len; i++)
|
||||
+ *data++ = op->cmd.opcode >> (8 * (op_len - i - 1));
|
||||
+ for (i = 0; i < addr_len; i++)
|
||||
+ *data++ = op->addr.val >> (8 * (addr_len - i - 1));
|
||||
+ for (i = 0; i < dummy_len; i++)
|
||||
+ *data++ = 0xff;
|
||||
+
|
||||
/* switch to manual mode */
|
||||
err = airoha_snand_set_mode(priv, SPI_MODE_MANUAL);
|
||||
if (err < 0)
|
||||
@@ -559,40 +650,40 @@ static int airoha_snand_exec_op(struct spi_slave *slave,
|
||||
return err;
|
||||
|
||||
/* opcode */
|
||||
- err = airoha_snand_write_data(priv, 0x8, &opcode, sizeof(opcode));
|
||||
+ data = buf;
|
||||
+ err = airoha_snand_write_data(priv, data, op_len,
|
||||
+ op->cmd.buswidth);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
/* addr part */
|
||||
- cmd = opcode == SPI_NAND_OP_GET_FEATURE ? 0x11 : 0x8;
|
||||
- put_unaligned_be64(op->addr.val, data);
|
||||
-
|
||||
- for (i = ARRAY_SIZE(data) - op->addr.nbytes;
|
||||
- i < ARRAY_SIZE(data); i++) {
|
||||
- err = airoha_snand_write_data(priv, cmd, &data[i],
|
||||
- sizeof(data[0]));
|
||||
+ data += op_len;
|
||||
+ if (addr_len) {
|
||||
+ err = airoha_snand_write_data(priv, data, addr_len,
|
||||
+ op->addr.buswidth);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
|
||||
/* dummy */
|
||||
- data[0] = 0xff;
|
||||
- for (i = 0; i < op->dummy.nbytes; i++) {
|
||||
- err = airoha_snand_write_data(priv, 0x8, &data[0],
|
||||
- sizeof(data[0]));
|
||||
+ data += addr_len;
|
||||
+ if (dummy_len) {
|
||||
+ err = airoha_snand_write_data(priv, data, dummy_len,
|
||||
+ op->dummy.buswidth);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
|
||||
/* data */
|
||||
- if (op->data.dir == SPI_MEM_DATA_IN) {
|
||||
- err = airoha_snand_read_data(priv, op->data.buf.in,
|
||||
- op->data.nbytes);
|
||||
- if (err)
|
||||
- return err;
|
||||
- } else {
|
||||
- err = airoha_snand_write_data(priv, 0x8, op->data.buf.out,
|
||||
- op->data.nbytes);
|
||||
+ if (op->data.nbytes) {
|
||||
+ if (op->data.dir == SPI_MEM_DATA_IN)
|
||||
+ err = airoha_snand_read_data(priv, op->data.buf.in,
|
||||
+ op->data.nbytes,
|
||||
+ op->data.buswidth);
|
||||
+ else
|
||||
+ err = airoha_snand_write_data(priv, op->data.buf.out,
|
||||
+ op->data.nbytes,
|
||||
+ op->data.buswidth);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
--
|
||||
2.51.0
|
||||
|
||||
@@ -1,378 +0,0 @@
|
||||
From f1fe2f174f26eb98af35862caea083439e08a344 Mon Sep 17 00:00:00 2001
|
||||
From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
|
||||
Date: Sun, 8 Jun 2025 05:30:22 +0300
|
||||
Subject: [PATCH 4/5] spi: airoha: add dma support
|
||||
|
||||
This patch speed up cache reading/writing/updating opearions.
|
||||
It was tested on en7523/an7581 and some other Airoha chips.
|
||||
|
||||
It will speed up
|
||||
* page reading/writing without oob
|
||||
* page reading/writing with oob
|
||||
* oob reading/writing (significant for UBI scanning)
|
||||
|
||||
The only know issue appears in a very specific conditions for en7523 family
|
||||
chips only.
|
||||
|
||||
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
|
||||
---
|
||||
drivers/spi/airoha_snfi_spi.c | 309 ++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 309 insertions(+)
|
||||
|
||||
diff --git a/drivers/spi/airoha_snfi_spi.c b/drivers/spi/airoha_snfi_spi.c
|
||||
index 7cd409ba44a..f72d11f5b19 100644
|
||||
--- a/drivers/spi/airoha_snfi_spi.c
|
||||
+++ b/drivers/spi/airoha_snfi_spi.c
|
||||
@@ -141,12 +141,14 @@
|
||||
#define SPI_NFI_CUS_SEC_SIZE_EN BIT(16)
|
||||
|
||||
#define REG_SPI_NFI_RD_CTL2 0x0510
|
||||
+
|
||||
#define REG_SPI_NFI_RD_CTL3 0x0514
|
||||
|
||||
#define REG_SPI_NFI_PG_CTL1 0x0524
|
||||
#define SPI_NFI_PG_LOAD_CMD GENMASK(15, 8)
|
||||
|
||||
#define REG_SPI_NFI_PG_CTL2 0x0528
|
||||
+
|
||||
#define REG_SPI_NFI_NOR_PROG_ADDR 0x052c
|
||||
#define REG_SPI_NFI_NOR_RD_ADDR 0x0534
|
||||
|
||||
@@ -219,6 +221,8 @@ struct airoha_snand_priv {
|
||||
u8 sec_num;
|
||||
u8 spare_size;
|
||||
} nfi_cfg;
|
||||
+
|
||||
+ u8 *txrx_buf;
|
||||
};
|
||||
|
||||
static int airoha_snand_set_fifo_op(struct airoha_snand_priv *priv,
|
||||
@@ -614,6 +618,302 @@ static bool airoha_snand_supports_op(struct spi_slave *slave,
|
||||
(!op->data.nbytes || op->data.buswidth == 1);
|
||||
}
|
||||
|
||||
+static int airoha_snand_dirmap_create(struct spi_mem_dirmap_desc *desc)
|
||||
+{
|
||||
+ struct spi_slave *slave = desc->slave;
|
||||
+ struct udevice *bus = slave->dev->parent;
|
||||
+ struct airoha_snand_priv *priv = dev_get_priv(bus);
|
||||
+
|
||||
+ if (!priv->txrx_buf)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ if (desc->info.offset + desc->info.length > U32_MAX)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ if (!airoha_snand_supports_op(desc->slave, &desc->info.op_tmpl))
|
||||
+ return -EOPNOTSUPP;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static ssize_t airoha_snand_dirmap_read(struct spi_mem_dirmap_desc *desc,
|
||||
+ u64 offs, size_t len, void *buf)
|
||||
+{
|
||||
+ struct spi_mem_op *op = &desc->info.op_tmpl;
|
||||
+ struct spi_slave *slave = desc->slave;
|
||||
+ struct udevice *bus = slave->dev->parent;
|
||||
+ struct airoha_snand_priv *priv = dev_get_priv(bus);
|
||||
+ u8 *txrx_buf = priv->txrx_buf;
|
||||
+ dma_addr_t dma_addr;
|
||||
+ u32 val, rd_mode;
|
||||
+ int err;
|
||||
+
|
||||
+ switch (op->cmd.opcode) {
|
||||
+ case SPI_NAND_OP_READ_FROM_CACHE_DUAL:
|
||||
+ rd_mode = 1;
|
||||
+ break;
|
||||
+ case SPI_NAND_OP_READ_FROM_CACHE_QUAD:
|
||||
+ rd_mode = 2;
|
||||
+ break;
|
||||
+ default:
|
||||
+ rd_mode = 0;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ err = airoha_snand_set_mode(priv, SPI_MODE_DMA);
|
||||
+ if (err < 0)
|
||||
+ return err;
|
||||
+
|
||||
+ err = airoha_snand_nfi_config(priv);
|
||||
+ if (err)
|
||||
+ goto error_dma_mode_off;
|
||||
+
|
||||
+ dma_addr = dma_map_single(txrx_buf, SPI_NAND_CACHE_SIZE,
|
||||
+ DMA_FROM_DEVICE);
|
||||
+
|
||||
+ /* set dma addr */
|
||||
+ err = regmap_write(priv->regmap_nfi, REG_SPI_NFI_STRADDR,
|
||||
+ dma_addr);
|
||||
+ if (err)
|
||||
+ goto error_dma_unmap;
|
||||
+
|
||||
+ /* set cust sec size */
|
||||
+ val = priv->nfi_cfg.sec_size * priv->nfi_cfg.sec_num;
|
||||
+ val = FIELD_PREP(SPI_NFI_READ_DATA_BYTE_NUM, val);
|
||||
+ err = regmap_update_bits(priv->regmap_nfi,
|
||||
+ REG_SPI_NFI_SNF_MISC_CTL2,
|
||||
+ SPI_NFI_READ_DATA_BYTE_NUM, val);
|
||||
+ if (err)
|
||||
+ goto error_dma_unmap;
|
||||
+
|
||||
+ /* set read command */
|
||||
+ err = regmap_write(priv->regmap_nfi, REG_SPI_NFI_RD_CTL2,
|
||||
+ op->cmd.opcode);
|
||||
+ if (err)
|
||||
+ goto error_dma_unmap;
|
||||
+
|
||||
+ /* set read mode */
|
||||
+ err = regmap_write(priv->regmap_nfi, REG_SPI_NFI_SNF_MISC_CTL,
|
||||
+ FIELD_PREP(SPI_NFI_DATA_READ_WR_MODE, rd_mode));
|
||||
+ if (err)
|
||||
+ goto error_dma_unmap;
|
||||
+
|
||||
+ /* set read addr: zero page offset + descriptor read offset */
|
||||
+ err = regmap_write(priv->regmap_nfi, REG_SPI_NFI_RD_CTL3,
|
||||
+ desc->info.offset);
|
||||
+ if (err)
|
||||
+ goto error_dma_unmap;
|
||||
+
|
||||
+ /* set nfi read */
|
||||
+ err = regmap_update_bits(priv->regmap_nfi, REG_SPI_NFI_CNFG,
|
||||
+ SPI_NFI_OPMODE,
|
||||
+ FIELD_PREP(SPI_NFI_OPMODE, 6));
|
||||
+ if (err)
|
||||
+ goto error_dma_unmap;
|
||||
+
|
||||
+ err = regmap_set_bits(priv->regmap_nfi, REG_SPI_NFI_CNFG,
|
||||
+ SPI_NFI_READ_MODE | SPI_NFI_DMA_MODE);
|
||||
+ if (err)
|
||||
+ goto error_dma_unmap;
|
||||
+
|
||||
+ err = regmap_write(priv->regmap_nfi, REG_SPI_NFI_CMD, 0x0);
|
||||
+ if (err)
|
||||
+ goto error_dma_unmap;
|
||||
+
|
||||
+ /* trigger dma reading */
|
||||
+ err = regmap_clear_bits(priv->regmap_nfi, REG_SPI_NFI_CON,
|
||||
+ SPI_NFI_RD_TRIG);
|
||||
+ if (err)
|
||||
+ goto error_dma_unmap;
|
||||
+
|
||||
+ err = regmap_set_bits(priv->regmap_nfi, REG_SPI_NFI_CON,
|
||||
+ SPI_NFI_RD_TRIG);
|
||||
+ if (err)
|
||||
+ goto error_dma_unmap;
|
||||
+
|
||||
+ err = regmap_read_poll_timeout(priv->regmap_nfi,
|
||||
+ REG_SPI_NFI_SNF_STA_CTL1, val,
|
||||
+ (val & SPI_NFI_READ_FROM_CACHE_DONE),
|
||||
+ 0, 1 * MSEC_PER_SEC);
|
||||
+ if (err)
|
||||
+ goto error_dma_unmap;
|
||||
+
|
||||
+ /*
|
||||
+ * SPI_NFI_READ_FROM_CACHE_DONE bit must be written at the end
|
||||
+ * of dirmap_read operation even if it is already set.
|
||||
+ */
|
||||
+ err = regmap_update_bits(priv->regmap_nfi, REG_SPI_NFI_SNF_STA_CTL1,
|
||||
+ SPI_NFI_READ_FROM_CACHE_DONE,
|
||||
+ SPI_NFI_READ_FROM_CACHE_DONE);
|
||||
+ if (err)
|
||||
+ goto error_dma_unmap;
|
||||
+
|
||||
+ err = regmap_read_poll_timeout(priv->regmap_nfi, REG_SPI_NFI_INTR,
|
||||
+ val, (val & SPI_NFI_AHB_DONE), 0,
|
||||
+ 1 * MSEC_PER_SEC);
|
||||
+ if (err)
|
||||
+ goto error_dma_unmap;
|
||||
+
|
||||
+ /* DMA read need delay for data ready from controller to DRAM */
|
||||
+ udelay(1);
|
||||
+
|
||||
+ dma_unmap_single(dma_addr, SPI_NAND_CACHE_SIZE, DMA_FROM_DEVICE);
|
||||
+
|
||||
+ err = airoha_snand_set_mode(priv, SPI_MODE_MANUAL);
|
||||
+ if (err < 0)
|
||||
+ return err;
|
||||
+
|
||||
+ memcpy(buf, txrx_buf + offs, len);
|
||||
+
|
||||
+ return len;
|
||||
+
|
||||
+error_dma_unmap:
|
||||
+ dma_unmap_single(dma_addr, SPI_NAND_CACHE_SIZE, DMA_FROM_DEVICE);
|
||||
+error_dma_mode_off:
|
||||
+ airoha_snand_set_mode(priv, SPI_MODE_MANUAL);
|
||||
+ return err;
|
||||
+}
|
||||
+
|
||||
+static ssize_t airoha_snand_dirmap_write(struct spi_mem_dirmap_desc *desc,
|
||||
+ u64 offs, size_t len, const void *buf)
|
||||
+{
|
||||
+ struct spi_slave *slave = desc->slave;
|
||||
+ struct udevice *bus = slave->dev->parent;
|
||||
+ struct airoha_snand_priv *priv = dev_get_priv(bus);
|
||||
+ u8 *txrx_buf = priv->txrx_buf;
|
||||
+ dma_addr_t dma_addr;
|
||||
+ u32 wr_mode, val, opcode;
|
||||
+ int err;
|
||||
+
|
||||
+ opcode = desc->info.op_tmpl.cmd.opcode;
|
||||
+ switch (opcode) {
|
||||
+ case SPI_NAND_OP_PROGRAM_LOAD_SINGLE:
|
||||
+ case SPI_NAND_OP_PROGRAM_LOAD_RAMDOM_SINGLE:
|
||||
+ wr_mode = 0;
|
||||
+ break;
|
||||
+ case SPI_NAND_OP_PROGRAM_LOAD_QUAD:
|
||||
+ case SPI_NAND_OP_PROGRAM_LOAD_RAMDON_QUAD:
|
||||
+ wr_mode = 2;
|
||||
+ break;
|
||||
+ default:
|
||||
+ /* unknown opcode */
|
||||
+ return -EOPNOTSUPP;
|
||||
+ }
|
||||
+
|
||||
+ memcpy(txrx_buf + offs, buf, len);
|
||||
+
|
||||
+ err = airoha_snand_set_mode(priv, SPI_MODE_DMA);
|
||||
+ if (err < 0)
|
||||
+ return err;
|
||||
+
|
||||
+ err = airoha_snand_nfi_config(priv);
|
||||
+ if (err)
|
||||
+ goto error_dma_mode_off;
|
||||
+
|
||||
+ dma_addr = dma_map_single(txrx_buf, SPI_NAND_CACHE_SIZE,
|
||||
+ DMA_TO_DEVICE);
|
||||
+
|
||||
+ /* set dma addr */
|
||||
+ err = regmap_write(priv->regmap_nfi, REG_SPI_NFI_STRADDR,
|
||||
+ dma_addr);
|
||||
+ if (err)
|
||||
+ goto error_dma_unmap;
|
||||
+
|
||||
+ val = FIELD_PREP(SPI_NFI_PROG_LOAD_BYTE_NUM,
|
||||
+ priv->nfi_cfg.sec_size * priv->nfi_cfg.sec_num);
|
||||
+ err = regmap_update_bits(priv->regmap_nfi,
|
||||
+ REG_SPI_NFI_SNF_MISC_CTL2,
|
||||
+ SPI_NFI_PROG_LOAD_BYTE_NUM, val);
|
||||
+ if (err)
|
||||
+ goto error_dma_unmap;
|
||||
+
|
||||
+ /* set write command */
|
||||
+ err = regmap_write(priv->regmap_nfi, REG_SPI_NFI_PG_CTL1,
|
||||
+ FIELD_PREP(SPI_NFI_PG_LOAD_CMD, opcode));
|
||||
+ if (err)
|
||||
+ goto error_dma_unmap;
|
||||
+
|
||||
+ /* set write mode */
|
||||
+ err = regmap_write(priv->regmap_nfi, REG_SPI_NFI_SNF_MISC_CTL,
|
||||
+ FIELD_PREP(SPI_NFI_DATA_READ_WR_MODE, wr_mode));
|
||||
+ if (err)
|
||||
+ goto error_dma_unmap;
|
||||
+
|
||||
+ /* set write addr: zero page offset + descriptor write offset */
|
||||
+ err = regmap_write(priv->regmap_nfi, REG_SPI_NFI_PG_CTL2,
|
||||
+ desc->info.offset);
|
||||
+ if (err)
|
||||
+ goto error_dma_unmap;
|
||||
+
|
||||
+ err = regmap_clear_bits(priv->regmap_nfi, REG_SPI_NFI_CNFG,
|
||||
+ SPI_NFI_READ_MODE);
|
||||
+ if (err)
|
||||
+ goto error_dma_unmap;
|
||||
+
|
||||
+ err = regmap_update_bits(priv->regmap_nfi, REG_SPI_NFI_CNFG,
|
||||
+ SPI_NFI_OPMODE,
|
||||
+ FIELD_PREP(SPI_NFI_OPMODE, 3));
|
||||
+ if (err)
|
||||
+ goto error_dma_unmap;
|
||||
+
|
||||
+ err = regmap_set_bits(priv->regmap_nfi, REG_SPI_NFI_CNFG,
|
||||
+ SPI_NFI_DMA_MODE);
|
||||
+ if (err)
|
||||
+ goto error_dma_unmap;
|
||||
+
|
||||
+ err = regmap_write(priv->regmap_nfi, REG_SPI_NFI_CMD, 0x80);
|
||||
+ if (err)
|
||||
+ goto error_dma_unmap;
|
||||
+
|
||||
+ /* trigger dma writing */
|
||||
+ err = regmap_clear_bits(priv->regmap_nfi, REG_SPI_NFI_CON,
|
||||
+ SPI_NFI_WR_TRIG);
|
||||
+ if (err)
|
||||
+ goto error_dma_unmap;
|
||||
+
|
||||
+ err = regmap_set_bits(priv->regmap_nfi, REG_SPI_NFI_CON,
|
||||
+ SPI_NFI_WR_TRIG);
|
||||
+ if (err)
|
||||
+ goto error_dma_unmap;
|
||||
+
|
||||
+ err = regmap_read_poll_timeout(priv->regmap_nfi, REG_SPI_NFI_INTR,
|
||||
+ val, (val & SPI_NFI_AHB_DONE), 0,
|
||||
+ 1 * MSEC_PER_SEC);
|
||||
+ if (err)
|
||||
+ goto error_dma_unmap;
|
||||
+
|
||||
+ err = regmap_read_poll_timeout(priv->regmap_nfi,
|
||||
+ REG_SPI_NFI_SNF_STA_CTL1, val,
|
||||
+ (val & SPI_NFI_LOAD_TO_CACHE_DONE),
|
||||
+ 0, 1 * MSEC_PER_SEC);
|
||||
+ if (err)
|
||||
+ goto error_dma_unmap;
|
||||
+
|
||||
+ /*
|
||||
+ * SPI_NFI_LOAD_TO_CACHE_DONE bit must be written at the end
|
||||
+ * of dirmap_write operation even if it is already set.
|
||||
+ */
|
||||
+ err = regmap_update_bits(priv->regmap_nfi, REG_SPI_NFI_SNF_STA_CTL1,
|
||||
+ SPI_NFI_LOAD_TO_CACHE_DONE,
|
||||
+ SPI_NFI_LOAD_TO_CACHE_DONE);
|
||||
+ if (err)
|
||||
+ goto error_dma_unmap;
|
||||
+
|
||||
+ dma_unmap_single(dma_addr, SPI_NAND_CACHE_SIZE, DMA_TO_DEVICE);
|
||||
+
|
||||
+ err = airoha_snand_set_mode(priv, SPI_MODE_MANUAL);
|
||||
+ if (err < 0)
|
||||
+ return err;
|
||||
+
|
||||
+ return len;
|
||||
+
|
||||
+error_dma_unmap:
|
||||
+ dma_unmap_single(dma_addr, SPI_NAND_CACHE_SIZE, DMA_TO_DEVICE);
|
||||
+error_dma_mode_off:
|
||||
+ airoha_snand_set_mode(priv, SPI_MODE_MANUAL);
|
||||
+ return err;
|
||||
+}
|
||||
+
|
||||
static int airoha_snand_exec_op(struct spi_slave *slave,
|
||||
const struct spi_mem_op *op)
|
||||
{
|
||||
@@ -696,6 +996,12 @@ static int airoha_snand_probe(struct udevice *dev)
|
||||
struct airoha_snand_priv *priv = dev_get_priv(dev);
|
||||
int ret;
|
||||
|
||||
+ priv->txrx_buf = memalign(ARCH_DMA_MINALIGN, SPI_NAND_CACHE_SIZE);
|
||||
+ if (!priv->txrx_buf) {
|
||||
+ dev_err(dev, "failed to alloacate memory for dirmap\n");
|
||||
+ return -ENOMEM;
|
||||
+ }
|
||||
+
|
||||
ret = regmap_init_mem_index(dev_ofnode(dev), &priv->regmap_ctrl, 0);
|
||||
if (ret) {
|
||||
dev_err(dev, "failed to init spi ctrl regmap\n");
|
||||
@@ -769,6 +1075,9 @@ static int airoha_snand_nfi_setup(struct spi_slave *slave,
|
||||
static const struct spi_controller_mem_ops airoha_snand_mem_ops = {
|
||||
.supports_op = airoha_snand_supports_op,
|
||||
.exec_op = airoha_snand_exec_op,
|
||||
+ .dirmap_create = airoha_snand_dirmap_create,
|
||||
+ .dirmap_read = airoha_snand_dirmap_read,
|
||||
+ .dirmap_write = airoha_snand_dirmap_write,
|
||||
};
|
||||
|
||||
static const struct dm_spi_ops airoha_snfi_spi_ops = {
|
||||
--
|
||||
2.51.0
|
||||
|
||||
@@ -1,94 +0,0 @@
|
||||
From 2ebbccfa053993d0fe90bee523020a8f796e8988 Mon Sep 17 00:00:00 2001
|
||||
From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
|
||||
Date: Sun, 8 Jun 2025 05:30:22 +0300
|
||||
Subject: [PATCH 5/5] spi: airoha: support of dualio/quadio flash reading
|
||||
commands
|
||||
|
||||
Airoha snfi spi controller supports acceleration of DUAL/QUAD
|
||||
operations, but does not supports DUAL_IO/QUAD_IO operations.
|
||||
Luckily DUAL/QUAD operations do the same as DUAL_IO/QUAD_IO ones,
|
||||
so we can issue corresponding DUAL/QUAD operation instead of
|
||||
DUAL_IO/QUAD_IO one.
|
||||
|
||||
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
|
||||
---
|
||||
drivers/spi/airoha_snfi_spi.c | 27 +++++++++++++++++++++------
|
||||
1 file changed, 21 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/drivers/spi/airoha_snfi_spi.c b/drivers/spi/airoha_snfi_spi.c
|
||||
index f72d11f5b19..7cafa900bbc 100644
|
||||
--- a/drivers/spi/airoha_snfi_spi.c
|
||||
+++ b/drivers/spi/airoha_snfi_spi.c
|
||||
@@ -141,6 +141,7 @@
|
||||
#define SPI_NFI_CUS_SEC_SIZE_EN BIT(16)
|
||||
|
||||
#define REG_SPI_NFI_RD_CTL2 0x0510
|
||||
+#define SPI_NFI_DATA_READ_CMD GENMASK(7, 0)
|
||||
|
||||
#define REG_SPI_NFI_RD_CTL3 0x0514
|
||||
|
||||
@@ -175,7 +176,9 @@
|
||||
#define SPI_NAND_OP_READ_FROM_CACHE_SINGLE 0x03
|
||||
#define SPI_NAND_OP_READ_FROM_CACHE_SINGLE_FAST 0x0b
|
||||
#define SPI_NAND_OP_READ_FROM_CACHE_DUAL 0x3b
|
||||
+#define SPI_NAND_OP_READ_FROM_CACHE_DUALIO 0xbb
|
||||
#define SPI_NAND_OP_READ_FROM_CACHE_QUAD 0x6b
|
||||
+#define SPI_NAND_OP_READ_FROM_CACHE_QUADIO 0xeb
|
||||
#define SPI_NAND_OP_WRITE_ENABLE 0x06
|
||||
#define SPI_NAND_OP_WRITE_DISABLE 0x04
|
||||
#define SPI_NAND_OP_PROGRAM_LOAD_SINGLE 0x02
|
||||
@@ -639,25 +642,37 @@ static int airoha_snand_dirmap_create(struct spi_mem_dirmap_desc *desc)
|
||||
static ssize_t airoha_snand_dirmap_read(struct spi_mem_dirmap_desc *desc,
|
||||
u64 offs, size_t len, void *buf)
|
||||
{
|
||||
- struct spi_mem_op *op = &desc->info.op_tmpl;
|
||||
struct spi_slave *slave = desc->slave;
|
||||
struct udevice *bus = slave->dev->parent;
|
||||
struct airoha_snand_priv *priv = dev_get_priv(bus);
|
||||
u8 *txrx_buf = priv->txrx_buf;
|
||||
dma_addr_t dma_addr;
|
||||
- u32 val, rd_mode;
|
||||
+ u32 val, rd_mode, opcode;
|
||||
int err;
|
||||
|
||||
- switch (op->cmd.opcode) {
|
||||
+ /*
|
||||
+ * DUALIO and QUADIO opcodes are not supported by the spi controller,
|
||||
+ * replace them with supported opcodes.
|
||||
+ */
|
||||
+ opcode = desc->info.op_tmpl.cmd.opcode;
|
||||
+ switch (opcode) {
|
||||
+ case SPI_NAND_OP_READ_FROM_CACHE_SINGLE:
|
||||
+ case SPI_NAND_OP_READ_FROM_CACHE_SINGLE_FAST:
|
||||
+ rd_mode = 0;
|
||||
+ break;
|
||||
case SPI_NAND_OP_READ_FROM_CACHE_DUAL:
|
||||
+ case SPI_NAND_OP_READ_FROM_CACHE_DUALIO:
|
||||
+ opcode = SPI_NAND_OP_READ_FROM_CACHE_DUAL;
|
||||
rd_mode = 1;
|
||||
break;
|
||||
case SPI_NAND_OP_READ_FROM_CACHE_QUAD:
|
||||
+ case SPI_NAND_OP_READ_FROM_CACHE_QUADIO:
|
||||
+ opcode = SPI_NAND_OP_READ_FROM_CACHE_QUAD;
|
||||
rd_mode = 2;
|
||||
break;
|
||||
default:
|
||||
- rd_mode = 0;
|
||||
- break;
|
||||
+ /* unknown opcode */
|
||||
+ return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
err = airoha_snand_set_mode(priv, SPI_MODE_DMA);
|
||||
@@ -688,7 +703,7 @@ static ssize_t airoha_snand_dirmap_read(struct spi_mem_dirmap_desc *desc,
|
||||
|
||||
/* set read command */
|
||||
err = regmap_write(priv->regmap_nfi, REG_SPI_NFI_RD_CTL2,
|
||||
- op->cmd.opcode);
|
||||
+ FIELD_PREP(SPI_NFI_DATA_READ_CMD, opcode));
|
||||
if (err)
|
||||
goto error_dma_unmap;
|
||||
|
||||
--
|
||||
2.51.0
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
From 073de6579cf8c7599d925852bb0fc7fa50378dd3 Mon Sep 17 00:00:00 2001
|
||||
From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
|
||||
Date: Thu, 14 Aug 2025 18:00:32 +0300
|
||||
Subject: [PATCH 1/4] spi: airoha: avoid setting of page/oob sizes in
|
||||
REG_SPI_NFI_PAGEFMT
|
||||
|
||||
spi-airoha-snfi uses custom sector size in REG_SPI_NFI_SECCUS_SIZE
|
||||
register, so setting of page/oob sizes in REG_SPI_NFI_PAGEFMT is not
|
||||
required.
|
||||
|
||||
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
|
||||
---
|
||||
drivers/spi/airoha_snfi_spi.c | 38 -----------------------------------
|
||||
1 file changed, 38 deletions(-)
|
||||
|
||||
diff --git a/drivers/spi/airoha_snfi_spi.c b/drivers/spi/airoha_snfi_spi.c
|
||||
index 7cafa900bbc..71e4fc13924 100644
|
||||
--- a/drivers/spi/airoha_snfi_spi.c
|
||||
+++ b/drivers/spi/airoha_snfi_spi.c
|
||||
@@ -514,44 +514,6 @@ static int airoha_snand_nfi_config(struct airoha_snand_priv *priv)
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
- /* page format */
|
||||
- switch (priv->nfi_cfg.spare_size) {
|
||||
- case 26:
|
||||
- val = FIELD_PREP(SPI_NFI_SPARE_SIZE, 0x1);
|
||||
- break;
|
||||
- case 27:
|
||||
- val = FIELD_PREP(SPI_NFI_SPARE_SIZE, 0x2);
|
||||
- break;
|
||||
- case 28:
|
||||
- val = FIELD_PREP(SPI_NFI_SPARE_SIZE, 0x3);
|
||||
- break;
|
||||
- default:
|
||||
- val = FIELD_PREP(SPI_NFI_SPARE_SIZE, 0x0);
|
||||
- break;
|
||||
- }
|
||||
-
|
||||
- err = regmap_update_bits(priv->regmap_nfi, REG_SPI_NFI_PAGEFMT,
|
||||
- SPI_NFI_SPARE_SIZE, val);
|
||||
- if (err)
|
||||
- return err;
|
||||
-
|
||||
- switch (priv->nfi_cfg.page_size) {
|
||||
- case 2048:
|
||||
- val = FIELD_PREP(SPI_NFI_PAGE_SIZE, 0x1);
|
||||
- break;
|
||||
- case 4096:
|
||||
- val = FIELD_PREP(SPI_NFI_PAGE_SIZE, 0x2);
|
||||
- break;
|
||||
- default:
|
||||
- val = FIELD_PREP(SPI_NFI_PAGE_SIZE, 0x0);
|
||||
- break;
|
||||
- }
|
||||
-
|
||||
- err = regmap_update_bits(priv->regmap_nfi, REG_SPI_NFI_PAGEFMT,
|
||||
- SPI_NFI_PAGE_SIZE, val);
|
||||
- if (err)
|
||||
- return err;
|
||||
-
|
||||
/* sec num */
|
||||
val = FIELD_PREP(SPI_NFI_SEC_NUM, priv->nfi_cfg.sec_num);
|
||||
err = regmap_update_bits(priv->regmap_nfi, REG_SPI_NFI_CON,
|
||||
--
|
||||
2.51.0
|
||||
|
||||
@@ -1,200 +0,0 @@
|
||||
From 3bd6ca4ddaae4f0a667a9359c8092d2271006687 Mon Sep 17 00:00:00 2001
|
||||
From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
|
||||
Date: Thu, 14 Aug 2025 18:49:34 +0300
|
||||
Subject: [PATCH 2/4] spi: airoha: reduce the number of modification of
|
||||
REG_SPI_NFI_CNFG and REG_SPI_NFI_SECCUS_SIZE registers
|
||||
|
||||
This just reduce the number of modification of REG_SPI_NFI_CNFG and
|
||||
REG_SPI_NFI_SECCUS_SIZE registers during dirmap operation.
|
||||
|
||||
This patch is a necessary step to avoid usage of flash specific
|
||||
parameters.
|
||||
|
||||
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
|
||||
---
|
||||
drivers/spi/airoha_snfi_spi.c | 134 +++++++++++++++++++++++++---------
|
||||
1 file changed, 101 insertions(+), 33 deletions(-)
|
||||
|
||||
diff --git a/drivers/spi/airoha_snfi_spi.c b/drivers/spi/airoha_snfi_spi.c
|
||||
index 71e4fc13924..1fcf5dd89e9 100644
|
||||
--- a/drivers/spi/airoha_snfi_spi.c
|
||||
+++ b/drivers/spi/airoha_snfi_spi.c
|
||||
@@ -641,7 +641,47 @@ static ssize_t airoha_snand_dirmap_read(struct spi_mem_dirmap_desc *desc,
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
- err = airoha_snand_nfi_config(priv);
|
||||
+ /* NFI reset */
|
||||
+ err = regmap_write(priv->regmap_nfi, REG_SPI_NFI_CON,
|
||||
+ SPI_NFI_FIFO_FLUSH | SPI_NFI_RST);
|
||||
+ if (err)
|
||||
+ goto error_dma_mode_off;
|
||||
+
|
||||
+ /* NFI configure:
|
||||
+ * - No AutoFDM (custom sector size (SECCUS) register will be used)
|
||||
+ * - No SoC's hardware ECC (flash internal ECC will be used)
|
||||
+ * - Use burst mode (faster, but requires 16 byte alignment for addresses)
|
||||
+ * - Setup for reading (SPI_NFI_READ_MODE)
|
||||
+ * - Setup reading command: FIELD_PREP(SPI_NFI_OPMODE, 6)
|
||||
+ * - Use DMA instead of PIO for data reading
|
||||
+ * - Use AHB bus for DMA transfer
|
||||
+ */
|
||||
+ err = regmap_update_bits(priv->regmap_nfi, REG_SPI_NFI_CNFG,
|
||||
+ SPI_NFI_DMA_MODE |
|
||||
+ SPI_NFI_READ_MODE |
|
||||
+ SPI_NFI_DMA_BURST_EN |
|
||||
+ SPI_NFI_HW_ECC_EN |
|
||||
+ SPI_NFI_AUTO_FDM_EN |
|
||||
+ SPI_NFI_OPMODE,
|
||||
+ SPI_NFI_DMA_MODE |
|
||||
+ SPI_NFI_READ_MODE |
|
||||
+ SPI_NFI_DMA_BURST_EN |
|
||||
+ FIELD_PREP(SPI_NFI_OPMODE, 6));
|
||||
+
|
||||
+ /* Set number of sector will be read */
|
||||
+ val = FIELD_PREP(SPI_NFI_SEC_NUM, priv->nfi_cfg.sec_num);
|
||||
+ err = regmap_update_bits(priv->regmap_nfi, REG_SPI_NFI_CON,
|
||||
+ SPI_NFI_SEC_NUM, val);
|
||||
+ if (err)
|
||||
+ goto error_dma_mode_off;
|
||||
+
|
||||
+ /* Set custom sector size */
|
||||
+ val = priv->nfi_cfg.sec_size;
|
||||
+ err = regmap_update_bits(priv->regmap_nfi, REG_SPI_NFI_SECCUS_SIZE,
|
||||
+ SPI_NFI_CUS_SEC_SIZE |
|
||||
+ SPI_NFI_CUS_SEC_SIZE_EN,
|
||||
+ FIELD_PREP(SPI_NFI_CUS_SEC_SIZE, val) |
|
||||
+ SPI_NFI_CUS_SEC_SIZE_EN);
|
||||
if (err)
|
||||
goto error_dma_mode_off;
|
||||
|
||||
@@ -654,7 +694,14 @@ static ssize_t airoha_snand_dirmap_read(struct spi_mem_dirmap_desc *desc,
|
||||
if (err)
|
||||
goto error_dma_unmap;
|
||||
|
||||
- /* set cust sec size */
|
||||
+ /*
|
||||
+ * Setup transfer length
|
||||
+ * ---------------------
|
||||
+ * The following rule MUST be met:
|
||||
+ * transfer_length =
|
||||
+ * = NFI_SNF_MISC_CTL2.read_data_byte_number =
|
||||
+ * = NFI_CON.sector_number * NFI_SECCUS.custom_sector_size
|
||||
+ */
|
||||
val = priv->nfi_cfg.sec_size * priv->nfi_cfg.sec_num;
|
||||
val = FIELD_PREP(SPI_NFI_READ_DATA_BYTE_NUM, val);
|
||||
err = regmap_update_bits(priv->regmap_nfi,
|
||||
@@ -681,18 +728,6 @@ static ssize_t airoha_snand_dirmap_read(struct spi_mem_dirmap_desc *desc,
|
||||
if (err)
|
||||
goto error_dma_unmap;
|
||||
|
||||
- /* set nfi read */
|
||||
- err = regmap_update_bits(priv->regmap_nfi, REG_SPI_NFI_CNFG,
|
||||
- SPI_NFI_OPMODE,
|
||||
- FIELD_PREP(SPI_NFI_OPMODE, 6));
|
||||
- if (err)
|
||||
- goto error_dma_unmap;
|
||||
-
|
||||
- err = regmap_set_bits(priv->regmap_nfi, REG_SPI_NFI_CNFG,
|
||||
- SPI_NFI_READ_MODE | SPI_NFI_DMA_MODE);
|
||||
- if (err)
|
||||
- goto error_dma_unmap;
|
||||
-
|
||||
err = regmap_write(priv->regmap_nfi, REG_SPI_NFI_CMD, 0x0);
|
||||
if (err)
|
||||
goto error_dma_unmap;
|
||||
@@ -783,7 +818,48 @@ static ssize_t airoha_snand_dirmap_write(struct spi_mem_dirmap_desc *desc,
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
- err = airoha_snand_nfi_config(priv);
|
||||
+ /* NFI reset */
|
||||
+ err = regmap_write(priv->regmap_nfi, REG_SPI_NFI_CON,
|
||||
+ SPI_NFI_FIFO_FLUSH | SPI_NFI_RST);
|
||||
+ if (err)
|
||||
+ goto error_dma_mode_off;
|
||||
+
|
||||
+ /*
|
||||
+ * NFI configure:
|
||||
+ * - No AutoFDM (custom sector size (SECCUS) register will be used)
|
||||
+ * - No SoC's hardware ECC (flash internal ECC will be used)
|
||||
+ * - Use burst mode (faster, but requires 16 byte alignment for addresses)
|
||||
+ * - Setup for writing (SPI_NFI_READ_MODE bit is cleared)
|
||||
+ * - Setup writing command: FIELD_PREP(SPI_NFI_OPMODE, 3)
|
||||
+ * - Use DMA instead of PIO for data writing
|
||||
+ */
|
||||
+ err = regmap_update_bits(priv->regmap_nfi, REG_SPI_NFI_CNFG,
|
||||
+ SPI_NFI_DMA_MODE |
|
||||
+ SPI_NFI_READ_MODE |
|
||||
+ SPI_NFI_DMA_BURST_EN |
|
||||
+ SPI_NFI_HW_ECC_EN |
|
||||
+ SPI_NFI_AUTO_FDM_EN |
|
||||
+ SPI_NFI_OPMODE,
|
||||
+ SPI_NFI_DMA_MODE |
|
||||
+ SPI_NFI_DMA_BURST_EN |
|
||||
+ FIELD_PREP(SPI_NFI_OPMODE, 3));
|
||||
+ if (err)
|
||||
+ goto error_dma_mode_off;
|
||||
+
|
||||
+ /* Set number of sector will be written */
|
||||
+ val = FIELD_PREP(SPI_NFI_SEC_NUM, priv->nfi_cfg.sec_num);
|
||||
+ err = regmap_update_bits(priv->regmap_nfi, REG_SPI_NFI_CON,
|
||||
+ SPI_NFI_SEC_NUM, val);
|
||||
+ if (err)
|
||||
+ goto error_dma_mode_off;
|
||||
+
|
||||
+ /* Set custom sector size */
|
||||
+ val = priv->nfi_cfg.sec_size;
|
||||
+ err = regmap_update_bits(priv->regmap_nfi, REG_SPI_NFI_SECCUS_SIZE,
|
||||
+ SPI_NFI_CUS_SEC_SIZE |
|
||||
+ SPI_NFI_CUS_SEC_SIZE_EN,
|
||||
+ FIELD_PREP(SPI_NFI_CUS_SEC_SIZE, val) |
|
||||
+ SPI_NFI_CUS_SEC_SIZE_EN);
|
||||
if (err)
|
||||
goto error_dma_mode_off;
|
||||
|
||||
@@ -796,8 +872,16 @@ static ssize_t airoha_snand_dirmap_write(struct spi_mem_dirmap_desc *desc,
|
||||
if (err)
|
||||
goto error_dma_unmap;
|
||||
|
||||
- val = FIELD_PREP(SPI_NFI_PROG_LOAD_BYTE_NUM,
|
||||
- priv->nfi_cfg.sec_size * priv->nfi_cfg.sec_num);
|
||||
+ /*
|
||||
+ * Setup transfer length
|
||||
+ * ---------------------
|
||||
+ * The following rule MUST be met:
|
||||
+ * transfer_length =
|
||||
+ * = NFI_SNF_MISC_CTL2.write_data_byte_number =
|
||||
+ * = NFI_CON.sector_number * NFI_SECCUS.custom_sector_size
|
||||
+ */
|
||||
+ val = priv->nfi_cfg.sec_size * priv->nfi_cfg.sec_num;
|
||||
+ val = FIELD_PREP(SPI_NFI_PROG_LOAD_BYTE_NUM, val);
|
||||
err = regmap_update_bits(priv->regmap_nfi,
|
||||
REG_SPI_NFI_SNF_MISC_CTL2,
|
||||
SPI_NFI_PROG_LOAD_BYTE_NUM, val);
|
||||
@@ -822,22 +906,6 @@ static ssize_t airoha_snand_dirmap_write(struct spi_mem_dirmap_desc *desc,
|
||||
if (err)
|
||||
goto error_dma_unmap;
|
||||
|
||||
- err = regmap_clear_bits(priv->regmap_nfi, REG_SPI_NFI_CNFG,
|
||||
- SPI_NFI_READ_MODE);
|
||||
- if (err)
|
||||
- goto error_dma_unmap;
|
||||
-
|
||||
- err = regmap_update_bits(priv->regmap_nfi, REG_SPI_NFI_CNFG,
|
||||
- SPI_NFI_OPMODE,
|
||||
- FIELD_PREP(SPI_NFI_OPMODE, 3));
|
||||
- if (err)
|
||||
- goto error_dma_unmap;
|
||||
-
|
||||
- err = regmap_set_bits(priv->regmap_nfi, REG_SPI_NFI_CNFG,
|
||||
- SPI_NFI_DMA_MODE);
|
||||
- if (err)
|
||||
- goto error_dma_unmap;
|
||||
-
|
||||
err = regmap_write(priv->regmap_nfi, REG_SPI_NFI_CMD, 0x80);
|
||||
if (err)
|
||||
goto error_dma_unmap;
|
||||
--
|
||||
2.51.0
|
||||
|
||||
@@ -1,140 +0,0 @@
|
||||
From 8e6cba428ce48005b5b8be64c2a08c98d04865e9 Mon Sep 17 00:00:00 2001
|
||||
From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
|
||||
Date: Thu, 14 Aug 2025 22:47:17 +0300
|
||||
Subject: [PATCH 3/4] spi: airoha: set custom sector size equal to flash page
|
||||
size
|
||||
|
||||
Set custom sector size equal to flash page size including oob. Thus we
|
||||
will always read a single sector. The maximum custom sector size is
|
||||
8187, so all possible flash sector sizes are supported.
|
||||
|
||||
This patch is a necessary step to avoid usage of flash specific
|
||||
parameters.
|
||||
|
||||
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
|
||||
---
|
||||
drivers/spi/airoha_snfi_spi.c | 35 +++++++++++++++++++----------------
|
||||
1 file changed, 19 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/drivers/spi/airoha_snfi_spi.c b/drivers/spi/airoha_snfi_spi.c
|
||||
index 1fcf5dd89e9..c9feef83f89 100644
|
||||
--- a/drivers/spi/airoha_snfi_spi.c
|
||||
+++ b/drivers/spi/airoha_snfi_spi.c
|
||||
@@ -515,7 +515,7 @@ static int airoha_snand_nfi_config(struct airoha_snand_priv *priv)
|
||||
return err;
|
||||
|
||||
/* sec num */
|
||||
- val = FIELD_PREP(SPI_NFI_SEC_NUM, priv->nfi_cfg.sec_num);
|
||||
+ val = FIELD_PREP(SPI_NFI_SEC_NUM, 1);
|
||||
err = regmap_update_bits(priv->regmap_nfi, REG_SPI_NFI_CON,
|
||||
SPI_NFI_SEC_NUM, val);
|
||||
if (err)
|
||||
@@ -528,7 +528,8 @@ static int airoha_snand_nfi_config(struct airoha_snand_priv *priv)
|
||||
return err;
|
||||
|
||||
/* set cust sec size */
|
||||
- val = FIELD_PREP(SPI_NFI_CUS_SEC_SIZE, priv->nfi_cfg.sec_size);
|
||||
+ val = FIELD_PREP(SPI_NFI_CUS_SEC_SIZE,
|
||||
+ priv->nfi_cfg.sec_size * priv->nfi_cfg.sec_num);
|
||||
return regmap_update_bits(priv->regmap_nfi,
|
||||
REG_SPI_NFI_SECCUS_SIZE,
|
||||
SPI_NFI_CUS_SEC_SIZE, val);
|
||||
@@ -610,8 +611,11 @@ static ssize_t airoha_snand_dirmap_read(struct spi_mem_dirmap_desc *desc,
|
||||
u8 *txrx_buf = priv->txrx_buf;
|
||||
dma_addr_t dma_addr;
|
||||
u32 val, rd_mode, opcode;
|
||||
+ size_t bytes;
|
||||
int err;
|
||||
|
||||
+ bytes = priv->nfi_cfg.sec_num * priv->nfi_cfg.sec_size;
|
||||
+
|
||||
/*
|
||||
* DUALIO and QUADIO opcodes are not supported by the spi controller,
|
||||
* replace them with supported opcodes.
|
||||
@@ -669,18 +673,17 @@ static ssize_t airoha_snand_dirmap_read(struct spi_mem_dirmap_desc *desc,
|
||||
FIELD_PREP(SPI_NFI_OPMODE, 6));
|
||||
|
||||
/* Set number of sector will be read */
|
||||
- val = FIELD_PREP(SPI_NFI_SEC_NUM, priv->nfi_cfg.sec_num);
|
||||
err = regmap_update_bits(priv->regmap_nfi, REG_SPI_NFI_CON,
|
||||
- SPI_NFI_SEC_NUM, val);
|
||||
+ SPI_NFI_SEC_NUM,
|
||||
+ FIELD_PREP(SPI_NFI_SEC_NUM, 1));
|
||||
if (err)
|
||||
goto error_dma_mode_off;
|
||||
|
||||
/* Set custom sector size */
|
||||
- val = priv->nfi_cfg.sec_size;
|
||||
err = regmap_update_bits(priv->regmap_nfi, REG_SPI_NFI_SECCUS_SIZE,
|
||||
SPI_NFI_CUS_SEC_SIZE |
|
||||
SPI_NFI_CUS_SEC_SIZE_EN,
|
||||
- FIELD_PREP(SPI_NFI_CUS_SEC_SIZE, val) |
|
||||
+ FIELD_PREP(SPI_NFI_CUS_SEC_SIZE, bytes) |
|
||||
SPI_NFI_CUS_SEC_SIZE_EN);
|
||||
if (err)
|
||||
goto error_dma_mode_off;
|
||||
@@ -702,11 +705,10 @@ static ssize_t airoha_snand_dirmap_read(struct spi_mem_dirmap_desc *desc,
|
||||
* = NFI_SNF_MISC_CTL2.read_data_byte_number =
|
||||
* = NFI_CON.sector_number * NFI_SECCUS.custom_sector_size
|
||||
*/
|
||||
- val = priv->nfi_cfg.sec_size * priv->nfi_cfg.sec_num;
|
||||
- val = FIELD_PREP(SPI_NFI_READ_DATA_BYTE_NUM, val);
|
||||
err = regmap_update_bits(priv->regmap_nfi,
|
||||
REG_SPI_NFI_SNF_MISC_CTL2,
|
||||
- SPI_NFI_READ_DATA_BYTE_NUM, val);
|
||||
+ SPI_NFI_READ_DATA_BYTE_NUM,
|
||||
+ FIELD_PREP(SPI_NFI_READ_DATA_BYTE_NUM, bytes));
|
||||
if (err)
|
||||
goto error_dma_unmap;
|
||||
|
||||
@@ -795,8 +797,11 @@ static ssize_t airoha_snand_dirmap_write(struct spi_mem_dirmap_desc *desc,
|
||||
u8 *txrx_buf = priv->txrx_buf;
|
||||
dma_addr_t dma_addr;
|
||||
u32 wr_mode, val, opcode;
|
||||
+ size_t bytes;
|
||||
int err;
|
||||
|
||||
+ bytes = priv->nfi_cfg.sec_num * priv->nfi_cfg.sec_size;
|
||||
+
|
||||
opcode = desc->info.op_tmpl.cmd.opcode;
|
||||
switch (opcode) {
|
||||
case SPI_NAND_OP_PROGRAM_LOAD_SINGLE:
|
||||
@@ -847,18 +852,17 @@ static ssize_t airoha_snand_dirmap_write(struct spi_mem_dirmap_desc *desc,
|
||||
goto error_dma_mode_off;
|
||||
|
||||
/* Set number of sector will be written */
|
||||
- val = FIELD_PREP(SPI_NFI_SEC_NUM, priv->nfi_cfg.sec_num);
|
||||
err = regmap_update_bits(priv->regmap_nfi, REG_SPI_NFI_CON,
|
||||
- SPI_NFI_SEC_NUM, val);
|
||||
+ SPI_NFI_SEC_NUM,
|
||||
+ FIELD_PREP(SPI_NFI_SEC_NUM, 1));
|
||||
if (err)
|
||||
goto error_dma_mode_off;
|
||||
|
||||
/* Set custom sector size */
|
||||
- val = priv->nfi_cfg.sec_size;
|
||||
err = regmap_update_bits(priv->regmap_nfi, REG_SPI_NFI_SECCUS_SIZE,
|
||||
SPI_NFI_CUS_SEC_SIZE |
|
||||
SPI_NFI_CUS_SEC_SIZE_EN,
|
||||
- FIELD_PREP(SPI_NFI_CUS_SEC_SIZE, val) |
|
||||
+ FIELD_PREP(SPI_NFI_CUS_SEC_SIZE, bytes) |
|
||||
SPI_NFI_CUS_SEC_SIZE_EN);
|
||||
if (err)
|
||||
goto error_dma_mode_off;
|
||||
@@ -880,11 +884,10 @@ static ssize_t airoha_snand_dirmap_write(struct spi_mem_dirmap_desc *desc,
|
||||
* = NFI_SNF_MISC_CTL2.write_data_byte_number =
|
||||
* = NFI_CON.sector_number * NFI_SECCUS.custom_sector_size
|
||||
*/
|
||||
- val = priv->nfi_cfg.sec_size * priv->nfi_cfg.sec_num;
|
||||
- val = FIELD_PREP(SPI_NFI_PROG_LOAD_BYTE_NUM, val);
|
||||
err = regmap_update_bits(priv->regmap_nfi,
|
||||
REG_SPI_NFI_SNF_MISC_CTL2,
|
||||
- SPI_NFI_PROG_LOAD_BYTE_NUM, val);
|
||||
+ SPI_NFI_PROG_LOAD_BYTE_NUM,
|
||||
+ FIELD_PREP(SPI_NFI_PROG_LOAD_BYTE_NUM, bytes));
|
||||
if (err)
|
||||
goto error_dma_unmap;
|
||||
|
||||
--
|
||||
2.51.0
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user