[PATCH] rtems-kernel: Implement kernel recipe using waf

Ryan Long ryan.long at oarcorp.com
Fri Oct 8 15:03:14 UTC 2021


Closes #4145
---
 rtems/config/tools/rtems-kernel-6.cfg      |  8 ++-
 rtems/config/tools/rtems-kernel-common.cfg | 95 +++++++++++++-----------------
 2 files changed, 47 insertions(+), 56 deletions(-)

diff --git a/rtems/config/tools/rtems-kernel-6.cfg b/rtems/config/tools/rtems-kernel-6.cfg
index f1d0990..edc0eb1 100644
--- a/rtems/config/tools/rtems-kernel-6.cfg
+++ b/rtems/config/tools/rtems-kernel-6.cfg
@@ -2,10 +2,12 @@
 # RTEMS 5
 #
 
-%define rtems_kernel_version 3ec5f20484cc4201e1d7b87844505644533b6148
-%hash sha512 rtems-kernel-%{rtems_kernel_version}.tar.bz2 \
-              BjMKrf5n1YR6IpiZrY5TUEzKATPRJxA2/6m6f833DdRu+RyLxccXqA4gHRdVUqFelFNQ3o0XdG4o1naBKYfhkQ==
+%define rtems_kernel_version 3bb97a30b17b6c138dead3e3a6b329c3b301cdb3
 
+%source set rtems_kernel --rsb-file=rtems-kernel-%{rtems_kernel_version}.tar.gz https://codeload.github.com/RTEMS/rtems/tar.gz/%{rtems_kernel_version}
+
+%hash sha512 rtems-kernel-%{rtems_kernel_version}.tar.gz \
+              m/ogwrJj4X60ewDIbV6WRj1MJa/22gQHQd56XiNMfvCr0nsvcXdkXKAObLIGYIGYfUyEwlVk3SRjjRFkFalDGQ==
 #
 # The RTEMS build instructions.
 #
diff --git a/rtems/config/tools/rtems-kernel-common.cfg b/rtems/config/tools/rtems-kernel-common.cfg
index 157c7a4..38af264 100644
--- a/rtems/config/tools/rtems-kernel-common.cfg
+++ b/rtems/config/tools/rtems-kernel-common.cfg
@@ -38,6 +38,11 @@
 %define rtems_bsp %{with_rtems_bsp}
 
 #
+# Configuration file used with waf
+#
+%define config_file config-%{_target}-%{rtems_bsp}.ini
+
+#
 # If no tools are provided use the prefix.
 #
 %ifn %{defined with_tools}
@@ -98,14 +103,6 @@ URL: 	 https://www.rtems.org/
  %define rtems_posix 0
 %endif
 
-%if %{defined with_rtems_legacy_network}
- %define rtems_networking 1
-%endif
-
-%if %{defined with_rtems_cxx}
- %define rtems_cxx 1
-%endif
-
 %if %{defined with_rtems_bspopts}
  %define bspopts %{with_rtems_bspopts}
 %endif
@@ -129,8 +126,10 @@ URL: 	 https://www.rtems.org/
  %error No RTEMS kernel version defined
 %endif
 
+#%if ! %{defined rtems_kernel}
 %source set rtems_kernel --rsb-file=%{rtems_kernel_file} \
               https://git.rtems.org/rtems/snapshot/rtems-%{rtems_kernel_version}.tar.bz2
+#%endif
 
 #
 # Check the various --with/--without options we support. These are
@@ -151,51 +150,38 @@ URL: 	 https://www.rtems.org/
 %if %{defined without_rtemsbsp}
  %error Option --without-rtemsbsp is not supported.
 %endif
+
 %if %{defined without_rtems_tests}
- %define with_rtems_tests no
+ %define rtems_tests False
+ %define rtems_sample_tests False
 %endif
 %if %{defined with_rtems_tests}
  %if %{with_rtems_tests} == 1
-  %define with_rtems_tests yes
+   %define rtems_tests True
+   %define rtems_sample_tests True
  %endif
- %if %{with_rtems_tests} == yes || \
-     %{with_rtems_tests} == no || \
-     %{with_rtems_tests} == samples
-  %define rtems_tests %{with_rtems_tests}
+  %if %{with_rtems_tests} == samples
+      %define rtems_tests False
+      %define rtems_sample_tests True
  %endif
 %endif
 %if %{defined with_rtems_smp}
  %define rtems_smp 1
 %endif
