SpacemiT: BananaPi F3: U-Boot: use TAGS and add SCRIPT support.

A boot.cmd file still needs to be created, but this is
functional.

Overlay support is now baked into the syslinux patch.

Signed-off-by: Patrick Yavitz <pyavitz@xxxxx.com>
This commit is contained in:
Patrick Yavitz 2024-07-16 12:32:23 -04:00 committed by c0rnelius
parent 0898df5db4
commit 7f47cc7a53
6 changed files with 166 additions and 122 deletions

View File

@ -21,7 +21,7 @@ declare -g ATF_TARGET_MAP="PLATFORM_DEFCONFIG=k1_defconfig PLATFORM=generic ;;bu
# U-Boot
declare -g BOOTSOURCE="https://gitee.com/bianbu-linux/uboot-2022.10.git"
declare -g BOOTBRANCH="${BOOTBRANCH_BOARD:-"branch:bl-v1.0.y"}"
declare -g BOOTBRANCH="${BOOTBRANCH_BOARD:-"tag:v1.0.8"}"
declare -g BOOTDIR='u-boot-spacemit'
declare -g BOOTPATCHDIR="${BOOTPATCHDIR:-"legacy/u-boot-spacemit-k1"}"
declare -g UBOOT_TARGET_MAP=";;bootinfo_emmc.bin FSBL.bin u-boot.itb fw_dynamic.itb"

View File

@ -1,43 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Patrick Yavitz <pyavitz@armbian.com>
Date: Fri, 14 Jun 2024 10:39:21 -0400
Subject: overlay support
Signed-off-by: Patrick Yavitz <pyavitz@armbian.com>
---
configs/k1_defconfig | 1 +
include/configs/k1-x.h | 2 ++
2 files changed, 3 insertions(+)
diff --git a/configs/k1_defconfig b/configs/k1_defconfig
index 111111111111..222222222222 100644
--- a/configs/k1_defconfig
+++ b/configs/k1_defconfig
@@ -272,3 +272,4 @@ CONFIG_IMAGE_SPARSE_TRANSFER_BLK_NUM=0x3000
# CONFIG_SPL_SHA256 is not set
CONFIG_ZSTD=y
CONFIG_FDT_FIXUP_PARTITIONS=y
+CONFIG_OF_LIBFDT_OVERLAY=y
diff --git a/include/configs/k1-x.h b/include/configs/k1-x.h
index 111111111111..222222222222 100644
--- a/include/configs/k1-x.h
+++ b/include/configs/k1-x.h
@@ -141,6 +141,7 @@ struct boot_storage_op
#define KERNEL_ADDR_R __stringify(0x10000000)
#define FDT_ADDR_R __stringify(0x1F000000)
#define RAMDISK_ADDR_R __stringify(0x21000000)
+#define FDTOVERLAY_ADDR_R __stringify(0x01000000)
#include <config_distro_bootcmd.h>
@@ -172,6 +173,7 @@ struct boot_storage_op
"fdt_addr_r=" FDT_ADDR_R "\0" \
"kernel_addr_r=" KERNEL_ADDR_R "\0" \
"ramdisk_addr_r=" RAMDISK_ADDR_R "\0" \
+ "fdtoverlay_addr_r=" FDTOVERLAY_ADDR_R "\0" \
"fdtfile=spacemit/" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0" \
"dtb_addr=" __stringify(DTB_LOAD_ADDR) "\0" \
"scriptaddr=0x2c100000\0" \
--
Armbian

View File

