#!/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 . "${SRC_ROOT}/platform/dev/toolchain_utils.sh" # Script must run inside the chroot restart_in_chroot_if_needed "$@" 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 to bootstrap." DEFINE_boolean getbinpkg $FLAGS_TRUE \ "Download binary packages from remote repository." 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 accept_licenses "" \ "Licenses to append to the accept list." DEFINE_string board_overlay "" \ "Location of the board overlay." DEFINE_boolean fast ${DEFAULT_FAST} "Call many emerges in parallel" DEFINE_integer jobs -1 \ "How many packages to build in parallel at maximum." DEFINE_boolean latest_toolchain $FLAGS_FALSE \ "Use the latest ebuild for all toolchain packages (gcc, binutils, libc, \ kernel). This overrides the other toolchain version options." DEFINE_string libc_version "[stable]" \ "Version of libc to use." DEFINE_string profile "" \ "The portage configuration profile to use. Profile must be located in overlay-board/profiles" DEFINE_boolean quiet $FLAGS_FALSE \ "Don't print warnings when board already exists." 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_string toolchain "" \ "Toolchain. For example: i686-pc-linux-gnu, armv7a-softfloat-linux-gnueabi" DEFINE_string variant "" \ "Board variant." DEFINE_boolean regen_configs ${FLAGS_FALSE} \ "Regenerate all config files (useful for modifying profiles w/out rebuild)." # 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 echo "Done!" echo "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=$(cros_workon --board=${FLAGS_board} list) if [ -n "${WORKING_ON}" ]; then echo echo "Currently working on the following ebuilds for this board:" echo "${WORKING_ON}" fi