This patch makes several changes with uboot-envtools package:

 * bumps to version 2011.12
 * adds md5sum
 * creates a menu so it will look better in 'make menuconfig'
 * adds /etc/fw_env.config to conffile
 * refresh patches
 * removes init script because we should be using uci-defaults instead

I would also like to maintain this package.

Changes since v1:

We should put target uboot environment uci-defaults in this package and
use Makefile to install correct one. I should have think of that the
first time. Idea is from owsip package.

Signed-off-by: Luka Perkov <open...@lukaperkov.net>
---

Index: target/linux/lantiq/base-files/etc/uci-defaults/uboot_environment
===================================================================
--- target/linux/lantiq/base-files/etc/uci-defaults/uboot_environment   
(revision 30604)
+++ target/linux/lantiq/base-files/etc/uci-defaults/uboot_environment   
(working copy)
@@ -1,32 +0,0 @@
-#!/bin/sh
-#
-# Copyright (C) 2012 OpenWrt.org
-#
-
-uboot_environment_configuration() {
-       local dev=$1
-       local offset=$2
-       local envsize=$3
-       local secsize=$4
-       local numsec=$5
-       echo "$dev $offset $envsize $secsize $numsec" > /etc/fw_env.config
-}
-
-[ -e /etc/config/fw_env.config ] && exit 0
-
-. /lib/lantiq.sh
-
-board=$(lantiq_board_name)
-
-case "$board" in
-GIGASX76X)
-       uboot_environment_configuration "/dev/mtd1" "0x0" "0x10000" "0x10000" 
"1"
-       ;;
-
-*)
-       # custom foo goes here
-       true
-       ;;
-esac
-
-exit 0
Index: package/uboot-envtools/files/lantiq_env
===================================================================
--- package/uboot-envtools/files/lantiq_env     (revision 0)
+++ package/uboot-envtools/files/lantiq_env     (working copy)
@@ -0,0 +1,32 @@
+#!/bin/sh
+#
+# Copyright (C) 2012 OpenWrt.org
+#
+
+uboot_environment_configuration() {
+       local dev=$1
+       local offset=$2
+       local envsize=$3
+       local secsize=$4
+       local numsec=$5
+       echo "$dev $offset $envsize $secsize $numsec" > /etc/fw_env.config
+}
+
+[ -e /etc/config/fw_env.config ] && exit 0
+
+. /lib/lantiq.sh
+
+board=$(lantiq_board_name)
+
+case "$board" in
+GIGASX76X)
+       uboot_environment_configuration "/dev/mtd1" "0x0" "0x10000" "0x10000" 
"1"
+       ;;
+
+*)
+       # custom foo goes here
+       true
+       ;;
+esac
+
+exit 0
Index: package/uboot-envtools/files/uboot-envtools.init
===================================================================
--- package/uboot-envtools/files/uboot-envtools.init    (revision 30604)
+++ package/uboot-envtools/files/uboot-envtools.init    (working copy)
@@ -1,27 +0,0 @@
-#!/bin/sh /etc/rc.common
-# (C) 2011 OpenWrt.org
-# Creates /etc/fw_env.conf for fw_printenv (and fw_setenv)
-
-START=80
-
-create_fwenv_config() {
-       local dev
-       local offset
-       local envsize
-       local secsize
-       local numsec
-       config_get dev "$1" dev
-       config_get offset "$1" offset "0x0000"
-       config_get envsize "$1" envsize
-       config_get secsize "$1" secsize
-       config_get numsec "$1" numsec
-       echo "$dev              $offset         $envsize                
$secsize                $numsec" >>/etc/fw_env.config
-}
-
-start() {
-       [ ! -e /etc/fw_env.config ] && {
-               echo "# MTD device name Device offset   Env. size       Flash 
sector size       Number of sectors" >/etc/fw_env.config
-               config_load ubootenv
-               config_foreach create_fwenv_config ubootenv
-       }
-}
Index: package/uboot-envtools/patches/001-crc32_func_signature.patch
===================================================================
--- package/uboot-envtools/patches/001-crc32_func_signature.patch       
(revision 30604)
+++ package/uboot-envtools/patches/001-crc32_func_signature.patch       
(working copy)
@@ -110,15 +110,6 @@
  
        /* write environment back to flash */
        if (flash_io(O_RDWR)) {
-@@ -802,7 +804,7 @@ static int flash_write_buf (int dev, int
-               data = malloc (erase_len);
-               if (!data) {
-                       fprintf (stderr,
--                               "Cannot malloc %u bytes: %s\n",
-+                               "Cannot malloc %zu bytes: %s\n",
-                                erase_len, strerror (errno));
-                       return -1;
-               }
 @@ -1107,7 +1109,7 @@ int fw_env_open(void)
        if (flash_io (O_RDONLY))
                return -1;
Index: package/uboot-envtools/patches/002-makefile.patch
===================================================================
--- package/uboot-envtools/patches/002-makefile.patch   (revision 30604)
+++ package/uboot-envtools/patches/002-makefile.patch   (working copy)
@@ -1,13 +1,13 @@
 --- a/Makefile
 +++ b/Makefile
-@@ -21,37 +21,16 @@
+@@ -21,34 +21,17 @@
  # MA 02111-1307 USA
  #
  
 -include $(TOPDIR)/config.mk
 -
--HOSTSRCS := $(obj)crc32.c  fw_env.c  fw_env_main.c
-+SRCS := crc32.c  fw_env.c  fw_env_main.c
+-HOSTSRCS := $(SRCTREE)/lib/crc32.c  fw_env.c  fw_env_main.c
++SRCS := crc32.c fw_env.c fw_env_main.c
  HEADERS       := fw_env.h
  
 -# Compile for a hosted environment on the target
@@ -19,27 +19,26 @@
 -ifeq ($(MTD_VERSION),old)
 -HOSTCPPFLAGS += -DMTD_OLD
 -endif
+-
+-all:  $(obj)fw_printenv
+-
+-# Some files complain if compiled with -pedantic, use HOSTCFLAGS_NOPED
+-$(obj)fw_printenv:    $(HOSTSRCS) $(HEADERS)
+-      $(HOSTCC) $(HOSTCFLAGS_NOPED) $(HOSTLDFLAGS) -o $@ $(HOSTSRCS)
 +CPPFLAGS := -Wall $(CFLAGS)
  
- all:  $(obj)fw_printenv
+-clean:
+-      rm -f $(obj)fw_printenv
++all: fw_printenv
  
- # Some files complain if compiled with -pedantic, use HOSTCFLAGS_NOPED
--$(obj)fw_printenv:    $(HOSTSRCS) $(HEADERS)
--      $(HOSTCC) $(HOSTCFLAGS_NOPED) $(HOSTLDFLAGS) -o $@ $(HOSTSRCS)
-+$(obj)fw_printenv:    $(SRCS) $(HEADERS)
-+      $(CC) $(CPPFLAGS) $(SRCS) -o $(obj)fw_printenv
+-#########################################################################
++fw_printenv: $(SRCS) $(HEADERS)
++      $(CC) $(CPPFLAGS) $(SRCS) -o fw_printenv
  
- clean:
--      rm -f $(obj)fw_printenv $(obj)crc32.c
--
--$(obj)crc32.c:
--      ln -s $(src)../../lib/crc32.c $(obj)crc32.c
--
--#########################################################################
--
 -include $(TOPDIR)/rules.mk
 -
 -sinclude $(obj).depend
--
--#########################################################################
-+      rm -f $(obj)fw_printenv
++clean:
++      rm -f fw_printenv
+ 
+ #########################################################################
Index: package/uboot-envtools/Makefile
===================================================================
--- package/uboot-envtools/Makefile     (revision 30604)
+++ package/uboot-envtools/Makefile     (working copy)
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2006-2011 OpenWrt.org
+# Copyright (C) 2006-2012 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -9,12 +9,12 @@
 
 PKG_NAME:=uboot-envtools
 PKG_DISTNAME:=u-boot
-PKG_VERSION:=2011.06
-PKG_RELEASE:=4
+PKG_VERSION:=2011.12
+PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_DISTNAME)-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:=ftp://ftp.denx.de/pub/u-boot
-PKG_MD5SUM:=
+PKG_MD5SUM:=7f29b9f6da44d6e46e988e7561fd1d5f
 PKG_BUILD_DEPENDS:=zlib
 
 include $(INCLUDE_DIR)/package.mk
@@ -26,31 +26,46 @@
   CATEGORY:=Utilities
   TITLE:=read/modify U-Boot bootloader environment
   URL:=http://www.denx.de/wiki/U-Boot
+  MENU:=1
 endef
 
+define Package/uboot-envtools/config
+       menu "Configuration"
+       depends on PACKAGE_uboot-envtools
+
+       config PACKAGE_uboot-envtools_setenv_symlink
+               bool "Create fw_setenv symlink"
+               default n
+               help
+               With this option selected you will be able to edit U-Boot 
bootloader environment.
+ 
+       endmenu
+endef
+
 define Package/uboot-envtools/description
  This package includes tools to read and modify U-Boot bootloader environment.
 endef
 
-define Package/uboot-envtools/config
-        config PACKAGE_uboot-envtools_setenv_symlink
-                bool "create fw_setenv symlink"
+define Build/Prepare
+       mkdir -p $(PKG_BUILD_DIR)
+       tar xvjf $(DL_DIR)/$(PKG_SOURCE) --strip-components=2 -C 
$(PKG_BUILD_DIR) $(PKG_DISTNAME)-$(PKG_VERSION)/lib/crc32.c
+       $(call Build/Prepare/Default)
 endef
 
+define Package/uboot-envtools/conffiles
+/etc/fw_env.config
+endef
+
 define Package/uboot-envtools/install
        $(INSTALL_DIR) $(1)/usr/sbin
-       $(INSTALL_BIN) $(PKG_BUILD_DIR)/fw_printenv $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/fw_printenv $(1)/usr/sbin
 ifneq ($(CONFIG_PACKAGE_uboot-envtools_setenv_symlink),)
        ln -s fw_printenv $(1)/usr/sbin/fw_setenv
 endif
-       $(INSTALL_DIR) $(1)/etc/init.d
-       $(INSTALL_BIN) ./files/uboot-envtools.init 
$(1)/etc/init.d/uboot-envtools
+ifneq ($(CONFIG_TARGET_lantiq),)
+       $(INSTALL_DIR) $(1)/etc/uci-defaults
+       $(INSTALL_BIN) ./files/lantiq_env $(1)/etc/uci-defaults/uboot-envtools
+endif
 endef
 
-define Build/Prepare
-       mkdir -p $(PKG_BUILD_DIR)
-       tar xvjf $(DL_DIR)/$(PKG_SOURCE) --strip-components=2 -C 
$(PKG_BUILD_DIR) $(PKG_DISTNAME)-$(PKG_VERSION)/lib/crc32.c
-       $(call Build/Prepare/Default)
-endef
-
 $(eval $(call BuildPackage,uboot-envtools))
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to