summaryrefslogtreecommitdiffstats
path: root/misc/rtems-boot-image
diff options
context:
space:
mode:
Diffstat (limited to 'misc/rtems-boot-image')
-rwxr-xr-xmisc/rtems-boot-image31
1 files changed, 17 insertions, 14 deletions
diff --git a/misc/rtems-boot-image b/misc/rtems-boot-image
index aa23b2e..7f7ac0d 100755
--- a/misc/rtems-boot-image
+++ b/misc/rtems-boot-image
@@ -1,7 +1,7 @@
-#! /bin/sh
+#! /usr/bin/env python
#
# RTEMS Tools Project (http://www.rtems.org/)
-# Copyright 2019 Chris Johns (chrisj@rtems.org)
+# Copyright 2019, 2020 Chris Johns (chrisj@rtems.org)
# All rights reserved.
#
# This file is part of the RTEMS Tools package in 'rtems-tools'.
@@ -28,15 +28,18 @@
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
-set -e
-base=$(dirname $(dirname $0))
-cmd=misc/tools/cmd-boot-image.py
-PYTHON_WRAPPER=rtemstoolkit/python-wrapper.sh
-if test -f ${base}/${PYTHON_WRAPPER}; then
- PYTHON_CMD=${base}/${cmd}
- . ${base}/${PYTHON_WRAPPER}
-elif test -f ${base}/share/rtems/${PYTHON_WRAPPER}; then
- PYTHON_CMD=${base}/share/rtems/${cmd}
- . ${base}/share/rtems/${PYTHON_WRAPPER}
-fi
-echo "error: RTEMS Toolkit python wrapper not found, please report"
+
+from __future__ import print_function
+
+import sys, os
+
+base = os.path.dirname(os.path.dirname(os.path.abspath(sys.argv[0])))
+rtems = os.path.join(base, 'share', 'rtems')
+sys.path = sys.path[0:1] + [rtems, base] + sys.path[1:]
+
+try:
+ import misc.tools.boot
+ misc.tools.boot.run()
+except ImportError:
+ print("Incorrect RTEMS Tools installation", file = sys.stderr)
+ sys.exit(1)