From ef54932bf190acae1ee5600a2c00d3e4c165c2d8 Mon Sep 17 00:00:00 2001 From: luka Date: Thu, 29 Aug 2013 23:06:29 +0000 Subject: [package] uboot-envtools: update to v2013.07 git-svn-id: svn://svn.openwrt.org/openwrt/trunk@37857 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- ...-add-redundant-env-support-for-MTD_ABSENT.patch | 28 +++++ ...v-fix-writing-environment-for-mtd-devices.patch | 114 +++++++++++++++++++++ .../patches/110-add-support-for-MTD_ABSENT.patch | 19 ---- .../115-writing-environment-for-mtd-devices.patch | 106 ------------------- 4 files changed, 142 insertions(+), 125 deletions(-) create mode 100644 package/boot/uboot-envtools/patches/0001-fw_env-add-redundant-env-support-for-MTD_ABSENT.patch create mode 100644 package/boot/uboot-envtools/patches/0002-fw_env-fix-writing-environment-for-mtd-devices.patch delete mode 100644 package/boot/uboot-envtools/patches/110-add-support-for-MTD_ABSENT.patch delete mode 100644 package/boot/uboot-envtools/patches/115-writing-environment-for-mtd-devices.patch (limited to 'package/boot/uboot-envtools/patches') diff --git a/package/boot/uboot-envtools/patches/0001-fw_env-add-redundant-env-support-for-MTD_ABSENT.patch b/package/boot/uboot-envtools/patches/0001-fw_env-add-redundant-env-support-for-MTD_ABSENT.patch new file mode 100644 index 0000000000..d373e13424 --- /dev/null +++ b/package/boot/uboot-envtools/patches/0001-fw_env-add-redundant-env-support-for-MTD_ABSENT.patch @@ -0,0 +1,28 @@ +From: Oliver Metz +Subject: [PATCH v2 1/2] fw_env: add redundant env support for MTD_ABSENT + +Signed-off-by: Oliver Metz +Tested-by: Luka Perkov +--- + +v1 -> v2: + * correct spelling of redundant + +http://lists.denx.de/pipermail/u-boot/2013-August/161694.html +http://patchwork.ozlabs.org/patch/270993/ + + tools/env/fw_env.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/tools/env/fw_env.c ++++ b/tools/env/fw_env.c +@@ -1152,6 +1152,9 @@ int fw_env_open(void) + } else if (DEVTYPE(dev_current) == MTD_UBIVOLUME && + DEVTYPE(!dev_current) == MTD_UBIVOLUME) { + environment.flag_scheme = FLAG_INCREMENTAL; ++ } else if (DEVTYPE(dev_current) == MTD_ABSENT && ++ DEVTYPE(!dev_current) == MTD_ABSENT) { ++ environment.flag_scheme = FLAG_INCREMENTAL; + } else { + fprintf (stderr, "Incompatible flash types!\n"); + return -1; diff --git a/package/boot/uboot-envtools/patches/0002-fw_env-fix-writing-environment-for-mtd-devices.patch b/package/boot/uboot-envtools/patches/0002-fw_env-fix-writing-environment-for-mtd-devices.patch new file mode 100644 index 0000000000..ebfe0e48d8 --- /dev/null +++ b/package/boot/uboot-envtools/patches/0002-fw_env-fix-writing-environment-for-mtd-devices.patch @@ -0,0 +1,114 @@ +From: Oliver Metz +Subject: [PATCH v2 2/2] fw_env: fix writing environment for mtd devices + +Signed-off-by: Oliver Metz +Tested-by: Luka Perkov +--- + +v1 -> v2: + * fix checkpatch.pl warnings + +http://lists.denx.de/pipermail/u-boot/2013-August/161695.html +http://patchwork.ozlabs.org/patch/270994/ + + tools/env/fw_env.c | 70 ++++++++++++++++++++++++++++++++---------------------- + 1 file changed, 42 insertions(+), 28 deletions(-) + +--- a/tools/env/fw_env.c ++++ b/tools/env/fw_env.c +@@ -743,27 +743,39 @@ static int flash_write_buf (int dev, int + MEMGETBADBLOCK needs 64 bits */ + int rc; + +- blocklen = DEVESIZE (dev); ++ /* ++ * For mtd devices only offset and size of the environment do matter ++ */ ++ if (mtd_type == MTD_ABSENT) { ++ blocklen = count; ++ top_of_range = offset + count; ++ erase_len = blocklen; ++ blockstart = offset; ++ block_seek = 0; ++ write_total = blocklen; ++ } else { ++ blocklen = DEVESIZE(dev); + +- top_of_range = ((DEVOFFSET(dev) / blocklen) + +- ENVSECTORS (dev)) * blocklen; ++ top_of_range = ((DEVOFFSET(dev) / blocklen) + ++ ENVSECTORS(dev)) * blocklen; + +- erase_offset = (offset / blocklen) * blocklen; ++ erase_offset = (offset / blocklen) * blocklen; + +- /* Maximum area we may use */ +- erase_len = top_of_range - erase_offset; ++ /* Maximum area we may use */ ++ erase_len = top_of_range - erase_offset; + +- blockstart = erase_offset; +- /* Offset inside a block */ +- block_seek = offset - erase_offset; ++ blockstart = erase_offset; ++ /* Offset inside a block */ ++ block_seek = offset - erase_offset; + +- /* +- * Data size we actually have to write: from the start of the block +- * to the start of the data, then count bytes of data, and to the +- * end of the block +- */ +- write_total = ((block_seek + count + blocklen - 1) / +- blocklen) * blocklen; ++ /* ++ * Data size we actually write: from the start of the block ++ * to the start of the data, then count bytes of data, and ++ * to the end of the block ++ */ ++ write_total = ((block_seek + count + blocklen - 1) / ++ blocklen) * blocklen; ++ } + + /* + * Support data anywhere within erase sectors: read out the complete +@@ -834,17 +846,18 @@ static int flash_write_buf (int dev, int + continue; + } + +- erase.start = blockstart; +- ioctl (fd, MEMUNLOCK, &erase); +- /* These do not need an explicit erase cycle */ +- if (mtd_type != MTD_ABSENT && +- mtd_type != MTD_DATAFLASH) +- if (ioctl (fd, MEMERASE, &erase) != 0) { +- fprintf (stderr, "MTD erase error on %s: %s\n", +- DEVNAME (dev), +- strerror (errno)); +- return -1; +- } ++ if (mtd_type != MTD_ABSENT) { ++ erase.start = blockstart; ++ ioctl(fd, MEMUNLOCK, &erase); ++ /* These do not need an explicit erase cycle */ ++ if (mtd_type != MTD_DATAFLASH) ++ if (ioctl(fd, MEMERASE, &erase) != 0) { ++ fprintf(stderr, ++ "MTD erase error on %s: %s\n", ++ DEVNAME(dev), strerror(errno)); ++ return -1; ++ } ++ } + + if (lseek (fd, blockstart, SEEK_SET) == -1) { + fprintf (stderr, +@@ -863,7 +876,8 @@ static int flash_write_buf (int dev, int + return -1; + } + +- ioctl (fd, MEMLOCK, &erase); ++ if (mtd_type != MTD_ABSENT) ++ ioctl(fd, MEMLOCK, &erase); + + processed += blocklen; + block_seek = 0; diff --git a/package/boot/uboot-envtools/patches/110-add-support-for-MTD_ABSENT.patch b/package/boot/uboot-envtools/patches/110-add-support-for-MTD_ABSENT.patch deleted file mode 100644 index dd98b45d8f..0000000000 --- a/package/boot/uboot-envtools/patches/110-add-support-for-MTD_ABSENT.patch +++ /dev/null @@ -1,19 +0,0 @@ -tools/fw_env: add redundant env support for MTD_ABSENT - -Signed-off-by: Oliver Metz ---- - tools/env/fw_env.c | 3 +++ - 1 file changed, 3 insertions(+) - ---- a/tools/env/fw_env.c -+++ b/tools/env/fw_env.c -@@ -1164,6 +1164,9 @@ int fw_env_open(void) - } else if (DEVTYPE(dev_current) == MTD_UBIVOLUME && - DEVTYPE(!dev_current) == MTD_UBIVOLUME) { - environment.flag_scheme = FLAG_INCREMENTAL; -+ } else if (DEVTYPE(dev_current) == MTD_ABSENT && -+ DEVTYPE(!dev_current) == MTD_ABSENT) { -+ environment.flag_scheme = FLAG_INCREMENTAL; - } else { - fprintf (stderr, "Incompatible flash types!\n"); - return -1; diff --git a/package/boot/uboot-envtools/patches/115-writing-environment-for-mtd-devices.patch b/package/boot/uboot-envtools/patches/115-writing-environment-for-mtd-devices.patch deleted file mode 100644 index 96d0fd9892..0000000000 --- a/package/boot/uboot-envtools/patches/115-writing-environment-for-mtd-devices.patch +++ /dev/null @@ -1,106 +0,0 @@ -tools/fw_env: fix writing environment for mtd devices - -Signed-off-by: Oliver Metz ---- - tools/env/fw_env.c | 71 ++++++++++++++++++++++++++++++++---------------------- - 1 file changed, 42 insertions(+), 29 deletions(-) - ---- a/tools/env/fw_env.c -+++ b/tools/env/fw_env.c -@@ -743,27 +743,39 @@ static int flash_write_buf (int dev, int - MEMGETBADBLOCK needs 64 bits */ - int rc; - -- blocklen = DEVESIZE (dev); -+ /* -+ * For mtd devices only offset and size of the environment do matter -+ */ -+ if (mtd_type == MTD_ABSENT) { -+ blocklen = count; -+ top_of_range = offset + count; -+ erase_len = blocklen; -+ blockstart = offset; -+ block_seek = 0; -+ write_total = blocklen; -+ } else { -+ blocklen = DEVESIZE (dev); - -- top_of_range = ((DEVOFFSET(dev) / blocklen) + -- ENVSECTORS (dev)) * blocklen; -+ top_of_range = ((DEVOFFSET(dev) / blocklen) + -+ ENVSECTORS (dev)) * blocklen; - -- erase_offset = (offset / blocklen) * blocklen; -+ erase_offset = (offset / blocklen) * blocklen; - -- /* Maximum area we may use */ -- erase_len = top_of_range - erase_offset; -+ /* Maximum area we may use */ -+ erase_len = top_of_range - erase_offset; - -- blockstart = erase_offset; -- /* Offset inside a block */ -- block_seek = offset - erase_offset; -+ blockstart = erase_offset; -+ /* Offset inside a block */ -+ block_seek = offset - erase_offset; - -- /* -- * Data size we actually have to write: from the start of the block -- * to the start of the data, then count bytes of data, and to the -- * end of the block -- */ -- write_total = ((block_seek + count + blocklen - 1) / -- blocklen) * blocklen; -+ /* -+ * Data size we actually write: from the start of the block -+ * to the start of the data, then count bytes of data, and to the -+ * end of the block -+ */ -+ write_total = ((block_seek + count + blocklen - 1) / -+ blocklen) * blocklen; -+ } - - /* - * Support data anywhere within erase sectors: read out the complete -@@ -834,17 +846,18 @@ static int flash_write_buf (int dev, int - continue; - } - -- erase.start = blockstart; -- ioctl (fd, MEMUNLOCK, &erase); -- /* These do not need an explicit erase cycle */ -- if (mtd_type != MTD_ABSENT && -- mtd_type != MTD_DATAFLASH) -- if (ioctl (fd, MEMERASE, &erase) != 0) { -- fprintf (stderr, "MTD erase error on %s: %s\n", -- DEVNAME (dev), -- strerror (errno)); -- return -1; -- } -+ if (mtd_type != MTD_ABSENT) { -+ erase.start = blockstart; -+ ioctl (fd, MEMUNLOCK, &erase); -+ /* These do not need an explicit erase cycle */ -+ if (mtd_type != MTD_DATAFLASH) -+ if (ioctl (fd, MEMERASE, &erase) != 0) { -+ fprintf (stderr, "MTD erase error on %s: %s\n", -+ DEVNAME (dev), -+ strerror (errno)); -+ return -1; -+ } -+ } - - if (lseek (fd, blockstart, SEEK_SET) == -1) { - fprintf (stderr, -@@ -862,8 +875,8 @@ static int flash_write_buf (int dev, int - DEVNAME (dev), strerror (errno)); - return -1; - } -- -- ioctl (fd, MEMLOCK, &erase); -+ if (mtd_type != MTD_ABSENT) -+ ioctl (fd, MEMLOCK, &erase); - - processed += blocklen; - block_seek = 0; -- cgit v1.2.3