[PATCH v4 2/3] i386: Update build system

Jan Sommer jan.sommer at dlr.de
Thu Apr 9 13:56:55 UTC 2020


- Update FreeBSD files in libbsd.py
- Introduce path-mappings in waf_libsd.py and libbsd.py for include path
fixes
---
 libbsd.py     | 17 +++++++++++++++--
 waf_libbsd.py | 13 +++++++++++--
 2 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/libbsd.py b/libbsd.py
index d791efe4..3c0b7afe 100644
--- a/libbsd.py
+++ b/libbsd.py
@@ -90,6 +90,14 @@ _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']),
+    ],
+
     # The path where headers will be copied during build.
     'build-include-path': ['build-include'],
 
@@ -1366,10 +1374,14 @@ class dev_net(builder.Module):
                 'sys/net/if_types.h',
                 'sys/net/if_var.h',
                 'sys/net/vnet.h',
+                'sys/net/mp_ring.h',
+                'sys/net/iflib_private.h',
             ]
         )
         self.addKernelSpaceSourceFiles(
             [
+                'sys/net/iflib.c',
+                'sys/net/mp_ring.c',
                 'sys/arm/ti/cpsw/if_cpsw.c',
                 'sys/dev/ffec/if_ffec.c',
                 'sys/dev/mii/mii.c',
@@ -1425,6 +1437,7 @@ class dev_nic(builder.Module):
                 'sys/i386/include/specialreg.h',
                 'sys/i386/include/md_var.h',
                 'sys/i386/include/intr_machdep.h',
+                'sys/x86/include/intr_machdep.h',
                 'sys/i386/include/cpufunc.h',
                 'sys/mips/include/cpufunc.h',
                 'sys/mips/include/cpuregs.h',
@@ -2601,7 +2614,7 @@ class pci(builder.Module):
         self.addCPUDependentFreeBSDHeaderFiles(
             [
                 'sys/i386/include/_bus.h',
-                'sys/i386/include/legacyvar.h',
+                'sys/x86/include/legacyvar.h',
                 'sys/x86/include/bus.h',
                 'sys/x86/include/pci_cfgreg.h',
             ]
@@ -2609,7 +2622,7 @@ class pci(builder.Module):
         self.addCPUDependentFreeBSDSourceFiles(
             [ 'i386' ],
             [
-                'sys/i386/i386/legacy.c',
+                'sys/x86/x86/legacy.c',
                 'sys/x86/pci/pci_bus.c',
             ],
             mm.generator['source']()
diff --git a/waf_libbsd.py b/waf_libbsd.py
index 02816bb7..14f2ae78 100644
--- a/waf_libbsd.py
+++ b/waf_libbsd.py
@@ -210,8 +210,6 @@ class Builder(builder.ModuleManager):
         buildinclude = 'build-include'
         if 'cpu-include-paths' in config:
             cpu = bld.get_env()['RTEMS_ARCH']
-            if cpu == "i386":
-                cpu = 'x86'
             for i in config['cpu-include-paths']:
                 includes += [i.replace('@CPU@', cpu)]
         if 'include-paths' in config:
@@ -223,6 +221,17 @@ class Builder(builder.ModuleManager):
         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
         #
         libbsd_use = []
-- 
2.12.3



More information about the devel mailing list