redox/recipes/core/drivers-initfs/recipe.toml
bjorn3 4a2109c2c7 Use a single source dir for the drivers and drivers-initfs recipes
This makes it easier to make driver changes. And in the future other
recipes could potentially benefit from the same infrastructure too.
2024-07-10 22:20:43 +02:00

76 lines
1.4 KiB
TOML

[source]
same_as = "../drivers"
[build]
template = "custom"
script = """
BINS=(
fbcond
inputd
nvmed
pcid
vesad
lived
)
virt_bins()
{
BINS+=(virtio-blkd virtio-gpud)
}
x86_common_bins()
{
BINS+=(ahcid ided ps2d vesad)
virt_bins
}
aarch64_bins()
{
case "${BOARD}" in
raspi3b | raspi3bp)
BINS+=(bcm2835-sdhcid)
;;
*)
#qemu-virt
virt_bins
;;
esac
}
case "${TARGET}" in
i686-unknown-redox)
x86_common_bins
;;
x86_64-unknown-redox)
x86_common_bins
BINS+=(acpid)
;;
aarch64-unknown-redox)
aarch64_bins
;;
*)
;;
esac
mkdir -pv "${COOKBOOK_STAGE}/bin" "${COOKBOOK_STAGE}/lib/drivers"
export CARGO_PROFILE_RELEASE_OPT_LEVEL=s
export CARGO_PROFILE_RELEASE_PANIC=abort
"${COOKBOOK_CARGO}" build --release \
--manifest-path "${COOKBOOK_SOURCE}/Cargo.toml" \
$(for bin in "${BINS[@]}"; do echo "-p" "${bin}"; done)
for bin in "${BINS[@]}"
do
case "${bin}" in
pcid | fbcond | inputd | vesad | lived | ps2d | acpid)
cp -v "target/${TARGET}/release/${bin}" "${COOKBOOK_STAGE}/bin"
;;
*)
cp -v "target/${TARGET}/release/${bin}" "${COOKBOOK_STAGE}/lib/drivers"
;;
esac
done
mkdir -pv "${COOKBOOK_STAGE}/etc/pcid"
cp -v "${COOKBOOK_SOURCE}/initfs.toml" "${COOKBOOK_STAGE}/etc/pcid/initfs.toml"
"""