
Driver Installation Guide of ARC-11XX/ARC12XX/ARC16XX/18XX RAID Controller 
         for RHEL/Rocky Linux/AlmaLinux 9.2(kernel 5.14.0-284.11.1.el9_2.x86_64)
=================================================================================
Linux SCSI driver technical support 
mail address: support@areca.com.tw
Web site: www.areca.com.tw
==================================================================================
 
**********************************************************************************   
1. Contents
**********************************************************************************

readme.txt	- the installation guide of ARC-11XX/12XX/16XX/18XX driver
		  for RHEL 9.2, Rocky Linux 9.2 AlmaLinux 9.2
arcmsr-1.51.0X.15-rhel9.2.zip	- Areca RAID driver for Linux system installation
kmod-arcmsr-1.51.0X.15_rhel9.2-1.x86_64.rpm  - arcmsr driver in rpm format
arcmsr-1.51.0X.15-20230915.zip               - arcmsr driver source code
arcmsr-1.51.00.15-source-only.dkms.tar.gz    - arcmsr DKMS enabled driver source code
genkey.cfg	- configuration file for generating public and private key pair
public_key.der	- public key of pre-compiled driver arcmsr.ko.xz in for first time installation

**********************************************************************************
2. First installation
**********************************************************************************
  A. Before Installation 
  ======================
    Copy arcmsr-1.51.0X.15-rhel9.2.zip and public_key.der to top(/) directory of an USB flash drive .
    Give a label to this USB flash drive, said OEMDRV.

  B. Installation
  ===============
        Extract arcmsr-1.51.0X.15-rhel9.2.zip to an USB flash drive.
	a. Booting from Installation DVD disc.
	b. When 'WELCOM TO RED HAT ENTERPRISE LINUX 9.2' or 'WELCOM TO ROCKY LINUX 9' or
	  'WELCOM TO ALMALINUX 9.2' was displayed, press CTRL+ALT+F2 to command console.
	c. Insert USB flash drive to target system.
	   # mkdir /arcmsr /tmp/arcmsr
	   # mount /dev/sda1 /arcmsr
	   # cp /arcmsr/* /tmp/arcmsr
	   # umount /arcmsr
	d. Remove the USB flash drive from the USB port and then type:
	   # cd /tmp/arcmsr
	   # chmod +x *.sh
	   # ./pre-install.sh
	e. Press ALT+F6 back to installation GUI.
	f. On 'INSTALLATION DESTINATION' page, if you can not find hard drive(s) to install OS,
	   click the 'Refresh'(blue color), which was located at bottom right corner of page, to rescan hard drive(s).
	g. When system was successfully installed and prompts for Reboot, press CTRL+ALT+F2 to command console
	   # mkdir -p /mnt/sysimage/tmp/arcmsr
	   # cp /tmp/arcmsr/* /mnt/sysimage/tmp/arcmsr
	   # chroot /mnt/sysimage
	   # cd /tmp/arcmsr
	   # ./post-install.sh
	   # exit
	h. Press ALT+F6 to back to system installation GUI and Reboot. 

**********************************************************************************
3. Installing raid driver on an existed System.
**********************************************************************************
	login as root
	If you have been installed kmod-arcmsr rpm package, remove the old one before install new.
	# rpm -ev kmod-arcmsr

	# rpm -ivh kmod-arcmsr-1.51.0X.15_rhel9.2-1.x86_64.rpm
	# depmod -a
	# modprobe arcmsr
	   or
	# reboot

**********************************************************************************
4. To compile raid driver on an existed System.
**********************************************************************************

	Before you can compile a new driver, you have to install kernel-headers and kernel-devel.
	These two rpm packages are in RHEL 9.2 DVD installation disc /BaseOS/Packages.

        if your target kernel version is not (uname -r), then replace following
	$(uname -r) by target kernel version

	# rpm -ivh kernel-headers-$(uname -r).rpm
	# rpm -ivh kernel-devel-$(uname -r).rpm

	To compile arcmsr driver, extract driver source code to a new directory.
	# make KDIR=/lib/modules/$(uname -r)/build

	# xz arcmsr.ko
	# mkdir -p /lib/modules/$(uname -r)/extra/arcmsr
	# cp -f arcmsr.ko.xz /lib/modules/$(uname -r)/extra/arcmsr
	# depmod -a $(uname -r)

	If your system was booted from Areca volume, you have to rebuild initial ramdisk.
	# dracut --kver $(uname -r)

	# reboot

