diff options
-rw-r--r-- | meta/classes/kernel-fitimage.bbclass | 58 | ||||
-rw-r--r-- | meta/classes/uboot-config.bbclass | 56 | ||||
-rw-r--r-- | meta/classes/uboot-sign.bbclass | 35 | ||||
-rw-r--r-- | meta/recipes-bsp/u-boot/u-boot.inc | 46 |
4 files changed, 91 insertions, 104 deletions
diff --git a/meta/classes/kernel-fitimage.bbclass b/meta/classes/kernel-fitimage.bbclass index b9d8270027..6b7c1c3a7d 100644 --- a/meta/classes/kernel-fitimage.bbclass +++ b/meta/classes/kernel-fitimage.bbclass | |||
@@ -53,30 +53,6 @@ python __anonymous () { | |||
53 | d.appendVarFlag('do_assemble_fitimage_initramfs', 'depends', ' %s:do_populate_sysroot' % uboot_pn) | 53 | d.appendVarFlag('do_assemble_fitimage_initramfs', 'depends', ' %s:do_populate_sysroot' % uboot_pn) |
54 | } | 54 | } |
55 | 55 | ||
56 | # Options for the device tree compiler passed to mkimage '-D' feature: | ||
57 | UBOOT_MKIMAGE_DTCOPTS ??= "" | ||
58 | |||
59 | # fitImage Hash Algo | ||
60 | FIT_HASH_ALG ?= "sha256" | ||
61 | |||
62 | # fitImage Signature Algo | ||
63 | FIT_SIGN_ALG ?= "rsa2048" | ||
64 | |||
65 | # Generate keys for signing fitImage | ||
66 | FIT_GENERATE_KEYS ?= "0" | ||
67 | |||
68 | # Size of private key in number of bits | ||
69 | FIT_SIGN_NUMBITS ?= "2048" | ||
70 | |||
71 | # args to openssl genrsa (Default is just the public exponent) | ||
72 | FIT_KEY_GENRSA_ARGS ?= "-F4" | ||
73 | |||
74 | # args to openssl req (Default is -batch for non interactive mode and | ||
75 | # -new for new certificate) | ||
76 | FIT_KEY_REQ_ARGS ?= "-batch -new" | ||
77 | |||
78 | # Standard format for public key certificate | ||
79 | FIT_KEY_SIGN_PKCS ?= "-x509" | ||
80 | 56 | ||
81 | # Description string | 57 | # Description string |
82 | FIT_DESC ?= "U-Boot fitImage for ${DISTRO_NAME}/${PV}/${MACHINE}" | 58 | FIT_DESC ?= "U-Boot fitImage for ${DISTRO_NAME}/${PV}/${MACHINE}" |
@@ -84,13 +60,6 @@ FIT_DESC ?= "U-Boot fitImage for ${DISTRO_NAME}/${PV}/${MACHINE}" | |||
84 | # Sign individual images as well | 60 | # Sign individual images as well |
85 | FIT_SIGN_INDIVIDUAL ?= "0" | 61 | FIT_SIGN_INDIVIDUAL ?= "0" |
86 | 62 | ||
87 | # mkimage command | ||
88 | UBOOT_MKIMAGE ?= "uboot-mkimage" | ||
89 | UBOOT_MKIMAGE_SIGN ?= "${UBOOT_MKIMAGE}" | ||
90 | |||
91 | # Arguments passed to mkimage for signing | ||
92 | UBOOT_MKIMAGE_SIGN_ARGS ?= "" | ||
93 | |||
94 | # | 63 | # |
95 | # Emit the fitImage ITS header | 64 | # Emit the fitImage ITS header |
96 | # | 65 | # |
@@ -698,33 +667,6 @@ do_assemble_fitimage_initramfs() { | |||
698 | 667 | ||
699 | addtask assemble_fitimage_initramfs before do_deploy after do_bundle_initramfs | 668 | addtask assemble_fitimage_initramfs before do_deploy after do_bundle_initramfs |
700 | 669 | ||
701 | do_generate_rsa_keys() { | ||
702 | if [ "${UBOOT_SIGN_ENABLE}" = "0" ] && [ "${FIT_GENERATE_KEYS}" = "1" ]; then | ||
703 | bbwarn "FIT_GENERATE_KEYS is set to 1 eventhough UBOOT_SIGN_ENABLE is set to 0. The keys will not be generated as they won't be used." | ||
704 | fi | ||
705 | |||
706 | if [ "${UBOOT_SIGN_ENABLE}" = "1" ] && [ "${FIT_GENERATE_KEYS}" = "1" ]; then | ||
707 | |||
708 | # Generate keys only if they don't already exist | ||
709 | if [ ! -f "${UBOOT_SIGN_KEYDIR}/${UBOOT_SIGN_KEYNAME}".key ] || \ | ||
710 | [ ! -f "${UBOOT_SIGN_KEYDIR}/${UBOOT_SIGN_KEYNAME}".crt]; then | ||
711 | |||
712 | # make directory if it does not already exist | ||
713 | mkdir -p "${UBOOT_SIGN_KEYDIR}" | ||
714 | |||
715 | echo "Generating RSA private key for signing fitImage" | ||
716 | openssl genrsa ${FIT_KEY_GENRSA_ARGS} -out \ | ||
717 | "${UBOOT_SIGN_KEYDIR}/${UBOOT_SIGN_KEYNAME}".key \ | ||
718 | "${FIT_SIGN_NUMBITS}" | ||
719 | |||
720 | echo "Generating certificate for signing fitImage" | ||
721 | openssl req ${FIT_KEY_REQ_ARGS} "${FIT_KEY_SIGN_PKCS}" \ | ||
722 | -key "${UBOOT_SIGN_KEYDIR}/${UBOOT_SIGN_KEYNAME}".key \ | ||
723 | -out "${UBOOT_SIGN_KEYDIR}/${UBOOT_SIGN_KEYNAME}".crt | ||
724 | fi | ||
725 | fi | ||
726 | } | ||
727 | |||
728 | addtask generate_rsa_keys before do_assemble_fitimage after do_compile | 670 | addtask generate_rsa_keys before do_assemble_fitimage after do_compile |
729 | 671 | ||
730 | kernel_do_deploy[vardepsexclude] = "DATETIME" | 672 | kernel_do_deploy[vardepsexclude] = "DATETIME" |
diff --git a/meta/classes/uboot-config.bbclass b/meta/classes/uboot-config.bbclass index 89ff970fcc..31487c1418 100644 --- a/meta/classes/uboot-config.bbclass +++ b/meta/classes/uboot-config.bbclass | |||
@@ -11,7 +11,63 @@ | |||
11 | # | 11 | # |
12 | # Copyright 2013, 2014 (C) O.S. Systems Software LTDA. | 12 | # Copyright 2013, 2014 (C) O.S. Systems Software LTDA. |
13 | 13 | ||
14 | # Some versions of u-boot use .bin and others use .img. By default use .bin | ||
15 | # but enable individual recipes to change this value. | ||
16 | UBOOT_SUFFIX ??= "bin" | ||
14 | UBOOT_BINARY ?= "u-boot.${UBOOT_SUFFIX}" | 17 | UBOOT_BINARY ?= "u-boot.${UBOOT_SUFFIX}" |
18 | UBOOT_BINARYNAME ?= "${@os.path.splitext(d.getVar("UBOOT_BINARY"))[0]}" | ||
19 | UBOOT_IMAGE ?= "u-boot-${MACHINE}-${PV}-${PR}.${UBOOT_SUFFIX}" | ||
20 | UBOOT_SYMLINK ?= "u-boot-${MACHINE}.${UBOOT_SUFFIX}" | ||
21 | UBOOT_MAKE_TARGET ?= "all" | ||
22 | |||
23 | # Output the ELF generated. Some platforms can use the ELF file and directly | ||
24 | # load it (JTAG booting, QEMU) additionally the ELF can be used for debugging | ||
25 | # purposes. | ||
26 | UBOOT_ELF ?= "" | ||
27 | UBOOT_ELF_SUFFIX ?= "elf" | ||
28 | UBOOT_ELF_IMAGE ?= "u-boot-${MACHINE}-${PV}-${PR}.${UBOOT_ELF_SUFFIX}" | ||
29 | UBOOT_ELF_BINARY ?= "u-boot.${UBOOT_ELF_SUFFIX}" | ||
30 | UBOOT_ELF_SYMLINK ?= "u-boot-${MACHINE}.${UBOOT_ELF_SUFFIX}" | ||
31 | |||
32 | # Some versions of u-boot build an SPL (Second Program Loader) image that | ||
33 | # should be packaged along with the u-boot binary as well as placed in the | ||
34 | # deploy directory. For those versions they can set the following variables | ||
35 | # to allow packaging the SPL. | ||
36 | SPL_BINARY ?= "" | ||
37 | SPL_BINARYNAME ?= "${@os.path.basename(d.getVar("SPL_BINARY"))}" | ||
38 | SPL_IMAGE ?= "${SPL_BINARYNAME}-${MACHINE}-${PV}-${PR}" | ||
39 | SPL_SYMLINK ?= "${SPL_BINARYNAME}-${MACHINE}" | ||
40 | |||
41 | # Additional environment variables or a script can be installed alongside | ||
42 | # u-boot to be used automatically on boot. This file, typically 'uEnv.txt' | ||
43 | # or 'boot.scr', should be packaged along with u-boot as well as placed in the | ||
44 | # deploy directory. Machine configurations needing one of these files should | ||
45 | # include it in the SRC_URI and set the UBOOT_ENV parameter. | ||
46 | UBOOT_ENV_SUFFIX ?= "txt" | ||
47 | UBOOT_ENV ?= "" | ||
48 | UBOOT_ENV_BINARY ?= "${UBOOT_ENV}.${UBOOT_ENV_SUFFIX}" | ||
49 | UBOOT_ENV_IMAGE ?= "${UBOOT_ENV}-${MACHINE}-${PV}-${PR}.${UBOOT_ENV_SUFFIX}" | ||
50 | UBOOT_ENV_SYMLINK ?= "${UBOOT_ENV}-${MACHINE}.${UBOOT_ENV_SUFFIX}" | ||
51 | |||
52 | # Default name of u-boot initial env, but enable individual recipes to change | ||
53 | # this value. | ||
54 | UBOOT_INITIAL_ENV ?= "${PN}-initial-env" | ||
55 | |||
56 | # U-Boot EXTLINUX variables. U-Boot searches for /boot/extlinux/extlinux.conf | ||
57 | # to find EXTLINUX conf file. | ||
58 | UBOOT_EXTLINUX_INSTALL_DIR ?= "/boot/extlinux" | ||
59 | UBOOT_EXTLINUX_CONF_NAME ?= "extlinux.conf" | ||
60 | UBOOT_EXTLINUX_SYMLINK ?= "${UBOOT_EXTLINUX_CONF_NAME}-${MACHINE}-${PR}" | ||
61 | |||
62 | # Options for the device tree compiler passed to mkimage '-D' feature: | ||
63 | UBOOT_MKIMAGE_DTCOPTS ??= "" | ||
64 | |||
65 | # mkimage command | ||
66 | UBOOT_MKIMAGE ?= "uboot-mkimage" | ||
67 | UBOOT_MKIMAGE_SIGN ?= "${UBOOT_MKIMAGE}" | ||
68 | |||
69 | # Arguments passed to mkimage for signing | ||
70 | UBOOT_MKIMAGE_SIGN_ARGS ?= "" | ||
15 | 71 | ||
16 | python () { | 72 | python () { |
17 | ubootmachine = d.getVar("UBOOT_MACHINE") | 73 | ubootmachine = d.getVar("UBOOT_MACHINE") |
diff --git a/meta/classes/uboot-sign.bbclass b/meta/classes/uboot-sign.bbclass index d590971a27..4e4941e733 100644 --- a/meta/classes/uboot-sign.bbclass +++ b/meta/classes/uboot-sign.bbclass | |||
@@ -31,6 +31,9 @@ | |||
31 | # | 31 | # |
32 | # For more details on signature process, please refer to U-Boot documentation. | 32 | # For more details on signature process, please refer to U-Boot documentation. |
33 | 33 | ||
34 | # We need some variables from u-boot-config | ||
35 | inherit uboot-config | ||
36 | |||
34 | # Signature activation. | 37 | # Signature activation. |
35 | UBOOT_SIGN_ENABLE ?= "0" | 38 | UBOOT_SIGN_ENABLE ?= "0" |
36 | 39 | ||
@@ -41,6 +44,38 @@ UBOOT_DTB_SYMLINK ?= "u-boot-${MACHINE}.dtb" | |||
41 | UBOOT_NODTB_IMAGE ?= "u-boot-nodtb-${MACHINE}-${PV}-${PR}.${UBOOT_SUFFIX}" | 44 | UBOOT_NODTB_IMAGE ?= "u-boot-nodtb-${MACHINE}-${PV}-${PR}.${UBOOT_SUFFIX}" |
42 | UBOOT_NODTB_BINARY ?= "u-boot-nodtb.${UBOOT_SUFFIX}" | 45 | UBOOT_NODTB_BINARY ?= "u-boot-nodtb.${UBOOT_SUFFIX}" |
43 | UBOOT_NODTB_SYMLINK ?= "u-boot-nodtb-${MACHINE}.${UBOOT_SUFFIX}" | 46 | UBOOT_NODTB_SYMLINK ?= "u-boot-nodtb-${MACHINE}.${UBOOT_SUFFIX}" |
47 | UBOOT_ITS_IMAGE ?= "u-boot-${MACHINE}-${PV}-${PR}.its" | ||
48 | UBOOT_ITS ?= "u-boot.its" | ||
49 | UBOOT_ITS_SYMLINK ?= "u-boot-${MACHINE}.its" | ||
50 | SPL_DIR ?= "${@os.path.dirname(d.getVar("SPL_BINARY")) or '.'}" | ||
51 | SPL_DTB_IMAGE ?= "u-boot-spl-${MACHINE}-${PV}-${PR}.dtb" | ||
52 | SPL_DTB_BINARY ?= "u-boot-spl.dtb" | ||
53 | SPL_DTB_SYMLINK ?= "u-boot-spl-${MACHINE}.dtb" | ||
54 | SPL_NODTB_IMAGE ?= "${@os.path.splitext(d.getVar("SPL_BINARYNAME"))[0]}-nodtb-${MACHINE}-${PV}-${PR}${@os.path.splitext(d.getVar("SPL_BINARYNAME"))[1]}" | ||
55 | SPL_NODTB_BINARY ?= "${@os.path.splitext(d.getVar("SPL_BINARYNAME"))[0]}-nodtb${@os.path.splitext(d.getVar("SPL_BINARYNAME"))[1]}" | ||
56 | SPL_NODTB_SYMLINK ?= "${@os.path.splitext(d.getVar("SPL_BINARYNAME"))[0]}-nodtb-${MACHINE}${@os.path.splitext(d.getVar("SPL_BINARYNAME"))[1]}" | ||
57 | |||
58 | # fitImage Hash Algo | ||
59 | FIT_HASH_ALG ?= "sha256" | ||
60 | |||
61 | # fitImage Signature Algo | ||
62 | FIT_SIGN_ALG ?= "rsa2048" | ||
63 | |||
64 | # Generate keys for signing fitImage | ||
65 | FIT_GENERATE_KEYS ?= "0" | ||
66 | |||
67 | # Size of private key in number of bits | ||
68 | FIT_SIGN_NUMBITS ?= "2048" | ||
69 | |||
70 | # args to openssl genrsa (Default is just the public exponent) | ||
71 | FIT_KEY_GENRSA_ARGS ?= "-F4" | ||
72 | |||
73 | # args to openssl req (Default is -batch for non interactive mode and | ||
74 | # -new for new certificate) | ||
75 | FIT_KEY_REQ_ARGS ?= "-batch -new" | ||
76 | |||
77 | # Standard format for public key certificate | ||
78 | FIT_KEY_SIGN_PKCS ?= "-x509" | ||
44 | 79 | ||
45 | # Functions in this bbclass is for u-boot only | 80 | # Functions in this bbclass is for u-boot only |
46 | UBOOT_PN = "${@d.getVar('PREFERRED_PROVIDER_u-boot') or 'u-boot'}" | 81 | UBOOT_PN = "${@d.getVar('PREFERRED_PROVIDER_u-boot') or 'u-boot'}" |
diff --git a/meta/recipes-bsp/u-boot/u-boot.inc b/meta/recipes-bsp/u-boot/u-boot.inc index 251178db33..5398c2e621 100644 --- a/meta/recipes-bsp/u-boot/u-boot.inc +++ b/meta/recipes-bsp/u-boot/u-boot.inc | |||
@@ -24,52 +24,6 @@ PACKAGECONFIG[openssl] = ",,openssl-native" | |||
24 | # file already exists it will not be overwritten. | 24 | # file already exists it will not be overwritten. |
25 | UBOOT_LOCALVERSION ?= "" | 25 | UBOOT_LOCALVERSION ?= "" |
26 | 26 | ||
27 | # Some versions of u-boot use .bin and others use .img. By default use .bin | ||
28 | # but enable individual recipes to change this value. | ||
29 | UBOOT_SUFFIX ??= "bin" | ||
30 | UBOOT_IMAGE ?= "u-boot-${MACHINE}-${PV}-${PR}.${UBOOT_SUFFIX}" | ||
31 | UBOOT_SYMLINK ?= "u-boot-${MACHINE}.${UBOOT_SUFFIX}" | ||
32 | UBOOT_MAKE_TARGET ?= "all" | ||
33 | |||
34 | # Output the ELF generated. Some platforms can use the ELF file and directly | ||
35 | # load it (JTAG booting, QEMU) additionally the ELF can be used for debugging | ||
36 | # purposes. | ||
37 | UBOOT_ELF ?= "" | ||
38 | UBOOT_ELF_SUFFIX ?= "elf" | ||
39 | UBOOT_ELF_IMAGE ?= "u-boot-${MACHINE}-${PV}-${PR}.${UBOOT_ELF_SUFFIX}" | ||
40 | UBOOT_ELF_BINARY ?= "u-boot.${UBOOT_ELF_SUFFIX}" | ||
41 | UBOOT_ELF_SYMLINK ?= "u-boot-${MACHINE}.${UBOOT_ELF_SUFFIX}" | ||
42 | |||
43 | # Some versions of u-boot build an SPL (Second Program Loader) image that | ||
44 | # should be packaged along with the u-boot binary as well as placed in the | ||
45 | # deploy directory. For those versions they can set the following variables | ||
46 | # to allow packaging the SPL. | ||
47 | SPL_BINARY ?= "" | ||
48 | SPL_BINARYNAME ?= "${@os.path.basename(d.getVar("SPL_BINARY"))}" | ||
49 | SPL_IMAGE ?= "${SPL_BINARYNAME}-${MACHINE}-${PV}-${PR}" | ||
50 | SPL_SYMLINK ?= "${SPL_BINARYNAME}-${MACHINE}" | ||
51 | |||
52 | # Additional environment variables or a script can be installed alongside | ||
53 | # u-boot to be used automatically on boot. This file, typically 'uEnv.txt' | ||
54 | # or 'boot.scr', should be packaged along with u-boot as well as placed in the | ||
55 | # deploy directory. Machine configurations needing one of these files should | ||
56 | # include it in the SRC_URI and set the UBOOT_ENV parameter. | ||
57 | UBOOT_ENV_SUFFIX ?= "txt" | ||
58 | UBOOT_ENV ?= "" | ||
59 | UBOOT_ENV_BINARY ?= "${UBOOT_ENV}.${UBOOT_ENV_SUFFIX}" | ||
60 | UBOOT_ENV_IMAGE ?= "${UBOOT_ENV}-${MACHINE}-${PV}-${PR}.${UBOOT_ENV_SUFFIX}" | ||
61 | UBOOT_ENV_SYMLINK ?= "${UBOOT_ENV}-${MACHINE}.${UBOOT_ENV_SUFFIX}" | ||
62 | |||
63 | # Default name of u-boot initial env, but enable individual recipes to change | ||
64 | # this value. | ||
65 | UBOOT_INITIAL_ENV ?= "${PN}-initial-env" | ||
66 | |||
67 | # U-Boot EXTLINUX variables. U-Boot searches for /boot/extlinux/extlinux.conf | ||
68 | # to find EXTLINUX conf file. | ||
69 | UBOOT_EXTLINUX_INSTALL_DIR ?= "/boot/extlinux" | ||
70 | UBOOT_EXTLINUX_CONF_NAME ?= "extlinux.conf" | ||
71 | UBOOT_EXTLINUX_SYMLINK ?= "${UBOOT_EXTLINUX_CONF_NAME}-${MACHINE}-${PR}" | ||
72 | |||
73 | do_configure () { | 27 | do_configure () { |
74 | if [ -n "${UBOOT_CONFIG}" ]; then | 28 | if [ -n "${UBOOT_CONFIG}" ]; then |
75 | unset i j | 29 | unset i j |