From 0bfe83edbb65f94fca8028be0ca20fdfec5ffc81 Mon Sep 17 00:00:00 2001 From: Tom Zanussi Date: Mon, 11 Mar 2013 18:52:50 -0500 Subject: yocto-kernel: add support for kernel feature add/rm/list Add yocto-kernel commands allowing users to add, remove, and list kernel features with respect to a given BSP. Features managed by these commands modify a special machine-user-features.scc file associated with the kernel recipe (.bbappend) of a yocto-bsp-generated BSP. This is analagous to the implementation of similar support for bare config items and patches already implemented for yocto-bsp-generated BSPs. Future patches will add support for providing a list of eligible features as defined by linux-yocto kernels and locally-defined (recipe-space) kernel features. (From meta-yocto rev: ae68d906c5c9854f2cd7ee0870556fbfbd7d94d0) Signed-off-by: Tom Zanussi Signed-off-by: Richard Purdie --- scripts/yocto-kernel | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 70 insertions(+), 1 deletion(-) (limited to 'scripts/yocto-kernel') diff --git a/scripts/yocto-kernel b/scripts/yocto-kernel index 2e1789b13d..72b407109d 100755 --- a/scripts/yocto-kernel +++ b/scripts/yocto-kernel @@ -162,6 +162,65 @@ def yocto_kernel_patch_rm_subcommand(args, usage_str): yocto_kernel_patch_rm(scripts_path, args[0]) +def yocto_kernel_feature_list_subcommand(args, usage_str): + """ + Command-line handling for listing the BSP features that are being + used by the BSP. The real work is done by + bsp.kernel.yocto_kernel_feature_list(). + """ + logging.debug("yocto_kernel_feature_list_subcommand") + + parser = optparse.OptionParser(usage = usage_str) + + (options, args) = parser.parse_args(args) + + if len(args) != 1: + logging.error("Wrong number of arguments, exiting\n") + parser.print_help() + sys.exit(1) + + yocto_kernel_feature_list(scripts_path, args[0]) + + +def yocto_kernel_feature_add_subcommand(args, usage_str): + """ + Command-line handling for adding the use of kernel features to a + BSP. The real work is done by bsp.kernel.yocto_kernel_feature_add(). + """ + logging.debug("yocto_kernel_feature_add_subcommand") + + parser = optparse.OptionParser(usage = usage_str) + + (options, args) = parser.parse_args(args) + + if len(args) < 2: + logging.error("Wrong number of arguments, exiting\n") + parser.print_help() + sys.exit(1) + + machine = args.pop(0) + yocto_kernel_feature_add(scripts_path, machine, args) + + +def yocto_kernel_feature_rm_subcommand(args, usage_str): + """ + Command-line handling for removing the use of kernel features from + a BSP. The real work is done by bsp.kernel.yocto_kernel_feature_rm(). + """ + logging.debug("yocto_kernel_feature_rm_subcommand") + + parser = optparse.OptionParser(usage = usage_str) + + (options, args) = parser.parse_args(args) + + if len(args) != 1: + logging.error("Wrong number of arguments, exiting\n") + parser.print_help() + sys.exit(1) + + yocto_kernel_feature_rm(scripts_path, args[0]) + + subcommands = { "config-list": [yocto_kernel_config_list_subcommand, yocto_kernel_config_list_usage, @@ -181,6 +240,15 @@ subcommands = { "patch-rm": [yocto_kernel_patch_rm_subcommand, yocto_kernel_patch_rm_usage, yocto_kernel_patch_rm_help], + "feature-list": [yocto_kernel_feature_list_subcommand, + yocto_kernel_feature_list_usage, + yocto_kernel_feature_list_help], + "feature-add": [yocto_kernel_feature_add_subcommand, + yocto_kernel_feature_add_usage, + yocto_kernel_feature_add_help], + "feature-rm": [yocto_kernel_feature_rm_subcommand, + yocto_kernel_feature_rm_usage, + yocto_kernel_feature_rm_help], } @@ -212,7 +280,8 @@ def main(): else: sc = 0 - if args[sc] == "config" or args[sc] == "patch": + if args[sc] == "config" or args[sc] == "patch" or \ + args[sc] == "feature": if len(args) < 2 + sc: parser.print_help() sys.exit(1) -- cgit v1.2.3-54-g00ecf