diff options
Diffstat (limited to 'util/mkelfImage')
63 files changed, 17472 insertions, 0 deletions
diff --git a/util/mkelfImage/AUTHORS b/util/mkelfImage/AUTHORS new file mode 100644 index 0000000000..08224f6aa0 --- /dev/null +++ b/util/mkelfImage/AUTHORS @@ -0,0 +1,4 @@ +Eric Biederman <ebiederman@lnxi.com> +Joshua Aune <luken@lnxi.com> +Jake Page <jake@CS.Stanford.EDU> +Andrew Ip <aip@cwlinux.com> diff --git a/util/mkelfImage/COPYING b/util/mkelfImage/COPYING new file mode 100644 index 0000000000..a52b16e406 --- /dev/null +++ b/util/mkelfImage/COPYING @@ -0,0 +1,341 @@ + + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 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 Library 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) 19yy <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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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) 19yy 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 Library General +Public License instead of this License. diff --git a/util/mkelfImage/Makefile b/util/mkelfImage/Makefile new file mode 100644 index 0000000000..2100ed4cbe --- /dev/null +++ b/util/mkelfImage/Makefile @@ -0,0 +1,118 @@ +include Makefile.conf +VERSION:=2.7 +RELEASE_DATE:=27 March 2006 +PACKAGE:=mkelfImage + +# You can specify DESTDIR on the command line to do a add +# a prefix to the install so it doesn't really happen +# Useful for building binary packages +DESTDIR = +CWD:=$(shell pwd) +OBJDIR:=objdir + +pkgdatadir = $(datadir)/$(PACKAGE) +pkglibdir = $(libdir)/$(PACKAGE) +pkgincludedir = $(includedir)/$(PACKAGE) + +CPPFLAGS=-DVERSION='"$(VERSION)"' -DRELEASE_DATE='"$(RELEASE_DATE)"' -I include +HOST_CPPFLAGS=$(CPPFLAGS) +I386_CPPFLAGS=$(CPPFLAGS) -I arch/i386/include +IA64_CPPFLAGS=$(CPPFLAGS) -I arch/ia64/include + +GENERATED_SRCS:=\ + ./configure \ + ./linux-i386/convert.bin.c\ + ./linux-ia64/convert.bin.c + +SPEC=$(OBJDIR)/mkelfImage-$(VERSION).spec +TARBALL=$(OBJDIR)/mkelfImage-$(VERSION).tar.gz +SRCS:=$(shell find ./AUTHORS ./COPYING ./Makefile ./Makefile.conf.in ./News \ + ./configure.ac \ + ./mkelfImage.spec.in \ + ./config \ + ./kunzip_src \ + ./main ./util ./include ./arch \ + ./linux-i386 \ + ./linux-ia64 \ + ! -path '*CVS*' ! -name '*~' ! -name '.*' -type f -print ) +SRCS+=$(GENERATED_SRCS) +PSRCS:=$(patsubst ./%,mkelfImage-$(VERSION)/%,$(SRCS)) +PSRCS+=./mkelfImage-$(VERSION).spec + +SBIN_TARGETS=$(OBJDIR)/sbin/mkelfImage +MAN8_TARGETS=$(OBJDIR)/man/man8/mkelfImage.8 + +TARGETS:=$(SBIN_TARGETS) $(MAN8_TARGETS) + +DEPS:= Makefile Makefile.conf +all: $(TARGETS) + +include main/Makefile +include util/Makefile +include linux-i386/Makefile +include linux-ia64/Makefile + + +clean:: + @$(RM) -rf objdir + @$(RM) -rf rpm + @$(RM) -f config.log config.status config.cache + @$(RM) -f $(SBIN_TARGETS) $(MAN1_TARGETS) + @$(RM) -f mkelfImage-$(VERSION) $(TARBALL) + +dist-clean:: clean + @$(FIND) . -type f -name '*~' | xargs $(RM) -f + @$(RM) Makefile.conf + +maintainer-clean:: dist-clean + @$(RM) -f $(SPEC) $(GENERATED_SRCS) + + +install: $(TARGETS) + $(MKDIR) -p $(DESTDIR)/$(pkgdatadir)/elf32-i386/ $(DESTDIR)/$(sbindir) $(DESTDIR)/$(mandir)/man8 + $(CP) -ar $(SBIN_TARGETS) $(DESTDIR)/$(sbindir)/ + $(CP) -ar $(MAN8_TARGETS) $(DESTDIR)/$(mandir)/man8/ + + +#%.1 : %.pl Makefile +# mkdir -p $(@D) +# pod2man --date="$(RELEASE_DATE)" --release="$(VERSION)" $*.pl > $@ + + +tarball: $(TARBALL) + + +$(TARBALL): $(SRCS) $(SPEC) + $(MKDIR) -p $(OBJDIR) + $(RM) -f $(OBJDIR)/mkelfImage-$(VERSION) + $(LN) -s .. $(OBJDIR)/mkelfImage-$(VERSION) + (cd $(OBJDIR); $(TAR) -cf - $(PSRCS) | gzip -9) > $@ + +rpm: $(TARBALL) + $(MKDIR) -p $(OBJDIR)/RPM $(OBJDIR)/SRPM $(OBJDIR)/BUILD $(OBJDIR)/SPECS $(OBJDIR)/TMP + unset MAKEFLAGS MAKELEVEL; \ + $(RPM) -ta \ + --define '_rpmdir $(CWD)/$(OBJDIR)/RPM' \ + --define '_srcrpmdir $(CWD)/$(OBJDIR)/SRPM' \ + --define '_builddir $(CWD)/$(OBJDIR)/BUILD' \ + --define '_specdir $(CWD)/$(OBJDIR)/SPECS' \ + --define '_tmppath $(CWD)/$(OBJDIR)/TMP' \ + $(TARBALL) + +Makefile.conf: Makefile.conf.in configure + /bin/sh ./configure + + +configure: configure.ac + autoconf + $(RM) -rf autom4te.cache + +$(SPEC): mkelfImage.spec.in Makefile + $(SED) -e 's,^Version: $$,Version: $(VERSION),' $< > $@ + + +.PHONY: echo install realinstall + + +echo: + echo $(SRCS) diff --git a/util/mkelfImage/Makefile.conf.in b/util/mkelfImage/Makefile.conf.in new file mode 100644 index 0000000000..4645e44a36 --- /dev/null +++ b/util/mkelfImage/Makefile.conf.in @@ -0,0 +1,46 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ + +bindir=@bindir@ +sbindir=@sbindir@ +libexecdir=@libexecdir@ +datadir=@datadir@ +sysconfdir=@sysconfdir@ +sharedstatedir=@sharedstatedir@ +localstatedir=@localstatedir@ +libdir=@libdir@ +infodir=@infodir@ +mandir=@mandir@ +includedir=@includedir@ + +DEFS=@DEFS@ +LIBS=@LIBS@ +HOST_CC=@HOST_CC@ +HOST_CFLAGS=@HOST_CFLAGS@ $(DEFS) + +I386_CC =@I386_CC@ +I386_LD =@I386_LD@ +I386_AS =@I386_AS@ +I386_CPP =@I386_CPP@ +I386_OBJCOPY=@I386_OBJCOPY@ +I386_CFLAGS =@I386_CFLAGS@ +I386_ASFLAGS=@I386_ASFLAGS@ +I386_LDFLAGS=@I386_LDFLAGS@ + +IA64_CC =@IA64_CC@ +IA64_LD =@IA64_LD@ +IA64_AS =@IA64_AS@ +IA64_CPP =@IA64_CPP@ +IA64_OBJCOPY=@IA64_OBJCOPY@ +IA64_CFLAGS =@IA64_CFLAGS@ +IA64_ASFLAGS=@IA64_ASFLAGS@ +IA64_LDFLAGS=@IA64_LDFLAGS@ + +MKDIR=@MKDIR@ +RM=@RM@ +CP=@CP@ +LN=@LN@ +TAR=@TAR@ +RPM=@RPM@ +SED=@SED@ +FIND=@FIND@ diff --git a/util/mkelfImage/News b/util/mkelfImage/News new file mode 100644 index 0000000000..fbf8b6ace2 --- /dev/null +++ b/util/mkelfImage/News @@ -0,0 +1,123 @@ +* 2.6 14 March 2006 +- Fix the i386-linux probe code so it does not get confused by + bzImages that are also ELF executables. +- Changed value of GDTLOC and REAL_MODE_DATA_LOC to be below + 512kb. This allows for booting on machines whose BIOS reports + only 512kb of memory below 1MB. + +* 2.5 24 April 2003 +- Fix the checksum code so that it checksums the bss sections as well. + How I missed the checksum code was broken in 2.4 I don't know. + +* 2.4 22 April 2003 +- Fix code that failed to write more than the first ELF note. + Resulting in checksums and other information not being present + in the generated ELF image. + This bug has been present since mkelfImage-2.0 + +* 2.3 7 Febuary 2003 +- Disable debugging code on the itanium that is not always safe. + +* 2.2 6 Febuary 2003 +- Always read the correct pointer when an ELF boot header is found. +- Add a printf implementation to i386-linux/convert_param.c +- Minor man page updates. + +* 2.1 27 January 2003 +- Allow an arbitrary number of kernel headers in mkelf-linux-ia64.c +- Remove unused entries from Makefile.conf.in +- Correctly report the elf note size. +- Check for broken binutils when we run, so mkelfImage does not generate incorrect images. +- Add automatic decompress of kernel images + +* 2.0 13 January 2003 +- Convert everything to C +- Add itanium support + +* 1.19 20 December 2002 + - Update to handle a Bhdr passed via the C calling conventions. + +* 1.18 9 November 2002 + - Update to work with binutils 2.13.x + +* 1.17 17 October 2002 + - Add an rpm target + - Fix Source0 in the rpm spec file + - Linux 2.5.x support + +* 1.16 29 August 2002 + - Include the source for my spec file in the tarball. + - Fix the make install target + +* 1.15 23 August 2002 + - Rewrote the perl ip checksum code to be reasonably fast + - Fixes to the initial parameter passing in head.S thanks to Jake Page <jake@CS.Stanford.EDU> + - Initial cross compiling support thanks to Jake Page <jake@CS.Stanford.EDU> + - Official specfile thanks to Andrew Ip <aip@cwlinux.com> + - Autoconf support Josh Aune <lunke@linuxnetworx.com> + +* 1.14 28 June 2002 + - Use much less complex ld magic (removed the use of PHDRS directive) + - Fix a small bug in the LinuxBIOS checksum verification code (only affected odd length tables) + +* 1.13 10 May 2002 + Include the version number in mkelfImage. + +* 1.12 26 January 2002 + Better firmware detection, and stripping excess symbols from the + generated object. + +* 1.11 24 January 2002 + Bug fix to command line processing. + +* 1.10 21 January 2002 + Starting using the PHDRS directive which many versions of ld cannot + handle correctly. The symptom is generally a file that is 9MB in + size. + + Start computing a checksum on the Image. + + Include an ELF note section in the image for out of band + information (checksum, program name, etc). + +* 1.9 7 January 2002 + I changed LinuxBIOS (in LinuxBIOS) from passing it's information + locally, to passing it in a global table that is always present. + So that whoever needs that information can get it unfiltered. And + because it isn't being passed around it has less chance of + becomming corrupt. Globals for global information are good :) + Version 1.9 goes out and finds that table. + +* 1.8 10 December 2001 + Move the ramdisk up even higher in memory. + Better debugging of multiboot parameters + Pass the correct values for a vga screen instead of telling the + kernel we have EGA... + +* 1.7 18 May 2001 + Warn when I don't have information about the bootloader. + Include a ELF compreressor that works on alpha && x86 + There is no good way to apply it though. + +* 1.6 1 Febuary 2001 + Code cleanup in bzImage support. + +* 1.5 1 Febuary 2001 + Add support for bzImage + +* 1.4 ??? + ??? + +* 1.3 27 December 2000 + Minor bug fixes for working with the e820 memory map. + +* 1.2 18 December 2000 + Work around for some versions of ld not treating /dev/null and an + empty file the same + +* 1.1 30 November 2000 + Fix for ramdisks and large amounts of memory with 2.2 series + kernels. + +* 1.0 7 November 2000 + Initial release (supports vmlinux && bvmlinux) diff --git a/util/mkelfImage/arch/i386/include/arch/io.h b/util/mkelfImage/arch/i386/include/arch/io.h new file mode 100644 index 0000000000..2ebe5dd9c6 --- /dev/null +++ b/util/mkelfImage/arch/i386/include/arch/io.h @@ -0,0 +1,64 @@ +#ifndef ARCH_IO_H +#define ARCH_IO_H + +#include <stdint.h> +/* Helper functions for directly doing I/O */ + +extern inline uint8_t inb(uint16_t port) +{ + uint8_t result; + + __asm__ __volatile__ ( + "inb %w1,%0" + :"=a" (result) + :"Nd" (port)); + return result; +} + +extern inline uint16_t inw(uint16_t port) +{ + uint16_t result; + + __asm__ __volatile__ ( + "inw %w1,%0" + :"=a" (result) + :"Nd" (port)); + return result; +} + +extern inline uint32_t inl(uint32_t port) +{ + uint32_t result; + + __asm__ __volatile__ ( + "inl %w1,%0" + :"=a" (result) + :"Nd" (port)); + return result; +} + +extern inline void outb (uint8_t value, uint16_t port) +{ + __asm__ __volatile__ ( + "outb %b0,%w1" + : + :"a" (value), "Nd" (port)); +} + +extern inline void outw (uint16_t value, uint16_t port) +{ + __asm__ __volatile__ ( + "outw %w0,%w1" + : + :"a" (value), "Nd" (port)); +} + +extern inline void outl (uint32_t value, uint16_t port) +{ + __asm__ __volatile__ ( + "outl %0,%w1" + : + :"a" (value), "Nd" (port)); +} + +#endif /* ARCH_IO_H */ diff --git a/util/mkelfImage/arch/i386/include/limits.h b/util/mkelfImage/arch/i386/include/limits.h new file mode 100644 index 0000000000..d5a5a02c6f --- /dev/null +++ b/util/mkelfImage/arch/i386/include/limits.h @@ -0,0 +1,58 @@ +#ifndef LIMITS_H +#define LIMITS_H 1 + + +/* Number of bits in a `char' */ +#define CHAR_BIT 8 + +/* Minimum and maximum values a `signed char' can hold */ +#define SCHAR_MIN (-128) +#define SCHAR_MAX 127 + +/* Maximum value an `unsigned char' can hold. (Minimum is 0.) */ +#define UCHAR_MAX 255 + +/* Minimum and maximum values a `char' can hold */ +#define CHAR_MIN SCHAR_MIN +#define CHAR_MAX SCHAR_MAX + +/* Minimum and maximum values a `signed short int' can hold */ +#define SHRT_MIN (-32768) +#define SHRT_MAX 32767 + +/* Maximum value an `unsigned short' can hold. (Minimum is 0.) */ +#define USHRT_MAX 65535 + + +/* Minimum and maximum values a `signed int' can hold */ +#define INT_MIN (-INT_MAX - 1) +#define INT_MAX 2147483647 + +/* Maximum value an `unsigned int' can hold. (Minimum is 0.) */ +#define UINT_MAX 4294967295U + + +/* Minimum and maximum values a `signed int' can hold */ +#define INT_MIN (-INT_MAX - 1) +#define INT_MAX 2147483647 + +/* Maximum value an `unsigned int' can hold. (Minimum is 0.) */ +#define UINT_MAX 4294967295U + +/* Minimum and maximum values a `signed long' can hold */ +#define LONG_MAX 2147483647L +#define LONG_MIN (-LONG_MAX - 1L) + +/* Maximum value an `unsigned long' can hold. (Minimum is 0.) */ +#define ULONG_MAX 4294967295UL + +/* Minimum and maximum values a `signed long long' can hold */ +#define LLONG_MAX 9223372036854775807LL +#define LLONG_MIN (-LONG_MAX - 1LL) + + +/* Maximum value an `unsigned long long' can hold. (Minimum is 0.) */ +#define ULLONG_MAX 18446744073709551615ULL + + +#endif /* LIMITS_H */ diff --git a/util/mkelfImage/arch/i386/include/stdint.h b/util/mkelfImage/arch/i386/include/stdint.h new file mode 100644 index 0000000000..79262c206c --- /dev/null +++ b/util/mkelfImage/arch/i386/include/stdint.h @@ -0,0 +1,16 @@ +#ifndef STDINT_H +#define STDINT_H + +typedef unsigned long size_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; + +#endif /* STDINT_H */ diff --git a/util/mkelfImage/arch/ia64/include/limits.h b/util/mkelfImage/arch/ia64/include/limits.h new file mode 100644 index 0000000000..0c6f21f9e0 --- /dev/null +++ b/util/mkelfImage/arch/ia64/include/limits.h @@ -0,0 +1,57 @@ +#ifndef LIMITS_H +#define LIMITS_H 1 + +/* Number of bits in a `char' */ +#define CHAR_BIT 8 + +/* Minimum and maximum values a `signed char' can hold */ +#define SCHAR_MIN (-128) +#define SCHAR_MAX 127 + +/* Maximum value an `unsigned char' can hold. (Minimum is 0.) */ +#define UCHAR_MAX 255 + +/* Minimum and maximum values a `char' can hold */ +#define CHAR_MIN SCHAR_MIN +#define CHAR_MAX SCHAR_MAX + +/* Minimum and maximum values a `signed short int' can hold */ +#define SHRT_MIN (-32768) +#define SHRT_MAX 32767 + +/* Maximum value an `unsigned short' can hold. (Minimum is 0.) */ +#define USHRT_MAX 65535 + + +/* Minimum and maximum values a `signed int' can hold */ +#define INT_MIN (-INT_MAX - 1) +#define INT_MAX 2147483647 + +/* Maximum value an `unsigned int' can hold. (Minimum is 0.) */ +#define UINT_MAX 4294967295U + + +/* Minimum and maximum values a `signed int' can hold */ +#define INT_MIN (-INT_MAX - 1) +#define INT_MAX 2147483647 + +/* Maximum value an `unsigned int' can hold. (Minimum is 0.) */ +#define UINT_MAX 4294967295U + +/* Minimum and maximum values a `signed long' can hold */ +#define LONG_MAX 9223372036854775807L +#define LONG_MIN (-LONG_MAX - 1L) + +/* Maximum value an `unsigned long' can hold. (Minimum is 0.) */ +#define ULONG_MAX 18446744073709551615UL + +/* Minimum and maximum values a `signed long long' can hold */ +#define LLONG_MAX 9223372036854775807LL +#define LLONG_MIN (-LONG_MAX - 1LL) + + +/* Maximum value an `unsigned long long' can hold. (Minimum is 0.) */ +#define ULLONG_MAX 18446744073709551615ULL + + +#endif /* LIMITS_H */ diff --git a/util/mkelfImage/arch/ia64/include/stdint.h b/util/mkelfImage/arch/ia64/include/stdint.h new file mode 100644 index 0000000000..2f9c592c33 --- /dev/null +++ b/util/mkelfImage/arch/ia64/include/stdint.h @@ -0,0 +1,16 @@ +#ifndef STDINT_H +#define STDINT_H + +typedef unsigned long size_t; + +typedef unsigned char uint8_t; +typedef unsigned short uint16_t; +typedef unsigned int uint32_t; +typedef unsigned long uint64_t; + +typedef signed char int8_t; +typedef signed short int16_t; +typedef signed int int32_t; +typedef signed long int64_t; + +#endif /* STDINT_H */ diff --git a/util/mkelfImage/config/config.guess b/util/mkelfImage/config/config.guess new file mode 100755 index 0000000000..ed2e03b7f2 --- /dev/null +++ b/util/mkelfImage/config/config.guess @@ -0,0 +1,1321 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002 Free Software Foundation, Inc. + +timestamp='2002-03-20' + +# This file 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Per Bothner <per@bothner.com>. +# Please send patches to <config-patches@gnu.org>. Submit a context +# diff and a properly formatted ChangeLog entry. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit build system type. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to <config-patches@gnu.org>." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + + +dummy=dummy-$$ +trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int dummy(){}" > $dummy.c ; + for c in cc gcc c89 c99 ; do + ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ; + if test $? = 0 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + rm -f $dummy.c $dummy.o $dummy.rel ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + case "${UNAME_MACHINE_ARCH}" in + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE_ARCH}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit 0 ;; + amiga:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + arc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + hp300:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mac68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + macppc:OpenBSD:*:*) + echo powerpc-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme88k:OpenBSD:*:*) + echo m88k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvmeppc:OpenBSD:*:*) + echo powerpc-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + pmax:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sgi:OpenBSD:*:*) + echo mipseb-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sun3:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + wgrisc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + *:OpenBSD:*:*) + echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + alpha:OSF1:*:*) + if test $UNAME_RELEASE = "V4.0"; then + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + fi + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + cat <<EOF >$dummy.s + .data +\$Lformat: + .byte 37,100,45,37,120,10,0 # "%d-%x\n" + + .text + .globl main + .align 4 + .ent main +main: + .frame \$30,16,\$26,0 + ldgp \$29,0(\$27) + .prologue 1 + .long 0x47e03d80 # implver \$0 + lda \$2,-1 + .long 0x47e20c21 # amask \$2,\$1 + lda \$16,\$Lformat + mov \$0,\$17 + not \$1,\$18 + jsr \$26,printf + ldgp \$29,0(\$26) + mov 0,\$16 + jsr \$26,exit + .end main +EOF + eval $set_cc_for_build + $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null + if test "$?" = 0 ; then + case `./$dummy` in + 0-0) + UNAME_MACHINE="alpha" + ;; + 1-0) + UNAME_MACHINE="alphaev5" + ;; + 1-1) + UNAME_MACHINE="alphaev56" + ;; + 1-101) + UNAME_MACHINE="alphapca56" + ;; + 2-303) + UNAME_MACHINE="alphaev6" + ;; + 2-307) + UNAME_MACHINE="alphaev67" + ;; + 2-1307) + UNAME_MACHINE="alphaev68" + ;; + esac + fi + rm -f $dummy.s $dummy + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit 0 ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit 0 ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit 0 ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit 0;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit 0 ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos + exit 0 ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit 0 ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit 0;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit 0;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit 0 ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit 0 ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + i86pc:SunOS:5.*:*) + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit 0 ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit 0 ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit 0 ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit 0 ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit 0 ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit 0 ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit 0 ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit 0 ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit 0 ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit 0 ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include <stdio.h> /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy \ + && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ + && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo mips-mips-riscos${UNAME_RELEASE} + exit 0 ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit 0 ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit 0 ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit 0 ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit 0 ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit 0 ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit 0 ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit 0 ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit 0 ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit 0 ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit 0 ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit 0 ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit 0 ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include <sys/systemcfg.h> + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo rs6000-ibm-aix3.2.5 + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit 0 ;; + *:AIX:*:[45]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit 0 ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit 0 ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit 0 ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit 0 ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit 0 ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit 0 ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit 0 ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include <stdlib.h> + #include <unistd.h> + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null) && HP_ARCH=`./$dummy` + if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi + rm -f $dummy.c $dummy + fi ;; + esac + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit 0 ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit 0 ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include <unistd.h> + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo unknown-hitachi-hiuxwe2 + exit 0 ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit 0 ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit 0 ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit 0 ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit 0 ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit 0 ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit 0 ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit 0 ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit 0 ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit 0 ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit 0 ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit 0 ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*T3D:*:*:*) + echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit 0 ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit 0 ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:FreeBSD:*:*) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit 0 ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit 0 ;; + i*:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit 0 ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit 0 ;; + x86:Interix*:3*) + echo i386-pc-interix3 + exit 0 ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i386-pc-interix + exit 0 ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit 0 ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit 0 ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + *:GNU:*:*) + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit 0 ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit 0 ;; + arm*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + mips:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips + #undef mipsel + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mipsel + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` + rm -f $dummy.c + test x"${CPU}" != x && echo "${CPU}-pc-linux-gnu" && exit 0 + ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit 0 ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit 0 ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit 0 ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit 0 ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit 0 ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit 0 ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit 0 ;; + i*86:Linux:*:*) + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + # Set LC_ALL=C to ensure ld outputs messages in English. + ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ + | sed -ne '/supported targets:/!d + s/[ ][ ]*/ /g + s/.*supported targets: *// + s/ .*// + p'` + case "$ld_supported_targets" in + elf32-i386) + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + ;; + a.out-i386-linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit 0 ;; + coff-i386) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" + exit 0 ;; + "") + # Either a pre-BFD a.out linker (linux-gnuoldld) or + # one that does not give us useful --help. + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + exit 0 ;; + esac + # Determine whether the default compiler is a.out or elf + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include <features.h> + #ifdef __ELF__ + # ifdef __GLIBC__ + # if __GLIBC__ >= 2 + LIBC=gnu + # else + LIBC=gnulibc1 + # endif + # else + LIBC=gnulibc1 + # endif + #else + #ifdef __INTEL_COMPILER + LIBC=gnu + #else + LIBC=gnuaout + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` + rm -f $dummy.c + test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 + test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 + ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit 0 ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit 0 ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit 0 ;; + i*86:*:5:[78]*) + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit 0 ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name` + echo ${UNAME_MACHINE}-pc-isc$UNAME_REL + elif /bin/uname -X 2>/dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` + (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit 0 ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit 0 ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i386. + echo i386-pc-msdosdjgpp + exit 0 ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit 0 ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit 0 ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit 0 ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit 0 ;; + M68*:*:R3V[567]*:*) + test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; + 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4.3${OS_REL} && exit 0 + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4 && exit 0 ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit 0 ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit 0 ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit 0 ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says <Richard.M.Bartel@ccMail.Census.GOV> + echo i586-unisys-sysv4 + exit 0 ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes <hewes@openmarket.com>. + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit 0 ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit 0 ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit 0 ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit 0 ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit 0 ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit 0 ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit 0 ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit 0 ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit 0 ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit 0 ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit 0 ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Darwin:*:*) + echo `uname -p`-apple-darwin${UNAME_RELEASE} + exit 0 ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + exit 0 ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit 0 ;; + NSR-[GKLNPTVW]:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit 0 ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit 0 ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit 0 ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit 0 ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit 0 ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit 0 ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit 0 ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit 0 ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit 0 ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit 0 ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit 0 ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit 0 ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit 0 ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit 0 ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +eval $set_cc_for_build +cat >$dummy.c <<EOF +#ifdef _SEQUENT_ +# include <sys/types.h> +# include <sys/utsname.h> +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include <sys/param.h> + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include <sys/param.h> +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0 +rm -f $dummy.c $dummy + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit 0 ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + c34*) + echo c34-convex-bsd + exit 0 ;; + c38*) + echo c38-convex-bsd + exit 0 ;; + c4*) + echo c4-convex-bsd + exit 0 ;; + esac +fi + +cat >&2 <<EOF +$0: unable to guess system type + +This script, last modified $timestamp, has failed to recognize +the operating system you are using. It is advised that you +download the most up to date version of the config scripts from + + ftp://ftp.gnu.org/pub/gnu/config/ + +If the version you run ($0) is already up to date, please +send the following data and any information you think might be +pertinent to <config-patches@gnu.org> in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/util/mkelfImage/config/config.sub b/util/mkelfImage/config/config.sub new file mode 100755 index 0000000000..f3657978c7 --- /dev/null +++ b/util/mkelfImage/config/config.sub @@ -0,0 +1,1443 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002 Free Software Foundation, Inc. + +timestamp='2002-03-07' + +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file 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., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Please send patches to <config-patches@gnu.org>. Submit a context +# diff and a properly formatted ChangeLog entry. +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to <config-patches@gnu.org>." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit 0;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis) + os= + basic_machine=$1 + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ + | c4x | clipper \ + | d10v | d30v | dsp16xx \ + | fr30 \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | m32r | m68000 | m68k | m88k | mcore \ + | mips | mips16 | mips64 | mips64el | mips64orion | mips64orionel \ + | mips64vr4100 | mips64vr4100el | mips64vr4300 \ + | mips64vr4300el | mips64vr5000 | mips64vr5000el \ + | mipsbe | mipseb | mipsel | mipsle | mipstx39 | mipstx39el \ + | mipsisa32 | mipsisa64 \ + | mn10200 | mn10300 \ + | ns16k | ns32k \ + | openrisc | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | sh | sh[34] | sh[34]eb | shbe | shle | sh64 \ + | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ + | strongarm \ + | tahoe | thumb | tic80 | tron \ + | v850 | v850e \ + | we32k \ + | x86 | xscale | xstormy16 | xtensa \ + | z8k) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armv*-* \ + | avr-* \ + | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c54x-* \ + | clipper-* | cydra-* \ + | d10v-* | d30v-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fr30-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | m32r-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | mcore-* \ + | mips-* | mips16-* | mips64-* | mips64el-* | mips64orion-* \ + | mips64orionel-* | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* | mipsbe-* | mipseb-* \ + | mipsle-* | mipsel-* | mipstx39-* | mipstx39el-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | romp-* | rs6000-* \ + | sh-* | sh[34]-* | sh[34]eb-* | shbe-* | shle-* | sh64-* \ + | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ + | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \ + | v850-* | v850e-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ + | xtensa-* \ + | ymp-* \ + | z8k-*) + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | j90) + basic_machine=j90-cray + os=-unicos + ;; + crds | unos) + basic_machine=m68k-crds + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + mmix*) + basic_machine=mmix-knuth + os=-mmixware + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + or32 | or32-*) + basic_machine=or32-unknown + os=-coff + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon) + basic_machine=i686-pc + ;; + pentiumii | pentium2) + basic_machine=i686-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sparclite-wrs | simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3d) + basic_machine=alpha-cray + os=-unicos + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + windows32) + basic_machine=i386-pc + os=-windows32-msvcrt + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + romp) + basic_machine=romp-ibm + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh3 | sh4 | sh3eb | sh4eb) + basic_machine=sh-unknown + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparc | sparcv9 | sparcv9b) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + c4x*) + basic_machine=c4x-none + os=-coff + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ + | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto*) + os=-nto-qnx + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -atheos*) + os=-atheos + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -nova*) + os=-rtmk-nova + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + or32-*) + os=-coff + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-ibm) + os=-aix + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -vxsim* | -vxworks*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/util/mkelfImage/config/install-sh b/util/mkelfImage/config/install-sh new file mode 100755 index 0000000000..e9de23842d --- /dev/null +++ b/util/mkelfImage/config/install-sh @@ -0,0 +1,251 @@ +#!/bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5 (mit/util/scripts/install.sh). +# +# Copyright 1991 by the Massachusetts Institute of Technology +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of M.I.T. not be used in advertising or +# publicity pertaining to distribution of the software without specific, +# written prior permission. M.I.T. makes no representations about the +# suitability of this software for any purpose. It is provided "as is" +# without express or implied warranty. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + chmodcmd="" + else + instcmd=mkdir + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff --git a/util/mkelfImage/configure b/util/mkelfImage/configure new file mode 100755 index 0000000000..fd5669a6e3 --- /dev/null +++ b/util/mkelfImage/configure @@ -0,0 +1,5276 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.59. +# +# Copyright (C) 2003 Free Software Foundation, Inc. +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi +DUALCASE=1; export DUALCASE # for MKS sh + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +exec 6>&1 + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_config_libobj_dir=. +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Maximum number of lines to put in a shell here document. +# This variable seems obsolete. It should probably be removed, and +# only ac_max_sed_lines should be used. +: ${ac_max_here_lines=38} + +# Identity of this package. +PACKAGE_NAME= +PACKAGE_TARNAME= +PACKAGE_VERSION= +PACKAGE_STRING= +PACKAGE_BUGREPORT= + +ac_unique_file="Makefile.conf.in" +# Factoring default headers for most tests. +ac_includes_default="\ +#include <stdio.h> +#if HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif +#if HAVE_SYS_STAT_H +# include <sys/stat.h> +#endif +#if STDC_HEADERS +# include <stdlib.h> +# include <stddef.h> +#else +# if HAVE_STDLIB_H +# include <stdlib.h> +# endif +#endif +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include <memory.h> +# endif +# include <string.h> +#endif +#if HAVE_STRINGS_H +# include <strings.h> +#endif +#if HAVE_INTTYPES_H +# include <inttypes.h> +#else +# if HAVE_STDINT_H +# include <stdint.h> +# endif +#endif +#if HAVE_UNISTD_H +# include <unistd.h> +#endif" + +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT MKDIR RM CP LN TAR RPM SED FIND CPP EGREP LD ac_ct_LD AS ac_ct_AS OBJCOPY ac_ct_OBJCOPY I386_CC I386_CPP I386_LD I386_AS I386_OBJCOPY IA64_CC IA64_CPP IA64_LD IA64_AS IA64_OBJCOPY HOST_CC HOST_CFLAGS I386_CFLAGS I386_ASFLAGS I386_LDFLAGS IA64_CFLAGS IA64_ASFLAGS IA64_LDFLAGS LIBOBJS LTLIBOBJS' +ac_subst_files='' + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +ac_prev= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_option in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + eval "enable_$ac_feature=no" ;; + + -enable-* | --enable-*) + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "enable_$ac_feature='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package| sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "with_$ac_package='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/-/_/g'` + eval "with_$ac_package=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) { echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` + eval "$ac_envvar='$ac_optarg'" + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } +fi + +# Be sure to have absolute paths. +for ac_var in exec_prefix prefix +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* | NONE | '' ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# Be sure to have absolute paths. +for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ + localstatedir libdir includedir oldincludedir infodir mandir +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_confdir=`(dirname "$0") 2>/dev/null || +$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$0" : 'X\(//\)[^/]' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$0" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 + { (exit 1); exit 1; }; } + else + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } + fi +fi +(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || + { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 + { (exit 1); exit 1; }; } +srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` +ac_env_build_alias_set=${build_alias+set} +ac_env_build_alias_value=$build_alias +ac_cv_env_build_alias_set=${build_alias+set} +ac_cv_env_build_alias_value=$build_alias +ac_env_host_alias_set=${host_alias+set} +ac_env_host_alias_value=$host_alias +ac_cv_env_host_alias_set=${host_alias+set} +ac_cv_env_host_alias_value=$host_alias +ac_env_target_alias_set=${target_alias+set} +ac_env_target_alias_value=$target_alias +ac_cv_env_target_alias_set=${target_alias+set} +ac_cv_env_target_alias_value=$target_alias +ac_env_CC_set=${CC+set} +ac_env_CC_value=$CC +ac_cv_env_CC_set=${CC+set} +ac_cv_env_CC_value=$CC +ac_env_CFLAGS_set=${CFLAGS+set} +ac_env_CFLAGS_value=$CFLAGS +ac_cv_env_CFLAGS_set=${CFLAGS+set} +ac_cv_env_CFLAGS_value=$CFLAGS +ac_env_LDFLAGS_set=${LDFLAGS+set} +ac_env_LDFLAGS_value=$LDFLAGS +ac_cv_env_LDFLAGS_set=${LDFLAGS+set} +ac_cv_env_LDFLAGS_value=$LDFLAGS +ac_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_env_CPPFLAGS_value=$CPPFLAGS +ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_cv_env_CPPFLAGS_value=$CPPFLAGS +ac_env_CPP_set=${CPP+set} +ac_env_CPP_value=$CPP +ac_cv_env_CPP_set=${CPP+set} +ac_cv_env_CPP_value=$CPP + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures this package to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +_ACEOF + + cat <<_ACEOF +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data [PREFIX/share] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --infodir=DIR info documentation [PREFIX/info] + --mandir=DIR man documentation [PREFIX/man] +_ACEOF + + cat <<\_ACEOF + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] +_ACEOF +fi + +if test -n "$ac_init_help"; then + + cat <<\_ACEOF + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-i386 enable building i386 code + --with-ia64 enable building ia64 code + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a + nonstandard directory <lib dir> + CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have + headers in a nonstandard directory <include dir> + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +_ACEOF +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + ac_popdir=`pwd` + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d $ac_dir || continue + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + cd $ac_dir + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_srcdir/configure.gnu; then + echo + $SHELL $ac_srcdir/configure.gnu --help=recursive + elif test -f $ac_srcdir/configure; then + echo + $SHELL $ac_srcdir/configure --help=recursive + elif test -f $ac_srcdir/configure.ac || + test -f $ac_srcdir/configure.in; then + echo + $ac_configure --help + else + echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi + cd $ac_popdir + done +fi + +test -n "$ac_init_help" && exit 0 +if $ac_init_version; then + cat <<\_ACEOF + +Copyright (C) 2003 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit 0 +fi +exec 5>config.log +cat >&5 <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by $as_me, which was +generated by GNU Autoconf 2.59. Invocation command line was + + $ $0 $@ + +_ACEOF +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +hostinfo = `(hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + echo "PATH: $as_dir" +done + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_sep= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 2) + ac_configure_args1="$ac_configure_args1 '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" + # Get rid of the leading space. + ac_sep=" " + ;; + esac + done +done +$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } +$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Be sure not to use single quotes in there, as some shells, +# such as our DU 5.0 friend, will then `close' the trap. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + cat <<\_ASBOX +## ---------------- ## +## Cache variables. ## +## ---------------- ## +_ASBOX + echo + # The following way of writing the cache mishandles newlines in values, +{ + (set) 2>&1 | + case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in + *ac_space=\ *) + sed -n \ + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + ;; + *) + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} + echo + + cat <<\_ASBOX +## ----------------- ## +## Output variables. ## +## ----------------- ## +_ASBOX + echo + for ac_var in $ac_subst_vars + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + + if test -n "$ac_subst_files"; then + cat <<\_ASBOX +## ------------- ## +## Output files. ## +## ------------- ## +_ASBOX + echo + for ac_var in $ac_subst_files + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + fi + + if test -s confdefs.h; then + cat <<\_ASBOX +## ----------- ## +## confdefs.h. ## +## ----------- ## +_ASBOX + echo + sed "/^$/d" confdefs.h | sort + echo + fi + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" + echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core && + rm -rf conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status + ' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo >confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:$LINENO: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . $cache_file;; + *) . ./$cache_file;; + esac + fi +else + { echo "$as_me:$LINENO: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in `(set) 2>&1 | + sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val="\$ac_cv_env_${ac_var}_value" + eval ac_new_val="\$ac_env_${ac_var}_value" + case $ac_old_set,$ac_new_set in + set,) + { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + + + + + + + + + + + + + +ac_aux_dir= +for ac_dir in ./config $srcdir/./config; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f $ac_dir/shtool; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in ./config $srcdir/./config" >&5 +echo "$as_me: error: cannot find install-sh or install.sh in ./config $srcdir/./config" >&2;} + { (exit 1); exit 1; }; } +fi +ac_config_guess="$SHELL $ac_aux_dir/config.guess" +ac_config_sub="$SHELL $ac_aux_dir/config.sub" +ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. + + + + +# Make sure we can run config.sub. +$ac_config_sub sun4 >/dev/null 2>&1 || + { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 +echo "$as_me: error: cannot run $ac_config_sub" >&2;} + { (exit 1); exit 1; }; } + +echo "$as_me:$LINENO: checking build system type" >&5 +echo $ECHO_N "checking build system type... $ECHO_C" >&6 +if test "${ac_cv_build+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_build_alias=$build_alias +test -z "$ac_cv_build_alias" && + ac_cv_build_alias=`$ac_config_guess` +test -z "$ac_cv_build_alias" && + { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 +echo "$as_me: error: cannot guess build type; you must specify one" >&2;} + { (exit 1); exit 1; }; } +ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || + { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:$LINENO: result: $ac_cv_build" >&5 +echo "${ECHO_T}$ac_cv_build" >&6 +build=$ac_cv_build +build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + + +echo "$as_me:$LINENO: checking host system type" >&5 +echo $ECHO_N "checking host system type... $ECHO_C" >&6 +if test "${ac_cv_host+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_host_alias=$host_alias +test -z "$ac_cv_host_alias" && + ac_cv_host_alias=$ac_cv_build_alias +ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || + { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:$LINENO: result: $ac_cv_host" >&5 +echo "${ECHO_T}$ac_cv_host" >&6 +host=$ac_cv_host +host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + + +#AC_CANONICAL_TARGET + + +case $host_cpu in + i?86 ) + target_cpu="i386" + ;; + * ) + target_cpu="$host_cpu" + ;; +esac + +targets="" + + +# Check whether --with-i386 or --without-i386 was given. +if test "${with_i386+set}" = set; then + withval="$with_i386" + if test "withval" = "yes" ; then with_i386="i386"; else with_i386="$withval"; fi +else + with_i386="no" +fi; + + +# Check whether --with-ia64 or --without-ia64 was given. +if test "${with_ia64+set}" = set; then + withval="$with_ia64" + if test "withval" = "yes" ; then with_ia64="ia64"; else with_ia64="$withval"; fi +else + with_ia64="no" +fi; + +with_default="no" +if test "$with_i386" = "no" && + test "$with_ia64" = "no" ; then + with_default=`echo $target_cpu | tr a-z A-Z` +fi + +{ echo "$as_me:$LINENO: with_default=$with_default" >&5 +echo "$as_me: with_default=$with_default" >&6;} +{ echo "$as_me:$LINENO: with_i386=$with_i386" >&5 +echo "$as_me: with_i386=$with_i386" >&6;} +{ echo "$as_me:$LINENO: with_ia64=$with_ia64" >&5 +echo "$as_me: with_ia64=$with_ia64" >&6;} + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_CC" && break +done + + CC=$ac_ct_CC +fi + +fi + + +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO:" \ + "checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5 + (eval $ac_compiler --version </dev/null >&5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5 + (eval $ac_compiler -v </dev/null >&5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5 + (eval $ac_compiler -V </dev/null >&5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 +echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 + (eval $ac_link_default) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Find the output, starting from the most likely. This scheme is +# not robust to junk in `.', hence go to wildcards (a.*) only as a last +# resort. + +# Be careful to initialize this variable, since it used to be cached. +# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. +ac_cv_exeext= +# b.out is created by i960 compilers. +for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) + ;; + conftest.$ac_ext ) + # This is the source file. + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + # FIXME: I believe we export ac_cv_exeext for Libtool, + # but it would be cool to find out if it's true. Does anybody + # maintain Libtool? --akim. + export ac_cv_exeext + break;; + * ) + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables +See \`config.log' for more details." >&5 +echo "$as_me: error: C compiler cannot create executables +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6 + +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:$LINENO: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + fi + fi +fi +echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +rm -f a.out a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6 + +echo "$as_me:$LINENO: checking for suffix of executables" >&5 +echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6 + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +echo "$as_me:$LINENO: checking for suffix of object files" >&5 +echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6 +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_compiler_gnu=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +CFLAGS="-g" +echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_cc_g=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 +echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_stdc=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <stdarg.h> +#include <stdio.h> +#include <sys/types.h> +#include <sys/stat.h> +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std1 is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std1. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX 10.20 and later -Ae +# HP-UX older versions -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_stdc=$ac_arg +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext +done +rm -f conftest.$ac_ext conftest.$ac_objext +CC=$ac_save_CC + +fi + +case "x$ac_cv_prog_cc_stdc" in + x|xno) + echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 ;; + *) + echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 + CC="$CC $ac_cv_prog_cc_stdc" ;; +esac + +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +#ifndef __cplusplus + choke me +#endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ + '' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +#include <stdlib.h> +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +continue +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + +# Extract the first word of "mkdir", so it can be a program name with args. +set dummy mkdir; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_MKDIR+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$MKDIR"; then + ac_cv_prog_MKDIR="$MKDIR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_MKDIR="mkdir" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +MKDIR=$ac_cv_prog_MKDIR +if test -n "$MKDIR"; then + echo "$as_me:$LINENO: result: $MKDIR" >&5 +echo "${ECHO_T}$MKDIR" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +# Extract the first word of "rm", so it can be a program name with args. +set dummy rm; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_RM+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$RM"; then + ac_cv_prog_RM="$RM" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_RM="rm" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +RM=$ac_cv_prog_RM +if test -n "$RM"; then + echo "$as_me:$LINENO: result: $RM" >&5 +echo "${ECHO_T}$RM" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +# Extract the first word of "cp", so it can be a program name with args. +set dummy cp; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CP"; then + ac_cv_prog_CP="$CP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CP="cp" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CP=$ac_cv_prog_CP +if test -n "$CP"; then + echo "$as_me:$LINENO: result: $CP" >&5 +echo "${ECHO_T}$CP" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +# Extract the first word of "ln", so it can be a program name with args. +set dummy ln; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_LN+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$LN"; then + ac_cv_prog_LN="$LN" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_LN="ln" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +LN=$ac_cv_prog_LN +if test -n "$LN"; then + echo "$as_me:$LINENO: result: $LN" >&5 +echo "${ECHO_T}$LN" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +# Extract the first word of "tar", so it can be a program name with args. +set dummy tar; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_TAR+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$TAR"; then + ac_cv_prog_TAR="$TAR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_TAR="tar" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +TAR=$ac_cv_prog_TAR +if test -n "$TAR"; then + echo "$as_me:$LINENO: result: $TAR" >&5 +echo "${ECHO_T}$TAR" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +# Extract the first word of "rpm", so it can be a program name with args. +set dummy rpm; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_RPM+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$RPM"; then + ac_cv_prog_RPM="$RPM" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_RPM="rpm" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +RPM=$ac_cv_prog_RPM +if test -n "$RPM"; then + echo "$as_me:$LINENO: result: $RPM" >&5 +echo "${ECHO_T}$RPM" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +# Extract the first word of "sed", so it can be a program name with args. +set dummy sed; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_SED+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$SED"; then + ac_cv_prog_SED="$SED" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_SED="sed" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +SED=$ac_cv_prog_SED +if test -n "$SED"; then + echo "$as_me:$LINENO: result: $SED" >&5 +echo "${ECHO_T}$SED" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +# Extract the first word of "find", so it can be a program name with args. +set dummy find; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_FIND+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$FIND"; then + ac_cv_prog_FIND="$FIND" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_FIND="find" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +FIND=$ac_cv_prog_FIND +if test -n "$FIND"; then + echo "$as_me:$LINENO: result: $FIND" >&5 +echo "${ECHO_T}$FIND" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + # <limits.h> exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <ac_nonexistent.h> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +echo "$as_me:$LINENO: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6 +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + # <limits.h> exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <ac_nonexistent.h> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +echo "$as_me:$LINENO: checking for egrep" >&5 +echo $ECHO_N "checking for egrep... $ECHO_C" >&6 +if test "${ac_cv_prog_egrep+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if echo a | (grep -E '(a|b)') >/dev/null 2>&1 + then ac_cv_prog_egrep='grep -E' + else ac_cv_prog_egrep='egrep' + fi +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 +echo "${ECHO_T}$ac_cv_prog_egrep" >&6 + EGREP=$ac_cv_prog_egrep + + +echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <stdlib.h> +#include <stdarg.h> +#include <string.h> +#include <float.h> + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_stdc=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <string.h> + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <stdlib.h> + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <ctype.h> +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + exit(2); + exit (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6 +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. + + + + + + + + + +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +if test "${ac_cv_header_zlib_h+set}" = set; then + echo "$as_me:$LINENO: checking for zlib.h" >&5 +echo $ECHO_N "checking for zlib.h... $ECHO_C" >&6 +if test "${ac_cv_header_zlib_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_zlib_h" >&5 +echo "${ECHO_T}$ac_cv_header_zlib_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking zlib.h usability" >&5 +echo $ECHO_N "checking zlib.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <zlib.h> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking zlib.h presence" >&5 +echo $ECHO_N "checking zlib.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <zlib.h> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: zlib.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: zlib.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: zlib.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: zlib.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: zlib.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: zlib.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: zlib.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: zlib.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: zlib.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: zlib.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: zlib.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: zlib.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: zlib.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: zlib.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: zlib.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: zlib.h: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for zlib.h" >&5 +echo $ECHO_N "checking for zlib.h... $ECHO_C" >&6 +if test "${ac_cv_header_zlib_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_zlib_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_zlib_h" >&5 +echo "${ECHO_T}$ac_cv_header_zlib_h" >&6 + +fi +if test $ac_cv_header_zlib_h = yes; then + echo "$as_me:$LINENO: checking for inflateInit_ in -lz" >&5 +echo $ECHO_N "checking for inflateInit_ in -lz... $ECHO_C" >&6 +if test "${ac_cv_lib_z_inflateInit_+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lz $LIBS" + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char inflateInit_ (); +int +main () +{ +inflateInit_ (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_z_inflateInit_=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_z_inflateInit_=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_z_inflateInit_" >&5 +echo "${ECHO_T}$ac_cv_lib_z_inflateInit_" >&6 +if test $ac_cv_lib_z_inflateInit_ = yes; then + cat >>confdefs.h <<\_ACEOF +#define HAVE_ZLIB_H 1 +_ACEOF + LIBS="$LIBS -lz" +fi + +fi + + + +if test "with_default" != no ; then + if test "$CC" = no; then + { { echo "$as_me:$LINENO: error: cc not found" >&5 +echo "$as_me: error: cc not found" >&2;} + { (exit 1); exit 1; }; } + fi + eval "${with_default}_CC='$CC'" + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + # <limits.h> exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <ac_nonexistent.h> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +echo "$as_me:$LINENO: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6 +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + # <limits.h> exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <ac_nonexistent.h> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + if test "$CPP" = no; then + { { echo "$as_me:$LINENO: error: cpp not found" >&5 +echo "$as_me: error: cpp not found" >&2;} + { (exit 1); exit 1; }; } + fi + eval "${with_default}_CPP='$CPP'" + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ld", so it can be a program name with args. +set dummy ${ac_tool_prefix}ld; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_LD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$LD"; then + ac_cv_prog_LD="$LD" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_LD="${ac_tool_prefix}ld" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +LD=$ac_cv_prog_LD +if test -n "$LD"; then + echo "$as_me:$LINENO: result: $LD" >&5 +echo "${ECHO_T}$LD" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_LD"; then + ac_ct_LD=$LD + # Extract the first word of "ld", so it can be a program name with args. +set dummy ld; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_LD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_LD"; then + ac_cv_prog_ac_ct_LD="$ac_ct_LD" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_LD="ld" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_LD" && ac_cv_prog_ac_ct_LD="no" +fi +fi +ac_ct_LD=$ac_cv_prog_ac_ct_LD +if test -n "$ac_ct_LD"; then + echo "$as_me:$LINENO: result: $ac_ct_LD" >&5 +echo "${ECHO_T}$ac_ct_LD" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + LD=$ac_ct_LD +else + LD="$ac_cv_prog_LD" +fi + + if test "$LD" = no; then + { { echo "$as_me:$LINENO: error: ld not found" >&5 +echo "$as_me: error: ld not found" >&2;} + { (exit 1); exit 1; }; } + fi + eval "${with_default}_LD='$LD'" + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args. +set dummy ${ac_tool_prefix}as; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_AS+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$AS"; then + ac_cv_prog_AS="$AS" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AS="${ac_tool_prefix}as" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +AS=$ac_cv_prog_AS +if test -n "$AS"; then + echo "$as_me:$LINENO: result: $AS" >&5 +echo "${ECHO_T}$AS" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_AS"; then + ac_ct_AS=$AS + # Extract the first word of "as", so it can be a program name with args. +set dummy as; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_AS+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_AS"; then + ac_cv_prog_ac_ct_AS="$ac_ct_AS" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_AS="as" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_AS" && ac_cv_prog_ac_ct_AS="no" +fi +fi +ac_ct_AS=$ac_cv_prog_ac_ct_AS +if test -n "$ac_ct_AS"; then + echo "$as_me:$LINENO: result: $ac_ct_AS" >&5 +echo "${ECHO_T}$ac_ct_AS" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + AS=$ac_ct_AS +else + AS="$ac_cv_prog_AS" +fi + + if test "$AS" = no; then + { { echo "$as_me:$LINENO: error: as not found" >&5 +echo "$as_me: error: as not found" >&2;} + { (exit 1); exit 1; }; } + fi + eval "${with_default}_AS='$AS'" + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}objcopy", so it can be a program name with args. +set dummy ${ac_tool_prefix}objcopy; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_OBJCOPY+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$OBJCOPY"; then + ac_cv_prog_OBJCOPY="$OBJCOPY" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_OBJCOPY="${ac_tool_prefix}objcopy" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +OBJCOPY=$ac_cv_prog_OBJCOPY +if test -n "$OBJCOPY"; then + echo "$as_me:$LINENO: result: $OBJCOPY" >&5 +echo "${ECHO_T}$OBJCOPY" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_OBJCOPY"; then + ac_ct_OBJCOPY=$OBJCOPY + # Extract the first word of "objcopy", so it can be a program name with args. +set dummy objcopy; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_OBJCOPY+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_OBJCOPY"; then + ac_cv_prog_ac_ct_OBJCOPY="$ac_ct_OBJCOPY" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_OBJCOPY="objcopy" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_OBJCOPY" && ac_cv_prog_ac_ct_OBJCOPY="no" +fi +fi +ac_ct_OBJCOPY=$ac_cv_prog_ac_ct_OBJCOPY +if test -n "$ac_ct_OBJCOPY"; then + echo "$as_me:$LINENO: result: $ac_ct_OBJCOPY" >&5 +echo "${ECHO_T}$ac_ct_OBJCOPY" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + OBJCOPY=$ac_ct_OBJCOPY +else + OBJCOPY="$ac_cv_prog_OBJCOPY" +fi + + if test "$OBJCOPY" = no; then + { { echo "$as_me:$LINENO: error: objcopy not found" >&5 +echo "$as_me: error: objcopy not found" >&2;} + { (exit 1); exit 1; }; } + fi + eval "${with_default}_OBJCOPY='$OBJCOPY'" + if test "$with_default" = "X86_64" ; then + with_i386=yes + fi +fi + +if test "$with_i386" != "no" ; then + cc="gcc -m32" + cpp=cpp + ld=ld + as="as -32" + objcopy=objcopy + if test "$with_i386" != "" -a "$with_i386" != "yes" ; then + cc="$with_i386-$cc" + cpp="$with_i386-$cpp" + ld="$with_i386-$ld" + as="$with_i386-$as" + objcopy="$with_i386-$objcopy" + fi + # Extract the first word of "$cc", so it can be a program name with args. +set dummy $cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_I386_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$I386_CC"; then + ac_cv_prog_I386_CC="$I386_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_I386_CC="$cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_I386_CC" && ac_cv_prog_I386_CC="""" +fi +fi +I386_CC=$ac_cv_prog_I386_CC +if test -n "$I386_CC"; then + echo "$as_me:$LINENO: result: $I386_CC" >&5 +echo "${ECHO_T}$I386_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + if test "$I386_CC" = no; then + + { { echo "$as_me:$LINENO: error: $cc not found" >&5 +echo "$as_me: error: $cc not found" >&2;} + { (exit 1); exit 1; }; } + fi + # Extract the first word of "$cpp", so it can be a program name with args. +set dummy $cpp; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_I386_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$I386_CPP"; then + ac_cv_prog_I386_CPP="$I386_CPP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_I386_CPP="$cpp" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_I386_CPP" && ac_cv_prog_I386_CPP="""" +fi +fi +I386_CPP=$ac_cv_prog_I386_CPP +if test -n "$I386_CPP"; then + echo "$as_me:$LINENO: result: $I386_CPP" >&5 +echo "${ECHO_T}$I386_CPP" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + if test "$I386_CPP" = no; then + { { echo "$as_me:$LINENO: error: $cpp not found" >&5 +echo "$as_me: error: $cpp not found" >&2;} + { (exit 1); exit 1; }; } + fi + # Extract the first word of "$ld", so it can be a program name with args. +set dummy $ld; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_I386_LD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$I386_LD"; then + ac_cv_prog_I386_LD="$I386_LD" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_I386_LD="$ld" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_I386_LD" && ac_cv_prog_I386_LD="""" +fi +fi +I386_LD=$ac_cv_prog_I386_LD +if test -n "$I386_LD"; then + echo "$as_me:$LINENO: result: $I386_LD" >&5 +echo "${ECHO_T}$I386_LD" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + if test "$I386_AS" = no; then + { { echo "$as_me:$LINENO: error: $ld not found" >&5 +echo "$as_me: error: $ld not found" >&2;} + { (exit 1); exit 1; }; } + fi + # Extract the first word of "$as", so it can be a program name with args. +set dummy $as; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_I386_AS+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$I386_AS"; then + ac_cv_prog_I386_AS="$I386_AS" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_I386_AS="$as" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_I386_AS" && ac_cv_prog_I386_AS="""" +fi +fi +I386_AS=$ac_cv_prog_I386_AS +if test -n "$I386_AS"; then + echo "$as_me:$LINENO: result: $I386_AS" >&5 +echo "${ECHO_T}$I386_AS" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + if test "$I386_AS" = no; then + { { echo "$as_me:$LINENO: error: $as not found" >&5 +echo "$as_me: error: $as not found" >&2;} + { (exit 1); exit 1; }; } + fi + # Extract the first word of "$objcopy", so it can be a program name with args. +set dummy $objcopy; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_I386_OBJCOPY+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$I386_OBJCOPY"; then + ac_cv_prog_I386_OBJCOPY="$I386_OBJCOPY" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_I386_OBJCOPY="$objcopy" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_I386_OBJCOPY" && ac_cv_prog_I386_OBJCOPY="""" +fi +fi +I386_OBJCOPY=$ac_cv_prog_I386_OBJCOPY +if test -n "$I386_OBJCOPY"; then + echo "$as_me:$LINENO: result: $I386_OBJCOPY" >&5 +echo "${ECHO_T}$I386_OBJCOPY" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + if test "$I386_OBJCOPY" = no; then + { { echo "$as_me:$LINENO: error: $objcopy not found" >&5 +echo "$as_me: error: $objcopy not found" >&2;} + { (exit 1); exit 1; }; } + fi +fi + +if test "$with_ia64" != "no" ; then + cc=gcc + cpp=cpp + ld=ld + as=as + objcopy=objcopy + if test "$with_ia64" != "" -a "$with_ia64" != "yes" ; then + cc="$with_ia64-$cc" + cpp="$with_ia64-$cpp" + ld="$with_ia64-$ld" + as="$with_ia64-$as" + objcopy="$with_ia64-$objcopy" + fi + # Extract the first word of "$cc", so it can be a program name with args. +set dummy $cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_IA64_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$IA64_CC"; then + ac_cv_prog_IA64_CC="$IA64_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_IA64_CC="$cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_IA64_CC" && ac_cv_prog_IA64_CC="""" +fi +fi +IA64_CC=$ac_cv_prog_IA64_CC +if test -n "$IA64_CC"; then + echo "$as_me:$LINENO: result: $IA64_CC" >&5 +echo "${ECHO_T}$IA64_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + if test "$IA64_CC" = no; then + + { { echo "$as_me:$LINENO: error: $cc not found" >&5 +echo "$as_me: error: $cc not found" >&2;} + { (exit 1); exit 1; }; } + fi + # Extract the first word of "$cpp", so it can be a program name with args. +set dummy $cpp; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_IA64_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$IA64_CPP"; then + ac_cv_prog_IA64_CPP="$IA64_CPP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_IA64_CPP="$cpp" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_IA64_CPP" && ac_cv_prog_IA64_CPP="""" +fi +fi +IA64_CPP=$ac_cv_prog_IA64_CPP +if test -n "$IA64_CPP"; then + echo "$as_me:$LINENO: result: $IA64_CPP" >&5 +echo "${ECHO_T}$IA64_CPP" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + if test "$IA64_CPP" = no; then + { { echo "$as_me:$LINENO: error: $cpp not found" >&5 +echo "$as_me: error: $cpp not found" >&2;} + { (exit 1); exit 1; }; } + fi + # Extract the first word of "$ld", so it can be a program name with args. +set dummy $ld; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_IA64_LD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$IA64_LD"; then + ac_cv_prog_IA64_LD="$IA64_LD" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_IA64_LD="$ld" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_IA64_LD" && ac_cv_prog_IA64_LD="""" +fi +fi +IA64_LD=$ac_cv_prog_IA64_LD +if test -n "$IA64_LD"; then + echo "$as_me:$LINENO: result: $IA64_LD" >&5 +echo "${ECHO_T}$IA64_LD" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + if test "$IA64_AS" = no; then + { { echo "$as_me:$LINENO: error: $ld not found" >&5 +echo "$as_me: error: $ld not found" >&2;} + { (exit 1); exit 1; }; } + fi + # Extract the first word of "$as", so it can be a program name with args. +set dummy $as; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_IA64_AS+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$IA64_AS"; then + ac_cv_prog_IA64_AS="$IA64_AS" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_IA64_AS="$as" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_IA64_AS" && ac_cv_prog_IA64_AS="""" +fi +fi +IA64_AS=$ac_cv_prog_IA64_AS +if test -n "$IA64_AS"; then + echo "$as_me:$LINENO: result: $IA64_AS" >&5 +echo "${ECHO_T}$IA64_AS" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + if test "$IA64_AS" = no; then + { { echo "$as_me:$LINENO: error: $as not found" >&5 +echo "$as_me: error: $as not found" >&2;} + { (exit 1); exit 1; }; } + fi + # Extract the first word of "$objcopy", so it can be a program name with args. +set dummy $objcopy; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_IA64_OBJCOPY+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$IA64_OBJCOPY"; then + ac_cv_prog_IA64_OBJCOPY="$IA64_OBJCOPY" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_IA64_OBJCOPY="$objcopy" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_IA64_OBJCOPY" && ac_cv_prog_IA64_OBJCOPY="""" +fi +fi +IA64_OBJCOPY=$ac_cv_prog_IA64_OBJCOPY +if test -n "$IA64_OBJCOPY"; then + echo "$as_me:$LINENO: result: $IA64_OBJCOPY" >&5 +echo "${ECHO_T}$IA64_OBJCOPY" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + if test "$IA64_OBJCOPY" = no; then + { { echo "$as_me:$LINENO: error: $objcopy not found" >&5 +echo "$as_me: error: $objcopy not found" >&2;} + { (exit 1); exit 1; }; } + fi +fi + + + +HOST_CC=$CC +HOST_CFLAGS='-O2 -Wall $(HOST_CPPFLAGS)' + +I386_CFLAGS='-Os -ffreestanding -Wall -W -Wno-format $(I386_CPPFLAGS)' +I386_ASFLAGS='' +I386_LDFLAGS='-static --warn-multiple-gp --warn-common' + +IA64_CFLAGS='-Os -ffreestanding -Wall -W -Wno-format -fpic -mconstant-gp -mauto-pic -fno-unwind-tables $(IA64_CPPFLAGS)' +IA64_ASFLAGS='-mconstant-gp -mauto-pic' +IA64_LDFLAGS='-static --warn-multiple-gp --warn-common' + + + + + + + + + + + + + + + + + + + + + + + ac_config_files="$ac_config_files Makefile.conf" +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +{ + (set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} | + sed ' + t clear + : clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + : end' >>confcache +if diff $cache_file confcache >/dev/null 2>&1; then :; else + if test -w $cache_file; then + test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" + cat confcache >$cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/; +s/:*\${srcdir}:*/:/; +s/:*@srcdir@:*/:/; +s/^\([^=]*=[ ]*\):*/\1/; +s/:*$//; +s/^[^=]*=[ ]*$//; +}' +fi + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +# +# If the first sed substitution is executed (which looks for macros that +# take arguments), then we branch to the quote section. Otherwise, +# look for a macro that doesn't take arguments. +cat >confdef2opt.sed <<\_ACEOF +t clear +: clear +s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g +t quote +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g +t quote +d +: quote +s,[ `~#$^&*(){}\\|;'"<>?],\\&,g +s,\[,\\&,g +s,\],\\&,g +s,\$,$$,g +p +_ACEOF +# We use echo to avoid assuming a particular line-breaking character. +# The extra dot is to prevent the shell from consuming trailing +# line-breaks from the sub-command output. A line-break within +# single-quotes doesn't work because, if this script is created in a +# platform that uses two characters for line-breaks (e.g., DOS), tr +# would break. +ac_LF_and_DOT=`echo; echo .` +DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'` +rm -f confdef2opt.sed + + +ac_libobjs= +ac_ltlibobjs= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_i=`echo "$ac_i" | + sed 's/\$U\././;s/\.o$//;s/\.obj$//'` + # 2. Add them. + ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + + +: ${CONFIG_STATUS=./config.status} +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false +SHELL=\${CONFIG_SHELL-$SHELL} +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi +DUALCASE=1; export DUALCASE # for MKS sh + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 +echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 +echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + +exec 6>&1 + +# Open the log real soon, to keep \$[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. Logging --version etc. is OK. +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX +} >&5 +cat >&5 <<_CSEOF + +This file was extended by $as_me, which was +generated by GNU Autoconf 2.59. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +_CSEOF +echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 +echo >&5 +_ACEOF + +# Files that config.status was made for. +if test -n "$ac_config_files"; then + echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_headers"; then + echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_links"; then + echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_commands"; then + echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS +fi + +cat >>$CONFIG_STATUS <<\_ACEOF + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + +Configuration files: +$config_files + +Report bugs to <bug-autoconf@gnu.org>." +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +ac_cs_version="\\ +config.status +configured by $0, generated by GNU Autoconf 2.59, + with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" + +Copyright (C) 2003 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." +srcdir=$srcdir +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "x$1" : 'x\([^=]*\)='` + ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + ac_shift=: + ;; + -*) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + *) # This is not an option, so the user has probably given explicit + # arguments. + ac_option=$1 + ac_need_defaults=false;; + esac + + case $ac_option in + # Handling of the options. +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --vers* | -V ) + echo "$ac_cs_version"; exit 0 ;; + --he | --h) + # Conflict between --help and --header + { { echo "$as_me:$LINENO: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + CONFIG_FILES="$CONFIG_FILES $ac_optarg" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" + ac_need_defaults=false;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +if \$ac_cs_recheck; then + echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 + exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion +fi + +_ACEOF + + + + + +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_config_target in $ac_config_targets +do + case "$ac_config_target" in + # Handling of arguments. + "Makefile.conf" ) CONFIG_FILES="$CONFIG_FILES Makefile.conf" ;; + *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason to put it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./confstat$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF + +# +# CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "\$CONFIG_FILES"; then + # Protect against being on the right side of a sed subst in config.status. + sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; + s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF +s,@SHELL@,$SHELL,;t t +s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t +s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t +s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t +s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t +s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t +s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t +s,@exec_prefix@,$exec_prefix,;t t +s,@prefix@,$prefix,;t t +s,@program_transform_name@,$program_transform_name,;t t +s,@bindir@,$bindir,;t t +s,@sbindir@,$sbindir,;t t +s,@libexecdir@,$libexecdir,;t t +s,@datadir@,$datadir,;t t +s,@sysconfdir@,$sysconfdir,;t t +s,@sharedstatedir@,$sharedstatedir,;t t +s,@localstatedir@,$localstatedir,;t t +s,@libdir@,$libdir,;t t +s,@includedir@,$includedir,;t t +s,@oldincludedir@,$oldincludedir,;t t +s,@infodir@,$infodir,;t t +s,@mandir@,$mandir,;t t +s,@build_alias@,$build_alias,;t t +s,@host_alias@,$host_alias,;t t +s,@target_alias@,$target_alias,;t t +s,@DEFS@,$DEFS,;t t +s,@ECHO_C@,$ECHO_C,;t t +s,@ECHO_N@,$ECHO_N,;t t +s,@ECHO_T@,$ECHO_T,;t t +s,@LIBS@,$LIBS,;t t +s,@build@,$build,;t t +s,@build_cpu@,$build_cpu,;t t +s,@build_vendor@,$build_vendor,;t t +s,@build_os@,$build_os,;t t +s,@host@,$host,;t t +s,@host_cpu@,$host_cpu,;t t +s,@host_vendor@,$host_vendor,;t t +s,@host_os@,$host_os,;t t +s,@CC@,$CC,;t t +s,@CFLAGS@,$CFLAGS,;t t +s,@LDFLAGS@,$LDFLAGS,;t t +s,@CPPFLAGS@,$CPPFLAGS,;t t +s,@ac_ct_CC@,$ac_ct_CC,;t t +s,@EXEEXT@,$EXEEXT,;t t +s,@OBJEXT@,$OBJEXT,;t t +s,@MKDIR@,$MKDIR,;t t +s,@RM@,$RM,;t t +s,@CP@,$CP,;t t +s,@LN@,$LN,;t t +s,@TAR@,$TAR,;t t +s,@RPM@,$RPM,;t t +s,@SED@,$SED,;t t +s,@FIND@,$FIND,;t t +s,@CPP@,$CPP,;t t +s,@EGREP@,$EGREP,;t t +s,@LD@,$LD,;t t +s,@ac_ct_LD@,$ac_ct_LD,;t t +s,@AS@,$AS,;t t +s,@ac_ct_AS@,$ac_ct_AS,;t t +s,@OBJCOPY@,$OBJCOPY,;t t +s,@ac_ct_OBJCOPY@,$ac_ct_OBJCOPY,;t t +s,@I386_CC@,$I386_CC,;t t +s,@I386_CPP@,$I386_CPP,;t t +s,@I386_LD@,$I386_LD,;t t +s,@I386_AS@,$I386_AS,;t t +s,@I386_OBJCOPY@,$I386_OBJCOPY,;t t +s,@IA64_CC@,$IA64_CC,;t t +s,@IA64_CPP@,$IA64_CPP,;t t +s,@IA64_LD@,$IA64_LD,;t t +s,@IA64_AS@,$IA64_AS,;t t +s,@IA64_OBJCOPY@,$IA64_OBJCOPY,;t t +s,@HOST_CC@,$HOST_CC,;t t +s,@HOST_CFLAGS@,$HOST_CFLAGS,;t t +s,@I386_CFLAGS@,$I386_CFLAGS,;t t +s,@I386_ASFLAGS@,$I386_ASFLAGS,;t t +s,@I386_LDFLAGS@,$I386_LDFLAGS,;t t +s,@IA64_CFLAGS@,$IA64_CFLAGS,;t t +s,@IA64_ASFLAGS@,$IA64_ASFLAGS,;t t +s,@IA64_LDFLAGS@,$IA64_LDFLAGS,;t t +s,@LIBOBJS@,$LIBOBJS,;t t +s,@LTLIBOBJS@,$LTLIBOBJS,;t t +CEOF + +_ACEOF + + cat >>$CONFIG_STATUS <<\_ACEOF + # Split the substitutions into bite-sized pieces for seds with + # small command number limits, like on Digital OSF/1 and HP-UX. + ac_max_sed_lines=48 + ac_sed_frag=1 # Number of current file. + ac_beg=1 # First line for current file. + ac_end=$ac_max_sed_lines # Line after last line for current file. + ac_more_lines=: + ac_sed_cmds= + while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + else + sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + fi + if test ! -s $tmp/subs.frag; then + ac_more_lines=false + else + # The purpose of the label and of the branching condition is to + # speed up the sed processing (if there are no `@' at all, there + # is no need to browse any of the substitutions). + # These are the two extra sed commands mentioned above. + (echo ':t + /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + else + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + fi + ac_sed_frag=`expr $ac_sed_frag + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_lines` + fi + done + if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat + fi +fi # test -n "$CONFIG_FILES" + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + + + if test x"$ac_file" != x-; then + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + if test x"$ac_file" = x-; then + configure_input= + else + configure_input="$ac_file. " + fi + configure_input=$configure_input"Generated from `echo $ac_file_in | + sed 's,.*/,,'` by configure." + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo "$f";; + *) # Relative + if test -f "$f"; then + # Build tree + echo "$f" + elif test -f "$srcdir/$f"; then + # Source tree + echo "$srcdir/$f" + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + sed "$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s,@configure_input@,$configure_input,;t t +s,@srcdir@,$ac_srcdir,;t t +s,@abs_srcdir@,$ac_abs_srcdir,;t t +s,@top_srcdir@,$ac_top_srcdir,;t t +s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t +s,@builddir@,$ac_builddir,;t t +s,@abs_builddir@,$ac_abs_builddir,;t t +s,@top_builddir@,$ac_top_builddir,;t t +s,@abs_top_builddir@,$ac_abs_top_builddir,;t t +" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out + rm -f $tmp/stdin + if test x"$ac_file" != x-; then + mv $tmp/out $ac_file + else + cat $tmp/out + rm -f $tmp/out + fi + +done +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF + +{ (exit 0); exit 0; } +_ACEOF +chmod +x $CONFIG_STATUS +ac_clean_files=$ac_clean_files_save + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi + + + diff --git a/util/mkelfImage/configure.ac b/util/mkelfImage/configure.ac new file mode 100644 index 0000000000..0c0e9c09fe --- /dev/null +++ b/util/mkelfImage/configure.ac @@ -0,0 +1,212 @@ +dnl +dnl configure.ac for mkelfImage +dnl +dnl + +dnl ---Required +AC_INIT(Makefile.conf.in) +AC_CONFIG_AUX_DIR(./config) + +dnl --Options + + +dnl -- Compilation platform configuration +AC_CANONICAL_HOST +#AC_CANONICAL_TARGET + + +dnl Compute target cpu +case $host_cpu in + i?86 ) + target_cpu="i386" + ;; + * ) + target_cpu="$host_cpu" + ;; +esac + +dnl ---Options +targets="" + +AC_ARG_WITH([i386], AC_HELP_STRING([--with-i386],[enable building i386 code]), + [ if test "withval" = "yes" ; then with_i386="i386"; else with_i386="$withval"; fi], + [ with_i386="no"]) + +AC_ARG_WITH([ia64], AC_HELP_STRING([--with-ia64],[enable building ia64 code]), + [ if test "withval" = "yes" ; then with_ia64="ia64"; else with_ia64="$withval"; fi], + [ with_ia64="no"]) + +dnl If no targets are specified use a default +with_default="no" +if test "$with_i386" = "no" && + test "$with_ia64" = "no" ; then + with_default=`echo $target_cpu | tr [a-z] [A-Z]` +fi + +AC_MSG_NOTICE([with_default=$with_default]) +AC_MSG_NOTICE([with_i386=$with_i386]) +AC_MSG_NOTICE([with_ia64=$with_ia64]) + +dnl ---Programs +dnl To specify a different compiler, just 'export CC=/path/to/compiler' + +AC_PROG_CC + + +AC_CHECK_PROG([MKDIR], mkdir, mkdir, [], [$PATH]) +AC_CHECK_PROG([RM], rm, rm, [], [$PATH]) +AC_CHECK_PROG([CP], cp, cp, [], [$PATH]) +AC_CHECK_PROG([LN], ln, ln, [], [$PATH]) +AC_CHECK_PROG([TAR], tar, tar, [], [$PATH]) +AC_CHECK_PROG([RPM], rpm, rpm, [], [$PATH]) +AC_CHECK_PROG([SED], sed, sed, [], [$PATH]) +AC_CHECK_PROG([FIND], find, find, [], [$PATH]) + +AC_CHECK_HEADER(zlib.h, AC_CHECK_LIB(z, inflateInit_, [AC_DEFINE(HAVE_ZLIB_H, 1) LIBS="$LIBS -lz"])) + +dnl Find the default programs +if test "with_default" != no ; then + if test "$CC" = no; then + AC_MSG_ERROR([cc not found]) + fi + eval "${with_default}_CC='$CC'" + AC_PROG_CPP + if test "$CPP" = no; then + AC_MSG_ERROR([cpp not found]) + fi + eval "${with_default}_CPP='$CPP'" + AC_CHECK_TOOL([LD], ld, no) + if test "$LD" = no; then + AC_MSG_ERROR([ld not found]) + fi + eval "${with_default}_LD='$LD'" + AC_CHECK_TOOL([AS], as, no) + if test "$AS" = no; then + AC_MSG_ERROR([as not found]) + fi + eval "${with_default}_AS='$AS'" + AC_CHECK_TOOL([OBJCOPY], objcopy, no) + if test "$OBJCOPY" = no; then + AC_MSG_ERROR([objcopy not found]) + fi + eval "${with_default}_OBJCOPY='$OBJCOPY'" + if test "$with_default" = "X86_64" ; then + with_i386=yes + fi +fi + +dnl Find the programs for compiling i386 targets +if test "$with_i386" != "no" ; then + cc="gcc -m32" + cpp=cpp + ld=ld + as="as -32" + objcopy=objcopy + if test "$with_i386" != "" -a "$with_i386" != "yes" ; then + cc="$with_i386-$cc" + cpp="$with_i386-$cpp" + ld="$with_i386-$ld" + as="$with_i386-$as" + objcopy="$with_i386-$objcopy" + fi + AC_CHECK_PROG([I386_CC], [$cc], [$cc], [""], [$PATH]) + if test "$I386_CC" = no; then + + AC_MSG_ERROR([$cc not found]) + fi + AC_CHECK_PROG([I386_CPP], [$cpp], [$cpp], [""], [$PATH]) + if test "$I386_CPP" = no; then + AC_MSG_ERROR([$cpp not found]) + fi + AC_CHECK_PROG([I386_LD], [$ld], [$ld], [""], [$PATH]) + if test "$I386_AS" = no; then + AC_MSG_ERROR([$ld not found]) + fi + AC_CHECK_PROG([I386_AS], [$as], [$as], [""], [$PATH]) + if test "$I386_AS" = no; then + AC_MSG_ERROR([$as not found]) + fi + AC_CHECK_PROG([I386_OBJCOPY], [$objcopy], [$objcopy],[""], [$PATH]) + if test "$I386_OBJCOPY" = no; then + AC_MSG_ERROR([$objcopy not found]) + fi +fi + +dnl Find the programs for compiling ia64 targets +if test "$with_ia64" != "no" ; then + cc=gcc + cpp=cpp + ld=ld + as=as + objcopy=objcopy + if test "$with_ia64" != "" -a "$with_ia64" != "yes" ; then + cc="$with_ia64-$cc" + cpp="$with_ia64-$cpp" + ld="$with_ia64-$ld" + as="$with_ia64-$as" + objcopy="$with_ia64-$objcopy" + fi + AC_CHECK_PROG([IA64_CC], [$cc], [$cc], [""], [$PATH]) + if test "$IA64_CC" = no; then + + AC_MSG_ERROR([$cc not found]) + fi + AC_CHECK_PROG([IA64_CPP], [$cpp], [$cpp], [""], [$PATH]) + if test "$IA64_CPP" = no; then + AC_MSG_ERROR([$cpp not found]) + fi + AC_CHECK_PROG([IA64_LD], [$ld], [$ld], [""], [$PATH]) + if test "$IA64_AS" = no; then + AC_MSG_ERROR([$ld not found]) + fi + AC_CHECK_PROG([IA64_AS], [$as], [$as], [""], [$PATH]) + if test "$IA64_AS" = no; then + AC_MSG_ERROR([$as not found]) + fi + AC_CHECK_PROG([IA64_OBJCOPY], [$objcopy], [$objcopy],[""], [$PATH]) + if test "$IA64_OBJCOPY" = no; then + AC_MSG_ERROR([$objcopy not found]) + fi +fi + + +dnl ---Output variables... + +HOST_CC=$CC +HOST_CFLAGS='-O2 -Wall $(HOST_CPPFLAGS)' + +dnl TODO: figure out how to set these appropriately for compilers other than gcc +I386_CFLAGS='-Os -ffreestanding -Wall -W -Wno-format $(I386_CPPFLAGS)' +I386_ASFLAGS='' +I386_LDFLAGS='-static --warn-multiple-gp --warn-common' + +dnl TODO: figure out how to set these appropriately for compilers other than gcc +IA64_CFLAGS='-Os -ffreestanding -Wall -W -Wno-format -fpic -mconstant-gp -mauto-pic -fno-unwind-tables $(IA64_CPPFLAGS)' +IA64_ASFLAGS='-mconstant-gp -mauto-pic' +IA64_LDFLAGS='-static --warn-multiple-gp --warn-common' + +AC_SUBST([HOST_CC]) +AC_SUBST([HOST_CFLAGS]) + +AC_SUBST([I386_CC]) +AC_SUBST([I386_LD]) +AC_SUBST([I386_AS]) +AC_SUBST([I386_CPP]) +AC_SUBST([I386_OBJCOPY]) +AC_SUBST([I386_CFLAGS]) +AC_SUBST([I386_ASFLAGS]) +AC_SUBST([I386_LDFLAGS]) + +AC_SUBST([IA64_CC]) +AC_SUBST([IA64_LD]) +AC_SUBST([IA64_AS]) +AC_SUBST([IA64_CPP]) +AC_SUBST([IA64_OBJCOPY]) +AC_SUBST([IA64_CFLAGS]) +AC_SUBST([IA64_ASFLAGS]) +AC_SUBST([IA64_LDFLAGS]) + +dnl ---Output +AC_OUTPUT([Makefile.conf]) + + diff --git a/util/mkelfImage/include/elf.h b/util/mkelfImage/include/elf.h new file mode 100644 index 0000000000..eb9ac1d71e --- /dev/null +++ b/util/mkelfImage/include/elf.h @@ -0,0 +1,226 @@ +#ifndef ELF_H +#define ELF_H + +#define EI_NIDENT 16 /* Size of e_ident array. */ + +/* Values for e_type. */ +#define ET_NONE 0 /* No file type */ +#define ET_REL 1 /* Relocatable file */ +#define ET_EXEC 2 /* Executable file */ +#define ET_DYN 3 /* Shared object file */ +#define ET_CORE 4 /* Core file */ + +/* Values for e_machine (architecute). */ +#define EM_NONE 0 /* No machine */ +#define EM_M32 1 /* AT&T WE 32100 */ +#define EM_SPARC 2 /* SUN SPARC */ +#define EM_386 3 /* Intel 80386+ */ +#define EM_68K 4 /* Motorola m68k family */ +#define EM_88K 5 /* Motorola m88k family */ +#define EM_486 6 /* Perhaps disused */ +#define EM_860 7 /* Intel 80860 */ +#define EM_MIPS 8 /* MIPS R3000 big-endian */ +#define EM_S370 9 /* IBM System/370 */ +#define EM_MIPS_RS3_LE 10 /* MIPS R3000 little-endian */ + +#define EM_PARISC 15 /* HPPA */ +#define EM_VPP500 17 /* Fujitsu VPP500 */ +#define EM_SPARC32PLUS 18 /* Sun's "v8plus" */ +#define EM_960 19 /* Intel 80960 */ +#define EM_PPC 20 /* PowerPC */ +#define EM_PPC64 21 /* PowerPC 64-bit */ +#define EM_S390 22 /* IBM S390 */ + +#define EM_V800 36 /* NEC V800 series */ +#define EM_FR20 37 /* Fujitsu FR20 */ +#define EM_RH32 38 /* TRW RH-32 */ +#define EM_RCE 39 /* Motorola RCE */ +#define EM_ARM 40 /* ARM */ +#define EM_FAKE_ALPHA 41 /* Digital Alpha */ +#define EM_SH 42 /* Hitachi SH */ +#define EM_SPARCV9 43 /* SPARC v9 64-bit */ +#define EM_TRICORE 44 /* Siemens Tricore */ +#define EM_ARC 45 /* Argonaut RISC Core */ +#define EM_H8_300 46 /* Hitachi H8/300 */ +#define EM_H8_300H 47 /* Hitachi H8/300H */ +#define EM_H8S 48 /* Hitachi H8S */ +#define EM_H8_500 49 /* Hitachi H8/500 */ +#define EM_IA_64 50 /* Intel Merced */ +#define EM_MIPS_X 51 /* Stanford MIPS-X */ +#define EM_COLDFIRE 52 /* Motorola Coldfire */ +#define EM_68HC12 53 /* Motorola M68HC12 */ +#define EM_MMA 54 /* Fujitsu MMA Multimedia Accelerator*/ +#define EM_PCP 55 /* Siemens PCP */ +#define EM_NCPU 56 /* Sony nCPU embeeded RISC */ +#define EM_NDR1 57 /* Denso NDR1 microprocessor */ +#define EM_STARCORE 58 /* Motorola Start*Core processor */ +#define EM_ME16 59 /* Toyota ME16 processor */ +#define EM_ST100 60 /* STMicroelectronic ST100 processor */ +#define EM_TINYJ 61 /* Advanced Logic Corp. Tinyj emb.fam*/ +#define EM_X86_64 62 /* AMD x86-64 architecture */ +#define EM_PDSP 63 /* Sony DSP Processor */ + +#define EM_FX66 66 /* Siemens FX66 microcontroller */ +#define EM_ST9PLUS 67 /* STMicroelectronics ST9+ 8/16 mc */ +#define EM_ST7 68 /* STmicroelectronics ST7 8 bit mc */ +#define EM_68HC16 69 /* Motorola MC68HC16 microcontroller */ +#define EM_68HC11 70 /* Motorola MC68HC11 microcontroller */ +#define EM_68HC08 71 /* Motorola MC68HC08 microcontroller */ +#define EM_68HC05 72 /* Motorola MC68HC05 microcontroller */ +#define EM_SVX 73 /* Silicon Graphics SVx */ +#define EM_AT19 74 /* STMicroelectronics ST19 8 bit mc */ +#define EM_VAX 75 /* Digital VAX */ +#define EM_CRIS 76 /* Axis Communications 32-bit embedded processor */ +#define EM_JAVELIN 77 /* Infineon Technologies 32-bit embedded processor */ +#define EM_FIREPATH 78 /* Element 14 64-bit DSP Processor */ +#define EM_ZSP 79 /* LSI Logic 16-bit DSP Processor */ +#define EM_MMIX 80 /* Donald Knuth's educational 64-bit processor */ +#define EM_HUANY 81 /* Harvard University machine-independent object files */ +#define EM_PRISM 82 /* SiTera Prism */ +#define EM_AVR 83 /* Atmel AVR 8-bit microcontroller */ +#define EM_FR30 84 /* Fujitsu FR30 */ +#define EM_D10V 85 /* Mitsubishi D10V */ +#define EM_D30V 86 /* Mitsubishi D30V */ +#define EM_V850 87 /* NEC v850 */ +#define EM_M32R 88 /* Mitsubishi M32R */ +#define EM_MN10300 89 /* Matsushita MN10300 */ +#define EM_MN10200 90 /* Matsushita MN10200 */ +#define EM_PJ 91 /* picoJava */ +#define EM_OPENRISC 92 /* OpenRISC 32-bit embedded processor */ +#define EM_ARC_A5 93 /* ARC Cores Tangent-A5 */ +#define EM_XTENSA 94 /* Tensilica Xtensa Architecture */ +#define EM_NUM 95 + +/* Values for p_type. */ +#define PT_NULL 0 /* Unused entry. */ +#define PT_LOAD 1 /* Loadable segment. */ +#define PT_DYNAMIC 2 /* Dynamic linking information segment. */ +#define PT_INTERP 3 /* Pathname of interpreter. */ +#define PT_NOTE 4 /* Auxiliary information. */ +#define PT_SHLIB 5 /* Reserved (not used). */ +#define PT_PHDR 6 /* Location of program header itself. */ + +/* Values for p_flags. */ +#define PF_X 0x1 /* Executable. */ +#define PF_W 0x2 /* Writable. */ +#define PF_R 0x4 /* Readable. */ + + +#define ELF_PROGRAM_RETURNS_BIT 0x8000000 /* e_flags bit 31 */ + +#define EI_MAG0 0 +#define ELFMAG0 0x7f + +#define EI_MAG1 1 +#define ELFMAG1 'E' + +#define EI_MAG2 2 +#define ELFMAG2 'L' + +#define EI_MAG3 3 +#define ELFMAG3 'F' + +#define ELFMAG "\177ELF" + +#define EI_CLASS 4 /* File class byte index */ +#define ELFCLASSNONE 0 /* Invalid class */ +#define ELFCLASS32 1 /* 32-bit objects */ +#define ELFCLASS64 2 /* 64-bit objects */ + +#define EI_DATA 5 /* Data encodeing byte index */ +#define ELFDATANONE 0 /* Invalid data encoding */ +#define ELFDATA2LSB 1 /* 2's complement little endian */ +#define ELFDATA2MSB 2 /* 2's complement big endian */ + +#define EI_VERSION 6 /* File version byte index */ + /* Value must be EV_CURRENT */ + +#define EV_NONE 0 /* Invalid ELF Version */ +#define EV_CURRENT 1 /* Current version */ + +#define ELF32_PHDR_SIZE (8*4) /* Size of an elf program header */ + +#ifndef ASSEMBLY +/* + * ELF definitions common to all 32-bit architectures. + */ + +typedef uint32_t Elf32_Addr; +typedef uint16_t Elf32_Half; +typedef uint32_t Elf32_Off; +typedef int32_t Elf32_Sword; +typedef uint32_t Elf32_Word; +typedef uint32_t Elf32_Size; + +typedef uint64_t Elf64_Addr; +typedef uint16_t Elf64_Half; +typedef uint64_t Elf64_Off; +typedef int32_t Elf64_Sword; +typedef uint32_t Elf64_Word; +typedef uint64_t Elf64_Size; + +/* + * ELF header. + */ +typedef struct { + unsigned char e_ident[EI_NIDENT]; /* File identification. */ + Elf32_Half e_type; /* File type. */ + Elf32_Half e_machine; /* Machine architecture. */ + Elf32_Word e_version; /* ELF format version. */ + Elf32_Addr e_entry; /* Entry point. */ + Elf32_Off e_phoff; /* Program header file offset. */ + Elf32_Off e_shoff; /* Section header file offset. */ + Elf32_Word e_flags; /* Architecture-specific flags. */ + Elf32_Half e_ehsize; /* Size of ELF header in bytes. */ + Elf32_Half e_phentsize; /* Size of program header entry. */ + Elf32_Half e_phnum; /* Number of program header entries. */ + Elf32_Half e_shentsize; /* Size of section header entry. */ + Elf32_Half e_shnum; /* Number of section header entries. */ + Elf32_Half e_shstrndx; /* Section name strings section. */ +} Elf32_Ehdr; + +typedef struct { + unsigned char e_ident[EI_NIDENT]; /* File identification. */ + Elf64_Half e_type; /* File type. */ + Elf64_Half e_machine; /* Machine architecture. */ + Elf64_Word e_version; /* ELF format version. */ + Elf64_Addr e_entry; /* Entry point. */ + Elf64_Off e_phoff; /* Program header file offset. */ + Elf64_Off e_shoff; /* Section header file offset. */ + Elf64_Word e_flags; /* Architecture-specific flags. */ + Elf64_Half e_ehsize; /* Size of ELF header in bytes. */ + Elf64_Half e_phentsize; /* Size of program header entry. */ + Elf64_Half e_phnum; /* Number of program header entries. */ + Elf64_Half e_shentsize; /* Size of section header entry. */ + Elf64_Half e_shnum; /* Number of section header entries. */ + Elf64_Half e_shstrndx; /* Section name strings section. */ +} Elf64_Ehdr; + +/* + * Program header. + */ +typedef struct { + Elf32_Word p_type; /* Entry type. */ + Elf32_Off p_offset; /* File offset of contents. */ + Elf32_Addr p_vaddr; /* Virtual address (not used). */ + Elf32_Addr p_paddr; /* Physical address. */ + Elf32_Size p_filesz; /* Size of contents in file. */ + Elf32_Size p_memsz; /* Size of contents in memory. */ + Elf32_Word p_flags; /* Access permission flags. */ + Elf32_Size p_align; /* Alignment in memory and file. */ +} Elf32_Phdr; + +typedef struct { + Elf64_Word p_type; /* Entry type. */ + Elf64_Word p_flags; /* Access permission flags. */ + Elf64_Off p_offset; /* File offset of contents. */ + Elf64_Addr p_vaddr; /* Virtual address (not used). */ + Elf64_Addr p_paddr; /* Physical address. */ + Elf64_Size p_filesz; /* Size of contents in file. */ + Elf64_Size p_memsz; /* Size of contents in memory. */ + Elf64_Size p_align; /* Alignment in memory and file. */ +} Elf64_Phdr; + +#endif /* ASSEMBLY */ + +#endif /* ELF_H */ diff --git a/util/mkelfImage/include/elf_boot.h b/util/mkelfImage/include/elf_boot.h new file mode 100644 index 0000000000..f90013ffa8 --- /dev/null +++ b/util/mkelfImage/include/elf_boot.h @@ -0,0 +1,105 @@ +#ifndef ELF_BOOT_H +#define ELF_BOOT_H + + +/* This defines the structure of a table of parameters useful for ELF + * bootable images. These parameters are all passed and generated + * by the bootloader to the booted image. For simplicity and + * consistency the Elf Note format is reused. + * + * All of the information must be Position Independent Data. + * That is it must be safe to relocate the whole ELF boot parameter + * block without changing the meaning or correctnes of the data. + * Additionally it must be safe to permute the order of the ELF notes + * to any possible permutation without changing the meaning or correctness + * of the data. + * + */ + +#define ELF_BHDR_MAGIC 0x0E1FB007 + +#ifndef ASSEMBLY +#include <stdint.h> +typedef uint16_t Elf_Half; +typedef uint32_t Elf_Word; + +/* + * Elf boot notes... + */ + +typedef struct Elf_Bhdr +{ + Elf_Word b_signature; /* "0x0E1FB007" */ + Elf_Word b_size; + Elf_Half b_checksum; + Elf_Half b_records; +} Elf_Bhdr; + +/* + * ELF Notes. + */ + +typedef struct Elf_Nhdr +{ + Elf_Word n_namesz; /* Length of the note's name. */ + Elf_Word n_descsz; /* Length of the note's descriptor. */ + Elf_Word n_type; /* Type of the note. */ +} Elf_Nhdr; + +#endif /* ASSEMBLY */ + +/* Standardized Elf image notes for booting... The name for all of these is ELFBoot */ +#define ELF_NOTE_BOOT "ELFBoot" + +#define EIN_PROGRAM_NAME 0x00000001 +/* The program in this ELF file */ +#define EIN_PROGRAM_VERSION 0x00000002 +/* The version of the program in this ELF file */ +#define EIN_PROGRAM_CHECKSUM 0x00000003 +/* ip style checksum of the memory image. */ + + +/* Linux image notes for booting... The name for all of these is Linux */ + +#define LIN_COMMAND_LINE 0x00000001 +/* The command line to pass to the loaded kernel. */ +#define LIN_ROOT_DEV 0x00000002 +/* The root dev to pass to the loaded kernel. */ +#define LIN_RAMDISK_FLAGS 0x00000003 +/* Various old ramdisk flags */ +#define LIN_INITRD_START 0x00000004 +/* Start of the ramdisk in bytes */ +#define LIN_INITRD_SIZE 0x00000005 +/* Size of the ramdisk in bytes */ + +/* Notes that are passed to a loaded image */ +/* For the standard elf boot notes n_namesz must be zero */ +#define EBN_FIRMWARE_TYPE 0x00000001 +/* ASCIZ name of the platform firmware. */ +#define EBN_BOOTLOADER_NAME 0x00000002 +/* This specifies just the ASCIZ name of the bootloader */ +#define EBN_BOOTLOADER_VERSION 0x00000003 +/* This specifies the version of the bootloader as an ASCIZ string */ +#define EBN_COMMAND_LINE 0x00000004 +/* This specifies a command line that can be set by user interaction, + * and is provided as a free form ASCIZ string to the loaded image. + */ +#define EBN_NOP 0x00000005 +/* A note nop note has no meaning, useful for inserting explicit padding */ +#define EBN_LOADED_IMAGE 0x00000006 +/* An ASCIZ string naming the loaded image */ + + +/* Etherboot specific notes */ +#define EB_PARAM_NOTE "Etherboot" +#define EB_IA64_SYSTAB 0x00000001 +#define EB_IA64_MEMMAP 0x00000002 +#define EB_IA64_FPSWA 0x00000003 +#define EB_IA64_CONINFO 0x00000004 +#define EB_BOOTP_DATA 0x00000005 +#define EB_HEADER 0x00000006 +#define EB_IA64_IMAGE_HANDLE 0x00000007 +#define EB_I386_MEMMAP 0x00000008 + + +#endif /* ELF_BOOT_H */ diff --git a/util/mkelfImage/include/linuxbios_tables.h b/util/mkelfImage/include/linuxbios_tables.h new file mode 100644 index 0000000000..c324cf543a --- /dev/null +++ b/util/mkelfImage/include/linuxbios_tables.h @@ -0,0 +1,82 @@ +#ifndef LINUXBIOS_TABLES_H +#define LINUXBIOS_TABLES_H + +#include <stdint.h> + +/* The linuxbios table information is for conveying information + * from the firmware to the loaded OS image. Primarily this + * is expected to be information that cannot be discovered by + * other means, such as quering the hardware directly. + * + * All of the information should be Position Independent Data. + * That is it should be safe to relocated any of the information + * without it's meaning/correctnes changing. For table that + * can reasonably be used on multiple architectures the data + * size should be fixed. This should ease the transition between + * 32 bit and 64 bit architectures etc. + * + * The completeness test for the information in this table is: + * - Can all of the hardware be detected? + * - Are the per motherboard constants available? + * - Is there enough to allow a kernel to run that was written before + * a particular motherboard is constructed? (Assuming the kernel + * has drivers for all of the hardware but it does not have + * assumptions on how the hardware is connected together). + * + * With this test it should be straight forward to determine if a + * table entry is required or not. This should remove much of the + * long term compatibility burden as table entries which are + * irrelevant or have been replaced by better alternatives may be + * dropped. Of course it is polite and expidite to include extra + * table entries and be backwards compatible, but it is not required. + */ + + +struct lb_header +{ + uint8_t signature[4]; /* LBIO */ + uint32_t header_bytes; + uint32_t header_checksum; + uint32_t table_bytes; + uint32_t table_checksum; + uint32_t table_entries; +}; + +/* Every entry in the boot enviroment list will correspond to a boot + * info record. Encoding both type and size. The type is obviously + * so you can tell what it is. The size allows you to skip that + * boot enviroment record if you don't know what it easy. This allows + * forward compatibility with records not yet defined. + */ +struct lb_record { + uint32_t tag; /* tag ID */ + uint32_t size; /* size of record (in bytes) */ +}; + +#define LB_TAG_UNUSED 0x0000 + +#define LB_TAG_MEMORY 0x0001 + +struct lb_memory_range { + uint64_t start; + uint64_t size; + uint32_t type; +#define LB_MEM_RAM 1 +#define LB_MEM_RESERVED 2 + +}; + +struct lb_memory { + uint32_t tag; + uint32_t size; + struct lb_memory_range map[0]; +}; + +#define LB_TAG_HWRPB 0x0002 +struct lb_hwrpb { + uint32_t tag; + uint32_t size; + uint64_t hwrpb; +}; + +#endif /* LINUXBIOS_TABLES_H */ diff --git a/util/mkelfImage/include/mkelfImage.h b/util/mkelfImage/include/mkelfImage.h new file mode 100644 index 0000000000..917f46e8c2 --- /dev/null +++ b/util/mkelfImage/include/mkelfImage.h @@ -0,0 +1,125 @@ +#ifndef MKELFIMAGE_H +#define MKELFIMAGE_H + +#include <sys/types.h> +#include <stdint.h> +#include <byteswap.h> +#define USE_BSD +#include <endian.h> +#define _GNU_SOURCE + +struct memelfheader; +struct memelfphdr; +struct memelfnote; + +extern void die(char *fmt, ...); +extern void usage(void); +extern void error(char *fmt, ...); +extern uint16_t ipchksum(const void *data, unsigned long length); +extern uint16_t add_ipchksums(unsigned long offset, uint16_t sum, uint16_t new); +extern void *xmalloc(size_t size, const char *name); +extern void *xrealloc(void *ptr, size_t size, const char *name); +extern char *slurp_file(const char *filename, off_t *r_size); +extern char *slurp_decompress_file(const char *filename, off_t *r_size); +extern struct memelfphdr *add_program_headers(struct memelfheader *ehdr, int count); +extern struct memelfnote *add_notes(struct memelfheader *ehdr, int count); + +typedef char *(probe_t)(char *kernel_buf, off_t kernel_size); +typedef int (mkelf_t)(int argc, char **argv, + struct memelfheader *hdr, char *kernel_buf, off_t kernel_size); +typedef void (usage_t)(void); +struct file_type { + const char *name; + probe_t *probe; + mkelf_t *mkelf; + usage_t *usage; +}; + +#if BYTE_ORDER == LITTLE_ENDIAN +#define cpu_to_le16(val) (val) +#define cpu_to_le32(val) (val) +#define cpu_to_le64(val) (val) +#define cpu_to_be16(val) bswap_16(val) +#define cpu_to_be32(val) bswap_32(val) +#define cpu_to_be64(val) bswap_64(val) +#define le16_to_cpu(val) (val) +#define le32_to_cpu(val) (val) +#define le64_to_cpu(val) (val) +#define be16_to_cpu(val) bswap_16(val) +#define be32_to_cpu(val) bswap_32(val) +#define be64_to_cpu(val) bswap_64(val) +#endif +#if BYTE_ORDER == BIG_ENDIAN +#define cpu_to_le16(val) bswap_16(val) +#define cpu_to_le32(val) bswap_32(val) +#define cpu_to_le64(val) bswap_64(val) +#define cpu_to_be16(val) (val) +#define cpu_to_be32(val) (val) +#define cpu_to_be64(val) (val) +#define le16_to_cpu(val) bswap_16(val) +#define le32_to_cpu(val) bswap_32(val) +#define le64_to_cpu(val) bswap_64(val) +#define be16_to_cpu(val) (val) +#define be32_to_cpu(val) (val) +#define be64_to_cpu(val) (val) +#endif + +#define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) + +struct memelfheader { + unsigned ei_class; + unsigned ei_data; + unsigned e_type; + unsigned e_machine; + unsigned e_flags; + unsigned e_phnum; + unsigned e_notenum; + unsigned long e_entry; + struct memelfphdr *e_phdr; + struct memelfnote *e_notes; +}; + +struct memelfphdr { + uint64_t p_vaddr; + uint64_t p_paddr; + uint64_t p_filesz; + uint64_t p_memsz; + void *p_data; + unsigned p_type; + unsigned p_flags; +}; + +struct memelfnote { + unsigned n_type; + char *n_name; + void *n_desc; + unsigned n_descsz; +}; + +#define OPT_HELP 'h' +#define OPT_VERSION 'v' +#define OPT_TYPE 't' +#define OPT_KERNEL 256 +#define OPT_OUTPUT 257 +#define OPT_MAX 258 + +#define MKELF_OPTIONS \ + { "help", 0, 0, OPT_HELP }, \ + { "version", 0, 0, OPT_VERSION }, \ + { "kernel", 1, 0, OPT_KERNEL }, \ + { "output", 1, 0, OPT_OUTPUT }, \ + { "type", 1, 0, OPT_TYPE }, + +#define MKELF_OPT_STR "hvt:" + +extern probe_t vmlinux_i386_probe; +extern probe_t bzImage_i386_probe; +extern probe_t linux_i386_probe; +extern mkelf_t linux_i386_mkelf; +extern usage_t linux_i386_usage; + +extern probe_t linux_ia64_probe; +extern mkelf_t linux_ia64_mkelf; +extern usage_t linux_ia64_usage; + +#endif /* MKELFIMAGE_H */ diff --git a/util/mkelfImage/kunzip_src/arch/alpha/include/stddef.h b/util/mkelfImage/kunzip_src/arch/alpha/include/stddef.h new file mode 100644 index 0000000000..37ee13858a --- /dev/null +++ b/util/mkelfImage/kunzip_src/arch/alpha/include/stddef.h @@ -0,0 +1,15 @@ +#ifndef ALPHA_STDDEF_H +#define ALPHA_STDDEF_H + +typedef long ptrdiff_t; +typedef unsigned long size_t; +typedef long ssize_t; + +typedef int wchar_t; +typedef unsigned int wint_t; + +#define NULL 0 + +#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) + +#endif /* ALPHA_STDDEF_H */ diff --git a/util/mkelfImage/kunzip_src/arch/alpha/include/stdint.h b/util/mkelfImage/kunzip_src/arch/alpha/include/stdint.h new file mode 100644 index 0000000000..9b93a0c84f --- /dev/null +++ b/util/mkelfImage/kunzip_src/arch/alpha/include/stdint.h @@ -0,0 +1,53 @@ +#ifndef ALPHA_STDINT_H +#define ALPHA_STDINT_H + +/* Exact integral types */ +typedef unsigned char uint8_t; +typedef signed char int8_t; + +typedef unsigned short uint16_t; +typedef signed short int16_t; + +typedef unsigned int uint32_t; +typedef signed int int32_t; + +typedef unsigned long uint64_t; +typedef signed long int64_t; + + +/* Small types */ +typedef unsigned char uint_least8_t; +typedef signed char int_least8_t; + +typedef unsigned short uint_least16_t; +typedef signed short int_least16_t; + +typedef unsigned int uint_least32_t; +typedef signed int int_least32_t; + +typedef unsigned long uint_least64_t; +typedef signed long int_least64_t; + +/* Fast Types */ +typedef unsigned char uint_fast8_t; +typedef signed char int_fast8_t; + +typedef unsigned long uint_fast16_t; +typedef signed long int_fast16_t; + +typedef unsigned long uint_fast32_t; +typedef signed long int_fast32_t; + +typedef unsigned long uint_fast64_t; +typedef signed long int_fast64_t; + +/* Types for `void *' pointers. */ +typedef long intptr_t; +typedef unsigned long uintptr_t; + +/* Largest integral types */ +typedef long intmax_t; +typedef unsigned long uintmax_t; + + +#endif /* ALPHA_STDINT_H */ diff --git a/util/mkelfImage/kunzip_src/arch/alpha/include/va-alpha.h b/util/mkelfImage/kunzip_src/arch/alpha/include/va-alpha.h new file mode 100644 index 0000000000..2528a712ad --- /dev/null +++ b/util/mkelfImage/kunzip_src/arch/alpha/include/va-alpha.h @@ -0,0 +1,128 @@ +/* GNU C varargs and stdargs support for the DEC Alpha. */ + +/* Note: We must use the name __builtin_savregs. GCC attaches special + significance to that name. In particular, regardless of where in a + function __builtin_saveregs is called, GCC moves the call up to the + very start of the function. */ + +/* Define __gnuc_va_list. */ + +#ifndef __GNUC_VA_LIST +#define __GNUC_VA_LIST + +/* In VMS, __gnuc_va_list is simply char *; on OSF, it's a structure. */ + +#ifdef __VMS__ +typedef char *__gnuc_va_list; +#else + +typedef struct { + char *__base; /* Pointer to first integer register. */ + int __offset; /* Byte offset of args so far. */ +} __gnuc_va_list; +#endif + +#endif /* __GNUC_VA_LIST */ + +/* If this is for internal libc use, don't define anything but + __gnuc_va_list. */ + +#if !defined(__GNUC_VA_LIST_1) && (defined (_STDARG_H) || defined (_VARARGS_H)) +#define __GNUC_VA_LIST_1 + +#define _VA_LIST +#define _VA_LIST_ + +typedef __gnuc_va_list va_list; + +#if !defined(_STDARG_H) + +/* varargs support */ +#define va_alist __builtin_va_alist +#define va_dcl int __builtin_va_alist;... +#ifdef __VMS__ +#define va_start(pvar) ((pvar) = __builtin_saveregs ()) +#else +#define va_start(pvar) ((pvar) = * (__gnuc_va_list *) __builtin_saveregs ()) +#endif + +#else /* STDARG.H */ + +/* ANSI alternative. */ + +/* Call __builtin_next_arg even though we aren't using its value, so that + we can verify that firstarg is correct. */ + +#ifdef __VMS__ +#define va_start(pvar, firstarg) \ + (__builtin_next_arg (firstarg), \ + (pvar) = __builtin_saveregs ()) +#else +#define va_start(pvar, firstarg) \ + (__builtin_next_arg (firstarg), \ + (pvar) = *(__gnuc_va_list *) __builtin_saveregs ()) +#endif + +#endif /* _STDARG_H */ + +#define va_end(__va) ((void) 0) + +/* Values returned by __builtin_classify_type. */ + +enum { + __no_type_class = -1, + __void_type_class, + __integer_type_class, + __char_type_class, + __enumeral_type_class, + __boolean_type_class, + __pointer_type_class, + __reference_type_class, + __offset_type_class, + __real_type_class, + __complex_type_class, + __function_type_class, + __method_type_class, + __record_type_class, + __union_type_class, + __array_type_class, + __string_type_class, + __set_type_class, + __file_type_class, + __lang_type_class +}; + +/* Note that parameters are always aligned at least to a word boundary + (when passed) regardless of what GCC's __alignof__ operator says. */ + +/* Avoid errors if compiling GCC v2 with GCC v1. */ +#if __GNUC__ == 1 +#define __extension__ +#endif + +/* Get the size of a type in bytes, rounded up to an integral number + of words. */ + +#define __va_tsize(__type) \ + (((sizeof (__type) + __extension__ sizeof (long long) - 1) \ + / __extension__ sizeof (long long)) * __extension__ sizeof (long long)) + +#ifdef __VMS__ +#define va_arg(__va, __type) \ +(*(((__va) += __va_tsize (__type)), \ + (__type *)(void *)((__va) - __va_tsize (__type)))) + +#else + +#define va_arg(__va, __type) \ +(*(((__va).__offset += __va_tsize (__type)), \ + (__type *)(void *)((__va).__base + (__va).__offset \ + - (((__builtin_classify_type (* (__type *) 0) \ + == __real_type_class) && (__va).__offset <= (6 * 8)) \ + ? (6 * 8) + 8 : __va_tsize (__type))))) +#endif + +/* Copy __gnuc_va_list into another variable of this type. */ +#define __va_copy(dest, src) (dest) = (src) + +#endif /* __GNUC_VA_LIST_1 */ diff --git a/util/mkelfImage/kunzip_src/arch/alpha/lib/Makefile b/util/mkelfImage/kunzip_src/arch/alpha/lib/Makefile new file mode 100644 index 0000000000..2fd15b06a0 --- /dev/null +++ b/util/mkelfImage/kunzip_src/arch/alpha/lib/Makefile @@ -0,0 +1,17 @@ +ARCH_OPTIONS= + +OBJECTS += __divqu.o __remqu.o __divlu.o __remlu.o + +$(OBJDIR)/__divqu.o: $(SRC)/arch/alpha/lib/divide.S + $(CC) $(CFLAGS) -DDIV -c -o $@ $^ + +$(OBJDIR)/__remqu.o: $(SRC)/arch/alpha/lib/divide.S + $(CC) $(CFLAGS) -DREM -c -o $@ $^ + +$(OBJDIR)/__divlu.o: $(SRC)/arch/alpha/lib/divide.S + $(CC) $(CFLAGS) -DDIV -DINTSIZE -c -o $@ $^ + +$(OBJDIR)/__remlu.o: $(SRC)/arch/alpha/lib/divide.S + $(CC) $(CFLAGS) -DREM -DINTSIZE -c -o $@ $^ + + diff --git a/util/mkelfImage/kunzip_src/arch/alpha/lib/divide.S b/util/mkelfImage/kunzip_src/arch/alpha/lib/divide.S new file mode 100644 index 0000000000..a4bc1f751e --- /dev/null +++ b/util/mkelfImage/kunzip_src/arch/alpha/lib/divide.S @@ -0,0 +1,195 @@ +/* + * cpu/ev6/divide.S + * + * (C) 1995 Linus Torvalds + * + * Alpha division.. + */ + +/* + * The alpha chip doesn't provide hardware division, so we have to do it + * by hand. The compiler expects the functions + * + * __divqu: 64-bit unsigned long divide + * __remqu: 64-bit unsigned long remainder + * __divqs/__remqs: signed 64-bit + * __divlu/__remlu: unsigned 32-bit + * __divls/__remls: signed 32-bit + * + * These are not normal C functions: instead of the normal + * calling sequence, these expect their arguments in registers + * $24 and $25, and return the result in $27. Register $28 may + * be clobbered (assembly temporary), anything else must be saved. + * + * In short: painful. + * + * This is a rather simple bit-at-a-time algorithm: it's very good + * at dividing random 64-bit numbers, but the more usual case where + * the divisor is small is handled better by the DEC algorithm + * using lookup tables. This uses much less memory, though, and is + * nicer on the cache.. Besides, I don't know the copyright status + * of the DEC code. + */ + +/* + * My temporaries: + * $0 - current bit + * $1 - shifted divisor + * $2 - modulus/quotient + * + * $23 - return address + * $24 - dividend + * $25 - divisor + * + * $27 - quotient/modulus + * $28 - compare status + */ + +#define halt .long 0 + +/* + * Select function type and registers + */ +#define mask $0 +#define divisor $1 +#define compare $28 +#define tmp1 $3 +#define tmp2 $4 + +#ifdef DIV +#define DIV_ONLY(x,y...) x,##y +#define MOD_ONLY(x,y...) +#define func(x) __div##x +#define modulus $2 +#define quotient $27 +#define GETSIGN(x) xor $24,$25,x +#define STACK 48 +#else +#define DIV_ONLY(x,y...) +#define MOD_ONLY(x,y...) x,##y +#define func(x) __rem##x +#define modulus $27 +#define quotient $2 +#define GETSIGN(x) bis $24,$24,x +#define STACK 32 +#endif + +/* + * For 32-bit operations, we need to extend to 64-bit + */ +#ifdef INTSIZE +#define ufunction func(lu) +#define sfunction func(l) +#define LONGIFY(x) zapnot x,15,x +#define SLONGIFY(x) addl x,0,x +#else +#define ufunction func(qu) +#define sfunction func(q) +#define LONGIFY(x) +#define SLONGIFY(x) +#endif + +.set noat +.align 3 +.globl ufunction +.ent ufunction +ufunction: + subq $30,STACK,$30 + .frame $30,STACK,$23 + .prologue 0 + +7: stq $1, 0($30) + bis $25,$25,divisor + stq $2, 8($30) + bis $24,$24,modulus + stq $0,16($30) + bis $31,$31,quotient + LONGIFY(divisor) + stq tmp1,24($30) + LONGIFY(modulus) + bis $31,1,mask + DIV_ONLY(stq tmp2,32($30)) + beq divisor, 9f /* div by zero */ + +#ifdef INTSIZE + /* + * shift divisor left, using 3-bit shifts for + * 32-bit divides as we can't overflow. Three-bit + * shifts will result in looping three times less + * here, but can result in two loops more later. + * Thus using a large shift isn't worth it (and + * s8add pairs better than a sll..) + */ +1: cmpult divisor,modulus,compare + s8addq divisor,$31,divisor + s8addq mask,$31,mask + bne compare,1b +#else +1: cmpult divisor,modulus,compare + blt divisor, 2f + addq divisor,divisor,divisor + addq mask,mask,mask + bne compare,1b + unop +#endif + + /* ok, start to go right again.. */ +2: DIV_ONLY(addq quotient,mask,tmp2) + srl mask,1,mask + cmpule divisor,modulus,compare + subq modulus,divisor,tmp1 + DIV_ONLY(cmovne compare,tmp2,quotient) + srl divisor,1,divisor + cmovne compare,tmp1,modulus + bne mask,2b + +9: ldq $1, 0($30) + ldq $2, 8($30) + ldq $0,16($30) + ldq tmp1,24($30) + DIV_ONLY(ldq tmp2,32($30)) + addq $30,STACK,$30 + ret $31,($23),1 + .end ufunction + +/* + * Uhh.. Ugly signed division. I'd rather not have it at all, but + * it's needed in some circumstances. There are different ways to + * handle this, really. This does: + * -a / b = a / -b = -(a / b) + * -a % b = -(a % b) + * a % -b = a % b + * which is probably not the best solution, but at least should + * have the property that (x/y)*y + (x%y) = x. + */ +.align 3 +.globl sfunction +.ent sfunction +sfunction: + subq $30,STACK,$30 + .frame $30,STACK,$23 + .prologue 0 + bis $24,$25,$28 + SLONGIFY($28) + bge $28,7b + stq $24,0($30) + subq $31,$24,$28 + stq $25,8($30) + cmovlt $24,$28,$24 /* abs($24) */ + stq $23,16($30) + subq $31,$25,$28 + stq tmp1,24($30) + cmovlt $25,$28,$25 /* abs($25) */ + unop + bsr $23,ufunction + ldq $24,0($30) + ldq $25,8($30) + GETSIGN($28) + subq $31,$27,tmp1 + SLONGIFY($28) + ldq $23,16($30) + cmovlt $28,tmp1,$27 + ldq tmp1,24($30) + addq $30,STACK,$30 + ret $31,($23),1 + .end sfunction diff --git a/util/mkelfImage/kunzip_src/arch/alpha/lib/kunzip.lds b/util/mkelfImage/kunzip_src/arch/alpha/lib/kunzip.lds new file mode 100644 index 0000000000..ed632686a8 --- /dev/null +++ b/util/mkelfImage/kunzip_src/arch/alpha/lib/kunzip.lds @@ -0,0 +1,50 @@ +PAGE_SIZE = 65536; +BASIC_ALIGN = 8; +OUTPUT_FORMAT("elf64-alpha") +ENTRY(__start) +SECTIONS +{ + . = PAGE_SIZE; + _start = .; + /* + * First we place the code and read only data (typically const declared). + * This get placed in rom. + */ + .text : { + _text = .; + *(.text) + _etext = .; + _rodata = .; + *(.rodata); + _erodata = .; + } + /* Global data */ + .data : { + _data = .; + *(.data) + CONSTRUCTORS + *(.got) + *(.sdata) + _edata = .; + } + + /* Important align _bss so bss may be zeroed with quadword access */ + . = ALIGN(BASIC_ALIGN); + .bss : { + _bss = .; + *(.sbss) + *(.scommon) + *(.bss) + *(COMMON) + *(.heap) + *(.stack) + /* Important align _ebss so bss may be zeroed with quadword access */ + . = ALIGN(BASIC_ALIGN); + _ebss = .; + } + _end = .; + + /DISCARD/ : { + *(*) + } +} diff --git a/util/mkelfImage/kunzip_src/arch/alpha/lib/start.S b/util/mkelfImage/kunzip_src/arch/alpha/lib/start.S new file mode 100644 index 0000000000..a89f4ca6de --- /dev/null +++ b/util/mkelfImage/kunzip_src/arch/alpha/lib/start.S @@ -0,0 +1,89 @@ +.set noat +.set noreorder +.text + +__original_registers: + .quad 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + +__entry: + .quad entry + +.globl __start +__start: + br $27, __save_registers +__save_registers: + lda $27, (__original_registers - __save_registers)($27) + stq $0, 0($27) + stq $1, 8($27) + stq $2, 16($27) + stq $3, 24($27) + stq $4, 32($27) + stq $5, 40($27) + stq $6, 48($27) + stq $7, 56($27) + stq $8, 64($27) + stq $9, 72($27) + stq $10, 80($27) + stq $11, 88($27) + stq $12, 96($27) + stq $13, 104($27) + stq $14, 112($27) + stq $15, 120($27) + stq $16, 128($27) + stq $17, 136($27) + stq $18, 144($27) + stq $19, 152($27) + stq $20, 160($27) + stq $21, 168($27) + stq $22, 176($27) + stq $23, 184($27) + stq $24, 192($27) + stq $25, 200($27) + stq $26, 208($27) + stq $28, 224($27) + stq $29, 232($27) + stq $30, 240($27) + +__normal_start: + ldgp $29, (__normal_start - __original_registers)($27) + lda $30, _estack + jsr $26, kunzip + +.globl jmp_to_program_entry +jmp_to_program_entry: + br $27, __restore_registers +__restore_registers: + lda $27,(__original_registers - __restore_registers)($27) + stq $16, (__entry - __original_registers)($27) + ldq $0, 0($27) + ldq $1, 8($27) + ldq $2, 16($27) + ldq $3, 24($27) + ldq $4, 32($27) + ldq $5, 40($27) + ldq $6, 48($27) + ldq $7, 56($27) + ldq $8, 64($27) + ldq $9, 72($27) + ldq $10, 80($27) + ldq $11, 88($27) + ldq $12, 96($27) + ldq $13, 104($27) + ldq $14, 112($27) + ldq $15, 120($27) + ldq $16, 128($27) + ldq $17, 136($27) + ldq $18, 144($27) + ldq $19, 152($27) + ldq $20, 160($27) + ldq $21, 168($27) + ldq $22, 176($27) + ldq $23, 184($27) + ldq $24, 192($27) + ldq $25, 200($27) + ldq $26, 208($27) + ldq $28, 224($27) + ldq $29, 232($27) + ldq $30, 240($27) + ldq $27, (__entry - __original_registers)($27) + jsr $31, ($27) diff --git a/util/mkelfImage/kunzip_src/arch/i386/include/stddef.h b/util/mkelfImage/kunzip_src/arch/i386/include/stddef.h new file mode 100644 index 0000000000..88a3b48957 --- /dev/null +++ b/util/mkelfImage/kunzip_src/arch/i386/include/stddef.h @@ -0,0 +1,15 @@ +#ifndef I386_STDDEF_H +#define I386_STDDEF_H + +typedef long ptrdiff_t; +typedef unsigned long size_t; +typedef long ssize_t; + +typedef int wchar_t; +typedef unsigned int wint_t; + +#define NULL 0 + +#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) + +#endif I386_STDDEF_H diff --git a/util/mkelfImage/kunzip_src/arch/i386/include/stdint.h b/util/mkelfImage/kunzip_src/arch/i386/include/stdint.h new file mode 100644 index 0000000000..58d7519cde --- /dev/null +++ b/util/mkelfImage/kunzip_src/arch/i386/include/stdint.h @@ -0,0 +1,52 @@ +#ifndef I386_STDINT_H +#define I386_STDINT_H + +/* Exact integral types */ +typedef unsigned char uint8_t; +typedef signed char int8_t; + +typedef unsigned short uint16_t; +typedef signed short int16_t; + +typedef unsigned int uint32_t; +typedef signed int int32_t; + +typedef unsigned long long uint64_t; +typedef signed long long int64_t; + +/* Small types */ +typedef unsigned char uint_least8_t; +typedef signed char int_least8_t; + +typedef unsigned short uint_least16_t; +typedef signed short int_least16_t; + +typedef unsigned int uint_least32_t; +typedef signed int int_least32_t; + +typedef unsigned long long uint_least64_t; +typedef signed long long int_least64_t; + +/* Fast Types */ +typedef unsigned char uint_fast8_t; +typedef signed char int_fast8_t; + +typedef unsigned int uint_fast16_t; +typedef signed int int_fast16_t; + +typedef unsigned int uint_fast32_t; +typedef signed int int_fast32_t; + +typedef unsigned long long uint_fast64_t; +typedef signed long long int_fast64_t; + +/* Types for `void *' pointers. */ +typedef int intptr_t; +typedef unsigned int uintptr_t; + +/* Largest integral types */ +typedef long long int intmax_t; +typedef unsigned long long uintmax_t; + + +#endif /* I386_STDINT_H */ diff --git a/util/mkelfImage/kunzip_src/arch/i386/lib/Makefile b/util/mkelfImage/kunzip_src/arch/i386/lib/Makefile new file mode 100644 index 0000000000..df2474d210 --- /dev/null +++ b/util/mkelfImage/kunzip_src/arch/i386/lib/Makefile @@ -0,0 +1 @@ +ARCH_OPTIONS= diff --git a/util/mkelfImage/kunzip_src/arch/i386/lib/kunzip.lds b/util/mkelfImage/kunzip_src/arch/i386/lib/kunzip.lds new file mode 100644 index 0000000000..0e649005cf --- /dev/null +++ b/util/mkelfImage/kunzip_src/arch/i386/lib/kunzip.lds @@ -0,0 +1,50 @@ +PAGE_SIZE = 4096; +BASIC_ALIGN = 8; +OUTPUT_FORMAT("elf32-i386") +ENTRY(__start) +SECTIONS +{ + . = PAGE_SIZE; + _start = .; + /* + * First we place the code and read only data (typically const declared). + * This get placed in rom. + */ + .text : { + _text = .; + *(.text) + _etext = .; + _rodata = .; + *(.rodata); + _erodata = .; + } + /* Global data */ + .data : { + _data = .; + *(.data) + CONSTRUCTORS + *(.got) + *(.sdata) + _edata = .; + } + + /* Important align _bss so bss may be zeroed with quadword access */ + . = ALIGN(BASIC_ALIGN); + .bss : { + _bss = .; + *(.sbss) + *(.scommon) + *(.bss) + *(COMMON) + *(.heap) + *(.stack) + /* Important align _ebss so bss may be zeroed with quadword access */ + . = ALIGN(BASIC_ALIGN); + _ebss = .; + } + _end = .; + + /DISCARD/ : { + *(*) + } +} diff --git a/util/mkelfImage/kunzip_src/arch/i386/lib/start.S b/util/mkelfImage/kunzip_src/arch/i386/lib/start.S new file mode 100644 index 0000000000..fec7c9da66 --- /dev/null +++ b/util/mkelfImage/kunzip_src/arch/i386/lib/start.S @@ -0,0 +1,36 @@ +.text + +__original_registers: + .long 0, 0, 0, 0, 0, 0 , 0 , 0 +__entry: + .long entry + +.globl __start +__start: + movl %eax, 0+__original_registers + movl %ebx, 4+__original_registers + movl %ecx, 8+__original_registers + movl %edx, 12+__original_registers + movl %esi, 16+__original_registers + movl %edi, 20+__original_registers + movl %esp, 24+__original_registers + movl %ebp, 28+__original_registers + +__normal_start: + movl $_estack, %esp + call kunzip + +.globl jmp_to_program_entry +jmp_to_program_entry: + movl 4(%esp), %eax + movl %eax, __entry + movl 0+__original_registers, %eax + movl 4+__original_registers, %ebx + movl 8+__original_registers, %ecx + movl 12+__original_registers, %edx + movl 16+__original_registers, %esi + movl 20+__original_registers, %edi + movl 24+__original_registers, %esp + movl 28+__original_registers, %ebp + jmp *__entry +
\ No newline at end of file diff --git a/util/mkelfImage/kunzip_src/include/stdarg.h b/util/mkelfImage/kunzip_src/include/stdarg.h new file mode 100644 index 0000000000..24f3383198 --- /dev/null +++ b/util/mkelfImage/kunzip_src/include/stdarg.h @@ -0,0 +1,205 @@ +/* stdarg.h for GNU. + Note that the type used in va_arg is supposed to match the + actual type **after default promotions**. + Thus, va_arg (..., short) is not valid. */ + +#ifndef _STDARG_H +#ifndef _ANSI_STDARG_H_ +#ifndef __need___va_list +#define _STDARG_H +#define _ANSI_STDARG_H_ +#endif /* not __need___va_list */ +#undef __need___va_list + +#ifdef __clipper__ +#include "va-clipper.h" +#else +#ifdef __m88k__ +#include "va-m88k.h" +#else +#ifdef __i860__ +#include "va-i860.h" +#else +#ifdef __hppa__ +#include "va-pa.h" +#else +#ifdef __mips__ +#include "va-mips.h" +#else +#ifdef __sparc__ +#include "va-sparc.h" +#else +#ifdef __i960__ +#include "va-i960.h" +#else +#ifdef __alpha__ +#include "va-alpha.h" +#else +#if defined (__H8300__) || defined (__H8300H__) || defined (__H8300S__) +#include "va-h8300.h" +#else +#if defined (__PPC__) && (defined (_CALL_SYSV) || defined (_WIN32)) +#include "va-ppc.h" +#else +#ifdef __arc__ +#include "va-arc.h" +#else +#ifdef __M32R__ +#include "va-m32r.h" +#else +#ifdef __sh__ +#include "va-sh.h" +#else +#ifdef __mn10300__ +#include "va-mn10300.h" +#else +#ifdef __mn10200__ +#include "va-mn10200.h" +#else +#ifdef __v850__ +#include "va-v850.h" +#else + +/* Define __gnuc_va_list. */ + +#ifndef __GNUC_VA_LIST +#define __GNUC_VA_LIST +#if defined(__svr4__) || defined(_AIX) || defined(_M_UNIX) || defined(__NetBSD__) +typedef char *__gnuc_va_list; +#else +typedef void *__gnuc_va_list; +#endif +#endif + +/* Define the standard macros for the user, + if this invocation was from the user program. */ +#ifdef _STDARG_H + +/* Amount of space required in an argument list for an arg of type TYPE. + TYPE may alternatively be an expression whose type is used. */ + +#if defined(sysV68) +#define __va_rounded_size(TYPE) \ + (((sizeof (TYPE) + sizeof (short) - 1) / sizeof (short)) * sizeof (short)) +#else +#define __va_rounded_size(TYPE) \ + (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int)) +#endif + +#define va_start(AP, LASTARG) \ + (AP = ((__gnuc_va_list) __builtin_next_arg (LASTARG))) + +#undef va_end +void va_end (__gnuc_va_list); /* Defined in libgcc.a */ +#define va_end(AP) ((void)0) + +/* We cast to void * and then to TYPE * because this avoids + a warning about increasing the alignment requirement. */ + +#if (defined (__arm__) && ! defined (__ARMEB__)) || defined (__i386__) || defined (__i860__) || defined (__ns32000__) || defined (__vax__) +/* This is for little-endian machines; small args are padded upward. */ +#define va_arg(AP, TYPE) \ + (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \ + *((TYPE *) (void *) ((char *) (AP) - __va_rounded_size (TYPE)))) +#else /* big-endian */ +/* This is for big-endian machines; small args are padded downward. */ +#define va_arg(AP, TYPE) \ + (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \ + *((TYPE *) (void *) ((char *) (AP) \ + - ((sizeof (TYPE) < __va_rounded_size (char) \ + ? sizeof (TYPE) : __va_rounded_size (TYPE)))))) +#endif /* big-endian */ + +/* Copy __gnuc_va_list into another variable of this type. */ +#define __va_copy(dest, src) (dest) = (src) + +#endif /* _STDARG_H */ + +#endif /* not v850 */ +#endif /* not mn10200 */ +#endif /* not mn10300 */ +#endif /* not sh */ +#endif /* not m32r */ +#endif /* not arc */ +#endif /* not powerpc with V.4 calling sequence */ +#endif /* not h8300 */ +#endif /* not alpha */ +#endif /* not i960 */ +#endif /* not sparc */ +#endif /* not mips */ +#endif /* not hppa */ +#endif /* not i860 */ +#endif /* not m88k */ +#endif /* not clipper */ + +#ifdef _STDARG_H +/* Define va_list, if desired, from __gnuc_va_list. */ +/* We deliberately do not define va_list when called from + stdio.h, because ANSI C says that stdio.h is not supposed to define + va_list. stdio.h needs to have access to that data type, + but must not use that name. It should use the name __gnuc_va_list, + which is safe because it is reserved for the implementation. */ + +#ifdef _HIDDEN_VA_LIST /* On OSF1, this means varargs.h is "half-loaded". */ +#undef _VA_LIST +#endif + +#ifdef _BSD_VA_LIST +#undef _BSD_VA_LIST +#endif + +#if defined(__svr4__) || (defined(_SCO_DS) && !defined(__VA_LIST)) +/* SVR4.2 uses _VA_LIST for an internal alias for va_list, + so we must avoid testing it and setting it here. + SVR4 uses _VA_LIST as a flag in stdarg.h, but we should + have no conflict with that. */ +#ifndef _VA_LIST_ +#define _VA_LIST_ +#ifdef __i860__ +#ifndef _VA_LIST +#define _VA_LIST va_list +#endif +#endif /* __i860__ */ +typedef __gnuc_va_list va_list; +#ifdef _SCO_DS +#define __VA_LIST +#endif +#endif /* _VA_LIST_ */ +#else /* not __svr4__ || _SCO_DS */ + +/* The macro _VA_LIST_ is the same thing used by this file in Ultrix. + But on BSD NET2 we must not test or define or undef it. + (Note that the comments in NET 2's ansi.h + are incorrect for _VA_LIST_--see stdio.h!) */ +#if !defined (_VA_LIST_) || defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__) || defined(WINNT) +/* The macro _VA_LIST_DEFINED is used in Windows NT 3.5 */ +#ifndef _VA_LIST_DEFINED +/* The macro _VA_LIST is used in SCO Unix 3.2. */ +#ifndef _VA_LIST +/* The macro _VA_LIST_T_H is used in the Bull dpx2 */ +#ifndef _VA_LIST_T_H +typedef __gnuc_va_list va_list; +#endif /* not _VA_LIST_T_H */ +#endif /* not _VA_LIST */ +#endif /* not _VA_LIST_DEFINED */ +#if !(defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__)) +#define _VA_LIST_ +#endif +#ifndef _VA_LIST +#define _VA_LIST +#endif +#ifndef _VA_LIST_DEFINED +#define _VA_LIST_DEFINED +#endif +#ifndef _VA_LIST_T_H +#define _VA_LIST_T_H +#endif + +#endif /* not _VA_LIST_, except on certain systems */ + +#endif /* not __svr4__ */ + +#endif /* _STDARG_H */ + +#endif /* not _ANSI_STDARG_H_ */ +#endif /* not _STDARG_H */ diff --git a/util/mkelfImage/kunzip_src/include/stdlib.h b/util/mkelfImage/kunzip_src/include/stdlib.h new file mode 100644 index 0000000000..eb67d20fe7 --- /dev/null +++ b/util/mkelfImage/kunzip_src/include/stdlib.h @@ -0,0 +1,14 @@ +#ifndef STDLIB_H +#define STDLIB_H + +#include <stddef.h> + +extern void *malloc(size_t size); +void free(void *ptr); + +/* Extensions to malloc... */ +typedef size_t malloc_mark_t; +void malloc_mark(malloc_mark_t *place); +void malloc_release(malloc_mark_t *place); + +#endif /* STDLIB_H */ diff --git a/util/mkelfImage/kunzip_src/include/string.h b/util/mkelfImage/kunzip_src/include/string.h new file mode 100644 index 0000000000..dbaa1ecd17 --- /dev/null +++ b/util/mkelfImage/kunzip_src/include/string.h @@ -0,0 +1,31 @@ +#ifndef STRING_H +#define STRING_H + +#include <stddef.h> + +// yes, linux has fancy ones. We don't care. This stuff gets used +// hardly at all. And the pain of including those files is just too high. + +//extern inline void strcpy(char *dst, char *src) {while (*src) *dst++ = *src++;} + +//extern inline int strlen(char *src) { int i = 0; while (*src++) i++; return i;} + +static inline size_t strnlen(const char *src, size_t max) { + int i = 0; + if (max<0) { + while (*src++) + i++; + return i; + } + else { + while ((*src++) && (i < max)) + i++; + return i; + } +} + +extern void *memcpy(void *dest, const void *src, size_t n); +extern void *memset(void *s, int c, size_t n); +extern int memcmp(const void *s1, const void *s2, size_t n); + +#endif /* STRING_H */ diff --git a/util/mkelfImage/kunzip_src/include/types.h b/util/mkelfImage/kunzip_src/include/types.h new file mode 100644 index 0000000000..4b9dadfe55 --- /dev/null +++ b/util/mkelfImage/kunzip_src/include/types.h @@ -0,0 +1,18 @@ +#ifndef TYPES_H +#define TYPES_H + +#include <stdint.h> +#include <stddef.h> + +typedef uint8_t u8; +typedef int8_t s8; +typedef uint16_t u16; +typedef int16_t s16; +typedef uint32_t u32; +typedef int32_t s32; +typedef uint64_t u64; +typedef int64_t s64; + +/* FIXME is BITS_PER_LONG needed? */ + +#endif diff --git a/util/mkelfImage/kunzip_src/lib/inflate.c b/util/mkelfImage/kunzip_src/lib/inflate.c new file mode 100644 index 0000000000..894a98cd27 --- /dev/null +++ b/util/mkelfImage/kunzip_src/lib/inflate.c @@ -0,0 +1,1178 @@ +#define DEBG(x) +#define DEBG1(x) +/* Taken from /usr/src/linux/lib/inflate.c [unmodified] + Used for start32, 1/11/2000 + James Hendricks, Dale Webster */ + +/* inflate.c -- Not copyrighted 1992 by Mark Adler + version c10p1, 10 January 1993 */ + +/* + * Adapted for booting Linux by Hannu Savolainen 1993 + * based on gzip-1.0.3 + * + * Nicolas Pitre <nico@cam.org>, 1999/04/14 : + * Little mods for all variable to reside either into rodata or bss segments + * by marking constant variables with 'const' and initializing all the others + * at run-time only. This allows for the kernel uncompressor to run + * directly from Flash or ROM memory on embeded systems. + */ + +/* + Inflate deflated (PKZIP's method 8 compressed) data. The compression + method searches for as much of the current string of bytes (up to a + length of 258) in the previous 32 K bytes. If it doesn't find any + matches (of at least length 3), it codes the next byte. Otherwise, it + codes the length of the matched string and its distance backwards from + the current position. There is a single Huffman code that codes both + single bytes (called "literals") and match lengths. A second Huffman + code codes the distance information, which follows a length code. Each + length or distance code actually represents a base value and a number + of "extra" (sometimes zero) bits to get to add to the base value. At + the end of each deflated block is a special end-of-block (EOB) literal/ + length code. The decoding process is basically: get a literal/length + code; if EOB then done; if a literal, emit the decoded byte; if a + length then get the distance and emit the referred-to bytes from the + sliding window of previously emitted data. + + There are (currently) three kinds of inflate blocks: stored, fixed, and + dynamic. The compressor deals with some chunk of data at a time, and + decides which method to use on a chunk-by-chunk basis. A chunk might + typically be 32 K or 64 K. If the chunk is incompressible, then the + "stored" method is used. In this case, the bytes are simply stored as + is, eight bits per byte, with none of the above coding. The bytes are + preceded by a count, since there is no longer an EOB code. + + If the data is compressible, then either the fixed or dynamic methods + are used. In the dynamic method, the compressed data is preceded by + an encoding of the literal/length and distance Huffman codes that are + to be used to decode this block. The representation is itself Huffman + coded, and so is preceded by a description of that code. These code + descriptions take up a little space, and so for small blocks, there is + a predefined set of codes, called the fixed codes. The fixed method is + used if the block codes up smaller that way (usually for quite small + chunks), otherwise the dynamic method is used. In the latter case, the + codes are customized to the probabilities in the current block, and so + can code it much better than the pre-determined fixed codes. + + The Huffman codes themselves are decoded using a multi-level table + lookup, in order to maximize the speed of decoding plus the speed of + building the decoding tables. See the comments below that precede the + lbits and dbits tuning parameters. + */ + + +/* + Notes beyond the 1.93a appnote.txt: + + 1. Distance pointers never point before the beginning of the output + stream. + 2. Distance pointers can point back across blocks, up to 32k away. + 3. There is an implied maximum of 7 bits for the bit length table and + 15 bits for the actual data. + 4. If only one code exists, then it is encoded using one bit. (Zero + would be more efficient, but perhaps a little confusing.) If two + codes exist, they are coded using one bit each (0 and 1). + 5. There is no way of sending zero distance codes--a dummy must be + sent if there are none. (History: a pre 2.0 version of PKZIP would + store blocks with no distance codes, but this was discovered to be + too harsh a criterion.) Valid only for 1.93a. 2.04c does allow + zero distance codes, which is sent as one code of zero bits in + length. + 6. There are up to 286 literal/length codes. Code 256 represents the + end-of-block. Note however that the static length tree defines + 288 codes just to fill out the Huffman codes. Codes 286 and 287 + cannot be used though, since there is no length base or extra bits + defined for them. Similarly, there are up to 30 distance codes. + However, static trees define 32 codes (all 5 bits) to fill out the + Huffman codes, but the last two had better not show up in the data. + 7. Unzip can check dynamic Huffman blocks for complete code sets. + The exception is that a single code would not be complete (see #4). + 8. The five bits following the block type is really the number of + literal codes sent minus 257. + 9. Length codes 8,16,16 are interpreted as 13 length codes of 8 bits + (1+6+6). Therefore, to output three times the length, you output + three codes (1+1+1), whereas to output four times the same length, + you only need two codes (1+3). Hmm. + 10. In the tree reconstruction algorithm, Code = Code + Increment + only if BitLength(i) is not zero. (Pretty obvious.) + 11. Correction: 4 Bits: # of Bit Length codes - 4 (4 - 19) + 12. Note: length code 284 can represent 227-258, but length code 285 + really is 258. The last length deserves its own, short code + since it gets used a lot in very redundant files. The length + 258 is special since 258 - 3 (the min match length) is 255. + 13. The literal/length and distance code bit lengths are read as a + single stream of lengths. It is possible (and advantageous) for + a repeat code (16, 17, or 18) to go across the boundary between + the two sets of lengths. + */ + +#ifdef RCSID +static char rcsid[] = "#Id: inflate.c,v 0.14 1993/06/10 13:27:04 jloup Exp #"; +#endif + +#ifndef STATIC + +#if defined(STDC_HEADERS) || defined(HAVE_STDLIB_H) +# include <sys/types.h> +# include <stdlib.h> +#endif + +#include "gzip.h" +#define STATIC +#endif /* !STATIC */ + +#define slide window + +/* Huffman code lookup table entry--this entry is four bytes for machines + that have 16-bit pointers (e.g. PC's in the small or medium model). + Valid extra bits are 0..13. e == 15 is EOB (end of block), e == 16 + means that v is a literal, 16 < e < 32 means that v is a pointer to + the next table, which codes e - 16 bits, and lastly e == 99 indicates + an unused code. If a code with e == 99 is looked up, this implies an + error in the data. */ +struct huft { + uch e; /* number of extra bits or operation */ + uch b; /* number of bits in this code or subcode */ + union { + ush n; /* literal, length base, or distance base */ + struct huft *t; /* pointer to next level of table */ + } v; +}; + + +/* Function prototypes */ +STATIC int huft_build OF((unsigned *, unsigned, unsigned, + const ush *, const ush *, struct huft **, int *)); +STATIC int huft_free OF((struct huft *)); +STATIC int inflate_codes OF((struct huft *, struct huft *, int, int)); +STATIC int inflate_stored OF((void)); +STATIC int inflate_fixed OF((void)); +STATIC int inflate_dynamic OF((void)); +STATIC int inflate_block OF((int *)); +STATIC int inflate OF((void)); + + +/* The inflate algorithm uses a sliding 32 K byte window on the uncompressed + stream to find repeated byte strings. This is implemented here as a + circular buffer. The index is updated simply by incrementing and then + ANDing with 0x7fff (32K-1). */ +/* It is left to other modules to supply the 32 K area. It is assumed + to be usable as if it were declared "uch slide[32768];" or as just + "uch *slide;" and then malloc'ed in the latter case. The definition + must be in unzip.h, included above. */ +/* unsigned wp; current position in slide */ +#define wp outcnt +#define flush_output(w) (wp=(w),flush_window()) + +/* Tables for deflate from PKZIP's appnote.txt. */ +static const unsigned border[] = { /* Order of the bit length code lengths */ + 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; +static const ush cplens[] = { /* Copy lengths for literal codes 257..285 */ + 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, + 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; + /* note: see note #13 above about the 258 in this list. */ +static const ush cplext[] = { /* Extra bits for literal codes 257..285 */ + 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, + 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 99, 99}; /* 99==invalid */ +static const ush cpdist[] = { /* Copy offsets for distance codes 0..29 */ + 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, + 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, + 8193, 12289, 16385, 24577}; +static const ush cpdext[] = { /* Extra bits for distance codes */ + 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, + 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, + 12, 12, 13, 13}; + + + +/* Macros for inflate() bit peeking and grabbing. + The usage is: + + NEEDBITS(j) + x = b & mask_bits[j]; + DUMPBITS(j) + + where NEEDBITS makes sure that b has at least j bits in it, and + DUMPBITS removes the bits from b. The macros use the variable k + for the number of bits in b. Normally, b and k are register + variables for speed, and are initialized at the beginning of a + routine that uses these macros from a global bit buffer and count. + + If we assume that EOB will be the longest code, then we will never + ask for bits with NEEDBITS that are beyond the end of the stream. + So, NEEDBITS should not read any more bytes than are needed to + meet the request. Then no bytes need to be "returned" to the buffer + at the end of the last block. + + However, this assumption is not true for fixed blocks--the EOB code + is 7 bits, but the other literal/length codes can be 8 or 9 bits. + (The EOB code is shorter than other codes because fixed blocks are + generally short. So, while a block always has an EOB, many other + literal/length codes have a significantly lower probability of + showing up at all.) However, by making the first table have a + lookup of seven bits, the EOB code will be found in that first + lookup, and so will not require that too many bits be pulled from + the stream. + */ + +STATIC ulg bb; /* bit buffer */ +STATIC unsigned bk; /* bits in bit buffer */ + +STATIC const ush mask_bits[] = { + 0x0000, + 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff, + 0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff +}; + +#define NEXTBYTE() (uch)get_byte() +#define NEEDBITS(n) {while(k<(n)){b|=((ulg)NEXTBYTE())<<k;k+=8;}} +#define DUMPBITS(n) {b>>=(n);k-=(n);} + + +/* + Huffman code decoding is performed using a multi-level table lookup. + The fastest way to decode is to simply build a lookup table whose + size is determined by the longest code. However, the time it takes + to build this table can also be a factor if the data being decoded + is not very long. The most common codes are necessarily the + shortest codes, so those codes dominate the decoding time, and hence + the speed. The idea is you can have a shorter table that decodes the + shorter, more probable codes, and then point to subsidiary tables for + the longer codes. The time it costs to decode the longer codes is + then traded against the time it takes to make longer tables. + + This results of this trade are in the variables lbits and dbits + below. lbits is the number of bits the first level table for literal/ + length codes can decode in one step, and dbits is the same thing for + the distance codes. Subsequent tables are also less than or equal to + those sizes. These values may be adjusted either when all of the + codes are shorter than that, in which case the longest code length in + bits is used, or when the shortest code is *longer* than the requested + table size, in which case the length of the shortest code in bits is + used. + + There are two different values for the two tables, since they code a + different number of possibilities each. The literal/length table + codes 286 possible values, or in a flat code, a little over eight + bits. The distance table codes 30 possible values, or a little less + than five bits, flat. The optimum values for speed end up being + about one bit more than those, so lbits is 8+1 and dbits is 5+1. + The optimum values may differ though from machine to machine, and + possibly even between compilers. Your mileage may vary. + */ + + +STATIC const int lbits = 9; /* bits in base literal/length lookup table */ +STATIC const int dbits = 6; /* bits in base distance lookup table */ + + +/* If BMAX needs to be larger than 16, then h and x[] should be ulg. */ +#define BMAX 16 /* maximum bit length of any code (16 for explode) */ +#define N_MAX 288 /* maximum number of codes in any set */ + + +STATIC unsigned hufts; /* track memory usage */ + + +STATIC int huft_build(b, n, s, d, e, t, m) +unsigned *b; /* code lengths in bits (all assumed <= BMAX) */ +unsigned n; /* number of codes (assumed <= N_MAX) */ +unsigned s; /* number of simple-valued codes (0..s-1) */ +const ush *d; /* list of base values for non-simple codes */ +const ush *e; /* list of extra bits for non-simple codes */ +struct huft **t; /* result: starting table */ +int *m; /* maximum lookup bits, returns actual */ +/* Given a list of code lengths and a maximum table size, make a set of + tables to decode that set of codes. Return zero on success, one if + the given code set is incomplete (the tables are still built in this + case), two if the input is invalid (all zero length codes or an + oversubscribed set of lengths), and three if not enough memory. */ +{ + unsigned a; /* counter for codes of length k */ + unsigned c[BMAX+1]; /* bit length count table */ + unsigned f; /* i repeats in table every f entries */ + int g; /* maximum code length */ + int h; /* table level */ + register unsigned i; /* counter, current code */ + register unsigned j; /* counter */ + register int k; /* number of bits in current code */ + int l; /* bits per table (returned in m) */ + register unsigned *p; /* pointer into c[], b[], or v[] */ + register struct huft *q; /* points to current table */ + struct huft r; /* table entry for structure assignment */ + struct huft *u[BMAX]; /* table stack */ + unsigned v[N_MAX]; /* values in order of bit length */ + register int w; /* bits before this table == (l * h) */ + unsigned x[BMAX+1]; /* bit offsets, then code stack */ + unsigned *xp; /* pointer into x */ + int y; /* number of dummy codes added */ + unsigned z; /* number of entries in current table */ + +DEBG("huft1 "); + + /* Generate counts for each bit length */ + memzero(c, sizeof(c)); + p = b; i = n; + do { + Tracecv(*p, (stderr, (n-i >= ' ' && n-i <= '~' ? "%c %d\n" : "0x%x %d\n"), + n-i, *p)); + c[*p]++; /* assume all entries <= BMAX */ + p++; /* Can't combine with above line (Solaris bug) */ + } while (--i); + if (c[0] == n) /* null input--all zero length codes */ + { + *t = (struct huft *)NULL; + *m = 0; + return 0; + } + +DEBG("huft2 "); + + /* Find minimum and maximum length, bound *m by those */ + l = *m; + for (j = 1; j <= BMAX; j++) + if (c[j]) + break; + k = j; /* minimum code length */ + if ((unsigned)l < j) + l = j; + for (i = BMAX; i; i--) + if (c[i]) + break; + g = i; /* maximum code length */ + if ((unsigned)l > i) + l = i; + *m = l; + +DEBG("huft3 "); + + /* Adjust last length count to fill out codes, if needed */ + for (y = 1 << j; j < i; j++, y <<= 1) + if ((y -= c[j]) < 0) + return 2; /* bad input: more codes than bits */ + if ((y -= c[i]) < 0) + return 2; + c[i] += y; + +DEBG("huft4 "); + + /* Generate starting offsets into the value table for each length */ + x[1] = j = 0; + p = c + 1; xp = x + 2; + while (--i) { /* note that i == g from above */ + *xp++ = (j += *p++); + } + +DEBG("huft5 "); + + /* Make a table of values in order of bit lengths */ + p = b; i = 0; + do { + if ((j = *p++) != 0) + v[x[j]++] = i; + } while (++i < n); + +DEBG("h6 "); + + /* Generate the Huffman codes and for each, make the table entries */ + x[0] = i = 0; /* first Huffman code is zero */ + p = v; /* grab values in bit order */ + h = -1; /* no tables yet--level -1 */ + w = -l; /* bits decoded == (l * h) */ + u[0] = (struct huft *)NULL; /* just to keep compilers happy */ + q = (struct huft *)NULL; /* ditto */ + z = 0; /* ditto */ +DEBG("h6a "); + + /* go through the bit lengths (k already is bits in shortest code) */ + for (; k <= g; k++) + { +DEBG("h6b "); + a = c[k]; + while (a--) + { +DEBG("h6b1 "); + /* here i is the Huffman code of length k bits for value *p */ + /* make tables up to required level */ + while (k > w + l) + { +DEBG1("1 "); + h++; + w += l; /* previous table always l bits */ + + /* compute minimum size table less than or equal to l bits */ + z = (z = g - w) > (unsigned)l ? l : z; /* upper limit on table size */ + if ((f = 1 << (j = k - w)) > a + 1) /* try a k-w bit table */ + { /* too few codes for k-w bit table */ +DEBG1("2 "); + f -= a + 1; /* deduct codes from patterns left */ + xp = c + k; + while (++j < z) /* try smaller tables up to z bits */ + { + if ((f <<= 1) <= *++xp) + break; /* enough codes to use up j bits */ + f -= *xp; /* else deduct codes from patterns */ + } + } +DEBG1("3 "); + z = 1 << j; /* table entries for j-bit table */ + + /* allocate and link in new table */ + if ((q = (struct huft *)malloc((z + 1)*sizeof(struct huft))) == + (struct huft *)NULL) + { + if (h) + huft_free(u[0]); + return 3; /* not enough memory */ + } +DEBG1("4 "); + hufts += z + 1; /* track memory usage */ + *t = q + 1; /* link to list for huft_free() */ + *(t = &(q->v.t)) = (struct huft *)NULL; + u[h] = ++q; /* table starts after link */ + +DEBG1("5 "); + /* connect to last table, if there is one */ + if (h) + { + x[h] = i; /* save pattern for backing up */ + r.b = (uch)l; /* bits to dump before this table */ + r.e = (uch)(16 + j); /* bits in this table */ + r.v.t = q; /* pointer to this table */ + j = i >> (w - l); /* (get around Turbo C bug) */ + u[h-1][j] = r; /* connect to last table */ + } +DEBG1("6 "); + } +DEBG("h6c "); + + /* set up table entry in r */ + r.b = (uch)(k - w); + if (p >= v + n) + r.e = 99; /* out of values--invalid code */ + else if (*p < s) + { + r.e = (uch)(*p < 256 ? 16 : 15); /* 256 is end-of-block code */ + r.v.n = (ush)(*p); /* simple code is just the value */ + p++; /* one compiler does not like *p++ */ + } + else + { + r.e = (uch)e[*p - s]; /* non-simple--look up in lists */ + r.v.n = d[*p++ - s]; + } +DEBG("h6d "); + + /* fill code-like entries with r */ + f = 1 << (k - w); + for (j = i >> w; j < z; j += f) + q[j] = r; + + /* backwards increment the k-bit code i */ + for (j = 1 << (k - 1); i & j; j >>= 1) + i ^= j; + i ^= j; + + /* backup over finished tables */ + while ((i & ((1 << w) - 1)) != x[h]) + { + h--; /* don't need to update q */ + w -= l; + } +DEBG("h6e "); + } +DEBG("h6f "); + } + +DEBG("huft7 "); + + /* Return true (1) if we were given an incomplete table */ + return y != 0 && g != 1; +} + + + +STATIC int huft_free(t) +struct huft *t; /* table to free */ +/* Free the malloc'ed tables built by huft_build(), which makes a linked + list of the tables it made, with the links in a dummy first entry of + each table. */ +{ + register struct huft *p, *q; + + + /* Go through linked list, freeing from the malloced (t[-1]) address. */ + p = t; + while (p != (struct huft *)NULL) + { + q = (--p)->v.t; + free((char*)p); + p = q; + } + return 0; +} + + +STATIC int inflate_codes(tl, td, bl, bd) +struct huft *tl, *td; /* literal/length and distance decoder tables */ +int bl, bd; /* number of bits decoded by tl[] and td[] */ +/* inflate (decompress) the codes in a deflated (compressed) block. + Return an error code or zero if it all goes ok. */ +{ + register unsigned e; /* table entry flag/number of extra bits */ + unsigned n, d; /* length and index for copy */ + unsigned w; /* current window position */ + struct huft *t; /* pointer to table entry */ + unsigned ml, md; /* masks for bl and bd bits */ + register ulg b; /* bit buffer */ + register unsigned k; /* number of bits in bit buffer */ + + + /* make local copies of globals */ + b = bb; /* initialize bit buffer */ + k = bk; + w = wp; /* initialize window position */ + + /* inflate the coded data */ + ml = mask_bits[bl]; /* precompute masks for speed */ + md = mask_bits[bd]; + for (;;) /* do until end of block */ + { + NEEDBITS((unsigned)bl) + if ((e = (t = tl + ((unsigned)b & ml))->e) > 16) + do { + if (e == 99) + return 1; + DUMPBITS(t->b) + e -= 16; + NEEDBITS(e) + } while ((e = (t = t->v.t + ((unsigned)b & mask_bits[e]))->e) > 16); + DUMPBITS(t->b) + if (e == 16) /* then it's a literal */ + { + slide[w++] = (uch)t->v.n; + Tracevv((stderr, "%c", slide[w-1])); + if (w == WSIZE) + { + flush_output(w); + w = 0; + } + } + else /* it's an EOB or a length */ + { + /* exit if end of block */ + if (e == 15) + break; + + /* get length of block to copy */ + NEEDBITS(e) + n = t->v.n + ((unsigned)b & mask_bits[e]); + DUMPBITS(e); + + /* decode distance of block to copy */ + NEEDBITS((unsigned)bd) + if ((e = (t = td + ((unsigned)b & md))->e) > 16) + do { + if (e == 99) + return 1; + DUMPBITS(t->b) + e -= 16; + NEEDBITS(e) + } while ((e = (t = t->v.t + ((unsigned)b & mask_bits[e]))->e) > 16); + DUMPBITS(t->b) + NEEDBITS(e) + d = w - t->v.n - ((unsigned)b & mask_bits[e]); + DUMPBITS(e) + Tracevv((stderr,"\\[%d,%d]", w-d, n)); + + /* do the copy */ + do { + n -= (e = (e = WSIZE - ((d &= WSIZE-1) > w ? d : w)) > n ? n : e); +#if !defined(NOMEMCPY) && !defined(DEBUG) + if (w - d >= e) /* (this test assumes unsigned comparison) */ + { + memcpy(slide + w, slide + d, e); + w += e; + d += e; + } + else /* do it slow to avoid memcpy() overlap */ +#endif /* !NOMEMCPY */ + do { + slide[w++] = slide[d++]; + Tracevv((stderr, "%c", slide[w-1])); + } while (--e); + if (w == WSIZE) + { + flush_output(w); + w = 0; + } + } while (n); + } + } + + + /* restore the globals from the locals */ + wp = w; /* restore global window pointer */ + bb = b; /* restore global bit buffer */ + bk = k; + + /* done */ + return 0; +} + + + +STATIC int inflate_stored() +/* "decompress" an inflated type 0 (stored) block. */ +{ + unsigned n; /* number of bytes in block */ + unsigned w; /* current window position */ + register ulg b; /* bit buffer */ + register unsigned k; /* number of bits in bit buffer */ + +DEBG("<stor"); + + /* make local copies of globals */ + b = bb; /* initialize bit buffer */ + k = bk; + w = wp; /* initialize window position */ + + + /* go to byte boundary */ + n = k & 7; + DUMPBITS(n); + + + /* get the length and its complement */ + NEEDBITS(16) + n = ((unsigned)b & 0xffff); + DUMPBITS(16) + NEEDBITS(16) + if (n != (unsigned)((~b) & 0xffff)) + return 1; /* error in compressed data */ + DUMPBITS(16) + + + /* read and output the compressed data */ + while (n--) + { + NEEDBITS(8) + slide[w++] = (uch)b; + if (w == WSIZE) + { + flush_output(w); + w = 0; + } + DUMPBITS(8) + } + + + /* restore the globals from the locals */ + wp = w; /* restore global window pointer */ + bb = b; /* restore global bit buffer */ + bk = k; + + DEBG(">"); + return 0; +} + + + +STATIC int inflate_fixed() +/* decompress an inflated type 1 (fixed Huffman codes) block. We should + either replace this with a custom decoder, or at least precompute the + Huffman tables. */ +{ + int i; /* temporary variable */ + struct huft *tl; /* literal/length code table */ + struct huft *td; /* distance code table */ + int bl; /* lookup bits for tl */ + int bd; /* lookup bits for td */ + unsigned l[288]; /* length list for huft_build */ + +DEBG("<fix"); + + /* set up literal table */ + for (i = 0; i < 144; i++) + l[i] = 8; + for (; i < 256; i++) + l[i] = 9; + for (; i < 280; i++) + l[i] = 7; + for (; i < 288; i++) /* make a complete, but wrong code set */ + l[i] = 8; + bl = 7; + if ((i = huft_build(l, 288, 257, cplens, cplext, &tl, &bl)) != 0) + return i; + + + /* set up distance table */ + for (i = 0; i < 30; i++) /* make an incomplete code set */ + l[i] = 5; + bd = 5; + if ((i = huft_build(l, 30, 0, cpdist, cpdext, &td, &bd)) > 1) + { + huft_free(tl); + + DEBG(">"); + return i; + } + + + /* decompress until an end-of-block code */ + if (inflate_codes(tl, td, bl, bd)) + return 1; + + + /* free the decoding tables, return */ + huft_free(tl); + huft_free(td); + return 0; +} + + + +STATIC int inflate_dynamic() +/* decompress an inflated type 2 (dynamic Huffman codes) block. */ +{ + int i; /* temporary variables */ + unsigned j; + unsigned l; /* last length */ + unsigned m; /* mask for bit lengths table */ + unsigned n; /* number of lengths to get */ + struct huft *tl; /* literal/length code table */ + struct huft *td; /* distance code table */ + int bl; /* lookup bits for tl */ + int bd; /* lookup bits for td */ + unsigned nb; /* number of bit length codes */ + unsigned nl; /* number of literal/length codes */ + unsigned nd; /* number of distance codes */ +#ifdef PKZIP_BUG_WORKAROUND + unsigned ll[288+32]; /* literal/length and distance code lengths */ +#else + unsigned ll[286+30]; /* literal/length and distance code lengths */ +#endif + register ulg b; /* bit buffer */ + register unsigned k; /* number of bits in bit buffer */ + +DEBG("<dyn"); + + /* make local bit buffer */ + b = bb; + k = bk; + + + /* read in table lengths */ + NEEDBITS(5) + nl = 257 + ((unsigned)b & 0x1f); /* number of literal/length codes */ + DUMPBITS(5) + NEEDBITS(5) + nd = 1 + ((unsigned)b & 0x1f); /* number of distance codes */ + DUMPBITS(5) + NEEDBITS(4) + nb = 4 + ((unsigned)b & 0xf); /* number of bit length codes */ + DUMPBITS(4) +#ifdef PKZIP_BUG_WORKAROUND + if (nl > 288 || nd > 32) +#else + if (nl > 286 || nd > 30) +#endif + return 1; /* bad lengths */ + +DEBG("dyn1 "); + + /* read in bit-length-code lengths */ + for (j = 0; j < nb; j++) + { + NEEDBITS(3) + ll[border[j]] = (unsigned)b & 7; + DUMPBITS(3) + } + for (; j < 19; j++) + ll[border[j]] = 0; + +DEBG("dyn2 "); + + /* build decoding table for trees--single level, 7 bit lookup */ + bl = 7; + if ((i = huft_build(ll, 19, 19, NULL, NULL, &tl, &bl)) != 0) + { + if (i == 1) + huft_free(tl); + return i; /* incomplete code set */ + } + +DEBG("dyn3 "); + + /* read in literal and distance code lengths */ + n = nl + nd; + m = mask_bits[bl]; + i = l = 0; + while ((unsigned)i < n) + { + NEEDBITS((unsigned)bl) + j = (td = tl + ((unsigned)b & m))->b; + DUMPBITS(j) + j = td->v.n; + if (j < 16) /* length of code in bits (0..15) */ + ll[i++] = l = j; /* save last length in l */ + else if (j == 16) /* repeat last length 3 to 6 times */ + { + NEEDBITS(2) + j = 3 + ((unsigned)b & 3); + DUMPBITS(2) + if ((unsigned)i + j > n) + return 1; + while (j--) + ll[i++] = l; + } + else if (j == 17) /* 3 to 10 zero length codes */ + { + NEEDBITS(3) + j = 3 + ((unsigned)b & 7); + DUMPBITS(3) + if ((unsigned)i + j > n) + return 1; + while (j--) + ll[i++] = 0; + l = 0; + } + else /* j == 18: 11 to 138 zero length codes */ + { + NEEDBITS(7) + j = 11 + ((unsigned)b & 0x7f); + DUMPBITS(7) + if ((unsigned)i + j > n) + return 1; + while (j--) + ll[i++] = 0; + l = 0; + } + } + +DEBG("dyn4 "); + + /* free decoding table for trees */ + huft_free(tl); + +DEBG("dyn5 "); + + /* restore the global bit buffer */ + bb = b; + bk = k; + +DEBG("dyn5a "); + + /* build the decoding tables for literal/length and distance codes */ + bl = lbits; + if ((i = huft_build(ll, nl, 257, cplens, cplext, &tl, &bl)) != 0) + { +DEBG("dyn5b "); + if (i == 1) { + error(" incomplete literal tree\n"); + huft_free(tl); + } + return i; /* incomplete code set */ + } +DEBG("dyn5c "); + bd = dbits; + if ((i = huft_build(ll + nl, nd, 0, cpdist, cpdext, &td, &bd)) != 0) + { +DEBG("dyn5d "); + if (i == 1) { + error(" incomplete distance tree\n"); +#ifdef PKZIP_BUG_WORKAROUND + i = 0; + } +#else + huft_free(td); + } + huft_free(tl); + return i; /* incomplete code set */ +#endif + } + +DEBG("dyn6 "); + + /* decompress until an end-of-block code */ + if (inflate_codes(tl, td, bl, bd)) + return 1; + +DEBG("dyn7 "); + + /* free the decoding tables, return */ + huft_free(tl); + huft_free(td); + + DEBG(">"); + return 0; +} + + + +STATIC int inflate_block(e) +int *e; /* last block flag */ +/* decompress an inflated block */ +{ + unsigned t; /* block type */ + register ulg b; /* bit buffer */ + register unsigned k; /* number of bits in bit buffer */ + + DEBG("<blk"); + + /* make local bit buffer */ + b = bb; + k = bk; + + + /* read in last block bit */ + NEEDBITS(1) + *e = (int)b & 1; + DUMPBITS(1) + + + /* read in block type */ + NEEDBITS(2) + t = (unsigned)b & 3; + DUMPBITS(2) + + + /* restore the global bit buffer */ + bb = b; + bk = k; + + /* inflate that block type */ + if (t == 2) + return inflate_dynamic(); + if (t == 0) + return inflate_stored(); + if (t == 1) + return inflate_fixed(); + + DEBG(">"); + + /* bad block type */ + return 2; +} + + + +STATIC int inflate() +/* decompress an inflated entry */ +{ + int e; /* last block flag */ + int r; /* result code */ + unsigned h; /* maximum struct huft's malloc'ed */ + malloc_mark_t mark; + + /* initialize window, bit buffer */ + wp = 0; + bk = 0; + bb = 0; + + + /* decompress until the last block */ + h = 0; + do { + hufts = 0; + malloc_mark(&mark); + if ((r = inflate_block(&e)) != 0) { + malloc_release(&mark); + return r; + } + malloc_release(&mark); + if (hufts > h) + h = hufts; + } while (!e); + + /* Undo too much lookahead. The next read will be byte aligned so we + * can discard unused bits in the last meaningful byte. + */ + while (bk >= 8) { + bk -= 8; + inptr--; + } + + /* flush out slide */ + flush_output(wp); + + + /* return success */ + DBG(("<%u> ", h)); + return 0; +} + +/********************************************************************** + * + * The following are support routines for inflate.c + * + **********************************************************************/ + +static ulg crc_32_tab[256]; +static ulg crc; /* initialized in makecrc() so it'll reside in bss */ +#define CRC_VALUE (crc ^ 0xffffffffL) + +/* + * Code to compute the CRC-32 table. Borrowed from + * gzip-1.0.3/makecrc.c. + */ + +static void +makecrc(void) +{ +/* Not copyrighted 1990 Mark Adler */ + + unsigned long c; /* crc shift register */ + unsigned long e; /* polynomial exclusive-or pattern */ + int i; /* counter for all possible eight bit values */ + int k; /* byte being shifted into crc apparatus */ + + /* terms of polynomial defining this crc (except x^32): */ + static const int p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26}; + + /* Make exclusive-or pattern from polynomial */ + e = 0; + for (i = 0; i < sizeof(p)/sizeof(int); i++) + e |= 1L << (31 - p[i]); + + crc_32_tab[0] = 0; + + for (i = 1; i < 256; i++) + { + c = 0; + for (k = i | 256; k != 1; k >>= 1) + { + c = c & 1 ? (c >> 1) ^ e : c >> 1; + if (k & 1) + c ^= e; + } + crc_32_tab[i] = c; + } + + /* this is initialized here so this code could reside in ROM */ + crc = (ulg)0xffffffffL; /* shift register contents */ +} + +/* gzip flag byte */ +#define ASCII_FLAG 0x01 /* bit 0 set: file probably ASCII text */ +#define CONTINUATION 0x02 /* bit 1 set: continuation of multi-part gzip file */ +#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */ +#define ORIG_NAME 0x08 /* bit 3 set: original file name present */ +#define COMMENT 0x10 /* bit 4 set: file comment present */ +#define ENCRYPTED 0x20 /* bit 5 set: file is encrypted */ +#define RESERVED 0xC0 /* bit 6,7: reserved */ + +/* + * Do the uncompression! + */ +int gunzip(void) +{ + uch flags; + unsigned char magic[2]; /* magic header */ + char method; + ulg orig_crc = 0; /* original crc */ + ulg orig_len = 0; /* original uncompressed length */ + int res; + + magic[0] = (unsigned char)get_byte(); + magic[1] = (unsigned char)get_byte(); + method = (unsigned char)get_byte(); + + if (magic[0] != 037 || + ((magic[1] != 0213) && (magic[1] != 0236))) { + error("bad gzip magic numbers"); + return -1; + } + + /* We only support method #8, DEFLATED */ + if (method != 8) { + error("internal error, invalid method"); + return -1; + } + + flags = (uch)get_byte(); + if ((flags & ENCRYPTED) != 0) { + error("Input is encrypted\n"); + return -1; + } + if ((flags & CONTINUATION) != 0) { + error("Multi part input\n"); + return -1; + } + if ((flags & RESERVED) != 0) { + error("Input has invalid flags\n"); + return -1; + } + (ulg)get_byte(); /* Get timestamp */ + ((ulg)get_byte()) << 8; + ((ulg)get_byte()) << 16; + ((ulg)get_byte()) << 24; + + (void)get_byte(); /* Ignore extra flags for the moment */ + (void)get_byte(); /* Ignore OS type for the moment */ + + if ((flags & EXTRA_FIELD) != 0) { + unsigned len = (unsigned)get_byte(); + len |= ((unsigned)get_byte())<<8; + while (len--) (void)get_byte(); + } + + /* Get original file name if it was truncated */ + if ((flags & ORIG_NAME) != 0) { + /* Discard the old name */ + while (get_byte() != 0) /* null */ ; + } + + /* Discard file comment if any */ + if ((flags & COMMENT) != 0) { + while (get_byte() != 0) /* null */ ; + } + + /* Decompress */ + if ((res = inflate())) { + switch (res) { + case 0: + break; + case 1: + error("invalid compressed format (err=1)"); + break; + case 2: + error("invalid compressed format (err=2)"); + break; + case 3: + error("out of memory"); + break; + default: + error("invalid compressed format (other)"); + } + return -1; + } + + /* Get the crc and original length */ + /* crc32 (see algorithm.doc) + * uncompressed input size modulo 2^32 + */ + orig_crc = (ulg) get_byte(); + orig_crc |= (ulg) get_byte() << 8; + orig_crc |= (ulg) get_byte() << 16; + orig_crc |= (ulg) get_byte() << 24; + + orig_len = (ulg) get_byte(); + orig_len |= (ulg) get_byte() << 8; + orig_len |= (ulg) get_byte() << 16; + orig_len |= (ulg) get_byte() << 24; + + /* Validate decompression */ + if (orig_crc != CRC_VALUE) { + error("crc error"); + return -1; + } + if (orig_len != bytes_out) { + error("length error"); + return -1; + } + return 0; +} + + diff --git a/util/mkelfImage/kunzip_src/lib/kunzip.c b/util/mkelfImage/kunzip_src/lib/kunzip.c new file mode 100644 index 0000000000..4bfe504f70 --- /dev/null +++ b/util/mkelfImage/kunzip_src/lib/kunzip.c @@ -0,0 +1,170 @@ +#include <string.h> +#include <stdlib.h> + +/* + * gzip support routine declartions.. + * ========================================================= + */ + +#ifdef DEBUG +# define Trace(x) +# define Tracev(x) +# define Tracevv(x) +# define Tracec(c,x) +# define Tracecv(c,x) +# define DBG(x) printf x +#else +# define Trace(x) +# define Tracev(x) +# define Tracevv(x) +# define Tracec(c,x) +# define Tracecv(c,x) +# define DBG(x) +#endif + +void error(char *str) +{ + DBG(("%s\n", str)); +} + +static unsigned char *inbuf; /* input buffer */ +static unsigned int insize; /* valid bytes in inbuf */ +static unsigned int inptr; /* index of next byte to be processed in inbuf */ + +#if !defined(DEBUG) +#define get_byte() (inptr < insize ? inbuf[inptr++] : 0) +#else +static unsigned char get_byte(void) +{ + static int count; + unsigned char byte = (inptr < insize ? inbuf[inptr++] : 0); +#if 0 + printf("%02x ", byte); + if ((++count & 0x0f) == 0) { + printf("\n"); + } +#endif + return byte; +} + +#endif + +static void flush_window(void); + +static long bytes_out; /* total bytes compressed */ +static unsigned outcnt; /* bytes in output buffer */ + +#define WSIZE 0x8000 /* Window size must be at least 32k, and a power of two */ +static unsigned char window[WSIZE]; /* Sliding window buffer */ + +/* + * gzip declarations + */ + +#define OF(args) args +#define STATIC static + + +#define memzero(s, n) memset ((s), 0, (n)) + +typedef unsigned char uch; +typedef unsigned short ush; +typedef unsigned long ulg; + + + +#include "inflate.c" + + +/* Variables that gunzip doesn't need to see... */ +static unsigned char *output_ptr; +static unsigned long end_offset; +static struct unzip_region { + unsigned long start; + unsigned long end_offset; +} unzip_region; + +/* Data provided by the header */ +extern unsigned char zipped_data[]; +extern unsigned char zipped_data_end[]; +extern unsigned char entry; +/* Assembly language routines */ +extern void jmp_to_program_entry(void *); + +/* =========================================================================== + * Write the output window window[0..outcnt-1] and update crc and bytes_out. + * (Used for the decompressed data only.) + */ +static void flush_window(void) +{ + ulg c = crc; /* temporary variable */ + unsigned n; + unsigned long limit; + uch *in, *out, ch; + + limit = outcnt; + + + n = 0; + in = window; + while (n < outcnt) { + limit = end_offset - bytes_out +n; + if (limit > outcnt) { + limit = outcnt; + } + out = output_ptr; + DBG(("flush 0x%08lx start 0x%08lx limit 0x%08lx\n", + (unsigned long) out, (unsigned long)n, limit)); + for (; n < limit; n++) { + ch = *out++ = *in++; + c = crc_32_tab[((int) c ^ ch) & 0xff] ^ (c >> 8); + } + crc = c; + bytes_out += (out - output_ptr); + output_ptr = out; + if (bytes_out == end_offset) { + if (output_ptr == (unsigned char *)(&unzip_region+1)) { + output_ptr = (unsigned char *)(unzip_region.start); + end_offset = unzip_region.end_offset; + } else { + output_ptr = (unsigned char *)&unzip_region; + end_offset += sizeof(unzip_region); + } + } + } + outcnt = 0; +} + + +void gunzip_setup(void) +{ + DBG(("gunzip_setup\n")); + outcnt = 0; + bytes_out = 0; + + end_offset = sizeof(unzip_region); + output_ptr = (unsigned char *)&unzip_region; + + inbuf = &zipped_data[0]; + insize = zipped_data_end - zipped_data; + inptr = 0; + + makecrc(); + DBG(("gunzip_setup_done\n")); +} + + +int kunzip(int argc, char **argv) +{ + DBG(("kunzip\n")); + gunzip_setup(); + DBG(("pre_gunzip\n")); + if (gunzip() != 0) { + error("gunzip failed"); + while(1) {} + return -1; + } + DBG(("pre_jmp_to_program_entry: %p\n", &entry )); + jmp_to_program_entry(&entry); + return 0; +} diff --git a/util/mkelfImage/kunzip_src/lib/malloc.c b/util/mkelfImage/kunzip_src/lib/malloc.c new file mode 100644 index 0000000000..8e43e0c226 --- /dev/null +++ b/util/mkelfImage/kunzip_src/lib/malloc.c @@ -0,0 +1,42 @@ +#include <stdlib.h> + +extern unsigned char _heap, _eheap; +static size_t free_mem_ptr = (size_t)&_heap; /* Start of heap */ +static size_t free_mem_end_ptr = (size_t)&_eheap; /* End of heap */ + + +void malloc_mark(malloc_mark_t *place) +{ + *place = free_mem_ptr; +} + +void malloc_release(malloc_mark_t *ptr) +{ + free_mem_ptr = *ptr; +} + +void *malloc(size_t size) +{ + void *p; + + if (size < 0) + error("Error! malloc: Size < 0"); + if (free_mem_ptr <= 0) + error("Error! malloc: Free_mem_ptr <= 0"); + + free_mem_ptr = (free_mem_ptr + 3) & ~3; /* Align */ + + p = (void *) free_mem_ptr; + free_mem_ptr += size; + + if (free_mem_ptr >= free_mem_end_ptr) + error("Error! malloc: Free_mem_ptr >= free_mem_end_ptr"); + + + return p; +} + +void free(void *where) +{ + /* Don't care */ +} diff --git a/util/mkelfImage/kunzip_src/lib/memcmp.c b/util/mkelfImage/kunzip_src/lib/memcmp.c new file mode 100644 index 0000000000..46f13a41bd --- /dev/null +++ b/util/mkelfImage/kunzip_src/lib/memcmp.c @@ -0,0 +1,17 @@ +#include <string.h> + +int memcmp(const void *src1, const void *src2, size_t bytes) +{ + const unsigned char *s1, *s2; + int result; + s1 = src1; + s2 = src2; + result = 0; + while((bytes > 0) && (result == 0)) { + result = *s1 - *s2; + bytes--; + s1++; + s2++; + } + return result; +} diff --git a/util/mkelfImage/kunzip_src/lib/memcpy.c b/util/mkelfImage/kunzip_src/lib/memcpy.c new file mode 100644 index 0000000000..ad8e8bd3f0 --- /dev/null +++ b/util/mkelfImage/kunzip_src/lib/memcpy.c @@ -0,0 +1,11 @@ +#include <string.h> +void *memcpy(void *__dest, __const void *__src, size_t __n) +{ + int i; + char *d = (char *) __dest, *s = (char *) __src; + + for (i = 0; i < __n; i++) + d[i] = s[i]; + + return __dest; +} diff --git a/util/mkelfImage/kunzip_src/lib/memset.c b/util/mkelfImage/kunzip_src/lib/memset.c new file mode 100644 index 0000000000..c1bb4f841f --- /dev/null +++ b/util/mkelfImage/kunzip_src/lib/memset.c @@ -0,0 +1,12 @@ +#include <string.h> + +void *memset(void *s, int c, size_t n) +{ + int i; + char *ss = (char *) s; + + for (i = 0; i < n; i++) + ss[i] = c; + + return s; +} diff --git a/util/mkelfImage/linux-i386/Makefile b/util/mkelfImage/linux-i386/Makefile new file mode 100644 index 0000000000..51531d6f4b --- /dev/null +++ b/util/mkelfImage/linux-i386/Makefile @@ -0,0 +1,35 @@ +LI386_DIR:=linux-i386 +LI386_OBJ:=$(OBJDIR)/$(LI386_DIR) +LI386_DEP=Makefile Makefile.conf $(LI386_DIR)/Makefile + +$(LI386_OBJ)/mkelf-linux-i386.o: $(LI386_DIR)/mkelf-linux-i386.c $(LI386_DIR)/convert.bin.c $(LI386_DEP) + $(MKDIR) -p $(@D) + $(HOST_CC) $(HOST_CFLAGS) -c -g $< -o $@ + + +ifdef I386_CC + +$(LI386_DIR)/convert.bin.c: $(LI386_OBJ)/convert.bin $(OBJDIR)/bin/bin-to-hex $(LI386_DEP) + $(MKDIR) -p $(@D) + $(OBJDIR)/bin/bin-to-hex < $(LI386_OBJ)/convert.bin > $@ + +$(LI386_OBJ)/convert.bin: $(LI386_OBJ)/convert $(LI386_DEP) + $(MKDIR) -p $(@D) + $(I386_OBJCOPY) -O binary $< $@ + +CONVERT_LI386_OBJS=$(LI386_OBJ)/head.o $(LI386_OBJ)/convert_params.o + +$(LI386_OBJ)/convert: $(LI386_DIR)/convert.lds $(CONVERT_LI386_OBJS) $(LI386_DEP) + $(MKDIR) -p $(@D) + $(I386_LD) $(I386_LDFLAGS) -T $(LI386_DIR)/convert.lds -o $@ $(CONVERT_LI386_OBJS) + +$(LI386_OBJ)/head.o: $(LI386_DIR)/head.S $(LI386_DIR)/convert.h + $(MKDIR) -p $(@D) + $(I386_CPP) $(I386_CPPFLAGS) -DASSEMBLY $< | $(I386_AS) $(I386_ASFLAGS) -o $@ + +$(LI386_OBJ)/convert_params.o: $(LI386_DIR)/convert_params.c $(LI386_DIR)/convert.h $(LI386_DEP) + $(MKDIR) -p $(@D) + $(I386_CC) $(I386_CFLAGS) -c -o $@ $< + +endif + diff --git a/util/mkelfImage/linux-i386/convert.bin.c b/util/mkelfImage/linux-i386/convert.bin.c new file mode 100644 index 0000000000..7cf0eb5e72 --- /dev/null +++ b/util/mkelfImage/linux-i386/convert.bin.c @@ -0,0 +1,284 @@ +0xfc, 0xfa, 0xa3, 0xee, 0x01, 0x01, 0x00, 0x89, 0x1d, 0xf2, 0x01, 0x01, 0x00, 0x83, 0xfc, 0x00, +0x74, 0x09, 0x8b, 0x44, 0x24, 0x04, 0xa3, 0xf6, 0x01, 0x01, 0x00, 0x8b, 0x25, 0x8c, 0x10, 0x01, +0x00, 0x6a, 0x00, 0x9d, 0x31, 0xc0, 0xbf, 0xbc, 0x11, 0x01, 0x00, 0xb9, 0x44, 0x54, 0x01, 0x00, +0x29, 0xf9, 0xfc, 0xf3, 0xaa, 0xbe, 0x0c, 0x02, 0x01, 0x00, 0xbf, 0x00, 0x10, 0x02, 0x00, 0xb9, +0x70, 0x00, 0x00, 0x00, 0xf3, 0xa4, 0x0f, 0x01, 0x15, 0x06, 0x02, 0x01, 0x00, 0x0f, 0x01, 0x1d, +0x00, 0x02, 0x01, 0x00, 0xb8, 0x18, 0x00, 0x00, 0x00, 0x8e, 0xd8, 0x8e, 0xc0, 0x8e, 0xe0, 0x8e, +0xe8, 0x8e, 0xd0, 0x68, 0xa0, 0x10, 0x01, 0x00, 0xff, 0x35, 0xf6, 0x01, 0x01, 0x00, 0xff, 0x35, +0xf2, 0x01, 0x01, 0x00, 0xff, 0x35, 0xee, 0x01, 0x01, 0x00, 0xe8, 0x50, 0x08, 0x00, 0x00, 0x89, +0xc6, 0x83, 0xc4, 0x10, 0x6a, 0x00, 0x9d, 0x31, 0xdb, 0x31, 0xc0, 0x31, 0xc9, 0x31, 0xd2, 0x31, +0xff, 0x31, 0xe4, 0x31, 0xed, 0xea, 0x00, 0x00, 0x10, 0x00, 0x10, 0x00, 0x55, 0x89, 0xe5, 0x53, +0x56, 0x57, 0x8b, 0x7d, 0x08, 0x81, 0xef, 0x00, 0x00, 0x01, 0x00, 0x8b, 0x75, 0x0c, 0x56, 0xe8, +0xfc, 0x00, 0x00, 0x00, 0x66, 0x31, 0xdb, 0x66, 0xb8, 0x20, 0xe8, 0x00, 0x00, 0x66, 0xba, 0x50, +0x41, 0x4d, 0x53, 0x66, 0xb9, 0x14, 0x00, 0x00, 0x00, 0xcd, 0x15, 0x72, 0x18, 0x66, 0x3d, 0x50, +0x41, 0x4d, 0x53, 0x75, 0x10, 0x66, 0x4e, 0x66, 0x85, 0xf6, 0x74, 0x09, 0x83, 0xc7, 0x14, 0x66, +0x83, 0xfb, 0x00, 0x75, 0xd2, 0x66, 0xe8, 0x82, 0x00, 0x00, 0x00, 0x58, 0x29, 0xf0, 0x5f, 0x5e, +0x5b, 0x89, 0xec, 0x5d, 0xc3, 0x53, 0x56, 0x57, 0xe8, 0xb3, 0x00, 0x00, 0x00, 0xf9, 0x31, 0xc9, +0x31, 0xd2, 0xb8, 0x01, 0xe8, 0xcd, 0x15, 0x72, 0x28, 0x83, 0xf9, 0x00, 0x75, 0x09, 0x83, 0xfa, +0x00, 0x75, 0x04, 0x89, 0xc1, 0x89, 0xda, 0x66, 0x81, 0xe2, 0xff, 0xff, 0x00, 0x00, 0x66, 0xc1, +0xe2, 0x06, 0x66, 0x89, 0xd0, 0x66, 0x81, 0xe1, 0xff, 0xff, 0x00, 0x00, 0x66, 0x01, 0xc8, 0xeb, +0x03, 0x66, 0x31, 0xc0, 0x66, 0xe8, 0x33, 0x00, 0x00, 0x00, 0x5f, 0x5e, 0x5b, 0xc3, 0x53, 0x56, +0x57, 0xe8, 0x6a, 0x00, 0x00, 0x00, 0xb4, 0x88, 0xcd, 0x15, 0x66, 0x25, 0xff, 0xff, 0x00, 0x00, +0x66, 0xe8, 0x17, 0x00, 0x00, 0x00, 0x5f, 0x5e, 0x5b, 0xc3, 0xe8, 0x51, 0x00, 0x00, 0x00, 0xcd, +0x12, 0x89, 0xc1, 0x66, 0xe8, 0x04, 0x00, 0x00, 0x00, 0x66, 0x89, 0xc8, 0xc3, 0xfa, 0x2e, 0x67, +0x0f, 0x01, 0x15, 0x06, 0x02, 0x00, 0x00, 0x0f, 0x20, 0xc0, 0x66, 0x83, 0xc8, 0x01, 0x0f, 0x22, +0xc0, 0x66, 0xea, 0x89, 0x01, 0x01, 0x00, 0x10, 0x00, 0xb8, 0x18, 0x00, 0x00, 0x00, 0x8e, 0xd8, +0x8e, 0xc0, 0x8e, 0xd0, 0x81, 0xc4, 0x00, 0x00, 0x01, 0x00, 0x31, 0xc0, 0x8e, 0xe0, 0x8e, 0xe8, +0x58, 0x05, 0x00, 0x00, 0x01, 0x00, 0x50, 0x2e, 0x0f, 0x01, 0x1d, 0x00, 0x02, 0x01, 0x00, 0xc3, +0x58, 0x2d, 0x00, 0x00, 0x01, 0x00, 0x50, 0x81, 0xec, 0x00, 0x00, 0x01, 0x00, 0xea, 0xc4, 0x01, +0x00, 0x00, 0x08, 0x00, 0x0f, 0x20, 0xc0, 0x66, 0x83, 0xe0, 0xfe, 0x0f, 0x22, 0xc0, 0x66, 0xea, +0xd6, 0x01, 0x00, 0x00, 0x00, 0x10, 0x8c, 0xc8, 0x8e, 0xd8, 0x8e, 0xc0, 0x8e, 0xd0, 0x8e, 0xe0, +0x8e, 0xe8, 0x2e, 0x67, 0x0f, 0x01, 0x1d, 0xfa, 0x01, 0x00, 0x00, 0xfb, 0x66, 0xc3, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6f, 0x00, 0x00, 0x10, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x01, 0x9b, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, +0x00, 0x9a, 0xcf, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x92, 0xcf, 0x00, 0xff, 0xff, 0x00, 0x00, +0x01, 0x93, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, +0x00, 0x9a, 0xcf, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x92, 0xcf, 0x00, 0x55, 0x89, 0xe5, 0x89, +0xc1, 0xba, 0xfd, 0x03, 0x00, 0x00, 0xec, 0xa8, 0x20, 0x74, 0xf6, 0xb2, 0xf8, 0x88, 0xc8, 0xee, +0xba, 0xfd, 0x03, 0x00, 0x00, 0xec, 0xa8, 0x40, 0x74, 0xf6, 0xc9, 0xc3, 0x55, 0x83, 0xf8, 0x0a, +0x89, 0xe5, 0x53, 0x89, 0xc3, 0x75, 0x0a, 0xb8, 0x0d, 0x00, 0x00, 0x00, 0xe8, 0xcb, 0xff, 0xff, +0xff, 0x89, 0xd8, 0x5b, 0xc9, 0xeb, 0xc5, 0x55, 0x89, 0xe5, 0x57, 0x56, 0x53, 0x83, 0xec, 0x44, +0x8d, 0x45, 0x0c, 0x8b, 0x75, 0x08, 0x89, 0x45, 0xc0, 0x80, 0x3e, 0x00, 0x0f, 0x84, 0x5b, 0x01, +0x00, 0x00, 0x8a, 0x06, 0x3c, 0x25, 0x74, 0x0d, 0x0f, 0xbe, 0xc0, 0xe8, 0xbc, 0xff, 0xff, 0xff, +0xe9, 0x42, 0x01, 0x00, 0x00, 0x46, 0x8a, 0x06, 0x3c, 0x73, 0x75, 0x1d, 0x8b, 0x45, 0xc0, 0x8b, +0x18, 0x83, 0x45, 0xc0, 0x04, 0x80, 0x3b, 0x00, 0x0f, 0x84, 0x29, 0x01, 0x00, 0x00, 0x0f, 0xbe, +0x03, 0xe8, 0x96, 0xff, 0xff, 0xff, 0x43, 0xeb, 0xec, 0x3c, 0x4c, 0x8d, 0x7d, 0xc4, 0xc7, 0x45, +0xbc, 0x1c, 0x00, 0x00, 0x00, 0x75, 0x09, 0xc7, 0x45, 0xbc, 0x3c, 0x00, 0x00, 0x00, 0xeb, 0x1c, +0x3c, 0x6c, 0x74, 0x18, 0x3c, 0x68, 0x75, 0x15, 0xc7, 0x45, 0xbc, 0x0c, 0x00, 0x00, 0x00, 0x46, +0x80, 0x3e, 0x68, 0x75, 0x08, 0xc7, 0x45, 0xbc, 0x04, 0x00, 0x00, 0x00, 0x46, 0x8a, 0x16, 0x88, +0xd0, 0x83, 0xc8, 0x20, 0x3c, 0x78, 0x75, 0x61, 0x83, 0x7d, 0xbc, 0x1c, 0x7e, 0x0e, 0x8b, 0x45, +0xc0, 0x8b, 0x08, 0x83, 0x45, 0xc0, 0x08, 0x8b, 0x58, 0x04, 0xeb, 0x0b, 0x8b, 0x45, 0xc0, 0x8b, +0x08, 0x83, 0x45, 0xc0, 0x04, 0x31, 0xdb, 0x89, 0x5d, 0xb4, 0x89, 0xd3, 0x83, 0xe3, 0x20, 0x89, +0x4d, 0xb0, 0x89, 0x5d, 0xb8, 0x83, 0x7d, 0xbc, 0x00, 0x0f, 0x88, 0x96, 0x00, 0x00, 0x00, 0x8a, +0x4d, 0xbc, 0x8b, 0x55, 0xb4, 0x8b, 0x45, 0xb0, 0x0f, 0xad, 0xd0, 0xd3, 0xea, 0x80, 0xe1, 0x20, +0x74, 0x02, 0x89, 0xd0, 0x83, 0xe0, 0x0f, 0x8a, 0x5d, 0xb8, 0x0a, 0x98, 0x48, 0x0f, 0x01, 0x00, +0x88, 0x1f, 0x47, 0x83, 0x6d, 0xbc, 0x04, 0xeb, 0xd0, 0x80, 0xfa, 0x64, 0x75, 0x4e, 0x83, 0x7d, +0xbc, 0x1c, 0x7e, 0x09, 0x8b, 0x45, 0xc0, 0x83, 0x45, 0xc0, 0x08, 0xeb, 0x07, 0x8b, 0x45, 0xc0, +0x83, 0x45, 0xc0, 0x04, 0x8b, 0x10, 0x85, 0xd2, 0x79, 0x06, 0xc6, 0x07, 0x2d, 0xf7, 0xda, 0x47, +0x89, 0xfb, 0x89, 0xd0, 0x99, 0xb9, 0x0a, 0x00, 0x00, 0x00, 0xf7, 0xf9, 0x83, 0xc2, 0x30, 0x88, +0x17, 0x47, 0x85, 0xc0, 0x89, 0xc2, 0x75, 0xea, 0x8d, 0x4f, 0xff, 0x39, 0xd9, 0x76, 0x26, 0x0f, +0xbe, 0x11, 0x8a, 0x03, 0x88, 0x01, 0x88, 0x13, 0x49, 0x43, 0xeb, 0xef, 0x80, 0xfa, 0x63, 0x8d, +0x4f, 0x01, 0x75, 0x0d, 0x8b, 0x45, 0xc0, 0x8b, 0x00, 0x83, 0x45, 0xc0, 0x04, 0x88, 0x07, 0xeb, +0x02, 0x88, 0x17, 0x89, 0xcf, 0x8d, 0x5d, 0xc4, 0x39, 0xfb, 0x73, 0x0b, 0x0f, 0xbe, 0x03, 0xe8, +0x78, 0xfe, 0xff, 0xff, 0x43, 0xeb, 0xf1, 0x46, 0xe9, 0x9c, 0xfe, 0xff, 0xff, 0x83, 0xc4, 0x44, +0x5b, 0x5e, 0x5f, 0xc9, 0xc3, 0x55, 0x89, 0xe5, 0x8b, 0x55, 0x08, 0x8b, 0x4d, 0x0c, 0x31, 0xc0, +0xeb, 0x07, 0x80, 0x3a, 0x00, 0x74, 0x06, 0x40, 0x42, 0x39, 0xc8, 0x72, 0xf5, 0xc9, 0xc3, 0x55, +0x89, 0xe5, 0x8b, 0x45, 0x08, 0x53, 0x8b, 0x4d, 0x10, 0x8b, 0x5d, 0x0c, 0x31, 0xd2, 0x39, 0xca, +0x73, 0x06, 0x88, 0x1c, 0x10, 0x42, 0xeb, 0xf6, 0x5b, 0xc9, 0xc3, 0x55, 0x89, 0xe5, 0x56, 0x53, +0x8b, 0x4d, 0x08, 0x8b, 0x75, 0x0c, 0x8b, 0x5d, 0x10, 0x31, 0xd2, 0x39, 0xda, 0x73, 0x09, 0x8a, +0x04, 0x16, 0x88, 0x04, 0x11, 0x42, 0xeb, 0xf3, 0x5b, 0x89, 0xc8, 0x5e, 0xc9, 0xc3, 0x55, 0x89, +0xe5, 0x57, 0x56, 0x53, 0x8b, 0x7d, 0x08, 0x8b, 0x75, 0x0c, 0x8b, 0x5d, 0x10, 0x31, 0xd2, 0x39, +0xda, 0x73, 0x15, 0x8a, 0x0f, 0x8a, 0x06, 0x38, 0xc1, 0x74, 0x0a, 0x0f, 0xb6, 0xd0, 0x0f, 0xb6, +0xc1, 0x29, 0xc2, 0xeb, 0x05, 0x42, 0xeb, 0xe7, 0x31, 0xd2, 0x5b, 0x5e, 0x89, 0xd0, 0x5f, 0xc9, +0xc3, 0x55, 0x89, 0xe5, 0x56, 0x53, 0x89, 0xd3, 0x51, 0x31, 0xc9, 0x31, 0xd2, 0x89, 0xc6, 0x39, +0xd9, 0x73, 0x26, 0xf6, 0xc2, 0x01, 0x0f, 0xb6, 0x04, 0x16, 0x74, 0x03, 0xc1, 0xe0, 0x08, 0x01, +0xc1, 0x81, 0xf9, 0xff, 0xff, 0x00, 0x00, 0x76, 0x0b, 0x89, 0xc8, 0xc1, 0xe8, 0x10, 0x8d, 0x04, +0x01, 0x0f, 0xb7, 0xc8, 0x42, 0x39, 0xda, 0xeb, 0xd8, 0x88, 0x4d, 0xf6, 0xc1, 0xe9, 0x08, 0x88, +0x4d, 0xf7, 0x66, 0x8b, 0x45, 0xf6, 0x5a, 0x5b, 0xf7, 0xd0, 0x0f, 0xb7, 0xc0, 0x5e, 0xc9, 0xc3, +0x55, 0x89, 0xe5, 0x57, 0x56, 0x53, 0x8b, 0x5d, 0x08, 0x68, 0x00, 0x01, 0x00, 0x00, 0x8d, 0x83, +0x00, 0x08, 0x00, 0x00, 0x50, 0x8b, 0x7d, 0x10, 0xe8, 0x08, 0xff, 0xff, 0xff, 0x01, 0xc3, 0x5e, +0xb8, 0xff, 0x00, 0x00, 0x00, 0x5a, 0xc6, 0x83, 0x00, 0x08, 0x00, 0x00, 0x20, 0x81, 0xc3, 0x01, +0x08, 0x00, 0x00, 0x39, 0xf8, 0x7e, 0x02, 0x89, 0xf8, 0x50, 0xff, 0x75, 0x0c, 0xe8, 0xe3, 0xfe, +0xff, 0xff, 0x50, 0xff, 0x75, 0x0c, 0x89, 0xc6, 0x53, 0xe8, 0x0d, 0xff, 0xff, 0xff, 0xc6, 0x04, +0x33, 0x00, 0x8d, 0x65, 0xf4, 0x5b, 0x5e, 0x5f, 0xc9, 0xc3, 0x55, 0x81, 0xfa, 0xff, 0xff, 0x3f, +0x00, 0x89, 0xe5, 0x89, 0xd1, 0x53, 0x89, 0xc3, 0x76, 0x05, 0xb9, 0xff, 0xff, 0x3f, 0x00, 0x8b, +0x83, 0xe0, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x00, 0x39, 0xc1, 0x76, 0x24, 0x8d, 0x91, +0x00, 0xfc, 0xff, 0xff, 0x8d, 0x81, 0x00, 0xfc, 0xff, 0xff, 0x81, 0xfa, 0xff, 0xff, 0x00, 0x00, +0x89, 0x93, 0xe0, 0x01, 0x00, 0x00, 0x66, 0x89, 0x43, 0x02, 0x76, 0x06, 0x66, 0xc7, 0x43, 0x02, +0x00, 0xfc, 0x5b, 0xc9, 0xc3, 0x55, 0x89, 0xe5, 0x56, 0x53, 0x83, 0xec, 0x10, 0x89, 0xc1, 0x8b, +0x55, 0x0c, 0x8b, 0x45, 0x08, 0x8b, 0x5d, 0x10, 0x8b, 0x75, 0x14, 0x89, 0x55, 0xf4, 0x89, 0x45, +0xf0, 0x89, 0x5d, 0xe8, 0x89, 0x75, 0xec, 0x0f, 0xb6, 0x81, 0xe8, 0x01, 0x00, 0x00, 0x83, 0xf8, +0x1f, 0x8b, 0x55, 0x18, 0x7f, 0x35, 0x6b, 0xc0, 0x14, 0x01, 0xc8, 0x8b, 0x5d, 0xf0, 0x8b, 0x75, +0xf4, 0x89, 0x98, 0xd0, 0x02, 0x00, 0x00, 0x89, 0xb0, 0xd4, 0x02, 0x00, 0x00, 0x8b, 0x5d, 0xe8, +0x8b, 0x75, 0xec, 0x89, 0x98, 0xd8, 0x02, 0x00, 0x00, 0x89, 0xb0, 0xdc, 0x02, 0x00, 0x00, 0x89, +0x90, 0xe0, 0x02, 0x00, 0x00, 0xfe, 0x81, 0xe8, 0x01, 0x00, 0x00, 0x4a, 0x75, 0x2e, 0x8b, 0x45, +0xf0, 0x03, 0x45, 0xe8, 0x8b, 0x55, 0xf4, 0x13, 0x55, 0xec, 0x81, 0xfa, 0xff, 0x03, 0x00, 0x00, +0x72, 0x07, 0x76, 0x05, 0x83, 0xca, 0xff, 0xeb, 0x06, 0x0f, 0xac, 0xd0, 0x0a, 0x89, 0xc2, 0x83, +0xc4, 0x10, 0x5b, 0x5e, 0x89, 0xc8, 0xc9, 0xe9, 0x1e, 0xff, 0xff, 0xff, 0x83, 0xc4, 0x10, 0x5b, +0x5e, 0xc9, 0xc3, 0x55, 0x89, 0xe5, 0x8b, 0x45, 0x0c, 0x8b, 0x55, 0x10, 0x89, 0x45, 0x10, 0x8b, +0x45, 0x08, 0x8b, 0x40, 0x10, 0x89, 0x55, 0x0c, 0x89, 0x45, 0x08, 0xc9, 0xe9, 0x9f, 0xfe, 0xff, +0xff, 0x55, 0x89, 0xe5, 0x57, 0x56, 0x53, 0x39, 0xd0, 0x56, 0x56, 0x89, 0xc7, 0x89, 0x55, 0xf0, +0x73, 0x77, 0x8d, 0x58, 0x18, 0x81, 0x7b, 0xe8, 0x4c, 0x42, 0x49, 0x4f, 0x75, 0x60, 0x83, 0x7b, +0xec, 0x18, 0x75, 0x5a, 0xba, 0x18, 0x00, 0x00, 0x00, 0x89, 0xf8, 0xe8, 0x21, 0xfe, 0xff, 0xff, +0x85, 0xc0, 0x75, 0x4a, 0x8b, 0x53, 0xf4, 0x89, 0xd8, 0xe8, 0x13, 0xfe, 0xff, 0xff, 0x3b, 0x43, +0xf8, 0x75, 0x3b, 0x89, 0xde, 0x03, 0x73, 0xf4, 0x39, 0xf3, 0xc7, 0x45, 0xec, 0x00, 0x00, 0x00, +0x00, 0x89, 0xd9, 0x73, 0x1d, 0x89, 0xf0, 0x29, 0xd8, 0x8b, 0x53, 0x04, 0x39, 0xc2, 0x77, 0x12, +0x01, 0xd1, 0xff, 0x45, 0xec, 0x39, 0xf1, 0x73, 0x09, 0x89, 0xf0, 0x29, 0xc8, 0x8b, 0x51, 0x04, +0xeb, 0xea, 0x8b, 0x45, 0xec, 0x3b, 0x43, 0xfc, 0x75, 0x04, 0x89, 0xf8, 0xeb, 0x0d, 0x83, 0xc7, +0x10, 0x83, 0xc3, 0x10, 0x3b, 0x7d, 0xf0, 0x72, 0x8c, 0x31, 0xc0, 0x59, 0x5b, 0x5b, 0x5e, 0x5f, +0xc9, 0xc3, 0x55, 0x89, 0xe5, 0xba, 0x00, 0x10, 0x00, 0x00, 0x53, 0x89, 0xc3, 0x31, 0xc0, 0xe8, +0x5d, 0xff, 0xff, 0xff, 0x85, 0xc0, 0x75, 0x15, 0xba, 0x00, 0x00, 0x10, 0x00, 0xb8, 0x00, 0x00, +0x0f, 0x00, 0xe8, 0x4a, 0xff, 0xff, 0xff, 0x31, 0xd2, 0x85, 0xc0, 0x74, 0x0f, 0xc7, 0x43, 0x24, +0x01, 0x00, 0x00, 0x00, 0x89, 0x43, 0x28, 0xba, 0x01, 0x00, 0x00, 0x00, 0x89, 0xd0, 0x5b, 0xc9, +0xc3, 0x55, 0x89, 0xe5, 0x56, 0x53, 0x68, 0x00, 0x10, 0x00, 0x00, 0x8b, 0x75, 0x08, 0x6a, 0x00, +0xff, 0x76, 0x10, 0xe8, 0xf7, 0xfc, 0xff, 0xff, 0x8b, 0x46, 0x10, 0xc6, 0x00, 0x00, 0x8b, 0x46, +0x10, 0xc6, 0x40, 0x01, 0x19, 0x8b, 0x46, 0x10, 0xc6, 0x40, 0x06, 0x00, 0x66, 0xc7, 0x40, 0x04, +0x00, 0x00, 0x8b, 0x46, 0x10, 0xc6, 0x40, 0x07, 0x50, 0x8b, 0x46, 0x10, 0xc6, 0x40, 0x0e, 0x19, +0x8b, 0x46, 0x10, 0xc6, 0x40, 0x0f, 0x01, 0x66, 0xc7, 0x40, 0x0a, 0x00, 0x00, 0x8b, 0x46, 0x10, +0xc6, 0x80, 0xe8, 0x01, 0x00, 0x00, 0x00, 0x66, 0xc7, 0x40, 0x10, 0x10, 0x00, 0x66, 0xc7, 0x40, +0x02, 0x00, 0x00, 0x8b, 0x46, 0x10, 0x8d, 0x90, 0x00, 0x08, 0x00, 0x00, 0x89, 0x90, 0x28, 0x02, +0x00, 0x00, 0x66, 0xc7, 0x40, 0x20, 0x3f, 0xa3, 0x66, 0xc7, 0x40, 0x22, 0x00, 0x08, 0x68, 0xff, +0x00, 0x00, 0x00, 0x8b, 0x46, 0x0c, 0x83, 0xc0, 0x1c, 0x50, 0xe8, 0x66, 0xfc, 0xff, 0xff, 0x50, +0x89, 0xc3, 0x8b, 0x46, 0x0c, 0x83, 0xc0, 0x1c, 0x50, 0x8b, 0x46, 0x10, 0x05, 0x00, 0x08, 0x00, +0x00, 0x50, 0xe8, 0x84, 0xfc, 0xff, 0xff, 0x83, 0xc4, 0x20, 0x8b, 0x46, 0x10, 0xc6, 0x84, 0x03, +0x00, 0x08, 0x00, 0x00, 0x00, 0x6a, 0x40, 0x6a, 0x00, 0x8b, 0x46, 0x10, 0x83, 0xc0, 0x40, 0x50, +0xe8, 0x4a, 0xfc, 0xff, 0xff, 0x6a, 0x20, 0x6a, 0x00, 0x8b, 0x46, 0x10, 0x83, 0xe8, 0x80, 0x50, +0xe8, 0x3a, 0xfc, 0xff, 0xff, 0x8b, 0x46, 0x10, 0x8b, 0x4e, 0x0c, 0x66, 0xc7, 0x80, 0xa0, 0x00, +0x00, 0x00, 0x00, 0x00, 0x66, 0xc7, 0x40, 0x02, 0x00, 0x00, 0x66, 0xc7, 0x80, 0xf2, 0x01, 0x00, +0x00, 0xff, 0xff, 0x66, 0x8b, 0x51, 0x0c, 0x66, 0x89, 0x90, 0xf8, 0x01, 0x00, 0x00, 0x66, 0x8b, +0x51, 0x0e, 0x66, 0x89, 0x90, 0xfc, 0x01, 0x00, 0x00, 0xc7, 0x80, 0xe0, 0x01, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0xc6, 0x80, 0xff, 0x01, 0x00, 0x00, 0x00, 0x6a, 0x04, 0x68, 0x59, 0x0f, 0x01, +0x00, 0x8b, 0x46, 0x10, 0x05, 0x02, 0x02, 0x00, 0x00, 0x50, 0xe8, 0xfc, 0xfb, 0xff, 0xff, 0x8b, +0x46, 0x10, 0xc6, 0x80, 0x10, 0x02, 0x00, 0x00, 0x50, 0x66, 0xc7, 0x80, 0x06, 0x02, 0x00, 0x00, +0x01, 0x02, 0x8b, 0x46, 0x10, 0xc6, 0x80, 0x11, 0x02, 0x00, 0x00, 0x00, 0x8b, 0x4e, 0x10, 0xc7, +0x81, 0x18, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc7, 0x81, 0x1c, 0x02, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x8b, 0x56, 0x0c, 0x83, 0xc4, 0x24, 0x83, 0x7a, 0x18, 0x00, 0x74, 0x12, 0x8b, +0x42, 0x14, 0x89, 0x81, 0x18, 0x02, 0x00, 0x00, 0x8b, 0x42, 0x18, 0x89, 0x81, 0x1c, 0x02, 0x00, +0x00, 0xc7, 0x46, 0x2c, 0x01, 0x00, 0x00, 0x00, 0x8d, 0x65, 0xf8, 0x5b, 0x5e, 0xc9, 0xc3, 0x55, +0x89, 0xe5, 0x57, 0x56, 0x53, 0x83, 0xec, 0x60, 0xa1, 0x90, 0x10, 0x01, 0x00, 0x89, 0x45, 0xd4, +0x8b, 0x45, 0x08, 0x89, 0x45, 0xc4, 0x8b, 0x45, 0x0c, 0x89, 0x45, 0xc8, 0x8b, 0x45, 0x10, 0x89, +0x45, 0xcc, 0x8b, 0x45, 0x14, 0x89, 0x45, 0xd0, 0x8d, 0x45, 0xc4, 0x50, 0xe8, 0x40, 0xfe, 0xff, +0xff, 0x58, 0x8b, 0x45, 0xc4, 0x31, 0xdb, 0x31, 0xf6, 0x3d, 0x02, 0xb0, 0xad, 0x2b, 0x75, 0x0b, +0xb3, 0x01, 0xc7, 0x45, 0xd8, 0x01, 0x00, 0x00, 0x00, 0xeb, 0x2e, 0x3d, 0x07, 0xb0, 0x11, 0x0a, +0x75, 0x27, 0x8b, 0x45, 0xc8, 0x8b, 0x10, 0xe8, 0x95, 0xfb, 0xff, 0xff, 0x85, 0xc0, 0x75, 0x0e, +0xbb, 0x01, 0x00, 0x00, 0x00, 0xc7, 0x45, 0xdc, 0x01, 0x00, 0x00, 0x00, 0xeb, 0x0b, 0x68, 0x5e, +0x0f, 0x01, 0x00, 0xe8, 0x6f, 0xf9, 0xff, 0xff, 0x5f, 0x81, 0x7d, 0xc4, 0x07, 0xb0, 0x1f, 0x0e, +0x75, 0x03, 0x8b, 0x75, 0xc8, 0x8b, 0x45, 0xcc, 0x85, 0xc0, 0x74, 0x0a, 0x81, 0x38, 0x07, 0xb0, +0x1f, 0x0e, 0x75, 0x02, 0x89, 0xc6, 0x85, 0xdb, 0x0f, 0x85, 0x11, 0x01, 0x00, 0x00, 0x85, 0xf6, +0x0f, 0x84, 0xd1, 0x00, 0x00, 0x00, 0x66, 0x83, 0x7e, 0x08, 0x00, 0xc7, 0x45, 0xc0, 0x00, 0x00, +0x00, 0x00, 0x74, 0x0d, 0x8b, 0x56, 0x04, 0x89, 0xf0, 0xe8, 0x33, 0xfb, 0xff, 0xff, 0x89, 0x45, +0xc0, 0x89, 0xf3, 0x31, 0xff, 0x8d, 0x4e, 0x0c, 0x03, 0x5e, 0x04, 0x39, 0xd9, 0x73, 0x21, 0x8b, +0x01, 0x83, 0xc0, 0x03, 0x83, 0xe0, 0xfc, 0x8d, 0x54, 0x01, 0x0c, 0x8b, 0x41, 0x04, 0x83, 0xc0, +0x03, 0x83, 0xe0, 0xfc, 0x8d, 0x04, 0x02, 0x39, 0xd8, 0x77, 0x05, 0x47, 0x89, 0xc1, 0xeb, 0xdb, +0x81, 0x3e, 0x07, 0xb0, 0x1f, 0x0e, 0x75, 0x1d, 0x83, 0x7d, 0xc0, 0x00, 0x75, 0x17, 0x0f, 0xb7, +0x46, 0x0a, 0x39, 0xf8, 0x75, 0x0f, 0xc7, 0x45, 0xe0, 0x01, 0x00, 0x00, 0x00, 0x89, 0x75, 0xcc, +0xe9, 0x9a, 0x00, 0x00, 0x00, 0x68, 0x81, 0x0f, 0x01, 0x00, 0xe8, 0xc8, 0xf8, 0xff, 0xff, 0x59, +0xff, 0x75, 0xc0, 0x68, 0x9b, 0x0f, 0x01, 0x00, 0xe8, 0xba, 0xf8, 0xff, 0xff, 0x58, 0x5a, 0x57, +0x68, 0xad, 0x0f, 0x01, 0x00, 0xe8, 0xad, 0xf8, 0xff, 0xff, 0x5f, 0x58, 0x56, 0x68, 0xbf, 0x0f, +0x01, 0x00, 0xe8, 0xa0, 0xf8, 0xff, 0xff, 0x59, 0x5b, 0xff, 0x76, 0x04, 0x68, 0xd1, 0x0f, 0x01, +0x00, 0xe8, 0x91, 0xf8, 0xff, 0xff, 0x58, 0x5a, 0xff, 0x36, 0x68, 0xe3, 0x0f, 0x01, 0x00, 0xe8, +0x83, 0xf8, 0xff, 0xff, 0x5f, 0x58, 0x0f, 0xb7, 0x46, 0x0a, 0x50, 0x68, 0xf5, 0x0f, 0x01, 0x00, +0xe8, 0x72, 0xf8, 0xff, 0xff, 0x5b, 0x5e, 0x68, 0x07, 0x10, 0x01, 0x00, 0xe8, 0x66, 0xf8, 0xff, +0xff, 0x59, 0xff, 0x75, 0xc4, 0x68, 0x22, 0x10, 0x01, 0x00, 0xe8, 0x58, 0xf8, 0xff, 0xff, 0x58, +0x5a, 0xff, 0x75, 0xc8, 0x68, 0x2b, 0x10, 0x01, 0x00, 0xe8, 0x49, 0xf8, 0xff, 0xff, 0x5e, 0x5f, +0xff, 0x75, 0xcc, 0x68, 0x34, 0x10, 0x01, 0x00, 0xe8, 0x3a, 0xf8, 0xff, 0xff, 0x59, 0x5b, 0x31, +0xc0, 0x83, 0x7d, 0xe0, 0x00, 0xc7, 0x45, 0xe4, 0x00, 0x00, 0x00, 0x00, 0xc7, 0x45, 0xe8, 0x00, +0x00, 0x00, 0x00, 0x0f, 0x84, 0x22, 0x01, 0x00, 0x00, 0x8b, 0x45, 0xcc, 0x89, 0xc6, 0xc7, 0x45, +0xb8, 0x00, 0x00, 0x00, 0x00, 0xc7, 0x45, 0xbc, 0x00, 0x00, 0x00, 0x00, 0x8d, 0x58, 0x0c, 0x03, +0x70, 0x04, 0x39, 0xf3, 0x73, 0x41, 0x8b, 0x0b, 0x8d, 0x51, 0x03, 0x8b, 0x43, 0x04, 0x83, 0xe2, +0xfc, 0x83, 0xc0, 0x03, 0x8d, 0x7b, 0x0c, 0x83, 0xe0, 0xfc, 0x8d, 0x14, 0x17, 0x8d, 0x04, 0x02, +0x39, 0xf0, 0x89, 0x45, 0xb4, 0x77, 0x20, 0x83, 0x7b, 0x08, 0x01, 0x75, 0x15, 0x85, 0xc9, 0x75, +0x11, 0x6a, 0x00, 0x6a, 0x00, 0x57, 0xe8, 0xa3, 0xf9, 0xff, 0xff, 0x83, 0xc4, 0x0c, 0x85, 0xc0, +0x74, 0x09, 0x8b, 0x5d, 0xb4, 0xeb, 0xbb, 0x31, 0xdb, 0xeb, 0x04, 0x85, 0xdb, 0x75, 0x09, 0xc7, +0x45, 0xb8, 0x00, 0x00, 0x00, 0x00, 0xeb, 0x0e, 0x8b, 0x03, 0x83, 0xc0, 0x03, 0x83, 0xe0, 0xfc, +0x8d, 0x04, 0x07, 0x89, 0x45, 0xbc, 0x85, 0xdb, 0x0f, 0x84, 0x9a, 0x00, 0x00, 0x00, 0x83, 0x7b, +0x04, 0x07, 0x75, 0x1f, 0x6a, 0x07, 0x68, 0x74, 0x10, 0x01, 0x00, 0xff, 0x75, 0xbc, 0xe8, 0x5b, +0xf9, 0xff, 0xff, 0x83, 0xc4, 0x0c, 0x85, 0xc0, 0x75, 0x09, 0xc7, 0x45, 0xe4, 0x01, 0x00, 0x00, +0x00, 0xeb, 0x59, 0x85, 0xdb, 0x74, 0x71, 0x83, 0x7b, 0x04, 0x0a, 0x75, 0x25, 0x6a, 0x0a, 0x68, +0x69, 0x10, 0x01, 0x00, 0xff, 0x75, 0xbc, 0xe8, 0x32, 0xf9, 0xff, 0xff, 0x83, 0xc4, 0x0c, 0x85, +0xc0, 0x75, 0x0f, 0x8d, 0x45, 0xc4, 0xe8, 0x97, 0xfb, 0xff, 0xff, 0x85, 0xc0, 0x89, 0x45, 0xb8, +0x75, 0x46, 0x85, 0xdb, 0x74, 0x42, 0x83, 0x7b, 0x04, 0x00, 0x74, 0x20, 0x85, 0xdb, 0x74, 0x38, +0x83, 0x7b, 0x04, 0x01, 0x75, 0x1f, 0x6a, 0x01, 0x68, 0x9a, 0x0f, 0x01, 0x00, 0xff, 0x75, 0xbc, +0xe8, 0xf9, 0xf8, 0xff, 0xff, 0x83, 0xc4, 0x0c, 0x85, 0xc0, 0x75, 0x09, 0xc7, 0x45, 0xb8, 0x01, +0x00, 0x00, 0x00, 0xeb, 0x13, 0x85, 0xdb, 0x74, 0x0f, 0xff, 0x75, 0xbc, 0x68, 0x3e, 0x10, 0x01, +0x00, 0xe8, 0x01, 0xf7, 0xff, 0xff, 0x58, 0x5a, 0x8b, 0x45, 0xb8, 0x85, 0xc0, 0x75, 0x13, 0x8d, +0x45, 0xc4, 0xe8, 0x3b, 0xfb, 0xff, 0xff, 0x85, 0xc0, 0x75, 0x07, 0xc7, 0x45, 0xe4, 0x01, 0x00, +0x00, 0x00, 0x68, 0x59, 0x10, 0x01, 0x00, 0xe8, 0xdb, 0xf6, 0xff, 0xff, 0x83, 0x7d, 0xe8, 0x00, +0x5f, 0x74, 0x0b, 0x68, 0x68, 0x10, 0x01, 0x00, 0xe8, 0xca, 0xf6, 0xff, 0xff, 0x5e, 0x83, 0x7d, +0xe4, 0x00, 0x74, 0x0b, 0x68, 0x73, 0x10, 0x01, 0x00, 0xe8, 0xb9, 0xf6, 0xff, 0xff, 0x5b, 0x68, +0x99, 0x0f, 0x01, 0x00, 0xe8, 0xae, 0xf6, 0xff, 0xff, 0x83, 0x7d, 0xe8, 0x00, 0x59, 0x0f, 0x84, +0x84, 0x00, 0x00, 0x00, 0x8b, 0x45, 0xec, 0x8d, 0x50, 0x18, 0x8b, 0x40, 0x0c, 0x01, 0xd0, 0x39, +0xc2, 0x89, 0x45, 0xb0, 0x89, 0xd3, 0x73, 0x70, 0x29, 0xd8, 0x8b, 0x53, 0x04, 0x39, 0xc2, 0x77, +0x67, 0x83, 0x3b, 0x01, 0x75, 0x55, 0x8d, 0x42, 0xf8, 0xba, 0x14, 0x00, 0x00, 0x00, 0x89, 0xd1, +0x31, 0xd2, 0xf7, 0xf1, 0x31, 0xff, 0x39, 0xc7, 0x89, 0x45, 0xac, 0x7d, 0x37, 0x31, 0xf6, 0x31, +0xd2, 0x83, 0x7c, 0x1e, 0x18, 0x01, 0x0f, 0x95, 0xc2, 0x42, 0x52, 0xff, 0x74, 0x1e, 0x14, 0xff, +0x74, 0x1e, 0x10, 0xff, 0x74, 0x1e, 0x0c, 0xff, 0x74, 0x1e, 0x08, 0x8b, 0x45, 0xd4, 0x47, 0xe8, +0x41, 0xf9, 0xff, 0xff, 0x83, 0xc6, 0x14, 0x83, 0xc4, 0x14, 0x3b, 0x7d, 0xac, 0x7d, 0x05, 0x83, +0xff, 0x1f, 0x7e, 0xcb, 0xc7, 0x45, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x03, 0x5b, 0x04, 0x3b, 0x5d, +0xb0, 0x73, 0x05, 0x8b, 0x45, 0xb0, 0xeb, 0x90, 0x83, 0x7d, 0xe4, 0x00, 0x0f, 0x84, 0x94, 0x00, +0x00, 0x00, 0x6a, 0x20, 0x68, 0xc4, 0x51, 0x01, 0x00, 0xe8, 0xee, 0xf3, 0xff, 0xff, 0x31, 0xf6, +0x5f, 0x39, 0xc6, 0x5a, 0xa3, 0xc0, 0x51, 0x01, 0x00, 0x7d, 0x47, 0x31, 0xdb, 0x83, 0xbb, 0xd4, +0x51, 0x01, 0x00, 0x01, 0x75, 0x07, 0xc7, 0x45, 0xf0, 0x00, 0x00, 0x00, 0x00, 0xff, 0xb3, 0xd4, +0x51, 0x01, 0x00, 0xff, 0xb3, 0xd0, 0x51, 0x01, 0x00, 0xff, 0xb3, 0xcc, 0x51, 0x01, 0x00, 0xff, +0xb3, 0xc8, 0x51, 0x01, 0x00, 0xff, 0xb3, 0xc4, 0x51, 0x01, 0x00, 0x8b, 0x45, 0xd4, 0x46, 0xe8, +0xc1, 0xf8, 0xff, 0xff, 0x83, 0xc3, 0x14, 0x83, 0xc4, 0x14, 0x3b, 0x35, 0xc0, 0x51, 0x01, 0x00, +0x7c, 0xbb, 0x8b, 0x5d, 0xd4, 0xe8, 0xeb, 0xf3, 0xff, 0xff, 0x89, 0x83, 0xe0, 0x01, 0x00, 0x00, +0x8b, 0x5d, 0xd4, 0xe8, 0x26, 0xf4, 0xff, 0xff, 0x66, 0x89, 0x43, 0x02, 0x8b, 0x45, 0xd4, 0x83, +0xb8, 0xe0, 0x01, 0x00, 0x00, 0x00, 0x75, 0x07, 0x66, 0x83, 0x78, 0x02, 0x00, 0x74, 0x07, 0xc7, +0x45, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x83, 0x7d, 0xd8, 0x00, 0x0f, 0x84, 0x8a, 0x00, 0x00, 0x00, +0x83, 0x7d, 0xf0, 0x00, 0x8b, 0x75, 0xc8, 0x74, 0x16, 0xf6, 0x06, 0x01, 0x74, 0x11, 0x8b, 0x56, +0x08, 0x81, 0xc2, 0x00, 0x04, 0x00, 0x00, 0x8b, 0x45, 0xd4, 0xe8, 0x0b, 0xf8, 0xff, 0xff, 0xf6, +0x06, 0x04, 0x74, 0x10, 0x6a, 0xff, 0xff, 0x76, 0x10, 0xff, 0x75, 0xd4, 0xe8, 0x9f, 0xf7, 0xff, +0xff, 0x83, 0xc4, 0x0c, 0x83, 0x7d, 0xf0, 0x00, 0x74, 0x3b, 0xf6, 0x06, 0x40, 0x74, 0x36, 0x8b, +0x5e, 0x30, 0x8b, 0x45, 0xd4, 0x89, 0xdf, 0x8b, 0x4b, 0xfc, 0x89, 0x45, 0xa8, 0x03, 0x7e, 0x2c, +0x89, 0x4d, 0xa4, 0x39, 0xfb, 0x73, 0x1e, 0xff, 0x73, 0x10, 0xff, 0x73, 0x0c, 0xff, 0x73, 0x08, +0xff, 0x73, 0x04, 0xff, 0x33, 0x8b, 0x45, 0xa8, 0xe8, 0x08, 0xf8, 0xff, 0xff, 0x83, 0xc4, 0x14, +0x03, 0x5d, 0xa4, 0xeb, 0xde, 0xf6, 0x06, 0x41, 0x0f, 0x84, 0x51, 0x01, 0x00, 0x00, 0xc7, 0x45, +0xf0, 0x00, 0x00, 0x00, 0x00, 0xe9, 0x45, 0x01, 0x00, 0x00, 0x83, 0x7d, 0xdc, 0x00, 0x0f, 0x84, +0xc9, 0x00, 0x00, 0x00, 0x8b, 0x5d, 0xc8, 0x8b, 0x43, 0x0c, 0x85, 0xc0, 0x74, 0x0f, 0x50, 0xff, +0x73, 0x08, 0xff, 0x75, 0xd4, 0xe8, 0x26, 0xf7, 0xff, 0xff, 0x83, 0xc4, 0x0c, 0x8b, 0x7b, 0x14, +0x8b, 0x73, 0x10, 0x85, 0xff, 0x0f, 0x84, 0x14, 0x01, 0x00, 0x00, 0x83, 0x3e, 0x01, 0x0f, 0x85, +0x8d, 0x00, 0x00, 0x00, 0x83, 0x7d, 0xf0, 0x00, 0x0f, 0x84, 0x83, 0x00, 0x00, 0x00, 0x8b, 0x45, +0xd4, 0xba, 0x14, 0x00, 0x00, 0x00, 0x89, 0x45, 0xa0, 0x8b, 0x46, 0x04, 0x83, 0xe8, 0x08, 0x89, +0xd1, 0x31, 0xd2, 0xf7, 0xf1, 0xc7, 0x45, 0x9c, 0x00, 0x00, 0x00, 0x00, 0x39, 0x45, 0x9c, 0x89, +0x45, 0x98, 0x7d, 0x56, 0x31, 0xdb, 0x8b, 0x44, 0x33, 0x18, 0x83, 0xf8, 0x03, 0xba, 0x03, 0x00, +0x00, 0x00, 0x74, 0x16, 0x77, 0x05, 0xb2, 0x01, 0x48, 0xeb, 0x08, 0xba, 0x04, 0x00, 0x00, 0x00, +0x83, 0xf8, 0x04, 0x74, 0x05, 0xba, 0x02, 0x00, 0x00, 0x00, 0x52, 0xff, 0x74, 0x33, 0x14, 0xff, +0x74, 0x33, 0x10, 0xff, 0x74, 0x33, 0x0c, 0xff, 0x74, 0x33, 0x08, 0x8b, 0x45, 0xa0, 0xe8, 0x42, +0xf7, 0xff, 0xff, 0xff, 0x45, 0x9c, 0x8b, 0x45, 0x98, 0x83, 0xc4, 0x14, 0x83, 0xc3, 0x14, 0x39, +0x45, 0x9c, 0x7d, 0x06, 0x83, 0x7d, 0x9c, 0x1f, 0x7e, 0xac, 0xc7, 0x45, 0xf0, 0x00, 0x00, 0x00, +0x00, 0x8b, 0x46, 0x04, 0x01, 0xc6, 0x29, 0xc7, 0xe9, 0x58, 0xff, 0xff, 0xff, 0x83, 0x7d, 0xe0, +0x00, 0x74, 0x6c, 0x8b, 0x45, 0xcc, 0x89, 0xc6, 0x8d, 0x58, 0x0c, 0x03, 0x70, 0x04, 0x39, 0xf3, +0x73, 0x5d, 0x8b, 0x13, 0x8d, 0x42, 0x03, 0x83, 0xe0, 0xfc, 0x8d, 0x4b, 0x0c, 0x8d, 0x3c, 0x01, +0x8b, 0x43, 0x04, 0x83, 0xc0, 0x03, 0x83, 0xe0, 0xfc, 0x8d, 0x04, 0x07, 0x39, 0xf0, 0x89, 0x45, +0x94, 0x77, 0x3c, 0xa1, 0x84, 0x10, 0x01, 0x00, 0x39, 0x43, 0x08, 0x75, 0x2d, 0x3b, 0x15, 0x7c, +0x10, 0x01, 0x00, 0x75, 0x25, 0x52, 0xff, 0x35, 0x80, 0x10, 0x01, 0x00, 0x51, 0xe8, 0x9c, 0xf5, +0xff, 0xff, 0x83, 0xc4, 0x0c, 0x85, 0xc0, 0x75, 0x11, 0x57, 0xff, 0x73, 0x04, 0x8d, 0x4d, 0xc4, +0x51, 0xff, 0x15, 0x88, 0x10, 0x01, 0x00, 0x83, 0xc4, 0x0c, 0x8b, 0x5d, 0x94, 0xeb, 0x9f, 0xb0, +0x80, 0xe6, 0x70, 0x31, 0xc0, 0xe6, 0xf0, 0xe6, 0xf1, 0xb0, 0x11, 0xe6, 0x20, 0xe6, 0xa0, 0xb0, +0x20, 0xe6, 0x21, 0xb0, 0x28, 0xe6, 0xa1, 0xb0, 0x04, 0xe6, 0x21, 0xb0, 0x02, 0xe6, 0xa1, 0xb0, +0x01, 0xe6, 0x21, 0xe6, 0xa1, 0xb0, 0xff, 0xe6, 0xa1, 0xb0, 0xfb, 0xe6, 0x21, 0x8b, 0x45, 0xd4, +0x8d, 0x65, 0xf4, 0x5b, 0x5e, 0x5f, 0xc9, 0xc3, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, +0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x00, 0x48, 0x64, 0x72, 0x53, 0x00, 0x42, 0x61, +0x64, 0x20, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x62, 0x6f, 0x6f, 0x74, 0x20, 0x68, +0x65, 0x61, 0x64, 0x65, 0x72, 0x20, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x21, 0x0a, +0x00, 0x42, 0x61, 0x64, 0x20, 0x45, 0x4c, 0x46, 0x20, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, +0x65, 0x72, 0x20, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x21, 0x0a, 0x00, 0x20, 0x20, 0x20, 0x63, 0x68, +0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x20, 0x3d, 0x20, 0x25, 0x78, 0x0a, 0x00, 0x20, 0x20, 0x20, +0x20, 0x20, 0x20, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x20, 0x3d, 0x20, 0x25, 0x78, 0x0a, 0x00, 0x20, +0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x68, 0x64, 0x72, 0x20, 0x3d, 0x20, 0x25, 0x78, 0x0a, +0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x62, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x20, 0x3d, 0x20, 0x25, +0x78, 0x0a, 0x00, 0x62, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x20, 0x3d, +0x20, 0x25, 0x78, 0x0a, 0x00, 0x20, 0x20, 0x62, 0x5f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, +0x20, 0x3d, 0x20, 0x25, 0x78, 0x0a, 0x00, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x20, 0x62, +0x6f, 0x6f, 0x74, 0x6c, 0x6f, 0x61, 0x64, 0x65, 0x72, 0x20, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x21, +0x0a, 0x00, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x25, 0x78, 0x0a, 0x00, 0x64, 0x61, 0x74, 0x61, 0x3d, +0x25, 0x78, 0x0a, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x3d, 0x25, 0x78, 0x0a, 0x00, 0x55, 0x6e, +0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x20, 0x66, 0x69, 0x72, 0x6d, 0x77, 0x61, 0x72, 0x65, 0x20, 0x74, +0x79, 0x70, 0x65, 0x3a, 0x20, 0x25, 0x73, 0x0a, 0x00, 0x46, 0x69, 0x72, 0x6d, 0x77, 0x61, 0x72, +0x65, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x00, 0x20, 0x4c, 0x69, 0x6e, 0x75, 0x78, 0x42, 0x49, +0x4f, 0x53, 0x00, 0x20, 0x50, 0x43, 0x42, 0x49, 0x4f, 0x53, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x9a, 0x0f, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x53, 0x06, 0x01, 0x00, 0xc0, 0x51, 0x01, 0x00, +0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0xa5, 0xa5, 0xa5, 0xa5, 0x70, 0x00, 0x00, 0x00, 0xa8, 0x10, 0x01, 0x00, 0x00, 0x00, 0x00, 0x03, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x4f, 0x4f, 0x54, +0x5f, 0x49, 0x4d, 0x41, 0x47, 0x45, 0x3d, 0x68, 0x65, 0x61, 0x64, 0x2e, 0x53, 0x20, 0x63, 0x6f, +0x6e, 0x73, 0x6f, 0x6c, 0x65, 0x3d, 0x74, 0x74, 0x79, 0x53, 0x30, 0x20, 0x69, 0x70, 0x3d, 0x64, +0x68, 0x63, 0x70, 0x20, 0x72, 0x6f, 0x6f, 0x74, 0x3d, 0x2f, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x66, +0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, diff --git a/util/mkelfImage/linux-i386/convert.h b/util/mkelfImage/linux-i386/convert.h new file mode 100644 index 0000000000..369829f78f --- /dev/null +++ b/util/mkelfImage/linux-i386/convert.h @@ -0,0 +1,29 @@ + +/* Hard coded locations */ +#define CONVERTLOC 0x10000 +#define REAL_MODE_DATA_LOC 0x20000 +#define GDTLOC 0x21000 + +#define DEFAULT_ROOT_DEV ((0x3<<8)| 0) + +#define CMDLINE_MAX 256 + +#ifdef ASSEMBLY +#define CONVERT_MAGIC 0xA5A5A5A5 +#else +#define CONVERT_MAGIC 0xA5A5A5A5UL +#endif + +#ifndef ASSEMBLY +struct image_parameters { + uint32_t convert_magic; /* a signature to verify mkelfImage was built properly */ + uint32_t gdt_size; + uint32_t bss_size; + uint16_t ramdisk_flags; + uint16_t root_dev; + uint32_t entry; + uint32_t initrd_start; + uint32_t initrd_size; + uint8_t cmdline[CMDLINE_MAX]; +}; +#endif diff --git a/util/mkelfImage/linux-i386/convert.lds b/util/mkelfImage/linux-i386/convert.lds new file mode 100644 index 0000000000..2195fe435d --- /dev/null +++ b/util/mkelfImage/linux-i386/convert.lds @@ -0,0 +1,36 @@ +OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") +OUTPUT_ARCH(i386) + + +ENTRY(startup_32) +SECTIONS +{ + . = 0x10000; + _text = .; /* Text and read-only data */ + .text . : { + *(.text) + *(.text.*) + } = 0x9090 + .rodata (.): { + *(.rodata) + *(.rodata.*) + } + _etext = .; /* End of text section */ + .data (.): { /* Data */ + *(.data) + *(.data.*) + *(.trailer) + } + _edata = .; /* End of data section */ + _bss = .; /* BSS */ + .bss (.): { + *(.bss) + } + _end = . ; + bss_size = _end - _bss; + + /DISCARD/ : { + *(.comment) + *(.note) + } +} diff --git a/util/mkelfImage/linux-i386/convert_params.c b/util/mkelfImage/linux-i386/convert_params.c new file mode 100644 index 0000000000..501adfbb11 --- /dev/null +++ b/util/mkelfImage/linux-i386/convert_params.c @@ -0,0 +1,1555 @@ +#include <stdarg.h> +#include <limits.h> +#include "arch/io.h" +#include "stdint.h" +#include "uniform_boot.h" +#include "linuxbios_tables.h" +#include "elf_boot.h" +#include "convert.h" +#define STACK_SIZE (4096) + +#define __unused __attribute__ ((unused)) + +long user_stack [STACK_SIZE] = { 0 }; + +unsigned long * stack_start = & user_stack[STACK_SIZE]; + +/* FIXME expand on drive_info_)struct... */ +struct drive_info_struct { + uint8_t dummy[32]; +}; +struct sys_desc_table { + uint16_t length; + uint8_t table[318]; +}; + +/* + * These are set up by the setup-routine at boot-time: + */ + +struct screen_info { + uint8_t orig_x; /* 0x00 */ + uint8_t orig_y; /* 0x01 */ + uint16_t dontuse1; /* 0x02 -- EXT_MEM_K sits here */ + uint16_t orig_video_page; /* 0x04 */ + uint8_t orig_video_mode; /* 0x06 */ + uint8_t orig_video_cols; /* 0x07 */ + uint16_t unused2; /* 0x08 */ + uint16_t orig_video_ega_bx; /* 0x0a */ + uint16_t unused3; /* 0x0c */ + uint8_t orig_video_lines; /* 0x0e */ + uint8_t orig_video_isVGA; /* 0x0f */ + uint16_t orig_video_points; /* 0x10 */ + + /* VESA graphic mode -- linear frame buffer */ + uint16_t lfb_width; /* 0x12 */ + uint16_t lfb_height; /* 0x14 */ + uint16_t lfb_depth; /* 0x16 */ + uint32_t lfb_base; /* 0x18 */ + uint32_t lfb_size; /* 0x1c */ + uint16_t dontuse2, dontuse3; /* 0x20 -- CL_MAGIC and CL_OFFSET here */ + uint16_t lfb_linelength; /* 0x24 */ + uint8_t red_size; /* 0x26 */ + uint8_t red_pos; /* 0x27 */ + uint8_t green_size; /* 0x28 */ + uint8_t green_pos; /* 0x29 */ + uint8_t blue_size; /* 0x2a */ + uint8_t blue_pos; /* 0x2b */ + uint8_t rsvd_size; /* 0x2c */ + uint8_t rsvd_pos; /* 0x2d */ + uint16_t vesapm_seg; /* 0x2e */ + uint16_t vesapm_off; /* 0x30 */ + uint16_t pages; /* 0x32 */ +}; + + +#define PAGE_SIZE 4096 + + +#define E820MAP 0x2d0 /* our map */ +#define E820MAX 32 /* number of entries in E820MAP */ +#define E820NR 0x1e8 /* # entries in E820MAP */ + + +struct e820entry { + unsigned long long addr; /* start of memory segment */ + unsigned long long size; /* size of memory segment */ + unsigned long type; /* type of memory segment */ +#define E820_RAM 1 +#define E820_RESERVED 2 +#define E820_ACPI 3 /* usable as RAM once ACPI tables have been read */ +#define E820_NVS 4 +}; + +struct e820map { + int nr_map; + struct e820entry map[E820MAX]; +}; + + +struct apm_bios_info { + uint16_t version; /* 0x40 */ + uint16_t cseg; /* 0x42 */ + uint32_t offset; /* 0x44 */ + uint16_t cseg_16; /* 0x48 */ + uint16_t dseg; /* 0x4a */ + uint16_t flags; /* 0x4c */ + uint16_t cseg_len; /* 0x4e */ + uint16_t cseg_16_len; /* 0x50 */ + uint16_t dseg_len; /* 0x52 */ + uint8_t reserved[44]; /* 0x54 */ +}; + + +struct parameters { + uint8_t orig_x; /* 0x00 */ + uint8_t orig_y; /* 0x01 */ + uint16_t ext_mem_k; /* 0x02 -- EXT_MEM_K sits here */ + uint16_t orig_video_page; /* 0x04 */ + uint8_t orig_video_mode; /* 0x06 */ + uint8_t orig_video_cols; /* 0x07 */ + uint16_t unused2; /* 0x08 */ + uint16_t orig_video_ega_bx; /* 0x0a */ + uint16_t unused3; /* 0x0c */ + uint8_t orig_video_lines; /* 0x0e */ + uint8_t orig_video_isVGA; /* 0x0f */ + uint16_t orig_video_points; /* 0x10 */ + + /* VESA graphic mode -- linear frame buffer */ + uint16_t lfb_width; /* 0x12 */ + uint16_t lfb_height; /* 0x14 */ + uint16_t lfb_depth; /* 0x16 */ + uint32_t lfb_base; /* 0x18 */ + uint32_t lfb_size; /* 0x1c */ + uint16_t cl_magic; /* 0x20 */ +#define CL_MAGIC_VALUE 0xA33F + uint16_t cl_offset; /* 0x22 */ + uint16_t lfb_linelength; /* 0x24 */ + uint8_t red_size; /* 0x26 */ + uint8_t red_pos; /* 0x27 */ + uint8_t green_size; /* 0x28 */ + uint8_t green_pos; /* 0x29 */ + uint8_t blue_size; /* 0x2a */ + uint8_t blue_pos; /* 0x2b */ + uint8_t rsvd_size; /* 0x2c */ + uint8_t rsvd_pos; /* 0x2d */ + uint16_t vesapm_seg; /* 0x2e */ + uint16_t vesapm_off; /* 0x30 */ + uint16_t pages; /* 0x32 */ + uint8_t reserved4[12]; /* 0x34 -- 0x3f reserved for future expansion */ + + struct apm_bios_info apm_bios_info; /* 0x40 */ + struct drive_info_struct drive_info; /* 0x80 */ + struct sys_desc_table sys_desc_table; /* 0xa0 */ + uint32_t alt_mem_k; /* 0x1e0 */ + uint8_t reserved5[4]; /* 0x1e4 */ + uint8_t e820_map_nr; /* 0x1e8 */ + uint8_t reserved6[9]; /* 0x1e9 */ + uint16_t mount_root_rdonly; /* 0x1f2 */ + uint8_t reserved7[4]; /* 0x1f4 */ + uint16_t ramdisk_flags; /* 0x1f8 */ +#define RAMDISK_IMAGE_START_MASK 0x07FF +#define RAMDISK_PROMPT_FLAG 0x8000 +#define RAMDISK_LOAD_FLAG 0x4000 + uint8_t reserved8[2]; /* 0x1fa */ + uint16_t orig_root_dev; /* 0x1fc */ + uint8_t reserved9[1]; /* 0x1fe */ + uint8_t aux_device_info; /* 0x1ff */ + uint8_t reserved10[2]; /* 0x200 */ + uint8_t param_block_signature[4]; /* 0x202 */ + uint16_t param_block_version; /* 0x206 */ + uint8_t reserved11[8]; /* 0x208 */ + uint8_t loader_type; /* 0x210 */ +#define LOADER_TYPE_LOADLIN 1 +#define LOADER_TYPE_BOOTSECT_LOADER 2 +#define LOADER_TYPE_SYSLINUX 3 +#define LOADER_TYPE_ETHERBOOT 4 +#define LOADER_TYPE_KERNEL 5 + uint8_t loader_flags; /* 0x211 */ + uint8_t reserved12[2]; /* 0x212 */ + uint32_t kernel_start; /* 0x214 */ + uint32_t initrd_start; /* 0x218 */ + uint32_t initrd_size; /* 0x21c */ + uint8_t reserved13[4]; /* 0x220 */ + /* 2.01+ */ + uint16_t heap_end_ptr; /* 0x224 */ + uint8_t reserved14[2]; /* 0x226 */ + /* 2.02+ */ + uint32_t cmd_line_ptr; /* 0x228 */ + /* 2.03+ */ + uint32_t initrd_addr_max; /* 0x22c */ + uint8_t reserved15[0x2d0 - 0x230]; /* 0x230 */ + + struct e820entry e820_map[E820MAX]; /* 0x2d0 */ + uint8_t reserved16[688]; /* 0x550 */ +#define COMMAND_LINE_SIZE 256 + uint8_t command_line[COMMAND_LINE_SIZE]; /* 0x800 */ + uint8_t reserved17[1792]; /* 0x900 - 0x1000 */ +}; + +/* Keep track of which information I need to acquire. */ +struct param_info { + unsigned type; + void *data; + Elf_Bhdr *param; + struct image_parameters *image; + struct parameters *real_mode; + /* bootloader type */ + int has_multiboot; + int has_uniform_boot; + int has_elf_boot; + /* firmware type */ + int has_pcbios; + int has_linuxbios; + struct lb_header *lb_table; + /* machine information needed */ + int need_mem_sizes; +}; +/* + * This is set up by the setup-routine at boot-time + */ + + +#undef memcmp +#undef memset +#undef memcpy +#define memzero(s, n) memset ((s), 0, (n)) + + +/* FIXME handle systems with large EBDA's */ +static struct parameters *faked_real_mode = (void *)REAL_MODE_DATA_LOC; + + + +/* + * Output + * ============================================================================= + */ + +/* Base Address */ +#define TTYS0 0x3f8 +#define TTYS0_LSR (TTYS0+0x05) +#define TTYS0_TBR (TTYS0+0x00) + +static void ttys0_tx_byte(unsigned byte) +{ + /* Wait until I can send a byte */ + while((inb(TTYS0_LSR) & 0x20) == 0) + ; + outb(byte, TTYS0_TBR); + /* Wait until the byte is transmitted */ + while(!(inb(TTYS0_LSR) & 0x40)) + ; +} +static void put_char_serial(int c) +{ + if (c == '\n') { + ttys0_tx_byte('\r'); + } + ttys0_tx_byte(c); +} + +static void putchar(int c) +{ +#if 0 + put_char_video(c); +#endif + put_char_serial(c); +} + +#define LONG_LONG_SHIFT ((int)((sizeof(unsigned long long)*CHAR_BIT) - 4)) +#define LONG_SHIFT ((int)((sizeof(unsigned long)*CHAR_BIT) - 4)) +#define INT_SHIFT ((int)((sizeof(unsigned int)*CHAR_BIT) - 4)) +#define SHRT_SHIFT ((int)((sizeof(unsigned short)*CHAR_BIT) - 4)) +#define CHAR_SHIFT ((int)((sizeof(unsigned char)*CHAR_BIT) - 4)) + +/************************************************************************** +PRINTF and friends + + Formats: + %x - 4 bytes int (8 hex digits, lower case) + %X - 4 bytes int (8 hex digits, upper case) + %lx - 8 bytes long (16 hex digits, lower case) + %lX - 8 bytes long (16 hex digits, upper case) + %hx - 2 bytes int (4 hex digits, lower case) + %hX - 2 bytes int (4 hex digits, upper case) + %hhx - 1 byte int (2 hex digits, lower case) + %hhX - 1 byte int (2 hex digits, upper case) + - optional # prefixes 0x or 0X + %d - decimal int + %c - char + %s - string + Note: width specification not supported +**************************************************************************/ +static void printf(const char *fmt, ...) +{ + va_list args; + char *p; + va_start(args, fmt); + for ( ; *fmt != '\0'; ++fmt) { + if (*fmt != '%') { + putchar(*fmt); + continue; + } + if (*++fmt == 's') { + for(p = va_arg(args, char *); *p != '\0'; p++) + putchar(*p); + } + else { /* Length of item is bounded */ + char tmp[40], *q = tmp; + int shift = INT_SHIFT; + if (*fmt == 'L') { + shift = LONG_LONG_SHIFT; + fmt++; + } + else if (*fmt == 'l') { + shift = LONG_SHIFT; + fmt++; + } + else if (*fmt == 'h') { + shift = SHRT_SHIFT; + fmt++; + if (*fmt == 'h') { + shift = CHAR_SHIFT; + fmt++; + } + } + + /* + * Before each format q points to tmp buffer + * After each format q points past end of item + */ + if ((*fmt | 0x20) == 'x') { + /* With x86 gcc, sizeof(long) == sizeof(int) */ + unsigned long long h; + int ncase; + if (shift > LONG_SHIFT) { + h = va_arg(args, unsigned long long); + } + else if (shift > INT_SHIFT) { + h = va_arg(args, unsigned long); + } else { + h = va_arg(args, unsigned int); + } + ncase = (*fmt & 0x20); + for ( ; shift >= 0; shift -= 4) + *q++ = "0123456789ABCDEF"[(h >> shift) & 0xF] | ncase; + } + else if (*fmt == 'd') { + char *r; + long i; + if (shift > LONG_SHIFT) { + i = va_arg(args, long long); + } + else if (shift > INT_SHIFT) { + i = va_arg(args, long); + } else { + i = va_arg(args, int); + } + if (i < 0) { + *q++ = '-'; + i = -i; + } + p = q; /* save beginning of digits */ + do { + *q++ = '0' + (i % 10); + i /= 10; + } while (i); + /* reverse digits, stop in middle */ + r = q; /* don't alter q */ + while (--r > p) { + i = *r; + *r = *p; + *p++ = i; + } + } + else if (*fmt == 'c') + *q++ = va_arg(args, int); + else + *q++ = *fmt; + /* now output the saved string */ + for (p = tmp; p < q; ++p) + putchar(*p); + } + } + va_end(args); +} + +/* + * String Functions + * ============================================================================= + */ + + +size_t strnlen(const char *s, size_t max) +{ + size_t len = 0; + while(len < max && *s) { + len++; + s++; + } + return len; +} + +void* memset(void* s, int c, size_t n) +{ + size_t i; + char *ss = (char*)s; + + for (i=0;i<n;i++) ss[i] = c; + return s; +} + +void* memcpy(void *dest, const void *src, size_t len) +{ + size_t i; + unsigned char *d; + const unsigned char *s; + d = dest; + s = src; + + for (i=0; i < len; i++) + d[i] = s[i]; + + return dest; +} + +int memcmp(void *src1, void *src2, size_t len) +{ + unsigned char *s1, *s2; + size_t i; + s1 = src1; + s2 = src2; + for(i = 0; i < len; i++) { + if (*s1 != *s2) { + return *s2 - *s1; + } + } + return 0; + +} + +/* + * Checksum functions + * ============================================================================= + */ + + +static unsigned long checksum_partial(unsigned long sum, + void *addr, unsigned long length) +{ + uint8_t *ptr; + volatile union { + uint8_t byte[2]; + uint16_t word; + } value; + unsigned long i; + /* In the most straight forward way possible, + * compute an ip style checksum. + */ + sum = 0; + ptr = addr; + for(i = 0; i < length; i++) { + unsigned long value; + value = ptr[i]; + if (i & 1) { + value <<= 8; + } + /* Add the new value */ + sum += value; + /* Wrap around the carry */ + if (sum > 0xFFFF) { + sum = (sum + (sum >> 16)) & 0xFFFF; + } + } + value.byte[0] = sum & 0xff; + value.byte[1] = (sum >> 8) & 0xff; + return value.word & 0xFFFF; + +} + +static unsigned long checksum_final(unsigned long partial) +{ + return (~partial) & 0xFFFF; +} + +static unsigned long compute_checksum(void *vaddr, unsigned long length) +{ + return checksum_final(checksum_partial(0, vaddr, length)); +} + +/* + * Helper functions + * ============================================================================= + */ + + +void append_command_line(struct parameters *real_mode, char *arg, int arg_bytes) +{ + int len, max; + char *dest; + /* skip over what has already been set */ + len = strnlen(real_mode->command_line, sizeof(real_mode->command_line)); + dest = real_mode->command_line + len; + max = sizeof(real_mode->command_line) - 1; + if (max < 1) { + /* No room to append anything :( */ + return; + } + /* Add a space in between strings */ + *dest++ = ' '; + /* Append the added command line */ + max = sizeof(real_mode->command_line) - 1; + if (max > arg_bytes) { + max = arg_bytes; + } + len = strnlen(arg, max); + memcpy(dest, arg, len); + dest += len; + /* Null terminate the string */ + *dest++ = '\0'; +} + +static void set_memsize_k(struct parameters *real_mode, unsigned long mem_k) +{ + /* ALT_MEM_K maxes out at 4GB */ + if (mem_k > 0x3fffff) { + mem_k = 0x3fffff; + } + if (mem_k > (real_mode->alt_mem_k + (1 << 10))) { + /* Use our memory size less 1M */ + real_mode->alt_mem_k = mem_k - (1 << 10); + real_mode->ext_mem_k = mem_k - (1 << 10); + if ((mem_k - (1 << 10)) > 0xFFFF) { + real_mode->ext_mem_k = 0xFC00; /* 64 M */ + } + } +} + +static void add_e820_map(struct parameters *real_mode, + unsigned long long addr, unsigned long long size, + unsigned long type) +{ + unsigned long long high; + unsigned long mem_k; + int i; + i = real_mode->e820_map_nr; + if (i < E820MAX) { + real_mode->e820_map[i].addr = addr; + real_mode->e820_map[i].size = size; + real_mode->e820_map[i].type = type; + real_mode->e820_map_nr++; + } + /* policy I assume that for the legacy memory + * variables memory is contiguous. + */ + if (type == E820_RAM) { + high = addr + size; + if (high >= 0x40000000000ULL) { + mem_k = 0xFFFFFFFF; + } else { + mem_k = high >> 10; + } + set_memsize_k(real_mode, mem_k); + } +} + +/* + * Multiboot + * ============================================================================= + */ + +#define MULTI_MEM_DEBUG 0 +#if MULTI_MEM_DEBUG +#define multi_puts(x) printf("%s", x) +#define multi_put_hex(x) printf("%x", x) +#define multi_put_lhex(x) printf("%Lx", x) +#else +#define multi_puts(x) +#define multi_put_hex(x) +#define multi_put_lhex(x) +#endif /* MULTI_MEM_DEBUG */ + +/* Multiboot Specification */ +struct multiboot_mods { + unsigned mod_start; + unsigned mod_end; + unsigned char *string; + unsigned reserved; +}; + +struct memory_segment { + unsigned long long addr; + unsigned long long size; + unsigned type; +}; + +struct multiboot_info { + unsigned flags; +#define MULTIBOOT_MEM_VALID 0x01 +#define MULTIBOOT_BOOT_DEV_VALID 0x02 +#define MULTIBOOT_CMDLINE_VALID 0x04 +#define MULTIBOOT_MODS_VALID 0x08 +#define MULTIBOOT_AOUT_SYMS_VALID 0x10 +#define MULTIBOOT_ELF_SYMS_VALID 0x20 +#define MULTIBOOT_MMAP_VALID 0x40 + unsigned mem_lower; + unsigned mem_upper; + unsigned char boot_device[4]; + void *command_line; + unsigned mods_count; + struct multiboot_mods *mods_addr; + unsigned syms_num; + unsigned syms_size; + unsigned syms_addr; + unsigned syms_shndx; + unsigned mmap_length; + struct memory_segment *mmap_addr; +}; + +#define MULTIBOOT_MAX_COMMAND_LINE 0xFFFFFFFF + +static void convert_multiboot_memmap( + struct parameters *real_mode, + struct multiboot_info *info) +{ + unsigned size; + unsigned *size_addr; +#define next_seg(seg, size) ((struct memory_segment *)((char *)(seg) + (size))) + struct memory_segment *seg, *end; + + seg = info->mmap_addr; + end = (void *)(((char *)seg) + info->mmap_length); + size_addr = (unsigned *)(((char *)seg) - 4); + size = *size_addr; + multi_puts("mmap_addr: "); multi_put_hex((unsigned)info->mmap_addr); multi_puts("\n"); + multi_puts("mmap_length: "); multi_put_hex(info->mmap_length); multi_puts("\n"); + multi_puts("size_addr: "); multi_put_hex((unsigned)size_addr); multi_puts("\n"); + multi_puts("size: "); multi_put_hex(size); multi_puts("\n"); + multi_puts("end: "); multi_put_hex((unsigned)end); multi_puts("\n"); + for(seg = info->mmap_addr; (seg < end); seg = next_seg(seg,size)) { + multi_puts("multi-mem: "); + multi_put_lhex(seg->size); + multi_puts(" @ "); + multi_put_lhex(seg->addr); + multi_puts(" ("); + switch(seg->type) { + case E820_RAM: + multi_puts("ram"); + break; + case E820_ACPI: + multi_puts("ACPI data"); + break; + case E820_NVS: + multi_puts("ACPI NVS"); + break; + case E820_RESERVED: + default: + multi_puts("reserved"); + break; + } + multi_puts(")\n"); + add_e820_map(real_mode, seg->addr, seg->size, seg->type); + } +#undef next_seg +} + +static void convert_multiboot( + struct param_info *info, struct multiboot_info *mb_info) +{ + if (info->need_mem_sizes && (mb_info->flags & MULTIBOOT_MEM_VALID)) { + /* info->memory is short 1M */ + set_memsize_k(info->real_mode, mb_info->mem_upper + (1 << 10)); + } + if (mb_info->flags & MULTIBOOT_CMDLINE_VALID) { + append_command_line(info->real_mode, mb_info->command_line, + MULTIBOOT_MAX_COMMAND_LINE); + } + if (info->need_mem_sizes && (mb_info->flags & MULTIBOOT_MMAP_VALID)) { + convert_multiboot_memmap(info->real_mode, mb_info); + } + if (mb_info->flags & (MULTIBOOT_MEM_VALID | MULTIBOOT_MMAP_VALID)) { + info->need_mem_sizes = 0; + } +} + + +/* + * Uniform Boot Environment + * ============================================================================= + */ + +#define UBE_MEM_DEBUG 0 +#if UBE_MEM_DEBUG +#define ube_puts(x) printf("%s", x) +#define ube_put_hex(x) printf("%x", x) +#define ube_put_lhex(x) printf("%Lx", x) +#else +#define ube_puts(x) +#define ube_put_hex(x) +#define ube_put_lhex(x) +#endif /* UBE_MEM_DEBUG */ +static void convert_uniform_boot_memory( + struct parameters *real_mode, struct ube_memory *mem) +{ + int i; + int entries; + unsigned long mem_k; + mem_k = 0; + entries = (mem->size - sizeof(*mem))/sizeof(mem->map[0]); + for(i = 0; (i < entries) && (i < E820MAX); i++) { + unsigned long type; + ube_puts("ube-mem: "); + ube_put_lhex(mem->map[i].size); + ube_puts(" @ "); + ube_put_lhex(mem->map[i].start); + ube_puts(" ("); + switch(mem->map[i].type) { + case UBE_MEM_RAM: + type = E820_RAM; + ube_puts("ram"); + break; + case UBE_MEM_ACPI: + type = E820_ACPI; + ube_puts("ACPI data"); + break; + case UBE_MEM_NVS: + type = E820_NVS; + ube_puts("ACPI NVS"); + break; + case UBE_MEM_RESERVED: + default: + type = E820_RESERVED; + ube_puts("reserved"); + break; + } + ube_puts(")\n"); + add_e820_map(real_mode, + mem->map[i].start, mem->map[i].size, type); + } +} + +static void convert_uniform_boot(struct param_info *info, + struct uniform_boot_header *header) +{ + /* Uniform boot environment */ + unsigned long env_bytes; + char *env; + if (header->arg_bytes) { + append_command_line(info->real_mode, (void *)(header->arg), header->arg_bytes); + } + env = (void *)(header->env); + env_bytes = header->env_bytes; + while(env_bytes) { + struct ube_record *record; + record = (void *)env; + if (record->tag == UBE_TAG_MEMORY) { + if (info->need_mem_sizes) { + convert_uniform_boot_memory(info->real_mode, (void *)record); + info->need_mem_sizes = 0; + } + } + env += record->size; + env_bytes -= record->size; + } +} + + + + +/* + * Hardware + * ============================================================================= + */ + +/* we're getting screwed again and again by this problem of the 8259. + * so we're going to leave this lying around for inclusion into + * crt0.S on an as-needed basis. + * well, that went ok, I hope. Now we have to reprogram the interrupts :-( + * we put them right after the intel-reserved hardware interrupts, at + * int 0x20-0x2F. There they won't mess up anything. Sadly IBM really + * messed this up with the original PC, and they haven't been able to + * rectify it afterwards. Thus the bios puts interrupts at 0x08-0x0f, + * which is used for the internal hardware interrupts as well. We just + * have to reprogram the 8259's, and it isn't fun. + */ + +static void setup_i8259(void) +{ + outb(0x11, 0x20); /*! initialization sequence to 8259A-1*/ + outb(0x11, 0xA0); /*! and to 8259A-2*/ + + outb(0x20, 0x21); /*! start of hardware int's (0x20)*/ + outb(0x28, 0xA1); /*! start of hardware int's 2 (0x28)*/ + + outb(0x04, 0x21); /*! 8259-1 is master*/ + outb(0x02, 0xA1); /*! 8259-2 is slave*/ + + outb(0x01, 0x21); /*! 8086 mode for both*/ + outb(0x01, 0xA1); + + outb(0xFF, 0xA1); /*! mask off all interrupts for now*/ + outb(0xFB, 0x21); /*! mask all irq's but irq2 which is cascaded*/ +} + +static void hardware_setup(struct param_info *info __unused) +{ + /* Disable nmi */ + outb(0x80, 0x70); + + /* Make sure any coprocessor is properly reset.. */ + outb(0, 0xf0); + outb(0, 0xf1); + + setup_i8259(); +} + + +/* + * ELF Boot loader + * ============================================================================= + */ + +static int count_elf_notes(Elf_Bhdr *bhdr) +{ + unsigned char *note, *end; + int count; + count = 0; + note = ((char *)bhdr) + sizeof(*bhdr); + end = ((char *)bhdr) + bhdr->b_size; +#if 0 + printf("count_elf_notes %lx\n", (unsigned long)bhdr); +#endif + while (note < end) { + Elf_Nhdr *hdr; + unsigned char *n_name, *n_desc, *next; + hdr = (Elf_Nhdr *)note; + n_name = note + sizeof(*hdr); + n_desc = n_name + ((hdr->n_namesz + 3) & ~3); + next = n_desc + ((hdr->n_descsz + 3) & ~3); +#if 0 + printf("elf_note = %lx\n", (unsigned long)note); + printf("elf_namesz = %x\n", hdr->n_namesz); + printf("elf_descsz = %x\n", hdr->n_descsz); + printf("elf_type = %x\n", hdr->n_type); + printf("elf_name = %lx\n", (unsigned long)n_name); + printf("elf_desc = %lx\n", (unsigned long)n_desc); +#endif + if (next > end) + break; + count++; + note = next; + } + return count; +} + +static Elf_Nhdr *find_elf_note(Elf_Bhdr *bhdr, + Elf_Word namesz, unsigned char *name, Elf_Word type) +{ + unsigned char *note, *end; + note = ((char *)bhdr) + sizeof(*bhdr); + end = ((char *)bhdr) + bhdr->b_size; + while(note < end) { + Elf_Nhdr *hdr; + unsigned char *n_name, *n_desc, *next; + hdr = (Elf_Nhdr *)note; + n_name = note + sizeof(*hdr); + n_desc = n_name + ((hdr->n_namesz + 3) & ~3); + next = n_desc + ((hdr->n_descsz + 3) & ~3); + if (next > end) + break; + if ((hdr->n_type == type) && + (hdr->n_namesz == namesz) && + (memcmp(n_name, name, namesz) == 0)) { + return hdr; + } + note = next; + } + return 0; +} + +static void convert_elf_command_line(struct param_info *info, + Elf_Word descsz, unsigned char *desc) +{ + append_command_line(info->real_mode, desc, descsz); +} + +struct { + Elf_Word namesz; + unsigned char *name; + Elf_Word type; + void (*convert)(struct param_info *info, Elf_Word descsz, unsigned char *desc); +} elf_notes[] = +{ + { 0, "", EBN_COMMAND_LINE, convert_elf_command_line }, +}; + +static void convert_elf_boot(struct param_info *info, Elf_Bhdr *bhdr) +{ + unsigned char *note, *end; + note = ((char *)bhdr) + sizeof(*bhdr); + end = ((char *)bhdr) + bhdr->b_size; + while(note < end) { + Elf_Nhdr *hdr; + unsigned char *n_name, *n_desc, *next; + size_t i; + hdr = (Elf_Nhdr *)note; + n_name = note + sizeof(*hdr); + n_desc = n_name + ((hdr->n_namesz + 3) & ~3); + next = n_desc + ((hdr->n_descsz + 3) & ~3); + if (next > end) + break; + for(i = 0; i < sizeof(elf_notes)/sizeof(elf_notes[0]); i++) { + if ((hdr->n_type == elf_notes[i].type) && + (hdr->n_namesz == elf_notes[i].namesz) && + (memcmp(n_name, elf_notes[i].name, elf_notes[i].namesz) == 0)) { + elf_notes[i].convert(info, hdr->n_descsz, n_desc); + break; + } + } + note = next; + } +} + +/* + * LinuxBIOS + * ============================================================================= + */ + +#define LB_MEM_DEBUG 0 +#if LB_MEM_DEBUG +#define lb_puts(x) printf("%s", x) +#define lb_put_hex(x) printf("%x", x) +#define lb_put_lhex(x) printf("%Lx", x) +#else +#define lb_puts(x) +#define lb_put_hex(x) +#define lb_put_lhex(x) +#endif /* LB_MEM_DEBUG */ + +static unsigned count_lb_records(void *start, unsigned long length) +{ + struct lb_record *rec; + void *end; + unsigned count; + count = 0; + end = ((char *)start) + length; + for(rec = start; ((void *)rec < end) && + (rec->size <= (unsigned long)(end - (void *)rec)); + rec = (void *)(((char *)rec) + rec->size)) { + count++; + } + return count; +} + +static struct lb_header *__find_lb_table(void *start, void *end) +{ + unsigned char *ptr; + /* For now be stupid.... */ + for(ptr = start; (void *)ptr < end; ptr += 16) { + struct lb_header *head = (void *)ptr; + if ((head->signature[0] == 'L') && + (head->signature[1] == 'B') && + (head->signature[2] == 'I') && + (head->signature[3] == 'O') && + (head->header_bytes == sizeof(*head)) && + (compute_checksum(head, sizeof(*head)) == 0) && + (compute_checksum(ptr + sizeof(*head), head->table_bytes) == + head->table_checksum) && + (count_lb_records(ptr + sizeof(*head), head->table_bytes) == + head->table_entries) + ) { + return head; + } + }; + return 0; +} + +static int find_lb_table(struct param_info *info) +{ + struct lb_header *head; + head = 0; + if (!head) { + /* First try at address 0 */ + head = __find_lb_table((void *)0x00000, (void *)0x1000); + } + if (!head) { + /* Then try at address 0xf0000 */ + head = __find_lb_table((void *)0xf0000, (void *)0x100000); + } + if (head) { + info->has_linuxbios = 1; + info->lb_table = head; + return 1; + } + return 0; +} + +static void convert_lb_memory(struct param_info *info, struct lb_memory *mem) +{ + int i; + int entries; + entries = (mem->size - sizeof(*mem))/sizeof(mem->map[0]); + for(i = 0; (i < entries) && (i < E820MAX); i++) { + unsigned long type; + unsigned long long end; + end = mem->map[i].start + mem->map[i].size; + lb_puts("lb-mem: "); + lb_put_lhex(mem->map[i].start); + lb_puts(" - "); + lb_put_lhex(end); + lb_puts(" ("); + switch(mem->map[i].type) { + case LB_MEM_RAM: + type = E820_RAM; + lb_puts("ram"); + break; + default: + type = E820_RESERVED; + lb_puts("reserved"); + break; + } + lb_puts(")\n"); + add_e820_map(info->real_mode, + mem->map[i].start, mem->map[i].size, type); + } + info->need_mem_sizes = 0; +} + +static void query_lb_values(struct param_info *info) +{ + struct lb_header *head; + struct lb_record *rec; + void *start, *end; + head = info->lb_table; + start = ((unsigned char *)head) + sizeof(*head); + end = ((char *)start) + head->table_bytes; + for(rec = start; ((void *)rec < end) && + (rec->size <= (unsigned long)(end - (void *)rec)); + rec = (void *)(((char *)rec) + rec->size)) { + switch(rec->tag) { + case LB_TAG_MEMORY: + { + struct lb_memory *mem; + mem = (struct lb_memory *) rec; + convert_lb_memory(info, mem); + break; + } + default: + break; + }; + } +} + +/* + * PCBIOS + * ============================================================================= + */ +#define PC_MEM_DEBUG 0 +#if PC_MEM_DEBUG +#define pc_puts(x) printf("%s", x) +#define pc_put_hex(x) printf("%x", x) +#define pc_put_lhex(x) printf("%Lx", x) +#else +#define pc_puts(x) +#define pc_put_hex(x) +#define pc_put_lhex(x) +#endif /* PC_MEM_DEBUG */ + +/* functions for querying the pcbios */ +extern void noop(void); /* for testing purposes only */ +extern int meme820(struct e820entry *buf, int count); +extern unsigned int meme801(void); +extern unsigned short mem88(void); +extern unsigned short basememsize(void); + +struct meminfo { + int map_count; + struct e820entry map[E820MAX]; +}; + +static struct meminfo meminfo; +static void get_meminfo(struct param_info *info) +{ + int i; + pc_puts("getting meminfo...\n"); + meminfo.map_count = meme820(meminfo.map, E820MAX); + pc_puts("got meminfo count="); pc_put_hex(meminfo.map_count); pc_puts("\n"); + for(i = 0; i < meminfo.map_count; i++) { + unsigned long long end; + struct e820entry *seg = meminfo.map + i; + end = seg->addr + seg->size; + pc_puts("BIOS-e820: "); + pc_put_lhex(seg->addr); + pc_puts(" - "); + pc_put_lhex(end); + pc_puts(" ("); + switch(seg->type) { + case E820_RAM: + pc_puts("ram"); + info->need_mem_sizes = 0; + break; + case E820_ACPI: + pc_puts("ACPI data"); + break; + case E820_NVS: + pc_puts("ACPI NVS"); + break; + case E820_RESERVED: + default: + pc_puts("reserved"); + break; + } + pc_puts(")\n"); + add_e820_map(info->real_mode, + seg->addr, seg->size, seg->type); + } + info->real_mode->alt_mem_k = meme801(); + info->real_mode->ext_mem_k = mem88(); + if (info->real_mode->alt_mem_k || info->real_mode->ext_mem_k) { + info->need_mem_sizes = 0; + } +} + +static void query_pcbios_values(struct param_info *info) +{ + get_meminfo(info); +} + +/* + * Bootloaders + * ============================================================================= + */ + + +static void query_bootloader_param_class(struct param_info *info) +{ + int has_bootloader_type = 0; + Elf_Bhdr *hdr = 0; + if (!has_bootloader_type && (info->type == 0x2BADB002)) { + /* Orignal multiboot specification */ + info->has_multiboot = 1; + has_bootloader_type = 1; + } + if (!has_bootloader_type && (info->type == 0x0A11B007)) { + /* Uniform boot proposal */ + unsigned long checksum; + struct uniform_boot_header *header; + header = info->data; + checksum = compute_checksum(header, header->header_bytes); + if (checksum == 0) { + info->has_uniform_boot = 1; + has_bootloader_type = 1; + } else{ + printf("Bad uniform boot header checksum!\n"); + } + } + if (info->type == ELF_BHDR_MAGIC) { + hdr = info->data; + } + if (info->param && (info->param->b_signature == ELF_BHDR_MAGIC)) { + hdr = info->param; + } + if (!has_bootloader_type && hdr) { + /* Good ELF boot proposal... */ + unsigned long checksum; + int count; + checksum = 0; + if (hdr->b_checksum != 0) { + checksum = compute_checksum(hdr, hdr->b_size); + } + count = count_elf_notes(hdr); + if ((hdr->b_signature == ELF_BHDR_MAGIC) && + (checksum == 0) && + hdr->b_records == count) { + info->has_elf_boot = 1; + info->param = hdr; + has_bootloader_type = 1; + } + else { + printf("Bad ELF parameter table!\n"); + printf(" checksum = %x\n", checksum); + printf(" count = %x\n", count); + printf(" hdr = %x\n", (unsigned long)hdr); + printf(" b_size = %x\n", hdr->b_size); + printf("b_signature = %x\n", hdr->b_signature); + printf(" b_records = %x\n", hdr->b_records); + } + } + if (!has_bootloader_type) { + printf("Unknown bootloader class!\n"); + printf("type=%x\n", info->type); + printf("data=%x\n", (unsigned)info->data); + printf("param=%x\n", (unsigned)info->param); + } +} + +static void query_bootloader_values(struct param_info *info) +{ + if (info->has_multiboot) { + convert_multiboot(info, info->data); + } + else if (info->has_uniform_boot) { + convert_uniform_boot(info, info->data); + } + else if (info->has_elf_boot) { + convert_elf_boot(info, info->param); + } +} + +/* + * Firmware + * ============================================================================= + */ + +static int bootloader_query_firmware_class(struct param_info *info) +{ + Elf_Nhdr *hdr; + unsigned char *note, *n_name, *n_desc; + int detected_firmware_type; + if (!info->has_elf_boot) { + /* Only the elf boot tables gives us a firmware type */ + return 0; + } + detected_firmware_type = 0; + n_desc = 0; + + hdr = find_elf_note(info->param, 0, 0, EBN_FIRMWARE_TYPE); + if (!hdr) { + /* If I'm not explicitly told the firmware type + * do my best to guess it for myself. + */ + detected_firmware_type = 0; + } else { + note = (char *)hdr; + n_name = note + sizeof(*hdr); + n_desc = n_name + ((hdr->n_namesz + 3) & ~3); + } + if (!detected_firmware_type && hdr && + (hdr->n_descsz == 7) && + (memcmp(n_desc, "PCBIOS", 7) == 0)) { + info->has_pcbios = 1; + detected_firmware_type = 1; + } + if (!detected_firmware_type && hdr && + (hdr->n_descsz == 10) && + (memcmp(n_desc, "LinuxBIOS", 10) == 0)) { + /* Don't believe I'm linuxBIOS unless I can + * find the linuxBIOS table.. + */ + detected_firmware_type = find_lb_table(info); + } + if (!detected_firmware_type && hdr && + (hdr->n_descsz == 0)) { + /* No firmware is present */ + detected_firmware_type = 1; + } + if (!detected_firmware_type && hdr && + (hdr->n_descsz == 1) && + (memcmp(n_desc, "", 1) == 0)) { + /* No firmware is present */ + detected_firmware_type = 1; + } + if (!detected_firmware_type && hdr) { + printf("Unknown firmware type: %s\n", n_desc); + } + return detected_firmware_type; +} + +static void query_firmware_class(struct param_info *info) +{ + int detected_firmware_type = 0; + + /* First say I have no firmware at all... */ + info->has_pcbios = 0; + info->has_linuxbios = 0; + + /* See if the bootloader has told us what + * kind of firmware we are running on. + */ + detected_firmware_type = bootloader_query_firmware_class(info); + + /* See if we can detect linuxbios. */ + if (!detected_firmware_type) { + detected_firmware_type = find_lb_table(info); + } + + if (!detected_firmware_type) { + /* if all else fails assume a standard pcbios... */ + info->has_pcbios = 1; + } + + /* Now print out the firmware type... */ + printf("Firmware type:"); + if (info->has_linuxbios) { + printf(" LinuxBIOS"); + } + if (info->has_pcbios) { + printf(" PCBIOS"); + } + printf("\n"); +} + +static void query_firmware_values(struct param_info *info) +{ + if (info->has_linuxbios) { + query_lb_values(info); + } + if (info->has_pcbios) { + query_pcbios_values(info); + } + +} + +/* + * Debug + * ============================================================================= + */ + +#if 0 +static void print_offsets(void) +{ + struct parameters *real_mode = 0; + printf("print_offsets\n"); + + printf("orig_x =%x\n", (uint32_t)&real_mode->orig_x); + printf("orig_y =%x\n", (uint32_t)&real_mode->orig_y); + printf("ext_mem_k =%x\n", (uint32_t)&real_mode->ext_mem_k); + printf("orig_video_page =%x\n", (uint32_t)&real_mode->orig_video_page); + printf("orig_video_mode =%x\n", (uint32_t)&real_mode->orig_video_mode); + printf("orig_video_cols =%x\n", (uint32_t)&real_mode->orig_video_cols); + printf("unused2 =%x\n", (uint32_t)&real_mode->unused2); + printf("orig_video_ega_bx =%x\n", (uint32_t)&real_mode->orig_video_ega_bx); + printf("unused3 =%x\n", (uint32_t)&real_mode->unused3); + printf("orig_video_lines =%x\n", (uint32_t)&real_mode->orig_video_lines); + printf("orig_video_isVGA =%x\n", (uint32_t)&real_mode->orig_video_isVGA); + printf("orig_video_points =%x\n", (uint32_t)&real_mode->orig_video_points); + printf("lfb_width =%x\n", (uint32_t)&real_mode->lfb_width); + printf("lfb_height =%x\n", (uint32_t)&real_mode->lfb_height); + printf("lfb_depth =%x\n", (uint32_t)&real_mode->lfb_depth); + printf("lfb_base =%x\n", (uint32_t)&real_mode->lfb_base); + printf("lfb_size =%x\n", (uint32_t)&real_mode->lfb_size); + printf("cl_magic =%x\n", (uint32_t)&real_mode->cl_magic); + printf("cl_offset =%x\n", (uint32_t)&real_mode->cl_offset); + printf("lfb_linelength =%x\n", (uint32_t)&real_mode->lfb_linelength); + printf("red_size =%x\n", (uint32_t)&real_mode->red_size); + printf("red_pos =%x\n", (uint32_t)&real_mode->red_pos); + printf("green_size =%x\n", (uint32_t)&real_mode->green_size); + printf("green_pos =%x\n", (uint32_t)&real_mode->green_pos); + printf("blue_size =%x\n", (uint32_t)&real_mode->blue_size); + printf("blue_pos =%x\n", (uint32_t)&real_mode->blue_pos); + printf("rsvd_size =%x\n", (uint32_t)&real_mode->rsvd_size); + printf("rsvd_pos =%x\n", (uint32_t)&real_mode->rsvd_pos); + printf("vesapm_seg =%x\n", (uint32_t)&real_mode->vesapm_seg); + printf("vesapm_off =%x\n", (uint32_t)&real_mode->vesapm_off); + printf("pages =%x\n", (uint32_t)&real_mode->pages); + printf("reserved4 =%x\n", (uint32_t)&real_mode->reserved4); + printf("apm_bios_info =%x\n", (uint32_t)&real_mode->apm_bios_info); + printf("drive_info =%x\n", (uint32_t)&real_mode->drive_info); + printf("sys_desc_table =%x\n", (uint32_t)&real_mode->sys_desc_table); + printf("alt_mem_k =%x\n", (uint32_t)&real_mode->alt_mem_k); + printf("reserved5 =%x\n", (uint32_t)&real_mode->reserved5); + printf("e820_map_nr =%x\n", (uint32_t)&real_mode->e820_map_nr); + printf("reserved6 =%x\n", (uint32_t)&real_mode->reserved6); + printf("mount_root_rdonly =%x\n", (uint32_t)&real_mode->mount_root_rdonly); + printf("reserved7 =%x\n", (uint32_t)&real_mode->reserved7); + printf("ramdisk_flags =%x\n", (uint32_t)&real_mode->ramdisk_flags); + printf("reserved8 =%x\n", (uint32_t)&real_mode->reserved8); + printf("orig_root_dev =%x\n", (uint32_t)&real_mode->orig_root_dev); + printf("reserved9 =%x\n", (uint32_t)&real_mode->reserved9); + printf("aux_device_info =%x\n", (uint32_t)&real_mode->aux_device_info); + printf("reserved10 =%x\n", (uint32_t)&real_mode->reserved10); + printf("param_block_signature=%x\n", (uint32_t)&real_mode->param_block_signature); + printf("param_block_version =%x\n", (uint32_t)&real_mode->param_block_version); + printf("reserved11 =%x\n", (uint32_t)&real_mode->reserved11); + printf("loader_type =%x\n", (uint32_t)&real_mode->loader_type); + printf("loader_flags =%x\n", (uint32_t)&real_mode->loader_flags); + printf("reserved12 =%x\n", (uint32_t)&real_mode->reserved12); + printf("kernel_start =%x\n", (uint32_t)&real_mode->kernel_start); + printf("initrd_start =%x\n", (uint32_t)&real_mode->initrd_start); + printf("initrd_size =%x\n", (uint32_t)&real_mode->initrd_size); + printf("reserved13 =%x\n", (uint32_t)&real_mode->reserved13); + printf("e820_map =%x\n", (uint32_t)&real_mode->e820_map); + printf("reserved16 =%x\n", (uint32_t)&real_mode->reserved16); + printf("command_line =%x\n", (uint32_t)&real_mode->command_line); + printf("reserved17 =%x\n", (uint32_t)&real_mode->reserved17); +} + +static void print_linux_params(struct param_info *info) +{ + int i; + + printf("print_linux_params\n"); + /* Default screen size */ + printf("orig_x =%x\n", info->real_mode->orig_x); + printf("orig_y =%x\n", info->real_mode->orig_y); + printf("orig_video_page =%x\n", info->real_mode->orig_video_page); + printf("orig_video_mode =%x\n", info->real_mode->orig_video_mode); + printf("orig_video_cols =%x\n", info->real_mode->orig_video_cols); + printf("orig_video_lines =%x\n", info->real_mode->orig_video_lines); + printf("orig_video_ega_bx=%x\n", info->real_mode->orig_video_ega_bx); + printf("orig_video_isVGA =%x\n", info->real_mode->orig_video_isVGA); + printf("orig_video_points=%x\n", info->real_mode->orig_video_points); + + + /* System descriptor table... */ + printf("sys_dest_table_len=%x\n", info->real_mode->sys_desc_table.length); + + /* Memory sizes */ + printf("ext_mem_k =%x\n", info->real_mode->ext_mem_k); + printf("alt_mem_k =%x\n", info->real_mode->alt_mem_k); + printf("e820_map_nr =%x\n", info->real_mode->e820_map_nr); + for(i = 0; i < E820MAX; i++) { + printf("addr[%x] =%Lx\n", + i, info->real_mode->e820_map[i].addr); + printf("size[%x] =%Lx\n", + i, info->real_mode->e820_map[i].size); + printf("type[%x] =%Lx\n", + i, info->real_mode->e820_map[i].type); + } + printf("mount_root_rdonly=%x\n", info->real_mode->mount_root_rdonly); + printf("ramdisk_flags =%x\n", info->real_mode->ramdisk_flags); + printf("orig_root_dev =%x\n", info->real_mode->orig_root_dev); + printf("aux_device_info =%x\n", info->real_mode->aux_device_info); + printf("param_block_signature=%x\n", *((uint32_t *)info->real_mode->param_block_signature)); + printf("loader_type =%x\n", info->real_mode->loader_type); + printf("loader_flags =%x\n", info->real_mode->loader_flags); + printf("initrd_start =%x\n", info->real_mode->initrd_start); + printf("initrd_size =%x\n", info->real_mode->initrd_size); + + /* Where I'm putting the command line */ + printf("cl_magic =%x\n", info->real_mode->cl_magic); + printf("cl_offset =%x\n", info->real_mode->cl_offset); + + /* Now print the command line */ + printf("command_line =%s\n", info->real_mode->command_line); +} + + +#endif + +/* + * main + * ============================================================================= + */ + +void initialize_linux_params(struct param_info *info) +{ + int len; + /* First the defaults */ + memset(info->real_mode, 0, PAGE_SIZE); + + /* Default screen size */ + info->real_mode->orig_x = 0; + info->real_mode->orig_y = 25; + info->real_mode->orig_video_page = 0; + info->real_mode->orig_video_mode = 0; + info->real_mode->orig_video_cols = 80; + info->real_mode->orig_video_lines = 25; + info->real_mode->orig_video_ega_bx = 0; + info->real_mode->orig_video_isVGA = 1; + info->real_mode->orig_video_points = 16; + + /* Fill this in later */ + info->real_mode->ext_mem_k = 0; + + /* Fill in later... */ + info->real_mode->e820_map_nr = 0; + + /* Where I'm putting the command line */ + info->real_mode->cl_magic = CL_MAGIC_VALUE; + info->real_mode->cl_offset = 2048; + + info->real_mode->cmd_line_ptr = info->real_mode->cl_offset + (unsigned long) info->real_mode; + + /* Now set the command line */ + len = strnlen(info->image->cmdline, sizeof(info->real_mode->command_line) -1); + memcpy(info->real_mode->command_line, info->image->cmdline, len); + info->real_mode->command_line[len] = '\0'; + + /* from the bios initially */ + memset(&info->real_mode->apm_bios_info, 0, sizeof(info->real_mode->apm_bios_info)); + + memset(&info->real_mode->drive_info, 0, sizeof(info->real_mode->drive_info)); + + /* forget it for now... */ + info->real_mode->sys_desc_table.length = 0; + + /* Fill this in later */ + info->real_mode->alt_mem_k = 0; + info->real_mode->ext_mem_k = 0; + + /* default yes: this can be overridden on the command line */ + info->real_mode->mount_root_rdonly = 0xFFFF; + + /* old ramdisk options, These really should be command line + * things... + */ + info->real_mode->ramdisk_flags = info->image->ramdisk_flags; + + /* default to /dev/hda. + * Override this on the command line if necessary + */ + info->real_mode->orig_root_dev = info->image->root_dev; + + /* Originally from the bios? */ + info->real_mode->aux_device_info = 0; + + /* Boot block magic */ + memcpy(info->real_mode->param_block_signature, "HdrS", 4); + info->real_mode->param_block_version = 0x0201; + + /* Say I'm a kernel boot loader */ + info->real_mode->loader_type = (LOADER_TYPE_KERNEL << 4) + 0 /* version */; + + /* No loader flags */ + info->real_mode->loader_flags = 0; + + /* Ramdisk address and size ... */ + info->real_mode->initrd_start = 0; + info->real_mode->initrd_size = 0; + if (info->image->initrd_size) { + info->real_mode->initrd_start = info->image->initrd_start; + info->real_mode->initrd_size = info->image->initrd_size; + } + + /* Now remember those things that I need */ + info->need_mem_sizes = 1; +} + +void *convert_params(unsigned type, void *data, void *param, void *image) +{ + struct param_info info; +#if 0 + printf("hello world\n"); +#endif + info.real_mode = faked_real_mode; + info.type = type; + info.data = data; + info.param = param; + info.image = image; + initialize_linux_params(&info); + query_bootloader_param_class(&info); + query_firmware_class(&info); + query_firmware_values(&info); + query_bootloader_values(&info); + + /* Do the hardware setup that linux might forget... */ + hardware_setup(&info); + + /* Print some debugging information */ +#if 0 + printf("EXT_MEM_K=%x\n", info.real_mode->ext_mem_k); + printf("ALT_MEM_K=%x\n", info.real_mode->alt_mem_k); +#endif +#if 0 + print_offsets(); + print_linux_params(&info); +#endif +#if 0 + printf("info.real_mode = 0x%x\n", info.real_mode ); + printf("Jumping to Linux\n"); +#endif + return info.real_mode; +} + diff --git a/util/mkelfImage/linux-i386/head.S b/util/mkelfImage/linux-i386/head.S new file mode 100644 index 0000000000..c3990ac801 --- /dev/null +++ b/util/mkelfImage/linux-i386/head.S @@ -0,0 +1,476 @@ +/* + * exec_kernel/user_space/head.S + * + * Copyright (C) 2000, 2002, 2003 Eric Biederman + * + * Parts of this code were take from the linux startup + * code of linux-2.4.0-test9 + * + * Other parts were taken from etherboot-5.0.5 + */ + +#define ASSEMBLY 1 + +#define RELOC 0x10000 +#define PROT_CODE_SEG 0x10 +#define PROT_DATA_SEG 0x18 +#define REAL_CODE_SEG 0x08 +#define REAL_DATA_SEG 0x20 + + .equ CR0_PE,1 + +.text +.code32 + + +#include "convert.h" + + .globl startup_32 +startup_32: + cld + cli + + # Save the arguments safely out of the way + movl %eax, boot_type + movl %ebx, boot_data + cmp $0,%esp + jz 1f + movl 4(%esp), %eax + movl %eax, boot_param +1: + + movl stack_start, %esp + + # Clear eflags + pushl $0 + popfl + + # Clear BSS + xorl %eax,%eax + movl $ _edata,%edi + movl $ _end,%ecx + subl %edi,%ecx + cld + rep + stosb + + # Move the gdt where Linux will not smash it during decompression + movl $gdt, %esi + movl $GDTLOC, %edi + movl $(gdt_end - gdt), %ecx + rep movsb + + # Linux makes stupid assumptions about the segments + # that are already setup, so setup a new gdt & ldt + # and then reload the segment registers. + + lgdt gdt_48 + lidt idt_48 + + # Load the data segment registers + movl $ PROT_DATA_SEG, %eax + movl %eax, %ds + movl %eax, %es + movl %eax, %fs + movl %eax, %gs + movl %eax, %ss + + pushl $image_params # image build time parameters as forth arg + pushl boot_param # boot_param pointer as third arg + pushl boot_data # boot data pointer as second arg + pushl boot_type # boot data type as first argument + call convert_params + + movl %eax, %esi # put the real mode pointer in a safe place + addl $16, %esp # pop the arguments + + + # Setup the registers before jumping to linux + + + # clear eflags + pushl $0 + popfl + + # Flag to indicate we are the bootstrap processor + xorl %ebx, %ebx + + # Clear the unspecified registers for good measure + xorl %eax, %eax + xorl %ecx, %ecx + xorl %edx, %edx + xorl %edi, %edi + xorl %esp, %esp + xorl %ebp, %ebp + + + # Jump to the linux kernel + ljmp $ PROT_CODE_SEG , $ 0x100000 + + + /* Routines to query the BIOS... */ + + +/************************************************************************** +E820_MEMSIZE - Get a listing of memory regions +**************************************************************************/ +#define SMAP 0x534d4150 + .globl meme820 +meme820: + pushl %ebp + movl %esp, %ebp + pushl %ebx + pushl %esi + pushl %edi + movl 8(%ebp), %edi /* Address to return e820 structures at */ + subl $RELOC, %edi + movl 12(%ebp), %esi /* Maximum number of e820 structurs to return */ + pushl %esi + call _prot_to_real + .code16 + xorl %ebx, %ebx +jmpe820: + movl $0xe820, %eax + movl $SMAP, %edx + movl $20, %ecx + /* %di was setup earlier */ + int $0x15 + jc bail820 + + cmpl $SMAP, %eax + jne bail820 + +good820: + /* If this is useable memory, we save it by simply advancing %di by + * sizeof(e820rec) + */ + decl %esi + testl %esi,%esi + jz bail820 + + addw $20, %di +again820: + cmpl $0, %ebx /* check to see if %ebx is set to EOF */ + jne jmpe820 + +bail820: + data32 call _real_to_prot + .code32 + popl %eax + subl %esi, %eax /* Compute how many structure we read */ + + /* Restore everything else */ + popl %edi + popl %esi + popl %ebx + movl %ebp, %esp + popl %ebp + ret + + +/************************************************************************** +MEME801 - Determine size of extended memory +**************************************************************************/ + .globl meme801 +meme801: + pushl %ebx + pushl %esi + pushl %edi + call _prot_to_real + .code16 + + stc # fix to work around buggy + xorw %cx,%cx # BIOSes which dont clear/set + xorw %dx,%dx # carry on pass/error of + # e801h memory size call + # or merely pass cx,dx though + # without changing them. + movw $0xe801,%ax + int $0x15 + jc e801absent + + cmpw $0x0, %cx # Kludge to handle BIOSes + jne e801usecxdx # which report their extended + cmpw $0x0, %dx # memory in AX/BX rather than + jne e801usecxdx # CX/DX. The spec I have read + movw %ax, %cx # seems to indicate AX/BX + movw %bx, %dx # are more reasonable anyway... + +e801usecxdx: + andl $0xffff, %edx # clear sign extend + shll $6, %edx # and go from 64k to 1k chunks + movl %edx, %eax # store extended memory size + andl $0xffff, %ecx # clear sign extend + addl %ecx, %eax # and add lower memory into + + jmp e801out +e801absent: + xorl %eax,%eax + +e801out: + data32 call _real_to_prot + .code32 + /* Restore Everything */ + popl %edi + popl %esi + popl %ebx + ret + +/************************************************************************** +MEM88 - Determine size of extended memory +**************************************************************************/ + .globl mem88 +mem88: + pushl %ebx + pushl %esi + pushl %edi + call _prot_to_real + .code16 + + movb $0x88, %ah + int $0x15 + andl $0xffff, %eax + + data32 call _real_to_prot + .code32 + + /* Restore Everything */ + popl %edi + popl %esi + popl %ebx + ret + + +/************************************************************************** +BASEMEMSIZE - Get size of the conventional (base) memory +**************************************************************************/ + .globl basememsize +basememsize: + call _prot_to_real + .code16 + int $0x12 + movw %ax,%cx + DATA32 call _real_to_prot + .code32 + movw %cx,%ax + ret + +/************************************************************************** +_REAL_TO_PROT - Go from REAL mode to Protected Mode +**************************************************************************/ + .globl _real_to_prot +_real_to_prot: + .code16 + cli + cs + addr32 lgdt gdt_48 - RELOC + movl %cr0,%eax + orl $CR0_PE,%eax + movl %eax,%cr0 /* turn on protected mode */ + + /* flush prefetch queue, and reload %cs:%eip */ + data32 ljmp $PROT_CODE_SEG,$1f +1: + .code32 + /* reload other segment registers */ + movl $PROT_DATA_SEG,%eax + movl %eax,%ds + movl %eax,%es + movl %eax,%ss + addl $RELOC,%esp /* Fix up stack pointer */ + xorl %eax,%eax + movl %eax,%fs + movl %eax,%gs + popl %eax /* Fix up return address */ + addl $RELOC,%eax + pushl %eax + + /* switch to protected mode idt */ + cs + lidt idt_48 + ret + +/************************************************************************** +_PROT_TO_REAL - Go from Protected Mode to REAL Mode +**************************************************************************/ + .globl _prot_to_real +_prot_to_real: + .code32 + popl %eax + subl $RELOC,%eax /* Adjust return address */ + pushl %eax + subl $RELOC,%esp /* Adjust stack pointer */ + ljmp $REAL_CODE_SEG,$1f- RELOC /* jump to a 16 bit segment */ +1: + .code16 + /* clear the PE bit of CR0 */ + movl %cr0,%eax + andl $0!CR0_PE,%eax + movl %eax,%cr0 + + /* make intersegment jmp to flush the processor pipeline + * and reload %cs:%eip (to clear upper 16 bits of %eip). + */ + data32 ljmp $(RELOC)>>4,$2f- RELOC +2: + /* we are in real mode now + * set up the real mode segment registers : %ds, $ss, %es + */ + movw %cs,%ax + movw %ax,%ds + movw %ax,%es + movw %ax,%ss + movw %ax,%fs + movw %ax,%gs + + /* Switch to the real mode idt */ + cs + addr32 lidt idt_real - RELOC + + sti + data32 ret /* There is a 32 bit return address on the stack */ + .code32 + +boot_type: .long 0 +boot_data: .long 0 +boot_param: .long 0 + +idt_real: + .word 0x400 # idt limit = 256 + .word 0, 0 +idt_48: + .word 0 # idt limit = 0 + .word 0, 0 # idt base = 0L +gdt_48: + .word gdt_end - gdt - 1 # gdt limit=40, + # (5 GDT entries) + .long GDTLOC # gdt base + +# Descriptor tables +# These need to be in a seperate section so I can be +# certain later activities dont stomp them +gdt: + /* 0x00 */ + .word 0, 0, 0, 0 # dummy + + /* 0x08 */ + /* 16 bit real mode code segment */ + .word 0xffff,(RELOC&0xffff) + .byte (RELOC>>16),0x9b,0x00,(RELOC>>24) + + /* 0x10 */ + .word 0xFFFF # 4Gb - (0x100000*0x1000 = 4Gb) + .word 0 # base address = 0 + .word 0x9A00 # code read/exec + .word 0x00CF # granularity = 4096, 386 + # (+5th nibble of limit) + + /* 0x18 */ + .word 0xFFFF # 4Gb - (0x100000*0x1000 = 4Gb) + .word 0 # base address = 0 + .word 0x9200 # data read/write + .word 0x00CF # granularity = 4096, 386 + # (+5th nibble of limit) + + /* 0x20 */ + /* 16 bit real mode data segment */ + .word 0xffff,(RELOC&0xffff) + .byte (RELOC>>16),0x93,0x00,(RELOC>>24) + + /* For 2.5.x the kernel segments have moved */ + + /* 0x28 dummy */ + .quad 0 + + /* 0x30 dummy */ + .quad 0 + /* 0x38 dummy */ + .quad 0 + /* 0x40 dummy */ + .quad 0 + /* 0x48 dummy */ + .quad 0 + /* 0x50 dummy */ + .quad 0 + /* 0x58 dummy */ + .quad 0 + + + /* 0x60 */ + .word 0xFFFF # 4Gb - (0x100000*0x1000 = 4Gb) + .word 0 # base address = 0 + .word 0x9A00 # code read/exec + .word 0x00CF # granularity = 4096, 386 + # (+5th nibble of limit) + + /* 0x68 */ + .word 0xFFFF # 4Gb - (0x100000*0x1000 = 4Gb) + .word 0 # base address = 0 + .word 0x9200 # data read/write + .word 0x00CF # granularity = 4096, 386 + # (+5th nibble of limit) +/* + * The layout of the per-CPU GDT under Linux: + * + * 0 - null + * 1 - reserved + * 2 - reserved + * 3 - reserved + * + * 4 - default user CS <==== new cacheline + * 5 - default user DS + * + * ------- start of TLS (Thread-Local Storage) segments: + * + * 6 - TLS segment #1 [ glibc's TLS segment ] + * 7 - TLS segment #2 [ Wine's %fs Win32 segment ] + * 8 - TLS segment #3 + * 9 - reserved + * 10 - reserved + * 11 - reserved + * + * ------- start of kernel segments: + * + * 12 - kernel code segment <==== new cacheline + * 13 - kernel data segment + * 14 - TSS + * 15 - LDT + * 16 - PNPBIOS support (16->32 gate) + * 17 - PNPBIOS support + * 18 - PNPBIOS support + * 19 - PNPBIOS support + * 20 - PNPBIOS support + * 21 - APM BIOS support + * 22 - APM BIOS support + * 23 - APM BIOS support + */ +gdt_end: + + + + .section ".trailer", "a" + /* Constants set at build time, these are at the very end of my image */ + .balign 16 + .global image_params +image_params: + +convert_magic: + .long CONVERT_MAGIC +gdt_size: + .long gdt_end - gdt +bss_size: + .long bss_size +ramdisk_flags: + .word 0 +root_dev: + .word DEFAULT_ROOT_DEV +entry: + .long 0 +initrd_start: + .long 0 +initrd_size: + .long 0 +cmdline: + .asciz "BOOT_IMAGE=head.S console=ttyS0 ip=dhcp root=/dev/nfs" + .org cmdline + CMDLINE_MAX, 0 +cmdline_end: diff --git a/util/mkelfImage/linux-i386/mkelf-linux-i386.c b/util/mkelfImage/linux-i386/mkelf-linux-i386.c new file mode 100644 index 0000000000..200d4a55f9 --- /dev/null +++ b/util/mkelfImage/linux-i386/mkelf-linux-i386.c @@ -0,0 +1,388 @@ +#include <stdio.h> +#include <errno.h> +#include <stdlib.h> +#include <stdint.h> +#include <string.h> +#define _GNU_SOURCE +#include <getopt.h> +#include "elf.h" +#include "elf_boot.h" +#include "convert.h" +#include "x86-linux.h" +#include "mkelfImage.h" + +static unsigned char payload[] = { +#include "convert.bin.c" +}; + +struct kernel_info; +static void (*parse_kernel_type)(struct kernel_info *info, char *kernel_buf, size_t kernel_size); +static void parse_bzImage_kernel(struct kernel_info *info, char *kernel_buf, size_t kernel_size); +static void parse_elf32_kernel(struct kernel_info *info, char *kernel_buf, size_t kernel_size); + +char *vmlinux_i386_probe(char *kernel_buf, off_t kernel_size) +{ + Elf32_Ehdr *ehdr; + Elf32_Phdr *phdr; + int i; + int hdr1, hdr2; + ehdr = (Elf32_Ehdr *)kernel_buf; + if ( + (ehdr->e_ident[EI_MAG0] != ELFMAG0) || + (ehdr->e_ident[EI_MAG1] != ELFMAG1) || + (ehdr->e_ident[EI_MAG2] != ELFMAG2) || + (ehdr->e_ident[EI_MAG3] != ELFMAG3)) { + return "No ELF signature found on kernel\n"; + } + if (ehdr->e_ident[EI_CLASS] != ELFCLASS32) { + return "Not a 32bit ELF kernel\n"; + } + if (ehdr->e_ident[EI_DATA] != ELFDATA2LSB) { + return "Not a little endian ELF kernel\n"; + } + if (le16_to_cpu(ehdr->e_type) != ET_EXEC) { + return "Not an executable kernel\n"; + } + if (le16_to_cpu(ehdr->e_machine) != EM_386) { + return "Not an i386 kernel\n"; + } + if ( (ehdr->e_ident[EI_VERSION] != EV_CURRENT) || + (le32_to_cpu(ehdr->e_version) != EV_CURRENT)) { + return "Kernel not using ELF version 1.\n"; + } + if (le16_to_cpu(ehdr->e_phentsize) != sizeof(*phdr)) { + return "Kernel uses bad program header size.\n"; + } + phdr = (Elf32_Phdr *)(kernel_buf + le32_to_cpu(ehdr->e_phoff)); + hdr1 = hdr2 = -1; + for(i = 0; i < le32_to_cpu(ehdr->e_phnum); i++) { + if (le32_to_cpu(phdr[i].p_type) != PT_LOAD) + continue; + if (((hdr1 != -1) && + ((le32_to_cpu(phdr[hdr1].p_paddr) & 0xfffffff) != 0x100000)) || + (hdr2 != -1)) { + return "Too many PT_LOAD segments to be a linux kernel\n"; + } + if (hdr1 == -1) { + hdr1 = i; + } else { + hdr2 = i; + } + } + if (hdr1 == -1) { + return "No PT_LOAD segments!\n"; + } + parse_kernel_type = parse_elf32_kernel; + return 0; +} + +char *bzImage_i386_probe(char *kernel_buf, off_t kernel_size) +{ + struct x86_linux_header *hdr; + unsigned long offset; + int setup_sects; + hdr = (struct x86_linux_header *)kernel_buf; + + if (le16_to_cpu(hdr->boot_sector_magic) != 0xaa55) { + return "No bootsector magic"; + } + if (memcmp(hdr->header_magic, "HdrS", 4) != 0) { + return "Not a linux kernel"; + } + + if (le16_to_cpu(hdr->protocol_version) < 0x202) { + return "Kernel protcols version before 2.02 not supported"; + } + + setup_sects = hdr->setup_sects; + if (setup_sects == 0) { + setup_sects = 4; + } + offset = 512 + (512 *setup_sects); + if (offset > kernel_size) { + return "Not enough bytes"; + } + parse_kernel_type = parse_bzImage_kernel; + return 0; +} + +char *linux_i386_probe(char *kernel_buf, off_t kernel_size) +{ + char *result; + result = ""; + if (result) result = bzImage_i386_probe(kernel_buf, kernel_size); + if (result) result = vmlinux_i386_probe(kernel_buf, kernel_size); + if (result) result = bzImage_i386_probe(kernel_buf, kernel_size); + return result; +} + +struct kernel_info +{ + void *kernel; + size_t filesz; + size_t memsz; + size_t paddr; + size_t vaddr; + void *kernel2; + size_t filesz2; + size_t memsz2; + size_t paddr2; + size_t vaddr2; + size_t entry; + char *version; +}; + +static void parse_elf32_kernel(struct kernel_info *info, char *kernel_buf, size_t kernel_size) +{ + Elf32_Ehdr *ehdr; + Elf32_Phdr *phdr; + int i; + int hdr1, hdr2; + ehdr = (Elf32_Ehdr *)kernel_buf; + phdr = (Elf32_Phdr *)(kernel_buf + ehdr->e_phoff); + hdr1 = hdr2 = -1; + for(i = 0; i < le16_to_cpu(ehdr->e_phnum); i++) { + if (le32_to_cpu(phdr[i].p_type) != PT_LOAD) + continue; + if (hdr2 != -1) { + die("Too many PT_LOAD segments to be a linux kernel\n"); + } + if (hdr1 == -1) { + hdr1 = i; + } else { + hdr2 = i; + } + } + if (hdr1 == -1) { + die("No PT_LOAD segments!\n"); + } + info->kernel = kernel_buf + le32_to_cpu(phdr[hdr1].p_offset); + info->filesz = le32_to_cpu(phdr[hdr1].p_filesz); + info->memsz = le32_to_cpu(phdr[hdr1].p_memsz); + info->paddr = le32_to_cpu(phdr[hdr1].p_paddr) & 0xfffffff; + info->vaddr = le32_to_cpu(phdr[hdr1].p_vaddr); + + if (hdr2 != -1) { + info->kernel2 = kernel_buf + le32_to_cpu(phdr[hdr2].p_offset); + info->filesz2 = le32_to_cpu(phdr[hdr2].p_filesz); + info->memsz2 = le32_to_cpu(phdr[hdr2].p_memsz); + info->paddr2 = le32_to_cpu(phdr[hdr2].p_paddr) & 0xfffffff; + info->vaddr2 = le32_to_cpu(phdr[hdr2].p_vaddr); + } + + info->entry = 0x100000; + info->version = "unknown"; +} + +static void parse_bzImage_kernel(struct kernel_info *info, char *kernel_buf, size_t kernel_size) +{ + struct x86_linux_header *hdr; + unsigned long offset; + int setup_sects; + hdr = (struct x86_linux_header *)kernel_buf; + setup_sects = hdr->setup_sects; + if (setup_sects == 0) { + setup_sects = 4; + } + offset = 512 + (512 *setup_sects); + + info->kernel = kernel_buf + offset; + info->filesz = kernel_size - offset; + info->memsz = 0x700000; + info->paddr = 0x100000; + info->vaddr = 0x100000; + info->entry = info->paddr; + info->version = kernel_buf + 512 + le16_to_cpu(hdr->kver_addr); +} + +static void parse_kernel(struct kernel_info *info, char *kernel_buf, size_t kernel_size) +{ + memset(info, 0, sizeof(*info)); + if (parse_kernel_type) { + parse_kernel_type(info, kernel_buf, kernel_size); + } + else { + die("Unknown kernel format"); + } +} + +void linux_i386_usage(void) +{ + printf( + " --command-line=<string> Set the command line to <string>\n" + " --append=<string> Set the command line to <string>\n" + " --initrd=<filename> Set the initrd to <filename>\n" + " --ramdisk=<filename> Set the initrd to <filename>\n" + " --ramdisk-base=<addr> Set the initrd load address to <addr>\n" + ); + return; +} + + +#define OPT_CMDLINE OPT_MAX+0 +#define OPT_RAMDISK OPT_MAX+1 +#define OPT_RAMDISK_BASE OPT_MAX+2 + +#define DEFAULT_RAMDISK_BASE (8*1024*1024) + +int linux_i386_mkelf(int argc, char **argv, + struct memelfheader *ehdr, char *kernel_buf, off_t kernel_size) +{ + const char *ramdisk, *cmdline; + unsigned long ramdisk_base; + char *payload_buf, *ramdisk_buf; + off_t payload_size, ramdisk_size; + struct memelfphdr *phdr; + struct memelfnote *note; + struct kernel_info kinfo; + struct image_parameters *params; + int index; + + int opt; + static const struct option options[] = { + MKELF_OPTIONS + { "command-line", 1, 0, OPT_CMDLINE }, + { "append", 1, 0, OPT_CMDLINE }, + { "initrd", 1, 0, OPT_RAMDISK }, + { "ramdisk", 1, 0, OPT_RAMDISK }, + { "ramdisk-base", 1, 0, OPT_RAMDISK_BASE }, + { 0 , 0, 0, 0 }, + }; + static const char short_options[] = MKELF_OPT_STR; + + ramdisk_base = DEFAULT_RAMDISK_BASE; + ramdisk = 0; + cmdline=""; + + while((opt = getopt_long(argc, argv, short_options, options, 0)) != -1) { + switch(opt) { + case '?': + error("Unknown option %s\n", argv[optind]); + break; + case OPT_RAMDISK_BASE: + { + char *end; + unsigned long base; + base = strtoul(optarg, &end, 0); + if ((end == optarg) || (*end != '\0')) { + error("Invalid ramdisk base\n"); + } + ramdisk_base = base; + } + case OPT_RAMDISK: + ramdisk = optarg; + break; + case OPT_CMDLINE: + cmdline = optarg; + break; + default: + break; + } + } + ehdr->ei_class = ELFCLASS32; + ehdr->ei_data = ELFDATA2LSB; + ehdr->e_type = ET_EXEC; + ehdr->e_machine = EM_386; + + /* locate the payload buffer */ + payload_buf = payload; + payload_size = sizeof(payload); + + /* slurp the input files */ + ramdisk_buf = slurp_file(ramdisk, &ramdisk_size); + + /* parse the kernel */ + parse_kernel(&kinfo, kernel_buf, kernel_size); + + /* Find the parameters */ + params = (void *)(payload_buf + (payload_size - sizeof(*params))); + + /* A sanity check against bad versions of binutils */ + if (params->convert_magic != CONVERT_MAGIC) { + die("Internal error convert_magic %08x != %08x\n", + params->convert_magic, CONVERT_MAGIC); + } + + /* Copy the command line */ + strncpy(params->cmdline, cmdline, sizeof(params->cmdline)); + params->cmdline[sizeof(params->cmdline)-1]= '\0'; + + + /* Add a program header for the note section */ + index = 4; + index += kinfo.kernel2 ? 1:0; + index += ramdisk_size ? 1:0; + phdr = add_program_headers(ehdr, index); + + /* Fill in the program headers*/ + phdr[0].p_type = PT_NOTE; + + /* Fill in the converter program headers */ + phdr[1].p_paddr = CONVERTLOC; + phdr[1].p_vaddr = CONVERTLOC; + phdr[1].p_filesz = payload_size; + phdr[1].p_memsz = payload_size + params->bss_size; + phdr[1].p_data = payload; + + /* Reserve space for the REAL MODE DATA segment AND the GDT segment */ + phdr[2].p_paddr = REAL_MODE_DATA_LOC; + phdr[2].p_vaddr = REAL_MODE_DATA_LOC; + phdr[2].p_filesz = 0; + phdr[2].p_memsz = (GDTLOC - REAL_MODE_DATA_LOC) + params->gdt_size; + phdr[2].p_data = 0; + + phdr[3].p_paddr = kinfo.paddr; + phdr[3].p_vaddr = kinfo.vaddr; + phdr[3].p_filesz = kinfo.filesz; + phdr[3].p_memsz = kinfo.memsz; + phdr[3].p_data = kinfo.kernel; + + index = 4; + /* Put the second kernel frament if present */ + if (kinfo.kernel2) { + phdr[index].p_paddr = kinfo.paddr2; + phdr[index].p_vaddr = kinfo.vaddr2; + phdr[index].p_filesz = kinfo.filesz2; + phdr[index].p_memsz = kinfo.memsz2; + phdr[index].p_data = kinfo.kernel2; + index++; + } + + /* Put the ramdisk at ramdisk base. + */ + params->initrd_start = params->initrd_size = 0; + if (ramdisk_size) { + phdr[index].p_paddr = ramdisk_base; + phdr[index].p_vaddr = ramdisk_base; + phdr[index].p_filesz = ramdisk_size; + phdr[index].p_memsz = ramdisk_size; + phdr[index].p_data = ramdisk_buf; + params->initrd_start = phdr[index].p_paddr; + params->initrd_size = phdr[index].p_filesz; + index++; + } + + /* Set the start location */ + params->entry = kinfo.entry; + ehdr->e_entry = phdr[1].p_paddr; + + /* Setup the elf notes */ + note = add_notes(ehdr, 3); + note[0].n_type = EIN_PROGRAM_NAME; + note[0].n_name = "ELFBoot"; + note[0].n_desc = "Linux"; + note[0].n_descsz = strlen(note[0].n_desc)+1; + + note[1].n_type = EIN_PROGRAM_VERSION; + note[1].n_name = "ELFBoot"; + note[1].n_desc = kinfo.version; + note[1].n_descsz = strlen(note[1].n_desc); + + note[2].n_type = EIN_PROGRAM_CHECKSUM; + note[2].n_name = "ELFBoot"; + note[2].n_desc = 0; + note[2].n_descsz = 2; + + return 0; +} + diff --git a/util/mkelfImage/linux-i386/uniform_boot.h b/util/mkelfImage/linux-i386/uniform_boot.h new file mode 100644 index 0000000000..5291fa66bb --- /dev/null +++ b/util/mkelfImage/linux-i386/uniform_boot.h @@ -0,0 +1,67 @@ +#ifndef _LINUX_UNIFORM_BOOT_H +#define _LINUX_UNIFORM_BOOT_H + +/* The uniform boot environment information is restricted to + * hardware information. In particular for a simple enough machine + * all of the environment information should be able to reside in + * a rom and not need to be moved. This information is the + * information a trivial boot room can pass to linux to let it + * run the hardware. + * + * Also all of the information should be Position Independent Data. + * That is it should be safe to relocated any of the information + * without it's meaning/correctnes changing. The exception is the + * uniform_boot_header with it's two pointers arg & env. + * + * The addresses in the arg & env pointers must be physical + * addresses. A physical address is an address you put in the page + * table. + * + * The Command line is for user policy. Things like the default + * root device. + * + */ + +struct uniform_boot_header +{ + unsigned long header_bytes; + unsigned long header_checksum; + unsigned long arg; + unsigned long arg_bytes; + unsigned long env; + unsigned long env_bytes; +}; + +/* Every entry in the boot enviroment list will correspond to a boot + * info record. Encoding both type and size. The type is obviously + * so you can tell what it is. The size allows you to skip that + * boot enviroment record if you don't know what it easy. This allows + * forward compatibility with records not yet defined. + */ +struct ube_record { + unsigned long tag; /* tag ID */ + unsigned long size; /* size of record (in bytes) */ + unsigned long data[0]; /* data */ +}; + + +#define UBE_TAG_MEMORY 0x0001 + +struct ube_memory_range { + unsigned long long start; + unsigned long long size; + unsigned long type; +#define UBE_MEM_RAM 1 +#define UBE_MEM_RESERVED 2 +#define UBE_MEM_ACPI 3 +#define UBE_MEM_NVS 4 + +}; + +struct ube_memory { + unsigned long tag; + unsigned long size; + struct ube_memory_range map[0]; +}; + +#endif /* _LINUX_UNIFORM_BOOT_H */ diff --git a/util/mkelfImage/linux-i386/x86-linux.h b/util/mkelfImage/linux-i386/x86-linux.h new file mode 100644 index 0000000000..fe1673ea67 --- /dev/null +++ b/util/mkelfImage/linux-i386/x86-linux.h @@ -0,0 +1,162 @@ +#ifndef X86_LINUX_H +#define X86_LINUX_H + +#define E820MAP 0x2d0 /* our map */ +#define E820MAX 32 /* number of entries in E820MAP */ +#define E820NR 0x1e8 /* # entries in E820MAP */ + +#ifndef ASSEMBLY + +struct e820entry { + uint64_t addr; /* start of memory segment */ + uint64_t size; /* size of memory segment */ + uint32_t type; /* type of memory segment */ +#define E820_RAM 1 +#define E820_RESERVED 2 +#define E820_ACPI 3 /* usable as RAM once ACPI tables have been read */ +#define E820_NVS 4 +} __attribute__((packed)); + +/* FIXME expand on drive_info_struct... */ +struct drive_info_struct { + uint8_t dummy[32]; +}; +struct sys_desc_table { + uint16_t length; + uint8_t table[318]; +}; + +struct apm_bios_info { + uint16_t version; /* 0x40 */ + uint16_t cseg; /* 0x42 */ + uint32_t offset; /* 0x44 */ + uint16_t cseg_16; /* 0x48 */ + uint16_t dseg; /* 0x4a */ + uint16_t flags; /* 0x4c */ + uint16_t cseg_len; /* 0x4e */ + uint16_t cseg_16_len; /* 0x50 */ + uint16_t dseg_len; /* 0x52 */ + uint8_t reserved[44]; /* 0x54 */ +}; + + +struct x86_linux_param_header { + uint8_t orig_x; /* 0x00 */ + uint8_t orig_y; /* 0x01 */ + uint16_t ext_mem_k; /* 0x02 -- EXT_MEM_K sits here */ + uint16_t orig_video_page; /* 0x04 */ + uint8_t orig_video_mode; /* 0x06 */ + uint8_t orig_video_cols; /* 0x07 */ + uint16_t unused2; /* 0x08 */ + uint16_t orig_video_ega_bx; /* 0x0a */ + uint16_t unused3; /* 0x0c */ + uint8_t orig_video_lines; /* 0x0e */ + uint8_t orig_video_isVGA; /* 0x0f */ + uint16_t orig_video_points; /* 0x10 */ + + /* VESA graphic mode -- linear frame buffer */ + uint16_t lfb_width; /* 0x12 */ + uint16_t lfb_height; /* 0x14 */ + uint16_t lfb_depth; /* 0x16 */ + uint32_t lfb_base; /* 0x18 */ + uint32_t lfb_size; /* 0x1c */ + uint16_t cl_magic; /* 0x20 */ +#define CL_MAGIC_VALUE 0xA33F + uint16_t cl_offset; /* 0x22 */ + uint16_t lfb_linelength; /* 0x24 */ + uint8_t red_size; /* 0x26 */ + uint8_t red_pos; /* 0x27 */ + uint8_t green_size; /* 0x28 */ + uint8_t green_pos; /* 0x29 */ + uint8_t blue_size; /* 0x2a */ + uint8_t blue_pos; /* 0x2b */ + uint8_t rsvd_size; /* 0x2c */ + uint8_t rsvd_pos; /* 0x2d */ + uint16_t vesapm_seg; /* 0x2e */ + uint16_t vesapm_off; /* 0x30 */ + uint16_t pages; /* 0x32 */ + uint8_t reserved4[12]; /* 0x34 -- 0x3f reserved for future expansion */ + + struct apm_bios_info apm_bios_info; /* 0x40 */ + struct drive_info_struct drive_info; /* 0x80 */ + struct sys_desc_table sys_desc_table; /* 0xa0 */ + uint32_t alt_mem_k; /* 0x1e0 */ + uint8_t reserved5[4]; /* 0x1e4 */ + uint8_t e820_map_nr; /* 0x1e8 */ + uint8_t reserved6[8]; /* 0x1e9 */ + uint8_t setup_sects; /* 0x1f1 */ + uint16_t mount_root_rdonly; /* 0x1f2 */ + uint8_t reserved7[4]; /* 0x1f4 */ + uint16_t ramdisk_flags; /* 0x1f8 */ +#define RAMDISK_IMAGE_START_MASK 0x07FF +#define RAMDISK_PROMPT_FLAG 0x8000 +#define RAMDISK_LOAD_FLAG 0x4000 + uint16_t vid_mode; /* 0x1fa */ + uint16_t root_dev; /* 0x1fc */ + uint8_t reserved9[1]; /* 0x1fe */ + uint8_t aux_device_info; /* 0x1ff */ + /* 2.00+ */ + uint8_t reserved10[2]; /* 0x200 */ + uint8_t header_magic[4]; /* 0x202 */ + uint16_t protocol_version; /* 0x206 */ + uint8_t reserved11[8]; /* 0x208 */ + uint8_t loader_type; /* 0x210 */ +#define LOADER_TYPE_LOADLIN 1 +#define LOADER_TYPE_BOOTSECT_LOADER 2 +#define LOADER_TYPE_SYSLINUX 3 +#define LOADER_TYPE_ETHERBOOT 4 +#define LOADER_TYPE_UNKNOWN 0xFF + uint8_t loader_flags; /* 0x211 */ + uint8_t reserved12[2]; /* 0x212 */ + uint32_t kernel_start; /* 0x214 */ + uint32_t initrd_start; /* 0x218 */ + uint32_t initrd_size; /* 0x21c */ + uint8_t reserved13[4]; /* 0x220 */ + /* 2.01+ */ + uint16_t heap_end_ptr; /* 0x224 */ + uint8_t reserved14[2]; /* 0x226 */ + /* 2.02+ */ + uint32_t cmd_line_ptr; /* 0x228 */ + /* 2.03+ */ + uint32_t initrd_addr_max; /* 0x22c */ + uint8_t reserved15[160]; /* 0x230 */ + struct e820entry e820_map[E820MAX]; /* 0x2d0 */ + /* 0x550 */ +#define COMMAND_LINE_SIZE 256 +}; + +struct x86_linux_header { + uint8_t reserved1[0x1f1]; /* 0x000 */ + uint8_t setup_sects; /* 0x1f1 */ + uint16_t root_flags; /* 0x1f2 */ + uint8_t reserved2[6]; /* 0x1f4 */ + uint16_t vid_mode; /* 0x1fa */ + uint16_t root_dev; /* 0x1fc */ + uint16_t boot_sector_magic; /* 0x1fe */ + /* 2.00+ */ + uint8_t reserved3[2]; /* 0x200 */ + uint8_t header_magic[4]; /* 0x202 */ + uint16_t protocol_version; /* 0x206 */ + uint32_t realmode_swtch; /* 0x208 */ + uint16_t start_sys; /* 0x20c */ + uint16_t kver_addr; /* 0x20e */ + uint8_t type_of_loader; /* 0x210 */ + uint8_t loadflags; /* 0x211 */ + uint16_t setup_move_size; /* 0x212 */ + uint32_t code32_start; /* 0x214 */ + uint32_t ramdisk_image; /* 0x218 */ + uint32_t ramdisk_size; /* 0x21c */ + uint8_t reserved4[4]; /* 0x220 */ + /* 2.01+ */ + uint16_t heap_end_ptr; /* 0x224 */ + uint8_t reserved5[2]; /* 0x226 */ + /* 2.02+ */ + uint32_t cmd_line_ptr; /* 0x228 */ + /* 2.03+ */ + uint32_t initrd_addr_max; /* 0x22c */ + uint8_t tail[32*1024]; /* 0x230 */ +} __attribute__ ((packed)); + +#endif /* ASSEMBLY */ + +#endif /* X86_LINUX_H */ diff --git a/util/mkelfImage/linux-ia64/Makefile b/util/mkelfImage/linux-ia64/Makefile new file mode 100644 index 0000000000..38f5d8cd34 --- /dev/null +++ b/util/mkelfImage/linux-ia64/Makefile @@ -0,0 +1,33 @@ +LIA64_DIR=linux-ia64 +LIA64_OBJ=$(OBJDIR)/$(LIA64_DIR) +LIA64_DEP=Makefile Makefile.conf $(LIA64_DIR)/Makefile + +$(LIA64_OBJ)/mkelf-linux-ia64.o: $(LIA64_DIR)/mkelf-linux-ia64.c $(LIA64_DIR)/convert.bin.c $(LIA64_DEP) + $(MKDIR) -p $(@D) + $(HOST_CC) $(HOST_CFLAGS) -c -g $< -o $@ + +ifdef IA64_CC + +$(LIA64_DIR)/convert.bin.c: $(LIA64_OBJ)/convert.bin $(OBJDIR)/bin/bin-to-hex $(LIA64_DEP) + $(MKDIR) -p $(@D) + $(OBJDIR)/bin/bin-to-hex < $(LIA64_OBJ)/convert.bin > $@ + +$(LIA64_OBJ)/convert.bin: $(LIA64_OBJ)/convert $(LIA64_DEP) + $(MKDIR) -p $(@D) + $(IA64_OBJCOPY) -O binary $< $@ + +CONVERT_LIA64_OBJS=$(LIA64_OBJ)/head.o $(LIA64_OBJ)/convert_params.o +$(LIA64_OBJ)/convert: $(LIA64_DIR)/convert.lds $(CONVERT_LIA64_OBJS) $(LIA64_DEP) + $(MKDIR) -p $(@D) + $(IA64_LD) $(IA64_LDFLAGS) -T $(LIA64_DIR)/convert.lds -o $@ $(CONVERT_LIA64_OBJS) + +$(LIA64_OBJ)/head.o: $(LIA64_DIR)/head.S $(LIA64_DIR)/convert.h + $(MKDIR) -p $(@D) + $(IA64_CPP) $(IA64_CFLAGS) -D ASSEMBLY $< | $(IA64_AS) $(IA64_ASFLAGS) -o $@ + +$(LIA64_OBJ)/convert_params.o: $(LIA64_DIR)/convert_params.c $(LIA64_DIR)/convert.h $(LIA64_DEP) + $(IA64_CC) $(IA64_CFLAGS) -c -o $@ $< + + +endif + diff --git a/util/mkelfImage/linux-ia64/convert.bin.c b/util/mkelfImage/linux-ia64/convert.bin.c new file mode 100644 index 0000000000..2b8bcc7fa9 --- /dev/null +++ b/util/mkelfImage/linux-ia64/convert.bin.c @@ -0,0 +1,310 @@ +0x00, 0x08, 0x19, 0x06, 0x80, 0x05, 0x20, 0x02, 0x00, 0x62, 0x00, 0xc0, 0x01, 0x00, 0xc0, 0x00, +0x05, 0x00, 0x00, 0x00, 0x01, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xe0, 0x01, 0xe2, 0x8b, 0x6f, +0x0a, 0x08, 0x38, 0x1e, 0x05, 0x20, 0x30, 0x02, 0x80, 0x00, 0x42, 0x80, 0x04, 0xe0, 0x00, 0x84, +0x1c, 0x28, 0x41, 0x03, 0x00, 0x26, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x70, 0x0d, 0x00, 0x50, +0x0d, 0xe0, 0x00, 0x10, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0xe0, 0x81, 0x0d, 0x00, 0x98, +0x0a, 0x80, 0x00, 0x1e, 0x18, 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x20, 0x00, 0x09, 0x00, 0x07, +0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x08, 0x01, 0x55, 0x00, 0x00, 0x20, 0x0a, 0x00, 0x07, +0x1d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, +0x00, 0x38, 0x28, 0x40, 0x86, 0x39, 0x00, 0x6a, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x04, 0x00, +0x13, 0x00, 0x00, 0x00, 0x01, 0x80, 0x41, 0x04, 0x00, 0xc2, 0x01, 0x00, 0xf0, 0xff, 0xff, 0x48, +0x00, 0x60, 0x3d, 0x1c, 0x80, 0x05, 0x00, 0x41, 0x30, 0x00, 0x42, 0x20, 0x02, 0x60, 0x00, 0x84, +0x0a, 0x60, 0x40, 0x18, 0x3f, 0x23, 0xd0, 0x02, 0x90, 0x44, 0x08, 0x60, 0x05, 0x00, 0xc4, 0x00, +0x00, 0x80, 0x9f, 0x20, 0xd9, 0x17, 0xa0, 0x42, 0x32, 0x00, 0x42, 0x00, 0x00, 0x00, 0x04, 0x00, +0x0a, 0x80, 0x9b, 0x22, 0xd9, 0x17, 0x00, 0x2f, 0x41, 0xb2, 0x2f, 0x00, 0x00, 0x00, 0x04, 0x00, +0x0a, 0x80, 0x93, 0x22, 0xd9, 0x17, 0x00, 0x1f, 0x41, 0xb2, 0x2f, 0x00, 0x00, 0x00, 0x04, 0x00, +0x0a, 0x00, 0x88, 0x22, 0xd8, 0x11, 0x00, 0x08, 0x41, 0xb0, 0x23, 0x00, 0x00, 0x00, 0x04, 0x00, +0x0b, 0x70, 0x01, 0x40, 0x00, 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0xc0, 0x01, 0x70, 0x51, 0x00, +0x10, 0x38, 0x00, 0x1c, 0x86, 0x39, 0x00, 0x00, 0x00, 0x02, 0x80, 0x03, 0x70, 0x00, 0x00, 0x43, +0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0xe0, 0x00, 0xb8, 0x28, 0x00, 0xc0, 0x50, 0x72, 0x1c, 0xe6, +0x10, 0x70, 0x01, 0x1c, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0x70, 0x00, 0x00, 0x43, +0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x48, 0xff, 0xff, 0x58, +0x0b, 0x00, 0x05, 0x40, 0x00, 0x21, 0xe0, 0x02, 0x80, 0x00, 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, +0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0xe0, 0x00, 0xb8, 0x28, 0x00, 0xe0, 0x00, 0x70, 0x18, 0xe6, +0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0xb0, 0xff, 0xff, 0x4a, +0x00, 0x00, 0xb4, 0x48, 0x2a, 0x04, 0x00, 0x60, 0x01, 0x55, 0x00, 0x00, 0xb0, 0x0a, 0x00, 0x07, +0x11, 0x60, 0xc0, 0x19, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x80, 0x08, 0x00, 0x84, 0x00, +0x01, 0x00, 0x05, 0x40, 0x00, 0x21, 0x90, 0x82, 0x30, 0x00, 0x42, 0x00, 0xc2, 0x01, 0x00, 0x90, +0x0b, 0x78, 0x00, 0x40, 0x00, 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0xc0, 0x01, 0x78, 0x50, 0x00, +0x11, 0x38, 0xcc, 0x1d, 0x86, 0x39, 0xe0, 0x00, 0x3c, 0x28, 0x80, 0x03, 0x80, 0x03, 0x00, 0x43, +0x1d, 0x38, 0xb0, 0x1d, 0x86, 0x39, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, +0xf0, 0x80, 0xf0, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x02, 0x80, 0x03, 0x50, 0x03, 0x00, 0x43, +0x10, 0x38, 0xa0, 0x1d, 0x86, 0x39, 0x00, 0x00, 0x00, 0x02, 0x80, 0x03, 0x00, 0x03, 0x00, 0x43, +0x0b, 0x78, 0x00, 0x40, 0x00, 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0xc0, 0x01, 0x78, 0x50, 0x00, +0x1d, 0x70, 0x80, 0x1c, 0x2e, 0x20, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, +0x11, 0x38, 0xe0, 0x1d, 0x86, 0x39, 0xe0, 0x00, 0x3c, 0x28, 0x80, 0x03, 0x00, 0x02, 0x00, 0x43, +0x11, 0x38, 0x90, 0x1d, 0x86, 0x39, 0xe0, 0x00, 0x3c, 0x28, 0x80, 0x03, 0xa0, 0x00, 0x00, 0x43, +0x0a, 0x38, 0x8c, 0x1d, 0x86, 0xf9, 0xe1, 0x00, 0xa8, 0x00, 0xc2, 0x43, 0x85, 0x50, 0x01, 0x84, +0xcb, 0x08, 0x3c, 0x52, 0x80, 0xd5, 0xe1, 0x00, 0x38, 0x00, 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, +0xe0, 0x08, 0x38, 0x52, 0x80, 0x15, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, +0x1d, 0x40, 0x41, 0x18, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, +0x10, 0x30, 0xa0, 0x52, 0x07, 0x34, 0x00, 0x00, 0x00, 0x02, 0x80, 0x03, 0xd0, 0xfe, 0xff, 0x4a, +0x0a, 0x70, 0x05, 0x50, 0x00, 0x14, 0x00, 0x00, 0x00, 0x02, 0x00, 0xc0, 0x05, 0x70, 0x51, 0x00, +0x11, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0xe8, 0xfd, 0xff, 0x58, +0x10, 0x30, 0xa0, 0x52, 0x07, 0x34, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0xe0, 0xff, 0xff, 0x4a, +0x11, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x90, 0xfe, 0xff, 0x48, +0x0a, 0x38, 0x70, 0x20, 0x86, 0xb1, 0xe1, 0x00, 0xa8, 0x00, 0xc2, 0xc3, 0x01, 0x50, 0x01, 0x84, +0xc2, 0x50, 0x21, 0x54, 0x00, 0xe1, 0xa1, 0x42, 0xa8, 0x00, 0x42, 0x00, 0x00, 0x00, 0x04, 0x00, +0xc9, 0x70, 0x00, 0x1c, 0x10, 0xd0, 0x01, 0x01, 0x38, 0x30, 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, +0x03, 0x00, 0x00, 0x00, 0x01, 0x80, 0x01, 0x01, 0x38, 0x2c, 0x00, 0xe0, 0x00, 0x01, 0x18, 0xc0, +0xe2, 0x70, 0xb4, 0x00, 0x00, 0xe4, 0x01, 0x01, 0x40, 0x0a, 0x40, 0x00, 0x00, 0x00, 0x04, 0x00, +0xea, 0x08, 0x38, 0x52, 0x80, 0x15, 0x80, 0x02, 0xa4, 0x00, 0x42, 0x00, 0x00, 0x00, 0x04, 0x00, +0x00, 0x30, 0x40, 0x00, 0xe1, 0x18, 0xf0, 0xf8, 0x43, 0x00, 0x29, 0x00, 0x00, 0x00, 0x04, 0x00, +0x05, 0x00, 0x00, 0x00, 0x01, 0x40, 0x66, 0x66, 0x66, 0x66, 0x66, 0xc0, 0x71, 0xd6, 0x30, 0x63, +0x0a, 0x38, 0x38, 0x00, 0xe1, 0x18, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, +0x0d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x60, 0x00, 0x18, 0x0e, 0x77, 0x00, 0x00, 0x00, 0x04, 0x00, +0x0b, 0x70, 0x18, 0x00, 0xe1, 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0xc0, 0x51, 0x70, 0xf4, 0x52, +0x0b, 0x70, 0x38, 0x1e, 0x05, 0x20, 0xf0, 0x70, 0x38, 0x22, 0x40, 0xe0, 0x00, 0x70, 0x18, 0xe4, +0x0b, 0x78, 0x3c, 0x00, 0x10, 0x20, 0xf0, 0x80, 0x3c, 0x0a, 0x40, 0x00, 0x02, 0x70, 0x00, 0x84, +0x1d, 0x78, 0xc0, 0x1e, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, +0x11, 0x08, 0x3c, 0x52, 0x80, 0x15, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0x80, 0xff, 0xff, 0x4a, +0x1d, 0x80, 0xfc, 0x53, 0x3f, 0x23, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, +0x10, 0x30, 0xa0, 0x20, 0x07, 0x34, 0x00, 0x00, 0x00, 0x02, 0x80, 0x03, 0xa0, 0xfe, 0xff, 0x4b, +0x09, 0x70, 0x00, 0x20, 0x00, 0x10, 0xf0, 0x00, 0xa0, 0x00, 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, +0x09, 0xf8, 0x3f, 0x20, 0x81, 0x17, 0x10, 0x70, 0xa0, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x04, 0x00, +0x10, 0x30, 0xa0, 0x20, 0x07, 0x34, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0xe0, 0xff, 0xff, 0x4a, +0x11, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x60, 0xfe, 0xff, 0x48, +0x02, 0x38, 0x70, 0x20, 0x86, 0x31, 0x20, 0x01, 0x3d, 0x58, 0xc0, 0xc3, 0x01, 0x50, 0x01, 0x84, +0xc9, 0x70, 0x00, 0x54, 0x00, 0xe1, 0xa1, 0x42, 0xa8, 0x00, 0x42, 0x43, 0x85, 0x50, 0x01, 0x84, +0xec, 0x88, 0x00, 0x1c, 0x18, 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, +0xd0, 0x88, 0x00, 0x1c, 0x10, 0x10, 0x70, 0x80, 0x00, 0x0c, 0xe1, 0x03, 0x20, 0xfe, 0xff, 0x4b, +0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xe0, 0x00, 0x40, 0x24, 0x00, 0x00, 0xc2, 0x87, 0xfc, 0x8c, +0x05, 0x00, 0x00, 0x00, 0x01, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xe0, 0x01, 0xe2, 0xff, 0x6f, +0x01, 0x78, 0x04, 0x1e, 0x00, 0x20, 0xe0, 0x70, 0x44, 0x80, 0x3c, 0xe0, 0x00, 0x01, 0x18, 0xc2, +0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, +0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, +0x0b, 0x70, 0x3c, 0x1c, 0x2c, 0x20, 0xe0, 0x70, 0x3c, 0x00, 0x40, 0x00, 0x00, 0x00, 0x04, 0x00, +0x0b, 0x70, 0x00, 0x1c, 0x00, 0x10, 0xe0, 0x90, 0x38, 0x1c, 0x40, 0x00, 0x00, 0x00, 0x04, 0x00, +0x10, 0x08, 0x38, 0x52, 0x80, 0x15, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0x90, 0xff, 0xff, 0x4a, +0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x90, 0xfd, 0xff, 0x48, +0x02, 0x00, 0x05, 0x40, 0x00, 0x21, 0x00, 0x61, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x04, 0x00, +0x0b, 0x70, 0x00, 0x40, 0x00, 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0xc0, 0x01, 0x70, 0x50, 0x00, +0x10, 0x38, 0xa0, 0x1d, 0x86, 0x39, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0xf0, 0xfc, 0xff, 0x4a, +0x00, 0x80, 0x10, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, +0x10, 0x00, 0x05, 0x40, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0xd0, 0xfc, 0xff, 0x48, +0x02, 0x70, 0x00, 0x54, 0x00, 0x21, 0xa0, 0x42, 0xa8, 0x00, 0x42, 0x00, 0x00, 0x00, 0x04, 0x00, +0x0b, 0x40, 0x01, 0x1c, 0x18, 0x10, 0xe0, 0x00, 0xa0, 0x00, 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, +0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0xe0, 0x00, 0x38, 0x28, 0x00, 0xe0, 0x00, 0x70, 0x18, 0xe6, +0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x80, 0x03, 0xe0, 0xfb, 0xff, 0x4a, +0x0a, 0x70, 0x05, 0x50, 0x00, 0x14, 0x00, 0x00, 0x00, 0x02, 0x00, 0xc0, 0x05, 0x70, 0x51, 0x00, +0x11, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0xf8, 0xfa, 0xff, 0x58, +0x0b, 0x70, 0x00, 0x50, 0x00, 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0xc0, 0x01, 0x70, 0x50, 0x00, +0x10, 0x38, 0x00, 0x1c, 0x86, 0x39, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0xd0, 0xff, 0xff, 0x4a, +0x11, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x90, 0xfb, 0xff, 0x48, +0x00, 0x70, 0xfc, 0x45, 0x3f, 0x23, 0x20, 0x00, 0x04, 0x65, 0x00, 0x00, 0x01, 0x00, 0x01, 0x84, +0x1d, 0x38, 0x00, 0x44, 0x06, 0x39, 0x00, 0x00, 0x00, 0x02, 0x80, 0x03, 0x40, 0x00, 0x00, 0x43, +0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x70, 0x04, 0x55, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, +0x1d, 0x70, 0x04, 0x42, 0x00, 0x14, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, +0x11, 0x08, 0x38, 0x10, 0x80, 0x15, 0x00, 0x00, 0x00, 0x02, 0x00, 0xa0, 0xf0, 0xff, 0xff, 0x48, +0x11, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x10, 0x04, 0x55, 0x00, 0x80, 0x08, 0x00, 0x84, 0x00, +0x1d, 0x80, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, +0x10, 0x30, 0x40, 0x44, 0x07, 0x34, 0x00, 0x00, 0x00, 0x02, 0x80, 0x03, 0x50, 0x00, 0x00, 0x43, +0x00, 0x78, 0x00, 0x40, 0x00, 0x10, 0x00, 0x09, 0x40, 0x00, 0x42, 0x00, 0x14, 0x00, 0x01, 0x84, +0x0a, 0x70, 0x00, 0x42, 0x00, 0x10, 0x80, 0x80, 0x88, 0x12, 0x68, 0x20, 0x14, 0x08, 0x01, 0x84, +0x1d, 0x30, 0x38, 0x1e, 0x87, 0x38, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, +0xf3, 0x40, 0x3c, 0x1c, 0x05, 0xe0, 0x41, 0x04, 0x00, 0xc2, 0x01, 0x04, 0xd0, 0xff, 0xff, 0x4a, +0x11, 0x40, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x80, 0x08, 0x00, 0x84, 0x00, +0x1d, 0x78, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, +0x10, 0x30, 0x3c, 0x44, 0x07, 0x34, 0x00, 0x00, 0x00, 0x02, 0x80, 0x03, 0x60, 0x00, 0x00, 0x43, +0x0b, 0x70, 0x80, 0x1e, 0x00, 0x20, 0xe0, 0x00, 0x38, 0x00, 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, +0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0xe0, 0x00, 0x38, 0x28, 0x00, 0xe0, 0x00, 0x70, 0x18, 0xe6, +0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x80, 0x03, 0x30, 0x00, 0x00, 0x43, +0x1d, 0x78, 0x04, 0x1e, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, +0x11, 0x30, 0x3c, 0x44, 0x07, 0x34, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0xc0, 0xff, 0xff, 0x4a, +0x10, 0x88, 0x00, 0x00, 0x00, 0x21, 0x60, 0x78, 0x88, 0x0e, 0xe8, 0x03, 0x80, 0x00, 0x00, 0x43, +0x01, 0x90, 0x3c, 0x40, 0x00, 0x20, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, +0x0b, 0x70, 0x84, 0x22, 0x00, 0x20, 0x00, 0x01, 0x38, 0x00, 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, +0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0xe0, 0x00, 0x40, 0x28, 0x00, 0xe0, 0x00, 0x70, 0x18, 0xe6, +0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x80, 0x03, 0x40, 0x00, 0x00, 0x43, +0x09, 0x88, 0x04, 0x22, 0x00, 0x21, 0x10, 0x80, 0x48, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x04, 0x00, +0x1d, 0x70, 0x44, 0x1e, 0x00, 0x20, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, +0x10, 0x30, 0x38, 0x44, 0x07, 0x34, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0xb0, 0xff, 0xff, 0x4a, +0x0b, 0x78, 0x3c, 0x22, 0x00, 0x20, 0x60, 0x78, 0x88, 0x0e, 0x68, 0x00, 0x00, 0x00, 0x04, 0x00, +0xeb, 0x78, 0xfc, 0x45, 0x3f, 0x23, 0xe0, 0x00, 0x3d, 0x00, 0x40, 0x00, 0x00, 0x00, 0x04, 0x00, +0x11, 0x00, 0x00, 0x1c, 0x80, 0x11, 0x00, 0x00, 0x00, 0x02, 0x00, 0x80, 0x08, 0x00, 0x84, 0x00, +0x00, 0x28, 0x25, 0x0c, 0x80, 0x05, 0x80, 0x02, 0x00, 0x10, 0x48, 0x40, 0x04, 0x00, 0x20, 0x90, +0x00, 0x08, 0x01, 0x40, 0x00, 0x21, 0x40, 0x02, 0x00, 0x62, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, +0x05, 0x00, 0x00, 0x00, 0x01, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x60, 0x04, 0x10, 0x00, 0x68, +0x05, 0x18, 0x05, 0x46, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xe0, 0x84, 0xe3, 0xff, 0x6f, +0x19, 0x38, 0x05, 0x4e, 0x00, 0x20, 0x60, 0x02, 0x8c, 0x30, 0x20, 0x00, 0xa8, 0xfe, 0xff, 0x58, +0x01, 0x00, 0x01, 0x46, 0x18, 0x10, 0x00, 0x28, 0x01, 0x55, 0x00, 0x00, 0x40, 0x0a, 0x00, 0x07, +0x11, 0x10, 0x0c, 0x00, 0x80, 0x05, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x88, 0xfe, 0xff, 0x48, +0x0a, 0x80, 0x24, 0x02, 0x80, 0x05, 0xf0, 0x40, 0x80, 0x00, 0x42, 0x00, 0x02, 0x01, 0x01, 0x84, +0x00, 0x88, 0x60, 0x40, 0x00, 0x21, 0x20, 0x01, 0x81, 0x00, 0x42, 0x80, 0xc2, 0x02, 0x01, 0x84, +0x09, 0x70, 0x20, 0x41, 0x00, 0x21, 0x30, 0x41, 0x81, 0x00, 0x42, 0x60, 0xe4, 0x02, 0x01, 0x84, +0x00, 0x20, 0xc1, 0x40, 0x00, 0x21, 0x50, 0x92, 0x81, 0x00, 0x42, 0xc0, 0x84, 0x03, 0x01, 0x84, +0x05, 0xe8, 0x00, 0x1e, 0x18, 0xd0, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xe0, 0x04, 0x10, 0x00, 0x68, +0x09, 0x38, 0x05, 0x4e, 0x00, 0x20, 0x80, 0x02, 0x38, 0x30, 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, +0x00, 0x40, 0x20, 0x4f, 0x00, 0x21, 0x10, 0x42, 0x9c, 0x00, 0x42, 0x40, 0x04, 0x39, 0x01, 0x84, +0x00, 0xd0, 0x00, 0x20, 0x18, 0x10, 0xe0, 0xc1, 0x9c, 0x00, 0x42, 0xe0, 0x03, 0x3a, 0x01, 0x84, +0x09, 0xb0, 0x00, 0x22, 0x18, 0x10, 0x70, 0x01, 0x48, 0x30, 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, +0x00, 0x70, 0x00, 0x4a, 0x08, 0x10, 0xc0, 0x41, 0x9d, 0x00, 0x42, 0x60, 0xc3, 0x3a, 0x01, 0x84, +0x00, 0x90, 0x00, 0x28, 0x08, 0x10, 0x80, 0x71, 0x9d, 0x00, 0x42, 0x80, 0x22, 0x3b, 0x01, 0x84, +0x09, 0x78, 0x00, 0x4c, 0x18, 0x10, 0x30, 0x01, 0x4c, 0x20, 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, +0x00, 0xc8, 0xc0, 0x4e, 0x00, 0x21, 0x50, 0xc1, 0x9d, 0x00, 0x42, 0xc0, 0x00, 0x40, 0x1d, 0xe4, +0x08, 0x80, 0x00, 0x46, 0x08, 0x10, 0x10, 0x01, 0x90, 0x10, 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, +0x02, 0x00, 0x38, 0x28, 0x88, 0x11, 0x40, 0x01, 0x9e, 0x00, 0x42, 0x00, 0x00, 0x00, 0x04, 0x00, +0x08, 0x00, 0x3c, 0x2a, 0x98, 0x11, 0x00, 0xe8, 0x84, 0x30, 0x23, 0xe0, 0x01, 0x04, 0x01, 0x84, +0x08, 0x00, 0x68, 0x44, 0x98, 0x11, 0x00, 0xb0, 0x78, 0x30, 0x23, 0x00, 0x00, 0x00, 0x04, 0x00, +0x08, 0x00, 0x5c, 0x3e, 0x98, 0x11, 0x00, 0x98, 0x70, 0x20, 0x23, 0x00, 0x00, 0x00, 0x04, 0x00, +0x08, 0x00, 0x48, 0x36, 0x88, 0x11, 0x00, 0x80, 0x60, 0x10, 0x23, 0x00, 0x00, 0x00, 0x04, 0x00, +0x10, 0x00, 0x44, 0x32, 0x88, 0x11, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0x40, 0x00, 0x00, 0x42, +0x0b, 0x70, 0x00, 0x10, 0x18, 0x10, 0x70, 0x00, 0x38, 0x0c, 0x72, 0x00, 0x00, 0x00, 0x04, 0x00, +0xe9, 0x70, 0x00, 0x1e, 0x18, 0xd0, 0x01, 0x40, 0x21, 0x30, 0x23, 0x00, 0x00, 0x00, 0x04, 0x00, +0xe0, 0x00, 0x38, 0x28, 0x98, 0x11, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, +0x1d, 0x70, 0x00, 0x40, 0x18, 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, +0x11, 0x30, 0x00, 0x1c, 0x07, 0x39, 0x00, 0x02, 0x38, 0x00, 0x42, 0x83, 0x08, 0x00, 0x84, 0x02, +0x11, 0x10, 0x04, 0x00, 0x80, 0x05, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x08, 0xfe, 0xff, 0x48, +0x00, 0x40, 0x31, 0x12, 0x80, 0x05, 0x10, 0x02, 0x00, 0x00, 0x42, 0xc0, 0x04, 0x00, 0x00, 0x84, +0x18, 0x20, 0x01, 0x00, 0x00, 0x21, 0xe0, 0x20, 0x80, 0x00, 0x42, 0x00, 0x00, 0x00, 0x00, 0x20, +0x02, 0x10, 0x31, 0x40, 0x00, 0x21, 0x70, 0x02, 0x00, 0x62, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, +0x0b, 0x70, 0x00, 0x1c, 0x10, 0x10, 0x00, 0x02, 0x39, 0x00, 0x40, 0x00, 0x00, 0x00, 0x04, 0x00, +0x10, 0x30, 0x88, 0x40, 0x07, 0x34, 0x00, 0x00, 0x00, 0x02, 0x80, 0x03, 0xd0, 0x00, 0x00, 0x43, +0x02, 0x70, 0x00, 0x44, 0x00, 0x21, 0x90, 0x62, 0x88, 0x00, 0x42, 0x00, 0x00, 0x00, 0x04, 0x00, +0x0b, 0x80, 0x10, 0x1c, 0x10, 0x14, 0xe0, 0x00, 0x38, 0x20, 0x20, 0xe0, 0x31, 0x80, 0x00, 0x84, +0x0b, 0x78, 0xf0, 0x1f, 0x2c, 0x22, 0xe0, 0x18, 0x38, 0x00, 0x42, 0xe0, 0x01, 0x78, 0x48, 0x00, +0x03, 0x70, 0xf0, 0x1d, 0x2c, 0x22, 0x30, 0x4a, 0x3d, 0x00, 0x40, 0xc0, 0x01, 0x70, 0x48, 0x00, +0x02, 0x28, 0x8d, 0x1c, 0x00, 0x20, 0xe0, 0x40, 0x88, 0x00, 0x42, 0xe0, 0x00, 0x2a, 0x19, 0xd0, +0x11, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x80, 0x03, 0x70, 0x00, 0x00, 0x43, +0x10, 0x38, 0x00, 0x20, 0x86, 0x39, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0x70, 0x01, 0x00, 0x42, +0x0b, 0x70, 0x00, 0x1c, 0x10, 0x10, 0x60, 0x10, 0x38, 0x0e, 0x73, 0x00, 0x00, 0x00, 0x04, 0x00, +0xd0, 0x20, 0x01, 0x46, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0x30, 0x00, 0x00, 0x43, +0x11, 0x30, 0x08, 0x1c, 0x87, 0x35, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0xf0, 0x00, 0x00, 0x42, +0x0a, 0x30, 0x04, 0x1c, 0x87, 0xb9, 0x11, 0x02, 0x8c, 0x00, 0x42, 0x00, 0x00, 0x00, 0x04, 0x00, +0x11, 0x10, 0x01, 0x4a, 0x00, 0x21, 0x60, 0x28, 0x81, 0x0e, 0x68, 0x03, 0x50, 0xff, 0xff, 0x4a, +0x02, 0x48, 0x00, 0x48, 0x08, 0x39, 0x70, 0x00, 0x98, 0x0c, 0x72, 0xe3, 0x11, 0x00, 0x00, 0x90, +0xe9, 0x78, 0x00, 0x00, 0x00, 0x21, 0xe2, 0x08, 0x00, 0x00, 0xc8, 0xc4, 0x01, 0x00, 0x00, 0x84, +0x0b, 0x70, 0x3c, 0x1c, 0x0c, 0x20, 0x60, 0x00, 0x38, 0x0e, 0x73, 0x00, 0x00, 0x00, 0x04, 0x00, +0xe4, 0x50, 0x01, 0x48, 0x00, 0xe1, 0xff, 0xff, 0xff, 0xff, 0xff, 0x23, 0x05, 0xe4, 0xff, 0x6f, +0xea, 0x58, 0x01, 0x4c, 0x00, 0xe1, 0x91, 0x0a, 0xa4, 0x00, 0x40, 0x00, 0x00, 0x00, 0x04, 0x00, +0x11, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x80, 0x03, 0x78, 0xf5, 0xff, 0x5b, +0x10, 0x30, 0x00, 0x42, 0x07, 0x39, 0x00, 0x40, 0x01, 0x55, 0x00, 0x03, 0x40, 0x00, 0x00, 0x43, +0x05, 0x00, 0x00, 0x00, 0x01, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x84, 0xe5, 0xff, 0x6f, +0x03, 0x00, 0x05, 0x40, 0x00, 0x20, 0x00, 0x38, 0x05, 0x80, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, +0x11, 0x10, 0x08, 0x00, 0x80, 0x05, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x38, 0xf5, 0xff, 0x48, +0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x40, 0x01, 0x55, 0x00, 0x00, 0x70, 0x0a, 0x00, 0x07, +0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x80, 0x08, 0x00, 0x84, 0x00, +0x1d, 0x30, 0x0c, 0x1c, 0x87, 0x39, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, +0xd0, 0x30, 0x01, 0x46, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0x20, 0xff, 0xff, 0x4b, +0x0a, 0x30, 0x10, 0x1c, 0x87, 0xb9, 0x91, 0x02, 0x8c, 0x00, 0x42, 0x00, 0x00, 0x00, 0x04, 0x00, +0x11, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0xf8, 0xfb, 0xff, 0x5b, +0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0xf0, 0xfe, 0xff, 0x48, +0x10, 0x38, 0x28, 0x20, 0x86, 0x39, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0xe0, 0xfe, 0xff, 0x4a, +0x05, 0x58, 0x29, 0x00, 0x00, 0xe4, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x40, 0x85, 0xe6, 0xff, 0x6f, +0x11, 0x50, 0x05, 0x54, 0x00, 0x20, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x28, 0xfa, 0xff, 0x58, +0x11, 0x70, 0x20, 0x44, 0x00, 0x21, 0x70, 0x00, 0x20, 0x0c, 0x73, 0x03, 0xb0, 0xfe, 0xff, 0x4a, +0x0b, 0x70, 0x00, 0x1c, 0x10, 0x10, 0x60, 0x10, 0x38, 0x0e, 0x73, 0x00, 0x00, 0x00, 0x04, 0x00, +0xc0, 0x90, 0x80, 0x46, 0x00, 0xa1, 0x31, 0x81, 0x8c, 0x00, 0x42, 0x83, 0x82, 0x19, 0x01, 0x84, +0x05, 0x00, 0x00, 0x00, 0x01, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xc3, 0x01, 0x10, 0x00, 0x68, +0xca, 0x70, 0x04, 0x1c, 0x00, 0xa0, 0xf1, 0x80, 0x38, 0x00, 0x42, 0x03, 0x82, 0x71, 0x00, 0x84, +0xc2, 0x88, 0x80, 0x1c, 0x00, 0xa1, 0xe1, 0x40, 0x39, 0x00, 0x42, 0x00, 0x00, 0x00, 0x04, 0x00, +0xc9, 0x00, 0x48, 0x1e, 0x98, 0x91, 0xf1, 0x00, 0x8c, 0x30, 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, +0xc9, 0x00, 0x3c, 0x20, 0x98, 0x91, 0xf1, 0x00, 0x4c, 0x30, 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, +0xc9, 0x00, 0x3c, 0x22, 0x98, 0x91, 0xf1, 0x00, 0x50, 0x20, 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, +0xd0, 0x00, 0x3c, 0x1c, 0x90, 0x11, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0x20, 0xfe, 0xff, 0x4b, +0x11, 0x30, 0x08, 0x1c, 0x87, 0x35, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0x50, 0x00, 0x00, 0x42, +0x10, 0x30, 0x04, 0x1c, 0x87, 0x39, 0x00, 0x00, 0x00, 0x02, 0x80, 0x03, 0x00, 0xfe, 0xff, 0x4a, +0x05, 0x78, 0x00, 0x46, 0x18, 0xd0, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xc0, 0x01, 0x10, 0x00, 0x68, +0x0b, 0x70, 0x04, 0x1c, 0x00, 0x20, 0xe0, 0x40, 0x38, 0x00, 0x42, 0x00, 0x00, 0x00, 0x04, 0x00, +0x10, 0x00, 0x3c, 0x1c, 0x98, 0x11, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0xd0, 0xfd, 0xff, 0x48, +0x11, 0x30, 0x0c, 0x1c, 0x87, 0x39, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0x60, 0x00, 0x00, 0x43, +0x10, 0x30, 0x10, 0x1c, 0x87, 0x39, 0x00, 0x00, 0x00, 0x02, 0x80, 0x03, 0xb0, 0xfd, 0xff, 0x4a, +0x04, 0x50, 0x01, 0x46, 0x00, 0xe1, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x20, 0x05, 0x10, 0x00, 0x68, +0x0b, 0x58, 0x21, 0x00, 0x00, 0x24, 0x90, 0x0a, 0xa4, 0x00, 0x40, 0x00, 0x00, 0x00, 0x04, 0x00, +0x11, 0x48, 0xb1, 0x52, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x88, 0xf8, 0xff, 0x58, +0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x70, 0xfd, 0xff, 0x48, +0x05, 0x78, 0x00, 0x46, 0x18, 0xd0, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xc0, 0x01, 0x10, 0x00, 0x68, +0x1d, 0x70, 0x04, 0x1c, 0x00, 0x20, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, +0x11, 0x70, 0xe0, 0x1c, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x70, 0xff, 0xff, 0x48, +0x00, 0x20, 0x19, 0x0a, 0x80, 0x05, 0x10, 0x81, 0x88, 0x00, 0x42, 0xe0, 0x01, 0x12, 0x01, 0x84, +0x08, 0x80, 0x00, 0x40, 0x10, 0x10, 0x20, 0xc2, 0x88, 0x00, 0x42, 0x60, 0x04, 0x00, 0xc4, 0x00, +0x05, 0x28, 0x01, 0x40, 0x00, 0xe1, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xc0, 0x01, 0x10, 0x00, 0x68, +0x0a, 0x70, 0x04, 0x1c, 0x00, 0x20, 0x20, 0x01, 0x3a, 0x00, 0x42, 0x60, 0x82, 0x74, 0x00, 0x84, +0x04, 0x00, 0x3c, 0x1c, 0x98, 0x11, 0x0e, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x71, 0xe0, 0x83, 0x65, +0x0a, 0x78, 0x00, 0x22, 0x18, 0x10, 0x70, 0x70, 0x40, 0x0c, 0x71, 0x00, 0x00, 0x00, 0x04, 0x00, +0x09, 0x00, 0x3c, 0x24, 0x98, 0x11, 0xe0, 0x00, 0x88, 0x30, 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, +0x10, 0x00, 0x38, 0x26, 0x98, 0x11, 0x00, 0x00, 0x00, 0x02, 0x80, 0x03, 0x50, 0x00, 0x00, 0x43, +0x11, 0x28, 0x01, 0x42, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x18, 0xfa, 0xff, 0x58, +0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x20, 0x01, 0x55, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, +0x05, 0x00, 0x00, 0x00, 0x01, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x01, 0x10, 0x00, 0x68, +0x11, 0x40, 0x04, 0x10, 0x00, 0x20, 0x00, 0x18, 0x05, 0x80, 0x03, 0x80, 0x08, 0x00, 0x84, 0x00, +0x11, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x78, 0xfb, 0xff, 0x58, +0x11, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0xc0, 0xff, 0xff, 0x48, +0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x4c, 0x6f, 0x61, 0x64, 0x65, 0x72, 0x3a, 0x20, 0x25, 0x73, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, +0x6f, 0x6e, 0x3a, 0x20, 0x25, 0x73, 0x0a, 0x00, 0x46, 0x69, 0x72, 0x6d, 0x77, 0x61, 0x72, 0x65, +0x3a, 0x20, 0x25, 0x73, 0x0a, 0x00, 0x00, 0x00, 0x45, 0x74, 0x68, 0x65, 0x72, 0x62, 0x6f, 0x6f, +0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x18, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x42, 0x4f, 0x4f, 0x54, 0x5f, 0x49, 0x4d, 0x41, 0x47, 0x45, 0x3d, 0x68, 0x65, 0x61, 0x64, 0x2e, +0x53, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x6f, 0x6c, 0x65, 0x3d, 0x74, 0x74, 0x79, 0x53, 0x30, 0x20, +0x69, 0x70, 0x3d, 0x64, 0x68, 0x63, 0x70, 0x20, 0x72, 0x6f, 0x6f, 0x74, 0x3d, 0x2f, 0x64, 0x65, +0x76, 0x2f, 0x6e, 0x66, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + diff --git a/util/mkelfImage/linux-ia64/convert.h b/util/mkelfImage/linux-ia64/convert.h new file mode 100644 index 0000000000..ff71385934 --- /dev/null +++ b/util/mkelfImage/linux-ia64/convert.h @@ -0,0 +1,17 @@ +#define CMDLINE_MAX 1024 + +#ifdef ASSEMBLY +#define CONVERT_MAGIC 0xA5A5A5A5A5A5A5A5 +#else +#define CONVERT_MAGIC 0xA5A5A5A5A5A5A5A5ULL +#endif + +#ifndef ASSEMBLY +struct image_parameters { + uint64_t convert_magic; + uint64_t entry; + uint64_t initrd_start; + uint64_t initrd_size; + uint8_t cmdline[CMDLINE_MAX]; +}; +#endif diff --git a/util/mkelfImage/linux-ia64/convert.lds b/util/mkelfImage/linux-ia64/convert.lds new file mode 100644 index 0000000000..c729a5235f --- /dev/null +++ b/util/mkelfImage/linux-ia64/convert.lds @@ -0,0 +1,36 @@ +OUTPUT_FORMAT("elf64-ia64-little") +OUTPUT_ARCH(ia64) + +ENTRY(_start) +SECTIONS { + /* . = 0; */ + . = 0x0000000004400000; + .text : { + _text = . ; + *(.text) + *(.rodaa) + *(.rodata.*) + _etext = . ; + } + . = ALIGN(16); + __gp = . + 0x200000; + .sdata : { + _sdata = . ; + *(.got.plt) + *(.got) + *(.srodata) + *(.sdata) + _esdata = . ; + } + .data : { + _data = . ; + *(.data) + *(.data.*) + *(.trailer) + _edata = . ; + } + /DISCARD/ : { + *(.comment) + *(.note) + } +}
\ No newline at end of file diff --git a/util/mkelfImage/linux-ia64/convert_params.c b/util/mkelfImage/linux-ia64/convert_params.c new file mode 100644 index 0000000000..5022e52c4c --- /dev/null +++ b/util/mkelfImage/linux-ia64/convert_params.c @@ -0,0 +1,334 @@ +#include "stdint.h" +#include "limits.h" +#include <stdarg.h> +#include "elf.h" +#include "elf_boot.h" +#include "convert.h" + + +/* NOTE be very careful with static variables. No relocations are + * being performed so static variables with initialized pointers will + * point to the wrong locations, unless this file is loaded at just + * the right location. + */ +/* Data and functions in head.S */ +extern void uart_tx_byte(int c); + +static void putchar(int c) +{ + if (c == '\n') { + putchar('\r'); + } +#if 0 + uart_tx_byte(c); +#endif +} + +#define LONG_SHIFT ((int)((sizeof(unsigned long)*CHAR_BIT) - 4)) +#define INT_SHIFT ((int)((sizeof(unsigned int)*CHAR_BIT) - 4)) +#define SHRT_SHIFT ((int)((sizeof(unsigned short)*CHAR_BIT) - 4)) +#define CHAR_SHIFT ((int)((sizeof(unsigned char)*CHAR_BIT) - 4)) + +/************************************************************************** +PRINTF and friends + + Formats: + %x - 4 bytes int (8 hex digits, lower case) + %X - 4 bytes int (8 hex digits, upper case) + %lx - 8 bytes long (16 hex digits, lower case) + %lX - 8 bytes long (16 hex digits, upper case) + %hx - 2 bytes int (4 hex digits, lower case) + %hX - 2 bytes int (4 hex digits, upper case) + %hhx - 1 byte int (2 hex digits, lower case) + %hhX - 1 byte int (2 hex digits, upper case) + - optional # prefixes 0x or 0X + %d - decimal int + %c - char + %s - string + Note: width specification not supported +**************************************************************************/ +static void printf(const char *fmt, ...) +{ + va_list args; + char *p; + va_start(args, fmt); + for ( ; *fmt != '\0'; ++fmt) { + if (*fmt != '%') { + putchar(*fmt); + continue; + } + if (*++fmt == 's') { + for(p = va_arg(args, char *); *p != '\0'; p++) + putchar(*p); + } + else { /* Length of item is bounded */ + char tmp[40], *q = tmp; + int shift = INT_SHIFT; + if (*fmt == 'l') { + shift = LONG_SHIFT; + fmt++; + } + else if (*fmt == 'h') { + shift = SHRT_SHIFT; + fmt++; + if (*fmt == 'h') { + shift = CHAR_SHIFT; + fmt++; + } + } + + /* + * Before each format q points to tmp buffer + * After each format q points past end of item + */ + if ((*fmt | 0x20) == 'x') { + /* With x86 gcc, sizeof(long) == sizeof(int) */ + unsigned long h; + int ncase; + if (shift > INT_SHIFT) { + h = va_arg(args, unsigned long); + } else { + h = va_arg(args, unsigned int); + } + ncase = (*fmt & 0x20); + for ( ; shift >= 0; shift -= 4) + *q++ = "0123456789ABCDEF"[(h >> shift) & 0xF] | ncase; + } + else if (*fmt == 'd') { + char *r; + long i; + if (shift > INT_SHIFT) { + i = va_arg(args, long); + } else { + i = va_arg(args, int); + } + if (i < 0) { + *q++ = '-'; + i = -i; + } + p = q; /* save beginning of digits */ + do { + *q++ = '0' + (i % 10); + i /= 10; + } while (i); + /* reverse digits, stop in middle */ + r = q; /* don't alter q */ + while (--r > p) { + i = *r; + *r = *p; + *p++ = i; + } + } + else if (*fmt == 'c') + *q++ = va_arg(args, int); + else + *q++ = *fmt; + /* now output the saved string */ + for (p = tmp; p < q; ++p) + putchar(*p); + } + } + va_end(args); +} + +void *memcpy(void *vdest, void *vsrc, size_t size) +{ + unsigned char *dest = vdest, *src = vsrc; + size_t i; + for(i = 0; i < size; i++) { + *dest++ = *src++; + } + return dest; +} + +int memcmp(void *vs1, void *vs2, size_t size) +{ + unsigned char *s1 =vs1, *s2=vs2; + size_t i; + for(i = 0; i < size; i++, s1++, s2++) { + if (*s1 != *s2) + return *s1 - *s2; + } + return 0; + +} + +void strappend(char *dest, const char *src, size_t max) +{ + size_t len, i; + /* Walk to the end of the destination string */ + for(len = 0; len < max; len++) { + if (dest[len] == '\0') + break; + } + /* Walk through the source string and append it */ + for(i = 0; (i + len) < max; i++) { + if (src[i] == '\0') + break; + dest[len + i] = src[i]; + } + len = len + i; + /* Now null terminate the string */ + if (len >= max) { + len = max -1; + } + dest[len] = '\0'; +} + +static struct ia64_boot_param { + uint64_t command_line; /* physical address of command line arguments */ + uint64_t efi_systab; /* physical address of EFI system table */ + uint64_t efi_memmap; /* physical address of EFI memory map */ + uint64_t efi_memmap_size; /* size of EFI memory map */ + uint64_t efi_memdesc_size; /* size of an EFI memory map descriptor */ + uint32_t efi_memdesc_version; /* memory descriptor version */ + struct { + uint16_t num_cols; /* number of columns on console output device */ + uint16_t num_rows; /* number of rows on console output device */ + uint16_t orig_x; /* cursor's x position */ + uint16_t orig_y; /* cursor's y position */ + } console_info; + uint64_t fpswa; /* physical address of the fpswa interface */ + uint64_t initrd_start; + uint64_t initrd_size; +} bp = { 0, 0, 0, 0, 0, 0, { 80, 24, 0, 0 }, 0, 0, 0 }; + +static void append_command_line(char *arg) +{ + strappend((char *)bp.command_line, " ", CMDLINE_MAX); + strappend((char *)bp.command_line, arg, CMDLINE_MAX); +} + +static void convert_ia64_boot_params(struct ia64_boot_param *orig_bp) +{ + /* Copy the parameters I have no clue about */ + bp.efi_systab = orig_bp->efi_systab; + bp.efi_memmap = orig_bp->efi_memmap; + bp.efi_memmap_size = orig_bp->efi_memmap_size; + bp.efi_memdesc_size = orig_bp->efi_memdesc_size; + bp.efi_memdesc_version = orig_bp->efi_memdesc_version; + bp.console_info.num_cols = orig_bp->console_info.num_cols; + bp.console_info.num_rows = orig_bp->console_info.num_rows; + bp.console_info.orig_x = orig_bp->console_info.orig_x; + bp.console_info.orig_y = orig_bp->console_info.orig_y; + bp.fpswa = orig_bp->fpswa; + /* If a ramdisk was supplied and I didn't original have one, + * use it. + */ + if (orig_bp->initrd_size && (!bp.initrd_size)) { + bp.initrd_start = orig_bp->initrd_start; + bp.initrd_size = orig_bp->initrd_size; + } + /* If a command line was supplied append it */ + if (orig_bp->command_line) { + append_command_line((char *)(orig_bp->command_line)); + } +} + +static void convert_bhdr_params(Elf_Bhdr *bhdr) +{ + unsigned char *note, *end; + char *ldr_name, *ldr_version, *firmware; + + ldr_name = ldr_version = firmware = 0; + + note = ((char *)bhdr) + sizeof(*bhdr); + end = ((char *)bhdr) + bhdr->b_size; + while(note < end) { + Elf_Nhdr *hdr; + unsigned char *n_name, *n_desc, *next; + hdr = (Elf_Nhdr *)note; + n_name = note + sizeof(*hdr); + n_desc = n_name + ((hdr->n_namesz + 3) & ~3); + next = n_desc + ((hdr->n_descsz + 3) & ~3); + if (next > end) + break; +#if 0 + printf("n_type: %x n_name(%d): n_desc(%d): \n", + hdr->n_type, hdr->n_namesz, hdr->n_descsz); +#endif + + if (hdr->n_namesz == 0) { + switch(hdr->n_type) { + case EBN_FIRMWARE_TYPE: + firmware = n_desc; + break; + case EBN_BOOTLOADER_NAME: + ldr_name = n_desc; + break; + case EBN_BOOTLOADER_VERSION: + ldr_version = n_desc; + break; + case EBN_COMMAND_LINE: + append_command_line(n_desc); + break; + } + } + else if ((hdr->n_namesz == 10) && + (memcmp(n_name, "Etherboot", 10) == 0)) { + switch(hdr->n_type) { + case EB_IA64_SYSTAB: + { + uint64_t *systabp = (void *)n_desc; + bp.efi_systab = *systabp; + break; + } + case EB_IA64_FPSWA: + { + uint64_t *fpswap = (void *)n_desc; + bp.fpswa = *fpswap; + break; + } + case EB_IA64_CONINFO: + memcpy(&bp.console_info, n_desc, sizeof(bp.console_info)); + break; + case EB_IA64_MEMMAP: + { + struct efi_mem_map { + uint64_t map_size; + uint64_t map_key; + uint64_t descriptor_size; + uint64_t descriptor_version; + uint8_t map[40]; + } *map = (void *)n_desc; + bp.efi_memmap = (uint64_t)&map->map; + bp.efi_memmap_size = map->map_size; + bp.efi_memdesc_size = map->descriptor_size; + bp.efi_memdesc_version = map->descriptor_version; + break; + } + } + } + note = next; + } + if (ldr_name && ldr_version) { + printf("Loader: %s version: %s\n", + ldr_name, ldr_version); + } + if (firmware) { + printf("Firmware: %s\n", + firmware); + } +} + +void *convert_params(unsigned long arg1, unsigned long r28, + struct image_parameters *params) +{ + struct ia64_boot_param *orig_bp; + Elf_Bhdr *bhdr = (Elf_Bhdr*)arg1; + + /* handle the options I can easily deal with */ + bp.command_line = (unsigned long)¶ms->cmdline; + bp.initrd_start = params->initrd_start; + bp.initrd_size = params->initrd_size; + + orig_bp = (struct ia64_boot_param *)r28; + if (bhdr->b_signature == 0x0E1FB007) { + convert_bhdr_params(bhdr); + } + else { + convert_ia64_boot_params(orig_bp); + } + + return &bp; +} diff --git a/util/mkelfImage/linux-ia64/head.S b/util/mkelfImage/linux-ia64/head.S new file mode 100644 index 0000000000..4a12fb5566 --- /dev/null +++ b/util/mkelfImage/linux-ia64/head.S @@ -0,0 +1,235 @@ +#define ASSEMBLY 1 + + .text + +#include "convert.h" + + .globl _start + .proc _start +_start: + alloc loc0=ar.pfs,1,2,3,0 /* in, local, out, rotating */ + mov loc1=rp + mov r14=ip /* Get the address of _start, I'm in the first bundle */ + movl r15=@gprel(_start) + ;; + sub gp=r14,r15 /* gp = _start - @gprel(_start), current value of gp */ + ;; + mov out0=in0 + mov out1=r28 + add out2=@gprel(params),gp + br.call.sptk.few rp=convert_params + + + mov r28=r8 + add r15=@gprel(entry), gp + ;; + ld8 r16=[r15] + ;; + mov b1=r16 + mov ar.pfs=loc0 + mov rp=loc1 + ;; + br.cond.sptk.few b1 + + .size _start, . - _start + .endp _start + + +#if 0 + +/* Base Address */ +#define UART_BASE 0x00000000f8030000 +#define UART_BAUD 9600 + +/* Data */ +#define UART_RBR 0x00 +#define UART_TBR 0x00 +/* Control */ +#define UART_IER 0x01 +#define UART_IIR 0x02 +#define UART_FCR 0x02 +#define UART_LCR 0x03 +#define UART_MCR 0x04 + +#define UART_DLL 0x00 +#define UART_DLM 0x01 +/* Status */ +#define UART_LSR 0x05 +#define UART_MSR 0x06 +#define UART_SCR 0x07 + +#define UART_PHYS_BASE (0x8000000000000000|UART_BASE) +#define UART_DIV (115200/UART_BAUD) +#define UART_DIV_LO (UART_DIV&0xFF) +#define UART_DIV_HI ((UART_DIV >> 8)&0xFF) + +#if ((115200%UART_BAUD) != 0) +#error Bad uart baud rate +#endif + +/* NOTE: As these are debugging functions, they do not consume any + * space on the register stack, and instead rely entirely on + * scratch registers for the registers they use. + */ +uart_init: + /* set the UART_BASE */ + movl r31=UART_PHYS_BASE + ;; + + /* disable interrupts */ + add r30=UART_IER,r31 + mov r29=0x00 + ;; + st1 [r30]=r29 + + /* enable fifos */ + add r30=UART_FCR,r31 + mov r29=0x01 + ;; + st1 [r30]=r29 + + /* Set Baud Rate Divisor to UART_BAUD */ + add r30=UART_LCR,r31 + mov r29=0x83 + ;; + st1 [r30]=r29 + + add r30=UART_DLL,r31 + mov r29=UART_DIV_LO + ;; + st1 [r30]=r29 + + add r30=UART_DLM,r31 + mov r29=UART_DIV_HI + ;; + st1 [r30]=r29 + + add r30=UART_LCR,r31 + mov r29=0x03 + ;; + st1 [r30]=r29 + + br.ret.sptk.few rp + + .proc uart_tx_byte + .globl uart_tx_byte +uart_tx_byte: + /* set the UART_PHYS_BASE */ + movl r31=UART_PHYS_BASE + ;; +__uart_tx_byte: + /* Wait until the UART can hold another byte */ + add r30=UART_LSR,r31 + ;; +9: ld1.acq.nta r29=[r30] + ;; + and r29=0x20,r29 + ;; + cmp.eq p63,p0=0,r29 +(p63) br.cond.sptk.few 9b + + /* Transmit the byte */ + add r30=UART_TBR,r31 + ;; + st1.rel.nta [r30]=r32 + ;; + + /* Wait until the UART is empty to be certain the byte is flushed */ + add r30=UART_LSR,r31 + ;; +9: ld1.acq.nta r29=[r30] + ;; + and r29=0x40,r29 + ;; + cmp.eq p63,p0=0,r29 +(p63) br.cond.sptk.few 9b + ;; + br.ret.sptk.few rp + .endp uart_tx_byte + +__uart_tx_hex_char: + cmp.ltu p62,p63=9,r32 + ;; +(p63) add r32=48,r32 /* digits*/ +(p62) add r32=55,r32 /* letters */ + br.cond.sptk.few __uart_tx_byte + +uart_tx_hex64: + /* set the UART_bASE */ + movl r31=UART_PHYS_BASE + /* skip r28 */ + mov r27=rp + mov r26=ar.pfs + mov r25=r32 + ;; + extr.u r32=r25,60,4 + br.call.sptk.few rp=__uart_tx_hex_char + ;; + extr.u r32=r25,56,4 + br.call.sptk.few rp=__uart_tx_hex_char + ;; + extr.u r32=r25,52,4 + br.call.sptk.few rp=__uart_tx_hex_char + ;; + extr.u r32=r25,48,4 + br.call.sptk.few rp=__uart_tx_hex_char + ;; + extr.u r32=r25,44,4 + br.call.sptk.few rp=__uart_tx_hex_char + ;; + extr.u r32=r25,40,4 + br.call.sptk.few rp=__uart_tx_hex_char + ;; + extr.u r32=r25,36,4 + br.call.sptk.few rp=__uart_tx_hex_char + ;; + extr.u r32=r25,32,4 + br.call.sptk.few rp=__uart_tx_hex_char + ;; + extr.u r32=r25,28,4 + br.call.sptk.few rp=__uart_tx_hex_char + ;; + extr.u r32=r25,24,4 + br.call.sptk.few rp=__uart_tx_hex_char + ;; + extr.u r32=r25,20,4 + br.call.sptk.few rp=__uart_tx_hex_char + ;; + extr.u r32=r25,16,4 + br.call.sptk.few rp=__uart_tx_hex_char + ;; + extr.u r32=r25,12,4 + br.call.sptk.few rp=__uart_tx_hex_char + ;; + extr.u r32=r25,8,4 + br.call.sptk.few rp=__uart_tx_hex_char + ;; + extr.u r32=r25,4,4 + br.call.sptk.few rp=__uart_tx_hex_char + ;; + extr.u r32=r25,0,4 + br.call.sptk.few rp=__uart_tx_hex_char + ;; + mov ar.pfs = r26 + mov rp = r27 + ;; + br.ret.sptk.few rp +#endif + + .section ".trailer", "a" + /* Constants set at build time, these are at the very end of my image */ + .balign 16 + .global params +params: +convert_magic: + .quad CONVERT_MAGIC +entry: + .quad 0 +initrd_start: + .quad 0 +initrd_size: + .quad 0 +cmdline: + .asciz "BOOT_IMAGE=head.S console=ttyS0 ip=dhcp root=/dev/nfs" + .org cmdline + 1024, 0 +cmdline_end: diff --git a/util/mkelfImage/linux-ia64/mkelf-linux-ia64.c b/util/mkelfImage/linux-ia64/mkelf-linux-ia64.c new file mode 100644 index 0000000000..82f57be79f --- /dev/null +++ b/util/mkelfImage/linux-ia64/mkelf-linux-ia64.c @@ -0,0 +1,272 @@ +#include <stdio.h> +#include <errno.h> +#include <stdlib.h> +#include <stdint.h> +#include <string.h> +#define _GNU_SOURCE +#include <getopt.h> +#include "elf.h" +#include "elf_boot.h" +#include "convert.h" +#include "mkelfImage.h" + +static unsigned char payload[] = { +#include "convert.bin.c" +}; + +char *linux_ia64_probe(char *kernel_buf, off_t kernel_size) +{ + Elf64_Ehdr *ehdr; + Elf64_Phdr *phdr; + int i; + int phdrs; + ehdr = (Elf64_Ehdr *)kernel_buf; + if ( + (ehdr->e_ident[EI_MAG0] != ELFMAG0) || + (ehdr->e_ident[EI_MAG1] != ELFMAG1) || + (ehdr->e_ident[EI_MAG2] != ELFMAG2) || + (ehdr->e_ident[EI_MAG3] != ELFMAG3)) { + return "No ELF signature found on kernel\n"; + } + if (ehdr->e_ident[EI_CLASS] != ELFCLASS64) { + return "Not a 64bit ELF kernel\n"; + } + if (ehdr->e_ident[EI_DATA] != ELFDATA2LSB) { + return "Not a little endian ELF kernel\n"; + } + if (le16_to_cpu(ehdr->e_type) != ET_EXEC) { + return "Not an executable kernel\n"; + } + if (le16_to_cpu(ehdr->e_machine) != EM_IA_64) { + return "Not an ia64 kernel\n"; + } + if ( (ehdr->e_ident[EI_VERSION] != EV_CURRENT) || + (le32_to_cpu(ehdr->e_version) != EV_CURRENT)) { + return "Kernel not using ELF version 1.\n"; + } + if (le16_to_cpu(ehdr->e_phentsize) != sizeof(*phdr)) { + return "Kernel uses bad program header size.\n"; + } + phdr = (Elf64_Phdr *)(kernel_buf + le64_to_cpu(ehdr->e_phoff)); + phdrs = 0; + for(i = 0; i < le16_to_cpu(ehdr->e_phnum); i++) { + if (le32_to_cpu(phdr[i].p_type) != PT_LOAD) + continue; + phdrs++; + } + if (phdrs == 0) { + return "No PT_LOAD segments!\n"; + } + return 0; +} + +struct kernel_info +{ + int phdrs; + char *kernel_buf; + Elf64_Ehdr *ehdr; + Elf64_Phdr *phdr; + uint64_t entry; + char *version; +}; + +static void parse_kernel(struct kernel_info *info, + char *kernel_buf, size_t kernel_size) +{ + Elf64_Ehdr *ehdr; + Elf64_Phdr *phdr; + int i; + int phdrs; + ehdr = (Elf64_Ehdr *)kernel_buf; + phdr = (Elf64_Phdr *)(kernel_buf + le64_to_cpu(ehdr->e_phoff)); + phdrs = 0; + for(i = 0; i < le16_to_cpu(ehdr->e_phnum); i++) { + if (le16_to_cpu(phdr[i].p_type) != PT_LOAD) + continue; + phdrs++; + } + if (phdrs == 0) { + die("No PT_LOAD segments!\n"); + } + info->kernel_buf = kernel_buf; + info->ehdr = ehdr; + info->phdrs = phdrs; + info->phdr = phdr; + info->entry = le64_to_cpu(ehdr->e_entry); + info->version = "unknown"; +} + +static int populate_kernel_phdrs(struct kernel_info *info, struct memelfphdr *phdr) +{ + uint64_t paddr; + int i; + paddr = 0; + for(i = 0; i < info->phdrs; i++) { + Elf64_Phdr *hdr; + int j; + hdr = 0; + for(j = 0; j < le16_to_cpu(info->ehdr->e_phnum); j++) { + if (le16_to_cpu(info->phdr[j].p_type != PT_LOAD)) { + continue; + } + if (paddr > le64_to_cpu(info->phdr[j].p_paddr)) { + continue; + } + if (hdr && + le64_to_cpu(hdr->p_paddr) < + le64_to_cpu(info->phdr[j].p_paddr)) { + continue; + } + hdr = info->phdr + j; + } + if (!hdr) { + die("Expected %d phdrs found %d!", info->phdrs, i); + } + phdr[i].p_paddr = le64_to_cpu(hdr->p_paddr); + phdr[i].p_vaddr = le64_to_cpu(hdr->p_vaddr); + phdr[i].p_filesz = le64_to_cpu(hdr->p_filesz); + phdr[i].p_memsz = le64_to_cpu(hdr->p_memsz); + phdr[i].p_data = info->kernel_buf + le64_to_cpu(hdr->p_offset); + paddr = phdr[i].p_paddr + phdr[i].p_memsz; + } + return i; +} + + +void linux_ia64_usage(void) +{ + printf( + " --command-line=<string> Set the command line to <string>\n" + " --append=<string> Set the command line to <string>\n" + " --initrd=<filename> Set the initrd to <filename>\n" + " --ramdisk=<filename> Set the initrd to <filename>\n" + ); + return; +} + +#define OPT_CMDLINE OPT_MAX+0 +#define OPT_RAMDISK OPT_MAX+1 + +int linux_ia64_mkelf(int argc, char **argv, + struct memelfheader *ehdr, char *kernel_buf, off_t kernel_size) +{ + const char *ramdisk, *cmdline; + char *payload_buf, *ramdisk_buf; + off_t payload_size, ramdisk_size; + struct memelfphdr *phdr; + struct memelfnote *note; + struct kernel_info kinfo; + struct image_parameters *params; + int index; + + int opt; + static const struct option options[] = { + MKELF_OPTIONS + { "command-line", 1, 0, OPT_CMDLINE }, + { "append", 1, 0, OPT_CMDLINE }, + { "initrd", 1, 0, OPT_RAMDISK }, + { "ramdisk", 1, 0, OPT_RAMDISK }, + { 0 , 0, 0, 0 }, + }; + static const char short_options[] = "HV"; + + ramdisk = 0; + cmdline=""; + + while((opt = getopt_long(argc, argv, short_options, options, 0)) != -1) { + switch(opt) { + case '?': + error("Unknown option %s\n", argv[optind]); + break; + case OPT_RAMDISK: + ramdisk = optarg; + break; + case OPT_CMDLINE: + cmdline = optarg; + break; + default: + break; + } + } + ehdr->ei_class = ELFCLASS64; + ehdr->ei_data = ELFDATA2LSB; + ehdr->e_type = ET_EXEC; + ehdr->e_machine = EM_IA_64; + + /* locate the payload buffer */ + payload_buf = payload; + payload_size = sizeof(payload); + + /* slurp the input files */ + ramdisk_buf = slurp_file(ramdisk, &ramdisk_size); + + /* parse the kernel */ + parse_kernel(&kinfo, kernel_buf, kernel_size); + + /* Find the parameters */ + params = (void *)(payload_buf + (payload_size - sizeof(*params))); + + /* A sanity check against bad versions of binutils */ + if (params->convert_magic != CONVERT_MAGIC) { + die("Internal error convert_magic %16llx != %16llx\n", + (unsigned long long)(params->convert_magic), CONVERT_MAGIC); + } + + /* Copy the command line */ + strncpy(params->cmdline, cmdline, sizeof(params->cmdline)); + params->cmdline[sizeof(params->cmdline)-1]= '\0'; + + /* Add a program header for the note section */ + phdr = add_program_headers(ehdr, 2 + kinfo.phdrs + (ramdisk_size?1:0)); + + /* Fill in the program headers*/ + phdr[0].p_type = PT_NOTE; + + /* Fill in the kernel program headers */ + index = 1 + populate_kernel_phdrs(&kinfo, phdr + 1); + + /* Fill in the converter program header */ + phdr[index].p_paddr = roundup(phdr[index -1].p_paddr + phdr[index -1].p_memsz, 16); + phdr[index].p_vaddr = phdr[index].p_paddr; + phdr[index].p_filesz = payload_size; + phdr[index].p_memsz = payload_size; + phdr[index].p_data = payload_buf; + index++; + + /* Set the start location */ + params->entry = kinfo.entry; + ehdr->e_entry = phdr[index -1].p_paddr; + + + /* Fill in the ramdisk program header */ + params->initrd_start = params->initrd_size = 0; + if (ramdisk_size) { + phdr[index].p_paddr = roundup(phdr[index -1].p_paddr + phdr[index -1].p_memsz, 16); + phdr[index].p_vaddr = phdr[index].p_paddr; + phdr[index].p_filesz = ramdisk_size; + phdr[index].p_memsz = ramdisk_size; + phdr[index].p_data = ramdisk_buf; + params->initrd_start = phdr[index].p_paddr; + params->initrd_size = phdr[index].p_filesz; + index++; + } + + /* Compute the elf notes */ + note = add_notes(ehdr, 3); + note[0].n_type = EIN_PROGRAM_NAME; + note[0].n_name = "ELFBoot"; + note[0].n_desc = "Linux"; + note[0].n_descsz = strlen(note[0].n_desc)+1; + + note[1].n_type = EIN_PROGRAM_VERSION; + note[1].n_name = "ELFBoot"; + note[1].n_desc = kinfo.version; + note[1].n_descsz = strlen(note[1].n_desc)+1; + + note[2].n_type = EIN_PROGRAM_CHECKSUM; + note[2].n_name = "ELFBoot"; + note[2].n_desc = 0; + note[2].n_descsz = 2; + + return 0; +} diff --git a/util/mkelfImage/main/Makefile b/util/mkelfImage/main/Makefile new file mode 100644 index 0000000000..403b0a4245 --- /dev/null +++ b/util/mkelfImage/main/Makefile @@ -0,0 +1,18 @@ +MKELF_OBJS=$(OBJDIR)/main/mkelfImage.o \ + $(OBJDIR)/linux-i386/mkelf-linux-i386.o \ + $(OBJDIR)/linux-ia64/mkelf-linux-ia64.o + +$(OBJDIR)/sbin/mkelfImage: $(MKELF_OBJS) $(DEPS) + $(MKDIR) -p $(@D) + $(HOST_CC) $(HOST_CFLAGS) $(MKELF_OBJS) -o $@ $(LIBS) + +$(OBJDIR)/main/mkelfImage.o: main/mkelfImage.c include/mkelfImage.h $(DEPS) + $(MKDIR) -p $(@D) + $(HOST_CC) $(HOST_CFLAGS) -c $< -o $@ + +$(OBJDIR)/man/man8/mkelfImage.8: main/mkelfImage.man + $(MKDIR) -p $(@D) + $(SED) \ + -e 's,^.TH MKELFIMAGE 8 "RELEASE_DATE" "VERSION"$$,.TH MKELFIMAGE 8 "$(RELEASE_DATE)" "$(VERSION)",' \ + $< > $@ + $(CP) $< $@ diff --git a/util/mkelfImage/main/mkelfImage.c b/util/mkelfImage/main/mkelfImage.c new file mode 100644 index 0000000000..bb318b3f37 --- /dev/null +++ b/util/mkelfImage/main/mkelfImage.c @@ -0,0 +1,663 @@ +#include <stdarg.h> +#include <errno.h> +#include <string.h> +#include <stdint.h> +#include <stdlib.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <unistd.h> +#include <stdio.h> +#include <getopt.h> +#ifdef HAVE_ZLIB_H +#include <zlib.h> +#endif +#include "elf.h" +#include "elf_boot.h" +#include "mkelfImage.h" + +static struct file_type file_type[] = { + { "linux-i386", linux_i386_probe, linux_i386_mkelf, linux_i386_usage }, + { "bzImage-i386", bzImage_i386_probe, linux_i386_mkelf, linux_i386_usage }, + { "vmlinux-i386", vmlinux_i386_probe, linux_i386_mkelf, linux_i386_usage }, + { "linux-ia64", linux_ia64_probe, linux_ia64_mkelf, linux_ia64_usage }, +}; +static const int file_types = sizeof(file_type)/sizeof(file_type[0]); + +void die(char *fmt, ...) +{ + va_list args; + va_start(args, fmt); + vfprintf(stderr, fmt, args); + va_end(args); + exit(1); +} + + + +/************************************************************************** +IPCHKSUM - Checksum IP Header +**************************************************************************/ +uint16_t ipchksum(const void *data, unsigned long length) +{ + unsigned long sum; + unsigned long i; + const uint8_t *ptr; + + /* In the most straight forward way possible, + * compute an ip style checksum. + */ + sum = 0; + ptr = data; + for(i = 0; i < length; i++) { + unsigned long value; + value = ptr[i]; + if (i & 1) { + value <<= 8; + } + /* Add the new value */ + sum += value; + /* Wrap around the carry */ + if (sum > 0xFFFF) { + sum = (sum + (sum >> 16)) & 0xFFFF; + } + } + return (~cpu_to_le16(sum)) & 0xFFFF; +} + +uint16_t add_ipchksums(unsigned long offset, uint16_t sum, uint16_t new) +{ + unsigned long checksum; + sum = ~sum & 0xFFFF; + new = ~new & 0xFFFF; + if (offset & 1) { + /* byte swap the sum if it came from an odd offset + * since the computation is endian independant this + * works. + */ + new = bswap_16(new); + } + checksum = sum + new; + if (checksum > 0xFFFF) { + checksum -= 0xFFFF; + } + return (~checksum) & 0xFFFF; +} + +void *xmalloc(size_t size, const char *name) +{ + void *buf; + buf = malloc(size); + if (!buf) { + die("Cannot malloc %ld bytes to hold %s: %s\n", + size + 0UL, name, strerror(errno)); + } + return buf; +} + +void *xrealloc(void *ptr, size_t size, const char *name) +{ + void *buf; + buf = realloc(ptr, size); + if (!buf) { + die("Cannot realloc %ld bytes to hold %s: %s\n", + size + 0UL, name, strerror(errno)); + } + return buf; +} + + +char *slurp_file(const char *filename, off_t *r_size) +{ + int fd; + char *buf; + off_t size, progress; + ssize_t result; + struct stat stats; + + + if (!filename) { + *r_size = 0; + return 0; + } + fd = open(filename, O_RDONLY); + if (fd < 0) { + die("Cannot open `%s': %s\n", + filename, strerror(errno)); + } + result = fstat(fd, &stats); + if (result < 0) { + die("Cannot stat: %s: %s\n", + filename, strerror(errno)); + } + size = stats.st_size; + *r_size = size; + buf = xmalloc(size, filename); + progress = 0; + while(progress < size) { + result = read(fd, buf + progress, size - progress); + if (result < 0) { + if ((errno == EINTR) || (errno == EAGAIN)) + continue; + die("read on %s of %ld bytes failed: %s\n", + filename, (size - progress)+ 0UL, strerror(errno)); + } + progress += result; + } + result = close(fd); + if (result < 0) { + die("Close of %s failed: %s\n", + filename, strerror(errno)); + } + return buf; +} + +#if HAVE_ZLIB_H +char *slurp_decompress_file(const char *filename, off_t *r_size) +{ + gzFile fp; + int errnum; + const char *msg; + char *buf; + off_t size, allocated; + ssize_t result; + + if (!filename) { + *r_size = 0; + return 0; + } + fp = gzopen(filename, "rb"); + if (fp == 0) { + msg = gzerror(fp, &errnum); + if (errnum == Z_ERRNO) { + msg = strerror(errno); + } + die("Cannot open `%s': %s\n", filename, msg); + } + size = 0; + allocated = 65536; + buf = xmalloc(allocated, filename); + do { + if (size == allocated) { + allocated <<= 1; + buf = xrealloc(buf, allocated, filename); + } + result = gzread(fp, buf + size, allocated - size); + if (result < 0) { + if ((errno == EINTR) || (errno == EAGAIN)) + continue; + + msg = gzerror(fp, &errnum); + if (errnum == Z_ERRNO) { + msg = strerror(errno); + } + die ("read on %s of %ld bytes failed: %s\n", + filename, (allocated - size) + 0UL, msg); + } + size += result; + } while(result > 0); + result = gzclose(fp); + if (result != Z_OK) { + msg = gzerror(fp, &errnum); + if (errnum == Z_ERRNO) { + msg = strerror(errno); + } + die ("Close of %s failed: %s\n", filename, msg); + } + *r_size = size; + return buf; +} +#else +char *slurp_decompress_file(const char *filename, off_t *r_size) +{ + return slurp_file(filename, r_size); +} +#endif + +struct memelfphdr *add_program_headers(struct memelfheader *ehdr, int count) +{ + struct memelfphdr *phdr; + int i; + ehdr->e_phnum = count; + ehdr->e_phdr = phdr = xmalloc(count *sizeof(*phdr), "Program headers"); + /* Set the default values */ + for(i = 0; i < count; i++) { + phdr[i].p_type = PT_LOAD; + phdr[i].p_flags = PF_R | PF_W | PF_X; + phdr[i].p_vaddr = 0; + phdr[i].p_paddr = 0; + phdr[i].p_filesz = 0; + phdr[i].p_memsz = 0; + phdr[i].p_data = 0; + } + return phdr; +} + +struct memelfnote *add_notes(struct memelfheader *ehdr, int count) +{ + struct memelfnote *notes; + ehdr->e_notenum = count; + ehdr->e_notes = notes = xmalloc(count *sizeof(*notes), "Notes"); + memset(notes, 0, count *sizeof(*notes)); + return notes; +} + +static int sizeof_notes(struct memelfnote *note, int notes) +{ + int size; + int i; + + size = 0; + for(i = 0; i < notes; i++) { + size += sizeof(Elf_Nhdr); + size += roundup(strlen(note[i].n_name)+1, 4); + size += roundup(note[i].n_descsz, 4); + } + return size; +} + +static uint16_t cpu_to_elf16(struct memelfheader *ehdr, uint16_t val) +{ + if (ehdr->ei_data == ELFDATA2LSB) { + return cpu_to_le16(val); + } + else if (ehdr->ei_data == ELFDATA2MSB) { + return cpu_to_be16(val); + } + die("Uknown elf layout in cpu_to_elf16"); + return 0; +} + +static uint32_t cpu_to_elf32(struct memelfheader *ehdr, uint32_t val) +{ + if (ehdr->ei_data == ELFDATA2LSB) { + return cpu_to_le32(val); + } + else if (ehdr->ei_data == ELFDATA2MSB) { + return cpu_to_be32(val); + } + die("Uknown elf layout in cpu_to_elf32"); + return 0; +} + +static uint64_t cpu_to_elf64(struct memelfheader *ehdr, uint64_t val) +{ + if (ehdr->ei_data == ELFDATA2LSB) { + return cpu_to_le64(val); + } + else if (ehdr->ei_data == ELFDATA2MSB) { + return cpu_to_be64(val); + } + die("Uknown elf layout in cpu_to_elf64"); + return 0; +} + +static void serialize_notes(char *buf, struct memelfheader *ehdr) +{ + struct Elf_Nhdr hdr; + struct memelfnote *note; + int notes; + size_t size, offset; + int i; + + /* Clear the buffer */ + note = ehdr->e_notes; + notes = ehdr->e_notenum; + size = sizeof_notes(note, notes); + memset(buf, 0, size); + + /* Write the Elf Notes */ + offset = 0; + for(i = 0; i < notes; i++) { + /* Compute the note header */ + size_t n_namesz; + n_namesz = strlen(note[i].n_name) +1; + hdr.n_namesz = cpu_to_elf32(ehdr, n_namesz); + hdr.n_descsz = cpu_to_elf32(ehdr, note[i].n_descsz); + hdr.n_type = cpu_to_elf32(ehdr, note[i].n_type); + + /* Copy the note into the buffer */ + memcpy(buf + offset, &hdr, sizeof(hdr)); + offset += sizeof(hdr); + memcpy(buf + offset, note[i].n_name, n_namesz); + offset += roundup(n_namesz, 4); + memcpy(buf + offset, note[i].n_desc, note[i].n_descsz); + offset += roundup(note[i].n_descsz, 4); + + } +} +static void serialize_ehdr(char *buf, struct memelfheader *ehdr) +{ + if (ehdr->ei_class == ELFCLASS32) { + Elf32_Ehdr *hdr = (Elf32_Ehdr *)buf; + hdr->e_ident[EI_MAG0] = ELFMAG0; + hdr->e_ident[EI_MAG1] = ELFMAG1; + hdr->e_ident[EI_MAG2] = ELFMAG2; + hdr->e_ident[EI_MAG3] = ELFMAG3; + hdr->e_ident[EI_CLASS] = ehdr->ei_class; + hdr->e_ident[EI_DATA] = ehdr->ei_data; + hdr->e_ident[EI_VERSION] = EV_CURRENT; + hdr->e_type = cpu_to_elf16(ehdr, ehdr->e_type); + hdr->e_machine = cpu_to_elf16(ehdr, ehdr->e_machine); + hdr->e_version = cpu_to_elf32(ehdr, EV_CURRENT); + hdr->e_entry = cpu_to_elf32(ehdr, ehdr->e_entry); + hdr->e_phoff = cpu_to_elf32(ehdr, sizeof(*hdr)); + hdr->e_shoff = cpu_to_elf32(ehdr, 0); + hdr->e_flags = cpu_to_elf32(ehdr, ehdr->e_flags); + hdr->e_ehsize = cpu_to_elf16(ehdr, sizeof(*hdr)); + hdr->e_phentsize = cpu_to_elf16(ehdr, sizeof(Elf32_Phdr)); + hdr->e_phnum = cpu_to_elf16(ehdr, ehdr->e_phnum); + hdr->e_shentsize = cpu_to_elf16(ehdr, 0); + hdr->e_shnum = cpu_to_elf16(ehdr, 0); + hdr->e_shstrndx = cpu_to_elf16(ehdr, 0); + } + else if (ehdr->ei_class == ELFCLASS64) { + Elf64_Ehdr *hdr = (Elf64_Ehdr *)buf; + hdr->e_ident[EI_MAG0] = ELFMAG0; + hdr->e_ident[EI_MAG1] = ELFMAG1; + hdr->e_ident[EI_MAG2] = ELFMAG2; + hdr->e_ident[EI_MAG3] = ELFMAG3; + hdr->e_ident[EI_CLASS] = ehdr->ei_class; + hdr->e_ident[EI_DATA] = ehdr->ei_data; + hdr->e_ident[EI_VERSION] = EV_CURRENT; + hdr->e_type = cpu_to_elf16(ehdr, ehdr->e_type); + hdr->e_machine = cpu_to_elf16(ehdr, ehdr->e_machine); + hdr->e_version = cpu_to_elf32(ehdr, EV_CURRENT); + hdr->e_entry = cpu_to_elf64(ehdr, ehdr->e_entry); + hdr->e_phoff = cpu_to_elf64(ehdr, sizeof(*hdr)); + hdr->e_shoff = cpu_to_elf64(ehdr, 0); + hdr->e_flags = cpu_to_elf32(ehdr, ehdr->e_flags); + hdr->e_ehsize = cpu_to_elf16(ehdr, sizeof(*hdr)); + hdr->e_phentsize = cpu_to_elf16(ehdr, sizeof(Elf64_Phdr)); + hdr->e_phnum = cpu_to_elf16(ehdr, ehdr->e_phnum); + hdr->e_shentsize = cpu_to_elf16(ehdr, 0); + hdr->e_shnum = cpu_to_elf16(ehdr, 0); + hdr->e_shstrndx = cpu_to_elf16(ehdr, 0); + } + else die("Uknown elf class: %x\n", ehdr->ei_class); +} +static void serialize_phdrs(char *buf, struct memelfheader *ehdr, size_t note_size) +{ + int i; + size_t offset, note_offset; + if (ehdr->ei_class == ELFCLASS32) { + Elf32_Phdr *phdr = (Elf32_Phdr *)buf; + note_offset = + sizeof(Elf32_Ehdr) + (sizeof(Elf32_Phdr)*ehdr->e_phnum); + offset = note_offset + note_size; + for(i = 0; i < ehdr->e_phnum; i++) { + struct memelfphdr *hdr = ehdr->e_phdr + i; + phdr[i].p_type = cpu_to_elf32(ehdr, hdr->p_type); + phdr[i].p_offset = cpu_to_elf32(ehdr, offset); + phdr[i].p_vaddr = cpu_to_elf32(ehdr, hdr->p_vaddr); + phdr[i].p_paddr = cpu_to_elf32(ehdr, hdr->p_paddr); + phdr[i].p_filesz = cpu_to_elf32(ehdr, hdr->p_filesz); + phdr[i].p_memsz = cpu_to_elf32(ehdr, hdr->p_memsz); + phdr[i].p_flags = cpu_to_elf32(ehdr, hdr->p_flags); + phdr[i].p_align = cpu_to_elf32(ehdr, 0); + if (phdr[i].p_type == PT_NOTE) { + phdr[i].p_filesz = cpu_to_elf32(ehdr, note_size); + phdr[i].p_memsz = cpu_to_elf32(ehdr, note_size); + phdr[i].p_offset = cpu_to_elf32(ehdr, note_offset); + } else { + offset += hdr->p_filesz; + } + } + } + else if (ehdr->ei_class == ELFCLASS64) { + Elf64_Phdr *phdr = (Elf64_Phdr *)buf; + note_offset = + sizeof(Elf64_Ehdr) + (sizeof(Elf64_Phdr)*ehdr->e_phnum); + offset = note_offset + note_size; + for(i = 0; i < ehdr->e_phnum; i++) { + struct memelfphdr *hdr = ehdr->e_phdr + i; + phdr[i].p_type = cpu_to_elf32(ehdr, hdr->p_type); + phdr[i].p_flags = cpu_to_elf32(ehdr, hdr->p_flags); + phdr[i].p_offset = cpu_to_elf64(ehdr, offset); + phdr[i].p_vaddr = cpu_to_elf64(ehdr, hdr->p_vaddr); + phdr[i].p_paddr = cpu_to_elf64(ehdr, hdr->p_paddr); + phdr[i].p_filesz = cpu_to_elf64(ehdr, hdr->p_filesz); + phdr[i].p_memsz = cpu_to_elf64(ehdr, hdr->p_memsz); + phdr[i].p_align = cpu_to_elf64(ehdr, 0); + if (phdr[i].p_type == PT_NOTE) { + phdr[i].p_filesz = cpu_to_elf64(ehdr, note_size); + phdr[i].p_memsz = cpu_to_elf64(ehdr, note_size); + phdr[i].p_offset = cpu_to_elf64(ehdr, note_offset); + } else { + offset += hdr->p_filesz; + } + } + } + else { + die("Unknwon elf class: %x\n", ehdr->ei_class); + } +} + +static void write_buf(int fd, char *buf, size_t size) +{ + size_t progress = 0; + ssize_t result; + while(progress < size) { + result = write(fd, buf + progress, size - progress); + if (result < 0) { + if ((errno == EAGAIN) || (errno == EINTR)) { + continue; + } + die ("write of %ld bytes failed: %s\n", + size - progress, strerror(errno)); + } + progress += result; + } +} +static void write_elf(struct memelfheader *ehdr, char *output) +{ + size_t ehdr_size; + size_t phdr_size; + size_t note_size; + size_t size; + uint16_t checksum; + size_t bytes; + char *buf; + int result, fd; + int i; + /* Prep for adding the checksum */ + for(i = 0; i < ehdr->e_notenum; i++) { + if ((memcmp(ehdr->e_notes[i].n_name, "ELFBoot", 8) == 0) && + (ehdr->e_notes[i].n_type == EIN_PROGRAM_CHECKSUM)) { + ehdr->e_notes[i].n_desc = &checksum; + ehdr->e_notes[i].n_descsz = 2; + } + } + /* Compute the sizes */ + ehdr_size = 0; + phdr_size = 0; + note_size = 0; + if (ehdr->e_notenum) { + note_size = sizeof_notes(ehdr->e_notes, ehdr->e_notenum); + } + if (ehdr->ei_class == ELFCLASS32) { + ehdr_size = sizeof(Elf32_Ehdr); + phdr_size = sizeof(Elf32_Phdr) * ehdr->e_phnum; + } + else if (ehdr->ei_class == ELFCLASS64) { + ehdr_size = sizeof(Elf64_Ehdr); + phdr_size = sizeof(Elf64_Phdr) * ehdr->e_phnum; + } + else { + die("Unknown elf class: %x\n", ehdr->ei_class); + } + + /* Allocate a buffer to temporarily hold the serialized forms */ + size = ehdr_size + phdr_size + note_size; + buf = xmalloc(size, "Elf Headers"); + memset(buf, 0, size); + serialize_ehdr(buf, ehdr); + serialize_phdrs(buf + ehdr_size, ehdr, note_size); + + /* Compute the checksum... */ + checksum = ipchksum(buf, ehdr_size + phdr_size); + bytes = ehdr_size + phdr_size; + for(i = 0; i < ehdr->e_phnum; i++) { + checksum = add_ipchksums(bytes, checksum, + ipchksum(ehdr->e_phdr[i].p_data, ehdr->e_phdr[i].p_filesz)); + bytes += ehdr->e_phdr[i].p_memsz; + } + + /* Compute the final form of the notes */ + serialize_notes(buf + ehdr_size + phdr_size, ehdr); + + /* Now write the elf image */ + fd = open(output, O_WRONLY | O_CREAT | O_EXCL, S_IRUSR | S_IRGRP | S_IROTH); + if (fd < 0) { + die("Cannot open ``%s'':%s\n", + output, strerror(errno)); + } + write_buf(fd, buf, size); + for(i = 0; i < ehdr->e_phnum; i++) { + write_buf(fd, ehdr->e_phdr[i].p_data, ehdr->e_phdr[i].p_filesz); + } + result = close(fd); + if (result < 0) { + die("Close on %s failed: %s\n", + output, strerror(errno)); + } +} + +static void version(void) +{ + printf("mkelfImage " VERSION " released " RELEASE_DATE "\n"); +} +void usage(void) +{ + int i; + version(); + printf( + "Usage: mkelfImage [OPTION]... <kernel> <elf_kernel>\n" + "Build an ELF bootable kernel image from a normal kernel image\n" + "\n" + " -h, --help Print this help.\n" + " -v, --version Print the version of kexec.\n" + " --kernel=<filename> Set the kernel to <filename>\n" + " --output=<filename> Output to <filename>\n" + " -t, --type=TYPE Specify the new kernel is of <type>.\n" + "\n" + "Supported kernel types: \n" + ); + for(i = 0; i < file_types; i++) { + printf("%s\n", file_type[i].name); + file_type[i].usage(); + } + printf("\n"); +} + +void error(char *fmt, ...) +{ + va_list args; + va_start(args, fmt); + vfprintf(stderr, fmt, args); + va_end(args); + usage(); + exit(1); +} + +int main(int argc, char **argv) +{ + int opt; + int fileind; + char *type, *kernel, *output; + off_t kernel_size; + char *kernel_buf; + int result; + int i; + struct memelfheader hdr; + + static const struct option options[] = { + MKELF_OPTIONS + { 0, 0, 0, 0 }, + }; + static const char short_options[] = MKELF_OPT_STR; + + memset(&hdr, 0, sizeof(hdr)); + kernel = 0; + output = 0; + + /* Get the default type from the program name */ + type = strrchr(argv[0], '/'); + if (!type) type = argv[0]; + if (memcmp(type, "mkelf-", 6) == 0) { + type = type + 6; + } else { + type = 0; + } + opterr = 0; /* Don't complain about unrecognized options here */ + while ((opt = getopt_long(argc, argv, short_options, options, 0)) != -1) { + switch(opt) { + case OPT_HELP: + usage(); + return 0; + case OPT_VERSION: + version(); + return 0; + case OPT_KERNEL: + kernel = optarg; + break; + case OPT_OUTPUT: + output = optarg; + break; + case OPT_TYPE: + type = optarg; + break; + default: + break; + } + } + fileind = optind; + + /* Reset getopt for the next pass */ + opterr = 1; + optind = 1; + + if (argc - fileind > 0) { + kernel = argv[fileind++]; + } + if (argc - fileind > 0) { + output = argv[fileind++]; + } + if (!kernel) { + error("No kernel specified!\n"); + } + if (!output) { + error("No output file specified!\n"); + } + if (argc - fileind > 0) { + error("%d extra options specified!\n", argc - fileind); + } + + /* slurp in the input kernel */ + kernel_buf = slurp_decompress_file(kernel, &kernel_size); + + /* Find/verify the kernel type */ + for(i = 0; i < file_types; i++) { + char *reason; + if (type && (strcmp(type, file_type[i].name) != 0)) { + continue; + } + reason = file_type[i].probe(kernel_buf, kernel_size); + if (reason == 0) { + break; + } + if (type) { + die("Not %s: %s\n", type, reason); + } + } + if (i == file_types) { + die("Can not determine the file type of %s\n", kernel); + } + result = file_type[i].mkelf(argc, argv, &hdr, kernel_buf, kernel_size); + if (result < 0) { + die("Cannot create %s result: %d\n", output, result); + } + /* open the output file */ + write_elf(&hdr, output); + return 0; +} diff --git a/util/mkelfImage/main/mkelfImage.man b/util/mkelfImage/main/mkelfImage.man new file mode 100644 index 0000000000..f3f50d56d0 --- /dev/null +++ b/util/mkelfImage/main/mkelfImage.man @@ -0,0 +1,166 @@ +.\" Automatically generated by Pod::Man v1.3, Pod::Parser v1.13 +.\" But now manually maintained +.\" +.\" Standard preamble: +.\" ======================================================================== +.de Sh \" Subsection heading +.br +.if t .Sp +.ne 5 +.PP +\fB\\$1\fR +.PP +.. +.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. | will give a +.\" real vertical bar. \*(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-|\(bv\*(Tr +.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\} +.\" +.\" If the F register is turned on, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. nr % 0 +. rr F +.\} +.\" +.\" For nroff, turn off justification. Always turn off hyphenation; it makes +.\" way too many mistakes in technical documents. +.hy 0 +.if n .na +.\" +.\" 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 "MKELFIMAGE 8" +.TH MKELFIMAGE 8 "RELEASE_DATE" "VERSION" +.UC +.SH "NAME" +mkelfImage \- make an elf network bootable image for linux +.SH "SYNOPSIS" +.IX Header "SYNOPSIS" +\&\fBmkelfImage\fR [\-\-command\-line=\fIcommand line\fR] [\-\-kernel=\fIpath to vmlinux\fR] [\-\-ramdisk=\fIpath to ramdisk\fR] [\-\-output=\fIfile\fR] [\-\-ramdisk\-base=<start addr>] +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +\&\fBmkelfImage\fR is a program that makes a elf boot image for linux kernel +images. The image should work with any i386 multiboot compliant boot loader, +an \s-1ELF\s0 bootloader that passes no options, a loader compliant with the linuxBIOS +elf booting spec or with the linux kexec kernel patch. A key feature +here is that nothing relies upon \s-1BIOS\s0 calls, but they are made when +necessary. This is useful for systems running linuxbios. +.SH "BUGS" +.IX Header "BUGS" +Not all kernel parameters can be passed with the multiboot image format. +ip configuration is not automatically passed to a node. +The ramdisk base is hard coded to 8MB by default. +This man page need to be updated. +.SH "SEE ALSO" +.IX Header "SEE ALSO" +The kexec kernel patch. +LinuxBIOS. +Etherboot. +The multiboot standard. +.SH "COPYRIGHT" +.IX Header "COPYRIGHT" +mkelfImage is under the \s-1GNU\s0 Public License version 2 +.SH "AUTHOR" +.IX Header "AUTHOR" +Eric Biederman <ebiederman@lnxi.com> diff --git a/util/mkelfImage/mkelfImage.spec.in b/util/mkelfImage/mkelfImage.spec.in new file mode 100644 index 0000000000..a10eca4aa3 --- /dev/null +++ b/util/mkelfImage/mkelfImage.spec.in @@ -0,0 +1,50 @@ +Summary: make an elf network bootable image for linux +Name: mkelfImage +Version: +Release: 0 +Copyright: GPL +Group: Development/Tools +Source0:%{name}-%{version}.tar.gz +Packager: Andrew Ip <aip@cwlinux.com> +BuildRoot: %{_tmppath}/%{name} + +%description +mkelfImage is a program that makes a elf boot image for linux kernel images. +The image should work with any i386 multiboot compliant boot loader, an ELF boot +loader that passes no options, a loader compliant with the linuxBIOS elf booting +spec or with the linux kexec kernel patch. A key feature here is that nothing +relies upon BIOS calls, but they are made when necessary. This is useful for +systems running linuxbios. + +%prep +%setup -q -n %{name}-%{version} + +%build +%configure +make + +%install +make install DESTDIR=${RPM_BUILD_ROOT} + +%files +%defattr(-,root,root) +%{_sbindir}/mkelfImage +%doc News +%doc COPYING +%doc AUTHORS +%{_mandir}/man8/mkelfImage.8.gz + +%changelog +* Mon Jan 13 2003 Eric Biederman <ebiederman@lnxi.com> +- Move the man page into section 8 as mkelfImage lives in sbin + +* Mon Aug 26 2002 Joshua Aune <luken@linuxnetworx.com> 1.15-1 +- New version +- Merge distro and Eric's spec file + +* Fri Aug 23 2002 Eric Biederman <ebiederman@lnxi.com> +- Simplified and incorporated into mkelfImage + +* Sat Aug 10 2002 Andrew Ip <aip@cwlinux.com> +- Initial release + diff --git a/util/mkelfImage/util/Makefile b/util/mkelfImage/util/Makefile new file mode 100644 index 0000000000..67ec05be49 --- /dev/null +++ b/util/mkelfImage/util/Makefile @@ -0,0 +1,3 @@ +$(OBJDIR)/bin/bin-to-hex: util/bin-to-hex.c + $(MKDIR) -p $(@D) + $(HOST_CC) $(HOST_CFLAGS) $< -o $@ diff --git a/util/mkelfImage/util/bin-to-hex.c b/util/mkelfImage/util/bin-to-hex.c new file mode 100644 index 0000000000..af87e3ac0c --- /dev/null +++ b/util/mkelfImage/util/bin-to-hex.c @@ -0,0 +1,20 @@ +#include <stdio.h> + +int main(int argc, char **argv) +{ + int c; + int i; + i = 0; + while((c = getchar()) != EOF) { + if ((i % 16) != 0) { + putchar(' '); + } + printf("0x%02x,", c); + i++; + if ((i %16) == 0) { + putchar('\n'); + } + } + putchar('\n'); + return 0; +} |