Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[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.
  • Loading branch information
Michael Brown committed Oct 31, 2008
1 parent 32bc76f commit 5e6b821
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 14 deletions.
33 changes: 33 additions & 0 deletions src/arch/i386/prefix/libprefix.S
Expand Up @@ -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)
*
Expand Down
55 changes: 43 additions & 12 deletions src/arch/i386/prefix/romprefix.S
Expand Up @@ -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 "
Expand Down Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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
*
Expand Down Expand Up @@ -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
Expand All @@ -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
*
Expand Down
16 changes: 16 additions & 0 deletions src/config/general.h
Expand Up @@ -9,6 +9,22 @@

#include <config/defaults.h>

/*
* 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
*
Expand Down
16 changes: 14 additions & 2 deletions src/core/main.c
Expand Up @@ -20,6 +20,7 @@ Literature dealing with the network protocols:
#include <gpxe/shell.h>
#include <gpxe/shell_banner.h>
#include <usr/autoboot.h>
#include <config/general.h>

#define NORMAL "\033[0m"
#define BOLD "\033[1m"
Expand All @@ -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:" );
Expand Down

0 comments on commit 5e6b821

Please sign in to comment.