[openwrt/openwrt] uboot-mediatek: add noncached_set_region prototype to fix build

LEDE Commits lede-commits at lists.infradead.org
Tue Oct 15 19:24:26 PDT 2024


dangole pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/92ca322dd1f48158b8829fec59319a12e4ae4295

commit 92ca322dd1f48158b8829fec59319a12e4ae4295
Author: Jonas Jelonek <jelonek.jonas at gmail.com>
AuthorDate: Tue Oct 15 20:52:35 2024 +0200

    uboot-mediatek: add noncached_set_region prototype to fix build
    
    Building uboot-mediatek fails with GCC-14, uboot v2024.10 and
    CONFIG_SYS_NONCACHED_MEMORY defined with error:
    cmd/cache.c: In function 'do_dcache':
    cmd/cache.c:57:25: error: implicit declaration of function
            'noncached_set_region' [-Wimplicit-function-declaration]
    
    This is caused by upstream commit 7d6cee2cd0e2e2507aca1e3a6fe0e2cb241a116e
    ("cmd: cache: Remove weak functions") as this removes weak functions in
    favor of arch-specific definitions.
    
    This patch adds the function prototype for `noncached_set_region` to
    arch-specific header for ARM. It also adds an include in cmd/cache.c to
    make the function available there.
    
    Fixes: #16697
    Fixes: f8c22c9bff ("uboot-mediatek: update to U-Boot 2024.10")
    Signed-off-by: Jonas Jelonek <jelonek.jonas at gmail.com>
    [@dangowrt refreshed patch]
    Signed-off-by: Daniel Golle <daniel at makrotopia.org>
---
 ...ncached_set_region-prototype-to-fix-build.patch | 43 ++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/package/boot/uboot-mediatek/patches/455-arm-provide-noncached_set_region-prototype-to-fix-build.patch b/package/boot/uboot-mediatek/patches/455-arm-provide-noncached_set_region-prototype-to-fix-build.patch
new file mode 100644
index 0000000000..ba04f608b4
--- /dev/null
+++ b/package/boot/uboot-mediatek/patches/455-arm-provide-noncached_set_region-prototype-to-fix-build.patch
@@ -0,0 +1,43 @@
+From aab8e6cf7afbbcef60593c6b1795fa5d8e78e597 Mon Sep 17 00:00:00 2001
+From: Jonas Jelonek <jelonek.jonas at gmail.com>
+Date: Tue, 15 Oct 2024 20:02:25 +0200
+Subject: [PATCH] arm: provide noncached_set_region prototype to fix build
+
+Due to the removal of weak functions in 7d6cee2cd0 ("cmd: cache: Remove
+weak function"), uboot fails to compile after updating to v2024.10 for
+mediatek target in OpenWrt with GCC-14 with error:
+cmd/cache.c: In function 'do_dcache':
+cmd/cache.c:57:25: error: implicit declaration of function
+	'noncached_set_region' [-Wimplicit-function-declaration]
+
+Thus, provide a prototype in arm's include/asm/system.h to fix a build
+error in cmd/cache.c, since related prototypes are also located there.
+Also add an include of asm/system.h in cmd/cache.c have the function
+available there.
+
+Signed-off-by: Jonas Jelonek <jelonek.jonas at gmail.com>
+---
+ arch/arm/include/asm/system.h | 1 +
+ cmd/cache.c                   | 1 +
+ 2 files changed, 2 insertions(+)
+
+--- a/arch/arm/include/asm/system.h
++++ b/arch/arm/include/asm/system.h
+@@ -658,6 +658,7 @@ void mmu_set_region_dcache_behaviour(phy
+  * Return: 0 if OK
+  */
+ int noncached_init(void);
++void noncached_set_region(void);
+ 
+ phys_addr_t noncached_alloc(size_t size, size_t align);
+ #endif /* CONFIG_SYS_NONCACHED_MEMORY */
+--- a/cmd/cache.c
++++ b/cmd/cache.c
+@@ -10,6 +10,7 @@
+ #include <command.h>
+ #include <cpu_func.h>
+ #include <linux/compiler.h>
++#include <asm/system.h>
+ 
+ static int parse_argv(const char *);
+ 




More information about the lede-commits mailing list