代码拉取完成,页面将自动刷新
同步操作将从 src-anolis-sig/ck-build 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#!/bin/bash
#
# Anolis Cloud Kernel rpm builder
#
[ -z $WORKSPACE ] && WORKSPACE=$(pwd)
[ -z $BUILD_NUMBER ] && BUILD_NUMBER=0
topdir="${WORKSPACE}"
srcdir="${topdir}/cloud-kernel"
rpmbuilddir="${topdir}/rpmbuild"
outputdir="${topdir}/outputs"
dist="an8"
kernel_spec="${topdir}/kernel.spec"
nproc=$(grep -c processor /proc/cpuinfo)
function do_prep() {
rm -rf ${rpmbuilddir}
mkdir -p ${rpmbuilddir}/{SOURCES,SPECS}
cp ${kernel_spec} ${rpmbuilddir}/SPECS/kernel.spec
pushd ${srcdir}/ > /dev/null
KVER=$(make kernelversion)
if [ -z "${KVER##*-*}" ]; then
RELEASE=${KVER##*-}
KVER=${KVER%%-*}
fi
if [ "_${RELEASE}" == "_" ]; then
commit_sha=$(git rev-parse --short HEAD)
KREL="${BUILD_NUMBER}.git.${commit_sha}"
else
KREL=${RELEASE}
fi
sed -i "s/!KREL:.*}/!KREL:${KREL}}/" ${rpmbuilddir}/SPECS/kernel.spec
pkgname="linux-${KVER}-${KREL}.${dist}"
git archive --format=tar --prefix="${pkgname}/" HEAD | xz -T${nproc} > "${rpmbuilddir}/SOURCES/${pkgname}.tar.xz"
if [ -f arch/x86/configs/anolis_defconfig ]
then
cp arch/x86/configs/anolis_defconfig ${rpmbuilddir}/SOURCES/kernel-${KVER}-x86_64.config
cp arch/x86/configs/anolis-debug_defconfig ${rpmbuilddir}/SOURCES/kernel-${KVER}-x86_64-debug.config
cp arch/arm64/configs/anolis_defconfig ${rpmbuilddir}/SOURCES/kernel-${KVER}-aarch64.config
cp arch/arm64/configs/anolis-debug_defconfig ${rpmbuilddir}/SOURCES/kernel-${KVER}-aarch64-debug.config
popd > /dev/null
else
popd > /dev/null
cp anolis_defconfig.x86 ${rpmbuilddir}/SOURCES/kernel-${KVER}-x86_64.config
cp anolis-debug_defconfig.x86 ${rpmbuilddir}/SOURCES/kernel-${KVER}-x86_64-debug.config
cp anolis_defconfig.arm64 ${rpmbuilddir}/SOURCES/kernel-${KVER}-aarch64.config
cp anolis-debug_defconfig.arm64 ${rpmbuilddir}/SOURCES/kernel-${KVER}-aarch64-debug.config
fi
cp cpupower* ${rpmbuilddir}/SOURCES/
cp filter-* ${rpmbuilddir}/SOURCES/
cp mod-* ${rpmbuilddir}/SOURCES/
cp generate_bls_conf.sh ${rpmbuilddir}/SOURCES/
}
function do_rpmbuild() {
if [ "_${RELEASE}" == "_" ]; then
CMD="-bb"
else
CMD="-ba"
fi
# Now we have:
# + variants: default, only-debug, with-debug
# + extras: base, with-debuginfo, full
# + modes: nightly, dev, pre-release
#TODO: add with-gcov
#
# Matrix
#
# | Extra\Var | Default | Only-debug | With-debug |
# |-----------|----------|------------|------------|
# | Base | +default | -default | +default |
# | | -debug | +debug | +debug |
# | | +headers |
# |-----------|------------------------------------|
# | debuginfo | +debuginfo |
# |-----------|------------------------------------|
# | full | +tools +doc +perf |
#
# Note: pre-release mode will always be "full" and "with-debug" by default
build_opts="--with headers --without bpftool --without signmodules"
if [ "_${BUILD_VARIANT}" == "_only-debug" ]; then
build_opts="$build_opts --without default --with debug"
elif [ "_${BUILD_VARIANT}" == "_with-debug" ]; then
build_opts="$build_opts --with default --with debug"
else # assume default
build_opts="$build_opts --with default --without debug"
fi
if [ "_${BUILD_EXTRA}" == "_debuginfo" ]; then
build_opts="$build_opts --with debuginfo --without tools --without doc --without perf"
elif [ "_${BUILD_EXTRA}" == "_base" ]; then
build_opts="$build_opts --without debuginfo --without tools --without doc --without perf"
else # assume full
build_opts="$build_opts --with debuginfo --with tools --with doc --with perf"
fi
rpmbuild \
--define "%_smp_mflags -j${nproc}" \
--define "%packager <alicloud-linux@alibaba-inc.com>" \
--define "%_topdir ${rpmbuilddir}" \
--define "%KVER ${KVER}" \
--define "%KREL ${KREL}" \
${build_opts} \
${CMD} ${rpmbuilddir}/SPECS/kernel.spec \
--target=$(uname -m) || exit 1
}
function output() {
if [ "_${RELEASE}" == "_" ]; then
targetdir=${BUILD_NUMBER}
else
targetdir=${RELEASE}
fi
mkdir -p ${outputdir}/${targetdir}
cp ${rpmbuilddir}/RPMS/$(uname -m)/*.rpm ${outputdir}/${targetdir}/
cp ${rpmbuilddir}/SRPMS/*.rpm ${outputdir}/${targetdir}
i=0
for p in ${outputdir}/${targetdir}/*.rpm; do
echo $p
((i++))
done
echo "$i rpm(s) copied."
}
do_prep
do_rpmbuild
output
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。