blob: 13b93a9e21be5d4c3143721635b6d9f7c7f9ffa5 [file] [log] [blame]
# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
# Distributed under the terms of the GNU General Public License v2
EAPI=2
CROS_WORKON_COMMIT="9c5ef945fd3f05d0e2890f2a9f3f922876412343"
CROS_WORKON_PROJECT="chromiumos/third_party/u-boot"
inherit cros-debug toolchain-funcs
DESCRIPTION="Das U-Boot boot loader"
HOMEPAGE="http://www.denx.de/wiki/U-Boot"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="arm x86"
IUSE="profiling"
DEPEND=">=chromeos-base/vboot_reference-firmware-0.0.1-r175
"
RDEPEND="${DEPEND}
"
CROS_WORKON_LOCALNAME="u-boot"
CROS_WORKON_SUBDIR="files"
# This must be inherited *after* EGIT/CROS_WORKON variables defined
inherit cros-workon
UB_BUILD_DIR="${WORKDIR}/${ROOT}"
# TODO(vbendeb): this will have to be populated when it becomes necessary to
# build different config flavors.
ALL_UBOOT_FLAVORS=''
IUSE="${IUSE} ${ALL_UBOOT_FLAVORS}"
UB_ARCH="$(tc-arch-kernel)"
COMMON_MAKE_FLAGS="ARCH=${UB_ARCH} CROSS_COMPILE=${CHOST}- O=${UB_BUILD_DIR}"
COMMON_MAKE_FLAGS+=" VBOOT=${ROOT%/}/usr"
if use cros-debug; then
COMMON_MAKE_FLAGS+=" VBOOT_DEBUG=1"
fi
if use profiling; then
COMMON_MAKE_FLAGS+=" VBOOT_PERFORMANCE=1"
fi
get_required_config() {
case "${UB_ARCH}" in
(arm) echo 'chromeos_tegra2_twostop_config';;
(i386) echo 'coreboot-x86_config';;
(*) die "can not build for unknown architecture ${UB_ARCH}";;
esac
}
if use arm; then
COMMON_MAKE_FLAGS+=" USE_PRIVATE_LIBGCC=yes"
# We will supply an fdt at run time
COMMON_MAKE_FLAGS+=" DEV_TREE_SEPARATE=1"
fi
src_configure() {
local config
config=$(get_required_config)
elog "Using U-Boot config: ${config}"
emake \
${COMMON_MAKE_FLAGS} \
distclean
emake \
${COMMON_MAKE_FLAGS} \
${config} || die "U-Boot configuration ${config} failed"
}
src_compile() {
local config
tc-getCC
config=$(get_required_config)
emake \
${COMMON_MAKE_FLAGS} \
HOSTCC=${CC} \
HOSTSTRIP=true \
all || die "U-Boot compile ${config} failed"
}
src_install() {
local config
local inst_dir
if use x86; then
inst_dir='/coreboot'
else
inst_dir='/u-boot'
fi
dodir "${inst_dir}"
insinto "${inst_dir}"
local files_to_copy='System.map include/autoconf.mk u-boot.bin'
for file in ${files_to_copy}; do
doins "${UB_BUILD_DIR}/${file}" || die
done
if use x86; then
newins "${UB_BUILD_DIR}/u-boot" u-boot.elf || die
fi
}