# --- T2-COPYRIGHT-NOTE-BEGIN --- # T2 SDE: package/*/rtai/pkg_linux_post.conf # Copyright (C) 2007 - 2023 The T2 SDE Project # # This Copyright note is generated by scripts/Create-CopyPatch, # more information can be found in the files COPYING and README. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2. # --- T2-COPYRIGHT-NOTE-END --- # TODO: # patch procedure should be more flexible to support different architectures # and kernel versions # This function extracts RTAI and patches Linux kernel # TODO: patch can be optimised to extract only the needed patch files # and not the whole RTAI package patch_linux() { echo '------------------------------------' echo 'Applying RTAI patch' echo $(pwd) echo '------------------------------------' tar $taropt `match_source_file -p rtai rtai` -C ../ # TODO: Need to figure out the way to make RTAI patching automatically # Applying Linux patch patch -p1 < ../rtai-3.6/base/arch/i386/patches/hal-linux-2.6.23-i386-1.12-00.patch } cp_linux_sources() { if [ $SDECFG_PKG_LINUX_KEEP_BUILDSRC = 1 ]; then echo "Copying compiled kernel with source ..." rm -rf $root/usr/src/linux-${lx_kernelrelease}-build mkdir -p $root/usr/src/linux-${lx_kernelrelease}-build cp -ar . $root/usr/src/linux-${lx_kernelrelease}-build } make_rtai() { echo '--------------------------------------------' echo 'Entering make_rtai function from rtai package' echo '--------------------------------------------' #TODO: remove hardlinks pushd ../rtai-3.6 cp $base/package/*/rtai/.rtai_config ./.rtai_config var_append instopt ' ' "DESTDIR=$root/" prefix="/$prefix/realtime/" # Do I really need to specify options myself? # Maybe T2 could handle it automatically?! #DK confopt="" # var_append confopt ' ' "--datadir=$root" # var_append confopt ' ' "--prefix=$root/$prefix/realtime" # var_append confopt ' ' "--prefix=/$prefix/realtime" # var_append confopt ' ' "--with-rtai-dir=$root/usr/include" var_append confopt ' ' "--with-linux-dir=$kerneldir" #DK var_append confopt ' ' "--build=$arch_build" #DK var_append confopt ' ' "--host=$arch_target" eval_config_command $confopt eval $MAKE eval $MAKE DESTDIR=$root install # eval $MAKE install popd # Let's set RTAI path so that we can run comedi scripts out of the box echo '$PATH="/usr/realtime/bin:$PATH"' > $root/etc/profile.d/rtai } # TODO: # The function below should only be enabled when comedi-driver package selected # to be compiled with RTAI support make_rtai_with_comedi() { echo '--------------------------------------------' echo 'Entering make_rtai_with_comedi function' echo '--------------------------------------------' #TODO: remove hardlink pushd ../rtai-3.6 # Now rtai_config will be copied to the RTAI source dir from T2 "rtai" target cp $base/package/*/rtai/.rtai_config_comedi ./.rtai_config # Do I really need to specify options myself? # Maybe T2 could handle it automatically?! #DK confopt="" # var_append confopt ' ' "--prefix=/$prefix/realtime" var_append confopt ' ' "--prefix=/$prefix/realtime" var_append confopt ' ' "--with-linux-dir=$kerneldir" # var_append confopt ' ' "--with-module-dir=$root/lib/modules/" var_append confopt ' ' "--build=$arch_build" var_append confopt ' ' "--host=$arch_target" var_append confopt ' ' "--enable-comedi-lxrt" #DK var_append confopt ' ' "--with-comedi=/$prefix" #DK var_append confopt ' ' "--with-comedi=$root/usr" eval_config_command $confopt eval $MAKE # eval $MAKE install DESTDIR=$root eval $MAKE install popd } # patch Linux with RTAI patch. hook_add postpatch 1 patch_linux #hook_add inmake 2 cp_linux_sources # This function is substituted by rtai.conf. #hook_add postmake 2 make_rtai # This function will be substituted with rtai_post.conf function #hook_add postmake 4 make_rtai_with_comedi