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.

3 Likes

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.

2 Likes

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…

4 Likes

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

Yeah they really should offer the use of SSD with VenusOS.

1 Like

Similarly, I would like to run the RPI4 image in a virtual machine - this would require booting from an external drive as well.

I’ve come to the conclusion that it’s not worth working on, as for it to be any use, I would need access to Victron’s private repos to complete a full build.

Pity Victron opted to handicap their “open-source” OS by making crucial components closed-source…

1 Like

Well the problem ain’t the closed sources.

Making the image bootable from non SD Card should be no problem, as mine runs for several weeks now and i had to reboot and switch between older and newer firmware in between.

The problem i see, is the hardware you will use. I don’t know how you want to emulate the Pi4.

Maybe this can work. Never thought about it.

And by the way, i did a complete build with open sources files only. The closed files are needed, if you want to build your own venus, based on oem venus, which doesn’t make sense.

Hello Groove,

I just ran into the issue of not being able to boot my Pi400 from USB-SSD drive. I fixed the no wifi issue by copying all the /lib/firmware from the raspbian pi400 over to the VenusOS. It works from SD now. But no SSD. Did you ever get to creating that manual for building VenusOS from source with the mods to make it work from SSD?

Cool! Did you ever get to writing that manual. What’s the link to your github? Thanks!

@Groove: You seem to have found a way to boot VenusOS from an SSD and also perform a firmware update on the VenusOS SSD. It would be really great if you could document this journey. Thank you very much in advance.

Well, I already documented it on my github but so far as private. Because it’s not that easy and also depends on where you come from.

Fresh and clean install or using an existing backup.

Also, from what I have seen on victrons github, there are several changes coming for the next major update of venus, which might also need some changes for my solution.

I will wait until the new venus os is out.

And you will defenitly need a linux pc on top. Or at least a virtual linux pc.

1 Like