rockchip: binman: Factor out arch and compression
authorSimon Glass <sjg@chromium.org>
Sun, 13 Apr 2025 19:59:34 +0000 (19:59 +0000)
committerKever Yang <kever.yang@rock-chips.com>
Tue, 6 May 2025 07:58:25 +0000 (15:58 +0800)
Declare arch and compression at the top of the file to avoid needing
ifdefs in every usage.

Add a few comments to help with the remaining #ifdefs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
arch/arm/dts/rockchip-u-boot.dtsi

index e9ed1d4..943d7d8 100644 (file)
@@ -5,6 +5,20 @@
 
 #include <config.h>
 
+#ifdef CONFIG_ARM64
+#define FIT_ARCH               "arm64"
+#else
+#define FIT_ARCH               "arm"
+#endif
+
+#if defined(CONFIG_SPL_GZIP)
+#define FIT_UBOOT_COMP         "gzip"
+#elif defined(CONFIG_SPL_LZMA)
+#define FIT_UBOOT_COMP         "lzma"
+#else
+#define FIT_UBOOT_COMP         "none"
+#endif
+
 / {
        binman: binman {
                multiple-images;
                                        description = "U-Boot";
                                        type = "standalone";
                                        os = "u-boot";
-#ifdef CONFIG_ARM64
-                                       arch = "arm64";
-#else
-                                       arch = "arm";
-#endif
-#if defined(CONFIG_SPL_GZIP)
-                                       compression = "gzip";
-#elif defined(CONFIG_SPL_LZMA)
-                                       compression = "lzma";
-#else
-                                       compression = "none";
-#endif
+                                       arch = FIT_ARCH;
+                                       compression = FIT_UBOOT_COMP;
                                        load = <CONFIG_TEXT_BASE>;
                                        entry = <CONFIG_TEXT_BASE>;
                                        u-boot-nodtb {
-#if defined(CONFIG_SPL_GZIP)
-                                       compress = "gzip";
-#elif defined(CONFIG_SPL_LZMA)
-                                       compress = "lzma";
-#endif
+                                       compress = FIT_UBOOT_COMP;
                                        };
 #ifdef CONFIG_SPL_FIT_SIGNATURE
                                        hash {
@@ -84,7 +84,7 @@
                                        fit,operation = "split-elf";
                                        description = "ARM Trusted Firmware";
                                        type = "firmware";
-                                       arch = "arm64";
+                                       arch = FIT_ARCH;
                                        os = "arm-trusted-firmware";
                                        compression = "none";
                                        fit,load;
                                        fit,operation = "split-elf";
                                        description = "TEE";
                                        type = "tee";
-                                       arch = "arm64";
+                                       arch = FIT_ARCH;
                                        os = "tee";
                                        compression = "none";
                                        fit,load;
                                        };
 #endif
                                };
-#else
+#else /* !CONFIG_ARM64 */
                                op-tee {
                                        description = "OP-TEE";
                                        type = "tee";
-                                       arch = "arm";
+                                       arch = FIT_ARCH;
                                        os = "tee";
                                        compression = "none";
                                        load = <(CFG_SYS_SDRAM_BASE + 0x8400000)>;
                                        };
 #endif
                                };
-#endif
+#endif /* CONFIG_ARM64 */
 
                                @fdt-SEQ {
                                        description = "fdt-NAME";