Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Side by Side Diff: make_factory_package.sh

Issue 6296001: Add legacy fixup for diskimg (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/crosutils.git@0.9.132.B
Patch Set: . Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/bin/bash 1 #!/bin/bash
2 2
3 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. 3 # Copyright (c) 2009 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 to generate a factory install partition set and miniomaha.conf 7 # Script to generate a factory install partition set and miniomaha.conf
8 # file from a release image and a factory image. This creates a server 8 # file from a release image and a factory image. This creates a server
9 # configuration that can be installed using a factory install shim. 9 # configuration that can be installed using a factory install shim.
10 # 10 #
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 if image_has_part_tools; then 183 if image_has_part_tools; then
184 IMAGE_IS_UNPACKED= 184 IMAGE_IS_UNPACKED=
185 else 185 else
186 #TODO(hungte) Currently we run unpack_partitions.sh if part_tools are not 186 #TODO(hungte) Currently we run unpack_partitions.sh if part_tools are not
187 # found. If the format of unpack_partitions.sh is reliable, we can prevent 187 # found. If the format of unpack_partitions.sh is reliable, we can prevent
188 # creating temporary files. See image_part_offset for more information. 188 # creating temporary files. See image_part_offset for more information.
189 echo "WARNING: cannot find partition tools. Using unpack_partitions.sh." >&2 189 echo "WARNING: cannot find partition tools. Using unpack_partitions.sh." >&2
190 IMAGE_IS_UNPACKED=1 190 IMAGE_IS_UNPACKED=1
191 fi 191 fi
192 192
193 mount_esp() {
194 local image="$1"
195 local esp_mountpoint="$2"
196 offset=$(partoffset "${image}" 12)
197 sudo mount -o loop,offset=$(( offset * 512 )) \
198 "${image}" "${esp_mountpoint}"
199 ESP_MOUNT="${esp_mountpoint}"
200 }
201
202 umount_esp() {
203 if [ -n "${ESP_MOUNT}" ]; then
204 sudo umount "${ESP_MOUNT}"
205 fi
206 }
207
193 generate_img() { 208 generate_img() {
194 local outdev="$FLAGS_diskimg" 209 local outdev="$FLAGS_diskimg"
195 local sectors="$FLAGS_sectors" 210 local sectors="$FLAGS_sectors"
196 211
197 prepare_img 212 prepare_img
198 213
199 # Get the release image. 214 # Get the release image.
200 pushd "${RELEASE_DIR}" >/dev/null 215 pushd "${RELEASE_DIR}" >/dev/null
201 216
202 echo "Release Kernel" 217 echo "Release Kernel"
203 image_partition_copy "${RELEASE_IMAGE}" 2 "${outdev}" 4 218 image_partition_copy "${RELEASE_IMAGE}" 2 "${outdev}" 4
204
205 echo "Release Rootfs" 219 echo "Release Rootfs"
206 image_partition_copy "${RELEASE_IMAGE}" 3 "${outdev}" 5 220 image_partition_copy "${RELEASE_IMAGE}" 3 "${outdev}" 5
207
208 echo "OEM parition" 221 echo "OEM parition"
209 image_partition_copy "${RELEASE_IMAGE}" 8 "${outdev}" 8 222 image_partition_copy "${RELEASE_IMAGE}" 8 "${outdev}" 8
210 223
211 popd >/dev/null 224 popd >/dev/null
212 225
213 # Go to retrieve the factory test image. 226 # Go to retrieve the factory test image.
214 pushd "${FACTORY_DIR}" >/dev/null 227 pushd "${FACTORY_DIR}" >/dev/null
215 228
216 echo "Factory Kernel" 229 echo "Factory Kernel"
217 image_partition_copy "${FACTORY_IMAGE}" 2 "${outdev}" 2 230 image_partition_copy "${FACTORY_IMAGE}" 2 "${outdev}" 2
218 echo "Factory Rootfs" 231 echo "Factory Rootfs"
219 image_partition_copy "${FACTORY_IMAGE}" 3 "${outdev}" 3 232 image_partition_copy "${FACTORY_IMAGE}" 3 "${outdev}" 3
220 echo "Factory Stateful" 233 echo "Factory Stateful"
221 image_partition_copy "${FACTORY_IMAGE}" 1 "${outdev}" 1 234 image_partition_copy "${FACTORY_IMAGE}" 1 "${outdev}" 1
222 echo "EFI Partition" 235 echo "EFI Partition"
223 image_partition_copy "${FACTORY_IMAGE}" 12 "${outdev}" 12 236 image_partition_copy "${FACTORY_IMAGE}" 12 "${outdev}" 12
224 237
238 # TODO(nsanders, wad): consolidate this code into some common code
239 # when cleaning up kernel commandlines. There is code that touches
240 # this in postint/chromeos-setimage and build_image. However none
241 # of the preexisting code actually does what we want here.
242 local tmpesp="$(mktemp -d)"
243 mount_esp "${outdev}" "${tmpesp}"
244
245 trap "umount_esp" EXIT
246
247 # Edit boot device default for legacy.
248 # Support both vboot and regular boot.
249 sudo sed -i "s/chromeos-usb.A/chromeos-hd.A/" \
250 "${tmpesp}"/syslinux/default.cfg
251 sudo sed -i "s/chromeos-vusb.A/chromeos-vhd.A/" \
252 "${tmpesp}"/syslinux/default.cfg
253
254 # Edit root fs default for legacy
255 # Somewhat safe as ARM does not support syslinux, I believe.
256 sudo sed -i "s'HDROOTA'/dev/sda3'g" "${tmpesp}"/syslinux/root.A.cfg
257
258 trap - EXIT
259
260 umount_esp
261
225 echo "Generated Image at $outdev." 262 echo "Generated Image at $outdev."
226 echo "Done" 263 echo "Done"
227 } 264 }
228 265
229 generate_omaha() { 266 generate_omaha() {
230 # Clean up stale config and data files. 267 # Clean up stale config and data files.
231 prepare_omaha 268 prepare_omaha
232 269
233 # Get the release image. 270 # Get the release image.
234 pushd "${RELEASE_DIR}" >/dev/null 271 pushd "${RELEASE_DIR}" >/dev/null
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 To run the server: 395 To run the server:
359 python2.6 devserver.py --factory_config miniomaha.conf" 396 python2.6 devserver.py --factory_config miniomaha.conf"
360 } 397 }
361 398
362 # Main 399 # Main
363 if [ -n "$FLAGS_diskimg" ]; then 400 if [ -n "$FLAGS_diskimg" ]; then
364 generate_img 401 generate_img
365 else 402 else
366 generate_omaha 403 generate_omaha
367 fi 404 fi
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698