2017-10-15 22:36:00 -04:00
|
|
|
|
2023-01-26 15:25:28 -05:00
|
|
|
LINUX_VERSION = 6.1.8
|
2017-10-15 22:36:00 -04:00
|
|
|
|
|
|
|
KERNEL_VERSION = linux-$(LINUX_VERSION)
|
2023-01-26 15:25:28 -05:00
|
|
|
KERNEL_DOWNLOAD = https://cdn.kernel.org/pub/linux/kernel/v6.x/$(KERNEL_VERSION)
|
2017-10-15 22:36:00 -04:00
|
|
|
|
|
|
|
PWD = $(shell pwd)
|
2019-09-20 17:55:12 -04:00
|
|
|
NPROC = $(shell nproc)
|
2017-10-15 22:36:00 -04:00
|
|
|
|
|
|
|
PATCH_FILES := $(shell find patches/ -name "00*.patch" | sort)
|
|
|
|
|
|
|
|
KERNEL_DL_PATH = downloads/$(KERNEL_VERSION).tar
|
2019-09-20 17:55:12 -04:00
|
|
|
KERNEL_BUILD_PATH = $(KERNEL_VERSION)
|
2017-10-15 22:36:00 -04:00
|
|
|
KERNEL_BUILD_OUTPUT = $(KERNEL_BUILD_PATH)/vmlinux
|
|
|
|
|
|
|
|
PH_LINUX = ph_linux
|
2017-10-18 17:06:38 -04:00
|
|
|
PH_LINUX_VER = $(PH_LINUX)-$(LINUX_VERSION)
|
2017-10-15 22:36:00 -04:00
|
|
|
|
|
|
|
SHA256_FILE = v$(KERNEL_VERSION).sha256
|
|
|
|
|
2017-10-18 17:06:38 -04:00
|
|
|
$(shell mkdir -p downloads)
|
2019-09-20 17:55:12 -04:00
|
|
|
$(shell mkdir -p .work)
|
2017-10-18 17:06:38 -04:00
|
|
|
|
2019-09-20 17:55:12 -04:00
|
|
|
SHA256_SENTINEL = .work/.sha256-verififed
|
2017-10-15 22:36:00 -04:00
|
|
|
|
|
|
|
.PHONY: all gen-sha256
|
|
|
|
|
2017-10-18 17:06:38 -04:00
|
|
|
all: $(KERNEL_BUILD_OUTPUT) $(PH_LINUX_VER)
|
2017-10-15 22:36:00 -04:00
|
|
|
|
|
|
|
$(KERNEL_DL_PATH):
|
2019-09-20 19:53:43 -04:00
|
|
|
@echo "Downloading $(KERNEL_DOWNLOAD).tar.xz"
|
|
|
|
@cd downloads; rm -f $(KERNEL_VERSION).tar.xz
|
|
|
|
@cd downloads; wget --quiet $(KERNEL_DOWNLOAD).tar.xz
|
|
|
|
@cd downloads; unxz $(KERNEL_VERSION).tar.xz
|
|
|
|
@cd downloads; wget --quiet $(KERNEL_DOWNLOAD).tar.sign
|
2017-10-15 22:36:00 -04:00
|
|
|
|
2017-10-18 17:06:38 -04:00
|
|
|
|
2019-09-20 17:55:12 -04:00
|
|
|
$(KERNEL_BUILD_PATH): $(KERNEL_DL_PATH) $(SHA256_SENTINEL)
|
|
|
|
rm -rf .work/$(KERNEL_VERSION)
|
|
|
|
tar -C .work -xf downloads/$(KERNEL_VERSION).tar
|
|
|
|
for p in $(PATCH_FILES); do patch -p1 -d .work/$(KERNEL_VERSION) < "$$p"; done
|
|
|
|
cp config .work/$(KERNEL_VERSION)/.config
|
|
|
|
rm -rf ./$(KERNEL_VERSION)
|
|
|
|
mv .work/$(KERNEL_VERSION) .
|
2017-10-15 22:36:00 -04:00
|
|
|
|
2019-09-20 17:55:12 -04:00
|
|
|
$(PH_LINUX_VER): $(KERNEL_BUILD_OUTPUT)
|
|
|
|
rm -f $(PH_LINUX)
|
|
|
|
cp $(KERNEL_BUILD_OUTPUT) $(PH_LINUX_VER)
|
|
|
|
strip $(PH_LINUX_VER)
|
|
|
|
ln -s $(PWD)/$(PH_LINUX_VER) $(PH_LINUX)
|
2017-10-15 22:36:00 -04:00
|
|
|
|
2019-09-20 17:55:12 -04:00
|
|
|
$(KERNEL_BUILD_OUTPUT): $(KERNEL_BUILD_PATH)
|
2023-01-26 15:25:28 -05:00
|
|
|
cd $(KERNEL_VERSION); make -j$(NPROC) vmlinux
|
2017-10-15 22:36:00 -04:00
|
|
|
|
2019-09-20 17:55:12 -04:00
|
|
|
clean:
|
|
|
|
rm -rf $(KERNEL_BUILD_PATH) $(SHA256_SENTINEL) $(PH_LINUX_VER) $(PH_LINUX) .work
|
2017-10-15 22:36:00 -04:00
|
|
|
|
2019-09-20 17:55:12 -04:00
|
|
|
$(SHA256_SENTINEL): $(KERNEL_DL_PATH)
|
|
|
|
sha256sum -c v$(LINUX_VERSION).sha256
|
|
|
|
touch $@
|
2017-10-15 22:36:00 -04:00
|
|
|
|
|
|
|
gen-sha256: $(SHA256_FILE)
|
|
|
|
|
2019-09-20 17:55:12 -04:00
|
|
|
GPGTMP = verify-tmp/
|
|
|
|
GPGOPTS = --homedir $(GPGTMP) --trust-model direct --no-autostart
|
|
|
|
GPG_IMPORT = gpg $(GPGOPTS) --import
|
|
|
|
GPG_VERIFY = gpg $(GPGOPTS) --verify
|
2017-10-15 22:36:00 -04:00
|
|
|
|
|
|
|
$(KERNEL_DL_PATH).verify: $(KERNEL_DL_PATH)
|
|
|
|
rm -rf $(GPGTMP)
|
2019-09-20 17:55:12 -04:00
|
|
|
mkdir -m 0700 $(GPGTMP)
|
2017-10-15 22:36:00 -04:00
|
|
|
$(GPG_IMPORT) < keys/torvalds.key
|
|
|
|
$(GPG_IMPORT) < keys/gregkh.key
|
|
|
|
$(GPG_VERIFY) downloads/$(KERNEL_VERSION).tar.sign $(KERNEL_DL_PATH) 2> .out
|
|
|
|
mv .out $(KERNEL_DL_PATH).verify
|
|
|
|
rm -rf $(GPGTMP)
|
|
|
|
|
2019-09-20 17:55:12 -04:00
|
|
|
$(SHA256_FILE): $(KERNEL_DL_PATH).verify
|
|
|
|
sha256sum $(KERNEL_DL_PATH) > v$(LINUX_VERSION).sha256
|
2017-10-15 22:36:00 -04:00
|
|
|
|