11 years ago[802.11] The 802.11 MAC layer, second big commit
Joshua Oreman [Sun, 7 Jun 2009 04:47:29 +0000 (21:47 -0700)]
[802.11] The 802.11 MAC layer, second big commit

With this commit the MAC layer is almost "barebones feature-complete";
the only things I still need to implement before I can test is the
network probe functionality. Various changes include:

- net80211_device.channels is now a statically declared array, to
  avoid constantly reallocating it.
- net80211_device.assoc has been replaced by "state", containing a
  set of flags (authenticated, associated, etc) related to the
  association process as well as the most recent IEEE status code from
  said process.
- Signal strength info has been moved from a per-device to a per-frame
  basis, since its only real use (choosing between different APs on
  the same network while scanning) requires that.
    -> The code for this would be made much cleaner if there were
       space for a couple bytes of private data in io_buffer.
- The net80211_wlan structure has been amended to include a copy of
  the beacon from this access point and an authentication-method state
  variable for the association task. Association now can be handled
  just by passing one structure around.
- Added net80211_prepare_default(), to create a default list of
  channels to listen on during network scanning.
- Implemented the association API described on my notes page.
- Added settings for SSID and hidden-network-ness.
- Added a function to send an arbitrary management frame.
- Added processing for received beacons.
- Implemented most of the association process.

11 years ago[802.11] The 802.11 MAC layer, first big commit
Joshua Oreman [Fri, 5 Jun 2009 04:06:16 +0000 (21:06 -0700)]
[802.11] The 802.11 MAC layer, first big commit

Implemented much of the basic functionality required of the 802.11 MAC
layer. gPXE with rtl8180 compiled in will now link, but should not be
tested yet because the rather fundamental "associate with a network"
function is one of the ones still stubbed.

11 years ago[drivers rtl8180] Make a #define clearer
Joshua Oreman [Fri, 5 Jun 2009 04:05:34 +0000 (21:05 -0700)]
[drivers rtl8180] Make a #define clearer

11 years ago[netdevice] Add netdev argument to ll_protocol::push, pull
Joshua Oreman [Fri, 5 Jun 2009 04:02:02 +0000 (21:02 -0700)]
[netdevice] Add netdev argument to ll_protocol::push, pull

In order to construct outgoing link-layer frames or parse incoming
ones properly, some protocols (such as 802.11) need more state than
is available in the existing variables passed to the ll_protocol
handlers. To remedy this, add struct net_device *netdev as the first
argument to each of these functions, so that more information can
be fetched from the link layer-private part of the netdev.

Updated all 3 call sites (netdevice.c, efi_snp.c, pxe_undi.c) and
2 implementations (ethernet.c, ipoib.c) of ll_protocol to use the
new argument.

11 years ago[drivers rtl8180] Fix rtl8225 rf idnumber - was 10, should be 9
Joshua Oreman [Tue, 2 Jun 2009 04:04:54 +0000 (21:04 -0700)]
[drivers rtl8180] Fix rtl8225 rf idnumber - was 10, should be 9

11 years ago[drivers rtl8180] Fix the main rtl8180 driver filename
Joshua Oreman [Tue, 2 Jun 2009 03:49:34 +0000 (20:49 -0700)]
[drivers rtl8180] Fix the main rtl8180 driver filename

The Linux driver named the main file rtl8180_dev.c, which does not fit existing
gPXE conventions. Rename deferred to a separate commit so as not to mess up the

11 years ago[drivers rtl8180] First shot at an rtl8180/8185 driver
Joshua Oreman [Tue, 2 Jun 2009 03:48:50 +0000 (20:48 -0700)]
[drivers rtl8180] First shot at an rtl8180/8185 driver

I trimmed and ported the Linux rtl8180 driver, supporting the 8180
and 8185 chipsets, to gPXE's fledgling 802.11 layer. The result
compiles but does not yet link because none of the generic 802.11
functions have been written yet. Code size is 3k for the card and
up to 8k for the RF initialization (lots of constants).

This chipset is often bundled with different RF modules; I've
included support for the four supported by the Linux driver using
gPXE's linker tables. The rtl8225 chip supports 802.11g on 8185
cards; the other three are similar and support 802.11b on 8180