-%if %{defined with_rtems_legacy_network}
- %define rtems_networking 1
-%endif
 %if %{defined with_rtems_bspopts}
  %define rtems_bspopts %{with_rtems_bspopts}
 %endif
 
 #
-# If C++ defined for the tool set use it to control RTEMS's setting..
-#
-%if %{defined enable_cxx}
- %define rtems_cxx %{enable_cxx}
-%endif
-
-#
 # Default set up. Override these in a BSP if you want a
 # specific setup.
 #
 %ifn %{defined rtems_posix}
  %define rtems_posix 1
 %endif
-%ifn %{defined rtems_networking}
- %define rtems_networking 0
-%endif
-%ifn %{defined rtems_cxx}
- %define rtems_cxx 1
-%endif
 %ifn %{defined rtems_tests}
- %define rtems_tests samples
+ %define rtems_tests False
+ %define rtems_sample_tests True
 %endif
 %ifn %{defined rtems_bspopts}
  %define rtems_bspopts %{nil}
@@ -213,8 +199,9 @@ URL: 	 https://www.rtems.org/
     %if %{defined _internal_autotools_path}
       export PATH="%{_internal_autotools_path}/bin:${PATH}"
     %endif
-    ./bootstrap -c
-    ./rtems-bootstrap
+    pwd
+    ls
+    ./waf distclean
   %endif
   cd ..
 
@@ -225,32 +212,34 @@ URL: 	 https://www.rtems.org/
   else
     build_dir="build"
   fi
+
+  cd ${source_dir_rtems}
+
+  cpu=`echo %{_target} | cut -d- -f1`
+  echo "[${cpu}/%{rtems_bsp}]" > %{config_file}
+  echo "RTEMS_POSIX_API = %{?rtems_posix:True}%{!?rtems_posix:False}" >> %{config_file}
+  echo "RTEMS_SMP = %{?rtems_smp:True}%{!?rtems_smp:False}" >> %{config_file}
+  echo "BUILD_TESTS = %{rtems_tests}" >> %{config_file}
+  echo "BUILD_SAMPLES = %{rtems_sample_tests}" >> %{config_file}
+
   mkdir -p ${build_dir}
-  cd ${build_dir}
-
-  ../${source_dir_rtems}/configure \
-    --build=%{_build} --host=%{_host} \
-    --target=%{_target} \
-    --enable-rtemsbsp="%{rtems_bsp}" \
-    %{?rtems_cxx:--enable-cxx}%{!?rtems_cxx:--disable-cxx} \
-    %{?rtems_posix:--enable-posix}%{!?rtems_posix:--disable-posix} \
-    %{?rtems_networking:--enable-networking}%{!?rtems_networking:--disable-networking} \
-    %{?rtems_tests:--enable-tests=%{rtems_tests}} \
-    %{?rtems_smp:--enable-smp} \
+
+  ./waf configure \
+    --rtems-bsps=%{_target}/%{rtems_bsp} \
     --prefix=%{_prefix} --bindir=%{_bindir} \
-    --exec-prefix=%{_exec_prefix} \
-    --includedir=%{_includedir} --libdir=%{_libdir} \
-    --mandir=%{_mandir} --infodir=%{_infodir} \
-    %{rtems_bspopts}
+    --out=b-%{rtems_bsp} \
+    %{rtems_bspopts} \
+    --rtems-config=%{config_file}
 
-  %{__make} %{?_smp_mflags} all
-  cd ..
+  ./waf %{?_smp_mflags}
+
+  cd -
 
 %install
   %{__rmdir} $SB_BUILD_ROOT
 
-  cd ${build_dir}
-  %{__make} DESTDIR=$SB_BUILD_ROOT install
+  cd ${source_dir_rtems}
+  ./waf --destdir=$SB_BUILD_ROOT install
 
   %if %{rtems_tests} != no
    %define rtems_test_install %{_target}/%{rtems_bsp}/tests
@@ -259,4 +248,4 @@ URL: 	 https://www.rtems.org/
       -exec cp -v \{\} $SB_BUILD_ROOT/%{_prefix}/%{rtems_test_install}/ \;
   %endif
 
-  cd ..
+  cd -
-- 
1.8.3.1



More information about the devel mailing list