How to remotely upgrade/change OS on Rock PI 4

I am wondering how i could set up the Rock PI 4 so that i can remotely (without physically plugging/unplugging uSD) change/upgrade the OS on the Rock PI 4. I do have the serial console.

I want to have the target OS on eMMC module, so i was hoping that i could have a setup where i also have an OS (e.g.: debian) on eMMC, but that i can set up bootstrap so that the system will normally boot from eMMC, but with interruption on console, one could boot from uSD and then use that OS to change/upgrade the OS installed on eMMC. Alas, it seems that the normal bootstrap is that uSD is preferred over eMMC.

Is there any documentation how the bootstrap process can be configured/influenced ?

What is wrong with:

  1. Installing OS on eMMC
  2. Upgrade it with: apt update && apt upgrade

?

For example if i want to change from debian to armbian :wink: Full fresh install.

I know what you mean, but such features are not really present in consumer grade world. It can be done, but its yet another expensive feature which somebody has to pay for it. Or do it as donation.

It seems that the bootstrap process has two stages in which it can be interrupted via serial console. The second one allows to select a different kernel, the first one stops somewhere in u-boot. Alas, the u-boot documentation isn’t very enlightening.

Lets say i have both an eMMC and a uSD installed. Would it be possible to select which disk to boot from during the first interruption ? What u-boot commands would i need to use for that ?

Hi raidboy,

The feature you are looking for is very hard to achieve on the Rock Pi4. It works on a router running Linux, because those have a very minimalist systems: kernel (with a couple of specific network drivers and firewall stack), a minimal http server, a few daemons to handle file sharing and SSH, and maybe a few more, if the router has a bit more RAM and could handle VPN or some such. A system like that would be in the range of 5-25 MB pre-packaged image. Even Debian net install image is an order of magnitude bigger than that and something like it would be too big to be handled by u-boot, for re-installation purposes.

If you really need it, you could bake your own minimalist yocto distro, which sole purpose would be to load from uSD and then pull an iso image (your choice) from the Internet and install it on the eMMC… Your Pi4 would normally boot from eMMC and only when you want it, from the SD card. It would be an interesting engineering project :wink:

@raidboy I believe you need to read this

https://wiki.radxa.com/Rockpi4/dev/usb-install

More something like this: https://mender.io/

Full image system updates: A/B partitioning provides automatic rollback functionality, for the most robust update process.

Isn’t this one a bit overkill for just one change?

Also, as for remotely change OS - @raidboy you may try pxeboot

https://wiki.radxa.com/Rockpi4/dev/u-boot/pxe

As a solution, it perhaps provide functions you don’t need. But as a concept, no.

This is ability to load kernel and OS from the network. If you have access to the boot console you can tell u-boot which image to boot and from where. Now you only need to construct eMMC update mechanism with fall back ability … DIY “Mender”.

Well, creating something like this can indeed make community live simplier, but i don’t think that raidboy have skills or knowledge or time to make something like this

On side note - do you think it’s possible, without rewriting whole uboot to create some kind of OS selection or at least create ability to start boot from selected partition?

Thanks, folks for the idea.

IMHO it would be nice if one would be possible to hae a bootstrap system option that is similarily flexible to what folks are used to on x.86: something like grub (very light) that allows you to choose booting different OS from different partitions/disks.

For example, i think its possible to multiple different kernels via the radxa debian images. Still need to check if it supports different partitions/disks (eMMC, uSD, …). But i am not aware that it would be possible to boot a non-linux-kernel that way - like there is a chainloader for grub to boot into windows on x86.

I am sure there are several options to select what to boot earlier in the u-boot chain as you describe in your answers, but that of course requires learning more rockpi4/u-boot specifics, and probably can not as easily be shared across different platforms (guessing).