AArch64 on Raspberry Pi 2 (rev 1.2), 3B, 3B+


#32

Is /boot/config.txt missing or just in a different location (for the 32-bit armhf image)?


#33

Hi Zacherl, yes config.txt is in /boot/firmware for armhf and arm64. More info here https://wiki.ubuntu.com/ARM/RaspberryPi#Raspberry_Pi_packages

Raspbian and (current versions of) Ubuntu-mate mount the fat partition as /boot, but that requires a few hacks to overcome debian packaging restrictions. It is not a very good thing to do. For this reason debian and Ubuntu server mount the fat partition as /boot/firmware. This is consistent with how things are done on other architectures. For example, efi partitions are mounted at /boot/efi.


#34

Ahh thank you :slight_smile: found it. You seem to have some experience with the custom ubuntu distros for raspi. May I ask you what steps exactly you performed to get from the official image to the 32-bit armhf version you linked?

Did you just exactly follow this guide:
https://wiki.ubuntu.com/ARM/RaspberryPi#Booting_the_official_Pi_2_image_on_the_Pi_3B.2F3B.2B-

Your image works fine on my 3b+ but I want to replace xubuntu with lubuntu (and I do not trust the system to completely remove the old desktop with the commands you posted some answers above).


#35

Yes I booted my 3B following those instructions. Once I had a working environment I then built the installer in a similar way to https://wiki.ubuntu.com/ARM/RaspberryPi#Building_Raspberry_Pi_3_images . To make the armhf image I did an extra step of an oem install.

If you are just doing this for yourself, then you can start with the server, remove the cloud image stuff (slows boot time) and install lubuntu-desktop.

An even cleaner way is to boot the armhf mini iso. There are several ways you can do this, but probably the simplest is to take the raspi2 kernel vmlinuz and use the mini iso’s initramfs. I can give more instructions if this is something you want to pursue and can’t figure it out.


#36

[quote=“stillwinter, post:35, topic:16853”]There are several ways you can do this, but probably the simplest is to take the raspi2 kernel vmlinuz and use the mini iso’s initramfs. I can give more instructions if this is something you want to pursue and can’t figure it out.
[/quote]

This sounds interesting. Would love to get more instructions.


#37

These are very rough instructions still. It is possible to script this rather nicely, taking advantage of debian’s preseeding to automate the install. The following has been written for armhf, but you can easily adapt it for arm64.

First download the latest kernel packages from Launchpad https://launchpad.net/ubuntu/+source/linux-raspi2/ e.g.

wget https://launchpad.net/~canonical-kernel-security-team/+archive/ubuntu/ppa/+build/15482714/+files/linux-image-4.15.0-1024-raspi2_4.15.0-1024.26_armhf.deb
wget https://launchpad.net/~canonical-kernel-security-team/+archive/ubuntu/ppa/+build/15482714/+files/linux-modules-4.15.0-1024-raspi2_4.15.0-1024.26_armhf.deb

Next, create a working directory and extract vmlinuz and the dtb files

dpkg-deb -x linux-image-[0-9]*raspi2*.deb /tmp/pi-kernel
dpkg-deb -x linux-modules-[0-9]*raspi2*.deb /tmp/pi-kernel
mkdir pi-installer
cd pi-installer
RASPI_VER="$(ls /tmp/pi-kernel/boot/vmlinuz* | sed 's,^\/tmp\/pi-kernel\/boot\/vmlinuz-,,g')"
# Note, in arm64 device tree files are in a broadcom folder
cp /tmp/pi-kernel/lib/firmware/$RASPI_VER/device-tree/bcm2710*.dtb .
cp /tmp/pi-kernel/boot/vmlinuz-$RASPI_VER vmlinuz
# Copy the device-tree overlays too if you need them

Download the Pi’s bootloader files - https://wiki.ubuntu.com/ARM/RaspberryPi#Updating_the_Pi_GPU_firmware_and_bootloader_files - and save to pi-installer

Create a cmdline.txt with your favourite text editor. Paste in:

