[meta-freescale] [PATCH] atf: Reorganize

C.r. Guo chunrong.guo at nxp.com
Mon Mar 18 23:34:23 PDT 2019


Hello Otavlo,
I have done .

https://github.com/Freescale/meta-freescale/pull/64

Thanks
Chunrong


-----Original Message-----
From: Otavio Salvador [mailto:otavio.salvador at ossystems.com.br] 
Sent: 2019年3月18日 18:52
To: C.r. Guo <chunrong.guo at nxp.com>
Cc: meta-freescale at yoctoproject.org
Subject: Re: [meta-freescale] [PATCH] atf: Reorganize

Please prepare a PR on github, so we can review it.

On Tue, Mar 12, 2019 at 12:11 AM C.r. Guo <chunrong.guo at nxp.com> wrote:
>
> From: Chunrong Guo <chunrong.guo at nxp.com>
>
> *Add FUSE DISTRO_FEATURES
> *Add chassistype and ddrphyopt
> *Install srk.pri and srk.pub
>
> Signed-off-by: Chunrong Guo <chunrong.guo at nxp.com>
> ---
>  recipes-bsp/atf/atf_git.bb | 90 
> +++++++++++++++++++++++++++++++++-------------
>  1 file changed, 66 insertions(+), 24 deletions(-)
>
> diff --git a/recipes-bsp/atf/atf_git.bb b/recipes-bsp/atf/atf_git.bb 
> index 45bd376..edba6cc 100644
> --- a/recipes-bsp/atf/atf_git.bb
> +++ b/recipes-bsp/atf/atf_git.bb
> @@ -29,21 +29,27 @@ LDFLAGS[unexport] = "1"
>  AS[unexport] = "1"
>  LD[unexport] = "1"
>
> -# set secure option
> -# fuseopt ?= "FUSE_PROV=1  FUSE_FILE=$(CONFIG_SEC_FUSE_FILE)"
> -
>  BOOTTYPE ?= "nor nand qspi flexspi_nor sd emmc"
> -BUILD_SECURE = "${@bb.utils.contains('COMBINED_FEATURES', 'secure', 'true', 'false', d)}"
> -BUILD_OPTEE = "${@bb.utils.contains('COMBINED_FEATURES', 'optee', 'true', 'false', d)}"
> +BUILD_SECURE = "${@bb.utils.contains('DISTRO_FEATURES', 'secure', 'true', 'false', d)}"
> +BUILD_OPTEE = "${@bb.utils.contains('DISTRO_FEATURES', 'optee', 'true', 'false', d)}"
> +BUILD_FUSE = "${@bb.utils.contains('DISTRO_FEATURES', 'fuse', 'true', 'false', d)}"
>
>  uboot_boot_sec ?= "${DEPLOY_DIR_IMAGE}/u-boot.bin-tfa-secure-boot"
>  uboot_boot ?= "${DEPLOY_DIR_IMAGE}/u-boot.bin-tfa"
>  rcw ?= ""
>  rcw_ls1012afrwy = "_default"
>  rcw_ls1012ardb = "_default"
> -rcwsec ?= ""
> -rcwsec_ls1012afrwy = "_sben"
> -rcwsec_ls1012ardb = "_sben"
> +rcwsec ?= "_sben"
> +
> +chassistype ?= "ls2088_1088"
> +chassistype_ls1012ardb = "ls104x_1012"
> +chassistype_ls1012afrwy = "ls104x_1012"
> +chassistype_ls1043ardb = "ls104x_1012"
> +chassistype_ls1046ardb = "ls104x_1012"
> +
> +ddrphyopt ?= ""
> +ddrphyopt_lx2160ardb = "fip_ddr_sec"
> +
>  do_configure[noexec] = "1"
>
>  do_compile() {
> @@ -51,14 +57,23 @@ do_compile() {
>      install -d ${S}/include/tools_share/openssl
>      cp -r ${RECIPE_SYSROOT}/usr/include/openssl/*   ${S}/include/tools_share/openssl
>      ${RECIPE_SYSROOT_NATIVE}/usr/bin/cst/gen_keys 1024
> +
> +    if [ "${BUILD_FUSE}" = "true" ]; then
> +       ${RECIPE_SYSROOT_NATIVE}/usr/bin/cst/gen_fusescr ${RECIPE_SYSROOT_NATIVE}/usr/bin/cst/input_files/gen_fusescr/${chassistype}/input_fuse_file
> +       fuseopt="fip_fuse FUSE_PROG=1 FUSE_PROV_FILE=fuse_scr.bin"
> +    fi
>      if [ "${BUILD_SECURE}" = "true" ]; then
>          secureopt="TRUSTED_BOARD_BOOT=1 $ddrphyopt CST_DIR=${RECIPE_SYSROOT_NATIVE}/usr/bin/cst"
>          secext="_sec"
>          bl33="${uboot_boot_sec}"
> -        rcwsec="${rcwsec}"
> +        if [ ${chassistype} = ls104x_1012 ]; then
> +            rcwtemp="${rcwsec}"
> +        else
> +            rcwtemp="${rcw}"
> +        fi
>      else
>          bl33="${uboot_boot}"
> -        rcwsec="${rcw}"
> +        rcwtemp="${rcw}"
>      fi
>
>      if [ "${BUILD_OPTEE}" = "true" ]; then @@ -70,39 +85,47 @@ 
> do_compile() {
>      for d in ${BOOTTYPE}; do
>          case $d in
>          nor)
> -            rcwimg="${RCWNOR}${rcwsec}.bin"
> +            rcwimg="${RCWNOR}${rcwtemp}.bin"
>              uefiboot="${UEFI_NORBOOT}"
>              ;;
>          nand)
> -            rcwimg="${RCWNAND}${rcwsec}.bin"
> +            rcwimg="${RCWNAND}${rcwtemp}.bin"
>              ;;
>          qspi)
> -            rcwimg="${RCWQSPI}${rcwsec}.bin"
> +            rcwimg="${RCWQSPI}${rcwtemp}.bin"
>              ;;
>          sd)
> -            rcwimg="${RCWSD}${rcwsec}.bin"
> +            rcwimg="${RCWSD}${rcwtemp}.bin"
>              ;;
>          flexspi_nor)
> -            rcwimg="${RCWXSPI}${rcwsec}.bin"
> +            rcwimg="${RCWXSPI}${rcwtemp}.bin"
>              uefiboot="${UEFI_XSPIBOOT}"
>              ;;
>          esac
>
>         if [ -f "${DEPLOY_DIR_IMAGE}/rcw/${PLATFORM}/${rcwimg}" ]; 
> then
> +                oe_runmake V=1 -C ${S} realclean
> +                oe_runmake V=1 -C ${S} all fip pbl PLAT=${PLATFORM} BOOT_MODE=${d} RCW=${DEPLOY_DIR_IMAGE}/rcw/${PLATFORM}/${rcwimg} BL33=${bl33} ${bl32opt} ${spdopt} ${secureopt} ${fuseopt}
> +                cp -r ${S}/build/${PLATFORM}/release/bl2_${d}*.pbl ${S}
> +                cp -r ${S}/build/${PLATFORM}/release/fip.bin ${S}
> +                if [ "${BUILD_FUSE}" = "true" ]; then
> +                    cp -f ${S}/build/${PLATFORM}/release/fuse_fip.bin ${S}
> +                fi
> +
>                  if [ ${MACHINE} = ls1012afrwy ]; then
>                      oe_runmake V=1 -C ${S} realclean
>                      oe_runmake V=1 -C ${S} all fip pbl PLAT=ls1012afrwy_512mb BOOT_MODE=${d} RCW=${DEPLOY_DIR_IMAGE}/rcw/${PLATFORM}/${rcwimg} BL33=${bl33} ${bl32opt} ${spdopt} ${secureopt} ${fuseopt}
> -                    cp -r ${S}/build/ls1012afrwy_512mb/release/bl2_qspi.pbl ${S}/bl2_${d}_512mb.pbl
> +                    cp -r 
> + ${S}/build/ls1012afrwy_512mb/release/bl2_qspi${secext}.pbl 
> + ${S}/bl2_${d}${secext}_512mb.pbl
>                      cp -r 
> ${S}/build/ls1012afrwy_512mb/release/fip.bin ${S}/fip_512mb.bin
> +                    if [ "${BUILD_FUSE}" = "true" ]; then
> +                        cp -r ${S}/build/ls1012afrwy_512mb/release/fuse_fip.bin ${S}/fuse_fip_512mb.bin
> +                    fi
>                  fi
>                  if [ -n "${uefiboot}" ]; then
>                      oe_runmake V=1 -C ${S} realclean
>                      oe_runmake V=1 -C ${S} all fip pbl PLAT=${PLATFORM} BOOT_MODE=${d} RCW=${DEPLOY_DIR_IMAGE}/rcw/${PLATFORM}/${rcwimg} BL33=${DEPLOY_DIR_IMAGE}/uefi/${PLATFORM}/${uefiboot} ${bl32opt} ${spdopt} ${secureopt} ${fuseopt}
>                      cp -r ${S}/build/${PLATFORM}/release/fip.bin ${S}/fip_uefi.bin
>                  fi
> -                oe_runmake V=1 -C ${S} realclean
> -                oe_runmake V=1 -C ${S} all fip pbl PLAT=${PLATFORM} BOOT_MODE=${d} RCW=${DEPLOY_DIR_IMAGE}/rcw/${PLATFORM}/${rcwimg} BL33=${bl33} ${bl32opt} ${spdopt} ${secureopt} ${fuseopt}
> -                cp -r ${S}/build/${PLATFORM}/release/bl2_${d}*.pbl ${S}
>          fi
>          rcwimg=""
>          uefiboot=""
> @@ -111,13 +134,20 @@ do_compile() {
>
>  do_install() {
>      install -d ${D}/boot/atf
> -    if [ "${BUILD_SECURE}" = "y" ]; then
> +    cp -r ${S}/srk.pri ${D}/boot/atf
> +    cp -r ${S}/srk.pub ${D}/boot/atf
> +    if [ "${BUILD_SECURE}" = "true" ]; then
>          secext="_sec"
>      fi
>      if [ -f "${S}/fip_uefi.bin" ]; then
>          cp -r ${S}/fip_uefi.bin ${D}/boot/atf/fip_uefi.bin
>      fi
> -    cp -r ${S}/build/${PLATFORM}/release/fip.bin ${D}/boot/atf/fip.bin
> +    if [ -f "${S}/fuse_fip.bin" ]; then
> +        cp -r ${S}/fuse_fip.bin ${D}/boot/atf/fuse_fip.bin
> +    fi
> +    if [ -f "${S}/fip.bin" ]; then
> +        cp -r ${S}/fip.bin ${D}/boot/atf/fip.bin
> +    fi
>      for d in ${BOOTTYPE}; do
>          if [ -e  ${S}/bl2_${d}${secext}.pbl ]; then
>              cp -r ${S}/bl2_${d}${secext}.pbl 
> ${D}/boot/atf/bl2_${d}${secext}.pbl
> @@ -125,16 +155,25 @@ do_install() {
>      done
>      if [ ${MACHINE} = ls1012afrwy ]; then
>              cp -r ${S}/fip_512mb.bin ${D}/boot/atf/fip_512mb.bin
> -            cp -r ${S}/bl2_qspi_512mb.pbl ${D}/boot/atf/fip_512mb.bin
> +            cp -r ${S}/bl2_qspi${secext}_512mb.pbl ${D}/boot/atf/bl2_qspi${secext}_512mb.pbl
> +            if [ -f "${S}/fuse_fip_512mb.bin" ]; then
> +                cp -r ${S}/fuse_fip_512mb.bin ${D}/boot/atf/fuse_fip_512mb.bin
> +            fi
>      fi
>      chown -R root:root ${D}
>  }
>
>  do_deploy() {
>      install -d ${DEPLOYDIR}/atf
> -    if [ "${BUILD_SECURE}" = "y" ]; then
> +    cp -r ${D}/boot/atf/srk.pri ${DEPLOYDIR}/atf
> +    cp -r  ${D}/boot/atf/srk.pub ${DEPLOYDIR}/atf
> +    if [ "${BUILD_SECURE}" = "true" ]; then
>          secext="_sec"
>      fi
> +
> +    if [ -f "${S}/fuse_fip.bin" ]; then
> +        cp -r ${D}/boot/atf/fuse_fip.bin ${DEPLOYDIR}/atf/fuse_fip${secext}.bin
> +    fi
>
>      if [ -e ${D}/boot/atf/fip_uefi.bin ]; then
>          cp -r ${D}/boot/atf/fip_uefi.bin 
> ${DEPLOYDIR}/atf/fip_uefi.bin @@ -146,8 +185,11 @@ do_deploy() {
>          fi
>      done
>      if [ ${MACHINE} = ls1012afrwy ]; then
> -        cp -r ${S}/bl2_qspi_512mb.pbl ${DEPLOYDIR}/atf/
> +        cp -r ${S}/bl2_qspi${secext}_512mb.pbl ${DEPLOYDIR}/atf/
>          cp -r ${S}/fip_512mb.bin 
> ${DEPLOYDIR}/atf/fip_uboot${secext}_512mb.bin
> +        if [ -f "${S}/fuse_fip_512mb.bin" ]; then
> +                cp -r ${S}/fuse_fip_512mb.bin ${D}/boot/atf/fuse_fip_512mb${secext}.bin
> +        fi
>      fi
>  }
>  addtask deploy after do_install
> --
> 2.7.4
>
> --
> _______________________________________________
> meta-freescale mailing list
> meta-freescale at yoctoproject.org
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist
> s.yoctoproject.org%2Flistinfo%2Fmeta-freescale&data=02%7C01%7Cchun
> rong.guo%40nxp.com%7C9ba7b469b10e4014b8d608d6ab8fdadd%7C686ea1d3bc2b4c
> 6fa92cd99c5c301635%7C0%7C0%7C636885031673880267&sdata=JPYNhznwCMAD
> 1X%2BHbeRADx%2BtFSoS6Ay9N%2Bif7NnuUNA%3D&reserved=0



-- 
Otavio Salvador                             O.S. Systems
https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.ossystems.com.br&data=02%7C01%7Cchunrong.guo%40nxp.com%7C9ba7b469b10e4014b8d608d6ab8fdadd%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C636885031673880267&sdata=Y4AMD9lZ0kiM%2Fg445IIayqxyd5Cp1Lb41BiT4SyTpAc%3D&reserved=0        https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fcode.ossystems.com.br&data=02%7C01%7Cchunrong.guo%40nxp.com%7C9ba7b469b10e4014b8d608d6ab8fdadd%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C636885031673880267&sdata=s9YmZ2CDVrzg%2FFt3Po8OO%2BELmxvaXJube5%2BUSwnUfVo%3D&reserved=0
Mobile: +55 (53) 9 9981-7854          Mobile: +1 (347) 903-9750


More information about the meta-freescale mailing list