From ca63e041e5b45c59d115e5c755bb0e51a508ca21 Mon Sep 17 00:00:00 2001 From: Joseph Hwang Date: Sat, 24 Mar 2012 20:38:21 +0800 Subject: [PATCH] Install uinput module in test image only This CL adds uinput module in INSTALL_MASK so that the module is not installed to non-test image. A mod_image_for_test script is implemented to install the module in the test image if the uinput module exists. BUG=chromium-os:26707 TEST=Build a base image and a test image. Check the directory /lib/modules//kernel/drivers/input/misc where current is 3.2.7. In the base image, there should be no uinput.ko, while in the test image, there should be uinput.ko. CQ-DEPEND=Ie96242c4d56403866a2298db2ba3bd6459248c1b Change-Id: I0ca6599f80b9bb72cdc044fc97cdf990ce550edc Reviewed-on: https://gerrit.chromium.org/gerrit/19032 Reviewed-by: Kees Cook Reviewed-by: Mandeep Singh Baines Tested-by: Joseph Shyh-In Hwang Commit-Ready: Joseph Shyh-In Hwang --- build_library/test_image_util.sh | 1 + common.sh | 1 + mod_for_test_scripts/920addUinput | 21 +++++++++++++++++++++ 3 files changed, 23 insertions(+) create mode 100755 mod_for_test_scripts/920addUinput diff --git a/build_library/test_image_util.sh b/build_library/test_image_util.sh index 1807d9f9e7..9f6729f9ad 100755 --- a/build_library/test_image_util.sh +++ b/build_library/test_image_util.sh @@ -116,6 +116,7 @@ mod_image_for_test () { # Run test setup script to modify the image sudo -E GCLIENT_ROOT="${GCLIENT_ROOT}" ROOT_FS_DIR="${ROOT_FS_DIR}" \ STATEFUL_DIR="${STATEFUL_FS_DIR}" ARCH="${ARCH}" BACKDOOR="${BACKDOOR}" \ + BOARD_ROOT="${BOARD_ROOT}" \ "${mod_test_script}" # Legacy parameter (used by mod_image_for_test.sh --factory) diff --git a/common.sh b/common.sh index c4a15c4321..2aa93b255e 100644 --- a/common.sh +++ b/common.sh @@ -238,6 +238,7 @@ COMMON_INSTALL_MASK=" DEFAULT_INSTALL_MASK=" $COMMON_INSTALL_MASK /usr/local/autotest + /lib/modules/*/kernel/drivers/input/misc/uinput.ko " # Mask for factory test image (build_image --factory) diff --git a/mod_for_test_scripts/920addUinput b/mod_for_test_scripts/920addUinput new file mode 100755 index 0000000000..6089c77654 --- /dev/null +++ b/mod_for_test_scripts/920addUinput @@ -0,0 +1,21 @@ +#!/bin/bash + +# Copyright (c) 2012 The Chromium OS Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +# +# Add the uinput kernel module into the image for test builds. +# This is for running trackpad autotest in VM. + +echo "Adding the uinput module for test builds." +MODULES_PATH="/lib/modules" +KERNEL_RELEASE=$(ls -tr "${ROOT_FS_DIR}${MODULES_PATH}" | tail -n1) +UINPUT_PATH="${MODULES_PATH}/${KERNEL_RELEASE}"/kernel/drivers/input/misc +SRC_FILE="${BOARD_ROOT}${UINPUT_PATH}"/uinput.ko +DST_DIR="${ROOT_FS_DIR}${UINPUT_PATH}" +if [ -f "${SRC_FILE}" ]; then + install -m 644 "${SRC_FILE}" "${DST_DIR}" + echo "The uinput module is installed." +else + echo "Cannot install the uinput module." +fi