config/drivers.conf: which drivers are compiled in
y or n per optional driver (virtio-gpu, stdvga, e1000, rtl8139, native r8169, AC'97, AHCI, NVMe), all y except the native r8169, overridable with make DRV_X=n. Only drivers nothing else calls can be optional; the registry #ifdefs them and the Makefile leaves their objects out. Built with every one off (links, none of their symbols present), with r8169 on, and by default. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EVRhxi9zpdW2uDUN4FVcao
This commit is contained in:
parent
f94d19ae47
commit
1334f446cc
6 changed files with 139 additions and 16 deletions
|
|
@ -61,6 +61,10 @@ ours.
|
|||
|
||||
2. Declare it in `kernel/drivers/registry.c` and add it to the array.
|
||||
3. Add the object to `KERN_DRIVERS` in the `Makefile`.
|
||||
3½. If nothing else in the kernel calls it, make it optional: a `DRV_<NAME>` line in
|
||||
`config/drivers.conf`, the name in `DRV_LIST` in the Makefile, the object behind
|
||||
`$(filter y,$(DRV_<NAME>))`, and an `#ifdef CONFIG_DRV_<NAME>` around its line in `registry.c`.
|
||||
A driver other code calls (`vga_fb`, the USB stack) cannot be optional.
|
||||
4. Fill in the **class vtable** for what it is, and point `.ops` at it. That is
|
||||
the whole of what the rest of the kernel sees:
|
||||
|
||||
|
|
@ -113,7 +117,7 @@ That is data; the logic stays ours.
|
|||
- [ ] One directory under `kernel/drivers/<class>/<name>/`
|
||||
- [ ] Exports a `struct pci_driver` or `struct usb_driver`
|
||||
- [ ] Declared in `kernel/drivers/registry.c` **and** added to its array
|
||||
- [ ] Object added to `KERN_DRIVERS` in the `Makefile`
|
||||
- [ ] Object added to `KERN_DRIVERS` in the `Makefile`, and an option in `config/drivers.conf` if it can be left out
|
||||
- [ ] Class vtable filled in and `.ops` pointed at it
|
||||
- [ ] `.attached` implemented if it can drive more than one card
|
||||
- [ ] `devclass` set, if it is a USB driver
|
||||
|
|
|
|||
|
|
@ -17,6 +17,9 @@ hundred megabytes, kept in `dist/`) and compiles Xorg's dependencies not at all:
|
|||
packages are Alpine's binaries, pinned in `ports/alpine/world.lock`. See
|
||||
[packages](../architecture/packages.md).
|
||||
|
||||
Which drivers go into the kernel is `config/drivers.conf` (all of the optional ones by default);
|
||||
`make DRV_E1000=n` leaves one out for a build. See [devices](../architecture/devices.md).
|
||||
|
||||
## Prerequisites
|
||||
|
||||
| Need | Why | Windows | Linux | macOS | BSD |
|
||||
|
|
|
|||
Loading…
Reference in a new issue