# Please enter the commit message for your changes.
# (Comment lines starting with '#' will not be included)
# On branch wireless
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
# modified:   Makefile
# new file:   drivers/net/rtl818x/rtl8180.c
# modified:   drivers/net/rtl818x/rtl8180.h
# deleted:    drivers/net/rtl818x/rtl8180_dev.c
# modified:   drivers/net/rtl818x/rtl8180_grf5101.c
# deleted:    drivers/net/rtl818x/rtl8180_grf5101.h
# modified:   drivers/net/rtl818x/rtl8180_max2820.c
# deleted:    drivers/net/rtl818x/rtl8180_max2820.h
# modified:   drivers/net/rtl818x/rtl8180_rtl8225.c
# deleted:    drivers/net/rtl818x/rtl8180_rtl8225.h
# modified:   drivers/net/rtl818x/rtl8180_sa2400.c
# deleted:    drivers/net/rtl818x/rtl8180_sa2400.h
# modified:   drivers/net/rtl818x/rtl818x.h
# modified:   include/gpxe/errfile.h
# modified:   include/gpxe/ieee80211.h
# modified:   include/gpxe/net80211.h
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
# ../#foo#
# ../._linux-2.6.29
# ../80211-notes.txt
# ../atheros/
# ../b43-tools/
# ../core
# ../dhcp-capture.pcap
# ../fireproxy-0.34.tar.gz
# ../fireproxy-0.34/
# ../firewire-chainload.patch
# ../flashrom/
# ../gdb-firewire-v2-v3-incr.patch
# ../gdb-firewire-v2.patch
# ../gdb-firewire-v3-v4-incr.patch
# ../gdb-firewire-v3.patch
# ../gdb-firewire-v4.patch
# ../gdb-firewire.patch
# ../gpxe.lkrn
# ../ieee1394_types.h
# ../lin-ohci1394.c
# ../lin-skge.c
# ../lin-skge.h
# ../lin-sky2.c
# ../lin-sky2.h
# ../linux-2.6.29/
# ../ohci1394.h
# ../ohci1394_dma_early-v3.diff
# ../pxe-ohci1394.c
# ../pxe-ohci1394.h
# ../pxe-skge.c
# ../pxe-skge.h
# ../pxe-sky2.c
# ../pxe-sky2.h
# ../sky2-incr-v1-v2.patch
# ../sky2-v2.patch
# ../sky2.patch
# drivers/net/rtl818x/#rtl8180_max2820.c#
# drivers/net/rtl818x/.#rtl8180_max2820.c
# ../wpa_supplicant-0.6.9.tar.gz
# ../wpa_supplicant-0.6.9/

11 years ago[802.11] Tweaks to API for clarity and practicality
Joshua Oreman [Tue, 2 Jun 2009 03:45:34 +0000 (20:45 -0700)]
[802.11] Tweaks to API for clarity and practicality

In working on the rtl8185 driver, I found some issues with the
generic 802.11 API as I had originally designed it, and modified
the API headers slightly to ameliorate or clarify.

11 years ago[nvs] Add init function for Atmel 93C66 EEPROM
Joshua Oreman [Tue, 2 Jun 2009 01:36:25 +0000 (18:36 -0700)]
[nvs] Add init function for Atmel 93C66 EEPROM

The 93C66 is identical to the 93C56 in programming interface and
addressing, but twice as large in data storage (4096 bits). It's
used in some RTL8185 wireless cards.

11 years ago[drivers 802.11] Initial import Realtek 8180/8185 driver from Linux
Joshua Oreman [Mon, 1 Jun 2009 18:57:03 +0000 (11:57 -0700)]
[drivers 802.11] Initial import Realtek 8180/8185 driver from Linux

This is the code of Linux kernel rtl8180 module, as of kernel 2.6.29,
as yet unmodified for gPXE. I'm importing it now so as to have a clear
record of the things I change.

Most of the code is quite simple, like with most Realtek drivers, but
things are complicated slightly by the presence of at least four
different RF modules that can be packaged with the rtl8180 chip.

11 years ago[802.11] Add net80211.h with preliminary declarations for gPXE's 802.11 layer
Joshua Oreman [Fri, 29 May 2009 23:59:02 +0000 (16:59 -0700)]
[802.11] Add net80211.h with preliminary declarations for gPXE's 802.11 layer

11 years ago[802.11] Add ieee80211.h defining standard constants and frame formats
Joshua Oreman [Fri, 29 May 2009 23:58:19 +0000 (16:58 -0700)]
[802.11] Add ieee80211.h defining standard constants and frame formats

11 years agoMerge branch 'master' of git://
Joshua Oreman [Thu, 28 May 2009 18:50:10 +0000 (11:50 -0700)]
Merge branch 'master' of git://

