#!/bin/bash # Copyright (c) 2012 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. . "$(dirname "$0")/common.sh" || exit 1 . "${BUILD_LIBRARY_DIR}/toolchain_util.sh" || exit 1 # Script must run inside the chroot assert_inside_chroot assert_not_root_user # Developer-visible flags. DEFINE_string board "${DEFAULT_BOARD}" \ "The name of the board to set up." DEFINE_boolean default "${FLAGS_FALSE}" \ "Set board to the default board in your chroot" DEFINE_boolean force "${FLAGS_FALSE}" \ "Force re-creating board root." DEFINE_boolean usepkg "${FLAGS_TRUE}" \ "Use binary packages when possible." DEFINE_boolean usepkgonly "${FLAGS_FALSE}" \ "Only use/download binary packages." DEFINE_boolean getbinpkg "${FLAGS_TRUE}" \ "Download binary packages from remote repository." DEFINE_string getbinpkgver "" \ "Use binary packages from a specific version." DEFINE_string pkgdir "" \ "Use binary packages from a custom directory instead of /build/[ARCH]/var/lib/portage/pkgs/." DEFINE_string binhost "" \ "Use binary packages from a specific location instead of $FLATCAR_DEV_BUILDS/... " DEFINE_boolean toolchainpkgonly "${FLAGS_FALSE}" \ "Use binary packages only for the board toolchain." DEFINE_boolean skip_toolchain_update "${FLAGS_FALSE}" \ "Don't update toolchain automatically." DEFINE_boolean skip_chroot_upgrade "${FLAGS_FALSE}" \ "Don't run the chroot upgrade automatically; use with care." DEFINE_boolean regen_configs "${FLAGS_FALSE}" \ "Regenerate all config files (useful for modifying profiles w/out rebuild)." DEFINE_boolean regen_configs_only "${FLAGS_FALSE}" \ "Regenerate all config files and nothing else, even if nothing else is installed." FLAGS_HELP="usage: $(basename $0) [flags] setup_board sets up the sysroot for a particular board. This script is called automatically when you run build_packages, so there is typically no need to call it directly, unless you want to blow away your board (using --force). " show_help_if_requested "$@" # The following options are advanced options, only available to those willing # to read the source code. They are not shown in help output, since they are # not needed for the typical developer workflow. DEFINE_string libc_version "[stable]" \ "Version of libc to use." DEFINE_boolean quiet $FLAGS_FALSE \ "Don't print warnings when board already exists." DEFINE_string variant "" \ "Board variant." # builds wrappers like equery-arm-generic. # args: # $1: command to wrap # rest: extra arguments to pass to the command _generate_wrapper() { local command="${1}" shift local extra_args="$@" local target="/usr/local/bin/${command}-${BOARD_VARIANT}" sudo_clobber "${target}" < "$GCLIENT_ROOT/src/scripts/.default_board" fi command_completed info "The SYSROOT is: ${BOARD_ROOT}" # NOTE: Printing the working-on ebuilds does not only serve the informative # purpose. It also causes the ${BOARD_ROOT}/etc/portage/package.* files to be # regenerated. WORKING_ON=$("${SRC_ROOT}/scripts/cros_workon" --board=${FLAGS_board} list) if [ -n "${WORKING_ON}" ]; then info info "Currently working on the following ebuilds for this board:" info "${WORKING_ON}" fi