* [PATCH v2] uboot-extlinux-config.bbclass: add support for timeout & default
@ 2017-02-10 1:06 Dalon Westergreen
2017-02-10 17:50 ` Khem Raj
0 siblings, 1 reply; 2+ messages in thread
From: Dalon Westergreen @ 2017-02-10 1:06 UTC (permalink / raw)
To: openembedded-core
When multible targets are defined it is useful to allow for
a default target along with a timeout. After timeout, the
default target will be selected.
Signed-off-by: Dalon Westergreen <dwesterg@gmail.com>
--
v2:
- fixed UnboundLocalError
---
meta/classes/uboot-extlinux-config.bbclass | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/meta/classes/uboot-extlinux-config.bbclass b/meta/classes/uboot-extlinux-config.bbclass
index ec5fffb..f075a37 100644
--- a/meta/classes/uboot-extlinux-config.bbclass
+++ b/meta/classes/uboot-extlinux-config.bbclass
@@ -16,6 +16,10 @@
# concatenate and use as an initrd (optional).
# UBOOT_EXTLINUX_MENU_DESCRIPTION - Name to use as description.
# UBOOT_EXTLINUX_ROOT - Root kernel cmdline.
+# UBOOT_EXTLINUX_TIMEOUT - Timeout before DEFAULT selection is made.
+# Measured in 1/10 of a second.
+# UBOOT_EXTLINUX_DEFAULT_LABEL - Target to be selected by default after
+# the timeout period
#
# If there's only one label system will boot automatically and menu won't be
# created. If you want to use more than one labels, e.g linux and alternate,
@@ -25,6 +29,9 @@
#
# UBOOT_EXTLINUX_LABELS ??= "default fallback"
#
+# UBOOT_EXTLINUX_DEFAULT_LABEL ??= "Linux Default"
+# UBOOT_EXTLINUX_TIMEOUT ??= "30"
+#
# UBOOT_EXTLINUX_KERNEL_IMAGE_default ??= "../zImage"
# UBOOT_EXTLINUX_MENU_DESCRIPTION_default ??= "Linux Default"
#
@@ -34,6 +41,8 @@
# Results:
#
# menu title Select the boot mode
+# TIMEOUT 30
+# DEFAULT Linux Default
# LABEL Linux Default
# KERNEL ../zImage
# FDTDIR ../
@@ -82,6 +91,14 @@ python create_extlinux_config() {
if len(labels.split()) > 1:
cfgfile.write('menu title Select the boot mode\n')
+ timeout = d.getVar('UBOOT_EXTLINUX_TIMEOUT')
+ if timeout:
+ cfgfile.write('TIMEOUT %s\n' % (timeout))
+
+ default = d.getVar('UBOOT_EXTLINUX_DEFAULT_LABEL')
+ if default:
+ cfgfile.write('DEFAULT %s\n' % (default))
+
for label in labels.split():
localdata = bb.data.createCopy(d)
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] uboot-extlinux-config.bbclass: add support for timeout & default
2017-02-10 1:06 [PATCH v2] uboot-extlinux-config.bbclass: add support for timeout & default Dalon Westergreen
@ 2017-02-10 17:50 ` Khem Raj
0 siblings, 0 replies; 2+ messages in thread
From: Khem Raj @ 2017-02-10 17:50 UTC (permalink / raw)
To: openembedded-core
On 2/9/17 5:06 PM, Dalon Westergreen wrote:
> When multible targets are defined it is useful to allow for
> a default target along with a timeout. After timeout, the
> default target will be selected.
>
> Signed-off-by: Dalon Westergreen <dwesterg@gmail.com>
>
this looks good to me.
> --
> v2:
> - fixed UnboundLocalError
> ---
> meta/classes/uboot-extlinux-config.bbclass | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
>
> diff --git a/meta/classes/uboot-extlinux-config.bbclass b/meta/classes/uboot-extlinux-config.bbclass
> index ec5fffb..f075a37 100644
> --- a/meta/classes/uboot-extlinux-config.bbclass
> +++ b/meta/classes/uboot-extlinux-config.bbclass
> @@ -16,6 +16,10 @@
> # concatenate and use as an initrd (optional).
> # UBOOT_EXTLINUX_MENU_DESCRIPTION - Name to use as description.
> # UBOOT_EXTLINUX_ROOT - Root kernel cmdline.
> +# UBOOT_EXTLINUX_TIMEOUT - Timeout before DEFAULT selection is made.
> +# Measured in 1/10 of a second.
> +# UBOOT_EXTLINUX_DEFAULT_LABEL - Target to be selected by default after
> +# the timeout period
> #
> # If there's only one label system will boot automatically and menu won't be
> # created. If you want to use more than one labels, e.g linux and alternate,
> @@ -25,6 +29,9 @@
> #
> # UBOOT_EXTLINUX_LABELS ??= "default fallback"
> #
> +# UBOOT_EXTLINUX_DEFAULT_LABEL ??= "Linux Default"
> +# UBOOT_EXTLINUX_TIMEOUT ??= "30"
> +#
> # UBOOT_EXTLINUX_KERNEL_IMAGE_default ??= "../zImage"
> # UBOOT_EXTLINUX_MENU_DESCRIPTION_default ??= "Linux Default"
> #
> @@ -34,6 +41,8 @@
> # Results:
> #
> # menu title Select the boot mode
> +# TIMEOUT 30
> +# DEFAULT Linux Default
> # LABEL Linux Default
> # KERNEL ../zImage
> # FDTDIR ../
> @@ -82,6 +91,14 @@ python create_extlinux_config() {
> if len(labels.split()) > 1:
> cfgfile.write('menu title Select the boot mode\n')
>
> + timeout = d.getVar('UBOOT_EXTLINUX_TIMEOUT')
> + if timeout:
> + cfgfile.write('TIMEOUT %s\n' % (timeout))
> +
> + default = d.getVar('UBOOT_EXTLINUX_DEFAULT_LABEL')
> + if default:
> + cfgfile.write('DEFAULT %s\n' % (default))
> +
> for label in labels.split():
> localdata = bb.data.createCopy(d)
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-02-10 17:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-10 1:06 [PATCH v2] uboot-extlinux-config.bbclass: add support for timeout & default Dalon Westergreen
2017-02-10 17:50 ` Khem Raj
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.