From patchwork Mon Apr 16 20:32:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 133497 Delivered-To: patch@linaro.org Received: by 10.46.84.18 with SMTP id i18csp3974940ljb; Mon, 16 Apr 2018 13:36:46 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/jvr3OEtj7L042bs+0lUsuNw5cZ63VytsOzeXM1S1grvyL4504+iCyVhibvQd2DehHpMPT X-Received: by 10.80.175.196 with SMTP id h62mr34803974edd.102.1523911006171; Mon, 16 Apr 2018 13:36:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523911006; cv=none; d=google.com; s=arc-20160816; b=0yOAayPu2B2dpQJZA6COZ8J6WlWS2HHiUqbMA+tmdLahoCKyLB3RCW1HfeGo8bfewR udTpc6MMIhvdB6H+8FTQwYL02aJGbkE0JIuJ052ZexoZcjfcj1axc5f3dZOvXOxjZJtQ NMuASqllHwkfmY/FMC45vt9iCGllGmnvTumzyIUuq/SAYGj65rv5eJ3NHlVorBS8M+aO aYkZkewM8R4fhb97qSCG9x42SLuip3TiPcISKaV5MUsQ4Rc3bbXzV6xCiMrqkHg9E07/ dcRKBrOMU6/+Lx6sidHGGi3bepCtfzpqUZZohlal7KRLfo0l+73VLe42LBvBQ2CjfQKx 1/WA== 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:references:in-reply-to:message-id :date:to:from:dkim-signature:arc-authentication-results; bh=1g0p6xgIPYW4NTLnI0CCNsOTTXpzrBgcYB+5BmLhVrk=; b=JbuyiXv+uGji4syJ1MqnHBka+yJg5M5e54cZvjD9zNfYGyvydx15THn21doHDYYy5l eRrYccRLCxh9n3syRiPmyCptGpD7kQ4vHzPfIwYx5caveLfqxCnpqHRTIY1qCcGCYv/v 2J4KGp3STBGWerccy0nySZ/6fRXoSmLCSYdRb21szS8ZOfj82H3VZvmdM/DEnvqzBO+3 uXrW6//o0XeCeTlDl7y1/r4cCxi5KFsjB2NHZ8WL/sTpCslEI6lieFPZr7rby3g6lBcM DYOMFewTeNWBwd/KTzstwzfohgRgz81enLkko9YZDFsYmrZy118Jd7MPLir5HzDlheLH 5qqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=iGX27Bzs; 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 l92si2137561edl.455.2018.04.16.13.36.45; Mon, 16 Apr 2018 13:36:46 -0700 (PDT) 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=iGX27Bzs; 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 9174DC21E73; Mon, 16 Apr 2018 20:34:05 +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_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, 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 CEC5BC21DD7; Mon, 16 Apr 2018 20:33:41 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id BCEB0C21E35; Mon, 16 Apr 2018 20:32:46 +0000 (UTC) Received: from mail-lf0-f66.google.com (mail-lf0-f66.google.com [209.85.215.66]) by lists.denx.de (Postfix) with ESMTPS id 3DF43C21E26 for ; Mon, 16 Apr 2018 20:32:42 +0000 (UTC) Received: by mail-lf0-f66.google.com with SMTP id m202-v6so6796813lfe.8 for ; Mon, 16 Apr 2018 13:32:42 -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; bh=YMVrdhJ6wc1/COjsqX/ee2GhD6T9cqYulDdhsBfFSYk=; b=iGX27BzsUQXHjiWUQkCETIA4ipMPWbgS1sBlmz71xJw01ZJA5TpJI5vABW9htVJ5OE LaXvvU4WxaIBSDuJluZBKx5B7qVa4CLylL2Lkwq0vziUq0YY/Juz7lA8ttKOJIl135xW lnKpu8dQDaGUJXyZCGQ/95mG44hY3f3mZubpc= 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; bh=YMVrdhJ6wc1/COjsqX/ee2GhD6T9cqYulDdhsBfFSYk=; b=SH8WgYA4ezb3GjA7JgnbKFAcd4vQ8LKcCBDkQc7/eZgekgVpv0Z1O8ElxNyGMVi0sh SvUzAsxkMYSKA+uUaHkYje7+UEr/tOiJB3DMboQUX6sF6JlvbL0+0DkSJXEpfm6n1USu NdNYkvegGJx4qjv9JgUhy+arVqtwoMl3YfCLDlBmX+QIv3M/W0Zo4DigCLvRsM43H2Pb a+x36GtyYb3dfH13xfOyVoduRs0wGUlraEFsjW6D8u3V1sn/x0fPzxcpmZa6UjE19BNG /ejS5X50lb4WvaIQ0Ee7fBuPcx8L/8Aic6jhR2NJz/Bv9yaJQq8sCyngifFa/mkcCFbS oLYA== X-Gm-Message-State: ALQs6tDL2ZEwRFY8E7OI0r/3xWApoGWUEmZCVenQVjJgp6Jqp3hYcCgA mU5IpthBetDIe7mGT5boLkmxm5dR83A= X-Received: by 2002:a19:be4b:: with SMTP id o72-v6mr16143519lff.20.1523910761212; Mon, 16 Apr 2018 13:32:41 -0700 (PDT) Received: from localhost ([195.238.92.132]) by smtp.gmail.com with ESMTPSA id d24-v6sm2986959lfc.51.2018.04.16.13.32.40 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Apr 2018 13:32:40 -0700 (PDT) From: Sam Protsenko To: u-boot@lists.denx.de Date: Mon, 16 Apr 2018 23:32:27 +0300 Message-Id: <20180416203227.26523-6-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180416203227.26523-1-semen.protsenko@linaro.org> References: <20180416203227.26523-1-semen.protsenko@linaro.org> Cc: Amit Pundir , Tom Rini , Praneeth Bajjuri , John Stultz , Sumit Semwal Subject: [U-Boot] [PATCH 5/5] arm: ti: boot: Implement Android boot using DT image format 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" Make sure we can boot Android on TI boards using scheme described in Android documentation [1]. For this do next: 1. Enable "dtimg" command. We will need it to boot the Android using new DTB/DTBO image format. 2. Add fdt overlay support. We will need that to be able to apply fdt overlays to dtb file. 3. Provide new Android boot commands. In case we don't know what board it is, let's provide fallback mechanism: - use just dtb[0] from dtb.img - don't apply any dtbo files on top of it - but still that dtb file must be packed into Android DT image To use new boot scheme, user has to do next: 1. Prepare dtb.img and dtbo.img images, generated with mkdtimg tool (can be found in Android sources, see prebuilts/misc/linux-x86/libufdt). Example: $ ./mkdtimg create dtb.img \ am57xx-beagle-x15.dtb --id=0 \ am57xx-beagle-x15-revc.dtb --id=1 $ ./mkdtimg create dtbo.img \ am57xx-evm-common.dtbo --id=0 \ mt9t111.dtbo --id=1 \ ov10635.dtbo --id=2 \ am57xx-evm.dtbo --id=3 \ am57xx-evm-reva3.dtbo --id=4 Current boot commands rely on that specific order of dtb/dtbo files. Also, be sure to compile .dtb files with -@ dtc flag, so that overlays can be applied to dtb files. 2. Flash new U-Boot, set new environment and format eMMC: $ fastboot flash xloader MLO $ fastboot flash bootloader u-boot.img => env default -f -a => setenv partitions $partitions_android => env save => fastboot 1 $ fastboot oem format 3. Flash dtb.img, dtbo.img: $ fastboot flash dtb dtb.img $ fastboot flash dtbo dtbo.img 4. Flash Android images: $ fastboot flash boot boot.img $ fastboot flash cache cache.img $ fastboot flash recovery recovery.img $ fastboot flash system system.img $ fastboot flash userdata userdata.img $ fastboot flash vendor vendor.img For more detailed instructions, see [2]. [1] https://source.android.com/devices/architecture/dto/partitions [2] https://wiki.linaro.org/Boards/BeagleBoard-X15 Signed-off-by: Sam Protsenko --- board/ti/common/Kconfig | 1 + configs/am57xx_evm_defconfig | 1 + configs/am57xx_hs_evm_defconfig | 1 + configs/dra7xx_evm_defconfig | 1 + configs/dra7xx_hs_evm_defconfig | 1 + include/configs/ti_armv7_common.h | 1 + include/environment/ti/boot.h | 40 +++++++++++++++++++++++++------ 7 files changed, 39 insertions(+), 7 deletions(-) diff --git a/board/ti/common/Kconfig b/board/ti/common/Kconfig index c21eb8c2d2..f5bd9160b3 100644 --- a/board/ti/common/Kconfig +++ b/board/ti/common/Kconfig @@ -21,6 +21,7 @@ config TI_COMMON_CMD_OPTIONS imply CRC32_VERIFY if ARCH_KEYSTONE imply CMD_DFU if USB_GADGET_DOWNLOAD imply CMD_DHCP + imply CMD_DTIMG imply CMD_EEPROM imply CMD_EXT2 imply CMD_EXT4 diff --git a/configs/am57xx_evm_defconfig b/configs/am57xx_evm_defconfig index 6b11b3476c..7198542d9e 100644 --- a/configs/am57xx_evm_defconfig +++ b/configs/am57xx_evm_defconfig @@ -78,3 +78,4 @@ CONFIG_USB_GADGET=y CONFIG_USB_GADGET_MANUFACTURER="Texas Instruments" CONFIG_USB_GADGET_VENDOR_NUM=0x0451 CONFIG_USB_GADGET_PRODUCT_NUM=0xd022 +CONFIG_OF_LIBFDT_OVERLAY=y diff --git a/configs/am57xx_hs_evm_defconfig b/configs/am57xx_hs_evm_defconfig index ca9742f118..e4948d549b 100644 --- a/configs/am57xx_hs_evm_defconfig +++ b/configs/am57xx_hs_evm_defconfig @@ -81,3 +81,4 @@ CONFIG_USB_GADGET=y CONFIG_USB_GADGET_MANUFACTURER="Texas Instruments" CONFIG_USB_GADGET_VENDOR_NUM=0x0451 CONFIG_USB_GADGET_PRODUCT_NUM=0xd022 +CONFIG_OF_LIBFDT_OVERLAY=y diff --git a/configs/dra7xx_evm_defconfig b/configs/dra7xx_evm_defconfig index e17135c8f6..4ce687fbda 100644 --- a/configs/dra7xx_evm_defconfig +++ b/configs/dra7xx_evm_defconfig @@ -96,3 +96,4 @@ CONFIG_USB_GADGET=y CONFIG_USB_GADGET_MANUFACTURER="Texas Instruments" CONFIG_USB_GADGET_VENDOR_NUM=0x0451 CONFIG_USB_GADGET_PRODUCT_NUM=0xd022 +CONFIG_OF_LIBFDT_OVERLAY=y diff --git a/configs/dra7xx_hs_evm_defconfig b/configs/dra7xx_hs_evm_defconfig index 606f99938c..6546daa080 100644 --- a/configs/dra7xx_hs_evm_defconfig +++ b/configs/dra7xx_hs_evm_defconfig @@ -95,3 +95,4 @@ CONFIG_USB_GADGET=y CONFIG_USB_GADGET_MANUFACTURER="Texas Instruments" CONFIG_USB_GADGET_VENDOR_NUM=0x0451 CONFIG_USB_GADGET_PRODUCT_NUM=0xd022 +CONFIG_OF_LIBFDT_OVERLAY=y diff --git a/include/configs/ti_armv7_common.h b/include/configs/ti_armv7_common.h index 4771e74940..4340b5188f 100644 --- a/include/configs/ti_armv7_common.h +++ b/include/configs/ti_armv7_common.h @@ -43,6 +43,7 @@ "loadaddr=0x82000000\0" \ "kernel_addr_r=0x82000000\0" \ "fdtaddr=0x88000000\0" \ + "dtboaddr=0x89000000\0" \ "fdt_addr_r=0x88000000\0" \ "rdaddr=0x88080000\0" \ "ramdisk_addr_r=0x88080000\0" \ diff --git a/include/environment/ti/boot.h b/include/environment/ti/boot.h index f2d91f5298..52c9f129ed 100644 --- a/include/environment/ti/boot.h +++ b/include/environment/ti/boot.h @@ -65,15 +65,41 @@ "run eval_bootargs; " \ "setenv mmcdev 1; " \ "setenv machid fe6; " \ + "setenv dtbaddr $fdtaddr; " \ + "setenv dtb_size 0x100000; " \ "mmc dev $mmcdev; " \ "mmc rescan; " \ - "part start mmc ${mmcdev} dtb fdt_start; " \ - "part size mmc ${mmcdev} dtb fdt_size; " \ - "part start mmc ${mmcdev} boot boot_start; " \ - "part size mmc ${mmcdev} boot boot_size; " \ - "mmc read ${fdtaddr} ${fdt_start} ${fdt_size}; " \ - "mmc read ${loadaddr} ${boot_start} ${boot_size}; " \ - "bootm $loadaddr $loadaddr $fdtaddr;\0" + "part start mmc ${mmcdev} dtb p_dtb_start; " \ + "part size mmc ${mmcdev} dtb p_dtb_size; " \ + "part start mmc ${mmcdev} dtbo p_dtbo_start; " \ + "part size mmc ${mmcdev} dtbo p_dtbo_size; " \ + "part start mmc ${mmcdev} boot p_boot_start; " \ + "part size mmc ${mmcdev} boot p_boot_size; " \ + "mmc read ${dtbaddr} ${p_dtb_start} ${p_dtb_size}; " \ + "mmc read ${dtboaddr} ${p_dtbo_start} ${p_dtbo_size}; " \ + "mmc read ${loadaddr} ${p_boot_start} ${p_boot_size}; " \ + "if test $board_name = am57xx_evm; then " \ + "dtimg start ${dtbaddr} 0 dtb_addr; " \ + "fdt addr $dtb_addr $dtb_size; " \ + "dtimg start ${dtboaddr} 0 dtbo_addr; " \ + "fdt apply $dtbo_addr; " \ + "dtimg start ${dtboaddr} 3 dtbo_addr; " \ + "fdt apply $dtbo_addr; " \ + "elif test $board_name = am57xx_evm_reva3; then " \ + "dtimg start ${dtbaddr} 1 dtb_addr; " \ + "fdt addr $dtb_addr $dtb_size; " \ + "dtimg start ${dtboaddr} 0 dtbo_addr; " \ + "fdt apply $dtbo_addr; " \ + "dtimg start ${dtboaddr} 4 dtbo_addr; " \ + "fdt apply $dtbo_addr; " \ + "elif test $board_name = beagle_x15; then " \ + "dtimg start ${dtbaddr} 0 dtb_addr; " \ + "elif test $board_name = beagle_x15_revc; then " \ + "dtimg start ${dtbaddr} 1 dtb_addr; " \ + "else " \ + "dtimg start ${dtbaddr} 0 dtb_addr; " \ + "fi; " \ + "bootm $loadaddr $loadaddr $dtb_addr;\0" #ifdef CONFIG_OMAP54XX