Browse Source

[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.
tags/v0.9.6
Michael Brown 16 years ago
parent
commit
5e6b82104d
4 changed files with 106 additions and 14 deletions
  1. 33
    0
      src/arch/i386/prefix/libprefix.S
  2. 43
    12
      src/arch/i386/prefix/romprefix.S
  3. 16
    0
      src/config/general.h
  4. 14
    2
      src/core/main.c

+ 33
- 0
src/arch/i386/prefix/libprefix.S View File

199
 	ret
199
 	ret
200
 	.size	print_pci_busdevfn, . - print_pci_busdevfn
200
 	.size	print_pci_busdevfn, . - print_pci_busdevfn
201
 
201
 
202
+/*****************************************************************************
203
+ * Utility function: clear current line
204
+ *
205
+ * Parameters:
206
+ *   %ds:di : output buffer (or %di=0 to print to console)
207
+ * Returns:
208
+ *   %ds:di : next character in output buffer (if applicable)
209
+ *****************************************************************************
210
+ */
211
+	.section ".prefix.lib"
212
+	.code16
213
+	.globl	print_kill_line
214
+print_kill_line:
215
+	/* Preserve registers */
216
+	pushw	%ax
217
+	pushw	%cx
218
+	/* Print CR */
219
+	movb	$'\r', %al
220
+	call	print_character
221
+	/* Print 79 spaces */
222
+	movb	$' ', %al
223
+	movw	$79, %cx
224
+1:	call	print_character
225
+	loop	1b
226
+	/* Print CR */
227
+	movb	$'\r', %al
228
+	call	print_character
229
+	/* Restore registers and return */
230
+	popw	%cx
231
+	popw	%ax
232
+	ret
233
+	.size	print_kill_line, . - print_kill_line
234
+
202
 /****************************************************************************
235
 /****************************************************************************
203
  * pm_call (real-mode near call)
236
  * pm_call (real-mode near call)
204
  *
237
  *

+ 43
- 12
src/arch/i386/prefix/romprefix.S View File

109
 
109
 
110
 /* Product string
110
 /* Product string
111
  *
111
  *
112
- * Defaults to "gPXE".  If the ROM image is writable at initialisation
113
- * time, it will be filled in to include the PCI bus:dev.fn number of
114
- * the card as well.
112
+ * Defaults to PRODUCT_SHORT_NAME.  If the ROM image is writable at
113
+ * initialisation time, it will be filled in to include the PCI
114
+ * bus:dev.fn number of the card as well.
115
  */
115
  */
116
 prodstr:
116
 prodstr:
117
-	.ascii	"gPXE"
117
+	.ascii	PRODUCT_SHORT_NAME
118
 prodstr_separator:
118
 prodstr_separator:
119
 	.byte	0
119
 	.byte	0
120
 	.ascii	"(PCI "
120
 	.ascii	"(PCI "
346
 	movw	$init_message_prompt, %si
346
 	movw	$init_message_prompt, %si
347
 	xorw	%di, %di
347
 	xorw	%di, %di
348
 	call	print_message
348
 	call	print_message
349
+	movw	$prodstr, %si
350
+	call	print_message
351
+	movw	$init_message_dots, %si
352
+	call	print_message
349
 	/* Wait for Ctrl-B */
353
 	/* Wait for Ctrl-B */
350
 	movw	$0xff02, %bx
354
 	movw	$0xff02, %bx
351
 	call	wait_for_key
355
 	call	wait_for_key
352
 	/* Clear prompt */
356
 	/* Clear prompt */
353
 	pushf
357
 	pushf
354
-	movw	$clear_message, %si
355
 	xorw	%di, %di
358
 	xorw	%di, %di
359
+	call	print_kill_line
360
+	movw	$init_message_done, %si
356
 	call	print_message
361
 	call	print_message
357
 	popf
362
 	popf
358
-	jnz	1f
363
+	jnz	2f
359
 	/* Ctrl-B was pressed: invoke gPXE.  The keypress will be
364
 	/* Ctrl-B was pressed: invoke gPXE.  The keypress will be
360
 	 * picked up by the initial shell prompt, and we will drop
365
 	 * picked up by the initial shell prompt, and we will drop
361
 	 * into a shell.
366
 	 * into a shell.
362
 	 */
367
 	 */
363
 	pushw	%cs
368
 	pushw	%cs
364
 	call	exec
369
 	call	exec
365
-1:
370
+2:
366
 	/* Restore registers */
371
 	/* Restore registers */
367
 	popw	%gs
372
 	popw	%gs
368
 	popw	%fs
373
 	popw	%fs
375
 	lret
380
 	lret
376
 	.size init, . - init
381
 	.size init, . - init
377
 
382
 
383
+/*
384
+ * Note to hardware vendors:
385
+ *
386
+ * If you wish to brand this boot ROM, please do so by defining the
387
+ * strings PRODUCT_NAME and PRODUCT_SHORT_NAME in config/general.h.
388
+ *
389
+ * While nothing in the GPL prevents you from removing all references
390
+ * to gPXE or http://etherboot.org, we prefer you not to do so.
391
+ *
392
+ * If you have an OEM-mandated branding requirement that cannot be
393
+ * satisfied simply by defining PRODUCT_NAME and PRODUCT_SHORT_NAME,
394
+ * please contact us.
395
+ *
396
+ * [ Including an ASCII NUL in PRODUCT_NAME is considered to be
397
+ *   bypassing the spirit of this request! ]
398
+ */
378
 init_message:
399
 init_message:
400
+	.ascii	"\n"
401
+	.ascii	PRODUCT_NAME
402
+	.ascii	"\n"
379
 	.asciz	"gPXE (http://etherboot.org) - "
403
 	.asciz	"gPXE (http://etherboot.org) - "
380
 	.size	init_message, . - init_message
404
 	.size	init_message, . - init_message
381
 init_message_pci:
405
 init_message_pci:
394
 	.asciz	" INT19"
418
 	.asciz	" INT19"
395
 	.size	init_message_int19, . - init_message_int19
419
 	.size	init_message_int19, . - init_message_int19
396
 init_message_prompt:
420
 init_message_prompt:
397
-	.asciz	"\nPress Ctrl-B to configure gPXE..."
421
+	.asciz	"\nPress Ctrl-B to configure "
398
 	.size	init_message_prompt, . - init_message_prompt
422
 	.size	init_message_prompt, . - init_message_prompt
399
-clear_message:
400
-	.asciz	"\r                                          \n\n"
401
-	.size	clear_message, . - clear_message
423
+init_message_dots:
424
+	.asciz	"..."
425
+	.size	init_message_dots, . - init_message_dots
426
+init_message_done:
427
+	.asciz	"\n\n"
428
+	.size	init_message_done, . - init_message_done
402
 
429
 
403
 /* ROM image location
430
 /* ROM image location
404
  *
431
  *
454
 	movw	$0xdf42, %bx
481
 	movw	$0xdf42, %bx
455
 	call	wait_for_key
482
 	call	wait_for_key
456
 	pushf
483
 	pushf
457
-	movw	$clear_message, %si
458
 	xorw	%di, %di
484
 	xorw	%di, %di
485
+	call	print_kill_line
486
+	movw	$int19_message_done, %si
459
 	call	print_message
487
 	call	print_message
460
 	popf
488
 	popf
461
 	jnz	1f
489
 	jnz	1f
482
 int19_message_dots:
510
 int19_message_dots:
483
 	.asciz	"..."
511
 	.asciz	"..."
484
 	.size	int19_message_dots, . - int19_message_dots
512
 	.size	int19_message_dots, . - int19_message_dots
513
+int19_message_done:
514
+	.asciz	"\n\n"
515
+	.size	int19_message_done, . - int19_message_done
485
 	
516
 	
486
 /* Execute as a boot device
517
 /* Execute as a boot device
487
  *
518
  *

+ 16
- 0
src/config/general.h View File

9
 
9
 
10
 #include <config/defaults.h>
10
 #include <config/defaults.h>
11
 
11
 
12
+/*
13
+ * Branding
14
+ *
15
+ * Vendors may use these strings to add their own branding to gPXE.
16
+ * PRODUCT_NAME is displayed prior to any gPXE branding in startup
17
+ * messages, and PRODUCT_SHORT_NAME is used where a brief product
18
+ * label is required (e.g. in BIOS boot selection menus).
19
+ *
20
+ * To minimise end-user confusion, it's probably a good idea to either
21
+ * make PRODUCT_SHORT_NAME a substring of PRODUCT_NAME or leave it as
22
+ * "gPXE".
23
+ *
24
+ */
25
+#define PRODUCT_NAME ""
26
+#define PRODUCT_SHORT_NAME "gPXE"
27
+
12
 /*
28
 /*
13
  * Timer configuration
29
  * Timer configuration
14
  *
30
  *

+ 14
- 2
src/core/main.c View File

20
 #include <gpxe/shell.h>
20
 #include <gpxe/shell.h>
21
 #include <gpxe/shell_banner.h>
21
 #include <gpxe/shell_banner.h>
22
 #include <usr/autoboot.h>
22
 #include <usr/autoboot.h>
23
+#include <config/general.h>
23
 
24
 
24
 #define NORMAL	"\033[0m"
25
 #define NORMAL	"\033[0m"
25
 #define BOLD	"\033[1m"
26
 #define BOLD	"\033[1m"
39
 	initialise();
40
 	initialise();
40
 	startup();
41
 	startup();
41
 
42
 
42
-	/* Print welcome banner */
43
-	printf ( NORMAL "\n\n\n" BOLD "gPXE " VERSION
43
+	/*
44
+	 * Print welcome banner
45
+	 *
46
+	 *
47
+	 * If you wish to brand this build of gPXE, please do so by
48
+	 * defining the string PRODUCT_NAME in config/general.h.
49
+	 *
50
+	 * While nothing in the GPL prevents you from removing all
51
+	 * references to gPXE or http://etherboot.org, we prefer you
52
+	 * not to do so.
53
+	 *
54
+	 */
55
+	printf ( NORMAL "\n\n" PRODUCT_NAME "\n" BOLD "gPXE " VERSION
44
 		 NORMAL " -- Open Source Boot Firmware -- "
56
 		 NORMAL " -- Open Source Boot Firmware -- "
45
 		 CYAN "http://etherboot.org" NORMAL "\n"
57
 		 CYAN "http://etherboot.org" NORMAL "\n"
46
 		 "Features:" );
58
 		 "Features:" );

Loading…
Cancel
Save