Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright (c) 2011 The Chromium OS Authors. All rights reserved. | 1 # Copyright (c) 2011 The Chromium OS Authors. All rights reserved. |
| 2 # Distributed under the terms of the GNU General Public License v2 | 2 # Distributed under the terms of the GNU General Public License v2 |
| 3 | 3 |
| 4 EAPI=2 | 4 EAPI=2 |
| 5 | 5 |
| 6 inherit toolchain-funcs | 6 inherit toolchain-funcs |
| 7 | 7 |
| 8 DESCRIPTION="ChromeOS BIOS builder" | 8 DESCRIPTION="ChromeOS BIOS builder" |
| 9 HOMEPAGE="http://www.chromium.org" | 9 HOMEPAGE="http://www.chromium.org" |
| 10 LICENSE="" | 10 LICENSE="" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 51 grep -E 'CONFIG_CHROMEOS_HWID' ${autoconf} || | 51 grep -E 'CONFIG_CHROMEOS_HWID' ${autoconf} || |
| 52 die "Failed to extract HWID." | 52 die "Failed to extract HWID." |
| 53 | 53 |
| 54 grep -E 'CONFIG_(OFFSET|LENGTH)_\w+' ${autoconf} || | 54 grep -E 'CONFIG_(OFFSET|LENGTH)_\w+' ${autoconf} || |
| 55 die "Failed to extract offsets and lengths." | 55 die "Failed to extract offsets and lengths." |
| 56 | 56 |
| 57 cat ${FILESDIR}/firmware_layout_config || | 57 cat ${FILESDIR}/firmware_layout_config || |
| 58 die "Failed to cat firmware_layout_config." | 58 die "Failed to cat firmware_layout_config." |
| 59 } | 59 } |
| 60 | 60 |
| 61 construct_config() { | |
| 62 local text_base="0x$1" | |
| 63 | |
| 64 # | |
| 65 # The cbootimage config file format is not yet documented. Below is | |
| 66 # a minimal config file that merges a BCT file and bootloader; in | |
| 67 # this case our stub U-Boot image. We do not use the Version, but it | |
| 68 # needs to be set. | |
| 69 # | |
| 70 # Currently a bug in cbootimage prevents us from setting Redundancy to | |
| 71 # 0. Redundancy controls how many instances of the BCT should be | |
| 72 # written to the signed image. A value of 1 causes two instances to | |
| 73 # be written. | |
| 74 # | |
| 75 # The BootLoader parameter specifies the bootloader image to use. It | |
| 76 # also specifies the load address for the bootloader in RAM and the | |
| 77 # entry point of the resulting image. For U-Boot these are the same | |
| 78 # value (TEXT_BASE). | |
| 79 # | |
| 80 echo "Bctfile=${bct_file};" | |
| 81 echo "Version=1;" | |
| 82 echo "Redundancy=1;" | |
| 83 echo "BootLoader=${stub_image},${text_base},${text_base},Complete;" | |
| 84 } | |
| 85 | |
| 86 src_compile() { | 61 src_compile() { |
| 87 hwid=$(get_autoconf CONFIG_CHROMEOS_HWID) | 62 hwid=$(get_autoconf CONFIG_CHROMEOS_HWID) |
| 88 gbb_size=$(get_autoconf CONFIG_LENGTH_GBB) | 63 gbb_size=$(get_autoconf CONFIG_LENGTH_GBB) |
| 89 | 64 |
| 90 construct_layout > layout.py | 65 construct_layout > layout.py |
| 91 | 66 |
| 92 /usr/share/vboot/bitmaps/make_bmp_images.sh \ | 67 /usr/share/vboot/bitmaps/make_bmp_images.sh \ |
| 93 "${hwid}" \ | 68 "${hwid}" \ |
| 94 "$(get_screen_geometry)" \ | 69 "$(get_screen_geometry)" \ |
| 95 "arm" | 70 "arm" |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 107 gbb_utility -s \ | 82 gbb_utility -s \ |
| 108 --hwid="${hwid}" \ | 83 --hwid="${hwid}" \ |
| 109 --rootkey=${keys}/root_key.vbpubk \ | 84 --rootkey=${keys}/root_key.vbpubk \ |
| 110 --recoverykey=${keys}/recovery_key.vbpubk \ | 85 --recoverykey=${keys}/recovery_key.vbpubk \ |
| 111 --bmpfv="${bmp_dir}/bmpblk.bin" \ | 86 --bmpfv="${bmp_dir}/bmpblk.bin" \ |
| 112 gbb.bin || | 87 gbb.bin || |
| 113 die "Failed to write keys and HWID to the GBB." | 88 die "Failed to write keys and HWID to the GBB." |
| 114 | 89 |
| 115 # | 90 # |
| 116 # Sign the bootstub. This is a combination of the board specific | 91 # Sign the bootstub. This is a combination of the board specific |
| 117 » # BCT and the stub U-Boot image. The cbootimage tool takes a config | 92 » # BCT and the stub U-Boot image. |
| 118 » # file and an output filename to write to. | |
| 119 # | 93 # |
| 120 » cat ${cfg_file} > boot.cfg || | 94 » cros_sign_bootstub \ |
|
vb
2011/03/03 04:10:19
please add to the CL description some information
| |
| 121 » » die "Failed to cat flash configuration file." | 95 » » --bct "${bct_file}" \ |
| 122 | 96 » » --flash "${cfg_file}" \ |
| 123 » construct_config $(get_text_base) >> boot.cfg || | 97 » » --bootstub "${stub_image}" \ |
| 124 » » die "Failed to create boot stub signing configuration file." | 98 » » --output bootstub.bin \ |
| 125 | 99 » » --text_base "0x$(get_text_base)" || |
| 126 » cbootimage boot.cfg bootstub.bin || | |
| 127 die "Failed to sign boot stub image." | 100 die "Failed to sign boot stub image." |
| 128 | 101 |
| 129 pack_firmware_image layout.py \ | 102 pack_firmware_image layout.py \ |
| 130 KEYDIR=${keys}/ \ | 103 KEYDIR=${keys}/ \ |
| 131 BOOTSTUB_IMAGE=bootstub.bin \ | 104 BOOTSTUB_IMAGE=bootstub.bin \ |
| 132 RECOVERY_IMAGE=${recovery_image} \ | 105 RECOVERY_IMAGE=${recovery_image} \ |
| 133 GBB_IMAGE=gbb.bin \ | 106 GBB_IMAGE=gbb.bin \ |
| 134 FIRMWARE_A_IMAGE=${normal_image} \ | 107 FIRMWARE_A_IMAGE=${normal_image} \ |
| 135 FIRMWARE_B_IMAGE=${normal_image} \ | 108 FIRMWARE_B_IMAGE=${normal_image} \ |
| 136 OUTPUT=image.bin || | 109 OUTPUT=image.bin || |
| 137 die "Failed to pack the firmware image." | 110 die "Failed to pack the firmware image." |
| 138 } | 111 } |
| 139 | 112 |
| 140 src_install() { | 113 src_install() { |
| 141 insinto /u-boot | 114 insinto /u-boot |
| 142 doins boot.cfg || die | |
| 143 doins layout.py || die | 115 doins layout.py || die |
| 144 doins image.bin || die | 116 doins image.bin || die |
| 145 doins bootstub.bin || die | 117 doins bootstub.bin || die |
| 146 } | 118 } |
| OLD | NEW |