[Armadeus-commitlog] armadeus branch, master, updated. armadeus-6.0-60-g1e48000
Brought to you by:
sszy
|
From: Fabien M <fa...@us...> - 2016-04-11 11:50:53
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "armadeus".
The branch, master has been updated
via 1e4800037889aba512a77ffcbc58e66aa183e474 (commit)
from 5edcafb29657dfb913aca8e0189d03e3d9967393 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 1e4800037889aba512a77ffcbc58e66aa183e474
Author: Fabien Marteau <fab...@ar...>
Date: Mon Apr 11 13:49:56 2016 +0200
[TOOLS]: adding option to generate only nand_recover binary (not download it)
-----------------------------------------------------------------------
Summary of changes:
software/uboot_recover/apf28_recover.py | 105 +++++++++++++++++++-----------
1 files changed, 66 insertions(+), 39 deletions(-)
diff --git a/software/uboot_recover/apf28_recover.py b/software/uboot_recover/apf28_recover.py
index 87f99e0..50b039c 100644
--- a/software/uboot_recover/apf28_recover.py
+++ b/software/uboot_recover/apf28_recover.py
@@ -7,21 +7,22 @@
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
+# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
+#
# authors: eri...@ar...
-#
+#
#
import sys
+import getopt
import time
from struct import *
import os
@@ -31,6 +32,16 @@ import re
import usb
+BR_HOST_PATH = "../../buildroot/output/host"
+SPEED = 115200
+BINARY = "apf28-u-boot.sb"
+USB_DOWNLOAD_APP = BR_HOST_PATH + "/usr/bin/gnet-imx28-usb-downloader"
+ELFTOSB_APP = BR_HOST_PATH + "/usr/bin/elftosb"
+NAND_BINARY = "apf28_nand_recover.sb"
+ENV_RECOVER = "apf28_env_recover.txt"
+ENV_DOWNLOAD = 0x42000000
+
+
class Error(Exception):
""" Manage specific error
@@ -43,13 +54,13 @@ class Error(Exception):
self._message = message
self.level = level
Exception.__init__(self,message)
-
+
def __repr__(self):
return self.message
- def _get_message(self):
+ def _get_message(self):
return self._message
- def _set_message(self, message):
+ def _set_message(self, message):
self._message = message
message = property(_get_message, _set_message)
@@ -63,8 +74,6 @@ class Error(Exception):
return self.level
-
-
class UBoot:
"""
"""
@@ -85,7 +94,7 @@ class UBoot:
raise Error("getOutput error")
sys.stdout.write(response)
return response
-
+
def resetEnv(self):
self.serial.write("run flash_reset_env\n")
return self.__getOutput()
@@ -127,18 +136,51 @@ class UBoot:
except Error,e:
raise Error("Reseting U-Boot")
return ret
-
+
+def build_nand_binary():
+ """ building nand binary"""
+ print "Building NAND image file %s.." % NAND_BINARY
+ fsize = "%08x" % os.path.getsize(BINARY)
+ envfile = open(ENV_RECOVER, 'w')
+ envfile.write("fileaddr=41000000\n")
+ envfile.write("filesize=%s\n" % fsize)
+ envfile.close()
+
+ try:
+ os.system(ELFTOSB_APP + " -zdf imx28 -c apf28-u-boot_recover.bd -o " + NAND_BINARY)
+ except Exception, msg:
+ print "Failed to build build NAND image filet !"
+ print msg
+ os.remove(NAND_BINARY);
+ os.remove(ENV_RECOVER);
+ sys.exit()
+ print(NAND_BINARY + " created.")
+
+
+def usages():
+ """print usages"""
+ print("Usages:")
+ print("printimage.py [option]")
+ print("-h, --help print this help")
+ print("-n, --nand build nand binary")
+ print("If no options given full recover apf28 launched")
+
if __name__ == "__main__":
- BR_HOST_PATH = "../../buildroot/output/host"
- SPEED = 115200
- BINARY = "apf28-u-boot.sb"
- USB_DOWNLOAD_APP = BR_HOST_PATH + "/usr/bin/gnet-imx28-usb-downloader"
- ELFTOSB_APP = BR_HOST_PATH + "/usr/bin/elftosb"
- NAND_BINARY = "apf28_nand_recover.sb"
- ENV_RECOVER = "apf28_env_recover.txt"
- ENV_DOWNLOAD = 0x42000000
+ try:
+ opts, args = getopt.getopt(sys.argv[1:], "hn", ["nand", "help"])
+ except getopt.GetoptError:
+ usages()
+ sys.exit(2)
+
+ for opt, arg in opts:
+ if opt in ["-h", "--help"]:
+ usages()
+ sys.exit(0)
+ elif opt in ["-n", "--nand"]:
+ build_nand_binary()
+ sys.exit(0)
print "\n--- APF28 Bootstrap Tool ---\n"
print "Procedure to follow:"
@@ -173,23 +215,8 @@ if __name__ == "__main__":
uboot = UBoot(ser)
- print "Building NAND image file %s.." % NAND_BINARY
-
- fsize = "%08x" % os.path.getsize(BINARY)
- envfile = open(ENV_RECOVER, 'w')
- envfile.write("fileaddr=41000000\n")
- envfile.write("filesize=%s\n" % fsize)
- envfile.close()
-
-
- try:
- os.system(ELFTOSB_APP + " -zdf imx28 -c apf28-u-boot_recover.bd -o " + NAND_BINARY)
- except Exception, msg:
- print "Failed to build build NAND image filet !"
- print msg
- os.remove(NAND_BINARY);
- os.remove(ENV_RECOVER);
- sys.exit()
+ # build nand binary
+ build_nand_binary()
print "Downloading NAND image file %s.." % NAND_BINARY
try:
@@ -204,10 +231,10 @@ if __name__ == "__main__":
os.remove(NAND_BINARY);
print "--- Successfully initialized APF28, now loading U-Boot"
-
+
print "Loading %s, size = %d bytes.." % (BINARY, os.path.getsize(BINARY))
time.sleep(4)
-
+
try:
os.system(USB_DOWNLOAD_APP + " -f " + BINARY)
except Exception, msg:
hooks/post-receive
--
armadeus
|