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