-
-
Couldn't load subscription status.
- Fork 2.7k
RFC: Add OrangePi RV2 support with RISC-V KY platform #8702
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
tmshlvck
wants to merge
1
commit into
armbian:main
Choose a base branch
from
tmshlvck:opir2-rebase-main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| # OrangePi RV2 - RISC-V SoC with SPI flash boot | ||
| BOARD_NAME="Orange Pi RV2" | ||
| BOARDFAMILY="ky" | ||
| BOARD_MAINTAINER="tmshlvck" | ||
| KERNEL_TARGET="current,edge" | ||
| BOOT_FDT_FILE="ky/x1_orangepi-rv2.dtb" | ||
| BOOTDELAY=1 | ||
| SRC_EXTLINUX="yes" | ||
| SRC_CMDLINE="console=ttyS0,115200 earlycon=sbi clk_ignore_unused swiotlb=65536" | ||
| PACKAGE_LIST_BOARD="rfkill bluetooth bluez bluez-tools can-utils v4l-utils" | ||
| #SKIP_BOOTSPLASH="yes" # Skip boot splash patch, conflicts with CONFIG_VT=yes | ||
|
|
||
| function post_config_uboot_target__extra_configs_for_orangepi_rv2() { | ||
| display_alert "u-boot for ${BOARD}" "u-boot: enabling extra configs for SPI flash boot" "info" | ||
| run_host_command_logged scripts/config --enable CONFIG_SD_BOOT | ||
| run_host_command_logged scripts/config --enable CONFIG_EXT4_WRITE | ||
| run_host_command_logged scripts/config --enable CONFIG_FS_BTRFS | ||
| run_host_command_logged scripts/config --enable CONFIG_CMD_BTRFS | ||
| run_host_command_logged scripts/config --enable CONFIG_CMD_SF | ||
| run_host_command_logged scripts/config --enable CONFIG_SPI_FLASH | ||
| run_host_command_logged scripts/config --enable CONFIG_SPI_FLASH_MTD | ||
| run_host_command_logged scripts/config --enable CONFIG_CMD_MTD | ||
| } | ||
|
|
||
| function post_family_tweaks_bsp__orangepi_rv2_extras() { | ||
| display_alert "$BOARD" "Installing OrangePi RV2 specific configuration" "info" | ||
|
|
||
| if [[ -d "$SRC/packages/blobs/riscv64/ky" ]]; then | ||
| run_host_command_logged mkdir -pv "${destination}"/lib/firmware | ||
| display_alert "$BOARD" "Installing boot firmware" "info" | ||
| run_host_command_logged cp -fv $SRC/packages/blobs/riscv64/ky/esos.elf "${destination}"/lib/firmware | ||
| fi | ||
|
|
||
| # Force load wireless module if available | ||
| if [[ -f "${destination}"/etc/modules-load.d/${BOARD}.conf ]]; then | ||
| run_host_command_logged rm -f "${destination}"/etc/modules-load.d/${BOARD}.conf | ||
| fi | ||
| run_host_command_logged mkdir -pv "${destination}"/etc/modules-load.d | ||
|
|
||
| # Add wireless module for AP6256 if present | ||
| if [[ "${BOARD}x" == "orangepirv2x" ]]; then | ||
| echo "bcmdhd" > "${destination}"/etc/modules-load.d/${BOARD}.conf | ||
|
|
||
| # Copy WiFi firmware if available | ||
| if [[ -f "${SRC}/packages/blobs/ky/nvram_ap6256.txt" ]]; then | ||
| run_host_command_logged mkdir -pv "${destination}"/lib/firmware | ||
| run_host_command_logged cp -v "${SRC}/packages/blobs/ky/nvram_ap6256.txt" "${destination}"/lib/firmware/ | ||
| fi | ||
| fi | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| verbosity=1 | ||
| bootlogo=false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| # DO NOT EDIT THIS FILE | ||
| # | ||
| # Please edit /boot/orangepiEnv.txt to set supported parameters | ||
| # | ||
|
|
||
| setenv load_addr "0x9000000" | ||
| setenv overlay_error "false" | ||
| # default values | ||
| setenv verbosity "1" | ||
| setenv console "both" | ||
| setenv bootlogo "false" | ||
| setenv rootfstype "ext4" | ||
| setenv docker_optimizations "on" | ||
| setenv earlycon "on" | ||
|
|
||
| echo "Boot script loaded from ${devtype} ${devnum}" | ||
|
|
||
| #if test -e ${devtype} ${devnum} ${prefix}orangepiEnv.txt; then | ||
| load ${devtype} ${devnum} ${load_addr} ${prefix}orangepiEnv.txt | ||
| env import -t ${load_addr} ${filesize} | ||
| #fi | ||
|
|
||
| if test "${logo}" = "disabled"; then setenv logo "logo.nologo"; fi | ||
|
|
||
| if test "${console}" = "display" || test "${console}" = "both"; then setenv consoleargs "console=tty1"; fi | ||
| if test "${console}" = "serial" || test "${console}" = "both"; then setenv consoleargs "console=ttyS0,115200 ${consoleargs}"; fi | ||
| if test "${earlycon}" = "on"; then setenv consoleargs "earlycon=sbi ${consoleargs}"; fi | ||
| if test "${bootlogo}" = "true"; then setenv consoleargs "bootsplash.bootfile=bootsplash.orangepi ${consoleargs}"; fi | ||
|
|
||
| setenv bootargs "mtdparts=${mtdparts} root=${rootdev} rootwait rootfstype=${rootfstype} ${consoleargs} consoleblank=0 loglevel=${verbosity} ubootpart=${partuuid} clk_ignore_unused swiotlb=65536 workqueue.default_affinity_scope=system usb-storage.quirks=${usbstoragequirks} ${extraargs} ${extraboardargs}" | ||
|
|
||
| if test "${docker_optimizations}" = "on"; then setenv bootargs "${bootargs} cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory swapaccount=1"; fi | ||
|
|
||
| load ${devtype} ${devnum} ${ramdisk_addr_r} ${prefix}uInitrd | ||
| load ${devtype} ${devnum} ${kernel_addr_r} ${prefix}Image | ||
|
|
||
| load ${devtype} ${devnum} ${fdt_addr_r} ${prefix}dtb/${fdtfile} | ||
| fdt addr ${fdt_addr_r} | ||
| fdt rm /soc/lcd_backlight phandle | ||
| fdt resize 65536 | ||
| for overlay_file in ${overlays}; do | ||
| if load ${devtype} ${devnum} ${load_addr} ${prefix}dtb/ky/overlay/${overlay_prefix}-${overlay_file}.dtbo; then | ||
| echo "Applying kernel provided DT overlay ${overlay_prefix}-${overlay_file}.dtbo" | ||
| fdt apply ${load_addr} || setenv overlay_error "true" | ||
| fi | ||
| done | ||
| for overlay_file in ${user_overlays}; do | ||
| if load ${devtype} ${devnum} ${load_addr} ${prefix}overlay-user/${overlay_file}.dtbo; then | ||
| echo "Applying user provided DT overlay ${overlay_file}.dtbo" | ||
| fdt apply ${load_addr} || setenv overlay_error "true" | ||
| fi | ||
| done | ||
|
|
||
| booti ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r} | ||
|
|
||
| # Recompile with: | ||
| # mkimage -C none -A arm -T script -d /boot/boot.cmd /boot/boot.scr |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion | 🟠 Major
🧩 Analysis chain
Use consistent logging and clarify board variant naming.
Line 42 writes directly to the file without using
run_host_command_logged, inconsistent with the rest of the function. Additionally, verify that the board identifier is indeed "orangepirv2x" for the AP6256 WiFi variant (vs "orangepirv2").Apply this diff for consistency:
if [[ "${BOARD}x" == "orangepirv2x" ]]; then - echo "bcmdhd" > "${destination}"/etc/modules-load.d/${BOARD}.conf + run_host_command_logged bash -c "echo 'bcmdhd' > '${destination}/etc/modules-load.d/${BOARD}.conf'"Verify the board name with:
🏁 Script executed:
Length of output: 30
🏁 Script executed:
Length of output: 2286
Wrap echo in logged command, drop variant check suggestion.
Replace the direct file write to use
run_host_command_loggedfor consistency:The test
[[ "${BOARD}x" == "orangepirv2x" ]]correctly checksBOARD=="orangepirv2"via the suffix-hack—no variant rename needed.📝 Committable suggestion
🤖 Prompt for AI Agents