[v1,1/1] image_types: add base64 conversion

Submitted by Silvio Fricke on Feb. 11, 2019, 6:02 a.m. | Patch ID: 158642

Details

Message ID 4c3dabb9814914747119a28172f38e2a32c0bd36.1549821635.git.silvio.fricke@gmail.com
State Accepted
Commit 9d00b146c4125b195fac5a0743fe7d8e59edef7f
Headers show

Commit Message

Silvio Fricke Feb. 11, 2019, 6:02 a.m.
Sometimes it is useful to have a base64 representation of an image.

Signed-off-by: Silvio Fricke <silvio.fricke@gmail.com>
---
 meta/classes/image_types.bbclass | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass
index 70bd315306..ddca5b624e 100644
--- a/meta/classes/image_types.bbclass
+++ b/meta/classes/image_types.bbclass
@@ -280,7 +280,7 @@  IMAGE_TYPES = " \
 # CONVERSION_CMD/DEPENDS.
 COMPRESSIONTYPES ?= ""
 
-CONVERSIONTYPES = "gz bz2 lzma xz lz4 lzo zip sum md5sum sha1sum sha224sum sha256sum sha384sum sha512sum bmap u-boot vmdk vdi qcow2 ${COMPRESSIONTYPES}"
+CONVERSIONTYPES = "gz bz2 lzma xz lz4 lzo zip sum md5sum sha1sum sha224sum sha256sum sha384sum sha512sum bmap u-boot vmdk vdi qcow2 base64 ${COMPRESSIONTYPES}"
 CONVERSION_CMD_lzma = "lzma -k -f -7 ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}"
 CONVERSION_CMD_gz = "pigz -f -9 -n -c ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} > ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.gz"
 CONVERSION_CMD_bz2 = "pbzip2 -f -k ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}"
@@ -300,6 +300,7 @@  CONVERSION_CMD_u-boot = "mkimage -A ${UBOOT_ARCH} -O linux -T ramdisk -C none -n
 CONVERSION_CMD_vmdk = "qemu-img convert -O vmdk ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.vmdk"
 CONVERSION_CMD_vdi = "qemu-img convert -O vdi ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.vdi"
 CONVERSION_CMD_qcow2 = "qemu-img convert -O qcow2 ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.qcow2"
+CONVERSION_CMD_base64 = "base64 ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} > ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.base64"
 CONVERSION_DEPENDS_lzma = "xz-native"
 CONVERSION_DEPENDS_gz = "pigz-native"
 CONVERSION_DEPENDS_bz2 = "pbzip2-native"
@@ -313,6 +314,7 @@  CONVERSION_DEPENDS_u-boot = "u-boot-tools-native"
 CONVERSION_DEPENDS_vmdk = "qemu-native"
 CONVERSION_DEPENDS_vdi = "qemu-native"
 CONVERSION_DEPENDS_qcow2 = "qemu-native"
+CONVERSION_DEPENDS_base64 = "coreutils-native"
 
 RUNNABLE_IMAGE_TYPES ?= "ext2 ext3 ext4"
 RUNNABLE_MACHINE_PATTERNS ?= "qemu"

Comments

Ross Burton Feb. 11, 2019, 10:27 a.m.
Is it?  I'm genuinely curious when a base64 encoded image is useful.

Ross

On Mon, 11 Feb 2019 at 06:03, Silvio Fricke <silvio.fricke@gmail.com> wrote:

> Sometimes it is useful to have a base64 representation of an image.
>
> Signed-off-by: Silvio Fricke <silvio.fricke@gmail.com>
> ---
>  meta/classes/image_types.bbclass | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/meta/classes/image_types.bbclass
> b/meta/classes/image_types.bbclass
> index 70bd315306..ddca5b624e 100644
> --- a/meta/classes/image_types.bbclass
> +++ b/meta/classes/image_types.bbclass
> @@ -280,7 +280,7 @@ IMAGE_TYPES = " \
>  # CONVERSION_CMD/DEPENDS.
>  COMPRESSIONTYPES ?= ""
>
> -CONVERSIONTYPES = "gz bz2 lzma xz lz4 lzo zip sum md5sum sha1sum
> sha224sum sha256sum sha384sum sha512sum bmap u-boot vmdk vdi qcow2
> ${COMPRESSIONTYPES}"
> +CONVERSIONTYPES = "gz bz2 lzma xz lz4 lzo zip sum md5sum sha1sum
> sha224sum sha256sum sha384sum sha512sum bmap u-boot vmdk vdi qcow2 base64
> ${COMPRESSIONTYPES}"
>  CONVERSION_CMD_lzma = "lzma -k -f -7
> ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}"
>  CONVERSION_CMD_gz = "pigz -f -9 -n -c
> ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} >
> ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.gz"
>  CONVERSION_CMD_bz2 = "pbzip2 -f -k
> ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}"
> @@ -300,6 +300,7 @@ CONVERSION_CMD_u-boot = "mkimage -A ${UBOOT_ARCH} -O
> linux -T ramdisk -C none -n
>  CONVERSION_CMD_vmdk = "qemu-img convert -O vmdk
> ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}
> ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.vmdk"
>  CONVERSION_CMD_vdi = "qemu-img convert -O vdi
> ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}
> ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.vdi"
>  CONVERSION_CMD_qcow2 = "qemu-img convert -O qcow2
> ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}
> ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.qcow2"
> +CONVERSION_CMD_base64 = "base64 ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}
> > ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.base64"
>  CONVERSION_DEPENDS_lzma = "xz-native"
>  CONVERSION_DEPENDS_gz = "pigz-native"
>  CONVERSION_DEPENDS_bz2 = "pbzip2-native"
> @@ -313,6 +314,7 @@ CONVERSION_DEPENDS_u-boot = "u-boot-tools-native"
>  CONVERSION_DEPENDS_vmdk = "qemu-native"
>  CONVERSION_DEPENDS_vdi = "qemu-native"
>  CONVERSION_DEPENDS_qcow2 = "qemu-native"
> +CONVERSION_DEPENDS_base64 = "coreutils-native"
>
>  RUNNABLE_IMAGE_TYPES ?= "ext2 ext3 ext4"
>  RUNNABLE_MACHINE_PATTERNS ?= "qemu"
> --
> 2.20.1
>
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>
Silvio Fricke Feb. 11, 2019, 12:14 p.m.
Hi,

