Skip to content

Commit 8cd8c79

Browse files
committed
3: add watch
1 parent 0a200be commit 8cd8c79

File tree

4 files changed

+19
-0
lines changed

4 files changed

+19
-0
lines changed

Cargo.toml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[package]
2+
name = "linux"
3+
version = "0.1.0"
4+
edition = "2021"
5+
6+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7+
8+
[dependencies]

Makefile

+7
Original file line numberDiff line numberDiff line change
@@ -1803,6 +1803,13 @@ $(DOC_TARGETS):
18031803

18041804
# Rust targets
18051805
# ---------------------------------------------------------------------------
1806+
PHONY += rustwatch
1807+
rustwatch:
1808+
$(Q) cargo watch -w ./samples/rust/rust_vdev.rs -cs 'make && qemu-system-x86_64 -nographic -kernel vmlinux -initrd initrd.img -nic user,model=rtl8139,hostfwd=tcp::5555-:23'
1809+
1810+
PHONY += rustvm
1811+
rustvm:
1812+
$(Q) make && qemu-system-x86_64 -nographic -kernel vmlinux -initrd initrd.img -nic user,model=rtl8139,hostfwd=tcp::5555-:23
18061813

18071814
# "Is Rust available?" target
18081815
PHONY += rustavailable

samples/rust/rust_vdev.rs

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ impl kernel::Module for VDev {
1414
// Print a banner to make sure our moudle is working
1515
pr_info!("-----------------------\n");
1616
pr_info!("initialize vdev module!\n");
17+
pr_info!("watching for changes...\n");
1718
pr_info!("-----------------------\n");
1819
Ok(VDev)
1920
}

src/main.rs

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
fn main() {
2+
println!("Hello, world!");
3+
}

0 commit comments

Comments
 (0)