Skip to content

Add Milk-V DuoS, an aarch64+riscv64 board - #10326

Merged
igorpecovnik merged 18 commits into
armbian:mainfrom
lukaszsobala:milkv-duos-pr
Aug 9, 2026
Merged

Add Milk-V DuoS, an aarch64+riscv64 board#10326
igorpecovnik merged 18 commits into
armbian:mainfrom
lukaszsobala:milkv-duos-pr

Conversation

@lukaszsobala

@lukaszsobala lukaszsobala commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Description

This is a squashed PR adding Milk-V DuoS, a 512 MB of RAM board with Sophgo SG2000: 1 x core A53, 1 x T-Head C906 (selected by a slide switch) and a few other CPUS. More info can be found here: https://milkv.io/docs/duo/getting-started/duos. The board is quite cheap and needs very little power, typically less than 1 watt.

The starting points were these repositories: https://github.com/queenkjuul/milkv-duo-ubuntu and https://github.com/Fishwaldo/sophgo-sg200x-debian. Claude was used liberally. I trimmed its verbose comments as far as doable. For a long time it was quite difficult to find sensible images for it, especially for arm64. Let's change this.

What this features:

  • just additions
  • mainline kernel 7.0 edge and bleedingedge (currently 7.2-rc4). Same kernel version for both architectures. Therefore, two board configs must exist
  • device tree overlays selectable normally using armbian-config. i2c, spi, uart, whatever I could enable
    • editorial decision: the C906L real-time processor is disabled by default, can be enabled using an overlay. No firmware shipped
    • editorial decision: by default, the board acts as a USB Host device (USB 2.0). The USB gadget mode can also be enabled via an overlay
  • u-boot and fip.bin are built from source every time. No blobs necessary. xpressreal-t3 is the precedent here
  • a unified image for eMMC and SD card (however, a separate command: sophgo-emmc-install must be used to install to the eMMC because the special file fip.bin selects one storage type only). May be folded later to armbian-install but it will be tricky. We ship u-boot with both versions fip.bin, then just one is written to the eMMC
    • really, there is no way to make one universal image you could just dd to the eMMC and the SD and call it a day. I tried. Making a single image is the best one can do
    • there is an extension image-output-sophgo-emmc-installer one can use to, alternatively, create an "installer SD card" which the board will flash straight to eMMC by itself. Can be used to easily unbrick the board, if this ever happens
  • WiFi and Ethernet have no MAC addresses of their own on this board. Now they are derived from the efuse
    • as much as possible, the existing framework for AIC8800 was re-used. The board has AIC8800D80
  • many fixes to the vendor device tree (mainlined) - both eMMC and SD now function together. Previously, eMMC was invisible when booted from the SD card, and the SD card was not visible when booted from the eMMC and not initially present. Pinmux fixes as well
  • 1 GHz CPU frequency as a default (vendor promises this but ships 850 MHz)
  • a companion PR fixes hashing of BSP packages which may lead to stale debs bsp-cli: version the package on the family's own packages/bsp files #10327
  • a Bluetooth-enabling service

What this doesn't feature:

  • camera interface (may be done later, I have it)
  • TPU
  • other stuff I don't even understand the names of
  • USB mode selectable without a reboot. This might be reverted by popular demand, but as it features Ethernet, connecting headlessly should be quite easy.

How Has This Been Tested?

Extensively tested by rebuilding and booting, writing images to different storages etc.

EDIT: not sure why Rabbit says there are missing assets, they were merged yesterday.
EDIT2: the missing assets are just because I used an underscore instead of a hyphen. The PR is here: armbian/armbian.github.io#377

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules

Summary by CodeRabbit

  • New Features
    • Added Milk-V Duo S support for ARM64 and RISC-V platforms.
    • Added boot support for SD and eMMC, including eMMC installer images and installation tooling.
    • Added USB host/device modes, USB networking, Wi-Fi and Bluetooth support.
    • Added configurable 26-pin header overlays for I²C, SPI, UART, and PWM.
    • Added audio, thermal monitoring, watchdog, PWM, DMA, remote-processor, and persistent crash-log support.
  • Bug Fixes
    • Improved compatibility with newer Linux kernels and RISC-V toolchains.
    • Improved stable network address handling and board peripheral initialization.

@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds Milk-V Duo S ARM64 and RISC-V64 board support for Sophgo SG2000. The change includes kernel, U-Boot, device-tree, boot, wireless, USB gadget, stable-MAC, thermal, remoteproc, PWM, eMMC installer, and image-output integration.

Changes

Sophgo SG200x platform support

