david/ipxe
Archived
1
0

[config] Make PXE stack a compile-time option

For extremely tight space requirements and specific applications, it is
sometimes desirable to create gPXE images that cannot provide the PXE API
functionality to client programs. Add a configuration header option,
PXE_STACK, that can be removed to remove this stack. Also add PXE_MENU
to control the PXE boot menu, which most uses of gPXE do not need.

Signed-off-by: Marty Connor <mdc@etherboot.org>
This commit is contained in:
Joshua Oreman 2009-10-06 19:15:06 -04:00 committed by Marty Connor
parent 9e9cc8c60f
commit fa4aec8f03
11 changed files with 135 additions and 48 deletions

View File

@ -34,5 +34,24 @@ extern void pxe_activate ( struct net_device *netdev );
extern int pxe_deactivate ( void ); extern int pxe_deactivate ( void );
extern int pxe_start_nbp ( void ); extern int pxe_start_nbp ( void );
extern __asmcall void pxe_api_call ( struct i386_all_regs *ix86 ); extern __asmcall void pxe_api_call ( struct i386_all_regs *ix86 );
extern int _pxe_api_call_weak ( struct i386_all_regs *ix86 )
__attribute__ (( weak ));
/**
* Dispatch PXE API call weakly
*
* @v ix86 Registers for PXE call
* @ret present Zero if the PXE stack is present, nonzero if not
*
* A successful return only indicates that the PXE stack was available
* for dispatching the call; it says nothing about the success of
* whatever the call asked for.
*/
static inline int pxe_api_call_weak ( struct i386_all_regs *ix86 )
{
if ( _pxe_api_call_weak != NULL )
return _pxe_api_call_weak ( ix86 );
return -1;
}
#endif /* _PXE_CALL_H */ #endif /* _PXE_CALL_H */

View File

@ -339,6 +339,18 @@ __asmcall void pxe_api_call ( struct i386_all_regs *ix86 ) {
ix86->regs.ax = ret; ix86->regs.ax = ret;
} }
/**
* Dispatch weak PXE API call with PXE stack available
*
* @v ix86 Registers for PXE call
* @ret present Zero (PXE stack present)
*/
int _pxe_api_call_weak ( struct i386_all_regs *ix86 )
{
pxe_api_call ( ix86 );
return 0;
}
/** /**
* Dispatch PXE loader call * Dispatch PXE loader call
* *

View File

@ -445,8 +445,10 @@ static __asmcall void int22 ( struct i386_all_regs *ix86 ) {
break; break;
case 0x0009: /* Call PXE Stack */ case 0x0009: /* Call PXE Stack */
pxe_api_call ( ix86 ); if ( pxe_api_call_weak ( ix86 ) != 0 )
ix86->flags &= ~CF; ix86->flags |= CF;
else
ix86->flags &= ~CF;
break; break;
case 0x000A: /* Get Derivative-Specific Information */ case 0x000A: /* Get Derivative-Specific Information */

View File

@ -126,6 +126,7 @@ prodstr_pci_id:
.size prodstr, . - prodstr .size prodstr, . - prodstr
.globl undiheader .globl undiheader
.weak undiloader
undiheader: undiheader:
.ascii "UNDI" /* Signature */ .ascii "UNDI" /* Signature */
.byte undiheader_len /* Length of structure */ .byte undiheader_len /* Length of structure */
@ -495,6 +496,7 @@ init_message_done:
* *
* May be either within option ROM space, or within PMM-allocated block. * May be either within option ROM space, or within PMM-allocated block.
*/ */
.globl image_source
image_source: image_source:
.long 0 .long 0
.size image_source, . - image_source .size image_source, . - image_source
@ -503,6 +505,7 @@ image_source:
* *
* May be either at HIGHMEM_LOADPOINT, or within PMM-allocated block. * May be either at HIGHMEM_LOADPOINT, or within PMM-allocated block.
*/ */
.globl decompress_to
decompress_to: decompress_to:
.long HIGHMEM_LOADPOINT .long HIGHMEM_LOADPOINT
.size decompress_to, . - decompress_to .size decompress_to, . - decompress_to
@ -644,50 +647,6 @@ exec_message:
.asciz " starting execution\n" .asciz " starting execution\n"
.size exec_message, . - exec_message .size exec_message, . - exec_message
/* UNDI loader
*
* Called by an external program to load our PXE stack.
*/
undiloader:
/* Save registers */
pushl %esi
pushl %edi
pushw %ds
pushw %es
pushw %bx
/* ROM segment address to %ds */
pushw %cs
popw %ds
/* UNDI loader parameter structure address into %es:%di */
movw %sp, %bx
movw %ss:18(%bx), %di
movw %ss:20(%bx), %es
/* Install to specified real-mode addresses */
pushw %di
movw %es:12(%di), %bx
movw %es:14(%di), %ax
movl image_source, %esi
movl decompress_to, %edi
call install_prealloc
popw %di
/* Call UNDI loader C code */
pushl $pxe_loader_call
pushw %cs
pushw $1f
pushw %ax
pushw $prot_call
lret
1: popw %bx /* discard */
popw %bx /* discard */
/* Restore registers and return */
popw %bx
popw %es
popw %ds
popl %edi
popl %esi
lret
.size undiloader, . - undiloader
/* Wait for key press specified by %bl (masked by %bh) /* Wait for key press specified by %bl (masked by %bh)
* *
* Used by init and INT19 code when prompting user. If the specified * Used by init and INT19 code when prompting user. If the specified

View File

@ -0,0 +1,49 @@
.text
.code16
.arch i386
.section ".prefix", "ax", @progbits
/* UNDI loader
*
* Called by an external program to load our PXE stack.
*/
.globl undiloader
undiloader:
/* Save registers */
pushl %esi
pushl %edi
pushw %ds
pushw %es
pushw %bx
/* ROM segment address to %ds */
pushw %cs
popw %ds
/* UNDI loader parameter structure address into %es:%di */
movw %sp, %bx
movw %ss:18(%bx), %di
movw %ss:20(%bx), %es
/* Install to specified real-mode addresses */
pushw %di
movw %es:12(%di), %bx
movw %es:14(%di), %ax
movl image_source, %esi
movl decompress_to, %edi
call install_prealloc
popw %di
/* Call UNDI loader C code */
pushl $pxe_loader_call
pushw %cs
pushw $1f
pushw %ax
pushw $prot_call
lret
1: popw %bx /* discard */
popw %bx /* discard */
/* Restore registers and return */
popw %bx
popw %es
popw %ds
popl %edi
popl %esi
lret
.size undiloader, . - undiloader

