Skip to content

Commit

Permalink
Kconfig: Move CONFIG_FIT and related options to Kconfig
Browse files Browse the repository at this point in the history
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: Simon Glass <[email protected]>
[trini: Add microblaze change, various configs/ re-applies]
Signed-off-by: Tom Rini <[email protected]>
  • Loading branch information
sjg20 authored and trini committed Mar 14, 2016
1 parent 69e173e commit 73223f0
Show file tree
Hide file tree
Showing 791 changed files with 1,679 additions and 708 deletions.
62 changes: 60 additions & 2 deletions Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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)"
Expand Down
39 changes: 3 additions & 36 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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([email protected]): Adjust this option to be positive,
and move it to Kconfig

- Standalone program support:
CONFIG_STANDALONE_LOAD_ADDR

Expand Down
1 change: 0 additions & 1 deletion arch/arm/include/asm/fsl_secure_boot.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions arch/microblaze/lib/bootm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 0 additions & 1 deletion arch/powerpc/include/asm/fsl_secure_boot.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions board/freescale/ls1043aqds/eth.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
1 change: 1 addition & 0 deletions board/freescale/ls1043ardb/ls1043ardb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions board/vscom/baltos/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
6 changes: 3 additions & 3 deletions cmd/disk.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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");
Expand All @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions common/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions common/bootm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions common/image-fdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion common/image-fit.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading

0 comments on commit 73223f0

Please sign in to comment.