riscv: Select appropriate image type
authorMayuresh Chitale <mchitale@ventanamicro.com>
Fri, 4 Apr 2025 14:48:56 +0000 (14:48 +0000)
committerLeo Yu-Chi Liang <ycliang@andestech.com>
Wed, 21 May 2025 08:45:55 +0000 (16:45 +0800)
Select between the 32-bit or 64-bit arch type for the image headers
depending on how the build is configured.

Signed-off-by: Mayuresh Chitale <mchitale@ventanamicro.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
arch/riscv/dts/binman.dtsi
arch/riscv/include/asm/u-boot.h

index 5aeeedd..f8c1083 100644 (file)
@@ -5,6 +5,12 @@
 
 #include <config.h>
 
+#ifdef CONFIG_64BIT
+#define ARCH "riscv64"
+#else
+#define ARCH "riscv"
+
+#endif
 / {
        binman: binman {
                multiple-images;
@@ -31,7 +37,7 @@
                                        description = "U-Boot";
                                        type = "standalone";
                                        os = "U-Boot";
-                                       arch = "riscv";
+                                       arch = ARCH;
                                        compression = "none";
                                        load = /bits/ 64 <CONFIG_TEXT_BASE>;
 
@@ -44,7 +50,7 @@
                                        description = "Linux";
                                        type = "standalone";
                                        os = "Linux";
-                                       arch = "riscv";
+                                       arch = ARCH;
                                        compression = "none";
                                        load = /bits/ 64 <CONFIG_TEXT_BASE>;
 
@@ -57,7 +63,7 @@
                                tee {
                                        description = "OP-TEE";
                                        type = "tee";
-                                       arch = "riscv";
+                                       arch = ARCH;
                                        compression = "none";
                                        os = "tee";
                                        load = /bits/ 64 <CONFIG_SPL_OPTEE_LOAD_ADDR>;
@@ -71,7 +77,7 @@
                                        description = "OpenSBI fw_dynamic Firmware";
                                        type = "firmware";
                                        os = "opensbi";
-                                       arch = "riscv";
+                                       arch = ARCH;
                                        compression = "none";
                                        load = /bits/ 64 <CONFIG_SPL_OPENSBI_LOAD_ADDR>;
                                        entry = /bits/ 64 <CONFIG_SPL_OPENSBI_LOAD_ADDR>;
index d5e1d5f..a90cc4c 100644 (file)
 #include <asm/u-boot-riscv.h>
 
 /* For image.h:image_check_target_arch() */
+#ifdef CONFIG_64BIT
+#define IH_ARCH_DEFAULT IH_ARCH_RISCV64
+#else
 #define IH_ARCH_DEFAULT IH_ARCH_RISCV
+#endif
 
 #endif /* _U_BOOT_H_ */