-
Notifications
You must be signed in to change notification settings - Fork 519
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
driverdog is a tool to link kernel modules at runtime, given a configuration. The configuration must be provided per driver vendor, and it is created at runtime by the tmpfilesd daemon, using a file from the %{_cross_factorydir} directory. Signed-off-by: Arnaldo Garcia Rincon <[email protected]>
- Loading branch information
1 parent
4ec9530
commit cf7b439
Showing
13 changed files
with
617 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[Unit] | ||
Description=Link additional kernel modules | ||
# Rerunning this service after the system is fully loaded will override | ||
# the already linked kernel modules. This doesn't affect the running system, | ||
# since kernel modules are linked early in the boot sequence, but we still | ||
# disable manual restarts to prevent unnecessary kernel modules rewrites. | ||
RefuseManualStart=true | ||
RefuseManualStop=true | ||
|
||
[Service] | ||
Type=oneshot | ||
ExecStart=/usr/bin/driverdog link-modules | ||
RemainAfterExit=true | ||
StandardError=journal+console | ||
|
||
[Install] | ||
RequiredBy=preconfigured.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[Unit] | ||
Description=Load additional kernel modules | ||
After=link-kernel-modules.service | ||
Requires=link-kernel-modules.service | ||
# Disable manual restarts to prevent loading kernel modules | ||
# that weren't linked by the running system | ||
RefuseManualStart=true | ||
RefuseManualStop=true | ||
|
||
[Service] | ||
Type=oneshot | ||
ExecStart=/usr/bin/driverdog load-modules | ||
RemainAfterExit=true | ||
StandardError=journal+console | ||
|
||
[Install] | ||
RequiredBy=preconfigured.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
%global _cross_first_party 1 | ||
%global _is_k8s_variant %(if echo %{_cross_variant} | grep -Fqw "k8s"; then echo 1; else echo 0; fi) | ||
%global _is_aws_variant %(if echo %{_cross_variant} | grep -Fqw "aws"; then echo 1; else echo 0; fi) | ||
%global _is_vendor_variant %(if echo %{_cross_variant} | grep -Fqw "nvidia"; then echo 1; else echo 0; fi) | ||
%undefine _debugsource_packages | ||
|
||
Name: %{_cross_os}os | ||
|
@@ -39,6 +40,8 @@ Source111: metricdog.service | |
Source112: metricdog.timer | ||
Source113: send-boot-success.service | ||
Source114: [email protected] | ||
Source115: link-kernel-modules.service | ||
Source116: load-kernel-modules.service | ||
|
||
# 2xx sources: tmpfilesd configs | ||
Source200: migration-tmpfiles.conf | ||
|
@@ -91,6 +94,10 @@ Requires: %{_cross_os}shibaken | |
Requires: %{_cross_os}ecs-settings-applier | ||
%endif | ||
|
||
%if %{_is_vendor_variant} | ||
Requires: %{_cross_os}driverdog | ||
%endif | ||
|
||
%description | ||
%{summary}. | ||
|
||
|
@@ -251,6 +258,14 @@ Requires: %{_cross_os}hotdog | |
%description -n %{_cross_os}shimpei | ||
%{summary}. | ||
|
||
%if %{_is_vendor_variant} | ||
%package -n %{_cross_os}driverdog | ||
Summary: Tool to load additional drivers | ||
Requires: %{_cross_os}binutils | ||
%description -n %{_cross_os}driverdog | ||
%{summary}. | ||
%endif | ||
|
||
%package -n %{_cross_os}bootstrap-containers | ||
Summary: Manages bootstrap-containers | ||
%description -n %{_cross_os}bootstrap-containers | ||
|
@@ -327,6 +342,9 @@ echo "** Output from non-static builds:" | |
-p pluto \ | ||
%endif | ||
-p static-pods \ | ||
%endif | ||
%if %{_is_vendor_variant} | ||
-p driverdog \ | ||
%endif | ||
%{nil} | ||
|
||
|
@@ -361,6 +379,9 @@ for p in \ | |
%endif | ||
static-pods \ | ||
%endif | ||
%if %{_is_vendor_variant} | ||
driverdog \ | ||
%endif | ||
; do | ||
install -p -m 0755 ${HOME}/.cache/%{__cargo_target}/release/${p} %{buildroot}%{_cross_bindir} | ||
done | ||
|
@@ -413,6 +434,9 @@ install -p -m 0644 \ | |
%{S:100} %{S:101} %{S:102} %{S:103} %{S:105} \ | ||
%{S:106} %{S:107} %{S:110} %{S:111} %{S:112} \ | ||
%{S:113} %{S:114} \ | ||
%if %{_is_vendor_variant} | ||
%{S:115} %{S:116} \ | ||
%endif | ||
%{buildroot}%{_cross_unitdir} | ||
|
||
install -d %{buildroot}%{_cross_tmpfilesdir} | ||
|
@@ -540,6 +564,13 @@ install -p -m 0644 %{S:300} %{buildroot}%{_cross_udevrulesdir}/80-ephemeral-stor | |
%{_cross_datadir}/eks/eni-max-pods | ||
%endif | ||
|
||
%if %{_is_vendor_variant} | ||
%files -n %{_cross_os}driverdog | ||
%{_cross_bindir}/driverdog | ||
%{_cross_unitdir}/link-kernel-modules.service | ||
%{_cross_unitdir}/load-kernel-modules.service | ||
%endif | ||
|
||
%files -n %{_cross_os}static-pods | ||
%{_cross_bindir}/static-pods | ||
%endif | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,6 +39,8 @@ members = [ | |
|
||
"imdsclient", | ||
|
||
"driverdog", | ||
|
||
"ghostdog", | ||
|
||
"growpart", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[package] | ||
name = "driverdog" | ||
version = "0.1.0" | ||
authors = ["Arnaldo Garcia Rincon <[email protected]>"] | ||
license = "Apache-2.0 OR MIT" | ||
edition = "2018" | ||
publish = false | ||
# Don't rebuild crate just because of changes to README. | ||
exclude = ["README.md"] | ||
|
||
[dependencies] | ||
argh = "0.1.3" | ||
log = "0.4" | ||
simplelog = "0.10" | ||
snafu = "0.6" | ||
serde = { version = "1.0", features = ["derive"] } | ||
tempfile = "3.2.0" | ||
toml = "0.5.8" | ||
|
||
[build-dependencies] | ||
cargo-readme = "3.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# driverdog | ||
|
||
Current version: 0.1.0 | ||
|
||
driverdog is a tool to link kernel modules at runtime. It uses a toml configuration file with the following shape: | ||
|
||
`lib-modules-path`: destination path for the .ko linked files | ||
`objects-source`: path where the objects used to link the kernel module are | ||
`object-files`: hash with the object files to be linked, each object in the map should include the files used to link it | ||
`kernel-modules`: hash with the kernel modules to be linked, each kernel module in the map should include the files used to link it | ||
|
||
## Colophon | ||
|
||
This text was generated from `README.tpl` using [cargo-readme](https://crates.io/crates/cargo-readme), and includes the rustdoc from `src/main.rs`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# {{crate}} | ||
|
||
Current version: {{version}} | ||
|
||
{{readme}} | ||
|
||
## Colophon | ||
|
||
This text was generated from `README.tpl` using [cargo-readme](https://crates.io/crates/cargo-readme), and includes the rustdoc from `src/main.rs`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Automatically generate README.md from rustdoc. | ||
|
||
use std::env; | ||
use std::fs::File; | ||
use std::io::Write; | ||
use std::path::PathBuf; | ||
|
||
fn main() { | ||
// Check for environment variable "SKIP_README". If it is set, | ||
// skip README generation | ||
if env::var_os("SKIP_README").is_some() { | ||
return; | ||
} | ||
|
||
let mut source = File::open("src/main.rs").unwrap(); | ||
let mut template = File::open("README.tpl").unwrap(); | ||
|
||
let content = cargo_readme::generate_readme( | ||
&PathBuf::from("."), // root | ||
&mut source, // source | ||
Some(&mut template), // template | ||
// The "add x" arguments don't apply when using a template. | ||
true, // add title | ||
false, // add badges | ||
false, // add license | ||
true, // indent headings | ||
) | ||
.unwrap(); | ||
|
||
let mut readme = File::create("README.md").unwrap(); | ||
readme.write_all(content.as_bytes()).unwrap(); | ||
} |
Oops, something went wrong.