RaspberryPi3

Differences between revisions 2 and 3
Revision 2 as of 2016-05-05 05:31:50
Size: 4881
Editor: fo0bar
Comment:
Revision 3 as of 2016-05-05 15:53:55
Size: 4881
Editor: fo0bar
Comment:
Deletions are marked like this. Additions are marked like this.
Line 5: Line 5:
The [[ARM/RaspberryPi|Raspberry Pi]] 3 was released in early April 2016, shortly before the release of Ubuntu 14.04 (Xenial) LTS, but too short to have proper support. It is possible to run Xenial's kernel and a full Ubuntu installation, but it requires replacing the firmware, bootloader and some other hacks. The [[ARM/RaspberryPi|Raspberry Pi]] 3 was released in early March 2016, shortly before the release of Ubuntu 14.04 (Xenial) LTS, but too short to have proper support. It is possible to run Xenial's kernel and a full Ubuntu installation, but it requires replacing the firmware, bootloader and some other hacks.

Table of Contents

Raspberry Pi 3

The Raspberry Pi 3 was released in early March 2016, shortly before the release of Ubuntu 14.04 (Xenial) LTS, but too short to have proper support. It is possible to run Xenial's kernel and a full Ubuntu installation, but it requires replacing the firmware, bootloader and some other hacks.

While the BCM2710 is a 64-bit CPU, as of this writing there is no firmware or kernel support for it arm64 mode yet. As such, you will be left with a 32-bit installation.

This procedure assumes a working Ubuntu Xenial Raspberry Pi 2 installation. You will be converting a few things over to work on the RPi3, then doing a hardware swap from an RPi2 to an RPi3.

Be sure you have proper backups! This is not a foolproof or well-tested procedure; if it breaks, you get to keep both pieces.

Xenial upgrade procedure

First, grab and install a new u-boot bootloader. The one provided by u-boot-rpi on xenial is not new enough. The one provided on finnie.org is a straight "make rpi_3_32b_defconfig && make" compilation on u-boot's git HEAD (b38eaec53570821043c94ad44eabcb23747d9969 as of this writing), but 2016.05 (still in RC as of this writing) or later should be fine if you want to compile it yourself.

wget -O /tmp/u-boot.bin http://www.finnie.org/software/raspberrypi/ubuntu-rpi3/u-boot-b38eaec.bin
wget -O /tmp/mkknlimg https://raw.githubusercontent.com/raspberrypi/tools/master/mkimage/mkknlimg
chmod 0755 /tmp/mkknlimg 
/tmp/mkknlimg --dtok /tmp/u-boot.bin /boot/firmware/uboot.bin

Likewise, the firmware in xenial multiverse is too old. HEAD should work, but this will download a known good set:

for i in bootcode.bin \
  fixup.dat fixup_cd.dat fixup_db.dat fixup_x.dat \
  start.elf start_cd.elf start_db.elf start_x.elf; do
  wget -O /boot/firmware/${i} https://github.com/raspberrypi/firmware/raw/6832d9a431a98b640accb2b76eac38a420d7c680/boot/${i}
done

Update flash-kernel to recognize and handle the RPi3. flash-kernel on Xenial for the RPi2 would create a compiled uboot.env for u-boot with the same information, but for some reason the newer u-boot will not recognize this uboot.env. So instead, this RPi3 flash-kernel profile will compile a boot.scr, which is functionally identical, but is recognized by the newer u-boot.

cat <<"EOM" >/usr/share/flash-kernel/bootscript/bootscr.rpi3
fdt addr 0x100
fdt get value bootargs /chosen bootargs
setenv kernel_addr_r 0x01000000
setenv ramdisk_addr_r 0x02100000
fatload mmc 0:1 ${kernel_addr_r} vmlinuz
fatload mmc 0:1 ${ramdisk_addr_r} initrd.img
setenv initrdsize $filesize
bootz ${kernel_addr_r} ${ramdisk_addr_r}:${initrdsize} 0x100
EOM

cat <<"EOM" >>/usr/share/flash-kernel/db/all.db

# RaspberryPi3+
Machine: BCM2710
Machine: Raspberry Pi 3 Model B
Machine: Raspberry Pi 3 Model B Rev 1.2
U-Boot-Script-Name: bootscr.rpi3
Required-Packages: u-boot-tools
Boot-Dtb-Path: /boot/firmware/bcm2710-rpi-3-b.dtb
Boot-Kernel-Path: /boot/firmware/vmlinuz
Boot-Initrd-Path: /boot/firmware/initrd.img
Boot-Script-Path: /boot/firmware/boot.scr
DTB-Id: bcm2710-rpi-3-b.dtb
# XXX we should copy the entire overlay dtbs dir too
EOM

rm -f /boot/firmware/uboot.env
flash-kernel

Check that bcm2710-rpi-3-b.dtb and boot.scr have been created in /boot/firmware by flash-kernel.

Modify /boot/firmware/config.txt with at least the following configs:

enable_uart=1
device_tree=bcm2710-rpi-3-b.dtb
device_tree_address=0x100
device_tree_end=0x8000
kernel=uboot.bin
dtparam=i2c_arm=on
dtparam=spi=on

enable_uart is needed by u-boot for all RPi3 modes, even if you have no intention of using a serial console. The device_tree options are needed to explicitly declare the DTB area, as the DTB is slightly larger than 16,128 bytes, and the bootloader otherwise assumes an address space of 0x100 through 0x4000.

Remove linux-firmware-raspi2 (contains now-unusable firmware which would overwrite your local firmware if upgraded), and hold flash-kernel (because of the local modifications).

apt-get --purge remove linux-firmware-raspi2
echo "flash-kernel hold" | dpkg --set-selections

(Optional) Download the WiFi/Bluetooth firmware.

mkdir -p /lib/firmware/brcm
wget -O /lib/firmware/brcm/brcmfmac43430-sdio.txt \
  https://raw.githubusercontent.com/RPi-Distro/firmware-nonfree/master/brcm80211/brcm/brcmfmac43430-sdio.txt
wget -O /lib/firmware/brcm/brcmfmac43430-sdio.bin \
  https://raw.githubusercontent.com/RPi-Distro/firmware-nonfree/master/brcm80211/brcm/brcmfmac43430-sdio.bin

Shut down the system.

poweroff

Swap out the hardware from the RPi2 to the RPi3 and boot.

ARM/RaspberryPi/RaspberryPi3 (last edited 2017-09-26 19:21:30 by adamsmith)