summaryrefslogtreecommitdiffstats
path: root/meta-fsl-ppc/recipes-kernel/u-boot/u-boot_git.bb
blob: c1d0c6978b19bbad6afb4bf91937d848c804313e (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
DESCRIPTION = "U-boot bootloader"
HOMEPAGE = "http://u-boot.sf.net"
SECTION = "bootloaders"
PROVIDES = "virtual/bootloader"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=1707d6db1d42237583f50183a5651ecb"

PR = "r6"
INHIBIT_DEFAULT_DEPS = "1"
DEPENDS = "boot-format-native virtual/${TARGET_PREFIX}gcc"

inherit deploy

SRCREV = "348d8fceba39e5622d315ffda7d72ff6bbcf05ec"
SRC_URI = "git://git.freescale.com/ppc/sdk/u-boot.git \
		"

EXTRA_OEMAKE = 'CROSS_COMPILE=${TARGET_PREFIX} CC="${CC}"'
EXTRA_OEMAKE_e5500-64b = 'CROSS_COMPILE=${TARGET_PREFIX} CC="${CC} -m32" LD="${LD} -melf32ppc"'

PACKAGE_ARCH = "${MACHINE_ARCH}"

USRC ?= ""
S = ${@base_conditional("USRC", "", "${WORKDIR}/git", "${USRC}", d)}

do_compile () {
	unset LDFLAGS
	unset CFLAGS
	unset CPPFLAGS

	if [ "x${UBOOT_MACHINES}" == "x" ]; then
		UBOOT_MACHINES=${UBOOT_MACHINE}
	fi

	for board in ${UBOOT_MACHINES}; do
		oe_runmake O=${board} distclean
		oe_runmake O=${board} ${board}
		oe_runmake O=${board} all

		case "${board}" in
		*SDCARD*)	UBOOT_TARGET="u-bootx-sd";;
		*SPIFLASH*)	UBOOT_TARGET="u-bootx-spi";;
		*)		UBOOT_TARGET="";;
		esac

		if [ "x${UBOOT_TARGET}" != "x" ]; then
			${STAGING_BINDIR_NATIVE}/boot_format \
				${STAGING_DATADIR_NATIVE}/${BOOTFORMAT_CONFIG} \
				${S}/${board}/u-boot.bin -spi ${S}/${board}/${UBOOT_TARGET}.bin
		fi
	done
}

do_install(){
	if [ "x${UBOOT_MACHINES}" == "x" ]; then
		UBOOT_MACHINES=${UBOOT_MACHINE}
	fi

	for board in ${UBOOT_MACHINES}; do
		case "${board}" in
		*SDCARD*)	UBOOT_TARGET="u-bootx-sd";;
		*SPIFLASH*)	UBOOT_TARGET="u-bootx-spi";;
		*NAND*)		UBOOT_TARGET="u-boot-nand";;
		*)		UBOOT_TARGET="u-boot";;
		esac

		if [ -f ${S}/${UBOOT_TARGET}.bin ]; then
			install ${S}/${board}/${UBOOT_TARGET}.bin ${D}/boot/${UBOOT_TARGET}-${MACHINE}-${PV}-${PR}.bin
			ln -sf ${UBOOT_TARGET}-${MACHINE}-${PV}-${PR}.bin ${D}/boot/${UBOOT_TARGET}.bin
		fi
	done
}

do_deploy(){
	if [ "x${UBOOT_MACHINES}" == "x" ]; then
		UBOOT_MACHINES=${UBOOT_MACHINE}
	fi

	for board in ${UBOOT_MACHINES}; do
		case "${board}" in
		*SDCARD*)	UBOOT_TARGET="u-bootx-sd";;
		*SPIFLASH*)	UBOOT_TARGET="u-bootx-spi";;
		*NAND*)		UBOOT_TARGET="u-boot-nand";;
		*)		UBOOT_TARGET="u-boot";;
		esac

	        if [ -f ${S}/${board}/${UBOOT_TARGET}.bin ]; then
			mkdir -p ${DEPLOY_DIR_IMAGE}
	        	install ${S}/${board}/${UBOOT_TARGET}.bin ${DEPLOY_DIR_IMAGE}/${UBOOT_TARGET}-${MACHINE}-${PV}-${PR}.bin

			cd ${DEPLOY_DIR_IMAGE}
			rm -f ${UBOOT_TARGET}-${MACHINE}.bin
			ln -sf ${UBOOT_TARGET}-${MACHINE}-${PV}-${PR}.bin ${UBOOT_TARGET}-${MACHINE}.bin
		fi
	done
}
addtask deploy after do_install

FILES_${PN} += "/boot"

ALLOW_EMPTY = 1