spl_fit. add hook to make fixes after fit header is loaded
authorHeiko Schocher <hs@denx.de>
Fri, 6 Aug 2021 04:44:26 +0000 (06:44 +0200)
committerStefano Babic <sbabic@denx.de>
Thu, 7 Oct 2021 14:53:50 +0000 (16:53 +0200)
add hook function spl_load_simple_fit_fix_load()
which is called after fit image header is loaded.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
common/spl/spl_fit.c
include/spl.h

index f41abca0ccb59baf486f5383d6cef64a92cfeb33..849e01ad8ee11c9805223e2cd98ab159195476ff 100644 (file)
@@ -548,6 +548,15 @@ __weak bool spl_load_simple_fit_skip_processing(void)
        return false;
 }
 
+/*
+ * Weak default function to allow fixes after fit header
+ * is loaded.
+ */
+__weak void *spl_load_simple_fit_fix_load(const void *fit)
+{
+       return (void *)fit;
+}
+
 static void warn_deprecated(const char *msg)
 {
        printf("DEPRECATED: %s\n", msg);
@@ -685,6 +694,8 @@ int spl_load_simple_fit(struct spl_image_info *spl_image,
        if (spl_load_simple_fit_skip_processing())
                return 0;
 
+       ctx.fit = spl_load_simple_fit_fix_load(ctx.fit);
+
        ret = spl_simple_fit_parse(&ctx);
        if (ret < 0)
                return ret;
index afbf39bef49f8d110927def0ed46d4c4e5374d32..7ddb2abe0fb9f094c88a282ecb7146129ac1dd61 100644 (file)
@@ -304,6 +304,14 @@ ulong spl_get_image_text_base(void);
  */
 bool spl_load_simple_fit_skip_processing(void);
 
+/**
+ * spl_load_simple_fit_fix_load() - Hook to make fixes
+ * after fit image header is loaded
+ *
+ * Returns pointer to fit
+ */
+void *spl_load_simple_fit_fix_load(const void *fit);
+
 /**
  * spl_load_simple_fit() - Loads a fit image from a device.
  * @spl_image: Image description to set up