Re: [OE-core] [PATCH v2 1/2] kernel: Add KERNEL_IMAGETYPES to build multi types kernel at one time

2016-02-22 Thread Bruce Ashfield
On Mon, Feb 22, 2016 at 3:43 AM, He Zhe  wrote:

>
>
> On 02/19/2016 11:46 PM, Bruce Ashfield wrote:
> >
> >
> > On Fri, Feb 19, 2016 at 4:56 AM, >wrote:
> >
> > From: He Zhe >
> >
> > Add KERNEL_IMAGETYPES to support building packaging and installing
> > multi types of kernel images, such as zImage uImage, at one time.
> >
> > KERNEL_IMAGETYPE works as before. All KERNEL_ALT_IMAGETYPEs are
> > replaced by KERNEL_IMAGETYPES.
> >
> >
> >
> > I see that you have updated layers/configs with the new variable, but
> obviously you can't see all the
> > layers that may be using that old variable.
> >
> > Isn't it possible to have a python routine that detects the old
> ALT_IMAGETYPE variable and
> > assigns it to the new one (if it isn't already set) ? Sort of like how
> distro features/features backfill
> > work ?
> >
>
> Thanks for careful review.
>
> OK. I'll try to add such function.
>
> >
> > Fixes [YOCTO #6945].
> >
> > Signed-off-by: He Zhe >
> > ---
> >  documentation/ref-manual/ref-variables.xml |  10 +-
> >  meta-yocto-bsp/conf/machine/edgerouter.conf|   2 +-
> >  meta/classes/kernel-fitimage.bbclass   |  20 +--
> >  meta/classes/kernel-grub.bbclass   |  44 --
> >  meta/classes/kernel-uimage.bbclass |  22 +--
> >  meta/classes/kernel.bbclass| 171
> +++--
> >  meta/conf/documentation.conf   |   1 +
> >  meta/conf/machine/qemumips.conf|   2 +-
> >  meta/conf/machine/qemumips64.conf  |   2 +-
> >  meta/recipes-kernel/linux/linux-dtb.inc|  49 +++---
> >  .../target/arch/mips/conf/machine/machine.conf |   2 +-
> >  .../target/arch/mips64/conf/machine/machine.conf   |   2 +-
> >  .../target/arch/qemu/conf/machine/machine.conf |   2 +-
> >  13 files changed, 214 insertions(+), 115 deletions(-)
> >
> > diff --git a/documentation/ref-manual/ref-variables.xml
> b/documentation/ref-manual/ref-variables.xml
> > index a76a8c2..a8e4fd8 100644
> > --- a/documentation/ref-manual/ref-variables.xml
> > +++ b/documentation/ref-manual/ref-variables.xml
> > @@ -6417,14 +6417,14 @@
> recipes-graphics/xorg-font/font-alias_1.0.3.bb:PR = "${INC_PR}.3"
> >  
> >  
> >
> > - id='var-KERNEL_ALT_IMAGETYPE'>KERNEL_ALT_IMAGETYPE
> > + id='var-KERNEL_IMAGETYPES'>KERNEL_IMAGETYPES
> >  
> > -KERNEL_ALT_IMAGETYPE[doc] = "Specifies an alternate
> kernel image type for creation."
> > +KERNEL_IMAGETYPES[doc] = "Specifies alternate
> kernel image types for creation."
> >  
> >  
> >  
> >  
> > -Specifies an alternate kernel image type for
> creation in
> > +Specifies alternate kernel image types for
> creation in
> >  addition to the kernel image type specified
> using the
> >   linkend='var-KERNEL_IMAGETYPE'>KERNEL_IMAGETYPE
> >  variable.
> > @@ -6612,8 +6612,8 @@ recipes-graphics/xorg-font/font-alias_1.0.3.bb:PR
> = "${INC_PR}.3"
> >  
> >
> >  
> > -If you want to build an alternate kernel image
> type, use the
> > - linkend='var-KERNEL_ALT_IMAGETYPE'>KERNEL_ALT_IMAGETYPE
> > +If you want to build alternate kernel image
> types, use the
> > + linkend='var-KERNEL_IMAGETYPES'>KERNEL_IMAGETYPES
> >  variable.
> >  
> >  
> > diff --git a/meta-yocto-bsp/conf/machine/edgerouter.conf
> b/meta-yocto-bsp/conf/machine/edgerouter.conf
> > index 476e690..affd568 100644
> > --- a/meta-yocto-bsp/conf/machine/edgerouter.conf
> > +++ b/meta-yocto-bsp/conf/machine/edgerouter.conf
> > @@ -7,7 +7,7 @@ require conf/machine/include/tune-mips64.inc
> >  MACHINE_FEATURES = "pci ext2 ext3 serial"
> >
> >  KERNEL_IMAGETYPE = "vmlinux"
> > -KERNEL_ALT_IMAGETYPE = "vmlinux.bin"
> > +KERNEL_IMAGETYPES = "vmlinux.bin"
> >
> >
> > This now reads a bit ... odd (for back of a better description). I'm
> concerned that it will cause
> > confusion, there are two variables:
> >
> > KERNEL_IMAGETYPE and KERNEL_IMAGETYPES ..
> >
> > They are very close in name, and just reading the variable doesn't
> really tell us why
> > we'd set one and not the other. The old "ALT" made it more obvious.
> >
>
> But changing original KERNEL_ALT_IMAGETYPE to a list or using
> KERNEL_ALT_IMAGETYPES
> in addition to KERNEL_ALT_IMAGETYPE 

Re: [OE-core] [PATCH v2 1/2] kernel: Add KERNEL_IMAGETYPES to build multi types kernel at one time

2016-02-22 Thread He Zhe


On 02/19/2016 11:46 PM, Bruce Ashfield wrote:
>
>
> On Fri, Feb 19, 2016 at 4:56 AM,  >wrote:
>
> From: He Zhe >
>
> Add KERNEL_IMAGETYPES to support building packaging and installing
> multi types of kernel images, such as zImage uImage, at one time.
>
> KERNEL_IMAGETYPE works as before. All KERNEL_ALT_IMAGETYPEs are
> replaced by KERNEL_IMAGETYPES.
>
>
>  
> I see that you have updated layers/configs with the new variable, but 
> obviously you can't see all the 
> layers that may be using that old variable.
>
> Isn't it possible to have a python routine that detects the old ALT_IMAGETYPE 
> variable and
> assigns it to the new one (if it isn't already set) ? Sort of like how distro 
> features/features backfill
> work ?
>

Thanks for careful review.

OK. I'll try to add such function.

>
> Fixes [YOCTO #6945].
>
> Signed-off-by: He Zhe >
> ---
>  documentation/ref-manual/ref-variables.xml |  10 +-
>  meta-yocto-bsp/conf/machine/edgerouter.conf|   2 +-
>  meta/classes/kernel-fitimage.bbclass   |  20 +--
>  meta/classes/kernel-grub.bbclass   |  44 --
>  meta/classes/kernel-uimage.bbclass |  22 +--
>  meta/classes/kernel.bbclass| 171 
> +++--
>  meta/conf/documentation.conf   |   1 +
>  meta/conf/machine/qemumips.conf|   2 +-
>  meta/conf/machine/qemumips64.conf  |   2 +-
>  meta/recipes-kernel/linux/linux-dtb.inc|  49 +++---
>  .../target/arch/mips/conf/machine/machine.conf |   2 +-
>  .../target/arch/mips64/conf/machine/machine.conf   |   2 +-
>  .../target/arch/qemu/conf/machine/machine.conf |   2 +-
>  13 files changed, 214 insertions(+), 115 deletions(-)
>
> diff --git a/documentation/ref-manual/ref-variables.xml 
> b/documentation/ref-manual/ref-variables.xml
> index a76a8c2..a8e4fd8 100644
> --- a/documentation/ref-manual/ref-variables.xml
> +++ b/documentation/ref-manual/ref-variables.xml
> @@ -6417,14 +6417,14 @@ recipes-graphics/xorg-font/font-alias_1.0.3.bb:PR 
> = "${INC_PR}.3"
>  
>  
>
> - id='var-KERNEL_ALT_IMAGETYPE'>KERNEL_ALT_IMAGETYPE
> + id='var-KERNEL_IMAGETYPES'>KERNEL_IMAGETYPES
>  
> -KERNEL_ALT_IMAGETYPE[doc] = "Specifies an alternate 
> kernel image type for creation."
> +KERNEL_IMAGETYPES[doc] = "Specifies alternate kernel 
> image types for creation."
>  
>  
>  
>  
> -Specifies an alternate kernel image type for 
> creation in
> +Specifies alternate kernel image types for creation 
> in
>  addition to the kernel image type specified using the
>   linkend='var-KERNEL_IMAGETYPE'>KERNEL_IMAGETYPE
>  variable.
> @@ -6612,8 +6612,8 @@ recipes-graphics/xorg-font/font-alias_1.0.3.bb:PR = 
> "${INC_PR}.3"
>  
>
>  
> -If you want to build an alternate kernel image type, 
> use the
> - linkend='var-KERNEL_ALT_IMAGETYPE'>KERNEL_ALT_IMAGETYPE
> +If you want to build alternate kernel image types, 
> use the
> + linkend='var-KERNEL_IMAGETYPES'>KERNEL_IMAGETYPES
>  variable.
>  
>  
> diff --git a/meta-yocto-bsp/conf/machine/edgerouter.conf 
> b/meta-yocto-bsp/conf/machine/edgerouter.conf
> index 476e690..affd568 100644
> --- a/meta-yocto-bsp/conf/machine/edgerouter.conf
> +++ b/meta-yocto-bsp/conf/machine/edgerouter.conf
> @@ -7,7 +7,7 @@ require conf/machine/include/tune-mips64.inc
>  MACHINE_FEATURES = "pci ext2 ext3 serial"
>
>  KERNEL_IMAGETYPE = "vmlinux"
> -KERNEL_ALT_IMAGETYPE = "vmlinux.bin"
> +KERNEL_IMAGETYPES = "vmlinux.bin"
>
>
> This now reads a bit ... odd (for back of a better description). I'm 
> concerned that it will cause
> confusion, there are two variables:
>
> KERNEL_IMAGETYPE and KERNEL_IMAGETYPES ..
>
> They are very close in name, and just reading the variable doesn't really 
> tell us why
> we'd set one and not the other. The old "ALT" made it more obvious.
>

But changing original KERNEL_ALT_IMAGETYPE to a list or using 
KERNEL_ALT_IMAGETYPES
in addition to KERNEL_ALT_IMAGETYPE also seems not very clear. Below is the 
previous
talk with Richard Purdie and Christopher Larson.

> Question, why not add KERNEL_IMAGETYPES, and make KERNEL_IMAGETYPE equal 
> to your new KERNEL_IMAGETYPE_0?(Christopher)
 Adding 

Re: [OE-core] [PATCH v2 1/2] kernel: Add KERNEL_IMAGETYPES to build multi types kernel at one time

2016-02-19 Thread Bruce Ashfield
On Fri, Feb 19, 2016 at 4:56 AM,  wrote:

> From: He Zhe 
>
> Add KERNEL_IMAGETYPES to support building packaging and installing
> multi types of kernel images, such as zImage uImage, at one time.
>
> KERNEL_IMAGETYPE works as before. All KERNEL_ALT_IMAGETYPEs are
> replaced by KERNEL_IMAGETYPES.
>


I see that you have updated layers/configs with the new variable, but
obviously you can't see all the
layers that may be using that old variable.

Isn't it possible to have a python routine that detects the old
ALT_IMAGETYPE variable and
assigns it to the new one (if it isn't already set) ? Sort of like how
distro features/features backfill
work ?


> Fixes [YOCTO #6945].
>
> Signed-off-by: He Zhe 
> ---
>  documentation/ref-manual/ref-variables.xml |  10 +-
>  meta-yocto-bsp/conf/machine/edgerouter.conf|   2 +-
>  meta/classes/kernel-fitimage.bbclass   |  20 +--
>  meta/classes/kernel-grub.bbclass   |  44 --
>  meta/classes/kernel-uimage.bbclass |  22 +--
>  meta/classes/kernel.bbclass| 171
> +++--
>  meta/conf/documentation.conf   |   1 +
>  meta/conf/machine/qemumips.conf|   2 +-
>  meta/conf/machine/qemumips64.conf  |   2 +-
>  meta/recipes-kernel/linux/linux-dtb.inc|  49 +++---
>  .../target/arch/mips/conf/machine/machine.conf |   2 +-
>  .../target/arch/mips64/conf/machine/machine.conf   |   2 +-
>  .../target/arch/qemu/conf/machine/machine.conf |   2 +-
>  13 files changed, 214 insertions(+), 115 deletions(-)
>
> diff --git a/documentation/ref-manual/ref-variables.xml
> b/documentation/ref-manual/ref-variables.xml
> index a76a8c2..a8e4fd8 100644
> --- a/documentation/ref-manual/ref-variables.xml
> +++ b/documentation/ref-manual/ref-variables.xml
> @@ -6417,14 +6417,14 @@ recipes-graphics/xorg-font/font-alias_1.0.3.bb:PR
> = "${INC_PR}.3"
>  
>  
>
> - id='var-KERNEL_ALT_IMAGETYPE'>KERNEL_ALT_IMAGETYPE
> + id='var-KERNEL_IMAGETYPES'>KERNEL_IMAGETYPES
>  
> -KERNEL_ALT_IMAGETYPE[doc] = "Specifies an alternate
> kernel image type for creation."
> +KERNEL_IMAGETYPES[doc] = "Specifies alternate kernel
> image types for creation."
>  
>  
>  
>  
> -Specifies an alternate kernel image type for creation
> in
> +Specifies alternate kernel image types for creation in
>  addition to the kernel image type specified using the
>   linkend='var-KERNEL_IMAGETYPE'>KERNEL_IMAGETYPE
>  variable.
> @@ -6612,8 +6612,8 @@ recipes-graphics/xorg-font/font-alias_1.0.3.bb:PR =
> "${INC_PR}.3"
>  
>
>  
> -If you want to build an alternate kernel image type,
> use the
> - linkend='var-KERNEL_ALT_IMAGETYPE'>KERNEL_ALT_IMAGETYPE
> +If you want to build alternate kernel image types,
> use the
> + linkend='var-KERNEL_IMAGETYPES'>KERNEL_IMAGETYPES
>  variable.
>  
>  
> diff --git a/meta-yocto-bsp/conf/machine/edgerouter.conf
> b/meta-yocto-bsp/conf/machine/edgerouter.conf
> index 476e690..affd568 100644
> --- a/meta-yocto-bsp/conf/machine/edgerouter.conf
> +++ b/meta-yocto-bsp/conf/machine/edgerouter.conf
> @@ -7,7 +7,7 @@ require conf/machine/include/tune-mips64.inc
>  MACHINE_FEATURES = "pci ext2 ext3 serial"
>
>  KERNEL_IMAGETYPE = "vmlinux"
> -KERNEL_ALT_IMAGETYPE = "vmlinux.bin"
> +KERNEL_IMAGETYPES = "vmlinux.bin"
>

This now reads a bit ... odd (for back of a better description). I'm
concerned that it will cause
confusion, there are two variables:

KERNEL_IMAGETYPE and KERNEL_IMAGETYPES ..

They are very close in name, and just reading the variable doesn't really
tell us why
we'd set one and not the other. The old "ALT" made it more obvious.

But from the patch, KERNEL_IMAGETYPE isn't used, so does it have to be set
at
all in these .conf files ? .. or maybe I missed where it is still used
other than for
compatibility.


>  KERNEL_IMAGE_STRIP_EXTRA_SECTIONS  = ".comment"
>
>  PREFERRED_PROVIDER_virtual/kernel ?= "linux-yocto"
> diff --git a/meta/classes/kernel-fitimage.bbclass
> b/meta/classes/kernel-fitimage.bbclass
> index f1b409c..51df19d 100644
> --- a/meta/classes/kernel-fitimage.bbclass
> +++ b/meta/classes/kernel-fitimage.bbclass
> @@ -1,8 +1,8 @@
>  inherit kernel-uboot
>
>  python __anonymous () {
> -kerneltype = d.getVar('KERNEL_IMAGETYPE', True)
> -if kerneltype == 'fitImage':
> +kerneltypes = d.getVar('KERNEL_IMAGETYPES', True) or ""
> +if 'fitImage' in kerneltypes.split():
>  depends = d.getVar("DEPENDS", True)
>  depends = "%s u-boot-mkimage-native dtc-native" % 

[OE-core] [PATCH v2 1/2] kernel: Add KERNEL_IMAGETYPES to build multi types kernel at one time

2016-02-19 Thread zhe.he
From: He Zhe 

Add KERNEL_IMAGETYPES to support building packaging and installing
multi types of kernel images, such as zImage uImage, at one time.

KERNEL_IMAGETYPE works as before. All KERNEL_ALT_IMAGETYPEs are
replaced by KERNEL_IMAGETYPES.

Fixes [YOCTO #6945].

Signed-off-by: He Zhe 
---
 documentation/ref-manual/ref-variables.xml |  10 +-
 meta-yocto-bsp/conf/machine/edgerouter.conf|   2 +-
 meta/classes/kernel-fitimage.bbclass   |  20 +--
 meta/classes/kernel-grub.bbclass   |  44 --
 meta/classes/kernel-uimage.bbclass |  22 +--
 meta/classes/kernel.bbclass| 171 +++--
 meta/conf/documentation.conf   |   1 +
 meta/conf/machine/qemumips.conf|   2 +-
 meta/conf/machine/qemumips64.conf  |   2 +-
 meta/recipes-kernel/linux/linux-dtb.inc|  49 +++---
 .../target/arch/mips/conf/machine/machine.conf |   2 +-
 .../target/arch/mips64/conf/machine/machine.conf   |   2 +-
 .../target/arch/qemu/conf/machine/machine.conf |   2 +-
 13 files changed, 214 insertions(+), 115 deletions(-)

diff --git a/documentation/ref-manual/ref-variables.xml 
b/documentation/ref-manual/ref-variables.xml
index a76a8c2..a8e4fd8 100644
--- a/documentation/ref-manual/ref-variables.xml
+++ b/documentation/ref-manual/ref-variables.xml
@@ -6417,14 +6417,14 @@ recipes-graphics/xorg-font/font-alias_1.0.3.bb:PR = 
"${INC_PR}.3"
 
 
 
-KERNEL_ALT_IMAGETYPE
+KERNEL_IMAGETYPES
 
-KERNEL_ALT_IMAGETYPE[doc] = "Specifies an alternate kernel 
image type for creation."
+KERNEL_IMAGETYPES[doc] = "Specifies alternate kernel image 
types for creation."
 
 
 
 
-Specifies an alternate kernel image type for creation in
+Specifies alternate kernel image types for creation in
 addition to the kernel image type specified using the
 KERNEL_IMAGETYPE
 variable.
@@ -6612,8 +6612,8 @@ recipes-graphics/xorg-font/font-alias_1.0.3.bb:PR = 
"${INC_PR}.3"
 
 
 
-If you want to build an alternate kernel image type, use 
the
-KERNEL_ALT_IMAGETYPE
+If you want to build alternate kernel image types, use the
+KERNEL_IMAGETYPES
 variable.
 
 
diff --git a/meta-yocto-bsp/conf/machine/edgerouter.conf 
b/meta-yocto-bsp/conf/machine/edgerouter.conf
index 476e690..affd568 100644
--- a/meta-yocto-bsp/conf/machine/edgerouter.conf
+++ b/meta-yocto-bsp/conf/machine/edgerouter.conf
@@ -7,7 +7,7 @@ require conf/machine/include/tune-mips64.inc
 MACHINE_FEATURES = "pci ext2 ext3 serial"
 
 KERNEL_IMAGETYPE = "vmlinux"
-KERNEL_ALT_IMAGETYPE = "vmlinux.bin"
+KERNEL_IMAGETYPES = "vmlinux.bin"
 KERNEL_IMAGE_STRIP_EXTRA_SECTIONS  = ".comment"
 
 PREFERRED_PROVIDER_virtual/kernel ?= "linux-yocto"
diff --git a/meta/classes/kernel-fitimage.bbclass 
b/meta/classes/kernel-fitimage.bbclass
index f1b409c..51df19d 100644
--- a/meta/classes/kernel-fitimage.bbclass
+++ b/meta/classes/kernel-fitimage.bbclass
@@ -1,8 +1,8 @@
 inherit kernel-uboot
 
 python __anonymous () {
-kerneltype = d.getVar('KERNEL_IMAGETYPE', True)
-if kerneltype == 'fitImage':
+kerneltypes = d.getVar('KERNEL_IMAGETYPES', True) or ""
+if 'fitImage' in kerneltypes.split():
 depends = d.getVar("DEPENDS", True)
 depends = "%s u-boot-mkimage-native dtc-native" % depends
 d.setVar("DEPENDS", depends)
@@ -10,7 +10,9 @@ python __anonymous () {
# Override KERNEL_IMAGETYPE_FOR_MAKE variable, which is internal
# to kernel.bbclass . We have to override it, since we pack zImage
# (at least for now) into the fitImage .
-d.setVar("KERNEL_IMAGETYPE_FOR_MAKE", "zImage")
+typeformake = d.getVar("KERNEL_IMAGETYPE_FOR_MAKE", True) or ""
+if 'fitImage' in typeformake.split():
+d.setVar('KERNEL_IMAGETYPE_FOR_MAKE', 
typeformake.replace('fitImage', 'zImage'))
 
 image = d.getVar('INITRAMFS_IMAGE', True)
 if image:
@@ -154,7 +156,7 @@ EOF
 }
 
 do_assemble_fitimage() {
-   if test "x${KERNEL_IMAGETYPE}" = "xfitImage" ; then
+   if echo ${KERNEL_IMAGETYPES} | grep -Pq "\bfitImage\b"; then
kernelcount=1
dtbcount=""
rm -f fit-image.its
@@ -217,14 +219,14 @@ addtask assemble_fitimage before do_install after 
do_compile
 
 kernel_do_deploy_append() {
# Update deploy directory
-   if test "x${KERNEL_IMAGETYPE}" = "xfitImage" ; then
+   if echo ${KERNEL_IMAGETYPES} | grep -Pq "\bfitImage\b"; then
cd ${B}
echo "Copying fit-image.its source file..."
-