Skip to content

redhat: scripts: An automation script for disabling unused driver for x86

Kate Hsuan requested to merge hpa1/kernel-ark:wip/kate/driver-filter into os-build

Some of the drivers are not used for x86 systems but they are enabled and shipped with Fedora kernel release. These unnecessary kernel modules increase the package size for x86 platform. If we manually disable all unnecessary drivers, it takes time and is difficult to address the errors. If a place can be used to manage a list of necessary drivers and based on the list, the unnecessary drivers can be automatically disabled, it certainly reduces a part of the workload for the maintainer. Moreover, the package size can also be reduced by the results of the tool. In this work, we proposed an automation script tool that can be used to disable the drivers based on a configuration list. The drivers that are not in the list will be disabled and reduce the kernel module package size.

This script filters and disables the unused driver through an allow list file in JSON format. The maintainer sets a list kernel config to the allow list file and then runs this script. It will compare the current setting with allow list. If the current settings aren't listed in the allow list, the script will generate a redhat kernel config file and disable it.

Moreover, the allow list file includes the setting of the commit title and commit message. The maintainer can make that information according to the requirement. The format is shown below.

{
"name":"iio_accel",
"driver_path":"drivers/iio/accel/",
"redhat_config_path":"redhat/configs/fedora/generic",
"redhat_x86_config_path":"redhat/configs/fedora/generic/x86",
"allow_list":[
"CONFIG_BMC150_ACCEL_I2C",
"CONFIG_DA280",
"CONFIG_HID_SENSOR_ACCEL_3D",
"CONFIG_KXCJK1013",
"CONFIG_MMA7660",
"CONFIG_MMA8452",
"CONFIG_MXC4005",
"CONFIG_MXC6255",
"CONFIG_IIO_ST_ACCEL_I2C_3AXIS",
"CONFIG_IIO_ST_ACCEL_3AXIS",
"CONFIG_IIO_CROS_EC_ACCEL_LEGACY",
"CONFIG_BMC150_ACCEL"
],
"commit_title":"Disable accel drivers for Fedora x86",
"commit_msg":"Disable the following accel drivers because they are not used on any x86 boards.\n{{ config_list }}"
}

The second commit includes the result of the script. It disabled the unused iio accel drivers for x86 since they were not used in any x86 boards.

Edited by Kate Hsuan

Merge request reports