Installation of RetroBSD on a Fubarino SD

This walkthrough documentation assumes you work under a 32 bit virtual machine running Ubuntu Linux, in this case the latest 14.04.1 LTS.1).

Start up the Virtual machine, log in and update with

apt-get update; apt-get -y dist-upgrade; apt-get -y autoremove --purge; apt-get clean

Then install the dependencies for building RetroBSD:

apt-get -y install libusb-1.0-0-dev subversion pkg-config make build-essential unzip git bison byacc flex libelf-dev libfuse-dev minicom

RetroBSD on the Fubarino SD needs two things:

  • The Unix System, think of the kernel in term of your previous Linux experience. This will be flashed (written to) the Fubarino's Flash ROM itself (ie. *not* to the SD card). This will load things (applications, config files and such) from the → filesystem which will reside on the SD card.
  • The filesystem, which holds application files, config files and your user files (ie. text you type and save, …).

Both a filesystem image (think of it as a copy of RetroBSDs filesystem all written together in one file), the Unix “kernel” and a program to flash (ie. write) the Unix kernel to the Fubarino's ROM need to be built from sourcecode. Building applications on a certain type of machine (x86 in our case, that is an 32bit Intel-style desktop processor which your virtualization software emulates) for *another* type of machine (the Fubarino has a PIC32 “processor” on board) is called *crosscompiling*, so we also need a tool to do this for us which we will need to download first (the current stable zip'ed up collection can be found at https://github.com/jasonkajita/chipKIT-cxx/downloads , at the time of writing the below link was the most current):

wget https://github.com/downloads/jasonkajita/chipKIT-cxx/pic32-tools-chipKIT-cxx-master-Linux32-image-20120720.zip
unzip pic32-tools-chipKIT-cxx-master-Linux32-image-20120720.zip -d /usr/local
rm pic32-tools-chipKIT-cxx-master-Linux32-image-20120720.zip

We also need a program to transfer the unix kernel on to the Fubarino; the Fubarino can start into what is called a bootloader mode by pressing the PRG key first, holding it, then pressing the RESET key. The LED will now flash and your Fubarino is ready to accept new code. If you just press RESET the code you uploaded will be run.

git clone https://github.com/sergev/pic32prog.git
cd pic32prog/
make
cd ..

Now for the sourcecode:

git clone https://github.com/RetroBSD/retrobsd.git
cd retrobsd
nano Makefile

Here, change line 35 from

TARGET          ?= $(MAX32)

to

TARGET          ?= $(FUBARINO)

and save the file with Ctrl-X, y, enter.

Build your kernel and filesystem files:

make

This will take a while, please check that your build-process does not end with any error but instead with something like

Allocated partition 1, type b7, start 2, size 204800 sectors
Allocated partition 2, type b8, start 204802, size 4096 sectors
Allocated partition 3, type b7, start 208898, size 204800 sectors
tools/fsutil/fsutil --new --partition=1 --manifest=rootfs.manifest sdcard.img .
Created filesystem at partition 1 of sdcard.img - 102400 kbytes
./.profile: No such file or directory
Installed 36 directories, 525 files, 36 devices, 20 links, 3 symlinks
tools/fsutil/fsutil --new --partition=3 --manifest=userfs.manifest sdcard.img u
Created filesystem at partition 3 of sdcard.img - 102400 kbytes
Installed 0 directories, 1 files, 0 devices, 0 links, 0 symlinks

Now for the fun part of transferring your files on to the Fubarino hardware:

  • Connect the Fubarino to your host-PC via a USB-to-microUsb cable.
  • Press and hold PRG, press RESET, let go once the lED flashes.
  • On your virtual machine, connect the device “www.cpustick.com Stk500v2 [0180]” to your virtual machine.
  • In the virtual machine, issue

lsusb and you should see

(...)
Bus 001 Device 006: ID 0403:a662 Future Technology Devices International, Ltd
(...)

Now burn your files on to the Fubarino's flash ROM:

../pic32prog-read-only/pic32prog -d /dev/ttyACM0 sys/pic32/fubarino/unix.hex

and you should see

Programmer for Microchip PIC32 microcontrollers, Version 1.112
    Copyright: (C) 2011-2014 Serge Vakulenko
      Adapter: STK500v2 Bootloader
 Program area: 1d000000-1d07ffff
    Processor: Bootloader
 Flash memory: 512 kbytes
         Data: 153384 bytes
Program flash: ###################################### done
 Verify flash: ###################################### done
Rate: 9307 bytes per second

Now transfer the filesystem image on to a SD card; connect a USB-to-SD reader to your host PC, then connect the US device to your virtual machine. Issue

dd if=sdcard.img of=/dev/sdx

whereas sdx is your newly inserted SD card.

Once that is done remove the SD card, plug in into your Fubarino's SD slot, press RESET and connect the USB device

Microchip Technology Inc. RetroBSD console [0100]

to your virtual machine, then issue

ls /dev/tty*

and find something like /dev/ttyACM0

sudo minicom -s

→ Settings for serial port, change A - Serial Port to

/dev/ttyACM0

→ E- Bps/Par/Bits to

96008N1

and safe as dfl (default), then exit.

minicom

Press Enter and you should see RetroBSD booting!

1) I myself do this on a MacBook Pro running Virtual Box