blob: b3482dcef31947ea3f3b372cbdc7a0bb80d2ac63 [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
Andrew Geisslereff27472021-10-29 15:35:00 -05006DEPENDS += "${@bb.utils.contains('UBOOT_ENV_SUFFIX', 'scr', 'u-boot-mkimage-native', '', d)}"
Brad Bishop19323692019-04-05 15:28:33 -04007
Patrick Williams2390b1b2022-11-03 13:47:49 -05008inherit uboot-config uboot-extlinux-config uboot-sign deploy 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
Zev Weiss897b7442022-01-18 22:48:12 -080027require u-boot-configure.inc
Brad Bishop19323692019-04-05 15:28:33 -040028
Patrick Williams2390b1b2022-11-03 13:47:49 -050029do_savedefconfig() {
30 bbplain "Saving defconfig to:\n${B}/defconfig"
31 oe_runmake -C ${B} savedefconfig
32}
33do_savedefconfig[nostamp] = "1"
34addtask savedefconfig after do_configure
Andrew Geissler6aa7eec2023-03-03 12:41:14 -060035UBOOT_ARCH_DIR = "${@'arm' if d.getVar('UBOOT_ARCH').startswith('arm') else d.getVar('UBOOT_ARCH')}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050036do_compile () {
Andrew Geissler4ed12e12020-06-05 18:00:41 -050037 if [ "${@bb.utils.filter('DISTRO_FEATURES', 'ld-is-gold', d)}" ]; then
38 sed -i 's/$(CROSS_COMPILE)ld$/$(CROSS_COMPILE)ld.bfd/g' ${S}/config.mk
39 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -050040
Andrew Geissler4ed12e12020-06-05 18:00:41 -050041 unset LDFLAGS
42 unset CFLAGS
43 unset CPPFLAGS
Patrick Williamsc124f4f2015-09-15 14:41:29 -050044
Andrew Geissler4ed12e12020-06-05 18:00:41 -050045 if [ ! -e ${B}/.scmversion -a ! -e ${S}/.scmversion ]
46 then
47 echo ${UBOOT_LOCALVERSION} > ${B}/.scmversion
48 echo ${UBOOT_LOCALVERSION} > ${S}/.scmversion
49 fi
Patrick Williamsc0f7c042017-02-23 20:41:17 -060050
Andrew Geisslerd25ed322020-06-27 00:28:28 -050051 if [ -n "${UBOOT_CONFIG}" -o -n "${UBOOT_DELTA_CONFIG}" ]
Patrick Williamsc124f4f2015-09-15 14:41:29 -050052 then
Patrick Williamsc0f7c042017-02-23 20:41:17 -060053 unset i j k
Patrick Williamsc124f4f2015-09-15 14:41:29 -050054 for config in ${UBOOT_MACHINE}; do
Patrick Williamsc0f7c042017-02-23 20:41:17 -060055 i=$(expr $i + 1);
56 for type in ${UBOOT_CONFIG}; do
57 j=$(expr $j + 1);
Patrick Williamsc124f4f2015-09-15 14:41:29 -050058 if [ $j -eq $i ]
59 then
Patrick Williamsc0f7c042017-02-23 20:41:17 -060060 oe_runmake -C ${S} O=${B}/${config} ${UBOOT_MAKE_TARGET}
61 for binary in ${UBOOT_BINARIES}; do
62 k=$(expr $k + 1);
63 if [ $k -eq $i ]; then
Andrew Geisslerd159c7f2021-09-02 21:05:58 -050064 cp ${B}/${config}/${binary} ${B}/${config}/${UBOOT_BINARYNAME}-${type}.${UBOOT_SUFFIX}
Patrick Williamsc0f7c042017-02-23 20:41:17 -060065 fi
66 done
Andrew Geissler82c905d2020-04-13 13:39:40 -050067
68 # Generate the uboot-initial-env
Andrew Geissler4ed12e12020-06-05 18:00:41 -050069 if [ -n "${UBOOT_INITIAL_ENV}" ]; then
70 oe_runmake -C ${S} O=${B}/${config} u-boot-initial-env
71 cp ${B}/${config}/u-boot-initial-env ${B}/${config}/u-boot-initial-env-${type}
72 fi
Andrew Geissler82c905d2020-04-13 13:39:40 -050073
Patrick Williamsc0f7c042017-02-23 20:41:17 -060074 unset k
Patrick Williamsc124f4f2015-09-15 14:41:29 -050075 fi
76 done
Andrew Geissler4ed12e12020-06-05 18:00:41 -050077 unset j
Patrick Williamsc124f4f2015-09-15 14:41:29 -050078 done
Andrew Geissler4ed12e12020-06-05 18:00:41 -050079 unset i
Patrick Williamsc124f4f2015-09-15 14:41:29 -050080 else
Patrick Williamsc0f7c042017-02-23 20:41:17 -060081 oe_runmake -C ${S} O=${B} ${UBOOT_MAKE_TARGET}
Andrew Geissler82c905d2020-04-13 13:39:40 -050082
83 # Generate the uboot-initial-env
Andrew Geissler4ed12e12020-06-05 18:00:41 -050084 if [ -n "${UBOOT_INITIAL_ENV}" ]; then
85 oe_runmake -C ${S} O=${B} u-boot-initial-env
86 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -050087 fi
Andrew Geisslereff27472021-10-29 15:35:00 -050088
89 if [ -n "${UBOOT_ENV}" ] && [ "${UBOOT_ENV_SUFFIX}" = "scr" ]
90 then
91 ${UBOOT_MKIMAGE} -C none -A ${UBOOT_ARCH} -T script -d ${WORKDIR}/${UBOOT_ENV_SRC} ${WORKDIR}/${UBOOT_ENV_BINARY}
92 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -050093}
94
95do_install () {
Patrick Williamsc0f7c042017-02-23 20:41:17 -060096 if [ -n "${UBOOT_CONFIG}" ]
Patrick Williamsc124f4f2015-09-15 14:41:29 -050097 then
98 for config in ${UBOOT_MACHINE}; do
Patrick Williamsc0f7c042017-02-23 20:41:17 -060099 i=$(expr $i + 1);
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500100 for type in ${UBOOT_CONFIG}; do
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600101 j=$(expr $j + 1);
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500102 if [ $j -eq $i ]
103 then
Andrew Geisslerd159c7f2021-09-02 21:05:58 -0500104 install -D -m 644 ${B}/${config}/${UBOOT_BINARYNAME}-${type}.${UBOOT_SUFFIX} ${D}/boot/${UBOOT_BINARYNAME}-${type}-${PV}-${PR}.${UBOOT_SUFFIX}
105 ln -sf ${UBOOT_BINARYNAME}-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${D}/boot/${UBOOT_BINARY}-${type}
106 ln -sf ${UBOOT_BINARYNAME}-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${D}/boot/${UBOOT_BINARY}
Andrew Geissler82c905d2020-04-13 13:39:40 -0500107
108 # Install the uboot-initial-env
Andrew Geissler4ed12e12020-06-05 18:00:41 -0500109 if [ -n "${UBOOT_INITIAL_ENV}" ]; then
110 install -D -m 644 ${B}/${config}/u-boot-initial-env-${type} ${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}-${MACHINE}-${type}-${PV}-${PR}
111 ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${type}-${PV}-${PR} ${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}-${MACHINE}-${type}
112 ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${type}-${PV}-${PR} ${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}-${type}
113 ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${type}-${PV}-${PR} ${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}
114 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500115 fi
116 done
Andrew Geissler4ed12e12020-06-05 18:00:41 -0500117 unset j
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500118 done
Andrew Geissler4ed12e12020-06-05 18:00:41 -0500119 unset i
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500120 else
Andrew Geissler82c905d2020-04-13 13:39:40 -0500121 install -D -m 644 ${B}/${UBOOT_BINARY} ${D}/boot/${UBOOT_IMAGE}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500122 ln -sf ${UBOOT_IMAGE} ${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}/u-boot-initial-env ${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}-${MACHINE}-${PV}-${PR}
127 ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${PV}-${PR} ${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}-${MACHINE}
128 ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${PV}-${PR} ${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}
129 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500130 fi
131
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600132 if [ -n "${UBOOT_ELF}" ]
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500133 then
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600134 if [ -n "${UBOOT_CONFIG}" ]
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500135 then
136 for config in ${UBOOT_MACHINE}; do
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600137 i=$(expr $i + 1);
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500138 for type in ${UBOOT_CONFIG}; do
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600139 j=$(expr $j + 1);
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500140 if [ $j -eq $i ]
141 then
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600142 install -m 644 ${B}/${config}/${UBOOT_ELF} ${D}/boot/u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500143 ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${D}/boot/${UBOOT_BINARY}-${type}
144 ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${D}/boot/${UBOOT_BINARY}
145 fi
146 done
147 unset j
148 done
149 unset i
150 else
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600151 install -m 644 ${B}/${UBOOT_ELF} ${D}/boot/${UBOOT_ELF_IMAGE}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500152 ln -sf ${UBOOT_ELF_IMAGE} ${D}/boot/${UBOOT_ELF_BINARY}
153 fi
154 fi
155
156 if [ -e ${WORKDIR}/fw_env.config ] ; then
157 install -d ${D}${sysconfdir}
158 install -m 644 ${WORKDIR}/fw_env.config ${D}${sysconfdir}/fw_env.config
159 fi
160
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600161 if [ -n "${SPL_BINARY}" ]
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500162 then
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600163 if [ -n "${UBOOT_CONFIG}" ]
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500164 then
165 for config in ${UBOOT_MACHINE}; do
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600166 i=$(expr $i + 1);
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500167 for type in ${UBOOT_CONFIG}; do
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600168 j=$(expr $j + 1);
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500169 if [ $j -eq $i ]
170 then
Andrew Geisslerd159c7f2021-09-02 21:05:58 -0500171 install -m 644 ${B}/${config}/${SPL_BINARY} ${D}/boot/${SPL_BINARYNAME}-${type}-${PV}-${PR}${SPL_DELIMITER}${SPL_SUFFIX}
172 ln -sf ${SPL_BINARYNAME}-${type}-${PV}-${PR}${SPL_DELIMITER}${SPL_SUFFIX} ${D}/boot/${SPL_BINARYFILE}-${type}
173 ln -sf ${SPL_BINARYNAME}-${type}-${PV}-${PR}${SPL_DELIMITER}${SPL_SUFFIX} ${D}/boot/${SPL_BINARYFILE}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500174 fi
175 done
Andrew Geissler4ed12e12020-06-05 18:00:41 -0500176 unset j
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500177 done
Andrew Geissler4ed12e12020-06-05 18:00:41 -0500178 unset i
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500179 else
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600180 install -m 644 ${B}/${SPL_BINARY} ${D}/boot/${SPL_IMAGE}
Andrew Geisslerd159c7f2021-09-02 21:05:58 -0500181 ln -sf ${SPL_IMAGE} ${D}/boot/${SPL_BINARYFILE}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500182 fi
183 fi
184
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600185 if [ -n "${UBOOT_ENV}" ]
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500186 then
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600187 install -m 644 ${WORKDIR}/${UBOOT_ENV_BINARY} ${D}/boot/${UBOOT_ENV_IMAGE}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500188 ln -sf ${UBOOT_ENV_IMAGE} ${D}/boot/${UBOOT_ENV_BINARY}
189 fi
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600190
191 if [ "${UBOOT_EXTLINUX}" = "1" ]
192 then
193 install -Dm 0644 ${UBOOT_EXTLINUX_CONFIG} ${D}/${UBOOT_EXTLINUX_INSTALL_DIR}/${UBOOT_EXTLINUX_CONF_NAME}
194 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500195}
196
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500197PACKAGE_BEFORE_PN += "${PN}-env ${PN}-extlinux"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500198
Patrick Williams213cb262021-08-07 19:21:33 -0500199RPROVIDES:${PN}-env += "u-boot-default-env"
200ALLOW_EMPTY:${PN}-env = "1"
201FILES:${PN}-env = " \
Andrew Geissler4ed12e12020-06-05 18:00:41 -0500202 ${@ '${sysconfdir}/${UBOOT_INITIAL_ENV}*' if d.getVar('UBOOT_INITIAL_ENV') else ''} \
Andrew Geissler82c905d2020-04-13 13:39:40 -0500203 ${sysconfdir}/fw_env.config \
204"
205
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500206FILES:${PN}-extlinux = "${UBOOT_EXTLINUX_INSTALL_DIR}/${UBOOT_EXTLINUX_CONF_NAME}"
207RDEPENDS:${PN} += "${@bb.utils.contains('UBOOT_EXTLINUX', '1', '${PN}-extlinux', '', d)}"
208
Andrew Geissler517393d2023-01-13 08:55:19 -0600209SYSROOT_DIRS += "/boot"
Patrick Williams213cb262021-08-07 19:21:33 -0500210FILES:${PN} = "/boot ${datadir}"
211RDEPENDS:${PN} += "${PN}-env"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500212
213do_deploy () {
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600214 if [ -n "${UBOOT_CONFIG}" ]
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500215 then
216 for config in ${UBOOT_MACHINE}; do
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600217 i=$(expr $i + 1);
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500218 for type in ${UBOOT_CONFIG}; do
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600219 j=$(expr $j + 1);
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500220 if [ $j -eq $i ]
221 then
Andrew Geisslerd159c7f2021-09-02 21:05:58 -0500222 install -D -m 644 ${B}/${config}/${UBOOT_BINARYNAME}-${type}.${UBOOT_SUFFIX} ${DEPLOYDIR}/${UBOOT_BINARYNAME}-${type}-${PV}-${PR}.${UBOOT_SUFFIX}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500223 cd ${DEPLOYDIR}
Andrew Geisslerd159c7f2021-09-02 21:05:58 -0500224 ln -sf ${UBOOT_BINARYNAME}-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${UBOOT_SYMLINK}-${type}
225 ln -sf ${UBOOT_BINARYNAME}-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${UBOOT_SYMLINK}
226 ln -sf ${UBOOT_BINARYNAME}-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${UBOOT_BINARY}-${type}
227 ln -sf ${UBOOT_BINARYNAME}-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${UBOOT_BINARY}
Andrew Geissler82c905d2020-04-13 13:39:40 -0500228
229 # Deploy the uboot-initial-env
Andrew Geissler4ed12e12020-06-05 18:00:41 -0500230 if [ -n "${UBOOT_INITIAL_ENV}" ]; then
231 install -D -m 644 ${B}/${config}/u-boot-initial-env-${type} ${DEPLOYDIR}/${UBOOT_INITIAL_ENV}-${MACHINE}-${type}-${PV}-${PR}
232 cd ${DEPLOYDIR}
233 ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${type}-${PV}-${PR} ${UBOOT_INITIAL_ENV}-${MACHINE}-${type}
234 ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${type}-${PV}-${PR} ${UBOOT_INITIAL_ENV}-${type}
235 fi
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600236 fi
237 done
Andrew Geissler4ed12e12020-06-05 18:00:41 -0500238 unset j
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500239 done
Andrew Geissler4ed12e12020-06-05 18:00:41 -0500240 unset i
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500241 else
Andrew Geissler82c905d2020-04-13 13:39:40 -0500242 install -D -m 644 ${B}/${UBOOT_BINARY} ${DEPLOYDIR}/${UBOOT_IMAGE}
243
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500244 cd ${DEPLOYDIR}
245 rm -f ${UBOOT_BINARY} ${UBOOT_SYMLINK}
246 ln -sf ${UBOOT_IMAGE} ${UBOOT_SYMLINK}
247 ln -sf ${UBOOT_IMAGE} ${UBOOT_BINARY}
Andrew Geissler82c905d2020-04-13 13:39:40 -0500248
249 # Deploy the uboot-initial-env
Andrew Geissler4ed12e12020-06-05 18:00:41 -0500250 if [ -n "${UBOOT_INITIAL_ENV}" ]; then
251 install -D -m 644 ${B}/u-boot-initial-env ${DEPLOYDIR}/${UBOOT_INITIAL_ENV}-${MACHINE}-${PV}-${PR}
252 cd ${DEPLOYDIR}
253 ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${PV}-${PR} ${UBOOT_INITIAL_ENV}-${MACHINE}
254 ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${PV}-${PR} ${UBOOT_INITIAL_ENV}
255 fi
Andrew Geissler82c905d2020-04-13 13:39:40 -0500256 fi
257
258 if [ -e ${WORKDIR}/fw_env.config ] ; then
259 install -D -m 644 ${WORKDIR}/fw_env.config ${DEPLOYDIR}/fw_env.config-${MACHINE}-${PV}-${PR}
260 cd ${DEPLOYDIR}
261 ln -sf fw_env.config-${MACHINE}-${PV}-${PR} fw_env.config-${MACHINE}
262 ln -sf fw_env.config-${MACHINE}-${PV}-${PR} fw_env.config
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800263 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500264
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600265 if [ -n "${UBOOT_ELF}" ]
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500266 then
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600267 if [ -n "${UBOOT_CONFIG}" ]
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500268 then
269 for config in ${UBOOT_MACHINE}; do
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600270 i=$(expr $i + 1);
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500271 for type in ${UBOOT_CONFIG}; do
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600272 j=$(expr $j + 1);
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500273 if [ $j -eq $i ]
274 then
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600275 install -m 644 ${B}/${config}/${UBOOT_ELF} ${DEPLOYDIR}/u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500276 ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${DEPLOYDIR}/${UBOOT_ELF_BINARY}-${type}
277 ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${DEPLOYDIR}/${UBOOT_ELF_BINARY}
278 ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${DEPLOYDIR}/${UBOOT_ELF_SYMLINK}-${type}
279 ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${DEPLOYDIR}/${UBOOT_ELF_SYMLINK}
280 fi
281 done
282 unset j
283 done
284 unset i
285 else
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600286 install -m 644 ${B}/${UBOOT_ELF} ${DEPLOYDIR}/${UBOOT_ELF_IMAGE}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500287 ln -sf ${UBOOT_ELF_IMAGE} ${DEPLOYDIR}/${UBOOT_ELF_BINARY}
288 ln -sf ${UBOOT_ELF_IMAGE} ${DEPLOYDIR}/${UBOOT_ELF_SYMLINK}
289 fi
290 fi
291
292
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600293 if [ -n "${SPL_BINARY}" ]
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500294 then
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800295 if [ -n "${UBOOT_CONFIG}" ]
296 then
297 for config in ${UBOOT_MACHINE}; do
298 i=$(expr $i + 1);
299 for type in ${UBOOT_CONFIG}; do
300 j=$(expr $j + 1);
301 if [ $j -eq $i ]
302 then
Andrew Geisslerd159c7f2021-09-02 21:05:58 -0500303 install -m 644 ${B}/${config}/${SPL_BINARY} ${DEPLOYDIR}/${SPL_BINARYNAME}-${type}-${PV}-${PR}${SPL_DELIMITER}${SPL_SUFFIX}
304 rm -f ${DEPLOYDIR}/${SPL_BINARYFILE} ${DEPLOYDIR}/${SPL_SYMLINK}
305 ln -sf ${SPL_BINARYNAME}-${type}-${PV}-${PR}${SPL_DELIMITER}${SPL_SUFFIX} ${DEPLOYDIR}/${SPL_BINARYFILE}-${type}
306 ln -sf ${SPL_BINARYNAME}-${type}-${PV}-${PR}${SPL_DELIMITER}${SPL_SUFFIX} ${DEPLOYDIR}/${SPL_BINARYFILE}
307 ln -sf ${SPL_BINARYNAME}-${type}-${PV}-${PR}${SPL_DELIMITER}${SPL_SUFFIX} ${DEPLOYDIR}/${SPL_SYMLINK}-${type}
308 ln -sf ${SPL_BINARYNAME}-${type}-${PV}-${PR}${SPL_DELIMITER}${SPL_SUFFIX} ${DEPLOYDIR}/${SPL_SYMLINK}
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800309 fi
310 done
Andrew Geissler4ed12e12020-06-05 18:00:41 -0500311 unset j
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800312 done
Andrew Geissler4ed12e12020-06-05 18:00:41 -0500313 unset i
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800314 else
315 install -m 644 ${B}/${SPL_BINARY} ${DEPLOYDIR}/${SPL_IMAGE}
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800316 ln -sf ${SPL_IMAGE} ${DEPLOYDIR}/${SPL_BINARYNAME}
317 ln -sf ${SPL_IMAGE} ${DEPLOYDIR}/${SPL_SYMLINK}
318 fi
319 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500320
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600321 if [ -n "${UBOOT_ENV}" ]
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500322 then
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600323 install -m 644 ${WORKDIR}/${UBOOT_ENV_BINARY} ${DEPLOYDIR}/${UBOOT_ENV_IMAGE}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500324 ln -sf ${UBOOT_ENV_IMAGE} ${DEPLOYDIR}/${UBOOT_ENV_BINARY}
325 ln -sf ${UBOOT_ENV_IMAGE} ${DEPLOYDIR}/${UBOOT_ENV_SYMLINK}
326 fi
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600327
328 if [ "${UBOOT_EXTLINUX}" = "1" ]
329 then
330 install -m 644 ${UBOOT_EXTLINUX_CONFIG} ${DEPLOYDIR}/${UBOOT_EXTLINUX_SYMLINK}
331 ln -sf ${UBOOT_EXTLINUX_SYMLINK} ${DEPLOYDIR}/${UBOOT_EXTLINUX_CONF_NAME}-${MACHINE}
332 ln -sf ${UBOOT_EXTLINUX_SYMLINK} ${DEPLOYDIR}/${UBOOT_EXTLINUX_CONF_NAME}
333 fi
Andrew Geissler09036742021-06-25 14:25:14 -0500334
335 if [ -n "${UBOOT_DTB}" ]
336 then
Andrew Geissler6aa7eec2023-03-03 12:41:14 -0600337 install -m 644 ${B}/arch/${UBOOT_ARCH_DIR}/dts/${UBOOT_DTB_BINARY} ${DEPLOYDIR}/
Andrew Geissler09036742021-06-25 14:25:14 -0500338 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500339}
340
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500341addtask deploy before do_build after do_compile