Add support for build pvops kernel using kernel.spec
This commit is contained in:
parent
dea2375213
commit
90d2b31bbf
2
Makefile
2
Makefile
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
NAME := kernel
|
NAME := kernel
|
||||||
SPECFILE := kernel-xenlinux.spec
|
SPECFILE := kernel.spec
|
||||||
|
|
||||||
|
|
||||||
include Makefile.common
|
include Makefile.common
|
||||||
|
@ -8,16 +8,19 @@ SRCRPMDIR ?= $(WORKDIR)/srpm
|
|||||||
BUILDDIR ?= $(WORKDIR)
|
BUILDDIR ?= $(WORKDIR)
|
||||||
RPMDIR ?= $(WORKDIR)/rpm
|
RPMDIR ?= $(WORKDIR)/rpm
|
||||||
SOURCEDIR := $(WORKDIR)
|
SOURCEDIR := $(WORKDIR)
|
||||||
VERSION := $(shell cat version)
|
|
||||||
|
|
||||||
NO_OF_CPUS := $(shell grep -c ^processor /proc/cpuinfo)
|
NO_OF_CPUS := $(shell grep -c ^processor /proc/cpuinfo)
|
||||||
|
|
||||||
|
ifndef BUILD_FLAVOR
|
||||||
|
$(error "Add BUILD_FLAVOR=pvops or BUILD_FLAVOR=xenlinux to make cmdline")
|
||||||
|
endif
|
||||||
|
|
||||||
RPM_DEFINES := --define "_sourcedir $(SOURCEDIR)" \
|
RPM_DEFINES := --define "_sourcedir $(SOURCEDIR)" \
|
||||||
--define "_specdir $(SPECDIR)" \
|
--define "_specdir $(SPECDIR)" \
|
||||||
--define "_builddir $(BUILDDIR)" \
|
--define "_builddir $(BUILDDIR)" \
|
||||||
--define "_srcrpmdir $(SRCRPMDIR)" \
|
--define "_srcrpmdir $(SRCRPMDIR)" \
|
||||||
--define "_rpmdir $(RPMDIR)" \
|
--define "_rpmdir $(RPMDIR)" \
|
||||||
--define "version $(VERSION)" \
|
--define "build_flavor $(BUILD_FLAVOR)" \
|
||||||
--define "jobs $(NO_OF_CPUS)"
|
--define "jobs $(NO_OF_CPUS)"
|
||||||
|
|
||||||
VER_REL := $(shell rpm $(RPM_DEFINES) -q --qf "%{VERSION} %{RELEASE}\n" --specfile $(SPECFILE)| head -1)
|
VER_REL := $(shell rpm $(RPM_DEFINES) -q --qf "%{VERSION} %{RELEASE}\n" --specfile $(SPECFILE)| head -1)
|
||||||
@ -26,7 +29,7 @@ ifndef NAME
|
|||||||
$(error "You can not run this Makefile without having NAME defined")
|
$(error "You can not run this Makefile without having NAME defined")
|
||||||
endif
|
endif
|
||||||
ifndef VERSION
|
ifndef VERSION
|
||||||
$(error "You can not run this Makefile without having VERSION defined")
|
VERSION := $(word 1, $(VER_REL))
|
||||||
endif
|
endif
|
||||||
ifndef RELEASE
|
ifndef RELEASE
|
||||||
RELEASE := $(word 2, $(VER_REL))
|
RELEASE := $(word 2, $(VER_REL))
|
||||||
@ -34,7 +37,7 @@ endif
|
|||||||
|
|
||||||
all: help
|
all: help
|
||||||
|
|
||||||
SRC_BASEURL := http://www.kernel.org/pub/linux/kernel/v2.6/
|
SRC_BASEURL := http://www.kernel.org/pub/linux/kernel/v$(shell echo $(VERSION) | sed 's/^\([0-9]*\.[0-9]*\).*/\1/')
|
||||||
SRC_FILE := linux-${VERSION}.tar.bz2
|
SRC_FILE := linux-${VERSION}.tar.bz2
|
||||||
SIGN_FILE := linux-${VERSION}.tar.bz2.sign
|
SIGN_FILE := linux-${VERSION}.tar.bz2.sign
|
||||||
|
|
||||||
|
31
kernel.spec
31
kernel.spec
@ -3,11 +3,11 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
#%define _unpackaged_files_terminate_build 0
|
#%define _unpackaged_files_terminate_build 0
|
||||||
%define variant xenlinux.qubes
|
%define variant %{build_flavor}.qubes
|
||||||
%define rel %(cat rel).%{variant}
|
%define rel %(cat rel-%{build_flavor}).%{variant}
|
||||||
|
%define version %(cat version-%{build_flavor})
|
||||||
|
|
||||||
%define _buildshell /bin/bash
|
%define _buildshell /bin/bash
|
||||||
%define build_flavor xenlinux
|
|
||||||
%define build_xen 1
|
%define build_xen 1
|
||||||
|
|
||||||
%global cpu_arch x86_64
|
%global cpu_arch x86_64
|
||||||
@ -57,7 +57,7 @@ Provides: kernel = %kernelrelease
|
|||||||
Provides: kernel-uname-r = %kernelrelease
|
Provides: kernel-uname-r = %kernelrelease
|
||||||
|
|
||||||
Source0: linux-%version.tar.bz2
|
Source0: linux-%version.tar.bz2
|
||||||
Source14: series.conf
|
Source14: series-%{build_flavor}.conf
|
||||||
Source16: guards
|
Source16: guards
|
||||||
Source17: apply-patches
|
Source17: apply-patches
|
||||||
Source33: check-for-config-changes
|
Source33: check-for-config-changes
|
||||||
@ -86,7 +86,7 @@ if ! [ -e %_sourcedir/linux-%version.tar.bz2 ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
SYMBOLS="xen-dom0 xenlinux"
|
SYMBOLS="xen-dom0 %{build_flavor}"
|
||||||
|
|
||||||
# Unpack all sources and patches
|
# Unpack all sources and patches
|
||||||
%setup -q -c -T -a 0
|
%setup -q -c -T -a 0
|
||||||
@ -95,7 +95,7 @@ mkdir -p %kernel_build_dir
|
|||||||
|
|
||||||
cd linux-%version
|
cd linux-%version
|
||||||
|
|
||||||
%_sourcedir/apply-patches %_sourcedir/series.conf %_sourcedir $SYMBOLS
|
%_sourcedir/apply-patches %_sourcedir/series-%{build_flavor}.conf %_sourcedir $SYMBOLS
|
||||||
|
|
||||||
cd %kernel_build_dir
|
cd %kernel_build_dir
|
||||||
|
|
||||||
@ -158,7 +158,11 @@ cd %kernel_build_dir
|
|||||||
|
|
||||||
mkdir -p %buildroot/boot
|
mkdir -p %buildroot/boot
|
||||||
cp -p System.map %buildroot/boot/System.map-%kernelrelease
|
cp -p System.map %buildroot/boot/System.map-%kernelrelease
|
||||||
|
if [ "%{build_flavor}" == "xenlinux" ]; then
|
||||||
cp -p arch/x86/boot/vmlinuz %buildroot/boot/vmlinuz-%kernelrelease
|
cp -p arch/x86/boot/vmlinuz %buildroot/boot/vmlinuz-%kernelrelease
|
||||||
|
else
|
||||||
|
cp -p arch/x86/boot/bzImage %buildroot/boot/vmlinuz-%kernelrelease
|
||||||
|
fi
|
||||||
cp .config %buildroot/boot/config-%kernelrelease
|
cp .config %buildroot/boot/config-%kernelrelease
|
||||||
|
|
||||||
%if %install_vdso
|
%if %install_vdso
|
||||||
@ -192,7 +196,9 @@ pushd %build_src_dir
|
|||||||
cp --parents `find -type f -name "Makefile*" -o -name "Kconfig*"` %buildroot/lib/modules/%kernelrelease/build
|
cp --parents `find -type f -name "Makefile*" -o -name "Kconfig*"` %buildroot/lib/modules/%kernelrelease/build
|
||||||
cp -a scripts %buildroot/lib/modules/%kernelrelease/build
|
cp -a scripts %buildroot/lib/modules/%kernelrelease/build
|
||||||
cp -a --parents arch/x86/include/asm %buildroot/lib/modules/%kernelrelease/build/
|
cp -a --parents arch/x86/include/asm %buildroot/lib/modules/%kernelrelease/build/
|
||||||
|
if [ "%{build_flavor}" == "xenlinux" ]; then
|
||||||
cp -a --parents arch/x86/include/mach-xen %buildroot/lib/modules/%kernelrelease/build/
|
cp -a --parents arch/x86/include/mach-xen %buildroot/lib/modules/%kernelrelease/build/
|
||||||
|
fi
|
||||||
cp -a include %buildroot/lib/modules/%kernelrelease/build/include
|
cp -a include %buildroot/lib/modules/%kernelrelease/build/include
|
||||||
popd
|
popd
|
||||||
|
|
||||||
@ -271,7 +277,7 @@ rm -f modinfo modnames
|
|||||||
|
|
||||||
# Move the devel headers out of the root file system
|
# Move the devel headers out of the root file system
|
||||||
mkdir -p %buildroot/usr/src/kernels
|
mkdir -p %buildroot/usr/src/kernels
|
||||||
mv %buildroot/lib/modules/%kernelrelease/build/* %buildroot/%src_install_dir
|
mv %buildroot/lib/modules/%kernelrelease/build/* %buildroot/%src_install_dir/
|
||||||
mv %buildroot/lib/modules/%kernelrelease/build/.config %buildroot/%src_install_dir
|
mv %buildroot/lib/modules/%kernelrelease/build/.config %buildroot/%src_install_dir
|
||||||
rmdir %buildroot/lib/modules/%kernelrelease/build
|
rmdir %buildroot/lib/modules/%kernelrelease/build
|
||||||
ln -sf %src_install_dir %buildroot/lib/modules/%kernelrelease/build
|
ln -sf %src_install_dir %buildroot/lib/modules/%kernelrelease/build
|
||||||
@ -284,15 +290,24 @@ if [ $? -ne 0 ] || echo "$msg" | grep 'needs unknown symbol'; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "%{build_flavor}" == "pvops" ]; then
|
||||||
|
mv %buildroot/lib/firmware %buildroot/lib/firmware-all
|
||||||
|
mkdir -p %buildroot/lib/firmware
|
||||||
|
mv %buildroot/lib/firmware-all %buildroot/lib/firmware/%kernelrelease
|
||||||
|
fi
|
||||||
# Prepare initramfs for Qubes VM
|
# Prepare initramfs for Qubes VM
|
||||||
mkdir -p %buildroot/%vm_install_dir
|
mkdir -p %buildroot/%vm_install_dir
|
||||||
/sbin/dracut --nomdadmconf --nolvmconf \
|
/sbin/dracut --nomdadmconf --nolvmconf \
|
||||||
--kmoddir %buildroot/lib/modules/%kernelrelease \
|
--kmoddir %buildroot/lib/modules/%kernelrelease \
|
||||||
--include %_sourcedir/vm-initramfs / \
|
--include %_sourcedir/vm-initramfs / \
|
||||||
-d "xenblk cdrom ext4 jbd2 crc16 dm_snapshot" \
|
-d "xenblk xen-blkfront cdrom ext4 jbd2 crc16 dm_snapshot" \
|
||||||
%buildroot/%vm_install_dir/initramfs %kernelrelease
|
%buildroot/%vm_install_dir/initramfs %kernelrelease
|
||||||
|
|
||||||
|
if [ "%{build_flavor}" == "xenlinux" ]; then
|
||||||
cp -p arch/x86/boot/vmlinuz %buildroot/%vm_install_dir/vmlinuz
|
cp -p arch/x86/boot/vmlinuz %buildroot/%vm_install_dir/vmlinuz
|
||||||
|
else
|
||||||
|
cp -p arch/x86/boot/bzImage %buildroot/%vm_install_dir/vmlinuz
|
||||||
|
fi
|
||||||
|
|
||||||
# Modules for Qubes VM
|
# Modules for Qubes VM
|
||||||
mkdir -p %buildroot%vm_install_dir/modules
|
mkdir -p %buildroot%vm_install_dir/modules
|
||||||
|
Loading…
Reference in New Issue
Block a user