Debian Wheezy Linux-Rt Compile LinuxCNCThe 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.
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.
You will be able to run LinuxCNC in simulator mode, with lousy latency numbers
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.gzBecome root
sudo suExtract 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.gzUpdate 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+ zImageEdit 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
sudo aptitude install git-core gitk git-gui sudo aptitude install build-essential autoconf
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
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.tmpTo 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
sudo aptitude install build-essentialYou 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
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-plaatform=beaglebone make sudo make setuid
. scripts/rip-environment latency-test linuxcncNote: I built on a virtual host and have not yet had a chance to test on a real host.
| Max Interval (1.0 ms thread) | Max Jitter(ns) 1.0 ms thread | Max Interval (25 us thread) | Max Jitter (25 us thread) | ||||||||
| Motherboard | CPU | Other hardware comments | preempt_rt | rtai | preempt_rt | rtai | preempt_rt | rtai | preempt_rt | rtai | Test Duration |
| Shuttle SG31G2 | Core-2 Q6600 Quad-Core | 4G RAM, Integrated G31 GPU | 1015734 | 1442628 | 15734 | 442708 | 47646 | 52697 | 22646 | 27699 | A few minutes |
| Shuttle SG31G2 | Core-2 Q6600 Quad-Core | 4G RAM, Integrated G31 GPU, C1E Disabled | 1022148 | 1003079 | 22148 | 3159 | 45413 | 29937 | 20413 | 5133 | A few minutes |
| Shuttle SG31G2 | Core-2 Q6600 Quad-Core | 4G RAM, Integrated G31 GPU, C1E Disabled | 1019702 | ? | 19702 | ? | 47313 | ? | 22313 | ? | 24 Hours |
| Intel DQ67O | i7-2600 | 8G RAM, Integrated GPU, HT and C states disabled | 1017248 | 1007215 | 17282 | 8815 | 44870 | 33985 | 19870 | 9025 | A few minutes |