Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/809831/?format=api
{ "id": 809831, "url": "http://patchwork.ozlabs.org/api/patches/809831/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/1504555943-12893-8-git-send-email-pantelis.antoniou@konsulko.com/", "project": { "id": 18, "url": "http://patchwork.ozlabs.org/api/projects/18/?format=api", "name": "U-Boot", "link_name": "uboot", "list_id": "u-boot.lists.denx.de", "list_email": "u-boot@lists.denx.de", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<1504555943-12893-8-git-send-email-pantelis.antoniou@konsulko.com>", "list_archive_url": null, "date": "2017-09-04T20:12:16", "name": "[U-Boot,v3,07/14] fit: Introduce methods for applying overlays on fit-load", "commit_ref": "169043d826e6b0db3c67a60acbedfc72c43aae5d", "pull_url": null, "state": "accepted", "archived": false, "hash": "28788f90d77a565144fd30c4d381289edc9b4fa0", "submitter": { "id": 64098, "url": "http://patchwork.ozlabs.org/api/people/64098/?format=api", "name": "Pantelis Antoniou", "email": "pantelis.antoniou@konsulko.com" }, "delegate": { "id": 3184, "url": "http://patchwork.ozlabs.org/api/users/3184/?format=api", "username": "sjg", "first_name": "Simon", "last_name": "Glass", "email": "sjg@chromium.org" }, "mbox": "http://patchwork.ozlabs.org/project/uboot/patch/1504555943-12893-8-git-send-email-pantelis.antoniou@konsulko.com/mbox/", "series": [ { "id": 1453, "url": "http://patchwork.ozlabs.org/api/series/1453/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/list/?series=1453", "date": "2017-09-04T20:12:09", "name": "uboot overlays, FIT image & unittest", "version": 3, "mbox": "http://patchwork.ozlabs.org/series/1453/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/809831/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/809831/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<u-boot-bounces@lists.denx.de>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org", "Authentication-Results": [ "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)", "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=konsulko.com header.i=@konsulko.com\n\theader.b=\"ZQVQDNXt\"; dkim-atps=neutral" ], "Received": [ "from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xmLlm175pz9t2R\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 5 Sep 2017 06:19:00 +1000 (AEST)", "by lists.denx.de (Postfix, from userid 105)\n\tid DA560C21EE1; Mon, 4 Sep 2017 20:16:29 +0000 (UTC)", "from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 2C830C21F49;\n\tMon, 4 Sep 2017 20:15:45 +0000 (UTC)", "by lists.denx.de (Postfix, from userid 105)\n\tid 5C502C21DD7; Mon, 4 Sep 2017 20:13:12 +0000 (UTC)", "from mail-wm0-f49.google.com (mail-wm0-f49.google.com\n\t[74.125.82.49])\n\tby lists.denx.de (Postfix) with ESMTPS id 49708C21EEC\n\tfor <u-boot@lists.denx.de>; Mon, 4 Sep 2017 20:13:05 +0000 (UTC)", "by mail-wm0-f49.google.com with SMTP id u26so8728014wma.0\n\tfor <u-boot@lists.denx.de>; Mon, 04 Sep 2017 13:13:05 -0700 (PDT)", "from localhost.localdomain ([195.97.110.117])\n\tby smtp.gmail.com with ESMTPSA id\n\tu8sm3720435wrc.92.2017.09.04.13.13.02\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tMon, 04 Sep 2017 13:13:04 -0700 (PDT)" ], "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,\n\tRCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,\n\tT_DKIM_INVALID autolearn=unavailable\n\tautolearn_force=no version=3.4.0", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com;\n\ts=google; \n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=jE5DEU/+VQnbYF9YNgjzHj1W+unyJSU/HHVDu8xSPv8=;\n\tb=ZQVQDNXtCkMyaC4CUdwyi/kmmPwVdJ7FiOr574Ww6lsM5Yis1y9X36VMzlBQy3vGmj\n\tQuHeVLNmpFbxVkXH0SneVTo1+nqsKy9M1Y8ynNipkY4bZ+qToglDq7xfmU6WMhxofjTG\n\tlacPjGrPmfAUg/GDw6GLI10KdTIyfExBTw2ig=", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=jE5DEU/+VQnbYF9YNgjzHj1W+unyJSU/HHVDu8xSPv8=;\n\tb=e8nmzdYBU7xeK3ol7EmYhmNmIQfwgxRRBtPZx4ckSO8qCZmLCBYkOLbOcDTGtx3r9q\n\tDfz/qIHGXDSS1i0sE73bs+Hua5+jYNUM9itFdxsJimYJ7NJLxR5hTfyJRazUcuMMruGD\n\tHQdJO3MDu8ikNAqkDpPpSMS3MYiml4EWJ82nSW/5bdyHZcZl7757Wq+9c0UlO5bDn7vR\n\trRJ8iaSWD+Xw5RPw+WV/IsbRLz/JTzksBfXZCuh/zmgo17In6V2sApw9fsg3y+Wo9w1v\n\tYLXhPjpShMXXxaQwMKV7enwnlLfacD2EajoXR4lFYpPm57Y2frt4HJHno4TnQ5pFYSzw\n\tlLzA==", "X-Gm-Message-State": "AHPjjUiy2jo60mo7RFyj+7wBp09fWEuiF9NGSKNiwmRh7Yp2bpNUlNdN\n\tyHMFy7ovSX27KEuu", "X-Google-Smtp-Source": "ADKCNb4es27i+Dim00AM5tel4juILhoo671XKUvdpqtbKBJniwgZvEAgm0ktKiAaGID+fxBVrTP3nQ==", "X-Received": "by 10.28.9.137 with SMTP id 131mr1029112wmj.87.1504555984805;\n\tMon, 04 Sep 2017 13:13:04 -0700 (PDT)", "From": "Pantelis Antoniou <pantelis.antoniou@konsulko.com>", "To": "Tom Rini <trini@konsulko.com>", "Date": "Mon, 4 Sep 2017 23:12:16 +0300", "Message-Id": "<1504555943-12893-8-git-send-email-pantelis.antoniou@konsulko.com>", "X-Mailer": "git-send-email 2.1.4", "In-Reply-To": "<1504555943-12893-1-git-send-email-pantelis.antoniou@konsulko.com>", "References": "<1504555943-12893-1-git-send-email-pantelis.antoniou@konsulko.com>", "Cc": "Marek Vasut <marex@denx.de>,\n\tPantelis Antoniou <pantelis.antoniou@konsulko.com>,\n\tTero Kristo <t-kristo@ti.com>, u-boot@lists.denx.de,\n\tMaxime Ripard <maxime.ripard@free-electrons.com>,\n\tStefan Roese <sr@denx.de>, Alan Ott <alan@signal11.us>", "Subject": "[U-Boot] [PATCH v3 07/14] fit: Introduce methods for applying\n\toverlays on fit-load", "X-BeenThere": "u-boot@lists.denx.de", "X-Mailman-Version": "2.1.18", "Precedence": "list", "List-Id": "U-Boot discussion <u-boot.lists.denx.de>", "List-Unsubscribe": "<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>", "List-Archive": "<http://lists.denx.de/pipermail/u-boot/>", "List-Post": "<mailto:u-boot@lists.denx.de>", "List-Help": "<mailto:u-boot-request@lists.denx.de?subject=help>", "List-Subscribe": "<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"utf-8\"", "Content-Transfer-Encoding": "base64", "Errors-To": "u-boot-bounces@lists.denx.de", "Sender": "\"U-Boot\" <u-boot-bounces@lists.denx.de>" }, "content": "Introduce an overlay based method for constructing a base DT blob\nto pass to the kernel.\n\nIt is based on a specific method now to get the FDT from a FIT image\nnamed boot_get_fdt_fit().\n\nSigned-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>\n---\n common/image-fdt.c | 7 +--\n common/image-fit.c | 181 +++++++++++++++++++++++++++++++++++++++++++++++++++--\n include/image.h | 25 ++++++++\n 3 files changed, 205 insertions(+), 8 deletions(-)", "diff": "diff --git a/common/image-fdt.c b/common/image-fdt.c\nindex da4d007..a2ef409 100644\n--- a/common/image-fdt.c\n+++ b/common/image-fdt.c\n@@ -356,17 +356,16 @@ int boot_get_fdt(int flag, int argc, char * const argv[], uint8_t arch,\n \t\t\tif (fit_check_format(buf)) {\n \t\t\t\tulong load, len;\n \n-\t\t\t\tfdt_noffset = fit_image_load(images,\n+\t\t\t\tfdt_noffset = boot_get_fdt_fit(images,\n \t\t\t\t\tfdt_addr, &fit_uname_fdt,\n \t\t\t\t\t&fit_uname_config,\n-\t\t\t\t\tarch, IH_TYPE_FLATDT,\n-\t\t\t\t\tBOOTSTAGE_ID_FIT_FDT_START,\n-\t\t\t\t\tFIT_LOAD_OPTIONAL, &load, &len);\n+\t\t\t\t\tarch, &load, &len);\n \n \t\t\t\timages->fit_hdr_fdt = map_sysmem(fdt_addr, 0);\n \t\t\t\timages->fit_uname_fdt = fit_uname_fdt;\n \t\t\t\timages->fit_noffset_fdt = fdt_noffset;\n \t\t\t\tfdt_addr = load;\n+\n \t\t\t\tbreak;\n \t\t\t} else\n #endif\ndiff --git a/common/image-fit.c b/common/image-fit.c\nindex e75cb64..7f17fd1 100644\n--- a/common/image-fit.c\n+++ b/common/image-fit.c\n@@ -19,6 +19,7 @@\n #include <errno.h>\n #include <mapmem.h>\n #include <asm/io.h>\n+#include <malloc.h>\n DECLARE_GLOBAL_DATA_PTR;\n #endif /* !USE_HOSTCC*/\n \n@@ -434,6 +435,10 @@ void fit_image_print(const void *fit, int image_noffset, const char *p)\n \t\t\tprintf(\"0x%08lx\\n\", load);\n \t}\n \n+\t/* optional load address for FDT */\n+\tif (type == IH_TYPE_FLATDT && !fit_image_get_load(fit, image_noffset, &load))\n+\t\tprintf(\"%s Load Address: 0x%08lx\\n\", p, load);\n+\n \tif ((type == IH_TYPE_KERNEL) || (type == IH_TYPE_STANDALONE) ||\n \t (type == IH_TYPE_RAMDISK)) {\n \t\tret = fit_image_get_entry(fit, image_noffset, &entry);\n@@ -1454,6 +1459,8 @@ int fit_conf_get_node(const void *fit, const char *conf_uname)\n {\n \tint noffset, confs_noffset;\n \tint len;\n+\tconst char *s;\n+\tchar *conf_uname_copy = NULL;\n \n \tconfs_noffset = fdt_path_offset(fit, FIT_CONFS_PATH);\n \tif (confs_noffset < 0) {\n@@ -1475,12 +1482,29 @@ int fit_conf_get_node(const void *fit, const char *conf_uname)\n \t\tdebug(\"Found default configuration: '%s'\\n\", conf_uname);\n \t}\n \n+\ts = strchr(conf_uname, '#');\n+\tif (s) {\n+\t\tlen = s - conf_uname;\n+\t\tconf_uname_copy = malloc(len + 1);\n+\t\tif (!conf_uname_copy) {\n+\t\t\tdebug(\"Can't allocate uname copy: '%s'\\n\",\n+\t\t\t\t\tconf_uname);\n+\t\t\treturn -ENOMEM;\n+\t\t}\n+\t\tmemcpy(conf_uname_copy, conf_uname, len);\n+\t\tconf_uname_copy[len] = '\\0';\n+\t\tconf_uname = conf_uname_copy;\n+\t}\n+\n \tnoffset = fdt_subnode_offset(fit, confs_noffset, conf_uname);\n \tif (noffset < 0) {\n \t\tdebug(\"Can't get node offset for configuration unit name: '%s' (%s)\\n\",\n \t\t conf_uname, fdt_strerror(noffset));\n \t}\n \n+\tif (conf_uname_copy)\n+\t\tfree(conf_uname_copy);\n+\n \treturn noffset;\n }\n \n@@ -1527,7 +1551,7 @@ void fit_conf_print(const void *fit, int noffset, const char *p)\n \tchar *desc;\n \tconst char *uname;\n \tint ret;\n-\tint loadables_index;\n+\tint fdt_index, loadables_index;\n \n \t/* Mandatory properties */\n \tret = fit_get_desc(fit, noffset, &desc);\n@@ -1549,9 +1573,17 @@ void fit_conf_print(const void *fit, int noffset, const char *p)\n \tif (uname)\n \t\tprintf(\"%s Init Ramdisk: %s\\n\", p, uname);\n \n-\tuname = fdt_getprop(fit, noffset, FIT_FDT_PROP, NULL);\n-\tif (uname)\n-\t\tprintf(\"%s FDT: %s\\n\", p, uname);\n+\tfor (fdt_index = 0;\n+\t uname = fdt_stringlist_get(fit, noffset, FIT_FDT_PROP,\n+\t\t\t\t\tfdt_index, NULL), uname;\n+\t fdt_index++) {\n+\n+\t\tif (fdt_index == 0)\n+\t\t\tprintf(\"%s FDT: \", p);\n+\t\telse\n+\t\t\tprintf(\"%s \", p);\n+\t\tprintf(\"%s\\n\", uname);\n+\t}\n \n \tuname = fdt_getprop(fit, noffset, FIT_FPGA_PROP, NULL);\n \tif (uname)\n@@ -1888,3 +1920,144 @@ int boot_get_setup_fit(bootm_headers_t *images, uint8_t arch,\n \n \treturn ret;\n }\n+\n+#ifndef USE_HOSTCC\n+int boot_get_fdt_fit(bootm_headers_t *images, ulong addr,\n+\t\t const char **fit_unamep, const char **fit_uname_configp,\n+\t\t int arch, ulong *datap, ulong *lenp)\n+{\n+\tint fdt_noffset, cfg_noffset, count;\n+\tconst void *fit;\n+\tconst char *fit_uname = NULL;\n+\tconst char *fit_uname_config = NULL;\n+\tchar *fit_uname_config_copy = NULL;\n+\tchar *next_config = NULL;\n+\tulong load, len;\n+#ifdef CONFIG_OF_LIBFDT_OVERLAY\n+\tulong image_start, image_end;\n+\tulong ovload, ovlen;\n+\tconst char *uconfig;\n+\tconst char *uname;\n+\tvoid *base, *ov;\n+\tint i, err, noffset, ov_noffset;\n+#endif\n+\n+\tfit_uname = fit_unamep ? *fit_unamep : NULL;\n+\n+\tif (fit_uname_configp && *fit_uname_configp) {\n+\t\tfit_uname_config_copy = strdup(*fit_uname_configp);\n+\t\tif (!fit_uname_config_copy)\n+\t\t\treturn -ENOMEM;\n+\n+\t\tnext_config = strchr(fit_uname_config_copy, '#');\n+\t\tif (next_config)\n+\t\t\t*next_config++ = '\\0';\n+\t\tif (next_config - 1 > fit_uname_config_copy)\n+\t\t\tfit_uname_config = fit_uname_config_copy;\n+\t}\n+\n+\tfdt_noffset = fit_image_load(images,\n+\t\taddr, &fit_uname, &fit_uname_config,\n+\t\tarch, IH_TYPE_FLATDT,\n+\t\tBOOTSTAGE_ID_FIT_FDT_START,\n+\t\tFIT_LOAD_OPTIONAL, &load, &len);\n+\n+\tif (fdt_noffset < 0)\n+\t\tgoto out;\n+\n+\tdebug(\"fit_uname=%s, fit_uname_config=%s\\n\",\n+\t\t\tfit_uname ? fit_uname : \"<NULL>\",\n+\t\t\tfit_uname_config ? fit_uname_config : \"<NULL>\");\n+\n+\tfit = map_sysmem(addr, 0);\n+\n+\tcfg_noffset = fit_conf_get_node(fit, fit_uname_config);\n+\n+\t/* single blob, or error just return as well */\n+\tcount = fit_conf_get_prop_node_count(fit, cfg_noffset, FIT_FDT_PROP);\n+\tif (count <= 1 && !next_config)\n+\t\tgoto out;\n+\n+\t/* we need to apply overlays */\n+\n+#ifdef CONFIG_OF_LIBFDT_OVERLAY\n+\timage_start = addr;\n+\timage_end = addr + fit_get_size(fit);\n+\t/* verify that relocation took place by load address not being in fit */\n+\tif (load >= image_start && load < image_end) {\n+\t\t/* check is simplified; fit load checks for overlaps */\n+\t\tprintf(\"Overlayed FDT requires relocation\\n\");\n+\t\tfdt_noffset = -EBADF;\n+\t\tgoto out;\n+\t}\n+\n+\tbase = map_sysmem(load, len);\n+\n+\t/* apply extra configs in FIT first, followed by args */\n+\tfor (i = 1; ; i++) {\n+\t\tif (i < count) {\n+\t\t\tnoffset = fit_conf_get_prop_node_index(fit, cfg_noffset,\n+\t\t\t\t\t\t\t FIT_FDT_PROP, i);\n+\t\t\tuname = fit_get_name(fit, noffset, NULL);\n+\t\t\tuconfig = NULL;\n+\t\t} else {\n+\t\t\tif (!next_config)\n+\t\t\t\tbreak;\n+\t\t\tuconfig = next_config;\n+\t\t\tnext_config = strchr(next_config, '#');\n+\t\t\tif (next_config)\n+\t\t\t\t*next_config++ = '\\0';\n+\t\t\tuname = NULL;\n+\t\t}\n+\n+\t\tdebug(\"%d: using uname=%s uconfig=%s\\n\", i, uname, uconfig);\n+\n+\t\tov_noffset = fit_image_load(images,\n+\t\t\taddr, &uname, &uconfig,\n+\t\t\tarch, IH_TYPE_FLATDT,\n+\t\t\tBOOTSTAGE_ID_FIT_FDT_START,\n+\t\t\tFIT_LOAD_REQUIRED, &ovload, &ovlen);\n+\t\tif (ov_noffset < 0) {\n+\t\t\tprintf(\"load of %s failed\\n\", uname);\n+\t\t\tcontinue;\n+\t\t}\n+\t\tdebug(\"%s loaded at 0x%08lx len=0x%08lx\\n\",\n+\t\t\t\tuname, ovload, ovlen);\n+\t\tov = map_sysmem(ovload, ovlen);\n+\n+\t\tbase = map_sysmem(load, len + ovlen);\n+\t\terr = fdt_open_into(base, base, len + ovlen);\n+\t\tif (err < 0) {\n+\t\t\tprintf(\"failed on fdt_open_into\\n\");\n+\t\t\tfdt_noffset = err;\n+\t\t\tgoto out;\n+\t\t}\n+\t\t/* the verbose method prints out messages on error */\n+\t\terr = fdt_overlay_apply_verbose(base, ov);\n+\t\tif (err < 0) {\n+\t\t\tfdt_noffset = err;\n+\t\t\tgoto out;\n+\t\t}\n+\t\tfdt_pack(base);\n+\t\tlen = fdt_totalsize(base);\n+\t}\n+#else\n+\tprintf(\"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set\\n\");\n+\tfdt_noffset = -EBADF;\n+#endif\n+\n+out:\n+\tif (datap)\n+\t\t*datap = load;\n+\tif (lenp)\n+\t\t*lenp = len;\n+\tif (fit_unamep)\n+\t\t*fit_unamep = fit_uname;\n+\tif (fit_uname_configp)\n+\t\t*fit_uname_configp = fit_uname_config;\n+\n+\tif (fit_uname_config_copy)\n+\t\tfree(fit_uname_config_copy);\n+\treturn fdt_noffset;\n+}\n+#endif\ndiff --git a/include/image.h b/include/image.h\nindex 1f4bfda..eca9b46 100644\n--- a/include/image.h\n+++ b/include/image.h\n@@ -593,6 +593,31 @@ int boot_get_setup_fit(bootm_headers_t *images, uint8_t arch,\n \t\t ulong *setup_start, ulong *setup_len);\n \n /**\n+ * boot_get_fdt_fit() - load a DTB from a FIT file (applying overlays)\n+ *\n+ * This deals with all aspects of loading an DTB from a FIT.\n+ * The correct base image based on configuration will be selected, and\n+ * then any overlays specified will be applied (as present in fit_uname_configp).\n+ *\n+ * @param images\tBoot images structure\n+ * @param addr\t\tAddress of FIT in memory\n+ * @param fit_unamep\tOn entry this is the requested image name\n+ *\t\t\t(e.g. \"kernel@1\") or NULL to use the default. On exit\n+ *\t\t\tpoints to the selected image name\n+ * @param fit_uname_configp\tOn entry this is the requested configuration\n+ *\t\t\tname (e.g. \"conf@1\") or NULL to use the default. On\n+ *\t\t\texit points to the selected configuration name.\n+ * @param arch\t\tExpected architecture (IH_ARCH_...)\n+ * @param datap\t\tReturns address of loaded image\n+ * @param lenp\t\tReturns length of loaded image\n+ *\n+ * @return node offset of base image, or -ve error code on error\n+ */\n+int boot_get_fdt_fit(bootm_headers_t *images, ulong addr,\n+\t\t const char **fit_unamep, const char **fit_uname_configp,\n+\t\t int arch, ulong *datap, ulong *lenp);\n+\n+/**\n * fit_image_load() - load an image from a FIT\n *\n * This deals with all aspects of loading an image from a FIT, including\n", "prefixes": [ "U-Boot", "v3", "07/14" ] }