On Wed, Feb 26, 2025 at 7:24 PM NoisyCoil<noisycoil@disroot.org> wrote:
It does indeed depend on the configuration, because at least someI was referring to the `.so`, not the `.rmeta`s, i.e. I thought Ben
abstractions are enabled via the configuration and different metadata
will be produced depending on whether they are or not (Miguel should
confirm this, but I'm pretty sure about it). The first example that
comes to my mind is the firmware abstractions, which are already in
stable. So it can't go in linux-kbuild, and if it can't go in
linux-headers either then it needs a new package.
was referring to the last paragraph quoted.
The `.rmeta`s definitely depend on the kernel config (and always
will). The `.so` do not get the config passed right now, but we may
end up passing it if we need it. So I would just assume they do.
Cheers,
Miguel
On Wed, Feb 26, 2025 at 3:15 PM NoisyCoil<noisycoil@disroot.org> wrote:
Yeah I'd imagined this could happen. Currently d/rules just copiesUnknown yet -- my current plan is to propose to generate them all in a
rust/{*.rmeta,*.so} into the destination directory. My guess was that in
the future they could be placed in subdirectories of rust/, but on a
second thought I think as subsystems accept Rust they could be located
kind of anywhere in the build directory? If this is the case, then I
single place (which may be different than their current place) for simplicity. But if people disagree, I may have to place them all over
the tree.
think hardcoding can hardly be avoided. One will just have to change theIf a single place is better for you, that is another argument that I
hardcoded paths as needed (not ideal, but oh, well; also, absolutely not
unheard of :-)). I say this mostly because of the *.so files: assuming
that all *.rmeta files must be installed probably is a good enough
assumption, but the same is not true for *.so files.
can use to push for the thing I mentioned above, so I wouldn't mind to
hear that! 🙂
On the other hand, one could maybe use something like `objdump -TIn the case where we are everywhere, I guess I could output a file
whatever.so | grep rustc_proc_macro_decls` to discover if a .so file is
a rust proc macro?
easily with the paths of all the needed dependencies, if that would
help.
Thanks for the feedback!
Cheers,
Miguel
I was referring to the `.so`, not the `.rmeta`s, i.e. I thought Ben
was referring to the last paragraph quoted.
On Wed, Feb 26, 2025 at 07:47:39PM +0100, Miguel Ojeda wrote:
I was referring to the `.so`, not the `.rmeta`s, i.e. I thought BenThe .so are for the build architecture:
was referring to the last paragraph quoted.
This means they need to go into linux-kbuild and can not use any config.
On Wed, Apr 02, 2025 at 10:38:04PM +0200, Bastian Blank wrote:
On Wed, Feb 26, 2025 at 07:47:39PM +0100, Miguel Ojeda wrote:I don't see any reference to libmacros.so in anything apart the build of rust/kernel.o. Is this actually used for module build at all and where?
I was referring to the `.so`, not the `.rmeta`s, i.e. I thought BenThe .so are for the build architecture:
was referring to the last paragraph quoted.
This means they need to go into linux-kbuild and can not use any config.
I am in fact able to build the reference out-of-tree kernel module
without libmacros.so.
On 02/04/25 23:33, NoisyCoil wrote:
I am in fact able to build the reference out-of-tree kernel module
without libmacros.so.
I take that back, I had deleted libmacros.so from the wrong kernel package version. Not only one of the proc macros defined in the macros crate is module!(), which is used to declare kernel modules, but without libmacros.so the kernel crate is not even found:
error[E0463]: can't find crate for `kernel`
/home/noisycoil/Tmp/rust-out-of-tree-module/rust_out_of_tree.rs:5:5|
5 | use kernel::prelude::*;
| ^^^^^^ can't find crate
Please reference the bug report for this. Removing a file needs to
produce a file not found error if it is required.
But this means this library needs to be shipped in linux-kbuild and
properly referenced in the build.
On 03/04/25 16:28, Bastian Blank wrote:
Please reference the bug report for this. Removing a file needs toWhat bug report? Is this a suggestion to file one against the upstream kernel?
produce a file not found error if it is required.
But this means this library needs to be shipped in linux-kbuild and properly referenced in the build.Miguel said they are unwilling to commit to macros being config-independent, so it can't go in linux-kbuild as-is.
To be clear, are you suggesting that
it be made config-independent so it can be built in the package for the
build architecture (in a cross-compilation scenario), and then used for arbitrary target architectures, hence why it must be config-independent?
On Thu, Apr 3, 2025 at 8:33 PM Bastian Blank<waldi@debian.org> wrote:
What the heck is this good for, where config dependency would be useful?C macros in the kernel use the kernel config all the time, why would
this be different?
What is the root issue here?
On Thu, Apr 3, 2025 at 8:33 PM Bastian Blank <waldi@debian.org> wrote:
What the heck is this good for, where config dependency would be useful?C macros in the kernel use the kernel config all the time, why would
this be different?
What is the root issue here?
So, either "macros" is static and unchanging, then we can just build itWhat "external module" are you referring to?
and don't care. Or it is dynamic, then it needs to be built next to the external module and not be shipped at all.
So you want to build a kernel for architecture X in a host of
architecture Y, and then build an out-of-tree module for architecture
X in a host of architecture Z (possibly X)?
As far as I have been told, the kernel generally requires that the
exact same toolchain is used to build out-of-tree modules as the main
kernel -- so the same host/target pair should be used for both the
kernel build as the out-of-tree builds. Of course, things may happen
to work otherwise.
Is the reason that there is a build farm on architecture Y that builds
all the kernels for all X, and then you want users to be able to use
their architecture X to build out-of-tree modules for their kernel on
X? i.e. the X == Z case.
Cheers,
Miguel
So I can confirm that builds in fact do not seem to work either way currently, the toolchain must be the exact same, as expected. In particular, it seems that the arch/config-(in)dependence of libmacros.so is not the main blocker here.
So we can only ship rust source in any way and the
kernel module make stuff needs to rebuild anything for the external
modules.
I am not sure I am following correctly the tests, but are you
referring to rebuilding all the Rust artifacts (and not just the host
ones)?
I think that would still be not generally supported by the kernel,
since you still used a different host/target pair (i.e. different toolchains/binaries) -- if I understand correctly, your out-of-tree
module ends up using `.rmeta`s that are different than those used for
the main kernel since they come from a different build, even if they
are all accepted by the Rust compiler since it built them all.
On Thu, Apr 3, 2025 at 11:32 PM NoisyCoil <noisycoil@disroot.org> wrote:
I think the key issue here is Debian wants to support cross-compiling out-of-tree kernel modules,
I see, that sentence explains it, thanks!
So you want to build a kernel for architecture X in a host of
architecture Y, and then build an out-of-tree module for architecture
X in a host of architecture Z (possibly X)?
As far as I have been told, the kernel generally requires that the
exact same toolchain is used to build out-of-tree modules as the main
kernel -- so the same host/target pair should be used for both the
kernel build as the out-of-tree builds. Of course, things may happen
to work otherwise.
Is the reason that there is a build farm on architecture Y that builds
all the kernels for all X, and then you want users to be able to use
their architecture X to build out-of-tree modules for their kernel on
X? i.e. the X == Z case.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 489 |
Nodes: | 16 (2 / 14) |
Uptime: | 12:59:45 |
Calls: | 9,665 |
Files: | 13,712 |
Messages: | 6,167,578 |