[OE-core] [PATCH 1/1] uboot-sign.bbclass: fix signature and deployment

2018-11-29 Thread Robert Yang
Fixed:
MACHINE = "beaglebone-yocto"
KERNEL_CLASSES += "kernel-fitimage"
KERNEL_IMAGETYPE_beaglebone-yocto = "fitImage"
UBOOT_MACHINE_beaglebone-yocto = "am335x_boneblack_vboot_config"
UBOOT_MKIMAGE_DTCOPTS = "-I dts -O dtb -p 2000"
UBOOT_SIGN_KEYDIR = "${TOPDIR}/conf"
UBOOT_SIGN_KEYNAME = "dev"
UBOOT_SIGN_ENABLE = "1"
IMAGE_INSTALL_remove = "kernel-image-zimage"

$ cd conf
$ openssl genrsa -F4 -out dev.key 2048
$ openssl req -batch -new -x509 -key dev.key -out dev.crt
$ cd ../
$ bitbake u-boot linux-yocto
$ grep signature tmp/deploy/images/beaglebone-yocto/*.dtb
Binary file 
tmp/deploy/images/beaglebone-yocto/u-boot-beaglebone-yocto-2018.07-r0.dtb 
matches
Binary file tmp/deploy/images/beaglebone-yocto/u-boot-beaglebone-yocto.dtb 
matches
Binary file tmp/deploy/images/beaglebone-yocto/u-boot.dtb matches

And there would be no signature info when rebuild from sstate:
$ bitbake u-boot linux-yocto -cclean
$ bitbake u-boot linux-yocto
$ grep signature tmp/deploy/images/beaglebone-yocto/*.dtb
No result

This s because kernel directly edit ${DEPLOY_DIR_IMAGE}/u-boot.dtb, (Note, it
is global ${DEPLOY_DIR_IMAGE}, not recipe's DEPLOYDIR), so that the modified
info is not in sstate, and would be lost when rebuild from sstate.

There are other problems in previouse code:
- The u-boot.dtb is provided by u-boot, but edited by kernel during signing, so
  it should be deployed by kernel rather than u-boot.

- The u-boot.do_concat_dtb directly install files to global ${DEPLOY_DIR_IMAGE},
  this is incorrect, the ${DEPLOY_DIR_IMAGE} should be installed by do_deploy.

- It seems that it assumes do_deploy depends on do_install according the 
comments,
  but they have no relationships:
  # do_concat_dtb is scheduled _before_ do_install as it overwrite the
  # u-boot.bin in both DEPLOYDIR and DEPLOY_IMAGE_DIR.

- The do_concat_dtb should be run after do_compile, but it doesn't have this
  dependency.

Make u-boot install u-boot.dtb to ${datadir}, kernel copies u-boot.dtb from
${STAGING_DATADIR} to ${B} and deploy it can fix the problem.

[YOCTO #12112]

Reported-by: Christian Andersen 
Signed-off-by: Robert Yang 
---
 meta/classes/kernel-fitimage.bbclass | 17 ++-
 meta/classes/uboot-sign.bbclass  | 95 
 meta/recipes-bsp/u-boot/u-boot.inc   |  2 +-
 3 files changed, 69 insertions(+), 45 deletions(-)

diff --git a/meta/classes/kernel-fitimage.bbclass 
b/meta/classes/kernel-fitimage.bbclass
index 328bef4..5f6380f 100644
--- a/meta/classes/kernel-fitimage.bbclass
+++ b/meta/classes/kernel-fitimage.bbclass
@@ -35,7 +35,7 @@ python __anonymous () {
 # the fitImage:
 if d.getVar('UBOOT_SIGN_ENABLE') == "1":
 uboot_pn = d.getVar('PREFERRED_PROVIDER_u-boot') or 'u-boot'
-d.appendVarFlag('do_assemble_fitimage', 'depends', ' %s:do_deploy' 
% uboot_pn)
+d.appendVarFlag('do_assemble_fitimage', 'depends', ' 
%s:do_populate_sysroot' % uboot_pn)
 }
 
 # Options for the device tree compiler passed to mkimage '-D' feature:
@@ -456,10 +456,17 @@ fitimage_assemble() {
# Step 7: Sign the image and add public key to U-Boot dtb
#
if [ "x${UBOOT_SIGN_ENABLE}" = "x1" ] ; then
+   add_key_to_u_boot=""
+   if [ -n "${UBOOT_DTB_BINARY}" ]; then
+   # The u-boot.dtb is a symlink to UBOOT_DTB_IMAGE, so we 
need copy
+   # both of them, and don't dereference the symlink.
+   cp -P ${STAGING_DATADIR}/u-boot*.dtb ${B}
+   add_key_to_u_boot="-K ${B}/${UBOOT_DTB_BINARY}"
+   fi
uboot-mkimage \
${@'-D "${UBOOT_MKIMAGE_DTCOPTS}"' if 
len('${UBOOT_MKIMAGE_DTCOPTS}') else ''} \
-F -k "${UBOOT_SIGN_KEYDIR}" \
-   ${@'-K "${DEPLOY_DIR_IMAGE}/${UBOOT_DTB_BINARY}"' if 
len('${UBOOT_DTB_BINARY}') else ''} \
+   $add_key_to_u_boot \
-r arch/${ARCH}/boot/${2}
fi
 }
@@ -505,5 +512,11 @@ kernel_do_deploy_append() {
install -m 0644 
${B}/arch/${ARCH}/boot/fitImage-${INITRAMFS_IMAGE} 
${DEPLOYDIR}/fitImage-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_NAME}.bin
ln -snf 
fitImage-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_NAME}.bin 
${DEPLOYDIR}/fitImage-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_LINK_NAME}
fi
+   if [ "${UBOOT_SIGN_ENABLE}" = "1" -a -n "${UBOOT_DTB_BINARY}" ] 
; then
+   # UBOOT_DTB_IMAGE is a realfile, but we can't use
+   # ${UBOOT_DTB_IMAGE} since it contains ${PV} which is 
aimed
+   # for u-boot, but we are in kernel env now.
+   install -m 0644 ${B}/u-boot-${MACHINE}*.dtb 
${DEPLOYDIR}/
+   fi
fi
 }
diff --git a/meta/classes/uboot-sign.bbclass b/meta/classes/uboot-sign.bbclass
index afaf46f..03100b8 100644
--- 

Re: [OE-core] [PATCH 1/1] uboot-sign.bbclass: fix signature and deployment

2018-11-29 Thread Robert Yang

Hi Ross,

On 11/29/18 9:15 PM, Burton, Ross wrote:

This didn't get merged before other pieces did, so can you please
rebase and resend?


Thanks, I will rebase to master-next and resend. BTW, the Christian Andersen
(the reporter) has replied that the patch works for him:

https://bugzilla.yoctoproject.org/show_bug.cgi?id=12112

// Robert



Ross
On Thu, 22 Nov 2018 at 01:43, Robert Yang  wrote:




On 11/22/18 1:20 AM, Otavio Salvador wrote:

Hello,

On Wed, Nov 21, 2018 at 4:08 AM Robert Yang  wrote:


Fixed:
MACHINE = "beaglebone-yocto"
KERNEL_CLASSES += "kernel-fitimage"
KERNEL_IMAGETYPE_beaglebone-yocto = "fitImage"
UBOOT_MACHINE_beaglebone-yocto = "am335x_boneblack_vboot_config"
UBOOT_MKIMAGE_DTCOPTS = "-I dts -O dtb -p 2000"
UBOOT_SIGN_KEYDIR = "${TOPDIR}/conf"
UBOOT_SIGN_KEYNAME = "dev"
UBOOT_SIGN_ENABLE = "1"
IMAGE_INSTALL_remove = "kernel-image-zimage"

$ cd conf
$ openssl genrsa -F4 -out dev.key 2048
$ openssl req -batch -new -x509 -key dev.key -out dev.crt
$ cd ../
$ bitbake u-boot linux-yocto
$ grep signature tmp/deploy/images/beaglebone-yocto/*.dtb
Binary file 
tmp/deploy/images/beaglebone-yocto/u-boot-beaglebone-yocto-2018.07-r0.dtb 
matches
Binary file tmp/deploy/images/beaglebone-yocto/u-boot-beaglebone-yocto.dtb 
matches
Binary file tmp/deploy/images/beaglebone-yocto/u-boot.dtb matches

And there would be no signature info when rebuild from sstate:
$ bitbake u-boot linux-yocto -cclean
$ bitbake u-boot linux-yocto
$ grep signature tmp/deploy/images/beaglebone-yocto/*.dtb
No result

This s because kernel directly edit ${DEPLOY_DIR_IMAGE}/u-boot.dtb, (Note, it
is global ${DEPLOY_DIR_IMAGE}, not recipe's DEPLOYDIR), so that the modified
info is not in sstate, and would be lost when rebuild from sstate.

There are other problems in previouse code:
- The u-boot.dtb is provided by u-boot, but edited by kernel during signing, so
it should be deployed by kernel rather than u-boot.

- The u-boot.do_concat_dtb directly install files to global ${DEPLOY_DIR_IMAGE},
this is incorrect, the ${DEPLOY_DIR_IMAGE} should be installed by do_deploy.

- It seems that it assumes do_deploy depends on do_install according the 
comments,
but they have no relationships:
# do_concat_dtb is scheduled _before_ do_install as it overwrite the
# u-boot.bin in both DEPLOYDIR and DEPLOY_IMAGE_DIR.

- The do_concat_dtb should be run after do_compile, but it doesn't have this
dependency.

Make u-boot install u-boot.dtb to ${datadir}, kernel copies u-boot.dtb from
${STAGING_DATADIR} to ${B} and deploy it can fix the problem.

[YOCTO #12112]

Reported-by: Christian Andersen 
Signed-off-by: Robert Yang 


The change itself looks good, I noticed that the script part is not
using 4 spaces for indenting and as this is being changed, it might
make sense to address this as well.


Thanks, sounds good to me, I will make another patch for it after this is 
merged.

// Robert



Acked-by: Otavio Salvador 


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



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


Re: [OE-core] [PATCH 1/1] uboot-sign.bbclass: fix signature and deployment

2018-11-29 Thread Burton, Ross
This didn't get merged before other pieces did, so can you please
rebase and resend?

Ross
On Thu, 22 Nov 2018 at 01:43, Robert Yang  wrote:
>
>
>
> On 11/22/18 1:20 AM, Otavio Salvador wrote:
> > Hello,
> >
> > On Wed, Nov 21, 2018 at 4:08 AM Robert Yang  
> > wrote:
> >>
> >> Fixed:
> >> MACHINE = "beaglebone-yocto"
> >> KERNEL_CLASSES += "kernel-fitimage"
> >> KERNEL_IMAGETYPE_beaglebone-yocto = "fitImage"
> >> UBOOT_MACHINE_beaglebone-yocto = "am335x_boneblack_vboot_config"
> >> UBOOT_MKIMAGE_DTCOPTS = "-I dts -O dtb -p 2000"
> >> UBOOT_SIGN_KEYDIR = "${TOPDIR}/conf"
> >> UBOOT_SIGN_KEYNAME = "dev"
> >> UBOOT_SIGN_ENABLE = "1"
> >> IMAGE_INSTALL_remove = "kernel-image-zimage"
> >>
> >> $ cd conf
> >> $ openssl genrsa -F4 -out dev.key 2048
> >> $ openssl req -batch -new -x509 -key dev.key -out dev.crt
> >> $ cd ../
> >> $ bitbake u-boot linux-yocto
> >> $ grep signature tmp/deploy/images/beaglebone-yocto/*.dtb
> >> Binary file 
> >> tmp/deploy/images/beaglebone-yocto/u-boot-beaglebone-yocto-2018.07-r0.dtb 
> >> matches
> >> Binary file tmp/deploy/images/beaglebone-yocto/u-boot-beaglebone-yocto.dtb 
> >> matches
> >> Binary file tmp/deploy/images/beaglebone-yocto/u-boot.dtb matches
> >>
> >> And there would be no signature info when rebuild from sstate:
> >> $ bitbake u-boot linux-yocto -cclean
> >> $ bitbake u-boot linux-yocto
> >> $ grep signature tmp/deploy/images/beaglebone-yocto/*.dtb
> >> No result
> >>
> >> This s because kernel directly edit ${DEPLOY_DIR_IMAGE}/u-boot.dtb, (Note, 
> >> it
> >> is global ${DEPLOY_DIR_IMAGE}, not recipe's DEPLOYDIR), so that the 
> >> modified
> >> info is not in sstate, and would be lost when rebuild from sstate.
> >>
> >> There are other problems in previouse code:
> >> - The u-boot.dtb is provided by u-boot, but edited by kernel during 
> >> signing, so
> >>it should be deployed by kernel rather than u-boot.
> >>
> >> - The u-boot.do_concat_dtb directly install files to global 
> >> ${DEPLOY_DIR_IMAGE},
> >>this is incorrect, the ${DEPLOY_DIR_IMAGE} should be installed by 
> >> do_deploy.
> >>
> >> - It seems that it assumes do_deploy depends on do_install according the 
> >> comments,
> >>but they have no relationships:
> >># do_concat_dtb is scheduled _before_ do_install as it overwrite the
> >># u-boot.bin in both DEPLOYDIR and DEPLOY_IMAGE_DIR.
> >>
> >> - The do_concat_dtb should be run after do_compile, but it doesn't have 
> >> this
> >>dependency.
> >>
> >> Make u-boot install u-boot.dtb to ${datadir}, kernel copies u-boot.dtb from
> >> ${STAGING_DATADIR} to ${B} and deploy it can fix the problem.
> >>
> >> [YOCTO #12112]
> >>
> >> Reported-by: Christian Andersen 
> >> Signed-off-by: Robert Yang 
> >
> > The change itself looks good, I noticed that the script part is not
> > using 4 spaces for indenting and as this is being changed, it might
> > make sense to address this as well.
>
> Thanks, sounds good to me, I will make another patch for it after this is 
> merged.
>
> // Robert
>
> >
> > Acked-by: Otavio Salvador 
> >
> --
> ___
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH 1/1] uboot-sign.bbclass: fix signature and deployment

2018-11-21 Thread Robert Yang




On 11/22/18 1:20 AM, Otavio Salvador wrote:

Hello,

On Wed, Nov 21, 2018 at 4:08 AM Robert Yang  wrote:


Fixed:
MACHINE = "beaglebone-yocto"
KERNEL_CLASSES += "kernel-fitimage"
KERNEL_IMAGETYPE_beaglebone-yocto = "fitImage"
UBOOT_MACHINE_beaglebone-yocto = "am335x_boneblack_vboot_config"
UBOOT_MKIMAGE_DTCOPTS = "-I dts -O dtb -p 2000"
UBOOT_SIGN_KEYDIR = "${TOPDIR}/conf"
UBOOT_SIGN_KEYNAME = "dev"
UBOOT_SIGN_ENABLE = "1"
IMAGE_INSTALL_remove = "kernel-image-zimage"

$ cd conf
$ openssl genrsa -F4 -out dev.key 2048
$ openssl req -batch -new -x509 -key dev.key -out dev.crt
$ cd ../
$ bitbake u-boot linux-yocto
$ grep signature tmp/deploy/images/beaglebone-yocto/*.dtb
Binary file 
tmp/deploy/images/beaglebone-yocto/u-boot-beaglebone-yocto-2018.07-r0.dtb 
matches
Binary file tmp/deploy/images/beaglebone-yocto/u-boot-beaglebone-yocto.dtb 
matches
Binary file tmp/deploy/images/beaglebone-yocto/u-boot.dtb matches

And there would be no signature info when rebuild from sstate:
$ bitbake u-boot linux-yocto -cclean
$ bitbake u-boot linux-yocto
$ grep signature tmp/deploy/images/beaglebone-yocto/*.dtb
No result

This s because kernel directly edit ${DEPLOY_DIR_IMAGE}/u-boot.dtb, (Note, it
is global ${DEPLOY_DIR_IMAGE}, not recipe's DEPLOYDIR), so that the modified
info is not in sstate, and would be lost when rebuild from sstate.

There are other problems in previouse code:
- The u-boot.dtb is provided by u-boot, but edited by kernel during signing, so
   it should be deployed by kernel rather than u-boot.

- The u-boot.do_concat_dtb directly install files to global ${DEPLOY_DIR_IMAGE},
   this is incorrect, the ${DEPLOY_DIR_IMAGE} should be installed by do_deploy.

- It seems that it assumes do_deploy depends on do_install according the 
comments,
   but they have no relationships:
   # do_concat_dtb is scheduled _before_ do_install as it overwrite the
   # u-boot.bin in both DEPLOYDIR and DEPLOY_IMAGE_DIR.

- The do_concat_dtb should be run after do_compile, but it doesn't have this
   dependency.

Make u-boot install u-boot.dtb to ${datadir}, kernel copies u-boot.dtb from
${STAGING_DATADIR} to ${B} and deploy it can fix the problem.

[YOCTO #12112]

Reported-by: Christian Andersen 
Signed-off-by: Robert Yang 


The change itself looks good, I noticed that the script part is not
using 4 spaces for indenting and as this is being changed, it might
make sense to address this as well.


Thanks, sounds good to me, I will make another patch for it after this is 
merged.

// Robert



Acked-by: Otavio Salvador 


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


Re: [OE-core] [PATCH 1/1] uboot-sign.bbclass: fix signature and deployment

2018-11-21 Thread Otavio Salvador
Hello,

On Wed, Nov 21, 2018 at 4:08 AM Robert Yang  wrote:
>
> Fixed:
> MACHINE = "beaglebone-yocto"
> KERNEL_CLASSES += "kernel-fitimage"
> KERNEL_IMAGETYPE_beaglebone-yocto = "fitImage"
> UBOOT_MACHINE_beaglebone-yocto = "am335x_boneblack_vboot_config"
> UBOOT_MKIMAGE_DTCOPTS = "-I dts -O dtb -p 2000"
> UBOOT_SIGN_KEYDIR = "${TOPDIR}/conf"
> UBOOT_SIGN_KEYNAME = "dev"
> UBOOT_SIGN_ENABLE = "1"
> IMAGE_INSTALL_remove = "kernel-image-zimage"
>
> $ cd conf
> $ openssl genrsa -F4 -out dev.key 2048
> $ openssl req -batch -new -x509 -key dev.key -out dev.crt
> $ cd ../
> $ bitbake u-boot linux-yocto
> $ grep signature tmp/deploy/images/beaglebone-yocto/*.dtb
> Binary file 
> tmp/deploy/images/beaglebone-yocto/u-boot-beaglebone-yocto-2018.07-r0.dtb 
> matches
> Binary file tmp/deploy/images/beaglebone-yocto/u-boot-beaglebone-yocto.dtb 
> matches
> Binary file tmp/deploy/images/beaglebone-yocto/u-boot.dtb matches
>
> And there would be no signature info when rebuild from sstate:
> $ bitbake u-boot linux-yocto -cclean
> $ bitbake u-boot linux-yocto
> $ grep signature tmp/deploy/images/beaglebone-yocto/*.dtb
> No result
>
> This s because kernel directly edit ${DEPLOY_DIR_IMAGE}/u-boot.dtb, (Note, it
> is global ${DEPLOY_DIR_IMAGE}, not recipe's DEPLOYDIR), so that the modified
> info is not in sstate, and would be lost when rebuild from sstate.
>
> There are other problems in previouse code:
> - The u-boot.dtb is provided by u-boot, but edited by kernel during signing, 
> so
>   it should be deployed by kernel rather than u-boot.
>
> - The u-boot.do_concat_dtb directly install files to global 
> ${DEPLOY_DIR_IMAGE},
>   this is incorrect, the ${DEPLOY_DIR_IMAGE} should be installed by do_deploy.
>
> - It seems that it assumes do_deploy depends on do_install according the 
> comments,
>   but they have no relationships:
>   # do_concat_dtb is scheduled _before_ do_install as it overwrite the
>   # u-boot.bin in both DEPLOYDIR and DEPLOY_IMAGE_DIR.
>
> - The do_concat_dtb should be run after do_compile, but it doesn't have this
>   dependency.
>
> Make u-boot install u-boot.dtb to ${datadir}, kernel copies u-boot.dtb from
> ${STAGING_DATADIR} to ${B} and deploy it can fix the problem.
>
> [YOCTO #12112]
>
> Reported-by: Christian Andersen 
> Signed-off-by: Robert Yang 

The change itself looks good, I noticed that the script part is not
using 4 spaces for indenting and as this is being changed, it might
make sense to address this as well.

Acked-by: Otavio Salvador 

-- 
Otavio Salvador O.S. Systems
http://www.ossystems.com.brhttp://code.ossystems.com.br
Mobile: +55 (53) 9 9981-7854  Mobile: +1 (347) 903-9750
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 1/1] uboot-sign.bbclass: fix signature and deployment

2018-11-20 Thread Robert Yang
Fixed:
MACHINE = "beaglebone-yocto"
KERNEL_CLASSES += "kernel-fitimage"
KERNEL_IMAGETYPE_beaglebone-yocto = "fitImage"
UBOOT_MACHINE_beaglebone-yocto = "am335x_boneblack_vboot_config"
UBOOT_MKIMAGE_DTCOPTS = "-I dts -O dtb -p 2000"
UBOOT_SIGN_KEYDIR = "${TOPDIR}/conf"
UBOOT_SIGN_KEYNAME = "dev"
UBOOT_SIGN_ENABLE = "1"
IMAGE_INSTALL_remove = "kernel-image-zimage"

$ cd conf
$ openssl genrsa -F4 -out dev.key 2048
$ openssl req -batch -new -x509 -key dev.key -out dev.crt
$ cd ../
$ bitbake u-boot linux-yocto
$ grep signature tmp/deploy/images/beaglebone-yocto/*.dtb
Binary file 
tmp/deploy/images/beaglebone-yocto/u-boot-beaglebone-yocto-2018.07-r0.dtb 
matches
Binary file tmp/deploy/images/beaglebone-yocto/u-boot-beaglebone-yocto.dtb 
matches
Binary file tmp/deploy/images/beaglebone-yocto/u-boot.dtb matches

And there would be no signature info when rebuild from sstate:
$ bitbake u-boot linux-yocto -cclean
$ bitbake u-boot linux-yocto
$ grep signature tmp/deploy/images/beaglebone-yocto/*.dtb
No result

This s because kernel directly edit ${DEPLOY_DIR_IMAGE}/u-boot.dtb, (Note, it
is global ${DEPLOY_DIR_IMAGE}, not recipe's DEPLOYDIR), so that the modified
info is not in sstate, and would be lost when rebuild from sstate.

There are other problems in previouse code:
- The u-boot.dtb is provided by u-boot, but edited by kernel during signing, so
  it should be deployed by kernel rather than u-boot.

- The u-boot.do_concat_dtb directly install files to global ${DEPLOY_DIR_IMAGE},
  this is incorrect, the ${DEPLOY_DIR_IMAGE} should be installed by do_deploy.

- It seems that it assumes do_deploy depends on do_install according the 
comments,
  but they have no relationships:
  # do_concat_dtb is scheduled _before_ do_install as it overwrite the
  # u-boot.bin in both DEPLOYDIR and DEPLOY_IMAGE_DIR.

- The do_concat_dtb should be run after do_compile, but it doesn't have this
  dependency.

Make u-boot install u-boot.dtb to ${datadir}, kernel copies u-boot.dtb from
${STAGING_DATADIR} to ${B} and deploy it can fix the problem.

[YOCTO #12112]

Reported-by: Christian Andersen 
Signed-off-by: Robert Yang 
---
 meta/classes/kernel-fitimage.bbclass | 17 ++-
 meta/classes/uboot-sign.bbclass  | 95 
 meta/recipes-bsp/u-boot/u-boot.inc   |  2 +-
 3 files changed, 69 insertions(+), 45 deletions(-)

diff --git a/meta/classes/kernel-fitimage.bbclass 
b/meta/classes/kernel-fitimage.bbclass
index 4c4fd99..7c5bcd0 100644
--- a/meta/classes/kernel-fitimage.bbclass
+++ b/meta/classes/kernel-fitimage.bbclass
@@ -35,7 +35,7 @@ python __anonymous () {
 # the fitImage:
 if d.getVar('UBOOT_SIGN_ENABLE') == "1":
 uboot_pn = d.getVar('PREFERRED_PROVIDER_u-boot') or 'u-boot'
-d.appendVarFlag('do_assemble_fitimage', 'depends', ' %s:do_deploy' 
% uboot_pn)
+d.appendVarFlag('do_assemble_fitimage', 'depends', ' 
%s:do_populate_sysroot' % uboot_pn)
 }
 
 # Options for the device tree compiler passed to mkimage '-D' feature:
@@ -456,10 +456,17 @@ fitimage_assemble() {
# Step 7: Sign the image and add public key to U-Boot dtb
#
if [ "x${UBOOT_SIGN_ENABLE}" = "x1" ] ; then
+   add_key_to_u_boot=""
+   if [ -n "${UBOOT_DTB_BINARY}" ]; then
+   # The u-boot.dtb is a symlink to UBOOT_DTB_IMAGE, so we 
need copy
+   # both of them, and don't dereference the symlink.
+   cp -P ${STAGING_DATADIR}/u-boot*.dtb ${B}
+   add_key_to_u_boot="-K ${B}/${UBOOT_DTB_BINARY}"
+   fi
uboot-mkimage \
${@'-D "${UBOOT_MKIMAGE_DTCOPTS}"' if 
len('${UBOOT_MKIMAGE_DTCOPTS}') else ''} \
-F -k "${UBOOT_SIGN_KEYDIR}" \
-   ${@'-K "${DEPLOY_DIR_IMAGE}/${UBOOT_DTB_BINARY}"' if 
len('${UBOOT_DTB_BINARY}') else ''} \
+   $add_key_to_u_boot \
-r arch/${ARCH}/boot/${2}
fi
 }
@@ -505,5 +512,11 @@ kernel_do_deploy_append() {
install -m 0644 
${B}/arch/${ARCH}/boot/fitImage-${INITRAMFS_IMAGE} 
${DEPLOYDIR}/fitImage-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_NAME}.bin
ln -snf 
fitImage-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_NAME}.bin 
${DEPLOYDIR}/fitImage-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_LINK_NAME}
fi
+   if [ "${UBOOT_SIGN_ENABLE}" = "1" -a -n "${UBOOT_DTB_BINARY}" ] 
; then
+   # UBOOT_DTB_IMAGE is a realfile, but we can't use
+   # ${UBOOT_DTB_IMAGE} since it contains ${PV} which is 
aimed
+   # for u-boot, but we are in kernel env now.
+   install -m 0644 ${B}/u-boot-${MACHINE}*.dtb 
${DEPLOYDIR}/
+   fi
fi
 }
diff --git a/meta/classes/uboot-sign.bbclass b/meta/classes/uboot-sign.bbclass
index 8ee904e..0e5e1b1 100644
---