
Driver Disk Installation Guide for ARC-11XX/ARC12XX/ARC16XX/18XX RAID Controller 
         on Fedora 39 (kernel 6.5.6-300.fc39)
=================================================================================
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 Fedora 39
arcmsr-1.51.0X.15_fc39.zip - Areca RAID driver for system installation
kmod-arcmsr-1.51.0X.15-1.fc39-k6.5.6.x86_64.rpm   - arcmsr driver for kernel 6.5.6-300 x86_64
kmod-arcmsr-1.51.0X.15-1.fc39-k6.5.10.x86_64.rpm  - arcmsr driver for kernel 6.5.10-300 x86_64
arcmsr-1.51.0X.15-20231012.zip  - arcmsr driver source code
genkey.cfg	- configuration file for generating public and private key pair
public_key.der	- public key for pre-compiled driver arcmsr in .rpm and .iso first time installation

**********************************************************************************
2. System installation
**********************************************************************************
A. Before Installation 

   Fedora 39 kernel default driver has support Areca all Raid controllers except ARC-1688.
   So just following the Fedora installation guide to install system to on-board hard drive or Areca Raid volume.
   In case of installation to Areca Raid volume, you should first create a Raid volume by reference to
   Areca Raid controllers user's manual.

   For installation Fedora 39 onto Areca ARC-1688 Raid volume, following below steps.
   Extract arcmsr-1.51.0X.15_fc39.zip and copy public_key.der to top(/) directory of an USB flash drive .
   Give a label to this USB flash drive, said ARECA.

B. For Server Installation
	1. Booting from Fedora Installation DVD disc.
	2. When GRUB boot menu appears, move cursor UP to "Install Fedora 39".
	   Press Enter to start system installation.
	3. When 'Welcom to Fedora 39' was displayed for selection a language during installation,
	   press CTRL+ALT+F2 to open a command console.
	   # rmmod arcmsr
	4. Insert USB flash drive to target system.
	   # mkdir /arcmsr /tmp/arcmsr
	   # mount /dev/sda1 /arcmsr
	   # cp /arcmsr/* /tmp/arcmsr
	   # umount /arcmsr
	5. Remove the USB flash drive from the USB port and then type:
	   # cd /tmp/arcmsr
	   # chmod +x pre-install.sh
	   # ./pre-install.sh
	   Press Alt+F6 to back to 'Welcom to Fedora 39' GUI, go on the system installtion.
	6. In INSTALLATION DESTINATION page, if you can not find hard drive(s) to install OS, click the Refresh at Bottom right corner
	   to rescan hard drive(s).
	7. When system was successfully installed, press CTRL+ALT+F2 to command console before click "Reboot System".
	   # mkdir /mnt/sysimage/tmp/arcmsr
	   # cp /tmp/arcmsr/* /mnt/sysimage/tmp/arcmsr
	   # chroot /mnt/sysimage
	   # cd /tmp/arcmsr
	   # chmod +x post-install.sh
	   # ./post-install.sh
	   # exit
	8. Press ALT+F6 to back to system installation GUI and 'Reboot System'. 


C. For Workstation Installation
	1. Booting from Fedora Installation DVD disc.
	2. When GRUB boot manager appears, move cursor UP to "Start Fedora-Workstation-Live 39".
	   Press Enter to start system.
	3. When "Install Fedora" and "Not Now" GUI was displayed, open a terminal console.
	   # sudo rmmod arcmsr
	4. Insert USB flash drive to target system.
	   # sudo mkdir /arcmsr /tmp/arcmsr
	   # sudo mount /dev/sda1 /arcmsr
	   # sudo cp /arcmsr/* /tmp/arcmsr
	   # sudo umount /arcmsr
	5. Remove the USB flash drive from the USB port and then type:
	   # cd /tmp/arcmsr
	   # sudo chmod +x pre-install.sh
	   # sudo ./pre-install.sh
	   Back to 'Welcom to Fedora' GUI, click on "Install Fedora" to install system.
	6. When system was successfully installed, run following command before click "Reboot System".
	   # sudo mkdir /mnt/sysimage/tmp/arcmsr
	   # sudo cp /tmp/arcmsr/* /mnt/sysimage/tmp/arcmsr
	   # sudo chroot /mnt/sysimage
	   # cd /tmp/arcmsr
	   # sudo chmod +x post-install.sh
	   # sudo ./post-install.sh
	   # exit
	7. Back to system installation GUI and Finish Installation.
	8. Power off and power on and eject the installation disc, let system boot from hard drive.

**********************************************************************************
3. Installing raid driver on an Existing System.
**********************************************************************************
   If your Linux system can use Areca Raid volume normally, you need not to install driver package.

	login as root or use su
	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-1.fc39-k6.x.xx.$(uname -m).rpm
	# xz -f /lib/modules/$(uname -r)/updates/arcmsr.ko
	# depmod -a
	# modprobe arcmsr
	    or
	# reboot

**********************************************************************************
4. To compile raid driver on an Existing System.
**********************************************************************************
   If your Linux system can use Areca Raid volume normally, you need not to compile driver for it.
   If areca pre-build driver(kmod-arcmsr...) can not fit for your kernel, then you need compile
   driver for it by yourself.

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

	Before you can compile a driver, you have to install kernel-devel.
	# yum install kernel-devel-$(uname -r)

	If you do not have installed gcc compiler.
	# yum install gcc make

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

	# xz arcmsr.ko
	# cp -f arcmsr.ko.xz  /lib/modules/$(uname -r)/kernel/drivers/scsi/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 support Areca thunderbolt device and cable hotplug
**********************************************************************************

	Fedora 39 has native support Areca thunderbolt 2 & 3 devices, ARC-8050T2/T3 series.
	But it needs root user to authorise permission after connect the thunderbolt cable.

Fedora Workstation:
===================

	From GNOME Settings->Privacy->Thunderbolt, click the 'connected' but not yet authorized device,
	confirm the 'authorize and connect' to make it 'authorized'.
	Now detecting devices start, just a moment you will can access thunderbolt devices.

Fedora Server:
==============

	1. Find the thunderbolt deivce's UUID.
	   # boltctl list

	2. Give an authorised permission to thunderbolt devices
	   # boltctl authorize UUID
	   	where UUID is thunderbolt device's UUID, like 00000000-0000-0008-0015-5f0b2012a051
	   Now detecting devices start, just a moment you will can access thunderbolt devices.


**********************************************************************************
6. 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 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)/kernel/drivers/scsi/arcmsr/arcmsr.ko 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   /boot/vmlinux-6.5.6-xx..... ... ... quiet LANG=en_US.UTF-8 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/fedora/grub.cfg
       Append driver parameter setting to end of line that include "linux   /boot/vmlinuz-x.xx.xx ....."

       linux   /boot/vmlinux-6.5.6-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, ...
