From patchwork Fri Apr 28 19:18:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1775120 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=FG1nxYyX; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q7MpZ26Bkz23td for ; Sat, 29 Apr 2023 05:18:46 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id BA2F88609D; Fri, 28 Apr 2023 21:18:41 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="FG1nxYyX"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EBBE585F8E; Fri, 28 Apr 2023 21:18:39 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-io1-xd32.google.com (mail-io1-xd32.google.com [IPv6:2607:f8b0:4864:20::d32]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 6651B85F64 for ; Fri, 28 Apr 2023 21:18:36 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd32.google.com with SMTP id ca18e2360f4ac-766692684e1so4171539f.3 for ; Fri, 28 Apr 2023 12:18:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1682709514; x=1685301514; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Ic+YKlYRCXXRbpguLQKteXWiFLvx7n9EG7QATI0anNI=; b=FG1nxYyXZlvWcDlrpP0GDL4uJq/V7p4Lv/gqXHqeJJ7rJhSMeuexHNFIN9JiDNUGy9 QlehEgCb19GO7fDk7vQrCAVkbeKSO2EpqzzNteuF00FeNw4jEgyykEFS6kOLgddneqlG xkAIpaA5Z61usbYl0fUj/Tprj9yuqo9ybgUXc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682709514; x=1685301514; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Ic+YKlYRCXXRbpguLQKteXWiFLvx7n9EG7QATI0anNI=; b=AHInTatN1nEd0vXaVNpQzo/NcpgcyZ6D0c6Q/LGIwM3THSOSfItWldjKTDMDPB1FNq mZYVvNoJ/10oCO7JhCQtT/rlCdZpPXwFUsBNiTLR/tpeFlsqNDiVkyjNMSAkO8RTeBsU r0Vc5rCNfyxOSyD1UzxGrszTQgMUbXwAVIO7Frgrn2Oq1AWI3w23do9E20Zq7tiX00/q nrM+W7TKwIbNb7CVeHX80oULNKCntTY5M0Vv3yM7iWi0gqxtPQyqeA1TbJGquTCZDJ41 QyUdthfD0g1S06sp13kmUAE7ZRK4ubJi6q11z35Ts0zrYQ200SiRFoWioE39WZJtSbDI bsbg== X-Gm-Message-State: AC+VfDzp5lPzZuZ9O4vuwNjyJVya/SC1AN16gL75XjDBB0Z6+1hsw37b HvOAdpC77k99wU+wvwN/BhRNf3GI24J4SKSkdBs= X-Google-Smtp-Source: ACHHUZ5L6EZekk7lheGX7y/CifHIoN5d9/Hwxm9YugkoRoCcYyYDyclgurlyYhPdwVrWDYpgGlL//g== X-Received: by 2002:a5e:c118:0:b0:763:5f38:6e3e with SMTP id v24-20020a5ec118000000b007635f386e3emr4532429iol.3.1682709514378; Fri, 28 Apr 2023 12:18:34 -0700 (PDT) Received: from kea.bld.corp.google.com ([2620:15c:183:200:9261:21dc:edb:e426]) by smtp.gmail.com with ESMTPSA id l12-20020a0566380d8c00b0041407c67451sm1698811jaj.165.2023.04.28.12.18.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Apr 2023 12:18:34 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass , Marek Vasut , Marek Vasut Subject: [PATCH 01/18] test: Restore test behaviour on failure Date: Fri, 28 Apr 2023 13:18:01 -0600 Message-ID: <20230428131814.1.I467c7141c281acaf64fde5b54dec482f990ccd3c@changeid> X-Mailer: git-send-email 2.40.1.495.gc816e09b53d-goog In-Reply-To: <20230428191819.3070393-1-sjg@chromium.org> References: <20230428191819.3070393-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.8 at phobos.denx.de X-Virus-Status: Clean A recent change makes test continue to run after failure. This results in a lot of useless output and may lead to a segfault. Fix this by adding back the 'return' statement. Fixes: fa847bb409d ("test: Wrap assert macros in ({ ... }) and fix") Signed-off-by: Simon Glass --- include/test/ut.h | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/include/test/ut.h b/include/test/ut.h index dddf9ad241f..ea6ee95d734 100644 --- a/include/test/ut.h +++ b/include/test/ut.h @@ -130,7 +130,7 @@ int ut_check_console_dump(struct unit_test_state *uts, int total_bytes); \ if (!(cond)) { \ ut_fail(uts, __FILE__, __LINE__, __func__, #cond); \ - __ret = CMD_RET_FAILURE; \ + return CMD_RET_FAILURE; \ } \ __ret; \ }) @@ -142,7 +142,7 @@ int ut_check_console_dump(struct unit_test_state *uts, int total_bytes); if (!(cond)) { \ ut_failf(uts, __FILE__, __LINE__, __func__, #cond, \ fmt, ##args); \ - __ret = CMD_RET_FAILURE; \ + return CMD_RET_FAILURE; \ } \ __ret; \ }) @@ -157,7 +157,7 @@ int ut_check_console_dump(struct unit_test_state *uts, int total_bytes); #expr1 " == " #expr2, \ "Expected %#x (%d), got %#x (%d)", \ _val1, _val1, _val2, _val2); \ - __ret = CMD_RET_FAILURE; \ + return CMD_RET_FAILURE; \ } \ __ret; \ }) @@ -175,7 +175,7 @@ int ut_check_console_dump(struct unit_test_state *uts, int total_bytes); (unsigned long long)_val1, \ (unsigned long long)_val2, \ (unsigned long long)_val2); \ - __ret = CMD_RET_FAILURE; \ + return CMD_RET_FAILURE; \ } \ __ret; \ }) @@ -189,7 +189,7 @@ int ut_check_console_dump(struct unit_test_state *uts, int total_bytes); ut_failf(uts, __FILE__, __LINE__, __func__, \ #expr1 " = " #expr2, \ "Expected \"%s\", got \"%s\"", _val1, _val2); \ - __ret = CMD_RET_FAILURE; \ + return CMD_RET_FAILURE; \ } \ __ret; \ }) @@ -208,7 +208,7 @@ int ut_check_console_dump(struct unit_test_state *uts, int total_bytes); #expr1 " = " #expr2, \ "Expected \"%.*s\", got \"%.*s\"", \ _len, _val1, _len, _val2); \ - __ret = CMD_RET_FAILURE; \ + return CMD_RET_FAILURE; \ } \ __ret; \ }) @@ -228,7 +228,7 @@ int ut_check_console_dump(struct unit_test_state *uts, int total_bytes); #expr1 " = " #expr2, \ "Expected \"%s\", got \"%s\"", \ __buf1, __buf2); \ - __ret = CMD_RET_FAILURE; \ + return CMD_RET_FAILURE; \ } \ __ret; \ }) @@ -242,7 +242,7 @@ int ut_check_console_dump(struct unit_test_state *uts, int total_bytes); ut_failf(uts, __FILE__, __LINE__, __func__, \ #expr1 " = " #expr2, \ "Expected %p, got %p", _val1, _val2); \ - __ret = CMD_RET_FAILURE; \ + return CMD_RET_FAILURE; \ } \ __ret; \ }) @@ -257,7 +257,7 @@ int ut_check_console_dump(struct unit_test_state *uts, int total_bytes); ut_failf(uts, __FILE__, __LINE__, __func__, \ #expr1 " = " #expr2, \ "Expected %lx, got %lx", _val1, _val2); \ - __ret = CMD_RET_FAILURE; \ + return CMD_RET_FAILURE; \ } \ __ret; \ }) @@ -271,7 +271,7 @@ int ut_check_console_dump(struct unit_test_state *uts, int total_bytes); ut_failf(uts, __FILE__, __LINE__, __func__, \ #expr " != NULL", \ "Expected NULL, got %p", _val); \ - __ret = CMD_RET_FAILURE; \ + return CMD_RET_FAILURE; \ } \ __ret; \ }) @@ -285,7 +285,7 @@ int ut_check_console_dump(struct unit_test_state *uts, int total_bytes); ut_failf(uts, __FILE__, __LINE__, __func__, \ #expr " = NULL", \ "Expected non-null, got NULL"); \ - __ret = CMD_RET_FAILURE; \ + return CMD_RET_FAILURE; \ } \ __ret; \ }) @@ -300,7 +300,7 @@ int ut_check_console_dump(struct unit_test_state *uts, int total_bytes); #expr " = NULL", \ "Expected pointer, got error %ld", \ PTR_ERR(_val)); \ - __ret = CMD_RET_FAILURE; \ + return CMD_RET_FAILURE; \ } \ __ret; \ }) @@ -316,7 +316,7 @@ int ut_check_console_dump(struct unit_test_state *uts, int total_bytes); ut_failf(uts, __FILE__, __LINE__, __func__, \ "console", "\nExpected '%s',\n got '%s'", \ uts->expect_str, uts->actual_str); \ - __ret = CMD_RET_FAILURE; \ + return CMD_RET_FAILURE; \ } \ __ret; \ }) @@ -329,7 +329,7 @@ int ut_check_console_dump(struct unit_test_state *uts, int total_bytes); ut_failf(uts, __FILE__, __LINE__, __func__, \ "console", "\nExpected '%s',\n got '%s'", \ uts->expect_str, uts->actual_str); \ - __ret = CMD_RET_FAILURE; \ + return CMD_RET_FAILURE; \ } \ __ret; \ }) @@ -341,7 +341,7 @@ int ut_check_console_dump(struct unit_test_state *uts, int total_bytes); if (ut_check_skipline(uts)) { \ ut_failf(uts, __FILE__, __LINE__, __func__, \ "console", "\nExpected a line, got end"); \ - __ret = CMD_RET_FAILURE; \ + return CMD_RET_FAILURE; \ } \ __ret; \ }) @@ -354,7 +354,7 @@ int ut_check_console_dump(struct unit_test_state *uts, int total_bytes); ut_failf(uts, __FILE__, __LINE__, __func__, \ "console", "\nExpected '%s',\n got to '%s'", \ uts->expect_str, uts->actual_str); \ - __ret = CMD_RET_FAILURE; \ + return CMD_RET_FAILURE; \ } \ __ret; \ }) @@ -367,7 +367,7 @@ int ut_check_console_dump(struct unit_test_state *uts, int total_bytes); ut_failf(uts, __FILE__, __LINE__, __func__, \ "console", "Expected no more output, got '%s'",\ uts->actual_str); \ - __ret = CMD_RET_FAILURE; \ + return CMD_RET_FAILURE; \ } \ __ret; \ }) @@ -381,7 +381,7 @@ int ut_check_console_dump(struct unit_test_state *uts, int total_bytes); "console", \ "Expected dump of length %x bytes, got '%s'", \ total_bytes, uts->actual_str); \ - __ret = CMD_RET_FAILURE; \ + return CMD_RET_FAILURE; \ } \ __ret; \ }) From patchwork Fri Apr 28 19:18:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1775125 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=D591W2km; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q7Mqt6LCyz23td for ; Sat, 29 Apr 2023 05:19:54 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4F23485FE8; Fri, 28 Apr 2023 21:19:01 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="D591W2km"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DF24386046; Fri, 28 Apr 2023 21:18:55 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-il1-x12f.google.com (mail-il1-x12f.google.com [IPv6:2607:f8b0:4864:20::12f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 723E185F85 for ; Fri, 28 Apr 2023 21:18:36 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x12f.google.com with SMTP id e9e14a558f8ab-32933a4af12so481335ab.3 for ; Fri, 28 Apr 2023 12:18:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1682709515; x=1685301515; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=MaHsLo/PuenHmpdAN89uAoe6YTeYYPoN9kI/VfwZg0s=; b=D591W2kmVFC5V7BmIYX4WimqA/7uCJug5hGf9j80iwHcSpCvXKy6Ls/X4J8q5rPmQG 8MiKHrGbZaag7prAO5tn7hSEpgmPXVZ0E+vqRX7i6Naw13LIylwyYfx+Sw0neUWGCsMe T/ykURSlgtvmKE+bnbLdag+//J0ez40zb8LBo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682709515; x=1685301515; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MaHsLo/PuenHmpdAN89uAoe6YTeYYPoN9kI/VfwZg0s=; b=IZjcluo8IECtEB6IAZNwLd9XNhjX0XHoyGl9ZGbmsrxKKPVzwCR+BB0C1hxTPTI4c/ kNQx2Gy+f+NPxpMQMld8T2G60faT9il9aY7Z5Re8q1uPRCUr6oQblgvMUiCFySxasmxi 9wHd4OGrdRWcNyZNuU9bGnIloJV2bGsrLMaXMthZGsuq5t+96M5gedE34gtuw+Azx9jX 2lJpFKLUsi9j13g/bhI6cWHiRbMC5ntZlw8jdeIY42epVN4rK+9tEto56aE0mI7XApCp e/dnH1PFh9mYoeq3zwA/SbA68hUkM+PJW1viDYgdZ8qvcUiiIn8PUMkVG2tvqEMLU9NL R74w== X-Gm-Message-State: AC+VfDwRdgoG0zu7PDjyBjujpSqm32JXy1aPlc1Zb8BzxsO0RvIWrXBr 2z2Qn/6Bpko5EQfiOoodbrMD9IfvNU6WR4oog6Y= X-Google-Smtp-Source: ACHHUZ6d/biF7Q51qDbds3GemHGl/a5Vcqh+5bdie6RrmUNymOWbphYptHDBp6GDIDNqtGH94HYslQ== X-Received: by 2002:a92:ddc8:0:b0:328:56f3:8a82 with SMTP id d8-20020a92ddc8000000b0032856f38a82mr4467032ilr.13.1682709515097; Fri, 28 Apr 2023 12:18:35 -0700 (PDT) Received: from kea.bld.corp.google.com ([2620:15c:183:200:9261:21dc:edb:e426]) by smtp.gmail.com with ESMTPSA id l12-20020a0566380d8c00b0041407c67451sm1698811jaj.165.2023.04.28.12.18.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Apr 2023 12:18:34 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass , Michal Suchanek , Stefan Roese Subject: [PATCH 02/18] test: Skip flat-tree tests if devicetree is not used Date: Fri, 28 Apr 2023 13:18:02 -0600 Message-ID: <20230428191819.3070393-2-sjg@chromium.org> X-Mailer: git-send-email 2.40.1.495.gc816e09b53d-goog In-Reply-To: <20230428191819.3070393-1-sjg@chromium.org> References: <20230428191819.3070393-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.8 at phobos.denx.de X-Virus-Status: Clean Many tests don't actually use the devicetree at all so there is no point in running the tests both with livetree and flat tree. Check for this and skip the flat tree test in that case. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- test/test-main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/test-main.c b/test/test-main.c index b3c30d92937..f770bdb81ea 100644 --- a/test/test-main.c +++ b/test/test-main.c @@ -476,7 +476,8 @@ static int ut_run_test_live_flat(struct unit_test_state *uts, * (for sandbox we handle this by copying the tree, but not for other * boards) */ - if (!(test->flags & UT_TESTF_LIVE_TREE) && + if ((test->flags & UT_TESTF_SCAN_FDT) && + !(test->flags & UT_TESTF_LIVE_TREE) && (CONFIG_IS_ENABLED(OFNODE_MULTI_TREE) || !(test->flags & UT_TESTF_OTHER_FDT)) && (!runs || ut_test_run_on_flattree(test)) && From patchwork Fri Apr 28 19:18:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1775121 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=ZVVna3Ox; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q7Mpx2GDlz23td for ; Sat, 29 Apr 2023 05:19:05 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id BDEC48603A; Fri, 28 Apr 2023 21:18:48 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="ZVVna3Ox"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 32B638609C; Fri, 28 Apr 2023 21:18:47 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_PASS, T_SCC_BODY_TEXT_LINE,T_SPF_HELO_TEMPERROR autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd2b.google.com (mail-io1-xd2b.google.com [IPv6:2607:f8b0:4864:20::d2b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 7BA0285FEF for ; Fri, 28 Apr 2023 21:18:38 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd2b.google.com with SMTP id ca18e2360f4ac-760f4dcfdf4so12182939f.2 for ; Fri, 28 Apr 2023 12:18:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1682709515; x=1685301515; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=q/sqWspxPk4FfXWrJrMoGHnaTZZgwHa0E4YjLpuomuc=; b=ZVVna3Ox1HG6tVpL5IprW4BpPeDQ2h4MdSCbOGDpVxSPOoDrjL3PbXWNrrq2qsUgif EWPohMuEYu4xK841kR6a7ddARz43kwZch9ybkeZSWsQEw76s/9WgIlfJBMwJd07lJdJy L0Szaj1bou3lQ0/OZcDXPizrHIXAUO/V8blD4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682709515; x=1685301515; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=q/sqWspxPk4FfXWrJrMoGHnaTZZgwHa0E4YjLpuomuc=; b=Zq+br5MAmYzaGoJtr+7c9HgPk3Mp/hfwfTPzeFXZ9KR5/v7CfNonSTRFS+l7q9yGDx r27btPutvvpEtI6vqxUM5W7fSPZ70bBwN12eR7JOZGrhb6+SJdKzSP+QgGud6BHMR0we FCXvOXw51RvoTaqkuaujj4mmxJvZd4207sEkGrXCOxPpwgktOxHbirRU82JInN2PGNJ2 MpqJi62rqwyE86t1Whgv4GW9SJHM9YcvpNPM3fwwuuh7S/iP2TKIsz2uudtxpxawKVyi JX1AbBuEcQ62f6UvFnk4oqrcAv04WYLqYcy0M5zRMXryHC02ZhM7R08k+C2uQdnjGe7b FOGg== X-Gm-Message-State: AC+VfDx2b1azcz1znVjOjSK0MoZe3lUnkA1nGD+5xG09SxICC53g/qJS 9CzisgZE3IOB4dgaknwiB/aeXauAYdIVFas2YoQ= X-Google-Smtp-Source: ACHHUZ7Z1K9alx5APxdrJFWteMlqhW13vl0xJNCtCg/ZIW1YVm/nSDlNjU/btufYlF8HyBM2/2rN0g== X-Received: by 2002:a6b:da03:0:b0:760:fa16:5ea8 with SMTP id x3-20020a6bda03000000b00760fa165ea8mr5099594iob.11.1682709515670; Fri, 28 Apr 2023 12:18:35 -0700 (PDT) Received: from kea.bld.corp.google.com ([2620:15c:183:200:9261:21dc:edb:e426]) by smtp.gmail.com with ESMTPSA id l12-20020a0566380d8c00b0041407c67451sm1698811jaj.165.2023.04.28.12.18.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Apr 2023 12:18:35 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass Subject: [PATCH 03/18] bootstd: Correct the name of the QEMU bootmeth Date: Fri, 28 Apr 2023 13:18:03 -0600 Message-ID: <20230428191819.3070393-3-sjg@chromium.org> X-Mailer: git-send-email 2.40.1.495.gc816e09b53d-goog In-Reply-To: <20230428191819.3070393-1-sjg@chromium.org> References: <20230428191819.3070393-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.8 at phobos.denx.de X-Virus-Status: Clean This does not relate to sandbox. Correct the name. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- boot/bootmeth_qfw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boot/bootmeth_qfw.c b/boot/bootmeth_qfw.c index a5f95d4d0c5..0af9999745f 100644 --- a/boot/bootmeth_qfw.c +++ b/boot/bootmeth_qfw.c @@ -76,7 +76,7 @@ static int qfw_bootmeth_bind(struct udevice *dev) { struct bootmeth_uc_plat *plat = dev_get_uclass_plat(dev); - plat->desc = "Sandbox boot for testing"; + plat->desc = "QEMU boot using firmware interface"; return 0; } From patchwork Fri Apr 28 19:18:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1775126 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=NIWp+BL/; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q7Mr9159Lz23tl for ; Sat, 29 Apr 2023 05:20:09 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 66B5B86068; Fri, 28 Apr 2023 21:19:05 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="NIWp+BL/"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1FB8686074; Fri, 28 Apr 2023 21:18:56 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-il1-x132.google.com (mail-il1-x132.google.com [IPv6:2607:f8b0:4864:20::132]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id F423785F8B for ; Fri, 28 Apr 2023 21:18:36 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x132.google.com with SMTP id e9e14a558f8ab-32ac0743030so651445ab.0 for ; Fri, 28 Apr 2023 12:18:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1682709516; x=1685301516; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CpVSCRIgFdm9OTdlnZn9Yz0/PCxvC596PSmmoz+HmcU=; b=NIWp+BL/xA0GvzDP2TyDmWeX1OqVVW+NvrJkBv1UYWE+oc7ccxDVt5UXD9yclrjePM +9ModdDf7cambDiKuw0DvhhaY7gtV+i3UZGJh2J+eQo+4/nuJ33P/Y3gHkewWfdVcc+E fvyCrh1vR2LJYj3w8ZzFOwM0O4OoGwC8quurA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682709516; x=1685301516; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CpVSCRIgFdm9OTdlnZn9Yz0/PCxvC596PSmmoz+HmcU=; b=WRZeBPsvbKJhJxiZx6ApdAAHuqO0TlTQpqTRsz/kW007ge2/IW+1okcHAQv322vqVb tzLwn3d/ak9LJ3p+yFdL4vyXV/vvoo46OAL0dUnVkP56rdvay48g5zRlMyeI83QSFC8e aKhkoO3TJgnLv6gzMd2NnJwwZ0ZYPCsJQcOmzigQ6kL/o0yVISAh2qUCgGVoLkJ9TXrg cLTcZGApzk7WfQJkFphxNlh8WZHy9VYBr/U4fOBHZCdrdjpa0LOEmcZng6PIxTDJ5zph KfFQm+2UXnLlWf3Bg5OZof/UBkiKkj/b3XPOpuLA+i3oLNKDALRN5wLlZ9WT/ubK9EJc BHOw== X-Gm-Message-State: AC+VfDx+CbTKuDRM6ldkJQC03juoqkehHV/UBmyMLopj9mf/SlllS7K/ La/2+5pQBHErpEl3Ki/HvU9+u/f/La/lidm6xZY= X-Google-Smtp-Source: ACHHUZ7J22ie5N93ldPdrgQDfxHPQJYkJV6F9tLMtVnQNacjWMAm60h6TR1TEAbAjv+QZJdd6d+SAA== X-Received: by 2002:a92:cf06:0:b0:32b:46b4:62 with SMTP id c6-20020a92cf06000000b0032b46b40062mr4483703ilo.6.1682709516478; Fri, 28 Apr 2023 12:18:36 -0700 (PDT) Received: from kea.bld.corp.google.com ([2620:15c:183:200:9261:21dc:edb:e426]) by smtp.gmail.com with ESMTPSA id l12-20020a0566380d8c00b0041407c67451sm1698811jaj.165.2023.04.28.12.18.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Apr 2023 12:18:36 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass , Jaehoon Chung , Joe Hershberger , Marek Vasut , Peng Fan , Ramon Fried Subject: [PATCH 04/18] bootstd: Use bootdev instead of bootdevice Date: Fri, 28 Apr 2023 13:18:04 -0600 Message-ID: <20230428191819.3070393-4-sjg@chromium.org> X-Mailer: git-send-email 2.40.1.495.gc816e09b53d-goog In-Reply-To: <20230428191819.3070393-1-sjg@chromium.org> References: <20230428191819.3070393-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.8 at phobos.denx.de X-Virus-Status: Clean It seems better to call this a 'bootdev' since this is name used in the documentation. The older 'Bootdevice' name is no-longer used and may cause confusion with the 'bootdevice' environment variable. Update throughout to use bootdev. Signed-off-by: Simon Glass --- boot/bootflow.c | 4 ++-- drivers/mmc/mmc_bootdev.c | 2 +- drivers/scsi/scsi_bootdev.c | 2 +- drivers/usb/host/usb_bootdev.c | 2 +- include/bootdev.h | 2 +- include/bootflow.h | 2 +- net/eth_bootdev.c | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/boot/bootflow.c b/boot/bootflow.c index 8f2cb876bb4..487552fa28c 100644 --- a/boot/bootflow.c +++ b/boot/bootflow.c @@ -315,14 +315,14 @@ static int bootflow_check(struct bootflow_iter *iter, struct bootflow *bflow) /* If we got a valid bootflow, return it */ if (!ret) { - log_debug("Bootdevice '%s' part %d method '%s': Found bootflow\n", + log_debug("Bootdev '%s' part %d method '%s': Found bootflow\n", dev->name, iter->part, iter->method->name); return 0; } /* Unless there is nothing more to try, move to the next device */ else if (ret != BF_NO_MORE_PARTS && ret != -ENOSYS) { - log_debug("Bootdevice '%s' part %d method '%s': Error %d\n", + log_debug("Bootdev '%s' part %d method '%s': Error %d\n", dev->name, iter->part, iter->method->name, ret); /* * For 'all' we return all bootflows, even diff --git a/drivers/mmc/mmc_bootdev.c b/drivers/mmc/mmc_bootdev.c index b57b8a62276..55ecead2ddf 100644 --- a/drivers/mmc/mmc_bootdev.c +++ b/drivers/mmc/mmc_bootdev.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0+ /* - * Bootdevice for MMC + * Bootdev for MMC * * Copyright 2021 Google LLC * Written by Simon Glass diff --git a/drivers/scsi/scsi_bootdev.c b/drivers/scsi/scsi_bootdev.c index 991013fe1ef..218221fa306 100644 --- a/drivers/scsi/scsi_bootdev.c +++ b/drivers/scsi/scsi_bootdev.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0+ /* - * Bootdevice for USB + * Bootdev for SCSI * * Copyright 2021 Google LLC * Written by Simon Glass diff --git a/drivers/usb/host/usb_bootdev.c b/drivers/usb/host/usb_bootdev.c index 32919f99286..95df99a6e5c 100644 --- a/drivers/usb/host/usb_bootdev.c +++ b/drivers/usb/host/usb_bootdev.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0+ /* - * Bootdevice for USB + * Bootdev for USB * * Copyright 2021 Google LLC * Written by Simon Glass diff --git a/include/bootdev.h b/include/bootdev.h index e72ef3650f7..1533adfe506 100644 --- a/include/bootdev.h +++ b/include/bootdev.h @@ -200,7 +200,7 @@ void bootdev_clear_bootflows(struct udevice *dev); * All fields in @bflow must be set up. Note that @bflow->dev is used to add the * bootflow to that device. * - * @dev: Bootdevice device to add to + * @dev: Bootdev device to add to * @bflow: Bootflow to add. Note that fields within bflow must be allocated * since this function takes over ownership of these. This functions makes * a copy of @bflow itself (without allocating its fields again), so the diff --git a/include/bootflow.h b/include/bootflow.h index f20f575030f..018d021b810 100644 --- a/include/bootflow.h +++ b/include/bootflow.h @@ -58,7 +58,7 @@ enum bootflow_flags_t { * * @bm_node: Points to siblings in the same bootdev * @glob_node: Points to siblings in the global list (all bootdev) - * @dev: Bootdevice device which produced this bootflow + * @dev: Bootdev device which produced this bootflow * @blk: Block device which contains this bootflow, NULL if this is a network * device or sandbox 'host' device * @part: Partition number (0 for whole device) diff --git a/net/eth_bootdev.c b/net/eth_bootdev.c index 13e5fcd3bdf..0896d4e8175 100644 --- a/net/eth_bootdev.c +++ b/net/eth_bootdev.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0+ /* - * Bootdevice for ethernet (uses PXE) + * Bootdev for ethernet (uses PXE) * * Copyright 2021 Google LLC * Written by Simon Glass From patchwork Fri Apr 28 19:18:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1775122 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=oQ60Aubh; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q7Mq75VWJz23td for ; Sat, 29 Apr 2023 05:19:15 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CA8A186177; Fri, 28 Apr 2023 21:18:49 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="oQ60Aubh"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 60E4F85FEF; Fri, 28 Apr 2023 21:18:47 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd2b.google.com (mail-io1-xd2b.google.com [IPv6:2607:f8b0:4864:20::d2b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 81F7B8602A for ; Fri, 28 Apr 2023 21:18:38 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd2b.google.com with SMTP id ca18e2360f4ac-7606d44604aso13686339f.1 for ; Fri, 28 Apr 2023 12:18:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1682709517; x=1685301517; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WJIYjdFhNwFcvRTroidusEikC9itVpZA2kosKpnBsPU=; b=oQ60AubhTBRaNLzvEzl9aPrwPP2HXlFpEkSLCDB439M0i9jpT/rFMLVarDUnLrwDRl gOA5ZOgjTodHsmc1qyhotDX4c/qdUM5BDC7g24qgiLQYILD4cgj2w8DgOfIsv/fkYd8S Pag4KLfeXB4NJjkIlE8dybguJMUsXcWGRaV74= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682709517; x=1685301517; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WJIYjdFhNwFcvRTroidusEikC9itVpZA2kosKpnBsPU=; b=DGs/n0VWEUAxr92Y3/jdKvih+u7EAYGtM4oC107JKk+DCjy6KR5L0ZIRohwoPWaSua YRhBa6B9uiOZhZgn3jg4EQpun/OK9Oivb/P5sptfpbQebdk34zSv61rbZRQC9GABvNUd LHcAzYzskErpXKEGi0slb7OYj8wfX8MaWamJuDZ0utX3FMGlWoXpGc0VMWsZ16dyrJbd fnI2vea5aHN8O+DOn2jMmNaVeFa9jcW+n5yHI1xxKYgHP9t9ERZQ4lVoJg6/KzeBPzdF 2sZtYAs1cI7416+SBVoz39vRW1oH3VRwHm8ZY8VkEEEP3PkUb0WSm9rlXUzMdG9vNSvY PeAA== X-Gm-Message-State: AC+VfDxyG+dlpSfkXNm8u8DlqlSkuDuNi+/J8AR5idC8ATXNQ+Myzo9m 7T7S5mwFTNDspnFwZ8YwbyKChvIu7Ql3MyrX3/c= X-Google-Smtp-Source: ACHHUZ6JkrzlzBajUAlGWApZnvvf73PIRhAs74IPV8RbHDjpTnY1Wmm7qITjEACSMum+TmRFu9NXPg== X-Received: by 2002:a6b:dd18:0:b0:74c:8c3c:b71 with SMTP id f24-20020a6bdd18000000b0074c8c3c0b71mr4483395ioc.12.1682709517099; Fri, 28 Apr 2023 12:18:37 -0700 (PDT) Received: from kea.bld.corp.google.com ([2620:15c:183:200:9261:21dc:edb:e426]) by smtp.gmail.com with ESMTPSA id l12-20020a0566380d8c00b0041407c67451sm1698811jaj.165.2023.04.28.12.18.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Apr 2023 12:18:36 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass Subject: [PATCH 05/18] bootstd: Correct baudrate typo Date: Fri, 28 Apr 2023 13:18:05 -0600 Message-ID: <20230428191819.3070393-5-sjg@chromium.org> X-Mailer: git-send-email 2.40.1.495.gc816e09b53d-goog In-Reply-To: <20230428191819.3070393-1-sjg@chromium.org> References: <20230428191819.3070393-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.8 at phobos.denx.de X-Virus-Status: Clean This is a copy error. Fix it. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- boot/bootmeth-uclass.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boot/bootmeth-uclass.c b/boot/bootmeth-uclass.c index 2aee1e0f0c5..139ab08c4ed 100644 --- a/boot/bootmeth-uclass.c +++ b/boot/bootmeth-uclass.c @@ -421,7 +421,7 @@ int bootmeth_common_read_file(struct udevice *dev, struct bootflow *bflow, /** * on_bootmeths() - Update the bootmeth order * - * This will check for a valid baudrate and only apply it if valid. + * This will check for a valid list of bootmeths and only apply it if valid. */ static int on_bootmeths(const char *name, const char *value, enum env_op op, int flags) From patchwork Fri Apr 28 19:18:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1775123 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=gQZ6Cmxx; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q7MqN5jJyz23td for ; Sat, 29 Apr 2023 05:19:28 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1148685FD2; Fri, 28 Apr 2023 21:18:55 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="gQZ6Cmxx"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D897F86176; Fri, 28 Apr 2023 21:18:49 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd34.google.com (mail-io1-xd34.google.com [IPv6:2607:f8b0:4864:20::d34]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 70F8E86044 for ; Fri, 28 Apr 2023 21:18:39 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd34.google.com with SMTP id ca18e2360f4ac-7606ce9bfdeso13963139f.0 for ; Fri, 28 Apr 2023 12:18:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1682709518; x=1685301518; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/15PsBc5vgvGd/xJLUUcJikjqHGNN+RtE76TuiHIiqA=; b=gQZ6CmxxO0ALd42tdaz/D519qexRQ4TrO6gGebyk/ena8mn/V/11sz9hmMM2kgwhLb 0IE5deIWjk6MzCmvAAfZVkPnv+ScvJsJfqmJ1KItWYJZpKdfLG4muRohZ7IPryGbkaR+ nNT4wkrZ1XzkeRIKcyaMh8Cr4Q+1iyabsm6Gc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682709518; x=1685301518; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/15PsBc5vgvGd/xJLUUcJikjqHGNN+RtE76TuiHIiqA=; b=bospn1B969vB4vtwNrDNYkRj+kj7QXtEfuTQ0bbr467T4TztwAhqnYqNiIQKkVybHm VEMFY7D73L1TBruZolR9gNWCcV/39vdir06qln9unZ94jhON8+T1yZK3P3UL5UzgeSVd c+PgMyNRrZMA0eRt1hJaVLHCEcVzAZzgBhvYHUOTw+PLAqvUuBwSiCngzecmxtj6PcOp 80MgKQajJs/tEcdQ+6RSY9KTKy1R39hQtPq34BOMst75O0As/5+RjXjrexlh1kRYtvke EK2A3PfVTa+sjRQJdQD3h/TPT7qOge32Glz5GAsjCuCUhr8VUSJHKQvMHvbgAPIoV2Im Qbaw== X-Gm-Message-State: AC+VfDxZa9SofMZMh8R2DSZglkn/zIHJSKC8u0Q24KzgrPLNfOgVVOeG +5BiFS+t+F+O79TUZ9M1S65zQyr7tip0hGcVbKY= X-Google-Smtp-Source: ACHHUZ6pJpgMFHSILgihobcoL1jH0zrYgLEsIK/Opt1Nwe3iRjebX/xUFx31/bITrJOVXjM+gwDuzQ== X-Received: by 2002:a6b:dc02:0:b0:760:ea3c:7ba4 with SMTP id s2-20020a6bdc02000000b00760ea3c7ba4mr4615638ioc.9.1682709517875; Fri, 28 Apr 2023 12:18:37 -0700 (PDT) Received: from kea.bld.corp.google.com ([2620:15c:183:200:9261:21dc:edb:e426]) by smtp.gmail.com with ESMTPSA id l12-20020a0566380d8c00b0041407c67451sm1698811jaj.165.2023.04.28.12.18.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Apr 2023 12:18:37 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass Subject: [PATCH 06/18] bootstd: Allow storing the OS command line in the bootflow Date: Fri, 28 Apr 2023 13:18:06 -0600 Message-ID: <20230428191819.3070393-6-sjg@chromium.org> X-Mailer: git-send-email 2.40.1.495.gc816e09b53d-goog In-Reply-To: <20230428191819.3070393-1-sjg@chromium.org> References: <20230428191819.3070393-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.8 at phobos.denx.de X-Virus-Status: Clean Some operating systems have a command line which can be adjusted before booting. Store this in the bootflow so it can be controlled within U-Boot. Fix up the example output while we are here, since there are a few new items. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- cmd/bootflow.c | 6 ++++++ doc/usage/cmd/bootflow.rst | 5 ++++- include/bootflow.h | 2 ++ test/boot/bootflow.c | 1 + 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/cmd/bootflow.c b/cmd/bootflow.c index aa06999e3db..59d1bdc25b7 100644 --- a/cmd/bootflow.c +++ b/cmd/bootflow.c @@ -324,6 +324,12 @@ static int do_bootflow_info(struct cmd_tbl *cmdtp, int flag, int argc, printf("Buffer: %lx\n", (ulong)map_to_sysmem(bflow->buf)); printf("Size: %x (%d bytes)\n", bflow->size, bflow->size); printf("OS: %s\n", bflow->os_name ? bflow->os_name : "(none)"); + printf("Cmdline: "); + if (bflow->cmdline) + puts(bflow->cmdline); + else + puts("(none)"); + putc('\n'); printf("Logo: %s\n", bflow->logo ? simple_xtoa((ulong)map_to_sysmem(bflow->logo)) : "(none)"); if (bflow->logo) { diff --git a/doc/usage/cmd/bootflow.rst b/doc/usage/cmd/bootflow.rst index cad09bbec9a..1e14fd05ad5 100644 --- a/doc/usage/cmd/bootflow.rst +++ b/doc/usage/cmd/bootflow.rst @@ -258,7 +258,6 @@ displayed and booted:: Name: mmc@7e202000.bootdev.part_2 Device: mmc@7e202000.bootdev Block dev: mmc@7e202000.blk - Sequence: 1 Method: distro State: ready Partition: 2 @@ -266,6 +265,10 @@ displayed and booted:: Filename: extlinux/extlinux.conf Buffer: 3db7ae88 Size: 232 (562 bytes) + OS: Fedora-Workstation-armhfp-31-1.9 (5.3.7-301.fc31.armv7hl) + Cmdline: (none) + Logo: (none) + FDT: Error: 0 U-Boot> bootflow boot ** Booting bootflow 'smsc95xx_eth.bootdev.0' diff --git a/include/bootflow.h b/include/bootflow.h index 018d021b810..e49f3a24864 100644 --- a/include/bootflow.h +++ b/include/bootflow.h @@ -81,6 +81,7 @@ enum bootflow_flags_t { * @fdt_size: Size of FDT file * @fdt_addr: Address of loaded fdt * @flags: Flags for the bootflow (see enum bootflow_flags_t) + * @cmdline: OS command line, or NULL it not known (allocated) */ struct bootflow { struct list_head bm_node; @@ -104,6 +105,7 @@ struct bootflow { int fdt_size; ulong fdt_addr; int flags; + char *cmdline; }; /** diff --git a/test/boot/bootflow.c b/test/boot/bootflow.c index fd0e1d62435..b9ac539107b 100644 --- a/test/boot/bootflow.c +++ b/test/boot/bootflow.c @@ -226,6 +226,7 @@ static int bootflow_cmd_info(struct unit_test_state *uts) ut_assert_nextlinen("Buffer: "); ut_assert_nextline("Size: 253 (595 bytes)"); ut_assert_nextline("OS: Fedora-Workstation-armhfp-31-1.9 (5.3.7-301.fc31.armv7hl)"); + ut_assert_nextline("Cmdline: (none)"); ut_assert_nextline("Logo: (none)"); ut_assert_nextline("FDT: "); ut_assert_nextline("Error: 0"); From patchwork Fri Apr 28 19:18:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1775138 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=YaVr2+hH; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q7N0Q50hXz23tl for ; Sat, 29 Apr 2023 05:27:18 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id DBBCB85E03; Fri, 28 Apr 2023 21:26:45 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="YaVr2+hH"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 850C885EE7; Fri, 28 Apr 2023 21:26:41 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-il1-x132.google.com (mail-il1-x132.google.com [IPv6:2607:f8b0:4864:20::132]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id E026485D94 for ; Fri, 28 Apr 2023 21:18:39 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x132.google.com with SMTP id e9e14a558f8ab-32f397b44dcso20672495ab.1 for ; Fri, 28 Apr 2023 12:18:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1682709518; x=1685301518; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UqtAZ61ymNRtPnUnElL7AJll6LciW3C0tz6jbL1RUBk=; b=YaVr2+hHZppwloCd2l3ukyeXHF9cabeSRZXaVNGZYRQJGoc/L6QDJPXcuXpg8eBWjY x8XSgBZDNGZFNZXXyQ9olJ0gswkgf2QM44F1h0voae1s/SVwM1DD7nOY6fwM6bBsbbsN A+Hhte6n8xF1ubidHWwRoY3Kddp6mBak/QnM0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682709518; x=1685301518; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UqtAZ61ymNRtPnUnElL7AJll6LciW3C0tz6jbL1RUBk=; b=jlbHbPZ2gZeaU8cb7oZEwkmoqkQIIpP4OMsuytAb79asSUgtsOnOe2G141G/uyvyjh suc06mVzmS3+SfQUStQJJ8GoS1SOHAuwV5TQ9xEsK6G9vo7ZXkXnSAbK+uBBZLySqwLY U0zCZ2bN2INda2+MCMJBo+9DCn+eKaSscK/AEAWptDDBOzqfuxjTVH0Qy14FLHIy1LmG SDeCp8CEiUiCifthShjBLQ1NcrsC/ftuYJPBOtmj8On5MWSK0JDnQ71v4wcIDi0Pm6/l Nolx76l3Gd5rzw07zCjaCtpGOQQkpU5R4x668Tt7JzqbOpttg77U+NOgU3FZXT9/0gxM kxug== X-Gm-Message-State: AC+VfDyHWvZ2lx41ZWyyr4W/TQtIoFRuseZ3pTvWveYn0fNQ64KO67Jf L3NaSnwos+w4MZQ6QRGOZcEa6CePzMDSZCeKrbM= X-Google-Smtp-Source: ACHHUZ7uu4sP8U4fBRKO0Cru9sw/iXFhIMbtY5nAYI8lPLnZVAHoIIbLOP9AHA911G/kY6LewN08qw== X-Received: by 2002:a05:6e02:c6a:b0:32f:828f:54a7 with SMTP id f10-20020a056e020c6a00b0032f828f54a7mr260292ilj.12.1682709518499; Fri, 28 Apr 2023 12:18:38 -0700 (PDT) Received: from kea.bld.corp.google.com ([2620:15c:183:200:9261:21dc:edb:e426]) by smtp.gmail.com with ESMTPSA id l12-20020a0566380d8c00b0041407c67451sm1698811jaj.165.2023.04.28.12.18.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Apr 2023 12:18:38 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass , Joe Hershberger , Wolfgang Denk Subject: [PATCH 07/18] bootstd: Use the bootargs env var for changing the cmdline Date: Fri, 28 Apr 2023 13:18:07 -0600 Message-ID: <20230428191819.3070393-7-sjg@chromium.org> X-Mailer: git-send-email 2.40.1.495.gc816e09b53d-goog In-Reply-To: <20230428191819.3070393-1-sjg@chromium.org> References: <20230428191819.3070393-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.8 at phobos.denx.de X-Virus-Status: Clean The "bootargs" environment variable is used to set the command-line arguments to pass to the OS. Use this same mechanism with bootstd as well. When the variable is updated, it is written to the current bootflow. When the current bootflow is updated, the environment variable is updated too. Signed-off-by: Simon Glass --- boot/bootflow.c | 59 ++++++++++++++++++++++++++++++++++++++++++ cmd/bootflow.c | 6 +++++ include/env_callback.h | 6 +++-- 3 files changed, 69 insertions(+), 2 deletions(-) diff --git a/boot/bootflow.c b/boot/bootflow.c index 487552fa28c..62b7f45ab27 100644 --- a/boot/bootflow.c +++ b/boot/bootflow.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -552,3 +553,61 @@ int bootflow_iter_check_system(const struct bootflow_iter *iter) return -ENOTSUPP; } + +/** + * bootflow_cmdline_set() - Set the command line for a bootflow + * + * @value: New command-line string + * Returns 0 if OK, -ENOENT if no current bootflow, -ENOMEM if out of memory + */ +int bootflow_cmdline_set(struct bootflow *bflow, const char *value) +{ + char *cmdline = NULL; + + if (value) { + cmdline = strdup(value); + if (!cmdline) + return -ENOMEM; + } + + free(bflow->cmdline); + bflow->cmdline = cmdline; + + return 0; +} + +#ifdef CONFIG_BOOTSTD_FULL +/** + * on_bootargs() - Update the cmdline of a bootflow + */ +static int on_bootargs(const char *name, const char *value, enum env_op op, + int flags) +{ + struct bootstd_priv *std; + struct bootflow *bflow; + int ret; + + ret = bootstd_get_priv(&std); + if (ret) + return 0; + bflow = std->cur_bootflow; + if (!bflow) + return 0; + + switch (op) { + case env_op_create: + case env_op_overwrite: + ret = bootflow_cmdline_set(bflow, value); + if (ret && ret != ENOENT) + return 1; + return 0; + case env_op_delete: + bootflow_cmdline_set(bflow, NULL); + fallthrough; + default: + return 0; + } +} +U_BOOT_ENV_CALLBACK(bootargs, on_bootargs); +#endif + diff --git a/cmd/bootflow.c b/cmd/bootflow.c index 59d1bdc25b7..b20d5893632 100644 --- a/cmd/bootflow.c +++ b/cmd/bootflow.c @@ -288,6 +288,12 @@ static int do_bootflow_select(struct cmd_tbl *cmdtp, int flag, int argc, return CMD_RET_FAILURE; } std->cur_bootflow = found; + if (IS_ENABLED(CONFIG_BOOTSTD_FULL)) { + if (env_set("bootargs", found->cmdline)) { + printf("Cannot set bootargs\n"); + return CMD_RET_FAILURE; + } + } return 0; } diff --git a/include/env_callback.h b/include/env_callback.h index a9a14f2a84a..23bc650c162 100644 --- a/include/env_callback.h +++ b/include/env_callback.h @@ -60,8 +60,10 @@ #define NET6_CALLBACKS #endif -#ifdef CONFIG_BOOTSTD -#define BOOTSTD_CALLBACK "bootmeths:bootmeths," +#ifdef CONFIG_BOOTSTD_FULL +#define BOOTSTD_CALLBACK \ + "bootmeths:bootmeths," \ + "bootargs:bootargs," #else #define BOOTSTD_CALLBACK #endif From patchwork Fri Apr 28 19:18:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1775124 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=fWdqThOb; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q7Mqd32pQz23td for ; Sat, 29 Apr 2023 05:19:41 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 248E885F8B; Fri, 28 Apr 2023 21:18:56 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="fWdqThOb"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 092CA85FD2; Fri, 28 Apr 2023 21:18:52 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x133.google.com (mail-il1-x133.google.com [IPv6:2607:f8b0:4864:20::133]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id BDDAB8606E for ; Fri, 28 Apr 2023 21:18:40 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x133.google.com with SMTP id e9e14a558f8ab-329465f10fbso216285ab.1 for ; Fri, 28 Apr 2023 12:18:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1682709519; x=1685301519; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TBRFCuycgxSH1LtjO0SgtHa7cyXQaXha82aKlm2Qtp8=; b=fWdqThObDvS0ZEpxruZUeQ/CS9osIx5y0tp0FcfcAZscchlZmp0i3bgWj8oDSUVSlC vz+jVvyKWxAIg86Rjf1KBax37gqyBviKC/TiLjIAyuj7r6SLL17rekiNPtWkZgI8D+7O JN1CCAZaK4Sbr/jjPgihgSmJj1Jjy8iGv85nQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682709519; x=1685301519; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TBRFCuycgxSH1LtjO0SgtHa7cyXQaXha82aKlm2Qtp8=; b=Qs8CiVTSXGv+1U9ukxU9jFFSt1Vud2YqvJJMgLFTJcuC5LhtxWPJcVmEercKkcyRPo Em8QorOB7mVTVfYQNYMBH48n2mzB6+/wSYS5JxeSPtD4eTE+cDpxpZKe/VQFp3E79Dj2 5YTwnoHxFUo1K4YsN8KqYYTi50QGwp2fsj56AHjMVr+c4n539ZQoOo3JvFB/GFMSpPSm g4zIcbvhzhYU+JdxDiO/PnXqHkwiKdSh6YRCmthTQCBspK7HVwNWwUxO+dfGrLzc4hnr Wy5KfzH5IMazdcQjz2KTmUnM9EVXf121QDZvjf12z709hsTtFvmkqfP04Tyj1Lg+ZbDJ J//w== X-Gm-Message-State: AC+VfDzjKCOSNIp9y1mkyK4jlHGlwlzxWvO0mtyzLidRfZxQcs0lL4em S4Q3EGMdkB8+LxR+Ly8bJHacBHFZqNyZY8uf3nU= X-Google-Smtp-Source: ACHHUZ69J3CE3L4ce2fkIAsfkOao0llqVUi8paZ51x+WY76vXQgEveHa8nQGqNuyCU4LGyHjE5xYYA== X-Received: by 2002:a5d:930a:0:b0:760:ee29:5103 with SMTP id l10-20020a5d930a000000b00760ee295103mr3668777ion.15.1682709519274; Fri, 28 Apr 2023 12:18:39 -0700 (PDT) Received: from kea.bld.corp.google.com ([2620:15c:183:200:9261:21dc:edb:e426]) by smtp.gmail.com with ESMTPSA id l12-20020a0566380d8c00b0041407c67451sm1698811jaj.165.2023.04.28.12.18.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Apr 2023 12:18:38 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass Subject: [PATCH 08/18] bootstd: Allow storing x86 setup information Date: Fri, 28 Apr 2023 13:18:08 -0600 Message-ID: <20230428191819.3070393-8-sjg@chromium.org> X-Mailer: git-send-email 2.40.1.495.gc816e09b53d-goog In-Reply-To: <20230428191819.3070393-1-sjg@chromium.org> References: <20230428191819.3070393-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.8 at phobos.denx.de X-Virus-Status: Clean On x86 boards Linux uses a block of binary data to provide information about the command line, memory map, etc. Provide a way to store this in the bootflow so it can be passed on to the OS. Signed-off-by: Simon Glass --- cmd/bootflow.c | 2 ++ include/bootflow.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/cmd/bootflow.c b/cmd/bootflow.c index b20d5893632..155c71f83c2 100644 --- a/cmd/bootflow.c +++ b/cmd/bootflow.c @@ -336,6 +336,8 @@ static int do_bootflow_info(struct cmd_tbl *cmdtp, int flag, int argc, else puts("(none)"); putc('\n'); + if (bflow->x86_setup) + printf("X86 setup: %p\n", bflow->x86_setup); printf("Logo: %s\n", bflow->logo ? simple_xtoa((ulong)map_to_sysmem(bflow->logo)) : "(none)"); if (bflow->logo) { diff --git a/include/bootflow.h b/include/bootflow.h index e49f3a24864..9baa8672083 100644 --- a/include/bootflow.h +++ b/include/bootflow.h @@ -82,6 +82,7 @@ enum bootflow_flags_t { * @fdt_addr: Address of loaded fdt * @flags: Flags for the bootflow (see enum bootflow_flags_t) * @cmdline: OS command line, or NULL it not known (allocated) + * @x86_setup: Pointer to x86 setup block inside @buf, NULL if not present */ struct bootflow { struct list_head bm_node; @@ -106,6 +107,7 @@ struct bootflow { ulong fdt_addr; int flags; char *cmdline; + char *x86_setup; }; /** From patchwork Fri Apr 28 19:18:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1775132 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=jizhXRdM; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q7Msq46h9z23tZ for ; Sat, 29 Apr 2023 05:21:35 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 57AF08639D; Fri, 28 Apr 2023 21:19:24 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="jizhXRdM"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A47E78603D; Fri, 28 Apr 2023 21:19:01 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd34.google.com (mail-io1-xd34.google.com [IPv6:2607:f8b0:4864:20::d34]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 54E428607F for ; Fri, 28 Apr 2023 21:18:41 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd34.google.com with SMTP id ca18e2360f4ac-76089de42e6so13066139f.0 for ; Fri, 28 Apr 2023 12:18:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1682709520; x=1685301520; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=nXWbt2Wx74GI14Fwc962g5A1jzFFwHaVsz1+aDDKh+U=; b=jizhXRdMZSSZ8R+lJeix29dD49avkp2lm0q36fkbefervVLUrVFgQks65XX6CEwLRX aBstEopVPCRO7uD+yzqdy9lwCVXQNdyTtkoTPJ5YAI6az9UOQb6Cp2inyrTWSl0nVxYc TIiyOSFsaDE68RLOa1iz/N37gb3n2jab1BStA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682709520; x=1685301520; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nXWbt2Wx74GI14Fwc962g5A1jzFFwHaVsz1+aDDKh+U=; b=NbjImbsmZjaXgqFLYIf8VuwFA32yQs/1dvV5yY3mgw2uoL9kCtYQ5RqpISOgU1msGL U1J4PZ2DNH0Q+nzs/m4/sq67cHLG1btLB6St+retLeoq0hlQO+HirMKw5fMhSQJioK+i LEfg65SQl6MHsZFUd6+O1WMbwljxgbkpAZBPVmIrsYAo+k2IHUpSe/zN9czJm8Yy8c/w q8K4u2KahKy1Sn4W+XYO/GHoh3H9Y+WV6fA17+l0nPXyKEL1LuNMdXwXuZ4RjXbdoPN9 KIjsPXzUoFZpZ150il7gFsCgP4yvIPEDqQve1Y4xdxyYr/rHHB3MUmW2J0LCfeJeDmY3 uFvg== X-Gm-Message-State: AC+VfDyEXI0Y9tltNK9W6IjQ4ax5AYVLDHJgFbjn85S4L20rzgEzjwFJ 7Ml8AFGW/XS7cLdtQi/m53dsAC5v4SuQaioWYJ8= X-Google-Smtp-Source: ACHHUZ4FIjDZTUmx286yNAgFlPfNQsfxzbi+UuxCMKqiS9jOdr6s73xSB2p7HGsCOFdttY1I+Et4Gg== X-Received: by 2002:a05:6602:420d:b0:763:5ead:f212 with SMTP id cb13-20020a056602420d00b007635eadf212mr3847152iob.21.1682709519955; Fri, 28 Apr 2023 12:18:39 -0700 (PDT) Received: from kea.bld.corp.google.com ([2620:15c:183:200:9261:21dc:edb:e426]) by smtp.gmail.com with ESMTPSA id l12-20020a0566380d8c00b0041407c67451sm1698811jaj.165.2023.04.28.12.18.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Apr 2023 12:18:39 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass Subject: [PATCH 09/18] bootstd: Work around missing partition 1 Date: Fri, 28 Apr 2023 13:18:09 -0600 Message-ID: <20230428191819.3070393-9-sjg@chromium.org> X-Mailer: git-send-email 2.40.1.495.gc816e09b53d-goog In-Reply-To: <20230428191819.3070393-1-sjg@chromium.org> References: <20230428191819.3070393-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.8 at phobos.denx.de X-Virus-Status: Clean If there is no partition numbered 1, we decide that there are no partitions at all. That may not be correct, since at least one Debian installed has just a single partition numbered 2. Continue searching up to partition 3, just in case. Signed-off-by: Simon Glass --- boot/bootdev-uclass.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/boot/bootdev-uclass.c b/boot/bootdev-uclass.c index 57d29446476..9660ff75676 100644 --- a/boot/bootdev-uclass.c +++ b/boot/bootdev-uclass.c @@ -154,8 +154,15 @@ int bootdev_find_in_blk(struct udevice *dev, struct udevice *blk, ret = -ESHUTDOWN; else bflow->state = BOOTFLOWST_MEDIA; - if (ret) + if (ret) { + /* allow partition 1 to be missing */ + if (iter->part == 1) { + iter->max_part = 3; + ret = -ENOENT; + } + return log_msg_ret("part", ret); + } /* * Currently we don't get the number of partitions, so just From patchwork Fri Apr 28 19:18:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1775127 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=LVXJpa2A; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q7MrS05mNz23tZ for ; Sat, 29 Apr 2023 05:20:23 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D75DF86176; Fri, 28 Apr 2023 21:19:06 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="LVXJpa2A"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 357A486191; Fri, 28 Apr 2023 21:18:57 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd2b.google.com (mail-io1-xd2b.google.com [IPv6:2607:f8b0:4864:20::d2b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 2B39A86075 for ; Fri, 28 Apr 2023 21:18:41 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd2b.google.com with SMTP id ca18e2360f4ac-760f4dcfdf4so12186439f.2 for ; Fri, 28 Apr 2023 12:18:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1682709520; x=1685301520; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=52oQXau/de6t6xmdWprjOmNmmc+9VaBjX6L8CksZqYw=; b=LVXJpa2AqdGWLSD/m4j6fqriW2cwz3FOAReCbowZkTRskspwMOvo5Ex66y3jJ4EH5U HvfYD8NfFWXYXMVs3HnLbvWe3NvWVzY/ATXgd/iZeH7id7l8957iPVvyOi58uGLdJvpL 6UrsanQqPwNWu88tWdhi3rKbmcVgRKnhUqkfs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682709520; x=1685301520; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=52oQXau/de6t6xmdWprjOmNmmc+9VaBjX6L8CksZqYw=; b=SUUOwL2kuZF1dzFFK9j75oPIBRbMYwrLqGYJ+6YXb3AN/fIMe4qOO6QsK1C7FWyQOs d7DfmSfIx4rZ4kDPJ4KMB7ttbC9P0njYIREulJFHtZQ4gorVwW7rmhn7TYmpQzjCf+vh t4fJQFTyKQiafduPLO1XcuN0U3X0+r6q/RuVYByZIWtNdD62hjwuOWluZCrT/9G6yOMw gubrzBYWWTaTEFNN4bklBaNkJ6+1Ptq6YPUB93lxjYrjv7optQcxkzr7EyrpwBq5coUH UQE85fZ1pGrrPdtl7JAg9uR8OBQbaKZkA0WxXjB5EHV6F77F7pjjXjAcDUoAId0wBFPj OMNQ== X-Gm-Message-State: AC+VfDyYvaUghtmHA5ai4b5oZJqvynTNVMQwKpwe3e8rtnjxXHcfvY15 3Yp1GbW69Eof1A+CeSmBDSnXIbSUisH36aVmCD4= X-Google-Smtp-Source: ACHHUZ7gLCV/SrT43bzccndT2sSqpv6YmmQwlI52M7GgqTvlHS+YMEr4evXBZFqRy4YANZJ/HKniyQ== X-Received: by 2002:a6b:fd05:0:b0:763:bb0e:ebdf with SMTP id c5-20020a6bfd05000000b00763bb0eebdfmr5369140ioi.0.1682709520646; Fri, 28 Apr 2023 12:18:40 -0700 (PDT) Received: from kea.bld.corp.google.com ([2620:15c:183:200:9261:21dc:edb:e426]) by smtp.gmail.com with ESMTPSA id l12-20020a0566380d8c00b0041407c67451sm1698811jaj.165.2023.04.28.12.18.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Apr 2023 12:18:40 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass , Jason Liu , Michal Simek , Ovidiu Panait Subject: [PATCH 10/18] bdinfo: Show information about the serial port Date: Fri, 28 Apr 2023 13:18:10 -0600 Message-ID: <20230428131814.10.Id05e096ed6874145d14d9ee428fc25c0611bd84f@changeid> X-Mailer: git-send-email 2.40.1.495.gc816e09b53d-goog In-Reply-To: <20230428191819.3070393-1-sjg@chromium.org> References: <20230428191819.3070393-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.8 at phobos.denx.de X-Virus-Status: Clean It is useful to see the detailed setting of the serial port, e.g. to allow setting up earlycon or console for Linux. Add this output to the 'bdinfo' command. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- cmd/bdinfo.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c index f709904c516..af68c06696a 100644 --- a/cmd/bdinfo.c +++ b/cmd/bdinfo.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -103,6 +104,25 @@ static void show_video_info(void) } } +static void print_serial(struct udevice *dev) +{ + struct serial_device_info info; + int ret; + + if (!dev || !IS_ENABLED(CONFIG_DM_SERIAL)) + return; + + ret = serial_getinfo(dev, &info); + if (ret) + return; + + bdinfo_print_num_l("serial addr", info.addr); + bdinfo_print_num_l(" width", info.reg_width); + bdinfo_print_num_l(" shift", info.reg_shift); + bdinfo_print_num_l(" offset", info.reg_offset); + bdinfo_print_num_l(" clock", info.clock); +} + int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { struct bd_info *bd = gd->bd; @@ -144,6 +164,7 @@ int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) if (IS_ENABLED(CONFIG_OF_REAL)) printf("devicetree = %s\n", fdtdec_get_srcname()); } + print_serial(gd->cur_serial_dev); arch_print_bdinfo(); From patchwork Fri Apr 28 19:18:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1775137 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=d9aEi6xb; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q7N080hw8z23tl for ; Sat, 29 Apr 2023 05:27:04 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 944AD85D94; Fri, 28 Apr 2023 21:26:41 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="d9aEi6xb"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8598185BF8; Fri, 28 Apr 2023 21:26:39 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x133.google.com (mail-il1-x133.google.com [IPv6:2607:f8b0:4864:20::133]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id F2A32860FC for ; Fri, 28 Apr 2023 21:18:42 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x133.google.com with SMTP id e9e14a558f8ab-32b437f4607so221485ab.1 for ; Fri, 28 Apr 2023 12:18:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1682709521; x=1685301521; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0GQ3xPhZfBKJ+L+yeclts9p/vdZXM7SRh5iDKvX3tKY=; b=d9aEi6xbzRPPvQ0qyrxZbthh8CManiEGv2OGyDSoSi27g79ch2r1t1TJBYJV33ezgW 6xXFuPkOfGJ7QLKyC55sTZi0yhAgKDnXwZ+Jb6GVjC9swT3eLTWRFHju8VJvxN54xtiI oOeylMs+NwJKMmmYG0qiM8ADYbMqcSjF6F7Z8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682709521; x=1685301521; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0GQ3xPhZfBKJ+L+yeclts9p/vdZXM7SRh5iDKvX3tKY=; b=MEKHfrEzot5mVR2RJY7YF5+3wmo+FZPguWp4TVDdXPQzmPM6Suz1B9EmFyJ/Tcg8CZ CF+kyrsktCwfRhTyC7tTe1NhtEBw5ybjWip4bISpFFpEXxhvrFQNcQ8a5/r/FNMVvU3l a846Yx3m+t20dY6FHQVKfpGXFE8Yr6M9+YBS2dHSEereqriMLN/UmNOYGw5kT8Hhk5Yc 3d+uHnW29X9i8Pb9XYHZ33RbrjKVPWsz5dDFo/RL5au1+t6S5INkq1XVgz5wOE5pcY+X DX+lKQ2llPAul3J4MgejMadt6k21OdwbR19sDZqmuWeECf7YjVasADbei6x7SwRS3RP2 N81Q== X-Gm-Message-State: AC+VfDxwEhnh07XarVAb3w4uynVJLbFUUqn0hlNe2qqNZhY7QN5P9QMl 5JhEiq5KTJVe9QleLJbo7cPvWat8lWR3snYY3xo= X-Google-Smtp-Source: ACHHUZ7ELGj9LOoqCq1CBlC64Vlhcf2u1qDmTGfz+KjaPznAioK6pMYxXzJjiseAbMDnFkYTXemI1g== X-Received: by 2002:a92:c042:0:b0:32a:798e:5e72 with SMTP id o2-20020a92c042000000b0032a798e5e72mr4094775ilf.25.1682709521318; Fri, 28 Apr 2023 12:18:41 -0700 (PDT) Received: from kea.bld.corp.google.com ([2620:15c:183:200:9261:21dc:edb:e426]) by smtp.gmail.com with ESMTPSA id l12-20020a0566380d8c00b0041407c67451sm1698811jaj.165.2023.04.28.12.18.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Apr 2023 12:18:41 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass Subject: [PATCH 11/18] bootstd: Add a function to update a command line Date: Fri, 28 Apr 2023 13:18:11 -0600 Message-ID: <20230428191819.3070393-10-sjg@chromium.org> X-Mailer: git-send-email 2.40.1.495.gc816e09b53d-goog In-Reply-To: <20230428191819.3070393-1-sjg@chromium.org> References: <20230428191819.3070393-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.8 at phobos.denx.de X-Virus-Status: Clean The Linux command line consists of a number of words with optional values. At present U-Boot allows this to be changed using the bootargs environment variable. But this is quite painful, since the command line can be very long. Add a function which can adjust a single field in the command line, so that it is easier to make changes before booting. Signed-off-by: Simon Glass --- boot/bootflow.c | 178 +++++++++++++++++++++++++++++++++++++++++++ include/bootflow.h | 40 ++++++++++ test/boot/bootflow.c | 154 +++++++++++++++++++++++++++++++++++++ 3 files changed, 372 insertions(+) diff --git a/boot/bootflow.c b/boot/bootflow.c index 62b7f45ab27..7e2442a9599 100644 --- a/boot/bootflow.c +++ b/boot/bootflow.c @@ -611,3 +611,181 @@ static int on_bootargs(const char *name, const char *value, enum env_op op, U_BOOT_ENV_CALLBACK(bootargs, on_bootargs); #endif +static int copy_in(char *buf, char *end, const char *arg, int len, + const char *new_val) +{ + char *to = buf; + + /* copy the arg name */ + if (to + len >= end) + return -E2BIG; + memcpy(to, arg, len); + to += len; + + if (new_val == BOOTFLOWCL_EMPTY) { + /* no value */ + } else { + bool need_quote = strchr(new_val, ' '); + len = strlen(new_val); + + /* need space for value, equals sign and maybe two quotes */ + if (to + 1 + 2 * need_quote + len >= end) + return -E2BIG; + *to++ = '='; + if (need_quote) + *to++ = '"'; + memcpy(to, new_val, len); + to += len; + if (need_quote) + *to++ = '"'; + } + + return to - buf; +} + +int cmdline_set_arg(char *buf, int maxlen, const char *cmdline, + const char *set_arg, const char *new_val, int *posp) +{ + bool found_arg = false; + const char *from; + char *to, *end; + int set_arg_len; + char empty = '\0'; + int ret; + + from = cmdline ?: ∅ + + /* check if the value has quotes inside */ + if (new_val && new_val != BOOTFLOWCL_EMPTY && strchr(new_val, '"')) + return -EBADF; + + set_arg_len = strlen(set_arg); + for (to = buf, end = buf + maxlen; *from;) { + const char *val, *arg_end, *val_end, *p; + bool in_quote; + + if (to >= end) + return -E2BIG; + while (*from == ' ') + from++; + if (!*from) + break; + + /* find the end of this arg */ + val = NULL; + arg_end = NULL; + val_end = NULL; + in_quote = false; + for (p = from;; p++) { + if (in_quote) { + if (!*p) + return -EINVAL; + if (*p == '"') + in_quote = false; + continue; + } + if (*p == '=') { + arg_end = p; + val = p + 1; + } else if (*p == '"') { + in_quote = true; + } else if (!*p || *p == ' ') { + val_end = p; + if (!arg_end) + arg_end = p; + break; + } + } + /* + * At this point val_end points to the end of the value, or the + * last char after the arg name, if there is no label. + * arg_end is the char after the arg name + * val points to the value, or NULL if there is none + * char after the value. + * + * fred=1234 + * ^ ^^ ^ + * from || | + * / \ \ + * arg_end val val_end + */ + log_debug("from %s arg_end %ld val %ld val_end %ld\n", from, + (long)(arg_end - from), (long)(val - from), + (long)(val_end - from)); + + if (to != buf) { + if (to >= end) + return -E2BIG; + *to++ = ' '; + } + + /* if this is the target arg, update it */ + if (!strncmp(from, set_arg, arg_end - from)) { + if (!buf) { + bool has_quote = val_end[-1] == '"'; + + /* + * exclude any start/end quotes from + * calculations + */ + if (!val) + val = val_end; + *posp = val - cmdline + has_quote; + return val_end - val - 2 * has_quote; + } + found_arg = true; + if (!new_val) { + /* delete this arg */ + from = val_end + (*val_end == ' '); + log_debug("delete from: %s\n", from); + if (to != buf) + to--; /* drop the space we added */ + continue; + } + + ret = copy_in(to, end, from, arg_end - from, new_val); + if (ret < 0) + return ret; + to += ret; + + /* if not the target arg, copy it unchanged */ + } else if (to) { + int len; + + len = val_end - from; + if (to + len >= end) + return -E2BIG; + memcpy(to, from, len); + to += len; + } + from = val_end; + } + + /* If we didn't find the arg, add it */ + if (!found_arg) { + /* trying to delete something that is not there */ + if (!new_val || !buf) + return -ENOENT; + if (to >= end) + return -E2BIG; + + /* add a space to separate it from the previous arg */ + if (to != buf && to[-1] != ' ') + *to++ = ' '; + ret = copy_in(to, end, set_arg, set_arg_len, new_val); + log_debug("ret=%d, to: %s buf: %s\n", ret, to, buf); + if (ret < 0) + return ret; + to += ret; + } + + /* delete any trailing space */ + if (to > buf && to[-1] == ' ') + to--; + + if (to >= end) + return -E2BIG; + *to++ = '\0'; + + return to - buf; +} diff --git a/include/bootflow.h b/include/bootflow.h index 9baa8672083..1ec77f3bf8a 100644 --- a/include/bootflow.h +++ b/include/bootflow.h @@ -444,4 +444,44 @@ int bootflow_menu_apply_theme(struct expo *exp, ofnode node); int bootflow_menu_run(struct bootstd_priv *std, bool text_mode, struct bootflow **bflowp); +#define BOOTFLOWCL_EMPTY ((void *)1) + +/** + * cmdline_set_arg() - Update or read an argument in a cmdline string + * + * Handles updating a single arg in a cmdline string, returning it in a supplied + * buffer; also reading an arg from a cmdline string + * + * When updating, consecutive spaces are squashed as are spaces at the start and + * end. + * + * @buf: Working buffer to use (initial contents are ignored). Use NULL when + * reading + * @maxlen: Length of working buffer. Use 0 when reading + * @cmdline: Command line to update, in the form: + * + * fred mary= jane=123 john="has spaces" + * + * @set_arg: Argument to set or read (may or may not exist) + * @new_val: Value for the new argument. May not include quotes (") but may + * include embedded spaces, in which case it will be quoted when added to the + * command line. Use NULL to delete the argument from @cmdline, BOOTFLOWCL_EMPTY + * to set it to an empty value (no '=' sign after arg), "" to add an '=' sign + * but with an empty value. Use NULL when reading. + * @posp: Ignored when setting an argument; when getting an argument, returns + * the start position of its value in @cmdline, after the first quote, if any + * + * Return: + * For updating: + * length of new buffer (including \0 terminator) on success, -ENOENT if + * @new_val is NULL and @set_arg does not exist in @from, -EINVAL if a + * quoted arg-value in @from is not terminated with a quote, -EBADF if + * @new_val has spaces but does not start and end with quotes (or it has + * quotes in the middle of the string), -E2BIG if @maxlen is too small + * For reading: + * length of arg value (excluding quotes), -ENOENT if not found + */ +int cmdline_set_arg(char *buf, int maxlen, const char *cmdline, + const char *set_arg, const char *new_val, int *posp); + #endif diff --git a/test/boot/bootflow.c b/test/boot/bootflow.c index b9ac539107b..c42d86d916c 100644 --- a/test/boot/bootflow.c +++ b/test/boot/bootflow.c @@ -683,3 +683,157 @@ static int bootflow_menu_theme(struct unit_test_state *uts) return 0; } BOOTSTD_TEST(bootflow_menu_theme, UT_TESTF_DM | UT_TESTF_SCAN_FDT); + +/** + * check_arg() - Check both the normal case and the buffer-overflow case + * + * @uts: Unit-test state + * @expect_ret: Expected return value (i.e. buffer length) + * @expect_str: String expected to be returned + * @buf: Buffer to use + * @from: Original cmdline to update + * @arg: Argument to update (e.g. "console") + * @val: Value to set (e.g. "ttyS2") or NULL to delete the argument if present, + * "" to set it to an empty value (e.g. "console=") and BOOTFLOWCL_EMPTY to add + * it without any value ("initrd") + */ +static int check_arg(struct unit_test_state *uts, int expect_ret, + const char *expect_str, char *buf, const char *from, + const char *arg, const char *val) +{ + /* check for writing outside the reported bounds */ + buf[expect_ret] = '['; + ut_asserteq(expect_ret, + cmdline_set_arg(buf, expect_ret, from, arg, val, NULL)); + ut_asserteq_str(expect_str, buf); + ut_asserteq('[', buf[expect_ret]); + + /* do the test again but with one less byte in the buffer */ + ut_asserteq(-E2BIG, cmdline_set_arg(buf, expect_ret - 1, from, arg, + val, NULL)); + + return 0; +} + +/* Test of bootflow_cmdline_set_arg() */ +static int test_bootflow_cmdline_set(struct unit_test_state *uts) +{ + char buf[50]; + const int size = sizeof(buf); + + /* + * note that buffer-overflow tests are immediately each test case, just + * top keep the code together + */ + + /* add an arg that doesn't already exist, starting from empty */ + ut_asserteq(-ENOENT, cmdline_set_arg(buf, size, NULL, "me", NULL, + NULL)); + + ut_assertok(check_arg(uts, 3, "me", buf, NULL, "me", BOOTFLOWCL_EMPTY)); + ut_assertok(check_arg(uts, 4, "me=", buf, NULL, "me", "")); + ut_assertok(check_arg(uts, 8, "me=fred", buf, NULL, "me", "fred")); + + /* add an arg that doesn't already exist, starting from non-empty */ + ut_assertok(check_arg(uts, 11, "arg=123 me", buf, "arg=123", "me", + BOOTFLOWCL_EMPTY)); + ut_assertok(check_arg(uts, 12, "arg=123 me=", buf, "arg=123", "me", + "")); + ut_assertok(check_arg(uts, 16, "arg=123 me=fred", buf, "arg=123", "me", + "fred")); + + /* update an arg at the start */ + ut_assertok(check_arg(uts, 1, "", buf, "arg=123", "arg", NULL)); + ut_assertok(check_arg(uts, 4, "arg", buf, "arg=123", "arg", + BOOTFLOWCL_EMPTY)); + ut_assertok(check_arg(uts, 5, "arg=", buf, "arg=123", "arg", "")); + ut_assertok(check_arg(uts, 6, "arg=1", buf, "arg=123", "arg", "1")); + ut_assertok(check_arg(uts, 9, "arg=1234", buf, "arg=123", "arg", + "1234")); + + /* update an arg at the end */ + ut_assertok(check_arg(uts, 5, "mary", buf, "mary arg=123", "arg", + NULL)); + ut_assertok(check_arg(uts, 9, "mary arg", buf, "mary arg=123", "arg", + BOOTFLOWCL_EMPTY)); + ut_assertok(check_arg(uts, 10, "mary arg=", buf, "mary arg=123", "arg", + "")); + ut_assertok(check_arg(uts, 11, "mary arg=1", buf, "mary arg=123", "arg", + "1")); + ut_assertok(check_arg(uts, 14, "mary arg=1234", buf, "mary arg=123", + "arg", "1234")); + + /* update an arg in the middle */ + ut_assertok(check_arg(uts, 16, "mary=abc john=2", buf, + "mary=abc arg=123 john=2", "arg", NULL)); + ut_assertok(check_arg(uts, 20, "mary=abc arg john=2", buf, + "mary=abc arg=123 john=2", "arg", + BOOTFLOWCL_EMPTY)); + ut_assertok(check_arg(uts, 21, "mary=abc arg= john=2", buf, + "mary=abc arg=123 john=2", "arg", "")); + ut_assertok(check_arg(uts, 22, "mary=abc arg=1 john=2", buf, + "mary=abc arg=123 john=2", "arg", "1")); + ut_assertok(check_arg(uts, 25, "mary=abc arg=1234 john=2", buf, + "mary=abc arg=123 john=2", "arg", "1234")); + + /* handle existing args with quotes */ + ut_assertok(check_arg(uts, 16, "mary=\"abc\" john", buf, + "mary=\"abc\" arg=123 john", "arg", NULL)); + + /* handle existing args with quoted spaces */ + ut_assertok(check_arg(uts, 20, "mary=\"abc def\" john", buf, + "mary=\"abc def\" arg=123 john", "arg", NULL)); + + ut_assertok(check_arg(uts, 34, "mary=\"abc def\" arg=123 john def=4", + buf, "mary=\"abc def\" arg=123 john", "def", + "4")); + + /* quote at the start */ + ut_asserteq(-EBADF, cmdline_set_arg(buf, size, + "mary=\"abc def\" arg=\"123 456\"", + "arg", "\"4 5 6", NULL)); + + /* quote at the end */ + ut_asserteq(-EBADF, cmdline_set_arg(buf, size, + "mary=\"abc def\" arg=\"123 456\"", + "arg", "4 5 6\"", NULL)); + + /* quote in the middle */ + ut_asserteq(-EBADF, cmdline_set_arg(buf, size, + "mary=\"abc def\" arg=\"123 456\"", + "arg", "\"4 \"5 6\"", NULL)); + + /* handle updating a quoted arg */ + ut_assertok(check_arg(uts, 27, "mary=\"abc def\" arg=\"4 5 6\"", buf, + "mary=\"abc def\" arg=\"123 456\"", "arg", + "4 5 6")); + + /* changing a quoted arg to a non-quoted arg */ + ut_assertok(check_arg(uts, 23, "mary=\"abc def\" arg=789", buf, + "mary=\"abc def\" arg=\"123 456\"", "arg", + "789")); + + /* changing a non-quoted arg to a quoted arg */ + ut_assertok(check_arg(uts, 29, "mary=\"abc def\" arg=\"456 789\"", buf, + "mary=\"abc def\" arg=123", "arg", "456 789")); + + /* handling of spaces */ + ut_assertok(check_arg(uts, 8, "arg=123", buf, " ", "arg", "123")); + ut_assertok(check_arg(uts, 8, "arg=123", buf, " ", "arg", "123")); + ut_assertok(check_arg(uts, 13, "john arg=123", buf, " john ", "arg", + "123")); + ut_assertok(check_arg(uts, 13, "john arg=123", buf, " john arg=123 ", + "arg", "123")); + ut_assertok(check_arg(uts, 18, "john arg=123 mary", buf, + " john arg=123 mary ", "arg", "123")); + + /* unchanged arg */ + ut_assertok(check_arg(uts, 3, "me", buf, "me", "me", BOOTFLOWCL_EMPTY)); + + /* arg which starts with the same name */ + ut_assertok(check_arg(uts, 28, "mary=abc johnathon=2 john=3", buf, + "mary=abc johnathon=2 john=1", "john", "3")); + + return 0; +} +BOOTSTD_TEST(test_bootflow_cmdline_set, 0); From patchwork Fri Apr 28 19:18:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1775139 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=WHeMWUcs; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q7N0k39r2z23tl for ; Sat, 29 Apr 2023 05:27:34 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2190D85F8E; Fri, 28 Apr 2023 21:26:47 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="WHeMWUcs"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1BA3385F18; Fri, 28 Apr 2023 21:26:42 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd2b.google.com (mail-io1-xd2b.google.com [IPv6:2607:f8b0:4864:20::d2b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id B29C5860BB for ; Fri, 28 Apr 2023 21:18:42 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd2b.google.com with SMTP id ca18e2360f4ac-7606d44604aso13694239f.1 for ; Fri, 28 Apr 2023 12:18:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1682709522; x=1685301522; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=kF4MqtG7OmyovarQMfrm0M0T6qCWtrUYWVG8ka4AkFc=; b=WHeMWUcse94b53ZmrA+W6VadhZT6v3liQab0i919W3cAd5jk+vvd+QSXTKlibpr0/7 BJqehnUg5qCf4sbLuVha+rsy4IpaEtjDVdlGA2W35yfmF48pnDLXAx6i5LCHXSwXWFth rsAjFLLduPV078Ksyal6HSr7wi13q0EvybRfI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682709522; x=1685301522; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kF4MqtG7OmyovarQMfrm0M0T6qCWtrUYWVG8ka4AkFc=; b=fJf3cjjE1yynDsuCzJgxHBn9R5zZqdm605mBcYPCxDxK0taBSfyF5NSRKb/bBS2vLW Zxt80RFo+eTIatvhq8L4uGhR4S8ZzsuxzEpbGBPTNVgqalbXLvoy8DZKHyute/tX4HyX F3U+PIQN+twKZlgXqjsoX3mKElB2p+HQG0OfHG/5rC9qu1nQO/Y0ROEStui0IHhbI3H2 OXEJ4AAiblkvH7XzYPD59ZvrAwz9q8oSzOarPP1Ux+ssNx4bvxuR1TGPTOCvYGozA2xG uCvhDP4ywqeW58+Hd5YODUzMd2I8OI0KQwR45e6v6y9nmE4eK3GLQOXxpCZgkvd/4tyf nBvg== X-Gm-Message-State: AC+VfDy10Sp8hopWOxBOHRBNz70hEwF2+QgWRK5AoobY8MPa+75mkDoi HyNXArNkcKai7mPUReJs/Wv61oZvVxPcdatz/1Q= X-Google-Smtp-Source: ACHHUZ7vqnNq1qi7dgXpf98QUZwuUCseeJuKdxVoX0iz/9LT+Tugr2jb5hNa/PM+1KhCmKU5XuI+JA== X-Received: by 2002:a5d:8887:0:b0:763:5a8f:fe6 with SMTP id d7-20020a5d8887000000b007635a8f0fe6mr4609820ioo.21.1682709522056; Fri, 28 Apr 2023 12:18:42 -0700 (PDT) Received: from kea.bld.corp.google.com ([2620:15c:183:200:9261:21dc:edb:e426]) by smtp.gmail.com with ESMTPSA id l12-20020a0566380d8c00b0041407c67451sm1698811jaj.165.2023.04.28.12.18.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Apr 2023 12:18:41 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass Subject: [PATCH 12/18] bootstd: Add support for updating elements of the cmdline Date: Fri, 28 Apr 2023 13:18:12 -0600 Message-ID: <20230428131814.12.I290ecc06dd4227b5ad3cf5e8b9a2908be5758fb4@changeid> X-Mailer: git-send-email 2.40.1.495.gc816e09b53d-goog In-Reply-To: <20230428191819.3070393-1-sjg@chromium.org> References: <20230428191819.3070393-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.8 at phobos.denx.de X-Virus-Status: Clean Add a bootflow command to update the command line more easily. This allows changing a particular parameter rather than editing a very long strings. It is also easier to handle with scripting. The new 'bootflow cmdline' command allows getting and setting single parameters. Fix up the example output while we are here, since there are a few new items. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- boot/bootflow.c | 53 ++++++++++++++++++ cmd/bootflow.c | 57 ++++++++++++++++++- doc/usage/cmd/bootflow.rst | 22 +++++++- include/bootflow.h | 42 ++++++++++++++ test/boot/bootflow.c | 109 +++++++++++++++++++++++++++++++++++++ 5 files changed, 281 insertions(+), 2 deletions(-) diff --git a/boot/bootflow.c b/boot/bootflow.c index 7e2442a9599..dbf93701cfb 100644 --- a/boot/bootflow.c +++ b/boot/bootflow.c @@ -789,3 +789,56 @@ int cmdline_set_arg(char *buf, int maxlen, const char *cmdline, return to - buf; } + +int bootflow_cmdline_set_arg(struct bootflow *bflow, const char *set_arg, + const char *new_val, bool set_env) +{ + char buf[2048]; + char *cmd = NULL; + int ret; + + ret = cmdline_set_arg(buf, sizeof(buf), bflow->cmdline, set_arg, + new_val, NULL); + if (ret < 0) + return ret; + + ret = bootflow_cmdline_set(bflow, buf); + if (*buf) { + cmd = strdup(buf); + if (!cmd) + return -ENOMEM; + } + free(bflow->cmdline); + bflow->cmdline = cmd; + + if (set_env) { + ret = env_set("bootargs", bflow->cmdline); + if (ret) + return ret; + } + + return 0; +} + +int cmdline_get_arg(const char *cmdline, const char *arg, int *posp) +{ + int ret; + + ret = cmdline_set_arg(NULL, 1, cmdline, arg, NULL, posp); + + return ret; +} + +int bootflow_cmdline_get_arg(struct bootflow *bflow, const char *arg, + const char **val) +{ + int ret; + int pos; + + ret = cmdline_get_arg(bflow->cmdline, arg, &pos); + if (ret < 0) + return ret; + *val = bflow->cmdline + pos; + + return ret; +} diff --git a/cmd/bootflow.c b/cmd/bootflow.c index 155c71f83c2..dc54124621c 100644 --- a/cmd/bootflow.c +++ b/cmd/bootflow.c @@ -431,6 +431,59 @@ static int do_bootflow_menu(struct cmd_tbl *cmdtp, int flag, int argc, return 0; } + +static int do_bootflow_cmdline(struct cmd_tbl *cmdtp, int flag, int argc, + char *const argv[]) +{ + struct bootstd_priv *std; + struct bootflow *bflow; + const char *op, *arg, *val = NULL; + int ret; + + if (argc < 3) + return CMD_RET_USAGE; + + ret = bootstd_get_priv(&std); + if (ret) + return CMD_RET_FAILURE; + + bflow = std->cur_bootflow; + if (!bflow) { + printf("No bootflow selected\n"); + return CMD_RET_FAILURE; + } + + op = argv[1]; + arg = argv[2]; + if (*op == 's') { + if (argc < 4) + return CMD_RET_USAGE; + val = argv[3]; + } + + switch (*op) { + case 'c': /* clear */ + val = ""; + fallthrough; + case 's': /* set */ + case 'd': /* delete */ + ret = bootflow_cmdline_set_arg(bflow, arg, val, true); + break; + case 'g': /* get */ + ret = bootflow_cmdline_get_arg(bflow, arg, &val); + if (ret < 0) + printf("Cannot read arg (err %dE)\n", ret); + else + printf("%.*s\n", ret, val); + break; + } + if (ret < 0) { + printf("Operation failed\n"); + return CMD_RET_FAILURE; + } + + return 0; +} #endif /* CONFIG_CMD_BOOTFLOW_FULL */ #ifdef CONFIG_SYS_LONGHELP @@ -441,7 +494,8 @@ static char bootflow_help_text[] = "bootflow select [|] - select a bootflow\n" "bootflow info [-d] - show info on current bootflow (-d dump bootflow)\n" "bootflow boot - boot current bootflow (or first available if none selected)\n" - "bootflow menu [-t] - show a menu of available bootflows"; + "bootflow menu [-t] - show a menu of available bootflows\n" + "bootflow cmdline [set|get|clear|delete] [] - update cmdline"; #else "scan - boot first available bootflow\n"; #endif @@ -455,5 +509,6 @@ U_BOOT_CMD_WITH_SUBCMDS(bootflow, "Boot flows", bootflow_help_text, U_BOOT_SUBCMD_MKENT(info, 2, 1, do_bootflow_info), U_BOOT_SUBCMD_MKENT(boot, 1, 1, do_bootflow_boot), U_BOOT_SUBCMD_MKENT(menu, 2, 1, do_bootflow_menu), + U_BOOT_SUBCMD_MKENT(cmdline, 4, 1, do_bootflow_cmdline), #endif ); diff --git a/doc/usage/cmd/bootflow.rst b/doc/usage/cmd/bootflow.rst index 1e14fd05ad5..0dbbb4a327c 100644 --- a/doc/usage/cmd/bootflow.rst +++ b/doc/usage/cmd/bootflow.rst @@ -13,7 +13,7 @@ Synopis bootflow select [] bootflow info [-d] bootflow boot - + bootflow cmdline [set|get|clear|delete] [] Description ----------- @@ -198,6 +198,26 @@ bootflow boot This boots the current bootflow. +bootflow cmdline +~~~~~~~~~~~~~~~~ + +Some bootmeths can obtain the OS command line since it is stored with the OS. +In that case, you can use `bootflow cmdline` to adjust this. The command line +is assumed to be in the format used by Linux, i.e. a space-separated set of +parameters with optional values, e.g. "noinitrd console=/dev/tty0". + +To change or add a parameter, use:: + + bootflow cmdline set + +To clear a parameter value to empty you can use "" for the value, or use:: + + bootflow cmdline clear + +To delete a parameter entirely, use:: + + bootflow cmdline delete + Example ------- diff --git a/include/bootflow.h b/include/bootflow.h index 1ec77f3bf8a..af4b762dc5e 100644 --- a/include/bootflow.h +++ b/include/bootflow.h @@ -484,4 +484,46 @@ int bootflow_menu_run(struct bootstd_priv *std, bool text_mode, int cmdline_set_arg(char *buf, int maxlen, const char *cmdline, const char *set_arg, const char *new_val, int *posp); +/** + * bootflow_cmdline_set_arg() - Set a single argument for a bootflow + * + * Update the allocated cmdline and set the bootargs variable + * + * @bflow: Bootflow to update + * @arg: Argument to update (e.g. "console") + * @val: Value to set (e.g. "ttyS2") or NULL to delete the argument if present, + * "" to set it to an empty value (e.g. "console=") and BOOTFLOWCL_EMPTY to add + * it without any value ("initrd") + * @set_env: true to set the "bootargs" environment variable too + * + * Return: 0 if OK, -ENOMEM if out of memory + */ +int bootflow_cmdline_set_arg(struct bootflow *bflow, const char *arg, + const char *val, bool set_env); + +/** + * cmdline_get_arg() - Read an argument from a cmdline + * + * @cmdline: Command line to read, in the form: + * + * fred mary= jane=123 john="has spaces" + * @arg: Argument to read (may or may not exist) + * @posp: Returns position of argument (after any leading quote) if present + * Return: Length of argument value excluding quotes if found, -ENOENT if not + * found + */ +int cmdline_get_arg(const char *cmdline, const char *arg, int *posp); + +/** + * bootflow_cmdline_get_arg() - Read an argument from a cmdline + * + * @bootflow: Bootflow to read from + * @arg: Argument to read (may or may not exist) + * @valp: Returns a pointer to the argument (after any leading quote) if present + * Return: Length of argument value excluding quotes if found, -ENOENT if not + * found + */ +int bootflow_cmdline_get_arg(struct bootflow *bflow, const char *arg, + const char **val); + #endif diff --git a/test/boot/bootflow.c b/test/boot/bootflow.c index c42d86d916c..c494c0b8a0c 100644 --- a/test/boot/bootflow.c +++ b/test/boot/bootflow.c @@ -837,3 +837,112 @@ static int test_bootflow_cmdline_set(struct unit_test_state *uts) return 0; } BOOTSTD_TEST(test_bootflow_cmdline_set, 0); + +/* Test of bootflow_cmdline_set_arg() */ +static int bootflow_set_arg(struct unit_test_state *uts) +{ + struct bootflow s_bflow, *bflow = &s_bflow; + ulong mem_start; + + ut_assertok(env_set("bootargs", NULL)); + + mem_start = ut_check_delta(0); + + /* Do a simple sanity check. Rely on bootflow_cmdline() for the rest */ + bflow->cmdline = NULL; + ut_assertok(bootflow_cmdline_set_arg(bflow, "fred", "123", false)); + ut_asserteq_str(bflow->cmdline, "fred=123"); + + ut_assertok(bootflow_cmdline_set_arg(bflow, "mary", "and here", false)); + ut_asserteq_str(bflow->cmdline, "fred=123 mary=\"and here\""); + + ut_assertok(bootflow_cmdline_set_arg(bflow, "mary", NULL, false)); + ut_asserteq_str(bflow->cmdline, "fred=123"); + ut_assertok(bootflow_cmdline_set_arg(bflow, "fred", NULL, false)); + ut_asserteq_ptr(bflow->cmdline, NULL); + + ut_asserteq(0, ut_check_delta(mem_start)); + + ut_assertok(bootflow_cmdline_set_arg(bflow, "mary", "here", true)); + ut_asserteq_str("mary=here", env_get("bootargs")); + ut_assertok(env_set("bootargs", NULL)); + + return 0; +} +BOOTSTD_TEST(bootflow_set_arg, 0); + +/* Test of bootflow_cmdline_get_arg() */ +static int bootflow_cmdline_get(struct unit_test_state *uts) +{ + int pos; + + /* empty string */ + ut_asserteq(-ENOENT, cmdline_get_arg("", "fred", &pos)); + + /* arg with empty value */ + ut_asserteq(0, cmdline_get_arg("fred= mary", "fred", &pos)); + ut_asserteq(5, pos); + + /* arg with a value */ + ut_asserteq(2, cmdline_get_arg("fred=23", "fred", &pos)); + ut_asserteq(5, pos); + + /* arg with a value */ + ut_asserteq(3, cmdline_get_arg("mary=1 fred=234", "fred", &pos)); + ut_asserteq(12, pos); + + /* arg with a value, after quoted arg */ + ut_asserteq(3, cmdline_get_arg("mary=\"1 2\" fred=234", "fred", &pos)); + ut_asserteq(16, pos); + + /* arg in the middle */ + ut_asserteq(0, cmdline_get_arg("mary=\"1 2\" fred john=23", "fred", + &pos)); + ut_asserteq(15, pos); + + /* quoted arg */ + ut_asserteq(3, cmdline_get_arg("mary=\"1 2\" fred=\"3 4\" john=23", + "fred", &pos)); + ut_asserteq(17, pos); + + /* args starting with the same prefix */ + ut_asserteq(1, cmdline_get_arg("mary=abc johnathon=3 john=1", "john", + &pos)); + ut_asserteq(26, pos); + + return 0; +} +BOOTSTD_TEST(bootflow_cmdline_get, 0); + +static int bootflow_cmdline(struct unit_test_state *uts) +{ + ut_assertok(run_command("bootflow scan mmc", 0)); + ut_assertok(run_command("bootflow sel 0", 0)); + console_record_reset_enable(); + + ut_asserteq(1, run_command("bootflow cmdline get fred", 0)); + ut_assert_nextline("Cannot read arg (err -2: No such file or directory)"); + ut_assert_nextline("Operation failed"); + + ut_asserteq(0, run_command("bootflow cmdline set fred 123", 0)); + ut_asserteq(0, run_command("bootflow cmdline get fred", 0)); + ut_assert_nextline("123"); + + ut_asserteq(0, run_command("bootflow cmdline set mary abc", 0)); + ut_asserteq(0, run_command("bootflow cmdline get mary", 0)); + ut_assert_nextline("abc"); + + ut_asserteq(0, run_command("bootflow cmdline delete fred", 0)); + ut_asserteq(1, run_command("bootflow cmdline get fred", 0)); + ut_assert_nextline("Cannot read arg (err -2: No such file or directory)"); + ut_assert_nextline("Operation failed"); + + ut_asserteq(0, run_command("bootflow cmdline clear mary", 0)); + ut_asserteq(0, run_command("bootflow cmdline get mary", 0)); + ut_assert_nextline_empty(); + + ut_assert_console_end(); + + return 0; +} +BOOTSTD_TEST(bootflow_cmdline, 0); From patchwork Fri Apr 28 19:18:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1775136 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=M+gYauov; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q7Mzl2n8rz23tl for ; Sat, 29 Apr 2023 05:26:43 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id AA511858F1; Fri, 28 Apr 2023 21:26:40 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="M+gYauov"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 66002858F1; Fri, 28 Apr 2023 21:26:39 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd2e.google.com (mail-io1-xd2e.google.com [IPv6:2607:f8b0:4864:20::d2e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 47DEA8615E for ; Fri, 28 Apr 2023 21:18:44 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd2e.google.com with SMTP id ca18e2360f4ac-7606d6b3294so12721739f.2 for ; Fri, 28 Apr 2023 12:18:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1682709523; x=1685301523; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=zgxq5SRYiyfpMchnl5zPy+eu3K80BFOL2QE0U5EzjiM=; b=M+gYauovUR0qo5qxCnpX8snv16A3zAGCjrWYW+lxRgKheJG7q220z1K8X60mx7ox6t gj4b0hAxQHBRt2Z03cEzpm9hFe8ojKTJ8VWBuIULeu4JQfwE8HXMQiYzz97xcxa20wn0 cCmW0eSSWP997QWfm6OOhbkdwuAjV0+LhneRQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682709523; x=1685301523; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zgxq5SRYiyfpMchnl5zPy+eu3K80BFOL2QE0U5EzjiM=; b=j9SHcmD4WF+YiUjKj+Gt8b979SaBAkaaG3si32IWPE2WzoM5lbSA03VuXNq4cMrMo9 GDLbsNjq9HwmSxXxxSGJ9bM7aOSRoEjLW5qBC9VQeTkKv78DZJrbP++79Z4JIABHF5F2 p2RrTtZjesExKQmsBzGxC9QuX+PFtTRmIykgtDvfpTeA7mRzw1toFTmiPsBdlcr1eCDn Vkwh4i3Og4/ZAZ/QAP9MdSnxkVnfV4pAzi5M7ib69OkoBnLGnM2J02E4BrRhzZjq3eNz dIsGTJ2dm2pKOb6+lF8nPUTTJarPK3/MdXlmVIUFlh1hFcmFkwHvdqLSslR03KmHYEg+ JO8g== X-Gm-Message-State: AC+VfDw0HQcowUR+0LRygOSqC6ZHvD25KDuxXOvD16PoJmC5GhXeXP/g MDvYio/vpFBAdgEnaowoMYLINFvGkd/4zSYo+Pc= X-Google-Smtp-Source: ACHHUZ5/H7r+xFjwiTvXAjCQ2UorjsHmyBwXnoksckYRn8lCMQm6QD5BMb5vNTKV9+yn2i5C7xSdAg== X-Received: by 2002:a92:ce92:0:b0:32d:6163:596 with SMTP id r18-20020a92ce92000000b0032d61630596mr4309511ilo.20.1682709522738; Fri, 28 Apr 2023 12:18:42 -0700 (PDT) Received: from kea.bld.corp.google.com ([2620:15c:183:200:9261:21dc:edb:e426]) by smtp.gmail.com with ESMTPSA id l12-20020a0566380d8c00b0041407c67451sm1698811jaj.165.2023.04.28.12.18.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Apr 2023 12:18:42 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass Subject: [PATCH 13/18] bootstd: Support automatically setting Linux parameters Date: Fri, 28 Apr 2023 13:18:13 -0600 Message-ID: <20230428131814.13.I940170ebbcbc538efea78f7d0b75226ddfba809f@changeid> X-Mailer: git-send-email 2.40.1.495.gc816e09b53d-goog In-Reply-To: <20230428191819.3070393-1-sjg@chromium.org> References: <20230428191819.3070393-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.8 at phobos.denx.de X-Virus-Status: Clean Some Linux parameters can be set automatically by U-Boot, if it knows the device being used. For example, since U-Boot knows the serial console being used, it can add parameters for earlycon and console. Add support for this. Note that this is an experimental feature and we will see how useful it turns out to be. It is very handy for ChromeOS, since otherwise it is very difficult to manually determine the UART address or port number, particularly in a script. Provide an example of how this is used with ChromeOS. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- boot/bootflow.c | 33 +++++++++++++++++ cmd/bootflow.c | 5 ++- doc/usage/cmd/bootflow.rst | 75 +++++++++++++++++++++++++++++++++++++- include/bootflow.h | 12 ++++++ 4 files changed, 123 insertions(+), 2 deletions(-) diff --git a/boot/bootflow.c b/boot/bootflow.c index dbf93701cfb..745472a0b7a 100644 --- a/boot/bootflow.c +++ b/boot/bootflow.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -842,3 +843,35 @@ int bootflow_cmdline_get_arg(struct bootflow *bflow, const char *arg, return ret; } + +int bootflow_cmdline_auto(struct bootflow *bflow, const char *arg) +{ + struct serial_device_info info; + char buf[50]; + int ret; + + ret = serial_getinfo(gd->cur_serial_dev, &info); + if (ret) + return ret; + + *buf = '\0'; + if (!strcmp("earlycon", arg)) { + snprintf(buf, sizeof(buf), + "uart8250,mmio32,%#lx,%dn8", info.addr, + info.baudrate); + } else if (!strcmp("console", arg)) { + snprintf(buf, sizeof(buf), + "ttyS0,%dn8", info.baudrate); + } + + if (!*buf) { + printf("Unknown param '%s\n", arg); + return -ENOENT; + } + + ret = bootflow_cmdline_set_arg(bflow, arg, buf, true); + if (ret) + return ret; + + return 0; +} diff --git a/cmd/bootflow.c b/cmd/bootflow.c index dc54124621c..9d93b457408 100644 --- a/cmd/bootflow.c +++ b/cmd/bootflow.c @@ -476,6 +476,9 @@ static int do_bootflow_cmdline(struct cmd_tbl *cmdtp, int flag, int argc, else printf("%.*s\n", ret, val); break; + case 'a': /* auto */ + ret = bootflow_cmdline_auto(bflow, arg); + break; } if (ret < 0) { printf("Operation failed\n"); @@ -495,7 +498,7 @@ static char bootflow_help_text[] = "bootflow info [-d] - show info on current bootflow (-d dump bootflow)\n" "bootflow boot - boot current bootflow (or first available if none selected)\n" "bootflow menu [-t] - show a menu of available bootflows\n" - "bootflow cmdline [set|get|clear|delete] [] - update cmdline"; + "bootflow cmdline [set|get|clear|delete|auto] [] - update cmdline"; #else "scan - boot first available bootflow\n"; #endif diff --git a/doc/usage/cmd/bootflow.rst b/doc/usage/cmd/bootflow.rst index 0dbbb4a327c..d5f5ae79882 100644 --- a/doc/usage/cmd/bootflow.rst +++ b/doc/usage/cmd/bootflow.rst @@ -13,7 +13,7 @@ Synopis bootflow select [] bootflow info [-d] bootflow boot - bootflow cmdline [set|get|clear|delete] [] + bootflow cmdline [set|get|clear|delete|auto] [] Description ----------- @@ -218,6 +218,16 @@ To delete a parameter entirely, use:: bootflow cmdline delete +Automatic parameters are available in a very few cases. You can use these to +add parmeters where the value is known by U-Boot. For example:: + + bootflow cmdline auto earlycon + bootflow cmdline auto console + +can be used to set the early console (or console) to a suitable value so that +output appears on the serial port. This is only supported by the 16550 serial +driver so far. + Example ------- @@ -450,6 +460,69 @@ Here is am example using the -e flag to see all errors:: (21 bootflows, 2 valid) U-Boot> +Here is an example of booting ChromeOS, adjusting the console beforehand. Note that +the cmdline is word-wrapped here and some parts of the command line are elided:: + + => bootfl list + Showing all bootflows + Seq Method State Uclass Part Name Filename + --- ----------- ------ -------- ---- ------------------------ ---------------- + 0 cros ready nvme 0 5.10.153-20434-g98da1eb2c + 1 efi ready nvme c nvme#0.blk#1.bootdev.part efi/boot/bootia32.efi + 2 efi ready usb_mass_ 2 usb_mass_storage.lun0.boo efi/boot/bootia32.efi + --- ----------- ------ -------- ---- ------------------------ ---------------- + (3 bootflows, 3 valid) + => bootfl sel 0 + => bootfl inf + Name: 5.10.153-20434-g98da1eb2cf9d (chrome-bot@chromeos-release-builder-us-central1-b-x32-12-xijx) #1 SMP PREEMPT Tue Jan 24 19:38:23 PST 2023 + Device: nvme#0.blk#1.bootdev + Block dev: nvme#0.blk#1 + Method: cros + State: ready + Partition: 0 + Subdir: (none) + Filename: + Buffer: 737a1400 + Size: c47000 (12873728 bytes) + OS: ChromeOS + Cmdline: console= loglevel=7 init=/sbin/init cros_secure drm.trace=0x106 + root=/dev/dm-0 rootwait ro dm_verity.error_behavior=3 + dm_verity.max_bios=-1 dm_verity.dev_wait=1 + dm="1 vroot none ro 1,0 6348800 + verity payload=PARTUUID=799c935b-ae62-d143-8493-816fa936eef7/PARTNROFF=1 + hashtree=PARTUUID=799c935b-ae62-d143-8493-816fa936eef7/PARTNROFF=1 + hashstart=6348800 alg=sha256 + root_hexdigest=78cc462cd45aecbcd49ca476587b4dee59aa1b00ba5ece58e2c29ec9acd914ab + salt=8dec4dc80a75dd834a9b3175c674405e15b16a253fdfe05c79394ae5fd76f66a" + noinitrd vt.global_cursor_default=0 + kern_guid=799c935b-ae62-d143-8493-816fa936eef7 add_efi_memmap boot=local + noresume noswap i915.modeset=1 ramoops.ecc=1 tpm_tis.force=0 + intel_pmc_core.warn_on_s0ix_failures=1 i915.enable_guc=3 i915.enable_dc=4 + xdomain=0 swiotlb=65536 intel_iommu=on i915.enable_psr=1 + usb-storage.quirks=13fe:6500:u + X86 setup: 742e3400 + Logo: (none) + FDT: + Error: 0 + => bootflow cmdline auto earlycon + => bootflow cmd auto console + => print bootargs + bootargs=console=ttyS0,115200n8 loglevel=7 ... + usb-storage.quirks=13fe:6500:u earlycon=uart8250,mmio32,0xfe03e000,115200n8 + => bootflow cmd del console + => print bootargs + bootargs=loglevel=7 ... earlycon=uart8250,mmio32,0xfe03e000,115200n8 + => bootfl boot + ** Booting bootflow '5.10.153-20434-g98da1eb2cf9d (chrome-bot@chromeos-release-builder-us-central1-b-x32-12-xijx) #1 SMP PREEMPT Tue Jan 24 19:38:23 PST 2023' with cros + Kernel command line: "loglevel=7 ... earlycon=uart8250,mmio32,0xfe03e000,115200n8" + + Starting kernel ... + + [ 0.000000] Linux version 5.10.153-20434-g98da1eb2cf9d (chrome-bot@chromeos-release-builder-us-central1-b-x32-12-xijx) (Chromium OS 15.0_pre465103_p20220825-r4 clang version 15.0.0 (/var/tmp/portage/sys-devel/llvm-15.0_pre465103_p20220825-r4/work/llvm-15.0_pre465103_p20220825/clang db1978b67431ca3462ad8935bf662c15750b8252), LLD 15.0.0) #1 SMP PREEMPT Tue Jan 24 19:38:23 PST 2023 + [ 0.000000] Command line: loglevel=7 ... usb-storage.quirks=13fe:6500:u earlycon=uart8250,mmio32,0xfe03e000,115200n8 + [ 0.000000] x86/split lock detection: warning about user-space split_locks + + Return value ------------ diff --git a/include/bootflow.h b/include/bootflow.h index af4b762dc5e..f65098a2dc3 100644 --- a/include/bootflow.h +++ b/include/bootflow.h @@ -526,4 +526,16 @@ int cmdline_get_arg(const char *cmdline, const char *arg, int *posp); int bootflow_cmdline_get_arg(struct bootflow *bflow, const char *arg, const char **val); +/** + * bootflow_cmdline_auto() - Automatically set a value for a known argument + * + * This handles a small number of known arguments, for Linux in particular. It + * adds suitable kernel parameters automatically, e.g. to enable the console. + * + * @bflow: Bootflow to update + * @arg: Name of argument to set (e.g. "earlycon" or "console") + * Return: 0 if OK -ve on error + */ +int bootflow_cmdline_auto(struct bootflow *bflow, const char *arg); + #endif From patchwork Fri Apr 28 19:18:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1775128 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=RMPESQkd; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q7Mrl5qrFz23tZ for ; Sat, 29 Apr 2023 05:20:39 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 32544861A4; Fri, 28 Apr 2023 21:19:08 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="RMPESQkd"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7C82C86053; Fri, 28 Apr 2023 21:18:58 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd2f.google.com (mail-io1-xd2f.google.com [IPv6:2607:f8b0:4864:20::d2f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id DCF7E8603D for ; Fri, 28 Apr 2023 21:18:55 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd2f.google.com with SMTP id ca18e2360f4ac-7606d6b3294so12722539f.2 for ; Fri, 28 Apr 2023 12:18:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1682709523; x=1685301523; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0ejG7+1IVqzkr2ijhWFOepd7wJVy8DSAeds/6UQnF+g=; b=RMPESQkdvBd3OYZvWN7pn/gEmJEJ3saijXE03CAenFnq5J24yl5L6fXX+5LDoQeWG5 btai6d9caHuzbwJJ7NHl1O5HPwesbsTn2e2u99UJcYdXT/JAiZyF5SuF+rLX1529T566 t3UClrixzYdFvupMOlibddYlS4mtkdf73eYaQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682709523; x=1685301523; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0ejG7+1IVqzkr2ijhWFOepd7wJVy8DSAeds/6UQnF+g=; b=RzLi7lHmPSMdqygJiAj6p6rsrHM/sEgc3+b1u+h8RbZCKkCXt6IGSpt3D9SIlr3OrB N0IsgDO2W5GgElRLe7s6B3sYFfH6EQ9oybIXERnvUuGzE8Pco2yfVKfquwU5rv6ocbQ9 sUAClZRmvCfuwQxiqDTAxIyZUHXMTIj9NndXShAA4HIHUGZjM/SOgdb25Sdb9ntzj4Sj vGYKiBCaxEXAqVETi+z57iDHN7/WLSfXAJfnkq/iKSy4yfdrX2j9ct9VuDW5tgFp7muT 95weBoxMz/YY7Iggzis4zJ8DMwJtZL8VW8AAteS7UGoSLqsG5IAQ6qYY1IKFnTjxQJ3s iCjA== X-Gm-Message-State: AC+VfDy/oQ8+20j7wevQUwyy4qzSxzwZsuoCEc3EEyQVqyVqffl7puKG knAAF0Qm0rivpqAufN7lYf05qDxkwOtuCm5m/+c= X-Google-Smtp-Source: ACHHUZ5C+AlVQrDp/fBvF+FdzerLTosSoqJVIbDNbzK2a/5BCGKwDn7paF4RBz1XhM49LQ500FcUiA== X-Received: by 2002:a5d:94d8:0:b0:760:e2e5:8c9 with SMTP id y24-20020a5d94d8000000b00760e2e508c9mr4021570ior.3.1682709523474; Fri, 28 Apr 2023 12:18:43 -0700 (PDT) Received: from kea.bld.corp.google.com ([2620:15c:183:200:9261:21dc:edb:e426]) by smtp.gmail.com with ESMTPSA id l12-20020a0566380d8c00b0041407c67451sm1698811jaj.165.2023.04.28.12.18.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Apr 2023 12:18:43 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass , Bin Meng Subject: [PATCH 14/18] x86: Add a function to boot a zimage Date: Fri, 28 Apr 2023 13:18:14 -0600 Message-ID: <20230428131814.14.Iebb4e915a2f70f6ab353a62ddc68c39a822a2d37@changeid> X-Mailer: git-send-email 2.40.1.495.gc816e09b53d-goog In-Reply-To: <20230428191819.3070393-1-sjg@chromium.org> References: <20230428191819.3070393-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.8 at phobos.denx.de X-Virus-Status: Clean Add a direct interface to booting a zimage, so that bootstd can call it without going through the command-line interface. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- arch/x86/include/asm/zimage.h | 17 ++++++++ arch/x86/lib/zimage.c | 82 ++++++++++++++++++++++++++++++----- 2 files changed, 88 insertions(+), 11 deletions(-) diff --git a/arch/x86/include/asm/zimage.h b/arch/x86/include/asm/zimage.h index 000b38ea899..966d7224eb1 100644 --- a/arch/x86/include/asm/zimage.h +++ b/arch/x86/include/asm/zimage.h @@ -72,4 +72,21 @@ int setup_zimage(struct boot_params *setup_base, char *cmd_line, int auto_boot, */ void zimage_dump(struct boot_params *base_ptr); +/** + * zboot_start() - Boot a zimage + * + * Boot a zimage, given the component parts + * + * @addr: Address where the bzImage is moved before booting, either + * BZIMAGE_LOAD_ADDR or ZIMAGE_LOAD_ADDR + * @base: Pointer to the boot parameters, typically at address + * DEFAULT_SETUP_BASE + * @initrd: Address of the initial ramdisk, or 0 if none + * @initrd_size: Size of the initial ramdisk, or 0 if none + * @cmdline: Command line to use for booting + * Return: -EFAULT on error (normally it does not return) + */ +int zboot_start(ulong addr, ulong size, ulong initrd, ulong initrd_size, + ulong base, char *cmdline); + #endif diff --git a/arch/x86/lib/zimage.c b/arch/x86/lib/zimage.c index e5ea5129c1e..540d4d888bc 100644 --- a/arch/x86/lib/zimage.c +++ b/arch/x86/lib/zimage.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -442,8 +443,7 @@ static int do_zboot_start(struct cmd_tbl *cmdtp, int flag, int argc, return 0; } -static int do_zboot_load(struct cmd_tbl *cmdtp, int flag, int argc, - char *const argv[]) +static int zboot_load(void) { struct boot_params *base_ptr; @@ -460,31 +460,51 @@ static int do_zboot_load(struct cmd_tbl *cmdtp, int flag, int argc, &state.load_address); if (!base_ptr) { puts("## Kernel loading failed ...\n"); - return CMD_RET_FAILURE; + return -EINVAL; } } state.base_ptr = base_ptr; - if (env_set_hex("zbootbase", (ulong)base_ptr) || + + return 0; +} + +static int do_zboot_load(struct cmd_tbl *cmdtp, int flag, int argc, + char *const argv[]) +{ + if (zboot_load()) + return CMD_RET_FAILURE; + + if (env_set_hex("zbootbase", map_to_sysmem(state.base_ptr)) || env_set_hex("zbootaddr", state.load_address)) return CMD_RET_FAILURE; return 0; } +static int zboot_setup(void) +{ + struct boot_params *base_ptr = state.base_ptr; + int ret; + + ret = setup_zimage(base_ptr, (char *)base_ptr + COMMAND_LINE_OFFSET, + 0, state.initrd_addr, state.initrd_size, + (ulong)state.cmdline); + if (ret) + return -EINVAL; + + return 0; +} + static int do_zboot_setup(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { struct boot_params *base_ptr = state.base_ptr; - int ret; if (!base_ptr) { printf("base is not set: use 'zboot load' first\n"); return CMD_RET_FAILURE; } - ret = setup_zimage(base_ptr, (char *)base_ptr + COMMAND_LINE_OFFSET, - 0, state.initrd_addr, state.initrd_size, - (ulong)state.cmdline); - if (ret) { + if (zboot_setup()) { puts("Setting up boot parameters failed ...\n"); return CMD_RET_FAILURE; } @@ -501,8 +521,7 @@ static int do_zboot_info(struct cmd_tbl *cmdtp, int flag, int argc, return 0; } -static int do_zboot_go(struct cmd_tbl *cmdtp, int flag, int argc, - char *const argv[]) +static int zboot_go(void) { struct boot_params *params = state.base_ptr; struct setup_header *hdr = ¶ms->hdr; @@ -522,11 +541,52 @@ static int do_zboot_go(struct cmd_tbl *cmdtp, int flag, int argc, /* we assume that the kernel is in place */ ret = boot_linux_kernel((ulong)state.base_ptr, entry, image_64bit); + + return ret; +} + +static int do_zboot_go(struct cmd_tbl *cmdtp, int flag, int argc, + char *const argv[]) +{ + int ret; + + ret = zboot_go(); printf("Kernel returned! (err=%d)\n", ret); return CMD_RET_FAILURE; } +int zboot_start(ulong addr, ulong size, ulong initrd, ulong initrd_size, + ulong base, char *cmdline) +{ + int ret; + + memset(&state, '\0', sizeof(state)); + + if (base) { + state.base_ptr = map_sysmem(base, 0); + state.load_address = addr; + } else { + state.bzimage_addr = addr; + } + state.bzimage_size = size; + state.initrd_addr = initrd; + state.initrd_size = initrd_size; + state.cmdline = cmdline; + + ret = zboot_load(); + if (ret) + return log_msg_ret("ld", ret); + ret = zboot_setup(); + if (ret) + return log_msg_ret("set", ret); + ret = zboot_go(); + if (ret) + return log_msg_ret("set", ret); + + return -EFAULT; +} + static void print_num(const char *name, ulong value) { printf("%-20s: %lx\n", name, value); From patchwork Fri Apr 28 19:18:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1775130 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=JCIgwKkQ; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q7MsJ0nVVz23tZ for ; Sat, 29 Apr 2023 05:21:08 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E754C863A5; Fri, 28 Apr 2023 21:19:11 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="JCIgwKkQ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2C7DC8603D; Fri, 28 Apr 2023 21:18:59 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x135.google.com (mail-il1-x135.google.com [IPv6:2607:f8b0:4864:20::135]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1002085FE8 for ; Fri, 28 Apr 2023 21:18:56 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x135.google.com with SMTP id e9e14a558f8ab-32ad8ca1e69so522565ab.3 for ; Fri, 28 Apr 2023 12:18:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1682709524; x=1685301524; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HgWIwQklHzUNMG+PsNkthjrHHZaZM8U6fCF7KXPKaGQ=; b=JCIgwKkQxFmqLmjquWqpEUx86UIo6tJH3plQuUDJec8FKTxjW3Wx8yI/FCaWRVEa4w 8SUg8JjQUsQ9BSAVtznvZBKhmP8iVHukz41Rq9r5k0ghqqXJY3srMjf5E8+8JMIjlhSV ICEN+GUdL0i+bPICf5KgH5WatArEEuZ9XQLyI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682709524; x=1685301524; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HgWIwQklHzUNMG+PsNkthjrHHZaZM8U6fCF7KXPKaGQ=; b=ktlu4Eczeli1iHYP67/vE6UVQ1gwKyYX8aG0TRVqCqjSQZ7g1C1evMBjQBzlFr5t1f uDfdbHEo2EFyXfxZxLN5Z8cKuIBke7nJlyhpOrK3PmR8kR/siPn7zXBJgVjFNhlDY1e2 jBiE5uhgwODrJHlxMPdXv8usbQh+DgAXA8p24DSqg4tqau9kaFct+QeOWPeXihEuFDPN 28HP0zEpXbcWJv7GtHSpdtm2Dt3Q4g9SqFvoO/8ZZ1yK99kgs4VmRZFHu89Yu9JdpGkb OaE8+OC3qAm3gzRQjJXFXGA6PtHitLN6n07LZQtjoNrM7ia89rKzYMBvRVMyrUe92kIN edew== X-Gm-Message-State: AC+VfDyHdrnu7kNGVk6pIuTvEPl5aPAKwGiz8vHk33732opNv+UHUhI4 GgwpzEgf6R84/dWEi4aqDigYAGhxBqZQjwWILCM= X-Google-Smtp-Source: ACHHUZ6Rz356g7T+pX/wNCgx8NxRI0MW3gw9qAY52GfWVrgdEc5cIUvfQ8fQidl2UUt+rvrWauQ2Qg== X-Received: by 2002:a92:dc4c:0:b0:32b:5e:e22a with SMTP id x12-20020a92dc4c000000b0032b005ee22amr4095061ilq.17.1682709524157; Fri, 28 Apr 2023 12:18:44 -0700 (PDT) Received: from kea.bld.corp.google.com ([2620:15c:183:200:9261:21dc:edb:e426]) by smtp.gmail.com with ESMTPSA id l12-20020a0566380d8c00b0041407c67451sm1698811jaj.165.2023.04.28.12.18.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Apr 2023 12:18:43 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass , Bin Meng Subject: [PATCH 15/18] x86: zimage: Export the function to obtain the cmdline Date: Fri, 28 Apr 2023 13:18:15 -0600 Message-ID: <20230428191819.3070393-11-sjg@chromium.org> X-Mailer: git-send-email 2.40.1.495.gc816e09b53d-goog In-Reply-To: <20230428191819.3070393-1-sjg@chromium.org> References: <20230428191819.3070393-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.8 at phobos.denx.de X-Virus-Status: Clean Allow reading the command line from a zimage, so that it can be recorded in the bootflow. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- arch/x86/include/asm/zimage.h | 10 ++++++++++ arch/x86/lib/zimage.c | 11 ++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/arch/x86/include/asm/zimage.h b/arch/x86/include/asm/zimage.h index 966d7224eb1..9ad74dc0b94 100644 --- a/arch/x86/include/asm/zimage.h +++ b/arch/x86/include/asm/zimage.h @@ -89,4 +89,14 @@ void zimage_dump(struct boot_params *base_ptr); int zboot_start(ulong addr, ulong size, ulong initrd, ulong initrd_size, ulong base, char *cmdline); +/* + * zimage_get_kernel_version() - Get the version string from a kernel + * + * @params: boot_params pointer + * @kernel_base: base address of kernel + * Return: Kernel version as a NUL-terminated string + */ +const char *zimage_get_kernel_version(struct boot_params *params, + void *kernel_base); + #endif diff --git a/arch/x86/lib/zimage.c b/arch/x86/lib/zimage.c index 540d4d888bc..062e3d3e315 100644 --- a/arch/x86/lib/zimage.c +++ b/arch/x86/lib/zimage.c @@ -181,7 +181,7 @@ static int setup_device_tree(struct setup_header *hdr, const void *fdt_blob) return 0; } -static const char *get_kernel_version(struct boot_params *params, +const char *zimage_get_kernel_version(struct boot_params *params, void *kernel_base) { struct setup_header *hdr = ¶ms->hdr; @@ -189,10 +189,14 @@ static const char *get_kernel_version(struct boot_params *params, const char *s, *end; bootproto = get_boot_protocol(hdr, false); + log_debug("bootproto %x, hdr->setup_sects %x\n", bootproto, + hdr->setup_sects); if (bootproto < 0x0200 || hdr->setup_sects < 15) return NULL; /* sanity-check the kernel version in case it is missing */ + log_debug("hdr->kernel_version %x, str at %p\n", hdr->kernel_version, + kernel_base + hdr->kernel_version + 0x200); for (s = kernel_base + hdr->kernel_version + 0x200, end = s + 0x100; *s; s++) { if (!isprint(*s)) @@ -239,7 +243,7 @@ struct boot_params *load_zimage(char *image, unsigned long kernel_size, log_debug("Using boot protocol version %x.%02x\n", (bootproto & 0xff00) >> 8, bootproto & 0xff); - version = get_kernel_version(params, image); + version = zimage_get_kernel_version(params, image); if (version) printf("Linux kernel version %s\n", version); else @@ -728,7 +732,8 @@ void zimage_dump(struct boot_params *base_ptr) print_num("Real mode switch", hdr->realmode_swtch); print_num("Start sys seg", hdr->start_sys_seg); print_num("Kernel version", hdr->kernel_version); - version = get_kernel_version(base_ptr, (void *)state.bzimage_addr); + version = zimage_get_kernel_version(base_ptr, + (void *)state.bzimage_addr); if (version) printf(" @%p: %s\n", version, version); print_num("Type of loader", hdr->type_of_loader); From patchwork Fri Apr 28 19:18:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1775129 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=B0HN+Jwd; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q7Ms216zKz23tZ for ; Sat, 29 Apr 2023 05:20:54 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4A815862CC; Fri, 28 Apr 2023 21:19:10 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="B0HN+Jwd"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0E46685FE9; Fri, 28 Apr 2023 21:18:59 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd35.google.com (mail-io1-xd35.google.com [IPv6:2607:f8b0:4864:20::d35]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 53AFB8617A for ; Fri, 28 Apr 2023 21:18:56 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd35.google.com with SMTP id ca18e2360f4ac-763ae18986cso4560039f.3 for ; Fri, 28 Apr 2023 12:18:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1682709525; x=1685301525; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=zaf9ANxwEcUVleVoDFTbN/oMz3JGjgSI4d+g96+IISM=; b=B0HN+JwdPozOeVWRsR3C6zS0y1uM6nwzmmOOgiBN2pKyGIGFzSpBFa+dzPtYV688LY Rupbnj3pnCj2FI8jN2kl0UOBprBCujZZMYNhHT2+hg2tCmDzzMFKd6mxMEwZPlq+w+0T p7VxgYjh0E4IjtfEoA/RWwPH7+a8lt1eHM0d8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682709525; x=1685301525; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zaf9ANxwEcUVleVoDFTbN/oMz3JGjgSI4d+g96+IISM=; b=PoCRyj3/iQu0gHv2AsWf0jgf37oM2c/3mLrpK5Glpq7CeX5GshaEQSqheMH2Ahex7n N/UD9vD5N12hDOYIuY8YJAW2n9agklQT97vXZY2/9EUz0EQDrOCRChayG26GVat1yyZU alHMBbXjphU3F4s1XhmKe5YQk2rYcxHydcVwciwHR5j/4sIQcVqs8WmA0M1oegDeDHZ2 m83UTozUceqBLwfaWdXS0BjqE5/H/aL6rMfqVTno6bjtBremrAAaHBVZuTYYwJFy/GBW 7CnijVoH3P6rEjYzt72jZwPPEz+55CKc3LSjDmwZlF6FYXYKJTr4T5Hivx0uQEqe6wcF eELw== X-Gm-Message-State: AC+VfDzd919/kbIWiuayJuRooNgp07OEmZ78xmBUDsvqlFYBTziMxQi7 wSkEpZ5KwKwcKNzi4RQwGV1NKM+D7va6xtb4EjM= X-Google-Smtp-Source: ACHHUZ5lTMnR7OsrLlqTtv+WnkIriPzhVHY2hdIJBKK4Zg5roRrISjPDrvXIlXW8Zk9Y11tNeQCFmA== X-Received: by 2002:a6b:d002:0:b0:758:917b:c313 with SMTP id x2-20020a6bd002000000b00758917bc313mr3386842ioa.13.1682709524847; Fri, 28 Apr 2023 12:18:44 -0700 (PDT) Received: from kea.bld.corp.google.com ([2620:15c:183:200:9261:21dc:edb:e426]) by smtp.gmail.com with ESMTPSA id l12-20020a0566380d8c00b0041407c67451sm1698811jaj.165.2023.04.28.12.18.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Apr 2023 12:18:44 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass , Andrew Davis , Heinrich Schuchardt , John Keeping Subject: [PATCH 16/18] bootstd: Add a simple bootmeth for ChromiumOS Date: Fri, 28 Apr 2023 13:18:16 -0600 Message-ID: <20230428191819.3070393-12-sjg@chromium.org> X-Mailer: git-send-email 2.40.1.495.gc816e09b53d-goog In-Reply-To: <20230428191819.3070393-1-sjg@chromium.org> References: <20230428191819.3070393-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.8 at phobos.denx.de X-Virus-Status: Clean It is possible to boot x86-based ChromeOS machines by parsing a table and locating the kernel and command line. Add a bootmeth for this. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- boot/Kconfig | 11 ++ boot/Makefile | 1 + boot/bootmeth_cros.c | 212 +++++++++++++++++++++++++++++++++++ configs/tools-only_defconfig | 1 + 4 files changed, 225 insertions(+) create mode 100644 boot/bootmeth_cros.c diff --git a/boot/Kconfig b/boot/Kconfig index d95a2a70266..1dadd42f15e 100644 --- a/boot/Kconfig +++ b/boot/Kconfig @@ -462,6 +462,17 @@ config BOOTMETH_GLOBAL EFI bootmgr, since they take full control over which bootdevs are selected to boot. +config BOOTMETH_CROS + bool "Bootdev support for Chromium OS" + depends on X86 || SANDBOX + default y + help + Enables support for booting Chromium OS using bootdevs. This uses the + kernel A slot and obtains the kernel command line from the parameters + provided there. + + Note that only x86 devices are supported at present. + config BOOTMETH_DISTRO bool "Bootdev support for distro boot" select PXE_UTILS diff --git a/boot/Makefile b/boot/Makefile index 88193a1b60e..998a7f9c684 100644 --- a/boot/Makefile +++ b/boot/Makefile @@ -27,6 +27,7 @@ obj-$(CONFIG_$(SPL_TPL_)BOOTSTD) += bootstd-uclass.o obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_DISTRO) += bootmeth_distro.o obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_DISTRO_PXE) += bootmeth_pxe.o obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_EFILOADER) += bootmeth_efi.o +obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_CROS) += bootmeth_cros.o obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_SANDBOX) += bootmeth_sandbox.o obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_SCRIPT) += bootmeth_script.o ifdef CONFIG_$(SPL_TPL_)BOOTSTD_FULL diff --git a/boot/bootmeth_cros.c b/boot/bootmeth_cros.c new file mode 100644 index 00000000000..440737060fd --- /dev/null +++ b/boot/bootmeth_cros.c @@ -0,0 +1,212 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Bootmethod for ChromiumOS + * + * Copyright 2023 Google LLC + * Written by Simon Glass + */ + +#define LOG_CATEGORY UCLASS_BOOTSTD + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef CONFIG_X86 +#include +#endif +#include + +enum { + /* Offsets in the kernel-partition header */ + KERN_START = 0x4f0, + KERN_SIZE = 0x518, + + SETUP_OFFSET = 0x1000, /* bytes before base */ + CMDLINE_OFFSET = 0x2000, /* bytes before base */ + OFFSET_BASE = 0x100000, /* assumed kernel load-address */ +}; + +static int cros_check(struct udevice *dev, struct bootflow_iter *iter) +{ + /* This only works on block and network devices */ + if (bootflow_iter_check_blk(iter)) + return log_msg_ret("blk", -ENOTSUPP); + + return 0; +} + +static int copy_cmdline(const char *from, const char *uuid, char **bufp) +{ + const int maxlen = 2048; + char buf[maxlen]; + char *cmd, *to, *end; + int len; + + /* Allow space for cmdline + UUID */ + len = strnlen(from, sizeof(buf)); + if (len >= maxlen) + return -E2BIG; + + log_debug("uuid %d %s\n", uuid ? (int)strlen(uuid) : 0, uuid); + for (to = buf, end = buf + maxlen - UUID_STR_LEN - 1; *from; from++) { + if (to >= end) + return -E2BIG; + if (from[0] == '%' && from[1] == 'U' && uuid && + strlen(uuid) == UUID_STR_LEN) { + strcpy(to, uuid); + to += UUID_STR_LEN; + from++; + } else { + *to++ = *from; + } + } + *to = '\0'; + len = to - buf; + cmd = strdup(buf); + if (!cmd) + return -ENOMEM; + free(*bufp); + *bufp = cmd; + + return 0; +} + +static int cros_read_bootflow(struct udevice *dev, struct bootflow *bflow) +{ + struct blk_desc *desc = dev_get_uclass_plat(bflow->blk); + ulong base, start, size, setup, cmdline, num_blks, kern_base; + struct disk_partition info; + const char *uuid = NULL; + void *buf, *hdr; + int ret; + + log_debug("starting, part=%d\n", bflow->part); + + /* We consider the whole disk, not any one partition */ + if (bflow->part) + return log_msg_ret("max", -ENOENT); + + /* Check partition 2 */ + ret = part_get_info(desc, 2, &info); + if (ret) + return log_msg_ret("part", ret); + + /* Make a buffer for the header information */ + num_blks = SZ_4K >> desc->log2blksz; + log_debug("Reading header, blk=%s, start=%lx, blocks=%lx\n", + bflow->blk->name, (ulong)info.start, num_blks); + hdr = memalign(SZ_1K, SZ_4K); + if (!hdr) + return log_msg_ret("hdr", -ENOMEM); + ret = blk_read(bflow->blk, info.start, num_blks, hdr); + if (ret != num_blks) + return log_msg_ret("inf", ret); + + if (memcmp("CHROMEOS", hdr, 8)) + return -ENOENT; + + log_debug("Header at %lx\n", (ulong)map_to_sysmem(hdr)); + start = *(u32 *)(hdr + KERN_START); + size = ALIGN(*(u32 *)(hdr + KERN_SIZE), desc->blksz); + log_debug("Reading start %lx size %lx\n", start, size); + bflow->size = size; + + buf = memalign(SZ_1K, size); + if (!buf) + return log_msg_ret("buf", -ENOMEM); + num_blks = size >> desc->log2blksz; + log_debug("Reading data, blk=%s, start=%lx, blocks=%lx\n", + bflow->blk->name, (ulong)info.start, num_blks); + ret = blk_read(bflow->blk, (ulong)info.start + 0x80, num_blks, buf); + if (ret != num_blks) + return log_msg_ret("inf", ret); + base = map_to_sysmem(buf); + + setup = base + start - OFFSET_BASE - SETUP_OFFSET; + cmdline = base + start - OFFSET_BASE - CMDLINE_OFFSET; + kern_base = base + start - OFFSET_BASE + SZ_16K; + log_debug("base %lx setup %lx, cmdline %lx, kern_base %lx\n", base, + setup, cmdline, kern_base); + +#ifdef CONFIG_X86 + const char *version; + + version = zimage_get_kernel_version(map_sysmem(setup, 0), + map_sysmem(kern_base, 0)); + log_debug("version %s\n", version); + if (version) + bflow->name = strdup(version); +#endif + if (!bflow->name) + bflow->name = strdup("ChromeOS"); + if (!bflow->name) + return log_msg_ret("nam", -ENOMEM); + bflow->os_name = strdup("ChromeOS"); + if (!bflow->os_name) + return log_msg_ret("os", -ENOMEM); + +#if CONFIG_IS_ENABLED(PARTITION_UUIDS) + uuid = info.uuid; +#endif + ret = copy_cmdline(map_sysmem(cmdline, 0), uuid, &bflow->cmdline); + if (ret) + return log_msg_ret("cmd", ret); + + bflow->state = BOOTFLOWST_READY; + bflow->buf = buf; + bflow->x86_setup = map_sysmem(setup, 0); + + return 0; +} + +static int cros_read_file(struct udevice *dev, struct bootflow *bflow, + const char *file_path, ulong addr, ulong *sizep) +{ + return -ENOSYS; +} + +static int cros_boot(struct udevice *dev, struct bootflow *bflow) +{ +#ifdef CONFIG_X86 + zboot_start(map_to_sysmem(bflow->buf), bflow->size, 0, 0, + map_to_sysmem(bflow->x86_setup), + bflow->cmdline); +#endif + + return log_msg_ret("go", -EFAULT); +} + +static int cros_bootmeth_bind(struct udevice *dev) +{ + struct bootmeth_uc_plat *plat = dev_get_uclass_plat(dev); + + plat->desc = "ChromiumOS boot"; + + return 0; +} + +static struct bootmeth_ops cros_bootmeth_ops = { + .check = cros_check, + .read_bootflow = cros_read_bootflow, + .read_file = cros_read_file, + .boot = cros_boot, +}; + +static const struct udevice_id cros_bootmeth_ids[] = { + { .compatible = "u-boot,cros" }, + { } +}; + +U_BOOT_DRIVER(bootmeth_cros) = { + .name = "bootmeth_cros", + .id = UCLASS_BOOTMETH, + .of_match = cros_bootmeth_ids, + .ops = &cros_bootmeth_ops, + .bind = cros_bootmeth_bind, +}; diff --git a/configs/tools-only_defconfig b/configs/tools-only_defconfig index 23e1f0e9dba..7b6c07ffb02 100644 --- a/configs/tools-only_defconfig +++ b/configs/tools-only_defconfig @@ -9,6 +9,7 @@ CONFIG_FIT=y CONFIG_TIMESTAMP=y CONFIG_FIT_SIGNATURE=y # CONFIG_BOOTSTD_FULL is not set +# CONFIG_BOOTMETH_CROS is not set # CONFIG_BOOTMETH_VBE is not set CONFIG_USE_BOOTCOMMAND=y CONFIG_BOOTCOMMAND="run distro_bootcmd" From patchwork Fri Apr 28 19:18:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1775131 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=APG/ZES7; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q7MsY3sn9z23tZ for ; Sat, 29 Apr 2023 05:21:21 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0DB8D863BA; Fri, 28 Apr 2023 21:19:13 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="APG/ZES7"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6391185FE8; Fri, 28 Apr 2023 21:18:59 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x12d.google.com (mail-il1-x12d.google.com [IPv6:2607:f8b0:4864:20::12d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 07B538618F for ; Fri, 28 Apr 2023 21:18:57 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x12d.google.com with SMTP id e9e14a558f8ab-32f23e2249bso25331585ab.0 for ; Fri, 28 Apr 2023 12:18:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1682709525; x=1685301525; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9lsBNEkmVGqd+h3w1Hm7ohXt5fCpW+BZrlvHL5n7ETE=; b=APG/ZES77CaWhijcynAXE2B8EBFtUaU+XevhQ5P8AxEkvoRG4O2E7LZpvqll+cS+ZX 5jj9qtzy2CuAuL/wPiXj3CCmrysE8NNQfpz5/5/9S7vqDpfxTkQ6zUZAmNN4vv3DvBSb +OZxGU6CcUgcEyTDcMMzv5ocxwvfwFjaj/A2o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682709525; x=1685301525; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9lsBNEkmVGqd+h3w1Hm7ohXt5fCpW+BZrlvHL5n7ETE=; b=IUCENIzYF0SpXpv/qGo5YGLQ4pnaLi6ARqYcuJ+mYFnkU9nLVVtW4x6ckmX8Manz3g oLRkUPyo+3IXRd9tmxhVPwulmL88YyNLH5392Jrc7w9fBZ6VfC5xrsz9xarb3BnQkYKM lmt9QsjnHnzop7LCR/b+iDzNRfdpG7+FwCUFLgrcssKaiYU3sNOQMYl58xZD7rjN4dzt 9Q+/5wFpiGGyHOkyF7tc2N0kzCmrzV9HEqLq7yul0drRVHqLA3+7PhI+TPmhKcl8azi9 yWAyz2ktosmAPoftDK4GSylqh+l0bZRkpopUtbuDZXiUAUfgDXSGbxoX0/oiUrB+9tCQ Nacw== X-Gm-Message-State: AC+VfDzA5KE+uCsTC3GTzBSfVVkzvVJ9DVREBD9OThFQjVtwPdLZmHfL ZLuIszKO4PJEO1ZZd4GKzqF8S+l9e6qx213wyrM= X-Google-Smtp-Source: ACHHUZ4d8EpmUUtnso1nOVDToZmuLFsypDVMfOP6grIm7F/LfLtp5wm0DFRiikSXMS3JMUomYVchtg== X-Received: by 2002:a05:6602:2762:b0:760:a0be:e63c with SMTP id l2-20020a056602276200b00760a0bee63cmr6281322ioe.4.1682709525637; Fri, 28 Apr 2023 12:18:45 -0700 (PDT) Received: from kea.bld.corp.google.com ([2620:15c:183:200:9261:21dc:edb:e426]) by smtp.gmail.com with ESMTPSA id l12-20020a0566380d8c00b0041407c67451sm1698811jaj.165.2023.04.28.12.18.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Apr 2023 12:18:45 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass , Bin Meng Subject: [PATCH 17/18] x86: coreboot: Adjust various config options Date: Fri, 28 Apr 2023 13:18:17 -0600 Message-ID: <20230428191819.3070393-13-sjg@chromium.org> X-Mailer: git-send-email 2.40.1.495.gc816e09b53d-goog In-Reply-To: <20230428191819.3070393-1-sjg@chromium.org> References: <20230428191819.3070393-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.8 at phobos.denx.de X-Virus-Status: Clean Drop IDE since this is not widely used anymore. Add NVME since it is becoming more popular. Add ms so it is easier to search for tables in memory. Expand the command-line and print buffers so that we can deal with the very long ChromeOS command lines. (typically 700 characters). Enable BOOTSTD_FULL to get the full set up standard-boot options. Finally, expand the malloc() space so we can read large kernels into a bootflow. Signed-off-by: Simon Glass --- configs/coreboot_defconfig | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/configs/coreboot_defconfig b/configs/coreboot_defconfig index 4db72899169..e8a915a64f9 100644 --- a/configs/coreboot_defconfig +++ b/configs/coreboot_defconfig @@ -1,5 +1,6 @@ CONFIG_X86=y CONFIG_TEXT_BASE=0x1110000 +CONFIG_SYS_MALLOC_LEN=0x2000000 CONFIG_NR_DRAM_BANKS=8 CONFIG_ENV_SIZE=0x1000 CONFIG_DEFAULT_DEVICE_TREE="coreboot" @@ -8,19 +9,21 @@ CONFIG_VENDOR_COREBOOT=y CONFIG_TARGET_COREBOOT=y CONFIG_FIT=y CONFIG_FIT_SIGNATURE=y +CONFIG_BOOTSTD_FULL=y CONFIG_SYS_MONITOR_BASE=0x01110000 CONFIG_SHOW_BOOT_PROGRESS=y CONFIG_USE_BOOTARGS=y CONFIG_BOOTARGS="root=/dev/sdb3 init=/sbin/init rootwait ro" -CONFIG_USE_BOOTCOMMAND=y -CONFIG_BOOTCOMMAND="ext2load scsi 0:3 01000000 /boot/vmlinuz; zboot 01000000" CONFIG_PRE_CONSOLE_BUFFER=y CONFIG_SYS_CONSOLE_INFO_QUIET=y +CONFIG_LOG=y +CONFIG_LOGF_FUNC=y CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_LAST_STAGE_INIT=y CONFIG_HUSH_PARSER=y -CONFIG_SYS_PBSIZE=532 -CONFIG_CMD_IDE=y +CONFIG_SYS_CBSIZE=1024 +CONFIG_SYS_PBSIZE=1024 +CONFIG_CMD_MEM_SEARCH=y CONFIG_CMD_MMC=y CONFIG_CMD_PART=y CONFIG_CMD_USB=y @@ -48,13 +51,9 @@ CONFIG_USE_ROOTPATH=y CONFIG_REGMAP=y CONFIG_SYSCON=y # CONFIG_ACPIGEN is not set -CONFIG_SYS_IDE_MAXDEVICE=4 -CONFIG_SYS_ATA_DATA_OFFSET=0 -CONFIG_SYS_ATA_REG_OFFSET=0 -CONFIG_SYS_ATA_ALT_OFFSET=0 -CONFIG_ATAPI=y -CONFIG_LBA48=y -CONFIG_SYS_64BIT_LBA=y +CONFIG_MISC=y +CONFIG_NVMEM=y +CONFIG_NVME_PCI=y # CONFIG_PCI_PNP is not set CONFIG_SYS_NS16550_PORT_MAPPED=y CONFIG_SOUND=y From patchwork Fri Apr 28 19:18:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1775133 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=j+UXWBnE; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q7Mt93M5pz23tZ for ; Sat, 29 Apr 2023 05:21:53 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4BBBA863B0; Fri, 28 Apr 2023 21:19:25 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="j+UXWBnE"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5FBD0863A5; Fri, 28 Apr 2023 21:19:11 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,LOTS_OF_MONEY, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd36.google.com (mail-io1-xd36.google.com [IPv6:2607:f8b0:4864:20::d36]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id A2883861B3 for ; Fri, 28 Apr 2023 21:19:08 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd36.google.com with SMTP id ca18e2360f4ac-760f29073b4so4658439f.2 for ; Fri, 28 Apr 2023 12:19:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1682709526; x=1685301526; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=EvU37Qgaq0maE94w6rSx/inxlgoVjphHQAFaIOcmB1o=; b=j+UXWBnEusMS+lx4nxks+dUhOFvW4IHP0N6mF7CTZuMfdFtBBITGYPxJnE793wHQox Y4IHwy0nng8zYxvsqcHd/ZNfzx/L411ktLLrJI3xSwBiiHP444xjJ4KmxvSmzsbwLHT9 irTS6Os99wwChnCwd0jJAFpn2njWdHStKoeAs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682709526; x=1685301526; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EvU37Qgaq0maE94w6rSx/inxlgoVjphHQAFaIOcmB1o=; b=BhncKASSXHzuvrL4X9UqLk88/OcyxJgYMYUTdGKUxWk5Rp+2kBZ47zIMvnWTPZ0hch Ti3rcCUsulVq9fOHZplJ8EkqVfyV+g3tNe+8UyKfmAeQGUUk5/BiWYOTOJ9EZ6YVLD0J 7bZRFhx/3Xk1gU3zWArTob9yUU1XMtxbl01nrjR5u82jLEd+xmFDX31lBkH83M+Sc/Ta H4hQatqVmqnfIzbrEJkFI3zMlivToYvf/HpJaTC0KWKhwEoWORdHL5665trFMNPRjHWd IKcYPQR4SGXelVgLy0lGNqZnyt5XkJ4dsdloP23NvGO3Y7F1yqt+E7lUVXJTDmRPsGB8 vgDA== X-Gm-Message-State: AC+VfDyJcRYWVeIXeRT5SJNC9U5JcCFxU8Jw7ndH9PPPSNr8ilgT5toj 0cERCAWv5qF3tWot56thadzpr41MbVsT2zA9mCc= X-Google-Smtp-Source: ACHHUZ70MxMV2M/Ly6LwzcAfW/4aZHCJ5K3VeTP1+UDzWazyo415hQ2spgj2pU1Euc2vg0PMYx8o9g== X-Received: by 2002:a6b:a0a:0:b0:758:edfb:3f76 with SMTP id z10-20020a6b0a0a000000b00758edfb3f76mr4436356ioi.17.1682709526326; Fri, 28 Apr 2023 12:18:46 -0700 (PDT) Received: from kea.bld.corp.google.com ([2620:15c:183:200:9261:21dc:edb:e426]) by smtp.gmail.com with ESMTPSA id l12-20020a0566380d8c00b0041407c67451sm1698811jaj.165.2023.04.28.12.18.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Apr 2023 12:18:46 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass , Bin Meng Subject: [PATCH 18/18] x86: coral: Adjust various config options Date: Fri, 28 Apr 2023 13:18:18 -0600 Message-ID: <20230428131814.18.I9026d132c84ec1bbaa14bd1eaec291c778375f35@changeid> X-Mailer: git-send-email 2.40.1.495.gc816e09b53d-goog In-Reply-To: <20230428191819.3070393-1-sjg@chromium.org> References: <20230428191819.3070393-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.8 at phobos.denx.de X-Virus-Status: Clean Add NVME support. Add ms so it is easier to search for tables in memory. Expand the command-line and print buffers so that we can deal with the very long ChromeOS command lines. (typically 700 characters). Enable BOOTSTD_FULL to get the full set of standard-boot options. Replace the existing manual script with 'bootflow scan', since it can find and boot the OS. Finally, expand the malloc() space so we can read large kernels into a bootflow. Signed-off-by: Simon Glass --- configs/chromebook_coral_defconfig | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/configs/chromebook_coral_defconfig b/configs/chromebook_coral_defconfig index f5995f22004..fe61153b93d 100644 --- a/configs/chromebook_coral_defconfig +++ b/configs/chromebook_coral_defconfig @@ -1,5 +1,6 @@ CONFIG_X86=y CONFIG_TEXT_BASE=0x1110000 +CONFIG_SYS_MALLOC_LEN=0x2000000 CONFIG_SYS_MALLOC_F_LEN=0x3d00 CONFIG_NR_DRAM_BANKS=8 CONFIG_MAX_CPUS=8 @@ -22,6 +23,7 @@ CONFIG_X86_OFFSET_U_BOOT=0xffd00000 CONFIG_X86_OFFSET_SPL=0xffe80000 CONFIG_INTEL_ACPIGEN=y CONFIG_INTEL_GENERIC_WIFI=y +CONFIG_BOOTSTD_FULL=y CONFIG_SYS_MONITOR_BASE=0x01110000 CONFIG_CHROMEOS=y CONFIG_BOOTSTAGE=y @@ -33,8 +35,10 @@ CONFIG_BOOTSTAGE_STASH=y CONFIG_USE_BOOTARGS=y CONFIG_BOOTARGS_SUBST=y CONFIG_USE_BOOTCOMMAND=y -CONFIG_BOOTCOMMAND="tpm init; tpm startup TPM2_SU_CLEAR; read mmc 0:2 100000 0 80; setexpr loader *001004f0; setexpr size *00100518; setexpr blocks $size / 200; read mmc 0:2 100000 80 $blocks; setexpr setup $loader - 1000; setexpr cmdline_ptr $loader - 2000; setexpr.s cmdline *$cmdline_ptr; setexpr cmdline gsub %U \\\\${uuid}; if part uuid mmc 0:2 uuid; then zboot start 100000 0 0 0 $setup cmdline; zboot load; zboot setup; zboot dump; zboot go;fi" +CONFIG_BOOTCOMMAND="tpm init; tpm startup TPM2_SU_CLEAR; bootflow scan -lb" CONFIG_SYS_CONSOLE_INFO_QUIET=y +CONFIG_LOG=y +CONFIG_LOGF_FUNC=y CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_LAST_STAGE_INIT=y CONFIG_BLOBLIST=y @@ -52,9 +56,11 @@ CONFIG_SPL_POWER=y CONFIG_TPL_SYS_MALLOC_SIMPLE=y CONFIG_TPL_POWER=y CONFIG_HUSH_PARSER=y -CONFIG_SYS_PBSIZE=532 +CONFIG_SYS_CBSIZE=1024 +CONFIG_SYS_PBSIZE=1024 CONFIG_CMD_CPU=y CONFIG_CMD_PMC=y +CONFIG_CMD_MEM_SEARCH=y CONFIG_CMD_GPIO=y CONFIG_CMD_I2C=y CONFIG_CMD_PART=y