Set devtype devnum and distro_bootpart var when booting from nvme

This will ensure future boot scripts should function correctly.

Tested-on: BPI-F3 and MusePi Pro
Signed-off-by: Patrick Yavitz <pyavitz@gmail.com>
This commit is contained in:
Patrick Yavitz 2026-02-21 15:59:32 -05:00 committed by c0rnelius
parent a4de6bfd42
commit 57694c740d

View File

@ -1,18 +1,18 @@
From 12836b75b818985a2059921b6882418a2dd60908 Mon Sep 17 00:00:00 2001
From 767d386dcc7422266d6afc0585b7b742f631bf28 Mon Sep 17 00:00:00 2001
From: Patrick Yavitz <pyavitz@gmail.com>
Date: Fri, 20 Feb 2026 14:51:24 -0500
Subject: [PATCH] Add uefi syslinux and script support
Date: Sat, 21 Feb 2026 15:56:32 -0500
Subject: [PATCH] Add syslinux script and uefi support
Signed-off-by: Patrick Yavitz <pyavitz@gmail.com>
---
board/spacemit/k1-x/k1-x.env | 366 +++--------------------------------
1 file changed, 30 insertions(+), 336 deletions(-)
board/spacemit/k1-x/k1-x.env | 374 ++++-------------------------------
1 file changed, 38 insertions(+), 336 deletions(-)
diff --git a/board/spacemit/k1-x/k1-x.env b/board/spacemit/k1-x/k1-x.env
index 3499aec7..fe0242cd 100644
index 3499aec7..463cbd07 100644
--- a/board/spacemit/k1-x/k1-x.env
+++ b/board/spacemit/k1-x/k1-x.env
@@ -1,336 +1,30 @@
@@ -1,336 +1,38 @@
-// Common parameter
-earlycon=sbi
-init=/init
@ -349,7 +349,12 @@ index 3499aec7..fe0242cd 100644
-bootmenu_7="recovery from usb"=run flash_from_usb
-bootmenu_8="recovery from mmc"=run flash_from_mmc
-bootmenu_9="recovery from net"=run flash_from_net
+// Add UEFI, SYSLINUX and SCRIPT support
+// SYSLINUX, SCRIPT and UEFI Support
+
+nvme_devtype=nvme
+nvme_devnum=0
+nvme_bootpart=1
+
+autoboot=if test -e ${devtype} ${devnum}:${distro_bootpart} /extlinux/extlinux.conf; then \
+ sysboot ${devtype} ${devnum}:${distro_bootpart} any 0x2000000 /extlinux/extlinux.conf; \
+ elif test -e ${devtype} ${devnum}:${distro_bootpart} /boot/extlinux/extlinux.conf; then \
@ -362,16 +367,19 @@ index 3499aec7..fe0242cd 100644
+ load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} EFI/BOOT/BOOTRISCV64.EFI; bootefi ${kernel_addr_r}; \
+ fi;
+ nvme part; \
+ if test -e nvme 0:1 /extlinux/extlinux.conf; then \
+ sysboot nvme 0:1 any 0x2000000 /extlinux/extlinux.conf; \
+ elif test -e nvme 0:1 /boot/extlinux/extlinux.conf; then \
+ sysboot nvme 0:1 any 0x2000000 /boot/extlinux/extlinux.conf; \
+ elif test -e nvme 0:1 /boot.scr; then \
+ load nvme 0:1 0x2000000 /boot.scr; source 0x2000000; \
+ elif test -e nvme 0:1 /boot/boot.scr; then \
+ load nvme 0:1 0x2000000 /boot/boot.scr; source 0x2000000; \
+ elif test -e nvme 0:1 EFI/BOOT/BOOTRISCV64.EFI; then \
+ load nvme 0:1 ${kernel_addr_r} EFI/BOOT/BOOTRISCV64.EFI; bootefi ${kernel_addr_r}; \
+ setenv devtype $nvme_devtype; \
+ setenv devnum $nvme_devnum; \
+ setenv distro_bootpart $nvme_bootpart; \
+ if test -e ${devtype} ${devnum}:${distro_bootpart} /extlinux/extlinux.conf; then \
+ sysboot ${devtype} ${devnum}:${distro_bootpart} any 0x2000000 /extlinux/extlinux.conf; \
+ elif test -e ${devtype} ${devnum}:${distro_bootpart} /boot/extlinux/extlinux.conf; then \
+ sysboot ${devtype} ${devnum}:${distro_bootpart} any 0x2000000 /boot/extlinux/extlinux.conf; \
+ elif test -e ${devtype} ${devnum}:${distro_bootpart} /boot.scr; then \
+ load ${devtype} ${devnum}:${distro_bootpart} 0x2000000 /boot.scr; source 0x2000000; \
+ elif test -e ${devtype} ${devnum}:${distro_bootpart} /boot/boot.scr; then \
+ load ${devtype} ${devnum}:${distro_bootpart} 0x2000000 /boot/boot.scr; source 0x2000000; \
+ elif test -e ${devtype} ${devnum}:${distro_bootpart} EFI/BOOT/BOOTRISCV64.EFI; then \
+ load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} EFI/BOOT/BOOTRISCV64.EFI; bootefi ${kernel_addr_r}; \
+ fi;
+
+bootcmd=echo "Loading K1-X Environment ..."; \