I was given a Medion MD86517 NAS without a drive for free. I wanted to put a 2.5" disk in it, and use it as a web-server. The NAS runs Linux, and the sources are here.

A large part of the installation was done on a regular Gentoo x86/x64 PC, using a SATA to USB converter. Start with a clean drive with no partitions, connected to the host computer (Not the NAS).

During the install, I have aimed to have all files needed for a new intall, located on the NAS drive itself, in the hopes that it will make a reinstall, easier. You can of course remove these files from /usr/src, if you do not want this.

Much of this stuff needs root permissions, and all the NAS side stuff is done through a serial connection. If something is unclear, read The Gentoo handbook, this is in essence the same procedure, except I boot into the system instead of chrooting.

A lot of thanks and credit to the people in this thread, without whom I would never have gotten on the right track.


To boot from the SATA disk, a special partition layout is needed. The ox820 reads the start of the drive, to check if it is bootable. A script has been written to put the right data in the first part of the hard disk. Download disk creation files created by WarheadsSE, extract the files somewhere, and enter that directory. Edit the disk_create script to change the target drive in the variable disk.

Creating the partitions

Prepare the disk using WarheadsSE's tool.


Fire up fdisk to partition the disk.

fdisk -c=dos /dev/sdb
  • Create a small partition for U-Boot, stage1, and the kernel. WarheadsSE recommends a 10M partition. This partition must start at sector 2048.

  • Create a second partition for the root file system, leave a little space left for a swap partition.

  • Create a third partition for swap space. Set it as swap type.

Format the second and third partition, I use ext4 as the root file system.

mkfs.ext4 /dev/sdb2
mkswap /dev/sdb3

Last, mount the second partition to /mnt/gentoo, your partition may have another designation than /dev/sdb.

cd /mnt
mkdir gentoo
mount /dev/sdb2 /mnt/gentoo

Root file system

Download a stage 3 Gentoo for ARM5, and extract it to /mnt/gentoo. Though the processor is ARM6 compatible, I could not get it to boot beyond the kernel using and ARM6 stage 3.

tar -xvjpf stage3-armv5tel-20140115.tar.bz2 -C /mnt/gentoo

Set the baud rate in /mnt/gentoo/etc/inittab to 115200. Change:

#s0:12345:respawn:/sbin/agetty -L 9600 ttyS0 vt100


s0:12345:respawn:/sbin/agetty -L 115200 ttyS0 vt100

Copy resolv.conf from your host /etc directory, to have DNS working.

cp -L /etc/resolv.conf /mnt/gentoo/etc/resolv.conf

Create a link from net.lo to net.eth0 to enable the network at first boot.

cd /mnt/gentoo/etc/init.d
ln -sf net.lo net.eth0

Edit /mnt/gentoo/etc/fstab to set the devices for the root and swap file system. The file should contain something like this:

#/dev/BOOT              /boot           ext2            noauto,noatime  1 2
/dev/sda2               /               ext4            noatime         0 1
/dev/sda3               none            swap            sw              0 0
#/dev/cdrom             /mnt/cdrom      auto            noauto,ro       0 0
#/dev/fd0               /mnt/floppy     auto            noauto          0 0

Copy passwd and shadow from the running system to have your logins and passwords when you boot the NAS.

cp /etc/passwd /mnt/gentoo/etc/passwd
cp /etc/shadow /mnt/gentoo/etc/shadow
cp /etc/group /mnt/gentoo/etc/group

Select mirrors for portage.

mirrorselect -i -o >> /mnt/gentoo/etc/portage/make.conf
mirrorselect -i -r -o >> /mnt/gentoo/etc/portage/make.conf

Set the timezone.

echo "Europe/Copenhagen" > /mnt/gentoo/etc/timezone

Set the hostanme.

nano -w /mnt/gentoo/etc/conf.d/hostname
nano -w /mnt/gentoo/etc/hosts

Set the keymap (just in case).

nano -w /mnt/gentoo/etc/conf.d/keymaps

Last edit and change UTC to local if needed.

nano -w /etc/conf.d/hwclock


You will need an ARM cross-compiler, Gentoo's crossdev comes in handy.

crossdev -t armv5tel-softfloat-linux-gnueabi

Clone linux-oxnas into /mnt/gentoo/usr/src.

cd /mnt/gentoo/usr/src
git clone https://github.com/kref/linux-oxnas
ln -sf linux-oxnas linux

cd linux-oxnas
make ARCH=arm ox820_defconfig CROSS_COMPILE=armv5tel-softfloat-linux-gnueabi-
make ARCH=arm menuconfig CROSS_COMPILE=armv5tel-softfloat-linux-gnueabi-

Boot options --->
[*] Use appended device tree blob to zImage (EXPERIMENTAL)
[*] Supplement the appended DTB with traditional ATAG information
disable PCI support if you device does not have one

Remember to compile in support for the root file system type, if you did like me this means enabling the ext4 file system.

File system  --->
<*> The Extended 4 (ext 4) filesystem

Compile and create kernel image.

make ARCH=arm zImage ox820-pogoplug-pro.dtb CROSS_COMPILE=armv5tel-softfloat-linux-gnueabi-

cat arch/arm/boot/zImage arch/arm/boot/dts/ox820-pogoplug-pro.dtb > arch/arm/boot/zImage.fdt

scripts/mkuboot.sh -A arm -O linux -C none -T kernel -a 0x60008000 -e 0x60008000 -n 'Linux-3.11.1+' -d arch/arm/boot/zImage.fdt arch/arm/boot/uImage

Final disk creation

Copy WarheadsSE's disk creation files (contents of onax-sata-boot.tar.gz) to the /mnt/gentoo/usr/src.

