From 2f9a82df4cb69909efa374c80d96f5777bffc6c3 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 17 Sep 2012 23:58:13 -0400 Subject: [PATCH] setup_board: add new --regen_configs option This lets people run setup_board w/out re-installing the toolchain, but otherwise setting up all the config files. This is useful when people want to make overlay changes that don't affect the settings but do affect file layout (like when moving from private to public overlays). BUG=chromium-os:34519 TEST=`cbuildbot {x86,amd64,arm}-generic-full chromiumos-sdk` worked Change-Id: I6202073a74700379fe2b705d1ff3d6148b9723ec Reviewed-on: https://gerrit.chromium.org/gerrit/33487 Reviewed-by: Brian Harring Commit-Ready: Mike Frysinger Tested-by: Mike Frysinger --- setup_board | 51 +++++++++++++++++++++++++++++++++------------------ 1 file changed, 33 insertions(+), 18 deletions(-) diff --git a/setup_board b/setup_board index 024947123e..f206aa11f1 100755 --- a/setup_board +++ b/setup_board @@ -55,6 +55,8 @@ 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)." # The --reuse_pkgs_from_local_boards flag tells Portage to share binary # packages between boards that are built locally, so that the total time @@ -229,8 +231,8 @@ install_toolchain_in_board() { else cmds=( "mkdir -p '${BOARD_ROOT}'{/usr,}/lib64 '${BOARD_ROOT}/usr/lib/debug'" - "ln -sf '${BOARD_ROOT}/usr/lib64' '${BOARD_ROOT}/usr/lib'" - "ln -sf '${BOARD_ROOT}/lib64' '${BOARD_ROOT}/lib'" + "ln -sfT '${BOARD_ROOT}/usr/lib64' '${BOARD_ROOT}/usr/lib'" + "ln -sfT '${BOARD_ROOT}/lib64' '${BOARD_ROOT}/lib'" ) sudo_multi "${cmds[@]}" LIBC_PATH="${PKGDIR}/sys-libs/${LIBC_TAR}" @@ -437,14 +439,14 @@ BOARD_OVERLAY_LIST=$(cros_overlay_list \ eval $(portageq envvar -v CHOST PKGDIR) -if [ -d "${BOARD_ROOT}" ] ; then +if [ -d "${BOARD_ROOT}" ]; then if [[ ${FLAGS_force} -eq ${FLAGS_TRUE} ]]; then echo "--force set. Re-creating ${BOARD_ROOT}..." # Removal takes long. Make it asynchronous. TEMP_DIR=`mktemp -d` sudo mv "${BOARD_ROOT}" "${TEMP_DIR}" sudo rm -rf "${TEMP_DIR}" & - else + elif [[ ${FLAGS_regen_configs} -eq ${FLAGS_FALSE} ]]; then if ! ${HOST_BOARD}; then { print_board_make_conf; print_board_binhost_config; } | \ sudo_clobber $BOARD_ETC/make.conf.board @@ -461,6 +463,9 @@ if [ -d "${BOARD_ROOT}" ] ; then fi exit 0 fi +else + # Regenerating configs w/out a board root doesn't make sense. + FLAGS_regen_configs=${FLAGS_FALSE} fi cmds=( @@ -481,8 +486,8 @@ if ${HOST_BOARD}; then # Setting up symlinks for bootstrapping multilib. # See http://crosbug.com/14498 "mkdir -p '${BOARD_ROOT}'{/usr,}/lib64" - "ln -sf lib64 '${BOARD_ROOT}/lib'" - "ln -sf lib64 '${BOARD_ROOT}/usr/lib'" + "ln -sfT lib64 '${BOARD_ROOT}/lib'" + "ln -sfT lib64 '${BOARD_ROOT}/usr/lib'" # Copying some files for bootstrapping empty chroot. # See http://crosbug.com/14499 @@ -513,7 +518,9 @@ if ! ${HOST_BOARD}; then # We install the toolchain related bits after the BOARD_ROOT, BOARD_PROFILE # and BOARD_ETC directories have been created. - install_toolchain_in_board + if [[ ${FLAGS_regen_configs} -eq ${FLAGS_FALSE} ]]; then + install_toolchain_in_board + fi fi # Setup make.globals and the profile. cmds=( @@ -597,18 +604,26 @@ else # config to make.conf.board. print_board_binhost_config | sudo_append $BOARD_ETC/make.conf.board - # Emerge the kernel headers into the board build root. Use rdeps to - # avoid pulling any spurious DEPEND things in that we don't care about. - KERNEL_EMERGE_FLAGS="--select --quiet --root-deps=rdeps" - if [[ "${FLAGS_usepkg}" -eq "${FLAGS_TRUE}" || - "${FLAGS_reuse_pkgs_from_local_boards}" -eq "${FLAGS_TRUE}" ]]; then - KERNEL_EMERGE_FLAGS+=" --getbinpkg --usepkg" + if [[ ${FLAGS_regen_configs} -eq ${FLAGS_FALSE} ]]; then + # Emerge the kernel headers into the board build root. Use rdeps to + # avoid pulling any spurious DEPEND things in that we don't care about. + KERNEL_EMERGE_FLAGS="--select --quiet --root-deps=rdeps" + if [[ "${FLAGS_usepkg}" -eq "${FLAGS_TRUE}" || + "${FLAGS_reuse_pkgs_from_local_boards}" -eq "${FLAGS_TRUE}" ]]; then + KERNEL_EMERGE_FLAGS+=" --getbinpkg --usepkg" + fi + + sudo -E "${EMERGE_WRAPPER}" ${KERNEL_EMERGE_FLAGS} \ + sys-kernel/linux-headers + + unset KERNEL_EMERGE_FLAGS + else + # Since we clobbered this file earlier, make sure the libc version + # is set correctly otherwise future upgrades will wrongly trigger. + sudo_append "${BOARD_SETUP}" <