summaryrefslogtreecommitdiff
path: root/recipes-bsp/barebox/barebox.inc
blob: b37fc9b647499b2d8ad625965ba43d4e97fcd04d (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
SUMMARY = "The barebox bootloader"
DESCRIPTION = "The barebox is a bootloader designed for embedded systems. It \
               runs on a variety of architectures including x86, ARM, MIPS, \
               PowerPC and others."
HOMEPAGE = "http://www.barebox.org"
SECTION = "bootloaders"
LICENSE = "GPL-2.0"
LIC_FILES_CHKSUM = "file://COPYING;md5=057bf9e50e1ca857d0eb97bfe4ba8e5d"
DEPENDS += "lzop-native coreutils-native"
PROVIDES = "virtual/bootloader"
# Increase INC_PR everytime the include file is changed.
INC_PR = "r7"

SRC_URI = "http://barebox.org/download/barebox-${PV}.tar.bz2"
PATCHTOOL = "git"

inherit kernel-arch deploy
inherit kconfig

# Barebox doesn't seperate arm 32bit and 64bit. So we have to set
# ARCH to arm for 64bit.
ARCH_aarch64 = "arm"

# verbose build 0/1
VERBOSE_BUILD ?= "0"
EXTRA_OEMAKE = 'CROSS_COMPILE="${TARGET_PREFIX}" CC="${TARGET_PREFIX}gcc" V="${VERBOSE_BUILD}"'
B = "${WORKDIR}/build"

# name of the image created by barebox Makefile
BAREBOX_BIN ?= "barebox.bin"
# filename of file to be deployed by this recipe
BAREBOX_IMAGE_NAME ?= "barebox-${MACHINE}-${PKGV}-${PKGR}${IMAGE_VERSION_SUFFIX}"
BAREBOX_IMAGE_NAME[vardepsexclude] += "IMAGE_VERSION_SUFFIX"
BAREBOX_BIN_LINK_NAME ?= "barebox.bin"

do_configure_append() {
    # Don't compile target tools for barebox here
    kconfig_set BAREBOXENV_TARGET n
    kconfig_set BAREBOXCRC32_TARGET n
    kconfig_set KERNEL_INSTALL_TARGET n
    kconfig_set IMD_TARGET n
}

do_compile () {
    unset CFLAGS
    export LDFLAGS="--no-dynamic-linker"
    oe_runmake all
}

# target rootfs boot directory
base_bootdir = "/boot"

do_install () {
    bbnote "Installing barebox image on target rootfs"
    install -d ${D}${base_bootdir}
    install ${B}/${BAREBOX_BIN} ${D}${base_bootdir}/${BAREBOX_IMAGE_NAME}.bin
    ln -sf ${BAREBOX_IMAGE_NAME}.bin ${D}${base_bootdir}/${BAREBOX_BIN_LINK_NAME}
}
do_install[prefuncs] += "package_get_auto_pr"

PACKAGE_ARCH = "${MACHINE_ARCH}"

FILES_${PN} = "${base_bootdir}"

do_deploy () {
    bbnote "Deploying barebox"
    install -m 644 ${B}/${BAREBOX_BIN} ${DEPLOYDIR}/${BAREBOX_IMAGE_NAME}.bin
    ln -sf ${BAREBOX_IMAGE_NAME}.bin ${DEPLOYDIR}/${BAREBOX_BIN_LINK_NAME}

    bbnote "Installing host barebox toolset"
    install -d ${STAGING_BINDIR_NATIVE}
    install -m 755 ${B}/scripts/bareboxenv ${STAGING_BINDIR_NATIVE}/

    install -m 644 ${B}/.config ${DEPLOYDIR}/${BAREBOX_IMAGE_NAME}.config
    ln -sf ${BAREBOX_IMAGE_NAME}.config ${DEPLOYDIR}/${PN}.config
}
do_deploy[prefuncs] += "package_get_auto_pr"
addtask deploy before do_build after do_compile