View File

@ -91,6 +91,17 @@ REQUIRE_OBJECT ( efi_console );
REQUIRE_OBJECT ( ipv4 ); REQUIRE_OBJECT ( ipv4 );
#endif #endif
/*
* Drag in all requested PXE support
*
*/
#ifdef PXE_MENU
REQUIRE_OBJECT ( pxemenu );
#endif
#ifdef PXE_STACK
REQUIRE_OBJECT ( pxe_call );
#endif
/* /*
* Drag in all requested download protocols * Drag in all requested download protocols
* *

View File

@ -0,0 +1,24 @@
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2, or (at
* your option) any later version.
*/
FILE_LICENCE ( GPL2_OR_LATER );
#include <config/general.h>
/** @file
*
* ROM prefix configuration options
*
*/
/*
* Provide UNDI loader if PXE stack is requested
*
*/
#ifdef PXE_STACK
REQUIRE_OBJECT ( undiloader );
#endif

View File

@ -25,6 +25,8 @@ FILE_LICENCE ( GPL2_OR_LATER );
#define IMAGE_BZIMAGE /* Linux bzImage image support */ #define IMAGE_BZIMAGE /* Linux bzImage image support */
#define IMAGE_COMBOOT /* SYSLINUX COMBOOT image support */ #define IMAGE_COMBOOT /* SYSLINUX COMBOOT image support */
#define PXE_STACK /* PXE stack in gPXE - required for PXELINUX */
#define PXE_MENU /* PXE menu booting */
#define PXE_CMD /* PXE commands */ #define PXE_CMD /* PXE commands */
#define SANBOOT_PROTO_ISCSI /* iSCSI protocol */ #define SANBOOT_PROTO_ISCSI /* iSCSI protocol */

View File

@ -41,6 +41,13 @@ FILE_LICENCE ( GPL2_OR_LATER );
#define NET_PROTO_IPV4 /* IPv4 protocol */ #define NET_PROTO_IPV4 /* IPv4 protocol */
/*
* PXE support
*
*/
//#undef PXE_STACK /* PXE stack in gPXE - you want this! */
//#undef PXE_MENU /* PXE menu booting */
/* /*
* Download protocols * Download protocols
* *

View File

@ -18,6 +18,8 @@ extern void autoboot ( void );
extern int boot_next_server_and_filename ( struct in_addr next_server, extern int boot_next_server_and_filename ( struct in_addr next_server,
const char *filename ); const char *filename );
extern int boot_root_path ( const char *root_path ); extern int boot_root_path ( const char *root_path );
extern int pxe_menu_boot ( struct net_device *netdev );
extern int pxe_menu_boot ( struct net_device *netdev )
__attribute__ (( weak ));
#endif /* _USR_AUTOBOOT_H */ #endif /* _USR_AUTOBOOT_H */

View File

@ -151,7 +151,7 @@ static int netboot ( struct net_device *netdev ) {
buf, sizeof ( buf ) ); buf, sizeof ( buf ) );
pxe_discovery_control = pxe_discovery_control =
fetch_uintz_setting ( NULL, &pxe_discovery_control_setting ); fetch_uintz_setting ( NULL, &pxe_discovery_control_setting );
if ( ( strcmp ( buf, "PXEClient" ) == 0 ) && if ( ( strcmp ( buf, "PXEClient" ) == 0 ) && pxe_menu_boot != NULL &&
setting_exists ( NULL, &pxe_boot_menu_setting ) && setting_exists ( NULL, &pxe_boot_menu_setting ) &&
( ! ( ( pxe_discovery_control & PXEBS_SKIP ) && ( ! ( ( pxe_discovery_control & PXEBS_SKIP ) &&
setting_exists ( NULL, &filename_setting ) ) ) ) { setting_exists ( NULL, &filename_setting ) ) ) ) {