build: Implement CONFIGDIR setting

In effort to support different builds of Aimee OS using the same
scripts, without necessarily having to fork this repository, the build
system now supports a `CONFIGDIR` setting.  When this variable is set,
files defining the target environment, such as the lists of packages to
install, the kernel configuration, the Portage configuration, etc. are
found in the path it specifes.

The reference build, for the Home Assistant Yellow board, is configured
in the `yellow` directory.  To build it, run:

```sh
CONFIGDIR=yellow ./vm-build.sh
```
This commit is contained in:
2023-03-13 16:21:20 -05:00
parent 1914b3aba0
commit 31d8a98f64
100 changed files with 83 additions and 53 deletions

View File

@@ -0,0 +1,71 @@
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit savedconfig toolchain-funcs
MY_P="u-boot-${PV/_/-}"
DESCRIPTION="Das U-Boot firmware"
HOMEPAGE="http://www.denx.de/wiki/U-Boot"
SRC_URI="https://ftp.denx.de/pub/u-boot/${MY_P}.tar.bz2"
S="${WORKDIR}/${MY_P}"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~arm64"
PATCHES=(
"${FILESDIR}"/0001-drivers-bcm283x-don-t-explicitly-disable-init.patch
"${FILESDIR}"/0001-rpi-Use-CONFIG_OF_BOARD-instead-of-CONFIG_EMBED.patch
"${FILESDIR}"/0002-drivers-bcm283x-allow-to-spawn-any-PL011-UART.patch
"${FILESDIR}"/0002-rpi-add-NVMe-to-boot-order.patch
"${FILESDIR}"/0003-Revert-nvme-Correct-the-prps-per-page-calculation-me.patch
"${FILESDIR}"/0004-usb-xhci-brcm-Make-driver-compatible-with-downstream.patch
"${FILESDIR}"/0005-nvme-improve-readability-of-nvme_setup_prps.patch
"${FILESDIR}"/0006-nvme-Use-pointer-for-CPU-addressed-buffers.patch
"${FILESDIR}"/0007-nvme-translate-virtual-addresses-into-the-bus-s-addr.patch
)
src_configure() {
restore_config .config
if [ -f .config ]; then
emake -j1 olddefconfig
else
# TODO Build images for other boards based on USE flags
emake -j1 rpi_4_defconfig
fi
tc-export AR BUILD_CC CC LD OBJCOPY PKG_CONFIG
tc-export_build_env
}
src_compile() {
unset KBUILD_OUTPUT KBUILD_SRC
local myemakeargs=(
V=1
AR="${AR}"
CC="${CC}"
HOSTCC="${BUILD_CC}"
HOSTCFLAGS="${BUILD_CFLAGS} ${BUILD_CPPFLAGS}"' $(HOSTCPPFLAGS)'
HOSTLDFLAGS="${BUILD_LDFLAGS}"
LD="${LD}"
OBJCOPY="${OBJCOPY}"
)
emake "${myemakeargs[@]}" \
NO_SDL=1 \
HOSTSTRIP=: \
STRIP=: \
CONFIG_ENV_OVERWRITE=y
}
src_test() { :; }
src_install() {
save_config .config
insinto /usr/share/${PN}
doins u-boot.bin
}