From e1f87e5d72e6161089ec143a0f2f07e9f84ae8ab Mon Sep 17 00:00:00 2001 From: Chris Johns Date: Wed, 7 Sep 2022 18:21:50 +1000 Subject: rtems/rtems-bsp: Support a kernel configuration file - 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=-rtems +%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 -- cgit v1.2.3