I'd like to install "pure" Debian (not Raspberry Pi OS/Raspbian) in a Raspberry Pi 4B.
This is because Raspberry Pi OS diverges too much and makes some stuff in FreedomBox not work fine.
Is that possible? How?
Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It only takes a minute to sign up.
Sign up to join this communityAccording to the Debian Wiki it could be possible, because RPi4 now boots from CPU instead of GPU.
Unfortunately, it seems that currently the Debian kernel does not support the RPi4.
The kernel in use for Bullseye now makes this possible, with some caveats.
I am mostly echoing what Akeo posted, but with a little bit more detail on the non-free firmware. I would stop here but SE frowns on answers with just a link and no explanation.
You can skip this if your RPi 4 is newer than April 2020, or if you just want to wait until other things don't work. If you get as far as the blue screen with an installation option, you don't need to do this.
Follow the instructions here. I found it easiest to boot from a working Raspbian SD card and, as root,
# apt-get update
# apt-get upgrade
# rpi-eeprom-update
# reboot
Be patient. This took a while. I think that the actual update of the EEPROM is during the boot, so you need to wait for it to finish. (Anybody who knows more feel free to jump in and edit this.)
I partitioned a 1TB drive using gparted
to have a 750MiB EXT-32 partition, formatted, and with the ESP flag set. The boot flag was automatically set.
Mount the ESP partition
$ sudo mount /dev/sd${X}1 /mnt
Find and download a recent netinst CD from here. Extract it directly into the partition. If you extract it elsewhere and copy you might accidentally lose some important hidden files.
$ cd /mnt
$ sudo 7z x ~/Downloads/debian-testing-arm64-netinst.iso
Find and download recent firmware from here. Again, extract it directly.
$ sudo 7z x ~/Downloads/RPi4_UEFI_Firmware_v1.27.zip
That much permits the UEFI bootloader to load the Debian installer. But the Debian installer will need the same firmware and won't look in the same place.
$ sudo cp firmware/brcm/* .
Find and download the Debian non-free firmware packages here. Extract them.
$ cd firmware
$ sudo tar xzf ~/Downloads/firmware.tar.gz
Don't forget to unmount:
$ cd
$ sudo umount /mnt
Now plug the USB-3 drive into the USB-3 port on the RPi 4 and boot. You should eventually get to the installer. Proceed as you would normally for Debian installation on any other hardware.
I am completely baffled about this next problem. The "Detect network hardware" fails sometimes, asking for some non-free firmware. To fix this, use 'Ctrl-Alt-F2' and press 'Enter' to open a new shell.
# mount -o remount,rw /cdrom
# cd /cdrom/firmware
# cp brcm/* .
Now press 'Ctrl-Alt-F1' to go back to the main installer and press 'Enter'.
If you remember we already copied those to the root of the ESP, which is now mounted as /cdrom
. I have tried copying them either to the root or to the firmware
directory. Either place is supposed to do the trick. Perhaps I should have done both above. Forgive me, but I'm tired of checking the steps, and knowing this trick is not a bad idea anyway.
I tried this again with the brcm firmware in both the root of the ESP and in firmware
. I still got the request for firmware midway through the install. I did the same remedy as above, except that I ran these in the alternate shell:
# mount -o remount,rw /cdrom
# cd /cdrom
# touch x
And it was able to continue. As I said before, I'm baffled, but it does let me get a complete Debian Bullseye installation.
Again, the credit for this goes to Akeo.