aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHimbeerserverDE <himbeerserverde@gmail.com>2022-12-26 23:48:14 +0100
committerHimbeerserverDE <himbeerserverde@gmail.com>2022-12-26 23:48:35 +0100
commit5c6587cfb5406a67a434e6c86e22f66a6b1ff7ae (patch)
treec5f34efe8047f832f568759d9ab46771d937e972
parentee27a8113d62c1deee572f5bf8ec682061d6b2cd (diff)
download kernel and cmdline from kernel repo
-rw-r--r--Cargo.toml1
-rw-r--r--src/main.rs8
2 files changed, 6 insertions, 3 deletions
diff --git a/Cargo.toml b/Cargo.toml
index c46cbcc..00bd270 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -11,5 +11,6 @@ clap = { version = "4.0.29", features = ["derive"] }
fatfs = "0.3.5"
fscommon = "0.1.1"
nix = { version = "0.26.1", features = ["ioctl"] }
+reqwest = { version = "0.11.13", features = ["blocking"] }
squashfs-ng = "0.1.2"
temp-file = "0.1.7"
diff --git a/src/main.rs b/src/main.rs
index 3c6c84e..257c4ae 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -125,15 +125,17 @@ fn write_boot(partition: &mut StreamSlice<File>) -> anyhow::Result<()> {
fatfs::format_volume(&mut *partition, format_opts)?;
- let kernel_dir = Path::new(".");
-
let fs = fatfs::FileSystem::new(partition, fatfs::FsOptions::new())?;
let root_dir = fs.root_dir();
let copy = ["vmlinuz", "cmdline.txt"];
for path in copy {
let mut file = root_dir.create_file(path)?;
- io::copy(&mut File::open(kernel_dir.join(path))?, &mut file)?;
+ let url = "https://github.com/rustkrazy/kernel/raw/master/".to_owned() + path;
+
+ reqwest::blocking::get(url)?
+ .error_for_status()?
+ .copy_to(&mut file)?;
}
println!("Boot filesystem created successfully");