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 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 sudo cp ${ROOT_FS_DIR}/boot/vmlinuz ${ESP_DIR}/efi/boot/vmlinuz | 353 sudo cp ${ROOT_FS_DIR}/boot/vmlinuz ${ESP_DIR}/efi/boot/vmlinuz |
354 cat <<EOF | sudo dd of=${ESP_DIR}/efi/boot/grub.cfg | 354 cat <<EOF | sudo dd of=${ESP_DIR}/efi/boot/grub.cfg |
355 set timeout=2 | 355 set timeout=2 |
356 set default=0 | 356 set default=0 |
357 | 357 |
358 menuentry "32-bit serial" { | 358 menuentry "32-bit serial" { |
359 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 | 359 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 |
360 } | 360 } |
361 EOF | 361 EOF |
362 | 362 |
363 "${SCRIPTS_DIR}/customize_rootfs" \ | |
364 --root="$ROOT_FS_DIR" \ | |
365 --target="$ARCH" \ | |
366 --board="$BOARD" \ | |
367 $WITH_DEV | |
368 | |
369 # Check that the image has been correctly created. | |
370 "${SCRIPTS_DIR}/test_image" \ | |
371 --root="$ROOT_FS_DIR" \ | |
372 --target="$ARCH" | |
373 | |
374 # Enable dev mode on the target system and re-run ldconfig | 363 # Enable dev mode on the target system and re-run ldconfig |
375 # for rootfs's ld.so.cache | 364 # for rootfs's ld.so.cache |
376 if [ $FLAGS_statefuldev -eq $FLAGS_TRUE ] ; then | 365 if [ $FLAGS_statefuldev -eq $FLAGS_TRUE ] ; then |
377 # Flag will mount /usr/local on target device | 366 # Flag will mount /usr/local on target device |
378 sudo mkdir -p "$ROOT_FS_DIR/root" | 367 sudo mkdir -p "$ROOT_FS_DIR/root" |
379 sudo touch "$ROOT_FS_DIR/root/.dev_mode" | 368 sudo touch "$ROOT_FS_DIR/root/.dev_mode" |
380 | 369 |
381 # Re-run ldconfig to fix /etc/ldconfig.so.cache | 370 # Re-run ldconfig to fix /etc/ldconfig.so.cache |
382 sudo /sbin/ldconfig -r "$ROOT_FS_DIR" | 371 sudo /sbin/ldconfig -r "$ROOT_FS_DIR" |
383 | 372 |
384 #TODO(sosa@chromium.org) - /usr/bin/xterm symlink not created in stateful. | 373 #TODO(sosa@chromium.org) - /usr/bin/xterm symlink not created in stateful. |
385 sudo ln -sf "/usr/local/bin/aterm" "/usr/bin/xterm" | 374 sudo ln -sf "/usr/local/bin/aterm" "/usr/bin/xterm" |
386 fi | 375 fi |
387 | 376 |
| 377 "${SCRIPTS_DIR}/customize_rootfs" \ |
| 378 --root="$ROOT_FS_DIR" \ |
| 379 --target="$ARCH" \ |
| 380 --board="$BOARD" \ |
| 381 $WITH_DEV |
| 382 |
| 383 # Check that the image has been correctly created. |
| 384 "${SCRIPTS_DIR}/test_image" \ |
| 385 --root="$ROOT_FS_DIR" \ |
| 386 --target="$ARCH" |
| 387 |
388 # Clean up symlinks so they work on a running target rooted at "/". | 388 # Clean up symlinks so they work on a running target rooted at "/". |
389 # Here development packages are rooted at /usr/local. However, do not | 389 # Here development packages are rooted at /usr/local. However, do not |
390 # create /usr/local or /var on host (already exist on target). | 390 # create /usr/local or /var on host (already exist on target). |
391 setup_symlinks_on_root "/usr/local" "/var" | 391 setup_symlinks_on_root "/usr/local" "/var" |
392 | 392 |
393 # Cleanup loop devices. | 393 # Cleanup loop devices. |
394 cleanup | 394 cleanup |
395 | 395 |
396 # Create the GPT-formatted image | 396 # Create the GPT-formatted image |
397 ${SCRIPTS_DIR}/build_gpt.sh \ | 397 ${SCRIPTS_DIR}/build_gpt.sh \ |
398 --arch=${ARCH} --board=${FLAGS_board} --board_root=${BOARD_ROOT} \ | 398 --arch=${ARCH} --board=${FLAGS_board} --board_root=${BOARD_ROOT} \ |
399 "${OUTPUT_DIR}" "${OUTPUT_IMG}" | 399 "${OUTPUT_DIR}" "${OUTPUT_IMG}" |
400 | 400 |
401 # Clean up temporary files. | 401 # Clean up temporary files. |
402 rm -f "${ROOT_FS_IMG}" "${STATEFUL_IMG}" "${OUTPUT_DIR}/vmlinuz.image" \ | 402 rm -f "${ROOT_FS_IMG}" "${STATEFUL_IMG}" "${OUTPUT_DIR}/vmlinuz.image" \ |
403 "${ESP_IMG}" | 403 "${ESP_IMG}" |
404 rmdir "${ROOT_FS_DIR}" "${STATEFUL_DIR}" "${ESP_DIR}" | 404 rmdir "${ROOT_FS_DIR}" "${STATEFUL_DIR}" "${ESP_DIR}" |
405 | 405 |
406 OUTSIDE_OUTPUT_DIR="../build/images/${FLAGS_board}/${IMAGE_SUBDIR}" | 406 OUTSIDE_OUTPUT_DIR="../build/images/${FLAGS_board}/${IMAGE_SUBDIR}" |
407 echo "Done. Image created in ${OUTPUT_DIR}" | 407 echo "Done. Image created in ${OUTPUT_DIR}" |
408 echo "To copy to USB keyfob, OUTSIDE the chroot, do something like:" | 408 echo "To copy to USB keyfob, OUTSIDE the chroot, do something like:" |
409 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdb" | 409 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdb" |
410 echo "To convert to VMWare image, OUTSIDE the chroot, do something like:" | 410 echo "To convert to VMWare image, OUTSIDE the chroot, do something like:" |
411 echo " ./image_to_vmware.sh --from=${OUTSIDE_OUTPUT_DIR}" | 411 echo " ./image_to_vmware.sh --from=${OUTSIDE_OUTPUT_DIR}" |
412 echo "from the scripts directory where you entered the chroot." | 412 echo "from the scripts directory where you entered the chroot." |
413 | 413 |
414 trap - EXIT | 414 trap - EXIT |
OLD | NEW |