Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AF059C433F5 for ; Sat, 1 Jan 2022 18:46:02 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9E67E82F91; Sat, 1 Jan 2022 19:45:59 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=svenschwermer.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=svenschwermer.de header.i=@svenschwermer.de header.b="HdNqbIUb"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 70D0183022; Sat, 1 Jan 2022 19:45:58 +0100 (CET) Received: from mail.schwermer.no (mail.schwermer.no [49.12.228.226]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 8EC3A811B2 for ; Sat, 1 Jan 2022 19:45:55 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=svenschwermer.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sven@svenschwermer.de From: Sven Schwermer DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=svenschwermer.de; s=mail; t=1641062754; bh=OIcCseAQt6+KX9NLjN0WZSVwjQT4unovN9icEfhwDys=; h=From:To:Cc:Subject; b=HdNqbIUbYMRE0tq/J25GLBW4SgxnG+DfHenujLgfSH08bcW0krpzJjgnxtNBh4AKY JNuSO1nTZ7SA9Xt/koO5D6rX29FEqPGFSoZK0w5dQ3rmruknpOLfTDaOAZF+RDoIRz +m5eWtdgwy6aXKKzx46M7NTnaMBj+K5RjZ+g8i3WdN/RSBbcfGTZCQi01JCmedlAJX DO67w2U8kYF512w8HL+xtveqaldvkout3VmhrbYuLUqUcK7AIjjVi8/DIIV5bE0VqS jV+FbPkT3OSAlwJ0y3hIG1FWml4bXYepMR3fiyj/s753+eRLmW1DMK40PQUusxHnqG hbxndpEoizrdA== To: u-boot@lists.denx.de Cc: Sven Schwermer , Alexandru Gagniuc , Artem Lapkin , Ramon Fried , Simon Glass Subject: [PATCH v2 1/2] cmd: source: Use script from default config Date: Sat, 1 Jan 2022 19:45:39 +0100 Message-Id: <20220101184540.42491-1-sven@svenschwermer.de> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.38 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean When sourcing FIT images, source the script node from the "bootscr" property within the default configuration. If board_fit_config_name_match is overridden, this will determine the selected configuration rather than the default one. The old behaviour is inconsistent with the FIT image specification which does not mention a "default" property in the "/images" node. Signed-off-by: Sven Schwermer --- (no changes since v1) boot/Makefile | 8 ++------ cmd/source.c | 22 +++++++++++++--------- include/image.h | 1 + 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/boot/Makefile b/boot/Makefile index 2938c3f145..51181b10fc 100644 --- a/boot/Makefile +++ b/boot/Makefile @@ -24,14 +24,10 @@ obj-$(CONFIG_ANDROID_AB) += android_ab.o obj-$(CONFIG_ANDROID_BOOT_IMAGE) += image-android.o image-android-dt.o obj-$(CONFIG_$(SPL_TPL_)OF_LIBFDT) += image-fdt.o obj-$(CONFIG_$(SPL_TPL_)FIT_SIGNATURE) += fdt_region.o -obj-$(CONFIG_$(SPL_TPL_)FIT) += image-fit.o -obj-$(CONFIG_$(SPL_)MULTI_DTB_FIT) += boot_fit.o common_fit.o +obj-$(CONFIG_$(SPL_TPL_)FIT) += common_fit.o image-fit.o +obj-$(CONFIG_$(SPL_)MULTI_DTB_FIT) += boot_fit.o obj-$(CONFIG_$(SPL_TPL_)IMAGE_SIGN_INFO) += image-sig.o obj-$(CONFIG_$(SPL_TPL_)FIT_SIGNATURE) += image-fit-sig.o obj-$(CONFIG_$(SPL_TPL_)FIT_CIPHER) += image-cipher.o obj-$(CONFIG_CMD_ADTIMG) += image-android-dt.o - -ifdef CONFIG_SPL_BUILD -obj-$(CONFIG_SPL_LOAD_FIT) += common_fit.o -endif diff --git a/cmd/source.c b/cmd/source.c index 81e015b64e..b78cac7d5c 100644 --- a/cmd/source.c +++ b/cmd/source.c @@ -26,19 +26,23 @@ #if defined(CONFIG_FIT) /** - * get_default_image() - Return default property from /images + * get_default_bootscr() - Return default boot script unit name. * - * Return: Pointer to value of default property (or NULL) + * The default configuration is used unless board_fit_config_name_match + * is overridden. + * + * Return: Pointer to value of bootscr property (or NULL) */ -static const char *get_default_image(const void *fit) +static const char *get_default_bootscr(const void *fit) { - int images_noffset; + int noffset; - images_noffset = fdt_path_offset(fit, FIT_IMAGES_PATH); - if (images_noffset < 0) + /* get default or board-specific configuration node */ + noffset = fit_find_config_node(fit); + if (noffset < 0) return NULL; - return fdt_getprop(fit, images_noffset, FIT_DEFAULT_PROP, NULL); + return fdt_getprop(fit, noffset, FIT_BOOTSCR_PROP, NULL); } #endif @@ -113,7 +117,7 @@ int image_source_script(ulong addr, const char *fit_uname) } if (!fit_uname) - fit_uname = get_default_image(fit_hdr); + fit_uname = get_default_bootscr(fit_hdr); if (!fit_uname) { puts("No FIT subimage unit name\n"); @@ -128,7 +132,7 @@ int image_source_script(ulong addr, const char *fit_uname) } if (!fit_image_check_type (fit_hdr, noffset, IH_TYPE_SCRIPT)) { - puts ("Not a image image\n"); + puts("Not a script image\n"); return 1; } diff --git a/include/image.h b/include/image.h index fd662e74b4..67c70952bd 100644 --- a/include/image.h +++ b/include/image.h @@ -936,6 +936,7 @@ int booti_setup(ulong image, ulong *relocated_addr, ulong *size, #define FIT_KERNEL_PROP "kernel" #define FIT_RAMDISK_PROP "ramdisk" #define FIT_FDT_PROP "fdt" +#define FIT_BOOTSCR_PROP "bootscr" #define FIT_LOADABLE_PROP "loadables" #define FIT_DEFAULT_PROP "default" #define FIT_SETUP_PROP "setup" -- 2.34.1