mirror of
https://github.com/flatcar/scripts.git
synced 2025-11-28 22:12:10 +01:00
fix(setup_board): Remove unused support for special amd64-host boards.
This was some scheme for building packages using the SDK profile instead of the normal target board profiles. We use catalyst instead so remove this dead code. Ordering cleaned up slightly as well.
This commit is contained in:
parent
505ef86bbd
commit
456af72625
144
setup_board
144
setup_board
@ -202,13 +202,8 @@ ARCH=$(get_board_arch "${BOARD}") || exit 1
|
|||||||
|
|
||||||
case "$BOARD" in
|
case "$BOARD" in
|
||||||
*-host)
|
*-host)
|
||||||
if [[ $FLAGS_usepkg -eq $FLAGS_TRUE ]]; then
|
die_notrace "host boards not supported by setup_board"
|
||||||
die_notrace "host boards only support --nousepkg"
|
|
||||||
fi
|
|
||||||
HOST_BOARD=true
|
|
||||||
;;
|
;;
|
||||||
*)
|
|
||||||
HOST_BOARD=false
|
|
||||||
esac
|
esac
|
||||||
# Locations we will need
|
# Locations we will need
|
||||||
BOARD_ROOT="/build/${BOARD_VARIANT}"
|
BOARD_ROOT="/build/${BOARD_VARIANT}"
|
||||||
@ -253,36 +248,24 @@ fi
|
|||||||
|
|
||||||
cmds=(
|
cmds=(
|
||||||
"mkdir -p '${BOARD_ROOT}' '${BOARD_ETC}' '${BOARD_PROFILE}' /usr/local/bin"
|
"mkdir -p '${BOARD_ROOT}' '${BOARD_ETC}' '${BOARD_PROFILE}' /usr/local/bin"
|
||||||
|
"mkdir -p '${BOARD_ETC}/portage/hooks'"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Setup the make.confs. We use the following:
|
# Setup the make.confs. We use the following:
|
||||||
# make.conf <- Overall target make.conf [arm, x86, etc. version]
|
# make.conf <- Overall target make.conf [arm, x86, etc. version]
|
||||||
# make.conf.board_setup <- Declares CHOST, ROOT, etc.
|
# make.conf.board_setup <- Declares CHOST, ROOT, etc.
|
||||||
# make.conf.common <- Common settings across all targets
|
# make.conf.common <- Common settings across all targets
|
||||||
# make.conf.board <- Optional board-supplied make.conf
|
|
||||||
if ${HOST_BOARD}; then
|
|
||||||
cmds+=(
|
|
||||||
"ln -sf '${CHROMIUMOS_CONFIG}/make.conf.${BOARD}' \
|
|
||||||
'${BOARD_ETC}/make.conf'"
|
|
||||||
"cp -f '/etc/portage/make.conf.host_setup' '${BOARD_ETC}/'"
|
|
||||||
|
|
||||||
# Setting up symlinks for bootstrapping multilib.
|
|
||||||
# See http://crosbug.com/14498
|
|
||||||
"mkdir -p '${BOARD_ROOT}'{/usr,}/lib64"
|
|
||||||
"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
|
|
||||||
"mkdir -p '${BOARD_ETC}'/{init.d,xml}"
|
|
||||||
"cp /etc/xml/catalog '${BOARD_ETC}'/xml/"
|
|
||||||
"cp /etc/init.d/functions.sh '${BOARD_ETC}'/init.d/"
|
|
||||||
)
|
|
||||||
fi
|
|
||||||
cmds+=(
|
cmds+=(
|
||||||
|
"ln -sf '${CHROMIUMOS_CONFIG}/make.conf.${ARCH}-target' \
|
||||||
|
'${BOARD_ETC}/make.conf'"
|
||||||
"ln -sf '${CHROMIUMOS_CONFIG}/make.conf.common-target' \
|
"ln -sf '${CHROMIUMOS_CONFIG}/make.conf.common-target' \
|
||||||
'${BOARD_ETC}/make.conf.common'"
|
'${BOARD_ETC}/make.conf.common'"
|
||||||
|
"touch /etc/portage/make.conf.user"
|
||||||
|
"ln -sf /etc/portage/make.conf.user '${BOARD_ROOT}/etc/make.conf.user'"
|
||||||
)
|
)
|
||||||
|
for d in "${SCRIPTS_DIR}"/hooks/*; do
|
||||||
|
cmds+=( "ln -sfT '${d}' '${BOARD_ROOT}/etc/portage/hooks/${d##*/}'" )
|
||||||
|
done
|
||||||
sudo_multi "${cmds[@]}"
|
sudo_multi "${cmds[@]}"
|
||||||
|
|
||||||
SAVED_VERSION=
|
SAVED_VERSION=
|
||||||
@ -307,21 +290,6 @@ ${SAVED_VERSION}
|
|||||||
${ACCEPT_LICENSE}
|
${ACCEPT_LICENSE}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
if ! ${HOST_BOARD}; then
|
|
||||||
sudo ln -sf "${CHROMIUMOS_CONFIG}/make.conf.${ARCH}-target" \
|
|
||||||
"${BOARD_ETC}/make.conf"
|
|
||||||
fi
|
|
||||||
# Setup make.globals and the profile.
|
|
||||||
cmds=(
|
|
||||||
"touch /etc/portage/make.conf.user"
|
|
||||||
"ln -sf /etc/portage/make.conf.user '${BOARD_ROOT}/etc/make.conf.user'"
|
|
||||||
"mkdir -p '${BOARD_ROOT}/etc/portage/hooks'"
|
|
||||||
)
|
|
||||||
for d in "${SCRIPTS_DIR}"/hooks/*; do
|
|
||||||
cmds+=( "ln -sfT '${d}' '${BOARD_ROOT}/etc/portage/hooks/${d##*/}'" )
|
|
||||||
done
|
|
||||||
sudo_multi "${cmds[@]}"
|
|
||||||
|
|
||||||
# Select the profile to build based on the board and profile passed to
|
# Select the profile to build based on the board and profile passed to
|
||||||
# setup_board. The developer can later change profiles by running
|
# setup_board. The developer can later change profiles by running
|
||||||
# cros_choose_profile manually.
|
# cros_choose_profile manually.
|
||||||
@ -337,85 +305,29 @@ fi
|
|||||||
|
|
||||||
generate_all_wrappers
|
generate_all_wrappers
|
||||||
|
|
||||||
if ${HOST_BOARD}; then
|
if [[ ${FLAGS_regen_configs} -eq ${FLAGS_FALSE} ]]; then
|
||||||
EMERGE_CMD="emerge"
|
# First thing first, install baselayout with USE=build to create a
|
||||||
if [[ $FLAGS_fast -eq $FLAGS_TRUE ]]; then
|
# working directory tree. Don't use binpkgs due to the use flag change.
|
||||||
EMERGE_CMD="${GCLIENT_ROOT}/chromite/bin/parallel_emerge"
|
sudo -E USE=build "${EMERGE_WRAPPER}" --usepkg=n --buildpkg=n \
|
||||||
fi
|
--oneshot --quiet --nodeps sys-apps/baselayout
|
||||||
PACKAGES="system coreos-devel/sdk-depends world"
|
|
||||||
|
|
||||||
# First, rebuild all packages from scratch. This is needed to make sure
|
# Now time for tool chain happy fun time
|
||||||
# we rebuild all chroot packages.
|
install_toolchain
|
||||||
sudo -E $EMERGE_CMD --emptytree --with-bdeps=y $PACKAGES
|
|
||||||
sudo eclean -d packages
|
|
||||||
|
|
||||||
# Next, install our rebuilt packages into our separate root.
|
# Emerge the kernel headers into the board build root. Use rdeps to
|
||||||
HOST_FLAGS="--root=$BOARD_ROOT --update --verbose --deep --root-deps"
|
# avoid pulling any spurious DEPEND things in that we don't care about.
|
||||||
HOST_FLAGS+=" --with-bdeps=y --newuse --jobs=$NUM_JOBS --usepkgonly"
|
KERNEL_EMERGE_FLAGS="--select --quiet --root-deps=rdeps"
|
||||||
sudo -E $EMERGE_CMD $HOST_FLAGS --select=y $PACKAGES
|
if [[ "${FLAGS_usepkg}" -eq "${FLAGS_TRUE}" ]]; then
|
||||||
sudo cp -a "${PKGDIR}" $BOARD_ROOT/packages
|
KERNEL_EMERGE_FLAGS+=" --usepkg"
|
||||||
|
if [[ "${FLAGS_getbinpkg}" -eq "${FLAGS_TRUE}" ]]; then
|
||||||
# Install cross-compilers.
|
KERNEL_EMERGE_FLAGS+=" --getbinpkg "
|
||||||
COMPILERS=$(equery l cross-*/* --format='=$cpv')
|
|
||||||
sudo -E $EMERGE_CMD $HOST_FLAGS --select=n $COMPILERS
|
|
||||||
|
|
||||||
# Setup needed symlinks for cross-compilers.
|
|
||||||
sudo mkdir -p $BOARD_ROOT/usr/local/portage
|
|
||||||
sudo cp -a ${CROSSDEV_OVERLAY} $BOARD_ROOT/usr/local/portage
|
|
||||||
|
|
||||||
# Setup crossdev configuration for categories.
|
|
||||||
sudo cp -a /etc/portage/* $BOARD_ROOT/etc/portage
|
|
||||||
|
|
||||||
# The new chroot should have gcc for each target. Make sure that
|
|
||||||
# the latest one is correctly selected. Ignore cat errors as not
|
|
||||||
# all overlays will have a toolchain.conf.
|
|
||||||
ALL_TARGETS=$(cros_setup_toolchains --show-board-cfg=sdk)
|
|
||||||
for target in ${ALL_TARGETS//,/ }; do
|
|
||||||
libc=$(eval $(crossdev --show-target-cfg "${target}"); echo ${libc_pn})
|
|
||||||
if [[ ${libc} == "glibc" ]] ; then
|
|
||||||
# Install needed glibc tarball.
|
|
||||||
cross_target_path=/var/lib/portage/pkgs/cross-${target}
|
|
||||||
if [[ -e "$cross_target_path" ]] ; then
|
|
||||||
sudo mkdir -p ${BOARD_ROOT}${cross_target_path}
|
|
||||||
sudo cp -a ${cross_target_path}/glibc-* \
|
|
||||||
${BOARD_ROOT}${cross_target_path}
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
CURRENT_GCC="$(gcc-config -c ${target})"
|
|
||||||
sudo ROOT=${BOARD_ROOT} gcc-config ${CURRENT_GCC}
|
|
||||||
CURRENT_BINUTILS="$(binutils-config -c ${target})"
|
|
||||||
sudo ROOT=${BOARD_ROOT} binutils-config ${CURRENT_BINUTILS}
|
|
||||||
done
|
|
||||||
|
|
||||||
# Now cleanup paths referencing the ROOT from the *.la files.
|
|
||||||
sudo find $BOARD_ROOT -type f -name '*.la' | xargs sudo \
|
|
||||||
sed -i -e "s|$BOARD_ROOT/|/|g"
|
|
||||||
else
|
|
||||||
if [[ ${FLAGS_regen_configs} -eq ${FLAGS_FALSE} ]]; then
|
|
||||||
# First thing first, install baselayout with USE=build to create a
|
|
||||||
# working directory tree. Don't use binpkgs due to the use flag change.
|
|
||||||
sudo -E USE=build "${EMERGE_WRAPPER}" --usepkg=n --buildpkg=n \
|
|
||||||
--oneshot --quiet --nodeps sys-apps/baselayout
|
|
||||||
|
|
||||||
# Now time for tool chain happy fun time
|
|
||||||
install_toolchain
|
|
||||||
|
|
||||||
# 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}" ]]; then
|
|
||||||
KERNEL_EMERGE_FLAGS+=" --usepkg"
|
|
||||||
if [[ "${FLAGS_getbinpkg}" -eq "${FLAGS_TRUE}" ]]; then
|
|
||||||
KERNEL_EMERGE_FLAGS+=" --getbinpkg "
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
sudo -E "${EMERGE_WRAPPER}" ${KERNEL_EMERGE_FLAGS} \
|
|
||||||
sys-kernel/linux-headers
|
|
||||||
|
|
||||||
unset KERNEL_EMERGE_FLAGS
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
sudo -E "${EMERGE_WRAPPER}" ${KERNEL_EMERGE_FLAGS} \
|
||||||
|
sys-kernel/linux-headers
|
||||||
|
|
||||||
|
unset KERNEL_EMERGE_FLAGS
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $FLAGS_default -eq $FLAGS_TRUE ] ; then
|
if [ $FLAGS_default -eq $FLAGS_TRUE ] ; then
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user