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

Chris Johns chrisj at rtems.org
Tue Oct 12 20:59:37 UTC 2021


On 12/10/21 11:59 pm, Ryan Long wrote:
 -----Original Message-----
> From: Chris Johns <chrisj at rtems.org> 
> Sent: Friday, October 8, 2021 6:44 PM
> To: Ryan Long <ryan.long at oarcorp.com>; devel at rtems.org
> Subject: Re: [PATCH] rtems-kernel: Implement kernel recipe using waf
> 
> Hi Ryan,
> 
> Thank you for taking this on.
> 
> I would like see one addition, a user supplied config.ini file that bypasses any generated config file. The config needs to match the tool chain being built and waf will need to complain if it does not but that is not a problem for the RSB to manage.
> [Ryan Long] So this should be done in a separate patchset?

This patch is fine. I suggest using `--with-rtems-bsp-config=` to the RSB.

> 
> On 9/10/21 2:03 am, Ryan Long wrote:
>> 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
>> +}
> 
> Please use the rtems.org repo.
> 
>> +
>> +%hash sha512 rtems-kernel-%{rtems_kernel_version}.tar.gz \
>> +              
>> +m/ogwrJj4X60ewDIbV6WRj1MJa/22gQHQd56XiNMfvCr0nsvcXdkXKAObLIGYIGYfUyEw
>> +lVk3SRjjRFkFalDGQ==
>>  #
>>  # 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
>> -
>>  %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}
> 
> Please raise an error. Users will need to change their set up.
> 
>> - %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}
> 
> I think raise an error.
> 
>> -%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
> 
> ?
> [Ryan Long] This got left in by accident.
> 
>> +    ./waf distclean
> 
> I am not sure this works by itself when you use --out with configure?
> 
> This could be ...
> 
>   ./waf distclean configure ....
> 
>>    %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} \
> 
> Why change the build directory?
> [Ryan Long] I think this was in Joel's build_bsp script. I was using it for reference. Do I not need this option?

I would remove it. Lets not move away from the default behaviour of waf.

> 
>> +    %{rtems_bspopts} \
> 
> Does this work?
> [Ryan Long] I don't know if the options I used during testing used this. I'll check.

I do not think it works so lets remove this.

> 
>> +    --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 -
> 
> Why the change?
> [Ryan Long] I wasn't sure if cd-ing to the parent directory would be correct since the user could have their RTEMS source directory somewhere else. I figured doing "cd -" would just guarantee we get back to where we were.

Sure. I would check the script the RSB creates if you are not sure. I suggest we
leave it as it is. I do not think it is a big issue.

Chris


More information about the devel mailing list