
Driver Disk Installation Guide for ARC-11XX/ARC12XX/ARC16XX/18XX RAID Controller 
         on Fedora 23 (kernel 4.2.3-300.fc)
=================================================================================
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 23
arcmsr_fedora23.iso   - Areca RAID driver for Server installation
arcmsr_fc23.zip	      - Areca RAID driver for Desktoop installation
kmod-arcmsr-1.30.0X.23-1.fc23.x86_64.rpm    - arcmsr driver for x86_64
kmod-arcmsr-1.30.0X.23-1.fc23.i686.rpm      - arcmsr driver for i686
kmod-arcmsr+PAE-1.30.0X.23-1.fc23.i686.rpm  - arcmsr driver for i686+PAE
arcmsr-1.30.0X.23-20151225.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. First installation
**********************************************************************************
A. Before Installation 
   Copy arcmsr_fc23.zip and public_key.der to top(/) directory of an USB flash drive .
   Give a label to this USB flash drive, said ARECA.

    If you would like system boots with UEFI Secure Boot, following condition must be satisfied in BIOS setup.
    Or system may not boot properly.
	1. Set "Secure Boot" to "Enabled".
	2. Set "Secure Boot Mode" to "Custom".
	3. Set "Csm support" to "Disabled".
	4. Install all manufacture defaults to Platform Key(PK), Key Exchange Key(KEK), Authorized Signatures(DB), 
	   Forbidden Signatures(DBX).
	5. Set "CPU slot PCI-E Device OPROM (Option ROM)" to "EFI" or "UEFI", if any.
	6. Areca Raid controller System controls->Advanced configuration->BISO selection set to UEFI or AUTO. 
	  (This can be done by web browser through Raid controller Ethernet port. Please refer to areca Raid controller user manual.)
	7. Add Areca Linux driver's public key to Authorized signature database(DB) or Machine Owner Key(MOK) database.
	8. OS is 64 bits version, CPU is 64 bits, and both support UEFI specification.

	 
    You must add Areca Linux driver's public key to the MOK or DB before installing operation system. 
    If Areca Linux driver's public key has been in the DB or MOK of system NVRAM, it is not necessary to do it again.

    To add Areca Linux driver's public key to the DB or MOK database, select one of three ways to do.

    ============================================================
    1. Append public_key.der to DB database from M/B BIOS setup
    ============================================================
	Copy Areca public_key.der to an USB flash drive with label name ARECA.
	Enter M/B BIOS setup, in secure boot menu -> Key Management -> Append DB(or "Append db from file", or "Append Var to DB")
	
	a. Append the addition db?( or update 'db' with factory defaults?)
	   Select: No

	b. Select File system( or press ESC to skip)
	   Select: ...\USB(x,0)\....

	c. Select File
	   Select: public_key.der

	d. Select key file type
	   Select: key Certificate blob

	e. Update 'db' from selected file 'public_key.der'?
	   Select: Yes

	f. Set "Set New DB (DataBase)" to "Yes", if any.

    =============================================================
    2. Enroll public_key.der to MOK database by "MokManager.efi"
    =============================================================
	Copy Areca public_key.der to an USB flash drive with label name ARECA.
	a. Insert the USB flash drive to the target system.
	b. Insert Installation DVD disc to DVD drive.
	c. Booting from UEFI: CD/DVD drive.
	d. When grub2 boot menu show up, type c to get into grub CLI.
	   At grub console, input following command.

		grub> chainloader /EFI/BOOT/MokManager.efi
		grub> boot

	e. When "shim EFI key management" page show up, press Enter.
	f. When "Perform MOK management" menu show up, move cursor to "Enroll key from disk", then press Enter.
	g. When "Seclect Key" menu show up, move cursor to "ARECA", then press Enter.
	   Move cursor to "publick_key.der", then press Enter.
	h. When "[Enroll MOK]" menu show up, move cursour to "continue", then press Enter.
	i. When "Enroll the key(s)?" menu show up, move cursor to "Yes", then press Enter.
	j. When "Perform MOK management" menu show up again, move cursor to "continue to boot", then press Enter.
	k. When back to grub CLI, press Esc.

	The public key is added to the MOK list now, which is persistent.
	Once a key is on the MOK list, it is propagated automatically to the system key ring for this and subsequent 
	reboots, when uEFI Secure Boot is enabled.

    ======================================================
    3. Enroll public_key.der to MOK database by "mokutil"
    ======================================================
	Copy Areca public_key.der to home directory.
	a. In OS, open a terminal console.
	   # mokutil --import public_key.der
	   
	   When prompted, enter a password of your choice. 
	   This password will be used when enrolling the key into the MOK list.

	b. Reboot your system.

	c. Upon rebooting, the "Shim UEFI key management" screen appears. 
	   Press any key withing 10 seconds to proceed.

	d. Perform MOK management
	   Select: Enroll MOK

	e. [Enroll MOK]
	   Select: View key 0
	   Select: Continue

	f. Enroll the key(s)?
	   Select: Yes

	g. Enroll the key(s)?
	   Password:      <------ give the password that previously requested by mokutil

	h. Reboot the system?
	   Select: OK

	The key is now enrolled.


