diff mbox series

u-boot: Add mkenvimage tool

Message ID 20181115040043.9326-1-abrodkin@synopsys.com
State New
Headers show
Series u-boot: Add mkenvimage tool | expand

Commit Message

Alexey Brodkin Nov. 15, 2018, 4 a.m. UTC
This utility is used for creation of images containing
usable in run-time U-Boot environment.

As of today this utility is added per-board like here [1]
for Intel Edison board, here [2] for Altera's SoCFPGA and
I may guess there're others so instead of adding another one for
ARC why don't we package it for each and everyone.

[1] http://git.yoctoproject.org/cgit/cgit.cgi/meta-intel-edison/tree/meta-intel-edison-bsp/recipes-bsp/u-boot/u-boot-tools_2014.04.bb
[2] https://github.com/kraj/meta-altera/blob/master/recipes-bsp/u-boot/u-boot-mkenvimage_v2016.11.bb

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Alexander Kanavin <alexander.kanavin@linux.intel.com>
Cc: Richard Purdie <richard.purdie@linuxfoundation.org>
Cc: Otavio Salvador <otavio@ossystems.com.br>
Cc: Ross Burton <ross.burton@intel.com>
Cc: Marek Vasut <marex@denx.de>
---
 .../u-boot/u-boot-mkenvimage_2018.07.bb            | 27 ++++++++++++++++++++++
 1 file changed, 27 insertions(+)
 create mode 100644 meta/recipes-bsp/u-boot/u-boot-mkenvimage_2018.07.bb

Comments

Khem Raj Nov. 15, 2018, 4:57 a.m. UTC | #1
On Wed, Nov 14, 2018 at 8:00 PM Alexey Brodkin
<alexey.brodkin@synopsys.com> wrote:
>
> This utility is used for creation of images containing
> usable in run-time U-Boot environment.
>
> As of today this utility is added per-board like here [1]
> for Intel Edison board, here [2] for Altera's SoCFPGA and
> I may guess there're others so instead of adding another one for
> ARC why don't we package it for each and everyone.
>
> [1] http://git.yoctoproject.org/cgit/cgit.cgi/meta-intel-edison/tree/meta-intel-edison-bsp/recipes-bsp/u-boot/u-boot-tools_2014.04.bb
> [2] https://github.com/kraj/meta-altera/blob/master/recipes-bsp/u-boot/u-boot-mkenvimage_v2016.11.bb

If this is applicable/works for all u-boot based machines then I think it makes
sense to have it on OE-core.

>
> Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
> Cc: Alexander Kanavin <alexander.kanavin@linux.intel.com>
> Cc: Richard Purdie <richard.purdie@linuxfoundation.org>
> Cc: Otavio Salvador <otavio@ossystems.com.br>
> Cc: Ross Burton <ross.burton@intel.com>
> Cc: Marek Vasut <marex@denx.de>
> ---
>  .../u-boot/u-boot-mkenvimage_2018.07.bb            | 27 ++++++++++++++++++++++
>  1 file changed, 27 insertions(+)
>  create mode 100644 meta/recipes-bsp/u-boot/u-boot-mkenvimage_2018.07.bb
>
> diff --git a/meta/recipes-bsp/u-boot/u-boot-mkenvimage_2018.07.bb b/meta/recipes-bsp/u-boot/u-boot-mkenvimage_2018.07.bb
> new file mode 100644
> index 0000000000..4770f3db08
> --- /dev/null
> +++ b/meta/recipes-bsp/u-boot/u-boot-mkenvimage_2018.07.bb
> @@ -0,0 +1,27 @@
> +require u-boot-common_${PV}.inc
> +
> +SUMMARY = "U-Boot bootloader environment image creation tool"
> +DEPENDS += "openssl"
> +
> +EXTRA_OEMAKE_class-target = 'CROSS_COMPILE="${TARGET_PREFIX}" CC="${CC} ${CFLAGS} ${LDFLAGS}" HOSTCC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}" STRIP=true V=1'
> +EXTRA_OEMAKE_class-native = 'CC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}" HOSTCC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}" STRIP=true V=1'
> +EXTRA_OEMAKE_class-nativesdk = 'CROSS_COMPILE="${HOST_PREFIX}" CC="${CC} ${CFLAGS} ${LDFLAGS}" HOSTCC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}" STRIP=true V=1'
> +
> +do_compile () {
> +       oe_runmake sandbox_defconfig
> +
> +       # Disable CONFIG_CMD_LICENSE, license.h is not used by tools and
> +       # generating it requires bin2header tool, which for target build
> +       # is built with target tools and thus cannot be executed on host.
> +       sed -i "s/CONFIG_CMD_LICENSE=.*/# CONFIG_CMD_LICENSE is not set/" .config
> +
> +       oe_runmake cross_tools NO_SDL=1
> +}
> +
> +do_install () {
> +       install -d ${D}${bindir}
> +       install -m 0755 tools/mkenvimage ${D}${bindir}/uboot-mkenvimage
> +       ln -sf uboot-mkenvimage ${D}${bindir}/mkenvimage
> +}
> +
> +BBCLASSEXTEND = "native nativesdk"
> --
> 2.16.2
>
Marek Vasut Nov. 15, 2018, 5:03 a.m. UTC | #2
On 11/15/2018 05:57 AM, Khem Raj wrote:
> On Wed, Nov 14, 2018 at 8:00 PM Alexey Brodkin
> <alexey.brodkin@synopsys.com> wrote:
>>
>> This utility is used for creation of images containing
>> usable in run-time U-Boot environment.
>>
>> As of today this utility is added per-board like here [1]
>> for Intel Edison board, here [2] for Altera's SoCFPGA and
>> I may guess there're others so instead of adding another one for
>> ARC why don't we package it for each and everyone.
>>
>> [1] http://git.yoctoproject.org/cgit/cgit.cgi/meta-intel-edison/tree/meta-intel-edison-bsp/recipes-bsp/u-boot/u-boot-tools_2014.04.bb
>> [2] https://github.com/kraj/meta-altera/blob/master/recipes-bsp/u-boot/u-boot-mkenvimage_v2016.11.bb
> 
> If this is applicable/works for all u-boot based machines then I think it makes
> sense to have it on OE-core.

