david/ipxe
david
/
ipxe
Archived
1
0
Fork 0
Commit Graph

61 Commits

Author SHA1 Message Date
Michael Brown 2782ccec41 [legal] Add support for the Unmodified Binary Distribution Licence
Add the text for the Unmodified Binary Distribution Licence.  This
Licence allows for the distribution of unmodified binaries built from
publicly available source code, without imposing the obligations of
the GNU General Public License upon anyone who chooses to distribute
only the unmodified binaries built from that source code.  See the
licence text for the precise terms and conditions.

Add the licence GPL2_OR_LATER_OR_UBDL to the set of licences which can
be declared using FILE_LICENCE(), and add the corresponding support to
licence.pl.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-02 12:07:14 +00:00
Michael Brown 4413ab4f5a [build] Allow for a debug level of zero
Allow for an explicit debug level of zero, which will enable
assertions and profiling (i.e. anything controlled by NDEBUG) without
generating any debug messages.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-04-28 14:45:47 +01:00
Michael Brown ca319873bf [build] Fix %.licence build target
Our use of --gc-sections causes the linker to discard the symbols
defined by FILE_LICENCE(), meaning that the resulting licence
determination is incomplete.

We must use the KEEP() directive in the linker script to force the
linker to not discard the licence symbols.  Using KEEP(*(COMMON))
would be undesirable, since there are some symbols in COMMON which we
may wish to discard.

Fix by placing symbols defined by PROVIDE_SYMBOL() (which is used by
FILE_LICENCE()) into a special ".provided" section, which we then mark
with KEEP().  All such symbols are zero-length, so there is no cost in
terms of the final binary size.

Since the symbols are no longer in COMMON, the linker will reject
symbols with the same name coming from multiple objects.  We therefore
append the object name to the licence symbol, to ensure that it is
unique.

Reported-by: Marin Hannache <git@mareo.fr>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-07-16 00:50:54 +02:00
Michael Brown eaa0f47dc2 [build] Avoid sparse undeclared symbol warning for PROVIDE_SYMBOL()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-04-25 15:14:59 +01:00
Michael Brown e024cd39a8 [console] Allow usage to be defined independently for each console
Add the concept of a "console usage", such as "standard output" or
"debug messages".  Allow usages to be associated with each console
independently.  For example, to send debugging output via the serial
port, while preventing it from appearing on the local console:

  #define CONSOLE_SERIAL CONSOLE_USAGE_ALL
  #define CONSOLE_PCBIOS ( CONSOLE_USAGE_ALL & ~CONSOLE_USAGE_DEBUG )

If no usages are explicitly specified, then a default set of usages
will be applied.  For example:

  #define CONSOLE_SERIAL

will have the same affect as

  #define CONSOLE_SERIAL CONSOLE_USAGE_ALL

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-26 17:40:01 +01:00
Michael Brown 18ff2ad53e [debug] Ensure debug address and colourisation fields are fully initialised
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-06 22:02:15 +00:00
Michael Brown 3f13e3d5d2 [build] Allow DEBUG=... to affect builds of assembler source files
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-03-01 14:18:35 +00:00
Michael Brown 66531a5918 [debug] Add DBG_MD5() and related macros
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-12-09 13:13:31 +00:00
Michael Brown ea0fcb9460 [fnrec] Enhance function recording
Enhance the information collected by the function recorder to include
the call site and entry/exit counts.  This allows fnrec.pl to produce
a call tree such as:

    step (from core/getkey.c:46 = 0x17e90) {
      ref_increment (from core/process.c:93 = 0x73ec) { }
      net_step (from core/process.c:96 = 0x73f1) {
        net_poll (from net/netdevice.c:741 = 0xbce6) {
          netdev_poll (from net/netdevice.c:700 = 0xbc58) { }
          netdev_rx_dequeue (from net/netdevice.c:709 = 0xbc65) { }
        }
      }
      ref_decrement (from core/process.c:96 = 0x73f9) { }
    }

Note that inlined functions are reported, confusingly, as extra calls
to the *containing* function.  Minimise this confusion by adding the
attribute "no_instrument_function" to all functions declared as
inline.  (Static functions that have been inlined autonomously by gcc
will still be problematic, but these are far fewer in number.)

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-12-09 13:11:27 +00:00
Michael Brown 79dd00bb3a [build] Remove unnecessary constraint on DBG_ENABLE()/DBG_DISABLE()
DBG_ENABLE() and DBG_DISABLE() are currently constrained to enabling
and disabling only debug levels that are compiled in for the current
object.  For example, a DBG_ENABLE(DBGLVL_EXTRA) in foo.c will not be
able to affect output from other objects at DBGLVL_EXTRA unless foo.c
is itself compiled with DBGLVL_EXTRA enabled.

