diff options
| author | Andreas Obergschwandtner <andreas.obergschwandtner@skidata.com> | 2019-04-11 14:21:30 +0200 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-04-16 11:10:01 +0100 |
| commit | de0019cf6c20436bf7bfd07cc467b7a2b7a46d34 (patch) | |
| tree | 5d2b952b6f53b2b2d1e576a3178a6a2e40b923a7 /meta/classes/uboot-sign.bbclass | |
| parent | 98143681efc76582f5a0b25212c6630824c71f65 (diff) | |
| download | poky-de0019cf6c20436bf7bfd07cc467b7a2b7a46d34.tar.gz | |
uboot-sign: add support for different u-boot configurations
This is done by concatenating the DTB with the kernels public key
to all built u-boot binaries. Furthermore the installation of all
the binaries is required.
(From OE-Core rev: bacb59079eb6ba7e43507a6d3a357341fb367f83)
Signed-off-by: Andreas Obergschwandtner <andreas.obergschwandtner@skidata.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/uboot-sign.bbclass')
| -rw-r--r-- | meta/classes/uboot-sign.bbclass | 85 |
1 files changed, 54 insertions, 31 deletions
diff --git a/meta/classes/uboot-sign.bbclass b/meta/classes/uboot-sign.bbclass index 9e3d1d6fc1..2da43655aa 100644 --- a/meta/classes/uboot-sign.bbclass +++ b/meta/classes/uboot-sign.bbclass | |||
| @@ -45,49 +45,72 @@ UBOOT_NODTB_SYMLINK ?= "u-boot-nodtb-${MACHINE}.${UBOOT_SUFFIX}" | |||
| 45 | # Functions in this bbclass is for u-boot only | 45 | # Functions in this bbclass is for u-boot only |
| 46 | UBOOT_PN = "${@d.getVar('PREFERRED_PROVIDER_u-boot') or 'u-boot'}" | 46 | UBOOT_PN = "${@d.getVar('PREFERRED_PROVIDER_u-boot') or 'u-boot'}" |
| 47 | 47 | ||
| 48 | concat_dtb_helper() { | ||
| 49 | if [ -e ${UBOOT_DTB_BINARY} ]; then | ||
| 50 | ln -sf ${UBOOT_DTB_IMAGE} ${DEPLOYDIR}/${UBOOT_DTB_BINARY} | ||
| 51 | ln -sf ${UBOOT_DTB_IMAGE} ${DEPLOYDIR}/${UBOOT_DTB_SYMLINK} | ||
| 52 | fi | ||
| 53 | |||
| 54 | if [ -f ${UBOOT_NODTB_BINARY} ]; then | ||
| 55 | install ${UBOOT_NODTB_BINARY} ${DEPLOYDIR}/${UBOOT_NODTB_IMAGE} | ||
| 56 | ln -sf ${UBOOT_NODTB_IMAGE} ${UBOOT_NODTB_SYMLINK} | ||
| 57 | ln -sf ${UBOOT_NODTB_IMAGE} ${UBOOT_NODTB_BINARY} | ||
| 58 | fi | ||
| 59 | |||
| 60 | # Concatenate U-Boot w/o DTB & DTB with public key | ||
| 61 | # (cf. kernel-fitimage.bbclass for more details) | ||
| 62 | deployed_uboot_dtb_binary='${DEPLOY_DIR_IMAGE}/${UBOOT_DTB_IMAGE}' | ||
| 63 | if [ "x${UBOOT_SUFFIX}" = "ximg" -o "x${UBOOT_SUFFIX}" = "xrom" ] && \ | ||
| 64 | [ -e "$deployed_uboot_dtb_binary" ]; then | ||
| 65 | oe_runmake EXT_DTB=$deployed_uboot_dtb_binary | ||
| 66 | install ${UBOOT_BINARY} ${DEPLOYDIR}/${UBOOT_IMAGE} | ||
| 67 | elif [ -e "${DEPLOYDIR}/${UBOOT_NODTB_IMAGE}" -a -e "$deployed_uboot_dtb_binary" ]; then | ||
| 68 | cd ${DEPLOYDIR} | ||
| 69 | cat ${UBOOT_NODTB_IMAGE} $deployed_uboot_dtb_binary | tee ${UBOOT_BINARY} > ${UBOOT_IMAGE} | ||
| 70 | elif [ -n "${UBOOT_DTB_BINARY}" ]; then | ||
| 71 | bbwarn "Failure while adding public key to u-boot binary. Verified boot won't be available." | ||
| 72 | fi | ||
| 73 | } | ||
| 74 | |||
| 48 | concat_dtb() { | 75 | concat_dtb() { |
| 49 | if [ "${UBOOT_SIGN_ENABLE}" = "1" -a "${PN}" = "${UBOOT_PN}" ]; then | 76 | if [ "${UBOOT_SIGN_ENABLE}" = "1" -a "${PN}" = "${UBOOT_PN}" ]; then |
| 50 | mkdir -p ${DEPLOYDIR} | 77 | mkdir -p ${DEPLOYDIR} |
| 51 | if [ -e ${B}/${UBOOT_DTB_BINARY} ]; then | 78 | if [ -n "${UBOOT_CONFIG}" ]; then |
| 52 | ln -sf ${UBOOT_DTB_IMAGE} ${DEPLOYDIR}/${UBOOT_DTB_BINARY} | 79 | for config in ${UBOOT_MACHINE}; do |
| 53 | ln -sf ${UBOOT_DTB_IMAGE} ${DEPLOYDIR}/${UBOOT_DTB_SYMLINK} | 80 | cd ${B}/${config} |
| 54 | fi | 81 | concat_dtb_helper |
| 55 | 82 | done | |
| 56 | if [ -f ${B}/${UBOOT_NODTB_BINARY} ]; then | 83 | else |
| 57 | install ${B}/${UBOOT_NODTB_BINARY} ${DEPLOYDIR}/${UBOOT_NODTB_IMAGE} | ||
| 58 | ln -sf ${UBOOT_NODTB_IMAGE} ${UBOOT_NODTB_SYMLINK} | ||
| 59 | ln -sf ${UBOOT_NODTB_IMAGE} ${UBOOT_NODTB_BINARY} | ||
| 60 | fi | ||
| 61 | |||
| 62 | # Concatenate U-Boot w/o DTB & DTB with public key | ||
| 63 | # (cf. kernel-fitimage.bbclass for more details) | ||
| 64 | deployed_uboot_dtb_binary='${DEPLOY_DIR_IMAGE}/${UBOOT_DTB_IMAGE}' | ||
| 65 | if [ "x${UBOOT_SUFFIX}" = "ximg" -o "x${UBOOT_SUFFIX}" = "xrom" ] && \ | ||
| 66 | [ -e "$deployed_uboot_dtb_binary" ]; then | ||
| 67 | cd ${B} | 84 | cd ${B} |
| 68 | oe_runmake EXT_DTB=$deployed_uboot_dtb_binary | 85 | concat_dtb_helper |
| 69 | install ${B}/${UBOOT_BINARY} ${DEPLOYDIR}/${UBOOT_IMAGE} | ||
| 70 | elif [ -e "${DEPLOYDIR}/${UBOOT_NODTB_IMAGE}" -a -e "$deployed_uboot_dtb_binary" ]; then | ||
| 71 | cd ${DEPLOYDIR} | ||
| 72 | cat ${UBOOT_NODTB_IMAGE} $deployed_uboot_dtb_binary | tee ${B}/${UBOOT_BINARY} > ${UBOOT_IMAGE} | ||
| 73 | elif [ -n "${UBOOT_DTB_BINARY}" ]; then | ||
| 74 | bbwarn "Failure while adding public key to u-boot binary. Verified boot won't be available." | ||
| 75 | fi | 86 | fi |
| 76 | fi | 87 | fi |
| 77 | } | 88 | } |
| 78 | 89 | ||
| 79 | # Install UBOOT_DTB_BINARY to datadir, so that kernel can use it for | 90 | # Install UBOOT_DTB_BINARY to datadir, so that kernel can use it for |
| 80 | # signing, and kernel will deploy UBOOT_DTB_BINARY after signs it. | 91 | # signing, and kernel will deploy UBOOT_DTB_BINARY after signs it. |
| 92 | install_helper() { | ||
| 93 | if [ -f ${UBOOT_DTB_BINARY} ]; then | ||
| 94 | install -d ${D}${datadir} | ||
| 95 | # UBOOT_DTB_BINARY is a symlink to UBOOT_DTB_IMAGE, so we | ||
| 96 | # need both of them. | ||
| 97 | install ${UBOOT_DTB_BINARY} ${D}${datadir}/${UBOOT_DTB_IMAGE} | ||
| 98 | ln -sf ${UBOOT_DTB_IMAGE} ${D}${datadir}/${UBOOT_DTB_BINARY} | ||
| 99 | elif [ -n "${UBOOT_DTB_BINARY}" ]; then | ||
| 100 | bbwarn "${UBOOT_DTB_BINARY} not found" | ||
| 101 | fi | ||
| 102 | } | ||
| 103 | |||
| 81 | do_install_append() { | 104 | do_install_append() { |
| 82 | if [ "${UBOOT_SIGN_ENABLE}" = "1" -a "${PN}" = "${UBOOT_PN}" ]; then | 105 | if [ "${UBOOT_SIGN_ENABLE}" = "1" -a "${PN}" = "${UBOOT_PN}" ]; then |
| 83 | if [ -f ${B}/${UBOOT_DTB_BINARY} ]; then | 106 | if [ -n "${UBOOT_CONFIG}" ]; then |
| 84 | install -d ${D}${datadir} | 107 | for config in ${UBOOT_MACHINE}; do |
| 85 | # UBOOT_DTB_BINARY is a symlink to UBOOT_DTB_IMAGE, so we | 108 | cd ${B}/${config} |
| 86 | # need both of them. | 109 | install_helper |
| 87 | install ${B}/${UBOOT_DTB_BINARY} ${D}${datadir}/${UBOOT_DTB_IMAGE} | 110 | done |
| 88 | ln -sf ${UBOOT_DTB_IMAGE} ${D}${datadir}/${UBOOT_DTB_BINARY} | 111 | else |
| 89 | elif [ -n "${UBOOT_DTB_BINARY}" ]; then | 112 | cd ${B} |
| 90 | bbwarn "${B}/${UBOOT_DTB_BINARY} not found" | 113 | install_helper |
| 91 | fi | 114 | fi |
| 92 | fi | 115 | fi |
| 93 | } | 116 | } |
