chromeos-config-tools: cros_configfs block boot-services

Change cros_configfs to block boot-services, until cros_configfs
is ready. By extension, this ensure that the cros config mechanism
is ready for use as soon as "boot-services" transitions to "started".

Problem:
The cros config mechanism is globally dead until cros_configfs is
mounted. The mounting is accomplished by the cros_configfs upstart
pre-start section. Although this is done in the pre-start section, the
script is triggered from the "started boot-services" signal, which
gives assurances about completion, with respect to other service start
time. This means that cros_configfs can complete mounting at any point,
after boot-services starts.
See b/161421508 for an example of the errors this causes.

Explanation of Solution:
Cros config is assumed to be a core feature, similar to dbus or metrics,
that is used by many services. It would incur unnecessary complexity
and additional room for error if all services had to form an explicit
startup dependencies for cros_configfs (which is what cros config
indirectly uses). See b/161421508 for more analysis.

cros_configfs should block boot-services itself, similar to what
metrics_library currently does.

Assumptions (which might change in the future):
* No service before boot-services shall use cros config.
* No service that blocks boot-services
  ("start on starting boot-services") shall use cros config.
* Services that "start on started boot-services" or start on later
  events may use cros config (eg. powerd, ui, or system-services).

BUG=b:157095325, b:161421508
TEST=# The following test occurred on both Nocturne and Dratini
     # Flash R86-13376.0.0
     /usr/share/vboot/bin/make_dev_ssd.sh --partitions '2 4' --default_rw_root --remove_rootfs_verification
     sync
     reboot
     # Edit /etc/init/cros_configfs.conf
     # - Do NOT apply fix
     # - Add a "sleep 10" to the top of the pre-start section
     cat >/etc/init/before.conf <<-EOF
          start on starting boot-services
          task
          script
          echo "name = '$(cros_config / name)'" >/var/log/${UPSTART_JOB}.log
          end script
     EOF
     cat >/etc/init/after.conf <<-EOF
          start on started boot-services
          task
          script
          echo "name = '$(cros_config / name)'" >/var/log/${UPSTART_JOB}.log
          end script
     EOF
     sync
     reboot
     # Check that /var/log/before.log shows "name = ''"
     # Check that /var/log/after.log shows "name = ''"
     #
     # Edit /etc/init/cros_configfs.conf
     # - Apply fix
     sync
     reboot
     # Check that /var/log/before.log shows "name = ''"
     # Check that /var/log/after.log shows "name = '<BOARD>'"
TEST=# Thanks to @yichengli for the following test:
     # On a nami device without /dev/cros_fp:
     # (1) without this change, boot many times, observe that 1 in ~3
     #     boots bio_fw_updater fails to query cros_configfs, and
     #     decided to do legacy update, and failed to query FPMCU
     #     version (there's no FPMCU at all).
     # (2) with this change, boot >10 times, observe that every time
     #     bio_fw_updater learns from cros_configfs that there's no
     #     FPMCU.

Change-Id: I4b1bc6d5599f81089434dca65bb335e5af6aa58a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform2/+/2320013
Tested-by: Craig Hesling <hesling@chromium.org>
Auto-Submit: Craig Hesling <hesling@chromium.org>
Commit-Queue: Yicheng Li <yichengli@chromium.org>
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Reviewed-by: Matthew Blecker <matthewb@chromium.org>
Reviewed-by: Yicheng Li <yichengli@chromium.org>
diff --git a/chromeos-config/init/cros_configfs.conf b/chromeos-config/init/cros_configfs.conf
index d64dea2..fb29705 100644
--- a/chromeos-config/init/cros_configfs.conf
+++ b/chromeos-config/init/cros_configfs.conf
@@ -5,7 +5,7 @@
 description     "Abstract job to control the /run/chromeos-config mount"
 author          "The Chromium OS Authors <chromium-os-dev@chromium.org>"
 
-start on started boot-services
+start on starting boot-services
 
 env CROS_CONFIGFS_IMAGE="/usr/share/chromeos-config/configfs.img"
 env MOUNTPOINT="/run/chromeos-config"