[PATCH v4 2/3] amd64: Add to build

Jan Sommer jan.sommer at dlr.de
Tue Feb 18 10:21:43 UTC 2020


---
 libbsd.py     | 25 +++++++++++++++++++++++++
 waf_libbsd.py | 13 +++++++++++--
 2 files changed, 36 insertions(+), 2 deletions(-)

diff --git a/libbsd.py b/libbsd.py
index 3823c03f..db4b4c63 100644
--- a/libbsd.py
+++ b/libbsd.py
@@ -90,6 +90,17 @@ _defaults = {
     'cpu-include-paths': ['rtemsbsd/@CPU@/include',
                           'freebsd/sys/@CPU@/include'],
 
+    #
+    # Map paths based on RTEMS naming to FreeBSD naming.
+    #
+    'path-mappings': [     # (source, targets)
+    # i386
+    ('freebsd/sys/i386/include', ['freebsd/sys/x86/include', 'freebsd/sys/i386/include']),
+    # amd64
+    ('freebsd/sys/x86_64/include', ['freebsd/sys/x86/include', 'freebsd/sys/amd64/include']),
+    ('rtemsbsd/x86_64/include', 'rtemsbsd/amd64/include')
+    ],
+
     # The path where headers will be copied during build.
     'build-include-path': ['build-include'],
 
@@ -1548,6 +1559,7 @@ class dev_nic(builder.Module):
                 'sys/sys/buf.h',
                 'sys/sys/mqueue.h',
                 'sys/sys/user.h',
+                'sys/sys/efi.h',
             ]
         )
         self.addCPUDependentFreeBSDHeaderFiles(
@@ -1559,6 +1571,11 @@ class dev_nic(builder.Module):
                 'sys/x86/include/intr_machdep.h',
                 'sys/x86/include/metadata.h',
                 'sys/i386/include/cpufunc.h',
+                'sys/amd64/include/specialreg.h',
+                'sys/amd64/include/md_var.h',
+                'sys/amd64/include/efi.h',
+                'sys/amd64/include/_bus.h',
+                'sys/amd64/include/cpufunc.h',
                 'sys/mips/include/cpufunc.h',
                 'sys/mips/include/cpuregs.h',
                 'sys/powerpc/include/cpufunc.h',
@@ -4993,6 +5010,7 @@ class in_cksum(builder.Module):
         self.addCPUDependentFreeBSDHeaderFiles(
             [
                 'sys/i386/include/in_cksum.h',
+                'sys/amd64/include/in_cksum.h',
                 'sys/mips/include/in_cksum.h',
                 'sys/powerpc/include/in_cksum.h',
                 'sys/sparc64/include/in_cksum.h',
@@ -5013,6 +5031,13 @@ class in_cksum(builder.Module):
             ],
             mm.generator['source']()
         )
+        self.addCPUDependentFreeBSDSourceFiles(
+            [ 'x86_64' ],
+            [
+                'sys/amd64/amd64/in_cksum.c',
+            ],
+            mm.generator['source']()
+        )
         self.addCPUDependentFreeBSDSourceFiles(
             [ 'powerpc' ],
             [
diff --git a/waf_libbsd.py b/waf_libbsd.py
index 84f22b76..9038119f 100644
--- a/waf_libbsd.py
+++ b/waf_libbsd.py
@@ -196,8 +196,6 @@ class Builder(builder.ModuleManager):
         buildinclude = 'build-include'
         if 'cpu-include-paths' in config:
             cpu = bld.get_env()['RTEMS_ARCH']
-            if cpu == "i386":
-                includes += ['freebsd/sys/x86/include']
             for i in config['cpu-include-paths']:
                 includes += [i.replace('@CPU@', cpu)]
         if 'include-paths' in config:
@@ -208,6 +206,17 @@ class Builder(builder.ModuleManager):
                 buildinclude = buildinclude[0]
         includes += [buildinclude]
 
+        #
+        # Path mappings
+        #
+        if 'path-mappings' in config:
+            for source, target in config['path-mappings']:
+                if source in includes:
+                    target = [target] if isinstance(target, str) else target
+                    i = includes.index(source)
+                    includes.remove(source)
+                    includes[i:i] = target
+
         #
         # Collect the libbsd uses
         #
-- 
2.17.1



More information about the devel mailing list