[Home]Debian Wheezy Linux-Rt Compile LinuxCNC

LinuxCNCKnowledgeBase | RecentChanges | PageIndex | Preferences | LinuxCNC.org

Revision 12 not available (showing current revision instead)
1. Install Debian Wheezy
1.1. x86/amd64 Install
1.2. BeagleBone ARM Install
1.2.1. Install Debian
1.2.2. Install a real-time kernel
1.2.2.1. Standard kernel (non-real-time)
1.2.2.2. Xenomai real-time kernel
1.2.2.3. PREEMPT_RT real-time kernel
2. Prepare LinuxCNC Source
2.1. Get some needed tools
2.2. Grab LinuxCNC source code from git
3. Build LinuxCNC
3.1. Gcc Version WARNING!
3.2. Setup Build Dependencies
3.3. Configure & Make
4. Run LinuxCNC
5. Hardware Performance

The following has been annotated in italics 20120830/20120902 to reflect the experience of a 3rd-party (a different 'I' from the 'I' in the main text) trying to replicate the results. As well, some light editing has been done. I chose to do it this way because I consider this page to be in flux still.

Note to Ubuntu users: It's easy (don't ask me how I know) to install a Debian system with a root user who can log in directly and no other users added to the sudo'ers list. You'll have to add yourself to the sudo'ers list before you can execute some of the following.

1. Install Debian Wheezy

1.1. x86/amd64 Install

Note 1. I missed the opportunity to choose a realtime kernel during installation and a clunky 486-compatible kernel was installed for me. Not to worry, after rebooting at the end of the installation, I ran the Add/Remove Software app to install a meta package for the desired kernel.

Note 2. On this date, 20120830, two Linux-RT kernels are available: 3.2.0-3-rt-amd64 and 3.2.0-3-rt-686-pae. I wanted a 32-bit kernel so I installed the linux-image-rt-686-pae-3.2+45 (32-bit) meta-package and rebooted.

1.2. BeagleBone ARM Install

1.2.1. Install Debian

1.2.2. Install a real-time kernel

1.2.2.1. Standard kernel (non-real-time)
Carry on with the current current non-real-time kernel

You will be able to run LinuxCNC in simulator mode, with lousy latency numbers

1.2.2.2. Xenomai real-time kernel
Download Michael Haberler's Xenomai kernel and boot loader for the BeagleBone:
 http://static.mah.priv.at/public/beaglebone/linux-3.2.21-xenomai+.tar.gz
 http://static.mah.priv.at/public/beaglebone/linux-headers-3.2.21-xenomai+.tar.gz
 http://static.mah.priv.at/public/beaglebone/bootpart.tar.gz
Become root
 sudo su
Extract the kernel files:
 cd /
 tar -xzvf /path/to/linux-3.2.21-xenomai+.tar.gz
 cd /usr/src/
 tar -zxvf /path/to/linux-headers-3.2.21-xenomai+.tar.gz
Update the kernel image on the boot partition:
 cd /boot/uboot
 mv zImage zImage.orig
 mv initrd.img initrd.img.orig
 cp ../vmlinuz-3.2.21-xenomai+ zImage
Edit the uEnv.txt file to not load an initial ramdisk
 Change the line that reads
 xyz_mmcboot=run xyz_load_image; run xyz_load_initrd; echo Booting from mmc ...
 to read:
 xyz_mmcboot=run xyz_load_image; echo Booting from mmc ...
WARNING! If you do not replace the boot loader, your BeagleBone will likely boot running at 520 MHz and you will NOT be able to increase the speed to 720 MHz as Michael's xenomai kernel is not built with support for changing the frequency at runtime. Michael's boot loader will set the frequency to 720 MHz, requiring you run off a real power supply (if you run off USB power, you will experience random shutdowns)
 cd /tmp
 tar -xzvf /path/to/bootpart.tar.gz
 cp MLO /boot/uboot/
 cp u-boot.img /boot/uboot/
Do NOT copy the uEnv.txt file unless you intend to boot off the network!

Reboot, and verify you are running the Xenomai kernel at full speed

 $ uname -a
 Linux arm 3.2.21-xenomai+ #3 PREEMPT ...
 $ grep MIPS /proc/cpuinfo
 BogoMIPS?        : 718.02

1.2.2.3. PREEMPT_RT real-time kernel
Please e-mail the developer list if you have a working PREEMPT_RT kernel for the BeagleBone!

2. Prepare LinuxCNC Source

2.1. Get some needed tools

 sudo aptitude install git-core gitk git-gui
 sudo aptitude install build-essential autoconf

2.2. Grab LinuxCNC source code from git

For background, refer to http://wiki.linuxcnc.org/cgi-bin/wiki.pl?Installing_LinuxCNC#Getting_the_source_with_git

