#!/usr/bin/env bash
# SPDX-License-Identifier: GPL-2.0-only

build() {
    local major minor

    # AGP and DRM modules for GPUs
    map add_checked_modules '/drivers/char/agp/' '/drivers/gpu/drm/'

    # modules that implement the privacy screen interface
    IFS=.- read -r major minor _ <<<"$KERNELVERSION"
    if (( major > 5 || (major == 5 && minor >= 17) )); then
        add_checked_modules_from_symbol 'drm_privacy_screen_register' '=drivers/platform'
    fi
}

help() {
    cat <<HELPEOF
Adds KMS and privacy screen drivers to the initramfs image. To minimize the
modules in the image, add the autodetect hook too.
HELPEOF
}
