Skip to content

Commit

Permalink
v8.23
Browse files Browse the repository at this point in the history
- VisionFive 2 | Bump kernel and apply 8 GB and model A overlays automatically on update as well as on first boot. Also inform users about the U-Boot environment change, needed to boot our image with latest StarFive U-Boot release.
  • Loading branch information
MichaIng committed Oct 15, 2023
1 parent 76d6ce1 commit 8fc8e4b
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 11 deletions.
6 changes: 5 additions & 1 deletion .build/images/dietpi-installer
Original file line number Diff line number Diff line change
Expand Up @@ -1230,11 +1230,15 @@ _EOF_
elif (( $G_HW_MODEL == 81 ))
then
G_EXEC curl -sSfo package.deb 'https://dietpi.com/downloads/binaries/linux-image-visionfive2.deb'
[[ -f '/boot/extlinux/extlinux.conf' ]] && G_EXEC rm /boot/extlinux/extlinux.conf
dpkg-deb -I linux-image-visionfive2.deb conffiles | while read -r line
do
[[ -f $line ]] && G_EXEC rm "$line"
done
G_EXEC_OUTPUT=1 G_EXEC dpkg -i package.deb
G_EXEC rm package.deb
G_EXEC sed -i "s/root=[^[:blank:]]*/root=PARTUUID=$(findmnt -Ufnro PARTUUID -M /)/" /boot/extlinux/extlinux.conf
G_EXEC sed -i "s/rootfstype=[^[:blank:]]*/rootfstype=$(findmnt -Ufnro FSTYPE -M /)/" /boot/extlinux/extlinux.conf
aPACKAGES_REQUIRED_INSTALL+=('libubootenv-tool')

# Sparky SBC
elif (( $G_HW_MODEL == 70 ))
Expand Down
50 changes: 49 additions & 1 deletion .update/patches
Original file line number Diff line number Diff line change
Expand Up @@ -1470,12 +1470,60 @@ Patch_8_23()
G_EXEC rm package.deb

# VisionFive 2
elif (( $G_HW_MODEL == 81 )) && dpkg --compare-versions "$(dpkg-query -Wf '${Version}' linux-image-visionfive2 2> /dev/null)" lt-nl 6.1.55-dietpi1
elif (( $G_HW_MODEL == 81 )) && dpkg --compare-versions "$(dpkg-query -Wf '${Version}' linux-image-visionfive2 2> /dev/null)" lt-nl 6.1.58-dietpi1
then
G_DIETPI-NOTIFY 2 'Updating RISC-V StarFive VisionFive 2 kernel ...'
G_EXEC_OUTPUT=1 G_EXEC curl -fo package.deb 'https://dietpi.com/downloads/binaries/linux-image-visionfive2.deb'
G_EXEC_OUTPUT=1 G_EXEC dpkg -i --force-confdef,confold package.deb
G_EXEC rm package.deb
local serial overlays=()
read -r serial < /proc/device-tree/serial-number
if [[ $serial == 'VF7110A1-'* ]]
then
G_DIETPI-NOTIFY 2 'A revision detected, applying device tree overlay to fix Ethernet ...'
read -ra overlays < <(mawk '$1=="fdtoverlays"{$1="";print}' /boot/extlinux/extlinux.conf)
local add=1
for i in "${overlays[@]}"
do
[[ $i == '/usr/lib/linux-image-visionfive2/starfive/vf2-overlay/ethernet-A12.dtbo' ]] || continue
G_DIETPI-NOTIFY 2 'A revision Ethernet overlay was applied already ...'
add=0
done
if (( $add ))
then
overlays+=('/usr/lib/linux-image-visionfive2/starfive/vf2-overlay/ethernet-A12.dtbo')
G_CONFIG_INJECT 'fdtoverlays[[:blank:]]' "fdtoverlays ${overlays[@]}" /boot/extlinux/extlinux.conf
fi
fi
if [[ $serial == *'-D008E000-'* ]]
then
G_DIETPI-NOTIFY 2 '8 GB RAM model detected, applying device tree overlay to make all 8 GB available to the system ...'
read -ra overlays < <(mawk '$1=="fdtoverlays"{$1="";print}' /boot/extlinux/extlinux.conf)
local add=1
for i in "${overlays[@]}"
do
[[ $i == '/usr/lib/linux-image-visionfive2/starfive/vf2-overlay/8GB.dtbo' ]] || continue
G_DIETPI-NOTIFY 2 '8 GB RAM overlay was applied already ...'
add=0
done
if (( $add ))
then
overlays+=('/usr/lib/linux-image-visionfive2/starfive/vf2-overlay/8GB.dtbo')
G_CONFIG_INJECT 'fdtoverlays[[:blank:]]' "fdtoverlays ${overlays[@]}" /boot/extlinux/extlinux.conf
fi
fi
G_AGI libubootenv-tool
G_WHIP_MSG '[ INFO ] VisionFive 2 U-Boot environment and boot priorities
\nThe latest StarFive U-Boot release does not support our image anymore without adjusting the U-Boot environment.
\nThe kernel package we just installed comes with the needed config files to change the U-Boot environment. We took the chance to ship a generic default which allows to boot from all filesystems on all partitions from all boot media, including NVMe, USB, eMMC, SD cards and DHCP/TFTP.
\nEspecially before updating to latest SPI bootloader, we recommend to flash this environment, right after you rebooted the system, with the following command:
# fw_setenv
\nAfterwards, you can print the U-Boot environment via "fw_printenv" and set individual variables via
# fw_setenv name value
\nThe "boot_targets" variabe takes a list of targets, which U-Boot tries to boot from left to right. The default is
# fw_setenv boot_targets "mmc1 usb0 nvme0 mmc0 dhcp"
\n"mnc1" is the SD card, "mmc0" the eMMC module.
\nPlease report back if you face any issues with this U-Boot environment, e.g. also with other distributions.'
fi
# ADS-B Feeder used to install two service files that aren't needed: https://github.com/MichaIng/DietPi/pull/6661
if [[ -f '/boot/dietpi/.installed' ]] && grep -q '^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[141\]=2' /boot/dietpi/.installed
Expand Down
54 changes: 45 additions & 9 deletions rootfs/var/lib/dietpi/services/dietpi-firstboot.bash
Original file line number Diff line number Diff line change
Expand Up @@ -114,24 +114,60 @@ _EOF_
*'T6'*) [[ -f '/etc/udev/rules.d/dietpi-eth-leds.rules' ]] && rm /etc/udev/rules.d/dietpi-eth-leds.rules;;
*) :;;
esac

