Using multiple target architectures in the same metacrate?

So, I have a kernel binary and a library for kernel drivers and such (libk), both targeting a custom x86_64 architecture triplet. However, I'd love to have my drivers be written in web assembly and then my kernel can load them.
Is it possible for cargo to have multiple projects target different processor architectures?

Assuming your kernel and your drivers live in separate packages within a workspace, you can put a .cargo/config.toml in the kernel's package directory with this in it:

[build]
target = "my-custom-x86_64-target"

and similarly in the drivers' package directory or directories with:

[build]
target = "my-wasm-target"

Here's the relevant page in the Cargo reference.

1 Like

Okay. One last question. Is there a way to force serialization of a particular set of packages? For example, I want my drivers compiled first so my kernels build script can digest them and include them in the kernel image (my bootloader doesn't allow for "module"-like loading).

I don't know enough about how build scripts work to answer this with confidence—hopefully someone else from the forum can chime in here.