summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmar Takhar <amar@rtems.org>2020-03-04 17:56:20 -0500
committerAmar Takhar <verm@darkbeer.org>2020-03-04 18:07:45 -0500
commit2444acb0ad35d9f6abd7cf0c1ed8e18a7546a4f6 (patch)
tree88268f7cef19d0bc3ff088c1683a6f87fe1f7a06
parentFix to work under Pyhon 2 and Python 3. (diff)
downloadrtems-tools-2444acb0ad35d9f6abd7cf0c1ed8e18a7546a4f6.tar.bz2
Add print statement similar to the original mkimage.
This is limited to Python 2.6+
-rwxr-xr-xmisc/tools/mkimage.py17
1 files 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)