kvx: add elf bootm support
PATCH v2 1/4 common: bootm: allow building using undefined IH_ARCH
In reply to Clement LegerSome architectures might not want to support uImage. To do so, allow IH_ARCH to be let undefined which will make it possible to compile boot support.
--- common/bootm.c | 2 +- include/image.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-)
common/bootm.c +1 -1
@@ -510,7 +510,7 @@ static int bootm_open_os_uimage(struct image_data *data)uimage_print_contents (data->os); -if (data->os->header.ih_arch !=IH_ARCH ) { +if (IH_ARCH ==IH_ARCH_INVALID || data->os->header.ih_arch !=IH_ARCH ) {printf ("Unsupported Architecture 0x%x\n" , data->os->header.ih_arch);return -EINVAL ;
include/image.h +2 -0
@@ -101,6 +101,8 @@#define IH_ARCH IH_ARCH_AVR32#elif defined(CONFIG_LINUX )#define IH_ARCH IH_ARCH_LINUX +#else +#define IH_ARCH IH_ARCH_INVALID#endif /*
Signature · 7 lines
2.17.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v2 2/4 common: Kconfig: remove MIPS dependency
In reply to Clement LegerThere is no reason anymore to limit the use of elf on mips since there is no elf specific support needed in architectures. Remove this dependency and drop COMPILE_TEST config.
--- common/Kconfig | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
common/Kconfig +1 -2
@@ -38,8 +38,7 @@ config BLOCK_WRITE bool config ELF - bool "ELF Support" if COMPILE_TEST - depends on MIPS || COMPILE_TEST + bool config FILETYPE bool
Signature · 7 lines
2.17.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
v2 cover kvx: add elf bootm support
This serie adds support for elf bootm support on KVX architecture. First patches are allowing to build elf support for KVX and then bootm support is added to KVX.
Changes from v1 -> v2:
- Remove D-cache invalidation
- Reword first patch commit message
Clement Leger (4):
common: bootm: allow building using undefined IH_ARCH
common: Kconfig: remove MIPS dependency
kvx: add I-cache and D-cache synchronisation
kvx: add support for elf loading using bootm
arch/kvx/Kconfig | 5 ++ arch/kvx/configs/generic_defconfig | 3 +- arch/kvx/include/asm/bootm.h | 11 +++ arch/kvx/include/asm/cache.h | 18 ++++ arch/kvx/include/asm/elf.h | 3 + arch/kvx/lib/Makefile | 2 +- arch/kvx/lib/bootm.c | 133 +++++++++++++++++++++++++++++ common/Kconfig | 3 +- common/bootm.c | 2 +- include/image.h | 2 + 10 files changed, 177 insertions(+), 5 deletions(-) create mode 100644 arch/kvx/include/asm/bootm.h create mode 100644 arch/kvx/include/asm/cache.h create mode 100644 arch/kvx/lib/bootm.c
Signature · 7 lines
2.17.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v2 3/4 kvx: add I-cache and D-cache synchronisation
Before booting, we must make sure the I-cache is synchronized with the D-cache to execute loaded instructions. In order to do that, add a function which execute a fence to ensure every memory accesses have been committed out of processor pipeline to memory and then invalidate I-cache to reload from memory.
--- arch/kvx/include/asm/cache.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 arch/kvx/include/asm/cache.h
arch/kvx/include/asm/cache.h new file +18 -0
@@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2019 Kalray Inc. +*/ + +#ifndef __KVX_CACHE_H +#define __KVX_CACHE_H + +#include <linux/types.h> + +static inline void sync_dcache_icache (void ) +{ +__builtin_kvx_fence (); +__builtin_kvx_iinval (); +__builtin_kvx_barrier (); +} + +#endif /* __KVX_CACHE_H */
Signature · 7 lines
2.17.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v2 4/4 kvx: add support for elf loading using bootm
In reply to Clement LegerFrom: Clement Leger <[email protected]>
In order to boot elfs files, add bootm command support for kvx. This support can boot elf files using bootm elf support. initrd and device-tree handling is also included and loads them after the elf file load address.
--- arch/kvx/Kconfig | 5 ++ arch/kvx/configs/generic_defconfig | 3 +- arch/kvx/include/asm/bootm.h | 11 +++ arch/kvx/include/asm/elf.h | 3 + arch/kvx/lib/Makefile | 2 +- arch/kvx/lib/bootm.c | 133 +++++++++++++++++++++++++++++ 6 files changed, 155 insertions(+), 2 deletions(-) create mode 100644 arch/kvx/include/asm/bootm.h create mode 100644 arch/kvx/lib/bootm.c
arch/kvx/Kconfig +5 -0
@@ -1,9 +1,14 @@ config KVX bool select 64BIT + select BOOTM + select BOOTM_ELF + select BOOTM_OFTREE + select BOOTM_INITRD select CLKDEV_LOOKUP select COMMON_CLK select COMMON_CLK_OF_PROVIDER + select ELF select FLEXIBLE_BOOTARGS select GENERIC_FIND_NEXT_BIT select LIBFDT
arch/kvx/configs/generic_defconfig +2 -1
@@ -1,7 +1,8 @@ CONFIG_AUTO_COMPLETE=y CONFIG_BAUDRATE=115200 -# CONFIG_BOOTM is not set CONFIG_CLOCKSOURCE_KVX=y +CONFIG_CMD_BOOT=y +CONFIG_CMD_BOOTM=y CONFIG_CMD_CMP=y CONFIG_CMD_OF_DUMP=y CONFIG_CMD_POWEROFF=y
arch/kvx/include/asm/bootm.h new file +11 -0
@@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) 2019 Kalray Inc. +*/ + +#ifndef _ASM_KVX_BOOTM_H +#define _ASM_KVX_BOOTM_H + +#define LINUX_BOOT_PARAM_MAGIC 0x31564752414E494CULL + +#endif /* _ASM_KVX_BOOTM_H */
arch/kvx/include/asm/elf.h +3 -0
@@ -11,6 +11,9 @@*/ #include <linux/types.h> +#define EM_KVX 256 + +#define ELF_ARCH EM_KVX#define ELF_CLASS ELFCLASS32#define ELF_DATA ELFDATA2MSB
arch/kvx/lib/Makefile +1 -1
@@ -3,4 +3,4 @@ # Copyright (C) 2019 Kalray Inc. # -obj-y += cpuinfo.o board.o dtb.o poweroff.o +obj-y += cpuinfo.o board.o dtb.o poweroff.o bootm.o
arch/kvx/lib/bootm.c new file +133 -0
133 lines not on this page · raw message
Signature · 7 lines
2.17.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH v2 2/4] common: Kconfig: remove MIPS dependency
In reply to Clement LegerHello Clement,
Quoted 14 lines · Clement Leger
There is no reason anymore to limit the use of elf on mips since there is no elf specific support needed in architectures. Remove this dependency and drop
COMPILE_TESTconfig.Signed-off-by Clement Leger <[email protected]>--- common/Kconfig | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)common/Kconfig +0
-0
common/Kconfig config BLOCK_WRITE · line 41
Quoted 6 lines
common/Kconfig +1
-2@@ -38,8 +38,7 @@ config BLOCK_WRITE bool config ELF - bool "ELF Support" if COMPILE_TEST - depends on MIPS || COMPILE_TEST + bool
as I already commented on v1, please don't remove the bool "Elf Support" if COMPILE_TEST line. You can drop the depends.
Quoted 4 lines
common/Kconfig +0
-0config FILETYPE bool
Signature · 9 lines
Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox