From 3097b3ae8d5480de8a470dd9cf391f13ab9835d2 Mon Sep 17 00:00:00 2001 From: Klagarge Date: Sun, 7 Jun 2026 23:20:59 +0200 Subject: [PATCH] feat(MP): add just recipe for full installation and run/stop --- src/06-mini-project/daemon/justfile | 5 +++++ src/06-mini-project/justfile | 20 +++++++++++++++++++- src/06-mini-project/kernel/Makefile | 4 +++- src/06-mini-project/kernel/justfile | 2 +- 4 files changed, 28 insertions(+), 3 deletions(-) diff --git a/src/06-mini-project/daemon/justfile b/src/06-mini-project/daemon/justfile index a112781..efa4d09 100644 --- a/src/06-mini-project/daemon/justfile +++ b/src/06-mini-project/daemon/justfile @@ -4,6 +4,11 @@ @build: make +@install: + install -m 0755 daemon /rootfs/usr/bin/daemon + echo "daemon installed successfully in /rootfs/usr/bin/" + @clean: make clean rm -f -- daemon + rm -f /rootfs/usr/bin/daemon diff --git a/src/06-mini-project/justfile b/src/06-mini-project/justfile index fc2eee1..3996112 100644 --- a/src/06-mini-project/justfile +++ b/src/06-mini-project/justfile @@ -2,21 +2,39 @@ mod kernel mod daemon mod cli +target_ssh := "root@192.168.53.14" + +# List available recipes @default: just --list +# Build all components (kernel module, daemon, and cli) @build: just kernel::build just daemon::build just cli::build +# Install all components to the local rootfs @install: just kernel::install + just daemon::install just cli::install +# Load the kernel module and start the daemon on the target +@run: + ssh {{target_ssh}} "modprobe temp_regulator" + ssh {{target_ssh}} "start-stop-daemon --start --background --exec /usr/bin/daemon" + +# Stop the daemon and unload the kernel module on the target +@stop: + ssh {{target_ssh}} "start-stop-daemon --stop --exec /usr/bin/daemon || true" + ssh {{target_ssh}} "modprobe -r temp_regulator || true" + +# Clean build artifacts and remove installed files from local rootfs @clean: just kernel::clean just daemon::clean just cli::clean -@all: clean build install +# Clean, build, install, and run everything +@all: clean build install run diff --git a/src/06-mini-project/kernel/Makefile b/src/06-mini-project/kernel/Makefile index a7a127f..38cf078 100644 --- a/src/06-mini-project/kernel/Makefile +++ b/src/06-mini-project/kernel/Makefile @@ -30,10 +30,12 @@ all: clean: $(MAKE) -C $(KDIR) M=$(PWD) clean + rm -f $(MODPATH)/etc/modprobe.d/$(MODULE).conf + rm -f $(MODPATH)/lib/modules/*/extra/$(MODULE).ko echo $(PATH) install: $(MAKE) -C $(KDIR) M=$(PWD) INSTALL_MOD_PATH=$(MODPATH) modules_install - # install -D -m 0644 $(MODULE).conf $(MODPATH)/etc/modprobe.d/$(MODULE).conf + install -D -m 0644 $(MODULE).conf $(MODPATH)/etc/modprobe.d/$(MODULE).conf endif diff --git a/src/06-mini-project/kernel/justfile b/src/06-mini-project/kernel/justfile index 690c76c..57e86c2 100644 --- a/src/06-mini-project/kernel/justfile +++ b/src/06-mini-project/kernel/justfile @@ -8,4 +8,4 @@ make install @clean: - make clean + make clean