From: Jules Maselbas <jmaselbas@kalray.eu>
To: barebox@lists.infradead.org
Cc: Clement Leger <clement.leger@bootlin.com>,
Louis Morhet <lmorhet@kalray.eu>, Luc Michel <lmichel@kalray.eu>,
Yann Sionneau <ysionneau@kalray.eu>,
Clement Leger <cleger@kalray.eu>,
Jules Maselbas <jmaselbas@kalray.eu>
Subject: [PATCH 05/13] kvx: enable FITIMAGE support
Date: Fri, 14 Jan 2022 17:52:04 +0100 [thread overview]
Message-ID: <20220114165208.9980-6-jmaselbas@kalray.eu> (raw)
In-Reply-To: <20220114165208.9980-1-jmaselbas@kalray.eu>
From: Clement Leger <cleger@kalray.eu>
Enable FITIMAGE support in kvx defconfig and add code to handle fit boot
from bootm command. This is rather a simple addition and it allow to boot
a fit image containing an ELF file as the kernel.
Signed-off-by: Clement Leger <cleger@kalray.eu>
Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu>
---
arch/kvx/Kconfig | 1 +
arch/kvx/lib/bootm.c | 32 +++++++++++++++++++++++++++++++-
2 files changed, 32 insertions(+), 1 deletion(-)
diff --git a/arch/kvx/Kconfig b/arch/kvx/Kconfig
index 0934440880..100a945761 100644
--- a/arch/kvx/Kconfig
+++ b/arch/kvx/Kconfig
@@ -10,6 +10,7 @@ config KVX
select COMMON_CLK_OF_PROVIDER
select ELF
select FLEXIBLE_BOOTARGS
+ select FITIMAGE
select GENERIC_FIND_NEXT_BIT
select HAS_ARCH_SJLJ
select HAS_CACHE
diff --git a/arch/kvx/lib/bootm.c b/arch/kvx/lib/bootm.c
index 3e9772c458..4c77f676ec 100644
--- a/arch/kvx/lib/bootm.c
+++ b/arch/kvx/lib/bootm.c
@@ -94,7 +94,7 @@ static int do_boot_elf(struct image_data *data, struct elf_image *elf)
goto err_free_fdt;
}
- entry = (boot_func_entry) data->os_address;
+ entry = (boot_func_entry) elf->entry;
ret = do_boot_entry(data, entry, fdt);
@@ -104,6 +104,27 @@ err_free_fdt:
return ret;
}
+static int do_bootm_fit(struct image_data *data)
+{
+ int ret;
+ struct elf_image *elf;
+
+ elf = elf_open_binary((void *) data->fit_kernel);
+ if (IS_ERR(elf))
+ return PTR_ERR(data->elf);
+
+ ret = elf_load(elf);
+ if (ret)
+ goto close_elf;
+
+ ret = do_boot_elf(data, elf);
+
+close_elf:
+ elf_close(elf);
+
+ return ret;
+}
+
static int do_bootm_elf(struct image_data *data)
{
int ret;
@@ -121,6 +142,12 @@ static struct image_handler elf_handler = {
.filetype = filetype_elf,
};
+static struct image_handler fit_handler = {
+ .name = "FIT",
+ .bootm = do_bootm_fit,
+ .filetype = filetype_oftree,
+};
+
static struct binfmt_hook binfmt_elf_hook = {
.type = filetype_elf,
.exec = "bootm",
@@ -130,6 +157,9 @@ static int kvx_register_image_handler(void)
{
register_image_handler(&elf_handler);
+ if (IS_ENABLED(CONFIG_FITIMAGE))
+ register_image_handler(&fit_handler);
+
binfmt_register(&binfmt_elf_hook);
return 0;
--
2.17.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2022-01-14 16:54 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-14 16:51 [PATCH 00/13] kvx arch update Jules Maselbas
2022-01-14 16:52 ` [PATCH 01/13] kvx: dma: Remove arch dma_map/unmap_single Jules Maselbas
2022-01-14 16:52 ` [PATCH 02/13] kvx: Move LINUX_BOOT_PARAM_MAGIC in asm/common.h Jules Maselbas
2022-01-14 16:52 ` [PATCH 03/13] kvx: Accept LINUX_BOOT_PARAM_MAGIC as a valid magic value Jules Maselbas
2022-01-14 16:52 ` [PATCH 04/13] common: elf: add elf_load_binary Jules Maselbas
2022-01-14 17:21 ` Clément Léger
2022-01-14 17:24 ` Jules Maselbas
2022-01-14 16:52 ` Jules Maselbas [this message]
2022-01-14 16:52 ` [PATCH 06/13] clocksource: kvx: Register as postcore_platform_driver Jules Maselbas
2022-01-14 16:52 ` [PATCH 07/13] watchdog: kvx: do not disable watchdog on probe Jules Maselbas
2022-01-14 16:52 ` [PATCH 08/13] nvmem: add kvx otp non volatile regbank support Jules Maselbas
2022-01-17 8:24 ` Sascha Hauer
2022-01-17 11:17 ` Jules Maselbas
2022-01-14 16:52 ` [PATCH 09/13] kvx: add kvx_sfr_field_val Jules Maselbas
2022-01-14 16:54 ` [PATCH 10/13] drivers: add soc hierarchy properly Jules Maselbas
2022-01-14 16:54 ` [PATCH 11/13] soc: add kvx_socinfo driver Jules Maselbas
2022-01-14 16:54 ` [PATCH 12/13] kvx: Update defconfig Jules Maselbas
2022-01-14 16:54 ` [PATCH 13/13] kvx: dts: Update k200.dts Jules Maselbas
2022-01-14 17:31 ` Clément Léger
2022-01-14 17:06 ` [PATCH 10/13] drivers: add soc hierarchy properly Ahmad Fatoum
2022-01-14 17:11 ` Jules Maselbas
2022-01-14 17:20 ` Ahmad Fatoum
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=20220114165208.9980-6-jmaselbas@kalray.eu \
--to=jmaselbas@kalray.eu \
--cc=barebox@lists.infradead.org \
--cc=cleger@kalray.eu \
--cc=clement.leger@bootlin.com \
--cc=lmichel@kalray.eu \
--cc=lmorhet@kalray.eu \
--cc=ysionneau@kalray.eu \
/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