diff options
6 files changed, 7 insertions, 234 deletions
diff --git a/package/boot/uboot-envtools/Config.in b/package/boot/uboot-envtools/Config.in deleted file mode 100644 index 8f0078f053..0000000000 --- a/package/boot/uboot-envtools/Config.in +++ /dev/null @@ -1,9 +0,0 @@ -config UBOOT_ENVTOOLS_UBI - bool "Support environment in UBI volume" - depends on PACKAGE_uboot-envtools - default TARGET_oxnas - help - Add support for reading and writing U-Boot environment - stored in UBI volume(s). - - Increases binary size by about 8 kB diff --git a/package/boot/uboot-envtools/Makefile b/package/boot/uboot-envtools/Makefile index 442cf3fd83..c8eafbe664 100644 --- a/package/boot/uboot-envtools/Makefile +++ b/package/boot/uboot-envtools/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=uboot-envtools PKG_DISTNAME:=u-boot -PKG_VERSION:=2015.10 +PKG_VERSION:=2018.03 PKG_RELEASE:=1 PKG_BUILD_DIR:=$(BUILD_DIR)/u-boot-$(PKG_VERSION) @@ -17,7 +17,7 @@ PKG_SOURCE:=$(PKG_DISTNAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=\ http://mirror2.openwrt.org/sources \ ftp://ftp.denx.de/pub/u-boot -PKG_HASH:=bdc68d5f9455ad933b059c735d983f2c8b6b552dafb062e5ff1444f623021955 +PKG_HASH:=7e7477534409d5368eb1371ffde6820f0f79780a1a1f676161c48442cb303dfd PKG_BUILD_DEPENDS:=fstools @@ -42,13 +42,10 @@ define Package/uboot-envtools/description This package includes tools to read and modify U-Boot bootloader environment. endef -define Package/uboot-envtools/config - source "$(SOURCE)/Config.in" -endef - define Build/Configure - touch $(PKG_BUILD_DIR)/include/config.mk touch $(PKG_BUILD_DIR)/include/config.h + mkdir -p $(PKG_BUILD_DIR)/include/config + touch $(PKG_BUILD_DIR)/include/config/auto.conf mkdir -p $(PKG_BUILD_DIR)/include/generated touch $(PKG_BUILD_DIR)/include/generated/autoconf.h endef @@ -59,10 +56,9 @@ define Build/Compile $(MAKE) -C $(PKG_BUILD_DIR) \ CROSS_COMPILE="$(TARGET_CROSS)" \ TARGET_CFLAGS="$(TARGET_CFLAGS)" \ - UBI="$(CONFIG_UBOOT_ENVTOOLS_UBI)" \ - dot-config=0 \ HOSTLDFLAGS= \ - env + no-dot-config-targets=envtools \ + envtools endef define Package/uboot-envtools/conffiles diff --git a/package/boot/uboot-envtools/patches/001-compile.patch b/package/boot/uboot-envtools/patches/001-compile.patch index 1705979765..f7ec9130d6 100644 --- a/package/boot/uboot-envtools/patches/001-compile.patch +++ b/package/boot/uboot-envtools/patches/001-compile.patch @@ -2,7 +2,7 @@ +++ b/tools/env/Makefile @@ -10,6 +10,10 @@ # with "CC" here for the maximum code reuse of scripts/Makefile.host. - HOSTCC = $(CC) + override HOSTCC = $(CC) +ifneq ($(TARGET_CFLAGS),) +HOSTCFLAGS = $(TARGET_CFLAGS) diff --git a/package/boot/uboot-envtools/patches/200-fw_env_no_aes.patch b/package/boot/uboot-envtools/patches/200-fw_env_no_aes.patch deleted file mode 100644 index 9c8681ff48..0000000000 --- a/package/boot/uboot-envtools/patches/200-fw_env_no_aes.patch +++ /dev/null @@ -1,38 +0,0 @@ ---- a/tools/env/fw_env.c -+++ b/tools/env/fw_env.c -@@ -246,7 +246,7 @@ int fw_printenv (int argc, char *argv[]) - int i, n_flag; - int rc = 0; - -- if (argc >= 2 && strcmp(argv[1], "-a") == 0) { -+ if (0 && argc >= 2 && strcmp(argv[1], "-a") == 0) { - if (argc < 3) { - fprintf(stderr, - "## Error: '-a' option requires AES key\n"); -@@ -325,7 +325,7 @@ int fw_printenv (int argc, char *argv[]) - int fw_env_close(void) - { - int ret; -- if (aes_flag) { -+ if (0 && aes_flag) { - ret = env_aes_cbc_crypt(environment.data, 1); - if (ret) { - fprintf(stderr, -@@ -1223,7 +1223,7 @@ int fw_env_open(void) - - crc0 = crc32 (0, (uint8_t *) environment.data, ENV_SIZE); - -- if (aes_flag) { -+ if (0 && aes_flag) { - ret = env_aes_cbc_crypt(environment.data, 0); - if (ret) - return ret; -@@ -1280,7 +1280,7 @@ int fw_env_open(void) - - crc1 = crc32 (0, (uint8_t *) redundant->data, ENV_SIZE); - -- if (aes_flag) { -+ if (0 && aes_flag) { - ret = env_aes_cbc_crypt(redundant->data, 0); - if (ret) - return ret; diff --git a/package/boot/uboot-envtools/patches/300-support-env-in-ubivol-chardev.patch b/package/boot/uboot-envtools/patches/300-support-env-in-ubivol-chardev.patch deleted file mode 100644 index 75d3804ed4..0000000000 --- a/package/boot/uboot-envtools/patches/300-support-env-in-ubivol-chardev.patch +++ /dev/null @@ -1,163 +0,0 @@ -From 6e2630a0fc872d0db34157972f6dc3941f6d66dd Mon Sep 17 00:00:00 2001 -From: Daniel Golle <daniel@makrotopia.org> -Date: Mon, 19 May 2014 21:38:01 +0200 -Subject: [PATCH] tools/env: add support for env in ubi volume chardev - -Signed-off-by: Daniel Golle <daniel@makrotopia.org> ---- - tools/env/Makefile | 5 ++++ - tools/env/fw_env.c | 76 +++++++++++++++++++++++++++++++++++++++++++++++------- - 2 files changed, 71 insertions(+), 10 deletions(-) - ---- a/tools/env/Makefile -+++ b/tools/env/Makefile -@@ -24,6 +24,13 @@ ifeq ($(MTD_VERSION),old) - HOST_EXTRACFLAGS += -DMTD_OLD - endif - -+ifeq ($(UBI),y) -+HOST_EXTRACFLAGS += -DUBI -+HOST_LOADLIBES = "-Wl,--gc-sections,-lubi-utils" -+else -+HOST_LOADLIBES = "-Wl,--gc-sections" -+endif -+ - always := fw_printenv - hostprogs-y := fw_printenv - ---- a/tools/env/fw_env.c -+++ b/tools/env/fw_env.c -@@ -31,6 +31,9 @@ - # include <mtd/mtd-user.h> - #endif - -+#ifdef UBI -+# include <libubi.h> -+#endif - #include "fw_env.h" - - #include <aes.h> -@@ -811,6 +814,11 @@ static int flash_write_buf (int dev, int - off_t top_of_range; /* end of the last block we may use */ - loff_t blockstart; /* running start of the current block - - MEMGETBADBLOCK needs 64 bits */ -+#ifdef UBI -+ libubi_t *libubi = NULL;/* pointer to libubi struct */ -+#else -+ void *libubi = NULL; -+#endif - int rc; - - /* -@@ -916,7 +924,30 @@ static int flash_write_buf (int dev, int - continue; - } - -- if (mtd_type != MTD_ABSENT) { -+#ifdef UBI -+ if (mtd_type == MTD_UBIVOLUME) { -+ struct ubi_vol_info volinfo; -+ libubi = libubi_open(); -+ if (libubi) -+ rc = ubi_get_vol_info(libubi, -+ DEVNAME(dev_current), &volinfo); -+ if (libubi && !rc) { -+ erasesize = volinfo.leb_size; -+ int leb = blockstart / erasesize; -+ if (volinfo.type != UBI_STATIC_VOLUME) -+ rc = ubi_leb_change_start(libubi, fd, -+ leb, erasesize); -+ else -+ rc = ubi_update_start(libubi, fd, -+ erasesize); -+ } -+ if (libubi && rc) { -+ libubi_close(libubi); -+ libubi = NULL; -+ } -+ } -+#endif -+ if (!libubi && mtd_type != MTD_ABSENT) { - erase.start = blockstart; - ioctl(fd, MEMUNLOCK, &erase); - /* These do not need an explicit erase cycle */ -@@ -933,7 +964,8 @@ static int flash_write_buf (int dev, int - fprintf (stderr, - "Seek error on %s: %s\n", - DEVNAME (dev), strerror (errno)); -- return -1; -+ processed = -1; -+ goto out; - } - - #ifdef DEBUG -@@ -943,10 +975,11 @@ static int flash_write_buf (int dev, int - if (write (fd, data + processed, erasesize) != erasesize) { - fprintf (stderr, "Write error on %s: %s\n", - DEVNAME (dev), strerror (errno)); -- return -1; -+ processed = -1; -+ goto out; - } - -- if (mtd_type != MTD_ABSENT) -+ if (!libubi && mtd_type != MTD_ABSENT) - ioctl(fd, MEMLOCK, &erase); - - processed += erasesize; -@@ -957,6 +990,11 @@ static int flash_write_buf (int dev, int - if (write_total > count) - free (data); - -+out: -+#ifdef UBI -+ if (libubi) -+ libubi_close(libubi); -+#endif - return processed; - } - -@@ -1068,12 +1106,8 @@ static int flash_read (int fd) - - if (S_ISCHR(st.st_mode)) { - rc = ioctl(fd, MEMGETINFO, &mtdinfo); -- if (rc < 0) { -- fprintf(stderr, "Cannot get MTD information for %s\n", -- DEVNAME(dev_current)); -- return -1; -- } -- if (mtdinfo.type != MTD_NORFLASH && -+ if (!rc && -+ mtdinfo.type != MTD_NORFLASH && - mtdinfo.type != MTD_NANDFLASH && - mtdinfo.type != MTD_DATAFLASH && - mtdinfo.type != MTD_UBIVOLUME) { -@@ -1081,6 +1115,28 @@ static int flash_read (int fd) - mtdinfo.type, DEVNAME(dev_current)); - return -1; - } -+#ifdef UBI -+ if (rc) { -+ libubi_t *libubi; -+ struct ubi_vol_info volinfo; -+ libubi = libubi_open(); -+ if (!libubi) -+ return -ENOMEM; -+ -+ rc = ubi_get_vol_info(libubi, DEVNAME(dev_current), -+ &volinfo); -+ if (rc) { -+ libubi_close(libubi); -+ return -ENODEV; -+ } -+ memset(&mtdinfo, 0, sizeof(mtdinfo)); -+ mtdinfo.type = MTD_UBIVOLUME; -+ mtdinfo.size = volinfo.data_bytes; -+ mtdinfo.erasesize = volinfo.leb_size; -+ mtdinfo.writesize = volinfo.leb_size; -+ libubi_close(libubi); -+ } -+#endif - } else { - memset(&mtdinfo, 0, sizeof(mtdinfo)); - mtdinfo.type = MTD_ABSENT; diff --git a/package/boot/uboot-envtools/patches/400-u-boot-2015.10-stdint.patch b/package/boot/uboot-envtools/patches/400-u-boot-2015.10-stdint.patch deleted file mode 100644 index 395674fd8b..0000000000 --- a/package/boot/uboot-envtools/patches/400-u-boot-2015.10-stdint.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff -Naur u-boot-2015.10.orig/tools/env/fw_env.c u-boot-2015.10/tools/env/fw_env.c ---- u-boot-2015.10.orig/tools/env/fw_env.c 2016-06-24 12:42:31.152391850 +0200 -+++ u-boot-2015.10/tools/env/fw_env.c 2016-06-24 12:42:59.080391754 +0200 -@@ -21,7 +21,8 @@ - #include <sys/types.h> - #include <sys/ioctl.h> - #include <sys/stat.h> --#include <unistd.h> -+#include <unistd.h> -+#include <stdint.h> - - #ifdef MTD_OLD - # include <stdint.h> |