Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id F3BD5E00B18; Fri, 16 Jun 2017 11:29:43 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on yocto-www.yoctoproject.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,T_REMOTE_IMAGE autolearn=ham version=3.3.1 X-Spam-HAM-Report: * -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no * trust * [46.105.79.46 listed in list.dnswl.org] * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * 0.0 HTML_MESSAGE BODY: HTML included in message * 0.0 T_REMOTE_IMAGE Message contains an external image X-Greylist: delayed 4513 seconds by postgrey-1.32 at yocto-www; Fri, 16 Jun 2017 11:29:41 PDT Received: from 10.mo179.mail-out.ovh.net (10.mo179.mail-out.ovh.net [46.105.79.46]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id C06B8E009A0 for ; Fri, 16 Jun 2017 11:29:41 -0700 (PDT) Received: from player729.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo179.mail-out.ovh.net (Postfix) with ESMTP id 1E0E34D183 for ; Fri, 16 Jun 2017 19:14:27 +0200 (CEST) Received: from [192.168.0.165] (LMontsouris-657-1-193-111.w90-63.abo.wanadoo.fr [90.63.225.111]) (Authenticated sender: romain.bazile@ubiant.com) by player729.ha.ovh.net (Postfix) with ESMTPSA id DF1BC5E007D; Fri, 16 Jun 2017 19:14:25 +0200 (CEST) To: Otavio Salvador References: <344293d3-6ec9-cbf1-190b-b4954a4dc7cf@ubiant.com> From: Romain Bazile Organization: Ubiant Message-ID: <80f3546b-a372-4865-39f8-5deb013dd400@ubiant.com> Date: Fri, 16 Jun 2017 19:14:25 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: X-Ovh-Tracer-Id: 1293377519016303513 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeeljedrjeelgdduuddvucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddm Cc: "meta-freescale@yoctoproject.org" Subject: Re: u-boot-fslc: migration from morty to pyro with a signed image using CST X-BeenThere: meta-freescale@yoctoproject.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Usage and development list for the meta-fsl-* layers List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jun 2017 18:29:44 -0000 Content-Type: multipart/alternative; boundary="------------6CC130A6253FE6EAC2ABBEF7" Content-Language: fr-FR --------------6CC130A6253FE6EAC2ABBEF7 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Here is the bbappend for u-boot. SRC_URI += "\ file://0001-Add-MMC-boot-support.patch \ file://0002-Add-MT41K128M16JT-125K-support.patch \ file://0003-Remove-video-support.patch \ file://0004-Ethernet-Use-ENET1.patch \ file://0005-Rename-DTB-file-used-to-imx6ul-aveli.dtb.patch \ file://0006-Add-PMIC-pf3001-support.patch \ file://0007-Disable-I2C2.patch \ file://0008-Add-USB-support-force-port-0-in-host-mode.patch \ file://0009-Only-use-default-env-var-and-import-bootpart-from-sd.patch \ file://0010-Add-bootcount-support.patch \ file://0011-hab-auth-zimage.patch \ file://0012-Load-uImage-and-DTB-present-at-mmc-address.patch \ file://0013-Verify-DTB-signature.patch \ file://0014-Add-active-passive-kernel-dtb-support.patch \ file://0016-Enable-watchdog.patch \ " FILESEXTRAPATHS_append := "${THISDIR}/${PN}" UBOOT_MAKE_TARGET = "" UBOOT_BINARY = "u-boot-ivt.img" addtask sign_uboot before do_build after do_deploy do_sign_uboot () { if [ -e ${CST_ROOT}/crts/CSF1_1_sha256_2048_65537_v3_usr_crt.pem ] ; then cd ${CST_ROOT} bash mkfinalimage.sh ${CST_ROOT} ${DEPLOYDIR} ${DEPLOY_DIR_IMAGE} ${SPL_BINARYNAME} ${UBOOT_IMAGE} else if [ ! -d ${CST_ROOT} ] ; then bberror "The CST Tool at path ${CST_ROOT} doesn't exist" fi bberror "The CST keys are not created yet" fi } mkfinalimage.sh creates the signed copy of SPL and u-boot.img using the Code Signing Tool from NXP. I switched the UBOOT_BINARY variable to "u-boot-ivt.img" and u-boot compiled well. However even if it boots for now, I'll have to test the signature check. What I meant with my question was that I don't know if my do_sign task is redundant with compiling u-boot with the SECURE_BOOT activated (which would sign the image no?). Sincerely, Romain Bazile /Hardware R&D Engineer/ www.ubiant.com Le 16/06/2017 à 17:04, Otavio Salvador a écrit : > On Wed, Jun 14, 2017 at 1:45 PM, Romain Bazile wrote: > ... >> We have in our bbappend a custom task, `sign_uboot`. This task uses the IMX >> Code Signing Tool distributed by NXP to sign `u-boot.img` . >> >> >> During the migration, I had a compilation problem. Basically, the build >> system would complain that authenticate_image was an undefined reference. >> When having a look at u-boot code, it seemed normal since it was not built >> in the absence of `CONFIG_SECURE_BOOT`. >> I added a patchfile changing this in `mx6ul_14x14_defconfig`, but now, a >> different problem appears. >> >> Basically, the do_compile task is failing when it tries to copy `u-boot.img` >> (as defined in my bbappend `UBOOT_BINARY`). This is "normal", since this >> file is not in the filesystem, and likely not built. However, I do have a >> `u-boot-ivt.img` (but this file is supposed to be created at a later stage >> by the task `sign_uboot`). >> >> Also, just before, a couple of errors appears, where a script complains >> about `bc` and `comm` not being found, except they are installed in the >> build machine. This may not be related and not have consequences, I believe >> this could be linked to the per-recipe sysroot. >> >> >> Sorry for the long post, I can also share the details if needed (the task >> `sign_uboot` and the scripts used to sign). >> >> My questions are as follows: >> Do I still need to use this custom script if I use `CONFIG_SECURE_BOOT`? >> How can I insure that u-boot-fslc will be correctly built? > Please share the patch so we can look how it is done... > > --------------6CC130A6253FE6EAC2ABBEF7 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit

Here is the bbappend for u-boot.

SRC_URI += "\
    file://0001-Add-MMC-boot-support.patch \
    file://0002-Add-MT41K128M16JT-125K-support.patch \
    file://0003-Remove-video-support.patch \
    file://0004-Ethernet-Use-ENET1.patch \
    file://0005-Rename-DTB-file-used-to-imx6ul-aveli.dtb.patch \
    file://0006-Add-PMIC-pf3001-support.patch \
    file://0007-Disable-I2C2.patch \
    file://0008-Add-USB-support-force-port-0-in-host-mode.patch \
    file://0009-Only-use-default-env-var-and-import-bootpart-from-sd.patch \
    file://0010-Add-bootcount-support.patch \
    file://0011-hab-auth-zimage.patch \
    file://0012-Load-uImage-and-DTB-present-at-mmc-address.patch \
    file://0013-Verify-DTB-signature.patch \
    file://0014-Add-active-passive-kernel-dtb-support.patch \
    file://0016-Enable-watchdog.patch \
"

FILESEXTRAPATHS_append := "${THISDIR}/${PN}"
UBOOT_MAKE_TARGET = ""
UBOOT_BINARY = "u-boot-ivt.img"
addtask sign_uboot before do_build after do_deploy
do_sign_uboot () {
    if [ -e ${CST_ROOT}/crts/CSF1_1_sha256_2048_65537_v3_usr_crt.pem ] ; then
        cd ${CST_ROOT}
            bash mkfinalimage.sh ${CST_ROOT} ${DEPLOYDIR} ${DEPLOY_DIR_IMAGE} ${SPL_BINARYNAME} ${UBOOT_IMAGE}
    else
        if [ ! -d ${CST_ROOT} ] ; then
            bberror "The CST Tool at path ${CST_ROOT} doesn't exist"
        fi
        bberror "The CST keys are not created yet"
    fi
}

mkfinalimage.sh creates the signed copy of SPL and u-boot.img using the Code Signing Tool from NXP.

I switched the UBOOT_BINARY variable to "u-boot-ivt.img" and u-boot compiled well. However even if it boots for now, I'll have to test the signature check.


What I meant with my question was that I don't know if my do_sign task is redundant with compiling u-boot with the SECURE_BOOT activated (which would sign the image no?).


Sincerely,

Romain Bazile
Hardware R&D Engineer

www.ubiant.com

Le 16/06/2017 à 17:04, Otavio Salvador a écrit :
On Wed, Jun 14, 2017 at 1:45 PM, Romain Bazile <romain.bazile@ubiant.com> wrote:
...
We have in our bbappend a custom task, `sign_uboot`. This task uses the IMX
Code Signing Tool distributed by NXP to sign `u-boot.img` .


During the migration, I had a compilation problem. Basically, the build
system would complain that authenticate_image was an undefined reference.
When having a look at u-boot code, it seemed normal since it was not built
in the absence of `CONFIG_SECURE_BOOT`.
I added a patchfile changing this in `mx6ul_14x14_defconfig`, but now, a
different problem appears.

Basically, the do_compile task is failing when it tries to copy `u-boot.img`
(as defined in my bbappend `UBOOT_BINARY`). This is "normal", since this
file is not in the filesystem, and likely not built. However, I do have a
`u-boot-ivt.img` (but this file is supposed to be created at a later stage
by the task `sign_uboot`).

Also, just before, a couple of errors appears, where a script complains
about `bc` and `comm` not being found, except they are installed in the
build machine. This may not be related and not have consequences, I believe
this could be linked to the per-recipe sysroot.


Sorry for the long post, I can also share the details if needed (the task
`sign_uboot` and the scripts used to sign).

My questions are as follows:
Do I still need to use this custom script if I use `CONFIG_SECURE_BOOT`?
How can I insure that u-boot-fslc will be correctly built?
Please share the patch so we can look how it is done...



--------------6CC130A6253FE6EAC2ABBEF7--