Last active
December 28, 2025 18:35
-
-
Save arkku/cb7e9b20b913d6c4a38b2a681ae24a92 to your computer and use it in GitHub Desktop.
DKMS makefile for E810 driver intel/ethernet-linux-ice
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Makefile to add the Intel ice driver (E810) as a DKMS module to Debian | |
| # | |
| # Check out the repository https://github.com/intel/ethernet-linux-ice | |
| # into a directory. Put this Makefile into the root of that directory. | |
| # Run `make` as root, which should add the module to DKMS and build it. | |
| # Use `make install` to install, or just `dkms install ice/2.4.5` directly. | |
| # `make clean` to restore the initial state. | |
| # | |
| # When the driver is updated, `git pull` and then just `make` again. It | |
| # should automatically update the version number, as long as the format | |
| # of `src/ice_main.c` remains. | |
| # | |
| # Use and distribute freely at your own risk, absolutely no warranty. | |
| # | |
| # - Kimmo Kulovesi https://github.com/arkku/ | |
| MODULE := ice | |
| VERSION := $(shell awk '/^\s*#define DRV_VERSION\s*"[0-9.]+"/ { gsub(/"/, "", $$3); print $$3; exit 0 }' src/$(MODULE)_main.c) | |
| SRC_DIR := /usr/src/$(MODULE)-$(VERSION) | |
| KERNEL_VERSION := $(shell uname -r) | |
| ARCH := $(shell uname -m) | |
| DKMS_DIR := /var/lib/dkms/$(MODULE)/$(VERSION) | |
| DKMS_ADDED := $(DKMS_DIR)/source | |
| DKMS_BUILT := $(DKMS_DIR)/$(KERNEL_VERSION)/$(ARCH)/module/$(MODULE).ko.xz | |
| all: $(DKMS_BUILT) | |
| dkms.conf: src/$(MODULE)_main.c Makefile | |
| @echo 'PACKAGE_NAME="$(MODULE)"' > $@ | |
| @echo 'PACKAGE_VERSION="$(VERSION)"' >> $@ | |
| @echo 'BUILT_MODULE_NAME[0]="$(MODULE)"' >> $@ | |
| @echo 'BUILT_MODULE_LOCATION[0]="src/"' >> $@ | |
| @echo "MAKE[0]=\"'make' -j\$$(nproc) -C src/\"" >> $@ | |
| @echo 'CLEAN="make -C src/ clean"' >> $@ | |
| @echo 'DEST_MODULE_LOCATION[0]="/kernel/drivers/net/ethernet/intel/$(MODULE)/"' >> $@ | |
| @echo 'AUTOINSTALL="yes"' >> $@ | |
| $(SRC_DIR): dkms.conf $(wildcard src/*) | |
| mkdir -p $@ | |
| rsync -a --exclude='.git' --exclude='*.o' --exclude='*.ko' ./ $@/ | |
| @touch $@ | |
| $(DKMS_ADDED): $(SRC_DIR) | |
| -dkms add -m $(MODULE) -v $(VERSION) | |
| $(DKMS_BUILT): $(DKMS_ADDED) | |
| dkms build -m $(MODULE) -v $(VERSION) -k $(KERNEL_VERSION) --force | |
| build: $(DKMS_BUILT) | |
| add: $(DKMS_ADDED) | |
| install: $(DKMS_BUILT) | |
| dkms install -m $(MODULE) -v $(VERSION) | |
| clean: uninstall | |
| -rm -rf $(SRC_DIR) | |
| uninstall: | |
| -dkms uninstall -m $(MODULE) -v $(VERSION) | |
| -dkms remove -m $(MODULE) -v $(VERSION) --all | |
| .PHONY: all add install clean uninstall build |
Author
Author
The Makefile creates a dkms.conf like:
PACKAGE_NAME="ice"
PACKAGE_VERSION="2.4.5"
BUILT_MODULE_NAME[0]="ice"
BUILT_MODULE_LOCATION[0]="src/"
MAKE[0]="'make' -j$(nproc) -C src/"
CLEAN="make -C src/ clean"
DEST_MODULE_LOCATION[0]="/kernel/drivers/net/ethernet/intel/ice/"
AUTOINSTALL="yes"
The version number is extracted from the sources automatically.
Author
(BTW, currently the Gist looks wrong in the syntax highlighted version, but copypasting from the raw file works.)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Tested with version 2.4.5, the most recent one at the time of writing in intel/ethernet-linux-ice: