mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-28 15:41:40 +00:00
Revert "global: Remove CONFIG_SYS_EXTRA_OPTIONS support"
Unfortunately, we require additional logic to buildman to support this
removal and still use SYS_SOC, etc, for build targets.
This reverts commit eeec00072d
.
Signed-off-by: Tom Rini <trini@konsulko.com>
This commit is contained in:
parent
10d615f2fc
commit
25b8acee2e
7 changed files with 122 additions and 5 deletions
13
boot/Kconfig
13
boot/Kconfig
|
@ -339,6 +339,19 @@ config OF_STDOUT_VIA_ALIAS
|
|||
incorrect when used with device tree as this option does not
|
||||
exist / should not be used.
|
||||
|
||||
config SYS_EXTRA_OPTIONS
|
||||
string "Extra Options (DEPRECATED)"
|
||||
help
|
||||
The old configuration infrastructure (= mkconfig + boards.cfg)
|
||||
provided the extra options field. If you have something like
|
||||
"HAS_BAR,BAZ=64", the optional options
|
||||
#define CONFIG_HAS
|
||||
#define CONFIG_BAZ 64
|
||||
will be defined in include/config.h.
|
||||
This option was prepared for the smooth migration from the old
|
||||
configuration to Kconfig. Since this option will be removed sometime,
|
||||
new boards should not use this option.
|
||||
|
||||
config HAVE_SYS_TEXT_BASE
|
||||
bool
|
||||
depends on !NIOS2 && !XTENSA
|
||||
|
|
|
@ -99,6 +99,7 @@ Kconfig. Each field of boards.cfg was converted as follows:
|
|||
Vendor -> CONFIG_SYS_VENDOR defined by Kconfig
|
||||
Board -> CONFIG_SYS_BOARD defined by Kconfig
|
||||
Target -> File name of defconfig (configs/<target>_defconfig)
|
||||
Options -> CONFIG_SYS_EXTRA_OPTIONS defined by Kconfig
|
||||
Maintainers -> "M:" entry of MAINTAINERS
|
||||
|
||||
|
||||
|
@ -139,6 +140,12 @@ When removing an obsolete board, the following steps are generally needed:
|
|||
TODO
|
||||
----
|
||||
|
||||
- The option field of boards.cfg, which was used for the pre-Kconfig
|
||||
configuration, moved to CONFIG_SYS_EXTRA_OPTIONS verbatim now.
|
||||
Board maintainers are expected to implement proper Kconfig options
|
||||
and switch over to them. Eventually CONFIG_SYS_EXTRA_OPTIONS will go away.
|
||||
CONFIG_SYS_EXTRA_OPTIONS should not be used for new boards.
|
||||
|
||||
- In the pre-Kconfig, a single board had multiple entries in the boards.cfg
|
||||
file with differences in the option fields. The corresponding defconfig
|
||||
files were auto-generated when switching to Kconfig. Now we have too many
|
||||
|
|
|
@ -295,7 +295,8 @@ Available options
|
|||
|
||||
-y, --yes
|
||||
Instead of prompting, automatically go ahead with all operations. This
|
||||
includes cleaning up headers, the config whitelist and the README.
|
||||
includes cleaning up headers, CONFIG_SYS_EXTRA_OPTIONS, the config whitelist
|
||||
and the README.
|
||||
|
||||
To see the complete list of supported options, run::
|
||||
|
||||
|
|
|
@ -100,6 +100,10 @@ tpl/include/autoconf.mk: tpl/u-boot.cfg
|
|||
# Prior to Kconfig, it was generated by mkconfig. Now it is created here.
|
||||
define filechk_config_h
|
||||
(echo "/* Automatically generated - do not edit */"; \
|
||||
for i in $$(echo $(CONFIG_SYS_EXTRA_OPTIONS) | sed 's/,/ /g'); do \
|
||||
echo \#define CONFIG_$$i \
|
||||
| sed '/=/ {s/=/ /;q; } ; { s/$$/ 1/; }'; \
|
||||
done; \
|
||||
echo \#define CONFIG_BOARDDIR board/$(if $(VENDOR),$(VENDOR)/)$(BOARD);\
|
||||
echo \#include \<config_uncmd_spl.h\>; \
|
||||
echo \#include \<configs/$(CONFIG_SYS_CONFIG_NAME).h\>; \
|
||||
|
|
|
@ -10,13 +10,30 @@
|
|||
#
|
||||
export LC_ALL=C LC_COLLATE=C
|
||||
|
||||
# Looks for the rest of the CONFIG options, but exclude those in Kconfig and
|
||||
# defconfig files.
|
||||
# There are two independent greps. The first pulls out the component parts
|
||||
# of CONFIG_SYS_EXTRA_OPTIONS. An example is:
|
||||
#
|
||||
# SUN7I_GMAC,AHCI,SATAPWR=SUNXI_GPB(8)
|
||||
#
|
||||
# We want this to produce:
|
||||
# CONFIG_SUN7I_GMAC
|
||||
# CONFIG_AHCI
|
||||
# CONFIG_SATAPWR
|
||||
#
|
||||
# The second looks for the rest of the CONFIG options, but excludes those in
|
||||
# Kconfig and defconfig files.
|
||||
#
|
||||
(
|
||||
git grep CONFIG_SYS_EXTRA_OPTIONS |sed -n \
|
||||
's/.*CONFIG_SYS_EXTRA_OPTIONS="\(.*\)"/\1/ p' \
|
||||
| tr , '\n' \
|
||||
| sed 's/ *\([A-Za-z0-9_]*\).*/CONFIG_\1/'
|
||||
|
||||
git grep CONFIG_ | \
|
||||
egrep -vi "(Kconfig:|defconfig:|README|\.py|\.pl:)" \
|
||||
| tr ' \t' '\n\n' \
|
||||
| sed -n 's/^\(CONFIG_[A-Za-z0-9_]*\).*/\1/p' \
|
||||
| sed -n 's/^\(CONFIG_[A-Za-z0-9_]*\).*/\1/p'
|
||||
) \
|
||||
|sort |uniq >scripts/config_whitelist.txt.tmp1;
|
||||
|
||||
# Finally, we need a list of the valid Kconfig options to exclude these from
|
||||
|
|
|
@ -111,6 +111,7 @@ class KconfigScanner:
|
|||
'vendor' : 'SYS_VENDOR',
|
||||
'board' : 'SYS_BOARD',
|
||||
'config' : 'SYS_CONFIG_NAME',
|
||||
'options' : 'SYS_EXTRA_OPTIONS'
|
||||
}
|
||||
|
||||
def __init__(self):
|
||||
|
@ -148,6 +149,7 @@ class KconfigScanner:
|
|||
'board': <board_name>,
|
||||
'target': <target_name>,
|
||||
'config': <config_header_name>,
|
||||
'options': <extra_options>
|
||||
}
|
||||
"""
|
||||
# strip special prefixes and save it in a temporary file
|
||||
|
@ -183,6 +185,14 @@ class KconfigScanner:
|
|||
if params['arch'] == 'arm' and params['cpu'] == 'armv8':
|
||||
params['arch'] = 'aarch64'
|
||||
|
||||
# fix-up options field. It should have the form:
|
||||
# <config name>[:comma separated config options]
|
||||
if params['options'] != '-':
|
||||
params['options'] = params['config'] + ':' + \
|
||||
params['options'].replace(r'\"', '"')
|
||||
elif params['config'] != params['target']:
|
||||
params['options'] = params['config']
|
||||
|
||||
return params
|
||||
|
||||
def scan_defconfigs_for_multiprocess(queue, defconfigs):
|
||||
|
@ -368,7 +378,7 @@ def format_and_output(params_list, output):
|
|||
output: The path to the output file
|
||||
"""
|
||||
FIELDS = ('status', 'arch', 'cpu', 'soc', 'vendor', 'board', 'target',
|
||||
'maintainers')
|
||||
'options', 'maintainers')
|
||||
|
||||
# First, decide the width of each column
|
||||
max_length = dict([ (f, 0) for f in FIELDS])
|
||||
|
|
|
@ -443,6 +443,70 @@ def cleanup_headers(configs, args):
|
|||
cleanup_one_header(header_path, patterns, args)
|
||||
cleanup_empty_blocks(header_path, args)
|
||||
|
||||
def cleanup_one_extra_option(defconfig_path, configs, args):
|
||||
"""Delete config defines in CONFIG_SYS_EXTRA_OPTIONS in one defconfig file.
|
||||
|
||||
Args:
|
||||
defconfig_path: path to the cleaned defconfig file.
|
||||
configs: A list of CONFIGs to remove.
|
||||
args (Namespace): program arguments
|
||||
"""
|
||||
|
||||
start = 'CONFIG_SYS_EXTRA_OPTIONS="'
|
||||
end = '"'
|
||||
|
||||
lines = read_file(defconfig_path)
|
||||
|
||||
for i, line in enumerate(lines):
|
||||
if line.startswith(start) and line.endswith(end):
|
||||
break
|
||||
else:
|
||||
# CONFIG_SYS_EXTRA_OPTIONS was not found in this defconfig
|
||||
return
|
||||
|
||||
old_tokens = line[len(start):-len(end)].split(',')
|
||||
new_tokens = []
|
||||
|
||||
for token in old_tokens:
|
||||
pos = token.find('=')
|
||||
if not (token[:pos] if pos >= 0 else token) in configs:
|
||||
new_tokens.append(token)
|
||||
|
||||
if new_tokens == old_tokens:
|
||||
return
|
||||
|
||||
tolines = copy.copy(lines)
|
||||
|
||||
if new_tokens:
|
||||
tolines[i] = start + ','.join(new_tokens) + end
|
||||
else:
|
||||
tolines.pop(i)
|
||||
|
||||
show_diff(lines, tolines, defconfig_path, args.color)
|
||||
|
||||
if args.dry_run:
|
||||
return
|
||||
|
||||
write_file(defconfig_path, tolines)
|
||||
|
||||
def cleanup_extra_options(configs, args):
|
||||
"""Delete config defines in CONFIG_SYS_EXTRA_OPTIONS in defconfig files.
|
||||
|
||||
Args:
|
||||
configs: A list of CONFIGs to remove.
|
||||
args (Namespace): program arguments
|
||||
"""
|
||||
if not confirm(args, 'Clean up CONFIG_SYS_EXTRA_OPTIONS?'):
|
||||
return
|
||||
|
||||
configs = [ config[len('CONFIG_'):] for config in configs ]
|
||||
|
||||
defconfigs = get_all_defconfigs()
|
||||
|
||||
for defconfig in defconfigs:
|
||||
cleanup_one_extra_option(os.path.join('configs', defconfig), configs,
|
||||
args)
|
||||
|
||||
def cleanup_whitelist(configs, args):
|
||||
"""Delete config whitelist entries
|
||||
|
||||
|
@ -1739,6 +1803,7 @@ doc/develop/moveconfig.rst for documentation.'''
|
|||
|
||||
if configs:
|
||||
cleanup_headers(configs, args)
|
||||
cleanup_extra_options(configs, args)
|
||||
cleanup_whitelist(configs, args)
|
||||
cleanup_readme(configs, args)
|
||||
|
||||
|
|
Loading…
Reference in a new issue