u-boot: enhance deploy symlinking logic
[glsdk/meta-ti-glsdk.git] / recipes-bsp / u-boot / u-boot.inc
1 DESCRIPTION = "U-Boot - the Universal Boot Loader"
2 HOMEPAGE = "http://www.denx.de/wiki/U-Boot/WebHome"
3 SECTION = "bootloaders"
4 PRIORITY = "optional"
5 LICENSE = "GPLv2+"
6 LIC_FILES_CHKSUM = "file://COPYING;md5=4c6cde5df68eff615d36789dc18edd3b"
8 PROVIDES = "virtual/bootloader"
10 DEPENDS = "mtd-utils"
12 PACKAGE_ARCH = "${MACHINE_ARCH}"
13 PARALLEL_MAKE=""
15 EXTRA_OEMAKE = "CROSS_COMPILE=${TARGET_PREFIX}"
17 UBOOT_MACHINE ?= "${MACHINE}_config"
18 UBOOT_BINARY ?= "u-boot.bin"
19 UBOOT_IMAGE ?= "u-boot-${MACHINE}-${PV}-${PR}.bin"
20 UBOOT_SYMLINK ?= "u-boot-${MACHINE}.bin"
21 UBOOT_MAKE_TARGET ?= "all"
23 do_configure () {
24         oe_runmake ${UBOOT_MACHINE}
25 }
27 do_compile () {
28         unset LDFLAGS
29         unset CFLAGS
30         unset CPPFLAGS
31         oe_runmake ${UBOOT_MAKE_TARGET}
32         oe_runmake tools env
33 }
35 do_install () {
36         install -d ${D}/boot
37         install ${S}/${UBOOT_BINARY} ${D}/boot/${UBOOT_IMAGE}
38         ln -sf ${UBOOT_IMAGE} ${D}/boot/${UBOOT_BINARY}
40         if [ -e ${WORKDIR}/fw_env.config ] ; then
41             install -d ${D}${base_sbindir}
42                 install -d ${D}${sysconfdir}
43                 install -m 644 ${WORKDIR}/fw_env.config ${D}${sysconfdir}/fw_env.config
44 #               install -m 755 ${S}/tools/env/fw_printenv ${D}${base_sbindir}/fw_printenv
45 #               install -m 755 ${S}/tools/env/fw_printenv ${D}${base_sbindir}/fw_setenv
46         fi
48 }
50 FILES_${PN} = "/boot"
51 # no gnu_hash in uboot.bin, by design, so skip QA
52 INSANE_SKIP_${PN} = True
54 PACKAGES += "${PN}-fw-utils"
55 FILES_${PN}-fw-utils = "${sysconfdir} ${base_sbindir}"
57 inherit deploy
59 addtask deploy before do_package after do_compile
61 do_deploy () {
62         install -d ${DEPLOY_DIR_IMAGE}
63         install ${S}/${UBOOT_BINARY} ${DEPLOY_DIR_IMAGE}/${UBOOT_IMAGE}
65         cd ${DEPLOY_DIR_IMAGE}
66         rm -f ${UBOOT_BINARY} ${UBOOT_SYMLINK}
67         ln -sf ${UBOOT_IMAGE} ${UBOOT_SYMLINK}
68         ln -sf ${UBOOT_IMAGE} ${UBOOT_BINARY}
70         if [ -e ${S}/MLO ] ; then
71                 install ${S}/MLO ${DEPLOY_DIR_IMAGE}/MLO-${MACHINE}-${PV}
72                 rm -f ${DEPLOY_DIR_IMAGE}/MLO-${MACHINE} ${DEPLOY_DIR_IMAGE}/MLO
73                 ln -sf MLO-${MACHINE}-${PV} ${DEPLOY_DIR_IMAGE}/MLO-${MACHINE}
74                 ln -sf MLO-${MACHINE}-${PV} ${DEPLOY_DIR_IMAGE}/MLO
75         fi
76 }