summaryrefslogtreecommitdiff
path: root/recipes-bsp/u-boot/u-boot-toradex-ti_2023.04.bb
blob: a49e37cef9265ebea7823a68e79ec94d5e974f1e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
SUMMARY = "U-Boot bootloader with support for Toradex AM62 series SoMs"
HOMEPAGE = "http://www.denx.de/wiki/U-Boot/WebHome"
SECTION = "bootloaders"
LICENSE = "GPL-2.0-or-later"

require recipes-bsp/u-boot/u-boot-ti.inc

LIC_FILES_CHKSUM = "file://Licenses/README;md5=2ca5f2c35c8cc335f0a19756634782f1"

SRC_URI = "git://git.toradex.com/u-boot-toradex.git;protocol=https;branch=${SRCBRANCH}"

SRCREV = "1f3132604196ba70372d9ef99bc8a7ffeb275742"
SRCREV:use-head-next = "${AUTOREV}"
SRCBRANCH = "toradex_ti-u-boot-2023.04"

B = "${WORKDIR}/build"
S = "${WORKDIR}/git"

inherit toradex-u-boot-localversion

UBOOT_INITIAL_ENV = "u-boot-initial-env"

COMPATIBLE_MACHINE = "(ti-soc)"
PACKAGE_ARCH = "${MACHINE_ARCH}"

# preserve and deploy u-boot-initial-env if building for the Cortex-A53 core
# even if u-boot-ti.inc do_deploy() tries to delete it.
DEPLOY_INITIAL_ENV = "install -D -m 644 ${B}/sd/u-boot-initial-env ${DEPLOYDIR}/ || true"
DEPLOY_INITIAL_ENV:k3r5 = ":"
do_deploy:append () {
    ${DEPLOY_INITIAL_ENV}
}
do_deploy:append:k3r5 () {
    if [ -n "${UBOOT_CONFIG}" ]
    then
        for config in ${UBOOT_MACHINE}; do
            if [ x${config} = "xverdin-am62_r5_usbdfu_defconfig" ]
            then
                TARGETSUFFIX="-dfu"
            else
                TARGETSUFFIX=""
            fi
            i=$(expr $i + 1);
            for type in ${UBOOT_CONFIG}; do
                j=$(expr $j + 1);
                if [ $j -eq $i ]
                then
                    for f in ${B}/${config}/tiboot3-*.bin; do
                        if [ -f "$f" ]; then
                            TARGET=$(basename $f)${TARGETSUFFIX}
                            install -m 644 $f ${DEPLOYDIR}/${TARGET}
                        fi
                    done

                    for f in ${B}/${config}/sysfw*.itb; do
                            if [ -f "$f" ]; then
                                    install -m 644 $f ${DEPLOYDIR}/
                            fi
                    done
                fi
            done
            unset j
        done
        unset i
    else
        if ! [ -f ${B}/${UBOOT_BINARY} ]; then
            ln -s spl/${UBOOT_BINARY} ${B}/${UBOOT_BINARY}
        fi
    fi
}

# build the k3r5 spl also for DFU
do_compile:append:k3r5 () {
    if [ -L ${B}/${UBOOT_BINARY} ]; then
        rm ${B}/${UBOOT_BINARY}
    fi

    if [ -n "${UBOOT_CONFIG}" ]
    then
        for config in ${UBOOT_MACHINE}; do
            i=$(expr $i + 1);
            for type in ${UBOOT_CONFIG}; do
                j=$(expr $j + 1);
                if [ $j -eq $i ]
                then
                    if ! [ -f ${B}/${config}/${UBOOT_BINARY} ]; then
                        ln -s spl/${UBOOT_BINARY} ${B}/${config}/${UBOOT_BINARY}
                    fi
                fi
            done
            unset j
        done
        unset i
    else
        if ! [ -f ${B}/${UBOOT_BINARY} ]; then
            ln -s spl/${UBOOT_BINARY} ${B}/${UBOOT_BINARY}
        fi
    fi
}