Commit 73223f0e authored by Simon Glass's avatar Simon Glass Committed by Tom Rini

Kconfig: Move CONFIG_FIT and related options to Kconfig

There are already two FIT options in Kconfig but the CONFIG options are
still in the header files. We need to do a proper move to fix this.

Move these options to Kconfig and tidy up board configuration:

   CONFIG_FIT
   CONFIG_OF_BOARD_SETUP
   CONFIG_OF_SYSTEM_SETUP
   CONFIG_FIT_SIGNATURE
   CONFIG_FIT_BEST_MATCH
   CONFIG_FIT_VERBOSE
   CONFIG_OF_STDOUT_VIA_ALIAS
   CONFIG_RSA

Unfortunately the first one is a little complicated. We need to make sure
this option is not enabled in SPL by this change. Also this option is
enabled automatically in the host builds by defining CONFIG_FIT in the
image.h file. To solve this, add a new IMAGE_USE_FIT #define which can
be used in files that are built on the host but must also build for U-Boot
and SPL.

Note: Masahiro's moveconfig.py script is amazing.
Signed-off-by: default avatarSimon Glass <sjg@chromium.org>
[trini: Add microblaze change, various configs/ re-applies]
Signed-off-by: default avatarTom Rini <trini@konsulko.com>
parent 69e173eb
......@@ -177,6 +177,10 @@ config FIT
images of various types (kernel, FDT blob, ramdisk, etc.)
in a single blob. To boot this new uImage structure,
pass the address of the blob to the "bootm" command.
FIT is very flexible, supporting compression, multiple images,
multiple configurations, verification through hashing and also
verified boot (secure boot using RSA). This option enables that
feature.
config FIT_VERBOSE
bool "Display verbose messages on FIT boot"
......@@ -191,8 +195,62 @@ config FIT_SIGNATURE
This option enables signature verification of FIT uImages,
using a hash signed and verified using RSA. If
CONFIG_SHA_PROG_HW_ACCEL is defined, i.e support for progressive
hashing is available using hardware, RSA library will use it.
See doc/uImage.FIT/signature.txt for more details.
hashing is available using hardware, then then RSA library will use
it. See doc/uImage.FIT/signature.txt for more details.
WARNING: When relying on signed FIT images with a required signature
check the legacy image format is disabled by default, so that
unsigned images cannot be loaded. If a board needs the legacy image
format support in this case, enable it using
CONFIG_IMAGE_FORMAT_LEGACY.
config FIT_BEST_MATCH
bool "Select the best match for the kernel device tree"
depends on FIT
help
When no configuration is explicitly selected, default to the
one whose fdt's compatibility field best matches that of
U-Boot itself. A match is considered "best" if it matches the
most specific compatibility entry of U-Boot's fdt's root node.
The order of entries in the configuration's fdt is ignored.
config FIT_VERBOSE
bool "Show verbose messages when FIT images fails"
depends on FIT
help
Generally a system will have valid FIT images so debug messages
are a waste of code space. If you are debugging your images then
you can enable this option to get more verbose information about
failures.
config OF_BOARD_SETUP
bool "Set up board-specific details in device tree before boot"
depends on OF_LIBFDT
help
This causes U-Boot to call ft_board_setup() before booting into
the Operating System. This function can set up various
board-specific information in the device tree for use by the OS.
The device tree is then passed to the OS.
config OF_SYSTEM_SETUP
bool "Set up system-specific details in device tree before boot"
depends on OF_LIBFDT
help
This causes U-Boot to call ft_system_setup() before booting into
the Operating System. This function can set up various
system-specific information in the device tree for use by the OS.
The device tree is then passed to the OS.
config OF_STDOUT_VIA_ALIAS
bool "Update the device-tree stdout alias from U-Boot"
depends on OF_LIBFDT
help
This uses U-Boot's serial alias from the aliases node to update
the device tree passed to the OS. The "linux,stdout-path" property
in the chosen node is set to point to the correct serial node.
This option currently references CONFIG_CONS_INDEX, which is
incorrect when used with device tree as this option does not
exist / should not be used.
config SYS_EXTRA_OPTIONS
string "Extra Options (DEPRECATED)"
......
......@@ -3093,20 +3093,6 @@ CBFS (Coreboot Filesystem) support
will set it back to normal. This command currently
supports i.MX53 and i.MX6.
- Signing support:
CONFIG_RSA
This enables the RSA algorithm used for FIT image verification
in U-Boot. See doc/uImage.FIT/signature.txt for more information.
The Modular Exponentiation algorithm in RSA is implemented using
driver model. So CONFIG_DM needs to be enabled by default for this
library to function.
The signing part is build into mkimage regardless of this
option. The software based modular exponentiation is built into
mkimage irrespective of this option.
- bootcount support:
CONFIG_BOOTCOUNT_LIMIT
......@@ -3306,33 +3292,14 @@ FIT uImage format:
enabled per default for backward compatibility.
- FIT image support:
CONFIG_FIT
Enable support for the FIT uImage format.
CONFIG_FIT_BEST_MATCH
When no configuration is explicitly selected, default to the
one whose fdt's compatibility field best matches that of
U-Boot itself. A match is considered "best" if it matches the
most specific compatibility entry of U-Boot's fdt's root node.
The order of entries in the configuration's fdt is ignored.
CONFIG_FIT_SIGNATURE
This option enables signature verification of FIT uImages,
using a hash signed and verified using RSA. If
CONFIG_SHA_PROG_HW_ACCEL is defined, i.e support for progressive
hashing is available using hardware, RSA library will use it.
See doc/uImage.FIT/signature.txt for more details.
WARNING: When relying on signed FIT images with required
signature check the legacy image format is default
disabled. If a board need legacy image format support
enable this through CONFIG_IMAGE_FORMAT_LEGACY
CONFIG_FIT_DISABLE_SHA256
Supporting SHA256 hashes has quite an impact on binary size.
For constrained systems sha256 hash support can be disabled
with this option.
TODO(sjg@chromium.org): Adjust this option to be positive,
and move it to Kconfig
- Standalone program support:
CONFIG_STANDALONE_LOAD_ADDR
......
......@@ -20,7 +20,6 @@
#define CONFIG_CMD_BLOB
#define CONFIG_FSL_SEC_MON
#define CONFIG_SHA_PROG_HW_ACCEL
#define CONFIG_RSA
#define CONFIG_RSA_FREESCALE_EXP
#ifndef CONFIG_FSL_CAAM
......
......@@ -10,6 +10,7 @@
#include <common.h>
#include <command.h>
#include <fdt_support.h>
#include <image.h>
#include <u-boot/zlib.h>
#include <asm/byteorder.h>
......
......@@ -76,7 +76,6 @@
#define CONFIG_CMD_BLOB
#define CONFIG_FSL_SEC_MON
#define CONFIG_SHA_PROG_HW_ACCEL
#define CONFIG_RSA
#define CONFIG_RSA_FREESCALE_EXP
#ifndef CONFIG_FSL_CAAM
......
......@@ -7,9 +7,11 @@
#include <common.h>
#include <asm/io.h>
#include <netdev.h>
#include <fdt_support.h>
#include <fm_eth.h>
#include <fsl_mdio.h>
#include <fsl_dtsec.h>
#include <libfdt.h>
#include <malloc.h>
#include <asm/arch/fsl_serdes.h>
......
......@@ -10,6 +10,7 @@
#include <asm/arch/clock.h>
#include <asm/arch/fsl_serdes.h>
#include <asm/arch/soc.h>
#include <fdt_support.h>
#include <hwconfig.h>
#include <ahci.h>
#include <mmc.h>
......
......@@ -10,6 +10,7 @@
#include <common.h>
#include <errno.h>
#include <libfdt.h>
#include <spl.h>
#include <asm/arch/cpu.h>
#include <asm/arch/hardware.h>
......
......@@ -22,7 +22,7 @@ int common_diskboot(cmd_tbl_t *cmdtp, const char *intf, int argc,
#endif
block_dev_desc_t *dev_desc;
#if defined(CONFIG_FIT)
#if CONFIG_IS_ENABLED(FIT)
const void *fit_hdr = NULL;
#endif
......@@ -82,7 +82,7 @@ int common_diskboot(cmd_tbl_t *cmdtp, const char *intf, int argc,
cnt = image_get_image_size(hdr);
break;
#endif
#if defined(CONFIG_FIT)
#if CONFIG_IS_ENABLED(FIT)
case IMAGE_FORMAT_FIT:
fit_hdr = (const void *) addr;
puts("Fit image detected...\n");
......@@ -108,7 +108,7 @@ int common_diskboot(cmd_tbl_t *cmdtp, const char *intf, int argc,
}
bootstage_mark(BOOTSTAGE_ID_IDE_READ);
#if defined(CONFIG_FIT)
#if CONFIG_IS_ENABLED(FIT)
/* This cannot be done earlier,
* we need complete FIT image in RAM first */
if (genimg_get_format((void *) addr) == IMAGE_FORMAT_FIT) {
......
......@@ -132,8 +132,8 @@ endif
obj-y += image.o
obj-$(CONFIG_ANDROID_BOOT_IMAGE) += image-android.o
obj-$(CONFIG_OF_LIBFDT) += image-fdt.o
obj-$(CONFIG_FIT) += image-fit.o
obj-$(CONFIG_FIT_SIGNATURE) += image-sig.o
obj-$(CONFIG_$(SPL_)FIT) += image-fit.o
obj-$(CONFIG_$(SPL_)FIT_SIGNATURE) += image-sig.o
obj-$(CONFIG_IO_TRACE) += iotrace.o
obj-y += memsize.o
obj-y += stdio.o
......
......@@ -108,7 +108,7 @@ static int bootm_find_os(cmd_tbl_t *cmdtp, int flag, int argc,
images.os.arch = image_get_arch(os_hdr);
break;
#endif
#if defined(CONFIG_FIT)
#if IMAGE_ENABLE_FIT
case IMAGE_FORMAT_FIT:
if (fit_image_get_type(images.fit_hdr_os,
images.fit_noffset_os,
......@@ -180,7 +180,7 @@ static int bootm_find_os(cmd_tbl_t *cmdtp, int flag, int argc,
/* Kernel entry point is the setup.bin */
} else if (images.legacy_hdr_valid) {
images.ep = image_get_ep(&images.legacy_hdr_os_copy);
#if defined(CONFIG_FIT)
#if IMAGE_ENABLE_FIT
} else if (images.fit_uname_os) {
int ret;
......@@ -245,7 +245,7 @@ int bootm_find_images(int flag, int argc, char * const argv[])
set_working_fdt_addr((ulong)images.ft_addr);
#endif
#if defined(CONFIG_FIT)
#if IMAGE_ENABLE_FIT
/* find all of the loadables */
ret = boot_get_loadable(argc, argv, &images, IH_ARCH_DEFAULT,
NULL, NULL);
......@@ -788,7 +788,7 @@ static const void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc,
const void *buf;
const char *fit_uname_config = NULL;
const char *fit_uname_kernel = NULL;
#if defined(CONFIG_FIT)
#if IMAGE_ENABLE_FIT
int os_noffset;
#endif
......@@ -849,7 +849,7 @@ static const void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc,
bootstage_mark(BOOTSTAGE_ID_DECOMP_IMAGE);
break;
#endif
#if defined(CONFIG_FIT)
#if IMAGE_ENABLE_FIT
case IMAGE_FORMAT_FIT:
os_noffset = fit_image_load(images, img_addr,
&fit_uname_kernel, &fit_uname_config,
......
......@@ -231,7 +231,7 @@ int boot_get_fdt(int flag, int argc, char * const argv[], uint8_t arch,
ulong fdt_addr;
char *fdt_blob = NULL;
void *buf;
#if defined(CONFIG_FIT)
#if CONFIG_IS_ENABLED(FIT)
const char *fit_uname_config = images->fit_uname_cfg;
const char *fit_uname_fdt = NULL;
ulong default_addr;
......@@ -246,7 +246,7 @@ int boot_get_fdt(int flag, int argc, char * const argv[], uint8_t arch,
if (argc > 2)
select = argv[2];
if (select || genimg_has_config(images)) {
#if defined(CONFIG_FIT)
#if CONFIG_IS_ENABLED(FIT)
if (select) {
/*
* If the FDT blob comes from the FIT image and the
......@@ -276,7 +276,7 @@ int boot_get_fdt(int flag, int argc, char * const argv[], uint8_t arch,
debug("* fdt: cmdline image address = 0x%08lx\n",
fdt_addr);
}
#if defined(CONFIG_FIT)
#if CONFIG_IS_ENABLED(FIT)
} else {
/* use FIT configuration provided in first bootm
* command argument
......@@ -351,7 +351,7 @@ int boot_get_fdt(int flag, int argc, char * const argv[], uint8_t arch,
* (libfdt based) and raw FDT blob (also libfdt
* based).
*/
#if defined(CONFIG_FIT)
#if CONFIG_IS_ENABLED(FIT)
/* check FDT blob vs FIT blob */
if (fit_check_format(buf)) {
ulong load, len;
......
......@@ -1101,8 +1101,9 @@ int fit_all_image_verify(const void *fit)
* Direct child node of the images parent node,
* i.e. component image node.
*/
printf(" Hash(es) for Image %u (%s): ", count++,
printf(" Hash(es) for Image %u (%s): ", count,
fit_get_name(fit, noffset, NULL));
count++;
if (!fit_image_verify(fit, noffset))
return 0;
......
......@@ -29,7 +29,7 @@
#include <image.h>
#include <mapmem.h>
#if defined(CONFIG_FIT) || defined(CONFIG_OF_LIBFDT)
#if IMAGE_ENABLE_FIT || defined(CONFIG_OF_LIBFDT)
#include <libfdt.h>
#include <fdt_support.h>
#endif
......@@ -707,7 +707,7 @@ ulong genimg_get_kernel_addr_fit(char * const img_addr,
kernel_addr = load_addr;
debug("* kernel: default image load address = 0x%08lx\n",
load_addr);
#if defined(CONFIG_FIT)
#if CONFIG_IS_ENABLED(FIT)
} else if (fit_parse_conf(img_addr, load_addr, &kernel_addr,
fit_uname_config)) {
debug("* kernel: config '%s' from image at 0x%08lx\n",
......@@ -762,7 +762,7 @@ int genimg_get_format(const void *img_addr)
if (image_check_magic(hdr))
return IMAGE_FORMAT_LEGACY;
#endif
#if defined(CONFIG_FIT) || defined(CONFIG_OF_LIBFDT)
#if IMAGE_ENABLE_FIT || defined(CONFIG_OF_LIBFDT)
if (fdt_check_header(img_addr) == 0)
return IMAGE_FORMAT_FIT;
#endif
......@@ -799,7 +799,7 @@ ulong genimg_get_image(ulong img_addr)
/* get header size */
h_size = image_get_header_size();
#if defined(CONFIG_FIT)
#if IMAGE_ENABLE_FIT
if (sizeof(struct fdt_header) > h_size)
h_size = sizeof(struct fdt_header);
#endif
......@@ -821,7 +821,7 @@ ulong genimg_get_image(ulong img_addr)
ram_addr, d_size);
break;
#endif
#if defined(CONFIG_FIT)
#if IMAGE_ENABLE_FIT
case IMAGE_FORMAT_FIT:
d_size = fit_get_size(buf) - h_size;
debug(" FIT/FDT format image found at 0x%08lx, "
......@@ -862,7 +862,7 @@ ulong genimg_get_image(ulong img_addr)
*/
int genimg_has_config(bootm_headers_t *images)
{
#if defined(CONFIG_FIT)
#if IMAGE_ENABLE_FIT
if (images->fit_uname_cfg)
return 1;
#endif
......@@ -903,7 +903,7 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
#ifdef CONFIG_SUPPORT_RAW_INITRD
char *end;
#endif
#if defined(CONFIG_FIT)
#if IMAGE_ENABLE_FIT
const char *fit_uname_config = images->fit_uname_cfg;
const char *fit_uname_ramdisk = NULL;
ulong default_addr;
......@@ -934,7 +934,7 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
debug("## Skipping init Ramdisk\n");
rd_len = rd_data = 0;
} else if (select || genimg_has_config(images)) {
#if defined(CONFIG_FIT)
#if IMAGE_ENABLE_FIT
if (select) {
/*
* If the init ramdisk comes from the FIT image and
......@@ -965,7 +965,7 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
"0x%08lx\n",
rd_addr);
}
#if defined(CONFIG_FIT)