blob: c62dd81f9ca018dc49b81ddb11393ce8a0b2fb44 [file] [log] [blame]
# Copyright 2018 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 file.
EAPI=5
SRC_URI="https://github.com/rhboot/shim/releases/download/${PV}/shim-${PV}.tar.bz2"
KEYWORDS="*"
inherit eutils multilib toolchain-funcs
DESCRIPTION="Red Hat UEFI shim loader"
HOMEPAGE="https://github.com/rhboot/shim"
LICENSE="BSD-2"
SLOT="0"
IUSE=""
RDEPEND=""
DEPEND="dev-libs/openssl
platform-key? ( sys-boot/platform-key )
"
IUSE="platform-key"
shim_arch() {
case ${ARCH} in
amd64) echo "x86_64";;
arm64) echo "aarch64";;
*) eerror "unsupported architecture: ${ARCH}";;
esac
}
shim_binary() {
case ${ARCH} in
amd64) echo "shimx64.efi";;
arm64) echo "shimaa64.efi";;
*) eerror "unsupported architecture: ${ARCH}";;
esac
}
src_prepare() {
epatch "${FILESDIR}"/${P}-fix-gcc-host-leak.patch
epatch "${FILESDIR}"/${P}-force-ld.bfd.patch
default
}
src_compile() {
local extra_opts=()
if use platform-key; then
extra_opts+=( VENDOR_CERT_FILE="${ROOT}/build/share/platform-key/signing_key.cer" )
fi
emake ARCH="$(shim_arch)" \
CROSS_COMPILE="${CHOST}-" \
COMMITID="${GIT_COMMIT_ID}" \
DEFAULT_LOADER="\\\\\\\\grub-lakitu.efi" \
"${extra_opts[@]}" \
$(shim_binary)
}
src_install() {
insinto /boot/efi/boot
doins "$(shim_binary)"
}