Skip to content

Add scripts for kernel module aggregation and deployment - #336

Merged
ymodlin merged 3 commits into
devfrom
deploy_scripts
Jan 22, 2026
Merged

Add scripts for kernel module aggregation and deployment#336
ymodlin merged 3 commits into
devfrom
deploy_scripts

Conversation

@ymodlin

@ymodlin ymodlin commented Jan 21, 2026

Copy link
Copy Markdown
Collaborator
  • Introduced aggregate_kernel_6.x.sh for aggregating kernel modules and copying to remote devices.
  • Added deploy_kernel_6.2.sh to package kernel modules and update boot files on target devices.
  • Created install_to_kernel_dev.sh for installing kernel modules on the target device.
  • Updated setup_workspace.sh to support local cache extraction for sources and use specific version directories (e.g., sources_6.0, sources_6.1).
  • Fixed build_all.sh to use specific version directories instead of normalized versions.
  • Added .gitignore to exclude specific directories from version control.

- Introduced aggregate_kernel_6.x.sh for aggregating kernel modules and copying to remote devices.
- Added deploy_kernel_6.2.sh to package kernel modules and update boot files on target devices.
- Created install_to_kernel_dev.sh for installing kernel modules on the target device.
- Updated setup_workspace.sh to support local cache extraction for sources and use specific version directories (e.g., sources_6.0, sources_6.1).
- Fixed build_all.sh to use specific version directories instead of normalized versions.
- Added .gitignore to exclude specific directories from version control.
@ymodlin
ymodlin requested review from Nikolai-L and Copilot January 21, 2026 09:46

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds automation scripts for kernel module deployment and updates the workspace setup to support version-specific source directories. It introduces three new deployment scripts and modifies existing scripts to use explicit version numbers (e.g., "6.0", "6.1") instead of normalized versions (e.g., "6.x").

Changes:

  • Added scripts for kernel module aggregation, deployment, and installation on target devices
  • Updated workspace setup to support local cache extraction and version-specific directories
  • Modified build and patch scripts to use explicit version parameters

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
setup_workspace.sh Added local cache support for extracting sources and updated to use version-specific directory names
scripts/install_to_kernel_dev.sh New script for installing kernel modules on target devices
scripts/deploy_kernel_6.2.sh New script for packaging and deploying kernel 6.2 modules to remote devices
scripts/aggregate_kernel_6.x.sh New script for aggregating kernel modules with optional remote deployment
build_all.sh Updated to use explicit version parameter instead of normalized JETPACK_VERSION
apply_patches.sh Added logic to determine correct sources directory and updated references

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread setup_workspace.sh Outdated
Comment thread setup_workspace.sh Outdated
Comment on lines +76 to +77
# Check if local tar ball exists in ~/nvidia_sources_cash
NVIDIA_CACHE_DIR="$HOME/nvidia_sources_cash"

Copilot AI Jan 21, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected spelling of 'cash' to 'cache' in directory name.

Suggested change
# Check if local tar ball exists in ~/nvidia_sources_cash
NVIDIA_CACHE_DIR="$HOME/nvidia_sources_cash"
# Check if local tar ball exists in ~/nvidia_sources_cache
NVIDIA_CACHE_DIR="$HOME/nvidia_sources_cache"

Copilot uses AI. Check for mistakes.
Comment thread setup_workspace.sh
if [[ -f "./scripts/source_sync_$1.sh" ]]; then
"./scripts/source_sync_$1.sh" -t "$L4T_VERSION" -d "sources_$1"
elif [[ -f "./scripts/source_sync_$JETPACK_VERSION.sh" ]]; then
./scripts/source_sync_$JETPACK_VERSION.sh -t $L4T_VERSION -d sources_$1

Copilot AI Jan 21, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Variables should be quoted to prevent word splitting and globbing. Use quotes around $L4T_VERSION and sources_$1.

