Change default to build ChromeOS with AFDO.

Change the default USE flags to use AFDO since that is how the
released images are built. To build WITHOUT AFDO do:

  build_chromeos.py --env='USE=-afdo_use' --board ....

BUG=None
TEST=Tested building with and without AFDO. Verified right USE
     flags are generated.

Change-Id: I6ae2313b76b08fc0e0a22aae90f4ca0396d523e4
Reviewed-on: https://chrome-internal-review.googlesource.com/210834
Reviewed-by: Caroline Tice <cmtice@google.com>
Tested-by: Luis Lozano <llozano@chromium.org>
Commit-Queue: Luis Lozano <llozano@chromium.org>
diff --git a/build_chromeos.py b/build_chromeos.py
index 6968989..673f32b 100755
--- a/build_chromeos.py
+++ b/build_chromeos.py
@@ -84,6 +84,10 @@
 
   if options.chromeos_root is None:
     Usage(parser, "--chromeos_root must be set")
+  options.chromeos_root = os.path.expanduser(options.chromeos_root)
+  scripts_dir = os.path.join(options.chromeos_root, 'src', 'scripts')
+  if not os.path.isdir(scripts_dir):
+    Usage(parser, "--chromeos_root must be set up first. Use setup_chromeos.py")
 
   if options.board is None:
     Usage(parser, "--board must be set")
@@ -104,10 +108,11 @@
     # browser but it doesn't. So do it here.
     misc.RemoveChromeBrowserObjectFiles(options.chromeos_root, options.board)
 
-  build_packages_env = misc.MergeEnvStringWithDict(build_packages_env,
-                                                   {"USE": "chrome_internal"})
-
-  options.chromeos_root = os.path.expanduser(options.chromeos_root)
+  # Build with afdo_use by default.
+  # To change the default use --env="USE=-afdo_use".
+  build_packages_env = misc.MergeEnvStringWithDict(
+    build_packages_env,
+    {"USE": "chrome_internal afdo_use"})
 
   build_packages_command = misc.GetBuildPackagesCommand(
     board=options.board, usepkg=options.vanilla_image, debug=options.debug)