rtems/rtems-bsp: Support a kernel configuration file

- Support a single BSP defined in a kernel config file
This commit is contained in:
Chris Johns
2022-09-07 18:21:50 +10:00
parent 1ce36943e9
commit e1f87e5d72

View File

@@ -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
%define rtems_bsp %{with_rtems_bsp}
#
# 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
%{triplet _host %{rtems_host}}
#
# If no tools or RTEMS provided use the prefix. If staging use the staging