Files
RedBear-OS/recipes/core/bootloader/recipe.toml
T

54 lines
1.9 KiB
TOML

[source]
path = "../../../local/sources/bootloader"
[build]
template = "custom"
script = """
OUTDIR="${COOKBOOK_BUILD}"
mkdir -pv "${COOKBOOK_STAGE}/usr/lib/boot"
function bootloader {
src="$2"
dst="$3"
features="${4:-}"
RUSTFLAGS="--cfg aes_force_soft" rustup run nightly cargo rustc \
--manifest-path "${COOKBOOK_SOURCE}/Cargo.toml" \
-Z build-std=core,alloc -Z build-std-features=compiler-builtins-mem \
--target "$1" --bin bootloader --release \
${features:+--features} ${features:+"$features"} \
-- \
--emit link="${OUTDIR}/${src}"
cp -v "${OUTDIR}/${src}" "${COOKBOOK_STAGE}/usr/lib/boot/${dst}"
}
function bootloader_bios {
src="$2"
dst="$3"
features="${4:-}"
RUST_TARGET_PATH="${COOKBOOK_SOURCE}/targets" RUSTFLAGS="--cfg aes_force_soft" rustup run nightly cargo -Zunstable-options rustc \
--manifest-path "${COOKBOOK_SOURCE}/Cargo.toml" \
-Z build-std=core,alloc -Z build-std-features=compiler-builtins-mem \
--target "$1" --bin bootloader --release \
${features:+--features} ${features:+"$features"} \
-- \
--emit link="${OUTDIR}/${src}"
cp -v "${OUTDIR}/${src}" "${COOKBOOK_STAGE}/usr/lib/boot/${dst}"
}
ARCH="$(echo "${TARGET}" | cut -d - -f1)"
# Build BIOS bootloader for supported architectures
if false && [ "${ARCH}" == "i586" -o "${ARCH}" == "i686" -o "${ARCH}" == "x86_64" ]
then
bootloader_bios "x86-unknown-none" bootloader.bin bootloader.bios
bootloader_bios "x86-unknown-none" bootloader-live.bin bootloader-live.bios live
fi
# Build UEFI bootloader for supported architectures
if [ "${ARCH}" == "aarch64" -o "${ARCH}" == "x86_64" -o "${ARCH}" == "riscv64gc" ]
then
bootloader "${ARCH}-unknown-uefi" bootloader.efi bootloader.efi
bootloader "${ARCH}-unknown-uefi" bootloader-live.efi bootloader-live.efi live
fi
"""