Skip to contentSkip to conversation

byte-swap: add recipe

PATCH In review [email protected] 2 participants 6 messages Feb 3, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 byte-swap: add recipe

From: Chunrong Guo <[email protected]>

*provides the tcl script for endian swap

---
 recipes-bsp/byte-swap/byte-swap.bb            | 21 +++++++++++++++++++
 recipes-bsp/byte-swap/byte-swap/byte_swap.tcl | 29 +++++++++++++++++++++++++++
 2 files changed, 50 insertions(+)
 create mode 100644 recipes-bsp/byte-swap/byte-swap.bb
 create mode 100755 recipes-bsp/byte-swap/byte-swap/byte_swap.tcl
recipes-bsp/byte-swap/byte-swap.bb new file +21 -0
new file mode 100644
index 0000000..9e7e868
@@ -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}
+}
recipes-bsp/byte-swap/byte-swap/byte_swap.tcl new file +29 -0
new file mode 100755
index 0000000..aca956b
@@ -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
Signature · 1 line
1.9.2
#1 lore raw

PATCH 2/4 u-boot-ls1: Added byte-swap as DEPENDS

From: Chunrong Guo <[email protected]>

---
 recipes-bsp/u-boot/u-boot-ls1_2014.07.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
recipes-bsp/u-boot/u-boot-ls1_2014.07.bb +1 -1
index 7b4fb58..9a40342 100644
@@ -4,7 +4,7 @@ inherit fsl-u-boot-localversion
 
 LOCALVERSION ?= "-${SRCBRANCH}"
 
-DEPENDS += "u-boot-ls1-tools-native"
+DEPENDS += "byte-swap"
 PROVIDES += "u-boot"
 
 do_compile_append () {
Signature · 1 line
1.9.2
#2 lore raw

PATCH 3/4 rcw: Added byte-swap as DEPENDS

In reply to [email protected]

From: Chunrong Guo <[email protected]>

---
 recipes-bsp/rcw/rcw_git.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
recipes-bsp/rcw/rcw_git.bb +1 -1
index 0d10548..898f67b 100644
@@ -3,7 +3,7 @@ DESCRIPTION = "Reset Configuration Word - hardware boot-time parameters for the
 LICENSE = "BSD"
 LIC_FILES_CHKSUM = "file://rcw.py;beginline=8;endline=28;md5=9ba0b28922dd187b06b6c8ebcfdd208e"
 
-DEPENDS += "u-boot-ls1-tools-native"
+DEPENDS += "byte-swap"
 
 inherit deploy
 
Signature · 1 line
1.9.2
#3 lore raw

PATCH 4/4 u-boot-ls1-tools-native: remove recipe

In reply to [email protected]

From: Chunrong Guo <[email protected]>

---
 recipes-bsp/u-boot/u-boot-ls1-tools-native_2013.10.bb | 16 ----------------
 1 file changed, 16 deletions(-)
 delete mode 100644 recipes-bsp/u-boot/u-boot-ls1-tools-native_2013.10.bb
recipes-bsp/u-boot/u-boot-ls1-tools-native_2013.10.bb deleted +0 -16
deleted file mode 100644
index 09cf1f7..0000000
@@ -1,16 +0,0 @@
-require u-boot-ls1.inc
-
-SRC_URI = "git://git.freescale.com/layerscape/ls1021a/u-boot.git;branch=LS1-dev"
-SRCREV = "50d684801cd05ed6b77d52d1ca9ed00fefeac469"
-
-RDEPENDS += "tcl-native"
-
-inherit native
-
-do_configure[noexec] = "1"
-do_compile[noexec] = "1"
-
-do_install () {
-    install -d ${D}/${bindir}
-    install -m 755 ${S}/byte_swap.tcl ${D}/${bindir}
-}
Signature · 1 line
1.9.2
#4 lore raw
In reply to [email protected]
Quoted 5 lines · On Tue, Feb 3, 2015 at 7:01 AM, <[email protected]> wrote:

From: Chunrong Guo <[email protected]>

*provides the tcl script for endian swap

The only thing which currently uses this is the U-Boot. Is it worth splitting this out?

Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
#5 lore raw
Quoted 9 lines · Otavio Salvador
Quoted 5 lines · On Tue, Feb 3, 2015 at 7:01 AM, <[email protected]> wrote:

From: Chunrong Guo <[email protected]>

*provides the tcl script for endian swap

The only thing which currently uses this is the U-Boot. Is it worth splitting this out?

You drop the u-boot tools native recipe, which is good. So let's find a more meaningful name for this recipe.

Maybe: 'change-file-endianess' ? byte swap does not make clear for me it acts in whole file.

Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750