Partially fix by removing this unnecessary constraint.  (Note that it
is still necessary for at least one debug level to be compiled in for
the object invoking DBG_ENABLE()/DBG_DISABLE().)

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-09-12 22:24:06 +01:00
Joshua Oreman 49d6f57005 [compiler] Prevent empty weak function stubs from being removed
Even with the noinline specifier added by commit 1a260f8, gcc may skip
calls to non-inlinable functions that it knows have no side
effects. This caused the get_cached_dhcpack() call in start_dhcp(),
the weak stub of which has no code in its body, to be removed,
preventing cached DHCP from working.

Fix by adding a __keepme macro to compiler.h expanding to asm(""), as
recommended by gcc's info page, and using it in the weak stub for
get_cached_dhcpack().

Reported-by: Aaron Brooks <aaron@brooks1.net>
Tested-by: Aaron Brooks <aaron@brooks1.net>
Signed-off-by: Joshua Oreman <oremanj@rwcr.net>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-08-19 13:37:52 +01:00
Stefan Hajnoczi 8ee6d216e4 [build] Mark weak functions noinline
Weak functions whose visibility is hidden may be inlined due to a bug
in GCC.  Explicitly mark weak functions noinline to work around the
problem.

This makes the PXE_MENU config option work again, the PXE boot menu
was never being called because the compiler inlined a weak stub
function.

The GCC bug was identified and fixed by Richard Sandiford
<rdsandiford@googlemail.com> but in the meantime iPXE needs to
implement a workaround.

Reported-by: Steve Jones <steve@squaregoldfish.co.uk>
Reported-by: Shao Miller <shao.miller@yrdsb.edu.on.ca>
Suggested-by: Joshua Oreman <oremanj@rwcr.net>
Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-07-14 12:55:59 +01:00
Michael Brown 7aa1d70e52 [debug] Expose pause() and more() debugging functions
Include the pause() and more() debugging functions within the general
iPXE debugging framework, by introducing DBGxxx_PAUSE() and
DBGxxx_MORE() macros.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-07-14 12:28:18 +01:00
Michael Brown 307b39c08c [build] Remove PACKED macro
Most of iPXE uses __attribute__((packed)) anyway, and PACKED conflicts
with an identically-named macro in the upstream EFI header files.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-05-29 23:49:47 +01:00
Joshua Oreman 2aad3fab23 [build] Use weak definitions instead of weak declarations
This removes the need for inline safety wrappers, marginally reducing
the size penalty of weak functions, and works around an apparent
binutils bug that causes undefined weak symbols to not actually be
NULL when compiling with -fPIE (as EFI builds do).

A bug in versions of binutils prior to 2.16 (released in 2005) will
cause same-file weak definitions to not work with those
toolchains. Update the README to reflect our new dependency on
binutils >= 2.16.

Signed-off-by: Joshua Oreman <oremanj@rwcr.net>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-05-27 10:19:14 +01:00
Michael Brown 8406115834 [build] Rename gPXE to iPXE
Access to the gpxe.org and etherboot.org domains and associated
resources has been revoked by the registrant of the domain.  Work
around this problem by renaming project from gPXE to iPXE, and
updating URLs to match.

Also update README, LOG and COPYRIGHTS to remove obsolete information.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-04-19 23:43:39 +01:00
Joshua Oreman 2d58a62330 [linker] Add safe weak symbol macros
Weak symbols are a useful tool in eliminating unnecessary dependencies
between object files, but they are somewhat dangerous because one must
remember to test the weak symbol against NULL before using it. To
rectify that, add macros for declaring weak functions that will return
a default value inline if the file defining them is not available at
link time.

Signed-off-by: Marty Connor <mdc@etherboot.org>
2010-01-20 17:05:25 -05:00
Joshua Oreman 9a0bd0711f [linker] Add mechanism for subsystem-dependent configuration options
It is often the case that some module of gPXE is only relevant if the
subsystem it depends on is already being included. For instance,
commands to manage wireless interfaces are quite useless if no
compiled-in driver has pulled in the wireless networking stack. There
may be a user-modifiable configuration options for these dependent
modules, but even if enabled, they should not be included when they
would be useless.

