Faster and easier! MachineKit install using packages

A past post here described installing MachineKit from source, but now you have a much better option: using a package-based install.

What’s a Package?

‘Package’ refers to a Debian package, which brings together all the stuff (code, scripts, images, documentation, etc.) needed to run a piece of software.  Creating, storing, and keeping packages up-to-date is thankless work, but once someone else has made a package, the code is vastly easier to install.  Then you don’t need to install a compiler and all its dependencies just to build a piece of software, then wait for that software to build, which previously was around 40 minutes for a BBB, nor do you need disk space for all of those.  With a package, you can get new features and bug fixes, plus can easily revert a version if it doesn’t work for you – in a single-line command.

This post provides instructions for getting MachineKit up and running using packages, on a fresh BeagleBone Black rev C (the one with 4 GB of embedded memory). I assume you know how to flash an image onto your BBB and connect to it. If not, you may find my earlier Initial Setup post helpful.

Flash the latest image

Start with the latest Debian Testing snapshot, from this page:
http://elinux.org/Beagleboard:BeagleBoneBlack_Debian#Debian_Image_Testing_Snapshots

I used the 12-19-2014 eMMC Flasher image. MachineKit contributor Charles Steinkuhler says the flasher image runs a bit faster, but that the 4GB limit can be constraining if you do software development. Next time I’ll use the non-flasher image and run off the SD card; for now, it’ll be nice to eliminate the possibility of the tiny MicroSD card coming out when I least want it to.

On OS X, I used The Unarchiver to extract the .xz file and Pi Filler to flash to SD. Both are free downloads and easy to use.

The next steps borrow somewhat from these instructions:
https://github.com/strahlex/asciidoc-sandbox/wiki/Creating-a-Machinekit-Debian-Image

Tweak the image for MachineKit

Log in

Username/password: debian / temppwd

At this point, I would suggest verifying Internet connectivity, either by direct Ethernet, shared via Internet Sharing, or with a wireless dongle. My favorite method is to use an Edimax dongle with a powered USB hub; now these packages have the required drivers built-in, so all you have to do is modify /etc/network/interfaces to add your WiFi SSID and password and then bring up the interface with ‘sudo ifup wlan0’.

Add a machinekit user

 sudo adduser machinekit
 sudo usermod -aG sudo,xenomai,kmem machinekit

Remove the sudo password for the machine kit user:

 sudo su -c 'echo -e "# No sudo password for machinekit user\nmachinekit ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/90-machinekit'
 exit

Add the MachineKit package

…and authorize the Dovetail Automata Debian repo:
(Full instructions at http://www.machinekit.io/docs/packages-debian/)

 sudo sh -c \
 "echo 'deb http://deb.dovetail-automata.com wheezy main' > \
 /etc/apt/sources.list.d/machinekit.list; \
 apt-get update ; \
 apt-get install dovetail-automata-keyring"

Enter ‘Y’ when prompted. Then update the packages:

 sudo apt-get update

Install realtime-capable kernel (Xenomai)

 sudo apt-get install -y linux-image-xenomai.beaglebone-omap

Reboot

 sudo reboot

Verify that the kernel updated after logging in:

 uname -r

You should see something like this:

 3.8-1-xenomai.beaglebone-omap

Install MachineKit package

 sudo apt-get install -y machinekit-xenomai

Disable HDMI, if desired, as per the instructions here:

https://github.com/strahlex/asciidoc-sandbox/wiki/Creating-a-Machinekit-Debian-Image#step-8-deactivate-all-unneeded-capes

Run MachineKit

Log in as the machinekit user, making sure that you have X forwarding enabled if you’re like me and don’t have a display connected to your BBB.

linuxcnc &

Now find a config; for me, I chose ARM -> BeagleBone -> CRAMPS

It should load, but didn’t for me, due to a packaging error.  I saw this message:

machinekit@beaglebone:~$ LINUXCNC - 2.7.0~pre0
 Machine configuration directory is '/home/machinekit/linuxcnc/configs/ARM.BeagleBone.CRAMPS'
 Machine configuration file is 'CRAMPS.ini'
 Starting LinuxCNC...
 /usr/libexec/linuxcnc/rtapi_msgd: error while loading shared libraries: libzmq.so.3: cannot open shared object file: No such file or directory
 rtapi_msgd startup failed - aborting

The workaround is simple and in all likelihood this will be fixed by the time you read these words.  I did the following:

 ln -s /usr/lib/arm-linux-gnueabihf/libzmq.so.4 /usr/lib/arm-linux-gnueabihf/libzmq.so.3

For details on this issue, see this Machinekit Google Group discussion.

Let’s assume the install went smoothly.  Within a minute, you should see the Axis interface appear.

For those with a Linear Delta 3D printer (Kossel, Rostock, etc) and a CRAMPS board, or those looking to see how you might distribute a config for MachineKit, see the step below.

(Optional) Run a Linear Delta 3D Printer

Earlier in 2014, I had stored my customized MachineKit configs within the source tree.  That’s no longer needed, so you can just check out the installation-specific additions, which includes the HAL and INI files, M-code scripts, and other delta-specific calibration scripts.  I had to make a few small changes to the HAL and INI files to update them for the latest MachineKit.  To get these:

cd ~/
git clone https://github.com/brandonheller/linuxcnc.git

If you already selected a sample config and have these files, then move the /home/machinekit/linuxcnc directory elsewhere and re-run the ‘git clone’.

Then when you re-start MachineKit (linuxcnc), when it brings up the config selection dialog, the CRAMPS.LinearDelta config should be selectable.   Now you can do stuff like use a non-typical printer type (delta) to print a completely wacky printer type, like a Simpson:

 

Advertisements

3 thoughts on “Faster and easier! MachineKit install using packages

  1. Pingback: Faster and easier! MachineKit install using packages | linearcreations

  2. Brandon, the last part of the instructions here no longer work as your repository contains .hal and .ini files that are no longer compatible with the latest distribution of the rebranded machinekit. Files need updating, which is not a big deal, but after updating lineardeltakins part in the .hal file causes an abort with: CRAMPS.lineardelta.hal:28: insmod failed, returned -1. I will post this question to google group. Thanks.

    • Hello Ali,

      Did you find a solution for the Problem?
      can you send me a patch?
      ecam(at)aon.at

      Kind regards,
      mathias

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s