From 3fa29024e102fc0d3ae77a3224cde41008beaa41 Mon Sep 17 00:00:00 2001 From: Michael Marineau Date: Mon, 8 Jul 2013 16:28:12 -0400 Subject: [PATCH] fix(build_image): Configure legacy bootloaders to set root by UUID. Make use of the new partition UUIDs for ROOT-A and ROOT-B in the root= kernel parameters provided by the legacy (non-kexec) bootloaders. This makes all of our images bootable as-is without having to pass them through image_to_vm.sh. :-D --- build_library/cgpt.py | 24 +++++++++++++ .../create_legacy_bootloader_templates.sh | 17 +++++---- build_library/disk_layout_util.sh | 8 +++++ image_to_vm.sh | 35 ------------------- 4 files changed, 42 insertions(+), 42 deletions(-) diff --git a/build_library/cgpt.py b/build_library/cgpt.py index 57ad46b247..b2980cded9 100755 --- a/build_library/cgpt.py +++ b/build_library/cgpt.py @@ -485,6 +485,26 @@ def GetNum(options, image_type, layout_filename, label): return '-1' +def GetUuid(options, image_type, layout_filename, label): + """Returns the unique partition UUID for a given label. + + Note: Only useful if the UUID is specified in the config file, otherwise + the value returned unlikely to be what is actually used in the image. + + Args: + options: Flags passed to the script + image_type: Type of image eg base/test/dev/prod + layout_filename: Path to partition configuration file + label: Label of the partition you want to read from + Returns: + String containing the requested UUID + """ + + partitions = GetPartitionTableFromConfig(options, layout_filename, image_type) + partition = GetPartitionByLabel(partitions, label) + return partition['uuid'] + + def DoDebugOutput(options, image_type, layout_filename): """Prints out a human readable disk layout in on-disk order. @@ -557,6 +577,10 @@ def main(argv): 'usage': ['', '', '