From d352ff6cac7230b9279e011fe00e2ff482733576 Mon Sep 17 00:00:00 2001 From: Luka Perkov Date: Tue, 2 Jul 2013 23:08:17 +0000 Subject: [PATCH] uboot-envtools: upgrade to 2013.07-rc1 Support for writing on MMC devices has been added. Signed-off-by: Luka Perkov SVN-Revision: 37135 --- package/boot/uboot-envtools/Makefile | 32 +++--- .../110-add-support-for-MTD_ABSENT.patch | 19 ++++ ...-writing-environment-for-mtd-devices.patch | 106 ++++++++++++++++++ 3 files changed, 141 insertions(+), 16 deletions(-) create mode 100644 package/boot/uboot-envtools/patches/110-add-support-for-MTD_ABSENT.patch create mode 100644 package/boot/uboot-envtools/patches/115-writing-environment-for-mtd-devices.patch diff --git a/package/boot/uboot-envtools/Makefile b/package/boot/uboot-envtools/Makefile index 2d0f6b7986..f83b062a3b 100644 --- a/package/boot/uboot-envtools/Makefile +++ b/package/boot/uboot-envtools/Makefile @@ -9,12 +9,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=uboot-envtools PKG_DISTNAME:=u-boot -PKG_VERSION:=2013.04 +PKG_VERSION:=2013.07-rc1 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_DISTNAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=ftp://ftp.denx.de/pub/u-boot -PKG_MD5SUM:=21bf962d69938ed4ed783b792b2b074e +PKG_MD5SUM:=9b14d9a8981ce2e429956af7cc96996e PKG_BUILD_DIR:=$(BUILD_DIR)/u-boot-$(PKG_VERSION) @@ -55,23 +55,23 @@ define Package/uboot-envtools/install $(INSTALL_DATA) ./files/uboot-envtools.sh $(1)/lib ifneq ($(CONFIG_TARGET_ar71xx),) $(INSTALL_DIR) $(1)/etc/uci-defaults - $(INSTALL_BIN) ./files/ar71xx $(1)/etc/uci-defaults/uboot-envtools -endif -ifneq ($(CONFIG_TARGET_kirkwood),) - $(INSTALL_DIR) $(1)/etc/uci-defaults - $(INSTALL_BIN) ./files/kirkwood $(1)/etc/uci-defaults/uboot-envtools -endif -ifneq ($(CONFIG_TARGET_lantiq),) - $(INSTALL_DIR) $(1)/etc/uci-defaults - $(INSTALL_BIN) ./files/lantiq $(1)/etc/uci-defaults/uboot-envtools -endif -ifneq ($(CONFIG_TARGET_ramips),) - $(INSTALL_DIR) $(1)/etc/uci-defaults - $(INSTALL_BIN) ./files/ramips $(1)/etc/uci-defaults/uboot-envtools + $(INSTALL_BIN) ./files/ar71xx $(1)/etc/uci-defaults/30_uboot-envtools endif ifneq ($(CONFIG_TARGET_cns3xxx),) $(INSTALL_DIR) $(1)/etc/uci-defaults - $(INSTALL_BIN) ./files/cns3xxx $(1)/etc/uci-defaults/uboot-envtools + $(INSTALL_BIN) ./files/cns3xxx $(1)/etc/uci-defaults/30_uboot-envtools +endif +ifneq ($(CONFIG_TARGET_kirkwood),) + $(INSTALL_DIR) $(1)/etc/uci-defaults + $(INSTALL_BIN) ./files/kirkwood $(1)/etc/uci-defaults/30_uboot-envtools +endif +ifneq ($(CONFIG_TARGET_lantiq),) + $(INSTALL_DIR) $(1)/etc/uci-defaults + $(INSTALL_BIN) ./files/lantiq $(1)/etc/uci-defaults/30_uboot-envtools +endif +ifneq ($(CONFIG_TARGET_ramips),) + $(INSTALL_DIR) $(1)/etc/uci-defaults + $(INSTALL_BIN) ./files/ramips $(1)/etc/uci-defaults/30_uboot-envtools endif endef 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 new file mode 100644 index 0000000000..dd98b45d8f --- /dev/null +++ b/package/boot/uboot-envtools/patches/110-add-support-for-MTD_ABSENT.patch @@ -0,0 +1,19 @@ +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 new file mode 100644 index 0000000000..96d0fd9892 --- /dev/null +++ b/package/boot/uboot-envtools/patches/115-writing-environment-for-mtd-devices.patch @@ -0,0 +1,106 @@ +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;