All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] Support to change set file via arg
@ 2017-07-05 16:16 C Shapiro
  2017-07-06  4:21 ` ERAMOTO Masaya
  0 siblings, 1 reply; 4+ messages in thread
From: C Shapiro @ 2017-07-05 16:16 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Simon Glass, Luiz Augusto von Dentz, Marcel Holtmann

ChromeOS is currently shifting to a more dynamic build system where a
single build will be created/managed/deployed to support multiple models
that were all created based on a single reference board.

This is being done for general cost/maintenance savings around the sheer
number of builds that are currently managed for ChromeOS.

To support this, we're changing our build images to have all of the
configuration available for all of the models supported by a given
build.

For the bluetooth stack, models have different product id values in the
DeviceID field for the main.conf config file.

E.g.
https://chromium.git.corp.google.com/chromiumos/overlays/board-overlays/+/master/overlay-pyro/chromeos-base/chromeos-bsp-pyro/files/main.conf
https://chromium.git.corp.google.com/chromiumos/overlays/board-overlays/+/master/overlay-reef/chromeos-base/chromeos-bsp-reef/files/main.conf
https://chromium.git.corp.google.com/chromiumos/overlays/board-overlays/+/master/overlay-snappy/chromeos-base/chromeos-bsp-snappy/files/main.conf

This change allows the config file to be passed as a runtime argument to
bluetoothd, which allows the ChromeOS init script to determine the model
at runtime and then pass the appropriate model specific config file.

Signed-off-by: C Shapiro <shapiroc@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
---
Changes in v2:
- Updates the commit message with a better explanation of the usage.

 src/bluetoothd.8.in |  4 ++++
 src/main.c          | 12 +++++++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/src/bluetoothd.8.in b/src/bluetoothd.8.in
index 97ef3ec94..d61dcc5b3 100644
--- a/src/bluetoothd.8.in
+++ b/src/bluetoothd.8.in
@@ -27,6 +27,10 @@ Print bluetoothd options and exit.
 Enable logging in foreground. Directs log output to the controlling terminal \
 in addition to syslog.
 .TP
+.B -f, --configfile
+Specifies an explicit config file path instead of relying on the default path \
+(@CONFIGDIR@/main.conf) for the config file.
+.TP
 .B -d, --debug=<file1>:<file2>:...
 Sets how much information bluetoothd sends to the log destination (usually \
 syslog's "daemon" facility). If the file options are omitted, then debugging \
diff --git a/src/main.c b/src/main.c
index bcc1e6fae..87bdb66cb 100644
--- a/src/main.c
+++ b/src/main.c
@@ -490,6 +490,7 @@ static guint setup_signalfd(void)
 static char *option_debug = NULL;
 static char *option_plugin = NULL;
 static char *option_noplugin = NULL;
+static char *option_configfile = NULL;
 static gboolean option_compat = FALSE;
 static gboolean option_detach = TRUE;
 static gboolean option_version = FALSE;
@@ -505,6 +506,9 @@ static void free_options(void)
 
 	g_free(option_noplugin);
 	option_noplugin = NULL;
+
+	g_free(option_configfile);
+	option_configfile = NULL;
 }
 
 static void disconnect_dbus(void)
@@ -577,6 +581,9 @@ static GOptionEntry options[] = {
 				"Specify plugins to load", "NAME,..," },
 	{ "noplugin", 'P', 0, G_OPTION_ARG_STRING, &option_noplugin,
 				"Specify plugins not to load", "NAME,..." },
+	{ "configfile", 'f', 0, G_OPTION_ARG_STRING, &option_configfile,
+				"Specify an explicit path to the config file",
+				"FILE"},
 	{ "compat", 'C', 0, G_OPTION_ARG_NONE, &option_compat,
 				"Provide deprecated command line interfaces" },
 	{ "experimental", 'E', 0, G_OPTION_ARG_NONE, &option_experimental,
@@ -636,7 +643,10 @@ int main(int argc, char *argv[])
 
 	sd_notify(0, "STATUS=Starting up");
 
-	main_conf = load_config(CONFIGDIR "/main.conf");
+	if (option_configfile)
+		main_conf = load_config(option_configfile);
+	else
+		main_conf = load_config(CONFIGDIR "/main.conf");
 
 	parse_config(main_conf);
 
-- 
2.13.2.725.g09c95d1e9-goog

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] Support to change set file via arg
  2017-07-05 16:16 [PATCH v2] Support to change set file via arg C Shapiro
@ 2017-07-06  4:21 ` ERAMOTO Masaya
  2017-07-06 15:46   ` C Shapiro
  0 siblings, 1 reply; 4+ messages in thread
From: ERAMOTO Masaya @ 2017-07-06  4:21 UTC (permalink / raw)
  To: C Shapiro, linux-bluetooth; +Cc: Luiz Augusto von Dentz, Marcel Holtmann

Hi Charles,

On 07/06/2017 01:16 AM, C Shapiro wrote:
> ChromeOS is currently shifting to a more dynamic build system where a
> single build will be created/managed/deployed to support multiple models
> that were all created based on a single reference board.
> 
> This is being done for general cost/maintenance savings around the sheer
> number of builds that are currently managed for ChromeOS.

I could not understand whether there were any merits except maintenance
of your ChromeOS.
Are there any merits for other software/users (e.g. container, etc.)?

> For the bluetooth stack, models have different product id values in the
> DeviceID field for the main.conf config file.

Why do not you pass DeviceID as an argument instead of a config file?

> E.g.
> https://chromium.git.corp.google.com/chromiumos/overlays/board-overlays/+/master/overlay-pyro/chromeos-base/chromeos-bsp-pyro/files/main.conf
> https://chromium.git.corp.google.com/chromiumos/overlays/board-overlays/+/master/overlay-reef/chromeos-base/chromeos-bsp-reef/files/main.conf
> https://chromium.git.corp.google.com/chromiumos/overlays/board-overlays/+/master/overlay-snappy/chromeos-base/chromeos-bsp-snappy/files/main.conf

I could not access without an account.
How can I sign up?

> This change allows the config file to be passed as a runtime argument to
> bluetoothd, which allows the ChromeOS init script to determine the model
> at runtime and then pass the appropriate model specific config file.

Why do not you change only ChromeOS init scirpt?

For example, in ChromeOS init scirpt,
 1. Determine the model.
 2. Run ln command with --force option to link /etc/bluetooth/main.conf to 
    the appropriate config file.


Thank you for reading this to the end :)

Regards,
Eramoto

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] Support to change set file via arg
  2017-07-06  4:21 ` ERAMOTO Masaya
