Skip to contentSkip to conversation

rcw: provides the tcl script for endian swap

PATCH In review [email protected] 1 participant 4 messages Feb 3, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 rcw: provides the tcl script for endian swap

From: Chunrong Guo <[email protected]>

---
 recipes-bsp/rcw/rcw/byte_swap.tcl                  | 29 ++++++++++++++++++++++
 ...ake-BOARDS-DESTDIR-overidable-in-Makefile.patch |  2 +-
 recipes-bsp/rcw/rcw_git.bb                         |  3 ++-
 3 files changed, 32 insertions(+), 2 deletions(-)
 create mode 100755 recipes-bsp/rcw/rcw/byte_swap.tcl
recipes-bsp/rcw/rcw/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
recipes-bsp/rcw/rcw/rcw-make-BOARDS-DESTDIR-overidable-in-Makefile.patch +1 -1
index 51f6eeb..f2617a3 100644
@@ -45,7 +45,7 @@ index 4cadb2e..6e8b78f 100644
 -		$(INSTALL) -m 644 -D $$file $(DESTDIR)/$$file; \
 +		case $$file in \
 +			*qspiboot*) file_swap="`echo $$file | sed -e 's/qspiboot/qspiboot_swap/'`"; \
-+						tclsh byte_swap.tcl $$file $$file_swap 8 ; \
++						tclsh ../../byte_swap.tcl $$file $$file_swap 8 ; \
 +						$(INSTALL) -m 644 -D $$file_swap $(DESTDIR)/$$file_swap ;; \
 +			*) $(INSTALL) -m 644 -D $$file $(DESTDIR)/$$file; \
 +        esac \
recipes-bsp/rcw/rcw_git.bb +2 -1
index 0d10548..2b9949e 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 += "tcl-native"
 
 inherit deploy
 
@@ -11,6 +11,7 @@ SRCBRANCH = "sdk-v1.7.x"
 SRCREV = "3e89f378ed70e9b856756de8c3dbdfccb045fa0c"
 SRC_URI = "git://git.freescale.com/ppc/sdk/rcw.git;branch=${SRCBRANCH} \
     file://rcw-make-BOARDS-DESTDIR-overidable-in-Makefile.patch \
+    file://byte_swap.tcl \
 "
 
 S = "${WORKDIR}/git"
Signature · 1 line
1.9.2
#1 lore raw

PATCH 1/2 u-boot-ls1: u-boot-ls1: provides the tcl script for endian swap

From: Chunrong Guo <[email protected]>

---
 .../u-boot/u-boot-ls1-tools-native_2013.10.bb      | 16 ------------
 recipes-bsp/u-boot/u-boot-ls1.inc                  |  4 ++-
 recipes-bsp/u-boot/u-boot-ls1/byte_swap.tcl        | 29 ++++++++++++++++++++++
 recipes-bsp/u-boot/u-boot-ls1_2014.07.bb           |  4 +--
 4 files changed, 34 insertions(+), 19 deletions(-)
 delete mode 100644 recipes-bsp/u-boot/u-boot-ls1-tools-native_2013.10.bb
 create mode 100755 recipes-bsp/u-boot/u-boot-ls1/byte_swap.tcl
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}
-}
recipes-bsp/u-boot/u-boot-ls1.inc +3 -1
index ccd37c6..5712549 100644
@@ -9,7 +9,9 @@ LIC_FILES_CHKSUM = " \
 "
 
 SRCBRANCH = "sdk-v1.7.x"
-SRC_URI = "git://git.freescale.com/ppc/sdk/u-boot.git;branch=${SRCBRANCH}"
+SRC_URI = "git://git.freescale.com/ppc/sdk/u-boot.git;branch=${SRCBRANCH} \ 
+    file://byte_swap.tcl \
+"
 SRCREV = "659b6a23a8b1f3026200bc6352dbacef53f4dcb1"
 
 LOCALVERSION ?= "-${SRCBRANCH}"
recipes-bsp/u-boot/u-boot-ls1/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
recipes-bsp/u-boot/u-boot-ls1_2014.07.bb +2 -2
index 7b4fb58..9a1aec2 100644
@@ -4,12 +4,12 @@ inherit fsl-u-boot-localversion
 
 LOCALVERSION ?= "-${SRCBRANCH}"
 
-DEPENDS += "u-boot-ls1-tools-native"
+DEPENDS += "tcl-native"
 PROVIDES += "u-boot"
 
 do_compile_append () {
     case "${UBOOT_MACHINE}" in
-        *spi*) tclsh ${STAGING_BINDIR_NATIVE}/byte_swap.tcl ${S}/u-boot.bin ${S}/u-boot.swap.bin 8 
+        *spi*) tclsh  ../byte_swap.tcl ${S}/u-boot.bin ${S}/u-boot.swap.bin 8 
         mv ${S}/u-boot.swap.bin ${S}/u-boot.bin;;
         *sdcard*)  mv ${S}/u-boot-with-spl-pbl.bin  ${S}/u-boot.bin;;
     esac
Signature · 1 line
1.9.2
#2 lore raw

Re: [meta-fsl-arm][PATCH 1/2] u-boot-ls1: u-boot-ls1: provides the tcl script for endian swap

Please ignore this patch.

