# akmod-amd-isp4-capture

[![Copr Build Status](https://copr.fedorainfracloud.org/coprs/abn/amd-isp4-capture-kmod/package/amd-isp4-capture-kmod/status_image/last_build.png)](https://copr.fedorainfracloud.org/coprs/abn/amd-isp4-capture-kmod/package/amd-isp4-capture-kmod/)
[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/abn/amd-isp4-capture-kmod-rpm)

Fedora **akmod** package for the AMD ISP4 camera driver, enabling the built-in camera on AMD Ryzen AI Max (Strix Halo) platforms.

The driver source is tracked as patches from the [lore.kernel.org linux-media list](https://lore.kernel.org/linux-media/?q=amd+isp4+capture+Bin.Du), applied at build time. Use `update-patches.sh` to pull a new patch series revision.

## Installation

This driver is available via the [abn/amd-isp4-capture-kmod](https://copr.fedorainfracloud.org/coprs/abn/amd-isp4-capture-kmod/) Copr repository.

```bash
# Enable the Copr repository
sudo dnf copr enable abn/amd-isp4-capture-kmod

# Install the akmod and meta-package
sudo dnf install akmod-amd-isp4-capture kmod-amd-isp4-capture
```

### Secure Boot Enrollment (Required if Secure Boot is ON)

If your system has Secure Boot enabled, you **must** enroll a signing key so the kernel can trust and load the locally-compiled module.

> **Note:** The `kmodgenca` command requires the `akmods` package to be installed.

1.  **Generate a signing key** (if you haven't already):
    ```bash
    sudo kmodgenca -a
    ```

2.  **Import the key into the MOK (Machine Owner Key) database**:
    ```bash
    sudo mokutil --import /etc/pki/akmods/certs/public_key.der
    ```
    *You will be prompted to enter a one-time password. You will need this after rebooting.*

3.  **Reboot your system.**
    During startup, you will see a blue screen ("Perform MOK Management"). Select **Enroll MOK**, then **Continue**, and **Yes** to confirm. Enter the password you chose in step 2.

4.  **Rebuild and load the module**:
    Once back in Fedora, force a rebuild to sign the module with your new key:
    ```bash
    sudo akmods --force --akmod amd-isp4-capture-kmod
    sudo modprobe amd_isp4_capture
    ```

## Post-Installation

The module is compiled for your running kernel automatically. This typically takes about a minute. The `akmod` system ensures the driver is rebuilt automatically every time your kernel updates.

To verify the module is loaded:
```bash
lsmod | grep amd_isp4_capture
```

## Troubleshooting

If the module fails to load:

1.  **Check the akmods build log**:
    ```bash
    cat /var/cache/akmods/amd-isp4-capture/*.log
    ```

2.  **Verify signature status**:
    ```bash
    modinfo amd_isp4_capture | grep signature
    ```
    If no signature is present or if `modprobe` reports "Key was rejected by service", ensure you have followed the Secure Boot steps above.

## Development

This project uses [tito](https://github.com/rpm-software-management/tito) for versioning and release management.

### Building RPMs locally

See `HOW-TO-BUILD-RPMS.md` for the full workflow. Quick reference:

```bash
# Build source tarball and RPMs (single shot)
mkdir -p output
tito build --test --tgz
cp /tmp/tito/amd-isp4-capture-kmod-git-*.tar.gz ./amd-isp4-capture-kmod-8.tar.gz
podman run --rm \
  -v $(pwd):/sources:z -v $(pwd)/output:/output:z \
  quay.io/abn/rpmbuilder:fedora-43 rpmbuilder
```

### Updating to a new upstream patch series

```bash
# Find the cover-letter message ID at:
# https://lore.kernel.org/linux-media/?q=amd+isp4+capture+Bin.Du
./update-patches.sh <cover-letter-message-id>
```

Requires `b4` (`sudo dnf install b4`).

### Releasing to COPR

To tag a new version and release to COPR:
```bash
# Tag a new release (updates spec and creates git tag)
tito tag

# Release to COPR (as configured in .tito/releasers.conf)
tito release copr
```
