From patchwork Sun Jun 12 08:40:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Nazzareno Trimarchi X-Patchwork-Id: 634155 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3rS8Wc3kW1z9sD5 for ; Sun, 12 Jun 2016 18:40:59 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=amarulasolutions-com.20150623.gappssmtp.com header.i=@amarulasolutions-com.20150623.gappssmtp.com header.b=AsZXG9dG; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 915F1A76B5; Sun, 12 Jun 2016 10:40:55 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id o8D9EeVzd873; Sun, 12 Jun 2016 10:40:55 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C9DF1A7676; Sun, 12 Jun 2016 10:40:54 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D6FBAA7676 for ; Sun, 12 Jun 2016 10:40:52 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id JvTJfk9pOTWq for ; Sun, 12 Jun 2016 10:40:52 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-wm0-f46.google.com (mail-wm0-f46.google.com [74.125.82.46]) by theia.denx.de (Postfix) with ESMTPS id 9E7C6A75AA for ; Sun, 12 Jun 2016 10:40:49 +0200 (CEST) Received: by mail-wm0-f46.google.com with SMTP id v199so40785785wmv.0 for ; Sun, 12 Jun 2016 01:40:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:subject:message-id:mime-version:content-disposition :user-agent; bh=7qvjI7hgpTyKW72sHWflpv1FM9T8Ae299FzypuTMioU=; b=AsZXG9dG5mpuQ4ecWTD2FeI3GmMit4YM+UYwnrCJ9gFTvdtMsAeEDPjhpTZRuZmuXY sTiLSW618GorQaDslgi0J38b5oDGZf80a6Vvu24PKScnQTudlBpauvrwOGGEl6YbkYvm 1+gXnTfvCMhCv90/TBCEyuV7j2zCTcwFzKR4yJ4lSQvbfalDr76U/+Bzab9+tV9buS/1 MJt+1z22V90x1+EKHDc9TJDlgqHLP9JCNNV/tpzaYhyjss0CH1WVoibJ4Z4KABSzYcqr Y68/njilwioN8fnRp3nkPmUPlq98+pbw7cSqyi2I12C4zm3B4vshC0ONaPKuuz0VxKjF gq1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-disposition:user-agent; bh=7qvjI7hgpTyKW72sHWflpv1FM9T8Ae299FzypuTMioU=; b=QLlixKmFg8NMSKd7a8nReF6nk5K7IWWiPL1GaFmlkZwSNeRHMrea+ZMrHA69I5QttT jsGiSZ2fbeTR/9UiI1qheK4Ld5UJkHbJg+CgRHnQ1SXJ0ECZLELROHLqd5ScHhgQq23b fKL9lPysYE4ASAEOjjaFHkM0QjHMJRM1gp1W2fXvspmZehY1WUHocatVKuIHVWnevF9c 9RA8gagXjVjcYlVN0RFjDT+9x2gEdpiqqcpxBuG5F3Ukbr24kR6OTkVxx08/PD/jkESx gjOs2nxH2aVuHTBSp4ha69qDNqVRiQkCgXevbmw+sryxsgbaI3g+e1yY98AYG6W1GWVp Xbog== X-Gm-Message-State: ALyK8tJicmZgZqvaYoZU4JOCyiF6h6k3xeEoX6QNymsLXie/7WWrSUdqS+Gx8tjvw/K9xOx4 X-Received: by 10.194.2.44 with SMTP id 12mr9034629wjr.61.1465720848604; Sun, 12 Jun 2016 01:40:48 -0700 (PDT) Received: from panicking ([5.90.98.153]) by smtp.gmail.com with ESMTPSA id g3sm21228812wjb.47.2016.06.12.01.40.47 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Sun, 12 Jun 2016 01:40:47 -0700 (PDT) Date: Sun, 12 Jun 2016 10:40:43 +0200 From: Michael Trimarchi To: sjg@chromium.org, u-boot@lists.denx.de Message-ID: <20160612084038.GA13803@panicking> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Subject: [U-Boot] FDT on second address of android image X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 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" This is not a patch, but just an idea of what I would like to have. I don't know what is the best option to change the image-fit file. So I have just tried because the boot_get_fdt start to be a very long function and would make sense to split in some way. There are two point where make sense to insert this code in my opinion. As you can see here or complicated this condition } else if (images->legacy_hdr_valid && image_check_type(&images->legacy_hdr_os_copy, IH_TYPE_MULTI)) { I don't test it so far. Anyway, I have seen that some android image (aka fsl) use this address. diff --git a/common/image-android.c b/common/image-android.c index ee03b96..9701acd 100644 --- a/common/image-android.c +++ b/common/image-android.c @@ -146,6 +146,27 @@ int android_image_get_ramdisk(const struct andr_img_hdr *hdr, return 0; } +int android_image_get_dts(const struct andr_img_hdr *hdr, + ulong *dts_data, ulong *dts_len) +{ + if (!hdr->second_size) { + *dts_data = *dts_len = 0; + return -1; + } + + printf("Dts load addr 0x%08x size %u KiB\n", + hdr->second_addr, DIV_ROUND_UP(hdr->second_size, 1024)); + + *dts_data = (unsigned long)hdr; + *dts_data += hdr->page_size; + *dts_data += ALIGN(hdr->kernel_size, hdr->page_size); + *dts_data += ALIGN(hdr->ramdisk_size, hdr->page_size); + + *dts_len = hdr->second_size; + return 0; +} + #if !defined(CONFIG_SPL_BUILD) /** * android_print_contents - prints out the contents of the Android format image diff --git a/common/image-fdt.c b/common/image-fdt.c index 6cac7db..cdcdfd3 100644 --- a/common/image-fdt.c +++ b/common/image-fdt.c @@ -345,6 +345,30 @@ int boot_get_fdt(int flag, int argc, char * const argv[], uint8_t arch, fdt_addr = load; break; #endif +#if defined(CONFIG_ANDROID_BOOT_IMAGE) + case IMAGE_FORMAT_ANDROID: { + ulong fdt_data, fdt_len; + android_image_get_dts(buf, &fdt_data, &fdt_len); + if (fdt_len) { + fdt_blob = (char *)fdt_data; + printf(" Booting using the fdt at 0x%p\n", fdt_blob); + + if (fdt_check_header(fdt_blob) != 0) { + fdt_error("image is not a fdt"); + goto error; + } + + if (fdt_totalsize(fdt_blob) != fdt_len) { + fdt_error("fdt size != image size"); + goto error; + } + } else { + debug("## No Flattened Device Tree\n"); + goto no_fdt; + } + } + break; +#endif case IMAGE_FORMAT_FIT: /* * This case will catch both: new uImage format diff --git a/include/image.h b/include/image.h index 61b5d3b..f475481 100644 --- a/include/image.h +++ b/include/image.h @@ -1147,6 +1147,8 @@ struct andr_img_hdr; int android_image_check_header(const struct andr_img_hdr *hdr); int android_image_get_kernel(const struct andr_img_hdr *hdr, int verify, ulong *os_data, ulong *os_len); +int android_image_get_dts(const struct andr_img_hdr *hdr, + ulong *dts_data, ulong *dts_len); int android_image_get_ramdisk(const struct andr_img_hdr *hdr, ulong *rd_data, ulong *rd_len); ulong android_image_get_end(const struct andr_img_hdr *hdr);