B. For Server Installation

	1. Insert USB flash drive to target system.
	2. Booting from Fedora Installation DVD disc.

    For choice legacy DVD drive to install:
    =======================================
	3. When the Installation screen appears, move cursor UP to "Install Fedora 23".
	   Press Tab to edit kernel boot option.

	   At the end of command line, append " inst.dd"
	   (double quotation mark are not include).

	   Press Enter to start system installation.

    For choice UEFI DVD drive to install:
    =====================================
	3. When the Installation screen appears, move cursor UP to "Install Fedora 23".
	   Type e to edit kernel boot option.

	   At the end of command line, that include "linuxefi /images/pxeboot/vmlinuz", append " inst.dd"
	   (double quotation mark are not include).

	   Press Ctrl-x to start system installation.


	4. When following messages show up, type the number that line with the LABEL of USB flash drive.
	   If you can not see the USB flash drive, reinsert USB drive and type r then ENTER to refresh it.
	    
	   (Page 1 of 1) Driver disk device selection 
	        /DEVICE    TYPE       LABEL               UUID
	    1)  sr0        iso9660    Fedora-S-23-x86_64  2015-10-30-01-48-39-00
	    2)  sda1       vfat       ARECA               60A4-83FC

	   In this example, type 2 and press Enter
	   
	   (Page 1 of 1) Choose driver disk ISO file
	    1) /media/DD-1/arcmsr-fedora23.iso
	     
	   In this example, type 1 and press Enter
	   
	  ========== For Fedora server x86_64 ===========================================
	   (Page 1 of 1) Select drivers to install
	    1) [ ] /media/DD-2/rpms/x86_64/kmod-arcmsr-1.30.0X.23-1.fc23.x86_64.rpm
	     
	   In this example, type 1 and press Enter
		   
	   (Page 1 of 1) Select drivers to install
	    1) [x] /media/DD-2/rpms/x86_64/kmod-arcmsr-1.30.0X.23-1.fc23.x86_64.rpm
	     
	   In this example, type c and press Enter
	  ===============================================================================

	  ========== For Fedora server i386 =============================================
	  There are two drivers, first load i686 driver then load i686+PAE driver.

	   (Page 1 of 1) Select drivers to install
	    1) [ ] /media/DD-2/rpms/i686/kmod-arcmsr+PAE-1.30.0X.23-1.fc23.i686.rpm
	    2) [ ] /media/DD-2/rpms/i686/kmod-arcmsr-1.30.0X.23-1.fc23.i686.rpm
	     
  NOTE 1: first load i686(w/o PAE) driver
	   In this time, type 2 and press Enter
		   
	   (Page 1 of 1) Select drivers to install
	    1) [ ] /media/DD-2/rpms/i686/kmod-arcmsr+PAE-1.30.0X.23-1.fc23.i686.rpm
	    2) [x] /media/DD-2/rpms/i686/kmod-arcmsr-1.30.0X.23-1.fc23.i686.rpm
	     
	   In this example, type c and press Enter

	   (Page 1 of 1) Driver disk device selection 
	        /DEVICE    TYPE       LABEL               UUID
	    1)  sr0        iso9660    Fedora-S-23-x86_64  2015-10-30-01-48-39-00
	    2)  sda1       vfat       ARECA               60A4-83FC
	    3)  sdb        ext4                           2015-10-30-01-48-39-00
	    3)  sdc        ext4                           2015-10-30-01-48-39-00

	   In this example, type 2 and press Enter
	   
	   (Page 1 of 1) Choose driver disk ISO file
	    1) /media/DD-1/arcmsr-fedora23.iso
	     
	   In this example, type 1 and press Enter
	   
	   (Page 1 of 1) Select drivers to install
	    1) [ ] /media/DD-2/rpms/i686/kmod-arcmsr+PAE-1.30.0X.23-1.fc23.i686.rpm
	    2) [ ] /media/DD-2/rpms/i686/kmod-arcmsr-1.30.0X.23-1.fc23.i686.rpm
	     
  NOTE 2: second load i686(with PAE) driver
	   In this time, type 1 and press Enter
		   
	   (Page 1 of 1) Select drivers to install
	    1) [x] /media/DD-2/rpms/i686/kmod-arcmsr+PAE-1.30.0X.23-1.fc23.i686.rpm
	    2) [ ] /media/DD-2/rpms/i686/kmod-arcmsr-1.30.0X.23-1.fc23.i686.rpm
	     
	   In this example, type c and press Enter
	  ===============================================================================

	   After driver installation and new HDD devices show up, type c and press Enter to continue the system installation. 


