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

b40290 at freescale.com b40290 at freescale.com
Mon Feb 2 22:48:42 PST 2015


From: Chunrong Guo <B40290 at freescale.com>

Signed-off-by: Chunrong Guo <B40290 at freescale.com>
---
 .../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

diff --git a/recipes-bsp/u-boot/u-boot-ls1-tools-native_2013.10.bb b/recipes-bsp/u-boot/u-boot-ls1-tools-native_2013.10.bb
deleted file mode 100644
index 09cf1f7..0000000
--- a/recipes-bsp/u-boot/u-boot-ls1-tools-native_2013.10.bb
+++ /dev/null
@@ -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}
-}
diff --git a/recipes-bsp/u-boot/u-boot-ls1.inc b/recipes-bsp/u-boot/u-boot-ls1.inc
index ccd37c6..5712549 100644
--- a/recipes-bsp/u-boot/u-boot-ls1.inc
+++ b/recipes-bsp/u-boot/u-boot-ls1.inc
@@ -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}"
diff --git a/recipes-bsp/u-boot/u-boot-ls1/byte_swap.tcl b/recipes-bsp/u-boot/u-boot-ls1/byte_swap.tcl
new file mode 100755
index 0000000..aca956b
--- /dev/null
+++ b/recipes-bsp/u-boot/u-boot-ls1/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
diff --git a/recipes-bsp/u-boot/u-boot-ls1_2014.07.bb b/recipes-bsp/u-boot/u-boot-ls1_2014.07.bb
index 7b4fb58..9a1aec2 100644
--- a/recipes-bsp/u-boot/u-boot-ls1_2014.07.bb
+++ b/recipes-bsp/u-boot/u-boot-ls1_2014.07.bb
@@ -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



More information about the meta-freescale mailing list