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"
11 prepare_and_build_srpm() {
13 pushd $TOPDIR >/dev/null
15 # generate our buildid
16 local buildid="lustre${EXTRA_VERSION##*_lustre}"
18 # do release specific spec editing
20 mkdir -p config/$(basearch $TARGET_ARCH)
21 cp $CONFIG_FILE config/$(basearch $TARGET_ARCH)/$RPMSMPTYPE
22 tar cjf SOURCES/config.tar.bz2 config
25 # do we need any special rpm build options
26 local rpmbuildopt="-bb"
31 # XXX - ignore the kabi changes. need to figure out what this is really
33 touch SOURCES/IGNORE-KABI-BADNESS
36 if ! rpmbuild $rpmbuildopt --target ${TARGET_ARCH} \
37 --define "_topdir $TOPDIR" \
38 $TOPDIR/SOURCES/kernel-$RPMSMPTYPE.spec 2>&1; then
39 fatal 1 "Failed to build kernel RPM"
42 # for SLES, we also need to build the kernel-source rpm
43 if ! rpmbuild $rpmbuildopt $targets \
44 --define "_topdir $TOPDIR" \
45 $TOPDIR/SOURCES/kernel-source.spec 2>&1; then
46 fatal 1 "Failed to build kernel source RPM"
49 # for SLES, we also need to build the kernel-syms rpm
50 if ! rpmbuild $rpmbuildopt $targets \
51 --define "_topdir $TOPDIR" \
52 $TOPDIR/SOURCES/kernel-syms.spec 2>&1; then
53 fatal 1 "Failed to build kernel syms RPM"
59 local lustre=${1:-false}
62 echo "kernel-lustre-$DEVEL_KERNEL_TYPE"
64 echo "kernel-$DEVEL_KERNEL_TYPE"
69 rpm_BUILD_kernel_dirname() {
76 if $KERNEL_LUSTRE_NAMING; then
79 echo kernel${lustre}-${rpmsmptype}-${lnxmaj}${lnxmin}/linux-${lnxmaj}
84 # because we build an i686 kernel, we need to know if the arch we are
85 # resolving for is for the patched or patchless kernel (which is i586)
86 # we really should be building an i586 kernel to match what Novell does
87 local for_patchless=${2:-true}
88 local canonical=${3:-false}
93 i?86) if $canonical; then
95 elif $(eval $for_patchless); then
105 find_linux_devel_paths() {
107 local linuxobjpath=$path/usr/src/linux-${lnxmaj}${lnxmin}-${lnxrel}-obj/$(resolve_arch $TARGET_ARCH $PATCHLESS)/$RPMSMPTYPE
108 local linuxmodpath=$path/lib/modules/${lnxmaj}${lnxmin}-${lnxrel}-$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 build and source to the local path instead of system's
114 ln -sf $linuxobjpath $linuxmodpath/build
115 ln -sf $LINUX $linuxmodpath/source
116 # symlink the linux-obj to linux-version-obj
117 ln -s $linuxobjpath $LINUXOBJ
118 # We need to copy the headers from the source to the object tree for
119 # MOFED to be able to compile (a bug in ofed?)
120 if [ -e ${LINUX}/include ] && [ -e ${LINUXOBJ}/include ]; then
121 cp -rf ${LINUX}/include ${LINUXOBJ}
123 # We modify %kernel_module_package macro to use the linux obj
124 # that lbuild install, not the OS installed /usr/src
125 sed -e "s/\/usr\/src/${path//\//\\/}\/usr\/src/" \
126 -e "s/\/boot/${path//\//\\/}\/boot/" ${SUSE_MACROS} > $RMAC
131 mcpu_rpmbuild_opt() {
133 echo "--define \'jobs $(/usr/bin/getconf _NPROCESSORS_ONLN)\'"
137 # This function digs out the linux release from a linux-obj tree
138 find_linux_release() {
139 _find_linux_release $LINUXOBJ
142 # cleanup the modified/added rpmmacros
143 cleanup_rpmmacros() {
144 sed -i -e "/^%kernel_module_package/,/^)}$/d" \
145 -e "/^# A few cross-distro definitions/d" $RMAC