[openwrt/openwrt] uboot-envtools: update to U-Boot release v2024.07

LEDE Commits lede-commits at lists.infradead.org
Thu Jul 4 12:16:35 PDT 2024


nick pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/cdfd0b74a2421e0ae0389a86ec33fc6ebd03f329

commit cdfd0b74a2421e0ae0389a86ec33fc6ebd03f329
Author: Shiji Yang <yangshiji66 at qq.com>
AuthorDate: Thu Jul 4 18:39:35 2024 +0800

    uboot-envtools: update to U-Boot release v2024.07
    
    Remove upstreamed patches:
    010-fw_env-fix-reading-NVMEM-device-s-compatible-value.patch
    [commit f29c5ca33df4c77b9af2cbfb7ed90bf336613522]
    
    011-fw_env-keep-calling-read-until-whole-flash-block-is-.patch
    [commit 9e3003f79d168eac7ee65cd457e3904e2fb4eea8]
    
    012-fw_env-autodetect-NAND-erase-size-and-env-sectors.patch
    [commit d73a6641868029b5cae53ed00c5766921c9d8b1f]
    
    Signed-off-by: Shiji Yang <yangshiji66 at qq.com>
---
 package/boot/uboot-envtools/Makefile               |  6 +-
 ...x-reading-NVMEM-device-s-compatible-value.patch | 70 --------------------
 ...-calling-read-until-whole-flash-block-is-.patch | 75 ----------------------
 ...utodetect-NAND-erase-size-and-env-sectors.patch | 49 --------------
 4 files changed, 3 insertions(+), 197 deletions(-)

diff --git a/package/boot/uboot-envtools/Makefile b/package/boot/uboot-envtools/Makefile
index d4446167b7..19c3073c74 100644
--- a/package/boot/uboot-envtools/Makefile
+++ b/package/boot/uboot-envtools/Makefile
@@ -9,15 +9,15 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=uboot-envtools
 PKG_DISTNAME:=u-boot
-PKG_VERSION:=2024.01
-PKG_RELEASE:=3
+PKG_VERSION:=2024.07
+PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_DISTNAME)-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:= \
     https://ftp.denx.de/pub/u-boot \
     https://mirror.cyberbits.eu/u-boot \
     ftp://ftp.denx.de/pub/u-boot
-PKG_HASH:=b99611f1ed237bf3541bdc8434b68c96a6e05967061f992443cb30aabebef5b3
+PKG_HASH:=f591da9ab90ef3d6b3d173766d0ddff90c4ed7330680897486117df390d83c8f
 PKG_SOURCE_SUBDIR:=$(PKG_DISTNAME)-$(PKG_VERSION)
 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_DISTNAME)-$(PKG_VERSION)
 
