This skill providesend-to-end automated NPU driver and firmware installation capabilities, covering the entire process from installation package verification to driver effectiveness verification, without the need for manual step-by-step operations, strictly following Ascend official installation specifications, and adapting to mainstream Linux distributions.
Core Capabilities
- Automatically extract driver/firmware packages from a specified folder based on official regular expressions, and strictly verify the uniqueness of the package count, allowing only 1 driver package + 1 firmware package;
- Executable permissions for installation packages are granted on demand, and automatically executed when there are no permissions
chmod +xand the permission grant result is verified a second time to avoid installation failures caused by permission issues; - Dual Python+Shell package verification, verifying package format, path, and file validity in advance, and intercepting invalid installation packages;
- Verify system dependencies before installation
- Strictly follow Ascend officialdriver first, then firmwareinstallation order, and after installation provide an interactive restart option + official
npu-sminative commands to verify driver status.
Prerequisites
- This version does not require kernel verification, and deployment can be performed directly
1. Script File Preparation
Place the core scriptscheck_package.py(Python package verification) andinstall_npu_driver.sh(Shell main installation) in thesame directory. The root directory of this skill is recommended to be namedascend-npu-driver-install, consistent with the name field.
2. Installation Package Requirements
In the specified installation package folderstore only 1driver .run package and 1 firmware .run package that conform to the Ascend official naming format, with no other irrelevant files. The package name format strictly follows:
- Driver package:
Ascend-hdk-<chip_type>-npu-driver_<version>_linux-<arch>.run - Firmware package:
Ascend-hdk-<chip_type>-npu-firmware_<version>.run
3. System Environment Requirements
- Permissions: must haveROOT administrator permissions, can switch via
sudo -icommand; - System: compatible with CentOS/RHEL, Ubuntu/Debian series Linux distributions, supporting yum/apt package managers;
- Basic environment: Python3 is preinstalled on the system; in offline environments without network, it is necessary tomanually install in advancegcc, make, and dkms core dependencies;
- Hardware: compatible with Ascend Ascend310P, Ascend910A, Ascend910B series NPU chips.
Quick Usage Steps
Restrictions
- The installation package parameters only support --full, --install, --install-for-all
Step 1: Add executable permissions to the scripts
Enter the skill root directory where the scripts are located, and execute the following command to grant executable permissions to the two core scripts:
chmod +x ./scripts/install_npu_driver.sh ./scripts/check_package.py
Step 2: Execute the automated installation script
Command format:./scripts/install_npu_driver.sh <NPU包文件夹完整路径> <驱动运行用户>
Recommended example(install as root user):
./scripts/install_npu_driver.sh /opt/ascend/npu_pkgs root
Step 3: System Restart (Required for Driver to Take Effect)
After installation is complete, the script will display an interactive restart prompt.The system must be restarted for the NPU driver and firmware to take effect. Without a restart, driver loading cannot be completed:
- Input
y: the system restarts immediately to complete NPU driver kernel loading; - Input
n: Skip the immediate restart; it will need to be executed manually afterward.rebootThe command completes the system restart.
Step 4: Verify the installation result
After the system restarts, run the official Ascend native command to verify the NPU driver loading status:
npu-smi info
Installation success indicator: The command output contains the NPU chip model, Driver Version, and Firmware Version, with no error messages.
Core Script Description
check_package.py (Python package verification script) Automatically called by the main Shell script; no manual execution required. It mainly completes the following package verification work: Check whether the folder containing the installation package exists; Match the driver/firmware packages according to the official Ascend regular expression, and verify the uniqueness of the package count; Verify that the package is a valid file (not a directory); Detect the executable permission of the package, and give a warning if there is no permission; Output the complete absolute paths of the driver/firmware packages that pass verification, for use by the Shell script. install_npu_driver.sh (main Shell installation script) The core execution script of the skill runs automatically according to a fixed process, with no manual intervention throughout. The execution process is: ROOT/Python3 environment check → regular expression extraction of package paths → assign executable permissions to packages as needed → secondary Python package verification → automatic creation of the running user/group → install system dependencies after checking them first → NPU driver installation → NPU firmware installation → interactive restart confirmation → npu-smi native verification