Skip to content

Instantly share code, notes, and snippets.

@z4yx
Created June 15, 2013 15:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save z4yx/5788459 to your computer and use it in GitHub Desktop.
Save z4yx/5788459 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import os
SCRIPT_MAX_SIZE = 64*1024
if len(sys.argv)<3:
print "usage: mkrootimg.py script.bin uImage"
script_file = open(sys.argv[1], "rb")
uimage_file = open(sys.argv[2], "rb")
script_size = os.path.getsize(sys.argv[1])
if script_size > SCRIPT_MAX_SIZE:
print "script.bin is too large"
exit()
sys.stdout.write(script_file.read())
sys.stdout.write("\0" * (SCRIPT_MAX_SIZE-script_size))
sys.stdout.write(uimage_file.read())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment