# OE linux kernel module

## Package description

The package contain the Opto Engineering linux kernel module that can work with ItalaAPI library (oegevmodule). 
The goal of the module is to minimize packet loss and CPU load at acquisition time, 
especially useful with 10G cameras. 

## License

Check the LICENSE file for information about allowed usage of this package.

## Warning

"oegevmodule" is precompiled for a precise kernel version and configuration.
Installing the module in a kernel other than the one it was build in may crash the system
with undefined behaviour. This may happen specially with custom or third party kernels. 
    
## Install the module

First of all, add the execution permission to install.sh and uninstall.sh, if necessary:

    $ sudo chmod +x ./install.sh ./uninstall.sh 

Than, you can run the install script:

    $ sudo ./install.sh

Check if the module is correctly installed:

    $ sudo lsmod | grep oegevmodule

The above command return the list of modules installed with "oegevmodule" in the name. 
If the command return an empty string, the module is not correctly installed.

After these steps, itala-sdk and ItalaView can use the module.
You can check oegevmodule activity from the kernel logs:

    $ sudo dmesg

Note: you need to sign the module if your system has "secure boot" enabled.

## Uninstall the module

    $ sudo ./uninstall.sh


# Opto Engineering linux kernel module with SecureBoot enabled

If Secure Boot is enabled on your system, the kernel module must be signed 
in order to load correctly.
Here is a guide on how to create a key pair and sign the module.

Check if SecureBoot is enabled:

    $ sudo mokutil --sb-state

## 1. Generate a Signing Key Pair

    $ openssl req -new -x509 -newkey rsa:2048 \
        -keyout MOK.key \
        -out MOK.crt \
        -nodes -days 36500 \
        -subj "/CN=Opto Engineering Module Signing/"

Convert the certificate to DER format:

    $ openssl x509 -in MOK.crt -outform DER -out MOK.der

## 2. Enroll the Key (MOK)

    $ sudo mokutil --import MOK.der

- Set a temporary password
- Reboot the system

During reboot:
- Select "Enroll MOK"
- Confirm enrollment
- Enter the password

Verify enrollment after reboot:

    $ mokutil --list-enrolled

## 3. Sign the Kernel Module

Locate sign-file tool:

    $ find /usr/src -name sign-file

Sign the module:

    $ /path/to/sign-file sha256 MOK.key MOK.der mymodule.ko

Verify the Signature:

    $ modinfo mymodule.ko | grep signer

## 4. Install the Driver

Add execution permission:

    $ sudo chmod +x install.sh

Run the installation script:

    $ sudo ./install.sh

## Important Notes

- SecureBoot systems require signed kernel modules
- Keep your private key (MOK.key) secure
- The module must match your running kernel version
- If the module is updated, it must be signed again
