[rtems-tools commit] Add print statement similar to the original mkimage.
Amar Takhar
amar at rtems.org
Wed Mar 4 23:35:00 UTC 2020
Module: rtems-tools
Branch: master
Commit: 2444acb0ad35d9f6abd7cf0c1ed8e18a7546a4f6
Changeset: http://git.rtems.org/rtems-tools/commit/?id=2444acb0ad35d9f6abd7cf0c1ed8e18a7546a4f6
Author: Amar Takhar <amar at rtems.org>
Date: Wed Mar 4 17:56:20 2020 -0500
Add print statement similar to the original mkimage.
This is limited to Python 2.6+
---
misc/tools/mkimage.py | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/misc/tools/mkimage.py b/misc/tools/mkimage.py
index 38ed11e..fd75f0a 100755
--- a/misc/tools/mkimage.py
+++ b/misc/tools/mkimage.py
@@ -27,6 +27,8 @@
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
+# We support Python 2.6+ so this is okay.
+from __future__ import print_function
import argparse
from struct import *
@@ -35,6 +37,8 @@ import os.path
import time
import binascii
+
+
MAGIC = 0x27051956
IMG_NAME_LENGTH = 32
@@ -125,14 +129,16 @@ while True:
inputcrc = inputcrc & 0xffffffff
-structdata = struct.pack(MAGIC, 0, int(time.time()), inputsize,
+timestamp = int(time.time())
+
+structdata = struct.pack(MAGIC, 0, timestamp, inputsize,
int(options.addr,16), int(options.ep,16), inputcrc,
oss[options.os], archs[options.arch], types[options.type],
comps[options.comp], options.name.encode("utf-8"))
headercrc = binascii.crc32(structdata) & 0xFFFFFFFF
-structdata = struct.pack(MAGIC, headercrc, int(time.time()), inputsize,
+structdata = struct.pack(MAGIC, headercrc, timestamp, inputsize,
int(options.addr,16), int(options.ep,16), inputcrc,
oss[options.os], archs[options.arch], types[options.type],
comps[options.comp], options.name.encode("utf-8"))
@@ -141,3 +147,10 @@ outputfile.seek(0)
outputfile.write(structdata)
outputfile.close()
inputfile.close()
+
+print("Image Name: ", options.name)
+print("Created: ", time.ctime(timestamp))
+print("Image Type: ", options.comp)
+print("Data Size: ", inputsize)
+print("Load Address: ", options.addr)
+print("Entry Point: ", options.ep)
More information about the vc
mailing list