Solve this by allowing the creation of config_subsystem.c, for
configuration directives like those in the global config.c that should
only be considered when subsystem.c is included in the final gPXE
build.

For consistency, move core/config.c to the config/ directory, where
the other config_subsystem.c files will eventually reside.

Signed-off-by: Marty Connor <mdc@etherboot.org>
2009-11-20 20:30:58 -05:00
Joshua Oreman 572e61754a [linker] Expand and correct symbol requirement macros
REQUIRE_SYMBOL() formerly used a formulation of symbol requirement
that would allow a link to succeed despite lacking a required symbol,
because it did not introduce any relocations. Fix by renaming it to
REQUEST_SYMBOL() (since the soft-requirement behavior can be useful)
and add a REQUIRE_SYMBOL() that truly requires.

Add EXPORT_SYMBOL() and IMPORT_SYMBOL() for REQUEST_SYMBOL()-like
behavior that allows one to make use of the symbol, by combining a
weak external on the symbol itself with a REQUEST_SYMBOL() of a second
symbol.

Signed-off-by: Marty Connor <mdc@etherboot.org>
2009-11-20 20:27:25 -05:00
Joshua Oreman 3f274a6950 [legal] Add MIT licence declaration
Signed-off-by: Michael Brown <mcb30@etherboot.org>
2009-08-09 00:13:29 +01:00
Michael Brown a525fb7782 [legal] Add mechanism for explicit per-file licence declarations
For partly historical reasons, various files in the gPXE source tree
are licensed under different, though compatible, terms.  Most of the
code is licensed under GPLv2 with the "or later" clause, but there are
exceptions such as:

  The string.h file, which derives from Linux and is licensed as
  Public Domain.

  The EFI header files, which are taken from the EDK2 source tree and
  are licensed under BSD.

  The 3c90x driver, which has a custom GPL-like licence text.

Introduce a FILE_LICENCE() macro to make licensing more explicit.
This macro should be applied exactly once to each source (.c, .S or
.h) file.  It will cause a corresponding zero-sized common symbol to
be added to any .o files generated from that source file (and hence to
any final gPXE binaries generated from that source file).  Determining
the applicable licences to generated files can then be done using e.g.

  $ objdump -t bin/process.o | grep __licence
  00000000       O *COM*  00000001 .hidden __licence_gpl2_or_later

indicating that bin/process.o is covered entirely by the GPLv2
with the "or later" clause, or

  $ objdump -t bin/rtl8139.dsk.tmp | grep __licence
  00033e8c g     O .bss.textdata  00000000 .hidden __licence_gpl2_only
  00033e8c g     O .bss.textdata  00000000 .hidden __licence_gpl2_or_later
  00033e8c g     O .bss.textdata  00000000 .hidden __licence_public_domain

indicating that bin/rtl8139.dsk includes both code licensed under
GPLv2 (both with and without the "or later" clause) and code licensed
as Public Domain.

Determining the result of licence combinations is currently left as an
exercise for the reader.
2009-05-18 08:26:08 +01:00
Michael Brown 7c47ebd65c [build] Add {PROVIDE,REQUIRE}_SYMBOL macros and tidy up compiler.h 2009-04-27 14:04:35 +01:00
Michael Brown 1c67623e37 [build] Enable building with the Intel C compiler (icc) 2009-03-26 07:27:19 +00:00
Michael Brown b08e255ef1 [build] Fix building on gcc 3
GCC did not support #pragma GCC visibility until version 4.0.
2009-02-16 02:15:17 +00:00
Michael Brown ce0a0ccf5c [x86_64] Add support for compilation as an x86_64 binary
Currently the only supported platform for x86_64 is EFI.

Building an EFI64 gPXE requires a version of gcc that supports
__attribute__((ms_abi)).  This currently means a development build of
gcc; the feature should be present when gcc 4.4 is released.

In the meantime; you can grab a suitable gcc tree from

  git://git.etherboot.org/scm/people/mcb30/gcc/.git
