Skip to content

Commit

Permalink
Merge pull request #6148 from StephanStS/dev-StS-StarFive
Browse files Browse the repository at this point in the history
Support of RISC-V (StarFive VisionFive 2) - step 1
  • Loading branch information
StephanStS authored Feb 11, 2023
2 parents fc81aa1 + 3a98e7b commit 6d2bba1
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 9 deletions.
9 changes: 9 additions & 0 deletions .build/images/dietpi-installer
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,10 @@ _EOF_
elif [[ $G_HW_ARCH_NAME == 'x86_64' ]]
then
G_HW_ARCH=10

elif [[ $G_HW_ARCH_NAME == 'riscv64' ]]
then
G_HW_ARCH=11
else
G_DIETPI-NOTIFY 1 "Unsupported CPU architecture: \"$G_HW_ARCH_NAME\". Aborting...\n"
exit 1
Expand Down Expand Up @@ -389,6 +393,8 @@ _EOF_
'27' ': Generic Allwinner H6'
'28' ': Generic Amlogic S905'
'29' ': Generic Amlogic S922X'
'' '●─ RISC-V '
'81' ': StarFive VisionFive 2'
'' '●─ Other '
'75' ': Container image'
'22' ': Generic device'
Expand Down Expand Up @@ -1222,6 +1228,9 @@ _EOF_
fi
G_EXEC apt-get clean # Remove downloaded archives

# RISC-V: Install Debian ports repository key
(( $G_HW_ARCH == 11 )) && aPACKAGES_REQUIRED_INSTALL+=('debian-ports-archive-keyring')

# WiFi and firmware packages: Usually no firmware should be necessary for VMs. If user manually passes though some USB device, user might need to install the firmware then.
if (( $G_HW_MODEL != 20 && $G_HW_MODEL != 75 ))
then
Expand Down
1 change: 1 addition & 0 deletions .meta/dietpi-survey_report
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ shopt -s extglob
[78]='ROCK 5B'
[79]='NanoPi R6S'
[80]='Orange Pi 5'
[81]='StarFive VisionFive 2'
)

## Benchmark data arrays: aBENCH_XX[$HW_MODEL,${aBENCH_XX_INDEX[$HW_MODEL]}]
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ New images:
- Odroid N2/HC4 | New images have been generated with support for the default Hardkernel SPI bootloader petitboot. Thanks to this, boot from USB devices is now possible, and on Odroid HC4 it is not necessary anymore to erase the SPI flash or flash mainline U-Boot to it. Many thanks to @hstarcm and @Power-onoff for bringing up this topic and help testing adjustments to the boot script: https://github.com/MichaIng/DietPi/issues/5634
- ROCK 5B | New images with ext4 boot filesystem have been generated, to solve possible issues and limitations of the previously used FAT filesystem. Many thanks to @isarrider for reporting this issue: https://github.com/MichaIng/DietPi/issues/6122

New architecture:
- Initial experimental support for RISC-V and the StarFive VisionFive 2 SBC has been added. This is all in playground stage currently, but if anyone wants to join the party, contact us.

Enhancements:
- WiFi | Since Linux 4.15, the kernel can read the WiFi country code from connected access points, and searches the regulatory database for related allowed frequencies automatically. The Central Regulatory Domain Agent (CRDA) has hence become obsolete and isn't even functional if the kernel feature is used. Linux needs to have the regulatory database in specific format stored below /lib/firmware for this, which is the case since Debian Bullseye. Additionally, if no Debian kernel is used (all SBCs), one needs to change the used regulatory database from a Debian-only one to the upstream one. New DietPi image ship now with this setup without CRDA, it is applied on next DietPi update on Bullseye and Bookworm systems, and it is offered to purge the obsolete CRDA package. This also fixes the issue on Bookworm SBC systems, where the limited global (00) country code was used, since CRDA is not available on Bookworm, but the Debian-only regulatory database used by default.
- NanoPi R2S/NEO3 | Video related kernel modules are now blacklisted on these headless SBCs, saving some bits of RAM and load at boot.
Expand Down
4 changes: 2 additions & 2 deletions dietpi/dietpi-software
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@ Available commands:
esac

# Available for (need to match highest value in dietpi-obtain_hw_model)
readonly MAX_G_HW_MODEL=80
readonly MAX_G_HW_ARCH=10
readonly MAX_G_HW_MODEL=81
readonly MAX_G_HW_ARCH=11
#readonly MAX_G_DISTRO=7
# - 2D array (well, bash style)
declare -A aSOFTWARE_AVAIL_G_HW_MODEL
Expand Down
16 changes: 13 additions & 3 deletions dietpi/func/dietpi-obtain_hw_model
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@
# - Called from /boot/dietpi/preboot, called by /etc/systemd/system/dietpi-preboot.service
#
# Developer note: Sync highest IDs with dietpi-software:
# - MAX_G_HW_MODEL=76
# - MAX_G_HW_ARCH=10
# - MAX_G_HW_MODEL=81
# - MAX_G_HW_ARCH=11
# - MAX_G_DISTRO=7
#
# G_HW_MODEL 81 StarFive VisionFive 2
# G_HW_MODEL 80 Orange Pi 5
# G_HW_MODEL 79 NanoPi R6S
# G_HW_MODEL 78 ROCK 5B
Expand Down Expand Up @@ -74,6 +75,7 @@
# G_HW_MODEL 1 Raspberry Pi 1/Zero (512 MiB)
# G_HW_MODEL 0 Raspberry Pi 1 (256 MiB)
# ----------------
# G_HW_ARCH 11 riscv64
# G_HW_ARCH 10 x86_64/amd64
# G_HW_ARCH 3 aarch64/arm64
# G_HW_ARCH 2 armv7l/armhf
Expand Down Expand Up @@ -310,7 +312,11 @@

G_HW_MODEL=$(mawk 'NR==1' "$FP_G_HW_MODEL_IDENTIFIER")

if (( $G_HW_MODEL == 80 )); then
if (( $G_HW_MODEL == 81 )); then

G_HW_MODEL_NAME='StarFive VisionFive 2'

elif (( $G_HW_MODEL == 80 )); then

G_HW_MODEL_NAME='Orange Pi 5'
G_HW_CPUID=11
Expand Down Expand Up @@ -605,6 +611,10 @@

G_HW_ARCH=10

elif [[ $G_HW_ARCH_NAME == 'riscv64' ]]; then

G_HW_ARCH=11

# - Unsupported by DietPi, inform user by adding 'Unsupported'
else

Expand Down
12 changes: 8 additions & 4 deletions dietpi/func/dietpi-set_software
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,15 @@ $FP_SCRIPT disable_ssh_password_logins [01]|root|<empty> Whether to disable SSH
# RPi
(( $G_HW_MODEL < 10 || ( $G_HW_MODEL == 75 && ${G_RASPBIAN:-0} == 1 ) )) && G_EXEC eval "echo 'deb https://archive.raspberrypi.org/debian/ ${G_DISTRO_NAME/bookworm/bullseye} main' > /etc/apt/sources.list.d/raspi.list"

# Raspbian
if (( $G_RASPBIAN )); then
# RISC-V: Provided via Debian ports and Sid only
if (( $G_HW_ARCH == 11 ))
then
G_EXEC eval 'echo '\''deb https://deb.debian.org/debian-ports/ sid main contrib non-free
deb https://deb.debian.org/debian-ports/ unreleased main contrib non-free'\'' > /etc/apt/sources.list'

# Raspbian
elif (( $G_RASPBIAN ))
then
# Default?
[[ $INPUT_MODE_VALUE == 'default' ]] && INPUT_MODE_VALUE='http://raspbian.raspberrypi.org/raspbian/'

Expand All @@ -120,7 +126,6 @@ $FP_SCRIPT disable_ssh_password_logins [01]|root|<empty> Whether to disable SSH

# Debian
else

# Default?
[[ $INPUT_MODE_VALUE == 'default' ]] && INPUT_MODE_VALUE='https://deb.debian.org/debian/'

Expand All @@ -134,7 +139,6 @@ deb $INPUT_MODE_VALUE $G_DISTRO_NAME-backports main contrib non-free' > /etc/apt

# Update dietpi.txt entry
G_CONFIG_INJECT 'CONFIG_APT_DEBIAN_MIRROR=' "CONFIG_APT_DEBIAN_MIRROR=$INPUT_MODE_VALUE" /boot/dietpi.txt

fi

}
Expand Down

0 comments on commit 6d2bba1

Please sign in to comment.