Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Installing Debian 12 on a Banana Pi M5

3 views
Skip to first unread message

Marco d'Itri

unread,
Apr 9, 2023, 10:46:04 PM4/9/23
to
I recently bought a Banana Pi BPI-M5[0], which uses the Amlogic S905X3
SoC{0}: these are my notes about installing Debian on it.

While this SoC is supported by the upstream U-Boot[1] it is not
supported by the Debian U-Boot package, so debian-installer does not
work. Do not be fooled by seeing the DTB file for this exact board
being distributed with debian-installer: all DTB files are, and it does
not mean that the board is supposed to work.

As I documented in #1033504[2], the Debian kernels are currently
missing some patches needed to support the SD card reader.

I started by downloading an Armbian Banana Pi image[3] and booted it
from an SD card. From there I partitioned the eMMC, which always
appears as /dev/mmcblk1:

parted /dev/mmcblk1
(parted) mklabel msdos
(parted) mkpart primary ext4 4194304B -1
(parted) align-check optimal 1
mkfs.ext4 /dev/mmcblk1p1


Make sure to leave enough space before the first partition, or else
U-Boot will overwrite it: as it is common for many ARM SoCs, U-Boot
lives somewhere in the gap between the MBR{1}[4] and the first
partition.

I looked at Armbian's /usr/lib/u-boot/platform_install.sh and installed
U-Boot by manually copying it to the eMMC:

dd if=/usr/lib/linux-u-boot-edge-bananapim5_22.08.6_arm64/u-boot.bin
of=/dev/mmcblk1 bs=1 count=442
dd if=/usr/lib/linux-u-boot-edge-bananapim5_22.08.6_arm64/u-boot.bin
of=/dev/mmcblk1 bs=512 skip=1 seek=1


Beware:Armbian's U-Boot 2022.10 is buggy[5], so I had to use an older
image.

I did not want to install a new system, so I copied over my old
Cubieboard install[6]:

mount /dev/mmcblk1p1 /mnt/
rsync -xaHSAX --delete --numeric-ids root@old-server:/ /mnt/
--exclude='/tmp/*' --exclude='/var/tmp/*'


Since the Cubieboard has a 32 bit CPU and the Banana Pi requires an
arm64 kernel I enabled the architecture and installed a new kernel:

dpkg --add-architecture arm64
apt update
apt install linux-image-arm64
apt purge linux-image-6.1.0-6-armmp linux-image-armmp


At some point I will cross-grade the entire system.Even if ttyS0 exists
it is not the serial console, which appears as ttyAML0 instead.
Nowadays systemd automatically start a getty if the serial console is
enabled on the kernel command line[7], so I just had to disable the old
manually-configured getty:

systemctl disable serial...@ttyS0.service


I wanted to have a fully working flash-kernel[8], so I used Armbian's
boot.scr as a template to create
/etc/flash-kernel/bootscript/bootscr.meson and then added a custom
entry for the Banana Pi to /etc/flash-kernel/db:

Machine: Banana Pi BPI-M5
Kernel-Flavors: arm64
DTB-Id: amlogic/meson-sm1-bananapi-m5.dtb
U-Boot-Initrd-Address: 0x0
Boot-Initrd-Path: /boot/uInitrd
Boot-Initrd-Path-Version: yes
Boot-Script-Path: /boot/boot.scr
U-Boot-Script-Name: bootscr.meson
Required-Packages: u-boot-tools


All things considered I do not think that I would recommend to Debian
users to buy Amlogic-based boards since there are many other better
supported SoCs.


[0] https://wiki.banana-pi.org/Banana_Pi_BPI-M5
[1]
https://source.denx.de/u-boot/u-boot/-/blob/master/doc/board/amlogic/odroid-c4.rst
[2] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1033504
[3] https://www.armbian.com/bananapi-m5/
[4] https://en.wikipedia.org/wiki/Master_boot_record
[5]
https://forum.armbian.com/topic/27812-u-boot-202210-armbian-hangs-when-a-usb-hard-disk-is-connected/
[6] http://blog.bofh.it/debian/id_440
[7]
https://manpages.debian.org/unstable/systemd/systemd-getty-generator.8.en.html
[8] https://packages.debian.org/sid/flash-kernel

{0} System on Chip
{1} Master Boot Record

Permalink: https://blog.bofh.it/debian/id_466
0 new messages