Copilot uses AI. Check for mistakes.
KERNEL_VERSION="$1"
IP_ADDRESS="${2:-}"
USERNAME="${3:-administrator}"
REMOTE_PATH="/home/${USERNAME}/${4:-ymodlin/}/"

Copilot AI Jan 21, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hardcoded default 'ymodlin/' appears to be user-specific. Consider using a more generic default or making it explicit in documentation that this should be changed.

Copilot uses AI. Check for mistakes.
Comment thread scripts/deploy_kernel_6.2.sh Outdated
Comment on lines +52 to +59
cp ${LOCAL_DIR}/install_to_kernel_6.2.sh ${LOCAL_DIR}/kernel_mod/6.2/
# Use SSH ControlMaster to reuse a single SSH connection
CONTROL_PATH="/tmp/ssh-control-${USERNAME}-${TARGET}"
ssh -o ControlMaster=yes -o ControlPath="${CONTROL_PATH}" -o ControlPersist=10s -fN ${USERNAME}@${TARGET}
ssh -o ControlMaster=no -o ControlPath="${CONTROL_PATH}" ${USERNAME}@${TARGET} "rm -rf ${REMOTE_PATH}/kernel_mod/6.2 && mkdir -p ${REMOTE_PATH}/kernel_mod"
scp -o ControlMaster=no -o ControlPath="${CONTROL_PATH}" -r ${LOCAL_DIR}/kernel_mod/6.2 ${USERNAME}@${TARGET}:${REMOTE_PATH}/kernel_mod/
ssh -o ControlMaster=no -o ControlPath="${CONTROL_PATH}" ${USERNAME}@${TARGET} "chmod +x ${REMOTE_PATH}/kernel_mod/6.2/install_to_kernel_6.2.sh"
ssh -o ControlMaster=no -o ControlPath="${CONTROL_PATH}" ${USERNAME}@${TARGET} "cd ${REMOTE_PATH}/kernel_mod/6.2 && ./install_to_kernel_6.2.sh ${REMOTE_BOOT_FOLDER}"

Copilot AI Jan 21, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script copies 'install_to_kernel_6.2.sh' but this file doesn't exist in the diff. It should be 'install_to_kernel_dev.sh' based on the newly created file.

Suggested change
cp ${LOCAL_DIR}/install_to_kernel_6.2.sh ${LOCAL_DIR}/kernel_mod/6.2/
# Use SSH ControlMaster to reuse a single SSH connection
CONTROL_PATH="/tmp/ssh-control-${USERNAME}-${TARGET}"
ssh -o ControlMaster=yes -o ControlPath="${CONTROL_PATH}" -o ControlPersist=10s -fN ${USERNAME}@${TARGET}
ssh -o ControlMaster=no -o ControlPath="${CONTROL_PATH}" ${USERNAME}@${TARGET} "rm -rf ${REMOTE_PATH}/kernel_mod/6.2 && mkdir -p ${REMOTE_PATH}/kernel_mod"
scp -o ControlMaster=no -o ControlPath="${CONTROL_PATH}" -r ${LOCAL_DIR}/kernel_mod/6.2 ${USERNAME}@${TARGET}:${REMOTE_PATH}/kernel_mod/
ssh -o ControlMaster=no -o ControlPath="${CONTROL_PATH}" ${USERNAME}@${TARGET} "chmod +x ${REMOTE_PATH}/kernel_mod/6.2/install_to_kernel_6.2.sh"
ssh -o ControlMaster=no -o ControlPath="${CONTROL_PATH}" ${USERNAME}@${TARGET} "cd ${REMOTE_PATH}/kernel_mod/6.2 && ./install_to_kernel_6.2.sh ${REMOTE_BOOT_FOLDER}"
cp ${LOCAL_DIR}/install_to_kernel_dev.sh ${LOCAL_DIR}/kernel_mod/6.2/
# Use SSH ControlMaster to reuse a single SSH connection
CONTROL_PATH="/tmp/ssh-control-${USERNAME}-${TARGET}"
ssh -o ControlMaster=yes -o ControlPath="${CONTROL_PATH}" -o ControlPersist=10s -fN ${USERNAME}@${TARGET}
ssh -o ControlMaster=no -o ControlPath="${CONTROL_PATH}" ${USERNAME}@${TARGET} "rm -rf ${REMOTE_PATH}/kernel_mod/6.2 && mkdir -p ${REMOTE_PATH}/kernel_mod"
scp -o ControlMaster=no -o ControlPath="${CONTROL_PATH}" -r ${LOCAL_DIR}/kernel_mod/6.2 ${USERNAME}@${TARGET}:${REMOTE_PATH}/kernel_mod/
ssh -o ControlMaster=no -o ControlPath="${CONTROL_PATH}" ${USERNAME}@${TARGET} "chmod +x ${REMOTE_PATH}/kernel_mod/6.2/install_to_kernel_dev.sh"
ssh -o ControlMaster=no -o ControlPath="${CONTROL_PATH}" ${USERNAME}@${TARGET} "cd ${REMOTE_PATH}/kernel_mod/6.2 && ./install_to_kernel_dev.sh ${REMOTE_BOOT_FOLDER}"

