This repository has been archived by the owner on Jul 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
ampere-centos-build.sh
executable file
·78 lines (64 loc) · 2.79 KB
/
ampere-centos-build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/sh
#
# Usage: ampere-centos-build.sh <build-tag>
#
# where the build-tag format is YYMMDD where YY is last year digit, MM is month, and DD is day
#
# NOTE: build-tag is auto generated by date if not provided.
#
# These need to match with the definition in .spec file
#
echo off
APM_TOOLCHAIN_VER=9.0.7-le
APM_COMPILER_PATH=/opt/apm/${APM_TOOLCHAIN_VER}/usr/bin
CROSS_COMPILER_PATH=/tools/arm/armv8/Theobroma/opt/apm-aarch64/${APM_TOOLCHAIN_VER}/bin
if [ -d "$APM_COMPILER_PATH" ]; then
PATH=${APM_COMPILER_PATH}:$PATH
export PATH
fi
if [ -d "$CROSS_COMPILER_PATH" ]; then
PATH=${CROSS_COMPILER_PATH}:$PATH
export PATH
fi
MACHINE_TYPE=`uname -m`
if [ ${MACHINE_TYPE} == 'aarch64' ]; then
export -n CROSS_COMPILE
fi
if [ ${MACHINE_TYPE} == 'x86_64' ]; then
export CROSS_COMPILE=aarch64-apm-linux-gnu-
fi
TODAY=`date +%y%m%d`
RELBUILD="${TODAY}"
if [ -n "${1}" ]; then
RELBUILD=${1}
fi
CENTOSNAMEPREFIX=amp_sw_centos_7.4
CENTOSSPECFILE=SPECS/kernel-xgene.spec
CENTOSOPTIMIZESPECFILE=SPECS/kernel-xgene-optimized.spec
RPMVERSION=`grep -e "^%define rpmversion" ${CENTOSSPECFILE} | cut -d' ' -f3`
PKGRELEASE=`grep -e "^%define pkgrelease" ${CENTOSSPECFILE} | cut -d' ' -f3`
rpmversion=${RPMVERSION}
pkgrelease=${PKGRELEASE}
# Prepare Linux source in SOURCES/
LINUX_SRC=linux-${rpmversion}-${pkgrelease}
rm -fr ${LINUX_SRC} SOURCES/linux-${rpmversion}-${pkgrelease}.tar.xz
cp -r ../ampere-centos-kernel ${LINUX_SRC}
cd ${LINUX_SRC};make distclean;rm -fr .git;cd -
tar -cJf SOURCES/linux-${rpmversion}-${pkgrelease}.tar.xz ${LINUX_SRC}
rm -fr ${LINUX_SRC} RPMS/aarch64/* SRPMS/*
echo "Building for generic release tag ${RELBUILD}"
#Update build release tag to spec file
#sed -i "s/ buildid \..*/ buildid \.${RELBUILD}+amp/g" ${CENTOSSPECFILE}
rpmbuild --target aarch64 --define "%_topdir `pwd`" --define "buildid .${RELBUILD}+amp" --without debug --without debuginfo --without tools --without perf -ba ${CENTOSSPECFILE}
cd RPMS/aarch64; md5sum *.rpm > ${CENTOSNAMEPREFIX}-${RELBUILD}_md5sum.txt; cd -
cd RPMS/; tar -cJf ../${CENTOSNAMEPREFIX}-${RELBUILD}.tar.xz aarch64;cd -
tar -cJf ${CENTOSNAMEPREFIX}-${RELBUILD}.src.tar.xz SRPMS
rm -rf RPMS/aarch64/* SRPMS/*
echo "Building for optimized release tag ${RELBUILD}"
#Update build release tag to spec file
#sed -i "s/ buildid \..*/ buildid \.${RELBUILD}+amp.ilp32/g" ${CENTOSOPTIMIZESPECFILE}
rpmbuild --target aarch64 --define "%_topdir `pwd`" --define "buildid .${RELBUILD}+amp.ilp32" --without debug --without debuginfo --without tools --without perf -ba ${CENTOSOPTIMIZESPECFILE}
cd RPMS/aarch64; md5sum *.rpm > ${CENTOSNAMEPREFIX}-${RELBUILD}.ilp32_md5sum.txt; cd -
cd RPMS/; tar -cJf ../${CENTOSNAMEPREFIX}-${RELBUILD}.ilp32.tar.xz aarch64;cd -
tar -cJf ${CENTOSNAMEPREFIX}-${RELBUILD}.ilp32-src.tar.xz SRPMS
rm -fr RPMS/aarch64/* SRPMS/*