(Optional) Repacking the Driver Package
Build a driver package that meets the requirements of the target OS version, kernel version, and GCC version.
A driver package can be repacked using either of the following methods:
- Directly repack the driver package.
- Decompress the .run package and then repack the driver package.
- Use a repacking tool to repack the driver package.
The first two methods are recommended.
- If you do not need to change source code in the .run package, use the first method. For details, see Directly Repacking the Driver Package.
- If you need to change source driver code, use the second method. For details, see Repacking the Decompressed Driver Package.
Prerequisites
- The GCC tool and kernel source code corresponding to the target OS and its kernel version exist. For details, see Checking the OS and Environment.
- The open-source tool Makeself v2.4.0 has been downloaded from https://github.com/megastep/makeself or https://github.com/megastep/makeself/releases/tag/release-2.4.0.
- Pigz has been installed. You can run the which pigz command to check whether Pigz has been installed. If the path where Pigz is installed is displayed, Pigz has been installed.
Directly Repacking the Driver Package
- Obtain the general driver package. For details, see Obtaining Software Packages.
- Upload the general driver package to the same directory in the operating environment, for example, in the /opt directory.
- Run the following command to go to the directory where the software package in 2 is stored, for example, /opt:
cd /opt
- Run the following command to add the execution permission for the general driver package:
chmod +x *.run
Example: A300t-9000-npu-driver_x.x.x_linux-aarch64.run
- Run the following command as the root user to build a new driver package:
./*.run --repack [package_name]
Example: ./A300t-9000-npu-driver_x.x.x_linux-aarch64.run --repack A300t-9000-npu-driver-repack.run
If package_name is not specified, a file named Original driver package name-custom.run will be generated in the current path.
- Install the driver. For details, see Installing the Driver and Firmware.
Repacking the Decompressed Driver Package
- Obtain the general driver package. For details, see Obtaining Software Packages.
- Upload the general driver package to the same directory in the operating environment, for example, in the /opt directory.
- Run the following command to go to the directory where the software package in 2 is stored, for example, /opt:
cd /opt
- Run the following command to add the execution permission for the general driver package:
chmod +x *.run
Example: A300t-9000-npu-driver_x.x.x_linux-aarch64.run
- Run the following command to decompress the general driver package to a specified directory:
./*.run --noexec --extract=Specified directory
Example: ./A300t-9000-npu-driver_x.x.x_linux-aarch64.run --noexec --extract=./tmp
- Run the following command to build a new driver package:
./*.run --repack-path=<path> [package_name]
Example: ./A300t-9000-npu-driver_x.x.x_linux-aarch64.run --repack-path=tmp/ A300t-9000-npu-driver-repack.run
If package_name is left blank, a file named original_driver_package_name-custom.run is generated in the current path.
- Install the driver. For details, see Installing the Driver and Firmware.
Using the Repacking Tool to Repack the Driver Package
- Obtain the general driver package and repacking tool package. For details, see Obtaining Software Packages.
- Upload the general driver package, repacking tool package, and open-source software package makeself-release-2.4.0.zip to the same directory in the operating environment, for example, in the /opt directory.
- Run the following command to go to the directory where the software package in 2 is stored, for example, /opt:
cd /opt
- Run the following command to add the execution permission for the general driver package:
chmod +x *.run
Example: chmod +x A300t-9000-npu-driver_x.x.x_linux-aarch64.run
- Run the following command to decompress the general driver package to a specified directory:
./*.run --noexec --extract=Specified directory
Example: ./A300t-9000-npu-driver_x.x.x_linux-aarch64.run --noexec --extract=./tmp
- Run the following command to depress the repacking tool package to the current directory:
tar -xzvf Name of the repacking tool package --strip-components 1
Example: tar -xzvf A300t-9000-npu-driver-repack-tools-x.x.x.tar.gz --strip-components 1
- Run the following command to depress the software package makeself-release-2.4.0.zip:
unzip makeself-release-2.4.0.zip
- Run the following command to build a new driver package:
bash build.sh makeself.sh Path Decompression_path_of_the_general_driver package Output_package_name
Example: bash build.sh ./makeself-release-2.4.0/makeself.sh tmp/ A300t-9000-npu-driver-repack.run
- Install the driver. For details, see Installing the Driver and Firmware.