forked from thopiekar/rcraid-dkms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall
executable file
·196 lines (172 loc) · 5.54 KB
/
install
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
#!/bin/bash
# Script to install the RAIDCore drivers from the SDK for supported platforms
# (RedHat and Ubuntu).
#
# Copyright © 2006-2008 Ciprico Inc. All rights reserved.
# Copyright © 2008-2013 Dot Hill Systems Corp. All rights reserved.
# Copyright © 2020-2021 Advanced Micro Devices, Inc. All rights reserved.
#
# Use of this software is subject to the terms and conditions of the written
# software license agreement between you and AMD (the "License"),
# including, without limitation, the following (as further elaborated in the
# License): (i) THIS SOFTWARE IS PROVIDED "AS IS", AND AMD DISCLAIMS
# ANY AND ALL WARRANTIES OF ANY KIND, WHETHER EXPRESS, IMPLIED, STATUTORY,
# BY CONDUCT, OR OTHERWISE; (ii) this software may be used only in connection
# with the integrated circuit product and storage software with which it was
# designed to be used; (iii) this source code is the confidential information
# of AMD and may not be disclosed to any third party; and (iv) you may not
# make any modification or take any action that would cause this software,
# or any other Advanced Micro Devices software, to fall under any GPL license
# or any other open source license.
#
source src/common_shell
USE_SWL="ahci"
install_modules(){
(cd src; sh ./$1 $2 $3 $4 $5)
if [ $? -ne 0 ]; then
echo "ERROR: Failed to install the RAIDCORE Drivers."
exit 1
fi
}
build_modules(){
KERNELMAKEFILE=/lib/modules/$1/build/Makefile
buildfailed=0
if [ -f $KERNELMAKEFILE ]; then
(cd src; make clean; make KVERS=$1 all);
if [ $? -ne 0 ]; then
buildfailed=1
fi
else
buildfailed=1
fi
if [ $buildfailed -eq 1 ]; then
echo "ERROR: Failed to build the RAIDCORE Drivers."
echo "Please make sure kernel source rpm is installed for $1."
exit 1
fi
}
# Builds and installs the driver for RedHat variants
build_and_install_rh(){
set_kernel_flavors_rh
for flavor in $flavors ; do
if [ $flavor = "uni" ] ; then
version=$kernel
else
version=$kernel$flavor
fi
build_modules $version
if [ -f "src/rcraid.ko" ] ; then
install_modules install_rh "USE_SWL=${USE_SWL}" $version
else
echo "#"
echo "# Driver module not built -- install aborted!"
echo "#"
fi
done
}
build_and_install_ubuntu(){
KERNELS=$(ls /lib/modules)
RCRAID="rcraid-9.3.0"
if [ ! -f "/usr/src/$RCRAID/mk_certs" ] ; then
mkdir -p /usr/src/$RCRAID
cp -Rap src/* /usr/src/$RCRAID
#/usr/bin/echo "MAKE=\"make -C /usr/src/$RCRAID KERNELDIR=/lib/modules/\${kernelver}/build\"" > /ii#usr/src/$RCRAID/dkms.conf
#/usr/bin/echo "CLEAN=\"make -C /usr/src/$RCRAID clean\"" >> /usr/src/$RCRAID/dkms.conf
echo "BUILT_MODULE_NAME=rcraid" > /usr/src/$RCRAID/dkms.conf
echo "BUILT_MODULE_LOCATION=/usr/src/$RCRAID" >> /usr/src/$RCRAID/dkms.conf
echo "PACKAGE_NAME=rcraid" >> /usr/src/$RCRAID/dkms.conf
echo "PACKAGE_VERSION=9.3.0" >> /usr/src/$RCRAID/dkms.conf
#/usr/bin/echo "REMAKE_INITRD=yes" >> /usr/src/$RCRAID/dkms.conf
echo "DEST_MODULE_NAME=rcraid" >> /usr/src/$RCRAID/dkms.conf
echo "DEST_MODULE_LOCATION=/kernel/drivers/scsi" >> /usr/src/$RCRAID/dkms.conf
echo "AUTOINSTALL=yes" >> /usr/src/$RCRAID/dkms.conf
echo "PRE_BUILD=/install" >> /usr/src/$RCRAID/dkms.conf
dkms status | grep rcraid
if [ $? -ne 0 ]; then
dkms add -m rcraid -v 9.3.0
fi
fi
chmod -R 777 /usr/src/$RCRAID/*
dkms status | grep rcraid
if [ $? -ne 0 ]; then
dkms add -m rcraid -v 9.3.0
fi
DEBIAN="0"
grep "SMP Debian" /proc/version
if [ $? -eq 0 ]; then
DEBIAN="debian"
fi
dkms status
for RELEASE in $KERNELS
do
if [ ! -f "/lib/modules/$RELEASE/kernel/drivers/scsi/rcraid.ko" ] || [ "$DEBIAN" = "debian" ]; then
echo "Make kernel for $RELEASE"
make -C src clean
make -C src KVERS=$RELEASE
if [ -f "src/rcraid.ko" ] ; then
## update modules.dep
cp -ap src/rcraid.ko /lib/modules/$RELEASE/kernel/drivers/scsi/rcraid.ko
depmod -a $RELEASE
## make new initrd.img
cp -ap /boot/initrd.img-$RELEASE /boot/initrd.img-$RELEASE.bak
#rm -rf /etc/modprobe.d/blacklist.local.conf
mkinitramfs -o /boot/initrd.img-$RELEASE $RELEASE
else
echo "#"
echo "# Driver module not built -- install aborted!"
echo "#"
fi
else
echo "RCRAID for $RELEASE already exists"
fi
done
}
########
# MAIN #
########
if [ $UID != 0 ] ; then
echo "This script must be run as root"
exit 1
fi
if [ -e /etc/redhat-release ]; then
# redhat based
while [ $# -gt 0 ] ; do
case $1 in
--help)
usage_rh $1
;;
USE_SWL=*)
USE_SWL=${1:8}
;;
uni | smp | bigmem | hugemem | largesmp | PAE)
case " $flavors " in
*" $1 "*) ;;
*) flavors="$flavors $1";;
esac
;;
*)
if [ -z $kernel ] ; then
kernel=$1
else
usage_rh $1
fi
;;
esac
shift
done
build_and_install_rh
else
# generic
UBUNTU_RELEASE=$(grep 'Ubuntu' /etc/lsb-release)
DEBIAN_RELEASE=$(cat /etc/debian_version)
if [ -z UBUNTU_RELEASE ]; then
if [ -z DEBIAN_RELEASE ]; then
(cd src; make clean; make all; make install);
else
build_and_install_ubuntu
fi
else
build_and_install_ubuntu
fi
exit $?
fi