summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxuhy <huayong.xu@samsung.com>2024-01-24 16:50:24 +0800
committerxuhy <huayong.xu@samsung.com>2024-01-24 16:54:15 +0800
commit3986255c109d15be79d3947d0289ac8bfc4f85be (patch)
tree2a92863b142e7cd7dd20862c16855007e8b4198b
parent7949c40c185296d142cfd54a08864a19f2b5d37a (diff)
downloadmic-accepted/tizen/unified/toolchain/20240311.070041.tar.gz
mic-accepted/tizen/unified/toolchain/20240311.070041.tar.bz2
mic-accepted/tizen/unified/toolchain/20240311.070041.zip
Change-Id: I4ead58bcabeffbb08e89f2984e0af2e913452a40 Signed-off-by: Marek PikuĊ‚a <m.pikula@partner.samsung.com> Signed-off-by: xuhy <huayong.xu@samsung.com>
-rw-r--r--MANIFEST.in2
-rw-r--r--etc/bash_completion.d/mic.sh1
-rw-r--r--mic/chroot.py3
-rw-r--r--mic/imager/baseimager.py21
-rw-r--r--mic/imager/raw.py7
-rwxr-xr-xmic/utils/misc.py11
-rw-r--r--mic/utils/rpmmisc.py3
7 files changed, 45 insertions, 3 deletions
diff --git a/MANIFEST.in b/MANIFEST.in
new file mode 100644
index 0000000..d24b818
--- /dev/null
+++ b/MANIFEST.in
@@ -0,0 +1,2 @@
+include etc/mic.conf.in
+
diff --git a/etc/bash_completion.d/mic.sh b/etc/bash_completion.d/mic.sh
index 4f467ca..38d5555 100644
--- a/etc/bash_completion.d/mic.sh
+++ b/etc/bash_completion.d/mic.sh
@@ -110,6 +110,7 @@ __mic_complete_val()
armv5tel
armv5tejl
armv7tnhl
+ riscv64
"
pkgmgr_values="
yum
diff --git a/mic/chroot.py b/mic/chroot.py
index 71e35b7..27278b6 100644
--- a/mic/chroot.py
+++ b/mic/chroot.py
@@ -56,6 +56,7 @@ def ELF_arch(chrootdir):
r"Intel 80[0-9]86": "i686",
r"x86-64": "x86_64",
r"ARM": "arm",
+ r"RISC-V": "riscv64",
}
for path in chkfiles:
@@ -307,6 +308,8 @@ def chroot(chrootdir, bindmounts = None, execute = "/bin/bash"):
qemu_emulators = misc.setup_qemu_emulator(chrootdir, "arm")
elif arch == "mipsel":
qemu_emulators = misc.setup_qemu_emulator(chrootdir, "mipsel")
+ elif arch == "riscv64":
+ qemu_emulators = misc.setup_qemu_emulator(chrootdir, "riscv64")
else:
qemu_emulators = []
diff --git a/mic/imager/baseimager.py b/mic/imager/baseimager.py
index f0243f7..059e670 100644
--- a/mic/imager/baseimager.py
+++ b/mic/imager/baseimager.py
@@ -203,6 +203,25 @@ class BaseImageCreator(object):
"\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 == "riscv64":
+ for dep in self._dep_checks:
+ if dep == "extlinux":
+ self._dep_checks.remove(dep)
+
+ if not os.path.exists("/usr/bin/qemu-riscv64") or \
+ not misc.is_statically_linked("/usr/bin/qemu-riscv64"):
+ self._dep_checks.append("qemu-riscv64-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 riscv64 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):
@@ -831,7 +850,7 @@ class BaseImageCreator(object):
fs.makedirs(self._instroot + d)
if self.target_arch and self.target_arch.startswith("arm") or \
- self.target_arch == "aarch64":
+ self.target_arch == "aarch64" or self.target_arch == "riscv64":
self.qemu_emulators = misc.setup_qemu_emulator(self._instroot,
self.target_arch)
diff --git a/mic/imager/raw.py b/mic/imager/raw.py
index 452ba8c..430cfd0 100644
--- a/mic/imager/raw.py
+++ b/mic/imager/raw.py
@@ -491,8 +491,11 @@ class RawImageCreator(BaseImageCreator):
def _write_image_xml(self):
imgarch = "i686"
- if self.target_arch and self.target_arch.startswith("arm"):
- imgarch = "arm"
+ if self.target_arch:
+ if self.target_arch.startswith("arm"):
+ imgarch = "arm"
+ elif self.target_arch == "riscv64":
+ imgarch = "riscv64"
xml = "<image>\n"
name_attributes = ""
diff --git a/mic/utils/misc.py b/mic/utils/misc.py
index a49e20f..1fbbcd9 100755
--- a/mic/utils/misc.py
+++ b/mic/utils/misc.py
@@ -923,6 +923,15 @@ def get_qemu_arm_binary(arch):
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)
+ elif arch == "riscv64":
+ node = "/proc/sys/fs/binfmt_misc/riscv64"
+ arm_binary = "qemu-riscv64"
+ if os.path.exists("/usr/bin/qemu-riscv64") and is_statically_linked("/usr/bin/qemu-riscv64"):
+ arm_binary = "qemu-riscv64"
+ elif os.path.exists("/usr/bin/qemu-riscv64-static"):
+ arm_binary = "qemu-riscv64-static"
+ else:
+ raise CreatorError("Please install a statically-linked %s" % arm_binary)
else:
node = "/proc/sys/fs/binfmt_misc/arm"
arm_binary = "qemu-arm"
@@ -964,6 +973,8 @@ def setup_qemu_emulator(rootdir, arch):
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
+ elif arch == "riscv64":
+ qemu_arm_string = ":riscv64:M::\\x7fELF\\x02\\x01\\x01\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x02\\x00\\xf3\\x00:\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\x00\\xff\\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
diff --git a/mic/utils/rpmmisc.py b/mic/utils/rpmmisc.py
index a656e40..3dde377 100644
--- a/mic/utils/rpmmisc.py
+++ b/mic/utils/rpmmisc.py
@@ -323,6 +323,7 @@ archPolicies = {
"armv5tel": "armv5tel:armv5l:armv4tl:armv4l:armv3l",
"armv5l": "armv5l:armv4tl:armv4l:armv3l",
"mipsel": "mipsel",
+ "riscv64": "riscv64",
}
# dict mapping arch -> ( multicompat, best personality, biarch personality )
@@ -358,6 +359,8 @@ arches = {
"ia64": "noarch",
"mipsel": "mipsel",
+
+ "riscv64": "noarch",
}
def isMultiLibArch(arch=None):