]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
uboot-tools: move ubootenv_add_* functions to common functions
authorPaweł Owoc <frut3k7@gmail.com>
Fri, 16 May 2025 13:58:28 +0000 (15:58 +0200)
committerHauke Mehrtens <hauke@hauke-m.de>
Thu, 26 Jun 2025 21:12:20 +0000 (23:12 +0200)
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@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/18818
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
package/boot/uboot-tools/uboot-envtools/files/qualcommax_ipq60xx
package/boot/uboot-tools/uboot-envtools/files/qualcommax_ipq807x
package/boot/uboot-tools/uboot-envtools/files/uboot-envtools.sh

index 0bfc7e7cf804204f67cbe301da1c03cf67ee481b..a06ffc1f36c5054977560d3687d13491ed583698 100644 (file)
@@ -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|\
index 723b0981c44e9748eb3f9746f6ff14eaacaab9c0..ae0946190df62a7ecd2f8e4e40c2cbdb125fa543 100644 (file)
@@ -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|\
index 980c9962b17c5d0a5f26e5ee456f33ebfca9697d..23687d9826d2417483f8058d1bef0c0f06696a7d 100644 (file)
@@ -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}"
+}