Procházet zdrojové kódy

[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 před 16 roky
rodič
revize
5e6b82104d

+ 33
- 0
src/arch/i386/prefix/libprefix.S Zobrazit soubor

@@ -199,6 +199,39 @@ print_pci_busdevfn:
199 199
 	ret
200 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 236
  * pm_call (real-mode near call)
204 237
  *

+ 43
- 12
src/arch/i386/prefix/romprefix.S Zobrazit soubor

@@ -109,12 +109,12 @@ mfgstr:
109 109
 
110 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 116
 prodstr:
117
-	.ascii	"gPXE"
117
+	.ascii	PRODUCT_SHORT_NAME
118 118
 prodstr_separator:
119 119
 	.byte	0
120 120
 	.ascii	"(PCI "
@@ -346,23 +346,28 @@ no_pmm:
346 346
 	movw	$init_message_prompt, %si
347 347
 	xorw	%di, %di
348 348
 	call	print_message
349
+	movw	$prodstr, %si
350
+	call	print_message
351
+	movw	$init_message_dots, %si
352
+	call	print_message
349 353
 	/* Wait for Ctrl-B */
350 354
 	movw	$0xff02, %bx
351 355
 	call	wait_for_key
352 356
 	/* Clear prompt */
353 357
 	pushf
354
-	movw	$clear_message, %si
355 358
 	xorw	%di, %di
359
+	call	print_kill_line
360
+	movw	$init_message_done, %si
356 361
 	call	print_message
357 362
 	popf
358
-	jnz	1f
363
+	jnz	2f
359 364
 	/* Ctrl-B was pressed: invoke gPXE.  The keypress will be
360 365
 	 * picked up by the initial shell prompt, and we will drop
361 366
 	 * into a shell.
362 367
 	 */
363 368
 	pushw	%cs
364 369
 	call	exec
365
-1:
370
+2:
366 371
 	/* Restore registers */
367 372
 	popw	%gs
368 373
 	popw	%fs
@@ -375,7 +380,26 @@ no_pmm:
375 380
 	lret
376 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 399
 init_message:
400
+	.ascii	"\n"
401
+	.ascii	PRODUCT_NAME
402
+	.ascii	"\n"
379 403
 	.asciz	"gPXE (http://etherboot.org) - "
380 404
 	.size	init_message, . - init_message
381 405
 init_message_pci:
@@ -394,11 +418,14 @@ init_message_int19:
394 418
 	.asciz	" INT19"
395 419
 	.size	init_message_int19, . - init_message_int19
396 420
 init_message_prompt:
397
-	.asciz	"\nPress Ctrl-B to configure gPXE..."
421
+	.asciz	"\nPress Ctrl-B to configure "
398 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 430
 /* ROM image location
404 431
  *
@@ -454,8 +481,9 @@ int19_entry:
454 481
 	movw	$0xdf42, %bx
455 482
 	call	wait_for_key
456 483
 	pushf
457
-	movw	$clear_message, %si
458 484
 	xorw	%di, %di
485
+	call	print_kill_line
486
+	movw	$int19_message_done, %si
459 487
 	call	print_message
460 488
 	popf
461 489
 	jnz	1f
@@ -482,6 +510,9 @@ int19_message_prompt:
482 510
 int19_message_dots:
483 511
 	.asciz	"..."
484 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 517
 /* Execute as a boot device
487 518
  *

+ 16
- 0
src/config/general.h Zobrazit soubor

@@ -9,6 +9,22 @@
9 9
 
10 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 29
  * Timer configuration
14 30
  *

+ 14
- 2
src/core/main.c Zobrazit soubor

@@ -20,6 +20,7 @@ Literature dealing with the network protocols:
20 20
 #include <gpxe/shell.h>
21 21
 #include <gpxe/shell_banner.h>
22 22
 #include <usr/autoboot.h>
23
+#include <config/general.h>
23 24
 
24 25
 #define NORMAL	"\033[0m"
25 26
 #define BOLD	"\033[1m"
@@ -39,8 +40,19 @@ __cdecl int main ( void ) {
39 40
 	initialise();
40 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 56
 		 NORMAL " -- Open Source Boot Firmware -- "
45 57
 		 CYAN "http://etherboot.org" NORMAL "\n"
46 58
 		 "Features:" );

Načítá se…
Zrušit
Uložit