[openwrt/openwrt] uboot-tools: move ubootenv_add_* functions to common functions

LEDE Commits lede-commits at lists.infradead.org
Thu Jun 26 14:13:37 PDT 2025


hauke pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/68527d87cc91a3ce53d6af62a0ef3c860944c7d6

commit 68527d87cc91a3ce53d6af62a0ef3c860944c7d6
Author: Paweł Owoc <frut3k7 at gmail.com>
AuthorDate: Fri May 16 15:58:28 2025 +0200

    uboot-tools: move ubootenv_add_* functions to common functions
    
    Functions ubootenv_add_mtd, ubootenv_add_sys_mtd and ubootenv_add_mmc
    can be shared so make them common.
    
    Signed-off-by: Paweł Owoc <frut3k7 at gmail.com>
    Link: https://github.com/openwrt/openwrt/pull/18818
    Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
 .../uboot-envtools/files/qualcommax_ipq60xx            |  6 ------
 .../uboot-envtools/files/qualcommax_ipq807x            | 18 ------------------
 .../uboot-tools/uboot-envtools/files/uboot-envtools.sh | 18 ++++++++++++++++++
 3 files changed, 18 insertions(+), 24 deletions(-)

diff --git a/package/boot/uboot-tools/uboot-envtools/files/qualcommax_ipq60xx b/package/boot/uboot-tools/uboot-envtools/files/qualcommax_ipq60xx
index 0bfc7e7cf8..a06ffc1f36 100644
--- a/package/boot/uboot-tools/uboot-envtools/files/qualcommax_ipq60xx
+++ b/package/boot/uboot-tools/uboot-envtools/files/qualcommax_ipq60xx
@@ -7,12 +7,6 @@ touch /etc/config/ubootenv
 
 board=$(board_name)
 
-ubootenv_add_mtd() {
-	local idx="$(find_mtd_index "${1}")"
-	[ -n "$idx" ] && \
-		ubootenv_add_uci_config "/dev/mtd$idx" "${2}" "${3}" "${4}"
-}
-
 case "$board" in
 8devices,mango-dvk|\
 8devices,mango-dvk-sfp|\
diff --git a/package/boot/uboot-tools/uboot-envtools/files/qualcommax_ipq807x b/package/boot/uboot-tools/uboot-envtools/files/qualcommax_ipq807x
index 723b0981c4..ae0946190d 100644
--- a/package/boot/uboot-tools/uboot-envtools/files/qualcommax_ipq807x
+++ b/package/boot/uboot-tools/uboot-envtools/files/qualcommax_ipq807x
@@ -7,24 +7,6 @@ touch /etc/config/ubootenv
 
 board=$(board_name)
 
-ubootenv_add_mtd() {
-	local idx="$(find_mtd_index "${1}")"
-	[ -n "$idx" ] && \
-		ubootenv_add_uci_config "/dev/mtd$idx" "${2}" "${3}" "${4}"
-}
-
-ubootenv_add_sys_mtd() {
-	local idx="$(find_mtd_index "${1}")"
-	[ -n "$idx" ] && \
-		ubootenv_add_uci_sys_config "/dev/mtd$idx" "${2}" "${3}" "${4}"
-}
-
-ubootenv_add_mmc() {
-	local mmcpart="$(find_mmc_part "${1}")"
-	[ -n "$mmcpart" ] && \
-		ubootenv_add_uci_config "$mmcpart" "${2}" "${3}" "${4}" "${5}"
-}
-
 case "$board" in
 aliyun,ap8220|\
 compex,wpq873|\
diff --git a/package/boot/uboot-tools/uboot-envtools/files/uboot-envtools.sh b/package/boot/uboot-tools/uboot-envtools/files/uboot-envtools.sh
index 980c9962b1..23687d9826 100644
--- a/package/boot/uboot-tools/uboot-envtools/files/uboot-envtools.sh
+++ b/package/boot/uboot-tools/uboot-envtools/files/uboot-envtools.sh
@@ -44,3 +44,21 @@ ubootenv_add_app_config() {
 	config_get numsec "$1" numsec
 	grep -q "^[[:space:]]*${dev}[[:space:]]*${offset}" "/etc/fw_${cfgtype#uboot}.config" || echo "$dev $offset $envsize $secsize $numsec" >>"/etc/fw_${cfgtype#uboot}.config"
 }
+
+ubootenv_add_mtd() {
+	local idx="$(find_mtd_index "${1}")"
+	[ -n "$idx" ] && \
+		ubootenv_add_uci_config "/dev/mtd$idx" "${2}" "${3}" "${4}"
+}
+
+ubootenv_add_sys_mtd() {
+	local idx="$(find_mtd_index "${1}")"
+	[ -n "$idx" ] && \
+		ubootenv_add_uci_sys_config "/dev/mtd$idx" "${2}" "${3}" "${4}"
+}
+
+ubootenv_add_mmc() {
+	local mmcpart="$(find_mmc_part "${1}")"
+	[ -n "$mmcpart" ] && \
+		ubootenv_add_uci_config "$mmcpart" "${2}" "${3}" "${4}" "${5}"
+}




More information about the lede-commits mailing list