@ -1,20 +1,21 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From ce3a6afb82e1ac21ddccffa2bfb32efb938d65f4 Mon Sep 17 00:00:00 2001
From: Banana Pi -BPI <lionwang@sinovoip.com.cn>
Date: Sat, 29 Jun 2024 08:30:56 -0400
Subject: MBR support
Date: Thu, 11 Jul 2024 07:33:58 -0400
Subject: [PATCH] MBR support
Signed-off-by: Banana Pi -BPI <lionwang@sinovoip.com.cn>
Signed-off-by: Patrick Yavitz <pyavitz@armbian.com>
---
board/spacemit/k1-x/k1x.c | 10 ++++-
common/spl/spl_mmc.c | 22 +++++++++-
board/spacemit/k1-x/k1x.c | 10 +++++++++-
common/spl/spl_mmc.c | 22 ++++++++++++++++++++--
configs/k1_defconfig | 1 +
3 files changed, 30 insertions(+), 3 deletions(-)
diff --git a/board/spacemit/k1-x/k1x.c b/board/spacemit/k1-x/k1x.c
index 111111111111..222222222222 100644
index 192a850a29..ec1beb3e7a 100644
--- a/board/spacemit/k1-x/k1x.c
+++ b/board/spacemit/k1-x/k1x.c
@@ -310,6 +310,7 @@ void _load_env_from_blk(struct blk_desc *dev_desc, const char *dev_name, int dev
@@ -313,6 +313,7 @@ void _load_env_from_blk(struct blk_desc *dev_desc, const char *dev_name, int dev
char cmd[128];
struct disk_partition info;
@ -22,7 +23,7 @@ index 111111111111..222222222222 100644
for (part = 1; part <= MAX_SEARCH_PARTITIONS; part++) {
err = part_get_info(dev_desc, part, &info);
if (err)
@@ -319,8 +320,13 @@ void _load_env_from_blk(struct blk_desc *dev_desc, const char *dev_name, int dev
@@ -322,8 +323,13 @@ void _load_env_from_blk(struct blk_desc *dev_desc, const char *dev_name, int dev
break;
}
}
@ -37,7 +38,7 @@ index 111111111111..222222222222 100644
env_set("bootfs_part", simple_itoa(part));
env_set("bootfs_devname", dev_name);
@@ -330,12 +336,14 @@ void _load_env_from_blk(struct blk_desc *dev_desc, const char *dev_name, int dev
@@ -333,12 +339,14 @@ void _load_env_from_blk(struct blk_desc *dev_desc, const char *dev_name, int dev
sprintf(cmd, "load %s %d:%d 0x%x env_%s.txt", dev_name,
dev, part, CONFIG_SPL_LOAD_FIT_ADDRESS, CONFIG_SYS_CONFIG_NAME);
pr_debug("cmd:%s\n", cmd);
@ -53,7 +54,7 @@ index 111111111111..222222222222 100644
pr_info("load env_%s.txt from bootfs successful\n", CONFIG_SYS_CONFIG_NAME);
}
diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c
index 111111111111..222222222222 100644
index acf2b278e8..581958bb1e 100644
--- a/common/spl/spl_mmc.c
+++ b/common/spl/spl_mmc.c
@@ -91,6 +91,7 @@ int mmc_load_image_raw_sector(struct spl_image_info *spl_image,
@ -103,7 +104,7 @@ index 111111111111..222222222222 100644
#endif
}
diff --git a/configs/k1_defconfig b/configs/k1_defconfig
index 111111111111..222222222222 100644
index 439db27210..a3adf4b091 100644
--- a/configs/k1_defconfig
+++ b/configs/k1_defconfig
@@ -23,6 +23,7 @@ CONFIG_ARCH_RV64I=y
@ -115,5 +116,5 @@ index 111111111111..222222222222 100644
CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x1000000
--
Armbian
2.39.2

View File

@ -1,22 +1,27 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From e646c31222ba2175e7ded14507f852a1a2202e8e Mon Sep 17 00:00:00 2001
From: Banana Pi -BPI <lionwang@sinovoip.com.cn>
Date: Wed, 15 May 2024 22:16:08 +0800
Subject: change AUTOBOOT_STOP_STR to Space KEY
Date: Thu, 11 Jul 2024 07:37:18 -0400
Subject: [PATCH] change AUTOBOOT_STOP_STR to Space KEY
Signed-off-by: Banana Pi -BPI <lionwang@sinovoip.com.cn>
Signed-off-by: Patrick Yavitz <pyavitz@armbian.com>
---
configs/k1_defconfig | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
configs/k1_defconfig | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/configs/k1_defconfig b/configs/k1_defconfig
index 111111111111..222222222222 100644
index a3adf4b091..4ee8f69e47 100644
--- a/configs/k1_defconfig
+++ b/configs/k1_defconfig
@@ -36,7 +36,10 @@ CONFIG_LEGACY_IMAGE_FORMAT=y
@@ -35,9 +35,12 @@ CONFIG_SPL_LOAD_FIT_ADDRESS=0x11000000
CONFIG_LEGACY_IMAGE_FORMAT=y
CONFIG_SUPPORT_RAW_INITRD=y
CONFIG_BOOTDELAY=0
CONFIG_OF_BOARD_SETUP=y
-CONFIG_BOOTDELAY=0
+CONFIG_BOOTDELAY=2
CONFIG_AUTOBOOT_KEYED=y
-CONFIG_AUTOBOOT_STOP_STR="s"
+CONFIG_AUTOBOOT_PROMPT="Auto-boot in %d seconds, press <Space> to stop\n"
+CONFIG_AUTOBOOT_PROMPT="Autoboot in %d seconds, press <Space> to stop\n"
+CONFIG_AUTOBOOT_DELAY_STR=""
+CONFIG_AUTOBOOT_STOP_STR=" "
+CONFIG_AUTOBOOT_KEYED_CTRLC=y
@ -24,5 +29,5 @@ index 111111111111..222222222222 100644
CONFIG_BOOTCOMMAND="bootm 0x11000000"
CONFIG_LOGLEVEL=7
--
Armbian
2.39.2

View File

@ -1,29 +1,26 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From cfa8de6bd957231e4a3ff0e3c6488ef579598afc Mon Sep 17 00:00:00 2001
From: Patrick Yavitz <pyavitz@armbian.com>
Date: Sat, 29 Jun 2024 08:42:10 -0400
Subject: extlinux support
Date: Thu, 11 Jul 2024 07:43:37 -0400
Subject: [PATCH] Syslinux and script support
Signed-off-by: Patrick Yavitz <pyavitz@armbian.com>
---
board/spacemit/k1-x/k1-x.env | 173 +---------
configs/k1_defconfig | 2 +
include/configs/k1-x.h | 13 +-
3 files changed, 22 insertions(+), 166 deletions(-)
board/spacemit/k1-x/k1-x.env | 184 ++++-------------------------------
board/spacemit/k1-x/k1x.c | 20 ++--
configs/k1_defconfig | 3 +
include/configs/k1-x.h | 23 ++---
4 files changed, 43 insertions(+), 187 deletions(-)
diff --git a/board/spacemit/k1-x/k1-x.env b/board/spacemit/k1-x/k1-x.env
index 111111111111..222222222222 100644
index b0a1cd6000..acb1ef7a11 100644
--- a/board/spacemit/k1-x/k1-x.env
+++ b/board/spacemit/k1-x/k1-x.env
@@ -1,4 +1,4 @@
-// Common parameter
+// Common Parameters
earlycon=sbi
console=ttyS0,115200
init=/init
@@ -10,166 +10,15 @@ stdin=serial,usbkbd
@@ -8,168 +8,24 @@ loglevel=8
stderr=serial
stdin=serial,usbkbd
stdout=serial
workqueue.default_affinity_scope=system
-workqueue.default_affinity_scope=system
-
-//partitions/mtdparts/mtdids would set while flashing env.bin
-
-// Nor flash rootfs device
@ -162,18 +159,8 @@ index 111111111111..222222222222 100644
- elif test ${boot_device} = mmc; then \
- run mmc_boot; \
- fi;
+// Extlinux
+autoboot=if test -e ${boot_device} ${boot_devnum}:${bootfs_part} /extlinux/extlinux.conf; then \
+ sysboot ${boot_device} ${boot_devnum}:${bootfs_part} any 0x2000000 /extlinux/extlinux.conf; \
+ elif test -e ${boot_device} ${boot_devnum}:${bootfs_part} /boot/extlinux/extlinux.conf; then \
+ sysboot ${boot_device} ${boot_devnum}:${bootfs_part} any 0x2000000 /boot/extlinux/extlinux.conf; \
+ elif test -e nvme ${devnum}:${partition} /extlinux/extlinux.conf; then \
+ sysboot nvme ${devnum}:${partition} any 0x2000000 /extlinux/extlinux.conf; \
+ elif test -e nvme ${devnum}:${partition} /boot/extlinux/extlinux.conf; then \
+ sysboot nvme ${devnum}:${partition} any 0x2000000 /boot/extlinux/extlinux.conf; \
+ fi;
bootcmd=run autoboot; echo "run autoboot"
-
-bootcmd=run autoboot; echo "run autoboot"
-
-// Boot menu definitions
-boot_default=echo "Current Boot Device: ${boot_device}"
@ -196,12 +183,87 @@ index 111111111111..222222222222 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
-
+// SYSLINUX and SCRIPT Support
+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 \
+ 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 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; \
+ fi;
+
+bootcmd=echo "Loading ..."; run autoboot
diff --git a/board/spacemit/k1-x/k1x.c b/board/spacemit/k1-x/k1x.c
index ec1beb3e7a..f8fe46368f 100644
--- a/board/spacemit/k1-x/k1x.c
+++ b/board/spacemit/k1-x/k1x.c
@@ -331,8 +331,8 @@ void _load_env_from_blk(struct blk_desc *dev_desc, const char *dev_name, int dev
#endif
}
- env_set("bootfs_part", simple_itoa(part));
- env_set("bootfs_devname", dev_name);
+ env_set("distro_bootpart", simple_itoa(part));
+ env_set("devnum", dev_name);
/*load env.txt and import to uboot*/
memset((void *)CONFIG_SPL_LOAD_FIT_ADDRESS, 0, CONFIG_ENV_SIZE);
@@ -511,7 +511,7 @@ void setenv_boot_mode(void)
u32 boot_mode = get_boot_mode();
switch (boot_mode) {
case BOOT_MODE_NAND:
- env_set("boot_device", "nand");
+ env_set("devtype", "nand");
break;
case BOOT_MODE_NOR:
char *blk_name;
@@ -522,23 +522,23 @@ void setenv_boot_mode(void)
return;
}
- env_set("boot_device", "nor");
- env_set("boot_devnum", simple_itoa(blk_index));
+ env_set("devtype", "nor");
+ env_set("devnum", simple_itoa(blk_index));
break;
case BOOT_MODE_EMMC:
- env_set("boot_device", "mmc");
- env_set("boot_devnum", simple_itoa(MMC_DEV_EMMC));
+ env_set("devtype", "mmc");
+ env_set("devnum", simple_itoa(MMC_DEV_EMMC));
break;
case BOOT_MODE_SD:
- env_set("boot_device", "mmc");
- env_set("boot_devnum", simple_itoa(MMC_DEV_SD));
+ env_set("devtype", "mmc");
+ env_set("devnum", simple_itoa(MMC_DEV_SD));
break;
case BOOT_MODE_USB:
// for fastboot image download and run test
env_set("bootcmd", CONFIG_BOOTCOMMAND);
break;
default:
- env_set("boot_device", "");
+ env_set("devtype", "");
break;
}
}
diff --git a/configs/k1_defconfig b/configs/k1_defconfig
index 111111111111..222222222222 100644
index 4ee8f69e47..b615296e6c 100644
--- a/configs/k1_defconfig
+++ b/configs/k1_defconfig
@@ -42,6 +42,8 @@ CONFIG_AUTOBOOT_STOP_STR=" "
@@ -43,6 +43,8 @@ CONFIG_AUTOBOOT_STOP_STR=" "
CONFIG_AUTOBOOT_KEYED_CTRLC=y
CONFIG_USE_BOOTCOMMAND=y
CONFIG_BOOTCOMMAND="bootm 0x11000000"
@ -210,47 +272,66 @@ index 111111111111..222222222222 100644
CONFIG_LOGLEVEL=7
CONFIG_SPL_LOGLEVEL=1
# CONFIG_SYS_DEVICE_NULLDEV is not set
@@ -273,3 +275,4 @@ CONFIG_IMAGE_SPARSE_TRANSFER_BLK_NUM=0x3000
# CONFIG_SPL_SHA256 is not set
CONFIG_ZSTD=y
CONFIG_FDT_FIXUP_PARTITIONS=y
+CONFIG_OF_LIBFDT_OVERLAY=y
diff --git a/include/configs/k1-x.h b/include/configs/k1-x.h
index 111111111111..222222222222 100644
index 023bd4b77f..e7fc803e91 100644
--- a/include/configs/k1-x.h
+++ b/include/configs/k1-x.h
@@ -86,7 +86,7 @@
@@ -82,11 +82,6 @@
#define TLV_CODE_EEPROM_I2C_INDEX 0x81
#define TLV_CODE_EEPROM_PIN_GROUP 0x82
// #define RAMDISK_LOAD_ADDR (CONFIG_FASTBOOT_BUF_ADDR + CONFIG_FASTBOOT_BUF_SIZE)
// #define DTB_LOAD_ADDR (CONFIG_FASTBOOT_BUF_ADDR + CONFIG_FASTBOOT_BUF_SIZE * 2)
-// #define RAMDISK_LOAD_ADDR (CONFIG_FASTBOOT_BUF_ADDR + CONFIG_FASTBOOT_BUF_SIZE)
-// #define DTB_LOAD_ADDR (CONFIG_FASTBOOT_BUF_ADDR + CONFIG_FASTBOOT_BUF_SIZE * 2)
-#define RAMDISK_LOAD_ADDR 0x21000000
+//#define RAMDISK_LOAD_ADDR 0x21000000
#define DTB_LOAD_ADDR 0x31000000
#ifndef __ASSEMBLY__
@@ -135,10 +135,13 @@ struct boot_storage_op
#define BOOTFS_NAME ("bootfs")
/* Environment options */
-#define DTB_LOAD_ADDR 0x31000000
-
// for those has NOT been through test procedure(ATE)
#define SVT_DRO_DEFAULT_VALUE (120)
@@ -140,6 +135,11 @@ struct boot_storage_op
#define BOOT_TARGET_DEVICES(func) \
func(QEMU, qemu, na)
+#define KERNEL_ADDR_R __stringify(0x10000000)
+#define FDT_ADDR_R __stringify(0x1F000000)
+#define RAMDISK_ADDR_R __stringify(0x21000000)
+#define FDT_ADDR_R __stringify(0x31000000)
+#define FDTOVERLAY_ADDR_R __stringify(0x01000000)
+
#include <config_distro_bootcmd.h>
#define BOOTENV_DEV_QEMU(devtypeu, devtypel, instance) \
@@ -166,8 +169,10 @@ struct boot_storage_op
@@ -165,11 +165,6 @@ struct boot_storage_op
/*if env not use for spl, please define to board/spacemit/k1-x/k1-x.env */
#define CONFIG_EXTRA_ENV_SETTINGS \
"stdout_flash=serial,vidconsole\0" \
"kernel_comp_addr_r=" __stringify(CONFIG_SYS_LOAD_ADDR) "\0" \
"kernel_comp_size=" __stringify(CONFIG_FASTBOOT_BUF_SIZE) "\0" \
- "kernel_comp_addr_r=" __stringify(CONFIG_SYS_LOAD_ADDR) "\0" \
- "kernel_comp_size=" __stringify(CONFIG_FASTBOOT_BUF_SIZE) "\0" \
- "kernel_addr_r=" __stringify(CONFIG_FASTBOOT_BUF_ADDR) "\0" \
- "ramdisk_addr=" __stringify(RAMDISK_LOAD_ADDR) "\0" \
- "dtb_addr=" __stringify(DTB_LOAD_ADDR) "\0" \
"scriptaddr=0x2c100000\0" \
"pxefile_addr_r=0x0c200000\0" \
"ipaddr=192.168.1.15\0" \
@@ -177,9 +172,11 @@ struct boot_storage_op
"serverip=10.0.92.134\0" \
"gatewayip=192.168.1.1\0" \
"net_data_path=spacemit_flash_file/net_flash_file/\0" \
- "splashimage=" __stringify(CONFIG_FASTBOOT_BUF_ADDR) "\0" \
- "splashpos=m,m\0" \
- "splashfile=bianbu.bmp\0" \
+ "fdt_addr_r=" FDT_ADDR_R "\0" \
+ "kernel_addr_r=" KERNEL_ADDR_R "\0" \
+ "ramdisk_addr_r=" RAMDISK_ADDR_R "\0" \
+ "fdtoverlay_addr_r=" FDTOVERLAY_ADDR_R "\0" \
+ "fdtfile=spacemit/" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0" \
"dtb_addr=" __stringify(DTB_LOAD_ADDR) "\0" \
"scriptaddr=0x2c100000\0" \
"pxefile_addr_r=0x0c200000\0" \
BOOTENV_DEVICE_CONFIG
--
Armbian
2.39.2

View File

@ -1,7 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From 60013790aa6b8ba65fdb7546f715314d00591f81 Mon Sep 17 00:00:00 2001
From: Tejas Bhumkar <tejas.arvind.bhumkar@amd.com>
Date: Fri, 7 Jun 2024 06:32:58 -0400
Subject: efi_loader : Suppress error print message
Subject: [PATCH] efi_loader : Suppress error print message
Currently, on certain Xilinx platforms, an issue has been
identified, manifesting as follows:
@ -38,7 +38,7 @@ Signed-off-by: Tejas Bhumkar <tejas.arvind.bhumkar@amd.com>
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
index 111111111111..222222222222 100644
index e048a545e4..7fea2f79c8 100644
--- a/lib/efi_loader/efi_memory.c
+++ b/lib/efi_loader/efi_memory.c
@@ -660,7 +660,7 @@ efi_status_t efi_free_pool(void *buffer)
@ -51,5 +51,5 @@ index 111111111111..222222222222 100644
}
/* Avoid double free */
--
Armbian
2.39.2