summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJun Wang <junbill.wang@samsung.com>2017-03-03 15:56:24 +0800
committerSoonKyu Park <sk7.park@samsung.com>2017-04-04 21:32:14 +0900
commitd8180c7b3e89bddf435c51bf0621568a078133f5 (patch)
tree5b794494239b2c4216d5b9565e75893d6a2d456d
parent990f46dfac1b1ad7c074a030f59e727d532d6abd (diff)
downloadmic-d8180c7b3e89bddf435c51bf0621568a078133f5.tar.gz
mic-d8180c7b3e89bddf435c51bf0621568a078133f5.tar.bz2
mic-d8180c7b3e89bddf435c51bf0621568a078133f5.zip
Merge add mipsel register on binfmt_misc && Add support of qemu-mipsel patch
Change-Id: I6df917f19662ecfeb8ef5810b9ce2c9765018326
-rw-r--r--mic/imager/baseimager.py58
-rwxr-xr-xmic/utils/misc.py9
2 files changed, 48 insertions, 19 deletions
diff --git a/mic/imager/baseimager.py b/mic/imager/baseimager.py
index c905724..18a2d9c 100644
--- a/mic/imager/baseimager.py
+++ b/mic/imager/baseimager.py
@@ -155,25 +155,45 @@ class BaseImageCreator(object):
if len(self.ks.handler.partition.partitions) > 1:
self.multiple_partitions = True
- if self.target_arch and self.target_arch.startswith("arm"):
- for dep in self._dep_checks:
- if dep == "extlinux":
- self._dep_checks.remove(dep)
-
- if not os.path.exists("/usr/bin/qemu-arm") or \
- not misc.is_statically_linked("/usr/bin/qemu-arm"):
- self._dep_checks.append("qemu-arm-static")
-
- if os.path.exists("/proc/sys/vm/vdso_enabled"):
- vdso_fh = open("/proc/sys/vm/vdso_enabled","r")
- vdso_value = vdso_fh.read().strip()
- vdso_fh.close()
- if (int)(vdso_value) == 1:
- msger.warning("vdso is enabled on your host, which might "
- "cause problems with arm emulations.\n"
- "\tYou can disable vdso with following command before "
- "starting image build:\n"
- "\techo 0 | sudo tee /proc/sys/vm/vdso_enabled")
+ if self.target_arch:
+ if self.target_arch.startswith("arm"):
+ for dep in self._dep_checks:
+ if dep == "extlinux":
+ self._dep_checks.remove(dep)
+
+ if not os.path.exists("/usr/bin/qemu-arm") or \
+ not misc.is_statically_linked("/usr/bin/qemu-arm"):
+ self._dep_checks.append("qemu-arm-static")
+
+ if os.path.exists("/proc/sys/vm/vdso_enabled"):
+ vdso_fh = open("/proc/sys/vm/vdso_enabled","r")
+ vdso_value = vdso_fh.read().strip()
+ vdso_fh.close()
+ if (int)(vdso_value) == 1:
+ msger.warning("vdso is enabled on your host, which might "
+ "cause problems with arm emulations.\n"
+ "\tYou can disable vdso with following command before "
+ "starting image build:\n"
+ "\techo 0 | sudo tee /proc/sys/vm/vdso_enabled")
+ elif self.target_arch == "mipsel":
+ for dep in self._dep_checks:
+ if dep == "extlinux":
+ self._dep_checks.remove(dep)
+
+ if not os.path.exists("/usr/bin/qemu-mipsel") or \
+ not misc.is_statically_linked("/usr/bin/qemu-mipsel"):
+ self._dep_checks.append("qemu-mipsel-static")
+
+ if os.path.exists("/proc/sys/vm/vdso_enabled"):
+ vdso_fh = open("/proc/sys/vm/vdso_enabled","r")
+ vdso_value = vdso_fh.read().strip()
+ vdso_fh.close()
+ if (int)(vdso_value) == 1:
+ msger.warning("vdso is enabled on your host, which might "
+ "cause problems with mipsel emulations.\n"
+ "\tYou can disable vdso with following command before "
+ "starting image build:\n"
+ "\techo 0 | sudo tee /proc/sys/vm/vdso_enabled")
# make sure the specified tmpdir and cachedir exist
if not os.path.exists(self.tmpdir):
diff --git a/mic/utils/misc.py b/mic/utils/misc.py
index 1e337d9..f7693b2 100755
--- a/mic/utils/misc.py
+++ b/mic/utils/misc.py
@@ -908,6 +908,13 @@ def setup_qemu_emulator(rootdir, arch):
arm_binary = "qemu-aarch64-static"
else:
raise CreatorError("Please install a statically-linked %s" % arm_binary)
+ elif arch == "mipsel":
+ node = "/proc/sys/fs/binfmt_misc/mipsel"
+ arm_binary = "qemu-mipsel"
+ if not os.path.exists("/usr/bin/%s" % arm_binary) or not is_statically_linked("/usr/bin/%s"):
+ arm_binary = "qemu-mipsel-static"
+ if not os.path.exists("/usr/bin/%s" % arm_binary):
+ raise CreatorError("Please install a statically-linked %s" % arm_binary)
else:
node = "/proc/sys/fs/binfmt_misc/arm"
arm_binary = "qemu-arm"
@@ -937,6 +944,8 @@ def setup_qemu_emulator(rootdir, arch):
if not os.path.exists(node):
if arch == "aarch64":
qemu_arm_string = ":aarch64:M::\\x7fELF\\x02\\x01\\x01\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x02\\x00\\xb7:\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\x00\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xfe\\xff\\xff:%s:\n" % qemu_emulator
+ elif arch == "mipsel":
+ qemu_arm_string = ":mipsel:M::\\x7fELF\\x01\\x01\\x01\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x02\\x00\\x08\\x00:\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\x00\\xfe\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xfe\\xff\\xff\\xff:%s:\n" % qemu_emulator
else:
qemu_arm_string = ":arm:M::\\x7fELF\\x01\\x01\\x01\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x02\\x00\\x28\\x00:\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\x00\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xfa\\xff\\xff\\xff:%s:\n" % qemu_emulator
with open("/proc/sys/fs/binfmt_misc/register", "w") as fd: