diff --git a/build_image.sh b/build_image.sh index 06005372db..a554f50a07 100755 --- a/build_image.sh +++ b/build_image.sh @@ -20,6 +20,8 @@ # 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 @@ -208,6 +210,7 @@ CUST_OPTS="${SETUP_DIR}/customize_opts.sh" cat < $CUST_OPTS SETUP_DIR="$ROOTFS_SETUP_DIR" USE_UBUNTU_KERNEL="$USE_UBUNTU_KERNEL" +KERNEL_VERSION="$KERNEL_VERSION" SERVER="$MIRROR_INSIDE" SUITE="$FLAGS_suite" SERVER2="$MIRROR2_INSIDE" diff --git a/build_kernel.sh b/build_kernel.sh index 54cefd1263..a85e35e577 100755 --- a/build_kernel.sh +++ b/build_kernel.sh @@ -18,9 +18,11 @@ 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"} + # Flags DEFAULT_BUILD_ROOT=${BUILD_ROOT:-"${SRC_ROOT}/build"} -DEFINE_string config "config.2.6.30-chromeos-intel-menlow" \ +DEFINE_string config "config.${KERNEL_VERSION}" \ "The kernel configuration file to use. See src/platform/kernel/config/*" DEFINE_integer revision 002 \ "The package revision to use" @@ -99,38 +101,44 @@ mkdir -p "$SRCDIR" cd "$SRCDIR" # Get kernel sources and patches. +if [ -d ${KERNEL_DIR}/linux-${VER_MME} ]; then +# TODO(msb): uncomment once git is available in the chroot +# git clone "${KERNEL_DIR}"/linux_${VER_MME} + cp -a "${KERNEL_DIR}"/linux-${VER_MME} . +else + # old way... # TODO: find a better source for the kernel source. Old versions of karmic # aren't hosted on archive.ubuntu.com #apt-get source linux-source-$MAJOR.$MINOR.$EXTRA -# TODO(msb): uncomment once git is available in the chroot -# git clone "${KERNEL_DIR}"/files linux_${VER_MME} # Name directory to what the patches expect -mkdir linux-${VER_MME} -cp -a "${KERNEL_DIR}"/files/* linux-${VER_MME} + mkdir linux-${VER_MME} + cp -a "${KERNEL_DIR}"/files/* linux-${VER_MME} -if [ ! -z $PATCHES ] -then - # TODO: Get rid of sudo if possible. Maybe the non-chromeos kernel patches - # will be infrequent enough that we can make them part of the chroot env? - sudo apt-get install $PATCHES + if [ ! -z $PATCHES ] + then + # TODO: Get rid of sudo if possible. Maybe the non-chromeos kernel + # patches will be infrequent enough that we can make them part of + # the chroot env? + sudo apt-get install $PATCHES + fi + + # Apply chromeos patches + CHROMEOS_PATCHES=`ls "$KERNEL_DIR"/patches/*.patch` + for i in ${CHROMEOS_PATCHES} + do + patch -d "linux-$VER_MME" -p1 < "$i" + done + + # TODO: Remove a config option which references a non-existent directory in + # ubuntu kernel sources. + sed -i '/gfs/ d' linux-$VER_MME/ubuntu/Makefile fi -# Apply chromeos patches -CHROMEOS_PATCHES=`ls "$KERNEL_DIR"/patches/*.patch` -for i in ${CHROMEOS_PATCHES} -do - patch -d "linux-$VER_MME" -p1 < "$i" -done - # Move kernel config to kernel source tree and rename to .config so that # it can be used for "make oldconfig" by make-kpkg. cp "$KCONFIG" "linux-${VER_MME}/.config" cd "linux-$VER_MME" -# TODO: Remove a config option which references a non-existent directory in -# ubuntu kernel sources. -sed -i '/gfs/ d' ubuntu/Makefile - # Remove stale packages. make-kpkg will dump the package in the parent # directory. From there, it will be moved to the output directory. rm -f "../${PACKAGE}" diff --git a/customize_rootfs.sh b/customize_rootfs.sh index df20506e8e..1d7e926558 100755 --- a/customize_rootfs.sh +++ b/customize_rootfs.sh @@ -109,12 +109,7 @@ do_initrd = yes warn_initrd = no EOF -if [ $USE_UBUNTU_KERNEL -eq 1 ] -then - KERNEL_VERSION="2.6.30-9-generic" -else - KERNEL_VERSION="2.6.30-chromeos-intel-menlow" -fi +# NB: KERNEL_VERSION comes from customize_opts.sh apt-get --yes --force-yes install "linux-image-${KERNEL_VERSION}" # Create custom initramfs