I SHOULD MAKE CLEAR THIS IS NOT COMPLETE AND WILL TAKE MONTHS MORE WORK TO ACUALLY DRIVE SOME MOTORS!!!!
But anyone interested in compiling linuxcnc in simulator mode should start here and then work towards the other components required for a real time compilation..........
I should start by saying real time linuxcnc on RPI has 3 possible routes and as far as I can see the easier they are to implement the worse the possible real time performance....
List of realtime linuxcnc implementations in order of my guess about how simple they are to implement:
1) RT_PREEMPT linux kernel patches (supported in the next version of linuxcnc and the route that I am following
2) Xenomai. ipipe patches (not directly supported by linuxcnc but a ARM version has been compiled called miniemc2)
3) RTAI kernel (linuxcnc preferential real time support but only ever used on x86 systems)
I think there are quite a few problems to sort out in the RPI kernel tree before its worth hacking at real time support so I am not going to attempt it (In hope that someone that actually knows this stuff will do this work).
I have only really done some very simple work and made a simple script for others to compile the linuxcnc simulator system on RPI.
At present I am looking at creating some IO drivers for hal interfacing with RPI GPIO.
Really I have not done much but hope others will be encouraged to look at getting the real time version compiled.
Below are some links to other relevant forum posts:
http://www.raspberrypi.org/phpBB3/viewt ... =63&t=2376
http://www.raspberrypi.org/phpBB3/viewt ... =24&t=1847
http://www.raspberrypi.org/phpBB3/viewt ... =63&t=9490
I was going to attach the shell script but it seems this file is not allowed

