Compiling full LinuxCNC to get realtime components for use with PathPilot 2

More
28 Apr 2018 07:39 #109745 by Stigoe
Since it seems several people are trying to add some of the missing realtime components to PathPilot and haven't been able to replicate what I did and described in another post, I figured I'd create this how-to and include code and screendumps along the way.

Disclaimer: This worked for me. If it doesn't for you, I take no responsibility if it screws up you PathPilot install, kill your house or burn down your cat. You break it, you fix it... :-)

This was done on a Win7 x64 and Oracle VirtualBox, but the type of host-machine shouldn't really matter as it is the VirtualBox running the virtual machine. If you have an unused pc, you could use that. Or you can try doing this on your PathPilot machine, but I didn't want to risk my PP install by doing the compiling on that.

Preparations

First I created a virtual machine, with a fixed drive of 32GB and told VB that it would be a 64-bit linux.
Then I downloaded Linux Mint 17.3 from linuxmint.com and selected Download - All versions - 17.3 - Mate (64-bit).
From what I have read, PP is based on LCNC 2.7.8 pre, so I chose to get LCNC 2.7.8 and this can be had from linuxcnc.org/dists/wheezy/2.7-uspace/source/
PP is using kernel 4.11.9-rt7 x86_64 PREEMPT, so go and fetch kernel 4.11.9 and patch 4.11.9-rt7 from kernel.org ( mirrors.edge.kernel.org/pub/linux/kernel.../linux-4.11.9.tar.gz and mirrors.edge.kernel.org/pub/linux/kernel...-4.11.9-rt7.patch.gz ), or you could wait until Linux Mint is up and running and just download them in the virtual machine.

First put the Linux Mint .iso in the virtual CD-drive and start up your virtual machine. When Linux Mint is up in it's live version, install Linux Mint and reboot when it's finished installing. After rebooting, install Guest Additions in the virtual machine so that you have access to shared folders and can connect USB-sticks to the virtual machine. When this is done, you may have to reboot the machine before the guest additions will work. When it's done, create a shared folder and put your LCNC and kernel files in this shared folder, or you could just use a USB-stick to transfer the files.

Preparing the kernel

Copy the 3 files to your home directory and chown the 2 kernel files (obviously, replace stig with your login username)
sudo chown stig:stig linux-4.11.9
sudo chown stig:stig patch-4.11.9-rt7.patch.gz

Next unpack the files, copy the patch-file into the Linux kernel directory, cd into Linux-4.11.9 and apply patch
gunzip linux-4.11.9.tar.gz
gunzip patch-4.11.9-rt7.patch.gz
tar -xf linux-4.11.9.tar
cp patch-4.11.9-rt7.patch linux-4.11.9
cd linux-4.11.9
cat patch-4.11.9-rt7.patch | patch -p1

Start Package Manager, go to Settings - Repositories and Enable source code repositories. Close Package Manager.

We will have to install quite a lot of packages to be able to compile the kernel and LCNC, so let's install some of them.
sudo add-apt-repository 'deb http://mirrors.kernel.org/ubuntu precise main universe'
sudo apt-get update
sudo apt-get install libgnomeprintui2.2-dev python-support tcl8.4-dev tk8.4-dev libtk-img-dev libssl-dev dpkg-dev libncurses5-dev

Next, let's configure the kernel.
make menuconfig

Attachment not found



Make sure 64-bit kernel is checked
Select Processor type and features-->Preemption Model---> Fully Preemptible Kernel (RT)-->back to top menu
Select Power management and ACPI option ---> disable suspend to RAM, Hybernation and CPU frequency scaling --> back to top menu
Select Memory Debugging (found under Kernel hacking)--> Check for stack overflows ( already deselect so dont select this -just check)
Save and exit

Unless you really want it, you don't need a kernel built with debug options. This takes a lot longer time and space to build and you need more than a 32 GB drive to complete it.
So to turn off debug kernel,
scripts/config --disable DEBUG_INFO

Next comes the compile of the kernel. This takes quite some time, and if you have several processors available, you can speed up the process by specifying -j<number of processors> after the make command, but since I'm running in a VM with only one processor I just drop the j-option.
make
sudo make modules_install
sudo make install

You may get some errors about ndiswrapper and no support for locate en_US.utf8, but this is nothing to worry about.

After the kernel is installed check that it is in /boot

Attachment not found



Reboot to enable the new kernel. After it has restarted, run "uname -a" to check that you are running the new kernel.

Attachment not found



Compiling LinuxCNC...

Go into build/debian and run "sudo ,/configure uspace" before going back up one step to check for dependencies. bwidget and tclx will not show as dependency, but configure will fail unless they are also installed.
cd build/debian
sudo ./configure uspace
cd ..
dpkg-checkbuilddeps
sudo apt-get install build-essential:native debhelper libudev-dev dvipng texlive-extra-utils texlive-latex-recommended texlive-fonts-recommended imagemagick texlive-font-utils tcl8.6-dev tk8.6-dev libxaw7-dev libreadline-gplv2-dev asciidoc source-highlight dblatex groff python-dev python-tk libglu1-mesa-dev libgl1-mesa-dev libboost-python-dev texlive-lang-cyrillic texlive-lang-french texlive-lang-spanish texlive-lang-german libmodbus-dev libusb-1.0-0-dev graphviz inkscape bwidget tclx
When these are all installed, go into the src-directory and run configure and compile LCNC.
cd src
sudo ./autogen.sh
sudo ./config --with-realtime=uspace
sudo make clean
sudo make

