Background
I have just bought the newest Raspberry Pi 3 Model B+. I played with NOOBS but I like Ubuntu MATE more
So I went to the download page and got ubuntu-mate-16.04.2-desktop-armhf-raspberry-pi.img.xz
image file. I did not know yet that it is not supported on Raspberry Pi 3 Model B+. Then I tried to perform some search here and on RaspberryPi.org forums. Both recommend to download special image for 3 B+ (another 4.32 Gb, see for example this post by MaxVMH here or on RasperryPi.org).
But from reading post on RaspberryPi.org forum I decided to somehow run rpi-update
on the downloaded 16.04.2 image.
Below is my method.
Method
Prepare host
We need to use Ubuntu 18.04 LTS, and install QEMU components to it.
sudo apt-get update
sudo apt-get install qemu-user-static kpartx
As we already have downloaded ubuntu-mate-16.04.2-desktop-armhf-raspberry-pi.img.xz
, we can unpack it:
cd ~/Downloads
unxz ubuntu-mate-16.04.2-desktop-armhf-raspberry-pi.img.xz
then create corresponding loop-devices for it:
sudo kpartx -a -v ubuntu-mate-16.04.2-desktop-armhf-raspberry-pi.img
Then we will mount virtual SD card partitions to the system.
Mount RPi SD card to the host system
At first we need to determine their names and block devices (we need PI_BOOT
and PI_ROOT
):
$ sudo lsblk --fs
NAME FSTYPE LABEL UUID MOUNTPOINT
loop0
├─loop0p1 vfat PI_BOOT EAD0-90DA
└─loop0p2 ext4 PI_ROOT 9d97a4df-a4eb-4b09-92b6-bb1ccfade0ee
Then mount them
sudo mount /dev/mapper/loop0p2 /mnt/
sudo mount /dev/mapper/loop0p1 /mnt/boot/
Copy QEMU part to the RPi file-system and copy resolv.conf
to have network in the chroot:
sudo cp /usr/bin/qemu-arm-static /mnt/usr/bin/
sudo cp /etc/resolv.conf /mnt/etc/resolv.conf
Prepare for chrooting and then go to chroot
sudo mount --bind /dev /mnt/dev/
sudo mount --bind /dev/pts /mnt/dev/pts
sudo mount --bind /sys /mnt/sys/
sudo mount --bind /proc /mnt/proc/
sudo chroot /mnt
Run rpi-update
inside chroot:
rpi-update
To get Wi-Fi working (preventing kernel: [ 11.013103] brcmfmac mmc1:0001:1: Direct firmware load for brcm/brcmfmac43455-sdio.txt failed with error -2
error) according this AskUbuntu answer we need to download the mentioned file and save it as /lib/firmware/brcm/brcmfmac43455-sdio.txt
while being in chroot:
wget https://github.com/khadas/android_hardware_amlogic_wifi/raw/b6709758755568e4a0ff6e80993be0fc64c77fb9/bcm_ampak/config/6255/nvram.txt -O /lib/firmware/brcm/brcmfmac43455-sdio.txt
Then exit from chroot:
exit
Unmount SD Card from host system
Sync data and unmount all directories:
sync
cd ~/Downloads
sudo umount /mnt/dev/pts
sudo umount /mnt/dev
sudo umount /mnt/proc
sudo umount /mnt/sys
sudo umount /mnt/boot
sudo umount /mnt
And finally remove loop-devices with
sudo kpartx -d -v ubuntu-mate-16.04.2-desktop-armhf-raspberry-pi.img
and write this image as usual (with ddrescue
or with GNOME Disks).
Boot modified SD Card in RPi
Insert modified SD Card into Raspberry and follow wizards on the screen. Wait them to finish. Insert Ethernet cable to the Raspberry.
Then login to the system and run:
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get clean
sudo apt-get autoremove
As the result we have working upgraded Ubuntu 16.04.5 LTS MATE which is fully functional on our Raspberry Pi 3 Model B+. So all things (Wi-Fi, Ethernet, HDMI, 3.5mm sound, USB) work as expected.
Hope this helps both Raspberry and Ubuntu MATE community