This wiki page is inaccurate and outdated. Instead of modifying this wiki page, create github pull requests for the official documentation on building LinuxCNC. You can read the current version of the compilation instructions here: http://linuxcnc.org/docs/master/html/code/building-linuxcnc.html LinuxCNC master branch now includes support for Xenomai realtime, configure --with-realtime=uspace |
cd <working dir> wget https://github.com/raspberrypi/tools/archive/master.tar.gz tar xzf master.tar.gz
git clone -b rpi-3.2.27 --depth 1 git://github.com/raspberrypi/linux.git linux-rpi-3.2.27
git clone https://github.com/raspberrypi/firmware.git
wget http://download.gna.org/xenomai/stable/xenomai-2.6.1.tar.bz2 tar xjf xenomai-2.6.1.tar.bz2
mkdir patch wget http://www.cim.mcgill.ca/~ian/rpi-linux-3.2.21-xenomai-2.6.1.patch -P patch wget http://dl.dropbox.com/u/17024524/linuxcnc/rpi-3.2.27-xenomai.patch -P patch
patch -p0 < patch/rpi-3.2.27-xenomai.patch
xenomai-2.6.1/scripts/prepare-kernel.sh --arch=arm --linux=linux-rpi-3.2.27 --adeos=xenomai-2.6.1/ksrc/arch/arm/patches/ipipe-core-3.2.21-arm-1.patch
(cd linux-rpi-3.2.27; patch -p1 < ../patch/rpi-linux-3.2.21-xenomai-2.6.1.patch)
mkdir linux-rpi-3.2.27/build
cd linux-rpi-3.2.27 make mrproper make ARCH=arm O=build menuconfig
wget http://dl.dropbox.com/u/17024524/linuxcnc/config.rpi-3.2.27-xenomai%2B -O linux-rpi-3.2.27/build/.config cd linux-rpi-3.2.27 make mrproper make ARCH=arm O=build oldconfig
make ARCH=arm O=build CROSS_COMPILE=../../tools-master/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi/bin/arm-bcm2708hardfp-linux-gnueabi-
make ARCH=arm O=build INSTALL_MOD_PATH=dist modules_install
make ARCH=arm O=build INSTALL_HDR_PATH=dist headers_install find build/dist/include \( -name .install -o -name ..install.cmd \) -deleteThe linux-rpi-3.2.27/build/dist directory contains the kernel headers and modules while the kernel image is at linux-rpi-3.2.27/build/arch/arm/boot/ .
sudo apt-get install qemu qemu-user qemu-user-static binfmt-support debootstrap
sudo apt-get install debootstrap
cd <working dir> sudo debootstrap --foreign --no-check-gpg --include=ca-certificates --arch=armhf wheezy rootfs <Raspbian mirror>
EXTRA_OPTS="-L/usr/lib/arm-linux-gnueabihf"
sudo cp $(which qemu-arm-static) rootfs/usr/bin sudo chroot rootfs/ /debootstrap/debootstrap --second-stage --verbose
sudo sh -c 'echo deb <Raspbian mirror> wheezy main > rootfs/etc/apt/sources.list'
cd <working dir> sudo debootstrap --no-check-gpg --include=ca-certificates wheezy rootfs <Raspbian mirror>
sudo sh -c 'echo rpi-linuxcnc >rootfs/etc/hostname'
sudo sh -c 'echo -e 127.0.0.1\\trpi-linuxcnc >> rootfs/etc/hosts'
sudo sh -c 'cat> rootfs/etc/network/interfaces << EOF auto lo iface lo inet loopback
auto eth0 iface eth0 inet dhcp EOF '
sudo sh -c 'cat> rootfs/etc/fstab << EOF proc /proc proc defaults 0 0 /dev/mmcblk0p1 /boot vfat defaults 0 0 EOF '
sudo cp /etc/resolv.conf rootfs/etc
sudo chroot rootfs /bin/bash
LC_ALL=C LANGUAGE=C LANG=C
apt-get update apt-get install --no-install-recommends locales sudo xauth bc openssh-server ntp gettext autoconf \ libpth-dev gcc g++ make git libncurses5-dev libreadline-gplv2-dev tcl8.5-dev tk8.5-dev bwidget \ blt libxaw7-dev libglu1-mesa-dev libgl1-mesa-dev libgtk2.0-dev python python-dev python-support \ python-tk python-lxml libboost-python-dev yapps2-runtime libtk-img python-imaging python-imaging-tk \ libgl1-mesa-swx11 python-xlib python-gtkglext1 python-configobj python-glade2 python-numpy build-essential
apt-get clean
addgroup xenomai addgroup root xenomai
adduser rpi usermod -a -G xenomai,sudo,staff,kmem rpi
cat >/etc/udev/rules.d/xenomai.rules<<EOF # allow RW access to /dev/mem KERNEL=="mem", MODE="0660", GROUP="kmem" # real-time heap device (Xenomai:rtheap) KERNEL=="rtheap", MODE="0660", GROUP=="xenomai" # real-time pipe devices (Xenomai:rtpipe) KERNEL=="rtp[0-9]*", MODE="0660", GROUP="xenomai" EOF
exit
sudo cp -a linux-rpi-3.2.27/build/dist/lib/modules rootfs/lib/ sudo cp -a linux-rpi-3.2.27/build/dist/include/* rootfs/usr/include sudo cp linux-rpi-3.2.27/build/.config rootfs/boot/config-3.2.27-xenomai+
sudo cp -a xenomai-2.6.1 rootfs/usr/src git clone -b rtos-integration-preview3 --depth 1 git://git.mah.priv.at/emc2-dev.git sudo cp -a emc2-dev rootfs/usr/src/
sudo chroot rootfs
LC_ALL=C LANGUAGE=C LANG=C
cd /usr/src/xenomai-2.6.1 ./configure make DESTDIR=$(pwd)/rpi install tar cf - -C rpi usr/xenomai/{bin,lib,sbin,include} | tar xvf - -C / echo /usr/xenomai/lib/ > /etc/ld.so.conf.d/xenomai.conf ldconfig -v
make clean rm -r rpi
cd ../emc2-dev/src ./autogen.sh ./configure --prefix=/usr/local --with-platform=raspberry --disable-build-documentation --with-kernel=/boot/config-3.2.27-xenomai+ make make install
make clean
exit
sudo rm rootfs/usr/bin/qemu-arm-static
cd <working dir> dd if=/dev/zero of=rpi-lcnc.img count=0 bs=1 seek=2021654528
sudo sh -c 'cat <<EOF | sfdisk --force rpi-lcnc.img unit: sectors
1 : start= 2048, size= 204800, Id= c 2 : start= 206848, size= 3741696, Id=83 EOF '
sudo losetup /dev/loop0 rpi-lcnc.img -o $((2048*512)) sudo mkfs.vfat -F 32 -n BOOT /dev/loop0 sudo losetup -d /dev/loop0 sudo losetup /dev/loop0 rpi-lcnc.img -o $((206848*512)) sudo mkfs.ext4 -L ROOT /dev/loop0 sudo losetup -d /dev/loop0
mkdir -p mnt/{boot,root} sudo mount -o loop,offset=$((2048*512)) rpi-lcnc.img mnt/boot sudo mount -o loop,offset=$((206848*512)) rpi-lcnc.img mnt/root
sudo rsync -a rootfs/ mnt/root/ sudo cp -a firmware/hardfp/opt/vc mnt/root/opt/
sudo mv rootfs/boot/* mnt/boot/ sudo cp firmware/boot/{*bin,*dat,*elf} mnt/boot/ sudo cp linux-rpi-3.2.27/build/arch/arm/boot/Image? mnt/boot/kernel.img sudo sh -c 'cat >mnt/boot/config.txt<<EOF kernel=kernel.img arm_freq=800 core_freq=250 sdram_freq=400 over_voltage=0 gpu_mem=16 EOF ' sudo sh -c 'cat >mnt/boot/cmdline.txt<<EOF xeno_nucleus.xenomai_gid=1000 dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait EOF '
sudo umount mnt/{boot,root}
bzip2 -9 rpi-lcnc.img
sudo sh -c 'bzcat rpi-lcnc.img.bz2 > /dev/<sdcard>'
sudo dpkg-reconfigure locales
sudo dpkg-reconfigure tzdata
ssh -X -l rpi <ip address>
sudo sh -c 'echo 3500 > /proc/xenomai/latency' /usr/xenomai/bin/latency
latency-test 100us 1ms
This pre-built image does not have libgl1-mesa-swx11 installed (this package is needed by Axis)
[xenomai.img]
or
http://filecloud.io/_0vew6zmj
Username: rpi Password: linuxcnc
http://www.blaess.fr/christophe/2012/08/27/xenomai-sur-raspberry-pi/
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=41&t=12368
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=37&t=14122