diff options
Diffstat (limited to 'scripts/lib/wic/plugins/source/bootimg-efi.py')
-rw-r--r-- | scripts/lib/wic/plugins/source/bootimg-efi.py | 67 |
1 files changed, 49 insertions, 18 deletions
diff --git a/scripts/lib/wic/plugins/source/bootimg-efi.py b/scripts/lib/wic/plugins/source/bootimg-efi.py index fa63c6abda..5feb79dbf1 100644 --- a/scripts/lib/wic/plugins/source/bootimg-efi.py +++ b/scripts/lib/wic/plugins/source/bootimg-efi.py | |||
@@ -29,6 +29,7 @@ import shutil | |||
29 | 29 | ||
30 | from wic import kickstart, msger | 30 | from wic import kickstart, msger |
31 | from wic.pluginbase import SourcePlugin | 31 | from wic.pluginbase import SourcePlugin |
32 | from wic.utils.misc import get_custom_config | ||
32 | from wic.utils.oe.misc import exec_cmd, exec_native_cmd, get_bitbake_var, \ | 33 | from wic.utils.oe.misc import exec_cmd, exec_native_cmd, get_bitbake_var, \ |
33 | BOOTDD_EXTRA_SPACE | 34 | BOOTDD_EXTRA_SPACE |
34 | 35 | ||
@@ -45,22 +46,37 @@ class BootimgEFIPlugin(SourcePlugin): | |||
45 | """ | 46 | """ |
46 | Create loader-specific (grub-efi) config | 47 | Create loader-specific (grub-efi) config |
47 | """ | 48 | """ |
48 | options = creator.ks.handler.bootloader.appendLine | 49 | configfile = kickstart.get_bootloader_file(creator.ks) |
50 | custom_cfg = None | ||
51 | if configfile: | ||
52 | custom_cfg = get_custom_config(configfile) | ||
53 | if custom_cfg: | ||
54 | # Use a custom configuration for grub | ||
55 | grubefi_conf = custom_cfg | ||
56 | msger.debug("Using custom configuration file " | ||
57 | "%s for grub.cfg" % configfile) | ||
58 | else: | ||
59 | msger.error("configfile is specified but failed to " | ||
60 | "get it from %s." % configfile) | ||
49 | 61 | ||
50 | grubefi_conf = "" | 62 | if not custom_cfg: |
51 | grubefi_conf += "serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1\n" | 63 | # Create grub configuration using parameters from wks file |
52 | grubefi_conf += "default=boot\n" | 64 | options = creator.ks.handler.bootloader.appendLine |
53 | timeout = kickstart.get_timeout(creator.ks) | 65 | |
54 | if not timeout: | 66 | grubefi_conf = "" |
55 | timeout = 0 | 67 | grubefi_conf += "serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1\n" |
56 | grubefi_conf += "timeout=%s\n" % timeout | 68 | grubefi_conf += "default=boot\n" |
57 | grubefi_conf += "menuentry 'boot'{\n" | 69 | timeout = kickstart.get_timeout(creator.ks) |
70 | if not timeout: | ||
71 | timeout = 0 | ||
72 | grubefi_conf += "timeout=%s\n" % timeout | ||
73 | grubefi_conf += "menuentry 'boot'{\n" | ||
58 | 74 | ||
59 | kernel = "/bzImage" | 75 | kernel = "/bzImage" |
60 | 76 | ||
61 | grubefi_conf += "linux %s root=%s rootwait %s\n" \ | 77 | grubefi_conf += "linux %s root=%s rootwait %s\n" \ |
62 | % (kernel, creator.rootdev, options) | 78 | % (kernel, creator.rootdev, options) |
63 | grubefi_conf += "}\n" | 79 | grubefi_conf += "}\n" |
64 | 80 | ||
65 | msger.debug("Writing grubefi config %s/hdd/boot/EFI/BOOT/grub.cfg" \ | 81 | msger.debug("Writing grubefi config %s/hdd/boot/EFI/BOOT/grub.cfg" \ |
66 | % cr_workdir) | 82 | % cr_workdir) |
@@ -95,12 +111,27 @@ class BootimgEFIPlugin(SourcePlugin): | |||
95 | cfg.write(loader_conf) | 111 | cfg.write(loader_conf) |
96 | cfg.close() | 112 | cfg.close() |
97 | 113 | ||
98 | kernel = "/bzImage" | 114 | configfile = kickstart.get_bootloader_file(creator.ks) |
115 | custom_cfg = None | ||
116 | if configfile: | ||
117 | custom_cfg = get_custom_config(configfile) | ||
118 | if custom_cfg: | ||
119 | # Use a custom configuration for gummiboot | ||
120 | boot_conf = custom_cfg | ||
121 | msger.debug("Using custom configuration file " | ||
122 | "%s for gummiboots's boot.conf" % configfile) | ||
123 | else: | ||
124 | msger.error("configfile is specified but failed to " | ||
125 | "get it from %s." % configfile) | ||
126 | |||
127 | if not custom_cfg: | ||
128 | # Create gummiboot configuration using parameters from wks file | ||
129 | kernel = "/bzImage" | ||
99 | 130 | ||
100 | boot_conf = "" | 131 | boot_conf = "" |
101 | boot_conf += "title boot\n" | 132 | boot_conf += "title boot\n" |
102 | boot_conf += "linux %s\n" % kernel | 133 | boot_conf += "linux %s\n" % kernel |
103 | boot_conf += "options LABEL=Boot root=%s %s\n" % (creator.rootdev, options) | 134 | boot_conf += "options LABEL=Boot root=%s %s\n" % (creator.rootdev, options) |
104 | 135 | ||
105 | msger.debug("Writing gummiboot config %s/hdd/boot/loader/entries/boot.conf" \ | 136 | msger.debug("Writing gummiboot config %s/hdd/boot/loader/entries/boot.conf" \ |
106 | % cr_workdir) | 137 | % cr_workdir) |