Upload files to TFTP server for network boot

This commit is contained in:
2025-05-24 11:33:30 +02:00
parent 70eb41b3d5
commit 64c35e05c3
3 changed files with 37 additions and 0 deletions

5
.env.example Normal file
View File

@@ -0,0 +1,5 @@
KERNEL_NAME=kernel8.img
BUILD_PATH=target/aarch64-unknown-none/release/nova
TFTP_PATH=/srv/tftp
REMOTE_USER=TFTP_HOST_USER
REMOTE_HOST=TFTP_HOST_IP

1
.gitignore vendored
View File

@@ -1,2 +1,3 @@
/target /target
kernel8.img kernel8.img
.env

31
tools/deply_to_hw.sh Executable file
View File

@@ -0,0 +1,31 @@
#!/bin/bash
cd "$(dirname "$0")"
set -a
source ../.env
set +a
set -e # Stop on errors
# === RESOLVE VARIABLES ===
REMOTE="$REMOTE_USER@$REMOTE_HOST"
REMOTE_DIR="$TFTP_PATH"
# === BUILD ===
echo "[*] Building kernel..."
eval $BUILD_COMMAND
# === CONVERT TO IMG ===
echo "[*] Convert kernel elf to img..."
llvm-objcopy -O binary "../$BUILD_PATH/$BINARY_NAME" ../$BUILD_PATH/kernel8.img
# === COPY TO TFTP ===
echo "[*] Copying firmware files to TFTP server..."
scp ../firmware_files/* "$REMOTE:$REMOTE_DIR/."
echo "[*] Copying kernel to TFTP server..."
scp "../$BUILD_PATH/kernel8.img" "$REMOTE:$REMOTE_DIR/$KERNEL_NAME"
echo "[✓] Deployed to TFTP server as $KERNEL_NAME"