Copilot uses AI. Check for mistakes.
Comment thread scripts/deploy_kernel_6.2.sh Outdated
Comment on lines +52 to +59
cp ${LOCAL_DIR}/install_to_kernel_6.2.sh ${LOCAL_DIR}/kernel_mod/6.2/
# Use SSH ControlMaster to reuse a single SSH connection
CONTROL_PATH="/tmp/ssh-control-${USERNAME}-${TARGET}"
ssh -o ControlMaster=yes -o ControlPath="${CONTROL_PATH}" -o ControlPersist=10s -fN ${USERNAME}@${TARGET}
ssh -o ControlMaster=no -o ControlPath="${CONTROL_PATH}" ${USERNAME}@${TARGET} "rm -rf ${REMOTE_PATH}/kernel_mod/6.2 && mkdir -p ${REMOTE_PATH}/kernel_mod"
scp -o ControlMaster=no -o ControlPath="${CONTROL_PATH}" -r ${LOCAL_DIR}/kernel_mod/6.2 ${USERNAME}@${TARGET}:${REMOTE_PATH}/kernel_mod/
ssh -o ControlMaster=no -o ControlPath="${CONTROL_PATH}" ${USERNAME}@${TARGET} "chmod +x ${REMOTE_PATH}/kernel_mod/6.2/install_to_kernel_6.2.sh"
ssh -o ControlMaster=no -o ControlPath="${CONTROL_PATH}" ${USERNAME}@${TARGET} "cd ${REMOTE_PATH}/kernel_mod/6.2 && ./install_to_kernel_6.2.sh ${REMOTE_BOOT_FOLDER}"

Copilot AI Jan 21, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

References to 'install_to_kernel_6.2.sh' should be changed to 'install_to_kernel_dev.sh' to match the actual script file created.

