From patchwork Wed Oct 23 14:34:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 1182211 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="V4Gra+NG"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 46ytJ142nFz9sPV for ; Thu, 24 Oct 2019 01:37:21 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 4206CC21E15; Wed, 23 Oct 2019 14:36:10 +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 0E7C3C21DAF; Wed, 23 Oct 2019 14:35:16 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id BB98DC21D83; Wed, 23 Oct 2019 14:34:44 +0000 (UTC) Received: from mail-lj1-f194.google.com (mail-lj1-f194.google.com [209.85.208.194]) by lists.denx.de (Postfix) with ESMTPS id 7E535C21DAF for ; Wed, 23 Oct 2019 14:34:43 +0000 (UTC) Received: by mail-lj1-f194.google.com with SMTP id m7so21399202lji.2 for ; Wed, 23 Oct 2019 07:34:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=OC7gHyuc76QVEyxiu7Teh+4DvTPGtwzGp0lMpeLiROI=; b=V4Gra+NG03ccMl7xWeU9wtbCjpt7ejkgt0u9igA9tXr3XNYtvb/QTQR90cnn1rFWRq bTGjPzbQmqk3GXfmA5jzeqe1OAB62kE804YRgxoBATbcXhLn+YNKCZgWa6RanJksXId2 vN1DziHPRN/vr5C7Cyx6bbQQG95Q37+UNMfxLGXVKRZufvBc2hyV8v0Vk6vXHFxiYq6i /Ghb+362T2WznmBUyknj4Fa4Smv4zJIWFO18YFDUK+tyOEKKCtK6cdsa6Q1pxvXIQdrC 1r92iNNQC81ccq58Ydy+Z+g33IH/OLcEJNrN8SlvDARwuVE9beovUMFi+Pq+S5G8Lthg wn3w== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=OC7gHyuc76QVEyxiu7Teh+4DvTPGtwzGp0lMpeLiROI=; b=bFbjw8XI0GoGEWO2jjFOdNdDuQvRKh6luxTNVsDZIcz08VpEf8Oakeo5MMrS3c3e8z YpGmJB10xK3oLL8NlAMpCGr7Ik0OgsJQ1HKlN7nv4qmUidWAn+weKvaFkMB8+3M9ZJ87 BjRa1NUsuFmlajgKGoSsGj08Yu2r4rcHpHeKJkohW9zMpPcySifJ7W2bHTXkBtZEPE3v ZIpRNOQNQz5f/l7vYj806xwMVbGkDsmEBMWbDONzhcTQNpndSG9BbNP5ofVCRJEsbZTc CmCPduiMEobF4hC2/ocBSsf0++w36KgDK2gBayHcBXK33hp3ufnmzF9NfTsifQ0ZSHwX gQXQ== X-Gm-Message-State: APjAAAVB1gf1KXNs9AI9cMIIcj0zWwt57ZkeeB7x5M54Dq4A+7wG1xm8 LHYZvjdXjaGCzPtFuQ7eMSd5yocR/ys= X-Google-Smtp-Source: APXvYqzG1iQ921mH5h0olllRjJlGnwaJ6ZhZzFI/0fjHuRQ/3wAgHwDzSpYROEVtbqJyzYsj4WRvTA== X-Received: by 2002:a2e:86cd:: with SMTP id n13mr16210652ljj.252.1571841281999; Wed, 23 Oct 2019 07:34:41 -0700 (PDT) Received: from localhost (94.179.226.44.pool.3g.utel.ua. [94.179.226.44]) by smtp.gmail.com with ESMTPSA id z26sm8981811lji.79.2019.10.23.07.34.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2019 07:34:41 -0700 (PDT) From: Sam Protsenko To: U-Boot Mailing List Date: Wed, 23 Oct 2019 17:34:26 +0300 Message-Id: <20191023143427.10865-8-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191023143427.10865-1-semen.protsenko@linaro.org> References: <20191023143427.10865-1-semen.protsenko@linaro.org> MIME-Version: 1.0 Cc: adelva@google.com, Alex Deymo , Eugeniu Rosca , Praneeth Bajjuri , Mykhailo Sopiha Subject: [U-Boot] [PATCH v2 7/8] env: ti: boot: Boot Android with dynamic partitions 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Changes: - use boot.img instead of boot_fit.img - use .dtb from boot.img v2 - implement recovery boot - always boot ramdisk from boot.img, we can't mount system as root now, as system is a logical partition inside of super partition - don't add "skip_initramfs" to cmdline anymore - to boot into recovery, use boot image from recovery partition - prepare partition table: - A/B scheme - use 'super' partition instead of 'system' and 'vendor' - add dtbo partitions - introduce metadata partition Not implemented: reading and applying dtbo files from dtbo partition. Signed-off-by: Sam Protsenko --- Changes in v2: - rebase on top of master include/environment/ti/boot.h | 105 +++++++++++++--------------------- 1 file changed, 41 insertions(+), 64 deletions(-) diff --git a/include/environment/ti/boot.h b/include/environment/ti/boot.h index da99215fbd..a7644a5874 100644 --- a/include/environment/ti/boot.h +++ b/include/environment/ti/boot.h @@ -13,28 +13,6 @@ #define CONSOLEDEV "ttyS2" #endif -#define VBMETA_PART_SIZE (64 * 1024) - -#if defined(CONFIG_LIBAVB) -#define VBMETA_PART \ - "name=vbmeta,size=" __stringify(VBMETA_PART_SIZE) \ - ",uuid=${uuid_gpt_vbmeta};" -#else -#define VBMETA_PART "" -#endif - -#if defined(CONFIG_CMD_AB_SELECT) -#define COMMON_PARTS \ - "name=boot_a,size=20M,uuid=${uuid_gpt_boot_a};" \ - "name=boot_b,size=20M,uuid=${uuid_gpt_boot_b};" \ - "name=system_a,size=1024M,uuid=${uuid_gpt_system_a};" \ - "name=system_b,size=1024M,uuid=${uuid_gpt_system_b};" -#else -#define COMMON_PARTS \ - "name=boot,size=20M,uuid=${uuid_gpt_boot};" \ - "name=system,size=1024M,uuid=${uuid_gpt_system};" -#endif - #ifndef PARTS_DEFAULT /* Define the default GPT table for eMMC */ #define PARTS_DEFAULT \ @@ -49,10 +27,15 @@ "name=bootloader,size=2048K,uuid=${uuid_gpt_bootloader};" \ "name=uboot-env,start=2432K,size=256K,uuid=${uuid_gpt_reserved};" \ "name=misc,size=128K,uuid=${uuid_gpt_misc};" \ - "name=recovery,size=40M,uuid=${uuid_gpt_recovery};" \ - COMMON_PARTS \ - "name=vendor,size=256M,uuid=${uuid_gpt_vendor};" \ - VBMETA_PART \ + "name=boot_a,size=20M,uuid=${uuid_gpt_boot_a};" \ + "name=boot_b,size=20M,uuid=${uuid_gpt_boot_b};" \ + "name=dtbo_a,size=8M,uuid=${uuid_gpt_dtbo_a};" \ + "name=dtbo_b,size=8M,uuid=${uuid_gpt_dtbo_b};" \ + "name=vbmeta_a,size=64K,uuid=${uuid_gpt_vbmeta_a};" \ + "name=vbmeta_b,size=64K,uuid=${uuid_gpt_vbmeta_b};" \ + "name=recovery,size=64M,uuid=${uuid_gpt_recovery};" \ + "name=super,size=2560M,uuid=${uuid_gpt_super};" \ + "name=metadata,size=16M,uuid=${uuid_gpt_metadata};" \ "name=userdata,size=-,uuid=${uuid_gpt_userdata}" #endif /* PARTS_DEFAULT */ @@ -72,7 +55,7 @@ #define CONTROL_PARTITION "misc" #if defined(CONFIG_CMD_AB_SELECT) -#define AB_SELECT \ +#define AB_SELECT_SLOT \ "if part number mmc 1 " CONTROL_PARTITION " control_part_number; " \ "then " \ "echo " CONTROL_PARTITION \ @@ -82,18 +65,12 @@ "echo " CONTROL_PARTITION " partition not found;" \ "exit;" \ "fi;" \ - "setenv slot_suffix _${slot_name};" \ - "if part number mmc ${mmcdev} system${slot_suffix} " \ - "system_part_number; then " \ - "setenv bootargs_ab " \ - "ro root=/dev/mmcblk${mmcdev}p${system_part_number} " \ - "rootwait init=/init skip_initramfs " \ - "androidboot.slot_suffix=${slot_suffix};" \ - "echo A/B cmdline addition: ${bootargs_ab};" \ - "setenv bootargs ${bootargs} ${bootargs_ab};" \ - "else " \ - "echo system${slot_suffix} partition not found;" \ - "fi;" + "setenv slot_suffix _${slot_name};" + +#define AB_SELECT_ARGS \ + "setenv bootargs_ab androidboot.slot_suffix=${slot_suffix}; " \ + "echo A/B cmdline addition: ${bootargs_ab};" \ + "setenv bootargs ${bootargs} ${bootargs_ab};" #else #define AB_SELECT "" #endif @@ -121,46 +98,46 @@ "setenv mmcroot /dev/mmcblk0p2 rw; " \ "run mmcboot;\0" \ "emmc_android_boot=" \ + "setenv mmcdev 1; " \ + "mmc dev $mmcdev; " \ + "mmc rescan; " \ + AB_SELECT_SLOT \ "if bcb load " __stringify(CONFIG_FASTBOOT_FLASH_MMC_DEV) " " \ CONTROL_PARTITION "; then " \ + "setenv ardaddr -; " \ "if bcb test command = bootonce-bootloader; then " \ - "echo BCB: Bootloader boot...; " \ + "echo Android: Bootloader boot...; " \ "bcb clear command; bcb store; " \ FASTBOOT_CMD \ + "exit; " \ "elif bcb test command = boot-recovery; then " \ - "echo BCB: Recovery boot...; " \ - "echo Warning: recovery is not implemented; " \ - "echo Performing normal boot for now...; " \ - "bcb clear command; bcb store; " \ - "run emmc_android_normal_boot; " \ + "echo Android: Recovery boot...; " \ + "setenv ardaddr $loadaddr;" \ + "setenv apart recovery; " \ "else " \ - "echo BCB: Normal boot requested...; " \ - "run emmc_android_normal_boot; " \ + "echo Android: Normal boot...; " \ + "setenv ardaddr $loadaddr; " \ + "setenv apart boot${slot_suffix}; " \ "fi; " \ "else " \ "echo Warning: BCB is corrupted or does not exist; " \ - "echo Performing normal boot...; " \ - "run emmc_android_normal_boot; " \ - "fi;\0" \ - "emmc_android_normal_boot=" \ - "echo Trying to boot Android from eMMC ...; " \ - "run update_to_fit; " \ + "echo Android: Normal boot...; " \ + "fi; " \ "setenv eval_bootargs setenv bootargs $bootargs; " \ "run eval_bootargs; " \ - "setenv mmcdev 1; " \ "setenv machid fe6; " \ - "mmc dev $mmcdev; " \ - "mmc rescan; " \ AVB_VERIFY_CHECK \ - AB_SELECT \ - "if part start mmc ${mmcdev} boot${slot_suffix} boot_start; " \ - "then " \ - "part size mmc ${mmcdev} boot${slot_suffix} " \ - "boot_size; " \ - "mmc read ${loadaddr} ${boot_start} ${boot_size}; " \ - "bootm ${loadaddr}#${fdtfile}; " \ + AB_SELECT_ARGS \ + "if part start mmc $mmcdev $apart boot_start; then " \ + "part size mmc $mmcdev $apart boot_size; " \ + "mmc read $loadaddr $boot_start $boot_size; " \ + "bootimg get_dtb_file 0 dtb_start dtb_size; " \ + "cp.b $dtb_start $fdtaddr $dtb_size; " \ + "fdt addr $fdtaddr; " \ + "bootm $loadaddr $ardaddr $fdtaddr; " \ "else " \ - "echo boot${slot_suffix} partition not found; " \ + "echo $apart partition not found; " \ + "exit; " \ "fi;\0" #ifdef CONFIG_OMAP54XX