* Using 3rd party crates in an out-of-tree module @ 2022-03-21 9:40 Nándor Krácser 2022-03-21 14:36 ` Alex Gaynor 2022-03-21 16:49 ` Miguel Ojeda 0 siblings, 2 replies; 6+ messages in thread From: Nándor Krácser @ 2022-03-21 9:40 UTC (permalink / raw) To: rust-for-linux Hi, I was looking at the out-of-tree example at https://github.com/Rust-for-Linux/rust-out-of-tree-module and found myself in a situation where I wanted to pull in a 3rd party module from crates.io which can run in kernel space as well. How can this be done? As far as I know there is no cargo support currently in the Makefiles, but maybe I'm missing something. Thank you! Nándor István Krácser bonifaido@gmail.com ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Using 3rd party crates in an out-of-tree module 2022-03-21 9:40 Using 3rd party crates in an out-of-tree module Nándor Krácser @ 2022-03-21 14:36 ` Alex Gaynor 2022-03-21 23:14 ` Miguel Ojeda 2022-03-21 16:49 ` Miguel Ojeda 1 sibling, 1 reply; 6+ messages in thread From: Alex Gaynor @ 2022-03-21 14:36 UTC (permalink / raw) To: Nándor Krácser; +Cc: rust-for-linux Hi Nándor, That's correct that there's currently no support for pulling in 3rd party modules automatically with cargo. This is because any work that goes into the upstream kernel will need to be self-contained to the maximum extent possible. I don't know if anyone has given any thought to supporting 3rd party crates for out-of-tree modules. Alex On Mon, Mar 21, 2022 at 10:12 AM Nándor Krácser <bonifaido@gmail.com> wrote: > > Hi, > > I was looking at the out-of-tree example at > https://github.com/Rust-for-Linux/rust-out-of-tree-module and found > myself in a situation where I wanted to pull in a 3rd party module > from crates.io which can run in kernel space as well. How can this be > done? > > As far as I know there is no cargo support currently in the Makefiles, > but maybe I'm missing something. > > Thank you! > > Nándor István Krácser > bonifaido@gmail.com -- All that is necessary for evil to succeed is for good people to do nothing. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Using 3rd party crates in an out-of-tree module 2022-03-21 14:36 ` Alex Gaynor @ 2022-03-21 23:14 ` Miguel Ojeda 2022-03-23 9:40 ` Nándor Krácser 0 siblings, 1 reply; 6+ messages in thread From: Miguel Ojeda @ 2022-03-21 23:14 UTC (permalink / raw) To: Alex Gaynor; +Cc: Nándor Krácser, rust-for-linux On Mon, Mar 21, 2022 at 10:17 PM Alex Gaynor <alex.gaynor@gmail.com> wrote: > > I don't know if anyone has given any thought to supporting 3rd party > crates for out-of-tree modules. It is possible that we will have some form of dependency support within the kernel (e.g. to split the `kernel` crate), which could be used by out-of-tree modules too. Extending this to Cargo-based crates could be possible, but we would need a clear use case -- if an out-of-tree module requires a third-party crate, it is fairly likely others in-tree also need the same problem solved. It can also complicate submitting the out-of-tree module later on to mainline if one relied on third-party code which now has an alternative in-tree. Cheers, Miguel ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Using 3rd party crates in an out-of-tree module 2022-03-21 23:14 ` Miguel Ojeda @ 2022-03-23 9:40 ` Nándor Krácser 2022-03-23 11:40 ` Greg KH 0 siblings, 1 reply; 6+ messages in thread From: Nándor Krácser @ 2022-03-23 9:40 UTC (permalink / raw) To: Miguel Ojeda; +Cc: Alex Gaynor, rust-for-linux Currently I'm experimenting with different crates which I would like to use in my module, serialization libraries, math libraries. etc, even complex ones, are really hard to pull in as a direct source library (copy the code to the module), and if they have a transitive dependency that complicates things even more. I totally agree, that submitting something to the mainline with libraries linked out there in the "wild" makes them hard to merge, however a kernel crate sounds really good and is a bit more native to rust. Regards, Nandor On Tue, Mar 22, 2022 at 12:15 AM Miguel Ojeda <miguel.ojeda.sandonis@gmail.com> wrote: > > On Mon, Mar 21, 2022 at 10:17 PM Alex Gaynor <alex.gaynor@gmail.com> wrote: > > > > I don't know if anyone has given any thought to supporting 3rd party > > crates for out-of-tree modules. > > It is possible that we will have some form of dependency support > within the kernel (e.g. to split the `kernel` crate), which could be > used by out-of-tree modules too. > > Extending this to Cargo-based crates could be possible, but we would > need a clear use case -- if an out-of-tree module requires a > third-party crate, it is fairly likely others in-tree also need the > same problem solved. It can also complicate submitting the out-of-tree > module later on to mainline if one relied on third-party code which > now has an alternative in-tree. > > Cheers, > Miguel -- Krácser Nándor István bonifaido@gmail.com ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Using 3rd party crates in an out-of-tree module 2022-03-23 9:40 ` Nándor Krácser @ 2022-03-23 11:40 ` Greg KH 0 siblings, 0 replies; 6+ messages in thread From: Greg KH @ 2022-03-23 11:40 UTC (permalink / raw) To: Nándor Krácser; +Cc: Miguel Ojeda, Alex Gaynor, rust-for-linux On Wed, Mar 23, 2022 at 10:40:33AM +0100, Nándor Krácser wrote: > Currently I'm experimenting with different crates which I would like > to use in my module, serialization libraries, math libraries. etc, You really do not want that type of code in your kernel module. Adding functionality to the kernel rust crate should be the only way to do this, for good reasons. Not the least being that userspace crates have no idea about the restrictions that occur when having to run within the kernel. thanks, greg k-h ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Using 3rd party crates in an out-of-tree module 2022-03-21 9:40 Using 3rd party crates in an out-of-tree module Nándor Krácser 2022-03-21 14:36 ` Alex Gaynor @ 2022-03-21 16:49 ` Miguel Ojeda 1 sibling, 0 replies; 6+ messages in thread From: Miguel Ojeda @ 2022-03-21 16:49 UTC (permalink / raw) To: Nándor Krácser; +Cc: rust-for-linux Hi Nándor, On Mon, Mar 21, 2022 at 3:12 PM Nándor Krácser <bonifaido@gmail.com> wrote: > > I was looking at the out-of-tree example at > https://github.com/Rust-for-Linux/rust-out-of-tree-module and found > myself in a situation where I wanted to pull in a 3rd party module > from crates.io which can run in kernel space as well. How can this be > done? You can do it by importing the code into your crate. However, it would be best to have the functionality in mainline, so that everyone benefits: which crates are you looking into? We have a few crates that we may adapt in the future or provide similar functionality ourselves (e.g. `bitflags`). Cheers, Miguel ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-03-23 11:40 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2022-03-21 9:40 Using 3rd party crates in an out-of-tree module Nándor Krácser 2022-03-21 14:36 ` Alex Gaynor 2022-03-21 23:14 ` Miguel Ojeda 2022-03-23 9:40 ` Nándor Krácser 2022-03-23 11:40 ` Greg KH 2022-03-21 16:49 ` Miguel Ojeda
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.