This will also compile all included realtime components.

Next depends on what you want, whether you want just your missing realtime components or if you want the whole installation copied to your PP install. If you want only the missing components, copy them to a USB-stick or some other means to transfer them over and copy them into ~/tmc/rtlib on your PP machine. If you do this, you will have to chown the files to operator:operator.

If you want the whole installation, cd out of build directory, pack up the whole directory and copy it over to your PP machine, where you unpack it to ~/repos/tormach_linuxcnc/ before you rename the build folder to linuxcnc.
# you should be in the build folder now
cd ..
tar -cf lcnc.tar build/
# copy lcnc.tar over to your PP install
# when you have copied it over to ~/repos/tormach_linuxcnc
tar -xf lcnc.tar
mv build linuxcnc

That's all there is to it.
The following user(s) said Thank You: andypugh, tivoi, dinkata

Please Log in or Create an account to join the conversation.

More
02 May 2018 21:04 #110052 by andypugh
I wonder where the attachments went to?

Please Log in or Create an account to join the conversation.

More
03 May 2018 05:33 - 06 May 2018 07:34 #110090 by Stigoe
Glitch in the forum software? Seems I can't edit the post any more so I can't re-upload them either, other than in a new post.

Edit: Here are the attachments from the first post.
make menuconfig


Check that the kernel is installed


After rebooting, check that you are running the new kernel
Attachments:
Last edit: 06 May 2018 07:34 by Stigoe. Reason: Adding attachments again.
The following user(s) said Thank You: rafferty

Please Log in or Create an account to join the conversation.

More
13 May 2018 12:08 #110666 by rafferty
Just finished the rtlib build using VMware on Mac OS X.

Minor problem was missing autoconf which prevented the sudo ./autogen.sh line running, a quick apt get fixed that.

I'm slowly moving to PP2 but want to look further into the works before going all the way.

Thanks for doing all the hard work.

Please Log in or Create an account to join the conversation.

More
03 Dec 2019 21:44 #151900 by davidimurray
I've followed the instructions above and I now have a full compiled version of linuxcnc 2.7.

I am running Pathpilot 2.2.4 and having checked - i see this version is running Linuxcnc 2.8.0-pre1. How do I go about upgrading the version I have to 2.8. I've tried following the instructions here - buildbot.linuxcnc.org/ but i keep getting error messages.

Any help much appreciated.

Please Log in or Create an account to join the conversation.

More
03 Dec 2019 22:14 #151908 by andypugh
The method of getting the LinuxCNC source mentioned above gets you 2.7.

A much better way (that will allow you to compile any version of linuxCNC, including various experimental versions) can be found here:

linuxcnc.org/docs/master/html/code/building-linuxcnc.html

Please Log in or Create an account to join the conversation.

More
04 Dec 2019 13:57 #151992 by davidimurray
Thanks Andy - I will have a run through and see if I can install on to a virtual machine.

This is going to sound like a stupid question .... but as I want to recreate the pathpilot install - I will need to install Linuxcnc 2.8.0-pre1. Where can I find the correct link to get that specific version. I can see 2.8 on the git but not sure how to link to it.

Thanks

Dave

Please Log in or Create an account to join the conversation.

More
04 Dec 2019 16:08 #152004 by andypugh
git checkout <version> basically.

Is Pathpilot _really_ based on an unreleased 2.8 version?

git checkout 2.8

Would get the current 2.8. But it is possible that the 2.8_pre that you used won't have an equivalent in the LinuxCNC repository.

but if it does, I think you can checkout the exact version based on the hash. Do you see a string of hex after the version when LinuxCNC starts?

Please Log in or Create an account to join the conversation.

More
04 Dec 2019 16:27 #152006 by davidimurray
Please see below the screenshots from the log files at startup.

I originally had a parallel port configuration working under PP2.0 and when I upgraded to PP2.2.4 it stopped working - I had to make a number of hal/ini changes to get it working which in hindsight seems consistent with a version change. I've yet to be brave enough to upgrade to 2.3.6 ;)

Cheers

Dave
Attachments:

Please Log in or Create an account to join the conversation.

More
04 Dec 2019 17:01 #152008 by smgvbest
Hi,
I pulled 2.8.0-pre1 some time back
if you can't find it here it is from my google drive
2.8.0-pre1

the way I did this was install PP V2 into a virtual machine.
I loaded both PP 2.0.5 source and 2.8.0-pre1 source
installed need dependencies then compiled 2.8.0-pre1, do not install it only compile it from the operator id,
i was then able to pull any libs I needed

compiling pp 2.0.5 from source was fun as the list of prereq was larger as they are not included in the source

hope the 2.8.0-pre1 source helps

Please Log in or Create an account to join the conversation.

Moderators: cncbasher
Time to create page: 0.210 seconds
Powered by Kunena Forum