[elbe-devel] patch proposal build_sdk target_arch

Steih, Martin Martin.Steih at lachmann-rink.de
Fri Apr 8 14:31:15 CEST 2022


Hey y'all,

I ran into a problem after building an sdk for cross development.
After sourcing the environment variables, everything was set up correctly, except ARCH, which was hardcoded to x86.

I hope the change below is not too far off from the correct solution, but it did the trick for me. Maybe someone can review it.

Thanks.

diff --git a/elbepack/elbeproject.py b/elbepack/elbeproject.py
index 5bee22e80..e0898985f 100644
--- a/elbepack/elbeproject.py
+++ b/elbepack/elbeproject.py
@@ -74,7 +74,8 @@ class UnsupportedSDKException(Exception):
 def test_gen_sdk_scripts():
     system("mkdir -p /tmp/test/sdk")
-    gen_sdk_scripts('armhf-linux-gnueabihf',
+    gen_sdk_scripts('armhf',
+                    'armhf-linux-gnueabihf',
                     'ARM',
                     'testproject',
                     '08.15',
@@ -82,7 +83,8 @@ def test_gen_sdk_scripts():
                     '/tmp/test/sdk')

-def gen_sdk_scripts(triplet,
+def gen_sdk_scripts(arch,
+                    triplet,
                     elfcode,
                     prj_name,
                     prj_version,
@@ -101,6 +103,7 @@ def gen_sdk_scripts(triplet,
                                                          prj_version),
                  'sdk_ext_path': '~/elbe-sdk',
                  'real_multimach_target_sys': triplet,
+                 'target_arch' : arch,
                  'target_elfcode': elfcode,
                  'sdk_title': 'ELBE %s' % prj_name,
                  'sdk_version': prj_version}
@@ -378,6 +381,7 @@ class ElbeProject:
     def build_sdk(self):
         triplet = self.xml.defs["triplet"]
         elfcode = self.xml.defs["elfcode"]
+        arch = self.xml.defs["arch"]
         host_pkglist = []
         if self.xml.tgt.has('hostsdk-pkg-list'):
@@ -403,7 +407,8 @@ class ElbeProject:
         self.build_host_sysroot(host_pkglist, hostsysrootpath)
-        n = gen_sdk_scripts(triplet,
+        n = gen_sdk_scripts(arch,
+                            triplet,
                             elfcode,
                             self.name,
                             self.xml.text("project/version"),
diff --git a/elbepack/makofiles/environment-setup-elbe.mako b/elbepack/makofiles/environment-setup-elbe.mako
index b758f0117..a7d714322 100644
--- a/elbepack/makofiles/environment-setup-elbe.mako
+++ b/elbepack/makofiles/environment-setup-elbe.mako
@@ -77,7 +77,7 @@ export CPPFLAGS=""
export KCFLAGS="--sysroot=$SDKTARGETSYSROOT"
export OECORE_DISTRO_VERSION="${sdk_version}"
export OECORE_SDK_VERSION="${sdk_version}"
-export ARCH=x86
+export ARCH=${target_arch}
export CROSS_COMPILE=${real_multimach_target_sys}-
 # Append environment subscripts

i. A. Martin Steih
Projektleiter
Entwicklung

[cid:image001.png at 01D84B55.4C2ED2B0]<https://www.lachmann-rink.de/>

Lachmann & Rink GmbH
Martin.Steih at lachmann-rink.de<mailto:Martin.Steih at lachmann-rink.de> | www.lachmann-rink.de<https://www.lachmann-rink.de>
fon: +49 2734 2817 430<tel:+49%202734%202817%20430>

Hommeswiese 129, 57258 Freudenberg | Otto-Hahn-Straße 18-20, 44227 Dortmund
Geschäftsführer: Dipl.-Ing. Arjan Bijlard, Dipl.-Inf. Claudius Rink | Amtsgericht Siegen, HRB 2600
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linutronix.de/pipermail/elbe-devel/attachments/20220408/8f432d3b/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 47352 bytes
Desc: image001.png
URL: <http://lists.linutronix.de/pipermail/elbe-devel/attachments/20220408/8f432d3b/attachment-0001.png>


More information about the elbe-devel mailing list