mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-11-24 10:14:55 +00:00
make_dev_ssd.sh: support updating legacy boot partitions
Change the boot default option in partition 12 (ESP) when we want to disable
rootfs verification.
BUG=chromium-os:12424
TEST=./make_dev_ssd --remove_rootfs_verification --recovery_key -i USB_IMAGE
# the image is bootable by H2C and H2C BIOS(EFI).
# Not tried on non-EFI (syslinux) firmware, but it should work.
Change-Id: I7533bb73597041bbdc8cc57e4e8baaf6ca242309
R=wfrichar@chromium.org
Review URL: http://codereview.chromium.org/6813109
This commit is contained in:
@@ -61,6 +61,22 @@ is_rootfs_verification_enabled() {
|
|||||||
echo "$*" | grep -q 'root=/dev/dm-0'
|
echo "$*" | grep -q 'root=/dev/dm-0'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
remove_legacy_boot_rootfs_verification() {
|
||||||
|
# See src/scripts/create_legacy_bootloader_templates
|
||||||
|
local image="$1"
|
||||||
|
local mount_point="$(make_temp_dir)"
|
||||||
|
local config_file
|
||||||
|
debug_msg "Removing rootfs verification for legacy boot configuration."
|
||||||
|
mount_image_partition "$image" 12 "$mount_point" || return $FLAGS_FALSE
|
||||||
|
config_file="$mount_point/efi/boot/grub.cfg"
|
||||||
|
[ ! -f "$config_file" ] ||
|
||||||
|
sudo sed -i 's/^ *set default=2 *$/set default=0/g' "$config_file"
|
||||||
|
config_file="$mount_point/syslinux/default.cfg"
|
||||||
|
[ ! -f "$config_file" ] ||
|
||||||
|
sudo sed -i 's/-vusb/-usb/g; s/-vhd/-hd/g' "$config_file"
|
||||||
|
sudo umount "$mount_point"
|
||||||
|
}
|
||||||
|
|
||||||
# Wrapped version of dd
|
# Wrapped version of dd
|
||||||
mydd() {
|
mydd() {
|
||||||
# oflag=sync is safer, but since we need bs=512, syncing every block would be
|
# oflag=sync is safer, but since we need bs=512, syncing every block would be
|
||||||
@@ -158,6 +174,7 @@ resign_ssd_kernel() {
|
|||||||
kernel_config="$(remove_rootfs_verification "$kernel_config")"
|
kernel_config="$(remove_rootfs_verification "$kernel_config")"
|
||||||
debug_msg "New kernel config: $kernel_config"
|
debug_msg "New kernel config: $kernel_config"
|
||||||
echo "$name: Disabled rootfs verification."
|
echo "$name: Disabled rootfs verification."
|
||||||
|
remove_legacy_boot_rootfs_verification "$ssd_device"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local new_kernel_config_file="$(make_temp_file)"
|
local new_kernel_config_file="$(make_temp_file)"
|
||||||
@@ -287,4 +304,11 @@ main() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# People using this to process images may forget to add "-i",
|
||||||
|
# so adding parameter check is safer.
|
||||||
|
if [ "$#" -gt 0 ]; then
|
||||||
|
flags_help
|
||||||
|
err_die "Unknown parameters: $@"
|
||||||
|
fi
|
||||||
|
|
||||||
main
|
main
|
||||||
|
|||||||
Reference in New Issue
Block a user