On Tue, Aug 05, 2014 at 02:29:12PM +0200, Markus Niebel wrote:
> Hello Bruno,
> 
> Am 04.08.2014 10:29, wrote Bruno Thomsen:
> > Provide read/write access to U-Boot environment stored in eMMC flash from 
> > Linux.
> > 
> > Access to U-Boot environment can be very useful; dual kernel/rootfs images, 
> > production default values, change kernel bootargs, etc.
> > 
> > Tested with U-Boot 2009.08 and 2013.04 on TQMa28.
> > 
> 
> Wouldn't it be better to rework the support for u-boot tools in general? (I 
> know, this will be tricky, since
> U-Boot environment tools compilation is really an adventure). Also I think, 
> we should use the same version of
> U-Boot tools as we use for the U-Boot itself.
> 
> What do you think?

I think it's a good idea.

> For reference here is an internal used version of the u-boot-tools Makefile 
> (known to work with U-Boot versions from our BSP for TQMa53 / TQMa6x). Should 
> work at least for U-Boot 2013.01 and 2013.04 You need to provide a target 
> specific /etc/fw_env.config
> 
> 8<--------------------------------------------------------------------
> # -*-makefile-*-
> #
> # Copyright (C) 2012 by Andreas Bießmann <[email protected]>
> #
> # See CREDITS for details about who has contributed to this project.
> #
> # For further information about the PTXdist project and license conditions
> # see the README file.
> #
> 
> #
> # We provide this package
> #
> PACKAGES-$(PTXCONF_U_BOOT_TOOLS) += u-boot-tools
> 
> #
> # Paths and names
> #
> U_BOOT_TOOLS_VERSION  := $(U_BOOT_VERSION)
> U_BOOT_TOOLS_MD5      := $(U_BOOT_MD5)
> U_BOOT_TOOLS          := u-boot-$(U_BOOT_TOOLS_VERSION)
> U_BOOT_TOOLS_SUFFIX   := tar.bz2
> U_BOOT_TOOLS_URL      := 
> http://ftp.denx.de/pub/u-boot/$(U_BOOT_TOOLS).$(U_BOOT_TOOLS_SUFFIX)
> U_BOOT_TOOLS_SOURCE   := $(SRCDIR)/$(U_BOOT_TOOLS).$(U_BOOT_TOOLS_SUFFIX)

This can fail. Use '=' instead of ':=' for anything that uses U_BOOT*
variables (directly or indirectly).

> U_BOOT_TOOLS_DIR      := $(BUILDDIR)/$(U_BOOT_TOOLS)

Set this to $(BUILDDIR)/u-boot-tools-$(U_BOOT_TOOLS_VERSION) ...

> U_BOOT_TOOLS_LICENSE  := GPLv2
> 
> $(STATEDIR)/u-boot-tools.extract: $(STATEDIR)/u-boot.extract
>       @$(call targetinfo)
>       @$(call touch)
> 
> $(STATEDIR)/u-boot-tools.prepare: $(STATEDIR)/u-boot.prepare
>       @$(call targetinfo)
>       @$(call touch)

... and do the extract /prepare correctly. Anything else causes problems
when rebuilding individual packages.

Michael

> 
> # ----------------------------------------------------------------------------
> # Prepare
> # ----------------------------------------------------------------------------
> 
> U_BOOT_TOOLS_PATH     := $(U_BOOT_PATH)
> # U_BOOT_TOOLS_MAKE_OPT       := $(U_BOOT_MAKE_OPT) tools
> 
> U_BOOT_TOOLS_CONF_TOOL        := NO
> U_BOOT_TOOLS_MAKE_OPT := \
>       HOSTCC="$(BOOTLOADER_CROSS_COMPILE)gcc" \
>       HOSTSTRIP="$(BOOTLOADER_CROSS_COMPILE)strip" \
>       CROSS_COMPILE=$(BOOTLOADER_CROSS_COMPILE) \
>       tools
> 
> #     HOSTCC="$(CROSS_CC)" \
> #     HOSTSTRIP="$(CROSS_STRIP)" \
> #     tools
> 
> ifdef PTXCONF_U_BOOT_TOOLS_TOOL_ENV
> U_BOOT_TOOLS_MAKE_OPT += env
> endif
> 
> # ----------------------------------------------------------------------------
> # Install
> # ----------------------------------------------------------------------------
> 
> $(STATEDIR)/u-boot-tools.install:
>       @$(call targetinfo)
>       install -D $(U_BOOT_TOOLS_DIR)/tools/env/fw_printenv \
>               $(U_BOOT_TOOLS_PKGDIR)/usr/sbin/fw_printenv
>       @$(call touch)
> 
> # ----------------------------------------------------------------------------
> # Target-Install
> # ----------------------------------------------------------------------------
> 
> $(STATEDIR)/u-boot-tools.targetinstall:
>       @$(call targetinfo)
> 
>       @$(call install_init,  u-boot-tools)
>       @$(call install_fixup, u-boot-tools,PRIORITY,optional)
>       @$(call install_fixup, u-boot-tools,SECTION,base)
>       @$(call install_fixup, u-boot-tools,AUTHOR,\
>               "Andreas Bießmann <[email protected]>")
>       @$(call install_fixup, u-boot-tools,DESCRIPTION,missing)
> 
> ifdef PTXCONF_U_BOOT_TOOLS_TOOL_ENV
>       @$(call install_copy, u-boot-tools, 0, 0, 0755, -, 
> /usr/sbin/fw_printenv)
>       @$(call install_link, u-boot-tools, fw_printenv, /usr/sbin/fw_setenv)
>       @$(call install_alternative, u-boot-tools, 0, 0, 0644, 
> /etc/fw_env.config)
> endif
> 
>       @$(call install_finish, u-boot-tools)
> 
>       @$(call touch)
> 
> $(STATEDIR)/u-boot-tools.clean:
>       @$(call targetinfo)
>       -rm $(STATEDIR)/u-boot-tools.*
> #     @$(call clean_pkg, U_BOOT_TOOLS)
> 
> # vim: syntax=make
> 8<--------------------------------------------------------------------
> 
> Regards
> 
> Markus
> 
> -- 
> ptxdist mailing list
> [email protected]
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

-- 
ptxdist mailing list
[email protected]

Reply via email to