From 73a447079c19bc234f9012102b2d45b3cebbd49f Mon Sep 17 00:00:00 2001 From: Vincent BENOIT Date: Tue, 14 Mar 2023 16:44:25 +0000 Subject: [PATCH] =?UTF-8?q?ajout=20de=20patches=20pour=20essayer=20de=20co?= =?UTF-8?q?mpiler=20U-Boot=20avec=20SPL=5FOF=5FCONTROL=20(sans=20succ?= =?UTF-8?q?=C3=A8s)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- conf/machine/pengwyn.conf | 58 ++++++++++++++--- .../u-boot/files/0001-pengwyn-defconfig.patch | 2 +- .../files/0006-spl-load-fit-compile-err.patch | 28 ++++++++ .../u-boot/files/0010-log-compile-err.patch | 47 ++++++++++++++ .../files/0011-board-ti-spl-of-control.patch | 64 +++++++++++++++++++ .../u-boot/files/am335x-pengwyn-u-boot.dtsi | 25 ++++++++ recipes-bsp/u-boot/files/uEnv.txt | 10 +-- .../u-boot/u-boot-ti-staging_2020.07.bb | 5 ++ 8 files changed, 224 insertions(+), 15 deletions(-) create mode 100644 recipes-bsp/u-boot/files/0006-spl-load-fit-compile-err.patch create mode 100644 recipes-bsp/u-boot/files/0010-log-compile-err.patch create mode 100644 recipes-bsp/u-boot/files/0011-board-ti-spl-of-control.patch create mode 100644 recipes-bsp/u-boot/files/am335x-pengwyn-u-boot.dtsi diff --git a/conf/machine/pengwyn.conf b/conf/machine/pengwyn.conf index 85a8cb1..b69de14 100644 --- a/conf/machine/pengwyn.conf +++ b/conf/machine/pengwyn.conf @@ -6,18 +6,11 @@ require conf/machine/include/ti33x.inc IMAGE_CLASSES += "sdcard_image-pengwyn" -#IMAGE_FSTYPES += "ubifs ubi tar.bz2 jffs2 wic wic.bmap" #IMAGE_FSTYPES ?= "tar.bz2 ext4 wic wic.bmap" IMAGE_FSTYPES = "tar.bz2 ext4" -#WKS_FILE ?= "pengwyn.wks" #MACHINE_ESSENTIAL_EXTRA_RDEPENDS += "kernel-image kernel-devicetree" -MACHINE_ESSENTIAL_EXTRA_RDEPENDS += "kernel-image kernel-modules" -#do_image_wic[depends] += " \ -# mtools-native:do_populate_sysroot \ -# dosfstools-native:do_populate_sysroot \ -# virtual/bootloader:do_deploy \ -# virtual/dtb:do_deploy \ -#" +#MACHINE_ESSENTIAL_EXTRA_RDEPENDS += "kernel-image kernel-modules" +MACHINE_ESSENTIAL_EXTRA_RDEPENDS += "kernel-image" # A list of machine-dependent packages not essential for booting the image. # Thus, the build does not fail if the packages do not exist. @@ -39,11 +32,56 @@ EXTRA_IMAGEDEPENDS += "virtual/bootloader virtual/dtb" PREFERRED_PROVIDER_virtual/bootloader ?= "u-boot" PREFERRED_VERSION_u-boot ?= "u-boot-ti-staging_2020.07%" +# The file type for the Secondary Program Loader (SPL) SPL_BINARY = "MLO" UBOOT_SUFFIX = "img" UBOOT_MACHINE = "pengwyn_defconfig" UBOOT_ENTRYPOINT = "0x80008000" UBOOT_LOADADDRESS = "0x80008000" +UBOOT_DTB_LOADADDRESS = "0x80F80000" + +# Localtion of the directory containing the RSA key and certificate used for signing image +UBOOT_SIGN_KEYDIR = "${PWD}/scle_keys" +# keys name in keydir (eg. "dev.crt", "dev.key") +UBOOT_SIGN_KEYNAME = "scle" +UBOOT_SIGN_ENABLE = "1" + +# Localtion of the directory containing the RSA key and certificate used for signing bootloader +SPL_SIGN_KEYDIR = "${PWD}/scle_keys" +SPL_SIGN_KEYNAME = "scle" +SPL_SIGN_ENABLE = "0" + +########################################################## +# +# U-Boot FIT Image +# +########################################################## + +# Enable use of a U-Boot fitImage +UBOOT_FITIMAGE_ENABLE = "0" +# U-Boot fitImage Hash Algo +UBOOT_FIT_HASH_ALG = "sha256" +# U-Boot fitImage Signature Algo +UBOOT_FIT_SIGN_ALG = "rsa4096" +# Generate keys for signing U-Boot fitImage +UBOOT_FIT_GENERATE_KEYS = "0" +# Size of private keys in number of bits +UBOOT_FIT_SIGN_NUMBITS = "4096" + +########################################################## +# +# Kernel FIT Image +# +########################################################## + +# Decides whether to generate the keys for signing fitImage if they don’t already exist +FIT_GENERATE_KEYS = "1" +# Specifies the hash algorithm used in creating the FIT Image +FIT_HASH_ALG = "sha256" +# Specifies the signature algorithm used in creating the FIT Image +FIT_SIGN_ALG = "rsa4096" +# Size of private key in number of bits used in fitImage +FIT_SIGN_NUMBITS = "4096" ########################################################## # @@ -60,7 +98,9 @@ KERNEL_CLASSES ?= " kernel-fitimage " KERNEL_IMAGETYPE = "fitImage" # Not necessary => see devicetree recipe #KERNEL_DEVICETREE = "am335x-pengwyn.dtb" +# Remove dtb from ti33x.inc KERNEL_DEVICETREE:remove = " \ + am335x-evm.dtb \ am335x-evmsk.dtb \ am335x-icev2.dtb \ am335x-pocketbeagle.dtb am335x-bone.dtb am335x-boneblue.dtb \ diff --git a/recipes-bsp/u-boot/files/0001-pengwyn-defconfig.patch b/recipes-bsp/u-boot/files/0001-pengwyn-defconfig.patch index 75480a2..415f466 100644 --- a/recipes-bsp/u-boot/files/0001-pengwyn-defconfig.patch +++ b/recipes-bsp/u-boot/files/0001-pengwyn-defconfig.patch @@ -174,7 +174,7 @@ CONFIG_SPL_GPIO_SUPPORT=y CONFIG_SPL_LIBCOMMON_SUPPORT=y CONFIG_SPL_LIBGENERIC_SUPPORT=y -+CONFIG_SYS_MALLOC_F_LEN=0x1000 ++CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_ENV_SIZE=0x4000 +CONFIG_ENV_OFFSET=0x260000 +CONFIG_DM_GPIO=y diff --git a/recipes-bsp/u-boot/files/0006-spl-load-fit-compile-err.patch b/recipes-bsp/u-boot/files/0006-spl-load-fit-compile-err.patch new file mode 100644 index 0000000..cfa5961 --- /dev/null +++ b/recipes-bsp/u-boot/files/0006-spl-load-fit-compile-err.patch @@ -0,0 +1,28 @@ +--- 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 +@@ -573,6 +575,16 @@ void board_init_f(ulong dummy) + + #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 */ ++ debug("%s: %s\n", __func__, name); ++ ++ return 0; ++} ++#endif ++ + int arch_cpu_init_dm(void) + { + hw_data_init(); diff --git a/recipes-bsp/u-boot/files/0010-log-compile-err.patch b/recipes-bsp/u-boot/files/0010-log-compile-err.patch new file mode 100644 index 0000000..f24715c --- /dev/null +++ b/recipes-bsp/u-boot/files/0010-log-compile-err.patch @@ -0,0 +1,47 @@ +--- a/common/spl/spl_mmc.c ++++ b/common/spl/spl_mmc.c +@@ -5,6 +5,9 @@ + * + * Aneesh V + */ ++ ++#define DEBUG ++ + #include + #include + #include +--- a/common/board_f.c ++++ b/common/board_f.c +@@ -9,6 +9,8 @@ + * Marius Groeger + */ + ++#define DEBUG ++ + #include + #include + #include +--- a/common/spl/spl.c ++++ b/common/spl/spl.c +@@ -6,6 +6,8 @@ + * Aneesh V + */ + ++#define DEBUG ++ + #include + #include + #include +@@ -715,10 +717,10 @@ void board_init_r(gd_t *dummy1, ulong dummy2) + default: + debug("Unsupported OS image.. Jumping nevertheless..\n"); + } +-#if CONFIG_VAL(SYS_MALLOC_F_LEN) && !defined(CONFIG_SYS_SPL_MALLOC_SIZE) ++//#if CONFIG_VAL(SYS_MALLOC_F_LEN) && !defined(CONFIG_SYS_SPL_MALLOC_SIZE) + debug("SPL malloc() used 0x%lx bytes (%ld KB)\n", gd->malloc_ptr, + gd->malloc_ptr / 1024); +-#endif ++//#endif + bootstage_mark_name(spl_phase() == PHASE_TPL ? BOOTSTAGE_ID_END_TPL : + BOOTSTAGE_ID_END_SPL, "end " SPL_TPL_NAME); + #ifdef CONFIG_BOOTSTAGE_STASH diff --git a/recipes-bsp/u-boot/files/0011-board-ti-spl-of-control.patch b/recipes-bsp/u-boot/files/0011-board-ti-spl-of-control.patch new file mode 100644 index 0000000..b67ae84 --- /dev/null +++ b/recipes-bsp/u-boot/files/0011-board-ti-spl-of-control.patch @@ -0,0 +1,64 @@ +--- a/board/ti/am335x/board.c ++++ b/board/ti/am335x/board.c +@@ -963,32 +963,32 @@ void board_fit_image_post_process(void **p_image, size_t *p_size) + } + #endif + +-#if !CONFIG_IS_ENABLED(OF_CONTROL) +-static const struct omap_hsmmc_plat am335x_mmc0_platdata = { +- .base_addr = (struct hsmmc *)OMAP_HSMMC1_BASE, +- .cfg.host_caps = MMC_MODE_HS_52MHz | MMC_MODE_HS | MMC_MODE_4BIT, +- .cfg.f_min = 400000, +- .cfg.f_max = 52000000, +- .cfg.voltages = MMC_VDD_32_33 | MMC_VDD_33_34 | MMC_VDD_165_195, +- .cfg.b_max = CONFIG_SYS_MMC_MAX_BLK_COUNT, +-}; +- +-U_BOOT_DEVICE(am335x_mmc0) = { +- .name = "omap_hsmmc", +- .platdata = &am335x_mmc0_platdata, +-}; +- +-static const struct omap_hsmmc_plat am335x_mmc1_platdata = { +- .base_addr = (struct hsmmc *)OMAP_HSMMC2_BASE, +- .cfg.host_caps = MMC_MODE_HS_52MHz | MMC_MODE_HS | MMC_MODE_8BIT, +- .cfg.f_min = 400000, +- .cfg.f_max = 52000000, +- .cfg.voltages = MMC_VDD_32_33 | MMC_VDD_33_34 | MMC_VDD_165_195, +- .cfg.b_max = CONFIG_SYS_MMC_MAX_BLK_COUNT, +-}; +- +-U_BOOT_DEVICE(am335x_mmc1) = { +- .name = "omap_hsmmc", +- .platdata = &am335x_mmc1_platdata, +-}; +-#endif ++//#if !CONFIG_IS_ENABLED(OF_CONTROL) ++//static const struct omap_hsmmc_plat am335x_mmc0_platdata = { ++// .base_addr = (struct hsmmc *)OMAP_HSMMC1_BASE, ++// .cfg.host_caps = MMC_MODE_HS_52MHz | MMC_MODE_HS | MMC_MODE_4BIT, ++// .cfg.f_min = 400000, ++// .cfg.f_max = 52000000, ++// .cfg.voltages = MMC_VDD_32_33 | MMC_VDD_33_34 | MMC_VDD_165_195, ++// .cfg.b_max = CONFIG_SYS_MMC_MAX_BLK_COUNT, ++//}; ++// ++//U_BOOT_DEVICE(am335x_mmc0) = { ++// .name = "omap_hsmmc", ++// .platdata = &am335x_mmc0_platdata, ++//}; ++// ++//static const struct omap_hsmmc_plat am335x_mmc1_platdata = { ++// .base_addr = (struct hsmmc *)OMAP_HSMMC2_BASE, ++// .cfg.host_caps = MMC_MODE_HS_52MHz | MMC_MODE_HS | MMC_MODE_8BIT, ++// .cfg.f_min = 400000, ++// .cfg.f_max = 52000000, ++// .cfg.voltages = MMC_VDD_32_33 | MMC_VDD_33_34 | MMC_VDD_165_195, ++// .cfg.b_max = CONFIG_SYS_MMC_MAX_BLK_COUNT, ++//}; ++// ++//U_BOOT_DEVICE(am335x_mmc1) = { ++// .name = "omap_hsmmc", ++// .platdata = &am335x_mmc1_platdata, ++//}; ++//#endif diff --git a/recipes-bsp/u-boot/files/am335x-pengwyn-u-boot.dtsi b/recipes-bsp/u-boot/files/am335x-pengwyn-u-boot.dtsi new file mode 100644 index 0000000..0a2676d --- /dev/null +++ b/recipes-bsp/u-boot/files/am335x-pengwyn-u-boot.dtsi @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include "am33xx-u-boot.dtsi" + +&am33xx_pinmux { + u-boot,dm-pre-reloc; +}; + +&uart0 { + u-boot,dm-pre-reloc; +}; + +&i2c0 { + u-boot,dm-pre-reloc; +}; + +&spi1 { + u-boot,dm-pre-reloc; +}; diff --git a/recipes-bsp/u-boot/files/uEnv.txt b/recipes-bsp/u-boot/files/uEnv.txt index c4f05de..ad6f087 100644 --- a/recipes-bsp/u-boot/files/uEnv.txt +++ b/recipes-bsp/u-boot/files/uEnv.txt @@ -7,7 +7,7 @@ bootcmd=run mmcboot;run nandboot; bootdelay=2 bootdir=/boot bootenv=uEnv.txt -bootfile=uImage +bootfile=fitImage bootpart=0:2 console=ttyS0,115200n8 cpu=armv7 @@ -16,7 +16,7 @@ ethaddr=00:18:30:fc:c0:35 fdtaddr=0x80F80000 fdtfile=am335x-pengwyn.dtb importbootenv=echo Importing environment from mmc ...; env import -t $loadaddr $filesize -loadaddr=0x80200000 +loadaddr=0x80600000 loadbootenv=fatload mmc ${mmcdev} ${loadaddr} ${bootenv} loadfdt=fatload mmc ${mmcdev} ${fdtaddr} ${fdtfile} loadimage=fatload mmc ${mmcdev} ${loadaddr} ${bootfile} @@ -41,8 +41,8 @@ partition=nand0,0 rootpath=/export/rootfs soc=am33xx static_ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}::off -stderr=ns16550_serial -stdin=ns16550_serial -stdout=ns16550_serial +stderr=serial@44e09000 +stdin=serial@44e09000 +stdout=serial@44e09000 vendor=silica ver=U-Boot 2020.07-g2f5fbb5b39 (Jul 06 2020 - 19:22:53 +0000) diff --git a/recipes-bsp/u-boot/u-boot-ti-staging_2020.07.bb b/recipes-bsp/u-boot/u-boot-ti-staging_2020.07.bb index 5b4e10c..af535d3 100644 --- a/recipes-bsp/u-boot/u-boot-ti-staging_2020.07.bb +++ b/recipes-bsp/u-boot/u-boot-ti-staging_2020.07.bb @@ -15,7 +15,11 @@ SRC_URI = " \ file://0003-pengwyn-add-dts-to-makefile.patch \ file://0004-redeclaration-compile-error.patch \ file://0005-activate-spi1-clk.patch \ + file://0006-spl-load-fit-compile-err.patch \ + file://0010-log-compile-err.patch \ + file://0011-board-ti-spl-of-control.patch \ file://am335x-pengwyn.dts \ + file://am335x-pengwyn-u-boot.dtsi \ file://uEnv.txt \ " @@ -29,6 +33,7 @@ S = "${WORKDIR}/git" do_configure:append() { install -d ${S}/arch/arm/dts install -m 0644 ${WORKDIR}/am335x-pengwyn.dts ${S}/arch/arm/dts + install -m 0644 ${WORKDIR}/am335x-pengwyn-u-boot.dtsi ${S}/arch/arm/dts } do_deploy:append() {