-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Tuesday, February 03, 2015 2:49 PM
To: [email protected]
Cc: Liu Ting-B28495; Luo Zhenhua-B19537; Guo Chunrong-B40290
Subject: [meta-fsl-arm][PATCH 1/2] u-boot-ls1: u-boot-ls1: provides the tcl script for endian swap

From: Chunrong Guo <[email protected]>

---
 .../u-boot/u-boot-ls1-tools-native_2013.10.bb      | 16 ------------
 recipes-bsp/u-boot/u-boot-ls1.inc                  |  4 ++-
 recipes-bsp/u-boot/u-boot-ls1/byte_swap.tcl        | 29 ++++++++++++++++++++++
 recipes-bsp/u-boot/u-boot-ls1_2014.07.bb           |  4 +--
 4 files changed, 34 insertions(+), 19 deletions(-)  delete mode 100644 recipes-bsp/u-boot/u-boot-ls1-tools-native_2013.10.bb
 create mode 100755 recipes-bsp/u-boot/u-boot-ls1/byte_swap.tcl
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}
-}
recipes-bsp/u-boot/u-boot-ls1.inc +3 -1
index ccd37c6..5712549 100644
@@ -9,7 +9,9 @@ LIC_FILES_CHKSUM = " \
 "
 
 SRCBRANCH = "sdk-v1.7.x"
-SRC_URI = "git://git.freescale.com/ppc/sdk/u-boot.git;branch=${SRCBRANCH}"
+SRC_URI = "git://git.freescale.com/ppc/sdk/u-boot.git;branch=${SRCBRANCH} \ 
+    file://byte_swap.tcl \
+"
 SRCREV = "659b6a23a8b1f3026200bc6352dbacef53f4dcb1"
 
 LOCALVERSION ?= "-${SRCBRANCH}"
recipes-bsp/u-boot/u-boot-ls1/byte_swap.tcl new file +28 -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
recipes-bsp/u-boot/u-boot-ls1_2014.07.bb +3 -2
index 7b4fb58..9a1aec2 100644
@@ -4,12 +4,12 @@ inherit fsl-u-boot-localversion
 
 LOCALVERSION ?= "-${SRCBRANCH}"
 
-DEPENDS += "u-boot-ls1-tools-native"
+DEPENDS += "tcl-native"
 PROVIDES += "u-boot"
 
 do_compile_append () {
     case "${UBOOT_MACHINE}" in
-        *spi*) tclsh ${STAGING_BINDIR_NATIVE}/byte_swap.tcl ${S}/u-boot.bin ${S}/u-boot.swap.bin 8 
+        *spi*) tclsh  ../byte_swap.tcl ${S}/u-boot.bin 
+ ${S}/u-boot.swap.bin 8
         mv ${S}/u-boot.swap.bin ${S}/u-boot.bin;;
         *sdcard*)  mv ${S}/u-boot-with-spl-pbl.bin  ${S}/u-boot.bin;;

esac
--
1.9.2

#3 lore raw
In reply to [email protected]

Please ignore this patch.

-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Tuesday, February 03, 2015 2:49 PM
To: [email protected]
Cc: Liu Ting-B28495; Luo Zhenhua-B19537; Guo Chunrong-B40290
Subject: [meta-fsl-arm][PATCH 2/2] rcw: provides the tcl script for endian swap

From: Chunrong Guo <[email protected]>

---
 recipes-bsp/rcw/rcw/byte_swap.tcl                  | 29 ++++++++++++++++++++++
 ...ake-BOARDS-DESTDIR-overidable-in-Makefile.patch |  2 +-
 recipes-bsp/rcw/rcw_git.bb                         |  3 ++-
 3 files changed, 32 insertions(+), 2 deletions(-)  create mode 100755 recipes-bsp/rcw/rcw/byte_swap.tcl
recipes-bsp/rcw/rcw/byte_swap.tcl new file +28 -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
recipes-bsp/rcw/rcw/rcw-make-BOARDS-DESTDIR-overidable-in-Makefile renamed from recipes-bsp/rcw/rcw/rcw-make-BOARDS-DESTDIR-overidable-in-Makefile.patch +0 -0
index 51f6eeb..f2617a3 100644

+++ .patch
@@ -45,7 +45,7 @@ index 4cadb2e..6e8b78f 100644
- $(INSTALL) -m 644 -D $$file $(DESTDIR)/$$file; \
+ case $$file in \
+ *qspiboot*) file_swap="echo $$file | sed -e 's/qspiboot/qspiboot_swap/'"; \
-+ tclsh byte_swap.tcl $$file $$file_swap 8 ; \
++ tclsh ../../byte_swap.tcl $$file $$file_swap 8 ; \
+ $(INSTALL) -m 644 -D $$file_swap $(DESTDIR)/$$file_swap ;; \
+ *) $(INSTALL) -m 644 -D $$file $(DESTDIR)/$$file; \
+ esac \

recipes-bsp/rcw/rcw_git.bb +2 -1
@@ -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 += "tcl-native"
 
 inherit deploy
 
@@ -11,6 +11,7 @@ SRCBRANCH = "sdk-v1.7.x"
 SRCREV = "3e89f378ed70e9b856756de8c3dbdfccb045fa0c"
 SRC_URI = "git://git.freescale.com/ppc/sdk/rcw.git;branch=${SRCBRANCH} \
     file://rcw-make-BOARDS-DESTDIR-overidable-in-Makefile.patch \
+    file://byte_swap.tcl \
 "
 
 S = "${WORKDIR}/git"

--
1.9.2