Table of contents
- Requirements
- What will/will not be working?
- Linux kernel
- Compiling
- Install kernel and modules
- U-Boot
- Compiling
- Install to SPI flash
- Setup environment
- Enable features
- Bluetooth
- Turning the LED on/off using systemd
- U-Boot environment variables in linux
- Bluetooth
- Download compiled binaries
- References
1. Requirements
I am going with the cross compilation method, because compiling on the plug takes few hours and it could be problematic to re-compile after every change of the configuration. Open up a terminal and let's begin.
You will need an ARM compiler toolchain to do this. I recommend arm-linux-gnueabi-gcc[1], so search for it and install with your package manager.
Also you will need to install the so called build essentials. On debian-based systems
- Code: Select all
apt-get install build-essential
- Code: Select all
pacman -S kernel26-headers file base-devel abs
For installing the latest U-Boot you will need the JTAG developer kit from GlobalScale and get OpenOCD utility installed.
It is optional, but to deploy the binaries on Dreamplug the easy way I recommend installing netcat utility.
Setting up the root file-system can be done according to the Quick start guide PDF putting your favorite distro on it.
There is one exception: the latest U-Boot can handle ext2 filesystem, so you may want to format the /boot partition to ext2.
2 What will/will not be working?
- [WORKING] Linux kernel 3.7.8 with Flattened Device Tree (FDT) support[4]
- [WORKING] The latest Arch Linux ARM as OS
- [WORKING] Networking via. Gigabit Ethernet
- [WORKING Audio playback
- [WORKING] USB mass storage device (external HDDs)
- [WORKING] Controlling LEDs
- [NOT TESTED] eSATA ports
- [NOT TESTED] SD card socket
- [NOT WORKING] WIFI AP mode
- [NOT WORKING] WIFI client mode
3 Linux kernel[3][4]
Grab and unpack the source code:
- Code: Select all
wget http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.7.8.tar.bz2
tar xvfj linux-3.7.8.tar.bz2
Here is my .config file which is only for the Dreamplug. Wireless and audio drivers set as modules, others features will be built into the kernel image. Of course it can be or should be changed to meet your needs.
- Code: Select all
wget http://pastebin.com/raw.php?i=Z0MicyJ3 -O linux-3.7.8/.config
3.1. Compiling[3][4]
- Code: Select all
cd linux-3.7.8
export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabi-
make oldconfig
make menuconfig # Can be skipped if you don not want to change the configuration
make all
make uImage
mkdir -p modules_install
sudo make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- INSTALL_MOD_PATH=modules_install/ modules_install
sudo tar cfz modules-3.7.8-dreamplug.tar.gz -C modules_install/ .
3.2. Install kernel and modules[4]
Terminal for your computer is represented as user@dev and Dreamplug as root@dreamplug in command lines below:
- Code: Select all
user@dev$ netcat -l -p 6666 < arch/arm/boot/uImage
root@dreamplug /boot# netcat 10.42.54.158 6666 > uImage-3.7.8
root@dreamplug /boot# rm uImage
root@dreamplug /boot# ln -s uImage-3.7.8 uImage
user@dev$ netcat -l -p 6666 < arch/arm/boot/kirkwood-dreamplug.dtb
root@dreamplug /boot# netcat 10.42.54.158 6666 > kirkwood-dreamplug.dtb
user@dev$ netcat -l -p 6666 < modules-3.7.8-dreamplug.tar.gz
root@dreamplug /boot# netcat 10.42.54.158 6666 > modules-3.7.8-dreamplug.tar.gz
root@dreamplug /boot# cd /tmp/
root@dreamplug /tmp# tar xvfz /boot/modules-3.7.8-dreamplug.tar.gz .
root@dreamplug /tmp# cp -R lib/modules/3.7.8-dreamplug/ /lib/modules
4.1. Compiling
- Code: Select all
cd u-boot-2013.01
export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabi-
make dreamplug_config
make all
make u-boot.kwb
4.2. Install to SPI flash[4]
Prepare the JTAG developer kit according to the User guide.
Install and start TFTP server (tftpd) and issue
- Code: Select all
cp u-boot.kwb /srv/tftp/u-boot.kwb
Terminal1:
- Code: Select all
cd /path/to/u-boot_build_dir
make u-boot.elf
mv u-boot.elf uboot.elf
openocd -f /usr/share/openocd/scripts/board/sheevaplug.cfg
Terminal2:
- Code: Select all
telnet localhost 4444
reset ; init ; sheevaplug_load_uboot
Terminal3:
Instead of screen, minicom can be used as well.
- Code: Select all
screen /dev/ttyUSB0 115200
Marvell>> setenv ipaddr 192.168.1.2
Marvell>> setenv serverip 192.168.1.1
Marvell>> tftpboot 0x6400000 u-boot.kwb
Marvell>> sf probe 0
Marvell>> sf erase 0x0 0x100000
Marvell>> sf write 0x6400000 0x0 0x2fd74
Where "0x2fd74" is the size of u-boot.kwb image.
4.3. Setup environment[2]
- Code: Select all
Marvell>> setenv x_bootcmd_fdt ext2load usb 0 0xd000000 kirkwood-dreamplug.dtb
Marvell>> setenv x_bootcmd_kernel ext2load usb 0 0x6400000 uImage
Marvell>> setenv bootcmd '${x_bootcmd_usb}; ${x_bootcmd_kernel}; ${x_bootcmd_fdt}; setenv bootargs ${x_bootargs} ${x_bootargs_root}; bootm 0x6400000 - 0xd000000;'
Marvell>> saveenv
Marvell>> reset
5.1. Bluetooth[4]
Installing and enabling the service:
- Code: Select all
pacman -S bluez
systemctl enable bluetooth.service
Currently two drivers provides support for Marvell Bluetooth devices 8688/8787/8797 are libertas_sdio and btmrvl_sdio. For some reason or another they are in conflict with each other so libertas module should be disabled:
- Code: Select all
nano /etc/modprobe.d/blacklist.conf
# add lines:
# Do not load, because it conflicts with btmrvl_sdio driver.
blacklist libertas_sdio
On the other hand it requires binary firmware from marvell. The file sd8688.bin and sd8688_helper.bin are used by btmrvl module and must be available under /lib/firmware directory. If they are missing you will see an error message in dmesg output. To solve this first install linux-firmware package, then create symlinks for them like this:
- Code: Select all
cd /lib/firmware
ln -s libertas/sd8688.bin sd8688.bin
ln -s libertas/sd8688_helper.bin sd8688_helper.bin
5.1.1. Turning the LED on/off using systemd
This will turn on the blue LED of the Dreamplug when bluetooth.service is started at boot time. Put the following text into bluetooth-led.service file under /etc/systemd/system directory.
[Unit]
Description=Bluetooth LED service
Requires=bluetooth.service
After=bluetooth.service
[Service]
Type=oneshot
ExecStart=/bin/bash -c 'echo "timer" > /sys/class/leds/dreamplug\:blue\:bluetooth/trigger; echo "1300" > /sys/class/leds/dreamplug\:blue\:bluetooth/delay_off'
RemainAfterExit=yes
ExecStop=/bin/bash -c 'echo "none" > /sys/class/leds/dreamplug\:blue\:bluetooth/trigger'
[Install]
WantedBy=bluetooth.target
If you want to get the LED service started after manually starting bluetooth.service then do the following:
- Code: Select all
cp /usr/lib/systemd/system/bluetooth.service /etc/systemd/system
nano /etc/systemd/system/bluetooth.service
# append the next line to the [Install] section:
# Also=bluetooth-led.service
systemctl restart bluetooth.service
5.2. U-Boot environment variables in linux
It is possible to read and write U-Boot environment variables in linux. To do this first install uboot-envtools package, then configure it like this:
- Code: Select all
nano /etc/fw_env.config
# MTD device name Device offset Env. size Flash sector size
/dev/mtd1 0x0000 0x1000 0x1000
6. Download compiled binaries
If you just want to give a try without building from source code, you can download the binaries from here:
http://ubuntuone.com/33ble0BR5FRhYNWU5uTwTv
7. References
[1] http://gcc.gnu.org/
[2] http://www.spinics.net/lists/arm-kernel/msg177648.html
[3] http://wiki.gentoo.org/wiki/DreamPlug
[4] http://www.madore.org/~david/linux/dreamplug.html
