OLD | NEW |
1 #! /bin/sh | 1 #! /bin/sh |
2 | 2 |
3 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 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 | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 # This script contains the set of commands to build a kernel package. | 7 # This script contains the set of commands to build a kernel package. |
8 # | 8 # |
9 # If successful, a new linux-image-*.deb file will appear in the specified | 9 # If successful, a new linux-image-*.deb file will appear in the specified |
10 # output directory. | 10 # output directory. |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 rm -f "../${PACKAGE}" | 119 rm -f "../${PACKAGE}" |
120 rm -f "${FLAGS_output_root}"/linux-image-*.deb | 120 rm -f "${FLAGS_output_root}"/linux-image-*.deb |
121 | 121 |
122 # Speed up compilation by running parallel jobs. | 122 # Speed up compilation by running parallel jobs. |
123 if [ ! -e "/proc/cpuinfo" ] | 123 if [ ! -e "/proc/cpuinfo" ] |
124 then | 124 then |
125 # default to a reasonable level | 125 # default to a reasonable level |
126 CONCURRENCY_LEVEL=2 | 126 CONCURRENCY_LEVEL=2 |
127 else | 127 else |
128 # speed up compilation by running #cpus * 2 simultaneous jobs | 128 # speed up compilation by running #cpus * 2 simultaneous jobs |
129 CONCURRENCY_LEVEL=$(($(cat /proc/cpuinfo | grep "processor" | wc -l) * 2)) | 129 CONCURRENCY_LEVEL=$(($(grep -c "^processor" /proc/cpuinfo) * 2)) |
130 fi | 130 fi |
131 | 131 |
132 # Build the kernel and make package. "setarch" is used so that scripts which | 132 # Build the kernel and make package. "setarch" is used so that scripts which |
133 # detect architecture (like the "oldconfig" rule in kernel Makefile) don't get | 133 # detect architecture (like the "oldconfig" rule in kernel Makefile) don't get |
134 # confused when cross-compiling. | 134 # confused when cross-compiling. |
135 make-kpkg clean | 135 make-kpkg clean |
136 MAKEFLAGS="CONCURRENCY_LEVEL=$CONCURRENCY_LEVEL" \ | 136 MAKEFLAGS="CONCURRENCY_LEVEL=$CONCURRENCY_LEVEL" \ |
137 setarch $ARCH make-kpkg \ | 137 setarch $ARCH make-kpkg \ |
138 --append-to-version="-$CHROMEOS_TAG" --revision="$FLAGS_revision" \ | 138 --append-to-version="-$CHROMEOS_TAG" --revision="$FLAGS_revision" \ |
139 --arch="$ARCH" \ | 139 --arch="$ARCH" \ |
140 --rootcmd fakeroot \ | 140 --rootcmd fakeroot \ |
141 --config oldconfig \ | 141 --config oldconfig \ |
142 --initrd --bzImage kernel_image | 142 --initrd --bzImage kernel_image |
143 | 143 |
144 # make-kpkg dumps the newly created package in the parent directory | 144 # make-kpkg dumps the newly created package in the parent directory |
145 if [ -e "../${PACKAGE}" ] | 145 if [ -e "../${PACKAGE}" ] |
146 then | 146 then |
147 mv "../${PACKAGE}" "${FLAGS_output_root}" | 147 mv "../${PACKAGE}" "${FLAGS_output_root}" |
148 echo "Kernel build successful, check ${FLAGS_output_root}/${PACKAGE}" | 148 echo "Kernel build successful, check ${FLAGS_output_root}/${PACKAGE}" |
149 else | 149 else |
150 echo "Kernel build failed" | 150 echo "Kernel build failed" |
151 exit 1 | 151 exit 1 |
152 fi | 152 fi |
OLD | NEW |