1 --- mptlinux.spec.dist 2008-11-07 02:16:26.000000000 -0500
2 +++ mptlinux.spec 2009-10-28 12:10:05.000000000 -0400
4 +%{!?kernel_obj: %define kernel_obj ""}
7 %define version 4.16.00.00
9 -Summary: MPT Fusion drivers for 53C1030, FC9XX, and SAS Adapters
10 +%define release 2sun1
11 +Summary: Common files for the MPT Fusion drivers for 53C1030, FC9XX, and SAS Adapters
17 -Group: System Environment/Kernel
18 +Group: Utilities/System
19 Source0: %{name}-%{version}.tar.gz
20 Source1: fusion.mptctl
21 URL: http://www.lsilogic.com
23 Fibre Channel FC909, FC919, FC929, FC919X, FC929X, and FC949X adapters
24 SAS SAS1064, SAS1068, and SAS1078 adapters.
26 +This package contains the common file(s).
29 +Summary: Kernel modules for the MPT Fusion drivers for 53C1030, FC9XX, and SAS Adapters
30 +Group: System Environment/Kernel
34 +Drivers for (suse i686, x86_64, ia64 and updates) for the
35 +LSI Logic Fusion-MPT Architecture parts.
36 +These include the Ultra320 53C1030 and 53C1020 adapters.
37 +Fibre Channel FC909, FC919, FC929, FC919X, FC929X, and FC949X adapters
38 +SAS SAS1064, SAS1068, and SAS1078 adapters.
40 +This package contains the drivers.
42 # prep #########################################################################
49 # build ########################################################################
53 +if [ "%{kernel_obj}" != "" ]; then
54 + # dig the version out of the tree
55 + LINUXRELEASEHEADER=%{kernel_obj}/include/linux/version.h
56 + if [ -s %{kernel_obj}/include/linux/utsrelease.h ]; then
57 + LINUXRELEASEHEADER=%{kernel_obj}/include/linux/utsrelease.h
59 + LINUXRELEASE=$(sed -ne 's/#define UTS_RELEASE "\(.*\)"$/\1/p' $LINUXRELEASEHEADER)
61 + make build LINUX=%{kernel_obj} KERNEL=$LINUXRELEASE
63 for i in /lib/modules/2.6.*; do
64 - kernel=`basename ${i}`;
65 + kernel=`basename ${i}`
66 if [ -f /lib/modules/${kernel}/source/drivers/message/fusion/Kconfig ]; then
67 - make build KERNEL=$kernel;
70 + make build KERNEL=$kernel
75 # install ######################################################################
77 echo install %{version}
78 echo "%defattr(-,root,root)" > $RPM_BUILD_DIR/file.list.%{name}
79 +echo "%defattr(-,root,root)" > $RPM_BUILD_DIR/file.list.%{name}-modules
80 echo "/etc/init.d/fusion.mptctl" >> $RPM_BUILD_DIR/file.list.%{name}
81 mkdir -p $RPM_BUILD_ROOT/etc/init.d
82 -cp -rf $RPM_SOURCE_DIR/fusion.mptctl $RPM_BUILD_ROOT/etc/init.d
83 +cp -f $RPM_SOURCE_DIR/fusion.mptctl $RPM_BUILD_ROOT/etc/init.d
84 +if [ "%{kernel_obj}" != "" ]; then
85 + # dig the version out of the tree
86 + LINUXRELEASEHEADER=%{kernel_obj}/include/linux/version.h
87 + if [ -s %{kernel_obj}/include/linux/utsrelease.h ]; then
88 + LINUXRELEASEHEADER=%{kernel_obj}/include/linux/utsrelease.h
90 + kernel="$(sed -ne 's/#define UTS_RELEASE "\(.*\)"$/\1/p' $LINUXRELEASEHEADER)"
92 + #if [ ! -e /lib/modules/${kernel}/source/drivers/message/fusion/Kconfig ]; then
95 + MPTLINUX_IPATH=/lib/modules/${kernel}/updates/drivers/message/fusion
96 + mkdir -p $RPM_BUILD_ROOT/lib/modules/${kernel}/{kernel,updates}/drivers/message/fusion
98 + # create the file list used in %files to indicate which files are in package
99 + for driver_name in mptbase.ko mptscsih.ko mptctl.ko mptlan.ko mptspi.ko mptfc.ko mptsas.ko; do
100 + echo "$MPTLINUX_IPATH/${driver_name}" >> $RPM_BUILD_DIR/file.list.%{name}-modules
103 + make install PREFIX=$RPM_BUILD_ROOT LINUX=%{kernel_obj} KERNEL=$kernel
104 + # the Makefile hardcodes the destination path to
105 + # $(PREFIX)/lib/modules/$(KERNEL)/kernel/drivers/message/fusion
106 + # so lets move these to where they really go
107 + # ideally, the Makefile should take this location as an (optional if you
109 + mv -f $RPM_BUILD_ROOT/lib/modules/${kernel}/kernel/drivers/message/fusion/* \
110 + $RPM_BUILD_ROOT/$MPTLINUX_IPATH/
112 for i in /lib/modules/2.6.*; do
113 kernel=`basename ${i}`
114 if [ ! -e /lib/modules/${kernel}/source/drivers/message/fusion/Kconfig ]; then
117 - MPTLINUX_IPATH=/lib/modules/${kernel}/kernel/drivers/message/fusion
118 - mkdir -p $RPM_BUILD_ROOT/lib/modules/${kernel}/kernel/drivers/message/fusion
121 + MPTLINUX_IPATH=/lib/modules/${kernel}/updates/drivers/message/fusion
122 + mkdir -p $RPM_BUILD_ROOT/lib/modules/${kernel}/{kernel,updates}/drivers/message/fusion
124 # create the file list used in %files to indicate which files are in package
125 for driver_name in mptbase.ko mptscsih.ko mptctl.ko mptlan.ko mptspi.ko mptfc.ko mptsas.ko; do
126 - echo "$MPTLINUX_IPATH/${driver_name}.new" >> $RPM_BUILD_DIR/file.list.%{name}
128 + echo "$MPTLINUX_IPATH/${driver_name}" >> $RPM_BUILD_DIR/file.list.%{name}-modules
131 make install PREFIX=$RPM_BUILD_ROOT KERNEL=$kernel
133 - for driver_name in mptbase.ko mptscsih.ko mptctl.ko mptlan.ko mptspi.ko mptfc.ko mptsas.ko; do
134 - mv -f $RPM_BUILD_ROOT/$MPTLINUX_IPATH/${driver_name} \
135 - $RPM_BUILD_ROOT/$MPTLINUX_IPATH/${driver_name}.new
138 + # the Makefile hardcodes the destination path to
139 + # $(PREFIX)/lib/modules/$(KERNEL)/kernel/drivers/message/fusion
140 + # so lets move these to where they really go
141 + # ideally, the Makefile should take this location as an (optional if you
143 + mv -f $RPM_BUILD_ROOT/lib/modules/${kernel}/kernel/drivers/message/fusion/* \
144 + $RPM_BUILD_ROOT/$MPTLINUX_IPATH/
148 # pre #########################################################################
152 system_arch=`uname -m`
153 if [ -f /etc/SuSE-release ] && [ ${system_arch} == i686 ]; then
158 if [ %{_target_cpu} != ${system_arch} ]; then
159 echo "ERROR: Failed installing this rpm!!!!"
160 - echo "This rpm is intended for %{_target_cpu} platform. It seems your system is ${system_arch}.";
163 + echo "This rpm is intended for %{_target_cpu} platform. It seems your system is ${system_arch}."
167 # post #########################################################################
171 chkconfig fusion.mptctl --add >/dev/null 2>&1
172 if [ -f /etc/redhat-release ]; then
174 - if [ -f /etc/modprobe.conf ] ; then
175 - cp /etc/modprobe.conf /etc/modprobe.conf.orig.%{version};
176 - sed -e '/mptbase/d' /etc/modprobe.conf > modprobe.edit;
177 - sed -e '/mptscsih/d' modprobe.edit > modprobe.edit.1;
178 - sed -e '/mptspi/d' modprobe.edit.1 > modprobe.edit.2;
179 - sed -e '/mptfc/d' modprobe.edit.2 > modprobe.edit.3;
180 - sed -e '/mptsas/d' modprobe.edit.3 > modprobe.edit;
181 - echo "alias scsi_hostadapter mptspi" >> modprobe.edit;
182 - echo "alias scsi_hostadapter1 mptfc" >> modprobe.edit;
183 - echo "alias scsi_hostadapter2 mptsas" >> modprobe.edit;
184 - mv -f modprobe.edit /etc/modprobe.conf;
185 - rm -fr modprobe.edit.*;
187 + # per the comments below, i can't see any modprobe.conf editing here that's
189 + #if [ -f /etc/modprobe.conf ] ; then
190 + # cp /etc/modprobe.conf /etc/modprobe.conf.orig.mptlinux-%{version}
191 + # i don't think this is kosher. what sort of entries are
192 + # being deleted here?
193 + #sed -e '/mptbase/d' -e '/mptscsih/d' -e '/mptspi/d' \
194 + # -e '/mptfc/d' -e '/mptsas/d' /etc/modprobe.conf > /etc/modprobe.edit
195 + # this really isn't kosher. you can't assume that the
196 + # administrator has not already defined the scsi_hostadapter
197 + # aliases for some other HBA that's already in the system
198 + #echo "alias scsi_hostadapter mptspi" >> /etc/modprobe.edit
199 + #echo "alias scsi_hostadapter1 mptfc" >> /etc/modprobe.edit
200 + #echo "alias scsi_hostadapter2 mptsas" >> /etc/modprobe.edit
201 + #mv -f /etc/modprobe.edit /etc/modprobe.conf
203 elif [ -f /etc/SuSE-release ]; then
205 if [ -f /etc/sysconfig/kernel ] ; then
206 - cp /etc/sysconfig/kernel /etc/sysconfig/kernel.orig.%{version};
207 - sed -e 's/mptscsih//g' /etc/sysconfig/kernel > kernel.edit;
208 - sed -e 's/mptsas//g' kernel.edit > kernel.edit.1;
209 - sed -e 's/mptfc//g' kernel.edit.1 > kernel.edit.2;
210 - sed -e 's/mptspi//g' kernel.edit.2 > kernel.edit.3;
211 - sed -e 's/INITRD_MODULES="/INITRD_MODULES="mptsas /g' kernel.edit.3 > kernel.edit.4;
212 - sed -e 's/INITRD_MODULES="/INITRD_MODULES="mptfc /g' kernel.edit.4 > kernel.edit.5;
213 - sed -e 's/INITRD_MODULES="/INITRD_MODULES="mptspi /g' kernel.edit.5 > kernel.edit;
214 - mv -f kernel.edit /etc/sysconfig/kernel;
215 - rm -fr kernel.edit.*;
217 + cp /etc/sysconfig/kernel /etc/sysconfig/kernel.orig.mptlinux-%{version}
218 + sed -e 's/mptscsih//g' -e 's/mptsas//g' -e 's/mptfc//g' \
220 + -e 's/INITRD_MODULES="/INITRD_MODULES="mptsas /g' \
221 + -e 's/INITRD_MODULES="/INITRD_MODULES="mptfc /g' \
222 + -e 's/INITRD_MODULES="/INITRD_MODULES="mptspi /g' \
223 + /etc/sysconfig/kernel > /etc/sysconfig/kernel.edit
224 + mv -f /etc/sysconfig/kernel.edit /etc/sysconfig/kernel
228 # adding device nodes
229 if [ ! -e /dev/mptctl ]; then
230 - echo "Creating /dev/mptctl ioctl node file";
231 - mknod /dev/mptctl c 10 220;
233 + echo "Creating /dev/mptctl ioctl node file"
234 + mknod /dev/mptctl c 10 220
237 +# i think this is wrong. we should not muck around with kernels we did not
238 +# install new drivers into. but how to determine which kernels those are?
239 +# maybe look for the new driver in the /lib/modules/*/updates tree?
240 for i in /lib/modules/2.6.*; do
241 - kernel=`basename ${i}`;
242 - MPTLINUX_IPATH=/lib/modules/${kernel}/kernel/drivers/message/fusion
243 - if [ ! -e $MPTLINUX_IPATH/mptbase.ko ] || \
244 - [ ! -e $MPTLINUX_IPATH/mptbase.ko.new ]; then
247 + kernel=`basename ${i}`
249 if [ -f /etc/SuSE-release ] &&
250 [ ! -e /boot/initrd-${kernel} ]; then
256 - echo "The mpt driver for kernel ${kernel} is now version 4.16.00.00";
257 - #backup original fusion drivers here if not already done
258 - for driver_name in mptbase.ko mptscsih.ko mptctl.ko mptlan.ko mptspi.ko mptfc.ko mptsas.ko; do
259 - if [ ! -e $MPTLINUX_IPATH/${driver_name}.orig ]; then
260 - cp $MPTLINUX_IPATH/${driver_name} \
261 - $MPTLINUX_IPATH/${driver_name}.orig
263 - cp -f $MPTLINUX_IPATH/${driver_name}.new $MPTLINUX_IPATH/${driver_name}
265 + echo "The mpt driver for kernel ${kernel} is now version 4.16.00.00"
266 # Remake the initrd image for the user, depending on their OS
267 if [ -f /etc/redhat-release ]; then
269 - # taking care of dud migration, by moving all the ko's to ko.orig
270 - for driver_name in mptbase.ko mptscsih.ko mptctl.ko mptlan.ko mptspi.ko mptfc.ko mptsas.ko; do
271 - MPTLINUX_IPATH=/lib/modules/${kernel}/updates
272 - if [ -e $MPTLINUX_IPATH/${driver_name} ]; then
273 - mv $MPTLINUX_IPATH/${driver_name} \
274 - $MPTLINUX_IPATH/${driver_name}.orig
279 if [ -d /boot/efi/efi/redhat ]; then
280 - bootpart=/boot/efi/efi/redhat;
281 + bootpart=/boot/efi/efi/redhat
282 elif [ -d /boot/efi ]; then
283 - bootpart=/boot/efi;
289 if [ ! -e ${bootpart}/initrd-${kernel}.img.orig ]; then
290 echo Saving initrd-${kernel}.img in ${bootpart} directory.
291 cp ${bootpart}/initrd-${kernel}.img \
292 - ${bootpart}/initrd-${kernel}.img.orig
294 + ${bootpart}/initrd-${kernel}.img.orig.mptlinux-%{version}
297 - depmod -v ${kernel} > /dev/null 2>&1;
298 + depmod -v ${kernel} > /dev/null 2>&1
299 mkinitrd -f ${bootpart}/initrd-${kernel}.img ${kernel}
300 elif [ -f /etc/SuSE-release ]; then
302 if [ ! -e /boot/initrd-${kernel}.orig ]; then
303 echo Saving initrd-${kernel} in /boot directory.
304 - cp /boot/initrd-${kernel} /boot/initrd-${kernel}.orig
306 + cp /boot/initrd-${kernel} /boot/initrd-${kernel}.orig.mptlinux-%{version}
309 - depmod -v ${kernel} > /dev/null 2>&1;
310 + depmod -v ${kernel} > /dev/null 2>&1
311 mk_initrd -k vmlinuz-${kernel} -i /boot/initrd-${kernel}
316 echo -e "post Install Done."
318 # postun #######################################################################
321 echo postun %{version}
322 for i in /lib/modules/2.6.*; do
323 - kernel=`basename ${i}`;
324 - MPTLINUX_IPATH=/lib/modules/${kernel}/kernel/drivers/message/fusion
325 - if [ ! -e $MPTLINUX_IPATH/mptbase.ko ] || \
326 - [ -e $MPTLINUX_IPATH/mptbase.ko.new ]; then
329 + kernel=`basename ${i}`
330 + MPTLINUX_IPATH=/lib/modules/${kernel}/updates/drivers/message/fusion
331 + if [ ! -e $MPTLINUX_IPATH/mptbase.ko ]; then
334 if [ ! -e /etc/init.d/fusion.mptctl ]; then
335 + # why are we only doing this if the fustion.mptctl file
336 + # *doesn't* exist? running chkconfig on a file that doesn't
337 + # exist is surely an error
338 + #chkconfig fusion.mptctl --del >/dev/null 2>&1
341 chkconfig fusion.mptctl --del >/dev/null 2>&1
343 - if [ -f /etc/modprobe.conf.orig ]; then
346 + if [ -f /etc/modprobe.conf.orig.mptlinux-%{version} ]; then
348 - mv -f /etc/modprobe.conf.orig /etc/modprobe.conf;
349 - elif [ -f /etc/sysconfig/kernel.orig ]; then
350 + mv -f /etc/modprobe.conf.orig.mptlinux-%{version} /etc/modprobe.conf
351 + elif [ -f /etc/sysconfig/kernel.orig.mptlinux-%{version} ]; then
353 - mv -f /etc/sysconfig/kernel.orig /etc/sysconfig/kernel;
355 - for driver_name in mptbase.ko mptscsih.ko mptctl.ko mptlan.ko mptspi.ko mptfc.ko mptsas.ko; do
356 - if [ -f $MPTLINUX_IPATH/${driver_name}.orig ]; then
357 - mv -f $MPTLINUX_IPATH/${driver_name}.orig $MPTLINUX_IPATH/${driver_name}
360 + mv -f /etc/sysconfig/kernel.orig.mptlinux-%{version} /etc/sysconfig/kernel
362 # restore original initrd images
363 + # i don't think this is a good idea. lots of stuff may have happened
364 + # to the system between the time this backup was made and now that
365 + # renders the original initrd images useless now
366 + # probably should just generate new ones
367 if [ -f /etc/redhat-release ]; then
369 - # restoring the state of dud migration
370 - for driver_name in mptbase.ko mptscsih.ko mptctl.ko mptlan.ko mptspi.ko mptfc.ko mptsas.ko; do
371 - MPTLINUX_IPATH=/lib/modules/${kernel}/udpates
372 - if [ -f $MPTLINUX_IPATH/${driver_name}.orig ]; then
373 - mv -f $MPTLINUX_IPATH/${driver_name}.orig $MPTLINUX_IPATH/${driver_name}
378 if [ -d /boot/efi/efi/redhat ]; then
379 - bootpart=/boot/efi/efi/redhat;
380 + bootpart=/boot/efi/efi/redhat
381 elif [ -d /boot/efi ]; then
382 - bootpart=/boot/efi;
388 - if [ -f ${bootpart}/initrd-${kernel}.img.orig ]; then
389 - mv -f ${bootpart}/initrd-${kernel}.img.orig ${bootpart}/initrd-${kernel}.img;
391 + #if [ -f ${bootpart}/initrd-${kernel}.img.orig.mptlinux-%{version} ]; then
392 + # mv -f ${bootpart}/initrd-${kernel}.img.orig.mptlinux-%{version} ${bootpart}/initrd-${kernel}.img
395 + depmod -v ${kernel} > /dev/null 2>&1
396 + mkinitrd -f ${bootpart}/initrd-${kernel}.img ${kernel}
397 elif [ -f /etc/SuSE-release ]; then
399 - if [ -f /boot/initrd-${kernel}.orig ]; then
400 - mv -f /boot/initrd-${kernel}.orig /boot/initrd-${kernel};
403 - depmod -v ${kernel} > /dev/null 2>&1;
405 + #if [ -f /boot/initrd-${kernel}.orig.mptlinux-%{version} ]; then
406 + # mv -f /boot/initrd-${kernel}.orig.mptlinux-%{version} /boot/initrd-${kernel}
409 + depmod -v ${kernel} > /dev/null 2>&1
410 + mk_initrd -k vmlinuz-${kernel} -i /boot/initrd-${kernel}
413 echo -e "Uninstall Done."
415 # files ########################################################################
416 %files -f ../file.list.%{name}
417 +%files modules -f ../file.list.%{name}-modules
419 # changelog ###################################################################
421 +* Wed Oct 28 2009 Brian J. Murrell <Brian.Murrell@Sun.COM>
422 + - split into modules and non-modules packages so that multiple
423 + modules packages can be installed, for several kernels
424 + - don't fiddle with files once RPM has installed them
425 + - put modules into the updates tree under the modules dir, where
427 + - don't use the "orig" initrd, but generate a new one on removal
428 + + the orig initrd could very well no longer be suitable
429 + - don't edit the modprobe.conf file as that's a job for the admin
430 + + we really can't assume which other scsi_host_adapters are in
431 + the machine and what position we are to take relative to them
432 * Tue Apr 24 2007 Eric Moore <Eric.Moore@lsi.com>
433 - Fix RHEL5 DUD to RPM migration
434 * Tue Apr 17 2007 Eric Moore <Eric.Moore@lsi.com>