**********************************************************************************
5. To install DKMS enabled tarball of arcmsr driver on an existed System.
**********************************************************************************
	Login as root or as superuser.

	Before you can compile a new driver, you have to install kernel-headers and kernel-devel.
	These two rpm packages are in RHEL 9.2 DVD installation disc /BaseOS/Packages.
	# rpm -ivh kernel-headers-$(uname -r).rpm
	# rpm -ivh kernel-devel-$(uname -r).rpm

	Download DKMS package dkms-<dkmsversion>.noarch.rpm from http://linux.dell.com/dkms/
	Before using DKMS, you must install DKMS package. You can install dkms as following.
	# rpm -ivh dkms-<dkmsversion>.noarch.rpm
	where <moduleversion> is dkms version could be, e.g., 2.2.0.3-1

	Copy arcmsr DKMS enabled tarball to home directory.
	In order to load tarball into the DKMS tree, you must use the following command:

	# dkms ldtarball --archive=./arcmsr-<moduleversion>-source-only.dkms.tar.gz
	where <moduleversion> is module version could be, e.g., 1.51.00.15
	arcmsr source code will be added to DKMS tree.
	
	To build arcmsr driver module
	# dkms build -m arcmsr -v <moduleversion>
	
	To install arcmsr driver module
	# dkms install -m arcmsr -v <moduleversion>


	If you are upgrading linux kernel, then you have to install the corresponding linux-headers-<kernelver> before
	reboot your system. New kernel image can be find in /boot, corresponding new linux header can be find in /usr/src.
	If you can not find new linux header in /usr/src, you can install it as following.
	# rpm -ivh kernel-headers-<kernelver>.rpm
	where <kernelver> is kernel version could be, e.g., 5.14.0-284.11.1.el9_2.$(uname -m)
	
	After installed linux header files, DKMS service will build and install arcmsr driver for new kernel automatically.

**********************************************************************************
6. To support Areca thunderbolt device and cable hotplug
**********************************************************************************
	RHEL 9.2/CentOS 9.2-2105 has been build-in support thunderbolt 2, 3 devices.
	To support Areca thunderbolt devices, like ARC-8050Tx, 
	arcmsr driver version must be >= v1.40.0X.05-20190309.
	This version's driver was built-in in Linux kernel since v4.17.

	The first time of connection thunderbolt device to system, it may need to authorize the device to system.
	From GNOME Settings->Privacy->Thunderbolt, click the 'connected' but not yet authorized device,
	confirm the 'authorize and connect' to make it 'authorized'.

**********************************************************************************
7. To set driver parameters value
**********************************************************************************
    arcmsr provided driver parameters setting since v1.30.0X.25.
    Multiple Driver parameters can be set at a time.
    e.g. # insmod arcmsr.ko.xz host_can_queue=72 cmd_per_lun=16

    Setting parameter value out of range will be ignored, parameter remain default value.

    a. To list what driver parameter can be set, parameter default value and value range.
       # modinfo arcmsr

    b. To set driver parameter when you manually install driver.
       (This method will be infeasible if your system was boot from areca Raid volume.)
       e.g. to set parameter host_can_queue value to 64
       # sudo rmmod arcmsr
       # sudo insmod /lib/modules/$(uname -r)/extra/arcmsr/arcmsr.ko.xz host_can_queue=64

    c. To set driver parameter during booting from grub menu.
       When grub menu display, use UP and DOWN arrow key to move cursor to booting target.
       Type e to edit, move cursor to end of line that include "linux   /boot/vmlinuz-x.xx.xx ....."
       Append driver parameter to there.(e.g. to set parameter host_can_queue value to 64)

       linux  ($root) /boot/vmlinux-5.14.0-xx..... ... ... rhgb quiet arcmsr.host_can_queue=64

    d. To set driver parameter for every boot up.
       e.g. to set parameter host_can_queue value to 64
       # sudo gedit /boot/grub2/grub.cfg
           or
       # sudo gedit /boot/efi/EFI/centos/grub.cfg
       Append driver parameter setting to end of line that include "linux   /boot/vmlinuz-x.xx.xx ....."

       linux   /boot/vmlinux-5.14.0-xx..... ... ... quiet LANG=en_US.UTF-8 arcmsr.host_can_queue=64

    e. To verify parameter setting is correct.
       1. To locate adapter parameter directory
          Find Areca host number:
          # dmesg | grep 'scsi host'
          # cat /sys/class/scsi_host/hostX/proc_name
                where hostX could be host0, host1, ...
          The correct output should be arcmsr. If output is (null), check host_fw_model and host_driver_version.
          # cat /sys/class/scsi_host/hostX/host_fw_model
          # cat /sys/class/scsi_host/hostX/host_driver_version

       2. List host_can_queue value
          #  cat /sys/class/scsi_host/hostX/can_queue

       3. List cmd_per_lun value
          #  cat /sys/class/scsi_host/hostX/cmd_per_lun

       4. List cmd_timeout value
          #  cat /sys/block/sdX/device/cmd_timeout
             where sdX could be sda, sdb, ...
