Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D3DEAC001DF for ; Sun, 30 Jul 2023 17:19:29 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8D38886ABA; Sun, 30 Jul 2023 19:17:30 +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="Pddy5eh9"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B160286AAA; Sun, 30 Jul 2023 19:17:22 +0200 (CEST) Received: from mail-il1-x131.google.com (mail-il1-x131.google.com [IPv6:2607:f8b0:4864:20::131]) (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 3BBD98692D for ; Sun, 30 Jul 2023 19:17:19 +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-x131.google.com with SMTP id e9e14a558f8ab-3490a0bb5cdso11028705ab.2 for ; Sun, 30 Jul 2023 10:17:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1690737438; x=1691342238; 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=nxjDR3T0JMXqQLZZHWsqsGY9HDdbMASYsfrivc9mgQU=; b=Pddy5eh9WdHJMKKAEJb5PUP54CZ55Dt45qWy3dYYXjBMPVr5sMPLwSCEwlRB1KYEkx Zy0EcEZ4ausBE8PRVNM8IQH35xOjVUqgR2zbhmitXSBCfgbBbAYy+2/pq1eSS6LGYt6g LoFbZLfMjWyEEve6MYesA4SYn1NL7ShhkBdns= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690737438; x=1691342238; 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=nxjDR3T0JMXqQLZZHWsqsGY9HDdbMASYsfrivc9mgQU=; b=I+epNTCVw34m/4lO8/PzD9j/tbuD+FulFPoZ0ZQWMLhSwbm2diCvS60SUxgiVporOR 4F6wHYixpHpLs3a+ctmYyfN4NT6ggmVY9e2r9zAqjSOjffxJ0JCEyjq9a8A5NkqgRBHp 9SKMgNAn0fK5URygH0gYYJDNS3GNZD4pmgI/68BluYYu+77Cb4LVEXHV7t40Knsot7gD N+m3C4A+SivygLAXZAdKi7EbOAXiZz86c/qnRzmqgSP6GnzA0tY4W/kwb3uhi8aG894m STU9kCr3+InsQvMb9ht9Qhaypv3GAXAp1EVnpzTCADRslq2Sub6FS7n3Xp9k+subMIWb QSYQ== X-Gm-Message-State: ABy/qLYF2f/6OyLNTAcj3CU+2C3q0xKog8xydmPMgIHo6MRXtg0tPlFm P3PFvZlLzesZGHwAlHuj7AdG41pj24tDAWEVp88= X-Google-Smtp-Source: APBJJlHjSAiLsCBKHexBErw9XIQQqaPq3GuCfNx5MZhDRzY+k7/TBEexbxJcqYjagYNK8gJZAeOdNQ== X-Received: by 2002:a05:6e02:1292:b0:348:f3b3:164f with SMTP id y18-20020a056e02129200b00348f3b3164fmr6183119ilq.12.1690737437921; Sun, 30 Jul 2023 10:17:17 -0700 (PDT) Received: from sjg1.lan (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id b24-20020a02a598000000b0041cd626ea0csm2537412jam.147.2023.07.30.10.17.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Jul 2023 10:17:17 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Bin Meng , Alper Nebi Yasak , Simon Glass Subject: [PATCH 04/16] bootstd: cros: Support a kernel on either partition Date: Sun, 30 Jul 2023 11:16:50 -0600 Message-ID: <20230730171709.917352-5-sjg@chromium.org> X-Mailer: git-send-email 2.41.0.487.g6d72f3e995-goog In-Reply-To: <20230730171709.917352-1-sjg@chromium.org> References: <20230730171709.917352-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 ChromiumOS allows a kernel to be on either partition 2 or 4. Add support for scanning both and using the first one we find with a suitable signature. Record the partition which is used. Signed-off-by: Simon Glass --- boot/bootmeth_cros.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/boot/bootmeth_cros.c b/boot/bootmeth_cros.c index 385eca37381c..7b25042bfe56 100644 --- a/boot/bootmeth_cros.c +++ b/boot/bootmeth_cros.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -133,7 +134,7 @@ static int cros_read_bootflow(struct udevice *dev, struct bootflow *bflow) struct disk_partition info; const char *uuid = NULL; void *buf, *hdr; - int ret; + int part, ret; log_debug("starting, part=%d\n", bflow->part); @@ -141,13 +142,19 @@ static int cros_read_bootflow(struct udevice *dev, struct bootflow *bflow) if (bflow->part) return log_msg_ret("max", -ENOENT); - /* Check partition 2 */ - ret = scan_part(bflow->blk, 2, &info, &hdr); - if (ret) - return log_msg_ret("scan", ret); - bflow->part = 2; + /* Check partition 2 then 4 */ + part = 2; + ret = scan_part(bflow->blk, part, &info, &hdr); + if (ret) { + part = 4; + ret = scan_part(bflow->blk, part, &info, &hdr); + if (ret) + return log_msg_ret("scan", ret); + } + bflow->part = part; - log_info("Header at %lx\n", (ulong)map_to_sysmem(hdr)); + log_info("Selected parition %d, header at %lx\n", bflow->part, + (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); -- 2.41.0.487.g6d72f3e995-goog