Installing the Native Debian “armhf” Architecture on Raspberry Pi 3 Instead of Raspbian

I’m building a product for Algoram with a Raspberry Pi 3 as the embedded processor. In doing so, I wanted to have a path to a clean and current distribution with as little non-free content as possible. Raspbian, the Debian version run on Raspberry Pi up until now, was created because the Pi had an odd floating point format that wasn’t supported by Debian “armhf”. That is not the case with Pi 3, it works fine with “armhf”. And Raspbian has some other issues: not all packages were built, and it’s somewhat out-of-date compared to Debian 8.4 . So, I decided to put native Debian on the platform instead of Raspbian.

What follows contains a lot of copying of files that should be replaced with .deb packages in a special supplementary archive which is installed along with Native Debian. Run this from the March 18 Raspbian image:

# Manually create an ext4 partition for the Debian system, and mount it on /mnt
apt-get install debootstrap
mount /dev/mmcblk0p3 /mnt
debootstrap --arch=armhf jessie /mnt
cp -ar /lib/modules /mnt/lib
cp -ar /lib/firmware /mnt/lib
cp /etc/fstab /mnt/etc/fstab
# Manually edit /mnt/etc/fstab to mount the proper root partition.
chroot /mnt
mount -t proc proc /proc
apt-get update
apt-get install openssh-server wireless-tools build-essential bluez aptitude bluetooth bluez-hcidump exfat-fuse exfat-utils locales ntpdate fake-hwclock udisks2 wpasupplicant hostapd network-manager dnsmasq rfkill linux-wlan-ng libncurses5-dev bc git
# Manually add a user and set their password, replace $USER below.
adduser $USER
passwd root

If you want to use the serial console, for example if you plan to replace the kernel and need to see its output while booting, you should also edit /boot/config.txt to add this as the last line:

dtoverlay=pi3-miniuart-bt

That will move /dev/ttyAMA0 to the serial0 alias and I/O pins 14 and 15 instead of /dev/ttyS0. On Pi 3, /dev/ttyS0 is a “mini-uart” which does not have its own clock generator. It goes off of its normal baud rate due to the dynamic clock frequency of the CPU. A side-effect of this is that Bluetooth is disabled, because /dev/ttyAMA0 was dedicated to the Bluetooth HCI (Host-Controller Interface) on Pi 3. A Bluetooth USB dongle is probably the best solution.

What doesn’t work:

Graphics, the display, the HDMI port.
Bluetooth.

What we need to do next:

Create a supplementary Debian repository for this work.

Bring over packages for firmware (put it in non-free) kernel, free libraries, pi-specific-bluetooth, and utilities.

Get the upstream 4.6 kernel running.

Get the Open Source OpenGL driver running.

Move over the uboot that someone recently got working.

Don’t attempt to get Debian to accept it at this time, make the whole thing work first and then once it’s stable ask some nice DD to move it over.  I don’t have time to be a DD again.

Ambitious stuff I won’t be able to do right away unless others want to help:

Take the documentation that Broadcom released on the GPU and a little reverse-engineering, and write a replacement for bootcode.bin that minimally boots uboot on the ARM without doing anything about graphics. Release as Free Software.

Figure out how to load the Broadcom graphics kernel in the same way that Linux loads the rest of its firmware from /lib/firmware .

Profit! (No really, I have a hardware product to sell.)