| # Copyright 2019 The Chromium OS Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE.makefile file. |
| |
| EAPI=5 |
| |
| CROS_WORKON_COMMIT="a05affa8514cb1b8ed324685ce23e9b665de13a4" |
| CROS_WORKON_TREE="5a262c6ecac35cac34dcba0a29d041d8feb105cb" |
| CROS_WORKON_PROJECT="chromiumos/platform/ec" |
| CROS_WORKON_LOCALNAME="ec" |
| CROS_WORKON_DESTDIR="${S}/platform/ec" |
| |
| inherit toolchain-funcs cros-workon cros-unibuild coreboot-sdk |
| |
| DESCRIPTION="ECOS ISH image" |
| HOMEPAGE="https://www.chromium.org/chromium-os/ec-development" |
| |
| LICENSE="BSD-Google" |
| SLOT="0" |
| KEYWORDS="*" |
| IUSE="quiet verbose coreboot-sdk unibuild" |
| |
| # EC build requires libftdi, but not used for runtime (b:129129436) |
| DEPEND="dev-embedded/libftdi:1=" |
| |
| src_unpack() { |
| cros-workon_src_unpack |
| S+="/platform/ec" |
| } |
| |
| src_prepare() { |
| cros_use_gcc |
| } |
| |
| src_configure() { |
| cros-workon_src_configure |
| } |
| |
| set_build_env() { |
| # always use coreboot-sdk to build ISH |
| export CROSS_COMPILE_i386=${COREBOOT_SDK_PREFIX_x86_32} |
| export CROSS_COMPILE_coreboot_sdk_i386=${COREBOOT_SDK_PREFIX_x86_32} |
| |
| tc-export CC BUILD_CC |
| export BUILDCC="${BUILD_CC}" |
| |
| ish_targets=($(cros_config_host get-firmware-build-targets ish)) |
| |
| EC_OPTS=() |
| use quiet && EC_OPTS+=( -s V=0 ) |
| use verbose && EC_OPTS+=( V=1 ) |
| } |
| |
| |
| src_compile() { |
| set_build_env |
| |
| local target |
| einfo "Building targets: ${ish_targets[@]}" |
| for target in "${ish_targets[@]}"; do |
| BOARD="${target}" emake "${EC_OPTS[@]}" clean |
| BOARD="${target}" emake "${EC_OPTS[@]}" all |
| done |
| } |
| |
| src_test() { |
| set_build_env |
| |
| local target |
| for target in "${ish_targets[@]}"; do |
| BOARD="${target}" emake "${EC_OPTS[@]}" tests |
| done |
| } |
| |
| src_install() { |
| set_build_env |
| |
| local target |
| insinto "/lib/firmware/intel/" |
| |
| einfo "Installing targets: ${ish_targets[@]}" |
| for target in "${ish_targets[@]}"; do |
| newins "build/${target}/ec.bin" "${target}.bin" \ |
| || die "Couldn't install ${target}" |
| done |
| } |