From: Lukasz Majewski <lukma@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 5/9] spl: Add full fitImage support
Date: Thu, 28 Dec 2017 15:21:06 +0100 [thread overview]
Message-ID: <20171228152106.137b5781@jawa> (raw)
In-Reply-To: <20171228120621.4039-6-marex@denx.de>
Hi Marek,
> Add support for loading U-Boot and optionally FDT from a fitImage
> in SPL by using the full fitImage support from U-Boot. While we do
> have limited SPL loading support in SPL with a small footprint, it
> is missing a lot of important features, like checking signatures.
> This support has all the fitImage features, while the footprint is
> obviously larger.
>
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
> Cc: Simon Glass <sjg@chromium.org>
> ---
> Kconfig | 11 +++++++++++
> common/spl/spl.c | 43 +++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 54 insertions(+)
>
> diff --git a/Kconfig b/Kconfig
> index cd32096f21..4d0c1a01c1 100644
> --- a/Kconfig
> +++ b/Kconfig
> @@ -293,6 +293,17 @@ config SPL_LOAD_FIT
> particular it can handle selecting from multiple device
> tree and passing the correct one to U-Boot.
>
> +config SPL_LOAD_FIT_FULL
> + bool "Enable SPL loading U-Boot as a FIT"
> + select SPL_FIT
> + help
> + Normally with the SPL framework a legacy image is
> generated as part
> + of the build. This contains U-Boot along with information
> as to
> + where it should be loaded. This option instead enables
> generation
> + of a FIT (Flat Image Tree) which provides more
> flexibility. In
> + particular it can handle selecting from multiple device
> tree
> + and passing the correct one to U-Boot.
> +
> config SPL_FIT_IMAGE_POST_PROCESS
> bool "Enable post-processing of FIT artifacts after loading
> by the SPL" depends on SPL_LOAD_FIT
> diff --git a/common/spl/spl.c b/common/spl/spl.c
> index 76c1963611..d429ea2c82 100644
> --- a/common/spl/spl.c
> +++ b/common/spl/spl.c
> @@ -139,9 +139,52 @@ void spl_set_header_raw_uboot(struct
> spl_image_info *spl_image) spl_image->name = "U-Boot";
> }
>
> +#ifdef CONFIG_SPL_LOAD_FIT_FULL
> +/* Parse and load full fitImage in SPL */
> +static int spl_load_fit_image(struct spl_image_info *spl_image,
> + const struct image_header *header)
> +
^^^ - this blank line can be removed.
> +{
> + bootm_headers_t images;
> + const char *fit_uname_config = NULL;
> + const char *fit_uname_fdt = FIT_FDT_PROP;
> + ulong fw_data = 0, dt_data = 0;
> + ulong fw_len = 0, dt_len = 0;
> + int ret;
> +
> + ret = fit_image_load(&images, (ulong)header,
> + NULL, &fit_uname_config,
> + IH_ARCH_DEFAULT, IH_TYPE_STANDALONE, -1,
> + FIT_LOAD_REQUIRED, &fw_data, &fw_len);
> + if (ret < 0)
> + return ret;
> +
> + spl_image->size = fw_len;
> + spl_image->entry_point = fw_data;
> + spl_image->load_addr = fw_data;
> + spl_image->os = IH_OS_U_BOOT;
> + spl_image->name = "U-Boot";
> +
> + debug("spl: payload image: %.*s load addr: 0x%lx size: %d\n",
> + (int)sizeof(spl_image->name), spl_image->name,
> + spl_image->load_addr, spl_image->size);
> +
> + ret = fit_image_load(&images, (ulong)header,
> + &fit_uname_fdt, &fit_uname_config,
> + IH_ARCH_DEFAULT, IH_TYPE_FLATDT, -1,
> + FIT_LOAD_OPTIONAL, &dt_data, &dt_len);
> + return 0;
> +}
> +#endif
> +
> int spl_parse_image_header(struct spl_image_info *spl_image,
> const struct image_header *header)
> {
> +#ifdef CONFIG_SPL_LOAD_FIT_FULL
> + int ret = spl_load_fit_image(spl_image, header);
> + if (!ret)
> + return ret;
> +#endif
> if (image_get_magic(header) == IH_MAGIC) {
> #ifdef CONFIG_SPL_LEGACY_IMAGE_SUPPORT
> u32 header_size = sizeof(struct image_header);
Despite this minor thing:
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20171228/92e7ac2d/attachment.sig>
next prev parent reply other threads:[~2017-12-28 14:21 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-28 12:06 [U-Boot] [PATCH 0/9] spl: Add full fit and u-boot dto support Marek Vasut
2017-12-28 12:06 ` [U-Boot] [PATCH 1/9] fit: Fix CONFIG_FIT_SPL_PRINT Marek Vasut
2018-01-08 3:53 ` Simon Glass
2017-12-28 12:06 ` [U-Boot] [PATCH 2/9] fit: Add empty fit_print_contents() and fit_image_print() Marek Vasut
2018-01-08 3:53 ` Simon Glass
2017-12-28 12:06 ` [U-Boot] [PATCH 3/9] fit: Add standalone image type handling Marek Vasut
2018-01-08 3:53 ` Simon Glass
2017-12-28 12:06 ` [U-Boot] [PATCH 4/9] fit: Verify all configuration signatures Marek Vasut
2018-01-08 3:56 ` Simon Glass
2017-12-28 12:06 ` [U-Boot] [PATCH 5/9] spl: Add full fitImage support Marek Vasut
2017-12-28 14:21 ` Lukasz Majewski [this message]
2018-01-08 3:58 ` Simon Glass
2017-12-28 12:06 ` [U-Boot] [PATCH 6/9] spl: Add support for overlaying U-Boot DT Marek Vasut
2017-12-28 14:23 ` Lukasz Majewski
2018-01-08 4:20 ` Simon Glass
2017-12-28 12:06 ` [U-Boot] [PATCH 7/9] spl: Restart loading if load_image returns -EAGAIN Marek Vasut
2017-12-28 14:25 ` Lukasz Majewski
2017-12-31 17:37 ` Marek Vasut
2017-12-28 12:06 ` [U-Boot] [PATCH 8/9] spl: ram: Add support for fetching image position from control DT Marek Vasut
2017-12-28 14:27 ` Lukasz Majewski
2018-01-08 4:20 ` Simon Glass
2017-12-28 12:06 ` [U-Boot] [PATCH 9/9] spl: spi: " Marek Vasut
2017-12-28 14:29 ` Lukasz Majewski
2018-01-08 4:37 ` Simon Glass
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171228152106.137b5781@jawa \
--to=lukma@denx.de \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox