redox/recipes/core/drivers/recipe.toml
2023-11-05 12:58:51 +00:00

63 lines
1.5 KiB
TOML

[source]
git = "https://gitlab.redox-os.org/redox-os/drivers.git"
[build]
template = "custom"
script = """
# Drivers that are built on all architectures, and NOT in drivers-initfs
BINS=(
alxd
e1000d
ihdad
ixgbed
rtl8139d
rtl8168d
usbctl
usbhidd
usbscsid
virtio-netd
xhcid
inputd
)
# Add additional drivers to the list to build, that are not in drivers-initfs
# depending on the target architecture
case "${TARGET}" in
i686-unknown-redox | x86_64-unknown-redox)
BINS+=(ac97d bgad pcid pcspkrd sb16d vboxd)
;;
*)
;;
esac
#Build each driver in the list
mkdir -pv "${COOKBOOK_STAGE}/bin"
for bin in "${BINS[@]}"
do
"${COOKBOOK_CARGO}" rustc --release \
--manifest-path "${COOKBOOK_SOURCE}/${bin}/Cargo.toml" \
--bin "${bin}" \
-- \
-C opt-level=s \
-C panic=abort
cp -v "target/${TARGET}/release/${bin}" "${COOKBOOK_STAGE}/bin"
done
mkdir -pv "${COOKBOOK_STAGE}/bin"
${FIND} "target/${TARGET}/release" \
-maxdepth 1 \
-executable \
-type f \
-exec cp -v {} "${COOKBOOK_STAGE}/bin/" ';'
mkdir -pv "${COOKBOOK_STAGE}/etc/pcid"
cp -v "${COOKBOOK_SOURCE}/initfs.toml" "${COOKBOOK_STAGE}/etc/pcid/initfs.toml"
mkdir -pv "${COOKBOOK_STAGE}/etc/pcid.d"
${FIND} "${COOKBOOK_SOURCE}" -maxdepth 2 -type f -name 'config.toml' | while read conf
do
driver="$(basename "$(dirname "$conf")")"
cp -v "$conf" "${COOKBOOK_STAGE}/etc/pcid.d/$driver.toml"
done
"""