Compare commits
254 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a6870bc362 | |||
| db0dff8260 | |||
|
|
b1d23cd4cb | ||
|
|
dfb5b8d66f | ||
|
|
3de3fb2bdb | ||
|
|
3c627e4c45 | ||
|
|
6478e4145b | ||
|
|
370b35db61 | ||
|
|
c5aff168d9 | ||
|
|
5b3da73bba | ||
|
|
c1684fa66d | ||
|
|
f98f8fc3fe | ||
|
|
530f413fff | ||
|
|
87e3a5eac7 | ||
|
|
38bcfc76b2 | ||
|
|
30004b9f42 | ||
|
|
2ba4581701 | ||
|
|
34e2cdb069 | ||
|
|
e8966d4556 | ||
|
|
7acc285f6a | ||
|
|
67fa84ee6f | ||
|
|
6632fd0cbd | ||
|
|
8468092c16 | ||
|
|
a5bec70af7 | ||
|
|
12d2b83a2d | ||
|
|
a37549124f | ||
|
|
2edf63a4ad | ||
|
|
9aacaa0ffa | ||
|
|
c59851f7ec | ||
|
|
aa2245486f | ||
|
|
61f3bd5a14 | ||
|
|
cdf6784df7 | ||
|
|
dc4c934202 | ||
|
|
c7ae8f65f0 | ||
|
|
95fd4e27af | ||
|
|
ea0d1cca86 | ||
|
|
d919b7854a | ||
|
|
abef5e8006 | ||
|
|
65dedfb579 | ||
|
|
c47aa94440 | ||
|
|
1c1256964b | ||
|
|
42937af879 | ||
|
|
1612fa7775 | ||
|
|
f1c01b38bd | ||
|
|
226c4e9b83 | ||
|
|
60a5b065ea | ||
|
|
ed1029d103 | ||
|
|
e8c6f8f165 | ||
|
|
81828eda28 | ||
|
|
bae04b42b2 | ||
|
|
a655dfab35 | ||
|
|
81a3b0dcf0 | ||
|
|
80d980c42d | ||
|
|
a01bdf36d2 | ||
|
|
a97ba8ec55 | ||
|
|
e1fa90e221 | ||
|
|
a3f6b75cba | ||
|
|
542e897d4b | ||
|
|
50afe2f978 | ||
|
|
0e8c95bd7f | ||
|
|
b62378dcb4 | ||
|
|
9b927dbcba | ||
|
|
8502c5e598 | ||
|
|
b6501c9a20 | ||
|
|
ddf9becfae | ||
|
|
3fd0beb278 | ||
|
|
0eea6d8170 | ||
|
|
ac4ad46060 | ||
|
|
7c237658e3 | ||
|
|
9458d76b6b | ||
|
|
19b4e379aa | ||
|
|
3fe8285ca0 | ||
|
|
a4b677615e | ||
|
|
23e779781e | ||
|
|
fe5d6e1578 | ||
|
|
543e380250 | ||
|
|
76ab34e0e9 | ||
|
|
750f418dfa | ||
|
|
d7e948ea32 | ||
|
|
e01e8ef4fc | ||
|
|
6f856f7dba | ||
|
|
28f98400af | ||
|
|
4b6f54007c | ||
|
|
4da5759c17 | ||
|
|
af6eb79a63 | ||
|
|
e645bb1dfe | ||
|
|
18725e0e29 | ||
|
|
1298f2b619 | ||
|
|
6ce89fe4c0 | ||
|
|
c37fc47621 | ||
|
|
5e9dcacace | ||
|
|
3cf70360f1 | ||
|
|
b957de0e16 | ||
|
|
c2c2d104a7 | ||
|
|
5f998d147f | ||
|
|
cb414db044 | ||
|
|
bffabe88ef | ||
|
|
d98b5e2116 | ||
|
|
5d3ae48c50 | ||
|
|
1800f96bd7 | ||
|
|
d7d8716c42 | ||
|
|
a595fa7a98 | ||
|
|
e19db867f5 | ||
|
|
eb24b58aac | ||
|
|
34e35dd034 | ||
|
|
ff694ee83c | ||
|
|
9cbe38aa38 | ||
|
|
658663e93c | ||
|
|
34477073d5 | ||
|
|
be22f404fc | ||
|
|
0ba67dc32d | ||
|
|
e13e153b52 | ||
|
|
1856cd2605 | ||
|
|
3d0d49e5eb | ||
|
|
40b65ed242 | ||
|
|
2f7483fe3d | ||
|
|
64f08dde5f | ||
|
|
e8605e938a | ||
|
|
df9636cd92 | ||
|
|
dd8fc69c05 | ||
|
|
ae2136ad5d | ||
|
|
f1a0602fad | ||
|
|
23d088db28 | ||
|
|
a902143587 | ||
|
|
afa14d1434 | ||
|
|
d06822a9ca | ||
|
|
2b43c43db2 | ||
|
|
c9b3616b70 | ||
|
|
dd10cc80b6 | ||
|
|
c2d26ec4b3 | ||
|
|
b9ddd00d22 | ||
|
|
95a57274a1 | ||
|
|
96f2a99b94 | ||
|
|
8dc7a2a281 | ||
|
|
bd6ae62638 | ||
|
|
d60f816054 | ||
|
|
f7dee425a5 | ||
|
|
247b530953 | ||
|
|
328aedeb92 | ||
|
|
9e14fbd087 | ||
|
|
a6f6b6c20b | ||
|
|
2641258b83 | ||
|
|
5f48e0e66f | ||
|
|
dbf6ebb75a | ||
|
|
e1afd4ac88 | ||
|
|
c96e1b095d | ||
|
|
6bf3034fb4 | ||
|
|
2ff926c009 | ||
|
|
f0f3bf3a36 | ||
|
|
6c02909781 | ||
|
|
4683fc28dc | ||
|
|
a432948460 | ||
|
|
3132c76269 | ||
|
|
7f6b8f9d7a | ||
|
|
4436b9b236 | ||
|
|
134d4781f4 | ||
|
|
5d9f5fe1d6 | ||
|
|
28b3594e1f | ||
|
|
5efb68ab0f | ||
|
|
7c42d66e8a | ||
|
|
c656dbd449 | ||
|
|
be51fbc5cf | ||
|
|
c75d525b69 | ||
|
|
30ae2a4666 | ||
|
|
91afc4e70e | ||
|
|
b30a87c18a | ||
|
|
2ae009a90c | ||
|
|
c4b49e10fd | ||
|
|
4be0ae9d3b | ||
|
|
b37bef71bc | ||
|
|
5c2640f0d0 | ||
|
|
83e10929fd | ||
|
|
10c2b022ec | ||
|
|
c6bea6a6dd | ||
|
|
1fb3f91979 | ||
|
|
2518e1a5fa | ||
|
|
d92b97a26c | ||
|
|
a188ee0553 | ||
|
|
fa42ea3fe4 | ||
|
|
bfc3155d9f | ||
|
|
a0aae99caa | ||
|
|
388fc6082e | ||
|
|
b57e8d8a6e | ||
|
|
60ce7694e7 | ||
|
|
5b4767e841 | ||
|
|
028b3c4467 | ||
|
|
16e3acad85 | ||
|
|
1d3e82ab80 | ||
|
|
7d6dce0161 | ||
|
|
c5e3380c48 | ||
|
|
ba50d0a481 | ||
|
|
0b0b61f50c | ||
|
|
c47b2d58db | ||
|
|
329dbee149 | ||
|
|
391bb0df74 | ||
|
|
8e44579b68 | ||
|
|
cd229d6484 | ||
|
|
8614a08683 | ||
|
|
58d0397dfe | ||
|
|
48d41286b3 | ||
|
|
b49413a774 | ||
|
|
221ee48e29 | ||
|
|
1918fd931e | ||
|
|
d6ca9120a5 | ||
|
|
e432ec6155 | ||
|
|
a9dec8bee1 | ||
|
|
aed268398f | ||
|
|
6ba91c3d9e | ||
|
|
64f764a169 | ||
|
|
2d9e2d94f6 | ||
|
|
6e8a9f99f4 | ||
|
|
b8d234c727 | ||
|
|
4c05ae5462 | ||
|
|
db4e288810 | ||
|
|
21ae7177d1 | ||
|
|
57d65364cd | ||
|
|
8566b79857 | ||
|
|
314c23af24 | ||
|
|
415422bb18 | ||
|
|
571bb2508b | ||
|
|
c7d14bcc2d | ||
|
|
49eb5a7f1f | ||
|
|
9b36c0947e | ||
|
|
ede6a84299 | ||
|
|
e37fe980b1 | ||
|
|
62ca67b526 | ||
|
|
72c210f472 | ||
|
|
95abb898a1 | ||
|
|
a91de704c8 | ||
|
|
e95de00341 | ||
|
|
732ea05011 | ||
|
|
989e05c245 | ||
|
|
14b5093318 | ||
|
|
2afcce8ce1 | ||
|
|
6c9705a014 | ||
|
|
3c8a0c2557 | ||
|
|
e5c8e2c552 | ||
|
|
10b499785a | ||
|
|
f25a37284e | ||
|
|
e957017ce2 | ||
|
|
b68fce9efd | ||
|
|
a502143f61 | ||
|
|
ca1d16e2e3 | ||
|
|
cad7dd075b | ||
|
|
5bcf6e2712 | ||
|
|
b8ec85b33a | ||
|
|
46ada0542d | ||
|
|
09f1c1a640 | ||
|
|
4b02e048ff | ||
|
|
a2daa43fc3 | ||
|
|
88dfc5afcd | ||
|
|
966af8bddf | ||
|
|
2554d13465 | ||
|
|
a44f107d5a |
97
.github/workflows/openwrt-ci.yml
vendored
97
.github/workflows/openwrt-ci.yml
vendored
@@ -5,22 +5,11 @@
|
||||
#
|
||||
# Copyright (C) 2020 KFERMercer
|
||||
#
|
||||
#
|
||||
# <https://github.com/KFERMercer/OpenWrt-CI>
|
||||
#
|
||||
# Copyright (C) 2019 P3TERX
|
||||
#
|
||||
# Copyright (C) 2020 KFERMercer
|
||||
#
|
||||
name: OpenWrt-CI
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: 0 20 * * *
|
||||
release:
|
||||
types: [published]
|
||||
repository_dispatch:
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
@@ -29,42 +18,32 @@ jobs:
|
||||
|
||||
build_openwrt:
|
||||
|
||||
permissions:
|
||||
contents: write # for release creation
|
||||
name: Build OpenWrt Firmware
|
||||
|
||||
name: Build OpenWrt firmware
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
if: github.event.repository.owner.id == github.event.sender.id || ! github.event.sender.id
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
ref: stable
|
||||
|
||||
- name: Space cleanup
|
||||
- name: Space cleanup and Initialization environment
|
||||
env:
|
||||
DEBIAN_FRONTEND: noninteractive
|
||||
run: |
|
||||
docker rmi `docker images -q`
|
||||
sudo rm -rf /usr/share/dotnet /etc/mysql /etc/php /etc/apt/sources.list.d /usr/local/lib/android
|
||||
sudo -E apt-get -y purge azure-cli ghc* zulu* hhvm llvm* firefox google* dotnet* powershell openjdk* adoptopenjdk* mysql* php* mongodb* dotnet* moby* snapd* || true
|
||||
sudo -E apt-get update
|
||||
sudo -E rm -rf /usr/share/dotnet /etc/mysql /etc/php /etc/apt/sources.list.d /usr/local/lib/android
|
||||
sudo -E apt-mark hold grub-efi-amd64-signed
|
||||
sudo -E apt-get -y install ack antlr3 aria2 asciidoc autoconf automake autopoint binutils bison build-essential bzip2 ccache cmake cpio curl device-tree-compiler fastjar flex gawk gettext gcc-multilib g++-multilib git gperf haveged help2man intltool libc6-dev-i386 libelf-dev libglib2.0-dev libgmp3-dev libltdl-dev libmpc-dev libmpfr-dev libncurses5-dev libncursesw5-dev libreadline-dev libssl-dev libtool lrzsz mkisofs msmtp nano ninja-build p7zip p7zip-full patch pkgconf python2.7 python3 python3-pip libpython3-dev qemu-utils rsync scons squashfs-tools subversion swig texinfo uglifyjs upx-ucl unzip vim wget xmlto xxd zlib1g-dev
|
||||
sudo -E apt-get -y autoremove --purge
|
||||
sudo -E apt-get clean
|
||||
df -h
|
||||
sudo -E apt update
|
||||
sudo -E apt -y purge azure-cli* docker* ghc* zulu* llvm* firefox google* dotnet* powershell* openjdk* mysql* php* mongodb* dotnet* snap*
|
||||
sudo -E apt -y full-upgrade
|
||||
sudo -E apt -y install ack antlr3 asciidoc autoconf automake autopoint binutils bison build-essential bzip2 ccache clang cmake cpio curl device-tree-compiler flex gawk gcc-multilib g++-multilib gettext genisoimage git gperf haveged help2man intltool libc6-dev-i386 libelf-dev libfuse-dev libglib2.0-dev libgmp3-dev libltdl-dev libmpc-dev libmpfr-dev libncurses5-dev libncursesw5-dev libpython3-dev libreadline-dev libssl-dev libtool llvm lrzsz msmtp ninja-build p7zip p7zip-full patch pkgconf python3 python3-pyelftools python3-setuptools qemu-utils rsync scons squashfs-tools subversion swig texinfo uglifyjs upx-ucl unzip vim wget xmlto xxd zlib1g-dev
|
||||
sudo -E systemctl daemon-reload
|
||||
sudo -E apt -y autoremove --purge
|
||||
sudo -E apt clean
|
||||
sudo -E timedatectl set-timezone "Asia/Shanghai"
|
||||
|
||||
- name: Checkout OpenWrt
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Update feeds
|
||||
run: |
|
||||
sed -i 's/5.4/6.1/g' ./target/linux/rockchip/Makefile
|
||||
rm -rf package/kernel/mac80211 && rm -rf package/kernel/rtl8821cu && rm -rf package/kernel/mt76
|
||||
svn export https://github.com/openwrt/openwrt/trunk/package/kernel/mac80211 package/kernel/mac80211
|
||||
svn export https://github.com/openwrt/openwrt/trunk/package/kernel/mt76 package/kernel/mt76
|
||||
./scripts/feeds update -a
|
||||
./scripts/feeds install -a -f
|
||||
echo '
|
||||
@@ -73,10 +52,26 @@ jobs:
|
||||
CONFIG_TARGET_MULTI_PROFILE=y
|
||||
CONFIG_TARGET_DEVICE_rockchip_armv8_DEVICE_embedfire_doornet1=y
|
||||
CONFIG_TARGET_DEVICE_rockchip_armv8_DEVICE_embedfire_doornet2=y
|
||||
CONFIG_TARGET_DEVICE_rockchip_armv8_DEVICE_embedfire_lubancat-1=y
|
||||
CONFIG_TARGET_DEVICE_rockchip_armv8_DEVICE_embedfire_lubancat-1n=y
|
||||
CONFIG_TARGET_DEVICE_rockchip_armv8_DEVICE_embedfire_lubancat-2=y
|
||||
CONFIG_TARGET_DEVICE_rockchip_armv8_DEVICE_embedfire_lubancat-2n=y
|
||||
CONFIG_TARGET_DEVICE_rockchip_armv8_DEVICE_embedfire_lubancat-4=y
|
||||
CONFIG_TARGET_DEVICE_rockchip_armv8_DEVICE_embedfire_lubancat-5=y
|
||||
CONFIG_TARGET_DEVICE_rockchip_armv8_DEVICE_friendlyarm_nanopc-t6=y
|
||||
CONFIG_TARGET_DEVICE_rockchip_armv8_DEVICE_friendlyarm_nanopi-r2c=y
|
||||
CONFIG_TARGET_DEVICE_rockchip_armv8_DEVICE_friendlyarm_nanopi-r2s=y
|
||||
CONFIG_TARGET_DEVICE_rockchip_armv8_DEVICE_friendlyarm_nanopi-r4s=y
|
||||
CONFIG_TARGET_DEVICE_rockchip_armv8_DEVICE_friendlyarm_nanopi-r4se=y
|
||||
CONFIG_TARGET_DEVICE_rockchip_armv8_DEVICE_friendlyarm_nanopi-r5c=y
|
||||
CONFIG_TARGET_DEVICE_rockchip_armv8_DEVICE_friendlyarm_nanopi-r5s=y
|
||||
CONFIG_TARGET_DEVICE_rockchip_armv8_DEVICE_friendlyarm_nanopi-r6c=y
|
||||
CONFIG_TARGET_DEVICE_rockchip_armv8_DEVICE_friendlyarm_nanopi-r6s=y
|
||||
CONFIG_TARGET_DEVICE_rockchip_armv8_DEVICE_hinlink_h88k=y
|
||||
CONFIG_TARGET_DEVICE_rockchip_armv8_DEVICE_hinlink_opc-h66k=y
|
||||
CONFIG_TARGET_DEVICE_rockchip_armv8_DEVICE_hinlink_opc-h68k=y
|
||||
CONFIG_TARGET_DEVICE_rockchip_armv8_DEVICE_hinlink_opc-h69k=y
|
||||
CONFIG_TARGET_DEVICE_rockchip_armv8_DEVICE_radxa_zero-3e=y
|
||||
CONFIG_TARGET_KERNEL_PARTSIZE=64
|
||||
CONFIG_TARGET_ROOTFS_PARTSIZE=512
|
||||
CONFIG_TARGET_ROOTFS_TARGZ=y
|
||||
@@ -86,10 +81,8 @@ jobs:
|
||||
- name: Generate configuration file
|
||||
run: make defconfig
|
||||
|
||||
- name: Make download
|
||||
run: |
|
||||
make download -j8
|
||||
find dl -size -1024c -exec rm -f {} \;
|
||||
- name: Download packages
|
||||
run: make download -j16
|
||||
|
||||
- name: Compile firmware
|
||||
run: |
|
||||
@@ -102,40 +95,30 @@ jobs:
|
||||
du -h --max-depth=1 ./ --exclude=build_dir --exclude=bin
|
||||
du -h --max-depth=1 ./build_dir
|
||||
du -h --max-depth=1 ./bin
|
||||
|
||||
- name: Prepare artifact
|
||||
run: |
|
||||
mkdir -p ./artifact/firmware
|
||||
mkdir -p ./artifact/package
|
||||
mkdir -p ./artifact/buildinfo
|
||||
rm -rf $(find ./bin/targets/ -type d -name "packages")
|
||||
cp -rf $(find ./bin/targets/ -type f) ./artifact/firmware/
|
||||
cp -rf $(find ./bin/packages/ -type f -name "*.ipk") ./artifact/package/
|
||||
cp -rf $(find ./bin/targets/ -type f -name "*.buildinfo" -o -name "*.manifest") ./artifact/buildinfo/
|
||||
|
||||
- name: Deliver buildinfo
|
||||
uses: actions/upload-artifact@v3
|
||||
- name: Upload buildinfo
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: OpenWrt_buildinfo
|
||||
path: ./artifact/buildinfo/
|
||||
|
||||
- name: Deliver package
|
||||
uses: actions/upload-artifact@v3
|
||||
- name: Upload package
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: OpenWrt_package
|
||||
path: ./artifact/package/
|
||||
|
||||
- name: Deliver firmware
|
||||
uses: actions/upload-artifact@v3
|
||||
- name: Upload firmware
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: OpenWrt_firmware
|
||||
path: ./bin/targets/
|
||||
|
||||
|
||||
- name: Upload release asset
|
||||
if: github.event == 'release'
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
with:
|
||||
repo_token: ${{ secrets.YOURTOKEN }}
|
||||
file: ./artifact/firmware/*
|
||||
tag: ${{ github.ref }}
|
||||
file_glob: true
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -30,3 +30,4 @@ git-src
|
||||
.cproject
|
||||
.ccache
|
||||
.vscode*
|
||||
/openwrt_logs
|
||||
2
Makefile
2
Makefile
@@ -15,7 +15,7 @@ $(if $(findstring $(space),$(TOPDIR)),$(error ERROR: The path to the OpenWrt dir
|
||||
world:
|
||||
|
||||
DISTRO_PKG_CONFIG:=$(shell $(TOPDIR)/scripts/command_all.sh pkg-config | grep '/usr' -m 1)
|
||||
export PATH:=$(TOPDIR)/staging_dir/host/bin:$(PATH)
|
||||
export PATH:=$(if $(STAGING_DIR),$(abspath $(STAGING_DIR)/../host/bin),$(TOPDIR)/staging_dir/host/bin):$(PATH)
|
||||
|
||||
ifneq ($(OPENWRT_BUILD),1)
|
||||
_SINGLE=export MAKEFLAGS=$(space);
|
||||
|
||||
26
README.md
26
README.md
@@ -9,18 +9,23 @@ embedfire_lubancat2
|
||||
embedfire_lubancat2n
|
||||
friendlyarm_nanopi-r2c
|
||||
friendlyarm_nanopi-r2s
|
||||
friendlyarm_nanopi-r3s
|
||||
friendlyarm_nanopi-r4s
|
||||
friendlyarm_nanopi-r4se
|
||||
friendlyarm_nanopi-r5s
|
||||
friendlyarm_nanopi-r5c
|
||||
friendlyarm_nanopi-r6c
|
||||
friendlyarm_nanopi-r6s
|
||||
friendlyarm_nanopc-t6
|
||||
hinlink_opc-h66k
|
||||
hinlink_opc-h68k
|
||||
hinlink_opc-h69k
|
||||
hinlink_h88k
|
||||
```
|
||||
|
||||
### Next plan to add equipment:
|
||||
```
|
||||
|
||||
no
|
||||
```
|
||||
How to compile the OpenWrt firmware you need
|
||||
-
|
||||
@@ -29,20 +34,19 @@ Notice:
|
||||
1. **NOT** compile with **root** user! ! !
|
||||
2. Domestic users had better prepare a ladder before compiling
|
||||
3. Default login IP 192.168.1.1 password password
|
||||
4. **If you need wireless, please use the 5.4 kernel, and the 5.15 kernel opens the wireless conference card kernel. It is recommended not to enable wireless when compiling 5.15**
|
||||
5. [Switch 5.15 to compile rk33xx](https://github.com/DHDAXCW/lede-rockchip/blob/stable/linux5.15.md)
|
||||
6. [Switch 6.1 kernel to compile rk356x method](https://github.com/DHDAXCW/lede-rockchip/blob/stable/linux6.x.md)
|
||||
|
||||
2. Install compilation dependencies
|
||||
2. First install the Linux system, Debian 11 or Ubuntu LTS is recommended
|
||||
3. Install compilation dependencies
|
||||
|
||||
```bash
|
||||
sudo apt update -y
|
||||
sudo apt install -y ack antlr3 asciidoc autoconf automake autopoint binutils bison build-essential \
|
||||
bzip2 ccache cmake cpio curl device-tree-compiler fastjar flex gawk gettext gcc-multilib g++-multilib \
|
||||
git gperf haveged help2man intltool libc6-dev-i386 libelf-dev libglib2.0-dev libgmp3-dev libltdl-dev vpnc \
|
||||
libmpc-dev libmpfr-dev libncurses5-dev libncursesw5-dev libreadline-dev libssl-dev libtool lrzsz aria2 lib32gcc-s1 \
|
||||
mkisofs msmtp nano ninja-build p7zip p7zip-full patch pkgconf python2.7 python3 python3-pip libpython3-dev qemu-utils \
|
||||
rsync scons squashfs-tools subversion swig texinfo uglifyjs upx-ucl unzip vim wget xmlto xxd zlib1g-dev libfuse-dev
|
||||
bzip2 ccache clang cmake cpio curl device-tree-compiler flex gawk gettext gcc-multilib g++-multilib \
|
||||
git gperf haveged help2man intltool libc6-dev-i386 libelf-dev libfuse-dev libglib2.0-dev libgmp3-dev \
|
||||
libltdl-dev libmpc-dev libmpfr-dev libncurses5-dev libncursesw5-dev libpython3-dev libreadline-dev \
|
||||
libssl-dev libtool llvm lrzsz mkisofs msmtp ninja-build p7zip p7zip-full patch pkgconf python3 \
|
||||
python3-pyelftools python3-setuptools qemu-utils rsync scons squashfs-tools subversion swig texinfo \
|
||||
uglifyjs upx-ucl unzip vim wget xmlto xxd zlib1g-dev
|
||||
```
|
||||
|
||||
3. Download source code, update feeds and choose configuration
|
||||
@@ -59,7 +63,7 @@ Notice:
|
||||
|
||||
6. Enter `make -j10 V=s` (-j1 is followed by the number of threads. It is recommended to use single thread for the first compilation) to start compiling the firmware you want.
|
||||
|
||||
This set of code is guaranteed to compile successfully. It includes all source codes of R21, including IPK.
|
||||
This set of code is guaranteed to compile successfully. It includes all source codes of R24, including IPK.
|
||||
|
||||
Second compilation:
|
||||
```bash
|
||||
|
||||
750
build_openwrt.sh
Executable file
750
build_openwrt.sh
Executable file
@@ -0,0 +1,750 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#====================================================
|
||||
# OpenWrt 构建管理脚本
|
||||
# 功能:提供交互式菜单,可选择执行特定操作
|
||||
# 更新:2025-04-05
|
||||
#====================================================
|
||||
|
||||
#---------------基础配置---------------#
|
||||
# 日志目录设置
|
||||
LOGS_ROOT="openwrt_logs"
|
||||
SESSION_DIR="${LOGS_ROOT}/$(date +%Y%m%d_%H%M%S)"
|
||||
LOG_FILE="${SESSION_DIR}/main_build_script.log" # 主脚本日志文件名更改,更清晰
|
||||
|
||||
#---------------清理配置---------------#
|
||||
# 需要移除的目录列表 (示例,根据你的需要添加)
|
||||
declare -a REMOVE_DIRS=(
|
||||
# "feeds/packages/net/v2ray-geodata" # 示例
|
||||
)
|
||||
|
||||
# 需要移除的包列表 (示例,根据你的需要添加)
|
||||
declare -a REMOVE_PACKAGES=(
|
||||
# "package/feeds/luci/luci-app-example" # 示例
|
||||
)
|
||||
|
||||
#---------------自定义包配置---------------#
|
||||
# 定义自定义包配置,格式:[包名]=[目标目录]=[仓库URL]=[分支]=[是否使用--depth 1]
|
||||
declare -A CUSTOM_PACKAGES=(
|
||||
["partexp"]="package/luci-app-partexp=https://github.com/sirpdboy/luci-app-partexp=main=false"
|
||||
["openclash"]="package/openclash=https://github.com/vernesong/OpenClash=dev=true"
|
||||
["zerotier"]="package/luci-app-zerotier=https://github.com/Firsgith/luci-app-zerotier.git=main=false"
|
||||
["5gsupport"]="package/5G-Modem-Support=https://nanako.site/gitea/Nanako/openwrt-app-actions.git=main=false"
|
||||
["pcat"]="package/pcat-manager=https://github.com/photonicat/rockchip_rk3568_pcat_manager.git=master=true"
|
||||
["adguardhome"]="package/adguardhome=https://github.com/xiaoxiao29/luci-app-adguardhome.git=master=false"
|
||||
)
|
||||
|
||||
#---------------日志系统---------------#
|
||||
# 保存原始的标准输出和错误输出文件描述符
|
||||
exec {STDOUT_ORIG}>&1
|
||||
exec {STDERR_ORIG}>&2
|
||||
|
||||
# 全局变量标记日志是否启用
|
||||
LOGGING_ENABLED=false # 初始为 false,由 init_logger 启用
|
||||
|
||||
# 初始化日志系统
|
||||
init_logger() {
|
||||
# 创建日志目录结构
|
||||
mkdir -p "$SESSION_DIR" || {
|
||||
echo "错误: 无法创建日志目录: $SESSION_DIR" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
LOGGING_ENABLED=true
|
||||
echo "日志将保存在: $SESSION_DIR"
|
||||
echo "主脚本日志: $LOG_FILE"
|
||||
|
||||
# 重定向主脚本的 stdout 和 stderr 到 tee,同时输出到控制台和主日志文件
|
||||
# 使用 process substitution 和 tee
|
||||
exec > >(tee -a "$LOG_FILE")
|
||||
exec 2> >(tee -a "$LOG_FILE" >&2)
|
||||
|
||||
# 记录初始信息到日志
|
||||
echo "[$(date "+%Y-%m-%d %H:%M:%S")] [INFO]: 日志系统初始化完成。主日志文件: $LOG_FILE"
|
||||
}
|
||||
|
||||
# 创建新的特定构建阶段的日志文件
|
||||
create_build_log() {
|
||||
local build_type=$1
|
||||
local timestamp=$(date +%Y%m%d_%H%M%S)
|
||||
# 使用更明确的文件名
|
||||
BUILD_LOG_FILE="${SESSION_DIR}/${build_type}_build_${timestamp}.log"
|
||||
# 确保文件被创建,即使命令没有输出
|
||||
touch "$BUILD_LOG_FILE" || {
|
||||
log "ERROR" "无法创建构建日志文件: $BUILD_LOG_FILE"
|
||||
return 1
|
||||
}
|
||||
# 返回创建的日志文件名
|
||||
echo "$BUILD_LOG_FILE"
|
||||
return 0
|
||||
}
|
||||
|
||||
# 禁用日志重定向 (用于 menuconfig 等交互场景)
|
||||
disable_logging() {
|
||||
if [ "$LOGGING_ENABLED" = true ]; then
|
||||
log "DEBUG" "禁用日志重定向,恢复原始标准输出/错误。"
|
||||
exec >&$STDOUT_ORIG
|
||||
exec 2>&$STDERR_ORIG
|
||||
LOGGING_ENABLED=false # 标记为禁用
|
||||
fi
|
||||
}
|
||||
|
||||
# 启用日志重定向 (恢复)
|
||||
enable_logging() {
|
||||
# 仅在之前被禁用的情况下才重新启用
|
||||
if [ "$LOGGING_ENABLED" = false ]; then
|
||||
# 重新应用重定向到主日志
|
||||
exec > >(tee -a "$LOG_FILE")
|
||||
exec 2> >(tee -a "$LOG_FILE" >&2)
|
||||
LOGGING_ENABLED=true # 标记为启用
|
||||
log "DEBUG" "重新启用日志重定向到主日志。"
|
||||
fi
|
||||
}
|
||||
|
||||
# 设置终端颜色
|
||||
setup_colors() {
|
||||
if [[ -t 1 ]]; then # 检查标准输出是否连接到终端
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
BLUE='\033[0;34m'
|
||||
NC='\033[0m' # No Color
|
||||
else
|
||||
RED='' GREEN='' YELLOW='' BLUE='' NC=''
|
||||
fi
|
||||
}
|
||||
|
||||
# 记录日志函数 - 使用此函数来明确日志级别
|
||||
# 注意:此函数输出会经过 init_logger 设置的全局重定向
|
||||
log() {
|
||||
local level=$1
|
||||
local message=$2
|
||||
local timestamp
|
||||
timestamp=$(date "+%Y-%m-%d %H:%M:%S")
|
||||
local color="" level_str=""
|
||||
|
||||
case $level in
|
||||
"INFO") color="$GREEN"; level_str="INFO " ;; # 加空格对齐
|
||||
"WARN") color="$YELLOW"; level_str="WARN " ;;
|
||||
"ERROR") color="$RED"; level_str="ERROR" ;;
|
||||
"DEBUG") color="$BLUE"; level_str="DEBUG" ;;
|
||||
*) color=""; level_str="LOG " ;; # 默认级别
|
||||
esac
|
||||
|
||||
# 使用 printf 保证原子写入,减少并发问题
|
||||
printf "[%s] %b[%s]%b: %s\n" "$timestamp" "$color" "$level_str" "$NC" "$message"
|
||||
}
|
||||
|
||||
# 同时记录消息到主日志和特定的构建日志
|
||||
log_to_both() {
|
||||
local level=$1
|
||||
local message=$2
|
||||
local build_log_file=$3 # 明确参数名
|
||||
|
||||
# 1. 输出到主日志(通过全局重定向和 log 函数)
|
||||
log "$level" "$message"
|
||||
|
||||
# 2. 追加到指定的构建日志文件
|
||||
local timestamp
|
||||
timestamp=$(date "+%Y-%m-%d %H:%M:%S")
|
||||
# 直接追加,不需要颜色代码
|
||||
printf "[%s] [%s]: %s\n" "$timestamp" "$level" "$message" >> "$build_log_file"
|
||||
}
|
||||
|
||||
|
||||
#---------------自定义包管理函数---------------#
|
||||
# 更新单个自定义包
|
||||
update_single_package() {
|
||||
local pkg_name=$1
|
||||
local config=$2
|
||||
|
||||
# 解析配置 (保持 cut 的方式,假设路径/URL/分支名不含 '=')
|
||||
# 如果遇到问题,可以切换到 IFS/read
|
||||
local target_dir repo_url branch use_depth
|
||||
target_dir=$(echo "$config" | cut -d= -f1)
|
||||
repo_url=$(echo "$config" | cut -d= -f2)
|
||||
branch=$(echo "$config" | cut -d= -f3)
|
||||
use_depth=$(echo "$config" | cut -d= -f4)
|
||||
|
||||
# 基础验证
|
||||
if [ -z "$target_dir" ] || [ -z "$repo_url" ]; then
|
||||
log "ERROR" "包 '$pkg_name' 的配置无效: $config"
|
||||
return 1
|
||||
fi
|
||||
|
||||
log "INFO" "更新自定义包: $pkg_name..."
|
||||
|
||||
# 检查目标目录的父目录是否存在
|
||||
local parent_dir
|
||||
parent_dir=$(dirname "$target_dir")
|
||||
if [ ! -d "$parent_dir" ]; then
|
||||
log "INFO" "创建父目录: $parent_dir"
|
||||
mkdir -p "$parent_dir" || {
|
||||
log "ERROR" "无法创建父目录: $parent_dir"
|
||||
return 1
|
||||
}
|
||||
fi
|
||||
|
||||
# 移除现有目录
|
||||
if [ -d "$target_dir" ]; then
|
||||
log "INFO" "移除现有目录: $target_dir"
|
||||
rm -rf "$target_dir" || {
|
||||
log "ERROR" "无法删除目录: $target_dir"
|
||||
return 1
|
||||
}
|
||||
fi
|
||||
|
||||
# 准备 git clone 命令参数数组 (移除 eval)
|
||||
local git_options=("--progress") # 总是显示进度
|
||||
# 处理分支
|
||||
if [ -n "$branch" ] && [ "$branch" != "master" ]; then
|
||||
git_options+=("-b" "$branch")
|
||||
fi
|
||||
# 处理 depth
|
||||
if [ "$use_depth" = "true" ]; then
|
||||
git_options+=("--depth" "1")
|
||||
fi
|
||||
|
||||
# 执行克隆
|
||||
log "INFO" "执行: git clone ${git_options[*]} $repo_url $target_dir"
|
||||
if git clone "${git_options[@]}" "$repo_url" "$target_dir"; then
|
||||
log "INFO" "包 '$pkg_name' 更新成功"
|
||||
return 0
|
||||
else
|
||||
log "ERROR" "克隆包 '$pkg_name' 失败 (仓库: $repo_url)"
|
||||
# 尝试给出更具体的错误提示
|
||||
log "ERROR" "请检查网络连接、仓库 URL、分支名称以及目标目录权限。"
|
||||
# 保留可能存在的空目录或部分克隆,让用户检查
|
||||
# rm -rf "$target_dir" # 不再自动删除失败的克隆
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# 更新所有自定义包的主函数
|
||||
update_custom_package() {
|
||||
local failed_packages=()
|
||||
local success_count=0
|
||||
local total_packages=${#CUSTOM_PACKAGES[@]}
|
||||
|
||||
if [ "$total_packages" -eq 0 ]; then
|
||||
log "INFO" "没有配置自定义包,跳过更新。"
|
||||
return 0
|
||||
fi
|
||||
|
||||
log "INFO" "开始更新 $total_packages 个自定义包..."
|
||||
|
||||
for pkg_name in "${!CUSTOM_PACKAGES[@]}"; do
|
||||
# 使用 subshell 执行,避免污染当前环境的变量,但这里影响不大
|
||||
if update_single_package "$pkg_name" "${CUSTOM_PACKAGES[$pkg_name]}"; then
|
||||
((success_count++))
|
||||
else
|
||||
failed_packages+=("$pkg_name")
|
||||
fi
|
||||
done
|
||||
|
||||
# 显示更新结果
|
||||
if [ ${#failed_packages[@]} -eq 0 ]; then
|
||||
log "INFO" "所有自定义包更新成功 ($success_count/$total_packages)"
|
||||
return 0
|
||||
else
|
||||
log "WARN" "部分自定义包更新失败 (成功: $success_count/$total_packages)"
|
||||
log "ERROR" "更新失败的包: ${failed_packages[*]}"
|
||||
return 1 # 返回失败状态码
|
||||
fi
|
||||
}
|
||||
|
||||
# 更新特定自定义包
|
||||
update_specific_package() {
|
||||
local pkg_name=$1
|
||||
|
||||
if [ -z "$pkg_name" ]; then
|
||||
log "ERROR" "未指定包名"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ -z "${CUSTOM_PACKAGES[$pkg_name]}" ]; then
|
||||
log "ERROR" "未找到包配置:'$pkg_name'"
|
||||
log "INFO" "可用的包名: ${!CUSTOM_PACKAGES[*]}"
|
||||
return 1
|
||||
fi
|
||||
|
||||
update_single_package "$pkg_name" "${CUSTOM_PACKAGES[$pkg_name]}"
|
||||
}
|
||||
|
||||
#---------------基础功能函数---------------#
|
||||
# 清理工作区 (make clean 的替代方案,更彻底)
|
||||
clean_workspace() {
|
||||
log "INFO" "开始彻底清理工作区..."
|
||||
|
||||
# 清理 feeds (可选,如果 feeds 内容经常变动或出问题可以启用)
|
||||
# log "INFO" "执行 ./scripts/feeds clean ..."
|
||||
# ./scripts/feeds clean || log "WARN" "./scripts/feeds clean 执行时遇到问题。"
|
||||
|
||||
# 清理编译产物和临时文件
|
||||
log "INFO" "执行 rm -rf ./tmp ./logs ./staging_dir ./build_dir ./bin ./dl ..."
|
||||
# 注意:这里移除了 logs 目录,但我们的脚本日志在 openwrt_logs 下,不会被删
|
||||
# 如果 OpenWrt 自身有 logs 目录且需要保留,则从下面移除 ./logs
|
||||
rm -rf ./tmp ./logs ./staging_dir ./build_dir ./bin ./dl || {
|
||||
log "ERROR" "删除部分工作区目录失败,请检查权限或文件占用。"
|
||||
return 1
|
||||
}
|
||||
|
||||
log "INFO" "工作区清理完成。"
|
||||
return 0
|
||||
}
|
||||
|
||||
# 清理编译临时文件 (make clean 的快速版)
|
||||
clean_build_temp() {
|
||||
log "INFO" "开始清理编译临时文件..."
|
||||
|
||||
log "INFO" "执行 rm -rf ./tmp ./staging_dir ./build_dir ..."
|
||||
rm -rf ./tmp ./staging_dir ./build_dir || {
|
||||
log "ERROR" "删除部分编译临时目录失败。"
|
||||
return 1
|
||||
}
|
||||
|
||||
log "INFO" "编译临时文件清理完成。"
|
||||
return 0
|
||||
}
|
||||
|
||||
# 更新源码
|
||||
update_source() {
|
||||
log "INFO" "开始更新 OpenWrt 源码 (git pull)..."
|
||||
if git pull --rebase; then # 使用 rebase 避免不必要的 merge commit
|
||||
log "INFO" "源码更新完成"
|
||||
return 0
|
||||
else
|
||||
log "ERROR" "源码更新失败 (git pull --rebase)"
|
||||
log "WARN" "请检查本地是否有未提交的修改,或尝试手动解决 Git 冲突。"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# 更新并安装 feeds
|
||||
update_feeds() {
|
||||
log "INFO" "开始更新 Feeds (update -a)..."
|
||||
if ./scripts/feeds update -a; then
|
||||
log "INFO" "Feeds 更新成功,开始安装 (install -a)..."
|
||||
if ./scripts/feeds install -a; then
|
||||
log "INFO" "Feeds 安装成功"
|
||||
return 0
|
||||
else
|
||||
log "ERROR" "Feeds 安装失败 (install -a)"
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
log "ERROR" "Feeds 更新失败 (update -a)"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# 执行构建相关命令,并将 stdout 重定向到日志,stderr 同时输出到控制台和日志
|
||||
run_build_command() {
|
||||
local cmd=$1 # 要执行的命令字符串
|
||||
local log_file=$2 # 目标日志文件
|
||||
local description=$3 # 操作描述
|
||||
|
||||
log_to_both "INFO" "开始执行: $description" "$log_file"
|
||||
log "DEBUG" "命令详情: $cmd" # 只记录到主日志
|
||||
|
||||
# 执行命令
|
||||
# stdout (>>) 追加到日志文件
|
||||
# stderr (2>) 通过管道给 tee
|
||||
# tee -a "$log_file" 将 stderr 追加到日志文件
|
||||
# tee 默认将其标准输入复制到标准输出,这里即脚本的 stderr,因此会显示在控制台
|
||||
local start_time end_time duration
|
||||
start_time=$(date +%s)
|
||||
if eval "$cmd" >> "$log_file" 2> >(tee -a "$log_file" >&2); then
|
||||
end_time=$(date +%s)
|
||||
duration=$((end_time - start_time))
|
||||
log_to_both "INFO" "$description 完成 (耗时: ${duration}s)" "$log_file"
|
||||
return 0 # 成功返回 0
|
||||
else
|
||||
end_time=$(date +%s)
|
||||
duration=$((end_time - start_time))
|
||||
local exit_code=$? # 获取命令的退出码
|
||||
# 错误信息已经通过 stderr 的 tee 输出到控制台了
|
||||
log_to_both "ERROR" "$description 失败 (退出码: $exit_code, 耗时: ${duration}s)" "$log_file"
|
||||
log "ERROR" "详细错误请查看控制台输出以及日志文件: $log_file"
|
||||
return $exit_code # 失败返回命令的退出码
|
||||
fi
|
||||
}
|
||||
|
||||
# 编译固件
|
||||
build_firmware() {
|
||||
# 创建新的固件编译日志文件
|
||||
local current_log
|
||||
current_log=$(create_build_log "firmware") || return 1 # 创建失败则退出
|
||||
|
||||
log "INFO" "开始编译固件..."
|
||||
log "INFO" "详细编译日志将保存在: $current_log"
|
||||
|
||||
# 1. 下载依赖包
|
||||
local download_cmd="make download -j$(nproc) V=s"
|
||||
run_build_command "$download_cmd" "$current_log" "下载依赖包" || {
|
||||
log "ERROR" "依赖包下载失败,编译中止。"
|
||||
# 即使下载失败,日志文件也已包含错误信息
|
||||
return 1
|
||||
}
|
||||
|
||||
# 2. 多线程编译
|
||||
local cpu_cores
|
||||
cpu_cores=$(nproc)
|
||||
log "INFO" "检测到 $cpu_cores 个 CPU 核心,开始多线程编译..."
|
||||
local build_cmd="make -j${cpu_cores} V=s"
|
||||
|
||||
if run_build_command "$build_cmd" "$current_log" "固件编译 (多线程)"; then
|
||||
log "INFO" "${GREEN}固件编译成功完成!${NC}"
|
||||
log "INFO" "固件输出目录: ./bin/targets/"
|
||||
return 0 # 编译成功
|
||||
else
|
||||
# 多线程编译失败,询问用户是否重试
|
||||
log "WARN" "多线程编译失败。"
|
||||
local retry_choice
|
||||
# -r: raw input, -p: prompt, -n 1: read only one char (optional but nice), -t 15: timeout (optional)
|
||||
# Default to No
|
||||
read -rp "$(echo -e ${YELLOW}"是否尝试使用单线程重新编译? (y/N): "${NC})" -n 1 -t 30 retry_choice
|
||||
echo # Add a newline after read -n
|
||||
|
||||
if [[ "$retry_choice" =~ ^[Yy]$ ]]; then
|
||||
log "INFO" "用户选择使用单线程重试编译..."
|
||||
|
||||
# 3. 单线程编译重试
|
||||
local build_cmd_single="make -j1 V=s"
|
||||
if run_build_command "$build_cmd_single" "$current_log" "固件编译 (单线程重试)"; then
|
||||
log "INFO" "${GREEN}单线程编译成功完成!${NC}"
|
||||
log "INFO" "固件输出目录: ./bin/targets/"
|
||||
return 0 # 单线程编译成功
|
||||
else
|
||||
log "ERROR" "${RED}单线程编译也失败了。${NC}"
|
||||
log "ERROR" "请仔细检查控制台错误输出以及日志文件: $current_log"
|
||||
return 1 # 最终编译失败
|
||||
fi
|
||||
else
|
||||
log "INFO" "用户选择不进行单线程重试编译。"
|
||||
log "ERROR" "${RED}编译失败,未进行单线程重试。${NC}"
|
||||
log "ERROR" "请仔细检查控制台错误输出以及日志文件: $current_log"
|
||||
return 1 # 用户取消重试,编译失败
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# 清理配置文件中指定的旧包/目录
|
||||
clean_packages() {
|
||||
log "INFO" "开始清理配置文件中指定的旧包和目录..."
|
||||
local removed_count=0
|
||||
local failed_count=0
|
||||
local total_to_remove=$((${#REMOVE_DIRS[@]} + ${#REMOVE_PACKAGES[@]}))
|
||||
|
||||
if [ "$total_to_remove" -eq 0 ]; then
|
||||
log "INFO" "配置文件中未指定需要移除的包或目录。"
|
||||
return 0
|
||||
fi
|
||||
|
||||
# 清理目录
|
||||
for dir in "${REMOVE_DIRS[@]}"; do
|
||||
if [ -e "$dir" ]; then # 使用 -e 检查文件或目录是否存在
|
||||
log "INFO" "正在删除目录: $dir"
|
||||
if rm -rf "$dir"; then
|
||||
log "INFO" "已删除: $dir"
|
||||
((removed_count++))
|
||||
else
|
||||
log "ERROR" "删除失败: $dir (请检查权限或是否被占用)"
|
||||
((failed_count++))
|
||||
fi
|
||||
else
|
||||
log "WARN" "指定的目录不存在,跳过: $dir"
|
||||
fi
|
||||
done
|
||||
|
||||
# 清理包 (通常包也是目录)
|
||||
for pkg in "${REMOVE_PACKAGES[@]}"; do
|
||||
if [ -e "$pkg" ]; then
|
||||
log "INFO" "正在删除包/目录: $pkg"
|
||||
if rm -rf "$pkg"; then
|
||||
log "INFO" "已删除: $pkg"
|
||||
((removed_count++))
|
||||
else
|
||||
log "ERROR" "删除失败: $pkg (请检查权限或是否被占用)"
|
||||
((failed_count++))
|
||||
fi
|
||||
else
|
||||
log "WARN" "指定的包/目录不存在,跳过: $pkg"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ $failed_count -eq 0 ]; then
|
||||
log "INFO" "旧包/目录清理完成,共处理 $removed_count 个项目。"
|
||||
return 0
|
||||
else
|
||||
log "WARN" "旧包/目录清理部分完成 (成功: $removed_count, 失败: $failed_count)"
|
||||
return 1 # 返回失败状态码
|
||||
fi
|
||||
}
|
||||
|
||||
# 更新所有组件 (源码 -> 清理旧包 -> 自定义包 -> feeds)
|
||||
update_all_components() {
|
||||
log "INFO" "开始更新所有组件..."
|
||||
local success=true # 假设成功
|
||||
|
||||
# 1. 更新源码
|
||||
log "INFO" "[1/4] 更新 OpenWrt 源码..."
|
||||
update_source || success=false
|
||||
|
||||
# 2. 清理旧包 (即使上一步失败也尝试清理)
|
||||
log "INFO" "[2/4] 清理配置文件指定的旧包/目录..."
|
||||
clean_packages || log "WARN" "清理旧包/目录时遇到问题,继续执行..." # 清理失败通常不阻止后续
|
||||
|
||||
# 3. 更新自定义包 (只有在源码更新成功时才执行较好)
|
||||
if [ "$success" = true ]; then
|
||||
log "INFO" "[3/4] 更新自定义包..."
|
||||
update_custom_package || success=false
|
||||
else
|
||||
log "WARN" "[3/4] 跳过更新自定义包,因为源码更新失败。"
|
||||
fi
|
||||
|
||||
# 4. 更新 Feeds (只有在源码和自定义包都成功时执行较好)
|
||||
if [ "$success" = true ]; then
|
||||
log "INFO" "[4/4] 更新 Feeds..."
|
||||
update_feeds || success=false
|
||||
else
|
||||
log "WARN" "[4/4] 跳过更新 Feeds,因为之前的步骤失败。"
|
||||
fi
|
||||
|
||||
# 总结
|
||||
if [ "$success" = true ]; then
|
||||
log "INFO" "所有组件更新完成!"
|
||||
return 0
|
||||
else
|
||||
log "ERROR" "部分或全部组件更新失败,请检查上面的日志。"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# 菜单配置 (make menuconfig)
|
||||
menuconfig() {
|
||||
log "INFO" "准备进入菜单配置 (make menuconfig)..."
|
||||
log "INFO" "注意:日志重定向将暂时禁用以进行交互。"
|
||||
|
||||
# 禁用日志重定向,否则 menuconfig 界面可能显示不正常
|
||||
disable_logging
|
||||
|
||||
# 执行 menuconfig
|
||||
if make menuconfig; then
|
||||
# 配置成功后重新启用日志
|
||||
enable_logging
|
||||
log "INFO" "菜单配置完成。新配置已保存到 .config"
|
||||
# 询问是否保存 defconfig (可选)
|
||||
# read -p "是否将当前配置保存为 defconfig? (y/N): " save_defconfig
|
||||
# if [[ "$save_defconfig" =~ ^[Yy]$ ]]; then
|
||||
# ./scripts/diffconfig.sh > my_defconfig
|
||||
# log "INFO" "当前配置已保存到 my_defconfig"
|
||||
# fi
|
||||
return 0
|
||||
else
|
||||
# 配置失败或被取消,也要恢复日志
|
||||
enable_logging
|
||||
log "WARN" "菜单配置未完成或被取消。"
|
||||
return 1 # 返回失败状态码
|
||||
fi
|
||||
}
|
||||
|
||||
#---------------组合功能函数---------------#
|
||||
# 完整构建流程
|
||||
full_build() {
|
||||
log "INFO" "启动完整构建流程..."
|
||||
local step=1
|
||||
local total_steps=6 # 预估步骤数
|
||||
|
||||
# 1. 清理工作区
|
||||
log "INFO" "[${step}/${total_steps}] 清理工作区..."
|
||||
clean_workspace || { log "WARN" "工作区清理可能不完整,尝试继续..."; } # 清理失败通常不致命
|
||||
((step++))
|
||||
|
||||
# 2. 更新源码
|
||||
log "INFO" "[${step}/${total_steps}] 更新源码..."
|
||||
update_source || { log "ERROR" "源码更新失败,终止构建流程。"; return 1; }
|
||||
((step++))
|
||||
|
||||
# 3. 清理旧包
|
||||
log "INFO" "[${step}/${total_steps}] 清理配置文件指定的旧包..."
|
||||
clean_packages || log "WARN" "清理旧包时遇到问题,继续执行..."
|
||||
((step++))
|
||||
|
||||
# 4. 更新自定义包
|
||||
log "INFO" "[${step}/${total_steps}] 更新自定义包..."
|
||||
update_custom_package || { log "ERROR" "自定义包更新失败,终止构建流程。"; return 1; }
|
||||
((step++))
|
||||
|
||||
# 5. 更新 Feeds
|
||||
log "INFO" "[${step}/${total_steps}] 更新 Feeds..."
|
||||
update_feeds || { log "ERROR" "Feeds 更新失败,终止构建流程。"; return 1; }
|
||||
((step++))
|
||||
|
||||
# 6. 菜单配置
|
||||
log "INFO" "[${step}/${total_steps}] 进入菜单配置 (make menuconfig)..."
|
||||
menuconfig || { log "WARN" "菜单配置未完成或取消,但继续尝试编译..."; } # 允许使用现有配置编译
|
||||
((step++)) # 无论成功与否,都算一步
|
||||
|
||||
# 7. 编译固件 (独立步骤,不计入前面的 total_steps)
|
||||
log "INFO" "所有准备工作完成,开始编译固件..."
|
||||
if build_firmware; then
|
||||
log "INFO" "${GREEN}完整构建流程成功完成!${NC}"
|
||||
return 0
|
||||
else
|
||||
log "ERROR" "${RED}完整构建流程失败于编译阶段。${NC}"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
#---------------菜单函数---------------#
|
||||
# 打印主菜单
|
||||
print_menu() {
|
||||
echo -e "\n${BLUE}======= OpenWrt 构建管理菜单 =======${NC}"
|
||||
echo -e " ${YELLOW}会话日志目录: ${SESSION_DIR}${NC}"
|
||||
echo -e "${GREEN} 1.${NC} ${BOLD}完整构建流程${NC} (清理 > 更新源码/包/feeds > 配置 > 编译)"
|
||||
echo -e "${GREEN} 2.${NC} 清理工作区 (删除 tmp, bin, build_dir 等)"
|
||||
echo -e "${GREEN} 3.${NC} 更新所有组件 (源码 + 旧包清理 + 自定义包 + feeds)"
|
||||
echo -e "${GREEN} 4.${NC} 清理配置文件指定的旧包/目录"
|
||||
echo -e "${GREEN} 5.${NC} ${BOLD}编译固件${NC} (make V=s)"
|
||||
echo -e "${GREEN} 6.${NC} 调整配置 (make menuconfig)"
|
||||
echo -e "${GREEN} 7.${NC} 更新所有自定义包"
|
||||
echo -e "${GREEN} 8.${NC} 更新特定的自定义包"
|
||||
echo -e "${GREEN} 9.${NC} 更新 OpenWrt 源码 (git pull)"
|
||||
echo -e "${GREEN}10.${NC} 更新并安装 Feeds"
|
||||
echo -e "-------------------------------------"
|
||||
echo -e "${GREEN} 0.${NC} 退出脚本"
|
||||
echo -e "${BLUE}====================================${NC}"
|
||||
# 使用 read -p 提供提示
|
||||
read -rp "请输入选项 [0-10]: " choice
|
||||
}
|
||||
|
||||
# 打印并选择特定自定义包进行更新
|
||||
select_specific_package() {
|
||||
local pkg_names=("${!CUSTOM_PACKAGES[@]}") # 获取所有包名
|
||||
local num_packages=${#pkg_names[@]}
|
||||
|
||||
if [ "$num_packages" -eq 0 ]; then
|
||||
log "WARN" "没有配置任何自定义包。"
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo -e "\n${BLUE}--- 选择要更新的自定义包 ---${NC}"
|
||||
local i=1
|
||||
# 使用 sort 命令让包名按字母排序显示
|
||||
local sorted_pkg_names=($(printf "%s\n" "${pkg_names[@]}" | sort))
|
||||
|
||||
for pkg_name in "${sorted_pkg_names[@]}"; do
|
||||
echo -e " ${GREEN}$i.${NC} $pkg_name"
|
||||
((i++))
|
||||
done
|
||||
echo -e " ${GREEN}0.${NC} 返回主菜单"
|
||||
echo -e "${BLUE}----------------------------${NC}"
|
||||
|
||||
local choice_pkg
|
||||
read -rp "请输入包的序号 [0-$num_packages]: " choice_pkg
|
||||
|
||||
# 验证选择
|
||||
if [[ ! "$choice_pkg" =~ ^[0-9]+$ ]]; then
|
||||
log "ERROR" "无效输入,请输入数字。"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ "$choice_pkg" -eq 0 ]; then
|
||||
log "INFO" "返回主菜单。"
|
||||
return 0 # 返回成功,表示正常退出选择
|
||||
elif [ "$choice_pkg" -ge 1 ] && [ "$choice_pkg" -le "$num_packages" ]; then
|
||||
local selected_pkg=${sorted_pkg_names[$((choice_pkg-1))]}
|
||||
log "INFO" "选择更新包: $selected_pkg"
|
||||
update_specific_package "$selected_pkg" # 调用更新函数
|
||||
return $? # 返回更新函数的执行结果
|
||||
else
|
||||
log "ERROR" "无效的选择序号: $choice_pkg"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
#---------------主函数---------------#
|
||||
main() {
|
||||
# 0. 设置颜色变量
|
||||
setup_colors
|
||||
|
||||
# 1. 初始化日志系统 (会进行第一次输出重定向)
|
||||
init_logger || exit 1 # 初始化失败则退出
|
||||
|
||||
# 2. 检查运行环境和依赖
|
||||
log "INFO" "检查运行环境..."
|
||||
local dep_missing=false
|
||||
if [ ! -f "Makefile" ] || [ ! -d "scripts" ] || [ ! -d ".git" ]; then
|
||||
log "ERROR" "脚本必须在 OpenWrt 源码的根目录下运行 (需要存在 Makefile, scripts, .git)。"
|
||||
dep_missing=true
|
||||
fi
|
||||
for cmd in git make nproc tee cut dirname mkdir rm git date printf sort read; do
|
||||
if ! command -v "$cmd" &> /dev/null; then
|
||||
log "ERROR" "缺少必要的系统命令: $cmd"
|
||||
dep_missing=true
|
||||
fi
|
||||
done
|
||||
if [ "$dep_missing" = true ]; then
|
||||
log "ERROR" "环境或依赖检查失败,请修正后重试。"
|
||||
# 恢复原始输出,避免后续可能的错误信息无法显示
|
||||
exec >&$STDOUT_ORIG
|
||||
exec 2>&$STDERR_ORIG
|
||||
exit 1
|
||||
fi
|
||||
log "INFO" "环境检查通过。"
|
||||
|
||||
# 记录脚本启动信息
|
||||
log "INFO" "${BOLD}OpenWrt 构建管理脚本已启动${NC}"
|
||||
log "INFO" "PID: $$"
|
||||
log "INFO" "会话日志目录: $SESSION_DIR"
|
||||
|
||||
# 3. 主菜单循环
|
||||
local choice # 提前声明 choice
|
||||
while true; do
|
||||
print_menu # 显示菜单并获取输入到 choice 变量
|
||||
log "DEBUG" "用户选择了: $choice" # 记录用户选择
|
||||
|
||||
# 根据选择执行操作
|
||||
case $choice in
|
||||
1) full_build ;;
|
||||
2) clean_workspace ;;
|
||||
3) update_all_components ;;
|
||||
4) clean_packages ;;
|
||||
5) build_firmware ;;
|
||||
6) menuconfig ;;
|
||||
7) update_custom_package ;;
|
||||
8) select_specific_package ;;
|
||||
9) update_source ;;
|
||||
10) update_feeds ;;
|
||||
0)
|
||||
log "INFO" "收到退出命令,正在退出脚本..."
|
||||
# 恢复原始输出流 (好习惯)
|
||||
exec >&$STDOUT_ORIG
|
||||
exec 2>&$STDERR_ORIG
|
||||
echo -e "${GREEN}脚本已退出。${NC}"
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
log "WARN" "无效的选项: '$choice',请输入 0 到 10 之间的数字。"
|
||||
;;
|
||||
esac
|
||||
|
||||
local last_exit_code=$? # 获取上一个命令的退出状态码
|
||||
# 操作完成后暂停,给用户查看结果的时间
|
||||
if [[ $choice != 0 ]]; then
|
||||
if [ $last_exit_code -eq 0 ]; then
|
||||
echo -e "\n${GREEN}操作 '$choice' 执行完成。${NC}"
|
||||
else
|
||||
echo -e "\n${RED}操作 '$choice' 执行时遇到错误 (退出码: $last_exit_code)。${NC}"
|
||||
fi
|
||||
echo -e "${YELLOW}按 Enter 键返回主菜单...${NC}"
|
||||
read -r # 等待用户按回车
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
#---------------脚本入口---------------#
|
||||
# 将所有主逻辑放入 main 函数,并在最后调用它
|
||||
# "$@" 将所有命令行参数传递给 main 函数 (虽然本脚本目前未使用)
|
||||
main "$@"
|
||||
@@ -153,6 +153,21 @@ menu "Global build settings"
|
||||
help
|
||||
Adds -g3 to the CFLAGS.
|
||||
|
||||
config USE_GC_SECTIONS
|
||||
bool
|
||||
prompt "Dead code and data elimination for all packages (EXPERIMENTAL)"
|
||||
help
|
||||
Places functions and data items into its own sections to use the linker's
|
||||
garbage collection capabilites.
|
||||
Packages can choose to opt-out via setting PKG_BUILD_FLAGS:=no-gc-sections
|
||||
|
||||
config USE_LTO
|
||||
bool
|
||||
prompt "Use the link-time optimizer for all packages (EXPERIMENTAL)"
|
||||
help
|
||||
Adds LTO flags to the CFLAGS and LDFLAGS.
|
||||
Packages can choose to opt-out via setting PKG_BUILD_FLAGS:=no-lto
|
||||
|
||||
config IPV6
|
||||
def_bool y
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ menu "Target Images"
|
||||
default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_lantiq
|
||||
default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_mpc85xx
|
||||
default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_ramips
|
||||
default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_ipq40xx
|
||||
default TARGET_INITRAMFS_COMPRESSION_ZSTD if TARGET_qualcommax
|
||||
default TARGET_INITRAMFS_COMPRESSION_XZ if USES_SEPARATE_INITRAMFS
|
||||
default TARGET_INITRAMFS_COMPRESSION_NONE
|
||||
depends on TARGET_ROOTFS_INITRAMFS
|
||||
@@ -198,18 +198,21 @@ menu "Target Images"
|
||||
default ""
|
||||
|
||||
config GRUB_IMAGES
|
||||
bool "Build GRUB images (Linux x86 or x86_64 host only)"
|
||||
bool "Build GRUB images"
|
||||
depends on TARGET_x86
|
||||
depends on TARGET_ROOTFS_EXT4FS || TARGET_ROOTFS_JFFS2 || TARGET_ROOTFS_SQUASHFS
|
||||
select PACKAGE_grub2
|
||||
default n
|
||||
|
||||
config GRUB_EFI_IMAGES
|
||||
bool "Build GRUB EFI images (Linux x86 or x86_64 host only)"
|
||||
depends on TARGET_x86
|
||||
bool "Build GRUB EFI images"
|
||||
depends on TARGET_x86 || TARGET_armvirt || TARGET_loongarch64 || TARGET_phytium_armv8
|
||||
depends on TARGET_ROOTFS_EXT4FS || TARGET_ROOTFS_JFFS2 || TARGET_ROOTFS_SQUASHFS
|
||||
select PACKAGE_grub2
|
||||
select PACKAGE_grub2-efi
|
||||
select PACKAGE_grub2 if TARGET_x86
|
||||
select PACKAGE_grub2-efi if TARGET_x86
|
||||
select PACKAGE_grub2-bios-setup if TARGET_x86
|
||||
select PACKAGE_grub2-efi-arm if TARGET_armvirt
|
||||
select PACKAGE_grub2-efi-arm if TARGET_phytium_armv8
|
||||
select PACKAGE_kmod-fs-vfat
|
||||
default y
|
||||
|
||||
@@ -274,7 +277,7 @@ menu "Target Images"
|
||||
|
||||
config VMDK_IMAGES
|
||||
bool "Build VMware image files (VMDK)"
|
||||
depends on TARGET_x86
|
||||
depends on TARGET_x86 || TARGET_armvirt || TARGET_loongarch64
|
||||
depends on GRUB_IMAGES || GRUB_EFI_IMAGES
|
||||
default y
|
||||
select PACKAGE_kmod-e1000
|
||||
@@ -287,7 +290,7 @@ menu "Target Images"
|
||||
|
||||
config TARGET_IMAGES_GZIP
|
||||
bool "GZip images"
|
||||
depends on TARGET_ROOTFS_EXT4FS || TARGET_x86 || TARGET_armvirt || TARGET_malta
|
||||
depends on TARGET_ROOTFS_EXT4FS || TARGET_x86 || TARGET_armvirt || TARGET_loongarch64 || TARGET_malta
|
||||
default y
|
||||
|
||||
comment "Image Options"
|
||||
@@ -300,12 +303,13 @@ menu "Target Images"
|
||||
default 8 if TARGET_apm821xx_sata
|
||||
default 64 if TARGET_bcm27xx
|
||||
default 32 if TARGET_rockchip
|
||||
default 32 if TARGET_x86
|
||||
default 16
|
||||
default 128 if TARGET_armvirt
|
||||
default 32
|
||||
|
||||
config TARGET_ROOTFS_PARTSIZE
|
||||
int "Root filesystem partition size (in MiB)"
|
||||
depends on USES_ROOTFS_PART || TARGET_ROOTFS_EXT4FS
|
||||
default 232 if TARGET_loongarch64
|
||||
default 400 if TARGET_x86
|
||||
default 160
|
||||
help
|
||||
|
||||
@@ -50,6 +50,20 @@ config KERNEL_ARM_PMU
|
||||
default n
|
||||
depends on (arm || aarch64)
|
||||
|
||||
config KERNEL_ARM_PMUV3
|
||||
bool
|
||||
default y if TARGET_armsr_armv8
|
||||
depends on (arm_v7 || aarch64) && LINUX_6_6
|
||||
|
||||
config KERNEL_RISCV_PMU
|
||||
bool
|
||||
select KERNEL_RISCV_PMU_SBI
|
||||
depends on riscv64
|
||||
|
||||
config KERNEL_RISCV_PMU_SBI
|
||||
bool
|
||||
depends on riscv64
|
||||
|
||||
config KERNEL_X86_VSYSCALL_EMULATION
|
||||
bool "Enable vsyscall emulation"
|
||||
default n
|
||||
@@ -72,6 +86,8 @@ config KERNEL_PERF_EVENTS
|
||||
bool "Compile the kernel with performance events and counters"
|
||||
default n
|
||||
select KERNEL_ARM_PMU if (arm || aarch64)
|
||||
select KERNEL_ARM_PMUV3 if (arm_v7 || aarch64) && LINUX_6_6
|
||||
select KERNEL_RISCV_PMU if riscv64
|
||||
|
||||
config KERNEL_PROFILING
|
||||
bool "Compile the kernel with profiling enabled"
|
||||
@@ -401,6 +417,17 @@ config KERNEL_DEBUG_INFO_REDUCED
|
||||
DEBUG_INFO build and compile times are reduced too.
|
||||
Only works with newer gcc versions.
|
||||
|
||||
config KERNEL_FRAME_WARN
|
||||
int
|
||||
range 0 8192
|
||||
default 1280 if KERNEL_KASAN && !ARCH_64BIT
|
||||
default 1024 if !ARCH_64BIT
|
||||
default 2048 if ARCH_64BIT
|
||||
help
|
||||
Tell the compiler to warn at build time for stack frames larger than this.
|
||||
Setting this too low will cause a lot of warnings.
|
||||
Setting it to 0 disables the warning.
|
||||
|
||||
config KERNEL_DEBUG_LL_UART_NONE
|
||||
bool
|
||||
default n
|
||||
@@ -1056,6 +1083,13 @@ if KERNEL_IP_MROUTE
|
||||
|
||||
endif
|
||||
|
||||
config KERNEL_MPTCP
|
||||
bool "Enable IPv4 MultiPath TCP support"
|
||||
default y
|
||||
depends on !(LINUX_4_4||LINUX_5_4)
|
||||
help
|
||||
IPv4 MultiPath TCP to kernel support.
|
||||
|
||||
#
|
||||
# IPv6 configuration
|
||||
#
|
||||
@@ -1097,6 +1131,14 @@ if KERNEL_IPV6
|
||||
config KERNEL_LWTUNNEL_BPF
|
||||
def_bool n
|
||||
|
||||
config KERNEL_MPTCP_IPV6
|
||||
bool "Enable IPv6 MultiPath TCP support"
|
||||
default y
|
||||
depends on KERNEL_MPTCP
|
||||
depends on !(LINUX_4_4||LINUX_5_4)
|
||||
help
|
||||
IPv6 MultiPath TCP to kernel support.
|
||||
|
||||
endif
|
||||
|
||||
#
|
||||
@@ -1109,6 +1151,21 @@ config KERNEL_NET_L3_MASTER_DEV
|
||||
This module provides glue between core networking code and device
|
||||
drivers to support L3 master devices like VRF.
|
||||
|
||||
config KERNEL_XDP_SOCKETS
|
||||
bool "XDP sockets support"
|
||||
default y if KERNEL_DEBUG_INFO_BTF
|
||||
help
|
||||
XDP sockets allows a channel between XDP programs and
|
||||
userspace applications.
|
||||
|
||||
config KERNEL_PAGE_POOL
|
||||
def_bool n
|
||||
|
||||
config KERNEL_PAGE_POOL_STATS
|
||||
bool "Page pool stats support"
|
||||
depends on KERNEL_PAGE_POOL
|
||||
depends on !(LINUX_5_4||LINUX_5_10)
|
||||
|
||||
#
|
||||
# NFS related symbols
|
||||
#
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
src-git packages https://github.com/DHDAXCW/packages
|
||||
src-git luci https://github.com/DHDAXCW/luci
|
||||
src-git routing https://github.com/coolsnowwolf/routing
|
||||
src-git telephony https://git.openwrt.org/feed/telephony.git
|
||||
src-git telephony https://github.com/coolsnowwolf/telephony.git
|
||||
src-git istore https://github.com/linkease/istore;main
|
||||
|
||||
@@ -300,7 +300,7 @@ define Build/fit
|
||||
$(if $(DEVICE_FDT_NUM),-n $(DEVICE_FDT_NUM)) \
|
||||
$(if $(DEVICE_DTS_DELIMITER),-l $(DEVICE_DTS_DELIMITER)) \
|
||||
$(if $(DEVICE_DTS_LOADADDR),-s $(DEVICE_DTS_LOADADDR)) \
|
||||
$(if $(DEVICE_DTS_OVERLAY),$(foreach dtso,$(DEVICE_DTS_OVERLAY), -O $(dtso):$(KERNEL_BUILD_DIR)/image-$(dtso).dtb)) \
|
||||
$(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)
|
||||
PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage $(if $(findstring external,$(word 3,$(1))),\
|
||||
@@ -581,6 +581,7 @@ define Build/tplink-v2-image
|
||||
endef
|
||||
|
||||
define Build/uImage
|
||||
$(if $(UIMAGE_TIME),SOURCE_DATE_EPOCH="$(UIMAGE_TIME)") \
|
||||
mkimage \
|
||||
-A $(LINUX_KARCH) \
|
||||
-O linux \
|
||||
|
||||
@@ -146,7 +146,7 @@ endif
|
||||
|
||||
|
||||
# Disable noisy checks by default as in upstream
|
||||
DTC_FLAGS += \
|
||||
DTC_WARN_FLAGS := \
|
||||
-Wno-unit_address_vs_reg \
|
||||
-Wno-simple_bus_reg \
|
||||
-Wno-unit_address_format \
|
||||
@@ -159,6 +159,9 @@ DTC_FLAGS += \
|
||||
-Wno-graph_port \
|
||||
-Wno-unique_unit_address
|
||||
|
||||
DTC_FLAGS += $(DTC_WARN_FLAGS)
|
||||
DTCO_FLAGS += $(DTC_WARN_FLAGS)
|
||||
|
||||
define Image/pad-to
|
||||
dd if=$(1) of=$(1).new bs=$(2) conv=sync
|
||||
mv $(1).new $(1)
|
||||
@@ -174,21 +177,30 @@ endef
|
||||
# $(2) target dtb file
|
||||
# $(3) extra CPP flags
|
||||
# $(4) extra DTC flags
|
||||
define Image/BuildDTB
|
||||
define Image/BuildDTB/sub
|
||||
$(TARGET_CROSS)cpp -nostdinc -x assembler-with-cpp \
|
||||
$(DTS_CPPFLAGS) \
|
||||
-I$(DTS_DIR) \
|
||||
-I$(DTS_DIR)/include \
|
||||
-I$(LINUX_DIR)/include/ \
|
||||
-I$(LINUX_DIR)/scripts/dtc/include-prefixes \
|
||||
-undef -D__DTS__ $(3) \
|
||||
-o $(2).tmp $(1)
|
||||
$(LINUX_DIR)/scripts/dtc/dtc -O dtb \
|
||||
-i$(dir $(1)) $(DTC_FLAGS) $(4) \
|
||||
-i$(dir $(1)) $(4) \
|
||||
$(if $(CONFIG_HAS_DT_OVERLAY_SUPPORT),-@) \
|
||||
-o $(2) $(2).tmp
|
||||
$(RM) $(2).tmp
|
||||
endef
|
||||
|
||||
define Image/BuildDTB
|
||||
$(call Image/BuildDTB/sub,$(1),$(2),$(3),$(DTC_FLAGS) $(DEVICE_DTC_FLAGS) $(4))
|
||||
endef
|
||||
|
||||
define Image/BuildDTBO
|
||||
$(call Image/BuildDTB/sub,$(1),$(2),$(3),$(DTCO_FLAGS) $(DEVICE_DTCO_FLAGS) $(4))
|
||||
endef
|
||||
|
||||
define Image/mkfs/jffs2/sub-raw
|
||||
$(STAGING_DIR_HOST)/bin/mkfs.jffs2 \
|
||||
$(2) \
|
||||
@@ -400,11 +412,14 @@ define Device/Init
|
||||
DEVICE_DTS_LOADADDR :=
|
||||
DEVICE_DTS_OVERLAY :=
|
||||
DEVICE_FDT_NUM :=
|
||||
DEVICE_DTC_FLAGS :=
|
||||
DEVICE_DTCO_FLAGS :=
|
||||
SOC :=
|
||||
|
||||
BOARD_NAME :=
|
||||
UIMAGE_MAGIC :=
|
||||
UIMAGE_NAME :=
|
||||
UIMAGE_TIME :=
|
||||
DEVICE_COMPAT_VERSION := 1.0
|
||||
DEVICE_COMPAT_MESSAGE :=
|
||||
SUPPORTED_DEVICES := $(subst _,$(comma),$(1))
|
||||
@@ -421,11 +436,11 @@ endef
|
||||
DEFAULT_DEVICE_VARS := \
|
||||
DEVICE_NAME KERNEL KERNEL_INITRAMFS KERNEL_INITRAMFS_IMAGE KERNEL_SIZE \
|
||||
CMDLINE UBOOTENV_IN_UBI KERNEL_IN_UBI BLOCKSIZE PAGESIZE SUBPAGESIZE \
|
||||
VID_HDR_OFFSET UBINIZE_OPTS UBINIZE_PARTS MKUBIFS_OPTS DEVICE_DTS \
|
||||
DEVICE_DTS_CONFIG DEVICE_DTS_DELIMITER DEVICE_DTS_DIR DEVICE_DTS_OVERLAY \
|
||||
DEVICE_DTS_LOADADDR \
|
||||
VID_HDR_OFFSET UBINIZE_OPTS UBINIZE_PARTS MKUBIFS_OPTS DEVICE_DTC_FLAGS \
|
||||
DEVICE_DTCO_FLAGS DEVICE_DTS DEVICE_DTS_CONFIG DEVICE_DTS_DELIMITER \
|
||||
DEVICE_DTS_DIR DEVICE_DTS_OVERLAY DEVICE_DTS_LOADADDR \
|
||||
DEVICE_FDT_NUM DEVICE_IMG_PREFIX SOC BOARD_NAME UIMAGE_MAGIC UIMAGE_NAME \
|
||||
SUPPORTED_DEVICES IMAGE_METADATA KERNEL_ENTRY KERNEL_LOADADDR \
|
||||
UIMAGE_TIME SUPPORTED_DEVICES IMAGE_METADATA KERNEL_ENTRY KERNEL_LOADADDR \
|
||||
UBOOT_PATH IMAGE_SIZE \
|
||||
FACTORY_IMG_NAME FACTORY_SIZE \
|
||||
DEVICE_PACKAGES DEVICE_COMPAT_VERSION DEVICE_COMPAT_MESSAGE \
|
||||
@@ -550,19 +565,36 @@ define Device/Build/dtb
|
||||
$(KDIR)/image-$(1).dtb: FORCE
|
||||
$(call Image/BuildDTB,$(strip $(2))/$(strip $(3)).dts,$$@)
|
||||
|
||||
image_prepare: $(KDIR)/image-$(1).dtb
|
||||
compile-dtb: $(KDIR)/image-$(1).dtb
|
||||
endif
|
||||
|
||||
endef
|
||||
|
||||
define Device/Build/dtbo
|
||||
ifndef BUILD_DTSO_$(1)
|
||||
BUILD_DTSO_$(1) := 1
|
||||
$(KDIR)/image-$(1).dtbo: FORCE
|
||||
$(call Image/BuildDTBO,$(strip $(2))/$(strip $(3)).dtso,$$@)
|
||||
|
||||
compile-dtb: $(KDIR)/image-$(1).dtbo
|
||||
endif
|
||||
|
||||
endef
|
||||
endif
|
||||
|
||||
define Device/Build/kernel
|
||||
$$(eval $$(foreach dts,$$(DEVICE_DTS) $$(DEVICE_DTS_OVERLAY), \
|
||||
$$(eval $$(foreach dts,$$(DEVICE_DTS), \
|
||||
$$(call Device/Build/dtb,$$(notdir $$(dts)), \
|
||||
$$(if $$(DEVICE_DTS_DIR),$$(DEVICE_DTS_DIR),$$(DTS_DIR)), \
|
||||
$$(dts) \
|
||||
) \
|
||||
))
|
||||
$$(eval $$(foreach dtso,$$(DEVICE_DTS_OVERLAY), \
|
||||
$$(call Device/Build/dtbo,$$(notdir $$(dtso)), \
|
||||
$$(if $$(DEVICE_DTS_DIR),$$(DEVICE_DTS_DIR),$$(DTS_DIR)), \
|
||||
$$(dtso) \
|
||||
) \
|
||||
))
|
||||
|
||||
$(KDIR)/$$(KERNEL_NAME):: image_prepare
|
||||
$$(_TARGET): $$(if $$(KERNEL_INSTALL),$(BIN_DIR)/$$(KERNEL_IMAGE))
|
||||
@@ -781,18 +813,20 @@ define BuildImage
|
||||
download:
|
||||
prepare:
|
||||
compile:
|
||||
compile-dtb:
|
||||
clean:
|
||||
image_prepare:
|
||||
|
||||
ifeq ($(IB),)
|
||||
.PHONY: download prepare compile clean image_prepare kernel_prepare install install-images
|
||||
.PHONY: download prepare compile compile-dtb clean image_prepare kernel_prepare install install-images
|
||||
compile:
|
||||
$(call Build/Compile)
|
||||
|
||||
clean:
|
||||
$(call Build/Clean)
|
||||
|
||||
image_prepare: compile
|
||||
compile-dtb:
|
||||
image_prepare: compile compile-dtb
|
||||
mkdir -p $(BIN_DIR) $(KDIR)/tmp
|
||||
rm -rf $(BUILD_DIR)/json_info_files
|
||||
$(call Image/Prepare)
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
LINUX_VERSION-5.10 = .165
|
||||
LINUX_KERNEL_HASH-5.10.165 = 971defc48f19ed0a2a7ffd4b48234619cac28895c985c6d747f5b707ba47af0d
|
||||
LINUX_VERSION-5.10 = .220
|
||||
LINUX_KERNEL_HASH-5.10.220 = 7cc3aff924e9707a5dbf1200c79a7f01617e097b9b175d02bda8ca762aeee19b
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
LINUX_VERSION-5.15 = .90
|
||||
LINUX_KERNEL_HASH-5.15.90 = e6fd430022686753af7516fe7544f96aab379509dc5b7829017bdcd92b393b42
|
||||
LINUX_VERSION-5.15 = .162
|
||||
LINUX_KERNEL_HASH-5.15.162 = 91bfc0ea152ce7b102a0b79d35a7c92843874ebf085c99d2ba8b4d85e62b1a7c
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
LINUX_VERSION-5.4 = .192
|
||||
LINUX_KERNEL_HASH-5.4.192 = 32482e1152fb07b126180a374f5f7d14601bd13a50ab8cbb75465aa998da9e93
|
||||
LINUX_VERSION-5.4 = .278
|
||||
LINUX_KERNEL_HASH-5.4.278 = e5a00606115545f444ef2766af5652f5539e3c96f46a9778bede89b98ffb8588
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
LINUX_VERSION-6.1 = .30
|
||||
LINUX_KERNEL_HASH-6.1.30 = 1bf254c4ca9ebccb25328296584fb5e87ad635ae0c1cc1deb0b5bb37a4608813
|
||||
LINUX_VERSION-6.1 = .98
|
||||
LINUX_KERNEL_HASH-6.1.98 = 97cdc9127c7700556ea0891267a0c24cf372f4b81636fb8203a914f3a69f3406
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
LINUX_VERSION-6.3 = -rc2
|
||||
LINUX_KERNEL_HASH-6.3-rc2 = 9fb1fa648c615089a97c02a526aaff3821b1ff92a918229b4d01d5a8760be1e8
|
||||
2
include/kernel-6.6
Normal file
2
include/kernel-6.6
Normal file
@@ -0,0 +1,2 @@
|
||||
LINUX_VERSION-6.6 = .66
|
||||
LINUX_KERNEL_HASH-6.6.66 = 9d757937c4661c2f512c62641b74ef74eff9bb13dc5dbcbaaa108c21152f1e52
|
||||
@@ -156,6 +156,10 @@ define BuildKernel
|
||||
compile: $(LINUX_DIR)/.modules
|
||||
$(MAKE) -C image compile TARGET_BUILD=
|
||||
|
||||
dtb: $(STAMP_CONFIGURED)
|
||||
$(_SINGLE)$(KERNEL_MAKE) scripts_dtc
|
||||
$(MAKE) -C image compile-dtb TARGET_BUILD=
|
||||
|
||||
oldconfig menuconfig nconfig xconfig: $(STAMP_PREPARED) $(STAMP_CHECKED) FORCE
|
||||
rm -f $(LINUX_DIR)/.config.prev
|
||||
rm -f $(STAMP_CONFIGURED)
|
||||
|
||||
@@ -75,6 +75,7 @@ endif
|
||||
rm -f $(LINUX_DIR)/.config.prev
|
||||
mv $(LINUX_DIR)/.config $(LINUX_DIR)/.config.old
|
||||
$(call Kernel/SetInitramfs/PreConfigure)
|
||||
echo "# CONFIG_INITRAMFS_PRESERVE_MTIME is not set" >> $(LINUX_DIR)/.config
|
||||
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS_SEPARATE),y)
|
||||
echo 'CONFIG_INITRAMFS_ROOT_UID=$(shell id -u)' >> $(LINUX_DIR)/.config
|
||||
echo 'CONFIG_INITRAMFS_ROOT_GID=$(shell id -g)' >> $(LINUX_DIR)/.config
|
||||
@@ -99,6 +100,7 @@ define Kernel/SetNoInitramfs
|
||||
grep -v INITRAMFS $(LINUX_DIR)/.config.old > $(LINUX_DIR)/.config.set
|
||||
echo 'CONFIG_INITRAMFS_SOURCE=""' >> $(LINUX_DIR)/.config.set
|
||||
echo '# CONFIG_INITRAMFS_FORCE is not set' >> $(LINUX_DIR)/.config.set
|
||||
echo "# CONFIG_INITRAMFS_PRESERVE_MTIME is not set" >> $(LINUX_DIR)/.config.set
|
||||
endef
|
||||
|
||||
define Kernel/Configure/Default
|
||||
|
||||
@@ -2,11 +2,6 @@
|
||||
# Use the default kernel version if the Makefile doesn't override it
|
||||
LINUX_RELEASE?=1
|
||||
|
||||
ifdef CONFIG_TESTING_KERNEL
|
||||
KERNEL_PA
|
||||
# Use the default kernel version if the Makefile doesn't override it
|
||||
LINUX_RELEASE?=1
|
||||
|
||||
ifdef CONFIG_TESTING_KERNEL
|
||||
KERNEL_PATCHVER:=$(KERNEL_TESTING_PATCHVER)
|
||||
endif
|
||||
@@ -51,42 +46,6 @@ KERNEL_BASE=$(firstword $(subst -, ,$(LINUX_VERSION)))
|
||||
KERNEL=$(call merge_version,$(wordlist 1,2,$(call split_version,$(KERNEL_BASE))))
|
||||
KERNEL_PATCHVER ?= $(KERNEL)
|
||||
|
||||
# disable the md5sum check for unknown kernel versions
|
||||
LINUX_KERNEL_HASH:=$(LINUX_KERNEL_HASH-$(strip $(LINUX_VERSION)))
|
||||
LINUX_KERNEL_HASH?=xTCHVER:=$(KERNEL_TESTING_PATCHVER)
|
||||
endif
|
||||
|
||||
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
|
||||
|
||||
include $(KERNEL_DETAILS_FILE)
|
||||
|
||||
remove_uri_prefix=$(subst git://,,$(subst http://,,$(subst https://,,$(1))))
|
||||
sanitize_uri=$(call qstrip,$(subst @,_,$(subst :,_,$(subst .,_,$(subst -,_,$(subst /,_,$(1)))))))
|
||||
|
||||
ifneq ($(call qstrip,$(CONFIG_KERNEL_GIT_CLONE_URI)),)
|
||||
LINUX_VERSION:=$(call sanitize_uri,$(call remove_uri_prefix,$(CONFIG_KERNEL_GIT_CLONE_URI)))
|
||||
ifeq ($(call qstrip,$(CONFIG_KERNEL_GIT_REF)),)
|
||||
CONFIG_KERNEL_GIT_REF:=HEAD
|
||||
endif
|
||||
LINUX_VERSION:=$(LINUX_VERSION)-$(call sanitize_uri,$(CONFIG_KERNEL_GIT_REF))
|
||||
else
|
||||
ifdef KERNEL_PATCHVER
|
||||
LINUX_VERSION:=$(KERNEL_PATCHVER)$(strip $(LINUX_VERSION-$(KERNEL_PATCHVER)))
|
||||
endif
|
||||
ifdef KERNEL_TESTING_PATCHVER
|
||||
LINUX_TESTING_VERSION:=$(KERNEL_TESTING_PATCHVER)$(strip $(LINUX_VERSION-$(KERNEL_TESTING_PATCHVER)))
|
||||
endif
|
||||
endif
|
||||
|
||||
split_version=$(subst ., ,$(1))
|
||||
merge_version=$(subst $(space),.,$(1))
|
||||
KERNEL_BASE=$(firstword $(subst -, ,$(LINUX_VERSION)))
|
||||
KERNEL=$(call merge_version,$(wordlist 1,2,$(call split_version,$(KERNEL_BASE))))
|
||||
KERNEL_PATCHVER ?= $(KERNEL)
|
||||
|
||||
# disable the md5sum check for unknown kernel versions
|
||||
LINUX_KERNEL_HASH:=$(LINUX_KERNEL_HASH-$(strip $(LINUX_VERSION)))
|
||||
LINUX_KERNEL_HASH?=x
|
||||
|
||||
@@ -86,10 +86,14 @@ else ifneq (,$(findstring $(ARCH) , arceb ))
|
||||
LINUX_KARCH := arc
|
||||
else ifneq (,$(findstring $(ARCH) , armeb ))
|
||||
LINUX_KARCH := arm
|
||||
else ifneq (,$(findstring $(ARCH) , loongarch64 ))
|
||||
LINUX_KARCH := loongarch
|
||||
else ifneq (,$(findstring $(ARCH) , mipsel mips64 mips64el ))
|
||||
LINUX_KARCH := mips
|
||||
else ifneq (,$(findstring $(ARCH) , powerpc64 ))
|
||||
LINUX_KARCH := powerpc
|
||||
else ifneq (,$(findstring $(ARCH) , riscv64 ))
|
||||
LINUX_KARCH := riscv
|
||||
else ifneq (,$(findstring $(ARCH) , sh2 sh3 sh4 ))
|
||||
LINUX_KARCH := sh
|
||||
else ifneq (,$(findstring $(ARCH) , i386 x86_64 ))
|
||||
@@ -234,7 +238,7 @@ $(call KernelPackage/$(1)/config)
|
||||
$(call KernelPackage/depends)
|
||||
$(call KernelPackage/hooks)
|
||||
|
||||
ifneq ($(if $(filter-out %=y %=n %=m,$(KCONFIG)),$(filter m y,$(foreach c,$(filter-out %=y %=n %=m,$(KCONFIG)),$($(c)))),.),)
|
||||
ifneq ($(if $(filter-out %=y %=n %=m,$(KCONFIG)),$(filter m y,$(foreach c,$(call version_filter,$(filter-out %=y %=n %=m,$(KCONFIG))),$($(c)))),.),)
|
||||
define Package/kmod-$(1)/install
|
||||
@for mod in $$(call version_filter,$$(FILES)); do \
|
||||
if grep -q "$$$$$$$${mod##$(LINUX_DIR)/}" "$(LINUX_DIR)/modules.builtin"; then \
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
# Copyright (C) 2022 Enéas Ulir de Queiroz
|
||||
|
||||
ENGINES_DIR=engines-1.1
|
||||
|
||||
define Package/openssl/engine/Default
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
SUBMENU:=SSL
|
||||
DEPENDS:=libopenssl @OPENSSL_ENGINE +libopenssl-conf
|
||||
endef
|
||||
|
||||
# 1 = engine name
|
||||
# 2 - package name, defaults to libopenssl-$(1)
|
||||
define Package/openssl/add-engine
|
||||
OSSL_ENG_PKG:=$(if $(2),$(2),libopenssl-$(1))
|
||||
Package/$$(OSSL_ENG_PKG)/conffiles:=/etc/ssl/engines.cnf.d/$(1).cnf
|
||||
|
||||
define Package/$$(OSSL_ENG_PKG)/install
|
||||
$$(INSTALL_DIR) $$(1)/usr/lib/$(ENGINES_DIR)
|
||||
$$(INSTALL_BIN) $$(PKG_INSTALL_DIR)/usr/lib/$(ENGINES_DIR)/$(1).so \
|
||||
$$(1)/usr/lib/$(ENGINES_DIR)
|
||||
$$(INSTALL_DIR) $$(1)/etc/ssl/engines.cnf.d
|
||||
$$(INSTALL_DATA) ./files/$(1).cnf $$(1)/etc/ssl/engines.cnf.d/
|
||||
endef
|
||||
|
||||
define Package/$$(OSSL_ENG_PKG)/postinst :=
|
||||
#!/bin/sh
|
||||
OPENSSL_UCI="$$$${IPKG_INSTROOT}/etc/config/openssl"
|
||||
|
||||
[ -z "$$$${IPKG_INSTROOT}" ] && uci -q get openssl.$(1) >/dev/null && exit 0
|
||||
|
||||
cat << EOF >> "$$$${OPENSSL_UCI}"
|
||||
|
||||
config engine '$(1)'
|
||||
option enabled '1'
|
||||
EOF
|
||||
|
||||
[ -n "$$$${IPKG_INSTROOT}" ] || /etc/init.d/openssl reload
|
||||
endef
|
||||
|
||||
define Package/$$(OSSL_ENG_PKG)/postrm :=
|
||||
#!/bin/sh
|
||||
[ -n "$$$${IPKG_INSTROOT}" ] && exit 0
|
||||
uci delete openssl.$(1)
|
||||
uci commit openssl
|
||||
/etc/init.d/openssl reload
|
||||
endef
|
||||
endef
|
||||
79
include/openssl-module.mk
Normal file
79
include/openssl-module.mk
Normal file
@@ -0,0 +1,79 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
# Copyright (C) 2022-2023 Enéas Ulir de Queiroz
|
||||
|
||||
ENGINES_DIR=engines-3
|
||||
|
||||
define Package/openssl/module/Default
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
SUBMENU:=SSL
|
||||
DEPENDS:=libopenssl +libopenssl-conf
|
||||
endef
|
||||
|
||||
define Package/openssl/engine/Default
|
||||
$(Package/openssl/module/Default)
|
||||
DEPENDS+=@OPENSSL_ENGINE
|
||||
endef
|
||||
|
||||
|
||||
# 1 = moudule type (engine|provider)
|
||||
# 2 = module name
|
||||
# 3 = directory to save .so file
|
||||
# 4 = [ package name, defaults to libopenssl-$(2) ]
|
||||
define Package/openssl/add-module
|
||||
$(eval MOD_TYPE:=$(1))
|
||||
$(eval MOD_NAME:=$(2))
|
||||
$(eval MOD_DIR:=$(3))
|
||||
$(eval OSSL_PKG:=$(if $(4),$(4),libopenssl-$(MOD_NAME)))
|
||||
$(info Package/openssl/add-module 1='$(1)'; 2='$(2)'; 3='$(3)' 4='$(4)')
|
||||
$(info MOD_TYPE='$(MOD_TYPE)'; MOD_NAME='$(MOD_NAME)'; MOD_DIR='$(MOD_DIR)' OSSL_PKG='$(OSSL_PKG)')
|
||||
Package/$(OSSL_PKG)/conffiles:=/etc/ssl/modules.cnf.d/$(MOD_NAME).cnf
|
||||
|
||||
define Package/$(OSSL_PKG)/install
|
||||
$$(INSTALL_DIR) $$(1)/$(MOD_DIR)
|
||||
$$(INSTALL_BIN) $$(PKG_INSTALL_DIR)/$(MOD_DIR)/$(MOD_NAME).so \
|
||||
$$(1)/$(MOD_DIR)
|
||||
$$(INSTALL_DIR) $$(1)/etc/ssl/modules.cnf.d
|
||||
$$(INSTALL_DATA) ./files/$(MOD_NAME).cnf $$(1)/etc/ssl/modules.cnf.d/
|
||||
endef
|
||||
|
||||
define Package/$(OSSL_PKG)/postinst
|
||||
#!/bin/sh
|
||||
OPENSSL_UCI="$$$${IPKG_INSTROOT}/etc/config/openssl"
|
||||
|
||||
[ -z "$$$${IPKG_INSTROOT}" ] \
|
||||
&& uci -q get openssl.$(MOD_NAME) >/dev/null \
|
||||
&& exit 0
|
||||
|
||||
cat << EOF >> "$$$${OPENSSL_UCI}"
|
||||
|
||||
config $(MOD_TYPE) '$(MOD_NAME)'
|
||||
option enabled '1'
|
||||
EOF
|
||||
|
||||
[ -n "$$$${IPKG_INSTROOT}" ] || /etc/init.d/openssl reload
|
||||
exit 0
|
||||
endef
|
||||
|
||||
define Package/$(OSSL_PKG)/postrm
|
||||
#!/bin/sh
|
||||
[ -n "$$$${IPKG_INSTROOT}" ] && exit 0
|
||||
uci -q delete openssl.$(MOD_NAME) && uci commit openssl
|
||||
/etc/init.d/openssl reload
|
||||
exit 0
|
||||
endef
|
||||
endef
|
||||
|
||||
# 1 = engine name
|
||||
# 2 - package name, defaults to libopenssl-$(1)
|
||||
define Package/openssl/add-engine
|
||||
$(call Package/openssl/add-module,engine,$(1),/usr/lib/$(ENGINES_DIR),$(2))
|
||||
endef
|
||||
|
||||
# 1 = provider name
|
||||
# 2 = [ package name, defaults to libopenssl-$(1) ]
|
||||
define Package/openssl/add-provider
|
||||
$(call Package/openssl/add-module,provider,$(1),/usr/lib/ossl-modules,$(2))
|
||||
endef
|
||||
|
||||
@@ -11,8 +11,6 @@ include $(INCLUDE_DIR)/download.mk
|
||||
PKG_BUILD_DIR ?= $(BUILD_DIR)/$(if $(BUILD_VARIANT),$(PKG_NAME)-$(BUILD_VARIANT)/)$(PKG_NAME)$(if $(PKG_VERSION),-$(PKG_VERSION))
|
||||
PKG_INSTALL_DIR ?= $(PKG_BUILD_DIR)/ipkg-install
|
||||
PKG_BUILD_PARALLEL ?=
|
||||
PKG_USE_MIPS16 ?= 1
|
||||
PKG_IREMAP ?= 1
|
||||
PKG_SKIP_DOWNLOAD=$(USE_SOURCE_DIR)$(USE_GIT_TREE)$(USE_GIT_SRC_CHECKOUT)
|
||||
|
||||
MAKE_J:=$(if $(MAKE_JOBSERVER),$(MAKE_JOBSERVER) $(if $(filter 3.% 4.0 4.1,$(MAKE_VERSION)),-j))
|
||||
@@ -24,17 +22,52 @@ PKG_JOBS?=-j1
|
||||
else
|
||||
PKG_JOBS?=$(if $(PKG_BUILD_PARALLEL),$(MAKE_J),-j1)
|
||||
endif
|
||||
ifdef CONFIG_USE_MIPS16
|
||||
ifeq ($(strip $(PKG_USE_MIPS16)),1)
|
||||
TARGET_ASFLAGS_DEFAULT = $(filter-out -mips16 -minterlink-mips16,$(TARGET_CFLAGS))
|
||||
TARGET_CFLAGS += -mips16 -minterlink-mips16
|
||||
|
||||
PKG_BUILD_FLAGS?=
|
||||
# TODO remove this when all packages moved to PKG_BUILD_FLAGS=no-mips16
|
||||
PKG_USE_MIPS16?=1
|
||||
ifneq ($(strip $(PKG_USE_MIPS16)),1)
|
||||
PKG_BUILD_FLAGS+=no-mips16
|
||||
endif
|
||||
|
||||
__unknown_flags=$(filter-out no-iremap no-mips16 gc-sections no-gc-sections lto no-lto no-mold,$(PKG_BUILD_FLAGS))
|
||||
ifneq ($(__unknown_flags),)
|
||||
$(error unknown PKG_BUILD_FLAGS: $(__unknown_flags))
|
||||
endif
|
||||
ifeq ($(strip $(PKG_IREMAP)),1)
|
||||
|
||||
# $1=flagname, $2=default (0/1)
|
||||
define pkg_build_flag
|
||||
$(if $(filter no-$(1),$(PKG_BUILD_FLAGS)),0,$(if $(filter $(1),$(PKG_BUILD_FLAGS)),1,$(2)))
|
||||
endef
|
||||
|
||||
ifeq ($(call pkg_build_flag,iremap,1),1)
|
||||
IREMAP_CFLAGS = $(call iremap,$(PKG_BUILD_DIR),$(notdir $(PKG_BUILD_DIR)))
|
||||
TARGET_CFLAGS += $(IREMAP_CFLAGS)
|
||||
endif
|
||||
|
||||
ifdef CONFIG_USE_MIPS16
|
||||
ifeq ($(call pkg_build_flag,mips16,1),1)
|
||||
TARGET_ASFLAGS_DEFAULT = $(filter-out -mips16 -minterlink-mips16,$(TARGET_CFLAGS))
|
||||
TARGET_CFLAGS += -mips16 -minterlink-mips16
|
||||
TARGET_CXXFLAGS += -mips16 -minterlink-mips16
|
||||
endif
|
||||
endif
|
||||
ifeq ($(call pkg_build_flag,gc-sections,$(if $(CONFIG_USE_GC_SECTIONS),1,0)),1)
|
||||
TARGET_CFLAGS+= -ffunction-sections -fdata-sections
|
||||
TARGET_CXXFLAGS+= -ffunction-sections -fdata-sections
|
||||
TARGET_LDFLAGS+= -Wl,--gc-sections
|
||||
endif
|
||||
ifeq ($(call pkg_build_flag,lto,$(if $(CONFIG_USE_LTO),1,0)),1)
|
||||
TARGET_CFLAGS+= -flto=auto -fno-fat-lto-objects
|
||||
TARGET_CXXFLAGS+= -flto=auto -fno-fat-lto-objects
|
||||
TARGET_LDFLAGS+= -flto=auto -fuse-linker-plugin
|
||||
endif
|
||||
ifdef CONFIG_USE_MOLD
|
||||
ifeq ($(call pkg_build_flag,mold,1),1)
|
||||
TARGET_LINKER:=mold
|
||||
endif
|
||||
endif
|
||||
|
||||
include $(INCLUDE_DIR)/hardening.mk
|
||||
include $(INCLUDE_DIR)/prereq.mk
|
||||
include $(INCLUDE_DIR)/unpack.mk
|
||||
|
||||
@@ -229,4 +229,4 @@ prereq: $(STAGING_DIR_HOST)/bin/mkhash $(STAGING_DIR_HOST)/bin/xxd
|
||||
|
||||
# Install ldconfig stub
|
||||
$(eval $(call TestHostCommand,ldconfig-stub,Failed to install stub, \
|
||||
$(LN) $(firstword $(wildcard /bin/true /usr/bin/true)) $(STAGING_DIR_HOST)/bin/ldconfig))
|
||||
$(LN) $(SCRIPT_DIR)/noop.sh $(STAGING_DIR_HOST)/bin/ldconfig))
|
||||
|
||||
30
include/site/loongarch64
Normal file
30
include/site/loongarch64
Normal file
@@ -0,0 +1,30 @@
|
||||
#!/bin/sh
|
||||
. $TOPDIR/include/site/linux
|
||||
ac_cv_c_littleendian=${ac_cv_c_littleendian=yes}
|
||||
ac_cv_c_bigendian=${ac_cv_c_bigendian=no}
|
||||
|
||||
ac_cv_sizeof___int64=0
|
||||
ac_cv_sizeof_char=1
|
||||
ac_cv_sizeof_int=4
|
||||
ac_cv_sizeof_int16_t=2
|
||||
ac_cv_sizeof_int32_t=4
|
||||
ac_cv_sizeof_int64_t=8
|
||||
ac_cv_sizeof_long_int=8
|
||||
ac_cv_sizeof_long_long=8
|
||||
ac_cv_sizeof_long=8
|
||||
ac_cv_sizeof_off_t=8
|
||||
ac_cv_sizeof_short_int=2
|
||||
ac_cv_sizeof_short=2
|
||||
ac_cv_sizeof_size_t=8
|
||||
ac_cv_sizeof_ssize_t=8
|
||||
ac_cv_sizeof_u_int16_t=2
|
||||
ac_cv_sizeof_u_int32_t=4
|
||||
ac_cv_sizeof_u_int64_t=8
|
||||
ac_cv_sizeof_uint16_t=2
|
||||
ac_cv_sizeof_uint32_t=4
|
||||
ac_cv_sizeof_uint64_t=8
|
||||
ac_cv_sizeof_unsigned_int=4
|
||||
ac_cv_sizeof_unsigned_long=8
|
||||
ac_cv_sizeof_unsigned_long_long=8
|
||||
ac_cv_sizeof_unsigned_short=2
|
||||
ac_cv_sizeof_void_p=8
|
||||
30
include/site/riscv64
Normal file
30
include/site/riscv64
Normal file
@@ -0,0 +1,30 @@
|
||||
#!/bin/sh
|
||||
. $TOPDIR/include/site/linux
|
||||
ac_cv_c_littleendian=${ac_cv_c_littleendian=yes}
|
||||
ac_cv_c_bigendian=${ac_cv_c_bigendian=no}
|
||||
|
||||
ac_cv_sizeof___int64=8
|
||||
ac_cv_sizeof_char=1
|
||||
ac_cv_sizeof_int=4
|
||||
ac_cv_sizeof_int16_t=2
|
||||
ac_cv_sizeof_int32_t=4
|
||||
ac_cv_sizeof_int64_t=8
|
||||
ac_cv_sizeof_long_int=8
|
||||
ac_cv_sizeof_long_long=8
|
||||
ac_cv_sizeof_long=8
|
||||
ac_cv_sizeof_off_t=8
|
||||
ac_cv_sizeof_short_int=2
|
||||
ac_cv_sizeof_short=2
|
||||
ac_cv_sizeof_size_t=8
|
||||
ac_cv_sizeof_ssize_t=8
|
||||
ac_cv_sizeof_u_int16_t=2
|
||||
ac_cv_sizeof_u_int32_t=4
|
||||
ac_cv_sizeof_u_int64_t=8
|
||||
ac_cv_sizeof_uint16_t=2
|
||||
ac_cv_sizeof_uint32_t=4
|
||||
ac_cv_sizeof_uint64_t=8
|
||||
ac_cv_sizeof_unsigned_int=4
|
||||
ac_cv_sizeof_unsigned_long=8
|
||||
ac_cv_sizeof_unsigned_long_long=8
|
||||
ac_cv_sizeof_unsigned_short=2
|
||||
ac_cv_sizeof_void_p=8
|
||||
@@ -5,6 +5,9 @@
|
||||
ifeq ($(MAKECMDGOALS),prereq)
|
||||
SUBTARGETS:=prereq
|
||||
PREREQ_ONLY:=1
|
||||
# For target/linux related target add dtb to selectively compile dtbs
|
||||
else ifneq ($(filter target/linux/%,$(MAKECMDGOALS)),)
|
||||
SUBTARGETS:=$(DEFAULT_SUBDIR_TARGETS) dtb
|
||||
else
|
||||
SUBTARGETS:=$(DEFAULT_SUBDIR_TARGETS)
|
||||
endif
|
||||
|
||||
@@ -53,9 +53,9 @@ DEFAULT_PACKAGES.nas:=\
|
||||
mdadm
|
||||
# For router targets
|
||||
DEFAULT_PACKAGES.router:=\
|
||||
dnsmasq-full firewall iptables ppp ppp-mod-pppoe \
|
||||
dnsmasq-full firewall iptables ppp ppp-mod-pppoe odhcp6c odhcpd-ipv6only \
|
||||
block-mount coremark kmod-nf-nathelper kmod-nf-nathelper-extra kmod-ipt-raw kmod-tun \
|
||||
iptables-mod-tproxy iptables-mod-extra ipset ip-full default-settings luci luci-newapi \
|
||||
iptables-mod-tproxy iptables-mod-extra ipset ip-full default-settings luci luci-proto-ipv6 \
|
||||
ddns-scripts_aliyun ddns-scripts_dnspod luci-app-ddns luci-app-upnp luci-app-autoreboot \
|
||||
luci-app-arpbind luci-app-filetransfer luci-app-vsftpd luci-app-ssr-plus luci-app-vlmcsd \
|
||||
luci-app-accesscontrol luci-app-nlbwmon luci-app-turboacc luci-app-wol curl ca-certificates
|
||||
@@ -258,6 +258,15 @@ ifeq ($(DUMP),1)
|
||||
CPU_CFLAGS_arc700 = -mcpu=arc700
|
||||
CPU_CFLAGS_archs = -mcpu=archs
|
||||
endif
|
||||
ifeq ($(ARCH),riscv64)
|
||||
CPU_TYPE ?= riscv64
|
||||
CPU_CFLAGS_riscv64:=-mabi=lp64d -march=rv64imafdc
|
||||
endif
|
||||
ifeq ($(ARCH),loongarch64)
|
||||
CPU_TYPE ?= generic
|
||||
CPU_CFLAGS := -O2 -pipe
|
||||
CPU_CFLAGS_generic:=-march=loongarch64
|
||||
endif
|
||||
ifneq ($(CPU_TYPE),)
|
||||
ifndef CPU_CFLAGS_$(CPU_TYPE)
|
||||
$(warning CPU_TYPE "$(CPU_TYPE)" doesn't correspond to a known type)
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
include $(INCLUDE_DIR)/prereq.mk
|
||||
|
||||
PKG_NAME ?= u-boot
|
||||
|
||||
ifndef PKG_SOURCE_PROTO
|
||||
@@ -16,7 +18,32 @@ PKG_FLAGS:=nonshared
|
||||
PKG_LICENSE:=GPL-2.0 GPL-2.0+
|
||||
PKG_LICENSE_FILES:=Licenses/README
|
||||
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_BUILD_PARALLEL ?= 1
|
||||
|
||||
ifdef UBOOT_USE_BINMAN
|
||||
$(eval $(call TestHostCommand,python3-pyelftools, \
|
||||
Please install the Python3 elftools module, \
|
||||
$(STAGING_DIR_HOST)/bin/python3 -c 'import elftools'))
|
||||
endif
|
||||
|
||||
ifdef UBOOT_USE_INTREE_DTC
|
||||
$(eval $(call TestHostCommand,python3-dev, \
|
||||
Please install the python3-dev package, \
|
||||
python3.11-config --includes 2>&1 | grep 'python3', \
|
||||
python3.10-config --includes 2>&1 | grep 'python3', \
|
||||
python3.9-config --includes 2>&1 | grep 'python3', \
|
||||
python3.8-config --includes 2>&1 | grep 'python3', \
|
||||
python3.7-config --includes 2>&1 | grep 'python3', \
|
||||
python3-config --includes 2>&1 | grep -E 'python3\.([7-9]|[0-9][0-9])\.?'))
|
||||
|
||||
$(eval $(call TestHostCommand,python3-setuptools, \
|
||||
Please install the Python3 setuptools module, \
|
||||
$(STAGING_DIR_HOST)/bin/python3 -c 'import setuptools'))
|
||||
|
||||
$(eval $(call TestHostCommand,swig, \
|
||||
Please install the swig package, \
|
||||
swig -version))
|
||||
endif
|
||||
|
||||
export GCC_HONOUR_COPTS=s
|
||||
|
||||
@@ -42,6 +69,7 @@ endef
|
||||
TARGET_DEP = TARGET_$(BUILD_TARGET)$(if $(BUILD_SUBTARGET),_$(BUILD_SUBTARGET))
|
||||
|
||||
UBOOT_MAKE_FLAGS = \
|
||||
PATH=$(STAGING_DIR_HOST)/bin:$(PATH) \
|
||||
HOSTCC="$(HOSTCC)" \
|
||||
HOSTCFLAGS="$(HOST_CFLAGS) $(HOST_CPPFLAGS) -std=gnu11" \
|
||||
HOSTLDFLAGS="$(HOST_LDFLAGS)" \
|
||||
@@ -83,9 +111,14 @@ endef
|
||||
|
||||
define Build/Configure/U-Boot
|
||||
+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) $(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) $(UBOOT_CONFIGURE_VARS) oldconfig)
|
||||
endef
|
||||
|
||||
ifndef UBOOT_USE_INTREE_DTC
|
||||
DTC=$(wildcard $(LINUX_DIR)/scripts/dtc/dtc)
|
||||
endif
|
||||
|
||||
define Build/Compile/U-Boot
|
||||
+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
# 切换5.15来编译rockchip rk356x设备
|
||||
下版本更新5.15
|
||||
71
linux6.x.md
71
linux6.x.md
@@ -1,71 +0,0 @@
|
||||
# 切换6.1来编译rockchip rk356x设备
|
||||
1. 执行命令来切换6.1内核`sed -i 's/5.4/6.1/g' ./target/linux/rockchip/Makefile`
|
||||
2. 删除源码部分文件夹
|
||||
```bash
|
||||
rm -rf package/kernel/mac80211
|
||||
rm -rf package/kernel/rtl8821cu
|
||||
rm -rf package/network/services/hostapd
|
||||
```
|
||||
3.下载openwrt官网部分文件
|
||||
```bash
|
||||
svn export https://github.com/openwrt/openwrt/trunk/package/kernel/mac80211 package/kernel/mac80211
|
||||
svn export https://github.com/openwrt/openwrt/trunk/package/network/services/hostapd package/network/services/hostapd
|
||||
```
|
||||
4. 将在target/linux/rockchip/image/armv8.mk这个文件夹里,去掉注释#,如下:
|
||||
```patch
|
||||
--- a/target/linux/rockchip/image/armv8.mk
|
||||
+++ b/target/linux/rockchip/image/armv8.mk
|
||||
@@ -30,7 +30,7 @@ define Device/embedfire_lubancat1
|
||||
IMAGE/sysupgrade.img.gz := boot-common | boot-script nanopi-r5s | pine64-img | gzip | append-metadata
|
||||
DEVICE_PACKAGES := kmod-r8125
|
||||
endef
|
||||
-#TARGET_DEVICES += embedfire_lubancat1
|
||||
+TARGET_DEVICES += embedfire_lubancat1
|
||||
|
||||
define Device/embedfire_lubancat1n
|
||||
DEVICE_VENDOR := EmbedFire
|
||||
@@ -40,7 +40,7 @@ define Device/embedfire_lubancat1n
|
||||
IMAGE/sysupgrade.img.gz := boot-common | boot-script nanopi-r5s | pine64-img | gzip | append-metadata
|
||||
DEVICE_PACKAGES := kmod-r8169 -urngd kmod-ata-ahci
|
||||
endef
|
||||
-#TARGET_DEVICES += embedfire_lubancat1n
|
||||
+TARGET_DEVICES += embedfire_lubancat1n
|
||||
|
||||
define Device/embedfire_lubancat2
|
||||
DEVICE_VENDOR := EmbedFire
|
||||
@@ -50,7 +50,7 @@ define Device/embedfire_lubancat2
|
||||
IMAGE/sysupgrade.img.gz := boot-common | boot-script nanopi-r5s | pine64-img | gzip | append-metadata
|
||||
DEVICE_PACKAGES := kmod-ata-ahci kmod-ata-ahci-platform kmod-ata-core kmod-ata-ahci kmod-ata-ahci-platform kmod-ata-core
|
||||
endef
|
||||
-#TARGET_DEVICES += embedfire_lubancat2
|
||||
+TARGET_DEVICES += embedfire_lubancat2
|
||||
|
||||
define Device/embedfire_lubancat2n
|
||||
DEVICE_VENDOR := EmbedFire
|
||||
@@ -60,7 +60,7 @@ define Device/embedfire_lubancat2n
|
||||
IMAGE/sysupgrade.img.gz := boot-common | boot-script nanopi-r5s | pine64-img | gzip | append-metadata
|
||||
DEVICE_PACKAGES := kmod-r8125 kmod-ata-ahci kmod-ata-ahci-platform kmod-ata-core
|
||||
endef
|
||||
-#TARGET_DEVICES += embedfire_lubancat2n
|
||||
+TARGET_DEVICES += embedfire_lubancat2n
|
||||
|
||||
define Device/hinlink_opc-h68k
|
||||
DEVICE_VENDOR := HINLINK
|
||||
@@ -70,7 +70,7 @@ define Device/hinlink_opc-h68k
|
||||
IMAGE/sysupgrade.img.gz := boot-common | boot-script nanopi-r5s | pine64-img | gzip | append-metadata
|
||||
DEVICE_PACKAGES := kmod-r8125
|
||||
endef
|
||||
-#TARGET_DEVICES += hinlink_opc-h68k
|
||||
+TARGET_DEVICES += hinlink_opc-h68k
|
||||
|
||||
define Device/friendlyarm_nanopi-r2c
|
||||
DEVICE_VENDOR := FriendlyARM
|
||||
@@ -120,4 +120,4 @@ define Device/friendlyarm_nanopi-r5s
|
||||
IMAGE/sysupgrade.img.gz := boot-common | boot-script nanopi-r5s | pine64-img | gzip | append-metadata
|
||||
DEVICE_PACKAGES := kmod-r8125 kmod-nvme kmod-scsi-core
|
||||
endef
|
||||
-#TARGET_DEVICES += friendlyarm_nanopi-r5s
|
||||
+TARGET_DEVICES += friendlyarm_nanopi-r5s
|
||||
```
|
||||
|
||||
5. 然后参考下载源代码,更新 feeds 并选择配置等等,即可编译你需要的固件了
|
||||
56
openwrt_logs/20250408_180935/main_build_script.log
Normal file
56
openwrt_logs/20250408_180935/main_build_script.log
Normal file
@@ -0,0 +1,56 @@
|
||||
[2025-04-08 18:09:35] [INFO]: 日志系统初始化完成。主日志文件: openwrt_logs/20250408_180935/main_build_script.log
|
||||
[2025-04-08 18:09:35] [0;32m[INFO ][0m: 检查运行环境...
|
||||
[2025-04-08 18:09:35] [0;32m[INFO ][0m: 环境检查通过。
|
||||
[2025-04-08 18:09:35] [0;32m[INFO ][0m: OpenWrt 构建管理脚本已启动\033[0m
|
||||
[2025-04-08 18:09:35] [0;32m[INFO ][0m: PID: 2874378
|
||||
[2025-04-08 18:09:35] [0;32m[INFO ][0m: 会话日志目录: openwrt_logs/20250408_180935
|
||||
|
||||
[0;34m======= OpenWrt 构建管理菜单 =======[0m
|
||||
[1;33m会话日志目录: openwrt_logs/20250408_180935[0m
|
||||
[0;32m 1.[0m 完整构建流程[0m (清理 > 更新源码/包/feeds > 配置 > 编译)
|
||||
[0;32m 2.[0m 清理工作区 (删除 tmp, bin, build_dir 等)
|
||||
[0;32m 3.[0m 更新所有组件 (源码 + 旧包清理 + 自定义包 + feeds)
|
||||
[0;32m 4.[0m 清理配置文件指定的旧包/目录
|
||||
[0;32m 5.[0m 编译固件[0m (make V=s)
|
||||
[0;32m 6.[0m 调整配置 (make menuconfig)
|
||||
[0;32m 7.[0m 更新所有自定义包
|
||||
[0;32m 8.[0m 更新特定的自定义包
|
||||
[0;32m 9.[0m 更新 OpenWrt 源码 (git pull)
|
||||
[0;32m10.[0m 更新并安装 Feeds
|
||||
-------------------------------------
|
||||
[0;32m 0.[0m 退出脚本
|
||||
[0;34m====================================[0m
|
||||
请输入选项 [0-10]: [2025-04-08 18:09:36] [0;34m[DEBUG][0m: 用户选择了: 1
|
||||
[2025-04-08 18:09:36] [0;32m[INFO ][0m: 启动完整构建流程...
|
||||
[2025-04-08 18:09:36] [0;32m[INFO ][0m: [1/6] 清理工作区...
|
||||
[2025-04-08 18:09:36] [0;32m[INFO ][0m: 开始彻底清理工作区...
|
||||
[2025-04-08 18:09:36] [0;32m[INFO ][0m: 执行 rm -rf ./tmp ./logs ./staging_dir ./build_dir ./bin ./dl ...
|
||||
[2025-04-08 18:09:36] [0;32m[INFO ][0m: 工作区清理完成。
|
||||
[2025-04-08 18:09:36] [0;32m[INFO ][0m: [2/6] 更新源码...
|
||||
[2025-04-08 18:09:36] [0;32m[INFO ][0m: 开始更新 OpenWrt 源码 (git pull)...
|
||||
error: cannot pull with rebase: You have unstaged changes.
|
||||
error: Please commit or stash them.
|
||||
[2025-04-08 18:09:36] [0;31m[ERROR][0m: 源码更新失败 (git pull --rebase)
|
||||
[2025-04-08 18:09:36] [1;33m[WARN ][0m: 请检查本地是否有未提交的修改,或尝试手动解决 Git 冲突。
|
||||
[2025-04-08 18:09:36] [0;31m[ERROR][0m: 源码更新失败,终止构建流程。
|
||||
|
||||
[0;31m操作 '1' 执行时遇到错误 (退出码: 1)。[0m
|
||||
[1;33m按 Enter 键返回主菜单...[0m
|
||||
|
||||
[0;34m======= OpenWrt 构建管理菜单 =======[0m
|
||||
[1;33m会话日志目录: openwrt_logs/20250408_180935[0m
|
||||
[0;32m 1.[0m 完整构建流程[0m (清理 > 更新源码/包/feeds > 配置 > 编译)
|
||||
[0;32m 2.[0m 清理工作区 (删除 tmp, bin, build_dir 等)
|
||||
[0;32m 3.[0m 更新所有组件 (源码 + 旧包清理 + 自定义包 + feeds)
|
||||
[0;32m 4.[0m 清理配置文件指定的旧包/目录
|
||||
[0;32m 5.[0m 编译固件[0m (make V=s)
|
||||
[0;32m 6.[0m 调整配置 (make menuconfig)
|
||||
[0;32m 7.[0m 更新所有自定义包
|
||||
[0;32m 8.[0m 更新特定的自定义包
|
||||
[0;32m 9.[0m 更新 OpenWrt 源码 (git pull)
|
||||
[0;32m10.[0m 更新并安装 Feeds
|
||||
-------------------------------------
|
||||
[0;32m 0.[0m 退出脚本
|
||||
[0;34m====================================[0m
|
||||
请输入选项 [0-10]: [2025-04-08 18:09:40] [0;34m[DEBUG][0m: 用户选择了: 0
|
||||
[2025-04-08 18:09:40] [0;32m[INFO ][0m: 收到退出命令,正在退出脚本...
|
||||
1
package/5G-Modem-Support
Submodule
1
package/5G-Modem-Support
Submodule
Submodule package/5G-Modem-Support added at da43e7a10e
1
package/adguardhome
Submodule
1
package/adguardhome
Submodule
Submodule package/adguardhome added at ff6d1e2edf
@@ -23,6 +23,7 @@ PKG_LICENSE:=GPL-2.0
|
||||
PKG_CONFIG_DEPENDS += \
|
||||
CONFIG_SIGNED_PACKAGES CONFIG_TARGET_INIT_PATH CONFIG_TARGET_PREINIT_DISABLE_FAILSAFE \
|
||||
CONFIG_NAND_SUPPORT \
|
||||
CONFIG_LEGACY_SDCARD_SUPPORT \
|
||||
CONFIG_EMMC_SUPPORT \
|
||||
CONFIG_CLEAN_IPKG \
|
||||
CONFIG_PER_FEED_REPO \
|
||||
@@ -89,6 +90,19 @@ define ImageConfigOptions
|
||||
echo 'pi_preinit_net_messages="$(CONFIG_TARGET_PREINIT_SHOW_NETMSG)"' >>$(1)/lib/preinit/00_preinit.conf
|
||||
echo 'pi_preinit_no_failsafe_netmsg="$(CONFIG_TARGET_PREINIT_SUPPRESS_FAILSAFE_NETMSG)"' >>$(1)/lib/preinit/00_preinit.conf
|
||||
echo 'pi_preinit_no_failsafe="$(CONFIG_TARGET_PREINIT_DISABLE_FAILSAFE)"' >>$(1)/lib/preinit/00_preinit.conf
|
||||
ifeq ($(CONFIG_TARGET_DEFAULT_LAN_IP_FROM_PREINIT),y)
|
||||
mkdir -p $(1)/etc/board.d
|
||||
echo '. /lib/functions/uci-defaults.sh' >$(1)/etc/board.d/99-lan-ip
|
||||
echo 'logger -t 99-lan-ip "setting custom default LAN IP"' >>$(1)/etc/board.d/99-lan-ip
|
||||
echo 'board_config_update' >>$(1)/etc/board.d/99-lan-ip
|
||||
echo 'json_select network' >>$(1)/etc/board.d/99-lan-ip
|
||||
echo 'json_select lan' >>$(1)/etc/board.d/99-lan-ip
|
||||
echo 'json_add_string ipaddr $(if $(CONFIG_TARGET_PREINIT_IP),$(CONFIG_TARGET_PREINIT_IP),"192.168.1.1")' >>$(1)/etc/board.d/99-lan-ip
|
||||
echo 'json_add_string netmask $(if $(CONFIG_TARGET_PREINIT_NETMASK),$(CONFIG_TARGET_PREINIT_NETMASK),"255.255.255.0")' >>$(1)/etc/board.d/99-lan-ip
|
||||
echo 'json_select ..' >>$(1)/etc/board.d/99-lan-ip
|
||||
echo 'json_select ..' >>$(1)/etc/board.d/99-lan-ip
|
||||
echo 'board_config_flush' >>$(1)/etc/board.d/99-lan-ip
|
||||
endif
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
@@ -125,6 +139,12 @@ ifeq ($(CONFIG_NAND_SUPPORT),)
|
||||
endef
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_LEGACY_SDCARD_SUPPORT),)
|
||||
define Package/base-files/legacy-sdcard-support
|
||||
rm -f $(1)/lib/upgrade/legacy-sdcard.sh
|
||||
endef
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_EMMC_SUPPORT),)
|
||||
define Package/base-files/emmc-support
|
||||
rm -f $(1)/lib/upgrade/emmc.sh
|
||||
@@ -135,6 +155,7 @@ define Package/base-files/install
|
||||
$(CP) ./files/* $(1)/
|
||||
$(Package/base-files/install-key)
|
||||
$(Package/base-files/nand-support)
|
||||
$(Package/base-files/legacy-sdcard-support)
|
||||
$(Package/base-files/emmc-support)
|
||||
if [ -d $(GENERIC_PLATFORM_DIR)/base-files/. ]; then \
|
||||
$(CP) $(GENERIC_PLATFORM_DIR)/base-files/* $(1)/; \
|
||||
|
||||
@@ -305,10 +305,10 @@ generate_static_system() {
|
||||
set system.ntp='timeserver'
|
||||
set system.ntp.enabled='1'
|
||||
set system.ntp.enable_server='1'
|
||||
add_list system.ntp.server='ntp.aliyun.com'
|
||||
add_list system.ntp.server='time1.cloud.tencent.com'
|
||||
add_list system.ntp.server='time.ustc.edu.cn'
|
||||
add_list system.ntp.server='cn.pool.ntp.org'
|
||||
add_list system.ntp.server='time.apple.com'
|
||||
add_list system.ntp.server='time.google.com'
|
||||
add_list system.ntp.server='time.windows.com'
|
||||
add_list system.ntp.server='time.cloudflare.com'
|
||||
EOF
|
||||
|
||||
if json_is_a system object; then
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
▒█████ ██▓███ ▓█████ ███▄ █ █ █░ ██▀███ ▄▄▄█████▓
|
||||
▒██▒ ██▒▓██░ ██▒▓█ ▀ ██ ▀█ █ ▓█░ █ ░█░▓██ ▒ ██▒▓ ██▒ ▓▒
|
||||
▒██░ ██▒▓██░ ██▓▒▒███ ▓██ ▀█ ██▒▒█░ █ ░█ ▓██ ░▄█ ▒▒ ▓██░ ▒░
|
||||
|
||||
@@ -20,6 +20,7 @@ uci_apply_defaults() {
|
||||
boot() {
|
||||
[ -f /proc/mounts ] || /sbin/mount_root
|
||||
[ -f /proc/jffs2_bbc ] && echo "S" > /proc/jffs2_bbc
|
||||
|
||||
mkdir -p /var/lock
|
||||
chmod 1777 /var/lock
|
||||
mkdir -p /var/log
|
||||
|
||||
@@ -8,23 +8,33 @@ RTC_DEV=/dev/rtc0
|
||||
HWCLOCK=/sbin/hwclock
|
||||
|
||||
boot() {
|
||||
start && exit 0
|
||||
|
||||
local maxtime="$(maxtime)"
|
||||
hwclock_load
|
||||
local maxtime="$(find_max_time)"
|
||||
local curtime="$(date +%s)"
|
||||
[ $curtime -lt $maxtime ] && date -s @$maxtime
|
||||
if [ $curtime -lt $maxtime ]; then
|
||||
date -s @$maxtime
|
||||
hwclock_save
|
||||
fi
|
||||
}
|
||||
|
||||
start() {
|
||||
[ -e "$RTC_DEV" ] && [ -e "$HWCLOCK" ] && $HWCLOCK -s -u -f $RTC_DEV
|
||||
hwclock_load
|
||||
}
|
||||
|
||||
stop() {
|
||||
hwclock_save
|
||||
}
|
||||
|
||||
hwclock_load() {
|
||||
[ -e "$RTC_DEV" ] && [ -e "$HWCLOCK" ] && $HWCLOCK -s -u -f $RTC_DEV
|
||||
}
|
||||
|
||||
hwclock_save(){
|
||||
[ -e "$RTC_DEV" ] && [ -e "$HWCLOCK" ] && $HWCLOCK -w -u -f $RTC_DEV && \
|
||||
logger -t sysfixtime "saved '$(date)' to $RTC_DEV"
|
||||
}
|
||||
|
||||
maxtime() {
|
||||
find_max_time() {
|
||||
local file newest
|
||||
|
||||
for file in $( find /etc -type f ) ; do
|
||||
|
||||
@@ -13,7 +13,6 @@ export HOME=$(grep -e "^${USER:-root}:" /etc/passwd | cut -d ":" -f 6)
|
||||
export HOME=${HOME:-/root}
|
||||
export PS1='\u@\h:\w\$ '
|
||||
export ENV=/etc/shinit
|
||||
ulimit -n 655350
|
||||
|
||||
case "$TERM" in
|
||||
xterm*|rxvt*)
|
||||
|
||||
@@ -1 +1,5 @@
|
||||
# Defaults are configured in /etc/sysctl.d/* and can be customized in this file
|
||||
|
||||
net.bridge.bridge-nf-call-arptables = 0
|
||||
net.bridge.bridge-nf-call-ip6tables = 0
|
||||
net.bridge.bridge-nf-call-iptables = 0
|
||||
|
||||
@@ -314,19 +314,13 @@ find_mtd_part() {
|
||||
}
|
||||
|
||||
find_mmc_part() {
|
||||
local DEVNAME PARTNAME ROOTDEV
|
||||
local DEVNAME PARTNAME
|
||||
|
||||
if grep -q "$1" /proc/mtd; then
|
||||
echo "" && return 0
|
||||
fi
|
||||
|
||||
if [ -n "$2" ]; then
|
||||
ROOTDEV="$2"
|
||||
else
|
||||
ROOTDEV="mmcblk*"
|
||||
fi
|
||||
|
||||
for DEVNAME in /sys/block/$ROOTDEV/mmcblk*p*; do
|
||||
for DEVNAME in /sys/block/mmcblk*/mmcblk*p*; do
|
||||
PARTNAME="$(grep PARTNAME ${DEVNAME}/uevent | cut -f2 -d'=')"
|
||||
[ "$PARTNAME" = "$1" ] && echo "/dev/$(basename $DEVNAME)" && return 0
|
||||
done
|
||||
|
||||
@@ -61,40 +61,29 @@ find_mtd_chardev() {
|
||||
echo "${INDEX:+$PREFIX$INDEX}"
|
||||
}
|
||||
|
||||
mtd_get_mac_ascii() {
|
||||
local mtdname="$1"
|
||||
get_mac_ascii() {
|
||||
local part="$1"
|
||||
local key="$2"
|
||||
local part
|
||||
local mac_dirty
|
||||
|
||||
part=$(find_mtd_part "$mtdname")
|
||||
if [ -z "$part" ]; then
|
||||
echo "mtd_get_mac_ascii: partition $mtdname not found!" >&2
|
||||
return
|
||||
fi
|
||||
|
||||
mac_dirty=$(strings "$part" | sed -n 's/^'"$key"'=//p')
|
||||
|
||||
# "canonicalize" mac
|
||||
[ -n "$mac_dirty" ] && macaddr_canonicalize "$mac_dirty"
|
||||
}
|
||||
|
||||
mtd_get_mac_ascii_mmc() {
|
||||
mtd_get_mac_ascii() {
|
||||
local mtdname="$1"
|
||||
local key="$2"
|
||||
local part
|
||||
local mac_dirty
|
||||
|
||||
part=$(find_mmc_part "$mtdname")
|
||||
part=$(find_mtd_part "$mtdname")
|
||||
if [ -z "$part" ]; then
|
||||
echo "mtd_get_mac_ascii: partition $mtdname not found!" >&2
|
||||
return
|
||||
fi
|
||||
|
||||
mac_dirty=$(strings "$part" | sed -n 's/^'"$key"'=//p')
|
||||
|
||||
# "canonicalize" mac
|
||||
[ -n "$mac_dirty" ] && macaddr_canonicalize "$mac_dirty"
|
||||
get_mac_ascii "$part" "$key"
|
||||
}
|
||||
|
||||
mtd_get_mac_text() {
|
||||
@@ -162,6 +151,29 @@ mtd_get_part_size() {
|
||||
done < /proc/mtd
|
||||
}
|
||||
|
||||
mmc_get_mac_ascii() {
|
||||
local part_name="$1"
|
||||
local key="$2"
|
||||
local part
|
||||
|
||||
part=$(find_mmc_part "$part_name")
|
||||
if [ -z "$part" ]; then
|
||||
echo "mmc_get_mac_ascii: partition $part_name not found!" >&2
|
||||
return
|
||||
fi
|
||||
|
||||
get_mac_ascii "$part" "$key"
|
||||
}
|
||||
|
||||
mmc_get_mac_binary() {
|
||||
local part_name="$1"
|
||||
local offset="$2"
|
||||
local part
|
||||
|
||||
part=$(find_mmc_part "$part_name")
|
||||
get_mac_binary "$part" "$offset"
|
||||
}
|
||||
|
||||
macaddr_add() {
|
||||
local mac=$1
|
||||
local val=$2
|
||||
@@ -172,6 +184,14 @@ macaddr_add() {
|
||||
echo $oui:$nic
|
||||
}
|
||||
|
||||
macaddr_generate_from_mmc_cid() {
|
||||
local mmc_dev=$1
|
||||
|
||||
local sd_hash=$(sha256sum /sys/class/block/$mmc_dev/device/cid)
|
||||
local mac_base=$(macaddr_canonicalize "$(echo "${sd_hash}" | dd bs=1 count=12 2>/dev/null)")
|
||||
echo "$(macaddr_unsetbit_mc "$(macaddr_setbit_la "${mac_base}")")"
|
||||
}
|
||||
|
||||
macaddr_geteui() {
|
||||
local mac=$1
|
||||
local sep=$2
|
||||
|
||||
@@ -17,10 +17,7 @@ missing_lines() {
|
||||
do_mount_root() {
|
||||
mount_root
|
||||
boot_run_hook preinit_mount_root
|
||||
have_ro_ext4=$(/bin/cat /proc/mounts |/bin/grep ' / ext4'|/bin/grep 'ro'|/usr/bin/wc -l)
|
||||
if [ "$have_ro_ext4" != "0" ]; then
|
||||
/usr/bin/mount -o remount,rw,noatime /
|
||||
fi
|
||||
[ ! -f /etc/bench.log ] && touch /etc/bench.log
|
||||
[ -f /sysupgrade.tgz -o -f /tmp/sysupgrade.tar ] && {
|
||||
echo "- config restore -"
|
||||
cp /etc/passwd /etc/group /etc/shadow /tmp
|
||||
|
||||
@@ -65,16 +65,9 @@ _v() {
|
||||
[ -n "$VERBOSE" ] && [ "$VERBOSE" -ge 1 ] && echo "$*" >&2
|
||||
}
|
||||
|
||||
_vn() {
|
||||
[ -n "$VERBOSE" ] && [ "$VERBOSE" -ge 1 ] && echo -n "$*" >&2
|
||||
}
|
||||
|
||||
v() {
|
||||
_v "$(date) upgrade: $@"
|
||||
}
|
||||
|
||||
vn() {
|
||||
_vn "$(date) upgrade: $@"
|
||||
logger -p info -t upgrade "$@"
|
||||
}
|
||||
|
||||
json_string() {
|
||||
@@ -95,8 +88,7 @@ get_image() { # <source> [ <command> ]
|
||||
if [ -z "$cmd" ]; then
|
||||
local magic="$(dd if="$from" bs=2 count=1 2>/dev/null | hexdump -n 2 -e '1/1 "%02x"')"
|
||||
case "$magic" in
|
||||
1f8b) cmd="zcat";;
|
||||
425a) cmd="bzcat";;
|
||||
1f8b) cmd="busybox zcat";;
|
||||
*) cmd="cat";;
|
||||
esac
|
||||
fi
|
||||
@@ -135,6 +127,33 @@ get_magic_fat32() {
|
||||
(get_image "$@" | dd bs=1 count=5 skip=82) 2>/dev/null
|
||||
}
|
||||
|
||||
identify_magic_long() {
|
||||
local magic=$1
|
||||
case "$magic" in
|
||||
"55424923")
|
||||
echo "ubi"
|
||||
;;
|
||||
"31181006")
|
||||
echo "ubifs"
|
||||
;;
|
||||
"68737173")
|
||||
echo "squashfs"
|
||||
;;
|
||||
"d00dfeed")
|
||||
echo "fit"
|
||||
;;
|
||||
"4349"*)
|
||||
echo "combined"
|
||||
;;
|
||||
"1f8b"*)
|
||||
echo "gzip"
|
||||
;;
|
||||
*)
|
||||
echo "unknown $magic"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
part_magic_efi() {
|
||||
local magic=$(get_magic_gpt "$@")
|
||||
[ "$magic" = "EFI PART" ]
|
||||
@@ -146,6 +165,23 @@ part_magic_fat() {
|
||||
[ "$magic" = "FAT" ] || [ "$magic_fat32" = "FAT32" ]
|
||||
}
|
||||
|
||||
fitblk_get_bootdev() {
|
||||
[ -e /sys/firmware/devicetree/base/chosen/rootdisk ] || return
|
||||
|
||||
local rootdisk="$(cat /sys/firmware/devicetree/base/chosen/rootdisk)"
|
||||
local handle bootdev
|
||||
for handle in /sys/class/block/*/of_node/phandle /sys/class/block/*/device/of_node/phandle; do
|
||||
[ ! -e "$handle" ] && continue
|
||||
if [ "$rootdisk" = "$(cat $handle)" ]; then
|
||||
bootdev="${handle%/of_node/phandle}"
|
||||
bootdev="${bootdev%/device}"
|
||||
bootdev="${bootdev#/sys/class/block/}"
|
||||
echo "$bootdev"
|
||||
break
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
export_bootdevice() {
|
||||
local cmdline uuid blockdev uevent line class
|
||||
local MAJOR MINOR DEVNAME DEVTYPE
|
||||
@@ -163,9 +199,11 @@ export_bootdevice() {
|
||||
fi
|
||||
done
|
||||
;;
|
||||
PARTUUID=????????-????-????-????-??????????0?/PARTNROFF=1 | \
|
||||
PARTUUID=????????-????-????-????-??????????02)
|
||||
uuid="${rootpart#PARTUUID=}"
|
||||
uuid="${uuid%02}00"
|
||||
uuid="${uuid%/PARTNROFF=1}"
|
||||
uuid="${uuid%0?}00"
|
||||
for disk in $(find /dev -type b); do
|
||||
set -- $(dd if=$disk bs=1 skip=568 count=16 2>/dev/null | hexdump -v -e '8/1 "%02x "" "2/1 "%02x""-"6/1 "%02x"')
|
||||
if [ "$4$3$2$1-$6$5-$8$7-$9" = "$uuid" ]; then
|
||||
@@ -175,6 +213,7 @@ export_bootdevice() {
|
||||
done
|
||||
;;
|
||||
/dev/*)
|
||||
[ "$rootpart" = "/dev/fit0" ] && rootpart="$(fitblk_get_bootdev)"
|
||||
uevent="/sys/class/block/${rootpart##*/}/../uevent"
|
||||
;;
|
||||
0x[a-f0-9][a-f0-9][a-f0-9] | 0x[a-f0-9][a-f0-9][a-f0-9][a-f0-9] | \
|
||||
@@ -211,7 +250,7 @@ export_partdevice() {
|
||||
while read line; do
|
||||
export -n "$line"
|
||||
done < "$uevent"
|
||||
if [ $BOOTDEV_MAJOR = $MAJOR -a $(($BOOTDEV_MINOR + $offset)) = $MINOR -a -b "/dev/$DEVNAME" ]; then
|
||||
if [ "$BOOTDEV_MAJOR" = "$MAJOR" -a $(($BOOTDEV_MINOR + $offset)) = "$MINOR" -a -b "/dev/$DEVNAME" ]; then
|
||||
export "$var=$DEVNAME"
|
||||
return 0
|
||||
fi
|
||||
@@ -228,15 +267,6 @@ hex_le32_to_cpu() {
|
||||
echo "$@"
|
||||
}
|
||||
|
||||
get_partition_by_name() {
|
||||
for partname in /sys/class/block/$1/*/name; do
|
||||
[ "$(cat ${partname})" = "$2" ] && {
|
||||
basename ${partname%%/name}
|
||||
break
|
||||
}
|
||||
done
|
||||
}
|
||||
|
||||
get_partitions() { # <device> <filename>
|
||||
local disk="$1"
|
||||
local filename="$2"
|
||||
|
||||
@@ -19,8 +19,11 @@ emmc_upgrade_tar() {
|
||||
[ "$has_kernel" = 1 -a "$EMMC_KERN_DEV" ] &&
|
||||
export EMMC_KERNEL_BLOCKS=$(($(tar xf "$tar_file" ${board_dir}/kernel -O | dd of="$EMMC_KERN_DEV" bs=512 2>&1 | grep "records out" | cut -d' ' -f1)))
|
||||
|
||||
[ "$has_rootfs" = 1 -a "$EMMC_ROOT_DEV" ] &&
|
||||
[ "$has_rootfs" = 1 -a "$EMMC_ROOT_DEV" ] && {
|
||||
export EMMC_ROOTFS_BLOCKS=$(($(tar xf "$tar_file" ${board_dir}/root -O | dd of="$EMMC_ROOT_DEV" bs=512 2>&1 | grep "records out" | cut -d' ' -f1)))
|
||||
# Account for 64KiB ROOTDEV_OVERLAY_ALIGN in libfstools
|
||||
EMMC_ROOTFS_BLOCKS=$(((EMMC_ROOTFS_BLOCKS + 127) & ~127))
|
||||
}
|
||||
|
||||
if [ -z "$UPGRADE_BACKUP" ]; then
|
||||
if [ "$EMMC_DATA_DEV" ]; then
|
||||
|
||||
91
package/base-files/files/lib/upgrade/legacy-sdcard.sh
Normal file
91
package/base-files/files/lib/upgrade/legacy-sdcard.sh
Normal file
@@ -0,0 +1,91 @@
|
||||
legacy_sdcard_check_image() {
|
||||
local file="$1"
|
||||
local diskdev partdev diff
|
||||
|
||||
export_bootdevice && export_partdevice diskdev 0 || {
|
||||
v "Unable to determine upgrade device"
|
||||
return 1
|
||||
}
|
||||
|
||||
get_partitions "/dev/$diskdev" bootdisk
|
||||
|
||||
v "Extract boot sector from the image"
|
||||
get_image_dd "$1" of=/tmp/image.bs count=1 bs=512b
|
||||
|
||||
get_partitions /tmp/image.bs image
|
||||
|
||||
#compare tables
|
||||
diff="$(grep -F -x -v -f /tmp/partmap.bootdisk /tmp/partmap.image)"
|
||||
|
||||
rm -f /tmp/image.bs /tmp/partmap.bootdisk /tmp/partmap.image
|
||||
|
||||
if [ -n "$diff" ]; then
|
||||
v "Partition layout has changed. Full image will be written."
|
||||
ask_bool 0 "Abort" && exit 1
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
legacy_sdcard_do_upgrade() {
|
||||
local board=$(board_name)
|
||||
local diskdev partdev diff
|
||||
|
||||
export_bootdevice && export_partdevice diskdev 0 || {
|
||||
v "Unable to determine upgrade device"
|
||||
return 1
|
||||
}
|
||||
|
||||
sync
|
||||
|
||||
if [ "$UPGRADE_OPT_SAVE_PARTITIONS" = "1" ]; then
|
||||
get_partitions "/dev/$diskdev" bootdisk
|
||||
|
||||
v "Extract boot sector from the image"
|
||||
get_image_dd "$1" of=/tmp/image.bs count=1 bs=512b
|
||||
|
||||
get_partitions /tmp/image.bs image
|
||||
|
||||
#compare tables
|
||||
diff="$(grep -F -x -v -f /tmp/partmap.bootdisk /tmp/partmap.image)"
|
||||
else
|
||||
diff=1
|
||||
fi
|
||||
|
||||
if [ -n "$diff" ]; then
|
||||
get_image_dd "$1" of="/dev/$diskdev" bs=4096 conv=fsync
|
||||
|
||||
# Separate removal and addtion is necessary; otherwise, partition 1
|
||||
# will be missing if it overlaps with the old partition 2
|
||||
partx -d - "/dev/$diskdev"
|
||||
partx -a - "/dev/$diskdev"
|
||||
else
|
||||
v "Writing bootloader to /dev/$diskdev"
|
||||
get_image_dd "$1" of="$diskdev" bs=512 skip=1 seek=1 count=2048 conv=fsync
|
||||
#iterate over each partition from the image and write it to the boot disk
|
||||
while read part start size; do
|
||||
if export_partdevice partdev $part; then
|
||||
v "Writing image to /dev/$partdev..."
|
||||
get_image_dd "$1" of="/dev/$partdev" ibs="512" obs=1M skip="$start" count="$size" conv=fsync
|
||||
else
|
||||
v "Unable to find partition $part device, skipped."
|
||||
fi
|
||||
done < /tmp/partmap.image
|
||||
|
||||
v "Writing new UUID to /dev/$diskdev..."
|
||||
get_image_dd "$1" of="/dev/$diskdev" bs=1 skip=440 count=4 seek=440 conv=fsync
|
||||
fi
|
||||
|
||||
sleep 1
|
||||
}
|
||||
|
||||
legacy_sdcard_copy_config() {
|
||||
local partdev
|
||||
|
||||
if export_partdevice partdev 1; then
|
||||
mkdir -p /boot
|
||||
[ -f /boot/kernel.img ] || mount -o rw,noatime /dev/$partdev /boot
|
||||
cp -af "$UPGRADE_BACKUP" "/boot/$BACKUP_FILE"
|
||||
sync
|
||||
umount /boot
|
||||
fi
|
||||
}
|
||||
@@ -7,6 +7,8 @@
|
||||
CI_KERNPART="${CI_KERNPART:-kernel}"
|
||||
|
||||
# 'ubi' partition on NAND contains UBI
|
||||
# There are also CI_KERN_UBIPART and CI_ROOT_UBIPART if kernel
|
||||
# and rootfs are on separated UBIs.
|
||||
CI_UBIPART="${CI_UBIPART:-ubi}"
|
||||
|
||||
# 'rootfs' UBI volume on NAND contains the rootfs
|
||||
@@ -26,7 +28,7 @@ ubi_mknod() {
|
||||
|
||||
nand_find_volume() {
|
||||
local ubidevdir ubivoldir
|
||||
ubidevdir="/sys/devices/virtual/ubi/$1"
|
||||
ubidevdir="/sys/class/ubi/"
|
||||
[ ! -d "$ubidevdir" ] && return 1
|
||||
for ubivoldir in $ubidevdir/${1}_*; do
|
||||
[ ! -d "$ubivoldir" ] && continue
|
||||
@@ -39,13 +41,12 @@ nand_find_volume() {
|
||||
}
|
||||
|
||||
nand_find_ubi() {
|
||||
local ubidevdir ubidev mtdnum
|
||||
local ubidevdir ubidev mtdnum cmtdnum
|
||||
mtdnum="$( find_mtd_index $1 )"
|
||||
[ ! "$mtdnum" ] && return 1
|
||||
for ubidevdir in /sys/devices/virtual/ubi/ubi*; do
|
||||
[ ! -d "$ubidevdir" ] && continue
|
||||
for ubidevdir in /sys/class/ubi/ubi*; do
|
||||
[ ! -e "$ubidevdir/mtd_num" ] && continue
|
||||
cmtdnum="$( cat $ubidevdir/mtd_num )"
|
||||
[ ! "$mtdnum" ] && continue
|
||||
if [ "$mtdnum" = "$cmtdnum" ]; then
|
||||
ubidev=$( basename $ubidevdir )
|
||||
ubi_mknod "$ubidevdir"
|
||||
@@ -56,62 +57,125 @@ nand_find_ubi() {
|
||||
}
|
||||
|
||||
nand_get_magic_long() {
|
||||
dd if="$1" skip=$2 bs=4 count=1 2>/dev/null | hexdump -v -n 4 -e '1/1 "%02x"'
|
||||
(${3}cat "$1" | dd bs=4 "skip=${2:-0}" count=1 | hexdump -v -n 4 -e '1/1 "%02x"') 2> /dev/null
|
||||
}
|
||||
|
||||
get_magic_long_tar() {
|
||||
( tar xf $1 $2 -O | dd bs=4 count=1 | hexdump -v -n 4 -e '1/1 "%02x"') 2> /dev/null
|
||||
(tar xO${3}f "$1" "$2" | dd bs=4 count=1 | hexdump -v -n 4 -e '1/1 "%02x"') 2> /dev/null
|
||||
}
|
||||
|
||||
identify_magic() {
|
||||
local magic=$1
|
||||
case "$magic" in
|
||||
"55424923")
|
||||
echo "ubi"
|
||||
;;
|
||||
"31181006")
|
||||
echo "ubifs"
|
||||
;;
|
||||
"68737173")
|
||||
echo "squashfs"
|
||||
;;
|
||||
"d00dfeed")
|
||||
echo "fit"
|
||||
;;
|
||||
"4349"*)
|
||||
echo "combined"
|
||||
;;
|
||||
*)
|
||||
echo "unknown $magic"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
identify() {
|
||||
identify_magic $(nand_get_magic_long "$1" "${2:-0}")
|
||||
identify_magic_long $(nand_get_magic_long "$@")
|
||||
}
|
||||
|
||||
identify_tar() {
|
||||
identify_magic $(get_magic_long_tar "$1" "$2")
|
||||
identify_magic_long $(get_magic_long_tar "$@")
|
||||
}
|
||||
|
||||
identify_if_gzip() {
|
||||
if [ "$(identify "$1")" = gzip ]; then echo -n z; fi
|
||||
}
|
||||
|
||||
nand_restore_config() {
|
||||
sync
|
||||
local ubidev=$( nand_find_ubi $CI_UBIPART )
|
||||
local ubidev=$( nand_find_ubi "${CI_ROOT_UBIPART:-$CI_UBIPART}" )
|
||||
local ubivol="$( nand_find_volume $ubidev rootfs_data )"
|
||||
[ ! "$ubivol" ] &&
|
||||
ubivol="$( nand_find_volume $ubidev $CI_ROOTPART )"
|
||||
if [ ! "$ubivol" ]; then
|
||||
ubivol="$( nand_find_volume $ubidev "$CI_ROOTPART" )"
|
||||
if [ ! "$ubivol" ]; then
|
||||
echo "cannot find ubifs data volume"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
mkdir /tmp/new_root
|
||||
if ! mount -t ubifs /dev/$ubivol /tmp/new_root; then
|
||||
echo "mounting ubifs $ubivol failed"
|
||||
echo "cannot mount ubifs volume $ubivol"
|
||||
rmdir /tmp/new_root
|
||||
return 1
|
||||
fi
|
||||
mv "$1" "/tmp/new_root/$BACKUP_FILE"
|
||||
umount /tmp/new_root
|
||||
sync
|
||||
if mv "$1" "/tmp/new_root/$BACKUP_FILE"; then
|
||||
if umount /tmp/new_root; then
|
||||
echo "configuration saved"
|
||||
rmdir /tmp/new_root
|
||||
return 0
|
||||
fi
|
||||
else
|
||||
umount /tmp/new_root
|
||||
fi
|
||||
echo "could not save configuration to ubifs volume $ubivol"
|
||||
rmdir /tmp/new_root
|
||||
return 1
|
||||
}
|
||||
|
||||
nand_remove_ubiblock() {
|
||||
local ubivol="$1"
|
||||
|
||||
local ubiblk="ubiblock${ubivol:3}"
|
||||
if [ -e "/dev/$ubiblk" ]; then
|
||||
umount "/dev/$ubiblk" 2>/dev/null && echo "unmounted /dev/$ubiblk" || :
|
||||
if ! ubiblock -r "/dev/$ubivol"; then
|
||||
echo "cannot remove $ubiblk"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
nand_attach_ubi() {
|
||||
local ubipart="$1"
|
||||
local has_env="${2:-0}"
|
||||
|
||||
local mtdnum="$( find_mtd_index "$ubipart" )"
|
||||
if [ ! "$mtdnum" ]; then
|
||||
>&2 echo "cannot find ubi mtd partition $ubipart"
|
||||
return 1
|
||||
fi
|
||||
|
||||
local ubidev="$( nand_find_ubi "$ubipart" )"
|
||||
if [ ! "$ubidev" ]; then
|
||||
>&2 ubiattach -m "$mtdnum"
|
||||
ubidev="$( nand_find_ubi "$ubipart" )"
|
||||
|
||||
if [ ! "$ubidev" ]; then
|
||||
>&2 ubiformat /dev/mtd$mtdnum -y
|
||||
>&2 ubiattach -m "$mtdnum"
|
||||
ubidev="$( nand_find_ubi "$ubipart" )"
|
||||
|
||||
if [ ! "$ubidev" ]; then
|
||||
>&2 echo "cannot attach ubi mtd partition $ubipart"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ "$has_env" -gt 0 ]; then
|
||||
>&2 ubimkvol /dev/$ubidev -n 0 -N ubootenv -s 1MiB
|
||||
>&2 ubimkvol /dev/$ubidev -n 1 -N ubootenv2 -s 1MiB
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "$ubidev"
|
||||
return 0
|
||||
}
|
||||
|
||||
nand_detach_ubi() {
|
||||
local ubipart="$1"
|
||||
|
||||
local mtdnum="$( find_mtd_index "$ubipart" )"
|
||||
if [ ! "$mtdnum" ]; then
|
||||
echo "cannot find ubi mtd partition $ubipart"
|
||||
return 1
|
||||
fi
|
||||
|
||||
local ubidev="$( nand_find_ubi "$ubipart" )"
|
||||
if [ "$ubidev" ]; then
|
||||
for ubivol in $(find /dev -name "${ubidev}_*" -maxdepth 1 | sort); do
|
||||
ubivol="${ubivol:5}"
|
||||
nand_remove_ubiblock "$ubivol" || :
|
||||
umount "/dev/$ubivol" && echo "unmounted /dev/$ubivol" || :
|
||||
done
|
||||
if ! ubidetach -m "$mtdnum"; then
|
||||
echo "cannot detach ubi mtd partition $ubipart"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
nand_upgrade_prepare_ubi() {
|
||||
@@ -122,62 +186,46 @@ nand_upgrade_prepare_ubi() {
|
||||
|
||||
local kernel_length="$3"
|
||||
local has_env="${4:-0}"
|
||||
local kern_ubidev
|
||||
local root_ubidev
|
||||
|
||||
[ -n "$rootfs_length" -o -n "$kernel_length" ] || return 1
|
||||
|
||||
local mtdnum="$( find_mtd_index "$CI_UBIPART" )"
|
||||
if [ ! "$mtdnum" ]; then
|
||||
echo "cannot find ubi mtd partition $CI_UBIPART"
|
||||
return 1
|
||||
if [ -n "$CI_KERN_UBIPART" -a -n "$CI_ROOT_UBIPART" ]; then
|
||||
kern_ubidev="$( nand_attach_ubi "$CI_KERN_UBIPART" "$has_env" )"
|
||||
[ -n "$kern_ubidev" ] || return 1
|
||||
root_ubidev="$( nand_attach_ubi "$CI_ROOT_UBIPART" )"
|
||||
[ -n "$root_ubidev" ] || return 1
|
||||
else
|
||||
kern_ubidev="$( nand_attach_ubi "$CI_UBIPART" "$has_env" )"
|
||||
[ -n "$kern_ubidev" ] || return 1
|
||||
root_ubidev="$kern_ubidev"
|
||||
fi
|
||||
|
||||
local ubidev="$( nand_find_ubi "$CI_UBIPART" )"
|
||||
if [ ! "$ubidev" ]; then
|
||||
ubiattach -m "$mtdnum"
|
||||
sync
|
||||
ubidev="$( nand_find_ubi "$CI_UBIPART" )"
|
||||
fi
|
||||
local kern_ubivol="$( nand_find_volume $kern_ubidev "$CI_KERNPART" )"
|
||||
local root_ubivol="$( nand_find_volume $root_ubidev "$CI_ROOTPART" )"
|
||||
local data_ubivol="$( nand_find_volume $root_ubidev rootfs_data )"
|
||||
[ "$root_ubivol" = "$kern_ubivol" ] && root_ubivol=
|
||||
|
||||
if [ ! "$ubidev" ]; then
|
||||
ubiformat /dev/mtd$mtdnum -y
|
||||
ubiattach -m "$mtdnum"
|
||||
sync
|
||||
ubidev="$( nand_find_ubi "$CI_UBIPART" )"
|
||||
[ "$has_env" -gt 0 ] && {
|
||||
ubimkvol /dev/$ubidev -n 0 -N ubootenv -s 1MiB
|
||||
ubimkvol /dev/$ubidev -n 1 -N ubootenv2 -s 1MiB
|
||||
}
|
||||
fi
|
||||
|
||||
local kern_ubivol="$( nand_find_volume $ubidev $CI_KERNPART )"
|
||||
local root_ubivol="$( nand_find_volume $ubidev $CI_ROOTPART )"
|
||||
local data_ubivol="$( nand_find_volume $ubidev rootfs_data )"
|
||||
|
||||
local ubiblk ubiblkvol
|
||||
for ubiblk in /dev/ubiblock*_? ; do
|
||||
[ -e "$ubiblk" ] || continue
|
||||
echo "removing ubiblock${ubiblk:13}"
|
||||
ubiblkvol=ubi${ubiblk:13}
|
||||
if ! ubiblock -r /dev/$ubiblkvol; then
|
||||
echo "cannot remove $ubiblk"
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
# remove ubiblocks
|
||||
[ "$kern_ubivol" ] && { nand_remove_ubiblock $kern_ubivol || return 1; }
|
||||
[ "$root_ubivol" ] && { nand_remove_ubiblock $root_ubivol || return 1; }
|
||||
[ "$data_ubivol" ] && { nand_remove_ubiblock $data_ubivol || return 1; }
|
||||
|
||||
# kill volumes
|
||||
[ "$kern_ubivol" ] && ubirmvol /dev/$ubidev -N $CI_KERNPART || true
|
||||
[ "$root_ubivol" -a "$root_ubivol" != "$kern_ubivol" ] && ubirmvol /dev/$ubidev -N $CI_ROOTPART || true
|
||||
[ "$data_ubivol" ] && ubirmvol /dev/$ubidev -N rootfs_data || true
|
||||
[ "$kern_ubivol" ] && ubirmvol /dev/$kern_ubidev -N "$CI_KERNPART" || :
|
||||
[ "$root_ubivol" ] && ubirmvol /dev/$root_ubidev -N "$CI_ROOTPART" || :
|
||||
[ "$data_ubivol" ] && ubirmvol /dev/$root_ubidev -N rootfs_data || :
|
||||
|
||||
# update kernel
|
||||
# create kernel vol
|
||||
if [ -n "$kernel_length" ]; then
|
||||
if ! ubimkvol /dev/$ubidev -N $CI_KERNPART -s $kernel_length; then
|
||||
if ! ubimkvol /dev/$kern_ubidev -N "$CI_KERNPART" -s $kernel_length; then
|
||||
echo "cannot create kernel volume"
|
||||
return 1;
|
||||
fi
|
||||
fi
|
||||
|
||||
# update rootfs
|
||||
# create rootfs vol
|
||||
if [ -n "$rootfs_length" ]; then
|
||||
local rootfs_size_param
|
||||
if [ "$rootfs_type" = "ubifs" ]; then
|
||||
@@ -185,157 +233,224 @@ nand_upgrade_prepare_ubi() {
|
||||
else
|
||||
rootfs_size_param="-s $rootfs_length"
|
||||
fi
|
||||
if ! ubimkvol /dev/$ubidev -N $CI_ROOTPART $rootfs_size_param; then
|
||||
if ! ubimkvol /dev/$root_ubidev -N "$CI_ROOTPART" $rootfs_size_param; then
|
||||
echo "cannot create rootfs volume"
|
||||
return 1;
|
||||
fi
|
||||
fi
|
||||
|
||||
# create rootfs_data for non-ubifs rootfs
|
||||
# create rootfs_data vol for non-ubifs rootfs
|
||||
if [ "$rootfs_type" != "ubifs" ]; then
|
||||
local availeb=$(cat /sys/devices/virtual/ubi/$ubidev/avail_eraseblocks)
|
||||
local ebsize=$(cat /sys/devices/virtual/ubi/$ubidev/eraseblock_size)
|
||||
local avail_size=$((availeb * ebsize))
|
||||
local rootfs_data_size_param="-m"
|
||||
if [ -n "$rootfs_data_max" ] &&
|
||||
[ "$rootfs_data_max" != "0" ] &&
|
||||
[ "$rootfs_data_max" -le "$avail_size" ]; then
|
||||
if [ -n "$rootfs_data_max" ]; then
|
||||
rootfs_data_size_param="-s $rootfs_data_max"
|
||||
fi
|
||||
if ! ubimkvol /dev/$ubidev -N rootfs_data $rootfs_data_size_param; then
|
||||
if ! ubimkvol /dev/$root_ubidev -N rootfs_data $rootfs_data_size_param; then
|
||||
if ! ubimkvol /dev/$root_ubidev -N rootfs_data -m; then
|
||||
echo "cannot initialize rootfs_data volume"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
sync
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
nand_do_upgrade_success() {
|
||||
local conf_tar="/tmp/sysupgrade.tgz"
|
||||
|
||||
sync
|
||||
[ -f "$conf_tar" ] && nand_restore_config "$conf_tar"
|
||||
echo "sysupgrade successful"
|
||||
umount -a
|
||||
reboot -f
|
||||
}
|
||||
|
||||
# Flash the UBI image to MTD partition
|
||||
# Write the UBI image to MTD ubi partition
|
||||
nand_upgrade_ubinized() {
|
||||
local ubi_file="$1"
|
||||
local gz="$2"
|
||||
|
||||
local ubi_length=$( (${gz}cat "$ubi_file" | wc -c) 2> /dev/null)
|
||||
|
||||
nand_detach_ubi "$CI_UBIPART" || return 1
|
||||
|
||||
local mtdnum="$( find_mtd_index "$CI_UBIPART" )"
|
||||
|
||||
[ ! "$mtdnum" ] && {
|
||||
CI_UBIPART="rootfs"
|
||||
mtdnum="$(find_mtd_index "$CI_UBIPART")"
|
||||
${gz}cat "$ubi_file" | ubiformat "/dev/mtd$mtdnum" -S "$ubi_length" -y -f - && ubiattach -m "$mtdnum"
|
||||
}
|
||||
|
||||
if [ ! "$mtdnum" ]; then
|
||||
echo "cannot find mtd device $CI_UBIPART"
|
||||
umount -a
|
||||
reboot -f
|
||||
fi
|
||||
|
||||
local mtddev="/dev/mtd${mtdnum}"
|
||||
ubidetach -p "${mtddev}" || true
|
||||
sync
|
||||
ubiformat "${mtddev}" -y -f "${ubi_file}"
|
||||
ubiattach -p "${mtddev}"
|
||||
nand_do_upgrade_success
|
||||
}
|
||||
|
||||
# Write the UBIFS image to UBI volume
|
||||
# Write the UBIFS image to UBI rootfs volume
|
||||
nand_upgrade_ubifs() {
|
||||
local rootfs_length=$( (cat $1 | wc -c) 2> /dev/null)
|
||||
local ubifs_file="$1"
|
||||
local gz="$2"
|
||||
|
||||
nand_upgrade_prepare_ubi "$rootfs_length" "ubifs" "" ""
|
||||
local ubifs_length=$( (${gz}cat "$ubifs_file" | wc -c) 2> /dev/null)
|
||||
|
||||
nand_upgrade_prepare_ubi "$ubifs_length" "ubifs" "" "" || return 1
|
||||
|
||||
local ubidev="$( nand_find_ubi "$CI_UBIPART" )"
|
||||
local root_ubivol="$(nand_find_volume $ubidev $CI_ROOTPART)"
|
||||
ubiupdatevol /dev/$root_ubivol -s $rootfs_length $1
|
||||
|
||||
nand_do_upgrade_success
|
||||
local root_ubivol="$(nand_find_volume $ubidev "$CI_ROOTPART")"
|
||||
${gz}cat "$ubifs_file" | ubiupdatevol /dev/$root_ubivol -s "$ubifs_length" -
|
||||
}
|
||||
|
||||
# Write the FIT image to UBI kernel volume
|
||||
nand_upgrade_fit() {
|
||||
local fit_file="$1"
|
||||
local fit_length="$(wc -c < "$fit_file")"
|
||||
local gz="$2"
|
||||
|
||||
nand_upgrade_prepare_ubi "" "" "$fit_length" "1"
|
||||
local fit_length=$( (${gz}cat "$fit_file" | wc -c) 2> /dev/null)
|
||||
|
||||
nand_upgrade_prepare_ubi "" "" "$fit_length" "1" || return 1
|
||||
|
||||
local fit_ubidev="$(nand_find_ubi "$CI_UBIPART")"
|
||||
local fit_ubivol="$(nand_find_volume $fit_ubidev "$CI_KERNPART")"
|
||||
ubiupdatevol /dev/$fit_ubivol -s $fit_length $fit_file
|
||||
|
||||
nand_do_upgrade_success
|
||||
${gz}cat "$fit_file" | ubiupdatevol /dev/$fit_ubivol -s "$fit_length" -
|
||||
}
|
||||
|
||||
# Write images in the TAR file to MTD partitions and/or UBI volumes as required
|
||||
nand_upgrade_tar() {
|
||||
local tar_file="$1"
|
||||
local kernel_mtd="$(find_mtd_index $CI_KERNPART)"
|
||||
local gz="$2"
|
||||
local jffs2_markers="${CI_JFFS2_CLEAN_MARKERS:-0}"
|
||||
|
||||
local board_dir=$(tar tf "$tar_file" | grep -m 1 '^sysupgrade-.*/$')
|
||||
board_dir=${board_dir%/}
|
||||
# WARNING: This fails if tar contains more than one 'sysupgrade-*' directory.
|
||||
local board_dir="$(tar t${gz}f "$tar_file" | grep -m 1 '^sysupgrade-.*/$')"
|
||||
board_dir="${board_dir%/}"
|
||||
|
||||
kernel_length=$( (tar xf "$tar_file" ${board_dir}/kernel -O | wc -c) 2> /dev/null)
|
||||
local has_rootfs=0
|
||||
local rootfs_length
|
||||
local kernel_mtd kernel_length
|
||||
if [ "$CI_KERNPART" != "none" ]; then
|
||||
kernel_mtd="$(find_mtd_index "$CI_KERNPART")"
|
||||
kernel_length=$( (tar xO${gz}f "$tar_file" "$board_dir/kernel" | wc -c) 2> /dev/null)
|
||||
[ "$kernel_length" = 0 ] && kernel_length=
|
||||
fi
|
||||
local rootfs_length=$( (tar xO${gz}f "$tar_file" "$board_dir/root" | wc -c) 2> /dev/null)
|
||||
[ "$rootfs_length" = 0 ] && rootfs_length=
|
||||
local rootfs_type
|
||||
[ "$rootfs_length" ] && rootfs_type="$(identify_tar "$tar_file" "$board_dir/root" "$gz")"
|
||||
|
||||
tar tf "$tar_file" ${board_dir}/root 1>/dev/null 2>/dev/null && has_rootfs=1
|
||||
[ "$has_rootfs" = "1" ] && {
|
||||
rootfs_length=$( (tar xf "$tar_file" ${board_dir}/root -O | wc -c) 2> /dev/null)
|
||||
rootfs_type="$(identify_tar "$tar_file" ${board_dir}/root)"
|
||||
}
|
||||
local ubi_kernel_length
|
||||
if [ "$kernel_length" ]; then
|
||||
if [ "$kernel_mtd" ]; then
|
||||
# On some devices, the raw kernel and ubi partitions overlap.
|
||||
# These devices brick if the kernel partition is erased.
|
||||
# Hence only invalidate kernel for now.
|
||||
dd if=/dev/zero bs=4096 count=1 2> /dev/null | \
|
||||
mtd write - "$CI_KERNPART"
|
||||
else
|
||||
ubi_kernel_length="$kernel_length"
|
||||
fi
|
||||
fi
|
||||
|
||||
local has_kernel=1
|
||||
local has_env=0
|
||||
nand_upgrade_prepare_ubi "$rootfs_length" "$rootfs_type" "$ubi_kernel_length" "$has_env" || return 1
|
||||
|
||||
[ "$kernel_length" != 0 -a -n "$kernel_mtd" ] && {
|
||||
tar xf "$tar_file" ${board_dir}/kernel -O | mtd write - $CI_KERNPART
|
||||
}
|
||||
[ "$kernel_length" = 0 -o ! -z "$kernel_mtd" ] && has_kernel=
|
||||
if [ "$rootfs_length" ]; then
|
||||
local ubidev="$( nand_find_ubi "${CI_ROOT_UBIPART:-$CI_UBIPART}" )"
|
||||
local root_ubivol="$( nand_find_volume $ubidev "$CI_ROOTPART" )"
|
||||
tar xO${gz}f "$tar_file" "$board_dir/root" | \
|
||||
ubiupdatevol /dev/$root_ubivol -s "$rootfs_length" -
|
||||
fi
|
||||
if [ "$kernel_length" ]; then
|
||||
if [ "$kernel_mtd" ]; then
|
||||
if [ "$jffs2_markers" = 1 ]; then
|
||||
flash_erase -j "/dev/mtd${kernel_mtd}" 0 0
|
||||
tar xO${gz}f "$tar_file" "$board_dir/kernel" | \
|
||||
nandwrite "/dev/mtd${kernel_mtd}" -
|
||||
else
|
||||
tar xO${gz}f "$tar_file" "$board_dir/kernel" | \
|
||||
mtd write - "$CI_KERNPART"
|
||||
fi
|
||||
else
|
||||
local ubidev="$( nand_find_ubi "${CI_KERN_UBIPART:-$CI_UBIPART}" )"
|
||||
local kern_ubivol="$( nand_find_volume $ubidev "$CI_KERNPART" )"
|
||||
tar xO${gz}f "$tar_file" "$board_dir/kernel" | \
|
||||
ubiupdatevol /dev/$kern_ubivol -s "$kernel_length" -
|
||||
fi
|
||||
fi
|
||||
|
||||
nand_upgrade_prepare_ubi "$rootfs_length" "$rootfs_type" "${has_kernel:+$kernel_length}" "$has_env"
|
||||
|
||||
local ubidev="$( nand_find_ubi "$CI_UBIPART" )"
|
||||
[ "$has_kernel" = "1" ] && {
|
||||
local kern_ubivol="$( nand_find_volume $ubidev $CI_KERNPART )"
|
||||
tar xf "$tar_file" ${board_dir}/kernel -O | \
|
||||
ubiupdatevol /dev/$kern_ubivol -s $kernel_length -
|
||||
return 0
|
||||
}
|
||||
|
||||
[ "$has_rootfs" = "1" ] && {
|
||||
local root_ubivol="$( nand_find_volume $ubidev $CI_ROOTPART )"
|
||||
tar xf "$tar_file" ${board_dir}/root -O | \
|
||||
ubiupdatevol /dev/$root_ubivol -s $rootfs_length -
|
||||
nand_verify_if_gzip_file() {
|
||||
local file="$1"
|
||||
local gz="$2"
|
||||
|
||||
if [ "$gz" = z ]; then
|
||||
echo "verifying compressed sysupgrade file integrity"
|
||||
if ! gzip -t "$file"; then
|
||||
echo "corrupted compressed sysupgrade file"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
nand_do_upgrade_success
|
||||
|
||||
nand_verify_tar_file() {
|
||||
local file="$1"
|
||||
local gz="$2"
|
||||
|
||||
echo "verifying sysupgrade tar file integrity"
|
||||
if ! tar xO${gz}f "$file" > /dev/null; then
|
||||
echo "corrupted sysupgrade tar file"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
nand_do_flash_file() {
|
||||
local file="$1"
|
||||
|
||||
local gz="$(identify_if_gzip "$file")"
|
||||
local file_type="$(identify "$file" "" "$gz")"
|
||||
|
||||
[ ! "$(find_mtd_index "$CI_UBIPART")" ] && CI_UBIPART=rootfs
|
||||
|
||||
case "$file_type" in
|
||||
"fit")
|
||||
nand_verify_if_gzip_file "$file" "$gz" || return 1
|
||||
nand_upgrade_fit "$file" "$gz"
|
||||
;;
|
||||
"ubi")
|
||||
nand_verify_if_gzip_file "$file" "$gz" || return 1
|
||||
nand_upgrade_ubinized "$file" "$gz"
|
||||
;;
|
||||
"ubifs")
|
||||
nand_verify_if_gzip_file "$file" "$gz" || return 1
|
||||
nand_upgrade_ubifs "$file" "$gz"
|
||||
;;
|
||||
*)
|
||||
nand_verify_tar_file "$file" "$gz" || return 1
|
||||
nand_upgrade_tar "$file" "$gz"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
nand_do_restore_config() {
|
||||
local conf_tar="/tmp/sysupgrade.tgz"
|
||||
[ ! -f "$conf_tar" ] || nand_restore_config "$conf_tar"
|
||||
}
|
||||
|
||||
# Recognize type of passed file and start the upgrade process
|
||||
nand_do_upgrade() {
|
||||
local file_type=$(identify $1)
|
||||
local file="$1"
|
||||
|
||||
[ ! "$(find_mtd_index "$CI_UBIPART")" ] && CI_UBIPART="rootfs"
|
||||
|
||||
case "$file_type" in
|
||||
"fit") nand_upgrade_fit $1;;
|
||||
"ubi") nand_upgrade_ubinized $1;;
|
||||
"ubifs") nand_upgrade_ubifs $1;;
|
||||
*) nand_upgrade_tar $1;;
|
||||
esac
|
||||
sync
|
||||
nand_do_flash_file "$file" && nand_do_upgrade_success
|
||||
nand_do_upgrade_failed
|
||||
}
|
||||
|
||||
# Check if passed file is a valid one for NAND sysupgrade. Currently it accepts
|
||||
# 3 types of files:
|
||||
# 1) UBI - should contain an ubinized image, header is checked for the proper
|
||||
# MAGIC
|
||||
# 2) UBIFS - should contain UBIFS partition that will replace "rootfs" volume,
|
||||
# header is checked for the proper MAGIC
|
||||
# 3) TAR - archive has to include "sysupgrade-BOARD" directory with a non-empty
|
||||
# "CONTROL" file (at this point its content isn't verified)
|
||||
nand_do_upgrade_success() {
|
||||
if nand_do_restore_config && sync; then
|
||||
echo "sysupgrade successful"
|
||||
umount -a
|
||||
reboot -f
|
||||
fi
|
||||
nand_do_upgrade_failed
|
||||
}
|
||||
|
||||
nand_do_upgrade_failed() {
|
||||
sync
|
||||
echo "sysupgrade failed"
|
||||
# Should we reboot or bring up some failsafe mode instead?
|
||||
umount -a
|
||||
reboot -f
|
||||
}
|
||||
|
||||
# Check if passed file is a valid one for NAND sysupgrade.
|
||||
# Currently it accepts 4 types of files:
|
||||
# 1) UBI: a ubinized image containing required UBI volumes.
|
||||
# 2) UBIFS: a UBIFS rootfs volume image.
|
||||
# 3) FIT: a FIT image containing kernel and rootfs.
|
||||
# 4) TAR: an archive that includes directory "sysupgrade-${BOARD_NAME}" containing
|
||||
# a non-empty "CONTROL" file and required partition and/or volume images.
|
||||
#
|
||||
# You usually want to call this function in platform_check_image.
|
||||
#
|
||||
@@ -343,14 +458,25 @@ nand_do_upgrade() {
|
||||
# $(2): file to be checked
|
||||
nand_do_platform_check() {
|
||||
local board_name="$1"
|
||||
local tar_file="$2"
|
||||
local control_length=$( (tar xf $tar_file sysupgrade-$board_name/CONTROL -O | wc -c) 2> /dev/null)
|
||||
local file_type="$(identify $2)"
|
||||
local file="$2"
|
||||
|
||||
[ "$control_length" = 0 -a "$file_type" != "ubi" -a "$file_type" != "ubifs" -a "$file_type" != "fit" ] && {
|
||||
echo "Invalid sysupgrade file."
|
||||
local gz="$(identify_if_gzip "$file")"
|
||||
local file_type="$(identify "$file" "" "$gz")"
|
||||
local control_length=$( (tar xO${gz}f "$file" "sysupgrade-${board_name//,/_}/CONTROL" | wc -c) 2> /dev/null)
|
||||
|
||||
if [ "$control_length" = 0 ]; then
|
||||
control_length=$( (tar xO${gz}f "$file" "sysupgrade-${board_name//_/,}/CONTROL" | wc -c) 2> /dev/null)
|
||||
fi
|
||||
|
||||
if [ "$control_length" != 0 ]; then
|
||||
nand_verify_tar_file "$file" "$gz" || return 1
|
||||
else
|
||||
nand_verify_if_gzip_file "$file" "$gz" || return 1
|
||||
if [ "$file_type" != "fit" -a "$file_type" != "ubi" -a "$file_type" != "ubifs" ]; then
|
||||
echo "invalid sysupgrade file"
|
||||
return 1
|
||||
}
|
||||
fi
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -45,7 +45,8 @@ switch_to_ramfs() {
|
||||
mtd partx losetup mkfs.ext4 nandwrite flash_erase \
|
||||
ubiupdatevol ubiattach ubiblock ubiformat \
|
||||
ubidetach ubirsvol ubirmvol ubimkvol \
|
||||
snapshot snapshot_tool date \
|
||||
snapshot snapshot_tool date logger \
|
||||
/usr/sbin/fw_printenv /usr/bin/fwtool \
|
||||
$RAMFS_COPY_LOSETUP $RAMFS_COPY_LVM \
|
||||
$RAMFS_COPY_BIN
|
||||
do
|
||||
@@ -85,7 +86,7 @@ kill_remaining() { # [ <signal> [ <loop> ] ]
|
||||
local stat
|
||||
local proc_ppid=$(cut -d' ' -f4 /proc/$$/stat)
|
||||
|
||||
vn "Sending $sig to remaining processes ..."
|
||||
v "Sending $sig to remaining processes ..."
|
||||
|
||||
while $run; do
|
||||
run=false
|
||||
@@ -105,7 +106,7 @@ kill_remaining() { # [ <signal> [ <loop> ] ]
|
||||
# Skip kernel threads
|
||||
[ -n "$cmdline" ] || continue
|
||||
|
||||
_vn " $name"
|
||||
v "Sending signal $sig to $name ($pid)"
|
||||
kill -$sig $pid 2>/dev/null
|
||||
|
||||
[ $loop -eq 1 ] && run=true
|
||||
@@ -113,12 +114,10 @@ kill_remaining() { # [ <signal> [ <loop> ] ]
|
||||
|
||||
let loop_limit--
|
||||
[ $loop_limit -eq 0 ] && {
|
||||
_v
|
||||
v "Failed to kill all processes."
|
||||
exit 1
|
||||
}
|
||||
done
|
||||
_v
|
||||
}
|
||||
|
||||
indicate_upgrade
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
usage() {
|
||||
cat <<EOF
|
||||
Usage: $0 [config|up|down|reconf|reload|status|isup]
|
||||
Usage: $0 [config|up|down|reconf|reload|status]
|
||||
enables (default), disables or configures devices not yet configured.
|
||||
EOF
|
||||
exit 1
|
||||
@@ -17,24 +17,8 @@ ubus_wifi_cmd() {
|
||||
local dev="$2"
|
||||
|
||||
json_init
|
||||
[ -n "$dev" ] && json_add_string device "$dev"
|
||||
ubus call network.wireless "$cmd" "$(json_dump)"
|
||||
}
|
||||
|
||||
wifi_isup() {
|
||||
local dev="$1"
|
||||
|
||||
json_load "$(ubus_wifi_cmd "status" "$dev")"
|
||||
json_get_keys devices
|
||||
|
||||
for device in $devices; do
|
||||
json_select "$device"
|
||||
json_get_var up up
|
||||
[ $up -eq 0 ] && return 1
|
||||
json_select ..
|
||||
done
|
||||
|
||||
return 0
|
||||
[ -n "$2" ] && json_add_string device "$2"
|
||||
ubus call network.wireless "$1" "$(json_dump)"
|
||||
}
|
||||
|
||||
find_net_config() {(
|
||||
@@ -261,7 +245,6 @@ case "$1" in
|
||||
detect) wifi_detect_notice ;;
|
||||
config) wifi_config ;;
|
||||
status) ubus_wifi_cmd "status" "$2";;
|
||||
isup) wifi_isup "$2"; exit $?;;
|
||||
reload) wifi_reload "$2";;
|
||||
reload_legacy) wifi_reload_legacy "$2";;
|
||||
--help|help) usage;;
|
||||
|
||||
@@ -5,6 +5,13 @@
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
config TARGET_DEFAULT_LAN_IP_FROM_PREINIT
|
||||
bool "Use preinit IP configuration as default LAN IP" if IMAGEOPT
|
||||
default n
|
||||
help
|
||||
Enabling this will set the default LAN IP address and netmask
|
||||
to the preinit values set in the image config.
|
||||
|
||||
menuconfig PREINITOPT
|
||||
bool "Preinit configuration options" if IMAGEOPT
|
||||
default n
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#
|
||||
# Copyright (C) 2017 Hauke Mehrtens
|
||||
# Copyright (C) 2021 Daniel Golle
|
||||
# Copyright (C) 2021-2023 Daniel Golle
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
@@ -9,96 +9,487 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=arm-trusted-firmware-mediatek
|
||||
PKG_RELEASE:=$(AUTORELEASE)
|
||||
PKG_RELEASE:=2
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL=https://github.com/mtk-openwrt/arm-trusted-firmware.git
|
||||
PKG_SOURCE_DATE:=2021-05-08
|
||||
PKG_SOURCE_VERSION:=d2c75b2139be003887af9cc5a94da5e9bdc59de7
|
||||
PKG_MIRROR_HASH:=4af9ce8e11511afee7f588cc982946c06339edbfa47afef6a7f3e2231ac9f34d
|
||||
PKG_SOURCE_DATE:=2024-01-17
|
||||
PKG_SOURCE_VERSION:=bacca82a8cac369470df052a9d801a0ceb9b74ca
|
||||
PKG_MIRROR_HASH:=d035c1b63a9bd71d752c90540361b66d290e7cf42dcca73259d0950af3569c79
|
||||
|
||||
PKG_MAINTAINER:=Daniel Golle <daniel@makrotopia.org>
|
||||
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
include $(INCLUDE_DIR)/trusted-firmware-a.mk
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Trusted-Firmware-A/Default
|
||||
BUILD_TARGET:=mediatek
|
||||
BUILD_SUBTARGET:=mt7622
|
||||
PLAT:=mt7622
|
||||
TFA_IMAGE:=bl2.img bl31.bin
|
||||
BOOT_DEVICE:=
|
||||
DDR3_FLYBY:=
|
||||
DDR_TYPE:=
|
||||
NAND_TYPE:=
|
||||
BOARD_QFN:=
|
||||
DRAM_USE_COMB:=
|
||||
USE_UBI:=
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7622-nor-1ddr
|
||||
NAME:=MediaTek MT7622 (SPI-NOR, 1x DDR3)
|
||||
BUILD_SUBTARGET:=mt7622
|
||||
PLAT:=mt7622
|
||||
BOOT_DEVICE:=nor
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7622-nor-2ddr
|
||||
NAME:=MediaTek MT7622 (SPI-NOR, 2x DDR3)
|
||||
BUILD_SUBTARGET:=mt7622
|
||||
PLAT:=mt7622
|
||||
BOOT_DEVICE:=nor
|
||||
DDR3_FLYBY:=1
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7622-snand-1ddr
|
||||
NAME:=MediaTek MT7622 (SPI-NAND, 1x DDR3)
|
||||
BUILD_SUBTARGET:=mt7622
|
||||
PLAT:=mt7622
|
||||
BOOT_DEVICE:=snand
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7622-snand-ubi-1ddr
|
||||
NAME:=MediaTek MT7622 (SPI-NAND using UBI, 1x DDR3)
|
||||
BUILD_SUBTARGET:=mt7622
|
||||
PLAT:=mt7622
|
||||
BOOT_DEVICE:=snand
|
||||
USE_UBI:=1
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7622-snand-2ddr
|
||||
NAME:=MediaTek MT7622 (SPI-NAND, 2x DDR3)
|
||||
BUILD_SUBTARGET:=mt7622
|
||||
PLAT:=mt7622
|
||||
BOOT_DEVICE:=snand
|
||||
DDR3_FLYBY:=1
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7622-snand-ubi-2ddr
|
||||
NAME:=MediaTek MT7622 (SPI-NAND using UBI, 2x DDR3)
|
||||
BUILD_SUBTARGET:=mt7622
|
||||
PLAT:=mt7622
|
||||
BOOT_DEVICE:=snand
|
||||
DDR3_FLYBY:=1
|
||||
USE_UBI:=1
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7622-emmc-1ddr
|
||||
NAME:=MediaTek MT7622 (eMMC, 1x DDR3)
|
||||
BUILD_SUBTARGET:=mt7622
|
||||
PLAT:=mt7622
|
||||
BOOT_DEVICE:=emmc
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7622-emmc-2ddr
|
||||
NAME:=MediaTek MT7622 (eMMC, 2x DDR3)
|
||||
BUILD_SUBTARGET:=mt7622
|
||||
PLAT:=mt7622
|
||||
BOOT_DEVICE:=emmc
|
||||
DDR3_FLYBY:=1
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7622-sdmmc-1ddr
|
||||
NAME:=MediaTek MT7622 (SD card, 1x DDR3)
|
||||
BUILD_SUBTARGET:=mt7622
|
||||
PLAT:=mt7622
|
||||
BOOT_DEVICE:=sdmmc
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7622-sdmmc-2ddr
|
||||
NAME:=MediaTek MT7622 (SD card, 2x DDR3)
|
||||
BUILD_SUBTARGET:=mt7622
|
||||
PLAT:=mt7622
|
||||
BOOT_DEVICE:=sdmmc
|
||||
DDR3_FLYBY:=1
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7981-nor-ddr4
|
||||
NAME:=MediaTek MT7981 (SPI-NOR, DDR4)
|
||||
BOOT_DEVICE:=nor
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7981
|
||||
DDR_TYPE:=ddr4
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7981-emmc-ddr4
|
||||
NAME:=MediaTek MT7981 (eMMC, DDR4)
|
||||
BOOT_DEVICE:=emmc
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7981
|
||||
DDR_TYPE:=ddr4
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7981-spim-nand-ddr4
|
||||
NAME:=MediaTek MT7981 (SPI-NAND via SPIM, DDR4)
|
||||
BOOT_DEVICE:=spim-nand
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7981
|
||||
DDR_TYPE:=ddr4
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7981-nor-ddr3
|
||||
NAME:=MediaTek MT7981 (SPI-NOR, DDR3)
|
||||
BOOT_DEVICE:=nor
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7981
|
||||
DDR_TYPE:=ddr3
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7981-emmc-ddr3
|
||||
NAME:=MediaTek MT7981 (eMMC, DDR3)
|
||||
BOOT_DEVICE:=emmc
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7981
|
||||
DDR_TYPE:=ddr3
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7981-sdmmc-ddr3
|
||||
NAME:=MediaTek MT7981 (SD card, DDR3)
|
||||
BOOT_DEVICE:=sdmmc
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7981
|
||||
DDR_TYPE:=ddr3
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7981-snand-ddr3
|
||||
NAME:=MediaTek MT7981 (SPI-NAND via SNFI, DDR3)
|
||||
BOOT_DEVICE:=snand
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7981
|
||||
DDR_TYPE:=ddr3
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7981-spim-nand-ddr3
|
||||
NAME:=MediaTek MT7981 (SPI-NAND via SPIM, DDR3)
|
||||
BOOT_DEVICE:=spim-nand
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7981
|
||||
DDR_TYPE:=ddr3
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7981-spim-nand-ubi-ddr4
|
||||
NAME:=MediaTek MT7981 (SPI-NAND via SPIM, DDR4)
|
||||
BOOT_DEVICE:=spim-nand
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7981
|
||||
DDR_TYPE:=ddr4
|
||||
USE_UBI:=1
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7986-nor-ddr4
|
||||
NAME:=MediaTek MT7986 (SPI-NOR, DDR4)
|
||||
BOOT_DEVICE:=nor
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7986
|
||||
DDR_TYPE:=ddr4
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7986-emmc-ddr4
|
||||
NAME:=MediaTek MT7986 (eMMC, DDR4)
|
||||
BOOT_DEVICE:=emmc
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7986
|
||||
DDR_TYPE:=ddr4
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7986-sdmmc-ddr4
|
||||
NAME:=MediaTek MT7986 (SD card, DDR4)
|
||||
BOOT_DEVICE:=sdmmc
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7986
|
||||
DDR_TYPE:=ddr4
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7986-snand-ddr4
|
||||
NAME:=MediaTek MT7986 (SPI-NAND via SNFI, DDR4)
|
||||
BOOT_DEVICE:=snand
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7986
|
||||
DDR_TYPE:=ddr4
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7986-spim-nand-ddr4
|
||||
NAME:=MediaTek MT7986 (SPI-NAND via SPIM, DDR4)
|
||||
BOOT_DEVICE:=spim-nand
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7986
|
||||
DDR_TYPE:=ddr4
|
||||
NAND_TYPE:=spim:2k+64
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7986-spim-nand-ubi-ddr4
|
||||
NAME:=MediaTek MT7986 (SPI-NAND via SPIM using UBI, DDR4)
|
||||
BOOT_DEVICE:=spim-nand
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7986
|
||||
DDR_TYPE:=ddr4
|
||||
NAND_TYPE:=spim:2k+64
|
||||
USE_UBI:=1
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7986-spim-nand-4k-ddr4
|
||||
NAME:=MediaTek MT7986 (SPI-NAND via SPIM, DDR4)
|
||||
BOOT_DEVICE:=spim-nand
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7986
|
||||
DDR_TYPE:=ddr4
|
||||
NAND_TYPE:=spim:4k+256
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7986-nor-ddr3
|
||||
NAME:=MediaTek MT7986 (SPI-NOR, DDR3)
|
||||
BOOT_DEVICE:=nor
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7986
|
||||
DDR_TYPE:=ddr3
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7986-emmc-ddr3
|
||||
NAME:=MediaTek MT7986 (eMMC, DDR3)
|
||||
BOOT_DEVICE:=emmc
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7986
|
||||
DDR_TYPE:=ddr3
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7986-sdmmc-ddr3
|
||||
NAME:=MediaTek MT7986 (SD card, DDR3)
|
||||
BOOT_DEVICE:=sdmmc
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7986
|
||||
DDR_TYPE:=ddr3
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7986-snand-ddr3
|
||||
NAME:=MediaTek MT7986 (SPI-NAND via SNFI, DDR3)
|
||||
BOOT_DEVICE:=snand
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7986
|
||||
DDR_TYPE:=ddr3
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7986-spim-nand-ddr3
|
||||
NAME:=MediaTek MT7986 (SPI-NAND via SPIM, DDR3)
|
||||
BOOT_DEVICE:=spim-nand
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7986
|
||||
DDR_TYPE:=ddr3
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7988-nor-ddr3
|
||||
NAME:=MediaTek MT7988 (SPI-NOR, DDR3)
|
||||
BOOT_DEVICE:=nor
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7988
|
||||
DDR_TYPE:=ddr3
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7988-emmc-ddr3
|
||||
NAME:=MediaTek MT7988 (eMMC, DDR3)
|
||||
BOOT_DEVICE:=emmc
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7988
|
||||
DDR_TYPE:=ddr3
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7988-sdmmc-ddr3
|
||||
NAME:=MediaTek MT7988 (SD card, DDR3)
|
||||
BOOT_DEVICE:=sdmmc
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7988
|
||||
DDR_TYPE:=ddr3
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7988-snand-ddr3
|
||||
NAME:=MediaTek MT7988 (SPI-NAND via SNFI, DDR3)
|
||||
BOOT_DEVICE:=snand
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7988
|
||||
DDR_TYPE:=ddr3
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7988-spim-nand-ddr3
|
||||
NAME:=MediaTek MT7988 (SPI-NAND via SPIM, DDR3)
|
||||
BOOT_DEVICE:=spim-nand
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7988
|
||||
DDR_TYPE:=ddr3
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7988-nor-ddr4
|
||||
NAME:=MediaTek MT7988 (SPI-NOR, DDR4)
|
||||
BOOT_DEVICE:=nor
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7988
|
||||
DDR_TYPE:=ddr4
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7988-emmc-ddr4
|
||||
NAME:=MediaTek MT7988 (eMMC, DDR4)
|
||||
BOOT_DEVICE:=emmc
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7988
|
||||
DDR_TYPE:=ddr4
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7988-sdmmc-ddr4
|
||||
NAME:=MediaTek MT7988 (SD card, DDR4)
|
||||
BOOT_DEVICE:=sdmmc
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7988
|
||||
DDR_TYPE:=ddr4
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7988-snand-ddr4
|
||||
NAME:=MediaTek MT7988 (SPI-NAND via SNFI, DDR4)
|
||||
BOOT_DEVICE:=snand
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7988
|
||||
DDR_TYPE:=ddr4
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7988-spim-nand-ddr4
|
||||
NAME:=MediaTek MT7988 (SPI-NAND via SPIM, DDR4)
|
||||
BOOT_DEVICE:=spim-nand
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7988
|
||||
DDR_TYPE:=ddr4
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7988-nor-comb
|
||||
NAME:=MediaTek MT7988 (SPI-NOR)
|
||||
BOOT_DEVICE:=nor
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7988
|
||||
DRAM_USE_COMB:=1
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7988-emmc-comb
|
||||
NAME:=MediaTek MT7988 (eMMC)
|
||||
BOOT_DEVICE:=emmc
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7988
|
||||
DRAM_USE_COMB:=1
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7988-sdmmc-comb
|
||||
NAME:=MediaTek MT7988 (SD card)
|
||||
BOOT_DEVICE:=sdmmc
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7988
|
||||
DRAM_USE_COMB:=1
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7988-snand-comb
|
||||
NAME:=MediaTek MT7988 (SPI-NAND via SNFI)
|
||||
BOOT_DEVICE:=snand
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7988
|
||||
DRAM_USE_COMB:=1
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7988-snand-ubi-comb
|
||||
NAME:=MediaTek MT7988 (SPI-NAND via SNFI, UBI)
|
||||
BOOT_DEVICE:=snand
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7988
|
||||
DRAM_USE_COMB:=1
|
||||
USE_UBI:=1
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7988-spim-nand-comb
|
||||
NAME:=MediaTek MT7988 (SPI-NAND via SPIM)
|
||||
BOOT_DEVICE:=spim-nand
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7988
|
||||
DRAM_USE_COMB:=1
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7988-spim-nand-ubi-comb
|
||||
NAME:=MediaTek MT7988 (SPI-NAND via SPIM, UBI)
|
||||
BOOT_DEVICE:=spim-nand
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7988
|
||||
DRAM_USE_COMB:=1
|
||||
USE_UBI:=1
|
||||
endef
|
||||
|
||||
TFA_TARGETS:= \
|
||||
mt7622-nor-1ddr \
|
||||
mt7622-nor-2ddr \
|
||||
mt7622-snand-1ddr \
|
||||
mt7622-snand-ubi-1ddr \
|
||||
mt7622-snand-2ddr \
|
||||
mt7622-snand-ubi-2ddr \
|
||||
mt7622-emmc-1ddr \
|
||||
mt7622-emmc-2ddr \
|
||||
mt7622-sdmmc-1ddr \
|
||||
mt7622-sdmmc-2ddr
|
||||
mt7622-sdmmc-2ddr \
|
||||
mt7981-emmc-ddr3 \
|
||||
mt7981-nor-ddr3 \
|
||||
mt7981-sdmmc-ddr3 \
|
||||
mt7981-snand-ddr3 \
|
||||
mt7981-spim-nand-ddr3 \
|
||||
mt7981-spim-nand-ubi-ddr4 \
|
||||
mt7981-emmc-ddr4 \
|
||||
mt7981-nor-ddr4 \
|
||||
mt7981-spim-nand-ddr4 \
|
||||
mt7986-emmc-ddr3 \
|
||||
mt7986-nor-ddr3 \
|
||||
mt7986-sdmmc-ddr3 \
|
||||
mt7986-snand-ddr3 \
|
||||
mt7986-spim-nand-ddr3 \
|
||||
mt7986-emmc-ddr4 \
|
||||
mt7986-nor-ddr4 \
|
||||
mt7986-sdmmc-ddr4 \
|
||||
mt7986-snand-ddr4 \
|
||||
mt7986-spim-nand-ddr4 \
|
||||
mt7986-spim-nand-ubi-ddr4 \
|
||||
mt7986-spim-nand-4k-ddr4 \
|
||||
mt7988-emmc-ddr3 \
|
||||
mt7988-nor-ddr3 \
|
||||
mt7988-sdmmc-ddr3 \
|
||||
mt7988-snand-ddr3 \
|
||||
mt7988-spim-nand-ddr3 \
|
||||
mt7988-emmc-ddr4 \
|
||||
mt7988-nor-ddr4 \
|
||||
mt7988-sdmmc-ddr4 \
|
||||
mt7988-snand-ddr4 \
|
||||
mt7988-spim-nand-ddr4 \
|
||||
mt7988-emmc-comb \
|
||||
mt7988-nor-comb \
|
||||
mt7988-sdmmc-comb \
|
||||
mt7988-snand-comb \
|
||||
mt7988-snand-ubi-comb \
|
||||
mt7988-spim-nand-comb \
|
||||
mt7988-spim-nand-ubi-comb
|
||||
|
||||
TFA_MAKE_FLAGS += \
|
||||
BOOT_DEVICE=$(BOOT_DEVICE) \
|
||||
USE_MKIMAGE=1 MKIMAGE=$(STAGING_DIR_HOST)/bin/mkimage \
|
||||
$(if $(findstring ddr4,$(DDR_TYPE)),DRAM_USE_DDR4=1) \
|
||||
$(if $(BOARD_QFN),BOARD_QFN=1,BOARD_BGA=1) \
|
||||
$(if $(NAND_TYPE),NAND_TYPE=$(NAND_TYPE)) \
|
||||
HAVE_DRAM_OBJ_FILE=yes \
|
||||
$(if $(DDR3_FLYBY),DDR3_FLYBY=1) \
|
||||
$(if $(DRAM_USE_COMB),DRAM_USE_COMB=1) \
|
||||
$(if $(USE_UBI),UBI=1 $(if $(findstring mt7622,$(PLAT)),OVERRIDE_UBI_START_ADDR=0x80000)) \
|
||||
$(if $(USE_UBI),UBI=1 $(if $(findstring mt7981,$(PLAT)),OVERRIDE_UBI_START_ADDR=0x100000)) \
|
||||
all
|
||||
|
||||
define Build/Configure
|
||||
$(call Build/Configure/Default)
|
||||
endef
|
||||
|
||||
define Package/trusted-firmware-a/install
|
||||
$(INSTALL_DIR) $(STAGING_DIR_IMAGE)
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/build/mt7622/release/bl2.img $(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-bl2.img
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/build/mt7622/release/bl31.bin $(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-bl31.bin
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/build/$(PLAT)/release/bl2.img $(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-bl2.img
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/build/$(PLAT)/release/bl31.bin $(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-bl31.bin
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage/Trusted-Firmware-A))
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
From fb2a2b669ec9bbf5c448d4b56499bc83de075c93 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Golle <daniel@makrotopia.org>
|
||||
Date: Thu, 29 Feb 2024 18:01:08 +0000
|
||||
Subject: [PATCH 1/3] mediatek: snfi: FM35Q1GA is x4-only
|
||||
|
||||
Dont allow x2 read and cache read operations on FM35Q1GA.
|
||||
|
||||
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
---
|
||||
plat/mediatek/apsoc_common/drivers/snfi/mtk-snand-ids.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/plat/mediatek/apsoc_common/drivers/snfi/mtk-snand-ids.c
|
||||
+++ b/plat/mediatek/apsoc_common/drivers/snfi/mtk-snand-ids.c
|
||||
@@ -423,7 +423,7 @@ static const struct snand_flash_info sna
|
||||
|
||||
SNAND_INFO("FM35Q1GA", SNAND_ID(SNAND_ID_DYMMY, 0xe5, 0x71),
|
||||
SNAND_MEMORG_1G_2K_64,
|
||||
- &snand_cap_read_from_cache_x4,
|
||||
+ &snand_cap_read_from_cache_x4_only,
|
||||
&snand_cap_program_load_x4),
|
||||
|
||||
SNAND_INFO("PN26G01A", SNAND_ID(SNAND_ID_DYMMY, 0xa1, 0xe1),
|
||||
@@ -0,0 +1,99 @@
|
||||
From 6470986f037880ce76960c369d6e5a5270e7ce32 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Golle <daniel@makrotopia.org>
|
||||
Date: Sun, 10 Mar 2024 15:39:07 +0000
|
||||
Subject: [PATCH 2/3] mediatek: snfi: adjust pin drive strength for Fidelix
|
||||
SPI-NAND
|
||||
|
||||
It seems like we might need to adjust the pin driver strength to 12mA
|
||||
for Fidelix SPI-NAND chip on MT7622 to avoid SPI data corruption on
|
||||
some devices.
|
||||
|
||||
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
---
|
||||
.../apsoc_common/drivers/snfi/mtk-snand-def.h | 7 +++++
|
||||
.../apsoc_common/drivers/snfi/mtk-snand-ids.c | 4 ++-
|
||||
.../apsoc_common/drivers/snfi/mtk-snand.c | 30 +++++++++++++++++++
|
||||
3 files changed, 40 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/plat/mediatek/apsoc_common/drivers/snfi/mtk-snand-def.h
|
||||
+++ b/plat/mediatek/apsoc_common/drivers/snfi/mtk-snand-def.h
|
||||
@@ -86,6 +86,12 @@ struct snand_mem_org {
|
||||
|
||||
typedef int (*snand_select_die_t)(struct mtk_snand *snf, uint32_t dieidx);
|
||||
|
||||
+enum snand_drv {
|
||||
+ SNAND_DRV_NO_CHANGE = 0,
|
||||
+ SNAND_DRV_8mA = 8,
|
||||
+ SNAND_DRV_12mA = 12,
|
||||
+};
|
||||
+
|
||||
struct snand_flash_info {
|
||||
const char *model;
|
||||
struct snand_id id;
|
||||
@@ -93,6 +99,7 @@ struct snand_flash_info {
|
||||
const struct snand_io_cap *cap_rd;
|
||||
const struct snand_io_cap *cap_pl;
|
||||
snand_select_die_t select_die;
|
||||
+ enum snand_drv drv;
|
||||
};
|
||||
|
||||
#define SNAND_INFO(_model, _id, _memorg, _cap_rd, _cap_pl, ...) \
|
||||
--- a/plat/mediatek/apsoc_common/drivers/snfi/mtk-snand-ids.c
|
||||
+++ b/plat/mediatek/apsoc_common/drivers/snfi/mtk-snand-ids.c
|
||||
@@ -424,7 +424,9 @@ static const struct snand_flash_info sna
|
||||
SNAND_INFO("FM35Q1GA", SNAND_ID(SNAND_ID_DYMMY, 0xe5, 0x71),
|
||||
SNAND_MEMORG_1G_2K_64,
|
||||
&snand_cap_read_from_cache_x4_only,
|
||||
- &snand_cap_program_load_x4),
|
||||
+ &snand_cap_program_load_x4,
|
||||
+ NULL,
|
||||
+ SNAND_DRV_12mA),
|
||||
|
||||
SNAND_INFO("PN26G01A", SNAND_ID(SNAND_ID_DYMMY, 0xa1, 0xe1),
|
||||
SNAND_MEMORG_1G_2K_128,
|
||||
--- a/plat/mediatek/apsoc_common/drivers/snfi/mtk-snand.c
|
||||
+++ b/plat/mediatek/apsoc_common/drivers/snfi/mtk-snand.c
|
||||
@@ -1845,6 +1845,33 @@ static int mtk_snand_id_probe(struct mtk
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
+#define MT7622_GPIO_BASE (void *)0x10211000
|
||||
+#define MT7622_GPIO_DRIV(x) (MT7622_GPIO_BASE + 0x900 + 0x10 * x)
|
||||
+
|
||||
+void mtk_mt7622_snand_adjust_drive(void *dev, enum snand_drv drv)
|
||||
+{
|
||||
+ uint32_t e4, e8;
|
||||
+
|
||||
+ e4 = readl(MT7622_GPIO_DRIV(6)) & ~(0x3f00);
|
||||
+ e8 = readl(MT7622_GPIO_DRIV(7)) & ~(0x3f00);
|
||||
+
|
||||
+ switch (drv) {
|
||||
+ case SNAND_DRV_8mA:
|
||||
+ e4 |= 0x3f00;
|
||||
+ break;
|
||||
+ case SNAND_DRV_12mA:
|
||||
+ e8 |= 0x3f00;
|
||||
+ break;
|
||||
+ default:
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ snand_log_chip(dev, "adjusting SPI-NAND pin drive strength to %umA\n", drv);
|
||||
+
|
||||
+ writel(e4, MT7622_GPIO_DRIV(6));
|
||||
+ writel(e8, MT7622_GPIO_DRIV(7));
|
||||
+}
|
||||
+
|
||||
int mtk_snand_init(void *dev, const struct mtk_snand_platdata *pdata,
|
||||
struct mtk_snand **psnf)
|
||||
{
|
||||
@@ -1888,6 +1915,9 @@ int mtk_snand_init(void *dev, const stru
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
+ if (pdata->soc == SNAND_SOC_MT7622 && snand_info->drv)
|
||||
+ mtk_mt7622_snand_adjust_drive(dev, snand_info->drv);
|
||||
+
|
||||
rawpage_size = snand_info->memorg.pagesize +
|
||||
snand_info->memorg.sparesize;
|
||||
|
||||
@@ -0,0 +1,135 @@
|
||||
From 40a3661bebb3d738ab95b7de66e9d8382d5b9ab1 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Golle <daniel@makrotopia.org>
|
||||
Date: Sun, 10 Mar 2024 17:48:09 +0000
|
||||
Subject: [PATCH 3/3] mediatek: snfi: adjust drive strength to 12mA like old
|
||||
loader does
|
||||
|
||||
In addition to FM35X1GA, also change the driver strength to 12mA for
|
||||
all chips where this is done by the old/legacy U-Boot:
|
||||
* Winbond 512Mb
|
||||
* Winbond 1Gb
|
||||
* Winbond 2Gb
|
||||
* GD5F4GQ4UBYIG
|
||||
* GD5F4GQ4UAYIG
|
||||
* GD5F1GQ4UX
|
||||
* GD5F1GQ4UE
|
||||
* GD5F2GQ4UX
|
||||
* GD5F2GQ4UE
|
||||
|
||||
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
---
|
||||
.../apsoc_common/drivers/snfi/mtk-snand-ids.c | 59 ++++++++++++++-----
|
||||
1 file changed, 44 insertions(+), 15 deletions(-)
|
||||
|
||||
--- a/plat/mediatek/apsoc_common/drivers/snfi/mtk-snand-ids.c
|
||||
+++ b/plat/mediatek/apsoc_common/drivers/snfi/mtk-snand-ids.c
|
||||
@@ -80,65 +80,94 @@ static const struct snand_flash_info sna
|
||||
SNAND_INFO("W25N512GV", SNAND_ID(SNAND_ID_DYMMY, 0xef, 0xaa, 0x20),
|
||||
SNAND_MEMORG_512M_2K_64,
|
||||
&snand_cap_read_from_cache_quad,
|
||||
- &snand_cap_program_load_x4),
|
||||
+ &snand_cap_program_load_x4,
|
||||
+ NULL,
|
||||
+ SNAND_DRV_12mA),
|
||||
SNAND_INFO("W25N01GV", SNAND_ID(SNAND_ID_DYMMY, 0xef, 0xaa, 0x21),
|
||||
SNAND_MEMORG_1G_2K_64,
|
||||
&snand_cap_read_from_cache_quad,
|
||||
- &snand_cap_program_load_x4),
|
||||
+ &snand_cap_program_load_x4,
|
||||
+ NULL,
|
||||
+ SNAND_DRV_12mA),
|
||||
SNAND_INFO("W25M02GV", SNAND_ID(SNAND_ID_DYMMY, 0xef, 0xab, 0x21),
|
||||
SNAND_MEMORG_2G_2K_64_2D,
|
||||
&snand_cap_read_from_cache_quad,
|
||||
&snand_cap_program_load_x4,
|
||||
- mtk_snand_winbond_select_die),
|
||||
+ mtk_snand_winbond_select_die,
|
||||
+ SNAND_DRV_12mA),
|
||||
SNAND_INFO("W25N02KV", SNAND_ID(SNAND_ID_DYMMY, 0xef, 0xaa, 0x22),
|
||||
SNAND_MEMORG_2G_2K_128,
|
||||
&snand_cap_read_from_cache_quad,
|
||||
- &snand_cap_program_load_x4),
|
||||
+ &snand_cap_program_load_x4,
|
||||
+ NULL,
|
||||
+ SNAND_DRV_12mA),
|
||||
|
||||
SNAND_INFO("GD5F1GQ4UAWxx", SNAND_ID(SNAND_ID_ADDR, 0xc8, 0x10),
|
||||
SNAND_MEMORG_1G_2K_64,
|
||||
&snand_cap_read_from_cache_quad_q2d,
|
||||
- &snand_cap_program_load_x4),
|
||||
+ &snand_cap_program_load_x4,
|
||||
+ NULL,
|
||||
+ SNAND_DRV_12mA),
|
||||
SNAND_INFO("GD5F1GQ4UExIG", SNAND_ID(SNAND_ID_ADDR, 0xc8, 0xd1),
|
||||
SNAND_MEMORG_1G_2K_128,
|
||||
&snand_cap_read_from_cache_quad_q2d,
|
||||
- &snand_cap_program_load_x4),
|
||||
+ &snand_cap_program_load_x4,
|
||||
+ NULL,
|
||||
+ SNAND_DRV_12mA),
|
||||
SNAND_INFO("GD5F1GQ4UExxH", SNAND_ID(SNAND_ID_ADDR, 0xc8, 0xd9),
|
||||
SNAND_MEMORG_1G_2K_64,
|
||||
&snand_cap_read_from_cache_quad_q2d,
|
||||
- &snand_cap_program_load_x4),
|
||||
+ &snand_cap_program_load_x4,
|
||||
+ NULL,
|
||||
+ SNAND_DRV_12mA),
|
||||
SNAND_INFO("GD5F1GQ4xAYIG", SNAND_ID(SNAND_ID_ADDR, 0xc8, 0xf1),
|
||||
SNAND_MEMORG_1G_2K_64,
|
||||
&snand_cap_read_from_cache_quad_q2d,
|
||||
- &snand_cap_program_load_x4),
|
||||
+ &snand_cap_program_load_x4,
|
||||
+ NULL,
|
||||
+ SNAND_DRV_12mA),
|
||||
SNAND_INFO("GD5F2GQ4UExIG", SNAND_ID(SNAND_ID_ADDR, 0xc8, 0xd2),
|
||||
SNAND_MEMORG_2G_2K_128,
|
||||
&snand_cap_read_from_cache_quad_q2d,
|
||||
- &snand_cap_program_load_x4),
|
||||
+ &snand_cap_program_load_x4,
|
||||
+ NULL,
|
||||
+ SNAND_DRV_12mA),
|
||||
SNAND_INFO("GD5F2GQ5UExxH", SNAND_ID(SNAND_ID_ADDR, 0xc8, 0x32),
|
||||
SNAND_MEMORG_2G_2K_64,
|
||||
&snand_cap_read_from_cache_quad_a8d,
|
||||
- &snand_cap_program_load_x4),
|
||||
+ &snand_cap_program_load_x4,
|
||||
+ NULL,
|
||||
+ SNAND_DRV_12mA),
|
||||
SNAND_INFO("GD5F2GQ4xAYIG", SNAND_ID(SNAND_ID_ADDR, 0xc8, 0xf2),
|
||||
SNAND_MEMORG_2G_2K_64,
|
||||
&snand_cap_read_from_cache_quad_q2d,
|
||||
- &snand_cap_program_load_x4),
|
||||
+ &snand_cap_program_load_x4,
|
||||
+ NULL,
|
||||
+ SNAND_DRV_12mA),
|
||||
SNAND_INFO("GD5F4GQ4UBxIG", SNAND_ID(SNAND_ID_ADDR, 0xc8, 0xd4),
|
||||
SNAND_MEMORG_4G_4K_256,
|
||||
&snand_cap_read_from_cache_quad_q2d,
|
||||
- &snand_cap_program_load_x4),
|
||||
+ &snand_cap_program_load_x4,
|
||||
+ NULL,
|
||||
+ SNAND_DRV_12mA),
|
||||
SNAND_INFO("GD5F4GQ4xAYIG", SNAND_ID(SNAND_ID_ADDR, 0xc8, 0xf4),
|
||||
SNAND_MEMORG_4G_2K_64,
|
||||
&snand_cap_read_from_cache_quad_q2d,
|
||||
- &snand_cap_program_load_x4),
|
||||
+ &snand_cap_program_load_x4,
|
||||
+ NULL,
|
||||
+ SNAND_DRV_12mA),
|
||||
SNAND_INFO("GD5F2GQ5UExxG", SNAND_ID(SNAND_ID_DYMMY, 0xc8, 0x52),
|
||||
SNAND_MEMORG_2G_2K_128,
|
||||
&snand_cap_read_from_cache_quad_a8d,
|
||||
- &snand_cap_program_load_x4),
|
||||
+ &snand_cap_program_load_x4,
|
||||
+ NULL,
|
||||
+ SNAND_DRV_12mA),
|
||||
SNAND_INFO("GD5F4GQ4UCxIG", SNAND_ID(SNAND_ID_DYMMY, 0xc8, 0xb4),
|
||||
SNAND_MEMORG_4G_4K_256,
|
||||
&snand_cap_read_from_cache_quad_q2d,
|
||||
- &snand_cap_program_load_x4),
|
||||
+ &snand_cap_program_load_x4,
|
||||
+ NULL,
|
||||
+ SNAND_DRV_12mA),
|
||||
|
||||
SNAND_INFO("MX35LF1GE4AB", SNAND_ID(SNAND_ID_DYMMY, 0xc2, 0x12),
|
||||
SNAND_MEMORG_1G_2K_64,
|
||||
@@ -1,11 +0,0 @@
|
||||
--- a/plat/mediatek/mt7622/bl2_boot_nor.c
|
||||
+++ b/plat/mediatek/mt7622/bl2_boot_nor.c
|
||||
@@ -12,7 +12,7 @@
|
||||
#define MT7622_NOR_MAP_BASE 0x30000000
|
||||
|
||||
#define FIP_BASE 0x20000
|
||||
-#define FIP_SIZE 0x80000
|
||||
+#define FIP_SIZE 0xa0000
|
||||
|
||||
const io_block_spec_t mtk_boot_dev_fip_spec = {
|
||||
.offset = MT7622_NOR_MAP_BASE + FIP_BASE,
|
||||
@@ -13,6 +13,7 @@ PKG_HASH:=bf3eb3617a74cddd7fb0e0eacbfe38c3258ee07d4c8ed730deef7a175cc3d55b
|
||||
|
||||
PKG_MAINTAINER:=Vladimir Vid <vladimir.vid@sartura.hr>
|
||||
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
include $(INCLUDE_DIR)/trusted-firmware-a.mk
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
||||
@@ -1,91 +0,0 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
# Copyright (C) 2022 ImmortalWrt.org
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=arm-trusted-firmware-rockchip-vendor
|
||||
PKG_RELEASE:=$(AUTORELEASE)
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL=https://github.com/rockchip-linux/rkbin.git
|
||||
PKG_SOURCE_DATE:=2022-08-01
|
||||
PKG_SOURCE_VERSION:=b0c100f1a260d807df450019774993c761beb79d
|
||||
PKG_MIRROR_HASH:=0a6887af6edaecc0b9798612a0126c6ab470503f9b8841449e9543bd5a8a055e
|
||||
|
||||
PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
|
||||
|
||||
MAKE_PATH:=$(PKG_NAME)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/arm-trusted-firmware-rockchip-vendor
|
||||
SECTION:=boot
|
||||
CATEGORY:=Boot Loaders
|
||||
TITLE:=ARM Trusted Firmware for Rockchip
|
||||
endef
|
||||
|
||||
define Package/arm-trusted-firmware-rk3328
|
||||
$(Package/arm-trusted-firmware-rockchip-vendor)
|
||||
DEPENDS:=@TARGET_rockchip_armv8
|
||||
VARIANT:=rk3328
|
||||
endef
|
||||
|
||||
define Package/arm-trusted-firmware-rk3399
|
||||
$(Package/arm-trusted-firmware-rockchip-vendor)
|
||||
DEPENDS:=@TARGET_rockchip_armv8
|
||||
VARIANT:=rk3399
|
||||
endef
|
||||
|
||||
define Package/arm-trusted-firmware-rk3566
|
||||
$(Package/arm-trusted-firmware-rockchip-vendor)
|
||||
DEPENDS:=@TARGET_rockchip_armv8
|
||||
VARIANT:=rk3566
|
||||
endef
|
||||
|
||||
define Package/arm-trusted-firmware-rk3568
|
||||
$(Package/arm-trusted-firmware-rockchip-vendor)
|
||||
DEPENDS:=@TARGET_rockchip_armv8
|
||||
VARIANT:=rk3568
|
||||
endef
|
||||
|
||||
define Package/arm-trusted-firmware-rk3588
|
||||
$(Package/arm-trusted-firmware-rockchip-vendor)
|
||||
DEPENDS:=@TARGET_rockchip_armv8
|
||||
VARIANT:=rk3588
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
$(SED) 's,$$$$(PKG_BUILD_DIR),$(PKG_BUILD_DIR),g' $(PKG_BUILD_DIR)/trust.ini
|
||||
$(SED) 's,$$$$(VARIANT),$(BUILD_VARIANT),g' $(PKG_BUILD_DIR)/trust.ini
|
||||
$(call Build/Configure/Default)
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(CURDIR)/pack-firmware.sh build $(BUILD_VARIANT) '$(PKG_BUILD_DIR)'
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(CURDIR)/pack-firmware.sh install $(BUILD_VARIANT) '$(PKG_BUILD_DIR)' '$(STAGING_DIR_IMAGE)'
|
||||
endef
|
||||
|
||||
define Package/arm-trusted-firmware-rk3328/install
|
||||
endef
|
||||
|
||||
define Package/arm-trusted-firmware-rk3399/install
|
||||
endef
|
||||
|
||||
define Package/arm-trusted-firmware-rk3566/install
|
||||
endef
|
||||
|
||||
define Package/arm-trusted-firmware-rk3568/install
|
||||
endef
|
||||
|
||||
define Package/arm-trusted-firmware-rk3588/install
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,arm-trusted-firmware-rk3328))
|
||||
$(eval $(call BuildPackage,arm-trusted-firmware-rk3399))
|
||||
$(eval $(call BuildPackage,arm-trusted-firmware-rk3566))
|
||||
$(eval $(call BuildPackage,arm-trusted-firmware-rk3568))
|
||||
$(eval $(call BuildPackage,arm-trusted-firmware-rk3588))
|
||||
@@ -1,64 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Copyright (C) 2021 ImmortalWrt.org
|
||||
|
||||
ACTION="$1"
|
||||
VARIANT="$2"
|
||||
PKG_BUILD_DIR="$3"
|
||||
STAGING_DIR_IMAGE="$4"
|
||||
|
||||
case "$VARIANT" in
|
||||
"rk3328")
|
||||
ATF="rk33/rk322xh_bl31_v1.49.elf"
|
||||
DDR="rk33/rk3328_ddr_333MHz_v1.19.bin"
|
||||
LOADER="rk33/rk322xh_miniloader_v2.50.bin"
|
||||
;;
|
||||
"rk3399")
|
||||
ATF="rk33/rk3399_bl31_v1.35.elf"
|
||||
DDR="rk33/rk3399_ddr_800MHz_v1.27.bin"
|
||||
LOADER="rk33/rk3399_miniloader_v1.26.bin"
|
||||
;;
|
||||
"rk3566")
|
||||
ATF="rk35/rk3568_bl31_v1.28.elf"
|
||||
DDR="rk35/rk3566_ddr_1056MHz_v1.13.bin"
|
||||
;;
|
||||
"rk3568")
|
||||
ATF="rk35/rk3568_bl31_v1.28.elf"
|
||||
DDR="rk35/rk3568_ddr_1560MHz_v1.13.bin"
|
||||
;;
|
||||
"rk3588")
|
||||
ATF="rk35/rk3588_bl31_v1.27.elf"
|
||||
DDR="rk35/rk3588_ddr_lp4_2112MHz_lp5_2736MHz_v1.08.bin"
|
||||
;;
|
||||
*)
|
||||
echo -e "Not compatible with your platform: $VARIANT."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
set -x
|
||||
if [ "$ACTION" == "build" ]; then
|
||||
case "$VARIANT" in
|
||||
rk33*)
|
||||
"$PKG_BUILD_DIR"/tools/mkimage -n "$VARIANT" -T "rksd" -d "$PKG_BUILD_DIR/bin/$DDR" "$PKG_BUILD_DIR/$VARIANT-idbloader.bin"
|
||||
cat "$PKG_BUILD_DIR/bin/$LOADER" >> "$PKG_BUILD_DIR/$VARIANT-idbloader.bin"
|
||||
"$PKG_BUILD_DIR/tools/trust_merger" --replace "bl31.elf" "$PKG_BUILD_DIR/bin/$ATF" "$PKG_BUILD_DIR/trust.ini"
|
||||
;;
|
||||
esac
|
||||
elif [ "$ACTION" == "install" ]; then
|
||||
mkdir -p "$STAGING_DIR_IMAGE"
|
||||
cp -fp "$PKG_BUILD_DIR/bin/$ATF" "$STAGING_DIR_IMAGE"/
|
||||
case "$VARIANT" in
|
||||
rk33*)
|
||||
cp -fp "$PKG_BUILD_DIR/tools/loaderimage" "$STAGING_DIR_IMAGE"/
|
||||
cp -fp "$PKG_BUILD_DIR/$VARIANT-idbloader.bin" "$STAGING_DIR_IMAGE"/
|
||||
cp -fp "$PKG_BUILD_DIR/$VARIANT-trust.bin" "$STAGING_DIR_IMAGE"/
|
||||
;;
|
||||
rk35*)
|
||||
cp -fp "$PKG_BUILD_DIR/bin/$DDR" "$STAGING_DIR_IMAGE"/
|
||||
;;
|
||||
esac
|
||||
else
|
||||
echo -e "Unknown operation: $ACTION."
|
||||
exit 1
|
||||
fi
|
||||
set +x
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,49 +1,95 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
# Copyright (C) 2020 Tobias Maedel <openwrt@tbspace.de>
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
# Copyright (C) 2021-2023 ImmortalWrt.org
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=arm-trusted-firmware-rockchip
|
||||
PKG_VERSION:=2.3
|
||||
PKG_NAME:=rkbin
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=atf-v$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://github.com/atf-builds/atf/releases/download/v$(PKG_VERSION)/atf-v$(PKG_VERSION).tar.gz?
|
||||
PKG_HASH:=bf352298743aed594cf2958dd588e06ab6713fc514bb6f809bf55a85a87134c1
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/rockchip-linux/rkbin.git
|
||||
PKG_SOURCE_DATE:=2024-02-22
|
||||
PKG_SOURCE_VERSION:=a2a0b89b6c8c612dca5ed9ed8a68db8a07f68bc0
|
||||
PKG_MIRROR_HASH:=39f15e5f8fac02026065b6747b355b93f4e06202783ae448c43607763211597c
|
||||
|
||||
PKG_LICENSE:=BSD-3-Clause
|
||||
PKG_LICENSE_FILES:=license.md
|
||||
|
||||
PKG_MAINTAINER:=Tobias Maedel <openwrt@tbspace.de>
|
||||
|
||||
MAKE_PATH:=$(PKG_NAME)
|
||||
PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
|
||||
|
||||
include $(INCLUDE_DIR)/trusted-firmware-a.mk
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include ./atf-version.mk
|
||||
|
||||
define Package/arm-trusted-firmware-rockchip
|
||||
SECTION:=boot
|
||||
CATEGORY:=Boot Loaders
|
||||
TITLE:=ARM Trusted Firmware for Rockchip
|
||||
DEPENDS:=@TARGET_rockchip_armv8
|
||||
define Trusted-Firmware-A/Default
|
||||
NAME:=Rockchip $(1) SoCs
|
||||
BUILD_TARGET:=rockchip
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
$(TAR) -C $(PKG_BUILD_DIR) -xf $(DL_DIR)/$(PKG_SOURCE)
|
||||
define Trusted-Firmware-A/rk3328
|
||||
BUILD_SUBTARGET:=armv8
|
||||
ATF:=rk33/$(RK3328_ATF)
|
||||
TPL:=rk33/$(RK3328_TPL)
|
||||
LOADER:=rk33/$(RK3328_LOADER)
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/rk3399
|
||||
BUILD_SUBTARGET:=armv8
|
||||
ATF:=rk33/$(RK3399_ATF)
|
||||
TPL:=rk33/$(RK3399_TPL)
|
||||
LOADER:=rk33/$(RK3399_LOADER)
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/rk3566
|
||||
BUILD_SUBTARGET:=armv8
|
||||
ATF:=rk35/$(RK3566_ATF)
|
||||
TPL:=rk35/$(RK3566_TPL)
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/rk3568
|
||||
BUILD_SUBTARGET:=armv8
|
||||
ATF:=rk35/$(RK3568_ATF)
|
||||
TPL:=rk35/$(RK3568_TPL)
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/rk3588
|
||||
BUILD_SUBTARGET:=armv8
|
||||
ATF:=rk35/$(RK3588_ATF)
|
||||
TPL:=rk35/$(RK3588_TPL)
|
||||
endef
|
||||
|
||||
TFA_TARGETS:= \
|
||||
rk3328 \
|
||||
rk3399 \
|
||||
rk3566 \
|
||||
rk3568 \
|
||||
rk3588
|
||||
|
||||
define Build/Compile
|
||||
# This comment is the workaround for "extraneous 'endif'" error
|
||||
ifneq ($(LOADER),)
|
||||
( \
|
||||
pushd $(PKG_BUILD_DIR) ; \
|
||||
$(SED) 's,$$$$(PKG_BUILD_DIR),$(PKG_BUILD_DIR),g' trust.ini ; \
|
||||
$(SED) 's,$$$$(VARIANT),$(BUILD_VARIANT),g' trust.ini ; \
|
||||
./tools/mkimage -n $(BUILD_VARIANT) -T rksd -d bin/$(TPL) \
|
||||
$(BUILD_VARIANT)-idbloader.bin ; \
|
||||
cat bin/$(LOADER) >> $(BUILD_VARIANT)-idbloader.bin ; \
|
||||
./tools/trust_merger --replace bl31.elf bin/$(ATF) trust.ini ; \
|
||||
popd ; \
|
||||
)
|
||||
endif
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) -p $(STAGING_DIR_IMAGE)
|
||||
$(CP) $(PKG_BUILD_DIR)/rk*.elf $(STAGING_DIR_IMAGE)/
|
||||
define Package/trusted-firmware-a/install
|
||||
$(INSTALL_DIR) $(STAGING_DIR_IMAGE)
|
||||
|
||||
$(CP) $(PKG_BUILD_DIR)/bin/$(ATF) $(STAGING_DIR_IMAGE)/
|
||||
ifneq ($(LOADER),)
|
||||
$(CP) $(PKG_BUILD_DIR)/tools/loaderimage $(STAGING_DIR_IMAGE)/
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BUILD_VARIANT)-idbloader.bin $(STAGING_DIR_IMAGE)/
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BUILD_VARIANT)-trust.bin $(STAGING_DIR_IMAGE)/
|
||||
else
|
||||
$(CP) $(PKG_BUILD_DIR)/bin/$(TPL) $(STAGING_DIR_IMAGE)/
|
||||
endif
|
||||
endef
|
||||
|
||||
define Package/arm-trusted-firmware-rockchip/install
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,arm-trusted-firmware-rockchip))
|
||||
$(eval $(call BuildPackage/Trusted-Firmware-A))
|
||||
|
||||
16
package/boot/arm-trusted-firmware-rockchip/atf-version.mk
Normal file
16
package/boot/arm-trusted-firmware-rockchip/atf-version.mk
Normal file
@@ -0,0 +1,16 @@
|
||||
RK3328_ATF:=rk322xh_bl31_v1.49.elf
|
||||
RK3328_TPL:=rk3328_ddr_333MHz_v1.19.bin
|
||||
RK3328_LOADER:=rk322xh_miniloader_v2.50.bin
|
||||
|
||||
RK3399_ATF:=rk3399_bl31_v1.36.elf
|
||||
RK3399_TPL:=rk3399_ddr_800MHz_v1.30.bin
|
||||
RK3399_LOADER:=rk3399_miniloader_v1.30.bin
|
||||
|
||||
RK3566_ATF:=rk3568_bl31_v1.44.elf
|
||||
RK3566_TPL:=rk3566_ddr_1056MHz_v1.21.bin
|
||||
|
||||
RK3568_ATF:=rk3568_bl31_v1.44.elf
|
||||
RK3568_TPL:=rk3568_ddr_1560MHz_v1.21.bin
|
||||
|
||||
RK3588_ATF:=rk3588_bl31_v1.45.elf
|
||||
RK3588_TPL:=rk3588_ddr_lp4_2112MHz_lp5_2400MHz_v1.16.bin
|
||||
@@ -7,57 +7,48 @@
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=arm-trusted-firmware-sunxi
|
||||
PKG_VERSION:=2.10
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL=https://github.com/ARM-software/arm-trusted-firmware
|
||||
PKG_SOURCE_DATE:=2020-11-17
|
||||
PKG_SOURCE_VERSION:=e2c509a39c6cc4dda8734e6509cdbe6e3603cdfc
|
||||
PKG_MIRROR_HASH:=b212d369a5286ebbf6a5616486efa05fa54d4294fd6e9ba2e54fdfae9eda918d
|
||||
PKG_HASH:=88215a62291b9ba87da8e50b077741103cdc08fb6c9e1ebd34dfaace746d3201
|
||||
|
||||
PKG_LICENSE:=BSD-3-Clause
|
||||
PKG_LICENSE_FILES:=license.md
|
||||
|
||||
PKG_MAINTAINER:=Hauke Mehrtens <hauke@hauke-m.de>
|
||||
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
include $(INCLUDE_DIR)/trusted-firmware-a.mk
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
||||
define Package/arm-trusted-firmware-sunxi/Default
|
||||
SECTION:=boot
|
||||
CATEGORY:=Boot Loaders
|
||||
TITLE:=ARM Trusted Firmware for Allwinner
|
||||
DEPENDS:=@TARGET_sunxi_cortexa53
|
||||
define Trusted-Firmware-A/Default
|
||||
BUILD_TARGET:=sunxi
|
||||
BUILD_SUBTARGET:=cortexa53
|
||||
endef
|
||||
|
||||
define Package/arm-trusted-firmware-sunxi-a64
|
||||
$(call Package/arm-trusted-firmware-sunxi/Default)
|
||||
VARIANT:=sun50i_a64
|
||||
define Trusted-Firmware-A/sunxi-a64
|
||||
NAME:=Allwinner A64
|
||||
PLAT:=sun50i_a64
|
||||
endef
|
||||
|
||||
define Package/arm-trusted-firmware-sunxi-h6
|
||||
$(call Package/arm-trusted-firmware-sunxi/Default)
|
||||
VARIANT:=sun50i_h6
|
||||
define Trusted-Firmware-A/sunxi-h6
|
||||
NAME:=Allwinner H6
|
||||
PLAT:=sun50i_h6
|
||||
endef
|
||||
|
||||
export GCC_HONOUR_COPTS=s
|
||||
define Trusted-Firmware-A/sunxi-h616
|
||||
NAME:=Allwinner H616
|
||||
PLAT:=sun50i_h616
|
||||
endef
|
||||
|
||||
MAKE_VARS = \
|
||||
CROSS_COMPILE="$(TARGET_CROSS)"
|
||||
TFA_TARGETS:= \
|
||||
sunxi-a64 \
|
||||
sunxi-h6 \
|
||||
sunxi-h616
|
||||
|
||||
MAKE_FLAGS += \
|
||||
PLAT=$(BUILD_VARIANT) \
|
||||
bl31
|
||||
|
||||
define Build/InstallDev
|
||||
define Package/trusted-firmware-a/install
|
||||
$(INSTALL_DIR) $(STAGING_DIR_IMAGE)
|
||||
$(CP) $(PKG_BUILD_DIR)/build/$(BUILD_VARIANT)/release/bl31.bin $(STAGING_DIR_IMAGE)/bl31_$(BUILD_VARIANT).bin
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/build/$(PLAT)/release/bl31.bin $(STAGING_DIR_IMAGE)/bl31_$(BUILD_VARIANT).bin
|
||||
endef
|
||||
|
||||
define Package/arm-trusted-firmware-sunxi/install
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,arm-trusted-firmware-sunxi-a64))
|
||||
$(eval $(call BuildPackage,arm-trusted-firmware-sunxi-h6))
|
||||
$(eval $(call BuildPackage/Trusted-Firmware-A))
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=arm-trusted-firmware-tools
|
||||
PKG_VERSION:=2.4
|
||||
PKG_VERSION:=2.9
|
||||
PKG_RELEASE:=1
|
||||
PKG_HASH:=bf3eb3617a74cddd7fb0e0eacbfe38c3258ee07d4c8ed730deef7a175cc3d55b
|
||||
PKG_HASH:=76a66a1de0c01aeb83dfc7b72b51173fe62c6e51d6fca17cc562393117bed08b
|
||||
|
||||
PKG_MAINTAINER:=Daniel Golle <daniel@makrotopia.org>
|
||||
PKG_HOST_ONLY:=1
|
||||
@@ -34,23 +34,17 @@ define Host/Compile
|
||||
$(HOST_BUILD_DIR)/tools/fiptool \
|
||||
CPPFLAGS="$(HOST_CFLAGS)" \
|
||||
LDFLAGS="$(HOST_LDFLAGS)"
|
||||
$(MAKE) -C \
|
||||
$(HOST_BUILD_DIR)/tools/sptool \
|
||||
CPPFLAGS="$(HOST_CFLAGS)" \
|
||||
LDFLAGS="$(HOST_LDFLAGS)"
|
||||
endef
|
||||
|
||||
define Host/Install
|
||||
$(INSTALL_DIR) $(STAGING_DIR_HOST)/bin/
|
||||
$(INSTALL_BIN) $(HOST_BUILD_DIR)/tools/fiptool/fiptool $(STAGING_DIR_HOST)/bin/
|
||||
$(INSTALL_BIN) $(HOST_BUILD_DIR)/tools/sptool/sptool $(STAGING_DIR_HOST)/bin/
|
||||
$(INSTALL_BIN) $(HOST_BUILD_DIR)/tools/sptool/sp_mk_generator.py $(STAGING_DIR_HOST)/bin/
|
||||
$(INSTALL_BIN) $(HOST_BUILD_DIR)/tools/sptool/sptool.py $(STAGING_DIR_HOST)/bin/
|
||||
endef
|
||||
|
||||
define Host/Clean
|
||||
rm -f $(STAGING_DIR_HOST)/bin/fiptool
|
||||
rm -f $(STAGING_DIR_HOST)/bin/sptool
|
||||
rm -f $(STAGING_DIR_HOST)/bin/sp_mk_generator.py
|
||||
rm -f $(STAGING_DIR_HOST)/bin/sptool.py $(STAGING_DIR_HOST)/bin/sptool
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,arm-trusted-firmware-tools))
|
||||
|
||||
@@ -1,29 +1,31 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
# Copyright (C) 2006-2015 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
# Copyright (C) 2006-2021 OpenWrt.org
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=grub
|
||||
PKG_CPE_ID:=cpe:/a:gnu:grub2
|
||||
PKG_VERSION:=2.06
|
||||
PKG_RELEASE:=1
|
||||
PKG_VERSION:=2.12
|
||||
PKG_RELEASE:=6
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
|
||||
PKG_SOURCE_URL:=@GNU/grub
|
||||
PKG_HASH:=b79ea44af91b93d17cd3fe80bdae6ed43770678a9a5ae192ccea803ebb657ee1
|
||||
PKG_HASH:=f3c97391f7c4eaa677a78e090c7e97e6dc47b16f655f04683ebd37bef7fe0faa
|
||||
|
||||
PKG_LICENSE:=GPL-3.0-or-later
|
||||
PKG_CPE_ID:=cpe:/a:gnu:grub2
|
||||
|
||||
HOST_BUILD_PARALLEL:=1
|
||||
PKG_BUILD_DEPENDS:=grub2/host
|
||||
|
||||
ifneq ($(BUILD_VARIANT),none)
|
||||
PKG_ASLR_PIE:=0
|
||||
PKG_SSP:=0
|
||||
endif
|
||||
|
||||
PKG_FLAGS:=nonshared
|
||||
PKG_BUILD_FLAGS:=no-gc-sections no-lto no-mold
|
||||
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
@@ -31,14 +33,18 @@ include $(INCLUDE_DIR)/package.mk
|
||||
define Package/grub2/Default
|
||||
CATEGORY:=Boot Loaders
|
||||
SECTION:=boot
|
||||
TITLE:=GRand Unified Bootloader ($(1))
|
||||
TITLE:=GRand Unified Bootloader ($(2))
|
||||
URL:=http://www.gnu.org/software/grub/
|
||||
DEPENDS:=@TARGET_x86
|
||||
VARIANT:=$(1)
|
||||
DEPENDS:=@(TARGET_x86||TARGET_armsr||TARGET_armvirt||TARGET_phytium_armv8||TARGET_loongarch64)
|
||||
VARIANT:=$(2)
|
||||
endef
|
||||
|
||||
Package/grub2=$(call Package/grub2/Default,pc)
|
||||
Package/grub2-efi=$(call Package/grub2/Default,efi)
|
||||
Package/grub2=$(call Package/grub2/Default,x86,pc)
|
||||
Package/grub2-efi=$(call Package/grub2/Default,x86,efi)
|
||||
Package/grub2-efi-arm=$(call Package/grub2/Default,armsr,efi)
|
||||
Package/grub2-efi-arm=$(call Package/grub2/Default,armvirt,efi)
|
||||
Package/grub2-efi-arm=$(call Package/grub2/Default,phytium_armv8,efi)
|
||||
Package/grub2-efi-loongarch64=$(call Package/grub2/Default,loongarch64,efi)
|
||||
|
||||
define Package/grub2-editenv
|
||||
CATEGORY:=Utilities
|
||||
@@ -47,13 +53,27 @@ define Package/grub2-editenv
|
||||
TITLE:=Grub2 Environment editor
|
||||
URL:=http://www.gnu.org/software/grub/
|
||||
DEPENDS:=@TARGET_x86
|
||||
VARIANT:=pc
|
||||
VARIANT:=none
|
||||
endef
|
||||
|
||||
define Package/grub2-editenv/description
|
||||
Edit grub2 environment files.
|
||||
endef
|
||||
|
||||
define Package/grub2-bios-setup
|
||||
CATEGORY:=Utilities
|
||||
SECTION:=utils
|
||||
SUBMENU:=Boot Loaders
|
||||
TITLE:=Grub2 BIOS boot setup tool
|
||||
URL:=http://www.gnu.org/software/grub/
|
||||
DEPENDS:=@TARGET_x86
|
||||
VARIANT:=none
|
||||
endef
|
||||
|
||||
define Package/grub2-bios-setup/description
|
||||
Set up images to bootable.
|
||||
endef
|
||||
|
||||
HOST_BUILD_PREFIX := $(STAGING_DIR_HOST)
|
||||
|
||||
CONFIGURE_VARS += \
|
||||
@@ -85,7 +105,15 @@ HOST_MAKE_FLAGS += \
|
||||
TARGET_RANLIB=$(TARGET_RANLIB) \
|
||||
LIBLZMA=$(STAGING_DIR_HOST)/lib/liblzma.a
|
||||
|
||||
|
||||
ifneq ($(BUILD_VARIANT),none)
|
||||
TARGET_CFLAGS := $(filter-out -O2 -O3 -fno-plt,$(TARGET_CFLAGS))
|
||||
MAKE_PATH := grub-core
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_arm),y)
|
||||
TARGET_CFLAGS := $(filter-out -mfloat-abi=hard,$(TARGET_CFLAGS))
|
||||
endif
|
||||
|
||||
define Host/Configure
|
||||
$(SED) 's,(RANLIB),(TARGET_RANLIB),' $(HOST_BUILD_DIR)/grub-core/Makefile.in
|
||||
@@ -93,8 +121,6 @@ define Host/Configure
|
||||
endef
|
||||
|
||||
define Package/grub2/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/grub-bios-setup $(1)/usr/sbin/
|
||||
$(INSTALL_DIR) $(STAGING_DIR_IMAGE)/grub2
|
||||
$(CP) $(PKG_BUILD_DIR)/grub-core/boot.img $(STAGING_DIR_IMAGE)/grub2/
|
||||
$(CP) $(PKG_BUILD_DIR)/grub-core/cdboot.img $(STAGING_DIR_IMAGE)/grub2/
|
||||
@@ -105,14 +131,14 @@ define Package/grub2/install
|
||||
-O i386-pc \
|
||||
-c $(PKG_BUILD_DIR)/grub-early.cfg \
|
||||
-o $(STAGING_DIR_IMAGE)/grub2/gpt-core.img \
|
||||
at_keyboard biosdisk boot chain configfile fat linux ls part_gpt reboot search serial vga
|
||||
at_keyboard biosdisk boot chain configfile fat linux ls part_gpt reboot search serial test vga
|
||||
$(STAGING_DIR_HOST)/bin/grub-mkimage \
|
||||
-d $(PKG_BUILD_DIR)/grub-core \
|
||||
-p /boot/grub \
|
||||
-O i386-pc \
|
||||
-c ./files/grub-early.cfg \
|
||||
-o $(STAGING_DIR_IMAGE)/grub2/generic-core.img \
|
||||
at_keyboard biosdisk boot chain configfile ext2 linux ls part_msdos reboot search serial vga
|
||||
at_keyboard biosdisk boot chain configfile ext2 linux ls part_msdos reboot search serial test vga
|
||||
$(STAGING_DIR_HOST)/bin/grub-mkimage \
|
||||
-d $(PKG_BUILD_DIR)/grub-core \
|
||||
-p /boot/grub \
|
||||
@@ -137,22 +163,65 @@ define Package/grub2-efi/install
|
||||
-O $(CONFIG_ARCH)-efi \
|
||||
-c $(PKG_BUILD_DIR)/grub-early.cfg \
|
||||
-o $(STAGING_DIR_IMAGE)/grub2/boot$(if $(CONFIG_x86_64),x64,ia32).efi \
|
||||
at_keyboard boot chain configfile fat linux ls part_gpt reboot serial efi_gop efi_uga
|
||||
at_keyboard boot chain configfile fat linux ls part_gpt reboot serial test efi_gop efi_uga
|
||||
$(STAGING_DIR_HOST)/bin/grub-mkimage \
|
||||
-d $(PKG_BUILD_DIR)/grub-core \
|
||||
-p /boot/grub \
|
||||
-O $(CONFIG_ARCH)-efi \
|
||||
-c ./files/grub-early.cfg \
|
||||
-o $(STAGING_DIR_IMAGE)/grub2/iso-boot$(if $(CONFIG_x86_64),x64,ia32).efi \
|
||||
at_keyboard boot chain configfile fat iso9660 linux ls part_msdos part_gpt reboot serial test efi_gop efi_uga
|
||||
boot chain configfile fat iso9660 linux ls part_msdos part_gpt reboot serial test efi_gop efi_uga
|
||||
endef
|
||||
|
||||
define Package/grub2-efi-arm/install
|
||||
$(INSTALL_DIR) $(STAGING_DIR_IMAGE)/grub2
|
||||
cp ./files/grub-early-gpt.cfg $(PKG_BUILD_DIR)/grub-early.cfg
|
||||
$(STAGING_DIR_HOST)/bin/grub-mkimage \
|
||||
-d $(PKG_BUILD_DIR)/grub-core \
|
||||
-p /boot/grub \
|
||||
-O arm$(if $(CONFIG_aarch64),64,)-efi \
|
||||
-c $(PKG_BUILD_DIR)/grub-early.cfg \
|
||||
-o $(STAGING_DIR_IMAGE)/grub2/boot$(if $(CONFIG_aarch64),aa64,arm).efi \
|
||||
boot chain configfile fat linux ls part_gpt part_msdos reboot search \
|
||||
search_fs_uuid search_label serial efi_gop lsefi minicmd ext2
|
||||
$(STAGING_DIR_HOST)/bin/grub-mkimage \
|
||||
-d $(PKG_BUILD_DIR)/grub-core \
|
||||
-p /boot/grub \
|
||||
-O arm$(if $(CONFIG_aarch64),64,)-efi \
|
||||
-c ./files/grub-early.cfg \
|
||||
-o $(STAGING_DIR_IMAGE)/grub2/iso-bootaa$(if $(CONFIG_aarch64),aa64,arm).efi \
|
||||
boot chain configfile fat iso9660 linux ls lsefi minicmd part_msdos part_gpt \
|
||||
reboot serial test efi_gop
|
||||
endef
|
||||
|
||||
define Package/grub2-efi-loongarch64/install
|
||||
$(INSTALL_DIR) $(STAGING_DIR_IMAGE)/grub2
|
||||
cp ./files/grub-early-gpt.cfg $(PKG_BUILD_DIR)/grub-early.cfg
|
||||
$(STAGING_DIR_HOST)/bin/grub-mkimage \
|
||||
-d $(PKG_BUILD_DIR)/grub-core \
|
||||
-p /boot/grub \
|
||||
-O loongarch64-efi \
|
||||
-c $(PKG_BUILD_DIR)/grub-early.cfg \
|
||||
-o $(STAGING_DIR_IMAGE)/grub2/bootloongarch64.efi \
|
||||
boot chain configfile fat linux ls lsefi minicmd part_gpt part_msdos reboot search \
|
||||
search_fs_uuid search_label serial efi_gop all_video gfxterm ext2
|
||||
endef
|
||||
|
||||
|
||||
define Package/grub2-editenv/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/grub-editenv $(1)/usr/sbin/
|
||||
endef
|
||||
|
||||
define Package/grub2-bios-setup/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/grub-bios-setup $(1)/usr/sbin/
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
$(eval $(call BuildPackage,grub2))
|
||||
$(eval $(call BuildPackage,grub2-efi))
|
||||
$(eval $(call BuildPackage,grub2-efi-arm))
|
||||
$(eval $(call BuildPackage,grub2-efi-loongarch64))
|
||||
$(eval $(call BuildPackage,grub2-editenv))
|
||||
$(eval $(call BuildPackage,grub2-bios-setup))
|
||||
|
||||
2
package/boot/grub2/files/grub-early-gpt.cfg
Normal file
2
package/boot/grub2/files/grub-early-gpt.cfg
Normal file
@@ -0,0 +1,2 @@
|
||||
search --set=root --label kernel
|
||||
configfile ($root)/efi/openwrt/grub.cfg
|
||||
@@ -0,0 +1,36 @@
|
||||
From 4d4dae6a52b1749642261a15f5dcc1e3d4150b36 Mon Sep 17 00:00:00 2001
|
||||
From: Julien Olivain <ju.o@free.fr>
|
||||
Date: Fri, 22 Dec 2023 19:02:53 +0100
|
||||
Subject: [PATCH] Add missing grub-core/extra_deps.lst file in release tarball
|
||||
|
||||
A file is missing in the grub-2.12 release tarballs (both .gz and .xz).
|
||||
See [1]. The issue was reported in [2] and fixed upstream in [3].
|
||||
|
||||
This patch adds the missing file, on top of the release tarball. This
|
||||
patch won't apply on upstream git, since the file is present in the
|
||||
source repository. Since the issue is fixed upstream in [3], it is
|
||||
expected upcoming releases tarballs will include the file.
|
||||
|
||||
The file content was fetched from the upstream git repo:
|
||||
https://git.savannah.gnu.org/gitweb/?p=grub.git;a=blob_plain;f=grub-core/extra_deps.lst;hb=refs/tags/grub-2.12
|
||||
|
||||
[1] https://ftp.gnu.org/gnu/grub/grub-2.12.tar.xz
|
||||
[2] https://lists.gnu.org/archive/html/grub-devel/2023-12/msg00054.html
|
||||
[3] https://git.savannah.gnu.org/gitweb/?p=grub.git;a=commit;h=b835601c7639ed1890f2d3db91900a8506011a8e
|
||||
|
||||
Signed-off-by: Julien Olivain <ju.o@free.fr>
|
||||
Upstream: Fixed by: https://git.savannah.gnu.org/gitweb/?p=grub.git;a=commit;h=b835601c7639ed1890f2d3db91900a8506011a8e
|
||||
---
|
||||
grub-core/extra_deps.lst | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
create mode 100644 grub-core/extra_deps.lst
|
||||
|
||||
diff --git a/grub-core/extra_deps.lst b/grub-core/extra_deps.lst
|
||||
new file mode 100644
|
||||
index 0000000..f44ad6a
|
||||
--- /dev/null
|
||||
+++ b/grub-core/extra_deps.lst
|
||||
@@ -0,0 +1 @@
|
||||
+depends bli part_gpt
|
||||
--
|
||||
2.43.0
|
||||
63
package/boot/opensbi/Makefile
Normal file
63
package/boot/opensbi/Makefile
Normal file
@@ -0,0 +1,63 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
# Copyright (C) 2022 OpenWrt.org
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=opensbi
|
||||
PKG_RELEASE:=1.2
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL=https://github.com/riscv/opensbi
|
||||
PKG_SOURCE_DATE:=2022-12-24
|
||||
PKG_SOURCE_VERSION:=6b5188ca14e59ce7bf71afe4e7d3d557c3d31bf8
|
||||
PKG_MIRROR_HASH:=edcdd99da6c62975171981c0aa2b73a27091067da11ccd49816b5ad27d000858
|
||||
|
||||
PKG_BUILD_DIR=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_TARGETS:=bin
|
||||
PKG_FLAGS:=nonshared
|
||||
PKG_LICENSE:=BSD-2-Clause
|
||||
PKG_LICENSE_FILES:=COPYING.BSD
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
PKG_MAINTAINER:=Zoltan HERPAI <wigyori@uid0.hu>
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/opensbi
|
||||
SECTION:=boot
|
||||
CATEGORY:=Boot Loaders
|
||||
DEPENDS:=@TARGET_sifiveu
|
||||
URL:=https://github.com/riscv/opensbi/blob/master/README.md
|
||||
VARIANT:=$(subst _,/,$(subst opensbi_,,$(1)))
|
||||
TITLE:=OpenSBI generic
|
||||
OPENSBI_IMAGE:=
|
||||
PLAT:=
|
||||
endef
|
||||
|
||||
define Package/opensbi_generic
|
||||
$(Package/opensbi)
|
||||
TITLE:=OpenSBI generic
|
||||
OPENSBI_IMAGE:=fw_dynamic.bin
|
||||
PLAT:=generic
|
||||
endef
|
||||
|
||||
export GCC_HONOUR_COPTS=s
|
||||
|
||||
MAKE_VARS = \
|
||||
CROSS_COMPILE="$(TARGET_CROSS)"
|
||||
|
||||
define Build/Compile
|
||||
$(eval $(Package/opensbi_$(BUILD_VARIANT))) \
|
||||
+$(MAKE_VARS) $(MAKE) -C $(PKG_BUILD_DIR) \
|
||||
PLATFORM=$(PLAT)
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(STAGING_DIR_IMAGE)
|
||||
$(CP) $(PKG_BUILD_DIR)/build/platform/$(PLAT)/firmware/fw_dynamic.bin $(STAGING_DIR_IMAGE)/fw_dynamic-${BUILD_VARIANT}.bin
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,opensbi_generic))
|
||||
57
package/boot/uboot-amlogic/Makefile
Normal file
57
package/boot/uboot-amlogic/Makefile
Normal file
@@ -0,0 +1,57 @@
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_VERSION:=20240315
|
||||
PKG_RELEASE:=$(AUTORELEASE)
|
||||
|
||||
PKG_SOURCE_PROTO:=default
|
||||
PKG_SOURCE:=ophub-uboot-prebuilt-git-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_VERSION:=abe491ab386607f9ab0d66728e5766bc5d7e8a20
|
||||
PKG_SOURCE_URL_FILE:=$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://github.com/ophub/u-boot/archive/
|
||||
PKG_HASH:=3f98f5728f48d13f33cf4fd21fb6032a625ad3c61aa2e8073dda821f71f067ec
|
||||
|
||||
PKG_MAINTAINER:=ophub
|
||||
|
||||
include $(INCLUDE_DIR)/u-boot.mk
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
TAR_OPTIONS:=--strip-components 1 $(TAR_OPTIONS)
|
||||
TAR_CMD=$(HOST_TAR) -C $(1) $(TAR_OPTIONS)
|
||||
|
||||
define U-Boot/Default
|
||||
BUILD_TARGET:=amlogic
|
||||
UENV:=default
|
||||
HIDDEN:=1
|
||||
DEFAULT:=y
|
||||
endef
|
||||
|
||||
define U-Boot/phicomm-n1
|
||||
NAME:=Phicomm N1
|
||||
OVERLAY:=u-boot-n1.bin
|
||||
BUILD_SUBTARGET:=mesongx
|
||||
BUILD_DEVICES:=phicomm_n1
|
||||
endef
|
||||
|
||||
UBOOT_TARGETS := phicomm-n1
|
||||
|
||||
define Build/Configure
|
||||
true
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
true
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(STAGING_DIR_IMAGE)
|
||||
$(CP) $(PKG_BUILD_DIR)/u-boot/amlogic/overload/$(OVERLAY) $(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-u-boot-overlay.bin
|
||||
endef
|
||||
|
||||
define Package/u-boot/install/default
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage/U-Boot))
|
||||
@@ -9,15 +9,15 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=uboot-envtools
|
||||
PKG_DISTNAME:=u-boot
|
||||
PKG_VERSION:=2021.01
|
||||
PKG_RELEASE:=$(AUTORELEASE)
|
||||
PKG_VERSION:=2023.01
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_DISTNAME)-$(PKG_VERSION).tar.bz2
|
||||
PKG_SOURCE_URL:= \
|
||||
https://ftp.denx.de/pub/u-boot \
|
||||
https://mirror.cyberbits.eu/u-boot \
|
||||
ftp://ftp.denx.de/pub/u-boot
|
||||
PKG_HASH:=b407e1510a74e863b8b5cb42a24625344f0e0c2fc7582d8c866bd899367d0454
|
||||
PKG_HASH:=69423bad380f89a0916636e89e6dcbd2e4512d584308d922d1039d1e4331950f
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_DISTNAME)-$(PKG_VERSION)
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_DISTNAME)-$(PKG_VERSION)
|
||||
|
||||
|
||||
@@ -19,6 +19,10 @@ netgear,wndap620|\
|
||||
netgear,wndap660)
|
||||
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x4000" "0x4000" "4"
|
||||
;;
|
||||
wd,mybooklive)
|
||||
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x1000" "1"
|
||||
ubootenv_add_uci_config "/dev/mtd1" "0x1000" "0x1000" "0x1000" "1"
|
||||
;;
|
||||
esac
|
||||
|
||||
config_load ubootenv
|
||||
|
||||
@@ -18,10 +18,16 @@ alfa-network,n2q|\
|
||||
alfa-network,n5q|\
|
||||
alfa-network,pi-wifi4|\
|
||||
alfa-network,r36a|\
|
||||
alfa-network,tube-2hq|\
|
||||
allnet,all-wap02860ac|\
|
||||
araknis,an-300-ap-i-n|\
|
||||
araknis,an-500-ap-i-ac|\
|
||||
araknis,an-700-ap-i-ac|\
|
||||
arduino,yun|\
|
||||
buffalo,bhr-4grv2|\
|
||||
devolo,magic-2-wifi|\
|
||||
engenius,eap1200h|\
|
||||
engenius,eap1750h|\
|
||||
engenius,eap300-v2|\
|
||||
engenius,eap350-v1|\
|
||||
engenius,eap600|\
|
||||
@@ -38,6 +44,7 @@ glinet,gl-ar750s-nor-nand|\
|
||||
librerouter,librerouter-v1|\
|
||||
netgear,ex6400|\
|
||||
netgear,ex7300|\
|
||||
netgear,ex7300-v2|\
|
||||
netgear,wndr4300-v2|\
|
||||
netgear,wndr4500-v3|\
|
||||
netgear,wnr1000-v2|\
|
||||
@@ -49,11 +56,33 @@ ocedo,koala|\
|
||||
ocedo,raccoon|\
|
||||
openmesh,a40|\
|
||||
openmesh,a60|\
|
||||
openmesh,mr600-v1|\
|
||||
openmesh,mr600-v2|\
|
||||
openmesh,mr900-v1|\
|
||||
openmesh,mr900-v2|\
|
||||
openmesh,mr1750-v1|\
|
||||
openmesh,mr1750-v2|\
|
||||
openmesh,om5p|\
|
||||
openmesh,om5p-an|\
|
||||
openmesh,om5p-ac-v1|\
|
||||
openmesh,om5p-ac-v2|\
|
||||
samsung,wam250|\
|
||||
ubnt,airrouter|\
|
||||
ubnt,bullet-m-ar7240|\
|
||||
ubnt,bullet-m-ar7241|\
|
||||
ubnt,nanobridge-m|\
|
||||
ubnt,nanostation-loco-m|\
|
||||
ubnt,nanostation-m|\
|
||||
ubnt,picostation-m|\
|
||||
ubnt,powerbridge-m|\
|
||||
ubnt,rocket-m|\
|
||||
watchguard,ap100|\
|
||||
watchguard,ap200|\
|
||||
watchguard,ap300|\
|
||||
yuncore,a770|\
|
||||
yuncore,a782|\
|
||||
yuncore,a930|\
|
||||
yuncore,xd3200|\
|
||||
yuncore,xd4200|\
|
||||
ziking,cpe46b|\
|
||||
zyxel,nbg6616)
|
||||
@@ -63,15 +92,15 @@ buffalo,wzr-hp-ag300h)
|
||||
ubootenv_add_uci_config "/dev/mtd3" "0x0" "0x10000" "0x10000"
|
||||
;;
|
||||
buffalo,wzr-hp-g300nh-rb|\
|
||||
buffalo,wzr-hp-g300nh-s)
|
||||
buffalo,wzr-hp-g300nh-s|\
|
||||
linksys,ea4500-v3)
|
||||
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000"
|
||||
;;
|
||||
domywifi,dw33d)
|
||||
ubootenv_add_uci_config "/dev/mtd4" "0x0" "0x10000" "0x10000"
|
||||
;;
|
||||
glinet,gl-ar150)
|
||||
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x8000" "0x10000"
|
||||
;;
|
||||
dongwon,dw02-412h-64m|\
|
||||
dongwon,dw02-412h-128m|\
|
||||
glinet,gl-ar300m-lite|\
|
||||
glinet,gl-ar300m-nand|\
|
||||
glinet,gl-ar300m-nor|\
|
||||
@@ -80,17 +109,22 @@ glinet,gl-ar300m16)
|
||||
[ -n "$idx" ] && \
|
||||
ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x10000" "0x10000"
|
||||
;;
|
||||
glinet,gl-ar150)
|
||||
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x8000" "0x10000"
|
||||
;;
|
||||
netgear,wndr3700|\
|
||||
netgear,wndr3700-v2|\
|
||||
netgear,wndrmac-v1)
|
||||
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x10000"
|
||||
;;
|
||||
netgear,pgzng1|\
|
||||
netgear,wndr3700-v4|\
|
||||
netgear,wndr4300|\
|
||||
netgear,wndr4300tn|\
|
||||
netgear,wndr4300sw)
|
||||
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x40000" "0x20000"
|
||||
;;
|
||||
openmesh,om2p-v1|\
|
||||
openmesh,om2p-v2|\
|
||||
openmesh,om2p-v4|\
|
||||
openmesh,om2p-hs-v1|\
|
||||
@@ -105,9 +139,28 @@ plasmacloud,pa300e)
|
||||
qihoo,c301)
|
||||
ubootenv_add_uci_config "/dev/mtd9" "0x0" "0x10000" "0x10000"
|
||||
;;
|
||||
ruckus,zf7025)
|
||||
ubootenv_add_uci_config "/dev/mtd5" "0x0" "0x40000" "0x40000"
|
||||
;;
|
||||
ruckus,zf7321|\
|
||||
ruckus,zf7372)
|
||||
ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x40000" "0x10000"
|
||||
;;
|
||||
sophos,ap15|\
|
||||
sophos,ap55|\
|
||||
sophos,ap55c|\
|
||||
sophos,ap100|\
|
||||
sophos,ap100c)
|
||||
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x10000"
|
||||
;;
|
||||
wallys,dr531)
|
||||
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0xf800" "0x10000"
|
||||
;;
|
||||
zte,mf286|\
|
||||
zte,mf286a|\
|
||||
zte,mf286r)
|
||||
ubootenv_add_uci_config "/dev/mtd7" "0x0" "0x20000" "0x10000"
|
||||
;;
|
||||
esac
|
||||
|
||||
config_load ubootenv
|
||||
|
||||
19
package/boot/uboot-envtools/files/imx_cortexa7
Normal file
19
package/boot/uboot-envtools/files/imx_cortexa7
Normal file
@@ -0,0 +1,19 @@
|
||||
[ -e /etc/config/ubootenv ] && exit 0
|
||||
|
||||
touch /etc/config/ubootenv
|
||||
|
||||
. /lib/uboot-envtools.sh
|
||||
. /lib/functions.sh
|
||||
|
||||
board=$(board_name)
|
||||
|
||||
case "$board" in
|
||||
technexion,imx7d-pico-pi)
|
||||
ubootenv_add_uci_config "/dev/mmcblk2" "0xc0000" "0x2000" "0x2000"
|
||||
;;
|
||||
esac
|
||||
|
||||
config_load ubootenv
|
||||
config_foreach ubootenv_add_app_config ubootenv
|
||||
|
||||
exit 0
|
||||
@@ -26,25 +26,49 @@ ubootenv_mtdinfo () {
|
||||
fi
|
||||
|
||||
sectors=$(( $ubootenv_size / $mtd_erase ))
|
||||
sectors=$(printf "0x%x" $sectors )
|
||||
echo /dev/$mtd_dev 0x0 $ubootenv_size $mtd_erase $sectors
|
||||
}
|
||||
|
||||
case "$board" in
|
||||
alfa-network,ap120c-ac|\
|
||||
devolo,magic-2-wifi-next|\
|
||||
edgecore,ecw5211|\
|
||||
glinet,gl-a1300 |\
|
||||
glinet,gl-ap1300|\
|
||||
glinet,gl-b1300|\
|
||||
glinet,gl-b2200|\
|
||||
luma,wrtq-329acn|\
|
||||
netgear,wac510|\
|
||||
openmesh,a42|\
|
||||
openmesh,a62)
|
||||
openmesh,a62|\
|
||||
pakedge,wr-1|\
|
||||
plasmacloud,pa1200|\
|
||||
plasmacloud,pa2200)
|
||||
ubootenv_add_uci_config "/dev/mtd5" "0x0" "0x10000" "0x10000"
|
||||
;;
|
||||
aruba,ap-303)
|
||||
ubootenv_add_uci_config "/dev/mtd13" "0x0" "0x10000" "0x10000"
|
||||
;;
|
||||
aruba,ap-365)
|
||||
ubootenv_add_uci_config "/dev/mtd8" "0x0" "0x10000" "0x10000"
|
||||
;;
|
||||
buffalo,wtr-m2133hp)
|
||||
ubootenv_add_uci_config "/dev/mtd8" "0x0" "0x40000" "0x20000"
|
||||
;;
|
||||
linksys,ea6350v3)
|
||||
ubootenv_add_uci_config "/dev/mtd7" "0x0" "0x20000" "0x20000"
|
||||
;;
|
||||
linksys,ea8300)
|
||||
linksys,ea8300|\
|
||||
linksys,mr8300)
|
||||
ubootenv_add_uci_config "/dev/mtd7" "0x0" "0x40000" "0x20000"
|
||||
;;
|
||||
linksys,whw01)
|
||||
ubootenv_add_uci_config "/dev/mtd6" "0x0" "0x40000" "0x10000"
|
||||
;;
|
||||
linksys,whw03v2)
|
||||
ubootenv_add_uci_config "/dev/mtd6" "0x0" "0x80000" "0x20000"
|
||||
;;
|
||||
zyxel,nbg6617)
|
||||
ubootenv_add_uci_config "/dev/mtd6" "0x0" "0x10000" "0x10000"
|
||||
;;
|
||||
|
||||
19
package/boot/uboot-envtools/files/ipq60xx
Normal file
19
package/boot/uboot-envtools/files/ipq60xx
Normal file
@@ -0,0 +1,19 @@
|
||||
[ -e /etc/config/ubootenv ] && exit 0
|
||||
|
||||
touch /etc/config/ubootenv
|
||||
|
||||
. /lib/uboot-envtools.sh
|
||||
. /lib/functions.sh
|
||||
|
||||
board=$(board_name)
|
||||
|
||||
case "$board" in
|
||||
linksys,mr7350)
|
||||
ubootenv_add_uci_config "/dev/mtd11" "0x0" "0x40000" "0x20000"
|
||||
;;
|
||||
esac
|
||||
|
||||
config_load ubootenv
|
||||
config_foreach ubootenv_add_app_config ubootenv
|
||||
|
||||
exit 0
|
||||
@@ -26,6 +26,7 @@ ubootenv_mtdinfo () {
|
||||
fi
|
||||
|
||||
sectors=$(( $ubootenv_size / $mtd_erase ))
|
||||
sectors=$(printf "0x%x" $sectors )
|
||||
echo /dev/$mtd_dev 0x0 $ubootenv_size $mtd_erase $sectors
|
||||
}
|
||||
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
[ -e /etc/config/ubootenv ] && exit 0
|
||||
|
||||
touch /etc/config/ubootenv
|
||||
|
||||
. /lib/uboot-envtools.sh
|
||||
. /lib/functions.sh
|
||||
|
||||
board=$(board_name)
|
||||
|
||||
case "$board" in
|
||||
redmi,ax6|\
|
||||
xiaomi,ax3600|\
|
||||
xiaomi,ax9000)
|
||||
idx="$(find_mtd_index 0:appsblenv)"
|
||||
[ -n "$idx" ] && \
|
||||
ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x10000" "0x20000"
|
||||
;;
|
||||
qnap,301w)
|
||||
idx="$(find_mtd_index 0:appsblenv)"
|
||||
[ -n "$idx" ] && \
|
||||
ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x20000" "0x20000" "1"
|
||||
;;
|
||||
esac
|
||||
|
||||
config_load ubootenv
|
||||
config_foreach ubootenv_add_app_config ubootenv
|
||||
|
||||
exit 0
|
||||
@@ -19,6 +19,7 @@ globalscale,sheevaplug|\
|
||||
iom,ix2-200|\
|
||||
linksys,e4200-v2|\
|
||||
linksys,ea4500|\
|
||||
netgear,readynas-duo-v2|\
|
||||
raidsonic,ib-nas62x0|\
|
||||
seagate,dockstar|\
|
||||
zyxel,nsa310b|\
|
||||
|
||||
62
package/boot/uboot-envtools/files/mediatek_filogic
Normal file
62
package/boot/uboot-envtools/files/mediatek_filogic
Normal file
@@ -0,0 +1,62 @@
|
||||
#
|
||||
# Copyright (C) 2021 OpenWrt.org
|
||||
#
|
||||
|
||||
[ -e /etc/config/ubootenv ] && exit 0
|
||||
|
||||
touch /etc/config/ubootenv
|
||||
|
||||
. /lib/uboot-envtools.sh
|
||||
. /lib/functions.sh
|
||||
|
||||
board=$(board_name)
|
||||
|
||||
case "$board" in
|
||||
bananapi,bpi-r3|\
|
||||
bananapi,bpi-r4|\
|
||||
bananapi,bpi-r4-poe)
|
||||
case "$(cmdline_get_var root)" in
|
||||
/dev/mmc*)
|
||||
local envdev=$(find_mmc_part "ubootenv" $rootdev)
|
||||
ubootenv_add_uci_config "$envdev" "0x0" "0x40000" "0x40000" "1"
|
||||
ubootenv_add_uci_config "$envdev" "0x40000" "0x40000" "0x40000" "1"
|
||||
;;
|
||||
/dev/mtd*)
|
||||
local envdev=/dev/mtd$(find_mtd_index "u-boot-env")
|
||||
ubootenv_add_uci_config "$envdev" "0x0" "0x20000" "0x20000" "1"
|
||||
ubootenv_add_uci_config "$envdev" "0x20000" "0x20000" "0x20000" "1"
|
||||
;;
|
||||
/dev/ubi*)
|
||||
. /lib/upgrade/nand.sh
|
||||
local envubi=$(nand_find_ubi ubi)
|
||||
local envdev=/dev/$(nand_find_volume $envubi ubootenv)
|
||||
local envdev2=/dev/$(nand_find_volume $envubi ubootenv2)
|
||||
ubootenv_add_uci_config "$envdev" "0x0" "0x1f000" "0x1f000" "1"
|
||||
ubootenv_add_uci_config "$envdev2" "0x0" "0x1f000" "0x1f000" "1"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
cetron,ct3003|\
|
||||
imou,lc-hx3001)
|
||||
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000"
|
||||
;;
|
||||
glinet,gl-mt2500|\
|
||||
glinet,gl-mt6000)
|
||||
local envdev=$(find_mmc_part "u-boot-env")
|
||||
ubootenv_add_uci_config "$envdev" "0x0" "0x80000"
|
||||
;;
|
||||
glinet,gl-mt3000)
|
||||
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x20000"
|
||||
;;
|
||||
xiaomi,mi-router-wr30u|\
|
||||
xiaomi,mi-router-ax3000t|\
|
||||
xiaomi,redmi-router-ax6000)
|
||||
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x20000"
|
||||
ubootenv_add_uci_sys_config "/dev/mtd2" "0x0" "0x10000" "0x20000"
|
||||
;;
|
||||
esac
|
||||
|
||||
config_load ubootenv
|
||||
config_foreach ubootenv_add_app_config
|
||||
|
||||
exit 0
|
||||
@@ -17,16 +17,13 @@ linksys,e8450-ubi)
|
||||
ubootenv_add_uci_config "/dev/ubi0_1" "0x0" "0x1f000" "0x1f000" "1"
|
||||
;;
|
||||
bananapi,bpi-r64)
|
||||
. /lib/upgrade/common.sh
|
||||
export_bootdevice
|
||||
export_partdevice rootdev 0
|
||||
case "$rootdev" in
|
||||
mmc*)
|
||||
case "$(cmdline_get_var root)" in
|
||||
/dev/mmc*)
|
||||
local envdev=$(find_mmc_part "ubootenv" $rootdev)
|
||||
ubootenv_add_uci_config "$envdev" "0x0" "0x80000" "0x80000" "1"
|
||||
ubootenv_add_uci_config "$envdev" "0x80000" "0x80000" "0x80000" "1"
|
||||
;;
|
||||
*)
|
||||
/dev/ubi*)
|
||||
ubootenv_add_uci_config "/dev/ubi0_0" "0x0" "0x1f000" "0x1f000" "1"
|
||||
ubootenv_add_uci_config "/dev/ubi0_1" "0x0" "0x1f000" "0x1f000" "1"
|
||||
;;
|
||||
@@ -35,8 +32,11 @@ bananapi,bpi-r64)
|
||||
buffalo,wsr-2533dhp2)
|
||||
ubootenv_add_uci_config "/dev/mtd3" "0x0" "0x1000" "0x20000"
|
||||
;;
|
||||
ruijie,rg-ew3200gx-pro)
|
||||
ubootenv_add_uci_config "/dev/mtd3" "0x0" "0x20000" "0x20000"
|
||||
;;
|
||||
ubnt,unifi-6-lr-ubootmod)
|
||||
ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x4000" "0x10000"
|
||||
ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x4000" "0x1000"
|
||||
;;
|
||||
xiaomi,redmi-router-ax6s)
|
||||
ubootenv_add_uci_config "/dev/mtd3" "0x0" "0x10000" "0x40000"
|
||||
|
||||
@@ -17,6 +17,10 @@ bananapi,bpi-r2)
|
||||
export_bootdevice
|
||||
export_partdevice ubootpart 1
|
||||
ubootenv_add_uci_config "/dev/$ubootpart" "0xb0000" "0x10000" "0x10000" "1"
|
||||
;;
|
||||
unielec,u7623-02)
|
||||
ubootenv_add_uci_config "/dev/mmcblk0p1" "0xc0000" "0x10000" "0x10000" "1"
|
||||
;;
|
||||
esac
|
||||
|
||||
config_load ubootenv
|
||||
|
||||
@@ -8,10 +8,17 @@ touch /etc/config/ubootenv
|
||||
board=$(board_name)
|
||||
|
||||
case "$board" in
|
||||
extreme-networks,ws-ap3825i)
|
||||
ubootenv_add_uci_config "$(find_mtd_part 'cfg1')" "0x0" "0x10000" "0x20000"
|
||||
ubootenv_add_uci_config "$(find_mtd_part 'cfg2')" "0x0" "0x10000" "0x20000"
|
||||
;;
|
||||
ocedo,panda)
|
||||
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000"
|
||||
ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x20000" "0x20000"
|
||||
;;
|
||||
aerohive,hiveap-330)
|
||||
ubootenv_add_uci_config "$(find_mtd_part 'u-boot-env')" "0x0" "0x20000" "0x10000"
|
||||
;;
|
||||
esac
|
||||
|
||||
config_load ubootenv
|
||||
|
||||
@@ -17,7 +17,10 @@ buffalo,ls421de)
|
||||
ubootenv_add_uci_config "/dev/mtd3" "0x0" "0x10000"
|
||||
;;
|
||||
cznic,turris-omnia)
|
||||
if grep -q 'U-Boot 2015.10-rc2' /dev/mtd0; then
|
||||
idx="$(find_mtd_index u-boot-env)"
|
||||
if [ -n "$idx" ]; then
|
||||
ubootenv_add_uci_config "/dev/mtd${idx}" "0x0" "0x10000" "0x10000"
|
||||
elif grep -q 'U-Boot 2015.10-rc2' /dev/mtd0; then
|
||||
ubootenv_add_uci_config "/dev/mtd0" "0xc0000" "0x10000" "0x40000"
|
||||
else
|
||||
ubootenv_add_uci_config "/dev/mtd0" "0xf0000" "0x10000" "0x10000"
|
||||
@@ -30,7 +33,8 @@ globalscale,espressobin|\
|
||||
globalscale,espressobin-emmc|\
|
||||
globalscale,espressobin-ultra|\
|
||||
globalscale,espressobin-v7|\
|
||||
globalscale,espressobin-v7-emmc)
|
||||
globalscale,espressobin-v7-emmc|\
|
||||
globalscale,mochabin)
|
||||
idx="$(find_mtd_index u-boot-env)"
|
||||
if [ -n "$idx" ]; then
|
||||
ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x10000" "0x10000" "1"
|
||||
@@ -54,8 +58,14 @@ linksys,wrt3200acm|\
|
||||
linksys,wrt32x)
|
||||
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000"
|
||||
;;
|
||||
methode,udpu)
|
||||
methode,udpu|\
|
||||
methode,edpu)
|
||||
idx="$(find_mtd_index u-boot-env)"
|
||||
if [ -n "$idx" ]; then
|
||||
ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x10000" "0x10000" "1"
|
||||
else
|
||||
ubootenv_add_uci_config "/dev/mtd0" "0x180000" "0x10000" "0x10000"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ board=$(board_name)
|
||||
case "$board" in
|
||||
"cloudengines,pogoplug"*|\
|
||||
"shuttle,kd20")
|
||||
ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x2000" "0x2000" "1"
|
||||
ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x2000" "0x20000" "1"
|
||||
;;
|
||||
"mitrastar,stg-212")
|
||||
ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x20000" "0x20000" "1"
|
||||
|
||||
61
package/boot/uboot-envtools/files/qualcommax
Normal file
61
package/boot/uboot-envtools/files/qualcommax
Normal file
@@ -0,0 +1,61 @@
|
||||
[ -e /etc/config/ubootenv ] && exit 0
|
||||
|
||||
touch /etc/config/ubootenv
|
||||
|
||||
. /lib/uboot-envtools.sh
|
||||
. /lib/functions.sh
|
||||
|
||||
board=$(board_name)
|
||||
|
||||
case "$board" in
|
||||
compex,wpq873|\
|
||||
edgecore,eap102|\
|
||||
zyxel,nbg7815)
|
||||
idx="$(find_mtd_index 0:appsblenv)"
|
||||
[ -n "$idx" ] && \
|
||||
ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x10000" "0x10000" "1"
|
||||
;;
|
||||
dynalink,dl-wrx36|\
|
||||
glinet,gl-ax1800|\
|
||||
glinet,gl-axt1800|\
|
||||
netgear,rax120v2|\
|
||||
netgear,wax218|\
|
||||
netgear,wax620|\
|
||||
netgear,wax630)
|
||||
idx="$(find_mtd_index 0:appsblenv)"
|
||||
[ -n "$idx" ] && \
|
||||
ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x40000" "0x20000" "2"
|
||||
;;
|
||||
edimax,cax1800)
|
||||
idx="$(find_mtd_index 0:appsblenv)"
|
||||
[ -n "$idx" ] && \
|
||||
ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x10000" "0x20000"
|
||||
;;
|
||||
linksys,mr7350|\
|
||||
linksys,mx4200v1|\
|
||||
linksys,mx4200v2)
|
||||
idx="$(find_mtd_index u_env)"
|
||||
[ -n "$idx" ] && \
|
||||
ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x40000" "0x20000" "2"
|
||||
;;
|
||||
prpl,haze)
|
||||
mmcpart="$(find_mmc_part 0:APPSBLENV)"
|
||||
[ -n "$mmcpart" ] && \
|
||||
ubootenv_add_uci_config "$mmcpart" "0x0" "0x40000" "0x400" "0x100"
|
||||
;;
|
||||
qnap,301w)
|
||||
idx="$(find_mtd_index 0:appsblenv)"
|
||||
[ -n "$idx" ] && \
|
||||
ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x20000" "0x20000" "1"
|
||||
;;
|
||||
redmi,ax5-jdcloud)
|
||||
mmcpart="$(find_mmc_part 0:APPSBLENV)"
|
||||
[ -n "$mmcpart" ] && \
|
||||
ubootenv_add_uci_config "$mmcpart" "0x0" "0x40000" "0x20000" "2"
|
||||
;;
|
||||
esac
|
||||
|
||||
config_load ubootenv
|
||||
config_foreach ubootenv_add_app_config
|
||||
|
||||
exit 0
|
||||
@@ -42,15 +42,18 @@ zbtlink,zbt-wg2626|\
|
||||
zte,mf283plus)
|
||||
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x10000"
|
||||
;;
|
||||
h3c,tx1800-plus|\
|
||||
h3c,tx1801-plus|\
|
||||
h3c,tx1806|\
|
||||
jcg,q20)
|
||||
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000"
|
||||
;;
|
||||
hootoo,ht-tm05|\
|
||||
ravpower,rp-wd03)
|
||||
idx="$(find_mtd_index u-boot-env)"
|
||||
[ -n "$idx" ] && \
|
||||
ubootenv_add_uci_config "/dev/mtd$idx" "0x4000" "0x1000" "0x1000"
|
||||
;;
|
||||
jcg,q20)
|
||||
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000"
|
||||
;;
|
||||
linksys,ea7300-v1|\
|
||||
linksys,ea7500-v2|\
|
||||
linksys,ea8100-v1|\
|
||||
|
||||
@@ -8,13 +8,20 @@ touch /etc/config/ubootenv
|
||||
board=$(board_name)
|
||||
|
||||
case "$board" in
|
||||
d-link,dgs-1210-16|\
|
||||
d-link,dgs-1210-28|\
|
||||
d-link,dgs-1210-10mp|\
|
||||
d-link,dgs-1210-10p|\
|
||||
d-link,dgs-1210-16|\
|
||||
d-link,dgs-1210-20|\
|
||||
d-link,dgs-1210-28|\
|
||||
zyxel,gs1900-8|\
|
||||
zyxel,gs1900-8hp-v1|\
|
||||
zyxel,gs1900-8hp-v2|\
|
||||
zyxel,gs1900-10hp)
|
||||
zyxel,gs1900-10hp|\
|
||||
zyxel,gs1900-16|\
|
||||
zyxel,gs1900-24-v1|\
|
||||
zyxel,gs1900-24e|\
|
||||
zyxel,gs1900-24hp-v1|\
|
||||
zyxel,gs1900-24hp-v2)
|
||||
idx="$(find_mtd_index u-boot-env)"
|
||||
[ -n "$idx" ] && \
|
||||
ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x400" "0x10000"
|
||||
@@ -22,6 +29,21 @@ zyxel,gs1900-10hp)
|
||||
[ -n "$idx2" ] && \
|
||||
ubootenv_add_uci_sys_config "/dev/mtd$idx2" "0x0" "0x1000" "0x10000"
|
||||
;;
|
||||
tplink,sg2008p-v1|\
|
||||
tplink,sg2210p-v3|\
|
||||
tplink,sg2452p-v4)
|
||||
idx="$(find_mtd_index u-boot-env)"
|
||||
[ -n "$idx" ] && \
|
||||
ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x20000" "0x10000"
|
||||
;;
|
||||
iodata,bsh-g24mb)
|
||||
idx="$(find_mtd_index u-boot-env)"
|
||||
[ -n "$idx" ] && \
|
||||
ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x10000" "0x10000"
|
||||
idx2="$(find_mtd_index u-boot-env2)"
|
||||
[ -n "$idx2" ] && \
|
||||
ubootenv_add_uci_sys_config "/dev/mtd$idx2" "0x0" "0x3800" "0x10000"
|
||||
;;
|
||||
*)
|
||||
idx="$(find_mtd_index u-boot-env)"
|
||||
[ -n "$idx" ] && \
|
||||
|
||||
22
package/boot/uboot-envtools/files/rockchip
Normal file
22
package/boot/uboot-envtools/files/rockchip
Normal file
@@ -0,0 +1,22 @@
|
||||
#
|
||||
# Copyright (C) 2023 OpenWrt.org
|
||||
#
|
||||
[ -e /etc/config/ubootenv ] && exit 0
|
||||
|
||||
touch /etc/config/ubootenv
|
||||
|
||||
. /lib/uboot-envtools.sh
|
||||
. /lib/functions.sh
|
||||
|
||||
board=$(board_name)
|
||||
|
||||
case "$board" in
|
||||
lyt,t68m)
|
||||
ubootenv_add_uci_config "/dev/mmcblk0" "0x3f8000" "0x8000"
|
||||
;;
|
||||
esac
|
||||
|
||||
config_load ubootenv
|
||||
config_foreach ubootenv_add_app_config
|
||||
|
||||
exit 0
|
||||
@@ -1,19 +1,77 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_VERSION:=2021.04
|
||||
PKG_HASH:=0d438b1bb5cceb57a18ea2de4a0d51f7be5b05b98717df05938636e0aadfe11a
|
||||
PKG_BUILD_DEPENDS:=arm-trusted-firmware-tools/host
|
||||
PKG_VERSION:=2024.01
|
||||
PKG_HASH:=b99611f1ed237bf3541bdc8434b68c96a6e05967061f992443cb30aabebef5b3
|
||||
PKG_BUILD_DEPENDS:=!(TARGET_ramips||TARGET_mediatek_mt7623):arm-trusted-firmware-tools/host
|
||||
|
||||
include $(INCLUDE_DIR)/u-boot.mk
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
|
||||
MT7621_LOWLEVEL_PRELOADER_URL:=https://raw.githubusercontent.com/mtk-openwrt/mt7621-lowlevel-preloader/a03b07c60bf1ba4add9b671d32caa102fe948180/
|
||||
|
||||
define Download/mt7621-stage-sram
|
||||
FILE:=mt7621_stage_sram.bin
|
||||
URL:=$(MT7621_LOWLEVEL_PRELOADER_URL)
|
||||
HASH:=1dda68aa089f0ff262e01539b990dea478952e9fb68bcc0a8cd6f76f0135c62e
|
||||
endef
|
||||
|
||||
define Download/mt7621-stage-sram-noprint
|
||||
FILE:=mt7621_stage_sram_noprint.bin
|
||||
URL:=$(MT7621_LOWLEVEL_PRELOADER_URL)
|
||||
HASH:=8ee419275144fc298e9444d413d98e965a55d283152a74ea6a1f8de79eb516b6
|
||||
endef
|
||||
|
||||
ifdef CONFIG_TARGET_ramips_mt7621
|
||||
ifdef CONFIG_DEBUG
|
||||
$(eval $(call Download,mt7621-stage-sram))
|
||||
else
|
||||
$(eval $(call Download,mt7621-stage-sram-noprint))
|
||||
endif
|
||||
endif
|
||||
|
||||
define U-Boot/Default
|
||||
BUILD_TARGET:=mediatek
|
||||
UBOOT_IMAGE:=u-boot-mtk.bin
|
||||
endef
|
||||
|
||||
define U-Boot/mt7620_rfb
|
||||
NAME:=MT7620 Reference Board
|
||||
UBOOT_CONFIG:=mt7620_rfb
|
||||
BUILD_DEVICES:=ralink_mt7620a-evb
|
||||
BUILD_TARGET:=ramips
|
||||
BUILD_SUBTARGET:=mt7620
|
||||
UBOOT_IMAGE:=u-boot-with-spl.bin
|
||||
endef
|
||||
|
||||
define U-Boot/mt7620_mt7530_rfb
|
||||
NAME:=MT7620+MT7530 Reference Board
|
||||
UBOOT_CONFIG:=mt7620_mt7530_rfb
|
||||
BUILD_DEVICES:=ralink_mt7620a-mt7530-evb
|
||||
BUILD_TARGET:=ramips
|
||||
BUILD_SUBTARGET:=mt7620
|
||||
UBOOT_IMAGE:=u-boot-with-spl.bin
|
||||
endef
|
||||
|
||||
define U-Boot/mt7621_rfb
|
||||
NAME:=MT7621 Reference Board
|
||||
UBOOT_CONFIG:=mt7621_rfb
|
||||
BUILD_DEVICES:=mediatek_mt7621-eval-board
|
||||
BUILD_TARGET:=ramips
|
||||
BUILD_SUBTARGET:=mt7621
|
||||
UBOOT_IMAGE:=u-boot-mt7621.bin
|
||||
endef
|
||||
|
||||
define U-Boot/mt7621_nand_rfb
|
||||
NAME:=MT7621 Reference Board (NAND)
|
||||
UBOOT_CONFIG:=mt7621_nand_rfb
|
||||
BUILD_DEVICES:=mediatek_mt7621-eval-board
|
||||
BUILD_TARGET:=ramips
|
||||
BUILD_SUBTARGET:=mt7621
|
||||
UBOOT_IMAGE:=u-boot-mt7621.bin
|
||||
endef
|
||||
|
||||
define U-Boot/mt7622_rfb1
|
||||
NAME:=MT7622 Reference Board 1
|
||||
UBOOT_CONFIG:=mt7622_rfb
|
||||
@@ -68,29 +126,48 @@ endef
|
||||
define U-Boot/mt7622_ubnt_unifi-6-lr
|
||||
NAME:=Ubiquiti UniFi 6 LR
|
||||
UBOOT_CONFIG:=mt7622_ubnt_unifi-6-lr
|
||||
BUILD_DEVICES:=ubnt_unifi-6-lr-ubootmod
|
||||
BUILD_DEVICES:=ubnt_unifi-6-lr-v1-ubootmod ubnt_unifi-6-lr-v2-ubootmod
|
||||
BUILD_SUBTARGET:=mt7622
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=nor
|
||||
BL2_DDRBLOB:=2
|
||||
DEPENDS:=+trusted-firmware-a-mt7622-nor-2ddr
|
||||
FIP_COMPRESS:=1
|
||||
endef
|
||||
|
||||
define U-Boot/mt7623a_unielec_u7623
|
||||
NAME:=UniElec U7623 (mt7623)
|
||||
BUILD_DEVICES:=unielec_u7623-emmc unielec_u7623-02-emmc-512m-legacy
|
||||
BUILD_DEVICES:=unielec_u7623-02
|
||||
BUILD_SUBTARGET:=mt7623
|
||||
UBOOT_CONFIG:=mt7623a_unielec_u7623_02
|
||||
endef
|
||||
|
||||
define U-Boot/mt7623n_bpir2
|
||||
NAME:=Banana Pi R2 (mt7623)
|
||||
BUILD_DEVICES:=bpi_bananapi-r2
|
||||
BUILD_DEVICES:=bananapi_bpi-r2
|
||||
BUILD_SUBTARGET:=mt7623
|
||||
UBOOT_IMAGE:=u-boot.bin
|
||||
UBOOT_CONFIG:=mt7623n_bpir2
|
||||
endef
|
||||
|
||||
define U-Boot/mt7628_rfb
|
||||
NAME:=MT7628 Reference Board
|
||||
BUILD_DEVICES:=mediatek_mt7628an-eval-board
|
||||
BUILD_TARGET:=ramips
|
||||
BUILD_SUBTARGET:=mt76x8
|
||||
UBOOT_CONFIG:=mt7628_rfb
|
||||
UBOOT_IMAGE:=u-boot-with-spl.bin
|
||||
endef
|
||||
|
||||
define U-Boot/ravpower_rp-wd009
|
||||
NAME:=RAVPower RP-WD009
|
||||
BUILD_TARGET:=ramips
|
||||
BUILD_DEVICES:=ravpower_rp-wd009
|
||||
BUILD_SUBTARGET:=mt76x8
|
||||
UBOOT_CONFIG:=ravpower-rp-wd009-ram
|
||||
UBOOT_IMAGE:=u-boot.bin
|
||||
endef
|
||||
|
||||
define U-Boot/mt7629_rfb
|
||||
NAME:=MT7629 Reference Board
|
||||
BUILD_SUBTARGET:=mt7629
|
||||
@@ -98,7 +175,265 @@ define U-Boot/mt7629_rfb
|
||||
UBOOT_CONFIG:=mt7629_rfb
|
||||
endef
|
||||
|
||||
define U-Boot/mt7981_rfb-spim-nand
|
||||
NAME:=MT7981 Reference Board
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=mediatek_mt7981-rfb
|
||||
UBOOT_CONFIG:=mt7981_rfb
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=spim-nand
|
||||
BL2_SOC:=mt7981
|
||||
BL2_DDRTYPE:=ddr3
|
||||
DEPENDS:=+trusted-firmware-a-mt7981-spim-nand-ddr3
|
||||
endef
|
||||
|
||||
define U-Boot/mt7981_rfb-emmc
|
||||
NAME:=MT7981 Reference Board
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=mediatek_mt7981-rfb
|
||||
UBOOT_CONFIG:=mt7981_emmc_rfb
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=emmc
|
||||
BL2_SOC:=mt7981
|
||||
BL2_DDRTYPE:=ddr3
|
||||
DEPENDS:=+trusted-firmware-a-mt7981-emmc-ddr3
|
||||
endef
|
||||
|
||||
define U-Boot/mt7981_rfb-nor
|
||||
NAME:=MT7981 Reference Board
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=mediatek_mt7981-rfb
|
||||
UBOOT_CONFIG:=mt7981_nor_rfb
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=spim-nand
|
||||
BL2_SOC:=mt7981
|
||||
BL2_DDRTYPE:=ddr3
|
||||
DEPENDS:=+trusted-firmware-a-mt7981-nor-ddr3
|
||||
endef
|
||||
|
||||
define U-Boot/mt7981_rfb-sd
|
||||
NAME:=MT7981 Reference Board
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=mediatek_mt7981-rfb
|
||||
UBOOT_CONFIG:=mt7981_sd_rfb
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=sdmmc
|
||||
BL2_SOC:=mt7981
|
||||
BL2_DDRTYPE:=ddr3
|
||||
DEPENDS:=+trusted-firmware-a-mt7981-sdmmc-ddr3
|
||||
endef
|
||||
|
||||
define U-Boot/mt7981_rfb-snfi
|
||||
NAME:=MT7981 Reference Board
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=mediatek_mt7981-rfb
|
||||
UBOOT_CONFIG:=mt7981_snfi_nand_rfb
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=snand
|
||||
BL2_SOC:=mt7981
|
||||
BL2_DDRTYPE:=ddr3
|
||||
DEPENDS:=+trusted-firmware-a-mt7981-snand-ddr3
|
||||
endef
|
||||
|
||||
define U-Boot/mt7986_rfb
|
||||
NAME:=MT7986 Reference Board
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=mediatek_mt7986-rfb
|
||||
UBOOT_CONFIG:=mt7986_rfb
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=sdmmc
|
||||
BL2_SOC:=mt7986
|
||||
BL2_DDRTYPE:=ddr4
|
||||
DEPENDS:=+trusted-firmware-a-mt7986-sdmmc-ddr4
|
||||
endef
|
||||
|
||||
define U-Boot/mt7986_bananapi_bpi-r3-emmc
|
||||
NAME:=BananaPi BPi-R3
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=bananapi_bpi-r3
|
||||
UBOOT_CONFIG:=mt7986a_bpi-r3-emmc
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=emmc
|
||||
BL2_SOC:=mt7986
|
||||
BL2_DDRTYPE:=ddr4
|
||||
DEPENDS:=+trusted-firmware-a-mt7986-emmc-ddr4
|
||||
endef
|
||||
|
||||
define U-Boot/mt7986_bananapi_bpi-r3-sdmmc
|
||||
NAME:=BananaPi BPi-R3
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=bananapi_bpi-r3
|
||||
UBOOT_CONFIG:=mt7986a_bpi-r3-sd
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=sdmmc
|
||||
BL2_SOC:=mt7986
|
||||
BL2_DDRTYPE:=ddr4
|
||||
DEPENDS:=+trusted-firmware-a-mt7986-sdmmc-ddr4
|
||||
endef
|
||||
|
||||
define U-Boot/mt7986_bananapi_bpi-r3-snand
|
||||
NAME:=BananaPi BPi-R3
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=bananapi_bpi-r3
|
||||
UBOOT_CONFIG:=mt7986a_bpi-r3-snand
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=spim-nand-ubi
|
||||
BL2_SOC:=mt7986
|
||||
BL2_DDRTYPE:=ddr4
|
||||
DEPENDS:=+trusted-firmware-a-mt7986-spim-nand-ubi-ddr4
|
||||
endef
|
||||
|
||||
define U-Boot/mt7986_bananapi_bpi-r3-nor
|
||||
NAME:=BananaPi BPi-R3
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=bananapi_bpi-r3
|
||||
UBOOT_CONFIG:=mt7986a_bpi-r3-nor
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=nor
|
||||
BL2_SOC:=mt7986
|
||||
BL2_DDRTYPE:=ddr4
|
||||
DEPENDS:=+trusted-firmware-a-mt7986-nor-ddr4
|
||||
FIP_COMPRESS:=1
|
||||
endef
|
||||
|
||||
define U-Boot/mt7988_bananapi_bpi-r4-emmc
|
||||
NAME:=BananaPi BPi-R4
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=bananapi_bpi-r4
|
||||
UBOOT_CONFIG:=mt7988a_bananapi_bpi-r4-emmc
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=emmc
|
||||
BL2_SOC:=mt7988
|
||||
BL2_DDRTYPE:=comb
|
||||
DEPENDS:=+trusted-firmware-a-mt7988-emmc-comb
|
||||
endef
|
||||
|
||||
define U-Boot/mt7988_bananapi_bpi-r4-sdmmc
|
||||
NAME:=BananaPi BPi-R4
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=bananapi_bpi-r4
|
||||
UBOOT_CONFIG:=mt7988a_bananapi_bpi-r4-sdmmc
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=sdmmc
|
||||
BL2_SOC:=mt7988
|
||||
BL2_DDRTYPE:=comb
|
||||
DEPENDS:=+trusted-firmware-a-mt7988-sdmmc-comb
|
||||
endef
|
||||
|
||||
define U-Boot/mt7988_bananapi_bpi-r4-snand
|
||||
NAME:=BananaPi BPi-R4
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=bananapi_bpi-r4
|
||||
UBOOT_CONFIG:=mt7988a_bananapi_bpi-r4-snand
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=spim-nand-ubi
|
||||
BL2_SOC:=mt7988
|
||||
BL2_DDRTYPE:=comb
|
||||
DEPENDS:=+trusted-firmware-a-mt7988-spim-nand-ubi-comb
|
||||
endef
|
||||
|
||||
define U-Boot/mt7988_bananapi_bpi-r4-poe-emmc
|
||||
NAME:=BananaPi BPi-R4 2.5GE
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=bananapi_bpi-r4-poe
|
||||
UBOOT_CONFIG:=mt7988a_bananapi_bpi-r4-poe-emmc
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=emmc
|
||||
BL2_SOC:=mt7988
|
||||
BL2_DDRTYPE:=comb
|
||||
DEPENDS:=+trusted-firmware-a-mt7988-emmc-comb
|
||||
endef
|
||||
|
||||
define U-Boot/mt7988_bananapi_bpi-r4-poe-sdmmc
|
||||
NAME:=BananaPi BPi-R4 2.5GE
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=bananapi_bpi-r4-poe
|
||||
UBOOT_CONFIG:=mt7988a_bananapi_bpi-r4-poe-sdmmc
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=sdmmc
|
||||
BL2_SOC:=mt7988
|
||||
BL2_DDRTYPE:=comb
|
||||
DEPENDS:=+trusted-firmware-a-mt7988-sdmmc-comb
|
||||
endef
|
||||
|
||||
define U-Boot/mt7988_bananapi_bpi-r4-poe-snand
|
||||
NAME:=BananaPi BPi-R4 2.5GE
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=bananapi_bpi-r4-poe
|
||||
UBOOT_CONFIG:=mt7988a_bananapi_bpi-r4-poe-snand
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=spim-nand-ubi
|
||||
BL2_SOC:=mt7988
|
||||
BL2_DDRTYPE:=comb
|
||||
DEPENDS:=+trusted-firmware-a-mt7988-spim-nand-ubi-comb
|
||||
endef
|
||||
|
||||
define U-Boot/mt7988_rfb-spim-nand
|
||||
NAME:=MT7988 Reference Board
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=mediatek_mt7988a-rfb
|
||||
UBOOT_CONFIG:=mt7988_rfb
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=spim-nand
|
||||
BL2_SOC:=mt7988
|
||||
BL2_DDRTYPE:=comb
|
||||
DEPENDS:=+trusted-firmware-a-mt7988-spim-nand-comb
|
||||
endef
|
||||
|
||||
define U-Boot/mt7988_rfb-snand
|
||||
NAME:=MT7988 Reference Board
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=mediatek_mt7988a-rfb
|
||||
UBOOT_CONFIG:=mt7988_rfb
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=snand
|
||||
BL2_SOC:=mt7988
|
||||
BL2_DDRTYPE:=comb
|
||||
DEPENDS:=+trusted-firmware-a-mt7988-snand-comb
|
||||
endef
|
||||
|
||||
define U-Boot/mt7988_rfb-nor
|
||||
NAME:=MT7988 Reference Board
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=mediatek_mt7988a-rfb
|
||||
UBOOT_CONFIG:=mt7988_rfb
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=nor
|
||||
BL2_SOC:=mt7988
|
||||
BL2_DDRTYPE:=comb
|
||||
DEPENDS:=+trusted-firmware-a-mt7988-nor-comb
|
||||
FIP_COMPRESS:=1
|
||||
endef
|
||||
|
||||
define U-Boot/mt7988_rfb-emmc
|
||||
NAME:=MT7988 Reference Board
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=mediatek_mt7988a-rfb
|
||||
UBOOT_CONFIG:=mt7988_rfb
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=emmc
|
||||
BL2_SOC:=mt7988
|
||||
BL2_DDRTYPE:=comb
|
||||
DEPENDS:=+trusted-firmware-a-mt7988-emmc-comb
|
||||
endef
|
||||
|
||||
define U-Boot/mt7988_rfb-sd
|
||||
NAME:=MT7988 Reference Board
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=mediatek_mt7988a-rfb
|
||||
UBOOT_CONFIG:=mt7988_sd_rfb
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=sdmmc
|
||||
BL2_SOC:=mt7988
|
||||
BL2_DDRTYPE:=comb
|
||||
DEPENDS:=+trusted-firmware-a-mt7988-sdmmc-comb
|
||||
endef
|
||||
|
||||
UBOOT_TARGETS := \
|
||||
mt7620_mt7530_rfb \
|
||||
mt7620_rfb \
|
||||
mt7621_nand_rfb \
|
||||
mt7621_rfb \
|
||||
mt7622_bananapi_bpi-r64-emmc \
|
||||
mt7622_bananapi_bpi-r64-sdmmc \
|
||||
mt7622_bananapi_bpi-r64-snand \
|
||||
@@ -107,29 +442,74 @@ UBOOT_TARGETS := \
|
||||
mt7622_ubnt_unifi-6-lr \
|
||||
mt7623n_bpir2 \
|
||||
mt7623a_unielec_u7623 \
|
||||
mt7629_rfb
|
||||
mt7628_rfb \
|
||||
mt7628_ravpower_rp-wd009 \
|
||||
mt7629_rfb \
|
||||
mt7981_rfb-spim-nand \
|
||||
mt7981_rfb-emmc \
|
||||
mt7981_rfb-nor \
|
||||
mt7981_rfb-sd \
|
||||
mt7981_rfb-snfi \
|
||||
mt7986_bananapi_bpi-r3-emmc \
|
||||
mt7986_bananapi_bpi-r3-sdmmc \
|
||||
mt7986_bananapi_bpi-r3-snand \
|
||||
mt7986_bananapi_bpi-r3-nor \
|
||||
mt7986_rfb \
|
||||
mt7988_bananapi_bpi-r4-emmc \
|
||||
mt7988_bananapi_bpi-r4-sdmmc \
|
||||
mt7988_bananapi_bpi-r4-snand \
|
||||
mt7988_bananapi_bpi-r4-poe-emmc \
|
||||
mt7988_bananapi_bpi-r4-poe-sdmmc \
|
||||
mt7988_bananapi_bpi-r4-poe-snand \
|
||||
mt7988_rfb-spim-nand \
|
||||
mt7988_rfb-snand \
|
||||
mt7988_rfb-nor \
|
||||
mt7988_rfb-emmc \
|
||||
mt7988_rfb-sd
|
||||
|
||||
ifdef CONFIG_TARGET_mediatek
|
||||
UBOOT_MAKE_FLAGS += $(UBOOT_IMAGE:.fip=.bin)
|
||||
|
||||
Build/Exports:=$(Host/Exports)
|
||||
endif
|
||||
|
||||
define Build/fip-image
|
||||
$(if $(FIP_COMPRESS),\
|
||||
xz -f -e -k -9 -C crc32 $(STAGING_DIR_IMAGE)/$(if $(BL2_SOC),$(BL2_SOC),$(BUILD_SUBTARGET))-$(BL2_BOOTDEV)-$(if $(BL2_DDRTYPE),$(BL2_DDRTYPE)-)$(if $(BL2_DDRBLOB),$(BL2_DDRBLOB)ddr-)bl31.bin ;\
|
||||
xz -f -e -k -9 -C crc32 $(PKG_BUILD_DIR)/u-boot.bin \
|
||||
)
|
||||
$(STAGING_DIR_HOST)/bin/fiptool create \
|
||||
--soc-fw $(STAGING_DIR_IMAGE)/$(BUILD_SUBTARGET)-$(BL2_BOOTDEV)-$(BL2_DDRBLOB)ddr-bl31.bin \
|
||||
--nt-fw $(PKG_BUILD_DIR)/u-boot.bin \
|
||||
--soc-fw $(STAGING_DIR_IMAGE)/$(if $(BL2_SOC),$(BL2_SOC),$(BUILD_SUBTARGET))-$(BL2_BOOTDEV)-$(if $(BL2_DDRTYPE),$(BL2_DDRTYPE)-)$(if $(BL2_DDRBLOB),$(BL2_DDRBLOB)ddr-)bl31.bin$(if $(FIP_COMPRESS),.xz) \
|
||||
--nt-fw $(PKG_BUILD_DIR)/u-boot.bin$(if $(FIP_COMPRESS),.xz) \
|
||||
$(PKG_BUILD_DIR)/u-boot.fip
|
||||
endef
|
||||
|
||||
ifdef CONFIG_TARGET_ramips_mt7621
|
||||
define Build/Prepare
|
||||
$(call Build/Prepare/Default)
|
||||
ifdef CONFIG_DEBUG
|
||||
$(CP) $(DL_DIR)/mt7621_stage_sram.bin $(PKG_BUILD_DIR)/
|
||||
else
|
||||
$(CP) $(DL_DIR)/mt7621_stage_sram_noprint.bin $(PKG_BUILD_DIR)/mt7621_stage_sram.bin
|
||||
endif
|
||||
endef
|
||||
endif
|
||||
|
||||
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))
|
||||
ifeq ($(UBOOT_IMAGE),u-boot.fip)
|
||||
$(call Build/fip-image)
|
||||
endif
|
||||
endef
|
||||
|
||||
# don't stage files to bindir, let target/linux/mediatek/image/*.mk do that
|
||||
ifdef CONFIG_TARGET_mediatek
|
||||
define Package/u-boot/install
|
||||
endef
|
||||
endif
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(STAGING_DIR_IMAGE)
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
From 5efb7855a9d33ac897d6e2a7117e4e3d35d433a5 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Golle <daniel@makrotopia.org>
|
||||
Date: Thu, 11 Mar 2021 10:28:53 +0000
|
||||
Subject: [PATCH 01/21] Revert "clk: Add debugging for return values"
|
||||
|
||||
This reverts commit 5c5992cb90cf9ca4d51e38d9a95a13c293904df5.
|
||||
---
|
||||
drivers/clk/clk-uclass.c | 16 +++++-----------
|
||||
1 file changed, 5 insertions(+), 11 deletions(-)
|
||||
|
||||
--- a/drivers/clk/clk-uclass.c
|
||||
+++ b/drivers/clk/clk-uclass.c
|
||||
@@ -84,7 +84,7 @@ static int clk_get_by_index_tail(int ret
|
||||
if (ret) {
|
||||
debug("%s: uclass_get_device_by_of_offset failed: err=%d\n",
|
||||
__func__, ret);
|
||||
- return log_msg_ret("get", ret);
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
clk->dev = dev_clk;
|
||||
@@ -97,15 +97,14 @@ static int clk_get_by_index_tail(int ret
|
||||
ret = clk_of_xlate_default(clk, args);
|
||||
if (ret) {
|
||||
debug("of_xlate() failed: %d\n", ret);
|
||||
- return log_msg_ret("xlate", ret);
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
return clk_request(dev_clk, clk);
|
||||
err:
|
||||
debug("%s: Node '%s', property '%s', failed to request CLK index %d: %d\n",
|
||||
__func__, ofnode_get_name(node), list_name, index, ret);
|
||||
-
|
||||
- return log_msg_ret("prop", ret);
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
static int clk_get_by_indexed_prop(struct udevice *dev, const char *prop_name,
|
||||
@@ -124,7 +123,7 @@ static int clk_get_by_indexed_prop(struc
|
||||
if (ret) {
|
||||
debug("%s: fdtdec_parse_phandle_with_args failed: err=%d\n",
|
||||
__func__, ret);
|
||||
- return log_ret(ret);
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -472,7 +471,6 @@ int clk_free(struct clk *clk)
|
||||
ulong clk_get_rate(struct clk *clk)
|
||||
{
|
||||
const struct clk_ops *ops;
|
||||
- int ret;
|
||||
|
||||
debug("%s(clk=%p)\n", __func__, clk);
|
||||
if (!clk_valid(clk))
|
||||
@@ -482,11 +480,7 @@ ulong clk_get_rate(struct clk *clk)
|
||||
if (!ops->get_rate)
|
||||
return -ENOSYS;
|
||||
|
||||
- ret = ops->get_rate(clk);
|
||||
- if (ret)
|
||||
- return log_ret(ret);
|
||||
-
|
||||
- return 0;
|
||||
+ return ops->get_rate(clk);
|
||||
}
|
||||
|
||||
struct clk *clk_get_parent(struct clk *clk)
|
||||
@@ -1,25 +0,0 @@
|
||||
From 6f18e581a7e98db3675b4c111701263647b20781 Mon Sep 17 00:00:00 2001
|
||||
From: Sam Shih <sam.shih@mediatek.com>
|
||||
Date: Thu, 17 Dec 2020 19:29:56 +0800
|
||||
Subject: [PATCH 03/21] pinctrl: mediatek: fix wrong assignment in
|
||||
mtk_get_pin_name
|
||||
|
||||
This is a bug fix for mtk pinctrl common part. Appearently pins should be
|
||||
used instead of grps in mtk_get_pin_name().
|
||||
|
||||
Signed-off-by: Sam Shih <sam.shih@mediatek.com>
|
||||
---
|
||||
drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
|
||||
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
|
||||
@@ -219,7 +219,7 @@ static const char *mtk_get_pin_name(stru
|
||||
{
|
||||
struct mtk_pinctrl_priv *priv = dev_get_priv(dev);
|
||||
|
||||
- if (!priv->soc->grps[selector].name)
|
||||
+ if (!priv->soc->pins[selector].name)
|
||||
return mtk_pinctrl_dummy_name;
|
||||
|
||||
return priv->soc->pins[selector].name;
|
||||
@@ -1,43 +0,0 @@
|
||||
From ca73da39ff0c9f599f75d7ccac0196030aa946b9 Mon Sep 17 00:00:00 2001
|
||||
From: Sam Shih <sam.shih@mediatek.com>
|
||||
Date: Thu, 17 Dec 2020 19:32:48 +0800
|
||||
Subject: [PATCH 04/21] pinctrl: mediatek: add get_pin_muxing ops for mediatek
|
||||
pinctrl
|
||||
|
||||
This patch add get_pin_muxing support for mediatek pinctrl drivers
|
||||
|
||||
Signed-off-by: Sam Shih <sam.shih@mediatek.com>
|
||||
---
|
||||
drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 14 ++++++++++++++
|
||||
1 file changed, 14 insertions(+)
|
||||
|
||||
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
|
||||
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
|
||||
@@ -232,6 +232,19 @@ static int mtk_get_pins_count(struct ude
|
||||
return priv->soc->npins;
|
||||
}
|
||||
|
||||
+static int mtk_get_pin_muxing(struct udevice *dev,
|
||||
+ unsigned int selector,
|
||||
+ char *buf, int size)
|
||||
+{
|
||||
+ int val, err;
|
||||
+ err = mtk_hw_get_value(dev, selector, PINCTRL_PIN_REG_MODE, &val);
|
||||
+ if (err)
|
||||
+ return err;
|
||||
+
|
||||
+ snprintf(buf, size, "Aux Func.%d", val);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static const char *mtk_get_group_name(struct udevice *dev,
|
||||
unsigned int selector)
|
||||
{
|
||||
@@ -512,6 +525,7 @@ static int mtk_pinconf_group_set(struct
|
||||
const struct pinctrl_ops mtk_pinctrl_ops = {
|
||||
.get_pins_count = mtk_get_pins_count,
|
||||
.get_pin_name = mtk_get_pin_name,
|
||||
+ .get_pin_muxing = mtk_get_pin_muxing,
|
||||
.get_groups_count = mtk_get_groups_count,
|
||||
.get_group_name = mtk_get_group_name,
|
||||
.get_functions_count = mtk_get_functions_count,
|
||||
@@ -1,58 +0,0 @@
|
||||
From d3fbbef13853a695cdea75a980a3d6bd150a68c1 Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Mon, 11 Jan 2021 10:17:15 +0800
|
||||
Subject: [PATCH 05/21] pinctrl: mediatek: do not probe gpio driver if not
|
||||
enabled
|
||||
|
||||
The mtk pinctrl driver is a combination driver with support for both
|
||||
pinctrl and gpio. When this driver is used in SPL, gpio support may not be
|
||||
enabled, and this will result in a compilation error.
|
||||
|
||||
To fix this, macros are added to make sure gpio related code will only be
|
||||
compiled when gpio support is enabled.
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 12 ++++++++----
|
||||
1 file changed, 8 insertions(+), 4 deletions(-)
|
||||
|
||||
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
|
||||
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
|
||||
@@ -540,6 +540,8 @@ const struct pinctrl_ops mtk_pinctrl_ops
|
||||
.set_state = pinctrl_generic_set_state,
|
||||
};
|
||||
|
||||
+#if CONFIG_IS_ENABLED(DM_GPIO) || \
|
||||
+ (defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_GPIO_SUPPORT))
|
||||
static int mtk_gpio_get(struct udevice *dev, unsigned int off)
|
||||
{
|
||||
int val, err;
|
||||
@@ -647,12 +649,13 @@ static int mtk_gpiochip_register(struct
|
||||
|
||||
return 0;
|
||||
}
|
||||
+#endif
|
||||
|
||||
int mtk_pinctrl_common_probe(struct udevice *dev,
|
||||
struct mtk_pinctrl_soc *soc)
|
||||
{
|
||||
struct mtk_pinctrl_priv *priv = dev_get_priv(dev);
|
||||
- int ret;
|
||||
+ int ret = 0;
|
||||
|
||||
priv->base = dev_read_addr_ptr(dev);
|
||||
if (!priv->base)
|
||||
@@ -660,9 +663,10 @@ int mtk_pinctrl_common_probe(struct udev
|
||||
|
||||
priv->soc = soc;
|
||||
|
||||
+#if CONFIG_IS_ENABLED(DM_GPIO) || \
|
||||
+ (defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_GPIO_SUPPORT))
|
||||
ret = mtk_gpiochip_register(dev);
|
||||
- if (ret)
|
||||
- return ret;
|
||||
+#endif
|
||||
|
||||
- return 0;
|
||||
+ return ret;
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
From 1c6d07abf7fc79bf3950dc9ac56e3b566c334d3d Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Wed, 13 Jan 2021 16:29:23 +0800
|
||||
Subject: [PATCH 06/21] pinctrl: mt7629: add jtag function and pin group
|
||||
|
||||
The EPHY LEDs of mt7629 can be used as JTAG. This patch adds the jtag pin
|
||||
group to the pinctrl driver.
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
drivers/pinctrl/mediatek/pinctrl-mt7629.c | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
--- a/drivers/pinctrl/mediatek/pinctrl-mt7629.c
|
||||
+++ b/drivers/pinctrl/mediatek/pinctrl-mt7629.c
|
||||
@@ -201,6 +201,10 @@ static int mt7629_wf2g_led_funcs[] = { 1
|
||||
static int mt7629_wf5g_led_pins[] = { 18, };
|
||||
static int mt7629_wf5g_led_funcs[] = { 1, };
|
||||
|
||||
+/* LED for EPHY used as JTAG */
|
||||
+static int mt7629_ephy_leds_jtag_pins[] = { 12, 13, 14, 15, 16, };
|
||||
+static int mt7629_ephy_leds_jtag_funcs[] = { 7, 7, 7, 7, 7, };
|
||||
+
|
||||
/* Watchdog */
|
||||
static int mt7629_watchdog_pins[] = { 11, };
|
||||
static int mt7629_watchdog_funcs[] = { 1, };
|
||||
@@ -297,6 +301,7 @@ static const struct mtk_group_desc mt762
|
||||
PINCTRL_PIN_GROUP("ephy_led2", mt7629_ephy_led2),
|
||||
PINCTRL_PIN_GROUP("ephy_led3", mt7629_ephy_led3),
|
||||
PINCTRL_PIN_GROUP("ephy_led4", mt7629_ephy_led4),
|
||||
+ PINCTRL_PIN_GROUP("ephy_leds_jtag", mt7629_ephy_leds_jtag),
|
||||
PINCTRL_PIN_GROUP("wf2g_led", mt7629_wf2g_led),
|
||||
PINCTRL_PIN_GROUP("wf5g_led", mt7629_wf5g_led),
|
||||
PINCTRL_PIN_GROUP("watchdog", mt7629_watchdog),
|
||||
@@ -364,6 +369,7 @@ static const char *const mt7629_uart_gro
|
||||
static const char *const mt7629_wdt_groups[] = { "watchdog", };
|
||||
static const char *const mt7629_wifi_groups[] = { "wf0_5g", "wf0_2g", };
|
||||
static const char *const mt7629_flash_groups[] = { "snfi", "spi_nor" };
|
||||
+static const char *const mt7629_jtag_groups[] = { "ephy_leds_jtag" };
|
||||
|
||||
static const struct mtk_function_desc mt7629_functions[] = {
|
||||
{"eth", mt7629_ethernet_groups, ARRAY_SIZE(mt7629_ethernet_groups)},
|
||||
@@ -376,6 +382,7 @@ static const struct mtk_function_desc mt
|
||||
{"watchdog", mt7629_wdt_groups, ARRAY_SIZE(mt7629_wdt_groups)},
|
||||
{"wifi", mt7629_wifi_groups, ARRAY_SIZE(mt7629_wifi_groups)},
|
||||
{"flash", mt7629_flash_groups, ARRAY_SIZE(mt7629_flash_groups)},
|
||||
+ {"jtag", mt7629_jtag_groups, ARRAY_SIZE(mt7629_jtag_groups)},
|
||||
};
|
||||
|
||||
static struct mtk_pinctrl_soc mt7629_data = {
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user