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

187 Commits

Author SHA1 Message Date
Michael Brown 196751ce95 [build] Enable warnings when building utilities
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-04-10 19:38:54 +01:00
Michael Brown 8685280cbd [build] Allow a client certificate to be specified at build time
Allow a client certificate and corresponding private key to be
specified at build time using the syntax

  make CERT=/path/to/certificate KEY=/path/to/key

The build process uses openssl to convert the files into DER format,
and includes them within the client certificate store in
clientcert.c.  The build process will prompt for the private key
password if applicable.

Note that the private key is stored unencrypted, and so the resulting
iPXE binary (and the temporary files created during the build process)
should be treated as being equivalent to an unencrypted private key
file.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-20 20:39:11 +00:00
Michael Brown aee3a064f2 [build] Allow trusted root certificates to be specified at build time
Allow trusted root certificates to be specified at build time using
the syntax

  make TRUST=/path/to/certificate1,/path/to/certificate2,...

The build process uses openssl to calculate the SHA-256 fingerprints
of the specified certificates, and adds them to the root certificate
store in rootcert.c.  The certificates can be in any format understood
by openssl.

The certificates may be server certificates or (more usefully) CA
certificates.

If no trusted certificates are specified, then the default "iPXE root
CA" certificate will be used.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-19 00:23:29 +00:00
Michael Brown 95d82bb2a2 [build] Avoid using -ffunction-sections on some older versions of gcc
Some older versions of gcc issue a warning if -ffunction-sections is
used in combination with -g (gcc bug #18553).  Inhibit
-ffunction-sections when building with such a version of gcc.

Reported-by: zhengwei <zw111_2001@126.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-06-29 11:48:29 +01:00
Michael Brown 57e65d2c4d [build] Accept EMBED=... as a synonym for EMBEDDED_IMAGE=...
Make the build command line less cumbersome by accepting

  make DEBUG=int13 EMBED=test.ipxe

rather then

  make DEBUG=int13 EMBEDDED_IMAGE=test.ipxe

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-04-28 11:56:27 +01:00
Michael Brown bd9ff16c21 [build] Run parserom.pl only on potential driver files
PCI_ROM() and ISA_ROM() macros occur only within driver files.
Running parserom.pl on non-driver files is therefore redundant.

Skip running parserom.pl on any files outside a "drivers" directory.
This reduces the time taken to generate build rules and dependencies
after a "make veryclean" by around 12%.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-04-09 23:41:45 +01:00
Michael Brown 6e6ecacebf [build] Refuse to attempt building with the GNU gold linker
GNU gold (part of newer binutils builds) does not appear to be
designed to support generic linker functionality, since its source
code contains several Linux-specific hard-coded assumptions about the
layout of ELF binaries.  Attempting to build iPXE using GNU gold will
generally cause some kind of "linker internal error".

Provide an explicit error message suggesting the use of GNU ld
instead.

Reported-by: Chris Hills <chaz@chaz6.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-04-05 14:59:27 +01:00
Michael Brown 7514172b50 [build] Perform tool checks on each make invocation
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-04-05 14:51:03 +01:00
Bastian Blank 293e347a2e [build] Add "allmroms" target
Signed-off-by: Bastian Blank <waldi@debian.org>
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-03-30 16:19:23 +01:00
Michael Brown 647522793d [build] Include $(BIN)/errors in "make clean"
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-03-30 15:55:14 +01:00
Michael Brown 83994886ab [build] Remove obsolete "allzroms" target
The .zrom format has not existed since around 2007.  ROMs are now
compressed by default.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-03-30 15:22:19 +01:00
Gilles Espinasse fe61f6de0d [build] Fix compilation when gcc is patched to default to -fPIE -Wl,-pie
Signed-off-by: Gilles Espinasse <g.esp@free.fr>
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-03-29 15:33:28 +01:00
Michael Brown 7ccd5b831a [build] Delete incomplete targets if building fails for any reason
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-03-27 22:37:03 +01:00
Michael Brown c8e51f80a8 [build] Avoid spurious address comparison warnings in gcc 4.6
A construction such as "assert ( ptr != NULL )" seems to trigger a
false positive warning in gcc 4.6 if the value of "ptr" is known at
compile-time to be non-NULL.  Use -Wno-address to inhibit this
warning.

Reported-by: Ralph Giles <giles@thaumas.net>
Tested-by: Ralph Giles <giles@thaumas.net>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-03-16 19:32:17 +00:00
Michael Brown b8924c1aed [build] Allow workaround-specific flags to override default flags
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-03-16 19:31:41 +00:00
Michael Brown 9b68dc78b9 [build] Avoid rebuilding keymap files automatically
The keymap files, though autogenerated, are checked in to version
control and should be considered as source files.  They should never
be automatically rebuilt.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-03-16 14:06:46 +00:00
Michael Brown 1febd879e3 [console] Add keymap generator
Inspired by LILO's keytab-lilo.pl, genkeymap.pl uses "loadkeys -b" to
obtain a Linux keyboard map, and generates a file keymap_xx.c in
hci/keymap.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-03-16 12:02:59 +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 030e5a064e [build] Use unique entry symbols for each prefix
Some binutils versions will drag in an object to satisfy the entry
symbol; some won't.  Try to cope with this exciting variety of
behaviour by ensuring that all entry symbols are unique.

Remove the explicit inclusion of the prefix object on the linker
command line, since the entry symbol now provides all the information
needed to identify the prefix.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-02-23 21:12:56 +00:00
Michael Brown 623469de5d [build] Eliminate unused sections at link-time
Use -ffunction-sections, -fdata-sections, and --gc-sections to
automatically prune out any unreferenced sections.

This saves around 744 bytes (uncompressed) from the rtl8139.rom build.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-02-22 21:02:00 +00:00
Michael Brown e65e4e930c [legal] Ignore config/local header files for licensing purposes
The config/local/*.h files are expected to be empty in most cases.
This should not cause a licence determination to fail.

Fix by ignoring config/local/*.h for licensing purposes.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-10-18 01:25:42 +01:00
Michael Brown c9aff55320 [build] Fix building elf2efi using binutils 2.20
When using binutils 2.20, it seems to be necessary to add -ldl to link
against -lbfd.

Reported-by: Duane Voth <duanev@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-10-14 23:01:15 +01:00
Michael Brown 42a1f43bf9 [build] Provide %.fd0 build targets only for pcbios
Originally-fixed-by: Piotr Jaroszyński <p.jaroszynski@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-08-17 14:36:39 +01:00
Piotr Jaroszyński 2d98d4a018 [build] Properly handle multiple goals per BIN directory
When building multiple targets per BIN with multiple jobs, for
example:

  make -j16 bin-i386-efi/ipxe.efi{,drv,rom} bin-x86_64-efi/ipxe.efi{,drv,rom}

we would invoke a make subprocess for each goal in parallel resulting
in multiple makes running in a single BIN directory.  Fix by grouping
goals per BIN directory and invoking only one make per BIN.  It is
both safer and faster.

Signed-off-by: Piotr Jaroszyński <p.jaroszynski@gmail.com>
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-08-16 17:26:20 +01:00
Geoff Lywood b8dd94686b [efi] Fix the 32-bit version of elf2efi64
Currently, if elf2efi.c is compiled using a 32-bit HOST_CC, then the
resulting elf2efi64 binary will generate 32-bit EFI binaries instead
of 64-bit EFI binaries.

The problem is that elf2efi.c uses the MDE_CPU_* definitions to decide
whether to output a 32-bit or 64-bit PE binary.  However, MDE_CPU_*
gets defined in ProcessorBind.h, depending on the compiler's target
architecture.  Overriding them on the command line doesn't work in the
expected way, and you can end up in cases where both MDE_CPU_IA32 and
MDE_CPU_X64 are defined.

Fix by using a separate definition, EFI_TARGET_IA32/EFI_TARGET_X64,
which is specified only on the command line.

Signed-off-by: Geoff Lywood <glywood@vmware.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-07-21 12:41:41 +01:00
Michael Brown 770317a57d [build] Speed up rebuilding on header file changes
Split src_template into deps_template (which handles the definition of
foo_DEPS) and rules_template (which handles the rules referencing
foo_DEPS).  The rules_template is not affected by any included header
files and so does not need to be reprocessed following a change to an
included header file.

This reduces the time required to rebuild the Makefile rules following
a change to stdint.h by around 45%, at a cost of increasing the time
required to rebuild after a "make veryclean" by around 3%.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-07-14 18:47:35 +01:00
Michael Brown f00c3c619a [build] Standardise variable naming for inter-build state files
For files such as $(BIN)/.blib.list, standardise the variable names
used to represent the file contents.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-07-14 17:45:49 +01:00
Michael Brown 4d73b49d60 [build] Avoid unnecessary "rm" and "touch" in dependency generation
Speed up dependency generation by omitting the totally unnecessary
"rm" and "touch" commands.  This reduces the time taken to generate
dependencies by around 6%.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-07-14 17:00:51 +01:00
Michael Brown 719b49879d [build] Fix broken build caused by implied dependency upon "perl"
Commit ea12dc0 ("[build] Avoid hard-coding the path to perl")
introduced a build failure for fully clean trees (e.g. after running
"make veryclean"), since the dependency upon $(PARSEROM) now includes
a dependency upon "perl" (which doesn't exist) rather than upon
"/usr/bin/perl" (which does exist).

There should of course be no dependency upon the perl binary at all;
the dependency should be upon "./util/parserom.pl" alone.

Fix by removing the $(PERL) from the definition of Perl-based utility
paths, and adding $(PERL) at the point of usage.

Reported-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-06-24 17:25:54 +01:00
Michael Brown 6c0e8c14be [libc] Enable automated extraction of error usage reports
Add preprocessor magic to the error definitions to enable every error
usage to be tracked.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-05-31 03:11:57 +01:00
Geoff Lywood 6514d6430d [dhcp] Use correct DHCP options on EFI systems
See RFC 4578 for details.

Signed-off-by: Joshua Oreman <oremanj@rwcr.net>
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-05-29 08:51:46 +01:00
Geoff Lywood a5ad78f27e [build] Allow building against a zlib in a non-standard location
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-05-27 23:00:07 +01:00
Piotr Jaroszyński c68839d4d6 [efi] Fix .efi and .efidrv linking
The linker chooses to look for _start first and always picks
efidrvprefix.o to satisfy it (probably because it's earlier in the
archive) which causes a multiple definition error when the linker
later has to pick efiprefix.o for other symbols.

Fix by using EFI-specific TGT_LD_FLAGS with an explicit entry point.

Signed-off-by: Piotr Jaroszyński <p.jaroszynski@gmail.com>
Signed-off-by: Joshua Oreman <oremanj@rwcr.net>
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-05-27 10:38:12 +01:00
Piotr Jaroszyński ba27168c2e [efi] Fix link order for elf2efi
Dependencies are considered in left-to-right order so the source file
needs to come first in this case.

Signed-off-by: Piotr Jaroszyński <p.jaroszynski@gmail.com>
Signed-off-by: Joshua Oreman <oremanj@rwcr.net>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-05-27 10:15:49 +01:00
Michael Brown 28f73ca54e [build] Inhibit "skipping incompatible" message from ld
On 64-bit systems with both 32-bit and 64-bit libraries installed, ld
tends to generate noisy "skipping incompatible /usr/lib/libxxx.so"
messages when building elf2efi.c.

Fix by passing --no-warn-search-mismatch to ld.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-05-27 09:42:53 +01:00
Michael Brown d8c1f2e94f [build] Replace obsolete makerom.pl with quick script using Option::ROM
The only remaining useful function of makerom.pl is to correct the ROM
and PnP checksums; the PCI IDs are set at link time, and padding is
performed using padimg.pl.

Option::ROM already provides a facility for correcting the checksums,
so we may as well just use this instead.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-04-25 02:54:12 +01:00
Michael Brown 58f6e55362 [build] Generate random build identifier
Randomly generate a 32-bit build identifier that can be used to
identify identical iPXE ROMs when multiple such ROMs are present in a
system (e.g. when a multi-function NIC exposes the same iPXE ROM image
via each function's expansion ROM BAR).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-04-25 01:50:46 +01:00
Michael Brown 8ffea19225 [romprefix] Remove .hrom prefix
The .hrom prefix provides an experimental mechanism for reducing
option ROM space usage on systems where PMM allocation fails, by
pretending that PMM allocation succeeded and gave us an address fixed
at compilation time.  This is unreliable, and potentially dangerous.
In particular, when multiple gPXE ROMs are present in a system, each
gPXE ROM will assume ownership of the same fixed address, resulting in
undefined behaviour.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-04-19 23:43:48 +01:00
Michael Brown 329686c026 [romprefix] Remove .xrom prefix
The .xrom prefix provides an experimental mechanism for loading ROM
images greater than 64kB in size by mapping the expansion ROM BAR in
at a hopefully-unused address.  This is unreliable, and potentially
dangerous.  In particular, there is no guarantee that any PCI bridges
between the CPU and the device will respond to accesses for the
"unused" memory region that is chosen, and it is possible that the
process of scanning for the "unused" memory region may end up issuing
reads to other PCI devices.  If this ends up trampling on a register
with read side-effects belonging to an unrelated PCI device, this may
cause undefined behaviour.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-04-19 23:43:48 +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
Piotr Jaroszyński 46d6ec7d77 [build] Add support for local configuration files
Include config/local/$file in config/$file where it makes sense and
create empty local configs during build if not present.

Modified-by: Michael Brown <mcb30@etherboot.org>
Signed-off-by: Michael Brown <mcb30@etherboot.org>
2010-03-26 19:07:22 +00:00
Stefan Hajnoczi 6a6f26f74d [fnrec] Add function recorder for debugging
The function recorder is a crash and hang debugging tool.  It logs each
function call into a memory buffer while gPXE runs.  After the machine
is reset, and if the contents of memory have not been overwritten, gPXE
will detect the memory buffer and print out its contents.

This allows developers to see a trace of the last functions called
before a crash or hang.  The util/fnrec.sh script can be used to convert
the function addresses back into symbol names.

To build with fnrec:

    make FNREC=1

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Marty Connor <mdc@etherboot.org>
2010-03-04 11:38:29 -05:00
Stefan Hajnoczi 5782794e20 [build] Disable ccache for embedded.o
Embedded image support uses .incbin in inline assembly to include binary
files.  The file dependency is not spotted by ccache when deciding
whether or not to rebuild embedded.o.  This results in builds that
contain an outdated version of the embedded image when ccache is used.

Reported-by: Tim 'Shaggy' Bielawa <tbielawa@jabber.org>
Reported-by: Matt Domsch <Matt_Domsch@dell.com>
Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Marty Connor <mdc@etherboot.org>
2010-03-04 11:25:36 -05:00
Joshua Oreman 06a8398422 [prefix] Add .xrom prefix for a ROM that loads itself by PCI accesses
The standard option ROM format provides a header indicating the size
of the entire ROM, which the BIOS will reserve space for, load, and
call as necessary. However, this space is strictly limited to 128k for
all ROMs. gPXE ameliorates this somewhat by reserving space for itself
in high memory and relocating the majority of its code there, but on
systems prior to PCI3 enough space must still be present to load the
ROM in the first place. Even on PCI3 systems, the BIOS often limits the
size of ROM it will load to a bit over 64kB.

These space problems can be solved by providing an artificially small
size in the ROM header: just enough to let the prefix code (at the
beginning of the ROM image) be loaded by the BIOS. To the BIOS, the
gPXE ROM will appear to be only a few kilobytes; it can then load
the rest of itself by accessing the ROM directly using the PCI
interface reserved for that task.

There are a few problems with this approach. First, gPXE needs to find
an unmapped region in memory to map the ROM so it can read from it;
this is done using the crude but effective approach of scanning high
memory (over 0xF0000000) for a sufficiently large region of all-ones
(0xFF) reads. (In x86 architecture, all-ones is returned for accesses
to memory regions that no mapped device can satisfy.) This is not
provably valid in all situations, but has worked well in practice.
More importantly, this type of ROM access can only work if the PCI ROM
BAR exists at all. NICs on physical add-in PCI cards generally must
have the BAR in order for the BIOS to be able to load their ROM, but
ISA cards and LAN-on-Motherboard cards will both fail to load gPXE
using this scheme.

Due to these uncertainties, it is recommended that .xrom only be used
when a regular .rom image is infeasible due to crowded option ROM
space. However, when it works it could allow loading gPXE images
as large as a flash chip one could find - 128kB or even higher.

Signed-off-by: Marty Connor <mdc@etherboot.org>
2010-01-20 17:46:48 -05:00
Joshua Oreman f94845168a [makefile] Allow .sizes target to work with funny-named objects
The bin/xxx.sizes targets examine the list of obj_ symbols in bin/xxx.tmp
to determine which objects to measure the size of. These symbols have been
normalized to C identifiers, so the result is an error message from `size'
when examining a target that includes objects that were originally named
with hyphens.

Fix by turning obj_foo_bar into $(wildcard bin/foo?bar.o) instead of
bin/foo_bar.o.

Signed-off-by: Marty Connor <mdc@etherboot.org>
2010-01-14 11:28:52 -05:00
Joshua Oreman 5736f5eb32 [prefix] Add .hrom prefix for a ROM that loads high under PCI3 without PMM
gPXE currently takes advantage of the feature of PCI3.0 that allows
option ROMs to relocate the bulk of their code to high memory and so
take up only a small amount of space in the option ROM area. Currently,
the relocation can only take place if the BIOS's implementation of PMM
can be made to return blocks aligned to an even megabyte, because of
the A20 gate. AMI BIOSes, in particular, will not return allocations
that gPXE can use.

Ameliorate the situation somewhat by adding a prefix, .hrom, that works
identically to .rom except in the case that PMM allocation fails. Where
.rom would give up and place itself entirely in option ROM space, .hrom
moves to a block (assumed free) at HIGHMEM_LOADPOINT = 4MB. This allows
for the use of larger gPXE ROMs than would otherwise be possible.

Because there is no way to check that the area at HIGHMEM_LOADPOINT is
really free, other devices using that memory during the boot process
will cause failure for gPXE, the other device, or both. In practice
such conflicts will likely not occur, but this prefix should still be
considered EXPERIMENTAL.

Signed-off-by: Marty Connor <mdc@etherboot.org>
2010-01-14 10:56:08 -05:00
Joshua Oreman 3fa2779208 [build] Fix DEBUG builds for filenames with hyphens
Debug builds for filenames with hyphens such as:

     $ make bin/via-rhine.dsk DEBUG=via-rhine

fail with:

     [BUILD] bin/via-rhine.dbg1.o
     <command-line>: error: missing whitespace after the macro name
     make: *** [bin/via-rhine.dbg1.o] Error 1

This is because "-" is not a legal character in C identifiers, and
gcc rejects "-Ddebug_via-rhine=1" as an argument.

Signed-off-by: Daniel Verkamp <daniel@drv.nu>
Signed-off-by: Joshua Oreman <oremanj@rwcr.net>
Signed-off-by: Marty Connor <mdc@etherboot.org>
2009-10-15 14:07:20 -04:00
Michael Brown b3db99a38d [doc] Expand scope of doxygen-generated documentation 2009-08-11 15:14:36 +01:00
Michael Brown 8afafb6532 [build] Add -fno-dwarf2-cfi-asm to CFLAGS if supported by the gcc in use
gcc 4.4 defaults to using .cfi assembler directives for debugging
information, which causes unneeded .eh_frame sections to be generated.
These sections are already stripped out by our linker script, so don't
affect the final build, but do distort the output of "size" when run
on individual .o files; the .eh_frame size is included within the size
reported for .text.  This makes it difficult to accurately judge the
effects of source code changes upon object code size.

Fix by adding -fno-dwarf2-cfi-asm to CFLAGS if we detect that this
option is supported by the gcc that we are compiling with.

Tested-by: Daniel Verkamp <daniel@drv.nu>
2009-05-27 02:30:46 +01:00
Michael Brown 41307f2874 [legal] Add licence.pl and %.licence make target
It is now possible to run e.g.

  make bin/rtl8139.dsk.licence

in order to see a licensing assessment for any given gPXE build.  The
assessment will either produce a single overall licence for the build
(based on combining all the licences used within the source files for
that build), or will exit with an error stating why a licence
assessment is not possible (for example, if there are files involved
that do not yet contain an explicit FILE_LICENCE() declaration).
2009-05-18 08:29:24 +01:00
Michael Brown a1eb4ffdf7 [build] Automatically sort the list of constituent object sizes 2009-04-18 16:20:03 +01:00
Michael Brown ead44dba89 [build] Provide mechanism for listing constituent object sizes
You can now type e.g.

  make bin/rtl8139.rom.sizes

in order to see the (uncompressed) sizes of all of the object files
linked in to bin/rtl8139.rom.  This should make it easier to identify
relevant code bloat.
2009-04-18 15:56:29 +01:00
Michael Brown f721067d35 [build] Kill off the multiple-object-per-source-file mechanism
Now that there are no remaining multiple-object source files, kill off
the mechanism in order to simplify the Makefile.
2009-04-17 13:43:35 +01:00
Michael Brown f79608b376 [build] Provide mechanism for listing per-target source files
You can now type e.g.

  make bin/rtl8139.rom.deps

to see a list of the source files included in the build of
bin/rtl8139.rom.  This is intended to assist with copyright vetting.

Other new debugging targets include

  make bin/rtl8139.rom.objs

to see a list of object files linked in to bin/rtl8139.rom, and

  make bin/rtl8139.rom.nodeps

to see a list of the source files that are *not* required for the
build of bin/rtl8139.rom.
2009-04-17 12:38:44 +01:00
Michael Brown 7741546a40 [build] Pad .rom, .dsk, and .hd images to 512-byte boundaries
QEMU will silently round down a disk or ROM image file to the nearest
512 bytes.  Fix by always padding .rom, .dsk and .hd images to the
nearest 512-byte boundary.

Originally-fixed-by: Stefan Hajnoczi <stefanha@gmail.com>
2009-04-16 03:15:08 +01:00
Michael Brown dc387547a3 [build] Don't assume the existence of "seq"
The "seq" command is GNU-specific; a BSD userland will not have it.
Use POSIX-conforming "awk" instead.

Reported-by: Joshua Oreman <oremanj@rwcr.net>
Suggested-by: Stefan Hajnoczi <stefanha@gmail.com>
2009-03-31 11:06:35 +01:00
Michael Brown 3dd7ce1c26 [efi] Allow building with non-system libbfd
On Mac OS X, it is necessary to build binutils manually; the system
does not provide bfd.h or the libbfd or libiberty libraries.

Originally-fixed-by: Joshua Oreman <oremanj@rwcr.net>
2009-03-31 09:36:08 +01:00
Michael Brown e3b9e3d04b [build] Add --divide to ASFLAGS if supported by the assembler
Some builds of the GNU assembler will treat a '/' character as a
comment delimiter.  Adding "--divide" will cause it to be treated as a
division operator, as we expect.  The "--divide" option is not
available in all gas versions, so apply it only conditionally.

Suggested-by: Joshua Oreman <oremanj@rwcr.net>
2009-03-31 07:02:17 +01:00
Michael Brown a436dc4014 [build] Avoid always rebuilding bin/embedded.o
bin/embedded.o has a build dependency on bin/.embedded.list, which
gets generated automatically by the Makefile.  However, if the
EMBEDDED_IMAGE list is empty, bin/.embedded.list will never be
created, and so bin/embedded.o will be rebuilt every time due to a
missing dependency.

Fix by forcing bin/.embedded.list to be created even if the list is
empty.
2009-03-27 04:47:20 +00:00
Michael Brown 1c67623e37 [build] Enable building with the Intel C compiler (icc) 2009-03-26 07:27:19 +00:00
Michael Brown 4f3bab1a55 [image] Allow for zero embedded images
Having a default script containing

  #!gpxe
  autoboot

can cause problems when entering commands to load and start a kernel
manually; the default script image will still be present when the
kernel is started and so will be treated as an initrd.  It is possible
to work around this by typing "imgfree" before any other commands, but
this is counter-intuitive.

Fix by allowing the embedded image list to be empty (in which case we
just call autoboot()), and making this the default.

Reported by alkisg@gmail.com.
2009-02-24 05:57:56 +00:00
Michael Brown 78a57a6f76 [build] Allow NO_WERROR=1 to inhibit --fatal-warnings as well as -Werror 2009-02-16 01:06:40 +00:00
Michael Brown 076154a1c6 [image] Allow multiple embedded images
This patch extends the embedded image feature to allow multiple
embedded images instead of just one.

gPXE now always boots the first embedded image on startup instead of
doing the hardcoded DHCP boot (aka autoboot).

Based heavily upon a patch by Stefan Hajnoczi <stefanha@gmail.com>.
2009-02-16 00:30:36 +00:00
Michael Brown 79867d34ee [build] Treat warnings as errors in assembly files
Add --fatal-warnings to ASFLAGS; this is the equivalent of -Werror in
CFLAGS (which we have used since July 2007).
2009-02-15 11:05:00 +00:00
Michael Brown fb72336fe6 [efi] Add efirom utility and .efirom image format 2009-01-08 02:19:18 +00:00
Michael Brown 314779eb36 [efi] Use elf2efi utility in place of efilink
elf2efi converts a suitable ELF executable (containing relocation
information, and with appropriate virtual addresses) into an EFI
executable.  It is less tightly coupled with the gPXE build process
and, in particular, does not require the use of a hand-crafted PE
image header in efiprefix.S.

elf2efi correctly handles .bss sections, which significantly reduces
the size of the gPXE EFI executable.
2009-01-07 22:59:05 +00:00
Michael Brown 7d36a1b7b0 [build] Explicitly link efilink against -liberty
On some systems, libbfd is supplied only as a static library; linking
will fail unless -liberty is also specified.
2008-11-19 19:24:48 +00:00
Michael Brown d9c38d14d6 [build] Fix building on FreeBSD
FreeBSD requires the object format to be specified as elf_i386_fbsd,
rather than elf_i386.

Based on a patch from Eygene Ryabinkin <rea-fbsd@codelabs.ru>
2008-10-17 18:24:04 +01:00
Michael Brown 81d92c6d34 [efi] Add EFI image format and basic runtime environment
We have EFI APIs for CPU I/O, PCI I/O, timers, console I/O, user
access and user memory allocation.

EFI executables are created using the vanilla GNU toolchain, with the
EXE header handcrafted in assembly and relocations generated by a
custom efilink utility.
2008-10-13 10:24:14 +01:00
Michael Brown 2e812235f4 [makefile] Add -Wformat-nonliteral as an extra warning category
-Wformat-nonliteral is not enabled by -Wall and needs to be explicitly
 specified.

Modified the few files that use nonliteral format strings to work with
this new setting in place.

Inspired by a patch from Carl Karsten <carl@personnelware.com> and an
identical patch from Rorschach <r0rschach@lavabit.com>.
2008-10-10 18:41:24 +01:00
Michael Brown 98abd48a26 [makefile] Inhibit warnings if AUTO_DEPS or MEDIA_DEPS are empty lists 2008-10-10 03:42:56 +01:00
Michael Brown 3f80f9e1a6 [makefile] Add missing dependency on arch/$(ARCH)/Makefile to MAKEDEPS 2008-10-10 03:42:37 +01:00
Michael Brown e817a347fb [makefile] Split config.h out into config/*.h and kill off mkconfig.pl 2008-10-08 02:17:32 +01:00
Michael Brown a2588547f9 [makefile] Add support for multiple build platforms
Allow for the build CPU architecture and platform to be specified as part
of the make command goals.  For example:

  make bin/rtl8139.rom      # Standard i386 PC-BIOS build

  make bin-efi/rtl8139.efi  # i386 EFI build

The generic syntax is "bin[-[arch-]platform]", with the default
architecture being "i386" (regardless of the host architecture) and the
default platform being "pcbios".

Non-path targets such as "srcs" can be specified using e.g.

  make bin-efi srcs

Note that this changeset is merely Makefile restructuring to allow the
build architecture and platform to be determined by the make command
goals, and to export these to compiled code via the ARCH and PLATFORM
defines.  It doesn't actually introduce any new build platforms.
2008-10-08 02:17:25 +01:00
Michael Brown 91802c6e85 [makefile] Fix -fno-stack-protector test on older versions of gcc
Some older versions of gcc don't complain about unknown compiler flags
unless you ask them to actually compile; asking them to merely
preprocess won't trigger the error.

Fix the -fno-stack-protector test by making it attempt to compile an
empty file, rather than preprocess an empty file.
2008-10-01 19:24:56 +01:00
Marty Connor 60c3b69c31 [release] Update version to 0.9.5+ post release 2008-10-01 13:46:16 -04:00
Marty Connor 8c3e95ce42 [release] Update version to 0.9.5 for release 2008-10-01 13:38:45 -04:00
H. Peter Anvin e8b6077566 [makefile] Avoid using ?=
?= in a Makefile means that that variable can be overridden by the
environment.  This is confusing to users, especially with a generic
name like "ARCH".

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-09-30 21:53:34 +01:00
Marty Connor 6eaefa16a8 [release] Update version post release to 0.9.4+ 2008-09-26 16:05:55 -04:00
Marty Connor 601d244a8e [release] Update version information for 0.9.4 release 2008-09-26 15:14:34 -04:00
Michael Brown c302eeda5a [makefile] Suppress "No such file or directory" warnings at start of build
Use "-include" rather than "include" for the generated Makefile
fragments, in order to suppress the long list of warnings that
otherwise appears at the start of a clean build.

Contributed by Edward Waugh <ewaugh@netxen.com>
2008-07-24 19:45:35 +01:00
H. Peter Anvin 25450dc59c [Config] remove src/Config
Remove src/Config as it has no more users, and conflicts with
src/config on case-deficient filesystems.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-06-30 12:26:13 -07:00
Marty Connor db5f64ecdc [Makefile] Add "+" to end of version string for git-generated images
This "+" should be removed when a tarball release is done.
2008-06-06 16:40:16 -04:00
Michael Brown b5215803f0 [Makefile] Use .PRECIOUS instead of .SECONDARY for bin/%.tmp targets
Revert "Use .SECONDARY instead of .PRECIOUS for bin/%.tmp targets."

This reverts commit de29e5a39c.

.SECONDARY doesn't seem to work properly with the target patterns of
implicit rules.  In particular, a "make clean ; make bin/rtl8139.dsk"
will correctly leave the bin/rtl8139.dsk.tmp file present when .PRECIOUS
is used, but not when .SECONDARY is used.

This is slightly irritating since we don't want the
"do-not-delete-if-interrupted" semantics of .PRECIOUS, but it seems to be
the best compromise.
2008-06-06 14:25:25 +01:00
Stefan Hajnoczi f866b17998 [util] config-local.h to avoid accidental commits
During development it is often handy to change the config.h options from
their defaults, for example to enable debugging features.

To prevent accidental commits of debugging config.h changes, mdc
suggested having a config-local.h that is excluded from source control.
This file acts as a temporary config.h and can override any of the
defaults.

This commit is an attempt to implement the config-local.h feature.

The config.h file now has the following as its last line:
/* @TRYSOURCE config-local.h */

The @TRYSOURCE directive causes config-local.h to be included at that
point in the file.  If config-local.h does not exist, no error will be
printed and parsing will continue as normal.  Therefore, mkconfig.pl is
"trying" to "source" config-local.h.
2008-06-05 00:45:33 +01:00
Michael Brown eec9814a0e [Makefile] Quick hack: always define pci_{vendor,device}_id
ROMs will refuse to build unless pci_vendor_id and pci_device_id are
defined.  We probably ought to fix up the Makefile (and the ROM prefix) so
that they're required only for PCI ROMs, but this will do for now.
2008-04-23 16:24:00 +01:00
Michael Brown c06e6d0635 [Makefile] Use -MM instead of -M in dependency generation
Using -MM strips out any system header files from the dependency list,
which means that we could safely use an external stdarg.h if we wanted
to.
2008-03-24 00:28:55 +00:00
Marty Connor e6ff84b2d1 Make tarball generation quieter
Deleting bin/deps after "make veryclean" keeps deps from being
regenerated in the tarball.
2008-02-14 17:40:45 -05:00
Marty Connor c9593cd35b Updated $(VERSION) for release. Change tarball generation.
Added 'install' and 'configure' targets for those who are used
to other build setups.
2008-02-14 17:26:47 -05:00
Michael Brown 74fd544101 Added the embedded pxelinux payload patch from hpa. 2008-01-08 15:51:36 +00:00
Michael Brown de29e5a39c Use .SECONDARY instead of .PRECIOUS for bin/%.tmp targets. 2008-01-07 13:15:12 +00:00
Marty Connor af56768e98 Retain some intermediate object files, suggested by Geert Stappers and Alexey Zaytsev.
src/bin/%.tmp files can be useful for debugging, so let's keep them.
2007-12-28 14:33:11 -05:00
Michael Brown 5172d7b266 Autodetect whether or not we need to be using -fno-stack-protector. 2007-12-15 19:37:21 +00:00
Michael Brown 3ab571006e Yet another attempt to autodetect an appropriate "echo -e". 2007-12-07 14:25:02 -06:00
Michael Brown a8bddfe153 Another (hopefully more robust) attempt to find a usable substitute
for "echo -e" on the host system.
2007-12-08 00:50:57 +00:00
Michael Brown 3b58fc0baf Try to fix echo-detection to work on all systems that provide any
suitable "echo -e" substitute.
2007-12-07 03:35:32 +00:00
Michael Brown 98de16befd Merge branch 'master' of rom.etherboot.org:/pub/scm/gpxe 2007-09-09 13:31:38 +01:00
Michael Brown 6f799db5bd Use "/bin/echo -e" instead of shell builtin echo; some shells don't
implement the -e option.

(Thanks to Jim McQuillan for this suggestion.)
2007-09-08 23:38:17 +01:00
Michael Brown 66207bb912 Add the possibility to create .o files from arbitrary binary blobs. 2007-09-06 15:11:09 +01:00
Marty Connor 63f0e4e796 allpxes allroms alldsks fixes from Vampyre 2007-08-30 13:08:46 -04:00