From patchwork Mon Apr 16 20:32:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 133493 Delivered-To: patch@linaro.org Received: by 10.46.84.18 with SMTP id i18csp3972297ljb; Mon, 16 Apr 2018 13:33:41 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+x8btA2IBwfN0vLArK0g2gYBobvzOynkoJCfrd+M6BSyZ7JQl4+tOkkPXPb3VpdjdhFf82 X-Received: by 10.80.181.227 with SMTP id a90mr28335719ede.55.1523910821003; Mon, 16 Apr 2018 13:33:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523910820; cv=none; d=google.com; s=arc-20160816; b=b9CDyT+XZsvCWYNfFx726Bt7mMjcSOxSvecuhRHx1cIAA1DDsV8vQzdsuVC6rU2q4G uX02LUMTqOBe0yv7xAQovOGFE/4ot7OclY7GjFTjdcnGDI2woeUlliRY6XTbymxqC6AS IljyZL9z3WMNztRwyieV/YajNIHVgdbzq0lK+ssZE+BqFS3vSAXzvtVX7iLTmzJD3/bN baDMIN4V5WP5/8lT0Bk3BWMd1w4e9za3z4xeofoSwWca6seBAEcjpcU8WIFqHH+zffLw OtPAc8VF0Gkp9ogO6TJw16LZA0+/brPN631VrheAl3l1NJUpUUmB2ALMSKKhWGb1H2rY 3bDw== 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=Ie5LukCjVOysCjuovqpIyxKbWnNef1wfFXXZA7GwdT0=; b=RT1gzaPnafWsA8z0vn6IN1Dq11a0UMDnryEiY7/MEkLckXkc8/z8IeFeSim4ccsT73 71U7jQeEh78T2eyroUJDxFias5sZDJZ6nQSMBxPUnWPr3aMJsPOPT1c2mxIj1y47Rb4z 2bWXra9/5+EYWihdy4hSy3USvSlojDyz7VEsxmleNpmtkElNYjCzLhI2OjwdYT+o/JzW Oikry/z0lOkuD8f2ufSYv4/2dMcIle6OOxHa8dMUYnPV13Sdq14QrN537pN3tnt7U8pQ 5VbQqrmF5Q852Nx8HXj3a0mKF23NgSa8APCCJC+KTByL3mawS6ruvvKRGuceaZlKzUPp yYjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=YSkFrTxw; 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 m41si3239608edc.25.2018.04.16.13.33.40; Mon, 16 Apr 2018 13:33:40 -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=YSkFrTxw; 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 5BD44C21E35; Mon, 16 Apr 2018 20:32:55 +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 6225CC21E35; Mon, 16 Apr 2018 20:32:37 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id B01E3C21D4A; Mon, 16 Apr 2018 20:32:34 +0000 (UTC) Received: from mail-lf0-f67.google.com (mail-lf0-f67.google.com [209.85.215.67]) by lists.denx.de (Postfix) with ESMTPS id E306CC21C27 for ; Mon, 16 Apr 2018 20:32:33 +0000 (UTC) Received: by mail-lf0-f67.google.com with SMTP id g203-v6so24034688lfg.11 for ; Mon, 16 Apr 2018 13:32:33 -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=Q8bvUv2q7LxZPTwcgDVbvQsotO60/gZjqz08Xuymf+4=; b=YSkFrTxwKiyTuxFUp06KZk1VDyclB1eh4/d2F6OhebjLGrIEbUqYv4CMog8sk89f+3 +07Q98MmydodzUjQ5a8jfLSNryJoPY+o1ZFalcTl8ClFj0NK7pEE5CgzKZQHaQBAbRbG qnFHAmbOsrdI4gvdHb+7rtvac4tmg1BSfmLWQ= 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=Q8bvUv2q7LxZPTwcgDVbvQsotO60/gZjqz08Xuymf+4=; b=LRaWG1WWcR1Tvc5/jnJq0YdkOTWff/kImg5ysuvv5ptx4CxmnfSl9MNIi/NdClAuMl ZlO/z0JONPoznUO1DDK39x6k4k7RLQSqRARnUYc/nfTMKxOT2rpnGQiN5N4AqDWVvLSY kdlUECwwEmTs02QHYI9T5hdAZu8yS4er/k69+oy2yv4hh981mBcxwu804km3BWgGLglE kdFQdCe1z8C+DSPdLci11d+ArfSNm5wmnjy/kmWrJyy2veDovGngy67UOEgLBs8cgyfU OVHoabmElFEqWErnByRkOzwGG4so7wztSiY5v0N4DYIHHTlvJgMuUPTMVz/TGdp9m24v 0hiA== X-Gm-Message-State: ALQs6tD4is+55c5oF2ayCcSAn9LJAsFAVDWDW27+Pk68Y9T7OYHyOr25 zvPOJ3XfxBDEK/C2NCJW4qHjmhUuevY= X-Received: by 2002:a19:1903:: with SMTP id 3-v6mr14948018lfz.59.1523910752885; Mon, 16 Apr 2018 13:32:32 -0700 (PDT) Received: from localhost ([195.238.92.132]) by smtp.gmail.com with ESMTPSA id j8sm2273391lje.83.2018.04.16.13.32.31 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Apr 2018 13:32:31 -0700 (PDT) From: Sam Protsenko To: u-boot@lists.denx.de Date: Mon, 16 Apr 2018 23:32:23 +0300 Message-Id: <20180416203227.26523-2-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 1/5] common: Add support for Android DT image 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" Android documentation recommends new image format for storing DTB/DTBO files: [1]. To support that format, two things should be done: 1. Add dt_table.h file from Android (BSD-3 relicensed version): [2]. This header defines structures and constants that we need to work with that DT image format. Changes: - re-licensed from Apache to BSD-3 - removed functions declarations - change the coding style to kernel (make checkpatch happy) 2. Add helper functions for Android DTB/DTBO format. In image-android-dt.* files you can find helper functions to work with Android DT image format, such us routines for: - printing the dump of image structure - getting the address and size of desired dtb/dtbo file [1] https://source.android.com/devices/architecture/dto/partitions [2] https://android.googlesource.com/platform/system/libufdt/+/58a7582180f477032cd6c74f8d9afad0038e74c3/utils/src/dt_table.h Signed-off-by: Sam Protsenko --- common/image-android-dt.c | 134 +++++++++++++++++++++++++++++++++++++ include/dt_table.h | 46 +++++++++++++ include/image-android-dt.h | 18 +++++ 3 files changed, 198 insertions(+) create mode 100644 common/image-android-dt.c create mode 100644 include/dt_table.h create mode 100644 include/image-android-dt.h diff --git a/common/image-android-dt.c b/common/image-android-dt.c new file mode 100644 index 0000000000..f218db06bb --- /dev/null +++ b/common/image-android-dt.c @@ -0,0 +1,134 @@ +/* + * (C) Copyright 2018 Linaro Ltd. + * Sam Protsenko + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include +#include +#include +#include + +/** + * Check if image header is correct. + * + * @param hdr Address to image header + * @return true if header is correct or false if header is incorrect + */ +bool android_dt_check_header(const struct dt_table_header *hdr) +{ + return fdt32_to_cpu(hdr->magic) == DT_TABLE_MAGIC; +} + +/** + * Get the address of FDT (dtb or dtbo) in memory by its index in image. + * + * @param hdr Address to image header + * @param index Index of desired FDT in image (starting from 0) + * @param[out] addr If not null, will contain address to specified FDT + * @param[out] size If not NULL, will contain size of specified FDT + * + * @return true on success or false on error + */ +bool android_dt_get_fdt_by_index(const struct dt_table_header *hdr, + u32 index, ulong *addr, u32 *size) +{ + const struct dt_table_entry *e; + u32 entry_count = fdt32_to_cpu(hdr->dt_entry_count); + u32 entries_offset = fdt32_to_cpu(hdr->dt_entries_offset); + u32 entry_size = fdt32_to_cpu(hdr->dt_entry_size); + u32 dt_offset, dt_size; + + if (index > entry_count) { + printf("Error: index > dt_entry_count (%u > %u)\n", index, + entry_count); + return false; + } + + e = (const struct dt_table_entry *)((ulong)hdr + entries_offset + + index * entry_size); + dt_offset = fdt32_to_cpu(e->dt_offset); + dt_size = fdt32_to_cpu(e->dt_size); + + if (addr) + *addr = ((ulong)hdr + dt_offset); + if (size) + *size = dt_size; + + return true; +} + +#if !defined(CONFIG_SPL_BUILD) +static void android_dt_print_fdt_info(const struct fdt_header *fdt) +{ + u32 fdt_size; + int root_node_off; + const char *compatible = NULL; + + fdt_size = fdt_totalsize(fdt); + root_node_off = fdt_path_offset(fdt, "/"); + if (root_node_off < 0) { + printf("Error: Root node not found\n"); + } else { + compatible = fdt_getprop(fdt, root_node_off, "compatible", + NULL); + } + + printf(" (FDT)size = %d\n", fdt_size); + printf(" (FDT)compatible = %s\n", + compatible ? compatible : "(unknown)"); +} + +/** + * Print information about DT image structure. + * + * @param hdr Address to image header + */ +void android_dt_print_contents(const struct dt_table_header *hdr) +{ + u32 i; + u32 entry_count = fdt32_to_cpu(hdr->dt_entry_count); + u32 entries_offset = fdt32_to_cpu(hdr->dt_entries_offset); + u32 entry_size = fdt32_to_cpu(hdr->dt_entry_size); + + /* Print image header info */ + printf("dt_table_header:\n"); + printf(" magic = %08x\n", fdt32_to_cpu(hdr->magic)); + printf(" total_size = %d\n", fdt32_to_cpu(hdr->total_size)); + printf(" header_size = %d\n", fdt32_to_cpu(hdr->header_size)); + printf(" dt_entry_size = %d\n", entry_size); + printf(" dt_entry_count = %d\n", entry_count); + printf(" dt_entries_offset = %d\n", entries_offset); + printf(" page_size = %d\n", fdt32_to_cpu(hdr->page_size)); + printf(" reserved[0] = %08x\n", fdt32_to_cpu(hdr->reserved[0])); + + /* Print image entries info */ + for (i = 0; i < entry_count; ++i) { + const struct dt_table_entry *e; + const struct fdt_header *fdt; + u32 dt_offset, dt_size; + u32 j; + + e = (const struct dt_table_entry *)((ulong)hdr + entries_offset + + i * entry_size); + dt_offset = fdt32_to_cpu(e->dt_offset); + dt_size = fdt32_to_cpu(e->dt_size); + + printf("dt_table_entry[%d]:\n", i); + printf(" dt_size = %d\n", dt_size); + printf(" dt_offset = %d\n", dt_offset); + printf(" id = %08x\n", fdt32_to_cpu(e->id)); + printf(" rev = %08x\n", fdt32_to_cpu(e->rev)); + + for (j = 0; j < 4; ++j) { + printf(" custom[%d] = %08x\n", j, + fdt32_to_cpu(e->custom[j])); + } + + /* Print FDT info for this entry */ + fdt = (const struct fdt_header *)((ulong)hdr + dt_offset); + android_dt_print_fdt_info(fdt); + } +} +#endif diff --git a/include/dt_table.h b/include/dt_table.h new file mode 100644 index 0000000000..19cbbeab2a --- /dev/null +++ b/include/dt_table.h @@ -0,0 +1,46 @@ +/* + * This is from the Android Project, + * Repository: https://android.googlesource.com/platform/system/libufdt + * File: utils/src/dt_table.h + * Commit: 58a7582180f477032cd6c74f8d9afad0038e74c3 + * Copyright (C) 2017 The Android Open Source Project + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef DT_TABLE_H +#define DT_TABLE_H + +#include + +#define DT_TABLE_MAGIC 0xd7b7ab1e +#define DT_TABLE_DEFAULT_PAGE_SIZE 2048 + +struct dt_table_header { + u32 magic; /* DT_TABLE_MAGIC */ + u32 total_size; /* includes dt_table_header + all dt_table_entry + * and all dtb/dtbo + */ + u32 header_size; /* sizeof(dt_table_header) */ + + u32 dt_entry_size; /* sizeof(dt_table_entry) */ + u32 dt_entry_count; /* number of dt_table_entry */ + u32 dt_entries_offset; /* offset to the first dt_table_entry + * from head of dt_table_header. + * The value will be equal to header_size if + * no padding is appended + */ + u32 page_size; /* flash page size we assume */ + u32 reserved[1]; /* must be zero */ +}; + +struct dt_table_entry { + u32 dt_size; + u32 dt_offset; /* offset from head of dt_table_header */ + + u32 id; /* optional, must be zero if unused */ + u32 rev; /* optional, must be zero if unused */ + u32 custom[4]; /* optional, must be zero if unused */ +}; + +#endif diff --git a/include/image-android-dt.h b/include/image-android-dt.h new file mode 100644 index 0000000000..f9b5ff3f13 --- /dev/null +++ b/include/image-android-dt.h @@ -0,0 +1,18 @@ +/* + * (C) Copyright 2018 Linaro Ltd. + * Sam Protsenko + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#ifndef IMAGE_ANDROID_DT_H +#define IMAGE_ANDROID_DT_H + +#include + +bool android_dt_check_header(const struct dt_table_header *hdr); +void android_dt_print_contents(const struct dt_table_header *hdr); +bool android_dt_get_fdt_by_index(const struct dt_table_header *hdr, + u32 index, ulong *addr, u32 *size); + +#endif /* IMAGE_ANDROID_DT_H */ From patchwork Mon Apr 16 20:32:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 133495 Delivered-To: patch@linaro.org Received: by 10.46.84.18 with SMTP id i18csp3973533ljb; Mon, 16 Apr 2018 13:35:12 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+geazLTFDXXuGpI021joIYdY9zfiBZARSvIJ4By/5pw+U9qbFEjHt/4s/9DiJB4W6Be1o5 X-Received: by 10.80.169.89 with SMTP id m25mr34582934edc.244.1523910912713; Mon, 16 Apr 2018 13:35:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523910912; cv=none; d=google.com; s=arc-20160816; b=gWQ/nUgK+16W1yXD92ei74K6S1TMuSLCz+I/wIAEL4yla2lMzryc6xp26WW/EnBdtS s2xt197PSKj/9IyDAczTF1nLT9/Ru74wEYhOjHedGng+9RD311nUE55cUsnqTDIN/Y4a /p8jhj/rPyYd4SyODrVgpzGeTy/Ft6cOcfQMr8nKfzC3X/RIgF57E2ufI7Ug+g9RHmrL MUCKznKUnPQ1Y4x1jVcpN8suYYwZMQPbZuATWnhw7NROxYkpHnwKMZRhOjJ90r9QijmO q/+wlvC+trLs/H0Mbaj2utxFX6jCANkXmqFBqvaMqhZLkxB8RSLNU/6duMPK6WMYZ4ko pOzw== 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=j9bRUNYzQxK0nqA2gqFhFmsFypENz/qrS7vVW30kWW4=; b=wNK6AY72LZ7k1cfj1l404WHdBHH4/Ng5xtgreXvI4/b16NUz0Un6weYprh3ELFgqS3 o9gc1qDYzbsIoee43eTAWmkj/3E3d6EMfTEJ/FrWGPe4x7K6maiq1OOW/Sn7hoE+M21c a9gdj2dFM7oLaz3/UVtP5r4GbSbgejJQqp1+uqyu4hNu/byHCpUt7sjR4r1r5TsGCQ5k KeVL4cPTDhEb4kD/o7DLRk7yk2G1ANTL2eYV0oMxJRLTNTCoyzmZIP93PHlresRI2L2M OOh/WX4+vdCmRlNU7jg2iGtRuz0pO0rrCi0bX1DIYwnAhV+9oqRpzqNJ40TeBi1OqCV4 ra2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=DpueNXSc; 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 v21si4644992edb.88.2018.04.16.13.35.12; Mon, 16 Apr 2018 13:35:12 -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=DpueNXSc; 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 43FCFC21E57; Mon, 16 Apr 2018 20:33:44 +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 35334C21E57; Mon, 16 Apr 2018 20:32:56 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 5A46FC21DB5; Mon, 16 Apr 2018 20:32:39 +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 D6041C21E08 for ; Mon, 16 Apr 2018 20:32:35 +0000 (UTC) Received: by mail-lf0-f66.google.com with SMTP id v207-v6so24045366lfa.10 for ; Mon, 16 Apr 2018 13:32:35 -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=crzKAgIK23adECh6i1PUjIiYQP9AfpWByOcVuMVDJl0=; b=DpueNXScssfI3oRMcDnYxd1P5dib6jYqhVEQkhoKdjdX3DYd9S9cX2icgtSh1Uee0U 8rYX7lMjWSNXVI3ukwn9iS3HQBBZCVf3Qan7XPOPGC/b6bxmtc4zs1TdOpeJ7Ps+BTsn k4WON0/HGXFZOFWYMi3PpJQiteLuOfevre8EU= 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=crzKAgIK23adECh6i1PUjIiYQP9AfpWByOcVuMVDJl0=; b=jEMpxpGEeMK8ybleLIk5o698Hn5IiyS1fTynjCgXV7Xh/IGH67fWQe/jputvgVaT9U 0yYM0Ynqb4ER1XtBRCDlqS+DgCzInPPV4hnx+Z0t8WN4qSjKHfvyuRxEAsfdQpbzGQQR lnYJ5aWGDe8UDE3B5V/petTg2/pCkHKef+YOR4FLzzwGt4mPV24XlQyr2/Vm6xHciwZ8 O8ACgWnBQqaetdU59edaaEycWovvha1aqILwsAI4JhybIvtrW+8elgHdqbRkt0OWfH5o iyEbK3tvBvzNLIgP2ha5WxZJFOlc5atKso65+LHZaWRSFFBQG/8noTr/troPYuBttCfX 7/DA== X-Gm-Message-State: ALQs6tCzzmxb++FJdB6fXnWMarZlppOh8Tshk0dfyKyRUMKeKeAr89Go ZVywSXawgt6oiYvnTN0YED1g3xedr2o= X-Received: by 10.46.62.12 with SMTP id l12mr10053374lja.66.1523910754864; Mon, 16 Apr 2018 13:32:34 -0700 (PDT) Received: from localhost ([195.238.92.132]) by smtp.gmail.com with ESMTPSA id 199sm2276746ljj.81.2018.04.16.13.32.33 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Apr 2018 13:32:34 -0700 (PDT) From: Sam Protsenko To: u-boot@lists.denx.de Date: Mon, 16 Apr 2018 23:32:24 +0300 Message-Id: <20180416203227.26523-3-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 2/5] cmd: Add dtimg command 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" dtimg command allows user to work with Android DTB/DTBO image format. Such as, getting the address of desired DTB/DTBO file, printing the dump of the image in U-Boot shell, etc. This command is needed to provide Android boot with new Android DT image format further. Signed-off-by: Sam Protsenko --- cmd/Kconfig | 8 +++ cmd/Makefile | 1 + cmd/dtimg.c | 142 ++++++++++++++++++++++++++++++++++++++++++++++++ common/Makefile | 4 ++ 4 files changed, 155 insertions(+) create mode 100644 cmd/dtimg.c diff --git a/cmd/Kconfig b/cmd/Kconfig index bc1d2f31c0..68f3cc7b48 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -256,6 +256,14 @@ config CMD_BOOTMENU help Add an ANSI terminal boot menu command. +config CMD_DTIMG + bool "dtimg" + help + Android DTB/DTBO image manipulation commands. Read dtb/dtbo files from + image into RAM, dump image structure information, etc. Those dtb/dtbo + files should be merged in one dtb further, which needs to be passed to + the kernel, as part of a boot process. + config CMD_ELF bool "bootelf, bootvx" default y diff --git a/cmd/Makefile b/cmd/Makefile index c4269ac8ac..1cc2e74e9e 100644 --- a/cmd/Makefile +++ b/cmd/Makefile @@ -43,6 +43,7 @@ ifdef CONFIG_POST obj-$(CONFIG_CMD_DIAG) += diag.o endif obj-$(CONFIG_CMD_DISPLAY) += display.o +obj-$(CONFIG_CMD_DTIMG) += dtimg.o obj-$(CONFIG_CMD_ECHO) += echo.o obj-$(CONFIG_ENV_IS_IN_EEPROM) += eeprom.o obj-$(CONFIG_CMD_EEPROM) += eeprom.o diff --git a/cmd/dtimg.c b/cmd/dtimg.c new file mode 100644 index 0000000000..0b046402fe --- /dev/null +++ b/cmd/dtimg.c @@ -0,0 +1,142 @@ +/* + * (C) Copyright 2018 Linaro Ltd. + * Sam Protsenko + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include +#include + +enum cmd_dtimg_info { + CMD_DTIMG_START = 0, + CMD_DTIMG_SIZE, +}; + +static int do_dtimg_dump(cmd_tbl_t *cmdtp, int flag, int argc, + char * const argv[]) +{ + char *endp; + void *hdr; + + if (argc != 2) + return CMD_RET_USAGE; + + hdr = (void *)simple_strtoul(argv[1], &endp, 16); + if (*endp != '\0') { + printf("Error: Wrong image address\n"); + return CMD_RET_FAILURE; + } + + if (!android_dt_check_header(hdr)) { + printf("Error: DT image header is incorrect\n"); + return CMD_RET_FAILURE; + } + + android_dt_print_contents(hdr); + + return CMD_RET_SUCCESS; +} + +static int dtimg_get_fdt(int argc, char * const argv[], enum cmd_dtimg_info cmd) +{ + void *hdr; + u32 index; + char *endp; + ulong addr; + u32 size; + char buf[512] = { 0 }; + + if (argc != 4) + return CMD_RET_USAGE; + + hdr = (void *)simple_strtoul(argv[1], &endp, 16); + if (*endp != '\0') { + printf("Error: Wrong image address\n"); + return CMD_RET_FAILURE; + } + + if (!android_dt_check_header(hdr)) { + printf("Error: DT image header is incorrect\n"); + return CMD_RET_FAILURE; + } + + index = simple_strtoul(argv[2], &endp, 0); + if (*endp != '\0') { + printf("Error: Wrong index\n"); + return CMD_RET_FAILURE; + } + + if (!android_dt_get_fdt_by_index(hdr, index, &addr, &size)) + return CMD_RET_FAILURE; + + switch (cmd) { + case CMD_DTIMG_START: + snprintf(buf, sizeof(buf), "%p", (void *)addr); + break; + case CMD_DTIMG_SIZE: + snprintf(buf, sizeof(buf), "%x", size); + break; + default: + printf("Error: Unknown cmd_dtimg_info value: %d\n", cmd); + return CMD_RET_FAILURE; + } + + env_set(argv[3], buf); + + return CMD_RET_SUCCESS; +} + +static int do_dtimg_start(cmd_tbl_t *cmdtp, int flag, int argc, + char * const argv[]) +{ + return dtimg_get_fdt(argc, argv, CMD_DTIMG_START); +} + +static int do_dtimg_size(cmd_tbl_t *cmdtp, int flag, int argc, + char * const argv[]) +{ + return dtimg_get_fdt(argc, argv, CMD_DTIMG_SIZE); +} + +static cmd_tbl_t cmd_dtimg_sub[] = { + U_BOOT_CMD_MKENT(dump, 2, 0, do_dtimg_dump, "", ""), + U_BOOT_CMD_MKENT(start, 4, 0, do_dtimg_start, "", ""), + U_BOOT_CMD_MKENT(size, 4, 0, do_dtimg_size, "", ""), +}; + +static int do_dtimg(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) +{ + cmd_tbl_t *cp; + + cp = find_cmd_tbl(argv[1], cmd_dtimg_sub, ARRAY_SIZE(cmd_dtimg_sub)); + + /* Strip off leading 'dtimg' command argument */ + argc--; + argv++; + + if (!cp || argc > cp->maxargs) + return CMD_RET_USAGE; + if (flag == CMD_FLAG_REPEAT && !cp->repeatable) + return CMD_RET_SUCCESS; + + return cp->cmd(cmdtp, flag, argc, argv); +} + +U_BOOT_CMD( + dtimg, CONFIG_SYS_MAXARGS, 0, do_dtimg, + "manipulate dtb/dtbo Android image", + "dump \n" + " - parse specified image and print its structure info\n" + " : image address in RAM, in hex\n" + "dtimg start \n" + " - get address (hex) of FDT in the image, by index\n" + " : image address in RAM, in hex\n" + " : index of desired FDT in the image\n" + " : name of variable where to store address of FDT\n" + "dtimg size \n" + " - get size (hex, bytes) of FDT in the image, by index\n" + " : image address in RAM, in hex\n" + " : index of desired FDT in the image\n" + " : name of variable where to store size of FDT" +); diff --git a/common/Makefile b/common/Makefile index 7011dada99..6ef55d0d7a 100644 --- a/common/Makefile +++ b/common/Makefile @@ -111,6 +111,10 @@ obj-$(CONFIG_IO_TRACE) += iotrace.o obj-y += memsize.o obj-y += stdio.o +ifdef CONFIG_CMD_DTIMG +obj-y += image-android-dt.o +endif + ifndef CONFIG_SPL_BUILD # This option is not just y/n - it can have a numeric value ifdef CONFIG_FASTBOOT_FLASH From patchwork Mon Apr 16 20:32:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 133494 Delivered-To: patch@linaro.org Received: by 10.46.84.18 with SMTP id i18csp3972878ljb; Mon, 16 Apr 2018 13:34:22 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/OJilnwLRANVICnC6gBBlrqb3mRiyNem3R/o5mXeqHkcgAT5nkk7h5I8SmdObJDB5xAMVG X-Received: by 10.80.186.14 with SMTP id g14mr34100890edc.302.1523910861931; Mon, 16 Apr 2018 13:34:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523910861; cv=none; d=google.com; s=arc-20160816; b=F6AX/9mMefgZc8xwK4IBHwM8lgA5P6hrAF2NeeWCVhEq1zvcs0qT+LmbjsdpdwHxxs L6yqOFnhBYwqNea38d6SWeO/gGloQxRlwPV+09HLOu6XQSiupv+n5MBt+SWAq6MWY/cb Ew4DrWBoe0UhJhjHQ34C9pJd/qCMU5Wuq3RjnEAIXPySsHWMMYjvhfEJekDJ2tglWMFc VZ+zS2yeUHjUzcQcN1dsr26otGnVVYMZ/4q7H9vdGHdd+NYKjV4z+eq2lniA5MqRlz4n cYdGoaojgbvuPvmgt0wMezNa187smVoxMPfuTOi13caVeOTaHavyWIU0YNKrnVF3pLVv GpMg== 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=UbrxcGE+uPSYU/heu3DOXebIZx2A2MhfJx+XZxapea0=; b=miyTtI6wO9O/2BlB+kL/OHapwmVXGM78CmzdT01dYUp4CMbUMGOc66h/EhTMe6TOAk lwSAeAriKvwUnlT7sCNZj7jazs6yYC9EZxnhKGm+xooeLR6+ZwWMBsc+bgFB+0mMEKW5 16UwicZaG8ngbw8dae1H31SoknDuqPxsBSkfOPOO6zSXunYok3h3dLjsYFIzYIWqRlYa FxAdaJ84exkrZrD+WAqULQxhRccusqZobxTGOX5WgmygGfy6IkJobMbyu6zQsb3F8vb6 zqdKxYWE0TNHu8KqHXmPzCNp0ojTWYwZ8IkyN8Up1fnKxA0AuCFcWOyFUrhkO4b0/fKN /evw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Pfx6iJCC; 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 a6si3766626eda.172.2018.04.16.13.34.21; Mon, 16 Apr 2018 13:34:21 -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=Pfx6iJCC; 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 8B3FAC21E1E; Mon, 16 Apr 2018 20:33:22 +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_NONE, 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 32DF0C21E15; Mon, 16 Apr 2018 20:32:55 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id A0A4FC21E49; Mon, 16 Apr 2018 20:32:41 +0000 (UTC) Received: from mail-lf0-f65.google.com (mail-lf0-f65.google.com [209.85.215.65]) by lists.denx.de (Postfix) with ESMTPS id AA2B6C21E39 for ; Mon, 16 Apr 2018 20:32:37 +0000 (UTC) Received: by mail-lf0-f65.google.com with SMTP id j68-v6so24033060lfg.13 for ; Mon, 16 Apr 2018 13:32:37 -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=5QovSuMhYgMa+43nGfPRslZxIkQvSt+P5qcNFqBZYrk=; b=Pfx6iJCCfR9DfF+P047RqLE/37whu6OUP0KEYWQ6MMBL0BUicqe1G7Yvy26hCdU6vG p/qRMZtZk1GH5X93VdYStrlgZvoLNNdsqmXGqRZI+YJF2LFbsSxe1LSFt92PMYmYB956 L7n9PO/ro5PLW5Xm/dktlB/Mu76ISJeUNaJQw= 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=5QovSuMhYgMa+43nGfPRslZxIkQvSt+P5qcNFqBZYrk=; b=ayBI2U/4gn9tNvUQiumuFX2vhoav+CT8TG8sSH4sHt8a2mJG36JsljAzf9JOcjRYXN 6GDAog9wwwA0j/s6/wFdCOag89AoXxXMEmAi25/0uvUQ7ICU7cZXCRzhBb9S9/Hy+V7O 0MzfypABFzSkmN0n8ndNZRQ1CSNNCo7XqB9RQJnPTylpnxChRtGku5h2+jG1wG724dCO vfVnDzv6H8e1rMO/nvLRfOv3y+4VraxRoCuULlV8gvuOSlpvKudSr+L7OqnZfrpzLt/N TS/0CkkDcn28fvJ83coQfcLdKWHCyoD1MzAtlEVk5g6AV2p3evOz2itwizU6/fvWKC5j oN9w== X-Gm-Message-State: ALQs6tBrmR9gcjMC2KZPABH0UyUF3FFHDTmrZDyhKVq4kj788gw851CH +8nOA3/dawzhqgd+pjsfTgYd1peDO+Q= X-Received: by 2002:a19:d911:: with SMTP id q17-v6mr13857239lfg.99.1523910756767; Mon, 16 Apr 2018 13:32:36 -0700 (PDT) Received: from localhost ([195.238.92.132]) by smtp.gmail.com with ESMTPSA id u13-v6sm2987585lff.72.2018.04.16.13.32.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Apr 2018 13:32:36 -0700 (PDT) From: Sam Protsenko To: u-boot@lists.denx.de Date: Mon, 16 Apr 2018 23:32:25 +0300 Message-Id: <20180416203227.26523-4-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 3/5] arm: ti: boot: Extract PARTS_DEFAULT to boot.h 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" Eliminate code duplication: the same PARTS_DEFAULT was defined in am57xx_evm.h and in dra7xx_evm.h. Extract it to environment/boot.h and use in all OMAP5-based boards. Signed-off-by: Sam Protsenko Acked-by: Andrew F. Davis --- include/configs/am57xx_evm.h | 25 ------------------------- include/configs/cl-som-am57x.h | 2 ++ include/configs/cm_t54.h | 2 ++ include/configs/dra7xx_evm.h | 25 ------------------------- include/environment/ti/boot.h | 27 +++++++++++++++++++++++++-- 5 files changed, 29 insertions(+), 52 deletions(-) diff --git a/include/configs/am57xx_evm.h b/include/configs/am57xx_evm.h index d1f73f76a4..886a5696f5 100644 --- a/include/configs/am57xx_evm.h +++ b/include/configs/am57xx_evm.h @@ -38,31 +38,6 @@ #define CONFIG_SYS_OMAP_ABE_SYSCK -/* Define the default GPT table for eMMC */ -#define PARTS_DEFAULT \ - /* Linux partitions */ \ - "uuid_disk=${uuid_gpt_disk};" \ - "name=bootloader,start=384K,size=1792K,uuid=${uuid_gpt_bootloader};" \ - "name=rootfs,start=2688K,size=-,uuid=${uuid_gpt_rootfs}\0" \ - /* Android partitions */ \ - "partitions_android=" \ - "uuid_disk=${uuid_gpt_disk};" \ - "name=xloader,start=128K,size=256K,uuid=${uuid_gpt_xloader};" \ - "name=bootloader,size=1792K,uuid=${uuid_gpt_bootloader};" \ - "name=environment,size=128K,uuid=${uuid_gpt_environment};" \ - "name=misc,size=128K,uuid=${uuid_gpt_misc};" \ - "name=reserved,size=256K,uuid=${uuid_gpt_reserved};" \ - "name=efs,size=16M,uuid=${uuid_gpt_efs};" \ - "name=crypto,size=16K,uuid=${uuid_gpt_crypto};" \ - "name=recovery,size=40M,uuid=${uuid_gpt_recovery};" \ - "name=boot,size=10M,uuid=${uuid_gpt_boot};" \ - "name=system,size=768M,uuid=${uuid_gpt_system};" \ - "name=vendor,size=256M,uuid=${uuid_gpt_vendor};" \ - "name=cache,size=256M,uuid=${uuid_gpt_cache};" \ - "name=ipu1,size=1M,uuid=${uuid_gpt_ipu1};" \ - "name=ipu2,size=1M,uuid=${uuid_gpt_ipu2};" \ - "name=userdata,size=-,uuid=${uuid_gpt_userdata}" - #define DFUARGS \ "dfu_bufsiz=0x10000\0" \ DFU_ALT_INFO_MMC \ diff --git a/include/configs/cl-som-am57x.h b/include/configs/cl-som-am57x.h index 9c70cf0b37..709e0375b3 100644 --- a/include/configs/cl-som-am57x.h +++ b/include/configs/cl-som-am57x.h @@ -18,6 +18,8 @@ #define CONFIG_SYS_OMAP_ABE_SYSCK +#define PARTS_DEFAULT + #include /* misc */ diff --git a/include/configs/cm_t54.h b/include/configs/cm_t54.h index 6123cd374d..f0d76ed806 100644 --- a/include/configs/cm_t54.h +++ b/include/configs/cm_t54.h @@ -14,6 +14,8 @@ #define CONFIG_CM_T54 #define CONFIG_DRAM_2G +#define PARTS_DEFAULT + #include /* EEPROM related defines */ diff --git a/include/configs/dra7xx_evm.h b/include/configs/dra7xx_evm.h index 917a05d701..9b3fb2c913 100644 --- a/include/configs/dra7xx_evm.h +++ b/include/configs/dra7xx_evm.h @@ -45,31 +45,6 @@ #define CONFIG_SYS_OMAP_ABE_SYSCK #ifndef CONFIG_SPL_BUILD -/* Define the default GPT table for eMMC */ -#define PARTS_DEFAULT \ - /* Linux partitions */ \ - "uuid_disk=${uuid_gpt_disk};" \ - "name=bootloader,start=384K,size=1792K,uuid=${uuid_gpt_bootloader};" \ - "name=rootfs,start=2688K,size=-,uuid=${uuid_gpt_rootfs}\0" \ - /* Android partitions */ \ - "partitions_android=" \ - "uuid_disk=${uuid_gpt_disk};" \ - "name=xloader,start=128K,size=256K,uuid=${uuid_gpt_xloader};" \ - "name=bootloader,size=1792K,uuid=${uuid_gpt_bootloader};" \ - "name=environment,size=128K,uuid=${uuid_gpt_environment};" \ - "name=misc,size=128K,uuid=${uuid_gpt_misc};" \ - "name=reserved,size=256K,uuid=${uuid_gpt_reserved};" \ - "name=efs,size=16M,uuid=${uuid_gpt_efs};" \ - "name=crypto,size=16K,uuid=${uuid_gpt_crypto};" \ - "name=recovery,size=40M,uuid=${uuid_gpt_recovery};" \ - "name=boot,size=10M,uuid=${uuid_gpt_boot};" \ - "name=system,size=768M,uuid=${uuid_gpt_system};" \ - "name=vendor,size=256M,uuid=${uuid_gpt_vendor};" \ - "name=cache,size=256M,uuid=${uuid_gpt_cache};" \ - "name=ipu1,size=1M,uuid=${uuid_gpt_ipu1};" \ - "name=ipu2,size=1M,uuid=${uuid_gpt_ipu2};" \ - "name=userdata,size=-,uuid=${uuid_gpt_userdata}" - #define DFUARGS \ "dfu_bufsiz=0x10000\0" \ DFU_ALT_INFO_MMC \ diff --git a/include/environment/ti/boot.h b/include/environment/ti/boot.h index 24b7783f88..4f3d748b5c 100644 --- a/include/environment/ti/boot.h +++ b/include/environment/ti/boot.h @@ -15,8 +15,31 @@ #endif #ifndef PARTS_DEFAULT -#define PARTS_DEFAULT -#endif +/* Define the default GPT table for eMMC */ +#define PARTS_DEFAULT \ + /* Linux partitions */ \ + "uuid_disk=${uuid_gpt_disk};" \ + "name=bootloader,start=384K,size=1792K,uuid=${uuid_gpt_bootloader};" \ + "name=rootfs,start=2688K,size=-,uuid=${uuid_gpt_rootfs}\0" \ + /* Android partitions */ \ + "partitions_android=" \ + "uuid_disk=${uuid_gpt_disk};" \ + "name=xloader,start=128K,size=256K,uuid=${uuid_gpt_xloader};" \ + "name=bootloader,size=1792K,uuid=${uuid_gpt_bootloader};" \ + "name=environment,size=128K,uuid=${uuid_gpt_environment};" \ + "name=misc,size=128K,uuid=${uuid_gpt_misc};" \ + "name=reserved,size=256K,uuid=${uuid_gpt_reserved};" \ + "name=efs,size=16M,uuid=${uuid_gpt_efs};" \ + "name=crypto,size=16K,uuid=${uuid_gpt_crypto};" \ + "name=recovery,size=40M,uuid=${uuid_gpt_recovery};" \ + "name=boot,size=10M,uuid=${uuid_gpt_boot};" \ + "name=system,size=768M,uuid=${uuid_gpt_system};" \ + "name=vendor,size=256M,uuid=${uuid_gpt_vendor};" \ + "name=cache,size=256M,uuid=${uuid_gpt_cache};" \ + "name=ipu1,size=1M,uuid=${uuid_gpt_ipu1};" \ + "name=ipu2,size=1M,uuid=${uuid_gpt_ipu2};" \ + "name=userdata,size=-,uuid=${uuid_gpt_userdata}" +#endif /* PARTS_DEFAULT */ #define DEFAULT_COMMON_BOOT_TI_ARGS \ "console=" CONSOLEDEV ",115200n8\0" \ From patchwork Mon Apr 16 20:32:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 133496 Delivered-To: patch@linaro.org Received: by 10.46.84.18 with SMTP id i18csp3974395ljb; Mon, 16 Apr 2018 13:36:11 -0700 (PDT) X-Google-Smtp-Source: AIpwx49CWNCLeopk0YmV1iY4LxOJcJWTtCKDSyAYYEMdcbsSR/vCQUJGVVsrmDbQVjLqvIboEWGy X-Received: by 10.80.180.216 with SMTP id x24mr34030972edd.126.1523910971757; Mon, 16 Apr 2018 13:36:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523910971; cv=none; d=google.com; s=arc-20160816; b=mPH2XjLbzTuwVy+so8CN6oqPobDPeF0RH5pKZBtYBN9roq7xWiiY2Bntg9/IhRveUF GinzJydQp9kafKXusOguZv/CJMN0/574Os56stvD9LA7OQsuJVH77WiiJxf6qMNoQqxG 7I0NMoawrXLwt6LlhTHukvhqSUaFpjz0NuIMzwyodB2FIhFnWb270OR2iSPZsVCDdGXc yupc/lYmcjUL0UaefvUzBjqQRaN6RMhugKpdWOJxek1ghP8UFEuMlpfQi/anJFIh2dz0 4kKuu6P8cjYm2WlfzeLUGrCoVQOkD9Xp1GXF90A3UgLhwUJhPQzw0CogFxRBI2oS8Dx3 aR0Q== 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=mh4a+gJCTuPhCTtRAYthH3Tyv8rhGK0cJWJ24k4JaOg=; b=0MFwMQHcRqxHDkZAxfXosEFEDkvz6CGTFK//ngEFt4bSyCbduR0JMqH4b9+xGZcKfF 0Cln9k1q6fdgPeeo5HYIxeDHeKWTgu1QSguidaRp4kL9ILuk3ZjD5Cu7l2FlYSDy9LG6 XV589Q1EdqUrupfJwfsmMhO0KSxmjdAGn0KE1rqh7lON1ObM6wDOO2eEaWiylFdXhg1e jy9MPKx0RTU+RKg60BJzsZs+8veLTJ4tagYGgaIzdXQyr0cEL6zNe1zHdUfEv7/QXVBJ u9lwTVoiIIVm4FDJH60APjANddGFQpMXQh2kwQNND3VUeRq2N7DOxblBEFQGiaIho4+l 2xYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=VmWGE2gj; 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 r25si9333edm.165.2018.04.16.13.36.11; Mon, 16 Apr 2018 13:36:11 -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=VmWGE2gj; 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 5991BC21E38; Mon, 16 Apr 2018 20:34:27 +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_NONE, 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 3239DC21E3A; Mon, 16 Apr 2018 20:33:49 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 0165EC21DFD; Mon, 16 Apr 2018 20:32:44 +0000 (UTC) Received: from mail-lf0-f65.google.com (mail-lf0-f65.google.com [209.85.215.65]) by lists.denx.de (Postfix) with ESMTPS id 14275C21E08 for ; Mon, 16 Apr 2018 20:32:40 +0000 (UTC) Received: by mail-lf0-f65.google.com with SMTP id q9-v6so24042661lfk.9 for ; Mon, 16 Apr 2018 13:32:40 -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=EHzR+01SC0GMoKEPXdB2/7bKlZehnxMIkUIefkES8Yk=; b=VmWGE2gjUUhJdl8zDnJVf9AUONGCx33jpB3HJVoOn3d0itMj0lA8e9QSO5DNO4aDcS Kl1B387C954yQXEojCSbafqX8dY1rItTCl4KA7jUCUqxldvYzVbuVQdK7fCJgKbtYptI XYlzsoa3YdN7ZTErL53vIqCp8o4GOrL0DlcrE= 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=EHzR+01SC0GMoKEPXdB2/7bKlZehnxMIkUIefkES8Yk=; b=CihlG+PVjTUw8VlxxtoqXXuP7XMhjUJDJcdTHJE4m315ImzgW5KRzasUjs0xBZElFh 44pNXJk3MqIIKAN92hfGfMvOYSKpV2QYmqgxHP7vjoycVLUa+7T9hjhWFfsZBliBo0E/ f2OA6iweaXjz0TrdKga+obhSqbp87Uoyy5kSJkS6lqJ8QIB6s9DYsokL0/MNFUDcwphD 6FD8ALvEOnWS8eUOZawmCXNFAHvH0GNONYCAnoSL/YX1l7S0d5G24yfW95g+0IxlvPio Et9U/1rSI1HLrYnCN1xp1OGpVKyzdZv98SXTgIFifNt3EF9Kxa1yhZikfL2z37+pQ4tK vlrg== X-Gm-Message-State: ALQs6tDuzQHCxVnbcFAKX0PZecVfiaEp8FrKE9BNXNZx2j3eVvyhisJz t0PAKHb626KCay3RnyygFuKfOfAzCcA= X-Received: by 2002:a19:519a:: with SMTP id g26-v6mr14989243lfl.50.1523910759097; Mon, 16 Apr 2018 13:32:39 -0700 (PDT) Received: from localhost ([195.238.92.132]) by smtp.gmail.com with ESMTPSA id s3sm391116ljd.75.2018.04.16.13.32.37 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Apr 2018 13:32:38 -0700 (PDT) From: Sam Protsenko To: u-boot@lists.denx.de Date: Mon, 16 Apr 2018 23:32:26 +0300 Message-Id: <20180416203227.26523-5-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 4/5] arm: ti: boot: Add dtbo partition for Android boot 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" New Android boot scheme looks like this [1], and it involves adding new partition for storing Device Tree Overlays. This patch adds dtbo partition. While at it, let's revise Android partition table a bit. List of changes: - rename "misc" to "hole" (not used for anything, just a guard hole) - rename "reserved" to "uenv" (because it hold U-Boot environment) - rename "environment" to "dtb" (because it actually holds .dtb file) - move "dtb" after "uenv" (so that changes of dtb size won't affect "uenv" offset) - make "hole" size twice as bigger (to keep "uenv" offset the same, because "dtb" was moved after "uenv") - add "dtbo" partition (after "dtb", to not affect "uenv" offset) - while at it, increase "boot" partition size up to 20 MiB; that's needed because while playing with some additional drivers built-in and different compression techniques, and also for HS signing, we have seen the boot partition size reach close to border and sometimes reach over the limit of 10 MiB Now eMMC layout looks like this: offset content size partition (KiB) (KiB) =============================================================== 0 +------------------------+ | MBR/GPT header | 128 - 128 +------------------------+ | MLO | 256 xloader 384 +------------------------+ | u-boot.img | 1792 bootloader 2176 +------------------------+ | //////// hole //////// | 256 hole 2432 +------------------------+ | U-Boot environment | 256 uenv | (+ redundant) | 2688 +------------------------+ | dtb files | 1024 dtb 3712 +------------------------+ | dtbo files | 1024 dtbo 4736 +------------------------+ Android partitions remaining * =============================================================== "hole" partition is needed just to keep U-Boot environment at 2432 KiB offset, because: - this offset is used in DFU_ALT_INFO_EMMC: "u-env.raw raw 0x1300 0x200;" 0x1300 = 4864 sectors = 2432 KiB - which in turn relies on CONFIG_ENV_OFFSET: CONFIG_ENV_OFFSET = 0x260000 = 2432 KiB We are using "hole" partition instead of specifying "start" property to "uenv" partition, because this way it's easier to maintain change of preceding partitions. Also fix Android boot commands appropriately. [1] https://source.android.com/devices/architecture/dto/partitions Signed-off-by: Sam Protsenko --- include/environment/ti/boot.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/include/environment/ti/boot.h b/include/environment/ti/boot.h index 4f3d748b5c..f2d91f5298 100644 --- a/include/environment/ti/boot.h +++ b/include/environment/ti/boot.h @@ -26,13 +26,14 @@ "uuid_disk=${uuid_gpt_disk};" \ "name=xloader,start=128K,size=256K,uuid=${uuid_gpt_xloader};" \ "name=bootloader,size=1792K,uuid=${uuid_gpt_bootloader};" \ - "name=environment,size=128K,uuid=${uuid_gpt_environment};" \ - "name=misc,size=128K,uuid=${uuid_gpt_misc};" \ - "name=reserved,size=256K,uuid=${uuid_gpt_reserved};" \ + "name=hole,size=256K,uuid=${uuid_gpt_hole};" \ + "name=uenv,size=256K,uuid=${uuid_gpt_uenv};" \ + "name=dtb,size=1M,uuid=${uuid_gpt_dtb};" \ + "name=dtbo,size=1M,uuid=${uuid_gpt_dtbo};" \ "name=efs,size=16M,uuid=${uuid_gpt_efs};" \ "name=crypto,size=16K,uuid=${uuid_gpt_crypto};" \ "name=recovery,size=40M,uuid=${uuid_gpt_recovery};" \ - "name=boot,size=10M,uuid=${uuid_gpt_boot};" \ + "name=boot,size=20M,uuid=${uuid_gpt_boot};" \ "name=system,size=768M,uuid=${uuid_gpt_system};" \ "name=vendor,size=256M,uuid=${uuid_gpt_vendor};" \ "name=cache,size=256M,uuid=${uuid_gpt_cache};" \ @@ -66,8 +67,8 @@ "setenv machid fe6; " \ "mmc dev $mmcdev; " \ "mmc rescan; " \ - "part start mmc ${mmcdev} environment fdt_start; " \ - "part size mmc ${mmcdev} environment fdt_size; " \ + "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}; " \ 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