From patchwork Sun Jan 29 14:24:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 92786 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1051987qgi; Sun, 29 Jan 2017 06:26:36 -0800 (PST) X-Received: by 10.28.0.2 with SMTP id 2mr10707371wma.141.1485699996153; Sun, 29 Jan 2017 06:26:36 -0800 (PST) Return-Path: Received: from theia.denx.de (theia.denx.de. [85.214.87.163]) by mx.google.com with ESMTP id v11si9836273wmg.13.2017.01.29.06.26.35; Sun, 29 Jan 2017 06:26:36 -0800 (PST) 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=@nifty.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 6BE15B38CD; Sun, 29 Jan 2017 15:26:21 +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 Uht3v5ydPJvZ; Sun, 29 Jan 2017 15:26:21 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B7061B38CF; Sun, 29 Jan 2017 15:26:11 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 145DDA75B7 for ; Sun, 29 Jan 2017 15:26:00 +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 Ha2s9agF9aTJ for ; Sun, 29 Jan 2017 15:25:59 +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 conuserg-09.nifty.com (conuserg-09.nifty.com [210.131.2.76]) by theia.denx.de (Postfix) with ESMTPS id 5CB2AB384A for ; Sun, 29 Jan 2017 15:25:55 +0100 (CET) Received: from grover.sesame (FL1-111-169-71-157.osk.mesh.ad.jp [111.169.71.157]) (authenticated) by conuserg-09.nifty.com with ESMTP id v0TEPEc3004042; Sun, 29 Jan 2017 23:25:19 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com v0TEPEc3004042 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1485699919; bh=3/882Z/LF60aswRVLkwI0Puu0yk9T2cd9ecuOcsFiVc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vjaTuCF+3BKG17Od1d/zvMbDaSMOGrYV5ulDNK9rYMUxpQ+iEHsuXdVwvSC8POLB3 KYa52oEPwa3FuOhmJklVhOdl55io/l7zomS3m4ar3rvXByRKxmoIoZIEjHa4YExmiA ibDq8JE5NJ1j+WoD04Y2bavEbHOca2/aONUR9oIb46cwkShzpIR4ynZ0JDO3npheaO SXH/QrQ7ardflD+63DjFX72Zr/sQ1OcIURHb3aS1au2NAdHfGZeHnAAo1R5FKpMKp3 3QTU9HaBl8NMFYNH+vwvIAs7976UPDLcFqjclDokQXdqGn+3orVLvFqCGKoBPEST4m XhG1vJtA1HvTg== X-Nifty-SrcIP: [111.169.71.157] From: Masahiro Yamada To: u-boot@lists.denx.de Date: Sun, 29 Jan 2017 23:24:58 +0900 Message-Id: <1485699900-20464-2-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1485699900-20464-1-git-send-email-yamada.masahiro@socionext.com> References: <1485699900-20464-1-git-send-email-yamada.masahiro@socionext.com> Cc: Tom Rini Subject: [U-Boot] [PATCH 1/3] scripts: import bin2c.c from Linux 4.10-rc5 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" Import scripts/basic/bin2header.c of Linux. In Linux Kernel, this file was moved to scripts/basic directory by commit 8370edea81e3 ("bin2c: move bin2c in scripts/basic"). In U-boot, we do not need to follow that commit. Just put it in the original directory "scripts". Signed-off-by: Masahiro Yamada --- scripts/bin2c.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 scripts/bin2c.c -- 2.7.4 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot diff --git a/scripts/bin2c.c b/scripts/bin2c.c new file mode 100644 index 0000000..c3d7eef --- /dev/null +++ b/scripts/bin2c.c @@ -0,0 +1,36 @@ +/* + * Unloved program to convert a binary on stdin to a C include on stdout + * + * Jan 1999 Matt Mackall + * + * This software may be used and distributed according to the terms + * of the GNU General Public License, incorporated herein by reference. + */ + +#include + +int main(int argc, char *argv[]) +{ + int ch, total = 0; + + if (argc > 1) + printf("const char %s[] %s=\n", + argv[1], argc > 2 ? argv[2] : ""); + + do { + printf("\t\""); + while ((ch = getchar()) != EOF) { + total++; + printf("\\x%02x", ch); + if (total % 16 == 0) + break; + } + printf("\"\n"); + } while (ch != EOF); + + if (argc > 1) + printf("\t;\n\n#include \n\nconst size_t %s_size = %d;\n", + argv[1], total); + + return 0; +}