grub-installer/skip=true partman-swapfile/size=1024 partman-swapfile/percentage=10 --- quiet net.ifnames=0 dwc_otg.lpm_enable=0 modprobe.blacklist=sdhci_iproc

Create a config.txt with the contents:

# boot in AArch64 (64-bit) mode
#arm_64bit=1

# Kernel and initramfs
kernel=vmlinuz
initramfs initrd.img followkernel

# Enable audio (loads snd_bcm2835)
dtparam=audio=on

Download the initrd for the mini/netboot installer

wget http://ports.ubuntu.com/dists/bionic/main/installer-armhf/current/images/generic-lpae/netboot/initrd.gz

I’ll assume you have an Ethernet connection you can use, but if you want to do this over wifi then you need the files for your machine https://wiki.ubuntu.com/ARM/RaspberryPi#WiFi and follow https://help.ubuntu.com/lts/installation-guide/armhf/ch06s04.html or maybe https://wiki.debian.org/DebianInstaller/NetbootFirmware

This is enough to get the installer started since the raspi2 kernel has a lot of modules built in. However, you’ll probably find you get stuck at the detecting disks stage. I’m guessing this is due to missing modules.

The debian-installer doesn’t use standard deb packages, but expects everything to be packaged up as udebs. This includes lots of kernel udebs that include the modules. Unfortunately the raspi2 kernel doesn’t have any udeb module packages. A way around this is to copy all the kernel modules into the initrd:

# evbug spams the logs, get rid
rm /tmp/pi-kernel/lib/modules/$RASPI_VER/kernel/drivers/input/evbug.ko

# Generate modules.dep etc files
depmod -a -b /tmp/pi-kernel -F /tmp/pi-kernel/boot/System.map-$RASPI_VER $RASPI_VER

# Remove unneeded files
rm -r /tmp/pi-kernel/lib/modules/$RASPI_VER/initrd 
rm -r /tmp/pi-kernel/boot
rm -r /tmp/pi-kernel/usr
rm -r /tmp/pi-kernel/lib/firmware/$RASPI_VER

# Add raspi2 modules to the initrd and compress
gunzip initrd.gz
find /tmp/pi-kernel/.  | sed 's,^/tmp/pi-kernel\/,,g'| cpio -D /tmp/pi-kernel -R +0:+0 -H newc -o -A -F initrd
gzip initrd

We can save a few future steps if we change the name of initrd.gz to initrd.img

mv initrd.gz initrd.img

Format an SD card with MBR/msdos partition table. Create fat partition as partition 1. Create Linux partition as partition 2.

Copy everything you have in pi-installer to the fat partition. Stick it in the pi and turn on! There is a very long pause at the rainbow screen because the initrd is huge with all the kernel modules. You should eventually see the debian installer.

There will be a warning message about the lack of kernel modules. Skip it. Choose manual partitioning and give partition 1 the mount point /boot/firmware. Don’t format it. Give partitition 2 the mount point /

If I’m installing a desktop then I choose the “no automatic updates” option.

Eventually the installer will hit an error at the “Make system bootable” stage. Drop to a shell using the menu option.

Create a new cmdline.txt

# if you are installing to a usb drive use root=/dev/sda2
echo "root=/dev/mmcblk0p2 $(echo $(user-params)) elevator=deadline rootwait ro" > /target/boot/firmware/cmdline.txt

If you have a 3B+ then you need to add an entry to the flash-kernel database. See https://wiki.ubuntu.com/ARM/RaspberryPi#Update_flash-kernel_database for more details.

nano /target/etc/flash-kernel/db

Remove the installer initrd.img and vmlinuz just in case the fat partition is on the small side

rm /target/boot/firmware/initrd.img
rm /target/boot/firmware/vmlinuz

Currently the generic-lpae kernel is installed on the target system. We need to install the raspi2 kernel:

mount -o bind /dev /target/dev
#This next command turns the screen black.  Wait for the cursor to appear in the bottom left of the screen.
#Install linux-raspi2 if you need the header packages
apt-install linux-image-raspi2
umount /target/dev

If the above was successful there should be an initrd.img and vmlinuz on the fat partition:

