DietPi icon indicating copy to clipboard operation
DietPi copied to clipboard

Image | Raspberry Pi 5: Testing and firmware migration script

Open TDuffinNTU opened this issue 1 year ago β€’ 362 comments

ADMIN EDIT

First Raspberry Pi 5 testing images are available now on our download page: https://dietpi.com/#download You can also find images with the new kernel/firmware package set for other RPi models here: https://dietpi.com/downloads/images/testing/ The ones with the new firmware have "RPi1", "RPi2" and "RPi234" (64-bit) in their names. To migrate an existing system, use the migration script:

bash <(curl -sSf 'https://raw.githubusercontent.com/MichaIng/DietPi/dev/.meta/dietpi-rpi-firmware-migration')

WARNING: This is currently a one-way ticket. dietpi-backup cannot be used to restore the old system, since the boot partition mount point has changed. If you want to be able to revert, create an image of the whole SD card/drive. dietpi-imager can be used from another DietPi (or Debian/Ubuntu) system, to minimise partition and filesystem automatically, to have a small compressed backup image.


  • Device name | Raspberry Pi 5
  • Official product URL | https://www.raspberrypi.com/products/raspberry-pi-5/
  • GitHub resource URL (if available) | https://github.com/raspberrypi
  • Image download URL |https://www.raspberrypi.com/software/

Is the SBC officially supported by the Debian installer?

  • Yes(?) Looks like the board is inter-compatible with the same distro images as the 4B. That's pure speculation, mind you, but I did see a video of a reviewer transferring a Raspbian installation from a Pi4B to a Pi5 with no configuration necessary.

Notes

  • Not sure if this needs any specific developer legwork as the previous Pis seem to be inter-compatible with OS images for the most part (though I'm sure testing and drivers will be necessary!). Thought I'd make this issue now since it might be good to mark the Pi5 as provisionally supported on the website if it at least works out of the box.

TDuffinNTU avatar Oct 09 '23 22:10 TDuffinNTU

Okay this requires more work, sadly. With Bookworm and hence for RPi 5, the packages as well as the filesystem layout have changed dramatically:

  • For RPi 4 and earlier, the package is called linux-image-rpi-v8, which is a meta package and current pulls linux-image-6.1.0-rpi4-rpi-v8.
  • For RPi 5, the package is called linux-image-rpi-2712, which is a meta package and current pulls linux-image-6.1.0-rpi4-rpi-2712.
  • These packages are more streamlined with mainline Linux packages, installing kernel image, config, map, device trees and overlays like common Debian Linux packages:
    /boot/System.map-6.1.0-rpi4-rpi-2712
    /boot/config-6.1.0-rpi4-rpi-2712
    /boot/vmlinuz-6.1.0-rpi4-rpi-2712
    ...
    /usr/lib/linux-image-6.1.0-rpi4-rpi-2712/broadcom/bcm2712-rpi-5-b.dtb
    ...
    /usr/lib/linux-image-6.1.0-rpi4-rpi-2712/overlays/README
    
  • For the bootloader, there is now a raspi-firmware package, which installs the files as well more streamlined into /usr/lib/raspi-firmware/.
  • libraspberrypi0, libraspberrypi-bin and raspberrypi-sys-mods remain the same.
  • The RPi ROM bootloader stage still requires bootloader, config and kernel on a partition 1 with FAT filesystem, which was mounted to /boot. This cause the issue that, since dpkg does not support FAT, this rpikernelhack back and forth copying of all files in /boot was required, to bypass the need to dpkg to replace a file (which would fail). This procedure has now been replaced with another, IMO not less ugly workaround: The FAT filesystem of partition 1 is now mounted to /boot/firmware. The raspi-firmware package strictly requires this directory to be a mount point (now allowing a dir within a mount point) and then copies all kernel, dtb and bootloader files from /boot and /usr/lib/linux-image- over to /boot/firmware, applying the known naming schemes. So a copy back and forth of all those files has been replaced with a single copy, but files remaining permanently on both partitions. And of course, for the 64-bit kernel, it is now actually two kernel images and all related modules, hence disk space requirements have increased.
  • Furthermore, the raspi-firmware package does now strictly require an initramfs. I have to check whether this means that the kernel has essential modules no builtin anymore, or whether it is actually not required, but just installed and handled for in case. As far as I can see, there is a config flag to disable this copy to /boot/firmware stuff, which then would need to be done manually. So we could write our own script to do this, skipping the initramfs. But at least at the beginning, I am not keen to maintain such, as it will likely change a lot within the next months. Probably a tiny-initramfs is possible, like the moreless dummy one we do now use for Sparky SBC, one which does not include any kernel module, hence servers nearly no purpose (aside of supporting UUIDs on top of PARTUUIDs) aside of satisfying bootloader and/or package script expectations.
  • Same for the 32-bit image, with the same kernel packages names and suffixes: v6, v7, v7l and v8. But one quirk is that the linux-image-rpi-v8 packages are not contained within the armhf package list, only in the arm64 ones, which is not enabled by default on 32-bit userland.

MichaIng avatar Oct 19 '23 14:10 MichaIng

uhh does not sounds like a quick win. πŸ™„

Joulinar avatar Oct 20 '23 06:10 Joulinar

Any updates?

onurcoskun14 avatar Nov 06 '23 09:11 onurcoskun14

Same Question. :-) I buy a RPI-5 and want to install DietPi for LoxBerry. When can we expect a version?

