1 # vim:expandtab:shiftwidth=4:softtabstop=4:tabstop=4:
3 # increment this if you have made a change that should force a new kernel
5 BUILD_GEN+=".2" #LU-3337 add missing build files for sles11sp2 server
7 DEVEL_KERNEL_TYPE="default-devel"
8 RPM_HELPERS_DIR="/usr/lib/rpm"
10 SUSE_MACROS=/etc/rpm/macros.kernel-source
12 prepare_and_build_srpm() {
14 pushd $TOPDIR >/dev/null
16 # generate our buildid
17 local buildid="lustre${EXTRA_VERSION##*_lustre}"
19 # do release specific spec editing
22 # XXX - need to flesh this out per the rhel5 method
24 for arch in $BUILD_ARCHS; do
25 targets="--target $arch $targets"
26 mkdir -p config/$(basearch $arch)
27 cp $CONFIG_FILE config/$(basearch $arch)/$RPMSMPTYPE
30 tar cjf SOURCES/config.tar.bz2 config
33 # do we need any special rpm build options
34 local rpmbuildopt="-bb"
39 # XXX - ignore the kabi changes. need to figure out what this is really
41 touch SOURCES/IGNORE-KABI-BADNESS
44 # XXX testing speedup hack - never let an inspection pass without this
45 # commented out! in fact it should be removed completely before a
49 if ! rpmbuild $rpmbuildopt $targets \
50 --define "_topdir $TOPDIR" \
51 $TOPDIR/SOURCES/kernel-$RPMSMPTYPE.spec 2>&1; then
52 fatal 1 "Failed to build kernel RPM"
56 # for SLES, we also need to build the kernel-source rpm
57 if ! rpmbuild $rpmbuildopt $targets \
58 --define "_topdir $TOPDIR" \
59 $TOPDIR/SOURCES/kernel-source.spec 2>&1; then
60 fatal 1 "Failed to build kernel source RPM"
63 # for SLES, we also need to build the kernel-syms rpm
64 if ! rpmbuild $rpmbuildopt $targets \
65 --define "_topdir $TOPDIR" \
66 $TOPDIR/SOURCES/kernel-syms.spec 2>&1; then
67 fatal 1 "Failed to build kernel syms RPM"
73 local lustre=${1:-false}
76 echo "kernel-lustre-$DEVEL_KERNEL_TYPE"
78 echo "kernel-$DEVEL_KERNEL_TYPE"
83 rpm_BUILD_kernel_dirname() {
90 if $KERNEL_LUSTRE_NAMING; then
93 echo kernel${lustre}-${rpmsmptype}-${lnxmaj}${lnxmin}/linux-${lnxmaj}
98 # because we build an i686 kernel, we need to know if the arch we are
99 # resolving for is for the patched or patchless kernel (which is i586)
100 # we really should be building an i586 kernel to match what Novell does
101 local for_patchless=${2:-true}
102 local canonical=${3:-false}
107 i?86) if $canonical; then
109 elif $(eval $for_patchless); then
119 find_linux_devel_paths() {
121 local linuxobjpath=$path/usr/src/linux-${lnxmaj}${lnxmin}-${lnxrel}-obj/$(resolve_arch $TARGET_ARCH $PATCHLESS)/$RPMSMPTYPE
123 LINUX=$path/usr/src/linux-${lnxmaj}${lnxmin}-${lnxrel}
124 LINUXOBJ=$path/usr/src/linux-obj/$(resolve_arch $TARGET_ARCH $PATCHLESS)/$RPMSMPTYPE
126 # symlink the linux-obj to linux-version-obj
127 ln -s $linuxobjpath $LINUXOBJ
128 # We need to copy the headers from the source to the object tree for
129 # MOFED to be able to compile (a bug in ofed?)
130 if [ -e ${LINUX}/include ] && [ -e ${LINUXOBJ}/include ]; then
131 cp -rf ${LINUX}/include ${LINUXOBJ}
133 # We modify %kernel_module_package macro to use the linux obj
134 # that lbuild install, not the OS installed /usr/src
135 sed -i -e "/^%kernel_module_package/,/^)}$/d" \
136 -e "/^# A few cross-distro definitions/d" $RMAC
137 sed -e "s/\/usr\/src/${path//\//\\/}\/usr\/src/" \
138 -e "s/\/boot/${path//\//\\/}\/boot/" ${SUSE_MACROS} >> $RMAC
143 mcpu_rpmbuild_opt() {
145 echo "--define \'jobs $(/usr/bin/getconf _NPROCESSORS_ONLN)\'"
149 # This function digs out the linux release from a linux-obj tree
150 find_linux_release() {
151 _find_linux_release $LINUXOBJ
154 # cleanup the modified/added rpmmacros
155 cleanup_rpmmacros() {
156 sed -i -e "/^%kernel_module_package/,/^)}$/d" \
157 -e "/^# A few cross-distro definitions/d" $RMAC