...
Code Block | ||||
---|---|---|---|---|
| ||||
me@my-computer:$ scp -r build/artifacts/* pi@dukepad:/opt/dukepad |
root@dukepad4:/opt/dukepad# vi run.sh
echo "Using $JAVA_HOME"
cd /opt/dukepad
$JAVA_HOME/bin/java \
-Dcom.sun.javafx.transparentFramebuffer=true \
-Dprism.verbose=true \
-Degl.depthSize=24 -Dprism.glDepthSize=24 \
-Dcom.sun.javafx.experimental.embedded.3d=true \
-Di2c.bus=0 -Di2c.address=0x68 \
-Dprism.maxvram=209717200 \
-Dprism.targetvram=100663296 \
-Xmx90m \
-Xms90m \
-DuseMag=false \
-jar dukepad.jar |
We played with a lot of different command line values (for example, for remote debugging, JMX monitoring, etc). The maxvram and targetvram values are in bytes, and indicate how much of VRAM JavaFX will use for graphics. We didn't fine tune these values, just picked something that seemed reasonable, so there might be the ability to tweak these values for better performance (although it doesn't seem to be highly likely). We set the VM heap size to 90m so as to make startup a bit better, so that instead of the VM running out of space during startup it would just start off with a big chunk of memory. The OS still has another 150MB or so to play with, which is probably excessive, but the DukePad FX app didn't require a lot of heap (a lot less than 90MB actually), so we didn't see a reason to make it really large.
If you execute this script at this point, it should start up the DukePad, with whatever applications you have in your /opt/dukepad/apps directory. A quick note, if you have any MP3 files for music or MP4 files for media or JPG files for images, then put them in /opt/dukepad/media/images, /opt/dukepad/media/movies, /opt/dukepad/media/music as appropriate. If you want preview thumbnails for movies, also include in the movies directory medianame-thumb.jpg, where medianame is the name of the media file. For example, IronMan.mp4 would have IronMan-thumb.jpg.
If you want to enable auto-start, so that when the DukePad is booted up it will automatically launch the UI, then do the followingTo enable auto-start:
Code Block | ||||
---|---|---|---|---|
| ||||
root@dukepad:~# nano /etc/inittab |
...
Code Block | ||||
---|---|---|---|---|
| ||||
#1:2345:respawn:/sbin/getty 115200 tty1 1:2345:respawn:/bin/login -f pi tty1 </dev/tty1 >/dev/tty1 2>&1 |
Edit this file in /etc/init.d
Code Block | ||||
---|---|---|---|---|
| ||||
root@dukepad:~# vi /etc/init.d/asplashscreen #! /bin/sh ### BEGIN INIT INFO # Provides: asplashscreen # Required-Start: # Required-Stop: # Should-Start: # Default-Start: S # Default-Stop: # Short-Description: Show custom splashscreen # Description: Show custom splashscreen ### END INIT INFO do_start () { echo "Starting Duke Pad" /usr/bin/fbi -T 1 -noverbose -a /opt/dukepad/Duke-Startup.jpg exit 0 } case "$1" in start|"") do_start ;; restart|reload|force-reload) echo "Error: argument '$1' not supported" >&2 exit 3 ;; stop) # No-op ;; status) exit 0 ;; *) echo "Usage: asplashscreen [start|stop]" >&2 exit 3 ;; esac : |
Now it is time to get the code for the DukePad JavaFX
Hardware
- Setup your raspberry PI as usual. Here are quick start instructions if needed.
- If your installation does not already have it, download and install the latest JavaSE 8 Embedded release
- At this time (Sep 2013), we have weekly builds. After the official JavaSE 8 Embedded release is out, just use that.
- Setup the DukePad launcher and apps
- Clone the OpenJFX repo
- cd into rt/apps/experiments/DukePad
- Either open this project as an Intellij project, or use the gradle build script. The gradle script is iffy at this moment, and the IntelliJ project doesn't work well behind firewalls. YMMV.
- If using Intellij, build the project. This should download the required libraries from Maven. Feeling ambitious? Contribute a better gradle script or maven scripts. The world will love you.
- Once built, the runnable files are in build/artifacts. Copy everything in this directory onto your PI.
- We generally put things into /opt/dukepad, but you can put them wherever you like
- It is best to run things as root (you can switch to root with "sudo su")
- ssh into the PI, switch to the superuser
- Create a shell script (described below) to launch the DukePad java application
- Configure the PI with additional software requirements
- apt-get install fbi
- apt-get install mgp321
- Edit /etc/inittab. Comment out the line
1:2345:respawn:/sbin/getty 115200 tty1and replace with
1:2345:respawn:/bin/login -f pi tty1 </dev/tty1 >/dev/tty1 2>&1
This guide assumes that your Raspberry PI has "dukepad" as the host name, although of course you can use anything (including the raw IP address). The real work starts with step 3, building the DukePad software.
- Add the boot/config.txt configuration file modifications required (screen resolution, memory split, etc)
- Add a pointer to the JavaSE Embedded release that people should pick up
- Add a pointer to the JavaFX Embedded release to pick up
- Add instructions for cloning OpenJFX and building DukePad. At the moment we require using Intellij which isn't right. There is a gradle script, but it isn't reliable.
- Add hardware instructions (all zipped together?)
- Add pointers to where to get hardware
...
And finally, edit /etc/rc.local before "exit"
Code Block | ||||
---|---|---|---|---|
| ||||
# START DUKE PAD
nohup /opt/dukepad/run.sh > /opt/dukepad/log.txt & |
Hardware
OK, now for the hardware for building the DukePad. Some of the apps require hardware setup. There are some other steps not yet documented on this wiki for setting up accelerometer support. The following two files provide all of the template for laser cutting acrylic for the body of the DukePad. There are two different thicknesses, 3mm(1/8") and 4.5mm (3/16"). We're working with Special Computing to provide pre-built kits that can be ordered. This wiki will be updated with further information as it becomes available.
- Screen + Display Board $135 http://www.chalk-elec.com/?page_id=1280#!/~/product/category=3094861&id=14647624
- Raspberry Pi Model B $35 - http://www.newark.com/raspberry-pi/raspbrry-modb-512m/model-b-assembled-board-only/dp/43W5302
- Raspberry Pi Camera $25 - http://www.newark.com/jsp/search/productdetail.jsp?sku=69W0689
- 16Gb Mem Card $13 - http://www.amazon.com/gp/product/B003VNKNEQ/ref=oh_details_o01_s00_i00?ie=UTF8&psc=1
- USB Wifi $10 - http://www.amazon.com/gp/product/B003MTTJOY/ref=oh_details_o03_s00_i00?ie=UTF8&psc=1
- USB Hub $20 - http://www.amazon.com/gp/product/B005P2BY5I/ref=oh_details_o09_s00_i01?ie=UTF8&psc=1
- Battery Pack $40 - http://www.amazon.com/gp/product/B009USAJCC/ref=oh_details_o03_s00_i01?ie=UTF8&psc=1
- MPU 9150 Gyro/Accel/Mag $50 - https://www.sparkfun.com/products/11486
- 1ft USBA to MiniUSB B $4 - http://www.amazon.com/gp/product/B002L5U7N2/ref=oh_details_o04_s00_i01?ie=UTF8&psc=1
- 20x #4-40 7/16" Flat head screw $1 - http://www.amazon.com/gp/product/B000FN7UQO/ref=oh_details_o07_s01_i01?ie=UTF8&psc=1
- 10x Standoffs Hex Female To Female 3/16" 4-40 3/4" Aluminum $3.5 - https://www.jameco.com/webapp/wcs/stores/servlet/ProductDisplay?catalogId=10001&langId=-1&productId=133656&storeId=10001&krypto=vFgRhKXJZKuM8sLfuPRmxv3tw%2BNp1UpM3AZ3S0xdP278VMhlhjwnqg%3D%3D&ddkey=https:StoreCatalogDrillDownView
- Panel Mount RJ45 $5 - http://www.adafruit.com/products/909
- USB A connector for power from battery $1 - http://www.adafruit.com/products/1387
- DB25 IDC Female for external GPIO $2.5 - http://www.jameco.com/webapp/wcs/stores/servlet/ProductDisplay?search_type=jamecoall&catalogId=10001&freeText=115976&langId=-1&productId=115976&storeId=10001&ddkey=http:StoreCatalogDrillDownView
- GPIO Cable, cut one end of and replace with DB25 $3 - http://www.adafruit.com/products/862
- Case Acrylic $15
- 6x #4-40 1/2 Flat Bolt and Nut $1
- 4x #2-56 5/16" Bolt and Nut $1
- Small amount of wire for power wiring and i2C $1
- 650uf 6.3v capacitor to keep Pi running while switching screen on/off $0.3
- 2P3R Slide Switch $1.25