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. |
11 | 11 |
12 # Load common constants. This should be the first executable line. | 12 # --- BEGIN COMMON.SH BOILERPLATE --- |
13 # The path to common.sh should be relative to your script's location. | 13 # Load common CrOS utilities. Inside the chroot this file is installed in |
14 . "$(dirname "$0")/common.sh" | 14 # /usr/lib/crosutils. Outside the chroot we find it relative to the script's |
| 15 # location. |
| 16 find_common_sh() { |
| 17 local common_paths=(/usr/lib/crosutils $(dirname "$(readlink -f "$0")")) |
| 18 local path |
15 | 19 |
16 . "$(dirname "$0")/chromeos-common.sh" # for partoffset | 20 SCRIPT_ROOT= |
| 21 for path in "${common_paths[@]}"; do |
| 22 if [ -r "${path}/common.sh" ]; then |
| 23 SCRIPT_ROOT=${path} |
| 24 break |
| 25 fi |
| 26 done |
| 27 } |
| 28 |
| 29 find_common_sh |
| 30 . "${SCRIPT_ROOT}/common.sh" || (echo "Unable to load common.sh" && exit 1) |
| 31 # --- END COMMON.SH BOILERPLATE --- |
| 32 |
| 33 # Load functions and constants for chromeos-install |
| 34 [ -f /usr/lib/installer/chromeos-common.sh ] && \ |
| 35 INSTALLER_ROOT=/usr/lib/installer || \ |
| 36 INSTALLER_ROOT=$(dirname "$(readlink -f "$0")") |
| 37 |
| 38 . "${INSTALLER_ROOT}/chromeos-common.sh" || \ |
| 39 die "Unable to load chromeos-common.sh" |
| 40 |
17 locate_gpt | 41 locate_gpt |
18 | 42 |
19 # Script must be run inside the chroot. | 43 # Script must be run inside the chroot. |
20 restart_in_chroot_if_needed $* | 44 restart_in_chroot_if_needed "$@" |
21 | 45 |
22 get_default_board | 46 get_default_board |
23 | 47 |
24 # Flags. | 48 # Flags. |
25 DEFINE_string board "${DEFAULT_BOARD}" \ | 49 DEFINE_string board "${DEFAULT_BOARD}" \ |
26 "The board to build an image for." | 50 "The board to build an image for." |
27 DEFINE_string build_root "/build" \ | 51 DEFINE_string build_root "/build" \ |
28 "The root location for board sysroots." | 52 "The root location for board sysroots." |
29 DEFINE_integer build_attempt 1 \ | 53 DEFINE_integer build_attempt 1 \ |
30 "The build attempt for this image build." | 54 "The build attempt for this image build." |
(...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
815 echo "Developer image created as ${DEVELOPER_IMAGE_NAME}" | 839 echo "Developer image created as ${DEVELOPER_IMAGE_NAME}" |
816 fi | 840 fi |
817 | 841 |
818 print_time_elapsed | 842 print_time_elapsed |
819 | 843 |
820 echo "To copy to USB keyfob, do something like:" | 844 echo "To copy to USB keyfob, do something like:" |
821 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdX" | 845 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdX" |
822 echo "To convert to VMWare image, INSIDE the chroot, do something like:" | 846 echo "To convert to VMWare image, INSIDE the chroot, do something like:" |
823 echo " ./image_to_vm.sh --from=${OUTSIDE_OUTPUT_DIR} --board=${BOARD}" | 847 echo " ./image_to_vm.sh --from=${OUTSIDE_OUTPUT_DIR} --board=${BOARD}" |
824 echo "from the scripts directory where you entered the chroot." | 848 echo "from the scripts directory where you entered the chroot." |
OLD | NEW |