xref: /freebsd/tools/tools/mfi/runmegacli.sh (revision 06c3fb27)
1#!/bin/sh
2# This is a simple wrapper for running the MegaCLI tool for Linux.  It assumes
3# that the MegaCLI binary has been installed in /compat/linux/usr/sbin/MegaCli.
4# The binary must also have been branded appropriately, and the COMPAT_LINUX,
5# LINPROCFS, and LINSYSFS options must be enabled.  It is best to enable the
6# COMPAT_LINUX option and compile the mfi driver into the kernel, instead of
7# loading it as a module, to ensure that all of the required driver bits are
8# enabled.
9#
10
11megacli=/usr/sbin/MegaCli
12linuxdir=/compat/linux
13osrelease=2.6.12
14
15devfsmount=`mount |grep $linuxdir/dev | awk '{print $3}'`
16if [ "X$devfsmount" = "X" ]; then
17	mount -t devfs devfs $linuxdir/dev
18fi
19
20procfsmount=`mount |grep $linuxdir/proc | awk '{print $3}'`
21if [ "X$procfsmount" = "X" ]; then
22	mount -t linprocfs linprocfs $linuxdir/proc
23fi
24
25sysfsmount=`mount |grep $linuxdir/sys | awk '{print $3}'`
26if [ "X$sysfsmount" = "X" ]; then
27	mount -t linsysfs linsysfs $linuxdir/sys
28fi
29
30linuxver=`sysctl -n compat.linux.osrelease | cut -d . -f 1,2`
31if [ "X$linuxver" != "X2.6" ]; then
32	sysctl compat.linux.osrelease=$osrelease
33fi
34
35chroot $linuxdir $megacli $@
36