diff --git a/package/boot/uboot-envtools/patches/010-fw_env-fix-reading-NVMEM-device-s-compatible-value.patch b/package/boot/uboot-envtools/patches/010-fw_env-fix-reading-NVMEM-device-s-compatible-value.patch
deleted file mode 100644
index 5af8a1aa0e..0000000000
--- a/package/boot/uboot-envtools/patches/010-fw_env-fix-reading-NVMEM-device-s-compatible-value.patch
+++ /dev/null
@@ -1,70 +0,0 @@
-From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal at milecki.pl>
-Date: Tue, 12 Dec 2023 18:23:45 +0100
-Subject: [PATCH] fw_env: fix reading NVMEM device's "compatible" value
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Call to fread() was changed to check for return value. The problem is it
-can't be checked for returning 1 (as it is) to determine success.
-
-We call fread() with buffer size as "size" argument. Reading any
-"compatible" value shorter than buffer size will result in returning 0
-even on success.
-
-Modify code to use fstat() to determine expected read length.
-
-This fixes regression that broke using fw_env with NVMEM devices.
-
-Fixes: c059a22b7776 ("tools: env: fw_env: Fix unused-result warning")
-Cc: Jaehoon Chung <jh80.chung at samsung.com>
-Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
----
- tools/env/fw_env.c | 18 ++++++++++++++----
- 1 file changed, 14 insertions(+), 4 deletions(-)
-
---- a/tools/env/fw_env.c
-+++ b/tools/env/fw_env.c
-@@ -1732,6 +1732,7 @@ static int find_nvmem_device(void)
- 	}
- 
- 	while (!nvmem && (dent = readdir(dir))) {
-+		struct stat s;
- 		FILE *fp;
- 		size_t size;
- 
-@@ -1749,14 +1750,22 @@ static int find_nvmem_device(void)
- 			continue;
- 		}
- 
--		size = fread(buf, sizeof(buf), 1, fp);
-+		if (fstat(fileno(fp), &s)) {
-+			fprintf(stderr, "Failed to fstat %s\n", comp);
-+			goto next;
-+		}
-+
-+		if (s.st_size >= sizeof(buf)) {
-+			goto next;
-+		}
-+
-+		size = fread(buf, s.st_size, 1, fp);
- 		if (size != 1) {
- 			fprintf(stderr,
- 				"read failed about %s\n", comp);
--			fclose(fp);
--			return -EIO;
-+			goto next;
- 		}
--
-+		buf[s.st_size] = '\0';
- 
- 		if (!strcmp(buf, "u-boot,env")) {
- 			bytes = asprintf(&nvmem, "%s/%s/nvmem", path, dent->d_name);
-@@ -1765,6 +1774,7 @@ static int find_nvmem_device(void)
- 			}
- 		}
- 
-+next:
- 		fclose(fp);
- 	}
- 
diff --git a/package/boot/uboot-envtools/patches/011-fw_env-keep-calling-read-until-whole-flash-block-is-.patch b/package/boot/uboot-envtools/patches/011-fw_env-keep-calling-read-until-whole-flash-block-is-.patch
deleted file mode 100644
index af1c32fe91..0000000000
--- a/package/boot/uboot-envtools/patches/011-fw_env-keep-calling-read-until-whole-flash-block-is-.patch
+++ /dev/null
@@ -1,75 +0,0 @@
-From 9e3003f79d168eac7ee65cd457e3904e2fb4eea8 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal at milecki.pl>
-Date: Wed, 13 Dec 2023 13:13:54 +0100
-Subject: [PATCH] fw_env: keep calling read() until whole flash block is read
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-It's totally valid for read() to provide less bytes than requested
-maximum. It may happen if there is no more data available yet or source
-pushes data in small chunks.
-
-This actually happens when trying to read env data from NVMEM device.
-Kernel may provide NVMEM content in page size parts (like 4096 B).
-
-This fixes warnings like:
-Warning on /sys/bus/nvmem/devices/u-boot-env0/nvmem: Attempted to read 16384 bytes but got 4096
-Warning on /sys/bus/nvmem/devices/u-boot-env0/nvmem: Attempted to read 12288 bytes but got 4096
-Warning on /sys/bus/nvmem/devices/u-boot-env0/nvmem: Attempted to read 8192 bytes but got 4096
-
-Since the main loop in flash_read_buf() is used to read blocks this
-patch adds a new nested one.
-
-Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
----
- tools/env/fw_env.c | 34 +++++++++++++++-------------------
- 1 file changed, 15 insertions(+), 19 deletions(-)
-
---- a/tools/env/fw_env.c
-+++ b/tools/env/fw_env.c
-@@ -948,29 +948,25 @@ static int flash_read_buf(int dev, int f
- 		 */
- 		lseek(fd, blockstart + block_seek, SEEK_SET);
- 
--		rc = read(fd, buf + processed, readlen);
--		if (rc == -1) {
--			fprintf(stderr, "Read error on %s: %s\n",
--				DEVNAME(dev), strerror(errno));
--			return -1;
--		}
-+		while (readlen) {
-+			rc = read(fd, buf + processed, readlen);
-+			if (rc == -1) {
-+				fprintf(stderr, "Read error on %s: %s\n",
-+					DEVNAME(dev), strerror(errno));
-+				return -1;
-+			}
- #ifdef DEBUG
--		fprintf(stderr, "Read 0x%x bytes at 0x%llx on %s\n",
--			rc, (unsigned long long)blockstart + block_seek,
--			DEVNAME(dev));
-+			fprintf(stderr, "Read 0x%x bytes at 0x%llx on %s\n",
-+				rc, (unsigned long long)blockstart + block_seek,
-+				DEVNAME(dev));
- #endif
--		processed += rc;
--		if (rc != readlen) {
--			fprintf(stderr,
--				"Warning on %s: Attempted to read %zd bytes but got %d\n",
--				DEVNAME(dev), readlen, rc);
-+			processed += rc;
- 			readlen -= rc;
--			block_seek += rc;
--		} else {
--			blockstart += blocklen;
--			readlen = min(blocklen, count - processed);
--			block_seek = 0;
- 		}
-+
-+		blockstart += blocklen;
-+		readlen = min(blocklen, count - processed);
-+		block_seek = 0;
- 	}
- 
- 	return processed;
diff --git a/package/boot/uboot-envtools/patches/012-fw_env-autodetect-NAND-erase-size-and-env-sectors.patch b/package/boot/uboot-envtools/patches/012-fw_env-autodetect-NAND-erase-size-and-env-sectors.patch
deleted file mode 100644
index 78f555fb1f..0000000000
--- a/package/boot/uboot-envtools/patches/012-fw_env-autodetect-NAND-erase-size-and-env-sectors.patch
+++ /dev/null
@@ -1,49 +0,0 @@
-From d73a6641868029b5cae53ed00c5766921c9d8b1f Mon Sep 17 00:00:00 2001
-From: Anthony Loiseau <anthony.loiseau at allcircuits.com>
-Date: Thu, 21 Dec 2023 23:44:38 +0100
-Subject: [PATCH] fw_env: autodetect NAND erase size and env sectors
-
-As already done for NOR chips, if device ESIZE and ENVSECTORS static
-configurations are both zero, then autodetect them at runtime.
-
-Cc: Joe Hershberger <joe.hershberger at ni.com>
-cc: Stefan Agner <stefan at agner.ch>
-cc: Rasmus Villemoes <rasmus.villemoes at prevas.dk>
-Signed-off-by: Anthony Loiseau <anthony.loiseau at allcircuits.com>
----
- tools/env/README   |  3 +++
- tools/env/fw_env.c | 11 +++++++++--
- 2 files changed, 12 insertions(+), 2 deletions(-)
-
---- a/tools/env/README
-+++ b/tools/env/README
-@@ -58,6 +58,9 @@ DEVICEx_ENVSECTORS defines the number of
- this environment instance. On NAND this is used to limit the range
- within which bad blocks are skipped, on NOR it is not used.
- 
-+If DEVICEx_ESIZE and DEVICEx_ENVSECTORS are both zero, then a runtime
-+detection is attempted for NOR and NAND mtd types.
-+
- To prevent losing changes to the environment and to prevent confusing the MTD
- drivers, a lock file at /run/fw_printenv.lock is used to serialize access
- to the environment.
---- a/tools/env/fw_env.c
-+++ b/tools/env/fw_env.c
-@@ -1655,8 +1655,15 @@ static int check_device_config(int dev)
- 		}
- 		DEVTYPE(dev) = mtdinfo.type;
- 		if (DEVESIZE(dev) == 0 && ENVSECTORS(dev) == 0 &&
--		    mtdinfo.type == MTD_NORFLASH)
--			DEVESIZE(dev) = mtdinfo.erasesize;
-+		    mtdinfo.erasesize > 0) {
-+			if (mtdinfo.type == MTD_NORFLASH)
-+				DEVESIZE(dev) = mtdinfo.erasesize;
-+			else if (mtdinfo.type == MTD_NANDFLASH) {
-+				DEVESIZE(dev) = mtdinfo.erasesize;
-+				ENVSECTORS(dev) =
-+				    mtdinfo.size / mtdinfo.erasesize;
-+			}
-+		}
- 		if (DEVESIZE(dev) == 0)
- 			/* Assume the erase size is the same as the env-size */
- 			DEVESIZE(dev) = ENVSIZE(dev);




More information about the lede-commits mailing list