From: Paweł Owoc Date: Fri, 16 May 2025 13:58:28 +0000 (+0200) Subject: uboot-tools: move ubootenv_add_* functions to common functions X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=68527d87cc91a3ce53d6af62a0ef3c860944c7d6;p=thirdparty%2Fopenwrt.git 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 Link: https://github.com/openwrt/openwrt/pull/18818 Signed-off-by: Hauke Mehrtens --- diff --git a/package/boot/uboot-tools/uboot-envtools/files/qualcommax_ipq60xx b/package/boot/uboot-tools/uboot-envtools/files/qualcommax_ipq60xx index 0bfc7e7cf80..a06ffc1f36c 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 723b0981c44..ae0946190df 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 980c9962b17..23687d9826d 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}" +}