mirror of
https://github.com/aljazceru/kata-containers.git
synced 2026-02-23 15:34:28 +01:00
packages: Add spec files and update scripts
This commit adds the necessary spec files and scripts in order to be able to create packages in OBS (Open Build System) and locally. Fixes #15 Signed-off-by: Erick Cardona <erick.cardona.ruiz@intel.com> Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
This commit is contained in:
committed by
Jose Carlos Venegas Munoz
parent
ec6628ef6b
commit
235276fbff
25
kernel/Makefile.dist.install
Normal file
25
kernel/Makefile.dist.install
Normal file
@@ -0,0 +1,25 @@
|
||||
#
|
||||
# Copyright (c) 2018 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
# Installation variables
|
||||
DESTDIR :=
|
||||
DEFAULTSDIR := /usr/share/
|
||||
PROJECT_DIR := Kata-containers
|
||||
VMLINUX := @VMLINUX@
|
||||
VMLINUZ := @VMLINUZ@
|
||||
|
||||
DESTSYSCONFDIR := $(abspath $(DESTDIR)/$(DEFAULTSDIR)/$(PROJECT_DIR))
|
||||
|
||||
|
||||
VMLINUX_DEST := $(abspath $(DESTSYSCONFDIR)/$(VMLINUX))
|
||||
VMLINUZ_DEST := $(abspath $(DESTSYSCONFDIR)/$(VMLINUZ))
|
||||
|
||||
|
||||
install:
|
||||
install -D --owner root --group root --mode 0644 $(VMLINUX) $(VMLINUX_DEST)
|
||||
install -D --owner root --group root --mode 0644 $(VMLINUZ) $(VMLINUZ_DEST)
|
||||
ln -sf $(VMLINUX_DEST) $(DESTSYSCONFDIR)/vmlinuz.container
|
||||
ln -sf $(VMLINUZ_DEST) $(DESTSYSCONFDIR)/vmlinux.container
|
||||
13
kernel/_service-template
Normal file
13
kernel/_service-template
Normal file
@@ -0,0 +1,13 @@
|
||||
<!--- XML Structure defined here: https://en.opensuse.org/openSUSE:Build_Service_Concept_SourceService -->
|
||||
<services>
|
||||
<service name="download_url">
|
||||
<param name="protocol">https</param>
|
||||
<param name="host">cdn.kernel.org</param>
|
||||
<param name="path">/pub/linux/kernel/v4.x/linux-@VERSION@.tar.xz</param>
|
||||
</service>
|
||||
<service name="verify_file">
|
||||
<param name="file">_service:download_url:linux-@VERSION@.tar.xz</param>
|
||||
<param name="verifier">sha256</param>
|
||||
<param name="checksum">@KERNEL_SHA256@</param>
|
||||
</service>
|
||||
</services>
|
||||
1
kernel/debian.compat
Normal file
1
kernel/debian.compat
Normal file
@@ -0,0 +1 @@
|
||||
9
|
||||
18
kernel/debian.control-template
Normal file
18
kernel/debian.control-template
Normal file
@@ -0,0 +1,18 @@
|
||||
Source: kata-linux-container
|
||||
Section: devel
|
||||
Priority: optional
|
||||
Maintainer: Kata containers team <https://github.com/kata-containers/>
|
||||
Build-Depends: debhelper (>= 9), cpio, libelf-dev, libnewt-dev, libiberty-dev, rsync, libdw-dev, libpci-dev, pkg-config, flex, bison, libunwind8-dev, openssl, libaudit-dev, bc, python-dev, gawk, autoconf, automake, libtool, libssl-dev
|
||||
Standards-Version: 3.9.6
|
||||
Homepage: https://katacontainers.io
|
||||
|
||||
Package: kata-linux-container
|
||||
Architecture: @deb_arch@
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends},
|
||||
Description: linux kernel optimised for container-like workloads.
|
||||
Linux kernel optimised for container-like workloads
|
||||
|
||||
Package: kata-linux-container-debug
|
||||
Architecture: @deb_arch@
|
||||
Description: Debug components for the kata-linux-container package.
|
||||
This package includes the kernel config and the kernel map.
|
||||
30
kernel/debian.copyright
Normal file
30
kernel/debian.copyright
Normal file
@@ -0,0 +1,30 @@
|
||||
This is the Kata containers prepackaged version of the Linux kernel.
|
||||
Linux was written by Linus Torvalds <Linus.Torvalds@cs.Helsinki.FI>
|
||||
and others.
|
||||
|
||||
This package was put together by the Kata containers team, from
|
||||
sources retrieved from upstream linux git.
|
||||
The sources may be found at most Linux download websites, including
|
||||
https://www.kernel.org/pub/linux/kernel/
|
||||
|
||||
This package is currently maintained by the
|
||||
Kata containers team <https://github.com/kata-containers/
|
||||
|
||||
Linux is copyrighted by Linus Torvalds and others.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 dated June, 1991.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
On your Linux system, the complete text of the GNU General
|
||||
Public License v2 can be found in `/usr/share/common-licenses/GPL-2'.
|
||||
copyright (END)
|
||||
2
kernel/debian.dirs
Normal file
2
kernel/debian.dirs
Normal file
@@ -0,0 +1,2 @@
|
||||
usr/share/Kata-containers
|
||||
|
||||
35
kernel/debian.rules
Executable file
35
kernel/debian.rules
Executable file
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/make -f
|
||||
include /usr/share/dpkg/default.mk
|
||||
KernelDir=debian/kata-linux-container/usr/share/kata-containers
|
||||
DebugDir=debian/kata-linux-container-debug/usr/share/kata-containers
|
||||
KernelVer=${DEB_VERSION_UPSTREAM_REVISION}.container
|
||||
%:
|
||||
dh $@
|
||||
|
||||
override_dh_auto_build:
|
||||
sed -i "s/^EXTRAVERSION.*/EXTRAVERSION = -$$(echo $(KernelVer) | cut -d'-' -f2)/" Makefile
|
||||
cp /usr/src/packages/SOURCES/config .config
|
||||
make -s ARCH=x86_64 oldconfig > /dev/null
|
||||
make -s CONFIG_DEBUG_SECTION_MISMATCH=y ARCH=x86_64 -j4 all
|
||||
|
||||
override_dh_auto_install:
|
||||
|
||||
override_dh_auto_clean:
|
||||
|
||||
override_dh_install:
|
||||
dh_install
|
||||
mkdir -p $(DebugDir)
|
||||
mkdir -p $(KernelDir)
|
||||
install -m 644 .config $(DebugDir)/config-$(KernelVer)
|
||||
install -m 644 System.map $(DebugDir)/System.map-$(KernelVer)
|
||||
cp arch/x86/boot/bzImage $(KernelDir)/vmlinuz-$(KernelVer)
|
||||
chmod 755 $(KernelDir)/vmlinuz-$(KernelVer)
|
||||
ln -sf vmlinuz-$(KernelVer) $(KernelDir)/vmlinuz.container
|
||||
|
||||
cp vmlinux $(KernelDir)/vmlinux-$(KernelVer)
|
||||
chmod 755 $(KernelDir)/vmlinux-$(KernelVer)
|
||||
ln -sf vmlinux-$(KernelVer) $(KernelDir)/vmlinux.container
|
||||
|
||||
override_dh_strip:
|
||||
|
||||
override_dh_shlibdeps:
|
||||
20
kernel/kata-linux-container.dsc-template
Normal file
20
kernel/kata-linux-container.dsc-template
Normal file
@@ -0,0 +1,20 @@
|
||||
Format: 3.0 (quilt)
|
||||
Source: kata-linux-container
|
||||
Version: @VERSION@-@RELEASE@
|
||||
Section: devel
|
||||
Priority: optional
|
||||
Maintainer: Kata containers team <https://github.com/kata-containers/>
|
||||
Build-Depends: debhelper (>= 9), cpio, libelf-dev, libnewt-dev, libiberty-dev, rsync, libdw-dev, libpci-dev, pkg-config, flex, bison, libunwind8-dev, openssl, libaudit-dev, bc, python-dev, gawk, autoconf, automake, libtool, libssl-dev
|
||||
Standards-Version: 3.9.6
|
||||
Homepage: https://katacontainers.io
|
||||
Debtransform-Tar: linux-@VERSION@.tar.xz
|
||||
|
||||
Package: kata-linux-container
|
||||
Architecture: @deb_arch@
|
||||
Description: linux kernel optimised for container-like workloads.
|
||||
Linux kernel optimised for container-like workloads
|
||||
|
||||
Package: kata-linux-container-debug
|
||||
Architecture: @deb_arch@
|
||||
Description: Debug components for the kata-linux-container package.
|
||||
This package includes the kernel config and the kernel map.
|
||||
127
kernel/kata-linux-container.spec-template
Normal file
127
kernel/kata-linux-container.spec-template
Normal file
@@ -0,0 +1,127 @@
|
||||
#
|
||||
# This is a special configuration of the Linux kernel, aimed exclusively
|
||||
# for running inside a container
|
||||
# This specialization allows us to optimize memory footprint and boot time.
|
||||
#
|
||||
|
||||
%define bzimage_arch x86
|
||||
|
||||
Name: kata-linux-container
|
||||
Version: @VERSION@
|
||||
Release: @RELEASE@.<B_CNT>
|
||||
License: GPL-2.0
|
||||
Summary: The Linux kernel optimized for running inside a container
|
||||
Url: http://www.kernel.org/
|
||||
Group: kernel
|
||||
Source0: https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-@VERSION@.tar.xz
|
||||
Source1: config
|
||||
|
||||
%define kversion %{version}-%{release}.container
|
||||
|
||||
BuildRequires: bash >= 2.03
|
||||
BuildRequires: bc
|
||||
BuildRequires: binutils-devel
|
||||
|
||||
%if 0%{?rhel_version}
|
||||
BuildRequires: elfutils-devel
|
||||
%endif
|
||||
|
||||
%if 0%{?suse_version}
|
||||
BuildRequires: libelf-devel
|
||||
%endif
|
||||
|
||||
%if 0%{?fedora} || 0%{?centos_version}
|
||||
BuildRequires: pkgconfig(libelf)
|
||||
%endif
|
||||
|
||||
BuildRequires: make >= 3.78
|
||||
BuildRequires: openssl-devel
|
||||
BuildRequires: flex
|
||||
BuildRequires: bison
|
||||
|
||||
# don't strip .ko files!
|
||||
%global __os_install_post %{nil}
|
||||
%define debug_package %{nil}
|
||||
%define __strip /bin/true
|
||||
|
||||
# Patches
|
||||
@RPM_PATCH_LIST@
|
||||
|
||||
%description
|
||||
The Linux kernel.
|
||||
|
||||
%package debug
|
||||
Summary: Debug components for the kata-linux-container package.
|
||||
Group: Default
|
||||
|
||||
%description debug
|
||||
Debug components for the kata-linux-container package.
|
||||
This package includes the kernel config and the kernel map.
|
||||
|
||||
%prep
|
||||
%setup -q -n linux-@VERSION@
|
||||
|
||||
# Patches
|
||||
@RPM_APPLY_PATCHES@
|
||||
|
||||
cp %{SOURCE1} .
|
||||
|
||||
%build
|
||||
BuildKernel() {
|
||||
|
||||
Arch=%{_arch}
|
||||
ExtraVer="-%{release}.container"
|
||||
|
||||
perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = ${ExtraVer}/" Makefile
|
||||
|
||||
make -s mrproper
|
||||
cp config .config
|
||||
|
||||
make -s ARCH=$Arch oldconfig > /dev/null
|
||||
make -s CONFIG_DEBUG_SECTION_MISMATCH=y %{?_smp_mflags} ARCH=$Arch %{?sparse_mflags} || exit 1
|
||||
}
|
||||
|
||||
BuildKernel
|
||||
|
||||
%install
|
||||
|
||||
InstallKernel() {
|
||||
KernelImage=$1
|
||||
KernelImageRaw=$2
|
||||
|
||||
Arch=%{_arch}
|
||||
KernelVer=%{kversion}
|
||||
KernelDir=%{buildroot}/usr/share/kata-containers
|
||||
|
||||
mkdir -p ${KernelDir}
|
||||
|
||||
cp $KernelImage ${KernelDir}/vmlinuz-$KernelVer
|
||||
chmod 755 ${KernelDir}/vmlinuz-$KernelVer
|
||||
ln -sf vmlinuz-$KernelVer ${KernelDir}/vmlinuz.container
|
||||
|
||||
cp $KernelImageRaw ${KernelDir}/vmlinux-$KernelVer
|
||||
chmod 755 ${KernelDir}/vmlinux-$KernelVer
|
||||
ln -sf vmlinux-$KernelVer ${KernelDir}/vmlinux.container
|
||||
|
||||
cp .config "${KernelDir}/config-${KernelVer}"
|
||||
cp System.map "${KernelDir}/System.map-${KernelVer}"
|
||||
|
||||
rm -f %{buildroot}/usr/lib/modules/$KernelVer/build
|
||||
rm -f %{buildroot}/usr/lib/modules/$KernelVer/source
|
||||
}
|
||||
|
||||
InstallKernel arch/%{bzimage_arch}/boot/bzImage vmlinux
|
||||
|
||||
rm -rf %{buildroot}/usr/lib/firmware
|
||||
|
||||
%files
|
||||
%dir /usr/share/kata-containers
|
||||
/usr/share/kata-containers/vmlinux-%{kversion}
|
||||
/usr/share/kata-containers/vmlinux.container
|
||||
/usr/share/kata-containers/vmlinuz-%{kversion}
|
||||
/usr/share/kata-containers/vmlinuz.container
|
||||
|
||||
%files debug
|
||||
%defattr(-,root,root,-)
|
||||
/usr/share/kata-containers/config-%{kversion}
|
||||
/usr/share/kata-containers/System.map-%{kversion}
|
||||
58
kernel/update.sh
Executable file
58
kernel/update.sh
Executable file
@@ -0,0 +1,58 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (c) 2018 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
# Automation script to create specs to build Kata containers kernel
|
||||
set -e
|
||||
|
||||
source ../versions.txt
|
||||
source ../scripts/pkglib.sh
|
||||
|
||||
SCRIPT_NAME=$0
|
||||
SCRIPT_DIR=$(dirname $0)
|
||||
|
||||
PKG_NAME="kata-linux-container"
|
||||
VERSION=$kernel_version
|
||||
|
||||
KR_SERIES="$(echo $VERSION | cut -d "." -f 1).x"
|
||||
KR_LTS=$(echo $VERSION | cut -d "." -f 1,2)
|
||||
KR_PATCHES=$(eval find "patches" -type f -name "*.patch")
|
||||
|
||||
KR_REL=https://www.kernel.org/releases.json
|
||||
KR_SHA=https://cdn.kernel.org/pub/linux/kernel/v"${KR_SERIES}"/sha256sums.asc
|
||||
|
||||
GENERATED_FILES=(kata-linux-container.dsc kata-linux-container.spec _service config debian.control debian.series)
|
||||
STATIC_FILES=(debian.dirs debian.rules debian.compat debian.copyright)
|
||||
#STATIC_FILES+=($KR_PATCHES)
|
||||
|
||||
# Parse arguments
|
||||
cli "$@"
|
||||
|
||||
[ "$VERBOSE" == "true" ] && set -x
|
||||
PROJECT_REPO=${PROJECT_REPO:-home:${OBS_PROJECT}:${OBS_SUBPROJECT}/linux-container}
|
||||
RELEASE=$(get_obs_pkg_release "${PROJECT_REPO}")
|
||||
((RELEASE++))
|
||||
|
||||
kernel_sha256=$(curl -L -s -f ${KR_SHA} | awk '/linux-'${VERSION}'.tar.xz/ {print $1}')
|
||||
|
||||
# Generate the kernel config file
|
||||
cp "configs/x86_kata_kvm_${KR_LTS}.x" config
|
||||
|
||||
replace_list=(
|
||||
"VERSION=$VERSION"
|
||||
"RELEASE=$RELEASE"
|
||||
"KERNEL_SHA256=$kernel_sha256"
|
||||
)
|
||||
|
||||
verify
|
||||
echo "Verify succeed."
|
||||
get_git_info
|
||||
changelog_update $VERSION
|
||||
generate_files "$SCRIPT_DIR" "${replace_list[@]}"
|
||||
build_pkg "${PROJECT_REPO}"
|
||||
Reference in New Issue
Block a user