# VisionFive 2
elif [[ $G_HW_MODEL == 81 && -f '/proc/device-tree/serial-number' ]]
then
local serial overlays=()
read -r serial < /proc/device-tree/serial-number
if [[ $serial == 'VF7110A1-'* ]]
then
G_DIETPI-NOTIFY 2 'A revision detected, applying device tree overlay to fix Ethernet ...'
read -ra overlays < <(mawk '$1=="fdtoverlays"{$1="";print}' /boot/extlinux/extlinux.conf)
local add=1
for i in "${overlays[@]}"
do
[[ $i == '/usr/lib/linux-image-visionfive2/starfive/vf2-overlay/ethernet-A12.dtbo' ]] || continue
G_DIETPI-NOTIFY 2 'A revision Ethernet overlay was applied already ...'
add=0
done
if (( $add ))
then
overlays+=('/usr/lib/linux-image-visionfive2/starfive/vf2-overlay/ethernet-A12.dtbo')
G_CONFIG_INJECT 'fdtoverlays[[:blank:]]' "fdtoverlays ${overlays[@]}" /boot/extlinux/extlinux.conf
fi
fi
if [[ $serial == *'-D008E000-'* ]]
then
G_DIETPI-NOTIFY 2 '8 GB RAM model detected, applying device tree overlay to make all 8 GB available to the system ...'
read -ra overlays < <(mawk '$1=="fdtoverlays"{$1="";print}' /boot/extlinux/extlinux.conf)
local add=1
for i in "${overlays[@]}"
do
[[ $i == '/usr/lib/linux-image-visionfive2/starfive/vf2-overlay/8GB.dtbo' ]] || continue
G_DIETPI-NOTIFY 2 '8 GB RAM overlay was applied already ...'
add=0
done
if (( $add ))
then
overlays+=('/usr/lib/linux-image-visionfive2/starfive/vf2-overlay/8GB.dtbo')
G_CONFIG_INJECT 'fdtoverlays[[:blank:]]' "fdtoverlays ${overlays[@]}" /boot/extlinux/extlinux.conf
fi
fi
fi

# End user automated script
if [[ -f '/boot/Automation_Custom_PreScript.sh' ]]; then

G_DIETPI-NOTIFY 2 'Running custom script, please wait...'
if [[ -f '/boot/Automation_Custom_PreScript.sh' ]]
then
G_DIETPI-NOTIFY 2 'Running custom script, please wait ...'
chmod +x /boot/Automation_Custom_PreScript.sh
if /boot/Automation_Custom_PreScript.sh 2>&1 | tee /var/tmp/dietpi/logs/dietpi-automation_custom_prescript.log; then

if /boot/Automation_Custom_PreScript.sh 2>&1 | tee /var/tmp/dietpi/logs/dietpi-automation_custom_prescript.log
then
G_DIETPI-NOTIFY 0 'Custom script'

else

G_DIETPI-NOTIFY 1 'Custom script: Please see the log file for more information:
- /var/tmp/dietpi/logs/dietpi-automation_custom_prescript.log'

fi

fi

# Apply swap settings
Expand Down

0 comments on commit 8fc8e4b

Please sign in to comment.