C. For Workstation Installation
	1. Insert USB flash drive to target system.
	2. Booting from Fedora Installation DVD disc.
	3. When the Installation screen appears, move cursor UP to "Start Fedora Live".
	   Press Enter to start system.
	4. When 'Welcom to Fedora' was displayed, press CTRL+ALT+F2 to command console.
	   Login with root.
	   # 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+F1 to back to 'Welcom to Fedora' GUI, go on the system installtion.
	6. When Fedora was successfully installed and prompts you to Quit, press CTRL+ALT+F2 to command console
	   # 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
	7. Press ALT+F1 to back to system installation GUI and Quit. 

**********************************************************************************
3. Installing raid driver on an Existing System.
**********************************************************************************
	login as root
	============= For UEFI Secure Boot Only ===============
	If you had ever added areca public key to MOK list on this PC, do not do it again.
	# mokutil --import public_key.der
	# reboot
	=======================================================

	# rpm -ivh kmod-arcmsr-1.30.0X.23-1.fc23.$(uname -m).rpm
	# xz -f /lib/modules/$(uname -r)/updates/arcmsr.ko
	# depmod -a
	# reboot

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

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

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

	To compile arcmsr driver, extract driver source code to a new directory.
	# make

	============================ For UEFI Secure Boot Only =================================================
	For "UEFI Secure Boot" was Enabled in M/B BIOS, you have to generate a pair of public and private key by yourself.
	If you had ever generated key pair and added public key to MOK list once, do not do it again.

	Copy genkey.cfg to current directory, run following to generate key pair and add public key to MOK list.
	# openssl req -x509 -new -nodes -utf8 -sha256 -days 36500 -batch -config genkey.cfg -outform DER -out public_key.der -keyout private_key.priv
	# mokutil --import public_key.der

	Signing driver module with the Private Key by perl for each time you build new driver.
	# perl /usr/src/kernels/$(uname -r)/scripts/sign-file sha256 ./private_key.priv ./public_key.der ./arcmsr.ko
	========================================================================================================

	# xz arcmsr.ko
	# cp -f arcmsr.ko.xz  /lib/modules/$(uname -r)/kernel/drivers/scsi/arcmsr/
	# depmod -a
	# dracut -f
	# reboot
