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?