mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-05-08 18:24:39 +02:00
remove two patches use scripts/config for more options use updated patches from Patrick Yavitz <pyavitz@gmail.com>
120 lines
3.9 KiB
Diff
120 lines
3.9 KiB
Diff
From 1caeec5d9b700d2408c44df4e4ce7ac2a90412ab Mon Sep 17 00:00:00 2001
|
|
From: Patrick Yavitz <pyavitz@gmail.com>
|
|
Date: Mon, 4 Nov 2024 09:59:05 -0500
|
|
Subject: [PATCH] MBR support
|
|
|
|
Signed-off-by: Banana Pi -BPI <lionwang@sinovoip.com.cn>
|
|
Signed-off-by: Patrick Yavitz <pyavitz@gmail.com>
|
|
---
|
|
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 f47d9475..460eea4f 100644
|
|
--- a/board/spacemit/k1-x/k1x.c
|
|
+++ b/board/spacemit/k1-x/k1x.c
|
|
@@ -440,6 +440,7 @@ void _load_env_from_blk(struct blk_desc *dev_desc, const char *dev_name, int dev
|
|
char cmd[128];
|
|
struct disk_partition info;
|
|
|
|
+ printf("BPI: :%s\n", "_load_env_from_blk");
|
|
for (part = 1; part <= MAX_SEARCH_PARTITIONS; part++) {
|
|
err = part_get_info(dev_desc, part, &info);
|
|
if (err)
|
|
@@ -449,8 +450,13 @@ void _load_env_from_blk(struct blk_desc *dev_desc, const char *dev_name, int dev
|
|
break;
|
|
}
|
|
}
|
|
- if (part > MAX_SEARCH_PARTITIONS)
|
|
+ if (part > MAX_SEARCH_PARTITIONS) {
|
|
+#ifdef BPI
|
|
return;
|
|
+#else
|
|
+ part = 1;
|
|
+#endif
|
|
+ }
|
|
|
|
env_set("bootfs_part", simple_itoa(part));
|
|
env_set("bootfs_devname", dev_name);
|
|
@@ -460,12 +466,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);
|
|
+ printf("BPI: cmd:%s\n", cmd);
|
|
if (run_command(cmd, 0))
|
|
return;
|
|
|
|
memset(cmd, '\0', 128);
|
|
sprintf(cmd, "env import -t 0x%x", CONFIG_SPL_LOAD_FIT_ADDRESS);
|
|
pr_debug("cmd:%s\n", cmd);
|
|
+ printf("BPI: cmd:%s\n", cmd);
|
|
if (!run_command(cmd, 0)){
|
|
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 acf2b278..581958bb 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,
|
|
|
|
/* read image header to find the image size & load address */
|
|
count = blk_dread(bd, sector, 1, header);
|
|
+ printf("BPI:hdr read sector %lx, count=%lu\n", sector, count);
|
|
debug("hdr read sector %lx, count=%lu\n", sector, count);
|
|
if (count == 0) {
|
|
ret = -EIO;
|
|
@@ -222,11 +223,27 @@ static int mmc_load_image_raw_partition(struct spl_image_info *spl_image,
|
|
}
|
|
}
|
|
#endif
|
|
+ printf("BPI: partition=%d part_name[%s]\n",partition ,part_name);
|
|
|
|
for (int p = 1; p <= MAX_SEARCH_PARTITIONS; p++) {
|
|
err = part_get_info(mmc_get_blk_desc(mmc), p, &info);
|
|
- if (err)
|
|
- continue;
|
|
+ if (err) {
|
|
+#ifdef BPI
|
|
+#else
|
|
+ if (!strcmp(part_name, "opensbi")){
|
|
+ info.start = 0x500;
|
|
+ strcpy(info.name,"opensbi");
|
|
+ }
|
|
+ else
|
|
+ if (!strcmp(part_name, "uboot")){
|
|
+ info.start = 0x800;
|
|
+ strcpy(info.name,"uboot");
|
|
+ }
|
|
+ else
|
|
+#endif
|
|
+ continue;
|
|
+ }
|
|
+ printf("BPI: p=%d info.name=[%s] info.start[%lx]\n",p ,info.name,info.start);
|
|
if (!strcmp(part_name, info.name)){
|
|
if (mmc_load_image_raw_sector(spl_image, bootdev, mmc, info.start) == 0)
|
|
return 0;
|
|
@@ -245,6 +262,7 @@ static int mmc_load_image_raw_partition(struct spl_image_info *spl_image,
|
|
#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR
|
|
return mmc_load_image_raw_sector(spl_image, bootdev, mmc, info.start + sector);
|
|
#else
|
|
+ printf("BPI2: info.name=[%s] info.start[%lx]\n" ,info.name,info.start);
|
|
return mmc_load_image_raw_sector(spl_image, bootdev, mmc, info.start);
|
|
#endif
|
|
}
|
|
diff --git a/configs/k1_defconfig b/configs/k1_defconfig
|
|
index b23d595b..197d54cb 100644
|
|
--- a/configs/k1_defconfig
|
|
+++ b/configs/k1_defconfig
|
|
@@ -23,6 +23,7 @@ CONFIG_ARCH_RV64I=y
|
|
CONFIG_RISCV_SMODE=y
|
|
# CONFIG_SPL_SMP is not set
|
|
CONFIG_LOCALVERSION="spacemit"
|
|
+CONFIG_DISTRO_DEFAULTS=y
|
|
CONFIG_ENV_VARS_UBOOT_CONFIG=y
|
|
CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
|
|
CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x1000000
|
|
--
|
|
2.39.5
|
|
|