# Driver Installation

The driver is required for enabling communication between your host system and the installed NPU device. It is available on **Linux (Ubuntu)** or **Windows** systems.

```{attention}
- Please complete driver installation before proceeding with runtime setup.
- Please check the compatible runtime and firmware versions [here](compatibility.md)
```

## Table of Contents

- Linux

    - [Option 1: Installing via APT on Ubuntu](#option-1-installing-via-apt-on-ubuntu)

        - [(Optional) Installation on Secure Boot](#installation-on-secure-boot)

    - [Option 2: Manual Download (Other Linux distributions)](#option-2-manual-download-other-linux-distributions)

        - [(Optional) Built-In Kernel Integration](#optional-built-in-kernel-integration)

- Windows

    - [Option 1: Installing with Windows Update](#option-1-installing-with-windows-update)

    - [Option 2: Manual Installing of Windows Driver](#option-2-manual-installing-of-windows-driver)

## Linux

### Option 1: Installing via APT on Ubuntu

Mobilint provides a driver package for Ubuntu that can be installed using the **APT package manager**. You may also build the driver from source for use with other Linux distributions.

#### Requirements

Before starting, ensure the following:

- Your system is running Ubuntu 20.04, or later (x86-64 or ARM64)
- You have sudo/root privileges
- The following build tools are installed:

    ```bash
    sudo apt install linux-headers-$(uname -r) build-essential
    ```

#### Installation Process

1. Add the Mobilint APT repository to your system before proceeding with the installation.

    ```bash
    # Add Mobilint's official GPG key:
    sudo apt update
    sudo apt install ca-certificates curl
    sudo install -m 0755 -d /etc/apt/keyrings
    sudo curl -fsSL https://dl.mobilint.com/apt/gpg.pub -o /etc/apt/keyrings/mblt.asc
    sudo chmod a+r /etc/apt/keyrings/mblt.asc

    # Add the repository to apt sources:
    printf "%s\n" \
        "deb [signed-by=/etc/apt/keyrings/mblt.asc] https://dl.mobilint.com/apt \
        stable multiverse" | \
        sudo tee /etc/apt/sources.list.d/mobilint.list > /dev/null

    # Update available packages
    sudo apt update
    ```

2. Install the driver using the command below.

    ```bash
    sudo apt install mobilint-aries-driver
    ```

    ```{warning}
    If Secure Boot is enabled on your PC, driver will not be installed. Please disable Secure Boot and reinstall driver, or refer to [Installation on Secure Boot](#installation-on-secure-boot).
    ```

    You can check whether Secure Boot is enabled using the following command.
    
    ```bash
    $ mokutil --sb-state
    SecureBoot enabled
    ```

3. Once the driver installation is complete, reboot the system.

#### Verifying Installation

After reboot, check that the device node has been created:

```bash
ls -al /dev/aries*
```

If your NPU is recognized, you should see output listing device nodes such as `/dev/aries0`.

![Driver check](/res/image/driver_check.png "Driver check")

If not, confirm the NPU is recognized on the PCI bus:

```bash
sudo lspci -vd 209f:
```

If this command does not return an output like the following image, check the hardware connection (power, PCIe seating) or try another slot.

![Device check](/res/image/lspci.png "Device check")

If you are unable to install the driver using the provided method, please follow the alternative installation method described below. Or contact our technical support team at [https://discuss.mobilint.com](https://discuss.mobilint.com).

#### Installation on Secure Boot

To install the driver in an environment where Secure Boot is enabled, you need to register the driver's MOK (Machine Owner Key) in the system.

```{warning}
MOK registration cannot be performed in a remote work environment; it must be done by directly accessing the system with display and keyboard.
```

The registration procedure is as follows:

First, when you enter the installation command, the following message will appear.

```bash
$ sudo apt install mobilint-aries-driver
* READ ME! *****************************************************************
*
* Installation Instruction for Secure Boot Mode
*
* You are now installing aries driver on secure boot mode. MOK (Machine Owner Key) should be enrolled to the system first for succesful driver installation. If you haven't enrolled MOK yet, make sure that you are not accessing the system remotely (via ssh) as you need to enroll the MOK on system booting. Follow the instructions below.
*
* 1. You will be prompted to set password for MOK key enrollment. Set the password (which should be 8 to 16 characters) and remember it for step 2.
* 2. Reboot to enroll MOK to the system. Blue screen will pop up automatically for MOK enrollment. Enroll the key using the password you set in step 1. If you failed to enroll MOK for any reason, move on to step 3.
* 3. Reinstall the driver: \"sudo apt install mobilint-aries-driver\".
* 4. If the installation was successful, check whether the driver is loaded: \"lsmod | grep aries\". If not, follow the instruction from step 1 again.
*
*********************************
```

Enter the MOK password following the instructions. The password must be between 8 and 16 characters.

```bash
[Instruction] Set password for MOK enrollment
input password: 
input password again: 
```

After entering the MOK password, you may see an error log indicating installation failure along with a message instructing you to reboot the system and reinstall the driver. Then, reboot the system.

```bash
[Instruction] Enroll MOK on reboot. Then reinstall the driver.
dpkg: error processing package mobilint-aries-driver (--install):
 installed mobilint-aries-driver package post-installation script subprocess returned error exit status 1
```

When the system reboots, a blue screen titled "**Shim UEFI Key Management**" will appear.
Then, press any key to proceed to the MOK configuration.

![MOK_1](/res/image/mok_1.jpg "MOK_1")

When the "**Perform MOK Management**" screen appears, select "**Enroll MOK**".

![MOK_2](/res/image/mok_2.jpg "MOK_2")

When the "**Enroll the key(s)**?" screen appears, select "**Yes**".

![MOK_3](/res/image/mok_3.jpg "MOK_3")

When the "**Enroll MOK**" screen appears, select "**Continue**".

![MOK_4](/res/image/mok_4.jpg "MOK_4")

Enter the MOK password that you set during the driver installation by `apt`.

![MOK_5](/res/image/mok_5.jpg "MOK_5")

After the MOK registration is complete, select "**Reboot**" to restart the system.

![MOK_6](/res/image/mok_6.jpg "MOK_6")

Once the system reboots after completing MOK registration, try to reinstall the driver. The installation should now proceed successfully.

```bash
sudo apt install mobilint-aries-driver
```

```{note}
If you enter the MOK password incorrectly during the MOK registration process, installation command will request you to set a new MOK password. After setting the new password, reboot the system and repeat the MOK registration process.
```

### Option 2: Manual Download (Other Linux distributions)

Building a kernel module requires kernel headers and a compiler, and the specific requirements may vary significantly depending on your Linux distribution and environment. 

The following instructions illustrate the required steps for Ubuntu to install prerequisites using APT; please refer to them and adapt accordingly for your own system.

#### Requirements

- Download the appropriate driver from Mobilint’s official [Download Center](https://dl.mobilint.com).

- Before building the driver, make sure the following packages are installed:
    ```bash
    sudo apt install linux-headers-$(uname -r) build-essential
    ```

#### Installation Process

The driver package available from [Download Center](https://dl.mobilint.com) is provided in a form that allows you to build and use the kernel module direclty. If you intend to use it as a loadable module, you can simply build it using `make` and insert or remove the kernel module as shown below.

```bash
## Build the kernel
make

## insert the kernel module
sudo insmod aries.ko
```

- remove the kernel module

    You can remove the kernel module after insert with following command:

    ```bash
    sudo rmmod aries
    ```

#### Optional: Built-in Kernel Integration

If you want to include the driver as part of your custom Linux kernel (built-in module), refer to your distribution’s kernel build and packaging process.

If you are unable to install the driver using the instructions provided, please contact our technical support team at [https://discuss.mobilint.com](https://discuss.mobilint.com).

## Windows

Mobilint provides a WHQL-certified **Universal KMDF driver** for 64-bit Windows 10/11 (Build 19041 or later).

- Requirements
	- Windows 10 or 11 (64-bit), Universal (Above Windows 10.0.19041 build)
		- Windows Update may be required to reach minimum supported version

First, connect the device to the PCIe slot while the PC is powered off, then turn on the power and check if the device is properly recognized in `Device Manager`.

![Device Manager](/res/image/windows_driver_uninstalled_en.png "Device Manager")

```{note}
- Before the driver is installed, the device will appear under "Other Devices" as "PCI Simple Communications Controller".
- For the driver installation to proceed successfully, the motherboard and CPU drivers must be installed first.
```

Once the existence of the device is confirmed, you can proceed with installing the driver using one of the two methods below.

### Option 1: Installing with Windows Update

The easiest way is to install the driver through Windows Update.

1. Run "Windows update" in Settings.  
    ![Windows update](/res/image/windows_update_0_en.png "Windows update")  
	Press the "Check for updates" button and wait until it is complete.

2. Click "Advanced options".  
    ![Advanced options](/res/image/windows_update_1_en.png "Advanced options")  

3. Click "Optional updates".  
    ![Optional updates](/res/image/windows_update_2_en.png "Optional updates")  

4. Select "MOBILINT, Inc. AI Device Driver Update" from the "Driver Updates" list, then click "Download & install".  
    ![Download & install](/res/image/windows_update_3_en.png "Download & install")  

If the list is not visible, you need to check if the latest driver is already installed or if the device has been recognized first.

### Option 2: Manual Installing of Windows Driver

Drivers can be easily installed via Windows Update, but manual installation is required in situations where internet access is unavailable. When installing manually, follow the procedure below.

1. Download the [latest Windows driver](https://dl.mobilint.com/releases?series-id=3&product=ARIES) from another host PC with internet access and transfer them to the target PC.

    ![Download driver](/res/image/windows_driver_download.png "Download driver")

2. In Device Manager, click the "Update Driver" button.

    ![Update Driver](/res/image/windows_control_pannel_update_driver_en.png "Update driver")

3. Proceed by selecting `Browse my computer for drivers`.

    ![Manual Install](/res/image/en_manual_installation.png "Manual install")

4. Locate the folder containing the driver files.

    ![Find driver](/res/image/en_find_driver.png "Find driver")

5. Once installation is complete, you will see that the driver has been successfully installed, as shown below.

    ![Driver installation done](/res/image/en_complete_install.png "Driver installation done")

    ![Device Manager](/res/image/en_fin_device_manager.png "Device Manager")

