Revert "Changes to support ARM cross compilation."

This reverts commit e61c324991b41ad40e86f5c557a91622d2845b9d.

There are many places where '/x86' is hard-coded into directory paths. All
those places need to be modified before we can change it in just one place.

See http://code.google.com/p/chromium-os/issues/detail?id=1085

Review URL: http://codereview.chromium.org/501066
This commit is contained in:
Bill Richardson 2009-12-16 15:22:26 -08:00
parent 51ff488061
commit ff8b3d1338

View File

@ -21,23 +21,17 @@ SRC_ROOT=$(dirname $(readlink -f $(dirname "$0")))
KERNEL_DIR="$SRC_ROOT/third_party/kernel" KERNEL_DIR="$SRC_ROOT/third_party/kernel"
DEFAULT_KCONFIG="${KERNEL_DIR}/files/chromeos/config/chromeos-intel-menlow" DEFAULT_KCONFIG="${KERNEL_DIR}/files/chromeos/config/chromeos-intel-menlow"
CROSS_COMPILE_FLAG=""
VERBOSE_FLAG=""
# Flags # Flags
DEFAULT_BUILD_ROOT=${BUILD_ROOT:-"${SRC_ROOT}/build"} DEFAULT_BUILD_ROOT=${BUILD_ROOT:-"${SRC_ROOT}/build"}
DEFINE_string config "${DEFAULT_KCONFIG}" \ DEFINE_string config "${DEFAULT_KCONFIG}" \
"The kernel configuration file to use." "The kernel configuration file to use."
DEFINE_integer revision 002 \ DEFINE_integer revision 002 \
"The package revision to use" "The package revision to use"
DEFINE_string output_root "" \ DEFINE_string output_root "${DEFAULT_BUILD_ROOT}/x86/local_packages" \
"Directory in which to place the resulting .deb package" "Directory in which to place the resulting .deb package"
DEFINE_string build_root "$DEFAULT_BUILD_ROOT" \ DEFINE_string build_root "$DEFAULT_BUILD_ROOT" \
"Root of build output" "Root of build output"
DEFINE_string cross_compile "" \ FLAGS_HELP="Usage: $0 [flags]"
"Prefix for cross compile build tools"
DEFINE_boolean verbose $FLAGS_FALSE "Print debugging information in addtion to normal processing."
FLAGS_HELP="Usage: $0 [flags]"
# Parse command line # Parse command line
FLAGS "$@" || exit 1 FLAGS "$@" || exit 1
@ -46,6 +40,10 @@ eval set -- "${FLAGS_ARGV}"
# Die on any errors. # Die on any errors.
set -e set -e
# TODO: We detect the ARCH below. We can sed the FLAGS_output_root to replace
# an ARCH placeholder with the proper architecture rather than assuming x86.
mkdir -p "$FLAGS_output_root"
# Get kernel package configuration from repo. # Get kernel package configuration from repo.
# TODO: Find a workaround for needing sudo for this. Maybe create a symlink # TODO: Find a workaround for needing sudo for this. Maybe create a symlink
# to /tmp/kernel-pkg.conf when setting up the chroot env? # to /tmp/kernel-pkg.conf when setting up the chroot env?
@ -54,33 +52,23 @@ sudo cp "$KERNEL_DIR"/package/kernel-pkg.conf /etc/kernel-pkg.conf
# Parse kernel config file for target architecture information. This is needed # Parse kernel config file for target architecture information. This is needed
# to determine the full package name and also to setup the environment for # to determine the full package name and also to setup the environment for
# kernel build scripts which use "uname -m" to autodetect architecture. # kernel build scripts which use "uname -m" to autodetect architecture.
KCONFIG=`readlink -f "$FLAGS_config"` KCONFIG="$FLAGS_config"
if [ ! -f "$KCONFIG" ]; then if [ ! -f "$KCONFIG" ]; then
KCONFIG="$KERNEL_DIR"/files/chromeos/config/"$KCONFIG" KCONFIG="$KERNEL_DIR"/files/chromeos/config/"$KCONFIG"
fi fi
if [ $(grep 'CONFIG_X86=y' "$KCONFIG") ] if [ -n $(grep 'CONFIG_X86=y' "$KCONFIG") ]
then then
ARCH="i386" ARCH="i386"
elif [ $(grep 'CONFIG_X86_64=y' "$KCONFIG") ] elif [ -n $(grep 'CONFIG_X86_64=y' "$KCONFIG") ]
then then
ARCH="x86_64" ARCH="x86_64"
elif [ $(grep 'CONFIG_ARM=y' "$KCONFIG") ] elif [ -n $(grep 'CONFIG_ARM=y' "$KCONFIG") ]
then then
ARCH="armel" ARCH="arm"
KPKG_ARCH=arm
else else
exit 1 exit 1
fi fi
if [ ! $FLAGS_output_root ]
then
FLAGS_output_root="${DEFAULT_BUILD_ROOT}/${ARCH}/local_packages"
fi
# TODO: We detect the ARCH below. We can sed the FLAGS_output_root to replace
# an ARCH placeholder with the proper architecture rather than assuming x86.
mkdir -p "$FLAGS_output_root"
# Parse the config file for a line with "version" in it (in the header) # Parse the config file for a line with "version" in it (in the header)
# and remove any leading text before the major number of the kernel version # and remove any leading text before the major number of the kernel version
FULLVERSION=$(sed -e '/version/ !d' -e 's/^[^0-9]*//' $KCONFIG) FULLVERSION=$(sed -e '/version/ !d' -e 's/^[^0-9]*//' $KCONFIG)
@ -141,38 +129,12 @@ else
CONCURRENCY_LEVEL=$(($(cat /proc/cpuinfo | grep "processor" | wc -l) * 2)) CONCURRENCY_LEVEL=$(($(cat /proc/cpuinfo | grep "processor" | wc -l) * 2))
fi fi
# Setup the cross-compilation environment, if necessary, using the cross_compile
# Flag from the command line
if [ $FLAGS_cross_compile ]
then
CROSS_COMPILE_FLAG="--cross-compile $FLAGS_cross_compile"
fi
if [ $FLAGS_verbose -eq $FLAGS_TRUE ]
then
VERBOSE_FLAG="--verbose"
fi
# Build the kernel and make package. "setarch" is used so that scripts which # Build the kernel and make package. "setarch" is used so that scripts which
# detect architecture (like the "oldconfig" rule in kernel Makefile) don't get # detect architecture (like the "oldconfig" rule in kernel Makefile) don't get
# confused when cross-compiling. # confused when cross-compiling.
make-kpkg clean make-kpkg clean
# Setarch does not support arm, so if we are compiling for arm we need to
# make sure that uname -m will return the appropriate architeture.
if [ ! -n "$(setarch $ARCH ls)" ]
then
alias uname="echo $ARCH"
SETARCH=""
else
SETARCH="setarch $ARCH"
fi
MAKEFLAGS="CONCURRENCY_LEVEL=$CONCURRENCY_LEVEL" \ MAKEFLAGS="CONCURRENCY_LEVEL=$CONCURRENCY_LEVEL" \
$SETARCH \ setarch $ARCH make-kpkg \
make-kpkg \
$VERBOSE_FLAG \
$CROSS_COMPILE_FLAG \
--append-to-version="-$CHROMEOS_TAG" --revision="$FLAGS_revision" \ --append-to-version="-$CHROMEOS_TAG" --revision="$FLAGS_revision" \
--arch="$ARCH" \ --arch="$ARCH" \
--rootcmd fakeroot \ --rootcmd fakeroot \