| OLD | NEW |
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 | 2 |
| 3 # Copyright (c) 2011 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2011 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 utility uses cbootimage to signs a bootstub so that the Tegra boot ROM | 7 # This utility uses cbootimage to signs a bootstub so that the Tegra boot ROM |
| 8 # will load and run it. | 8 # will load and run it. |
| 9 | 9 |
| 10 # Include common CrOS utilities. | 10 # Include common CrOS utilities. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 CROS_LOG_PREFIX="cros_sign_bootstub" | 28 CROS_LOG_PREFIX="cros_sign_bootstub" |
| 29 | 29 |
| 30 function construct_config() { | 30 function construct_config() { |
| 31 local flash_file="$1" | 31 local flash_file="$1" |
| 32 local bct_file="$2" | 32 local bct_file="$2" |
| 33 local bootstub="$3" | 33 local bootstub="$3" |
| 34 local text_base="$4" | 34 local text_base="$4" |
| 35 | 35 |
| 36 # | 36 # |
| 37 # First we output the boot flash configuration file. | |
| 38 # | |
| 39 cat ${flash_file} | |
| 40 | |
| 41 # | |
| 42 # The cbootimage config file format is not yet documented. Below is | 37 # The cbootimage config file format is not yet documented. Below is |
| 43 # a minimal config file that merges a BCT file and bootloader; in | 38 # a minimal config file that merges a BCT file and bootloader; in |
| 44 # this case our stub U-Boot image. We do not use the Version, but it | 39 # this case our stub U-Boot image. We do not use the Version, but it |
| 45 # needs to be set. | 40 # needs to be set. |
| 46 # | 41 # |
| 47 # Currently a bug in cbootimage prevents us from setting Redundancy to | 42 # Currently a bug in cbootimage prevents us from setting Redundancy to |
| 48 # 0. Redundancy controls how many instances of the BCT should be | 43 # 0. Redundancy controls how many instances of the BCT should be |
| 49 # written to the signed image. A value of 1 causes two instances to | 44 # written to the signed image. A value of 1 causes two instances to |
| 50 # be written. | 45 # be written. |
| 51 # | 46 # |
| 52 # The BootLoader parameter specifies the bootloader image to use. It | 47 # The BootLoader parameter specifies the bootloader image to use. It |
| 53 # also specifies the load address for the bootloader in RAM and the | 48 # also specifies the load address for the bootloader in RAM and the |
| 54 # entry point of the resulting image. For U-Boot these are the same | 49 # entry point of the resulting image. For U-Boot these are the same |
| 55 # value (TEXT_BASE). | 50 # value (TEXT_BASE). |
| 56 # | 51 # |
| 57 echo "" | 52 echo "Bctfile = ${bct_file};" |
| 58 echo "Bctfile=${bct_file};" | 53 echo "Version = 1;" |
| 59 echo "Version=1;" | 54 echo "Redundancy = 1;" |
| 60 echo "Redundancy=1;" | 55 |
| 61 echo "BootLoader=${bootstub},${text_base},${text_base},Complete;" | 56 # TODO(robotboy): This needs to be added back in to support selecting the |
| 57 # boot flash device. With this commented out we can only boot from the |
| 58 # boot device that the source BCT file was created for. This is commented |
| 59 # out because it causes the resulting image to not boot if it is added. |
| 60 # TRACKER: http://code.google.com/p/chromium-os/issues/detail?id=12712 |
| 61 # |
| 62 # echo "" |
| 63 # cat ${flash_file} |
| 64 # echo "" |
| 65 |
| 66 echo "BootLoader = ${bootstub},${text_base},${text_base},Complete;" |
| 62 } | 67 } |
| 63 | 68 |
| 64 ############################################################################### | 69 ############################################################################### |
| 65 | 70 |
| 66 check_for_file "boot flash device config" "..." "${FLAGS_flash}" | 71 check_for_file "boot flash device config" "..." "${FLAGS_flash}" |
| 67 check_for_file "BCT" "........................" "${FLAGS_bct}" | 72 check_for_file "BCT" "........................" "${FLAGS_bct}" |
| 68 check_for_file "bootstub image" "............." "${FLAGS_bootstub}" | 73 check_for_file "bootstub image" "............." "${FLAGS_bootstub}" |
| 69 | 74 |
| 70 check_for_tool "cbootimage" "cbootimage" | 75 check_for_tool "cbootimage" "cbootimage" |
| 71 | 76 |
| 72 if [ -z "${FLAGS_config}" ]; then | 77 if [ -z "${FLAGS_config}" ]; then |
| 73 config=$(mktemp -d) | 78 config=$(mktemp -d) |
| 74 | 79 |
| 75 trap "rm -rf ${config}" EXIT | 80 trap "rm -rf ${config}" EXIT |
| 76 else | 81 else |
| 77 mkdir -p "${FLAGS_config}" | 82 mkdir -p "${FLAGS_config}" |
| 78 | 83 |
| 79 config=${FLAGS_config} | 84 config=${FLAGS_config} |
| 80 fi | 85 fi |
| 81 | 86 |
| 82 construct_config \ | 87 construct_config \ |
| 83 "${FLAGS_flash}" \ | 88 "${FLAGS_flash}" \ |
| 84 "${FLAGS_bct}" \ | 89 "${FLAGS_bct}" \ |
| 85 "${FLAGS_bootstub}" \ | 90 "${FLAGS_bootstub}" \ |
| 86 "${FLAGS_text_base}" > "${config}/boot.cfg" | 91 "${FLAGS_text_base}" > "${config}/boot.cfg" |
| 87 | 92 |
| 88 cbootimage "${config}/boot.cfg" "${FLAGS_output}" | 93 cbootimage "${config}/boot.cfg" "${FLAGS_output}" |
| OLD | NEW |