blob: f6a68da0f6bb2c3d0ea153f724e9de29853fe593 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001SUMMARY = "Universal Boot Loader for embedded devices"
Patrick Williamsc124f4f2015-09-15 14:41:29 -05002PROVIDES = "virtual/bootloader"
3
Patrick Williamsc124f4f2015-09-15 14:41:29 -05004PACKAGE_ARCH = "${MACHINE_ARCH}"
5
Brad Bishop19323692019-04-05 15:28:33 -04006DEPENDS += "kern-tools-native"
7
Andrew Geissler82c905d2020-04-13 13:39:40 -05008inherit uboot-config uboot-extlinux-config uboot-sign deploy cml1 python3native
Patrick Williamsc124f4f2015-09-15 14:41:29 -05009
Andrew Geissler82c905d2020-04-13 13:39:40 -050010DEPENDS += "swig-native"
Brad Bishopd5ae7d92018-06-14 09:52:03 -070011
Patrick Williamsc124f4f2015-09-15 14:41:29 -050012EXTRA_OEMAKE = 'CROSS_COMPILE=${TARGET_PREFIX} CC="${TARGET_PREFIX}gcc ${TOOLCHAIN_OPTIONS}" V=1'
13EXTRA_OEMAKE += 'HOSTCC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}"'
Andrew Geissler82c905d2020-04-13 13:39:40 -050014EXTRA_OEMAKE += 'STAGING_INCDIR=${STAGING_INCDIR_NATIVE} STAGING_LIBDIR=${STAGING_LIBDIR_NATIVE}'
Patrick Williamsc124f4f2015-09-15 14:41:29 -050015
16PACKAGECONFIG ??= "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.
20PACKAGECONFIG[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.
25UBOOT_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.
29UBOOT_SUFFIX ??= "bin"
30UBOOT_IMAGE ?= "u-boot-${MACHINE}-${PV}-${PR}.${UBOOT_SUFFIX}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050031UBOOT_SYMLINK ?= "u-boot-${MACHINE}.${UBOOT_SUFFIX}"
32UBOOT_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.
37UBOOT_ELF ?= ""
38UBOOT_ELF_SUFFIX ?= "elf"
39UBOOT_ELF_IMAGE ?= "u-boot-${MACHINE}-${PV}-${PR}.${UBOOT_ELF_SUFFIX}"
40UBOOT_ELF_BINARY ?= "u-boot.${UBOOT_ELF_SUFFIX}"
41UBOOT_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.
47SPL_BINARY ?= ""
Brad Bishop6e60e8b2018-02-01 10:27:11 -050048SPL_BINARYNAME ?= "${@os.path.basename(d.getVar("SPL_BINARY"))}"
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050049SPL_IMAGE ?= "${SPL_BINARYNAME}-${MACHINE}-${PV}-${PR}"
50SPL_SYMLINK ?= "${SPL_BINARYNAME}-${MACHINE}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050051
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.
57UBOOT_ENV_SUFFIX ?= "txt"
58UBOOT_ENV ?= ""
59UBOOT_ENV_BINARY ?= "${UBOOT_ENV}.${UBOOT_ENV_SUFFIX}"
60UBOOT_ENV_IMAGE ?= "${UBOOT_ENV}-${MACHINE}-${PV}-${PR}.${UBOOT_ENV_SUFFIX}"
61UBOOT_ENV_SYMLINK ?= "${UBOOT_ENV}-${MACHINE}.${UBOOT_ENV_SUFFIX}"
62
Andrew Geissler4ed12e12020-06-05 18:00:41 -050063# Default name of u-boot initial env, but enable individual recipes to change
64# this value.
65UBOOT_INITIAL_ENV ?= "${PN}-initial-env"
66
Patrick Williamsc0f7c042017-02-23 20:41:17 -060067# U-Boot EXTLINUX variables. U-Boot searches for /boot/extlinux/extlinux.conf
68# to find EXTLINUX conf file.
69UBOOT_EXTLINUX_INSTALL_DIR ?= "/boot/extlinux"
70UBOOT_EXTLINUX_CONF_NAME ?= "extlinux.conf"
71UBOOT_EXTLINUX_SYMLINK ?= "${UBOOT_EXTLINUX_CONF_NAME}-${MACHINE}-${PR}"
72
Brad Bishop19323692019-04-05 15:28:33 -040073# returns all the elements from the src uri that are .cfg files
74def find_cfgs(d):
75 sources=src_patches(d, True)
76 sources_list=[]
77 for s in sources:
78 if s.endswith('.cfg'):
79 sources_list.append(s)
80
81 return sources_list
82
83do_configure () {
Andrew Geissler5a43b432020-06-13 10:46:56 -050084 if [ -n "${UBOOT_CONFIG}" ]; then
85 unset i j
86 for config in ${UBOOT_MACHINE}; do
87 i=$(expr $i + 1);
88 for type in ${UBOOT_CONFIG}; do
89 j=$(expr $j + 1);
90 if [ $j -eq $i ]; then
91 oe_runmake -C ${S} O=${B}/${config} ${config}
92 merge_config.sh -m -O ${B}/${config} ${B}/${config}/.config ${@" ".join(find_cfgs(d))}
93 oe_runmake -C ${S} O=${B}/${config} oldconfig
94 fi
95 done
96 unset j
97 done
98 unset i
99 DEVTOOL_DISABLE_MENUCONFIG=true
100 else
Brad Bishop19323692019-04-05 15:28:33 -0400101 if [ -n "${UBOOT_MACHINE}" ]; then
102 oe_runmake -C ${S} O=${B} ${UBOOT_MACHINE}
103 else
104 oe_runmake -C ${S} O=${B} oldconfig
105 fi
106 merge_config.sh -m .config ${@" ".join(find_cfgs(d))}
107 cml1_do_configure
108 fi
109}
110
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500111do_compile () {
Andrew Geissler4ed12e12020-06-05 18:00:41 -0500112 if [ "${@bb.utils.filter('DISTRO_FEATURES', 'ld-is-gold', d)}" ]; then
113 sed -i 's/$(CROSS_COMPILE)ld$/$(CROSS_COMPILE)ld.bfd/g' ${S}/config.mk
114 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500115
Andrew Geissler4ed12e12020-06-05 18:00:41 -0500116 unset LDFLAGS
117 unset CFLAGS
118 unset CPPFLAGS
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500119
Andrew Geissler4ed12e12020-06-05 18:00:41 -0500120 if [ ! -e ${B}/.scmversion -a ! -e ${S}/.scmversion ]
121 then
122 echo ${UBOOT_LOCALVERSION} > ${B}/.scmversion
123 echo ${UBOOT_LOCALVERSION} > ${S}/.scmversion
124 fi
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600125
126 if [ -n "${UBOOT_CONFIG}" ]
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500127 then
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600128 unset i j k
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500129 for config in ${UBOOT_MACHINE}; do
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600130 i=$(expr $i + 1);
131 for type in ${UBOOT_CONFIG}; do
132 j=$(expr $j + 1);
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500133 if [ $j -eq $i ]
134 then
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600135 oe_runmake -C ${S} O=${B}/${config} ${UBOOT_MAKE_TARGET}
136 for binary in ${UBOOT_BINARIES}; do
137 k=$(expr $k + 1);
138 if [ $k -eq $i ]; then
139 cp ${B}/${config}/${binary} ${B}/${config}/u-boot-${type}.${UBOOT_SUFFIX}
140 fi
141 done
Andrew Geissler82c905d2020-04-13 13:39:40 -0500142
143 # Generate the uboot-initial-env
Andrew Geissler4ed12e12020-06-05 18:00:41 -0500144 if [ -n "${UBOOT_INITIAL_ENV}" ]; then
145 oe_runmake -C ${S} O=${B}/${config} u-boot-initial-env
146 cp ${B}/${config}/u-boot-initial-env ${B}/${config}/u-boot-initial-env-${type}
147 fi
Andrew Geissler82c905d2020-04-13 13:39:40 -0500148
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600149 unset k
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500150 fi
151 done
Andrew Geissler4ed12e12020-06-05 18:00:41 -0500152 unset j
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500153 done
Andrew Geissler4ed12e12020-06-05 18:00:41 -0500154 unset i
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500155 else
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600156 oe_runmake -C ${S} O=${B} ${UBOOT_MAKE_TARGET}
Andrew Geissler82c905d2020-04-13 13:39:40 -0500157
158 # Generate the uboot-initial-env
Andrew Geissler4ed12e12020-06-05 18:00:41 -0500159 if [ -n "${UBOOT_INITIAL_ENV}" ]; then
160 oe_runmake -C ${S} O=${B} u-boot-initial-env
161 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500162 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500163}
164
165do_install () {
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600166 if [ -n "${UBOOT_CONFIG}" ]
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500167 then
168 for config in ${UBOOT_MACHINE}; do
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600169 i=$(expr $i + 1);
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500170 for type in ${UBOOT_CONFIG}; do
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600171 j=$(expr $j + 1);
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500172 if [ $j -eq $i ]
173 then
Andrew Geissler82c905d2020-04-13 13:39:40 -0500174 install -D -m 644 ${B}/${config}/u-boot-${type}.${UBOOT_SUFFIX} ${D}/boot/u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500175 ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${D}/boot/${UBOOT_BINARY}-${type}
176 ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${D}/boot/${UBOOT_BINARY}
Andrew Geissler82c905d2020-04-13 13:39:40 -0500177
178 # Install the uboot-initial-env
Andrew Geissler4ed12e12020-06-05 18:00:41 -0500179 if [ -n "${UBOOT_INITIAL_ENV}" ]; then
180 install -D -m 644 ${B}/${config}/u-boot-initial-env-${type} ${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}-${MACHINE}-${type}-${PV}-${PR}
181 ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${type}-${PV}-${PR} ${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}-${MACHINE}-${type}
182 ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${type}-${PV}-${PR} ${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}-${type}
183 ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${type}-${PV}-${PR} ${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}
184 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500185 fi
186 done
Andrew Geissler4ed12e12020-06-05 18:00:41 -0500187 unset j
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500188 done
Andrew Geissler4ed12e12020-06-05 18:00:41 -0500189 unset i
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500190 else
Andrew Geissler82c905d2020-04-13 13:39:40 -0500191 install -D -m 644 ${B}/${UBOOT_BINARY} ${D}/boot/${UBOOT_IMAGE}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500192 ln -sf ${UBOOT_IMAGE} ${D}/boot/${UBOOT_BINARY}
Andrew Geissler82c905d2020-04-13 13:39:40 -0500193
194 # Install the uboot-initial-env
Andrew Geissler4ed12e12020-06-05 18:00:41 -0500195 if [ -n "${UBOOT_INITIAL_ENV}" ]; then
196 install -D -m 644 ${B}/u-boot-initial-env ${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}-${MACHINE}-${PV}-${PR}
197 ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${PV}-${PR} ${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}-${MACHINE}
198 ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${PV}-${PR} ${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}
199 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500200 fi
201
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600202 if [ -n "${UBOOT_ELF}" ]
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500203 then
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600204 if [ -n "${UBOOT_CONFIG}" ]
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500205 then
206 for config in ${UBOOT_MACHINE}; do
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600207 i=$(expr $i + 1);
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500208 for type in ${UBOOT_CONFIG}; do
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600209 j=$(expr $j + 1);
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500210 if [ $j -eq $i ]
211 then
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600212 install -m 644 ${B}/${config}/${UBOOT_ELF} ${D}/boot/u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500213 ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${D}/boot/${UBOOT_BINARY}-${type}
214 ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${D}/boot/${UBOOT_BINARY}
215 fi
216 done
217 unset j
218 done
219 unset i
220 else
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600221 install -m 644 ${B}/${UBOOT_ELF} ${D}/boot/${UBOOT_ELF_IMAGE}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500222 ln -sf ${UBOOT_ELF_IMAGE} ${D}/boot/${UBOOT_ELF_BINARY}
223 fi
224 fi
225
226 if [ -e ${WORKDIR}/fw_env.config ] ; then
227 install -d ${D}${sysconfdir}
228 install -m 644 ${WORKDIR}/fw_env.config ${D}${sysconfdir}/fw_env.config
229 fi
230
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600231 if [ -n "${SPL_BINARY}" ]
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500232 then
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600233 if [ -n "${UBOOT_CONFIG}" ]
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500234 then
235 for config in ${UBOOT_MACHINE}; do
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600236 i=$(expr $i + 1);
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500237 for type in ${UBOOT_CONFIG}; do
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600238 j=$(expr $j + 1);
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500239 if [ $j -eq $i ]
240 then
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600241 install -m 644 ${B}/${config}/${SPL_BINARY} ${D}/boot/${SPL_IMAGE}-${type}-${PV}-${PR}
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500242 ln -sf ${SPL_IMAGE}-${type}-${PV}-${PR} ${D}/boot/${SPL_BINARYNAME}-${type}
243 ln -sf ${SPL_IMAGE}-${type}-${PV}-${PR} ${D}/boot/${SPL_BINARYNAME}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500244 fi
245 done
Andrew Geissler4ed12e12020-06-05 18:00:41 -0500246 unset j
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500247 done
Andrew Geissler4ed12e12020-06-05 18:00:41 -0500248 unset i
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500249 else
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600250 install -m 644 ${B}/${SPL_BINARY} ${D}/boot/${SPL_IMAGE}
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500251 ln -sf ${SPL_IMAGE} ${D}/boot/${SPL_BINARYNAME}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500252 fi
253 fi
254
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600255 if [ -n "${UBOOT_ENV}" ]
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500256 then
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600257 install -m 644 ${WORKDIR}/${UBOOT_ENV_BINARY} ${D}/boot/${UBOOT_ENV_IMAGE}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500258 ln -sf ${UBOOT_ENV_IMAGE} ${D}/boot/${UBOOT_ENV_BINARY}
259 fi
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600260
261 if [ "${UBOOT_EXTLINUX}" = "1" ]
262 then
263 install -Dm 0644 ${UBOOT_EXTLINUX_CONFIG} ${D}/${UBOOT_EXTLINUX_INSTALL_DIR}/${UBOOT_EXTLINUX_CONF_NAME}
264 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500265}
266
Andrew Geissler82c905d2020-04-13 13:39:40 -0500267PACKAGE_BEFORE_PN += "${PN}-env"
268
269RPROVIDES_${PN}-env += "u-boot-default-env"
Andrew Geissler4ed12e12020-06-05 18:00:41 -0500270ALLOW_EMPTY_${PN}-env = "1"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500271FILES_${PN}-env = " \
Andrew Geissler4ed12e12020-06-05 18:00:41 -0500272 ${@ '${sysconfdir}/${UBOOT_INITIAL_ENV}*' if d.getVar('UBOOT_INITIAL_ENV') else ''} \
Andrew Geissler82c905d2020-04-13 13:39:40 -0500273 ${sysconfdir}/fw_env.config \
274"
275
276FILES_${PN} = "/boot ${datadir}"
277RDEPENDS_${PN} += "${PN}-env"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500278
279do_deploy () {
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600280 if [ -n "${UBOOT_CONFIG}" ]
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500281 then
282 for config in ${UBOOT_MACHINE}; do
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600283 i=$(expr $i + 1);
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500284 for type in ${UBOOT_CONFIG}; do
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600285 j=$(expr $j + 1);
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500286 if [ $j -eq $i ]
287 then
Andrew Geissler82c905d2020-04-13 13:39:40 -0500288 install -D -m 644 ${B}/${config}/u-boot-${type}.${UBOOT_SUFFIX} ${DEPLOYDIR}/u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500289 cd ${DEPLOYDIR}
290 ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${UBOOT_SYMLINK}-${type}
291 ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${UBOOT_SYMLINK}
292 ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${UBOOT_BINARY}-${type}
293 ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${UBOOT_BINARY}
Andrew Geissler82c905d2020-04-13 13:39:40 -0500294
295 # Deploy the uboot-initial-env
Andrew Geissler4ed12e12020-06-05 18:00:41 -0500296 if [ -n "${UBOOT_INITIAL_ENV}" ]; then
297 install -D -m 644 ${B}/${config}/u-boot-initial-env-${type} ${DEPLOYDIR}/${UBOOT_INITIAL_ENV}-${MACHINE}-${type}-${PV}-${PR}
298 cd ${DEPLOYDIR}
299 ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${type}-${PV}-${PR} ${UBOOT_INITIAL_ENV}-${MACHINE}-${type}
300 ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${type}-${PV}-${PR} ${UBOOT_INITIAL_ENV}-${type}
301 fi
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600302 fi
303 done
Andrew Geissler4ed12e12020-06-05 18:00:41 -0500304 unset j
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500305 done
Andrew Geissler4ed12e12020-06-05 18:00:41 -0500306 unset i
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500307 else
Andrew Geissler82c905d2020-04-13 13:39:40 -0500308 install -D -m 644 ${B}/${UBOOT_BINARY} ${DEPLOYDIR}/${UBOOT_IMAGE}
309
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500310 cd ${DEPLOYDIR}
311 rm -f ${UBOOT_BINARY} ${UBOOT_SYMLINK}
312 ln -sf ${UBOOT_IMAGE} ${UBOOT_SYMLINK}
313 ln -sf ${UBOOT_IMAGE} ${UBOOT_BINARY}
Andrew Geissler82c905d2020-04-13 13:39:40 -0500314
315 # Deploy the uboot-initial-env
Andrew Geissler4ed12e12020-06-05 18:00:41 -0500316 if [ -n "${UBOOT_INITIAL_ENV}" ]; then
317 install -D -m 644 ${B}/u-boot-initial-env ${DEPLOYDIR}/${UBOOT_INITIAL_ENV}-${MACHINE}-${PV}-${PR}
318 cd ${DEPLOYDIR}
319 ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${PV}-${PR} ${UBOOT_INITIAL_ENV}-${MACHINE}
320 ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${PV}-${PR} ${UBOOT_INITIAL_ENV}
321 fi
Andrew Geissler82c905d2020-04-13 13:39:40 -0500322 fi
323
324 if [ -e ${WORKDIR}/fw_env.config ] ; then
325 install -D -m 644 ${WORKDIR}/fw_env.config ${DEPLOYDIR}/fw_env.config-${MACHINE}-${PV}-${PR}
326 cd ${DEPLOYDIR}
327 ln -sf fw_env.config-${MACHINE}-${PV}-${PR} fw_env.config-${MACHINE}
328 ln -sf fw_env.config-${MACHINE}-${PV}-${PR} fw_env.config
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800329 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500330
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600331 if [ -n "${UBOOT_ELF}" ]
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500332 then
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600333 if [ -n "${UBOOT_CONFIG}" ]
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500334 then
335 for config in ${UBOOT_MACHINE}; do
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600336 i=$(expr $i + 1);
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500337 for type in ${UBOOT_CONFIG}; do
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600338 j=$(expr $j + 1);
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500339 if [ $j -eq $i ]
340 then
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600341 install -m 644 ${B}/${config}/${UBOOT_ELF} ${DEPLOYDIR}/u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500342 ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${DEPLOYDIR}/${UBOOT_ELF_BINARY}-${type}
343 ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${DEPLOYDIR}/${UBOOT_ELF_BINARY}
344 ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${DEPLOYDIR}/${UBOOT_ELF_SYMLINK}-${type}
345 ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${DEPLOYDIR}/${UBOOT_ELF_SYMLINK}
346 fi
347 done
348 unset j
349 done
350 unset i
351 else
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600352 install -m 644 ${B}/${UBOOT_ELF} ${DEPLOYDIR}/${UBOOT_ELF_IMAGE}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500353 ln -sf ${UBOOT_ELF_IMAGE} ${DEPLOYDIR}/${UBOOT_ELF_BINARY}
354 ln -sf ${UBOOT_ELF_IMAGE} ${DEPLOYDIR}/${UBOOT_ELF_SYMLINK}
355 fi
356 fi
357
358
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600359 if [ -n "${SPL_BINARY}" ]
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500360 then
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800361 if [ -n "${UBOOT_CONFIG}" ]
362 then
363 for config in ${UBOOT_MACHINE}; do
364 i=$(expr $i + 1);
365 for type in ${UBOOT_CONFIG}; do
366 j=$(expr $j + 1);
367 if [ $j -eq $i ]
368 then
369 install -m 644 ${B}/${config}/${SPL_BINARY} ${DEPLOYDIR}/${SPL_IMAGE}-${type}-${PV}-${PR}
370 rm -f ${DEPLOYDIR}/${SPL_BINARYNAME} ${DEPLOYDIR}/${SPL_SYMLINK}-${type}
371 ln -sf ${SPL_IMAGE}-${type}-${PV}-${PR} ${DEPLOYDIR}/${SPL_BINARYNAME}-${type}
372 ln -sf ${SPL_IMAGE}-${type}-${PV}-${PR} ${DEPLOYDIR}/${SPL_BINARYNAME}
373 ln -sf ${SPL_IMAGE}-${type}-${PV}-${PR} ${DEPLOYDIR}/${SPL_SYMLINK}-${type}
374 ln -sf ${SPL_IMAGE}-${type}-${PV}-${PR} ${DEPLOYDIR}/${SPL_SYMLINK}
375 fi
376 done
Andrew Geissler4ed12e12020-06-05 18:00:41 -0500377 unset j
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800378 done
Andrew Geissler4ed12e12020-06-05 18:00:41 -0500379 unset i
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800380 else
381 install -m 644 ${B}/${SPL_BINARY} ${DEPLOYDIR}/${SPL_IMAGE}
382 rm -f ${DEPLOYDIR}/${SPL_BINARYNAME} ${DEPLOYDIR}/${SPL_SYMLINK}
383 ln -sf ${SPL_IMAGE} ${DEPLOYDIR}/${SPL_BINARYNAME}
384 ln -sf ${SPL_IMAGE} ${DEPLOYDIR}/${SPL_SYMLINK}
385 fi
386 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500387
388
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600389 if [ -n "${UBOOT_ENV}" ]
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500390 then
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600391 install -m 644 ${WORKDIR}/${UBOOT_ENV_BINARY} ${DEPLOYDIR}/${UBOOT_ENV_IMAGE}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500392 rm -f ${DEPLOYDIR}/${UBOOT_ENV_BINARY} ${DEPLOYDIR}/${UBOOT_ENV_SYMLINK}
393 ln -sf ${UBOOT_ENV_IMAGE} ${DEPLOYDIR}/${UBOOT_ENV_BINARY}
394 ln -sf ${UBOOT_ENV_IMAGE} ${DEPLOYDIR}/${UBOOT_ENV_SYMLINK}
395 fi
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600396
397 if [ "${UBOOT_EXTLINUX}" = "1" ]
398 then
399 install -m 644 ${UBOOT_EXTLINUX_CONFIG} ${DEPLOYDIR}/${UBOOT_EXTLINUX_SYMLINK}
400 ln -sf ${UBOOT_EXTLINUX_SYMLINK} ${DEPLOYDIR}/${UBOOT_EXTLINUX_CONF_NAME}-${MACHINE}
401 ln -sf ${UBOOT_EXTLINUX_SYMLINK} ${DEPLOYDIR}/${UBOOT_EXTLINUX_CONF_NAME}
402 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500403}
404
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500405addtask deploy before do_build after do_compile