diff options
Diffstat (limited to 'meta-xilinx-core/classes/xilinx-deprecated.bbclass')
-rw-r--r-- | meta-xilinx-core/classes/xilinx-deprecated.bbclass | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/meta-xilinx-core/classes/xilinx-deprecated.bbclass b/meta-xilinx-core/classes/xilinx-deprecated.bbclass new file mode 100644 index 00000000..b9a44fc7 --- /dev/null +++ b/meta-xilinx-core/classes/xilinx-deprecated.bbclass | |||
@@ -0,0 +1,73 @@ | |||
1 | # Class to add a deprecated warning from various configuration files. | ||
2 | |||
3 | # Immediately after the ConfigParsed event handler, warn the user of any | ||
4 | # deprecated files the user has used. | ||
5 | addhandler xilinx_deprecated_config_eventhandler | ||
6 | xilinx_deprecated_config_eventhandler[eventmask] = "bb.event.ConfigParsed" | ||
7 | python xilinx_deprecated_config_eventhandler () { | ||
8 | # Check for BOARD & BOARD_VARIANT usage | ||
9 | if d.getVar('BOARD') or d.getVar('BOARD_VARIANT'): | ||
10 | bb.warn("Deprecated BOARD (%s) or BOARD_VARIANT (%s) is being used." % (d.getVar('BOARD'), d.getVar('BOARD_VARIANT'))) | ||
11 | |||
12 | if d.getVar('MACHINE') != d.getVar('ORIG_MACHINE'): | ||
13 | if d.getVar('BOARD_VARIANT') or d.getVar('BOARD') == d.getVar('MACHINE'): | ||
14 | if not check_conf_exists("conf/machine/${MACHINE}.conf", d): | ||
15 | mach_path = os.path.join(d.getVar('TOPDIR'), "conf/machine", d.getVar('MACHINE') + '.conf') | ||
16 | bb.utils.mkdirhier(os.path.dirname(mach_path)) | ||
17 | bb.warn('Generating (board_variant) MACHINE file: %s' % mach_path) | ||
18 | with open(mach_path, "w") as f: | ||
19 | f.write('#@TYPE: Machine\n') | ||
20 | f.write('#@NAME: %s\n' % d.getVar('MACHINE')) | ||
21 | f.write('#@DESCRIPTION: Generated %s machine\n' % d.getVar('MACHINE')) | ||
22 | f.write('\n') | ||
23 | f.write('#### Preamble\n') | ||
24 | f.write('''MACHINEOVERRIDES =. "${@['', '%s:']['%s' != '${MACHINE}']}"\n''' % (d.getVar('MACHINE'), d.getVar('MACHINE'))) | ||
25 | f.write('#### Regular settings follow\n') | ||
26 | f.write('\n') | ||
27 | f.write('unset BOARD\n') | ||
28 | f.write('unset BOARD_VARIANT\n') | ||
29 | f.write('\n') | ||
30 | f.write('DEFAULTTUNE ?= "%s"\n' % d.getVar('DEFAULTTUNE')) | ||
31 | if d.getVar('TUNE_FEATURES:tune-microblaze'): | ||
32 | f.write('TUNE_FEATURES:tune-microblaze ?= "%s"\n' % d.getVar('TUNE_FEATURES')) | ||
33 | if d.getVar('SOC_VARIANT'): | ||
34 | f.write('SOC_VARIANT ?= "%s"\n' % d.getVar('SOC_VARIANT')) | ||
35 | f.write('\n') | ||
36 | f.write('require conf/machine/%s.conf\n' % [d.getVar('ORIG_MACHINE'), d.getVar('BOARD')][bool(d.getVar('BOARD_VARIANT'))]) | ||
37 | f.write('\n') | ||
38 | f.write('#### No additional settings should be after the Postamble\n') | ||
39 | f.write('#### Postamble\n') | ||
40 | f.write('''PACKAGE_EXTRA_ARCHS:append = "${@['', ' %s']['%s' != "${MACHINE}"]}"\n''' % ((d.getVar('MACHINE_ARCH'), d.getVar('MACHINE')))) | ||
41 | bb.warn('Note: The generated machine conf file may be incomplete. If so copy the missing settings from the original conf files.') | ||
42 | bb.warn('In the future use: MACHINE = "%s"' % d.getVar('MACHINE')) | ||
43 | if d.getVar('BOARD') and d.getVar('BOARD') != d.getVar('MACHINE'): | ||
44 | if not check_conf_exists("conf/machine/${BOARD}.conf", d): | ||
45 | mach_path = os.path.join(d.getVar('TOPDIR'), "conf/machine", d.getVar('BOARD') + '.conf') | ||
46 | bb.utils.mkdirhier(os.path.dirname(mach_path)) | ||
47 | bb.warn('Generating (board) MACHINE file: %s' % mach_path) | ||
48 | with open(mach_path, "w") as f: | ||
49 | f.write('#@TYPE: Machine\n') | ||
50 | f.write('#@NAME: %s\n' % d.getVar('BOARD')) | ||
51 | f.write('#@DESCRIPTION: Generated %s machine\n' % d.getVar('BOARD')) | ||
52 | f.write('\n') | ||
53 | f.write('#### Preamble\n') | ||
54 | f.write('''MACHINEOVERRIDES =. "${@['', '%s:']['%s' != '${MACHINE}']}"\n''' % (d.getVar('BOARD'), d.getVar('BOARD'))) | ||
55 | f.write('#### Regular settings follow\n') | ||
56 | f.write('\n') | ||
57 | f.write('unset BOARD\n') | ||
58 | f.write('unset BOARD_VARIANT\n') | ||
59 | f.write('require conf/machine/%s.conf\n' % d.getVar('ORIG_MACHINE')) | ||
60 | f.write('\n') | ||
61 | f.write('#### No additional settings should be after the Postamble\n') | ||
62 | f.write('#### Postamble\n') | ||
63 | f.write('''PACKAGE_EXTRA_ARCHS:append = "${@['', ' %s']['%s' != "${MACHINE}"]}"\n''' % ((d.getVar('BOARD_ARCH'), d.getVar('BOARD')))) | ||
64 | bb.warn('Note: The generated machine conf file may be incomplete. If so copy the missing settings from the original conf files.') | ||
65 | d.delVar('ORIG_MACHINE') | ||
66 | |||
67 | msg_list = d.getVarFlags('XILINX_DEPRECATED') or [] | ||
68 | for msg_source in msg_list: | ||
69 | if msg_source == "doc": | ||
70 | continue | ||
71 | msg = d.getVarFlag('XILINX_DEPRECATED', msg_source) or "" | ||
72 | bb.warn('%s: %s' % (msg_source, msg)) | ||
73 | } | ||