diff options
Diffstat (limited to 'meta/classes/syslinux.bbclass')
| -rw-r--r-- | meta/classes/syslinux.bbclass | 278 |
1 files changed, 139 insertions, 139 deletions
diff --git a/meta/classes/syslinux.bbclass b/meta/classes/syslinux.bbclass index 700ea53911..c4596bffce 100644 --- a/meta/classes/syslinux.bbclass +++ b/meta/classes/syslinux.bbclass | |||
| @@ -54,146 +54,146 @@ syslinux_hddimg_install() { | |||
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | python build_syslinux_menu () { | 56 | python build_syslinux_menu () { |
| 57 | import copy | 57 | import copy |
| 58 | import sys | 58 | import sys |
| 59 | 59 | ||
| 60 | workdir = d.getVar('WORKDIR', True) | 60 | workdir = d.getVar('WORKDIR', True) |
| 61 | if not workdir: | 61 | if not workdir: |
| 62 | bb.error("WORKDIR is not defined") | 62 | bb.error("WORKDIR is not defined") |
| 63 | return | 63 | return |
| 64 | 64 | ||
| 65 | labels = d.getVar('LABELS', True) | 65 | labels = d.getVar('LABELS', True) |
| 66 | if not labels: | 66 | if not labels: |
| 67 | bb.debug(1, "LABELS not defined, nothing to do") | 67 | bb.debug(1, "LABELS not defined, nothing to do") |
| 68 | return | 68 | return |
| 69 | 69 | ||
| 70 | if labels == []: | 70 | if labels == []: |
| 71 | bb.debug(1, "No labels, nothing to do") | 71 | bb.debug(1, "No labels, nothing to do") |
| 72 | return | 72 | return |
| 73 | 73 | ||
| 74 | cfile = d.getVar('SYSLINUXMENU', True) | 74 | cfile = d.getVar('SYSLINUXMENU', True) |
| 75 | if not cfile: | 75 | if not cfile: |
| 76 | raise bb.build.FuncFailed('Unable to read SYSLINUXMENU') | 76 | raise bb.build.FuncFailed('Unable to read SYSLINUXMENU') |
| 77 | 77 | ||
| 78 | try: | 78 | try: |
| 79 | cfgfile = file(cfile, 'w') | 79 | cfgfile = file(cfile, 'w') |
| 80 | except OSError: | 80 | except OSError: |
| 81 | raise bb.build.funcFailed('Unable to open %s' % (cfile)) | 81 | raise bb.build.funcFailed('Unable to open %s' % (cfile)) |
| 82 | 82 | ||
| 83 | # Beep the speaker and Clear the screen | 83 | # Beep the speaker and Clear the screen |
| 84 | cfgfile.write('\x07\x0C') | 84 | cfgfile.write('\x07\x0C') |
| 85 | 85 | ||
| 86 | # The title should be configurable | 86 | # The title should be configurable |
| 87 | cfgfile.write('Linux Boot Menu\n') | 87 | cfgfile.write('Linux Boot Menu\n') |
| 88 | cfgfile.write('The following targets are available on this image:\n') | 88 | cfgfile.write('The following targets are available on this image:\n') |
| 89 | cfgfile.write('\n') | 89 | cfgfile.write('\n') |
| 90 | 90 | ||
| 91 | for label in labels.split(): | 91 | for label in labels.split(): |
| 92 | from copy import deepcopy | 92 | from copy import deepcopy |
| 93 | localdata = deepcopy(d) | 93 | localdata = deepcopy(d) |
| 94 | 94 | ||
| 95 | overrides = localdata.getVar('OVERRIDES') | 95 | overrides = localdata.getVar('OVERRIDES') |
| 96 | if not overrides: | 96 | if not overrides: |
| 97 | raise bb.build.FuncFailed('OVERRIDES not defined') | 97 | raise bb.build.FuncFailed('OVERRIDES not defined') |
| 98 | overrides = localdata.expand(overrides) | 98 | overrides = localdata.expand(overrides) |
| 99 | 99 | ||
| 100 | localdata.setVar('OVERRIDES', label + ':' + overrides) | 100 | localdata.setVar('OVERRIDES', label + ':' + overrides) |
| 101 | bb.data.update_data(localdata) | 101 | bb.data.update_data(localdata) |
| 102 | 102 | ||
| 103 | usage = localdata.getVar('USAGE', True) | 103 | usage = localdata.getVar('USAGE', True) |
| 104 | cfgfile.write(' \x0F\x30\x3E%16s\x0F\x30\x37: ' % (label)) | 104 | cfgfile.write(' \x0F\x30\x3E%16s\x0F\x30\x37: ' % (label)) |
| 105 | cfgfile.write('%s\n' % (usage)) | 105 | cfgfile.write('%s\n' % (usage)) |
| 106 | 106 | ||
| 107 | del localdata | 107 | del localdata |
| 108 | 108 | ||
| 109 | cfgfile.write('\n') | 109 | cfgfile.write('\n') |
| 110 | cfgfile.close() | 110 | cfgfile.close() |
| 111 | } | 111 | } |
| 112 | 112 | ||
| 113 | python build_syslinux_cfg () { | 113 | python build_syslinux_cfg () { |
| 114 | import copy | 114 | import copy |
| 115 | import sys | 115 | import sys |
| 116 | 116 | ||
| 117 | workdir = d.getVar('WORKDIR', True) | 117 | workdir = d.getVar('WORKDIR', True) |
| 118 | if not workdir: | 118 | if not workdir: |
| 119 | bb.error("WORKDIR not defined, unable to package") | 119 | bb.error("WORKDIR not defined, unable to package") |
| 120 | return | 120 | return |
| 121 | 121 | ||
| 122 | labels = d.getVar('LABELS', True) | 122 | labels = d.getVar('LABELS', True) |
| 123 | if not labels: | 123 | if not labels: |
| 124 | bb.debug(1, "LABELS not defined, nothing to do") | 124 | bb.debug(1, "LABELS not defined, nothing to do") |
| 125 | return | 125 | return |
| 126 | 126 | ||
| 127 | if labels == []: | 127 | if labels == []: |
| 128 | bb.debug(1, "No labels, nothing to do") | 128 | bb.debug(1, "No labels, nothing to do") |
| 129 | return | 129 | return |
| 130 | 130 | ||
| 131 | cfile = d.getVar('SYSLINUXCFG', True) | 131 | cfile = d.getVar('SYSLINUXCFG', True) |
| 132 | if not cfile: | 132 | if not cfile: |
| 133 | raise bb.build.FuncFailed('Unable to read SYSLINUXCFG') | 133 | raise bb.build.FuncFailed('Unable to read SYSLINUXCFG') |
| 134 | 134 | ||
| 135 | try: | 135 | try: |
| 136 | cfgfile = file(cfile, 'w') | 136 | cfgfile = file(cfile, 'w') |
| 137 | except OSError: | 137 | except OSError: |
| 138 | raise bb.build.funcFailed('Unable to open %s' % (cfile)) | 138 | raise bb.build.funcFailed('Unable to open %s' % (cfile)) |
| 139 | 139 | ||
| 140 | cfgfile.write('# Automatically created by OE\n') | 140 | cfgfile.write('# Automatically created by OE\n') |
| 141 | 141 | ||
| 142 | opts = d.getVar('SYSLINUX_OPTS', True) | 142 | opts = d.getVar('SYSLINUX_OPTS', True) |
| 143 | 143 | ||
| 144 | if opts: | 144 | if opts: |
| 145 | for opt in opts.split(';'): | 145 | for opt in opts.split(';'): |
| 146 | cfgfile.write('%s\n' % opt) | 146 | cfgfile.write('%s\n' % opt) |
| 147 | 147 | ||
| 148 | cfgfile.write('ALLOWOPTIONS 1\n'); | 148 | cfgfile.write('ALLOWOPTIONS 1\n'); |
| 149 | cfgfile.write('DEFAULT %s\n' % (labels.split()[0])) | 149 | cfgfile.write('DEFAULT %s\n' % (labels.split()[0])) |
| 150 | 150 | ||
| 151 | timeout = d.getVar('SYSLINUX_TIMEOUT', True) | 151 | timeout = d.getVar('SYSLINUX_TIMEOUT', True) |
| 152 | 152 | ||
| 153 | if timeout: | 153 | if timeout: |
| 154 | cfgfile.write('TIMEOUT %s\n' % timeout) | 154 | cfgfile.write('TIMEOUT %s\n' % timeout) |
| 155 | else: | 155 | else: |
| 156 | cfgfile.write('TIMEOUT 50\n') | 156 | cfgfile.write('TIMEOUT 50\n') |
| 157 | 157 | ||
| 158 | prompt = d.getVar('SYSLINUX_PROMPT', True) | 158 | prompt = d.getVar('SYSLINUX_PROMPT', True) |
| 159 | if prompt: | 159 | if prompt: |
| 160 | cfgfile.write('PROMPT %s\n' % prompt) | 160 | cfgfile.write('PROMPT %s\n' % prompt) |
| 161 | else: | 161 | else: |
| 162 | cfgfile.write('PROMPT 1\n') | 162 | cfgfile.write('PROMPT 1\n') |
| 163 | 163 | ||
| 164 | menu = d.getVar('AUTO_SYSLINUXMENU', True) | 164 | menu = d.getVar('AUTO_SYSLINUXMENU', True) |
| 165 | 165 | ||
| 166 | # This is ugly. My bad. | 166 | # This is ugly. My bad. |
| 167 | 167 | ||
| 168 | if menu: | 168 | if menu: |
| 169 | bb.build.exec_func('build_syslinux_menu', d) | 169 | bb.build.exec_func('build_syslinux_menu', d) |
| 170 | mfile = d.getVar('SYSLINUXMENU', True) | 170 | mfile = d.getVar('SYSLINUXMENU', True) |
| 171 | cfgfile.write('DISPLAY %s\n' % (mfile.split('/')[-1]) ) | 171 | cfgfile.write('DISPLAY %s\n' % (mfile.split('/')[-1]) ) |
| 172 | 172 | ||
| 173 | for label in labels.split(): | 173 | for label in labels.split(): |
| 174 | localdata = bb.data.createCopy(d) | 174 | localdata = bb.data.createCopy(d) |
| 175 | 175 | ||
| 176 | overrides = localdata.getVar('OVERRIDES', True) | 176 | overrides = localdata.getVar('OVERRIDES', True) |
| 177 | if not overrides: | 177 | if not overrides: |
| 178 | raise bb.build.FuncFailed('OVERRIDES not defined') | 178 | raise bb.build.FuncFailed('OVERRIDES not defined') |
| 179 | 179 | ||
| 180 | localdata.setVar('OVERRIDES', label + ':' + overrides) | 180 | localdata.setVar('OVERRIDES', label + ':' + overrides) |
| 181 | bb.data.update_data(localdata) | 181 | bb.data.update_data(localdata) |
| 182 | 182 | ||
| 183 | cfgfile.write('LABEL %s\nKERNEL /vmlinuz\n' % (label)) | 183 | cfgfile.write('LABEL %s\nKERNEL /vmlinuz\n' % (label)) |
| 184 | 184 | ||
| 185 | append = localdata.getVar('APPEND', True) | 185 | append = localdata.getVar('APPEND', True) |
| 186 | initrd = localdata.getVar('INITRD', True) | 186 | initrd = localdata.getVar('INITRD', True) |
| 187 | 187 | ||
| 188 | if append: | 188 | if append: |
| 189 | cfgfile.write('APPEND ') | 189 | cfgfile.write('APPEND ') |
| 190 | 190 | ||
| 191 | if initrd: | 191 | if initrd: |
| 192 | cfgfile.write('initrd=/initrd ') | 192 | cfgfile.write('initrd=/initrd ') |
| 193 | 193 | ||
| 194 | cfgfile.write('LABEL=%s '% (label)) | 194 | cfgfile.write('LABEL=%s '% (label)) |
| 195 | 195 | ||
| 196 | cfgfile.write('%s\n' % (append)) | 196 | cfgfile.write('%s\n' % (append)) |
| 197 | 197 | ||
| 198 | cfgfile.close() | 198 | cfgfile.close() |
| 199 | } | 199 | } |