Layer / File(s) Summary
Board and family integration
config/boards/*, config/sources/families/*, config/bootenv/*, config/bootscripts/*
Adds ARM64 and RISC-V64 board definitions, family configuration, boot environments, boot scripts, storage selection, source handling, and image layout configuration.
Kernel and device-tree support
config/kernel/*, patch/kernel/archive/sophgo-sg200x-*
Adds Sophgo kernel configurations, SG2000 board descriptions, peripheral drivers, thermal support, MDIO muxing, PWM, eFuse, DMA, audio, remoteproc, USB modes, storage pinmuxing, overlays, and ramoops.
U-Boot and firmware integration
patch/u-boot/*, patch/fsbl/*, patch/opensbi/*
Adds U-Boot board files and configurations, distro boot, RISC-V toolchain compatibility, FSBL assembler fixes, OpenSBI fence.tso emulation, and board peripheral setup.
BSP networking and wireless
extensions/sophgo-sg200x-aic8800.sh, packages/bsp/sophgo-sg200x/*
Adds AIC8800D80 driver integration, firmware validation, Bluetooth attachment, stable MAC generation, USB CDC-NCM gadget networking, and related system services.
eMMC installation tooling
extensions/image-output-sophgo-emmc-installer/*, packages/bsp/sophgo-sg200x/usr/sbin/sophgo-emmc-install
Adds CIMG packing, FAT32 installer image creation, eMMC image flashing, bootloader installation, validation, and storage metadata updates.

Estimated code review effort: 5 (Critical) | ~120 minutes

Possibly related PRs

Suggested labels: 05

Suggested reviewers: johnthecoolingfan, pyavitz, schwar3kat

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding Milk-V DuoS board support for both AArch64 and RISC-V 64-bit configurations.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added size/large PR with 250 lines or more 08 Milestone: Third quarter release Needs review Seeking for review Hardware Hardware related like kernel, U-Boot, ... Framework Framework components Patches Patches related to kernel, U-Boot, ... BSP Board Support Packages labels Aug 3, 2026
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

🚫 Missing required board assets

This PR adds new board configuration(s). Required assets must already exist in github/armbian/armbian.github.io.
They are required by Armbian Imager to ensure all boards are displayed with proper images.

  • Board images: board-images/<board>.png (1920x1080 px transparent)
  • Vendor logos: board-vendor-logos/<vendor>-logo.png (512x512 px transparent)

Missing items

  • Vendor logo missing for vendor milkv (used by board milkv-duos-arm)

    • Expected: board-vendor-logos/milkv-logo.png
    • Fix: add the file to armbian/armbian.github.io (folder board-vendor-logos/)
    • Naming rules: lowercase, dashes (e.g. kobol-logo.png, not Kobol_logo.png)
  • Vendor logo missing for vendor milkv (used by board milkv-duos-riscv)

    • Expected: board-vendor-logos/milkv-logo.png
    • Fix: add the file to armbian/armbian.github.io (folder board-vendor-logos/)
    • Naming rules: lowercase, dashes (e.g. kobol-logo.png, not Kobol_logo.png)

Once the missing files are added (or a PR is opened in armbian/armbian.github.io), re-run this check.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 18

🧹 Nitpick comments (12)
patch/kernel/archive/sophgo-sg200x-7.2/0043-arm64-dts-sophgo-mux-the-Milk-V-Duo-S-eMMC-pads-from.patch (2)

51-62: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider dropping the inert max-frequency.

The comment states that max-frequency = <200000000> has no effect while no-1-8-v holds the card at high speed. A property that is documented as inert invites a later reader to assume 200 MHz is reachable. Either remove it, or keep it and state in the DTS comment that it is a placeholder for a future 1.8 V configuration.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@patch/kernel/archive/sophgo-sg200x-7.2/0043-arm64-dts-sophgo-mux-the-Milk-V-Duo-S-eMMC-pads-from.patch`
around lines 51 - 62, Remove the inert max-frequency property from the emmc
node, or document it there as an explicit placeholder for a future 1.8 V
configuration; do not leave the 200 MHz setting uncommented while no-1-8-v
remains enabled.

1-2: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add the missing patch header.

This patch has no From:, Date:, Subject: or Signed-off-by: lines. Every other Armbian-authored patch in this series carries them, and the series relies on the subject for attribution and for readable build logs. The eMMC pad rationale in the file comment belongs in a commit message here.

♻️ Proposed header
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Armbian <info@armbian.com>
+Date: Sat, 1 Aug 2026 23:55:00 +0200
+Subject: [PATCH] arm64: dts: sophgo: mux the Milk-V Duo S eMMC pads from the DT
+
+The vendor U-Boot only muxes the eMMC group when it was built for eMMC
+storage, so after an SD boot Linux cannot talk to the eMMC. Own the mux
+and the power-source in the DT.
+
+Signed-off-by: Armbian <info@armbian.com>
 ---
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@patch/kernel/archive/sophgo-sg200x-7.2/0043-arm64-dts-sophgo-mux-the-Milk-V-Duo-S-eMMC-pads-from.patch`
around lines 1 - 2, 添加缺失的补丁提交头信息:在补丁内容开始处补充 From、Date、Subject 和 Signed-off-by
字段,并将文件注释中的 eMMC pad 修改理由纳入提交消息,以匹配同系列 Armbian 补丁的格式和可追溯性。
packages/bsp/sophgo-sg200x/lib/udev/sg200x-stable-mac (1)

100-100: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Optional: the success paths print, but the header says to stay quiet on success.

Lines 51-52 state that the script keeps quiet on success because output lands in the journal against systemd-udevd. Line 181 prints on every successful assignment, and line 100 prints on the leave-alone path. Both are success paths.

Either send these two messages to stderr only when they carry a decision worth recording, or update the header comment to say that one line per interface is intended. The current text and behavior disagree.

Also applies to: 181-181

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/bsp/sophgo-sg200x/lib/udev/sg200x-stable-mac` at line 100, Resolve
the contradiction between the quiet-on-success header and the success-path
messages in the sg200x udev script: update the header to document the intended
one-line-per-interface output, or change the messages at the leave-alone path
and successful assignment path to remain silent unless recording a meaningful
decision. Keep the selected behavior consistent for both output sites.
patch/u-boot/u-boot-sophgo-sg200x/cvitek-board-files/riscv64/dts/cv181x_base_riscv.dtsi (1)

147-149: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

watchdog0 and thermal declare interrupts without an interrupt parent.

The root node of this DTSI sets no interrupt-parent, and every other peripheral sets interrupt-parent = <&plic0> explicitly. These two nodes do not. The interrupt specifiers therefore do not resolve. U-Boot does not consume these interrupts, so there is no U-Boot runtime failure, but add interrupt-parent = <&plic0> so the nodes stay correct if reused.

♻️ Proposed fix
 	watchdog0: cv-wd@0x3010000 {
 		interrupts = <58 IRQ_TYPE_LEVEL_HIGH>;
+		interrupt-parent = <&plic0>;
 	};
 	thermal:thermal@030E0000 {
 		interrupts = <16 IRQ_TYPE_LEVEL_HIGH>;
 		interrupt-names = "tempsen";
+		interrupt-parent = <&plic0>;
 	};

Also applies to: 376-379

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@patch/u-boot/u-boot-sophgo-sg200x/cvitek-board-files/riscv64/dts/cv181x_base_riscv.dtsi`
around lines 147 - 149, Add interrupt-parent = <&plic0> to both watchdog0 and
thermal nodes alongside their existing interrupts properties, matching the
explicit parent declaration used by other peripherals. Do not alter the
interrupt specifiers or unrelated DTS configuration.

Source: Learnings

config/boards/milkv-duos-arm.csc (1)

16-16: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Both board targets declare the same BOARD_NAME. One display name is reused for two build targets, so /etc/armbian-release and armbian-config cannot show which core the image runs on.

  • config/boards/milkv-duos-arm.csc#L16-L16: set BOARD_NAME="Milk-V Duo S (ARM)".
  • config/boards/milkv-duos-riscv.csc#L15-L15: set BOARD_NAME="Milk-V Duo S (RISC-V)".
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@config/boards/milkv-duos-arm.csc` at line 16, Update BOARD_NAME in
config/boards/milkv-duos-arm.csc at lines 16-16 to identify the ARM target, and
update BOARD_NAME in config/boards/milkv-duos-riscv.csc at lines 15-15 to
identify the RISC-V target; use distinct display names “Milk-V Duo S (ARM)” and
“Milk-V Duo S (RISC-V)” respectively.
patch/kernel/archive/sophgo-sg200x-7.2/0028-nvmem-Add-Sophgo-eFuse-driver.patch (1)

33-45: 🗄️ Data Integrity & Integration | 🔵 Trivial | 💤 Low value

Fix the DTS indentation only.

The eFuse binding allows a single clocks entry, so the two-clock property should not be split between this comment and the binding itself. The only change needed here is to align efuse: efuse@3050000 and }; with tabs like the surrounding cv180x.dtsi content.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@patch/kernel/archive/sophgo-sg200x-7.2/0028-nvmem-Add-Sophgo-eFuse-driver.patch`
around lines 33 - 45, Fix only the DTS indentation in the efuse node: align
efuse: efuse@3050000 and its closing }; with the surrounding cv180x.dtsi content
using tabs. Leave the clocks property and all other node contents unchanged.

Source: Learnings

packages/bsp/aic8800/aic8800-bluetooth (1)

56-60: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Keep hciattach under systemd supervision.

hciattach forks, but the unit completes as a oneshot service. If the HCI child exits later, systemd keeps the unit active and cannot restart the attachment.

  • packages/bsp/aic8800/aic8800-bluetooth#L56-L60: run hciattach in the foreground with exec hciattach -n ....
  • packages/bsp/aic8800/aic8800-bluetooth.service#L10-L17: use a long-running service type and a restart policy for the foreground process.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/bsp/aic8800/aic8800-bluetooth` around lines 56 - 60, Update
packages/bsp/aic8800/aic8800-bluetooth lines 56-60 to replace the forked
hciattach invocation with the foreground form using exec hciattach -n,
preserving its existing arguments and logging. Update
packages/bsp/aic8800/aic8800-bluetooth.service lines 10-17 to configure a
long-running service type and a restart policy for the foreground hciattach
process.
config/sources/families/include/sophgo-sg200x_common.inc (1)

51-71: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add a default arm to the BRANCH case.

The ARCH case at line 235 fails loudly on an unknown value. This case does not. If BRANCH is neither edge nor bleedingedge, KERNEL_MAJOR_MINOR stays empty, KERNELPATCHDIR becomes archive/sophgo-sg200x-, and LINUXCONFIG stays unset. The build then fails later with a message that does not name the cause.

♻️ Proposed guard
 	bleedingedge)
 		declare -g KERNEL_MAJOR_MINOR="7.2"
 		declare -g KERNELBRANCH="tag:v7.2-rc5"
 		declare -g LINUXCONFIG="linux-${LINUXFAMILY}-bleedingedge"
 		;;
 
+	*)
+		exit_with_error "sophgo-sg200x: unsupported BRANCH" "${BRANCH}"
+		;;
+
 esac
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@config/sources/families/include/sophgo-sg200x_common.inc` around lines 51 -
71, Add a default arm to the BRANCH case that fails immediately for unsupported
branch values, matching the loud validation behavior of the ARCH case. Ensure
the error identifies the invalid BRANCH value before KERNELPATCHDIR is
constructed, while preserving the existing edge and bleedingedge branches.
patch/kernel/archive/sophgo-sg200x-7.2/0052-riscv-dts-sophgo-add-Milk-V-Duo-S-pin-header-overlay.patch (1)

104-118: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Stop installing the composite header DTB

Both Sophgo Makefiles add sg2000-milkv-duo-s-header.dtb to dtb-$(CONFIG_ARCH_SOPHGO), so scripts/Makefile.dtbs builds and installs *.dtb targets into /boot/dtb. The comment says only .dtbo files are installed, but the comment also says the combined tree contradicts itself and must never boot. Use a validation-only target if possible, or remove the conflicting dtb-$(CONFIG_ARCH_SOPHGO) += sg2000-milkv-duo-s-header.dtb line and add an equivalent validation rule that still passes the base .dtb to fdtoverlay.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@patch/kernel/archive/sophgo-sg200x-7.2/0052-riscv-dts-sophgo-add-Milk-V-Duo-S-pin-header-overlay.patch`
around lines 104 - 118, Stop adding sg2000-milkv-duo-s-header.dtb to the
installable dtb-$(CONFIG_ARCH_SOPHGO) list in the Sophgo DTS Makefiles. Replace
that entry with a validation-only build rule that still builds the composite
target and passes sg2000-milkv-duo-s.dtb as the base to fdtoverlay, while
leaving only the individual .dtbo files installable.
patch/kernel/archive/sophgo-sg200x-7.2/0036-riscv-dts-sophgo-add-board-support-for-Milk-V-Duo-25.patch (1)

190-199: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Use tabs for indentation in the reserved-memory node.

Lines 191-198 use spaces. The surrounding device-tree sources use tabs, and the closing brace on line 199 already uses a tab. Align the added lines with the file style.

🔧 Proposed fix
 	reserved-memory {
-    `#address-cells` = <1>;
-    `#size-cells` = <1>;
-    ranges;
-
-    coprocessor_rtos: region@8fe00000 {
-        no-map;
-        reg = <0x8fe00000 0x200000>;
-    };
+		`#address-cells` = <1>;
+		`#size-cells` = <1>;
+		ranges;
+
+		coprocessor_rtos: region@8fe00000 {
+			no-map;
+			reg = <0x8fe00000 0x200000>;
+		};
 	};
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@patch/kernel/archive/sophgo-sg200x-7.2/0036-riscv-dts-sophgo-add-board-support-for-Milk-V-Duo-25.patch`
around lines 190 - 199, Replace the space-based indentation in the
reserved-memory node, including the coprocessor_rtos region and its properties,
with tabs to match the surrounding device-tree formatting and existing closing
brace.
patch/u-boot/u-boot-sophgo-sg200x/cvitek-board-files/arm64/include/sd/imgs.h (1)

1-4: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Document that this is the untouched vendor list.

The eMMC counterpart patch/u-boot/u-boot-sophgo-sg200x/cvitek-board-files/arm64/include/emmc/imgs.h explains why its entries differ from the vendor package. This file keeps the vendor names boot.sd, logo.jpg, and rootfs.sd, which Armbian never produces. Add a one-line comment stating that the SD build does not run cvi_update, so this list stays as the vendor shipped it. That prevents a later reader from treating these names as an Armbian contract.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@patch/u-boot/u-boot-sophgo-sg200x/cvitek-board-files/arm64/include/sd/imgs.h`
around lines 1 - 4, Add a one-line explanatory comment above the imgs
declaration identifying it as the untouched vendor list and stating that the SD
build does not run cvi_update, so the vendor-provided names remain unchanged and
are not an Armbian contract.
patch/u-boot/u-boot-sophgo-sg200x/cvitek-board-files/arm64/include/sd/cvipart.h (1)

10-17: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low value

Document the unused raw SD layout macros.

ROOTFS_DEV and PARTS_OFFSET describe the vendor BOOT/MISC/ROOTFS raw split, which does not match the Armbian MBR image. The boot script sets rootdev to /dev/mmcblk0p2, and these macros are only present in board headers, so add a short comment saying they are not used by distroboot while vendor fallback paths still define them.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@patch/u-boot/u-boot-sophgo-sg200x/cvitek-board-files/arm64/include/sd/cvipart.h`
around lines 10 - 17, Add a short comment above ROOTFS_DEV and PARTS_OFFSET
documenting that these vendor raw BOOT/MISC/ROOTFS layout macros are not used by
distroboot for the Armbian MBR image, while vendor fallback paths still define
them. Keep the existing macro values unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@extensions/image-output-sophgo-emmc-installer/image-output-sophgo-emmc-installer.sh`:
- Around line 201-223: Before the original image is deleted in the
image-building flow, validate that `${work}/armbian.emmc` is smaller than the
FAT32 maximum file size of 4 GiB. If it is too large, emit a clear failure
message and abort before removing `${image_file}`; retain the existing packaging
flow for valid payload sizes.

In `@extensions/image-output-sophgo-emmc-installer/mkcimg.py`:
- Around line 125-129: Update the destination offset validation near _prgImage
to reject any negative offset before opening or writing the destination file;
enforce offset >= 0 while preserving the existing 512-byte alignment requirement
for nonnegative offsets.

In `@packages/bsp/sophgo-sg200x/usr/sbin/sg200x-usb-gadget`:
- Around line 78-88: Update do_start to roll back the gadget directory when any
setup write fails, using the existing failure-cleanup trap or equivalent cleanup
path. Ensure the trap is cleared only immediately before do_start’s successful
return, and change the initial existing-gadget handling to recognize an unbound
gadget as recoverable rather than returning success; preserve the no-op behavior
for an already configured and bound gadget.

In `@packages/bsp/sophgo-sg200x/usr/sbin/sophgo-emmc-install`:
- Around line 159-165: Normalize root_src immediately after findmnt by removing
any bracketed subvolume suffix, then use the normalized device path for the
block-device check, root_disk calculation, and later UUID comparison. Preserve
the existing self-overwrite guard behavior for regular block-device roots.
- Around line 227-238: Update the pre-write validation around fip_bytes and
boot0_bytes to reject any fip_bytes value larger than the 1 MiB gap before the
backup copy at sector 2048. Preserve the existing boot0 capacity check, and
ensure this validation occurs before changing force_ro or executing either dd in
the installation flow.

In
`@patch/kernel/archive/sophgo-sg200x-7.0/0011-riscv-dts-sophgo-add-thermal-zones-for-cv180x.patch`:
- Around line 58-60: Remove the added unmatched root-node closing brace
immediately before the soc node, keeping soc nested within the root DTS node so
the generated device tree compiles correctly.

In
`@patch/kernel/archive/sophgo-sg200x-7.0/0035-riscv-dts-sophgo-add-remoteproc-nodes-for-sg2000.patch`:
- Around line 37-40: Rename the reserved-memory node label `region@8fe00000` to
`region@9fe00000` so its unit address matches the base address specified by
`reg`; leave the `coprocessor_rtos` label and other properties unchanged.

In
`@patch/kernel/archive/sophgo-sg200x-7.0/0054-riscv-dts-sophgo-mux-the-Milk-V-Duo-S-microSD-pads-f.patch`:
- Around line 64-72: Add bias-pull-down = <0>; to the sd0-bus-pins pinctrl group
alongside bias-pull-up, ensuring inherited pull-down state is explicitly cleared
for the SD CMD and data pads while preserving the existing pinmux and
power-source settings.

In
`@patch/kernel/archive/sophgo-sg200x-7.2/0011-riscv-dts-sophgo-add-thermal-zones-for-cv180x.patch`:
- Around line 54-60: Remove the extra closing brace immediately before the soc
node in the device-tree patch, leaving the existing memory@80000000 closure
intact so soc remains inside the root node and the DTS parses successfully.

In
`@patch/kernel/archive/sophgo-sg200x-7.2/0023-drivers-remoteproc-Add-C906L-controller-for-Sophgo-C.patch`:
- Around line 267-279: Remove the redundant cv1800b_c906l_remove function that
calls rproc_del(), and remove its .remove = cv1800b_c906l_remove assignment from
the platform driver definition. Keep devm_rproc_add() as the sole cleanup
mechanism and leave the probe path unchanged.

In
`@patch/kernel/archive/sophgo-sg200x-7.2/0035-riscv-dts-sophgo-add-remoteproc-nodes-for-sg2000.patch`:
- Around line 37-40: Rename the reserved-memory node labeled coprocessor_rtos
from region@8fe00000 to region@9fe00000 so its unit address matches the first
address in reg.

In
`@patch/kernel/archive/sophgo-sg200x-7.2/0036-riscv-dts-sophgo-add-board-support-for-Milk-V-Duo-25.patch`:
- Around line 201-209: Add status = "disabled" to the c906l-rproc remoteproc
node in sg2002.dtsi, while preserving the existing board-level status = "okay"
override so only opted-in boards enable it and its coprocessor_rtos reservation.

In
`@patch/kernel/archive/sophgo-sg200x-7.2/0037-drivers-remoteproc-fix-C906L-probe-function.patch`:
- Around line 18-20: Check the return value of reset_control_assert(priv->reset)
in the probe function before calling devm_rproc_add, and return dev_err_probe()
on failure instead of registering the remote processor. Apply this change at the
reset assertion sites in both
patch/kernel/archive/sophgo-sg200x-7.2/0037-drivers-remoteproc-fix-C906L-probe-function.patch:18-20
and
patch/kernel/archive/sophgo-sg200x-7.0/0037-drivers-remoteproc-fix-C906L-probe-function.patch:18-20.

In
`@patch/kernel/archive/sophgo-sg200x-7.2/0057-arm64-dts-sophgo-reserve-a-ramoops-region-on-the-Mil.patch`:
- Around line 75-82: Update the reserved-memory nodes in both
patch/kernel/archive/sophgo-sg200x-7.2/0057-arm64-dts-sophgo-reserve-a-ramoops-region-on-the-Mil.patch
(lines 75-82) and
patch/kernel/archive/sophgo-sg200x-7.0/0056-riscv-dts-sophgo-reserve-a-ramoops-region-on-the-Mil.patch
(lines 75-82) by adding `#address-cells` = <2>, `#size-cells` = <1>, and an empty
ranges; declaration before the ramoops child, preserving the existing reg
encoding and ramoops properties.

In
`@patch/u-boot/u-boot-sophgo-sg200x/0001-cvitek-cv181x-enable-distroboot.patch`:
- Around line 49-59: Update the distroboot environment definition to use a safe
kernel load address instead of CONFIG_SYS_TEXT_BASE in kernel_addr_r. Review the
addresses in ramdisk_addr_r, kernel_comp_addr_r, and kernel_comp_size together,
ensuring compressed-kernel storage remains within the 512 MiB DRAM limit and
does not overlap U-Boot/data or reserved ION/FreeRTOS regions.

In
`@patch/u-boot/u-boot-sophgo-sg200x/cvitek-board-files/arm64/configs/cvitek_sg2000_milkv_duos_glibc_arm64_emmc_defconfig`:
- Around line 35-37: Declare MMC explicitly in both ARM64 defconfigs: add
CONFIG_MMC=y immediately before CONFIG_MMC_SDHCI=y in
patch/u-boot/u-boot-sophgo-sg200x/cvitek-board-files/arm64/configs/cvitek_sg2000_milkv_duos_glibc_arm64_emmc_defconfig
at lines 35-37 and
patch/u-boot/u-boot-sophgo-sg200x/cvitek-board-files/arm64/configs/cvitek_sg2000_milkv_duos_glibc_arm64_sd_defconfig
at lines 35-37, preserving the existing SDHCI configuration.

In
`@patch/u-boot/u-boot-sophgo-sg200x/cvitek-board-files/arm64/dts/sg2000_milkv_duos_glibc_arm64_emmc.dts`:
- Around line 26-28: Align the RISC-V *_sd.dts and *_emmc.dts device-tree
overrides with the ARM cv-sd@4310000 configuration by setting the microSD
max-frequency ceiling to 10000000. Apply this consistently to the corresponding
RISC-V board files while preserving the existing shared base configuration and
avoid changing the cap only if a documented ARM-specific signal-integrity
requirement exists.

In
`@patch/u-boot/u-boot-sophgo-sg200x/cvitek-board-files/common/dts/cv181x_base.dtsi`:
- Around line 856-857: The USB VBUS GPIO assignment is inconsistent across the
device tree and board initializers. In
patch/u-boot/u-boot-sophgo-sg200x/cvitek-board-files/common/dts/cv181x_base.dtsi
lines 856-857, confirm the schematic net and set vbus-gpio to the matching portb
line; update PINMUX_CONFIG(USB_VBUS_EN, XGPIOB_5) in
patch/u-boot/u-boot-sophgo-sg200x/cvitek-board-files/arm64/board/cvi_board_init.c
lines 41-42 and
patch/u-boot/u-boot-sophgo-sg200x/cvitek-board-files/riscv64/board/cvi_board_init.c
lines 41-42 to the corresponding GPIO function, keeping both architectures
identical.

---

Nitpick comments:
In `@config/boards/milkv-duos-arm.csc`:
- Line 16: Update BOARD_NAME in config/boards/milkv-duos-arm.csc at lines 16-16
to identify the ARM target, and update BOARD_NAME in
config/boards/milkv-duos-riscv.csc at lines 15-15 to identify the RISC-V target;
use distinct display names “Milk-V Duo S (ARM)” and “Milk-V Duo S (RISC-V)”
respectively.

In `@config/sources/families/include/sophgo-sg200x_common.inc`:
- Around line 51-71: Add a default arm to the BRANCH case that fails immediately
for unsupported branch values, matching the loud validation behavior of the ARCH
case. Ensure the error identifies the invalid BRANCH value before KERNELPATCHDIR
is constructed, while preserving the existing edge and bleedingedge branches.

In `@packages/bsp/aic8800/aic8800-bluetooth`:
- Around line 56-60: Update packages/bsp/aic8800/aic8800-bluetooth lines 56-60
to replace the forked hciattach invocation with the foreground form using exec
hciattach -n, preserving its existing arguments and logging. Update
packages/bsp/aic8800/aic8800-bluetooth.service lines 10-17 to configure a
long-running service type and a restart policy for the foreground hciattach
process.

In `@packages/bsp/sophgo-sg200x/lib/udev/sg200x-stable-mac`:
- Line 100: Resolve the contradiction between the quiet-on-success header and
the success-path messages in the sg200x udev script: update the header to
document the intended one-line-per-interface output, or change the messages at
the leave-alone path and successful assignment path to remain silent unless
recording a meaningful decision. Keep the selected behavior consistent for both
output sites.

In
`@patch/kernel/archive/sophgo-sg200x-7.2/0028-nvmem-Add-Sophgo-eFuse-driver.patch`:
- Around line 33-45: Fix only the DTS indentation in the efuse node: align
efuse: efuse@3050000 and its closing }; with the surrounding cv180x.dtsi content
using tabs. Leave the clocks property and all other node contents unchanged.

In
`@patch/kernel/archive/sophgo-sg200x-7.2/0036-riscv-dts-sophgo-add-board-support-for-Milk-V-Duo-25.patch`:
- Around line 190-199: Replace the space-based indentation in the
reserved-memory node, including the coprocessor_rtos region and its properties,
with tabs to match the surrounding device-tree formatting and existing closing
brace.

In
`@patch/kernel/archive/sophgo-sg200x-7.2/0043-arm64-dts-sophgo-mux-the-Milk-V-Duo-S-eMMC-pads-from.patch`:
- Around line 51-62: Remove the inert max-frequency property from the emmc node,
or document it there as an explicit placeholder for a future 1.8 V
configuration; do not leave the 200 MHz setting uncommented while no-1-8-v
remains enabled.
- Around line 1-2: 添加缺失的补丁提交头信息:在补丁内容开始处补充 From、Date、Subject 和 Signed-off-by
字段,并将文件注释中的 eMMC pad 修改理由纳入提交消息,以匹配同系列 Armbian 补丁的格式和可追溯性。

In
`@patch/kernel/archive/sophgo-sg200x-7.2/0052-riscv-dts-sophgo-add-Milk-V-Duo-S-pin-header-overlay.patch`:
- Around line 104-118: Stop adding sg2000-milkv-duo-s-header.dtb to the
installable dtb-$(CONFIG_ARCH_SOPHGO) list in the Sophgo DTS Makefiles. Replace
that entry with a validation-only build rule that still builds the composite
target and passes sg2000-milkv-duo-s.dtb as the base to fdtoverlay, while
leaving only the individual .dtbo files installable.

In
`@patch/u-boot/u-boot-sophgo-sg200x/cvitek-board-files/arm64/include/sd/cvipart.h`:
- Around line 10-17: Add a short comment above ROOTFS_DEV and PARTS_OFFSET
documenting that these vendor raw BOOT/MISC/ROOTFS layout macros are not used by
distroboot for the Armbian MBR image, while vendor fallback paths still define
them. Keep the existing macro values unchanged.

In
`@patch/u-boot/u-boot-sophgo-sg200x/cvitek-board-files/arm64/include/sd/imgs.h`:
- Around line 1-4: Add a one-line explanatory comment above the imgs declaration
identifying it as the untouched vendor list and stating that the SD build does
not run cvi_update, so the vendor-provided names remain unchanged and are not an
Armbian contract.

In
`@patch/u-boot/u-boot-sophgo-sg200x/cvitek-board-files/riscv64/dts/cv181x_base_riscv.dtsi`:
- Around line 147-149: Add interrupt-parent = <&plic0> to both watchdog0 and
thermal nodes alongside their existing interrupts properties, matching the
explicit parent declaration used by other peripherals. Do not alter the
interrupt specifiers or unrelated DTS configuration.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 7af3a039-ce81-42be-8647-741e953d304a

📥 Commits

Reviewing files that changed from the base of the PR and between bfec3b4 and ea1c58f.

📒 Files selected for processing (175)
  • config/boards/milkv-duos-arm.csc
  • config/boards/milkv-duos-riscv.csc
  • config/bootenv/sophgo-sg200x-arm64.txt
  • config/bootenv/sophgo-sg200x-riscv64.txt
  • config/bootscripts/boot-sophgo-sg200x.cmd
  • config/kernel/linux-sophgo-sg200x-arm64-bleedingedge.config
  • config/kernel/linux-sophgo-sg200x-arm64-edge.config
  • config/kernel/linux-sophgo-sg200x-riscv64-bleedingedge.config
  • config/kernel/linux-sophgo-sg200x-riscv64-edge.config
  • config/sources/families/include/sophgo-sg200x_common.inc
  • config/sources/families/sophgo-sg200x-arm64.conf
  • config/sources/families/sophgo-sg200x-riscv64.conf
  • extensions/image-output-sophgo-emmc-installer/image-output-sophgo-emmc-installer.sh
  • extensions/image-output-sophgo-emmc-installer/mkcimg.py
  • extensions/sophgo-sg200x-aic8800.sh
  • packages/bsp/aic8800/aic8800-bluetooth
  • packages/bsp/aic8800/aic8800-bluetooth.service
  • packages/bsp/sophgo-sg200x/etc/NetworkManager/system-connections/sg200x-usb0.nmconnection
  • packages/bsp/sophgo-sg200x/etc/systemd/network/70-sg200x-usb0.network
  • packages/bsp/sophgo-sg200x/etc/udev/rules.d/70-sg200x-stable-mac-wifi.rules
  • packages/bsp/sophgo-sg200x/etc/udev/rules.d/70-sg200x-stable-mac.rules
  • packages/bsp/sophgo-sg200x/lib/udev/sg200x-stable-mac
  • packages/bsp/sophgo-sg200x/usr/lib/systemd/system/sg200x-usb-gadget.service
  • packages/bsp/sophgo-sg200x/usr/sbin/sg200x-usb-gadget
  • packages/bsp/sophgo-sg200x/usr/sbin/sophgo-emmc-install
  • patch/fsbl/sophgo-sg200x/0001-riscv-assemble-thead-vendor-instructions-with-mainline-binutils.patch
  • patch/fsbl/sophgo-sg200x/0002-riscv-drop-the-vendor-march-string.patch
  • patch/kernel/archive/sophgo-sg200x-7.0/0001-dt-bindings-soc-sophgo-add-Milk-V-Duo-S-board-compat.patch
  • patch/kernel/archive/sophgo-sg200x-7.0/0002-arm64-dts-sophgo-add-initial-Milk-V-Duo-S-board-supp.patch
  • patch/kernel/archive/sophgo-sg200x-7.0/0003-dt-bindings-soc-sophgo-add-sg2000-plic-and-clint-doc.patch
  • patch/kernel/archive/sophgo-sg200x-7.0/0004-riscv64-dts-sophgo-add-SG2000-dtsi.patch
  • patch/kernel/archive/sophgo-sg200x-7.0/0005-riscv64-dts-sophgo-add-initial-Milk-V-Duo-S-board-su.patch
  • patch/kernel/archive/sophgo-sg200x-7.0/0006-riscv64-dts-sophgo-enable-full-512MB-RAM-for-Milk-V-.patch
  • patch/kernel/archive/sophgo-sg200x-7.0/0007-dt-bindings-thermal-sophgo-cv1800-thermal-Add-Sophgo.patch
  • patch/kernel/archive/sophgo-sg200x-7.0/0008-thermal-cv1800-Add-cv1800-thermal-driver-support.patch
  • patch/kernel/archive/sophgo-sg200x-7.0/0009-riscv-dts-sophgo-add-cv180x-thermal-sensor-dts-node.patch
  • patch/kernel/archive/sophgo-sg200x-7.0/0010-dt-bindings-net-Add-Sophgo-CV1800-MDIO-multiplexer.patch
  • patch/kernel/archive/sophgo-sg200x-7.0/0011-riscv-dts-sophgo-add-thermal-zones-for-cv180x.patch
  • patch/kernel/archive/sophgo-sg200x-7.0/0012-net-mdio-mux-Add-MDIO-mux-driver-for-Sophgo-CV1800-S.patch
  • patch/kernel/archive/sophgo-sg200x-7.0/0013-riscv-dts-sophgo-add-timer-dt-node-for-CV1800.patch
  • patch/kernel/archive/sophgo-sg200x-7.0/0014-riscv64-dts-sophgo-use-mdio-mux-driver-for-Sophgo-CV.patch
  • patch/kernel/archive/sophgo-sg200x-7.0/0015-riscv64-dts-sophgo-enable-USB-OTG-for-Milk-V-Duo-S-S.patch
  • patch/kernel/archive/sophgo-sg200x-7.0/0016-riscv64-dts-sophgo-add-watchdog-timer-node-for-Sophg.patch
  • patch/kernel/archive/sophgo-sg200x-7.0/0017-riscv64-dts-sophgo-enable-cv180x-watchdog-timer-for-.patch
  • patch/kernel/archive/sophgo-sg200x-7.0/0018-riscv64-dts-sophgo-enable-uart4-for-sg2000-milkv-duo.patch
  • patch/kernel/archive/sophgo-sg200x-7.0/0019-dt-bindings-pwm-sophgo-add-pwm-for-Sophgo-CV1800-ser.patch
  • patch/kernel/archive/sophgo-sg200x-7.0/0020-riscv-dts-sophgo-enable-all-peripherals-for-sg2000.patch
  • patch/kernel/archive/sophgo-sg200x-7.0/0021-dt-bindings-remoteproc-Add-C906L-rproc-for-Sophgo-CV.patch
  • patch/kernel/archive/sophgo-sg200x-7.0/0022-pwm-sophgo-add-pwm-support-for-Sophgo-CV1800-SoC.patch
  • patch/kernel/archive/sophgo-sg200x-7.0/0023-drivers-remoteproc-Add-C906L-controller-for-Sophgo-C.patch
  • patch/kernel/archive/sophgo-sg200x-7.0/0024-dt-bindings-dma-snps-dw-axi-dmac-Add-CV1800B-compati.patch
  • patch/kernel/archive/sophgo-sg200x-7.0/0025-dmaengine-dw-axi-dmac-Add-support-for-CV1800B-DMA.patch
  • patch/kernel/archive/sophgo-sg200x-7.0/0026-riscv-dts-sophgo-cv180x-Allow-the-DMA-multiplexer-to.patch
  • patch/kernel/archive/sophgo-sg200x-7.0/0027-dt-bindings-nvmem-Add-sophgo-efuses.patch
  • patch/kernel/archive/sophgo-sg200x-7.0/0028-nvmem-Add-Sophgo-eFuse-driver.patch
  • patch/kernel/archive/sophgo-sg200x-7.0/0029-riscv-dts-sophgo-enable-efuse-for-sg2000-milkv-duo-s.patch
  • patch/kernel/archive/sophgo-sg200x-7.0/0030-riscv-dts-sophgo-dts-nodes-for-i2s-tdm-modules.patch
  • patch/kernel/archive/sophgo-sg200x-7.0/0031-riscv-dts-sophgo-add-cv1800-PWM-device-nodes.patch
  • patch/kernel/archive/sophgo-sg200x-7.0/0032-riscv-dts-sophgo-enable-PWM-chips-for-sg2000-milkv-d.patch
  • patch/kernel/archive/sophgo-sg200x-7.0/0033-riscv-dts-sophgo-enable-I2S-devices-for-sg2000-milkv.patch
  • patch/kernel/archive/sophgo-sg200x-7.0/0034-riscv-dts-sophgo-add-mailbox-node-for-cv180x.patch
  • patch/kernel/archive/sophgo-sg200x-7.0/0035-riscv-dts-sophgo-add-remoteproc-nodes-for-sg2000.patch
  • patch/kernel/archive/sophgo-sg200x-7.0/0036-riscv-dts-sophgo-add-board-support-for-Milk-V-Duo-25.patch
  • patch/kernel/archive/sophgo-sg200x-7.0/0037-drivers-remoteproc-fix-C906L-probe-function.patch
  • patch/kernel/archive/sophgo-sg200x-7.0/0038-riscv-dts-sophgo-cv180x-use-SOC_PERIPHERAL_IRQ-for-d.patch
  • patch/kernel/archive/sophgo-sg200x-7.0/0039-arm64-dts-sophgo-enable-Milk-V-Duo-S-peripherals-in-.patch
  • patch/kernel/archive/sophgo-sg200x-7.0/0040-riscv-dts-sophgo-put-the-Milk-V-Duo-S-USB-port-in-ho.patch
  • patch/kernel/archive/sophgo-sg200x-7.0/0041-arm64-dts-sophgo-put-the-Milk-V-Duo-S-USB-port-in-ho.patch
  • patch/kernel/archive/sophgo-sg200x-7.0/0042-riscv-dts-sophgo-mux-the-Milk-V-Duo-S-eMMC-pads-from.patch
  • patch/kernel/archive/sophgo-sg200x-7.0/0043-arm64-dts-sophgo-mux-the-Milk-V-Duo-S-eMMC-pads-from.patch
  • patch/kernel/archive/sophgo-sg200x-7.0/0044-riscv-dts-sophgo-disable-the-unused-Milk-V-Duo-S-cop.patch
  • patch/kernel/archive/sophgo-sg200x-7.0/0045-arm64-dts-sophgo-disable-the-unused-Milk-V-Duo-S-cop.patch
  • patch/kernel/archive/sophgo-sg200x-7.0/0046-riscv-dts-sophgo-note-that-Milk-V-Duo-S-uart2-pads-a.patch
  • patch/kernel/archive/sophgo-sg200x-7.0/0047-arm64-dts-sophgo-note-that-Milk-V-Duo-S-uart2-pads-a.patch
  • patch/kernel/archive/sophgo-sg200x-7.0/0048-riscv-dts-sophgo-add-a-Milk-V-Duo-S-C906L-overlay.patch
  • patch/kernel/archive/sophgo-sg200x-7.0/0049-arm64-dts-sophgo-add-a-Milk-V-Duo-S-C906L-overlay.patch
  • patch/kernel/archive/sophgo-sg200x-7.0/0050-riscv-dts-sophgo-add-a-Milk-V-Duo-S-USB-device-mode-.patch
  • patch/kernel/archive/sophgo-sg200x-7.0/0051-arm64-dts-sophgo-add-a-Milk-V-Duo-S-USB-device-mode-.patch
  • patch/kernel/archive/sophgo-sg200x-7.0/0052-riscv-dts-sophgo-add-Milk-V-Duo-S-pin-header-overlay.patch
  • patch/kernel/archive/sophgo-sg200x-7.0/0053-arm64-dts-sophgo-add-Milk-V-Duo-S-pin-header-overlay.patch
  • patch/kernel/archive/sophgo-sg200x-7.0/0054-riscv-dts-sophgo-mux-the-Milk-V-Duo-S-microSD-pads-f.patch
  • patch/kernel/archive/sophgo-sg200x-7.0/0055-arm64-dts-sophgo-mux-the-Milk-V-Duo-S-microSD-pads-f.patch
  • patch/kernel/archive/sophgo-sg200x-7.0/0056-riscv-dts-sophgo-reserve-a-ramoops-region-on-the-Mil.patch
  • patch/kernel/archive/sophgo-sg200x-7.0/0057-arm64-dts-sophgo-reserve-a-ramoops-region-on-the-Mil.patch
  • patch/kernel/archive/sophgo-sg200x-7.2/0002-arm64-dts-sophgo-add-initial-Milk-V-Duo-S-board-supp.patch
  • patch/kernel/archive/sophgo-sg200x-7.2/0004-riscv64-dts-sophgo-add-SG2000-dtsi.patch
  • patch/kernel/archive/sophgo-sg200x-7.2/0005-riscv64-dts-sophgo-add-initial-Milk-V-Duo-S-board-su.patch
  • patch/kernel/archive/sophgo-sg200x-7.2/0006-riscv64-dts-sophgo-enable-full-512MB-RAM-for-Milk-V-.patch
  • patch/kernel/archive/sophgo-sg200x-7.2/0007-dt-bindings-thermal-sophgo-cv1800-thermal-Add-Sophgo.patch
  • patch/kernel/archive/sophgo-sg200x-7.2/0008-thermal-cv1800-Add-cv1800-thermal-driver-support.patch
  • patch/kernel/archive/sophgo-sg200x-7.2/0009-riscv-dts-sophgo-add-cv180x-thermal-sensor-dts-node.patch
  • patch/kernel/archive/sophgo-sg200x-7.2/0010-dt-bindings-net-Add-Sophgo-CV1800-MDIO-multiplexer.patch
  • patch/kernel/archive/sophgo-sg200x-7.2/0011-riscv-dts-sophgo-add-thermal-zones-for-cv180x.patch
  • patch/kernel/archive/sophgo-sg200x-7.2/0012-net-mdio-mux-Add-MDIO-mux-driver-for-Sophgo-CV1800-S.patch
  • patch/kernel/archive/sophgo-sg200x-7.2/0013-riscv-dts-sophgo-add-timer-dt-node-for-CV1800.patch
  • patch/kernel/archive/sophgo-sg200x-7.2/0014-riscv64-dts-sophgo-use-mdio-mux-driver-for-Sophgo-CV.patch
  • patch/kernel/archive/sophgo-sg200x-7.2/0015-riscv64-dts-sophgo-enable-USB-OTG-for-Milk-V-Duo-S-S.patch
  • patch/kernel/archive/sophgo-sg200x-7.2/0016-riscv64-dts-sophgo-add-watchdog-timer-node-for-Sophg.patch
  • patch/kernel/archive/sophgo-sg200x-7.2/0017-riscv64-dts-sophgo-enable-cv180x-watchdog-timer-for-.patch
  • patch/kernel/archive/sophgo-sg200x-7.2/0018-riscv64-dts-sophgo-enable-uart4-for-sg2000-milkv-duo.patch
  • patch/kernel/archive/sophgo-sg200x-7.2/0019-dt-bindings-pwm-sophgo-add-pwm-for-Sophgo-CV1800-ser.patch
  • patch/kernel/archive/sophgo-sg200x-7.2/0020-riscv-dts-sophgo-enable-all-peripherals-for-sg2000.patch
  • patch/kernel/archive/sophgo-sg200x-7.2/0021-dt-bindings-remoteproc-Add-C906L-rproc-for-Sophgo-CV.patch
  • patch/kernel/archive/sophgo-sg200x-7.2/0022-pwm-sophgo-add-pwm-support-for-Sophgo-CV1800-SoC.patch
  • patch/kernel/archive/sophgo-sg200x-7.2/0023-drivers-remoteproc-Add-C906L-controller-for-Sophgo-C.patch
  • patch/kernel/archive/sophgo-sg200x-7.2/0026-riscv-dts-sophgo-cv180x-Allow-the-DMA-multiplexer-to.patch
  • patch/kernel/archive/sophgo-sg200x-7.2/0027-dt-bindings-nvmem-Add-sophgo-efuses.patch
  • patch/kernel/archive/sophgo-sg200x-7.2/0028-nvmem-Add-Sophgo-eFuse-driver.patch
  • patch/kernel/archive/sophgo-sg200x-7.2/0029-riscv-dts-sophgo-enable-efuse-for-sg2000-milkv-duo-s.patch
  • patch/kernel/archive/sophgo-sg200x-7.2/0030-riscv-dts-sophgo-dts-nodes-for-i2s-tdm-modules.patch
  • patch/kernel/archive/sophgo-sg200x-7.2/0031-riscv-dts-sophgo-add-cv1800-PWM-device-nodes.patch
  • patch/kernel/archive/sophgo-sg200x-7.2/0032-riscv-dts-sophgo-enable-PWM-chips-for-sg2000-milkv-d.patch
  • patch/kernel/archive/sophgo-sg200x-7.2/0033-riscv-dts-sophgo-enable-I2S-devices-for-sg2000-milkv.patch
  • patch/kernel/archive/sophgo-sg200x-7.2/0034-riscv-dts-sophgo-add-mailbox-node-for-cv180x.patch
  • patch/kernel/archive/sophgo-sg200x-7.2/0035-riscv-dts-sophgo-add-remoteproc-nodes-for-sg2000.patch
  • patch/kernel/archive/sophgo-sg200x-7.2/0036-riscv-dts-sophgo-add-board-support-for-Milk-V-Duo-25.patch
  • patch/kernel/archive/sophgo-sg200x-7.2/0037-drivers-remoteproc-fix-C906L-probe-function.patch
  • patch/kernel/archive/sophgo-sg200x-7.2/0038-riscv-dts-sophgo-cv180x-use-SOC_PERIPHERAL_IRQ-for-d.patch
  • patch/kernel/archive/sophgo-sg200x-7.2/0039-arm64-dts-sophgo-enable-Milk-V-Duo-S-peripherals-in-.patch
  • patch/kernel/archive/sophgo-sg200x-7.2/0040-riscv-dts-sophgo-put-the-Milk-V-Duo-S-USB-port-in-ho.patch
  • patch/kernel/archive/sophgo-sg200x-7.2/0041-arm64-dts-sophgo-put-the-Milk-V-Duo-S-USB-port-in-ho.patch
  • patch/kernel/archive/sophgo-sg200x-7.2/0042-riscv-dts-sophgo-mux-the-Milk-V-Duo-S-eMMC-pads-from.patch
  • patch/kernel/archive/sophgo-sg200x-7.2/0043-arm64-dts-sophgo-mux-the-Milk-V-Duo-S-eMMC-pads-from.patch
  • patch/kernel/archive/sophgo-sg200x-7.2/0044-riscv-dts-sophgo-disable-the-unused-Milk-V-Duo-S-cop.patch
  • patch/kernel/archive/sophgo-sg200x-7.2/0045-arm64-dts-sophgo-disable-the-unused-Milk-V-Duo-S-cop.patch
  • patch/kernel/archive/sophgo-sg200x-7.2/0046-riscv-dts-sophgo-note-that-Milk-V-Duo-S-uart2-pads-a.patch
  • patch/kernel/archive/sophgo-sg200x-7.2/0047-arm64-dts-sophgo-note-that-Milk-V-Duo-S-uart2-pads-a.patch
  • patch/kernel/archive/sophgo-sg200x-7.2/0048-riscv-dts-sophgo-add-a-Milk-V-Duo-S-C906L-overlay.patch
  • patch/kernel/archive/sophgo-sg200x-7.2/0049-arm64-dts-sophgo-add-a-Milk-V-Duo-S-C906L-overlay.patch
  • patch/kernel/archive/sophgo-sg200x-7.2/0050-riscv-dts-sophgo-add-a-Milk-V-Duo-S-USB-device-mode-.patch
  • patch/kernel/archive/sophgo-sg200x-7.2/0051-arm64-dts-sophgo-add-a-Milk-V-Duo-S-USB-device-mode-.patch
  • patch/kernel/archive/sophgo-sg200x-7.2/0052-riscv-dts-sophgo-add-Milk-V-Duo-S-pin-header-overlay.patch
  • patch/kernel/archive/sophgo-sg200x-7.2/0053-arm64-dts-sophgo-add-Milk-V-Duo-S-pin-header-overlay.patch
  • patch/kernel/archive/sophgo-sg200x-7.2/0054-riscv-dts-sophgo-mux-the-Milk-V-Duo-S-microSD-pads-f.patch
  • patch/kernel/archive/sophgo-sg200x-7.2/0055-arm64-dts-sophgo-mux-the-Milk-V-Duo-S-microSD-pads-f.patch
  • patch/kernel/archive/sophgo-sg200x-7.2/0056-riscv-dts-sophgo-reserve-a-ramoops-region-on-the-Mil.patch
  • patch/kernel/archive/sophgo-sg200x-7.2/0057-arm64-dts-sophgo-reserve-a-ramoops-region-on-the-Mil.patch
  • patch/misc/aic8800/aic8800-Fix-building-on-7.1-kernel.patch
  • patch/misc/aic8800/aic8800-Fix-building-on-7.2-kernel.patch
  • patch/opensbi/sophgo-sg200x/0001-lib-sbi_illegal_insn-add-emulation-for-fence-tso.patch
  • patch/u-boot/u-boot-sophgo-sg200x/0001-cvitek-cv181x-enable-distroboot.patch
  • patch/u-boot/u-boot-sophgo-sg200x/0002-riscv-add-Zicsr-and-Zifencei-to-march.patch
  • patch/u-boot/u-boot-sophgo-sg200x/0003-mmc-cvitek-always-power-and-mux-the-SD-slot-on-probe.patch
  • patch/u-boot/u-boot-sophgo-sg200x/cvitek-board-files/arm64/board/cvi_board_init.c
  • patch/u-boot/u-boot-sophgo-sg200x/cvitek-board-files/arm64/configs/cvitek_sg2000_milkv_duos_glibc_arm64_emmc_defconfig
  • patch/u-boot/u-boot-sophgo-sg200x/cvitek-board-files/arm64/configs/cvitek_sg2000_milkv_duos_glibc_arm64_sd_defconfig
  • patch/u-boot/u-boot-sophgo-sg200x/cvitek-board-files/arm64/dts/cv181x_base_arm.dtsi
  • patch/u-boot/u-boot-sophgo-sg200x/cvitek-board-files/arm64/dts/sg2000_milkv_duos_glibc_arm64_emmc.dts
  • patch/u-boot/u-boot-sophgo-sg200x/cvitek-board-files/arm64/dts/sg2000_milkv_duos_glibc_arm64_sd.dts
  • patch/u-boot/u-boot-sophgo-sg200x/cvitek-board-files/arm64/include/cvi_board_memmap.h
  • patch/u-boot/u-boot-sophgo-sg200x/cvitek-board-files/arm64/include/cvitek.h
  • patch/u-boot/u-boot-sophgo-sg200x/cvitek-board-files/arm64/include/emmc/cvipart.h
  • patch/u-boot/u-boot-sophgo-sg200x/cvitek-board-files/arm64/include/emmc/imgs.h
  • patch/u-boot/u-boot-sophgo-sg200x/cvitek-board-files/arm64/include/sd/cvipart.h
  • patch/u-boot/u-boot-sophgo-sg200x/cvitek-board-files/arm64/include/sd/imgs.h
  • patch/u-boot/u-boot-sophgo-sg200x/cvitek-board-files/common/dts/cv181x_asic_bga.dtsi
  • patch/u-boot/u-boot-sophgo-sg200x/cvitek-board-files/common/dts/cv181x_asic_emmc.dtsi
  • patch/u-boot/u-boot-sophgo-sg200x/cvitek-board-files/common/dts/cv181x_asic_qfn.dtsi
  • patch/u-boot/u-boot-sophgo-sg200x/cvitek-board-files/common/dts/cv181x_asic_sd.dtsi
  • patch/u-boot/u-boot-sophgo-sg200x/cvitek-board-files/common/dts/cv181x_asic_spinand.dtsi
  • patch/u-boot/u-boot-sophgo-sg200x/cvitek-board-files/common/dts/cv181x_asic_spinor.dtsi
  • patch/u-boot/u-boot-sophgo-sg200x/cvitek-board-files/common/dts/cv181x_base.dtsi
  • patch/u-boot/u-boot-sophgo-sg200x/cvitek-board-files/common/dts/cv181x_default_memmap.dtsi
  • patch/u-boot/u-boot-sophgo-sg200x/cvitek-board-files/riscv64/board/cvi_board_init.c
  • patch/u-boot/u-boot-sophgo-sg200x/cvitek-board-files/riscv64/configs/cvitek_sg2000_milkv_duos_musl_riscv64_emmc_defconfig
  • patch/u-boot/u-boot-sophgo-sg200x/cvitek-board-files/riscv64/configs/cvitek_sg2000_milkv_duos_musl_riscv64_sd_defconfig
  • patch/u-boot/u-boot-sophgo-sg200x/cvitek-board-files/riscv64/dts/cv181x_base_riscv.dtsi
  • patch/u-boot/u-boot-sophgo-sg200x/cvitek-board-files/riscv64/dts/sg2000_milkv_duos_musl_riscv64_emmc.dts
  • patch/u-boot/u-boot-sophgo-sg200x/cvitek-board-files/riscv64/dts/sg2000_milkv_duos_musl_riscv64_sd.dts
  • patch/u-boot/u-boot-sophgo-sg200x/cvitek-board-files/riscv64/include/cvi_board_memmap.h
  • patch/u-boot/u-boot-sophgo-sg200x/cvitek-board-files/riscv64/include/cvitek.h
  • patch/u-boot/u-boot-sophgo-sg200x/cvitek-board-files/riscv64/include/emmc/cvipart.h
  • patch/u-boot/u-boot-sophgo-sg200x/cvitek-board-files/riscv64/include/emmc/imgs.h
  • patch/u-boot/u-boot-sophgo-sg200x/cvitek-board-files/riscv64/include/sd/cvipart.h
  • patch/u-boot/u-boot-sophgo-sg200x/cvitek-board-files/riscv64/include/sd/imgs.h

Comment thread extensions/image-output-sophgo-emmc-installer/mkcimg.py
Comment thread packages/bsp/sophgo-sg200x/usr/sbin/sg200x-usb-gadget
Comment thread packages/bsp/sophgo-sg200x/usr/sbin/sophgo-emmc-install Outdated
Comment thread packages/bsp/sophgo-sg200x/usr/sbin/sophgo-emmc-install
Comment thread config/boards/milkv-duos-arm.csc Outdated
Comment thread config/boards/milkv-duos-arm.csc Outdated
Comment thread config/boards/milkv-duos-riscv.csc Outdated
Comment thread config/sources/families/include/sophgo-sg200x_common.inc Outdated
Comment thread config/sources/families/include/sophgo-sg200x_common.inc Outdated
lukaszsobala and others added 5 commits August 4, 2026 10:07
The 34 patches written for this port carried the placeholder header the
autopatcher emits - "From: Armbian <info@armbian.com>" over a made-up Date -
which says nothing about who wrote them or when. Review asked for something
meaningful.

Each now names its real author and carries the date of the commit that last
changed that patch's content on the development branch, so the header matches
the history the patch actually has. Where a patch was revised after it was
first written - 0044 and 0052/0053 for the DT changes, 0046 for the regenerated
comment - the date is that of the revision, not the original.

The all-zero commit hash on the first line stays: these patches have no upstream
commit to point at, and that is what the rest of the tree uses to say so.

Header lines only; no patch payload was touched.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Ten patches went in as bare diffs - no From, no Date, no Subject, just a blank
line and the payload. They are the arm64 counterparts of 0040/0042/0044/0046/
0048, written in the same commits as their riscv twins and touching only files
this port creates, so they are ours to sign.

Each now carries the same header its twin does, dated to the commit that last
changed it - which for 0045 and 0047 is the commit that revised the pair, so the
two architectures stay in step. The body is one line pointing at the riscv twin
rather than a copy of its reasoning; the same change against the other DTS does
not need the argument made twice.

The two aic8800 patches had a real author but a placeholder Date of midnight UTC;
they now carry the date they were written.

Header lines only; no patch payload was touched. Every patch in this series now
has a From, a Date and a Subject.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Review asked for the absolute minimum here, and it was fair: 515 of the file's
988 lines were comment, several blocks running twenty or thirty lines to argue
a case rather than state one.

What is left says what each line does, and nothing else. Where a value looks
arbitrary the comment names the constraint behind it - boot.cmd rather than
boot.scr, CHIP_ARCH through the environment, "riscv" rather than "riscv64" -
in a clause, not a paragraph. The reasoning that was dropped is not lost; it
belongs in the port documentation rather than in a config file.

135 comment lines remain, down from 515, and the file is 607 lines rather than
988. Comments only: stripping comments and blank lines from this revision and
from the original gives identical files. shfmt and bash -n are clean.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The first line of a board config is a one-line hardware description and nothing
else. These carried a twelve-line preamble explaining the two-core split, the
slide switch and how to read the boot log, plus a link to the vendor page.

Both are now a single line in the form the rest of config/boards uses, with the
core naming the only difference between them. The explanation of why one board
ships as two configs is a thing to write down once, not in both files.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The bleedingedge branch pinned KERNELBRANCH to tag:v7.2-rc5 locally. That is
the tree's decision, not a family's: config/sources/common.conf only calls the
mainline_kernel_decide_version hooks when KERNELBRANCH is still empty, so the
local pin suppressed the whole chain in mainline-kernel.conf.sh - including the
hook that points KERNELSOURCE at Linus's tree when the stable mirrors have not
caught up with the tag yet.

Dropping it lets this family track the global pin, which is bumped weekly,
instead of sitting on whichever candidate happened to be current the day it was
written.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@lukaszsobala

Copy link
Copy Markdown
Contributor Author

Should I address any of Rabbit's concerns?

@EvilOlaf

EvilOlaf commented Aug 5, 2026

Copy link
Copy Markdown
Member

Depends on slopiness. Either address if they make sense or dismiss if not.

Comment thread config/boards/milkv-duos-arm.csc Outdated
Comment thread config/sources/families/sophgo-sg200x-arm64.conf Outdated
Comment thread extensions/sophgo-sg200x-aic8800.sh
Comment thread patch/misc/aic8800/aic8800-Fix-building-on-7.1-kernel.patch
@lukaszsobala

Copy link
Copy Markdown
Contributor Author

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Clear the inherited pull-down on SD CMD and data pads.

When U-Boot booted with an empty slot, it left these pads pulled down. bias-pull-up alone does not clear that state in this pinctrl driver. The CMD and data lines can stay at an invalid divider voltage after hot insertion.

Add bias-pull-down = <0>; to this group.

Proposed fix
 		sd0-bus-pins {
 			pinmux = <PINMUX(PIN_SD0_CMD, 0)>,
 				 <PINMUX(PIN_SD0_D0, 0)>,
 				 <PINMUX(PIN_SD0_D1, 0)>,
 				 <PINMUX(PIN_SD0_D2, 0)>,
 				 <PINMUX(PIN_SD0_D3, 0)>;
 			bias-pull-up;
+			bias-pull-down = <0>;
 			power-source = <3300>;
 		};
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

		sd0-bus-pins {
			pinmux = <PINMUX(PIN_SD0_CMD, 0)>,
				 <PINMUX(PIN_SD0_D0, 0)>,
				 <PINMUX(PIN_SD0_D1, 0)>,
				 <PINMUX(PIN_SD0_D2, 0)>,
				 <PINMUX(PIN_SD0_D3, 0)>;
			bias-pull-up;
			bias-pull-down = <0>;
			power-source = <3300>;
		};
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@patch/kernel/archive/sophgo-sg200x-7.0/0054-riscv-dts-sophgo-mux-the-Milk-V-Duo-S-microSD-pads-f.patch`
around lines 64 - 72, Add bias-pull-down = <0>; to the sd0-bus-pins pinctrl
group alongside bias-pull-up, ensuring inherited pull-down state is explicitly
cleared for the SD CMD and data pads while preserving the existing pinmux and
power-source settings.

this is wrong and would break the build

@lukaszsobala lukaszsobala reopened this Aug 5, 2026
Comment thread config/sources/families/sophgo-sg200x-arm64.conf Outdated
@lukaszsobala

lukaszsobala commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

Rabbit's nitpick comment: "Keep hciattach under systemd supervision." is genuinely useful, should this be implemented instead of the service?
@coderabbitai elaborate on this

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- Bluetooth helper ---'
cat -n packages/bsp/aic8800/aic8800-bluetooth

printf '%s\n' '--- systemd unit ---'
cat -n packages/bsp/aic8800/aic8800-bluetooth.service

printf '%s\n' '--- installation and references ---'
rg -n -C 4 \
  '(aic8800-bluetooth|hciattach|Type=oneshot|RemainAfterExit)' \
  extensions packages config patch \
  -g '*.sh' -g '*.service' -g '*.conf' -g '*.inc' -g '*.patch' || true

Length of output: 101124


@lukaszsobala Yes. This nitpick is valid, but it should modify the existing service, not replace it.

The current design starts /usr/bin/aic8800-bluetooth as a one-shot unit. The helper then runs hciattach without -n on Line 59. hciattach forks, so the helper exits successfully. aic8800-bluetooth.service stays active (exited) because of RemainAfterExit=yes.

This has two limitations:

  • systemd does not use the long-lived hciattach process as the service main process.
  • If hciattach later exits, the unit can still report success and cannot restart it.

Use the existing helper for UART discovery and port validation. Then keep hciattach in the foreground and let systemd supervise it:

  • Change the final helper command to exec hciattach -n ....
  • Change the unit to Type=simple.
  • Remove RemainAfterExit=yes.
  • Add Restart=on-failure and a short RestartSec, such as 2.
  • Keep the existing module-load ordering and Before=bluetooth.service.

This matches the already present AIC8800 unit at packages/bsp/sunxi/aic8800-bluetooth.service, which uses foreground hciattach and restart-on-failure behavior.

One qualification applies: confirm that rerunning hciattach after an unexpected exit is safe for this controller. The current comments say that firmware upload occurs through SDIO before attachment, so the retry should only reattach the H4 UART. That makes this design appropriate.

  • Update the AIC8800 Bluetooth helper to keep hciattach in the foreground.
  • Update the existing systemd unit to supervise and restart that foreground process.
  • Validate the unit syntax and review the final command arguments.

  • 📌 Create a pull request with these changes

You are interacting with an AI system.

@EvilOlaf EvilOlaf left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changes to aic8800 bt service is out of scope of this pr.

@lukaszsobala

lukaszsobala commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

@EvilOlaf
This is a newly added Bluetooth service, only affecting Milk-V Duo S, not anything else with AIC8800 Bluetooth. This change is verified working on real hardware (it was working before as well, but now the service is written more "correctly"). Should I remove the service altogether? Not sure what changes you requested.

@EvilOlaf

EvilOlaf commented Aug 6, 2026

Copy link
Copy Markdown
Member

Ah ok. I was confused because similar service files already exist https://github.com/armbian/build/blob/main/extensions/uwe5622-allwinner.sh
They are called aw859 because that's what is written on the actual chip. Perhaps they can be used as they are? Otherwise it gets confusing why there is a aic8800 and and aw859 service file in the framework

@lukaszsobala

lukaszsobala commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

Right. The board-specific Bluetooth service files are now moved to packages/bsp/sophgo-sg200x/. It was wrong to put them in packages/bsp/aic8800/ (my fault for letting the slop go unnoticed). But they can't be merged with aw859 as it is a different chip: UWE5622 (Unisoc). It uses a different blob and is attached on /dev/ttyBT0, not what we have here (uart4). The previous aic-bluetooth.service could not be reused as well, as it hardcodes /dev/ttyS1, and the Duo S BT UART has no serialN alias in the DT.

packages/bsp/aic8800/ is now back to how it was on the main branch. BSP_CLI_EXTRA_HASH_DIRS is gone from the extension.

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor
🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- Changed files ---'
git diff --name-status "$(git merge-base HEAD origin/main)" HEAD

printf '%s\n' '--- Bluetooth and hash-related diff ---'
git diff --unified=80 "$(git merge-base HEAD origin/main)" HEAD -- \
  packages/bsp/aic8800 \
  packages/bsp/sophgo-sg200x \
  extensions/sophgo-sg200x-aic8800.sh \
  config/sources/families/include/sophgo-sg200x_common.inc || true

printf '%s\n' '--- Current related paths ---'
fd -t f . packages/bsp extensions 2>/dev/null | \
  rg '(aic8800|aic-bluetooth|bluetooth\.service|sophgo-sg200x)' || true

printf '%s\n' '--- Relevant references and call contexts ---'
rg -n -C 5 \
  '(BSP_CLI_EXTRA_HASH_DIRS|aic8800-bluetooth|aic-bluetooth|hciattach|systemctl.*enable|install.*sophgo-sg200x)' \
  extensions packages config \
  -g '*.sh' -g '*.service' -g '*.rules' -g '*.inc' -g '*.conf' || true

Length of output: 186373


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- BSP hash mechanism definitions and uses ---'
rg -n -C 8 '\bBSP_CLI_EXTRA_HASH_DIRS\b' \
  lib config extensions \
  -g '*.sh' -g '*.inc' -g '*.conf' || true

printf '%s\n' '--- BSP package hook definitions and call sites ---'
rg -n -C 6 \
  '(post_family_tweaks_bsp|post_family_tweaks_bsp__|destination.*armbian-bsp|armbian-bsp-cli)' \
  lib config \
  -g '*.sh' -g '*.inc' -g '*.conf' || true

printf '%s\n' '--- Shared AIC8800 helper contract ---'
cat -n packages/bsp/aic8800/aic-bluetooth
printf '%s\n' '--- Shared AIC8800 unit contract ---'
cat -n packages/bsp/aic8800/aic-bluetooth.service

printf '%s\n' '--- Current SG200x Bluetooth assets ---'
cat -n packages/bsp/sophgo-sg200x/usr/bin/aic8800-bluetooth
cat -n packages/bsp/sophgo-sg200x/usr/lib/systemd/system/aic8800-bluetooth.service

Length of output: 112673


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- armbian-bsp-cli package hash inputs ---'
sed -n '16,92p' lib/functions/artifacts/artifact-armbian-bsp-cli.sh

printf '%s\n' '--- All repository references to the proposed extra-hash variable ---'
rg -n -C 3 '\bBSP_CLI_EXTRA_HASH_DIRS\b' . \
  -g '!cache/**' -g '!output/**' || true

printf '%s\n' '--- SG200x BSP files versus configured hash paths ---'
fd -t f . packages/bsp/sophgo-sg200x | sort

Length of output: 7174


@lukaszsobala The Bluetooth relocation is correct.

  • packages/bsp/aic8800/ is unchanged.
  • The shared aic-bluetooth helper hardcodes /dev/ttyS1 and performs a different reset sequence.
  • The Duo S helper resolves 41c0000.serial through sysfs.
  • The Duo S service keeps hciattach in the foreground and lets systemd supervise it.

I withdraw the earlier concern about reusing the shared AIC8800 service.

I found one remaining issue. BSP_CLI_EXTRA_HASH_DIRS has no consumer in the framework. lib/functions/artifacts/artifact-armbian-bsp-cli.sh hashes only its fixed directory list. It does not append BSP_CLI_EXTRA_HASH_DIRS.

As a result, a change only in packages/bsp/sophgo-sg200x/, such as a Bluetooth helper or unit update, can reuse the previous armbian-bsp-cli artifact. The updated asset then does not reach installed systems through the package upgrade path.

Please either add BSP_CLI_EXTRA_HASH_DIRS to dirs_to_hash in lib/functions/artifacts/artifact-armbian-bsp-cli.sh, or move these assets to an existing automatically hashed BSP location. The first option is more appropriate because the variable already documents this intended extension point.


✏️ Learnings added
Learnt from: lukaszsobala
URL: https://github.com/armbian/build/pull/10326

Timestamp: 2026-08-06T10:10:05.494Z
Learning: For the Milk-V Duo S Sophgo SG200x BSP, the AIC8800D80 Bluetooth controller uses UART4 at hardware address `41c0000.serial`. The device tree has no `serialN` alias for this UART, so its `/dev/ttyS*` number is not stable. The board-specific helper must resolve the UART through sysfs rather than reuse `packages/bsp/aic8800/aic-bluetooth`, which hardcodes `/dev/ttyS1` and uses a different reset sequence.

Learnt from: lukaszsobala
URL: https://github.com/armbian/build/pull/10326

Timestamp: 2026-08-06T10:10:05.494Z
Learning: The `aw859a` Bluetooth service is for the UWE5622 (Unisoc) chip and is not compatible with the AIC8800D80 on Milk-V Duo S. UWE5622 uses a different blob and `/dev/ttyBT0`; do not recommend sharing its service with the SG200x AIC8800 implementation.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor
🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- Changed paths relevant to Bluetooth/BSP hashing ---'
git diff --name-status origin/main...HEAD -- \
  packages/bsp/aic8800 \
  packages/bsp/sophgo-sg200x \
  extensions/sophgo-sg200x-aic8800.sh

printf '%s\n' '--- Relevant diff ---'
git diff --find-renames --find-copies --unified=30 origin/main...HEAD -- \
  packages/bsp/aic8800 \
  packages/bsp/sophgo-sg200x \
  extensions/sophgo-sg200x-aic8800.sh

printf '%s\n' '--- Candidate files ---'
fd -t f . packages/bsp/sophgo-sg200x packages/bsp/aic8800 2>/dev/null | sort

printf '%s\n' '--- Relevant symbol and installation references ---'
rg -n -C 4 \
  '(aic8800-bluetooth|hciattach|BSP_CLI_EXTRA_HASH_DIRS|BSP_DIR|install.*bluetooth|Type=|Restart=|RemainAfterExit)' \
  extensions/sophgo-sg200x-aic8800.sh packages/bsp/sophgo-sg200x packages/bsp/aic8800 \
  -g '*.sh' -g '*.service' -g '*.rules' -g '!*~' || true

Length of output: 64580


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- Locate Sophgo family and BSP package configuration ---'
fd -t f 'sophgo-sg200x_common.inc' config
fd -t f . lib config packages | rg '(bsp|cli|deb|hash)' | head -200

printf '%s\n' '--- BSP hash variables and package construction references ---'
rg -n -C 5 \
  '(BSP_CLI_EXTRA_HASH_DIRS|EXTRA_HASH_DIRS|packages/bsp|armbian-bsp-cli|bsp-cli|bsp_cli)' \
  config lib extensions \
  -g '*.sh' -g '*.inc' -g '*.conf' || true

printf '%s\n' '--- Relevant Sophgo family configuration ---'
common_file="$(fd -t f 'sophgo-sg200x_common.inc' config | head -n1)"
[ -n "${common_file}" ]
nl -ba "${common_file}" | sed -n '1,260p'

printf '%s\n' '--- Service syntax parser availability and unit contents ---'
command -v systemd-analyze || true
if command -v systemd-analyze >/dev/null 2>&1; then
  systemd-analyze verify packages/bsp/sophgo-sg200x/usr/lib/systemd/system/aic8800-bluetooth.service || true
fi
nl -ba packages/bsp/sophgo-sg200x/usr/lib/systemd/system/aic8800-bluetooth.service
nl -ba packages/bsp/sophgo-sg200x/usr/bin/aic8800-bluetooth

Length of output: 11270


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- Hash-related references ---'
rg -n -C 6 \
  '(BSP_CLI_EXTRA_HASH_DIRS|EXTRA_HASH_DIRS|packages/bsp|bsp-cli|bsp_cli)' \
  config/sources/families/include/sophgo-sg200x_common.inc \
  lib/functions/artifacts/artifact-armbian-bsp-cli.sh \
  lib/functions/bsp/armbian-bsp-cli-deb.sh \
  lib/functions/bsp/utils-bsp.sh \
  -g '*.sh' -g '*.inc' || true

printf '%s\n' '--- Sophgo family section that installs BSP assets ---'
nl -ba config/sources/families/include/sophgo-sg200x_common.inc | sed -n '1,360p'

printf '%s\n' '--- BSP artifact and package implementation ---'
nl -ba lib/functions/artifacts/artifact-armbian-bsp-cli.sh | sed -n '1,320p'
nl -ba lib/functions/bsp/armbian-bsp-cli-deb.sh | sed -n '1,360p'
nl -ba lib/functions/bsp/utils-bsp.sh | sed -n '1,300p'

printf '%s\n' '--- Service syntax verification ---'
if command -v systemd-analyze >/dev/null 2>&1; then
  systemd-analyze verify packages/bsp/sophgo-sg200x/usr/lib/systemd/system/aic8800-bluetooth.service
else
  echo 'systemd-analyze is not installed in the sandbox'
fi

Length of output: 43992


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- All declarations and consumers of BSP_CLI_EXTRA_HASH_DIRS ---'
rg -n -C 8 '\bBSP_CLI_EXTRA_HASH_DIRS\b' . \
  -g '!output/**' -g '!cache/**' -g '!node_modules/**' || true

printf '%s\n' '--- Complete BSP artifact version function ---'
sed -n '1,135p' lib/functions/artifacts/artifact-armbian-bsp-cli.sh

printf '%s\n' '--- Sophgo BSP hash setup ---'
sed -n '535,560p' config/sources/families/include/sophgo-sg200x_common.inc

printf '%s\n' '--- Service and helper checks without systemd execution ---'
grep -nE '^(Type|Restart|RestartSec|ExecStart|RemainAfterExit|StartLimit|Environment)=' \
  packages/bsp/sophgo-sg200x/usr/lib/systemd/system/aic8800-bluetooth.service
grep -nE 'exec hciattach -n' packages/bsp/sophgo-sg200x/usr/bin/aic8800-bluetooth

Length of output: 12629


@lukaszsobala The Bluetooth change is correct.

  • packages/bsp/aic8800/ is unchanged from main.
  • The Duo S Bluetooth helper and unit are correctly board-specific in packages/bsp/sophgo-sg200x/.
  • Reuse of the UWE5622 aw859 unit is not valid. It has different firmware and a different UART device.
  • The Duo S helper resolves the UART from 41c0000.serial. This avoids reliance on an unstable ttyS<N> number.
  • aic8800-bluetooth.service now supervises hciattach correctly through exec hciattach -n, Type=simple, and restart-on-failure.

I found one remaining issue:

BSP package version hashing does not include the new BSP asset directory.
config/sources/families/include/sophgo-sg200x_common.inc declares and populates BSP_CLI_EXTRA_HASH_DIRS, but lib/functions/artifacts/artifact-armbian-bsp-cli.sh does not consume that array when it builds dirs_to_hash.

As a result, a later change to files such as:

  • packages/bsp/sophgo-sg200x/usr/bin/aic8800-bluetooth
  • packages/bsp/sophgo-sg200x/usr/lib/systemd/system/aic8800-bluetooth.service

does not change the armbian-bsp-cli artifact version. Package repositories can then retain the old package version, and installed systems will not receive the updated assets through an upgrade.

Add the configured extra directories to the BSP artifact hash calculation, or use an existing framework-supported mechanism that hashes these assets. Also remove the Sophgo declaration only if the selected mechanism makes it unnecessary.


✏️ Learnings added
Learnt from: lukaszsobala
URL: https://github.com/armbian/build/pull/10326

Timestamp: 2026-08-06T10:11:14.403Z
Learning: For the Milk-V Duo S Sophgo SG200x support, the AIC8800D80 Bluetooth controller uses SoC UART4 at hardware address `41c0000.serial`. The UART has no `serialN` device-tree alias, so its `ttyS<N>` number is not stable. Board-specific Bluetooth code must resolve the TTY through sysfs using the hardware address instead of hardcoding a TTY number. The generic AIC8800 and UWE5622/aw859 Bluetooth helpers are not reusable because they use different controllers, firmware, and UART assumptions.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


If you found this review helpful, would you consider giving us a shout-out on X?

Thank you for using CodeRabbit!

⚠️ Action not completed

Already reviewed.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@extensions/image-output-sophgo-emmc-installer/mkcimg.py`:
- Around line 125-127: Validate part_size against U32_MAX before opening
dst_path in the relevant image-building flow, raising the appropriate validation
error for oversized values. Ensure build_chunk_header() is not reached with an
out-of-range part_size and that the destination file is not created before
validation; preserve existing handling for valid sizes.

In `@extensions/sophgo-sg200x-aic8800.sh`:
- Around line 189-205: Update the BSP hashing configuration so the effective
dirs_to_hash includes packages/bsp/sophgo-sg200x, covering the aic8800-bluetooth
helper and service installed by
post_family_tweaks_bsp__sophgo_sg200x_aic8800_bluetooth. Do not rely on
BSP_CLI_EXTRA_HASH_DIRS alone, and preserve the existing asset installation
behavior.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: d87c459f-6761-4511-a8b7-3a6017837f5c

📥 Commits

Reviewing files that changed from the base of the PR and between 6cfc6b0 and 9a8aaba.

📒 Files selected for processing (24)
  • config/boards/milkv-duos-arm.csc
  • config/boards/milkv-duos-riscv.csc
  • config/sources/families/include/sophgo-sg200x_common.inc
  • config/sources/families/sophgo-sg200x-arm64.conf
  • config/sources/families/sophgo-sg200x-riscv64.conf
  • extensions/image-output-sophgo-emmc-installer/mkcimg.py
  • extensions/sophgo-sg200x-aic8800.sh
  • packages/bsp/sophgo-sg200x/lib/udev/sg200x-stable-mac
  • packages/bsp/sophgo-sg200x/usr/bin/aic8800-bluetooth
  • packages/bsp/sophgo-sg200x/usr/lib/systemd/system/aic8800-bluetooth.service
  • packages/bsp/sophgo-sg200x/usr/sbin/sg200x-usb-gadget
  • packages/bsp/sophgo-sg200x/usr/sbin/sophgo-emmc-install
  • patch/kernel/archive/sophgo-sg200x-7.0/0028-nvmem-Add-Sophgo-eFuse-driver.patch
  • patch/kernel/archive/sophgo-sg200x-7.0/0036-riscv-dts-sophgo-add-board-support-for-Milk-V-Duo-25.patch
  • patch/kernel/archive/sophgo-sg200x-7.0/0052-riscv-dts-sophgo-add-Milk-V-Duo-S-pin-header-overlay.patch
  • patch/kernel/archive/sophgo-sg200x-7.0/0053-arm64-dts-sophgo-add-Milk-V-Duo-S-pin-header-overlay.patch
  • patch/kernel/archive/sophgo-sg200x-7.2/0028-nvmem-Add-Sophgo-eFuse-driver.patch
  • patch/kernel/archive/sophgo-sg200x-7.2/0036-riscv-dts-sophgo-add-board-support-for-Milk-V-Duo-25.patch
  • patch/kernel/archive/sophgo-sg200x-7.2/0052-riscv-dts-sophgo-add-Milk-V-Duo-S-pin-header-overlay.patch
  • patch/kernel/archive/sophgo-sg200x-7.2/0053-arm64-dts-sophgo-add-Milk-V-Duo-S-pin-header-overlay.patch
  • patch/u-boot/u-boot-sophgo-sg200x/cvitek-board-files/arm64/include/sd/cvipart.h
  • patch/u-boot/u-boot-sophgo-sg200x/cvitek-board-files/arm64/include/sd/imgs.h
  • patch/u-boot/u-boot-sophgo-sg200x/cvitek-board-files/riscv64/include/sd/cvipart.h
  • patch/u-boot/u-boot-sophgo-sg200x/cvitek-board-files/riscv64/include/sd/imgs.h
🚧 Files skipped from review as they are similar to previous changes (16)
  • config/boards/milkv-duos-arm.csc
  • patch/u-boot/u-boot-sophgo-sg200x/cvitek-board-files/riscv64/include/sd/imgs.h
  • patch/u-boot/u-boot-sophgo-sg200x/cvitek-board-files/arm64/include/sd/imgs.h
  • config/sources/families/sophgo-sg200x-riscv64.conf
  • config/sources/families/sophgo-sg200x-arm64.conf
  • config/boards/milkv-duos-riscv.csc
  • packages/bsp/sophgo-sg200x/lib/udev/sg200x-stable-mac
  • patch/kernel/archive/sophgo-sg200x-7.2/0036-riscv-dts-sophgo-add-board-support-for-Milk-V-Duo-25.patch
  • patch/u-boot/u-boot-sophgo-sg200x/cvitek-board-files/arm64/include/sd/cvipart.h
  • patch/kernel/archive/sophgo-sg200x-7.0/0028-nvmem-Add-Sophgo-eFuse-driver.patch
  • patch/kernel/archive/sophgo-sg200x-7.0/0052-riscv-dts-sophgo-add-Milk-V-Duo-S-pin-header-overlay.patch
  • config/sources/families/include/sophgo-sg200x_common.inc
  • patch/kernel/archive/sophgo-sg200x-7.0/0053-arm64-dts-sophgo-add-Milk-V-Duo-S-pin-header-overlay.patch
  • patch/kernel/archive/sophgo-sg200x-7.2/0053-arm64-dts-sophgo-add-Milk-V-Duo-S-pin-header-overlay.patch
  • packages/bsp/sophgo-sg200x/usr/sbin/sophgo-emmc-install
  • patch/kernel/archive/sophgo-sg200x-7.2/0052-riscv-dts-sophgo-add-Milk-V-Duo-S-pin-header-overlay.patch

Comment thread extensions/image-output-sophgo-emmc-installer/mkcimg.py
Comment thread extensions/sophgo-sg200x-aic8800.sh
@github-actions github-actions Bot removed the Needs review Seeking for review label Aug 6, 2026
@lukaszsobala

Copy link
Copy Markdown
Contributor Author

Thanks for reviewing @EvilOlaf, it was a big one!

@igorpecovnik
igorpecovnik merged commit 8988f4d into armbian:main Aug 9, 2026
16 checks passed
@lukaszsobala
lukaszsobala deleted the milkv-duos-pr branch August 11, 2026 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

08 Milestone: Third quarter release BSP Board Support Packages Framework Framework components Hardware Hardware related like kernel, U-Boot, ... Patches Patches related to kernel, U-Boot, ... size/large PR with 250 lines or more

Development

Successfully merging this pull request may close these issues.

3 participants