diff --git a/mod_for_factory_scripts/100disableUI b/mod_for_factory_scripts/100disableUI new file mode 100755 index 0000000000..a0f74716ae --- /dev/null +++ b/mod_for_factory_scripts/100disableUI @@ -0,0 +1,8 @@ +#!/bin/bash + +# Copyright (c) 2010 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. + +echo "Disabling ui.conf, don't do Chrome startup on boot." +mv ${ROOT_FS_DIR}/etc/init/ui.conf ${ROOT_FS_DIR}/etc/init/ui.conf.disabled diff --git a/mod_for_factory_scripts/200patchInitScript b/mod_for_factory_scripts/200patchInitScript new file mode 100755 index 0000000000..2a804af256 --- /dev/null +++ b/mod_for_factory_scripts/200patchInitScript @@ -0,0 +1,108 @@ +#!/bin/bash + +# Copyright (c) 2010 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. + +echo "Applying patch to init scripts." +pushd ${ROOT_FS_DIR} + +patch -d ${ROOT_FS_DIR} -Np1 < ${ROOT_FS_DIR}/etc/init/factory.conf <> /var/log/factory.log + cp -f site_tests/suite_Factory/control.full control + ./bin/autotest control >> /var/log/factory.log 2>&1 +fi +end script +EOF + +cat > ${ROOT_FS_DIR}/etc/init/autotest.conf <> /var/log/factory.log +./tools/autotest >> /var/log/factory.log 2>&1 +end script +EOF + +cat > ${ROOT_FS_DIR}/etc/init/tty1.conf < /sys/devices/virtual/graphics/fbcon/cursor_blink ++# echo 0 > /sys/devices/virtual/graphics/fbcon/cursor_blink + + # Since we defer udev until later in the boot process, we pre-populate /dev + # with the set of devices needed for X and other early services to run. + cp -a -f /lib/chromiumos/devices/* /dev + +-# Splash screen! +-if [ -x /usr/bin/ply-image ] +-then +- /usr/bin/ply-image /usr/share/chromeos-assets/images/login_splash.png & +-fi +- + mount -n -t tmpfs tmp /tmp + mount -n -t tmpfs -onosuid,nodev shmfs /dev/shm + mount -n -t devpts -onoexec,nosuid,gid=5,mode=0620 devpts /dev/pts +EOF + +popd diff --git a/mod_for_factory_scripts/300modifyDescription b/mod_for_factory_scripts/300modifyDescription new file mode 100755 index 0000000000..3937268341 --- /dev/null +++ b/mod_for_factory_scripts/300modifyDescription @@ -0,0 +1,9 @@ +#!/bin/bash + +# Copyright (c) 2010 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. + +echo "Modifying Release Description for Factory." +FILE="${ROOT_FS_DIR}/etc/lsb-release" +sed -i 's/Test/Factory/' $FILE diff --git a/mod_for_factory_scripts/500copyQualDb b/mod_for_factory_scripts/500copyQualDb new file mode 100755 index 0000000000..b6977ba602 --- /dev/null +++ b/mod_for_factory_scripts/500copyQualDb @@ -0,0 +1,30 @@ +#!/bin/bash + +# Copyright (c) 2010 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. + +# Assume that we run HWQual test before and generate the system component file. +# The file is placed in (XXXX is a random number): +# /tmp/run_remote_tests.XXXX/hardware_Components/results/system_components +# +# QUALDB can be a full path of the file, or a specified directory +# /tmp/run_remote_tests.XXXX, or a default wildcard one /tmp/run_remote_tests.*. + +# If QUALDB is a default wildcard directory, try to use the most recent one. +QUALDB=$(ls -dt ${QUALDB} 2>&-| head -1) + +# Try to append the full path to the file if QUALDB is a directory. +if [ ! -z ${QUALDB} ] && [ -d ${QUALDB} ]; then + QUALDB="${QUALDB}/hardware_Components/results/system_components" +fi + +if [ ! -z ${QUALDB} ] && [ -f ${QUALDB} ]; then + # Copy the qualified component file to the image + echo "Copying ${QUALDB} to the image." + mkdir -p ${ROOT_FS_DIR}/usr/local/manufacturing + cp -f ${QUALDB} \ + ${ROOT_FS_DIR}/usr/local/manufacturing/qualified_components +else + echo "No qualified component file found at: ${QUALDB}" +fi diff --git a/mod_for_factory_scripts/factory.patch b/mod_for_factory_scripts/factory.patch deleted file mode 100644 index 7978417572..0000000000 --- a/mod_for_factory_scripts/factory.patch +++ /dev/null @@ -1,88 +0,0 @@ -diff -Naur old/etc/init/dump-boot-stats.conf new/etc/init/dump-boot-stats.conf ---- old/etc/init/dump-boot-stats.conf 2010-04-05 21:33:11.000000000 -0700 -+++ new/etc/init/dump-boot-stats.conf 2010-04-05 21:00:48.000000000 -0700 -@@ -7,7 +7,7 @@ - # when login-prompt-ready is received, grabs the current uptime and - # disk stats. Also sends uptime to metrics client for perf dashboard - --start on login-prompt-ready -+start on stopping startup - - # This is run-once rather than a service. - task -diff -Naur old/etc/init/factory.conf new/etc/init/factory.conf ---- old/etc/init/factory.conf 1969-12-31 16:00:00.000000000 -0800 -+++ new/etc/init/factory.conf 2010-04-05 20:59:07.000000000 -0700 -@@ -0,0 +1,17 @@ -+ -+description "Chrome OS factory startup stub" -+author "chromium-os-dev@googlegroups.com" -+ -+start on stopping autotest -+ -+script -+ -+cd /usr/local/autotest -+if [ ! -e factory_started ]; then -+ touch factory_started -+ date >> /var/log/factory.log -+ cp -f site_tests/suite_Factory/control.full control -+ ./bin/autotest control >> /var/log/factory.log 2>&1 -+fi -+end script -+ -diff -Naur old/etc/init/autotest.conf new/etc/init/autotest.conf ---- old/etc/init/autotest.conf 1969-12-31 16:00:00.000000000 -0800 -+++ new/etc/init/autotest.conf 2010-04-05 20:59:07.000000000 -0700 -@@ -0,0 +1,15 @@ -+ -+description "Chrome OS autotest startup stub" -+author "chromium-os-dev@googlegroups.com" -+ -+start on started udev -+ -+script -+# Sleep as the current upstart sequence gives no clear completion signal. -+# TODO: investigate generating authoritative bootup finished event. -+sleep 10 -+cd /usr/local/autotest -+date >> /var/log/factory.log -+./tools/autotest >> /var/log/factory.log 2>&1 -+end script -+ -diff -Naur old/etc/init/tty1.conf new/etc/init/tty1.conf ---- old/etc/init/tty1.conf 1969-12-31 16:00:00.000000000 -0800 -+++ new/etc/init/tty1.conf 2010-04-05 20:59:07.000000000 -0700 -@@ -0,0 +1,9 @@ -+start on startup -+stop on starting halt or starting reboot -+ -+respawn -+script -+cd / -+/sbin/agetty 38400 tty1 linux -l /bin/bash -n -+end script -+ -diff -Naur old/sbin/chromeos_startup new/sbin/chromeos_startup ---- old/sbin/chromeos_startup 2010-04-05 21:33:52.000000000 -0700 -+++ new/sbin/chromeos_startup 2010-04-05 21:38:02.000000000 -0700 -@@ -20,18 +20,12 @@ - - # Moblin trick: Disable blinking cursor. Without this a splash screen - # will show a distinct cursor shape even when the cursor is set to none. --echo 0 > /sys/devices/virtual/graphics/fbcon/cursor_blink -+# echo 0 > /sys/devices/virtual/graphics/fbcon/cursor_blink - - # Since we defer udev until later in the boot process, we pre-populate /dev - # with the set of devices needed for X and other early services to run. - cp -a -f /lib/chromiumos/devices/* /dev - --# Splash screen! --if [ -x /usr/bin/ply-image ] --then -- /usr/bin/ply-image /usr/share/chromeos-assets/images/login_splash.png & --fi -- - mount -n -t tmpfs tmp /tmp - mount -n -t tmpfs -onosuid,nodev shmfs /dev/shm - mount -n -t devpts -onoexec,nosuid,gid=5,mode=0620 devpts /dev/pts diff --git a/mod_for_factory_scripts/factory_setup.sh b/mod_for_factory_scripts/factory_setup.sh new file mode 100755 index 0000000000..97959eea34 --- /dev/null +++ b/mod_for_factory_scripts/factory_setup.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +# Copyright (c) 2010 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. + +echo "Modifying image for factory test..." + +for SCRIPT in \ + ${GCLIENT_ROOT}/src/scripts/mod_for_factory_scripts/[0-9][0-9][0-9]*[!$~] +do + ${SCRIPT} +done diff --git a/mod_image_for_test.sh b/mod_image_for_test.sh index fc7f500f17..0707d206af 100755 --- a/mod_image_for_test.sh +++ b/mod_image_for_test.sh @@ -114,51 +114,16 @@ fi sudo losetup -o $(( $offset * 512 )) "${LOOP_DEV}" "${FLAGS_image}" sudo mount "${LOOP_DEV}" "${ROOT_FS_DIR}" -MOD_SCRIPTS_ROOT="${GCLIENT_ROOT}/src/scripts/mod_for_test_scripts" -# Run test setup script inside chroot jail to modify the image +MOD_TEST_ROOT="${GCLIENT_ROOT}/src/scripts/mod_for_test_scripts" +# Run test setup script to modify the image sudo GCLIENT_ROOT="${GCLIENT_ROOT}" ROOT_FS_DIR="${ROOT_FS_DIR}" \ - "${MOD_SCRIPTS_ROOT}/test_setup.sh" + "${MOD_TEST_ROOT}/test_setup.sh" -# Run manufacturing test setup if [ ${FLAGS_factory} -eq ${FLAGS_TRUE} ]; then - echo "Modifying image ${FLAGS_image} for manufacturing test..." - - echo "Disabling ui.conf, don't do chrome startup on boot." - sudo mv ${ROOT_FS_DIR}/etc/init/ui.conf \ - ${ROOT_FS_DIR}/etc/init/ui.conf.disabled - - echo "Applying patch to init scripts" - MOD_MFG_ROOT="${GCLIENT_ROOT}/src/scripts/mod_for_factory_scripts" - pushd ${ROOT_FS_DIR} - sudo patch -d ${ROOT_FS_DIR} -p1 < ${MOD_MFG_ROOT}/factory.patch - popd - - echo "Modifying Release Description for Factory." - FILE="${ROOT_FS_DIR}/etc/lsb-release" - sudo sed -i 's/Test/Factory/' $FILE - - echo "Done applying patch." - - # Try to use the sytem component file in the most recent autotest result - FLAGS_qualdb=$(ls -dt ${FLAGS_qualdb} 2>&-| head -1) - - # Try to append the full path to the file if FLAGS_qualdb is a directory - if [ ! -z ${FLAGS_qualdb} ] && [ -d ${FLAGS_qualdb} ]; then - # TODO(waihong): Handle multiple results to deliver to multiple images - FLAGS_qualdb="${FLAGS_qualdb}/hardware_Components,*" - FLAGS_qualdb=$(ls -dt ${FLAGS_qualdb} 2>&-| head -1) - FLAGS_qualdb="${FLAGS_qualdb}/hardware_Components/results/system_components" - fi - - if [ ! -z ${FLAGS_qualdb} ] && [ -f ${FLAGS_qualdb} ]; then - # Copy the qualified component file to the image - echo "Copying ${FLAGS_qualdb} to the image." - sudo mkdir -p ${ROOT_FS_DIR}/usr/local/manufacturing - sudo cp -f ${FLAGS_qualdb} \ - ${ROOT_FS_DIR}/usr/local/manufacturing/qualified_components - else - echo "No qualified component file found at: ${FLAGS_qualdb}" - fi + MOD_FACTORY_ROOT="${GCLIENT_ROOT}/src/scripts/mod_for_factory_scripts" + # Run factory setup script to modify the image + sudo GCLIENT_ROOT="${GCLIENT_ROOT}" ROOT_FS_DIR="${ROOT_FS_DIR}" \ + QUALDB="${FLAGS_qualdb}" "${MOD_FACTORY_ROOT}/factory_setup.sh" fi cleanup