From 22b3149f23231aa0c961dc5110dbcbce1d1589ba Mon Sep 17 00:00:00 2001 From: blizzardfinnegan Date: Fri, 14 Mar 2025 15:00:24 -0400 Subject: [PATCH] Update k1-spl-dram.md Signed-off-by: Blizzard Finnegan --- k1-spl-dram.md | 98 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 97 insertions(+), 1 deletion(-) diff --git a/k1-spl-dram.md b/k1-spl-dram.md index 11ed3cd..b21becb 100644 --- a/k1-spl-dram.md +++ b/k1-spl-dram.md @@ -289,7 +289,7 @@ Now press Ctrl + C to drop into the U-Boot shell. Enjoy! :-) --- -oreboot DRAM init +# oreboot DRAM init NOTE: I reverse engineered the DRAM training blob and translated the other DRAM init code from U-Boot, staged at https://github.com/orangecms/oreboot/tree/all-the-things-wip/src/mainboard/spacemit/k1x/bt0 @@ -602,3 +602,99 @@ frequency change done! [bt0] panic in 'src/mainboard/spacemit/k1x/bt0/src/dram.rs' line 1589 [bt0] TODO ``` + +--- + + +# flash to eMMC + +Get binaries from https://drive.google.com/drive/folders/1UQHHIu6MnOFvrqAhE5PR-fHMnH8RyAf6 / openwrt-spacemit-k1-nas-MUSE-N1-ext4-pack.zip (for other vendor binaries, see also https://docs.banana-pi.org/en/BPI-F3/BananaPi_BPI-F3 ) + +``` +unzip openwrt-spacemit-k1-nas-MUSE-N1-ext4-pack.zip factory/FSBL.bin u-boot.itb factory/bootinfo_sd.bin +``` + +and use the following partition_oreboot.json: +```JSON +{ + "version": "1.0", + "format": "gpt", + "partitions": [ + { + "name": "bootinfo", + "hidden": true, + "offset": "0K", + "size": "512", + "image": "factory/bootinfo_sd.bin", + "holes": "{\"(80;512)\"}" + }, + { + "name": "fsbl", + "hidden": false, + "offset": "128K", + "size": "256K", + "image": "../u-boot/oreboot.bin" + } + ] +} +``` + +then flash the whole thing (yes, bootinfo_sd.bin is fine even though we flash to eMMC; it's weird): + +``` +fastboot stage factory/FSBL.bin +fastboot continue +sleep 2 +fastboot stage u-boot.itb +fastboot continue +sleep 5 + +fastboot flash gpt partition_oreboot.json +fastboot flash bootinfo factory/bootinfo_sd.bin +fastboot flash fsbl ../u-boot/oreboot.bin +``` + +NOTE: The above may not work with a fresh board. I initially used spacemit-flashserver --debug -part partition_oreboot.json with a modified fastboot.yaml: + +```yaml +version: 1.0 # 配置文件版本 +support: # 支持的项目代号 + - 'k1x' + - 'k1pro' +actions: # 刷机操作的定义 + + - getvar: + args: 'version-brom' + set: 'version' + skip_fail: true + timeout: + seconds: 1 + + - stage: + file: 'factory/FSBL.bin' + skip_when: "not temp.version" + timeout: + minutes: 2 + + - continue: + skip_when: "not temp.version" + timeout: + seconds: 1 + + - stage: + file: 'u-boot.itb' + skip_when: "not temp.version" + timeout: + minutes: 2 + retry: 3 + + - continue: + skip_when: "not temp.version" + timeout: + seconds: 1 + + - multi_flash: + timeout: + minutes: 10 + relate_partition: ['partition_oreboot.json'] +``` \ No newline at end of file