| OLD | NEW |
| (Empty) |
| 1 #!/bin/sh | |
| 2 | |
| 3 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | |
| 4 # Use of this source code is governed by a BSD-style license that can be | |
| 5 # found in the LICENSE file. | |
| 6 | |
| 7 # This script will launch the kernel build script from outside a chroot | |
| 8 # environment and copy the kernel package into the chromeos source repository's | |
| 9 # src/platform/kernel directory. | |
| 10 | |
| 11 set -e | |
| 12 | |
| 13 SRC_ROOT=${SRC_ROOT:-$(cd "$(dirname $0)/.." ; pwd)} | |
| 14 KERNEL_DATA="${SRC_ROOT}/third_party/kernel" # version-controlled kernel stuff | |
| 15 BUILD_SCRIPT="build_kernel.sh" | |
| 16 | |
| 17 KCONFIG="$1" # kernel config file | |
| 18 PKGREVISION="$2" # version number to stamp on the package | |
| 19 ROOTFS="$3" # development environment (fakeroot) | |
| 20 | |
| 21 if [ $# -lt 3 ] | |
| 22 then | |
| 23 echo "usage: $0 <kernel_config> <package_revision> <rootfs> <patch>" | |
| 24 echo "kernel_config: Kernel config from ${KERNEL_DATA}/config/." | |
| 25 echo "package_revision: The revision to stamp on the final .deb package." | |
| 26 echo "rootfs: Root directory of build environment" | |
| 27 echo "remaining arguments are assumed to be kernel patch names" | |
| 28 echo -n "Usage example: sh build_kernel.sh config.2.6.30-rc8-chromeos-intel-
" | |
| 29 echo "menlow 001 ~/src/chromeos/devenv" | |
| 30 echo "" | |
| 31 exit 1 | |
| 32 fi | |
| 33 | |
| 34 # Use remaining arguments as patch names. | |
| 35 shift; shift; shift | |
| 36 PATCHES="$*" | |
| 37 | |
| 38 if [ ! -d "$ROOTFS" ] | |
| 39 then | |
| 40 echo "$ROOTFS is not a directory" | |
| 41 exit 1 | |
| 42 fi | |
| 43 | |
| 44 # Create a tmpfs to store output from build script which this script can copy | |
| 45 # the output from later on. We won't know the actual filename of the output | |
| 46 # but since this is a new namespace we're using it should be safe to use a use | |
| 47 # a wildcard (e.g. linux-image*.deb) without copying the wrong .debs. | |
| 48 OUTPUT_DIR="${ROOTFS}/tmp" | |
| 49 sudo mkdir -p "$OUTPUT_DIR" | |
| 50 sudo mount -t tmpfs size=32M "${OUTPUT_DIR}" | |
| 51 do_cleanup() { | |
| 52 sudo umount "${OUTPUT_DIR}" | |
| 53 } | |
| 54 trap do_cleanup EXIT | |
| 55 | |
| 56 # Copy kernel build helper script to chroot environment | |
| 57 sudo cp "${SRC_ROOT}/scripts/${BUILD_SCRIPT}" "${ROOTFS}/tmp/" | |
| 58 | |
| 59 # Run the build script. | |
| 60 sudo chroot "$ROOTFS" "/tmp/${BUILD_SCRIPT}" "$KCONFIG" \ | |
| 61 "$PKGREVISION" "${OUTPUT_DIR#$ROOTFS}/" "$PATCHES" | |
| 62 | |
| 63 # Copy kernel package from the output directory into Chrome OS sources | |
| 64 # before the cleanup routine clobbers it. | |
| 65 echo "Copying kernel to "$KERNEL_DATA"" | |
| 66 cp -i "$OUTPUT_DIR"/linux-image*.deb "$KERNEL_DATA" | |
| 67 | |
| 68 set +e | |
| OLD | NEW |