--- /dev/null
+#!/bin/sh
+
+##################################################################
+#
+# Russellville CrownBay CrossvilleOKI ML7213 NexCOM
+#monitor LVDS 7 LVDS 13 LVDS 7 LVDS 13 LVDS 7
+#Gfx 8086:8108 8086:4108 8086:4108 8086:4108 8086:4108
+#
+#################################################################
+#
+# unknown
+# 1 Russellville DEVICE has 8086:8108
+# 2 CrownBay VENDOR !has 10db && DEVICE has 8086:4108
+# 3 CrossivilleOKI VENDOR has 10db && DEVICE has 8086:4108
+
+DEVICE_LSPCI=`lspci -n | cut -d$' ' -f3`
+
+find_board_type() {
+ local __resultvar=$1
+ local _board_type="unknown"
+ local IS_8108='0'
+ local IS_4108='0'
+ local IS_ML7213='0'
+ local IS_CROWNBAY='0'
+ local oldIFS=$IFS
+ #set -x
+ for entry in $DEVICE_LSPCI; do
+ #echo $entry
+ IFS=$':'
+ set -- $entry
+
+ VENDOR=`echo $1`
+ DEVICE=`echo $2`
+ if [ $VENDOR == '8086' ]; then
+ if [ $DEVICE == '8108' ]; then
+ IS_8108='1'
+ break
+ elif [ $DEVICE == '4108' ]; then
+ IS_4108='1'
+ fi
+ elif [ $VENDOR == '10db' ]; then
+ IS_ML7213='1'
+ elif [ $VENDOR == '12d8' ]; then
+ IS_CROWNBAY='1'
+ fi
+ IFS=$oldIFS
+ done
+
+ if [ $IS_8108 == '1' ]; then
+ _board_type='Russellville'
+ elif [ $IS_4108 == '1' ]; then
+ if [ $IS_ML7213 == '1' ]; then
+ _board_type='CrossvilleOKI'
+ elif [ $IS_CROWNBAY == '1' ]; then
+ _board_type='CrownBay'
+ else
+ _board_type='NextCom'
+ fi
+ else
+ _board_type='unknown'
+ fi
+
+ # This logic is stupid and the reliable method is to query the firmware interface, which now is not available yet.
+
+ echo "$_board_type"
+}
+
+platform="unknown"
+set_config() {
+ boardname=`find_board_type $platform`
+ echo "Boardname is $boardname"
+ configid=3
+ case $boardname in
+ Russellville)
+ configid=1
+ ;;
+ CrownBay)
+ configid=2
+ ;;
+ NextCom)
+ configid=3
+ ;;
+ CrossvilleOKI)
+ configid=1
+ ;;
+ esac
+ echo "Configid is $configid"
+ modprobe emgd configid=$configid
+}
+set_config
+exit $?
--- /dev/null
+#----------------------------------------------------------------------------
+# Copyright (c) 2002-2010, Intel Corporation.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#----------------------------------------------------------------------------
+
+%define debug_package %{nil}
+%define modpath %(ls -d /lib/modules/*/kernel)/drivers/gpu/drm/emgd
+
+Name: intel-emgd-kmod
+Summary: Intel EMGD kernel module
+Version: 2667
+Release: 1%{?dist}
+License: GPL v2
+Vendor: Intel
+Group: System Environment/Kernel
+BuildRoot: %{_tmppath}/%{name}-%{version}
+Source0: %{name}-%{version}.tar.gz
+Source1: intel-emgd-kmod.service
+Source2: intel-emgd-kmod.init
+BuildRequires: kernel-adaptation-intel-automotive-devel, kmod
+
+
+%description
+Intel EMGD kernel module for kernel
+
+%prep
+%setup -q
+
+%build
+make
+
+%install
+
+mkdir -p $RPM_BUILD_ROOT/usr/lib/systemd/system/
+mkdir -p $RPM_BUILD_ROOT/usr/libexec/
+install -m 755 -d $RPM_BUILD_ROOT%{modpath}
+install -m 744 emgd.ko $RPM_BUILD_ROOT%{modpath}
+install -m 755 -D %{SOURCE1} $RPM_BUILD_ROOT/usr/lib/systemd/system/
+install -m 755 -D %{SOURCE2} $RPM_BUILD_ROOT/usr/libexec/
+
+%clean
+rm -Rf $RPM_BUILD_ROOT
+
+%post
+## create the dependency of kernel modules
+/sbin/depmod -a >/dev/null 2>&1
+
+mkdir -p /usr/lib/systemd/system/basic.target.wants/
+pushd /usr/lib/systemd/system/basic.target.wants/
+ln -sf ../intel-emgd-kmod.service intel-emgd-kmod.service
+popd
+
+if [ -x /bin/systemctl ]; then
+ /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+ /bin/systemctl start intel-emgd-kmod.service > /dev/null 2>&1 || :
+fi
+
+%postun
+/sbin/depmod -a >/dev/null 2>&1
+rm -f /usr/lib/systemd/system/basic.target.wants/intel-emgd-kmod.service
+if [ -x /bin/systemctl ]; then
+ systemctl daemon-reload >/dev/null 2>&1 || :
+fi
+
+%preun
+if [ -x /bin/systemctl ]; then
+ sytemctl stop intel-emgd-kmod.service >/dev/null 2>&1 || :
+fi
+
+%files
+%defattr(-,root,root,-)
+%{modpath}/emgd.ko
+%{_libdir}/systemd/system/intel-emgd-kmod.service
+/usr/libexec/intel-emgd-kmod.init