Michael Haberler | 28 Apr 16:09 2013

Beaglebone LinuxCNC starterkit: ready-to-run SD card image

As promised, I have prepared an SD card image for the beaglebone ready-to-run.

README: http://static.mah.priv.at/public/beaglebone/starterkit/README.beaglebone-sd
download from:  http://static.mah.priv.at/public/beaglebone/starterkit/

Please understand this as a 'raw hide, some assembly required' image for users who can help themselves in a
bare linux environment - this is not a polished 'pacakge', no desktop, no colored buttons to start LinuxCNC.

I'd like to thank all folks who beta-tested this and suggested improvements: Kent, Charles, David, Yishin
Li, Amit.

- Michael

ps: Gscreen runs nicely too. Axis is real CPU hog. Emcweb is very lightweight. All advanced features in
master work fine too!

---- README.beaglebone-sd ----

What is it:

An 4GB size SD card image for the BeagleBone board, which contains:

- Debian Wheezy
- the Xenomai 3.2.21 kernel with Xenomai 3.6 support in-kernel
- the Xenomai 2.6 runtime support installed (master)
- all prerequisite packages for LinuxCNC installed
- two LinuxCNC development branches installed ready to run:
      arm335x-hal-pru-module-emcweb  (v2.5_branch - based)
      arm335x-hal-pru-module-emcweb-master (master-based)
      both branches track git://git.mah.priv.at/emc2-dev.git

Alternatively, tar files of the boot and root partitions:

-rw-r--r-- 1 mah mah 3974103040 Apr 23 16:56 beaglebone_sd4GB.img
-rw-r--r-- 1 mah mah     380457 Apr 23 16:56 boot.tar.gz
-rw-r--r-- 1 mah mah 1704164777 Apr 23 17:28 root.tar.gz

The kernel and include files used in this image is here, it is a slightly
updated version of what has been available so far (still 3.2.21/2.6 based,
but all patches from arago/v3.2-staging applied):

-rw-r--r-- 1 mah mah    9617304 Apr 21 09:50 linux-3.2.21-xenomai+.tar.gz
-rw-r--r-- 1 mah mah     824139 Apr 21 09:51 linux-headers-3.2.21-xenomai+.tar.gz

How to get it to run:

- download 
- copy to a 4GB  MicroSD card:
  determine which device the SD card has, and make sure it is umounted
  assuming the card is at /dev/sdb, run this

  $ sudo dd if=beaglebone_sd4GB.img of=/dev/sdb bs=10M

- insert into beaglebone SD slot abd boot

  Alternatively you can extract the tar files to a mounted SD card which is
  formatted like so:
  partition 1 - VFAT, size 64MB, formatted as vfat, marked as bootable
  partition 2 - ext4, size 3.8GB or greater, 

How to log in:

user root password linuxcnc
user linuxcnc password linuxcnc

Running LinuxCNC:

a. Let the beaglebone complete the boot process.
b. From the X-server host enter the command
    $ ssh -X -l linuxcnc <beaglebone ip address>
c. answer the password prompt 
d. after login is complete continue as outlined below.

Charles' super-high-speed stepper demo config can be run like so:

$ cd ~/linuxcnc-pru-emcweb/configs/pru-examples
$ linuxcnc pru-stepper.ini

To run the miniEMC2 Web server config:

$ cd ~/linuxcnc-pru-emcweb/configs/sim
$ linuxcnc emcweb.ini

Then connect to the webserver at http://<ip-address-of-beaglebon>:8080

What happens on startup in /etc/rc.local:

echo 0 > /proc/sys/kernel/hung_task_timeout_secs
modprobe uio_pruss  # load the PRU support driver
# enable group 1002 (xenomai) to use Xenomai RT functions
echo 1002 > /sys/module/xeno_nucleus/parameters/xenomai_gid

# I dont understand why this is needed:
# NB: here comes your security hole!
chmod 644 /dev/mem

Partitions on sd card:

Mine looks like so (if I plug in the SD card on some other Linux machine):

$ fdisk /dev/sdb
You will not be able to write the partition table.

Command (m for help): p

Disk /dev/sdb: 3974 MB, 3974103040 bytes
123 heads, 62 sectors/track, 1017 cylinders, total 7761920 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *        2048      133119       65536    b  W95 FAT32
/dev/sdb2          133120     7761919     3814400   83  Linux

Command (m for help): 

The output of 'sfdisk -d' on the beaglebone looks like so:

# partition table of /dev/mmcblk0
unit: sectors

/dev/mmcblk0p1 : start=     2048, size=   131072, Id= e, bootable
/dev/mmcblk0p2 : start=   133120, size= 15144960, Id=83
/dev/mmcblk0p3 : start=        0, size=        0, Id= 0
/dev/mmcblk0p4 : start=        0, size=        0, Id= 0
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr