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 # |
52 echo "Bctfile = ${bct_file};" | |
53 echo "Version = 1;" | |
54 echo "Redundancy = 1;" | |
57 echo "" | 55 echo "" |
vb
2011/03/03 03:55:24
I am not sure I follow - is it right that essentia
robotboy
2011/03/03 17:53:33
Done.
| |
58 echo "Bctfile=${bct_file};" | 56 |
59 echo "Version=1;" | 57 # TODO(robotboy): This needs to be added back in to support selecting the |
vb
2011/03/03 03:55:24
Please open a tracker entry for this problem and i
robotboy
2011/03/03 17:53:33
Done.
| |
60 echo "Redundancy=1;" | 58 # boot flash device. With this commented out we can only boot from the |
61 echo "BootLoader=${bootstub},${text_base},${text_base},Complete;" | 59 # boot device that the source BCT file was created for. This is commented |
60 # out because it causes the resulting image to not boot if it is added. | |
61 # cat ${flash_file} | |
62 | |
63 echo "" | |
64 echo "BootLoader = ${bootstub},${text_base},${text_base},Complete;" | |
62 } | 65 } |
63 | 66 |
64 ############################################################################### | 67 ############################################################################### |
65 | 68 |
66 check_for_file "boot flash device config" "..." "${FLAGS_flash}" | 69 check_for_file "boot flash device config" "..." "${FLAGS_flash}" |
67 check_for_file "BCT" "........................" "${FLAGS_bct}" | 70 check_for_file "BCT" "........................" "${FLAGS_bct}" |
68 check_for_file "bootstub image" "............." "${FLAGS_bootstub}" | 71 check_for_file "bootstub image" "............." "${FLAGS_bootstub}" |
69 | 72 |
70 check_for_tool "cbootimage" "cbootimage" | 73 check_for_tool "cbootimage" "cbootimage" |
71 | 74 |
72 if [ -z "${FLAGS_config}" ]; then | 75 if [ -z "${FLAGS_config}" ]; then |
73 config=$(mktemp -d) | 76 config=$(mktemp -d) |
74 | 77 |
75 trap "rm -rf ${config}" EXIT | 78 trap "rm -rf ${config}" EXIT |
76 else | 79 else |
77 mkdir -p "${FLAGS_config}" | 80 mkdir -p "${FLAGS_config}" |
78 | 81 |
79 config=${FLAGS_config} | 82 config=${FLAGS_config} |
80 fi | 83 fi |
81 | 84 |
82 construct_config \ | 85 construct_config \ |
83 "${FLAGS_flash}" \ | 86 "${FLAGS_flash}" \ |
84 "${FLAGS_bct}" \ | 87 "${FLAGS_bct}" \ |
85 "${FLAGS_bootstub}" \ | 88 "${FLAGS_bootstub}" \ |
86 "${FLAGS_text_base}" > "${config}/boot.cfg" | 89 "${FLAGS_text_base}" > "${config}/boot.cfg" |
87 | 90 |
88 cbootimage "${config}/boot.cfg" "${FLAGS_output}" | 91 cbootimage "${config}/boot.cfg" "${FLAGS_output}" |
OLD | NEW |