- Backport upstream Winbond W25N04KV Flash support. - Backport upstream GigaDevice series Flash support. - Backport pending Airoha AN8855 switch TPID value fix. - Backport Mediatek UART baudrate accuracy compensation support. - Pull mtk patchset from MTK SDK mtksoc-20250711 branch: Remove mt7622_rfb changes. The MTK SDK already dropped them. Replace Airoha ethernet PHY driver with new version. Split downstream snfi changes into independent patches. Add new Marvell CUX3410 PHY driver. Add new MediaTek built-in 2.5Gbps PHY driver. Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
72 lines
2 KiB
Diff
72 lines
2 KiB
Diff
From e1ea321b028c2af81770c55aa5f1f319228e9a39 Mon Sep 17 00:00:00 2001
|
|
From: Weijie Gao <weijie.gao@mediatek.com>
|
|
Date: Mon, 25 Jul 2022 17:01:20 +0800
|
|
Subject: [PATCH 25/30] env: ubi: add support to create environment volume if
|
|
it does not exist
|
|
|
|
Add an option to allow environment volume being auto created if not exist.
|
|
|
|
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
|
---
|
|
env/Kconfig | 6 ++++++
|
|
env/ubi.c | 20 ++++++++++++++++++++
|
|
2 files changed, 26 insertions(+)
|
|
|
|
--- a/env/Kconfig
|
|
+++ b/env/Kconfig
|
|
@@ -687,6 +687,12 @@ config ENV_UBI_VOLUME_REDUND
|
|
help
|
|
Name of the redundant volume that you want to store the environment in.
|
|
|
|
+config ENV_UBI_VOLUME_CREATE
|
|
+ bool "Create UBI volume if not exist"
|
|
+ depends on ENV_IS_IN_UBI
|
|
+ help
|
|
+ Create the UBI volume if it does not exist.
|
|
+
|
|
config ENV_UBI_VID_OFFSET
|
|
int "ubi environment VID offset"
|
|
depends on ENV_IS_IN_UBI
|
|
--- a/env/ubi.c
|
|
+++ b/env/ubi.c
|
|
@@ -105,6 +105,18 @@ static int env_ubi_save(void)
|
|
#endif /* CONFIG_SYS_REDUNDAND_ENVIRONMENT */
|
|
#endif /* CONFIG_CMD_SAVEENV */
|
|
|
|
+int __weak env_ubi_volume_create(const char *volume)
|
|
+{
|
|
+ struct ubi_volume *vol;
|
|
+
|
|
+ vol = ubi_find_volume((char *)volume);
|
|
+ if (vol)
|
|
+ return 0;
|
|
+
|
|
+ return ubi_create_vol((char *)volume, CONFIG_ENV_SIZE, true,
|
|
+ UBI_VOL_NUM_AUTO, false);
|
|
+}
|
|
+
|
|
#ifdef CONFIG_SYS_REDUNDAND_ENVIRONMENT
|
|
static int env_ubi_load(void)
|
|
{
|
|
@@ -134,6 +146,11 @@ static int env_ubi_load(void)
|
|
return -EIO;
|
|
}
|
|
|
|
+ if (IS_ENABLED(CONFIG_ENV_UBI_VOLUME_CREATE)) {
|
|
+ env_ubi_volume_create(CONFIG_ENV_UBI_VOLUME);
|
|
+ env_ubi_volume_create(CONFIG_ENV_UBI_VOLUME_REDUND);
|
|
+ }
|
|
+
|
|
read1_fail = ubi_volume_read(CONFIG_ENV_UBI_VOLUME, (void *)tmp_env1, 0,
|
|
CONFIG_ENV_SIZE);
|
|
if (read1_fail)
|
|
@@ -171,6 +188,9 @@ static int env_ubi_load(void)
|
|
return -EIO;
|
|
}
|
|
|
|
+ if (IS_ENABLED(CONFIG_ENV_UBI_VOLUME_CREATE))
|
|
+ env_ubi_volume_create(CONFIG_ENV_UBI_VOLUME);
|
|
+
|
|
if (ubi_volume_read(CONFIG_ENV_UBI_VOLUME, buf, 0, CONFIG_ENV_SIZE)) {
|
|
printf("\n** Unable to read env from %s:%s **\n",
|
|
CONFIG_ENV_UBI_PART, CONFIG_ENV_UBI_VOLUME);
|