1eb8dc403SDave CobbleySUMMARY = "Universal Boot Loader for embedded devices"
2eb8dc403SDave CobbleyPROVIDES = "virtual/bootloader"
3eb8dc403SDave Cobbley
4eb8dc403SDave CobbleyPACKAGE_ARCH = "${MACHINE_ARCH}"
5eb8dc403SDave Cobbley
6eff27476SAndrew GeisslerDEPENDS += "${@bb.utils.contains('UBOOT_ENV_SUFFIX', 'scr', 'u-boot-mkimage-native', '', d)}"
719323693SBrad Bishop
82390b1b6SPatrick Williamsinherit uboot-config uboot-extlinux-config uboot-sign deploy python3native kernel-arch
9eb8dc403SDave Cobbley
1082c905dcSAndrew GeisslerDEPENDS += "swig-native"
11d5ae7d90SBrad Bishop
1273bd93f1SPatrick WilliamsEXTRA_OEMAKE = 'CROSS_COMPILE=${TARGET_PREFIX} CC="${TARGET_PREFIX}gcc ${TOOLCHAIN_OPTIONS} ${DEBUG_PREFIX_MAP}" V=1'
13eb8dc403SDave CobbleyEXTRA_OEMAKE += 'HOSTCC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}"'
1482c905dcSAndrew GeisslerEXTRA_OEMAKE += 'STAGING_INCDIR=${STAGING_INCDIR_NATIVE} STAGING_LIBDIR=${STAGING_LIBDIR_NATIVE}'
15eb8dc403SDave Cobbley
16eb8dc403SDave CobbleyPACKAGECONFIG ??= "openssl"
17eb8dc403SDave Cobbley# u-boot will compile its own tools during the build, with specific
18eb8dc403SDave Cobbley# configurations (aka when CONFIG_FIT_SIGNATURE is enabled) openssl is needed as
19eb8dc403SDave Cobbley# a host build dependency.
20eb8dc403SDave CobbleyPACKAGECONFIG[openssl] = ",,openssl-native"
21eb8dc403SDave Cobbley
22eb8dc403SDave Cobbley# Allow setting an additional version string that will be picked up by the
23eb8dc403SDave Cobbley# u-boot build system and appended to the u-boot version.  If the .scmversion
24eb8dc403SDave Cobbley# file already exists it will not be overwritten.
25eb8dc403SDave CobbleyUBOOT_LOCALVERSION ?= ""
26eb8dc403SDave Cobbley
27*b58112e5SPatrick Williams# Default name of u-boot initial env, but enable individual recipes to change
28*b58112e5SPatrick Williams# this value.
29*b58112e5SPatrick WilliamsUBOOT_INITIAL_ENV ?= "${PN}-initial-env"
30*b58112e5SPatrick Williams
31897b7444SZev Weissrequire u-boot-configure.inc
3219323693SBrad Bishop
332390b1b6SPatrick Williamsdo_savedefconfig() {
342390b1b6SPatrick Williams	bbplain "Saving defconfig to:\n${B}/defconfig"
352390b1b6SPatrick Williams	oe_runmake -C ${B} savedefconfig
362390b1b6SPatrick Williams}
372390b1b6SPatrick Williamsdo_savedefconfig[nostamp] = "1"
382390b1b6SPatrick Williamsaddtask savedefconfig after do_configure
396aa7eec5SAndrew GeisslerUBOOT_ARCH_DIR = "${@'arm' if d.getVar('UBOOT_ARCH').startswith('arm') else d.getVar('UBOOT_ARCH')}"
40eb8dc403SDave Cobbleydo_compile () {
41eb8dc403SDave Cobbley    if [ "${@bb.utils.filter('DISTRO_FEATURES', 'ld-is-gold', d)}" ]; then
42eb8dc403SDave Cobbley        sed -i 's/$(CROSS_COMPILE)ld$/$(CROSS_COMPILE)ld.bfd/g' ${S}/config.mk
43eb8dc403SDave Cobbley    fi
44eb8dc403SDave Cobbley
45eb8dc403SDave Cobbley    unset LDFLAGS
46eb8dc403SDave Cobbley    unset CFLAGS
47eb8dc403SDave Cobbley    unset CPPFLAGS
48eb8dc403SDave Cobbley
49eb8dc403SDave Cobbley    if [ ! -e ${B}/.scmversion -a ! -e ${S}/.scmversion ]
50eb8dc403SDave Cobbley    then
51eb8dc403SDave Cobbley        echo ${UBOOT_LOCALVERSION} > ${B}/.scmversion
52eb8dc403SDave Cobbley        echo ${UBOOT_LOCALVERSION} > ${S}/.scmversion
53eb8dc403SDave Cobbley    fi
54eb8dc403SDave Cobbley
55d25ed324SAndrew Geissler    if [ -n "${UBOOT_CONFIG}" -o -n "${UBOOT_DELTA_CONFIG}" ]
56eb8dc403SDave Cobbley    then
57eb8dc403SDave Cobbley        unset i j k
58eb8dc403SDave Cobbley        for config in ${UBOOT_MACHINE}; do
59eb8dc403SDave Cobbley            i=$(expr $i + 1);
60eb8dc403SDave Cobbley            for type in ${UBOOT_CONFIG}; do
61eb8dc403SDave Cobbley                j=$(expr $j + 1);
62eb8dc403SDave Cobbley                if [ $j -eq $i ]
63eb8dc403SDave Cobbley                then
64eb8dc403SDave Cobbley                    oe_runmake -C ${S} O=${B}/${config} ${UBOOT_MAKE_TARGET}
65eb8dc403SDave Cobbley                    for binary in ${UBOOT_BINARIES}; do
66eb8dc403SDave Cobbley                        k=$(expr $k + 1);
67eb8dc403SDave Cobbley                        if [ $k -eq $i ]; then
68d159c7fbSAndrew Geissler                            cp ${B}/${config}/${binary} ${B}/${config}/${UBOOT_BINARYNAME}-${type}.${UBOOT_SUFFIX}
69eb8dc403SDave Cobbley                        fi
70eb8dc403SDave Cobbley                    done
7182c905dcSAndrew Geissler
7282c905dcSAndrew Geissler                    # Generate the uboot-initial-env
734ed12e16SAndrew Geissler                    if [ -n "${UBOOT_INITIAL_ENV}" ]; then
7482c905dcSAndrew Geissler                        oe_runmake -C ${S} O=${B}/${config} u-boot-initial-env
7582c905dcSAndrew Geissler                        cp ${B}/${config}/u-boot-initial-env ${B}/${config}/u-boot-initial-env-${type}
764ed12e16SAndrew Geissler                    fi
7782c905dcSAndrew Geissler
78eb8dc403SDave Cobbley                    unset k
79eb8dc403SDave Cobbley                fi
80eb8dc403SDave Cobbley            done
81eb8dc403SDave Cobbley            unset j
82eb8dc403SDave Cobbley        done
83eb8dc403SDave Cobbley        unset i
84eb8dc403SDave Cobbley    else
85eb8dc403SDave Cobbley        oe_runmake -C ${S} O=${B} ${UBOOT_MAKE_TARGET}
8682c905dcSAndrew Geissler
8782c905dcSAndrew Geissler        # Generate the uboot-initial-env
884ed12e16SAndrew Geissler        if [ -n "${UBOOT_INITIAL_ENV}" ]; then
8982c905dcSAndrew Geissler            oe_runmake -C ${S} O=${B} u-boot-initial-env
90eb8dc403SDave Cobbley        fi
914ed12e16SAndrew Geissler    fi
92eff27476SAndrew Geissler
93eff27476SAndrew Geissler    if [ -n "${UBOOT_ENV}" ] && [ "${UBOOT_ENV_SUFFIX}" = "scr" ]
94eff27476SAndrew Geissler    then
95eff27476SAndrew Geissler        ${UBOOT_MKIMAGE} -C none -A ${UBOOT_ARCH} -T script -d ${WORKDIR}/${UBOOT_ENV_SRC} ${WORKDIR}/${UBOOT_ENV_BINARY}
96eff27476SAndrew Geissler    fi
97eb8dc403SDave Cobbley}
98eb8dc403SDave Cobbley
99eb8dc403SDave Cobbleydo_install () {
100eb8dc403SDave Cobbley    if [ -n "${UBOOT_CONFIG}" ]
101eb8dc403SDave Cobbley    then
102eb8dc403SDave Cobbley        for config in ${UBOOT_MACHINE}; do
103eb8dc403SDave Cobbley            i=$(expr $i + 1);
104eb8dc403SDave Cobbley            for type in ${UBOOT_CONFIG}; do
105eb8dc403SDave Cobbley                j=$(expr $j + 1);
106eb8dc403SDave Cobbley                if [ $j -eq $i ]
107eb8dc403SDave Cobbley                then
108d159c7fbSAndrew Geissler                    install -D -m 644 ${B}/${config}/${UBOOT_BINARYNAME}-${type}.${UBOOT_SUFFIX} ${D}/boot/${UBOOT_BINARYNAME}-${type}-${PV}-${PR}.${UBOOT_SUFFIX}
109d159c7fbSAndrew Geissler                    ln -sf ${UBOOT_BINARYNAME}-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${D}/boot/${UBOOT_BINARY}-${type}
110d159c7fbSAndrew Geissler                    ln -sf ${UBOOT_BINARYNAME}-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${D}/boot/${UBOOT_BINARY}
11182c905dcSAndrew Geissler
11282c905dcSAndrew Geissler                    # Install the uboot-initial-env
1134ed12e16SAndrew Geissler                    if [ -n "${UBOOT_INITIAL_ENV}" ]; then
1144ed12e16SAndrew Geissler                        install -D -m 644 ${B}/${config}/u-boot-initial-env-${type} ${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}-${MACHINE}-${type}-${PV}-${PR}
1154ed12e16SAndrew Geissler                        ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${type}-${PV}-${PR} ${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}-${MACHINE}-${type}
1164ed12e16SAndrew Geissler                        ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${type}-${PV}-${PR} ${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}-${type}
1174ed12e16SAndrew Geissler                        ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${type}-${PV}-${PR} ${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}
1184ed12e16SAndrew Geissler                    fi
119eb8dc403SDave Cobbley                fi
120eb8dc403SDave Cobbley            done
121eb8dc403SDave Cobbley            unset j
122eb8dc403SDave Cobbley        done
123eb8dc403SDave Cobbley        unset i
124eb8dc403SDave Cobbley    else
12582c905dcSAndrew Geissler        install -D -m 644 ${B}/${UBOOT_BINARY} ${D}/boot/${UBOOT_IMAGE}
126eb8dc403SDave Cobbley        ln -sf ${UBOOT_IMAGE} ${D}/boot/${UBOOT_BINARY}
12782c905dcSAndrew Geissler
12882c905dcSAndrew Geissler        # Install the uboot-initial-env
1294ed12e16SAndrew Geissler        if [ -n "${UBOOT_INITIAL_ENV}" ]; then
1304ed12e16SAndrew Geissler            install -D -m 644 ${B}/u-boot-initial-env ${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}-${MACHINE}-${PV}-${PR}
1314ed12e16SAndrew Geissler            ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${PV}-${PR} ${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}-${MACHINE}
1324ed12e16SAndrew Geissler            ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${PV}-${PR} ${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}
1334ed12e16SAndrew Geissler        fi
134eb8dc403SDave Cobbley    fi
135eb8dc403SDave Cobbley
136eb8dc403SDave Cobbley    if [ -n "${UBOOT_ELF}" ]
137eb8dc403SDave Cobbley    then
138eb8dc403SDave Cobbley        if [ -n "${UBOOT_CONFIG}" ]
139eb8dc403SDave Cobbley        then
140eb8dc403SDave Cobbley            for config in ${UBOOT_MACHINE}; do
141eb8dc403SDave Cobbley                i=$(expr $i + 1);
142eb8dc403SDave Cobbley                for type in ${UBOOT_CONFIG}; do
143eb8dc403SDave Cobbley                    j=$(expr $j + 1);
144eb8dc403SDave Cobbley                    if [ $j -eq $i ]
145eb8dc403SDave Cobbley                    then
146eb8dc403SDave Cobbley                        install -m 644 ${B}/${config}/${UBOOT_ELF} ${D}/boot/u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX}
147eb8dc403SDave Cobbley                        ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${D}/boot/${UBOOT_BINARY}-${type}
148eb8dc403SDave Cobbley                        ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${D}/boot/${UBOOT_BINARY}
149eb8dc403SDave Cobbley                    fi
150eb8dc403SDave Cobbley                done
151eb8dc403SDave Cobbley                unset j
152eb8dc403SDave Cobbley            done
153eb8dc403SDave Cobbley            unset i
154eb8dc403SDave Cobbley        else
155eb8dc403SDave Cobbley            install -m 644 ${B}/${UBOOT_ELF} ${D}/boot/${UBOOT_ELF_IMAGE}
156eb8dc403SDave Cobbley            ln -sf ${UBOOT_ELF_IMAGE} ${D}/boot/${UBOOT_ELF_BINARY}
157eb8dc403SDave Cobbley        fi
158eb8dc403SDave Cobbley    fi
159eb8dc403SDave Cobbley
160eb8dc403SDave Cobbley    if [ -e ${WORKDIR}/fw_env.config ] ; then
161eb8dc403SDave Cobbley        install -d ${D}${sysconfdir}
162eb8dc403SDave Cobbley        install -m 644 ${WORKDIR}/fw_env.config ${D}${sysconfdir}/fw_env.config
163eb8dc403SDave Cobbley    fi
164eb8dc403SDave Cobbley
165eb8dc403SDave Cobbley    if [ -n "${SPL_BINARY}" ]
166eb8dc403SDave Cobbley    then
167eb8dc403SDave Cobbley        if [ -n "${UBOOT_CONFIG}" ]
168eb8dc403SDave Cobbley        then
169eb8dc403SDave Cobbley            for config in ${UBOOT_MACHINE}; do
170eb8dc403SDave Cobbley                i=$(expr $i + 1);
171eb8dc403SDave Cobbley                for type in ${UBOOT_CONFIG}; do
172eb8dc403SDave Cobbley                    j=$(expr $j + 1);
173eb8dc403SDave Cobbley                    if [ $j -eq $i ]
174eb8dc403SDave Cobbley                    then
175d159c7fbSAndrew Geissler                         install -m 644 ${B}/${config}/${SPL_BINARY} ${D}/boot/${SPL_BINARYNAME}-${type}-${PV}-${PR}${SPL_DELIMITER}${SPL_SUFFIX}
176d159c7fbSAndrew Geissler                         ln -sf ${SPL_BINARYNAME}-${type}-${PV}-${PR}${SPL_DELIMITER}${SPL_SUFFIX} ${D}/boot/${SPL_BINARYFILE}-${type}
177d159c7fbSAndrew Geissler                         ln -sf ${SPL_BINARYNAME}-${type}-${PV}-${PR}${SPL_DELIMITER}${SPL_SUFFIX} ${D}/boot/${SPL_BINARYFILE}
178eb8dc403SDave Cobbley                    fi
179eb8dc403SDave Cobbley                done
180eb8dc403SDave Cobbley                unset j
181eb8dc403SDave Cobbley            done
182eb8dc403SDave Cobbley            unset i
183eb8dc403SDave Cobbley        else
184eb8dc403SDave Cobbley            install -m 644 ${B}/${SPL_BINARY} ${D}/boot/${SPL_IMAGE}
185d159c7fbSAndrew Geissler            ln -sf ${SPL_IMAGE} ${D}/boot/${SPL_BINARYFILE}
186eb8dc403SDave Cobbley        fi
187eb8dc403SDave Cobbley    fi
188eb8dc403SDave Cobbley
189eb8dc403SDave Cobbley    if [ -n "${UBOOT_ENV}" ]
190eb8dc403SDave Cobbley    then
191eb8dc403SDave Cobbley        install -m 644 ${WORKDIR}/${UBOOT_ENV_BINARY} ${D}/boot/${UBOOT_ENV_IMAGE}
192eb8dc403SDave Cobbley        ln -sf ${UBOOT_ENV_IMAGE} ${D}/boot/${UBOOT_ENV_BINARY}
193eb8dc403SDave Cobbley    fi
194eb8dc403SDave Cobbley
195eb8dc403SDave Cobbley    if [ "${UBOOT_EXTLINUX}" = "1" ]
196eb8dc403SDave Cobbley    then
197eb8dc403SDave Cobbley        install -Dm 0644 ${UBOOT_EXTLINUX_CONFIG} ${D}/${UBOOT_EXTLINUX_INSTALL_DIR}/${UBOOT_EXTLINUX_CONF_NAME}
198eb8dc403SDave Cobbley    fi
199eb8dc403SDave Cobbley}
200eb8dc403SDave Cobbley
2010ca19ccfSPatrick WilliamsPACKAGE_BEFORE_PN += "${PN}-env ${PN}-extlinux"
20282c905dcSAndrew Geissler
203213cb269SPatrick WilliamsRPROVIDES:${PN}-env += "u-boot-default-env"
204213cb269SPatrick WilliamsALLOW_EMPTY:${PN}-env = "1"
205213cb269SPatrick WilliamsFILES:${PN}-env = " \
2064ed12e16SAndrew Geissler    ${@ '${sysconfdir}/${UBOOT_INITIAL_ENV}*' if d.getVar('UBOOT_INITIAL_ENV') else ''} \
20782c905dcSAndrew Geissler    ${sysconfdir}/fw_env.config \
20882c905dcSAndrew Geissler"
20982c905dcSAndrew Geissler
2100ca19ccfSPatrick WilliamsFILES:${PN}-extlinux = "${UBOOT_EXTLINUX_INSTALL_DIR}/${UBOOT_EXTLINUX_CONF_NAME}"
2110ca19ccfSPatrick WilliamsRDEPENDS:${PN} += "${@bb.utils.contains('UBOOT_EXTLINUX', '1', '${PN}-extlinux', '', d)}"
2120ca19ccfSPatrick Williams
213517393d9SAndrew GeisslerSYSROOT_DIRS += "/boot"
214213cb269SPatrick WilliamsFILES:${PN} = "/boot ${datadir}"
215213cb269SPatrick WilliamsRDEPENDS:${PN} += "${PN}-env"
216eb8dc403SDave Cobbley
217eb8dc403SDave Cobbleydo_deploy () {
218eb8dc403SDave Cobbley    if [ -n "${UBOOT_CONFIG}" ]
219eb8dc403SDave Cobbley    then
220eb8dc403SDave Cobbley        for config in ${UBOOT_MACHINE}; do
221eb8dc403SDave Cobbley            i=$(expr $i + 1);
222eb8dc403SDave Cobbley            for type in ${UBOOT_CONFIG}; do
223eb8dc403SDave Cobbley                j=$(expr $j + 1);
224eb8dc403SDave Cobbley                if [ $j -eq $i ]
225eb8dc403SDave Cobbley                then
226d159c7fbSAndrew Geissler                    install -D -m 644 ${B}/${config}/${UBOOT_BINARYNAME}-${type}.${UBOOT_SUFFIX} ${DEPLOYDIR}/${UBOOT_BINARYNAME}-${type}-${PV}-${PR}.${UBOOT_SUFFIX}
227eb8dc403SDave Cobbley                    cd ${DEPLOYDIR}
228d159c7fbSAndrew Geissler                    ln -sf ${UBOOT_BINARYNAME}-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${UBOOT_SYMLINK}-${type}
229d159c7fbSAndrew Geissler                    ln -sf ${UBOOT_BINARYNAME}-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${UBOOT_SYMLINK}
230d159c7fbSAndrew Geissler                    ln -sf ${UBOOT_BINARYNAME}-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${UBOOT_BINARY}-${type}
231d159c7fbSAndrew Geissler                    ln -sf ${UBOOT_BINARYNAME}-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${UBOOT_BINARY}
23282c905dcSAndrew Geissler
23382c905dcSAndrew Geissler                    # Deploy the uboot-initial-env
2344ed12e16SAndrew Geissler                    if [ -n "${UBOOT_INITIAL_ENV}" ]; then
2354ed12e16SAndrew Geissler                        install -D -m 644 ${B}/${config}/u-boot-initial-env-${type} ${DEPLOYDIR}/${UBOOT_INITIAL_ENV}-${MACHINE}-${type}-${PV}-${PR}
23682c905dcSAndrew Geissler                        cd ${DEPLOYDIR}
2374ed12e16SAndrew Geissler                        ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${type}-${PV}-${PR} ${UBOOT_INITIAL_ENV}-${MACHINE}-${type}
2384ed12e16SAndrew Geissler                        ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${type}-${PV}-${PR} ${UBOOT_INITIAL_ENV}-${type}
2394ed12e16SAndrew Geissler                    fi
240eb8dc403SDave Cobbley                fi
241eb8dc403SDave Cobbley            done
242eb8dc403SDave Cobbley            unset j
243eb8dc403SDave Cobbley        done
244eb8dc403SDave Cobbley        unset i
245eb8dc403SDave Cobbley    else
24682c905dcSAndrew Geissler        install -D -m 644 ${B}/${UBOOT_BINARY} ${DEPLOYDIR}/${UBOOT_IMAGE}
24782c905dcSAndrew Geissler
248eb8dc403SDave Cobbley        cd ${DEPLOYDIR}
249eb8dc403SDave Cobbley        rm -f ${UBOOT_BINARY} ${UBOOT_SYMLINK}
250eb8dc403SDave Cobbley        ln -sf ${UBOOT_IMAGE} ${UBOOT_SYMLINK}
251eb8dc403SDave Cobbley        ln -sf ${UBOOT_IMAGE} ${UBOOT_BINARY}
25282c905dcSAndrew Geissler
25382c905dcSAndrew Geissler        # Deploy the uboot-initial-env
2544ed12e16SAndrew Geissler        if [ -n "${UBOOT_INITIAL_ENV}" ]; then
2554ed12e16SAndrew Geissler            install -D -m 644 ${B}/u-boot-initial-env ${DEPLOYDIR}/${UBOOT_INITIAL_ENV}-${MACHINE}-${PV}-${PR}
25682c905dcSAndrew Geissler            cd ${DEPLOYDIR}
2574ed12e16SAndrew Geissler            ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${PV}-${PR} ${UBOOT_INITIAL_ENV}-${MACHINE}
2584ed12e16SAndrew Geissler            ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${PV}-${PR} ${UBOOT_INITIAL_ENV}
2594ed12e16SAndrew Geissler        fi
26082c905dcSAndrew Geissler    fi
26182c905dcSAndrew Geissler
26282c905dcSAndrew Geissler    if [ -e ${WORKDIR}/fw_env.config ] ; then
26382c905dcSAndrew Geissler        install -D -m 644 ${WORKDIR}/fw_env.config ${DEPLOYDIR}/fw_env.config-${MACHINE}-${PV}-${PR}
26482c905dcSAndrew Geissler        cd ${DEPLOYDIR}
26582c905dcSAndrew Geissler        ln -sf fw_env.config-${MACHINE}-${PV}-${PR} fw_env.config-${MACHINE}
26682c905dcSAndrew Geissler        ln -sf fw_env.config-${MACHINE}-${PV}-${PR} fw_env.config
267eb8dc403SDave Cobbley    fi
268eb8dc403SDave Cobbley
269eb8dc403SDave Cobbley    if [ -n "${UBOOT_ELF}" ]
270eb8dc403SDave Cobbley    then
271eb8dc403SDave Cobbley        if [ -n "${UBOOT_CONFIG}" ]
272eb8dc403SDave Cobbley        then
273eb8dc403SDave Cobbley            for config in ${UBOOT_MACHINE}; do
274eb8dc403SDave Cobbley                i=$(expr $i + 1);
275eb8dc403SDave Cobbley                for type in ${UBOOT_CONFIG}; do
276eb8dc403SDave Cobbley                    j=$(expr $j + 1);
277eb8dc403SDave Cobbley                    if [ $j -eq $i ]
278eb8dc403SDave Cobbley                    then
279eb8dc403SDave Cobbley                        install -m 644 ${B}/${config}/${UBOOT_ELF} ${DEPLOYDIR}/u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX}
280eb8dc403SDave Cobbley                        ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${DEPLOYDIR}/${UBOOT_ELF_BINARY}-${type}
281eb8dc403SDave Cobbley                        ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${DEPLOYDIR}/${UBOOT_ELF_BINARY}
282eb8dc403SDave Cobbley                        ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${DEPLOYDIR}/${UBOOT_ELF_SYMLINK}-${type}
283eb8dc403SDave Cobbley                        ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${DEPLOYDIR}/${UBOOT_ELF_SYMLINK}
284eb8dc403SDave Cobbley                    fi
285eb8dc403SDave Cobbley                done
286eb8dc403SDave Cobbley                unset j
287eb8dc403SDave Cobbley            done
288eb8dc403SDave Cobbley            unset i
289eb8dc403SDave Cobbley        else
290eb8dc403SDave Cobbley            install -m 644 ${B}/${UBOOT_ELF} ${DEPLOYDIR}/${UBOOT_ELF_IMAGE}
291eb8dc403SDave Cobbley            ln -sf ${UBOOT_ELF_IMAGE} ${DEPLOYDIR}/${UBOOT_ELF_BINARY}
292eb8dc403SDave Cobbley            ln -sf ${UBOOT_ELF_IMAGE} ${DEPLOYDIR}/${UBOOT_ELF_SYMLINK}
293eb8dc403SDave Cobbley        fi
294eb8dc403SDave Cobbley    fi
295eb8dc403SDave Cobbley
296eb8dc403SDave Cobbley
297eb8dc403SDave Cobbley     if [ -n "${SPL_BINARY}" ]
298eb8dc403SDave Cobbley     then
299eb8dc403SDave Cobbley        if [ -n "${UBOOT_CONFIG}" ]
300eb8dc403SDave Cobbley        then
301eb8dc403SDave Cobbley            for config in ${UBOOT_MACHINE}; do
302eb8dc403SDave Cobbley                i=$(expr $i + 1);
303eb8dc403SDave Cobbley                for type in ${UBOOT_CONFIG}; do
304eb8dc403SDave Cobbley                    j=$(expr $j + 1);
305eb8dc403SDave Cobbley                    if [ $j -eq $i ]
306eb8dc403SDave Cobbley                    then
307d159c7fbSAndrew Geissler                        install -m 644 ${B}/${config}/${SPL_BINARY} ${DEPLOYDIR}/${SPL_BINARYNAME}-${type}-${PV}-${PR}${SPL_DELIMITER}${SPL_SUFFIX}
308d159c7fbSAndrew Geissler                        rm -f ${DEPLOYDIR}/${SPL_BINARYFILE} ${DEPLOYDIR}/${SPL_SYMLINK}
309d159c7fbSAndrew Geissler                        ln -sf ${SPL_BINARYNAME}-${type}-${PV}-${PR}${SPL_DELIMITER}${SPL_SUFFIX} ${DEPLOYDIR}/${SPL_BINARYFILE}-${type}
310d159c7fbSAndrew Geissler                        ln -sf ${SPL_BINARYNAME}-${type}-${PV}-${PR}${SPL_DELIMITER}${SPL_SUFFIX} ${DEPLOYDIR}/${SPL_BINARYFILE}
311d159c7fbSAndrew Geissler                        ln -sf ${SPL_BINARYNAME}-${type}-${PV}-${PR}${SPL_DELIMITER}${SPL_SUFFIX} ${DEPLOYDIR}/${SPL_SYMLINK}-${type}
312d159c7fbSAndrew Geissler                        ln -sf ${SPL_BINARYNAME}-${type}-${PV}-${PR}${SPL_DELIMITER}${SPL_SUFFIX} ${DEPLOYDIR}/${SPL_SYMLINK}
313eb8dc403SDave Cobbley                    fi
314eb8dc403SDave Cobbley                done
315eb8dc403SDave Cobbley                unset j
316eb8dc403SDave Cobbley            done
317eb8dc403SDave Cobbley            unset i
318eb8dc403SDave Cobbley        else
319eb8dc403SDave Cobbley            install -m 644 ${B}/${SPL_BINARY} ${DEPLOYDIR}/${SPL_IMAGE}
320eb8dc403SDave Cobbley            ln -sf ${SPL_IMAGE} ${DEPLOYDIR}/${SPL_BINARYNAME}
321eb8dc403SDave Cobbley            ln -sf ${SPL_IMAGE} ${DEPLOYDIR}/${SPL_SYMLINK}
322eb8dc403SDave Cobbley        fi
323eb8dc403SDave Cobbley    fi
324eb8dc403SDave Cobbley
325eb8dc403SDave Cobbley    if [ -n "${UBOOT_ENV}" ]
326eb8dc403SDave Cobbley    then
327eb8dc403SDave Cobbley        install -m 644 ${WORKDIR}/${UBOOT_ENV_BINARY} ${DEPLOYDIR}/${UBOOT_ENV_IMAGE}
328eb8dc403SDave Cobbley        ln -sf ${UBOOT_ENV_IMAGE} ${DEPLOYDIR}/${UBOOT_ENV_BINARY}
329eb8dc403SDave Cobbley        ln -sf ${UBOOT_ENV_IMAGE} ${DEPLOYDIR}/${UBOOT_ENV_SYMLINK}
330eb8dc403SDave Cobbley    fi
331eb8dc403SDave Cobbley
332eb8dc403SDave Cobbley    if [ "${UBOOT_EXTLINUX}" = "1" ]
333eb8dc403SDave Cobbley    then
334eb8dc403SDave Cobbley        install -m 644 ${UBOOT_EXTLINUX_CONFIG} ${DEPLOYDIR}/${UBOOT_EXTLINUX_SYMLINK}
335eb8dc403SDave Cobbley        ln -sf ${UBOOT_EXTLINUX_SYMLINK} ${DEPLOYDIR}/${UBOOT_EXTLINUX_CONF_NAME}-${MACHINE}
336eb8dc403SDave Cobbley        ln -sf ${UBOOT_EXTLINUX_SYMLINK} ${DEPLOYDIR}/${UBOOT_EXTLINUX_CONF_NAME}
337eb8dc403SDave Cobbley    fi
3380903674eSAndrew Geissler
3390903674eSAndrew Geissler    if [ -n "${UBOOT_DTB}" ]
3400903674eSAndrew Geissler    then
3416aa7eec5SAndrew Geissler        install -m 644 ${B}/arch/${UBOOT_ARCH_DIR}/dts/${UBOOT_DTB_BINARY} ${DEPLOYDIR}/
3420903674eSAndrew Geissler    fi
343eb8dc403SDave Cobbley}
344eb8dc403SDave Cobbley
345eb8dc403SDave Cobbleyaddtask deploy before do_build after do_compile
346