| 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 # Script which ensures that a given image has an up-to-date | 7 # Script which ensures that a given image has an up-to-date |
| 8 # kernel partition, rootfs integrity hashes, and legacy bootloader configs. | 8 # kernel partition, rootfs integrity hashes, and legacy bootloader configs. |
| 9 | 9 |
| 10 # Load common constants. This should be the first executable line. | 10 # Load common constants. This should be the first executable line. |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 ${SCRIPTS_DIR}/mount_gpt_image.sh --from "$(dirname ${image})" \ | 141 ${SCRIPTS_DIR}/mount_gpt_image.sh --from "$(dirname ${image})" \ |
| 142 --image "$(basename ${image})" -r "${FLAGS_rootfs_mountpoint}" \ | 142 --image "$(basename ${image})" -r "${FLAGS_rootfs_mountpoint}" \ |
| 143 -s "${FLAGS_statefulfs_mountpoint}" | 143 -s "${FLAGS_statefulfs_mountpoint}" |
| 144 | 144 |
| 145 # The rootfs should never be mounted rw again after this point without | 145 # The rootfs should never be mounted rw again after this point without |
| 146 # re-calling make_image_bootable. | 146 # re-calling make_image_bootable. |
| 147 sudo mount -o remount,ro "${FLAGS_rootfs_mountpoint}" | 147 sudo mount -o remount,ro "${FLAGS_rootfs_mountpoint}" |
| 148 root_dev=$(mount | grep -- "on ${FLAGS_rootfs_mountpoint} type" | | 148 root_dev=$(mount | grep -- "on ${FLAGS_rootfs_mountpoint} type" | |
| 149 cut -f1 -d' ' | tail -1) | 149 cut -f1 -d' ' | tail -1) |
| 150 | 150 |
| 151 # Make the filesystem un-mountable as read-write. |
| 152 # mount_gpt_image.sh will undo this as needed. |
| 153 # TODO(wad) make sure there is parity in the signing scripts. |
| 154 if [ ${FLAGS_enable_rootfs_verification} -eq ${FLAGS_TRUE} ]; then |
| 155 # TODO(wad) this would be a good place to reset any other ext2 metadata. |
| 156 warn "Disabling r/w mount of the root filesystem" |
| 157 disable_rw_mount "$root_dev" |
| 158 fi |
| 159 |
| 151 if [ ${FLAGS_use_dev_keys} -eq ${FLAGS_TRUE} ]; then | 160 if [ ${FLAGS_use_dev_keys} -eq ${FLAGS_TRUE} ]; then |
| 152 use_dev_keys="--use_dev_keys" | 161 use_dev_keys="--use_dev_keys" |
| 153 fi | 162 fi |
| 154 | 163 |
| 155 # Builds the kernel partition image. The temporary files are kept around | 164 # Builds the kernel partition image. The temporary files are kept around |
| 156 # so that we can perform a load_kernel_test later on the final image. | 165 # so that we can perform a load_kernel_test later on the final image. |
| 157 ${SCRIPTS_DIR}/build_kernel_image.sh \ | 166 ${SCRIPTS_DIR}/build_kernel_image.sh \ |
| 158 --arch="${FLAGS_arch}" \ | 167 --arch="${FLAGS_arch}" \ |
| 159 --to="${FLAGS_output_dir}/vmlinuz.image" \ | 168 --to="${FLAGS_output_dir}/vmlinuz.image" \ |
| 160 --hd_vblock="${FLAGS_output_dir}/vmlinuz_hd.vblock" \ | 169 --hd_vblock="${FLAGS_output_dir}/vmlinuz_hd.vblock" \ |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 mkdir -p ${FLAGS_statefulfs_mountpoint} | 265 mkdir -p ${FLAGS_statefulfs_mountpoint} |
| 257 mkdir -p ${FLAGS_espfs_mountpoint} | 266 mkdir -p ${FLAGS_espfs_mountpoint} |
| 258 | 267 |
| 259 make_image_bootable ${IMAGE} | 268 make_image_bootable ${IMAGE} |
| 260 | 269 |
| 261 if [ ${FLAGS_cleanup_dirs} -eq ${FLAGS_TRUE} ]; then | 270 if [ ${FLAGS_cleanup_dirs} -eq ${FLAGS_TRUE} ]; then |
| 262 rmdir ${FLAGS_rootfs_mountpoint} | 271 rmdir ${FLAGS_rootfs_mountpoint} |
| 263 rmdir ${FLAGS_statefulfs_mountpoint} | 272 rmdir ${FLAGS_statefulfs_mountpoint} |
| 264 rmdir ${FLAGS_espfs_mountpoint} | 273 rmdir ${FLAGS_espfs_mountpoint} |
| 265 fi | 274 fi |
| OLD | NEW |