{"id":21508852,"url":"https://github.com/oddlama/autokernel","last_synced_at":"2025-04-04T09:08:05.144Z","repository":{"id":56778714,"uuid":"239340226","full_name":"oddlama/autokernel","owner":"oddlama","description":"A tool for managing your kernel configuration that guarantees semantic correctness","archived":false,"fork":false,"pushed_at":"2024-10-26T22:13:51.000Z","size":796,"stargazers_count":99,"open_issues_count":2,"forks_count":4,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-28T08:06:33.084Z","etag":null,"topics":["configuration","kconfig","kernel","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oddlama.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-02-09T17:00:03.000Z","updated_at":"2025-03-18T21:49:02.000Z","dependencies_parsed_at":"2022-08-16T02:40:37.376Z","dependency_job_id":"08512886-c094-483b-9079-1c6ef1151283","html_url":"https://github.com/oddlama/autokernel","commit_stats":{"total_commits":176,"total_committers":3,"mean_commits":"58.666666666666664","dds":0.2727272727272727,"last_synced_commit":"d96f4516377d7596c45b892376fb73eb445addbe"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oddlama%2Fautokernel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oddlama%2Fautokernel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oddlama%2Fautokernel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oddlama%2Fautokernel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oddlama","download_url":"https://codeload.github.com/oddlama/autokernel/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247149501,"owners_count":20891954,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["configuration","kconfig","kernel","rust"],"created_at":"2024-11-23T21:13:07.733Z","updated_at":"2025-04-04T09:08:05.126Z","avatar_url":"https://github.com/oddlama.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\u003cimg width=\"auto\" height=\"90\" src=\"https://user-images.githubusercontent.com/31919558/201540026-7b9281f5-0f1b-4d7a-8b69-4480b1e467d3.png\"\u003e\u003c/p\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n[![Tutorial](https://img.shields.io/badge/API-Tutorial-informational.svg)](https://github.com/oddlama/autokernel/blob/main/examples/tutorial.lua)\n[![Crates.io](https://img.shields.io/crates/v/autokernel.svg)](https://crates.io/crates/autokernel)\n[![MIT License](https://img.shields.io/badge/license-MIT-informational.svg)](./LICENSE)\n\n\u003c/div\u003e\n\n# About autokernel\n\nAutokernel is a tool for managing your kernel configuration that guarantees semantic correctness.\nIt checks symbol assignments for validity by creating a native bridge to the kernel's\nKconfig interface and ensures that your configuration does not silently break during kernel updates.\nThe next time a config option is removed or renamed, similar to when `CONFIG_THUNDERBOLT` was merged\nwith `CONFIG_USB4`, you will notice.\n\nIt provides a configuration framework which understands the semantics behind symbols,\ntheir dependencies and allowed values and enforces these rules when generating the final\n`.config` kernel configuration file. It is able to automatically resolve symbol dependencies\nand show useful diagnostics to help you solve configuration errors.\n\nThe configuration itself can be written using traditional kconfig files\nor by using the more flexible and powerful lua scripting api. This allows for more complex logic\nand compatibility with multiple kernel versions. All kernel versions back to `v4.2.0` are supported.\n\n## Installation \\\u0026 Quickstart\n\nAutokernel can be installed with cargo:\n\n```bash\n$ cargo install autokernel\n```\n\nAfterwards you will need to create a `/etc/autokernel/config.toml` (for a reference see [examples/config.toml](https://github.com/oddlama/autokernel/blob/main/examples/config.toml)).\nHere you can configure which script is used to generate the kernel configuration and how the artifacts\nshould be installed to your system when using `autokernel build --install`.\n\n```toml\n[config]\n#script = \"/etc/autokernel/legacy.config\"\nscript = \"/etc/autokernel/config.lua\"\n```\n\nNow you can write your kernel configuration. You can either use a classic kconfig file here\n(just change the config above as the comment shows), or use the recommended lua interface.\nThe provided lua API is a more powerful and versatile way to write your configuration.\nWith it you will be able to create more structured, complex and reusable configurations.\nSee [tutorial.lua](examples/tutorial.lua) for an introduction to the api. Here's a very small\nexample `config.lua`:\n\n```lua\n-- Begin with the defconfig for your architecture\nload_kconfig_unchecked(kernel_dir .. \"/arch/x86/configs/x86_64_defconfig\")\n-- Change some symbols\nNET \"y\"\nUSB \"y\"\n```\n\nFinally run autokernel to generate a `.config` file. In case your configuration contains any errors,\nautokernel will abort and print the relevant diagnostics.\n\n```bash\n# Just generate the {kernel_dir}/.config file\n$ autokernel generate-config\n# Or directly build the whole kernel\n$ autokernel build\n```\n\nIf you want to maintain a package for your favourite distribution, feel free to do so and let us know!\n\n## Introduction\n\nTo set a symbol you can use the syntax below.\n\n```lua\n-- This will set `CONFIG_NET` to yes.\nNET \"y\"\n```\n\nYou can also try to assign a value that isn't allowed:\n\n```lua\n-- `CONFIG_NET` is a boolean symbol, so mod isn't allowed.\nNET \"m\"\n```\n\nThe kernel would usually ignore such statements entirely. Autokernel will instead\nabort with an error and display diagnostics telling you that only `n` or `y` are allowed:\n\n![Invalid assignment](https://user-images.githubusercontent.com/31919558/201546052-5c65b680-f722-43f5-b563-80cd6c2ced7f.png)\n\nKernel options can also only be assigned if they are visible, meaning that their\ndependencies must be met. If you try to enable an option that has unmet dependencies,\nautokernel will detect that and automatically suggest a solution.\n\n```lua\n-- This requires WLAN=y and NETDEVICES=y\nWLAN_VENDOR_REALTEK \"y\"\n```\n\n![Automatic dependency resolution](https://user-images.githubusercontent.com/31919558/201546061-9da4cd5f-0fba-46a8-a161-8b583bf3e9e1.png)\n\nInstead of blindly copying these assignments into your config, you can also invoke the solver directly\nfrom lua. This will only work when the solution is unambiguous, otherwise autokernel will\nraise an error and tell you what is missing.\n\n```lua\n-- Enable WLAN_VENDOR_REALTEK and any required dependencies\nWLAN_VENDOR_REALTEK:satisfy { y, recursive = true }\n```\n\nYou can also view what you would have to change without provoking an error in your config first\nby using `autokernel satisfy --recursive WLAN_VENDOR_REALTEK` as a one-shot command.\n\n![One-shot dependency resolution](https://user-images.githubusercontent.com/31919558/201546071-de397f53-d4a7-40d8-b9dc-6ad6f6c5c64a.png)\n\nThere are also some symbols that cannot be set manually, like `RTLWIFI_USB`.\nTrying to assign them directly will cause an error:\n\n```lua\nRTLWIFI_USB \"y\"\n```\n\n![Manual assignment error](https://user-images.githubusercontent.com/31919558/201546077-645e990d-8286-477c-886e-4e1614c88f07.png)\n\nInstead, these need to be enabled by setting another symbol that depends on `RTLWIFI_USB`.\nThe automatic satisfier is able to solve these aswell, so you can use the same command as\nabove to find the required assignments or just use `satisfy` directly from lua again:\n\n```lua\nRTLWIFI_USB:satisfy { y, recursive = true }\n```\n\nFinally you might want to build more complex scripts, which is were lua comes into play.\nIt will allow you to do conditional assignments like this:\n\n```lua\nif kernel_version \u003e= ver(\"5.6\") then\n\tUSB4 \"y\"\nelse\n\tTHUNDERBOLT \"y\"\nend\n```\n\nRefer to [tutorial.lua](examples/tutorial.lua) for a thorough introduction to the api.\n\n## Hardening example\n\nFor an example configuration for kernel hardening, see [hardening.lua](examples/hardening.lua).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foddlama%2Fautokernel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foddlama%2Fautokernel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foddlama%2Fautokernel/lists"}