|
1 | 1 | # kman (Linux Kernel Manager) |
2 | 2 |
|
3 | | -kman aims to automate the Linux Kernel installation from source process, allowing for a |
| 3 | +kman aims to automate and unify the Linux Kernel installation from source process, allowing for a |
4 | 4 | repeatable way of installing a Linux kernel, generating a initramfs image and updating |
5 | | -the bootloader configuration, based on the tools and configurations available of your system. |
| 5 | +the bootloader configuration, based on the tools and configurations available of your system, |
| 6 | +offering a sane and powerful way to manage kernels on any Linux distribution. |
6 | 7 |
|
7 | 8 | ## Features |
8 | 9 |
|
9 | | -- [x] No External Library dependencies |
10 | | -- [x] Automated download of Kernel versions |
11 | | -- [x] Cross-distro compatibility |
12 | | -- [ ] Configuration file |
13 | | -- [ ] Incremental updates via patching |
14 | | -- [ ] Support multiple bootloaders configuration |
| 10 | + |
| 11 | +- [x] Minimal external libraries |
| 12 | +- [x] Cross‑distro compatibility |
| 13 | +- [x] Automated download and verification of kernel versions |
| 14 | +- [ ] Accelerated & cached downloads, incremental updates |
| 15 | +- [ ] Embedded tar.gz/tar.xz multi-threaded decompression |
| 16 | +- [ ] Embedded key signature verification |
| 17 | +- [ ] Ephemeral container build environments |
| 18 | +- [ ] Configuration file support |
| 19 | +- [ ] Support for multiple bootloaders |
15 | 20 | - [ ] GNU grub |
16 | 21 | - [ ] systemd-boot |
17 | 22 | - [ ] limine |
18 | 23 | - [ ] rEFInd |
19 | | -- [ ] Support multiple initramfs generators |
| 24 | +- [ ] Support for multiple initramfs generators |
20 | 25 | - [ ] dracut |
21 | 26 | - [ ] mkinitcpio |
22 | 27 | - [ ] initramfs-tools |
23 | 28 | - [ ] booster |
24 | | -- [ ] distcc support for distributed compilation |
25 | | -- [ ] modprobed-db support to reduce compile time |
26 | | -- [ ] Unified kernel image |
27 | | - |
28 | | -## Phases |
29 | | - |
30 | | -Phases follow this order, all of them are optional and |
31 | | -defined either with command flags or with a configuration file. |
32 | | - |
33 | | -TODO: ensure all of this phases are correct and in right order |
34 | | - |
35 | | -- Linux |
36 | | - - list |
37 | | - - download |
38 | | - - verify |
39 | | - - extract |
40 | | - - configure |
41 | | - - patch |
42 | | - - compile |
43 | | - - install |
44 | | -- Initramfs |
45 | | - - generate |
46 | | -- Bootloader |
47 | | - - configure |
48 | | - |
49 | | -### Design Patterns |
50 | | - |
51 | | -It is adopted some level of project maintainability by using some |
52 | | -of the following design patterns: |
53 | | - |
54 | | -- Strategy Pattern: The strategy lets the algorithm vary independently from clients |
55 | | - that use it. Used for handling multiple bootloaders (e.g., GRUB, LILO, systemd-boot) |
56 | | - and multiple initramfs tools (e.g., Dracut, mkinitcpio, booster) depending on the system. |
57 | | -- Pipeline Pattern: Encapsulates each step (downloading, configuring, etc) |
58 | | - into a set of steps (pipeline), allowing for easy execution and management. Ensures commands |
59 | | - are ran in the correct order. |
60 | | -- Builder Pattern: Provides a flexible way to construct and add kernel configuration parameters |
61 | | - step-by-step. |
62 | | -- Facade Pattern: Manages the kernel context and encapsulates the flow of commands into one component. |
| 29 | +- [ ] distcc, ccache, modprobed-db, and unified kernel image support |
| 30 | + |
| 31 | +## Pipeline Steps |
| 32 | + |
| 33 | +Each step in the pipeline can be executed indidually, but requires some parameter/s. |
| 34 | + |
| 35 | +- Download (url) |
| 36 | +- Verify (archive) |
| 37 | +- Extract (archive) |
| 38 | +- Patch (optional: directory) |
| 39 | +- Configure (optional: .config file, directory, njobs) |
| 40 | +- Compile (optional: directory) |
| 41 | +- Install (optional: directory) |
| 42 | +- Initramfs (optional: initramfs) |
| 43 | +- Bootloader (optional: bootloader) |
| 44 | + |
| 45 | +### Architecture |
| 46 | + |
| 47 | +Some level of software architecture is adopted to make the project maintainability and evolution easier, such |
| 48 | +as separation of concerns (e.g. validation of data separated from execution of code) and responsabilities |
| 49 | +by layer (gateway, service, core); the use of design patterns for step dependency resolution |
| 50 | +and interaction with multiple kinds of outside tools. |
| 51 | + |
| 52 | +As a rule of thumb I like to keep my '.go' files as small as possible, have a component |
| 53 | +based design and have as little external dependencies as possible, even in outside layers. |
| 54 | + |
| 55 | +The final program must work as a unified cohesive experience. |
| 56 | + |
| 57 | +#### Layers |
| 58 | + |
| 59 | +- Gateway: UI (CLI/TUI/GUI), I/O, Interaction with 3rd party programs. |
| 60 | +- Service: Execution layer, use cases, orchestration logic. |
| 61 | +- Core: Definition of entities, validation, data structures; Does not depend on anything. |
| 62 | + |
| 63 | +Ideally dependencies should flow inward, in practice this is achieved by extensive use of interfaces. |
| 64 | +Interfaces add overhead and they are not always needed. Usually I will have injection of raw implementation |
| 65 | +(without interface) because of that. |
| 66 | + |
| 67 | +#### Design Patterns |
| 68 | + |
| 69 | +- Strategy Pattern: Used to handle multiple bootloader and initramfs tools. The Service layer |
| 70 | + chooses the right strategy at runtime based on system capabilities and configuration. |
| 71 | +- Pipeline Pattern: Each step (list, download, compile, etc.) is encapsulated as a modular |
| 72 | + component. The Pipeline Manager in the Service layer coordinates step dependencies and execution order. |
| 73 | +- Builder Pattern: A flexible way to assemble the kernel build configuration step-by‑step, |
| 74 | + culminating in a unified kernel build process. |
| 75 | +- Facade Pattern: Provides a simplified interface (a unified kernel context) to coordinate the |
| 76 | + flow of commands across multiple steps. |
0 commit comments