axxis-creator avatar Nov 10 '23 15:11 axxis-creator

any updates on this?

gaurishhs avatar Nov 14 '23 11:11 gaurishhs

We will post any updates here when we have some. I was looking further into it. The migration of the partition and installation of the new kernel packages is not too hard. But there is another big problem: Our scripts, and probably RPi's own scripts/programs expect config.txt and cmdline.txt in /boot, while for booting, both must be located in /boot/firmware (with the new package set). This is solved in RPi OS via symlinks. The problem is now that sed -i naturally replaces symlinks with actual files, and we use it a lot to edit their contents. Hence we must replace every occurrence across our whole code with sed -i --follow-symlinks to avoid this. Not understandable why this is not the default since ages, since I cannot imagine any circumstance where one would want to have a symlink replaced with its target file, when using sed on a symlink. However, I can do this quickly with a single command for the whole repo with the use of ... sed πŸ˜ƒ. But this needs to be carefully reviewed, since there are variances like sed -Ei and probably some cases or code comments where the replacement must not be applied.

Another problem or better question is what we do with /boot/dietpi and /boot/dietpi.txt. The first, I think is fine to stay on the ext4 partition in the first place, resp. being moved there as part of the migration. The dietpi.txt is however nice to be on the FAT partition, at least before first boot, so one can apply automation and pre-configure the image from Windows and macOS easily. We just added a trailing FAT partition to all other images to make it as easy there as on RPi, so it would be horrible if we now removed this possibility for RPi. Theoretically we could do it on RPi the same way we do on other SBCs: As part of the first boot rootfs expansion script, mount the FAT partition and copy over dietpi.txt, dietpi-wifi.txt and all other optional pre-config files to the rootfs, then unmount it again. This must of course only happen on those RPi images which have the FAT partition mounted to /boot/firmware already.

Btw, does someone of you guys have an RPi 5 already and can tell me the revision code? That way we can add support to our hardware detection script already and provide RPi 5 compatible images between releases, if I am not able to finish this until this Saturday (v8.24 release):

mawk '/^Revision/{print $3;exit}' /proc/cpuinfo

The 3rd and 2nd last characters define the model. "14" was CM4, so it is probably "15" or "16".

MichaIng avatar Nov 16 '23 00:11 MichaIng

C04170

jboots07 avatar Nov 16 '23 00:11 jboots07

Hi, i will receive the Raspberry next week. It is already shipped. I will update you when i receive it.

Very thanks for your amazing work!


Da: jboots07 @.> Inviato: Thursday, November 16, 2023 1:38:24 AM A: MichaIng/DietPi @.> Cc: adrianog91 @.>; Manual @.> Oggetto: Re: [MichaIng/DietPi] Image | Raspberry Pi 5 (Issue #6676)

C04170

β€” Reply to this email directly, view it on GitHubhttps://github.com/MichaIng/DietPi/issues/6676#issuecomment-1813520469, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADGPFYUSGCNXV4TTNFY4UYDYEVOABAVCNFSM6AAAAAA5ZNEQLKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJTGUZDANBWHE. You are receiving this because you are subscribed to this thread.Message ID: @.***>

adrianog91 avatar Nov 16 '23 06:11 adrianog91

Thanks. Found it now here as well: https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#new-style-revision-codes

So "15" is the CM4S, which is a special industry customer variant, not publicly sold, and "16" for "internal use". Let's see whether "16" is a surprise, not announced yet πŸ™‚.

MichaIng avatar Nov 16 '23 16:11 MichaIng

First step: https://github.com/MichaIng/DietPi/commit/6e848a1

MichaIng avatar Nov 16 '23 16:11 MichaIng

Thanks for your hard work and update! Let me know if I can help in any way, I have a pi 5.

jboots07 avatar Nov 16 '23 19:11 jboots07

I just received my PI5 and can't wait to install on it Dietpi to replace my PI4 :-)

sorriso93 avatar Nov 17 '23 15:11 sorriso93

I just received mine too and am excited to put dietpi on it :-)

