New device Spacemit K3 Pico-ITX #199
<!-- Generated by sourcery-ai[bot]: start review_guide -->
Reviewer's Guide
Adds full support for the SpacemiT K3 Pico-ITX device family, including X100 RISC-V microarchitecture metadata, K3 CPU/device/variants, provisioning strategy via fastboot, and board-image packages/image-combos for UFS and SD storage, plus minor message/i18n and description fixes.
Sequence diagram for SpacemiT K3 fastboot provisioning strategy
sequenceDiagram
actor User
participant Provisioner
participant SpacemitK3Plugin
participant Fastboot
User->>Provisioner: start_device_provisioning
Provisioner->>SpacemitK3Plugin: _flash_spacemit_k3(img_paths, blkdev_paths)
SpacemitK3Plugin->>Fastboot: _do_fastboot(stage, fsbl_img_path)
Fastboot-->>SpacemitK3Plugin: ret
alt [ret != 0]
SpacemitK3Plugin->>Provisioner: return ret
else [ret == 0]
SpacemitK3Plugin->>Fastboot: _do_fastboot(continue)
Fastboot-->>SpacemitK3Plugin: ret
alt [ret != 0]
SpacemitK3Plugin->>Provisioner: return ret
else [ret == 0]
SpacemitK3Plugin->>SpacemitK3Plugin: RUYI.sleep(wait_secs)
SpacemitK3Plugin->>Fastboot: _do_fastboot(stage, uboot_img_path)
Fastboot-->>SpacemitK3Plugin: ret
alt [ret != 0]
SpacemitK3Plugin->>Provisioner: return ret
else [ret == 0]
SpacemitK3Plugin->>Fastboot: _do_fastboot(continue)
Fastboot-->>SpacemitK3Plugin: ret
alt [ret != 0]
SpacemitK3Plugin->>Provisioner: return ret
else [ret == 0]
SpacemitK3Plugin->>SpacemitK3Plugin: RUYI.sleep(wait_secs)
loop partitions
SpacemitK3Plugin->>Fastboot: _do_fastboot_flash(partition, img_path)
Fastboot-->>SpacemitK3Plugin: ret
alt [ret != 0]
SpacemitK3Plugin->>Provisioner: return ret
end
end
SpacemitK3Plugin-->>Provisioner: return 0
end
end
end
end
File-Level Changes
| Change | Details | Files |
| ------ | ------- | ----- |
| Introduce SpacemiT K3 fastboot-based device provisioning strategy and pretend/flash flows. | <ul><li>Add ruyi-device-provision-strategy-spacemit-k3 plugin module implementing pretend and flash functions using internal-device-provisioner-common helpers.</li><li>Implement staged FSBL and U-Boot flashing with waits, followed by partition flashing (including optional MTD path) based on a partition_map.</li><li>Wire strategy into PROVIDED_DEVICE_PROVISION_STRATEGIES_V1 as spacemit-k3-v1 and require sudo fastboot.</li></ul> | plugins/ruyi-device-provision-strategy-spacemit-k3/mod.star |
| Register X100 microarchitecture, K3 CPU, K3 Pico-ITX device and storage variants in the entity graph. | <ul><li>Define spacemit-x100 RISC-V microarchitecture entity with detailed ISA string and arch=riscv64.</li><li>Add spacemit-k3 CPU entity related to the X100 microarchitecture.</li><li>Add spacemit-k3-pico-itx device entity with SD and UFS variants, each variant linked to the K3 CPU and identified by storage type.</li></ul> | entities/uarch/spacemit-x100.toml<br/>entities/cpu/spacemit-k3.toml<br/>entities/device/spacemit-k3-pico-itx.toml<br/>entities/device-variant/spacemit-k3-pico-itx@sd.toml<br/>entities/device-variant/spacemit-k3-pico-itx@ufs.toml |
| Provide board-image packages and image-combo entities for Bianbu Desktop LXQt and Minimal images on K3 (UEFI/non-UEFI, UFS/SD). | <ul><li>Add multiple board-image package TOMLs for LXQt and Minimal flavors for K3 on UFS, including UEFI variants, referencing upstream tarballs and checksums and using spacemit-k3-v1 provisioning strategy and partition maps.</li><li>Add corresponding board-image package TOMLs for LXQt and Minimal SD card images for K3 that are provisioned via dd-v1 with disk image mapping.</li><li>Create image-combo entities that associate K3 Pico-ITX SD/UFS variants with the appropriate board-image atoms for Desktop LXQt and Minimal, including UEFI variants.</li></ul> | packages/board-image/bianbu-desktop-lxqt-uefi-spacemit-k3/4.0.0.toml<br/>packages/board-image/bianbu-desktop-lxqt-uefi-spacemit-k3/4.0.1.toml<br/>packages/board-image/bianbu-minimal-uefi-spacemit-k3/4.0.0.toml<br/>packages/board-image/bianbu-minimal-uefi-spacemit-k3/4.0.1.toml<br/>packages/board-image/bianbu-desktop-lxqt-spacemit-k3/4.0.0.toml<br/>packages/board-image/bianbu-desktop-lxqt-spacemit-k3/4.0.1.toml<br/>packages/board-image/bianbu-minimal-spacemit-k3/4.0.0.toml<br/>packages/board-image/bianbu-minimal-spacemit-k3/4.0.1.toml<br/>packages/board-image/bianbu-desktop-lxqt-spacemit-k3-sd/4.0.0.toml<br/>packages/board-image/bianbu-desktop-lxqt-spacemit-k3-sd/4.0.1.toml<br/>packages/board-image/bianbu-minimal-spacemit-k3-sd/4.0.0.toml<br/>packages/board-image/bianbu-minimal-spacemit-k3-sd/4.0.1.toml<br/>entities/image-combo/bianbu-desktop-lxqt-spacemit-k3-sd.toml<br/>entities/image-combo/bianbu-desktop-lxqt-spacemit-k3-ufs.toml<br/>entities/image-combo/bianbu-desktop-lxqt-uefi-spacemit-k3-ufs.toml<br/>entities/image-combo/bianbu-minimal-spacemit-k3-sd.toml<br/>entities/image-combo/bianbu-minimal-spacemit-k3-ufs.toml<br/>entities/image-combo/bianbu-minimal-uefi-spacemit-k3-ufs.toml |
| Add i18n messages for K3 provisioning logs and clarify existing K1 image descriptions as UEFI. | <ul><li>Add English/Chinese message strings for K3 USB super speed OEM command success/failure to messages.toml and internal i18n compat messages.</li><li>Update metadata.desc for K1 UEFI board-image TOMLs to explicitly mention UEFI.</li></ul> | messages.toml<br/>plugins/internal-i18n-compat/data/messages.toml<br/>packages/board-image/bianbu-desktop-lite-uefi-spacemit-k1-sd/2.3.3.toml<br/>packages/board-image/bianbu-desktop-lite-uefi-spacemit-k1/2.3.3.toml |
Assessment against linked issues
| Issue | Objective | Addressed | Explanation |
| ------ | ------- | ----- | ----- |
| https://github.com/ruyisdk/packages-index/issues/200 | Add board-image package definitions for SpacemiT K3 (UEFI and non-UEFI, Minimal and Desktop, SD and UFS) that match the documented K3 images and partition layout, including the esos and ESP partitions. | ✅ | |
| https://github.com/ruyisdk/packages-index/issues/200 | Implement a SpacemiT K3 device provisioning strategy plugin that uses fastboot to flash all required partitions (fsbl, env, bootinfo, esos, opensbi, uboot/edk2, gpt, ESP, bootfs, rootfs) according to the K3 partition_universal.json and image descriptions, supporting both U-Boot and UEFI boot flows. | ✅ | |
| https://github.com/ruyisdk/packages-index/issues/200 | Define entities for the SpacemiT X100 microarchitecture, SpacemiT K3 CPU and K3 Pico-ITX device (with SD and UFS variants), and corresponding image-combos linking these to the new K3 board-image packages. | ✅ | |
Possibly linked issues
---
<details>
<summary>Tips and commands</summary>
Interacting with Sourcery
@sourcery-ai review on the pull request.issue from a review comment by replying to it. You can also reply to a
review comment with
@sourcery-ai issue to create an issue from it.@sourcery-ai anywhere in the pullrequest title to generate a title at any time. You can also comment
@sourcery-ai title on the pull request to (re-)generate the title at any time.@sourcery-ai summary anywhere inthe pull request body to generate a PR summary at any time exactly where you
want it. You can also comment
@sourcery-ai summary on the pull request to(re-)generate the summary at any time.
@sourcery-ai guide on the pullrequest to (re-)generate the reviewer's guide at any time.
@sourcery-ai resolve on thepull request to resolve all Sourcery comments. Useful if you've already
addressed all the comments and don't want to see them anymore.
@sourcery-ai dismiss on the pullrequest to dismiss all existing Sourcery reviews. Especially useful if you
want to start fresh with a new review - don't forget to comment
@sourcery-ai review to trigger a new review!Customizing Your Experience
Access your dashboard to:
summary, the reviewer's guide, and others.
Getting Help
</details>
<!-- Generated by sourcery-ai[bot]: end review_guide -->
ruyi device provision刷写过程
<img width="1006" height="1276" alt="2e75d8d2643a793cc41c55fb7bcacda7" src="https://github.com/user-attachments/assets/993b29eb-7360-4dc8-ac11-f37823df7b50" />
<img width="1285" height="1065" alt="b9f65ff8399c4dc15d88ec0b8967fda5" src="https://github.com/user-attachments/assets/8355b59a-a78e-4f61-8250-2cd0066f028f" />
<img width="1989" height="1296" alt="fac948e1812ef49232adc3f5297ad957" src="https://github.com/user-attachments/assets/06ebf8f8-cd11-41d0-9230-7c85eaebca7a" />
<img width="1461" height="1293" alt="d53ea142e6e7184a27178d5704c970e4" src="https://github.com/user-attachments/assets/2bd2acf8-4de1-4aea-9b0a-37ad94287b40" />
<img width="1279" height="1288" alt="d600e8341efddf7733aa6caa71628810" src="https://github.com/user-attachments/assets/e34635cf-f21c-46e5-91f6-753d12012db1" />
<img width="1376" height="1085" alt="01c3fc3293e145351c5ed95d8ba6f1cf" src="https://github.com/user-attachments/assets/6c281ecd-d180-407b-8be9-c26785f310a3" />
<img width="1920" height="1080" alt="b9bdcbc2c0381a7f787175fd729ca1fe" src="https://github.com/user-attachments/assets/4cdb1c6e-ab9c-453b-b781-7fcdc6097d3c" />
uefi镜像烧录
<img width="943" height="1231" alt="image" src="https://github.com/user-attachments/assets/84ff1cc0-9a74-405a-ab36-43660f59f41b" />
<img width="844" height="719" alt="image" src="https://github.com/user-attachments/assets/16a24ee8-8616-4d45-9fec-9e210fa6dc5c" />
<img width="1884" height="1287" alt="image" src="https://github.com/user-attachments/assets/24cf7730-9496-4463-9e45-9eb2c6c8237e" />
<img width="1474" height="1285" alt="image" src="https://github.com/user-attachments/assets/851abd03-50db-4095-8848-d246c0e08652" />
<img width="1458" height="1279" alt="image" src="https://github.com/user-attachments/assets/48b620e4-f6d0-488a-9250-ff4d79778da6" />
<img width="1319" height="1297" alt="image" src="https://github.com/user-attachments/assets/82c49b52-81d5-4f41-ab22-787b84e1e2e3" />
<img width="1016" height="584" alt="19523bb7f64401aaa14384161efcdcb5" src="https://github.com/user-attachments/assets/2cabe21e-f1c4-4631-a7c9-c87defdd8ef4" />
issue: Pretend output flashes ESP from the ESOS image instead of the ESP image, which differs from the actual flashing logic.
In _pretend_spacemit_k3, the ESP partition is shown as being flashed from esos_path, but _flash_spacemit_k3 correctly uses img_paths["esp"] for "ESP". Please update the pretend output to use img_paths["esp"] (or an esp_path variable) so it matches the real flashing sequence and avoids confusing users.
Hey - I've found 1 issue, and left some high level feedback:
<details>
<summary>Prompt for AI Agents</summary>
~~~markdown
Please address the comments from this code review:
Overall Comments
Individual Comments
Comment 1
<location path="plugins/ruyi-device-provision-strategy-spacemit-k3/mod.star" line_range="64-67" />
<code_context>
+ msg_flash.format(img_path=env_path, part="env"),
+ msg_flash.format(img_path=bootinfo_path, part="bootinfo"),
+ msg_flash.format(img_path=fsbl_path, part="fsbl"),
+ msg_flash.format(img_path=img_paths["esos"], part="esos"),
+ msg_flash.format(img_path=opensbi_path, part="opensbi"),
+ msg_flash.format(img_path=uboot_path, part="uboot"),
+ msg_flash.format(img_path=esos_path, part="ESP"),
+ msg_flash.format(img_path=bootfs_path, part="bootfs"),
+ msg_flash.format(img_path=rootfs_path, part="rootfs"),
</code_context>
<issue_to_address>
issue: Pretend output flashes ESP from the ESOS image instead of the ESP image, which differs from the actual flashing logic.
In _pretend_spacemit_k3, the ESP partition is shown as being flashed from esos_path, but _flash_spacemit_k3 correctly uses img_paths["esp"] for "ESP". Please update the pretend output to use img_paths["esp"] (or an esp_path variable) so it matches the real flashing sequence and avoids confusing users.
</issue_to_address>
~~~
</details>
***
<details>
<summary>Sourcery is free for open source - if you like our reviews please consider sharing them ✨</summary>
</details>
<sub>
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
</sub>
isa = "rv64imafdcvh_sdtrig_smaia_smcntrpmf_smepmp_smstateen_ssaia_sscofpmf_sspm_sstc_svinval_svnapot_svpbmt_svvptc_zicbom_zicbop_zicboz_zicntr_zicond_zicsr_zifencei_zihintntl_zihintpause_zihpm_zimop_zaamo_zalrsc_zawrs_zca_zcb_zcd_zcmop_zfa_zfbfmin_zfh_zfhmin_zkt_zba_zbb_zbc_zbs_zbkc_zmmul_zvbb_zvbc_zve32f_zve32x_zve64d_zve64f_zve64x_zvfbfmin_zvfbfwma_zvfh_zvfhmin_zvkb_zvkg_zvkned_zvknha_zvknhb_zvksed_zvksh_zvkt_zvl32b_zvl64b_zvl128b_zvl256b_xsmtvmadoti8"
Fixed and merged.
xen0n
weilinfox
Fix: #200
`
entities/uarch/spacemit-x100.toml` 这个我也无法完全确定。在 #200 附上了 ruapu 的结果和 cpuinfo。Summary by Sourcery
Add support for the SpacemiT K3 Pico-ITX device based on the SpacemiT X100 RISC-V microarchitecture, including its CPU and storage variants.
New Features:
Summary by Sourcery
Add support for the SpacemiT K3 Pico-ITX device family and associated provisioning workflow and images.
New Features:
Enhancements: