diff --git a/conf/machine/pengwyn.conf b/conf/machine/pengwyn.conf index 68a50ec..fb71723 100644 --- a/conf/machine/pengwyn.conf +++ b/conf/machine/pengwyn.conf @@ -45,7 +45,7 @@ UBOOT_DTB_LOADADDRESS = "0x80F80000" UBOOT_SIGN_KEYDIR = "${PWD}/scle_keys" # keys name in keydir (eg. "dev.crt", "dev.key") UBOOT_SIGN_KEYNAME = "scle" -UBOOT_SIGN_ENABLE = "1" +UBOOT_SIGN_ENABLE = "0" # Localtion of the directory containing the RSA key and certificate used for signing bootloader SPL_SIGN_KEYDIR = "${PWD}/scle_keys" @@ -94,9 +94,9 @@ PREFERRED_PROVIDER_virtual/kernel ?= "linux-ti-staging" PREFERRED_VERSION_linux-ti-staging ?= "5.4%" #KERNEL_IMAGETYPE = "zImage" -KERNEL_IMAGETYPE = "uImage" -#KERNEL_CLASSES ?= " kernel-fitimage " -#KERNEL_IMAGETYPE = "fitImage" +#KERNEL_IMAGETYPE = "uImage" +KERNEL_CLASSES ?= " kernel-fitimage " +KERNEL_IMAGETYPE = "fitImage" # Not necessary => see devicetree recipe #KERNEL_DEVICETREE = "am335x-pengwyn.dtb" # Remove dtb from ti33x.inc @@ -122,7 +122,7 @@ PREFERRED_VERSION_dtb ?= "1.0%" MACHINE_FEATURES = "usbgadget usbhost vfat" -IMAGE_BOOT_FILES = "MLO u-boot.${UBOOT_SUFFIX} uEnv.txt uImage devicetree/am335x-pengwyn.dtb" -#IMAGE_BOOT_FILES = "MLO u-boot.${UBOOT_SUFFIX} uEnv.txt fitImage devicetree/am335x-pengwyn.dtb" +#IMAGE_BOOT_FILES = "MLO u-boot.${UBOOT_SUFFIX} uEnv.txt uImage devicetree/am335x-pengwyn.dtb" +IMAGE_BOOT_FILES = "MLO u-boot.${UBOOT_SUFFIX} uEnv.txt fitImage devicetree/am335x-pengwyn.dtb" RM_WORK_EXCLUDE += "u-boot-ti-staging linux-ti-staging" diff --git a/recipes-bsp/u-boot/files2/0020-debug.patch b/recipes-bsp/u-boot/files2/0020-debug.patch index 696589c..8862fe5 100644 --- a/recipes-bsp/u-boot/files2/0020-debug.patch +++ b/recipes-bsp/u-boot/files2/0020-debug.patch @@ -1,25 +1,3 @@ ---- a/drivers/core/device.c -+++ b/drivers/core/device.c -@@ -8,6 +8,8 @@ - * Pavel Herrmann - */ - -+#define DEBUG -+ - #include - #include - #include ---- a/drivers/mmc/mmc-uclass.c -+++ b/drivers/mmc/mmc-uclass.c -@@ -5,6 +5,8 @@ - * Written by Simon Glass - */ - -+#define DEBUG -+ - #define LOG_CATEGORY UCLASS_MMC - - #include --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -7,6 +7,8 @@ @@ -48,206 +26,6 @@ } m = mmc_get_mmc_dev(dev); ---- a/drivers/core/uclass.c -+++ b/drivers/core/uclass.c -@@ -6,6 +6,8 @@ - * Pavel Herrmann - */ - -+#define DEBUG -+ - #define LOG_CATEGORY LOGC_DM - - #include -@@ -57,6 +61,7 @@ static int uclass_add(enum uclass_id id, struct uclass **ucp) - struct uclass *uc; - int ret; - -+ log_debug("uclass_add, id: %d\n", id); - *ucp = NULL; - uc_drv = lists_uclass_lookup(id); - if (!uc_drv) { -@@ -69,14 +74,19 @@ static int uclass_add(enum uclass_id id, struct uclass **ucp) - */ - return -EPFNOSUPPORT; - } -+ log_debug("uclass_add, uclass_driver name: %s - id: %d\n", uc_drv->name, uc_drv->id); - uc = calloc(1, sizeof(*uc)); -- if (!uc) -+ if (!uc) { -+ log_debug("uclass_add, calloc failed\n"); - return -ENOMEM; -+ } - if (uc_drv->priv_auto) { - void *ptr; -+ log_debug("uclass_add, priv_auto\n"); - - ptr = calloc(1, uc_drv->priv_auto); - if (!ptr) { -+ log_debug("uclass_add, priv_auto calloc failed\n"); - ret = -ENOMEM; - goto fail_mem; - } -@@ -85,22 +95,28 @@ static int uclass_add(enum uclass_id id, struct uclass **ucp) - uc->uc_drv = uc_drv; - INIT_LIST_HEAD(&uc->sibling_node); - INIT_LIST_HEAD(&uc->dev_head); -+ log_debug("uclass_add, list_add\n"); - list_add(&uc->sibling_node, DM_UCLASS_ROOT_NON_CONST); - - if (uc_drv->init) { -+ log_debug("uclass_add, uc_drv->init exists ...\n"); - ret = uc_drv->init(uc); -- if (ret) -+ if (ret) { -+ log_debug("uclass_add, uc_drv->init() failed (%d)\n", ret); - goto fail; -+ } - } - - *ucp = uc; - -+ log_debug("uclass_add, ends ...\n"); - return 0; - fail: - if (uc_drv->priv_auto) { - free(uclass_get_priv(uc)); - uclass_set_priv(uc, NULL); - } -+ log_debug("uclass_add, destroy list ...\n"); - list_del(&uc->sibling_node); - fail_mem: - free(uc); -@@ -146,12 +162,14 @@ int uclass_get(enum uclass_id id, struct uclass **ucp) - { - struct uclass *uc; - -+ log_debug("uclass_get, id: %d\n", id); - /* Immediately fail if driver model is not set up */ - if (!gd->uclass_root) - return -EDEADLK; - *ucp = NULL; - uc = uclass_find(id); - if (!uc) { -+ log_debug("uclass_get, not find\n"); - if (CONFIG_IS_ENABLED(OF_PLATDATA_INST)) - return -ENOENT; - return uclass_add(id, ucp); -@@ -228,19 +246,26 @@ int uclass_find_device(enum uclass_id id, int index, struct udevice **devp) - int ret; - - *devp = NULL; -+ log_debug("uclass_find_device, id: %d, index: %d\n", id, index); - ret = uclass_get(id, &uc); -- if (ret) -+ if (ret) { -+ log_debug("uclass_find_device, ret: %d\n", ret); - return ret; -- if (list_empty(&uc->dev_head)) -+ } -+ if (list_empty(&uc->dev_head)) { -+ log_debug("uclass_find_device, list_empty - ENODEV\n"); - return -ENODEV; -+ } - - uclass_foreach_dev(dev, uc) { - if (!index--) { - *devp = dev; -+ log_debug("uclass_find_device, OK\n"); - return 0; - } - } - -+ log_debug("uclass_find_device, return ENODEV\n"); - return -ENODEV; - } - -@@ -335,7 +360,7 @@ int uclass_find_device_by_seq(enum uclass_id id, int seq, struct udevice **devp) - int ret; - - *devp = NULL; -- log_debug("%d\n", seq); -+ log_debug("uclass_find_device_by_seq, id : %d - seq: %d\n", id, seq); - if (seq == -1) - return -ENODEV; - ret = uclass_get(id, &uc); -@@ -483,6 +508,7 @@ int uclass_get_device(enum uclass_id id, int index, struct udevice **devp) - int ret; - - *devp = NULL; -+ log_debug("uclass_get_device, id: %d, index: %d\n", id, index); - ret = uclass_find_device(id, index, &dev); - return uclass_get_device_tail(dev, ret, devp); - } -@@ -504,6 +530,7 @@ int uclass_get_device_by_seq(enum uclass_id id, int seq, struct udevice **devp) - int ret; - - *devp = NULL; -+ log_debug("uclass_get_device_by_seq, id: %d, seq: %d\n", id, seq); - ret = uclass_find_device_by_seq(id, seq, &dev); - - return uclass_get_device_tail(dev, ret, devp); ---- a/drivers/core/root.c -+++ b/drivers/core/root.c -@@ -6,6 +6,8 @@ - * Pavel Herrmann - */ - -+#define DEBUG -+ - #define LOG_CATEGORY UCLASS_ROOT - - #include -@@ -170,6 +172,7 @@ int dm_init(bool of_live) - { - int ret; - -+ log_debug("dm_init\n"); - if (gd->dm_root) { - dm_warn("Virtual root driver already exists!\n"); - return -EINVAL; -@@ -207,6 +210,7 @@ int dm_init(bool of_live) - - INIT_LIST_HEAD((struct list_head *)&gd->dmtag_list); - -+ log_debug("dm_init ends\n"); - return 0; - } - -@@ -397,6 +401,7 @@ static int dm_scan(bool pre_reloc_only) - { - int ret; - -+ log_debug("dm_scan\n"); - ret = dm_scan_plat(pre_reloc_only); - if (ret) { - debug("dm_scan_plat() failed: %d\n", ret); -@@ -415,6 +420,7 @@ static int dm_scan(bool pre_reloc_only) - if (ret) - return ret; - -+ log_debug("dm_scan ends\n"); - return dm_probe_devices(gd->dm_root, pre_reloc_only); - } - -@@ -422,6 +428,7 @@ int dm_init_and_scan(bool pre_reloc_only) - { - int ret; - -+ log_debug("dm_init_and_scan\n"); - ret = dm_init(CONFIG_IS_ENABLED(OF_LIVE)); - if (ret) { - debug("dm_init() failed: %d\n", ret); -@@ -440,6 +447,7 @@ int dm_init_and_scan(bool pre_reloc_only) - return log_msg_ret("ev", ret); - } - -+ log_debug("dm_init_and_scan ends ...\n"); - return 0; - } - -diff --git a/common/spl/spl.c b/common/spl/spl.c -index 22d2a0621e..f77b238237 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -6,6 +6,8 @@ @@ -336,50 +114,44 @@ index 22d2a0621e..f77b238237 100644 #include #include #include -@@ -62,6 +64,7 @@ int spl_load_image_fat(struct spl_image_info *spl_image, +@@ -62,18 +64,22 @@ int spl_load_image_fat(struct spl_image_info *spl_image, int err; struct legacy_img_hdr *header; -+ debug("spl_register_fat_device ...\n"); ++ debug("spl: spl_register_fat_device ...\n"); err = spl_register_fat_device(block_dev, partition); if (err) goto end; -@@ -74,6 +77,7 @@ int spl_load_image_fat(struct spl_image_info *spl_image, + ++ debug("spl: spl_get_load_buffer ...\n"); + header = spl_get_load_buffer(-sizeof(*header), sizeof(*header)); + ++ debug("spl: file_fat_read ...\n"); + err = file_fat_read(filename, header, sizeof(struct legacy_img_hdr)); + if (err <= 0) + goto end; if (IS_ENABLED(CONFIG_SPL_LOAD_FIT_FULL) && image_get_magic(header) == FDT_MAGIC) { -+ debug("Load FIT Full ...\n"); ++ debug("spl: Load FIT Full ... filename: %s\n", filename); err = file_fat_read(filename, (void *)CONFIG_SYS_LOAD_ADDR, 0); if (err <= 0) goto end; -@@ -95,6 +99,7 @@ int spl_load_image_fat(struct spl_image_info *spl_image, +@@ -87,14 +93,16 @@ int spl_load_image_fat(struct spl_image_info *spl_image, + image_get_magic(header) == FDT_MAGIC) { + struct spl_load_info load; +- debug("Found FIT\n"); ++ debug("spl: Found FIT - filename: %s\n", filename); + load.read = spl_fit_read; + load.bl_len = 1; + load.filename = (void *)filename; + load.priv = NULL; + ++ debug("spl: spl_load_simple_fit ...\n"); return spl_load_simple_fit(spl_image, &load, 0, header); } else { + debug("spl_parse_image_header ...\n"); err = spl_parse_image_header(spl_image, bootdev, header); if (err) goto end; ---- a/arch/arm/mach-omap2/am33xx/board.c -+++ b/arch/arm/mach-omap2/am33xx/board.c -@@ -7,6 +7,8 @@ - * Copyright (C) 2011, Texas Instruments, Incorporated - http://www.ti.com/ - */ - -+#define DEBUG -+ - #include - #include - #include ---- a/lib/fdtdec.c -+++ b/lib/fdtdec.c -@@ -620,7 +620,8 @@ int fdtdec_prepare_fdt(void) - } - # endif - #endif -- return -1; -+ return 0; -+ //return -1; - } - return 0; - } diff --git a/recipes-bsp/u-boot/files2/board.c b/recipes-bsp/u-boot/files2/board.c index fa2f93a..2a302c8 100644 --- a/recipes-bsp/u-boot/files2/board.c +++ b/recipes-bsp/u-boot/files2/board.c @@ -264,3 +264,13 @@ U_BOOT_DRVINFO(am335x_mmc0) = { .plat = &am335x_mmc0_platdata, }; #endif + +#ifdef CONFIG_SPL_LOAD_FIT +int board_fit_config_name_match(const char *name) +{ + /* just empty function now - can't decide what to choose */ + printf("board fit config name: %s\n", name); + + return 0; +} +#endif diff --git a/recipes-bsp/u-boot/files2/pengwyn_defconfig b/recipes-bsp/u-boot/files2/pengwyn_defconfig index 9c40cbb..6ef7a40 100644 --- a/recipes-bsp/u-boot/files2/pengwyn_defconfig +++ b/recipes-bsp/u-boot/files2/pengwyn_defconfig @@ -139,3 +139,18 @@ CONFIG_SPL_OF_CONTROL=y CONFIG_OF_SPL_REMOVE_PROPS="" #CONFIG_SPL_OF_PLATDATA=y CONFIG_SPL_OF_TRANSLATE=y +### for verified boot ### +CONFIG_SPL_CRYPTO=y +CONFIG_RSA=y +CONFIG_SPL_RSA=y +CONFIG_SHA1=y +CONFIG_SHA256=y +CONFIG_SHA512=y +CONFIG_SPL_SHA1=y +CONFIG_SPL_SHA256=y +CONFIG_SPL_SHA512=y +#CONFIG_FIT_SIGNATURE=y +#CONFIG_FIT_SIGNATURE_MAX_SIZE=0x10000000 +#CONFIG_SPL_FIT_FULL_CHECK=y +#CONFIG_SPL_FIT_SIGNATURE=y +#CONFIG_SPL_FIT_SIGNATURE_MAX_SIZE=0x10000000