OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 | 2 |
3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2010 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 # Helper script that generates the signed kernel image | 7 # Helper script that generates the signed kernel image |
8 | 8 |
9 # --- BEGIN COMMON.SH BOILERPLATE --- | 9 # --- BEGIN COMMON.SH BOILERPLATE --- |
10 # Load common CrOS utilities. Inside the chroot this file is installed in | 10 # Load common CrOS utilities. Inside the chroot this file is installed in |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 mkdir -p "${FLAGS_working_dir}" | 128 mkdir -p "${FLAGS_working_dir}" |
129 | 129 |
130 # Only let dm-verity block if rootfs verification is configured. | 130 # Only let dm-verity block if rootfs verification is configured. |
131 dev_wait=0 | 131 dev_wait=0 |
132 if [[ ${FLAGS_root} = "/dev/dm-0" ]]; then | 132 if [[ ${FLAGS_root} = "/dev/dm-0" ]]; then |
133 dev_wait=1 | 133 dev_wait=1 |
134 fi | 134 fi |
135 | 135 |
136 cat <<EOF > "${FLAGS_working_dir}/boot.config" | 136 cat <<EOF > "${FLAGS_working_dir}/boot.config" |
137 root=${FLAGS_root} | 137 root=${FLAGS_root} |
138 quiet | |
139 loglevel=1 | |
140 rootwait | 138 rootwait |
141 ro | 139 ro |
142 dm_verity.error_behavior=${FLAGS_verity_error_behavior} | 140 dm_verity.error_behavior=${FLAGS_verity_error_behavior} |
143 dm_verity.max_bios=${FLAGS_verity_max_ios} | 141 dm_verity.max_bios=${FLAGS_verity_max_ios} |
144 dm_verity.dev_wait=${dev_wait} | 142 dm_verity.dev_wait=${dev_wait} |
145 ${verity_args} | 143 ${verity_args} |
146 ${FLAGS_boot_args} | 144 ${FLAGS_boot_args} |
147 EOF | 145 EOF |
148 | 146 |
149 WORK="${WORK} ${FLAGS_working_dir}/boot.config" | 147 WORK="${WORK} ${FLAGS_working_dir}/boot.config" |
150 info "Emitted cross-platform boot params to ${FLAGS_working_dir}/boot.config" | 148 info "Emitted cross-platform boot params to ${FLAGS_working_dir}/boot.config" |
151 | 149 |
152 if [[ "${FLAGS_arch}" = "x86" ]]; then | 150 if [[ "${FLAGS_arch}" = "x86" ]]; then |
153 # Legacy BIOS will use the kernel in the rootfs (via syslinux), as will | 151 # Legacy BIOS will use the kernel in the rootfs (via syslinux), as will |
154 # standard EFI BIOS (via grub, from the EFI System Partition). Chrome OS | 152 # standard EFI BIOS (via grub, from the EFI System Partition). Chrome OS |
155 # BIOS will use a separate signed kernel partition, which we'll create now. | 153 # BIOS will use a separate signed kernel partition, which we'll create now. |
156 # FIXME: remove serial output, debugging messages. | 154 # FIXME: remove serial output, debugging messages. |
157 cat <<EOF | cat - "${FLAGS_working_dir}/boot.config" \ | 155 cat <<EOF | cat - "${FLAGS_working_dir}/boot.config" \ |
158 > "${FLAGS_working_dir}/config.txt" | 156 > "${FLAGS_working_dir}/config.txt" |
| 157 quiet |
| 158 loglevel=1 |
159 console=tty2 | 159 console=tty2 |
160 init=/sbin/init | 160 init=/sbin/init |
161 add_efi_memmap | 161 add_efi_memmap |
162 boot=local | 162 boot=local |
163 noresume | 163 noresume |
164 noswap | 164 noswap |
165 i915.modeset=1 | 165 i915.modeset=1 |
166 cros_secure | 166 cros_secure |
167 kern_guid=%U | 167 kern_guid=%U |
168 tpm_tis.force=1 | 168 tpm_tis.force=1 |
169 tpm_tis.interrupts=0 | 169 tpm_tis.interrupts=0 |
170 nmi_watchdog=panic,lapic | 170 nmi_watchdog=panic,lapic |
171 EOF | 171 EOF |
172 WORK="${WORK} ${FLAGS_working_dir}/config.txt" | 172 WORK="${WORK} ${FLAGS_working_dir}/config.txt" |
173 | 173 |
174 bootloader_path="/lib64/bootstub/bootstub.efi" | 174 bootloader_path="/lib64/bootstub/bootstub.efi" |
175 kernel_image="${FLAGS_vmlinuz}" | 175 kernel_image="${FLAGS_vmlinuz}" |
176 | 176 |
177 sign_the_kernel=${FLAGS_TRUE} | 177 sign_the_kernel=${FLAGS_TRUE} |
178 elif [[ "${FLAGS_arch}" = "arm" ]]; then | 178 elif [[ "${FLAGS_arch}" = "arm" ]]; then |
179 cp "${FLAGS_working_dir}/boot.config" "${FLAGS_working_dir}/config.txt" | 179 cat <<EOF | cat - "${FLAGS_working_dir}/boot.config" \ |
| 180 > "${FLAGS_working_dir}/config.txt" |
| 181 earlyprintk |
| 182 EOF |
180 WORK="${WORK} ${FLAGS_working_dir}/config.txt" | 183 WORK="${WORK} ${FLAGS_working_dir}/config.txt" |
181 | 184 |
182 kernel_script="${FLAGS_working_dir}/kernel.scr" | 185 kernel_script="${FLAGS_working_dir}/kernel.scr" |
183 kernel_script_img="${FLAGS_working_dir}/kernel.scr.uimg" | 186 kernel_script_img="${FLAGS_working_dir}/kernel.scr.uimg" |
184 | 187 |
185 echo -n 'setenv bootargs ${bootargs} ' > "${kernel_script}" | 188 echo -n 'setenv bootargs ${bootargs} ' > "${kernel_script}" |
186 tr '\n' ' ' < "${FLAGS_working_dir}/boot.config" >> "${kernel_script}" | 189 tr '\n' ' ' < "${FLAGS_working_dir}/boot.config" >> "${kernel_script}" |
187 echo >> "${kernel_script}" | 190 echo >> "${kernel_script}" |
188 | 191 |
189 mkimage -A arm -O linux -T script -C none -a 0 -e 0 \ | 192 mkimage -A arm -O linux -T script -C none -a 0 -e 0 \ |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 info "Cleaning up temporary files: ${WORK}" | 294 info "Cleaning up temporary files: ${WORK}" |
292 rm ${WORK} | 295 rm ${WORK} |
293 rmdir ${FLAGS_working_dir} | 296 rmdir ${FLAGS_working_dir} |
294 fi | 297 fi |
295 | 298 |
296 info "Kernel partition image emitted: ${FLAGS_to}" | 299 info "Kernel partition image emitted: ${FLAGS_to}" |
297 | 300 |
298 if [[ -f ${FLAGS_rootfs_hash} ]]; then | 301 if [[ -f ${FLAGS_rootfs_hash} ]]; then |
299 info "Root filesystem hash emitted: ${FLAGS_rootfs_hash}" | 302 info "Root filesystem hash emitted: ${FLAGS_rootfs_hash}" |
300 fi | 303 fi |
OLD | NEW |