2008-12-05 00:06:27 +00:00
Michael Brown dc60c24146 [i386] Rename __cdecl to __asmcall
__cdecl is a misleading name, since it currently encapsulates both
cdecl and regparm(0) attributes.  Rename to __asmcall.
2008-11-19 19:12:53 +00:00
Michael Brown afe1323c76 [compiler] Allow for selective disabling of debug levels at runtime
The usefulness of DBGLVL_IO is limited by the fact that many cards
require large numbers of uninteresting I/O reads/writes at device
probe time, typically when driving a bit-bashing I2C/SPI bus to read
the MAC address.

This patch adds the DBG_DISABLE() and DBG_ENABLE() macros, which can
be used to temporarily disable and re-enable selected debug levels.
Note that debug levels must still be enabled in the build in order to
function at all: you can't use DBG_ENABLE(DBGLVL_IO) in an object
built with DEBUG=object:1 and expect it to do anything.
2008-10-01 19:24:56 +01:00
Michael Brown 9b01a9fd9c [compiler] Add __always_inline macro 2008-10-01 19:24:56 +01:00
Michael Brown 0d91c37ce5 [legacy] Align legacy drivers' __shared data to the maximum possible
Some drivers that still use the legacy-driver wrapper (tg3 in particular)
apparently do not specify their alignment constraints properly.  This
hack forces any __shared data to be maximally aligned.

Note that this provides only 16-byte alignment; it is not possible to
request alignment to any greater than 16 bytes using
__attribute__((aligned)), since the relocation code will preserve only 16
byte alignment (and operation under -DKEEP_IT_REAL cannot preserve more
that 16 byte alignment).

Idea proposed by Tim Hockin <thockin@google.com>
2008-06-14 20:01:14 +01:00
Michael Brown 604c934981 Add DBGLVL_IO to trace all memory-mapped I/O. 2008-02-21 12:44:09 +00:00
Michael Brown 746d0f8feb Merge commit 'holger/strings' 2007-08-23 21:51:57 +01:00
Holger Lubitz 2220e1a676 define malloc attribute 2007-08-20 20:28:11 +02:00
Michael Brown a895fd0c15 Add barrier() primitive (was present in Eb5.4), used by some currently
out-of-tree driver code.
2007-08-18 18:04:50 +01:00
Holger Lubitz e3d10ac673 define __nonnull 2007-08-02 01:01:01 +02:00
Holger Lubitz cd619a1eec define __pure and __const 2007-08-02 00:27:54 +02:00
Michael Brown a6a1052096 Applied a modified version of holger's regparm patches. 2007-07-29 00:17:25 +01:00
Michael Brown 9aa61ad5a2 Add per-file error identifiers 2007-07-24 17:11:31 +01:00
Michael Brown 395c76e94d Use "dbg_stream" rather than "stream" as a variable name in
DBG_AC_IF(), to avoid namespace collisions.
2007-01-30 10:12:19 +00:00
Michael Brown d12770e254 console.h is no longer needed for debugging 2007-01-18 19:13:25 +00:00
Michael Brown f781a98ac4 Add DBGLVL_PROFILE 2007-01-18 17:59:59 +00:00
Michael Brown 3b77c7aa1b Hex dumps are now integrated into the DBG() framework. 2007-01-13 16:49:38 +00:00
Michael Brown 2494625702 Added auto-colourising DBGC() macro 2006-12-29 03:05:21 +00:00
Michael Brown b16de6ae66 Inhibit compiler warnings on DBG() when building a non-debug object,
while retaining the format string checking.
2006-09-27 11:09:56 +00:00
Marty Connor e2aca77132 update DBG_DISCARD macro to allow the compiler to see the argument for compile-time checking, while still having it optimized away during compilation 2006-09-14 17:38:17 +00:00
Michael Brown 50415b3aca Make DBG_DISCARD correct 2006-06-01 12:11:09 +00:00
Michael Brown af23ff8a24 Assertions are now handled via the POSIX-like <assert.h>. 2006-03-23 19:33:57 +00:00
Michael Brown a96759f9c8 Use "#var" rather than "@c var" for doxygen. 2005-05-20 10:27:02 +00:00
Michael Brown a9fabe7546 Doxygenation 2005-05-19 19:00:21 +00:00
Michael Brown 484d6e7d24 __attribute__ does not need to be treated as a variadic macro, since
it is always used as __attribute__((...)).  Since variadic macros seem
to confuse poor doxygen, change it to a single-valued macro.
2005-05-18 15:02:23 +00:00
Michael Brown 75a90cb143 Hide __attribute__ from doxygen 2005-05-18 14:42:02 +00:00