WARNING: Development of alternate RTOS support for LinuxCNC is currently proceeding at a fairly rapid pace. Check the developer list and browse the git repository for the latest locations and branch name(s) for the unified RTOS codebase (rtos-integration-preview3 as of Jan. 23, 2013).

Assuming you've already installed the git program as described above:

 git clone git://git.mah.priv.at/emc2-dev.git linuxcnc-dev
 cd linuxcnc-dev
 # Pick one of the following
 git checkout --track origin/rtos-integration-preview3                     # Based on LinuxCNC 2.5
 git checkout --track origin/rtos-integration-preview3-merged-into-master  # Based on LinuxCNC master
 git checkout --track origin/arm335x-hal-pru-module                        # For BeagleBone

3. Build LinuxCNC

3.1. Gcc Version WARNING!

With the latest Debian Wheezy, all x86 LinuxCNC builds failed using the default gcc-4.7, throwing errors like the following:
 Linking ../rtlib/abs.so
 ld -r -o objects/abs.tmp objects/rtobjects/hal/components/abs.o
 gcc -shared -Bsymbolic -L/home/maker/linuxcnc-dev.head/lib -Wl,-rpath,/home/maker/linuxcnc-dev.head/lib -o ../rtlib/abs.so objects/abs.tmp -lm
 `__x86.get_pc_thunk.bx' referenced in section `.text' of objects/abs.tmp: defined in discarded section `.text.__x86.get_pc_thunk.bx[__x86.get_pc_thunk.bx]' of objects/abs.tmp
To get a working build (even of unmodified LinuxCNC code) I needed to revert back to gcc-4.6:
 sudo aptitude install gcc-4.6 gcc-4.6-base
 export CC=gcc-4.6
(Edit 2013 May 7th : Gcc-4.6 was already installed on my system, and compiling ran fine without having to type "export CC=gcc-4.6")

For the ARM, gcc is still at 4.6, so no adjustments are required

3.2. Setup Build Dependencies

Make sure you have the build-essential packages installed
 sudo aptitude install build-essential
You should be in your working-copy directory at this point. Note that the configure step below will complain about not finding a supported kernel (the packaging files are still looking for an RTAI patched kernel), but since we're building to run in place and are not trying to build a .deb package, that's OK for now.
 debian/configure -r
 dpkg-checkbuilddeps
 sudo aptitude install <missing builddep packages except for rtai>

For me, this worked on my x86 system:

 sudo aptitude install debhelper linux-headers-rt-amd64 dvipng tcl8.5-dev tk8.5-dev bwidget blt libxaw7-dev libncurses-dev libreadline-dev asciidoc source-highlight dblatex xsltproc groff python-dev python-tk python-lxml libglu1-mesa-dev libgl1-mesa-dev libgtk2.0-dev libgnomeprintui2.2-dev gettext libboost-python-dev texlive-lang-cyrillic

3.3. Configure & Make

For PREEMPT_RT:
 cd src
 ./autogen.sh
 ./configure --with-threads=rt-preempt-user
 make
 sudo make setuid

For Xenomai + BeagleBone:

 cd src
 ./autogen.sh
 ./configure --with-threads=xenomai-user --with-platform=beaglebone
 make
 sudo make setuid

4. Run LinuxCNC

 . scripts/rip-environment
 latency-test
 linuxcnc
Note: I built on a virtual host and have not yet had a chance to test on a real host.

5. Hardware Performance

Please report your results (with RTAI numbers from the same platform, if available)!
 Max Interval (1.0 ms thread)Max Jitter(ns) 1.0 ms threadMax Interval (25 us thread)Max Jitter (25 us thread)
MotherboardCPUOther hardware commentspreempt_rtrtaipreempt_rtrtaipreempt_rtrtaipreempt_rtrtaiTest Duration
Shuttle SG31G2Core-2 Q6600 Quad-Core4G RAM, Integrated G31 GPU101573414426281573444270847646526972264627699A few minutes
Shuttle SG31G2Core-2 Q6600 Quad-Core4G RAM, Integrated G31 GPU, C1E Disabled102214810030792214831594541329937204135133A few minutes
Shuttle SG31G2Core-2 Q6600 Quad-Core4G RAM, Integrated G31 GPU, C1E Disabled1019702?19702?47313?22313?24 Hours
Intel DQ67Oi7-26008G RAM, Integrated GPU, HT and C states disabled101724810072151728288154487033985198709025A few minutes

LinuxCNCKnowledgeBase | RecentChanges | PageIndex | Preferences | LinuxCNC.org
This page is read-only. Follow the BasicSteps to edit pages. | View other revisions
Last edited February 1, 2014 11:54 pm by Elovalvo (diff)
Search:
Published under a Creative Commons License