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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: make_factory_package.sh
diff --git a/make_factory_package.sh b/make_factory_package.sh
index 71233fb09c4172007921878d4bde7ff9a7a76f25..ad9578bccd56c068757e99b88504c74fde4b3348 100755
--- a/make_factory_package.sh
+++ b/make_factory_package.sh
@@ -190,6 +190,21 @@ else
IMAGE_IS_UNPACKED=1
fi
+mount_esp() {
+ local image="$1"
+ local esp_mountpoint="$2"
+ offset=$(partoffset "${image}" 12)
+ sudo mount -o loop,offset=$(( offset * 512 )) \
+ "${image}" "${esp_mountpoint}"
+ ESP_MOUNT="${esp_mountpoint}"
+}
+
+umount_esp() {
+ if [ -n "${ESP_MOUNT}" ]; then
+ sudo umount "${ESP_MOUNT}"
+ fi
+}
+
generate_img() {
local outdev="$FLAGS_diskimg"
local sectors="$FLAGS_sectors"
@@ -201,10 +216,8 @@ generate_img() {
echo "Release Kernel"
image_partition_copy "${RELEASE_IMAGE}" 2 "${outdev}" 4
-
echo "Release Rootfs"
image_partition_copy "${RELEASE_IMAGE}" 3 "${outdev}" 5
-
echo "OEM parition"
image_partition_copy "${RELEASE_IMAGE}" 8 "${outdev}" 8
@@ -222,6 +235,30 @@ generate_img() {
echo "EFI Partition"
image_partition_copy "${FACTORY_IMAGE}" 12 "${outdev}" 12
+ # TODO(nsanders, wad): consolidate this code into some common code
+ # when cleaning up kernel commandlines. There is code that touches
+ # this in postint/chromeos-setimage and build_image. However none
+ # of the preexisting code actually does what we want here.
+ local tmpesp="$(mktemp -d)"
+ mount_esp "${outdev}" "${tmpesp}"
+
+ trap "umount_esp" EXIT
+
+ # Edit boot device default for legacy.
+ # Support both vboot and regular boot.
+ sudo sed -i "s/chromeos-usb.A/chromeos-hd.A/" \
+ "${tmpesp}"/syslinux/default.cfg
+ sudo sed -i "s/chromeos-vusb.A/chromeos-vhd.A/" \
+ "${tmpesp}"/syslinux/default.cfg
+
+ # Edit root fs default for legacy
+ # Somewhat safe as ARM does not support syslinux, I believe.
+ sudo sed -i "s'HDROOTA'/dev/sda3'g" "${tmpesp}"/syslinux/root.A.cfg
+
+ trap - EXIT
+
+ umount_esp
+
echo "Generated Image at $outdev."
echo "Done"
}
« 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