Use sysroot_lib to generate sysroot configuration.

When creating sysroots, use sysroot_lib to generate configuration. This
preserve the invariant that all sysroot have a valid standard
configuration file (etc/make.conf.board_setup) that other tools can use.

BUG=brillo:662
TEST=unittests
TEST=trybot run on daisy.

CQ-DEPEND=CL:262376

Change-Id: I41848c193321428ebc18a37f7709ce4479a554d9
Reviewed-on: https://chromium-review.googlesource.com/262485
Trybot-Ready: Bertrand Simonnet <bsimonnet@chromium.org>
Tested-by: Bertrand Simonnet <bsimonnet@chromium.org>
Reviewed-by: Steve Fung <stevefung@chromium.org>
Commit-Queue: Bertrand Simonnet <bsimonnet@chromium.org>
diff --git a/scripts/cros_generate_sysroot.py b/scripts/cros_generate_sysroot.py
index 662dfc1..bd48d7a 100644
--- a/scripts/cros_generate_sysroot.py
+++ b/scripts/cros_generate_sysroot.py
@@ -16,6 +16,7 @@
 from chromite.lib import commandline
 from chromite.lib import osutils
 from chromite.lib import sudo
+from chromite.lib import sysroot_lib
 
 DEFAULT_NAME = 'sysroot_%(package)s.tar.xz'
 PACKAGE_SEPARATOR = '/'
@@ -68,6 +69,9 @@
     cros_build_lib.SudoRunCommand(cmd, **kwargs)
 
   def _InstallToolchain(self):
+    # Create the sysroot's config.
+    config = sysroot_lib.GenerateBoardConfig(self.sysroot, self.options.board)
+    sysroot_lib.WriteSysrootConfig(self.sysroot, config)
     cros_build_lib.RunCommand(
         [os.path.join(constants.CROSUTILS_DIR, 'install_toolchain'),
          '--noconfigure', '--board_root', self.sysroot, '--board',