diff options
Diffstat (limited to 'scripts/lib/wic')
-rw-r--r-- | scripts/lib/wic/plugins/source/bootimg-efi.py | 67 | ||||
-rw-r--r-- | scripts/lib/wic/plugins/source/bootimg-pcbios.py | 72 |
2 files changed, 93 insertions, 46 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) |
diff --git a/scripts/lib/wic/plugins/source/bootimg-pcbios.py b/scripts/lib/wic/plugins/source/bootimg-pcbios.py index 96ed54dbad..80c7dfb65e 100644 --- a/scripts/lib/wic/plugins/source/bootimg-pcbios.py +++ b/scripts/lib/wic/plugins/source/bootimg-pcbios.py | |||
@@ -29,6 +29,7 @@ import os | |||
29 | from wic.utils.errors import ImageError | 29 | from wic.utils.errors import ImageError |
30 | from wic import kickstart, msger | 30 | from wic import kickstart, msger |
31 | from wic.utils import runner | 31 | from wic.utils import runner |
32 | from wic.utils.misc import get_custom_config | ||
32 | from wic.pluginbase import SourcePlugin | 33 | from wic.pluginbase import SourcePlugin |
33 | from wic.utils.oe.misc import exec_cmd, exec_native_cmd, \ | 34 | from wic.utils.oe.misc import exec_cmd, exec_native_cmd, \ |
34 | get_bitbake_var, BOOTDD_EXTRA_SPACE | 35 | get_bitbake_var, BOOTDD_EXTRA_SPACE |
@@ -83,34 +84,49 @@ class BootimgPcbiosPlugin(SourcePlugin): | |||
83 | install_cmd = "install -d %s" % hdddir | 84 | install_cmd = "install -d %s" % hdddir |
84 | exec_cmd(install_cmd) | 85 | exec_cmd(install_cmd) |
85 | 86 | ||
86 | splash = os.path.join(cr_workdir, "/hdd/boot/splash.jpg") | 87 | configfile = kickstart.get_bootloader_file(creator.ks) |
87 | if os.path.exists(splash): | 88 | custom_cfg = None |
88 | splashline = "menu background splash.jpg" | 89 | if configfile: |
89 | else: | 90 | custom_cfg = get_custom_config(configfile) |
90 | splashline = "" | 91 | if custom_cfg: |
91 | 92 | # Use a custom configuration for grub | |
92 | options = creator.ks.handler.bootloader.appendLine | 93 | syslinux_conf = custom_cfg |
93 | 94 | msger.debug("Using custom configuration file " | |
94 | syslinux_conf = "" | 95 | "%s for syslinux.cfg" % configfile) |
95 | syslinux_conf += "PROMPT 0\n" | 96 | else: |
96 | timeout = kickstart.get_timeout(creator.ks) | 97 | msger.error("configfile is specified but failed to " |
97 | if not timeout: | 98 | "get it from %s." % configfile) |
98 | timeout = 0 | 99 | |
99 | syslinux_conf += "TIMEOUT " + str(timeout) + "\n" | 100 | if not custom_cfg: |
100 | syslinux_conf += "\n" | 101 | # Create syslinux configuration using parameters from wks file |
101 | syslinux_conf += "ALLOWOPTIONS 1\n" | 102 | splash = os.path.join(cr_workdir, "/hdd/boot/splash.jpg") |
102 | syslinux_conf += "SERIAL 0 115200\n" | 103 | if os.path.exists(splash): |
103 | syslinux_conf += "\n" | 104 | splashline = "menu background splash.jpg" |
104 | if splashline: | 105 | else: |
105 | syslinux_conf += "%s\n" % splashline | 106 | splashline = "" |
106 | syslinux_conf += "DEFAULT boot\n" | 107 | |
107 | syslinux_conf += "LABEL boot\n" | 108 | options = creator.ks.handler.bootloader.appendLine |
108 | 109 | ||
109 | kernel = "/vmlinuz" | 110 | syslinux_conf = "" |
110 | syslinux_conf += "KERNEL " + kernel + "\n" | 111 | syslinux_conf += "PROMPT 0\n" |
111 | 112 | timeout = kickstart.get_timeout(creator.ks) | |
112 | syslinux_conf += "APPEND label=boot root=%s %s\n" % \ | 113 | if not timeout: |
113 | (creator.rootdev, options) | 114 | timeout = 0 |
115 | syslinux_conf += "TIMEOUT " + str(timeout) + "\n" | ||
116 | syslinux_conf += "\n" | ||
117 | syslinux_conf += "ALLOWOPTIONS 1\n" | ||
118 | syslinux_conf += "SERIAL 0 115200\n" | ||
119 | syslinux_conf += "\n" | ||
120 | if splashline: | ||
121 | syslinux_conf += "%s\n" % splashline | ||
122 | syslinux_conf += "DEFAULT boot\n" | ||
123 | syslinux_conf += "LABEL boot\n" | ||
124 | |||
125 | kernel = "/vmlinuz" | ||
126 | syslinux_conf += "KERNEL " + kernel + "\n" | ||
127 | |||
128 | syslinux_conf += "APPEND label=boot root=%s %s\n" % \ | ||
129 | (creator.rootdev, options) | ||
114 | 130 | ||
115 | msger.debug("Writing syslinux config %s/hdd/boot/syslinux.cfg" \ | 131 | msger.debug("Writing syslinux config %s/hdd/boot/syslinux.cfg" \ |
116 | % cr_workdir) | 132 | % cr_workdir) |