From 7962e7a0b423a5dfba251622f64d3891f69a55c0 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Thu, 6 Nov 2014 09:56:43 +0100 Subject: defaultenv-2: Make use of nonvolatile variables This moves the variable assignments previously done in /env/config-board to non volatile variables in /env/nv/. This makes the settings adjustable by the user without editing a file. Most of the changes are simple conversions which for many boards makes /env/config-board unnecessary. Some boards had some logic to assign global.boot.default based on the current bootsource. This has been moved to /env/init/bootsource. An additional check is added to not overwrite a nv.boot.default should it exist. Signed-off-by: Sascha Hauer --- defaultenv/defaultenv-2-base/bin/init | 3 +++ defaultenv/defaultenv-2-base/config | 22 ++-------------------- defaultenv/defaultenv-2-base/nv/allow_color | 1 + defaultenv/defaultenv-2-base/nv/autoboot_timeout | 1 + defaultenv/defaultenv-2-base/nv/user | 1 + 5 files changed, 8 insertions(+), 20 deletions(-) create mode 100644 defaultenv/defaultenv-2-base/nv/allow_color create mode 100644 defaultenv/defaultenv-2-base/nv/autoboot_timeout create mode 100644 defaultenv/defaultenv-2-base/nv/user (limited to 'defaultenv') diff --git a/defaultenv/defaultenv-2-base/bin/init b/defaultenv/defaultenv-2-base/bin/init index 3a0e93b49d..34807bcf58 100644 --- a/defaultenv/defaultenv-2-base/bin/init +++ b/defaultenv/defaultenv-2-base/bin/init @@ -16,9 +16,12 @@ global editcmd [ -z "${global.hostname}" ] && global.hostname=generic [ -z "${global.user}" ] && global.user=none +magicvar -a global.user "username (used in network filenames)" [ -z "${global.autoboot_timeout}" ] && global.autoboot_timeout=3 +magicvar -a global.autoboot_timeout "timeout in seconds before automatic booting" [ -z "${global.boot.default}" ] && global.boot.default=net [ -z "${global.allow_color}" ] && global.allow_color=true +magicvar -a global.allow_color "Allow color on the console (boolean)" [ -z "${global.editcmd}" ] && global.editcmd=sedit [ -e /env/config-board ] && /env/config-board diff --git a/defaultenv/defaultenv-2-base/config b/defaultenv/defaultenv-2-base/config index 784ae52b80..49fa605d1d 100644 --- a/defaultenv/defaultenv-2-base/config +++ b/defaultenv/defaultenv-2-base/config @@ -3,23 +3,5 @@ # change network settings in /env/network/eth0 # change mtd partition settings and automountpoints in /env/init/* -#global.hostname= - -# set to false if you do not want to have colors -#global.allow_color=true - -# user (used for network filenames) -#global.user=none - -# timeout in seconds before the default boot entry is started -#global.autoboot_timeout=3 - -# list of boot entries. These are executed in order until one -# succeeds. An entry can be: -# - a filename in /env/boot/ -# - a full path to a directory. All files in this directory are -# treated as boot files and executed in alphabetical order -#global.boot.default=net - -# base bootargs -#global.linux.bootargs.base="console=ttyS0,115200" +# The settings that used to be here are in nv variables now. +# See 'help nv', 'magicvar' diff --git a/defaultenv/defaultenv-2-base/nv/allow_color b/defaultenv/defaultenv-2-base/nv/allow_color new file mode 100644 index 0000000000..f32a5804e2 --- /dev/null +++ b/defaultenv/defaultenv-2-base/nv/allow_color @@ -0,0 +1 @@ +true \ No newline at end of file diff --git a/defaultenv/defaultenv-2-base/nv/autoboot_timeout b/defaultenv/defaultenv-2-base/nv/autoboot_timeout new file mode 100644 index 0000000000..e440e5c842 --- /dev/null +++ b/defaultenv/defaultenv-2-base/nv/autoboot_timeout @@ -0,0 +1 @@ +3 \ No newline at end of file diff --git a/defaultenv/defaultenv-2-base/nv/user b/defaultenv/defaultenv-2-base/nv/user new file mode 100644 index 0000000000..c86c3f3551 --- /dev/null +++ b/defaultenv/defaultenv-2-base/nv/user @@ -0,0 +1 @@ +none \ No newline at end of file -- cgit v1.2.3