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" |
} |