You will have to copy paste the code below and run it as a shellscript
instructions....
Make sure you have a recent version of raspbian and a network connection to upgrade it, best not compile this while running X, make sure you have a swap partition of at least 500mb (sudo swapon /dev/sda1).
save script below as 'linuxcnc.sh'
at prompt type 'chmod a+x linuxcnc.sh'
type './linuxcnc.sh'
once the compile shows success startx
open a terminal and type 'cd linuxcnc/linuxcnc-buesch-rt ; . scripts/rip-environment ; scripts/linuxcnc'
You should have linuxcnc running on X in simulator mode.
Code: Select all
#!/bin/sh
echo "script to compile linuxcnc in sim mode for raspbian"
echo "this will take a very very very long time, please wait 5 hours then comeback"
sudo apt-get update
sudo apt-get -f -y --force-yes install adduser alsa-base alsa-utils apt apt-utils aptitude aptitude-common asciidoc aspell aspell-en autoconf automake autopoint autotools-dev base-files
sudo apt-get -f -y --force-yes install base-passwd bash bash-completion binutils blt bsdmainutils bsdutils build-essential bwidget bzip2 ca-certificates cifs-utils console-setup console-setup-linux consolekit coreutils cpio cpp cpp-4.6 cron cryptsetup-bin curl dash dblatex dbus dbus-x11 dconf-gsettings-backend dconf-service debconf debconf-i18n debconf-utils debhelper debian-reference-common debian-reference-en debianutils desktop-base desktop-file-utils dictionaries-common diffutils dillo dmsetup docbook docbook-dsssl docbook-utils docbook-xml docbook-xsl dosfstools dphys-swapfile dpkg dpkg-dev dvipng e2fslibs e2fsprogs ed eject esound-common fake-hwclock fakeroot fbset ffmpeg file findutils firmware-atheros firmware-brcm80211 firmware-libertas firmware-ralink firmware-realtek fontconfig fontconfig-config fonts-droid fonts-freefont-ttf freeglut3 freeglut3-dev fuse g++ g++-4.6 gcc gcc-4.4-base gcc-4.5-base gcc-4.6 gcc-4.6-base gcc-4.7-base gccxml gconf-service gconf2 gconf2-common gdb gdbserver gegl
sudo apt-get -f -y --force-yes install gettext gettext-base ghostscript gir1.2-atk-1.0 gir1.2-freedesktop gir1.2-gdkpixbuf-2.0 gir1.2-glib-2.0 gir1.2-gst-plugins-base-0.10 gir1.2-gstreamer-0.10 gir1.2-pango-1.0 git git-man gksu glib-networking glib-networking-common glib-networking-services gnome-icon-theme gnome-themes-standard gnupg gpgv gpicview grep groff groff-base gsettings-desktop-schemas gsfonts gtk2-engines gzip hardlink hdparm hicolor-icon-theme hostname html2text i2c-tools idle idle-python2.7 idle-python3.2 idle3 ifplugd ifupdown imagemagick imagemagick-common info initscripts insserv install-info intltool-debian iproute iptables iputils-ping isc-dhcp-client isc-dhcp-common iso-codes jadetex kbd keyboard-configuration kmod krb5-locales latex-beamer latex-xcolor leafpad less libaa1 libaacs0 libacl1 libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libamd2.2.0 libapt-inst1.5 libapt-pkg-dev libapt-pkg4.12 libart-2.0-2 libart-2.0-dev libasound2 libaspell15
sudo apt-get -f -y --force-yes install libasprintf0c2 libasyncns0 libatasmart4 libatk1.0-0 libatk1.0-data libatk1.0-dev libattr1 libaudiofile1 libaudit0 libav-tools libavahi-client3 libavahi-common-data libavahi-common3 libavcodec53 libavdevice53 libavfilter2 libavformat53 libavutil51 libbabl-0.1-0 libblas3 libblas3gf libblkid1 libbluray1 libboost-iostreams1.46.1 libboost-iostreams1.48.0 libboost-iostreams1.49.0 libboost-iostreams1.50.0 libboost-python-dev libboost-python1.49-dev libboost-python1.49.0 libboost-regex1.49.0 libboost1.49-dev libbsd0 libbz2-1.0 libc-bin libc-dev-bin libc6 libc6-dev libcaca0 libcairo-gobject2 libcairo-script-interpreter2 libcairo2 libcairo2-dev libcap2 libcdio-cdda1 libcdio-paranoia1 libcdio13 libcdparanoia0 libck-connector0 libclass-isa-perl libcolord1 libcomerr2 libcroco3 libcryptsetup4 libcups2 libcupsimage2 libcurl3 libcurl3-gnutls libcwidget3 libdaemon0 libdatrie1 libdb5.1 libdbus-1-3 libdbus-1-dev libdbus-glib-1-2 libdc1394-22 libdca0 libdconf0
sudo apt-get -f -y --force-yes install libdevmapper-event1.02.1 libdevmapper1.02.1 libdirac-encoder0 libdirectfb-1.2-9 libdjvulibre-text libdjvulibre21 libdpkg-perl libdrm-nouveau1a libdrm-radeon1 libdrm2 libdvdnav4 libdvdread4 libedit2 libegl1-mesa libegl1-mesa-drivers libelf1 libenca0 libenchant1c2a libept-dev libept1.4.12 liberror-perl libesd0 libevent-2.0-5 libexiv2-12 libexpat1 libexpat1-dev libfaad2 libffi-dev libffi5 libfftw3-3 libfile-fcntllock-perl libflac8 libfltk1.3 libfm-data libfm-gtk-bin libfm-gtk1 libfm1 libfontconfig1 libfontconfig1-dev libfontenc1 libfreetype6 libfreetype6-dev libfribidi0 libfuse2 libgail-3-0
sudo apt-get -f -y --force-yes install libgail-common libgail-dev libgail18 libgbm1 libgcc1 libgconf-2-4 libgconf2-4 libgcrypt11 libgd2-noxpm libgdbm3 libgdk-pixbuf2.0-0 libgdk-pixbuf2.0-common libgdk-pixbuf2.0-dev libgegl-0.2-0 libgeoclue0 libgettextpo0 libgfortran3 libgif4 libgirepository-1.0-1 libgksu2-0 libgl1-mesa-dev libgl1-mesa-dri libgl1-mesa-glx libglade2-0 libglapi-mesa libglib2.0-0 libglib2.0-bin
sudo apt-get -f -y --force-yes install libglib2.0-data libglib2.0-dev libglu1-mesa libglu1-mesa-dev libgmp10 libgnome-keyring-common libgnome-keyring0 libgnomecanvas2-0 libgnomecanvas2-common libgnomecanvas2-dev libgnomecups1.0-1 libgnomeprint2.2-0 libgnomeprint2.2-data libgnomeprint2.2-dev libgnomeprintui2.2-0 libgnomeprintui2.2-common libgnomeprintui2.2-dev libgnutls26 libgomp1 libgpg-error0 libgpm2 libgraphite3 libgs9 libgs9-common libgsm1 libgssapi-krb5-2 libgssglue1 libgstreamer-plugins-base0.10-0 libgstreamer-plugins-base0.10-dev libgstreamer0.10-0 libgstreamer0.10-dev libgtk-3-0 libgtk-3-bin libgtk-3-common libgtk2.0-0 libgtk2.0-common libgtk2.0-dev libgtop2-7 libgtop2-common libgudev-1.0-0 libhunspell-1.3-0 libice-dev libice6 libicu-dev libicu48 libid3tag0 libident libidn11 libijs-0.35 libilmbase6 libimlib2 libiw30 libjack-jackd2-0 libjasper1 libjavascriptcoregtk-1.0-0 libjavascriptcoregtk-3.0-0 libjbig0 libjbig2dec0 libjpeg8 libjson0 libk5crypto3 libkeyutils1 libkmod2 libkpathsea6
sudo apt-get -f -y --force-yes install libkrb5-3 libkrb5support0 liblapack3 liblapack3gf liblcms1 liblcms2-2 libldap-2.4-2 liblensfun-data liblensfun0 liblightdm-gobject-1-0 liblircclient0 liblocale-gettext-perl liblqr-1-0 libltdl7 liblvm2app2.2 liblzma5 liblzo2-2 libmad0 libmagic1 libmagickcore5 libmagickcore5-extra libmagickwand5 libmail-sendmail-perl libmenu-cache1 libmikmod2 libmount1 libmp3lame0 libmpc2 libmpeg2-4 libmpfr4 libmtdev1 libncurses5 libncurses5-dev libncursesw5 libnetpbm10 libnewt0.52 libnfnetlink0 libnfsidmap2 libnl-3-200 libnl-genl-3-200 libnotify4 libnspr4 libnss3 libobrender27 libobt0 libogg0 libopenal-data libopenal1 libopenexr6 libopenjpeg2 libopenraw1 libopenvg1-mesa libopts25 liborc-0.4-0 libosp5 libostyle1c2 libp11-kit0 libpam-ck-connector libpam-modules libpam-modules-bin libpam-runtime libpam0g libpango1.0-0 libpango1.0-dev libpaper-utils libpaper1 libparted0debian1 libpci3 libpciaccess0 libpcre3 libpcre3-dev libpcrecpp0 libpcsclite1 libpipeline1 libpixman-1-0
sudo apt-get -f -y --force-yes install libpixman-1-dev libpng12-0 libpng12-dev libpolkit-agent-1-0 libpolkit-backend-1-0 libpolkit-gobject-1-0 libpoppler19 libpopt0 libportmidi0 libpostproc52 libprocps0 libproxy0 libptexenc1 libpth-dev libpth20 libpthread-stubs0 libpthread-stubs0-dev libpulse0 libpython2.7 libraspberrypi-bin libraspberrypi-dev libraspberrypi-doc libraspberrypi0 libraw1394-11 libreadline-dev libreadline6 libreadline6-dev librsvg2-2 librsvg2-common librtmp0 libruby1.9.1 libsamplerate0 libsasl2-2 libsasl2-modules libschroedinger-1.0-0 libsdl-image1.2 libsdl-mixer1.2 libsdl-ttf2.0-0 libsdl1.2debian
sudo apt-get -f -y --force-yes install libselinux1 libsemanage-common libsemanage1 libsepol1 libsgmls-perl libsgutils2-2 libsigc++-1.2-5c2 libsigc++-2.0-0c2a libslang2 libsm-dev libsm6 libsmbclient libsmpeg0 libsndfile1 libsoup2.4-1 libsource-highlight-common libsource-highlight4 libsp1c2 libspeex1 libspiro0 libsqlite3-0 libsqlite3-dev libss2 libssh2-1 libssl-dev libssl1.0.0 libstartup-notification0 libstdc++6 libstdc++6-4.6-dev libswitch-perl libswscale2 libsys-hostname-long-perl libsysfs2 libsystemd-login0 libtagcoll2-dev libtalloc2 libtasn1-3 libtdb1 libtext-charwidth-perl libtext-iconv-perl libtext-wrapi18n-perl libthai-data libthai0 libtheora0 libtiff4 libtimedate-perl libtinfo-dev libtinfo5 libtirpc1 libtogl-dev libtogl1 libts-0.0-0 libudev-dev libudev0 libumfpack5.4.0 libunique-1.0-0 libunistring0 libusb-0.1-4 libusb-1.0-0 libustr-1.0-1 libuuid1 libva-egl1 libva-x11-1 libva1 libvorbis0a libvorbisenc2 libvorbisfile3 libvpx1 libvte-common libvte9 libwayland-dev libwayland0 libwbclient0
sudo apt-get -f -y --force-yes install libwebkitgtk-1.0-0 libwebkitgtk-1.0-common libwebkitgtk-3.0-0 libwebkitgtk-3.0-common libwebp2 libwibble-dev libwmf0.2-7 libwnck-common libwnck22 libwrap0 libx11-6 libx11-data libx11-dev libx11-doc libx11-xcb1 libx264-123 libxapian-dev libxapian22 libxau-dev libxau6 libxaw7 libxaw7-dev libxcb-dri2-0 libxcb-glx0 libxcb-render0 libxcb-render0-dev libxcb-shape0 libxcb-shm0 libxcb-shm0-dev libxcb-util0 libxcb-xfixes0 libxcb1 libxcb1-dev libxcomposite-dev libxcomposite1 libxcursor-dev libxcursor1 libxdamage-dev libxdamage1 libxdmcp-dev libxdmcp6 libxext-dev libxext6 libxfixes-dev libxfixes3 libxfont1 libxft-dev libxft2 libxi-dev libxi6 libxinerama-dev libxinerama1 libxkbfile1 libxklavier16 libxml2 libxml2-dev libxml2-utils libxmu-dev libxmu-headers libxmu6 libxmuu1 libxpm-dev libxpm4 libxrandr-dev libxrandr2 libxrender-dev libxrender1 libxres1 libxslt1-dev libxslt1.1 libxss-dev libxss1 libxt-dev libxt6 libxtst6 libxv1 libxvidcore4 libxvmc1 libxxf86dga1 libxxf86vm1
sudo apt-get -f -y --force-yes install libyaml-0-2 lightdm lightdm-gtk-greeter linux-libc-dev linux-sound-base lmodern locales login logrotate lsb-base lsb-release lua5.1 luatex lxappearance lxde lxde-common lxde-core lxde-icon-theme lxinput lxmenu-data lxpanel lxpolkit lxrandr lxsession lxsession-edit lxshortcut lxtask lxterminal lynx lynx-cur m4 make man-db manpages mawk menu-xdg mesa-common-dev midori mime-support module-init-tools mount mplayer mtools multiarch-support mupdf nano ncdu ncurses-base ncurses-bin net-tools netbase netcat-openbsd netcat-traditional netpbm netsurf-common netsurf-gtk
sudo apt-get -f -y --force-yes install nfs-common ntfs-3g ntp obconf omxplayer openbox openjade openssh-blacklist openssh-blacklist-extra openssh-client openssh-server openssl parted passwd patch pciutils pcmanfm perl perl-base perl-modules pgf pkg-config po-debconf policykit-1 poppler-data powermgmt-base preview-latex-style procps prosper ps2eps psmisc psutils python python-apt python-apt-common python-cairo python-dev python-glade2 python-gobject-2 python-gobject-2-dev python-gtk2 python-gtk2-dev python-gtk2-doc python-imaging python-lxml python-minimal python-numpy python-pygame python-support python-tk python2.6 python2.6-minimal python2.7 python2.7-dev python2.7-minimal python3 python3-minimal python3-numpy python3-tk python3.2 python3.2-minimal raspberrypi-artwork raspberrypi-bootloader raspbian-archive-keyring raspi-config raspi-copies-and-fills readline-common rpcbind rsync rsyslog ruby ruby1.9.1 samba-common scratch sed sensible-utils sgml-base sgml-data sgmlspl shared-mime-info source-highlight
sudo apt-get -f -y --force-yes install sp squeak-plugins-scratch squeak-vm ssh strace sudo sysv-rc sysvinit sysvinit-utils tar tasksel tasksel-data tcl tcl-dev tcl8.4 tcl8.4-dev tcl8.5 tcl8.5-dev tcpd tex-common tex-gyre texlive texlive-base texlive-bibtex-extra texlive-binaries texlive-common texlive-doc-base texlive-extra-utils texlive-font-utils texlive-fonts-recommended texlive-fonts-recommended-doc texlive-generic-recommended texlive-latex-base texlive-latex-base-doc texlive-latex-extra texlive-latex-extra-doc texlive-latex-recommended texlive-latex-recommended-doc texlive-luatex texlive-math-extra texlive-pictures texlive-pictures-doc texlive-pstricks texlive-pstricks-doc tipa tk tk-dev tk8.4 tk8.4-dev tk8.5 tk8.5-dev togl-demos traceroute tsconf ttf-dejavu-core ttf-freefont ttf-marvosym tzdata ucf udev udisks ufraw-batch unzip usbutils util-linux vim-common vim-tiny wget whiptail wireless-tools wpasupplicant x11-common x11-utils x11-xkb-utils x11proto-composite-dev x11proto-core-dev
sudo apt-get -f -y --force-yes install x11proto-damage-dev x11proto-fixes-dev x11proto-input-dev x11proto-kb-dev x11proto-randr-dev x11proto-render-dev x11proto-scrnsaver-dev x11proto-xext-dev x11proto-xinerama-dev xarchiver xauth xdg-utils xfonts-encodings xfonts-utils xinit xkb-data xml-core xmlto xorg-sgml-doctools xserver-common xserver-xorg xserver-xorg-core xserver-xorg-input-all xserver-xorg-input-evdev xserver-xorg-input-synaptics xserver-xorg-video-ati xserver-xorg-video-fbdev xserver-xorg-video-mach64 xserver-xorg-video-r128 xserver-xorg-video-radeon xsltproc xtrans-dev xz-utils zenity zenity-common zip zlib1g zlib1g-dev
#sudo apt-get install debhelper libpth-dev dvipng tcl8.5-dev tk8.5-dev bwidget libxaw7-dev libncurses-dev libreadline-dev asciidoc source-highlight dblatex xsltproc groff python-dev python-lxml libglu1-mesa-dev libgl1-mesa-dev libgl1-mesa-swx11-dev libgtk2.0-dev libgnomeprintui2.2-dev gettext autoconf libboost-python-dev
if [ -d linuxcnc ]; then
echo "you seem to already have a linuxcnc directory and we dont want to overwrite it!"
else
mkdir linuxcnc
cd linuxcnc
#git clone
git clone git://gitorious.org/emc-rt-preempt/emc-rt-preempt.git linuxcnc-buesch-rt
cd linuxcnc-buesch-rt
git checkout linuxcnc-buesch-rt-patches-forward-port
#cd linuxcnc-buesch-rt
echo "#define typecheck(a,b)
#define raw_local_irq_save(a)
#define trace_hardirqs_off()
#define raw_irqs_disabled_flags(flags)
#define trace_hardirqs_on()
#define local_irq_save(flags) \
do { \
typecheck(unsigned long, flags); \
raw_local_irq_save(flags); \
trace_hardirqs_off(); \
} while (0)
#define local_irq_restore(flags) \
do { \
typecheck(unsigned long, flags); \
if (raw_irqs_disabled_flags(flags)) { \
raw_local_irq_restore(flags); \
trace_hardirqs_off(); \
} else { \
trace_hardirqs_on(); \
raw_local_irq_restore(flags); \
} \
} while (0)
# define _atomic_spin_lock_irqsave(l,f) do { local_irq_save(f); } while (0)
# define _atomic_spin_unlock_irqrestore(l,f) do { local_irq_restore(f); } while (0)
static inline int test_and_set_bit(int nr, volatile unsigned long *addr)
{return(0);}
static inline int test_and_clear_bit(int nr, volatile unsigned long *addr)
{return(0);}" > src/rtapi/arm_bitops.h
mv src/rtapi/rtapi_bitops.h src/rtapi/rtapi_bitops.h.old
cat src/rtapi/rtapi_bitops.h.old | sed -e '/The header/,+5d' | sed '$d' > src/rtapi/rtapi_bitops.h
echo -n '#elif defined(__arm__)
#include "arm_bitops.h"
#else
#error The header file <asm/bitops.h> is not usable and rtapi does not yet have support for your CPU
#endif
#endif' >> src/rtapi/rtapi_bitops.h
sudo apt-get remove Tcl8.4
./debian/configure sim
dpkg-checkbuilddeps
cd src
#sudo apt-get remove Tcl Tcl8.4
./autogen.sh
./configure --enable-simulator
make
fi