From cbae0903b76b2d3fe2eca6adcf0883d74367915f Mon Sep 17 00:00:00 2001 From: Zhenhua Luo Date: Tue, 20 Dec 2016 20:19:03 +0800 Subject: change-file-endianess: update byte_swap script to support ls1046 Signed-off-by: Ting Liu Signed-off-by: Zhenhua Luo Signed-off-by: Otavio Salvador --- recipes-bsp/change-file-endianess/change-file-endianess.bb | 13 +++++++++++-- .../change-file-endianess/byte_swap.tcl | 6 +++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/recipes-bsp/change-file-endianess/change-file-endianess.bb b/recipes-bsp/change-file-endianess/change-file-endianess.bb index 2ad8c588..ff1828bc 100644 --- a/recipes-bsp/change-file-endianess/change-file-endianess.bb +++ b/recipes-bsp/change-file-endianess/change-file-endianess.bb @@ -3,12 +3,11 @@ 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 +inherit native deploy S = "${WORKDIR}" @@ -20,4 +19,14 @@ do_install () { install -m 755 ${WORKDIR}/byte_swap.tcl ${D}/${bindir} } +do_deploy () { + : +} + +do_deploy_class-native () { + install -d ${DEPLOYDIR} + cp -f ${STAGING_BINDIR_NATIVE}/byte_swap.tcl ${DEPLOYDIR}/ +} +addtask deploy before do_build after do_populate_sysroot + BBCLASSEXTEND = "native nativesdk" 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 index a4e8008f..c6222022 100755 --- a/recipes-bsp/change-file-endianess/change-file-endianess/byte_swap.tcl +++ b/recipes-bsp/change-file-endianess/change-file-endianess/byte_swap.tcl @@ -18,12 +18,16 @@ if {$old_rem != 0} { append old_bin y } } -for {set i 0} {$i<[string length $old_bin]} {incr i $num_b} { +for {set i 0} {$i<[expr $old_length-8]} {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 j 0} {$j<8} {incr j 1} { + append new_bin [string index $old_bin [expr $i+$j]] +} + 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 -- cgit v1.2.3-54-g00ecf