New issue
Advanced search Search tips

Issue 725086 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: May 2017
Cc:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

init: Faster, cleaner, and safer boot flow for production images.

Project Member Reported by hungte@chromium.org, May 22 2017

Issue description

From the discussion of https://chromium-review.googlesource.com/#/c/426560/12/init/encrypted_stateful/startup_utils.sh@22

We should move test image & factory-specific logic into a new file that only available in test images so we won't need to worry about any logic complexity or security concern there.
 
Project Member

Comment 1 by bugdroid1@chromium.org, May 23 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/initramfs/+/4510af8444a752854acf64a1ad08f086ae60fb4e

commit 4510af8444a752854acf64a1ad08f086ae60fb4e
Author: Hung-Te Lin <hungte@chromium.org>
Date: Tue May 23 07:15:10 2017

factory_shim: Prevent running boot-splash.conf

To make normal boot path cleaner and faster, we want to remove 'factory'
logic from boot-splash, so we have to patch it here to a dummy job to
prevent being blocked by 'frecon' invocation.

BUG= chromium:725086 
TEST=build_image factory_install; Boots new install shim.

Change-Id: I78c5c544d54296c7caf6be14a91c53705ef5da2f
Reviewed-on: https://chromium-review.googlesource.com/511922
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Youcheng Syu <youcheng@google.com>

[modify] https://crrev.com/4510af8444a752854acf64a1ad08f086ae60fb4e/factory_shim/bootstrap.sh

Project Member

Comment 2 by bugdroid1@chromium.org, May 23 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/a9e27dfa881e82cd030e8edd5661cbef566ab447

commit a9e27dfa881e82cd030e8edd5661cbef566ab447
Author: Hung-Te Lin <hungte@chromium.org>
Date: Tue May 23 17:24:05 2017

chromeos-base/factory_installer: Clean pkg_postinstall.

The patching of upstart and rootfs files has been already moved to the
bootstrap code in initramfs/factory_shim, which is more flexible with
dynamic detection.

BUG= chromium:725086 
TEST=build_image factory_install; Boots factory shim successfully.

Change-Id: Id0233ab33f745dd63166311f07dfa6870b82b20a
Reviewed-on: https://chromium-review.googlesource.com/511902
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Youcheng Syu <youcheng@google.com>

[modify] https://crrev.com/a9e27dfa881e82cd030e8edd5661cbef566ab447/chromeos-base/factory_installer/factory_installer-9999.ebuild

Project Member

Comment 3 by bugdroid1@chromium.org, May 24 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform2/+/8c0dd2428bbdacc0460ef7a738d39583a170a10c

commit 8c0dd2428bbdacc0460ef7a738d39583a170a10c
Author: Hung-Te Lin <hungte@chromium.org>
Date: Wed May 24 06:59:02 2017

init: Merge BLOCKED_DEV_MODE_FILE to DEV_MODE_FILE.

If block_devmode is set, next boot will be in normal mode so there
should be no difference between checking DEV_MODE_FILE and
BLOCKED_DEV_MODE_FILE.

Directly using DEV_MODE_FILE helps us to simplify the logic and reduced
one file check call on each normal boot.

BUG= chromium:725086 
TEST=crossystem block_devmode=1; Reboot and enter developer mode;
     See block_devmode warning screen and reboots to normal mode,
     then seeing wiping occurred.

Change-Id: I2334e1ad26f587b4278cbace8a9ddc5bb37e576a
Reviewed-on: https://chromium-review.googlesource.com/509368
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>

[modify] https://crrev.com/8c0dd2428bbdacc0460ef7a738d39583a170a10c/init/chromeos_startup
[modify] https://crrev.com/8c0dd2428bbdacc0460ef7a738d39583a170a10c/init/dev_utils.sh

Project Member

Comment 4 by bugdroid1@chromium.org, May 24 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform2/+/5a8f51321be215509a66815600ee494e8b5b4576

commit 5a8f51321be215509a66815600ee494e8b5b4576
Author: Hung-Te Lin <hungte@chromium.org>
Date: Wed May 24 06:59:01 2017

init: Remove factory logic from boot-splash.conf.

boot-splash.conf used to have special logic for factory modes:
 - Not showing splash in factory install mode.
 - Showing additional logo for factory test mode.

In order to make normal boot path faster and cleaner, we want to remove
factory stuff from boot splash as:
 - Let factory installer build (or shim init) scripts disable boot-splash.
 - Enable frecon graphics in developer mode, and let factory test render
   the additional logo directly.

With these changes boot-splash can run faster and no special logic
included.

BUG= chromium:725086 
TEST=Boots system in test and factory mode, not seeing problems.

Change-Id: Id1bea3d1f1e3255235bb2e366c341a83324f3ec1
Reviewed-on: https://chromium-review.googlesource.com/511122
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Dan Erat <derat@chromium.org>

[modify] https://crrev.com/5a8f51321be215509a66815600ee494e8b5b4576/init/upstart/boot-splash.conf

Project Member

Comment 5 by bugdroid1@chromium.org, May 26 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform2/+/7c96450a186531a377a4b9946dbc920e9885d767

commit 7c96450a186531a377a4b9946dbc920e9885d767
Author: Hung-Te Lin <hungte@chromium.org>
Date: Fri May 26 18:18:14 2017

init: Revise enter_dev and leave_dev logic by removing factory mode checks.

The enter_dev and leave_dev was using few rules to determine developer
mode transition, which maybe revised:

 - FACTORY_MODE can be removed. All factory test images are
   cros_debugbuild=1, and netboot+factory install shims can be detected
   by checking stateful partition device.

 - FIRMWARE_TYPE: The checking of firmware type can be deferred after
   existence of DEV_MODE_FILE is checked. If DEV_MODE_FILE reflects
   right state of devsw_boot then we don't need to do further checks.

The new logic checks STATE_DEV in the very beginning, then RESET_FILE,
DEV_MODE_FILE, and finally using crossystem to check cros_debugbuild and
mainfw_type.

This change is needed for deprecating factory mode detection in future
commits.

BUG=b:36104199, chromium:725086 
TEST=Boots device in normal mode, switch to developer mode and see transition;
     switch back to normal mode and see transition.

Change-Id: I379dc73a31101f07feda94b7414b1a2195ee17d7
Reviewed-on: https://chromium-review.googlesource.com/493186
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Mattias Nissler <mnissler@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>

[modify] https://crrev.com/7c96450a186531a377a4b9946dbc920e9885d767/init/chromeos_startup
[modify] https://crrev.com/7c96450a186531a377a4b9946dbc920e9885d767/init/dev_utils.sh

Project Member

Comment 6 by bugdroid1@chromium.org, May 26 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform2/+/55211382d27a77ee68e33d95eaabc75e2c13a6e7

commit 55211382d27a77ee68e33d95eaabc75e2c13a6e7
Author: Hung-Te Lin <hungte@chromium.org>
Date: Fri May 26 20:01:05 2017

init: Move factory startup functions to only run on test image.

The factory logic should be not needed in normal mode. This change moves
"factory_utils.sh" to be only installed on test images by introducing a
new "test_utils.sh" that is loaded only in developer mode
(from "dev_utils.sh").

BUG= chromium:725086 
TEST=Boots in normal mode and developer mode, see dev mode transition.
     Install factory and remove DEV_MODE_FILE, not seeing enter_dev.

Change-Id: Ic5e6bf5b106b4011e1f22b185a544aac2c48336f
Reviewed-on: https://chromium-review.googlesource.com/426560
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>

[add] https://crrev.com/55211382d27a77ee68e33d95eaabc75e2c13a6e7/init/upstart/test-init/test_utils.sh
[modify] https://crrev.com/55211382d27a77ee68e33d95eaabc75e2c13a6e7/init/chromeos_startup
[rename] https://crrev.com/55211382d27a77ee68e33d95eaabc75e2c13a6e7/init/upstart/test-init/factory_utils.sh
[modify] https://crrev.com/55211382d27a77ee68e33d95eaabc75e2c13a6e7/init/dev_utils.sh

Project Member

Comment 7 by bugdroid1@chromium.org, May 31 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform2/+/203d7c0b15d95f9503545df8503941d5b095fc32

commit 203d7c0b15d95f9503545df8503941d5b095fc32
Author: Hung-Te Lin <hungte@chromium.org>
Date: Wed May 31 09:15:31 2017

init: factory_utils.sh: Allow mounting var and home in unencrypted mode.

The factory software has to unmount stateful partition and rootfs during
wiping process of finalization. The encstateful has created extra
complexity and hard to solve service dependency for stopping (to prevent
stateful/encstateful being busy). Also made it more difficult to debug
devices when kernel is corrupted.

Since "factory" mode for mount-encrypted was executed with fixed
key, it should be fine to just skip encryption so the factory wiping
process and fault analysis can be done more easily.

We now support a new mount_option file
/usr/local/factory/init/encstateful_mount_option with following modes:
 "factory": The "factory" mode using fixed key.
 "unencrypted": Do not use encstateful.

And if encstateful_mount_option is not defined, default to unencrypted.

BUG= chromium:725086 , chromium:679676 
TEST=./build_image test; install factory toolkit; run
     "gooftool wipe_in_place" and finished wiping process.

Change-Id: I9130ebb4620bc9b1ac62ceeea71de2f5a10d8358
Reviewed-on: https://chromium-review.googlesource.com/487922
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>

[modify] https://crrev.com/203d7c0b15d95f9503545df8503941d5b095fc32/init/upstart/test-init/factory_utils.sh

Project Member

Comment 8 by bugdroid1@chromium.org, May 31 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/41ef5eb08090e54a7bffff6d36f6df4c35e8fce8

commit 41ef5eb08090e54a7bffff6d36f6df4c35e8fce8
Author: Hung-Te Lin <hungte@chromium.org>
Date: Wed May 31 09:15:29 2017

chromeos-base/chromeos-test-init: Install *_utils.sh to /usr/share/cros.

To make production images run faster, cleaner and safer, we want to move
test image specific logic (and special modes relying on test image, for
example factory mode) to scripts only available in test images.

BUG= chromium:725086 
TEST=emerge-$BOARD chromeos-test-init
CQ-DEPEND=CL:426560

Change-Id: Ic3c334fa3d268f9fcf5aa79d9c0f8c08c93ee0c2
Reviewed-on: https://chromium-review.googlesource.com/509603
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>

[modify] https://crrev.com/41ef5eb08090e54a7bffff6d36f6df4c35e8fce8/chromeos-base/chromeos-test-init/chromeos-test-init-9999.ebuild

Comment 9 by hungte@chromium.org, May 31 2017

Status: Fixed (was: Started)

Sign in to add a comment