11 years ago[spi] Add address-length autodetection to the SPI bit-bashing code
Michael Brown [Thu, 28 May 2009 13:45:32 +0000 (14:45 +0100)]
[spi] Add address-length autodetection to the SPI bit-bashing code

Several SPI chips will respond to an SPI read command with a dummy
zero bit immediately prior to the first real data bit.  This can be
used to autodetect the address length, provided that the command
length and data length are already known, and that the MISO data line
is tied high.

Tested-by: Thomas Miletich <>
Debugged-by: Thomas Miletich <>
11 years ago[build] Add -fno-dwarf2-cfi-asm to CFLAGS if supported by the gcc in use
Michael Brown [Wed, 27 May 2009 01:21:45 +0000 (02:21 +0100)]
[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 <>
11 years ago[comboot] Implement stub calls for auxiliary data vector handling
Daniel Verkamp [Mon, 25 May 2009 20:32:48 +0000 (16:32 -0400)]
[comboot] Implement stub calls for auxiliary data vector handling

Signed-off-by: Michael Brown <>
11 years ago[ethernet] Add MII link status functions from Linux
Daniel Verkamp [Wed, 10 Dec 2008 08:35:02 +0000 (02:35 -0600)]
[ethernet] Add MII link status functions from Linux

Signed-off-by: Michael Brown <>
11 years ago[ethernet] Update mii.h and use it in drivers that had a private copy
Daniel Verkamp [Wed, 10 Dec 2008 08:30:54 +0000 (02:30 -0600)]
[ethernet] Update mii.h and use it in drivers that had a private copy

Signed-off-by: Michael Brown <>
11 years ago[ethernet] Move struct mii_if_info to mii.h
Daniel Verkamp [Wed, 10 Dec 2008 07:11:50 +0000 (01:11 -0600)]
[ethernet] Move struct mii_if_info to mii.h

Signed-off-by: Michael Brown <>
11 years ago[settings] Allow for arbitrarily-named settings
Michael Brown [Tue, 26 May 2009 10:05:58 +0000 (11:05 +0100)]
[settings] Allow for arbitrarily-named settings

This provides a mechanism for using arbitrarily-named variables within
gPXE, using the existing syntax for settings.

11 years ago[multiboot] Include argv[0] as part of "command line"
Michael Brown [Tue, 26 May 2009 05:58:53 +0000 (06:58 +0100)]
[multiboot] Include argv[0] as part of "command line"

Grub will include the module name as part of the command line, and
some multiboot kernels expect this to be done.

11 years ago[dhcp] Choose ProxyDHCP port based on presence of PXE options
Michael Brown [Thu, 21 May 2009 09:22:42 +0000 (10:22 +0100)]
[dhcp] Choose ProxyDHCP port based on presence of PXE options

If the ProxyDHCPOFFER already includes PXE options (i.e. option 60 is
set to "PXEClient" and option 43 is present) then assume that the
ProxyDHCPREQUEST can be sent to port 67, rather than port 4011.  This
is a reasonable assumption, since in that case the ProxyDHCP server
has already demonstrated by responding to the DHCPDISCOVER that it is
listening on port 67.  (If the ProxyDHCP server were not listening on
port 67, then the standard DHCP server would have been configured to
respond with option 60 set to "PXEClient" but no option 43 present.)

The PXE specification is ambiguous on this point; the specified
behaviour covers only the cases in which option 43 is *not* present in
the ProxyDHCPOFFER.  In these cases, we will continue to send the
ProxyDHCPREQUEST to port 4011.

This change is required in order to allow us to interoperate with
dnsmasq, which listens only on port 67.  (dnsmasq relies on
unspecified behaviour of the Intel PXE stack, which it seems will
retain the ProxyDHCPOFFER as an options source and never issue a
ProxyDHCPREQUEST, thereby enabling dnsmasq to omit listening on port

11 years ago[serial] Define constants for serial port I/O addresses
Thomas Miletich [Thu, 21 May 2009 08:50:48 +0000 (10:50 +0200)]
[serial] Define constants for serial port I/O addresses

Tested with COM1 and COM2.

Signed-off-by: Michael Brown <>
11 years ago[tftp] Process OACKs even if malformed
Michael Brown [Wed, 20 May 2009 09:03:13 +0000 (10:03 +0100)]
[tftp] Process OACKs even if malformed

IBM Tivoli PXE Server is reported to send trailing garbage
bytes at the end of the OACK packet, which causes gPXE to reject the
packet and abort the TFTP transfer.

Work around the problem by processing as much as possible of the OACK,
and treating name/value parsing errors as non-fatal.

Reported-by: Shao Miller <>
11 years ago[settings] Fix erroneous bit-masking in fetch_uintz_setting()
Michael Brown [Wed, 20 May 2009 07:54:41 +0000 (08:54 +0100)]
[settings] Fix erroneous bit-masking in fetch_uintz_setting()

11 years ago[dhcp] Send broadcast PXE boot server discovery requests to port 67
Michael Brown [Wed, 20 May 2009 07:16:51 +0000 (08:16 +0100)]
[dhcp] Send broadcast PXE boot server discovery requests to port 67

We currently send all boot server discovery requests to port 4011.
Section 2.2.1 of the PXE spec states that boot server discovery
packets should be "sent broadcast (port 67), multicast (port 4011), or
unicast (port 4011)".  Adjust our behaviour so that any boot server
discovery packets that are sent to the broadcast address are directed
to port 67 rather than port 4011.

This is required for operation with dnsmasq as a PXE server, since
dnsmasq listens only on port 67, and relies upon this (specified)

This change may break some setups using the (itself very broken) Linux
PXE server from  This server will, in its default
configuration, listen only on port 4011.  It never constructs a boot
server list (PXE_BOOT_SERVERS, option 43.8), and uses the wrong
definitions for the discovery control bits (PXE_DISCOVERY_CONTROL,
option 43.6).  The upshot is that it will always instruct the client
to perform multicast and broadcast discovery only.  In setups lacking
a valid multicast route on the server side, this used to work because
gPXE would eventually give up on the (non-responsive) multicast
address and send a broadcast request to port 4011, which the Linux PXE
server would respond to.  Now that gPXE correctly sends this broadcast
request to port 67 instead, it is never seen by the Linux PXE server,
and the boot fails.  The fix is to either (a) set up a multicast route
correctly on the server side before starting the PXE server, or (b)
edit /etc/pxe.conf to contain the server's unicast address in the
"multicast_address" field (a hack that happens to work).

Suggested-by: Simon Kelley <>
11 years ago[dhcp] Perform ProxyDHCP only if we do not already have PXE options
Michael Brown [Tue, 19 May 2009 14:54:35 +0000 (15:54 +0100)]
[dhcp] Perform ProxyDHCP only if we do not already have PXE options

This prevents gPXE from wasting time attempting to contact a ProxyDHCP
server on port 4011 if the DHCP response already contains the relevant
PXE options.  This behaviour is hinted at (though not explicitly
specified) in the PXE spec, and seems to match what the Intel client

Suggested-by: Simon Kelley <>
11 years ago[legal] Add FILE_LICENCE declaration to romprefix.S
Michael Brown [Mon, 18 May 2009 08:33:36 +0000 (09:33 +0100)]
[legal] Add FILE_LICENCE declaration to romprefix.S

11 years ago[legal] Add a selection of FILE_LICENCE declarations
Michael Brown [Fri, 1 May 2009 14:41:06 +0000 (15:41 +0100)]
[legal] Add a selection of FILE_LICENCE declarations

Add FILE_LICENCE declarations to almost all files that make up the
various standard builds of gPXE.

11 years ago[legal] Add and %.licence make target
Michael Brown [Wed, 29 Apr 2009 07:51:27 +0000 (08:51 +0100)]
[legal] Add 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).

11 years ago[legal] Add mechanism for explicit per-file licence declarations
Michael Brown [Mon, 27 Apr 2009 13:11:59 +0000 (14:11 +0100)]
[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.

11 years ago[legacy] Remove long-obsolete old dhcp.h file
Michael Brown [Fri, 1 May 2009 14:58:20 +0000 (15:58 +0100)]
[legacy] Remove long-obsolete old dhcp.h file

11 years agoMerge branch 'master' into official
Joshua Oreman [Sun, 3 May 2009 20:21:04 +0000 (13:21 -0700)]
Merge branch 'master' into official

11 years ago[fireserve] play nicer with reboots
Joshua Oreman [Sun, 3 May 2009 00:41:28 +0000 (17:41 -0700)]
[fireserve] play nicer with reboots

11 years agosky2: fix bugs - ring size too small, improper iob freeing
Joshua Oreman [Sun, 3 May 2009 00:41:06 +0000 (17:41 -0700)]
sky2: fix bugs - ring size too small, improper iob freeing

11 years agodon't dup fireserve line
Joshua Oreman [Sat, 2 May 2009 20:11:26 +0000 (13:11 -0700)]
don't dup fireserve line

11 years agono memdebug
Joshua Oreman [Sat, 2 May 2009 20:09:04 +0000 (13:09 -0700)]
no memdebug

11 years agomanual merge
Joshua Oreman [Sat, 2 May 2009 20:07:40 +0000 (13:07 -0700)]
manual merge

11 years agoMerge branch 'master' of git://
Joshua Oreman [Sat, 2 May 2009 19:56:00 +0000 (12:56 -0700)]
Merge branch 'master' of git://

11 years ago[pxeprefix] Work around bug in Etherboot 5.4 when loading undionly.kpxe
Michael Brown [Thu, 30 Apr 2009 03:42:21 +0000 (04:42 +0100)]
[pxeprefix] Work around bug in Etherboot 5.4 when loading undionly.kpxe

Etherboot 5.4 erroneously treats PXENV_UNLOAD_STACK as the "final
shutdown" call, and unhooks INT15.  When using gPXE's undionly.kpxe,
this results in gPXE overwriting the portion of Etherboot located in
high memory, because it is no longer hidden from the system memory map
at the time that gPXE loads.

Work around this by explicitly testing for Etherboot as the underlying
PXE stack (as is already done in undinet.c) and skipping the call to
PXENV_UNLOAD_STACK if necessary.

11 years ago[build] Add {PROVIDE,REQUIRE}_SYMBOL macros and tidy up compiler.h
Michael Brown [Mon, 27 Apr 2009 13:04:35 +0000 (14:04 +0100)]
[build] Add {PROVIDE,REQUIRE}_SYMBOL macros and tidy up compiler.h

11 years ago[i386] Remove long-obsolete realmode.c file
Michael Brown [Sun, 26 Apr 2009 05:41:41 +0000 (06:41 +0100)]
[i386] Remove long-obsolete realmode.c file

11 years ago[i386] Remove long-obsolete callbacks_arch.h file
Michael Brown [Sun, 26 Apr 2009 05:38:36 +0000 (06:38 +0100)]
[i386] Remove long-obsolete callbacks_arch.h file

11 years ago[build] Fix signed/unsigned division in util/zbin.c
Stefan Hajnoczi [Fri, 24 Apr 2009 09:21:07 +0000 (10:21 +0100)]
[build] Fix signed/unsigned division in util/zbin.c

Commit b149a99 ([build] Round up SUBx deltas) introduced a
signed/unsigned issue that affects gPXE images built on 32-bit hosts.
The zbin fixup utility performed an unsigned division, which led to
.usb images with an incorrect number of sectors to load.

The issue snuck by on 64-bit hosts since uint32_t is promoted to long.
On 32-bit hosts it is promoted to unsigned long.

Modified-by: Michael Brown <>
Signed-off-by: Michael Brown <>
11 years ago[elf] Work around entry point bug in NetBSD kernels
Michael Brown [Fri, 24 Apr 2009 02:42:34 +0000 (03:42 +0100)]
[elf] Work around entry point bug in NetBSD kernels

NetBSD kernels are multiboot ELF kernels with an entry point
incorrectly specified as a virtual address rather than a physical

Work around this by looking for the segment that could plausibly
contain the entry point address (interpreted as either a physical or
virtual address), and using that to determine the eventual physical
entry point.

In the event of any ambiguity, precedence is given to interpretation
of the entry point as a physical address.

11 years ago[multiboot] Work around raw-flag bug in Solaris kernels
Michael Brown [Fri, 24 Apr 2009 02:16:18 +0000 (03:16 +0100)]
[multiboot] Work around raw-flag bug in Solaris kernels

Solaris kernels are multiboot images with the "raw" flag set,
indicating that the loader should use the raw address fields within
the multiboot header rather than looking for an ELF header.  However,
the Solaris kernel contains garbage data in the raw address fields,
and requires us to use the ELF header instead.

Work around this by always using the ELF header if present.  This
renders the "raw" flag somewhat redundant.

11 years ago[doc] Remove obsolete README.pixify
Michael Brown [Sat, 18 Apr 2009 16:10:00 +0000 (17:10 +0100)]
[doc] Remove obsolete README.pixify

11 years ago[build] Automatically sort the list of constituent object sizes
Michael Brown [Sat, 18 Apr 2009 15:19:29 +0000 (16:19 +0100)]
[build] Automatically sort the list of constituent object sizes

11 years ago[build] Provide mechanism for listing constituent object sizes
Michael Brown [Sat, 18 Apr 2009 14:55:01 +0000 (15:55 +0100)]
[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.

11 years ago[build] Remove obsolete linker script files
Michael Brown [Fri, 17 Apr 2009 13:08:47 +0000 (14:08 +0100)]
[build] Remove obsolete linker script files

11 years ago[build] Kill off the multiple-object-per-source-file mechanism
Michael Brown [Fri, 17 Apr 2009 12:43:35 +0000 (13:43 +0100)]
[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.

11 years ago[build] Kill off the last multiple-object source file
Michael Brown [Fri, 17 Apr 2009 12:38:18 +0000 (13:38 +0100)]
[build] Kill off the last multiple-object source file

The build mechanism currently allows for multiple objects per source
file.  The only remaining user of this is unnrv2b.S.  Replace this
usage with a separate unnrv2b16.S wrapper file, as is currently used
for e.g. pxeprefix.S and kpxeprefix.S.

11 years ago[build] Provide mechanism for listing per-target source files
Michael Brown [Fri, 17 Apr 2009 11:38:44 +0000 (12:38 +0100)]
[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.

11 years ago[build] Simplify use of Getopt::Long in
Michael Brown [Thu, 16 Apr 2009 05:13:09 +0000 (06:13 +0100)]
[build] Simplify use of Getopt::Long in

Sometimes it's just so much fun doing things the complicated way that
you forget to check the man page for the existence of a simpler

11 years ago[build] Reinstate the .pdsk padded-floppy image format
Michael Brown [Thu, 16 Apr 2009 04:59:44 +0000 (05:59 +0100)]
[build] Reinstate the .pdsk padded-floppy image format

Some utilities that expect a floppy disk image (e.g. iLO?) may test
for a file of the correct size.  Reinstate the .pdsk image format in
order to provide this if needed.

11 years ago[build] Pad .rom, .dsk, and .hd images to 512-byte boundaries
Michael Brown [Thu, 16 Apr 2009 02:15:08 +0000 (03:15 +0100)]
[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 <>
11 years agoMerge branch 'master' of git://
Joshua Oreman [Wed, 15 Apr 2009 23:20:49 +0000 (16:20 -0700)]
Merge branch 'master' of git://

11 years ago[dhcp] Accept filename via DHCP option 67 as well as BOOTP filename field
Michael Brown [Wed, 15 Apr 2009 20:08:02 +0000 (21:08 +0100)]
[dhcp] Accept filename via DHCP option 67 as well as BOOTP filename field

Allow options with dedicated BOOTP fields to fall back to using the
equivalent DHCP option if the relevant field is empty.

11 years ago[smbios] Add asset tag setting
Timothy Stack [Tue, 31 Mar 2009 22:20:07 +0000 (15:20 -0700)]
[smbios] Add asset tag setting

Add SMBIOS asset tag as a named setting.

Signed-off-by: Michael Brown <>
11 years ago[gdb] Allow resynchronisation with gdb
Stefan Hajnoczi [Wed, 15 Apr 2009 16:16:31 +0000 (17:16 +0100)]
[gdb] Allow resynchronisation with gdb

This replaces the gdbstub's polite NAK behavior with retransmission of
the current outstanding reply packet.  It solves situations where gdb
and gPXE's gdbstub get out of sync due to the lack of flow control in
the gdb protocol spec.

Signed-off-by: Michael Brown <>
11 years ago[build] Round up SUBx deltas
Stefan Hajnoczi [Sat, 11 Apr 2009 10:13:09 +0000 (11:13 +0100)]
[build] Round up SUBx deltas

The zbin compressor fixup utility rounds down file sizes before
calculating their difference.  This produces incorrect values and may
cause truncated gPXE images to be loaded at boot.

The following example explains the problem:
ilen    = 48 bytes     (uncompressed input file)
olen    = 17 bytes     (compressed output file)
divisor = 16 bytes     (paragraph granularity)
fixmeup = 3 paragraphs (value to fix up)

olen / divisor - ilen / divisor
= 1 - 3
= -2 paragraphs  (old delta calculation)

( align ( olen, divisor ) - align ( ilen, divisor ) ) / divisor
= 2 - 3
= -1 paragraphs  (new delta calculation)

If we perform the SUBx operation with old delta:
fixmeup + -2 = 1 paragraph gets loaded by the prefix

With the new delta:
fixmeup + -1 = 2 paragraphs get loaded by the prefix

The old delta calculation removes the last paragraph; the prefix will
load a truncated copy of gPXE into memory.  We need to load 2
paragraphs since olen is 17 bytes.  Loading only 1 paragraph (16
bytes) would truncate the last byte.

Signed-off-by: Michael Brown <>
11 years ago[pcbios] Don't use "lret $2" to return from an interrupt
H. Peter Anvin [Sun, 12 Apr 2009 01:30:22 +0000 (18:30 -0700)]
[pcbios] Don't use "lret $2" to return from an interrupt

Using "lret $2" to return from an interrupt causes interrupts to be
disabled in the calling program, since the INT instruction will have
disabled interrupts.  Instead, patch CF on the stack and use iret to

Interestingly, the original PC BIOS had this bug in at least one

Signed-off-by: H. Peter Anvin <>
Signed-off-by: Michael Brown <>
11 years agoAdd fireserve to CLEANUP
Joshua Oreman [Mon, 13 Apr 2009 04:39:31 +0000 (21:39 -0700)]
Add fireserve to CLEANUP

11 years agoRemove ref to removed memdebug code
Joshua Oreman [Mon, 13 Apr 2009 04:37:22 +0000 (21:37 -0700)]
Remove ref to removed memdebug code

11 years agoAdd errfile decl.
Joshua Oreman [Mon, 13 Apr 2009 04:22:46 +0000 (21:22 -0700)]
Add errfile decl.

11 years agoOops, forgot another.
Joshua Oreman [Mon, 13 Apr 2009 04:20:45 +0000 (21:20 -0700)]
Oops, forgot another.

11 years agoOops, forgot a file.
Joshua Oreman [Mon, 13 Apr 2009 04:20:10 +0000 (21:20 -0700)]
Oops, forgot a file.

11 years agoAdd protocol for loading images over FireWire. Mainly for development.
Joshua Oreman [Mon, 13 Apr 2009 04:19:32 +0000 (21:19 -0700)]
Add protocol for loading images over FireWire. Mainly for development.

11 years agoAdd firebug to CLEANUP
Joshua Oreman [Mon, 13 Apr 2009 04:38:52 +0000 (21:38 -0700)]
Add firebug to CLEANUP

11 years agoTypo fix
Joshua Oreman [Mon, 13 Apr 2009 04:32:34 +0000 (21:32 -0700)]
Typo fix

11 years agoAdd errfile decl.
Joshua Oreman [Mon, 13 Apr 2009 04:22:46 +0000 (21:22 -0700)]
Add errfile decl.

11 years agoOops, forgot another.
Joshua Oreman [Mon, 13 Apr 2009 04:20:45 +0000 (21:20 -0700)]
Oops, forgot another.

11 years agoOops, forgot a file.
Joshua Oreman [Mon, 13 Apr 2009 04:20:10 +0000 (21:20 -0700)]
Oops, forgot a file.

11 years agoAdd protocol for loading images over FireWire. Mainly for development.
Joshua Oreman [Mon, 13 Apr 2009 04:19:32 +0000 (21:19 -0700)]
Add protocol for loading images over FireWire. Mainly for development.

11 years agoFireWire debugging fixes, speedups, and reorganizations.
Joshua Oreman [Mon, 13 Apr 2009 04:18:39 +0000 (21:18 -0700)]
FireWire debugging fixes, speedups, and reorganizations.

11 years agobetter bus reset code
Joshua Oreman [Fri, 10 Apr 2009 09:50:26 +0000 (02:50 -0700)]
better bus reset code

11 years agoZero last fix: no __always_inline
Joshua Oreman [Thu, 9 Apr 2009 10:10:50 +0000 (03:10 -0700)]
Zero last fix: no __always_inline

11 years agoOne last fix: no need for 'initialized' check
Joshua Oreman [Thu, 9 Apr 2009 10:08:08 +0000 (03:08 -0700)]
One last fix: no need for 'initialized' check

11 years agofixes re Stefan's code review
Joshua Oreman [Thu, 9 Apr 2009 09:51:38 +0000 (02:51 -0700)]
fixes re Stefan's code review

11 years agoremove #ifdef OHCI1394_DEBUG, no longer used
Joshua Oreman [Tue, 7 Apr 2009 05:11:29 +0000 (22:11 -0700)]
remove #ifdef OHCI1394_DEBUG, no longer used

11 years agotab fix
Joshua Oreman [Tue, 7 Apr 2009 05:07:56 +0000 (22:07 -0700)]
tab fix

11 years agoLeave GDB configuration defines properly #undef'ed
Joshua Oreman [Tue, 7 Apr 2009 05:07:11 +0000 (22:07 -0700)]
Leave GDB configuration defines properly #undef'ed

11 years agoCommenting & cleanup
Joshua Oreman [Tue, 7 Apr 2009 05:04:11 +0000 (22:04 -0700)]
Commenting & cleanup

11 years agoremove spurious debugging statements
Joshua Oreman [Tue, 7 Apr 2009 04:25:47 +0000 (21:25 -0700)]
remove spurious debugging statements

11 years agoPoll gPXE regularly for new data.
Joshua Oreman [Tue, 7 Apr 2009 03:56:26 +0000 (20:56 -0700)]
Poll gPXE regularly for new data.

11 years agomore debug whee
Joshua Oreman [Tue, 7 Apr 2009 03:43:07 +0000 (20:43 -0700)]
more debug whee

11 years agodebugging fixes
Joshua Oreman [Tue, 7 Apr 2009 03:35:55 +0000 (20:35 -0700)]
debugging fixes

11 years agodebugging fixes
Joshua Oreman [Tue, 7 Apr 2009 02:36:58 +0000 (19:36 -0700)]
debugging fixes

11 years ago[gdbstub-firewire] Add missing gpxe/nap.h include
Joshua Oreman [Tue, 7 Apr 2009 02:16:50 +0000 (19:16 -0700)]
[gdbstub-firewire] Add missing gpxe/nap.h include

11 years ago[gdbstub-firewire] Add GDB middle-end, plus small changes to the FireWire stub to...
Joshua Oreman [Tue, 7 Apr 2009 01:47:12 +0000 (18:47 -0700)]
[gdbstub-firewire] Add GDB middle-end, plus small changes to the FireWire stub to accomodate it.

11 years ago[gdbstub-firewire] Add {rx,tx}_ringaddr parameters to link structure so debugger...
Joshua Oreman [Mon, 6 Apr 2009 23:35:13 +0000 (16:35 -0700)]
[gdbstub-firewire] Add {rx,tx}_ringaddr parameters to link structure so debugger knows where to poke.

11 years ago[gdbstub-firewire] Bugfixes and integration for the firewire stub
Joshua Oreman [Mon, 6 Apr 2009 20:35:56 +0000 (13:35 -0700)]
[gdbstub-firewire] Bugfixes and integration for the firewire stub

Not much more to be said than that, really!

11 years agoGDB firewire backend.
Joshua Oreman [Mon, 6 Apr 2009 05:23:27 +0000 (22:23 -0700)]
GDB firewire backend.

11 years agoOHCI 1394 stub driver for debugging.
Joshua Oreman [Mon, 6 Apr 2009 05:15:54 +0000 (22:15 -0700)]
OHCI 1394 stub driver for debugging.

11 years agoFix mkisofs command line to work with newest versions.
Joshua Oreman [Mon, 6 Apr 2009 05:15:29 +0000 (22:15 -0700)]
Fix mkisofs command line to work with newest versions.

11 years agosky2 driver. Still buggy.
Joshua Oreman [Mon, 6 Apr 2009 05:14:20 +0000 (22:14 -0700)]
sky2 driver. Still buggy.

11 years ago[build] Don't assume the existence of "seq"
Michael Brown [Tue, 31 Mar 2009 10:06:35 +0000 (11:06 +0100)]
[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 <>
Suggested-by: Stefan Hajnoczi <>
11 years ago[efi] Allow building with non-system libbfd
Michael Brown [Tue, 31 Mar 2009 08:36:08 +0000 (09:36 +0100)]
[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 <>
11 years ago[efi] Fix compilation on Mac OS X.
Michael Brown [Tue, 31 Mar 2009 06:32:16 +0000 (07:32 +0100)]
[efi] Fix compilation on Mac OS X.

The Mac compiler treats "#pragma pack()" as gcc's "#pragma pack(pop)",
and so dies if the pragma pack stack is empty.  Adding a "#pragma
pack(1)" immediately beforehand is enough to keep the Mac compiler

The combination of "#pragma pack(1)", "#pragma pack()" won't actually
achieve anything on a Mac, but it will at least build.  (With gcc, the
"#pragma pack()" overrides any previous pragmas, so is still useful.)

Suggested-by: Joshua Oreman <>
11 years ago[build] Use __SIZE_TYPE__ macro in definition of size_t
Joshua Oreman [Tue, 31 Mar 2009 06:20:11 +0000 (07:20 +0100)]
[build] Use __SIZE_TYPE__ macro in definition of size_t

This is required in order to build on Mac OS X.

Modified-by: Michael Brown <>
Signed-off-by: Michael Brown <>