====== BeagleBone ======
This guide walks you through the steps of developing support for a new BeagleBone Capes (expansion board). The current version of this guide documents the features used in git commit **60a61df** and later. If you update this document because of changes to MINIX 3, please mention the commit ID of the change in the wiki comment.
===== Overview =====
Supporting new capes in Minix is fairly straight forward. One simply needs to develop drivers for the devices on the cape, determine the name of the cape stored on the cape's EEPROM, drop a start-up script into ''/usr/src/etc/rc.capes/'', and let the build system know about the new file.
===== Determining the Cape Name =====
Each proper cape has an EEPROM on-board connected to the 3rd I2C bus with slave address 0x54, 0x55, 0x56, or 0x57. The address should be configurable via DIP switches or jumpers. The EEPROM has a lot of information on it about the cape (part number, manufacturer, serial number, pinmux, power usage, and more). The ''/usr/etc/rc'' script uses the name of the cape from the EEPROM to call the right script in ''/etc/rc.capes/'' to load the drivers and do any other configuration for the cape. Therefore, you need to know the name of the cape exactly as it is stored in the EEPROM. You can find this information in the documentation for the board, from [[http://beaglebonecapes.com/|BeagleBoneCapes.com]], or by reading the name off of the chip.
The following command will print the name of the board with any trailing periods removed.
eepromread -i -f /dev/i2c-3 -a 0x54 | \
sed -n 's/^PART_NUMBER : \(.*\)$/\1/p' | \
sed -e 's/\.*$//g'
===== Creating the rc Script =====
Once you know the name of the cape, you will need to create a script which will be installed into ''/etc/rc.capes/''. The script will have the same name as the cape and should do start-up tasks like create device files, start drivers, and start any other programs needed by the cape.
Here's an example rc script for the weather cape. ''/usr/src/etc/rc.capes/BB-BONE-WTHR-01''
#!/bin/sh
#
# Start-up script for the BeagleBone Weather cape.
# TSL2550 Ambient Light Sensor
test -e /dev/tsl2550b3s39 | (cd /dev && MAKEDEV tsl2550b3s39)
/bin/service up /usr/sbin/tsl2550 -dev /dev/tsl2550b3s39 \
-label tsl2550.3.39 -args 'bus=3 address=0x39' && echo -n " tsl2550"
# SHT21 Temperature and Humidity Sensor
test -e /dev/sht21b3s40 | (cd /dev && MAKEDEV sht21b3s40)
/bin/service up /usr/sbin/sht21 -dev /dev/sht21b3s40 \
-label sht21.3.40 -args 'bus=3 address=0x40' && echo -n " sht21"
# BMP085 Temperature and Pressure Sensor
test -e /dev/bmp085b3s77 | (cd /dev && MAKEDEV bmp085b3s77)
/bin/service up /usr/sbin/bmp085 -dev /dev/bmp085b3s77 \
-label bmp085.3.77 -args 'bus=3 address=0x77' && echo -n " bmp085"
daemonize tcpd http /usr/share/beaglebone/weather/weatherstation.lua
===== Adding the rc script to md.evbarm =====
The build system keeps a list of installed files. You need to tell the build system about any new files you wish to install. This is done by adding a line to ''distrib/sets/lists/minix/md.evbarm''. You don't need to change any Makefiles to install the rc script as anything in ''/usr/src/etc/rc.capes/'' will be installed automatically.
''/usr/src/distrib/sets/lists/minix/md.evbarm'':
./etc/rc.capes/BB-BONE-WTHR-01 minix-sys