[PATCH 09/11] rtems/rtems-bsp: Support a kernel configuration file

chrisj at rtems.org chrisj at rtems.org
Thu Sep 8 01:26:03 UTC 2022


From: Chris Johns <chrisj at rtems.org>

- Support a single BSP defined in a kernel config file
---
 rtems/config/rtems-bsp.cfg | 46 +++++++++++++++++++++++++-------------
 1 file changed, 31 insertions(+), 15 deletions(-)

diff --git a/rtems/config/rtems-bsp.cfg b/rtems/config/rtems-bsp.cfg
index 801cd5c..4f9343a 100644
--- a/rtems/config/rtems-bsp.cfg
+++ b/rtems/config/rtems-bsp.cfg
@@ -40,28 +40,44 @@
 %{pkgconfig filter-flags yes}
 
 #
-# We need a host from the user to specifiy the RTEMS architecture and major
-# version. It can be defined in rtems_host.
+# We need a BSP from the user.
 #
-%if %{defined rtems_host}
- %{triplet _host %{rtems_host}}
-%endif
-%if %{rtems_bsp_error}
- %if %{_host} == %{nil} || %{_host} == %{_build}
-  %error No RTEMS host or BSP specified: --host=<arch>-rtems<ver>
+%if %{defined with_rtems_bsp_config}
+ %define rtems_bsp %(%{_sbdir}/sb/rtems-kernel-config-check \
+                        -c %{with_rtems_bsp_config})
+%else
+ %ifn %{defined with_rtems_bsp}
+  %if %{rtems_bsp_error}
+   %error No RTEMS BSP specified: --with-rtems-bsp=bsp
+  %endif
+  %define with_rtems_bsp sparc/erc32
  %endif
+ %define rtems_bsp %{with_rtems_bsp}
 %endif
 
 #
-# We need a BSP from the user.
+# Count the BSPs. Currently only one is supported
 #
-%ifn %{defined with_rtems_bsp}
- %if %{rtems_bsp_error}
-  %error No RTEMS BSP specified: --with-rtems-bsp=bsp
- %endif
- %define with_rtems_bsp sparc/erc32
+%define rtems_bsp_count %(echo %{rtems_bsp} | tr ' ' '\n' | wc -l)
+
+%if %{rtems_bsp_count} > 1
+ %error RTEMS packages do not support multiple BSP builds
+%endif
+
+#
+# Separate out the arch and bsp
+#
+%define rtems_arch %(echo %{rtems_bsp} | sed -e 's^\/.*^^g')
+%define rtems_bsp  %(echo %{rtems_bsp} | sed -e 's^.*\/^^g')
+
+#
+# We need a host from the user to specifiy the RTEMS architecture and major
+# version. It can be defined in rtems_host.
+#
+%if !%{defined rtems_host}
+ %define rtems_host %{rtems_arch}-rtems%{rtems_version}
 %endif
-%define rtems_bsp %{with_rtems_bsp}
+%{triplet _host %{rtems_host}}
 
 #
 # If no tools or RTEMS provided use the prefix. If staging use the staging
-- 
2.24.1



More information about the devel mailing list