diff options
author | Ioan-Adrian Ratiu <adrian.ratiu@ni.com> | 2016-04-20 18:06:15 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-04-29 07:58:44 +0100 |
commit | 222c5c65b1daa406ca8ccdd39bf2622ecd931f33 (patch) | |
tree | b0f5a2e2bd79c4c5d3ca9adf47267d93076e44bc | |
parent | 5073e5bbf13a3acf2716849a8a2a1ecd7d78c341 (diff) | |
download | poky-222c5c65b1daa406ca8ccdd39bf2622ecd931f33.tar.gz |
wic: isoimage-isohybrid: add grubefi configfile support
The latest wic kickstart refactoring introduced a bootloader option
"--configfile" which lets wks' specify a custom grub.cfg for use
while booting. This is very useful for creating stuff like boot menus.
This change lets isoimage-isohybrid use --configfile; if this option is
not specified in a wks, it generates a default cfg as before.
(From OE-Core rev: bf673a769514b13558ad9c785ae4da3a5adfd1e0)
Signed-off-by: Ioan-Adrian Ratiu <adrian.ratiu@ni.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | scripts/lib/wic/plugins/source/isoimage-isohybrid.py | 53 |
1 files changed, 32 insertions, 21 deletions
diff --git a/scripts/lib/wic/plugins/source/isoimage-isohybrid.py b/scripts/lib/wic/plugins/source/isoimage-isohybrid.py index bc9928314c..8440581629 100644 --- a/scripts/lib/wic/plugins/source/isoimage-isohybrid.py +++ b/scripts/lib/wic/plugins/source/isoimage-isohybrid.py | |||
@@ -27,6 +27,7 @@ import glob | |||
27 | 27 | ||
28 | from wic import msger | 28 | from wic import msger |
29 | from wic.pluginbase import SourcePlugin | 29 | from wic.pluginbase import SourcePlugin |
30 | from wic.utils.misc import get_custom_config | ||
30 | from wic.utils.oe.misc import exec_cmd, exec_native_cmd, get_bitbake_var | 31 | from wic.utils.oe.misc import exec_cmd, exec_native_cmd, get_bitbake_var |
31 | 32 | ||
32 | class IsoImagePlugin(SourcePlugin): | 33 | class IsoImagePlugin(SourcePlugin): |
@@ -94,33 +95,43 @@ class IsoImagePlugin(SourcePlugin): | |||
94 | """ | 95 | """ |
95 | Create loader-specific (grub-efi) config | 96 | Create loader-specific (grub-efi) config |
96 | """ | 97 | """ |
97 | splash = os.path.join(cr_workdir, "/EFI/boot/splash.jpg") | 98 | configfile = creator.ks.bootloader.configfile |
98 | if os.path.exists(splash): | 99 | if configfile: |
99 | splashline = "menu background splash.jpg" | 100 | grubefi_conf = get_custom_config(configfile) |
101 | if grubefi_conf: | ||
102 | msger.debug("Using custom configuration file " | ||
103 | "%s for grub.cfg" % configfile) | ||
104 | else: | ||
105 | msger.error("configfile is specified but failed to " | ||
106 | "get it from %s." % configfile) | ||
100 | else: | 107 | else: |
101 | splashline = "" | 108 | splash = os.path.join(cr_workdir, "/EFI/boot/splash.jpg") |
109 | if os.path.exists(splash): | ||
110 | splashline = "menu background splash.jpg" | ||
111 | else: | ||
112 | splashline = "" | ||
102 | 113 | ||
103 | bootloader = creator.ks.bootloader | 114 | bootloader = creator.ks.bootloader |
104 | 115 | ||
105 | grubefi_conf = "" | 116 | grubefi_conf = "" |
106 | grubefi_conf += "serial --unit=0 --speed=115200 --word=8 " | 117 | grubefi_conf += "serial --unit=0 --speed=115200 --word=8 " |
107 | grubefi_conf += "--parity=no --stop=1\n" | 118 | grubefi_conf += "--parity=no --stop=1\n" |
108 | grubefi_conf += "default=boot\n" | 119 | grubefi_conf += "default=boot\n" |
109 | grubefi_conf += "timeout=%s\n" % (bootloader.timeout or 10) | 120 | grubefi_conf += "timeout=%s\n" % (bootloader.timeout or 10) |
110 | grubefi_conf += "\n" | 121 | grubefi_conf += "\n" |
111 | grubefi_conf += "search --set=root --label %s " % part.label | 122 | grubefi_conf += "search --set=root --label %s " % part.label |
112 | grubefi_conf += "\n" | 123 | grubefi_conf += "\n" |
113 | grubefi_conf += "menuentry 'boot'{\n" | 124 | grubefi_conf += "menuentry 'boot'{\n" |
114 | 125 | ||
115 | kernel = "/bzImage" | 126 | kernel = "/bzImage" |
116 | 127 | ||
117 | grubefi_conf += "linux %s rootwait %s\n" \ | 128 | grubefi_conf += "linux %s rootwait %s\n" \ |
118 | % (kernel, bootloader.append) | 129 | % (kernel, bootloader.append) |
119 | grubefi_conf += "initrd /initrd \n" | 130 | grubefi_conf += "initrd /initrd \n" |
120 | grubefi_conf += "}\n" | 131 | grubefi_conf += "}\n" |
121 | 132 | ||
122 | if splashline: | 133 | if splashline: |
123 | grubefi_conf += "%s\n" % splashline | 134 | grubefi_conf += "%s\n" % splashline |
124 | 135 | ||
125 | msger.debug("Writing grubefi config %s/EFI/BOOT/grub.cfg" \ | 136 | msger.debug("Writing grubefi config %s/EFI/BOOT/grub.cfg" \ |
126 | % cr_workdir) | 137 | % cr_workdir) |