diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2021-05-17 16:23:50 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2021-05-17 16:23:50 +0200 |
commit | c5e0e697de769d0e78a00b1cb47fe864fade9974 (patch) | |
tree | 1a9177fe4fb08156bee02cdd2df0dbed61f2a12a /common | |
parent | ec8f2fe6b1bc9e69a725863a61a6b84ab7a91989 (diff) | |
parent | b383d7739c355fee9f81986e6e8d030185373ca5 (diff) | |
download | barebox-c5e0e697de769d0e78a00b1cb47fe864fade9974.tar.gz barebox-c5e0e697de769d0e78a00b1cb47fe864fade9974.tar.xz |
Merge branch 'for-next/riscv'
Diffstat (limited to 'common')
-rw-r--r-- | common/Kconfig | 13 | ||||
-rw-r--r-- | common/Makefile | 2 | ||||
-rw-r--r-- | common/booti.c | 66 |
3 files changed, 80 insertions, 1 deletions
diff --git a/common/Kconfig b/common/Kconfig index 939cfab4f7..758acb751d 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -1363,6 +1363,15 @@ config DEBUG_RPI3_MINI_UART help Say Y here if you want low-level debugging support on RaspberryPi 3 board mini UART. + +config DEBUG_ERIZO + bool "Erizo ns16550 port" + depends on SOC_ERIZO + +config DEBUG_SIFIVE + bool "SiFive serial0 port" + depends on SOC_SIFIVE + endchoice config DEBUG_IMX_UART_PORT @@ -1483,6 +1492,10 @@ endmenu config HAS_DEBUG_LL bool +config HAS_ASM_DEBUG_LL + bool + select HAS_DEBUG_LL + config DDR_SPD bool select CRC_ITU_T diff --git a/common/Makefile b/common/Makefile index c0b45d263e..2c679090a0 100644 --- a/common/Makefile +++ b/common/Makefile @@ -20,7 +20,7 @@ obj-$(CONFIG_BAREBOX_UPDATE) += bbu.o obj-$(CONFIG_BINFMT) += binfmt.o obj-$(CONFIG_BLOCK) += block.o obj-$(CONFIG_BLSPEC) += blspec.o -obj-$(CONFIG_BOOTM) += bootm.o +obj-$(CONFIG_BOOTM) += bootm.o booti.o obj-$(CONFIG_CMD_LOADS) += s_record.o obj-$(CONFIG_CMD_MEMTEST) += memtest.o obj-$(CONFIG_COMMAND_SUPPORT) += command.o diff --git a/common/booti.c b/common/booti.c new file mode 100644 index 0000000000..a2d63d8c31 --- /dev/null +++ b/common/booti.c @@ -0,0 +1,66 @@ +// SPDX-License-Identifier: GPL-2.0-only +// SPDX-FileCopyrightText: 2018 Sascha Hauer <s.hauer@pengutronix.de> + +#include <common.h> +#include <memory.h> +#include <bootm.h> +#include <linux/sizes.h> + +void *booti_load_image(struct image_data *data, phys_addr_t *oftree) +{ + const void *kernel_header = + data->os_fit ? data->fit_kernel : data->os_header; + resource_size_t start, end; + unsigned long text_offset, image_size, devicetree, kernel; + unsigned long image_end; + int ret; + void *fdt; + + text_offset = le64_to_cpup(kernel_header + 8); + image_size = le64_to_cpup(kernel_header + 16); + + ret = memory_bank_first_find_space(&start, &end); + if (ret) + return ERR_PTR(ret); + + kernel = ALIGN(start, SZ_2M) + text_offset; + + ret = bootm_load_os(data, kernel); + if (ret) + return ERR_PTR(ret); + + image_end = PAGE_ALIGN(kernel + image_size); + + if (oftree) { + if (bootm_has_initrd(data)) { + ret = bootm_load_initrd(data, image_end); + if (ret) + return ERR_PTR(ret); + + image_end += resource_size(data->initrd_res); + image_end = PAGE_ALIGN(image_end); + } + + devicetree = image_end; + + fdt = bootm_get_devicetree(data); + if (IS_ERR(fdt)) + return fdt; + + ret = bootm_load_devicetree(data, fdt, devicetree); + + free(fdt); + + if (ret) + return ERR_PTR(ret); + + *oftree = devicetree; + } + + printf("Loaded kernel to 0x%08lx", kernel); + if (oftree) + printf(", devicetree at 0x%08lx", devicetree); + printf("\n"); + + return (void *)kernel; +} |