Suggested change
cp ${LOCAL_DIR}/install_to_kernel_6.2.sh ${LOCAL_DIR}/kernel_mod/6.2/
# Use SSH ControlMaster to reuse a single SSH connection
CONTROL_PATH="/tmp/ssh-control-${USERNAME}-${TARGET}"
ssh -o ControlMaster=yes -o ControlPath="${CONTROL_PATH}" -o ControlPersist=10s -fN ${USERNAME}@${TARGET}
ssh -o ControlMaster=no -o ControlPath="${CONTROL_PATH}" ${USERNAME}@${TARGET} "rm -rf ${REMOTE_PATH}/kernel_mod/6.2 && mkdir -p ${REMOTE_PATH}/kernel_mod"
scp -o ControlMaster=no -o ControlPath="${CONTROL_PATH}" -r ${LOCAL_DIR}/kernel_mod/6.2 ${USERNAME}@${TARGET}:${REMOTE_PATH}/kernel_mod/
ssh -o ControlMaster=no -o ControlPath="${CONTROL_PATH}" ${USERNAME}@${TARGET} "chmod +x ${REMOTE_PATH}/kernel_mod/6.2/install_to_kernel_6.2.sh"
ssh -o ControlMaster=no -o ControlPath="${CONTROL_PATH}" ${USERNAME}@${TARGET} "cd ${REMOTE_PATH}/kernel_mod/6.2 && ./install_to_kernel_6.2.sh ${REMOTE_BOOT_FOLDER}"
cp ${LOCAL_DIR}/install_to_kernel_dev.sh ${LOCAL_DIR}/kernel_mod/6.2/
# Use SSH ControlMaster to reuse a single SSH connection
CONTROL_PATH="/tmp/ssh-control-${USERNAME}-${TARGET}"
ssh -o ControlMaster=yes -o ControlPath="${CONTROL_PATH}" -o ControlPersist=10s -fN ${USERNAME}@${TARGET}
ssh -o ControlMaster=no -o ControlPath="${CONTROL_PATH}" ${USERNAME}@${TARGET} "rm -rf ${REMOTE_PATH}/kernel_mod/6.2 && mkdir -p ${REMOTE_PATH}/kernel_mod"
scp -o ControlMaster=no -o ControlPath="${CONTROL_PATH}" -r ${LOCAL_DIR}/kernel_mod/6.2 ${USERNAME}@${TARGET}:${REMOTE_PATH}/kernel_mod/
ssh -o ControlMaster=no -o ControlPath="${CONTROL_PATH}" ${USERNAME}@${TARGET} "chmod +x ${REMOTE_PATH}/kernel_mod/6.2/install_to_kernel_dev.sh"
ssh -o ControlMaster=no -o ControlPath="${CONTROL_PATH}" ${USERNAME}@${TARGET} "cd ${REMOTE_PATH}/kernel_mod/6.2 && ./install_to_kernel_dev.sh ${REMOTE_BOOT_FOLDER}"

Copilot uses AI. Check for mistakes.
Comment on lines +48 to +61
if [ "$#" -eq 0 ]; then
echo "No TARGET specified, skipping copy and reboot."
else
echo "Copying files and setting permissions on remote host..."
cp ${LOCAL_DIR}/install_to_kernel_6.2.sh ${LOCAL_DIR}/kernel_mod/6.2/
# Use SSH ControlMaster to reuse a single SSH connection
CONTROL_PATH="/tmp/ssh-control-${USERNAME}-${TARGET}"
ssh -o ControlMaster=yes -o ControlPath="${CONTROL_PATH}" -o ControlPersist=10s -fN ${USERNAME}@${TARGET}
ssh -o ControlMaster=no -o ControlPath="${CONTROL_PATH}" ${USERNAME}@${TARGET} "rm -rf ${REMOTE_PATH}/kernel_mod/6.2 && mkdir -p ${REMOTE_PATH}/kernel_mod"
scp -o ControlMaster=no -o ControlPath="${CONTROL_PATH}" -r ${LOCAL_DIR}/kernel_mod/6.2 ${USERNAME}@${TARGET}:${REMOTE_PATH}/kernel_mod/
ssh -o ControlMaster=no -o ControlPath="${CONTROL_PATH}" ${USERNAME}@${TARGET} "chmod +x ${REMOTE_PATH}/kernel_mod/6.2/install_to_kernel_6.2.sh"
ssh -o ControlMaster=no -o ControlPath="${CONTROL_PATH}" ${USERNAME}@${TARGET} "cd ${REMOTE_PATH}/kernel_mod/6.2 && ./install_to_kernel_6.2.sh ${REMOTE_BOOT_FOLDER}"
ssh -o ControlPath="${CONTROL_PATH}" -O exit ${USERNAME}@${TARGET} 2>/dev/null
fi

Copilot AI Jan 21, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This condition will never be true because TARGET is checked at line 25 and is required. If no arguments are provided, TARGET would be empty string but $# would be checked before this point. The help message exit at line 21 already handles the zero argument case.