@ 2017-07-06 15:46   ` C Shapiro
  2017-07-07  9:04     ` ERAMOTO Masaya
  0 siblings, 1 reply; 4+ messages in thread
From: C Shapiro @ 2017-07-06 15:46 UTC (permalink / raw)
  To: ERAMOTO Masaya
  Cc: linux-bluetooth, Luiz Augusto von Dentz, Marcel Holtmann, Simon Glass

Hi Eramoto,
Thanks for the feedback...below are responses to the questions:

Are there any merits for other software/users (e.g. container, etc.)?
 - As more platforms implement verified boot and need to support many
platforms, this will become more common (e.g. Android)

Why do not you pass DeviceID as an argument instead of a config file?
 - This would be viable also, but then this arg could contradict the
config file setting and allowing the config file to be passed is more
powerful overall.

How can I sign up?
 - Sorry, I accidentally gave the wrong links.
 - https://chromium.googlesource.com/chromiumos/overlays/board-overlays/+/master/overlay-pyro/chromeos-base/chromeos-bsp-pyro/files/main.conf
 - https://chromium.googlesource.com/chromiumos/overlays/board-overlays/+/master/overlay-reef/chromeos-base/chromeos-bsp-reef/files/main.conf
 - https://chromium.googlesource.com/chromiumos/overlays/board-overlays/+/master/overlay-snappy/chromeos-base/chromeos-bsp-snappy/files/main.conf

Why do not you change only ChromeOS init script?
 - ChromeOS uses verified boot with a read only file system, so we
can't change any of the files at runtime.

Thanks,
Charles

On Wed, Jul 5, 2017 at 10:21 PM, ERAMOTO Masaya
<eramoto.masaya@jp.fujitsu.com> wrote:
> Hi Charles,
>
> On 07/06/2017 01:16 AM, C Shapiro wrote:
>> ChromeOS is currently shifting to a more dynamic build system where a
>> single build will be created/managed/deployed to support multiple models
>> that were all created based on a single reference board.
>>
>> This is being done for general cost/maintenance savings around the sheer
>> number of builds that are currently managed for ChromeOS.
>
> I could not understand whether there were any merits except maintenance
> of your ChromeOS.
> Are there any merits for other software/users (e.g. container, etc.)?
>
>> For the bluetooth stack, models have different product id values in the
>> DeviceID field for the main.conf config file.
>
> Why do not you pass DeviceID as an argument instead of a config file?
>
>> E.g.
>> https://chromium.git.corp.google.com/chromiumos/overlays/board-overlays/+/master/overlay-pyro/chromeos-base/chromeos-bsp-pyro/files/main.conf
>> https://chromium.git.corp.google.com/chromiumos/overlays/board-overlays/+/master/overlay-reef/chromeos-base/chromeos-bsp-reef/files/main.conf
>> https://chromium.git.corp.google.com/chromiumos/overlays/board-overlays/+/master/overlay-snappy/chromeos-base/chromeos-bsp-snappy/files/main.conf
>
> I could not access without an account.
> How can I sign up?
>
>> This change allows the config file to be passed as a runtime argument to
>> bluetoothd, which allows the ChromeOS init script to determine the model
>> at runtime and then pass the appropriate model specific config file.
>
> Why do not you change only ChromeOS init scirpt?
>
> For example, in ChromeOS init scirpt,
>  1. Determine the model.
>  2. Run ln command with --force option to link /etc/bluetooth/main.conf to
>     the appropriate config file.
>
>
> Thank you for reading this to the end :)
>
> Regards,
> Eramoto

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] Support to change set file via arg
  2017-07-06 15:46   ` C Shapiro
@ 2017-07-07  9:04     ` ERAMOTO Masaya
  0 siblings, 0 replies; 4+ messages in thread
From: ERAMOTO Masaya @ 2017-07-07  9:04 UTC (permalink / raw)
  To: C Shapiro
  Cc: linux-bluetooth, Luiz Augusto von Dentz, Marcel Holtmann, Simon Glass

Hi Charles,

Thank you for answering my stupid questions.

> Why do not you pass DeviceID as an argument instead of a config file?
>  - This would be viable also, but then this arg could contradict the
> config file setting and allowing the config file to be passed is more
> powerful overall.

I think you don't have to manage your config files if you pass DeviceID 
as the argument. However it seems like better idea to pass an config 
file as the argument.

Regards,
Eramoto

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-07-07  9:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-05 16:16 [PATCH v2] Support to change set file via arg C Shapiro
2017-07-06  4:21 ` ERAMOTO Masaya
2017-07-06 15:46   ` C Shapiro
2017-07-07  9:04     ` ERAMOTO Masaya

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.