Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions config/boards/milkv-duos-arm.csc
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Milk-V Duo S (Sophgo SG2000) - ARM mode
Comment thread
EvilOlaf marked this conversation as resolved.
Outdated
# Cortex-A53 @ 1GHz, 512MB LPDDR3, microSD, 100M Ethernet, USB-C OTG, USB-A,
# AIC8800D80 Wi-Fi 6 + BT 5, 26-pin + 14-pin GPIO headers.
#
# The SG2000 has both a Cortex-A53 and a C906 RISC-V core, and only one of them
# runs at a time. Which one is chosen by the slide switch on the board, which is
# what brings that core out of reset and runs the BootROM on it.
#
# Two board files for one physical board, because BOARD is the build target and
# each produces a different image. One image runs from either medium (SD or eMMC).
# The first line of the boot log is the quickest way to tell which core you are
# actually on: it starts with 'B' for ARM and 'C' for RISC-V.
#
#
# https://milkv.io/duo-s
Comment thread
EvilOlaf marked this conversation as resolved.
Outdated
BOARD_NAME="Milk-V Duo S"
BOARD_VENDOR="milkv"
BOARDFAMILY="sophgo-sg200x-arm64"
BOARD_MAINTAINER="lukaszsobala"
INTRODUCED="2024"
KERNEL_TARGET="edge,bleedingedge"
KERNEL_TEST_TARGET="edge"
BOOT_FDT_FILE="sophgo/sg2000-milkv-duo-s.dtb"
# The silicon could in principle drive a panel through pins on the GPIO
# headers, but no device tree we ship enables any of it, so every image is
# declared headless.
HAS_VIDEO_OUTPUT="no"

# Because 512MB of RAM does not go far.
PACKAGE_LIST_BOARD_REMOVE="snapd cloud-init"

enable_extension "sophgo-sg200x-aic8800"
31 changes: 31 additions & 0 deletions config/boards/milkv-duos-riscv.csc
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Milk-V Duo S (Sophgo SG2000) - RISC-V mode
Comment thread
EvilOlaf marked this conversation as resolved.
Outdated
# T-Head C906 @ 1GHz, 512MB LPDDR3, microSD, 100M Ethernet, USB-C OTG, USB-A,
# AIC8800D80 Wi-Fi 6 + BT 5, 26-pin + 14-pin GPIO headers.
#
# The SG2000 has both a Cortex-A53 and a C906 RISC-V core, and only one of them
# runs at a time. Which one is chosen by the slide switch on the board, which is
# what brings that core out of reset and runs the BootROM on it.
#
# Two board files for one physical board, because BOARD is the build target and
# each produces a different image. One image runs from either medium (SD or eMMC).
# The first line of the boot log is the quickest way to tell which core you are
# actually on: it starts with 'B' for ARM and 'C' for RISC-V.
#
# https://milkv.io/duo-s
BOARD_NAME="Milk-V Duo S"
BOARD_VENDOR="milkv"
BOARDFAMILY="sophgo-sg200x-riscv64"
BOARD_MAINTAINER="lukaszsobala"
INTRODUCED="2024"
KERNEL_TARGET="edge,bleedingedge"
KERNEL_TEST_TARGET="edge"
BOOT_FDT_FILE="sophgo/sg2000-milkv-duo-s.dtb"
# The silicon could in principle drive a panel through pins on the GPIO
# headers, but no device tree we ship enables any of it, so every image is
# declared headless.
HAS_VIDEO_OUTPUT="no"

# Because 512MB of RAM does not go far.
PACKAGE_LIST_BOARD_REMOVE="snapd cloud-init"

enable_extension "sophgo-sg200x-aic8800"
4 changes: 4 additions & 0 deletions config/bootenv/sophgo-sg200x-arm64.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
verbosity=1
console=serial
earlycon=on
overlays=
4 changes: 4 additions & 0 deletions config/bootenv/sophgo-sg200x-riscv64.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
verbosity=1
console=serial
earlycon=sbi
overlays=
68 changes: 68 additions & 0 deletions config/bootscripts/boot-sophgo-sg200x.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# DO NOT EDIT THIS FILE
#
# Please edit /boot/armbianEnv.txt to set supported parameters
#

# Scratch space for armbianEnv.txt and for each overlay before it is applied.
# 0x82300000 is fdtoverlay_addr_r from the vendor U-Boot's distroboot patch: it
# sits between fdt_addr_r (0x82200000) and pxefile_addr_r (0x82400000), so there
# is 1MiB for the device tree to grow into and 1MiB of scratch after it.
setenv load_addr "0x82300000"
setenv overlay_error "false"

# Defaults, overridden by armbianEnv.txt below. The Duo S has no display, so the
# console is serial-only; "both" would add a console=tty1 that never appears.
setenv rootdev "/dev/mmcblk0p2"
setenv verbosity "1"
setenv console "serial"
setenv rootfstype "ext4"
setenv earlycon "off"

test -n "${distro_bootpart}" || distro_bootpart=1

echo "Boot script loaded from ${devtype} ${devnum}:${distro_bootpart}"

if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}armbianEnv.txt; then
load ${devtype} ${devnum}:${distro_bootpart} ${load_addr} ${prefix}armbianEnv.txt
env import -t ${load_addr} ${filesize}
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

# Two spellings, because the two architectures need different ones and share
# this script. The C906 has no memory-mapped earlycon before the SBI console is
# up, so RISC-V wants earlycon=sbi; on the Cortex-A53 the device tree's
# stdout-path is enough and plain earlycon works.
if test "${earlycon}" = "on"; then setenv consoleargs "earlycon ${consoleargs}"; fi
if test "${earlycon}" = "sbi"; then setenv consoleargs "earlycon=sbi ${consoleargs}"; fi

setenv bootargs "root=${rootdev} rootwait rootfstype=${rootfstype} ${consoleargs} rw no_console_suspend consoleblank=0 loglevel=${verbosity} fsck.fix=yes fsck.repair=yes net.ifnames=0 ${extraargs} ${extraboardargs}"

load ${devtype} ${devnum}:${distro_bootpart} ${ramdisk_addr_r} ${prefix}uInitrd
load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} ${prefix}Image

load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} ${prefix}dtb/${fdtfile}
fdt addr ${fdt_addr_r}
fdt resize 65536
for overlay_file in ${overlays}; do
if load ${devtype} ${devnum}:${distro_bootpart} ${load_addr} ${prefix}dtb/sophgo/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}:${distro_bootpart} ${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
if test "${overlay_error}" = "true"; then
echo "Error applying DT overlays, restoring original DT"
load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} ${prefix}dtb/${fdtfile}
fi

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
Loading
Loading