summaryrefslogtreecommitdiff
path: root/recipes-bsp/u-boot/u-boot-ledge.bb
blob: 4e75333c651a1e914e7dc4c2fbffbef8bf977a01 (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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
HOMEPAGE = "http://www.denx.de/wiki/U-Boot/WebHome"
SECTION = "bootloaders"
DEPENDS += "flex-native bison-native"

LICENSE = "GPLv2+"
LIC_FILES_CHKSUM = "file://Licenses/README;md5=5a7450c57ffe5ae63fd732446b988025"
PE = "1"

# We use the revision in order to avoid having to fetch it from the
# repo during parse

PV = "2021.01"

SRC_URI = "git://git.denx.de/u-boot.git"
SRCREV = "c4fddedc48f336eabc4ce3f74940e6aa372de18c"

SRC_URI += " \
    file://0000-ti-am572x-enable-boot_distrocmd.patch \
    file://0001-stm32mp-update-MMU-config-before-the-relocation.patch \
    file://0002-stm32mp-update-the-mmu-configuration-for-SPL-and-pre.patch \
    file://0003-arm-remove-TTB_SECT_XN_MASK-in-DCACHE_WRITETHROUGH.patch \
    file://0004-arm-cosmetic-align-TTB_SECT-define-value.patch \
    file://0005-arm-cp15-update-DACR-value-to-activate-access-contro.patch \
    file://0006-arm-omap2-remove-arm_init_domains.patch \
    file://0007-arm-cp15-remove-weak-function-arm_init_domains.patch \
    file://0008-arm-remove-set_dacr-get_dacr-functions.patch \
    file://0009-tpm2-Introduce-TIS-tpm-core.patch \
    file://0010-tpm2-Add-a-TPMv2-MMIO-TIS-driver.patch \
    file://ledge_stm32mp157c_dk2_trusted_defconfig \
    file://ubootefi.var \
    "

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

SRC_URI_append_ledge-qemuarm = " file://ledge-qemuarm_defconfig"
SRC_URI_append_ledge-qemuarm64 = " file://ledge-qemuarm64_defconfig"
SRC_URI_append_ledge-ti-am572x = " file://ledge-ti-am572x_defconfig"

PACKAGE_ARCH = "${MACHINE_ARCH}"

require recipes-bsp/u-boot/u-boot.inc
PROVIDES += "u-boot virtual/bootloader"
RPROVIDES_${PN} += "u-boot virtual/bootloader"

DEPENDS += "bc-native dtc-native"

do_configure_prepend() {
    for conf in ${UBOOT_MACHINE};
    do
        if [ -f ${WORKDIR}/$conf ] ;
        then
            cp ${WORKDIR}/$conf ${S}/configs/
        fi
    done
    cp ${WORKDIR}/ubootefi.var ${S}/
}

# -----------------------------------------------------------------------------
# Append deploy to handle specific device tree binary deployement
#
SPL_BINARY_LEDGE_ledge-stm32mp157c-dk2 = "spl/u-boot-spl.stm32"
do_deploy_append() {
if [ -n "${SPL_BINARY_LEDGE}" ]; then
    # Clean deploydir from any available binary first
    # This allows to only install the devicetree binary ones
    rm -rf ${DEPLOYDIR}

    # Install destination folder
    install -d ${DEPLOYDIR}

    if [ -n "${UBOOT_CONFIG}" ]; then
        unset i j k
        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
                    for binary in ${UBOOT_BINARIES}; do
                        binarysuffix=$(echo ${binary} | cut -d'.' -f2)
                        k=$(expr $k + 1);
                        if [ $k -eq $i ]; then
                            if [ -f ${B}/${config}/${binary} ];
                            then
                                install -m 644 ${B}/${config}/${binary} ${DEPLOYDIR}/u-boot-${type}.${binarysuffix}
                            fi
                            # As soon as SPL binary exists, install it
                            # This allow to mix u-boot configuration, with and without SPL
                            if [ -f ${B}/${config}/${SPL_BINARY_LEDGE} ]; then
                                install -d ${DEPLOYDIR}/spl
                                install -m 644 ${B}/${config}/${SPL_BINARY_LEDGE} ${DEPLOYDIR}/${SPL_BINARY_LEDGE}-${type}
                            fi
                        fi
                    done
                    unset k
                fi
            done
            unset j
        done
        unset i
    else
            bbfatal "Wrong u-boot-ledge configuration: please make sure to use UBOOT_CONFIG through BOOTSCHEME_LABELS config"
    fi
fi
}
do_deploy_append_ledge-qemuarm() {
    cd ${DEPLOYDIR}
    ln -sf u-boot-ledge-qemuarm.bin bl33.bin
    cd -
}

do_deploy_append_ledge-qemuarm64() {
    cd ${DEPLOYDIR}
    ln -sf u-boot-ledge-qemuarm64.bin bl33.bin
    cd -
}