diff --git a/build_image.sh b/build_image.sh index 4790becad6..e121673ac9 100755 --- a/build_image.sh +++ b/build_image.sh @@ -20,8 +20,6 @@ # Script must be run inside the chroot assert_inside_chroot -KERNEL_VERSION=${KERNEL_VERSION:-"2.6.30-chromeos-intel-menlow"} - DEFAULT_PKGLIST="${SRC_ROOT}/package_repo/package-list-prod.txt" # Flags @@ -47,6 +45,10 @@ DEFINE_string suite2 "$DEFAULT_EXT_SUITE" "Suite to use in additional mirror." DEFINE_string pkglist2 "" \ "Name of file listing packages to install from additional mirror." +KERNEL_DEB_PATH=$(find "${FLAGS_build_root}/x86/local_packages" -name "linux-image-*.deb") +KERNEL_DEB=$(basename "${KERNEL_DEB_PATH}" .deb | sed -e 's/linux-image-//' -e 's/_.*//') +KERNEL_VERSION=${KERNEL_VERSION:-${KERNEL_DEB}} + # Parse command line FLAGS "$@" || exit 1 eval set -- "${FLAGS_ARGV}" diff --git a/build_kernel.sh b/build_kernel.sh index 7e08be34ff..7a861de62c 100755 --- a/build_kernel.sh +++ b/build_kernel.sh @@ -18,11 +18,12 @@ SRC_ROOT=$(dirname $(readlink -f $(dirname "$0"))) . "${SRC_ROOT}/third_party/shflags/files/src/shflags" -KERNEL_VERSION=${KERNEL_VERSION:-"2.6.30-chromeos-intel-menlow"} +KERNEL_DIR="$SRC_ROOT/third_party/kernel" +KCONFIG="${KERNEL_DIR}/files/chromeos/config/chromeos-intel-menlow" # Flags DEFAULT_BUILD_ROOT=${BUILD_ROOT:-"${SRC_ROOT}/build"} -DEFINE_string config "config.${KERNEL_VERSION}" \ +DEFINE_string config "${KCONFIG}" \ "The kernel configuration file to use. See src/platform/kernel/config/*" DEFINE_integer revision 002 \ "The package revision to use" @@ -39,9 +40,6 @@ eval set -- "${FLAGS_ARGV}" # Die on any errors. set -e -KERNEL_DIR="$SRC_ROOT/third_party/kernel" -KCONFIG="${KERNEL_DIR}/config/${FLAGS_config}" - # 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" @@ -80,9 +78,15 @@ FULLVERSION=$(sed -e '/version/ !d' -e 's/^[^0-9]*//' $KCONFIG) # example MAJOR is 2, MINOR is 6, EXTRA is 30, RELEASE is rc1, LOCAL is # asus-eeepc. RC is optional since it only shows up for release candidates. MAJOR=$(echo $FULLVERSION | sed -e 's/[^0-9].*//') -MINOR=$(echo $FULLVERSION | sed -e 's/[0-9].//' -e 's/[^0-9].*//') -EXTRA=$(echo $FULLVERSION | sed -e 's/[0-9].//' -e 's/[0-9].//' -e 's/[^0-9].*//') -VER_MME="${MAJOR}.${MINOR}.${EXTRA}" +MIDDLE=$(echo $FULLVERSION | sed -e 's/[0-9].//' -e 's/[^0-9].*//') +MINOR=$(echo $FULLVERSION | sed -e 's/[0-9].//' -e 's/[0-9].//' -e 's/[^0-9].*//') +EXTRA=$(echo $FULLVERSION | sed -e 's/[0-9].//' -e 's/[0-9].//' -e 's/[0-9]*.//' -e 's/[^0-9].*//') +if [ ! -z $EXTRA ]; then + VER_MME="${MAJOR}.${MIDDLE}.${MINOR}.${EXTRA}" +else + VER_MME="${MAJOR}.${MIDDLE}.${MINOR}" +fi + LOCAL=$(sed -e '/CONFIG_LOCALVERSION=/ !d' -e 's/.*="-//' -e 's/"//' $KCONFIG) RC=$(echo $FULLVERSION | sed -r \ "s/${VER_MME}-([^-]*)-*${LOCAL}/\1/") @@ -168,6 +172,7 @@ MAKEFLAGS="CONCURRENCY_LEVEL=$CONCURRENCY_LEVEL" \ # make-kpkg dumps the newly created package in the parent directory if [ -e "../${PACKAGE}" ] then + rm "${FLAGS_output_root}"/linux-image-*.deb mv "../${PACKAGE}" "${FLAGS_output_root}" echo "Kernel build successful, check ${FLAGS_output_root}/${PACKAGE}" else