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
21 mkdir -p config/$(basearch $TARGET_ARCH)
22 cp $CONFIG_FILE config/$(basearch $TARGET_ARCH)/$RPMSMPTYPE
23 tar cjf SOURCES/config.tar.bz2 config
26 # do we need any special rpm build options
27 local rpmbuildopt="-bb"
32 # XXX - ignore the kabi changes. need to figure out what this is really
34 touch SOURCES/IGNORE-KABI-BADNESS
37 if ! rpmbuild $rpmbuildopt --target ${TARGET_ARCH} \
38 --define "_topdir $TOPDIR" \
39 $TOPDIR/SOURCES/kernel-$RPMSMPTYPE.spec 2>&1; then
40 fatal 1 "Failed to build kernel RPM"
43 # for SLES, we also need to build the kernel-source rpm
44 if ! rpmbuild $rpmbuildopt $targets \
45 --define "_topdir $TOPDIR" \
46 $TOPDIR/SOURCES/kernel-source.spec 2>&1; then
47 fatal 1 "Failed to build kernel source RPM"
50 # for SLES, we also need to build the kernel-syms rpm
51 if ! rpmbuild $rpmbuildopt $targets \
52 --define "_topdir $TOPDIR" \
53 $TOPDIR/SOURCES/kernel-syms.spec 2>&1; then
54 fatal 1 "Failed to build kernel syms RPM"
60 local lustre=${1:-false}
63 echo "kernel-lustre-$DEVEL_KERNEL_TYPE"
65 echo "kernel-$DEVEL_KERNEL_TYPE"
70 rpm_BUILD_kernel_dirname() {
77 if $KERNEL_LUSTRE_NAMING; then
80 echo kernel${lustre}-${rpmsmptype}-${lnxmaj}${lnxmin}/linux-${lnxmaj}
85 # because we build an i686 kernel, we need to know if the arch we are
86 # resolving for is for the patched or patchless kernel (which is i586)
87 # we really should be building an i586 kernel to match what Novell does
88 local for_patchless=${2:-true}
89 local canonical=${3:-false}
94 i?86) if $canonical; then
96 elif $(eval $for_patchless); then
106 find_linux_devel_paths() {
108 local linuxobjpath=$path/usr/src/linux-${lnxmaj}${lnxmin}-${lnxrel}-obj/$(resolve_arch $TARGET_ARCH $PATCHLESS)/$RPMSMPTYPE
110 LINUX=$path/usr/src/linux-${lnxmaj}${lnxmin}-${lnxrel}
111 LINUXOBJ=$path/usr/src/linux-obj/$(resolve_arch $TARGET_ARCH $PATCHLESS)/$RPMSMPTYPE
113 # symlink the linux-obj to linux-version-obj
114 ln -s $linuxobjpath $LINUXOBJ
115 # We need to copy the headers from the source to the object tree for
116 # MOFED to be able to compile (a bug in ofed?)
117 if [ -e ${LINUX}/include ] && [ -e ${LINUXOBJ}/include ]; then
118 cp -rf ${LINUX}/include ${LINUXOBJ}
120 # We modify %kernel_module_package macro to use the linux obj
121 # that lbuild install, not the OS installed /usr/src
122 sed -i -e "/^%kernel_module_package/,/^)}$/d" \
123 -e "/^# A few cross-distro definitions/d" $RMAC
124 sed -e "s/\/usr\/src/${path//\//\\/}\/usr\/src/" \
125 -e "s/\/boot/${path//\//\\/}\/boot/" ${SUSE_MACROS} >> $RMAC
130 mcpu_rpmbuild_opt() {
132 echo "--define \'jobs $(/usr/bin/getconf _NPROCESSORS_ONLN)\'"
136 # This function digs out the linux release from a linux-obj tree
137 find_linux_release() {
138 _find_linux_release $LINUXOBJ
141 # cleanup the modified/added rpmmacros
142 cleanup_rpmmacros() {
143 sed -i -e "/^%kernel_module_package/,/^)}$/d" \
144 -e "/^# A few cross-distro definitions/d" $RMAC