2 # Copyright (C) 2004-2006, Advanced Micro Devices, Inc. All Rights Reserved
3 # Released under the MIT license (see packages/COPYING)
5 # This creates a configuration file suitable for use with syslinux.
7 python build_syslinux_menu () {
11 workdir = bb.data.getVar('WORKDIR', d, 1)
13 bb.error("WORKDIR is not defined")
16 labels = bb.data.getVar('LABELS', d, 1)
18 bb.debug(1, "LABELS not defined, nothing to do")
22 bb.debug(1, "No labels, nothing to do")
25 cfile = bb.data.getVar('SYSLINUXMENU', d, 1)
27 raise bb.build.FuncFailed('Unable to read SYSLINUXMENU')
29 bb.mkdirhier(os.path.dirname(cfile))
32 cfgfile = file(cfile, 'w')
34 raise bb.build.funcFailed('Unable to open %s' % (cfile))
36 # Beep the speaker and Clear the screen
37 cfgfile.write('\x07\x0C')
39 # The title should be configurable
40 cfgfile.write('AMD Geode Linux Boot Menu\n')
41 cfgfile.write('The following targets are available on this image:\n')
44 for label in labels.split():
45 from copy import deepcopy
46 localdata = deepcopy(d)
48 overrides = bb.data.getVar('OVERRIDES', localdata)
50 raise bb.build.FuncFailed('OVERRIDES not defined')
51 overrides = bb.data.expand(overrides, localdata)
53 bb.data.setVar('OVERRIDES', label + ':' + overrides, localdata)
54 bb.data.update_data(localdata)
56 usage = bb.data.getVar('USAGE', localdata, 1)
57 cfgfile.write(' \x0F\x30\x3E%16s\x0F\x30\x37: ' % (label))
58 cfgfile.write('%s\n' % (usage))
66 python build_syslinux_cfg () {
70 workdir = bb.data.getVar('WORKDIR', d, 1)
72 bb.error("WORKDIR not defined, unable to package")
75 labels = bb.data.getVar('LABELS', d, 1)
77 bb.debug(1, "LABELS not defined, nothing to do")
81 bb.debug(1, "No labels, nothing to do")
84 cfile = bb.data.getVar('SYSLINUXCFG', d, 1)
86 raise bb.build.FuncFailed('Unable to read SYSLINUXCFG')
88 bb.mkdirhier(os.path.dirname(cfile))
91 cfgfile = file(cfile, 'w')
93 raise bb.build.funcFailed('Unable to open %s' % (cfile))
95 # FIXME - the timeout should be settable
96 # And maybe the default too
97 # Definately the prompt
99 cfgfile.write('# Automatically created by OE\n')
101 opts = bb.data.getVar('SYSLINUX_OPTS', d, 1)
104 for opt in opts.split(';'):
105 cfgfile.write('%s\n' % opt)
107 cfgfile.write('ALLOWOPTIONS 1\n');
108 cfgfile.write('DEFAULT %s\n' % (labels.split()[0]))
110 timeout = bb.data.getVar('SYSLINUX_TIMEOUT', d, 1)
113 cfgfile.write('TIMEOUT %s\n' % timeout)
115 cfgfile.write('TIMEOUT 50\n')
117 cfgfile.write('PROMPT 1\n')
119 menu = bb.data.getVar('AUTO_SYSLINUXMENU', d, 1)
121 # This is ugly. My bad.
124 bb.build.exec_func('build_syslinux_menu', d)
125 mfile = bb.data.getVar('SYSLINUXMENU', d, 1)
126 cfgfile.write('DISPLAY %s\n' % (mfile.split('/')[-1]) )
128 for label in labels.split():
129 from copy import deepcopy
130 localdata = deepcopy(d)
132 overrides = bb.data.getVar('OVERRIDES', localdata)
134 raise bb.build.FuncFailed('OVERRIDES not defined')
135 overrides = bb.data.expand(overrides, localdata)
137 bb.data.setVar('OVERRIDES', label + ':' + overrides, localdata)
138 bb.data.update_data(localdata)
140 cfgfile.write('LABEL %s\nKERNEL vmlinuz\n' % (label))
142 append = bb.data.getVar('APPEND', localdata, 1)
143 initrd = bb.data.getVar('INITRD', localdata, 1)
146 cfgfile.write('APPEND ')
149 cfgfile.write('initrd=initrd ')
151 cfgfile.write('%s\n' % (append))