Boot from SSD @ Pi4

Hallo,

a long time ago in the old forum, there was a thread / discussion, if it is possible to make the Pi4 with VenusOS boot from SSD instead of SD.

So far I compiled my own u-boot.bin and I’m now able to boot without SD directly from the SSD connected via USB.

Right now i try to figure out, how the update process works and how to set env variables to boot from new Version.

So i made a clean install of 3.42 and booted it from SSD. Than I updated to 3.51 but a reboot still ends in 3.42.

From what i have found, the $Version variable has to be passed to u-boot to set the sda3 partition as rootfs. 3.42 is setting in sda2.

I use a serial connection to see what happends during the boot:

[    0.000000] Kernel command line: coherent_pool=1M 8250.nr_uarts=1 snd_bcm2835.enable_compat_alsa=0 snd_bcm2835.enable_hdmi=1 bcm2708_fb.fbwidth=0 bcm2708_fb.fbheight=0 bcm2708_fb.fbswap=1 smsc95xx.macaddr=DC:A6:32:0A:75:4D vc_mem.mem_base=0x3eb00000 vc_mem.mem_size=0x3ff00000  dwc_otg.lpm_enable=0 console=ttyS0,115200 root=/dev/sda2 rootwait

So root=/dev/sda2 has to be root=/dev/sda3

This is done by the code in the u-boot:

set_root=if test "${version}" = 2; then setenv bootpart 0:3; setenv mmcroot /dev/sda3; else setenv bootpart 0:2; setenv mmcroot /dev/sda2; fi

From the file in /opt/victronenergy/swupdate-scripts/set-version.sh

#! /bin/sh

. $(dirname $0)/functions.sh

start_log

case $1 in
    1) exit # no change
       ;;
    2) version=$(get_altrootfs)
       ;;
    *) echo "Invalid version $1"
       exit 1
       ;;
esac

if [ -z "$version" ]; then
    echo "Unable to determine new version"
    exit 1
fi

lock || exit

echo "switching to rootfs $version"
sed '1s/^/current version: /;2s/^/new version: /' /var/run/versions

unlock_env
fw_setenv version $version
reboot
unlock

i allready see, that the $version can be set, but how do you access the fw_env from a booted venus os? When i try the unlock_env or fw_setenv command, all i get is unknown command. So when and how does the script wright this variable to fw_env?

4 Likes

It is a pity, there is no official support for SSD Drives for Venus OS.
Not only because of performance but especially about reliability and longevity!
I am running many systems (also critical ones) and not a single SSD ever failed on me. It is the exact opposite with SD Cards!

As I wrote, it is possible and not that hard.

The only problem I got is the firmware update.

Hope victron might help with some info.

Of cause it’s also possible to do a manual update by installing new firmware on a clean disc.

Maybe i’ll put a manual here or on github if I fix the update problem.

In another discussion on the net i found the hint to use an eMMC-Card instead of the sd-card. So I ordered a eMMC-Card, an adapter SD to eMMC and another adapter eMMC to USB for copying.
I made the sd ready to run with the VenusOS and then cloned it on another Pi to the eMMC. Then I put the cloned VenusOS on the eMMC on the eMMC-sd-adapter and set it in the sd-slot of the Pi, which should work as a GX. This works now since nearly 1 year without any problems and I had never problems with firmware update. Actually it is running with 3.51

1 Like

@naranja nice, but not the solution as it is possible to use SSD without SD or eMMC.

Already found the files that need to be changed.

/usr/bin/swupdate
/sbin/fw_setenv
/sbin/fw_printenv

“mmcblk” needs to be changed to “sda” after that an update should work. Simply editing these files doesn’t work, they need to be compiled.

So at Victron, where are the sources for these 3 files, and how can I compile them on my own.

From github i read that there are several private resources if I want to compile my own venus OS. I just need to edit the 3 files.

1 Like

So, after many hours of reading code, compiling, testing, I finally got all working.

It is possible to boot a Pi4 from SSD via USB without the need of any SD card. Not for updating to a new firmare and also not for switching between old and new firmware.

Several files have to be edited before compiling from Victrons source. (swupdate, fw_printenv, fw_setenv.

It’s also necessary to compile your own uboot.bin to make it read from uboot.env file. Only with this you can switch between installed firmwares without the need of a SD card.

I’ll write a manual on my github and post the link here somewhen…

2 Likes

Thank you!!!’
I hope victron will adopt your code!!!