> Op 19 okt. 2014, om 21:15 heeft Marek Vasut <ma...@denx.de> het volgende 
> geschreven:
> 
> Pull the uImage image format generation from kernel.bbclass into
> a separate kernel-uimage.bbclass. The recipes which now need to
> generate an uImage will have to inherit kernel-uimage instead of
> kernel class.

To keep backward compatibility, could you rework this into something like:

kernel.bbclass:
        inherit kernel-${KERNEL_IMAGETYPE}

kernel-${KERNEL_IMAGETYPE}:
        inherit kernel-base
        imagetype stuff

kernel-base:
        old kernel.bbclass stuff

That would keep existing BSPs working *and* split out the image types.

regards,

Koen

> 
> Signed-off-by: Marek Vasut <ma...@denx.de>
> Cc: Richard Purdie <richard.pur...@linuxfoundation.org>
> Cc: Koen Kooi <k...@dominion.thruhere.net>
> Cc: Paul Eggleton <paul.eggle...@linux.intel.com>
> ---
> meta/classes/kernel-uimage.bbclass | 44 +++++++++++++++++++++++++++++++++++++
> meta/classes/kernel.bbclass        | 45 --------------------------------------
> 2 files changed, 44 insertions(+), 45 deletions(-)
> create mode 100644 meta/classes/kernel-uimage.bbclass
> 
> diff --git a/meta/classes/kernel-uimage.bbclass 
> b/meta/classes/kernel-uimage.bbclass
> new file mode 100644
> index 0000000..f51321b
> --- /dev/null
> +++ b/meta/classes/kernel-uimage.bbclass
> @@ -0,0 +1,44 @@
> +inherit kernel
> +
> +DEPENDS += " u-boot-mkimage-native "
> +
> +uboot_prep_kimage() {
> +     if test -e arch/${ARCH}/boot/compressed/vmlinux ; then
> +             vmlinux_path="arch/${ARCH}/boot/compressed/vmlinux"
> +             linux_suffix=""
> +             linux_comp="none"
> +     else
> +             vmlinux_path="vmlinux"
> +             linux_suffix=".gz"
> +             linux_comp="gzip"
> +     fi
> +
> +     ${OBJCOPY} -O binary -R .note -R .comment -S "${vmlinux_path}" linux.bin
> +
> +     if [ "${linux_comp}" != "none" ] ; then
> +             rm -f linux.bin
> +             gzip -9 linux.bin
> +             mv -f "linux.bin${linux_suffix}" linux.bin
> +     fi
> +
> +     echo "${linux_comp}"
> +}
> +
> +do_uboot_mkimage() {
> +     if test "x${KERNEL_IMAGETYPE}" = "xuImage" ; then
> +             if test "x${KEEPUIMAGE}" != "xyes" ; then
> +                     uboot_prep_kimage
> +
> +                     ENTRYPOINT=${UBOOT_ENTRYPOINT}
> +                     if test -n "${UBOOT_ENTRYSYMBOL}"; then
> +                             ENTRYPOINT=`${HOST_PREFIX}nm ${S}/vmlinux | \
> +                                     awk '$3=="${UBOOT_ENTRYSYMBOL}" {print 
> $1}'`
> +                     fi
> +
> +                     uboot-mkimage -A ${UBOOT_ARCH} -O linux -T kernel -C 
> "${linux_comp}" -a ${UBOOT_LOADADDRESS} -e $ENTRYPOINT -n 
> "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin arch/${ARCH}/boot/uImage
> +                     rm -f linux.bin
> +             fi
> +     fi
> +}
> +
> +addtask uboot_mkimage before do_install after do_compile
> diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
> index ec4d930..f3ba19c 100644
> --- a/meta/classes/kernel.bbclass
> +++ b/meta/classes/kernel.bbclass
> @@ -15,10 +15,6 @@ python __anonymous () {
>     import re
> 
>     kerneltype = d.getVar('KERNEL_IMAGETYPE', True)
> -    if kerneltype == 'uImage':
> -        depends = d.getVar("DEPENDS", True)
> -        depends = "%s u-boot-mkimage-native" % depends
> -        d.setVar("DEPENDS", depends)
> 
>     d.setVar("KERNEL_IMAGETYPE_FOR_MAKE", re.sub(r'\.[^\.]$', '', kerneltype))
> 
> @@ -448,47 +444,6 @@ MODULE_TARBALL_BASE_NAME ?= 
> "${MODULE_IMAGE_BASE_NAME}.tgz"
> MODULE_TARBALL_SYMLINK_NAME ?= "modules-${MACHINE}.tgz"
> MODULE_TARBALL_DEPLOY ?= "1"
> 
> -uboot_prep_kimage() {
> -     if test -e arch/${ARCH}/boot/compressed/vmlinux ; then
> -             vmlinux_path="arch/${ARCH}/boot/compressed/vmlinux"
> -             linux_suffix=""
> -             linux_comp="none"
> -     else
> -             vmlinux_path="vmlinux"
> -             linux_suffix=".gz"
> -             linux_comp="gzip"
> -     fi
> -
> -     ${OBJCOPY} -O binary -R .note -R .comment -S "${vmlinux_path}" linux.bin
> -
> -     if [ "${linux_comp}" != "none" ] ; then
> -             rm -f linux.bin
> -             gzip -9 linux.bin
> -             mv -f "linux.bin${linux_suffix}" linux.bin
> -     fi
> -
> -     echo "${linux_comp}"
> -}
> -
> -do_uboot_mkimage() {
> -     if test "x${KERNEL_IMAGETYPE}" = "xuImage" ; then 
> -             if test "x${KEEPUIMAGE}" != "xyes" ; then
> -                     uboot_prep_kimage
> -
> -                     ENTRYPOINT=${UBOOT_ENTRYPOINT}
> -                     if test -n "${UBOOT_ENTRYSYMBOL}"; then
> -                             ENTRYPOINT=`${HOST_PREFIX}nm ${S}/vmlinux | \
> -                                     awk '$3=="${UBOOT_ENTRYSYMBOL}" {print 
> $1}'`
> -                     fi
> -
> -                     uboot-mkimage -A ${UBOOT_ARCH} -O linux -T kernel -C 
> "${linux_comp}" -a ${UBOOT_LOADADDRESS} -e $ENTRYPOINT -n 
> "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin arch/${ARCH}/boot/uImage
> -                     rm -f linux.bin
> -             fi
> -     fi
> -}
> -
> -addtask uboot_mkimage before do_install after do_compile
> -
> kernel_do_deploy() {
>       install -m 0644 ${KERNEL_OUTPUT} 
> ${DEPLOYDIR}/${KERNEL_IMAGE_BASE_NAME}.bin
>       if [ ${MODULE_TARBALL_DEPLOY} = "1" ] && (grep -q -i -e 
> '^CONFIG_MODULES=y$' .config); then
> -- 
> 2.1.1
> 
> 

-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Reply via email to