ls /target/boot/firmware

Return to the menu by typing exit. Select the “Skip bootloader” option. Finish the install and reboot!

Once in the installed system, the final thing we need to do is remove the generic kernel:

OLD_KERNEL="$(readlink /boot/vmlinuz.old | sed 's,^vmlinuz-,,g')"
sudo apt-get --autoremove purge linux-generic-lpae linux-image-generic-lpae linux-headers-generic-lpae linux-image-$OLD_KERNEL linux-headers-$OLD_KERNEL linux-modules-$OLD_KERNEL linux-modules-extra-$OLD_KERNEL

That’s it! Phew!


Other Ubuntu Alternatives for RPI3B+?
Audio Output Mono instead of Stereo (Ubuntu 18.04.1 - RPi)
#38

Thank you for creating this. I’m new to raspberry pi and ubuntu so this has been helpful. I used the xubuntu-core-18.04-preinstalled-desktop-armhf+raspi2.img.xz and when I power on my pi 3 b+ I get these messages

[ 2.840838] Error: Driver ‘sdhost-bcm2835’ is already registered, aborting…
[ 4.322842] hub 1-1.1.2:1.0: hub_ext_port_status failed (err = -71)
[ 4.323049] usb 1-1.1.2: Failed to suspend device, error -71
[ 5.310902] hub 1-1.1.2:1.0: hub_ext_port_status failed (err = -71)
[ 5.311136] usb 1-1.1.2: Failed to suspend device, error -71

Is there something I can do to fix this?


#39

The sdhost error is nothing to worry about, but I did raise a bug about it. To my extreme annoyance they didn’t fix it, even though I submitted a patch to the kernel mailing list. I think it just looks really sloppy not to fix an obvious error. You could maybe get rid of it by creating a device tree overlay?..

The hub errors…no idea. Do you have a usb hub attached?


#40

the usb hub was part of my keyboard. I’ve got a command line (initramfs) is this where I enter my username, location, etc.?


#41

Do you mean you haven’t booted to a graphical interface? I’ll have to get my head around what could have gone wrong…I created the image ages ago, haven’t used it much since then!


#42

No it’s going right to a command line rather than a graphical interface, I get a blue screen with a xubuntu label a loading circle.


#43

Any error messages other than what you’ve already written?

How did you write the image to disk?


#44

I used win32DiskImager. I’m not getting any other messages. It displays after the Errors
“BusyBox v1.27.2 (Ubuntu 1:1.27.2-2ubuntu3) built-inshall (ash)
Enter ‘help’ for a list of built-in commands.”


#45

Have you tried booting without the keyboard attached to see if the usb hub messages are significant?

If that still doesn’t work, re-attach the keyboard and when you are at the blue splash screen press the escape key. You may possibly see an error message.

I can’t think why it is not working. Really strange. I’ll have a sleep on it.


#46

With the keyboard it gets rid of the usb hub messages but it still takes me to the command line after the splash screen is up for about 20 seconds.


#47

You usually hit busybox if it can’t find the root filesystem. If you do a search there is plenty of info on the net e.g. https://askubuntu.com/questions/137655/boot-drops-to-a-initramfs-prompts-busybox

It’s usually the filesystem has been corrupted, or the device is being super slow to power up. At the moment I can’t think of anything else.


#48

Just to demonstrate you can install any desktop environment, here's the latest kde neon desktop running on the pi 3:


Status of Ubuntu MATE 18.04 for Raspberry Pi 3 B & B+?
#49

I know this is the wrong forum to express this, but you have to admit kwin is impressive. There’s not many window managers that can be used under Wayland on the pi 3!


#50

Thanks for putting this together. Nice to have Xubuntu running on my 3B+.
What needs to be done after install to get wired ethernet to work?
I ran:
sudo ip link set dev eth0 down
sudo dhclient eth0
but wired connection does not function.
Debian networking is not my strong point.
Thanks for any help anyone can offer.


#51

Hi crashyz, Ethernet should just work when you plug the cable in. Xubuntu has a network manager GUI that takes care of it all. Have you edited any text files that may have stopped it working?