From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id 82656E0091D; Tue, 3 Feb 2015 19:18:55 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on yocto-www.yoctoproject.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.1 X-Spam-HAM-Report: * -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no * trust * [65.55.169.133 listed in list.dnswl.org] * -0.0 SPF_HELO_PASS SPF: HELO matches SPF record * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] Received: from na01-bl2-obe.outbound.protection.outlook.com (mail-bl2on0133.outbound.protection.outlook.com [65.55.169.133]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id B2545E008FB for ; Tue, 3 Feb 2015 19:18:54 -0800 (PST) Received: from DM2PR0301MB1198.namprd03.prod.outlook.com (25.160.217.148) by DM2PR0301MB0670.namprd03.prod.outlook.com (25.160.96.20) with Microsoft SMTP Server (TLS) id 15.1.65.19; Wed, 4 Feb 2015 03:18:48 +0000 Received: from BN3PR0301CA0005.namprd03.prod.outlook.com (25.160.180.143) by DM2PR0301MB1198.namprd03.prod.outlook.com (25.160.217.148) with Microsoft SMTP Server (TLS) id 15.1.75.20; Wed, 4 Feb 2015 03:18:45 +0000 Received: from BY2FFO11FD032.protection.gbl (2a01:111:f400:7c0c::109) by BN3PR0301CA0005.outlook.office365.com (2a01:111:e400:4000::15) with Microsoft SMTP Server (TLS) id 15.1.87.13 via Frontend Transport; Wed, 4 Feb 2015 03:18:45 +0000 Received: from az84smr01.freescale.net (192.88.158.2) by BY2FFO11FD032.mail.protection.outlook.com (10.1.14.210) with Microsoft SMTP Server (TLS) id 15.1.87.10 via Frontend Transport; Wed, 4 Feb 2015 03:18:45 +0000 Received: from sun.ap.freescale.net (sun.ap.freescale.net [10.192.208.75]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id t143IgAj011080; Tue, 3 Feb 2015 20:18:43 -0700 From: To: Date: Wed, 4 Feb 2015 11:18:36 +0800 Message-ID: <1423019919-5062-1-git-send-email-b40290@freescale.com> X-Mailer: git-send-email 1.9.2 X-EOPAttributedMessage: 0 Received-SPF: Fail (protection.outlook.com: domain of freescale.com does not designate 192.88.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=b40290@freescale.com; freescale.mail.onmicrosoft.com; dkim=none (message not signed) header.d=none; X-Forefront-Antispam-Report: CIP:192.88.158.2; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(339900001)(19580405001)(19580395003)(48376002)(77156002)(6806004)(85426001)(46102003)(230783001)(36756003)(50986999)(104016003)(47776003)(86152002)(92566002)(62966003)(86362001)(87936001)(77096005)(50466002)(105606002)(50226001)(106466001)(33646002)(110136001)(450100001)(229853001)(2351001); DIR:OUT; SFP:1102; SCL:1; SRVR:DM2PR0301MB1198; H:az84smr01.freescale.net; FPR:; SPF:Fail; MLV:sfv; LANG:en; MIME-Version: 1.0 X-Microsoft-Antispam: UriScan:;UriScan:; X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;SRVR:DM2PR0301MB1198; X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004); SRVR:DM2PR0301MB1198; X-Forefront-PRVS: 04772EA191 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:; SRVR:DM2PR0301MB1198; X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Feb 2015 03:18:45.2846 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d; Ip=[192.88.158.2] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR0301MB1198 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;SRVR:DM2PR0301MB0670; X-OriginatorOrg: freescale.com Subject: [meta-fsl-arm][PATCH 1/4] change-file-endianess: add recipe X-BeenThere: meta-freescale@yoctoproject.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Usage and development list for the meta-fsl-* layers List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Feb 2015 03:18:55 -0000 Content-Type: text/plain From: Chunrong Guo *provides the tcl script for endian swap Signed-off-by: Chunrong Guo --- .../change-file-endianess/change-file-endianess.bb | 21 ++++++++++++++++ .../change-file-endianess/byte_swap.tcl | 29 ++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 recipes-bsp/change-file-endianess/change-file-endianess.bb create mode 100755 recipes-bsp/change-file-endianess/change-file-endianess/byte_swap.tcl diff --git a/recipes-bsp/change-file-endianess/change-file-endianess.bb b/recipes-bsp/change-file-endianess/change-file-endianess.bb new file mode 100644 index 0000000..9e7e868 --- /dev/null +++ b/recipes-bsp/change-file-endianess/change-file-endianess.bb @@ -0,0 +1,21 @@ +DESCRIPTION = "provides the tcl script for endian swap" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690 \ + file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" + + +SRC_URI = "file://byte_swap.tcl" + +RDEPENDS += "tcl-native" + +inherit native + +S = "${WORKDIR}" + +do_configure[noexec] = "1" +do_compile[noexec] = "1" + +do_install () { + install -d ${D}/${bindir} + install -m 755 ${WORKDIR}/byte_swap.tcl ${D}/${bindir} +} diff --git a/recipes-bsp/change-file-endianess/change-file-endianess/byte_swap.tcl b/recipes-bsp/change-file-endianess/change-file-endianess/byte_swap.tcl new file mode 100755 index 0000000..aca956b --- /dev/null +++ b/recipes-bsp/change-file-endianess/change-file-endianess/byte_swap.tcl @@ -0,0 +1,29 @@ +puts $argv +set i_file [lindex $argv 0] +set o_file [lindex $argv 1] +set num_b [lindex $argv 2] +puts "" + +set fileid_i [open $i_file "r"] +set fileid_o [open $o_file "w+"] +fconfigure $fileid_i -translation {binary binary} +fconfigure $fileid_o -translation {binary binary} + +set old_bin [read $fileid_i] +set new_bin {} +for {set i 0} {$i<[string length $old_bin]} {incr i $num_b} { + for {set j $num_b} {$j>0} {incr j -1} { + append new_bin [string index $old_bin [expr $i+($j-1)]] + } +} + +for {set i 0} {$i<[string length $old_bin]} {incr i $num_b} { + set binValue [string range $old_bin [expr $i+0] [expr $i+($num_b-1)]] + binary scan $binValue H[expr $num_b*2] hexValue + + set binValue [string range $new_bin [expr $i+0] [expr $i+($num_b-1)]] + binary scan $binValue H[expr $num_b*2] hexValue +} + +puts -nonewline $fileid_o $new_bin +close $fileid_o -- 1.9.2