mirror of https://gitee.com/openkylin/ipxe.git
Import Upstream version 1.0.0+git-20190109.133f4c4
This commit is contained in:
commit
fc58bff077
|
@ -0,0 +1,54 @@
|
|||
dist: trusty
|
||||
|
||||
sudo: false
|
||||
|
||||
language: c
|
||||
|
||||
cache: ccache
|
||||
|
||||
compiler:
|
||||
- gcc
|
||||
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- binutils-dev
|
||||
- liblzma-dev
|
||||
- syslinux
|
||||
- genisoimage
|
||||
coverity_scan:
|
||||
project:
|
||||
name: "ipxe/ipxe"
|
||||
version: $TRAVIS_COMMIT
|
||||
build_command_prepend: "make -C src bin/deps"
|
||||
build_command: "make -C src bin/blib.a"
|
||||
branch_pattern: coverity_scan
|
||||
|
||||
env:
|
||||
global:
|
||||
- MAKEFLAGS="-j 4"
|
||||
|
||||
script:
|
||||
- make -C src bin/blib.a
|
||||
- make -C src bin/ipxe.pxe
|
||||
- make -C src bin/ipxe.usb
|
||||
- make -C src bin/ipxe.iso
|
||||
- make -C src bin/8086100e.mrom
|
||||
- make -C src bin-x86_64-pcbios/blib.a
|
||||
- make -C src bin-x86_64-pcbios/ipxe.pxe
|
||||
- make -C src bin-x86_64-pcbios/ipxe.usb
|
||||
- make -C src bin-x86_64-pcbios/ipxe.iso
|
||||
- make -C src bin-x86_64-pcbios/8086100e.mrom
|
||||
- make -C src bin-x86_64-efi/blib.a
|
||||
- make -C src bin-x86_64-efi/ipxe.efi
|
||||
- make -C src bin-x86_64-efi/intel.efidrv
|
||||
- make -C src bin-x86_64-efi/intel.efirom
|
||||
- make -C src bin-i386-efi/blib.a
|
||||
- make -C src bin-i386-efi/ipxe.efi
|
||||
- make -C src bin-i386-efi/intel.efidrv
|
||||
- make -C src bin-i386-efi/intel.efirom
|
||||
- make -C src bin-x86_64-linux/blib.a
|
||||
- make -C src bin-x86_64-linux/tap.linux
|
||||
- make -C src bin-x86_64-linux/af_packet.linux
|
||||
- make -C src bin-x86_64-linux/tests.linux
|
||||
- ./src/bin-x86_64-linux/tests.linux
|
|
@ -0,0 +1,12 @@
|
|||
In general iPXE files are licensed under the GPL. For historical
|
||||
reasons, individual files may contain their own licence declarations.
|
||||
Most builds of iPXE do not contain all iPXE code (in particular, most
|
||||
builds will include only one driver), and so the overall licence can
|
||||
vary depending on what target you are building.
|
||||
|
||||
The resultant applicable licence(s) for any particular build can be
|
||||
determined by using "make bin/xxxxxxx.yyy.licence"; for example:
|
||||
|
||||
make bin/rtl8139.rom.licence
|
||||
|
||||
to determine the resultant licence(s) for the build bin/rtl8139.rom
|
|
@ -0,0 +1,339 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
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 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
|
@ -0,0 +1,59 @@
|
|||
UNMODIFIED BINARY DISTRIBUTION LICENCE
|
||||
|
||||
|
||||
PREAMBLE
|
||||
|
||||
The GNU General Public License provides a legal guarantee that
|
||||
software covered by it remains free (in the sense of freedom, not
|
||||
price). It achieves this guarantee by imposing obligations on anyone
|
||||
who chooses to distribute the software.
|
||||
|
||||
Some of these obligations may be seen as unnecessarily burdensome. In
|
||||
particular, when the source code for the software is already publicly
|
||||
and freely available, there is minimal value in imposing upon each
|
||||
distributor the obligation to provide the complete source code (or an
|
||||
equivalent written offer to provide the complete source code).
|
||||
|
||||
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.
|
||||
|
||||
The extra permissions granted by this Licence apply only to unmodified
|
||||
binaries built from source code which has already been made available
|
||||
to the public in accordance with the terms of the GNU General Public
|
||||
Licence. Nothing in this Licence allows for the creation of
|
||||
closed-source modified versions of the Program. Any modified versions
|
||||
of the Program are subject to the usual terms and conditions of the
|
||||
GNU General Public License.
|
||||
|
||||
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
This Licence applies to any Program or other work which contains a
|
||||
notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this Unmodified Binary Distribution Licence. All
|
||||
terms used in the text of this Licence are to be interpreted as they
|
||||
are used in version 2 of the GNU General Public License as published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If you have made this Program available to the public in both source
|
||||
code and executable form in accordance with the terms of the GNU
|
||||
General Public License as published by the Free Software Foundation;
|
||||
either version 2 of the License, or (at your option) any later
|
||||
version, then you are hereby granted an additional permission to use,
|
||||
copy, and distribute the unmodified executable form of this Program
|
||||
(the "Unmodified Binary") without restriction, including the right to
|
||||
permit persons to whom the Unmodified Binary is furnished to do
|
||||
likewise, subject to the following conditions:
|
||||
|
||||
- when started running, the Program must display an announcement which
|
||||
includes the details of your existing publication of the Program
|
||||
made in accordance with the terms of the GNU General Public License.
|
||||
For example, the Program could display the URL of the publicly
|
||||
available source code from which the Unmodified Binary was built.
|
||||
|
||||
- when exercising your right to grant permissions under this Licence,
|
||||
you do not need to refer directly to the text of this Licence, but
|
||||
you may not grant permissions beyond those granted to you by this
|
||||
Licence.
|
|
@ -0,0 +1,8 @@
|
|||
iPXE README File
|
||||
|
||||
Quick start guide:
|
||||
|
||||
cd src
|
||||
make
|
||||
|
||||
For any more detailed instructions, see http://ipxe.org
|
|
@ -0,0 +1,9 @@
|
|||
Most of the content that was previously in this directory has been
|
||||
moved to a separate git repository:
|
||||
|
||||
http://git.etherboot.org/?p=contrib.git;a=summary
|
||||
|
||||
or the Etherboot Project wiki:
|
||||
|
||||
http://etherboot.org/
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* Coverity modelling file
|
||||
*
|
||||
*/
|
||||
|
||||
typedef long off_t;
|
||||
typedef void * userptr_t;
|
||||
typedef long long time_t;
|
||||
struct tm;
|
||||
|
||||
/* Inhibit use of built-in models for functions where Coverity's
|
||||
* assumptions about the modelled function are incorrect for iPXE.
|
||||
*/
|
||||
char * strerror ( int errno ) {
|
||||
}
|
||||
void copy_from_user ( void *dest, userptr_t src, off_t src_off, size_t len ) {
|
||||
}
|
||||
time_t mktime ( struct tm *tm ) {
|
||||
}
|
||||
int getchar ( void ) {
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
errors.db
|
|
@ -0,0 +1,109 @@
|
|||
#!/usr/bin/perl -w
|
||||
|
||||
=head1 NAME
|
||||
|
||||
errdb.pl
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
errdb.pl [options] ../../src/bin/errors
|
||||
|
||||
Options:
|
||||
|
||||
-d,--database=db Specify path to errors.db
|
||||
-h,--help Display brief help message
|
||||
-v,--verbose Increase verbosity
|
||||
-q,--quiet Decrease verbosity
|
||||
|
||||
=cut
|
||||
|
||||
use Getopt::Long;
|
||||
use Pod::Usage;
|
||||
use DBI;
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
# Parse command-line options
|
||||
my $verbosity = 0;
|
||||
my $errdb = "errors.db";
|
||||
Getopt::Long::Configure ( 'bundling', 'auto_abbrev' );
|
||||
GetOptions (
|
||||
'database|d=s' => sub { shift; $errdb = shift; },
|
||||
'verbose|v+' => sub { $verbosity++; },
|
||||
'quiet|q+' => sub { $verbosity--; },
|
||||
'help|h' => sub { pod2usage ( 1 ); },
|
||||
) or die "Could not parse command-line options\n";
|
||||
pod2usage ( 1 ) unless @ARGV >= 1;
|
||||
|
||||
# Open database
|
||||
my $dbh = DBI->connect ( "dbi:SQLite:dbname=".$errdb, "", "",
|
||||
{ RaiseError => 1, PrintError => 0 } );
|
||||
$dbh->begin_work();
|
||||
|
||||
# Create errors table if necessary
|
||||
eval {
|
||||
$dbh->selectall_arrayref ( "SELECT * FROM errors LIMIT 1" );
|
||||
};
|
||||
if ( $@ ) {
|
||||
print "Creating errors table\n" if $verbosity >= 1;
|
||||
$dbh->do ( "CREATE TABLE errors (".
|
||||
" errno char(8) NOT NULL,".
|
||||
" description text NOT NULL,".
|
||||
" PRIMARY KEY ( errno ) )" );
|
||||
}
|
||||
|
||||
# Create xrefs table if necessary
|
||||
eval {
|
||||
$dbh->selectall_arrayref ( "SELECT * FROM xrefs LIMIT 1" );
|
||||
};
|
||||
if ( $@ ) {
|
||||
print "Creating xrefs table\n" if $verbosity >= 1;
|
||||
$dbh->do ( "CREATE TABLE xrefs (".
|
||||
" errno char(8) NOT NULL,".
|
||||
" filename text NOT NULL,".
|
||||
" line integer NOT NULL,".
|
||||
" UNIQUE ( errno, filename, line ),".
|
||||
" FOREIGN KEY ( errno ) REFERENCES errors ( errno ) )" );
|
||||
$dbh->do ( "CREATE INDEX xrefs_errno ON xrefs ( errno )" );
|
||||
}
|
||||
|
||||
# Parse input file(s)
|
||||
my $errors = {};
|
||||
my $xrefs = {};
|
||||
while ( <> ) {
|
||||
chomp;
|
||||
( my $errno, my $filename, my $line, my $description ) = split ( /\t/ );
|
||||
$errno = substr ( $errno, 0, 6 ) unless $errno =~ /^7f/;
|
||||
$errors->{$errno} = $description;
|
||||
$xrefs->{$errno} ||= {};
|
||||
$xrefs->{$errno}->{$filename} ||= {};
|
||||
$xrefs->{$errno}->{$filename}->{$line} ||= 1;
|
||||
}
|
||||
|
||||
# Ensure all errors are present in database
|
||||
my $error_update =
|
||||
$dbh->prepare ( "UPDATE errors SET description = ? WHERE errno = ?" );
|
||||
my $error_insert = $dbh->prepare ( "INSERT INTO errors VALUES ( ?, ? )" );
|
||||
while ( ( my $errno, my $description ) = each %$errors ) {
|
||||
print "Error ".$errno." is \"".$description."\"\n" if $verbosity >= 2;
|
||||
if ( $error_update->execute ( $description, $errno ) == 0 ) {
|
||||
$error_insert->execute ( $errno, $description );
|
||||
}
|
||||
}
|
||||
|
||||
# Replace xrefs in database
|
||||
$dbh->do ( "DELETE FROM xrefs" );
|
||||
my $xref_insert = $dbh->prepare ( "INSERT INTO xrefs VALUES ( ?, ?, ? )" );
|
||||
while ( ( my $errno, my $xref_errno ) = each %$xrefs ) {
|
||||
while ( ( my $filename, my $xref_filename ) = each %$xref_errno ) {
|
||||
foreach my $line ( keys %$xref_filename ) {
|
||||
print "Error ".$errno." is used at ".$filename." line ".$line."\n"
|
||||
if $verbosity >= 2;
|
||||
$xref_insert->execute ( $errno, $filename, $line );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Close database
|
||||
$dbh->commit();
|
||||
$dbh->disconnect();
|
|
@ -0,0 +1,62 @@
|
|||
ROM-o-matic web interface for building iPXE ROMs
|
||||
------------------------------------------------
|
||||
|
||||
This web application generates iPXE images and sends them to a web
|
||||
browser.
|
||||
|
||||
Available as part of the iPXE source code distribution, which can be
|
||||
downlaoded from http://etherboot.org/
|
||||
|
||||
Author: Marty Connor <mdc@etherboot.org>
|
||||
License: GPLv2
|
||||
Support: http://etherboot.org/mailman/listinfo/ipxe
|
||||
Please send support questions to the iPXE mailing list
|
||||
|
||||
System Requirements
|
||||
-------------------
|
||||
- Apache web server
|
||||
- PHP 4+
|
||||
- Tools required to build iPXE installed on the server
|
||||
- gcc, mtools, syslinux, perl, etc.
|
||||
|
||||
Setup
|
||||
-----
|
||||
As distributed, it is expected that the rom-o-matic source code
|
||||
directory is in the contrib directory of a iPXE source distribution.
|
||||
|
||||
The easiest way to do this is to simply put a iPXE source distribution
|
||||
in a web server accessible directory.
|
||||
|
||||
If this is not the case, you will need to either edit the file
|
||||
|
||||
"globals.php"
|
||||
|
||||
or create a file called
|
||||
|
||||
"local-config.php"
|
||||
|
||||
containing the following lines:
|
||||
|
||||
<?php
|
||||
$src_dir = "../../src";
|
||||
?>
|
||||
|
||||
Then change the line beginning "$src_dir = " to the path of your iPXE
|
||||
source code tree.
|
||||
|
||||
To make build times shorter, before you run rom-o-matic for the first time
|
||||
you should cd to the ipxe "src" directory and enter the following
|
||||
commands:
|
||||
|
||||
$ make
|
||||
$ make bin/NIC
|
||||
|
||||
This will pro-compile most object files and will make your rom-o-matic
|
||||
builds much faster.
|
||||
|
||||
Running rom-o-matic from a web browser
|
||||
--------------------------------------
|
||||
Enter a URL like:
|
||||
|
||||
http://example.com/ipxe-1.x.x/contrib/rom-o-matic
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2009 Marty Connor <mdc@etherboot.org>.
|
||||
* Copyright (C) 2009 Entity Cyber, Inc.
|
||||
*
|
||||
* 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 of the
|
||||
* License, or any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
?>
|
||||
<hr>
|
||||
<h4>
|
||||
Resources:
|
||||
</h4>
|
||||
<ul>
|
||||
<li>
|
||||
Source code for iPXE images is available at
|
||||
<a href="http://www.ipxe.org/download" target="_blank">
|
||||
http://www.ipxe.org/download</a>
|
||||
<br><br>
|
||||
</li>
|
||||
<li>
|
||||
For general information about using iPXE, please visit the
|
||||
<a href="http://www.ipxe.org/" target="_blank">
|
||||
iPXE Project Home Page</a>
|
||||
<br><br>
|
||||
</li>
|
||||
<li>
|
||||
For Email-based support for iPXE please join
|
||||
<a href="http://www.ipxe.org/contact" target="_blank">
|
||||
iPXE Project mailing lists.</a>
|
||||
<br><br>
|
||||
</li>
|
||||
<li>
|
||||
For real-time online iPXE support via IRC please visit the
|
||||
<a href="irc://irc.freenode.net/%23ipxe"> #ipxe channel
|
||||
of irc.freenode.net</a>.
|
||||
<br><br>
|
||||
</li>
|
||||
</ul>
|
||||
<hr>
|
||||
<font size="-1">
|
||||
<br>
|
||||
Please email <a href="mailto:<?php echo "${webmaster_email}" ?>"><?php echo "${webmaster_email}"?></a>
|
||||
with questions or comments about this website.
|
||||
</font>
|
||||
<br><br>
|
||||
<hr>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,311 @@
|
|||
<?php // -*- Mode: PHP; -*-
|
||||
|
||||
/**
|
||||
* Copyright (C) 2009 Marty Connor <mdc@etherboot.org>.
|
||||
* Copyright (C) 2009 Entity Cyber, Inc.
|
||||
*
|
||||
* 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 of the
|
||||
* License, or any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
// Get utility functions and set globals
|
||||
require_once "utils.php";
|
||||
|
||||
// Make sure at least $A (action) was supplied
|
||||
if ( ! isset ( $_POST['A'] ) ) {
|
||||
|
||||
// Present user with form to customize build options
|
||||
require_once "customize-flags.php";
|
||||
|
||||
exit ();
|
||||
|
||||
// If user chose "Customize" option on form
|
||||
} else if ( $_POST['A'] == "Customize" ) {
|
||||
|
||||
// Present user with form to customize build options
|
||||
require_once "customize-flags.php";
|
||||
|
||||
exit ();
|
||||
|
||||
// The following conditional includes all other cases except "Get Image"
|
||||
// particularly the explicit ($A == "Start Over") case
|
||||
} else if ( $_POST['A'] != "Get Image" ) {
|
||||
|
||||
// Note that this method of redirections discards all the
|
||||
// configuration flags, which is intentional in this case.
|
||||
|
||||
$dest = curDirURL ();
|
||||
header ( "Location: $dest" );
|
||||
|
||||
// This next "echo" should normally not be seen, because
|
||||
// the "header" statement above should cause immediate
|
||||
// redirection but just in case...
|
||||
|
||||
echo "Try this link: <a href=\"$dest\">$dest</a>";
|
||||
|
||||
exit ();
|
||||
}
|
||||
|
||||
// OK, we're going to try to use whatever options have been set
|
||||
// to build an image.
|
||||
|
||||
// Make sure at least $nic was supplied
|
||||
if ( ! isset ( $_POST['nic'] ) ) {
|
||||
die ( "No NIC supplied!" );
|
||||
}
|
||||
if ( isset ( $nics[$_POST['nic']] ) ) {
|
||||
$nic = $nics[$_POST['nic']];
|
||||
} else {
|
||||
die ( "Invalid NIC \"${_POST['nic']}\" supplied!" );
|
||||
}
|
||||
|
||||
// Fetch flags
|
||||
$flags = get_flags ();
|
||||
|
||||
// Get requested format
|
||||
$ofmt = isset ( $_POST['ofmt'] ) ? $_POST['ofmt'] : "";
|
||||
$fmt_extension = isset ( $ofmts[$ofmt] ) ? $ofmts[$ofmt] : 'dsk';
|
||||
|
||||
// Handle some special cases
|
||||
|
||||
$pci_vendor_code = "";
|
||||
$pci_device_code = "";
|
||||
|
||||
if ( $nic == 'undionly' && $fmt_extension == "pxe" ) {
|
||||
|
||||
// undionly.pxe can't work because it unloads the PXE stack
|
||||
// that it needs to communicate with, so we set the extension
|
||||
// to .kpxe, which has a chance of working. The extension
|
||||
// .kkpxe is another option.
|
||||
|
||||
$fmt_extension = "kpxe";
|
||||
|
||||
} else if ( $fmt_extension == "rom" ) {
|
||||
|
||||
if ( ! isset ( $_POST['pci_vendor_code'] )
|
||||
|| ! isset ( $_POST['pci_device_code'] ) ) {
|
||||
die ( "rom output format selected but PCI code(s) missing!" );
|
||||
}
|
||||
|
||||
$pci_vendor_code = $_POST['pci_vendor_code'];
|
||||
$pci_device_code = $_POST['pci_device_code'];
|
||||
|
||||
if ( $pci_vendor_code == ""
|
||||
|| $pci_device_code == "" ) {
|
||||
die ( "rom output format selected but PCI code(s) missing!" );
|
||||
}
|
||||
|
||||
// Try to be forgiving of 0xAAAA format
|
||||
if ( strtolower ( substr ( $pci_vendor_code, 0, 2 ) ) == "0x"
|
||||
&& strlen ( $pci_vendor_code ) == 6 ) {
|
||||
$pci_vendor_code = substr ( $pci_vendor_code, 2, 4 );
|
||||
}
|
||||
if ( strtolower ( substr ( $pci_device_code, 0, 2 ) ) == "0x"
|
||||
&& strlen ( $pci_device_code ) == 6 ) {
|
||||
$pci_device_code = substr ( $pci_device_code, 2, 4 );
|
||||
}
|
||||
|
||||
// concatenate the pci codes to get the $nic part of the
|
||||
// Make target
|
||||
$pci_codes = strtolower ( $pci_vendor_code . $pci_device_code );
|
||||
|
||||
$nic = $pci_codes;
|
||||
if ( ! isset ( $roms[$pci_codes] ) ) {
|
||||
die ( "Sorry, no network driver supports PCI codes<br>"
|
||||
. "${_POST['pci_vendor_code']}:"
|
||||
. "${_POST['pci_device_code']}" );
|
||||
}
|
||||
} else if ( $fmt_extension != "rom"
|
||||
&& ( $pci_vendor_code != "" || $pci_device_code != "" ) ) {
|
||||
die ( "'$fmt_extension' format was selected but PCI IDs were"
|
||||
. " also entered.<br>Did you mean to select 'rom' output format"
|
||||
. " instead?" );
|
||||
}
|
||||
|
||||
/**
|
||||
* remove temporary build directory
|
||||
*
|
||||
* @return bool true if removal is successful, false otherwise
|
||||
*/
|
||||
function rm_build_dir ()
|
||||
{
|
||||
global $build_dir;
|
||||
global $keep_build_dir;
|
||||
|
||||
if ( $keep_build_dir !== true ) {
|
||||
rm_file_or_dir ( $build_dir );
|
||||
}
|
||||
}
|
||||
|
||||
// Arrange for the build directory to always be removed on exit.
|
||||
$build_dir = "";
|
||||
$keep_build_dir = false;
|
||||
register_shutdown_function ( 'rm_build_dir' );
|
||||
|
||||
// Make temporary copy of src directory
|
||||
$build_dir = mktempcopy ( "$src_dir", "/tmp", "MDCROM" );
|
||||
$config_dir = $build_dir . "/config";
|
||||
|
||||
// Write config files with supplied flags
|
||||
write_ipxe_config_files ( $config_dir, $flags );
|
||||
|
||||
// Handle a possible embedded script
|
||||
$emb_script_cmd = "";
|
||||
$embedded_script = isset ( $_POST['embedded_script'] ) ? $_POST['embedded_script'] : "";
|
||||
if ( $embedded_script != "" ) {
|
||||
$emb_script_path = "$build_dir" . "/script0.ipxe";
|
||||
|
||||
if ( substr ( $embedded_script, 0, 5 ) != "#!ipxe" ) {
|
||||
$embedded_script = "#!ipxe\n" . $embedded_script;
|
||||
}
|
||||
|
||||
// iPXE 0.9.7 doesn't like '\r\n" in the shebang...
|
||||
$embedded_script = str_replace ( "\r\n", "\n", $embedded_script );
|
||||
|
||||
write_file_from_string ( $emb_script_path, $embedded_script );
|
||||
$emb_script_cmd = "EMBEDDED_IMAGE=${emb_script_path}";
|
||||
}
|
||||
|
||||
// Make the requested image. $status is set to 0 on success
|
||||
$make_target = "bin/${nic}.${fmt_extension}";
|
||||
$gitversion = exec('git describe --always --abbrev=1 --match "" 2>/dev/null');
|
||||
if ($gitversion) {
|
||||
$gitversion = "GITVERSION=$gitversion";
|
||||
}
|
||||
|
||||
$make_cmd = "make -C '$build_dir' '$make_target' $gitversion $emb_script_cmd 2>&1";
|
||||
|
||||
exec ( $make_cmd, $maketxt, $status );
|
||||
|
||||
// Uncomment the following section for debugging
|
||||
|
||||
/**
|
||||
|
||||
echo "<h2>build.php:</h2>";
|
||||
echo "<h3>Begin debugging output</h3>";
|
||||
|
||||
//echo "<h3>\$_POST variables</h3>";
|
||||
//echo "<pre>"; var_dump ( $_POST ); echo "</pre>";
|
||||
|
||||
echo "<h3>Build options:</h3>";
|
||||
echo "<strong>Build directory is:</strong> $build_dir" . "<br><br>";
|
||||
echo "\$_POST['ofmt'] = " . "\"${_POST['ofmt']}\"" . "<br>";
|
||||
echo "\$_POST['nic'] = " . "\"${_POST['nic']}\"" . "<br>";
|
||||
echo "\$_POST['pci_vendor_code'] = " . "\"${_POST['pci_vendor_code']}\"" . "<br>";
|
||||
echo "\$_POST['pci_device_code'] = " . "\"${_POST['pci_device_code']}\"" . "<br>";
|
||||
|
||||
echo "<h3>Flags:</h3>";
|
||||
show_flags ( $flags );
|
||||
|
||||
if ( $embedded_script != "" ) {
|
||||
echo "<h3>Embedded script:</h3>";
|
||||
echo "<blockquote>"."<pre>";
|
||||
echo $embedded_script;
|
||||
echo "</pre>"."</blockquote>";
|
||||
}
|
||||
|
||||
echo "<h3>Make output:</h3>";
|
||||
echo "Make command: " . $make_cmd . "<br>";
|
||||
echo "Build status = <? echo $status ?>" . "<br>";
|
||||
echo "<blockquote>"."<pre>";
|
||||
echo htmlentities ( implode ("\n", $maketxt ) );
|
||||
echo "</pre>"."</blockquote>";
|
||||
// Uncomment the next line if you want to keep the
|
||||
// build directory around for inspection after building.
|
||||
$keep_build_dir = true;
|
||||
die ( "<h3>End debugging output</h3>" );
|
||||
|
||||
**/ // End debugging section
|
||||
|
||||
// Send ROM to browser (with extreme prejudice)
|
||||
|
||||
if ( $status == 0 ) {
|
||||
|
||||
$fp = fopen("${build_dir}/${make_target}", "rb" );
|
||||
if ( $fp > 0 ) {
|
||||
|
||||
$len = filesize ( "${build_dir}/${make_target}" );
|
||||
if ( $len > 0 ) {
|
||||
|
||||
$buf = fread ( $fp, $len );
|
||||
fclose ( $fp );
|
||||
|
||||
// Delete build directory as soon as it is not needed
|
||||
rm_build_dir ();
|
||||
|
||||
$output_filename = preg_replace('/[^a-z0-9\+\.\-]/i', '', "ipxe-${version}-${nic}.${fmt_extension}");
|
||||
|
||||
// Try to force IE to handle downloading right.
|
||||
Header ( "Cache-control: private");
|
||||
Header ( "Content-Type: application/x-octet-stream; " .
|
||||
"name=$output_filename");
|
||||
Header ( "Content-Disposition: attachment; " .
|
||||
"Filename=$output_filename");
|
||||
Header ( "Content-Location: $output_filename");
|
||||
Header ( "Content-Length: $len");
|
||||
|
||||
echo $buf;
|
||||
|
||||
exit ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* If we reach this point, the build has failed, and we provide
|
||||
* debugging information for a potential bug report
|
||||
*
|
||||
*/
|
||||
|
||||
// Remove build directory
|
||||
rm_build_dir ();
|
||||
|
||||
// Announce failure if $status from make was non-zero
|
||||
echo "<h2>Build failed. Status = " . $status . "</h2>";
|
||||
echo "<h2>build.php:</h2>";
|
||||
echo "<h3>Build options:</h3>";
|
||||
echo "<strong>Build directory is:</strong> $build_dir" . "<br><br>";
|
||||
echo "\$_POST['ofmt'] = " . "\"${_POST['ofmt']}\"" . "<br>";
|
||||
echo "\$_POST['nic'] = " . "\"${_POST['nic']}\"" . "<br>";
|
||||
echo "\$_POST['pci_vendor_code'] = " . "\"${_POST['pci_vendor_code']}\"" . "<br>";
|
||||
echo "\$_POST['pci_device_code'] = " . "\"${_POST['pci_device_code']}\"" . "<br>";
|
||||
|
||||
echo "<h3>Flags:</h3>";
|
||||
show_flags ( $flags );
|
||||
|
||||
if ( $embedded_script != "" ) {
|
||||
echo "<h3>Embedded script:</h3>";
|
||||
echo "<blockquote>"."<pre>";
|
||||
echo $embedded_script;
|
||||
echo "</pre>"."</blockquote>";
|
||||
}
|
||||
|
||||
echo "<h3>Make output:</h3>";
|
||||
echo "Make command: " . $make_cmd . "<br>";
|
||||
echo "<blockquote>"."<pre>";
|
||||
echo htmlentities ( implode ("\n", $maketxt ) );
|
||||
echo "</pre>"."</blockquote>";
|
||||
|
||||
echo "Please let us know that this happened, and paste the above output into your email message.<br>";
|
||||
|
||||
include_once $bottom_inc;
|
||||
|
||||
// For emacs:
|
||||
// Local variables:
|
||||
// c-basic-offset: 4
|
||||
// c-indent-level: 4
|
||||
// tab-width: 4
|
||||
// End:
|
||||
|
||||
?>
|
|
@ -0,0 +1,69 @@
|
|||
<?php // -*- Mode: PHP; -*-
|
||||
|
||||
/**
|
||||
* Copyright (C) 2009 Marty Connor <mdc@etherboot.org>.
|
||||
* Copyright (C) 2009 Entity Cyber, Inc.
|
||||
*
|
||||
* 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 of the
|
||||
* License, or any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
// Get utility functions and set globals
|
||||
require_once "utils.php";
|
||||
|
||||
// Prepare settable compile options for presentation to user
|
||||
$flags = default_flags ();
|
||||
|
||||
$build = "<input type=\"submit\" name=\"A\" value=\"Get Image\">";
|
||||
$restart = "<input type=\"submit\" name=\"A\" value=\"Start Over\">";
|
||||
|
||||
// Begin html output
|
||||
include_once $top_inc;
|
||||
|
||||
?>
|
||||
|
||||
<form action="build.php" method=POST>
|
||||
<input type="hidden" name="version" value = "<?php echo $version ?>">
|
||||
<input type="hidden" name="use_flags" value="1">
|
||||
<h3>
|
||||
Make changes below and press <?php echo $build ?> to create an image, <br>
|
||||
Or press <?php echo $restart ?> to return to the main page.
|
||||
</h3>
|
||||
<hr>
|
||||
<ul>
|
||||
<?php require ( "directions.php" ); ?>
|
||||
</ul>
|
||||
<hr>
|
||||
<?php echo_flags( $flags ); ?>
|
||||
<hr>
|
||||
<h3>Embedded Script:</h3>
|
||||
<?php echo textarea ( "embedded_script", "", "10", "50" ); ?>
|
||||
<br><br>
|
||||
<hr>
|
||||
<center><table width="35%"><tr>
|
||||
<td align="left"> <?php echo $build; ?> </td>
|
||||
<td align="right"> <?php echo $restart ?></td>
|
||||
</tr></table></center>
|
||||
</form>
|
||||
|
||||
<?php include_once $bottom_inc; ?>
|
||||
<?
|
||||
// For emacs:
|
||||
//
|
||||
// Local variables:
|
||||
// c-basic-offset: 4
|
||||
// c-indent-level: 4
|
||||
// tab-width: 4
|
||||
// End:
|
||||
?>
|
|
@ -0,0 +1,63 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2009 Marty Connor <mdc@etherboot.org>.
|
||||
* Copyright (C) 2009 Entity Cyber, Inc.
|
||||
*
|
||||
* 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 of the
|
||||
* License, or any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
?>
|
||||
<li>
|
||||
Choose an output format: <?php echo keys_menubox ( "ofmt", $ofmts,
|
||||
isset ( $_POST['ofmt'] ) ? $_POST['ofmt'] : "") ?>
|
||||
<br><br>
|
||||
</li>
|
||||
<li>
|
||||
Choose a NIC type: <?php echo keys_menubox ( "nic", $nics,
|
||||
isset ( $_POST['nic'] ) ? $_POST['nic'] : "" ) ?>
|
||||
<br><br>
|
||||
</li>
|
||||
<li>
|
||||
<strong>( optional — for binary ROM image format only )</strong> <br><br>
|
||||
If you choose <em>Binary ROM image</em> as your output format, you must<br>
|
||||
enter <strong>4 hex digits</strong> below for
|
||||
<em>PCI VENDOR CODE</em> and <em>PCI DEVICE CODE</em> <br>
|
||||
that match the NIC device for which you are making this image.<br><br>
|
||||
Information on how to determine NIC PCI IDs may be found
|
||||
<a href="http://www.ipxe.org/howto/romburning"
|
||||
target="_blank">here</a>.
|
||||
<br><br>
|
||||
PCI VENDOR CODE: <?php echo textbox ( "pci_vendor_code",
|
||||
isset ( $_POST['pci_vendor_code'] ) ? $_POST['pci_vendor_code']
|
||||
: "", 6 ); ?>
|
||||
|
||||
PCI DEVICE CODE: <?php echo textbox ( "pci_device_code",
|
||||
isset ( $_POST['pci_device_code'] ) ? $_POST['pci_device_code']
|
||||
: "", 6 ); ?>
|
||||
<h4>Please note for ROM images:</h4>
|
||||
<ul>
|
||||
<li>
|
||||
If you enter PCI IDs, we will attempt to determine the correct<br>
|
||||
driver to support them, and will ignore any NIC type entered
|
||||
above.<br><br>
|
||||
</li>
|
||||
<li>
|
||||
iPXE does not support all possible PCI IDs for supported
|
||||
NICs.
|
||||
<br><br>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
|
@ -0,0 +1 @@
|
|||
Automatic booting
|
|
@ -0,0 +1 @@
|
|||
Tenths of a second for which the shell banner should appear
|
|
@ -0,0 +1,3 @@
|
|||
Serial Console I/O port address. Common addresses are:<br>
|
||||
COM1 => 0x3f8, COM2 => 0x2f8, COM3 => 0x3e8, COM4 => 0x2e8
|
||||
|
|
@ -0,0 +1 @@
|
|||
Serial Console Data bits
|
|
@ -0,0 +1 @@
|
|||
Serial Console Parity: 0=None, 1=Odd, 2=Even
|
|
@ -0,0 +1 @@
|
|||
Keep settings from a previous user of the serial port
|
|
@ -0,0 +1 @@
|
|||
Serial Console Baud rate
|
|
@ -0,0 +1 @@
|
|||
Serial Console Stop bits
|
|
@ -0,0 +1 @@
|
|||
Option configuration console
|
|
@ -0,0 +1 @@
|
|||
Enable Default BIOS console
|
|
@ -0,0 +1 @@
|
|||
Enable Serial port console
|
|
@ -0,0 +1 @@
|
|||
Wireless WEP encryption support
|
|
@ -0,0 +1 @@
|
|||
Wireless WPA encryption support
|
|
@ -0,0 +1 @@
|
|||
Wireless WPA2 encryption support
|
|
@ -0,0 +1 @@
|
|||
DHCP management commands
|
|
@ -0,0 +1 @@
|
|||
DNS resolver
|
|
@ -0,0 +1 @@
|
|||
File Transfer Protocol
|
|
@ -0,0 +1 @@
|
|||
Hypertext Transfer Protocol
|
|
@ -0,0 +1 @@
|
|||
Trivial File Transfer Protocol
|
|
@ -0,0 +1 @@
|
|||
Interface management commands
|
|
@ -0,0 +1 @@
|
|||
Linux bzImage image support
|
|
@ -0,0 +1 @@
|
|||
Image management commands
|
|
@ -0,0 +1 @@
|
|||
ELF image support
|
|
@ -0,0 +1 @@
|
|||
MultiBoot image support
|
|
@ -0,0 +1 @@
|
|||
NBI image support
|
|
@ -0,0 +1 @@
|
|||
PXE image support
|
|
@ -0,0 +1 @@
|
|||
iPXE script image support
|
|
@ -0,0 +1 @@
|
|||
Wireless interface management commands
|
|
@ -0,0 +1 @@
|
|||
NMB resolver
|
|
@ -0,0 +1 @@
|
|||
Non-volatile option storage commands
|
|
@ -0,0 +1 @@
|
|||
Routing table management commands
|
|
@ -0,0 +1 @@
|
|||
SAN boot commands
|
|
@ -0,0 +1,531 @@
|
|||
<?php // -*- Mode: PHP; -*-
|
||||
|
||||
/**
|
||||
* Copyright (C) 2009 Marty Connor <mdc@etherboot.org>.
|
||||
* Copyright (C) 2009 Entity Cyber, Inc.
|
||||
*
|
||||
* 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 of the
|
||||
* License, or any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
$ofmts = array
|
||||
( "Floppy bootable image (.dsk)" => "dsk",
|
||||
"SYSLINUX-based bootable floppy image (.sdsk)" => "sdsk",
|
||||
"ISO bootable image (.iso)" => "iso",
|
||||
"ISO bootable image with legacy floppy emulation (.liso)" => "liso",
|
||||
"Linux kernel (SYSLINUX/GRUB/LILO) loadable image (.lkrn)" => "lkrn",
|
||||
"USB Keychain disk image (.usb)" => "usb",
|
||||
"ROM binary (flashable) image (.rom)" => "rom",
|
||||
"ROM binary (flashable) for problem PMM BIOSES (.hrom)" => "hrom",
|
||||
"PXE bootstrap loader image [Unload PXE stack] (.pxe)" => "pxe",
|
||||
"PXE bootstrap loader keep [Keep PXE stack method 1] (.kpxe)" => "kpxe",
|
||||
"PXE bootstrap loader keep [Keep PXE stack method 2] (.kkpxe)" => "kkpxe",
|
||||
);
|
||||
|
||||
$flag_table = array (
|
||||
|
||||
// Begin General Options:
|
||||
|
||||
"HDR_MISC_OPTIONS"
|
||||
=> array (
|
||||
"flag" => "HDR_MISC_OPTIONS",
|
||||
"hide_from_user" => "yes", // Hide even the header
|
||||
"type" => "header",
|
||||
"label" => "Miscellaneous Options"
|
||||
),
|
||||
|
||||
"PRODUCT_NAME"
|
||||
=> array (
|
||||
"flag" => "PRODUCT_NAME",
|
||||
"hide_from_user" => "yes",
|
||||
"type" => "string",
|
||||
"value" => "",
|
||||
"cfgsec" => "general"
|
||||
),
|
||||
|
||||
"PRODUCT_SHORT_NAME"
|
||||
=> array (
|
||||
"flag" => "PRODUCT_SHORT_NAME",
|
||||
"hide_from_user" => "yes",
|
||||
"type" => "string",
|
||||
"value" => "iPXE",
|
||||
"cfgsec" => "general"
|
||||
),
|
||||
|
||||
// End General Options:
|
||||
|
||||
// Begin Console Options:
|
||||
|
||||
"HDR_CONSOLE_OPTIONS"
|
||||
=> array (
|
||||
"flag" => "HDR_CONSOLE_OPTIONS",
|
||||
"type" => "header",
|
||||
"label" => "Console Options"
|
||||
),
|
||||
|
||||
"CONSOLE_PCBIOS"
|
||||
=> array (
|
||||
"flag" => "CONSOLE_PCBIOS",
|
||||
"type" => "on/off",
|
||||
"value" => "on",
|
||||
"cfgsec" => "console"
|
||||
),
|
||||
|
||||
"CONSOLE_SERIAL"
|
||||
=> array (
|
||||
"flag" => "CONSOLE_SERIAL",
|
||||
"type" => "on/off",
|
||||
"value" => "off",
|
||||
"cfgsec" => "console"
|
||||
),
|
||||
|
||||
"BANNER_TIMEOUT"
|
||||
=> array (
|
||||
"flag" => "BANNER_TIMEOUT",
|
||||
"type" => "integer",
|
||||
"value" => "20",
|
||||
"cfgsec" => "general"
|
||||
),
|
||||
|
||||
"KEYBOARD_MAP"
|
||||
=> array (
|
||||
"flag" => "KEYBOARD_MAP",
|
||||
"type" => "choice",
|
||||
"options" => array("al","az","bg","by","cf","cz","de","dk","es","et","fi","fr",
|
||||
"gr","hu","il","it","lt","mk","mt","nl","no","pl","pt","ro","ru","sg","sr",
|
||||
"th","ua","uk","us","wo"),
|
||||
"value" => "us",
|
||||
"cfgsec" => "console"
|
||||
),
|
||||
|
||||
"LOG_LEVEL"
|
||||
=> array (
|
||||
"flag" => "LOG_LEVEL",
|
||||
"type" => "choice",
|
||||
"options" => array("LOG_NONE","LOG_EMERG","LOG_ALERT","LOG_CRIT","LOG_ERR",
|
||||
"LOG_WARNING","LOG_NOTICE","LOG_INFO","LOG_DEBUG","LOG_ALL"),
|
||||
"value" => "LOG_NONE",
|
||||
"cfgsec" => "console"
|
||||
),
|
||||
|
||||
// End Console Options
|
||||
|
||||
// Begin Network Protocol Options:
|
||||
|
||||
"HDR_NETWORK_PROTOCOL_OPTIONS"
|
||||
=> array (
|
||||
"flag" => "HDR_NETWORK_PROTOCOL_OPTIONS",
|
||||
"hide_from_user" => "yes", // Hide even the header
|
||||
"type" => "header",
|
||||
"label" => "Network Protocol Options"
|
||||
),
|
||||
|
||||
"NET_PROTO_IPV4"
|
||||
=> array (
|
||||
"flag" => "NET_PROTO_IPV4",
|
||||
"type" => "on/off",
|
||||
"value" => "on",
|
||||
"hide_from_user" => "yes",
|
||||
"cfgsec" => "general"
|
||||
),
|
||||
|
||||
// End Network Protocol Options
|
||||
|
||||
// Begin Serial Port configuration
|
||||
|
||||
"HDR_SERIAL_PORT_OPTIONS"
|
||||
=> array (
|
||||
"flag" => "HDR_SERIAL_PORT_OPTIONS",
|
||||
"type" => "header",
|
||||
"label" => "Serial Port Options"
|
||||
),
|
||||
|
||||
"COMCONSOLE"
|
||||
=> array (
|
||||
"flag" => "COMCONSOLE",
|
||||
"type" => "integer-hex", // e.g. 0x378
|
||||
"value" => "0x3F8",
|
||||
"cfgsec" => "serial"
|
||||
),
|
||||
|
||||
"COMPRESERVE"
|
||||
=> array (
|
||||
"flag" => "COMPRESERVE",
|
||||
"type" => "on/off",
|
||||
"value" => "off",
|
||||
"cfgsec" => "serial"
|
||||
),
|
||||
|
||||
"COMSPEED"
|
||||
=> array (
|
||||
"flag" => "COMSPEED",
|
||||
"type" => "integer",
|
||||
"value" => "115200",
|
||||
"cfgsec" => "serial"
|
||||
),
|
||||
|
||||
"COMDATA"
|
||||
=> array (
|
||||
"flag" => "COMDATA",
|
||||
"type" => "integer",
|
||||
"value" => "8",
|
||||
"cfgsec" => "serial"
|
||||
),
|
||||
|
||||
"COMPARITY"
|
||||
=> array (
|
||||
"flag" => "COMPARITY",
|
||||
"type" => "integer",
|
||||
"value" => "0",
|
||||
"cfgsec" => "serial"
|
||||
),
|
||||
|
||||
"COMSTOP"
|
||||
=> array (
|
||||
"flag" => "COMSTOP",
|
||||
"type" => "integer",
|
||||
"value" => "1",
|
||||
"cfgsec" => "serial"
|
||||
),
|
||||
|
||||
// End Serial Options
|
||||
|
||||
// Begin Download Protocols
|
||||
|
||||
"HDR_DOWNLOAD_PROTOCOLS"
|
||||
=> array (
|
||||
"flag" => "HDR_DOWNLOAD_PROTOCOLS",
|
||||
"type" => "header",
|
||||
"label" => "Download Protocols"
|
||||
),
|
||||
|
||||
"DOWNLOAD_PROTO_TFTP"
|
||||
=> array (
|
||||
"flag" => "DOWNLOAD_PROTO_TFTP",
|
||||
"type" => "on/off",
|
||||
"value" => "on",
|
||||
"cfgsec" => "general"
|
||||
),
|
||||
|
||||
"DOWNLOAD_PROTO_HTTP"
|
||||
=> array (
|
||||
"flag" => "DOWNLOAD_PROTO_HTTP",
|
||||
"type" => "on/off",
|
||||
"value" => "on",
|
||||
"cfgsec" => "general"
|
||||
),
|
||||
|
||||
"DOWNLOAD_PROTO_HTTPS"
|
||||
=> array (
|
||||
"flag" => "DOWNLOAD_PROTO_HTTPS",
|
||||
"type" => "on/off",
|
||||
"value" => "off",
|
||||
"cfgsec" => "general"
|
||||
),
|
||||
|
||||
"DOWNLOAD_PROTO_FTP"
|
||||
=> array (
|
||||
"flag" => "DOWNLOAD_PROTO_FTP",
|
||||
"type" => "on/off",
|
||||
"value" => "off",
|
||||
"cfgsec" => "general"
|
||||
),
|
||||
|
||||
// End Download Protocols
|
||||
|
||||
// Begin SAN boot protocols
|
||||
|
||||
"HDR_SANBOOT_PROTOCOLS"
|
||||
=> array (
|
||||
"flag" => "HDR_SANBOOT_PROTOCOLS",
|
||||
"type" => "header",
|
||||
"label" => "SAN Boot Protocols"
|
||||
),
|
||||
|
||||
"SANBOOT_PROTO_ISCSI"
|
||||
=> array (
|
||||
"flag" => "SANBOOT_PROTO_ISCSI",
|
||||
"type" => "on/off",
|
||||
"value" => "on",
|
||||
"cfgsec" => "general"
|
||||
),
|
||||
|
||||
"SANBOOT_PROTO_AOE"
|
||||
=> array (
|
||||
"flag" => "SANBOOT_PROTO_AOE",
|
||||
"type" => "on/off",
|
||||
"value" => "on",
|
||||
"cfgsec" => "general"
|
||||
),
|
||||
|
||||
// End SAN boot protocols
|
||||
|
||||
// Begin Name resolution modules
|
||||
|
||||
"HDR_NAME_RESOLUTION_MODULES"
|
||||
=> array (
|
||||
"flag" => "HDR_NAME_RESOLUTION_MODULES",
|
||||
"type" => "header",
|
||||
"label" => "Name Resolution Modules"
|
||||
),
|
||||
|
||||
"DNS_RESOLVER"
|
||||
=> array (
|
||||
"flag" => "DNS_RESOLVER",
|
||||
"type" => "on/off",
|
||||
"value" => "on",
|
||||
"cfgsec" => "general"
|
||||
),
|
||||
|
||||
"NMB_RESOLVER"
|
||||
=> array (
|
||||
"flag" => "NMB_RESOLVER",
|
||||
"type" => "on/off",
|
||||
"value" => "off",
|
||||
"hide_from_user" => "yes",
|
||||
"cfgsec" => "general"
|
||||
),
|
||||
|
||||
// End Name resolution modules
|
||||
|
||||
// Begin Image types
|
||||
|
||||
"HDR_IMAGE_TYPES"
|
||||
=> array (
|
||||
"flag" => "HDR_IMAGE_TYPES",
|
||||
"type" => "header",
|
||||
"label" => "Image Types",
|
||||
),
|
||||
|
||||
"IMAGE_ELF"
|
||||
=> array (
|
||||
"flag" => "IMAGE_ELF",
|
||||
"type" => "on/off",
|
||||
"value" => "on",
|
||||
"cfgsec" => "general"
|
||||
),
|
||||
|
||||
"IMAGE_NBI"
|
||||
=> array (
|
||||
"flag" => "IMAGE_NBI",
|
||||
"type" => "on/off",
|
||||
"value" => "on",
|
||||
"cfgsec" => "general"
|
||||
),
|
||||
|
||||
"IMAGE_MULTIBOOT"
|
||||
=> array (
|
||||
"flag" => "IMAGE_MULTIBOOT",
|
||||
"type" => "on/off",
|
||||
"value" => "on",
|
||||
"cfgsec" => "general"
|
||||
),
|
||||
|
||||
"IMAGE_PXE"
|
||||
=> array (
|
||||
"flag" => "IMAGE_PXE",
|
||||
"type" => "on/off",
|
||||
"value" => "on",
|
||||
"cfgsec" => "general"
|
||||
),
|
||||
|
||||
"IMAGE_SCRIPT"
|
||||
=> array (
|
||||
"flag" => "IMAGE_SCRIPT",
|
||||
"type" => "on/off",
|
||||
"value" => "on",
|
||||
"cfgsec" => "general"
|
||||
),
|
||||
|
||||
"IMAGE_BZIMAGE"
|
||||
=> array (
|
||||
"flag" => "IMAGE_BZIMAGE",
|
||||
"type" => "on/off",
|
||||
"value" => "on",
|
||||
"cfgsec" => "general"
|
||||
),
|
||||
|
||||
"IMAGE_COMBOOT"
|
||||
=> array (
|
||||
"flag" => "IMAGE_COMBOOT",
|
||||
"type" => "on/off",
|
||||
"value" => "on",
|
||||
"cfgsec" => "general"
|
||||
),
|
||||
|
||||
// End Image types
|
||||
|
||||
// Begin Command-line commands to include
|
||||
|
||||
"HDR_COMMAND_LINE_OPTIONS"
|
||||
=> array (
|
||||
"flag" => "HDR_COMMAND_LINE_OPTIONS",
|
||||
"type" => "header",
|
||||
"label" => "Command Line Options",
|
||||
),
|
||||
|
||||
"AUTOBOOT_CMD"
|
||||
=> array (
|
||||
"flag" => "AUTOBOOT_CMD",
|
||||
"type" => "on/off",
|
||||
"value" => "on",
|
||||
"cfgsec" => "general"
|
||||
),
|
||||
|
||||
"NVO_CMD"
|
||||
=> array (
|
||||
"flag" => "NVO_CMD",
|
||||
"type" => "on/off",
|
||||
"value" => "on",
|
||||
"cfgsec" => "general"
|
||||
),
|
||||
|
||||
"CONFIG_CMD"
|
||||
=> array (
|
||||
"flag" => "CONFIG_CMD",
|
||||
"type" => "on/off",
|
||||
"value" => "on",
|
||||
"cfgsec" => "general"
|
||||
),
|
||||
|
||||
"IFMGMT_CMD"
|
||||
=> array (
|
||||
"flag" => "IFMGMT_CMD",
|
||||
"type" => "on/off",
|
||||
"value" => "on",
|
||||
"cfgsec" => "general"
|
||||
),
|
||||
|
||||
"IWMGMT_CMD"
|
||||
=> array (
|
||||
"flag" => "IWMGMT_CMD",
|
||||
"type" => "on/off",
|
||||
"value" => "on",
|
||||
"cfgsec" => "general"
|
||||
),
|
||||
|
||||
"ROUTE_CMD"
|
||||
=> array (
|
||||
"flag" => "ROUTE_CMD",
|
||||
"type" => "on/off",
|
||||
"value" => "on",
|
||||
"cfgsec" => "general"
|
||||
),
|
||||
|
||||
"IMAGE_CMD"
|
||||
=> array (
|
||||
"flag" => "IMAGE_CMD",
|
||||
"type" => "on/off",
|
||||
"value" => "on",
|
||||
"cfgsec" => "general"
|
||||
),
|
||||
|
||||
"DHCP_CMD"
|
||||
=> array (
|
||||
"flag" => "DHCP_CMD",
|
||||
"type" => "on/off",
|
||||
"value" => "on",
|
||||
"cfgsec" => "general"
|
||||
),
|
||||
|
||||
"SANBOOT_CMD"
|
||||
=> array (
|
||||
"flag" => "SANBOOT_CMD",
|
||||
"type" => "on/off",
|
||||
"value" => "on",
|
||||
"cfgsec" => "general"
|
||||
),
|
||||
|
||||
"LOGIN_CMD"
|
||||
=> array (
|
||||
"flag" => "LOGIN_CMD",
|
||||
"type" => "on/off",
|
||||
"value" => "on",
|
||||
"cfgsec" => "general"
|
||||
),
|
||||
|
||||
"TIME_CMD"
|
||||
=> array (
|
||||
"flag" => "TIME_CMD",
|
||||
"type" => "on/off",
|
||||
"value" => "off",
|
||||
"cfgsec" => "general"
|
||||
),
|
||||
|
||||
"DIGEST_CMD"
|
||||
=> array (
|
||||
"flag" => "DIGEST_CMD",
|
||||
"type" => "on/off",
|
||||
"value" => "off",
|
||||
"cfgsec" => "general"
|
||||
),
|
||||
|
||||
// End Command-line commands to include
|
||||
|
||||
// Begin Wireless options
|
||||
|
||||
"HDR_WIRELESS_OPTIONS"
|
||||
=> array (
|
||||
"flag" => "HDR_WIRELESS_OPTIONS",
|
||||
"type" => "header",
|
||||
"label" => "Wireless Interface Options",
|
||||
),
|
||||
|
||||
"CRYPTO_80211_WEP"
|
||||
=> array (
|
||||
"flag" => "CRYPTO_80211_WEP",
|
||||
"type" => "on/off",
|
||||
"value" => "on",
|
||||
"cfgsec" => "general"
|
||||
),
|
||||
|
||||
"CRYPTO_80211_WPA"
|
||||
=> array (
|
||||
"flag" => "CRYPTO_80211_WPA",
|
||||
"type" => "on/off",
|
||||
"value" => "on",
|
||||
"cfgsec" => "general"
|
||||
),
|
||||
|
||||
"CRYPTO_80211_WPA2"
|
||||
=> array (
|
||||
"flag" => "CRYPTO_80211_WPA2",
|
||||
"type" => "on/off",
|
||||
"value" => "on",
|
||||
"cfgsec" => "general"
|
||||
),
|
||||
|
||||
// End Wireless options
|
||||
|
||||
// Obscure options required to compile
|
||||
"NETDEV_DISCARD_RATE"
|
||||
=> array (
|
||||
"flag" => "NETDEV_DISCARD_RATE",
|
||||
"type" => "integer",
|
||||
"value" => "0",
|
||||
"cfgsec" => "general",
|
||||
"hide_from_user" => true
|
||||
)
|
||||
|
||||
// End Obscure options
|
||||
);
|
||||
|
||||
// For emacs:
|
||||
// Local variables:
|
||||
// c-basic-offset: 4
|
||||
// c-indent-level: 4
|
||||
// tab-width: 4
|
||||
// End:
|
||||
|
||||
?>
|
|
@ -0,0 +1,51 @@
|
|||
<?php // -*- Mode: PHP; -*-
|
||||
|
||||
/**
|
||||
* Copyright (C) 2009 Marty Connor <mdc@etherboot.org>.
|
||||
* Copyright (C) 2009 Entity Cyber, Inc.
|
||||
*
|
||||
* 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 of the
|
||||
* License, or any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
// Directory containing iPXE source code tree
|
||||
$src_dir = "../../src";
|
||||
|
||||
// Compute iPXE version based on source tree
|
||||
exec ( "make -C '$src_dir' version 2>&1", $make_output, $status );
|
||||
$version = ( $status == 0 && count ( $make_output ) > 1 )
|
||||
? trim ( $make_output[count ( $make_output ) - 2] )
|
||||
: "";
|
||||
|
||||
// Email address of person responsible for this website
|
||||
$webmaster_email = "webmaster@example.com";
|
||||
|
||||
// Files that header and footer text
|
||||
$top_inc = "top.php";
|
||||
$bottom_inc = "bottom.php";
|
||||
|
||||
// Descriptive strings
|
||||
$header_title = "ROM-o-matic for iPXE $version";
|
||||
$html_tagline = "ROM-o-matic dynamically generates iPXE images";
|
||||
$html_title = "ROM-o-matic for iPXE $version";
|
||||
$description = "a dynamic iPXE image generator";
|
||||
|
||||
// For emacs:
|
||||
// Local variables:
|
||||
// c-basic-offset: 4
|
||||
// c-indent-level: 4
|
||||
// tab-width: 4
|
||||
// End:
|
||||
|
||||
?>
|
|
@ -0,0 +1,47 @@
|
|||
<?php // -*- Mode: PHP; -*-
|
||||
|
||||
/**
|
||||
* Copyright (C) 2009 Marty Connor <mdc@etherboot.org>.
|
||||
* Copyright (C) 2009 Entity Cyber, Inc.
|
||||
*
|
||||
* 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 of the
|
||||
* License, or any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
// Get utility functions and set globals
|
||||
require_once "utils.php";
|
||||
|
||||
// Begin html output
|
||||
include_once $top_inc;
|
||||
|
||||
?>
|
||||
<form action="build.php" method=POST>
|
||||
<input type="hidden" name="version" value = "<?php echo $version ?>">
|
||||
<h3>To create an image:</h3>
|
||||
<ol>
|
||||
<?php require ( "directions.php" ); ?>
|
||||
<li>
|
||||
Generate and download an image:
|
||||
<input type="submit" name="A" value="Get Image">
|
||||
<br><br>
|
||||
</li>
|
||||
<li>
|
||||
(optional) Customize image configuration options:
|
||||
<input type="submit" name="A" value="Customize">
|
||||
<br><br>
|
||||
</li>
|
||||
</ol>
|
||||
</form>
|
||||
|
||||
<?php include_once $bottom_inc ?>
|
|
@ -0,0 +1,41 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2009 Marty Connor <mdc@etherboot.org>.
|
||||
* Copyright (C) 2009 Entity Cyber, Inc.
|
||||
*
|
||||
* 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 of the
|
||||
* License, or any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
?>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<link rev="made" href="mailto:<?php echo "${webmaster_email}" ?>">
|
||||
<meta name="keywords" content="rom, etherboot, ipxe, open source, rom-o-matic.net">
|
||||
<title><?php echo $header_title ?></title>
|
||||
<meta name="description" content="<?php echo $description ?>">
|
||||
</head>
|
||||
<h1>
|
||||
<?php echo "$html_title" ?>
|
||||
</h1>
|
||||
<hr>
|
||||
<h2>
|
||||
<?php echo "$html_tagline" ?>
|
||||
</h2>
|
||||
</form>
|
||||
<hr>
|
|
@ -0,0 +1,684 @@
|
|||
<?php // -*- Mode: PHP; -*-
|
||||
|
||||
/**
|
||||
* Copyright (C) 2009 Marty Connor <mdc@etherboot.org>.
|
||||
* Copyright (C) 2009 Entity Cyber, Inc.
|
||||
*
|
||||
* 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 of the
|
||||
* License, or any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
// Include table of user-configurable iPXE options
|
||||
require_once "flag-table.php";
|
||||
|
||||
// Include user-shadowable globals
|
||||
require_once "globals.php";
|
||||
|
||||
// Allow user to shadow globals
|
||||
if ( is_file ( 'local-config.php' ) ) {
|
||||
include_once "local-config.php";
|
||||
}
|
||||
|
||||
////
|
||||
// General utility functions
|
||||
////
|
||||
|
||||
/**
|
||||
* Remove undesirable characters from a given string
|
||||
*
|
||||
* Certain characters have the potential to be used for
|
||||
* malicious purposes by web-based attackers. This routine
|
||||
* filters out such characters.
|
||||
*
|
||||
* @param string $s supplied string
|
||||
*
|
||||
* @return string returned string with unwanted characters
|
||||
* removed
|
||||
*/
|
||||
function cleanstring ( $s )
|
||||
{
|
||||
$len = strlen ( $s );
|
||||
if ( $len > 80 ) {
|
||||
$s = substr ( $s, 0, 80 );
|
||||
}
|
||||
|
||||
$s = trim ( $s );
|
||||
$pos = 0;
|
||||
$result = "";
|
||||
|
||||
while ( $pos < $len ) {
|
||||
$ltr = ord ( ucfirst ( $s[$pos] ) );
|
||||
if ( ( $ltr >= ord ( "A" ) ) && ( $ltr <= ord ( "Z" ) ) ||
|
||||
( $ltr >= ord ( "0" ) ) && ( $ltr <= ord ( "9" ) ) ||
|
||||
( $ltr == ord ( "." ) ) && ( strlen ( $result ) > 0 ) ||
|
||||
( $ltr == ord ( "_" ) ) ||
|
||||
( $ltr == ord ( "+" ) ) ||
|
||||
( $ltr == ord ( ":" ) ) ||
|
||||
( $ltr == ord ( "/" ) ) ||
|
||||
( $ltr == ord ( "-" ) ) ) {
|
||||
$result .= $s[$pos];
|
||||
}
|
||||
$pos++;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return URL of the currently running script, minus the filename
|
||||
*
|
||||
* @return string the URL of the currently running script, minus the filename
|
||||
*/
|
||||
function curDirURL ()
|
||||
{
|
||||
$dir = dirname ( $_SERVER['PHP_SELF'] );
|
||||
|
||||
if ( $dir == "." || $dir == "/" ) {
|
||||
$dir = "";
|
||||
}
|
||||
|
||||
$isHTTPS = ( isset ( $_SERVER["HTTPS"] ) && $_SERVER["HTTPS"] == "on" );
|
||||
$port = ( isset($_SERVER["SERVER_PORT"] ) &&
|
||||
( ( !$isHTTPS && $_SERVER["SERVER_PORT"] != "80" ) ||
|
||||
( $isHTTPS && $_SERVER["SERVER_PORT"] != "443" ) ) );
|
||||
|
||||
$port = ( $port ) ? ':' . $_SERVER["SERVER_PORT"] : '';
|
||||
|
||||
$dest = ( $isHTTPS ? 'https://' : 'http://' ) .
|
||||
$_SERVER["SERVER_NAME"] . $dir . "/";
|
||||
|
||||
return $dest;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract NIC families and associated ROM PCI IDs from the src/bin/NIC file.
|
||||
*
|
||||
* $src_dir must contain the path of the iPXE src directory for this build
|
||||
*
|
||||
* @return array[0] array $new_nics
|
||||
* @return array[1] array $roms
|
||||
*/
|
||||
function parse_nic_file ()
|
||||
{
|
||||
global $src_dir;
|
||||
|
||||
$fd = fopen ( "$src_dir/bin/NIC", "r" );
|
||||
if ( ! $fd ) {
|
||||
die ( "Missing src/bin/NIC file. 'make bin/NIC'" );
|
||||
}
|
||||
|
||||
$nics = array ();
|
||||
$roms = array ();
|
||||
$nic = "";
|
||||
|
||||
while ( !feof ( $fd ) ) {
|
||||
|
||||
$line = trim ( fgets ( $fd, 200 ) );
|
||||
|
||||
$first_eight_chars = substr ( $line, 0, 8 );
|
||||
settype ( $first_eight_chars, "string" );
|
||||
|
||||
if ( strpos ( $first_eight_chars, "family" ) === 0 ) {
|
||||
|
||||
// get pathname of NIC driver
|
||||
#list ( $dummy, $nic ) = split( "[ \t]+", $line );
|
||||
list ( $dummy, $nic ) = explode("\t", $line);
|
||||
settype ( $nic, "string" );
|
||||
|
||||
// extract filename name of driver from pathname
|
||||
$nic = substr ( $nic, strrpos ( $nic, "/" ) + 1,
|
||||
strlen ( $nic ) - strrpos ( $nic, "/" ) + 1 );
|
||||
|
||||
$nics[$nic] = $nic;
|
||||
|
||||
// For each ISA NIC, there can only be one ROM variant
|
||||
$roms[$nic] = $nic;
|
||||
}
|
||||
|
||||
// If the first 8 digits of the line are hex digits
|
||||
// add this rom to the current nic family.
|
||||
|
||||
if ( ( strlen ( $first_eight_chars ) == 8 )
|
||||
&& ( ctype_xdigit ( $first_eight_chars ) )
|
||||
&& ( $nic != "" ) ) {
|
||||
|
||||
$roms[$first_eight_chars] = $nic;
|
||||
}
|
||||
}
|
||||
fclose ( $fd );
|
||||
|
||||
// put most NICs in nice alpha order for menu
|
||||
ksort ( $nics );
|
||||
|
||||
// add special cases to the top
|
||||
|
||||
$new_nics = array ( "all-drivers" => "ipxe",
|
||||
"undionly" => "undionly",
|
||||
"undi" => "undi",
|
||||
);
|
||||
|
||||
foreach ( $nics as $key => $value ) {
|
||||
// skip the undi driver
|
||||
if ( $key != "undi" ) {
|
||||
$new_nics[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return array ( $new_nics, $roms );
|
||||
}
|
||||
|
||||
////
|
||||
// HTML form utility functions
|
||||
////
|
||||
|
||||
/**
|
||||
* Return html code to create hidden form input fields
|
||||
*
|
||||
* @param string $flag name of form variable to set
|
||||
* @param string $value value to give form variable
|
||||
*
|
||||
* @return string html code for given hidden form input field
|
||||
*/
|
||||
function hidden ( $flag, $value )
|
||||
{
|
||||
$value = htmlentities ( $value );
|
||||
return "<input type=\"hidden\" value=\"$value\" name=\"$flag\"></input>";
|
||||
}
|
||||
|
||||
/**
|
||||
* Return html code to create checkbox form input fields
|
||||
*
|
||||
* @param string $flag name of form variable to set
|
||||
* @param string $value "on" means box should be checked
|
||||
*
|
||||
* @return string html code for given hidden form input field
|
||||
*/
|
||||
function checkbox ( $flag, $value )
|
||||
{
|
||||
return "<input type=\"checkbox\" value=\"on\" name=\"$flag\"" .
|
||||
($value == "on" ? " checked>" : ">" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Return html code to create text form input fields
|
||||
*
|
||||
* @param string $flag name of form variable to set
|
||||
* @param string $value initial contents of field
|
||||
* @param string $size size in characters of text box
|
||||
*
|
||||
* @return string html code for given text input field
|
||||
*/
|
||||
function textbox ( $flag, $value, $size )
|
||||
{
|
||||
$value = htmlentities ( $value );
|
||||
return "<input type=\"text\" size=\"$size\" value=\"$value\" name=\"$flag\">";
|
||||
}
|
||||
|
||||
/**
|
||||
* Return html code to create textarea form fields
|
||||
*
|
||||
* @param string $flag name of form variable to set
|
||||
* @param string $value initial contents of textarea
|
||||
* @param string $rows height of text area in rows
|
||||
* @param string $cols width of text area in columns
|
||||
*
|
||||
* @return string html code for given textarea input field
|
||||
*/
|
||||
function textarea ( $flag, $value, $rows, $cols )
|
||||
{
|
||||
$value = htmlentities ( $value );
|
||||
return "<textarea name=\"$flag\" rows=\"$rows\" cols=\"$cols\">"
|
||||
. $value . "</textarea>";
|
||||
}
|
||||
|
||||
/**
|
||||
* Return html code to create select (menu) form fields
|
||||
*
|
||||
* Use array of strings as menu choices
|
||||
*
|
||||
* @param string $flag name of form variable to set
|
||||
* @param array $options array of strings representing choices
|
||||
* @param string $value value of choice to select in menu
|
||||
*
|
||||
* @return string html code for given select (menu) input field
|
||||
*/
|
||||
function menubox ( $name, $options, $value )
|
||||
{
|
||||
$s="<select name=\"$name\">";
|
||||
|
||||
foreach ( $options as $ignore => $option ) {
|
||||
if ( !$value ) $value = $option;
|
||||
$s .= "<option" . ( $option == $value ? " selected>" : ">" ) .
|
||||
htmlentities ( $option ) . "</option>";
|
||||
}
|
||||
return $s . "</select>";
|
||||
}
|
||||
|
||||
/**
|
||||
* Return html code to create select (menu) form fields
|
||||
*
|
||||
* Use indices of array of strings as menu choices rather than
|
||||
* the values pointed to by the indicies.
|
||||
*
|
||||
* @param string $flag name of form variable to set
|
||||
* @param array $options array of strings representing choices
|
||||
* @param string $value value of choice to select in menu
|
||||
*
|
||||
* @return string html code for given select (menu) input field
|
||||
*/
|
||||
function keys_menubox ( $name, $options, $value )
|
||||
{
|
||||
$s="<select name=\"$name\">";
|
||||
|
||||
foreach ( $options as $option => $ignore ) {
|
||||
if ( !$value ) $value = $option;
|
||||
$s .= "<option" . ( $option == $value ? " selected>" : ">" ) .
|
||||
htmlentities ( $option ) . "</option>";
|
||||
}
|
||||
return $s . "</select>";
|
||||
}
|
||||
|
||||
////
|
||||
// Flag (compile option) handling functions
|
||||
////
|
||||
|
||||
/**
|
||||
* Return default compile options (flags)
|
||||
*
|
||||
* Initial compile options are in a global called $flag_table.
|
||||
* Create and return an array containing the ones we want.
|
||||
*
|
||||
* @return array default compile options (flags)
|
||||
*/
|
||||
function default_flags ()
|
||||
{
|
||||
global $flag_table;
|
||||
|
||||
$flags = array ();
|
||||
|
||||
foreach ( $flag_table as $key => $props ) {
|
||||
|
||||
$flag = $props["flag"];
|
||||
$type = $props["type"];
|
||||
|
||||
// Fields like headers have no "value" property
|
||||
if ( isset ( $props["value"] ) ) {
|
||||
$flags[$flag] = $props["value"];
|
||||
}
|
||||
}
|
||||
return $flags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return combination of default and user compile options (flags)
|
||||
*
|
||||
* Initial compile options are in a global called $flag_table.
|
||||
* Compile options may have been changed via form input. We return
|
||||
* an array with either the default value of each option or a user
|
||||
* supplied value from form input.
|
||||
*
|
||||
* @return array combined default and user supplied compile options (flags)
|
||||
*/
|
||||
function get_flags ()
|
||||
{
|
||||
global $flag_table;
|
||||
|
||||
$flags = default_flags ();
|
||||
|
||||
if ( ! isset ( $_POST["use_flags"] ) )
|
||||
return $flags;
|
||||
|
||||
foreach ( $flag_table as $key => $props ) {
|
||||
|
||||
$flag = $props["flag"];
|
||||
$type = $props["type"];
|
||||
|
||||
if ( isset ( $_POST["$flag"] ) ) {
|
||||
$flags[$flag] = $_POST["$flag"];
|
||||
if ( $type == "integer-hex" ) {
|
||||
if ( strtolower ( substr ( $flags[$flag], 0, 2 ) ) != "0x" ) {
|
||||
$flags[$flag] = "0x" . $flags[$flag];
|
||||
}
|
||||
}
|
||||
} else if ( $type == "on/off" ) {
|
||||
// Unchecked checkboxes don't pass any POST value
|
||||
// so we must check for them specially. At this
|
||||
// point we know that there is no $_POST value set
|
||||
// for this option. If it is a checkbox, this means
|
||||
// it is unchecked, so record that in $flags so we
|
||||
// can later generate an #undef for this option.
|
||||
$flags[$flag] = "off";
|
||||
}
|
||||
}
|
||||
return $flags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Output given value in appropriate format for iPXE config file
|
||||
*
|
||||
* iPXE config/*.h files use C pre-processor syntax. Output the given
|
||||
* compile option in a format appropriate to its type
|
||||
*
|
||||
* @param string $key index into $flag_table for given compile option
|
||||
* @param string $value value we wish to set compile option to
|
||||
*
|
||||
* @return string code to set compile option to given value
|
||||
*/
|
||||
function pprint_flag ( $key, $value )
|
||||
{
|
||||
global $flag_table;
|
||||
|
||||
// Determine type of given compile option (flag)
|
||||
$type = $flag_table[$key]["type"];
|
||||
$s = "";
|
||||
|
||||
if ( $type == "on/off" && $value == "on" ) {
|
||||
$s = "#define $key";
|
||||
} else if ( $type == "on/off" && $value != "on" ) {
|
||||
$s = "#undef $key";
|
||||
} else if ( $type == "string" ) {
|
||||
$s = ( "#define $key \"" . cleanstring ( $value ) . "\"" );
|
||||
} else if ($type == "qstring" ) {
|
||||
$s = ( "#define $key \\\"" . cleanstring ( $value ) . "\\\"" );
|
||||
} else {
|
||||
$s = "#define $key " . cleanstring ( $value );
|
||||
}
|
||||
|
||||
return $s;
|
||||
}
|
||||
|
||||
/**
|
||||
* Output html code to display all compile options as a table
|
||||
*
|
||||
* @param array $flags array of compile options
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function echo_flags ( $flags )
|
||||
{
|
||||
global $flag_table;
|
||||
|
||||
echo "<table>\n";
|
||||
|
||||
foreach ( $flag_table as $key => $props ) {
|
||||
|
||||
// Hide parameters from users that should not be changed.
|
||||
$hide_from_user = isset ( $props["hide_from_user"] ) ? $props["hide_from_user"] : "no";
|
||||
|
||||
$flag = $props["flag"];
|
||||
$type = $props["type"];
|
||||
|
||||
$value = isset ( $flags[$flag] ) ? $flags[$flag] : '';
|
||||
|
||||
if ( $hide_from_user == "yes" ) {
|
||||
|
||||
// Hidden flags cannot not be set by the user. We use hidden form
|
||||
// fields to keep them at their default values.
|
||||
if ( $type != "header" ) {
|
||||
echo hidden ( $flag, $value );
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
// Flag (iPXE compile option) should be displayed to user
|
||||
|
||||
if ( $type == "header" ) {
|
||||
|
||||
$label = $props["label"];
|
||||
echo "<td colspan=2><hr><h3>$label</h3><hr></td>";
|
||||
|
||||
} else if ($type == "on/off" ) {
|
||||
|
||||
echo "<td>", checkbox ( $flag, $value ), "</td><td><strong>$flag</strong></td>";
|
||||
|
||||
} else { // don't display checkbox for non-on/off flags
|
||||
|
||||
echo "<td> </td><td><strong>$flag: </strong>";
|
||||
|
||||
if ($type == "choice" ) {
|
||||
$options = $props["options"];
|
||||
echo menubox($flag, $options, $value);
|
||||
|
||||
} else {
|
||||
|
||||
echo textbox($flag, $value, ($type == "integer" ||
|
||||
$type == "integer-hex"
|
||||
? 7 : 25));
|
||||
}
|
||||
echo "</td>";
|
||||
}
|
||||
echo "</tr>\n";
|
||||
|
||||
if ( $type != "header" ) {
|
||||
echo "<tr><td> </td>";
|
||||
echo "<td>\n";
|
||||
if ( is_file ( "doc/$flag.html" ) ) {
|
||||
include_once "doc/$flag.html";
|
||||
}
|
||||
echo "\n</td></tr>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
echo "</table>";
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an array of configuration sections used in all compile options
|
||||
*
|
||||
* $flag_table, the global list of compile options contains a 'cfgsec'
|
||||
* property for each flag we are interested in. We return a list of
|
||||
* all the unique cfgsec options we find in $flag_table.
|
||||
*
|
||||
* @return array an array of strings representing all unique cfgsec values
|
||||
* found in $flag_table
|
||||
*/
|
||||
function get_flag_cfgsecs ()
|
||||
{
|
||||
global $flag_table;
|
||||
$cfgsecs = array ();
|
||||
|
||||
foreach ( $flag_table as $key => $props ) {
|
||||
if ( isset ( $props['cfgsec'] ) ) {
|
||||
$cfgsec = $props["cfgsec"];
|
||||
$cfgsecs[$cfgsec] = $cfgsec;
|
||||
}
|
||||
}
|
||||
return $cfgsecs;
|
||||
}
|
||||
|
||||
////
|
||||
// File and directory handling functions
|
||||
////
|
||||
|
||||
/**
|
||||
* Create a copy of a given source directory to a given destination
|
||||
*
|
||||
* Since we are going to modify the source directory, we create a copy
|
||||
* of the directory with a unique name in the given destination directory.
|
||||
* We supply a prefix for the tempnam call to prepend to the random filename
|
||||
* it generates.
|
||||
*
|
||||
* @param string $src source directory
|
||||
* @param string $dst destination directory
|
||||
* @param string $prefix string to append to directory created
|
||||
*
|
||||
* @return string absolute path to destination directory
|
||||
*/
|
||||
function mktempcopy ( $src, $dst, $prefix )
|
||||
{
|
||||
if ( $src[0] != "/" ) {
|
||||
$src = dirname ( $_SERVER['SCRIPT_FILENAME'] ) . "/" . $src;
|
||||
}
|
||||
|
||||
// Create a file in the given destination directory with a unique name
|
||||
$dir = tempnam ( $dst, $prefix );
|
||||
|
||||
// Delete the file just created, since it would interfere with the copy we
|
||||
// are about to do. We only care that the dir name we copy to is unique.
|
||||
unlink ( $dir );
|
||||
|
||||
exec ( "/bin/cp -a '$src' '$dir' 2>&1", $cpytxt, $status );
|
||||
|
||||
if ( $status != 0 ) {
|
||||
die ( "src directory copy failed!" );
|
||||
}
|
||||
return $dir;
|
||||
}
|
||||
|
||||
/**
|
||||
* Write iPXE config files based on value of given flags
|
||||
*
|
||||
* iPXE compile options are stored in src/config/*.h .
|
||||
* We write out a config file for each set of options.
|
||||
*
|
||||
* @param string $config_dir directory to write .h files to
|
||||
* @param array $flags array of compile options for this build
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function write_ipxe_config_files ( $config_dir, $flags )
|
||||
{
|
||||
global $flag_table;
|
||||
|
||||
$cfgsecs = get_flag_cfgsecs ();
|
||||
|
||||
foreach ( $cfgsecs as $cfgsec ) {
|
||||
|
||||
$fname = $config_dir . "/" . $cfgsec . ".h";
|
||||
|
||||
$fp = fopen ( $fname, "wb" );
|
||||
if ( $fp <= 0 ) {
|
||||
die ( "Unable to open $fname file for output!" );
|
||||
}
|
||||
|
||||
$ifdef_secname = "CONFIG_" . strtoupper ( $cfgsec ) . "_H";
|
||||
|
||||
fwrite ( $fp, "#ifndef ${ifdef_secname}\n" );
|
||||
fwrite ( $fp, "#define ${ifdef_secname}\n" );
|
||||
fwrite ( $fp, "#include <config/defaults.h>\n" );
|
||||
|
||||
foreach ( $flags as $key => $value ) {
|
||||
// When the flag matches this section name, write it out
|
||||
if ( $flag_table[$key]["cfgsec"] == $cfgsec ) {
|
||||
fwrite ( $fp, pprint_flag ( $key, $value ) . "\n" );
|
||||
}
|
||||
}
|
||||
fwrite ( $fp, "#endif /* ${ifdef_secname} */\n" );
|
||||
fclose ( $fp );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Output a string to a file
|
||||
*
|
||||
* Output a given string to a given pathname. The file will be created if
|
||||
* necessary, and the string will replace the file's contents in all cases.
|
||||
*
|
||||
* @param string $fname pathname of file to output string to
|
||||
* @param string $ftext text to output to file
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function write_file_from_string ( $fname, $ftext )
|
||||
{
|
||||
$fp = fopen ( $fname, "wb" );
|
||||
if ( ! $fp ) {
|
||||
die ( "Unable to open $fname file for output!" );
|
||||
}
|
||||
fwrite ( $fp, $ftext );
|
||||
fclose ( $fp );
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a file or recursively delete a directory tree
|
||||
*
|
||||
* @param string $file_or_dir_name name of file or directory to delete
|
||||
* @return bool Returns TRUE on success, FALSE on failure
|
||||
*/
|
||||
function rm_file_or_dir ( $file_or_dir_name )
|
||||
{
|
||||
if ( ! file_exists ( $file_or_dir_name ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( is_file ( $file_or_dir_name ) || is_link ( $file_or_dir_name ) ) {
|
||||
return unlink ( $file_or_dir_name );
|
||||
}
|
||||
|
||||
$dir = dir ( $file_or_dir_name );
|
||||
while ( ( $dir_entry = $dir->read () ) !== false ) {
|
||||
|
||||
if ( $dir_entry == '.' || $dir_entry == '..') {
|
||||
continue;
|
||||
}
|
||||
rm_file_or_dir ( $file_or_dir_name . '/' . $dir_entry );
|
||||
}
|
||||
$dir->close();
|
||||
|
||||
return rmdir ( $file_or_dir_name );
|
||||
}
|
||||
|
||||
////
|
||||
// Debugging functions
|
||||
////
|
||||
|
||||
/**
|
||||
* Emit html code to display given array of compile options (flags)
|
||||
*
|
||||
* @param array $flags array of compile options for this build
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function show_flags ( $flags )
|
||||
{
|
||||
echo ( "\$flags contains " . count ( $flags ) . " elements:" . "<br>" );
|
||||
|
||||
foreach ( $flags as $key => $flag ) {
|
||||
echo ( "\$flags[" . $key . "]=" . "\"$flag\"" . "<br>" );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Emit HTML code to display default array of compile options (flags)
|
||||
*
|
||||
* $flag_table contains default compile options and properties. This
|
||||
* routine outputs HTML code to display all properties of $flag_table.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function dump_flag_table ()
|
||||
{
|
||||
global $flag_table;
|
||||
|
||||
echo ( "\$flag_table contains " . count ( $flag_table ) . " elements:" . "<br>" );
|
||||
|
||||
foreach ( $flag_table as $key => $props ) {
|
||||
print ( "flag_table[" . $key . "] = " . "<br>" );
|
||||
|
||||
foreach ( $props as $key2 => $props2 ) {
|
||||
print ( " " . $key2 . " = " . $props2 . "<br>" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Parse src/bin/NIC file
|
||||
list ( $nics, $roms ) = parse_nic_file ();
|
||||
|
||||
// For emacs:
|
||||
// Local variables:
|
||||
// c-basic-offset: 4
|
||||
// c-indent-level: 4
|
||||
// tab-width: 4
|
||||
// End:
|
||||
|
||||
?>
|
|
@ -0,0 +1,6 @@
|
|||
bochsout.txt
|
||||
parport.out
|
||||
ne2k-tx.log
|
||||
ne2k-txdump.txt
|
||||
bochs
|
||||
qemu
|
|
@ -0,0 +1,7 @@
|
|||
all : serial-console.1
|
||||
|
||||
%.1 : %
|
||||
pod2man $< > $@
|
||||
|
||||
clean :
|
||||
rm -f serial-console.1
|
|
@ -0,0 +1,15 @@
|
|||
--- memory/memory.cc 18 Oct 2008 18:10:14 -0000 1.71
|
||||
+++ memory/memory.cc 21 Oct 2008 19:47:07 -0000
|
||||
@@ -172,7 +172,11 @@
|
||||
break;
|
||||
|
||||
case 0x0: // Writes to ROM, Inhibit
|
||||
- BX_DEBUG(("Write to ROM ignored: address 0x" FMT_PHY_ADDRX ", data %02x", a20addr, *data_ptr));
|
||||
+ if ((a20addr & 0xfffe0000) == 0x000e0000) {
|
||||
+ BX_DEBUG(("Write to ROM ignored: address 0x" FMT_PHY_ADDRX ", data %02x", a20addr, *data_ptr));
|
||||
+ } else {
|
||||
+ BX_MEM_THIS rom[(a20addr & EXROM_MASK) + BIOSROMSZ] = *data_ptr;
|
||||
+ }
|
||||
break;
|
||||
|
||||
default:
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,49 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
imgloop=
|
||||
tmpfile=
|
||||
tmploop=
|
||||
dmname=
|
||||
cowlink=
|
||||
|
||||
function cleanup () {
|
||||
set +e
|
||||
[ -n "$cowlink" ] && rm $cowlink
|
||||
[ -n "$dmname" ] && dmsetup remove $dmname
|
||||
[ -n "$tmploop" ] && losetup -d $tmploop
|
||||
[ -n "$tmpfile" ] && rm $tmpfile
|
||||
[ -n "$imgloop" ] && losetup -d $imgloop
|
||||
}
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
imgfile=$1 ; shift
|
||||
command=$1 ; shift
|
||||
if [ -z "$imgfile" -o -z "$command" ] ; then
|
||||
echo Syntax: $0 /path/to/image/file command [args..]
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Set up image loop device
|
||||
x=`losetup -f` ; losetup -r $x $imgfile ; imgloop=$x
|
||||
|
||||
# Create temporary file and set up temporary loop device
|
||||
tmpfile=`mktemp $imgfile.XXXXXXXXXX`
|
||||
truncate -r $imgfile $tmpfile
|
||||
x=`losetup -f` ; losetup $x $tmpfile ; tmploop=$x
|
||||
|
||||
# Create snapshot device
|
||||
imgsize=`blockdev --getsz $imgloop`
|
||||
x=`basename $imgfile` ; echo 0 $imgsize snapshot $imgloop $tmploop N 16 | \
|
||||
dmsetup create $x ; dmname=$x
|
||||
chown --reference=$imgfile /dev/mapper/$dmname
|
||||
chmod --reference=$imgfile /dev/mapper/$dmname
|
||||
|
||||
# Create symlink
|
||||
x=$imgfile.cow ; ln -s /dev/mapper/$dmname $x ; cowlink=$x
|
||||
|
||||
# Wait until killed
|
||||
echo "Created $cowlink"
|
||||
$command "$@" $cowlink
|
|
@ -0,0 +1,278 @@
|
|||
#!/usr/bin/perl -w
|
||||
|
||||
=head1 NAME
|
||||
|
||||
serial-console
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
serial-console [options]
|
||||
|
||||
Options:
|
||||
|
||||
-h,--help Display brief help message
|
||||
-v,--verbose Increase verbosity
|
||||
-q,--quiet Decrease verbosity
|
||||
-l,--log FILE Log output to file
|
||||
-r,--rcfile FILE Modify specified bochsrc file
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
C<serial-console> provides a virtual serial console for use with
|
||||
Bochs. Running C<serial-console> creates a pseudo-tty. The master
|
||||
side of this pty is made available to the user for interaction; the
|
||||
slave device is written to the Bochs configuration file
|
||||
(C<bochsrc.txt>) for use by a subsequent Bochs session.
|
||||
|
||||
=head1 EXAMPLES
|
||||
|
||||
=over 4
|
||||
|
||||
=item C<serial-console>
|
||||
|
||||
Create a virtual serial console for Bochs, modify C<bochsrc.txt>
|
||||
appropriately.
|
||||
|
||||
=item C<serial-console -r ../.bochsrc -l serial.log>
|
||||
|
||||
Create a virtual serial console for Bochs, modify C<../.bochsrc>
|
||||
appropriately, log output to C<serial.log>.
|
||||
|
||||
=back
|
||||
|
||||
=head1 INVOCATION
|
||||
|
||||
Before starting Bochs, run C<serial-console> in a different session
|
||||
(e.g. a different xterm window). When you subsequently start Bochs,
|
||||
anything that the emulated machine writes to its serial port will
|
||||
appear in the window running C<serial-console>, and anything typed in
|
||||
the C<serial-console> window will arrive on the emulated machine's
|
||||
serial port.
|
||||
|
||||
You do B<not> need to rerun C<serial-console> afresh for each Bochs
|
||||
session.
|
||||
|
||||
=head1 OPTIONS
|
||||
|
||||
=over 4
|
||||
|
||||
=item B<-l,--log FILE>
|
||||
|
||||
Log all output (i.e. everything that is printed in the
|
||||
C<serial-console> window) to the specified file.
|
||||
|
||||
=item B<-r,--rcfile FILE>
|
||||
|
||||
Modify the specified bochsrc file. The file will be updated to
|
||||
contain the path to the slave side of the psuedo tty that we create.
|
||||
The original file will be restored when C<serial-console> exits. The
|
||||
default is to modify the file C<bochsrc.txt> in the current directory.
|
||||
|
||||
To avoid modifying any bochsrc file, use C<--norcfile>.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
||||
use IO::Pty;
|
||||
use IO::Select;
|
||||
use File::Spec::Functions qw ( :ALL );
|
||||
use Getopt::Long;
|
||||
use Pod::Usage;
|
||||
use POSIX qw ( :termios_h );
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my $o;
|
||||
my $restore_file = {};
|
||||
my $restore_termios;
|
||||
use constant BLOCKSIZE => 8192;
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Parse command line options into options hash ($o)
|
||||
#
|
||||
# $o = parse_opts();
|
||||
|
||||
sub parse_opts {
|
||||
# $o is the hash that will hold the options
|
||||
my $o = {
|
||||
verbosity => 1,
|
||||
rcfile => 'bochsrc.txt',
|
||||
};
|
||||
# Special handlers for some options
|
||||
my $opt_handlers = {
|
||||
verbose => sub { $o->{verbosity}++; },
|
||||
quiet => sub { $o->{verbosity}--; },
|
||||
help => sub { pod2usage(1); },
|
||||
norcfile => sub { delete $o->{rcfile}; },
|
||||
};
|
||||
# Merge handlers into main options hash (so that Getopt::Long can find them)
|
||||
$o->{$_} = $opt_handlers->{$_} foreach keys %$opt_handlers;
|
||||
# Option specifiers for Getopt::Long
|
||||
my @optspec = ( 'help|h|?',
|
||||
'quiet|q+',
|
||||
'verbose|v+',
|
||||
'log|l=s',
|
||||
'rcfile|r=s',
|
||||
'norcfile',
|
||||
);
|
||||
# Do option parsing
|
||||
Getopt::Long::Configure ( 'bundling' );
|
||||
pod2usage("Error parsing command-line options") unless GetOptions (
|
||||
$o, @optspec );
|
||||
# Clean up $o by removing the handlers
|
||||
delete $o->{$_} foreach keys %$opt_handlers;
|
||||
return $o;
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Modify bochsrc file
|
||||
|
||||
sub patch_bochsrc {
|
||||
my $active = shift;
|
||||
my $pty = shift;
|
||||
|
||||
# Rename active file to backup file
|
||||
( my $vol, my $dir, my $file ) = splitpath ( $active );
|
||||
$file = '.'.$file.".serial-console";
|
||||
my $backup = catpath ( $vol, $dir, $file );
|
||||
rename $active, $backup
|
||||
or die "Could not back up $active to $backup: $!\n";
|
||||
|
||||
# Derive line to be inserted
|
||||
my $patch = "com1: enabled=1, mode=term, dev=$pty\n";
|
||||
|
||||
# Modify file
|
||||
open my $old, "<$backup" or die "Could not open $backup: $!\n";
|
||||
open my $new, ">$active" or die "Could not open $active: $!\n";
|
||||
print $new <<"EOF";
|
||||
##################################################
|
||||
#
|
||||
# This file has been modified by serial-console.
|
||||
#
|
||||
# Do not modify this file; it will be erased when
|
||||
# serial-console (pid $$) exits and will be
|
||||
# replaced with the backup copy held in
|
||||
# $backup.
|
||||
#
|
||||
##################################################
|
||||
|
||||
|
||||
EOF
|
||||
my $patched;
|
||||
while ( my $line = <$old> ) {
|
||||
if ( $line =~ /^\s*\#?\s*com1:\s*\S/ ) {
|
||||
if ( ! $patched ) {
|
||||
$line = $patch;
|
||||
$patched = 1;
|
||||
} else {
|
||||
$line = '# '.$line unless $line =~ /^\s*\#/;
|
||||
}
|
||||
}
|
||||
print $new $line;
|
||||
}
|
||||
print $new $patch unless $patched;
|
||||
close $old;
|
||||
close $new;
|
||||
|
||||
return $backup;
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Attach/detach message printing and terminal settings
|
||||
|
||||
sub bochs_attached {
|
||||
print STDERR "Bochs attached.\n\n\n"
|
||||
if $o->{verbosity} >= 1;
|
||||
}
|
||||
|
||||
sub bochs_detached {
|
||||
print STDERR "\n\nWaiting for bochs to attach...\n"
|
||||
if $o->{verbosity} >= 1;
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Main program
|
||||
|
||||
$o = parse_opts();
|
||||
pod2usage(1) if @ARGV;
|
||||
|
||||
# Catch signals
|
||||
my $sigdie = sub { die "Exiting via signal\n"; };
|
||||
$SIG{INT} = $sigdie;
|
||||
|
||||
# Create Pty, close slave side
|
||||
my $pty = IO::Pty->new();
|
||||
$pty->close_slave();
|
||||
$pty->set_raw();
|
||||
print STDERR "Slave pty is ".$pty->ttyname."\n" if $o->{verbosity} >= 1;
|
||||
|
||||
# Open logfile
|
||||
my $log;
|
||||
if ( $o->{log} ) {
|
||||
open $log, ">$o->{log}" or die "Could not open $o->{log}: $!\n";
|
||||
}
|
||||
|
||||
# Set up terminal
|
||||
my $termios;
|
||||
if ( -t STDIN ) {
|
||||
$termios = POSIX::Termios->new;
|
||||
$restore_termios = POSIX::Termios->new;
|
||||
$termios->getattr ( fileno(STDIN) );
|
||||
$restore_termios->getattr ( fileno(STDIN) );
|
||||
$termios->setlflag ( $termios->getlflag & ~(ICANON) & ~(ECHO) );
|
||||
$termios->setiflag ( $termios->getiflag & ~(ICRNL) );
|
||||
$termios->setattr ( fileno(STDIN), TCSANOW );
|
||||
}
|
||||
|
||||
# Modify bochsrc file
|
||||
$restore_file = { $o->{rcfile} =>
|
||||
patch_bochsrc ( $o->{rcfile}, $pty->ttyname ) }
|
||||
if $o->{rcfile};
|
||||
|
||||
# Start character shunt
|
||||
my $attached = 1;
|
||||
my $select = IO::Select->new ( \*STDIN, $pty );
|
||||
while ( 1 ) {
|
||||
my %can_read = map { $_ => 1 }
|
||||
$select->can_read ( $attached ? undef : 1 );
|
||||
if ( $can_read{\*STDIN} ) {
|
||||
sysread ( STDIN, my $data, BLOCKSIZE )
|
||||
or die "Cannot read from STDIN: $!\n";
|
||||
$pty->syswrite ( $data );
|
||||
}
|
||||
if ( $can_read{$pty} ) {
|
||||
if ( $pty->sysread ( my $data, BLOCKSIZE ) ) {
|
||||
# Actual data available
|
||||
bochs_attached() if $attached == 0;
|
||||
$attached = 1;
|
||||
syswrite ( STDOUT, $data );
|
||||
$log->syswrite ( $data ) if $log;
|
||||
} else {
|
||||
# No data available but select() says we can read. This almost
|
||||
# certainly indicates that nothing is attached to the slave.
|
||||
bochs_detached() if $attached == 1;
|
||||
$attached = 0;
|
||||
sleep ( 1 );
|
||||
}
|
||||
} else {
|
||||
bochs_attached() if $attached == 0;
|
||||
$attached = 1;
|
||||
}
|
||||
}
|
||||
|
||||
END {
|
||||
# Restore bochsrc file if applicable
|
||||
if ( ( my $orig_file, my $backup_file ) = %$restore_file ) {
|
||||
unlink $orig_file;
|
||||
rename $backup_file, $orig_file;
|
||||
}
|
||||
# Restore terminal settings if applicable
|
||||
if ( $restore_termios ) {
|
||||
$restore_termios->setattr ( fileno(STDIN), TCSANOW );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,190 @@
|
|||
.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
|
||||
.\"
|
||||
.\" Standard preamble:
|
||||
.\" ========================================================================
|
||||
.de Sp \" Vertical space (when we can't use .PP)
|
||||
.if t .sp .5v
|
||||
.if n .sp
|
||||
..
|
||||
.de Vb \" Begin verbatim text
|
||||
.ft CW
|
||||
.nf
|
||||
.ne \\$1
|
||||
..
|
||||
.de Ve \" End verbatim text
|
||||
.ft R
|
||||
.fi
|
||||
..
|
||||
.\" Set up some character translations and predefined strings. \*(-- will
|
||||
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
|
||||
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
|
||||
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
|
||||
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
|
||||
.\" nothing in troff, for use with C<>.
|
||||
.tr \(*W-
|
||||
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
|
||||
.ie n \{\
|
||||
. ds -- \(*W-
|
||||
. ds PI pi
|
||||
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
|
||||
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
|
||||
. ds L" ""
|
||||
. ds R" ""
|
||||
. ds C` ""
|
||||
. ds C' ""
|
||||
'br\}
|
||||
.el\{\
|
||||
. ds -- \|\(em\|
|
||||
. ds PI \(*p
|
||||
. ds L" ``
|
||||
. ds R" ''
|
||||
'br\}
|
||||
.\"
|
||||
.\" Escape single quotes in literal strings from groff's Unicode transform.
|
||||
.ie \n(.g .ds Aq \(aq
|
||||
.el .ds Aq '
|
||||
.\"
|
||||
.\" If the F register is turned on, we'll generate index entries on stderr for
|
||||
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
|
||||
.\" entries marked with X<> in POD. Of course, you'll have to process the
|
||||
.\" output yourself in some meaningful fashion.
|
||||
.ie \nF \{\
|
||||
. de IX
|
||||
. tm Index:\\$1\t\\n%\t"\\$2"
|
||||
..
|
||||
. nr % 0
|
||||
. rr F
|
||||
.\}
|
||||
.el \{\
|
||||
. de IX
|
||||
..
|
||||
.\}
|
||||
.\"
|
||||
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
|
||||
.\" Fear. Run. Save yourself. No user-serviceable parts.
|
||||
. \" fudge factors for nroff and troff
|
||||
.if n \{\
|
||||
. ds #H 0
|
||||
. ds #V .8m
|
||||
. ds #F .3m
|
||||
. ds #[ \f1
|
||||
. ds #] \fP
|
||||
.\}
|
||||
.if t \{\
|
||||
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
|
||||
. ds #V .6m
|
||||
. ds #F 0
|
||||
. ds #[ \&
|
||||
. ds #] \&
|
||||
.\}
|
||||
. \" simple accents for nroff and troff
|
||||
.if n \{\
|
||||
. ds ' \&
|
||||
. ds ` \&
|
||||
. ds ^ \&
|
||||
. ds , \&
|
||||
. ds ~ ~
|
||||
. ds /
|
||||
.\}
|
||||
.if t \{\
|
||||
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
|
||||
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
|
||||
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
|
||||
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
|
||||
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
|
||||
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
|
||||
.\}
|
||||
. \" troff and (daisy-wheel) nroff accents
|
||||
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
|
||||
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
|
||||
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
|
||||
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
|
||||
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
|
||||
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
|
||||
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
|
||||
.ds ae a\h'-(\w'a'u*4/10)'e
|
||||
.ds Ae A\h'-(\w'A'u*4/10)'E
|
||||
. \" corrections for vroff
|
||||
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
|
||||
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
|
||||
. \" for low resolution devices (crt and lpr)
|
||||
.if \n(.H>23 .if \n(.V>19 \
|
||||
\{\
|
||||
. ds : e
|
||||
. ds 8 ss
|
||||
. ds o a
|
||||
. ds d- d\h'-1'\(ga
|
||||
. ds D- D\h'-1'\(hy
|
||||
. ds th \o'bp'
|
||||
. ds Th \o'LP'
|
||||
. ds ae ae
|
||||
. ds Ae AE
|
||||
.\}
|
||||
.rm #[ #] #H #V #F C
|
||||
.\" ========================================================================
|
||||
.\"
|
||||
.IX Title "SERIAL-CONSOLE 1"
|
||||
.TH SERIAL-CONSOLE 1 "2010-09-22" "perl v5.10.1" "User Contributed Perl Documentation"
|
||||
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
|
||||
.\" way too many mistakes in technical documents.
|
||||
.if n .ad l
|
||||
.nh
|
||||
.SH "NAME"
|
||||
serial\-console
|
||||
.SH "SYNOPSIS"
|
||||
.IX Header "SYNOPSIS"
|
||||
serial-console [options]
|
||||
.PP
|
||||
Options:
|
||||
.PP
|
||||
.Vb 5
|
||||
\& \-h,\-\-help Display brief help message
|
||||
\& \-v,\-\-verbose Increase verbosity
|
||||
\& \-q,\-\-quiet Decrease verbosity
|
||||
\& \-l,\-\-log FILE Log output to file
|
||||
\& \-r,\-\-rcfile FILE Modify specified bochsrc file
|
||||
.Ve
|
||||
.SH "DESCRIPTION"
|
||||
.IX Header "DESCRIPTION"
|
||||
\&\f(CW\*(C`serial\-console\*(C'\fR provides a virtual serial console for use with
|
||||
Bochs. Running \f(CW\*(C`serial\-console\*(C'\fR creates a pseudo-tty. The master
|
||||
side of this pty is made available to the user for interaction; the
|
||||
slave device is written to the Bochs configuration file
|
||||
(\f(CW\*(C`bochsrc.txt\*(C'\fR) for use by a subsequent Bochs session.
|
||||
.SH "EXAMPLES"
|
||||
.IX Header "EXAMPLES"
|
||||
.ie n .IP """serial\-console""" 4
|
||||
.el .IP "\f(CWserial\-console\fR" 4
|
||||
.IX Item "serial-console"
|
||||
Create a virtual serial console for Bochs, modify \f(CW\*(C`bochsrc.txt\*(C'\fR
|
||||
appropriately.
|
||||
.ie n .IP """serial\-console \-r ../.bochsrc \-l serial.log""" 4
|
||||
.el .IP "\f(CWserial\-console \-r ../.bochsrc \-l serial.log\fR" 4
|
||||
.IX Item "serial-console -r ../.bochsrc -l serial.log"
|
||||
Create a virtual serial console for Bochs, modify \f(CW\*(C`../.bochsrc\*(C'\fR
|
||||
appropriately, log output to \f(CW\*(C`serial.log\*(C'\fR.
|
||||
.SH "INVOCATION"
|
||||
.IX Header "INVOCATION"
|
||||
Before starting Bochs, run \f(CW\*(C`serial\-console\*(C'\fR in a different session
|
||||
(e.g. a different xterm window). When you subsequently start Bochs,
|
||||
anything that the emulated machine writes to its serial port will
|
||||
appear in the window running \f(CW\*(C`serial\-console\*(C'\fR, and anything typed in
|
||||
the \f(CW\*(C`serial\-console\*(C'\fR window will arrive on the emulated machine's
|
||||
serial port.
|
||||
.PP
|
||||
You do \fBnot\fR need to rerun \f(CW\*(C`serial\-console\*(C'\fR afresh for each Bochs
|
||||
session.
|
||||
.SH "OPTIONS"
|
||||
.IX Header "OPTIONS"
|
||||
.IP "\fB\-l,\-\-log \s-1FILE\s0\fR" 4
|
||||
.IX Item "-l,--log FILE"
|
||||
Log all output (i.e. everything that is printed in the
|
||||
\&\f(CW\*(C`serial\-console\*(C'\fR window) to the specified file.
|
||||
.IP "\fB\-r,\-\-rcfile \s-1FILE\s0\fR" 4
|
||||
.IX Item "-r,--rcfile FILE"
|
||||
Modify the specified bochsrc file. The file will be updated to
|
||||
contain the path to the slave side of the psuedo tty that we create.
|
||||
The original file will be restored when \f(CW\*(C`serial\-console\*(C'\fR exits. The
|
||||
default is to modify the file \f(CW\*(C`bochsrc.txt\*(C'\fR in the current directory.
|
||||
.Sp
|
||||
To avoid modifying any bochsrc file, use \f(CW\*(C`\-\-norcfile\*(C'\fR.
|
|
@ -0,0 +1,4 @@
|
|||
.toolcheck
|
||||
.echocheck
|
||||
TAGS*
|
||||
bin*
|
|
@ -0,0 +1,229 @@
|
|||
###############################################################################
|
||||
#
|
||||
# Initialise various variables
|
||||
#
|
||||
|
||||
CLEANUP :=
|
||||
CFLAGS :=
|
||||
ASFLAGS :=
|
||||
LDFLAGS :=
|
||||
HOST_CFLAGS :=
|
||||
MAKEDEPS := Makefile
|
||||
CROSS_COMPILE ?= $(CROSS)
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# Locations of tools
|
||||
#
|
||||
HOST_CC := gcc
|
||||
RM := rm -f
|
||||
TOUCH := touch
|
||||
MKDIR := mkdir
|
||||
CP := cp
|
||||
ECHO := echo
|
||||
PRINTF := printf
|
||||
PERL := perl
|
||||
TRUE := true
|
||||
CC := $(CROSS_COMPILE)gcc
|
||||
CPP := $(CC) -E
|
||||
AS := $(CROSS_COMPILE)as
|
||||
LD := $(CROSS_COMPILE)ld
|
||||
SIZE := $(CROSS_COMPILE)size
|
||||
AR := $(CROSS_COMPILE)ar
|
||||
RANLIB := $(CROSS_COMPILE)ranlib
|
||||
OBJCOPY := $(CROSS_COMPILE)objcopy
|
||||
NM := $(CROSS_COMPILE)nm
|
||||
OBJDUMP := $(CROSS_COMPILE)objdump
|
||||
OPENSSL := openssl
|
||||
CSPLIT := csplit
|
||||
PARSEROM := ./util/parserom.pl
|
||||
FIXROM := ./util/fixrom.pl
|
||||
SYMCHECK := ./util/symcheck.pl
|
||||
SORTOBJDUMP := ./util/sortobjdump.pl
|
||||
PADIMG := ./util/padimg.pl
|
||||
LICENCE := ./util/licence.pl
|
||||
NRV2B := ./util/nrv2b
|
||||
ZBIN := ./util/zbin
|
||||
ELF2EFI32 := ./util/elf2efi32
|
||||
ELF2EFI64 := ./util/elf2efi64
|
||||
EFIROM := ./util/efirom
|
||||
EFIFATBIN := ./util/efifatbin
|
||||
ICCFIX := ./util/iccfix
|
||||
EINFO := ./util/einfo
|
||||
GENKEYMAP := ./util/genkeymap.pl
|
||||
DOXYGEN := doxygen
|
||||
LCAB := lcab
|
||||
QEMUIMG := qemu-img
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# SRCDIRS lists all directories containing source files.
|
||||
#
|
||||
SRCDIRS :=
|
||||
SRCDIRS += libgcc
|
||||
SRCDIRS += core
|
||||
SRCDIRS += net net/tcp net/udp net/infiniband
|
||||
SRCDIRS += image
|
||||
SRCDIRS += drivers/bus
|
||||
SRCDIRS += drivers/net
|
||||
SRCDIRS += drivers/net/e1000
|
||||
SRCDIRS += drivers/net/e1000e
|
||||
SRCDIRS += drivers/net/igb
|
||||
SRCDIRS += drivers/net/igbvf
|
||||
SRCDIRS += drivers/net/phantom
|
||||
SRCDIRS += drivers/net/vxge
|
||||
SRCDIRS += drivers/net/efi
|
||||
SRCDIRS += drivers/net/tg3
|
||||
SRCDIRS += drivers/net/sfc
|
||||
SRCDIRS += drivers/block
|
||||
SRCDIRS += drivers/nvs
|
||||
SRCDIRS += drivers/bitbash
|
||||
SRCDIRS += drivers/infiniband
|
||||
SRCDIRS += drivers/infiniband/mlx_utils_flexboot/src
|
||||
SRCDIRS += drivers/infiniband/mlx_utils/src/public
|
||||
SRCDIRS += drivers/infiniband/mlx_utils/mlx_lib/mlx_reg_access
|
||||
SRCDIRS += drivers/infiniband/mlx_utils/mlx_lib/mlx_nvconfig
|
||||
SRCDIRS += drivers/infiniband/mlx_utils/mlx_lib/mlx_vmac
|
||||
SRCDIRS += drivers/infiniband/mlx_utils/mlx_lib/mlx_blink_leds
|
||||
SRCDIRS += drivers/infiniband/mlx_utils/mlx_lib/mlx_link_speed
|
||||
SRCDIRS += drivers/infiniband/mlx_utils/mlx_lib/mlx_mtu
|
||||
SRCDIRS += drivers/infiniband/mlx_nodnic/src
|
||||
SRCDIRS += drivers/usb
|
||||
SRCDIRS += interface/pxe interface/efi interface/smbios
|
||||
SRCDIRS += interface/bofm
|
||||
SRCDIRS += interface/xen
|
||||
SRCDIRS += interface/hyperv
|
||||
SRCDIRS += tests
|
||||
SRCDIRS += crypto crypto/mishmash
|
||||
SRCDIRS += hci hci/commands hci/tui
|
||||
SRCDIRS += hci/mucurses hci/mucurses/widgets
|
||||
SRCDIRS += hci/keymap
|
||||
SRCDIRS += usr
|
||||
SRCDIRS += config
|
||||
|
||||
# These directories contain code that is not eligible for UEFI Secure
|
||||
# Boot signing.
|
||||
#
|
||||
SRCDIRS_INSEC += net/oncrpc
|
||||
SRCDIRS_INSEC += net/80211
|
||||
SRCDIRS_INSEC += drivers/net/rtl818x
|
||||
SRCDIRS_INSEC += drivers/net/ath
|
||||
SRCDIRS_INSEC += drivers/net/ath/ath5k
|
||||
SRCDIRS_INSEC += drivers/net/ath/ath9k
|
||||
|
||||
# NON_AUTO_SRCS lists files that are excluded from the normal
|
||||
# automatic build system.
|
||||
#
|
||||
NON_AUTO_SRCS :=
|
||||
NON_AUTO_SRCS += core/version.c
|
||||
NON_AUTO_SRCS += drivers/net/prism2.c
|
||||
|
||||
# INCDIRS lists the include path
|
||||
#
|
||||
INCDIRS :=
|
||||
INCDIRS += include .
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# Default build target: build the most common targets and print out a
|
||||
# helpfully suggestive message
|
||||
#
|
||||
ALL := bin/blib.a bin/ipxe.dsk bin/ipxe.lkrn bin/ipxe.iso \
|
||||
bin/ipxe.usb bin/ipxe.pxe bin/undionly.kpxe bin/rtl8139.rom \
|
||||
bin/8086100e.mrom bin/80861209.rom bin/10500940.rom \
|
||||
bin/10222000.rom bin/10ec8139.rom bin/1af41000.rom \
|
||||
bin/8086100f.mrom bin/808610d3.mrom bin/15ad07b0.rom
|
||||
|
||||
all : $(ALL)
|
||||
@$(ECHO) '==========================================================='
|
||||
@$(ECHO)
|
||||
@$(ECHO) 'To create a bootable floppy, type'
|
||||
@$(ECHO) ' cat bin/ipxe.dsk > /dev/fd0'
|
||||
@$(ECHO) 'where /dev/fd0 is your floppy drive. This will erase any'
|
||||
@$(ECHO) 'data already on the disk.'
|
||||
@$(ECHO)
|
||||
@$(ECHO) 'To create a bootable USB key, type'
|
||||
@$(ECHO) ' cat bin/ipxe.usb > /dev/sdX'
|
||||
@$(ECHO) 'where /dev/sdX is your USB key, and is *not* a real hard'
|
||||
@$(ECHO) 'disk on your system. This will erase any data already on'
|
||||
@$(ECHO) 'the USB key.'
|
||||
@$(ECHO)
|
||||
@$(ECHO) 'To create a bootable CD-ROM, burn the ISO image '
|
||||
@$(ECHO) 'bin/ipxe.iso to a blank CD-ROM.'
|
||||
@$(ECHO)
|
||||
@$(ECHO) 'These images contain drivers for all supported cards. You'
|
||||
@$(ECHO) 'can build more customised images, and ROM images, using'
|
||||
@$(ECHO) ' make bin/<rom-name>.<output-format>'
|
||||
@$(ECHO)
|
||||
@$(ECHO) '==========================================================='
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# Comprehensive build target: build a selection of cross-platform
|
||||
# targets to expose potential build errors that show up only on
|
||||
# certain platforms
|
||||
#
|
||||
everything :
|
||||
$(Q)$(MAKE) --no-print-directory $(ALL) \
|
||||
bin/3c509.rom bin/intel.rom bin/intel.mrom \
|
||||
bin-x86_64-pcbios/8086100e.mrom bin-x86_64-pcbios/intel.rom \
|
||||
bin-x86_64-pcbios/ipxe.usb bin-x86_64-pcbios/ipxe.pxe \
|
||||
bin-x86_64-pcbios/undionly.kpxe \
|
||||
bin-i386-efi/ipxe.efi bin-i386-efi/ipxe.efidrv \
|
||||
bin-i386-efi/ipxe.efirom \
|
||||
bin-x86_64-efi/ipxe.efi bin-x86_64-efi/ipxe.efidrv \
|
||||
bin-x86_64-efi/ipxe.efirom \
|
||||
bin-i386-linux/tap.linux bin-x86_64-linux/tap.linux \
|
||||
bin-i386-linux/tests.linux bin-x86_64-linux/tests.linux
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# VMware build target: all ROMs used with VMware
|
||||
#
|
||||
vmware : bin/8086100f.mrom bin/808610d3.mrom bin/10222000.rom bin/15ad07b0.rom
|
||||
@$(ECHO) '==========================================================='
|
||||
@$(ECHO)
|
||||
@$(ECHO) 'Available ROMs:'
|
||||
@$(ECHO) ' bin/8086100f.mrom -- intel/e1000'
|
||||
@$(ECHO) ' bin/808610d3.mrom -- intel/e1000e'
|
||||
@$(ECHO) ' bin/10222000.rom -- vlance/pcnet32'
|
||||
@$(ECHO) ' bin/15ad07b0.rom -- vmxnet3'
|
||||
@$(ECHO)
|
||||
@$(ECHO) 'For more information, see http://ipxe.org/howto/vmware'
|
||||
@$(ECHO)
|
||||
@$(ECHO) '==========================================================='
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# Build targets that do nothing but might be tried by users
|
||||
#
|
||||
configure :
|
||||
@$(ECHO) "No configuration needed."
|
||||
|
||||
install :
|
||||
@$(ECHO) "No installation required."
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# Version number calculations
|
||||
#
|
||||
VERSION_MAJOR = 1
|
||||
VERSION_MINOR = 0
|
||||
VERSION_PATCH = 0
|
||||
EXTRAVERSION = +
|
||||
MM_VERSION = $(VERSION_MAJOR).$(VERSION_MINOR)
|
||||
VERSION = $(MM_VERSION).$(VERSION_PATCH)$(EXTRAVERSION)
|
||||
ifneq ($(wildcard ../.git),)
|
||||
GITVERSION := $(shell git describe --always --abbrev=1 --match "" 2>/dev/null)
|
||||
VERSION += ($(GITVERSION))
|
||||
endif
|
||||
version :
|
||||
@$(ECHO) "$(VERSION)"
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# Drag in the bulk of the build system
|
||||
#
|
||||
|
||||
MAKEDEPS += Makefile.housekeeping
|
||||
include Makefile.housekeeping
|
|
@ -0,0 +1,46 @@
|
|||
# -*- makefile -*- : Force emacs to use Makefile mode
|
||||
|
||||
# The EFI linker script
|
||||
#
|
||||
LDSCRIPT = scripts/efi.lds
|
||||
|
||||
# Retain relocation information for elf2efi
|
||||
#
|
||||
LDFLAGS += -q -S
|
||||
|
||||
# Media types.
|
||||
#
|
||||
NON_AUTO_MEDIA += efi
|
||||
NON_AUTO_MEDIA += efidrv
|
||||
NON_AUTO_MEDIA += drv.efi
|
||||
NON_AUTO_MEDIA += efirom
|
||||
|
||||
# Include SNP driver in the all-drivers build
|
||||
#
|
||||
DRIVERS_net += snp
|
||||
|
||||
# Rules for building EFI files
|
||||
#
|
||||
$(BIN)/%.efi : $(BIN)/%.efi.tmp $(ELF2EFI)
|
||||
$(QM)$(ECHO) " [FINISH] $@"
|
||||
$(Q)$(ELF2EFI) --subsystem=10 $< $@
|
||||
|
||||
$(BIN)/%.efidrv : $(BIN)/%.efidrv.tmp $(ELF2EFI)
|
||||
$(QM)$(ECHO) " [FINISH] $@"
|
||||
$(Q)$(ELF2EFI) --subsystem=11 $< $@
|
||||
|
||||
$(BIN)/%.drv.efi : $(BIN)/%.efidrv
|
||||
$(QM)$(ECHO) " [FINISH] $@"
|
||||
$(Q)$(CP) $< $@
|
||||
|
||||
$(BIN)/%.efirom : $(BIN)/%.efidrv $(EFIROM)
|
||||
$(QM)$(ECHO) " [FINISH] $@"
|
||||
$(Q)$(EFIROM) -v $(TGT_PCI_VENDOR) -d $(TGT_PCI_DEVICE) $< $@
|
||||
|
||||
$(BIN)/efidrv.cab : $(BIN)/alldrv.efis # $(ALL_drv.efi) is not yet defined
|
||||
$(QM)$(ECHO) " [CAB] $@"
|
||||
$(Q)$(LCAB) -n -q $(ALL_drv.efi) $@
|
||||
|
||||
$(BIN)/%.usb : $(BIN)/%.efi
|
||||
$(QM)$(ECHO) " [GENEFIDSK] $@"
|
||||
$(Q)bash util/genefidsk -o $@ -b $(EFI_BOOT_FILE) $<
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,12 @@
|
|||
# Assembler section type character
|
||||
#
|
||||
ASM_TCHAR := %
|
||||
ASM_TCHAR_OPS := %%
|
||||
|
||||
# Include common ARM headers
|
||||
#
|
||||
INCDIRS += arch/arm/include
|
||||
|
||||
# ARM-specific directories containing source files
|
||||
#
|
||||
SRCDIRS += arch/arm/interface/efi
|
|
@ -0,0 +1,6 @@
|
|||
# -*- makefile -*- : Force emacs to use Makefile mode
|
||||
|
||||
# Include generic EFI Makefile
|
||||
#
|
||||
MAKEDEPS += Makefile.efi
|
||||
include Makefile.efi
|
|
@ -0,0 +1,93 @@
|
|||
/*
|
||||
* Copyright (C) 2016 Michael Brown <mbrown@fensystems.co.uk>.
|
||||
*
|
||||
* 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 of the
|
||||
* License, or any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301, USA.
|
||||
*
|
||||
* You can also choose to distribute this program under the terms of
|
||||
* the Unmodified Binary Distribution Licence (as given in the file
|
||||
* COPYING.UBDL), provided that you have satisfied its requirements.
|
||||
*/
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
#include <ipxe/io.h>
|
||||
#include <ipxe/arm_io.h>
|
||||
|
||||
/** @file
|
||||
*
|
||||
* iPXE I/O API for ARM
|
||||
*
|
||||
*/
|
||||
|
||||
/** An ARM I/O qword */
|
||||
union arm32_io_qword {
|
||||
uint64_t qword;
|
||||
uint32_t dword[2];
|
||||
};
|
||||
|
||||
/**
|
||||
* Read 64-bit qword from memory-mapped device
|
||||
*
|
||||
* @v io_addr I/O address
|
||||
* @ret data Value read
|
||||
*
|
||||
* This is not atomic for ARM32.
|
||||
*/
|
||||
static uint64_t arm32_readq ( volatile uint64_t *io_addr ) {
|
||||
volatile union arm32_io_qword *ptr =
|
||||
container_of ( io_addr, union arm32_io_qword, qword );
|
||||
union arm32_io_qword tmp;
|
||||
|
||||
tmp.dword[0] = readl ( &ptr->dword[0] );
|
||||
tmp.dword[1] = readl ( &ptr->dword[1] );
|
||||
return tmp.qword;
|
||||
}
|
||||
|
||||
/**
|
||||
* Write 64-bit qword to memory-mapped device
|
||||
*
|
||||
* @v data Value to write
|
||||
* @v io_addr I/O address
|
||||
*
|
||||
* This is not atomic for ARM32.
|
||||
*/
|
||||
static void arm32_writeq ( uint64_t data, volatile uint64_t *io_addr ) {
|
||||
volatile union arm32_io_qword *ptr =
|
||||
container_of ( io_addr, union arm32_io_qword, qword );
|
||||
union arm32_io_qword tmp;
|
||||
|
||||
tmp.qword = data;
|
||||
writel ( tmp.dword[0], &ptr->dword[0] );
|
||||
writel ( tmp.dword[1], &ptr->dword[1] );
|
||||
}
|
||||
|
||||
PROVIDE_IOAPI_INLINE ( arm, phys_to_bus );
|
||||
PROVIDE_IOAPI_INLINE ( arm, bus_to_phys );
|
||||
PROVIDE_IOAPI_INLINE ( arm, readb );
|
||||
PROVIDE_IOAPI_INLINE ( arm, readw );
|
||||
PROVIDE_IOAPI_INLINE ( arm, readl );
|
||||
PROVIDE_IOAPI_INLINE ( arm, writeb );
|
||||
PROVIDE_IOAPI_INLINE ( arm, writew );
|
||||
PROVIDE_IOAPI_INLINE ( arm, writel );
|
||||
PROVIDE_IOAPI_INLINE ( arm, iodelay );
|
||||
PROVIDE_IOAPI_INLINE ( arm, mb );
|
||||
#ifdef __aarch64__
|
||||
PROVIDE_IOAPI_INLINE ( arm, readq );
|
||||
PROVIDE_IOAPI_INLINE ( arm, writeq );
|
||||
#else
|
||||
PROVIDE_IOAPI ( arm, readq, arm32_readq );
|
||||
PROVIDE_IOAPI ( arm, writeq, arm32_writeq );
|
||||
#endif
|
|
@ -0,0 +1,12 @@
|
|||
#ifndef _BITS_ACPI_H
|
||||
#define _BITS_ACPI_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* ARM-specific ACPI API implementations
|
||||
*
|
||||
*/
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
#endif /* _BITS_ACPI_H */
|
|
@ -0,0 +1,13 @@
|
|||
#ifndef _BITS_ENDIAN_H
|
||||
#define _BITS_ENDIAN_H
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
/* ARM may be either little-endian or big-endian */
|
||||
#ifdef __ARM_BIG_ENDIAN
|
||||
#define __BYTE_ORDER __BIG_ENDIAN
|
||||
#else
|
||||
#define __BYTE_ORDER __LITTLE_ENDIAN
|
||||
#endif
|
||||
|
||||
#endif /* _BITS_ENDIAN_H */
|
|
@ -0,0 +1,12 @@
|
|||
#ifndef _BITS_ENTROPY_H
|
||||
#define _BITS_ENTROPY_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* ARM-specific entropy API implementations
|
||||
*
|
||||
*/
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
#endif /* _BITS_ENTROPY_H */
|
|
@ -0,0 +1,19 @@
|
|||
#ifndef _BITS_ERRFILE_H
|
||||
#define _BITS_ERRFILE_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* ARM-specific error file identifiers
|
||||
*
|
||||
*/
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
/**
|
||||
* @addtogroup errfile Error file identifiers
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @} */
|
||||
|
||||
#endif /* _BITS_ERRFILE_H */
|
|
@ -0,0 +1,12 @@
|
|||
#ifndef _BITS_HYPERV_H
|
||||
#define _BITS_HYPERV_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* Hyper-V interface
|
||||
*
|
||||
*/
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
#endif /* _BITS_HYPERV_H */
|
|
@ -0,0 +1,14 @@
|
|||
#ifndef _BITS_IO_H
|
||||
#define _BITS_IO_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* ARM-specific I/O API implementations
|
||||
*
|
||||
*/
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
#include <ipxe/arm_io.h>
|
||||
|
||||
#endif /* _BITS_IO_H */
|
|
@ -0,0 +1,12 @@
|
|||
#ifndef _BITS_IOMAP_H
|
||||
#define _BITS_IOMAP_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* ARM-specific I/O mapping API implementations
|
||||
*
|
||||
*/
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
#endif /* _BITS_IOMAP_H */
|
|
@ -0,0 +1,14 @@
|
|||
#ifndef _BITS_NAP_H
|
||||
#define _BITS_NAP_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* ARM-specific CPU sleeping API implementations
|
||||
*
|
||||
*/
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
#include <ipxe/efi/efiarm_nap.h>
|
||||
|
||||
#endif /* _BITS_MAP_H */
|
|
@ -0,0 +1,14 @@
|
|||
#ifndef _BITS_PCI_IO_H
|
||||
#define _BITS_PCI_IO_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* ARM PCI I/O API implementations
|
||||
*
|
||||
*/
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
#include <ipxe/io.h>
|
||||
|
||||
#endif /* _BITS_PCI_IO_H */
|
|
@ -0,0 +1,12 @@
|
|||
#ifndef _BITS_REBOOT_H
|
||||
#define _BITS_REBOOT_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* ARM-specific reboot API implementations
|
||||
*
|
||||
*/
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
#endif /* _BITS_REBOOT_H */
|
|
@ -0,0 +1,12 @@
|
|||
#ifndef _BITS_SANBOOT_H
|
||||
#define _BITS_SANBOOT_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* ARM-specific sanboot API implementations
|
||||
*
|
||||
*/
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
#endif /* _BITS_SANBOOT_H */
|
|
@ -0,0 +1,12 @@
|
|||
#ifndef _BITS_SMBIOS_H
|
||||
#define _BITS_SMBIOS_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* ARM-specific SMBIOS API implementations
|
||||
*
|
||||
*/
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
#endif /* _BITS_SMBIOS_H */
|
|
@ -0,0 +1,12 @@
|
|||
#ifndef _BITS_TIME_H
|
||||
#define _BITS_TIME_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* ARM-specific time API implementations
|
||||
*
|
||||
*/
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
#endif /* _BITS_TIME_H */
|
|
@ -0,0 +1,12 @@
|
|||
#ifndef _BITS_UACCESS_H
|
||||
#define _BITS_UACCESS_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* ARM-specific user access API implementations
|
||||
*
|
||||
*/
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
#endif /* _BITS_UACCESS_H */
|
|
@ -0,0 +1,12 @@
|
|||
#ifndef _BITS_UART_H
|
||||
#define _BITS_UART_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* 16550-compatible UART
|
||||
*
|
||||
*/
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
#endif /* _BITS_UART_H */
|
|
@ -0,0 +1,12 @@
|
|||
#ifndef _BITS_UMALLOC_H
|
||||
#define _BITS_UMALLOC_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* ARM-specific user memory allocation API implementations
|
||||
*
|
||||
*/
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
#endif /* _BITS_UMALLOC_H */
|
|
@ -0,0 +1,158 @@
|
|||
#ifndef _BITS_XEN_H
|
||||
#define _BITS_XEN_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* Xen interface
|
||||
*
|
||||
*/
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
/* Hypercall registers */
|
||||
#ifdef __aarch64__
|
||||
#define XEN_HC "x16"
|
||||
#define XEN_REG1 "x0"
|
||||
#define XEN_REG2 "x1"
|
||||
#define XEN_REG3 "x2"
|
||||
#define XEN_REG4 "x3"
|
||||
#define XEN_REG5 "x4"
|
||||
#else
|
||||
#define XEN_HC "r12"
|
||||
#define XEN_REG1 "r0"
|
||||
#define XEN_REG2 "r1"
|
||||
#define XEN_REG3 "r2"
|
||||
#define XEN_REG4 "r3"
|
||||
#define XEN_REG5 "r4"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Issue hypercall with one argument
|
||||
*
|
||||
* @v xen Xen hypervisor
|
||||
* @v hypercall Hypercall number
|
||||
* @v arg1 First argument
|
||||
* @ret retval Return value
|
||||
*/
|
||||
static inline __attribute__ (( always_inline )) unsigned long
|
||||
xen_hypercall_1 ( struct xen_hypervisor *xen __unused, unsigned int hypercall,
|
||||
unsigned long arg1 ) {
|
||||
register unsigned long hc asm ( XEN_HC ) = hypercall;
|
||||
register unsigned long reg1 asm ( XEN_REG1 ) = arg1;
|
||||
|
||||
__asm__ __volatile__ ( "hvc %1"
|
||||
: "+r" ( reg1 )
|
||||
: "i" ( XEN_HYPERCALL_TAG ), "r" ( hc )
|
||||
: "memory", "cc" );
|
||||
return reg1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Issue hypercall with two arguments
|
||||
*
|
||||
* @v xen Xen hypervisor
|
||||
* @v hypercall Hypercall number
|
||||
* @v arg1 First argument
|
||||
* @v arg2 Second argument
|
||||
* @ret retval Return value
|
||||
*/
|
||||
static inline __attribute__ (( always_inline )) unsigned long
|
||||
xen_hypercall_2 ( struct xen_hypervisor *xen __unused, unsigned int hypercall,
|
||||
unsigned long arg1, unsigned long arg2 ) {
|
||||
register unsigned long hc asm ( XEN_HC ) = hypercall;
|
||||
register unsigned long reg1 asm ( XEN_REG1 ) = arg1;
|
||||
register unsigned long reg2 asm ( XEN_REG2 ) = arg2;
|
||||
|
||||
__asm__ __volatile__ ( "hvc %2"
|
||||
: "+r" ( reg1 ), "+r" ( reg2 )
|
||||
: "i" ( XEN_HYPERCALL_TAG ), "r" ( hc )
|
||||
: "memory", "cc" );
|
||||
return reg1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Issue hypercall with three arguments
|
||||
*
|
||||
* @v xen Xen hypervisor
|
||||
* @v hypercall Hypercall number
|
||||
* @v arg1 First argument
|
||||
* @v arg2 Second argument
|
||||
* @v arg3 Third argument
|
||||
* @ret retval Return value
|
||||
*/
|
||||
static inline __attribute__ (( always_inline )) unsigned long
|
||||
xen_hypercall_3 ( struct xen_hypervisor *xen __unused, unsigned int hypercall,
|
||||
unsigned long arg1, unsigned long arg2, unsigned long arg3 ) {
|
||||
register unsigned long hc asm ( XEN_HC ) = hypercall;
|
||||
register unsigned long reg1 asm ( XEN_REG1 ) = arg1;
|
||||
register unsigned long reg2 asm ( XEN_REG2 ) = arg2;
|
||||
register unsigned long reg3 asm ( XEN_REG3 ) = arg3;
|
||||
|
||||
__asm__ __volatile__ ( "hvc %3"
|
||||
: "+r" ( reg1 ), "+r" ( reg2 ), "+r" ( reg3 )
|
||||
: "i" ( XEN_HYPERCALL_TAG ), "r" ( hc )
|
||||
: "memory", "cc" );
|
||||
return reg1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Issue hypercall with four arguments
|
||||
*
|
||||
* @v xen Xen hypervisor
|
||||
* @v hypercall Hypercall number
|
||||
* @v arg1 First argument
|
||||
* @v arg2 Second argument
|
||||
* @v arg3 Third argument
|
||||
* @v arg4 Fourth argument
|
||||
* @ret retval Return value
|
||||
*/
|
||||
static inline __attribute__ (( always_inline )) unsigned long
|
||||
xen_hypercall_4 ( struct xen_hypervisor *xen __unused, unsigned int hypercall,
|
||||
unsigned long arg1, unsigned long arg2, unsigned long arg3,
|
||||
unsigned long arg4 ) {
|
||||
register unsigned long hc asm ( XEN_HC ) = hypercall;
|
||||
register unsigned long reg1 asm ( XEN_REG1 ) = arg1;
|
||||
register unsigned long reg2 asm ( XEN_REG2 ) = arg2;
|
||||
register unsigned long reg3 asm ( XEN_REG3 ) = arg3;
|
||||
register unsigned long reg4 asm ( XEN_REG4 ) = arg4;
|
||||
|
||||
__asm__ __volatile__ ( "hvc %4"
|
||||
: "+r" ( reg1 ), "+r" ( reg2 ), "+r" ( reg3 ),
|
||||
"+r" ( reg4 )
|
||||
: "i" ( XEN_HYPERCALL_TAG ), "r" ( hc )
|
||||
: "memory", "cc" );
|
||||
return reg1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Issue hypercall with five arguments
|
||||
*
|
||||
* @v xen Xen hypervisor
|
||||
* @v hypercall Hypercall number
|
||||
* @v arg1 First argument
|
||||
* @v arg2 Second argument
|
||||
* @v arg3 Third argument
|
||||
* @v arg4 Fourth argument
|
||||
* @v arg5 Fifth argument
|
||||
* @ret retval Return value
|
||||
*/
|
||||
static inline __attribute__ (( always_inline )) unsigned long
|
||||
xen_hypercall_5 ( struct xen_hypervisor *xen __unused, unsigned int hypercall,
|
||||
unsigned long arg1, unsigned long arg2, unsigned long arg3,
|
||||
unsigned long arg4, unsigned long arg5 ) {
|
||||
register unsigned long hc asm ( XEN_HC ) = hypercall;
|
||||
register unsigned long reg1 asm ( XEN_REG1 ) = arg1;
|
||||
register unsigned long reg2 asm ( XEN_REG2 ) = arg2;
|
||||
register unsigned long reg3 asm ( XEN_REG3 ) = arg3;
|
||||
register unsigned long reg4 asm ( XEN_REG4 ) = arg4;
|
||||
register unsigned long reg5 asm ( XEN_REG5 ) = arg5;
|
||||
|
||||
__asm__ __volatile__ ( "hvc %5"
|
||||
: "+r" ( reg1 ), "+r" ( reg2 ), "+r" ( reg3 ),
|
||||
"+r" ( reg4 ), "+r" ( reg5 )
|
||||
: "i" ( XEN_HYPERCALL_TAG ), "r" ( hc )
|
||||
: "memory", "cc" );
|
||||
return reg1;
|
||||
}
|
||||
|
||||
#endif /* _BITS_XEN_H */
|
|
@ -0,0 +1,105 @@
|
|||
#ifndef _IPXE_ARM_IO_H
|
||||
#define _IPXE_ARM_IO_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* iPXE I/O API for ARM
|
||||
*
|
||||
*/
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
#ifdef IOAPI_ARM
|
||||
#define IOAPI_PREFIX_arm
|
||||
#else
|
||||
#define IOAPI_PREFIX_arm __arm_
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Memory space mappings
|
||||
*
|
||||
*/
|
||||
|
||||
/** Page shift */
|
||||
#define PAGE_SHIFT 12
|
||||
|
||||
/*
|
||||
* Physical<->Bus address mappings
|
||||
*
|
||||
*/
|
||||
|
||||
static inline __always_inline unsigned long
|
||||
IOAPI_INLINE ( arm, phys_to_bus ) ( unsigned long phys_addr ) {
|
||||
return phys_addr;
|
||||
}
|
||||
|
||||
static inline __always_inline unsigned long
|
||||
IOAPI_INLINE ( arm, bus_to_phys ) ( unsigned long bus_addr ) {
|
||||
return bus_addr;
|
||||
}
|
||||
|
||||
/*
|
||||
* MMIO reads and writes up to native word size
|
||||
*
|
||||
*/
|
||||
|
||||
#define ARM_READX( _api_func, _type, _insn_suffix, _reg_prefix ) \
|
||||
static inline __always_inline _type \
|
||||
IOAPI_INLINE ( arm, _api_func ) ( volatile _type *io_addr ) { \
|
||||
_type data; \
|
||||
__asm__ __volatile__ ( "ldr" _insn_suffix " %" _reg_prefix "0, %1" \
|
||||
: "=r" ( data ) : "Qo" ( *io_addr ) ); \
|
||||
return data; \
|
||||
}
|
||||
#ifdef __aarch64__
|
||||
ARM_READX ( readb, uint8_t, "b", "w" );
|
||||
ARM_READX ( readw, uint16_t, "h", "w" );
|
||||
ARM_READX ( readl, uint32_t, "", "w" );
|
||||
ARM_READX ( readq, uint64_t, "", "" );
|
||||
#else
|
||||
ARM_READX ( readb, uint8_t, "b", "" );
|
||||
ARM_READX ( readw, uint16_t, "h", "" );
|
||||
ARM_READX ( readl, uint32_t, "", "" );
|
||||
#endif
|
||||
|
||||
#define ARM_WRITEX( _api_func, _type, _insn_suffix, _reg_prefix ) \
|
||||
static inline __always_inline void \
|
||||
IOAPI_INLINE ( arm, _api_func ) ( _type data, volatile _type *io_addr ) { \
|
||||
__asm__ __volatile__ ( "str" _insn_suffix " %" _reg_prefix "0, %1" \
|
||||
: : "r" ( data ), "Qo" ( *io_addr ) ); \
|
||||
}
|
||||
#ifdef __aarch64__
|
||||
ARM_WRITEX ( writeb, uint8_t, "b", "w" );
|
||||
ARM_WRITEX ( writew, uint16_t, "h", "w" );
|
||||
ARM_WRITEX ( writel, uint32_t, "", "w" );
|
||||
ARM_WRITEX ( writeq, uint64_t, "", "" );
|
||||
#else
|
||||
ARM_WRITEX ( writeb, uint8_t, "b", "" );
|
||||
ARM_WRITEX ( writew, uint16_t, "h", "" );
|
||||
ARM_WRITEX ( writel, uint32_t, "", "" );
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Slow down I/O
|
||||
*
|
||||
*/
|
||||
static inline __always_inline void
|
||||
IOAPI_INLINE ( arm, iodelay ) ( void ) {
|
||||
/* Nothing to do */
|
||||
}
|
||||
|
||||
/*
|
||||
* Memory barrier
|
||||
*
|
||||
*/
|
||||
static inline __always_inline void
|
||||
IOAPI_INLINE ( arm, mb ) ( void ) {
|
||||
|
||||
#ifdef __aarch64__
|
||||
__asm__ __volatile__ ( "dmb sy" );
|
||||
#else
|
||||
__asm__ __volatile__ ( "dmb" );
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* _IPXE_ARM_IO_H */
|
|
@ -0,0 +1,18 @@
|
|||
#ifndef _IPXE_EFIARM_NAP_H
|
||||
#define _IPXE_EFIARM_NAP_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* EFI CPU sleeping
|
||||
*
|
||||
*/
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
#ifdef NAP_EFIARM
|
||||
#define NAP_PREFIX_efiarm
|
||||
#else
|
||||
#define NAP_PREFIX_efiarm __efiarm_
|
||||
#endif
|
||||
|
||||
#endif /* _IPXE_EFIARM_NAP_H */
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* Copyright (C) 2016 Michael Brown <mbrown@fensystems.co.uk>.
|
||||
*
|
||||
* 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 of the
|
||||
* License, or any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301, USA.
|
||||
*
|
||||
* You can also choose to distribute this program under the terms of
|
||||
* the Unmodified Binary Distribution Licence (as given in the file
|
||||
* COPYING.UBDL), provided that you have satisfied its requirements.
|
||||
*/
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
#include <ipxe/nap.h>
|
||||
#include <ipxe/efi/efi.h>
|
||||
|
||||
/** @file
|
||||
*
|
||||
* iPXE CPU sleeping API for EFI
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Sleep until next interrupt
|
||||
*
|
||||
*/
|
||||
static void efiarm_cpu_nap ( void ) {
|
||||
/*
|
||||
* I can't find any EFI API that allows us to put the CPU to
|
||||
* sleep. The CpuSleep() function is defined in CpuLib.h, but
|
||||
* isn't part of any exposed protocol so we have no way to
|
||||
* call it.
|
||||
*
|
||||
* The EFI shell doesn't seem to bother sleeping the CPU; it
|
||||
* just sits there idly burning power.
|
||||
*
|
||||
*/
|
||||
__asm__ __volatile__ ( "wfi" );
|
||||
}
|
||||
|
||||
PROVIDE_NAP ( efiarm, cpu_nap, efiarm_cpu_nap );
|
|
@ -0,0 +1,23 @@
|
|||
# ARM32-specific directories containing source files
|
||||
#
|
||||
SRCDIRS += arch/arm32/core
|
||||
SRCDIRS += arch/arm32/libgcc
|
||||
|
||||
# ARM32-specific flags
|
||||
#
|
||||
CFLAGS += -mthumb -mcpu=cortex-a15 -mabi=aapcs -mfloat-abi=soft
|
||||
CFLAGS += -mword-relocations
|
||||
ASFLAGS += -mthumb -mcpu=cortex-a15
|
||||
|
||||
# EFI requires -fshort-wchar, and nothing else currently uses wchar_t
|
||||
#
|
||||
CFLAGS += -fshort-wchar
|
||||
|
||||
# Include common ARM Makefile
|
||||
MAKEDEPS += arch/arm/Makefile
|
||||
include arch/arm/Makefile
|
||||
|
||||
# Include platform-specific Makefile
|
||||
#
|
||||
MAKEDEPS += arch/arm32/Makefile.$(PLATFORM)
|
||||
include arch/arm32/Makefile.$(PLATFORM)
|
|
@ -0,0 +1,18 @@
|
|||
# -*- makefile -*- : Force emacs to use Makefile mode
|
||||
|
||||
# UEFI requires that enums are always 32 bits
|
||||
#
|
||||
CFLAGS += -fno-short-enums
|
||||
|
||||
# Specify EFI image builder
|
||||
#
|
||||
ELF2EFI = $(ELF2EFI32)
|
||||
|
||||
# Specify EFI boot file
|
||||
#
|
||||
EFI_BOOT_FILE = bootarm.efi
|
||||
|
||||
# Include generic EFI Makefile
|
||||
#
|
||||
MAKEDEPS += arch/arm/Makefile.efi
|
||||
include arch/arm/Makefile.efi
|
|
@ -0,0 +1,102 @@
|
|||
/*
|
||||
* Copyright (C) 2016 Michael Brown <mbrown@fensystems.co.uk>.
|
||||
*
|
||||
* 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 of the
|
||||
* License, or any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301, USA.
|
||||
*
|
||||
* You can also choose to distribute this program under the terms of
|
||||
* the Unmodified Binary Distribution Licence (as given in the file
|
||||
* COPYING.UBDL), provided that you have satisfied its requirements.
|
||||
*/
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <ipxe/bigint.h>
|
||||
|
||||
/** @file
|
||||
*
|
||||
* Big integer support
|
||||
*/
|
||||
|
||||
/**
|
||||
* Multiply big integers
|
||||
*
|
||||
* @v multiplicand0 Element 0 of big integer to be multiplied
|
||||
* @v multiplier0 Element 0 of big integer to be multiplied
|
||||
* @v result0 Element 0 of big integer to hold result
|
||||
* @v size Number of elements
|
||||
*/
|
||||
void bigint_multiply_raw ( const uint32_t *multiplicand0,
|
||||
const uint32_t *multiplier0,
|
||||
uint32_t *result0, unsigned int size ) {
|
||||
const bigint_t ( size ) __attribute__ (( may_alias )) *multiplicand =
|
||||
( ( const void * ) multiplicand0 );
|
||||
const bigint_t ( size ) __attribute__ (( may_alias )) *multiplier =
|
||||
( ( const void * ) multiplier0 );
|
||||
bigint_t ( size * 2 ) __attribute__ (( may_alias )) *result =
|
||||
( ( void * ) result0 );
|
||||
unsigned int i;
|
||||
unsigned int j;
|
||||
uint32_t multiplicand_element;
|
||||
uint32_t multiplier_element;
|
||||
uint32_t *result_elements;
|
||||
uint32_t discard_low;
|
||||
uint32_t discard_high;
|
||||
uint32_t discard_temp;
|
||||
|
||||
/* Zero result */
|
||||
memset ( result, 0, sizeof ( *result ) );
|
||||
|
||||
/* Multiply integers one element at a time */
|
||||
for ( i = 0 ; i < size ; i++ ) {
|
||||
multiplicand_element = multiplicand->element[i];
|
||||
for ( j = 0 ; j < size ; j++ ) {
|
||||
multiplier_element = multiplier->element[j];
|
||||
result_elements = &result->element[ i + j ];
|
||||
/* Perform a single multiply, and add the
|
||||
* resulting double-element into the result,
|
||||
* carrying as necessary. The carry can
|
||||
* never overflow beyond the end of the
|
||||
* result, since:
|
||||
*
|
||||
* a < 2^{n}, b < 2^{n} => ab < 2^{2n}
|
||||
*/
|
||||
__asm__ __volatile__ ( "umull %1, %2, %5, %6\n\t"
|
||||
"ldr %3, [%0]\n\t"
|
||||
"adds %3, %1\n\t"
|
||||
"stmia %0!, {%3}\n\t"
|
||||
"ldr %3, [%0]\n\t"
|
||||
"adcs %3, %2\n\t"
|
||||
"stmia %0!, {%3}\n\t"
|
||||
"bcc 2f\n\t"
|
||||
"\n1:\n\t"
|
||||
"ldr %3, [%0]\n\t"
|
||||
"adcs %3, #0\n\t"
|
||||
"stmia %0!, {%3}\n\t"
|
||||
"bcs 1b\n\t"
|
||||
"\n2:\n\t"
|
||||
: "+l" ( result_elements ),
|
||||
"=l" ( discard_low ),
|
||||
"=l" ( discard_high ),
|
||||
"=l" ( discard_temp ),
|
||||
"+m" ( *result )
|
||||
: "l" ( multiplicand_element ),
|
||||
"l" ( multiplier_element )
|
||||
: "cc" );
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
||||
|
||||
.text
|
||||
.arm
|
||||
|
||||
/*
|
||||
* Save stack context for non-local goto
|
||||
*/
|
||||
.globl setjmp
|
||||
.type setjmp, %function
|
||||
setjmp:
|
||||
/* Store registers */
|
||||
stmia r0, { r4, r5, r6, r7, r8, r9, r10, fp, sp, lr }
|
||||
/* Return 0 when returning as setjmp() */
|
||||
mov r0, #0
|
||||
bx lr
|
||||
.size setjmp, . - setjmp
|
||||
|
||||
/*
|
||||
* Non-local jump to a saved stack context
|
||||
*/
|
||||
.globl longjmp
|
||||
.type longjmp, %function
|
||||
longjmp:
|
||||
/* Restore registers */
|
||||
ldmia r0, { r4, r5, r6, r7, r8, r9, r10, fp, sp, lr }
|
||||
/* Force result to non-zero */
|
||||
movs r0, r1
|
||||
moveq r0, #1
|
||||
/* Return to setjmp() caller */
|
||||
bx lr
|
||||
.size longjmp, . - longjmp
|
|
@ -0,0 +1,316 @@
|
|||
#ifndef _BITS_BIGINT_H
|
||||
#define _BITS_BIGINT_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* Big integer support
|
||||
*/
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
|
||||
/** Element of a big integer */
|
||||
typedef uint32_t bigint_element_t;
|
||||
|
||||
/**
|
||||
* Initialise big integer
|
||||
*
|
||||
* @v value0 Element 0 of big integer to initialise
|
||||
* @v size Number of elements
|
||||
* @v data Raw data
|
||||
* @v len Length of raw data
|
||||
*/
|
||||
static inline __attribute__ (( always_inline )) void
|
||||
bigint_init_raw ( uint32_t *value0, unsigned int size,
|
||||
const void *data, size_t len ) {
|
||||
size_t pad_len = ( sizeof ( bigint_t ( size ) ) - len );
|
||||
uint8_t *value_byte = ( ( void * ) value0 );
|
||||
const uint8_t *data_byte = ( data + len );
|
||||
|
||||
/* Copy raw data in reverse order, padding with zeros */
|
||||
while ( len-- )
|
||||
*(value_byte++) = *(--data_byte);
|
||||
while ( pad_len-- )
|
||||
*(value_byte++) = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add big integers
|
||||
*
|
||||
* @v addend0 Element 0 of big integer to add
|
||||
* @v value0 Element 0 of big integer to be added to
|
||||
* @v size Number of elements
|
||||
*/
|
||||
static inline __attribute__ (( always_inline )) void
|
||||
bigint_add_raw ( const uint32_t *addend0, uint32_t *value0,
|
||||
unsigned int size ) {
|
||||
bigint_t ( size ) __attribute__ (( may_alias )) *value =
|
||||
( ( void * ) value0 );
|
||||
uint32_t *discard_addend;
|
||||
uint32_t *discard_value;
|
||||
uint32_t *discard_end;
|
||||
uint32_t discard_addend_i;
|
||||
uint32_t discard_value_i;
|
||||
|
||||
__asm__ __volatile__ ( "adds %2, %0, %8, lsl #2\n\t" /* clear CF */
|
||||
"\n1:\n\t"
|
||||
"ldmia %0!, {%3}\n\t"
|
||||
"ldr %4, [%1]\n\t"
|
||||
"adcs %4, %3\n\t"
|
||||
"stmia %1!, {%4}\n\t"
|
||||
"teq %0, %2\n\t"
|
||||
"bne 1b\n\t"
|
||||
: "=l" ( discard_addend ),
|
||||
"=l" ( discard_value ),
|
||||
"=l" ( discard_end ),
|
||||
"=l" ( discard_addend_i ),
|
||||
"=l" ( discard_value_i ),
|
||||
"+m" ( *value )
|
||||
: "0" ( addend0 ), "1" ( value0 ), "l" ( size )
|
||||
: "cc" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Subtract big integers
|
||||
*
|
||||
* @v subtrahend0 Element 0 of big integer to subtract
|
||||
* @v value0 Element 0 of big integer to be subtracted from
|
||||
* @v size Number of elements
|
||||
*/
|
||||
static inline __attribute__ (( always_inline )) void
|
||||
bigint_subtract_raw ( const uint32_t *subtrahend0, uint32_t *value0,
|
||||
unsigned int size ) {
|
||||
bigint_t ( size ) __attribute__ (( may_alias )) *value =
|
||||
( ( void * ) value0 );
|
||||
uint32_t *discard_subtrahend;
|
||||
uint32_t *discard_value;
|
||||
uint32_t *discard_end;
|
||||
uint32_t discard_subtrahend_i;
|
||||
uint32_t discard_value_i;
|
||||
|
||||
__asm__ __volatile__ ( "add %2, %0, %8, lsl #2\n\t"
|
||||
"cmp %2, %0\n\t" /* set CF */
|
||||
"\n1:\n\t"
|
||||
"ldmia %0!, {%3}\n\t"
|
||||
"ldr %4, [%1]\n\t"
|
||||
"sbcs %4, %3\n\t"
|
||||
"stmia %1!, {%4}\n\t"
|
||||
"teq %0, %2\n\t"
|
||||
"bne 1b\n\t"
|
||||
: "=l" ( discard_subtrahend ),
|
||||
"=l" ( discard_value ),
|
||||
"=l" ( discard_end ),
|
||||
"=l" ( discard_subtrahend_i ),
|
||||
"=l" ( discard_value_i ),
|
||||
"+m" ( *value )
|
||||
: "0" ( subtrahend0 ), "1" ( value0 ),
|
||||
"l" ( size )
|
||||
: "cc" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Rotate big integer left
|
||||
*
|
||||
* @v value0 Element 0 of big integer
|
||||
* @v size Number of elements
|
||||
*/
|
||||
static inline __attribute__ (( always_inline )) void
|
||||
bigint_rol_raw ( uint32_t *value0, unsigned int size ) {
|
||||
bigint_t ( size ) __attribute__ (( may_alias )) *value =
|
||||
( ( void * ) value0 );
|
||||
uint32_t *discard_value;
|
||||
uint32_t *discard_end;
|
||||
uint32_t discard_value_i;
|
||||
|
||||
__asm__ __volatile__ ( "adds %1, %0, %5, lsl #2\n\t" /* clear CF */
|
||||
"\n1:\n\t"
|
||||
"ldr %2, [%0]\n\t"
|
||||
"adcs %2, %2\n\t"
|
||||
"stmia %0!, {%2}\n\t"
|
||||
"teq %0, %1\n\t"
|
||||
"bne 1b\n\t"
|
||||
: "=l" ( discard_value ),
|
||||
"=l" ( discard_end ),
|
||||
"=l" ( discard_value_i ),
|
||||
"+m" ( *value )
|
||||
: "0" ( value0 ), "1" ( size )
|
||||
: "cc" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Rotate big integer right
|
||||
*
|
||||
* @v value0 Element 0 of big integer
|
||||
* @v size Number of elements
|
||||
*/
|
||||
static inline __attribute__ (( always_inline )) void
|
||||
bigint_ror_raw ( uint32_t *value0, unsigned int size ) {
|
||||
bigint_t ( size ) __attribute__ (( may_alias )) *value =
|
||||
( ( void * ) value0 );
|
||||
uint32_t *discard_value;
|
||||
uint32_t *discard_end;
|
||||
uint32_t discard_value_i;
|
||||
|
||||
__asm__ __volatile__ ( "adds %1, %0, %5, lsl #2\n\t" /* clear CF */
|
||||
"\n1:\n\t"
|
||||
"ldmdb %1!, {%2}\n\t"
|
||||
"rrxs %2, %2\n\t"
|
||||
"str %2, [%1]\n\t"
|
||||
"teq %0, %1\n\t"
|
||||
"bne 1b\n\t"
|
||||
: "=l" ( discard_value ),
|
||||
"=l" ( discard_end ),
|
||||
"=l" ( discard_value_i ),
|
||||
"+m" ( *value )
|
||||
: "0" ( value0 ), "1" ( size )
|
||||
: "cc" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if big integer is equal to zero
|
||||
*
|
||||
* @v value0 Element 0 of big integer
|
||||
* @v size Number of elements
|
||||
* @ret is_zero Big integer is equal to zero
|
||||
*/
|
||||
static inline __attribute__ (( always_inline, pure )) int
|
||||
bigint_is_zero_raw ( const uint32_t *value0, unsigned int size ) {
|
||||
const uint32_t *value = value0;
|
||||
uint32_t value_i;
|
||||
|
||||
do {
|
||||
value_i = *(value++);
|
||||
if ( value_i )
|
||||
break;
|
||||
} while ( --size );
|
||||
|
||||
return ( value_i == 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare big integers
|
||||
*
|
||||
* @v value0 Element 0 of big integer
|
||||
* @v reference0 Element 0 of reference big integer
|
||||
* @v size Number of elements
|
||||
* @ret geq Big integer is greater than or equal to the reference
|
||||
*/
|
||||
static inline __attribute__ (( always_inline, pure )) int
|
||||
bigint_is_geq_raw ( const uint32_t *value0, const uint32_t *reference0,
|
||||
unsigned int size ) {
|
||||
const uint32_t *value = ( value0 + size );
|
||||
const uint32_t *reference = ( reference0 + size );
|
||||
uint32_t value_i;
|
||||
uint32_t reference_i;
|
||||
|
||||
do {
|
||||
value_i = *(--value);
|
||||
reference_i = *(--reference);
|
||||
if ( value_i != reference_i )
|
||||
break;
|
||||
} while ( --size );
|
||||
|
||||
return ( value_i >= reference_i );
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if bit is set in big integer
|
||||
*
|
||||
* @v value0 Element 0 of big integer
|
||||
* @v size Number of elements
|
||||
* @v bit Bit to test
|
||||
* @ret is_set Bit is set
|
||||
*/
|
||||
static inline __attribute__ (( always_inline )) int
|
||||
bigint_bit_is_set_raw ( const uint32_t *value0, unsigned int size,
|
||||
unsigned int bit ) {
|
||||
const bigint_t ( size ) __attribute__ (( may_alias )) *value =
|
||||
( ( const void * ) value0 );
|
||||
unsigned int index = ( bit / ( 8 * sizeof ( value->element[0] ) ) );
|
||||
unsigned int subindex = ( bit % ( 8 * sizeof ( value->element[0] ) ) );
|
||||
|
||||
return ( value->element[index] & ( 1 << subindex ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Find highest bit set in big integer
|
||||
*
|
||||
* @v value0 Element 0 of big integer
|
||||
* @v size Number of elements
|
||||
* @ret max_bit Highest bit set + 1 (or 0 if no bits set)
|
||||
*/
|
||||
static inline __attribute__ (( always_inline )) int
|
||||
bigint_max_set_bit_raw ( const uint32_t *value0, unsigned int size ) {
|
||||
const uint32_t *value = ( value0 + size );
|
||||
int max_bit = ( 8 * sizeof ( bigint_t ( size ) ) );
|
||||
uint32_t value_i;
|
||||
|
||||
do {
|
||||
value_i = *(--value);
|
||||
max_bit -= ( 32 - fls ( value_i ) );
|
||||
if ( value_i )
|
||||
break;
|
||||
} while ( --size );
|
||||
|
||||
return max_bit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Grow big integer
|
||||
*
|
||||
* @v source0 Element 0 of source big integer
|
||||
* @v source_size Number of elements in source big integer
|
||||
* @v dest0 Element 0 of destination big integer
|
||||
* @v dest_size Number of elements in destination big integer
|
||||
*/
|
||||
static inline __attribute__ (( always_inline )) void
|
||||
bigint_grow_raw ( const uint32_t *source0, unsigned int source_size,
|
||||
uint32_t *dest0, unsigned int dest_size ) {
|
||||
unsigned int pad_size = ( dest_size - source_size );
|
||||
|
||||
memcpy ( dest0, source0, sizeof ( bigint_t ( source_size ) ) );
|
||||
memset ( ( dest0 + source_size ), 0, sizeof ( bigint_t ( pad_size ) ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Shrink big integer
|
||||
*
|
||||
* @v source0 Element 0 of source big integer
|
||||
* @v source_size Number of elements in source big integer
|
||||
* @v dest0 Element 0 of destination big integer
|
||||
* @v dest_size Number of elements in destination big integer
|
||||
*/
|
||||
static inline __attribute__ (( always_inline )) void
|
||||
bigint_shrink_raw ( const uint32_t *source0, unsigned int source_size __unused,
|
||||
uint32_t *dest0, unsigned int dest_size ) {
|
||||
|
||||
memcpy ( dest0, source0, sizeof ( bigint_t ( dest_size ) ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Finalise big integer
|
||||
*
|
||||
* @v value0 Element 0 of big integer to finalise
|
||||
* @v size Number of elements
|
||||
* @v out Output buffer
|
||||
* @v len Length of output buffer
|
||||
*/
|
||||
static inline __attribute__ (( always_inline )) void
|
||||
bigint_done_raw ( const uint32_t *value0, unsigned int size __unused,
|
||||
void *out, size_t len ) {
|
||||
const uint8_t *value_byte = ( ( const void * ) value0 );
|
||||
uint8_t *out_byte = ( out + len );
|
||||
|
||||
/* Copy raw data in reverse order */
|
||||
while ( len-- )
|
||||
*(--out_byte) = *(value_byte++);
|
||||
}
|
||||
|
||||
extern void bigint_multiply_raw ( const uint32_t *multiplicand0,
|
||||
const uint32_t *multiplier0,
|
||||
uint32_t *value0, unsigned int size );
|
||||
|
||||
#endif /* _BITS_BIGINT_H */
|
|
@ -0,0 +1,100 @@
|
|||
#ifndef _BITS_BITOPS_H
|
||||
#define _BITS_BITOPS_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* ARM bit operations
|
||||
*
|
||||
*/
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/**
|
||||
* Test and set bit atomically
|
||||
*
|
||||
* @v bit Bit to set
|
||||
* @v bits Bit field
|
||||
* @ret old Old value of bit (zero or non-zero)
|
||||
*/
|
||||
static inline __attribute__ (( always_inline )) int
|
||||
test_and_set_bit ( unsigned int bit, volatile void *bits ) {
|
||||
unsigned int index = ( bit / 32 );
|
||||
unsigned int offset = ( bit % 32 );
|
||||
volatile uint32_t *dword = ( ( ( volatile uint32_t * ) bits ) + index );
|
||||
uint32_t mask = ( 1UL << offset );
|
||||
uint32_t old;
|
||||
uint32_t new;
|
||||
uint32_t flag;
|
||||
|
||||
__asm__ __volatile__ ( "\n1:\n\t"
|
||||
"ldrex %0, %3\n\t"
|
||||
"orr %1, %0, %4\n\t"
|
||||
"strex %2, %1, %3\n\t"
|
||||
"tst %2, %2\n\t"
|
||||
"bne 1b\n\t"
|
||||
: "=&r" ( old ), "=&r" ( new ), "=&l" ( flag ),
|
||||
"+Q" ( *dword )
|
||||
: "r" ( mask )
|
||||
: "cc" );
|
||||
|
||||
return ( old & mask );
|
||||
}
|
||||
|
||||
/**
|
||||
* Test and clear bit atomically
|
||||
*
|
||||
* @v bit Bit to set
|
||||
* @v bits Bit field
|
||||
* @ret old Old value of bit (zero or non-zero)
|
||||
*/
|
||||
static inline __attribute__ (( always_inline )) int
|
||||
test_and_clear_bit ( unsigned int bit, volatile void *bits ) {
|
||||
unsigned int index = ( bit / 32 );
|
||||
unsigned int offset = ( bit % 32 );
|
||||
volatile uint32_t *dword = ( ( ( volatile uint32_t * ) bits ) + index );
|
||||
uint32_t mask = ( 1UL << offset );
|
||||
uint32_t old;
|
||||
uint32_t new;
|
||||
uint32_t flag;
|
||||
|
||||
__asm__ __volatile__ ( "\n1:\n\t"
|
||||
"ldrex %0, %3\n\t"
|
||||
"bic %1, %0, %4\n\t"
|
||||
"strex %2, %1, %3\n\t"
|
||||
"tst %2, %2\n\t"
|
||||
"bne 1b\n\t"
|
||||
: "=&r" ( old ), "=&r" ( new ), "=&l" ( flag ),
|
||||
"+Q" ( *dword )
|
||||
: "r" ( mask )
|
||||
: "cc" );
|
||||
|
||||
return ( old & mask );
|
||||
}
|
||||
|
||||
/**
|
||||
* Set bit atomically
|
||||
*
|
||||
* @v bit Bit to set
|
||||
* @v bits Bit field
|
||||
*/
|
||||
static inline __attribute__ (( always_inline )) void
|
||||
set_bit ( unsigned int bit, volatile void *bits ) {
|
||||
|
||||
test_and_set_bit ( bit, bits );
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear bit atomically
|
||||
*
|
||||
* @v bit Bit to set
|
||||
* @v bits Bit field
|
||||
*/
|
||||
static inline __attribute__ (( always_inline )) void
|
||||
clear_bit ( unsigned int bit, volatile void *bits ) {
|
||||
|
||||
test_and_clear_bit ( bit, bits );
|
||||
}
|
||||
|
||||
#endif /* _BITS_BITOPS_H */
|
|
@ -0,0 +1,52 @@
|
|||
#ifndef _BITS_BYTESWAP_H
|
||||
#define _BITS_BYTESWAP_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* Byte-order swapping functions
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
static inline __attribute__ (( always_inline, const )) uint16_t
|
||||
__bswap_variable_16 ( uint16_t x ) {
|
||||
__asm__ ( "rev16 %0, %1" : "=l" ( x ) : "l" ( x ) );
|
||||
return x;
|
||||
}
|
||||
|
||||
static inline __attribute__ (( always_inline )) void
|
||||
__bswap_16s ( uint16_t *x ) {
|
||||
*x = __bswap_variable_16 ( *x );
|
||||
}
|
||||
|
||||
static inline __attribute__ (( always_inline, const )) uint32_t
|
||||
__bswap_variable_32 ( uint32_t x ) {
|
||||
__asm__ ( "rev %0, %1" : "=l" ( x ) : "l" ( x ) );
|
||||
return x;
|
||||
}
|
||||
|
||||
static inline __attribute__ (( always_inline )) void
|
||||
__bswap_32s ( uint32_t *x ) {
|
||||
*x = __bswap_variable_32 ( *x );
|
||||
}
|
||||
|
||||
static inline __attribute__ (( always_inline, const )) uint64_t
|
||||
__bswap_variable_64 ( uint64_t x ) {
|
||||
uint32_t in_high = ( x >> 32 );
|
||||
uint32_t in_low = ( x & 0xffffffffUL );
|
||||
uint32_t out_high = __bswap_variable_32 ( in_low );
|
||||
uint32_t out_low = __bswap_variable_32 ( in_high );
|
||||
|
||||
return ( ( ( ( uint64_t ) out_high ) << 32 ) |
|
||||
( ( uint64_t ) out_low ) );
|
||||
}
|
||||
|
||||
static inline __attribute__ (( always_inline )) void
|
||||
__bswap_64s ( uint64_t *x ) {
|
||||
*x = __bswap_variable_64 ( *x );
|
||||
}
|
||||
|
||||
#endif
|
|
@ -0,0 +1,16 @@
|
|||
#ifndef _BITS_COMPILER_H
|
||||
#define _BITS_COMPILER_H
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
/** Dummy relocation type */
|
||||
#define RELOC_TYPE_NONE R_ARM_NONE
|
||||
|
||||
#ifndef ASSEMBLY
|
||||
|
||||
#define __asmcall
|
||||
#define __libgcc
|
||||
|
||||
#endif /* ASSEMBLY */
|
||||
|
||||
#endif /*_BITS_COMPILER_H */
|
|
@ -0,0 +1,30 @@
|
|||
#ifndef _BITS_PROFILE_H
|
||||
#define _BITS_PROFILE_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* Profiling
|
||||
*
|
||||
*/
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/**
|
||||
* Get profiling timestamp
|
||||
*
|
||||
* @ret timestamp Timestamp
|
||||
*/
|
||||
static inline __attribute__ (( always_inline )) uint64_t
|
||||
profile_timestamp ( void ) {
|
||||
uint32_t cycles;
|
||||
|
||||
/* Read cycle counter */
|
||||
__asm__ __volatile__ ( "mcr p15, 0, %1, c9, c12, 0\n\t"
|
||||
"mrc p15, 0, %0, c9, c13, 0\n\t"
|
||||
: "=r" ( cycles ) : "r" ( 1 ) );
|
||||
return cycles;
|
||||
}
|
||||
|
||||
#endif /* _BITS_PROFILE_H */
|
|
@ -0,0 +1,23 @@
|
|||
#ifndef _BITS_STDINT_H
|
||||
#define _BITS_STDINT_H
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
typedef __SIZE_TYPE__ size_t;
|
||||
typedef signed long ssize_t;
|
||||
typedef signed long off_t;
|
||||
|
||||
typedef unsigned char uint8_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef unsigned int uint32_t;
|
||||
typedef unsigned long long uint64_t;
|
||||
|
||||
typedef signed char int8_t;
|
||||
typedef signed short int16_t;
|
||||
typedef signed int int32_t;
|
||||
typedef signed long long int64_t;
|
||||
|
||||
typedef unsigned long physaddr_t;
|
||||
typedef unsigned long intptr_t;
|
||||
|
||||
#endif /* _BITS_STDINT_H */
|
|
@ -0,0 +1,60 @@
|
|||
#ifndef BITS_STRING_H
|
||||
#define BITS_STRING_H
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
/** @file
|
||||
*
|
||||
* String functions
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fill memory region
|
||||
*
|
||||
* @v dest Destination region
|
||||
* @v character Fill character
|
||||
* @v len Length
|
||||
* @ret dest Destination region
|
||||
*/
|
||||
static inline __attribute__ (( always_inline )) void *
|
||||
memset ( void *dest, int character, size_t len ) {
|
||||
|
||||
/* Not yet optimised */
|
||||
generic_memset ( dest, character, len );
|
||||
return dest;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy memory region
|
||||
*
|
||||
* @v dest Destination region
|
||||
* @v src Source region
|
||||
* @v len Length
|
||||
* @ret dest Destination region
|
||||
*/
|
||||
static inline __attribute__ (( always_inline )) void *
|
||||
memcpy ( void *dest, const void *src, size_t len ) {
|
||||
|
||||
/* Not yet optimised */
|
||||
generic_memcpy ( dest, src, len );
|
||||
return dest;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy (possibly overlapping) memory region
|
||||
*
|
||||
* @v dest Destination region
|
||||
* @v src Source region
|
||||
* @v len Length
|
||||
* @ret dest Destination region
|
||||
*/
|
||||
static inline __attribute__ (( always_inline )) void *
|
||||
memmove ( void *dest, const void *src, size_t len ) {
|
||||
|
||||
/* Not yet optimised */
|
||||
generic_memmove ( dest, src, len );
|
||||
return dest;
|
||||
}
|
||||
|
||||
#endif /* BITS_STRING_H */
|
|
@ -0,0 +1,85 @@
|
|||
#ifndef _BITS_STRINGS_H
|
||||
#define _BITS_STRINGS_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* String functions
|
||||
*
|
||||
*/
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
/**
|
||||
* Find first (i.e. least significant) set bit
|
||||
*
|
||||
* @v value Value
|
||||
* @ret lsb Least significant bit set in value (LSB=1), or zero
|
||||
*/
|
||||
static inline __attribute__ (( always_inline )) int __ffsl ( long value ) {
|
||||
unsigned long bits = value;
|
||||
unsigned long lsb;
|
||||
unsigned int lz;
|
||||
|
||||
/* Extract least significant set bit */
|
||||
lsb = ( bits & -bits );
|
||||
|
||||
/* Count number of leading zeroes before LSB */
|
||||
__asm__ ( "clz %0, %1" : "=r" ( lz ) : "r" ( lsb ) );
|
||||
|
||||
return ( 32 - lz );
|
||||
}
|
||||
|
||||
/**
|
||||
* Find first (i.e. least significant) set bit
|
||||
*
|
||||
* @v value Value
|
||||
* @ret lsb Least significant bit set in value (LSB=1), or zero
|
||||
*/
|
||||
static inline __attribute__ (( always_inline )) int __ffsll ( long long value ){
|
||||
unsigned long high = ( value >> 32 );
|
||||
unsigned long low = ( value >> 0 );
|
||||
|
||||
if ( low ) {
|
||||
return ( __ffsl ( low ) );
|
||||
} else if ( high ) {
|
||||
return ( 32 + __ffsl ( high ) );
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Find last (i.e. most significant) set bit
|
||||
*
|
||||
* @v value Value
|
||||
* @ret msb Most significant bit set in value (LSB=1), or zero
|
||||
*/
|
||||
static inline __attribute__ (( always_inline )) int __flsl ( long value ) {
|
||||
unsigned int lz;
|
||||
|
||||
/* Count number of leading zeroes */
|
||||
__asm__ ( "clz %0, %1" : "=r" ( lz ) : "r" ( value ) );
|
||||
|
||||
return ( 32 - lz );
|
||||
}
|
||||
|
||||
/**
|
||||
* Find last (i.e. most significant) set bit
|
||||
*
|
||||
* @v value Value
|
||||
* @ret msb Most significant bit set in value (LSB=1), or zero
|
||||
*/
|
||||
static inline __attribute__ (( always_inline )) int __flsll ( long long value ){
|
||||
unsigned long high = ( value >> 32 );
|
||||
unsigned long low = ( value >> 0 );
|
||||
|
||||
if ( high ) {
|
||||
return ( 32 + __flsl ( high ) );
|
||||
} else if ( low ) {
|
||||
return ( __flsl ( low ) );
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* _BITS_STRINGS_H */
|
|
@ -0,0 +1,19 @@
|
|||
#ifndef _BITS_TCPIP_H
|
||||
#define _BITS_TCPIP_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* Transport-network layer interface
|
||||
*
|
||||
*/
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
static inline __attribute__ (( always_inline )) uint16_t
|
||||
tcpip_continue_chksum ( uint16_t partial, const void *data, size_t len ) {
|
||||
|
||||
/* Not yet optimised */
|
||||
return generic_tcpip_continue_chksum ( partial, data, len );
|
||||
}
|
||||
|
||||
#endif /* _BITS_TCPIP_H */
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* Copyright (C) 2015 Michael Brown <mbrown@fensystems.co.uk>.
|
||||
*
|
||||
* 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 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301, USA.
|
||||
*
|
||||
* You can also choose to distribute this program under the terms of
|
||||
* the Unmodified Binary Distribution Licence (as given in the file
|
||||
* COPYING.UBDL), provided that you have satisfied its requirements.
|
||||
*/
|
||||
|
||||
#ifndef _DHCP_ARCH_H
|
||||
#define _DHCP_ARCH_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* Architecture-specific DHCP options
|
||||
*/
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
#include <ipxe/dhcp.h>
|
||||
|
||||
#define DHCP_ARCH_CLIENT_ARCHITECTURE DHCP_CLIENT_ARCHITECTURE_ARM32
|
||||
|
||||
#define DHCP_ARCH_CLIENT_NDI 1 /* UNDI */ , 3, 10 /* v3.10 */
|
||||
|
||||
#endif
|
|
@ -0,0 +1,45 @@
|
|||
#ifndef GDBMACH_H
|
||||
#define GDBMACH_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* GDB architecture specifics
|
||||
*
|
||||
* This file declares functions for manipulating the machine state and
|
||||
* debugging context.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
typedef unsigned long gdbreg_t;
|
||||
|
||||
/* Register snapshot */
|
||||
enum {
|
||||
/* Not yet implemented */
|
||||
GDBMACH_NREGS,
|
||||
};
|
||||
|
||||
#define GDBMACH_SIZEOF_REGS ( GDBMACH_NREGS * sizeof ( gdbreg_t ) )
|
||||
|
||||
static inline void gdbmach_set_pc ( gdbreg_t *regs, gdbreg_t pc ) {
|
||||
/* Not yet implemented */
|
||||
( void ) regs;
|
||||
( void ) pc;
|
||||
}
|
||||
|
||||
static inline void gdbmach_set_single_step ( gdbreg_t *regs, int step ) {
|
||||
/* Not yet implemented */
|
||||
( void ) regs;
|
||||
( void ) step;
|
||||
}
|
||||
|
||||
static inline void gdbmach_breakpoint ( void ) {
|
||||
/* Not yet implemented */
|
||||
}
|
||||
|
||||
extern int gdbmach_set_breakpoint ( int type, unsigned long addr, size_t len,
|
||||
int enable );
|
||||
extern void gdbmach_init ( void );
|
||||
|
||||
#endif /* GDBMACH_H */
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue