mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-24 23:21:17 +02:00
Add legacy fixup for diskimg
make_factory_package.sh --diskimg can now boot on H2O bios. BUG=chromeium-os:10915 TEST=boots Change-Id: I8358247e475fa2d4298e225fa9445b00e4dad253 Review URL: http://codereview.chromium.org/6296001 (cherry picked from commit 10418cc13c298f3514fdc5898655132cb9b09037) Review URL: http://codereview.chromium.org/6278003
This commit is contained in:
parent
7bac5ab46f
commit
2a517638ef
@ -191,6 +191,21 @@ else
|
|||||||
IMAGE_IS_UNPACKED=1
|
IMAGE_IS_UNPACKED=1
|
||||||
fi
|
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() {
|
generate_img() {
|
||||||
local outdev="$(readlink -f "$FLAGS_diskimg")"
|
local outdev="$(readlink -f "$FLAGS_diskimg")"
|
||||||
local sectors="$FLAGS_sectors"
|
local sectors="$FLAGS_sectors"
|
||||||
@ -202,10 +217,8 @@ generate_img() {
|
|||||||
|
|
||||||
echo "Release Kernel"
|
echo "Release Kernel"
|
||||||
image_partition_copy "${RELEASE_IMAGE}" 2 "${outdev}" 4
|
image_partition_copy "${RELEASE_IMAGE}" 2 "${outdev}" 4
|
||||||
|
|
||||||
echo "Release Rootfs"
|
echo "Release Rootfs"
|
||||||
image_partition_copy "${RELEASE_IMAGE}" 3 "${outdev}" 5
|
image_partition_copy "${RELEASE_IMAGE}" 3 "${outdev}" 5
|
||||||
|
|
||||||
echo "OEM parition"
|
echo "OEM parition"
|
||||||
image_partition_copy "${RELEASE_IMAGE}" 8 "${outdev}" 8
|
image_partition_copy "${RELEASE_IMAGE}" 8 "${outdev}" 8
|
||||||
|
|
||||||
@ -223,6 +236,30 @@ generate_img() {
|
|||||||
echo "EFI Partition"
|
echo "EFI Partition"
|
||||||
image_partition_copy "${FACTORY_IMAGE}" 12 "${outdev}" 12
|
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 "Generated Image at $outdev."
|
||||||
echo "Done"
|
echo "Done"
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user