Release date: 2019-01-05
As of December 2018 it is possible to install a 64bit Debian Linux arm64 with a Debian or Vanilla Kernel on the RaspberryPi 3 Model B+ without the need to use a super-specialised distribution. You will need exactly three closed source files from the RaspberryPi Foundation, the rest of the system can be a regular Debian Linux arm64. Booting a system like this with u-boot is not straight forward but possible once you understood the syntax. In the following lines I will try to give you some additional information concerning this issue.
You will need a 16 GB SD-card, a host system with a recent Debian Linux and a working SD-card reader to perform the installation. I recommend two-partition installation, using vfat for the first partition and ext4 for the second. All data on the sd-card will be erased!
Theoretically it would also be possible to use the "stable" distribution of Debian Linux if you do not want to use "testing", but you should use at least "buster" which 12/2018 is "testing". To change, switch testing to stable in the qemu-debootstrap and sources.list entries.
You use all of this information at your own risk!!! There is absolutely no warranry!!!
RaspberryPi 3 B+ BOOT Archive
I collected some files which proved to be very helpful for setting up a RaspberryPi 3 B+ and packaged them in this archive. Please feel free to use them. It is absolutely possible that the contents may be outdated by the time you are planning to use them.
Nota bene: As of 12/2018 blacklisting of the vc4-module (see boot.cmd) is necessary to boot and the internal wifi is not working. Most probably both things are going to change.
Released: | 31 Dec 2018 by Bodo Giannone (http://www.giannone.ch) |
Download: | rpi-3b_plus_boot_2018_12_31.tgz |
SHA1-SUM: | 129ec3e721477b73ba40af61c6b14f9f7cb7a8d4 |
Contents: |
File | Description |
---|---|
boot.cmd | recommended boot script (raw file) |
bootcode.bin | firmware (from https://github.com/raspberrypi/firmware/blob/master/boot/bootcode.bin) |
boot.scr | recommended boot script (image file) |
brcmfmac43455-sdio.tgz | firmware needed for internal wifi (from Raspbian Linux) |
config.txt | configuration file for firmware |
fixup.dat | firmware (https://github.com/raspberrypi/firmware/blob/master/boot/fixup.dat) |
gen_boot.scr | script to create the boot script image file |
start.elf | firmware (https://github.com/raspberrypi/firmware/blob/master/boot/start.elf) |
Prepare the host-system
aptitude install u-boot-tools qemu-user-static debootstrap |
Prepare the client-system
dd if=/dev/zero of=${card} bs=1M count=10 |
/sbin/sfdisk --label dos ${card} <<\EndOfFile |
,128m,c |
, |
EndOfFile |
/sbin/mkfs.ext4 "${card}2" |
/sbin/tune2fs -c0 -i0 "${card}2" |
mount "${card}2" /mnt -o rw |
/sbin/mkfs.vfat "${card}1" |
/sbin/mkdir -p /mnt/boot/fat |
mount "${card}1" /mnt/boot/fat -o rw |
Install Debian Linux on the client-system
/usr/sbin/qemu-debootstrap --include=net-tools,wpasupplicant,aptitude,joe,linux-image-arm64,locales,console-data,tzdata,console-setup,keyboard-configuration,aptitude,dbus,u-boot-rpi,u-boot-tools,u-boot-menu,firmware-linux,sudo --arch arm64 --components=main,contrib,non-free testing /mnt http://ftp.debian.org/debian |
cp bootcode.bin fixup.dat start.elf /mnt/boot/fat |
cp /mnt/usr/lib/u-boot/rpi_3/u-boot.bin /mnt/boot/fat |
mkdir -p /mnt/lib/firmware/brcm |
zcat brcmfmac43455-sdio.tgz | (cd /mnt/lib/firmware/brcm && tar -x ) |
Configure the client-system
(You need to create the following files)
cat <<\EndOfFile > /mnt/boot/fat/config.txt |
arm_64bit=1 |
kernel=u-boot.bin |
enable_uart=1 |
EndOfFile |
cat <<\EndOfFile > /mnt/boot/fat/boot.cmd |
sysboot mmc 0:2 any ${loadaddr} /boot/extlinux/extlinux.conf |
EndOfFile |
mkimage -A arm -O linux -T script -C none -n boot_script -d /mnt/boot/fat/boot.cmd /mnt/boot/fat/boot.scr |
cat <<\EndOfFile > /mnt/etc/default/u-boot |
U_BOOT_PARAMETERS="console=tty1 rootwait panic=10 net.ifnames=0 dwc_otg.lpm_enable=0 fsck.repair=yes plymouth.ignore-serial-consoles elevator=deadline cma=32M modprobe.blacklist=vc4" |
EndOfFile |
mkdir -p /mnt/boot/extlinux/ |
cat <<EndOfFile > /mnt/boot/extlinux/extlinux.conf |
label linux |
linux /vmlinuz |
initrd /initrd.img |
fdtdir $(realpath /mnt/usr/lib/linux-image-*-arm64 | sed 's|'/mnt'||')/ |
append root=/dev/mmcblk0p2 console=tty1 rootwait panic=10 net.ifnames=0 dwc_otg.lpm_enable=0 fsck.repair=yes plymouth.ignore-serial-consoles elevator=deadline cma=32M modprobe.blacklist=vc4 |
EndOfFile |
cat <<\EndOfFile > /mnt/etc/fstab |
# /etc/fstab: static file system information. |
# |
#<file system> <mount point> <type> <options> <dump> <pass> |
/dev/mmcblk0p2 / ext4 errors=remount-ro,relatime 0 1 |
/dev/mmcblk0p1 /boot/fat vfat errors=remount-ro,relatime 0 2 |
tmpfs /tmp tmpfs defaults,auto 0 0 |
EndOfFile |
cat <<\EndOfFile >> /mnt/etc/network/interfaces |
auto lo |
iface lo inet loopback |
allow-hotplug eth0 |
iface eth0 inet dhcp |
allow-hotplug wlan0 |
allow-hotplug wlan1 |
iface wlan0 inet dhcp |
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf |
iface wlan1 inet dhcp |
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf |
EndOfFile |
cat <<\EndOfFile > /mnt/etc/apt/sources.list |
deb http://ftp.debian.org/debian testing main contrib non-free |
deb http://security.debian.org/ testing/updates main contrib non-free |
EndOfFile |
cat <<\EndOfFile > /mnt/etc/hostname |
raspberrypi |
EndOfFile |
cat <<\EndOfFile > /mnt/etc/rc.local |
#!/bin/sh |
passwd --quiet --delete root && |
yes | aptitude install && |
( rm -r /debootstrap > /dev/null 2>&1; exit 0; ) && |
/usr/sbin/u-boot-update && |
cp /etc/profile /etc/profile.SIC && |
/bin/echo -e 'dpkg-reconfigure locales keyboard-configuration tzdata console-setup &&\n\nmv /etc/profile.SIC /etc/profile\n' >> /etc/profile && |
/bin/echo -e '#!/bin/sh\n\nexit 0' > /etc/rc.local |
exit 0 |
EndOfFile |
chmod 755 /mnt/etc/rc.local |
Completing the installation
for i in etc/bash.bashrc etc/profile etc/skel/.bashrc etc/skel/.profile root/.bashrc root/.profile; do /bin/echo -e "\nalias dir='ls -ahl --color'\n" >> /mnt/$i; done |
umount /mnt/boot/fat |
umount /mnt |
passwd root |
adduser pi |
adduser pi sudo |
wpa_passphrase ${ssid} ${passphrase} > /etc/wpa_supplicant/wpa_supplicant.conf |
aptitude update |
aptitude full-upgrade |
aptitude install task-lxde-desktop |
References
https://github.com/raspberrypi/firmware/tree/master/boot
https://raspberrypi.stackexchange.com/questions/74896/u-boot-for-raspberry-pi-3
https://elinux.org/RPi_U-Boot#Copy_U-Boot_to_your_SD_card
https://www.raspberrypi.org/documentation/configuration/config-txt/README.md
https://wiki.debian.org/Arm64Port#Unofficial_Debian-ports_bootstrap
https://github.com/Debian/raspi3-image-spec/issues/12
https://code.overdrivenetworks.com/blog/2018/07/debian-buster-on-a-raspberry-pi-3-model-b-plus/
http://sunxi.org/Bootable_SD_card#Cleaning
https://wiki.debian.org/InstallingDebianOn/Allwinner
http://wiki.lemaker.org/BananaPro/Pi:Setting_up_the_Linux_distribution_root_file_system
http://linux-sunxi.org/Mainline_Debian_HowTo#Setting_up_the_SD-card
http://linux-sunxi.org/Mainline_U-Boot