From patchwork Fri Nov 4 13:22:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomeu Vizoso X-Patchwork-Id: 80862 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp1152425qge; Fri, 4 Nov 2016 06:28:39 -0700 (PDT) X-Received: by 10.194.127.161 with SMTP id nh1mr11753347wjb.61.1478266119390; Fri, 04 Nov 2016 06:28:39 -0700 (PDT) Return-Path: Received: from theia.denx.de (theia.denx.de. [85.214.87.163]) by mx.google.com with ESMTP id fu10si15178159wjc.118.2016.11.04.06.28.39; Fri, 04 Nov 2016 06:28:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 85.214.87.163 as permitted sender) client-ip=85.214.87.163; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 85.214.87.163 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A94E5A760A; Fri, 4 Nov 2016 14:28:38 +0100 (CET) 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 uGW6QirIygBe; Fri, 4 Nov 2016 14:28:38 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2B9B9A75F8; Fri, 4 Nov 2016 14:28:38 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 693E8A75F8 for ; Fri, 4 Nov 2016 14:28:34 +0100 (CET) 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 qKBsJaZ4cTgp for ; Fri, 4 Nov 2016 14:28:34 +0100 (CET) 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-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) by theia.denx.de (Postfix) with ESMTPS id 2C1B2A75F5 for ; Fri, 4 Nov 2016 14:28:29 +0100 (CET) Received: by mail-wm0-f66.google.com with SMTP id p190so3938757wmp.1 for ; Fri, 04 Nov 2016 06:28:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id; bh=8cP5NXPmG09rVnuACLqYv70ou4PtcFUFUJxAebmmjEw=; b=jMdUiwdcK+hIzOxPov2wWJCbt47K8oYtXWjbYE70YiBXsC/ZVk01ux3/uBQL1BtGSa cPk/aH0OJS4tpvpE6feLAwHRcLfj8yDrwA1f6WceP6LhOSf8XmZp9pYb2X1qminnQFQ9 6TaIlzK5KI/iBcWXXnjMATn8spKudrl6giH+MIPepsIzzKxkwLDtQ6yDKB0Pm5ySFrEy mM2ol5IbZrNmjzC4DUfi2RTQha9ZeGyrcRcETiHPp07FfIwPowNG+0xUSm8MudgeS7Bc HOXPUPYjJdSdye69kKw3GHZAZM9QyJHETUcLU8h3fFjpj24i/kb/JJIjLFz+akxNKbFJ aQYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=8cP5NXPmG09rVnuACLqYv70ou4PtcFUFUJxAebmmjEw=; b=Opr9gqHHzOPPWnRh+2Js/utQruajbvNdmmCk4PfsKg6IWtpUkAZ43xKSwXFQqw3vmP CnYDQlR/vroPx508IlY0xJtcIExn3pI+FV97b6Z4b8gvkJHWtobAyOnjaxKMG3fq+772 jUq4flpKjO6p3QS9p7ZJyZndAlFPE+yxFJCvAw/Up1Hykm09kkrOBeyFdklfe2ulcTCv hQHY3IfLqNjcvGQtasgF0rchJyuZreRyow1c/qdjuV9lgHJVf9kFFIPXEHLwUp7MSG4m tWXsxJ1zZcrBfKP84OZssgaBC5UymnKtlu2tZT5g55bLpiUOh27Sld3UcfdZsvECdVOJ rP0Q== X-Gm-Message-State: ABUngvdbvL4BwVd8Vl/tnjY3+z9pomS0ujKvGfETYb5On0MBzdHOYAjhuIDI2pRdYIqOnA== X-Received: by 10.28.154.86 with SMTP id c83mr3315947wme.23.1478265785978; Fri, 04 Nov 2016 06:23:05 -0700 (PDT) Received: from cizrna.lan ([109.72.12.48]) by smtp.gmail.com with ESMTPSA id 1sm4552249wmk.22.2016.11.04.06.23.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 04 Nov 2016 06:23:05 -0700 (PDT) From: Tomeu Vizoso To: u-boot@lists.denx.de Date: Fri, 4 Nov 2016 14:22:15 +0100 Message-Id: <1478265735-17373-1-git-send-email-tomeu.vizoso@collabora.com> X-Mailer: git-send-email 2.7.4 Cc: Neil Williams , Matt Hart Subject: [U-Boot] [PATCH] mkimage: Allow including a ramdisk in FIT auto mode 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: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Adds -i option that allows specifying a ramdisk file to be added to the FIT image when we are using the automatic FIT mode (no ITS file). This makes adding Depthcharge support to LAVA much more convenient, as no additional configuration files need to be kept around in the machine that dispatches jobs to the boards. Signed-off-by: Tomeu Vizoso Cc: Simon Glass Cc: Matt Hart Cc: Neil Williams --- doc/mkimage.1 | 4 ++++ tools/fit_image.c | 33 ++++++++++++++++++++++++++++++++- tools/imagetool.h | 1 + tools/mkimage.c | 10 +++++++--- 4 files changed, 44 insertions(+), 4 deletions(-) -- 2.7.4 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot Reviewed-by: Simon Glass diff --git a/doc/mkimage.1 b/doc/mkimage.1 index e883f07849a6..3dcdcedcefaf 100644 --- a/doc/mkimage.1 +++ b/doc/mkimage.1 @@ -138,6 +138,10 @@ This can be used to sign images with additional keys after initial image creation. .TP +.BI "\-i [" "ramdisk_file" "]" +Appends the ramdisk file to the FIT. + +.TP .BI "\-k [" "key_directory" "]" Specifies the directory containing keys to use for signing. This directory should contain a private key file .key for use with signing and a diff --git a/tools/fit_image.c b/tools/fit_image.c index 10fd6d492937..efd8a97a0b92 100644 --- a/tools/fit_image.c +++ b/tools/fit_image.c @@ -85,8 +85,15 @@ static int fit_calc_size(struct image_tool_params *params) size = imagetool_get_filesize(params, params->datafile); if (size < 0) return -1; - total_size = size; + + if (params->fit_ramdisk) { + size = imagetool_get_filesize(params, params->fit_ramdisk); + if (size < 0) + return -1; + total_size += size; + } + for (cont = params->content_head; cont; cont = cont->next) { size = imagetool_get_filesize(params, cont->fname); if (size < 0) @@ -233,6 +240,20 @@ static int fit_write_images(struct image_tool_params *params, char *fdt) fdt_end_node(fdt); } + /* And a ramdisk file if available */ + if (params->fit_ramdisk) { + fdt_begin_node(fdt, FIT_RAMDISK_PROP "@1"); + + fdt_property_string(fdt, "type", FIT_RAMDISK_PROP); + fdt_property_string(fdt, "os", genimg_get_os_short_name(params->os)); + + ret = fdt_property_file(params, fdt, "data", params->fit_ramdisk); + if (ret) + return ret; + + fdt_end_node(fdt); + } + fdt_end_node(fdt); return 0; @@ -272,15 +293,25 @@ static void fit_write_configs(struct image_tool_params *params, char *fdt) snprintf(str, sizeof(str), "%s@1", typename); fdt_property_string(fdt, typename, str); + if (params->fit_ramdisk) + fdt_property_string(fdt, FIT_RAMDISK_PROP, + FIT_RAMDISK_PROP "@1"); + snprintf(str, sizeof(str), FIT_FDT_PROP "@%d", upto); fdt_property_string(fdt, FIT_FDT_PROP, str); fdt_end_node(fdt); } + if (!upto) { fdt_begin_node(fdt, "conf@1"); typename = genimg_get_type_short_name(params->fit_image_type); snprintf(str, sizeof(str), "%s@1", typename); fdt_property_string(fdt, typename, str); + + if (params->fit_ramdisk) + fdt_property_string(fdt, FIT_RAMDISK_PROP, + FIT_RAMDISK_PROP "@1"); + fdt_end_node(fdt); } diff --git a/tools/imagetool.h b/tools/imagetool.h index 6c1a9d376058..15c2a0c0e1c1 100644 --- a/tools/imagetool.h +++ b/tools/imagetool.h @@ -70,6 +70,7 @@ struct image_tool_params { int orig_file_size; /* Original size for file before padding */ bool auto_its; /* Automatically create the .its file */ int fit_image_type; /* Image type to put into the FIT */ + char *fit_ramdisk; /* Ramdisk file to include */ struct content_info *content_head; /* List of files to include */ struct content_info *content_tail; bool external_data; /* Store data outside the FIT */ diff --git a/tools/mkimage.c b/tools/mkimage.c index 0c6dba89a099..49d5d1ed70a7 100644 --- a/tools/mkimage.c +++ b/tools/mkimage.c @@ -88,12 +88,13 @@ static void usage(const char *msg) " -x ==> set XIP (execute in place)\n", params.cmdname); fprintf(stderr, - " %s [-D dtc_options] [-f fit-image.its|-f auto|-F] [-b [-b ]] fit-image\n" + " %s [-D dtc_options] [-f fit-image.its|-f auto|-F] [-b [-b ]] [-i ] fit-image\n" " file is used with -f auto, it may occur multiple times.\n", params.cmdname); fprintf(stderr, " -D => set all options for device tree compiler\n" - " -f => input filename for FIT source\n"); + " -f => input filename for FIT source\n" + " -i => input filename for ramdisk file\n"); #ifdef CONFIG_FIT_SIGNATURE fprintf(stderr, "Signing / verified boot options: [-E] [-k keydir] [-K dtb] [ -c ] [-p addr] [-r]\n" @@ -141,7 +142,7 @@ static void process_args(int argc, char **argv) int opt; while ((opt = getopt(argc, argv, - "a:A:b:c:C:d:D:e:Ef:Fk:K:ln:p:O:rR:qsT:vVx")) != -1) { + "a:A:b:c:C:d:D:e:Ef:Fk:i:K:ln:p:O:rR:qsT:vVx")) != -1) { switch (opt) { case 'a': params.addr = strtoull(optarg, &ptr, 16); @@ -207,6 +208,9 @@ static void process_args(int argc, char **argv) params.type = IH_TYPE_FLATDT; params.fflag = 1; break; + case 'i': + params.fit_ramdisk = optarg; + break; case 'k': params.keydir = optarg; break;