>    Is it?  I'm genuinely curious when a base64 encoded image is useful. 

It is! :-)
We are using a softwarestack which use base64 (I am delighted thats no one is
using uuencode ^^) encoded images to transfer them via wire. I can not change
this stack.

If this isn't useful, maybe you can help me to get a own conversion cmd into
my own bbclasses? I have tried it in several ways, but nothing worked. The
last approach was to change the image_type.bbclass.


TIA,
Silvio


>    Ross
>    On Mon, 11 Feb 2019 at 06:03, Silvio Fricke <[1]silvio.fricke@gmail.com>
>    wrote:
> 
>      Sometimes it is useful to have a base64 representation of an image.
> 
>      Signed-off-by: Silvio Fricke <[2]silvio.fricke@gmail.com>
>      ---
>       meta/classes/image_types.bbclass | 4 +++-
>       1 file changed, 3 insertions(+), 1 deletion(-)
> 
>      diff --git a/meta/classes/image_types.bbclass
>      b/meta/classes/image_types.bbclass
>      index 70bd315306..ddca5b624e 100644
>      --- a/meta/classes/image_types.bbclass
>      +++ b/meta/classes/image_types.bbclass
>      @@ -280,7 +280,7 @@ IMAGE_TYPES = " \
>       # CONVERSION_CMD/DEPENDS.
>       COMPRESSIONTYPES ?= ""
> 
>      -CONVERSIONTYPES = "gz bz2 lzma xz lz4 lzo zip sum md5sum sha1sum
>      sha224sum sha256sum sha384sum sha512sum bmap u-boot vmdk vdi qcow2
>      ${COMPRESSIONTYPES}"
>      +CONVERSIONTYPES = "gz bz2 lzma xz lz4 lzo zip sum md5sum sha1sum
>      sha224sum sha256sum sha384sum sha512sum bmap u-boot vmdk vdi qcow2
>      base64 ${COMPRESSIONTYPES}"
>       CONVERSION_CMD_lzma = "lzma -k -f -7
>      ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}"
>       CONVERSION_CMD_gz = "pigz -f -9 -n -c
>      ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} >
>      ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.gz"
>       CONVERSION_CMD_bz2 = "pbzip2 -f -k
>      ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}"
>      @@ -300,6 +300,7 @@ CONVERSION_CMD_u-boot = "mkimage -A ${UBOOT_ARCH} -O
>      linux -T ramdisk -C none -n
>       CONVERSION_CMD_vmdk = "qemu-img convert -O vmdk
>      ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}
>      ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.vmdk"
>       CONVERSION_CMD_vdi = "qemu-img convert -O vdi
>      ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}
>      ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.vdi"
>       CONVERSION_CMD_qcow2 = "qemu-img convert -O qcow2
>      ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}
>      ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.qcow2"
>      +CONVERSION_CMD_base64 = "base64
>      ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} >
>      ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.base64"
>       CONVERSION_DEPENDS_lzma = "xz-native"
>       CONVERSION_DEPENDS_gz = "pigz-native"
>       CONVERSION_DEPENDS_bz2 = "pbzip2-native"
>      @@ -313,6 +314,7 @@ CONVERSION_DEPENDS_u-boot = "u-boot-tools-native"
>       CONVERSION_DEPENDS_vmdk = "qemu-native"
>       CONVERSION_DEPENDS_vdi = "qemu-native"
>       CONVERSION_DEPENDS_qcow2 = "qemu-native"
>      +CONVERSION_DEPENDS_base64 = "coreutils-native"
> 
>       RUNNABLE_IMAGE_TYPES ?= "ext2 ext3 ext4"
>       RUNNABLE_MACHINE_PATTERNS ?= "qemu"
>      --
>      2.20.1
> 
>      --
>      _______________________________________________
>      Openembedded-core mailing list
>      [3]Openembedded-core@lists.openembedded.org
>      [4]http://lists.openembedded.org/mailman/listinfo/openembedded-core
> 
> References
> 
>    Visible links
>    1. mailto:silvio.fricke@gmail.com
>    2. mailto:silvio.fricke@gmail.com
>    3. mailto:Openembedded-core@lists.openembedded.org
>    4. http://lists.openembedded.org/mailman/listinfo/openembedded-core
> /usr/bin/xdg-open: line 881: www-browser: command not found
> /usr/bin/xdg-open: line 881: links2: command not found
Ross Burton Feb. 11, 2019, 12:28 p.m.
On Mon, 11 Feb 2019 at 12:14, S. Fricke <silvio.fricke@gmail.com> wrote:

> Hi,
>
> >    Is it?  I'm genuinely curious when a base64 encoded image is useful.
>
> It is! :-)
> We are using a softwarestack which use base64 (I am delighted thats no one
> is
> using uuencode ^^) encoded images to transfer them via wire. I can not
> change
> this stack.
>

Ah, fair enough.  Yes in that case I guess that it's not uu is good :)


> If this isn't useful, maybe you can help me to get a own conversion cmd
> into
> my own bbclasses? I have tried it in several ways, but nothing worked. The
> last approach was to change the image_type.bbclass.


It's very low-impact so I don't object to this in oe-core.

Ross