From 5e6b82104df452bb7f6d2feed67a1d2079ddc4ce Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Fri, 31 Oct 2008 19:10:28 +0000 Subject: [romprefix] Add vendor branding facilities and guidelines Some hardware vendors have been known to remove all gPXE-related branding from ROMs that they build. While this is not prohibited by the GPL, it is a little impolite. Add a facility for adding branding messages via two #defines (PRODUCT_NAME and PRODUCT_SHORT_NAME) in config/general.h. This should accommodate all known OEM-mandated branding requirements. Vendors with branding requirements that cannot be satisfied by using PRODUCT_NAME and/or PRODUCT_SHORT_NAME should contact us so that we can extended this facility as necessary. --- src/arch/i386/prefix/libprefix.S | 33 ++++++++++++++++++++++++ src/arch/i386/prefix/romprefix.S | 55 +++++++++++++++++++++++++++++++--------- src/config/general.h | 16 ++++++++++++ src/core/main.c | 16 ++++++++++-- 4 files changed, 106 insertions(+), 14 deletions(-) diff --git a/src/arch/i386/prefix/libprefix.S b/src/arch/i386/prefix/libprefix.S index 60dce8e4..7159d745 100644 --- a/src/arch/i386/prefix/libprefix.S +++ b/src/arch/i386/prefix/libprefix.S @@ -199,6 +199,39 @@ print_pci_busdevfn: ret .size print_pci_busdevfn, . - print_pci_busdevfn +/***************************************************************************** + * Utility function: clear current line + * + * Parameters: + * %ds:di : output buffer (or %di=0 to print to console) + * Returns: + * %ds:di : next character in output buffer (if applicable) + ***************************************************************************** + */ + .section ".prefix.lib" + .code16 + .globl print_kill_line +print_kill_line: + /* Preserve registers */ + pushw %ax + pushw %cx + /* Print CR */ + movb $'\r', %al + call print_character + /* Print 79 spaces */ + movb $' ', %al + movw $79, %cx +1: call print_character + loop 1b + /* Print CR */ + movb $'\r', %al + call print_character + /* Restore registers and return */ + popw %cx + popw %ax + ret + .size print_kill_line, . - print_kill_line + /**************************************************************************** * pm_call (real-mode near call) * diff --git a/src/arch/i386/prefix/romprefix.S b/src/arch/i386/prefix/romprefix.S index 9407e64c..aa081ef0 100644 --- a/src/arch/i386/prefix/romprefix.S +++ b/src/arch/i386/prefix/romprefix.S @@ -109,12 +109,12 @@ mfgstr: /* Product string * - * Defaults to "gPXE". If the ROM image is writable at initialisation - * time, it will be filled in to include the PCI bus:dev.fn number of - * the card as well. + * Defaults to PRODUCT_SHORT_NAME. If the ROM image is writable at + * initialisation time, it will be filled in to include the PCI + * bus:dev.fn number of the card as well. */ prodstr: - .ascii "gPXE" + .ascii PRODUCT_SHORT_NAME prodstr_separator: .byte 0 .ascii "(PCI " @@ -346,23 +346,28 @@ no_pmm: movw $init_message_prompt, %si xorw %di, %di call print_message + movw $prodstr, %si + call print_message + movw $init_message_dots, %si + call print_message /* Wait for Ctrl-B */ movw $0xff02, %bx call wait_for_key /* Clear prompt */ pushf - movw $clear_message, %si xorw %di, %di + call print_kill_line + movw $init_message_done, %si call print_message popf - jnz 1f + jnz 2f /* Ctrl-B was pressed: invoke gPXE. The keypress will be * picked up by the initial shell prompt, and we will drop * into a shell. */ pushw %cs call exec -1: +2: /* Restore registers */ popw %gs popw %fs @@ -375,7 +380,26 @@ no_pmm: lret .size init, . - init +/* + * Note to hardware vendors: + * + * If you wish to brand this boot ROM, please do so by defining the + * strings PRODUCT_NAME and PRODUCT_SHORT_NAME in config/general.h. + * + * While nothing in the GPL prevents you from removing all references + * to gPXE or http://etherboot.org, we prefer you not to do so. + * + * If you have an OEM-mandated branding requirement that cannot be + * satisfied simply by defining PRODUCT_NAME and PRODUCT_SHORT_NAME, + * please contact us. + * + * [ Including an ASCII NUL in PRODUCT_NAME is considered to be + * bypassing the spirit of this request! ] + */ init_message: + .ascii "\n" + .ascii PRODUCT_NAME + .ascii "\n" .asciz "gPXE (http://etherboot.org) - " .size init_message, . - init_message init_message_pci: @@ -394,11 +418,14 @@ init_message_int19: .asciz " INT19" .size init_message_int19, . - init_message_int19 init_message_prompt: - .asciz "\nPress Ctrl-B to configure gPXE..." + .asciz "\nPress Ctrl-B to configure " .size init_message_prompt, . - init_message_prompt -clear_message: - .asciz "\r \n\n" - .size clear_message, . - clear_message +init_message_dots: + .asciz "..." + .size init_message_dots, . - init_message_dots +init_message_done: + .asciz "\n\n" + .size init_message_done, . - init_message_done /* ROM image location * @@ -454,8 +481,9 @@ int19_entry: movw $0xdf42, %bx call wait_for_key pushf - movw $clear_message, %si xorw %di, %di + call print_kill_line + movw $int19_message_done, %si call print_message popf jnz 1f @@ -482,6 +510,9 @@ int19_message_prompt: int19_message_dots: .asciz "..." .size int19_message_dots, . - int19_message_dots +int19_message_done: + .asciz "\n\n" + .size int19_message_done, . - int19_message_done /* Execute as a boot device * diff --git a/src/config/general.h b/src/config/general.h index 3d9663b9..6454b946 100644 --- a/src/config/general.h +++ b/src/config/general.h @@ -9,6 +9,22 @@ #include +/* + * Branding + * + * Vendors may use these strings to add their own branding to gPXE. + * PRODUCT_NAME is displayed prior to any gPXE branding in startup + * messages, and PRODUCT_SHORT_NAME is used where a brief product + * label is required (e.g. in BIOS boot selection menus). + * + * To minimise end-user confusion, it's probably a good idea to either + * make PRODUCT_SHORT_NAME a substring of PRODUCT_NAME or leave it as + * "gPXE". + * + */ +#define PRODUCT_NAME "" +#define PRODUCT_SHORT_NAME "gPXE" + /* * Timer configuration * diff --git a/src/core/main.c b/src/core/main.c index d5892261..aaf8111b 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -20,6 +20,7 @@ Literature dealing with the network protocols: #include #include #include +#include #define NORMAL "\033[0m" #define BOLD "\033[1m" @@ -39,8 +40,19 @@ __cdecl int main ( void ) { initialise(); startup(); - /* Print welcome banner */ - printf ( NORMAL "\n\n\n" BOLD "gPXE " VERSION + /* + * Print welcome banner + * + * + * If you wish to brand this build of gPXE, please do so by + * defining the string PRODUCT_NAME in config/general.h. + * + * While nothing in the GPL prevents you from removing all + * references to gPXE or http://etherboot.org, we prefer you + * not to do so. + * + */ + printf ( NORMAL "\n\n" PRODUCT_NAME "\n" BOLD "gPXE " VERSION NORMAL " -- Open Source Boot Firmware -- " CYAN "http://etherboot.org" NORMAL "\n" "Features:" ); -- cgit v1.2.3-55-g7522