BugDave avatar Nov 19 '23 13:11 BugDave

@MichaIng when you are ready for testing in the wild on RaspberryPi 5, I am happy to test.

m0jek avatar Nov 21 '23 10:11 m0jek

Available for testing on Pi 5 as well! Thanks for your efforts!

FabioEight avatar Nov 22 '23 08:11 FabioEight

Where can I get it?

elisenlebkuch avatar Nov 22 '23 10:11 elisenlebkuch

I don't think so there has been any image supporting Pi 5, You'll have to wait

gaurishhs avatar Nov 22 '23 10:11 gaurishhs

Oh... This one wonΒ΄t work? https://dietpi.com/downloads/images/testing/DietPi_Star64-RISC-V-Sid.img.xz

elisenlebkuch avatar Nov 22 '23 10:11 elisenlebkuch

I think that one is for Risc-V https://github.com/MichaIng/DietPi/issues/6212

gaurishhs avatar Nov 22 '23 10:11 gaurishhs

Is it possible to add the dietpi later on a running raspbian? I'll plan to docker all my programs anyway, so the host will stay pretty much raspbian lite until then.

If so, I'd just give my raspbian a diet later, when its compatible with raspi 5.

LittleFreak avatar Nov 26 '23 14:11 LittleFreak

Is it possible to add the dietpi later on a running raspbian?

You mean on a Raspberry Pi OS? Currently does not work as dietpi-installer installs the old kernel/bootloader/firmware packages and our scripts use sed in various places a way that the /boot/config.txt => /boot/firmware/config.txt (same with cmdline.txt) symlinks are replaced with the actual files, so that the intended changes will not actually apply. See my longer comment above about this issue. Once we added compatibility, dietpi-installer can run on a new RPi OS image, but it will remove all installed software, including Docker in your case. What you could do is backup your /var/lib/docker. Then once dietpi-installer ran through and you boot DietPi, do not install Docker at first, but restore /var/lib/docker to /mnt/dietpi_userdata/docker-data, then install Docker via dietpi-software.

MichaIng avatar Nov 26 '23 15:11 MichaIng

Have a Pi5, happy to test :)

cgmcfall avatar Nov 27 '23 07:11 cgmcfall

Also have a RPI5, happy to help testing.

alfredoanton82 avatar Nov 27 '23 19:11 alfredoanton82

Here, I have another one ready to test.

sergio-ingrao avatar Dec 01 '23 20:12 sergio-ingrao

Me too.

elisenlebkuch avatar Dec 01 '23 21:12 elisenlebkuch

I'm also available for testing.

Net0o avatar Dec 04 '23 15:12 Net0o

Just to clarify....

"MichaIng linked a pull request 2 days ago that will close this issue"

Is that Github speak, or does it mean that the latest Dietpi image will work on a Pi 5?

(Sorry if that is a stupid question!)

B.

bwims avatar Dec 09 '23 18:12 bwims

does it mean that the latest Dietpi image will work on a Pi 5

No

We are taking the first steps to adapt to the new firmware. For us, this means intensive testing, as we are making some significant code changes to our scripts. As a first step, we will provide a dedicated image for the RPi5 as soon as it is ready.

Joulinar avatar Dec 09 '23 18:12 Joulinar

Thanks for that. I guess the standard Github dialogues are a bit misleading in that respect! πŸ˜ƒ

On Sat, 9 Dec 2023 at 18:24, Joulinar @.***> wrote:

does it mean that the latest Dietpi image will work on a Pi 5

No

We are taking the first steps to adapt to the new firmware. For us, this means intensive testing, as we are making some significant code changes to our scripts. As a first step, we will provide a dedicated image for the RPi5 as soon as it is ready.

β€” Reply to this email directly, view it on GitHub https://github.com/MichaIng/DietPi/issues/6676#issuecomment-1848606657, or unsubscribe https://github.com/notifications/unsubscribe-auth/AENIQ2M74FWOJLCU57CBTPTYISUFBAVCNFSM6AAAAAA5ZNEQLKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNBYGYYDMNRVG4 . You are receiving this because you commented.Message ID: @.***>

bwims avatar Dec 09 '23 20:12 bwims

does it mean that the latest Dietpi image will work on a Pi 5

No

We are taking the first steps to adapt to the new firmware. For us, this means intensive testing, as we are making some significant code changes to our scripts. As a first step, we will provide a dedicated image for the RPi5 as soon as it is ready.

Do you have any potential timeline that you could share with us? Your work is greatly appreciated!

matttttttttttttt avatar Dec 09 '23 23:12 matttttttttttttt