Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | SUMMARY = "Universal Boot Loader for embedded devices" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 2 | PROVIDES = "virtual/bootloader" |
| 3 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 4 | PACKAGE_ARCH = "${MACHINE_ARCH}" |
| 5 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 6 | DEPENDS += "kern-tools-native" |
| 7 | |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 8 | inherit uboot-config uboot-extlinux-config uboot-sign deploy cml1 python3native |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 9 | |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 10 | DEPENDS += "swig-native" |
Brad Bishop | d5ae7d9 | 2018-06-14 09:52:03 -0700 | [diff] [blame] | 11 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 12 | EXTRA_OEMAKE = 'CROSS_COMPILE=${TARGET_PREFIX} CC="${TARGET_PREFIX}gcc ${TOOLCHAIN_OPTIONS}" V=1' |
| 13 | EXTRA_OEMAKE += 'HOSTCC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}"' |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 14 | EXTRA_OEMAKE += 'STAGING_INCDIR=${STAGING_INCDIR_NATIVE} STAGING_LIBDIR=${STAGING_LIBDIR_NATIVE}' |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 15 | |
| 16 | PACKAGECONFIG ??= "openssl" |
| 17 | # u-boot will compile its own tools during the build, with specific |
| 18 | # configurations (aka when CONFIG_FIT_SIGNATURE is enabled) openssl is needed as |
| 19 | # a host build dependency. |
| 20 | PACKAGECONFIG[openssl] = ",,openssl-native" |
| 21 | |
| 22 | # Allow setting an additional version string that will be picked up by the |
| 23 | # u-boot build system and appended to the u-boot version. If the .scmversion |
| 24 | # file already exists it will not be overwritten. |
| 25 | UBOOT_LOCALVERSION ?= "" |
| 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}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 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 ?= "" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 48 | SPL_BINARYNAME ?= "${@os.path.basename(d.getVar("SPL_BINARY"))}" |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 49 | SPL_IMAGE ?= "${SPL_BINARYNAME}-${MACHINE}-${PV}-${PR}" |
| 50 | SPL_SYMLINK ?= "${SPL_BINARYNAME}-${MACHINE}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 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 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 63 | # U-Boot EXTLINUX variables. U-Boot searches for /boot/extlinux/extlinux.conf |
| 64 | # to find EXTLINUX conf file. |
| 65 | UBOOT_EXTLINUX_INSTALL_DIR ?= "/boot/extlinux" |
| 66 | UBOOT_EXTLINUX_CONF_NAME ?= "extlinux.conf" |
| 67 | UBOOT_EXTLINUX_SYMLINK ?= "${UBOOT_EXTLINUX_CONF_NAME}-${MACHINE}-${PR}" |
| 68 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 69 | # returns all the elements from the src uri that are .cfg files |
| 70 | def find_cfgs(d): |
| 71 | sources=src_patches(d, True) |
| 72 | sources_list=[] |
| 73 | for s in sources: |
| 74 | if s.endswith('.cfg'): |
| 75 | sources_list.append(s) |
| 76 | |
| 77 | return sources_list |
| 78 | |
| 79 | do_configure () { |
| 80 | if [ -z "${UBOOT_CONFIG}" ]; then |
| 81 | if [ -n "${UBOOT_MACHINE}" ]; then |
| 82 | oe_runmake -C ${S} O=${B} ${UBOOT_MACHINE} |
| 83 | else |
| 84 | oe_runmake -C ${S} O=${B} oldconfig |
| 85 | fi |
| 86 | merge_config.sh -m .config ${@" ".join(find_cfgs(d))} |
| 87 | cml1_do_configure |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 88 | else |
| 89 | DEVTOOL_DISABLE_MENUCONFIG=true |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 90 | fi |
| 91 | } |
| 92 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 93 | do_compile () { |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 94 | if [ "${@bb.utils.filter('DISTRO_FEATURES', 'ld-is-gold', d)}" ]; then |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 95 | sed -i 's/$(CROSS_COMPILE)ld$/$(CROSS_COMPILE)ld.bfd/g' ${S}/config.mk |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 96 | fi |
| 97 | |
| 98 | unset LDFLAGS |
| 99 | unset CFLAGS |
| 100 | unset CPPFLAGS |
| 101 | |
| 102 | if [ ! -e ${B}/.scmversion -a ! -e ${S}/.scmversion ] |
| 103 | then |
| 104 | echo ${UBOOT_LOCALVERSION} > ${B}/.scmversion |
| 105 | echo ${UBOOT_LOCALVERSION} > ${S}/.scmversion |
| 106 | fi |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 107 | |
| 108 | if [ -n "${UBOOT_CONFIG}" ] |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 109 | then |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 110 | unset i j k |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 111 | for config in ${UBOOT_MACHINE}; do |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 112 | i=$(expr $i + 1); |
| 113 | for type in ${UBOOT_CONFIG}; do |
| 114 | j=$(expr $j + 1); |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 115 | if [ $j -eq $i ] |
| 116 | then |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 117 | oe_runmake -C ${S} O=${B}/${config} ${config} |
| 118 | oe_runmake -C ${S} O=${B}/${config} ${UBOOT_MAKE_TARGET} |
| 119 | for binary in ${UBOOT_BINARIES}; do |
| 120 | k=$(expr $k + 1); |
| 121 | if [ $k -eq $i ]; then |
| 122 | cp ${B}/${config}/${binary} ${B}/${config}/u-boot-${type}.${UBOOT_SUFFIX} |
| 123 | fi |
| 124 | done |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 125 | |
| 126 | # Generate the uboot-initial-env |
| 127 | oe_runmake -C ${S} O=${B}/${config} u-boot-initial-env |
| 128 | cp ${B}/${config}/u-boot-initial-env ${B}/${config}/u-boot-initial-env-${type} |
| 129 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 130 | unset k |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 131 | fi |
| 132 | done |
| 133 | unset j |
| 134 | done |
| 135 | unset i |
| 136 | else |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 137 | oe_runmake -C ${S} O=${B} ${UBOOT_MAKE_TARGET} |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 138 | |
| 139 | # Generate the uboot-initial-env |
| 140 | oe_runmake -C ${S} O=${B} u-boot-initial-env |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 141 | fi |
| 142 | |
| 143 | } |
| 144 | |
| 145 | do_install () { |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 146 | if [ -n "${UBOOT_CONFIG}" ] |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 147 | then |
| 148 | for config in ${UBOOT_MACHINE}; do |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 149 | i=$(expr $i + 1); |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 150 | for type in ${UBOOT_CONFIG}; do |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 151 | j=$(expr $j + 1); |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 152 | if [ $j -eq $i ] |
| 153 | then |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 154 | install -D -m 644 ${B}/${config}/u-boot-${type}.${UBOOT_SUFFIX} ${D}/boot/u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 155 | ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${D}/boot/${UBOOT_BINARY}-${type} |
| 156 | ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${D}/boot/${UBOOT_BINARY} |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 157 | |
| 158 | # Install the uboot-initial-env |
| 159 | install -D -m 644 ${B}/${config}/u-boot-initial-env-${type} ${D}/${sysconfdir}/${PN}-initial-env-${MACHINE}-${type}-${PV}-${PR} |
| 160 | ln -sf ${PN}-initial-env-${MACHINE}-${type}-${PV}-${PR} ${D}/${sysconfdir}/${PN}-initial-env-${MACHINE}-${type} |
| 161 | ln -sf ${PN}-initial-env-${MACHINE}-${type}-${PV}-${PR} ${D}/${sysconfdir}/${PN}-initial-env-${type} |
| 162 | ln -sf ${PN}-initial-env-${MACHINE}-${type}-${PV}-${PR} ${D}/${sysconfdir}/${PN}-initial-env |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 163 | fi |
| 164 | done |
| 165 | unset j |
| 166 | done |
| 167 | unset i |
| 168 | else |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 169 | install -D -m 644 ${B}/${UBOOT_BINARY} ${D}/boot/${UBOOT_IMAGE} |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 170 | ln -sf ${UBOOT_IMAGE} ${D}/boot/${UBOOT_BINARY} |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 171 | |
| 172 | # Install the uboot-initial-env |
| 173 | install -D -m 644 ${B}/u-boot-initial-env ${D}/${sysconfdir}/${PN}-initial-env-${MACHINE}-${PV}-${PR} |
| 174 | ln -sf ${PN}-initial-env-${MACHINE}-${PV}-${PR} ${D}/${sysconfdir}/${PN}-initial-env-${MACHINE} |
| 175 | ln -sf ${PN}-initial-env-${MACHINE}-${PV}-${PR} ${D}/${sysconfdir}/${PN}-initial-env |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 176 | fi |
| 177 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 178 | if [ -n "${UBOOT_ELF}" ] |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 179 | then |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 180 | if [ -n "${UBOOT_CONFIG}" ] |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 181 | then |
| 182 | for config in ${UBOOT_MACHINE}; do |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 183 | i=$(expr $i + 1); |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 184 | for type in ${UBOOT_CONFIG}; do |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 185 | j=$(expr $j + 1); |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 186 | if [ $j -eq $i ] |
| 187 | then |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 188 | install -m 644 ${B}/${config}/${UBOOT_ELF} ${D}/boot/u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 189 | ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${D}/boot/${UBOOT_BINARY}-${type} |
| 190 | ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${D}/boot/${UBOOT_BINARY} |
| 191 | fi |
| 192 | done |
| 193 | unset j |
| 194 | done |
| 195 | unset i |
| 196 | else |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 197 | install -m 644 ${B}/${UBOOT_ELF} ${D}/boot/${UBOOT_ELF_IMAGE} |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 198 | ln -sf ${UBOOT_ELF_IMAGE} ${D}/boot/${UBOOT_ELF_BINARY} |
| 199 | fi |
| 200 | fi |
| 201 | |
| 202 | if [ -e ${WORKDIR}/fw_env.config ] ; then |
| 203 | install -d ${D}${sysconfdir} |
| 204 | install -m 644 ${WORKDIR}/fw_env.config ${D}${sysconfdir}/fw_env.config |
| 205 | fi |
| 206 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 207 | if [ -n "${SPL_BINARY}" ] |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 208 | then |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 209 | if [ -n "${UBOOT_CONFIG}" ] |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 210 | then |
| 211 | for config in ${UBOOT_MACHINE}; do |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 212 | i=$(expr $i + 1); |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 213 | for type in ${UBOOT_CONFIG}; do |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 214 | j=$(expr $j + 1); |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 215 | if [ $j -eq $i ] |
| 216 | then |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 217 | install -m 644 ${B}/${config}/${SPL_BINARY} ${D}/boot/${SPL_IMAGE}-${type}-${PV}-${PR} |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 218 | ln -sf ${SPL_IMAGE}-${type}-${PV}-${PR} ${D}/boot/${SPL_BINARYNAME}-${type} |
| 219 | ln -sf ${SPL_IMAGE}-${type}-${PV}-${PR} ${D}/boot/${SPL_BINARYNAME} |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 220 | fi |
| 221 | done |
| 222 | unset j |
| 223 | done |
| 224 | unset i |
| 225 | else |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 226 | install -m 644 ${B}/${SPL_BINARY} ${D}/boot/${SPL_IMAGE} |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 227 | ln -sf ${SPL_IMAGE} ${D}/boot/${SPL_BINARYNAME} |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 228 | fi |
| 229 | fi |
| 230 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 231 | if [ -n "${UBOOT_ENV}" ] |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 232 | then |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 233 | install -m 644 ${WORKDIR}/${UBOOT_ENV_BINARY} ${D}/boot/${UBOOT_ENV_IMAGE} |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 234 | ln -sf ${UBOOT_ENV_IMAGE} ${D}/boot/${UBOOT_ENV_BINARY} |
| 235 | fi |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 236 | |
| 237 | if [ "${UBOOT_EXTLINUX}" = "1" ] |
| 238 | then |
| 239 | install -Dm 0644 ${UBOOT_EXTLINUX_CONFIG} ${D}/${UBOOT_EXTLINUX_INSTALL_DIR}/${UBOOT_EXTLINUX_CONF_NAME} |
| 240 | fi |
| 241 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 242 | } |
| 243 | |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 244 | PACKAGE_BEFORE_PN += "${PN}-env" |
| 245 | |
| 246 | RPROVIDES_${PN}-env += "u-boot-default-env" |
| 247 | FILES_${PN}-env = " \ |
| 248 | ${sysconfdir}/${PN}-initial-env* \ |
| 249 | ${sysconfdir}/fw_env.config \ |
| 250 | " |
| 251 | |
| 252 | FILES_${PN} = "/boot ${datadir}" |
| 253 | RDEPENDS_${PN} += "${PN}-env" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 254 | |
| 255 | do_deploy () { |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 256 | if [ -n "${UBOOT_CONFIG}" ] |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 257 | then |
| 258 | for config in ${UBOOT_MACHINE}; do |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 259 | i=$(expr $i + 1); |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 260 | for type in ${UBOOT_CONFIG}; do |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 261 | j=$(expr $j + 1); |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 262 | if [ $j -eq $i ] |
| 263 | then |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 264 | install -D -m 644 ${B}/${config}/u-boot-${type}.${UBOOT_SUFFIX} ${DEPLOYDIR}/u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 265 | cd ${DEPLOYDIR} |
| 266 | ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${UBOOT_SYMLINK}-${type} |
| 267 | ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${UBOOT_SYMLINK} |
| 268 | ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${UBOOT_BINARY}-${type} |
| 269 | ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${UBOOT_BINARY} |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 270 | |
| 271 | # Deploy the uboot-initial-env |
| 272 | install -D -m 644 ${B}/${config}/u-boot-initial-env-${type} ${DEPLOYDIR}/${PN}-initial-env-${MACHINE}-${type}-${PV}-${PR} |
| 273 | cd ${DEPLOYDIR} |
| 274 | ln -sf ${PN}-initial-env-${MACHINE}-${type}-${PV}-${PR} ${PN}-initial-env-${MACHINE}-${type} |
| 275 | ln -sf ${PN}-initial-env-${MACHINE}-${type}-${PV}-${PR} ${PN}-initial-env-${type} |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 276 | fi |
| 277 | done |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 278 | unset j |
| 279 | done |
| 280 | unset i |
| 281 | else |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 282 | install -D -m 644 ${B}/${UBOOT_BINARY} ${DEPLOYDIR}/${UBOOT_IMAGE} |
| 283 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 284 | cd ${DEPLOYDIR} |
| 285 | rm -f ${UBOOT_BINARY} ${UBOOT_SYMLINK} |
| 286 | ln -sf ${UBOOT_IMAGE} ${UBOOT_SYMLINK} |
| 287 | ln -sf ${UBOOT_IMAGE} ${UBOOT_BINARY} |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 288 | |
| 289 | # Deploy the uboot-initial-env |
| 290 | install -D -m 644 ${B}/u-boot-initial-env ${DEPLOYDIR}/${PN}-initial-env-${MACHINE}-${PV}-${PR} |
| 291 | cd ${DEPLOYDIR} |
| 292 | ln -sf ${PN}-initial-env-${MACHINE}-${PV}-${PR} ${PN}-initial-env-${MACHINE} |
| 293 | ln -sf ${PN}-initial-env-${MACHINE}-${PV}-${PR} ${PN}-initial-env |
| 294 | fi |
| 295 | |
| 296 | if [ -e ${WORKDIR}/fw_env.config ] ; then |
| 297 | install -D -m 644 ${WORKDIR}/fw_env.config ${DEPLOYDIR}/fw_env.config-${MACHINE}-${PV}-${PR} |
| 298 | cd ${DEPLOYDIR} |
| 299 | ln -sf fw_env.config-${MACHINE}-${PV}-${PR} fw_env.config-${MACHINE} |
| 300 | ln -sf fw_env.config-${MACHINE}-${PV}-${PR} fw_env.config |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 301 | fi |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 302 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 303 | if [ -n "${UBOOT_ELF}" ] |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 304 | then |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 305 | if [ -n "${UBOOT_CONFIG}" ] |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 306 | then |
| 307 | for config in ${UBOOT_MACHINE}; do |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 308 | i=$(expr $i + 1); |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 309 | for type in ${UBOOT_CONFIG}; do |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 310 | j=$(expr $j + 1); |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 311 | if [ $j -eq $i ] |
| 312 | then |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 313 | install -m 644 ${B}/${config}/${UBOOT_ELF} ${DEPLOYDIR}/u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 314 | ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${DEPLOYDIR}/${UBOOT_ELF_BINARY}-${type} |
| 315 | ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${DEPLOYDIR}/${UBOOT_ELF_BINARY} |
| 316 | ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${DEPLOYDIR}/${UBOOT_ELF_SYMLINK}-${type} |
| 317 | ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${DEPLOYDIR}/${UBOOT_ELF_SYMLINK} |
| 318 | fi |
| 319 | done |
| 320 | unset j |
| 321 | done |
| 322 | unset i |
| 323 | else |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 324 | install -m 644 ${B}/${UBOOT_ELF} ${DEPLOYDIR}/${UBOOT_ELF_IMAGE} |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 325 | ln -sf ${UBOOT_ELF_IMAGE} ${DEPLOYDIR}/${UBOOT_ELF_BINARY} |
| 326 | ln -sf ${UBOOT_ELF_IMAGE} ${DEPLOYDIR}/${UBOOT_ELF_SYMLINK} |
| 327 | fi |
| 328 | fi |
| 329 | |
| 330 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 331 | if [ -n "${SPL_BINARY}" ] |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 332 | then |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 333 | if [ -n "${UBOOT_CONFIG}" ] |
| 334 | then |
| 335 | for config in ${UBOOT_MACHINE}; do |
| 336 | i=$(expr $i + 1); |
| 337 | for type in ${UBOOT_CONFIG}; do |
| 338 | j=$(expr $j + 1); |
| 339 | if [ $j -eq $i ] |
| 340 | then |
| 341 | install -m 644 ${B}/${config}/${SPL_BINARY} ${DEPLOYDIR}/${SPL_IMAGE}-${type}-${PV}-${PR} |
| 342 | rm -f ${DEPLOYDIR}/${SPL_BINARYNAME} ${DEPLOYDIR}/${SPL_SYMLINK}-${type} |
| 343 | ln -sf ${SPL_IMAGE}-${type}-${PV}-${PR} ${DEPLOYDIR}/${SPL_BINARYNAME}-${type} |
| 344 | ln -sf ${SPL_IMAGE}-${type}-${PV}-${PR} ${DEPLOYDIR}/${SPL_BINARYNAME} |
| 345 | ln -sf ${SPL_IMAGE}-${type}-${PV}-${PR} ${DEPLOYDIR}/${SPL_SYMLINK}-${type} |
| 346 | ln -sf ${SPL_IMAGE}-${type}-${PV}-${PR} ${DEPLOYDIR}/${SPL_SYMLINK} |
| 347 | fi |
| 348 | done |
| 349 | unset j |
| 350 | done |
| 351 | unset i |
| 352 | else |
| 353 | install -m 644 ${B}/${SPL_BINARY} ${DEPLOYDIR}/${SPL_IMAGE} |
| 354 | rm -f ${DEPLOYDIR}/${SPL_BINARYNAME} ${DEPLOYDIR}/${SPL_SYMLINK} |
| 355 | ln -sf ${SPL_IMAGE} ${DEPLOYDIR}/${SPL_BINARYNAME} |
| 356 | ln -sf ${SPL_IMAGE} ${DEPLOYDIR}/${SPL_SYMLINK} |
| 357 | fi |
| 358 | fi |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 359 | |
| 360 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 361 | if [ -n "${UBOOT_ENV}" ] |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 362 | then |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 363 | install -m 644 ${WORKDIR}/${UBOOT_ENV_BINARY} ${DEPLOYDIR}/${UBOOT_ENV_IMAGE} |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 364 | rm -f ${DEPLOYDIR}/${UBOOT_ENV_BINARY} ${DEPLOYDIR}/${UBOOT_ENV_SYMLINK} |
| 365 | ln -sf ${UBOOT_ENV_IMAGE} ${DEPLOYDIR}/${UBOOT_ENV_BINARY} |
| 366 | ln -sf ${UBOOT_ENV_IMAGE} ${DEPLOYDIR}/${UBOOT_ENV_SYMLINK} |
| 367 | fi |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 368 | |
| 369 | if [ "${UBOOT_EXTLINUX}" = "1" ] |
| 370 | then |
| 371 | install -m 644 ${UBOOT_EXTLINUX_CONFIG} ${DEPLOYDIR}/${UBOOT_EXTLINUX_SYMLINK} |
| 372 | ln -sf ${UBOOT_EXTLINUX_SYMLINK} ${DEPLOYDIR}/${UBOOT_EXTLINUX_CONF_NAME}-${MACHINE} |
| 373 | ln -sf ${UBOOT_EXTLINUX_SYMLINK} ${DEPLOYDIR}/${UBOOT_EXTLINUX_CONF_NAME} |
| 374 | fi |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 375 | } |
| 376 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 377 | addtask deploy before do_build after do_compile |