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/<version>/kernel/drivers/input/misc
where current <version> 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 <keescook@chromium.org>
Reviewed-by: Mandeep Singh Baines <msb@chromium.org>
Tested-by: Joseph Shyh-In Hwang <josephsih@chromium.org>
Commit-Ready: Joseph Shyh-In Hwang <josephsih@chromium.org>
This commit is contained in:
Joseph Hwang 2012-03-24 20:38:21 +08:00 committed by Gerrit
parent 7515d89be7
commit ca63e041e5
3 changed files with 23 additions and 0 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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