mkdir /mnt/gentoo/usr/src/disk_create
cp -Rv (Where you unpacked the files)/* /mnt/gentoo/usr/src/disk_create

Integrate the new kernel into WarheadsSE's tool.

cd /mnt/gentoo/usr/src/disk_create
cp /mnt/gentoo/usr/src/linux-oxnas/arch/arm/boot/uImage uImages/gentoo
rm uImage
ln -sf uImages/gentoo uImage

Preparing for first boot

Unmount and sync the disk.

cd /
umount /mnt/gentoo

Remove the drive from the host computer and physically install it in the NAS.

First Boot

Set the clock. MMDDhhmmCCYY is month, date, hour, minute, century, year

date MMDDhhmmCCYY

Get the portage tree.

emerge --sync

Set the Profile.

eselect profile list

I selected default/linux/arm/13.0/armv5te.

eselect profile set 18

Configure the locales, first put the locales you want supported in locale.gen.

nano -w /etc/locale.gen

Generate the locales and select the system-wide one.

eselect locale list
eselect locale set *locale nr.*
env-update && source /etc/profile

Add the network interface to the startup.

rc-update add net.eth0 default

Update and install some needed stuff.

emerge -uDNv world ntp cronie syslog-ng openssh logrotate dhcpcd

Add it to the startup.

rc-update add syslog-ng default
rc-update add cronie default
rc-update add sshd default
rc-update add ntp-client default
rc-update add swclock boot
rc-update del hwclock boot

The end

You now have a basic Gentoo system running, from here you can install a web server, a DLNA server, or whatever you want.

A friend of mine had an iPhone 3 that was getting really flaky, it was still running IOS 3.1.2 as she was afraid to update, things could go wrong, she could lose all her texts. What she wanted was essentially a PDF with her messages.

I went searching and found some tools ranging in price from $5 to $20, but I was stubborn and cheap, and wanted another solution. There are some free services where you upload a file from an iTunes backup to some web application and it'll extract the texts for you. Neither I, nor my friend wanted all her texts uploaded to a service on the net.

From there I found out the file, that the web app uses, is actually an SQL database file. If you ask iTunes to make an unencrypted backup to your local drive, most of the backup files are actually in easily understandable formats like SQL and jpeg. The location of these files are:

  • Windows XP: \Documents and Settings\USERNAME\Application Data\Apple Computer\MobileSyncBackup\
  • Windows Vista, 7 or 8: \Users\USERNAME\AppData\Roaming\Apple Computer\MobileSync\Backup\
  • MacOS X: \~/Library/Application Support/MobileSync/Backup/

It turns out the file named 3d0d7e5fb2ce288813306e4d4636395e047a3d28.mddata is in fact an SQL database file with all text messages in the backup. After eyeballing the file with SQLite Database Browser, exporting it to a CSV file, importing it in LibreOffice Calc, I found it hard to manage the more than 30,000 messages that way.

In the end I made a python script that saves the messages to text files, each having the address (phone nr.) of the person you were conversing with. I am unsure how it handles MMS messages, I know that the multimedia content is lost, and I think the text is lost aswell, but I don't know. The result is here:

GitHub link

When using the Enrf24 library with Enegia these are the connections for the NRF24L01 module.

NRF24L01 MSP430 Stellaris
CE P2.0 PE1
CSN P2.1 PE2
SCK P1.5 PD0
IRQ P2.2 PE3

As I have mentioned, I am building a MIDI controller using the PIC18F4550. The controller has a MIDI in port, and acts as a MIDI to USB converter as well.


  • 10 potentiometers (knobs)
  • MIDI in
  • USB MIDI interface

Missing hardware:

  • Drill and mount the front panel
  • Create and mount the PCB
  • Mount the guts in the case

Missing firmware:

  • Active sense handling
  • MIDI channel selection

As always more details, source code, schematic, and PCB will follow.

I am in the process of building a MIDI USB device, using a PIC18F4550. I have trimmed the Microchip USB framework MIDI example, and is using this code as my base. It is a blessing to not have to code the entire USB stack with descriptors, from scratch, but it is a pain using someone elses code, and learning to use this framework as a sort of black box.

The goal is a combined MIDI to USB converter and knob box.


MIDI is an interface for sending musical notations and messages through a wire. I will only brush up on the protocol of MIDI in this text.

A MIDI message consists of a status byte and up to 2 data bytes, the protocol is serial, and runs at 31250 baud. A table with all messages can be found here. On thing that was not obvious to me was that only the bytes needed are send, no zeroes. As an example an "active sense" message only sends the status byte. This may seem obvious, but starting from the USB side of this stuff made it seem otherwise.

Another thing that I wasted a fair amount of time discovering, is "running status". When you sent the same voice or mode command multiply times you can omit the status byte from all but the first message.  An example, you want to sent "note on" on channel 1, key number 60, and a velocity of 128, when a key is pressed. Then "note on" on channel 1, key number 60, and a velocity of 0, when a key is depressed. For the second package you only send the data, e.g. key number 60, velocity 0, the receiver assumes the status and channel are the same as the first message.


MIDI packages on the USB cable are 4-byte fixed length packages, unused bytes are zeroed. The first byte is the cable number (16 virtual cables) and the Code Index Number, which acts sort of the same as the first 4 bits of a MIDI status. The following 3 bytes are an ordinary midi message. The standard is here.


For a long time, a note on page 17 of the USB MIDI standard eluded me. I thought that since the  Code Index Number almost mirrors the ordinary status of a MIDI message, I would have to parse and classify every message coming from the MIDI port. It turns out that you can send each byte received along without out classifying it, and set the Code Index Number to 0xF. Using this Code Index Number every byte received on the MIDI port is simply packaged in a 4 byte package, first 4 bits, the cable number, then 0xF, then the byte from the MIDI port, and in the end padded with 2 zero bytes.

I have some PIC18F4550s lying around, and I want to play with the USB features of this chip, therefore I made this breakout board. It contains enough components to get the PICMicro running, and nothing more, all the pins are routed to pin-headers to use with an experimenter board.


  • ICSP connector (In-Circuit Serial Programming, AKA PicKit 2 & 3)
  • USB-B Connector
  • 20Mhz clock crystal

Eagle files:  PIC18F4550 USB ICSP breakout board

Energia IDE

I never really caught on to the Arduino craze, not because of any dislikes as such, but because I was familiar with Microchips PICMICRO range. I had the parts, the programmer, and the knowledge to program them in both asm and C, so I guess I have had no need for the Arduino platform.

It turns out that the Arduino IDE has been ported to both the Stellaris Launchpad, and the MSP430 Launchpad from Texas Instruments. and is called Energia. This is nice, since it is then quite easy to port the vast amount of sketches and libraries from the Arduino IDE to Energia IDE and the Texas Instruments Launchpads.

Getting it going on Gentoo Linux

First to run Energia, 32-bit java support is needed, so


needs to be emerged. When running Energia you must make sure


is selected as user VM with eselect. Create a file called /etc/udev/rules.d/62-stellarpad.rules with these contents:

ATTRS{idVendor}=="1cbe", ATTRS{idProduct}=="00fd", MODE="0660", GROUP="plugdev"

Reload udev and add yourself to the "plugdev" group, plug-in in the Launchpad and you should be good to go!

Generated on 2017-03-19 22:52:04.499830