From patchwork Tue Jan 25 13:55:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ying-Chun Liu X-Patchwork-Id: 536485 Delivered-To: patch@linaro.org Received: by 2002:ac0:f7d2:0:0:0:0:0 with SMTP id i18csp3731521imr; Tue, 25 Jan 2022 05:55:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJwQJ791cuWmbdEQkSfmmlzoz16vYvZQH4dToz5IdhPbB5w+dttU13xk1WxW+n6GF8ET+SbA X-Received: by 2002:a17:906:5d0f:: with SMTP id g15mr16106722ejt.670.1643118955016; Tue, 25 Jan 2022 05:55:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643118955; cv=none; d=google.com; s=arc-20160816; b=bo6GTuY8ABUbLlaiKKJmZu+rXkd6jUHzsUtvo3L9iXlD5/quQGe/zuxuTpxulQk1rj E7cKHeflYyPUd5qHlGfu9GNAfS4NSgV8r1xUr+oQw1HLRV/fh55A36HkEHmOPfwmo/Fa Qvsc4e56XP9ZmKTXsqD0FWsnScSVpz2cnzA1P5Zd2wE/GRc3gMnAi2lkKQ8lst/5rZY+ CNr85n9dL3WIfEh1i0YiWv4aGljqyx8Nvyrs30lieaWVbZIH5aXAAKzXZP5dHWrmSxSR 4089spGde9MbQdlRCLEO64EvMAiQo+RnXVT9uPmmHAgd7nqAES8Q0jx92tn+QAMUav6Y VRSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=JuRGyAfV86pKpTEfieec0z7Vs41ki8ATKFj/x+5CxCk=; b=cEHQ8F6ypKxv+igmhsKcrpIArSMTznXoNIueJ8om39FYaGlpZvXY0D8Bd79U5gSN7y E1R2Tq41h8inhcbUMJxS6K6ZLDO+7TU1dydyI8BaB9/CCUc8gtZdhAke5I7Xow7h45Wi u0cvM2r8n1yphuDbE+PKVp08H+kpolW1PnhD4UoPLR8Fm2wjZBY63ygpfFAiolbdonU3 ZTB6vq7udSfa37RKHfBcKE180hFwSdygXNhTOnOylqzy1fr9xlSVJBz/53bq8zo+kh7S kxIMBFkgEF/k0EInO/3TyPUIH1pZ3IcLsR0MzGLcmhR3tHFenlCS+bBTDHNxNiaw7qNz XKvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=KNWryamE; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id js3si6221852ejc.206.2022.01.25.05.55.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jan 2022 05:55:55 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=KNWryamE; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8BC50833C2; Tue, 25 Jan 2022 14:55:51 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="KNWryamE"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C2EC48331E; Tue, 25 Jan 2022 14:55:49 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) (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 0913E80F9E for ; Tue, 25 Jan 2022 14:55:47 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=grandpaul@gmail.com Received: by mail-pj1-x1030.google.com with SMTP id g9-20020a17090a67c900b001b4f1d71e4fso2880426pjm.4 for ; Tue, 25 Jan 2022 05:55:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=JuRGyAfV86pKpTEfieec0z7Vs41ki8ATKFj/x+5CxCk=; b=KNWryamE2/zyzUUC5LOqZUpiNm4kUQM4pmOUK/jFc1dNImqMZI96vBkZqFsXvGTqJe Y8tNNPxiCTwyFfSSIy9kIcZVvTuhGJplwPtqclnlGbOTl73MCcCI1JFIg/vM5RyC25vQ wjs4B/3NKZck+59YgWsGRkMZmDO8ZuIhLs5oj5oMPDi7/n2hVuccH13tL/OKTP/2O9jg 6CLm7JnJ55tSaZntaxX/l1c1/hYjk5uSDWPTRuRv8PNY4cZoYvYbD+nyQbdldRgN9ssL k1gQ7vdri+7SEK0wvZCxd6KkKCCXpEtyk3TpWvAAW0ymkOiRjH/emEcQ/WM3dwWd2AHy 6zwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=JuRGyAfV86pKpTEfieec0z7Vs41ki8ATKFj/x+5CxCk=; b=2hGCqWSdM7v0UKYwkWVef8646jBjuhuDzP2o9sWmtVFDr32PQYu4b8+9ljIWn+n8Ar Wzvlpu4uxCkaBe+nyb+ayR21fyhqdqQSeJevkJ6wFu5t0+5CPRJNtvnH62AALIEjXUe5 9k9u06pQYvQMAyjk09CaNMre8gP/jfzb8oiTzbVk9NWpTqTYVIPMMEGxG41SvL3FQbAF RSWehwR/4pQgxjEV8HO5mOaRFQEPh5RycjyH135qJZWvL2byZVZvqp5DseBIJVBjFZrU 5QunwykDzIsCeanTTJSKvJgxJAYtf5zjXhhYEn1ShdvaH7l1Mry6Elkgr++tXjhbDtkI M/uA== X-Gm-Message-State: AOAM530RO477B5osbnXiWdaTkqNvqFmetsWhraXmBOTLAYLymMr2rK8Y ABmN8wbUX0UszsDb8rbjzp/wgiomxSc= X-Received: by 2002:a17:902:f24a:b0:14a:f56d:8acb with SMTP id j10-20020a170902f24a00b0014af56d8acbmr19175412plc.91.1643118944824; Tue, 25 Jan 2022 05:55:44 -0800 (PST) Received: from localhost (host-111-184-129-17.dynamic.kbtelecom.net. [111.184.129.17]) by smtp.gmail.com with ESMTPSA id f9sm1685108pgj.92.2022.01.25.05.55.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jan 2022 05:55:44 -0800 (PST) From: Ying-Chun Liu To: u-boot@lists.denx.de Cc: "Ying-Chun Liu (PaulLiu)" Subject: [RFC 0/2] A/B firmware update based in eMMC boot partition. Date: Tue, 25 Jan 2022 21:55:33 +0800 Message-Id: <20220125135535.224061-1-grandpaul@gmail.com> X-Mailer: git-send-email 2.34.1 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.5 at phobos.denx.de X-Virus-Status: Clean From: "Ying-Chun Liu (PaulLiu)" Hi all, I've implemented A/B firmware update based on eMMC hw partitions. Normally we have 2 boot partitions on eMMC. One is active and another is inactive. We can then flash the firmware to the inactive one and make it active. Also when booting we can write protect the current active one. And left the inactive partition still writable. So I make 2 commits that implements the following features: 1. Write protect "active" boot area when board init. 2. flash firmware to inactive boot area. 3. Change the inactive boot area after firmware update. Thanks. Ying-Chun Liu (PaulLiu) (2): drivers: mmc: write protect active boot area after mmc init. drivers: dfu: flash firmware to inactive boot area and active it drivers/dfu/dfu_mmc.c | 32 +++++++++++++++++++++--- drivers/mmc/Kconfig | 10 ++++++++ drivers/mmc/mmc.c | 58 +++++++++++++++++++++++++++++++++++++++++++ include/dfu.h | 1 + 4 files changed, 98 insertions(+), 3 deletions(-)