LibBSD | 7-freebsd-14 does not compile for powerpc (beatnik) (#67)

Heinz Junkes (@junkes) gitlab at rtems.org
Tue Nov 4 13:24:41 UTC 2025




Heinz Junkes commented: https://gitlab.rtems.org/rtems/pkg/rtems-libbsd/-/issues/67#note_135651


With this fix, i could compile:
```
diff --git a/rtemsbsd/powerpc/include/linux/ioport.h b/rtemsbsd/powerpc/include/linux/ioport.h
index 537498ea..d86dd4a1 100644
--- a/rtemsbsd/powerpc/include/linux/ioport.h
+++ b/rtemsbsd/powerpc/include/linux/ioport.h
@@ -33,7 +33,17 @@
 extern "C" {
 #endif /* __cplusplus */

-struct resource {
+/*
+ * Linux uses 'struct resource' with start/end fields for I/O port/memory ranges.
+ * FreeBSD uses 'struct resource' as an opaque type in sys/bus.h.
+ *
+ * To avoid conflicts, we:
+ * 1. Use FreeBSD's struct resource (forward declared in sys/bus.h)
+ * 2. Define a linux_resource structure for Linux compatibility
+ * 3. Provide a compatibility mapping where needed
+ */
+
+struct linux_resource {
        resource_size_t start;
        resource_size_t end;
 };
@@ -41,6 +51,17 @@ struct resource {
 #define        IORESOURCE_IRQ  0x00000400
 #define        IORESOURCE_MEM  0x00000420

+/*
+ * For Linux driver compatibility, map 'struct resource' to linux_resource
+ * in contexts where we know we need Linux semantics.
+ */
+#ifdef __rtems__
+/* When included from Linux drivers, use our linux_resource */
+#ifndef _USING_FREEBSD_RESOURCE_
+#define resource linux_resource
+#endif
+#endif
+
 static inline resource_size_t
 resource_size(const struct resource *res)
 {
```

-- 
View it on GitLab: https://gitlab.rtems.org/rtems/pkg/rtems-libbsd/-/issues/67#note_135651
You're receiving this email because of your account on gitlab.rtems.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20251104/5dff39d5/attachment.htm>


More information about the bugs mailing list