GentooPreemtrt - rmu75/linuxcnc-wiki GitHub Wiki


date: '2022-08-14T04:04:23' title: GentooPreemtrt

New 2.9 Master ebuild user space

August, 2022

https://github.com/NTULINUX/ntu_overlay/tree/main/sci-electronics/linuxcnc

  1. TODO:
  2. Fix documentation install directory (upstream bug?)
  3. Add CNC category to graphical menu drop-down
  4. Implement USE flags
  5. Check for PREEMPT_RT
  6. Maybe RTAI at some point
Disclaimer:
This worked for me and there are surely things to improve. None of the other ways I found on the web and in this wiki worked anymore with a recent Gentoo distribution since I tried in 2016. So I made this stuff now - December 2017 on a Thinkpad T43p (2GHz, 1GB RAM, Parport, ATI, 1600x1200). If you are not familiar with Gentoo you better take the standart Ubuntu based distribution. There you can remove the blinky stuff too and get it run with 256MB RAM. (I've done that but had to recompile kernel, rtai and emc as they where not compatible to my P III CPU as they where built for machines with lapic(s) and I only had a apic - so my hope to just drop in Ubuntu based LinuxCNC CD and use it was dissappointed and my hate to Ubuntu grew stronger. Well I guess LinuxCNC not running on pre SMP Processors should be fixed.)

As the performance differences between preemptrt, rtai and xenomai are small and the preemptrt kernel is easy to build I used this way.

Contents

toc

1. Emerge preemptrt sources

you can skip this and the following step if you just want to simulate machining on your Gentoo system

 emerge -av sys-kernel/rt-sources

2. Build the PreempRT kernel

cd to the directory where the rt-sources got installed /usr/src/linux-[versionnumber]-rt[revision], e.g.

 cd /usr/src/linux-4.13.13-rt5

copy .config of a working kernel to this directory

 cp ../linux/.config .

then

 make oldconfig

answer the stuff and enable all the things needed for realtime make sure your .config contains

CONFIG_PREEMPT=y
CONFIG_PREEMPT_RT_BASE=y
CONFIG_PREEMPT_RT_FULL=y
CONFIG_HIGH_RES_TIMERS=y

build the kernel

 make all

install the modules

 make modules_install

copy the bzImage to /boot and make grub or whatever you use find it

reboot the new kernel and make sure it works

update the link to the kernel source where linux-4.13.13-rt5 has to be set according to the Version you use e.g. cd /usr/src && rm linux && ln -s linux-4.13.13-rt5 linux

3. Emerge LinuxCNC

Download upload:linuxcnc-ebuilds-2.7.11.tar.xz

cd to /usr/local and untar the Download there

 cd /usr/local && tar Jxvf /PATH/TO/THE/DOWNLOAD/linuxcnc-ebuilds-2.7.11.tar.xz

make sure your make.conf contains a line like

 PORTDIR_OVERLAY="/usr/local/portage"

if you need modbus (If you don't know what it is, you don't need it.) for your machine add the useflag to linuxcnc e.g. add the following line to /usr/portage/package.use or a file in /usr/portage/package.use/ sci-misc/linuxcnc modbus

add the following line to your /etc/portage/make.conf You should remove this line when you are done. Anyways I couldn't find a way to get the ebuild preventing portage from bzip2ing the minimal sample files and this is a problem as the linuxcncgui is making heavy use of them and can't read them when they are zipped.

PORTAGE_COMPRESS=""

unmask sci-misc/linuxcnc and depencies and emerge emerge -av sci-misc/linuxcnc

if you forgot to unmask something the latter command will ask you to do this automatic. You can let it do that. It will not write the changes to the real files yet. You can use etc-update interactive to make those changes real. Be carefull, with this tool. Be patient and don't mix commands with - with numbers e.g. -1 is not the same as 1 !

read the messages I've put in the ebuild.

when you're done remember the make.conf line

good luck

4. TODO

get rid of the make.conf line change useflag for installing the whole documentation

5. More resources

I knew the stuff when I wrote this manual here and the ebuilds. It's mostly obsolete for use but maybe helpfull for improve the ebuild. EmcOnGentoo https://sourceforge.net/projects/gentoocnc/ http://gpo.zugaina.org/Overlays/booboo/sci-electronics/linuxcnc https://dallasmakerspace.org/wiki/User:Peter242/Gentoo_for_LinuxCNC The zugaina link gave me preview to linuxcnc 2.8_pre I don't remember what it was but somehow it didn't work on my machine when I tried it, but looks interesting.

6. Contact to the author of this manual

If you have any suggestions, questions or improvements you can reach me via my mail form: http://reiseradgabel.de/english/mail (This gives me less spam as putting my email address here.) Please keep in mind that generic LinuxCNC questions are better addressed somewhere else.

⚠️ **GitHub.com Fallback** ⚠️