OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
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 # Script to build a bootable keyfob-based chromeos system image from within | 7 # Script to build a bootable keyfob-based chromeos system image from within |
8 # a chromiumos setup. This assumes that all needed packages have been built into | 8 # a chromiumos setup. This assumes that all needed packages have been built into |
9 # the given target's root with binary packages turned on. This script will | 9 # the given target's root with binary packages turned on. This script will |
10 # build the Chrome OS image using only pre-built binary packages. | 10 # build the Chrome OS image using only pre-built binary packages. |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 "${PKGDIR}/${CHOST}/cross-${CHOST}"/glibc-${LIBC_VERSION}.tbz2 \ | 270 "${PKGDIR}/${CHOST}/cross-${CHOST}"/glibc-${LIBC_VERSION}.tbz2 \ |
271 -C "$ROOT_FS_DIR" --strip-components=3 \ | 271 -C "$ROOT_FS_DIR" --strip-components=3 \ |
272 --exclude=usr/include --exclude=sys-include --exclude=*.a --exclude=*.o | 272 --exclude=usr/include --exclude=sys-include --exclude=*.a --exclude=*.o |
273 | 273 |
274 # We need to install libstdc++ manually from the cross toolchain. | 274 # We need to install libstdc++ manually from the cross toolchain. |
275 # TODO: Figure out a better way of doing this? | 275 # TODO: Figure out a better way of doing this? |
276 sudo cp -a "${BOARD_ROOT}"/lib/libgcc_s.so* "${ROOT_FS_DIR}/lib" | 276 sudo cp -a "${BOARD_ROOT}"/lib/libgcc_s.so* "${ROOT_FS_DIR}/lib" |
277 sudo cp -a "${BOARD_ROOT}"/usr/lib/libstdc++.so* "${ROOT_FS_DIR}/usr/lib" | 277 sudo cp -a "${BOARD_ROOT}"/usr/lib/libstdc++.so* "${ROOT_FS_DIR}/usr/lib" |
278 | 278 |
279 INSTALL_MASK="" | 279 INSTALL_MASK="" |
280 if [[ $FLAGS_installmask -eq $FLAGS_FALSE ]] ; then | 280 if [[ $FLAGS_installmask -eq ${FLAGS_TRUE} ]] ; then |
281 INSTALL_MASK="$DEFAULT_INSTALL_MASK" | 281 INSTALL_MASK="$DEFAULT_INSTALL_MASK" |
282 fi | 282 fi |
283 | 283 |
284 if [[ $FLAGS_jobs -ne -1 ]]; then | 284 if [[ $FLAGS_jobs -ne -1 ]]; then |
285 EMERGE_JOBS="--jobs=$FLAGS_jobs" | 285 EMERGE_JOBS="--jobs=$FLAGS_jobs" |
286 fi | 286 fi |
287 | 287 |
288 # Prepare stateful partition with some pre-created directories | 288 # Prepare stateful partition with some pre-created directories |
289 sudo mkdir -p "${DEV_IMAGE_ROOT}" | 289 sudo mkdir -p "${DEV_IMAGE_ROOT}" |
290 sudo mkdir -p "${STATEFUL_DIR}/var" | 290 sudo mkdir -p "${STATEFUL_DIR}/var" |
(...skipping 21 matching lines...) Expand all Loading... |
312 # Determine the root dir for development packages. | 312 # Determine the root dir for development packages. |
313 ROOT_DEV_DIR="$ROOT_FS_DIR" | 313 ROOT_DEV_DIR="$ROOT_FS_DIR" |
314 [ $FLAGS_statefuldev -eq $FLAGS_TRUE ] && ROOT_DEV_DIR="$ROOT_FS_DIR/usr/local" | 314 [ $FLAGS_statefuldev -eq $FLAGS_TRUE ] && ROOT_DEV_DIR="$ROOT_FS_DIR/usr/local" |
315 | 315 |
316 # Install development packages. | 316 # Install development packages. |
317 if [[ $FLAGS_withdev -eq $FLAGS_TRUE ]] ; then | 317 if [[ $FLAGS_withdev -eq $FLAGS_TRUE ]] ; then |
318 sudo INSTALL_MASK="$INSTALL_MASK" emerge-${BOARD} \ | 318 sudo INSTALL_MASK="$INSTALL_MASK" emerge-${BOARD} \ |
319 --root="$ROOT_DEV_DIR" --root-deps=rdeps \ | 319 --root="$ROOT_DEV_DIR" --root-deps=rdeps \ |
320 --usepkgonly chromeos-dev $EMERGE_JOBS | 320 --usepkgonly chromeos-dev $EMERGE_JOBS |
321 | 321 |
| 322 # TODO(sosa@chromium.org) - Re-hide under statefuldev after switch |
| 323 # Flag will mount /usr/local on target device |
| 324 sudo mkdir -p "$ROOT_FS_DIR/root" |
| 325 sudo touch "$ROOT_FS_DIR/root/.dev_mode" |
| 326 |
322 # The ldd tool is a useful shell script but lives in glibc; just copy it. | 327 # The ldd tool is a useful shell script but lives in glibc; just copy it. |
323 sudo cp -a "$(which ldd)" "${ROOT_DEV_DIR}/usr/bin" | 328 sudo cp -a "$(which ldd)" "${ROOT_DEV_DIR}/usr/bin" |
324 fi | 329 fi |
325 | 330 |
326 if [ -n "$FLAGS_factory_server" ]; then | 331 if [ -n "$FLAGS_factory_server" ]; then |
327 sudo INSTALL_MASK="$INSTALL_MASK" emerge-${BOARD} \ | 332 sudo INSTALL_MASK="$INSTALL_MASK" emerge-${BOARD} \ |
328 --root="$ROOT_DEV_DIR" --root-deps=rdeps \ | 333 --root="$ROOT_DEV_DIR" --root-deps=rdeps \ |
329 --usepkgonly chromeos-factoryinstall $EMERGE_JOBS | 334 --usepkgonly chromeos-factoryinstall $EMERGE_JOBS |
330 fi | 335 fi |
331 | 336 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 menuentry "serial debug" { | 385 menuentry "serial debug" { |
381 linux /efi/boot/vmlinuz earlyprintk=serial,ttyS0,115200 i915.modeset=0 console
=ttyS0,115200 acpi=off init=/sbin/init boot=local rootwait root=/dev/sda3 ro nor
esume noswap loglevel=7 | 386 linux /efi/boot/vmlinuz earlyprintk=serial,ttyS0,115200 i915.modeset=0 console
=ttyS0,115200 acpi=off init=/sbin/init boot=local rootwait root=/dev/sda3 ro nor
esume noswap loglevel=7 |
382 } | 387 } |
383 | 388 |
384 menuentry "normal" { | 389 menuentry "normal" { |
385 linux /efi/boot/vmlinuz quiet console=tty2 init=/sbin/init boot=local rootwait
root=/dev/sda3 ro noresume noswap i915.modeset=1 loglevel=1 | 390 linux /efi/boot/vmlinuz quiet console=tty2 init=/sbin/init boot=local rootwait
root=/dev/sda3 ro noresume noswap i915.modeset=1 loglevel=1 |
386 } | 391 } |
387 | 392 |
388 EOF | 393 EOF |
389 | 394 |
390 # Enable dev mode on the target system and re-run ldconfig | 395 # Run ldconfig for rootfs's ld.so.cache |
391 # for rootfs's ld.so.cache | |
392 if [ $FLAGS_statefuldev -eq $FLAGS_TRUE ] ; then | 396 if [ $FLAGS_statefuldev -eq $FLAGS_TRUE ] ; then |
393 # Flag will mount /usr/local on target device | |
394 sudo mkdir -p "$ROOT_FS_DIR/root" | |
395 sudo touch "$ROOT_FS_DIR/root/.dev_mode" | |
396 | |
397 # Re-run ldconfig to fix /etc/ldconfig.so.cache | 397 # Re-run ldconfig to fix /etc/ldconfig.so.cache |
398 sudo /sbin/ldconfig -r "$ROOT_FS_DIR" | 398 sudo /sbin/ldconfig -r "$ROOT_FS_DIR" |
399 | 399 |
400 #TODO(sosa@chromium.org) - /usr/bin/xterm symlink not created in stateful. | 400 #TODO(sosa@chromium.org) - /usr/bin/xterm symlink not created in stateful. |
401 sudo ln -sf "/usr/local/bin/aterm" "/usr/bin/xterm" | 401 sudo ln -sf "/usr/local/bin/aterm" "/usr/bin/xterm" |
402 fi | 402 fi |
403 | 403 |
404 "${SCRIPTS_DIR}/customize_rootfs" \ | 404 "${SCRIPTS_DIR}/customize_rootfs" \ |
405 --root="$ROOT_FS_DIR" \ | 405 --root="$ROOT_FS_DIR" \ |
406 --target="$ARCH" \ | 406 --target="$ARCH" \ |
(...skipping 24 matching lines...) Expand all Loading... |
431 | 431 |
432 OUTSIDE_OUTPUT_DIR="../build/images/${FLAGS_board}/${IMAGE_SUBDIR}" | 432 OUTSIDE_OUTPUT_DIR="../build/images/${FLAGS_board}/${IMAGE_SUBDIR}" |
433 echo "Done. Image created in ${OUTPUT_DIR}" | 433 echo "Done. Image created in ${OUTPUT_DIR}" |
434 echo "To copy to USB keyfob, OUTSIDE the chroot, do something like:" | 434 echo "To copy to USB keyfob, OUTSIDE the chroot, do something like:" |
435 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdb" | 435 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdb" |
436 echo "To convert to VMWare image, OUTSIDE the chroot, do something like:" | 436 echo "To convert to VMWare image, OUTSIDE the chroot, do something like:" |
437 echo " ./image_to_vmware.sh --from=${OUTSIDE_OUTPUT_DIR}" | 437 echo " ./image_to_vmware.sh --from=${OUTSIDE_OUTPUT_DIR}" |
438 echo "from the scripts directory where you entered the chroot." | 438 echo "from the scripts directory where you entered the chroot." |
439 | 439 |
440 trap - EXIT | 440 trap - EXIT |
OLD | NEW |