mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-25 07:31:01 +02:00
Add support for building from a pre-patched kernel src tree (e.g. pulled
from git); to enable set KERNEL_VERSION in your environment to the directory name (e.g. 2.6.31-chromeos-intel-menlow) otherwise default to the existing kernel build mechanism Review URL: http://chromereview.prom.corp.google.com/1180034 git-svn-id: svn://chrome-svn/chromeos/trunk@142 06c00378-0e64-4dae-be16-12b19f9950a1
This commit is contained in:
parent
6f2c33649e
commit
e448ba3021
@ -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 <<EOF > $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"
|
||||
|
@ -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}"
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user