cmd: pxe: Display splashscreen from extlinux.conf input
RFC PATCH 1/1 cmd: pxe: Display splashscreen from extlinux.conf input
The objective is to provide a simple way to retrieve a BMP file, and display it as splashscreen, from extlinux.conf file input.
For this, we take example on https://www.syslinux.org/wiki/
index.php?title=Menu#The_advanced_menu_system
and more particularly on MENU BACKGROUND chapter. For this, add "menu background" support in pxe command.
As example, extlinux.conf content will look like:
# Generic Distro Configuration file generated by OpenEmbedded menu title Select the boot mode
TIMEOUT 20
menu background ../splash.bmp
DEFAULT stm32mp157c-ev1-sdcard
LABEL stm32mp157c-ev1-sdcard
KERNEL /uImage FDT /stm32mp157c-ev1.dtb APPEND root=/dev/mmcblk0p6 rootwait rw earlyprintk console=ttySTM0,115200
---
cmd/pxe.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
cmd/pxe.c +24 -0
@@ -8,11 +8,13 @@#include <command.h> #include <malloc.h> #include <mapmem.h> +#include <lcd.h> #include <linux/string.h> #include <linux/ctype.h> #include <errno.h> #include <linux/list.h> #include <fs.h> +#include <splash.h> #include <asm/io.h> #include "menu.h"
@@ -488,6 +490,7 @@ struct pxe_label {* * title - the name of the menu as given by a 'menu title' line. * default_label - the name of the default label, if any. +* bmp - the bmp file name which is displayed in background * timeout - time in tenths of a second to wait for a user key-press before * booting the default label. * prompt - if 0, don't prompt for a choice unless the timeout period is
@@ -498,6 +501,7 @@ struct pxe_label {struct pxe_menu {char *title;char *default_label; +char *bmp;int timeout;int prompt;struct list_head labels;
@@ -850,6 +854,7 @@ enum token_type {T_FDTDIR ,T_ONTIMEOUT ,T_IPAPPEND , +T_BACKGROUND , T_INVALID };
@@ -883,6 +888,7 @@ static const struct token keywords[] = { {"fdtdir", T_FDTDIR}, {"ontimeout", T_ONTIMEOUT,}, {"ipappend", T_IPAPPEND,}, + {"background", T_BACKGROUND,}, {NULL, T_INVALID} };
@@ -1160,6 +1166,10 @@ static int parse_menu(cmd_tbl_t *cmdtp, char **c, struct pxe_menu *cfg, nest_level + 1);break ; +case T_BACKGROUND : + err =parse_sliteral (c, &cfg->bmp); +break ; +default :printf ("Ignoring malformed menu command: %.*s\n" , (int )(*c - s), s);
@@ -1574,6 +1584,20 @@ static void handle_pxe_menu(cmd_tbl_t *cmdtp, struct pxe_menu *cfg)struct menu *m;int err; +#ifdef CONFIG_CMD_BMP +/* display BMP if available */ +if (cfg->bmp) { +if (get_relfile (cmdtp, cfg->bmp, load_addr)) { +run_command ("cls" ,0 ); +bmp_display (load_addr, +BMP_ALIGN_CENTER ,BMP_ALIGN_CENTER ); + }else { +printf ("Skipping background bmp %s for failure\n" , + cfg->bmp); + } + } +#endif + m =pxe_menu_to_menu (cfg);if (!m)return ;
Signature · 1 line
1.9.1
RFC PATCH 1/1 cmd: pxe: Display splashscreen from extlinux.conf input
Hi All,
Any comments ?
Patrice
Quoted 109 lines · Patrice Chotard
The objective is to provide a simple way to retrieve a BMP file, and display it as splashscreen, from extlinux.conf file input.
For this, we take example on https://www.syslinux.org/wiki/
index.php?title=Menu#The_advanced_menu_system
and more particularly on MENU BACKGROUND chapter. For this, add "menu background" support in pxe command.As example, extlinux.conf content will look like:
# Generic Distro Configuration file generated by OpenEmbedded menu title Select the boot mode
TIMEOUT 20
menu background ../splash.bmp
DEFAULT stm32mp157c-ev1-sdcard
LABEL stm32mp157c-ev1-sdcardKERNEL /uImage FDT /stm32mp157c-ev1.dtb APPEND root=/dev/mmcblk0p6 rootwait rw earlyprintk console=ttySTM0,115200Signed-off-by Patrice Chotard <[email protected]>---
cmd/pxe.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)cmd/pxe.c +24
-0@@ -8,11 +8,13 @@#include <command.h> #include <malloc.h> #include <mapmem.h> +#include <lcd.h> #include <linux/string.h> #include <linux/ctype.h> #include <errno.h> #include <linux/list.h> #include <fs.h> +#include <splash.h> #include <asm/io.h> #include "menu.h" @@ -488,6 +490,7 @@ struct pxe_label {* * title - the name of the menu as given by a 'menu title' line. * default_label - the name of the default label, if any. +* bmp - the bmp file name which is displayed in background * timeout - time in tenths of a second to wait for a user key-press before * booting the default label. * prompt - if 0, don't prompt for a choice unless the timeout period is @@ -498,6 +501,7 @@ struct pxe_label {struct pxe_menu {char *title;char *default_label; +char *bmp;int timeout;int prompt;struct list_head labels;@@ -850,6 +854,7 @@ enum token_type {T_FDTDIR ,T_ONTIMEOUT ,T_IPAPPEND , +T_BACKGROUND , T_INVALID };@@ -883,6 +888,7 @@ static const struct token keywords[] = { {"fdtdir", T_FDTDIR}, {"ontimeout", T_ONTIMEOUT,}, {"ipappend", T_IPAPPEND,}, + {"background", T_BACKGROUND,}, {NULL, T_INVALID} };@@ -1160,6 +1166,10 @@ static int parse_menu(cmd_tbl_t *cmdtp, char **c, struct pxe_menu *cfg, nest_level + 1);break ; +case T_BACKGROUND : + err =parse_sliteral (c, &cfg->bmp); +break ; +default :printf ("Ignoring malformed menu command: %.*s\n" , (int )(*c - s), s);@@ -1574,6 +1584,20 @@ static void handle_pxe_menu(cmd_tbl_t *cmdtp, struct pxe_menu *cfg)struct menu *m;int err; +#ifdef CONFIG_CMD_BMP +/* display BMP if available */ +if (cfg->bmp) { +if (get_relfile (cmdtp, cfg->bmp, load_addr)) { +run_command ("cls" ,0 ); +bmp_display (load_addr, +BMP_ALIGN_CENTER ,BMP_ALIGN_CENTER ); + }else { +printf ("Skipping background bmp %s for failure\n" , + cfg->bmp); + } + } +#endif + m =pxe_menu_to_menu (cfg);if (!m)return ;