blob: 971fdbb102dbcc074073472f69a2ca1841dbf944 [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 Geissler09036742021-06-25 14:25:14 -05008inherit uboot-config uboot-extlinux-config uboot-sign deploy cml1 python3native kernel-arch
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
Brad Bishop19323692019-04-05 15:28:33 -040027do_configure () {
Andrew Geissler5a43b432020-06-13 10:46:56 -050028 if [ -n "${UBOOT_CONFIG}" ]; then
29 unset i j
30 for config in ${UBOOT_MACHINE}; do
31 i=$(expr $i + 1);
32 for type in ${UBOOT_CONFIG}; do
33 j=$(expr $j + 1);
34 if [ $j -eq $i ]; then
35 oe_runmake -C ${S} O=${B}/${config} ${config}
Andrew Geisslerb7d28612020-07-24 16:15:54 -050036 if [ -n "${@' '.join(find_cfgs(d))}" ]; then
Andrew Geisslerd25ed322020-06-27 00:28:28 -050037 merge_config.sh -m -O ${B}/${config} ${B}/${config}/.config ${@" ".join(find_cfgs(d))}
38 oe_runmake -C ${S} O=${B}/${config} oldconfig
39 fi
Andrew Geissler5a43b432020-06-13 10:46:56 -050040 fi
41 done
42 unset j
43 done
44 unset i
45 DEVTOOL_DISABLE_MENUCONFIG=true
46 else
Brad Bishop19323692019-04-05 15:28:33 -040047 if [ -n "${UBOOT_MACHINE}" ]; then
48 oe_runmake -C ${S} O=${B} ${UBOOT_MACHINE}
49 else
50 oe_runmake -C ${S} O=${B} oldconfig
51 fi
52 merge_config.sh -m .config ${@" ".join(find_cfgs(d))}
53 cml1_do_configure
54 fi
55}
56
Patrick Williamsc124f4f2015-09-15 14:41:29 -050057do_compile () {
Andrew Geissler4ed12e12020-06-05 18:00:41 -050058 if [ "${@bb.utils.filter('DISTRO_FEATURES', 'ld-is-gold', d)}" ]; then
59 sed -i 's/$(CROSS_COMPILE)ld$/$(CROSS_COMPILE)ld.bfd/g' ${S}/config.mk
60 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -050061
Andrew Geissler4ed12e12020-06-05 18:00:41 -050062 unset LDFLAGS
63 unset CFLAGS
64 unset CPPFLAGS
Patrick Williamsc124f4f2015-09-15 14:41:29 -050065
Andrew Geissler4ed12e12020-06-05 18:00:41 -050066 if [ ! -e ${B}/.scmversion -a ! -e ${S}/.scmversion ]
67 then
68 echo ${UBOOT_LOCALVERSION} > ${B}/.scmversion
69 echo ${UBOOT_LOCALVERSION} > ${S}/.scmversion
70 fi
Patrick Williamsc0f7c042017-02-23 20:41:17 -060071
Andrew Geisslerd25ed322020-06-27 00:28:28 -050072 if [ -n "${UBOOT_CONFIG}" -o -n "${UBOOT_DELTA_CONFIG}" ]
Patrick Williamsc124f4f2015-09-15 14:41:29 -050073 then
Patrick Williamsc0f7c042017-02-23 20:41:17 -060074 unset i j k
Patrick Williamsc124f4f2015-09-15 14:41:29 -050075 for config in ${UBOOT_MACHINE}; do
Patrick Williamsc0f7c042017-02-23 20:41:17 -060076 i=$(expr $i + 1);
77 for type in ${UBOOT_CONFIG}; do
78 j=$(expr $j + 1);
Patrick Williamsc124f4f2015-09-15 14:41:29 -050079 if [ $j -eq $i ]
80 then
Patrick Williamsc0f7c042017-02-23 20:41:17 -060081 oe_runmake -C ${S} O=${B}/${config} ${UBOOT_MAKE_TARGET}
82 for binary in ${UBOOT_BINARIES}; do
83 k=$(expr $k + 1);
84 if [ $k -eq $i ]; then
85 cp ${B}/${config}/${binary} ${B}/${config}/u-boot-${type}.${UBOOT_SUFFIX}
86 fi
87 done
Andrew Geissler82c905d2020-04-13 13:39:40 -050088
89 # Generate the uboot-initial-env
Andrew Geissler4ed12e12020-06-05 18:00:41 -050090 if [ -n "${UBOOT_INITIAL_ENV}" ]; then
91 oe_runmake -C ${S} O=${B}/${config} u-boot-initial-env
92 cp ${B}/${config}/u-boot-initial-env ${B}/${config}/u-boot-initial-env-${type}
93 fi
Andrew Geissler82c905d2020-04-13 13:39:40 -050094
Patrick Williamsc0f7c042017-02-23 20:41:17 -060095 unset k
Patrick Williamsc124f4f2015-09-15 14:41:29 -050096 fi
97 done
Andrew Geissler4ed12e12020-06-05 18:00:41 -050098 unset j
Patrick Williamsc124f4f2015-09-15 14:41:29 -050099 done
Andrew Geissler4ed12e12020-06-05 18:00:41 -0500100 unset i
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500101 else
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600102 oe_runmake -C ${S} O=${B} ${UBOOT_MAKE_TARGET}
Andrew Geissler82c905d2020-04-13 13:39:40 -0500103
104 # Generate the uboot-initial-env
Andrew Geissler4ed12e12020-06-05 18:00:41 -0500105 if [ -n "${UBOOT_INITIAL_ENV}" ]; then
106 oe_runmake -C ${S} O=${B} u-boot-initial-env
107 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500108 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500109}
110
111do_install () {
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600112 if [ -n "${UBOOT_CONFIG}" ]
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500113 then
114 for config in ${UBOOT_MACHINE}; do
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600115 i=$(expr $i + 1);
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500116 for type in ${UBOOT_CONFIG}; do
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600117 j=$(expr $j + 1);
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500118 if [ $j -eq $i ]
119 then
Andrew Geissler82c905d2020-04-13 13:39:40 -0500120 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 -0500121 ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${D}/boot/${UBOOT_BINARY}-${type}
122 ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${D}/boot/${UBOOT_BINARY}
Andrew Geissler82c905d2020-04-13 13:39:40 -0500123
124 # Install the uboot-initial-env
Andrew Geissler4ed12e12020-06-05 18:00:41 -0500125 if [ -n "${UBOOT_INITIAL_ENV}" ]; then
126 install -D -m 644 ${B}/${config}/u-boot-initial-env-${type} ${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}-${MACHINE}-${type}-${PV}-${PR}
127 ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${type}-${PV}-${PR} ${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}-${MACHINE}-${type}
128 ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${type}-${PV}-${PR} ${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}-${type}
129 ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${type}-${PV}-${PR} ${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}
130 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500131 fi
132 done
Andrew Geissler4ed12e12020-06-05 18:00:41 -0500133 unset j
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500134 done
Andrew Geissler4ed12e12020-06-05 18:00:41 -0500135 unset i
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500136 else
Andrew Geissler82c905d2020-04-13 13:39:40 -0500137 install -D -m 644 ${B}/${UBOOT_BINARY} ${D}/boot/${UBOOT_IMAGE}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500138 ln -sf ${UBOOT_IMAGE} ${D}/boot/${UBOOT_BINARY}
Andrew Geissler82c905d2020-04-13 13:39:40 -0500139
140 # Install the uboot-initial-env
Andrew Geissler4ed12e12020-06-05 18:00:41 -0500141 if [ -n "${UBOOT_INITIAL_ENV}" ]; then
142 install -D -m 644 ${B}/u-boot-initial-env ${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}-${MACHINE}-${PV}-${PR}
143 ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${PV}-${PR} ${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}-${MACHINE}
144 ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${PV}-${PR} ${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}
145 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500146 fi
147
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600148 if [ -n "${UBOOT_ELF}" ]
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500149 then
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600150 if [ -n "${UBOOT_CONFIG}" ]
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500151 then
152 for config in ${UBOOT_MACHINE}; do
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600153 i=$(expr $i + 1);
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500154 for type in ${UBOOT_CONFIG}; do
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600155 j=$(expr $j + 1);
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500156 if [ $j -eq $i ]
157 then
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600158 install -m 644 ${B}/${config}/${UBOOT_ELF} ${D}/boot/u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500159 ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${D}/boot/${UBOOT_BINARY}-${type}
160 ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${D}/boot/${UBOOT_BINARY}
161 fi
162 done
163 unset j
164 done
165 unset i
166 else
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600167 install -m 644 ${B}/${UBOOT_ELF} ${D}/boot/${UBOOT_ELF_IMAGE}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500168 ln -sf ${UBOOT_ELF_IMAGE} ${D}/boot/${UBOOT_ELF_BINARY}
169 fi
170 fi
171
172 if [ -e ${WORKDIR}/fw_env.config ] ; then
173 install -d ${D}${sysconfdir}
174 install -m 644 ${WORKDIR}/fw_env.config ${D}${sysconfdir}/fw_env.config
175 fi
176
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600177 if [ -n "${SPL_BINARY}" ]
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500178 then
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600179 if [ -n "${UBOOT_CONFIG}" ]
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500180 then
181 for config in ${UBOOT_MACHINE}; do
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600182 i=$(expr $i + 1);
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500183 for type in ${UBOOT_CONFIG}; do
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600184 j=$(expr $j + 1);
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500185 if [ $j -eq $i ]
186 then
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600187 install -m 644 ${B}/${config}/${SPL_BINARY} ${D}/boot/${SPL_IMAGE}-${type}-${PV}-${PR}
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500188 ln -sf ${SPL_IMAGE}-${type}-${PV}-${PR} ${D}/boot/${SPL_BINARYNAME}-${type}
189 ln -sf ${SPL_IMAGE}-${type}-${PV}-${PR} ${D}/boot/${SPL_BINARYNAME}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500190 fi
191 done
Andrew Geissler4ed12e12020-06-05 18:00:41 -0500192 unset j
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500193 done
Andrew Geissler4ed12e12020-06-05 18:00:41 -0500194 unset i
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500195 else
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600196 install -m 644 ${B}/${SPL_BINARY} ${D}/boot/${SPL_IMAGE}
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500197 ln -sf ${SPL_IMAGE} ${D}/boot/${SPL_BINARYNAME}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500198 fi
199 fi
200
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600201 if [ -n "${UBOOT_ENV}" ]
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500202 then
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600203 install -m 644 ${WORKDIR}/${UBOOT_ENV_BINARY} ${D}/boot/${UBOOT_ENV_IMAGE}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500204 ln -sf ${UBOOT_ENV_IMAGE} ${D}/boot/${UBOOT_ENV_BINARY}
205 fi
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600206
207 if [ "${UBOOT_EXTLINUX}" = "1" ]
208 then
209 install -Dm 0644 ${UBOOT_EXTLINUX_CONFIG} ${D}/${UBOOT_EXTLINUX_INSTALL_DIR}/${UBOOT_EXTLINUX_CONF_NAME}
210 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500211}
212
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500213PACKAGE_BEFORE_PN += "${PN}-env ${PN}-extlinux"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500214
Patrick Williams213cb262021-08-07 19:21:33 -0500215RPROVIDES:${PN}-env += "u-boot-default-env"
216ALLOW_EMPTY:${PN}-env = "1"
217FILES:${PN}-env = " \
Andrew Geissler4ed12e12020-06-05 18:00:41 -0500218 ${@ '${sysconfdir}/${UBOOT_INITIAL_ENV}*' if d.getVar('UBOOT_INITIAL_ENV') else ''} \
Andrew Geissler82c905d2020-04-13 13:39:40 -0500219 ${sysconfdir}/fw_env.config \
220"
221
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500222FILES:${PN}-extlinux = "${UBOOT_EXTLINUX_INSTALL_DIR}/${UBOOT_EXTLINUX_CONF_NAME}"
223RDEPENDS:${PN} += "${@bb.utils.contains('UBOOT_EXTLINUX', '1', '${PN}-extlinux', '', d)}"
224
Patrick Williams213cb262021-08-07 19:21:33 -0500225FILES:${PN} = "/boot ${datadir}"
226RDEPENDS:${PN} += "${PN}-env"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500227
228do_deploy () {
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600229 if [ -n "${UBOOT_CONFIG}" ]
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500230 then
231 for config in ${UBOOT_MACHINE}; do
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600232 i=$(expr $i + 1);
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500233 for type in ${UBOOT_CONFIG}; do
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600234 j=$(expr $j + 1);
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500235 if [ $j -eq $i ]
236 then
Andrew Geissler82c905d2020-04-13 13:39:40 -0500237 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 -0500238 cd ${DEPLOYDIR}
239 ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${UBOOT_SYMLINK}-${type}
240 ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${UBOOT_SYMLINK}
241 ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${UBOOT_BINARY}-${type}
242 ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${UBOOT_BINARY}
Andrew Geissler82c905d2020-04-13 13:39:40 -0500243
244 # Deploy the uboot-initial-env
Andrew Geissler4ed12e12020-06-05 18:00:41 -0500245 if [ -n "${UBOOT_INITIAL_ENV}" ]; then
246 install -D -m 644 ${B}/${config}/u-boot-initial-env-${type} ${DEPLOYDIR}/${UBOOT_INITIAL_ENV}-${MACHINE}-${type}-${PV}-${PR}
247 cd ${DEPLOYDIR}
248 ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${type}-${PV}-${PR} ${UBOOT_INITIAL_ENV}-${MACHINE}-${type}
249 ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${type}-${PV}-${PR} ${UBOOT_INITIAL_ENV}-${type}
250 fi
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600251 fi
252 done
Andrew Geissler4ed12e12020-06-05 18:00:41 -0500253 unset j
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500254 done
Andrew Geissler4ed12e12020-06-05 18:00:41 -0500255 unset i
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500256 else
Andrew Geissler82c905d2020-04-13 13:39:40 -0500257 install -D -m 644 ${B}/${UBOOT_BINARY} ${DEPLOYDIR}/${UBOOT_IMAGE}
258
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500259 cd ${DEPLOYDIR}
260 rm -f ${UBOOT_BINARY} ${UBOOT_SYMLINK}
261 ln -sf ${UBOOT_IMAGE} ${UBOOT_SYMLINK}
262 ln -sf ${UBOOT_IMAGE} ${UBOOT_BINARY}
Andrew Geissler82c905d2020-04-13 13:39:40 -0500263
264 # Deploy the uboot-initial-env
Andrew Geissler4ed12e12020-06-05 18:00:41 -0500265 if [ -n "${UBOOT_INITIAL_ENV}" ]; then
266 install -D -m 644 ${B}/u-boot-initial-env ${DEPLOYDIR}/${UBOOT_INITIAL_ENV}-${MACHINE}-${PV}-${PR}
267 cd ${DEPLOYDIR}
268 ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${PV}-${PR} ${UBOOT_INITIAL_ENV}-${MACHINE}
269 ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${PV}-${PR} ${UBOOT_INITIAL_ENV}
270 fi
Andrew Geissler82c905d2020-04-13 13:39:40 -0500271 fi
272
273 if [ -e ${WORKDIR}/fw_env.config ] ; then
274 install -D -m 644 ${WORKDIR}/fw_env.config ${DEPLOYDIR}/fw_env.config-${MACHINE}-${PV}-${PR}
275 cd ${DEPLOYDIR}
276 ln -sf fw_env.config-${MACHINE}-${PV}-${PR} fw_env.config-${MACHINE}
277 ln -sf fw_env.config-${MACHINE}-${PV}-${PR} fw_env.config
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800278 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500279
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600280 if [ -n "${UBOOT_ELF}" ]
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500281 then
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600282 if [ -n "${UBOOT_CONFIG}" ]
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500283 then
284 for config in ${UBOOT_MACHINE}; do
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600285 i=$(expr $i + 1);
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500286 for type in ${UBOOT_CONFIG}; do
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600287 j=$(expr $j + 1);
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500288 if [ $j -eq $i ]
289 then
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600290 install -m 644 ${B}/${config}/${UBOOT_ELF} ${DEPLOYDIR}/u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500291 ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${DEPLOYDIR}/${UBOOT_ELF_BINARY}-${type}
292 ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${DEPLOYDIR}/${UBOOT_ELF_BINARY}
293 ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${DEPLOYDIR}/${UBOOT_ELF_SYMLINK}-${type}
294 ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${DEPLOYDIR}/${UBOOT_ELF_SYMLINK}
295 fi
296 done
297 unset j
298 done
299 unset i
300 else
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600301 install -m 644 ${B}/${UBOOT_ELF} ${DEPLOYDIR}/${UBOOT_ELF_IMAGE}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500302 ln -sf ${UBOOT_ELF_IMAGE} ${DEPLOYDIR}/${UBOOT_ELF_BINARY}
303 ln -sf ${UBOOT_ELF_IMAGE} ${DEPLOYDIR}/${UBOOT_ELF_SYMLINK}
304 fi
305 fi
306
307
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600308 if [ -n "${SPL_BINARY}" ]
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500309 then
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800310 if [ -n "${UBOOT_CONFIG}" ]
311 then
312 for config in ${UBOOT_MACHINE}; do
313 i=$(expr $i + 1);
314 for type in ${UBOOT_CONFIG}; do
315 j=$(expr $j + 1);
316 if [ $j -eq $i ]
317 then
318 install -m 644 ${B}/${config}/${SPL_BINARY} ${DEPLOYDIR}/${SPL_IMAGE}-${type}-${PV}-${PR}
319 rm -f ${DEPLOYDIR}/${SPL_BINARYNAME} ${DEPLOYDIR}/${SPL_SYMLINK}-${type}
320 ln -sf ${SPL_IMAGE}-${type}-${PV}-${PR} ${DEPLOYDIR}/${SPL_BINARYNAME}-${type}
321 ln -sf ${SPL_IMAGE}-${type}-${PV}-${PR} ${DEPLOYDIR}/${SPL_BINARYNAME}
322 ln -sf ${SPL_IMAGE}-${type}-${PV}-${PR} ${DEPLOYDIR}/${SPL_SYMLINK}-${type}
323 ln -sf ${SPL_IMAGE}-${type}-${PV}-${PR} ${DEPLOYDIR}/${SPL_SYMLINK}
324 fi
325 done
Andrew Geissler4ed12e12020-06-05 18:00:41 -0500326 unset j
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800327 done
Andrew Geissler4ed12e12020-06-05 18:00:41 -0500328 unset i
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800329 else
330 install -m 644 ${B}/${SPL_BINARY} ${DEPLOYDIR}/${SPL_IMAGE}
331 rm -f ${DEPLOYDIR}/${SPL_BINARYNAME} ${DEPLOYDIR}/${SPL_SYMLINK}
332 ln -sf ${SPL_IMAGE} ${DEPLOYDIR}/${SPL_BINARYNAME}
333 ln -sf ${SPL_IMAGE} ${DEPLOYDIR}/${SPL_SYMLINK}
334 fi
335 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500336
337
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600338 if [ -n "${UBOOT_ENV}" ]
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500339 then
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600340 install -m 644 ${WORKDIR}/${UBOOT_ENV_BINARY} ${DEPLOYDIR}/${UBOOT_ENV_IMAGE}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500341 rm -f ${DEPLOYDIR}/${UBOOT_ENV_BINARY} ${DEPLOYDIR}/${UBOOT_ENV_SYMLINK}
342 ln -sf ${UBOOT_ENV_IMAGE} ${DEPLOYDIR}/${UBOOT_ENV_BINARY}
343 ln -sf ${UBOOT_ENV_IMAGE} ${DEPLOYDIR}/${UBOOT_ENV_SYMLINK}
344 fi
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600345
346 if [ "${UBOOT_EXTLINUX}" = "1" ]
347 then
348 install -m 644 ${UBOOT_EXTLINUX_CONFIG} ${DEPLOYDIR}/${UBOOT_EXTLINUX_SYMLINK}
349 ln -sf ${UBOOT_EXTLINUX_SYMLINK} ${DEPLOYDIR}/${UBOOT_EXTLINUX_CONF_NAME}-${MACHINE}
350 ln -sf ${UBOOT_EXTLINUX_SYMLINK} ${DEPLOYDIR}/${UBOOT_EXTLINUX_CONF_NAME}
351 fi
Andrew Geissler09036742021-06-25 14:25:14 -0500352
353 if [ -n "${UBOOT_DTB}" ]
354 then
355 install -m 644 ${B}/arch/${UBOOT_ARCH}/dts/${UBOOT_DTB_BINARY} ${DEPLOYDIR}/
356 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500357}
358
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500359addtask deploy before do_build after do_compile