{"id":812761,"url":"http://patchwork.ozlabs.org/api/1.2/patches/812761/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/patch/20170912092410.9289-1-dengler@linutronix.de/","project":{"id":18,"url":"http://patchwork.ozlabs.org/api/1.2/projects/18/?format=json","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":"<20170912092410.9289-1-dengler@linutronix.de>","list_archive_url":null,"date":"2017-09-12T09:24:10","name":"[U-Boot,RESEND,v2] cmd: set filesize variable in ubi read","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"84598bc7b381c3947445d5b45ed50bd91c6b53b8","submitter":{"id":72011,"url":"http://patchwork.ozlabs.org/api/1.2/people/72011/?format=json","name":"Holger Dengler","email":"dengler@linutronix.de"},"delegate":{"id":3651,"url":"http://patchwork.ozlabs.org/api/1.2/users/3651/?format=json","username":"trini","first_name":"Tom","last_name":"Rini","email":"trini@ti.com"},"mbox":"http://patchwork.ozlabs.org/project/uboot/patch/20170912092410.9289-1-dengler@linutronix.de/mbox/","series":[{"id":2659,"url":"http://patchwork.ozlabs.org/api/1.2/series/2659/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/list/?series=2659","date":"2017-09-12T09:24:10","name":"[U-Boot,RESEND,v2] cmd: set filesize variable in ubi read","version":2,"mbox":"http://patchwork.ozlabs.org/series/2659/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/812761/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/812761/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>)","Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xs1bk2ydgz9sRg\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 12 Sep 2017 20:43:14 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid 21928C21F02; Tue, 12 Sep 2017 10:42:53 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id EC2ADC21FDE;\n\tTue, 12 Sep 2017 10:37:12 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid B0D92C21C57; Tue, 12 Sep 2017 09:24:39 +0000 (UTC)","from Galois.linutronix.de (Galois.linutronix.de [146.0.238.70])\n\tby lists.denx.de (Postfix) with ESMTPS id AD207C21C40\n\tfor <u-boot@lists.denx.de>; Tue, 12 Sep 2017 09:24:38 +0000 (UTC)","from p54bc52b0.dip0.t-ipconnect.de ([84.188.82.176]\n\thelo=linutronix.de) by Galois.linutronix.de with esmtpsa\n\t(TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256)\n\t(Exim 4.80) (envelope-from <dengler@linutronix.de>)\n\tid 1drhPD-0003kw-Az; Tue, 12 Sep 2017 11:22:55 +0200"],"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=none autolearn=unavailable\n\tautolearn_force=no version=3.4.0","From":"Holger Dengler <dengler@linutronix.de>","To":"Heiko Schocher <hs@denx.de>,\n\tKyungmin Park <kmpark@infradead.org>","Date":"Tue, 12 Sep 2017 11:24:10 +0200","Message-Id":"<20170912092410.9289-1-dengler@linutronix.de>","X-Mailer":"git-send-email 2.14.1","X-Linutronix-Spam-Score":"-1.0","X-Linutronix-Spam-Level":"-","X-Linutronix-Spam-Status":"No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,\n\tSHORTCIRCUIT=-0.0001","X-Mailman-Approved-At":"Tue, 12 Sep 2017 10:37:09 +0000","Cc":"\"xypron.glpk@gmx.de\" <xypron.glpk@gmx.de>, u-boot@lists.denx.de,\n\tHolger Dengler <dengler@linutronix.de>","Subject":"[U-Boot] [RESEND PATCH v2] cmd: set filesize variable in ubi read","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":"After a successful read of a UBI volume, the variable filesize is set\nto the number of read bytes. To boot linux with a raw initramfs/initrd,\nyou must specify the exact size of the initramfs/initrd image in boot\ncommand. If the initramfs/inird is read from UBI volume, $filesize is\nrequired to access the number of read bytes.\n\nExample:\n  ubi read ${loadaddr} kernelvol\n  ubi read ${fdtaddr} dtbvol\n  ubi read ${initrd_addr} initrdvol\n  bootz ${loadaddr} ${initrd_addr}:${filesize} ${fdt_addr}\n\nSigned-off-by: Holger Dengler <dengler@linutronix.de>\n---\n\nChanges in v2:\n- use renamed env_set_hex() function\n\n cmd/ubi.c | 5 +++++\n 1 file changed, 5 insertions(+)","diff":"diff --git a/cmd/ubi.c b/cmd/ubi.c\nindex 222be5a357..ac9a582437 100644\n--- a/cmd/ubi.c\n+++ b/cmd/ubi.c\n@@ -334,6 +334,7 @@ int ubi_volume_read(char *volume, char *buf, size_t size)\n \tunsigned long long tmp;\n \tstruct ubi_volume *vol;\n \tloff_t offp = 0;\n+\tsize_t len_read;\n \n \tvol = ubi_find_volume(volume);\n \tif (vol == NULL)\n@@ -373,6 +374,7 @@ int ubi_volume_read(char *volume, char *buf, size_t size)\n \ttmp = offp;\n \toff = do_div(tmp, vol->usable_leb_size);\n \tlnum = tmp;\n+\tlen_read = size;\n \tdo {\n \t\tif (off + len >= vol->usable_leb_size)\n \t\t\tlen = vol->usable_leb_size - off;\n@@ -398,6 +400,9 @@ int ubi_volume_read(char *volume, char *buf, size_t size)\n \t\tlen = size > tbuf_size ? tbuf_size : size;\n \t} while (size);\n \n+\tif (!size)\n+\t\tenv_set_hex(\"filesize\", len_read);\n+\n \tfree(tbuf);\n \treturn err;\n }\n","prefixes":["U-Boot","RESEND","v2"]}