From patchwork Tue Nov 27 19:57:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ruslan Trofymenko X-Patchwork-Id: 152162 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp215706ljp; Tue, 27 Nov 2018 12:10:37 -0800 (PST) X-Google-Smtp-Source: AFSGD/XcE5jaPShrR1y5qWVp20MjcoSiO6F9U6eGBe2RaHrU/wiN03hP2UzwlxOP++oiU0ahDFdX X-Received: by 2002:a50:a125:: with SMTP id 34mr9474257edj.175.1543349437291; Tue, 27 Nov 2018 12:10:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543349437; cv=none; d=google.com; s=arc-20160816; b=J2VD5ccWhFcJkIAOyaY6T12Eztqvuat1d5ezpNpjD7hrSMSOfTTNjBaOxFvDrG/KrM CVxm5xJD8mS8idemqirg2O3q+QNsXh9KzQHrm2nAHltNTiGH8d5kYLYnk/7IMVewby8J F2rTvQ69NaeNT/1jNoJ6hIrQvGomiIiRnBrMPAnCdkvUCvhntqnZRcKrA9KSfkZk+8wK M/L0Fgk/8hQBb9xbakLA+grQaKPW6QTGCM1rzvwup0pdizZ8BNNAJ1CugvsGnaIdpXB8 LnhKpLUyJZtQymhfNu3nHdu1Pdt4RzkTQnKYtl2totX0VZonzfnwrRkOAZgkBVXxRXqc PdDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:message-id:date:to:from :dkim-signature; bh=ObCdVdMAh6FFcsl5CC96jcHKpWynTUYMrtNd7zjkYN0=; b=IxTCzDGGVxYRNMcIB9Pufbi1ssx1DkytqUmbY/gM2epCKeoYauMPdO1eUNWozf07ah cetaQMRFPzneXVmFGkNJN9JmQKakO4RsIlTIs+66uDPswLu0EZI7QbsCZx3K1AOHGr5v rQjiCyhL72c8o1VAIByPoG+C62XsRPG8cFzibzxs4mk3dkd8SiSNjgH6mYMfNi9ISmOB SnXgfIJYYpHqWe5+g8zTeGemZTtIerWzV7mUTulSs65cSyZDtUZYOncklBUB/ekhgLhE VVqlXE2PUUVcsswRFkj8BwEh/WFEKMEtRMYdrTUXjSsb1IKADBo+bjBrlB+s/je+MTRO 7GJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=NEFN8PP8; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id o9si225609edr.334.2018.11.27.12.10.36; Tue, 27 Nov 2018 12:10:37 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=NEFN8PP8; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.denx.de (Postfix, from userid 105) id CEE38C220DB; Tue, 27 Nov 2018 20:10:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_MSPIKE_H2, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id CBE8EC21EAE; Tue, 27 Nov 2018 20:10:31 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 091EAC21EAE; Tue, 27 Nov 2018 19:57:25 +0000 (UTC) Received: from mail-lf1-f66.google.com (mail-lf1-f66.google.com [209.85.167.66]) by lists.denx.de (Postfix) with ESMTPS id 93B48C21DD7 for ; Tue, 27 Nov 2018 19:57:25 +0000 (UTC) Received: by mail-lf1-f66.google.com with SMTP id e26so17537835lfc.2 for ; Tue, 27 Nov 2018 11:57:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=eI5rwNQp6bcl3auroPMFgkzaSQ3NVabvxxeuywOPwao=; b=NEFN8PP8KR8vk6l0+lCFctM/gNp3xxOogaDafSe9fXl/Ifsi6a6YCZlVIqv9Hbwy5c N3nCSs11UspZkv+/GTSPv1evq7BUnn5KUm94kwCtql9VxVANsVLUklT4euSGdFKfTZzg a0yYQom31MXHNa/y3NOlSZjzRPbdMNMN1G59c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=eI5rwNQp6bcl3auroPMFgkzaSQ3NVabvxxeuywOPwao=; b=HLsCm7PLTCRzrxT0kn2fig1ps1n0VeYQWspm+twXXxv0yyof/fuW16YxLA6BU1LV87 vfnlGW2tQvw0dVCQ1PiNZpbUCmoBRbTfBb8nHK5HFUmms2GpYbRjtj3jew0HC+EF9K7B 9hur6PwIXDcxDFiMVDZtbsj+vN4yaucHpftyKhQGf9Qe0yfqeRZ3qwdXvWOptkdO9XCI lvCKchx0F7w2d5B1UUnW8WYvylSazvQdouzCpu34ICRugrNGFXFHkXuNZ6QKCRl96N6n BAq5ey+EUBwC7MnjXHrXYo2Zii3Qqu1TueLKlN5zGyutAjYwyyk5/lQMY6n9lILUGGKX qGTQ== X-Gm-Message-State: AGRZ1gJ+XcuxAIlcdZ92fKXYD0oLo1QD1ZgELJAawblggBN2VaCd+xEN xPFlIFLvk9dNEUqm51Z1c9Cc1wSs3wE= X-Received: by 2002:a19:6719:: with SMTP id b25mr18353810lfc.38.1543348644567; Tue, 27 Nov 2018 11:57:24 -0800 (PST) Received: from kbp1-dhp-f54913.synapse.com ([195.238.92.132]) by smtp.gmail.com with ESMTPSA id g12-v6sm738725lja.74.2018.11.27.11.57.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 27 Nov 2018 11:57:24 -0800 (PST) From: Ruslan Trofymenko To: u-boot@lists.denx.de Date: Tue, 27 Nov 2018 21:57:15 +0200 Message-Id: <1543348642-31045-1-git-send-email-ruslan.trofymenko@linaro.org> X-Mailer: git-send-email 2.7.4 X-Mailman-Approved-At: Tue, 27 Nov 2018 20:10:30 +0000 Cc: Tom Rini , Praneeth Bajjuri , Alistair Strachan Subject: [U-Boot] [PATCH 0/7] android: Implement A/B boot process X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" This patch series adds support for Android A/B boot process [1]. Main steps of A/B boot process are: - A/B metadata integrity check - looking for the current slot (where the system should be booting from) - getting the name of the current boot partition (boot_a or boot_b) and loading the corresponding Android boot image - getting the name of the current system partition (system_a or system_b) and passing of its full name via kernel command line (like 'root=/dev/mmcblk1p11') - passing current slot via kernel command line (like 'androidboot.slot_suffix=_a') and via A/B metadata (e.g. via misc partition) - A/B metadata processing: setting the boot success flag for current slot, handling the retry counter, etc A/B metadata is organized according to Android reference [2] and stored on 'misc' partition. On the first A/B boot process, when 'misc' partition doesn't contain required data, default A/B metadata will be created and stored in 'misc' partition. In the end of the Android boot, 'update_verifier' and 'update_engine' services are processing the A/B metadata through the Boot Control HAL. To confirm the boot was successful using current slot, "boot success" flag must be set on Android side. To enable Android A/B support in U-Boot: 1. Set the following config options: CONFIG_ANDROID_AB=y CONFIG_CMD_ANDROID_AB_SELECT=y 2. Change the disk layout so that it has sloted boot partitions. E.g. instead of 'boot' and 'system' partitions there should be 'boot_a', 'boot_b', 'system_a' and 'system_b' partitions. To be able to actually test this patch series, the A/B features must be implemented and enabled in Android as well (see [1] for details). Documentation and corresponding test for A/B boot is present here. The last patch in this series integrates A/B boot support on AM57xx based boards (though it's not enabled by default). Future users of A/B boot feature can use it as a reference. This series is a part of previous submission [3] by Alex Deymo. It contains only A/B feature that was stripped out from there with some modifications for using with "bootm" command preferred in upstream. [1] https://source.android.com/devices/tech/ota/ab/ab_implement [2] bootable/recovery/bootloader_message/include/bootloader_message/bootloader_message.h [3] https://lists.denx.de/pipermail/u-boot/2017-April/285841.html Ruslan Trofymenko (7): cmd: part: Add 'number' sub-command disk: part: Extend API to get partition info common: Implement A/B metadata cmd: Add 'android_ab_select' command test/py: Add base test case for A/B updates doc: android: Add simple guide for A/B updates env: am57xx: Implement A/B boot process cmd/Kconfig | 11 ++ cmd/Makefile | 1 + cmd/android_ab_select.c | 53 +++++++ cmd/part.c | 16 +- common/Kconfig | 10 ++ common/Makefile | 1 + common/android_ab.c | 278 +++++++++++++++++++++++++++++++++++ configs/sandbox_defconfig | 2 + disk/part.c | 68 +++++++++ doc/README.android-ab | 67 +++++++++ include/android_ab.h | 34 +++++ include/android_bootloader_message.h | 164 +++++++++++++++++++++ include/environment/ti/boot.h | 44 +++++- include/part.h | 21 +++ test/py/tests/test_ab.py | 74 ++++++++++ 15 files changed, 839 insertions(+), 5 deletions(-) create mode 100644 cmd/android_ab_select.c create mode 100644 common/android_ab.c create mode 100644 doc/README.android-ab create mode 100644 include/android_ab.h create mode 100644 include/android_bootloader_message.h create mode 100644 test/py/tests/test_ab.py Reviewed-by: Alistair Strachan Reviewed-by: Sam Protsenko