author | Mystery Man <unknown@mandriva.org> | 2001-08-07 17:40:36 +0000 |
---|---|---|
committer | Mystery Man <unknown@mandriva.org> | 2001-08-07 17:40:36 +0000 |
commit | 068d599562888a36a50e5bbdeb8b70f83fa7c287 (patch) | |
tree | 18f5eed8353b3af647412875d438b55ef8c07670 | |
parent | be838931607e1ab14c8c699e20dd807b55579f7b (diff) | |
download | drakx-topic/v_webmin_0_87.tar drakx-topic/v_webmin_0_87.tar.gz drakx-topic/v_webmin_0_87.tar.bz2 drakx-topic/v_webmin_0_87.tar.xz drakx-topic/v_webmin_0_87.zip |
diff --git a/.cvsignore b/.cvsignore deleted file mode 100644 index f6f0748da..000000000 --- a/.cvsignore +++ /dev/null @@ -1,7 +0,0 @@ -pictures -docs -images -unused -all.modules -all.kernels -drakxtools.tar.bz2 diff --git a/Makefile b/Makefile deleted file mode 100644 index 3aae7a662..000000000 --- a/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -ARCH := $(patsubst i%86,i386,$(shell uname -m)) -ARCH := $(patsubst sparc%,sparc,$(ARCH)) - -RELEASE_BOOT_IMG = cdrom.img hd.img network.img usbnet.img -ifeq (i386,$(ARCH)) -RELEASE_BOOT_IMG += blank.img pcmcia.img other.img -endif -ifeq (sparc,$(ARCH)) -BOOT_IMG = live.img tftp.img tftprd.img live64.img tftp64.img tftprd64.img -RELEASE_BOOT_IMG += hd64.img cdrom64.img network64.img -endif -ifeq (ppc,$(ARCH)) -BOOT_IMG = -RELEASE_BOOT_IMG = all.img -endif -ifeq (ia64,$(ARCH)) -BOOT_IMG = -RELEASE_BOOT_IMG = all.img -endif -BOOT_IMG += $(RELEASE_BOOT_IMG) - -FRELEASE_BOOT_IMG = $(BOOT_IMG:%=images/%) -FBOOT_IMG = $(BOOT_IMG:%=images/%) -FBOOT_RDZ = $(FBOOT_IMG:%.img=%.rdz) - -BINS = mdk-stage1/init mdk-stage1/stage1-full mdk-stage1/stage1-cdrom mdk-stage1/stage1-network mdk-stage/stage1-usbnet -ifeq (ppc,$(ARCH)) -BINS = mdk-stage1/init mdk-stage1/stage1-full -endif -DIRS = tools mdk-stage1 perl-install - -ROOTDEST = /export -UPLOAD_DEST_ = ~/cooker -UPLOAD_DEST = $(UPLOAD_DEST_)/cooker -UPLOAD_DEST_CONTRIB = $(UPLOAD_DEST_)/contrib -UPLOAD_SPARC_DEST = /mnt/BIG/distrib/sparc - -.PHONY: dirs perl-install $(FLOPPY_IMG) install - -install: all.modules build rescue - for i in images misc Mandrake Mandrake/base; do install -d $(ROOTDEST)/$$i ; done -ifneq (ppc,$(ARCH)) - for i in $(FRELEASE_BOOT_IMG); do cp -f $${i}* $(ROOTDEST)/images; done -endif -ifeq (alpha,$(ARCH)) - for i in $(FBOOT_RDZ); do cp -f $${i}* $(ROOTDEST)/boot; done - cp -f vmlinux.gz $(ROOTDEST)/boot/instboot.gz - make -C tools/$(ARCH)/cd install ROOTDEST=$(ROOTDEST) -endif - cd $(ROOTDEST)/images; rm -rf alternatives - if [ `ls $(ROOTDEST)/images/*.img-* 2>/dev/null | wc -l` -gt 0 ]; then \ - cd $(ROOTDEST)/images; mkdir alternatives; cd alternatives; mv ../*.img-* .; md5sum *.img-* > MD5SUM; \ - fi - cd $(ROOTDEST)/images; md5sum *.img* > MD5SUM - - install live_update $(ROOTDEST)/live_update - make -C perl-install full_stage2 - -build: $(FBOOT_IMG) - -dirs: - @for n in . $(DIRS); do \ - [ "$$n" = "." ] || $(MAKE) -C $$n all ;\ - done - -rescue: all.modules - make -C $@ - -$(FBOOT_RDZ): dirs all.modules - ./make_boot_img $@ `basename $(@:%.rdz=%)` - -$(FBOOT_IMG): %.img: %.rdz - ./make_boot_img $@ `basename $(@:%.img=%)` - -tar: clean - rpm -qa > needed_rpms.lst - cd .. ; tar cfj gi.tar.bz2 gi - rm needed_rpms.lst - -perl-install: - make -C perl-install all - -mdk-stage1/mar/mar: - make -C mdk-stage1/mar - -all.modules: mdk-stage1/mar/mar perl-install/auto/c/stuff/stuff.so update_kernel perl-install/modules.pm - `./tools/specific_arch ./update_kernel` - -perl-install/auto/c/stuff/stuff.so: perl-install - - -$(FBOOT_IMG:%=%f): %f: % - dd if=$< of=/dev/fd0 - xmessage "Floppy done" - -clean: - rm -rf $(BINS) images all.modules all.modules64 install_pcmcia_modules - for i in $(DIRS) rescue; do make -C $$i clean; done - find . -name "*~" -o -name ".#*" | xargs rm -f - -check: - @badrights=`find $(ROOTDEST)/Mandrake/mdkinst | perl -lne 'print if !((stat)[2] & 4)'`; [ -z "$$badrights" ] || { echo "bad rights for files vvvvvvvvvvvvvvvvvvvvvvvvvv" ; echo "$$badrights" ; echo "bad rights for files ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^" ; exit 1; } - @missing_kb=`find -name "Entries" | xargs perl -F/ -alne 'print $$ARGV =~ m|(.*)/CVS|, "/$$F[1]" if $$F[1] =~ /\.(png|gif|bmp|xcf|gz|bz2|tar|rdz|so|a|o|mar|img|exe)$$/ && $$F[4] ne "-kb"'` ; [ -z "$$missing_kb" ] || { echo "missing -kb in CVS for files vvvvvvvvvvvvvvvvvvvvvvvvvv" ; echo "$$missing_kb" ; echo "missing -kb in CVS for files ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^" ; exit 1; } - -upload: - $(MAKE) clean - -# # done before make install to increment ChangeLog version - tools/addchangelog.pl tools/cvslog2changelog.pl | tools/mailchangelog.pl & - - $(MAKE) install - $(MAKE) check - - function upload() { rsync -qSavz --verbose --exclude '*~' -e ssh --delete $(ROOTDEST)/$$1/$$2 mandrake@kenobi:/c/cooker/$$1; } ;\ - upload Mandrake/mdkinst '' ;\ - upload Mandrake/base compss* ;\ - upload Mandrake/base rpmsrate ;\ - upload Mandrake/base *_stage2.bz2 ;\ - upload misc gendistrib ;\ - upload misc make_mdkinst_stage2 ;\ - upload misc packdrake ;\ - upload misc packdrake.pm ;\ - upload misc rpmtools.pm ;\ - upload misc auto ;\ - upload '' live_update ;\ - upload images MD5SUM ;\ - upload images *.img* ;\ - upload images/alternatives '' ;\ - echo - -upload_sparc: - touch /tmp/mdkinst_done - cp -a $(ROOTDEST)/images/* $(UPLOAD_SPARC_DEST)/images ; true - cp -a $(ROOTDEST)/boot/* $(UPLOAD_SPARC_DEST)/boot; true - cp -a $(ROOTDEST)/misc/* $(UPLOAD_SPARC_DEST)/misc; true - rm -rf $(UPLOAD_SPARC_DEST)/Mandrake/mdkinst - cp -a $(ROOTDEST)/Mandrake/mdkinst $(UPLOAD_SPARC_DEST)/Mandrake/mdkinst; true - ( cd $(ROOTDEST)/Mandrake/base; cp mdkinst_stage2.bz2 rescue_stage2.bz2 compss compssList compssUsers compssUsers.desktop $(UPLOAD_SPARC_DEST)/Mandrake/base ); true - rm -f /tmp/mdkinst_done - -# mkisofs -r -J -b images/cdrom.img -c images/boot.cat /tmp/r /mnt/disk/ | cdrecord -v -eject speed=6 dev=1,0 - -# as distrib: mv ~/oxygen/oxygen/images ~/tmp/r -# as mandrake: ~distrib/bin/mkisofs -r -b images/cdrom.img -c images/boot.cat -o /home/ftp/linux-mandrake/pub/mirror/oxyiso/oxygen-3.iso ~distrib/tmp/r ~distrib/oxygen/oxygen -# as mandrake: remove old iso in /home/ftp/linux-mandrake/pub/mirror/oxyiso -# as mandrake: cd /home/ftp/linux-mandrake/pub/mirror/oxyiso ; md5sum *.iso > md5sum -# as distrib: mv ~/tmp/r/images ~/oxygen/oxygen diff --git a/docs/.cvsignore b/docs/.cvsignore deleted file mode 100644 index a0593a470..000000000 --- a/docs/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -pictures diff --git a/docs/BUGS b/docs/BUGS deleted file mode 100644 index 1d154fcf1..000000000 --- a/docs/BUGS +++ /dev/null @@ -1,10 +0,0 @@ -doInstallStep: if there's not enough room, error, but packages are marked installed :( - -when you click directly on setupFilesystems and you have scsi, you're fucked. -Even if you go to setupSCSI, you won't be able to have partitions again. - -bug non reproductible: -- /etc/passwd is empty after `root passwd' stage :( -- reboot at the end of package installation with a lot of error messages from -gtk about the progressbar - diff --git a/docs/COPYING b/docs/COPYING deleted file mode 100644 index 60549be51..000000000 --- a/docs/COPYING +++ /dev/null @@ -1,340 +0,0 @@ - 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/docs/HACKING b/docs/HACKING deleted file mode 100644 index fb3c8cf49..000000000 --- a/docs/HACKING +++ /dev/null @@ -1,122 +0,0 @@ --=-=-- -DrakX is a very big project, and it needs special setups to work. -The purpose of this file is to explain how you can setup your box to make it -compile and run. --=-=-- - -Beware, don't try this on a production machine with important data. - - --------------------------------------------------------------------------- -Sources installation: - - First grab the gi.tar.bz2 archive and untar it in your home directory, -for example from DrakX-*.src.rpm on your Mandrake Linux distribution. - -cd to gi -for i in `du -a | grep CVS/Root | cut -f 2` -do - sed -e 's/prigaux/anoncvs/' $i > $i.tmp - mv $i.tmp $i -done - -Then, log yourself into the cvs: -% export CVS_RSH=ssh -% export CVSROOT=:ext:anoncvs@cvs.mandrakesoft.com:/cooker -% cvs checkout gi - (passwd: 'cvs') -And update the gi package: -cvs update -P -d - - --------------------------------------------------------------------------- -Preparing the compilation process: - -(1) target directory - -create a /export directory and copy a recent Mandrake Linux CD in there. -(You don't have to put have all the RPMS...) ; you'll need roughly 1.5 -Gbytes for a full install. - -[gc@obiwan ~/cvs/gi] su -c "mkdir /export" - - -(2) devel packages - -you need quite a few devel packages to run the stuff; roughly: gcc, make, -glibc-devel, perl-devel, XFree86-devel, libglib-devel, libgtk+-devel, -perl-GTK, ldetect*, libslang-devel, libnewt-devel, e2fsprogs, dosfstools, -rpm-devel, popt-devel, rpmtools. - - -(3) sudo - -never build or run DrakX as root; install package sudo, and set up -relevant permissions; the following should be enough: (in your -/etc/sudoers) - -gc ALL=(root) NOPASSWD:/usr/bin/patch,NOPASSWD:/bin/rpm,NOPASSWD:/bin/mount,NOPASSWD:/bin/cp,NOPASSWD:/bin/umount,NOPASSWD:/usr/bin/install,NOPASSWD:/bin/rm,NOPASSWD:/bin/mv,NOPASSWD:/bin/tar,NOPASSWD:/bin/cpio,NOPASSWD:/bin/chown,NOPASSWD:/bin/mkdir,NOPASSWD:/usr/bin/strip - - -(4) boot kernel - -you need one or more kernels and (all?) their modules. it's located in -subdirectory "all.kernels" in DrakX-*.src.rpm ; if you ever grab (or -build) another boot kernel, replace or add an entry in "all.kernels" as: - - (a) create your modules subdir (useful to describe the - VERSION_RELEASE) and untar your kernel - -[gc@obiwan ~/cvs/gi/all.kernels] mkdir 2.4.1-BOOTcustom -[gc@obiwan ~/cvs/gi/all.kernels] cd 2.4.1-BOOTcustom -[gc@obiwan ~/cvs/gi/all.kernels/2.4.1-BOOTcustom] tar jxvf ~/mycustomkernel.tar.bz2 -[gc@obiwan ~/cvs/gi/all.kernels/2.4.1-BOOTcustom] ls -boot/ cardmgr/ lib/ - - (c) build kernel/modules stuff for stage1 and stage2 -[gc@obiwan ~/cvs/gi] ./update_kernel - - -(5) pray - -[gc@obiwan ~/cvs/gi] make - - ---------------------------------------------------------------------------- -The comments written with #- are automatically stripped out at install. - - ---------------------------------------------------------------------------- -testing all: - - go to the perl-install directory and execute ./g_auto_install --test - - You should be able to test the whole thing in a non-destructive way. - -NEVER compile and/or execute DrakX as root! - - - - -Here is how I (dams) made it work on my computer. -------------------------------------------------- - -- get the sources -- install the librairies needed included newt-devel gtk+-devel popt-devel popt gtk-engines -- cd path/to/gi -- make -- mkdir /usr/share/gtk -- ln -s path/to/gi/perl-install/share/themes /usr/share/gtk -- ln -s path/to/gi/perl-install/share/step-* /usr/share -- ln -s path/to/gi/perl-install/share/help.xpm /usr/share -- ln -s path/to/gi/perl-install/share/isdn* /etc/sysconfdir/network-scripts -- have a cd architecture linked on /export -- ln -s /export /tmp/rhimage -- export PERL_INSTALL_TEST=1 -- cd path/to/gi/perl-install -- gendistrib --noclean --distrib /export -- ./install2 in root (dangerous) or chmod a+r /dev/hd* and ./install2 in user - - - -address all bugreports to dave@null.com diff --git a/docs/README b/docs/README deleted file mode 100644 index 08d5613cc..000000000 --- a/docs/README +++ /dev/null @@ -1,366 +0,0 @@ -Well here is a little description of what DrakX needs to work in comparison -to the RH newt install. - -******************************************************************************** -* CVS ************************************************************************** -******************************************************************************** -Like all good free software, DrakX is in CVS :) - -You can access it at http://www.mandrakelinux.com/cgi-bin/cvsweb.cgi/gi - -or via - -export CVS_RSH=ssh -export CVSROOT=:ext:anoncvs@cvs.mandrakesoft.com:/cooker -cvs checkout gi - (enter password 'cvs') - - -This is only read-only access. If you want more, tell me (pixel@mandrakesoft.com) - -Alas, all is not in CVS as a lot of things are binary files. -For the other things, take SRPMS/DrakX-*.src.rpm - -Please note that redoing *all* the stuff is not for the faint of heart. I myself -sometimes wonder what the whole make does :-% -Instead, changing some .pm files is quite easy (nice interpreted language) - -******************************************************************************** -* Making your custom install *************************************************** -******************************************************************************** -If you have your own rpms you want to add, or make your own updated cdrom, you -just have to issue: - -% gendistrib --noclean --distrib <DIRS> - -Where <DIRS> is the root of all the media that the install will see, this first -one is the main one : - -(1) network or 1-cdrom installs - DIRS == the root directory of the Distribution - -(2) multi-cdrom install - DIRS == the root directories of all the media that the install will see - -``gendistrib'' will scan the file Mandrake/base/hdlists in the main root -directory (the first one in DIRS) to search for all media used. Typically you -use Mandrake/RPMS* for RPM packages repository. -For multi-cd, please use Mandrake/RPMS or Mandrake/RPMS1, Mandrake/RPMS2, etc. -For one CD or a network/hd volume, please use Mandrake/RPMS. - -Optionnally, you can modify ``Mandrake/base/rpmsrate''; this file manages -the relative importance of the files, and thus their installation or not. - -Also, mdkinst_stage2.gz must be remade if you modify files in Mandrake/mdkinst. -See below for information about these files. - -******************************************************************************** -* FILES ************************************************************************ -******************************************************************************** -First here are the different things needed : - -Mandrake/base/hdlists - description of the available install media. - format is one line for one medium as - <hdlist_name> <rpms_directory> <description> - <hdlist_name> should be match regexp /hdlist\S*.cz2?/ - for example (two cd install) you get - hdlist1.cz Mandrake/RPMS1 Boot CD - hdlist2.cz Mandrake/RPMS2 Extension CD - -Mandrake/base/hdlist*.cz - table of rpm's headers, referred by ``hdlists'' - their contents can be listed using ``packdrake -l <hdlist_file>'' or - or ``parsehdlist <hdlist_file>''. - ! Need to be remade when Mandrake/RPMS* changes (with ``gendistrib'') ! - -Mandrake/base/depslist.ordered - for each packages, tell which package it depends on. Also contains the - size for some (obscure) bloody reasons. - ! Need to be remade when Mandrake/RPMS* changes ! - (with ``gendistrib --noclean --distrib .'') - -Mandrake/base/compss - obsoletes comps. It store packages in different categories, generated - from the %{GROUP} field - ! Need to be remade when Mandrake/RPMS* changes ! - (with ``gendistrib --noclean --distrib .'') - -Mandrake/base/rpmsrate - ranks and classify packages, so that the installer will know which - ones to install. format is : - <intern_group> - <level> <packages> - where <intern_group> is a symbolic name used in Mandrake/base/compssUsers* files, - and <level> defines importance level as described below : - 5 must have - 4 important - 3 very nice - 2 nice - 1 maybe - by default (for non expert), group selects packages for level 4 (important) - and 5 (must have). export mode add 3 (very nice) level. other level (below 2) - can only be selected using individual package selection. - -Mandrake/mdkinst - live system used on certain installs. See ``Ramdisk or not'' below for - more. - -Mandrake/base/mdkinst_stage2.bz2 - for the ramdisk. live sytem in ext2 filesystem bzipped2. - generated from Mandrake/mdkinst tree using misc/make_mdkinst_stage2 - See ``Ramdisk or not'' below for more. - -Mandrake/base/rescue_stage2.bz2 - rescue ramdisk. live sytem in ext2 filesystem bzipped2. - this is the ramdisk loaded when typing rescue on boot prompt. - there is no live system available, only the ramdisk is used. - -images/*.img - boot images to use with DrakX. Use: - - cdrom for cdrom install - - network for ftp/nfs install (non-pcmcia devices) - - hd for hard-disk install - - pcmcia for pcmcia install (see ``PCMCIA install'' below for more) - - the following modules have been removed from: - network.img: acenic sk98lin de4x5 - cdrom.img and hd.img: BusLogic seagate fdomain g_NCR5380 dc395x_trm tmscsim - hd.img: dpt_i2o eata eata_pio eata_dma - cdrom.img: aztcd gscd isp16 mcd mcdx optcd cm206 sjcd - pcmcia.img: apa1480_cb - they are now in "other.img", - - blank.img is a blank boot image without a kernel nor initrd. this image - can be used to generate custom boot disk. - - if you think one of those modules is used a lot, tell me, i may find some room - to put it back on the main floppies. - - -******************************************************************************** -* logs ************************************************************************* -******************************************************************************** -During install, a lot of interesting stuff can be found in different places: -in consoles and in files. To switch to console 2 for example, do Ctrl-Alt-F2 -from the X install. -- alt-F1: the stdout of the install. Not very interesting stuff -- alt-F2: simple shell. Quite a lot of commands are available but as they are -written in perl (for space), they do not handle the very same options as normal. -After install, you can do ``chroot /mnt'' to see your system just like after -rebooting. ``rpm -qa'' works for example. -- alt-F3: a lot of interesting things. Be carefull, some ``ERROR'' messages are -not interesting. -- alt-F4: kernel's place. aka the output of dmesg. -- alt-F7: the graphical install lives there - -- command "bug" puts on floppy lots of interesting stuff. -- /tmp/ddebug.log: same (or nearly the same) as alt-F3 -- /tmp/syslog: same as alt-F4 -- /mnt/root/ddebug.log: at the end of each step, DrakX tries to backup -/tmp/ddebug.log to /mnt/root. Available only after mounting of /. -- /mnt/root/install.log: the log of the installation (or upgrade) of the rpms -(just like rpm's /mnt/tmp/(install|upgrade).log) -- /mnt/root/auto_inst.cfg.pl: a kickstart file generated at the end of each -step. Can be used in 2 ways: kickstart install or ``defcfg'' install. Hopefully -you know about kickstart. ``defcfg'' is a way to customize the default values in -install. For example, French can be the default language with a qwerty keyboard, -the auto-partitionning partitions can be changed, the default user class can be -set to developer (!)... - -******************************************************************************** -* po translation files ********************************************************* -******************************************************************************** -DrakX uses .po files for its translation. A script takes the different -strings out of the .pm files. It generates the DrakX.pot file which contains -all the english strings to translate. -To add a new language, you just have to add it to lang.pm (if it's not there -already) and put the .po in the perl-install/po directory (see ``Ramdisk or -not'' to know if you have to regenerate the mdkinst_stage2.gz) - -******************************************************************************** -* PCMCIA install *************************************************************** -******************************************************************************** -If the media you use to install is a pcmcia device, use the pcmcia boot disk. - -******************************************************************************** -* Ramdisk or not *************************************************************** -******************************************************************************** -The DrakX install is much bigger than the newt one. So the ramdisk which was -used is getting big, and costs a lot in memory -(eg: the mdkinst_stage2 is 14MB - 23/09/99) -(update! now size is 21MB - 24/01/01) -(update! now size is 19MB - 26/04/01) - -| | newt | DrakX -|-------+---------+---------------------------------------------------------- -| nfs | live | live -| ftp | ramdisk | ramdisk -| http | ramdisk | ramdisk -| hd | ramdisk | live if Mandrake/mdkinst/usr/bin/runinstall2 is a link, -| | | ramdisk otherwise -| cdrom | ramdisk | live if memory < 52MB, ramdisk otherwise - -Where ramdisk is needed, if detected memory is below the limit allowed for -ramdisk (maintained in file gi/mdk-stage1/config-stage1.h; currently 52 Mb), -a failure dialog will be printed explaining that there is not enough memory -to perform the installation. - -When i say live, it means that the stage1 will *mount* the -Mandrake/mdkinst and use it that way. - -The ramdisk is used in place of the live in some cases. This ramdisk is filled -with mdkinst_stage2.gz - -For cdrom install, the ramdisk is used to speed up things (access time is quite -high on cdrom drives) - -For pcmcia, it depends on the type of install. - - -******************************************************************************** -* modules ********************************************************************** -******************************************************************************** -Modules can be found in at least 2 places: -- in /modules/modules.mar -- in /lib/modules.cz<KERNEL_VERSION_RELEASE> - -/modules/modules.mar is used in mdk-stage1. It contains only modules -interesting for one kind of install. For example in an hd install, it -contains scsi modules. For a network install, it contains network card -modules. (To create, extract or view files in a ``mar'' archive, please -use gi/mdk-stage1/mar/mar; this is basically an archive format meant to -be minimalistic) - -/lib/modules.cz<KERNEL_VERSION_RELEASE> contains all modules, it is used -in stage2. - - -To install a module, use modprobe which is in /usr/bin. It's a perl wrapper -around /usr/bin/insmod. It uses the dependencies found in -/modules/modules.dep (stage1). - -/usr/bin/insmod is a wrapper around /usr/bin/insmod_. It just extracts the -module out of /lib/modules.cz in /tmp. Then it calls insmod_. - -/usr/bin/insmod_ is the real prog (which you usually find in /sbin/). You need -to give it the complete path. - -******************************************************************************** -* Making screenshots *********************************************************** -******************************************************************************** -On a test machine, make a network install, switch to console (ctrl-alt-F2), enter: -% xhost+ - -then, on another computer: -% DISPLAY=test_machine:0 xwd -root | convert - screenshot.png - -******************************************************************************** -* Miscellaneous **************************************************************** -******************************************************************************** -> o Media access methods: nfs, ftp, http, hd, cdrom -> o Stages: init, stage1, stage2 -> - What exactly each stage does - -init loads stage1 -stage1 loads stage2, on various medium type - -stage2 is too big to fit on a floppy, that's why stage1 exists - -> - How each stage relates to the various media access methods - -stage1 knows only how to access to the media is compiled for. It contains only -the kernel modules needed for that media. For eg, the nfs/ftp/http stage1 -doesn't contain scsi modules nor ide. - -> - How one stage terminates and another begins. i.e., How does -> stage1 find, mount, and launch stage2? - -/sbin/init just starts /sbin/stage1 -/sbin/stage1 takes care of mounting stage2 (in ramdisk if necessary) - then it runs /usr/bin/runinstall2 - -> o Text and Graphic mode installers -> - Architectural overview of each - -have a look at gi/docs/object_class.fig - - -******************************************************************************** -* OEM ************************************************************************** -******************************************************************************** -> I am a system OEM in Bangalore,India selling systems bundled with -> Mandrake Linux. The problem is that with every system I sell, I need to -> install & configure the system which takes HOURS!. Can I do a diskcopy -> instead? -> -> Please Help. This is a major bottleneck for me. - -many solutions: - -- make an install on drive hdb, then : - dd if=/dev/hdb of=/dev/hdc - but you should make sure the hardware is *REALLY* identical. - -- try the oem feature - 3. - burn a cd out of *latest* cooker or 8.0 and above. - - boot on it telling "oem" to syslinux - !! it will destroy every data on the harddrive or - resize (or use free space) if *ONLY* one fat partition is defined !! - - you now have a very automated install matrix - (duplicate it with "dd if=/dev/hdb of=/dev/hdc bs=1M count=730") - - put the harddrive in the oem box, the user will now have an *very* automated - install, just asking the root password and user password, and some other - question according its hardware. - - 4. just like 3. but you may have to mount /cdrom after typing rescue on - syslinux prompt (oem script do it automatically if a automatic boot nfs - network has been done as server is known). under /cdrom may be anything - as long as it provides an installation tree of Mandrake Linux. - after that run oem script by typing "/etc/oem -f" for normal installation - or "/etc/oem -f server" for server installation (normal with server installed). - - 5. (just like 3. without burning a cd, doing the first part by hand) - have a look at the /etc/oem script on the rescue and do it by hand... - - -cu Pixel, fpons. - - -comments: -1. maybe copy unnecessary things -> take too long - solution -> use bs=8k count=xxxx -2. kernel_reread can be found on the new rescue, source is also at end of this -mail. This solution works with one partition. Can be easily enhanced to many -primary partitions... For extended partitions, more complicated, but not much :) -3. has just been added in latest cooker. It may still have some pb. The main -current limitation is IDE only, though it can be fixed easily for special cases. - --------------------------------------------------------------------------------- -#include <stdio.h> -#include <sys/mount.h> -#include <fcntl.h> - -void die(char *msg) -{ - perror(msg); - exit(1); -} - -void kernel_read(char *dev) -{ - int fd; - if ((fd = open(dev, O_RDONLY)) == -1) die("can't open device"); - ioctl(fd, BLKRRPART, 0); - close(fd); -} - -int main(int argc, char **argv) -{ - if (argc != 2) { - fprintf(stderr, "usage: kernel_read_part <hard drive device>\n"); - exit(1); - } - kernel_read(argv[1]); -} diff --git a/docs/README.devel b/docs/README.devel deleted file mode 100644 index 0244557ba..000000000 --- a/docs/README.devel +++ /dev/null @@ -1,252 +0,0 @@ -Well here is a little description of how DrakX can be modified or extended. -Please refer to README file for getting DrakX code source and to known more -exactly how it works and what it can do. - - -******************************************************************************** -* Execution of DrakX *********************************************************** -******************************************************************************** -DrakX has originally be written by pixel in perl and C. -entry point for stage2 is /usr/bin/runinstall2 which is typically a link to -/usr/bin/install2 which simply load module install2.pm and execute -install2::main with @ARGV. - -install2::main parse command line arguments, prepare installation, find the right -install_interactive class (take a look at gi/docs/object_class.fig) according to -command line, memory available and if the interactive chosen is initializing -correctly, else it will try a less-demanding interactive object. -Once done, $::o is set to this install & interactive object and main runs the -various step of install2 defined in $o->{steps}, starting with $o->{steps}{first} -and iterating with method install_any::getNextStep(). -while running step, it trap any errors that may arise and use perl exception to -change step. - -******************************************************************************** -* DrakX modules descriptions *************************************************** -******************************************************************************** -Here is a brief description of what each modules of DrakX is doing. - -install2: main module of DrakX as described above, main loop execution of DrakX. - -install_steps: generic installation module containing steps definition, all steps - should always be defined here as some methods may be used on automatic mode. - there is no interactivity available. typically are defined base operation for - configuring each step according to $o. - -install_steps_interactive: generic installation module with generic interative - methods. typically are found all interactive code of DrakX for each steps. - -install_steps_auto_install: implementation installation module without interactive - methods to match auto_install mode. this is the simplest as almost no method are - redefined (inherit module install_steps only, compared to other implementation - modules described below). - -install_steps_stdio: implementation installation module with interactive stdio - methods to match stdio mode. inherit modules install_steps_interactive and - interactive_stdio. - -install_steps_newt: implementation installation module with interactive newt - methods to match newt mode. inherit modules install_steps_interactive and - interactive_newt. - -install_steps_gtk: implementation installation module with interactive gtk - methods to match gtk mode. inherit modules install_steps_interactive and - interactive_gtk. - -install_any: contains various methods using generic interactive interface but - not used by standalone tools. - -install_gtk: contains various methods using gtk interface but not used by - standalone tools. - -interactive_stdio: implementation methods for interactivity in stdio mode. - inherit module interactive. - -interactive_newt: implementation methods for interactivity in newt mode. - inherit module interactive. - -interactive_gtk: implementation methods for interactivity in gtk mode. - inherit module interactive. - -my_gtk: basic gtk access methods. - -any: contains various methods using generic interactive interface. to compare - against install_any module as this one is available for standalone tools. - -class_discard: simple module that implement every methods undefined to return - nothing. this trick is used to ensure no undefined method can arise when using - code that reference interactive method which are not defined. - -common: contains very simple and very usefull (common) methods to do various task. - some methods inspired by functionnal language. - -c: contains wrapper to C definition of methods used by DrakX, use of C is necessary - for C extern libraries interface (rpmlib, ldetect), kernel interface, XFree - interface. - -commands: implement some un*x commands, conflicting name with perl contains - trailing underscore (_). this module is used by commands perl script that - determine which command to run according to $0 (this is used this way when DrakX - is running). - -run_program: allow running a program with redirection but without using a shell. - allow rooted execution. - -help: contains all help message displayed by DrakX. - -log: log facility methods. - -lang: language manipulation methods, get and set sysconfig file, load po. - -keyboard: keyboard manipulation methods, get and set sysconfig file, set console - keyboard mapping. - -mouse: mouse manipulation methods, get and set sysconfig file, change mouse. - -timezone: time zone manipulation methods, get and set timezone. - -services: services manipulation methods, activate or delete services (see - /etc/rc.d/init.d directories). - -detect_devices: manage detection of various class of hardware. - -devices: manage device file, create device special according device name. - -partition_table: base partition table management methods, it manages - appriopriate partition_table_XXX object according to what has been read - as XXX partition table type. - -partition_table_raw: generic class for the following partition_table_XXX. - -partition_table_emtpy: matches an empty partition table. - -partition_table_dos: matches a DOS partition table. - -partition_table_bsd: matches a BSD partition table. - -partition_table_mac: matches an Apple partition table. - -partition_table_sun: matches a Sun Label partition table. - -fs: read and write /etc/fstab file, mount and umount, format. - -fsedit: manage (modyfy, edit) mount point associated to partition (like editing - /etc/fstab). - -swap: swap management methods, format and mount (activation). - -raid: raid (software only) management methods. - -lvm: lvm (Logical Volume Manager) management methods. - -loopback: loopback management methods, used for lnx4win type installation or using - a file as a partition. - -diskdrake: diskdrake itself, disk graphical (using gtk) manipulation tools. - -ftp: ftp mangement methods, used when using ftp install. - -http: http management methods, used when using http install. - -modparm: kernel modules options management, allow building nice dialog with each - module parameter available. - -modules: kernel modules management, allow loading or unloading (ala modprobe or - insmod). - -printer: printer management methods, read and write both LPR or CUPS configuration. - -printerdrake: interactive printer management methods. - -network: network management methods, get and set sysconfig file. - -netconnect: network configuration wizard. - -netconnect_const: network configuration wirard data. - -Xconfig: X configuration (monitor + already existing config file) management. - -Xconfigurator: X configuration wizard. - -Xconfigurator_const: X configuration wizard data. - -booloader: bootloader (LILO, GRUB, LOADLIN, SILO) configuration management methods. - -pkgs: rpm package and hdlist, depslist management methods, allow selecting or - unselecting packages, manage rpmsrate file and select group, installation and - removal methods of rpm file. - -crypto: *obsoleted* module to manage crypto site and rpm file. - -standalone: standalone only, allow defining a standalone tools. - -bootlook: standalone only, interface with DrakConf to configure bootloader options. - -tinyfirewall: standalone only, interface with DrakConf to configure a tiny firewall. - -******************************************************************************** -* DrakX FAT resizer module description ***************************************** -******************************************************************************** -here is a fat resizer written in perl and C used by DrakX (diskdrake) to resize -FAT16/FAT32 partition. it moves clusters to make sure a shrink can be done on the -limit of the partition itself, if no cluster need to be moved, only boot sector -partition limit are modified. - -any: various methods to flag cluster, compute min size. - -boot_sector: boot sector management methods. - -c_rewritten: originally resize_fat was only perl, this contains code section that - are the most sensible to speed or memory contraints and have been rewritten to C - using perl extension. - -dir_entry: manage directory structure. - -directory: traverse directory recursively, needed to move correctly cluster. - -fat: manage fat structure. - -info_sector: manage info sector. - -io: manage I/O on disk (need to take care of big file as partition size may be - larger than 2GB). - -main: main resizer algortihm. if needed allocate new clusters, copy files, copy - directories. update boot sector info. - -******************************************************************************** -* Adding a new step to DrakX *************************************************** -******************************************************************************** -Say we want to add a question for setting "alawindows" option. -We put it pretty early in the install, let's say after "Select Installation -Class". - -1. in install2.pm - -add - - selectAlawindows => [ __("A la windows or not"), 0, 1, '' ], - -after - - selectInstallClass => [ __("Select installation class"), 1, 1, '' ], - -the 0, 1, '' means not "redoable", "skip on error", "don't hide" - -2. add your function selectAlawindows in install2.pm - -sub selectAlawindows { $o->selectAlawindows } - -3. add your function selectAlawindows in install_steps_interactive.pm - -sub selectAlawindows { - my ($o) = @_; - $o->{alawindows} = $o->ask_yesorno('', _("Throw everything away as windobe does?"), 1); -} - -4. add your function selectAlawindows in install_steps.pm (not needed in that -case, except for auto_install) - -sub selectAlawindows {} - - diff --git a/docs/README.pxe b/docs/README.pxe deleted file mode 100644 index 14115369a..000000000 --- a/docs/README.pxe +++ /dev/null @@ -1,142 +0,0 @@ -Here is a short description to configure a PXE server using dhcpd and tftpd. -This allows a network boot for your ethernet card conforming to the Interl -PXE specification. - -******************************************************************************** -********** General overview ************ -******************************************************************************** - -You need a dhcp server and a tftp server on one or two machines to allow the -network boot. We are not using a PXE server to achieve this as it is not -mandatory. -You can install tftp-server and dhcp-server package from the Mandrake -distribution for example. - -On the server machine at 192.168.2.1, you will find a "/etc/dhcpd.conf" sample -file written by Florin Grad <florin@mandrakesoft.com>, where "mydomain.com" is -assumed to be your domain name, and 192.168.1.1 a name server. All install are -done on subnet 192.168.2.0. - -All the files that will be downloaded by the tftp daemon are located under -"/tftpboot" : - "/tftpboot/pxelinux.0" is a program that is loaded directly by the machine - where a network boot will be done, this program comes - from the SYSLINUX package by H. Peter Anvin. (look at - http://syslinux.zytor.com/pxe.php for more information) - "/tftpboot/pxelinux.cfg/" is a directory where all configuration file for - pxelinux.0 will be found, pxelinux.0 will download - these file by itself. It searches first for a file - named accordind to the machine IP address in - hexadecimal, for example for 192.168.2.20, it - looks for "C0A80214" first, then "C0A8021" and so - on down to "C0", "C" and "default". - "/tftpboot/network.rdz" is the standard network initrd for Mandrake installation. - "/tftpboot/vmlinuz" is the boot kernel for installation. - "/tftpboot/help.msg" is the message displayed by pxelinux.0, note that currently - graphical message (as for install using SYSLINUX 1.48 with - graphic patch by Mandrake) is not supported. - -All file "network.rdz", "vmlinuz", "help.msg" can be found by mounting "network.img", -or the network floppy disk used for install, "pxelinux.cfg" is just an adaptation -of the file found on the "network.img" called "syslinux.cfg" but without the reference -to boot.msg (as it is not currently supported). - -Update network configuration for your needs and start dhcp server on the machine and -tftp server and this should work. - -******************************************************************************** -* /etc/dhcpd.conf ************************************************************** -******************************************************************************** -ddns-update-style ad-hoc; - -authoritative; - -option space PXE; -option PXE.mtftp-ip code 1 = ip-address; -option PXE.mtftp-cport code 2 = unsigned integer 16; -option PXE.mtftp-sport code 3 = unsigned integer 16; -option PXE.mtftp-tmout code 4 = unsigned integer 8; -option PXE.mtftp-delay code 5 = unsigned integer 8; -option PXE.discovery-control code 6 = unsigned integer 8; -option PXE.discovery-mcast-addr code 7 = ip-address; - -default-lease-time 28800; -max-lease-time 86400; - -option domain-name "mydomain.com"; -option domain-name-servers 192.168.1.1; - -class "PXE" { - match if substring(option vendor-class-identifier, 0, 9) = "PXEClient"; - option vendor-class-identifier "PXEClient"; - - vendor-option-space PXE; - option PXE.mtftp-ip 0.0.0.0; - next-server 192.168.2.1; #tftp server location - - filename "pxelinux.0"; # standard TFTP - -} - -shared-network "mynetwork" { - subnet 192.168.2.0 netmask 255.255.255.0 { - option subnet-mask 255.255.255.0; - option routers 192.168.2.1; - - ddns-domainname = "mydomain.com"; - - pool { - range 192.168.2.10 192.168.2.20; - allow members of "PXE"; - } - } -} -******************************************************************************** -* /tftpboot/pxelinux.cfg/default *********************************************** -******************************************************************************** -default linux -prompt 1 -timeout 72 -display help.msg -label linux - kernel vmlinuz - append ramdisk_size=32000 initrd=network.rdz root=/dev/ram3 vga=788 -label vgalo - kernel vmlinuz - append ramdisk_size=32000 initrd=network.rdz root=/dev/ram3 vga=785 -label vgahi - kernel vmlinuz - append ramdisk_size=32000 initrd=network.rdz root=/dev/ram3 vga=791 -label vga16 - kernel vmlinuz - append ramdisk_size=32000 initrd=network.rdz root=/dev/ram3 vga16 -label text - kernel vmlinuz - append ramdisk_size=32000 initrd=network.rdz root=/dev/ram3 text -label patch - kernel vmlinuz - append ramdisk_size=32000 initrd=network.rdz root=/dev/ram3 patch vga=788 -label expert - kernel vmlinuz - append ramdisk_size=32000 initrd=network.rdz root=/dev/ram3 expert vga=788 -label rescue - kernel vmlinuz - append ramdisk_size=32000 initrd=network.rdz root=/dev/ram3 rescue rw -label lnx4win - kernel vmlinuz - append ramdisk_size=32000 initrd=network.rdz root=/dev/ram3 lnx4win vga=788 -label preinst - kernel vmlinuz - append ramdisk_size=32000 initrd=network.rdz automatic=method:cdrom root=/dev/ram3 rescue oem rw -label oem - kernel vmlinuz - append ramdisk_size=32000 initrd=network.rdz automatic=method:cdrom root=/dev/ram3 rescue oem rw -label auto - kernel vmlinuz - append ramdisk_size=32000 initrd=network.rdz auto_install=Mandrake/base/auto_inst.cfg.pl -******************************************************************************** -* Usefull linkst *************************************************************** -******************************************************************************** - -http://syslinux.zytor.com/pxe.php -http://www.kano.org.uk/projects/pxe/ diff --git a/docs/SHORTCUTS b/docs/SHORTCUTS deleted file mode 100644 index bc8325625..000000000 --- a/docs/SHORTCUTS +++ /dev/null @@ -1,49 +0,0 @@ -******************************************************************************** -main shortcuts - -F11 -> previous step -F12 -> next (reachable) step - -******************************************************************************** -diskdrake - -taken directly from diskdrake.pm: - - "a" => \&Active, - "b" => \&Move, - "c" => \&Create, - "d" => \&Delete, - "f" => \&Format, - "m" => \&Mount_point, - "M" => \&Mount, - "n" => \&Create, - "o" => \&ReadFromFile, - "s" => \&SaveInFile, - "q" => \&Exit, - "r" => \&Resize, - "t" => \&Type, - "u" => \&Unmount, - "w" => \&WritePartitions, - "W" => \&WriteFstab, - -hopefully it is explicit enough :) - -******************************************************************************** -list choice - -- acceleration a la windows (default): enter a letter and the selection will move to the -first entry beginning with that letter. If you enter another letter it will try -to find the entry beginning with the 2 letters you have given. In case it fails -the starting_word is reset. -- incremental search a la emacs: searches trough the list - -Use control-s to use incremental search and then to search next occurence - -******************************************************************************** -in case of complete mouse sh**t - -XFree86 provides a way of moving the mouse pointer: -- first, press Ctrl-Shift-NumLock -- then move the pointer with the keypad arrows -- press button is ``0'' (aka Inser) -- release button is ``.'' (aka Suppr) diff --git a/docs/TODO b/docs/TODO deleted file mode 100644 index cb9399f82..000000000 --- a/docs/TODO +++ /dev/null @@ -1,515 +0,0 @@ --URGENT--------------------------------------------------------------------------------- -check for fpons/pixel BOTH that resize_fat is clean for current version -relative to 7.0-2. - -heavy testing of diskdrake to avoid corrupting partition table, current version -should be available to fix bogus partition table, writing enabled only when -partition is Ok (fixme? allow primary partition inside extended one, but with -warning on diskdrake startup, made them as warning ?). - --features------------------------------------------------------------------------------- -add rpmdrake in menu - -(7.1 or later) clean SCSI CDROM autoboot. -(done,gc,8.0) stage1 & cdrom: add ability in expert to choose the scsi cdrom drive to use - -(7.1)better help for partitioning in newbie - -(7.1)Improved network configuration (PPP and/or Ethernet) -PPPoE install and configuration (SuSE includes it, DHCP-like) -(7.1)standalone applications for configuration (netdrake, timetool, authentificationconf, soundcard) - ----- -(7.2) replace normal with standard (in the installClass's) - -(7.2 or later)horizontal sub-steps - -(7.2 or later)diskdrake in text mode - -ask "do you have SCSI?" before asking "probe PCI or not" - -(?) paride in stage1 -(done,gc,8.0) stage1 & network: add ability to choose the network interface to use - -(?) msec custom - -(?)firewall configuration (instant firewalling?) - -(?)widget for displaying fdisk (dindinx) -add fdisk using the zvt widget (taken in gnome-libs) - -(?)help in some configuration files. - -ability to add nfs/weird_fs entries in fstab - -size of packages in crypto - --to test-------------------------------------------------------------------------------- -what's lseek64? - -ensure installClass is set to something in auto install. - -for axp, swriteboot -f1 if swriteboot failed. -axp with swap part sigsegv - -tree for choosing monitors (buggy?) - -what happens if a module fails to insmod (scsi step), in beginner/normal/expert - -fstab must be sorted (/usr/local after /usr) - -RAID upgrades - -add choice clean /tmp or not in expert - -kernel chosen by default must be the one according to supermount/secure - -bug if ide-scsi, no more hdX, but scd0 (aka sr0) - (and add alias block-major-11 ide-scsi ?) - -check on update for conf.modules and modules.conf ! - -with /usr, /usr/local and /usr/local/e mount points i get an error at step mounting local filesystems - --easy fixes----------------------------------------------------------------------------- -rpmdrake proposition for cdrom labels - -use option nocheck to mount for upgrades - --fixes needing thinking----------------------------------------------------------------- -bug: changing mem= in miscellaneous doesn't modify lilo conf if you backtrack - -ask network configuration only if NIC found? - -configure DHCP for newbies if ethernet & DHCP card available - -xvidtune like screen configuration (see SuSE's yast) - -live cdrom for alpha (sparc?) - -network boot - -get the error when getting/reading .rpm files fail -better timeout handling for network installs - -handle not enough room for update -(fpons)verify the free space is big enough. - -the XFdrake test does not handle the fontset - -> Here I go into the printer configuration select 'HP Deskjet 722C Colour', -> print a test ASCII page, pressing 'No' when prompted to indicate the page did -> not print OK and then hitting cancel when prompted to choose a printer type -> again. -> ask_from_list cancel at /usr/lib/libDrakX/my_gtk.pm line 504. - -diskdrake: take from parted mklabel, hide(?) - -bug in kde desktop if keeps home but not an upgrade - -bug in users: mandrake user is added twice in strange installs -(mixed of security 0 + ???) - -bugs rpmdrake: -- just after installing a package, switch to `Installed', the package has wrong name -- refresh the kde desktop after package installation in rpmdrake -(restart kpanel) -- rpmdrake and same name packages - -urpmi: pb if XXX-devel requires XXX = 1.2.3 and we updgrade XXX-1.2.3 - -bug in defcfg in with lang=fr_FR, display is buggy - -bug keyboard focus: after switch in console at Xconfig step - - - --to look at-------------------------------------------------------------------------- -adduserdrake to remove/update users - -(???)free provider auto configuration facility (to be discussed). -auto ppp-configure with free provider - -(?)on laptop, configure the MMU to use swap not very often - -(?)checkboxes in groups based on compssList (and availableSpace?) - -(?)see what can be done with nvram (50 bytes to save information) - -better wacom support - -(fpons)bug: CANON BJC 4X00 do not work with current rhs-printfilters - (work with magicfilters (debian)) - (should be handled by ghostscript BJC600's driver) - -(pix)install text on mem=8M, mem=16M? - -(pix)kickstart -partitioning? raid? -X configuration and bootloader in kickstart - -XFdrake chooseResolutions with ask_from_list do not permit ``Show all'' - -(?) options in mkfs, progress bar when formatting - -(?) when some error occurs, partition must be unset isFormatted - --hardware------------------------------------------------------------------------------- -- with no floppy drive, mkbootdisk step fails badly -- with bad floppy or write protected, mkbootdisk doesn't say anything -- try detect_devices::floppies (and how are scsi floppies handled?) -maybe: do a iotcl FDGETPRM to detect fd1, fd0. - -need a simple solution to precise mouse type (syslinux option?) - -ELSA Gloria has bad ddc info - -token ring is tr0 not eth0 - -I have Mandrake 6.1 installed and working on a ThinkPad 770. -To enable the PCMCIA Token ring I have to append the following line to -/etc/pcmcia/config.opts -module "ibmtr_cs" opts "mmiobase=0xd2000 srambase=0xd4000" - -smp not detected (mhoward@memphisonline.com on cooker, bios=BP6PW) - -UDMA66 (ultra66.o for promise) - -aha152x needs "insmod aha152x.o aha152x=0x140,11,7" - -(obsolete) usb module not removed if no mouse found - -(fpons)handle dat drives - -hibernation on laptop -> clock not restored - -# in 2.3.15 "Silicon Integrated Systems [SiS]|SiS900 10/100 Ethernet" is handled - -(?)enable the testing of the mouse type (under X) (wheel) -possibility to specify the mouse - --(?)--------------------------------------------------------------------------------- -(?) handle NT (add entry for it in lilo, put it in fstab) - -(?) lilo-0.22-19mdk is buggy with boot=/dev/hde & root=/dev/sda13, it needs -disk=/dev/hde bios=0x80 & disk=/dev/sda bios=0x81 - -(?)using setxkb, enable the testing of the keyboard - -(?)XFdrake does not handle fbdev - -(?) Je viens de faire une installation sur une machine où seul Be était -installé. Je l'ai supprimé et installé (mode recommandé) Oxygen. Au -redémarrage, le boot manager de Be apparaît et il est impossible de -démarrer Linux. -Pourquoi ne pas installer LILO si on supprime toutes les partitions ? - -(?)initrd in bzip2 - -(?)smaller zsh (or ash in initrd) - -(?)is configureNetworkNet needed with dhcp/bootp? - -(?)bug in upgrade: install from hda1:/usr/local/blah with hda1:/ - -(?)mandrake_desk was not installed while kdebase it there on upgrade - -(?)when clicking on X configuration, installation of packages is not displayed - -(?)maybe remove commented lines in /usr/lib/perl5/... files - -(?)timezone using a picture (pb: how to delimit zones) -when asking GMT or not, display the time for each possibility -the list is too big for USA - -(?)ability to select the type of install when booting of cdrom -(?)use the ability of el torito to handle 2.88MB or more - -(obsolete)lilo-deinstallation in case of lilo auto-installation for beginners - -(?)loadFont sucks - -(obsolete)trash on the screen when X first starts - -(?)remove the gray line surrounding the logo - -(?)cleanup /etc/services & /etc/protocols - -(?)strange: no scsi of type 'fd', only 'tape' - -(?)remount ro before X test. - -(?)remove every << and >> (doesn't handle > 32bits) - - --done--------------------------------------------------------------------------------- -(7.1,done,fpons) improve printerdrake to at least have the same functionalities as printtool. - -(done,fpons)diskdrake can olverlap partitions (resize lower, resize original typically -after clear all and auto allocate, try maximal size available). - -(done,fpons)rewrite mouseconfig in perl? - -(done,pix)kudzu or not in miscellaneous - -(done,pix)warn the user if not enough ram to fulfill install - -(done,fpons)test after printer config - -(done,pix)ask for more than the memory size detected - -(done,fpons)modem config - -(done,pix)call kudzu in batch to initialize its list - -(done,pix)standalone generator of mdkinst_stage2.gz - -(done,pix)text install - -(done,pix) if u choose mouse usb != found mouse, it fails at X config - -(done,pix) diskdrake bug: saved information on floppy contains isMounted. - -(done,pix) update devices.c from modules.pm - -(done,pix) in lilo.conf, put -disk=/dev/hdb - bios=0x80 - -(done,pix) diskdrake -auto_partitions -suggested partition tables must be better foreach installClass - -(done,pix) update the list of modules (in update_kernel) - -(done,pix) language support: only choose the right locales and upmark the packages requiring it - -(done,pix) move security question before isntallation of packages - -(done,pix) install ssh - -(done,fpons,pix) change the boot message of syslinux (have something different from RedHat) - -(done,pix) install_steps.pm: 569 (128M + 3) - -(done,pix) bug: mouse freeze just before network configuration (mouse primax) - (was kudzu) - -(done,pix) signal 11 in stage1 nfs kickstart mount failed - -(done,pix) ask supermount or not, no supermount with kernel-secure - -(done,pix) fix bug in g_auto_install (can't go through all) - -(done,pix) bug: install from ciril.fr fails - -(done,pix)wizard for partitioning in case of one full vfat - -(done,dindinx)app for choosing drakxtools (drakxconf) -(done,pix)verify being root -(done,pix)log::l -> initlog - -(done,pix)install apmd for laptops (maybe not start apmd though) -(done,pix)icewm apm (sh icewm_apm) -(done,pix)kde apm (put Kapm.kdelnk in ~/Desktop/Autostart) - -(done,pix)bug in adduserdrake: missing pwconv in md5 -(done,pix)correct the default value of draksec (cp draksec) -(done,pix)in draksec, (and maybe others) have --expert as default if /etc/sysconfig/system has TYPE=expert - -(done,pix)bug in XFdrake in install, cancel in choose Card do not close the window - -(done,pix)in XFdrake, testing should not overwrite /etc/X11/XF86Config - -(done,pix) hwiz and supermount and eject :( - -(done(replaced by msec's),pix) bug: usermod -G urpmi a not done (full install) - -(done,pix)perl and .ph's - -(done,pix) BUG bootp in network install sigsegv - -(done,pix) move the last done stuff before Xconfiguration if possible - -(done,pix)draksec is buggy, don't try security >= 4 - -(done,pix)install apmd on laptops?? (maybe ask emcweb@btinernet.com (see alix)) - -(done,pix)missing alias ll for root - -(done,pix)urpmi.addmedia: |gzip instead of doing it afterwards - -(done,pix)locale (and fonts?) buggy in case ramdisk is used - -(done,pix)rpmdrake: Installed packages not in hdlist should be there - -(done)in ftp install, locale not installed properly - -(done,pix)pcmcia.img does not handle hd/cdrom - -(done,pix)cyrillic font buggy in DrakX - -(done,fred)remove xfs user from kdm - -(done,pix)bug with 2 cdrom drives (.kdelnk to there for 1st drive) - -(done,pix(works))test ramdisk stage2 and romanian - -(done,pix)kfmrc - -(done,pix)on laptop, default to 1024x768 - -(done,pix)mkinitrd and deps - -(done,fred(removed the call))XFdrake and mousedrake freeze if lothar launches them - -(done,pix)crypto message - -(done,pix)test bug with lilo and windows (if not on mbr) - -(done,pix)removed icons come back later (kde desktop) - -(done,pix(was bug in upgrade reading old config)) - segfault in linuxconf (adapter 1 empty) - (test with the sysconfig sent) - -(done,fpons)bug: Lrosqu'on effectue une mise à jour et que /etc/lilo.conf -contient la variable « default » positionnée sur autre chose que -« linux » ou « windows », DrakX est incapable de générer LILO. - -(done,fpons)bug: GeForce and hd.img? - -(done,fpons)for upgrade in expert, give choice of packages to install - choosing packages available in upgrade? - -(done,pix)rpmdrake: pb uninstalling package with dependencies (rpmdrake is killed?!) (as root too) - -(done,pix)noatime option for ext2 fs on laptops (do not wake up the hd) - Do not update inode access times on this - file system (e.g, for faster access on the - news spool to speed up news servers). - -(done,pix)kde's icons: 28 horiz and 25 vert grid for big icons - -(done,pix)bug: DrakConf don't follow the charset -> add setlocale(LC_ALL, "") -(done,pix)for ko|ja|zh, gnome-terminal should point to rxvt (-CLE) -(done,pix)group cdrom in /etc/group (gid=22) -(done,pix)drakxtools should require urpmi -(done,pix)bug: gdm unset LANG -(done,pix) zip with automount -> ppa not autoloaded -(done,pix)when you set the kde icons to Large, maybe it'd be good to chown the .kderc -(done,pix)lilo in russian/japaneese is horrible -(ok,pix)test ide burners -(ok)test check bad blocks optional for mke2fs -(done,pix)hd install: no umount is done at the end of install :( - -just before release: -(done,pix)- mandrake_doc-xx, the symlink is no good in /usr/doc/mandrake as -(done,pix)- crypto dependencies to update -(done,pix)- update kudzu's pcitable -(done,pix)- update pcitable for 86C368 if 3.3.6 (and other S3 3D's) - ("ATI|3D Rage P/M Mobility AGP 2x" -> changed to Server:Mach64) - -(done,pix)with 2MB of video ram, chooses 8bpp instead of 16bpp - -(done,pix) replace - { device => "loop7", type => 0x83, size => ((cat_('/dos/lnx4win/size.txt'))[0]*2048), mntpoint => "/", isFormatted => 1, isMounted => 1 }, -by - { device => "loop7", type => 0x83, size => cat_('/dos/lnx4win/size.txt') * 2048, mntpoint => "/", isFormatted => 1, isMounted => 1 }, - -(done,fpons)in ftp install, bug with X server install with wu-ftpd 2.6 (see http://www.wu-ftpd.org/broken-clients.html) - -(done,pix)ask package installation languages (must be put in RPM_INSTALL_LANG) - -(done,pix)bug (by dadou): Si la partition racine est trop petite pour installer le système, un -message d'erreur apparaît pour signaler le problème (bien) mais on ne -peut en sortir. La seule solution est de redémarrer. - -(obsolete)bug when selecting compssUsers, do not deselect after (if u deselect) - -(done,pix)detect ide burners and then add hdX=ide-scsi to kernel cmdline - -(done,pix)urpmi: handle many args on cmd-line - -(done,pix)fix any // in path to ftp server otherwise windobe server bug :( - -(done,pix)diskdrake and auto partitioning, may have the last creation of partition rejected, -try to figure why? - -(done,pix)in chooseResolutions: display the graphic card found - -(done,pix)with pcmcia, need ONBOOT=no - -(fpons,done) XFree: handle by card options -eg: SIS6326 needs "no_bitblt" "no_bltimage" and 24bpp instead of 32bpp - -(done,pix) Xconfiguration: if "can't open fixed font", relaunch xfs. - -(obsolete) pb with dependencies ``missing'': icewm do not require XFree86 and so you can have icewm but no X server - -(obsolete) bug in ext2resizing (no sparse superbloc, don't finish properly) - -(done,pix,7.1)manage a lot of language (ergonomic issue as it already exists) - -(done,pix,7.1)tree for choosing things like timezone, monitors, graphic cards, modules, mice, keyboard? ... - -(done,pix,7.1)sound config, although very simple, no dedicated steps and only PCI (or maybe ISA-PNP if time left ?) - -(done,pix,7.1)partitioning, keyboard shortcut. - -(done,fpons,7.1)index/compress hdlist? (for multi-cd) -! for multi-cd live is mandatory, small transaction are mandatory too. - -(done,pix,7.1?)loopback partitions (even root one) - -(done,pix)in ok_cancel, focus has 3 states, should be 2 (ask dindinx) - -(done,pix,7.1)Generally improved package selection /ergonmic issue. -Tree -> CTree, ``all'' branch with all packages -show the value associated (100->a must, 90->great, 80->nice, ... 10->useless, 0->do not install) - -(done,pix)let diskdrake have dos/win partition automatically set up with mount point, -this will help loopback too. - -(done,pix,7.1)grub - -(done,pix,7.1)feature missing: cancel installation - -(obsolete) bug in diskdrake: can in strange cases create a primary partition at sector #0 - -(done,pix(partly, protection against bugging))bug in diskdrake: -in expert: blank, create hda5 at beginning, create hda6 at the end, create hda7 -in the middle, remove the first one. Result hda5 at the end and bug. - -(obsolete) have a better time estimation of the remaining time in install packages - -(done,dindinx+pix)ask_many_from_list can't keyboard scroll - -(done,pix,7.1)individual package selection: double click is tiring... - -(done,fpons,7.1) sparc ehancement, avoid V7+ machine target (div and mul not in v7 standard) - -(done,fpons,7.1)syslinux in graphical mode to be improved for heavily bogus BIOSes. - -(done,pix)missing feature in lilo configuration: can't give hda2 with /boot/vmlinuz if -already hda1 with /boot/vmlinuz - -(done,pix)in 640x480 install box is to small (cuz of 'Cancel' button beeing added) - -(done,pix)chooseGroup with individual alone - -(done)(7.1) rewrite crypto stuff -(done)crypto: add a cancel & progress bar while downloading -(done)error handling (like reading hdlist) -(done)(7.1)progression bar on crypto. - -(done, daouda&pix,7.1, other persons)rescue: -- small modification for stage1 to get the rescue stage2 -- create a stage2 with many tools (fdisk, bash...) -the rescue could be on another cd (if multi-cd) -! care must be taken about modules (if ide is in module...) - -(done,7.1)install in 800x600 -- need handling of both 640x480 (mostly for VGA16) and 800x600 - -(done,NEED 7.1) auto-install for corporate, very important (need consolidation). diff --git a/docs/advocacy b/docs/advocacy deleted file mode 100644 index 9e7f00b6b..000000000 --- a/docs/advocacy +++ /dev/null @@ -1,87 +0,0 @@ -a little DrakX history: - -june 1999: - i start rewriting redhat's install in perl, partly for the fun of it. I'm - still working for the army - -5 july 1999: - i start full time job at mandrakesoft. But we don't have many computers and i - must share the accounting computer with Merieme who is working half-time. No - test machine (i test on others box, and destroyed Jacques partitions once), - guess how it slows things down? - -august 1999: - at last computers, even test one - first DrakX version which can install things, very very rough - -september 1999: - a friend of mine help me 2 weeks on DrakX relayed by Francois - -november 1999: - first released version of DrakX (goldpack). Not really stable yet. - -january 2000: - 7.0 is out, with a DrakX quite stable - -july 2000: - dams starts working on draknet - -mid-october -> mid-january 2000: - gc rewrites the stage1 to win every kb we can - -> size divided by 7 (!) for cdrom - - -The DrakX team is also doing a lot of other things: -- drakxtools -- urpmi, early MandrakeUpdate, early rpmdrake... -- Mandrake Control Center (new DrakConf) -- packages maintenance/enhancing (esp. ghostscript, 3D-wrappers, lilo) -- fixing core packages to make them installable -- scoring packages, sorting them, flagging them... (compssList, rpmsrate) -- reading/answering cooker and other MLs -- helping non-perl gurus :) - -That doesn't give much. Me being the one more working on plain DrakX. It gives 2 -people working for 1.5 years. IMO it isn't ``spending an enormous amount of -resources''. -And what do you mean by ``compared to the code base size''??? DrakX is currently -around 28K lines, which is big IMO. You can compare it with linuxconf which is -170K lines. I think the achievement of DrakX is comparable (a 6 times code size -win from dumb C++ to expressive perl is normal imo). - - -Also it seems like we don't have the same understanding of the word -"maintenance". -DrakX functionalities have evolved *a lot* since the beginning: - -- hardware detection, configuration, debugging, work-arounding (multi-kernel installs...) -- making things prettier - - more bitmaps - - "advanced" button - - syslinux graphical boot -- making it work with latest versions of software (eg: switching to rpm4) -- finding out the best way to use rpmlib -- multi-cd -- draknet: configuring every piece of stupid protocols -- diskdrake: raid, loopback, LVM, resizing, checking stupid users entry -- XFdrake: multi-mice, multi-heads, 3D-accel -- porting to axp/sparc/ppc (with Stew's help) -- always more i18n -- keeping things small - - .cz format - - moving to .png - - getFile on demand from mdkinst for ramdisk installs - -[...] - -> You don't believe the books ? Count yourself; see the man/months spent -> in 'pure' developoment in drakX, and the resources put in mantainance -> of the code base; as far as i know, your count should confirm what the -> books says; more probabily, you will discover that our numbers are -> even worse. - -if you count enhancements, adding features... in maintenance, i confirm the -numbers, and find them quite normal. - -if you only count bug fixing, the time would be much shorter (around 30%). - diff --git a/docs/advocacy-interactive b/docs/advocacy-interactive deleted file mode 100644 index 99036008e..000000000 --- a/docs/advocacy-interactive +++ /dev/null @@ -1,60 +0,0 @@ - -> > We already have some functional backends, frontends, that works great, and has -> > not been thrown away since 1 year. We use it during install, post install, mcc -> > and so. -> -> But aren't generic enough. - -DrakX handles: -- buttons -- bool values (checkboxes) -- ranges -- entries -- combo boxes (editable or not) -- lists / radio boxes -- tree lists -- iconlist -- wait messages - -Features: -- all the entries above can be mixed -- nice separation between data and displayed data (eg: choose in list of -objects representing hda/hdb/... but displayed nicely with size...) -- keyboard handled nicely in GTK frontend -- callback on events: - ok pressed => check before the dialog is hidden - focus changed => - * enables pre-setting things based on other entries - * value checking on the fly -- simple/advance toggle -- shadowing of entries -- tooltips -- size of windows computed the best possible -- perl-based - -Misfeatures: -- display not flexible (though i don't know any of the tools we're talking -about that is flexible => nice) -- quite a few features are gtk only (simple/advance toggle, shadowing of -entries, certain events, tooltips). -- a stdio front-end exist but handle only certain entries. It would need a -week-work to finish it -- a http front-end could be done (mod-perl needed) -- perl-based - -The DrakX frontend (called "interactive") could be moved out of DrakX. - -eg of use: - -<#part type="text/plain" filename="~/bin/perl/imessage" disposition=attachment> -<#/part> - -[...] - -> > -provides a lot of frontends -> -> And you ideally have to provide a frontend by widget set. - -nope. The interface is completly standardised, even if it include some -gtk-like niceties. The *complete* newt (and not just entries and radioboxes -like bus) binding takes 241 lines. diff --git a/docs/comparisons b/docs/comparisons deleted file mode 100644 index cdf95b33a..000000000 --- a/docs/comparisons +++ /dev/null @@ -1,51 +0,0 @@ -redhat 6.1 (fr?), install 766MB, df 900MB, 35min (asked for all groups except "everything") - -upgrade to redhat 6.2, sum 757MB, df 936MB, 20min - -mandrake 7.1, install 755MB, df 1091MB, 17min (asked install size 910MB), 515 packages - -upgrade to cooker, sum 1000MB, df 1404MB, 35min - - -redhat 7.0b, install 815MB, df 960MB, 18min -redhat 7.0, install 995MB, df MB, 26min - -7.2b, 3.3GB 2h26 - - -7.2b: (lang fr) -compssLevel df rpm time fs df/time - -100 64 59 0:59 ext2 500M 1.08 - 90 132 127 1:50 ext2 500M 1.20 - 80 226 218 3:26 ext2 500M 1.10 - 70 449 387 5:52 ext2 1G 1.28 - 60 614 541 8:36 ext2 1G 1.19 - 50 1113 943 17:40 ext2 2G 1.05 - 40 1193 1013 20:39 ext2 2G 0.96 - 30 1262 1072 22:28 ext2 2G 0.94 - 20 1445 1219 27:34 ext2 2G 0.87 - 10 1649 1394 36:58 ext2 2G 0.74 - 0 1943 1638 48:02 ext2 2G 0.67 --10 2957 2519 101:49 ext2 4G 0.48 - -7.2b: (lang all) -compssLevel df rpm time fs df/time - -100 70 59 1:04 ext2 500M 1.09 - 90 289 281 4:20 ext2 500M 1.11 - 80 373 361 5:41 ext2 500M 1.09 - 70 890 794 13:28 ext2 1G 1.10 - - -mem used 7.2cooker -gtk: runinstall2 13608(data 9572) + FBDev 2984(data 1544) -newt: runinstall2 9516(data 7528) -stdio: runinstall2 9160(data 7372) - -8.0rc1: (lang fr) - -rpmsrate - -4 all 831 786 18:08 reiserfs 2G -4 () 175 139 3:25 reiserfs 2G diff --git a/docs/diskdrake.TODO b/docs/diskdrake.TODO deleted file mode 100644 index e6f2da038..000000000 --- a/docs/diskdrake.TODO +++ /dev/null @@ -1,23 +0,0 @@ -- test what windows can handle (the number of partitions) -- better keyboard focus handling -- end sector in Create -- add warnings for scsi drives if you create more than sdx15 -- the information put in save/restore partitions must be cleaned -(remove mounted/formatted/..., also remove the Data::Dumper dependency) -- test, test, test -- do not allow swap partitions above 2Gigs -- wanting the first partition to be extended is not used -- maybe warn if a mounted partition change of dev number -- text version -- better error handling (what to do if we find a bad partition table?) -- display the information about the correspondance color2type -- handle the partition labels (missing information here) -- add comments in the code -- add documentation -- handle the `luke' case (main extended partition must be extended) -- ability to batch actions (like chained moves) -- add a verification after fdiskReadPartitionTable that the start_cyl, -end_cyl... do correspond to start and start+size. For the moment, this -information is just discarded :( -This verif can't be done in fdiskReadPartitionTable as start is relative in -extended partitions diff --git a/docs/draknet_advanced_doc.txt b/docs/draknet_advanced_doc.txt deleted file mode 100644 index a0c0c63e0..000000000 --- a/docs/draknet_advanced_doc.txt +++ /dev/null @@ -1,165 +0,0 @@ -This document details the entry points you can call without the DrakX graohical -toolkit. First, the general variables you will encounter further. If you don't -know wht a variable is, look here. Any additional locally variables are -commented 'in place' - ------------------------------- -Special types (in upper cases) ------------------------------- - DB_FILE : file storing the ISDN ISP database. see share/isdndb.txt : file of lines in 'Unlisted - edit manually' or /^(.*)\|(.*)\|(.*)=>([0-9]*)=>(.*)=>(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})=>(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$/ where $1=Land $2=City $3=ISP_name $4=phone_number $5=hostname $6=dns1 $7=dns2 - ---------------------------------------------------------------------------------------- -Summary of common variables used (local variables are described in the function itself) ---------------------------------------------------------------------------------------- -notation : keys : description : type : format (regexp or enumeration. `...' means it's not exhaustive - $prefix : prefix path (empty in post-install) : string : path - $isLaptop : flag for laptop : boolean or int : guess - $isdn : hash table containing isdn infos - $isdn->{login} : cnx login : string - $isdn->{passwd} : cnx passwd : string - $isdn->{phone_in} : user phone : /^[0-9]*$/ - $isdn->{phone_out} : ISP phone : /^[0-9]*$/ - $isdn->{dialing_mode} : dialing mode : "auto" or "manual" - $isdn->{driver} : driver used for the card : "hisax" or "b1pci" or ... - $isdn->{type} : type of card, used for the driver, see netconnect_consts : integer : /^[1-22]|[24-37]$/ - $isdn->{irq} : irq of the ISA card : integer | - $isdn->{mem} : mem of the ISA card : string | - $isdn->{io} : io of the ISA card : string | see netconnect_consts for examples. - $isdn->{io0} : io0 of the ISA card : string | - $isdn->{io1} : i01 of the ISA card : string | - $isdn->{idl} : amount of time after the cnx times out in secs : int - $isdn->{user_name} : not used anymore. Not explicit. It represented the name of the connexion. - $isdn->{card_type} : card type : string : "isa" or "pci" or "pcmcia" - $isdn->{protocol} : cnx protocol : int : 1|2|3 : 1 for old german specific (not used anymore), 2 for europe, 3 for rest of the world - $isdn->{id} : card id. Associated with vendor, identify strictly the card. see pcitable : integer - $isdn->{description} : card description from pcitable : string - $isdn->{vendor} : card vendor : integer - $isdn->{passwd2} : passwd verification : string - $modem : hash table containing modem infos - $modem->{device} : device of the modem : string : /ttyS[0-9]/ - $adsl : hash table containing modem infos - $adsl->{login} : cnx login : string - $adsl->{passwd} : cnx passwd : string - $adsl->{atboot} : - $netc : hash table containing system-wide networking infos (maybe not true, correct this) : - $netc->{NET_DEVICE} - $netc->{dnsServer2} - $netc->{dnsServer3} - $netc->{DOMAINNAME2} - $netc->{NET_INTERFACE} is set to "ppp0" - $in : interactive object - ------------- -Entry points ------------- - -isdn_write_config_backend : write isdn info, only for ippp0 -> ask_connect_now -input : - $prefix - $isdn -$isdn input: - $isdn->{login} $isdn->{passwd} $isdn->{phone_in} $isdn->{phone_out} $isdn->{dialing_mode} - $isdn->{driver} $isdn->{type} $isdn->{irq} $isdn->{mem} $isdn->{io} $isdn->{io0} $isdn->{io1} - -write_secret_backend : write login and passwd into /etc/ppp/{chap, pap}-secrets. Replace old passwd only if same login -input : - $a : login : string : /^.*$/ - $b : passwd : string : /^.*$/ - -connect_backend : launch the cnx script -input : $prefix - -connect_backend : launch the cnx script -input : $prefix - -read_providers_backend : build the tree of isdn ISP -input : - $file : 1st location of the file : ISDN_DB_FILE - $file2 : 2nd location of the file : ISDN_DB_FILE -output : the list of ISP : array of strings : array of /^(.*)\|(.*)\|(.*)$/ where $1=Land $2=City $3=ISP_name - -get_info_isdn_backend : fills the infos from the line of the tree returned into $isdn and $netc -input : - $isdn - $netc - $name : the line choosen in the tree of ISP : string : /^(.*)\|(.*)\|(.*)$/ with $1=Land $2=City $3=ISP_name - $file : 1st location of the file : ISDN_DB_FILE - $file2 : 2nd location of the file : ISDN_DB_FILE -$isdn ouput - $isdn->{user_name}, $isdn->{phone_out}, $netc->{DOMAINNAME2}, $netc->{dnsServer2}, $netc->{dnsServer3}, -$netc output - $netc->{DOMAINNAME2}, $netc->{dnsServer2}, $netc->{dnsServer3} - -isdn_detect_backend : detects isdn pci card and fills the infos in $isdn : only detects one card -input - $isdn -$isdn output: - $isdn->{description} $isdn->{vendor} $isdn->{id} $isdn->{driver} $isdn->{card_type} $isdn->{type} - -isdn_get_list : return isdn cards descriptions list. This function is not use internally. -output : descriptions : list of strings - -isdn_get_info : return isdn card infos. This function is not use internally. -input : the description of the card (see isdn_get_list) -output : a reference on the decription of the card. : ref on a hash(description,type,irq,mem,io,io0,io1card,) - -conf_network_card_backend : configure the network cards and return the list of them, or configure one specified interface : WARNING, you have to setup the ethernet cards, by calling setup_thiskind($in, 'net', !$::expert, 1) or setup_thiskind_backend before calling this function. Basically, you call this function in 2 times. -input - $prefix - $netc - $intf - $type : type of interface, must be given if $interface is : string : "static" or "dhcp" - $interface : facultative, if given, set this interface and return it in a proper form. If not, return @all_cards - $ipadr : facultative, ip address of the interface : string - $netadr : facultative, netaddress of the interface : string -when $interface is given, informations are written in $intf and $netc. If not, @all_cards is returned. -$intf output: $device is the result of - $intf->{$device}->{DEVICE} : which device is concerned : $device is the result of $interface =~ /(eth[0-9]+)/; my $device = $1;; - $intf->{$device}->{BOOTPROTO} : $type - $intf->{$device}->{NETMASK} : '255.255.255.0' - $intf->{$device}->{NETWORK} : $netadr - $intf->{$device}->{ONBOOT} : "yes" -$netc output: - $netc->{nb_cards} : nb of ethernet cards - $netc->{NET_DEVICE} : this is used to indicate that this eth card is used to connect to internet : $device -output: - $all_cards : a list of a list ( (eth1, module1), ... , (ethn, modulen)). Pass the ethx as $interface in further call. - $device : only returned in case $interface was given it's $interface, but filtered by /eth[0-9+]/ : string : /eth[0-9+]/ - -adsl_conf_backend : write adsl configuration -input : - $prefix - $adsl - $netc - $adsl_type : type of cnx : string : "pptp" or "pppoe" -$adsl input: - $adsl->{login}, $adsl->{passwd}, $adsl->{atboot} -$netc input: - $netc->{NET_DEVICE} - $netc->{dnsServer2} - $netc->{dnsServer3} - $netc->{DOMAINNAME2} -$netc output: - $netc->{NET_INTERFACE} is set to "ppp0" - -modem_detect_backend : detects modem on serial ports and fills the infos in $modem : detects only one card -input - $modem - $mouse : facultative, hash containing device to exclude not to test mouse port : ( device => /ttyS[0-9]/ ) -output: - $modem->{device} : device where the modem were detected - -get_net_device : return the device choosen for the net cnx -no input -output : name of the internet device. - -read_net_conf : read the information stored in $prefix/etc/sysconfig/draknet and $prefix/etc/sysconfig/draknet.`type` -input: - $prefix - $netcnx - $netc - -set_net_conf : set the information from netcnx in $prefix/etc/sysconfig/draknet and $prefix/etc/sysconfig/draknet.`type` - $prefix - $netcnx - $netc : useless! REMOVE ME diff --git a/docs/mdk-vs-redhat b/docs/mdk-vs-redhat deleted file mode 100644 index 4d0de8223..000000000 --- a/docs/mdk-vs-redhat +++ /dev/null @@ -1,43 +0,0 @@ -+ Open Development (at least DrakX) -+ UDMA66 (HPT366) -+ gamerz -+ number of packages -+ better packages(?) -+ no automatic handling of ide burners -+ urpmi/rpmdrake -+ XFdrake -+ no newbie install -+ reiserfs -+ fat resizing -+ 3D handling (eg: Voodoo3) -+ diskdrake (vs diskdruid) -+ usb storage (?) -+ KDE2 -+ faces in kdm/gdm -+ menu -+ alternatives -+ /etc/emacs/site-start.d -+ default config -+ i18n (bootloader keyboard) - -+ More user-friendliness in general: - + you can choose between multiple net devices when more than one are - detected - + you are presented with the media descriptions (disks, cdrom's) - when you must choose between multiple media, and not only "sda", - "hdc", .. - + when installing from a disk partition, you are presented with an - extract of the directory contents when you fail to give the - correct location, which is very helpful to correct the input - instead of simply rebooting to remember where on earth you - mirrored the distribution on your disks - -+ Automatic mode (Redhat's equivalent is called "kickstart") is not - performed according to a file on the floppy but from kernel parameters, - which have many pros, among them: (1) we don't need the vfat filesystem - for that purpose, and (2) with advanced bootloaders such as grub and - lilo you can edit parameters on the fly at boot time. - -- no LABEL= in fstab (for auto renumbering of devices) -- kerberos -- LDAP diff --git a/docs/net_object_class.fig b/docs/net_object_class.fig deleted file mode 100644 index 19f7f5318..000000000 --- a/docs/net_object_class.fig +++ /dev/null @@ -1,73 +0,0 @@ -#FIG 3.2 -Landscape -Center -Inches -Letter -100.00 -Single --2 -1200 2 -1 1 0 1 0 7 50 0 -1 0.000 1 0.0000 4050 4162 675 338 4050 4162 4725 4500 -1 1 0 1 0 7 50 0 -1 0.000 1 0.0000 5700 3112 675 338 5700 3112 6375 3450 -1 1 0 1 0 7 50 0 -1 0.000 1 0.0000 7275 4087 675 338 7275 4087 7950 4425 -1 1 0 1 0 7 50 0 -1 0.000 1 0.0000 4800 1462 975 487 4800 1462 5775 1950 -1 1 0 1 0 7 50 0 -1 0.000 1 0.0000 2700 3112 675 338 2700 3112 3375 3450 -1 1 0 1 0 7 50 0 -1 0.000 1 0.0000 4875 5887 975 487 4875 5887 5850 6375 -1 1 0 1 0 7 50 0 -1 0.000 1 0.0000 9450 5062 675 338 9450 5062 10125 5400 -1 1 0 1 0 7 50 0 -1 0.000 1 0.0000 4654 4038 3900 3225 4654 4038 754 813 -2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2 - 0 0 1.00 60.00 120.00 - 4125 1875 3225 2850 -2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2 - 0 0 1.00 60.00 120.00 - 4575 1950 4200 3750 -2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2 - 0 0 1.00 60.00 120.00 - 5250 1950 5475 2775 -2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2 - 0 0 1.00 60.00 120.00 - 3000 3450 3600 3900 -2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2 - 0 0 1.00 60.00 120.00 - 5925 3450 6675 3900 -2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2 - 0 0 1.00 60.00 120.00 - 2700 3450 4050 5550 -2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2 - 0 0 1.00 60.00 120.00 - 4125 4500 4575 5400 -2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2 - 0 0 1.00 60.00 120.00 - 5625 3450 5025 5400 -2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2 - 0 0 1.00 60.00 120.00 - 5775 1575 9450 4725 -2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2 - 0 0 1.00 60.00 120.00 - 7800 4275 9000 4800 -2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2 - 0 0 1.00 60.00 120.00 - 4800 1950 4800 5400 -2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2 - 0 0 1.00 60.00 120.00 - 9000 975 9450 4725 -2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 - 7500 75 10687 75 10687 975 7500 975 7500 75 -2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2 - 0 0 1.00 60.00 120.00 - 7500 375 5400 1050 -2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2 - 0 0 1.00 60.00 120.00 - 5550 1800 7200 3675 -4 0 0 50 0 0 12 0.0000 4 135 885 4350 1500 Netconnect\001 -4 0 0 50 0 0 12 0.0000 4 135 435 2475 3150 ISDN\001 -4 0 0 50 0 0 12 0.0000 4 135 720 3675 4200 MODEM\001 -4 0 0 50 0 0 12 0.0000 4 135 960 6825 4125 ETHERNET\001 -4 0 0 50 0 0 12 0.0000 4 135 480 5400 3150 ADSL\001 -4 0 0 50 0 0 12 0.0000 4 135 420 4650 5925 Tools\001 -4 0 0 50 0 0 12 0.0000 4 135 660 9150 5100 Network\001 -4 0 0 50 0 0 12 0.0000 4 135 1305 8400 375 Rest of the world\001 -4 0 0 50 0 0 12 0.0000 4 180 2595 7725 600 (draknet, printerdrake, tinyfirewall\001 -4 0 0 50 0 0 12 0.0000 4 180 2310 7725 825 ftp, http, net_monitor, drakgw)\001 -4 0 0 50 0 0 12 0.0000 4 195 2760 3525 6825 Global variables $in, $prefix, $install\001 -4 0 0 50 0 0 12 0.0000 4 180 2340 3525 7050 shared with the module globals\001 diff --git a/docs/object_class.fig b/docs/object_class.fig deleted file mode 100644 index 44fd3fe89..000000000 --- a/docs/object_class.fig +++ /dev/null @@ -1,32 +0,0 @@ -#FIG 3.2 -Landscape -Center -Inches -Letter -100.00 -Single --2 -1200 2 -2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2 - 2625 1200 2625 1725 -2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2 - 7575 1125 7575 1650 -2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2 - 7575 2100 4350 3225 -2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2 - 5025 2025 4350 3225 -2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2 - 2625 2100 4350 3225 -2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2 - 5025 2025 6075 4125 -2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2 - 2625 1200 4950 1725 -2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2 - 7575 1125 4950 1725 -4 0 0 100 0 0 12 0.0000 4 180 1755 1800 1050 install_steps_gtk\001 -4 0 0 100 0 0 12 0.0000 4 180 1440 6900 975 install_steps_stdio\001 -4 0 0 100 0 0 12 0.0000 4 180 1140 2100 1950 interactive_gtk\001 -4 0 0 100 0 0 12 0.0000 4 180 1275 6900 1950 interactive_stdio\001 -4 0 0 100 0 0 12 0.0000 4 180 1875 4125 1950 install_steps_interactive\001 -4 0 0 100 0 0 12 0.0000 4 135 810 3975 3450 interactive\001 -4 0 0 100 0 0 12 0.0000 4 180 975 5625 4350 install_steps\001 diff --git a/docs/wizard.doc b/docs/wizard.doc deleted file mode 100644 index 0bbf8d254..000000000 --- a/docs/wizard.doc +++ /dev/null @@ -1,31 +0,0 @@ -How to handle wizard? - -to switch in wizard mode: -set $::isWizard to true; -if $::Wizard_no_previous is set to true, the wizard won't display the previous button. Usefull for first step -if $::Wizard_finished is set to true, the wizard will display Finish instead of Next. Usefull for last step - -how to code: -Code as if there were no wizard. -OK button is displayed as Next -Cancel is displayed as Previous -a additional button Cancel is added, xhich die with the exception 'wizard_cancelled' - -You have to handle the previous button. For example: - -step 1: -ask_from list( blablablabl) or return; -step2: -ask_from list( blablablabl) or goto step1; -step3: -ask_from list( blablablabl) or goto step2; - -etc... You don't have to handle the wizard Cancel button as it send an exception. - -Understood? If yes, you'll see that there is a pb with ask_yesorno. In this case, yes+next returns true, no+next returns false, Cancel send the exception 'wizard_canceled' and previous send the exception 'wizard previous'. So you have to handle the previous button manually. - -plop. - -dam's, pour vous servir - - diff --git a/live_update b/live_update deleted file mode 100644 index 0778b4ae8..000000000 --- a/live_update +++ /dev/null @@ -1,77 +0,0 @@ -#!/bin/sh - -message=/usr/X11R6/bin/gmessage -[ -x $message ] || message=/usr/X11R6/bin/xmessage -[ -x $message ] || unset message - -if [ "$UID" -ne 0 ]; then - if [ -x "$message" ]; then - case "$LANG" in - fr*) buttons="Arrêter:0" - msg="Mise à jour en direct de Mandrake Linux. - -Vous devez être l'utilisateur root pour lancer cette application." ;; - *) buttons="Abort:0" - msg="Mandrake Linux live upgrade. - -You need to be root to start this program." ;; - esac - $message -buttons "$buttons" -print "$msg" - else - echo >&2 "You need to be root to start this program." - fi - exit 3 -fi - -distrib=`pwd`; -if [ ! -x "$distrib/Mandrake/mdkinst/usr/bin/perl-install/live_install" ]; then - distrib="/mnt/cdrom" -fi -if [ ! -x "$distrib/Mandrake/mdkinst/usr/bin/perl-install/live_install" ]; then - if [ -x "$message" ]; then - case "$LANG" in - fr*) buttons="Arrêter:0" - msg="Mise à jour en direct de Mandrake Linux. - -Impossible de trouver le Cédérom d'installation de Mandrake Linux dans le premier lecteur." ;; - *) buttons="Abort:0" - msg="Mandrake Linux live upgrade. - -Unable to find Mandrake Linux Installation Cd-Rom in the first drive." ;; - esac - $message -buttons "$buttons" -print "$msg" - else - echo >&2 "Unable to find Mandrake Linux Installation Cd-Rom in the first drive." - fi - exit 2 -fi - -if [ -x "$message" ]; then - case "$LANG" in - fr*) buttons="Mise à jour:0,Annuler:1" - msg="Mise à jour en direct de Mandrake Linux. - -Appuyez sur \"Mise à jour\" pour lancer la mise à jour de votre système, -cela prendra quelques minutes avant que l'écran de DrakX apparaisse. - -Appuyez sur \"Annuler\" pour ne pas mettre à jour votre système de cette manière." ;; - *) buttons="Upgrade:0,Cancel:1" - msg="Mandrake Linux live upgrade. - -Press \"Upgrade\" to start live upgrade on your system, note this will -take some time to prepare the system before DrakX screen appears. - -Press \"Cancel\" to avoid upgrading your system this way." ;; - esac - default=`echo $buttons | cut -d: -f1` - $message -buttons "$buttons" -default "$default" -print "$msg" - [ $? -ne 0 ] && exit 1 -else - echo >&2 "Press ENTER to start live upgrade on your system, note this will -take some time to prepare the system before DrakX screen appears. - -Press CTRL-C to avoid upgrading your system this way." -fi - -cd "$distrib/Mandrake/mdkinst/usr/bin/perl-install" && exec ./live_install -exit 2 diff --git a/make_boot_img b/make_boot_img deleted file mode 100755 index 2de5e52be..000000000 --- a/make_boot_img +++ /dev/null @@ -1,468 +0,0 @@ -#!/usr/bin/perl - -@ARGV >= 2 or die "usage: $0 <image> all|other|cdrom|hd|network|usbnet|blank|pcmcia|live|tftp|tftprd\n"; - -use Config; -Config->import; -my ($arch) = $Config{archname} =~ /(.*)-/; -my $corporate = $ENV{CORPORATE} && " corporate"; #- use this for building a corporate version. - -($img, $type) = @ARGV; - -$instdir = "mdk-stage1"; -$mnt = "/tmp/drakx_mnt"; -$mke2fs = "/sbin/mke2fs -q -m 0 -F -s 1"; - -if ($>) { - $sudo = "sudo"; - $ENV{PATH} = "/sbin:/usr/sbin:$ENV{PATH}"; -} - -sub __ { print @_, "\n"; system(@_); } -sub _ { __ @_; $? and die; } - -_ "$sudo mkdir $mnt" unless -e $mnt; -_ "$sudo mkdir ${mnt}2" unless -e "${mnt}2"; - -$install = $ {{ - all => "stage1-full", - other => "stage1-full", - blank => "stage1-full", - live => "stage1-full", - tftp => "stage1-full", - tftprd => "stage1-full", - pcmcia => "stage1-full", - network => "stage1-network", - usbnet => "stage1-usbnet", - cdrom => "stage1-cdrom", - hd => "stage1-disk", - live64 => "stage1-full", - tftp64 => "stage1-full", - tftprd64 => "stage1-full", - pcmcia64 => "stage1-full", - network64 => "stage1-network", - cdrom64 => "stage1-cdrom", - hd64 => "stage1-disk", -}}{$type} or die; - -mkdir "images"; -chomp($main = `cat all.kernels/.main`); - -if ($img =~ /blank|other/) { - @kernels = $main; -} else { - @kernels = map { m|all.kernels/(.*)| } glob('all.kernels/*'); -} - -foreach (@kernels) { - if ($img =~ /rdz$/) { - initrd($mnt, "$img-$_"); - } else { - $::{"boot_img_$arch"}->($mnt, "$img-$_", glob("all.kernels/$_/boot/vmlinu*")); - } -} -rename("$img-$main", "$img"); - -sub install_stripped { _ "strip $_[0]"; _ "$sudo install $_[0] $_[1]" } - -sub initrd { - my ($mnt, $img) = @_; - my ($ltype, $I) = $type =~ /(.*?)(64)/; $ltype ||= $type; - my $tmp = "$ENV{HOME}/tmp/initrd"; - my $tar = "$instdir/stage1-data/stage1.tar.bz2"; - - __ "$sudo umount $tmp $mnt 2>/dev/null"; - _ "dd if=/dev/zero of=$tmp bs=1k count=" . ($arch =~ /ia64/ ? ($type eq "all" ? 16386 : 16384) : ($type eq "all" ? 4000 : 2000)); - _ "$mke2fs $tmp"; - _ "$sudo mount -t ext2 $tmp $mnt -o loop"; - - _ "$sudo tar xjC $mnt -f $tar"; - install_stripped("$instdir/init", "$mnt/sbin"); - install_stripped("$instdir/$install", "$mnt/sbin/stage1"); - - if ($type eq "network" || $type eq "usbnet" || $type eq "all" || $type eq "other" || $type eq "blank") { - install_stripped("$instdir/ppp/pppd-bin", "$mnt/sbin/pppd"); - install_stripped("$instdir/rp-pppoe/pppoe-bin", "$mnt/sbin/pppoe"); - _ "$sudo cp -a /dev/ppp $mnt/dev"; - _ "$sudo cp -a /dev/ptyp0 $mnt/dev"; - _ "$sudo cp -a /dev/ttyp0 $mnt/dev"; - } - - my $ftype = $type =~ /^(all)$/ ? "pcmcia" : $type; - if ($ftype eq "pcmcia" && $arch !~ /ppc/ && $arch !~ /ia64/) { - _ "$sudo cp -a /etc/pcmcia $mnt/etc"; - _ "$sudo patch -p0 -d $mnt/etc < $instdir/pcmcia_config.patch"; - } - my ($ext) = $img =~ /rdz-(.*)/ or die "bad initrd name ($img)"; - $modz = "all.modules$I/$ext"; - _ "$sudo cp -f $modz/${ltype}_modules.mar $mnt/modules/modules$I.mar" if $type !~ /blank/; - _ "$sudo cp -f $modz/modules.dep $mnt/modules/"; - _ "$sudo umount $mnt"; - - -# Workaround for vfat-loop bug (quite touchy) - _ "gzip -9f $tmp"; - _ "cp -f $tmp.gz $img"; - _ "rm -f $tmp.gz"; -# _ "gzip -9 -c $tmp > $img"; -# _ "rm -f $tmp"; -} - -sub boot_img_i386 { - my ($mnt, $img, $kernel) = @_; - - __ "$sudo umount $mnt 2>/dev/null"; - my $automatic = ""; - - if ($type eq "hd") { - _ "bunzip2 -c $instdir/init-data/msgboot.img.bz2 > $img"; - } elsif ($type eq "all") { - _ "bunzip2 -c $instdir/init-data/msgboot-graphicallogo-2880.img.bz2 > $img"; - } else { - _ "bunzip2 -c $instdir/init-data/msgboot-graphicallogo.img.bz2 > $img"; - } - - $automatic = "automatic=method:cdrom" if ($type eq "cdrom"); - $automatic = "automatic=method:disk" if ($type eq "hd"); - - _ "$sudo mount -t vfat -o umask=0 $img $mnt -o loop"; - _ "cat $kernel > $mnt/vmlinuz" if $type !~ /blank/; - - my $rdz = $img; $rdz =~ s/\.img/.rdz/; - initrd("${mnt}2", $rdz) if !-e $rdz; - eval { _ "cp -f $rdz $mnt/$type.rdz" }; - if ($@) { - unlink "$mnt/$type.rdz"; - my $avail = (split ' ', `df $mnt`)[-3]; - my $s = int((-s $rdz) / 1024); - die sprintf("not enough room for $rdz: need %dKB (available %dKB < needed %dKB)\n", $s - $avail, $avail, $s); - } - -# my $ftype = $type =~ /^(other|all)$/ ? "cdrom" : $type; - my $timeout = 72; - output("$mnt/syslinux.cfg", -"default linux -prompt 1 -timeout $timeout -display boot.msg -F1 help.msg -F2 boot.msg -label linux - kernel vmlinuz - append ramdisk_size=32000 initrd=$type.rdz $automatic root=/dev/ram3 vga=788 -label vgalo - kernel vmlinuz - append ramdisk_size=32000 initrd=$type.rdz $automatic root=/dev/ram3 vga=785 -label vgahi - kernel vmlinuz - append ramdisk_size=32000 initrd=$type.rdz $automatic root=/dev/ram3 vga=791 -label vga16 - kernel vmlinuz - append ramdisk_size=32000 initrd=$type.rdz $automatic root=/dev/ram3 vga16 -label text - kernel vmlinuz - append ramdisk_size=32000 initrd=$type.rdz $automatic root=/dev/ram3 text -label patch - kernel vmlinuz - append ramdisk_size=32000 initrd=$type.rdz $automatic root=/dev/ram3 patch vga=788 -label expert - kernel vmlinuz - append ramdisk_size=32000 initrd=$type.rdz $automatic root=/dev/ram3 expert vga=788 -label rescue - kernel vmlinuz - append ramdisk_size=32000 initrd=$type.rdz $automatic root=/dev/ram3 rescue rw -label lnx4win - kernel vmlinuz - append ramdisk_size=32000 initrd=$type.rdz $automatic root=/dev/ram3 lnx4win vga=788 -label preinst - kernel vmlinuz - append ramdisk_size=32000 initrd=$type.rdz automatic=method:cdrom root=/dev/ram3 rescue oem rw -label oem - kernel vmlinuz - append ramdisk_size=32000 initrd=$type.rdz automatic=method:cdrom root=/dev/ram3 rescue oem rw -label auto - kernel vmlinuz - append ramdisk_size=32000 initrd=$type.rdz $automatic auto_install=Mandrake/base/auto_inst.cfg.pl -label all - kernel vmlinuz - append ramdisk_size=32000 initrd=$type.rdz pcmcia root=/dev/ram3 vga=788 -label ackbar - kernel vmlinuz - append ramdisk_size=32000 initrd=$type.rdz automatic=method:nfs,network:static,ip:192.168.1.205,dns:192.168.1.11,domain:mandrakesoft.com,server:ackbar,directory:/export vga=788 -"); - _ "sync"; - _ "df $mnt"; -} - -sub boot_img_alpha { - my ($mnt, $img) = @_; - - __ "$sudo umount $mnt 2>/dev/null"; - _ "dd if=/dev/zero of=$img bs=1k count=1440"; - _ "$mke2fs $img"; - _ "/sbin/e2writeboot $img /boot/bootlx"; - _ "$sudo mount -t ext2 $img $mnt -o loop"; - _ "cp -f vmlinux.gz $mnt" if $type !~ /blank/; - -f "$type.rdz" ? _ "cp -f $type.rdz $mnt" : initrd("${mnt}2", "$mnt/$type.rdz"); - - mkdir "$mnt/etc", 0777; - output("$mnt/etc/aboot.conf", -"0:vmlinux.gz initrd=$type.rdz rw ramdisk_size=32000 root=/dev/ram3 $type -1:vmlinux.gz initrd=$type.rdz rw ramdisk_size=32000 root=/dev/ram3 text $type -"); - _ "sync"; - _ "df $mnt"; -} - -sub boot_img_ia64 { - my ($mnt, $img, $kernel) = @_; - - __ "$sudo umount $mnt 2>/dev/null"; - _ "dd if=/dev/zero of=$img bs=1k count=16384"; - _ "mkdosfs $img"; - _ "$sudo mount -t vfat $img $mnt -o loop,umask=000"; - _ "$sudo cp -f $kernel $mnt/vmlinux"; - _ "cp -f images/$type.rdz $mnt/$type.rdz"; - _ "$sudo cp -f tools/ia64/elilo.efi $mnt"; - output("$mnt/elilo.conf", " -prompt -timeout=50 - -image=vmlinux - label=linux - root=/dev/ram3 - initrd=$type.rdz - append=\"ramdisk_size=120000\" - read-only -"); - _ "sync"; - _ "df $mnt"; - -} - -sub boot_img_sparc { - my ($mnt, $img) = @_; - if ($type =~ /^live(.*)/) { - #- hack to produce directly into /export the needed file for cdrom boot. - my $dir = "/export"; - my $boot = "boot"; #- non-absolute pathname only! - - _ "mkdir -p $dir/$boot"; - _ "cp -f /boot/cd.b /boot/second.b $dir/$boot"; - _ "cp -f vmlinux$1 $dir/$boot/vmlinux$1"; - -f "live$1.rdz" ? _ "cp -f live$1.rdz $dir/$boot" : initrd("${mnt}2", "$dir/$boot/live$1.rdz"); - - output("$dir/$boot/silo.conf", " -partition=1 -default=linux -timeout=100 -read-write -message=/$boot/boot.msg -image=\"cat /$boot/boot.msg\" - label=1 - single-key -image=\"cat /$boot/general.msg\" - label=2 - single-key -image=\"cat /$boot/expert.msg\" - label=3 - single-key -image=\"cat /$boot/rescue.msg\" - label=4 - single-key -image=\"cat /$boot/kickit.msg\" - label=5 - single-key -image=\"cat /$boot/param.msg\" - label=6 - single-key -image[sun4c,sun4d,sun4m]=/$boot/vmlinux - label=linux - alias=install - initrd=/$boot/live.rdz - append=\"ramdisk_size=32000$corporate root=/dev/ram3\" -image[sun4c,sun4d,sun4m]=/$boot/vmlinux - label=text - initrd=/$boot/live.rdz - append=\"ramdisk_size=32000 text$corporate root=/dev/ram3\" -image[sun4c,sun4d,sun4m]=/$boot/vmlinux - label=expert - initrd=/$boot/live.rdz - append=\"ramdisk_size=32000 expert$corporate root=/dev/ram3\" -image[sun4c,sun4d,sun4m]=/$boot/vmlinux - label=ks - initrd=/$boot/live.rdz - append=\"ramdisk_size=32000 ks$corporate root=/dev/ram3\" -image[sun4c,sun4d,sun4m]=/$boot/vmlinux - label=rescue - initrd=/$boot/live.rdz - append=\"ramdisk_size=32000 rescue rw root=/dev/ram3$corporate\" -image[sun4u]=/$boot/vmlinux64 - label=linux - alias=install - initrd=/$boot/live64.rdz - append=\"ramdisk_size=32000$corporate root=/dev/ram3\" -image[sun4u]=/$boot/vmlinux64 - label=text - initrd=/$boot/live64.rdz - append=\"ramdisk_size=32000 text$corporate root=/dev/ram3\" -image[sun4u]=/$boot/vmlinux64 - label=expert - initrd=/$boot/live64.rdz - append=\"ramdisk_size=32000 expert$corporate root=/dev/ram3\" -image[sun4u]=/$boot/vmlinux64 - label=ks - initrd=/$boot/live64.rdz - append=\"ramdisk_size=32000 ks$corporate root=/dev/ram3\" -image[sun4u]=/$boot/vmlinux64 - label=rescue - initrd=/$boot/live64.rdz - append=\"ramdisk_size=32000 rescue rw root=/dev/ram3$corporate\" -"); - - output("$dir/$boot/README", " -To Build a Bootable CD-ROM, try: - mkisofs -R -o t.iso -s /$boot/silo.conf /export -"); - } elsif ($type =~ /^tftprd(.*)/) { - my $dir = "/export"; - my $boot = "images"; - my $setarch = $1 ? "sparc64" : "sparc32"; - - _ "mkdir -p $dir/$boot"; - -f "$type.rdz" or initrd("${mnt}2", "$type.rdz"); - _ "cp -f vmlinux$1.aout $dir/$boot/$type.img"; - _ "$setarch kernel$1/src/arch/sparc$1/boot/piggyback $dir/$boot/$type.img kernel$1/boot/System.map $type.rdz"; - } elsif ($type =~ /^tftp(.*)/) { - my $dir = "/export"; - my $boot = "images"; - - _ "mkdir -p $dir/$boot"; - _ "cp -f vmlinux$1.aout $dir/$boot/$type.img"; - } else { - my $dir = "floppy"; - my ($ltype, $I) = $type =~ /(.*?)(64)/; $ltype ||= $type; - - __ "$sudo umount $mnt 2>/dev/null"; - _ "rm -rf $dir"; - _ "mkdir -p $dir"; - _ "cp -f /boot/fd.b /boot/second.b $dir"; - _ "cp -f vmlinuz$I $dir/vmlinux$I.gz" if $type !~ /blank/; - -f "$type.rdz" ? _ "cp -f $type.rdz $dir" : initrd("${mnt}2", "$dir/$type.rdz"); - - output("$dir/boot.msg", " -Welcome to Mandrake Linux 7.1 - -Press <Enter> to install or upgrade a system 7mMandrake Linux7m -"); - - output("$dir/silo.conf", " -partition=1 -default=linux -timeout=100 -read-write -message=/boot.msg -image=/vmlinux$I.gz - label=linux - initrd=/$type.rdz - append=\"ramdisk_size=32000 $ltype$corporate root=/dev/ram3\" -"); - _ "genromfs -d $dir -f /dev/ram -A 2048,/.. -a 512 -V \'DrakX boot disk\'"; - _ "$sudo mount -t romfs /dev/ram $mnt"; - _ "silo -r $mnt -F -i /fd.b -b /second.b -C /silo.conf"; - _ "$sudo umount $mnt"; - _ "dd if=/dev/ram of=$type.img bs=1440k count=1"; - _ "sync"; - _ "$sudo mount -t romfs /dev/ram $mnt"; - _ "df $mnt"; - } -} - -sub boot_img_ppc { - my ($mnt, $img, $kern, $modz) = @_; - my $dir = "/export"; - my $boot = "boot"; #- non-absolute pathname only! - my ($extension) = $modz =~ /.*\/([^\/]+)/; - _ "mkdir -p $dir/$boot"; - _ "cp -f $kern $dir/$boot/vmlinux"; - _ "cp -f images/all.rdz$extension $dir/boot/all.gz"; - _ "cp -f tools/ppc/yaboot $dir/boot/yaboot"; - - output("$dir/$boot/yaboot.conf", " -init-message = \"\\nWelcome to Mandrake Linux PPC!\\nHit <TAB> for boot options.\\n\\n\" -timeout = 150 -default = install-novideo - -image = cd:,\\\\\\\\vmlinux - label = install-novideo - root = /dev/ram3 - initrd = cd:,\\\\\\\\all.gz - initrd-size = 32000 - append = \" video=ofonly\" - -image = cd:,\\\\\\\\vmlinux - label = install-atyfb - root = /dev/ram3 - initrd = cd:,\\\\\\\\all.gz - initrd-size = 32000 - append = \" video=atyfb:vmode:17\" - -image = cd:,\\\\\\\\vmlinux - label = install-aty128fb - root = /dev/ram3 - initrd = cd:,\\\\\\\\all.gz - initrd-size = 32000 - append = \" video=aty128fb:vmode:17\" - -image = cd:,\\\\\\\\vmlinux - label = install-text - root = /dev/ram3 - initrd = cd:,\\\\\\\\all.gz - initrd-size = 32000 - append = \" text video=ofonly\" - -image = enet:0,vmlinux - label = install-net - root = /dev/ram3 - initrd = enet:0,all.gz - initrd-size = 32000 - append = \" video=ofonly\" - -image = enet:0,vmlinux - label = install-net-text - root = /dev/ram3 - initrd = enet:0,all.gz - initrd-size = 32000 - append = \" text video=ofonly\" - -image = cd:,\\\\\\\\vmlinux - label = rescue - root = /dev/ram3 - initrd = cd:,\\\\\\\\all.gz - initrd-size = 32000 - append = \" rescue video=ofonly\" - -image = enet:0,vmlinux - label = rescue-net - root = /dev/ram3 - initrd = enet:0,all.gz - initrd-size = 32000 - append = \" rescue video=ofonly\" -"); - #- seem to need 2 yaboot.conf, one in the root, and one in boot - _ "cp -f $dir/boot/yaboot.conf $dir/yaboot.conf"; - - output("$dir/$boot/README", " -To Build a Bootable CD-ROM, do: -cd /tools/ppc -./mkINSTALLCD /export ppc-cd.img -"); - -} - -sub output { - my $f = shift; - local *F; - open F, "> $f" or die "error writing to $f"; - print F join '', @_; -} diff --git a/make_ks_from_floppy b/make_ks_from_floppy deleted file mode 100755 index 0c2c48331..000000000 --- a/make_ks_from_floppy +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -ks="install/ks.cfg" - -[ -e $ks ] || { echo "missing file $ks, create one based on $ks.default"; exit 1; } - -sudo mount /mnt/floppy -cp -f $ks /mnt/floppy -perl -pi -e 's/prompt 1//; s/\s*kickstart=\S+//g; s/append/append kickstart=auto_inst.cfg.pl/' /mnt/floppy/syslinux.cfg -sudo umount /mnt/floppy diff --git a/mdk-stage1/.cvsignore b/mdk-stage1/.cvsignore deleted file mode 100644 index 36f56f6b5..000000000 --- a/mdk-stage1/.cvsignore +++ /dev/null @@ -1,11 +0,0 @@ -init -stage1-full -stage1-cdrom -stage1-disk -stage1-network -debug.log -.depend -*.rdz* -mkinitrd_helper.tar.bz2 -hack_* -stage1-usbnet diff --git a/mdk-stage1/Makefile b/mdk-stage1/Makefile deleted file mode 100644 index 52a7fe792..000000000 --- a/mdk-stage1/Makefile +++ /dev/null @@ -1,258 +0,0 @@ - #****************************************************************************** - # - # mdk-stage1 - the program that will load second-stage install - # - # $Id$ - # - # Guillaume Cottenceau (gc@mandrakesoft.com) - # - # Copyright 2000 MandrakeSoft - # - # This software may be freely redistributed under the terms of the GNU - # public license. - # - # You should have received a copy of the GNU General Public License - # along with this program; if not, write to the Free Software - # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - # - # Portions from Erik Troan (ewt@redhat.com) Copyright 1996 Red Hat Software - # - #***************************************************************************** - # - # Currently: - # - # ix86 - # init with minilibc - # stage1 with dietlibc except some targets - # - # ppc - # init with dietlibc - # stage1 with glibc - # - # ia64 - # init with glibc - # stage1 with glibc - # - #***************************************************************************** - - -VERSION = cooker - -top_dir = . - -include $(top_dir)/Makefile.common - - -DEFS = -DVERSION=\"$(VERSION)\" -DSPAWN_SHELL - -COMPILE = $(CC) $(DEFS) $(CFLAGS) - - - #- stage1 "loader" -ifeq (i386, $(ARCH)) -INITSRC = minilibc.c init.c -INIT_DEFS = -DINIT_HEADERS=\"minilibc.h\" -else -INITSRC = init.c -ifeq (ia64, $(ARCH)) -INIT_DEFS = -DINIT_HEADERS=\"init-libc-headers.h\" $(GLIBC_INCLUDES) -else -INIT_DEFS = -DINIT_HEADERS=\"init-libc-headers.h\" $(DIETLIBC_INCLUDES) -endif -endif - -INITOBJS = $(subst .c,.o,$(INITSRC)) - - - #- frontends -NEWT_FRONTEND_SRC = newt-frontend.c -GLIBC_NEWT_FRONTEND_LIBS = newt/libnewt.a slang/libslang.a -DIETLIBC_NEWT_FRONTEND_LIBS = $(subst .a,-DIET.a,$(GLIBC_NEWT_FRONTEND_LIBS)) - -STDIO_FRONTEND_SRC = stdio-frontend.c -GLIBC_STDIO_FRONTEND_LIBS = -DIETLIBC_STDIO_FRONTEND_LIBS = - - -FRONTEND_OBJS = $(subst .c,.o,$($(F)_FRONTEND_SRC)) - -FRONTEND_LINK = $(FRONTEND_OBJS) $($(L)_$(F)_FRONTEND_LIBS) - -ifeq (i386, $(ARCH)) -INSMOD = insmod-busybox -else -INSMOD = insmod-modutils -endif - -GLIBC_STAGE1_OWN_LIBS = $(INSMOD)/libinsmod.a mar/libmar.a bzlib/libbzlib.a -DIETLIBC_STAGE1_OWN_LIBS = $(subst .a,-DIET.a,$(GLIBC_STAGE1_OWN_LIBS)) -STAGE1_OWN_LIBS = $($(L)_STAGE1_OWN_LIBS) - - -ifeq (DIETLIBC, $(L)) -STAGE1_NETWORK_LIBS = $(top_dir)/dietlibc/bin-$(ARCH)/librpc.a -endif - -ifeq (GLIBC, $(L)) -STAGE1_NETWORK_LIBS = /usr/lib/libresolv.a -endif - - #- stage1 itself -STAGE1SRC = stage1.c log.c tools.c modules.c probing.c mount.c automatic.c frontend-common.c -CDROMSRC = cdrom.c -DISKSRC = disk.c lomount.c -NETWORKSRC = network.c nfsmount.c dhcp.c url.c dns.c adsl.c - -ALLSRC = $(INITSRC) $(STAGE1SRC) $(CDROMSRC) $(DISKSRC) $(NETWORKSRC) - - - -STAGE1OBJS-CDROM = $(subst .c,-CDROM.o,$(STAGE1SRC) $(CDROMSRC)) - -CDROM_DEFS = -DDISABLE_DISK -DDISABLE_NETWORK - - -STAGE1OBJS-DISK = $(subst .c,-DISK.o,$(STAGE1SRC) $(DISKSRC)) - -DISK_DEFS = -DDISABLE_CDROM -DDISABLE_NETWORK - - -STAGE1OBJS-NETWORK = $(subst .c,-NETWORK.o,$(STAGE1SRC) $(NETWORKSRC)) - -NETWORK_DEFS = -DDISABLE_CDROM -DDISABLE_DISK - - -STAGE1OBJS-USBNET = $(subst .c,-USBNET.o,$(STAGE1SRC) $(NETWORKSRC)) - - -STAGE1OBJS-FULL = $(subst .c,-FULL.o,$(STAGE1SRC) $(CDROMSRC) $(DISKSRC) $(NETWORKSRC)) - - -ifeq (i386, $(ARCH)) -LDFLAGS_INIT = -static -nostdlib /usr/lib/crt1.o -else -ifeq (ia64, $(ARCH)) -LDFLAGS_INIT = $(GLIBC_LDFLAGS_STAGE1) -INIT_LIBC = $(GLIBC_LIBC) -else -LDFLAGS_INIT = $(DIETLIBC_LDFLAGS_STAGE1) -INIT_LIBC = $(DIETLIBC_LIBC) -endif -endif - - -BINS = init stage1-full - -ifeq (i386, $(ARCH)) -BINS += stage1-cdrom stage1-disk stage1-network stage1-usbnet -endif - -ifneq (ia64, $(ARCH)) -DIRS = dietlibc -endif -DIRS += mar pci-resource usb-resource bzlib $(INSMOD) slang newt ppp/pppd rp-pppoe/src -ifeq (i386,$(ARCH)) -DIRS += pcmcia -endif - - -ifeq (i386,$(ARCH)) -GLIBC_PCMCIA_LIB = pcmcia/libpcmcia.a -DIETLIBC_PCMCIA_LIB = $(subst .a,-DIET.a,$(GLIBC_PCMCIA_LIB)) -PCMCIA_LIB = $($(L)_PCMCIA_LIB) -PCMCIA_DEFS = -DENABLE_PCMCIA -endif - - -USBNET_DEFS_GEN = -DENABLE_USB -DENABLE_USBNET -USBNET_DEFS = $(USBNET_DEFS_GEN) -DDISABLE_PCINET - -all: dirs $(BINS) - -dirs: - @for n in . $(DIRS); do \ - [ "$$n" = "." ] || make -C $$n ;\ - done - -init: $(INITOBJS) $(INIT_LIBC) - $(CC) $(LDFLAGS_INIT) -o $@ $^ - $(STRIPCMD) $@ - -stage1-cdrom: $(STAGE1OBJS-CDROM) $(STAGE1_OWN_LIBS) $(FRONTEND_LINK) $(STAGE1_LIBC) - $(CC) $(LDFLAGS_STAGE1) -o $@ $^ - $(STRIPCMD) $@ - -stage1-disk: $(STAGE1OBJS-DISK) $(STAGE1_OWN_LIBS) $(FRONTEND_LINK) $(STAGE1_LIBC) - $(CC) $(LDFLAGS_STAGE1) -o $@ $^ - $(STRIPCMD) $@ - -stage1-network: $(STAGE1OBJS-NETWORK) $(STAGE1_OWN_LIBS) $(STAGE1_NETWORK_LIBS) $(FRONTEND_LINK) $(STAGE1_LIBC) - $(CC) $(LDFLAGS_STAGE1) -o $@ $^ - $(STRIPCMD) $@ - -stage1-usbnet: $(STAGE1OBJS-USBNET) $(STAGE1_OWN_LIBS) $(STAGE1_NETWORK_LIBS) $(FRONTEND_LINK) $(STAGE1_LIBC) - $(CC) $(LDFLAGS_STAGE1) -o $@ $^ - $(STRIPCMD) $@ - -stage1-full: $(STAGE1OBJS-FULL) $(STAGE1_OWN_LIBS) $(STAGE1_NETWORK_LIBS) $(FRONTEND_LINK) $(PCMCIA_LIB) $(STAGE1_LIBC) - $(CC) $(LDFLAGS_STAGE1) -o $@ $^ - $(STRIPCMD) $@ - - -$(INITOBJS): %.o: %.c - $(COMPILE) $(INIT_DEFS) -c $< - -$(STAGE1OBJS-CDROM): %-CDROM.o: %.c - $(COMPILE) $(INCLUDES) $(CDROM_DEFS) -c $< -o $@ - -$(STAGE1OBJS-DISK): %-DISK.o: %.c - $(COMPILE) $(INCLUDES) $(DISK_DEFS) -c $< -o $@ - -$(STAGE1OBJS-NETWORK): %-NETWORK.o: %.c - $(COMPILE) $(INCLUDES) $(NETWORK_DEFS) -c $< -o $@ - -$(STAGE1OBJS-USBNET): %-USBNET.o: %.c - $(COMPILE) $(INCLUDES) $(NETWORK_DEFS) $(USBNET_DEFS) -c $< -o $@ - -$(STAGE1OBJS-FULL): %-FULL.o: %.c - $(COMPILE) $(INCLUDES) $(USBNET_DEFS_GEN) $(PCMCIA_DEFS) -c $< -o $@ - -.c.o: - $(COMPILE) $(INCLUDES) -c $< - - -clean: - @for n in $(DIRS); do \ - (cd $$n; make clean) \ - done - rm -f *.o .depend *.rdz *.img $(BINS) - - -tar-mkinitrd_helper: clean - $(MAKE) -C mkinitrd_helper clean - rm -rf mkinitrd_helper-subdir - mkdir mkinitrd_helper-subdir - cd mkinitrd_helper-subdir ; cp -a ../dietlibc ../insmod-busybox ../mkinitrd_helper ../Makefile.common ../insmod.h ../log.h . ; \ - cp ../Makefile.mkinitrd_helper Makefile - tar cfj mkinitrd_helper.tar.bz2 mkinitrd_helper-subdir --exclude CVS - rm -rf mkinitrd_helper-subdir - - -.depend: - $(CPP) $(CFLAGS) -M $(ALLSRC) > .depend - -ifeq (.depend,$(wildcard .depend)) -include .depend -endif - - -*-CDROM.o: %-CDROM.o: %.o - -*-DISK.o: %-DISK.o: %.o - -*-NETWORK.o: %-NETWORK.o: %.o - -*-USBNET.o: %-USBNET.o: %.o - -*-FULL.o: %-FULL.o: %.o - diff --git a/mdk-stage1/Makefile.common b/mdk-stage1/Makefile.common deleted file mode 100644 index 3cb8f3695..000000000 --- a/mdk-stage1/Makefile.common +++ /dev/null @@ -1,57 +0,0 @@ - # -*- makefile -*- - #****************************************************************************** - # - # Guillaume Cottenceau (gc@mandrakesoft.com) - # - # Copyright 2000 MandrakeSoft - # - # This software may be freely redistributed under the terms of the GNU - # public license. - # - # You should have received a copy of the GNU General Public License - # along with this program; if not, write to the Free Software - # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - # - #***************************************************************************** - -ARCH := $(patsubst i%86,i386,$(shell uname -m)) -ARCH := $(patsubst sparc%,sparc,$(ARCH)) - - #- default lib is dietlibc (honoured by main Makefile whenever possible) -L = DIETLIBC -#L = GLIBC - - #- default frontend is newt (honoured by main Makefile whenever possible) -F = NEWT -# F = STDIO - - #- override in some situations -ifeq (ia64, $(ARCH)) -L = GLIBC -endif -ifeq (ppc, $(ARCH)) -L = GLIBC -endif - - - #- flags used by all stuff -ifeq (ppc, $(ARCH)) -CFLAGS = -Os -pipe -Wall -fomit-frame-pointer -else -CFLAGS = -Os -pipe -Wall -Werror -fomit-frame-pointer -endif - -DIETLIBC_INCLUDES = -I$(top_dir)/dietlibc/include -I. -I$(top_dir)/bzlib -GLIBC_INCLUDES = -I. -I$(top_dir)/bzlib -INCLUDES = $($(L)_INCLUDES) - -GLIBC_LDFLAGS_STAGE1 = -static -DIETLIBC_LDFLAGS_STAGE1 = -nostdlib $(top_dir)/dietlibc/bin-$(ARCH)/start.o -LDFLAGS_STAGE1 = $($(L)_LDFLAGS_STAGE1) - -GLIBC_LIBC = -DIETLIBC_LIBC = $(top_dir)/dietlibc/bin-$(ARCH)/dietlibc.a -STAGE1_LIBC = $($(L)_LIBC) - -STRIPCMD = strip -R .note -R .comment - diff --git a/mdk-stage1/Makefile.mkinitrd_helper b/mdk-stage1/Makefile.mkinitrd_helper deleted file mode 100644 index 899fccb55..000000000 --- a/mdk-stage1/Makefile.mkinitrd_helper +++ /dev/null @@ -1,30 +0,0 @@ - #****************************************************************************** - # - # Guillaume Cottenceau (gc@mandrakesoft.com) - # - # Copyright 2000 MandrakeSoft - # - # This software may be freely redistributed under the terms of the GNU - # public license. - # - # You should have received a copy of the GNU General Public License - # along with this program; if not, write to the Free Software - # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - # - #***************************************************************************** - - -DIRS = dietlibc insmod-busybox mkinitrd_helper - - -all: dirs - -dirs: - @for n in . $(DIRS); do \ - [ "$$n" = "." ] || make -C $$n ;\ - done - -clean: - @for n in $(DIRS); do \ - (cd $$n; make clean) \ - done diff --git a/mdk-stage1/adsl.c b/mdk-stage1/adsl.c deleted file mode 100644 index d542f2f35..000000000 --- a/mdk-stage1/adsl.c +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Guillaume Cottenceau (gc@mandrakesoft.com) - * - * Copyright 2000 MandrakeSoft - * - * This software may be freely redistributed under the terms of the GNU - * public license. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#include <stdlib.h> -#include <unistd.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <string.h> -#include <sys/socket.h> -#include <netinet/in.h> -#include <arpa/inet.h> -#include <sys/ioctl.h> -#include <errno.h> -#include <stdio.h> -#include <resolv.h> -#include <signal.h> - -#include "stage1.h" -#include "log.h" -#include "network.h" -#include "modules.h" -#include "tools.h" -#include "frontend.h" -#include "automatic.h" - -#include "adsl.h" - - -static enum return_type adsl_connect(char * net_device, char * username, char * password) -{ - char pppoe_call[500]; - char * pppd_launch[] = { "/sbin/pppd", "pty", pppoe_call, "noipdefault", "noauth", "default-asyncmap", "defaultroute", - "hide-password", "nodetach", "usepeerdns", "local", "mtu", "1492", "mru", "1492", "noaccomp", - "noccp", "nobsdcomp", "nodeflate", "nopcomp", "novj", "novjccomp", "user", username, - "password", password, "lcp-echo-interval", "20", "lcp-echo-failure", "3", "lock", "persist", NULL }; - int fd; - int retries = 10; - char * tty_adsl = "/dev/tty6"; - enum return_type status = RETURN_ERROR; - pid_t ppp_pid; - - snprintf(pppoe_call, sizeof(pppoe_call), "/sbin/pppoe -p /var/run/pppoe.conf-adsl.pid.pppoe -I %s -T 80 -U -m 1412", net_device); - - - fd = open(tty_adsl, O_RDWR); - if (fd == -1) { - log_message("cannot open tty -- no pppd"); - return RETURN_ERROR; - } - else if (access(pppd_launch[0], X_OK)) { - log_message("cannot open pppd - %s doesn't exist", pppd_launch[0]); - return RETURN_ERROR; - } - - if (!(ppp_pid = fork())) { - dup2(fd, 0); - dup2(fd, 1); - dup2(fd, 2); - - close(fd); - setsid(); - if (ioctl(0, TIOCSCTTY, NULL)) - log_perror("could not set new controlling tty"); - - printf("\t(exec of pppd)\n"); - execve(pppd_launch[0], pppd_launch, grab_env()); - log_message("execve of %s failed: %s", pppd_launch[0], strerror(errno)); - exit(-1); - } - close(fd); - while (retries > 0 && kill(ppp_pid, 0) == 0) { - FILE * f; - if ((f = fopen("/var/run/pppd.tdb", "rb"))) { - while (1) { - char buf[500]; - if (!fgets(buf, sizeof(buf), f)) - break; - if (strstr(buf, "IPLOCAL=")) - status = RETURN_OK; - } - fclose(f); - if (status == RETURN_OK) { - log_message("PPP: connected!"); - break; - } - } - retries--; - log_message("PPP: <sleep>"); - sleep(2); - } - - if (status != RETURN_OK) { - log_message("PPP: could not connect"); - kill(ppp_pid, SIGTERM); - sleep(1); - kill(ppp_pid, SIGKILL); - sleep(1); - } - return status; -} - - -enum return_type perform_adsl(struct interface_info * intf) -{ - struct in_addr addr; - char * questions[] = { "Username", "Password", NULL }; - char * questions_auto[] = { "adsluser", "adslpass", NULL }; - static char ** answers = NULL; - enum return_type results; - - inet_aton("10.0.0.10", &addr); - memcpy(&intf->ip, &addr, sizeof(addr)); - - inet_aton("255.255.255.0", &addr); - memcpy(&intf->netmask, &addr, sizeof(addr)); - - *((uint32_t *) &intf->broadcast) = (*((uint32_t *) &intf->ip) & - *((uint32_t *) &intf->netmask)) | ~(*((uint32_t *) &intf->netmask)); - - intf->is_ptp = 0; - - if (configure_net_device(intf)) { - stg1_error_message("Could not configure.."); - return RETURN_ERROR; - } - - results = ask_from_entries_auto("Please enter the username and password for your ADSL account.\n" - "(Warning! only PPPoE protocol is supported)", - questions, &answers, 40, questions_auto, NULL); - if (results != RETURN_OK) - return results; - - intf->boot_proto = BOOTPROTO_ADSL_PPPOE; - - wait_message("Waiting for ADSL connection to show up..."); - my_insmod("ppp_generic", ANY_DRIVER_TYPE, NULL); - my_insmod("ppp_async", ANY_DRIVER_TYPE, NULL); - my_insmod("ppp", ANY_DRIVER_TYPE, NULL); - results = adsl_connect(intf->device, answers[0], answers[1]); - remove_wait_message(); - - if (results != RETURN_OK) { - wait_message("Retrying the ADSL connection..."); - results = adsl_connect(intf->device, answers[0], answers[1]); - remove_wait_message(); - } else { - intf->user = strdup(answers[0]); - intf->pass = strdup(answers[1]); - } - - if (results != RETURN_OK) { - stg1_error_message("I could not connect to the ADSL network."); - return perform_adsl(intf); - } - - sleep(1); - res_init(); /* reinit the resolver, pppd modified /etc/resolv.conf */ - - return RETURN_OK; -} diff --git a/mdk-stage1/adsl.h b/mdk-stage1/adsl.h deleted file mode 100644 index 9d32cc631..000000000 --- a/mdk-stage1/adsl.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Guillaume Cottenceau (gc@mandrakesoft.com) - * - * Copyright 2000 MandrakeSoft - * - * View the homepage: http://us.mandrakesoft.com/~gc/html/stage1.html - * - * - * This software may be freely redistributed under the terms of the GNU - * public license. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -/* - * Portions from GRUB -- GRand Unified Bootloader - * Copyright (C) 2000 Free Software Foundation, Inc. - * - * Itself based on etherboot-4.6.4 by Martin Renters. - * - */ - -#ifndef _ADSL_H_ -#define _ADSL_H_ - -#include "stage1.h" -#include "network.h" - -enum return_type perform_adsl(struct interface_info * intf); - -#endif diff --git a/mdk-stage1/automatic.c b/mdk-stage1/automatic.c deleted file mode 100644 index 486a829de..000000000 --- a/mdk-stage1/automatic.c +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Guillaume Cottenceau (gc@mandrakesoft.com) - * - * Copyright 2000 MandrakeSoft - * - * This software may be freely redistributed under the terms of the GNU - * public license. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -/* - * This is supposed to replace the redhat "kickstart", by name but - * also by design (less code pollution). - * - */ - - -#include <unistd.h> -#include <stdlib.h> -#include <string.h> -#include "tools.h" -#include "stage1.h" -#include "frontend.h" -#include "log.h" - -#include "automatic.h" - - -static struct param_elem * automatic_params; -static char * value_not_bound = ""; - -void grab_automatic_params(char * line) -{ - int i, p; - struct param_elem tmp_params[50]; - - i = 0; p = 0; - while (line[i] != '\0') { - char *name, *value; - int k; - int j = i; - while (line[i] != ':' && line[i] != '\0') - i++; - name = memdup(&line[j], i-j + 1); - name[i-j] = 0; - - k = i+1; - i++; - while (line[i] != ',' && line[i] != '\0') - i++; - value = memdup(&line[k], i-k + 1); - value[i-k] = 0; - - tmp_params[p].name = name; - tmp_params[p].value = value; - p++; - if (line[i] == '\0') - break; - i++; - } - - tmp_params[p++].name = NULL; - automatic_params = memdup(tmp_params, sizeof(struct param_elem) * p); - - log_message("AUTOMATIC MODE: got %d params", p-1); -} - - -char * get_auto_value(char * auto_param) -{ - struct param_elem * ptr = automatic_params; - - while (ptr->name) { - if (!strcmp(ptr->name, auto_param)) - return ptr->value; - ptr++; - } - - return value_not_bound; -} - - -enum return_type ask_from_list_auto(char *msg, char ** elems, char ** choice, char * auto_param, char ** elems_auto) -{ - if (!IS_AUTOMATIC) - return ask_from_list(msg, elems, choice); - else { - char ** sav_elems = elems; - char * tmp = get_auto_value(auto_param); - while (elems && *elems) { - if (!strcmp(tmp, *elems_auto)) { - *choice = *elems; - log_message("AUTOMATIC: parameter %s for %s means returning %s", tmp, auto_param, *elems); - return RETURN_OK; - } - elems++; - elems_auto++; - } - unset_param(MODE_AUTOMATIC); /* we are in a fallback mode */ - return ask_from_list(msg, sav_elems, choice); - } -} - -enum return_type ask_from_list_comments_auto(char *msg, char ** elems, char ** elems_comments, char ** choice, char * auto_param, char ** elems_auto) -{ - if (!IS_AUTOMATIC) - return ask_from_list_comments(msg, elems, elems_comments, choice); - else { - char ** sav_elems = elems; - char * tmp = get_auto_value(auto_param); - while (elems && *elems) { - if (!strcmp(tmp, *elems_auto)) { - *choice = *elems; - log_message("AUTOMATIC: parameter %s for %s means returning %s", tmp, auto_param, *elems); - return RETURN_OK; - } - elems++; - elems_auto++; - } - unset_param(MODE_AUTOMATIC); /* we are in a fallback mode */ - return ask_from_list_comments(msg, sav_elems, elems_comments, choice); - } -} - - -enum return_type ask_from_entries_auto(char *msg, char ** questions, char *** answers, int entry_size, char ** questions_auto, void (*callback_func)(char ** strings)) -{ - if (!IS_AUTOMATIC) - return ask_from_entries(msg, questions, answers, entry_size, callback_func); - else { - char * tmp_answers[50]; - int i = 0; - while (questions && *questions) { - tmp_answers[i] = get_auto_value(*questions_auto); - log_message("AUTOMATIC: question %s answers %s because of param %s", *questions, tmp_answers[i], *questions_auto); - i++; - questions++; - questions_auto++; - - } - *answers = memdup(tmp_answers, sizeof(char *) * i); - return RETURN_OK; - } -} diff --git a/mdk-stage1/automatic.h b/mdk-stage1/automatic.h deleted file mode 100644 index c2ac0a73d..000000000 --- a/mdk-stage1/automatic.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Guillaume Cottenceau (gc@mandrakesoft.com) - * - * Copyright 2000 MandrakeSoft - * - * This software may be freely redistributed under the terms of the GNU - * public license. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -/* - * This is supposed to replace the redhat "kickstart", by name but - * also by design (no code pollution). - * - */ - -#ifndef _AUTOMATIC_H_ -#define _AUTOMATIC_H_ - -#include "stage1.h" - -void grab_automatic_params(char * line); - -enum return_type ask_from_list_auto(char *msg, char ** elems, char ** choice, char * auto_param, char ** elems_auto); -enum return_type ask_from_list_comments_auto(char *msg, char ** elems, char ** elems_comments, char ** choice, char * auto_param, char ** elems_auto); -enum return_type ask_from_entries_auto(char *msg, char ** questions, char *** answers, int entry_size, char ** questions_auto, void (*callback_func)(char ** strings)); - -#endif diff --git a/mdk-stage1/bzlib/Makefile b/mdk-stage1/bzlib/Makefile deleted file mode 100644 index 6b4f29ffc..000000000 --- a/mdk-stage1/bzlib/Makefile +++ /dev/null @@ -1,55 +0,0 @@ - #****************************************************************************** - # - # Guillaume Cottenceau (gc@mandrakesoft.com) - # - # Copyright 2000 MandrakeSoft - # - # This software may be freely redistributed under the terms of the GNU - # public license. - # - # You should have received a copy of the GNU General Public License - # along with this program; if not, write to the Free Software - # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - # - #***************************************************************************** - -top_dir = .. - -include $(top_dir)/Makefile.common - - -LIBNAME = libbzlib - -OBJS = blocksort.o bzlib.o compress.o crctable.o decompress.o huffman.o randtable.o - -DEFS = - -INCS = - - -TARGETS = $(LIBNAME).a - -ifeq (DIETLIBC, $(L)) -TARGETS += $(LIBNAME)-DIET.a -endif - -all: $(TARGETS) - -clean: - rm -f *.o *.a - -OBJS-DIET = $(subst .o,-DIET.o,$(OBJS)) - -$(LIBNAME).a: $(OBJS) - ar -cru $@ $^ - ranlib $@ - -$(LIBNAME)-DIET.a: $(OBJS-DIET) - ar -cru $@ $^ - ranlib $@ - -$(OBJS): %.o: %.c - gcc $(CFLAGS) $(DEFS) $(INCS) $(GLIBC_INCLUDES) -c $< -o $@ - -$(OBJS-DIET): %-DIET.o: %.c - gcc $(CFLAGS) $(DEFS) $(INCS) $(DIETLIBC_INCLUDES) -c $< -o $@ diff --git a/mdk-stage1/bzlib/blocksort.c b/mdk-stage1/bzlib/blocksort.c deleted file mode 100644 index c1b78c483..000000000 --- a/mdk-stage1/bzlib/blocksort.c +++ /dev/null @@ -1,1138 +0,0 @@ - -/*-------------------------------------------------------------*/ -/*--- Block sorting machinery ---*/ -/*--- blocksort.c ---*/ -/*-------------------------------------------------------------*/ - -/*-- - This file is a part of bzip2 and/or libbzip2, a program and - library for lossless, block-sorting data compression. - - Copyright (C) 1996-2000 Julian R Seward. All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 2. The origin of this software must not be misrepresented; you must - not claim that you wrote the original software. If you use this - software in a product, an acknowledgment in the product - documentation would be appreciated but is not required. - - 3. Altered source versions must be plainly marked as such, and must - not be misrepresented as being the original software. - - 4. The name of the author may not be used to endorse or promote - products derived from this software without specific prior written - permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - Julian Seward, Cambridge, UK. - jseward@acm.org - bzip2/libbzip2 version 1.0 of 21 March 2000 - - This program is based on (at least) the work of: - Mike Burrows - David Wheeler - Peter Fenwick - Alistair Moffat - Radford Neal - Ian H. Witten - Robert Sedgewick - Jon L. Bentley - - For more information on these sources, see the manual. - - To get some idea how the block sorting algorithms in this file - work, read my paper - On the Performance of BWT Sorting Algorithms - in Proceedings of the IEEE Data Compression Conference 2000, - Snowbird, Utah, USA, 27-30 March 2000. The main sort in this - file implements the algorithm called cache in the paper. ---*/ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - - -#include "bzlib_private.h" - -/*---------------------------------------------*/ -/*--- Fallback O(N log(N)^2) sorting ---*/ -/*--- algorithm, for repetitive blocks ---*/ -/*---------------------------------------------*/ - -/*---------------------------------------------*/ -static -__inline__ -void fallbackSimpleSort ( UInt32* fmap, - UInt32* eclass, - Int32 lo, - Int32 hi ) -{ - Int32 i, j, tmp; - UInt32 ec_tmp; - - if (lo == hi) return; - - if (hi - lo > 3) { - for ( i = hi-4; i >= lo; i-- ) { - tmp = fmap[i]; - ec_tmp = eclass[tmp]; - for ( j = i+4; j <= hi && ec_tmp > eclass[fmap[j]]; j += 4 ) - fmap[j-4] = fmap[j]; - fmap[j-4] = tmp; - } - } - - for ( i = hi-1; i >= lo; i-- ) { - tmp = fmap[i]; - ec_tmp = eclass[tmp]; - for ( j = i+1; j <= hi && ec_tmp > eclass[fmap[j]]; j++ ) - fmap[j-1] = fmap[j]; - fmap[j-1] = tmp; - } -} - - -/*---------------------------------------------*/ -#define fswap(zz1, zz2) \ - { Int32 zztmp = zz1; zz1 = zz2; zz2 = zztmp; } - -#define fvswap(zzp1, zzp2, zzn) \ -{ \ - Int32 yyp1 = (zzp1); \ - Int32 yyp2 = (zzp2); \ - Int32 yyn = (zzn); \ - while (yyn > 0) { \ - fswap(fmap[yyp1], fmap[yyp2]); \ - yyp1++; yyp2++; yyn--; \ - } \ -} - - -#define fmin(a,b) ((a) < (b)) ? (a) : (b) - -#define fpush(lz,hz) { stackLo[sp] = lz; \ - stackHi[sp] = hz; \ - sp++; } - -#define fpop(lz,hz) { sp--; \ - lz = stackLo[sp]; \ - hz = stackHi[sp]; } - -#define FALLBACK_QSORT_SMALL_THRESH 10 -#define FALLBACK_QSORT_STACK_SIZE 100 - - -static -void fallbackQSort3 ( UInt32* fmap, - UInt32* eclass, - Int32 loSt, - Int32 hiSt ) -{ - Int32 unLo, unHi, ltLo, gtHi, n, m; - Int32 sp, lo, hi; - UInt32 med, r, r3; - Int32 stackLo[FALLBACK_QSORT_STACK_SIZE]; - Int32 stackHi[FALLBACK_QSORT_STACK_SIZE]; - - r = 0; - - sp = 0; - fpush ( loSt, hiSt ); - - while (sp > 0) { - - AssertH ( sp < FALLBACK_QSORT_STACK_SIZE, 1004 ); - - fpop ( lo, hi ); - if (hi - lo < FALLBACK_QSORT_SMALL_THRESH) { - fallbackSimpleSort ( fmap, eclass, lo, hi ); - continue; - } - - /* Random partitioning. Median of 3 sometimes fails to - avoid bad cases. Median of 9 seems to help but - looks rather expensive. This too seems to work but - is cheaper. Guidance for the magic constants - 7621 and 32768 is taken from Sedgewick's algorithms - book, chapter 35. - */ - r = ((r * 7621) + 1) % 32768; - r3 = r % 3; - if (r3 == 0) med = eclass[fmap[lo]]; else - if (r3 == 1) med = eclass[fmap[(lo+hi)>>1]]; else - med = eclass[fmap[hi]]; - - unLo = ltLo = lo; - unHi = gtHi = hi; - - while (1) { - while (1) { - if (unLo > unHi) break; - n = (Int32)eclass[fmap[unLo]] - (Int32)med; - if (n == 0) { - fswap(fmap[unLo], fmap[ltLo]); - ltLo++; unLo++; - continue; - }; - if (n > 0) break; - unLo++; - } - while (1) { - if (unLo > unHi) break; - n = (Int32)eclass[fmap[unHi]] - (Int32)med; - if (n == 0) { - fswap(fmap[unHi], fmap[gtHi]); - gtHi--; unHi--; - continue; - }; - if (n < 0) break; - unHi--; - } - if (unLo > unHi) break; - fswap(fmap[unLo], fmap[unHi]); unLo++; unHi--; - } - - AssertD ( unHi == unLo-1, "fallbackQSort3(2)" ); - - if (gtHi < ltLo) continue; - - n = fmin(ltLo-lo, unLo-ltLo); fvswap(lo, unLo-n, n); - m = fmin(hi-gtHi, gtHi-unHi); fvswap(unLo, hi-m+1, m); - - n = lo + unLo - ltLo - 1; - m = hi - (gtHi - unHi) + 1; - - if (n - lo > hi - m) { - fpush ( lo, n ); - fpush ( m, hi ); - } else { - fpush ( m, hi ); - fpush ( lo, n ); - } - } -} - -#undef fmin -#undef fpush -#undef fpop -#undef fswap -#undef fvswap -#undef FALLBACK_QSORT_SMALL_THRESH -#undef FALLBACK_QSORT_STACK_SIZE - - -/*---------------------------------------------*/ -/* Pre: - nblock > 0 - eclass exists for [0 .. nblock-1] - ((UChar*)eclass) [0 .. nblock-1] holds block - ptr exists for [0 .. nblock-1] - - Post: - ((UChar*)eclass) [0 .. nblock-1] holds block - All other areas of eclass destroyed - fmap [0 .. nblock-1] holds sorted order - bhtab [ 0 .. 2+(nblock/32) ] destroyed -*/ - -#define SET_BH(zz) bhtab[(zz) >> 5] |= (1 << ((zz) & 31)) -#define CLEAR_BH(zz) bhtab[(zz) >> 5] &= ~(1 << ((zz) & 31)) -#define ISSET_BH(zz) (bhtab[(zz) >> 5] & (1 << ((zz) & 31))) -#define WORD_BH(zz) bhtab[(zz) >> 5] -#define UNALIGNED_BH(zz) ((zz) & 0x01f) - -static -void fallbackSort ( UInt32* fmap, - UInt32* eclass, - UInt32* bhtab, - Int32 nblock, - Int32 verb ) -{ - Int32 ftab[257]; - Int32 ftabCopy[256]; - Int32 H, i, j, k, l, r, cc, cc1; - Int32 nNotDone; - Int32 nBhtab; - UChar* eclass8 = (UChar*)eclass; - - /*-- - Initial 1-char radix sort to generate - initial fmap and initial BH bits. - --*/ - if (verb >= 4) - VPrintf0 ( " bucket sorting ...\n" ); - for (i = 0; i < 257; i++) ftab[i] = 0; - for (i = 0; i < nblock; i++) ftab[eclass8[i]]++; - for (i = 0; i < 256; i++) ftabCopy[i] = ftab[i]; - for (i = 1; i < 257; i++) ftab[i] += ftab[i-1]; - - for (i = 0; i < nblock; i++) { - j = eclass8[i]; - k = ftab[j] - 1; - ftab[j] = k; - fmap[k] = i; - } - - nBhtab = 2 + (nblock / 32); - for (i = 0; i < nBhtab; i++) bhtab[i] = 0; - for (i = 0; i < 256; i++) SET_BH(ftab[i]); - - /*-- - Inductively refine the buckets. Kind-of an - "exponential radix sort" (!), inspired by the - Manber-Myers suffix array construction algorithm. - --*/ - - /*-- set sentinel bits for block-end detection --*/ - for (i = 0; i < 32; i++) { - SET_BH(nblock + 2*i); - CLEAR_BH(nblock + 2*i + 1); - } - - /*-- the log(N) loop --*/ - H = 1; - while (1) { - - if (verb >= 4) - VPrintf1 ( " depth %6d has ", H ); - - j = 0; - for (i = 0; i < nblock; i++) { - if (ISSET_BH(i)) j = i; - k = fmap[i] - H; if (k < 0) k += nblock; - eclass[k] = j; - } - - nNotDone = 0; - r = -1; - while (1) { - - /*-- find the next non-singleton bucket --*/ - k = r + 1; - while (ISSET_BH(k) && UNALIGNED_BH(k)) k++; - if (ISSET_BH(k)) { - while (WORD_BH(k) == 0xffffffff) k += 32; - while (ISSET_BH(k)) k++; - } - l = k - 1; - if (l >= nblock) break; - while (!ISSET_BH(k) && UNALIGNED_BH(k)) k++; - if (!ISSET_BH(k)) { - while (WORD_BH(k) == 0x00000000) k += 32; - while (!ISSET_BH(k)) k++; - } - r = k - 1; - if (r >= nblock) break; - - /*-- now [l, r] bracket current bucket --*/ - if (r > l) { - nNotDone += (r - l + 1); - fallbackQSort3 ( fmap, eclass, l, r ); - - /*-- scan bucket and generate header bits-- */ - cc = -1; - for (i = l; i <= r; i++) { - cc1 = eclass[fmap[i]]; - if (cc != cc1) { SET_BH(i); cc = cc1; }; - } - } - } - - if (verb >= 4) - VPrintf1 ( "%6d unresolved strings\n", nNotDone ); - - H *= 2; - if (H > nblock || nNotDone == 0) break; - } - - /*-- - Reconstruct the original block in - eclass8 [0 .. nblock-1], since the - previous phase destroyed it. - --*/ - if (verb >= 4) - VPrintf0 ( " reconstructing block ...\n" ); - j = 0; - for (i = 0; i < nblock; i++) { - while (ftabCopy[j] == 0) j++; - ftabCopy[j]--; - eclass8[fmap[i]] = (UChar)j; - } - AssertH ( j < 256, 1005 ); -} - -#undef SET_BH -#undef CLEAR_BH -#undef ISSET_BH -#undef WORD_BH -#undef UNALIGNED_BH - - -/*---------------------------------------------*/ -/*--- The main, O(N^2 log(N)) sorting ---*/ -/*--- algorithm. Faster for "normal" ---*/ -/*--- non-repetitive blocks. ---*/ -/*---------------------------------------------*/ - -/*---------------------------------------------*/ -static -__inline__ -Bool mainGtU ( UInt32 i1, - UInt32 i2, - UChar* block, - UInt16* quadrant, - UInt32 nblock, - Int32* budget ) -{ - Int32 k; - UChar c1, c2; - UInt16 s1, s2; - - AssertD ( i1 != i2, "mainGtU" ); - /* 1 */ - c1 = block[i1]; c2 = block[i2]; - if (c1 != c2) return (c1 > c2); - i1++; i2++; - /* 2 */ - c1 = block[i1]; c2 = block[i2]; - if (c1 != c2) return (c1 > c2); - i1++; i2++; - /* 3 */ - c1 = block[i1]; c2 = block[i2]; - if (c1 != c2) return (c1 > c2); - i1++; i2++; - /* 4 */ - c1 = block[i1]; c2 = block[i2]; - if (c1 != c2) return (c1 > c2); - i1++; i2++; - /* 5 */ - c1 = block[i1]; c2 = block[i2]; - if (c1 != c2) return (c1 > c2); - i1++; i2++; - /* 6 */ - c1 = block[i1]; c2 = block[i2]; - if (c1 != c2) return (c1 > c2); - i1++; i2++; - /* 7 */ - c1 = block[i1]; c2 = block[i2]; - if (c1 != c2) return (c1 > c2); - i1++; i2++; - /* 8 */ - c1 = block[i1]; c2 = block[i2]; - if (c1 != c2) return (c1 > c2); - i1++; i2++; - /* 9 */ - c1 = block[i1]; c2 = block[i2]; - if (c1 != c2) return (c1 > c2); - i1++; i2++; - /* 10 */ - c1 = block[i1]; c2 = block[i2]; - if (c1 != c2) return (c1 > c2); - i1++; i2++; - /* 11 */ - c1 = block[i1]; c2 = block[i2]; - if (c1 != c2) return (c1 > c2); - i1++; i2++; - /* 12 */ - c1 = block[i1]; c2 = block[i2]; - if (c1 != c2) return (c1 > c2); - i1++; i2++; - - k = nblock + 8; - - do { - /* 1 */ - c1 = block[i1]; c2 = block[i2]; - if (c1 != c2) return (c1 > c2); - s1 = quadrant[i1]; s2 = quadrant[i2]; - if (s1 != s2) return (s1 > s2); - i1++; i2++; - /* 2 */ - c1 = block[i1]; c2 = block[i2]; - if (c1 != c2) return (c1 > c2); - s1 = quadrant[i1]; s2 = quadrant[i2]; - if (s1 != s2) return (s1 > s2); - i1++; i2++; - /* 3 */ - c1 = block[i1]; c2 = block[i2]; - if (c1 != c2) return (c1 > c2); - s1 = quadrant[i1]; s2 = quadrant[i2]; - if (s1 != s2) return (s1 > s2); - i1++; i2++; - /* 4 */ - c1 = block[i1]; c2 = block[i2]; - if (c1 != c2) return (c1 > c2); - s1 = quadrant[i1]; s2 = quadrant[i2]; - if (s1 != s2) return (s1 > s2); - i1++; i2++; - /* 5 */ - c1 = block[i1]; c2 = block[i2]; - if (c1 != c2) return (c1 > c2); - s1 = quadrant[i1]; s2 = quadrant[i2]; - if (s1 != s2) return (s1 > s2); - i1++; i2++; - /* 6 */ - c1 = block[i1]; c2 = block[i2]; - if (c1 != c2) return (c1 > c2); - s1 = quadrant[i1]; s2 = quadrant[i2]; - if (s1 != s2) return (s1 > s2); - i1++; i2++; - /* 7 */ - c1 = block[i1]; c2 = block[i2]; - if (c1 != c2) return (c1 > c2); - s1 = quadrant[i1]; s2 = quadrant[i2]; - if (s1 != s2) return (s1 > s2); - i1++; i2++; - /* 8 */ - c1 = block[i1]; c2 = block[i2]; - if (c1 != c2) return (c1 > c2); - s1 = quadrant[i1]; s2 = quadrant[i2]; - if (s1 != s2) return (s1 > s2); - i1++; i2++; - - if (i1 >= nblock) i1 -= nblock; - if (i2 >= nblock) i2 -= nblock; - - k -= 8; - (*budget)--; - } - while (k >= 0); - - return False; -} - - -/*---------------------------------------------*/ -/*-- - Knuth's increments seem to work better - than Incerpi-Sedgewick here. Possibly - because the number of elems to sort is - usually small, typically <= 20. ---*/ -static -Int32 incs[14] = { 1, 4, 13, 40, 121, 364, 1093, 3280, - 9841, 29524, 88573, 265720, - 797161, 2391484 }; - -static -void mainSimpleSort ( UInt32* ptr, - UChar* block, - UInt16* quadrant, - Int32 nblock, - Int32 lo, - Int32 hi, - Int32 d, - Int32* budget ) -{ - Int32 i, j, h, bigN, hp; - UInt32 v; - - bigN = hi - lo + 1; - if (bigN < 2) return; - - hp = 0; - while (incs[hp] < bigN) hp++; - hp--; - - for (; hp >= 0; hp--) { - h = incs[hp]; - - i = lo + h; - while (True) { - - /*-- copy 1 --*/ - if (i > hi) break; - v = ptr[i]; - j = i; - while ( mainGtU ( - ptr[j-h]+d, v+d, block, quadrant, nblock, budget - ) ) { - ptr[j] = ptr[j-h]; - j = j - h; - if (j <= (lo + h - 1)) break; - } - ptr[j] = v; - i++; - - /*-- copy 2 --*/ - if (i > hi) break; - v = ptr[i]; - j = i; - while ( mainGtU ( - ptr[j-h]+d, v+d, block, quadrant, nblock, budget - ) ) { - ptr[j] = ptr[j-h]; - j = j - h; - if (j <= (lo + h - 1)) break; - } - ptr[j] = v; - i++; - - /*-- copy 3 --*/ - if (i > hi) break; - v = ptr[i]; - j = i; - while ( mainGtU ( - ptr[j-h]+d, v+d, block, quadrant, nblock, budget - ) ) { - ptr[j] = ptr[j-h]; - j = j - h; - if (j <= (lo + h - 1)) break; - } - ptr[j] = v; - i++; - - if (*budget < 0) return; - } - } -} - - -/*---------------------------------------------*/ -/*-- - The following is an implementation of - an elegant 3-way quicksort for strings, - described in a paper "Fast Algorithms for - Sorting and Searching Strings", by Robert - Sedgewick and Jon L. Bentley. ---*/ - -#define mswap(zz1, zz2) \ - { Int32 zztmp = zz1; zz1 = zz2; zz2 = zztmp; } - -#define mvswap(zzp1, zzp2, zzn) \ -{ \ - Int32 yyp1 = (zzp1); \ - Int32 yyp2 = (zzp2); \ - Int32 yyn = (zzn); \ - while (yyn > 0) { \ - mswap(ptr[yyp1], ptr[yyp2]); \ - yyp1++; yyp2++; yyn--; \ - } \ -} - -static -__inline__ -UChar mmed3 ( UChar a, UChar b, UChar c ) -{ - UChar t; - if (a > b) { t = a; a = b; b = t; }; - if (b > c) { - b = c; - if (a > b) b = a; - } - return b; -} - -#define mmin(a,b) ((a) < (b)) ? (a) : (b) - -#define mpush(lz,hz,dz) { stackLo[sp] = lz; \ - stackHi[sp] = hz; \ - stackD [sp] = dz; \ - sp++; } - -#define mpop(lz,hz,dz) { sp--; \ - lz = stackLo[sp]; \ - hz = stackHi[sp]; \ - dz = stackD [sp]; } - - -#define mnextsize(az) (nextHi[az]-nextLo[az]) - -#define mnextswap(az,bz) \ - { Int32 tz; \ - tz = nextLo[az]; nextLo[az] = nextLo[bz]; nextLo[bz] = tz; \ - tz = nextHi[az]; nextHi[az] = nextHi[bz]; nextHi[bz] = tz; \ - tz = nextD [az]; nextD [az] = nextD [bz]; nextD [bz] = tz; } - - -#define MAIN_QSORT_SMALL_THRESH 20 -#define MAIN_QSORT_DEPTH_THRESH (BZ_N_RADIX + BZ_N_QSORT) -#define MAIN_QSORT_STACK_SIZE 100 - -static -void mainQSort3 ( UInt32* ptr, - UChar* block, - UInt16* quadrant, - Int32 nblock, - Int32 loSt, - Int32 hiSt, - Int32 dSt, - Int32* budget ) -{ - Int32 unLo, unHi, ltLo, gtHi, n, m, med; - Int32 sp, lo, hi, d; - - Int32 stackLo[MAIN_QSORT_STACK_SIZE]; - Int32 stackHi[MAIN_QSORT_STACK_SIZE]; - Int32 stackD [MAIN_QSORT_STACK_SIZE]; - - Int32 nextLo[3]; - Int32 nextHi[3]; - Int32 nextD [3]; - - sp = 0; - mpush ( loSt, hiSt, dSt ); - - while (sp > 0) { - - AssertH ( sp < MAIN_QSORT_STACK_SIZE, 1001 ); - - mpop ( lo, hi, d ); - if (hi - lo < MAIN_QSORT_SMALL_THRESH || - d > MAIN_QSORT_DEPTH_THRESH) { - mainSimpleSort ( ptr, block, quadrant, nblock, lo, hi, d, budget ); - if (*budget < 0) return; - continue; - } - - med = (Int32) - mmed3 ( block[ptr[ lo ]+d], - block[ptr[ hi ]+d], - block[ptr[ (lo+hi)>>1 ]+d] ); - - unLo = ltLo = lo; - unHi = gtHi = hi; - - while (True) { - while (True) { - if (unLo > unHi) break; - n = ((Int32)block[ptr[unLo]+d]) - med; - if (n == 0) { - mswap(ptr[unLo], ptr[ltLo]); - ltLo++; unLo++; continue; - }; - if (n > 0) break; - unLo++; - } - while (True) { - if (unLo > unHi) break; - n = ((Int32)block[ptr[unHi]+d]) - med; - if (n == 0) { - mswap(ptr[unHi], ptr[gtHi]); - gtHi--; unHi--; continue; - }; - if (n < 0) break; - unHi--; - } - if (unLo > unHi) break; - mswap(ptr[unLo], ptr[unHi]); unLo++; unHi--; - } - - AssertD ( unHi == unLo-1, "mainQSort3(2)" ); - - if (gtHi < ltLo) { - mpush(lo, hi, d+1 ); - continue; - } - - n = mmin(ltLo-lo, unLo-ltLo); mvswap(lo, unLo-n, n); - m = mmin(hi-gtHi, gtHi-unHi); mvswap(unLo, hi-m+1, m); - - n = lo + unLo - ltLo - 1; - m = hi - (gtHi - unHi) + 1; - - nextLo[0] = lo; nextHi[0] = n; nextD[0] = d; - nextLo[1] = m; nextHi[1] = hi; nextD[1] = d; - nextLo[2] = n+1; nextHi[2] = m-1; nextD[2] = d+1; - - if (mnextsize(0) < mnextsize(1)) mnextswap(0,1); - if (mnextsize(1) < mnextsize(2)) mnextswap(1,2); - if (mnextsize(0) < mnextsize(1)) mnextswap(0,1); - - AssertD (mnextsize(0) >= mnextsize(1), "mainQSort3(8)" ); - AssertD (mnextsize(1) >= mnextsize(2), "mainQSort3(9)" ); - - mpush (nextLo[0], nextHi[0], nextD[0]); - mpush (nextLo[1], nextHi[1], nextD[1]); - mpush (nextLo[2], nextHi[2], nextD[2]); - } -} - -#undef mswap -#undef mvswap -#undef mpush -#undef mpop -#undef mmin -#undef mnextsize -#undef mnextswap -#undef MAIN_QSORT_SMALL_THRESH -#undef MAIN_QSORT_DEPTH_THRESH -#undef MAIN_QSORT_STACK_SIZE - - -/*---------------------------------------------*/ -/* Pre: - nblock > N_OVERSHOOT - block32 exists for [0 .. nblock-1 +N_OVERSHOOT] - ((UChar*)block32) [0 .. nblock-1] holds block - ptr exists for [0 .. nblock-1] - - Post: - ((UChar*)block32) [0 .. nblock-1] holds block - All other areas of block32 destroyed - ftab [0 .. 65536 ] destroyed - ptr [0 .. nblock-1] holds sorted order - if (*budget < 0), sorting was abandoned -*/ - -#define BIGFREQ(b) (ftab[((b)+1) << 8] - ftab[(b) << 8]) -#define SETMASK (1 << 21) -#define CLEARMASK (~(SETMASK)) - -static -void mainSort ( UInt32* ptr, - UChar* block, - UInt16* quadrant, - UInt32* ftab, - Int32 nblock, - Int32 verb, - Int32* budget ) -{ - Int32 i, j, k, ss, sb; - Int32 runningOrder[256]; - Bool bigDone[256]; - Int32 copyStart[256]; - Int32 copyEnd [256]; - UChar c1; - Int32 numQSorted; - UInt16 s; - if (verb >= 4) VPrintf0 ( " main sort initialise ...\n" ); - - /*-- set up the 2-byte frequency table --*/ - for (i = 65536; i >= 0; i--) ftab[i] = 0; - - j = block[0] << 8; - i = nblock-1; - for (; i >= 3; i -= 4) { - quadrant[i] = 0; - j = (j >> 8) | ( ((UInt16)block[i]) << 8); - ftab[j]++; - quadrant[i-1] = 0; - j = (j >> 8) | ( ((UInt16)block[i-1]) << 8); - ftab[j]++; - quadrant[i-2] = 0; - j = (j >> 8) | ( ((UInt16)block[i-2]) << 8); - ftab[j]++; - quadrant[i-3] = 0; - j = (j >> 8) | ( ((UInt16)block[i-3]) << 8); - ftab[j]++; - } - for (; i >= 0; i--) { - quadrant[i] = 0; - j = (j >> 8) | ( ((UInt16)block[i]) << 8); - ftab[j]++; - } - - /*-- (emphasises close relationship of block & quadrant) --*/ - for (i = 0; i < BZ_N_OVERSHOOT; i++) { - block [nblock+i] = block[i]; - quadrant[nblock+i] = 0; - } - - if (verb >= 4) VPrintf0 ( " bucket sorting ...\n" ); - - /*-- Complete the initial radix sort --*/ - for (i = 1; i <= 65536; i++) ftab[i] += ftab[i-1]; - - s = block[0] << 8; - i = nblock-1; - for (; i >= 3; i -= 4) { - s = (s >> 8) | (block[i] << 8); - j = ftab[s] -1; - ftab[s] = j; - ptr[j] = i; - s = (s >> 8) | (block[i-1] << 8); - j = ftab[s] -1; - ftab[s] = j; - ptr[j] = i-1; - s = (s >> 8) | (block[i-2] << 8); - j = ftab[s] -1; - ftab[s] = j; - ptr[j] = i-2; - s = (s >> 8) | (block[i-3] << 8); - j = ftab[s] -1; - ftab[s] = j; - ptr[j] = i-3; - } - for (; i >= 0; i--) { - s = (s >> 8) | (block[i] << 8); - j = ftab[s] -1; - ftab[s] = j; - ptr[j] = i; - } - - /*-- - Now ftab contains the first loc of every small bucket. - Calculate the running order, from smallest to largest - big bucket. - --*/ - for (i = 0; i <= 255; i++) { - bigDone [i] = False; - runningOrder[i] = i; - } - - { - Int32 vv; - Int32 h = 1; - do h = 3 * h + 1; while (h <= 256); - do { - h = h / 3; - for (i = h; i <= 255; i++) { - vv = runningOrder[i]; - j = i; - while ( BIGFREQ(runningOrder[j-h]) > BIGFREQ(vv) ) { - runningOrder[j] = runningOrder[j-h]; - j = j - h; - if (j <= (h - 1)) goto zero; - } - zero: - runningOrder[j] = vv; - } - } while (h != 1); - } - - /*-- - The main sorting loop. - --*/ - - numQSorted = 0; - - for (i = 0; i <= 255; i++) { - - /*-- - Process big buckets, starting with the least full. - Basically this is a 3-step process in which we call - mainQSort3 to sort the small buckets [ss, j], but - also make a big effort to avoid the calls if we can. - --*/ - ss = runningOrder[i]; - - /*-- - Step 1: - Complete the big bucket [ss] by quicksorting - any unsorted small buckets [ss, j], for j != ss. - Hopefully previous pointer-scanning phases have already - completed many of the small buckets [ss, j], so - we don't have to sort them at all. - --*/ - for (j = 0; j <= 255; j++) { - if (j != ss) { - sb = (ss << 8) + j; - if ( ! (ftab[sb] & SETMASK) ) { - Int32 lo = ftab[sb] & CLEARMASK; - Int32 hi = (ftab[sb+1] & CLEARMASK) - 1; - if (hi > lo) { - if (verb >= 4) - VPrintf4 ( " qsort [0x%x, 0x%x] " - "done %d this %d\n", - ss, j, numQSorted, hi - lo + 1 ); - mainQSort3 ( - ptr, block, quadrant, nblock, - lo, hi, BZ_N_RADIX, budget - ); - numQSorted += (hi - lo + 1); - if (*budget < 0) return; - } - } - ftab[sb] |= SETMASK; - } - } - - AssertH ( !bigDone[ss], 1006 ); - - /*-- - Step 2: - Now scan this big bucket [ss] so as to synthesise the - sorted order for small buckets [t, ss] for all t, - including, magically, the bucket [ss,ss] too. - This will avoid doing Real Work in subsequent Step 1's. - --*/ - { - for (j = 0; j <= 255; j++) { - copyStart[j] = ftab[(j << 8) + ss] & CLEARMASK; - copyEnd [j] = (ftab[(j << 8) + ss + 1] & CLEARMASK) - 1; - } - for (j = ftab[ss << 8] & CLEARMASK; j < copyStart[ss]; j++) { - k = ptr[j]-1; if (k < 0) k += nblock; - c1 = block[k]; - if (!bigDone[c1]) - ptr[ copyStart[c1]++ ] = k; - } - for (j = (ftab[(ss+1) << 8] & CLEARMASK) - 1; j > copyEnd[ss]; j--) { - k = ptr[j]-1; if (k < 0) k += nblock; - c1 = block[k]; - if (!bigDone[c1]) - ptr[ copyEnd[c1]-- ] = k; - } - } - - AssertH ( copyStart[ss]-1 == copyEnd[ss], 1007 ); - - for (j = 0; j <= 255; j++) ftab[(j << 8) + ss] |= SETMASK; - - /*-- - Step 3: - The [ss] big bucket is now done. Record this fact, - and update the quadrant descriptors. Remember to - update quadrants in the overshoot area too, if - necessary. The "if (i < 255)" test merely skips - this updating for the last bucket processed, since - updating for the last bucket is pointless. - - The quadrant array provides a way to incrementally - cache sort orderings, as they appear, so as to - make subsequent comparisons in fullGtU() complete - faster. For repetitive blocks this makes a big - difference (but not big enough to be able to avoid - the fallback sorting mechanism, exponential radix sort). - - The precise meaning is: at all times: - - for 0 <= i < nblock and 0 <= j <= nblock - - if block[i] != block[j], - - then the relative values of quadrant[i] and - quadrant[j] are meaningless. - - else { - if quadrant[i] < quadrant[j] - then the string starting at i lexicographically - precedes the string starting at j - - else if quadrant[i] > quadrant[j] - then the string starting at j lexicographically - precedes the string starting at i - - else - the relative ordering of the strings starting - at i and j has not yet been determined. - } - --*/ - bigDone[ss] = True; - - if (i < 255) { - Int32 bbStart = ftab[ss << 8] & CLEARMASK; - Int32 bbSize = (ftab[(ss+1) << 8] & CLEARMASK) - bbStart; - Int32 shifts = 0; - - while ((bbSize >> shifts) > 65534) shifts++; - - for (j = bbSize-1; j >= 0; j--) { - Int32 a2update = ptr[bbStart + j]; - UInt16 qVal = (UInt16)(j >> shifts); - quadrant[a2update] = qVal; - if (a2update < BZ_N_OVERSHOOT) - quadrant[a2update + nblock] = qVal; - } - AssertH ( ((bbSize-1) >> shifts) <= 65535, 1002 ); - } - - } - - if (verb >= 4) - VPrintf3 ( " %d pointers, %d sorted, %d scanned\n", - nblock, numQSorted, nblock - numQSorted ); -} - -#undef BIGFREQ -#undef SETMASK -#undef CLEARMASK - - -/*---------------------------------------------*/ -/* Pre: - nblock > 0 - arr2 exists for [0 .. nblock-1 +N_OVERSHOOT] - ((UChar*)arr2) [0 .. nblock-1] holds block - arr1 exists for [0 .. nblock-1] - - Post: - ((UChar*)arr2) [0 .. nblock-1] holds block - All other areas of block destroyed - ftab [ 0 .. 65536 ] destroyed - arr1 [0 .. nblock-1] holds sorted order -*/ -void BZ2_blockSort ( EState* s ) -{ - UInt32* ptr = s->ptr; - UChar* block = s->block; - UInt32* ftab = s->ftab; - Int32 nblock = s->nblock; - Int32 verb = s->verbosity; - Int32 wfact = s->workFactor; - UInt16* quadrant; - Int32 budget; - Int32 budgetInit; - Int32 i; - - if (nblock < 10000) { - fallbackSort ( s->arr1, s->arr2, ftab, nblock, verb ); - } else { - /* Calculate the location for quadrant, remembering to get - the alignment right. Assumes that &(block[0]) is at least - 2-byte aligned -- this should be ok since block is really - the first section of arr2. - */ - i = nblock+BZ_N_OVERSHOOT; - if (i & 1) i++; - quadrant = (UInt16*)(&(block[i])); - - /* (wfact-1) / 3 puts the default-factor-30 - transition point at very roughly the same place as - with v0.1 and v0.9.0. - Not that it particularly matters any more, since the - resulting compressed stream is now the same regardless - of whether or not we use the main sort or fallback sort. - */ - if (wfact < 1 ) wfact = 1; - if (wfact > 100) wfact = 100; - budgetInit = nblock * ((wfact-1) / 3); - budget = budgetInit; - - mainSort ( ptr, block, quadrant, ftab, nblock, verb, &budget ); - if (verb >= 3) - VPrintf3 ( " %d work, %d block, ratio %5.2f\n", - budgetInit - budget, - nblock, - (float)(budgetInit - budget) / - (float)(nblock==0 ? 1 : nblock) ); - if (budget < 0) { - if (verb >= 2) - VPrintf0 ( " too repetitive; using fallback" - " sorting algorithm\n" ); - fallbackSort ( s->arr1, s->arr2, ftab, nblock, verb ); - } - } - - s->origPtr = -1; - for (i = 0; i < s->nblock; i++) - if (ptr[i] == 0) - { s->origPtr = i; break; }; - - AssertH( s->origPtr != -1, 1003 ); -} - - -/*-------------------------------------------------------------*/ -/*--- end blocksort.c ---*/ -/*-------------------------------------------------------------*/ diff --git a/mdk-stage1/bzlib/bzlib.c b/mdk-stage1/bzlib/bzlib.c deleted file mode 100644 index ebf6e269b..000000000 --- a/mdk-stage1/bzlib/bzlib.c +++ /dev/null @@ -1,1567 +0,0 @@ - -/*-------------------------------------------------------------*/ -/*--- Library top-level functions. ---*/ -/*--- bzlib.c ---*/ -/*-------------------------------------------------------------*/ - -/*-- - This file is a part of bzip2 and/or libbzip2, a program and - library for lossless, block-sorting data compression. - - Copyright (C) 1996-2000 Julian R Seward. All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 2. The origin of this software must not be misrepresented; you must - not claim that you wrote the original software. If you use this - software in a product, an acknowledgment in the product - documentation would be appreciated but is not required. - - 3. Altered source versions must be plainly marked as such, and must - not be misrepresented as being the original software. - - 4. The name of the author may not be used to endorse or promote - products derived from this software without specific prior written - permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - Julian Seward, Cambridge, UK. - jseward@acm.org - bzip2/libbzip2 version 1.0 of 21 March 2000 - - This program is based on (at least) the work of: - Mike Burrows - David Wheeler - Peter Fenwick - Alistair Moffat - Radford Neal - Ian H. Witten - Robert Sedgewick - Jon L. Bentley - - For more information on these sources, see the manual. ---*/ - -/*-- - CHANGES - ~~~~~~~ - 0.9.0 -- original version. - - 0.9.0a/b -- no changes in this file. - - 0.9.0c - * made zero-length BZ_FLUSH work correctly in bzCompress(). - * fixed bzWrite/bzRead to ignore zero-length requests. - * fixed bzread to correctly handle read requests after EOF. - * wrong parameter order in call to bzDecompressInit in - bzBuffToBuffDecompress. Fixed. ---*/ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - - - -#include "bzlib_private.h" - - -/*---------------------------------------------------*/ -/*--- Compression stuff ---*/ -/*---------------------------------------------------*/ - - -/*---------------------------------------------------*/ -#ifndef BZ_NO_STDIO -void BZ2_bz__AssertH__fail ( int errcode ) -{ - fprintf(stderr, - "\n\nbzip2/libbzip2: internal error number %d.\n" - "This is a bug in bzip2/libbzip2, %s.\n" - "Please report it to me at: jseward@acm.org. If this happened\n" - "when you were using some program which uses libbzip2 as a\n" - "component, you should also report this bug to the author(s)\n" - "of that program. Please make an effort to report this bug;\n" - "timely and accurate bug reports eventually lead to higher\n" - "quality software. Thanks. Julian Seward, 21 March 2000.\n\n", - errcode, - BZ2_bzlibVersion() - ); - exit(3); -} -#endif - - -/*---------------------------------------------------*/ -static -int bz_config_ok ( void ) -{ - if (sizeof(int) != 4) return 0; - if (sizeof(short) != 2) return 0; - if (sizeof(char) != 1) return 0; - return 1; -} - - -/*---------------------------------------------------*/ -static -void* default_bzalloc ( void* opaque, Int32 items, Int32 size ) -{ - void* v = malloc ( items * size ); - return v; -} - -static -void default_bzfree ( void* opaque, void* addr ) -{ - if (addr != NULL) free ( addr ); -} - - -/*---------------------------------------------------*/ -static -void prepare_new_block ( EState* s ) -{ - Int32 i; - s->nblock = 0; - s->numZ = 0; - s->state_out_pos = 0; - BZ_INITIALISE_CRC ( s->blockCRC ); - for (i = 0; i < 256; i++) s->inUse[i] = False; - s->blockNo++; -} - - -/*---------------------------------------------------*/ -static -void init_RL ( EState* s ) -{ - s->state_in_ch = 256; - s->state_in_len = 0; -} - - -static -Bool isempty_RL ( EState* s ) -{ - if (s->state_in_ch < 256 && s->state_in_len > 0) - return False; else - return True; -} - - -/*---------------------------------------------------*/ -int BZ_API(BZ2_bzCompressInit) - ( bz_stream* strm, - int blockSize100k, - int verbosity, - int workFactor ) -{ - Int32 n; - EState* s; - - if (!bz_config_ok()) return BZ_CONFIG_ERROR; - - if (strm == NULL || - blockSize100k < 1 || blockSize100k > 9 || - workFactor < 0 || workFactor > 250) - return BZ_PARAM_ERROR; - - if (workFactor == 0) workFactor = 30; - if (strm->bzalloc == NULL) strm->bzalloc = default_bzalloc; - if (strm->bzfree == NULL) strm->bzfree = default_bzfree; - - s = BZALLOC( sizeof(EState) ); - if (s == NULL) return BZ_MEM_ERROR; - s->strm = strm; - - s->arr1 = NULL; - s->arr2 = NULL; - s->ftab = NULL; - - n = 100000 * blockSize100k; - s->arr1 = BZALLOC( n * sizeof(UInt32) ); - s->arr2 = BZALLOC( (n+BZ_N_OVERSHOOT) * sizeof(UInt32) ); - s->ftab = BZALLOC( 65537 * sizeof(UInt32) ); - - if (s->arr1 == NULL || s->arr2 == NULL || s->ftab == NULL) { - if (s->arr1 != NULL) BZFREE(s->arr1); - if (s->arr2 != NULL) BZFREE(s->arr2); - if (s->ftab != NULL) BZFREE(s->ftab); - if (s != NULL) BZFREE(s); - return BZ_MEM_ERROR; - } - - s->blockNo = 0; - s->state = BZ_S_INPUT; - s->mode = BZ_M_RUNNING; - s->combinedCRC = 0; - s->blockSize100k = blockSize100k; - s->nblockMAX = 100000 * blockSize100k - 19; - s->verbosity = verbosity; - s->workFactor = workFactor; - - s->block = (UChar*)s->arr2; - s->mtfv = (UInt16*)s->arr1; - s->zbits = NULL; - s->ptr = (UInt32*)s->arr1; - - strm->state = s; - strm->total_in_lo32 = 0; - strm->total_in_hi32 = 0; - strm->total_out_lo32 = 0; - strm->total_out_hi32 = 0; - init_RL ( s ); - prepare_new_block ( s ); - return BZ_OK; -} - - -/*---------------------------------------------------*/ -static -void add_pair_to_block ( EState* s ) -{ - Int32 i; - UChar ch = (UChar)(s->state_in_ch); - for (i = 0; i < s->state_in_len; i++) { - BZ_UPDATE_CRC( s->blockCRC, ch ); - } - s->inUse[s->state_in_ch] = True; - switch (s->state_in_len) { - case 1: - s->block[s->nblock] = (UChar)ch; s->nblock++; - break; - case 2: - s->block[s->nblock] = (UChar)ch; s->nblock++; - s->block[s->nblock] = (UChar)ch; s->nblock++; - break; - case 3: - s->block[s->nblock] = (UChar)ch; s->nblock++; - s->block[s->nblock] = (UChar)ch; s->nblock++; - s->block[s->nblock] = (UChar)ch; s->nblock++; - break; - default: - s->inUse[s->state_in_len-4] = True; - s->block[s->nblock] = (UChar)ch; s->nblock++; - s->block[s->nblock] = (UChar)ch; s->nblock++; - s->block[s->nblock] = (UChar)ch; s->nblock++; - s->block[s->nblock] = (UChar)ch; s->nblock++; - s->block[s->nblock] = ((UChar)(s->state_in_len-4)); - s->nblock++; - break; - } -} - - -/*---------------------------------------------------*/ -static -void flush_RL ( EState* s ) -{ - if (s->state_in_ch < 256) add_pair_to_block ( s ); - init_RL ( s ); -} - - -/*---------------------------------------------------*/ -#define ADD_CHAR_TO_BLOCK(zs,zchh0) \ -{ \ - UInt32 zchh = (UInt32)(zchh0); \ - /*-- fast track the common case --*/ \ - if (zchh != zs->state_in_ch && \ - zs->state_in_len == 1) { \ - UChar ch = (UChar)(zs->state_in_ch); \ - BZ_UPDATE_CRC( zs->blockCRC, ch ); \ - zs->inUse[zs->state_in_ch] = True; \ - zs->block[zs->nblock] = (UChar)ch; \ - zs->nblock++; \ - zs->state_in_ch = zchh; \ - } \ - else \ - /*-- general, uncommon cases --*/ \ - if (zchh != zs->state_in_ch || \ - zs->state_in_len == 255) { \ - if (zs->state_in_ch < 256) \ - add_pair_to_block ( zs ); \ - zs->state_in_ch = zchh; \ - zs->state_in_len = 1; \ - } else { \ - zs->state_in_len++; \ - } \ -} - - -/*---------------------------------------------------*/ -static -Bool copy_input_until_stop ( EState* s ) -{ - Bool progress_in = False; - - if (s->mode == BZ_M_RUNNING) { - - /*-- fast track the common case --*/ - while (True) { - /*-- block full? --*/ - if (s->nblock >= s->nblockMAX) break; - /*-- no input? --*/ - if (s->strm->avail_in == 0) break; - progress_in = True; - ADD_CHAR_TO_BLOCK ( s, (UInt32)(*((UChar*)(s->strm->next_in))) ); - s->strm->next_in++; - s->strm->avail_in--; - s->strm->total_in_lo32++; - if (s->strm->total_in_lo32 == 0) s->strm->total_in_hi32++; - } - - } else { - - /*-- general, uncommon case --*/ - while (True) { - /*-- block full? --*/ - if (s->nblock >= s->nblockMAX) break; - /*-- no input? --*/ - if (s->strm->avail_in == 0) break; - /*-- flush/finish end? --*/ - if (s->avail_in_expect == 0) break; - progress_in = True; - ADD_CHAR_TO_BLOCK ( s, (UInt32)(*((UChar*)(s->strm->next_in))) ); - s->strm->next_in++; - s->strm->avail_in--; - s->strm->total_in_lo32++; - if (s->strm->total_in_lo32 == 0) s->strm->total_in_hi32++; - s->avail_in_expect--; - } - } - return progress_in; -} - - -/*---------------------------------------------------*/ -static -Bool copy_output_until_stop ( EState* s ) -{ - Bool progress_out = False; - - while (True) { - - /*-- no output space? --*/ - if (s->strm->avail_out == 0) break; - - /*-- block done? --*/ - if (s->state_out_pos >= s->numZ) break; - - progress_out = True; - *(s->strm->next_out) = s->zbits[s->state_out_pos]; - s->state_out_pos++; - s->strm->avail_out--; - s->strm->next_out++; - s->strm->total_out_lo32++; - if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++; - } - - return progress_out; -} - - -/*---------------------------------------------------*/ -static -Bool handle_compress ( bz_stream* strm ) -{ - Bool progress_in = False; - Bool progress_out = False; - EState* s = strm->state; - - while (True) { - - if (s->state == BZ_S_OUTPUT) { - progress_out |= copy_output_until_stop ( s ); - if (s->state_out_pos < s->numZ) break; - if (s->mode == BZ_M_FINISHING && - s->avail_in_expect == 0 && - isempty_RL(s)) break; - prepare_new_block ( s ); - s->state = BZ_S_INPUT; - if (s->mode == BZ_M_FLUSHING && - s->avail_in_expect == 0 && - isempty_RL(s)) break; - } - - if (s->state == BZ_S_INPUT) { - progress_in |= copy_input_until_stop ( s ); - if (s->mode != BZ_M_RUNNING && s->avail_in_expect == 0) { - flush_RL ( s ); - BZ2_compressBlock ( s, (Bool)(s->mode == BZ_M_FINISHING) ); - s->state = BZ_S_OUTPUT; - } - else - if (s->nblock >= s->nblockMAX) { - BZ2_compressBlock ( s, False ); - s->state = BZ_S_OUTPUT; - } - else - if (s->strm->avail_in == 0) { - break; - } - } - - } - - return progress_in || progress_out; -} - - -/*---------------------------------------------------*/ -int BZ_API(BZ2_bzCompress) ( bz_stream *strm, int action ) -{ - Bool progress; - EState* s; - if (strm == NULL) return BZ_PARAM_ERROR; - s = strm->state; - if (s == NULL) return BZ_PARAM_ERROR; - if (s->strm != strm) return BZ_PARAM_ERROR; - - preswitch: - switch (s->mode) { - - case BZ_M_IDLE: - return BZ_SEQUENCE_ERROR; - - case BZ_M_RUNNING: - if (action == BZ_RUN) { - progress = handle_compress ( strm ); - return progress ? BZ_RUN_OK : BZ_PARAM_ERROR; - } - else - if (action == BZ_FLUSH) { - s->avail_in_expect = strm->avail_in; - s->mode = BZ_M_FLUSHING; - goto preswitch; - } - else - if (action == BZ_FINISH) { - s->avail_in_expect = strm->avail_in; - s->mode = BZ_M_FINISHING; - goto preswitch; - } - else - return BZ_PARAM_ERROR; - - case BZ_M_FLUSHING: - if (action != BZ_FLUSH) return BZ_SEQUENCE_ERROR; - if (s->avail_in_expect != s->strm->avail_in) - return BZ_SEQUENCE_ERROR; - progress = handle_compress ( strm ); - if (s->avail_in_expect > 0 || !isempty_RL(s) || - s->state_out_pos < s->numZ) return BZ_FLUSH_OK; - s->mode = BZ_M_RUNNING; - return BZ_RUN_OK; - - case BZ_M_FINISHING: - if (action != BZ_FINISH) return BZ_SEQUENCE_ERROR; - if (s->avail_in_expect != s->strm->avail_in) - return BZ_SEQUENCE_ERROR; - progress = handle_compress ( strm ); - if (!progress) return BZ_SEQUENCE_ERROR; - if (s->avail_in_expect > 0 || !isempty_RL(s) || - s->state_out_pos < s->numZ) return BZ_FINISH_OK; - s->mode = BZ_M_IDLE; - return BZ_STREAM_END; - } - return BZ_OK; /*--not reached--*/ -} - - -/*---------------------------------------------------*/ -int BZ_API(BZ2_bzCompressEnd) ( bz_stream *strm ) -{ - EState* s; - if (strm == NULL) return BZ_PARAM_ERROR; - s = strm->state; - if (s == NULL) return BZ_PARAM_ERROR; - if (s->strm != strm) return BZ_PARAM_ERROR; - - if (s->arr1 != NULL) BZFREE(s->arr1); - if (s->arr2 != NULL) BZFREE(s->arr2); - if (s->ftab != NULL) BZFREE(s->ftab); - BZFREE(strm->state); - - strm->state = NULL; - - return BZ_OK; -} - - -/*---------------------------------------------------*/ -/*--- Decompression stuff ---*/ -/*---------------------------------------------------*/ - -/*---------------------------------------------------*/ -int BZ_API(BZ2_bzDecompressInit) - ( bz_stream* strm, - int verbosity, - int small ) -{ - DState* s; - - if (!bz_config_ok()) return BZ_CONFIG_ERROR; - - if (strm == NULL) return BZ_PARAM_ERROR; - if (small != 0 && small != 1) return BZ_PARAM_ERROR; - if (verbosity < 0 || verbosity > 4) return BZ_PARAM_ERROR; - - if (strm->bzalloc == NULL) strm->bzalloc = default_bzalloc; - if (strm->bzfree == NULL) strm->bzfree = default_bzfree; - - s = BZALLOC( sizeof(DState) ); - if (s == NULL) return BZ_MEM_ERROR; - s->strm = strm; - strm->state = s; - s->state = BZ_X_MAGIC_1; - s->bsLive = 0; - s->bsBuff = 0; - s->calculatedCombinedCRC = 0; - strm->total_in_lo32 = 0; - strm->total_in_hi32 = 0; - strm->total_out_lo32 = 0; - strm->total_out_hi32 = 0; - s->smallDecompress = (Bool)small; - s->ll4 = NULL; - s->ll16 = NULL; - s->tt = NULL; - s->currBlockNo = 0; - s->verbosity = verbosity; - - return BZ_OK; -} - - -/*---------------------------------------------------*/ -static -void unRLE_obuf_to_output_FAST ( DState* s ) -{ - UChar k1; - - if (s->blockRandomised) { - - while (True) { - /* try to finish existing run */ - while (True) { - if (s->strm->avail_out == 0) return; - if (s->state_out_len == 0) break; - *( (UChar*)(s->strm->next_out) ) = s->state_out_ch; - BZ_UPDATE_CRC ( s->calculatedBlockCRC, s->state_out_ch ); - s->state_out_len--; - s->strm->next_out++; - s->strm->avail_out--; - s->strm->total_out_lo32++; - if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++; - } - - /* can a new run be started? */ - if (s->nblock_used == s->save_nblock+1) return; - - - s->state_out_len = 1; - s->state_out_ch = s->k0; - BZ_GET_FAST(k1); BZ_RAND_UPD_MASK; - k1 ^= BZ_RAND_MASK; s->nblock_used++; - if (s->nblock_used == s->save_nblock+1) continue; - if (k1 != s->k0) { s->k0 = k1; continue; }; - - s->state_out_len = 2; - BZ_GET_FAST(k1); BZ_RAND_UPD_MASK; - k1 ^= BZ_RAND_MASK; s->nblock_used++; - if (s->nblock_used == s->save_nblock+1) continue; - if (k1 != s->k0) { s->k0 = k1; continue; }; - - s->state_out_len = 3; - BZ_GET_FAST(k1); BZ_RAND_UPD_MASK; - k1 ^= BZ_RAND_MASK; s->nblock_used++; - if (s->nblock_used == s->save_nblock+1) continue; - if (k1 != s->k0) { s->k0 = k1; continue; }; - - BZ_GET_FAST(k1); BZ_RAND_UPD_MASK; - k1 ^= BZ_RAND_MASK; s->nblock_used++; - s->state_out_len = ((Int32)k1) + 4; - BZ_GET_FAST(s->k0); BZ_RAND_UPD_MASK; - s->k0 ^= BZ_RAND_MASK; s->nblock_used++; - } - - } else { - - /* restore */ - UInt32 c_calculatedBlockCRC = s->calculatedBlockCRC; - UChar c_state_out_ch = s->state_out_ch; - Int32 c_state_out_len = s->state_out_len; - Int32 c_nblock_used = s->nblock_used; - Int32 c_k0 = s->k0; - UInt32* c_tt = s->tt; - UInt32 c_tPos = s->tPos; - char* cs_next_out = s->strm->next_out; - unsigned int cs_avail_out = s->strm->avail_out; - /* end restore */ - - UInt32 avail_out_INIT = cs_avail_out; - Int32 s_save_nblockPP = s->save_nblock+1; - unsigned int total_out_lo32_old; - - while (True) { - - /* try to finish existing run */ - if (c_state_out_len > 0) { - while (True) { - if (cs_avail_out == 0) goto return_notr; - if (c_state_out_len == 1) break; - *( (UChar*)(cs_next_out) ) = c_state_out_ch; - BZ_UPDATE_CRC ( c_calculatedBlockCRC, c_state_out_ch ); - c_state_out_len--; - cs_next_out++; - cs_avail_out--; - } - s_state_out_len_eq_one: - { - if (cs_avail_out == 0) { - c_state_out_len = 1; goto return_notr; - }; - *( (UChar*)(cs_next_out) ) = c_state_out_ch; - BZ_UPDATE_CRC ( c_calculatedBlockCRC, c_state_out_ch ); - cs_next_out++; - cs_avail_out--; - } - } - /* can a new run be started? */ - if (c_nblock_used == s_save_nblockPP) { - c_state_out_len = 0; goto return_notr; - }; - c_state_out_ch = c_k0; - BZ_GET_FAST_C(k1); c_nblock_used++; - if (k1 != c_k0) { - c_k0 = k1; goto s_state_out_len_eq_one; - }; - if (c_nblock_used == s_save_nblockPP) - goto s_state_out_len_eq_one; - - c_state_out_len = 2; - BZ_GET_FAST_C(k1); c_nblock_used++; - if (c_nblock_used == s_save_nblockPP) continue; - if (k1 != c_k0) { c_k0 = k1; continue; }; - - c_state_out_len = 3; - BZ_GET_FAST_C(k1); c_nblock_used++; - if (c_nblock_used == s_save_nblockPP) continue; - if (k1 != c_k0) { c_k0 = k1; continue; }; - - BZ_GET_FAST_C(k1); c_nblock_used++; - c_state_out_len = ((Int32)k1) + 4; - BZ_GET_FAST_C(c_k0); c_nblock_used++; - } - - return_notr: - total_out_lo32_old = s->strm->total_out_lo32; - s->strm->total_out_lo32 += (avail_out_INIT - cs_avail_out); - if (s->strm->total_out_lo32 < total_out_lo32_old) - s->strm->total_out_hi32++; - - /* save */ - s->calculatedBlockCRC = c_calculatedBlockCRC; - s->state_out_ch = c_state_out_ch; - s->state_out_len = c_state_out_len; - s->nblock_used = c_nblock_used; - s->k0 = c_k0; - s->tt = c_tt; - s->tPos = c_tPos; - s->strm->next_out = cs_next_out; - s->strm->avail_out = cs_avail_out; - /* end save */ - } -} - - - -/*---------------------------------------------------*/ -__inline__ Int32 BZ2_indexIntoF ( Int32 indx, Int32 *cftab ) -{ - Int32 nb, na, mid; - nb = 0; - na = 256; - do { - mid = (nb + na) >> 1; - if (indx >= cftab[mid]) nb = mid; else na = mid; - } - while (na - nb != 1); - return nb; -} - - -/*---------------------------------------------------*/ -static -void unRLE_obuf_to_output_SMALL ( DState* s ) -{ - UChar k1; - - if (s->blockRandomised) { - - while (True) { - /* try to finish existing run */ - while (True) { - if (s->strm->avail_out == 0) return; - if (s->state_out_len == 0) break; - *( (UChar*)(s->strm->next_out) ) = s->state_out_ch; - BZ_UPDATE_CRC ( s->calculatedBlockCRC, s->state_out_ch ); - s->state_out_len--; - s->strm->next_out++; - s->strm->avail_out--; - s->strm->total_out_lo32++; - if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++; - } - - /* can a new run be started? */ - if (s->nblock_used == s->save_nblock+1) return; - - - s->state_out_len = 1; - s->state_out_ch = s->k0; - BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK; - k1 ^= BZ_RAND_MASK; s->nblock_used++; - if (s->nblock_used == s->save_nblock+1) continue; - if (k1 != s->k0) { s->k0 = k1; continue; }; - - s->state_out_len = 2; - BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK; - k1 ^= BZ_RAND_MASK; s->nblock_used++; - if (s->nblock_used == s->save_nblock+1) continue; - if (k1 != s->k0) { s->k0 = k1; continue; }; - - s->state_out_len = 3; - BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK; - k1 ^= BZ_RAND_MASK; s->nblock_used++; - if (s->nblock_used == s->save_nblock+1) continue; - if (k1 != s->k0) { s->k0 = k1; continue; }; - - BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK; - k1 ^= BZ_RAND_MASK; s->nblock_used++; - s->state_out_len = ((Int32)k1) + 4; - BZ_GET_SMALL(s->k0); BZ_RAND_UPD_MASK; - s->k0 ^= BZ_RAND_MASK; s->nblock_used++; - } - - } else { - - while (True) { - /* try to finish existing run */ - while (True) { - if (s->strm->avail_out == 0) return; - if (s->state_out_len == 0) break; - *( (UChar*)(s->strm->next_out) ) = s->state_out_ch; - BZ_UPDATE_CRC ( s->calculatedBlockCRC, s->state_out_ch ); - s->state_out_len--; - s->strm->next_out++; - s->strm->avail_out--; - s->strm->total_out_lo32++; - if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++; - } - - /* can a new run be started? */ - if (s->nblock_used == s->save_nblock+1) return; - - s->state_out_len = 1; - s->state_out_ch = s->k0; - BZ_GET_SMALL(k1); s->nblock_used++; - if (s->nblock_used == s->save_nblock+1) continue; - if (k1 != s->k0) { s->k0 = k1; continue; }; - - s->state_out_len = 2; - BZ_GET_SMALL(k1); s->nblock_used++; - if (s->nblock_used == s->save_nblock+1) continue; - if (k1 != s->k0) { s->k0 = k1; continue; }; - - s->state_out_len = 3; - BZ_GET_SMALL(k1); s->nblock_used++; - if (s->nblock_used == s->save_nblock+1) continue; - if (k1 != s->k0) { s->k0 = k1; continue; }; - - BZ_GET_SMALL(k1); s->nblock_used++; - s->state_out_len = ((Int32)k1) + 4; - BZ_GET_SMALL(s->k0); s->nblock_used++; - } - - } -} - - -/*---------------------------------------------------*/ -int BZ_API(BZ2_bzDecompress) ( bz_stream *strm ) -{ - DState* s; - if (strm == NULL) return BZ_PARAM_ERROR; - s = strm->state; - if (s == NULL) return BZ_PARAM_ERROR; - if (s->strm != strm) return BZ_PARAM_ERROR; - - while (True) { - if (s->state == BZ_X_IDLE) return BZ_SEQUENCE_ERROR; - if (s->state == BZ_X_OUTPUT) { - if (s->smallDecompress) - unRLE_obuf_to_output_SMALL ( s ); else - unRLE_obuf_to_output_FAST ( s ); - if (s->nblock_used == s->save_nblock+1 && s->state_out_len == 0) { - BZ_FINALISE_CRC ( s->calculatedBlockCRC ); - if (s->verbosity >= 3) - VPrintf2 ( " {0x%x, 0x%x}", s->storedBlockCRC, - s->calculatedBlockCRC ); - if (s->verbosity >= 2) VPrintf0 ( "]" ); - if (s->calculatedBlockCRC != s->storedBlockCRC) - return BZ_DATA_ERROR; - s->calculatedCombinedCRC - = (s->calculatedCombinedCRC << 1) | - (s->calculatedCombinedCRC >> 31); - s->calculatedCombinedCRC ^= s->calculatedBlockCRC; - s->state = BZ_X_BLKHDR_1; - } else { - return BZ_OK; - } - } - if (s->state >= BZ_X_MAGIC_1) { - Int32 r = BZ2_decompress ( s ); - if (r == BZ_STREAM_END) { - if (s->verbosity >= 3) - VPrintf2 ( "\n combined CRCs: stored = 0x%x, computed = 0x%x", - s->storedCombinedCRC, s->calculatedCombinedCRC ); - if (s->calculatedCombinedCRC != s->storedCombinedCRC) - return BZ_DATA_ERROR; - return r; - } - if (s->state != BZ_X_OUTPUT) return r; - } - } - - AssertH ( 0, 6001 ); - - return 0; /*NOTREACHED*/ -} - - -/*---------------------------------------------------*/ -int BZ_API(BZ2_bzDecompressEnd) ( bz_stream *strm ) -{ - DState* s; - if (strm == NULL) return BZ_PARAM_ERROR; - s = strm->state; - if (s == NULL) return BZ_PARAM_ERROR; - if (s->strm != strm) return BZ_PARAM_ERROR; - - if (s->tt != NULL) BZFREE(s->tt); - if (s->ll16 != NULL) BZFREE(s->ll16); - if (s->ll4 != NULL) BZFREE(s->ll4); - - BZFREE(strm->state); - strm->state = NULL; - - return BZ_OK; -} - - -#ifndef BZ_NO_STDIO -/*---------------------------------------------------*/ -/*--- File I/O stuff ---*/ -/*---------------------------------------------------*/ - -#define BZ_SETERR(eee) \ -{ \ - if (bzerror != NULL) *bzerror = eee; \ - if (bzf != NULL) bzf->lastErr = eee; \ -} - -typedef - struct { - FILE* handle; - Char buf[BZ_MAX_UNUSED]; - Int32 bufN; - Bool writing; - bz_stream strm; - Int32 lastErr; - Bool initialisedOk; - } - bzFile; - - -/*---------------------------------------------*/ -static Bool myfeof ( FILE* f ) -{ - return feof(f) ? True : False; -} - - -/*---------------------------------------------------*/ -BZFILE* BZ_API(BZ2_bzWriteOpen) - ( int* bzerror, - FILE* f, - int blockSize100k, - int verbosity, - int workFactor ) -{ - Int32 ret; - bzFile* bzf = NULL; - - BZ_SETERR(BZ_OK); - - if (f == NULL || - (blockSize100k < 1 || blockSize100k > 9) || - (workFactor < 0 || workFactor > 250) || - (verbosity < 0 || verbosity > 4)) - { BZ_SETERR(BZ_PARAM_ERROR); return NULL; }; - - if (ferror(f)) - { BZ_SETERR(BZ_IO_ERROR); return NULL; }; - - bzf = malloc ( sizeof(bzFile) ); - if (bzf == NULL) - { BZ_SETERR(BZ_MEM_ERROR); return NULL; }; - - BZ_SETERR(BZ_OK); - bzf->initialisedOk = False; - bzf->bufN = 0; - bzf->handle = f; - bzf->writing = True; - bzf->strm.bzalloc = NULL; - bzf->strm.bzfree = NULL; - bzf->strm.opaque = NULL; - - if (workFactor == 0) workFactor = 30; - ret = BZ2_bzCompressInit ( &(bzf->strm), blockSize100k, - verbosity, workFactor ); - if (ret != BZ_OK) - { BZ_SETERR(ret); free(bzf); return NULL; }; - - bzf->strm.avail_in = 0; - bzf->initialisedOk = True; - return bzf; -} - - - -/*---------------------------------------------------*/ -void BZ_API(BZ2_bzWrite) - ( int* bzerror, - BZFILE* b, - void* buf, - int len ) -{ - Int32 n, n2, ret; - bzFile* bzf = (bzFile*)b; - - BZ_SETERR(BZ_OK); - if (bzf == NULL || buf == NULL || len < 0) - { BZ_SETERR(BZ_PARAM_ERROR); return; }; - if (!(bzf->writing)) - { BZ_SETERR(BZ_SEQUENCE_ERROR); return; }; - if (ferror(bzf->handle)) - { BZ_SETERR(BZ_IO_ERROR); return; }; - - if (len == 0) - { BZ_SETERR(BZ_OK); return; }; - - bzf->strm.avail_in = len; - bzf->strm.next_in = buf; - - while (True) { - bzf->strm.avail_out = BZ_MAX_UNUSED; - bzf->strm.next_out = bzf->buf; - ret = BZ2_bzCompress ( &(bzf->strm), BZ_RUN ); - if (ret != BZ_RUN_OK) - { BZ_SETERR(ret); return; }; - - if (bzf->strm.avail_out < BZ_MAX_UNUSED) { - n = BZ_MAX_UNUSED - bzf->strm.avail_out; - n2 = fwrite ( (void*)(bzf->buf), sizeof(UChar), - n, bzf->handle ); - if (n != n2 || ferror(bzf->handle)) - { BZ_SETERR(BZ_IO_ERROR); return; }; - } - - if (bzf->strm.avail_in == 0) - { BZ_SETERR(BZ_OK); return; }; - } -} - - -/*---------------------------------------------------*/ -void BZ_API(BZ2_bzWriteClose) - ( int* bzerror, - BZFILE* b, - int abandon, - unsigned int* nbytes_in, - unsigned int* nbytes_out ) -{ - BZ2_bzWriteClose64 ( bzerror, b, abandon, - nbytes_in, NULL, nbytes_out, NULL ); -} - - -void BZ_API(BZ2_bzWriteClose64) - ( int* bzerror, - BZFILE* b, - int abandon, - unsigned int* nbytes_in_lo32, - unsigned int* nbytes_in_hi32, - unsigned int* nbytes_out_lo32, - unsigned int* nbytes_out_hi32 ) -{ - Int32 n, n2, ret; - bzFile* bzf = (bzFile*)b; - - if (bzf == NULL) - { BZ_SETERR(BZ_OK); return; }; - if (!(bzf->writing)) - { BZ_SETERR(BZ_SEQUENCE_ERROR); return; }; - if (ferror(bzf->handle)) - { BZ_SETERR(BZ_IO_ERROR); return; }; - - if (nbytes_in_lo32 != NULL) *nbytes_in_lo32 = 0; - if (nbytes_in_hi32 != NULL) *nbytes_in_hi32 = 0; - if (nbytes_out_lo32 != NULL) *nbytes_out_lo32 = 0; - if (nbytes_out_hi32 != NULL) *nbytes_out_hi32 = 0; - - if ((!abandon) && bzf->lastErr == BZ_OK) { - while (True) { - bzf->strm.avail_out = BZ_MAX_UNUSED; - bzf->strm.next_out = bzf->buf; - ret = BZ2_bzCompress ( &(bzf->strm), BZ_FINISH ); - if (ret != BZ_FINISH_OK && ret != BZ_STREAM_END) - { BZ_SETERR(ret); return; }; - - if (bzf->strm.avail_out < BZ_MAX_UNUSED) { - n = BZ_MAX_UNUSED - bzf->strm.avail_out; - n2 = fwrite ( (void*)(bzf->buf), sizeof(UChar), - n, bzf->handle ); - if (n != n2 || ferror(bzf->handle)) - { BZ_SETERR(BZ_IO_ERROR); return; }; - } - - if (ret == BZ_STREAM_END) break; - } - } - - if ( !abandon && !ferror ( bzf->handle ) ) { - fflush ( bzf->handle ); - if (ferror(bzf->handle)) - { BZ_SETERR(BZ_IO_ERROR); return; }; - } - - if (nbytes_in_lo32 != NULL) - *nbytes_in_lo32 = bzf->strm.total_in_lo32; - if (nbytes_in_hi32 != NULL) - *nbytes_in_hi32 = bzf->strm.total_in_hi32; - if (nbytes_out_lo32 != NULL) - *nbytes_out_lo32 = bzf->strm.total_out_lo32; - if (nbytes_out_hi32 != NULL) - *nbytes_out_hi32 = bzf->strm.total_out_hi32; - - BZ_SETERR(BZ_OK); - BZ2_bzCompressEnd ( &(bzf->strm) ); - free ( bzf ); -} - - -/*---------------------------------------------------*/ -BZFILE* BZ_API(BZ2_bzReadOpen) - ( int* bzerror, - FILE* f, - int verbosity, - int small, - void* unused, - int nUnused ) -{ - bzFile* bzf = NULL; - int ret; - - BZ_SETERR(BZ_OK); - - if (f == NULL || - (small != 0 && small != 1) || - (verbosity < 0 || verbosity > 4) || - (unused == NULL && nUnused != 0) || - (unused != NULL && (nUnused < 0 || nUnused > BZ_MAX_UNUSED))) - { BZ_SETERR(BZ_PARAM_ERROR); return NULL; }; - - if (ferror(f)) - { BZ_SETERR(BZ_IO_ERROR); return NULL; }; - - bzf = malloc ( sizeof(bzFile) ); - if (bzf == NULL) - { BZ_SETERR(BZ_MEM_ERROR); return NULL; }; - - BZ_SETERR(BZ_OK); - - bzf->initialisedOk = False; - bzf->handle = f; - bzf->bufN = 0; - bzf->writing = False; - bzf->strm.bzalloc = NULL; - bzf->strm.bzfree = NULL; - bzf->strm.opaque = NULL; - - while (nUnused > 0) { - bzf->buf[bzf->bufN] = *((UChar*)(unused)); bzf->bufN++; - unused = ((void*)( 1 + ((UChar*)(unused)) )); - nUnused--; - } - - ret = BZ2_bzDecompressInit ( &(bzf->strm), verbosity, small ); - if (ret != BZ_OK) - { BZ_SETERR(ret); free(bzf); return NULL; }; - - bzf->strm.avail_in = bzf->bufN; - bzf->strm.next_in = bzf->buf; - - bzf->initialisedOk = True; - return bzf; -} - - -/*---------------------------------------------------*/ -void BZ_API(BZ2_bzReadClose) ( int *bzerror, BZFILE *b ) -{ - bzFile* bzf = (bzFile*)b; - - BZ_SETERR(BZ_OK); - if (bzf == NULL) - { BZ_SETERR(BZ_OK); return; }; - - if (bzf->writing) - { BZ_SETERR(BZ_SEQUENCE_ERROR); return; }; - - if (bzf->initialisedOk) - (void)BZ2_bzDecompressEnd ( &(bzf->strm) ); - free ( bzf ); -} - - -/*---------------------------------------------------*/ -int BZ_API(BZ2_bzRead) - ( int* bzerror, - BZFILE* b, - void* buf, - int len ) -{ - Int32 n, ret; - bzFile* bzf = (bzFile*)b; - - BZ_SETERR(BZ_OK); - - if (bzf == NULL || buf == NULL || len < 0) - { BZ_SETERR(BZ_PARAM_ERROR); return 0; }; - - if (bzf->writing) - { BZ_SETERR(BZ_SEQUENCE_ERROR); return 0; }; - - if (len == 0) - { BZ_SETERR(BZ_OK); return 0; }; - - bzf->strm.avail_out = len; - bzf->strm.next_out = buf; - - while (True) { - - if (ferror(bzf->handle)) - { BZ_SETERR(BZ_IO_ERROR); return 0; }; - - if (bzf->strm.avail_in == 0 && !myfeof(bzf->handle)) { - n = fread ( bzf->buf, sizeof(UChar), - BZ_MAX_UNUSED, bzf->handle ); - if (ferror(bzf->handle)) - { BZ_SETERR(BZ_IO_ERROR); return 0; }; - bzf->bufN = n; - bzf->strm.avail_in = bzf->bufN; - bzf->strm.next_in = bzf->buf; - } - - ret = BZ2_bzDecompress ( &(bzf->strm) ); - - if (ret != BZ_OK && ret != BZ_STREAM_END) - { BZ_SETERR(ret); return 0; }; - - if (ret == BZ_OK && myfeof(bzf->handle) && - bzf->strm.avail_in == 0 && bzf->strm.avail_out > 0) - { BZ_SETERR(BZ_UNEXPECTED_EOF); return 0; }; - - if (ret == BZ_STREAM_END) - { BZ_SETERR(BZ_STREAM_END); - return len - bzf->strm.avail_out; }; - if (bzf->strm.avail_out == 0) - { BZ_SETERR(BZ_OK); return len; }; - - } - - return 0; /*not reached*/ -} - - -/*---------------------------------------------------*/ -void BZ_API(BZ2_bzReadGetUnused) - ( int* bzerror, - BZFILE* b, - void** unused, - int* nUnused ) -{ - bzFile* bzf = (bzFile*)b; - if (bzf == NULL) - { BZ_SETERR(BZ_PARAM_ERROR); return; }; - if (bzf->lastErr != BZ_STREAM_END) - { BZ_SETERR(BZ_SEQUENCE_ERROR); return; }; - if (unused == NULL || nUnused == NULL) - { BZ_SETERR(BZ_PARAM_ERROR); return; }; - - BZ_SETERR(BZ_OK); - *nUnused = bzf->strm.avail_in; - *unused = bzf->strm.next_in; -} -#endif - - -/*---------------------------------------------------*/ -/*--- Misc convenience stuff ---*/ -/*---------------------------------------------------*/ - -/*---------------------------------------------------*/ -int BZ_API(BZ2_bzBuffToBuffCompress) - ( char* dest, - unsigned int* destLen, - char* source, - unsigned int sourceLen, - int blockSize100k, - int verbosity, - int workFactor ) -{ - bz_stream strm; - int ret; - - if (dest == NULL || destLen == NULL || - source == NULL || - blockSize100k < 1 || blockSize100k > 9 || - verbosity < 0 || verbosity > 4 || - workFactor < 0 || workFactor > 250) - return BZ_PARAM_ERROR; - - if (workFactor == 0) workFactor = 30; - strm.bzalloc = NULL; - strm.bzfree = NULL; - strm.opaque = NULL; - ret = BZ2_bzCompressInit ( &strm, blockSize100k, - verbosity, workFactor ); - if (ret != BZ_OK) return ret; - - strm.next_in = source; - strm.next_out = dest; - strm.avail_in = sourceLen; - strm.avail_out = *destLen; - - ret = BZ2_bzCompress ( &strm, BZ_FINISH ); - if (ret == BZ_FINISH_OK) goto output_overflow; - if (ret != BZ_STREAM_END) goto errhandler; - - /* normal termination */ - *destLen -= strm.avail_out; - BZ2_bzCompressEnd ( &strm ); - return BZ_OK; - - output_overflow: - BZ2_bzCompressEnd ( &strm ); - return BZ_OUTBUFF_FULL; - - errhandler: - BZ2_bzCompressEnd ( &strm ); - return ret; -} - - -/*---------------------------------------------------*/ -int BZ_API(BZ2_bzBuffToBuffDecompress) - ( char* dest, - unsigned int* destLen, - char* source, - unsigned int sourceLen, - int small, - int verbosity ) -{ - bz_stream strm; - int ret; - - if (dest == NULL || destLen == NULL || - source == NULL || - (small != 0 && small != 1) || - verbosity < 0 || verbosity > 4) - return BZ_PARAM_ERROR; - - strm.bzalloc = NULL; - strm.bzfree = NULL; - strm.opaque = NULL; - ret = BZ2_bzDecompressInit ( &strm, verbosity, small ); - if (ret != BZ_OK) return ret; - - strm.next_in = source; - strm.next_out = dest; - strm.avail_in = sourceLen; - strm.avail_out = *destLen; - - ret = BZ2_bzDecompress ( &strm ); - if (ret == BZ_OK) goto output_overflow_or_eof; - if (ret != BZ_STREAM_END) goto errhandler; - - /* normal termination */ - *destLen -= strm.avail_out; - BZ2_bzDecompressEnd ( &strm ); - return BZ_OK; - - output_overflow_or_eof: - if (strm.avail_out > 0) { - BZ2_bzDecompressEnd ( &strm ); - return BZ_UNEXPECTED_EOF; - } else { - BZ2_bzDecompressEnd ( &strm ); - return BZ_OUTBUFF_FULL; - }; - - errhandler: - BZ2_bzDecompressEnd ( &strm ); - return ret; -} - - -/*---------------------------------------------------*/ -/*-- - Code contributed by Yoshioka Tsuneo - (QWF00133@niftyserve.or.jp/tsuneo-y@is.aist-nara.ac.jp), - to support better zlib compatibility. - This code is not _officially_ part of libbzip2 (yet); - I haven't tested it, documented it, or considered the - threading-safeness of it. - If this code breaks, please contact both Yoshioka and me. ---*/ -/*---------------------------------------------------*/ - -/*---------------------------------------------------*/ -/*-- - return version like "0.9.0c". ---*/ -const char * BZ_API(BZ2_bzlibVersion)(void) -{ - return BZ_VERSION; -} - - -#ifndef BZ_NO_STDIO -/*---------------------------------------------------*/ - -#if defined(_WIN32) || defined(OS2) || defined(MSDOS) -# include <fcntl.h> -# include <io.h> -# define SET_BINARY_MODE(file) setmode(fileno(file),O_BINARY) -#else -# define SET_BINARY_MODE(file) -#endif -static -BZFILE * bzopen_or_bzdopen - ( const char *path, /* no use when bzdopen */ - int fd, /* no use when bzdopen */ - const char *mode, - int open_mode) /* bzopen: 0, bzdopen:1 */ -{ - int bzerr; - char unused[BZ_MAX_UNUSED]; - int blockSize100k = 9; - int writing = 0; - char mode2[10] = ""; - FILE *fp = NULL; - BZFILE *bzfp = NULL; - int verbosity = 0; - int workFactor = 30; - int smallMode = 0; - int nUnused = 0; - - if (mode == NULL) return NULL; - while (*mode) { - switch (*mode) { - case 'r': - writing = 0; break; - case 'w': - writing = 1; break; - case 's': - smallMode = 1; break; - default: - if (isdigit((int)(*mode))) { - blockSize100k = *mode-'0'; - } - } - mode++; - } - strcat(mode2, writing ? "w" : "r" ); - strcat(mode2,"b"); /* binary mode */ - - if (open_mode==0) { - if (path==NULL || strcmp(path,"")==0) { - fp = (writing ? stdout : stdin); - SET_BINARY_MODE(fp); - } else { - fp = fopen(path,mode2); - } - } else { -#ifdef BZ_STRICT_ANSI - fp = NULL; -#else - fp = fdopen(fd,mode2); -#endif - } - if (fp == NULL) return NULL; - - if (writing) { - /* Guard against total chaos and anarchy -- JRS */ - if (blockSize100k < 1) blockSize100k = 1; - if (blockSize100k > 9) blockSize100k = 9; - bzfp = BZ2_bzWriteOpen(&bzerr,fp,blockSize100k, - verbosity,workFactor); - } else { - bzfp = BZ2_bzReadOpen(&bzerr,fp,verbosity,smallMode, - unused,nUnused); - } - if (bzfp == NULL) { - if (fp != stdin && fp != stdout) fclose(fp); - return NULL; - } - return bzfp; -} - - -/*---------------------------------------------------*/ -/*-- - open file for read or write. - ex) bzopen("file","w9") - case path="" or NULL => use stdin or stdout. ---*/ -BZFILE * BZ_API(BZ2_bzopen) - ( const char *path, - const char *mode ) -{ - return bzopen_or_bzdopen(path,-1,mode,/*bzopen*/0); -} - - -/*---------------------------------------------------*/ -BZFILE * BZ_API(BZ2_bzdopen) - ( int fd, - const char *mode ) -{ - return bzopen_or_bzdopen(NULL,fd,mode,/*bzdopen*/1); -} - - -/*---------------------------------------------------*/ -int BZ_API(BZ2_bzread) (BZFILE* b, void* buf, int len ) -{ - int bzerr, nread; - if (((bzFile*)b)->lastErr == BZ_STREAM_END) return 0; - nread = BZ2_bzRead(&bzerr,b,buf,len); - if (bzerr == BZ_OK || bzerr == BZ_STREAM_END) { - return nread; - } else { - return -1; - } -} - - -/*---------------------------------------------------*/ -int BZ_API(BZ2_bzwrite) (BZFILE* b, void* buf, int len ) -{ - int bzerr; - - BZ2_bzWrite(&bzerr,b,buf,len); - if(bzerr == BZ_OK){ - return len; - }else{ - return -1; - } -} - - -/*---------------------------------------------------*/ -int BZ_API(BZ2_bzflush) (BZFILE *b) -{ - /* do nothing now... */ - return 0; -} - - -/*---------------------------------------------------*/ -void BZ_API(BZ2_bzclose) (BZFILE* b) -{ - int bzerr; - FILE *fp = ((bzFile *)b)->handle; - - if (b==NULL) {return;} - if(((bzFile*)b)->writing){ - BZ2_bzWriteClose(&bzerr,b,0,NULL,NULL); - if(bzerr != BZ_OK){ - BZ2_bzWriteClose(NULL,b,1,NULL,NULL); - } - }else{ - BZ2_bzReadClose(&bzerr,b); - } - if(fp!=stdin && fp!=stdout){ - fclose(fp); - } -} - - -/*---------------------------------------------------*/ -/*-- - return last error code ---*/ -static char *bzerrorstrings[] = { - "OK" - ,"SEQUENCE_ERROR" - ,"PARAM_ERROR" - ,"MEM_ERROR" - ,"DATA_ERROR" - ,"DATA_ERROR_MAGIC" - ,"IO_ERROR" - ,"UNEXPECTED_EOF" - ,"OUTBUFF_FULL" - ,"CONFIG_ERROR" - ,"???" /* for future */ - ,"???" /* for future */ - ,"???" /* for future */ - ,"???" /* for future */ - ,"???" /* for future */ - ,"???" /* for future */ -}; - - -const char * BZ_API(BZ2_bzerror) (BZFILE *b, int *errnum) -{ - int err = ((bzFile *)b)->lastErr; - - if(err>0) err = 0; - *errnum = err; - return bzerrorstrings[err*-1]; -} -#endif - - -/*-------------------------------------------------------------*/ -/*--- end bzlib.c ---*/ -/*-------------------------------------------------------------*/ diff --git a/mdk-stage1/bzlib/bzlib.h b/mdk-stage1/bzlib/bzlib.h deleted file mode 100644 index c9447a295..000000000 --- a/mdk-stage1/bzlib/bzlib.h +++ /dev/null @@ -1,319 +0,0 @@ - -/*-------------------------------------------------------------*/ -/*--- Public header file for the library. ---*/ -/*--- bzlib.h ---*/ -/*-------------------------------------------------------------*/ - -/*-- - This file is a part of bzip2 and/or libbzip2, a program and - library for lossless, block-sorting data compression. - - Copyright (C) 1996-2000 Julian R Seward. All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 2. The origin of this software must not be misrepresented; you must - not claim that you wrote the original software. If you use this - software in a product, an acknowledgment in the product - documentation would be appreciated but is not required. - - 3. Altered source versions must be plainly marked as such, and must - not be misrepresented as being the original software. - - 4. The name of the author may not be used to endorse or promote - products derived from this software without specific prior written - permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - Julian Seward, Cambridge, UK. - jseward@acm.org - bzip2/libbzip2 version 1.0 of 21 March 2000 - - This program is based on (at least) the work of: - Mike Burrows - David Wheeler - Peter Fenwick - Alistair Moffat - Radford Neal - Ian H. Witten - Robert Sedgewick - Jon L. Bentley - - For more information on these sources, see the manual. ---*/ - - -#ifndef _BZLIB_H -#define _BZLIB_H - -#ifdef __cplusplus -extern "C" { -#endif - -#define BZ_RUN 0 -#define BZ_FLUSH 1 -#define BZ_FINISH 2 - -#define BZ_OK 0 -#define BZ_RUN_OK 1 -#define BZ_FLUSH_OK 2 -#define BZ_FINISH_OK 3 -#define BZ_STREAM_END 4 -#define BZ_SEQUENCE_ERROR (-1) -#define BZ_PARAM_ERROR (-2) -#define BZ_MEM_ERROR (-3) -#define BZ_DATA_ERROR (-4) -#define BZ_DATA_ERROR_MAGIC (-5) -#define BZ_IO_ERROR (-6) -#define BZ_UNEXPECTED_EOF (-7) -#define BZ_OUTBUFF_FULL (-8) -#define BZ_CONFIG_ERROR (-9) - -typedef - struct { - char *next_in; - unsigned int avail_in; - unsigned int total_in_lo32; - unsigned int total_in_hi32; - - char *next_out; - unsigned int avail_out; - unsigned int total_out_lo32; - unsigned int total_out_hi32; - - void *state; - - void *(*bzalloc)(void *,int,int); - void (*bzfree)(void *,void *); - void *opaque; - } - bz_stream; - - -#ifndef BZ_IMPORT -#define BZ_EXPORT -#endif - -#ifdef _WIN32 -# include <stdio.h> -# include <windows.h> -# ifdef small - /* windows.h define small to char */ -# undef small -# endif -# ifdef BZ_EXPORT -# define BZ_API(func) WINAPI func -# define BZ_EXTERN extern -# else - /* import windows dll dynamically */ -# define BZ_API(func) (WINAPI * func) -# define BZ_EXTERN -# endif -#else -# define BZ_API(func) func -# define BZ_EXTERN extern -#endif - - -/*-- Core (low-level) library functions --*/ - -BZ_EXTERN int BZ_API(BZ2_bzCompressInit) ( - bz_stream* strm, - int blockSize100k, - int verbosity, - int workFactor - ); - -BZ_EXTERN int BZ_API(BZ2_bzCompress) ( - bz_stream* strm, - int action - ); - -BZ_EXTERN int BZ_API(BZ2_bzCompressEnd) ( - bz_stream* strm - ); - -BZ_EXTERN int BZ_API(BZ2_bzDecompressInit) ( - bz_stream *strm, - int verbosity, - int small - ); - -BZ_EXTERN int BZ_API(BZ2_bzDecompress) ( - bz_stream* strm - ); - -BZ_EXTERN int BZ_API(BZ2_bzDecompressEnd) ( - bz_stream *strm - ); - - - -/*-- High(er) level library functions --*/ - -#ifndef BZ_NO_STDIO -#define BZ_MAX_UNUSED 5000 - -typedef void BZFILE; - -BZ_EXTERN BZFILE* BZ_API(BZ2_bzReadOpen) ( - int* bzerror, - FILE* f, - int verbosity, - int small, - void* unused, - int nUnused - ); - -BZ_EXTERN void BZ_API(BZ2_bzReadClose) ( - int* bzerror, - BZFILE* b - ); - -BZ_EXTERN void BZ_API(BZ2_bzReadGetUnused) ( - int* bzerror, - BZFILE* b, - void** unused, - int* nUnused - ); - -BZ_EXTERN int BZ_API(BZ2_bzRead) ( - int* bzerror, - BZFILE* b, - void* buf, - int len - ); - -BZ_EXTERN BZFILE* BZ_API(BZ2_bzWriteOpen) ( - int* bzerror, - FILE* f, - int blockSize100k, - int verbosity, - int workFactor - ); - -BZ_EXTERN void BZ_API(BZ2_bzWrite) ( - int* bzerror, - BZFILE* b, - void* buf, - int len - ); - -BZ_EXTERN void BZ_API(BZ2_bzWriteClose) ( - int* bzerror, - BZFILE* b, - int abandon, - unsigned int* nbytes_in, - unsigned int* nbytes_out - ); - -BZ_EXTERN void BZ_API(BZ2_bzWriteClose64) ( - int* bzerror, - BZFILE* b, - int abandon, - unsigned int* nbytes_in_lo32, - unsigned int* nbytes_in_hi32, - unsigned int* nbytes_out_lo32, - unsigned int* nbytes_out_hi32 - ); -#endif - - -/*-- Utility functions --*/ - -BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffCompress) ( - char* dest, - unsigned int* destLen, - char* source, - unsigned int sourceLen, - int blockSize100k, - int verbosity, - int workFactor - ); - -BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffDecompress) ( - char* dest, - unsigned int* destLen, - char* source, - unsigned int sourceLen, - int small, - int verbosity - ); - - -/*-- - Code contributed by Yoshioka Tsuneo - (QWF00133@niftyserve.or.jp/tsuneo-y@is.aist-nara.ac.jp), - to support better zlib compatibility. - This code is not _officially_ part of libbzip2 (yet); - I haven't tested it, documented it, or considered the - threading-safeness of it. - If this code breaks, please contact both Yoshioka and me. ---*/ - -BZ_EXTERN const char * BZ_API(BZ2_bzlibVersion) ( - void - ); - -#ifndef BZ_NO_STDIO -BZ_EXTERN BZFILE * BZ_API(BZ2_bzopen) ( - const char *path, - const char *mode - ); - -BZ_EXTERN BZFILE * BZ_API(BZ2_bzdopen) ( - int fd, - const char *mode - ); - -BZ_EXTERN int BZ_API(BZ2_bzread) ( - BZFILE* b, - void* buf, - int len - ); - -BZ_EXTERN int BZ_API(BZ2_bzwrite) ( - BZFILE* b, - void* buf, - int len - ); - -BZ_EXTERN int BZ_API(BZ2_bzflush) ( - BZFILE* b - ); - -BZ_EXTERN void BZ_API(BZ2_bzclose) ( - BZFILE* b - ); - -BZ_EXTERN const char * BZ_API(BZ2_bzerror) ( - BZFILE *b, - int *errnum - ); -#endif - -#ifdef __cplusplus -} -#endif - -#endif - -/*-------------------------------------------------------------*/ -/*--- end bzlib.h ---*/ -/*-------------------------------------------------------------*/ diff --git a/mdk-stage1/bzlib/bzlib_private.h b/mdk-stage1/bzlib/bzlib_private.h deleted file mode 100644 index fb51c7a1d..000000000 --- a/mdk-stage1/bzlib/bzlib_private.h +++ /dev/null @@ -1,530 +0,0 @@ - -/*-------------------------------------------------------------*/ -/*--- Private header file for the library. ---*/ -/*--- bzlib_private.h ---*/ -/*-------------------------------------------------------------*/ - -/*-- - This file is a part of bzip2 and/or libbzip2, a program and - library for lossless, block-sorting data compression. - - Copyright (C) 1996-2000 Julian R Seward. All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 2. The origin of this software must not be misrepresented; you must - not claim that you wrote the original software. If you use this - software in a product, an acknowledgment in the product - documentation would be appreciated but is not required. - - 3. Altered source versions must be plainly marked as such, and must - not be misrepresented as being the original software. - - 4. The name of the author may not be used to endorse or promote - products derived from this software without specific prior written - permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - Julian Seward, Cambridge, UK. - jseward@acm.org - bzip2/libbzip2 version 1.0 of 21 March 2000 - - This program is based on (at least) the work of: - Mike Burrows - David Wheeler - Peter Fenwick - Alistair Moffat - Radford Neal - Ian H. Witten - Robert Sedgewick - Jon L. Bentley - - For more information on these sources, see the manual. ---*/ - - -#ifndef _BZLIB_PRIVATE_H -#define _BZLIB_PRIVATE_H - -#include <stdlib.h> - -#ifndef BZ_NO_STDIO -#include <stdio.h> -#include <ctype.h> -#include <string.h> -#endif - -#include "bzlib.h" - - - -/*-- General stuff. --*/ - -#define BZ_VERSION "1.0.1, 23-June-2000" - -typedef char Char; -typedef unsigned char Bool; -typedef unsigned char UChar; -typedef int Int32; -typedef unsigned int UInt32; -typedef short Int16; -typedef unsigned short UInt16; - -#define True ((Bool)1) -#define False ((Bool)0) - -#ifndef __GNUC__ -#define __inline__ /* */ -#endif - -#ifndef BZ_NO_STDIO -extern void BZ2_bz__AssertH__fail ( int errcode ); -#define AssertH(cond,errcode) \ - { if (!(cond)) BZ2_bz__AssertH__fail ( errcode ); } -#if BZ_DEBUG -#define AssertD(cond,msg) \ - { if (!(cond)) { \ - fprintf ( stderr, \ - "\n\nlibbzip2(debug build): internal error\n\t%s\n", msg );\ - exit(1); \ - }} -#else -#define AssertD(cond,msg) /* */ -#endif -#define VPrintf0(zf) \ - fprintf(stderr,zf) -#define VPrintf1(zf,za1) \ - fprintf(stderr,zf,za1) -#define VPrintf2(zf,za1,za2) \ - fprintf(stderr,zf,za1,za2) -#define VPrintf3(zf,za1,za2,za3) \ - fprintf(stderr,zf,za1,za2,za3) -#define VPrintf4(zf,za1,za2,za3,za4) \ - fprintf(stderr,zf,za1,za2,za3,za4) -#define VPrintf5(zf,za1,za2,za3,za4,za5) \ - fprintf(stderr,zf,za1,za2,za3,za4,za5) -#else -extern void bz_internal_error ( int errcode ); -#define AssertH(cond,errcode) \ - { if (!(cond)) bz_internal_error ( errcode ); } -#define AssertD(cond,msg) /* */ -#define VPrintf0(zf) /* */ -#define VPrintf1(zf,za1) /* */ -#define VPrintf2(zf,za1,za2) /* */ -#define VPrintf3(zf,za1,za2,za3) /* */ -#define VPrintf4(zf,za1,za2,za3,za4) /* */ -#define VPrintf5(zf,za1,za2,za3,za4,za5) /* */ -#endif - - -#define BZALLOC(nnn) (strm->bzalloc)(strm->opaque,(nnn),1) -#define BZFREE(ppp) (strm->bzfree)(strm->opaque,(ppp)) - - -/*-- Constants for the back end. --*/ - -#define BZ_MAX_ALPHA_SIZE 258 -#define BZ_MAX_CODE_LEN 23 - -#define BZ_RUNA 0 -#define BZ_RUNB 1 - -#define BZ_N_GROUPS 6 -#define BZ_G_SIZE 50 -#define BZ_N_ITERS 4 - -#define BZ_MAX_SELECTORS (2 + (900000 / BZ_G_SIZE)) - - - -/*-- Stuff for randomising repetitive blocks. --*/ - -extern Int32 BZ2_rNums[512]; - -#define BZ_RAND_DECLS \ - Int32 rNToGo; \ - Int32 rTPos \ - -#define BZ_RAND_INIT_MASK \ - s->rNToGo = 0; \ - s->rTPos = 0 \ - -#define BZ_RAND_MASK ((s->rNToGo == 1) ? 1 : 0) - -#define BZ_RAND_UPD_MASK \ - if (s->rNToGo == 0) { \ - s->rNToGo = BZ2_rNums[s->rTPos]; \ - s->rTPos++; \ - if (s->rTPos == 512) s->rTPos = 0; \ - } \ - s->rNToGo--; - - - -/*-- Stuff for doing CRCs. --*/ - -extern UInt32 BZ2_crc32Table[256]; - -#define BZ_INITIALISE_CRC(crcVar) \ -{ \ - crcVar = 0xffffffffL; \ -} - -#define BZ_FINALISE_CRC(crcVar) \ -{ \ - crcVar = ~(crcVar); \ -} - -#define BZ_UPDATE_CRC(crcVar,cha) \ -{ \ - crcVar = (crcVar << 8) ^ \ - BZ2_crc32Table[(crcVar >> 24) ^ \ - ((UChar)cha)]; \ -} - - - -/*-- States and modes for compression. --*/ - -#define BZ_M_IDLE 1 -#define BZ_M_RUNNING 2 -#define BZ_M_FLUSHING 3 -#define BZ_M_FINISHING 4 - -#define BZ_S_OUTPUT 1 -#define BZ_S_INPUT 2 - -#define BZ_N_RADIX 2 -#define BZ_N_QSORT 12 -#define BZ_N_SHELL 18 -#define BZ_N_OVERSHOOT (BZ_N_RADIX + BZ_N_QSORT + BZ_N_SHELL + 2) - - - - -/*-- Structure holding all the compression-side stuff. --*/ - -typedef - struct { - /* pointer back to the struct bz_stream */ - bz_stream* strm; - - /* mode this stream is in, and whether inputting */ - /* or outputting data */ - Int32 mode; - Int32 state; - - /* remembers avail_in when flush/finish requested */ - UInt32 avail_in_expect; - - /* for doing the block sorting */ - UInt32* arr1; - UInt32* arr2; - UInt32* ftab; - Int32 origPtr; - - /* aliases for arr1 and arr2 */ - UInt32* ptr; - UChar* block; - UInt16* mtfv; - UChar* zbits; - - /* for deciding when to use the fallback sorting algorithm */ - Int32 workFactor; - - /* run-length-encoding of the input */ - UInt32 state_in_ch; - Int32 state_in_len; - BZ_RAND_DECLS; - - /* input and output limits and current posns */ - Int32 nblock; - Int32 nblockMAX; - Int32 numZ; - Int32 state_out_pos; - - /* map of bytes used in block */ - Int32 nInUse; - Bool inUse[256]; - UChar unseqToSeq[256]; - - /* the buffer for bit stream creation */ - UInt32 bsBuff; - Int32 bsLive; - - /* block and combined CRCs */ - UInt32 blockCRC; - UInt32 combinedCRC; - - /* misc administratium */ - Int32 verbosity; - Int32 blockNo; - Int32 blockSize100k; - - /* stuff for coding the MTF values */ - Int32 nMTF; - Int32 mtfFreq [BZ_MAX_ALPHA_SIZE]; - UChar selector [BZ_MAX_SELECTORS]; - UChar selectorMtf[BZ_MAX_SELECTORS]; - - UChar len [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; - Int32 code [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; - Int32 rfreq [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; - /* second dimension: only 3 needed; 4 makes index calculations faster */ - UInt32 len_pack[BZ_MAX_ALPHA_SIZE][4]; - - } - EState; - - - -/*-- externs for compression. --*/ - -extern void -BZ2_blockSort ( EState* ); - -extern void -BZ2_compressBlock ( EState*, Bool ); - -extern void -BZ2_bsInitWrite ( EState* ); - -extern void -BZ2_hbAssignCodes ( Int32*, UChar*, Int32, Int32, Int32 ); - -extern void -BZ2_hbMakeCodeLengths ( UChar*, Int32*, Int32, Int32 ); - - - -/*-- states for decompression. --*/ - -#define BZ_X_IDLE 1 -#define BZ_X_OUTPUT 2 - -#define BZ_X_MAGIC_1 10 -#define BZ_X_MAGIC_2 11 -#define BZ_X_MAGIC_3 12 -#define BZ_X_MAGIC_4 13 -#define BZ_X_BLKHDR_1 14 -#define BZ_X_BLKHDR_2 15 -#define BZ_X_BLKHDR_3 16 -#define BZ_X_BLKHDR_4 17 -#define BZ_X_BLKHDR_5 18 -#define BZ_X_BLKHDR_6 19 -#define BZ_X_BCRC_1 20 -#define BZ_X_BCRC_2 21 -#define BZ_X_BCRC_3 22 -#define BZ_X_BCRC_4 23 -#define BZ_X_RANDBIT 24 -#define BZ_X_ORIGPTR_1 25 -#define BZ_X_ORIGPTR_2 26 -#define BZ_X_ORIGPTR_3 27 -#define BZ_X_MAPPING_1 28 -#define BZ_X_MAPPING_2 29 -#define BZ_X_SELECTOR_1 30 -#define BZ_X_SELECTOR_2 31 -#define BZ_X_SELECTOR_3 32 -#define BZ_X_CODING_1 33 -#define BZ_X_CODING_2 34 -#define BZ_X_CODING_3 35 -#define BZ_X_MTF_1 36 -#define BZ_X_MTF_2 37 -#define BZ_X_MTF_3 38 -#define BZ_X_MTF_4 39 -#define BZ_X_MTF_5 40 -#define BZ_X_MTF_6 41 -#define BZ_X_ENDHDR_2 42 -#define BZ_X_ENDHDR_3 43 -#define BZ_X_ENDHDR_4 44 -#define BZ_X_ENDHDR_5 45 -#define BZ_X_ENDHDR_6 46 -#define BZ_X_CCRC_1 47 -#define BZ_X_CCRC_2 48 -#define BZ_X_CCRC_3 49 -#define BZ_X_CCRC_4 50 - - - -/*-- Constants for the fast MTF decoder. --*/ - -#define MTFA_SIZE 4096 -#define MTFL_SIZE 16 - - - -/*-- Structure holding all the decompression-side stuff. --*/ - -typedef - struct { - /* pointer back to the struct bz_stream */ - bz_stream* strm; - - /* state indicator for this stream */ - Int32 state; - - /* for doing the final run-length decoding */ - UChar state_out_ch; - Int32 state_out_len; - Bool blockRandomised; - BZ_RAND_DECLS; - - /* the buffer for bit stream reading */ - UInt32 bsBuff; - Int32 bsLive; - - /* misc administratium */ - Int32 blockSize100k; - Bool smallDecompress; - Int32 currBlockNo; - Int32 verbosity; - - /* for undoing the Burrows-Wheeler transform */ - Int32 origPtr; - UInt32 tPos; - Int32 k0; - Int32 unzftab[256]; - Int32 nblock_used; - Int32 cftab[257]; - Int32 cftabCopy[257]; - - /* for undoing the Burrows-Wheeler transform (FAST) */ - UInt32 *tt; - - /* for undoing the Burrows-Wheeler transform (SMALL) */ - UInt16 *ll16; - UChar *ll4; - - /* stored and calculated CRCs */ - UInt32 storedBlockCRC; - UInt32 storedCombinedCRC; - UInt32 calculatedBlockCRC; - UInt32 calculatedCombinedCRC; - - /* map of bytes used in block */ - Int32 nInUse; - Bool inUse[256]; - Bool inUse16[16]; - UChar seqToUnseq[256]; - - /* for decoding the MTF values */ - UChar mtfa [MTFA_SIZE]; - Int32 mtfbase[256 / MTFL_SIZE]; - UChar selector [BZ_MAX_SELECTORS]; - UChar selectorMtf[BZ_MAX_SELECTORS]; - UChar len [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; - - Int32 limit [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; - Int32 base [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; - Int32 perm [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; - Int32 minLens[BZ_N_GROUPS]; - - /* save area for scalars in the main decompress code */ - Int32 save_i; - Int32 save_j; - Int32 save_t; - Int32 save_alphaSize; - Int32 save_nGroups; - Int32 save_nSelectors; - Int32 save_EOB; - Int32 save_groupNo; - Int32 save_groupPos; - Int32 save_nextSym; - Int32 save_nblockMAX; - Int32 save_nblock; - Int32 save_es; - Int32 save_N; - Int32 save_curr; - Int32 save_zt; - Int32 save_zn; - Int32 save_zvec; - Int32 save_zj; - Int32 save_gSel; - Int32 save_gMinlen; - Int32* save_gLimit; - Int32* save_gBase; - Int32* save_gPerm; - - } - DState; - - - -/*-- Macros for decompression. --*/ - -#define BZ_GET_FAST(cccc) \ - s->tPos = s->tt[s->tPos]; \ - cccc = (UChar)(s->tPos & 0xff); \ - s->tPos >>= 8; - -#define BZ_GET_FAST_C(cccc) \ - c_tPos = c_tt[c_tPos]; \ - cccc = (UChar)(c_tPos & 0xff); \ - c_tPos >>= 8; - -#define SET_LL4(i,n) \ - { if (((i) & 0x1) == 0) \ - s->ll4[(i) >> 1] = (s->ll4[(i) >> 1] & 0xf0) | (n); else \ - s->ll4[(i) >> 1] = (s->ll4[(i) >> 1] & 0x0f) | ((n) << 4); \ - } - -#define GET_LL4(i) \ - ((((UInt32)(s->ll4[(i) >> 1])) >> (((i) << 2) & 0x4)) & 0xF) - -#define SET_LL(i,n) \ - { s->ll16[i] = (UInt16)(n & 0x0000ffff); \ - SET_LL4(i, n >> 16); \ - } - -#define GET_LL(i) \ - (((UInt32)s->ll16[i]) | (GET_LL4(i) << 16)) - -#define BZ_GET_SMALL(cccc) \ - cccc = BZ2_indexIntoF ( s->tPos, s->cftab ); \ - s->tPos = GET_LL(s->tPos); - - -/*-- externs for decompression. --*/ - -extern Int32 -BZ2_indexIntoF ( Int32, Int32* ); - -extern Int32 -BZ2_decompress ( DState* ); - -extern void -BZ2_hbCreateDecodeTables ( Int32*, Int32*, Int32*, UChar*, - Int32, Int32, Int32 ); - - -#endif - - -/*-- BZ_NO_STDIO seems to make NULL disappear on some platforms. --*/ - -#ifdef BZ_NO_STDIO -#ifndef NULL -#define NULL 0 -#endif -#endif - - -/*-------------------------------------------------------------*/ -/*--- end bzlib_private.h ---*/ -/*-------------------------------------------------------------*/ diff --git a/mdk-stage1/bzlib/compress.c b/mdk-stage1/bzlib/compress.c deleted file mode 100644 index 58d5abe7c..000000000 --- a/mdk-stage1/bzlib/compress.c +++ /dev/null @@ -1,720 +0,0 @@ - -/*-------------------------------------------------------------*/ -/*--- Compression machinery (not incl block sorting) ---*/ -/*--- compress.c ---*/ -/*-------------------------------------------------------------*/ - -/*-- - This file is a part of bzip2 and/or libbzip2, a program and - library for lossless, block-sorting data compression. - - Copyright (C) 1996-2000 Julian R Seward. All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 2. The origin of this software must not be misrepresented; you must - not claim that you wrote the original software. If you use this - software in a product, an acknowledgment in the product - documentation would be appreciated but is not required. - - 3. Altered source versions must be plainly marked as such, and must - not be misrepresented as being the original software. - - 4. The name of the author may not be used to endorse or promote - products derived from this software without specific prior written - permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - Julian Seward, Cambridge, UK. - jseward@acm.org - bzip2/libbzip2 version 1.0 of 21 March 2000 - - This program is based on (at least) the work of: - Mike Burrows - David Wheeler - Peter Fenwick - Alistair Moffat - Radford Neal - Ian H. Witten - Robert Sedgewick - Jon L. Bentley - - For more information on these sources, see the manual. ---*/ - -/*-- - CHANGES - ~~~~~~~ - 0.9.0 -- original version. - - 0.9.0a/b -- no changes in this file. - - 0.9.0c - * changed setting of nGroups in sendMTFValues() so as to - do a bit better on small files ---*/ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - - - -#include "bzlib_private.h" - - -/*---------------------------------------------------*/ -/*--- Bit stream I/O ---*/ -/*---------------------------------------------------*/ - -/*---------------------------------------------------*/ -void BZ2_bsInitWrite ( EState* s ) -{ - s->bsLive = 0; - s->bsBuff = 0; -} - - -/*---------------------------------------------------*/ -static -void bsFinishWrite ( EState* s ) -{ - while (s->bsLive > 0) { - s->zbits[s->numZ] = (UChar)(s->bsBuff >> 24); - s->numZ++; - s->bsBuff <<= 8; - s->bsLive -= 8; - } -} - - -/*---------------------------------------------------*/ -#define bsNEEDW(nz) \ -{ \ - while (s->bsLive >= 8) { \ - s->zbits[s->numZ] \ - = (UChar)(s->bsBuff >> 24); \ - s->numZ++; \ - s->bsBuff <<= 8; \ - s->bsLive -= 8; \ - } \ -} - - -/*---------------------------------------------------*/ -static -__inline__ -void bsW ( EState* s, Int32 n, UInt32 v ) -{ - bsNEEDW ( n ); - s->bsBuff |= (v << (32 - s->bsLive - n)); - s->bsLive += n; -} - - -/*---------------------------------------------------*/ -static -void bsPutUInt32 ( EState* s, UInt32 u ) -{ - bsW ( s, 8, (u >> 24) & 0xffL ); - bsW ( s, 8, (u >> 16) & 0xffL ); - bsW ( s, 8, (u >> 8) & 0xffL ); - bsW ( s, 8, u & 0xffL ); -} - - -/*---------------------------------------------------*/ -static -void bsPutUChar ( EState* s, UChar c ) -{ - bsW( s, 8, (UInt32)c ); -} - - -/*---------------------------------------------------*/ -/*--- The back end proper ---*/ -/*---------------------------------------------------*/ - -/*---------------------------------------------------*/ -static -void makeMaps_e ( EState* s ) -{ - Int32 i; - s->nInUse = 0; - for (i = 0; i < 256; i++) - if (s->inUse[i]) { - s->unseqToSeq[i] = s->nInUse; - s->nInUse++; - } -} - - -/*---------------------------------------------------*/ -static -void generateMTFValues ( EState* s ) -{ - UChar yy[256]; - Int32 i, j; - Int32 zPend; - Int32 wr; - Int32 EOB; - - /* - After sorting (eg, here), - s->arr1 [ 0 .. s->nblock-1 ] holds sorted order, - and - ((UChar*)s->arr2) [ 0 .. s->nblock-1 ] - holds the original block data. - - The first thing to do is generate the MTF values, - and put them in - ((UInt16*)s->arr1) [ 0 .. s->nblock-1 ]. - Because there are strictly fewer or equal MTF values - than block values, ptr values in this area are overwritten - with MTF values only when they are no longer needed. - - The final compressed bitstream is generated into the - area starting at - (UChar*) (&((UChar*)s->arr2)[s->nblock]) - - These storage aliases are set up in bzCompressInit(), - except for the last one, which is arranged in - compressBlock(). - */ - UInt32* ptr = s->ptr; - UChar* block = s->block; - UInt16* mtfv = s->mtfv; - - makeMaps_e ( s ); - EOB = s->nInUse+1; - - for (i = 0; i <= EOB; i++) s->mtfFreq[i] = 0; - - wr = 0; - zPend = 0; - for (i = 0; i < s->nInUse; i++) yy[i] = (UChar) i; - - for (i = 0; i < s->nblock; i++) { - UChar ll_i; - AssertD ( wr <= i, "generateMTFValues(1)" ); - j = ptr[i]-1; if (j < 0) j += s->nblock; - ll_i = s->unseqToSeq[block[j]]; - AssertD ( ll_i < s->nInUse, "generateMTFValues(2a)" ); - - if (yy[0] == ll_i) { - zPend++; - } else { - - if (zPend > 0) { - zPend--; - while (True) { - if (zPend & 1) { - mtfv[wr] = BZ_RUNB; wr++; - s->mtfFreq[BZ_RUNB]++; - } else { - mtfv[wr] = BZ_RUNA; wr++; - s->mtfFreq[BZ_RUNA]++; - } - if (zPend < 2) break; - zPend = (zPend - 2) / 2; - }; - zPend = 0; - } - { - register UChar rtmp; - register UChar* ryy_j; - register UChar rll_i; - rtmp = yy[1]; - yy[1] = yy[0]; - ryy_j = &(yy[1]); - rll_i = ll_i; - while ( rll_i != rtmp ) { - register UChar rtmp2; - ryy_j++; - rtmp2 = rtmp; - rtmp = *ryy_j; - *ryy_j = rtmp2; - }; - yy[0] = rtmp; - j = ryy_j - &(yy[0]); - mtfv[wr] = j+1; wr++; s->mtfFreq[j+1]++; - } - - } - } - - if (zPend > 0) { - zPend--; - while (True) { - if (zPend & 1) { - mtfv[wr] = BZ_RUNB; wr++; - s->mtfFreq[BZ_RUNB]++; - } else { - mtfv[wr] = BZ_RUNA; wr++; - s->mtfFreq[BZ_RUNA]++; - } - if (zPend < 2) break; - zPend = (zPend - 2) / 2; - }; - zPend = 0; - } - - mtfv[wr] = EOB; wr++; s->mtfFreq[EOB]++; - - s->nMTF = wr; -} - - -/*---------------------------------------------------*/ -#define BZ_LESSER_ICOST 0 -#define BZ_GREATER_ICOST 15 - -static -void sendMTFValues ( EState* s ) -{ - Int32 v, t, i, j, gs, ge, totc, bt, bc, iter; - Int32 nSelectors, alphaSize, minLen, maxLen, selCtr; - Int32 nGroups, nBytes; - - /*-- - UChar len [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; - is a global since the decoder also needs it. - - Int32 code[BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; - Int32 rfreq[BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; - are also globals only used in this proc. - Made global to keep stack frame size small. - --*/ - - - UInt16 cost[BZ_N_GROUPS]; - Int32 fave[BZ_N_GROUPS]; - - UInt16* mtfv = s->mtfv; - - if (s->verbosity >= 3) - VPrintf3( " %d in block, %d after MTF & 1-2 coding, " - "%d+2 syms in use\n", - s->nblock, s->nMTF, s->nInUse ); - - alphaSize = s->nInUse+2; - for (t = 0; t < BZ_N_GROUPS; t++) - for (v = 0; v < alphaSize; v++) - s->len[t][v] = BZ_GREATER_ICOST; - - /*--- Decide how many coding tables to use ---*/ - AssertH ( s->nMTF > 0, 3001 ); - if (s->nMTF < 200) nGroups = 2; else - if (s->nMTF < 600) nGroups = 3; else - if (s->nMTF < 1200) nGroups = 4; else - if (s->nMTF < 2400) nGroups = 5; else - nGroups = 6; - - /*--- Generate an initial set of coding tables ---*/ - { - Int32 nPart, remF, tFreq, aFreq; - - nPart = nGroups; - remF = s->nMTF; - gs = 0; - while (nPart > 0) { - tFreq = remF / nPart; - ge = gs-1; - aFreq = 0; - while (aFreq < tFreq && ge < alphaSize-1) { - ge++; - aFreq += s->mtfFreq[ge]; - } - - if (ge > gs - && nPart != nGroups && nPart != 1 - && ((nGroups-nPart) % 2 == 1)) { - aFreq -= s->mtfFreq[ge]; - ge--; - } - - if (s->verbosity >= 3) - VPrintf5( " initial group %d, [%d .. %d], " - "has %d syms (%4.1f%%)\n", - nPart, gs, ge, aFreq, - (100.0 * (float)aFreq) / (float)(s->nMTF) ); - - for (v = 0; v < alphaSize; v++) - if (v >= gs && v <= ge) - s->len[nPart-1][v] = BZ_LESSER_ICOST; else - s->len[nPart-1][v] = BZ_GREATER_ICOST; - - nPart--; - gs = ge+1; - remF -= aFreq; - } - } - - /*--- - Iterate up to BZ_N_ITERS times to improve the tables. - ---*/ - for (iter = 0; iter < BZ_N_ITERS; iter++) { - - for (t = 0; t < nGroups; t++) fave[t] = 0; - - for (t = 0; t < nGroups; t++) - for (v = 0; v < alphaSize; v++) - s->rfreq[t][v] = 0; - - /*--- - Set up an auxiliary length table which is used to fast-track - the common case (nGroups == 6). - ---*/ - if (nGroups == 6) { - for (v = 0; v < alphaSize; v++) { - s->len_pack[v][0] = (s->len[1][v] << 16) | s->len[0][v]; - s->len_pack[v][1] = (s->len[3][v] << 16) | s->len[2][v]; - s->len_pack[v][2] = (s->len[5][v] << 16) | s->len[4][v]; - } - } - - nSelectors = 0; - totc = 0; - gs = 0; - while (True) { - - /*--- Set group start & end marks. --*/ - if (gs >= s->nMTF) break; - ge = gs + BZ_G_SIZE - 1; - if (ge >= s->nMTF) ge = s->nMTF-1; - - /*-- - Calculate the cost of this group as coded - by each of the coding tables. - --*/ - for (t = 0; t < nGroups; t++) cost[t] = 0; - - if (nGroups == 6 && 50 == ge-gs+1) { - /*--- fast track the common case ---*/ - register UInt32 cost01, cost23, cost45; - register UInt16 icv; - cost01 = cost23 = cost45 = 0; - -# define BZ_ITER(nn) \ - icv = mtfv[gs+(nn)]; \ - cost01 += s->len_pack[icv][0]; \ - cost23 += s->len_pack[icv][1]; \ - cost45 += s->len_pack[icv][2]; \ - - BZ_ITER(0); BZ_ITER(1); BZ_ITER(2); BZ_ITER(3); BZ_ITER(4); - BZ_ITER(5); BZ_ITER(6); BZ_ITER(7); BZ_ITER(8); BZ_ITER(9); - BZ_ITER(10); BZ_ITER(11); BZ_ITER(12); BZ_ITER(13); BZ_ITER(14); - BZ_ITER(15); BZ_ITER(16); BZ_ITER(17); BZ_ITER(18); BZ_ITER(19); - BZ_ITER(20); BZ_ITER(21); BZ_ITER(22); BZ_ITER(23); BZ_ITER(24); - BZ_ITER(25); BZ_ITER(26); BZ_ITER(27); BZ_ITER(28); BZ_ITER(29); - BZ_ITER(30); BZ_ITER(31); BZ_ITER(32); BZ_ITER(33); BZ_ITER(34); - BZ_ITER(35); BZ_ITER(36); BZ_ITER(37); BZ_ITER(38); BZ_ITER(39); - BZ_ITER(40); BZ_ITER(41); BZ_ITER(42); BZ_ITER(43); BZ_ITER(44); - BZ_ITER(45); BZ_ITER(46); BZ_ITER(47); BZ_ITER(48); BZ_ITER(49); - -# undef BZ_ITER - - cost[0] = cost01 & 0xffff; cost[1] = cost01 >> 16; - cost[2] = cost23 & 0xffff; cost[3] = cost23 >> 16; - cost[4] = cost45 & 0xffff; cost[5] = cost45 >> 16; - - } else { - /*--- slow version which correctly handles all situations ---*/ - for (i = gs; i <= ge; i++) { - UInt16 icv = mtfv[i]; - for (t = 0; t < nGroups; t++) cost[t] += s->len[t][icv]; - } - } - - /*-- - Find the coding table which is best for this group, - and record its identity in the selector table. - --*/ - bc = 999999999; bt = -1; - for (t = 0; t < nGroups; t++) - if (cost[t] < bc) { bc = cost[t]; bt = t; }; - totc += bc; - fave[bt]++; - s->selector[nSelectors] = bt; - nSelectors++; - - /*-- - Increment the symbol frequencies for the selected table. - --*/ - if (nGroups == 6 && 50 == ge-gs+1) { - /*--- fast track the common case ---*/ - -# define BZ_ITUR(nn) s->rfreq[bt][ mtfv[gs+(nn)] ]++ - - BZ_ITUR(0); BZ_ITUR(1); BZ_ITUR(2); BZ_ITUR(3); BZ_ITUR(4); - BZ_ITUR(5); BZ_ITUR(6); BZ_ITUR(7); BZ_ITUR(8); BZ_ITUR(9); - BZ_ITUR(10); BZ_ITUR(11); BZ_ITUR(12); BZ_ITUR(13); BZ_ITUR(14); - BZ_ITUR(15); BZ_ITUR(16); BZ_ITUR(17); BZ_ITUR(18); BZ_ITUR(19); - BZ_ITUR(20); BZ_ITUR(21); BZ_ITUR(22); BZ_ITUR(23); BZ_ITUR(24); - BZ_ITUR(25); BZ_ITUR(26); BZ_ITUR(27); BZ_ITUR(28); BZ_ITUR(29); - BZ_ITUR(30); BZ_ITUR(31); BZ_ITUR(32); BZ_ITUR(33); BZ_ITUR(34); - BZ_ITUR(35); BZ_ITUR(36); BZ_ITUR(37); BZ_ITUR(38); BZ_ITUR(39); - BZ_ITUR(40); BZ_ITUR(41); BZ_ITUR(42); BZ_ITUR(43); BZ_ITUR(44); - BZ_ITUR(45); BZ_ITUR(46); BZ_ITUR(47); BZ_ITUR(48); BZ_ITUR(49); - -# undef BZ_ITUR - - } else { - /*--- slow version which correctly handles all situations ---*/ - for (i = gs; i <= ge; i++) - s->rfreq[bt][ mtfv[i] ]++; - } - - gs = ge+1; - } - if (s->verbosity >= 3) { - VPrintf2 ( " pass %d: size is %d, grp uses are ", - iter+1, totc/8 ); - for (t = 0; t < nGroups; t++) - VPrintf1 ( "%d ", fave[t] ); - VPrintf0 ( "\n" ); - } - - /*-- - Recompute the tables based on the accumulated frequencies. - --*/ - for (t = 0; t < nGroups; t++) - BZ2_hbMakeCodeLengths ( &(s->len[t][0]), &(s->rfreq[t][0]), - alphaSize, 20 ); - } - - - AssertH( nGroups < 8, 3002 ); - AssertH( nSelectors < 32768 && - nSelectors <= (2 + (900000 / BZ_G_SIZE)), - 3003 ); - - - /*--- Compute MTF values for the selectors. ---*/ - { - UChar pos[BZ_N_GROUPS], ll_i, tmp2, tmp; - for (i = 0; i < nGroups; i++) pos[i] = i; - for (i = 0; i < nSelectors; i++) { - ll_i = s->selector[i]; - j = 0; - tmp = pos[j]; - while ( ll_i != tmp ) { - j++; - tmp2 = tmp; - tmp = pos[j]; - pos[j] = tmp2; - }; - pos[0] = tmp; - s->selectorMtf[i] = j; - } - }; - - /*--- Assign actual codes for the tables. --*/ - for (t = 0; t < nGroups; t++) { - minLen = 32; - maxLen = 0; - for (i = 0; i < alphaSize; i++) { - if (s->len[t][i] > maxLen) maxLen = s->len[t][i]; - if (s->len[t][i] < minLen) minLen = s->len[t][i]; - } - AssertH ( !(maxLen > 20), 3004 ); - AssertH ( !(minLen < 1), 3005 ); - BZ2_hbAssignCodes ( &(s->code[t][0]), &(s->len[t][0]), - minLen, maxLen, alphaSize ); - } - - /*--- Transmit the mapping table. ---*/ - { - Bool inUse16[16]; - for (i = 0; i < 16; i++) { - inUse16[i] = False; - for (j = 0; j < 16; j++) - if (s->inUse[i * 16 + j]) inUse16[i] = True; - } - - nBytes = s->numZ; - for (i = 0; i < 16; i++) - if (inUse16[i]) bsW(s,1,1); else bsW(s,1,0); - - for (i = 0; i < 16; i++) - if (inUse16[i]) - for (j = 0; j < 16; j++) { - if (s->inUse[i * 16 + j]) bsW(s,1,1); else bsW(s,1,0); - } - - if (s->verbosity >= 3) - VPrintf1( " bytes: mapping %d, ", s->numZ-nBytes ); - } - - /*--- Now the selectors. ---*/ - nBytes = s->numZ; - bsW ( s, 3, nGroups ); - bsW ( s, 15, nSelectors ); - for (i = 0; i < nSelectors; i++) { - for (j = 0; j < s->selectorMtf[i]; j++) bsW(s,1,1); - bsW(s,1,0); - } - if (s->verbosity >= 3) - VPrintf1( "selectors %d, ", s->numZ-nBytes ); - - /*--- Now the coding tables. ---*/ - nBytes = s->numZ; - - for (t = 0; t < nGroups; t++) { - Int32 curr = s->len[t][0]; - bsW ( s, 5, curr ); - for (i = 0; i < alphaSize; i++) { - while (curr < s->len[t][i]) { bsW(s,2,2); curr++; /* 10 */ }; - while (curr > s->len[t][i]) { bsW(s,2,3); curr--; /* 11 */ }; - bsW ( s, 1, 0 ); - } - } - - if (s->verbosity >= 3) - VPrintf1 ( "code lengths %d, ", s->numZ-nBytes ); - - /*--- And finally, the block data proper ---*/ - nBytes = s->numZ; - selCtr = 0; - gs = 0; - while (True) { - if (gs >= s->nMTF) break; - ge = gs + BZ_G_SIZE - 1; - if (ge >= s->nMTF) ge = s->nMTF-1; - AssertH ( s->selector[selCtr] < nGroups, 3006 ); - - if (nGroups == 6 && 50 == ge-gs+1) { - /*--- fast track the common case ---*/ - UInt16 mtfv_i; - UChar* s_len_sel_selCtr - = &(s->len[s->selector[selCtr]][0]); - Int32* s_code_sel_selCtr - = &(s->code[s->selector[selCtr]][0]); - -# define BZ_ITAH(nn) \ - mtfv_i = mtfv[gs+(nn)]; \ - bsW ( s, \ - s_len_sel_selCtr[mtfv_i], \ - s_code_sel_selCtr[mtfv_i] ) - - BZ_ITAH(0); BZ_ITAH(1); BZ_ITAH(2); BZ_ITAH(3); BZ_ITAH(4); - BZ_ITAH(5); BZ_ITAH(6); BZ_ITAH(7); BZ_ITAH(8); BZ_ITAH(9); - BZ_ITAH(10); BZ_ITAH(11); BZ_ITAH(12); BZ_ITAH(13); BZ_ITAH(14); - BZ_ITAH(15); BZ_ITAH(16); BZ_ITAH(17); BZ_ITAH(18); BZ_ITAH(19); - BZ_ITAH(20); BZ_ITAH(21); BZ_ITAH(22); BZ_ITAH(23); BZ_ITAH(24); - BZ_ITAH(25); BZ_ITAH(26); BZ_ITAH(27); BZ_ITAH(28); BZ_ITAH(29); - BZ_ITAH(30); BZ_ITAH(31); BZ_ITAH(32); BZ_ITAH(33); BZ_ITAH(34); - BZ_ITAH(35); BZ_ITAH(36); BZ_ITAH(37); BZ_ITAH(38); BZ_ITAH(39); - BZ_ITAH(40); BZ_ITAH(41); BZ_ITAH(42); BZ_ITAH(43); BZ_ITAH(44); - BZ_ITAH(45); BZ_ITAH(46); BZ_ITAH(47); BZ_ITAH(48); BZ_ITAH(49); - -# undef BZ_ITAH - - } else { - /*--- slow version which correctly handles all situations ---*/ - for (i = gs; i <= ge; i++) { - bsW ( s, - s->len [s->selector[selCtr]] [mtfv[i]], - s->code [s->selector[selCtr]] [mtfv[i]] ); - } - } - - - gs = ge+1; - selCtr++; - } - AssertH( selCtr == nSelectors, 3007 ); - - if (s->verbosity >= 3) - VPrintf1( "codes %d\n", s->numZ-nBytes ); -} - - -/*---------------------------------------------------*/ -void BZ2_compressBlock ( EState* s, Bool is_last_block ) -{ - if (s->nblock > 0) { - - BZ_FINALISE_CRC ( s->blockCRC ); - s->combinedCRC = (s->combinedCRC << 1) | (s->combinedCRC >> 31); - s->combinedCRC ^= s->blockCRC; - if (s->blockNo > 1) s->numZ = 0; - - if (s->verbosity >= 2) - VPrintf4( " block %d: crc = 0x%8x, " - "combined CRC = 0x%8x, size = %d\n", - s->blockNo, s->blockCRC, s->combinedCRC, s->nblock ); - - BZ2_blockSort ( s ); - } - - s->zbits = (UChar*) (&((UChar*)s->arr2)[s->nblock]); - - /*-- If this is the first block, create the stream header. --*/ - if (s->blockNo == 1) { - BZ2_bsInitWrite ( s ); - bsPutUChar ( s, 'B' ); - bsPutUChar ( s, 'Z' ); - bsPutUChar ( s, 'h' ); - bsPutUChar ( s, (UChar)('0' + s->blockSize100k) ); - } - - if (s->nblock > 0) { - - bsPutUChar ( s, 0x31 ); bsPutUChar ( s, 0x41 ); - bsPutUChar ( s, 0x59 ); bsPutUChar ( s, 0x26 ); - bsPutUChar ( s, 0x53 ); bsPutUChar ( s, 0x59 ); - - /*-- Now the block's CRC, so it is in a known place. --*/ - bsPutUInt32 ( s, s->blockCRC ); - - /*-- - Now a single bit indicating (non-)randomisation. - As of version 0.9.5, we use a better sorting algorithm - which makes randomisation unnecessary. So always set - the randomised bit to 'no'. Of course, the decoder - still needs to be able to handle randomised blocks - so as to maintain backwards compatibility with - older versions of bzip2. - --*/ - bsW(s,1,0); - - bsW ( s, 24, s->origPtr ); - generateMTFValues ( s ); - sendMTFValues ( s ); - } - - - /*-- If this is the last block, add the stream trailer. --*/ - if (is_last_block) { - - bsPutUChar ( s, 0x17 ); bsPutUChar ( s, 0x72 ); - bsPutUChar ( s, 0x45 ); bsPutUChar ( s, 0x38 ); - bsPutUChar ( s, 0x50 ); bsPutUChar ( s, 0x90 ); - bsPutUInt32 ( s, s->combinedCRC ); - if (s->verbosity >= 2) - VPrintf1( " final combined CRC = 0x%x\n ", s->combinedCRC ); - bsFinishWrite ( s ); - } -} - - -/*-------------------------------------------------------------*/ -/*--- end compress.c ---*/ -/*-------------------------------------------------------------*/ diff --git a/mdk-stage1/bzlib/crctable.c b/mdk-stage1/bzlib/crctable.c deleted file mode 100644 index c0ea3f769..000000000 --- a/mdk-stage1/bzlib/crctable.c +++ /dev/null @@ -1,148 +0,0 @@ - -/*-------------------------------------------------------------*/ -/*--- Table for doing CRCs ---*/ -/*--- crctable.c ---*/ -/*-------------------------------------------------------------*/ - -/*-- - This file is a part of bzip2 and/or libbzip2, a program and - library for lossless, block-sorting data compression. - - Copyright (C) 1996-2000 Julian R Seward. All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 2. The origin of this software must not be misrepresented; you must - not claim that you wrote the original software. If you use this - software in a product, an acknowledgment in the product - documentation would be appreciated but is not required. - - 3. Altered source versions must be plainly marked as such, and must - not be misrepresented as being the original software. - - 4. The name of the author may not be used to endorse or promote - products derived from this software without specific prior written - permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - Julian Seward, Cambridge, UK. - jseward@acm.org - bzip2/libbzip2 version 1.0 of 21 March 2000 - - This program is based on (at least) the work of: - Mike Burrows - David Wheeler - Peter Fenwick - Alistair Moffat - Radford Neal - Ian H. Witten - Robert Sedgewick - Jon L. Bentley - - For more information on these sources, see the manual. ---*/ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - - -#include "bzlib_private.h" - -/*-- - I think this is an implementation of the AUTODIN-II, - Ethernet & FDDI 32-bit CRC standard. Vaguely derived - from code by Rob Warnock, in Section 51 of the - comp.compression FAQ. ---*/ - -UInt32 BZ2_crc32Table[256] = { - - /*-- Ugly, innit? --*/ - - 0x00000000L, 0x04c11db7L, 0x09823b6eL, 0x0d4326d9L, - 0x130476dcL, 0x17c56b6bL, 0x1a864db2L, 0x1e475005L, - 0x2608edb8L, 0x22c9f00fL, 0x2f8ad6d6L, 0x2b4bcb61L, - 0x350c9b64L, 0x31cd86d3L, 0x3c8ea00aL, 0x384fbdbdL, - 0x4c11db70L, 0x48d0c6c7L, 0x4593e01eL, 0x4152fda9L, - 0x5f15adacL, 0x5bd4b01bL, 0x569796c2L, 0x52568b75L, - 0x6a1936c8L, 0x6ed82b7fL, 0x639b0da6L, 0x675a1011L, - 0x791d4014L, 0x7ddc5da3L, 0x709f7b7aL, 0x745e66cdL, - 0x9823b6e0L, 0x9ce2ab57L, 0x91a18d8eL, 0x95609039L, - 0x8b27c03cL, 0x8fe6dd8bL, 0x82a5fb52L, 0x8664e6e5L, - 0xbe2b5b58L, 0xbaea46efL, 0xb7a96036L, 0xb3687d81L, - 0xad2f2d84L, 0xa9ee3033L, 0xa4ad16eaL, 0xa06c0b5dL, - 0xd4326d90L, 0xd0f37027L, 0xddb056feL, 0xd9714b49L, - 0xc7361b4cL, 0xc3f706fbL, 0xceb42022L, 0xca753d95L, - 0xf23a8028L, 0xf6fb9d9fL, 0xfbb8bb46L, 0xff79a6f1L, - 0xe13ef6f4L, 0xe5ffeb43L, 0xe8bccd9aL, 0xec7dd02dL, - 0x34867077L, 0x30476dc0L, 0x3d044b19L, 0x39c556aeL, - 0x278206abL, 0x23431b1cL, 0x2e003dc5L, 0x2ac12072L, - 0x128e9dcfL, 0x164f8078L, 0x1b0ca6a1L, 0x1fcdbb16L, - 0x018aeb13L, 0x054bf6a4L, 0x0808d07dL, 0x0cc9cdcaL, - 0x7897ab07L, 0x7c56b6b0L, 0x71159069L, 0x75d48ddeL, - 0x6b93dddbL, 0x6f52c06cL, 0x6211e6b5L, 0x66d0fb02L, - 0x5e9f46bfL, 0x5a5e5b08L, 0x571d7dd1L, 0x53dc6066L, - 0x4d9b3063L, 0x495a2dd4L, 0x44190b0dL, 0x40d816baL, - 0xaca5c697L, 0xa864db20L, 0xa527fdf9L, 0xa1e6e04eL, - 0xbfa1b04bL, 0xbb60adfcL, 0xb6238b25L, 0xb2e29692L, - 0x8aad2b2fL, 0x8e6c3698L, 0x832f1041L, 0x87ee0df6L, - 0x99a95df3L, 0x9d684044L, 0x902b669dL, 0x94ea7b2aL, - 0xe0b41de7L, 0xe4750050L, 0xe9362689L, 0xedf73b3eL, - 0xf3b06b3bL, 0xf771768cL, 0xfa325055L, 0xfef34de2L, - 0xc6bcf05fL, 0xc27dede8L, 0xcf3ecb31L, 0xcbffd686L, - 0xd5b88683L, 0xd1799b34L, 0xdc3abdedL, 0xd8fba05aL, - 0x690ce0eeL, 0x6dcdfd59L, 0x608edb80L, 0x644fc637L, - 0x7a089632L, 0x7ec98b85L, 0x738aad5cL, 0x774bb0ebL, - 0x4f040d56L, 0x4bc510e1L, 0x46863638L, 0x42472b8fL, - 0x5c007b8aL, 0x58c1663dL, 0x558240e4L, 0x51435d53L, - 0x251d3b9eL, 0x21dc2629L, 0x2c9f00f0L, 0x285e1d47L, - 0x36194d42L, 0x32d850f5L, 0x3f9b762cL, 0x3b5a6b9bL, - 0x0315d626L, 0x07d4cb91L, 0x0a97ed48L, 0x0e56f0ffL, - 0x1011a0faL, 0x14d0bd4dL, 0x19939b94L, 0x1d528623L, - 0xf12f560eL, 0xf5ee4bb9L, 0xf8ad6d60L, 0xfc6c70d7L, - 0xe22b20d2L, 0xe6ea3d65L, 0xeba91bbcL, 0xef68060bL, - 0xd727bbb6L, 0xd3e6a601L, 0xdea580d8L, 0xda649d6fL, - 0xc423cd6aL, 0xc0e2d0ddL, 0xcda1f604L, 0xc960ebb3L, - 0xbd3e8d7eL, 0xb9ff90c9L, 0xb4bcb610L, 0xb07daba7L, - 0xae3afba2L, 0xaafbe615L, 0xa7b8c0ccL, 0xa379dd7bL, - 0x9b3660c6L, 0x9ff77d71L, 0x92b45ba8L, 0x9675461fL, - 0x8832161aL, 0x8cf30badL, 0x81b02d74L, 0x857130c3L, - 0x5d8a9099L, 0x594b8d2eL, 0x5408abf7L, 0x50c9b640L, - 0x4e8ee645L, 0x4a4ffbf2L, 0x470cdd2bL, 0x43cdc09cL, - 0x7b827d21L, 0x7f436096L, 0x7200464fL, 0x76c15bf8L, - 0x68860bfdL, 0x6c47164aL, 0x61043093L, 0x65c52d24L, - 0x119b4be9L, 0x155a565eL, 0x18197087L, 0x1cd86d30L, - 0x029f3d35L, 0x065e2082L, 0x0b1d065bL, 0x0fdc1becL, - 0x3793a651L, 0x3352bbe6L, 0x3e119d3fL, 0x3ad08088L, - 0x2497d08dL, 0x2056cd3aL, 0x2d15ebe3L, 0x29d4f654L, - 0xc5a92679L, 0xc1683bceL, 0xcc2b1d17L, 0xc8ea00a0L, - 0xd6ad50a5L, 0xd26c4d12L, 0xdf2f6bcbL, 0xdbee767cL, - 0xe3a1cbc1L, 0xe760d676L, 0xea23f0afL, 0xeee2ed18L, - 0xf0a5bd1dL, 0xf464a0aaL, 0xf9278673L, 0xfde69bc4L, - 0x89b8fd09L, 0x8d79e0beL, 0x803ac667L, 0x84fbdbd0L, - 0x9abc8bd5L, 0x9e7d9662L, 0x933eb0bbL, 0x97ffad0cL, - 0xafb010b1L, 0xab710d06L, 0xa6322bdfL, 0xa2f33668L, - 0xbcb4666dL, 0xb8757bdaL, 0xb5365d03L, 0xb1f740b4L -}; - - -/*-------------------------------------------------------------*/ -/*--- end crctable.c ---*/ -/*-------------------------------------------------------------*/ diff --git a/mdk-stage1/bzlib/decompress.c b/mdk-stage1/bzlib/decompress.c deleted file mode 100644 index 65cf75d8f..000000000 --- a/mdk-stage1/bzlib/decompress.c +++ /dev/null @@ -1,664 +0,0 @@ - -/*-------------------------------------------------------------*/ -/*--- Decompression machinery ---*/ -/*--- decompress.c ---*/ -/*-------------------------------------------------------------*/ - -/*-- - This file is a part of bzip2 and/or libbzip2, a program and - library for lossless, block-sorting data compression. - - Copyright (C) 1996-2000 Julian R Seward. All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 2. The origin of this software must not be misrepresented; you must - not claim that you wrote the original software. If you use this - software in a product, an acknowledgment in the product - documentation would be appreciated but is not required. - - 3. Altered source versions must be plainly marked as such, and must - not be misrepresented as being the original software. - - 4. The name of the author may not be used to endorse or promote - products derived from this software without specific prior written - permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - Julian Seward, Cambridge, UK. - jseward@acm.org - bzip2/libbzip2 version 1.0 of 21 March 2000 - - This program is based on (at least) the work of: - Mike Burrows - David Wheeler - Peter Fenwick - Alistair Moffat - Radford Neal - Ian H. Witten - Robert Sedgewick - Jon L. Bentley - - For more information on these sources, see the manual. ---*/ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - - -#include "bzlib_private.h" - - -/*---------------------------------------------------*/ -static -void makeMaps_d ( DState* s ) -{ - Int32 i; - s->nInUse = 0; - for (i = 0; i < 256; i++) - if (s->inUse[i]) { - s->seqToUnseq[s->nInUse] = i; - s->nInUse++; - } -} - - -/*---------------------------------------------------*/ -#define RETURN(rrr) \ - { retVal = rrr; goto save_state_and_return; }; - -#define GET_BITS(lll,vvv,nnn) \ - case lll: s->state = lll; \ - while (True) { \ - if (s->bsLive >= nnn) { \ - UInt32 v; \ - v = (s->bsBuff >> \ - (s->bsLive-nnn)) & ((1 << nnn)-1); \ - s->bsLive -= nnn; \ - vvv = v; \ - break; \ - } \ - if (s->strm->avail_in == 0) RETURN(BZ_OK); \ - s->bsBuff \ - = (s->bsBuff << 8) | \ - ((UInt32) \ - (*((UChar*)(s->strm->next_in)))); \ - s->bsLive += 8; \ - s->strm->next_in++; \ - s->strm->avail_in--; \ - s->strm->total_in_lo32++; \ - if (s->strm->total_in_lo32 == 0) \ - s->strm->total_in_hi32++; \ - } - -#define GET_UCHAR(lll,uuu) \ - GET_BITS(lll,uuu,8) - -#define GET_BIT(lll,uuu) \ - GET_BITS(lll,uuu,1) - -/*---------------------------------------------------*/ -#define GET_MTF_VAL(label1,label2,lval) \ -{ \ - if (groupPos == 0) { \ - groupNo++; \ - if (groupNo >= nSelectors) \ - RETURN(BZ_DATA_ERROR); \ - groupPos = BZ_G_SIZE; \ - gSel = s->selector[groupNo]; \ - gMinlen = s->minLens[gSel]; \ - gLimit = &(s->limit[gSel][0]); \ - gPerm = &(s->perm[gSel][0]); \ - gBase = &(s->base[gSel][0]); \ - } \ - groupPos--; \ - zn = gMinlen; \ - GET_BITS(label1, zvec, zn); \ - while (1) { \ - if (zn > 20 /* the longest code */) \ - RETURN(BZ_DATA_ERROR); \ - if (zvec <= gLimit[zn]) break; \ - zn++; \ - GET_BIT(label2, zj); \ - zvec = (zvec << 1) | zj; \ - }; \ - if (zvec - gBase[zn] < 0 \ - || zvec - gBase[zn] >= BZ_MAX_ALPHA_SIZE) \ - RETURN(BZ_DATA_ERROR); \ - lval = gPerm[zvec - gBase[zn]]; \ -} - - -/*---------------------------------------------------*/ -Int32 BZ2_decompress ( DState* s ) -{ - UChar uc; - Int32 retVal; - Int32 minLen, maxLen; - bz_stream* strm = s->strm; - - /* stuff that needs to be saved/restored */ - Int32 i; - Int32 j; - Int32 t; - Int32 alphaSize; - Int32 nGroups; - Int32 nSelectors; - Int32 EOB; - Int32 groupNo; - Int32 groupPos; - Int32 nextSym; - Int32 nblockMAX; - Int32 nblock; - Int32 es; - Int32 N; - Int32 curr; - Int32 zt; - Int32 zn; - Int32 zvec; - Int32 zj; - Int32 gSel; - Int32 gMinlen; - Int32* gLimit; - Int32* gBase; - Int32* gPerm; - - if (s->state == BZ_X_MAGIC_1) { - /*initialise the save area*/ - s->save_i = 0; - s->save_j = 0; - s->save_t = 0; - s->save_alphaSize = 0; - s->save_nGroups = 0; - s->save_nSelectors = 0; - s->save_EOB = 0; - s->save_groupNo = 0; - s->save_groupPos = 0; - s->save_nextSym = 0; - s->save_nblockMAX = 0; - s->save_nblock = 0; - s->save_es = 0; - s->save_N = 0; - s->save_curr = 0; - s->save_zt = 0; - s->save_zn = 0; - s->save_zvec = 0; - s->save_zj = 0; - s->save_gSel = 0; - s->save_gMinlen = 0; - s->save_gLimit = NULL; - s->save_gBase = NULL; - s->save_gPerm = NULL; - } - - /*restore from the save area*/ - i = s->save_i; - j = s->save_j; - t = s->save_t; - alphaSize = s->save_alphaSize; - nGroups = s->save_nGroups; - nSelectors = s->save_nSelectors; - EOB = s->save_EOB; - groupNo = s->save_groupNo; - groupPos = s->save_groupPos; - nextSym = s->save_nextSym; - nblockMAX = s->save_nblockMAX; - nblock = s->save_nblock; - es = s->save_es; - N = s->save_N; - curr = s->save_curr; - zt = s->save_zt; - zn = s->save_zn; - zvec = s->save_zvec; - zj = s->save_zj; - gSel = s->save_gSel; - gMinlen = s->save_gMinlen; - gLimit = s->save_gLimit; - gBase = s->save_gBase; - gPerm = s->save_gPerm; - - retVal = BZ_OK; - - switch (s->state) { - - GET_UCHAR(BZ_X_MAGIC_1, uc); - if (uc != 'B') RETURN(BZ_DATA_ERROR_MAGIC); - - GET_UCHAR(BZ_X_MAGIC_2, uc); - if (uc != 'Z') RETURN(BZ_DATA_ERROR_MAGIC); - - GET_UCHAR(BZ_X_MAGIC_3, uc) - if (uc != 'h') RETURN(BZ_DATA_ERROR_MAGIC); - - GET_BITS(BZ_X_MAGIC_4, s->blockSize100k, 8) - if (s->blockSize100k < '1' || - s->blockSize100k > '9') RETURN(BZ_DATA_ERROR_MAGIC); - s->blockSize100k -= '0'; - - if (s->smallDecompress) { - s->ll16 = BZALLOC( s->blockSize100k * 100000 * sizeof(UInt16) ); - s->ll4 = BZALLOC( - ((1 + s->blockSize100k * 100000) >> 1) * sizeof(UChar) - ); - if (s->ll16 == NULL || s->ll4 == NULL) RETURN(BZ_MEM_ERROR); - } else { - s->tt = BZALLOC( s->blockSize100k * 100000 * sizeof(Int32) ); - if (s->tt == NULL) RETURN(BZ_MEM_ERROR); - } - - GET_UCHAR(BZ_X_BLKHDR_1, uc); - - if (uc == 0x17) goto endhdr_2; - if (uc != 0x31) RETURN(BZ_DATA_ERROR); - GET_UCHAR(BZ_X_BLKHDR_2, uc); - if (uc != 0x41) RETURN(BZ_DATA_ERROR); - GET_UCHAR(BZ_X_BLKHDR_3, uc); - if (uc != 0x59) RETURN(BZ_DATA_ERROR); - GET_UCHAR(BZ_X_BLKHDR_4, uc); - if (uc != 0x26) RETURN(BZ_DATA_ERROR); - GET_UCHAR(BZ_X_BLKHDR_5, uc); - if (uc != 0x53) RETURN(BZ_DATA_ERROR); - GET_UCHAR(BZ_X_BLKHDR_6, uc); - if (uc != 0x59) RETURN(BZ_DATA_ERROR); - - s->currBlockNo++; - if (s->verbosity >= 2) - VPrintf1 ( "\n [%d: huff+mtf ", s->currBlockNo ); - - s->storedBlockCRC = 0; - GET_UCHAR(BZ_X_BCRC_1, uc); - s->storedBlockCRC = (s->storedBlockCRC << 8) | ((UInt32)uc); - GET_UCHAR(BZ_X_BCRC_2, uc); - s->storedBlockCRC = (s->storedBlockCRC << 8) | ((UInt32)uc); - GET_UCHAR(BZ_X_BCRC_3, uc); - s->storedBlockCRC = (s->storedBlockCRC << 8) | ((UInt32)uc); - GET_UCHAR(BZ_X_BCRC_4, uc); - s->storedBlockCRC = (s->storedBlockCRC << 8) | ((UInt32)uc); - - GET_BITS(BZ_X_RANDBIT, s->blockRandomised, 1); - - s->origPtr = 0; - GET_UCHAR(BZ_X_ORIGPTR_1, uc); - s->origPtr = (s->origPtr << 8) | ((Int32)uc); - GET_UCHAR(BZ_X_ORIGPTR_2, uc); - s->origPtr = (s->origPtr << 8) | ((Int32)uc); - GET_UCHAR(BZ_X_ORIGPTR_3, uc); - s->origPtr = (s->origPtr << 8) | ((Int32)uc); - - if (s->origPtr < 0) - RETURN(BZ_DATA_ERROR); - if (s->origPtr > 10 + 100000*s->blockSize100k) - RETURN(BZ_DATA_ERROR); - - /*--- Receive the mapping table ---*/ - for (i = 0; i < 16; i++) { - GET_BIT(BZ_X_MAPPING_1, uc); - if (uc == 1) - s->inUse16[i] = True; else - s->inUse16[i] = False; - } - - for (i = 0; i < 256; i++) s->inUse[i] = False; - - for (i = 0; i < 16; i++) - if (s->inUse16[i]) - for (j = 0; j < 16; j++) { - GET_BIT(BZ_X_MAPPING_2, uc); - if (uc == 1) s->inUse[i * 16 + j] = True; - } - makeMaps_d ( s ); - if (s->nInUse == 0) RETURN(BZ_DATA_ERROR); - alphaSize = s->nInUse+2; - - /*--- Now the selectors ---*/ - GET_BITS(BZ_X_SELECTOR_1, nGroups, 3); - if (nGroups < 2 || nGroups > 6) RETURN(BZ_DATA_ERROR); - GET_BITS(BZ_X_SELECTOR_2, nSelectors, 15); - if (nSelectors < 1) RETURN(BZ_DATA_ERROR); - for (i = 0; i < nSelectors; i++) { - j = 0; - while (True) { - GET_BIT(BZ_X_SELECTOR_3, uc); - if (uc == 0) break; - j++; - if (j >= nGroups) RETURN(BZ_DATA_ERROR); - } - s->selectorMtf[i] = j; - } - - /*--- Undo the MTF values for the selectors. ---*/ - { - UChar pos[BZ_N_GROUPS], tmp, v; - for (v = 0; v < nGroups; v++) pos[v] = v; - - for (i = 0; i < nSelectors; i++) { - v = s->selectorMtf[i]; - tmp = pos[v]; - while (v > 0) { pos[v] = pos[v-1]; v--; } - pos[0] = tmp; - s->selector[i] = tmp; - } - } - - /*--- Now the coding tables ---*/ - for (t = 0; t < nGroups; t++) { - GET_BITS(BZ_X_CODING_1, curr, 5); - for (i = 0; i < alphaSize; i++) { - while (True) { - if (curr < 1 || curr > 20) RETURN(BZ_DATA_ERROR); - GET_BIT(BZ_X_CODING_2, uc); - if (uc == 0) break; - GET_BIT(BZ_X_CODING_3, uc); - if (uc == 0) curr++; else curr--; - } - s->len[t][i] = curr; - } - } - - /*--- Create the Huffman decoding tables ---*/ - for (t = 0; t < nGroups; t++) { - minLen = 32; - maxLen = 0; - for (i = 0; i < alphaSize; i++) { - if (s->len[t][i] > maxLen) maxLen = s->len[t][i]; - if (s->len[t][i] < minLen) minLen = s->len[t][i]; - } - BZ2_hbCreateDecodeTables ( - &(s->limit[t][0]), - &(s->base[t][0]), - &(s->perm[t][0]), - &(s->len[t][0]), - minLen, maxLen, alphaSize - ); - s->minLens[t] = minLen; - } - - /*--- Now the MTF values ---*/ - - EOB = s->nInUse+1; - nblockMAX = 100000 * s->blockSize100k; - groupNo = -1; - groupPos = 0; - - for (i = 0; i <= 255; i++) s->unzftab[i] = 0; - - /*-- MTF init --*/ - { - Int32 ii, jj, kk; - kk = MTFA_SIZE-1; - for (ii = 256 / MTFL_SIZE - 1; ii >= 0; ii--) { - for (jj = MTFL_SIZE-1; jj >= 0; jj--) { - s->mtfa[kk] = (UChar)(ii * MTFL_SIZE + jj); - kk--; - } - s->mtfbase[ii] = kk + 1; - } - } - /*-- end MTF init --*/ - - nblock = 0; - GET_MTF_VAL(BZ_X_MTF_1, BZ_X_MTF_2, nextSym); - - while (True) { - - if (nextSym == EOB) break; - - if (nextSym == BZ_RUNA || nextSym == BZ_RUNB) { - - es = -1; - N = 1; - do { - if (nextSym == BZ_RUNA) es = es + (0+1) * N; else - if (nextSym == BZ_RUNB) es = es + (1+1) * N; - N = N * 2; - GET_MTF_VAL(BZ_X_MTF_3, BZ_X_MTF_4, nextSym); - } - while (nextSym == BZ_RUNA || nextSym == BZ_RUNB); - - es++; - uc = s->seqToUnseq[ s->mtfa[s->mtfbase[0]] ]; - s->unzftab[uc] += es; - - if (s->smallDecompress) - while (es > 0) { - if (nblock >= nblockMAX) RETURN(BZ_DATA_ERROR); - s->ll16[nblock] = (UInt16)uc; - nblock++; - es--; - } - else - while (es > 0) { - if (nblock >= nblockMAX) RETURN(BZ_DATA_ERROR); - s->tt[nblock] = (UInt32)uc; - nblock++; - es--; - }; - - continue; - - } else { - - if (nblock >= nblockMAX) RETURN(BZ_DATA_ERROR); - - /*-- uc = MTF ( nextSym-1 ) --*/ - { - Int32 ii, jj, kk, pp, lno, off; - UInt32 nn; - nn = (UInt32)(nextSym - 1); - - if (nn < MTFL_SIZE) { - /* avoid general-case expense */ - pp = s->mtfbase[0]; - uc = s->mtfa[pp+nn]; - while (nn > 3) { - Int32 z = pp+nn; - s->mtfa[(z) ] = s->mtfa[(z)-1]; - s->mtfa[(z)-1] = s->mtfa[(z)-2]; - s->mtfa[(z)-2] = s->mtfa[(z)-3]; - s->mtfa[(z)-3] = s->mtfa[(z)-4]; - nn -= 4; - } - while (nn > 0) { - s->mtfa[(pp+nn)] = s->mtfa[(pp+nn)-1]; nn--; - }; - s->mtfa[pp] = uc; - } else { - /* general case */ - lno = nn / MTFL_SIZE; - off = nn % MTFL_SIZE; - pp = s->mtfbase[lno] + off; - uc = s->mtfa[pp]; - while (pp > s->mtfbase[lno]) { - s->mtfa[pp] = s->mtfa[pp-1]; pp--; - }; - s->mtfbase[lno]++; - while (lno > 0) { - s->mtfbase[lno]--; - s->mtfa[s->mtfbase[lno]] - = s->mtfa[s->mtfbase[lno-1] + MTFL_SIZE - 1]; - lno--; - } - s->mtfbase[0]--; - s->mtfa[s->mtfbase[0]] = uc; - if (s->mtfbase[0] == 0) { - kk = MTFA_SIZE-1; - for (ii = 256 / MTFL_SIZE-1; ii >= 0; ii--) { - for (jj = MTFL_SIZE-1; jj >= 0; jj--) { - s->mtfa[kk] = s->mtfa[s->mtfbase[ii] + jj]; - kk--; - } - s->mtfbase[ii] = kk + 1; - } - } - } - } - /*-- end uc = MTF ( nextSym-1 ) --*/ - - s->unzftab[s->seqToUnseq[uc]]++; - if (s->smallDecompress) - s->ll16[nblock] = (UInt16)(s->seqToUnseq[uc]); else - s->tt[nblock] = (UInt32)(s->seqToUnseq[uc]); - nblock++; - - GET_MTF_VAL(BZ_X_MTF_5, BZ_X_MTF_6, nextSym); - continue; - } - } - - /* Now we know what nblock is, we can do a better sanity - check on s->origPtr. - */ - if (s->origPtr < 0 || s->origPtr >= nblock) - RETURN(BZ_DATA_ERROR); - - s->state_out_len = 0; - s->state_out_ch = 0; - BZ_INITIALISE_CRC ( s->calculatedBlockCRC ); - s->state = BZ_X_OUTPUT; - if (s->verbosity >= 2) VPrintf0 ( "rt+rld" ); - - /*-- Set up cftab to facilitate generation of T^(-1) --*/ - s->cftab[0] = 0; - for (i = 1; i <= 256; i++) s->cftab[i] = s->unzftab[i-1]; - for (i = 1; i <= 256; i++) s->cftab[i] += s->cftab[i-1]; - - if (s->smallDecompress) { - - /*-- Make a copy of cftab, used in generation of T --*/ - for (i = 0; i <= 256; i++) s->cftabCopy[i] = s->cftab[i]; - - /*-- compute the T vector --*/ - for (i = 0; i < nblock; i++) { - uc = (UChar)(s->ll16[i]); - SET_LL(i, s->cftabCopy[uc]); - s->cftabCopy[uc]++; - } - - /*-- Compute T^(-1) by pointer reversal on T --*/ - i = s->origPtr; - j = GET_LL(i); - do { - Int32 tmp = GET_LL(j); - SET_LL(j, i); - i = j; - j = tmp; - } - while (i != s->origPtr); - - s->tPos = s->origPtr; - s->nblock_used = 0; - if (s->blockRandomised) { - BZ_RAND_INIT_MASK; - BZ_GET_SMALL(s->k0); s->nblock_used++; - BZ_RAND_UPD_MASK; s->k0 ^= BZ_RAND_MASK; - } else { - BZ_GET_SMALL(s->k0); s->nblock_used++; - } - - } else { - - /*-- compute the T^(-1) vector --*/ - for (i = 0; i < nblock; i++) { - uc = (UChar)(s->tt[i] & 0xff); - s->tt[s->cftab[uc]] |= (i << 8); - s->cftab[uc]++; - } - - s->tPos = s->tt[s->origPtr] >> 8; - s->nblock_used = 0; - if (s->blockRandomised) { - BZ_RAND_INIT_MASK; - BZ_GET_FAST(s->k0); s->nblock_used++; - BZ_RAND_UPD_MASK; s->k0 ^= BZ_RAND_MASK; - } else { - BZ_GET_FAST(s->k0); s->nblock_used++; - } - - } - - RETURN(BZ_OK); - - - - endhdr_2: - - GET_UCHAR(BZ_X_ENDHDR_2, uc); - if (uc != 0x72) RETURN(BZ_DATA_ERROR); - GET_UCHAR(BZ_X_ENDHDR_3, uc); - if (uc != 0x45) RETURN(BZ_DATA_ERROR); - GET_UCHAR(BZ_X_ENDHDR_4, uc); - if (uc != 0x38) RETURN(BZ_DATA_ERROR); - GET_UCHAR(BZ_X_ENDHDR_5, uc); - if (uc != 0x50) RETURN(BZ_DATA_ERROR); - GET_UCHAR(BZ_X_ENDHDR_6, uc); - if (uc != 0x90) RETURN(BZ_DATA_ERROR); - - s->storedCombinedCRC = 0; - GET_UCHAR(BZ_X_CCRC_1, uc); - s->storedCombinedCRC = (s->storedCombinedCRC << 8) | ((UInt32)uc); - GET_UCHAR(BZ_X_CCRC_2, uc); - s->storedCombinedCRC = (s->storedCombinedCRC << 8) | ((UInt32)uc); - GET_UCHAR(BZ_X_CCRC_3, uc); - s->storedCombinedCRC = (s->storedCombinedCRC << 8) | ((UInt32)uc); - GET_UCHAR(BZ_X_CCRC_4, uc); - s->storedCombinedCRC = (s->storedCombinedCRC << 8) | ((UInt32)uc); - - s->state = BZ_X_IDLE; - RETURN(BZ_STREAM_END); - - default: AssertH ( False, 4001 ); - } - - AssertH ( False, 4002 ); - - save_state_and_return: - - s->save_i = i; - s->save_j = j; - s->save_t = t; - s->save_alphaSize = alphaSize; - s->save_nGroups = nGroups; - s->save_nSelectors = nSelectors; - s->save_EOB = EOB; - s->save_groupNo = groupNo; - s->save_groupPos = groupPos; - s->save_nextSym = nextSym; - s->save_nblockMAX = nblockMAX; - s->save_nblock = nblock; - s->save_es = es; - s->save_N = N; - s->save_curr = curr; - s->save_zt = zt; - s->save_zn = zn; - s->save_zvec = zvec; - s->save_zj = zj; - s->save_gSel = gSel; - s->save_gMinlen = gMinlen; - s->save_gLimit = gLimit; - s->save_gBase = gBase; - s->save_gPerm = gPerm; - - return retVal; -} - - -/*-------------------------------------------------------------*/ -/*--- end decompress.c ---*/ -/*-------------------------------------------------------------*/ diff --git a/mdk-stage1/bzlib/huffman.c b/mdk-stage1/bzlib/huffman.c deleted file mode 100644 index 8994f0bb9..000000000 --- a/mdk-stage1/bzlib/huffman.c +++ /dev/null @@ -1,232 +0,0 @@ - -/*-------------------------------------------------------------*/ -/*--- Huffman coding low-level stuff ---*/ -/*--- huffman.c ---*/ -/*-------------------------------------------------------------*/ - -/*-- - This file is a part of bzip2 and/or libbzip2, a program and - library for lossless, block-sorting data compression. - - Copyright (C) 1996-2000 Julian R Seward. All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 2. The origin of this software must not be misrepresented; you must - not claim that you wrote the original software. If you use this - software in a product, an acknowledgment in the product - documentation would be appreciated but is not required. - - 3. Altered source versions must be plainly marked as such, and must - not be misrepresented as being the original software. - - 4. The name of the author may not be used to endorse or promote - products derived from this software without specific prior written - permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - Julian Seward, Cambridge, UK. - jseward@acm.org - bzip2/libbzip2 version 1.0 of 21 March 2000 - - This program is based on (at least) the work of: - Mike Burrows - David Wheeler - Peter Fenwick - Alistair Moffat - Radford Neal - Ian H. Witten - Robert Sedgewick - Jon L. Bentley - - For more information on these sources, see the manual. ---*/ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - - -#include "bzlib_private.h" - -/*---------------------------------------------------*/ -#define WEIGHTOF(zz0) ((zz0) & 0xffffff00) -#define DEPTHOF(zz1) ((zz1) & 0x000000ff) -#define MYMAX(zz2,zz3) ((zz2) > (zz3) ? (zz2) : (zz3)) - -#define ADDWEIGHTS(zw1,zw2) \ - (WEIGHTOF(zw1)+WEIGHTOF(zw2)) | \ - (1 + MYMAX(DEPTHOF(zw1),DEPTHOF(zw2))) - -#define UPHEAP(z) \ -{ \ - Int32 zz, tmp; \ - zz = z; tmp = heap[zz]; \ - while (weight[tmp] < weight[heap[zz >> 1]]) { \ - heap[zz] = heap[zz >> 1]; \ - zz >>= 1; \ - } \ - heap[zz] = tmp; \ -} - -#define DOWNHEAP(z) \ -{ \ - Int32 zz, yy, tmp; \ - zz = z; tmp = heap[zz]; \ - while (True) { \ - yy = zz << 1; \ - if (yy > nHeap) break; \ - if (yy < nHeap && \ - weight[heap[yy+1]] < weight[heap[yy]]) \ - yy++; \ - if (weight[tmp] < weight[heap[yy]]) break; \ - heap[zz] = heap[yy]; \ - zz = yy; \ - } \ - heap[zz] = tmp; \ -} - - -/*---------------------------------------------------*/ -void BZ2_hbMakeCodeLengths ( UChar *len, - Int32 *freq, - Int32 alphaSize, - Int32 maxLen ) -{ - /*-- - Nodes and heap entries run from 1. Entry 0 - for both the heap and nodes is a sentinel. - --*/ - Int32 nNodes, nHeap, n1, n2, i, j, k; - Bool tooLong; - - Int32 heap [ BZ_MAX_ALPHA_SIZE + 2 ]; - Int32 weight [ BZ_MAX_ALPHA_SIZE * 2 ]; - Int32 parent [ BZ_MAX_ALPHA_SIZE * 2 ]; - - for (i = 0; i < alphaSize; i++) - weight[i+1] = (freq[i] == 0 ? 1 : freq[i]) << 8; - - while (True) { - - nNodes = alphaSize; - nHeap = 0; - - heap[0] = 0; - weight[0] = 0; - parent[0] = -2; - - for (i = 1; i <= alphaSize; i++) { - parent[i] = -1; - nHeap++; - heap[nHeap] = i; - UPHEAP(nHeap); - } - - AssertH( nHeap < (BZ_MAX_ALPHA_SIZE+2), 2001 ); - - while (nHeap > 1) { - n1 = heap[1]; heap[1] = heap[nHeap]; nHeap--; DOWNHEAP(1); - n2 = heap[1]; heap[1] = heap[nHeap]; nHeap--; DOWNHEAP(1); - nNodes++; - parent[n1] = parent[n2] = nNodes; - weight[nNodes] = ADDWEIGHTS(weight[n1], weight[n2]); - parent[nNodes] = -1; - nHeap++; - heap[nHeap] = nNodes; - UPHEAP(nHeap); - } - - AssertH( nNodes < (BZ_MAX_ALPHA_SIZE * 2), 2002 ); - - tooLong = False; - for (i = 1; i <= alphaSize; i++) { - j = 0; - k = i; - while (parent[k] >= 0) { k = parent[k]; j++; } - len[i-1] = j; - if (j > maxLen) tooLong = True; - } - - if (! tooLong) break; - - for (i = 1; i < alphaSize; i++) { - j = weight[i] >> 8; - j = 1 + (j / 2); - weight[i] = j << 8; - } - } -} - - -/*---------------------------------------------------*/ -void BZ2_hbAssignCodes ( Int32 *code, - UChar *length, - Int32 minLen, - Int32 maxLen, - Int32 alphaSize ) -{ - Int32 n, vec, i; - - vec = 0; - for (n = minLen; n <= maxLen; n++) { - for (i = 0; i < alphaSize; i++) - if (length[i] == n) { code[i] = vec; vec++; }; - vec <<= 1; - } -} - - -/*---------------------------------------------------*/ -void BZ2_hbCreateDecodeTables ( Int32 *limit, - Int32 *base, - Int32 *perm, - UChar *length, - Int32 minLen, - Int32 maxLen, - Int32 alphaSize ) -{ - Int32 pp, i, j, vec; - - pp = 0; - for (i = minLen; i <= maxLen; i++) - for (j = 0; j < alphaSize; j++) - if (length[j] == i) { perm[pp] = j; pp++; }; - - for (i = 0; i < BZ_MAX_CODE_LEN; i++) base[i] = 0; - for (i = 0; i < alphaSize; i++) base[length[i]+1]++; - - for (i = 1; i < BZ_MAX_CODE_LEN; i++) base[i] += base[i-1]; - - for (i = 0; i < BZ_MAX_CODE_LEN; i++) limit[i] = 0; - vec = 0; - - for (i = minLen; i <= maxLen; i++) { - vec += (base[i+1] - base[i]); - limit[i] = vec-1; - vec <<= 1; - } - for (i = minLen + 1; i <= maxLen; i++) - base[i] = ((limit[i-1] + 1) << 1) - base[i]; -} - - -/*-------------------------------------------------------------*/ -/*--- end huffman.c ---*/ -/*-------------------------------------------------------------*/ diff --git a/mdk-stage1/bzlib/randtable.c b/mdk-stage1/bzlib/randtable.c deleted file mode 100644 index a1fc82cfb..000000000 --- a/mdk-stage1/bzlib/randtable.c +++ /dev/null @@ -1,128 +0,0 @@ - -/*-------------------------------------------------------------*/ -/*--- Table for randomising repetitive blocks ---*/ -/*--- randtable.c ---*/ -/*-------------------------------------------------------------*/ - -/*-- - This file is a part of bzip2 and/or libbzip2, a program and - library for lossless, block-sorting data compression. - - Copyright (C) 1996-2000 Julian R Seward. All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 2. The origin of this software must not be misrepresented; you must - not claim that you wrote the original software. If you use this - software in a product, an acknowledgment in the product - documentation would be appreciated but is not required. - - 3. Altered source versions must be plainly marked as such, and must - not be misrepresented as being the original software. - - 4. The name of the author may not be used to endorse or promote - products derived from this software without specific prior written - permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - Julian Seward, Cambridge, UK. - jseward@acm.org - bzip2/libbzip2 version 1.0 of 21 March 2000 - - This program is based on (at least) the work of: - Mike Burrows - David Wheeler - Peter Fenwick - Alistair Moffat - Radford Neal - Ian H. Witten - Robert Sedgewick - Jon L. Bentley - - For more information on these sources, see the manual. ---*/ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - - -#include "bzlib_private.h" - - -/*---------------------------------------------*/ -Int32 BZ2_rNums[512] = { - 619, 720, 127, 481, 931, 816, 813, 233, 566, 247, - 985, 724, 205, 454, 863, 491, 741, 242, 949, 214, - 733, 859, 335, 708, 621, 574, 73, 654, 730, 472, - 419, 436, 278, 496, 867, 210, 399, 680, 480, 51, - 878, 465, 811, 169, 869, 675, 611, 697, 867, 561, - 862, 687, 507, 283, 482, 129, 807, 591, 733, 623, - 150, 238, 59, 379, 684, 877, 625, 169, 643, 105, - 170, 607, 520, 932, 727, 476, 693, 425, 174, 647, - 73, 122, 335, 530, 442, 853, 695, 249, 445, 515, - 909, 545, 703, 919, 874, 474, 882, 500, 594, 612, - 641, 801, 220, 162, 819, 984, 589, 513, 495, 799, - 161, 604, 958, 533, 221, 400, 386, 867, 600, 782, - 382, 596, 414, 171, 516, 375, 682, 485, 911, 276, - 98, 553, 163, 354, 666, 933, 424, 341, 533, 870, - 227, 730, 475, 186, 263, 647, 537, 686, 600, 224, - 469, 68, 770, 919, 190, 373, 294, 822, 808, 206, - 184, 943, 795, 384, 383, 461, 404, 758, 839, 887, - 715, 67, 618, 276, 204, 918, 873, 777, 604, 560, - 951, 160, 578, 722, 79, 804, 96, 409, 713, 940, - 652, 934, 970, 447, 318, 353, 859, 672, 112, 785, - 645, 863, 803, 350, 139, 93, 354, 99, 820, 908, - 609, 772, 154, 274, 580, 184, 79, 626, 630, 742, - 653, 282, 762, 623, 680, 81, 927, 626, 789, 125, - 411, 521, 938, 300, 821, 78, 343, 175, 128, 250, - 170, 774, 972, 275, 999, 639, 495, 78, 352, 126, - 857, 956, 358, 619, 580, 124, 737, 594, 701, 612, - 669, 112, 134, 694, 363, 992, 809, 743, 168, 974, - 944, 375, 748, 52, 600, 747, 642, 182, 862, 81, - 344, 805, 988, 739, 511, 655, 814, 334, 249, 515, - 897, 955, 664, 981, 649, 113, 974, 459, 893, 228, - 433, 837, 553, 268, 926, 240, 102, 654, 459, 51, - 686, 754, 806, 760, 493, 403, 415, 394, 687, 700, - 946, 670, 656, 610, 738, 392, 760, 799, 887, 653, - 978, 321, 576, 617, 626, 502, 894, 679, 243, 440, - 680, 879, 194, 572, 640, 724, 926, 56, 204, 700, - 707, 151, 457, 449, 797, 195, 791, 558, 945, 679, - 297, 59, 87, 824, 713, 663, 412, 693, 342, 606, - 134, 108, 571, 364, 631, 212, 174, 643, 304, 329, - 343, 97, 430, 751, 497, 314, 983, 374, 822, 928, - 140, 206, 73, 263, 980, 736, 876, 478, 430, 305, - 170, 514, 364, 692, 829, 82, 855, 953, 676, 246, - 369, 970, 294, 750, 807, 827, 150, 790, 288, 923, - 804, 378, 215, 828, 592, 281, 565, 555, 710, 82, - 896, 831, 547, 261, 524, 462, 293, 465, 502, 56, - 661, 821, 976, 991, 658, 869, 905, 758, 745, 193, - 768, 550, 608, 933, 378, 286, 215, 979, 792, 961, - 61, 688, 793, 644, 986, 403, 106, 366, 905, 644, - 372, 567, 466, 434, 645, 210, 389, 550, 919, 135, - 780, 773, 635, 389, 707, 100, 626, 958, 165, 504, - 920, 176, 193, 713, 857, 265, 203, 50, 668, 108, - 645, 990, 626, 197, 510, 357, 358, 850, 858, 364, - 936, 638 -}; - - -/*-------------------------------------------------------------*/ -/*--- end randtable.c ---*/ -/*-------------------------------------------------------------*/ diff --git a/mdk-stage1/cdrom.c b/mdk-stage1/cdrom.c deleted file mode 100644 index d99877b7f..000000000 --- a/mdk-stage1/cdrom.c +++ /dev/null @@ -1,181 +0,0 @@ -/* - * Guillaume Cottenceau (gc@mandrakesoft.com) - * - * Copyright 2000 MandrakeSoft - * - * This software may be freely redistributed under the terms of the GNU - * public license. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -/* - * Portions from Erik Troan (ewt@redhat.com) - * - * Copyright 1996 Red Hat Software - * - */ - -#include <stdlib.h> -#include <unistd.h> -#include <string.h> -#include <stdio.h> -#include <sys/mount.h> -#include "stage1.h" -#include "frontend.h" -#include "modules.h" -#include "probing.h" -#include "log.h" -#include "mount.h" - -#include "cdrom.h" - - -static int mount_that_cd_device(char * dev_name) -{ - char device_fullname[50]; - - strcpy(device_fullname, "/dev/"); - strcat(device_fullname, dev_name); - - return my_mount(device_fullname, IMAGE_LOCATION, "iso9660"); -} - - -static int test_that_cd() -{ - return access(IMAGE_LOCATION LIVE_LOCATION, R_OK); -} - - -static enum return_type try_with_device(char * dev_name, char * dev_model); - -static enum return_type do_with_device(char * dev_name, char * dev_model) -{ - if (test_that_cd()) { - enum return_type results; - umount(IMAGE_LOCATION); - results = ask_yes_no("That CDROM disc does not seem to be a " DISTRIB_NAME " Installation CDROM.\nRetry with another disc?"); - if (results == RETURN_OK) - return try_with_device(dev_name, dev_model); - return results; - } - - log_message("found a " DISTRIB_NAME " CDROM, good news!"); - - if (IS_SPECIAL_STAGE2 || ramdisk_possible()) - load_ramdisk(); /* we don't care about return code, we'll do it live if we failed */ - - if (IS_RESCUE) - umount(IMAGE_LOCATION); - - method_name = strdup("cdrom"); - return RETURN_OK; -} - -static enum return_type try_with_device(char * dev_name, char * dev_model) -{ - wait_message("Trying to access a CDROM disc (drive %s)", dev_model); - - if (mount_that_cd_device(dev_name) == -1) { - enum return_type results; - char msg[500]; - unset_param(MODE_AUTOMATIC); /* we are in a fallback mode */ - remove_wait_message(); - - snprintf(msg, sizeof(msg), "I can't access a " DISTRIB_NAME " Installation disc in your CDROM drive (%s).\nRetry?", dev_model); - results = ask_yes_no(msg); - if (results == RETURN_OK) - return try_with_device(dev_name, dev_model); - return results; - } - remove_wait_message(); - - return do_with_device(dev_name, dev_model); -} - -enum return_type cdrom_prepare(void) -{ - char ** medias, ** ptr, ** medias_models; - char * choice; - int i, count = 0; - enum return_type results; - - my_insmod("ide-cd", ANY_DRIVER_TYPE, NULL); - my_insmod("sr_mod", ANY_DRIVER_TYPE, NULL); - - get_medias(CDROM, &medias, &medias_models); - - ptr = medias; - while (ptr && *ptr) { - count++; - ptr++; - } - - if (count == 0) { - stg1_error_message("No CDROM device found."); - i = ask_insmod(SCSI_ADAPTERS); - if (i == RETURN_BACK) - return RETURN_BACK; - return cdrom_prepare(); - } - - if (count == 1) { - results = try_with_device(*medias, *medias_models); - if (results == RETURN_OK) - return RETURN_OK; - i = ask_insmod(SCSI_ADAPTERS); - if (i == RETURN_BACK) - return RETURN_BACK; - return cdrom_prepare(); - } - - if (IS_AUTOMATIC) { - char ** model = medias_models; - ptr = medias; - while (ptr && *ptr) { - wait_message("Trying to access " DISTRIB_NAME " CDROM disc (drive %s)", *model); - if (mount_that_cd_device(*ptr) != -1) { - if (!test_that_cd()) { - remove_wait_message(); - return do_with_device(*ptr, *model); - } - else - umount(IMAGE_LOCATION); - } - remove_wait_message(); - ptr++; - model++; - } - unset_param(MODE_AUTOMATIC); - return cdrom_prepare(); - } - else { - results = ask_from_list_comments("Please choose the CDROM drive to use for the installation.", medias, medias_models, &choice); - if (results == RETURN_OK) { - char ** model = medias_models; - ptr = medias; - while (ptr && *ptr && model && *model) { - if (!strcmp(*ptr, choice)) - break; - ptr++; - model++; - } - results = try_with_device(choice, *model); - } else - return results; - } - - if (results == RETURN_OK) - return RETURN_OK; - if (results == RETURN_BACK) - return cdrom_prepare(); - - i = ask_insmod(SCSI_ADAPTERS); - if (i == RETURN_BACK) - return RETURN_BACK; - return cdrom_prepare(); -} diff --git a/mdk-stage1/cdrom.h b/mdk-stage1/cdrom.h deleted file mode 100644 index 639487eed..000000000 --- a/mdk-stage1/cdrom.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Guillaume Cottenceau (gc@mandrakesoft.com) - * - * Copyright 2000 MandrakeSoft - * - * This software may be freely redistributed under the terms of the GNU - * public license. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -/* - * Portions from Erik Troan (ewt@redhat.com) - * - * Copyright 1996 Red Hat Software - * - */ - -#ifndef _CDROM_H_ -#define _CDROM_H_ - -#include "stage1.h" - -enum return_type cdrom_prepare(void); - -#endif diff --git a/mdk-stage1/config-stage1.h b/mdk-stage1/config-stage1.h deleted file mode 100644 index 3af38a446..000000000 --- a/mdk-stage1/config-stage1.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Guillaume Cottenceau (gc@mandrakesoft.com) - * - * Copyright 2000 MandrakeSoft - * - * This software may be freely redistributed under the terms of the GNU - * public license. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#ifndef _CONFIG_STAGE1_H_ -#define _CONFIG_STAGE1_H_ - -#define _GNU_SOURCE 1 - - -/* If we have more than that amount of memory (in Mbytes), we assume we can load the second stage as a ramdisk */ -#define MEM_LIMIT_RAMDISK 52 - -/* If we have more than that amount of memory (in Mbytes), we assume we can load the rescue as a ramdisk */ -#define MEM_LIMIT_RESCUE 40 - -#define DISTRIB_NAME "Mandrake Linux" - -#define RAMDISK_COMPRESSION_RATIO 1.95 - -#define LIVE_LOCATION "/Mandrake/mdkinst/" -#define RAMDISK_LOCATION "/Mandrake/base/" -#define IMAGE_LOCATION "/tmp/image" -#define STAGE2_LOCATION "/tmp/stage2" - -/* user-definable (in Makefile): DISABLE_NETWORK, DISABLE_DISK, DISABLE_CDROM, DISABLE_PCMCIA */ - - -/* some factorizing for disabling more features */ - -#ifdef DISABLE_DISK -#ifdef DISABLE_CDROM -#define DISABLE_MEDIAS -#endif -#endif - - -#endif diff --git a/mdk-stage1/dhcp.c b/mdk-stage1/dhcp.c deleted file mode 100644 index 44877fd8a..000000000 --- a/mdk-stage1/dhcp.c +++ /dev/null @@ -1,614 +0,0 @@ -/* - * Guillaume Cottenceau (gc@mandrakesoft.com) - * - * Copyright 2000 MandrakeSoft - * - * This software may be freely redistributed under the terms of the GNU - * public license. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -/* - * Portions from Erik Troan (ewt@redhat.com) - * - * Copyright 1996 Red Hat Software - * - */ - -/* - * Portions from GRUB -- GRand Unified Bootloader - * Copyright (C) 2000 Free Software Foundation, Inc. - */ - - -#include <stdlib.h> -#include <unistd.h> -#include <string.h> -#include <sys/socket.h> -#include <sys/ioctl.h> -#include <net/if.h> -#include <arpa/inet.h> -#include <net/route.h> -#include <errno.h> -#include <net/ethernet.h> -#include <netinet/ip.h> -#include <netinet/udp.h> -#include <sys/time.h> -#include <time.h> -#include <fcntl.h> -#include <sys/poll.h> - -#include "stage1.h" -#include "log.h" -#include "network.h" -#include "frontend.h" - -#include "dhcp.h" - - -typedef int bp_int32; -typedef short bp_int16; - -#define BOOTP_OPTION_NETMASK 1 -#define BOOTP_OPTION_GATEWAY 3 -#define BOOTP_OPTION_DNS 6 -#define BOOTP_OPTION_HOSTNAME 12 -#define BOOTP_OPTION_DOMAIN 15 -#define BOOTP_OPTION_BROADCAST 28 - -#define DHCP_OPTION_REQADDR 50 -#define DHCP_OPTION_LEASE 51 -#define DHCP_OPTION_TYPE 53 -#define DHCP_OPTION_SERVER 54 -#define DHCP_OPTION_OPTIONREQ 55 -#define DHCP_OPTION_MAXSIZE 57 - -#define BOOTP_CLIENT_PORT 68 -#define BOOTP_SERVER_PORT 67 - -#define BOOTP_OPCODE_REQUEST 1 -#define BOOTP_OPCODE_REPLY 2 - -#define DHCP_TYPE_DISCOVER 1 -#define DHCP_TYPE_OFFER 2 -#define DHCP_TYPE_REQUEST 3 -#define DHCP_TYPE_ACK 5 -#define DHCP_TYPE_RELEASE 7 - -#define BOOTP_VENDOR_LENGTH 64 |