From 1afb2fe5d44adb64013aa55d8aa95881d39269ee Mon Sep 17 00:00:00 2001
From: Donald Buczek <buczek@molgen.mpg.de>
Date: Tue, 12 Dec 2017 12:06:54 +0100
Subject: [PATCH] linux-4.9.68: Build aacraid driver

We need a driver with async-mode for the aacraid.

Patch by Thomas Kreitler
---
 linux-4.9.68-193.bee | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/linux-4.9.68-193.bee b/linux-4.9.68-193.bee
index b7e25db05..6b1dc57c3 100755
--- a/linux-4.9.68-193.bee
+++ b/linux-4.9.68-193.bee
@@ -28,6 +28,35 @@ B=${S}
 ls ${BEE_PKGDIR}/linux-[0-9].[0-9]*-${PKGREVISION}.x86_64.bee.* 2>/dev/null \
     && echo "A kernel with revision ${PKGREVISION} has already been build."  && exit
 
+#  aacraid
+#  https://storage.microsemi.com/en-us/downloads/linux_source/linux_source_code/productid=aha-1000-8e&dn=microsemi+adaptec+hba+1000-8e.php
+#  http://download.adaptec.com/raid/aac/linux/aacraid-linux-src-1.2.1-55022.tgz
+#  http://twiki.molgen.mpg.de/foswiki/Medv/SoftwareRaid
+#  CONFIG_SCSI_AACRAID=m
+#
+build_aacraid_driver_update_and_do_depmod() {
+    local DRIVERBUILD=54013
+
+    pushd .
+
+    echo "aacraid driver"
+
+    mkdir -pv ${B}/aacraid_update
+    cd ${B}/aacraid_update
+    tar -xf /src/mariux/beeroot/downloads/aacraid_source_1.2.1-${DRIVERBUILD}.tgz
+    cd aacraid-1.2.1-${DRIVERBUILD}
+    chmod -x *
+    make -C ${B} M=${B}/aacraid_update/aacraid-1.2.1-${DRIVERBUILD} modules
+
+    mkdir -pv ${D}/lib/modules/${FULLKERNELVERSION}/updates/drivers/scsi/aacraid
+    cp -v aacraid.ko ${D}/lib/modules/${FULLKERNELVERSION}/updates/drivers/scsi/aacraid
+
+    cd ${D}/lib/modules/${FULLKERNELVERSION}
+    depmod -a -b ${D} ${FULLKERNELVERSION}
+
+    popd
+}
+
 mee_patch() {
     echo "PATCH $@"
     bee_patch $@
@@ -75,6 +104,8 @@ mee_install() {
     make install          INSTALL_PATH=${D}/boot
 #    make firmware_install INSTALL_MOD_PATH=${D}
 
+    build_aacraid_driver_update_and_do_depmod
+
     rm -v ${D}/lib/modules/${FULLKERNELVERSION}/{source,build}
 
     ln -sv /usr/src/linux/${PKGALLPKG}/source ${D}/lib/modules/${FULLKERNELVERSION}/source