Compare commits
175 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 |
15
.github/workflows/openwrt-ci.yml
vendored
15
.github/workflows/openwrt-ci.yml
vendored
@@ -55,16 +55,13 @@ jobs:
|
||||
sudo -E apt-get update
|
||||
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
|
||||
pip3 install pyelftools
|
||||
sudo -E apt-get -y autoremove --purge
|
||||
sudo -E apt-get clean
|
||||
df -h
|
||||
|
||||
- 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 +70,18 @@ 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_friendlyarm_nanopi-r2c=y
|
||||
CONFIG_TARGET_DEVICE_rockchip_armv8_DEVICE_embedfire_lubancat1=y
|
||||
CONFIG_TARGET_DEVICE_rockchip_armv8_DEVICE_embedfire_lubancat1n=y
|
||||
CONFIG_TARGET_DEVICE_rockchip_armv8_DEVICE_embedfire_lubancat2=y
|
||||
CONFIG_TARGET_DEVICE_rockchip_armv8_DEVICE_embedfire_lubancat2n=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_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_KERNEL_PARTSIZE=64
|
||||
CONFIG_TARGET_ROOTFS_PARTSIZE=512
|
||||
CONFIG_TARGET_ROOTFS_TARGZ=y
|
||||
|
||||
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);
|
||||
|
||||
22
README.md
22
README.md
@@ -13,6 +13,9 @@ 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
|
||||
@@ -20,7 +23,7 @@ hinlink_opc-h69k
|
||||
|
||||
### Next plan to add equipment:
|
||||
```
|
||||
|
||||
hinlink_h88k
|
||||
```
|
||||
How to compile the OpenWrt firmware you need
|
||||
-
|
||||
@@ -29,20 +32,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
|
||||
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 lrzsz mkisofs msmtp ninja-build p7zip p7zip-full patch pkgconf python2.7 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 +61,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
|
||||
|
||||
@@ -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"
|
||||
@@ -306,6 +309,7 @@ menu "Target Images"
|
||||
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
|
||||
|
||||
@@ -401,6 +401,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 +1067,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 +1115,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 +1135,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
|
||||
#
|
||||
|
||||
BIN
doc/h68k.jpg
Normal file
BIN
doc/h68k.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 62 KiB |
BIN
doc/r1.jpg
Normal file
BIN
doc/r1.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 50 KiB |
BIN
doc/star.png
Normal file
BIN
doc/star.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 163 KiB |
@@ -2,3 +2,4 @@ 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 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 = .213
|
||||
LINUX_KERNEL_HASH-5.10.213 = 84cf30223239ec3333a5f7b2a7fba2042bba70d1582a139f7543956af871ad80
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
LINUX_VERSION-5.15 = .90
|
||||
LINUX_KERNEL_HASH-5.15.90 = e6fd430022686753af7516fe7544f96aab379509dc5b7829017bdcd92b393b42
|
||||
LINUX_VERSION-5.15 = .156
|
||||
LINUX_KERNEL_HASH-5.15.156 = 9f0465d14c93691056f5f94de647601f94f083ad8ce2e5d306564394b13e7778
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
LINUX_VERSION-5.4 = .192
|
||||
LINUX_KERNEL_HASH-5.4.192 = 32482e1152fb07b126180a374f5f7d14601bd13a50ab8cbb75465aa998da9e93
|
||||
LINUX_VERSION-5.4 = .272
|
||||
LINUX_KERNEL_HASH-5.4.272 = 3599d5959a403e64be407d7f05e56cb270d6ddd154e89a596609919ab1e2e366
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
LINUX_VERSION-6.1 = .30
|
||||
LINUX_KERNEL_HASH-6.1.30 = 1bf254c4ca9ebccb25328296584fb5e87ad635ae0c1cc1deb0b5bb37a4608813
|
||||
LINUX_VERSION-6.1 = .95
|
||||
LINUX_KERNEL_HASH-6.1.95 = 2960f0aa1d75665f39114ad3c272a999c54796e553a2355d0379f5188d14dfbd
|
||||
|
||||
@@ -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 = .35
|
||||
LINUX_KERNEL_HASH-6.6.35 = fce3ee728712ed063aa8c14a8756c8ff8c7a46ba3827f61d2b04a73c7cf5dd9e
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
DTC=$(wildcard $(LINUX_DIR)/scripts/dtc/dtc)
|
||||
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 并选择配置等等,即可编译你需要的固件了
|
||||
@@ -1 +1,6 @@
|
||||
# Defaults are configured in /etc/sysctl.d/* and can be customized in this file
|
||||
|
||||
# disable bridge firewalling.(Fixed the problem that even if br-netfilter is disabled in package/kernel/linux/files/sysctl-br-netfilter.conf, NAT loopback will still fail. This applies to OpenWrt with Docker)
|
||||
net.bridge.bridge-nf-call-arptables = 0
|
||||
net.bridge.bridge-nf-call-ip6tables = 0
|
||||
net.bridge.bridge-nf-call-iptables = 0
|
||||
|
||||
@@ -17,6 +17,7 @@ missing_lines() {
|
||||
do_mount_root() {
|
||||
mount_root
|
||||
boot_run_hook preinit_mount_root
|
||||
[ ! -f /etc/bench.log ] && touch /etc/bench.log
|
||||
have_ro_ext4=$(/bin/cat /proc/mounts |/bin/grep ' / ext4'|/bin/grep 'ro'|/usr/bin/wc -l)
|
||||
if [ "$have_ro_ext4" != "0" ]; then
|
||||
/usr/bin/mount -o remount,rw,noatime /
|
||||
|
||||
@@ -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
|
||||
@@ -61,4 +64,4 @@ emmc_do_upgrade() {
|
||||
"fit") emmc_upgrade_fit $1;;
|
||||
*) emmc_upgrade_tar $1;;
|
||||
esac
|
||||
}
|
||||
}
|
||||
@@ -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,72 +9,332 @@
|
||||
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:=2023-07-24
|
||||
PKG_SOURCE_VERSION:=00ac6db375b76e57e1f5e9e9bffa033e907c3581
|
||||
PKG_MIRROR_HASH:=74fc18395532c4292f530da8d00fa1873ada4e05e600c0077a7b7f85ace0d913
|
||||
|
||||
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:=
|
||||
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-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-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 (SDcard, 1x DDR3)
|
||||
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 (SDcard, 2x DDR3)
|
||||
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-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/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-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-spim-nand-comb
|
||||
NAME:=MediaTek MT7988 (SPI-NAND via SPIM)
|
||||
BOOT_DEVICE:=spim-nand
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7988
|
||||
DRAM_USE_COMB:=1
|
||||
endef
|
||||
|
||||
TFA_TARGETS:= \
|
||||
mt7622-nor-1ddr \
|
||||
mt7622-nor-2ddr \
|
||||
@@ -83,22 +343,53 @@ TFA_TARGETS:= \
|
||||
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 \
|
||||
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 \
|
||||
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-spim-nand-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) \
|
||||
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))
|
||||
|
||||
@@ -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.7
|
||||
PKG_RELEASE:=1
|
||||
PKG_HASH:=bf3eb3617a74cddd7fb0e0eacbfe38c3258ee07d4c8ed730deef7a175cc3d55b
|
||||
PKG_HASH:=53422dc649153838e03820330ba17cb10afe3e330ecde0db11e4d5f1361a33e6
|
||||
|
||||
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
|
||||
|
||||
PKG_ASLR_PIE:=0
|
||||
PKG_SSP:=0
|
||||
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
|
||||
|
||||
TARGET_CFLAGS := $(filter-out -O2 -O3 -fno-plt,$(TARGET_CFLAGS))
|
||||
|
||||
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))
|
||||
@@ -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|\
|
||||
|
||||
60
package/boot/uboot-envtools/files/mediatek_filogic
Normal file
60
package/boot/uboot-envtools/files/mediatek_filogic
Normal file
@@ -0,0 +1,60 @@
|
||||
#
|
||||
# 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)
|
||||
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
|
||||
@@ -48,6 +48,7 @@ ravpower,rp-wd03)
|
||||
[ -n "$idx" ] && \
|
||||
ubootenv_add_uci_config "/dev/mtd$idx" "0x4000" "0x1000" "0x1000"
|
||||
;;
|
||||
c-life,xg1|\
|
||||
jcg,q20)
|
||||
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000"
|
||||
;;
|
||||
|
||||
@@ -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:=2023.07.02
|
||||
PKG_HASH:=6b6a48581c14abb0f95bd87c1af4d740922406d7b801002a9f94727fdde021d5
|
||||
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,193 @@ 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
|
||||
BL2_SOC:=mt7986
|
||||
BL2_DDRTYPE:=ddr4
|
||||
DEPENDS:=+trusted-firmware-a-mt7986-spim-nand-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_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 +370,68 @@ UBOOT_TARGETS := \
|
||||
mt7622_ubnt_unifi-6-lr \
|
||||
mt7623n_bpir2 \
|
||||
mt7623a_unielec_u7623 \
|
||||
mt7629_rfb
|
||||
mt7628_rfb \
|
||||
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_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 = {
|
||||
@@ -1,25 +0,0 @@
|
||||
From c47a5b927787a463eff8f67339d91e60fe0381c4 Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Tue, 2 Mar 2021 15:02:50 +0800
|
||||
Subject: [PATCH 07/21] configs: mt7622: use ARMv8 Generic Timer instead of
|
||||
mtk_timer
|
||||
|
||||
It's better to use the generic timer which is correctly initialized by
|
||||
the ATF. The generic timer has higher resolution than the mtk_timer.
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
configs/mt7622_rfb_defconfig | 2 --
|
||||
1 file changed, 2 deletions(-)
|
||||
|
||||
--- a/configs/mt7622_rfb_defconfig
|
||||
+++ b/configs/mt7622_rfb_defconfig
|
||||
@@ -51,8 +51,6 @@ CONFIG_SPI=y
|
||||
CONFIG_DM_SPI=y
|
||||
CONFIG_MTK_SNOR=y
|
||||
CONFIG_SYSRESET_WATCHDOG=y
|
||||
-CONFIG_TIMER=y
|
||||
-CONFIG_MTK_TIMER=y
|
||||
CONFIG_WDT_MTK=y
|
||||
CONFIG_LZO=y
|
||||
CONFIG_HEXDUMP=y
|
||||
@@ -1,50 +0,0 @@
|
||||
From 4bee3f9e285007ccf77ca9916fff3d93fc4d8a80 Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Tue, 2 Mar 2021 15:43:27 +0800
|
||||
Subject: [PATCH 08/21] dts: mt7629: enable JTAG pins by default
|
||||
|
||||
The EPHY LEDs belongs to the built-in FE switch of MT7629, which is barely
|
||||
used. These LED pins on reference boards are used as JTAG socket. So it's
|
||||
a good idea to change the default state to JTAG, and this will make it
|
||||
convenience for debugging.
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
arch/arm/dts/mt7629-rfb.dts | 10 ++++++++++
|
||||
arch/arm/dts/mt7629.dtsi | 6 ++++++
|
||||
2 files changed, 16 insertions(+)
|
||||
|
||||
--- a/arch/arm/dts/mt7629-rfb.dts
|
||||
+++ b/arch/arm/dts/mt7629-rfb.dts
|
||||
@@ -36,6 +36,16 @@
|
||||
};
|
||||
|
||||
&pinctrl {
|
||||
+ state_default: pinmux_conf {
|
||||
+ u-boot,dm-pre-reloc;
|
||||
+
|
||||
+ mux {
|
||||
+ function = "jtag";
|
||||
+ groups = "ephy_leds_jtag";
|
||||
+ u-boot,dm-pre-reloc;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
snfi_pins: snfi-pins {
|
||||
mux {
|
||||
function = "flash";
|
||||
--- a/arch/arm/dts/mt7629.dtsi
|
||||
+++ b/arch/arm/dts/mt7629.dtsi
|
||||
@@ -152,6 +152,12 @@
|
||||
compatible = "mediatek,mt7629-pinctrl";
|
||||
reg = <0x10217000 0x8000>;
|
||||
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&state_default>;
|
||||
+
|
||||
+ state_default: pinmux_conf {
|
||||
+ };
|
||||
+
|
||||
gpio: gpio-controller {
|
||||
gpio-controller;
|
||||
#gpio-cells = <2>;
|
||||
@@ -1,44 +0,0 @@
|
||||
From f3f320af7078a8c5647d870a31c1d3695dacd7cf Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Tue, 2 Mar 2021 15:47:45 +0800
|
||||
Subject: [PATCH 09/21] board: mediatek: add more network configurations
|
||||
|
||||
Make the network configurations uniform for mediatek boards
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
include/configs/mt7622.h | 3 ++-
|
||||
include/configs/mt7623.h | 1 +
|
||||
include/configs/mt7629.h | 1 +
|
||||
3 files changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/include/configs/mt7622.h
|
||||
+++ b/include/configs/mt7622.h
|
||||
@@ -36,6 +36,7 @@
|
||||
|
||||
/* Ethernet */
|
||||
#define CONFIG_IPADDR 192.168.1.1
|
||||
-#define CONFIG_SERVERIP 192.168.1.3
|
||||
+#define CONFIG_SERVERIP 192.168.1.2
|
||||
+#define CONFIG_NETMASK 255.255.255.0
|
||||
|
||||
#endif
|
||||
--- a/include/configs/mt7623.h
|
||||
+++ b/include/configs/mt7623.h
|
||||
@@ -54,6 +54,7 @@
|
||||
/* Ethernet */
|
||||
#define CONFIG_IPADDR 192.168.1.1
|
||||
#define CONFIG_SERVERIP 192.168.1.2
|
||||
+#define CONFIG_NETMASK 255.255.255.0
|
||||
|
||||
#ifdef CONFIG_DISTRO_DEFAULTS
|
||||
|
||||
--- a/include/configs/mt7629.h
|
||||
+++ b/include/configs/mt7629.h
|
||||
@@ -52,5 +52,6 @@
|
||||
/* Ethernet */
|
||||
#define CONFIG_IPADDR 192.168.1.1
|
||||
#define CONFIG_SERVERIP 192.168.1.2
|
||||
+#define CONFIG_NETMASK 255.255.255.0
|
||||
|
||||
#endif
|
||||
@@ -1,38 +0,0 @@
|
||||
From ed880b7572e1135e3bd8382d4670a375f7d9c91b Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Tue, 2 Mar 2021 15:56:17 +0800
|
||||
Subject: [PATCH 10/21] mmc: mtk-sd: increase the minimum bus frequency
|
||||
|
||||
With a 48MHz input clock, the lowest bus frequency can be as low as
|
||||
48000000 / (4 * 4095) = 2930Hz. Such an extremely low frequency will cause
|
||||
the mmc framework take seconds to finish the initialization.
|
||||
|
||||
Limiting the minimum bus frequency to a slightly higher value can solve the
|
||||
issue without any side effects.
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
drivers/mmc/mtk-sd.c | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
--- a/drivers/mmc/mtk-sd.c
|
||||
+++ b/drivers/mmc/mtk-sd.c
|
||||
@@ -232,6 +232,8 @@
|
||||
|
||||
#define SCLK_CYCLES_SHIFT 20
|
||||
|
||||
+#define MIN_BUS_CLK 260000
|
||||
+
|
||||
#define CMD_INTS_MASK \
|
||||
(MSDC_INT_CMDRDY | MSDC_INT_RSPCRCERR | MSDC_INT_CMDTMO)
|
||||
|
||||
@@ -1639,6 +1641,9 @@ static int msdc_drv_probe(struct udevice
|
||||
else
|
||||
cfg->f_min = host->src_clk_freq / (4 * 4095);
|
||||
|
||||
+ if (cfg->f_min < MIN_BUS_CLK)
|
||||
+ cfg->f_min = MIN_BUS_CLK;
|
||||
+
|
||||
if (cfg->f_max < cfg->f_min || cfg->f_max > host->src_clk_freq)
|
||||
cfg->f_max = host->src_clk_freq;
|
||||
|
||||
@@ -1,141 +0,0 @@
|
||||
From d8bde59186dafdea5bbe8d29d3a6ae7cac98e9d0 Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Mon, 25 Jan 2021 11:19:08 +0800
|
||||
Subject: [PATCH 11/21] serial: serial-mtk: rewrite the setbrg function
|
||||
|
||||
Currently the setbrg logic of serial-mtk is messy, and should be rewritten.
|
||||
Also an option is added to make it possible to use highspeed=3 mode for all
|
||||
bauds.
|
||||
|
||||
The new logic is:
|
||||
1. If baud clock > 12MHz
|
||||
a) If baud <= 115200, highspeed=0 mode will be used (ns16550 compatible)
|
||||
b) If baud <= 576000, highspeed=2 mode will be used
|
||||
c) any baud > 576000, highspeed=3 mode will be used
|
||||
2. If baud clock <= 12MHz
|
||||
Always uses highspeed=3 mode
|
||||
a) If baud <= 115200, calculates the divisor using DIV_ROUND_CLOSEST
|
||||
b) any baud > 115200, the same as 1. c)
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
drivers/serial/serial_mtk.c | 74 +++++++++++++++++--------------------
|
||||
1 file changed, 33 insertions(+), 41 deletions(-)
|
||||
|
||||
--- a/drivers/serial/serial_mtk.c
|
||||
+++ b/drivers/serial/serial_mtk.c
|
||||
@@ -73,74 +73,64 @@ struct mtk_serial_regs {
|
||||
struct mtk_serial_priv {
|
||||
struct mtk_serial_regs __iomem *regs;
|
||||
u32 clock;
|
||||
+ bool force_highspeed;
|
||||
};
|
||||
|
||||
static void _mtk_serial_setbrg(struct mtk_serial_priv *priv, int baud)
|
||||
{
|
||||
- bool support_clk12m_baud115200;
|
||||
- u32 quot, samplecount, realbaud;
|
||||
+ u32 quot, realbaud, samplecount = 1;
|
||||
|
||||
- if ((baud <= 115200) && (priv->clock == 12000000))
|
||||
- support_clk12m_baud115200 = true;
|
||||
- else
|
||||
- support_clk12m_baud115200 = false;
|
||||
+ /* Special case for low baud clock */
|
||||
+ if ((baud <= 115200) && (priv->clock == 12000000)) {
|
||||
+ writel(3, &priv->regs->highspeed);
|
||||
+
|
||||
+ quot = DIV_ROUND_CLOSEST(priv->clock, 256 * baud);
|
||||
+ if (quot == 0)
|
||||
+ quot = 1;
|
||||
+
|
||||
+ samplecount = DIV_ROUND_CLOSEST(priv->clock, quot * baud);
|
||||
+
|
||||
+ realbaud = priv->clock / samplecount / quot;
|
||||
+ if ((realbaud > BAUD_ALLOW_MAX(baud)) ||
|
||||
+ (realbaud < BAUD_ALLOW_MIX(baud))) {
|
||||
+ pr_info("baud %d can't be handled\n", baud);
|
||||
+ }
|
||||
+
|
||||
+ goto set_baud;
|
||||
+ }
|
||||
+
|
||||
+ if (priv->force_highspeed)
|
||||
+ goto use_hs3;
|
||||
|
||||
if (baud <= 115200) {
|
||||
writel(0, &priv->regs->highspeed);
|
||||
quot = DIV_ROUND_CLOSEST(priv->clock, 16 * baud);
|
||||
-
|
||||
- if (support_clk12m_baud115200) {
|
||||
- writel(3, &priv->regs->highspeed);
|
||||
- quot = DIV_ROUND_CLOSEST(priv->clock, 256 * baud);
|
||||
- if (quot == 0)
|
||||
- quot = 1;
|
||||
-
|
||||
- samplecount = DIV_ROUND_CLOSEST(priv->clock,
|
||||
- quot * baud);
|
||||
- if (samplecount != 0) {
|
||||
- realbaud = priv->clock / samplecount / quot;
|
||||
- if ((realbaud > BAUD_ALLOW_MAX(baud)) ||
|
||||
- (realbaud < BAUD_ALLOW_MIX(baud))) {
|
||||
- pr_info("baud %d can't be handled\n",
|
||||
- baud);
|
||||
- }
|
||||
- } else {
|
||||
- pr_info("samplecount is 0\n");
|
||||
- }
|
||||
- }
|
||||
} else if (baud <= 576000) {
|
||||
writel(2, &priv->regs->highspeed);
|
||||
|
||||
/* Set to next lower baudrate supported */
|
||||
if ((baud == 500000) || (baud == 576000))
|
||||
baud = 460800;
|
||||
+
|
||||
quot = DIV_ROUND_UP(priv->clock, 4 * baud);
|
||||
} else {
|
||||
+use_hs3:
|
||||
writel(3, &priv->regs->highspeed);
|
||||
+
|
||||
quot = DIV_ROUND_UP(priv->clock, 256 * baud);
|
||||
+ samplecount = DIV_ROUND_CLOSEST(priv->clock, quot * baud);
|
||||
}
|
||||
|
||||
+set_baud:
|
||||
/* set divisor */
|
||||
writel(UART_LCR_WLS_8 | UART_LCR_DLAB, &priv->regs->lcr);
|
||||
writel(quot & 0xff, &priv->regs->dll);
|
||||
writel((quot >> 8) & 0xff, &priv->regs->dlm);
|
||||
writel(UART_LCR_WLS_8, &priv->regs->lcr);
|
||||
|
||||
- if (baud > 460800) {
|
||||
- u32 tmp;
|
||||
-
|
||||
- tmp = DIV_ROUND_CLOSEST(priv->clock, quot * baud);
|
||||
- writel(tmp - 1, &priv->regs->sample_count);
|
||||
- writel((tmp - 2) >> 1, &priv->regs->sample_point);
|
||||
- } else {
|
||||
- writel(0, &priv->regs->sample_count);
|
||||
- writel(0xff, &priv->regs->sample_point);
|
||||
- }
|
||||
-
|
||||
- if (support_clk12m_baud115200) {
|
||||
- writel(samplecount - 1, &priv->regs->sample_count);
|
||||
- writel((samplecount - 2) >> 1, &priv->regs->sample_point);
|
||||
- }
|
||||
+ /* set highspeed mode sample count & point */
|
||||
+ writel(samplecount - 1, &priv->regs->sample_count);
|
||||
+ writel((samplecount - 2) >> 1, &priv->regs->sample_point);
|
||||
}
|
||||
|
||||
static int _mtk_serial_putc(struct mtk_serial_priv *priv, const char ch)
|
||||
@@ -248,6 +238,8 @@ static int mtk_serial_of_to_plat(struct
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
+ priv->force_highspeed = dev_read_bool(dev, "mediatek,force-highspeed");
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,94 +0,0 @@
|
||||
From a80ef99cb308904b82662deb66c5ed7a6ff59928 Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Wed, 3 Mar 2021 11:13:36 +0800
|
||||
Subject: [PATCH 12/21] board: mt7629: enable compression of u-boot to reduce
|
||||
the size of final image
|
||||
|
||||
This patch makes use of the decompression mechanism implemented for mt7628
|
||||
previously to reduce the total image size. Binman will be also removed.
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
Makefile | 3 +++
|
||||
arch/arm/dts/mt7629-rfb-u-boot.dtsi | 18 ------------------
|
||||
arch/arm/mach-mediatek/Kconfig | 1 -
|
||||
configs/mt7629_rfb_defconfig | 6 ++++++
|
||||
4 files changed, 9 insertions(+), 19 deletions(-)
|
||||
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -1666,6 +1666,9 @@ u-boot-elf.lds: arch/u-boot-elf.lds prep
|
||||
|
||||
ifeq ($(CONFIG_SPL),y)
|
||||
spl/u-boot-spl-mtk.bin: spl/u-boot-spl
|
||||
+
|
||||
+u-boot-mtk.bin: u-boot-with-spl.bin
|
||||
+ $(call if_changed,copy)
|
||||
else
|
||||
MKIMAGEFLAGS_u-boot-mtk.bin = -T mtk_image \
|
||||
-a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE) \
|
||||
--- a/arch/arm/dts/mt7629-rfb-u-boot.dtsi
|
||||
+++ b/arch/arm/dts/mt7629-rfb-u-boot.dtsi
|
||||
@@ -5,24 +5,6 @@
|
||||
* Author: Weijie Gao <weijie.gao@mediatek.com>
|
||||
*/
|
||||
|
||||
-#include <config.h>
|
||||
-/ {
|
||||
- binman {
|
||||
- filename = "u-boot-mtk.bin";
|
||||
- pad-byte = <0xff>;
|
||||
-
|
||||
-#ifdef CONFIG_SPL
|
||||
- blob {
|
||||
- filename = "spl/u-boot-spl-mtk.bin";
|
||||
- size = <CONFIG_SPL_PAD_TO>;
|
||||
- };
|
||||
-
|
||||
- u-boot-img {
|
||||
- };
|
||||
-#endif
|
||||
- };
|
||||
-};
|
||||
-
|
||||
&infracfg {
|
||||
u-boot,dm-pre-reloc;
|
||||
};
|
||||
--- a/arch/arm/mach-mediatek/Kconfig
|
||||
+++ b/arch/arm/mach-mediatek/Kconfig
|
||||
@@ -36,7 +36,6 @@ config TARGET_MT7629
|
||||
bool "MediaTek MT7629 SoC"
|
||||
select CPU_V7A
|
||||
select SPL
|
||||
- select BINMAN
|
||||
help
|
||||
The MediaTek MT7629 is a ARM-based SoC with a dual-core Cortex-A7
|
||||
including DDR3, crypto engine, 3x3 11n/ac Wi-Fi, Gigabit Ethernet,
|
||||
--- a/configs/mt7629_rfb_defconfig
|
||||
+++ b/configs/mt7629_rfb_defconfig
|
||||
@@ -10,7 +10,11 @@ CONFIG_SPL_TEXT_BASE=0x201000
|
||||
CONFIG_TARGET_MT7629=y
|
||||
CONFIG_SPL_SERIAL_SUPPORT=y
|
||||
CONFIG_SPL_DRIVERS_MISC_SUPPORT=y
|
||||
+CONFIG_SPL_STACK_R_ADDR=0x40800000
|
||||
+CONFIG_SPL_PAYLOAD="u-boot-lzma.img"
|
||||
+CONFIG_BUILD_TARGET="u-boot-mtk.bin"
|
||||
CONFIG_DEFAULT_DEVICE_TREE="mt7629-rfb"
|
||||
+CONFIG_SPL_IMAGE="spl/u-boot-spl-mtk.bin"
|
||||
CONFIG_FIT=y
|
||||
CONFIG_FIT_VERBOSE=y
|
||||
CONFIG_BOOTDELAY=3
|
||||
@@ -18,6 +22,7 @@ CONFIG_DEFAULT_FDT_FILE="mt7629-rfb"
|
||||
CONFIG_SYS_CONSOLE_IS_IN_ENV=y
|
||||
# CONFIG_DISPLAY_BOARDINFO is not set
|
||||
CONFIG_SPL_SYS_MALLOC_SIMPLE=y
|
||||
+CONFIG_SPL_STACK_R=y
|
||||
CONFIG_SPL_NOR_SUPPORT=y
|
||||
CONFIG_SPL_WATCHDOG_SUPPORT=y
|
||||
CONFIG_HUSH_PARSER=y
|
||||
@@ -87,4 +92,5 @@ CONFIG_USB_STORAGE=y
|
||||
CONFIG_USB_KEYBOARD=y
|
||||
CONFIG_WDT_MTK=y
|
||||
CONFIG_LZMA=y
|
||||
+CONFIG_SPL_LZMA=y
|
||||
# CONFIG_EFI_LOADER is not set
|
||||
@@ -1,26 +0,0 @@
|
||||
From acd49b1549ff52286aace5e841420aa750325f8b Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Wed, 3 Mar 2021 10:53:14 +0800
|
||||
Subject: [PATCH 13/21] configs: mt7622: enable debug uart for
|
||||
mt7622_rfb_defconfig
|
||||
|
||||
Enable debug uart for mt7622_rfb_defconfig
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
configs/mt7622_rfb_defconfig | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
--- a/configs/mt7622_rfb_defconfig
|
||||
+++ b/configs/mt7622_rfb_defconfig
|
||||
@@ -4,7 +4,10 @@ CONFIG_ARCH_MEDIATEK=y
|
||||
CONFIG_SYS_TEXT_BASE=0x41e00000
|
||||
CONFIG_SYS_MALLOC_F_LEN=0x4000
|
||||
CONFIG_NR_DRAM_BANKS=1
|
||||
+CONFIG_DEBUG_UART_BASE=0x11002000
|
||||
+CONFIG_DEBUG_UART_CLOCK=25000000
|
||||
CONFIG_DEFAULT_DEVICE_TREE="mt7622-rfb"
|
||||
+CONFIG_DEBUG_UART=y
|
||||
CONFIG_FIT=y
|
||||
CONFIG_DEFAULT_FDT_FILE="mt7622-rfb"
|
||||
CONFIG_LOGLEVEL=7
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,174 +0,0 @@
|
||||
From 0c857d4c9cd9dc8e8ebba18cf9e9b10513ccb35d Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Wed, 3 Mar 2021 08:57:29 +0800
|
||||
Subject: [PATCH 15/21] mtd: mtk-snand: add support for SPL
|
||||
|
||||
Add support to initialize SPI-NAND in SPL.
|
||||
Add implementation for SPL NAND loader.
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
drivers/mtd/mtk-snand/Kconfig | 6 ++
|
||||
drivers/mtd/mtk-snand/Makefile | 4 +
|
||||
drivers/mtd/mtk-snand/mtk-snand-spl.c | 132 ++++++++++++++++++++++++++
|
||||
3 files changed, 142 insertions(+)
|
||||
create mode 100644 drivers/mtd/mtk-snand/mtk-snand-spl.c
|
||||
|
||||
--- a/drivers/mtd/mtk-snand/Kconfig
|
||||
+++ b/drivers/mtd/mtk-snand/Kconfig
|
||||
@@ -19,3 +19,9 @@ config MTK_SPI_NAND_MTD
|
||||
help
|
||||
This option enables access to SPI-NAND flashes through the
|
||||
MTD interface of MediaTek SPI NAND Flash Controller
|
||||
+
|
||||
+config SPL_MTK_SPI_NAND
|
||||
+ tristate "SPL support for MediaTek SPI NAND flash controller"
|
||||
+ depends on MTK_SPI_NAND
|
||||
+ help
|
||||
+ This option enables access to SPI-NAND flashes in the SPL stage
|
||||
--- a/drivers/mtd/mtk-snand/Makefile
|
||||
+++ b/drivers/mtd/mtk-snand/Makefile
|
||||
@@ -8,4 +8,8 @@
|
||||
obj-y += mtk-snand.o mtk-snand-ecc.o mtk-snand-ids.o mtk-snand-os.o
|
||||
obj-$(CONFIG_MTK_SPI_NAND_MTD) += mtk-snand-mtd.o
|
||||
|
||||
+ifdef CONFIG_SPL_BUILD
|
||||
+obj-$(CONFIG_SPL_MTK_SPI_NAND) += mtk-snand-spl.o
|
||||
+endif
|
||||
+
|
||||
ccflags-y += -DPRIVATE_MTK_SNAND_HEADER
|
||||
--- /dev/null
|
||||
+++ b/drivers/mtd/mtk-snand/mtk-snand-spl.c
|
||||
@@ -0,0 +1,132 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0
|
||||
+/*
|
||||
+ * Copyright (C) 2020 MediaTek Inc. All Rights Reserved.
|
||||
+ *
|
||||
+ * Author: Weijie Gao <weijie.gao@mediatek.com>
|
||||
+ */
|
||||
+
|
||||
+#include <common.h>
|
||||
+#include <dm.h>
|
||||
+#include <dm/uclass.h>
|
||||
+#include <malloc.h>
|
||||
+#include <mapmem.h>
|
||||
+#include <mtd.h>
|
||||
+#include <watchdog.h>
|
||||
+
|
||||
+#include "mtk-snand.h"
|
||||
+
|
||||
+static struct mtk_snand *snf;
|
||||
+static struct mtk_snand_chip_info cinfo;
|
||||
+static u32 oobavail;
|
||||
+
|
||||
+static u8 *page_cache;
|
||||
+
|
||||
+int nand_spl_load_image(uint32_t offs, unsigned int size, void *dst)
|
||||
+{
|
||||
+ u32 sizeremain = size, chunksize, leading;
|
||||
+ uint32_t off = offs, writesize_mask = cinfo.pagesize - 1;
|
||||
+ uint8_t *ptr = dst;
|
||||
+ int ret;
|
||||
+
|
||||
+ if (!snf)
|
||||
+ return -ENODEV;
|
||||
+
|
||||
+ while (sizeremain) {
|
||||
+ WATCHDOG_RESET();
|
||||
+
|
||||
+ leading = off & writesize_mask;
|
||||
+ chunksize = cinfo.pagesize - leading;
|
||||
+ if (chunksize > sizeremain)
|
||||
+ chunksize = sizeremain;
|
||||
+
|
||||
+ if (chunksize == cinfo.pagesize) {
|
||||
+ ret = mtk_snand_read_page(snf, off - leading, ptr,
|
||||
+ NULL, false);
|
||||
+ if (ret)
|
||||
+ break;
|
||||
+ } else {
|
||||
+ ret = mtk_snand_read_page(snf, off - leading,
|
||||
+ page_cache, NULL, false);
|
||||
+ if (ret)
|
||||
+ break;
|
||||
+
|
||||
+ memcpy(ptr, page_cache + leading, chunksize);
|
||||
+ }
|
||||
+
|
||||
+ off += chunksize;
|
||||
+ ptr += chunksize;
|
||||
+ sizeremain -= chunksize;
|
||||
+ }
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+void nand_init(void)
|
||||
+{
|
||||
+ struct mtk_snand_platdata mtk_snand_pdata = {};
|
||||
+ struct udevice *dev;
|
||||
+ fdt_addr_t base;
|
||||
+ int ret;
|
||||
+
|
||||
+ ret = uclass_get_device_by_driver(UCLASS_MTD, DM_DRIVER_GET(mtk_snand),
|
||||
+ &dev);
|
||||
+ if (ret) {
|
||||
+ printf("mtk-snand-spl: Device instance not found!\n");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ base = dev_read_addr_name(dev, "nfi");
|
||||
+ if (base == FDT_ADDR_T_NONE) {
|
||||
+ printf("mtk-snand-spl: NFI base not set\n");
|
||||
+ return;
|
||||
+ }
|
||||
+ mtk_snand_pdata.nfi_base = map_sysmem(base, 0);
|
||||
+
|
||||
+ base = dev_read_addr_name(dev, "ecc");
|
||||
+ if (base == FDT_ADDR_T_NONE) {
|
||||
+ printf("mtk-snand-spl: ECC base not set\n");
|
||||
+ return;
|
||||
+ }
|
||||
+ mtk_snand_pdata.ecc_base = map_sysmem(base, 0);
|
||||
+
|
||||
+ mtk_snand_pdata.soc = dev_get_driver_data(dev);
|
||||
+ mtk_snand_pdata.quad_spi = dev_read_bool(dev, "quad-spi");
|
||||
+
|
||||
+ ret = mtk_snand_init(NULL, &mtk_snand_pdata, &snf);
|
||||
+ if (ret) {
|
||||
+ printf("mtk-snand-spl: failed to initialize SPI-NAND\n");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ mtk_snand_get_chip_info(snf, &cinfo);
|
||||
+
|
||||
+ oobavail = cinfo.num_sectors * (cinfo.fdm_size - 1);
|
||||
+
|
||||
+ printf("SPI-NAND: %s (%uMB)\n", cinfo.model,
|
||||
+ (u32)(cinfo.chipsize >> 20));
|
||||
+
|
||||
+ page_cache = malloc(cinfo.pagesize + cinfo.sparesize);
|
||||
+ if (!page_cache) {
|
||||
+ mtk_snand_cleanup(snf);
|
||||
+ printf("mtk-snand-spl: failed to allocate page cache\n");
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void nand_deselect(void)
|
||||
+{
|
||||
+
|
||||
+}
|
||||
+
|
||||
+static const struct udevice_id mtk_snand_ids[] = {
|
||||
+ { .compatible = "mediatek,mt7622-snand", .data = SNAND_SOC_MT7622 },
|
||||
+ { .compatible = "mediatek,mt7629-snand", .data = SNAND_SOC_MT7629 },
|
||||
+ { .compatible = "mediatek,mt7986-snand", .data = SNAND_SOC_MT7986 },
|
||||
+ { /* sentinel */ },
|
||||
+};
|
||||
+
|
||||
+U_BOOT_DRIVER(mtk_snand) = {
|
||||
+ .name = "mtk-snand",
|
||||
+ .id = UCLASS_MTD,
|
||||
+ .of_match = mtk_snand_ids,
|
||||
+ .flags = DM_FLAG_PRE_RELOC,
|
||||
+};
|
||||
@@ -1,409 +0,0 @@
|
||||
From eaa9bc597e0bf8bcd1486ea49c8c7c070a37a8aa Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Wed, 3 Mar 2021 10:11:32 +0800
|
||||
Subject: [PATCH 16/21] env: add support for generic MTD device
|
||||
|
||||
Add an env driver for generic MTD device.
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
cmd/nvedit.c | 3 +-
|
||||
env/Kconfig | 37 +++++-
|
||||
env/Makefile | 1 +
|
||||
env/env.c | 3 +
|
||||
env/mtd.c | 256 +++++++++++++++++++++++++++++++++++++++++
|
||||
include/env_internal.h | 1 +
|
||||
tools/Makefile | 1 +
|
||||
7 files changed, 299 insertions(+), 3 deletions(-)
|
||||
create mode 100644 env/mtd.c
|
||||
|
||||
--- a/cmd/nvedit.c
|
||||
+++ b/cmd/nvedit.c
|
||||
@@ -50,6 +50,7 @@ DECLARE_GLOBAL_DATA_PTR;
|
||||
defined(CONFIG_ENV_IS_IN_MMC) || \
|
||||
defined(CONFIG_ENV_IS_IN_FAT) || \
|
||||
defined(CONFIG_ENV_IS_IN_EXT4) || \
|
||||
+ defined(CONFIG_ENV_IS_IN_MTD) || \
|
||||
defined(CONFIG_ENV_IS_IN_NAND) || \
|
||||
defined(CONFIG_ENV_IS_IN_NVRAM) || \
|
||||
defined(CONFIG_ENV_IS_IN_ONENAND) || \
|
||||
@@ -64,7 +65,7 @@ DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
#if !defined(ENV_IS_IN_DEVICE) && \
|
||||
!defined(CONFIG_ENV_IS_NOWHERE)
|
||||
-# error Define one of CONFIG_ENV_IS_IN_{EEPROM|FLASH|MMC|FAT|EXT4|\
|
||||
+# error Define one of CONFIG_ENV_IS_IN_{EEPROM|FLASH|MMC|FAT|EXT4|MTD|\
|
||||
NAND|NVRAM|ONENAND|SATA|SPI_FLASH|REMOTE|UBI} or CONFIG_ENV_IS_NOWHERE
|
||||
#endif
|
||||
|
||||
--- a/env/Kconfig
|
||||
+++ b/env/Kconfig
|
||||
@@ -19,7 +19,7 @@ config ENV_IS_NOWHERE
|
||||
!ENV_IS_IN_MMC && !ENV_IS_IN_NAND && \
|
||||
!ENV_IS_IN_NVRAM && !ENV_IS_IN_ONENAND && \
|
||||
!ENV_IS_IN_REMOTE && !ENV_IS_IN_SPI_FLASH && \
|
||||
- !ENV_IS_IN_UBI
|
||||
+ !ENV_IS_IN_UBI && !ENV_IS_IN_MTD
|
||||
help
|
||||
Define this if you don't want to or can't have an environment stored
|
||||
on a storage medium. In this case the environment will still exist
|
||||
@@ -207,6 +207,27 @@ config ENV_IS_IN_MMC
|
||||
This value is also in units of bytes, but must also be aligned to
|
||||
an MMC sector boundary.
|
||||
|
||||
+config ENV_IS_IN_MTD
|
||||
+ bool "Environment in a MTD device"
|
||||
+ depends on !CHAIN_OF_TRUST
|
||||
+ depends on MTD
|
||||
+ help
|
||||
+ Define this if you have a MTD device which you want to use for
|
||||
+ the environment.
|
||||
+
|
||||
+ - CONFIG_ENV_MTD_NAME:
|
||||
+ - CONFIG_ENV_OFFSET:
|
||||
+ - CONFIG_ENV_SIZE:
|
||||
+
|
||||
+ These three #defines specify the MTD device where the environment
|
||||
+ is stored, offset and size of the environment area within the MTD
|
||||
+ device. CONFIG_ENV_OFFSET must be aligned to an erase block boundary.
|
||||
+
|
||||
+ - CONFIG_ENV_SIZE_REDUND:
|
||||
+
|
||||
+ This #define specify the maximum size allowed for read/write/erase
|
||||
+ with skipped bad blocks starting from ENV_OFFSET.
|
||||
+
|
||||
config ENV_IS_IN_NAND
|
||||
bool "Environment in a NAND device"
|
||||
depends on !CHAIN_OF_TRUST
|
||||
@@ -513,10 +534,16 @@ config ENV_ADDR_REDUND
|
||||
Offset from the start of the device (or partition) of the redundant
|
||||
environment location.
|
||||
|
||||
+config ENV_MTD_NAME
|
||||
+ string "Name of the MTD device storing the environment"
|
||||
+ depends on ENV_IS_IN_MTD
|
||||
+ help
|
||||
+ Name of the MTD device that stores the environment
|
||||
+
|
||||
config ENV_OFFSET
|
||||
hex "Environment offset"
|
||||
depends on ENV_IS_IN_EEPROM || ENV_IS_IN_MMC || ENV_IS_IN_NAND || \
|
||||
- ENV_IS_IN_SPI_FLASH
|
||||
+ ENV_IS_IN_SPI_FLASH || ENV_IS_IN_MTD
|
||||
default 0x3f8000 if ARCH_ROCKCHIP && ENV_IS_IN_MMC
|
||||
default 0x140000 if ARCH_ROCKCHIP && ENV_IS_IN_SPI_FLASH
|
||||
default 0x88000 if ARCH_SUNXI
|
||||
@@ -560,6 +587,12 @@ config ENV_SECT_SIZE
|
||||
help
|
||||
Size of the sector containing the environment.
|
||||
|
||||
+config ENV_SIZE_REDUND
|
||||
+ hex "Redundant environment size"
|
||||
+ depends on ENV_IS_IN_MTD
|
||||
+ help
|
||||
+ The maximum size allowed for read/write/erase with skipped bad blocks.
|
||||
+
|
||||
config ENV_UBI_PART
|
||||
string "UBI partition name"
|
||||
depends on ENV_IS_IN_UBI
|
||||
--- a/env/Makefile
|
||||
+++ b/env/Makefile
|
||||
@@ -26,6 +26,7 @@ obj-$(CONFIG_$(SPL_TPL_)ENV_IS_NOWHERE)
|
||||
obj-$(CONFIG_$(SPL_TPL_)ENV_IS_IN_MMC) += mmc.o
|
||||
obj-$(CONFIG_$(SPL_TPL_)ENV_IS_IN_FAT) += fat.o
|
||||
obj-$(CONFIG_$(SPL_TPL_)ENV_IS_IN_EXT4) += ext4.o
|
||||
+obj-$(CONFIG_$(SPL_TPL_)ENV_IS_IN_MTD) += mtd.o
|
||||
obj-$(CONFIG_$(SPL_TPL_)ENV_IS_IN_NAND) += nand.o
|
||||
obj-$(CONFIG_$(SPL_TPL_)ENV_IS_IN_SPI_FLASH) += sf.o
|
||||
obj-$(CONFIG_$(SPL_TPL_)ENV_IS_IN_FLASH) += flash.o
|
||||
--- a/env/env.c
|
||||
+++ b/env/env.c
|
||||
@@ -69,6 +69,9 @@ static enum env_location env_locations[]
|
||||
#ifdef CONFIG_ENV_IS_IN_MMC
|
||||
ENVL_MMC,
|
||||
#endif
|
||||
+#ifdef CONFIG_ENV_IS_IN_MTD
|
||||
+ ENVL_MTD,
|
||||
+#endif
|
||||
#ifdef CONFIG_ENV_IS_IN_NAND
|
||||
ENVL_NAND,
|
||||
#endif
|
||||
--- /dev/null
|
||||
+++ b/env/mtd.c
|
||||
@@ -0,0 +1,256 @@
|
||||
+/* SPDX-License-Identifier: GPL-2.0 */
|
||||
+/*
|
||||
+ * Copyright (C) 2021 MediaTek Inc. All Rights Reserved.
|
||||
+ *
|
||||
+ * Author: Weijie Gao <weijie.gao@mediatek.com>
|
||||
+ */
|
||||
+
|
||||
+#include <command.h>
|
||||
+#include <env.h>
|
||||
+#include <env_internal.h>
|
||||
+#include <errno.h>
|
||||
+#include <linux/kernel.h>
|
||||
+#include <linux/stddef.h>
|
||||
+#include <linux/types.h>
|
||||
+#include <linux/mtd/mtd.h>
|
||||
+#include <malloc.h>
|
||||
+#include <memalign.h>
|
||||
+#include <mtd.h>
|
||||
+#include <search.h>
|
||||
+
|
||||
+#if CONFIG_ENV_SIZE_REDUND < CONFIG_ENV_SIZE
|
||||
+#undef CONFIG_ENV_SIZE_REDUND
|
||||
+#define CONFIG_ENV_SIZE_REDUND CONFIG_ENV_SIZE
|
||||
+#endif
|
||||
+
|
||||
+#if defined(ENV_IS_EMBEDDED)
|
||||
+env_t *env_ptr = &environment;
|
||||
+#else /* ! ENV_IS_EMBEDDED */
|
||||
+env_t *env_ptr;
|
||||
+#endif /* ENV_IS_EMBEDDED */
|
||||
+
|
||||
+DECLARE_GLOBAL_DATA_PTR;
|
||||
+
|
||||
+static int env_mtd_init(void)
|
||||
+{
|
||||
+#if defined(ENV_IS_EMBEDDED)
|
||||
+ int crc1_ok = 0, crc2_ok = 0;
|
||||
+ env_t *tmp_env1;
|
||||
+
|
||||
+ tmp_env1 = env_ptr;
|
||||
+ crc1_ok = crc32(0, tmp_env1->data, ENV_SIZE) == tmp_env1->crc;
|
||||
+
|
||||
+ if (!crc1_ok && !crc2_ok) {
|
||||
+ gd->env_addr = 0;
|
||||
+ gd->env_valid = ENV_INVALID;
|
||||
+
|
||||
+ return 0;
|
||||
+ } else if (crc1_ok && !crc2_ok) {
|
||||
+ gd->env_valid = ENV_VALID;
|
||||
+ }
|
||||
+
|
||||
+ if (gd->env_valid == ENV_VALID)
|
||||
+ env_ptr = tmp_env1;
|
||||
+
|
||||
+ gd->env_addr = (ulong)env_ptr->data;
|
||||
+
|
||||
+#else /* ENV_IS_EMBEDDED */
|
||||
+ gd->env_addr = (ulong)&default_environment[0];
|
||||
+ gd->env_valid = ENV_VALID;
|
||||
+#endif /* ENV_IS_EMBEDDED */
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static struct mtd_info *env_mtd_get_dev(void)
|
||||
+{
|
||||
+ struct mtd_info *mtd;
|
||||
+
|
||||
+ mtd_probe_devices();
|
||||
+
|
||||
+ mtd = get_mtd_device_nm(CONFIG_ENV_MTD_NAME);
|
||||
+ if (IS_ERR(mtd) || !mtd) {
|
||||
+ printf("MTD device '%s' not found\n", CONFIG_ENV_MTD_NAME);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ return mtd;
|
||||
+}
|
||||
+
|
||||
+static inline bool mtd_addr_is_block_aligned(struct mtd_info *mtd, u64 addr)
|
||||
+{
|
||||
+ return (addr & mtd->erasesize_mask) == 0;
|
||||
+}
|
||||
+
|
||||
+static int mtd_io_skip_bad(struct mtd_info *mtd, bool read, loff_t offset,
|
||||
+ size_t length, size_t redund, u8 *buffer)
|
||||
+{
|
||||
+ struct mtd_oob_ops io_op = {};
|
||||
+ size_t remaining = length;
|
||||
+ loff_t off, end;
|
||||
+ int ret;
|
||||
+
|
||||
+ io_op.mode = MTD_OPS_PLACE_OOB;
|
||||
+ io_op.len = mtd->writesize;
|
||||
+ io_op.datbuf = (void *)buffer;
|
||||
+
|
||||
+ /* Search for the first good block after the given offset */
|
||||
+ off = offset;
|
||||
+ end = (off + redund) | (mtd->erasesize - 1);
|
||||
+ while (mtd_block_isbad(mtd, off) && off < end)
|
||||
+ off += mtd->erasesize;
|
||||
+
|
||||
+ /* Reached end position */
|
||||
+ if (off >= end)
|
||||
+ return -EIO;
|
||||
+
|
||||
+ /* Loop over the pages to do the actual read/write */
|
||||
+ while (remaining) {
|
||||
+ /* Skip the block if it is bad */
|
||||
+ if (mtd_addr_is_block_aligned(mtd, off) &&
|
||||
+ mtd_block_isbad(mtd, off)) {
|
||||
+ off += mtd->erasesize;
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ if (read)
|
||||
+ ret = mtd_read_oob(mtd, off, &io_op);
|
||||
+ else
|
||||
+ ret = mtd_write_oob(mtd, off, &io_op);
|
||||
+
|
||||
+ if (ret) {
|
||||
+ printf("Failure while %s at offset 0x%llx\n",
|
||||
+ read ? "reading" : "writing", off);
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ off += io_op.retlen;
|
||||
+ remaining -= io_op.retlen;
|
||||
+ io_op.datbuf += io_op.retlen;
|
||||
+ io_op.oobbuf += io_op.oobretlen;
|
||||
+
|
||||
+ /* Reached end position */
|
||||
+ if (off >= end)
|
||||
+ return -EIO;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+#ifdef CONFIG_CMD_SAVEENV
|
||||
+static int mtd_erase_skip_bad(struct mtd_info *mtd, loff_t offset,
|
||||
+ size_t length, size_t redund)
|
||||
+{
|
||||
+ struct erase_info erase_op = {};
|
||||
+ loff_t end = (offset + redund) | (mtd->erasesize - 1);
|
||||
+ int ret;
|
||||
+
|
||||
+ erase_op.mtd = mtd;
|
||||
+ erase_op.addr = offset;
|
||||
+ erase_op.len = length;
|
||||
+
|
||||
+ while (erase_op.len) {
|
||||
+ ret = mtd_erase(mtd, &erase_op);
|
||||
+
|
||||
+ /* Abort if its not a bad block error */
|
||||
+ if (ret != -EIO)
|
||||
+ return ret;
|
||||
+
|
||||
+ printf("Skipping bad block at 0x%08llx\n", erase_op.fail_addr);
|
||||
+
|
||||
+ /* Skip bad block and continue behind it */
|
||||
+ erase_op.len -= erase_op.fail_addr - erase_op.addr;
|
||||
+ erase_op.len -= mtd->erasesize;
|
||||
+ erase_op.addr = erase_op.fail_addr + mtd->erasesize;
|
||||
+
|
||||
+ /* Reached end position */
|
||||
+ if (erase_op.addr >= end)
|
||||
+ return -EIO;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int env_mtd_save(void)
|
||||
+{
|
||||
+ ALLOC_CACHE_ALIGN_BUFFER(env_t, env_new, 1);
|
||||
+ struct mtd_info *mtd;
|
||||
+ int ret = 0;
|
||||
+
|
||||
+ ret = env_export(env_new);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ mtd = env_mtd_get_dev();
|
||||
+ if (!mtd)
|
||||
+ return 1;
|
||||
+
|
||||
+ printf("Erasing on MTD device '%s'... ", mtd->name);
|
||||
+
|
||||
+ ret = mtd_erase_skip_bad(mtd, CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
|
||||
+ CONFIG_ENV_SIZE_REDUND);
|
||||
+
|
||||
+ puts(ret ? "FAILED\n" : "OK\n");
|
||||
+
|
||||
+ if (ret) {
|
||||
+ put_mtd_device(mtd);
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+ printf("Writing to MTD device '%s'... ", mtd->name);
|
||||
+
|
||||
+ ret = mtd_io_skip_bad(mtd, false, CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
|
||||
+ CONFIG_ENV_SIZE_REDUND, (u8 *)env_new);
|
||||
+
|
||||
+ puts(ret ? "FAILED\n" : "OK\n");
|
||||
+
|
||||
+ put_mtd_device(mtd);
|
||||
+
|
||||
+ return !!ret;
|
||||
+}
|
||||
+#endif /* CONFIG_CMD_SAVEENV */
|
||||
+
|
||||
+static int readenv(size_t offset, u_char *buf)
|
||||
+{
|
||||
+ struct mtd_info *mtd;
|
||||
+ int ret;
|
||||
+
|
||||
+ mtd = env_mtd_get_dev();
|
||||
+ if (!mtd)
|
||||
+ return 1;
|
||||
+
|
||||
+ ret = mtd_io_skip_bad(mtd, true, offset, CONFIG_ENV_SIZE,
|
||||
+ CONFIG_ENV_SIZE_REDUND, buf);
|
||||
+
|
||||
+ put_mtd_device(mtd);
|
||||
+
|
||||
+ return !!ret;
|
||||
+}
|
||||
+
|
||||
+static int env_mtd_load(void)
|
||||
+{
|
||||
+#if !defined(ENV_IS_EMBEDDED)
|
||||
+ ALLOC_CACHE_ALIGN_BUFFER(char, buf, CONFIG_ENV_SIZE);
|
||||
+ int ret;
|
||||
+
|
||||
+ ret = readenv(CONFIG_ENV_OFFSET, (u_char *)buf);
|
||||
+ if (ret) {
|
||||
+ env_set_default("readenv() failed", 0);
|
||||
+ return -EIO;
|
||||
+ }
|
||||
+
|
||||
+ return env_import(buf, 1, H_EXTERNAL);
|
||||
+#endif /* ! ENV_IS_EMBEDDED */
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+U_BOOT_ENV_LOCATION(mtd) = {
|
||||
+ .location = ENVL_MTD,
|
||||
+ ENV_NAME("MTD")
|
||||
+ .load = env_mtd_load,
|
||||
+#if defined(CONFIG_CMD_SAVEENV)
|
||||
+ .save = env_save_ptr(env_mtd_save),
|
||||
+#endif
|
||||
+ .init = env_mtd_init,
|
||||
+};
|
||||
--- a/include/env_internal.h
|
||||
+++ b/include/env_internal.h
|
||||
@@ -131,6 +131,7 @@ enum env_location {
|
||||
ENVL_FAT,
|
||||
ENVL_FLASH,
|
||||
ENVL_MMC,
|
||||
+ ENVL_MTD,
|
||||
ENVL_NAND,
|
||||
ENVL_NVRAM,
|
||||
ENVL_ONENAND,
|
||||
--- a/tools/Makefile
|
||||
+++ b/tools/Makefile
|
||||
@@ -22,6 +22,7 @@ ENVCRC-$(CONFIG_ENV_IS_EMBEDDED) = y
|
||||
ENVCRC-$(CONFIG_ENV_IS_IN_EEPROM) = y
|
||||
ENVCRC-$(CONFIG_ENV_IS_IN_FLASH) = y
|
||||
ENVCRC-$(CONFIG_ENV_IS_IN_ONENAND) = y
|
||||
+ENVCRC-$(CONFIG_ENV_IS_IN_MTD) = y
|
||||
ENVCRC-$(CONFIG_ENV_IS_IN_NAND) = y
|
||||
ENVCRC-$(CONFIG_ENV_IS_IN_NVRAM) = y
|
||||
ENVCRC-$(CONFIG_ENV_IS_IN_SPI_FLASH) = y
|
||||
@@ -1,266 +0,0 @@
|
||||
From 47b386259625061b376f538055a4f3fbd0ab7fef Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Wed, 3 Mar 2021 10:48:53 +0800
|
||||
Subject: [PATCH 17/21] board: mt7629: add support for booting from SPI-NAND
|
||||
|
||||
Add support for mt7629 to boot from SPI-NAND.
|
||||
Add a new defconfig for mt7629+spi-nand configuration.
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
arch/arm/dts/mt7629-rfb-u-boot.dtsi | 8 ++
|
||||
arch/arm/dts/mt7629-rfb.dts | 10 +++
|
||||
arch/arm/dts/mt7629.dtsi | 16 ++++
|
||||
board/mediatek/mt7629/Kconfig | 35 ++++++++-
|
||||
configs/mt7629_nand_rfb_defconfig | 111 ++++++++++++++++++++++++++++
|
||||
include/configs/mt7629.h | 7 ++
|
||||
6 files changed, 186 insertions(+), 1 deletion(-)
|
||||
create mode 100644 configs/mt7629_nand_rfb_defconfig
|
||||
|
||||
--- a/arch/arm/dts/mt7629-rfb-u-boot.dtsi
|
||||
+++ b/arch/arm/dts/mt7629-rfb-u-boot.dtsi
|
||||
@@ -40,3 +40,11 @@
|
||||
&snfi {
|
||||
u-boot,dm-pre-reloc;
|
||||
};
|
||||
+
|
||||
+&pinctrl {
|
||||
+ u-boot,dm-pre-reloc;
|
||||
+};
|
||||
+
|
||||
+&snand {
|
||||
+ u-boot,dm-pre-reloc;
|
||||
+};
|
||||
--- a/arch/arm/dts/mt7629-rfb.dts
|
||||
+++ b/arch/arm/dts/mt7629-rfb.dts
|
||||
@@ -47,9 +47,12 @@
|
||||
};
|
||||
|
||||
snfi_pins: snfi-pins {
|
||||
+ u-boot,dm-pre-reloc;
|
||||
+
|
||||
mux {
|
||||
function = "flash";
|
||||
groups = "snfi";
|
||||
+ u-boot,dm-pre-reloc;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -102,6 +105,13 @@
|
||||
};
|
||||
};
|
||||
|
||||
+&snand {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&snfi_pins>;
|
||||
+ status = "okay";
|
||||
+ quad-spi;
|
||||
+};
|
||||
+
|
||||
&uart0 {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&uart0_pins>;
|
||||
--- a/arch/arm/dts/mt7629.dtsi
|
||||
+++ b/arch/arm/dts/mt7629.dtsi
|
||||
@@ -229,6 +229,22 @@
|
||||
#size-cells = <0>;
|
||||
};
|
||||
|
||||
+ snand: snand@1100d000 {
|
||||
+ compatible = "mediatek,mt7629-snand";
|
||||
+ reg = <0x1100d000 0x1000>,
|
||||
+ <0x1100e000 0x1000>;
|
||||
+ reg-names = "nfi", "ecc";
|
||||
+ clocks = <&pericfg CLK_PERI_NFI_PD>,
|
||||
+ <&pericfg CLK_PERI_SNFI_PD>,
|
||||
+ <&pericfg CLK_PERI_NFIECC_PD>;
|
||||
+ clock-names = "nfi_clk", "pad_clk", "ecc_clk";
|
||||
+ assigned-clocks = <&topckgen CLK_TOP_AXI_SEL>,
|
||||
+ <&topckgen CLK_TOP_NFI_INFRA_SEL>;
|
||||
+ assigned-clock-parents = <&topckgen CLK_TOP_SYSPLL1_D2>,
|
||||
+ <&topckgen CLK_TOP_UNIVPLL2_D8>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
snor: snor@11014000 {
|
||||
compatible = "mediatek,mtk-snor";
|
||||
reg = <0x11014000 0x1000>;
|
||||
--- a/board/mediatek/mt7629/Kconfig
|
||||
+++ b/board/mediatek/mt7629/Kconfig
|
||||
@@ -12,6 +12,39 @@ config MTK_SPL_PAD_SIZE
|
||||
|
||||
config MTK_BROM_HEADER_INFO
|
||||
string
|
||||
- default "media=nor"
|
||||
+ default "media=nor" if BOOT_FROM_SNOR
|
||||
+ default "media=snand;nandinfo=2k+64" if BOOT_FROM_SNAND_2K_64
|
||||
+ default "media=snand;nandinfo=2k+128" if BOOT_FROM_SNAND_2K_128
|
||||
+ default "media=snand;nandinfo=4k+128" if BOOT_FROM_SNAND_4K_128
|
||||
+ default "media=snand;nandinfo=4k+256" if BOOT_FROM_SNAND_4K_256
|
||||
+
|
||||
+choice
|
||||
+ prompt "Boot device"
|
||||
+ default BOOT_FROM_SNOR
|
||||
+
|
||||
+config BOOT_FROM_SNOR
|
||||
+ bool "SPI-NOR"
|
||||
+
|
||||
+config BOOT_FROM_SNAND_2K_64
|
||||
+ bool "SPI-NAND (2K+64)"
|
||||
+ select MT7629_BOOT_FROM_SNAND
|
||||
+
|
||||
+config BOOT_FROM_SNAND_2K_128
|
||||
+ bool "SPI-NAND (2K+128)"
|
||||
+ select MT7629_BOOT_FROM_SNAND
|
||||
+
|
||||
+config BOOT_FROM_SNAND_4K_128
|
||||
+ bool "SPI-NAND (4K+128)"
|
||||
+ select MT7629_BOOT_FROM_SNAND
|
||||
+
|
||||
+config BOOT_FROM_SNAND_4K_256
|
||||
+ bool "SPI-NAND (4K+256)"
|
||||
+ select MT7629_BOOT_FROM_SNAND
|
||||
+
|
||||
+endchoice
|
||||
+
|
||||
+config MT7629_BOOT_FROM_SNAND
|
||||
+ bool
|
||||
+ default n
|
||||
|
||||
endif
|
||||
--- /dev/null
|
||||
+++ b/configs/mt7629_nand_rfb_defconfig
|
||||
@@ -0,0 +1,111 @@
|
||||
+CONFIG_ARM=y
|
||||
+CONFIG_SYS_ARCH_TIMER=y
|
||||
+CONFIG_SYS_THUMB_BUILD=y
|
||||
+CONFIG_ARCH_MEDIATEK=y
|
||||
+CONFIG_SYS_TEXT_BASE=0x41e00000
|
||||
+CONFIG_SYS_MALLOC_F_LEN=0x4000
|
||||
+CONFIG_NR_DRAM_BANKS=1
|
||||
+CONFIG_ENV_SIZE=0x20000
|
||||
+CONFIG_ENV_OFFSET=0x100000
|
||||
+CONFIG_SPL_TEXT_BASE=0x201000
|
||||
+CONFIG_TARGET_MT7629=y
|
||||
+CONFIG_BOOT_FROM_SNAND_2K_64=y
|
||||
+CONFIG_SPL_SERIAL_SUPPORT=y
|
||||
+CONFIG_SPL_DRIVERS_MISC_SUPPORT=y
|
||||
+CONFIG_SPL_STACK_R_ADDR=0x40800000
|
||||
+CONFIG_SPL_PAYLOAD="u-boot.img"
|
||||
+CONFIG_BUILD_TARGET="u-boot-mtk.bin"
|
||||
+CONFIG_DEFAULT_DEVICE_TREE="mt7629-rfb"
|
||||
+CONFIG_SPL_IMAGE="spl/u-boot-spl-mtk.bin"
|
||||
+CONFIG_FIT=y
|
||||
+CONFIG_FIT_VERBOSE=y
|
||||
+CONFIG_BOOTDELAY=3
|
||||
+CONFIG_DEFAULT_FDT_FILE="mt7629-rfb"
|
||||
+CONFIG_SYS_CONSOLE_IS_IN_ENV=y
|
||||
+CONFIG_SYS_STDIO_DEREGISTER=y
|
||||
+# CONFIG_DISPLAY_BOARDINFO is not set
|
||||
+CONFIG_SPL_SYS_MALLOC_SIMPLE=y
|
||||
+CONFIG_SPL_STACK_R=y
|
||||
+CONFIG_SPL_MTD_SUPPORT=y
|
||||
+CONFIG_SPL_NAND_SUPPORT=y
|
||||
+CONFIG_SPL_WATCHDOG_SUPPORT=y
|
||||
+CONFIG_HUSH_PARSER=y
|
||||
+CONFIG_SYS_PROMPT="U-Boot> "
|
||||
+CONFIG_CMD_BOOTMENU=y
|
||||
+# CONFIG_BOOTM_NETBSD is not set
|
||||
+# CONFIG_BOOTM_PLAN9 is not set
|
||||
+# CONFIG_BOOTM_RTEMS is not set
|
||||
+# CONFIG_BOOTM_VXWORKS is not set
|
||||
+# CONFIG_CMD_ELF is not set
|
||||
+# CONFIG_CMD_XIMG is not set
|
||||
+CONFIG_CMD_BIND=y
|
||||
+CONFIG_CMD_DM=y
|
||||
+# CONFIG_CMD_FLASH is not set
|
||||
+CONFIG_CMD_GPIO=y
|
||||
+CONFIG_CMD_MTD=y
|
||||
+CONFIG_CMD_USB=y
|
||||
+# CONFIG_CMD_SETEXPR is not set
|
||||
+# CONFIG_CMD_NFS is not set
|
||||
+CONFIG_CMD_PING=y
|
||||
+CONFIG_CMD_FAT=y
|
||||
+CONFIG_CMD_FS_GENERIC=y
|
||||
+CONFIG_CMD_LOG=y
|
||||
+CONFIG_EFI_PARTITION=y
|
||||
+# CONFIG_SPL_PARTITION_UUIDS is not set
|
||||
+CONFIG_PARTITION_TYPE_GUID=y
|
||||
+CONFIG_OF_SPL_REMOVE_PROPS="interrupt-parent assigned-clocks assigned-clock-parents"
|
||||
+CONFIG_ENV_OVERWRITE=y
|
||||
+CONFIG_ENV_IS_IN_MTD=y
|
||||
+CONFIG_ENV_MTD_NAME="spi-nand0"
|
||||
+CONFIG_ENV_SIZE_REDUND=0x40000
|
||||
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
|
||||
+CONFIG_NET_RANDOM_ETHADDR=y
|
||||
+CONFIG_SPL_DM_SEQ_ALIAS=y
|
||||
+CONFIG_REGMAP=y
|
||||
+CONFIG_SPL_REGMAP=y
|
||||
+CONFIG_SYSCON=y
|
||||
+CONFIG_SPL_SYSCON=y
|
||||
+CONFIG_BLK=y
|
||||
+CONFIG_CLK=y
|
||||
+CONFIG_SPL_CLK=y
|
||||
+# CONFIG_MMC is not set
|
||||
+CONFIG_MTD=y
|
||||
+CONFIG_DM_MTD=y
|
||||
+CONFIG_MTK_SPI_NAND=y
|
||||
+CONFIG_MTK_SPI_NAND_MTD=y
|
||||
+CONFIG_SPL_MTK_SPI_NAND=y
|
||||
+CONFIG_DM_ETH=y
|
||||
+CONFIG_MEDIATEK_ETH=y
|
||||
+CONFIG_PHY=y
|
||||
+CONFIG_PHY_MTK_TPHY=y
|
||||
+CONFIG_PINCTRL=y
|
||||
+CONFIG_PINCONF=y
|
||||
+CONFIG_SPL_PINCTRL=y
|
||||
+CONFIG_SPL_PINCONF=y
|
||||
+CONFIG_PINCTRL_MT7629=y
|
||||
+CONFIG_POWER_DOMAIN=y
|
||||
+CONFIG_MTK_POWER_DOMAIN=y
|
||||
+CONFIG_DM_REGULATOR=y
|
||||
+CONFIG_DM_REGULATOR_FIXED=y
|
||||
+CONFIG_RAM=y
|
||||
+CONFIG_SPL_RAM=y
|
||||
+CONFIG_DM_SERIAL=y
|
||||
+CONFIG_MTK_SERIAL=y
|
||||
+CONFIG_SPI=y
|
||||
+CONFIG_DM_SPI=y
|
||||
+CONFIG_SPI_MEM=y
|
||||
+CONFIG_MTK_SNFI_SPI=y
|
||||
+CONFIG_SYSRESET=y
|
||||
+CONFIG_SPL_SYSRESET=y
|
||||
+CONFIG_SYSRESET_WATCHDOG=y
|
||||
+CONFIG_USB=y
|
||||
+CONFIG_DM_USB=y
|
||||
+# CONFIG_SPL_DM_USB is not set
|
||||
+CONFIG_USB_XHCI_HCD=y
|
||||
+CONFIG_USB_XHCI_MTK=y
|
||||
+CONFIG_USB_STORAGE=y
|
||||
+CONFIG_WDT_MTK=y
|
||||
+CONFIG_FAT_WRITE=y
|
||||
+CONFIG_LZMA=y
|
||||
+CONFIG_SPL_LZMA=y
|
||||
+# CONFIG_EFI_LOADER is not set
|
||||
--- a/include/configs/mt7629.h
|
||||
+++ b/include/configs/mt7629.h
|
||||
@@ -30,12 +30,19 @@
|
||||
|
||||
/* Defines for SPL */
|
||||
#define CONFIG_SPL_STACK 0x106000
|
||||
+#ifdef CONFIG_MT7629_BOOT_FROM_SNAND
|
||||
+#define CONFIG_SPL_MAX_SIZE SZ_128K
|
||||
+#define CONFIG_SPL_MAX_FOOTPRINT SZ_128K
|
||||
+#define CONFIG_SPL_PAD_TO 0x20000
|
||||
+#define CONFIG_SYS_NAND_U_BOOT_OFFS CONFIG_SPL_PAD_TO
|
||||
+#else
|
||||
#define CONFIG_SPL_MAX_SIZE SZ_64K
|
||||
#define CONFIG_SPL_MAX_FOOTPRINT SZ_64K
|
||||
#define CONFIG_SPL_PAD_TO 0x10000
|
||||
|
||||
#define CONFIG_SPI_ADDR 0x30000000
|
||||
#define CONFIG_SYS_UBOOT_BASE (CONFIG_SPI_ADDR + CONFIG_SPL_PAD_TO)
|
||||
+#endif
|
||||
|
||||
/* SPL -> Uboot */
|
||||
#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_TEXT_BASE + SZ_2M - \
|
||||
@@ -1,76 +0,0 @@
|
||||
From ec0d1899b035700a657721761ff6370b940450ab Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Wed, 3 Mar 2021 10:51:43 +0800
|
||||
Subject: [PATCH 18/21] board: mt7622: use new spi-nand driver
|
||||
|
||||
Enable new spi-nand driver support for mt7622_rfb_defconfig
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
arch/arm/dts/mt7622-rfb.dts | 7 +++++++
|
||||
arch/arm/dts/mt7622.dtsi | 16 ++++++++++++++++
|
||||
configs/mt7622_rfb_defconfig | 5 +++++
|
||||
3 files changed, 28 insertions(+)
|
||||
|
||||
--- a/arch/arm/dts/mt7622-rfb.dts
|
||||
+++ b/arch/arm/dts/mt7622-rfb.dts
|
||||
@@ -188,6 +188,13 @@
|
||||
};
|
||||
};
|
||||
|
||||
+&snand {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&snfi_pins>;
|
||||
+ status = "okay";
|
||||
+ quad-spi;
|
||||
+};
|
||||
+
|
||||
&uart0 {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&uart0_pins>;
|
||||
--- a/arch/arm/dts/mt7622.dtsi
|
||||
+++ b/arch/arm/dts/mt7622.dtsi
|
||||
@@ -53,6 +53,22 @@
|
||||
#size-cells = <0>;
|
||||
};
|
||||
|
||||
+ snand: snand@1100d000 {
|
||||
+ compatible = "mediatek,mt7622-snand";
|
||||
+ reg = <0x1100d000 0x1000>,
|
||||
+ <0x1100e000 0x1000>;
|
||||
+ reg-names = "nfi", "ecc";
|
||||
+ clocks = <&pericfg CLK_PERI_NFI_PD>,
|
||||
+ <&pericfg CLK_PERI_SNFI_PD>,
|
||||
+ <&pericfg CLK_PERI_NFIECC_PD>;
|
||||
+ clock-names = "nfi_clk", "pad_clk", "ecc_clk";
|
||||
+ assigned-clocks = <&topckgen CLK_TOP_AXI_SEL>,
|
||||
+ <&topckgen CLK_TOP_NFI_INFRA_SEL>;
|
||||
+ assigned-clock-parents = <&topckgen CLK_TOP_SYSPLL1_D2>,
|
||||
+ <&topckgen CLK_TOP_UNIVPLL2_D8>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
snor: snor@11014000 {
|
||||
compatible = "mediatek,mtk-snor";
|
||||
reg = <0x11014000 0x1000>;
|
||||
--- a/configs/mt7622_rfb_defconfig
|
||||
+++ b/configs/mt7622_rfb_defconfig
|
||||
@@ -15,6 +15,7 @@ CONFIG_LOG=y
|
||||
CONFIG_SYS_PROMPT="MT7622> "
|
||||
CONFIG_CMD_BOOTMENU=y
|
||||
CONFIG_CMD_MMC=y
|
||||
+CONFIG_CMD_MTD=y
|
||||
CONFIG_CMD_PCI=y
|
||||
CONFIG_CMD_SF_TEST=y
|
||||
CONFIG_CMD_PING=y
|
||||
@@ -28,6 +29,10 @@ CONFIG_CLK=y
|
||||
CONFIG_DM_MMC=y
|
||||
CONFIG_MMC_HS200_SUPPORT=y
|
||||
CONFIG_MMC_MTK=y
|
||||
+CONFIG_MTD=y
|
||||
+CONFIG_DM_MTD=y
|
||||
+CONFIG_MTK_SPI_NAND=y
|
||||
+CONFIG_MTK_SPI_NAND_MTD=y
|
||||
CONFIG_DM_SPI_FLASH=y
|
||||
CONFIG_SPI_FLASH_EON=y
|
||||
CONFIG_SPI_FLASH_GIGADEVICE=y
|
||||
@@ -1,31 +0,0 @@
|
||||
From 2f7aaf3c2c127bd53d5e8bfe39e808fdd6eb99be Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Wed, 3 Mar 2021 12:12:39 +0800
|
||||
Subject: [PATCH 19/21] configs: mt7629: remove unused options and add dm
|
||||
command
|
||||
|
||||
Remove unused bootm options
|
||||
Add dm command
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
configs/mt7629_rfb_defconfig | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
--- a/configs/mt7629_rfb_defconfig
|
||||
+++ b/configs/mt7629_rfb_defconfig
|
||||
@@ -28,9 +28,14 @@ CONFIG_SPL_WATCHDOG_SUPPORT=y
|
||||
CONFIG_HUSH_PARSER=y
|
||||
CONFIG_SYS_PROMPT="U-Boot> "
|
||||
CONFIG_CMD_BOOTMENU=y
|
||||
+# CONFIG_BOOTM_NETBSD is not set
|
||||
+# CONFIG_BOOTM_PLAN9 is not set
|
||||
+# CONFIG_BOOTM_RTEMS is not set
|
||||
+# CONFIG_BOOTM_VXWORKS is not set
|
||||
# CONFIG_CMD_ELF is not set
|
||||
# CONFIG_CMD_XIMG is not set
|
||||
CONFIG_CMD_BIND=y
|
||||
+CONFIG_CMD_DM=y
|
||||
# CONFIG_CMD_FLASH is not set
|
||||
CONFIG_CMD_GPIO=y
|
||||
CONFIG_CMD_SF_TEST=y
|
||||
@@ -1,7 +1,7 @@
|
||||
From e5a71a0eebadfb3d75d8619a8b317eec58b2bca2 Mon Sep 17 00:00:00 2001
|
||||
From 93d7086edb0db4b05149dfea21a2a82d8f160944 Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Sat, 6 Mar 2021 16:29:33 +0800
|
||||
Subject: [PATCH 20/21] configs: mt7622: enable environment for mt7622_rfb
|
||||
Subject: [PATCH 10/12] configs: mt7622: enable environment for mt7622_rfb
|
||||
|
||||
Enable environment vairables for mt7622_rfb
|
||||
|
||||
@@ -12,16 +12,16 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
|
||||
--- a/configs/mt7622_rfb_defconfig
|
||||
+++ b/configs/mt7622_rfb_defconfig
|
||||
@@ -4,6 +4,8 @@ CONFIG_ARCH_MEDIATEK=y
|
||||
CONFIG_SYS_TEXT_BASE=0x41e00000
|
||||
@@ -6,6 +6,8 @@ CONFIG_TEXT_BASE=0x41e00000
|
||||
CONFIG_SYS_MALLOC_F_LEN=0x4000
|
||||
CONFIG_NR_DRAM_BANKS=1
|
||||
CONFIG_DEFAULT_DEVICE_TREE="mt7622-rfb"
|
||||
+CONFIG_ENV_SIZE=0x20000
|
||||
+CONFIG_ENV_OFFSET=0x280000
|
||||
CONFIG_SYS_PROMPT="MT7622> "
|
||||
CONFIG_DEBUG_UART_BASE=0x11002000
|
||||
CONFIG_DEBUG_UART_CLOCK=25000000
|
||||
CONFIG_DEFAULT_DEVICE_TREE="mt7622-rfb"
|
||||
@@ -21,6 +23,9 @@ CONFIG_CMD_SF_TEST=y
|
||||
@@ -25,6 +27,9 @@ CONFIG_CMD_SF_TEST=y
|
||||
CONFIG_CMD_PING=y
|
||||
CONFIG_CMD_SMC=y
|
||||
CONFIG_ENV_OVERWRITE=y
|
||||
@@ -30,4 +30,4 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
+CONFIG_ENV_SIZE_REDUND=0x40000
|
||||
CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
|
||||
CONFIG_NET_RANDOM_ETHADDR=y
|
||||
CONFIG_REGMAP=y
|
||||
CONFIG_USE_IPADDR=y
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
+ ranges;
|
||||
+
|
||||
+ /* 64 KiB reserved for ramoops/pstore */
|
||||
+ ramoops@0x42ff0000 {
|
||||
+ ramoops@42ff0000 {
|
||||
+ compatible = "ramoops";
|
||||
+ reg = <0 0x42ff0000 0 0x10000>;
|
||||
+ record-size = <0x1000>;
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
--- a/arch/arm/dts/mt7986.dtsi
|
||||
+++ b/arch/arm/dts/mt7986.dtsi
|
||||
@@ -50,6 +50,35 @@
|
||||
};
|
||||
};
|
||||
|
||||
+ psci {
|
||||
+ compatible = "arm,psci-0.2";
|
||||
+ method = "smc";
|
||||
+ };
|
||||
+
|
||||
+ reserved-memory {
|
||||
+ #address-cells = <2>;
|
||||
+ #size-cells = <2>;
|
||||
+ ranges;
|
||||
+
|
||||
+ /* 64 KiB reserved for ramoops/pstore */
|
||||
+ ramoops@42ff0000 {
|
||||
+ compatible = "ramoops";
|
||||
+ reg = <0 0x42ff0000 0 0x10000>;
|
||||
+ record-size = <0x1000>;
|
||||
+ };
|
||||
+
|
||||
+ /* 192 KiB reserved for ARM Trusted Firmware (BL31) */
|
||||
+ secmon_reserved: secmon@43000000 {
|
||||
+ reg = <0 0x43000000 0 0x30000>;
|
||||
+ no-map;
|
||||
+ };
|
||||
+
|
||||
+ wmcpu_emi: wmcpu-reserved@4fc00000 {
|
||||
+ no-map;
|
||||
+ reg = <0 0x4fc00000 0 0x00100000>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
dummy_clk: dummy12m {
|
||||
compatible = "fixed-clock";
|
||||
clock-frequency = <12000000>;
|
||||
@@ -0,0 +1,38 @@
|
||||
--- a/arch/arm/dts/mt7981.dtsi
|
||||
+++ b/arch/arm/dts/mt7981.dtsi
|
||||
@@ -32,6 +32,35 @@
|
||||
};
|
||||
};
|
||||
|
||||
+ psci {
|
||||
+ compatible = "arm,psci-0.2";
|
||||
+ method = "smc";
|
||||
+ };
|
||||
+
|
||||
+ reserved-memory {
|
||||
+ #address-cells = <2>;
|
||||
+ #size-cells = <2>;
|
||||
+ ranges;
|
||||
+
|
||||
+ /* 64 KiB reserved for ramoops/pstore */
|
||||
+ ramoops@42ff0000 {
|
||||
+ compatible = "ramoops";
|
||||
+ reg = <0 0x42ff0000 0 0x10000>;
|
||||
+ record-size = <0x1000>;
|
||||
+ };
|
||||
+
|
||||
+ /* 192 KiB reserved for ARM Trusted Firmware (BL31) */
|
||||
+ secmon_reserved: secmon@43000000 {
|
||||
+ reg = <0 0x43000000 0 0x30000>;
|
||||
+ no-map;
|
||||
+ };
|
||||
+
|
||||
+ wmcpu_emi: wmcpu-reserved@4fc00000 {
|
||||
+ no-map;
|
||||
+ reg = <0 0x4fc00000 0 0x00100000>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
gpt_clk: gpt_dummy20m {
|
||||
compatible = "fixed-clock";
|
||||
clock-frequency = <13000000>;
|
||||
@@ -0,0 +1,43 @@
|
||||
From 19f2aa053d5531a9ca0ece04dca172a522d58b90 Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Fri, 29 Jul 2022 11:32:28 +0800
|
||||
Subject: [PATCH 32/71] clk: remove log_ret from clk_get_rate
|
||||
|
||||
The return value of clk_get_rate is ulong, an unsigned type. The size of
|
||||
ulong depends on the cpu architecture, i.e. 4 bytes on 32-bit CPUs and
|
||||
8 bytes on 64-bit CPUs.
|
||||
|
||||
However log_ret only accepts and returns value in int type, a fixed 4-byte
|
||||
type. This may truncate the real clock value and cause unexpected error on
|
||||
64-bit platforms.
|
||||
|
||||
This patch removes log_ret to solve this issue.
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
drivers/clk/clk-uclass.c | 7 +------
|
||||
1 file changed, 1 insertion(+), 6 deletions(-)
|
||||
|
||||
--- a/drivers/clk/clk-uclass.c
|
||||
+++ b/drivers/clk/clk-uclass.c
|
||||
@@ -471,7 +471,6 @@ void 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))
|
||||
@@ -481,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)
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,175 @@
|
||||
From a347e374cb338213632c6dde88dd226d64bd8b27 Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Wed, 3 Mar 2021 08:57:29 +0800
|
||||
Subject: [PATCH 37/71] mtd: mtk-snand: add support for SPL
|
||||
|
||||
Add support to initialize SPI-NAND in SPL.
|
||||
Add implementation for SPL NAND loader.
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
drivers/mtd/mtk-snand/Kconfig | 6 ++
|
||||
drivers/mtd/mtk-snand/Makefile | 4 +
|
||||
drivers/mtd/mtk-snand/mtk-snand-spl.c | 133 ++++++++++++++++++++++++++
|
||||
3 files changed, 143 insertions(+)
|
||||
create mode 100644 drivers/mtd/mtk-snand/mtk-snand-spl.c
|
||||
|
||||
--- a/drivers/mtd/mtk-snand/Kconfig
|
||||
+++ b/drivers/mtd/mtk-snand/Kconfig
|
||||
@@ -19,3 +19,9 @@ config MTK_SPI_NAND_MTD
|
||||
help
|
||||
This option enables access to SPI-NAND flashes through the
|
||||
MTD interface of MediaTek SPI NAND Flash Controller
|
||||
+
|
||||
+config SPL_MTK_SPI_NAND
|
||||
+ tristate "SPL support for MediaTek SPI NAND flash controller"
|
||||
+ depends on MTK_SPI_NAND
|
||||
+ help
|
||||
+ This option enables access to SPI-NAND flashes in the SPL stage
|
||||
--- a/drivers/mtd/mtk-snand/Makefile
|
||||
+++ b/drivers/mtd/mtk-snand/Makefile
|
||||
@@ -8,4 +8,8 @@
|
||||
obj-y += mtk-snand.o mtk-snand-ecc.o mtk-snand-ids.o mtk-snand-os.o
|
||||
obj-$(CONFIG_MTK_SPI_NAND_MTD) += mtk-snand-mtd.o
|
||||
|
||||
+ifdef CONFIG_SPL_BUILD
|
||||
+obj-$(CONFIG_SPL_MTK_SPI_NAND) += mtk-snand-spl.o
|
||||
+endif
|
||||
+
|
||||
ccflags-y += -DPRIVATE_MTK_SNAND_HEADER
|
||||
--- /dev/null
|
||||
+++ b/drivers/mtd/mtk-snand/mtk-snand-spl.c
|
||||
@@ -0,0 +1,133 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0
|
||||
+/*
|
||||
+ * Copyright (C) 2020 MediaTek Inc. All Rights Reserved.
|
||||
+ *
|
||||
+ * Author: Weijie Gao <weijie.gao@mediatek.com>
|
||||
+ */
|
||||
+
|
||||
+#include <common.h>
|
||||
+#include <dm.h>
|
||||
+#include <dm/uclass.h>
|
||||
+#include <malloc.h>
|
||||
+#include <mapmem.h>
|
||||
+#include <mtd.h>
|
||||
+#include <watchdog.h>
|
||||
+
|
||||
+#include "mtk-snand.h"
|
||||
+
|
||||
+static struct mtk_snand *snf;
|
||||
+static struct mtk_snand_chip_info cinfo;
|
||||
+static u32 oobavail;
|
||||
+
|
||||
+static u8 *page_cache;
|
||||
+
|
||||
+int nand_spl_load_image(uint32_t offs, unsigned int size, void *dst)
|
||||
+{
|
||||
+ u32 sizeremain = size, chunksize, leading;
|
||||
+ uint32_t off = offs, writesize_mask = cinfo.pagesize - 1;
|
||||
+ uint8_t *ptr = dst;
|
||||
+ int ret;
|
||||
+
|
||||
+ if (!snf)
|
||||
+ return -ENODEV;
|
||||
+
|
||||
+ while (sizeremain) {
|
||||
+ schedule();
|
||||
+
|
||||
+ leading = off & writesize_mask;
|
||||
+ chunksize = cinfo.pagesize - leading;
|
||||
+ if (chunksize > sizeremain)
|
||||
+ chunksize = sizeremain;
|
||||
+
|
||||
+ if (chunksize == cinfo.pagesize) {
|
||||
+ ret = mtk_snand_read_page(snf, off - leading, ptr,
|
||||
+ NULL, false);
|
||||
+ if (ret)
|
||||
+ break;
|
||||
+ } else {
|
||||
+ ret = mtk_snand_read_page(snf, off - leading,
|
||||
+ page_cache, NULL, false);
|
||||
+ if (ret)
|
||||
+ break;
|
||||
+
|
||||
+ memcpy(ptr, page_cache + leading, chunksize);
|
||||
+ }
|
||||
+
|
||||
+ off += chunksize;
|
||||
+ ptr += chunksize;
|
||||
+ sizeremain -= chunksize;
|
||||
+ }
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+void nand_init(void)
|
||||
+{
|
||||
+ struct mtk_snand_platdata mtk_snand_pdata = {};
|
||||
+ struct udevice *dev;
|
||||
+ fdt_addr_t base;
|
||||
+ int ret;
|
||||
+
|
||||
+ ret = uclass_get_device_by_driver(UCLASS_MTD, DM_DRIVER_GET(mtk_snand),
|
||||
+ &dev);
|
||||
+ if (ret) {
|
||||
+ printf("mtk-snand-spl: Device instance not found!\n");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ base = dev_read_addr_name(dev, "nfi");
|
||||
+ if (base == FDT_ADDR_T_NONE) {
|
||||
+ printf("mtk-snand-spl: NFI base not set\n");
|
||||
+ return;
|
||||
+ }
|
||||
+ mtk_snand_pdata.nfi_base = map_sysmem(base, 0);
|
||||
+
|
||||
+ base = dev_read_addr_name(dev, "ecc");
|
||||
+ if (base == FDT_ADDR_T_NONE) {
|
||||
+ printf("mtk-snand-spl: ECC base not set\n");
|
||||
+ return;
|
||||
+ }
|
||||
+ mtk_snand_pdata.ecc_base = map_sysmem(base, 0);
|
||||
+
|
||||
+ mtk_snand_pdata.soc = dev_get_driver_data(dev);
|
||||
+ mtk_snand_pdata.quad_spi = dev_read_bool(dev, "quad-spi");
|
||||
+
|
||||
+ ret = mtk_snand_init(NULL, &mtk_snand_pdata, &snf);
|
||||
+ if (ret) {
|
||||
+ printf("mtk-snand-spl: failed to initialize SPI-NAND\n");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ mtk_snand_get_chip_info(snf, &cinfo);
|
||||
+
|
||||
+ oobavail = cinfo.num_sectors * (cinfo.fdm_size - 1);
|
||||
+
|
||||
+ printf("SPI-NAND: %s (%uMB)\n", cinfo.model,
|
||||
+ (u32)(cinfo.chipsize >> 20));
|
||||
+
|
||||
+ page_cache = malloc(cinfo.pagesize + cinfo.sparesize);
|
||||
+ if (!page_cache) {
|
||||
+ mtk_snand_cleanup(snf);
|
||||
+ printf("mtk-snand-spl: failed to allocate page cache\n");
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void nand_deselect(void)
|
||||
+{
|
||||
+
|
||||
+}
|
||||
+
|
||||
+static const struct udevice_id mtk_snand_ids[] = {
|
||||
+ { .compatible = "mediatek,mt7622-snand", .data = SNAND_SOC_MT7622 },
|
||||
+ { .compatible = "mediatek,mt7629-snand", .data = SNAND_SOC_MT7629 },
|
||||
+ { .compatible = "mediatek,mt7981-snand", .data = SNAND_SOC_MT7981 },
|
||||
+ { .compatible = "mediatek,mt7986-snand", .data = SNAND_SOC_MT7986 },
|
||||
+ { /* sentinel */ },
|
||||
+};
|
||||
+
|
||||
+U_BOOT_DRIVER(mtk_snand) = {
|
||||
+ .name = "mtk-snand",
|
||||
+ .id = UCLASS_MTD,
|
||||
+ .of_match = mtk_snand_ids,
|
||||
+ .flags = DM_FLAG_PRE_RELOC,
|
||||
+};
|
||||
@@ -0,0 +1,409 @@
|
||||
From efc3e6f5d29f87a433b42f15a0b87e04b7cd498d Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Wed, 3 Mar 2021 10:11:32 +0800
|
||||
Subject: [PATCH 38/71] env: add support for generic MTD device
|
||||
|
||||
Add an env driver for generic MTD device.
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
cmd/nvedit.c | 3 +-
|
||||
env/Kconfig | 37 +++++-
|
||||
env/Makefile | 1 +
|
||||
env/env.c | 3 +
|
||||
env/mtd.c | 256 +++++++++++++++++++++++++++++++++++++++++
|
||||
include/env_internal.h | 1 +
|
||||
tools/Makefile | 1 +
|
||||
7 files changed, 299 insertions(+), 3 deletions(-)
|
||||
create mode 100644 env/mtd.c
|
||||
|
||||
--- a/cmd/nvedit.c
|
||||
+++ b/cmd/nvedit.c
|
||||
@@ -48,6 +48,7 @@ DECLARE_GLOBAL_DATA_PTR;
|
||||
defined(CONFIG_ENV_IS_IN_MMC) || \
|
||||
defined(CONFIG_ENV_IS_IN_FAT) || \
|
||||
defined(CONFIG_ENV_IS_IN_EXT4) || \
|
||||
+ defined(CONFIG_ENV_IS_IN_MTD) || \
|
||||
defined(CONFIG_ENV_IS_IN_NAND) || \
|
||||
defined(CONFIG_ENV_IS_IN_NVRAM) || \
|
||||
defined(CONFIG_ENV_IS_IN_ONENAND) || \
|
||||
@@ -61,7 +62,7 @@ DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
#if !defined(ENV_IS_IN_DEVICE) && \
|
||||
!defined(CONFIG_ENV_IS_NOWHERE)
|
||||
-# error Define one of CONFIG_ENV_IS_IN_{EEPROM|FLASH|MMC|FAT|EXT4|\
|
||||
+# error Define one of CONFIG_ENV_IS_IN_{EEPROM|FLASH|MMC|FAT|EXT4|MTD|\
|
||||
NAND|NVRAM|ONENAND|SATA|SPI_FLASH|REMOTE|UBI} or CONFIG_ENV_IS_NOWHERE
|
||||
#endif
|
||||
|
||||
--- a/env/Kconfig
|
||||
+++ b/env/Kconfig
|
||||
@@ -62,7 +62,7 @@ config ENV_IS_NOWHERE
|
||||
!ENV_IS_IN_MMC && !ENV_IS_IN_NAND && \
|
||||
!ENV_IS_IN_NVRAM && !ENV_IS_IN_ONENAND && \
|
||||
!ENV_IS_IN_REMOTE && !ENV_IS_IN_SPI_FLASH && \
|
||||
- !ENV_IS_IN_UBI
|
||||
+ !ENV_IS_IN_UBI && !ENV_IS_IN_MTD
|
||||
help
|
||||
Define this if you don't want to or can't have an environment stored
|
||||
on a storage medium. In this case the environment will still exist
|
||||
@@ -251,6 +251,27 @@ config ENV_IS_IN_MMC
|
||||
offset: "u-boot,mmc-env-offset", "u-boot,mmc-env-offset-redundant".
|
||||
CONFIG_ENV_OFFSET and CONFIG_ENV_OFFSET_REDUND are not used.
|
||||
|
||||
+config ENV_IS_IN_MTD
|
||||
+ bool "Environment in a MTD device"
|
||||
+ depends on !CHAIN_OF_TRUST
|
||||
+ depends on MTD
|
||||
+ help
|
||||
+ Define this if you have a MTD device which you want to use for
|
||||
+ the environment.
|
||||
+
|
||||
+ - CONFIG_ENV_MTD_NAME:
|
||||
+ - CONFIG_ENV_OFFSET:
|
||||
+ - CONFIG_ENV_SIZE:
|
||||
+
|
||||
+ These three #defines specify the MTD device where the environment
|
||||
+ is stored, offset and size of the environment area within the MTD
|
||||
+ device. CONFIG_ENV_OFFSET must be aligned to an erase block boundary.
|
||||
+
|
||||
+ - CONFIG_ENV_SIZE_REDUND:
|
||||
+
|
||||
+ This #define specify the maximum size allowed for read/write/erase
|
||||
+ with skipped bad blocks starting from ENV_OFFSET.
|
||||
+
|
||||
config ENV_IS_IN_NAND
|
||||
bool "Environment in a NAND device"
|
||||
depends on !CHAIN_OF_TRUST
|
||||
@@ -558,10 +579,16 @@ config ENV_ADDR_REDUND
|
||||
Offset from the start of the device (or partition) of the redundant
|
||||
environment location.
|
||||
|
||||
+config ENV_MTD_NAME
|
||||
+ string "Name of the MTD device storing the environment"
|
||||
+ depends on ENV_IS_IN_MTD
|
||||
+ help
|
||||
+ Name of the MTD device that stores the environment
|
||||
+
|
||||
config ENV_OFFSET
|
||||
hex "Environment offset"
|
||||
depends on ENV_IS_IN_EEPROM || ENV_IS_IN_MMC || ENV_IS_IN_NAND || \
|
||||
- ENV_IS_IN_SPI_FLASH
|
||||
+ ENV_IS_IN_SPI_FLASH || ENV_IS_IN_MTD
|
||||
default 0x3f8000 if ARCH_ROCKCHIP && ENV_IS_IN_MMC
|
||||
default 0x140000 if ARCH_ROCKCHIP && ENV_IS_IN_SPI_FLASH
|
||||
default 0xF0000 if ARCH_SUNXI
|
||||
@@ -609,6 +636,12 @@ config ENV_SECT_SIZE
|
||||
help
|
||||
Size of the sector containing the environment.
|
||||
|
||||
+config ENV_SIZE_REDUND
|
||||
+ hex "Redundant environment size"
|
||||
+ depends on ENV_IS_IN_MTD
|
||||
+ help
|
||||
+ The maximum size allowed for read/write/erase with skipped bad blocks.
|
||||
+
|
||||
config ENV_UBI_PART
|
||||
string "UBI partition name"
|
||||
depends on ENV_IS_IN_UBI
|
||||
--- a/env/Makefile
|
||||
+++ b/env/Makefile
|
||||
@@ -24,6 +24,7 @@ obj-$(CONFIG_$(SPL_TPL_)ENV_IS_NOWHERE)
|
||||
obj-$(CONFIG_$(SPL_TPL_)ENV_IS_IN_MMC) += mmc.o
|
||||
obj-$(CONFIG_$(SPL_TPL_)ENV_IS_IN_FAT) += fat.o
|
||||
obj-$(CONFIG_$(SPL_TPL_)ENV_IS_IN_EXT4) += ext4.o
|
||||
+obj-$(CONFIG_$(SPL_TPL_)ENV_IS_IN_MTD) += mtd.o
|
||||
obj-$(CONFIG_$(SPL_TPL_)ENV_IS_IN_NAND) += nand.o
|
||||
obj-$(CONFIG_$(SPL_TPL_)ENV_IS_IN_SPI_FLASH) += sf.o
|
||||
obj-$(CONFIG_$(SPL_TPL_)ENV_IS_IN_FLASH) += flash.o
|
||||
--- a/env/env.c
|
||||
+++ b/env/env.c
|
||||
@@ -69,6 +69,9 @@ static enum env_location env_locations[]
|
||||
#ifdef CONFIG_ENV_IS_IN_MMC
|
||||
ENVL_MMC,
|
||||
#endif
|
||||
+#ifdef CONFIG_ENV_IS_IN_MTD
|
||||
+ ENVL_MTD,
|
||||
+#endif
|
||||
#ifdef CONFIG_ENV_IS_IN_NAND
|
||||
ENVL_NAND,
|
||||
#endif
|
||||
--- /dev/null
|
||||
+++ b/env/mtd.c
|
||||
@@ -0,0 +1,256 @@
|
||||
+/* SPDX-License-Identifier: GPL-2.0 */
|
||||
+/*
|
||||
+ * Copyright (C) 2021 MediaTek Inc. All Rights Reserved.
|
||||
+ *
|
||||
+ * Author: Weijie Gao <weijie.gao@mediatek.com>
|
||||
+ */
|
||||
+
|
||||
+#include <command.h>
|
||||
+#include <env.h>
|
||||
+#include <env_internal.h>
|
||||
+#include <errno.h>
|
||||
+#include <linux/kernel.h>
|
||||
+#include <linux/stddef.h>
|
||||
+#include <linux/types.h>
|
||||
+#include <linux/mtd/mtd.h>
|
||||
+#include <malloc.h>
|
||||
+#include <memalign.h>
|
||||
+#include <mtd.h>
|
||||
+#include <search.h>
|
||||
+
|
||||
+#if CONFIG_ENV_SIZE_REDUND < CONFIG_ENV_SIZE
|
||||
+#undef CONFIG_ENV_SIZE_REDUND
|
||||
+#define CONFIG_ENV_SIZE_REDUND CONFIG_ENV_SIZE
|
||||
+#endif
|
||||
+
|
||||
+#if defined(ENV_IS_EMBEDDED)
|
||||
+env_t *env_ptr = &environment;
|
||||
+#else /* ! ENV_IS_EMBEDDED */
|
||||
+env_t *env_ptr;
|
||||
+#endif /* ENV_IS_EMBEDDED */
|
||||
+
|
||||
+DECLARE_GLOBAL_DATA_PTR;
|
||||
+
|
||||
+static int env_mtd_init(void)
|
||||
+{
|
||||
+#if defined(ENV_IS_EMBEDDED)
|
||||
+ int crc1_ok = 0, crc2_ok = 0;
|
||||
+ env_t *tmp_env1;
|
||||
+
|
||||
+ tmp_env1 = env_ptr;
|
||||
+ crc1_ok = crc32(0, tmp_env1->data, ENV_SIZE) == tmp_env1->crc;
|
||||
+
|
||||
+ if (!crc1_ok && !crc2_ok) {
|
||||
+ gd->env_addr = 0;
|
||||
+ gd->env_valid = ENV_INVALID;
|
||||
+
|
||||
+ return 0;
|
||||
+ } else if (crc1_ok && !crc2_ok) {
|
||||
+ gd->env_valid = ENV_VALID;
|
||||
+ }
|
||||
+
|
||||
+ if (gd->env_valid == ENV_VALID)
|
||||
+ env_ptr = tmp_env1;
|
||||
+
|
||||
+ gd->env_addr = (ulong)env_ptr->data;
|
||||
+
|
||||
+#else /* ENV_IS_EMBEDDED */
|
||||
+ gd->env_addr = (ulong)&default_environment[0];
|
||||
+ gd->env_valid = ENV_VALID;
|
||||
+#endif /* ENV_IS_EMBEDDED */
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static struct mtd_info *env_mtd_get_dev(void)
|
||||
+{
|
||||
+ struct mtd_info *mtd;
|
||||
+
|
||||
+ mtd_probe_devices();
|
||||
+
|
||||
+ mtd = get_mtd_device_nm(CONFIG_ENV_MTD_NAME);
|
||||
+ if (IS_ERR(mtd) || !mtd) {
|
||||
+ printf("MTD device '%s' not found\n", CONFIG_ENV_MTD_NAME);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ return mtd;
|
||||
+}
|
||||
+
|
||||
+static inline bool mtd_addr_is_block_aligned(struct mtd_info *mtd, u64 addr)
|
||||
+{
|
||||
+ return (addr & mtd->erasesize_mask) == 0;
|
||||
+}
|
||||
+
|
||||
+static int mtd_io_skip_bad(struct mtd_info *mtd, bool read, loff_t offset,
|
||||
+ size_t length, size_t redund, u8 *buffer)
|
||||
+{
|
||||
+ struct mtd_oob_ops io_op = {};
|
||||
+ size_t remaining = length;
|
||||
+ loff_t off, end;
|
||||
+ int ret;
|
||||
+
|
||||
+ io_op.mode = MTD_OPS_PLACE_OOB;
|
||||
+ io_op.len = mtd->writesize;
|
||||
+ io_op.datbuf = (void *)buffer;
|
||||
+
|
||||
+ /* Search for the first good block after the given offset */
|
||||
+ off = offset;
|
||||
+ end = (off + redund) | (mtd->erasesize - 1);
|
||||
+ while (mtd_block_isbad(mtd, off) && off < end)
|
||||
+ off += mtd->erasesize;
|
||||
+
|
||||
+ /* Reached end position */
|
||||
+ if (off >= end)
|
||||
+ return -EIO;
|
||||
+
|
||||
+ /* Loop over the pages to do the actual read/write */
|
||||
+ while (remaining) {
|
||||
+ /* Skip the block if it is bad */
|
||||
+ if (mtd_addr_is_block_aligned(mtd, off) &&
|
||||
+ mtd_block_isbad(mtd, off)) {
|
||||
+ off += mtd->erasesize;
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ if (read)
|
||||
+ ret = mtd_read_oob(mtd, off, &io_op);
|
||||
+ else
|
||||
+ ret = mtd_write_oob(mtd, off, &io_op);
|
||||
+
|
||||
+ if (ret) {
|
||||
+ printf("Failure while %s at offset 0x%llx\n",
|
||||
+ read ? "reading" : "writing", off);
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ off += io_op.retlen;
|
||||
+ remaining -= io_op.retlen;
|
||||
+ io_op.datbuf += io_op.retlen;
|
||||
+ io_op.oobbuf += io_op.oobretlen;
|
||||
+
|
||||
+ /* Reached end position */
|
||||
+ if (off >= end)
|
||||
+ return -EIO;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+#ifdef CONFIG_CMD_SAVEENV
|
||||
+static int mtd_erase_skip_bad(struct mtd_info *mtd, loff_t offset,
|
||||
+ size_t length, size_t redund)
|
||||
+{
|
||||
+ struct erase_info erase_op = {};
|
||||
+ loff_t end = (offset + redund) | (mtd->erasesize - 1);
|
||||
+ int ret;
|
||||
+
|
||||
+ erase_op.mtd = mtd;
|
||||
+ erase_op.addr = offset;
|
||||
+ erase_op.len = length;
|
||||
+
|
||||
+ while (erase_op.len) {
|
||||
+ ret = mtd_erase(mtd, &erase_op);
|
||||
+
|
||||
+ /* Abort if its not a bad block error */
|
||||
+ if (ret != -EIO)
|
||||
+ return ret;
|
||||
+
|
||||
+ printf("Skipping bad block at 0x%08llx\n", erase_op.fail_addr);
|
||||
+
|
||||
+ /* Skip bad block and continue behind it */
|
||||
+ erase_op.len -= erase_op.fail_addr - erase_op.addr;
|
||||
+ erase_op.len -= mtd->erasesize;
|
||||
+ erase_op.addr = erase_op.fail_addr + mtd->erasesize;
|
||||
+
|
||||
+ /* Reached end position */
|
||||
+ if (erase_op.addr >= end)
|
||||
+ return -EIO;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int env_mtd_save(void)
|
||||
+{
|
||||
+ ALLOC_CACHE_ALIGN_BUFFER(env_t, env_new, 1);
|
||||
+ struct mtd_info *mtd;
|
||||
+ int ret = 0;
|
||||
+
|
||||
+ ret = env_export(env_new);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ mtd = env_mtd_get_dev();
|
||||
+ if (!mtd)
|
||||
+ return 1;
|
||||
+
|
||||
+ printf("Erasing on MTD device '%s'... ", mtd->name);
|
||||
+
|
||||
+ ret = mtd_erase_skip_bad(mtd, CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
|
||||
+ CONFIG_ENV_SIZE_REDUND);
|
||||
+
|
||||
+ puts(ret ? "FAILED\n" : "OK\n");
|
||||
+
|
||||
+ if (ret) {
|
||||
+ put_mtd_device(mtd);
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+ printf("Writing to MTD device '%s'... ", mtd->name);
|
||||
+
|
||||
+ ret = mtd_io_skip_bad(mtd, false, CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
|
||||
+ CONFIG_ENV_SIZE_REDUND, (u8 *)env_new);
|
||||
+
|
||||
+ puts(ret ? "FAILED\n" : "OK\n");
|
||||
+
|
||||
+ put_mtd_device(mtd);
|
||||
+
|
||||
+ return !!ret;
|
||||
+}
|
||||
+#endif /* CONFIG_CMD_SAVEENV */
|
||||
+
|
||||
+static int readenv(size_t offset, u_char *buf)
|
||||
+{
|
||||
+ struct mtd_info *mtd;
|
||||
+ int ret;
|
||||
+
|
||||
+ mtd = env_mtd_get_dev();
|
||||
+ if (!mtd)
|
||||
+ return 1;
|
||||
+
|
||||
+ ret = mtd_io_skip_bad(mtd, true, offset, CONFIG_ENV_SIZE,
|
||||
+ CONFIG_ENV_SIZE_REDUND, buf);
|
||||
+
|
||||
+ put_mtd_device(mtd);
|
||||
+
|
||||
+ return !!ret;
|
||||
+}
|
||||
+
|
||||
+static int env_mtd_load(void)
|
||||
+{
|
||||
+#if !defined(ENV_IS_EMBEDDED)
|
||||
+ ALLOC_CACHE_ALIGN_BUFFER(char, buf, CONFIG_ENV_SIZE);
|
||||
+ int ret;
|
||||
+
|
||||
+ ret = readenv(CONFIG_ENV_OFFSET, (u_char *)buf);
|
||||
+ if (ret) {
|
||||
+ env_set_default("readenv() failed", 0);
|
||||
+ return -EIO;
|
||||
+ }
|
||||
+
|
||||
+ return env_import(buf, 1, H_EXTERNAL);
|
||||
+#endif /* ! ENV_IS_EMBEDDED */
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+U_BOOT_ENV_LOCATION(mtd) = {
|
||||
+ .location = ENVL_MTD,
|
||||
+ ENV_NAME("MTD")
|
||||
+ .load = env_mtd_load,
|
||||
+#if defined(CONFIG_CMD_SAVEENV)
|
||||
+ .save = env_save_ptr(env_mtd_save),
|
||||
+#endif
|
||||
+ .init = env_mtd_init,
|
||||
+};
|
||||
--- a/include/env_internal.h
|
||||
+++ b/include/env_internal.h
|
||||
@@ -109,6 +109,7 @@ enum env_location {
|
||||
ENVL_FAT,
|
||||
ENVL_FLASH,
|
||||
ENVL_MMC,
|
||||
+ ENVL_MTD,
|
||||
ENVL_NAND,
|
||||
ENVL_NVRAM,
|
||||
ENVL_ONENAND,
|
||||
--- a/tools/Makefile
|
||||
+++ b/tools/Makefile
|
||||
@@ -37,6 +37,7 @@ subdir-$(HOST_TOOLS_ALL) += gdb
|
||||
ENVCRC-$(CONFIG_ENV_IS_IN_EEPROM) = y
|
||||
ENVCRC-$(CONFIG_ENV_IS_IN_FLASH) = y
|
||||
ENVCRC-$(CONFIG_ENV_IS_IN_ONENAND) = y
|
||||
+ENVCRC-$(CONFIG_ENV_IS_IN_MTD) = y
|
||||
ENVCRC-$(CONFIG_ENV_IS_IN_NAND) = y
|
||||
ENVCRC-$(CONFIG_ENV_IS_IN_NVRAM) = y
|
||||
ENVCRC-$(CONFIG_ENV_IS_IN_SPI_FLASH) = y
|
||||
@@ -0,0 +1,44 @@
|
||||
From d26a789c451068caf4bbb4d1ac7bc1f592b5493e Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Mon, 25 Jul 2022 10:58:06 +0800
|
||||
Subject: [PATCH 39/71] mtd: add a new mtd device type for NMBM
|
||||
|
||||
This patch adds a new mtd device type for NMBM so that mtdparts can be
|
||||
correctly probed. And this also gives us an opportunity to add NMBM support
|
||||
for filesystems in the future.
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
cmd/mtdparts.c | 3 +++
|
||||
include/jffs2/load_kernel.h | 4 +++-
|
||||
2 files changed, 6 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/cmd/mtdparts.c
|
||||
+++ b/cmd/mtdparts.c
|
||||
@@ -1057,6 +1057,9 @@ int mtd_id_parse(const char *id, const c
|
||||
} else if (strncmp(p, "spi-nand", 8) == 0) {
|
||||
*dev_type = MTD_DEV_TYPE_SPINAND;
|
||||
p += 8;
|
||||
+ } else if (strncmp(p, "nmbm", 4) == 0) {
|
||||
+ *dev_type = MTD_DEV_TYPE_NMBM;
|
||||
+ p += 4;
|
||||
} else {
|
||||
printf("incorrect device type in %s\n", id);
|
||||
return 1;
|
||||
--- a/include/jffs2/load_kernel.h
|
||||
+++ b/include/jffs2/load_kernel.h
|
||||
@@ -16,11 +16,13 @@
|
||||
#define MTD_DEV_TYPE_NAND 0x0002
|
||||
#define MTD_DEV_TYPE_ONENAND 0x0004
|
||||
#define MTD_DEV_TYPE_SPINAND 0x0008
|
||||
+#define MTD_DEV_TYPE_NMBM 0x0010
|
||||
|
||||
#define MTD_DEV_TYPE(type) (type == MTD_DEV_TYPE_NAND ? "nand" : \
|
||||
(type == MTD_DEV_TYPE_NOR ? "nor" : \
|
||||
(type == MTD_DEV_TYPE_ONENAND ? "onenand" : \
|
||||
- "spi-nand"))) \
|
||||
+ (type == MTD_DEV_TYPE_SPINAND ? "spi-nand" : \
|
||||
+ "nmbm")))) \
|
||||
|
||||
struct mtd_device {
|
||||
struct list_head link;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user