The DukePad is a Do-It-Yourself, make-at-home tablet computer based on the Raspberry PI and JavaSE Embedded 8. The plans and instructions for building the DukePad are available here, and we're working with suppliers to make available pre-made kits that can be more easily assembled. The software on the DukePad uses Raspbian Linux as the operating system, and an OSGi-based JavaFX environment. Within this DukePad environment, apps are simple JavaFX OSGi Modules.
The DukePad is not a product, it is an open source, freely available set of plans and software for assembling your own tablet using off the shelf components. As such, the quality of the DukePad software environment is demo-quality (although we did strive to write as much real functionality as we could, the realities of demo presentations requires sacrificing time on parts of the applications that are not going to be shown, in favor of smoothing out those parts that will be shown). The code is hosted in the OpenJFX repositories under apps/experiments/DukePad. We hope to see forks of this code (GitHub, BitBucket, whatever you like best) and lots of experimentation and improvement that can be shared.
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. One thing to keep in mind, is that although the Raspberry PI can run X11, we will not normally use it, since JavaFX is going to take over the entire screen. When downloading software to the PI, you can choose either to start up X (startx), or you can choose to download onto your desktop system and sftp / scp the files over the PI. This guide assumes you know how to get files onto the PI (and if not, a quick lesson on sftp / scp should do the trick).
Software
First, setup your new 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 Embedded release. As of Sep. 2013, JavaSE Embedded is only available as a weekly build. After Mar 2013, you should just use the official builds. You are looking for Linux ARMv6/7 VFP, HardFP ABI. This is the version of Java that will work on a PI.
Installation simply involves uncompressing the downloaded file and putting it in a directory of your choosing. For example:
pi@dukepad$ sudo su root@dukepad:~# tar -xzf jdk-8-ea-b108-linux-arm-vfp-hflt-18_sep_2013.tar.gz root@dukepad:~# mv jdk1.8.0 /opt/
At this point, the JDK has been installed into /opt/jdk1.8.0 and includes JavaFX as well. Next, we need to install a few additional Raspberry PI packages in order to play media, and to configure the splash screen and auto-booting. You can skip the splash screen / auto-boot instructions if you are just playing with the DukePad software and not creating a table device.
First, get the proper packages:
root@dukepad:~# apt-get update root@dukepad:~# apt-get install fbi root@dukepad:~# apt-get install mpg321
The "fbi" package is required for the boot loading screen, and the "mpg321" package is for being able to play media.
Now we will walk through the steps for downloading and building the DukePad JavaFX software and apps. The sources are held in the OpenJFX project repositories. You need to clone OpenJFX, but you don't need to build all of OpenJFX, but can just build the DukePad independently. On your desktop, clone http://hg.openjdk.java.net/openjfx/8/graphics/rt. If you are using IntelliJ IDEA, locate under rt/apps/experimental the DukePad project. Open it and build. It should build, auto-downloading dependencies from maven central. Alternatively, you can try using the gradle build file. To do so, cd into rt/apps/experimental/DukePad. Execute:
me@my-computer:$ gradle artifacts
(For a while the IDEA project build wasn't working, so the gradle script was thrown together. The gradle script isn't being used by anybody, so it may have issues. Ultimately, gradle will download the dependencies into the lib/ directory. You can manually populate it if necessary).
After a successful build, the following libraries should be in rt/apps/experimental/DukePad/lib:
grizzly-framework-2.3.1.jar grizzly-http-2.3.1.jar grizzly-http-server-2.3.1.jar grizzly-rcm-2.3.1.jar tyrus-core-1.0.jar tyrus-spi-1.1.jar tyrus-client-1.0.jar tyrus-core-1.1.jar tyrus-websocket-core-1.0.jar tyrus-client-1.1.jar tyrus-server-1.0.jar tyrus-websocket-core-1.1.jar tyrus-container-grizzly-1.0.jar tyrus-spi-1.0.jar pi4j-native-0.0.5-soft-float.so pi4j-core-0.0.5.jar pi4j-native-0.0.5-hard-float.so javax.json-1.0.1.jar javax.websocket-api-1.0.jar
The actual built artifacts are in DukePad/build/artifacts. Everything in this directory must be uploaded to the Raspberry PI. The following example will use SCP to copy the files from build/artifacts up to a directory on the pi called /opt/dukepad (you may have had to pre-create this directory on the server and assign full rwx permissions on it).
me@my-computer:$ scp -r build/artifacts/* pi@dukepad:/opt/dukepad
Finally, back on the PI we need to .....
To enable auto-start:
root@dukepad:~# nano /etc/inittab
Scroll down and edit the file as thus:
#1:2345:respawn:/sbin/getty 115200 tty1 1:2345:respawn:/bin/login -f pi tty1 </dev/tty1 >/dev/tty1 2>&1
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
- 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