Suggested change
if [ "$#" -eq 0 ]; then
echo "No TARGET specified, skipping copy and reboot."
else
echo "Copying files and setting permissions on remote host..."
cp ${LOCAL_DIR}/install_to_kernel_6.2.sh ${LOCAL_DIR}/kernel_mod/6.2/
# Use SSH ControlMaster to reuse a single SSH connection
CONTROL_PATH="/tmp/ssh-control-${USERNAME}-${TARGET}"
ssh -o ControlMaster=yes -o ControlPath="${CONTROL_PATH}" -o ControlPersist=10s -fN ${USERNAME}@${TARGET}
ssh -o ControlMaster=no -o ControlPath="${CONTROL_PATH}" ${USERNAME}@${TARGET} "rm -rf ${REMOTE_PATH}/kernel_mod/6.2 && mkdir -p ${REMOTE_PATH}/kernel_mod"
scp -o ControlMaster=no -o ControlPath="${CONTROL_PATH}" -r ${LOCAL_DIR}/kernel_mod/6.2 ${USERNAME}@${TARGET}:${REMOTE_PATH}/kernel_mod/
ssh -o ControlMaster=no -o ControlPath="${CONTROL_PATH}" ${USERNAME}@${TARGET} "chmod +x ${REMOTE_PATH}/kernel_mod/6.2/install_to_kernel_6.2.sh"
ssh -o ControlMaster=no -o ControlPath="${CONTROL_PATH}" ${USERNAME}@${TARGET} "cd ${REMOTE_PATH}/kernel_mod/6.2 && ./install_to_kernel_6.2.sh ${REMOTE_BOOT_FOLDER}"
ssh -o ControlPath="${CONTROL_PATH}" -O exit ${USERNAME}@${TARGET} 2>/dev/null
fi
echo "Copying files and setting permissions on remote host..."
cp ${LOCAL_DIR}/install_to_kernel_6.2.sh ${LOCAL_DIR}/kernel_mod/6.2/
# Use SSH ControlMaster to reuse a single SSH connection
CONTROL_PATH="/tmp/ssh-control-${USERNAME}-${TARGET}"
ssh -o ControlMaster=yes -o ControlPath="${CONTROL_PATH}" -o ControlPersist=10s -fN ${USERNAME}@${TARGET}
ssh -o ControlMaster=no -o ControlPath="${CONTROL_PATH}" ${USERNAME}@${TARGET} "rm -rf ${REMOTE_PATH}/kernel_mod/6.2 && mkdir -p ${REMOTE_PATH}/kernel_mod"
scp -o ControlMaster=no -o ControlPath="${CONTROL_PATH}" -r ${LOCAL_DIR}/kernel_mod/6.2 ${USERNAME}@${TARGET}:${REMOTE_PATH}/kernel_mod/
ssh -o ControlMaster=no -o ControlPath="${CONTROL_PATH}" ${USERNAME}@${TARGET} "chmod +x ${REMOTE_PATH}/kernel_mod/6.2/install_to_kernel_6.2.sh"
ssh -o ControlMaster=no -o ControlPath="${CONTROL_PATH}" ${USERNAME}@${TARGET} "cd ${REMOTE_PATH}/kernel_mod/6.2 && ./install_to_kernel_6.2.sh ${REMOTE_BOOT_FOLDER}"
ssh -o ControlPath="${CONTROL_PATH}" -O exit ${USERNAME}@${TARGET} 2>/dev/null

Copilot uses AI. Check for mistakes.
ymodlin and others added 2 commits January 21, 2026 13:00
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
- Added deploy_kernel_6.2.sh to package kernel modules and update boot files on target devices.
- Created install_to_kernel_6.2.sh for installing kernel modules on the target device.
- Added .gitignore to exclude specific directories from version control.
@ymodlin
ymodlin requested a review from ejgoldik January 22, 2026 09:22
@ymodlin
ymodlin merged commit e42f099 into dev Jan 22, 2026
6 checks passed
@ymodlin
ymodlin deleted the deploy_scripts branch January 22, 2026 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants