forked from TencentOS/TencentOS-kernel
Merge pull request #304 from ryncsn/tk4/0009-kabi
package: remove TK4 legacy build system
This commit is contained in:
commit
97152118e4
|
|
@ -1,353 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# ==============================================================================
|
||||
# Description: Automaticly generating kernel rpm package with specified branch
|
||||
# according to HEAD tag.
|
||||
#
|
||||
# Author: David Shan <davidshan@tencent.com>
|
||||
# ===============================================================================
|
||||
|
||||
#variables
|
||||
kernel_full_name=""
|
||||
kernel_version=""
|
||||
tlinux_branch=""
|
||||
tlinux_release=""
|
||||
extra_version=""
|
||||
curdir=`pwd`
|
||||
build_specdir="/usr/src/packages/SPECS"
|
||||
build_srcdir="/usr/src/packages/SOURCES"
|
||||
kernel_type="default"
|
||||
spec_file_name=""
|
||||
make_jobs=""
|
||||
nosign_suffix=""
|
||||
build_src_only=0
|
||||
strip_sign_token=0
|
||||
nosign_suffix=""
|
||||
tagged_name=""
|
||||
# to control wheter to build rpm for xen domU
|
||||
isXenU=""
|
||||
build_perf=""
|
||||
kernel_default_types=(default)
|
||||
|
||||
#funcitons
|
||||
usage()
|
||||
{
|
||||
echo "generate-rpms [-t \$tag_name ] [-j \$jobs ][-h]"
|
||||
echo " -t tag_name"
|
||||
echo " Tagged name in the git tree."
|
||||
echo " -j jobs"
|
||||
echo " Specifies the number of jobs (threads) to run make."
|
||||
echo " -p"
|
||||
echo " build perf rpm only."
|
||||
echo " -c"
|
||||
echo " enable kabi check."
|
||||
|
||||
echo -e "\n"
|
||||
echo " Note:By default, we only generate latest tag kernel for standard kernels"
|
||||
echo " without -t"
|
||||
echo " So, if you hope to get certain tag kernel, please use -t."
|
||||
}
|
||||
|
||||
get_kernel_version()
|
||||
{
|
||||
local makefile="$1/Makefile"
|
||||
|
||||
if [ ! -e $makefile ]; then
|
||||
echo "Error: No Makefile found."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
kernel_version+=`grep "^VERSION" ${makefile} | head -1 | awk -F "=" '{print $2}' | tr -d ' '`
|
||||
kernel_version+="."
|
||||
kernel_version+=`grep "^PATCHLEVEL" ${makefile} | head -1 | awk -F "=" '{print $2}' | tr -d ' '`
|
||||
kernel_version+="."
|
||||
kernel_version+=`grep "^SUBLEVEL" ${makefile} | head -1 | awk -F "=" '{print $2}' | tr -d ' '`
|
||||
#kernel_version+=`grep "^EXTRAVERSION" ${makefile} | head -1 | awk -F "=" '{print $2}' | tr -d ' '`
|
||||
|
||||
echo "kernel version: $kernel_version"
|
||||
}
|
||||
|
||||
get_tlinux_name()
|
||||
{
|
||||
if [ -n "$tag_name" ]; then
|
||||
tagged_name="$tag_name"
|
||||
else
|
||||
tagged_name=`git describe --tags`
|
||||
fi
|
||||
|
||||
if [ -z "${tagged_name}" ];then
|
||||
echo "Error:Can't get kernel version from git tree."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
tagged_name=${tagged_name#arm64-}
|
||||
echo "${tagged_name}" | grep 'kvm_guest'
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "start kvm guest build"
|
||||
kvm_guest="yes"
|
||||
fi
|
||||
|
||||
echo "${tagged_name}" | grep 'xen_guest'
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "start xen guest build"
|
||||
xen_guest="yes"
|
||||
fi
|
||||
|
||||
echo "${tagged_name}" | grep 'ec'
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "start ECkernel build"
|
||||
ec="yes"
|
||||
fi
|
||||
|
||||
echo "${tagged_name}" | grep 'kasan'
|
||||
if [ $? -eq 0 ]; then
|
||||
nosign_suffix="_kasan"
|
||||
fi
|
||||
|
||||
|
||||
#if [ "${tagged_name#*-*-*}" != ${tagged_name} ];then
|
||||
#echo "Error: bad tag name:$tagged_name."
|
||||
#exit 1
|
||||
#fi
|
||||
|
||||
if [ "$build_perf" = "yes" ]; then
|
||||
rpm_name="perf"
|
||||
else
|
||||
rpm_name="kernel"
|
||||
fi
|
||||
#tlinux_release=${tagged_name#*-}
|
||||
tlinux_release=`echo $tagged_name|cut -d- -f2`.`echo $tagged_name|cut -d- -f3`
|
||||
extra_version=`echo $tagged_name | cut -d- -f2`
|
||||
kernel_full_name=${rpm_name}-${kernel_version}
|
||||
|
||||
echo "$tlinux_release"
|
||||
echo "$kernel_full_name"
|
||||
echo "extra_version $extra_version"
|
||||
|
||||
}
|
||||
|
||||
prepare_tlinux_spec()
|
||||
{
|
||||
local sign_token
|
||||
spec_file_name=${build_specdir}/${kernel_full_name}.spec
|
||||
spec_contents="%define name ${rpm_name} \n"
|
||||
spec_contents+="%define version ${kernel_version} \n"
|
||||
spec_contents+="%define release_os ${tlinux_release} \n"
|
||||
spec_contents+="%define tagged_name ${tagged_name} \n"
|
||||
spec_contents+="%define extra_version ${extra_version} \n"
|
||||
|
||||
if [ "${check_kabi}" = "yes" ]; then
|
||||
check_kabi=1
|
||||
else
|
||||
check_kabi=0
|
||||
fi
|
||||
spec_contents+="%define with_kabichk ${check_kabi} \n"
|
||||
|
||||
sign_token=
|
||||
if [ "$sign_token" = "" ]; then
|
||||
sign_token=0
|
||||
fi
|
||||
spec_contents+="%define sign_token ${sign_token} \n"
|
||||
|
||||
|
||||
if [ -z "${kernel_type}" ];then
|
||||
spec_contents+="%define kernel_all_types ${kernel_default_types[@]} \n"
|
||||
else
|
||||
spec_contents+="%define kernel_all_types ${kernel_type} \n"
|
||||
fi
|
||||
|
||||
if [ -n "${make_jobs}" ];then
|
||||
spec_contents+="%define jobs ${make_jobs} \n\n"
|
||||
fi
|
||||
|
||||
if [ -e /etc/tlinux-release ];then
|
||||
spec_contents+="%define debug_package %{nil}\n"
|
||||
spec_contents+="%define __os_install_post %{nil}\n"
|
||||
|
||||
fi
|
||||
|
||||
if [[ $isXenU == "32" && `uname -m` == "x86_64" ]];then
|
||||
spec_contents+="%define make_flag \"ARCH=i386\" \n"
|
||||
fi
|
||||
|
||||
echo -e "${spec_contents}" > $spec_file_name
|
||||
|
||||
if [ "$build_perf" = "yes" ]; then
|
||||
cat $curdir/perf-tlinux.spec >> $spec_file_name
|
||||
else
|
||||
cat $curdir/kernel-tlinux.spec >> $spec_file_name
|
||||
fi
|
||||
}
|
||||
|
||||
#main function
|
||||
|
||||
#Parse Parameters
|
||||
while getopts ":t:j:hdcp" option "$@"
|
||||
do
|
||||
case $option in
|
||||
"t" )
|
||||
tag_name=$OPTARG
|
||||
;;
|
||||
"j" )
|
||||
make_jobs=$OPTARG
|
||||
;;
|
||||
"h" )
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
"p" )
|
||||
build_perf="yes"
|
||||
;;
|
||||
"c" )
|
||||
echo "-c kabi check enabled!"
|
||||
check_kabi="yes"
|
||||
;;
|
||||
"?" )
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
|
||||
#test if parameter of kernel type is valid
|
||||
if [ -n "${kernel_type}" ] && [ ! -e config."${kernel_type}" ]
|
||||
then
|
||||
echo "Error: bad kernel type name. Config file for ${kernel_type} does not exist."
|
||||
usage
|
||||
exit 1
|
||||
elif [ -n "${kernel_type}" ] && [ -n "$isXenU" ] && [ ! -e config."${kernel_type}".xenU ]
|
||||
then
|
||||
echo "Error: bad kernel type name. Config file for ${kernel_type}.xenU does not exist."
|
||||
usage
|
||||
exit 1
|
||||
|
||||
fi
|
||||
|
||||
|
||||
if [ -e /etc/SuSE-release ];then
|
||||
build_specdir="/usr/src/packages/SPECS"
|
||||
build_srcdir="/usr/src/packages/SOURCES"
|
||||
elif [ -e /etc/tlinux-release ];then
|
||||
build_specdir="$HOME/rpmbuild/SPECS"
|
||||
build_srcdir="$HOME/rpmbuild/SOURCES"
|
||||
else
|
||||
echo "Error: Compile on unknown system."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -e "${build_srcdir}" ]; then
|
||||
mkdir $build_srcdir
|
||||
[ $? == 1 ] && exit 1
|
||||
fi
|
||||
|
||||
if [ ! -e "${build_specdir}" ]; then
|
||||
mkdir $build_specdir
|
||||
[ $? == 1 ] && exit 1
|
||||
fi
|
||||
|
||||
cd ../../
|
||||
origsrc=`pwd`
|
||||
|
||||
#if [ -n "$tag_name" ]; then
|
||||
# local_valid_branch=`git branch | grep "*" | awk '{print $2 }'`
|
||||
# git checkout "${tag_name}"
|
||||
# if [ $? -ne 0 ];then
|
||||
# echo "Error: bad tag name [$tag_name] "
|
||||
# exit 1
|
||||
# fi
|
||||
#fi
|
||||
|
||||
|
||||
get_kernel_version $origsrc
|
||||
get_tlinux_name
|
||||
echo "Prepare $kernel_full_name source."
|
||||
prepare_tlinux_spec
|
||||
|
||||
cp package/default/tlinux_cciss_link.modules $build_srcdir
|
||||
if [ "$kvm_guest" = "yes" ] ; then
|
||||
cp package/default/kvm_guest/*.patch $build_srcdir
|
||||
fi
|
||||
|
||||
if [ "$ec" = "yes" ] ; then
|
||||
cp package/default/ec/*.patch $build_srcdir
|
||||
fi
|
||||
|
||||
if test -e ${build_srcdir}/${kernel_full_name}; then
|
||||
rm -fr ${build_srcdir}/${kernel_full_name}
|
||||
fi
|
||||
|
||||
#tagged_name is a confirmed tag name and will be used for final source.
|
||||
git archive --format=tar --prefix="${kernel_full_name}"/ "${tagged_name}" | (cd "${build_srcdir}" && tar xf -)
|
||||
if [ $? -ne 0 ];then
|
||||
echo "Error:can't prepare $kernel_full_name source with git archive!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd ${build_srcdir}/${kernel_full_name}
|
||||
|
||||
if [[ $isXenU == "32" ]]
|
||||
then
|
||||
config_suffix="xenU32"
|
||||
target="--target i686"
|
||||
elif [[ $isXenU == "64" ]]
|
||||
then
|
||||
config_suffix="xenU"
|
||||
fi
|
||||
echo $config_suffix
|
||||
|
||||
if [ -z "${kernel_type}" ];then
|
||||
for type_name in "${kernel_default_types[@]}"
|
||||
do
|
||||
if [ -n "$isXenU" ]; then
|
||||
echo mv -f ${build_srcdir}/${kernel_full_name}/package/default/config.$type_name.$config_suffix${nosign_suffix} ${build_srcdir}/${kernel_full_name}/package/default/config.$type_name{nosign_suffix}
|
||||
mv -f ${build_srcdir}/${kernel_full_name}/package/default/config.$type_name.$config_suffix${nosign_suffix} ${build_srcdir}/${kernel_full_name}/package/default/config.$type_name${nosign_suffix}
|
||||
fi
|
||||
done
|
||||
else
|
||||
if [ -n "$isXenU" ]; then
|
||||
echo mv -f ${build_srcdir}/${kernel_full_name}/package/default/config.$kernel_type.$config_suffix${nosign_suffix} ${build_srcdir}/${kernel_full_name}/package/default/config.$kernel_type${nosign_suffix}
|
||||
mv -f ${build_srcdir}/${kernel_full_name}/package/default/config.$kernel_type.$config_suffix${nosign_suffix} ${build_srcdir}/${kernel_full_name}/package/default/config.$kernel_type${nosign_suffix}
|
||||
|
||||
elif [ "$kvm_guest" = "yes" ] ; then
|
||||
echo \
|
||||
cp -f ${build_srcdir}/${kernel_full_name}/package/default/kvm_guest/config.${kernel_type}${config_suffix}${nosign_suffix} ${build_srcdir}/${kernel_full_name}/package/default/config.$kernel_type${nosign_suffix}
|
||||
cp -f ${build_srcdir}/${kernel_full_name}/package/default/kvm_guest/config.${kernel_type}${config_suffix}${nosign_suffix} ${build_srcdir}/${kernel_full_name}/package/default/config.$kernel_type${nosign_suffix}
|
||||
elif [ "$xen_guest" = "yes" ] ; then
|
||||
echo \
|
||||
cp -f ${build_srcdir}/${kernel_full_name}/package/default/xen_guest/config.${kernel_type}${config_suffix}${nosign_suffix} ${build_srcdir}/${kernel_full_name}/package/default/config.$kernel_type${nosign_suffix}
|
||||
cp -f ${build_srcdir}/${kernel_full_name}/package/default/xen_guest/config.${kernel_type}${config_suffix}${nosign_suffix} ${build_srcdir}/${kernel_full_name}/package/default/config.$kernel_type${nosign_suffix}
|
||||
fi
|
||||
fi
|
||||
|
||||
cd ..
|
||||
tar -zcf ${kernel_full_name}.tar.gz ${kernel_full_name}
|
||||
rm -fr ${kernel_full_name}
|
||||
|
||||
#if [ -n "$tag_name" ];then
|
||||
# cd $origsrc
|
||||
# git checkout $local_valid_branch > /dev/null
|
||||
#fi
|
||||
|
||||
|
||||
echo "Build kernel rpm package."
|
||||
if [ $build_src_only -eq 0 ]; then
|
||||
rpmbuild -bb ${target} ${spec_file_name}
|
||||
sed -i 's/^%define sign_token.*/%define sign_token please_enter_your_token_here/' ${spec_file_name}
|
||||
else
|
||||
if [ $strip_sign_token -ne 0 ]; then
|
||||
sed -i 's/^%define sign_token.*/%define sign_token please_enter_your_token_here/' ${spec_file_name}
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Build kernel source rpm package."
|
||||
|
||||
cd ${build_srcdir}
|
||||
|
||||
tar -zxf ${kernel_full_name}.tar.gz
|
||||
|
||||
rm -fr ${kernel_full_name}/package/default/generate-rpms.sh
|
||||
tar -zcf ${kernel_full_name}.tar.gz ${kernel_full_name}
|
||||
|
||||
rpmbuild -bs ${target} ${spec_file_name}
|
||||
|
|
@ -1,623 +0,0 @@
|
|||
%global with_debuginfo 0
|
||||
%global with_perf 1
|
||||
%global with_bpftool 1
|
||||
%if 0%{?rhel} == 6
|
||||
%global rdist .tl1
|
||||
%global debug_path /usr/lib/debug/lib/
|
||||
%else
|
||||
%global debug_path /usr/lib/debug/usr/lib/
|
||||
%if 0%{?rhel} == 7
|
||||
%global rdist .tl2
|
||||
%endif
|
||||
%if 0%{?rhel} == 8
|
||||
%global rdist .tl3
|
||||
%global __python /usr/bin/python2
|
||||
%global _enable_debug_packages %{nil}
|
||||
%global debug_package %{nil}
|
||||
%global __debug_package %{nil}
|
||||
%global __debug_install_post %{nil}
|
||||
%global _build_id_links none
|
||||
%endif
|
||||
%endif
|
||||
|
||||
%global dist %{nil}
|
||||
|
||||
%global build_env DESTDIR="%{buildroot}" prefix=%{_prefix} lib=%{_lib} PYTHON=%{__python3} INSTALL_ROOT=%{buildroot}
|
||||
%global bpftool_make make %{?_smp_mflags} -C tools/bpf/bpftool %{build_env} mandir=%{_mandir} bash_compdir=%{_sysconfdir}/bash_completion.d/
|
||||
|
||||
Summary: Kernel for Tencent physical machine
|
||||
Name: %{name}
|
||||
Version: %{version}
|
||||
Release: %{release_os}%{?rdist}
|
||||
License: GPLv2
|
||||
Vendor: Tencent
|
||||
Packager: tlinux team <g_CAPD_SRDC_OS@tencent.com>
|
||||
Provides: kernel = %{version}-%{release}
|
||||
Group: System Environment/Kernel
|
||||
Source0: %{name}-%{version}.tar.gz
|
||||
Source1: tlinux_cciss_link.modules
|
||||
URL: http://www.tencent.com
|
||||
ExclusiveArch: aarch64
|
||||
Distribution: Tencent Linux
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-build
|
||||
BuildRequires: wget bc module-init-tools curl
|
||||
%if %{with_perf}
|
||||
BuildRequires: elfutils-devel zlib-devel binutils-devel newt-devel perl(ExtUtils::Embed) bison flex
|
||||
BuildRequires: xmlto asciidoc hmaccalc
|
||||
BuildRequires: audit-libs-devel
|
||||
#BuildRequires: uboot-tools
|
||||
%if 0%{?rhel} == 8
|
||||
BuildRequires: python2-devel
|
||||
%else
|
||||
BuildRequires: python-devel
|
||||
%endif
|
||||
|
||||
|
||||
%ifnarch s390 s390x
|
||||
BuildRequires: numactl-devel
|
||||
%endif
|
||||
%endif
|
||||
%if %{with_bpftool}
|
||||
BuildRequires: llvm
|
||||
%if 0%{?rhel} == 7
|
||||
BuildRequires: python2-docutils
|
||||
%else
|
||||
BuildRequires: python3-docutils
|
||||
%endif
|
||||
BuildRequires: zlib-devel binutils-devel
|
||||
%endif
|
||||
Requires(pre): linux-firmware >= 20100806-2
|
||||
|
||||
# for the 'hostname' command
|
||||
%if 0%{?rhel} == 7
|
||||
BuildRequires: hostname
|
||||
%else
|
||||
BuildRequires: net-tools
|
||||
%endif
|
||||
|
||||
%description
|
||||
This package contains tlinux kernel for arm64 Bare-Metal& VM
|
||||
|
||||
%package debuginfo-common
|
||||
Summary: tlinux kernel vmlinux for crash debug
|
||||
Release: %{release}
|
||||
Group: System Environment/Kernel
|
||||
Provides: kernel-debuginfo-common kernel-debuginfo
|
||||
AutoReqprov: no
|
||||
|
||||
%description debuginfo-common
|
||||
This package container vmlinux, System.map and config files for kernel
|
||||
debugging.
|
||||
|
||||
%package devel
|
||||
Summary: Development package for building kernel modules to match the %{version}-%{release} kernel
|
||||
Release: %{release}
|
||||
Group: System Environment/Kernel
|
||||
AutoReqprov: no
|
||||
|
||||
%description devel
|
||||
This package provides kernel headers and makefiles sufficient to build modules
|
||||
against the %{version}-%{release} kernel package.
|
||||
|
||||
|
||||
%package headers
|
||||
Summary: Header files for the Linux kernel for use by glibc
|
||||
Group: Development/System
|
||||
Obsoletes: glibc-kernheaders
|
||||
Provides: glibc-kernheaders = 3.0-46
|
||||
AutoReqprov: no
|
||||
|
||||
%description headers
|
||||
Kernel-headers includes the C header files that specify the interface
|
||||
between the Linux kernel and userspace libraries and programs. The
|
||||
header files define structures and constants that are needed for
|
||||
building most standard programs and are also needed for rebuilding the
|
||||
glibc package.
|
||||
|
||||
%if %{with_perf}
|
||||
%package -n perf
|
||||
Summary: Performance monitoring for the Linux kernel
|
||||
Group: Development/System
|
||||
License: GPLv2
|
||||
%description -n perf
|
||||
This package contains the perf tool, which enables performance monitoring
|
||||
of the Linux kernel.
|
||||
|
||||
%package -n perf-debuginfo
|
||||
Summary: Debug information for package perf
|
||||
Group: Development/Debug
|
||||
#Requires: %%{name}-debuginfo-common-%%{_target_cpu} = %%{version}-%%{release}
|
||||
AutoReqProv: no
|
||||
%description -n perf-debuginfo
|
||||
This package provides debug information for the perf package.
|
||||
|
||||
# Note that this pattern only works right to match the .build-id
|
||||
# symlinks because of the trailing nonmatching alternation and
|
||||
# the leading .*, because of find-debuginfo.sh's buggy handling
|
||||
# of matching the pattern against the symlinks file.
|
||||
%{expand:%%global debuginfo_args %{?debuginfo_args} -p '.*%%{_bindir}/perf(\.debug)?|.*%%{_libexecdir}/perf-core/.*|XXX' -o perf-debuginfo.list}
|
||||
|
||||
%package -n python-perf
|
||||
Summary: Python bindings for apps which will manipulate perf events
|
||||
Group: Development/Libraries
|
||||
%description -n python-perf
|
||||
The python-perf package contains a module that permits applications
|
||||
written in the Python programming language to use the interface
|
||||
to manipulate perf events.
|
||||
|
||||
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
|
||||
|
||||
%package -n python-perf-debuginfo
|
||||
Summary: Debug information for package perf python bindings
|
||||
Group: Development/Debug
|
||||
#Requires: %%{name}-debuginfo-common-%%{_target_cpu} = %%{version}-%%{release}
|
||||
AutoReqProv: no
|
||||
%description -n python-perf-debuginfo
|
||||
This package provides debug information for the perf python bindings.
|
||||
|
||||
# the python_sitearch macro should already be defined from above
|
||||
%{expand:%%global debuginfo_args %{?debuginfo_args} -p '.*%%{python_sitearch}/perf.so(\.debug)?|XXX' -o python-perf-debuginfo.list}
|
||||
|
||||
|
||||
%endif # with_perf
|
||||
|
||||
%if %{with_bpftool}
|
||||
%package -n bpftool
|
||||
Summary: Inspection and simple manipulation of eBPF programs and maps
|
||||
License: GPLv2
|
||||
%description -n bpftool
|
||||
This package contains the bpftool, which allows inspection and simple
|
||||
manipulation of eBPF programs and maps.
|
||||
|
||||
%package -n bpftool-debuginfo
|
||||
Summary: Debug information for package bpftool
|
||||
AutoReqProv: no
|
||||
%description -n bpftool-debuginfo
|
||||
This package provides debug information for the bpftool package.
|
||||
# debuginfo search rule
|
||||
%{expand:%%global debuginfo_args %{?debuginfo_args} -p '.*%%{_sbindir}/bpftool(\.debug)?|XXX' -o bpftool-debuginfo.list}
|
||||
%endif # with_bpftool
|
||||
|
||||
# prep #########################################################################
|
||||
%prep
|
||||
%setup -q -c -T -a 0
|
||||
|
||||
# build ########################################################################
|
||||
%build
|
||||
|
||||
|
||||
cd %{name}-%{version}
|
||||
|
||||
all_types="%{kernel_all_types}"
|
||||
no_sign="yes"
|
||||
for type_name in $all_types
|
||||
do
|
||||
sed -i '/^EXTRAVERSION/cEXTRAVERSION = -%{extra_version}' Makefile
|
||||
objdir=../%{name}-%{version}-obj-${type_name}
|
||||
[ -d ${objdir} ] || mkdir ${objdir}
|
||||
echo "include $PWD/Makefile" > ${objdir}/Makefile
|
||||
cp ./package/arm/config.${type_name} ${objdir}/.config
|
||||
localversion='"'-`echo %{tagged_name}|cut -d- -f3-`%{?dist}'"'
|
||||
sed -i -e 's/CONFIG_LOCALVERSION=.*/CONFIG_LOCALVERSION='$localversion'/' ${objdir}/.config
|
||||
make -C ${objdir} olddefconfig > /dev/null
|
||||
make -j16 -C ${objdir} RPM_BUILD_MODULE=y %{?jobs:-j %jobs} all > /dev/null
|
||||
|
||||
# dealing with files under lib/modules
|
||||
make -j16 -C ${objdir} RPM_BUILD_MODULE=y modules > /dev/null
|
||||
|
||||
%global perf_make make %{?_smp_mflags} -C tools/perf -s V=1 WERROR=0 NO_LIBUNWIND=1 HAVE_CPLUS_DEMANGLE=1 NO_GTK2=1 NO_STRLCPY=1 prefix=%{_prefix} lib=%{_lib}
|
||||
%if %{with_perf}
|
||||
# perf
|
||||
%{perf_make} all
|
||||
%{perf_make} man
|
||||
%endif
|
||||
|
||||
%if %{with_bpftool}
|
||||
%{bpftool_make}
|
||||
%endif
|
||||
done
|
||||
|
||||
# install ######################################################################
|
||||
%install
|
||||
|
||||
|
||||
echo install %{version}
|
||||
arch=`uname -m`
|
||||
if [ "$arch" != "aarch64" ];then
|
||||
echo "Unexpected error. Cannot build this rpm in non-aarch64 platform\n"
|
||||
exit 1
|
||||
fi
|
||||
mkdir -p %buildroot/boot
|
||||
cd %{name}-%{version}
|
||||
|
||||
all_types="%{kernel_all_types}"
|
||||
for type_name in $all_types
|
||||
do
|
||||
elfname=vmlinuz-%{tagged_name}%{?dist}
|
||||
mapname=System.map-%{tagged_name}%{?dist}
|
||||
configname=config-%{tagged_name}%{?dist}
|
||||
builddir=../%{name}-%{version}-obj-${type_name}
|
||||
%if 0%{?rhel} == 7
|
||||
cp -rpf ${builddir}/arch/arm64/boot/Image %buildroot/boot/${elfname}
|
||||
%endif
|
||||
#mkimage -A arm64 -O linux -T kernel -C none -a 0x80080000 -e 0x80080000 -n %{tagged_name} -d ${builddir}/arch/arm64/boot/Image %buildroot/boot/uImage-%{tagged_name}%{?dist}
|
||||
cp -rpf ${builddir}/System.map %buildroot/boot/${mapname}
|
||||
cp -rpf ${builddir}/.config %buildroot/boot/${configname}
|
||||
cp -rpf ${builddir}/vmlinux %buildroot/boot/vmlinux-%{tagged_name}%{?dist}
|
||||
sha512hmac %buildroot/boot/${elfname} | sed -e "s,$RPM_BUILD_ROOT,," > %buildroot/boot/.vmlinuz-%{tagged_name}%{?dist}.hmac
|
||||
|
||||
# dealing with kernel-devel package
|
||||
objdir=${builddir}
|
||||
#KernelVer=%{version}-%{title}-%{release_os}-${type_name}
|
||||
KernelVer=%{tagged_name}%{?dist}
|
||||
|
||||
|
||||
|
||||
####### make kernel-devel package: methods comes from rhel6(kernel.spec) #######
|
||||
make -C ${objdir} RPM_BUILD_MODULE=y INSTALL_MOD_PATH=%buildroot modules_install > /dev/null
|
||||
#don't package firmware, use linux-firmware rpm instead
|
||||
rm -rf %buildroot/lib/firmware
|
||||
# And save the headers/makefiles etc for building modules against
|
||||
#
|
||||
# This all looks scary, but the end result is supposed to be:
|
||||
# * all arch relevant include/ files
|
||||
# * all Makefile/Kconfig files
|
||||
# * all script/ files
|
||||
rm -rf %buildroot/lib/modules/${KernelVer}/build
|
||||
rm -rf %buildroot/lib/modules/${KernelVer}/source
|
||||
mkdir -p %buildroot/lib/modules/${KernelVer}/build
|
||||
(cd $RPM_BUILD_ROOT/lib/modules/${KernelVer} ; ln -s build source)
|
||||
mkdir -p %buildroot/lib/modules/${KernelVer}/source/arch/arm64/kernel && cp -pf arch/arm64/kernel/module.lds %buildroot/lib/modules/${KernelVer}/source/arch/arm64/kernel/
|
||||
# dirs for additional modules per module-init-tools, kbuild/modules.txt
|
||||
mkdir -p %buildroot/lib/modules/${KernelVer}/extra
|
||||
mkdir -p %buildroot/lib/modules/${KernelVer}/updates
|
||||
mkdir -p %buildroot/lib/modules/${KernelVer}/weak-updates
|
||||
%if 0%{?rhel} == 8
|
||||
cp -rpf ${builddir}/arch/arm64/boot/Image %buildroot/lib/modules/${KernelVer}/vmlinuz
|
||||
%endif
|
||||
# first copy everything
|
||||
cp --parents `find -type f -name "Makefile*" -o -name "Kconfig*"` %buildroot/lib/modules/${KernelVer}/build
|
||||
cp ${builddir}/Module.symvers %buildroot/lib/modules/${KernelVer}/build
|
||||
cp ${builddir}/System.map %buildroot/lib/modules/${KernelVer}/build
|
||||
|
||||
if [ -s ${builddir}/Module.markers ]; then
|
||||
cp ${builddir}/Module.markers %buildroot/lib/modules/${KernelVer}/build
|
||||
fi
|
||||
|
||||
# create the kABI metadata for use in packaging
|
||||
echo "**** GENERATING kernel ABI metadata ****"
|
||||
gzip -c9 < ${builddir}/Module.symvers > %buildroot/boot/symvers-${KernelVer}.gz
|
||||
# chmod 0755 %_sourcedir/kabitool
|
||||
# rm -f %{_tmppath}/kernel-$KernelVer-kabideps
|
||||
# %_sourcedir/kabitool -s Module.symvers -o %{_tmppath}/kernel-$KernelVer-kabideps
|
||||
|
||||
%if %{with_kabichk}
|
||||
echo "**** kABI checking is enabled in kernel SPEC file. ****"
|
||||
chmod 0755 scripts/check-kabi
|
||||
if [ -e package/arm/Module.kabi_%{_target_cpu}$Flavour ]; then
|
||||
scripts/check-kabi -k package/arm/Module.kabi_%{_target_cpu}$Flavour -s ${builddir}/Module.symvers || exit 1
|
||||
echo "**** kABI checking SUCCESS. ****"
|
||||
else
|
||||
echo "**** NOTE: Cannot find reference Module.kabi file. ****"
|
||||
exit 1
|
||||
fi
|
||||
%endif
|
||||
|
||||
rm -rf %buildroot/lib/modules/${KernelVer}/build/Documentation
|
||||
rm -rf %buildroot/lib/modules/${KernelVer}/build/scripts
|
||||
rm -rf %buildroot/lib/modules/${KernelVer}/build/include
|
||||
cp ${builddir}/.config %buildroot/lib/modules/${KernelVer}/build
|
||||
cp -a scripts %buildroot/lib/modules/${KernelVer}/build
|
||||
cp -a ${builddir}/scripts %buildroot/lib/modules/${KernelVer}/build
|
||||
rm -f %buildroot/lib/modules/${KernelVer}/build/scripts/*.o
|
||||
rm -f %buildroot/lib/modules/${KernelVer}/build/scripts/*/*.o
|
||||
cp -a --parents arch/arm64/include %buildroot/lib/modules/${KernelVer}/build/
|
||||
(cd ${builddir} ; cp -a --parents arch/arm64/include/generated %buildroot/lib/modules/${KernelVer}/build/)
|
||||
mkdir -p %buildroot/lib/modules/${KernelVer}/build/include
|
||||
|
||||
cp -a ${builddir}/include/config %buildroot/lib/modules/${KernelVer}/build/include/
|
||||
cp -a ${builddir}/include/generated %buildroot/lib/modules/${KernelVer}/build/include/
|
||||
|
||||
cd include
|
||||
cp -a acpi asm-generic clocksource crypto drm dt-bindings keys kvm linux math-emu media misc net pcmcia ras rdma scsi soc sound target trace uapi video xen %buildroot/lib/modules/${KernelVer}/build/include
|
||||
|
||||
cp -a ../arch/arm64 $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/include/asm-arm64
|
||||
pushd $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/include
|
||||
ln -s asm-arm64 asm
|
||||
popd
|
||||
|
||||
# Make sure the Makefile and version.h have a matching timestamp so that
|
||||
# external modules can be built
|
||||
touch -r %buildroot/lib/modules/${KernelVer}/build/Makefile %buildroot/lib/modules/${KernelVer}/build/include/generated/uapi/linux/version.h
|
||||
#touch -r %buildroot/lib/modules/${KernelVer}/build/.config %buildroot/lib/modules/${KernelVer}/build/include/linux/autoconf.h
|
||||
# Copy .config to include/config/auto.conf so "make prepare" is unnecessary.
|
||||
cp %buildroot/lib/modules/$KernelVer/build/.config %buildroot/lib/modules/${KernelVer}/build/include/config/auto.conf
|
||||
cd ..
|
||||
|
||||
|
||||
find %buildroot/lib/modules/${KernelVer} -name "*.ko" -type f >modnames
|
||||
|
||||
|
||||
mkdir -p %buildroot%debug_path/modules/${KernelVer}
|
||||
cp -r %buildroot/lib/modules/${KernelVer}/kernel %buildroot%debug_path/modules/${KernelVer}
|
||||
xargs --no-run-if-empty strip -g < modnames
|
||||
|
||||
xargs --no-run-if-empty chmod u+x < modnames
|
||||
|
||||
# Generate a list of modules for block and networking.
|
||||
fgrep /drivers/ modnames | xargs --no-run-if-empty nm -upA |
|
||||
sed -n 's,^.*/\([^/]*\.ko\): *U \(.*\)$,\1 \2,p' > drivers.undef
|
||||
|
||||
collect_modules_list()
|
||||
{
|
||||
sed -r -n -e "s/^([^ ]+) \\.?($2)\$/\\1/p" drivers.undef |
|
||||
LC_ALL=C sort -u > $RPM_BUILD_ROOT/lib/modules/$KernelVer/modules.$1
|
||||
if [ ! -z "$3" ]; then
|
||||
sed -r -e "/^($3)\$/d" -i $RPM_BUILD_ROOT/lib/modules/$KernelVer/modules.$1
|
||||
fi
|
||||
}
|
||||
|
||||
collect_modules_list networking 'register_netdev|ieee80211_register_hw|usbnet_probe|phy_driver_register|rt2x00(pci|usb)_probe|register_netdevice'
|
||||
collect_modules_list block 'ata_scsi_ioctl|scsi_add_host|scsi_add_host_with_dma|blk_alloc_queue|blk_init_queue|register_mtd_blktrans|scsi_esp_register|scsi_register_device_handler|blk_queue_physical_block_size' 'pktcdvd.ko|dm-mod.ko'
|
||||
collect_modules_list drm 'drm_open|drm_init'
|
||||
collect_modules_list modesetting 'drm_crtc_init'
|
||||
# detect missing or incorrect license tags
|
||||
rm -f modinfo
|
||||
while read i
|
||||
do
|
||||
echo -n "${i#%buildroot/lib/modules/${KernelVer}/} " >> modinfo
|
||||
/sbin/modinfo -l $i >> modinfo
|
||||
done < modnames
|
||||
|
||||
egrep -v \
|
||||
'GPL( v2)?$|Dual BSD/GPL$|Dual MPL/GPL$|GPL and additional rights$' \
|
||||
modinfo && exit 1
|
||||
|
||||
rm -f modinfo modnames
|
||||
# remove files that will be auto generated by depmod at rpm -i time
|
||||
#for i in alias alias.bin ccwmap dep dep.bin ieee1394map inputmap isapnpmap ofmap pcimap seriomap symbols symbols.bin usbmap
|
||||
#do
|
||||
# rm -f %buildroot/lib/modules/${KernelVer}/modules.$i
|
||||
#done
|
||||
|
||||
# Move the devel headers out of the root file system
|
||||
mkdir -p %buildroot/usr/src/kernels
|
||||
mv %buildroot/lib/modules/${KernelVer}/build %buildroot/usr/src/kernels/${KernelVer}
|
||||
ln -sf /usr/src/kernels/${KernelVer} %buildroot/lib/modules/${KernelVer}/build
|
||||
#
|
||||
# Generate the kernel-modules-* files lists
|
||||
#
|
||||
%if 0%{?rhel} == 8
|
||||
mkdir -p %buildroot/lib/modules/$KernelVer/dist_compat
|
||||
mv %buildroot/lib/modules/$KernelVer/modules.symbols.bin %buildroot/lib/modules/$KernelVer/dist_compat
|
||||
mv %buildroot/lib/modules/$KernelVer/modules.symbols %buildroot/lib/modules/$KernelVer/dist_compat
|
||||
mv %buildroot/lib/modules/$KernelVer/modules.softdep %buildroot/lib/modules/$KernelVer/dist_compat
|
||||
mv %buildroot/lib/modules/$KernelVer/modules.devname %buildroot/lib/modules/$KernelVer/dist_compat
|
||||
mv %buildroot/lib/modules/$KernelVer/modules.dep.bin %buildroot/lib/modules/$KernelVer/dist_compat
|
||||
mv %buildroot/lib/modules/$KernelVer/modules.dep %buildroot/lib/modules/$KernelVer/dist_compat
|
||||
mv %buildroot/lib/modules/$KernelVer/modules.builtin.bin %buildroot/lib/modules/$KernelVer/dist_compat
|
||||
mv %buildroot/lib/modules/$KernelVer/modules.alias.bin %buildroot/lib/modules/$KernelVer/dist_compat
|
||||
mv %buildroot/lib/modules/$KernelVer/modules.alias %buildroot/lib/modules/$KernelVer/dist_compat
|
||||
mv %buildroot/boot/$configname %buildroot/lib/modules/$KernelVer/dist_compat
|
||||
mv %buildroot/boot/System.map-$KernelVer %buildroot/lib/modules/$KernelVer/dist_compat
|
||||
mv %buildroot/boot/.vmlinuz-%{tagged_name}%{?dist}.hmac %buildroot/lib/modules/$KernelVer/dist_compat
|
||||
%endif
|
||||
|
||||
env -i PATH=$PATH LD_LIBRARY_PATH=$LD_LIBRARY_PATH HOME=$HOME USER=$USER bash -c "$PWD/package/arm/mlx/mlnx_ofed_integrate_into_kernel.sh $KernelVer $PWD %buildroot"
|
||||
|
||||
# Copy the System.map file for depmod to use, and create a backup of the
|
||||
# full module tree so we can restore it after we're done filtering
|
||||
cp ${builddir}/System.map $RPM_BUILD_ROOT/.
|
||||
pushd $RPM_BUILD_ROOT
|
||||
mkdir restore
|
||||
|
||||
|
||||
cp -r lib/modules/$KernelVer/* restore/.
|
||||
|
||||
find lib/modules/$KernelVer/ -not -type d | sort -n > modules.list
|
||||
find lib/modules/$KernelVer/ -type d | sort -n > module-dirs.list
|
||||
|
||||
# Run depmod on the resulting module tree and make sure it isn't broken
|
||||
depmod -b . -aeF ./System.map $KernelVer &> depmod.out
|
||||
if [ -s depmod.out ]; then
|
||||
echo "Depmod failure"
|
||||
cat depmod.out
|
||||
exit 1
|
||||
else
|
||||
rm depmod.out
|
||||
fi
|
||||
|
||||
# Cleanup
|
||||
rm System.map
|
||||
cp -r restore/* lib/modules/$KernelVer/.
|
||||
rm -rf restore
|
||||
popd
|
||||
|
||||
%if 0%{?rhel} == 8
|
||||
mv %buildroot/lib/modules/$KernelVer/modules.symbols.bin %buildroot/lib/modules/$KernelVer/dist_compat
|
||||
mv %buildroot/lib/modules/$KernelVer/modules.symbols %buildroot/lib/modules/$KernelVer/dist_compat
|
||||
mv %buildroot/lib/modules/$KernelVer/modules.softdep %buildroot/lib/modules/$KernelVer/dist_compat
|
||||
mv %buildroot/lib/modules/$KernelVer/modules.devname %buildroot/lib/modules/$KernelVer/dist_compat
|
||||
mv %buildroot/lib/modules/$KernelVer/modules.dep.bin %buildroot/lib/modules/$KernelVer/dist_compat
|
||||
mv %buildroot/lib/modules/$KernelVer/modules.dep %buildroot/lib/modules/$KernelVer/dist_compat
|
||||
mv %buildroot/lib/modules/$KernelVer/modules.builtin.bin %buildroot/lib/modules/$KernelVer/dist_compat
|
||||
mv %buildroot/lib/modules/$KernelVer/modules.alias.bin %buildroot/lib/modules/$KernelVer/dist_compat
|
||||
mv %buildroot/lib/modules/$KernelVer/modules.alias %buildroot/lib/modules/$KernelVer/dist_compat
|
||||
%endif
|
||||
|
||||
# Make sure the files lists start with absolute paths or rpmbuild fails.
|
||||
# Also add in the dir entries
|
||||
sed -e 's/^lib*/%dir \/lib/' $RPM_BUILD_ROOT/module-dirs.list > ../core.list
|
||||
sed -e 's/^lib*/\/lib/' $RPM_BUILD_ROOT/modules.list >> ../core.list
|
||||
|
||||
# Cleanup
|
||||
rm -f $RPM_BUILD_ROOT/modules.list
|
||||
rm -f $RPM_BUILD_ROOT/module-dirs.list
|
||||
|
||||
%if %{with_perf}
|
||||
# perf tool binary and supporting scripts/binaries
|
||||
%{perf_make} DESTDIR=$RPM_BUILD_ROOT install
|
||||
mkdir -p %{buildroot}%{_libdir}
|
||||
touch %{buildroot}%{_libdir}/libperf-jvmti.so
|
||||
rm -f %{buildroot}%{_bindir}/trace
|
||||
|
||||
# perf-python extension
|
||||
%{perf_make} DESTDIR=$RPM_BUILD_ROOT install-python_ext
|
||||
|
||||
# perf man pages (note: implicit rpm magic compresses them later)
|
||||
%{perf_make} DESTDIR=$RPM_BUILD_ROOT install-man
|
||||
%endif
|
||||
|
||||
%if %{with_bpftool}
|
||||
%{bpftool_make} install doc-install
|
||||
/usr/lib/rpm/brp-compress
|
||||
%endif # with_bpftool
|
||||
done
|
||||
|
||||
mkdir -p %buildroot/etc/sysconfig/modules
|
||||
install -m755 %SOURCE1 %buildroot/etc/sysconfig/modules
|
||||
|
||||
#### Header
|
||||
make INSTALL_HDR_PATH=$RPM_BUILD_ROOT/usr headers_install
|
||||
# Do headers_check but don't die if it fails.
|
||||
make INSTALL_HDR_PATH=$RPM_BUILD_ROOT/usr headers_check \
|
||||
> hdrwarnings.txt || :
|
||||
if grep -q exist hdrwarnings.txt; then
|
||||
sed s:^$RPM_BUILD_ROOT/usr/include/:: hdrwarnings.txt
|
||||
# Temporarily cause a build failure if header inconsistencies.
|
||||
# exit 1
|
||||
fi
|
||||
|
||||
find $RPM_BUILD_ROOT/usr/include \
|
||||
\( -name .install -o -name .check -o \
|
||||
-name ..install.cmd -o -name ..check.cmd \) | xargs rm -f
|
||||
|
||||
# glibc provides scsi headers for itself, for now
|
||||
rm -rf $RPM_BUILD_ROOT/usr/include/scsi
|
||||
rm -f $RPM_BUILD_ROOT/usr/include/asm*/atomic.h
|
||||
rm -f $RPM_BUILD_ROOT/usr/include/asm*/io.h
|
||||
rm -f $RPM_BUILD_ROOT/usr/include/asm*/irq.h
|
||||
|
||||
|
||||
%pre
|
||||
# pre #########################################################################
|
||||
system_arch=`uname -m`
|
||||
|
||||
if [ %{_target_cpu} != ${system_arch} ]; then
|
||||
echo "ERROR: Failed installing this rpm!!!!"
|
||||
echo "This rpm is intended for %{_target_cpu} platform. It seems your system is ${system_arch}.";
|
||||
exit 1;
|
||||
fi;
|
||||
|
||||
%post
|
||||
# post #########################################################################
|
||||
echo "Install tlinux kernel"
|
||||
%if 0%{?rhel} == 8
|
||||
kernel-install add %{tagged_name} /lib/modules/%{tagged_name}/vmlinuz
|
||||
cp -p /lib/modules/%{tagged_name}/dist_compat/config-%{tagged_name}%{?dist} /boot
|
||||
cp -p /lib/modules/%{tagged_name}/dist_compat/.vmlinuz-%{tagged_name}%{?dist}.hmac /boot
|
||||
cp -p /lib/modules/%{tagged_name}/dist_compat/System.map-%{tagged_name}%{?dist} /boot
|
||||
%else
|
||||
%if 0%{?rhel} == 7
|
||||
/sbin/new-kernel-pkg --package kernel --install %{tagged_name}%{?dist} --make-default|| exit $?
|
||||
echo -e "Set Grub default to \"%{tagged_name}%{?dist}\" Done."
|
||||
%endif
|
||||
%endif
|
||||
|
||||
%preun
|
||||
# preun #######################################################################
|
||||
%if 0%{?rhel} == 8
|
||||
kernel-install remove %{tagged_name}
|
||||
%else
|
||||
%if 0%{?rhel} == 7
|
||||
/sbin/new-kernel-pkg --rminitrd --dracut --remove %{tagged_name}%{?dist} || exit $?
|
||||
echo -e "Remove \"%{tagged_name}%{?dist}\" Done."
|
||||
%endif
|
||||
%endif
|
||||
|
||||
%posttrans
|
||||
# posttrans ####################################################################
|
||||
%if 0%{?rhel} == 7
|
||||
/sbin/new-kernel-pkg --package kernel --mkinitrd --dracut --depmod --update %{tagged_name}%{?dist} || exit $?
|
||||
/sbin/new-kernel-pkg --package kernel --rpmposttrans %{tagged_name}%{?dist} || exit $?
|
||||
%endif
|
||||
|
||||
%files -f core.list
|
||||
# files ########################################################################
|
||||
%defattr(-,root,root)
|
||||
%if 0%{?rhel} == 7
|
||||
/boot/vmlinuz-%%{tagged_name}%%{?dist}
|
||||
/boot/.vmlinuz-%%{tagged_name}%%{?dist}.hmac
|
||||
#/boot/uImage-%%{tagged_name}%%{?dist}
|
||||
/boot/System.map-%%{tagged_name}%%{?dist}
|
||||
/boot/config-%%{tagged_name}%%{?dist}
|
||||
%endif
|
||||
/boot/symvers-%{tagged_name}%{?dist}*
|
||||
/etc/sysconfig/modules/tlinux_cciss_link.modules
|
||||
#/lib/modules/%%{tagged_name}/vmlinuz
|
||||
#do not package firmware ,use linux-firmware rpm instead
|
||||
#/lib/firmware/
|
||||
|
||||
%files debuginfo-common
|
||||
%defattr(-,root,root)
|
||||
/boot/vmlinux-%{tagged_name}%{?dist}
|
||||
%dir %debug_path
|
||||
%debug_path/modules
|
||||
#/boot/System.map-%%{version}-%%{title}-%%{release_os}-*
|
||||
#/boot/config-%%{version}-%%{title}-%%{release_os}-*
|
||||
|
||||
%files headers
|
||||
%defattr(-,root,root)
|
||||
/usr/include/*
|
||||
|
||||
%files devel
|
||||
%defattr(-,root,root)
|
||||
/usr/src/kernels/%{tagged_name}%{?dist}
|
||||
|
||||
%if %{with_perf}
|
||||
%files -n perf
|
||||
%defattr(-,root,root)
|
||||
%{_bindir}/perf*
|
||||
%{_sysconfdir}/bash_completion.d/perf
|
||||
%dir %{_prefix}/lib/perf
|
||||
%{_prefix}/lib/perf/*
|
||||
%dir %{_libdir}/traceevent/
|
||||
%{_libdir}/traceevent/*
|
||||
%{_libdir}/libperf-jvmti.so
|
||||
%dir %{_libexecdir}/perf-core
|
||||
%{_libexecdir}/perf-core/*
|
||||
%{_datadir}/perf-core/*
|
||||
%{_docdir}/perf-tip/tips.txt
|
||||
%{_mandir}/man[1-8]/perf*
|
||||
|
||||
%files -n python-perf
|
||||
%defattr(-,root,root)
|
||||
%{python_sitearch}
|
||||
|
||||
%if %{with_debuginfo}
|
||||
%files -f perf-debuginfo.list -n perf-debuginfo
|
||||
%defattr(-,root,root)
|
||||
|
||||
%files -f python-perf-debuginfo.list -n python-perf-debuginfo
|
||||
%defattr(-,root,root)
|
||||
%endif
|
||||
%endif # with_perf
|
||||
|
||||
%if %{with_bpftool}
|
||||
%files -n bpftool
|
||||
%defattr(-,root,root)
|
||||
%{_sbindir}/bpftool
|
||||
%{_sysconfdir}/bash_completion.d/bpftool
|
||||
%{_mandir}/man8/bpftool*.gz
|
||||
%{_mandir}/man7/bpf-helpers.7.gz
|
||||
|
||||
%if %{with_debuginfo}
|
||||
%files -f bpftool-debuginfo.list -n bpftool-debuginfo
|
||||
%defattr(-,root,root)
|
||||
%endif
|
||||
%endif # with_bpftool
|
||||
|
||||
# changelog ###################################################################
|
||||
%changelog
|
||||
* Mon Mar 11 2019 Jia Wang <jasperwang@tencent.com>
|
||||
- Initial 4.14.99 repository
|
||||
|
|
@ -1,268 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Copyright (c) 2020 Mellanox Technologies. All rights reserved.
|
||||
#
|
||||
# This Software is licensed under one of the following licenses:
|
||||
#
|
||||
# 1) under the terms of the "Common Public License 1.0" a copy of which is
|
||||
# available from the Open Source Initiative, see
|
||||
# http://www.opensource.org/licenses/cpl.php.
|
||||
#
|
||||
# 2) under the terms of the "The BSD License" a copy of which is
|
||||
# available from the Open Source Initiative, see
|
||||
# http://www.opensource.org/licenses/bsd-license.php.
|
||||
#
|
||||
# 3) under the terms of the "GNU General Public License (GPL) Version 2" a
|
||||
# copy of which is available from the Open Source Initiative, see
|
||||
# http://www.opensource.org/licenses/gpl-license.php.
|
||||
#
|
||||
# Licensee has the right to choose one of the above licenses.
|
||||
#
|
||||
# Redistributions of source code must retain the above copyright
|
||||
# notice and one of the license notices.
|
||||
#
|
||||
# Redistributions in binary form must reproduce both the above copyright
|
||||
# notice, one of the license notices in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
#
|
||||
# Author: Alaa Hleihel <alaa@mellanox.com>
|
||||
#
|
||||
|
||||
set -ex
|
||||
|
||||
############################################################################
|
||||
# Settings:
|
||||
|
||||
# Additional flags to pass to mlnxofedinstall
|
||||
mlnxofedinstall_flags=""
|
||||
|
||||
#
|
||||
# Disabling build of specific modules:
|
||||
#
|
||||
mlnxofedinstall_flags=" ${mlnxofedinstall_flags} \
|
||||
--without-mlx5_fpga_tools \
|
||||
--without-mlnx-rdma-rxe \
|
||||
--without-mlnx-nfsrdma \
|
||||
--without-mlnx-nvme \
|
||||
--without-isert \
|
||||
--without-iser \
|
||||
--without-srp \
|
||||
--without-rshim \
|
||||
--without-mdev \
|
||||
"
|
||||
|
||||
#
|
||||
# Disabling checking for required packages:
|
||||
#
|
||||
# Uncomment the next line in case you have a customised build host that
|
||||
# causes mlnxofedinstall to fail when checking for required packages (as
|
||||
# they might be provided by packages with unexpected names, etc).
|
||||
#
|
||||
mlnxofedinstall_flags=" ${mlnxofedinstall_flags} --without-depcheck"
|
||||
|
||||
|
||||
|
||||
#
|
||||
############################################################################
|
||||
# get args
|
||||
|
||||
# kernel version number (for building modules)
|
||||
KERNELRELEASE=$1; shift
|
||||
|
||||
# path to kernel rpm build directory (for temp build folder)
|
||||
kbdir=$1; shift
|
||||
|
||||
# path to kernel rpm build root (for kernel sources and installing modules)
|
||||
buildroot=$1; shift
|
||||
|
||||
# Path to full mlnx_ofed package
|
||||
ofedsrc=${kbdir}/package/arm/mlx/MLNX_OFED_LINUX-5.1-2.5.8.0.46-rhel8.3-aarch64.tgz
|
||||
|
||||
mlx_splits_dir=${kbdir}/package/arm/mlx
|
||||
mlx_splits="mlx_split*"
|
||||
if [ ! -e "${ofedsrc}" ]; then
|
||||
cat $mlx_splits_dir/$mlx_splits > $ofedsrc
|
||||
fi
|
||||
|
||||
if [ ! -e "${ofedsrc}" ]; then
|
||||
echo "ERROR: ofedsrc not provided or path '${ofedsrc}' does not exist." >&2
|
||||
echo 1
|
||||
fi
|
||||
|
||||
if [ "X${KERNELRELEASE}" == "X" ]; then
|
||||
echo "ERROR: KERNELRELEASE not provided." >&2
|
||||
echo 1
|
||||
fi
|
||||
if [ ! -d "${kbdir}" ]; then
|
||||
echo "ERROR: kbdir not provided" >&2
|
||||
echo 1
|
||||
fi
|
||||
if [ ! -d "${buildroot}" ]; then
|
||||
echo "ERROR: buildroot not provided" >&2
|
||||
echo 1
|
||||
fi
|
||||
|
||||
K_SRC=${buildroot}/usr/src/kernels/${KERNELRELEASE}
|
||||
K_DIR_INSTALL=${buildroot}/lib/modules/${KERNELRELEASE}/kernel
|
||||
|
||||
export MAKE=${MAKE:-"make"}
|
||||
|
||||
|
||||
############################################################################
|
||||
#
|
||||
# make sure we have each modules installed once under the new kernel:
|
||||
# - if the module we want to install already exists, replace it wit the new one.
|
||||
# - if it's a new module, then just install it.
|
||||
#
|
||||
function inst_mod()
|
||||
{
|
||||
local mod=$1; shift
|
||||
|
||||
local mod_name=$(basename ${mod})
|
||||
local tdir=
|
||||
|
||||
for ii in $(find ${K_DIR_INSTALL} -name "*${mod_name}*")
|
||||
do
|
||||
# save module location
|
||||
tdir=$(dirname ${ii})
|
||||
|
||||
/bin/rm -fv ${ii}
|
||||
done
|
||||
|
||||
# install new module
|
||||
if [ ! -e "${tdir}" ]; then
|
||||
tdir="${K_DIR_INSTALL}/drivers/ofed_addon/"
|
||||
mkdir -p ${tdir}
|
||||
fi
|
||||
|
||||
/bin/cp -fv ${mod} ${tdir}/
|
||||
}
|
||||
|
||||
function handle_rpm()
|
||||
{
|
||||
local pkg=$1; shift
|
||||
|
||||
/bin/rm -rf ext_rpm
|
||||
mkdir -p ext_rpm
|
||||
cd ext_rpm
|
||||
|
||||
# extract rpm
|
||||
rpm2cpio ${pkg} | cpio -id
|
||||
|
||||
# copy all modules
|
||||
for mod in $(find . -name "*.ko*")
|
||||
do
|
||||
inst_mod ${mod}
|
||||
done
|
||||
|
||||
cd -
|
||||
}
|
||||
|
||||
function handle_rpms_ofa_kernel()
|
||||
{
|
||||
local mod_rpms=$1; shift
|
||||
|
||||
for mrpm in ${mod_rpms}
|
||||
do
|
||||
case "${mrpm}" in
|
||||
*mlnx-ofa_kernel*devel*)
|
||||
continue
|
||||
;;
|
||||
*mlnx-ofa_kernel*)
|
||||
handle_rpm ${mrpm}
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
function handle_rpms_all()
|
||||
{
|
||||
local mod_rpms=$1; shift
|
||||
|
||||
for mrpm in ${mod_rpms}
|
||||
do
|
||||
case "${mrpm}" in
|
||||
*mlnx-ofa_kernel*)
|
||||
continue
|
||||
;;
|
||||
*)
|
||||
handle_rpm ${mrpm}
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
__cleanup()
|
||||
{
|
||||
sed -i '/__os_install_post/d' ~/.rpmmacros
|
||||
sed -i '/__brp_mangle_shebangs/d' ~/.rpmmacros
|
||||
}
|
||||
trap '__cleanup' INT TERM ERR EXIT
|
||||
|
||||
############################################################################
|
||||
|
||||
cd ${kbdir}
|
||||
/bin/rm -rf ofedbuild && mkdir ofedbuild && cd ofedbuild
|
||||
mkdir mtmp
|
||||
TMPD="$PWD/mtmp"
|
||||
|
||||
# extract MLNX_OFED
|
||||
tar xzf ${ofedsrc}
|
||||
cd MLNX_OFED_LINUX-*
|
||||
|
||||
distro=$(cat distro 2>/dev/null)
|
||||
echo "This MLNX_OFED was built for distro: ${distro}"
|
||||
|
||||
#this will cause error in chroot environment
|
||||
#echo "%__os_install_post %{nil}" >> ~/.rpmmacros
|
||||
echo "%__brp_mangle_shebangs %{nil}" >> ~/.rpmmacros
|
||||
|
||||
# compile modules against target kernel
|
||||
./mlnxofedinstall \
|
||||
--add-kernel-support-build-only \
|
||||
--disable-kmp \
|
||||
--distro ${distro} \
|
||||
--kernel ${KERNELRELEASE} \
|
||||
--kernel-sources ${K_SRC} \
|
||||
--tmpdir ${TMPD} \
|
||||
--skip-distro-check \
|
||||
--skip-repo ${mlnxofedinstall_flags}
|
||||
|
||||
sed -i '/__os_install_post/d' ~/.rpmmacros
|
||||
sed -i '/__brp_mangle_shebangs/d' ~/.rpmmacros
|
||||
|
||||
# fix permissiosn
|
||||
chown -R ${USER} ${TMPD}
|
||||
|
||||
echo
|
||||
echo "Compilation done, now get the modules and copy the to kernel buildroot..."
|
||||
echo
|
||||
|
||||
# open RPMs and copy modules
|
||||
/bin/rm -rf ${TMPD}/new
|
||||
mkdir -p ${TMPD}/new
|
||||
cd ${TMPD}/new
|
||||
tar xzf ${TMPD}/MLNX_OFED_LINUX-*/MLNX_OFED_LINUX-*tgz
|
||||
|
||||
# get all kernel module rpms that were built against target kernel
|
||||
mod_rpms=
|
||||
for pkg in $(find ${TMPD}/new/MLNX_OFED_LINUX-*/RPMS -name "*rpm")
|
||||
do
|
||||
if rpm -qlp ${pkg} | grep "\.ko" | grep -q "${KERNELRELEASE}"; then
|
||||
# take each rpm only once
|
||||
rpkg=$(readlink -f ${pkg})
|
||||
if ! echo "${mod_rpms}" | grep -q "${rpkg}"; then
|
||||
mod_rpms="${mod_rpms} ${rpkg}"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# first handle ofa_kernel rpm since it's our base package
|
||||
handle_rpms_ofa_kernel "${mod_rpms}"
|
||||
|
||||
# now handle the additional packages
|
||||
handle_rpms_all "${mod_rpms}"
|
||||
|
||||
# cleanup
|
||||
cd ${kbdir}
|
||||
/bin/rm -rf ofedbuild
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -1,184 +0,0 @@
|
|||
%define sign_server 10.12.65.118
|
||||
|
||||
%global with_debuginfo 0
|
||||
%if 0%{?rhel} == 6
|
||||
%global dist .tl1
|
||||
%global debug_path /usr/lib/debug/lib/
|
||||
%else
|
||||
%global debug_path /usr/lib/debug/usr/lib/
|
||||
%if 0%{?rhel} == 7
|
||||
%global dist .tl2
|
||||
%endif
|
||||
%endif
|
||||
|
||||
%if 0%{?rhel} == 8
|
||||
%global __python %{__python2}
|
||||
%endif
|
||||
|
||||
%global build_env DESTDIR="%{buildroot}" prefix=%{_prefix} lib=%{_lib} PYTHON=%{__python3} INSTALL_ROOT=%{buildroot}
|
||||
%global bpftool_make make %{?_smp_mflags} -C tools/bpf/bpftool %{build_env} mandir=%{_mandir} bash_compdir=%{_sysconfdir}/bash_completion.d/
|
||||
|
||||
Summary: Performance monitoring for the Linux kernel
|
||||
Group: Development/System
|
||||
Name: %{name}
|
||||
Version: %{version}
|
||||
Release: %{release_os}%{?dist}
|
||||
License: GPLv2
|
||||
Vendor: Tencent
|
||||
Packager: tlinux team <g_CAPD_SRDC_OS@tencent.com>
|
||||
Provides: perf = %{version}-%{release}
|
||||
Source0: %{name}-%{version}.tar.gz
|
||||
URL: http://www.tencent.com
|
||||
ExclusiveArch: aarch64
|
||||
Distribution: Tencent Linux
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-build
|
||||
BuildRequires: wget bc module-init-tools curl
|
||||
BuildRequires: elfutils-devel zlib-devel binutils-devel newt-devel perl(ExtUtils::Embed) bison flex
|
||||
BuildRequires: xmlto asciidoc
|
||||
BuildRequires: audit-libs-devel
|
||||
%if 0%{?rhel} == 8
|
||||
BuildRequires: python2-devel
|
||||
%else
|
||||
BuildRequires: python-devel
|
||||
%endif
|
||||
%ifnarch s390 s390x
|
||||
BuildRequires: numactl-devel
|
||||
%endif
|
||||
|
||||
# for the 'hostname' command
|
||||
%if 0%{?rhel} == 7
|
||||
BuildRequires: hostname
|
||||
%else
|
||||
BuildRequires: net-tools
|
||||
%endif
|
||||
|
||||
%description
|
||||
This package contains the perf tool, which enables performance monitoring
|
||||
of the Linux kernel.
|
||||
|
||||
|
||||
%package -n python-perf
|
||||
Summary: Python bindings for apps which will manipulate perf events
|
||||
Group: Development/Libraries
|
||||
%description -n python-perf
|
||||
The python-perf package contains a module that permits applications
|
||||
written in the Python programming language to use the interface
|
||||
to manipulate perf events.
|
||||
|
||||
|
||||
%package -n bpftool
|
||||
Summary: Inspection and simple manipulation of eBPF programs and maps
|
||||
License: GPLv2
|
||||
BuildRequires: llvm
|
||||
%if 0%{?rhel} == 7
|
||||
BuildRequires: python2-docutils
|
||||
%else
|
||||
BuildRequires: python3-docutils
|
||||
%endif
|
||||
%description -n bpftool
|
||||
This package contains the bpftool, which allows inspection and simple
|
||||
manipulation of eBPF programs and maps.
|
||||
|
||||
|
||||
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
|
||||
|
||||
|
||||
# prep #########################################################################
|
||||
%prep
|
||||
|
||||
%setup -q -c -T -a 0
|
||||
|
||||
# build ########################################################################
|
||||
%build
|
||||
|
||||
|
||||
if [ ! -f /etc/tlinux-release ]; then
|
||||
echo "Error: please build this rpm on tlinux\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
cd %{name}-%{version}
|
||||
all_types="%{kernel_all_types}"
|
||||
num_processor=`cat /proc/cpuinfo | grep 'processor' | wc -l`
|
||||
if [ $num_processor -gt 8 ]; then
|
||||
num_processor=8
|
||||
fi
|
||||
|
||||
%global perf_make make %{?_smp_mflags} -C tools/perf -s V=1 WERROR=0 NO_LIBUNWIND=1 HAVE_CPLUS_DEMANGLE=1 NO_GTK2=1 NO_STRLCPY=1 prefix=%{_prefix} lib=%{_lib}
|
||||
# perf
|
||||
%{perf_make} all
|
||||
%{perf_make} man
|
||||
|
||||
# bpftool
|
||||
%{bpftool_make}
|
||||
|
||||
# install ######################################################################
|
||||
%install
|
||||
cd %{name}-%{version}
|
||||
%{perf_make} DESTDIR=$RPM_BUILD_ROOT install
|
||||
mkdir -p %{buildroot}%{_libdir}
|
||||
touch %{buildroot}%{_libdir}/libperf-jvmti.so
|
||||
rm -rf %{buildroot}%{_bindir}/trace
|
||||
|
||||
# perf-python extension
|
||||
%{perf_make} DESTDIR=$RPM_BUILD_ROOT install-python_ext
|
||||
|
||||
# perf man pages (note: implicit rpm magic compresses them later)
|
||||
%{perf_make} DESTDIR=$RPM_BUILD_ROOT install-man
|
||||
|
||||
%{bpftool_make} install doc-install
|
||||
/usr/lib/rpm/brp-compress
|
||||
|
||||
%pre
|
||||
# pre #########################################################################
|
||||
system_arch=`uname -m`
|
||||
|
||||
if [ %{_target_cpu} != ${system_arch} ]; then
|
||||
echo "ERROR: Failed installing this rpm!!!!"
|
||||
echo "This rpm is intended for %{_target_cpu} platform. It seems your system is ${system_arch}.";
|
||||
exit 1;
|
||||
fi;
|
||||
|
||||
if [ ! -f /etc/tlinux-release -o ! -f /etc/redhat-release ]; then
|
||||
echo "Error: Cannot install this rpm on non-tlinux OS"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
%post
|
||||
# post #########################################################################
|
||||
|
||||
|
||||
%postun
|
||||
|
||||
%files
|
||||
%defattr(-,root,root)
|
||||
%{_bindir}/perf*
|
||||
%{_sysconfdir}/bash_completion.d/perf
|
||||
%dir %{_prefix}/lib/perf
|
||||
%{_prefix}/lib/perf/*
|
||||
%dir %{_libdir}/traceevent/
|
||||
%{_libdir}/traceevent/*
|
||||
%{_libdir}/libperf-jvmti.so
|
||||
%dir %{_libexecdir}/perf-core
|
||||
%{_libexecdir}/perf-core/*
|
||||
%{_datadir}/perf-core/*
|
||||
%{_docdir}/perf-tip/tips.txt
|
||||
%{_mandir}/man[1-8]/perf*
|
||||
|
||||
%files -n python-perf
|
||||
%defattr(-,root,root)
|
||||
%{python_sitearch}
|
||||
|
||||
%files -n bpftool
|
||||
%defattr(-,root,root)
|
||||
%{_sbindir}/bpftool
|
||||
%{_sysconfdir}/bash_completion.d/bpftool
|
||||
%{_mandir}/man8/bpftool*.gz
|
||||
%{_mandir}/man7/bpf-helpers.7.gz
|
||||
|
||||
|
||||
# changelog ###################################################################
|
||||
%changelog
|
||||
* Thu Feb 2 2012 Samuel Liao <samuelliao@tencent.com>
|
||||
- Initial 3.0.18 repository
|
||||
|
|
@ -1,207 +0,0 @@
|
|||
#!/bin/bash
|
||||
# ==============================================================================
|
||||
# Description: Automaticly generating kernel rpm package with specified branch
|
||||
# according to HEAD tag.
|
||||
#
|
||||
# Author: David Shan <davidshan@tencent.com>
|
||||
# ===============================================================================
|
||||
|
||||
#variables
|
||||
kernel_full_name=""
|
||||
kernel_version=""
|
||||
tlinux_branch=""
|
||||
tlinux_release=""
|
||||
curdir=`pwd`
|
||||
|
||||
|
||||
build_specdir=`readlink -f ~/rpmbuild/SPECS`
|
||||
build_srcdir=`readlink -f ~/rpmbuild/SOURCES`
|
||||
dist="tl2"
|
||||
|
||||
kernel_type="default"
|
||||
spec_file_name=""
|
||||
make_jobs=""
|
||||
tag_name=""
|
||||
nosign_suffix=""
|
||||
build_src_only=0
|
||||
strip_sign_token=0
|
||||
# to control wheter to build rpm for xen domU
|
||||
isXenU=""
|
||||
kernel_default_types=(default)
|
||||
|
||||
#funcitons
|
||||
usage()
|
||||
{
|
||||
echo "generate-rpms [-t \$tag_name ] [-k \$kernel_type ] [-j \$jobs ][-h][-x \$arch]"
|
||||
echo " -t tag_name"
|
||||
echo " Tagged name in the git tree."
|
||||
echo " -k kernel_type"
|
||||
echo " Kernel type is default, state, container or user-specified type."
|
||||
echo " If -k parameter is not set, we will compile standard three kernels of default, state and container."
|
||||
echo " For user-specified type kernel, only compile individually."
|
||||
echo " -j jobs"
|
||||
echo " Specifies the number of jobs (threads) to run make."
|
||||
echo " -x arch"
|
||||
echo " switch to build rpm for xen domU. arch is 32 or 64."
|
||||
echo " -d"
|
||||
echo " disable module digital signature."
|
||||
|
||||
echo -e "\n"
|
||||
echo " Note:By default, we only generate latest tag kernel for standard kernels"
|
||||
echo " without -t and -k option."
|
||||
echo " So, if you hope to get certain tag kernel, please use -t."
|
||||
echo " Also, only for state type kernel, please use -k option with state value."
|
||||
}
|
||||
|
||||
get_kernel_version()
|
||||
{
|
||||
tagged_name=${tag_name#arm64-}
|
||||
kernel_version=`echo $tagged_name|cut -d- -f1`
|
||||
#kernel_version=${kernel_version}-1
|
||||
#echo "kernel version: $kernel_version"
|
||||
echo "kernel version: ${kernel_version}"
|
||||
}
|
||||
|
||||
get_tlinux_name()
|
||||
{
|
||||
if [ -n "$tag_name" ]; then
|
||||
tagged_name="$tag_name"
|
||||
else
|
||||
tagged_name=`git describe --tags`
|
||||
fi
|
||||
|
||||
if [ -z "${tagged_name}" ];then
|
||||
echo "Error:Can't get kernel version from git tree."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
tagged_name=${tagged_name#arm64-}
|
||||
echo "${tagged_name}" | grep 'kvm_guest'
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "start kvm guest build"
|
||||
kvm_guest="yes"
|
||||
fi
|
||||
|
||||
#if [ "${tagged_name#*-*-*}" != ${tagged_name} ];then
|
||||
#echo "Error: bad tag name:$tagged_name."
|
||||
#exit 1
|
||||
#fi
|
||||
|
||||
|
||||
release=`echo $tagged_name|cut -d- -f2`
|
||||
|
||||
tlinux_branch=`echo $tagged_name|cut -d- -f3`
|
||||
|
||||
if [ $release -eq 19 ]; then
|
||||
rpm_name="kernel"
|
||||
tlinux_release=`echo $tagged_name|cut -d- -f2`.`echo $tagged_name|cut -d- -f3`
|
||||
else
|
||||
rpm_name="kernel"-${tlinux_branch}
|
||||
tlinux_release=`echo $tagged_name|cut -d- -f2`.`echo $tagged_name|cut -d- -f4`
|
||||
fi
|
||||
|
||||
echo "rpm_name $rpm_name"
|
||||
#tlinux_release=${tagged_name#*-}
|
||||
kernel_full_name=${rpm_name}-${kernel_version}
|
||||
echo $kernel_full_name
|
||||
#exit 1
|
||||
}
|
||||
|
||||
prepare_tlinux_spec()
|
||||
{
|
||||
spec_file_name=${build_specdir}/${kernel_full_name}_${dist}.spec
|
||||
spec_contents="%define name ${rpm_name} \n"
|
||||
spec_contents+="%define version ${kernel_version} \n"
|
||||
spec_contents+="%define release_os ${tlinux_release} \n"
|
||||
spec_contents+="%define title ${tlinux_branch} \n"
|
||||
spec_contents+="%define tagged_name ${tagged_name} \n"
|
||||
|
||||
echo -e "${spec_contents}" > $spec_file_name
|
||||
|
||||
if [ "$kvm_guest" = "yes" ] ; then
|
||||
cat $curdir/kernel-tlinux_kvmguest_${dist}.spec >> $spec_file_name
|
||||
else
|
||||
cat $curdir/kernel-tlinux_${dist}.spec >> $spec_file_name
|
||||
#cp $curdir/${kernel_full_name}_${dist}.spec $spec_file_name
|
||||
fi
|
||||
}
|
||||
|
||||
prepare_tlinux_bin_sources()
|
||||
{
|
||||
local kernel_tl3_rpm=${rpm_name}-${kernel_version}-${tlinux_release}.tl3.aarch64.rpm
|
||||
local kernel_debuginfo_tl3_rpm=${rpm_name}-debuginfo-common-${kernel_version}-${tlinux_release}.tl3.aarch64.rpm
|
||||
local kernel_headers_tl3_rpm=${rpm_name}-headers-${kernel_version}-${tlinux_release}.tl3.aarch64.rpm
|
||||
local kernel_devel_tl3_rpm=${rpm_name}-devel-${kernel_version}-${tlinux_release}.tl3.aarch64.rpm
|
||||
|
||||
if [ ! -f $kernel_tl3_rpm ]; then
|
||||
echo "$kernel_tl3_rpm not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f $kernel_debuginfo_tl3_rpm ]; then
|
||||
echo "$kernel_debuginfo_tl3_rpm not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f $kernel_headers_tl3_rpm ]; then
|
||||
echo "$kernel_headers_tl3_rpm not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f $kernel_devel_tl3_rpm ]; then
|
||||
echo "$kernel_devel_tl3_rpm not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rm -rf ${rpm_name}-${kernel_version}
|
||||
rm -rf ${rpm_name}-${kernel_version}_bin.tar.gz
|
||||
mkdir ${rpm_name}-${kernel_version}
|
||||
pushd .
|
||||
cd ${rpm_name}-${kernel_version}
|
||||
rpm2cpio ../$kernel_tl3_rpm | cpio -divm
|
||||
rpm2cpio ../$kernel_debuginfo_tl3_rpm | cpio -divm
|
||||
rpm2cpio ../$kernel_headers_tl3_rpm | cpio -divm
|
||||
rpm2cpio ../$kernel_devel_tl3_rpm | cpio -divm
|
||||
popd
|
||||
tar -czvf ${rpm_name}-${kernel_version}_bin.tar.gz ${rpm_name}-${kernel_version}
|
||||
}
|
||||
|
||||
#main function
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "please specify tag"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
tag_name=$1
|
||||
|
||||
if [ ! -e "${build_srcdir}" ]; then
|
||||
mkdir $build_srcdir
|
||||
[ $? == 1 ] && exit 1
|
||||
fi
|
||||
|
||||
if [ ! -e "${build_specdir}" ]; then
|
||||
mkdir $build_specdir
|
||||
[ $? == 1 ] && exit 1
|
||||
fi
|
||||
|
||||
origsrc=`pwd`
|
||||
|
||||
get_kernel_version $origsrc
|
||||
get_tlinux_name
|
||||
prepare_tlinux_bin_sources
|
||||
echo "Prepare $kernel_full_name source."
|
||||
prepare_tlinux_spec
|
||||
|
||||
|
||||
if test -e ${build_srcdir}/${kernel_full_name}; then
|
||||
rm -fr ${build_srcdir}/${kernel_full_name}
|
||||
fi
|
||||
|
||||
rm -rf /var/tmp/${kernel_full_name}
|
||||
|
||||
cp ${kernel_full_name}_bin.tar.gz ${build_srcdir}/
|
||||
|
||||
echo "Build kernel rpm package."
|
||||
|
||||
rpmbuild -bb ${target} ${spec_file_name}
|
||||
|
|
@ -1,231 +0,0 @@
|
|||
%global with_debuginfo 0
|
||||
%global with_perf 1
|
||||
%if 0%{?rhel} == 6
|
||||
%global rdist .tl1
|
||||
%global debug_path /usr/lib/debug/lib/
|
||||
%else
|
||||
%global debug_path /usr/lib/debug/usr/lib/
|
||||
%if 0%{?rhel} == 7
|
||||
%global rdist .tl2
|
||||
%global _enable_debug_packages %{nil}
|
||||
%global debug_package %{nil}
|
||||
%global __debug_package %{nil}
|
||||
%global __debug_install_post %{nil}
|
||||
%global _build_id_links none
|
||||
%endif
|
||||
%if 0%{?rhel} == 8
|
||||
%global rdist .tl3
|
||||
%global __python /usr/bin/python2
|
||||
%global _enable_debug_packages %{nil}
|
||||
%global debug_package %{nil}
|
||||
%global __debug_package %{nil}
|
||||
%global __debug_install_post %{nil}
|
||||
%global _build_id_links none
|
||||
%endif
|
||||
%endif
|
||||
|
||||
%global dist %{nil}
|
||||
|
||||
Summary: Kernel for Tencent physical machine
|
||||
Name: %{name}
|
||||
Version: %{version}
|
||||
Release: %{release_os}%{?rdist}
|
||||
License: GPLv2
|
||||
Vendor: Tencent
|
||||
Packager: tlinux team <g_CAPD_SRDC_OS@tencent.com>
|
||||
Provides: kernel = %{version}-%{release}
|
||||
Group: System Environment/Kernel
|
||||
Source0: %{name}-%{version}_bin.tar.gz
|
||||
Source1: tlinux_cciss_link.modules
|
||||
URL: http://www.tencent.com
|
||||
ExclusiveArch: aarch64
|
||||
Distribution: Tencent Linux
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-build
|
||||
BuildRequires: wget bc module-init-tools curl
|
||||
%if %{with_perf}
|
||||
BuildRequires: elfutils-devel zlib-devel binutils-devel newt-devel perl(ExtUtils::Embed) bison flex
|
||||
BuildRequires: xmlto asciidoc hmaccalc
|
||||
BuildRequires: audit-libs-devel
|
||||
#BuildRequires: uboot-tools
|
||||
%if 0%{?rhel} == 8
|
||||
BuildRequires: python2-devel
|
||||
%else
|
||||
BuildRequires: python-devel
|
||||
%endif
|
||||
|
||||
|
||||
%ifnarch s390 s390x
|
||||
BuildRequires: numactl-devel
|
||||
%endif
|
||||
%endif
|
||||
Requires(pre): linux-firmware >= 20100806-2
|
||||
|
||||
# for the 'hostname' command
|
||||
%if 0%{?rhel} == 7
|
||||
BuildRequires: hostname
|
||||
%else
|
||||
BuildRequires: net-tools
|
||||
%endif
|
||||
|
||||
%description
|
||||
This package contains tlinux kernel for arm64 Bare-Metal& VM
|
||||
|
||||
%package debuginfo-common
|
||||
Summary: tlinux kernel vmlinux for crash debug
|
||||
Release: %{release}
|
||||
Group: System Environment/Kernel
|
||||
Provides: kernel-debuginfo-common kernel-debuginfo
|
||||
AutoReqprov: no
|
||||
|
||||
%description debuginfo-common
|
||||
This package container vmlinux, System.map and config files for kernel
|
||||
debugging.
|
||||
|
||||
%package devel
|
||||
Summary: Development package for building kernel modules to match the %{version}-%{release} kernel
|
||||
Release: %{release}
|
||||
Group: System Environment/Kernel
|
||||
AutoReqprov: no
|
||||
|
||||
%description devel
|
||||
This package provides kernel headers and makefiles sufficient to build modules
|
||||
against the %{version}-%{release} kernel package.
|
||||
|
||||
|
||||
%package headers
|
||||
Summary: Header files for the Linux kernel for use by glibc
|
||||
Group: Development/System
|
||||
Obsoletes: glibc-kernheaders
|
||||
Provides: glibc-kernheaders = 3.0-46
|
||||
AutoReqprov: no
|
||||
|
||||
%description headers
|
||||
Kernel-headers includes the C header files that specify the interface
|
||||
between the Linux kernel and userspace libraries and programs. The
|
||||
header files define structures and constants that are needed for
|
||||
building most standard programs and are also needed for rebuilding the
|
||||
glibc package.
|
||||
|
||||
|
||||
# prep #########################################################################
|
||||
%prep
|
||||
%setup -q -c -T -a 0
|
||||
|
||||
# build ########################################################################
|
||||
%build
|
||||
|
||||
|
||||
# install ######################################################################
|
||||
%install
|
||||
|
||||
|
||||
echo install %{version}
|
||||
arch=`uname -m`
|
||||
if [ "$arch" != "aarch64" ];then
|
||||
echo "Unexpected error. Cannot build this rpm in non-aarch64 platform\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd %{name}-%{version}
|
||||
|
||||
cp -rp * %buildroot/
|
||||
|
||||
elfname=vmlinuz-%{tagged_name}%{?dist}
|
||||
mapname=System.map-%{tagged_name}%{?dist}
|
||||
configname=config-%{tagged_name}%{?dist}
|
||||
|
||||
mkdir -p %buildroot/boot
|
||||
mv %buildroot/lib/modules/%tagged_name/vmlinuz %buildroot/boot/${elfname}
|
||||
mv %buildroot/lib/modules/%tagged_name/dist_compat/${mapname} %buildroot/boot/${mapname}
|
||||
mv %buildroot/lib/modules/%tagged_name/dist_compat/${configname} %buildroot/boot/${configname}
|
||||
mv %buildroot/lib/modules/%tagged_name/dist_compat/.vmlinuz-%{tagged_name}%{?dist}.hmac %buildroot/boot/
|
||||
|
||||
mv %buildroot/lib/modules/%tagged_name/dist_compat/modules.symbols.bin %buildroot/lib/modules/%tagged_name/
|
||||
mv %buildroot/lib/modules/%tagged_name/dist_compat/modules.symbols %buildroot/lib/modules/%tagged_name/
|
||||
mv %buildroot/lib/modules/%tagged_name/dist_compat/modules.softdep %buildroot/lib/modules/%tagged_name/
|
||||
mv %buildroot/lib/modules/%tagged_name/dist_compat/modules.devname %buildroot/lib/modules/%tagged_name/
|
||||
mv %buildroot/lib/modules/%tagged_name/dist_compat/modules.dep.bin %buildroot/lib/modules/%tagged_name/
|
||||
mv %buildroot/lib/modules/%tagged_name/dist_compat/modules.dep %buildroot/lib/modules/%tagged_name/
|
||||
mv %buildroot/lib/modules/%tagged_name/dist_compat/modules.builtin.bin %buildroot/lib/modules/%tagged_name/
|
||||
mv %buildroot/lib/modules/%tagged_name/dist_compat/modules.alias.bin %buildroot/lib/modules/%tagged_name/
|
||||
mv %buildroot/lib/modules/%tagged_name/dist_compat/modules.alias %buildroot/lib/modules/%tagged_name/
|
||||
|
||||
|
||||
|
||||
%pre
|
||||
# pre #########################################################################
|
||||
system_arch=`uname -m`
|
||||
|
||||
if [ %{_target_cpu} != ${system_arch} ]; then
|
||||
echo "ERROR: Failed installing this rpm!!!!"
|
||||
echo "This rpm is intended for %{_target_cpu} platform. It seems your system is ${system_arch}.";
|
||||
exit 1;
|
||||
fi;
|
||||
|
||||
%post
|
||||
# post #########################################################################
|
||||
echo "Install tlinux kernel"
|
||||
%if 0%{?rhel} == 8
|
||||
kernel-install add %{tagged_name} /lib/modules/%{tagged_name}/vmlinuz
|
||||
cp -p /lib/modules/%{tagged_name}/dist_compat/config-%{tagged_name}%{?dist} /boot
|
||||
cp -p /lib/modules/%{tagged_name}/dist_compat/.vmlinuz-%{tagged_name}%{?dist}.hmac /boot
|
||||
cp -p /lib/modules/%{tagged_name}/dist_compat/System.map-%{tagged_name}%{?dist} /boot
|
||||
%else
|
||||
%if 0%{?rhel} == 7
|
||||
/sbin/new-kernel-pkg --package kernel --install %{tagged_name}%{?dist} --make-default|| exit $?
|
||||
echo -e "Set Grub default to \"%{tagged_name}%{?dist}\" Done."
|
||||
%endif
|
||||
%endif
|
||||
|
||||
%preun
|
||||
# preun #######################################################################
|
||||
%if 0%{?rhel} == 8
|
||||
kernel-install remove %{tagged_name}
|
||||
%else
|
||||
%if 0%{?rhel} == 7
|
||||
/sbin/new-kernel-pkg --rminitrd --dracut --remove %{tagged_name}%{?dist} || exit $?
|
||||
echo -e "Remove \"%{tagged_name}%{?dist}\" Done."
|
||||
%endif
|
||||
%endif
|
||||
|
||||
%posttrans
|
||||
# posttrans ####################################################################
|
||||
%if 0%{?rhel} == 7
|
||||
/sbin/new-kernel-pkg --package kernel --mkinitrd --dracut --depmod --update %{tagged_name}%{?dist} || exit $?
|
||||
/sbin/new-kernel-pkg --package kernel --rpmposttrans %{tagged_name}%{?dist} || exit $?
|
||||
%endif
|
||||
|
||||
%files
|
||||
# files ########################################################################
|
||||
%defattr(-,root,root)
|
||||
/boot/vmlinuz-%%{tagged_name}%%{?dist}
|
||||
/boot/.vmlinuz-%%{tagged_name}%%{?dist}.hmac
|
||||
#/boot/uImage-%%{tagged_name}%%{?dist}
|
||||
/boot/System.map-%%{tagged_name}%%{?dist}
|
||||
/boot/config-%%{tagged_name}%%{?dist}
|
||||
/boot/symvers-%{tagged_name}%{?dist}*
|
||||
/etc/sysconfig/modules/tlinux_cciss_link.modules
|
||||
/lib/modules/%%{tagged_name}/*
|
||||
#do not package firmware ,use linux-firmware rpm instead
|
||||
#/lib/firmware/
|
||||
|
||||
%files debuginfo-common
|
||||
%defattr(-,root,root)
|
||||
/boot/vmlinux-%{tagged_name}%{?dist}
|
||||
%dir %debug_path
|
||||
%debug_path/modules
|
||||
#/boot/System.map-%%{version}-%%{title}-%%{release_os}-*
|
||||
#/boot/config-%%{version}-%%{title}-%%{release_os}-*
|
||||
|
||||
%files headers
|
||||
%defattr(-,root,root)
|
||||
/usr/include/*
|
||||
|
||||
%files devel
|
||||
%defattr(-,root,root)
|
||||
/usr/src/kernels/%{tagged_name}%{?dist}
|
||||
|
||||
# changelog ###################################################################
|
||||
%changelog
|
||||
* Mon Mar 11 2019 Jia Wang <jasperwang@tencent.com>
|
||||
- Initial 4.14.99 repository
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ -b /dev/sda -a ! -b /dev/cciss/c0d0 ]; then
|
||||
mkdir -p /dev/cciss
|
||||
set -- 0 a 1 b 2 c 3 d 4 e 5 f 6 g 7 h 8 i 9 j 10 k 11 l 12 m 13 n 14 o 15 p
|
||||
while [ $# -ge 2 ]; do
|
||||
c=/dev/cciss/c0d$1; shift
|
||||
s=/dev/sd$1; shift
|
||||
ln -s ${s} ${c}
|
||||
ln -s ${s}1 ${c}p1
|
||||
ln -s ${s}2 ${c}p2
|
||||
ln -s ${s}3 ${c}p3
|
||||
ln -s ${s}4 ${c}p4
|
||||
done
|
||||
fi
|
||||
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
# See 'cpupower help' and cpupower(1) for more info
|
||||
CPUPOWER_START_OPTS="frequency-set -g performance"
|
||||
CPUPOWER_STOP_OPTS="frequency-set -g ondemand"
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
[Unit]
|
||||
Description=Configure CPU power related settings
|
||||
After=syslog.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
RemainAfterExit=yes
|
||||
EnvironmentFile=/etc/sysconfig/cpupower
|
||||
ExecStart=/usr/bin/cpupower $CPUPOWER_START_OPTS
|
||||
ExecStop=/usr/bin/cpupower $CPUPOWER_STOP_OPTS
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
|
@ -1,265 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# ==============================================================================
|
||||
# Description: Automaticly generating kernel rpm package with specified branch
|
||||
# according to HEAD tag.
|
||||
#
|
||||
# Author: David Shan <davidshan@tencent.com>
|
||||
# ===============================================================================
|
||||
|
||||
#variables
|
||||
kernel_full_name=""
|
||||
kernel_version=""
|
||||
tlinux_release=""
|
||||
curdir=`pwd`
|
||||
build_specdir="/usr/src/packages/SPECS"
|
||||
build_srcdir="/usr/src/packages/SOURCES"
|
||||
kernel_type="default"
|
||||
spec_file_name=""
|
||||
make_jobs=""
|
||||
nosign_suffix=""
|
||||
build_src_only=0
|
||||
strip_sign_token=0
|
||||
tagged_name=""
|
||||
kasan=0
|
||||
# to control wheter to build rpm for xen domU
|
||||
isXenU=""
|
||||
build_perf_tools=""
|
||||
kernel_default_types=(default)
|
||||
|
||||
#funcitons
|
||||
usage()
|
||||
{
|
||||
echo "generate-rpms [-t \$tag_name ] [-j \$jobs ][-h]"
|
||||
echo " -t tag_name"
|
||||
echo " Tagged name in the git tree."
|
||||
echo " -j jobs"
|
||||
echo " Specifies the number of jobs (threads) to run make."
|
||||
echo " -d"
|
||||
echo " disable module digital signature."
|
||||
echo " -p"
|
||||
echo " build perf and other kernel tools rpm only."
|
||||
echo " -c"
|
||||
echo " enable kabi check."
|
||||
|
||||
echo -e "\n"
|
||||
echo " Note:By default, we only generate latest tag kernel for standard kernels"
|
||||
echo " without -t and -k option."
|
||||
echo " So, if you hope to get certain tag kernel, please use -t."
|
||||
echo " Also, only for state type kernel, please use -k option with state value."
|
||||
}
|
||||
|
||||
get_kernel_version()
|
||||
{
|
||||
local makefile="$1/Makefile"
|
||||
|
||||
if [ ! -e $makefile ]; then
|
||||
echo "Error: No Makefile found."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
kernel_version+=`grep "^VERSION" ${makefile} | head -1 | awk -F "=" '{print $2}' | tr -d ' '`
|
||||
kernel_version+="."
|
||||
kernel_version+=`grep "^PATCHLEVEL" ${makefile} | head -1 | awk -F "=" '{print $2}' | tr -d ' '`
|
||||
kernel_version+="."
|
||||
kernel_version+=`grep "^SUBLEVEL" ${makefile} | head -1 | awk -F "=" '{print $2}' | tr -d ' '`
|
||||
#kernel_version+=`grep "^EXTRAVERSION" ${makefile} | head -1 | awk -F "=" '{print $2}' | tr -d ' '`
|
||||
|
||||
echo "kernel version: $kernel_version"
|
||||
}
|
||||
|
||||
get_tlinux_name()
|
||||
{
|
||||
if [ -n "$tag_name" ]; then
|
||||
tagged_name="$tag_name"
|
||||
else
|
||||
tagged_name=`git describe --tags`
|
||||
fi
|
||||
|
||||
if [ -z "${tagged_name}" ];then
|
||||
echo "Error:Can't get kernel version from git tree."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
tagged_name=${tagged_name#x86-}
|
||||
echo "${tagged_name}" | grep 'kasan'
|
||||
if [ $? -eq 0 ]; then
|
||||
kasan=1
|
||||
fi
|
||||
|
||||
if [ "$build_perf_tools" = "yes" ]; then
|
||||
rpm_name="perf"
|
||||
else
|
||||
rpm_name="kernel"
|
||||
fi
|
||||
|
||||
tlinux_release=`echo $tagged_name|cut -d- -f2`.`echo $tagged_name|cut -d- -f3`
|
||||
extra_version=`echo $tagged_name | cut -d- -f2`
|
||||
kernel_full_name=${rpm_name}-${kernel_version}
|
||||
|
||||
echo "$kernel_version"
|
||||
echo "$tlinux_release"
|
||||
echo "$kernel_full_name"
|
||||
echo "extra_version $extra_version"
|
||||
}
|
||||
|
||||
prepare_tlinux_spec()
|
||||
{
|
||||
local sign_token
|
||||
spec_file_name=${build_specdir}/${kernel_full_name}.spec
|
||||
spec_contents="%define name ${rpm_name} \n"
|
||||
spec_contents+="%define version ${kernel_version} \n"
|
||||
spec_contents+="%define release_os ${tlinux_release} \n"
|
||||
spec_contents+="%define tagged_name ${tagged_name} \n"
|
||||
spec_contents+="%define extra_version ${extra_version} \n"
|
||||
|
||||
if [ "${check_kabi}" = "yes" ]; then
|
||||
check_kabi=1
|
||||
else
|
||||
check_kabi=0
|
||||
fi
|
||||
spec_contents+="%define with_kabichk ${check_kabi} \n"
|
||||
|
||||
if [ -z "${kernel_type}" ];then
|
||||
spec_contents+="%define kernel_all_types ${kernel_default_types[@]} \n"
|
||||
else
|
||||
spec_contents+="%define kernel_all_types ${kernel_type} \n"
|
||||
fi
|
||||
|
||||
if [ -n "${make_jobs}" ];then
|
||||
spec_contents+="%define jobs ${make_jobs} \n\n"
|
||||
fi
|
||||
|
||||
if [ -e /etc/redhat-release ];then
|
||||
spec_contents+="%define debug_package %{nil}\n"
|
||||
spec_contents+="%define __os_install_post %{nil}\n"
|
||||
|
||||
fi
|
||||
|
||||
echo -e "${spec_contents}" > $spec_file_name
|
||||
|
||||
if [ "$build_perf_tools" = "yes" ]; then
|
||||
cat $curdir/perf-tools-tlinux.spec >> $spec_file_name
|
||||
else
|
||||
cat $curdir/kernel-tlinux.spec >> $spec_file_name
|
||||
fi
|
||||
}
|
||||
|
||||
#main function
|
||||
|
||||
#Parse Parameters
|
||||
while getopts ":t:k:j:hdcpx:" option "$@"
|
||||
do
|
||||
case $option in
|
||||
"t" )
|
||||
tag_name=$OPTARG
|
||||
;;
|
||||
"j" )
|
||||
make_jobs=$OPTARG
|
||||
;;
|
||||
"h" )
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
"p" )
|
||||
build_perf_tools="yes"
|
||||
;;
|
||||
"c" )
|
||||
echo "-c kabi check enabled!"
|
||||
check_kabi="yes"
|
||||
;;
|
||||
"?" )
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
#test if parameter of kernel type is valid
|
||||
if [ -n "${kernel_type}" ] && [ ! -e config."${kernel_type}" ]
|
||||
then
|
||||
echo "Error: bad kernel type name. Config file for ${kernel_type} does not exist."
|
||||
usage
|
||||
exit 1
|
||||
elif [ -n "${kernel_type}" ] && [ -n "$isXenU" ] && [ ! -e config."${kernel_type}".xenU ]
|
||||
then
|
||||
echo "Error: bad kernel type name. Config file for ${kernel_type}.xenU does not exist."
|
||||
usage
|
||||
exit 1
|
||||
|
||||
fi
|
||||
|
||||
if [ -e /etc/SuSE-release ];then
|
||||
build_specdir="/usr/src/packages/SPECS"
|
||||
build_srcdir="/usr/src/packages/SOURCES"
|
||||
elif [ -e /etc/redhat-release ];then
|
||||
build_specdir="$HOME/rpmbuild/SPECS"
|
||||
build_srcdir="$HOME/rpmbuild/SOURCES"
|
||||
else
|
||||
echo "Error: Compile on unknown system."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -e "${build_srcdir}" ]; then
|
||||
mkdir $build_srcdir
|
||||
[ $? == 1 ] && exit 1
|
||||
fi
|
||||
|
||||
if [ ! -e "${build_specdir}" ]; then
|
||||
mkdir $build_specdir
|
||||
[ $? == 1 ] && exit 1
|
||||
fi
|
||||
|
||||
cd ../../
|
||||
origsrc=`pwd`
|
||||
|
||||
|
||||
if [ $kasan -eq 1 ]; then
|
||||
nosign_suffix="_kasan"
|
||||
else
|
||||
nosign_suffix=""
|
||||
fi
|
||||
|
||||
get_kernel_version $origsrc
|
||||
get_tlinux_name
|
||||
echo "Prepare $kernel_full_name source."
|
||||
prepare_tlinux_spec
|
||||
|
||||
cp package/default/tlinux_cciss_link.modules $build_srcdir
|
||||
cp package/default/cpupower.service $build_srcdir
|
||||
cp package/default/cpupower.config $build_srcdir
|
||||
|
||||
if test -e ${build_srcdir}/${kernel_full_name}; then
|
||||
rm -fr ${build_srcdir}/${kernel_full_name}
|
||||
fi
|
||||
|
||||
#tagged_name is a confirmed tag name and will be used for final source.
|
||||
git archive --format=tar --prefix=${kernel_full_name}/ ${tag_name} | (cd ${build_srcdir} && tar xf -)
|
||||
if [ $? -ne 0 ];then
|
||||
echo "Error:can't prepare $kernel_full_name source with git archive!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd ${build_srcdir}/${kernel_full_name}
|
||||
|
||||
echo $config_suffix
|
||||
|
||||
cd ..
|
||||
tar -zcf ${kernel_full_name}.tar.gz ${kernel_full_name}
|
||||
rm -fr ${kernel_full_name}
|
||||
|
||||
echo "Build kernel rpm package."
|
||||
if [ $build_src_only -eq 0 ]; then
|
||||
rpmbuild -bb ${target} ${spec_file_name}
|
||||
fi
|
||||
|
||||
echo "Build kernel source rpm package."
|
||||
pwd
|
||||
tar -zxf ${kernel_full_name}.tar.gz
|
||||
|
||||
rm -fr ${kernel_full_name}/package/default/generate-rpms.sh
|
||||
tar -zcf ${kernel_full_name}.tar.gz ${kernel_full_name}
|
||||
|
||||
rpmbuild -bs ${target} ${spec_file_name}
|
||||
|
||||
|
|
@ -1,759 +0,0 @@
|
|||
%global with_debuginfo 0
|
||||
%global with_perf 1
|
||||
%global with_tools 1
|
||||
%global with_bpftool 1
|
||||
%if 0%{?rhel} == 6
|
||||
%global rdist .tl1
|
||||
%global debug_path /usr/lib/debug/lib/
|
||||
%else
|
||||
%global debug_path /usr/lib/debug/usr/lib/
|
||||
%if 0%{?rhel} == 7
|
||||
%global rdist .tl2
|
||||
%else
|
||||
%if 0%{?rhel} == 8
|
||||
%global rdist .tl3
|
||||
%global __python /usr/bin/python2
|
||||
%global _enable_debug_packages %{nil}
|
||||
%global debug_package %{nil}
|
||||
%global __debug_package %{nil}
|
||||
%global __debug_install_post %{nil}
|
||||
%global _build_id_links none
|
||||
%endif
|
||||
%endif
|
||||
%endif
|
||||
|
||||
%global dist %{nil}
|
||||
|
||||
%global build_env DESTDIR="%{buildroot}" prefix=%{_prefix} lib=%{_lib} PYTHON=%{__python3} INSTALL_ROOT=%{buildroot}
|
||||
%global bpftool_make make %{?_smp_mflags} -C tools/bpf/bpftool %{build_env} mandir=%{_mandir} bash_compdir=%{_sysconfdir}/bash_completion.d/
|
||||
|
||||
# Architectures we build tools/cpupower on
|
||||
%define cpupowerarchs x86_64 aarch64
|
||||
|
||||
Summary: Kernel for Tencent physical machine
|
||||
Name: %{name}
|
||||
Version: %{version}
|
||||
Release: %{release_os}%{?rdist}
|
||||
License: GPLv2
|
||||
Vendor: Tencent
|
||||
Packager: tlinux team <g_CAPD_SRDC_OS@tencent.com>
|
||||
Provides: kernel = %{version}-%{release}
|
||||
Group: System Environment/Kernel
|
||||
Source0: %{name}-%{version}.tar.gz
|
||||
Source1: tlinux_cciss_link.modules
|
||||
# Sources for kernel tools
|
||||
Source2000: cpupower.service
|
||||
Source2001: cpupower.config
|
||||
URL: http://www.tencent.com
|
||||
ExclusiveArch: x86_64
|
||||
Distribution: Tencent Linux
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-build
|
||||
BuildRequires: wget bc module-init-tools curl
|
||||
%if %{with_perf}
|
||||
BuildRequires: elfutils-devel zlib-devel binutils-devel newt-devel perl(ExtUtils::Embed) bison flex openssl-devel
|
||||
BuildRequires: xmlto asciidoc
|
||||
BuildRequires: audit-libs-devel
|
||||
%if 0%{?rhel} == 8
|
||||
BuildRequires: python2-devel
|
||||
%else
|
||||
BuildRequires: python-devel
|
||||
%endif
|
||||
%ifnarch s390 s390x
|
||||
BuildRequires: numactl-devel
|
||||
%endif
|
||||
%endif
|
||||
%if %{with_tools}
|
||||
BuildRequires: gettext ncurses-devel asciidoc
|
||||
%ifnarch s390x
|
||||
BuildRequires: pciutils-devel
|
||||
BuildRequires: libcap-devel
|
||||
%endif
|
||||
%endif
|
||||
%if %{with_bpftool}
|
||||
BuildRequires: llvm
|
||||
%if 0%{?rhel} == 7
|
||||
BuildRequires: python2-docutils
|
||||
%else
|
||||
BuildRequires: python3-docutils
|
||||
%endif
|
||||
BuildRequires: zlib-devel binutils-devel
|
||||
%endif
|
||||
Requires(pre): linux-firmware >= 20150904-44
|
||||
Requires(pre): grubby
|
||||
Requires(post): %{_sbindir}/new-kernel-pkg
|
||||
Requires(preun): %{_sbindir}/new-kernel-pkg
|
||||
|
||||
# for the 'hostname' command
|
||||
%if 0%{?rhel} >= 7
|
||||
BuildRequires: hostname
|
||||
%else
|
||||
BuildRequires: net-tools
|
||||
%endif
|
||||
|
||||
%description
|
||||
This package contains tlinux kernel, the core of operating system.
|
||||
|
||||
%package debuginfo-common
|
||||
Summary: tlinux kernel vmlinux for crash debug
|
||||
Release: %{release}
|
||||
Group: System Environment/Kernel
|
||||
Provides: kernel-debuginfo-common kernel-debuginfo
|
||||
Obsoletes: kernel-debuginfo
|
||||
AutoReqprov: no
|
||||
|
||||
%description debuginfo-common
|
||||
This package container vmlinux, System.map and config files for kernel
|
||||
debugging.
|
||||
|
||||
%package devel
|
||||
Summary: Development package for building kernel modules to match the %{version}-%{release} kernel
|
||||
Release: %{release}
|
||||
Group: System Environment/Kernel
|
||||
Provides: kernel-devel
|
||||
Obsoletes: kernel-devel
|
||||
AutoReqprov: no
|
||||
|
||||
%description devel
|
||||
This package provides kernel headers and makefiles sufficient to build modules
|
||||
against the %{version}-%{release} kernel package.
|
||||
|
||||
|
||||
%package headers
|
||||
Summary: Header files for the Linux kernel for use by glibc
|
||||
Group: Development/System
|
||||
Obsoletes: glibc-kernheaders
|
||||
Provides: glibc-kernheaders = 3.0-46
|
||||
Provides: kernel-headers
|
||||
Obsoletes: kernel-headers
|
||||
AutoReqprov: no
|
||||
|
||||
%description headers
|
||||
Kernel-headers includes the C header files that specify the interface
|
||||
between the Linux kernel and userspace libraries and programs. The
|
||||
header files define structures and constants that are needed for
|
||||
building most standard programs and are also needed for rebuilding the
|
||||
glibc package.
|
||||
|
||||
%if %{with_perf}
|
||||
%package -n perf
|
||||
Summary: Performance monitoring for the Linux kernel
|
||||
Group: Development/System
|
||||
License: GPLv2
|
||||
%description -n perf
|
||||
This package contains the perf tool, which enables performance monitoring
|
||||
of the Linux kernel.
|
||||
|
||||
%package -n perf-debuginfo
|
||||
Summary: Debug information for package perf
|
||||
Group: Development/Debug
|
||||
#Requires: %%{name}-debuginfo-common-%%{_target_cpu} = %%{version}-%%{release}
|
||||
AutoReqProv: no
|
||||
%description -n perf-debuginfo
|
||||
This package provides debug information for the perf package.
|
||||
|
||||
# Note that this pattern only works right to match the .build-id
|
||||
# symlinks because of the trailing nonmatching alternation and
|
||||
# the leading .*, because of find-debuginfo.sh's buggy handling
|
||||
# of matching the pattern against the symlinks file.
|
||||
%{expand:%%global debuginfo_args %{?debuginfo_args} -p '.*%%{_bindir}/perf(\.debug)?|.*%%{_libexecdir}/perf-core/.*|XXX' -o perf-debuginfo.list}
|
||||
|
||||
%package -n python-perf
|
||||
Summary: Python bindings for apps which will manipulate perf events
|
||||
Group: Development/Libraries
|
||||
%description -n python-perf
|
||||
The python-perf package contains a module that permits applications
|
||||
written in the Python programming language to use the interface
|
||||
to manipulate perf events.
|
||||
|
||||
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
|
||||
|
||||
%package -n python-perf-debuginfo
|
||||
Summary: Debug information for package perf python bindings
|
||||
Group: Development/Debug
|
||||
#Requires: %%{name}-debuginfo-common-%%{_target_cpu} = %%{version}-%%{release}
|
||||
AutoReqProv: no
|
||||
%description -n python-perf-debuginfo
|
||||
This package provides debug information for the perf python bindings.
|
||||
|
||||
# the python_sitearch macro should already be defined from above
|
||||
%{expand:%%global debuginfo_args %{?debuginfo_args} -p '.*%%{python_sitearch}/perf.so(\.debug)?|XXX' -o python-perf-debuginfo.list}
|
||||
|
||||
|
||||
%endif # with_perf
|
||||
|
||||
%if %{with_tools}
|
||||
%package -n kernel-tools
|
||||
Summary: Assortment of tools for the Linux kernel
|
||||
Group: Development/System
|
||||
License: GPLv2
|
||||
%ifarch %{cpupowerarchs}
|
||||
Provides: cpupowerutils = 1:009-0.6.p1
|
||||
Obsoletes: cpupowerutils < 1:009-0.6.p1
|
||||
Provides: cpufreq-utils = 1:009-0.6.p1
|
||||
Provides: cpufrequtils = 1:009-0.6.p1
|
||||
Obsoletes: cpufreq-utils < 1:009-0.6.p1
|
||||
Obsoletes: cpufrequtils < 1:009-0.6.p1
|
||||
Obsoletes: cpuspeed < 1:1.5-16
|
||||
%endif
|
||||
%description -n kernel-tools
|
||||
This package contains the tools/ directory from the kernel source
|
||||
and the supporting documentation.
|
||||
|
||||
%package -n kernel-tools-libs
|
||||
Summary: Libraries for the kernel-tools
|
||||
Group: Development/System
|
||||
License: GPLv2
|
||||
%description -n kernel-tools-libs
|
||||
This package contains the libraries built from the tools/ directory
|
||||
from the kernel source.
|
||||
%endif # with_tools
|
||||
|
||||
%if %{with_bpftool}
|
||||
%package -n bpftool
|
||||
Summary: Inspection and simple manipulation of eBPF programs and maps
|
||||
License: GPLv2
|
||||
%description -n bpftool
|
||||
This package contains the bpftool, which allows inspection and simple
|
||||
manipulation of eBPF programs and maps.
|
||||
|
||||
%package -n bpftool-debuginfo
|
||||
Summary: Debug information for package bpftool
|
||||
AutoReqProv: no
|
||||
%description -n bpftool-debuginfo
|
||||
This package provides debug information for the bpftool package.
|
||||
# debuginfo search rule
|
||||
%{expand:%%global debuginfo_args %{?debuginfo_args} -p '.*%%{_sbindir}/bpftool(\.debug)?|XXX' -o bpftool-debuginfo.list}
|
||||
%endif # with_bpftool
|
||||
|
||||
# prep #########################################################################
|
||||
%prep
|
||||
|
||||
%setup -q -c -T -a 0
|
||||
|
||||
# build ########################################################################
|
||||
%build
|
||||
|
||||
cd %{name}-%{version}
|
||||
|
||||
all_types="%{kernel_all_types}"
|
||||
num_processor=`cat /proc/cpuinfo | grep 'processor' | wc -l`
|
||||
if [ $num_processor -gt 8 ]; then
|
||||
num_processor=8
|
||||
fi
|
||||
for type_name in $all_types
|
||||
do
|
||||
sed -i '/^EXTRAVERSION/cEXTRAVERSION = -%{extra_version}' Makefile
|
||||
objdir=../%{name}-%{version}-obj-${type_name}
|
||||
[ -d ${objdir} ] || mkdir ${objdir}
|
||||
echo "include $PWD/Makefile" > ${objdir}/Makefile
|
||||
cp ./package/default/config.${type_name} ${objdir}/.config
|
||||
localversion='"'-`echo %{tagged_name}|cut -d- -f3-`%{?dist}'"'
|
||||
sed -i -e 's/CONFIG_LOCALVERSION=.*/CONFIG_LOCALVERSION='$localversion'/' ${objdir}/.config
|
||||
make -C ${objdir} olddefconfig > /dev/null
|
||||
smp_jobs=%{?jobs:%jobs}
|
||||
if [ "$smp_jobs" = "" ]; then
|
||||
make -j ${num_processor} -C ${objdir} RPM_BUILD_MODULE=y all
|
||||
else
|
||||
make -C ${objdir} RPM_BUILD_MODULE=y %{?jobs:-j%jobs} all
|
||||
fi
|
||||
# dealing with files under lib/modules
|
||||
make -C ${objdir} RPM_BUILD_MODULE=y modules
|
||||
|
||||
%global perf_make make %{?_smp_mflags} -C tools/perf -s V=1 WERROR=0 NO_LIBUNWIND=1 HAVE_CPLUS_DEMANGLE=1 NO_GTK2=1 NO_STRLCPY=1 prefix=%{_prefix} lib=%{_lib}
|
||||
%if %{with_perf}
|
||||
# perf
|
||||
%{perf_make} all
|
||||
%{perf_make} man
|
||||
%endif
|
||||
|
||||
%if %{with_tools}
|
||||
%ifarch %{cpupowerarchs}
|
||||
# cpupower
|
||||
# make sure version-gen.sh is executable.
|
||||
chmod +x tools/power/cpupower/utils/version-gen.sh
|
||||
make %{?_smp_mflags} -C tools/power/cpupower bash_completion_dir=%{_sysconfdir}/bash_completion.d/ CPUFREQ_BENCH=false
|
||||
%ifarch x86_64
|
||||
pushd tools/power/cpupower/debug/x86_64
|
||||
make %{?_smp_mflags} centrino-decode powernow-k8-decode
|
||||
popd
|
||||
%endif
|
||||
%ifarch x86_64
|
||||
pushd tools/power/x86/x86_energy_perf_policy/
|
||||
make
|
||||
popd
|
||||
pushd tools/power/x86/turbostat
|
||||
make
|
||||
popd
|
||||
%endif #turbostat/x86_energy_perf_policy
|
||||
%endif
|
||||
pushd tools
|
||||
make tmon
|
||||
popd
|
||||
%endif
|
||||
|
||||
%if %{with_bpftool}
|
||||
%{bpftool_make}
|
||||
%endif
|
||||
done
|
||||
|
||||
# install ######################################################################
|
||||
%install
|
||||
|
||||
echo install %{version}
|
||||
arch=`uname -m`
|
||||
if [ "$arch" != "x86_64" ];then
|
||||
echo "Unexpected error. Cannot build this rpm in non-x86_64 platform\n"
|
||||
exit 1
|
||||
fi
|
||||
mkdir -p %buildroot/boot
|
||||
cd %{name}-%{version}
|
||||
|
||||
all_types="%{kernel_all_types}"
|
||||
for type_name in $all_types
|
||||
do
|
||||
elfname=vmlinuz-%{tagged_name}%{?dist}
|
||||
mapname=System.map-%{tagged_name}%{?dist}
|
||||
configname=config-%{tagged_name}%{?dist}
|
||||
builddir=../%{name}-%{version}-obj-${type_name}
|
||||
%if 0%{?rhel} == 7
|
||||
cp -rpf ${builddir}/arch/x86/boot/bzImage %buildroot/boot/${elfname}
|
||||
%endif
|
||||
cp -rpf ${builddir}/System.map %buildroot/boot/${mapname}
|
||||
cp -rpf ${builddir}/.config %buildroot/boot/${configname}
|
||||
cp -rpf ${builddir}/vmlinux %buildroot/boot/vmlinux-%{tagged_name}%{?dist}
|
||||
sha512hmac %buildroot/boot/${elfname} | sed -e "s,$RPM_BUILD_ROOT,," > %buildroot/boot/.vmlinuz-%{tagged_name}%{?dist}.hmac
|
||||
|
||||
# dealing with kernel-devel package
|
||||
objdir=${builddir}
|
||||
#KernelVer=%{version}-%{title}-%{release_os}-${type_name}
|
||||
KernelVer=%{tagged_name}%{?dist}
|
||||
|
||||
####### make kernel-devel package: methods comes from rhel6(kernel.spec) #######
|
||||
make -C ${objdir} RPM_BUILD_MODULE=y INSTALL_MOD_PATH=%buildroot modules_install > /dev/null
|
||||
#don't package firmware, use linux-firmware rpm instead
|
||||
rm -rf %buildroot/lib/firmware
|
||||
# And save the headers/makefiles etc for building modules against
|
||||
#
|
||||
# This all looks scary, but the end result is supposed to be:
|
||||
# * all arch relevant include/ files
|
||||
# * all Makefile/Kconfig files
|
||||
# * all script/ files
|
||||
rm -rf %buildroot/lib/modules/${KernelVer}/build
|
||||
rm -rf %buildroot/lib/modules/${KernelVer}/source
|
||||
mkdir -p %buildroot/lib/modules/${KernelVer}/build
|
||||
(cd $RPM_BUILD_ROOT/lib/modules/${KernelVer} ; ln -s build source)
|
||||
# dirs for additional modules per module-init-tools, kbuild/modules.txt
|
||||
mkdir -p %buildroot/lib/modules/${KernelVer}/extra
|
||||
mkdir -p %buildroot/lib/modules/${KernelVer}/updates
|
||||
mkdir -p %buildroot/lib/modules/${KernelVer}/weak-updates
|
||||
|
||||
%if 0%{?rhel} == 8
|
||||
cp -rpf ${builddir}/arch/x86/boot/bzImage %buildroot/lib/modules/${KernelVer}/vmlinuz
|
||||
%endif
|
||||
|
||||
# first copy everything
|
||||
cp --parents `find -type f -name "Makefile*" -o -name "Kconfig*"` %buildroot/lib/modules/${KernelVer}/build
|
||||
cp ${builddir}/Module.symvers %buildroot/lib/modules/${KernelVer}/build
|
||||
cp ${builddir}/System.map %buildroot/lib/modules/${KernelVer}/build
|
||||
|
||||
if [ -s ${builddir}/Module.markers ]; then
|
||||
cp ${builddir}/Module.markers %buildroot/lib/modules/${KernelVer}/build
|
||||
fi
|
||||
|
||||
# create the kABI metadata for use in packaging
|
||||
echo "**** GENERATING kernel ABI metadata ****"
|
||||
gzip -c9 < ${builddir}/Module.symvers > %buildroot/boot/symvers-${KernelVer}.gz
|
||||
# chmod 0755 %_sourcedir/kabitool
|
||||
# rm -f %{_tmppath}/kernel-$KernelVer-kabideps
|
||||
# %_sourcedir/kabitool -s Module.symvers -o %{_tmppath}/kernel-$KernelVer-kabideps
|
||||
|
||||
%if %{with_kabichk}
|
||||
echo "**** kABI checking is enabled in kernel SPEC file. ****"
|
||||
chmod 0755 scripts/check-kabi
|
||||
if [ -e package/default/Module.kabi_%{_target_cpu}$Flavour ]; then
|
||||
scripts/check-kabi -k package/default/Module.kabi_%{_target_cpu}$Flavour -s ${builddir}/Module.symvers || exit 1
|
||||
echo "**** kABI checking SUCCESS. ****"
|
||||
else
|
||||
echo "**** NOTE: Cannot find reference Module.kabi file. ****"
|
||||
exit 1
|
||||
fi
|
||||
%endif
|
||||
|
||||
rm -rf %buildroot/lib/modules/${KernelVer}/build/Documentation
|
||||
rm -rf %buildroot/lib/modules/${KernelVer}/build/scripts
|
||||
rm -rf %buildroot/lib/modules/${KernelVer}/build/include
|
||||
cp ${builddir}/.config %buildroot/lib/modules/${KernelVer}/build
|
||||
cp -a scripts %buildroot/lib/modules/${KernelVer}/build
|
||||
cp -a ${builddir}/scripts %buildroot/lib/modules/${KernelVer}/build
|
||||
rm -f %buildroot/lib/modules/${KernelVer}/build/scripts/*.o
|
||||
rm -f %buildroot/lib/modules/${KernelVer}/build/scripts/*/*.o
|
||||
cp -a --parents arch/x86/include %buildroot/lib/modules/${KernelVer}/build/
|
||||
(cd ${builddir} ; cp -a --parents arch/x86/include/generated %buildroot/lib/modules/${KernelVer}/build/)
|
||||
mkdir -p %buildroot/lib/modules/${KernelVer}/build/include
|
||||
|
||||
cp -a ${builddir}/include/config %buildroot/lib/modules/${KernelVer}/build/include/
|
||||
cp -a ${builddir}/include/generated %buildroot/lib/modules/${KernelVer}/build/include/
|
||||
|
||||
cd include
|
||||
cp -a * %buildroot/lib/modules/${KernelVer}/build/include
|
||||
|
||||
cp -a ../arch/x86 $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/include/asm-x86
|
||||
pushd $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/include
|
||||
ln -s asm-x86 asm
|
||||
popd
|
||||
|
||||
# Make sure the Makefile and version.h have a matching timestamp so that
|
||||
# external modules can be built
|
||||
touch -r %buildroot/lib/modules/${KernelVer}/build/Makefile %buildroot/lib/modules/${KernelVer}/build/include/generated/uapi/linux/version.h
|
||||
#touch -r %buildroot/lib/modules/${KernelVer}/build/.config %buildroot/lib/modules/${KernelVer}/build/include/linux/autoconf.h
|
||||
# Copy .config to include/config/auto.conf so "make prepare" is unnecessary.
|
||||
cp %buildroot/lib/modules/$KernelVer/build/.config %buildroot/lib/modules/${KernelVer}/build/include/config/auto.conf
|
||||
cd ..
|
||||
|
||||
|
||||
find %buildroot/lib/modules/${KernelVer} -name "*.ko" -type f >modnames
|
||||
|
||||
|
||||
mkdir -p %buildroot%debug_path/modules/${KernelVer}
|
||||
cp -r %buildroot/lib/modules/${KernelVer}/kernel %buildroot%debug_path/modules/${KernelVer}
|
||||
xargs --no-run-if-empty strip -g < modnames
|
||||
|
||||
xargs --no-run-if-empty chmod u+x < modnames
|
||||
|
||||
# Generate a list of modules for block and networking.
|
||||
fgrep /drivers/ modnames | xargs --no-run-if-empty nm -upA |
|
||||
sed -n 's,^.*/\([^/]*\.ko\): *U \(.*\)$,\1 \2,p' > drivers.undef
|
||||
|
||||
collect_modules_list()
|
||||
{
|
||||
sed -r -n -e "s/^([^ ]+) \\.?($2)\$/\\1/p" drivers.undef |
|
||||
LC_ALL=C sort -u > $RPM_BUILD_ROOT/lib/modules/$KernelVer/modules.$1
|
||||
if [ ! -z "$3" ]; then
|
||||
sed -r -e "/^($3)\$/d" -i $RPM_BUILD_ROOT/lib/modules/$KernelVer/modules.$1
|
||||
fi
|
||||
}
|
||||
|
||||
collect_modules_list networking 'register_netdev|ieee80211_register_hw|usbnet_probe|phy_driver_register|rt2x00(pci|usb)_probe|register_netdevice'
|
||||
collect_modules_list block 'ata_scsi_ioctl|scsi_add_host|scsi_add_host_with_dma|blk_alloc_queue|blk_init_queue|register_mtd_blktrans|scsi_esp_register|scsi_register_device_handler|blk_queue_physical_block_size' 'pktcdvd.ko|dm-mod.ko'
|
||||
collect_modules_list drm 'drm_open|drm_init'
|
||||
collect_modules_list modesetting 'drm_crtc_init'
|
||||
# detect missing or incorrect license tags
|
||||
rm -f modinfo
|
||||
while read i
|
||||
do
|
||||
echo -n "${i#%buildroot/lib/modules/${KernelVer}/} " >> modinfo
|
||||
/sbin/modinfo -l $i >> modinfo
|
||||
done < modnames
|
||||
|
||||
egrep -v \
|
||||
'GPL( v2)?$|Dual BSD/GPL$|Dual MPL/GPL$|GPL and additional rights$' \
|
||||
modinfo && exit 1
|
||||
|
||||
rm -f modinfo modnames
|
||||
cp tools_key.pub %buildroot/lib/modules/${KernelVer}/kernel
|
||||
# remove files that will be auto generated by depmod at rpm -i time
|
||||
#for i in alias alias.bin ccwmap dep dep.bin ieee1394map inputmap isapnpmap ofmap pcimap seriomap symbols symbols.bin usbmap
|
||||
#do
|
||||
# rm -f %buildroot/lib/modules/${KernelVer}/modules.$i
|
||||
#done
|
||||
|
||||
# Move the devel headers out of the root file system
|
||||
mkdir -p %buildroot/usr/src/kernels
|
||||
mkdir -p %buildroot/lib/modules/${KernelVer}/build/tools/objtool
|
||||
cp ${builddir}/tools/objtool/objtool %buildroot/lib/modules/${KernelVer}/build/tools/objtool/objtool
|
||||
mv %buildroot/lib/modules/${KernelVer}/build %buildroot/usr/src/kernels/${KernelVer}
|
||||
ln -sf /usr/src/kernels/${KernelVer} %buildroot/lib/modules/${KernelVer}/build
|
||||
#
|
||||
# Generate the kernel-modules-* files lists
|
||||
#
|
||||
|
||||
%if 0%{?rhel} == 8
|
||||
mkdir -p %buildroot/lib/modules/$KernelVer/dist_compat
|
||||
mv %buildroot/lib/modules/$KernelVer/modules.symbols.bin %buildroot/lib/modules/$KernelVer/dist_compat
|
||||
mv %buildroot/lib/modules/$KernelVer/modules.symbols %buildroot/lib/modules/$KernelVer/dist_compat
|
||||
mv %buildroot/lib/modules/$KernelVer/modules.softdep %buildroot/lib/modules/$KernelVer/dist_compat
|
||||
mv %buildroot/lib/modules/$KernelVer/modules.devname %buildroot/lib/modules/$KernelVer/dist_compat
|
||||
mv %buildroot/lib/modules/$KernelVer/modules.dep.bin %buildroot/lib/modules/$KernelVer/dist_compat
|
||||
mv %buildroot/lib/modules/$KernelVer/modules.dep %buildroot/lib/modules/$KernelVer/dist_compat
|
||||
mv %buildroot/lib/modules/$KernelVer/modules.builtin.bin %buildroot/lib/modules/$KernelVer/dist_compat
|
||||
mv %buildroot/lib/modules/$KernelVer/modules.alias.bin %buildroot/lib/modules/$KernelVer/dist_compat
|
||||
mv %buildroot/lib/modules/$KernelVer/modules.alias %buildroot/lib/modules/$KernelVer/dist_compat
|
||||
mv %buildroot/boot/$configname %buildroot/lib/modules/$KernelVer/dist_compat
|
||||
mv %buildroot/boot/System.map-$KernelVer %buildroot/lib/modules/$KernelVer/dist_compat
|
||||
mv %buildroot/boot/.vmlinuz-%{tagged_name}%{?dist}.hmac %buildroot/lib/modules/$KernelVer/dist_compat
|
||||
%endif
|
||||
|
||||
|
||||
env -i PATH=$PATH LD_LIBRARY_PATH=$LD_LIBRARY_PATH HOME=$HOME USER=$USER bash -c "$PWD/package/default/mlx/mlnx_ofed_integrate_into_kernel.sh $KernelVer $PWD %buildroot"
|
||||
|
||||
# Copy the System.map file for depmod to use, and create a backup of the
|
||||
# full module tree so we can restore it after we're done filtering
|
||||
cp ${builddir}/System.map $RPM_BUILD_ROOT/.
|
||||
pushd $RPM_BUILD_ROOT
|
||||
mkdir restore
|
||||
cp -r lib/modules/$KernelVer/* restore/.
|
||||
|
||||
find lib/modules/$KernelVer/ -not -type d | sort -n > modules.list
|
||||
find lib/modules/$KernelVer/ -type d | sort -n > module-dirs.list
|
||||
|
||||
# Run depmod on the resulting module tree and make sure it isn't broken
|
||||
depmod -b . -aeF ./System.map $KernelVer &> depmod.out
|
||||
if [ -s depmod.out ]; then
|
||||
echo "Depmod failure"
|
||||
cat depmod.out
|
||||
exit 1
|
||||
else
|
||||
rm depmod.out
|
||||
fi
|
||||
|
||||
# Cleanup
|
||||
rm System.map
|
||||
cp -r restore/* lib/modules/$KernelVer/.
|
||||
rm -rf restore
|
||||
popd
|
||||
|
||||
%if 0%{?rhel} == 8
|
||||
mv %buildroot/lib/modules/$KernelVer/modules.symbols.bin %buildroot/lib/modules/$KernelVer/dist_compat
|
||||
mv %buildroot/lib/modules/$KernelVer/modules.symbols %buildroot/lib/modules/$KernelVer/dist_compat
|
||||
mv %buildroot/lib/modules/$KernelVer/modules.softdep %buildroot/lib/modules/$KernelVer/dist_compat
|
||||
mv %buildroot/lib/modules/$KernelVer/modules.devname %buildroot/lib/modules/$KernelVer/dist_compat
|
||||
mv %buildroot/lib/modules/$KernelVer/modules.dep.bin %buildroot/lib/modules/$KernelVer/dist_compat
|
||||
mv %buildroot/lib/modules/$KernelVer/modules.dep %buildroot/lib/modules/$KernelVer/dist_compat
|
||||
mv %buildroot/lib/modules/$KernelVer/modules.builtin.bin %buildroot/lib/modules/$KernelVer/dist_compat
|
||||
mv %buildroot/lib/modules/$KernelVer/modules.alias.bin %buildroot/lib/modules/$KernelVer/dist_compat
|
||||
mv %buildroot/lib/modules/$KernelVer/modules.alias %buildroot/lib/modules/$KernelVer/dist_compat
|
||||
%endif
|
||||
|
||||
# Make sure the files lists start with absolute paths or rpmbuild fails.
|
||||
# Also add in the dir entries
|
||||
sed -e 's/^lib*/%dir \/lib/' $RPM_BUILD_ROOT/module-dirs.list > ../core.list
|
||||
sed -e 's/^lib*/\/lib/' $RPM_BUILD_ROOT/modules.list >> ../core.list
|
||||
|
||||
# Cleanup
|
||||
rm -f $RPM_BUILD_ROOT/modules.list
|
||||
rm -f $RPM_BUILD_ROOT/module-dirs.list
|
||||
|
||||
%if %{with_perf}
|
||||
# perf tool binary and supporting scripts/binaries
|
||||
%{perf_make} DESTDIR=$RPM_BUILD_ROOT install
|
||||
mkdir -p %{buildroot}%{_libdir}
|
||||
touch %{buildroot}%{_libdir}/libperf-jvmti.so
|
||||
rm -f %{buildroot}%{_bindir}/trace
|
||||
|
||||
# perf-python extension
|
||||
%{perf_make} DESTDIR=$RPM_BUILD_ROOT install-python_ext
|
||||
|
||||
# perf man pages (note: implicit rpm magic compresses them later)
|
||||
%{perf_make} DESTDIR=$RPM_BUILD_ROOT install-man
|
||||
%endif
|
||||
|
||||
%if %{with_tools}
|
||||
%ifarch %{cpupowerarchs}
|
||||
make -C tools/power/cpupower DESTDIR=$RPM_BUILD_ROOT libdir=%{_libdir} mandir=%{_mandir} bash_completion_dir=%{_sysconfdir}/bash_completion.d/ CPUFREQ_BENCH=false install
|
||||
rm -f %{buildroot}%{_libdir}/*.{a,la}
|
||||
%find_lang cpupower
|
||||
mv cpupower.lang ../
|
||||
%ifarch x86_64
|
||||
pushd tools/power/cpupower/debug/x86_64
|
||||
install -m755 centrino-decode %{buildroot}%{_bindir}/centrino-decode
|
||||
install -m755 powernow-k8-decode %{buildroot}%{_bindir}/powernow-k8-decode
|
||||
popd
|
||||
%endif
|
||||
chmod 0755 %{buildroot}%{_libdir}/libcpupower.so*
|
||||
mkdir -p %{buildroot}%{_unitdir} %{buildroot}%{_sysconfdir}/sysconfig
|
||||
install -m644 %{SOURCE2000} %{buildroot}%{_unitdir}/cpupower.service
|
||||
install -m644 %{SOURCE2001} %{buildroot}%{_sysconfdir}/sysconfig/cpupower
|
||||
%ifarch %{ix86} x86_64
|
||||
mkdir -p %{buildroot}%{_mandir}/man8
|
||||
pushd tools/power/x86/x86_energy_perf_policy
|
||||
make DESTDIR=%{buildroot} install
|
||||
popd
|
||||
pushd tools/power/x86/turbostat
|
||||
make DESTDIR=%{buildroot} install
|
||||
popd
|
||||
%endif #turbostat/x86_energy_perf_policy
|
||||
pushd tools/thermal/tmon
|
||||
make INSTALL_ROOT=%{buildroot} install
|
||||
popd
|
||||
%endif
|
||||
%endif
|
||||
|
||||
%if %{with_bpftool}
|
||||
%{bpftool_make} install doc-install
|
||||
/usr/lib/rpm/brp-compress
|
||||
%endif # with_bpftool
|
||||
done
|
||||
|
||||
mkdir -p %buildroot/etc/sysconfig/modules
|
||||
install -m755 %SOURCE1 %buildroot/etc/sysconfig/modules
|
||||
|
||||
#### Header
|
||||
make INSTALL_HDR_PATH=$RPM_BUILD_ROOT/usr headers_install
|
||||
# Do headers_check but don't die if it fails.
|
||||
make INSTALL_HDR_PATH=$RPM_BUILD_ROOT/usr headers_check \
|
||||
> hdrwarnings.txt || :
|
||||
if grep -q exist hdrwarnings.txt; then
|
||||
sed s:^$RPM_BUILD_ROOT/usr/include/:: hdrwarnings.txt
|
||||
# Temporarily cause a build failure if header inconsistencies.
|
||||
# exit 1
|
||||
fi
|
||||
|
||||
find $RPM_BUILD_ROOT/usr/include \
|
||||
\( -name .install -o -name .check -o \
|
||||
-name ..install.cmd -o -name ..check.cmd \) | xargs rm -f
|
||||
|
||||
# glibc provides scsi headers for itself, for now
|
||||
rm -rf $RPM_BUILD_ROOT/usr/include/scsi
|
||||
rm -f $RPM_BUILD_ROOT/usr/include/asm*/atomic.h
|
||||
rm -f $RPM_BUILD_ROOT/usr/include/asm*/io.h
|
||||
rm -f $RPM_BUILD_ROOT/usr/include/asm*/irq.h
|
||||
|
||||
%pre
|
||||
# pre #########################################################################
|
||||
system_arch=`uname -m`
|
||||
|
||||
if [ %{_target_cpu} != ${system_arch} ]; then
|
||||
echo "ERROR: Failed installing this rpm!!!!"
|
||||
echo "This rpm is intended for %{_target_cpu} platform. It seems your system is ${system_arch}.";
|
||||
exit 1;
|
||||
fi;
|
||||
|
||||
%post
|
||||
# post #########################################################################
|
||||
echo "Install tlinux kernel"
|
||||
%if 0%{?rhel} == 8
|
||||
kernel-install add %{tagged_name} /lib/modules/%{tagged_name}/vmlinuz
|
||||
cp -p /lib/modules/%{tagged_name}/dist_compat/config-%{tagged_name}%{?dist} /boot
|
||||
cp -p /lib/modules/%{tagged_name}/dist_compat/.vmlinuz-%{tagged_name}%{?dist}.hmac /boot
|
||||
cp -p /lib/modules/%{tagged_name}/dist_compat/System.map-%{tagged_name}%{?dist} /boot
|
||||
%else
|
||||
%if 0%{?rhel} == 7
|
||||
/sbin/new-kernel-pkg --package kernel-tlinux4 --install %{tagged_name}%{?dist} --kernel-args="crashkernel=512M-12G:128M,12G-64G:256M,64G-128G:512M,128G-:768M" --make-default|| exit $?
|
||||
%endif
|
||||
%endif
|
||||
|
||||
%preun
|
||||
# preun #######################################################################
|
||||
%if 0%{?rhel} == 8
|
||||
kernel-install remove %{tagged_name}
|
||||
%else
|
||||
%if 0%{?rhel} == 7
|
||||
/sbin/new-kernel-pkg --rminitrd --dracut --remove %{tagged_name}%{?dist} || exit $?
|
||||
echo -e "Remove \"%{tagged_name}%{?dist}\" Done."
|
||||
%endif
|
||||
%endif
|
||||
|
||||
%posttrans
|
||||
# posttrans ####################################################################
|
||||
%if 0%{?rhel} == 7
|
||||
/sbin/new-kernel-pkg --package kernel --mkinitrd --dracut --depmod --update %{tagged_name}%{?dist} || exit $?
|
||||
/sbin/new-kernel-pkg --package kernel --rpmposttrans %{tagged_name}%{?dist} || exit $?
|
||||
%endif
|
||||
|
||||
%files -f core.list
|
||||
# files ########################################################################
|
||||
%defattr(-,root,root)
|
||||
%if 0%{?rhel} == 7
|
||||
/boot/vmlinuz-%{tagged_name}%{?dist}
|
||||
/boot/System.map-%{tagged_name}%{?dist}
|
||||
/boot/config-%{tagged_name}%{?dist}
|
||||
/boot/.vmlinuz-%{tagged_name}%{?dist}.hmac
|
||||
%endif
|
||||
/boot/symvers-%{tagged_name}%{?dist}*
|
||||
/etc/sysconfig/modules/tlinux_cciss_link.modules
|
||||
#do not package firmware ,use linux-firmware rpm instead
|
||||
#/lib/firmware/
|
||||
|
||||
%files debuginfo-common
|
||||
%defattr(-,root,root)
|
||||
/boot/vmlinux-%{tagged_name}%{?dist}
|
||||
%dir %debug_path
|
||||
%debug_path/modules
|
||||
#/boot/System.map-%%{version}-%%{title}-%%{release_os}-*
|
||||
#/boot/config-%%{version}-%%{title}-%%{release_os}-*
|
||||
|
||||
%files headers
|
||||
%defattr(-,root,root)
|
||||
/usr/include/*
|
||||
|
||||
%files devel
|
||||
%defattr(-,root,root)
|
||||
/usr/src/kernels/%{tagged_name}%{?dist}
|
||||
|
||||
%if %{with_perf}
|
||||
%files -n perf
|
||||
%defattr(-,root,root)
|
||||
%{_bindir}/perf*
|
||||
%{_sysconfdir}/bash_completion.d/perf
|
||||
%dir %{_prefix}/lib/perf
|
||||
%{_prefix}/lib/perf/*
|
||||
%dir %{_libdir}/traceevent/
|
||||
%{_libdir}/traceevent/*
|
||||
%{_libdir}/libperf-jvmti.so
|
||||
%dir %{_libexecdir}/perf-core
|
||||
%{_libexecdir}/perf-core/*
|
||||
%{_datadir}/perf-core/*
|
||||
%{_docdir}/perf-tip/tips.txt
|
||||
%{_mandir}/man[1-8]/perf*
|
||||
|
||||
%files -n python-perf
|
||||
%defattr(-,root,root)
|
||||
%{python_sitearch}
|
||||
|
||||
%if %{with_debuginfo}
|
||||
%files -f perf-debuginfo.list -n perf-debuginfo
|
||||
%defattr(-,root,root)
|
||||
|
||||
%files -f python-perf-debuginfo.list -n python-perf-debuginfo
|
||||
%defattr(-,root,root)
|
||||
%endif
|
||||
%endif # with_perf
|
||||
|
||||
%if %{with_tools}
|
||||
%files -n kernel-tools -f cpupower.lang
|
||||
%defattr(-,root,root)
|
||||
%ifarch %{cpupowerarchs}
|
||||
%{_bindir}/cpupower
|
||||
%ifarch x86_64
|
||||
%{_bindir}/centrino-decode
|
||||
%{_bindir}/powernow-k8-decode
|
||||
%endif
|
||||
%{_unitdir}/cpupower.service
|
||||
%{_mandir}/man[1-8]/cpupower*
|
||||
%config(noreplace) %{_sysconfdir}/sysconfig/cpupower
|
||||
%ifarch %{ix86} x86_64
|
||||
%{_bindir}/x86_energy_perf_policy
|
||||
%{_mandir}/man8/x86_energy_perf_policy*
|
||||
%{_bindir}/turbostat
|
||||
%{_mandir}/man8/turbostat*
|
||||
%endif
|
||||
%endif
|
||||
%{_bindir}/tmon
|
||||
%{_sysconfdir}/bash_completion.d/cpupower
|
||||
%{_oldincludedir}/cpu*.h
|
||||
|
||||
%ifarch %{cpupowerarchs}
|
||||
%files -n kernel-tools-libs
|
||||
%defattr(-,root,root)
|
||||
%{_libdir}/libcpupower.so*
|
||||
%endif
|
||||
%endif # with_tools
|
||||
|
||||
%if %{with_bpftool}
|
||||
%files -n bpftool
|
||||
%defattr(-,root,root)
|
||||
%{_sbindir}/bpftool
|
||||
%{_sysconfdir}/bash_completion.d/bpftool
|
||||
%{_mandir}/man8/bpftool*.gz
|
||||
%{_mandir}/man7/bpf-helpers.7.gz
|
||||
|
||||
%if %{with_debuginfo}
|
||||
%files -f bpftool-debuginfo.list -n bpftool-debuginfo
|
||||
%defattr(-,root,root)
|
||||
%endif
|
||||
%endif # with_bpftool
|
||||
|
||||
# changelog ###################################################################
|
||||
%changelog
|
||||
* Thu Feb 2 2012 Samuel Liao <samuelliao@tencent.com>
|
||||
- Initial 3.0.18 repository
|
||||
|
|
@ -1,268 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Copyright (c) 2020 Mellanox Technologies. All rights reserved.
|
||||
#
|
||||
# This Software is licensed under one of the following licenses:
|
||||
#
|
||||
# 1) under the terms of the "Common Public License 1.0" a copy of which is
|
||||
# available from the Open Source Initiative, see
|
||||
# http://www.opensource.org/licenses/cpl.php.
|
||||
#
|
||||
# 2) under the terms of the "The BSD License" a copy of which is
|
||||
# available from the Open Source Initiative, see
|
||||
# http://www.opensource.org/licenses/bsd-license.php.
|
||||
#
|
||||
# 3) under the terms of the "GNU General Public License (GPL) Version 2" a
|
||||
# copy of which is available from the Open Source Initiative, see
|
||||
# http://www.opensource.org/licenses/gpl-license.php.
|
||||
#
|
||||
# Licensee has the right to choose one of the above licenses.
|
||||
#
|
||||
# Redistributions of source code must retain the above copyright
|
||||
# notice and one of the license notices.
|
||||
#
|
||||
# Redistributions in binary form must reproduce both the above copyright
|
||||
# notice, one of the license notices in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
#
|
||||
# Author: Alaa Hleihel <alaa@mellanox.com>
|
||||
#
|
||||
|
||||
set -ex
|
||||
|
||||
############################################################################
|
||||
# Settings:
|
||||
|
||||
# Additional flags to pass to mlnxofedinstall
|
||||
mlnxofedinstall_flags=""
|
||||
|
||||
#
|
||||
# Disabling build of specific modules:
|
||||
#
|
||||
mlnxofedinstall_flags=" ${mlnxofedinstall_flags} \
|
||||
--without-mlx5_fpga_tools \
|
||||
--without-mlnx-rdma-rxe \
|
||||
--without-mlnx-nfsrdma \
|
||||
--without-mlnx-nvme \
|
||||
--without-isert \
|
||||
--without-iser \
|
||||
--without-srp \
|
||||
--without-rshim \
|
||||
--without-mdev \
|
||||
"
|
||||
|
||||
#
|
||||
# Disabling checking for required packages:
|
||||
#
|
||||
# Uncomment the next line in case you have a customised build host that
|
||||
# causes mlnxofedinstall to fail when checking for required packages (as
|
||||
# they might be provided by packages with unexpected names, etc).
|
||||
#
|
||||
mlnxofedinstall_flags=" ${mlnxofedinstall_flags} --without-depcheck"
|
||||
|
||||
|
||||
|
||||
#
|
||||
############################################################################
|
||||
# get args
|
||||
|
||||
# kernel version number (for building modules)
|
||||
KERNELRELEASE=$1; shift
|
||||
|
||||
# path to kernel rpm build directory (for temp build folder)
|
||||
kbdir=$1; shift
|
||||
|
||||
# path to kernel rpm build root (for kernel sources and installing modules)
|
||||
buildroot=$1; shift
|
||||
|
||||
# Path to full mlnx_ofed package
|
||||
ofedsrc=${kbdir}/package/default/mlx/MLNX_OFED_LINUX-5.1-2.5.8.0.40-rhel8.3-x86_64.tgz
|
||||
|
||||
mlx_splits_dir=${kbdir}/package/default/mlx
|
||||
mlx_splits="mlx_split*"
|
||||
if [ ! -e "${ofedsrc}" ]; then
|
||||
cat $mlx_splits_dir/$mlx_splits > $ofedsrc
|
||||
fi
|
||||
|
||||
if [ ! -e "${ofedsrc}" ]; then
|
||||
echo "ERROR: ofedsrc not provided or path '${ofedsrc}' does not exist." >&2
|
||||
echo 1
|
||||
fi
|
||||
|
||||
if [ "X${KERNELRELEASE}" == "X" ]; then
|
||||
echo "ERROR: KERNELRELEASE not provided." >&2
|
||||
echo 1
|
||||
fi
|
||||
if [ ! -d "${kbdir}" ]; then
|
||||
echo "ERROR: kbdir not provided" >&2
|
||||
echo 1
|
||||
fi
|
||||
if [ ! -d "${buildroot}" ]; then
|
||||
echo "ERROR: buildroot not provided" >&2
|
||||
echo 1
|
||||
fi
|
||||
|
||||
K_SRC=${buildroot}/usr/src/kernels/${KERNELRELEASE}
|
||||
K_DIR_INSTALL=${buildroot}/lib/modules/${KERNELRELEASE}/kernel
|
||||
|
||||
export MAKE=${MAKE:-"make"}
|
||||
|
||||
|
||||
############################################################################
|
||||
#
|
||||
# make sure we have each modules installed once under the new kernel:
|
||||
# - if the module we want to install already exists, replace it wit the new one.
|
||||
# - if it's a new module, then just install it.
|
||||
#
|
||||
function inst_mod()
|
||||
{
|
||||
local mod=$1; shift
|
||||
|
||||
local mod_name=$(basename ${mod})
|
||||
local tdir=
|
||||
|
||||
for ii in $(find ${K_DIR_INSTALL} -name "*${mod_name}*")
|
||||
do
|
||||
# save module location
|
||||
tdir=$(dirname ${ii})
|
||||
|
||||
/bin/rm -fv ${ii}
|
||||
done
|
||||
|
||||
# install new module
|
||||
if [ ! -e "${tdir}" ]; then
|
||||
tdir="${K_DIR_INSTALL}/drivers/ofed_addon/"
|
||||
mkdir -p ${tdir}
|
||||
fi
|
||||
|
||||
/bin/cp -fv ${mod} ${tdir}/
|
||||
}
|
||||
|
||||
function handle_rpm()
|
||||
{
|
||||
local pkg=$1; shift
|
||||
|
||||
/bin/rm -rf ext_rpm
|
||||
mkdir -p ext_rpm
|
||||
cd ext_rpm
|
||||
|
||||
# extract rpm
|
||||
rpm2cpio ${pkg} | cpio -id
|
||||
|
||||
# copy all modules
|
||||
for mod in $(find . -name "*.ko*")
|
||||
do
|
||||
inst_mod ${mod}
|
||||
done
|
||||
|
||||
cd -
|
||||
}
|
||||
|
||||
function handle_rpms_ofa_kernel()
|
||||
{
|
||||
local mod_rpms=$1; shift
|
||||
|
||||
for mrpm in ${mod_rpms}
|
||||
do
|
||||
case "${mrpm}" in
|
||||
*mlnx-ofa_kernel*devel*)
|
||||
continue
|
||||
;;
|
||||
*mlnx-ofa_kernel*)
|
||||
handle_rpm ${mrpm}
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
function handle_rpms_all()
|
||||
{
|
||||
local mod_rpms=$1; shift
|
||||
|
||||
for mrpm in ${mod_rpms}
|
||||
do
|
||||
case "${mrpm}" in
|
||||
*mlnx-ofa_kernel*)
|
||||
continue
|
||||
;;
|
||||
*)
|
||||
handle_rpm ${mrpm}
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
__cleanup()
|
||||
{
|
||||
sed -i '/__os_install_post/d' ~/.rpmmacros
|
||||
sed -i '/__brp_mangle_shebangs/d' ~/.rpmmacros
|
||||
}
|
||||
trap '__cleanup' INT TERM ERR EXIT
|
||||
|
||||
############################################################################
|
||||
|
||||
cd ${kbdir}
|
||||
/bin/rm -rf ofedbuild && mkdir ofedbuild && cd ofedbuild
|
||||
mkdir mtmp
|
||||
TMPD="$PWD/mtmp"
|
||||
|
||||
# extract MLNX_OFED
|
||||
tar xzf ${ofedsrc}
|
||||
cd MLNX_OFED_LINUX-*
|
||||
|
||||
distro=$(cat distro 2>/dev/null)
|
||||
echo "This MLNX_OFED was built for distro: ${distro}"
|
||||
|
||||
#this will cause error in chroot environment
|
||||
#echo "%__os_install_post %{nil}" >> ~/.rpmmacros
|
||||
echo "%__brp_mangle_shebangs %{nil}" >> ~/.rpmmacros
|
||||
|
||||
# compile modules against target kernel
|
||||
./mlnxofedinstall \
|
||||
--add-kernel-support-build-only \
|
||||
--disable-kmp \
|
||||
--distro ${distro} \
|
||||
--kernel ${KERNELRELEASE} \
|
||||
--kernel-sources ${K_SRC} \
|
||||
--tmpdir ${TMPD} \
|
||||
--skip-distro-check \
|
||||
--skip-repo ${mlnxofedinstall_flags}
|
||||
|
||||
sed -i '/__os_install_post/d' ~/.rpmmacros
|
||||
sed -i '/__brp_mangle_shebangs/d' ~/.rpmmacros
|
||||
|
||||
# fix permissiosn
|
||||
chown -R ${USER} ${TMPD}
|
||||
|
||||
echo
|
||||
echo "Compilation done, now get the modules and copy the to kernel buildroot..."
|
||||
echo
|
||||
|
||||
# open RPMs and copy modules
|
||||
/bin/rm -rf ${TMPD}/new
|
||||
mkdir -p ${TMPD}/new
|
||||
cd ${TMPD}/new
|
||||
tar xzf ${TMPD}/MLNX_OFED_LINUX-*/MLNX_OFED_LINUX-*tgz
|
||||
|
||||
# get all kernel module rpms that were built against target kernel
|
||||
mod_rpms=
|
||||
for pkg in $(find ${TMPD}/new/MLNX_OFED_LINUX-*/RPMS -name "*rpm")
|
||||
do
|
||||
if rpm -qlp ${pkg} | grep "\.ko" | grep -q "${KERNELRELEASE}"; then
|
||||
# take each rpm only once
|
||||
rpkg=$(readlink -f ${pkg})
|
||||
if ! echo "${mod_rpms}" | grep -q "${rpkg}"; then
|
||||
mod_rpms="${mod_rpms} ${rpkg}"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# first handle ofa_kernel rpm since it's our base package
|
||||
handle_rpms_ofa_kernel "${mod_rpms}"
|
||||
|
||||
# now handle the additional packages
|
||||
handle_rpms_all "${mod_rpms}"
|
||||
|
||||
# cleanup
|
||||
cd ${kbdir}
|
||||
/bin/rm -rf ofedbuild
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -1,300 +0,0 @@
|
|||
%define sign_server 10.12.65.118
|
||||
|
||||
%global with_debuginfo 0
|
||||
%if 0%{?rhel} == 6
|
||||
%global dist .tl1
|
||||
%global debug_path /usr/lib/debug/lib/
|
||||
%else
|
||||
%global debug_path /usr/lib/debug/usr/lib/
|
||||
%if 0%{?rhel} == 7
|
||||
%global dist .tl2
|
||||
%endif
|
||||
%endif
|
||||
|
||||
%if 0%{?rhel} == 8
|
||||
%global __python %{__python2}
|
||||
%endif
|
||||
|
||||
%global build_env DESTDIR="%{buildroot}" prefix=%{_prefix} lib=%{_lib} PYTHON=%{__python3} INSTALL_ROOT=%{buildroot}
|
||||
%global bpftool_make make %{?_smp_mflags} -C tools/bpf/bpftool %{build_env} mandir=%{_mandir} bash_compdir=%{_sysconfdir}/bash_completion.d/
|
||||
|
||||
# Architectures we build tools/cpupower on
|
||||
%define cpupowerarchs x86_64 aarch64
|
||||
|
||||
Summary: Performance monitoring for the Linux kernel
|
||||
Group: Development/System
|
||||
Name: %{name}
|
||||
Version: %{version}
|
||||
Release: %{release_os}%{?dist}
|
||||
License: GPLv2
|
||||
Vendor: Tencent
|
||||
Packager: tlinux team <g_CAPD_SRDC_OS@tencent.com>
|
||||
Provides: perf = %{version}-%{release}
|
||||
Source0: %{name}-%{version}.tar.gz
|
||||
# Sources for kernel tools
|
||||
Source2000: cpupower.service
|
||||
Source2001: cpupower.config
|
||||
URL: http://www.tencent.com
|
||||
ExclusiveArch: x86_64
|
||||
Distribution: Tencent Linux
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-build
|
||||
BuildRequires: wget bc module-init-tools curl
|
||||
BuildRequires: elfutils-devel zlib-devel binutils-devel newt-devel perl(ExtUtils::Embed) bison flex
|
||||
%if 0%{?rhel} == 8
|
||||
BuildRequires: python2-devel
|
||||
%else
|
||||
BuildRequires: python-devel
|
||||
%endif
|
||||
BuildRequires: xmlto asciidoc
|
||||
BuildRequires: audit-libs-devel
|
||||
%ifnarch s390 s390x
|
||||
BuildRequires: numactl-devel
|
||||
%endif
|
||||
# kernel tools
|
||||
BuildRequires: gettext ncurses-devel asciidoc
|
||||
%ifnarch s390x
|
||||
BuildRequires: pciutils-devel
|
||||
BuildRequires: libcap-devel
|
||||
%endif
|
||||
|
||||
# for the 'hostname' command
|
||||
%if 0%{?rhel} == 7
|
||||
BuildRequires: hostname
|
||||
%else
|
||||
BuildRequires: net-tools
|
||||
%endif
|
||||
|
||||
%description
|
||||
This package contains the perf tool, which enables performance monitoring
|
||||
of the Linux kernel.
|
||||
|
||||
|
||||
%package -n python-perf
|
||||
Summary: Python bindings for apps which will manipulate perf events
|
||||
Group: Development/Libraries
|
||||
%description -n python-perf
|
||||
The python-perf package contains a module that permits applications
|
||||
written in the Python programming language to use the interface
|
||||
to manipulate perf events.
|
||||
|
||||
%package -n kernel-tools
|
||||
Summary: Assortment of tools for the Linux kernel
|
||||
Group: Development/System
|
||||
License: GPLv2
|
||||
%ifarch %{cpupowerarchs}
|
||||
Provides: cpupowerutils = 1:009-0.6.p1
|
||||
Obsoletes: cpupowerutils < 1:009-0.6.p1
|
||||
Provides: cpufreq-utils = 1:009-0.6.p1
|
||||
Provides: cpufrequtils = 1:009-0.6.p1
|
||||
Obsoletes: cpufreq-utils < 1:009-0.6.p1
|
||||
Obsoletes: cpufrequtils < 1:009-0.6.p1
|
||||
Obsoletes: cpuspeed < 1:1.5-16
|
||||
%endif
|
||||
%description -n kernel-tools
|
||||
This package contains the tools/ directory from the kernel source
|
||||
and the supporting documentation.
|
||||
|
||||
%package -n kernel-tools-libs
|
||||
Summary: Libraries for the kernel-tools
|
||||
Group: Development/System
|
||||
License: GPLv2
|
||||
%description -n kernel-tools-libs
|
||||
This package contains the libraries built from the tools/ directory
|
||||
from the kernel source.
|
||||
|
||||
%package -n bpftool
|
||||
Summary: Inspection and simple manipulation of eBPF programs and maps
|
||||
License: GPLv2
|
||||
BuildRequires: llvm
|
||||
%if 0%{?rhel} == 7
|
||||
BuildRequires: python2-docutils
|
||||
%else
|
||||
BuildRequires: python3-docutils
|
||||
%endif
|
||||
%description -n bpftool
|
||||
This package contains the bpftool, which allows inspection and simple
|
||||
manipulation of eBPF programs and maps.
|
||||
|
||||
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
|
||||
|
||||
|
||||
# prep #########################################################################
|
||||
%prep
|
||||
|
||||
%setup -q -c -T -a 0
|
||||
|
||||
# build ########################################################################
|
||||
%build
|
||||
|
||||
|
||||
if [ ! -f /etc/tlinux-release ]; then
|
||||
echo "Error: please build this rpm on tlinux\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
cd %{name}-%{version}
|
||||
all_types="%{kernel_all_types}"
|
||||
num_processor=`cat /proc/cpuinfo | grep 'processor' | wc -l`
|
||||
if [ $num_processor -gt 8 ]; then
|
||||
num_processor=8
|
||||
fi
|
||||
|
||||
%global perf_make make %{?_smp_mflags} -C tools/perf -s V=1 WERROR=0 NO_LIBUNWIND=1 HAVE_CPLUS_DEMANGLE=1 NO_GTK2=1 NO_STRLCPY=1 prefix=%{_prefix} lib=%{_lib}
|
||||
# perf
|
||||
%{perf_make} all
|
||||
%{perf_make} man
|
||||
|
||||
# kernel tools
|
||||
%ifarch %{cpupowerarchs}
|
||||
# cpupower
|
||||
# make sure version-gen.sh is executable.
|
||||
chmod +x tools/power/cpupower/utils/version-gen.sh
|
||||
make %{?_smp_mflags} -C tools/power/cpupower bash_completion_dir=%{_sysconfdir}/bash_completion.d/ CPUFREQ_BENCH=false
|
||||
%ifarch x86_64
|
||||
pushd tools/power/cpupower/debug/x86_64
|
||||
make %{?_smp_mflags} centrino-decode powernow-k8-decode
|
||||
popd
|
||||
%endif
|
||||
%ifarch x86_64
|
||||
pushd tools/power/x86/x86_energy_perf_policy/
|
||||
make
|
||||
popd
|
||||
pushd tools/power/x86/turbostat
|
||||
make
|
||||
popd
|
||||
%endif #turbostat/x86_energy_perf_policy
|
||||
%endif
|
||||
pushd tools
|
||||
make tmon
|
||||
popd
|
||||
|
||||
%{bpftool_make}
|
||||
|
||||
# install ######################################################################
|
||||
%install
|
||||
cd %{name}-%{version}
|
||||
%{perf_make} DESTDIR=$RPM_BUILD_ROOT install
|
||||
mkdir -p %{buildroot}%{_libdir}
|
||||
touch %{buildroot}%{_libdir}/libperf-jvmti.so
|
||||
rm -f %{buildroot}%{_bindir}/trace
|
||||
|
||||
# perf-python extension
|
||||
%{perf_make} DESTDIR=$RPM_BUILD_ROOT install-python_ext
|
||||
|
||||
# perf man pages (note: implicit rpm magic compresses them later)
|
||||
%{perf_make} DESTDIR=$RPM_BUILD_ROOT install-man
|
||||
|
||||
# kernel tools
|
||||
%ifarch %{cpupowerarchs}
|
||||
make -C tools/power/cpupower DESTDIR=$RPM_BUILD_ROOT libdir=%{_libdir} mandir=%{_mandir} bash_completion_dir=%{_sysconfdir}/bash_completion.d/ CPUFREQ_BENCH=false install
|
||||
rm -f %{buildroot}%{_libdir}/*.{a,la}
|
||||
%find_lang cpupower
|
||||
mv cpupower.lang ../
|
||||
%ifarch x86_64
|
||||
pushd tools/power/cpupower/debug/x86_64
|
||||
install -m755 centrino-decode %{buildroot}%{_bindir}/centrino-decode
|
||||
install -m755 powernow-k8-decode %{buildroot}%{_bindir}/powernow-k8-decode
|
||||
popd
|
||||
%endif
|
||||
chmod 0755 %{buildroot}%{_libdir}/libcpupower.so*
|
||||
mkdir -p %{buildroot}%{_unitdir} %{buildroot}%{_sysconfdir}/sysconfig
|
||||
install -m644 %{SOURCE2000} %{buildroot}%{_unitdir}/cpupower.service
|
||||
install -m644 %{SOURCE2001} %{buildroot}%{_sysconfdir}/sysconfig/cpupower
|
||||
%ifarch %{ix86} x86_64
|
||||
mkdir -p %{buildroot}%{_mandir}/man8
|
||||
pushd tools/power/x86/x86_energy_perf_policy
|
||||
make DESTDIR=%{buildroot} install
|
||||
popd
|
||||
pushd tools/power/x86/turbostat
|
||||
make DESTDIR=%{buildroot} install
|
||||
popd
|
||||
%endif #turbostat/x86_energy_perf_policy
|
||||
pushd tools/thermal/tmon
|
||||
make INSTALL_ROOT=%{buildroot} install
|
||||
popd
|
||||
%endif
|
||||
|
||||
%{bpftool_make} install doc-install
|
||||
/usr/lib/rpm/brp-compress
|
||||
|
||||
%pre
|
||||
# pre #########################################################################
|
||||
system_arch=`uname -m`
|
||||
|
||||
if [ %{_target_cpu} != ${system_arch} ]; then
|
||||
echo "ERROR: Failed installing this rpm!!!!"
|
||||
echo "This rpm is intended for %{_target_cpu} platform. It seems your system is ${system_arch}.";
|
||||
exit 1;
|
||||
fi;
|
||||
|
||||
if [ ! -f /etc/tlinux-release -o ! -f /etc/redhat-release ]; then
|
||||
echo "Error: Cannot install this rpm on non-tlinux OS"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
%post
|
||||
# post #########################################################################
|
||||
|
||||
|
||||
%postun
|
||||
|
||||
%files
|
||||
%defattr(-,root,root)
|
||||
%{_bindir}/perf*
|
||||
%{_sysconfdir}/bash_completion.d/perf
|
||||
%dir %{_prefix}/lib/perf
|
||||
%{_prefix}/lib/perf/*
|
||||
%dir %{_libdir}/traceevent/
|
||||
%{_libdir}/traceevent/*
|
||||
%{_libdir}/libperf-jvmti.so
|
||||
%dir %{_libexecdir}/perf-core
|
||||
%{_libexecdir}/perf-core/*
|
||||
%{_datadir}/perf-core/*
|
||||
%{_docdir}/perf-tip/tips.txt
|
||||
%{_mandir}/man[1-8]/perf*
|
||||
|
||||
%files -n python-perf
|
||||
%defattr(-,root,root)
|
||||
%{python_sitearch}
|
||||
|
||||
# kernel tools
|
||||
%files -n kernel-tools -f cpupower.lang
|
||||
%defattr(-,root,root)
|
||||
%ifarch %{cpupowerarchs}
|
||||
%{_bindir}/cpupower
|
||||
%ifarch x86_64
|
||||
%{_bindir}/centrino-decode
|
||||
%{_bindir}/powernow-k8-decode
|
||||
%endif
|
||||
%{_unitdir}/cpupower.service
|
||||
%{_mandir}/man[1-8]/cpupower*
|
||||
%config(noreplace) %{_sysconfdir}/sysconfig/cpupower
|
||||
%ifarch %{ix86} x86_64
|
||||
%{_bindir}/x86_energy_perf_policy
|
||||
%{_mandir}/man8/x86_energy_perf_policy*
|
||||
%{_bindir}/turbostat
|
||||
%{_mandir}/man8/turbostat*
|
||||
%endif
|
||||
%endif
|
||||
%{_bindir}/tmon
|
||||
%{_sysconfdir}/bash_completion.d/cpupower
|
||||
%{_oldincludedir}/cpu*.h
|
||||
|
||||
%ifarch %{cpupowerarchs}
|
||||
%files -n kernel-tools-libs
|
||||
%defattr(-,root,root)
|
||||
%{_libdir}/libcpupower.so*
|
||||
%endif
|
||||
|
||||
%files -n bpftool
|
||||
%defattr(-,root,root)
|
||||
%{_sbindir}/bpftool
|
||||
%{_sysconfdir}/bash_completion.d/bpftool
|
||||
%{_mandir}/man8/bpftool*.gz
|
||||
%{_mandir}/man7/bpf-helpers.7.gz
|
||||
|
||||
# changelog ###################################################################
|
||||
%changelog
|
||||
* Thu Feb 2 2012 Samuel Liao <samuelliao@tencent.com>
|
||||
- Initial 3.0.18 repository
|
||||
|
|
@ -1,159 +0,0 @@
|
|||
#!/bin/bash
|
||||
# ==============================================================================
|
||||
# Description: Automaticly generating kernel rpm package with specified branch
|
||||
# according to HEAD tag.
|
||||
#
|
||||
# Author: David Shan <davidshan@tencent.com>
|
||||
# ===============================================================================
|
||||
|
||||
#variables
|
||||
kernel_full_name=""
|
||||
kernel_version=""
|
||||
tlinux_release=""
|
||||
curdir=`pwd`
|
||||
|
||||
|
||||
build_specdir=`readlink -f ~/rpmbuild/SPECS`
|
||||
build_srcdir=`readlink -f ~/rpmbuild/SOURCES`
|
||||
dist="tl2"
|
||||
|
||||
kernel_type="default"
|
||||
spec_file_name=""
|
||||
make_jobs=""
|
||||
tag_name=""
|
||||
nosign_suffix=""
|
||||
build_src_only=0
|
||||
strip_sign_token=0
|
||||
# to control wheter to build rpm for xen domU
|
||||
isXenU=""
|
||||
kernel_default_types=(default)
|
||||
|
||||
get_kernel_version()
|
||||
{
|
||||
tagged_name=${tag_name#x86-}
|
||||
kernel_version=`echo $tagged_name|cut -d- -f1`
|
||||
#kernel_version=${kernel_version}-1
|
||||
#echo "kernel version: $kernel_version"
|
||||
echo "kernel version: ${kernel_version}"
|
||||
}
|
||||
|
||||
get_tlinux_name()
|
||||
{
|
||||
if [ -n "$tag_name" ]; then
|
||||
tagged_name="$tag_name"
|
||||
else
|
||||
tagged_name=`git describe --tags`
|
||||
fi
|
||||
|
||||
if [ -z "${tagged_name}" ];then
|
||||
echo "Error:Can't get kernel version from git tree."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
tagged_name=${tagged_name#x86-}
|
||||
#if [ "${tagged_name#*-*-*}" != ${tagged_name} ];then
|
||||
#echo "Error: bad tag name:$tagged_name."
|
||||
#exit 1
|
||||
#fi
|
||||
|
||||
rpm_name="kernel"
|
||||
echo "rpm_name $rpm_name"
|
||||
|
||||
tlinux_release=`echo $tagged_name|cut -d- -f2`.`echo $tagged_name|cut -d- -f3`
|
||||
extra_version=`echo $tagged_name | cut -d- -f2`
|
||||
kernel_full_name=${rpm_name}-${kernel_version}
|
||||
#tlinux_release=${tagged_name#*-}
|
||||
}
|
||||
|
||||
prepare_tlinux_spec()
|
||||
{
|
||||
spec_file_name=${build_specdir}/${kernel_full_name}_${dist}.spec
|
||||
spec_contents="%define name ${rpm_name} \n"
|
||||
spec_contents+="%define version ${kernel_version} \n"
|
||||
spec_contents+="%define release_os ${tlinux_release} \n"
|
||||
spec_contents+="%define tagged_name ${tagged_name} \n"
|
||||
|
||||
echo -e "${spec_contents}" > $spec_file_name
|
||||
|
||||
if [ "$kvm_guest" = "yes" ] ; then
|
||||
cat $curdir/kernel-tlinux_kvmguest_${dist}.spec >> $spec_file_name
|
||||
else
|
||||
cat $curdir/kernel-tlinux_${dist}.spec >> $spec_file_name
|
||||
#cp $curdir/${kernel_full_name}_${dist}.spec $spec_file_name
|
||||
fi
|
||||
}
|
||||
|
||||
prepare_tlinux_bin_sources()
|
||||
{
|
||||
local kernel_tl3_rpm=${rpm_name}-${kernel_version}-${tlinux_release}.tl3.x86_64.rpm
|
||||
local kernel_debuginfo_tl3_rpm=${rpm_name}-debuginfo-common-${kernel_version}-${tlinux_release}.tl3.x86_64.rpm
|
||||
local kernel_headers_tl3_rpm=${rpm_name}-headers-${kernel_version}-${tlinux_release}.tl3.x86_64.rpm
|
||||
local kernel_devel_tl3_rpm=${rpm_name}-devel-${kernel_version}-${tlinux_release}.tl3.x86_64.rpm
|
||||
|
||||
if [ ! -f $kernel_tl3_rpm ]; then
|
||||
echo "$kernel_tl3_rpm not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f $kernel_debuginfo_tl3_rpm ]; then
|
||||
echo "$kernel_debuginfo_tl3_rpm not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f $kernel_headers_tl3_rpm ]; then
|
||||
echo "$kernel_headers_tl3_rpm not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rm -rf ${rpm_name}-${kernel_version}
|
||||
rm -rf ${rpm_name}-${kernel_version}_bin.tar.gz
|
||||
mkdir ${rpm_name}-${kernel_version}
|
||||
pushd .
|
||||
cd ${rpm_name}-${kernel_version}
|
||||
rpm2cpio ../$kernel_tl3_rpm | cpio -divm
|
||||
rpm2cpio ../$kernel_debuginfo_tl3_rpm | cpio -divm
|
||||
rpm2cpio ../$kernel_headers_tl3_rpm | cpio -divm
|
||||
rpm2cpio ../$kernel_devel_tl3_rpm | cpio -divm
|
||||
popd
|
||||
tar -czvf ${rpm_name}-${kernel_version}_bin.tar.gz ${rpm_name}-${kernel_version}
|
||||
}
|
||||
|
||||
#main function
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "please specify tag"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
tag_name=$1
|
||||
|
||||
if [ ! -e "${build_srcdir}" ]; then
|
||||
mkdir $build_srcdir
|
||||
[ $? == 1 ] && exit 1
|
||||
fi
|
||||
|
||||
if [ ! -e "${build_specdir}" ]; then
|
||||
mkdir $build_specdir
|
||||
[ $? == 1 ] && exit 1
|
||||
fi
|
||||
|
||||
origsrc=`pwd`
|
||||
|
||||
get_kernel_version $origsrc
|
||||
get_tlinux_name
|
||||
prepare_tlinux_bin_sources
|
||||
echo "Prepare $kernel_full_name source."
|
||||
prepare_tlinux_spec
|
||||
|
||||
|
||||
if test -e ${build_srcdir}/${kernel_full_name}; then
|
||||
rm -fr ${build_srcdir}/${kernel_full_name}
|
||||
fi
|
||||
|
||||
rm -rf /var/tmp/${kernel_full_name}
|
||||
|
||||
cp ${kernel_full_name}_bin.tar.gz ${build_srcdir}/
|
||||
|
||||
echo "Build kernel rpm package."
|
||||
|
||||
rpmbuild -bb ${target} ${spec_file_name}
|
||||
|
|
@ -1,268 +0,0 @@
|
|||
%global with_debuginfo 0
|
||||
%global with_perf 1
|
||||
%if 0%{?rhel} == 6
|
||||
%global rdist .tl1
|
||||
%global debug_path /usr/lib/debug/lib/
|
||||
%else
|
||||
%global debug_path /usr/lib/debug/usr/lib/
|
||||
%if 0%{?rhel} == 7
|
||||
%global rdist .tl2
|
||||
%global _enable_debug_packages %{nil}
|
||||
%global debug_package %{nil}
|
||||
%global __debug_package %{nil}
|
||||
%global __debug_install_post %{nil}
|
||||
%else
|
||||
%if 0%{?rhel} == 8
|
||||
%global rdist .tl3
|
||||
%global __python /usr/bin/python2
|
||||
%global _enable_debug_packages %{nil}
|
||||
%global debug_package %{nil}
|
||||
%global __debug_package %{nil}
|
||||
%global __debug_install_post %{nil}
|
||||
%endif
|
||||
%endif
|
||||
%endif
|
||||
|
||||
%global dist %{nil}
|
||||
|
||||
Summary: Kernel for Tencent physical machine
|
||||
Name: %{name}
|
||||
Version: %{version}
|
||||
Release: %{release_os}%{?rdist}
|
||||
License: GPLv2
|
||||
Vendor: Tencent
|
||||
Packager: tlinux team <g_CAPD_SRDC_OS@tencent.com>
|
||||
Provides: kernel = %{version}-%{release}
|
||||
Group: System Environment/Kernel
|
||||
Source0: %{name}-%{version}_bin.tar.gz
|
||||
Source1: tlinux_cciss_link.modules
|
||||
URL: http://www.tencent.com
|
||||
ExclusiveArch: x86_64
|
||||
Distribution: Tencent Linux
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-build
|
||||
BuildRequires: wget bc module-init-tools curl
|
||||
Requires(pre): linux-firmware >= 20150904-44
|
||||
|
||||
# for the 'hostname' command
|
||||
%if 0%{?rhel} >= 7
|
||||
BuildRequires: hostname
|
||||
%else
|
||||
BuildRequires: net-tools
|
||||
%endif
|
||||
|
||||
%description
|
||||
This package contains tlinux kernel, the core of operating system.
|
||||
|
||||
%package debuginfo-common
|
||||
Summary: tlinux kernel vmlinux for crash debug
|
||||
Release: %{release}
|
||||
Group: System Environment/Kernel
|
||||
Provides: kernel-debuginfo-common kernel-debuginfo
|
||||
Obsoletes: kernel-debuginfo
|
||||
AutoReqprov: no
|
||||
|
||||
%description debuginfo-common
|
||||
This package container vmlinux, System.map and config files for kernel
|
||||
debugging.
|
||||
|
||||
%package devel
|
||||
Summary: Development package for building kernel modules to match the %{version}-%{release} kernel
|
||||
Release: %{release}
|
||||
Group: System Environment/Kernel
|
||||
AutoReqprov: no
|
||||
|
||||
%description devel
|
||||
This package provides kernel headers and makefiles sufficient to build modules
|
||||
against the %{version}-%{release} kernel package.
|
||||
|
||||
%package headers
|
||||
Summary: Header files for the Linux kernel for use by glibc
|
||||
Group: Development/System
|
||||
Obsoletes: glibc-kernheaders
|
||||
Provides: glibc-kernheaders = 3.0-46
|
||||
Provides: kernel-headers
|
||||
Obsoletes: kernel-headers
|
||||
AutoReqprov: no
|
||||
|
||||
%description headers
|
||||
Kernel-headers includes the C header files that specify the interface
|
||||
between the Linux kernel and userspace libraries and programs. The
|
||||
header files define structures and constants that are needed for
|
||||
building most standard programs and are also needed for rebuilding the
|
||||
glibc package.
|
||||
|
||||
# prep #########################################################################
|
||||
%prep
|
||||
|
||||
%setup -q -c -T -a 0
|
||||
|
||||
# build ########################################################################
|
||||
%build
|
||||
|
||||
# install ######################################################################
|
||||
%install
|
||||
|
||||
echo install %{version}
|
||||
arch=`uname -m`
|
||||
if [ "$arch" != "x86_64" ];then
|
||||
echo "Unexpected error. Cannot build this rpm in non-x86_64 platform\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
pwd
|
||||
|
||||
cd %{name}-%{version}
|
||||
|
||||
cp -rp * %buildroot/
|
||||
|
||||
elfname=vmlinuz-%{tagged_name}%{?dist}
|
||||
mapname=System.map-%{tagged_name}%{?dist}
|
||||
configname=config-%{tagged_name}%{?dist}
|
||||
|
||||
mkdir -p %buildroot/boot
|
||||
mv %buildroot/lib/modules/%tagged_name/vmlinuz %buildroot/boot/${elfname}
|
||||
mv %buildroot/lib/modules/%tagged_name/dist_compat/${mapname} %buildroot/boot/${mapname}
|
||||
mv %buildroot/lib/modules/%tagged_name/dist_compat/${configname} %buildroot/boot/${configname}
|
||||
mv %buildroot/lib/modules/%tagged_name/dist_compat/.vmlinuz-%{tagged_name}%{?dist}.hmac %buildroot/boot/
|
||||
|
||||
mv %buildroot/lib/modules/%tagged_name/dist_compat/modules.symbols.bin %buildroot/lib/modules/%tagged_name/
|
||||
mv %buildroot/lib/modules/%tagged_name/dist_compat/modules.symbols %buildroot/lib/modules/%tagged_name/
|
||||
mv %buildroot/lib/modules/%tagged_name/dist_compat/modules.softdep %buildroot/lib/modules/%tagged_name/
|
||||
mv %buildroot/lib/modules/%tagged_name/dist_compat/modules.devname %buildroot/lib/modules/%tagged_name/
|
||||
mv %buildroot/lib/modules/%tagged_name/dist_compat/modules.dep.bin %buildroot/lib/modules/%tagged_name/
|
||||
mv %buildroot/lib/modules/%tagged_name/dist_compat/modules.dep %buildroot/lib/modules/%tagged_name/
|
||||
mv %buildroot/lib/modules/%tagged_name/dist_compat/modules.builtin.bin %buildroot/lib/modules/%tagged_name/
|
||||
mv %buildroot/lib/modules/%tagged_name/dist_compat/modules.alias.bin %buildroot/lib/modules/%tagged_name/
|
||||
mv %buildroot/lib/modules/%tagged_name/dist_compat/modules.alias %buildroot/lib/modules/%tagged_name/
|
||||
|
||||
%pre
|
||||
# pre #########################################################################
|
||||
system_arch=`uname -m`
|
||||
|
||||
if [ %{_target_cpu} != ${system_arch} ]; then
|
||||
echo "ERROR: Failed installing this rpm!!!!"
|
||||
echo "This rpm is intended for %{_target_cpu} platform. It seems your system is ${system_arch}.";
|
||||
exit 1;
|
||||
fi;
|
||||
|
||||
%post
|
||||
# post #########################################################################
|
||||
echo "Install tlinux kernel"
|
||||
%if 0%{?rhel} >= 7
|
||||
/sbin/new-kernel-pkg --package kernel --install %{tagged_name}%{?dist} --kernel-args="crashkernel=512M-12G:128M,12G-64G:256M,64G-128G:512M,128G-:768M" --make-default|| exit $?
|
||||
%else
|
||||
/sbin/new-kernel-pkg --install %{tagged_name}%{?dist} --kernel-args="crashkernel=512M-12G:128M,12G-64G:256M,64G-128G:512M,128G-:768M" --banner="tkernel 3.0" || exit $?
|
||||
|
||||
# check relase info to get suffix
|
||||
suffix=default
|
||||
|
||||
# modify boot menu
|
||||
grubconfig=/boot/grub/grub.conf
|
||||
if [ -d /sys/firmware/efi -a -f /boot/efi/EFI/tencent/grub.efi ]; then
|
||||
grubconfig=/boot/efi/EFI/tencent/grub.conf
|
||||
fi
|
||||
|
||||
# reduce multiple blank lines to one
|
||||
sed '/^$/{
|
||||
N
|
||||
/^\n$/D
|
||||
}' ${grubconfig} > ${grubconfig}.tmp
|
||||
mv ${grubconfig}.tmp ${grubconfig}
|
||||
rm -f ${grubconfig}.tmp
|
||||
|
||||
# set grub default according to $suffix we already got
|
||||
count=-1
|
||||
defcount=0
|
||||
while read line
|
||||
do
|
||||
echo $line | grep -q "title"
|
||||
if [ $? -eq 0 ]; then
|
||||
(( count++ ))
|
||||
fi
|
||||
if [ -f /etc/SuSE-release ]; then
|
||||
echo $line | grep -q "%{tagged_name}%{?dist}"
|
||||
elif [ -f /etc/redhat-release ]; then
|
||||
echo $line | grep -q "title.*\(%{tagged_name}%{?dist}\).*"
|
||||
fi
|
||||
result=$?
|
||||
if [ $result -eq 0 ] ; then
|
||||
break
|
||||
fi
|
||||
if [ -f /etc/SuSE-release ]; then
|
||||
echo $line | grep -q "title %{tagged_name}%{?dist}"
|
||||
elif [ -f /etc/redhat-release ]; then
|
||||
echo $line | grep -q "title.*(%{tagged_name}%{?dist}).*"
|
||||
fi
|
||||
if [ $? -eq 0 ] ; then
|
||||
defcount=$count
|
||||
fi
|
||||
done < $grubconfig
|
||||
|
||||
if [ $result -eq 0 ] ; then
|
||||
index=$count
|
||||
else
|
||||
index=$defcount
|
||||
fi
|
||||
|
||||
if [ -f /etc/SuSE-release ]; then
|
||||
sed -n "/^default /!p;
|
||||
{/^default /c\
|
||||
\default $index
|
||||
}
|
||||
" $grubconfig > $grubconfig.NEW
|
||||
mv $grubconfig.NEW $grubconfig
|
||||
elif [ -f /etc/redhat-release ]; then
|
||||
sed -n "/^default=/!p;
|
||||
{/^default=/c\
|
||||
\default=$index
|
||||
}
|
||||
" $grubconfig > $grubconfig.NEW
|
||||
mv $grubconfig.NEW $grubconfig
|
||||
fi
|
||||
%endif
|
||||
echo -e "Set Grub default to \"%{tagged_name}%{?dist}\" Done."
|
||||
|
||||
%postun
|
||||
# postun #######################################################################
|
||||
/sbin/new-kernel-pkg --rminitrd --dracut --remove %{tagged_name}%{?dist} || exit $?
|
||||
echo -e "Remove \"%{tagged_name}%{?dist}\" Done."
|
||||
|
||||
%if 0%{?rhel} >= 7
|
||||
%posttrans
|
||||
# posttrans ####################################################################
|
||||
/sbin/new-kernel-pkg --package kernel --mkinitrd --dracut --depmod --update %{tagged_name}%{?dist} || exit $?
|
||||
/sbin/new-kernel-pkg --package kernel --rpmposttrans %{tagged_name}%{?dist} || exit $?
|
||||
%endif
|
||||
|
||||
%files
|
||||
# files ########################################################################
|
||||
%defattr(-,root,root)
|
||||
/boot/vmlinuz-%%{tagged_name}%%{?dist}
|
||||
/boot/.vmlinuz-%%{tagged_name}%%{?dist}.hmac
|
||||
/boot/System.map-%%{tagged_name}%%{?dist}
|
||||
/boot/config-%%{tagged_name}%%{?dist}
|
||||
/boot/symvers-%{tagged_name}%{?dist}*
|
||||
/etc/sysconfig/modules/tlinux_cciss_link.modules
|
||||
/lib/modules/%%{tagged_name}/*
|
||||
|
||||
%files debuginfo-common
|
||||
%defattr(-,root,root)
|
||||
/boot/vmlinux-%{tagged_name}%{?dist}
|
||||
%dir %debug_path
|
||||
%debug_path/modules
|
||||
#/boot/System.map-%%{version}-%%{title}-%%{release_os}-*
|
||||
#/boot/config-%%{version}-%%{title}-%%{release_os}-*
|
||||
|
||||
|
||||
%files devel
|
||||
%defattr(-,root,root)
|
||||
/usr/src/kernels/%{tagged_name}%{?dist}
|
||||
|
||||
%files headers
|
||||
%defattr(-,root,root)
|
||||
/usr/include/*
|
||||
|
||||
# changelog ###################################################################
|
||||
%changelog
|
||||
* Thu Feb 2 2012 Samuel Liao <samuelliao@tencent.com>
|
||||
- Initial 3.0.18 repository
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ -b /dev/sda -a ! -b /dev/cciss/c0d0 ]; then
|
||||
mkdir -p /dev/cciss
|
||||
set -- 0 a 1 b 2 c 3 d 4 e 5 f 6 g 7 h 8 i 9 j 10 k 11 l 12 m 13 n 14 o 15 p
|
||||
while [ $# -ge 2 ]; do
|
||||
c=/dev/cciss/c0d$1; shift
|
||||
s=/dev/sd$1; shift
|
||||
ln -s ${s} ${c}
|
||||
ln -s ${s}1 ${c}p1
|
||||
ln -s ${s}2 ${c}p2
|
||||
ln -s ${s}3 ${c}p3
|
||||
ln -s ${s}4 ${c}p4
|
||||
done
|
||||
fi
|
||||
|
||||
Loading…
Reference in New Issue