summaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2016-01-14 14:12:56 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-01-18 11:47:06 +0000
commit4d5d5dd428e8d8fa0e155988286f3b45f47e1544 (patch)
tree7870f309f56ca9cc804640416c86d8dc880ff7db /scripts/lib/wic
parent26fb2a1a45049fd5731ae83efb962a84afb14568 (diff)
downloadpoky-4d5d5dd428e8d8fa0e155988286f3b45f47e1544.tar.gz
wic: get rid of get_timeout getter
Used bootloader.timeout instead of kickstart.get_timeout getter. Accessing attributes instead of getting them with getters is more pythonic, shorter and readable. It also more consistent as most of partition and bootloader attributes are used this way. This change also takes care of appendLine bootloader attribute: it's renamed to bootloader.append attribute provided by new parser. (From OE-Core rev: 8088caeff5bf4ee9279b47a69c9f1e5537909601) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/wic')
-rw-r--r--scripts/lib/wic/plugins/source/bootimg-efi.py18
-rw-r--r--scripts/lib/wic/plugins/source/bootimg-pcbios.py9
-rw-r--r--scripts/lib/wic/plugins/source/isoimage-isohybrid.py16
-rw-r--r--scripts/lib/wic/plugins/source/rootfs_pcbios_ext.py5
4 files changed, 16 insertions, 32 deletions
diff --git a/scripts/lib/wic/plugins/source/bootimg-efi.py b/scripts/lib/wic/plugins/source/bootimg-efi.py
index 556586f322..35afa30ea6 100644
--- a/scripts/lib/wic/plugins/source/bootimg-efi.py
+++ b/scripts/lib/wic/plugins/source/bootimg-efi.py
@@ -66,16 +66,13 @@ class BootimgEFIPlugin(SourcePlugin):
66 grubefi_conf = "" 66 grubefi_conf = ""
67 grubefi_conf += "serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1\n" 67 grubefi_conf += "serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1\n"
68 grubefi_conf += "default=boot\n" 68 grubefi_conf += "default=boot\n"
69 timeout = kickstart.get_timeout(creator.ks) 69 grubefi_conf += "timeout=%s\n" % bootloader.timeout
70 if not timeout:
71 timeout = 0
72 grubefi_conf += "timeout=%s\n" % timeout
73 grubefi_conf += "menuentry 'boot'{\n" 70 grubefi_conf += "menuentry 'boot'{\n"
74 71
75 kernel = "/bzImage" 72 kernel = "/bzImage"
76 73
77 grubefi_conf += "linux %s root=%s rootwait %s\n" \ 74 grubefi_conf += "linux %s root=%s rootwait %s\n" \
78 % (kernel, creator.rootdev, options) 75 % (kernel, creator.rootdev, bootloader.append)
79 grubefi_conf += "}\n" 76 grubefi_conf += "}\n"
80 77
81 msger.debug("Writing grubefi config %s/hdd/boot/EFI/BOOT/grub.cfg" \ 78 msger.debug("Writing grubefi config %s/hdd/boot/EFI/BOOT/grub.cfg" \
@@ -95,15 +92,11 @@ class BootimgEFIPlugin(SourcePlugin):
95 install_cmd = "install -d %s/loader/entries" % hdddir 92 install_cmd = "install -d %s/loader/entries" % hdddir
96 exec_cmd(install_cmd) 93 exec_cmd(install_cmd)
97 94
98 options = creator.ks.handler.bootloader.appendLine 95 bootloader = creator.ks.bootloader
99
100 timeout = kickstart.get_timeout(creator.ks)
101 if not timeout:
102 timeout = 0
103 96
104 loader_conf = "" 97 loader_conf = ""
105 loader_conf += "default boot\n" 98 loader_conf += "default boot\n"
106 loader_conf += "timeout %d\n" % timeout 99 loader_conf += "timeout %d\n" % bootloader.timeout
107 100
108 msger.debug("Writing gummiboot config %s/hdd/boot/loader/loader.conf" \ 101 msger.debug("Writing gummiboot config %s/hdd/boot/loader/loader.conf" \
109 % cr_workdir) 102 % cr_workdir)
@@ -131,7 +124,8 @@ class BootimgEFIPlugin(SourcePlugin):
131 boot_conf = "" 124 boot_conf = ""
132 boot_conf += "title boot\n" 125 boot_conf += "title boot\n"
133 boot_conf += "linux %s\n" % kernel 126 boot_conf += "linux %s\n" % kernel
134 boot_conf += "options LABEL=Boot root=%s %s\n" % (creator.rootdev, options) 127 boot_conf += "options LABEL=Boot root=%s %s\n" % \
128 (creator.rootdev, bootloader.append)
135 129
136 msger.debug("Writing gummiboot config %s/hdd/boot/loader/entries/boot.conf" \ 130 msger.debug("Writing gummiboot config %s/hdd/boot/loader/entries/boot.conf" \
137 % cr_workdir) 131 % cr_workdir)
diff --git a/scripts/lib/wic/plugins/source/bootimg-pcbios.py b/scripts/lib/wic/plugins/source/bootimg-pcbios.py
index 80c7dfb65e..255684b386 100644
--- a/scripts/lib/wic/plugins/source/bootimg-pcbios.py
+++ b/scripts/lib/wic/plugins/source/bootimg-pcbios.py
@@ -105,14 +105,9 @@ class BootimgPcbiosPlugin(SourcePlugin):
105 else: 105 else:
106 splashline = "" 106 splashline = ""
107 107
108 options = creator.ks.handler.bootloader.appendLine
109
110 syslinux_conf = "" 108 syslinux_conf = ""
111 syslinux_conf += "PROMPT 0\n" 109 syslinux_conf += "PROMPT 0\n"
112 timeout = kickstart.get_timeout(creator.ks) 110 syslinux_conf += "TIMEOUT " + str(bootloader.timeout) + "\n"
113 if not timeout:
114 timeout = 0
115 syslinux_conf += "TIMEOUT " + str(timeout) + "\n"
116 syslinux_conf += "\n" 111 syslinux_conf += "\n"
117 syslinux_conf += "ALLOWOPTIONS 1\n" 112 syslinux_conf += "ALLOWOPTIONS 1\n"
118 syslinux_conf += "SERIAL 0 115200\n" 113 syslinux_conf += "SERIAL 0 115200\n"
@@ -126,7 +121,7 @@ class BootimgPcbiosPlugin(SourcePlugin):
126 syslinux_conf += "KERNEL " + kernel + "\n" 121 syslinux_conf += "KERNEL " + kernel + "\n"
127 122
128 syslinux_conf += "APPEND label=boot root=%s %s\n" % \ 123 syslinux_conf += "APPEND label=boot root=%s %s\n" % \
129 (creator.rootdev, options) 124 (creator.rootdev, bootloader.append)
130 125
131 msger.debug("Writing syslinux config %s/hdd/boot/syslinux.cfg" \ 126 msger.debug("Writing syslinux config %s/hdd/boot/syslinux.cfg" \
132 % cr_workdir) 127 % cr_workdir)
diff --git a/scripts/lib/wic/plugins/source/isoimage-isohybrid.py b/scripts/lib/wic/plugins/source/isoimage-isohybrid.py
index 9472d8abb9..9ad0bc7c9b 100644
--- a/scripts/lib/wic/plugins/source/isoimage-isohybrid.py
+++ b/scripts/lib/wic/plugins/source/isoimage-isohybrid.py
@@ -64,13 +64,11 @@ class IsoImagePlugin(SourcePlugin):
64 else: 64 else:
65 splashline = "" 65 splashline = ""
66 66
67 options = creator.ks.handler.bootloader.appendLine 67 bootloader = creator.ks.bootloader
68
69 timeout = kickstart.get_timeout(creator.ks, 10)
70 68
71 syslinux_conf = "" 69 syslinux_conf = ""
72 syslinux_conf += "PROMPT 0\n" 70 syslinux_conf += "PROMPT 0\n"
73 syslinux_conf += "TIMEOUT %s \n" % timeout 71 syslinux_conf += "TIMEOUT %s \n" % (bootloader.timeout or 10)
74 syslinux_conf += "\n" 72 syslinux_conf += "\n"
75 syslinux_conf += "ALLOWOPTIONS 1\n" 73 syslinux_conf += "ALLOWOPTIONS 1\n"
76 syslinux_conf += "SERIAL 0 115200\n" 74 syslinux_conf += "SERIAL 0 115200\n"
@@ -82,7 +80,8 @@ class IsoImagePlugin(SourcePlugin):
82 80
83 kernel = "/bzImage" 81 kernel = "/bzImage"
84 syslinux_conf += "KERNEL " + kernel + "\n" 82 syslinux_conf += "KERNEL " + kernel + "\n"
85 syslinux_conf += "APPEND initrd=/initrd LABEL=boot %s\n" % options 83 syslinux_conf += "APPEND initrd=/initrd LABEL=boot %s\n" \
84 % bootloader.append
86 85
87 msger.debug("Writing syslinux config %s/ISO/isolinux/isolinux.cfg" \ 86 msger.debug("Writing syslinux config %s/ISO/isolinux/isolinux.cfg" \
88 % cr_workdir) 87 % cr_workdir)
@@ -100,14 +99,13 @@ class IsoImagePlugin(SourcePlugin):
100 else: 99 else:
101 splashline = "" 100 splashline = ""
102 101
103 options = creator.ks.handler.bootloader.appendLine 102 bootloader = creator.ks.bootloader
104 103
105 grubefi_conf = "" 104 grubefi_conf = ""
106 grubefi_conf += "serial --unit=0 --speed=115200 --word=8 " 105 grubefi_conf += "serial --unit=0 --speed=115200 --word=8 "
107 grubefi_conf += "--parity=no --stop=1\n" 106 grubefi_conf += "--parity=no --stop=1\n"
108 grubefi_conf += "default=boot\n" 107 grubefi_conf += "default=boot\n"
109 timeout = kickstart.get_timeout(creator.ks, 10) 108 grubefi_conf += "timeout=%s\n" % (bootloader.timeout or 10)
110 grubefi_conf += "timeout=%s\n" % timeout
111 grubefi_conf += "\n" 109 grubefi_conf += "\n"
112 grubefi_conf += "search --set=root --label %s " % part.label 110 grubefi_conf += "search --set=root --label %s " % part.label
113 grubefi_conf += "\n" 111 grubefi_conf += "\n"
@@ -116,7 +114,7 @@ class IsoImagePlugin(SourcePlugin):
116 kernel = "/bzImage" 114 kernel = "/bzImage"
117 115
118 grubefi_conf += "linux %s rootwait %s\n" \ 116 grubefi_conf += "linux %s rootwait %s\n" \
119 % (kernel, options) 117 % (kernel, bootloader.append)
120 grubefi_conf += "initrd /initrd \n" 118 grubefi_conf += "initrd /initrd \n"
121 grubefi_conf += "}\n" 119 grubefi_conf += "}\n"
122 120
diff --git a/scripts/lib/wic/plugins/source/rootfs_pcbios_ext.py b/scripts/lib/wic/plugins/source/rootfs_pcbios_ext.py
index 4280ff7f3e..bdf1b54cb2 100644
--- a/scripts/lib/wic/plugins/source/rootfs_pcbios_ext.py
+++ b/scripts/lib/wic/plugins/source/rootfs_pcbios_ext.py
@@ -83,10 +83,7 @@ class RootfsPlugin(SourcePlugin):
83 syslinux_conf = "" 83 syslinux_conf = ""
84 syslinux_conf += "PROMPT 0\n" 84 syslinux_conf += "PROMPT 0\n"
85 85
86 timeout = kickstart.get_timeout(image_creator.ks) 86 syslinux_conf += "TIMEOUT " + str(bootloader.timeout) + "\n"
87 if not timeout:
88 timeout = 0
89 syslinux_conf += "TIMEOUT " + str(timeout) + "\n"
90 syslinux_conf += "ALLOWOPTIONS 1\n" 87 syslinux_conf += "ALLOWOPTIONS 1\n"
91 88
92 # Derive SERIAL... line from from kernel boot parameters 89 # Derive SERIAL... line from from kernel boot parameters