2010-06-15 20:49:11 +00:00
|
|
|
NAME := kernel
|
2011-09-08 10:45:29 +00:00
|
|
|
SPECFILE := kernel.spec
|
2010-06-15 20:49:11 +00:00
|
|
|
|
|
|
|
|
2011-11-09 11:37:55 +00:00
|
|
|
WORKDIR := $(shell pwd)
|
|
|
|
SPECDIR ?= $(WORKDIR)
|
|
|
|
SRCRPMDIR ?= $(WORKDIR)/srpm
|
|
|
|
BUILDDIR ?= $(WORKDIR)
|
|
|
|
RPMDIR ?= $(WORKDIR)/rpm
|
|
|
|
SOURCEDIR := $(WORKDIR)
|
|
|
|
|
|
|
|
NO_OF_CPUS := $(shell grep -c ^processor /proc/cpuinfo)
|
|
|
|
|
2012-11-08 00:59:04 +00:00
|
|
|
BUILD_FLAVOR := pvops
|
2011-11-09 11:37:55 +00:00
|
|
|
|
|
|
|
RPM_DEFINES := --define "_sourcedir $(SOURCEDIR)" \
|
|
|
|
--define "_specdir $(SPECDIR)" \
|
|
|
|
--define "_builddir $(BUILDDIR)" \
|
|
|
|
--define "_srcrpmdir $(SRCRPMDIR)" \
|
|
|
|
--define "_rpmdir $(RPMDIR)" \
|
2013-03-19 15:41:05 +00:00
|
|
|
--define "build_flavor $(BUILD_FLAVOR)"
|
2011-11-09 11:37:55 +00:00
|
|
|
|
|
|
|
ifndef NAME
|
|
|
|
$(error "You can not run this Makefile without having NAME defined")
|
|
|
|
endif
|
|
|
|
ifndef VERSION
|
2018-11-18 15:08:35 +00:00
|
|
|
VERSION := $(shell cat version)
|
2011-11-09 11:37:55 +00:00
|
|
|
endif
|
|
|
|
ifndef RELEASE
|
2018-11-18 15:08:35 +00:00
|
|
|
RELEASE := $(shell cat rel)
|
2011-11-09 11:37:55 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
all: help
|
|
|
|
|
2017-04-14 09:04:40 +00:00
|
|
|
MIRROR := cdn.kernel.org
|
2018-04-12 19:25:40 +00:00
|
|
|
ifeq (,$(DISTFILES_MIRROR))
|
2017-04-18 14:43:39 +00:00
|
|
|
SRC_BASEURL := https://${MIRROR}/pub/linux/kernel/v$(shell echo $(VERSION) | sed 's/^\(2\.[0-9]*\).*/\1/;s/^3\..*/3.x/;s/^4\..*/4.x/')
|
2018-04-12 19:25:40 +00:00
|
|
|
else
|
|
|
|
SRC_BASEURL := $(DISTFILES_MIRROR)
|
|
|
|
endif
|
|
|
|
|
2014-02-02 02:20:06 +00:00
|
|
|
SRC_FILE := linux-${VERSION}.tar.xz
|
2012-02-13 00:56:55 +00:00
|
|
|
ifeq ($(BUILD_FLAVOR),pvops)
|
|
|
|
SIGN_FILE := linux-${VERSION}.tar.sign
|
|
|
|
else
|
2011-11-09 11:37:55 +00:00
|
|
|
SIGN_FILE := linux-${VERSION}.tar.bz2.sign
|
2012-02-13 00:56:55 +00:00
|
|
|
endif
|
2012-02-24 16:50:43 +00:00
|
|
|
HASH_FILE :=${SRC_FILE}.sha1sum
|
2011-11-09 11:37:55 +00:00
|
|
|
|
|
|
|
URL := $(SRC_BASEURL)/$(SRC_FILE)
|
|
|
|
URL_SIGN := $(SRC_BASEURL)/$(SIGN_FILE)
|
|
|
|
|
2012-11-07 17:36:00 +00:00
|
|
|
get-sources: $(SRC_FILE) $(SIGN_FILE)
|
2011-11-09 11:37:55 +00:00
|
|
|
|
|
|
|
$(SRC_FILE):
|
2012-10-08 22:26:33 +00:00
|
|
|
@wget -q -N $(URL)
|
2012-11-07 17:36:00 +00:00
|
|
|
|
|
|
|
$(SIGN_FILE):
|
2012-10-08 22:26:33 +00:00
|
|
|
@wget -q -N $(URL_SIGN)
|
2011-11-09 11:37:55 +00:00
|
|
|
|
2012-02-24 16:50:43 +00:00
|
|
|
import-keys:
|
2015-04-17 15:32:39 +00:00
|
|
|
@if [ -n "$$GNUPGHOME" ]; then rm -f "$$GNUPGHOME/linux-kernel-trustedkeys.gpg"; fi
|
|
|
|
@gpg --no-auto-check-trustdb --no-default-keyring --keyring linux-kernel-trustedkeys.gpg -q --import *-key.asc
|
2012-02-24 16:50:43 +00:00
|
|
|
|
|
|
|
verify-sources: import-keys
|
2012-02-13 00:56:55 +00:00
|
|
|
ifeq ($(BUILD_FLAVOR),pvops)
|
2015-04-17 15:32:39 +00:00
|
|
|
@xzcat $(SRC_FILE) | gpgv --keyring linux-kernel-trustedkeys.gpg $(SIGN_FILE) - 2>/dev/null
|
2012-02-13 00:56:55 +00:00
|
|
|
else
|
2012-02-24 16:50:43 +00:00
|
|
|
# @gpg --verify $(SIGN_FILE) $(SRC_FILE)
|
|
|
|
# The key has been compromised
|
|
|
|
# and kernel.org decided not to release signature
|
|
|
|
# with a new key... oh, well...
|
2012-11-14 10:40:59 +00:00
|
|
|
sha1sum --quiet -c ${HASH_FILE}
|
2012-09-27 01:08:59 +00:00
|
|
|
endif
|
2011-11-09 11:37:55 +00:00
|
|
|
|
|
|
|
.PHONY: clean-sources
|
|
|
|
clean-sources:
|
|
|
|
ifneq ($(SRC_FILE), None)
|
|
|
|
-rm $(SRC_FILE)
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
#RPM := rpmbuild --buildroot=/dev/shm/buildroot/
|
|
|
|
RPM := rpmbuild
|
|
|
|
|
|
|
|
RPM_WITH_DIRS = $(RPM) $(RPM_DEFINES)
|
|
|
|
|
2012-11-14 00:41:51 +00:00
|
|
|
rpms: rpms-dom0
|
|
|
|
|
|
|
|
rpms-vm:
|
|
|
|
|
|
|
|
rpms-dom0: get-sources $(SPECFILE)
|
2011-11-09 11:37:55 +00:00
|
|
|
$(RPM_WITH_DIRS) -bb $(SPECFILE)
|
|
|
|
rpm --addsign $(RPMDIR)/x86_64/*$(VERSION)-$(RELEASE)*.rpm
|
|
|
|
|
|
|
|
rpms-nobuild:
|
|
|
|
$(RPM_WITH_DIRS) --nobuild -bb $(SPECFILE)
|
|
|
|
|
|
|
|
rpms-just-build:
|
|
|
|
$(RPM_WITH_DIRS) --short-circuit -bc $(SPECFILE)
|
|
|
|
|
|
|
|
rpms-install:
|
|
|
|
$(RPM_WITH_DIRS) -bi $(SPECFILE)
|
|
|
|
|
|
|
|
prep: get-sources $(SPECFILE)
|
|
|
|
$(RPM_WITH_DIRS) -bp $(SPECFILE)
|
|
|
|
|
|
|
|
srpm: get-sources $(SPECFILE)
|
|
|
|
$(RPM_WITH_DIRS) -bs $(SPECFILE)
|
|
|
|
|
|
|
|
verrel:
|
|
|
|
@echo $(NAME)-$(VERSION)-$(RELEASE)
|
|
|
|
|
|
|
|
# mop up, printing out exactly what was mopped.
|
|
|
|
|
|
|
|
.PHONY : clean
|
|
|
|
clean ::
|
|
|
|
@echo "Running the %clean script of the rpmbuild..."
|
|
|
|
$(RPM_WITH_DIRS) --clean --nodeps $(SPECFILE)
|
|
|
|
|
|
|
|
help:
|
|
|
|
@echo "Usage: make <target>"
|
|
|
|
@echo
|
|
|
|
@echo "get-sources Download kernel sources from kernel.org"
|
|
|
|
@echo "verify-sources"
|
|
|
|
@echo
|
|
|
|
@echo "prep Just do the prep"
|
|
|
|
@echo "rpms Build rpms"
|
|
|
|
@echo "rpms-nobuild Skip the build stage (for testing)"
|
|
|
|
@echo "rpms-just-build Skip packaging (just test compilation)"
|
|
|
|
@echo "srpm Create an srpm"
|
|
|
|
@echo
|
|
|
|
@echo "make update-repo-current -- copy newly generated rpms to qubes yum repo"
|
|
|
|
@echo "make update-repo-current-testing -- same, but to -current-testing"
|
|
|
|
@echo "make update-repo-unstable -- same, but to -unstable repo"
|