It is.

>> Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
>> Cc: Alexander Kanavin <alexander.kanavin@linux.intel.com>
>> Cc: Richard Purdie <richard.purdie@linuxfoundation.org>
>> Cc: Otavio Salvador <otavio@ossystems.com.br>
>> Cc: Ross Burton <ross.burton@intel.com>
>> Cc: Marek Vasut <marex@denx.de>

Reviewed-by: Marek Vasut <marex@denx.de>

That said, could the recipe for mkimage and mkenvimage be somehow
deduplicated ? There seems to be a lot of common stuff.

>> ---
>>  .../u-boot/u-boot-mkenvimage_2018.07.bb            | 27 ++++++++++++++++++++++

btw why was U-Boot not updated using AUH to 2018.09/2018.11 ?
Alexey Brodkin Nov. 15, 2018, 5:05 a.m. UTC | #3
Hi Khem,

On Wed, 2018-11-14 at 20:57 -0800, Khem Raj wrote:
> On Wed, Nov 14, 2018 at 8:00 PM Alexey Brodkin
> <alexey.brodkin@synopsys.com> wrote:
> > This utility is used for creation of images containing
> > usable in run-time U-Boot environment.
> > 
> > As of today this utility is added per-board like here [1]
> > for Intel Edison board, here [2] for Altera's SoCFPGA and
> > I may guess there're others so instead of adding another one for
> > ARC why don't we package it for each and everyone.
> > 
> > [1] 
> > https://urldefense.proofpoint.com/v2/url?u=http-3A__git.yoctoproject.org_cgit_cgit.cgi_meta-2Dintel-2Dedison_tree_meta-2Dintel-2Dedison-2Dbsp_recipes-2Dbsp_u-2Dboot_u-2Dboot-2Dtools-5F2014.04.bb&d=DwIBaQ&c=DPL6_X_6JkXFx7AXWqB0tg&r=lqdeeSSEes0GFDDl656eViXO7breS55ytWkhpk5R81I&m=U0I6P-1P3vft6mR4soZ9Y6ptJqYWloOoS0ogvO2Rzv4&s=WEknmJT4TnByCWMMzh4D-2sDrYv5_kx2V1Qk8SYtJY8&e=
> > [2] 
> > https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_kraj_meta-2Daltera_blob_master_recipes-2Dbsp_u-2Dboot_u-2Dboot-2Dmkenvimage-5Fv2016.11.bb&d=DwIBaQ&c=DPL6_X_6JkXFx7AXWqB0tg&r=lqdeeSSEes0GFDDl656eViXO7breS55ytWkhpk5R81I&m=U0I6P-1P3vft6mR4soZ9Y6ptJqYWloOoS0ogvO2Rzv4&s=OiXy88hL3o5z9JN0O88EUo3ttvvgFQnC2LnDc_xhGyY&e=
> 
> If this is applicable/works for all u-boot based machines then I think it makes
> sense to have it on OE-core.

Well "mkenvimage" is one of standard U-Boot tools so it has nothing
specific for any architecture or board whatsoever.

It is not used that often as "mkimage" probably because people
mostly depends on default U-Boot env settings which are compiled-in
U-Boot binary with help of CONFIG_EXTRA_ENV_SETTINGS="..."
but IMHO it is rather useful as we may prepare fine-tuned environment
setups for a particular use-case from pure text-based input.

-Alexey
Alexey Brodkin Nov. 15, 2018, 5:15 a.m. UTC | #4
Hi Marek,

On Thu, 2018-11-15 at 06:03 +0100, Marek Vasut wrote:
> On 11/15/2018 05:57 AM, Khem Raj wrote:
> > On Wed, Nov 14, 2018 at 8:00 PM Alexey Brodkin
> > <alexey.brodkin@synopsys.com> wrote:
> > > This utility is used for creation of images containing
> > > usable in run-time U-Boot environment.
> > > 
> > > As of today this utility is added per-board like here [1]
> > > for Intel Edison board, here [2] for Altera's SoCFPGA and
> > > I may guess there're others so instead of adding another one for
> > > ARC why don't we package it for each and everyone.
> > > 
> > > [1] 
> > > https://urldefense.proofpoint.com/v2/url?u=http-3A__git.yoctoproject.org_cgit_cgit.cgi_meta-2Dintel-2Dedison_tree_meta-2Dintel-2Dedison-2Dbsp_recipes-2Dbsp_u-2Dboot_u-2Dboot-2Dtools-5F2014.04.bb&d=DwICaQ&c=DPL6_X_6JkXFx7AXWqB0tg&r=lqdeeSSEes0GFDDl656eViXO7breS55ytWkhpk5R81I&m=cK5urAA7P2ER1AvKZdD3CEL5r23DwdtJ4Iohy_QCUSQ&s=VyVOHq5I3FsOXvOf7SQgVlwtTfKX0bN5ZmPPehjD-zw&e=
> > > [2] 
> > > https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_kraj_meta-2Daltera_blob_master_recipes-2Dbsp_u-2Dboot_u-2Dboot-2Dmkenvimage-5Fv2016.11.bb&d=DwICaQ&c=DPL6_X_6JkXFx7AXWqB0tg&r=lqdeeSSEes0GFDDl656eViXO7breS55ytWkhpk5R81I&m=cK5urAA7P2ER1AvKZdD3CEL5r23DwdtJ4Iohy_QCUSQ&s=TDPtpmofctGuP4dejRGli0SBUReQQPoiFQsWPHs4vV8&e=
> > 
> > If this is applicable/works for all u-boot based machines then I think it makes
> > sense to have it on OE-core.
> 
> It is.
> 
> > > Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
> > > Cc: Alexander Kanavin <alexander.kanavin@linux.intel.com>
> > > Cc: Richard Purdie <richard.purdie@linuxfoundation.org>
> > > Cc: Otavio Salvador <otavio@ossystems.com.br>
> > > Cc: Ross Burton <ross.burton@intel.com>
> > > Cc: Marek Vasut <marex@denx.de>
> 
> Reviewed-by: Marek Vasut <marex@denx.de>
> 
> That said, could the recipe for mkimage and mkenvimage be somehow
> deduplicated ? There seems to be a lot of common stuff.

I'd say why don't we just have one recipe for all U-Boot tools
instead of adding tools one-by-one?

