move insmod script to gs-common
Bug: 243763292
Test: boot to home
Change-Id: I4662b5265ccaaf92889931214597fabc120e9dbc
diff --git a/conf/init.gs101.rc b/conf/init.gs101.rc
index d88cf82..28d108b 100644
--- a/conf/init.gs101.rc
+++ b/conf/init.gs101.rc
@@ -239,8 +239,8 @@
# Modem temperature driver
chown radio system /sys/devices/platform/cp-tm1/cp_temp
- # Loading common kernel modules in background
- start insmod_sh_common
+ # insert display module
+ start init_display
# Charge stats (write 0)
chown system system /sys/class/power_supply/battery/charge_stats
@@ -826,7 +826,7 @@
on property:persist.vendor.adaptive.charge.soc=*
write /sys/class/power_supply/battery/charge_limit ${persist.vendor.adaptive.charge.soc}
-service insmod_sh_common /vendor/bin/init.insmod.sh /vendor/etc/init.insmod.gs101.cfg
+service init_display /vendor/bin/init.display.sh
class main
user root
group root system
diff --git a/device.mk b/device.mk
index 4a84488..e0201be 100644
--- a/device.mk
+++ b/device.mk
@@ -301,12 +301,10 @@
# Shell scripts
PRODUCT_COPY_FILES += \
- device/google/gs101/init.insmod.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.insmod.sh \
+ device/google/gs101/init.display.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.display.sh \
device/google/gs101/disable_contaminant_detection.sh:$(TARGET_COPY_OUT_VENDOR)/bin/hw/disable_contaminant_detection.sh
-# insmod files
-PRODUCT_COPY_FILES += \
- device/google/gs101/init.insmod.gs101.cfg:$(TARGET_COPY_OUT_VENDOR)/etc/init.insmod.gs101.cfg
+include device/google/gs-common/insmod/insmod.mk
# For creating dtbo image
PRODUCT_HOST_PACKAGES += \
diff --git a/init.display.sh b/init.display.sh
new file mode 100755
index 0000000..bb942e3
--- /dev/null
+++ b/init.display.sh
@@ -0,0 +1,22 @@
+#!/vendor/bin/sh
+modules_dir=
+
+for f in /vendor/lib/modules/*/modules.dep /vendor/lib/modules/modules.dep; do
+ if [[ -f "$f" ]]; then
+ modules_dir="$(dirname "$f")"
+ break
+ fi
+done
+
+if [[ -z "${modules_dir}" ]]; then
+ echo "Unable to locate kernel modules directory" 2>&1
+ exit 1
+fi
+
+panel_drv=`getprop ro.boot.primary_panel_drv`
+if [[ -z "$panel_drv" ]]; then
+ panel_drv="panel-samsung-emul"
+fi
+modprobe -d "${modules_dir}" exynos-drm.ko
+modprobe -d "${modules_dir}" $panel_drv.ko
+
diff --git a/init.insmod.gs101.cfg b/init.insmod.gs101.cfg
deleted file mode 100644
index 1eb29b9..0000000
--- a/init.insmod.gs101.cfg
+++ /dev/null
@@ -1,12 +0,0 @@
-####################################################
-# init.insmod.common.cfg #
-# This file contains common kernel modules to load #
-# at init time by init.insmod.sh script #
-####################################################
-
-# Load common kernel modules
-# Modules here will be loaded *before* device specific modules
-install_display_drivers
-modprobe|-b *
-# All common modules loaded
-setprop|vendor.common.modules.ready
diff --git a/init.insmod.sh b/init.insmod.sh
deleted file mode 100755
index 645391a..0000000
--- a/init.insmod.sh
+++ /dev/null
@@ -1,78 +0,0 @@
-#!/vendor/bin/sh
-
-#############################################################
-### init.insmod.cfg format: ###
-### ----------------------------------------------------- ###
-### [insmod|setprop|enable/moprobe|wait] [path|prop name] ###
-### ... ###
-#############################################################
-
-modules_dir=
-
-for f in /vendor/lib/modules/*/modules.dep /vendor/lib/modules/modules.dep; do
- if [[ -f "$f" ]]; then
- modules_dir="$(dirname "$f")"
- break
- fi
-done
-
-if [[ -z "${modules_dir}" ]]; then
- echo "Unable to locate kernel modules directory" 2>&1
- exit 1
-fi
-
-# imitates wait_for_file() in init
-wait_for_file()
-{
- filename="${1}"
- timeout="${2:-5}"
-
- expiry=$(($(date "+%s")+timeout))
- while [[ ! -e "${filename}" ]] && [[ "$(date "+%s")" -le "${expiry}" ]]
- do
- sleep 0.01
- done
-}
-
-install_display_drivers()
-{
- panel_drv=`getprop ro.boot.primary_panel_drv`
- if [[ -z "$panel_drv" ]]; then
- panel_drv="panel-samsung-emul"
- fi
- modprobe -d "${modules_dir}" exynos-drm.ko
- modprobe -d "${modules_dir}" $panel_drv.ko
-}
-
-if [ $# -eq 1 ]; then
- cfg_file=$1
-else
- # Set property even if there is no insmod config
- # to unblock early-boot trigger
- setprop vendor.common.modules.ready
- setprop vendor.device.modules.ready
- setprop vendor.all.modules.ready
- setprop vendor.all.devices.ready
- exit 1
-fi
-
-if [ -f $cfg_file ]; then
- while IFS="|" read -r action arg
- do
- case $action in
- "insmod") insmod $arg ;;
- "setprop") setprop $arg 1 ;;
- "enable") echo 1 > $arg ;;
- "modprobe")
- case ${arg} in
- "-b *" | "-b")
- arg="-b --all=${modules_dir}/modules.load" ;;
- "*" | "")
- arg="--all=${modules_dir}/modules.load" ;;
- esac
- modprobe -a -d "${modules_dir}" $arg ;;
- "wait") wait_for_file $arg ;;
- "install_display_drivers") install_display_drivers ;;
- esac
- done < $cfg_file
-fi