From patchwork Mon Sep 22 18:01:01 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 401 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758564149; bh=tWlOkqIL36GXIPrstES9oc6bpCsx07wxv1QyQtGCXO4=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=DluCKI/nXXXXZrBlvTZ8nd1CIIFIi3W7S6GK4sgJ7Q64cw2AlnsXu16jEaIpXj7E9 ZWQforWq8nYAlpqAr5Qa9zIfJaQB2qJ4UKC74m28Z5jBqRutnF1rk59pQ9IPaAUac4 0p2FQC31rekBDYNTVydAIXjTB7Jj6BE6QxVwXS2bMDNlT1DhQNL3PCD4GWzuHhB1Ti LMfrAthoeLm8F15tW49olsbmzBmn+jmxioRBn8KZnXb1cOg9BOoZLlrMDeSiQjPEf8 8HsJ5qvxHMosCIjH0kku7nb1S/hjEcyIlEnwThC3D2M10cDjPWvQ1ALzrjIrEGFC41 tKwmLKM+cpG4g== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 480365FE1A for ; Mon, 22 Sep 2025 12:02:29 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id O7_reOd-4lYn for ; Mon, 22 Sep 2025 12:02:29 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758564148; bh=tWlOkqIL36GXIPrstES9oc6bpCsx07wxv1QyQtGCXO4=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=efbmaS8/EqZwd0o20xNNReKMdDzEPZZPUS4siDM0HAIA42Jmj/a1LipEtV2sgXLaV rgCTPp5mvXk/mkieSOJvNnVNAzkDC4krf/PxQgYJB76bO+Q4ufHBmqEUpAwb9gkV4l xhn5jDAH3dSFTbpJOPP2C0L74fvjSq3Uige3SJkA1WLJvS0jkiIW++Zgil494J3XfD xcyOD2Ju4EVaZ98N4P4sJdIPY0iLe/9ezNqduQsVEeivzs3TYzAJr6Fzvs0wI+NkcI OSau4OTFpjai3NL7MXeIb6OccRgn8v8sZfIANYtKuJvcamvRq52+JgHbuH/ilD1AnX S5XIJCF1Yi1nw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 39EF667C52 for ; Mon, 22 Sep 2025 12:02:28 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758564145; bh=zrsLI9NYOQYLCJDyIPwIzw4cVWfBdI44AB9Pw4X7P+w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c5hyoNaI97V+0R5kcTQ6tlbnGtu59zWyStM82XdsekqQEubX+PRpXNK6gl2vVCE6D 5141Dkyc0of+PGH9RaLANpNpNjSN0DFgPgZekQGB0kB3ocFnefU1IO0OI6F2SxOofM SHX+kL9eN6mIatCeI+yyIWwqitv7Xg8725WqlSo+wIxBIVOOh2Msj1w+nEgPLrlif5 Z70kh7VWPzPiaBLj3YiOnkHvm7elgMYlNne7L4EgdvSEm3jdlGth2X304m9TiWs5zT qsVN7KNWv0V9sN7hABnaJMhI2U7YJM7Or+9Yu6u4UM37jXaYwwDS44aTXllU6JrmbT PSISxbqQM8IEw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 9C73F67B38; Mon, 22 Sep 2025 12:02:25 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id ic3ZCiG04JoB; Mon, 22 Sep 2025 12:02:25 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758564141; bh=2B9ejhXkrVS2FqjWE8CCLjp8Vlg/BRsLY5gxCxFXxoM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kqc8a8YlqON6ttgBVoDykrzZtCR69XGvTKAsyQ0MmavNyu7PY76HRjDql5XzjMbRt iwao+QsuIESByXVURIRinPchFwIk+REpsXXfIuZG2PHcPjUzUlxzbYU7giWzOrbJa4 6iocjCacXCVFm9hFtZCcihKFI1FN/JSnLMLjRe3QB6GqISnZaed2VyUG0kcEs6zXiu brTHJbzpllfU7H8YJJ7wNSH4whCr2MvNzW7XdWSJp4quNBFv98Ok8M/hNmJ3R7HiNs wG253cpDSHxRTyXJDjTkgFDRqxhxfd1npjV4/CVg04XzVzb80K0JYNLRoM9V8FVJUP 99n6323P3LNFg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 4E8475FE1A; Mon, 22 Sep 2025 12:02:21 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Mon, 22 Sep 2025 12:01:01 -0600 Message-ID: <20250922180116.3088502-18-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250922180116.3088502-1-sjg@u-boot.org> References: <20250922180116.3088502-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: TVELLVLGH2EHZKO7FBIXBM2ITD6WTFOE X-Message-ID-Hash: TVELLVLGH2EHZKO7FBIXBM2ITD6WTFOE X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt , Simon Glass X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 17/24] arm: Update boot_prep_linux() to return an error List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Rather than panicing, return the error so that the top-level bootm logic can decide what to do. Signed-off-by: Simon Glass --- arch/arm/lib/bootm.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c index 02ff8beaeab..7c650c3ab67 100644 --- a/arch/arm/lib/bootm.c +++ b/arch/arm/lib/bootm.c @@ -164,14 +164,15 @@ static void do_nonsec_virt_switch(void) __weak void board_prep_linux(struct bootm_headers *images) { } /* Subcommand: PREP */ -static void boot_prep_linux(struct bootm_headers *images) +static int boot_prep_linux(struct bootm_headers *images) { char *commandline = env_get("bootargs"); if (CONFIG_IS_ENABLED(OF_LIBFDT) && IS_ENABLED(CONFIG_LMB) && images->ft_len) { debug("using: FDT\n"); if (image_setup_linux(images)) { - panic("FDT creation failed!"); + log_err("FDT creation failed!"); + return -EINVAL; } } else if (BOOTM_ENABLE_TAGS) { debug("using: ATAGS\n"); @@ -207,6 +208,8 @@ static void boot_prep_linux(struct bootm_headers *images) } board_prep_linux(images); + + return 0; } __weak bool armv7_boot_nonsec_default(void) @@ -345,6 +348,7 @@ static void boot_jump_linux(struct bootm_headers *images, int flag) int do_bootm_linux(int flag, struct bootm_info *bmi) { struct bootm_headers *images = bmi->images; + int ret; log_debug("boot linux flag %x\n", flag); /* No need for those on ARM */ @@ -353,7 +357,9 @@ int do_bootm_linux(int flag, struct bootm_info *bmi) if (flag & BOOTM_STATE_OS_PREP) { log_debug("Preparing to boot Linux\n"); - boot_prep_linux(images); + ret = boot_prep_linux(images); + if (ret) + return ret; return 0; } @@ -364,7 +370,9 @@ int do_bootm_linux(int flag, struct bootm_info *bmi) } log_debug("No flags set: continuing to prepare and jump to Linux\n"); - boot_prep_linux(images); + ret = boot_prep_linux(images); + if (ret) + return ret; boot_jump_linux(images, flag); return 0; }