-Alexey
Martin Jansa Nov. 15, 2018, 9:27 a.m. UTC | #5
On Thu, Nov 15, 2018 at 05:15:03AM +0000, Alexey Brodkin wrote:
> Hi Marek,
> 
> On Thu, 2018-11-15 at 06:03 +0100, Marek Vasut wrote:
> > On 11/15/2018 05:57 AM, Khem Raj wrote:
> > > On Wed, Nov 14, 2018 at 8:00 PM Alexey Brodkin
> > > <alexey.brodkin@synopsys.com> wrote:
> > > > This utility is used for creation of images containing
> > > > usable in run-time U-Boot environment.
> > > > 
> > > > As of today this utility is added per-board like here [1]
> > > > for Intel Edison board, here [2] for Altera's SoCFPGA and
> > > > I may guess there're others so instead of adding another one for
> > > > ARC why don't we package it for each and everyone.
> > > > 
> > > > [1] 
> > > > https://urldefense.proofpoint.com/v2/url?u=http-3A__git.yoctoproject.org_cgit_cgit.cgi_meta-2Dintel-2Dedison_tree_meta-2Dintel-2Dedison-2Dbsp_recipes-2Dbsp_u-2Dboot_u-2Dboot-2Dtools-5F2014.04.bb&d=DwICaQ&c=DPL6_X_6JkXFx7AXWqB0tg&r=lqdeeSSEes0GFDDl656eViXO7breS55ytWkhpk5R81I&m=cK5urAA7P2ER1AvKZdD3CEL5r23DwdtJ4Iohy_QCUSQ&s=VyVOHq5I3FsOXvOf7SQgVlwtTfKX0bN5ZmPPehjD-zw&e=
> > > > [2] 
> > > > https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_kraj_meta-2Daltera_blob_master_recipes-2Dbsp_u-2Dboot_u-2Dboot-2Dmkenvimage-5Fv2016.11.bb&d=DwICaQ&c=DPL6_X_6JkXFx7AXWqB0tg&r=lqdeeSSEes0GFDDl656eViXO7breS55ytWkhpk5R81I&m=cK5urAA7P2ER1AvKZdD3CEL5r23DwdtJ4Iohy_QCUSQ&s=TDPtpmofctGuP4dejRGli0SBUReQQPoiFQsWPHs4vV8&e=
> > > 
> > > If this is applicable/works for all u-boot based machines then I think it makes
> > > sense to have it on OE-core.
> > 
> > It is.
> > 
> > > > Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
> > > > Cc: Alexander Kanavin <alexander.kanavin@linux.intel.com>
> > > > Cc: Richard Purdie <richard.purdie@linuxfoundation.org>
> > > > Cc: Otavio Salvador <otavio@ossystems.com.br>
> > > > Cc: Ross Burton <ross.burton@intel.com>
> > > > Cc: Marek Vasut <marex@denx.de>
> > 
> > Reviewed-by: Marek Vasut <marex@denx.de>
> > 
> > That said, could the recipe for mkimage and mkenvimage be somehow
> > deduplicated ? There seems to be a lot of common stuff.
> 
> I'd say why don't we just have one recipe for all U-Boot tools
> instead of adding tools one-by-one?

Or add:
    install -m 0755 tools/mkenvimage ${D}${bindir}/uboot-mkenvimage
    ln -sf uboot-mkenvimage ${D}${bindir}/mkenvimage

to existing u-boot-mkimage recipe, that's what I'm doing in
u-boot-mkimage bbappend.
Alexey Brodkin Nov. 15, 2018, 10:32 a.m. UTC | #6
Hi Martin,

On Thu, 2018-11-15 at 10:27 +0100, Martin Jansa wrote:
> On Thu, Nov 15, 2018 at 05:15:03AM +0000, Alexey Brodkin wrote:
> > Hi Marek,

[snip]

> > > Reviewed-by: Marek Vasut <marex@denx.de>
> > > 
> > > That said, could the recipe for mkimage and mkenvimage be somehow
> > > deduplicated ? There seems to be a lot of common stuff.
> > 
> > I'd say why don't we just have one recipe for all U-Boot tools
> > instead of adding tools one-by-one?
> 
> Or add:
>     install -m 0755 tools/mkenvimage ${D}${bindir}/uboot-mkenvimage
>     ln -sf uboot-mkenvimage ${D}${bindir}/mkenvimage
> 
> to existing u-boot-mkimage recipe, that's what I'm doing in
> u-boot-mkimage bbappend.

Sure and indeed that was my initial intention but then I noticed
there're separate recipes for mkimage and fw-utils and decided
to act similarly.

If OE people is fine with addition of another (pretty similar ideologically)
utility in u-boot-mkimage_xx.bb then I'm happy to implement it that way.

-Alexey
Stefano Babic Nov. 15, 2018, 10:41 a.m. UTC | #7
On 15/11/18 06:05, Alexey Brodkin wrote:
> Hi Khem,
> 
> On Wed, 2018-11-14 at 20:57 -0800, Khem Raj wrote:
>> On Wed, Nov 14, 2018 at 8:00 PM Alexey Brodkin
>> <alexey.brodkin@synopsys.com> wrote:
>>> This utility is used for creation of images containing
>>> usable in run-time U-Boot environment.
>>>
>>> As of today this utility is added per-board like here [1]
>>> for Intel Edison board, here [2] for Altera's SoCFPGA and
>>> I may guess there're others so instead of adding another one for
>>> ARC why don't we package it for each and everyone.
>>>
>>> [1] 
>>> https://urldefense.proofpoint.com/v2/url?u=http-3A__git.yoctoproject.org_cgit_cgit.cgi_meta-2Dintel-2Dedison_tree_meta-2Dintel-2Dedison-2Dbsp_recipes-2Dbsp_u-2Dboot_u-2Dboot-2Dtools-5F2014.04.bb&d=DwIBaQ&c=DPL6_X_6JkXFx7AXWqB0tg&r=lqdeeSSEes0GFDDl656eViXO7breS55ytWkhpk5R81I&m=U0I6P-1P3vft6mR4soZ9Y6ptJqYWloOoS0ogvO2Rzv4&s=WEknmJT4TnByCWMMzh4D-2sDrYv5_kx2V1Qk8SYtJY8&e=
>>> [2] 
>>> https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_kraj_meta-2Daltera_blob_master_recipes-2Dbsp_u-2Dboot_u-2Dboot-2Dmkenvimage-5Fv2016.11.bb&d=DwIBaQ&c=DPL6_X_6JkXFx7AXWqB0tg&r=lqdeeSSEes0GFDDl656eViXO7breS55ytWkhpk5R81I&m=U0I6P-1P3vft6mR4soZ9Y6ptJqYWloOoS0ogvO2Rzv4&s=OiXy88hL3o5z9JN0O88EUo3ttvvgFQnC2LnDc_xhGyY&e=
>>
>> If this is applicable/works for all u-boot based machines then I think it makes
>> sense to have it on OE-core.
> 
> Well "mkenvimage" is one of standard U-Boot tools so it has nothing
> specific for any architecture or board whatsoever.
> 
> It is not used that often as "mkimage" probably because people
> mostly depends on default U-Boot env settings which are compiled-in
> U-Boot binary with help of CONFIG_EXTRA_ENV_SETTINGS="..."
> but IMHO it is rather useful as we may prepare fine-tuned environment
> setups for a particular use-case from pure text-based input.

It is useful, but I think it is better to include it into current recipe
(as Martin suggest) instead of adding a new one.

Stefano
Otavio Salvador Nov. 15, 2018, 5:03 p.m. UTC | #8
On Thu, Nov 15, 2018 at 9:35 AM Martin Jansa <martin.jansa@gmail.com> wrote:
> yes fw-utils is similar, but has different dependencies and builds slightly differently.

fw-utils use the machine setup to find the default environment to use,
so it is indeed machine specific.
diff mbox series

Patch

diff --git a/meta/recipes-bsp/u-boot/u-boot-mkenvimage_2018.07.bb b/meta/recipes-bsp/u-boot/u-boot-mkenvimage_2018.07.bb
new file mode 100644
index 0000000000..4770f3db08
--- /dev/null
+++ b/meta/recipes-bsp/u-boot/u-boot-mkenvimage_2018.07.bb
@@ -0,0 +1,27 @@ 
+require u-boot-common_${PV}.inc
+
+SUMMARY = "U-Boot bootloader environment image creation tool"
+DEPENDS += "openssl"
+
+EXTRA_OEMAKE_class-target = 'CROSS_COMPILE="${TARGET_PREFIX}" CC="${CC} ${CFLAGS} ${LDFLAGS}" HOSTCC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}" STRIP=true V=1'
+EXTRA_OEMAKE_class-native = 'CC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}" HOSTCC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}" STRIP=true V=1'
+EXTRA_OEMAKE_class-nativesdk = 'CROSS_COMPILE="${HOST_PREFIX}" CC="${CC} ${CFLAGS} ${LDFLAGS}" HOSTCC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}" STRIP=true V=1'
+
+do_compile () {
+	oe_runmake sandbox_defconfig
+
+	# Disable CONFIG_CMD_LICENSE, license.h is not used by tools and
+	# generating it requires bin2header tool, which for target build
+	# is built with target tools and thus cannot be executed on host.
+	sed -i "s/CONFIG_CMD_LICENSE=.*/# CONFIG_CMD_LICENSE is not set/" .config
+
+	oe_runmake cross_tools NO_SDL=1
+}
+
+do_install () {
+	install -d ${D}${bindir}
+	install -m 0755 tools/mkenvimage ${D}${bindir}/uboot-mkenvimage
+	ln -sf uboot-mkenvimage ${D}${bindir}/mkenvimage
+}
+
+BBCLASSEXTEND = "native nativesdk"