From 534642029e27683bf4c44550f730bff3f91cd80b Mon Sep 17 00:00:00 2001 From: Konrad Rzeszutek Wilk Date: Tue, 7 Sep 2010 13:30:46 -0400 Subject: [PATCH 1/1] Initial commit. --- .gitignore | 14 + COPYING | 340 +++++++ Makefile | 347 +++++++ bin/mkdiskimage | 272 ++++++ boot/isolinux/isolinux.cfg | 16 + boot/pxelinux.cfg/default | 22 + boot/pxelinux.cfg/menu.txt | 1 + early-devs | 11 + linux.config | 661 +++++++++++++ linux_cfg.pl | 109 +++ root_image/Makefile | 885 ++++++++++++++++++ root_image/busybox.config | 864 +++++++++++++++++ root_image/drivers/Makefile | 12 + root_image/drivers/dump/Makefile | 38 + root_image/drivers/dump/dump_dma.c | 68 ++ root_image/etc/fstab | 3 + root_image/etc/group | 25 + root_image/etc/host.conf | 2 + root_image/etc/hosts | 2 + root_image/etc/init.d/core_filesystems | 56 ++ root_image/etc/init.d/functions | 583 ++++++++++++ root_image/etc/init.d/halt | 180 ++++ root_image/etc/init.d/network | 301 ++++++ root_image/etc/init.d/primary_fb | 48 + root_image/etc/init.d/primary_network | 32 + root_image/etc/init.d/rcS | 70 ++ root_image/etc/inittab | 6 + root_image/etc/nsswitch.conf | 63 ++ root_image/etc/passwd | 5 + root_image/etc/rc.d/init.d | 1 + root_image/ldd-check.pl | 294 ++++++ root_image/tools/Makefile | 23 + root_image/tools/debug/Makefile | 25 + root_image/tools/debug/fb_test.c | 68 ++ root_image/tools/debug/fbtools.c | 541 +++++++++++ root_image/tools/debug/fbtools.h | 23 + root_image/tools/iostat-2.2/INSTALL | 4 + root_image/tools/iostat-2.2/LICENSE | 340 +++++++ root_image/tools/iostat-2.2/Makefile | 22 + root_image/tools/iostat-2.2/README | 8 + root_image/tools/iostat-2.2/iostat.8 | 155 +++ root_image/tools/iostat-2.2/iostat.c | 563 +++++++++++ root_image/tools/load_xen_modules/Makefile | 25 + .../tools/load_xen_modules/load_xen_modules | 11 + .../tools/load_xen_modules/xen-detect.c | 159 ++++ root_image/tools/ssh_support/Makefile | 17 + root_image/tools/ssh_support/shadowgen.c | 262 ++++++ root_image/tools/ssh_support/sshd_server | 268 ++++++ scm.mk | 27 + sources.mk | 26 + 50 files changed, 7898 insertions(+) create mode 100644 .gitignore create mode 100644 COPYING create mode 100644 Makefile create mode 100755 bin/mkdiskimage create mode 100755 boot/isolinux/isolinux.cfg create mode 100644 boot/pxelinux.cfg/default create mode 100644 boot/pxelinux.cfg/menu.txt create mode 100644 early-devs create mode 100644 linux.config create mode 100755 linux_cfg.pl create mode 100644 root_image/Makefile create mode 100644 root_image/busybox.config create mode 100644 root_image/drivers/Makefile create mode 100644 root_image/drivers/dump/Makefile create mode 100644 root_image/drivers/dump/dump_dma.c create mode 100644 root_image/etc/fstab create mode 100644 root_image/etc/group create mode 100644 root_image/etc/host.conf create mode 100644 root_image/etc/hosts create mode 100755 root_image/etc/init.d/core_filesystems create mode 100644 root_image/etc/init.d/functions create mode 100755 root_image/etc/init.d/halt create mode 100755 root_image/etc/init.d/network create mode 100755 root_image/etc/init.d/primary_fb create mode 100755 root_image/etc/init.d/primary_network create mode 100755 root_image/etc/init.d/rcS create mode 100644 root_image/etc/inittab create mode 100644 root_image/etc/nsswitch.conf create mode 100644 root_image/etc/passwd create mode 120000 root_image/etc/rc.d/init.d create mode 100755 root_image/ldd-check.pl create mode 100644 root_image/tools/Makefile create mode 100644 root_image/tools/debug/Makefile create mode 100644 root_image/tools/debug/fb_test.c create mode 100644 root_image/tools/debug/fbtools.c create mode 100644 root_image/tools/debug/fbtools.h create mode 100644 root_image/tools/iostat-2.2/INSTALL create mode 100644 root_image/tools/iostat-2.2/LICENSE create mode 100644 root_image/tools/iostat-2.2/Makefile create mode 100644 root_image/tools/iostat-2.2/README create mode 100644 root_image/tools/iostat-2.2/iostat.8 create mode 100644 root_image/tools/iostat-2.2/iostat.c create mode 100644 root_image/tools/load_xen_modules/Makefile create mode 100755 root_image/tools/load_xen_modules/load_xen_modules create mode 100644 root_image/tools/load_xen_modules/xen-detect.c create mode 100644 root_image/tools/ssh_support/Makefile create mode 100644 root_image/tools/ssh_support/shadowgen.c create mode 100755 root_image/tools/ssh_support/sshd_server create mode 100644 scm.mk create mode 100644 sources.mk diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0e89632 --- /dev/null +++ b/.gitignore @@ -0,0 +1,14 @@ +linux +syslinux +linux-build +dist +xen +root_image/modulespace +root_image/userspace +root_image/debugspace +root_image/RPMs +root_image/busybox +root_image/drivers/.tmp_versions/ +root_image/netperf +root_image/tools/ssh_support/ssh-shadowgen +root_image/pciutils diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..08ddefd --- /dev/null +++ b/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. + diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..50db66a --- /dev/null +++ b/Makefile @@ -0,0 +1,347 @@ +# +# +# Copyright (c) 2003-2009, Virtual Iron Software, Inc. +# +# Portions have been modified by Virtual Iron Software, Inc. +# (c) 2009. This file and the modifications can be redistributed and/or +# modified under the terms and conditions of the GNU General Public +# License, version 2.1 and not any later version of the GPL, as published +# by the Free Software Foundation. +# +# Copyright (c) 2009, Konrad Rzeszutek Wilk +# +# Portions have been modified by Konrad Rzeszutek Wilk +# (c) 2009. This file and the modifications can be redistributed and/or +# modified under the terms and conditions of the GNU General Public +# License, version 2.1 and not any later version of the GPL, as published +# by the Free Software Foundation. +# +# +##################################################################### +# Not Exactly Backup +##################################################################### + + +.PHONY: default +default: dist + +.PHONY: help +help: + @echo 'Main build targets:' + @echo ' dist - build and install everything into dist/' + @echo ' distrib - dist + set up tftp areas specified by DISTSYSTEMS' + @echo '' + @echo 'Cleaning targets:' + @echo ' clean - remove compiled files' + @echo ' distclean - remove all generated files' + @echo '' +COMPONENTS = root_image linux syslinux + + +include sources.mk + +##################################################################### +# exported variables +##################################################################### + +# We only build the 32-bit version +# + +ifeq ($(shell uname -m), i686) +ARCH = i386 +else +ARCH = $(shell uname -m) +endif + +LIBSDIR = lib + +export ARCH LIBSDIR + +# Define the install commands that we'll need +# for those with poor octal/mnemonic memories (like me): +# 644 - u=rw g=r o=r +# 755 - u=rwx g=rx o=rx + +INSTALL = install -p +INSTALL_DIR = $(INSTALL) -m0755 -d +INSTALL_DATA = $(INSTALL) -m0644 +INSTALL_SCRIPT = $(INSTALL) -m0755 +INSTALL_PROG = $(INSTALL) -m0755 -s +export INSTALL INSTALL_DIR INSTALL_DATA INSTALL_SCRIPT INSTALL_PROG + +##################################################################### +# generic rules +##################################################################### + +##################################################################### +# linux rules +##################################################################### + +LINUX_SRC = $(PWD)/linux +LINUX_DST = $(PWD)/linux-build + +linux-DISTRIB_TARGET=dist/common/vmlinuz + +NCPUS := $(shell grep processor /proc/cpuinfo | wc -l) + +.PHONY: linux-dist-nodep +linux-dist-nodep: linux-config + $(MAKE) -j$$(($(NCPUS) * 2)) -C $(LINUX_SRC) O=$(LINUX_DST) bzImage + $(INSTALL_DIR) dist/common/ + $(INSTALL_DATA) $(LINUX_DST)/arch/$(ARCH)/boot/bzImage dist/common/vmlinuz + +.PHONY: linux-dist +linux-dist: linux-dist-nodep + +$(LINUX_DST)/usr/gen_init_cpio: + $(MAKE) -C $(LINUX_SRC) O=$(LINUX_DST) usr + +.PHONY: linux-config +linux-config: + $(MAKE) $(LINUX_DST)/.config + +DEF_CONFIG = $(LINUX_SRC)/arch/x86/configs/$(ARCH)_defconfig + +$(LINUX_DST)/.config: linux.config + mkdir -p $(LINUX_DST); + ./linux_cfg.pl $(DEF_CONFIG) linux.config >$@ + cp -f early-devs $(LINUX_DST) + $(MAKE) -C $(LINUX_SRC) O=$(LINUX_DST) oldconfig + +.PHONY: linux-modules +linux-modules: linux-config + @mkdir -p $(LINUX_DST)/modulespace + $(MAKE) -j$$(($(NCPUS) * 2)) -C $(LINUX_SRC) O=$(LINUX_DST) modules + $(MAKE) -j$$(($(NCPUS) * 2)) -C $(LINUX_SRC) O=$(LINUX_DST) \ + INSTALL_MOD_PATH=$(LINUX_DST)/modulespace modules_install + +.PHONY: linux-firmware +linux-firmware: linux-config + @mkdir -p $(LINUX_DST)/firmwarespace + $(MAKE) -j$$(($(NCPUS) * 2)) -C $(LINUX_SRC) O=$(LINUX_DST) \ + INSTALL_FW_PATH=$(LINUX_DST)/firmwarespace firmware_install + +.PHONY: linux-clean +linux-clean: + if [ -e linux ]; then \ + rm -rf $(LINUX_DST) \ + ;fi + +linux-distclean: linux-clean + if [ -e linux ]; then \ + $(MAKE) -C $(LINUX_SRC) mrproper \ + ;fi + +##################################################################### +# xen rules +##################################################################### + +XEN_DISTDIR = xen/dist/install + +XEN_EXTRAVERSION := $(shell date +-%y%m%d)$(xen_TAG) + +xen-DISTRIB_TARGET = dist/common/xen.gz + +.PHONY: xen-dist-nodep +xen-dist-nodep: + $(MAKE) debug=y XEN_EXTRAVERSION=$(XEN_EXTRAVERSION) -C xen xen -j$$(($(NCPUS) * 2)) + $(INSTALL_DIR) dist/common/ + $(INSTALL_DATA) $(XEN_DISTDIR)/boot/xen.gz dist/common/ + + +IOEMU_DIR = ioemu-remote + +.PHONY: xen-tools +xen-tools: + $(MAKE) -C xen IOEMU_CONFIGURE_CROSS="--disable-opengl --disable-sdl --disable-kvm" tools -j$$(($(NCPUS) * 2)) + +.PHONY: xen-dist +xen-dist: xen-dist-nodep xen-tools + +.PHONY: xen-clean +xen-clean: + if [ -e xen ]; then \ + $(MAKE) -C xen clean; \ + fi + +xen-distclean: xen-clean + if [ -e xen ]; then \ + $(MAKE) -C xen distclean; \ + fi \ +k +##################################################################### +# root_image rules +##################################################################### + +root_image-DISTRIB_TARGET = dist/common/initramfs.cpio.gz +DOM0_DEP_LIST = linux-modules + + +.PHONY: root_image-dist-nodep +root_image-dist-nodep: $(LINUX_SRC)/usr/gen_init_cpio + $(MAKE) -C root_image + $(INSTALL_DIR) dist/common/ + $(INSTALL_DATA) root_image/dist/common/initramfs.cpio.gz dist/common/ + +.PHONY: root_image-dist +root_image-dist: $(DOM0_DEP_LIST) + $(MAKE) root_image-dist-nodep + +.PHONY: root_image-clean +root_image-clean: + if [ -e root_image ];then \ + $(MAKE) -C root_image clean \ + ;fi + +root_image-distclean: root_image-clean + if [ -e root_image ];then \ + $(MAKE) -C root_image distclean \ + ;fi + + + +##################################################################### +# syslinux rules +##################################################################### + + +.PHONY: syslinux-distclean +syslinux-distclean: syslinux-clean + +.PHONY: syslinux-clean +syslinux-clean: + if [ -e syslinux ]; then \ + $(MAKE) -C syslinux clean \ + ;fi + +.PHONY: syslinux +syslinux: + $(MAKE) -j$$(($(NCPUS) * 2)) -C syslinux + +##################################################################### +# packaging, distribution, etc. rules +##################################################################### + +# Prefix 1, 2 and 3 digit system names by tst00, tst0, and tst, respectively. +DISTRIB_SYS=$(shell echo $(DISTSYSTEMS) | sed -e 's/^/,/' -e 's/$$/,/' -e 's/,\([0-9]\)\([0-9]\)\([0-9]\),/,tst\1\2\3,/g' -e 's/,\([0-9]\)\([0-9]\),/,tst0\1\2,/g' -e 's/,\([0-9]\),/,tst00\1,/g' -e 's/,/ /g') +DISTRIB_DIRS=$(foreach DS,$(DISTRIB_SYS),$(TFTPDIR)/$(DS)) + +TFTPDIR = /mnt/lab + +.PHONY: dist +dist: xtt-pxe xtt-iso xtt-fat + +.PHONY: distrib +.PHONY: distrib-file +ifeq ($(DISTSYSTEMS),) +distrib distrib-file: + $(error "distrib targets requires DISTSYSTEMS be set") +else +distrib: dist + for dir in $(DISTRIB_DIRS); do tar -C $$dir -xf dist/root_image-pxe.tar; done; sync + +distrib-file: + for dir in $(DISTRIB_DIRS); do cp $(DISTRIB_TARGET) $$dir/; done; sync +endif + +.PHONY: %-distrib +%-distrib: %-dist + $(MAKE) distrib-file DISTRIB_TARGET=$($*-DISTRIB_TARGET) + +.PHONY: %-distrib-nodep +%-distrib-nodep: %-dist-nodep + $(MAKE) distrib-file DISTRIB_TARGET=$($*-DISTRIB_TARGET) + +NEB_TARGETS = linux-dist xen-dist root_image-dist + +.PHONY: xtt-common +xtt-common: $(NEB_TARGETS) + $(INSTALL_DATA) syslinux/com32/modules/*.c32 dist/common/ + $(INSTALL_DATA) syslinux/com32/menu/*.c32 dist/common/ + +.PHONY: xtt-iso +xtt-iso: xtt-common + $(INSTALL_DIR) dist/iso/isolinux/ + $(INSTALL_DATA) dist/common/* dist/iso/isolinux/ + rm -f dist/iso/isolinux/{modules,userspace}.cpio.gz + $(INSTALL_DATA) boot/isolinux/isolinux.cfg dist/iso/isolinux/ + $(INSTALL_DATA) syslinux/core/isolinux.bin dist/iso/isolinux/ + mkisofs -boot-info-table -no-emul-boot \ + -b isolinux/isolinux.bin \ + -c isolinux/boot.cat -boot-load-size 4 \ + -o dist/root_image.iso dist/iso + +.PHONY: xtt-fat +xtt-fat: xtt-common + $(INSTALL_DIR) dist/fat/ + rm -f dist/fat/{modules,userspace}.cpio.gz + $(INSTALL_DATA) dist/common/* dist/fat/ + $(INSTALL_DATA) boot/syslinux/syslinux.cfg dist/fat/ + mv dist/fat/initramfs.cpio.gz dist/fat/initrmfs.cgz + tar -C dist/fat -cf dist/root_image-fat.tar . + +# Note: jffs2 (or is it block2mtd) doesn't work right when erase blocks +# (always specified in KiB units) span cylinders. This means +# USB_HEADS * USB_SECTORS * 512 (bytes/sector) must be a multiple +# of the erase block size (typically 128KiB). +# +USB_HEADS=128 +USB_SECTORS=62 +USB_MB=64 + +VFAT_IMAGE=dist/root_image-fat.img +MTOOLSRC=dist/mtoolsrc + +$(MTOOLSRC): + echo 'drive z:' >$(MTOOLSRC) + echo 'file="$(VFAT_IMAGE)" partition=1' >>$(MTOOLSRC) + +.PHONY: xtt-fat-image +xtt-fat-image: xtt-fat + $(MAKE) xtt-fat-image-nodeps + +.PHONY: xtt-fat-image-nodeps +xtt-fat-image-nodeps: $(MTOOLSRC) + @if ! mtype /dev/null 2>/dev/null; then \ + echo ""; \ + echo "mtools package not found in \$$PATH: $$PATH"; \ + echo ""; \ + exit 1; \ + fi + offset=`bin/mkdiskimage -Mo $(VFAT_IMAGE) $(USB_MB) $(USB_HEADS) $(USB_SECTORS)`; \ + syslinux -o $$offset $(VFAT_IMAGE) + MTOOLSRC=$(MTOOLSRC) mcopy -v -p dist/fat/* z: + +.PHONY: xtt-pxe +xtt-pxe: xtt-common + $(INSTALL_DIR) dist/pxe/ + $(INSTALL_DATA) dist/common/* dist/pxe/ + rm -f dist/pxe/{modules,userspace}.cpio.gz + $(INSTALL_DATA) syslinux/core/pxelinux.0 dist/pxe/ + $(INSTALL_DATA) syslinux/core/pxelinux.0 dist/pxe/pxeboot + $(INSTALL_DIR) dist/pxe/pxelinux.cfg + if [ -e boot/pxelinux.cfg/default-OVERRIDE ]; then \ + $(INSTALL_DATA) boot/pxelinux.cfg/default-OVERRIDE dist/pxe/pxelinux.cfg/default \ + ; else \ + $(INSTALL_DATA) boot/pxelinux.cfg/default dist/pxe/pxelinux.cfg/default \ + ; fi +# Link modules.cpio.gz -> initramfs.cpio.gz (keep old PXE cfgs working) +# cd dist/pxe; ln -s initramfs.cpio.gz modules.cpio.gz + tar -C dist/pxe -cf dist/root_image-pxe.tar . + +.PHONY: linux-clean-extras +linux-clean-extras: + rm -f $(LINUX_SRC)/.config + +.PHONY: clean +clean: $(COMPONENTS:%=%-clean) linux-clean-extras + +%-clean: % + $(MAKE) -C $? clean + +.PHONY: distclean +distclean: $(COMPONENTS:%=%-distclean) + rm -fr dist + +%-distclean: % + $(MAKE) -C $? distclean diff --git a/bin/mkdiskimage b/bin/mkdiskimage new file mode 100755 index 0000000..330fc29 --- /dev/null +++ b/bin/mkdiskimage @@ -0,0 +1,272 @@ +#!/usr/bin/perl +## ----------------------------------------------------------------------- +## $Id: mkdiskimage.in,v 1.15 2005/08/05 18:57:53 hpa Exp $ +## +## Copyright 2002-2004 H. Peter Anvin - All Rights Reserved +## +## 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, Inc., 53 Temple Place Ste 330, +## Boston MA 02111-1307, USA; either version 2 of the License, or +## (at your option) any later version; incorporated herein by reference. +## +## ----------------------------------------------------------------------- + +# +# Creates a blank MS-DOS formatted hard disk image +# + +use bytes; +use integer; +use Fcntl; +use Errno; +use Cwd; +use IO::Handle; # For flush() + +sub absolute_path($) { + my($f) = @_; + my($c); + + return $f if ( $f =~ /^\// ); + $c = cwd(); + $c = '' if ( $c eq '/' ); + return $c.'/'.$f; +} + +sub is_linux() { + return !!eval '{ '. + 'use POSIX; '. + '($sysname, $nodename, $release, $version, $machine) = POSIX::uname(); '. + "return \$sysname eq \'Linux\'; }"; +} + + +$is_linux = is_linux(); +if ( $is_linux ) { + # IOCTL numbers + $BLKRRPART = 0x125f; + $BLKGETSIZE = 0x1260; +} + +%opt = (); +@args = (); + +for $a ( @ARGV ) { + if ( $a =~ /^\-/ ) { + foreach $o ( split(//, substr($a,1)) ) { + $opt{$o} = 1; + } + } else { + push(@args, $a); + } +} + +($file,$c,$h,$s) = @args; +$c += 0; $h += 0; $s += 0; + +$pentry = 1; +$pentry = 2 if ( $opt{'2'} ); +$pentry = 3 if ( $opt{'3'} ); +$pentry = 4 if ( $opt{'4'} ); + +if ( $opt{'M'} ) { + # Specify size in megabytes, not in cylinders + $c = ($c*1024*2)/($h*$s); +} + +$is_open = 0; + +if ( $c == 0 && $file ne '' ) { + $len = 0; + if ( sysopen(OUTPUT, $file, O_RDWR, 0666) ) { + $is_open = 1; + + if ( (@filestat = stat(OUTPUT)) && S_ISREG($filestat[2]) ) { + $len = $filestat[7] >> 9; + } elsif ( $is_linux && S_ISBLK($filestat[2]) ) { + $blksize = pack("L!", 0); + if ( ioctl(OUTPUT, $BLKGETSIZE, $blksize) == 0 ) { + $len = unpack("L!", $blksize); # In 512-byte sectors! + } + } + } + + if ( !$len ) { + print STDERR "$0: $file: don't know how to determine the size of this device\n"; + exit 1; + } + + $c = $len/($h*$s); +} + +if ( $file eq '' || $c < 1 || $c > 1024 || + $h < 1 || $h > 256 || $s < 1 || $s > 63 ) { + print STDERR "Usage: $0 [-doF4] file [c h s] (max: 1024 256 63)\n"; + print STDERR " -d add DOSEMU header\n"; + print STDERR " -o print filesystem offset to stdout\n"; + print STDERR " -F format partition as FAT32\n"; + print STDERR " -M \"c\" argument is megabytes, calculate cylinders\n"; + print STDERR " -4 use partition entry 4 (standard for zipdisks)\n"; + exit 1; +} + +$cylsize = $h*$s*512; + +if ( !$is_open ) { + sysopen(OUTPUT, $file, O_CREAT|O_RDWR|O_TRUNC, 0666) + or die "$0: Cannot open: $file\n"; +} +binmode OUTPUT; + +# Print out DOSEMU header, if requested +if ( $opt{'d'} ) { + $emuhdr = "DOSEMU\0" . pack("VVVV", $h, $s, $c, 128); + $emuhdr .= "\0" x (128 - length($emuhdr)); + print OUTPUT $emuhdr; +} + +# Print the MBR and partition table +$mbr = ''; +while ( $line = ) { + chomp $line; + foreach $byte ( split(/\s+/, $line) ) { + $mbr .= chr(hex($byte)); + } +} +if ( length($mbr) > 446 ) { + die "$0: Bad MBR code\n"; +} + +$mbr .= "\0" x (446 - length($mbr)); + +print OUTPUT $mbr; + +# Print partition table +$psize = $c*$h*$s-$s; +$bhead = ($h > 1) ? 1 : 0; +$bsect = 1; +$bcyl = ($h > 1) ? 0 : 1; +$ehead = $h-1; +$esect = $s + ((($c-1) & 0x300) >> 2); +$ecyl = ($c-1) & 0xff; +if ( $psize > 65536 ) { + $fstype = 0x06; +} else { + $fstype = 0x04; +} +for ( $i = 1 ; $i <= 4 ; $i++ ) { + if ( $i == $pentry ) { + print OUTPUT pack("CCCCCCCCVV", 0x80, $bhead, $bsect, $bcyl, $fstype, + $ehead, $esect, $ecyl, $s, $psize); + } else { + print OUTPUT "\0" x 16; + } +} +print OUTPUT "\x55\xaa"; + +# Output blank file +$totalsize = $c*$h*$s; +$tracks = $c*$h; + +$track = "\0" x (512*$s); + +# Print fractional track +print OUTPUT "\0" x (512 * ($s-1)); + +for ( $i = 1 ; $i < $tracks ; $i++ ) { + print OUTPUT $track; +} + +# Print mtools temp file +$n = 0; +while ( !defined($tmpdir) ) { + $tmpdir = "/tmp/mkdiskimage.$$.".($n++); + if ( !mkdir($tmpdir, 0700) ) { + die "$0: Failed to make temp directory: $tmpdir\n" + if ( $! != EEXIST ); + undef $tmpdir; + } +} + +$cfgfile = $tmpdir.'/mtools.conf'; +$imglink = $tmpdir.'/disk.img'; +die "$0: Failed to create symlink $imglink\n" + if ( !symlink(absolute_path($file), $imglink) ); + +$header_size = ($opt{'d'} ? 128 : 0); + +# Start of filesystem +$offset = $s*512 + $header_size; + +# Start of partition table entry +$pstart = $header_size + 446 + 16*($pentry-1); + +open(MCONFIG, "> ${cfgfile}") or die "$0: Cannot make mtools config\n"; +print MCONFIG "drive z:\n"; +print MCONFIG "file=\"${imglink}\"\n"; +print MCONFIG "cylinders=${c}\n"; +print MCONFIG "heads=${h}\n"; +print MCONFIG "sectors=${s}\n"; +print MCONFIG "offset=${offset}\n"; +print MCONFIG "mformat_only\n"; +close(MCONFIG); + +# Output the filesystem offset to stdout if appropriate +if ( $opt{'o'} ) { + print $offset, "\n"; +} + +$ENV{'MTOOLSRC'} = $cfgfile; +if ( $opt{'F'} ) { + system('mformat', '-F', 'z:'); +} else { + system('mformat', 'z:'); +} + +# Clean up in /tmp +unlink($cfgfile); +unlink($imglink); +rmdir($tmpdir); + +# MTOOLS doesn't write the bsHiddenSecs field correctly +seek(OUTPUT, $offset + 0x1c, 0); +print OUTPUT pack("V", ($offset-$header_size)>>9); + +# Set the partition type +if ( $opt{'F'} ) { + $fstype = 0x0b; # FAT32 +} else { + if ( $psize > 65536 ) { + $fstype = 0x06; # FAT16 > 32MB + } else { + $fstype = 0x04; # FAT16 <= 32MB + } + seek(OUTPUT, $offset + 0x36, 0); + read(OUTPUT, $fsname, 8); + + # FAT12: adjust partition type + if ( $fsname eq 'FAT12 ' ) { + $fstype = 0x01; # FAT12 + } +} +seek(OUTPUT, $pstart+4, 0); +print OUTPUT pack("C", $fstype); + +flush OUTPUT; + +# Just in case this is a block device, try to flush the partition table +if ( $is_linux ) { + ioctl(OUTPUT, $BLKRRPART, 0); +}; + +exit 0; +__END__ +fa 31 c0 8e d8 8e c0 8e d0 bc 0 7c fb fc 89 e6 bf 0 6 b9 0 1 f3 a5 ea 1d 6 0 0 88 16 0 8 b4 8 cd 13 +31 c0 88 f0 40 a3 f0 6 80 e1 3f 88 e f2 6 be be 7 31 c0 b9 4 0 f6 4 80 74 3 40 89 f7 83 c6 10 e2 f3 83 +f8 1 75 73 8a 16 0 8 b8 0 41 bb aa 55 31 c9 30 f6 f9 cd 13 72 23 81 fb 55 aa 75 1d f6 c1 1 74 18 57 be e0 +6 8b 5d 8 89 5c 8 8b 5d a 89 5c a 8a 16 0 8 b4 42 eb 2a 57 8b 45 8 8b 55 a f7 36 f2 6 42 89 d1 31 d2 +f7 36 f0 6 88 c5 d1 e8 d1 e8 24 c0 8 c1 88 d6 8a 16 0 8 bb 0 7c b8 1 2 cd 13 72 16 5e 81 3e fe 7d 55 aa +75 8 fa ea 0 7c 0 0 77 5 be f4 6 eb 3 be f 7 ac 20 c0 74 c b4 e 8a 3e 62 4 b3 7 cd 10 eb ef eb fe +0 0 10 0 1 0 0 7c 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4d 69 73 73 69 6e 67 20 6f 70 65 72 61 74 69 +6e 67 20 73 79 73 74 65 6d d a 0 4f 70 65 72 61 74 69 6e 67 20 73 79 73 74 65 6d 20 6c 6f 61 64 69 6e 67 20 +65 72 72 6f 72 d a 0 diff --git a/boot/isolinux/isolinux.cfg b/boot/isolinux/isolinux.cfg new file mode 100755 index 0000000..67df0a4 --- /dev/null +++ b/boot/isolinux/isolinux.cfg @@ -0,0 +1,16 @@ +SERIAL 0 115200 +PROMPT 0 +TIMEOUT 100 +DEFAULT menu.c32 + +MENU TITLE Bootable Options: + +LABEL Serial Line ^Console + MENU LABEL Serial Line ^Console + KERNEL vmlinuz + APPEND initrd=initramf.gz ip=:::::eth0:dhcp debug loglevel=10 console=ttyS0,115200 + +LABEL ^VGA Console + MENU LABEL ^VGA Console + KERNEL vmlinuz + APPEND initrd=initramf.gz ip=:::::eth0:dhcp debug loglevel=10 diff --git a/boot/pxelinux.cfg/default b/boot/pxelinux.cfg/default new file mode 100644 index 0000000..d1df888 --- /dev/null +++ b/boot/pxelinux.cfg/default @@ -0,0 +1,22 @@ +DISPLAY menu.txt +SERIAL 0 115200 +PROMPT 0 +TIMEOUT 100 +DEFAULT menu.c32 + +MENU TITLE Bootable Options: + +LABEL Serial Line Console + MENU LABEL ^Serial Line Console + KERNEL vmlinuz + APPEND initrd=initramfs.cpio.gz ip=:::::eth0:dhcp console=ttyS0,115200 debug loglevel=10 + +LABEL VGA Console + MENU LABEL ^VGA Console + KERNEL vmlinuz + APPEND initrd=initramfs.cpio.gz ip=:::::eth0:dhcp debug loglevel=10 + +LABEL Local Disk MBR + MENU LABEL Local Disk (sd^a) + KERNEL chain.c32 + APPEND hd0 diff --git a/boot/pxelinux.cfg/menu.txt b/boot/pxelinux.cfg/menu.txt new file mode 100644 index 0000000..eef2889 --- /dev/null +++ b/boot/pxelinux.cfg/menu.txt @@ -0,0 +1 @@ +Konrad Rzeszutek Wilk (c) 2009 diff --git a/early-devs b/early-devs new file mode 100644 index 0000000..ff51a27 --- /dev/null +++ b/early-devs @@ -0,0 +1,11 @@ +# Set up devices in initramfs + +dir /dev 0755 0 0 +nod /dev/console 0600 0 0 c 5 1 +nod /dev/ttyS0 0600 0 0 c 4 64 +nod /dev/tty0 0600 0 0 c 4 0 +nod /dev/tty1 0600 0 0 c 4 1 +nod /dev/tty2 0600 0 0 c 4 2 +nod /dev/null 0666 0 0 c 1 3 +nod /dev/hvc0 0666 0 0 c 229 0 + diff --git a/linux.config b/linux.config new file mode 100644 index 0000000..b7d3422 --- /dev/null +++ b/linux.config @@ -0,0 +1,661 @@ + +# CONFIG_64BIT is not set +CONFIG_EXPERIMENTAL=y +CONFIG_KERNEL_GZIP=y + +CONFIG_BSD_PROCESS_ACCT=y +CONFIG_BSD_PROCESS_ACCT_V3=y +CONFIG_SYSFS_DEPRECATED=y +# CONFIG_RELAY is not set +CONFIG_BLK_DEV_INITRD=y +CONFIG_INITRAMFS_SOURCE="early-devs" +CONFIG_INITRAMFS_COMPRESSION_GZIP=y +CONFIG_INITRAMFS_ROOT_UID=0 +CONFIG_INITRAMFS_ROOT_GID=0 +# CONFIG_INITRAMFS_COMPRESSION_NONE is not set +# CONFIG_INITRAMFS_COMPRESSION_BZIP2 is not set +# CONFIG_INITRAMFS_COMPRESSION_LZMA is not set +CONFIG_HAVE_KERNEL_GZIP=y +CONFIG_HAVE_KERNEL_BZIP2=y +CONFIG_HAVE_KERNEL_LZMA=y +CONFIG_KERNEL_GZIP=y +# CONFIG_KERNEL_BZIP2 is not set +# CONFIG_KERNEL_LZMA is not set +# +CONFIG_LOCALVERSION="NEB" +# CONFIG_DEBUG_KMEMLEAK is not set + +# +CONFIG_SYSCTL=y +# CONFIG_STRIP_ASM_SYMS is not set +# CONFIG_X86_BIGSMP is not set +# CONFIG_X86_EXTENDED_PLATFORM is not set +CONFIG_NR_CPUS=8 +# CONFIG_X86_CPU_DEBUG is not set +# CONFIG_CC_STACKPROTECTOR is not set +CONFIG_PCI_IOV=y +# +# +# SCSI device support +# +CONFIG_RAID_ATTRS=m +CONFIG_SCSI=m +CONFIG_SCSI_NETLINK=y +CONFIG_SCSI_PROC_FS=y +# +# SCSI support type (disk, tape, CD-ROM) +# +CONFIG_BLK_DEV_SD=m +CONFIG_CHR_DEV_ST=m +CONFIG_CHR_DEV_OSST=m +CONFIG_BLK_DEV_SR=m +CONFIG_BLK_DEV_SR_VENDOR=y +CONFIG_CHR_DEV_SG=m +CONFIG_CHR_DEV_SCH=m +CONFIG_SCSI_FC_ATTRS=y +# +# Some SCSI devices (e.g. CD jukebox) support multiple LUNs +# +CONFIG_SCSI_MULTI_LUN=y +CONFIG_SCSI_CONSTANTS=y +CONFIG_SCSI_LOGGING=y +CONFIG_SCSI_SCAN_ASYNC=y +CONFIG_SCSI_WAIT_SCAN=m +# CONFIG_SCSI_OSD_INITIATOR is not set +CONFIG_SCSI_SAS_ATA=y +CONFIG_SCSI_SAS_HOST_SMP=y +CONFIG_SCSI_SAS_LIBSAS_DEBUG=n +CONFIG_LIBFC=m +CONFIG_LIBFCOE=m +CONFIG_FCOE=m +# CONFIG_FCOE_FNIC is not set +CONFIG_SCSI_LOWLEVEL=y +# +# SCSI low-level drivers +# +# CONFIG_ISCSI_TCP is not set +# CONFIG_SCSI_CXGB3_ISCSI is not set +# CONFIG_SCSI_BNX2_ISCSI is not set +CONFIG_BLK_DEV_3W_XXXX_RAID=m +CONFIG_SCSI_3W_9XXX=m +CONFIG_SCSI_ACARD=m +CONFIG_SCSI_AHA152X=m +CONFIG_SCSI_AHA1542=m +CONFIG_SCSI_AACRAID=m +CONFIG_SCSI_AIC7XXX=m +CONFIG_AIC7XXX_CMDS_PER_DEVICE=8 +CONFIG_AIC7XXX_RESET_DELAY_MS=15000 +CONFIG_AIC7XXX_DEBUG_ENABLE=y +CONFIG_AIC7XXX_DEBUG_MASK=0 +CONFIG_AIC7XXX_REG_PRETTY_PRINT=y +CONFIG_SCSI_AIC7XXX_OLD=m +CONFIG_SCSI_AIC79XX=m +CONFIG_AIC79XX_CMDS_PER_DEVICE=32 +CONFIG_AIC79XX_RESET_DELAY_MS=15000 +CONFIG_AIC79XX_DEBUG_ENABLE=y +CONFIG_AIC79XX_DEBUG_MASK=0 +CONFIG_AIC79XX_REG_PRETTY_PRINT=y +CONFIG_SCSI_AIC94XX=m +# CONFIG_AIC94XX_DEBUG is not set +CONFIG_SCSI_MVSAS=m +# CONFIG_SCSI_MVSAS_DEBUG is not set +CONFIG_SCSI_DPT_I2O=m +CONFIG_SCSI_ADVANSYS=m +CONFIG_SCSI_IN2000=m +CONFIG_SCSI_ARCMSR=m +CONFIG_SCSI_ARCMSR_AER=y +CONFIG_MEGARAID_NEWGEN=y +CONFIG_MEGARAID_MM=m +CONFIG_MEGARAID_MAILBOX=m +CONFIG_MEGARAID_LEGACY=m +CONFIG_MEGARAID_SAS=m +CONFIG_SCSI_MPT2SAS=m +CONFIG_SCSI_MPT2SAS_MAX_SGE=128 +CONFIG_SCSI_MPT2SAS_LOGGING=y +CONFIG_SCSI_HPTIOP=m +CONFIG_SCSI_BUSLOGIC=m +CONFIG_SCSI_FLASHPOINT=y +# CONFIG_SCSI_OMIT_FLASHPOINT is not set +CONFIG_SCSI_DMX3191D=m +CONFIG_SCSI_DTC3280=m +CONFIG_SCSI_EATA=m +CONFIG_SCSI_EATA_TAGGED_QUEUE=y +CONFIG_SCSI_EATA_LINKED_COMMANDS=y +CONFIG_SCSI_EATA_MAX_TAGS=16 +CONFIG_SCSI_FUTURE_DOMAIN=m +CONFIG_SCSI_GDTH=m +CONFIG_SCSI_GENERIC_NCR5380=m +CONFIG_SCSI_GENERIC_NCR5380_MMIO=m +CONFIG_SCSI_GENERIC_NCR53C400=y +CONFIG_SCSI_IPS=m +CONFIG_SCSI_INITIO=m +# CONFIG_SCSI_INIA100 is not set +CONFIG_SCSI_PPA=m +CONFIG_SCSI_IMM=m +# CONFIG_SCSI_IZIP_EPP16 is not set +# CONFIG_SCSI_IZIP_SLOW_CTR is not set +CONFIG_SCSI_NCR53C406A=m +CONFIG_SCSI_STEX=m +CONFIG_SCSI_SYM53C8XX_2=m +CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=1 +CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16 +CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64 +CONFIG_SCSI_SYM53C8XX_MMIO=y +CONFIG_SCSI_IPR=m +# CONFIG_SCSI_IPR_TRACE is not set +# CONFIG_SCSI_IPR_DUMP is not set +CONFIG_SCSI_PAS16=m +CONFIG_SCSI_PSI240I=m +CONFIG_SCSI_FC_TGT_ATTRS=y +CONFIG_SCSI_QLOGIC_1280=m +CONFIG_SCSI_QLA_FC=m +CONFIG_SCSI_QLA2XXX_TARGET_DISABLE_INI_MODE=y +CONFIG_SCSI_QLA2XXX_TARGET=y +CONFIG_SCST_QLA_TGT_ADDON=m +CONFIG_QLA_TGT_DEBUG_WORK_IN_THREAD=y +# CONFIG_QLA_TGT_DEBUG_SRR is not set +# CONFIG_SCSI_QLA_ISCSI is not set +CONFIG_SCSI_LPFC=m +# CONFIG_SCSI_LPFC_DEBUG_FS is not set +# CONFIG_SCSI_SEAGATE is not set +CONFIG_SCSI_SYM53C416=m +CONFIG_SCSI_DC395x=m +CONFIG_SCSI_DC390T=m +CONFIG_SCSI_T128=m +CONFIG_SCSI_U14_34F=m +CONFIG_SCSI_U14_34F_TAGGED_QUEUE=y +CONFIG_SCSI_U14_34F_LINKED_COMMANDS=y +CONFIG_SCSI_U14_34F_MAX_TAGS=8 +CONFIG_SCSI_ULTRASTOR=m +CONFIG_SCSI_NSP32=m +CONFIG_SCSI_DEBUG=m +CONFIG_SCSI_SRP=m + +# +# ATA +# + +CONFIG_ATA=m +# CONFIG_ATA_NONSTANDARD is not set +CONFIG_ATA_ACPI=y +CONFIG_SATA_AHCI=m +CONFIG_SATA_SVW=m +CONFIG_ATA_PIIX=m +CONFIG_SATA_MV=m +CONFIG_SATA_NV=m +CONFIG_PDC_ADMA=m +CONFIG_SATA_QSTOR=m +CONFIG_SATA_PROMISE=m +CONFIG_SATA_SX4=m +CONFIG_SATA_SIL=m +CONFIG_SATA_SIL24=m +CONFIG_SATA_SIS=m +CONFIG_SATA_ULI=m +CONFIG_SATA_VIA=m +CONFIG_SATA_VITESSE=m +CONFIG_SATA_INIC162X=m +# CONFIG_PATA_ALI is not set +# CONFIG_PATA_AMD is not set +# CONFIG_PATA_ARTOP is not set +# CONFIG_PATA_ATIIXP is not set +# CONFIG_PATA_CMD640_PCI is not set +# CONFIG_PATA_CMD64X is not set +# CONFIG_PATA_CS5520 is not set +# CONFIG_PATA_CS5530 is not set +# CONFIG_PATA_CS5535 is not set +# CONFIG_PATA_CYPRESS is not set +CONFIG_PATA_EFAR=m +CONFIG_ATA_GENERIC=m +# CONFIG_PATA_HPT366 is not set +# CONFIG_PATA_HPT37X is not set +# CONFIG_PATA_HPT3X2N is not set +# CONFIG_PATA_HPT3X3 is not set +CONFIG_PATA_ISAPNP=m +# CONFIG_PATA_IT821X is not set +# CONFIG_PATA_IT8213 is not set +# CONFIG_PATA_JMICRON is not set +CONFIG_PATA_LEGACY=m +# CONFIG_PATA_TRIFLEX is not set +CONFIG_PATA_MARVELL=m +# CONFIG_PATA_MPIIX is not set +# CONFIG_PATA_OLDPIIX is not set +# CONFIG_PATA_NETCELL is not set +# CONFIG_PATA_NS87410 is not set +# CONFIG_PATA_OPTI is not set +# CONFIG_PATA_OPTIDMA is not set +CONFIG_PATA_PCMCIA=m +CONFIG_PATA_PDC_OLD=m +CONFIG_PATA_QDI=m +CONFIG_PATA_RADISYS=m +# CONFIG_PATA_RZ1000 is not set +# CONFIG_PATA_SC1200 is not set +# CONFIG_PATA_SERVERWORKS is not set +# CONFIG_PATA_PDC2027X is not set +# CONFIG_PATA_SIL680 is not set +CONFIG_PATA_SIS=m +# CONFIG_PATA_VIA is not set +CONFIG_PATA_WINBOND=m +CONFIG_PATA_WINBOND_VLB=m + +# +# Multi-device support (RAID and LVM) +# +CONFIG_MD=y +CONFIG_BLK_DEV_MD=m +CONFIG_MD_LINEAR=m +CONFIG_MD_RAID0=m +CONFIG_MD_RAID1=m +CONFIG_MD_RAID10=m +CONFIG_MD_RAID456=m +CONFIG_MD_RAID5_RESHAPE=y +CONFIG_MD_MULTIPATH=m +CONFIG_MD_FAULTY=m +CONFIG_BLK_DEV_DM=m +# CONFIG_DM_DEBUG is not set +CONFIG_DM_CRYPT=m +CONFIG_DM_SNAPSHOT=m +CONFIG_DM_MIRROR=m +CONFIG_DM_ZERO=m +CONFIG_DM_MULTIPATH=m +CONFIG_DM_MULTIPATH_EMC=m +CONFIG_DM_DELAY=m + +# +# Fusion MPT device support +# +CONFIG_FUSION=y +CONFIG_FUSION_SPI=m +CONFIG_FUSION_FC=m +CONFIG_FUSION_SAS=m +CONFIG_FUSION_MAX_SGE=40 +CONFIG_FUSION_CTL=m +CONFIG_FUSION_LAN=m +# CONFIG_FUSION_LOGGING is not set +# +# Network device support +# +CONFIG_NETDEVICES=y + +# +# MII PHY device drivers +# +CONFIG_MARVELL_PHY=m +CONFIG_DAVICOM_PHY=m +CONFIG_QSEMI_PHY=m +CONFIG_LXT_PHY=m +CONFIG_CICADA_PHY=m +CONFIG_VITESSE_PHY=m +CONFIG_SMSC_PHY=m +CONFIG_BROADCOM_PHY=m +CONFIG_FIXED_PHY=y +# CONFIG_FIXED_MII_10_FDX is not set +# CONFIG_FIXED_MII_100_FDX is not set +# +# Ethernet (10 or 100Mbit) +# +CONFIG_NET_ETHERNET=y +CONFIG_MII=m +CONFIG_HAPPYMEAL=m +CONFIG_SUNGEM=m +CONFIG_CASSINI=m +CONFIG_NET_VENDOR_3COM=y +CONFIG_EL1=m +CONFIG_EL2=m +CONFIG_ELPLUS=m +CONFIG_EL16=m +CONFIG_EL3=m +CONFIG_3C515=m +CONFIG_VORTEX=m +CONFIG_TYPHOON=m +CONFIG_LANCE=m +CONFIG_VIA_VELOCITY=m +CONFIG_BNX2X=m +CONFIG_SKGE=m +# CONFIG_SKGE_DEBUG is not set +CONFIG_NET_VENDOR_SMC=y +CONFIG_WD80x3=m +CONFIG_ULTRA=m +CONFIG_SMC9194=m +CONFIG_NET_VENDOR_RACAL=y +CONFIG_NI52=m +CONFIG_NI65=m + +CONFIG_8139TOO=m + +# CONFIG_8139TOO_PIO is not set +# CONFIG_ETHOC is not set +# CONFIG_DNET is not set +# +# Tulip family network device support +CONFIG_EEXPRESS_PRO=m +CONFIG_NE2000=m +# CONFIG_DGRS is not set +CONFIG_EEPRO100=m +CONFIG_E100=m +CONFIG_NE2K_PCI=m +CONFIG_TLAN=m +CONFIG_VIA_RHINE=m +# CONFIG_VIA_RHINE_MMIO is not set +CONFIG_VIA_RHINE_NAPI=y +CONFIG_SC92031=m + +# +# Gigabit +# +# CONFIG_NET_POCKET is not set +CONFIG_NETDEV_1000=y +CONFIG_E1000=m +CONFIG_E1000_NAPI=y +CONFIG_IGB=m +CONFIG_IGBVF=m +# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set +# CONFIG_SK98LIN is not set +CONFIG_SKY2=m +CONFIG_BNX2=m +CONFIG_NETDEV_10000=y +CONFIG_3C359=m + +CONFIG_IXGBE=m + +# +# 10 GB +# CONFIG_VXGE is not set +# CONFIG_BE2NET is not set +# +# Wireless LAN +# +# CONFIG_WLAN_PRE80211 is not set +# CONFIG_WLAN_80211 is not set +# +# USB Network Adapters +# +# +# +# Cyclades-PC300 MLPPP support is disabled. +# + +# +# Refer to the file README.mlppp, provided by PC300 package. +# +CONFIG_NETCONSOLE=m +CONFIG_NETPOLL=y +# CONFIG_NETPOLL_TRAP is not set +CONFIG_NET_POLL_CONTROLLER=y +# CONFIG_IEEE802154 is not set +# +# ISDN subsystem +# +# CONFIG_ISDN is not set +# +# Input device support +# +CONFIG_INPUT=y +# CONFIG_INPUT_POLLDEV is not set + +# +# Userland interfaces +# + +# +# Input Device Drivers +# +# CONFIG_INPUT_TOUCHSCREEN is not set + +# +# Hardware I/O ports +# +# CONFIG_GAMEPORT is not set + +# +# Character devices +# +CONFIG_VT=y +CONFIG_VT_CONSOLE=y +CONFIG_HW_CONSOLE=y +# CONFIG_VT_HW_CONSOLE_BINDING is not set +CONFIG_SERIAL_NONSTANDARD=n +# +# Serial drivers +# +CONFIG_SERIAL_8250=y +CONFIG_SERIAL_8250_CONSOLE=y +CONFIG_SERIAL_8250_PCI=y +CONFIG_SERIAL_8250_PNP=y +CONFIG_SERIAL_8250_CS=m +CONFIG_SERIAL_8250_NR_UARTS=16 +CONFIG_SERIAL_8250_RUNTIME_UARTS=4 +CONFIG_SERIAL_8250_EXTENDED=y +CONFIG_SERIAL_8250_MANY_PORTS=y +CONFIG_SERIAL_8250_SHARE_IRQ=y +# CONFIG_SERIAL_8250_DETECT_IRQ is not set +CONFIG_SERIAL_8250_RSA=n + +# +# Non-8250 serial port support +# +CONFIG_SERIAL_CORE=y +CONFIG_SERIAL_CORE_CONSOLE=y +CONFIG_UNIX98_PTYS=y +CONFIG_LEGACY_PTYS=y +CONFIG_LEGACY_PTY_COUNT=256 +# CONFIG_HW_RANDOM_TIMERIOMEM is not set +# CONFIG_PRINTER is not set + +# +# IPMI +# +# CONFIG_IPMI_HANDLER is not set + +# +# Watchdog Device Drivers +# +# CONFIG_WATCHDOG is not set +# CONFIG_DRM is not set + +# +# TPM devices +# +# CONFIG_TCG_TPM is not set +# CONFIG_I2C is not set +# +# SPI support +# +# CONFIG_SPI is not set + +# +# Multimedia devices +# +# CONFIG_VIDEO_DEV is not set + +# +# Supported SAA7146 based PCI Adapters +# +# +# Display device support +# +CONFIG_DISPLAY_SUPPORT=m + +# +# Display hardware drivers +# +CONFIG_VGASTATE=m +CONFIG_FB=y + +# +# Frame buffer hardware drivers +# + +# +# Console display driver support +# +CONFIG_VGA_CONSOLE=y +# CONFIG_VGACON_SOFT_SCROLLBACK is not set +CONFIG_VIDEO_SELECT=y +CONFIG_MDA_CONSOLE=m +CONFIG_DUMMY_CONSOLE=y +# CONFIG_FONTS is not set +CONFIG_FONT_8x8=y +CONFIG_FONT_8x16=y +# CONFIG_LOGO is not set + +# +# Sound +# +# CONFIG_SOUND is not set +# +# HID Devices +# +CONFIG_HID=m +# CONFIG_HID_DEBUG is not set +# CONFIG_DRAGONRISE_FF is not set +# +# USB Input Devices +# +CONFIG_USB_HID=m +# CONFIG_USB_XHCI_HCD is not set +# +# USB HID Boot Protocol drivers +# +CONFIG_USB_KBD=m +CONFIG_USB_MOUSE=m +# CONFIG_NOP_USB_XCEIV is not set +# CONFIG_AUXDISPLAY is not set +# +# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set +# +# +# CONFIG_DETECT_HUNG_TASK is not set +# CONFIG_EVENT_TRACER is not set +# CONFIG_FTRACE_SYSCALLS is not set +# CONFIG_KMEMTRACE is not set +# CONFIG_WORKQUEUE_TRACER is not set +# CONFIG_FTRACE_STARTUP_TEST is not set +# CONFIG_DYNAMIC_DEBUG is not set +# CONFIG_DMA_API_DEBUG is not set +# CONFIG_SECURITY_TOMOYO is not set +# CONFIG_IMA is not set +CONFIG_CRYPTO_ZLIB=y + +# CONFIG_PERF_COUNTERS is not set +# CONFIG_GCOV_KERNEL is not set +# +CONFIG_LBDAF=y +# CONFIG_X86_OLD_MCE is not set +CONFIG_X86_MCE_INTEL=y +CONFIG_X86_MCE_AMD=y +CONFIG_X86_ANCIENT_MCE=y +CONFIG_X86_MCE_INJECT=y +# CONFIG_PPS is not set +CONFIG_NOHIGHMEM=y +# CONFIG_HIGHMEM4G is not set +# CONFIG_HIGHMEM64G is not set +CONFIG_X86_PAE=y +CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 +CONFIG_PCIE_ECRC=y +# CONFIG_PCIEAER_INJECT is not set +# +# CONFIG_HOTPLUG_PCI_COMPAQ is not set +# CONFIG_CFG80211_DEBUGFS is not set +# CONFIG_MAC80211_DEFAULT_PS is not set +# CONFIG_CB710_CORE is not set +# CONFIG_DM_MULTIPATH_QL is not set +# CONFIG_DM_MULTIPATH_ST is not set +# CONFIG_DM_LOG_USERSPACE is not set +# CONFIG_KS8842 is not set +# CONFIG_CNIC is not set +# CONFIG_MEDIA_SUPPORT is not set +# CONFIG_SMARTJOYPLUS_FF is not set +# CONFIG_FTRACE is not set +# CONFIG_IOMMU_STRESS is not set +CONFIG_LSM_MMAP_MIN_ADDR=65534 + +CONFIG_EXT4_FS=m +CONFIG_EXT2_FS=m +CONFIG_EXT2_FS_XATTR=y +CONFIG_EXT2_FS_POSIX_ACL=y +CONFIG_EXT2_FS_SECURITY=y +CONFIG_EXT2_FS_XIP=y +CONFIG_EXT3_FS=m +CONFIG_EXT3_FS_XATTR=y +CONFIG_EXT3_FS_POSIX_ACL=y +CONFIG_EXT3_FS_SECURITY=y +CONFIG_EXT4_FS=m +CONFIG_EXT4DEV_COMPAT=y +CONFIG_EXT4_FS_XATTR=y +CONFIG_EXT4_FS_POSIX_ACL=y +CONFIG_EXT4_FS_SECURITY=y +CONFIG_JBD=y +# CONFIG_JBD2_DEBUG is not set +CONFIG_REISERFS_FS=m +# CONFIG_REISERFS_CHECK is not set +CONFIG_REISERFS_PROC_INFO=y +CONFIG_REISERFS_FS_XATTR=y +CONFIG_REISERFS_FS_POSIX_ACL=y +CONFIG_REISERFS_FS_SECURITY=y +CONFIG_JFS_FS=m +CONFIG_JFS_POSIX_ACL=y +CONFIG_JFS_SECURITY=y +# CONFIG_JFS_DEBUG is not set +CONFIG_JFS_STATISTICS=y +CONFIG_FS_POSIX_ACL=y +CONFIG_XFS_FS=m +# CONFIG_XFS_QUOTA is not set +CONFIG_XFS_POSIX_ACL=y +# CONFIG_XFS_RT is not set +# CONFIG_XFS_DEBUG is not set +CONFIG_NTFS_FS=y +# CONFIG_NTFS_DEBUG is not set +CONFIG_NTFS_RW=y +# CONFIG_GFS2_FS is not set +# CONFIG_NFS_V4_1 is not set +CONFIG_SCST=m +CONFIG_SCST_DISK=m +CONFIG_SCST_TAPE=m +CONFIG_SCST_CDROM=m +CONFIG_SCST_MODISK=m +CONFIG_SCST_CHANGER=m +CONFIG_SCST_PROCESSOR=m +CONFIG_SCST_RAID=m +CONFIG_SCST_VDISK=m +CONFIG_SCST_USER=m +# CONFIG_SCST_STRICT_SERIALIZING is not set +# CONFIG_SCST_STRICT_SECURITY is not set +CONFIG_SCST_ALLOW_PASSTHROUGH_IO_SUBMIT_IN_SIRQ=y +CONFIG_SCST_ABORT_CONSIDER_FINISHED_TASKS_AS_NOT_EXISTING=y +# CONFIG_SCST_USE_EXPECTED_VALUES is not set +# CONFIG_SCST_EXTRACHECKS is not set +CONFIG_SCST_TRACING=y +# CONFIG_SCST_DEBUG is not set +# CONFIG_SCST_DEBUG_OOM is not set +# CONFIG_SCST_DEBUG_RETRY is not set +# CONFIG_SCST_DEBUG_SN is not set +CONFIG_SCST_MEASURE_LATENCY=y + + +CONFIG_PARAVIRT_GUEST=y +CONFIG_XEN=y +CONFIG_XEN_MAX_DOMAIN_MEMORY=8 +CONFIG_XEN_DEBUG_FS=y +CONFIG_VMI=y +CONFIG_KVM_CLOCK=y +CONFIG_KVM_GUEST=y +CONFIG_LGUEST_GUEST=y +CONFIG_PARAVIRT=y +CONFIG_PARAVIRT_SPINLOCKS=y +# CONFIG_PARAVIRT_DEBUG is not set +CONFIG_XEN_BLKDEV_FRONTEND=m +CONFIG_XEN_NETDEV_FRONTEND=m +CONFIG_XEN_KBDDEV_FRONTEND=m +CONFIG_XEN_FBDEV_FRONTEND=m +CONFIG_HVC_XEN=y +CONFIG_HW_RANDOM_VIRTIO=m +CONFIG_VIRTIO_BALLOON=y +CONFIG_VIRTIO_PCI=m +CONFIG_VIRTIO_BLK=m +CONFIG_VIRTIO_NET=m +CONFIG_XEN_BALLOON=y +CONFIG_XEN_SCRUB_PAGES=y +CONFIG_XEN_DEV_EVTCHN=m +CONFIG_XENFS=m +CONFIG_XEN_COMPAT_XENFS=y +CONFIG_XEN_SYS_HYPERVISOR=y diff --git a/linux_cfg.pl b/linux_cfg.pl new file mode 100755 index 0000000..96b76a3 --- /dev/null +++ b/linux_cfg.pl @@ -0,0 +1,109 @@ +#!/usr/bin/perl -w +# +# +# Copyright (c) 2003-2009, Virtual Iron Software, Inc. +# +# Portions have been modified by Virtual Iron Software, Inc. +# (c) 2009. This file and the modifications can be redistributed and/or +# modified under the terms and conditions of the GNU General Public +# License, version 2.1 and not any later version of the GPL, as published +# by the Free Software Foundation. +# +# +# +# Compose a Linux kernel config file from multiple config files and write +# the result to stdout. +# Existing options are overridden. New options are added. +# Comments and whitespace lines are passed through. +# + +use strict; + +my @param_names = (); +my %config_values = (); +my %config_text = (); +my $tmp_text = ""; + +sub usage { + die "$0 config-file [config-file ...]\n"; +} + +sub parse_name { + + my $line; + + ( $line ) = @_; + + if ($line =~ m/^(CONFIG_\w+)=/o || + $line =~ m/^#\s*(CONFIG_\w+)\s+is\s+not\s+set/o) { + return $1; + } else { + return ""; + } +} +sub write_config { + + my $name; + + foreach $name (@param_names) { + + print $config_text{$name}; + print $config_values{$name}; + } + +} + +sub load_file { + + my ( $fname ) = @_; + + open(INFILE, $fname) or die "$0: Unable to open $fname: $!\n"; + + while ( ) { + + my $line = $_; + + my $name = parse_name($line); + + if ($name ne "") { + + if (! exists $config_values{$name}) { + + # A new kernel parameter. + # Remember the order, and preceding text (comments) + @param_names = (@param_names, $name); + $config_text{$name} = $tmp_text; + + } else { + + # Updating the value of an existing parameter + # Remember any additional text + $config_text{$name} = $config_text{$name} . $tmp_text; + } + + # Remember the newest value + $config_values{$name} = $line; + + $tmp_text = ""; + + } else { + + # Accumulate everything that isn't a parameter line + $tmp_text = $tmp_text . $line; + } + } +} + +# Main +if ($#ARGV < 0) { + usage(); +} + +my $file; + +foreach $file (@ARGV) { + load_file($file); +} + +write_config(); +exit 0 diff --git a/root_image/Makefile b/root_image/Makefile new file mode 100644 index 0000000..a8b9f95 --- /dev/null +++ b/root_image/Makefile @@ -0,0 +1,885 @@ +# +# +# Copyright (c) 2003-2009, Virtual Iron Software, Inc. +# +# Portions have been modified by Virtual Iron Software, Inc. +# (c) 2009. This file and the modifications can be redistributed and/or +# modified under the terms and conditions of the GNU General Public +# License, version 2.1 and not any later version of the GPL, as published +# by the Free Software Foundation. +# +# Copyright (c) 2009, Konrad Rzeszutek Wilk +# +# Portions have been modified by Konrad Rzeszutek Wilk +# (c) 2009. This file and the modifications can be redistributed and/or +# modified under the terms and conditions of the GNU General Public +# License, version 2.1 and not any later version of the GPL, as published +# by the Free Software Foundation. +# +# +# -*- mode: Makefile; -*- + +# Xen Testing Toolkit root image makefile + +.DEFAULT_GOAL: all +.PHONY: all + +all: dist + +ifeq ($(shell head -1 /etc/redhat-release), Fedora release 11 (Leonidas)) +FC11 = 1 +endif + +ifeq ($(shell head -1 /etc/redhat-release), Fedora release 12 (Constantine)) +FC12 = 1 +FC12_RPM = 1 +endif + +ifeq ($(shell head -1 /etc/redhat-release), Fedora release 13 (Goddard)) +FC13 = 1 +FC12_RPM = 1 +endif + +include ../sources.mk + +LINUX_DST = ../linux-build +LINUX_SRC = $(dir $(CURDIR))linux + +# Define the install commands that we'll need +# for those with poor octal/mnemonic memories (like) me: +# 644 - u=rw g=r o=r +# 755 - u=rwx g=rx o=rx + +INSTALL = install -p +INSTALL_DIR = $(INSTALL) -m0755 -d +INSTALL_DATA = $(INSTALL) -m0644 +INSTALL_SCRIPT = $(INSTALL) -m0755 +INSTALL_PROG = $(INSTALL) -m0755 -s +INSTALL_PROG_DBG = $(INSTALL) -m0755 + +ifeq ($(shell uname -m), i686) +ifdef FC11 +RPM_ARCH = i586 +else +# FC12 and above now use the i686 instead of the old wierd i586. +RPM_ARCH = i686 +endif +ARCH = x86 +LIBSDIR = /lib +else +RPM_ARCH = x86_64 +ARCH = $(shell uname -m) +LIBSDIR = /lib64 +endif + +RPM_DIR = $(shell pwd)/RPMs + +TFTPDIR = /mnt/lab +DISTDIR = dist + +# RPM management definitions + +define TYPE_IS_WILDCARD + @if [ `echo '$(1)' | grep \*` ]; then $(2) else $(3) fi +endef + + +# If the $(1) is a wildcard, extract the file and double-check +# And if it has a slash in it lib/*glibc*, then also do an extra check. +define RPM_TO_USERSPACE_CHECK_WILDCARD + echo -n "Extracting $(1) .. "; \ + if [ `echo '$(1)' | grep \/` ]; then \ + if ! [ `find ./userspace/ -print0 | grep -EzZ '$(1)' | head -1` ]; then \ + rpm2cpio $(2)/*.$(RPM_ARCH).rpm | (cd userspace; cpio -i -d '$(1)'); \ + else \ + echo " (found) OK"; \ + fi; \ + if ! [ `find ./userspace/ -print0 | grep -EzZ '$(1)' | head -1` ]; then \ + echo "$1 was not in $(2)/*.$(RPM_ARCH)."; false; \ + fi; \ + else \ + if ! [ `find ./userspace/ -name '$(1)' | head -1` ]; then \ + rpm2cpio $(2)/*.$(RPM_ARCH).rpm | (cd userspace; cpio -i -d $(1)); \ + else \ + echo " (found) OK"; \ + fi; \ + if ! [ `find ./userspace/ -name '$(1)' | head -1` ]; then \ + echo "$1 was not in $(2)/*.$(RPM_ARCH)."; false; \ + fi; \ + fi; +endef + +# If the $(1) is a file, extract the file, and double-check. +define RPM_TO_USERSPACE_CHECK_FILE + echo -n "Extracting $(1) .. "; \ + if ! [ -e userspace/$(1) ];then \ + rpm2cpio $(2)/*.$(RPM_ARCH).rpm | (cd userspace; cpio -i -d $(1)); \ + else \ + echo " (found) OK"; \ + fi; \ + if ! [ -e userspace/$(1) ]; then \ + echo "$(1) was not installed."; false; \ + fi; +endef + +# It is imperative that the argument to $call are without spaces. +define RPM_TO_USERSPACE + $(call TYPE_IS_WILDCARD, $(1), $(call RPM_TO_USERSPACE_CHECK_WILDCARD,$(1),$(2)),$(call RPM_TO_USERSPACE_CHECK_FILE,$(1),$(2))) +endef + +define RPM_TO_USERSPACE_ALWAYS + rpm2cpio $(2)/*.$(RPM_ARCH).rpm | (cd userspace; cpio -i -d $(1) 2>/dev/null) +endef + +define RPM_INSTALL + rpm2cpio $(1)/*.$(RPM_ARCH).rpm | (cd userspace; cpio -i -d 2>/dev/null) +endef + +.PHONY: dist +dist: initramfs-install + +.PHONY: distrib +distrib: dist +ifeq ($(DISTSYSTEMS),) + @echo "DISTSYSTEMS not specified" +else + for s in `echo $(DISTSYSTEMS) | sed 's/,/ /g'`; do \ + cp $(DISTDIR)/common/initramfs.cpio.gz $(TFTPDIR)/tst$${s/tst/}; done +endif + +# For clean/distclean, invoke every subdirectory with a Makefile + +CLEAN_SUBDIRS := $(shell find . -maxdepth 2 -mindepth 1 -name "Makefile" | awk -F\/ '{print $$2}') + +.PHONY: clean +clean: $(CLEAN_SUBDIRS:%=%-clean) root_image-clean + +%-clean: % + if [ -f $?/Makefile ] ; then $(MAKE) $(MFLAGS) -C $? clean || true ;fi +.PHONY: distclean +distclean: $(CLEAN_SUBDIRS:%=%-distclean) root_image-clean + +%-distclean: % + if [ -f $?/Makefile ] ; then $(MAKE) $(MFLAGS) -C $? distclean || true ;fi + +USERSPACE = busybox udev + +USERSPACE_INSTALL = $(USERSPACE:%=%-install) + +.PHONY: $(USERSPACE_INSTALL) + +.PHONY: help +help: + @echo 'Main build targets:' + @echo ' dist - build and install root_image initramfs into dist/' + @echo ' distrib - dist + copy initramfs to areas specified by DISTSYSTEMS' + @echo '' + @echo 'Cleaning targets:' + @echo ' clean - remove compiled files' + @echo ' distclean - remove all generated files' + @echo '' + +.PHONY: distdir +distdir: + $(INSTALL_DIR) $(DISTDIR)/common/ + + +# This target includes all userspace tools and images +# It does not include the Linux drivers/modules found in the modulespace target +.PHONY: root_image-userspace-install +root_image-userspace-install: $(USERSPACE_INSTALL) add-libs add-bins add-debug-bins tools-install wget-install vim-install rsync-install openssh-install xtt-tools-install netperf-install lvm2-install plymouth-install pciutils-install iscsi-install bridge-utils-install xend-install nfs-install + + rm -rf userspace/man + rm -rf userspace/usr/share/man + rm -rf userspace/usr/share/doc + rm -rf userspace/usr/share/info + # No setuid for us. + find userspace -type f \( -perm -4000 -o -perm -2000 \) -exec chmod a-s '{}' \; +ifeq ($(NO_LDD_CHECK),) + find userspace/ -type f | xargs ./ldd-check.pl +endif + +.PHONY: root_image-clean +root_image-clean: + rm -fr userspace modulespace $(DISTDIR) + +.PHONY: add-libs +add-libs: userspace-prep root_image-tools-install +ifeq ($(RPM_ARCH), x86_64) + $(call RPM_TO_USERSPACE,*ld-linux-x86-64.so*,$(RPM_DIR)/glibc) +else + $(call RPM_TO_USERSPACE,*ld-linux.so*,$(RPM_DIR)/glibc) +endif + $(call RPM_TO_USERSPACE,*ld-$(GLIBC_VERSION).so*,$(RPM_DIR)/glibc) + $(call RPM_TO_USERSPACE,*libc.so*,$(RPM_DIR)/glibc) + $(call RPM_TO_USERSPACE,*libc-$(GLIBC_VERSION).so*,$(RPM_DIR)/glibc) + $(call RPM_TO_USERSPACE,*libpthread.so*,$(RPM_DIR)/glibc) + $(call RPM_TO_USERSPACE,*libpthread-$(GLIBC_VERSION).so*,$(RPM_DIR)/glibc) + $(call RPM_TO_USERSPACE,*libm.so*,$(RPM_DIR)/glibc) + $(call RPM_TO_USERSPACE,*libm-$(GLIBC_VERSION).so*,$(RPM_DIR)/glibc) + $(call RPM_TO_USERSPACE,*libnsl.so*,$(RPM_DIR)/glibc) + $(call RPM_TO_USERSPACE,*libnsl-$(GLIBC_VERSION).so*,$(RPM_DIR)/glibc) + $(call RPM_TO_USERSPACE,*libdl.so*,$(RPM_DIR)/glibc) + $(call RPM_TO_USERSPACE,*libdl-$(GLIBC_VERSION).so*,$(RPM_DIR)/glibc) + $(call RPM_TO_USERSPACE,*libresolv.so*,$(RPM_DIR)/glibc) + $(call RPM_TO_USERSPACE,*libnss_files.so*,$(RPM_DIR)/glibc) + $(call RPM_TO_USERSPACE,*libnss_files-$(GLIBC_VERSION).so*,$(RPM_DIR)/glibc) + $(call RPM_TO_USERSPACE,*librt.so*,$(RPM_DIR)/glibc) + $(call RPM_TO_USERSPACE,*librt-$(GLIBC_VERSION).so*,$(RPM_DIR)/glibc) + $(call RPM_TO_USERSPACE,*libutil.so*,$(RPM_DIR)/glibc) + $(call RPM_TO_USERSPACE,*libutil-$(GLIBC_VERSION).so*,$(RPM_DIR)/glibc) + $(call RPM_TO_USERSPACE,*libresolv-$(GLIBC_VERSION).so*,$(RPM_DIR)/glibc) + $(call RPM_TO_USERSPACE,*libresolv.so*,$(RPM_DIR)/glibc) + $(call RPM_TO_USERSPACE,*libnss_files.so*,$(RPM_DIR)/glibc) + $(call RPM_TO_USERSPACE,*libnss_files-$(GLIBC_VERSION).so*,$(RPM_DIR)/glibc) + $(call RPM_TO_USERSPACE,*libnss_dns.so*,$(RPM_DIR)/glibc) + $(call RPM_TO_USERSPACE,*libnss_dns-$(GLIBC_VERSION).so*,$(RPM_DIR)/glibc) + $(call RPM_TO_USERSPACE,*libnss_compat.so*,$(RPM_DIR)/glibc) + $(call RPM_TO_USERSPACE,*libnss_compat-$(GLIBC_VERSION).so*,$(RPM_DIR)/glibc) + $(call RPM_TO_USERSPACE,*libcrypt-$(GLIBC_VERSION).so*,$(RPM_DIR)/glibc) + $(call RPM_TO_USERSPACE,*libcrypt.so*,$(RPM_DIR)/glibc) + + $(call RPM_TO_USERSPACE_ALWAYS,*$(LIBSDIR)/libgcc_s.so*,$(RPM_DIR)/libgcc) + $(call RPM_TO_USERSPACE_ALWAYS,*$(LIBSDIR)/libgcc_s-*.so*,$(RPM_DIR)/libgcc) + $(call RPM_TO_USERSPACE,*libcrypto.so*,$(RPM_DIR)/openssl) + +ifdef FC12_RPM + $(call RPM_TO_USERSPACE,*libuuid.so*,$(RPM_DIR)/libuuid) + $(call RPM_TO_USERSPACE,*libcom_err.so*,$(RPM_DIR)/libcom_err) + $(call RPM_TO_USERSPACE,*libblkid.so*,$(RPM_DIR)/libblkid) +else + $(call RPM_TO_USERSPACE,*libuuid.so*,$(RPM_DIR)/e2fsprogs-libs) + $(call RPM_TO_USERSPACE,*libcom_err.so*,$(RPM_DIR)/e2fsprogs-libs) + $(call RPM_TO_USERSPACE,*libblkid.so*,$(RPM_DIR)/e2fsprogs-libs) +endif + $(call RPM_TO_USERSPACE,*libe2p.so*,$(RPM_DIR)/e2fsprogs-libs) + $(call RPM_TO_USERSPACE,*libext2fs.so*,$(RPM_DIR)/e2fsprogs-libs) + + $(call RPM_TO_USERSPACE,*libz.so*,$(RPM_DIR)/zlib) + $(call RPM_TO_USERSPACE,*libbz2.so*,$(RPM_DIR)/bzip2-libs) + $(call RPM_TO_USERSPACE,*libncursesw.so*,$(RPM_DIR)/ncurses-libs) + $(call RPM_TO_USERSPACE,*libncurses.so*,$(RPM_DIR)/ncurses-libs) + $(call RPM_TO_USERSPACE,*libpanel.so*,$(RPM_DIR)/ncurses-libs) +ifdef FC13 + $(call RPM_TO_USERSPACE,*libpanelw.so*,$(RPM_DIR)/ncurses-libs) +endif + $(call RPM_TO_USERSPACE,*libtinfo.so*,$(RPM_DIR)/ncurses-libs) + + $(call RPM_TO_USERSPACE,*libreadline.so*,$(RPM_DIR)/readline) + $(call RPM_TO_USERSPACE,*libhistory.so*,$(RPM_DIR)/readline) +ifdef FC12_RPM + $(call RPM_TO_USERSPACE,*libsysfs.so*,$(RPM_DIR)/libsysfs) +else + $(call RPM_TO_USERSPACE,*libsysfs.so*,$(RPM_DIR)/sysfsutils) +endif + + $(call RPM_TO_USERSPACE,*libsgutils2.so*,$(RPM_DIR)/sg3_utils-libs) + $(call RPM_TO_USERSPACE,*libproc*.so*,$(RPM_DIR)/procps) + + $(call RPM_TO_USERSPACE,*libselinux.so*,$(RPM_DIR)/libselinux) + $(call RPM_TO_USERSPACE,*libsepol.so*,$(RPM_DIR)/libsepol) + + $(call RPM_TO_USERSPACE,*libtasn1.so*,$(RPM_DIR)/libtasn1) + $(call RPM_TO_USERSPACE,*libgnutls.so*,$(RPM_DIR)/gnutls) + $(call RPM_TO_USERSPACE,*libgcrypt.so*,$(RPM_DIR)/libgcrypt) + $(call RPM_TO_USERSPACE,*libgpg-error.so*,$(RPM_DIR)/libgpg-error) + + $(call RPM_TO_USERSPACE,*libacl.so*,$(RPM_DIR)/libacl) + $(call RPM_TO_USERSPACE,*libattr.so*,$(RPM_DIR)/libattr) + $(call RPM_TO_USERSPACE,*libbfd*.so,$(RPM_DIR)/binutils) + + $(call RPM_TO_USERSPACE,*libpcre.so*,$(RPM_DIR)/pcre) + $(call RPM_TO_USERSPACE,*libcap.so*,$(RPM_DIR)/libcap) + + + $(call RPM_TO_USERSPACE,*libpopt.so*,$(RPM_DIR)/popt) + + $(call RPM_TO_USERSPACE,*libaudit.so*,$(RPM_DIR)/audit-libs) + + $(call RPM_TO_USERSPACE,*libidn.so*,$(RPM_DIR)/libidn) + + $(call RPM_TO_USERSPACE_ALWAYS,\*etc/\*,$(RPM_DIR)/ncurses-base) + $(call RPM_TO_USERSPACE_ALWAYS,*/lib/terminfo/l/*,$(RPM_DIR)/ncurses-base) + $(call RPM_TO_USERSPACE_ALWAYS,*/usr/share/terminfo/l/*,$(RPM_DIR)/ncurses-base) + $(call RPM_TO_USERSPACE_ALWAYS,*/usr/share/zoneinfo/*,$(RPM_DIR)/tzdata) + +.PHONY: add-bins +add-bins: userspace-prep + mkdir -p userspace/usr/share + $(call RPM_TO_USERSPACE,./sbin/mkfs.ext3,$(RPM_DIR)/e2fsprogs) + $(call RPM_TO_USERSPACE,./sbin/fsck.ext3,$(RPM_DIR)/e2fsprogs) + $(call RPM_TO_USERSPACE,./sbin/badblocks,$(RPM_DIR)/e2fsprogs) + $(call RPM_TO_USERSPACE,./sbin/tune2fs,$(RPM_DIR)/e2fsprogs) + $(call RPM_TO_USERSPACE,*libpcap.so*,$(RPM_DIR)/libpcap) + $(call RPM_TO_USERSPACE,./usr/bin/lsscsi,$(RPM_DIR)/lsscsi) + $(call RPM_TO_USERSPACE,./usr/bin/sg_readcap,$(RPM_DIR)/sg3_utils) + $(call RPM_TO_USERSPACE,./usr/bin/sg_inq,$(RPM_DIR)/sg3_utils) + $(call RPM_TO_USERSPACE,./usr/bin/sg_sync,$(RPM_DIR)/sg3_utils) + $(call RPM_TO_USERSPACE,./usr/bin/sg_reset,$(RPM_DIR)/sg3_utils) + $(call RPM_TO_USERSPACE,./sbin/modprobe,$(RPM_DIR)/module-init-tools) + $(call RPM_TO_USERSPACE,./sbin/modinfo,$(RPM_DIR)/module-init-tools) + $(call RPM_TO_USERSPACE,./sbin/nameif,$(RPM_DIR)/net-tools) + $(call RPM_TO_USERSPACE,./bin/bash,$(RPM_DIR)/bash) + $(call RPM_TO_USERSPACE,./bin/sh,$(RPM_DIR)/bash) + $(call RPM_TO_USERSPACE,./usr/bin/nohup,$(RPM_DIR)/coreutils) + $(call RPM_TO_USERSPACE,./sbin/ethtool,$(RPM_DIR)/ethtool) + $(call RPM_TO_USERSPACE,./usr/bin/md5sum,$(RPM_DIR)/coreutils) + $(call RPM_TO_USERSPACE,./usr/bin/stat,$(RPM_DIR)/coreutils) + $(call RPM_TO_USERSPACE,./bin/nice,$(RPM_DIR)/coreutils) + $(call RPM_TO_USERSPACE,./bin/stty,$(RPM_DIR)/coreutils) + $(call RPM_TO_USERSPACE,./bin/dd,$(RPM_DIR)/coreutils) + $(call RPM_TO_USERSPACE,./sbin/ifup,$(RPM_DIR)/initscripts) + $(call RPM_TO_USERSPACE,./sbin/ifdown,$(RPM_DIR)/initscripts) + $(call RPM_TO_USERSPACE,./sbin/consoletype,$(RPM_DIR)/initscripts) + $(call RPM_TO_USERSPACE,./bin/ipcalc,$(RPM_DIR)/initscripts) + $(call RPM_TO_USERSPACE_ALWAYS,*/etc/sysconfig/*,$(RPM_DIR)/initscripts) + $(call RPM_TO_USERSPACE_ALWAYS,*/etc/rc.d/init.d/network,$(RPM_DIR)/initscripts) + $(call RPM_TO_USERSPACE_ALWAYS,*/lib/*,$(RPM_DIR)/initscripts) + $(call RPM_TO_USERSPACE_ALWAYS,*/sbin/*,$(RPM_DIR)/initscripts) + mkdir -p userspace/var/run/netreport + $(call RPM_TO_USERSPACE,./bin/gawk,$(RPM_DIR)/gawk) + + ( cd userspace/bin; ln -sf gawk awk ) + $(call RPM_TO_USERSPACE,./bin/sed,$(RPM_DIR)/sed) + $(call RPM_TO_USERSPACE,./bin/grep,$(RPM_DIR)/grep) + $(call RPM_TO_USERSPACE,./bin/cpio,$(RPM_DIR)/cpio) + $(call RPM_TO_USERSPACE,./usr/sbin/dmidecode,$(RPM_DIR)/dmidecode) + $(call RPM_TO_USERSPACE,./usr/sbin/biosdecode,$(RPM_DIR)/dmidecode) + $(call RPM_TO_USERSPACE,./bin/umount,$(RPM_DIR)/util-linux-ng) + $(call RPM_TO_USERSPACE,./sbin/hwclock,$(RPM_DIR)/util-linux-ng) + $(call RPM_TO_USERSPACE,./usr/sbin/lsof,$(RPM_DIR)/lsof) + $(call RPM_TO_USERSPACE,./sbin/dhclient*,$(RPM_DIR)/dhclient) + $(call RPM_TO_USERSPACE,./usr/bin/idn,$(RPM_DIR)/libidn) + +.PHONY: add-debug-bins +add-debug-bins: root_image-tools-install + @echo "Installing support debug binary zips" + mkdir -p userspace/usr/bin userspace/usr/sbin + mkdir -p userspace/bin userspace/sbin + mkdir -p userspace/usr/bin userspace/usr/sbin + mkdir -p userspace/usr/lib + mkdir -p userspace/usr/share/hwdata + $(call RPM_TO_USERSPACE,./usr/sbin/tcpdump,$(RPM_DIR)/tcpdump) + $(call RPM_TO_USERSPACE,./bin/traceroute,$(RPM_DIR)/traceroute) + $(call RPM_TO_USERSPACE,./usr/bin/strace,$(RPM_DIR)/strace) + $(call RPM_TO_USERSPACE,./usr/bin/slabtop,$(RPM_DIR)/procps) + $(call RPM_TO_USERSPACE,./usr/bin/vmstat,$(RPM_DIR)/procps) + $(call RPM_TO_USERSPACE,./sbin/sysctl,$(RPM_DIR)/procps) + $(call RPM_TO_USERSPACE,./usr/bin/sginfo,$(RPM_DIR)/sg3_utils) + $(call RPM_TO_USERSPACE,./usr/bin/sg_logs,$(RPM_DIR)/sg3_utils) + $(call RPM_TO_USERSPACE,./usr/bin/sg_scan,$(RPM_DIR)/sg3_utils) + $(call RPM_TO_USERSPACE,./usr/bin/sg_turs,$(RPM_DIR)/sg3_utils) + $(call RPM_TO_USERSPACE,./usr/bin/blktrace,$(RPM_DIR)/blktrace) + $(call RPM_TO_USERSPACE,./usr/bin/blkparse,$(RPM_DIR)/blktrace) + $(call RPM_TO_USERSPACE,./usr/sbin/eject,$(RPM_DIR)/eject) + $(call RPM_TO_USERSPACE,./sbin/hdparm,$(RPM_DIR)/hdparm) + $(call RPM_TO_USERSPACE,./usr/bin/sdparm,$(RPM_DIR)/sdparm) + $(call RPM_TO_USERSPACE,./sbin/arp,$(RPM_DIR)/net-tools) + $(call RPM_TO_USERSPACE,./bin/netstat,$(RPM_DIR)/net-tools) + $(call RPM_TO_USERSPACE,*libusb-*.so*,$(RPM_DIR)/libusb) +ifdef FC12_RPM + $(call RPM_TO_USERSPACE,./usr/sbin/lsusb,$(RPM_DIR)/usbutils) +else + $(call RPM_TO_USERSPACE,./sbin/lsusb,$(RPM_DIR)/usbutils) +endif + + $(call RPM_TO_USERSPACE,./usr/share/hwdata/usb.ids,$(RPM_DIR)/hwdata) + +.PHONY: udev-install +udev-install: userspace-prep +ifdef FC12_RPM + $(call RPM_TO_USERSPACE,*libudev.so*,$(RPM_DIR)/libudev) +else + $(call RPM_TO_USERSPACE,*libvolume_id.so*,$(RPM_DIR)/libvolume_id) +endif + $(call RPM_TO_USERSPACE_ALWAYS,\*lib/udev/\*,$(RPM_DIR)/initscripts) + $(call RPM_TO_USERSPACE_ALWAYS,\*bin/\*,$(RPM_DIR)/udev) + $(call RPM_TO_USERSPACE_ALWAYS,\*etc/\*,$(RPM_DIR)/udev) + $(call RPM_TO_USERSPACE_ALWAYS,\*lib/udev/\*,$(RPM_DIR)/udev) + +.PHONY: tools-lib +tools-lib: + $(call RPM_TO_USERSPACE,*libglib*.so*,$(RPM_DIR)/glib2) + +.PHONY: tools-install +tools-install: tools-lib userspace-prep + mkdir -p userspace/var/lib/nfs + mkdir -p userspace/var/lib/nfs/sm + mkdir -p userspace/var/lib/nfs/sm.bak + touch userspace/var/lib/nfs/state + $(call RPM_TO_USERSPACE,./bin/basename,$(RPM_DIR)/coreutils) + $(call RPM_TO_USERSPACE,./bin/cat,$(RPM_DIR)/coreutils) + $(call RPM_TO_USERSPACE,./bin/chgrp,$(RPM_DIR)/coreutils) + $(call RPM_TO_USERSPACE,./bin/chmod,$(RPM_DIR)/coreutils) + $(call RPM_TO_USERSPACE,./bin/chown,$(RPM_DIR)/coreutils) + $(call RPM_TO_USERSPACE,./bin/cp,$(RPM_DIR)/coreutils) + $(call RPM_TO_USERSPACE,./bin/cut,$(RPM_DIR)/coreutils) + $(call RPM_TO_USERSPACE,./bin/date,$(RPM_DIR)/coreutils) + $(call RPM_TO_USERSPACE,./bin/df,$(RPM_DIR)/coreutils) + $(call RPM_TO_USERSPACE,./usr/bin/dirname,$(RPM_DIR)/coreutils) + $(call RPM_TO_USERSPACE,./usr/bin/du,$(RPM_DIR)/coreutils) + $(call RPM_TO_USERSPACE,./bin/echo,$(RPM_DIR)/coreutils) + $(call RPM_TO_USERSPACE,./bin/env,$(RPM_DIR)/coreutils) + $(call RPM_TO_USERSPACE,./usr/bin/expr,$(RPM_DIR)/coreutils) + $(call RPM_TO_USERSPACE,./bin/false,$(RPM_DIR)/coreutils) + $(call RPM_TO_USERSPACE,./usr/bin/head,$(RPM_DIR)/coreutils) + $(call RPM_TO_USERSPACE,./usr/bin/id,$(RPM_DIR)/coreutils) + $(call RPM_TO_USERSPACE,./usr/bin/install,$(RPM_DIR)/coreutils) + $(call RPM_TO_USERSPACE,./bin/kill,$(RPM_DIR)/util-linux-ng) + $(call RPM_TO_USERSPACE,./bin/ln,$(RPM_DIR)/coreutils) + $(call RPM_TO_USERSPACE,./bin/ls,$(RPM_DIR)/coreutils) + $(call RPM_TO_USERSPACE,./bin/mkdir,$(RPM_DIR)/coreutils) + $(call RPM_TO_USERSPACE,./bin/mknod,$(RPM_DIR)/coreutils) + $(call RPM_TO_USERSPACE,./bin/mv,$(RPM_DIR)/coreutils) + $(call RPM_TO_USERSPACE,./bin/pwd,$(RPM_DIR)/coreutils) +ifdef FC13 + $(call RPM_TO_USERSPACE,./bin/readlink,$(RPM_DIR)/coreutils) +else + $(call RPM_TO_USERSPACE,./usr/bin/readlink,$(RPM_DIR)/coreutils) +endif + $(call RPM_TO_USERSPACE,./bin/rm,$(RPM_DIR)/coreutils) + $(call RPM_TO_USERSPACE,./bin/rmdir,$(RPM_DIR)/coreutils) + $(call RPM_TO_USERSPACE,./usr/bin/seq,$(RPM_DIR)/coreutils) + $(call RPM_TO_USERSPACE,./bin/sleep,$(RPM_DIR)/coreutils) + $(call RPM_TO_USERSPACE,./bin/sort,$(RPM_DIR)/coreutils) + $(call RPM_TO_USERSPACE,./bin/sync,$(RPM_DIR)/coreutils) + $(call RPM_TO_USERSPACE,./usr/bin/tail,$(RPM_DIR)/coreutils) + $(call RPM_TO_USERSPACE,./usr/bin/tee,$(RPM_DIR)/coreutils) + $(call RPM_TO_USERSPACE,./usr/bin/test,$(RPM_DIR)/coreutils) + $(call RPM_TO_USERSPACE,./bin/touch,$(RPM_DIR)/coreutils) + $(call RPM_TO_USERSPACE,./usr/bin/tr,$(RPM_DIR)/coreutils) + $(call RPM_TO_USERSPACE,./bin/true,$(RPM_DIR)/coreutils) + $(call RPM_TO_USERSPACE,./usr/bin/tty,$(RPM_DIR)/coreutils) + $(call RPM_TO_USERSPACE,./bin/uname,$(RPM_DIR)/coreutils) + $(call RPM_TO_USERSPACE,./usr/bin/uniq,$(RPM_DIR)/coreutils) + $(call RPM_TO_USERSPACE,./usr/bin/uptime,$(RPM_DIR)/procps) + $(call RPM_TO_USERSPACE,./usr/bin/wc,$(RPM_DIR)/coreutils) + $(call RPM_TO_USERSPACE,./usr/bin/whoami,$(RPM_DIR)/coreutils) + $(call RPM_TO_USERSPACE,./usr/bin/yes,$(RPM_DIR)/coreutils) + $(call RPM_TO_USERSPACE,./bin/dmesg,$(RPM_DIR)/util-linux-ng) + $(call RPM_TO_USERSPACE,./usr/bin/logger,$(RPM_DIR)/util-linux-ng) + $(call RPM_TO_USERSPACE,./bin/more,$(RPM_DIR)/util-linux-ng) + $(call RPM_TO_USERSPACE,./bin/mount,$(RPM_DIR)/util-linux-ng) + $(call RPM_TO_USERSPACE,./sbin/fdisk,$(RPM_DIR)/util-linux-ng) + $(call RPM_TO_USERSPACE,./sbin/losetup,$(RPM_DIR)/util-linux-ng) + $(call RPM_TO_USERSPACE,./sbin/pivot_root,$(RPM_DIR)/util-linux-ng) + $(call RPM_TO_USERSPACE,./sbin/swapon,$(RPM_DIR)/util-linux-ng) + $(call RPM_TO_USERSPACE,./sbin/swapoff,$(RPM_DIR)/util-linux-ng) + $(call RPM_TO_USERSPACE,./usr/bin/hexdump,$(RPM_DIR)/util-linux-ng) + $(call RPM_TO_USERSPACE,./usr/bin/time,$(RPM_DIR)/time) + $(call RPM_TO_USERSPACE,./usr/bin/which,$(RPM_DIR)/which) + $(call RPM_TO_USERSPACE_ALWAYS,./bin/egrep,$(RPM_DIR)/grep) + $(call RPM_TO_USERSPACE_ALWAYS,./bin/fgrep,$(RPM_DIR)/grep) + $(call RPM_TO_USERSPACE,./bin/find,$(RPM_DIR)/findutils) + $(call RPM_TO_USERSPACE,./usr/bin/xargs,$(RPM_DIR)/findutils) + $(call RPM_TO_USERSPACE,./usr/bin/bzip2,$(RPM_DIR)/bzip2) + $(call RPM_TO_USERSPACE,./usr/bin/bunzip2,$(RPM_DIR)/bzip2) + $(call RPM_TO_USERSPACE,./usr/bin/bzcat,$(RPM_DIR)/bzip2) + $(call RPM_TO_USERSPACE,./bin/gunzip,$(RPM_DIR)/gzip) + $(call RPM_TO_USERSPACE,./bin/gzip,$(RPM_DIR)/gzip) + $(call RPM_TO_USERSPACE,./bin/zcat,$(RPM_DIR)/gzip) + $(call RPM_TO_USERSPACE,./usr/bin/cmp,$(RPM_DIR)/diffutils) + $(call RPM_TO_USERSPACE,./usr/bin/diff,$(RPM_DIR)/diffutils) + $(call RPM_TO_USERSPACE,./sbin/insmod,$(RPM_DIR)/module-init-tools) + $(call RPM_TO_USERSPACE,./sbin/lsmod,$(RPM_DIR)/module-init-tools) + $(call RPM_TO_USERSPACE,./sbin/rmmod,$(RPM_DIR)/module-init-tools) + $(call RPM_TO_USERSPACE,./usr/bin/clear,$(RPM_DIR)/ncurses) + $(call RPM_TO_USERSPACE,./usr/bin/tset,$(RPM_DIR)/ncurses) + $(call RPM_TO_USERSPACE,./usr/bin/reset,$(RPM_DIR)/ncurses) +ifdef FC13 + $(call RPM_TO_USERSPACE,./bin/hostname,$(RPM_DIR)/hostname) +else + $(call RPM_TO_USERSPACE,./bin/hostname,$(RPM_DIR)/net-tools) +endif + $(call RPM_TO_USERSPACE,./sbin/ifconfig,$(RPM_DIR)/net-tools) + $(call RPM_TO_USERSPACE,./sbin/route,$(RPM_DIR)/net-tools) + $(call RPM_TO_USERSPACE,./usr/bin/free,$(RPM_DIR)/procps) + $(call RPM_TO_USERSPACE,./usr/bin/top,$(RPM_DIR)/procps) + $(call RPM_TO_USERSPACE,./bin/ps,$(RPM_DIR)/procps) + $(call RPM_TO_USERSPACE,./usr/bin/strings,$(RPM_DIR)/binutils) + $(call RPM_TO_USERSPACE,./usr/bin/chvt,$(RPM_DIR)/kbd) + $(call RPM_TO_USERSPACE,./usr/bin/deallocvt,$(RPM_DIR)/kbd) + $(call RPM_TO_USERSPACE,./usr/bin/openvt,$(RPM_DIR)/kbd) + $(call RPM_TO_USERSPACE,./sbin/ip,$(RPM_DIR)/iproute) + $(call RPM_TO_USERSPACE,./bin/ping,$(RPM_DIR)/iputils) + $(call RPM_TO_USERSPACE,./bin/ping6,$(RPM_DIR)/iputils) + $(call RPM_TO_USERSPACE,./sbin/mingetty,$(RPM_DIR)/mingetty) + $(call RPM_TO_USERSPACE,./bin/mktemp,$(RPM_DIR)/coreutils) + $(call RPM_TO_USERSPACE,./usr/bin/killall,$(RPM_DIR)/psmisc) + $(call RPM_TO_USERSPACE,./sbin/klogd,$(RPM_DIR)/sysklogd) + $(call RPM_TO_USERSPACE,./sbin/syslogd,$(RPM_DIR)/sysklogd) +ifdef FC12_RPM + $(call RPM_TO_USERSPACE,./sbin/killall5,$(RPM_DIR)/sysvinit-tools) + $(call RPM_TO_USERSPACE,./sbin/pidof,$(RPM_DIR)/sysvinit-tools) +else + $(call RPM_TO_USERSPACE,./sbin/killall5,$(RPM_DIR)/sysvinit) + $(call RPM_TO_USERSPACE,./sbin/pidof,$(RPM_DIR)/sysvinit) +endif + $(call RPM_TO_USERSPACE,./bin/usleep,$(RPM_DIR)/initscripts) +ifdef 0 + $(call RPM_TO_USERSPACE,./sbin/reboot,$(RPM_DIR)/upstart) + $(call RPM_TO_USERSPACE,./sbin/halt,$(RPM_DIR)/upstart) + $(call RPM_TO_USERSPACE,./sbin/poweroff,$(RPM_DIR)/upstart) + $(call RPM_TO_USERSPACE,./sbin/shutdown,$(RPM_DIR)/upstart) +endif + $(call RPM_TO_USERSPACE,./bin/tar,$(RPM_DIR)/tar) + $(call RPM_TO_USERSPACE,./usr/bin/unzip,$(RPM_DIR)/unzip) + $(call RPM_TO_USERSPACE,./sbin/vconfig,$(RPM_DIR)/vconfig) +ifdef FC12_RPM + $(call RPM_TO_USERSPACE,*libcap-ng.so*,$(RPM_DIR)/libcap-ng) +endif + $(call RPM_TO_USERSPACE,./usr/sbin/irqbalance,$(RPM_DIR)/irqbalance) + $(call RPM_TO_USERSPACE,./sbin/mingetty,$(RPM_DIR)/mingetty) + + +.PHONY: wget-install +wget-install: + $(call RPM_TO_USERSPACE,./usr/bin/wget,$(RPM_DIR)/wget) + +.PHONY: vim-install +vim-install: + $(call RPM_TO_USERSPACE,*/libperl.so,$(RPM_DIR)/perl-libs) +ifndef FC13 + # don't do this under FC13. + (cd userspace/usr/lib; rm -f libperl.so;ln -sf `find ../../ -name libperl.so`) +endif + $(call RPM_TO_USERSPACE,*libpython*.so*,$(RPM_DIR)/python-libs) +ifdef FC13 + $(call RPM_TO_USERSPACE,*libgmp.so*,$(RPM_DIR)/gmp) + $(call RPM_TO_USERSPACE,*libruby.so*,$(RPM_DIR)/ruby-libs) +endif + $(call RPM_TO_USERSPACE,*libgpm.so*,$(RPM_DIR)/gpm-libs) + $(call RPM_TO_USERSPACE,./usr/bin/vim,$(RPM_DIR)/vim-enhanced) + +.PHONY: openssh-lib-deps +openssh-lib-deps: + $(call RPM_TO_USERSPACE,*libpam.so*,$(RPM_DIR)/pam) + $(call RPM_TO_USERSPACE,*libfipscheck.so*,$(RPM_DIR)/fipscheck-lib) + $(call RPM_TO_USERSPACE,*libnss3.so*,$(RPM_DIR)/nss) +ifdef FC12_RPM + $(call RPM_TO_USERSPACE,*libnssutil3.so*,$(RPM_DIR)/nss-util) +else + $(call RPM_TO_USERSPACE,*libnssutil3.so*,$(RPM_DIR)/nss) +endif +ifeq ($(RPM_ARCH), x86_64) + $(call RPM_TO_USERSPACE_ALWAYS,\*lib64/\*,$(RPM_DIR)/nspr) +else + $(call RPM_TO_USERSPACE_ALWAYS,\*lib/\*,$(RPM_DIR)/nspr) +endif + $(call RPM_TO_USERSPACE,*libwrap.so*,$(RPM_DIR)/tcp_wrappers-libs) + $(call RPM_TO_USERSPACE,*libfreebl3.so*,$(RPM_DIR)/nss-softokn-freebl) + $(call RPM_TO_USERSPACE,*libkeyutils-*.so*,$(RPM_DIR)/keyutils-libs) + $(call RPM_TO_USERSPACE,*libkeyutils.so*,$(RPM_DIR)/keyutils-libs) + $(call RPM_TO_USERSPACE,*libcrypto.so*,$(RPM_DIR)/openssl) + $(call RPM_TO_USERSPACE,*libssl.so*,$(RPM_DIR)/openssl) + $(call RPM_TO_USERSPACE,*libkrb5.so*,$(RPM_DIR)/krb5-libs) + $(call RPM_TO_USERSPACE,*libk5crypto.so*,$(RPM_DIR)/krb5-libs) + $(call RPM_TO_USERSPACE,*libkrb5support.so*,$(RPM_DIR)/krb5-libs) + $(call RPM_TO_USERSPACE,*libgssapi_krb5.so*,$(RPM_DIR)/krb5-libs) + $(call RPM_TO_USERSPACE,*libedit.so*,$(RPM_DIR)/libedit) + +.PHONY: openssh-install +openssh-install: openssh-lib-deps + mkdir -p userspace/etc/ssh +ifeq ($(RPM_ARCH), x86_64) + mkdir -p userspace/usr/lib64 +else + mkdir -p userspace/usr/lib +endif + mkdir -p userspace/usr/bin userspace/usr/sbin + mkdir -p userspace/root/ + mkdir -p userspace/root/.ssh + $(call RPM_TO_USERSPACE,./usr/bin/openssl,$(RPM_DIR)/openssl) + $(call RPM_TO_USERSPACE,./etc/ssh/sshd_config,$(RPM_DIR)/openssh-server) + $(call RPM_TO_USERSPACE,./etc/ssh/ssh_config,$(RPM_DIR)/openssh-clients) + $(call RPM_TO_USERSPACE,./usr/sbin/sshd,$(RPM_DIR)/openssh-server) + $(call RPM_TO_USERSPACE,./usr/bin/ssh,$(RPM_DIR)/openssh-clients) + $(call RPM_TO_USERSPACE,./usr/bin/scp,$(RPM_DIR)/openssh-clients) + $(call RPM_TO_USERSPACE,./usr/bin/sftp,$(RPM_DIR)/openssh-clients) + $(call RPM_TO_USERSPACE,./usr/bin/ssh-keygen,$(RPM_DIR)/openssh) + ( cd userspace/etc/ssh ; sed -e 's/^UsePAM yes/\#UsePAM yes/' --in-place sshd_config ) + #( cd userspace/etc/ssh ; sed -e 's/^PasswordAuthentication no/\#PasswordAuthentication no/' --in-place sshd_config ) + +.PHONY: rsync-install +rsync-install: + $(call RPM_TO_USERSPACE,./usr/bin/rsync,$(RPM_DIR)/rsync) + +.PHONY: netperf-install +netperf-install: + if ! [ -e netperf/config.h ]; then (cd netperf; ./autogen.sh;./configure --prefix=/usr); fi + $(MAKE) $(MFLAGS) -C netperf + + $(INSTALL_PROG) netperf/src/netperf userspace/usr/bin/ + $(INSTALL_PROG) netperf/src/netserver userspace/usr/bin/ + +.PHONY: pciutils-install +pciutils-install: + mkdir -p userspace/usr/local/share + $(MAKE) $(MFLAGS) -C pciutils PREFIX=/ + $(MAKE) $(MFLAGS) -C pciutils PREFIX=../userspace install + $(INSTALL_DATA) pciutils/pci.ids.gz userspace/usr/local/share/pci.ids.gz + (cd userspace/lib;chmod 755 libpci*.so.*) + (cd userspace/usr$(LIBSDIR); ln -fs ../../lib/libpci.so.3) +ifeq ($(RPM_ARCH), x86_64) + (cd userspace/$(LIBSDIR); ln -fs ../lib/libpci.so.3) +endif + +.PHONY: lvm2-install +lvm2-install: userspace-prep $(RPMs-repo-exists) + $(call RPM_TO_USERSPACE,*libdevmapper.so*,$(RPM_DIR)/device-mapper-libs) +ifdef FC12_RPM + $(call RPM_TO_USERSPACE,*/libdevmapper-event.so*,$(RPM_DIR)/device-mapper-event-libs) +endif + $(call RPM_INSTALL,$(RPM_DIR)/lvm2) + +.PHONY: fb-install +fb-install: + $(call RPM_TO_USERSPACE,./usr/sbin/fbset,$(RPM_DIR)/fbset) + $(call RPM_TO_USERSPACE,./usr/sbin/modeline2fb,$(RPM_DIR)/fbset) + $(call RPM_TO_USERSPACE,./etc/fb.modes,$(RPM_DIR)/fbset) + +.PHONY: plymouth-install +plymouth-install: userspace-prep fb-install + $(call RPM_TO_USERSPACE,./bin/plymouth,$(RPM_DIR)/plymouth) + $(call RPM_TO_USERSPACE,./sbin/plymouthd,$(RPM_DIR)/plymouth) + $(call RPM_TO_USERSPACE,*$(LIBSDIR)/plymouth/*,$(RPM_DIR)/plymouth) + $(call RPM_TO_USERSPACE,./usr/share/plymouth/themes/*,$(RPM_DIR)/plymouth) + $(call RPM_TO_USERSPACE,./usr$(LIBSDIR)/libpng.so*,$(RPM_DIR)/libpng) + $(call RPM_TO_USERSPACE,./usr$(LIBSDIR)/libpng12.so*,$(RPM_DIR)/libpng) +ifdef FC13 + $(call RPM_TO_USERSPACE,.$(LIBSDIR)/libply.so.*,$(RPM_DIR)/plymouth-core-libs) + $(call RPM_TO_USERSPACE,.$(LIBSDIR)/libply-splash-core.so*,$(RPM_DIR)/plymouth-core-libs) + $(call RPM_TO_USERSPACE,./usr$(LIBSDIR)/libply-splash-graphics*.so*,$(RPM_DIR)/plymouth-graphics-libs) +else + $(call RPM_TO_USERSPACE,.$(LIBSDIR)/libply.so*,$(RPM_DIR)/plymouth-libs) + $(call RPM_TO_USERSPACE,./usr$(LIBSDIR)/libplybootsplash.so*,$(RPM_DIR)/plymouth-libs) +endif + $(call RPM_INSTALL,$(RPM_DIR)/libdrm) + $(call RPM_INSTALL,$(RPM_DIR)/plymouth-plugin-two-step) + $(call RPM_INSTALL,$(RPM_DIR)/plymouth-plugin-fade-throbber) + $(call RPM_INSTALL,$(RPM_DIR)/plymouth-plugin-space-flares) + $(call RPM_INSTALL,$(RPM_DIR)/plymouth-plugin-throbgress) + $(call RPM_INSTALL,$(RPM_DIR)/plymouth-theme-charge) +ifdef FC12 + $(call RPM_INSTALL,$(RPM_DIR)/plymouth-theme-fade) +endif + $(call RPM_INSTALL,$(RPM_DIR)/plymouth-theme-solar) + $(call RPM_INSTALL,$(RPM_DIR)/plymouth-theme-spinfinity) + (cd userspace/usr/share/plymouth/themes; ln -fs charge/charge.plymout default.plymouth) + mkdir -p userspace/usr/share/pixmaps + $(INSTALL_DATA) $(RPM_DIR)/system-logo-white/system-logo-white.png userspace/usr/share/pixmaps/system-logo-white.png + +.PHONY: iscsi-install +iscsi-install: + $(call RPM_TO_USERSPACE,./sbin/iscsiadm,$(RPM_DIR)/iscsi-initiator-utils) + $(call RPM_TO_USERSPACE,./sbin/iscsistart,$(RPM_DIR)/iscsi-initiator-utils) + + +.PHONY: bridge-utils-install +bridge-utils-install: userspace-prep $(RPMs-repo-exists) + $(call RPM_INSTALL,$(RPM_DIR)/bridge-utils) + +.PHONY: python-deps +python-deps: + @echo "Installing python deps" + mkdir -p userspace/usr/lib64 + mkdir -p userspace/usr/bin + $(call RPM_TO_USERSPACE,*libssl.so*,$(RPM_DIR)/openssl) + $(call RPM_TO_USERSPACE,*libgdbm.so*,$(RPM_DIR)/gdbm) + $(call RPM_TO_USERSPACE,*libdb-*.so*,$(RPM_DIR)/db4) + $(call RPM_TO_USERSPACE,*libbz2.so*,$(RPM_DIR)/bzip2-libs) + $(call RPM_TO_USERSPACE,*liblzma.so*,$(RPM_DIR)/xz-libs) + $(call RPM_TO_USERSPACE,*libpython2.*.so*,$(RPM_DIR)/python-devel) + $(call RPM_TO_USERSPACE,*libxml2.so*,$(RPM_DIR)/libxml2) + $(call RPM_TO_USERSPACE,*libidn.so*,$(RPM_DIR)/libidn) + $(call RPM_TO_USERSPACE,*libexpat.so*,$(RPM_DIR)/expat) + +.PHONY: python-core +python-core: python-deps + @echo "Installing python tools" + $(call RPM_INSTALL,$(RPM_DIR)/python) + ln -sf /usr/bin/env userspace/bin/env + +.PHONY: python-install +python-install: python-core + # Now that python has been installed ... + @echo "Installing python extras" + $(call RPM_INSTALL,$(RPM_DIR)/libxml2-python) + #rm -f userspace/usr/lib64/python2.6/site-packages/libxml2mod.la + #rm -f userspace/usr/lib64/python2.6/lib-dynload/pyexpat.so + rm -f userspace/usr/lib64/python2.6/lib-dynload/_ctypes.so + rm -f userspace/usr/lib64/python2.6/lib-dynload/_sqlite3.so + rm -f userspace/usr/lib64/python2.6/idlelib/*.bat + +.PHONY: xen-python-bytecode +xen-python-bytecode: python-install + make -C ../xen/tools/python DESTDIR=$(CURDIR)/userspace install + +XEN_SRC = $(dir $(CURDIR))xen +XEN_DISTDIR = $(dir $(CURDIR))xen/dist/install + +.PHONY: xend-install +xend-install: xen-python-bytecode +# Install all of xen + cp -rdf $(XEN_DISTDIR)/usr userspace/ + cp -rdf $(XEN_DISTDIR)/etc userspace/ + cp -rdf $(XEN_DISTDIR)/var userspace/ + find userspace/usr/$(LIBSDIR) -name '*.so*' ! -type l | xargs chmod a+x +# prune usr/include after copy + rm -rf userspace/usr/include +# make them usable by nex, or xen + if ! test -f userspace/bin/qemu-dm; then \ + ( ln -sf /usr/local/$(LIBSDIR)/xen/bin/qemu-dm userspace/bin/qemu-dm ) \ + fi +# it would be nice if xen could make up their mind where they are +# launching things from + if ! test -f userspace/usr/lib64/xen/bin/qemu-dm; then \ + ( ln -sf /usr/local/$(LIBSDIR)/xen/bin/qemu-dm userspace/usr/lib64/xen/bin/qemu-dm ) \ + fi + if ! test -f userspace/bin/hvmloader; then \ + ( ln -sf /usr/lib/xen/boot/hvmloader userspace/bin/hvmloader ) \ + fi + if [ -e userspace/etc/xen/xend-config.sxp ]; then \ + sed -i 's/\(^[[:blank:]]*(network-script network-bridge)\)/# \1/' userspace/etc/xen/xend-config.sxp; \ + fi + +.PHONY: nfs-install +nfs-install: + $(call RPM_TO_USERSPACE,*libgssglue*,$(RPM_DIR)/libgssglue) + $(call RPM_TO_USERSPACE,*libtirpc*,$(RPM_DIR)/libtirpc) + $(call RPM_TO_USERSPACE,*netconfig*,$(RPM_DIR)/libtirpc) + $(call RPM_TO_USERSPACE,*rpcbind*,$(RPM_DIR)/rpcbind) + $(call RPM_TO_USERSPACE,*rpcinfo*,$(RPM_DIR)/rpcbind) + $(call RPM_TO_USERSPACE,*mount.nfs*,$(RPM_DIR)/nfs-utils) + $(call RPM_TO_USERSPACE,*showmount*,$(RPM_DIR)/nfs-utils) + $(call RPM_TO_USERSPACE,*mountd*,$(RPM_DIR)/nfs-utils) + $(call RPM_TO_USERSPACE,*rpc.statd*,$(RPM_DIR)/nfs-utils) + $(call RPM_TO_USERSPACE,*sm-notify*,$(RPM_DIR)/nfs-utils) + $(call RPM_INSTALL,$(RPM_DIR)/setup) + (cd userspace/etc;chmod 600 *shadow) + #(cd userspace/usr/sbin; rm -f rpc.*) + +.PHONY: busybox-install +busybox-install: userspace-prep busybox/.config + $(MAKE) $(MFLAGS) -C busybox CONFIG_PREFIX=../userspace install + mv userspace/linuxrc userspace/init + ( cd userspace; ln -sf /sbin/init init ) + +busybox/.config: busybox.config + cp busybox.config $@ + $(MAKE) -C busybox oldconfig + +.PHONY: xtt-tools-install +xtt-tools-install: + LDLIBS="-L$(shell pwd)/userspace/$(LIBSDIR)" $(MAKE) $(MFLAGS) -C tools + $(INSTALL_PROG) tools/ssh_support/ssh-shadowgen userspace/usr/sbin/ + $(INSTALL_SCRIPT) tools/ssh_support/sshd_server userspace/usr/bin/ + $(INSTALL_PROG) tools/load_xen_modules/xen-detect userspace/usr/bin/ + $(INSTALL_SCRIPT) tools/load_xen_modules/load_xen_modules userspace/usr/bin/ + $(INSTALL_PROG) tools/iostat-2.2/iostat userspace/usr/bin/ + $(INSTALL_PROG) tools/debug/fb_test userspace/usr/bin/ + +.PHONY: root_image-tools-install +root_image-tools-install: userspace-prep + + +.PHONY: initramfs +initramfs: distdir + time sh $(LINUX_SRC)/scripts/gen_initramfs_list.sh \ + -u $(shell id -u) -g $(shell id -g) \ + {user,module}space/ $(wildcard debugspace/) \ + | $(LINUX_DST)/usr/gen_init_cpio /proc/self/fd/0 \ + | gzip -c -f > $(DISTDIR)/common/initramfs.cpio.gz + + +.PHONY: linux-modules-prep + +$(USERSPACE_INSTALL): userspace-prep $(LINUX_SRC) + +USERSPACE_DIRS = bin/ \ + sbin/ \ + usr/ usr/bin/ usr/sbin/ \ + proc/ sys/ \ + etc/ \ + etc/sysconfig \ + $(LIBSDIR)/ usr/$(LIBSDIR)/ + +ifneq ($(wildcard $(LINUX_DST)/include/config/kernel.release),) +LINUX_VERSION = $(shell cat $(LINUX_DST)/include/config/kernel.release 2>/dev/null) +else +#default to unknown +LINUX_VERSION = UNKNOWN +endif +LOCAL_FIRMWARE_PATH=lib/firmware + +MODULESPACE_DIRS = etc/ etc/modprobe.d/ $(LOCAL_FIRMWARE_PATH) + +modulespace/% userspace/%: + $(INSTALL_DIR) $@ + +.PHONY: userspace-prep +userspace-prep: $(USERSPACE_DIRS:%=userspace/%) + find etc \( -name SCCS -prune \) -o -print | \ + cpio -p userspace 2>/dev/null + if [ -e init.local ]; then $(INSTALL_SCRIPT) init.local userspace/; fi + echo "NEB Release $(RELEASE_ID)" > userspace/etc/release-info + +.PHONY: modulespace-prep +modulespace-prep: $(MODULESPACE_DIRS:%=modulespace/%) + mkdir -p modulespace + echo "NEB Modules Release $(RELEASE_ID)" > modulespace/etc/modules-release-info + +.PHONY: linux-map-exists +linux-map-exists: + if ! [ -f $(LINUX_DST)/System.map ]; then $(MAKE) $(MFLAGS) linux-install; fi + +.PHONY: modulespace-install +modulespace/lib/modules/$(LINUX_VERSION)/modules.dep: $(LINUX_DST)/modulespace/lib/modules/$(LINUX_VERSION)/modules.dep + $(INSTALL_DIR) $(dir $@) + cp -r $(dir $<)* $(dir $@) + +.PHONY: linux-modules-install +linux-modules-install: modulespace/lib/modules/$(LINUX_VERSION)/modules.dep + +modulespace-install: modulespace-prep linux-modules-install local-firmware-install + if [ -d $(CURDIR)/drivers ]; then \ + $(MAKE) $(MFLAGS) V=1 -C $(LINUX_DST) \ + SUBDIRS=$(CURDIR)/drivers modules; \ + $(MAKE) $(MFLAGS) -C $(LINUX_DST) \ + SUBDIRS=$(CURDIR)/drivers \ + INSTALL_MOD_PATH=$(CURDIR)/modulespace/ modules_install; \ + fi + +QLOGIC_PATH=$(RPM_DIR)/qlogic-firmware/ + +.PHONY: local-firmware-install +local-firmware-install: modulespace-prep + if [ -d $(QLOGIC_PATH) ] ; then \ + $(INSTALL_DATA) $(QLOGIC_PATH)*.bin modulespace/$(LOCAL_FIRMWARE_PATH)/ ; \ + $(INSTALL_DATA) $(QLOGIC_PATH)LICENSE modulespace/$(LOCAL_FIRMWARE_PATH)/ ; \ + $(INSTALL_DATA) $(QLOGIC_PATH)CURRENT_VERSIONS modulespace/$(LOCAL_FIRMWARE_PATH)/ ; \ + fi + FIRMWARES="3com e100 radeon"; \ + for firmware in $$FIRMWARES; do \ + mkdir modulespace/$(LOCAL_FIRMWARE_PATH)/$$firmware; \ + for i in `find $(LINUX_DST)/modulespace/lib/firmware/$$firmware`; \ + do \ + echo "File: $$i"; \ + if [ -f "$$i" ]; then \ + $(INSTALL_DATA) $$i modulespace/$(LOCAL_FIRMWARE_PATH)/$$firmware; \ + fi; \ + done; \ + done + +.PHONY: syslinux-clean +syslinux-clean: + $(MAKE) -C syslinux/menu clean + +.PHONY: syslinux-distclean +syslinux-distclean: + $(MAKE) -C syslinux/menu clean + +.PHONY: initramfs-install +initramfs-install: root_image-userspace-install modulespace-install $(LINUX_DST)/usr/gen_init_cpio + $(MAKE) $(MFLAGS) initramfs + diff --git a/root_image/busybox.config b/root_image/busybox.config new file mode 100644 index 0000000..96fd6e7 --- /dev/null +++ b/root_image/busybox.config @@ -0,0 +1,864 @@ +# +# Automatically generated make config: don't edit +# Busybox version: 1.14.3 +# Fri Aug 14 21:31:01 2009 +# +CONFIG_HAVE_DOT_CONFIG=y + +# +# Busybox Settings +# + +# +# General Configuration +# +# CONFIG_DESKTOP is not set +# CONFIG_EXTRA_COMPAT is not set +# CONFIG_FEATURE_ASSUME_UNICODE is not set +CONFIG_FEATURE_BUFFERS_USE_MALLOC=y +# CONFIG_FEATURE_BUFFERS_GO_ON_STACK is not set +# CONFIG_FEATURE_BUFFERS_GO_IN_BSS is not set +CONFIG_SHOW_USAGE=y +CONFIG_FEATURE_VERBOSE_USAGE=y +CONFIG_FEATURE_COMPRESS_USAGE=y +CONFIG_FEATURE_INSTALLER=y +# CONFIG_LOCALE_SUPPORT is not set +CONFIG_GETOPT_LONG=y +CONFIG_FEATURE_DEVPTS=y +# CONFIG_FEATURE_CLEAN_UP is not set +CONFIG_FEATURE_PIDFILE=y +CONFIG_FEATURE_SUID=y +# CONFIG_FEATURE_SUID_CONFIG is not set +# CONFIG_FEATURE_SUID_CONFIG_QUIET is not set +# CONFIG_SELINUX is not set +# CONFIG_FEATURE_PREFER_APPLETS is not set +CONFIG_BUSYBOX_EXEC_PATH="/proc/self/exe" +CONFIG_FEATURE_SYSLOG=y +# CONFIG_FEATURE_HAVE_RPC is not set + +# +# Build Options +# +# CONFIG_STATIC is not set +# CONFIG_PIE is not set +# CONFIG_NOMMU is not set +# CONFIG_BUILD_LIBBUSYBOX is not set +# CONFIG_FEATURE_INDIVIDUAL is not set +# CONFIG_FEATURE_SHARED_BUSYBOX is not set +CONFIG_LFS=y +CONFIG_CROSS_COMPILER_PREFIX="" +CONFIG_EXTRA_CFLAGS="" + +# +# Debugging Options +# +# CONFIG_DEBUG is not set +# CONFIG_DEBUG_PESSIMIZE is not set +# CONFIG_WERROR is not set +CONFIG_NO_DEBUG_LIB=y +# CONFIG_DMALLOC is not set +# CONFIG_EFENCE is not set +CONFIG_INCLUDE_SUSv2=y + +# +# Installation Options +# +# CONFIG_INSTALL_NO_USR is not set +CONFIG_INSTALL_APPLET_SYMLINKS=y +# CONFIG_INSTALL_APPLET_HARDLINKS is not set +# CONFIG_INSTALL_APPLET_SCRIPT_WRAPPERS is not set +# CONFIG_INSTALL_APPLET_DONT is not set +# CONFIG_INSTALL_SH_APPLET_SYMLINK is not set +# CONFIG_INSTALL_SH_APPLET_HARDLINK is not set +# CONFIG_INSTALL_SH_APPLET_SCRIPT_WRAPPER is not set +CONFIG_PREFIX="./_install" + +# +# Busybox Library Tuning +# +CONFIG_PASSWORD_MINLEN=6 +CONFIG_MD5_SIZE_VS_SPEED=2 +CONFIG_FEATURE_FAST_TOP=y +# CONFIG_FEATURE_ETC_NETWORKS is not set +CONFIG_FEATURE_EDITING=y +CONFIG_FEATURE_EDITING_MAX_LEN=1024 +# CONFIG_FEATURE_EDITING_VI is not set +CONFIG_FEATURE_EDITING_HISTORY=15 +CONFIG_FEATURE_EDITING_SAVEHISTORY=y +CONFIG_FEATURE_TAB_COMPLETION=y +# CONFIG_FEATURE_USERNAME_COMPLETION is not set +# CONFIG_FEATURE_EDITING_FANCY_PROMPT is not set +# CONFIG_FEATURE_VERBOSE_CP_MESSAGE is not set +CONFIG_FEATURE_COPYBUF_KB=4 +# CONFIG_MONOTONIC_SYSCALL is not set +CONFIG_IOCTL_HEX2STR_ERROR=y +# CONFIG_FEATURE_HWIB is not set + +# +# Applets +# + +# +# Archival Utilities +# +# CONFIG_FEATURE_SEAMLESS_LZMA is not set +# CONFIG_FEATURE_SEAMLESS_BZ2 is not set +# CONFIG_FEATURE_SEAMLESS_GZ is not set +# CONFIG_FEATURE_SEAMLESS_Z is not set +# CONFIG_AR is not set +# CONFIG_FEATURE_AR_LONG_FILENAMES is not set +# CONFIG_BUNZIP2 is not set +# CONFIG_BZIP2 is not set +# CONFIG_CPIO is not set +# CONFIG_FEATURE_CPIO_O is not set +# CONFIG_FEATURE_CPIO_P is not set +# CONFIG_DPKG is not set +# CONFIG_DPKG_DEB is not set +# CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY is not set +# CONFIG_GUNZIP is not set +# CONFIG_GZIP is not set +# CONFIG_RPM2CPIO is not set +# CONFIG_RPM is not set +# CONFIG_TAR is not set +# CONFIG_FEATURE_TAR_CREATE is not set +# CONFIG_FEATURE_TAR_AUTODETECT is not set +# CONFIG_FEATURE_TAR_FROM is not set +# CONFIG_FEATURE_TAR_OLDGNU_COMPATIBILITY is not set +# CONFIG_FEATURE_TAR_OLDSUN_COMPATIBILITY is not set +# CONFIG_FEATURE_TAR_GNU_EXTENSIONS is not set +# CONFIG_FEATURE_TAR_LONG_OPTIONS is not set +# CONFIG_FEATURE_TAR_UNAME_GNAME is not set +# CONFIG_UNCOMPRESS is not set +# CONFIG_UNLZMA is not set +# CONFIG_FEATURE_LZMA_FAST is not set +# CONFIG_UNZIP is not set + +# +# Coreutils +# +# CONFIG_BASENAME is not set +# CONFIG_CAL is not set +# CONFIG_CAT is not set +# CONFIG_CATV is not set +# CONFIG_CHGRP is not set +# CONFIG_CHMOD is not set +# CONFIG_CHOWN is not set +# CONFIG_CHROOT is not set +# CONFIG_CKSUM is not set +# CONFIG_COMM is not set +# CONFIG_CP is not set +# CONFIG_CUT is not set +# CONFIG_DATE is not set +# CONFIG_FEATURE_DATE_ISOFMT is not set +# CONFIG_DD is not set +# CONFIG_FEATURE_DD_SIGNAL_HANDLING is not set +# CONFIG_FEATURE_DD_IBS_OBS is not set +# CONFIG_DF is not set +# CONFIG_FEATURE_DF_FANCY is not set +# CONFIG_DIRNAME is not set +# CONFIG_DOS2UNIX is not set +# CONFIG_UNIX2DOS is not set +# CONFIG_DU is not set +# CONFIG_FEATURE_DU_DEFAULT_BLOCKSIZE_1K is not set +# CONFIG_ECHO is not set +# CONFIG_FEATURE_FANCY_ECHO is not set +# CONFIG_ENV is not set +# CONFIG_FEATURE_ENV_LONG_OPTIONS is not set +# CONFIG_EXPAND is not set +# CONFIG_FEATURE_EXPAND_LONG_OPTIONS is not set +# CONFIG_EXPR is not set +# CONFIG_EXPR_MATH_SUPPORT_64 is not set +# CONFIG_FALSE is not set +# CONFIG_FOLD is not set +# CONFIG_HEAD is not set +# CONFIG_FEATURE_FANCY_HEAD is not set +# CONFIG_HOSTID is not set +# CONFIG_ID is not set +# CONFIG_INSTALL is not set +# CONFIG_FEATURE_INSTALL_LONG_OPTIONS is not set +# CONFIG_LENGTH is not set +# CONFIG_LN is not set +# CONFIG_LOGNAME is not set +# CONFIG_LS is not set +# CONFIG_FEATURE_LS_FILETYPES is not set +# CONFIG_FEATURE_LS_FOLLOWLINKS is not set +# CONFIG_FEATURE_LS_RECURSIVE is not set +# CONFIG_FEATURE_LS_SORTFILES is not set +# CONFIG_FEATURE_LS_TIMESTAMPS is not set +# CONFIG_FEATURE_LS_USERNAME is not set +# CONFIG_FEATURE_LS_COLOR is not set +# CONFIG_FEATURE_LS_COLOR_IS_DEFAULT is not set +# CONFIG_MD5SUM is not set +# CONFIG_MKDIR is not set +# CONFIG_FEATURE_MKDIR_LONG_OPTIONS is not set +# CONFIG_MKFIFO is not set +# CONFIG_MKNOD is not set +# CONFIG_MV is not set +# CONFIG_FEATURE_MV_LONG_OPTIONS is not set +# CONFIG_NICE is not set +# CONFIG_NOHUP is not set +# CONFIG_OD is not set +# CONFIG_PRINTENV is not set +# CONFIG_PRINTF is not set +# CONFIG_PWD is not set +# CONFIG_READLINK is not set +# CONFIG_FEATURE_READLINK_FOLLOW is not set +# CONFIG_REALPATH is not set +# CONFIG_RM is not set +# CONFIG_RMDIR is not set +# CONFIG_FEATURE_RMDIR_LONG_OPTIONS is not set +# CONFIG_SEQ is not set +# CONFIG_SHA1SUM is not set +# CONFIG_SHA256SUM is not set +# CONFIG_SHA512SUM is not set +# CONFIG_SLEEP is not set +# CONFIG_FEATURE_FANCY_SLEEP is not set +# CONFIG_FEATURE_FLOAT_SLEEP is not set +# CONFIG_SORT is not set +# CONFIG_FEATURE_SORT_BIG is not set +# CONFIG_SPLIT is not set +# CONFIG_FEATURE_SPLIT_FANCY is not set +# CONFIG_STAT is not set +# CONFIG_FEATURE_STAT_FORMAT is not set +# CONFIG_STTY is not set +# CONFIG_SUM is not set +# CONFIG_SYNC is not set +# CONFIG_TAC is not set +# CONFIG_TAIL is not set +# CONFIG_FEATURE_FANCY_TAIL is not set +# CONFIG_TEE is not set +# CONFIG_FEATURE_TEE_USE_BLOCK_IO is not set +# CONFIG_TEST is not set +# CONFIG_FEATURE_TEST_64 is not set +# CONFIG_TOUCH is not set +# CONFIG_TR is not set +# CONFIG_FEATURE_TR_CLASSES is not set +# CONFIG_FEATURE_TR_EQUIV is not set +# CONFIG_TRUE is not set +# CONFIG_TTY is not set +# CONFIG_UNAME is not set +# CONFIG_UNEXPAND is not set +# CONFIG_FEATURE_UNEXPAND_LONG_OPTIONS is not set +# CONFIG_UNIQ is not set +# CONFIG_USLEEP is not set +# CONFIG_UUDECODE is not set +# CONFIG_UUENCODE is not set +# CONFIG_WC is not set +# CONFIG_FEATURE_WC_LARGE is not set +# CONFIG_WHO is not set +# CONFIG_WHOAMI is not set +# CONFIG_YES is not set +# CONFIG_FEATURE_PRESERVE_HARDLINKS is not set +# CONFIG_FEATURE_AUTOWIDTH is not set +# CONFIG_FEATURE_HUMAN_READABLE is not set +# CONFIG_FEATURE_MD5_SHA1_SUM_CHECK is not set + +# +# Console Utilities +# +# CONFIG_CHVT is not set +# CONFIG_CLEAR is not set +# CONFIG_DEALLOCVT is not set +# CONFIG_DUMPKMAP is not set +# CONFIG_KBD_MODE is not set +# CONFIG_LOADFONT is not set +# CONFIG_LOADKMAP is not set +# CONFIG_OPENVT is not set +# CONFIG_RESET is not set +# CONFIG_RESIZE is not set +# CONFIG_FEATURE_RESIZE_PRINT is not set +# CONFIG_SETCONSOLE is not set +# CONFIG_FEATURE_SETCONSOLE_LONG_OPTIONS is not set +# CONFIG_SETFONT is not set +# CONFIG_FEATURE_SETFONT_TEXTUAL_MAP is not set +CONFIG_DEFAULT_SETFONT_DIR="" +# CONFIG_SETKEYCODES is not set +# CONFIG_SETLOGCONS is not set +# CONFIG_SHOWKEY is not set + +# +# Debian Utilities +# +# CONFIG_MKTEMP is not set +# CONFIG_PIPE_PROGRESS is not set +# CONFIG_RUN_PARTS is not set +# CONFIG_FEATURE_RUN_PARTS_LONG_OPTIONS is not set +# CONFIG_FEATURE_RUN_PARTS_FANCY is not set +# CONFIG_START_STOP_DAEMON is not set +# CONFIG_FEATURE_START_STOP_DAEMON_FANCY is not set +# CONFIG_FEATURE_START_STOP_DAEMON_LONG_OPTIONS is not set +# CONFIG_WHICH is not set + +# +# Editors +# +# CONFIG_AWK is not set +# CONFIG_FEATURE_AWK_LIBM is not set +# CONFIG_CMP is not set +# CONFIG_DIFF is not set +# CONFIG_FEATURE_DIFF_BINARY is not set +# CONFIG_FEATURE_DIFF_DIR is not set +# CONFIG_FEATURE_DIFF_MINIMAL is not set +# CONFIG_ED is not set +# CONFIG_PATCH is not set +# CONFIG_SED is not set +# CONFIG_VI is not set +CONFIG_FEATURE_VI_MAX_LEN=0 +# CONFIG_FEATURE_VI_8BIT is not set +# CONFIG_FEATURE_VI_COLON is not set +# CONFIG_FEATURE_VI_YANKMARK is not set +# CONFIG_FEATURE_VI_SEARCH is not set +# CONFIG_FEATURE_VI_USE_SIGNALS is not set +# CONFIG_FEATURE_VI_DOT_CMD is not set +# CONFIG_FEATURE_VI_READONLY is not set +# CONFIG_FEATURE_VI_SETOPTS is not set +# CONFIG_FEATURE_VI_SET is not set +# CONFIG_FEATURE_VI_WIN_RESIZE is not set +# CONFIG_FEATURE_VI_OPTIMIZE_CURSOR is not set +# CONFIG_FEATURE_ALLOW_EXEC is not set + +# +# Finding Utilities +# +# CONFIG_FIND is not set +# CONFIG_FEATURE_FIND_PRINT0 is not set +# CONFIG_FEATURE_FIND_MTIME is not set +# CONFIG_FEATURE_FIND_MMIN is not set +# CONFIG_FEATURE_FIND_PERM is not set +# CONFIG_FEATURE_FIND_TYPE is not set +# CONFIG_FEATURE_FIND_XDEV is not set +# CONFIG_FEATURE_FIND_MAXDEPTH is not set +# CONFIG_FEATURE_FIND_NEWER is not set +# CONFIG_FEATURE_FIND_INUM is not set +# CONFIG_FEATURE_FIND_EXEC is not set +# CONFIG_FEATURE_FIND_USER is not set +# CONFIG_FEATURE_FIND_GROUP is not set +# CONFIG_FEATURE_FIND_NOT is not set +# CONFIG_FEATURE_FIND_DEPTH is not set +# CONFIG_FEATURE_FIND_PAREN is not set +# CONFIG_FEATURE_FIND_SIZE is not set +# CONFIG_FEATURE_FIND_PRUNE is not set +# CONFIG_FEATURE_FIND_DELETE is not set +# CONFIG_FEATURE_FIND_PATH is not set +# CONFIG_FEATURE_FIND_REGEX is not set +# CONFIG_FEATURE_FIND_CONTEXT is not set +# CONFIG_GREP is not set +# CONFIG_FEATURE_GREP_EGREP_ALIAS is not set +# CONFIG_FEATURE_GREP_FGREP_ALIAS is not set +# CONFIG_FEATURE_GREP_CONTEXT is not set +# CONFIG_XARGS is not set +# CONFIG_FEATURE_XARGS_SUPPORT_CONFIRMATION is not set +# CONFIG_FEATURE_XARGS_SUPPORT_QUOTES is not set +# CONFIG_FEATURE_XARGS_SUPPORT_TERMOPT is not set +# CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM is not set + +# +# Init Utilities +# +CONFIG_INIT=y +CONFIG_FEATURE_USE_INITTAB=y +# CONFIG_FEATURE_KILL_REMOVED is not set +CONFIG_FEATURE_KILL_DELAY=0 +CONFIG_FEATURE_INIT_SCTTY=y +CONFIG_FEATURE_INIT_SYSLOG=y +# CONFIG_FEATURE_EXTRA_QUIET is not set +CONFIG_FEATURE_INIT_COREDUMPS=y +CONFIG_FEATURE_INITRD=y +CONFIG_HALT=y +# CONFIG_MESG is not set + +# +# Login/Password Management Utilities +# +# CONFIG_FEATURE_SHADOWPASSWDS is not set +# CONFIG_USE_BB_PWD_GRP is not set +# CONFIG_USE_BB_SHADOW is not set +# CONFIG_USE_BB_CRYPT is not set +# CONFIG_USE_BB_CRYPT_SHA is not set +# CONFIG_ADDGROUP is not set +# CONFIG_FEATURE_ADDUSER_TO_GROUP is not set +# CONFIG_DELGROUP is not set +# CONFIG_FEATURE_DEL_USER_FROM_GROUP is not set +# CONFIG_FEATURE_CHECK_NAMES is not set +# CONFIG_ADDUSER is not set +# CONFIG_FEATURE_ADDUSER_LONG_OPTIONS is not set +# CONFIG_DELUSER is not set +# CONFIG_GETTY is not set +# CONFIG_FEATURE_UTMP is not set +# CONFIG_FEATURE_WTMP is not set +# CONFIG_LOGIN is not set +# CONFIG_PAM is not set +# CONFIG_LOGIN_SCRIPTS is not set +# CONFIG_FEATURE_NOLOGIN is not set +# CONFIG_FEATURE_SECURETTY is not set +# CONFIG_PASSWD is not set +# CONFIG_FEATURE_PASSWD_WEAK_CHECK is not set +# CONFIG_CRYPTPW is not set +# CONFIG_CHPASSWD is not set +# CONFIG_SU is not set +# CONFIG_FEATURE_SU_SYSLOG is not set +# CONFIG_FEATURE_SU_CHECKS_SHELLS is not set +# CONFIG_SULOGIN is not set +# CONFIG_VLOCK is not set + +# +# Linux Ext2 FS Progs +# +# CONFIG_CHATTR is not set +# CONFIG_FSCK is not set +# CONFIG_LSATTR is not set + +# +# Linux Module Utilities +# +# CONFIG_MODPROBE_SMALL is not set +# CONFIG_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE is not set +# CONFIG_FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED is not set +# CONFIG_INSMOD is not set +# CONFIG_RMMOD is not set +# CONFIG_LSMOD is not set +# CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT is not set +# CONFIG_MODPROBE is not set +# CONFIG_FEATURE_MODPROBE_BLACKLIST is not set +# CONFIG_DEPMOD is not set + +# +# Options common to multiple modutils +# +# CONFIG_FEATURE_2_4_MODULES is not set +# CONFIG_FEATURE_INSMOD_VERSION_CHECKING is not set +# CONFIG_FEATURE_INSMOD_KSYMOOPS_SYMBOLS is not set +# CONFIG_FEATURE_INSMOD_LOADINKMEM is not set +# CONFIG_FEATURE_INSMOD_LOAD_MAP is not set +# CONFIG_FEATURE_INSMOD_LOAD_MAP_FULL is not set +# CONFIG_FEATURE_CHECK_TAINTED_MODULE is not set +# CONFIG_FEATURE_MODUTILS_ALIAS is not set +# CONFIG_FEATURE_MODUTILS_SYMBOLS is not set +CONFIG_DEFAULT_MODULES_DIR="" +CONFIG_DEFAULT_DEPMOD_FILE="" + +# +# Linux System Utilities +# +# CONFIG_ACPID is not set +# CONFIG_FEATURE_ACPID_COMPAT is not set +# CONFIG_BLKID is not set +# CONFIG_DMESG is not set +# CONFIG_FEATURE_DMESG_PRETTY is not set +# CONFIG_FBSET is not set +# CONFIG_FEATURE_FBSET_FANCY is not set +# CONFIG_FEATURE_FBSET_READMODE is not set +# CONFIG_FDFLUSH is not set +# CONFIG_FDFORMAT is not set +# CONFIG_FDISK is not set +CONFIG_FDISK_SUPPORT_LARGE_DISKS=y +# CONFIG_FEATURE_FDISK_WRITABLE is not set +# CONFIG_FEATURE_AIX_LABEL is not set +# CONFIG_FEATURE_SGI_LABEL is not set +# CONFIG_FEATURE_SUN_LABEL is not set +# CONFIG_FEATURE_OSF_LABEL is not set +# CONFIG_FEATURE_FDISK_ADVANCED is not set +# CONFIG_FINDFS is not set +# CONFIG_FREERAMDISK is not set +# CONFIG_FSCK_MINIX is not set +# CONFIG_MKFS_MINIX is not set +# CONFIG_FEATURE_MINIX2 is not set +# CONFIG_MKFS_VFAT is not set +# CONFIG_GETOPT is not set +# CONFIG_HEXDUMP is not set +# CONFIG_FEATURE_HEXDUMP_REVERSE is not set +# CONFIG_HD is not set +# CONFIG_HWCLOCK is not set +# CONFIG_FEATURE_HWCLOCK_LONG_OPTIONS is not set +# CONFIG_FEATURE_HWCLOCK_ADJTIME_FHS is not set +# CONFIG_IPCRM is not set +# CONFIG_IPCS is not set +# CONFIG_LOSETUP is not set +# CONFIG_MDEV is not set +# CONFIG_FEATURE_MDEV_CONF is not set +# CONFIG_FEATURE_MDEV_RENAME is not set +# CONFIG_FEATURE_MDEV_RENAME_REGEXP is not set +# CONFIG_FEATURE_MDEV_EXEC is not set +# CONFIG_FEATURE_MDEV_LOAD_FIRMWARE is not set +# CONFIG_MKSWAP is not set +# CONFIG_FEATURE_MKSWAP_V0 is not set +# CONFIG_MORE is not set +# CONFIG_FEATURE_USE_TERMIOS is not set +# CONFIG_VOLUMEID is not set +# CONFIG_FEATURE_VOLUMEID_EXT is not set +# CONFIG_FEATURE_VOLUMEID_REISERFS is not set +# CONFIG_FEATURE_VOLUMEID_FAT is not set +# CONFIG_FEATURE_VOLUMEID_HFS is not set +# CONFIG_FEATURE_VOLUMEID_JFS is not set +# CONFIG_FEATURE_VOLUMEID_XFS is not set +# CONFIG_FEATURE_VOLUMEID_NTFS is not set +# CONFIG_FEATURE_VOLUMEID_ISO9660 is not set +# CONFIG_FEATURE_VOLUMEID_UDF is not set +# CONFIG_FEATURE_VOLUMEID_LUKS is not set +# CONFIG_FEATURE_VOLUMEID_LINUXSWAP is not set +# CONFIG_FEATURE_VOLUMEID_CRAMFS is not set +# CONFIG_FEATURE_VOLUMEID_ROMFS is not set +# CONFIG_FEATURE_VOLUMEID_SYSV is not set +# CONFIG_FEATURE_VOLUMEID_OCFS2 is not set +# CONFIG_FEATURE_VOLUMEID_LINUXRAID is not set +# CONFIG_MOUNT is not set +# CONFIG_FEATURE_MOUNT_FAKE is not set +# CONFIG_FEATURE_MOUNT_VERBOSE is not set +# CONFIG_FEATURE_MOUNT_HELPERS is not set +# CONFIG_FEATURE_MOUNT_LABEL is not set +# CONFIG_FEATURE_MOUNT_NFS is not set +# CONFIG_FEATURE_MOUNT_CIFS is not set +# CONFIG_FEATURE_MOUNT_FLAGS is not set +# CONFIG_FEATURE_MOUNT_FSTAB is not set +# CONFIG_PIVOT_ROOT is not set +# CONFIG_RDATE is not set +# CONFIG_RDEV is not set +# CONFIG_READPROFILE is not set +# CONFIG_RTCWAKE is not set +# CONFIG_SCRIPT is not set +# CONFIG_SETARCH is not set +# CONFIG_SWAPONOFF is not set +# CONFIG_FEATURE_SWAPON_PRI is not set +# CONFIG_SWITCH_ROOT is not set +# CONFIG_UMOUNT is not set +# CONFIG_FEATURE_UMOUNT_ALL is not set +# CONFIG_FEATURE_MOUNT_LOOP is not set +# CONFIG_FEATURE_MTAB_SUPPORT is not set + +# +# Miscellaneous Utilities +# +# CONFIG_ADJTIMEX is not set +# CONFIG_BBCONFIG is not set +# CONFIG_CHAT is not set +# CONFIG_FEATURE_CHAT_NOFAIL is not set +# CONFIG_FEATURE_CHAT_TTY_HIFI is not set +# CONFIG_FEATURE_CHAT_IMPLICIT_CR is not set +# CONFIG_FEATURE_CHAT_SWALLOW_OPTS is not set +# CONFIG_FEATURE_CHAT_SEND_ESCAPES is not set +# CONFIG_FEATURE_CHAT_VAR_ABORT_LEN is not set +# CONFIG_FEATURE_CHAT_CLR_ABORT is not set +# CONFIG_CHRT is not set +# CONFIG_CROND is not set +# CONFIG_FEATURE_CROND_D is not set +# CONFIG_FEATURE_CROND_CALL_SENDMAIL is not set +CONFIG_FEATURE_CROND_DIR="" +# CONFIG_CRONTAB is not set +# CONFIG_DC is not set +# CONFIG_FEATURE_DC_LIBM is not set +# CONFIG_DEVFSD is not set +# CONFIG_DEVFSD_MODLOAD is not set +# CONFIG_DEVFSD_FG_NP is not set +# CONFIG_DEVFSD_VERBOSE is not set +# CONFIG_FEATURE_DEVFS is not set +# CONFIG_DEVMEM is not set +# CONFIG_EJECT is not set +# CONFIG_FEATURE_EJECT_SCSI is not set +# CONFIG_FBSPLASH is not set +# CONFIG_FLASH_ERASEALL is not set +# CONFIG_IONICE is not set +# CONFIG_INOTIFYD is not set +# CONFIG_LAST is not set +# CONFIG_FEATURE_LAST_SMALL is not set +# CONFIG_FEATURE_LAST_FANCY is not set +# CONFIG_LESS is not set +CONFIG_FEATURE_LESS_MAXLINES=0 +# CONFIG_FEATURE_LESS_BRACKETS is not set +# CONFIG_FEATURE_LESS_FLAGS is not set +# CONFIG_FEATURE_LESS_MARKS is not set +# CONFIG_FEATURE_LESS_REGEXP is not set +# CONFIG_FEATURE_LESS_WINCH is not set +# CONFIG_FEATURE_LESS_DASHCMD is not set +# CONFIG_FEATURE_LESS_LINENUMS is not set +# CONFIG_HDPARM is not set +# CONFIG_FEATURE_HDPARM_GET_IDENTITY is not set +# CONFIG_FEATURE_HDPARM_HDIO_SCAN_HWIF is not set +# CONFIG_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF is not set +# CONFIG_FEATURE_HDPARM_HDIO_DRIVE_RESET is not set +# CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF is not set +# CONFIG_FEATURE_HDPARM_HDIO_GETSET_DMA is not set +# CONFIG_MAKEDEVS is not set +# CONFIG_FEATURE_MAKEDEVS_LEAF is not set +# CONFIG_FEATURE_MAKEDEVS_TABLE is not set +# CONFIG_MAN is not set +# CONFIG_MICROCOM is not set +# CONFIG_MOUNTPOINT is not set +# CONFIG_MT is not set +# CONFIG_RAIDAUTORUN is not set +# CONFIG_READAHEAD is not set +# CONFIG_RUNLEVEL is not set +# CONFIG_RX is not set +# CONFIG_SETSID is not set +# CONFIG_STRINGS is not set +# CONFIG_TASKSET is not set +# CONFIG_FEATURE_TASKSET_FANCY is not set +# CONFIG_TIME is not set +# CONFIG_TIMEOUT is not set +# CONFIG_TTYSIZE is not set +# CONFIG_WATCHDOG is not set + +# +# Networking Utilities +# +# CONFIG_FEATURE_IPV6 is not set +# CONFIG_FEATURE_PREFER_IPV4_ADDRESS is not set +# CONFIG_VERBOSE_RESOLUTION_ERRORS is not set +# CONFIG_ARP is not set +# CONFIG_ARPING is not set +# CONFIG_BRCTL is not set +# CONFIG_FEATURE_BRCTL_FANCY is not set +# CONFIG_FEATURE_BRCTL_SHOW is not set +# CONFIG_DNSD is not set +# CONFIG_ETHER_WAKE is not set +# CONFIG_FAKEIDENTD is not set +# CONFIG_FTPD is not set +# CONFIG_FEATURE_FTP_WRITE is not set +# CONFIG_FTPGET is not set +# CONFIG_FTPPUT is not set +# CONFIG_FEATURE_FTPGETPUT_LONG_OPTIONS is not set +# CONFIG_HOSTNAME is not set +# CONFIG_HTTPD is not set +# CONFIG_FEATURE_HTTPD_RANGES is not set +# CONFIG_FEATURE_HTTPD_USE_SENDFILE is not set +# CONFIG_FEATURE_HTTPD_SETUID is not set +# CONFIG_FEATURE_HTTPD_BASIC_AUTH is not set +# CONFIG_FEATURE_HTTPD_AUTH_MD5 is not set +# CONFIG_FEATURE_HTTPD_CGI is not set +# CONFIG_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR is not set +# CONFIG_FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV is not set +# CONFIG_FEATURE_HTTPD_ENCODE_URL_STR is not set +# CONFIG_FEATURE_HTTPD_ERROR_PAGES is not set +# CONFIG_FEATURE_HTTPD_PROXY is not set +# CONFIG_IFCONFIG is not set +# CONFIG_FEATURE_IFCONFIG_STATUS is not set +# CONFIG_FEATURE_IFCONFIG_SLIP is not set +# CONFIG_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ is not set +# CONFIG_FEATURE_IFCONFIG_HW is not set +# CONFIG_FEATURE_IFCONFIG_BROADCAST_PLUS is not set +# CONFIG_IFENSLAVE is not set +# CONFIG_IFUPDOWN is not set +CONFIG_IFUPDOWN_IFSTATE_PATH="" +# CONFIG_FEATURE_IFUPDOWN_IP is not set +# CONFIG_FEATURE_IFUPDOWN_IP_BUILTIN is not set +# CONFIG_FEATURE_IFUPDOWN_IFCONFIG_BUILTIN is not set +# CONFIG_FEATURE_IFUPDOWN_IPV4 is not set +# CONFIG_FEATURE_IFUPDOWN_IPV6 is not set +# CONFIG_FEATURE_IFUPDOWN_MAPPING is not set +# CONFIG_FEATURE_IFUPDOWN_EXTERNAL_DHCP is not set +# CONFIG_INETD is not set +# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_ECHO is not set +# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DISCARD is not set +# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_TIME is not set +# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DAYTIME is not set +# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_CHARGEN is not set +# CONFIG_FEATURE_INETD_RPC is not set +# CONFIG_IP is not set +# CONFIG_FEATURE_IP_ADDRESS is not set +# CONFIG_FEATURE_IP_LINK is not set +# CONFIG_FEATURE_IP_ROUTE is not set +# CONFIG_FEATURE_IP_TUNNEL is not set +# CONFIG_FEATURE_IP_RULE is not set +# CONFIG_FEATURE_IP_SHORT_FORMS is not set +# CONFIG_FEATURE_IP_RARE_PROTOCOLS is not set +# CONFIG_IPADDR is not set +# CONFIG_IPLINK is not set +# CONFIG_IPROUTE is not set +# CONFIG_IPTUNNEL is not set +# CONFIG_IPRULE is not set +# CONFIG_IPCALC is not set +# CONFIG_FEATURE_IPCALC_FANCY is not set +# CONFIG_FEATURE_IPCALC_LONG_OPTIONS is not set +# CONFIG_NAMEIF is not set +# CONFIG_FEATURE_NAMEIF_EXTENDED is not set +# CONFIG_NC is not set +# CONFIG_NC_SERVER is not set +# CONFIG_NC_EXTRA is not set +# CONFIG_NETSTAT is not set +# CONFIG_FEATURE_NETSTAT_WIDE is not set +# CONFIG_FEATURE_NETSTAT_PRG is not set +# CONFIG_NSLOOKUP is not set +# CONFIG_PING is not set +# CONFIG_PING6 is not set +# CONFIG_FEATURE_FANCY_PING is not set +# CONFIG_PSCAN is not set +# CONFIG_ROUTE is not set +# CONFIG_SLATTACH is not set +# CONFIG_TELNET is not set +# CONFIG_FEATURE_TELNET_TTYPE is not set +# CONFIG_FEATURE_TELNET_AUTOLOGIN is not set +# CONFIG_TELNETD is not set +# CONFIG_FEATURE_TELNETD_STANDALONE is not set +# CONFIG_TFTP is not set +# CONFIG_TFTPD is not set +# CONFIG_FEATURE_TFTP_GET is not set +# CONFIG_FEATURE_TFTP_PUT is not set +# CONFIG_FEATURE_TFTP_BLOCKSIZE is not set +# CONFIG_TFTP_DEBUG is not set +# CONFIG_TRACEROUTE is not set +# CONFIG_FEATURE_TRACEROUTE_VERBOSE is not set +# CONFIG_FEATURE_TRACEROUTE_SOURCE_ROUTE is not set +# CONFIG_FEATURE_TRACEROUTE_USE_ICMP is not set +# CONFIG_APP_UDHCPD is not set +# CONFIG_APP_DHCPRELAY is not set +# CONFIG_APP_DUMPLEASES is not set +# CONFIG_FEATURE_UDHCPD_WRITE_LEASES_EARLY is not set +CONFIG_DHCPD_LEASES_FILE="" +# CONFIG_APP_UDHCPC is not set +# CONFIG_FEATURE_UDHCPC_ARPING is not set +# CONFIG_FEATURE_UDHCP_PORT is not set +# CONFIG_UDHCP_DEBUG is not set +# CONFIG_FEATURE_UDHCP_RFC3397 is not set +CONFIG_UDHCPC_DEFAULT_SCRIPT="" +CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS=0 +CONFIG_IFUPDOWN_UDHCPC_CMD_OPTIONS="" +# CONFIG_VCONFIG is not set +# CONFIG_WGET is not set +# CONFIG_FEATURE_WGET_STATUSBAR is not set +# CONFIG_FEATURE_WGET_AUTHENTICATION is not set +# CONFIG_FEATURE_WGET_LONG_OPTIONS is not set +# CONFIG_ZCIP is not set +# CONFIG_TCPSVD is not set +# CONFIG_TUNCTL is not set +# CONFIG_FEATURE_TUNCTL_UG is not set +# CONFIG_UDPSVD is not set + +# +# Print Utilities +# +# CONFIG_LPD is not set +# CONFIG_LPR is not set +# CONFIG_LPQ is not set + +# +# Mail Utilities +# +CONFIG_MAKEMIME=y +CONFIG_FEATURE_MIME_CHARSET="us-ascii" +# CONFIG_POPMAILDIR is not set +# CONFIG_FEATURE_POPMAILDIR_DELIVERY is not set +# CONFIG_REFORMIME is not set +# CONFIG_FEATURE_REFORMIME_COMPAT is not set +CONFIG_SENDMAIL=y + +# +# Process Utilities +# +# CONFIG_FREE is not set +# CONFIG_FUSER is not set +# CONFIG_KILL is not set +# CONFIG_KILLALL is not set +# CONFIG_KILLALL5 is not set +# CONFIG_NMETER is not set +# CONFIG_PGREP is not set +# CONFIG_PIDOF is not set +# CONFIG_FEATURE_PIDOF_SINGLE is not set +# CONFIG_FEATURE_PIDOF_OMIT is not set +# CONFIG_PKILL is not set +# CONFIG_PS is not set +# CONFIG_FEATURE_PS_WIDE is not set +# CONFIG_FEATURE_PS_TIME is not set +# CONFIG_FEATURE_PS_UNUSUAL_SYSTEMS is not set +# CONFIG_RENICE is not set +# CONFIG_BB_SYSCTL is not set +# CONFIG_TOP is not set +# CONFIG_FEATURE_TOP_CPU_USAGE_PERCENTAGE is not set +# CONFIG_FEATURE_TOP_CPU_GLOBAL_PERCENTS is not set +# CONFIG_FEATURE_TOP_SMP_CPU is not set +# CONFIG_FEATURE_TOP_DECIMALS is not set +# CONFIG_FEATURE_TOP_SMP_PROCESS is not set +# CONFIG_FEATURE_TOPMEM is not set +# CONFIG_UPTIME is not set +# CONFIG_WATCH is not set + +# +# Runit Utilities +# +# CONFIG_RUNSV is not set +# CONFIG_RUNSVDIR is not set +# CONFIG_FEATURE_RUNSVDIR_LOG is not set +# CONFIG_SV is not set +CONFIG_SV_DEFAULT_SERVICE_DIR="" +# CONFIG_SVLOGD is not set +# CONFIG_CHPST is not set +# CONFIG_SETUIDGID is not set +# CONFIG_ENVUIDGID is not set +# CONFIG_ENVDIR is not set +# CONFIG_SOFTLIMIT is not set +# CONFIG_CHCON is not set +# CONFIG_FEATURE_CHCON_LONG_OPTIONS is not set +# CONFIG_GETENFORCE is not set +# CONFIG_GETSEBOOL is not set +# CONFIG_LOAD_POLICY is not set +# CONFIG_MATCHPATHCON is not set +# CONFIG_RESTORECON is not set +# CONFIG_RUNCON is not set +# CONFIG_FEATURE_RUNCON_LONG_OPTIONS is not set +# CONFIG_SELINUXENABLED is not set +# CONFIG_SETENFORCE is not set +# CONFIG_SETFILES is not set +# CONFIG_FEATURE_SETFILES_CHECK_OPTION is not set +# CONFIG_SETSEBOOL is not set +# CONFIG_SESTATUS is not set + +# +# Shells +# +# CONFIG_FEATURE_SH_IS_ASH is not set +# CONFIG_FEATURE_SH_IS_HUSH is not set +# CONFIG_FEATURE_SH_IS_MSH is not set +# CONFIG_FEATURE_SH_IS_NONE is not set +# CONFIG_ASH is not set + +# +# Ash Shell Options +# +# CONFIG_ASH_BASH_COMPAT is not set +# CONFIG_ASH_JOB_CONTROL is not set +# CONFIG_ASH_READ_NCHARS is not set +# CONFIG_ASH_READ_TIMEOUT is not set +# CONFIG_ASH_ALIAS is not set +# CONFIG_ASH_GETOPTS is not set +# CONFIG_ASH_BUILTIN_ECHO is not set +# CONFIG_ASH_BUILTIN_PRINTF is not set +# CONFIG_ASH_BUILTIN_TEST is not set +# CONFIG_ASH_CMDCMD is not set +# CONFIG_ASH_MAIL is not set +# CONFIG_ASH_OPTIMIZE_FOR_SIZE is not set +# CONFIG_ASH_RANDOM_SUPPORT is not set +# CONFIG_ASH_EXPAND_PRMT is not set +# CONFIG_HUSH is not set +# CONFIG_HUSH_HELP is not set +# CONFIG_HUSH_INTERACTIVE is not set +# CONFIG_HUSH_JOB is not set +# CONFIG_HUSH_TICK is not set +# CONFIG_HUSH_IF is not set +# CONFIG_HUSH_LOOPS is not set +# CONFIG_HUSH_CASE is not set +# CONFIG_HUSH_FUNCTIONS is not set +# CONFIG_HUSH_EXPORT_N is not set +# CONFIG_LASH is not set +# CONFIG_MSH is not set + +# +# Bourne Shell Options +# +# CONFIG_SH_MATH_SUPPORT is not set +# CONFIG_SH_MATH_SUPPORT_64 is not set +# CONFIG_FEATURE_SH_EXTRA_QUIET is not set +# CONFIG_FEATURE_SH_STANDALONE is not set +# CONFIG_FEATURE_SH_NOFORK is not set +# CONFIG_CTTYHACK is not set + +# +# System Logging Utilities +# +# CONFIG_SYSLOGD is not set +# CONFIG_FEATURE_ROTATE_LOGFILE is not set +# CONFIG_FEATURE_REMOTE_LOG is not set +# CONFIG_FEATURE_SYSLOGD_DUP is not set +# CONFIG_FEATURE_IPC_SYSLOG is not set +CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE=0 +# CONFIG_LOGREAD is not set +# CONFIG_FEATURE_LOGREAD_REDUCED_LOCKING is not set +# CONFIG_KLOGD is not set +# CONFIG_LOGGER is not set diff --git a/root_image/drivers/Makefile b/root_image/drivers/Makefile new file mode 100644 index 0000000..3c1b76a --- /dev/null +++ b/root_image/drivers/Makefile @@ -0,0 +1,12 @@ +obj-m += dump/ + +.PHONY: distclean +distclean: clean + +.PHONY: clean +clean: + find . -name \*.o -o -name \*.ko -o -name \*.mod.c -o -name .\*.cmd \ + | xargs rm -f + +TAGS: + find . -name \*.[ch] | xargs etags diff --git a/root_image/drivers/dump/Makefile b/root_image/drivers/dump/Makefile new file mode 100644 index 0000000..dd93aa7 --- /dev/null +++ b/root_image/drivers/dump/Makefile @@ -0,0 +1,38 @@ +# Comment/uncomment the following line to disable/enable debugging +#DEBUG = y + +# Add your debugging flag (or not) to CFLAGS +ifeq ($(DEBUG),y) + DEBFLAGS = -O -g # "-O" is needed to expand inlines +else + DEBFLAGS = -O2 +endif + +EXTRA_CFLAGS += $(DEBFLAGS) -I$(LDDINCDIR) + +ifneq ($(KERNELRELEASE),) +# call from kernel build system + +obj-m := dump_dma.o + +else + +#KERNELDIR ?= /lib/modules/$(shell uname -r)/build +KERNELDIR ?= /home/konrad/git/neb.64/linux-build +PWD := $(shell pwd) + +default: + $(MAKE) -C $(KERNELDIR) M=$(PWD) LDDINCDIR=$(PWD)/../include modules + +endif + +clean: + rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions + +depend .depend dep: + $(CC) $(CFLAGS) -M *.c > .depend + + +ifeq (.depend,$(wildcard .depend)) +include .depend +endif diff --git a/root_image/drivers/dump/dump_dma.c b/root_image/drivers/dump/dump_dma.c new file mode 100644 index 0000000..2aea0d9 --- /dev/null +++ b/root_image/drivers/dump/dump_dma.c @@ -0,0 +1,68 @@ +/* + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License v2.0 as published by + * the Free Software Foundation + * + * 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. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +#define DUMP_DMA_FUN "0.1" + +MODULE_AUTHOR("Konrad Rzeszutek Wilk "); +MODULE_DESCRIPTION("dump dma"); +MODULE_LICENSE("GPL"); +MODULE_VERSION(DUMP_DMA_FUN); + +static int __init dump_dma_init(void) +{ + debug_dma_dump_mappings(NULL); + return 0; +} + +static void __exit dump_dma_exit(void) +{ +} + +module_init(dump_dma_init); +module_exit(dump_dma_exit); diff --git a/root_image/etc/fstab b/root_image/etc/fstab new file mode 100644 index 0000000..6a95b1f --- /dev/null +++ b/root_image/etc/fstab @@ -0,0 +1,3 @@ +proc /proc proc defaults 0 0 +sysfs /sys sysfs defaults 0 0 +debugfs /sys/kernel/debug debugfs defaults 0 0 diff --git a/root_image/etc/group b/root_image/etc/group new file mode 100644 index 0000000..8ca33b0 --- /dev/null +++ b/root_image/etc/group @@ -0,0 +1,25 @@ +root:x:0:root +bin:x:1:root,bin,daemon +daemon:x:2:root,bin,daemon +sys:x:3:root,bin,adm +adm:x:4:root,adm,daemon +tty:x:5: +disk:x:6:root +lp:x:7:daemon,lp +mem:x:8: +kmem:x:9: +wheel:x:10:root +man:x:15: +video:x:39: +lock:x:54: +audio:x:63: +nobody:x:99: +utmp:x:22: +floppy:x:19: +vcsa:x:69: +cdrom:x:11: +tape:x:33: +dialout:x:18: +nscd:x:28: +sshd:x:74: +vcsa:x:69: diff --git a/root_image/etc/host.conf b/root_image/etc/host.conf new file mode 100644 index 0000000..6cdfa5b --- /dev/null +++ b/root_image/etc/host.conf @@ -0,0 +1,2 @@ +multi on +order hosts,bind diff --git a/root_image/etc/hosts b/root_image/etc/hosts new file mode 100644 index 0000000..849c10d --- /dev/null +++ b/root_image/etc/hosts @@ -0,0 +1,2 @@ +127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 +::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 diff --git a/root_image/etc/init.d/core_filesystems b/root_image/etc/init.d/core_filesystems new file mode 100755 index 0000000..41a8b85 --- /dev/null +++ b/root_image/etc/init.d/core_filesystems @@ -0,0 +1,56 @@ +#!/bin/bash + +mount -t proc none /proc + +# Make certain directories into separate filesystems so we can bind-mount +# them into chrooted environments +for dir in /dev /lib/modules/`uname -r`; do + mv $dir $dir.orig + mkdir $dir + chmod 755 $dir + mount -t tmpfs none $dir + mv -f $dir.orig/{*,.*} $dir 2>/dev/null + rm -fr $dir.orig +done + +# Make /dev/shm be a tmpfs filesystem so that we can use shm functonality + +if [ ! -d /dev/shm ]; then + mkdir /dev/shm + chmod 755 /dev/shm + mount -t tmpfs -o size=10m shm /dev/shm +fi + +if [ ! -d "/var/log" ]; then + mkdir -p /var/log + mount -t tmpfs -o size=10m var_log /var/log +fi + +if [ ! -d "/var/tmp" ]; then + mkdir -p /var/tmp + mount -t tmpfs -o size=10m var_tmp /var/tmp +fi + +if [ ! -d /tmp ]; then + ln -sf /var/tmp /tmp +fi + +DIRS="/var/run /var/lib/dhclient /var/empty/sshd" +for d in $DIRS; do + if [ ! -d $d ]; then + mkdir -p $d + fi +done + +mount -t sysfs sys /sys + +if [ ! -d /proc/bus/usb ]; then + modprobe usbcore >/dev/null 2>&1 + mount -t usbfs none /proc/bus/usb +fi + +if [ ! -e /etc/mtab ]; then + touch /etc/mtab # mkfs.ext3 wants to see this file +fi + + diff --git a/root_image/etc/init.d/functions b/root_image/etc/init.d/functions new file mode 100644 index 0000000..2dd071a --- /dev/null +++ b/root_image/etc/init.d/functions @@ -0,0 +1,583 @@ +# -*-Shell-script-*- +# +# functions This file contains functions to be used by most or all +# shell scripts in the /etc/init.d directory. +# + +TEXTDOMAIN=initscripts + +# Make sure umask is sane +umask 022 + +# Set up a default search path. +PATH="/sbin:/usr/sbin:/bin:/usr/bin" +export PATH + +# Get a sane screen width +[ -z "${COLUMNS:-}" ] && COLUMNS=80 + +[ -z "${CONSOLETYPE:-}" ] && CONSOLETYPE="`/sbin/consoletype`" + +if [ -f /etc/sysconfig/i18n -a -z "${NOLOCALE:-}" -a -z "${LANGSH_SOURCED:-}" ] ; then + . /etc/profile.d/lang.sh + # avoid propagating LANGSH_SOURCED any further + unset LANGSH_SOURCED +fi + +# Read in our configuration +if [ -z "${BOOTUP:-}" ]; then + if [ -f /etc/sysconfig/init ]; then + . /etc/sysconfig/init + else + # This all seem confusing? Look in /etc/sysconfig/init, + # or in /usr/doc/initscripts-*/sysconfig.txt + BOOTUP=color + RES_COL=60 + MOVE_TO_COL="echo -en \\033[${RES_COL}G" + SETCOLOR_SUCCESS="echo -en \\033[1;32m" + SETCOLOR_FAILURE="echo -en \\033[1;31m" + SETCOLOR_WARNING="echo -en \\033[1;33m" + SETCOLOR_NORMAL="echo -en \\033[0;39m" + LOGLEVEL=1 + fi + if [ "$CONSOLETYPE" = "serial" ]; then + BOOTUP=serial + MOVE_TO_COL= + SETCOLOR_SUCCESS= + SETCOLOR_FAILURE= + SETCOLOR_WARNING= + SETCOLOR_NORMAL= + fi +fi + +boot_parameter() { + local param + local value + + param=$(cat /proc/cmdline | tr -s ' \t' '\n' | \ + egrep "^$1=|^$1\$" | tail -1 ) + if [ -z "$param" ]; then + return 1 + fi + value=$(echo $param | cut -d'=' -s -f 2- ) + echo $value + return 0 +} +# Interpret escape sequences in an fstab entry +fstab_decode_str() { + fstab-decode echo "$1" +} + +# Check if $pid (could be plural) are running +checkpid() { + local i + + for i in $* ; do + [ -d "/proc/$i" ] && return 0 + done + return 1 +} + +__readlink() { + ls -bl "$@" 2>/dev/null| awk '{ print $NF }' +} + +__fgrep() { + s=$1 + f=$2 + while read line; do + if strstr "$line" "$s"; then + echo $line + return 0 + fi + done < $f + return 1 +} + +# __umount_loop awk_program fstab_file first_msg retry_msg umount_args +# awk_program should process fstab_file and return a list of fstab-encoded +# paths; it doesn't have to handle comments in fstab_file. +__umount_loop() { + local remaining sig= + local retry=3 count + + remaining=$(LC_ALL=C awk "/^#/ {next} $1" "$2" | sort -r) + while [ -n "$remaining" -a "$retry" -gt 0 ]; do + if [ "$retry" -eq 3 ]; then + action "$3" fstab-decode umount $5 $remaining + else + action "$4" fstab-decode umount $5 $remaining + fi + count=4 + remaining=$(LC_ALL=C awk "/^#/ {next} $1" "$2" | sort -r) + while [ "$count" -gt 0 ]; do + [ -z "$remaining" ] && break + count=$(($count-1)) + usleep 500000 + remaining=$(LC_ALL=C awk "/^#/ {next} $1" "$2" | sort -r) + done + [ -z "$remaining" ] && break + fstab-decode /sbin/fuser -k -m $sig $remaining >/dev/null + sleep 3 + retry=$(($retry -1)) + sig=-9 + done +} + +# Similar to __umount loop above, specialized for loopback devices +__umount_loopback_loop() { + local remaining devremaining sig= + local retry=3 + + remaining=$(awk '$1 ~ /^\/dev\/loop/ && $2 != "/" {print $2}' /proc/mounts) + devremaining=$(awk '$1 ~ /^\/dev\/loop/ && $2 != "/" {print $1}' /proc/mounts) + while [ -n "$remaining" -a "$retry" -gt 0 ]; do + if [ "$retry" -eq 3 ]; then + action $"Unmounting loopback filesystems: " \ + fstab-decode umount $remaining + else + action $"Unmounting loopback filesystems (retry):" \ + fstab-decode umount $remaining + fi + for dev in $devremaining ; do + losetup $dev > /dev/null 2>&1 && \ + action $"Detaching loopback device $dev: " \ + losetup -d $dev + done + remaining=$(awk '$1 ~ /^\/dev\/loop/ && $2 != "/" {print $2}' /proc/mounts) + devremaining=$(awk '$1 ~ /^\/dev\/loop/ && $2 != "/" {print $1}' /proc/mounts) + [ -z "$remaining" ] && break + fstab-decode /sbin/fuser -k -m $sig $remaining >/dev/null + sleep 3 + retry=$(($retry -1)) + sig=-9 + done +} + +# __proc_pids {program} [pidfile] +# Set $pid to pids from /var/run* for {program}. $pid should be declared +# local in the caller. +# Returns LSB exit code for the 'status' action. +__pids_var_run() { + local base=${1##*/} + local pid_file=${2:-/var/run/$base.pid} + + pid= + if [ -f "$pid_file" ] ; then + local line p + + while : ; do + read line + [ -z "$line" ] && break + for p in $line ; do + [ -z "${p//[0-9]/}" -a -d "/proc/$p" ] && pid="$pid $p" + done + done < "$pid_file" + + if [ -n "$pid" ]; then + return 0 + fi + return 1 # "Program is dead and /var/run pid file exists" + fi + return 3 # "Program is not running" +} + +# Output PIDs of matching processes, found using pidof +__pids_pidof() { + pidof -c -o $$ -o $PPID -o %PPID -x "$1" || \ + pidof -c -o $$ -o $PPID -o %PPID -x "${1##*/}" +} + + +# A function to start a program. +daemon() { + # Test syntax. + local gotbase= force= nicelevel corelimit + local pid base= user= nice= bg= pid_file= + local cgroup= + nicelevel=0 + while [ "$1" != "${1##[-+]}" ]; do + case $1 in + '') echo $"$0: Usage: daemon [+/-nicelevel] {program}" + return 1;; + --check) + base=$2 + gotbase="yes" + shift 2 + ;; + --check=?*) + base=${1#--check=} + gotbase="yes" + shift + ;; + --user) + user=$2 + shift 2 + ;; + --user=?*) + user=${1#--user=} + shift + ;; + --pidfile) + pid_file=$2 + shift 2 + ;; + --pidfile=?*) + pid_file=${1#--pidfile=} + shift + ;; + --force) + force="force" + shift + ;; + [-+][0-9]*) + nice="nice -n $1" + shift + ;; + *) echo $"$0: Usage: daemon [+/-nicelevel] {program}" + return 1;; + esac + done + + # Save basename. + [ -z "$gotbase" ] && base=${1##*/} + + # See if it's already running. Look *only* at the pid file. + __pids_var_run "$base" "$pid_file" + + [ -n "$pid" -a -z "$force" ] && return + + # make sure it doesn't core dump anywhere unless requested + corelimit="ulimit -S -c ${DAEMON_COREFILE_LIMIT:-0}" + + # if they set NICELEVEL in /etc/sysconfig/foo, honor it + [ -n "${NICELEVEL:-}" ] && nice="nice -n $NICELEVEL" + + # if they set CGROUP_DAEMON in /etc/sysconfig/foo, honor it + if [ -n "${CGROUP_DAEMON}" ]; then + if [ ! -x /bin/cgexec ]; then + echo -n "Cgroups not installed"; warning + echo + else + cgroup="/bin/cgexec"; + for i in $CGROUP_DAEMON; do + cgroup="$cgroup -g $i"; + done + fi + fi + + # Echo daemon + [ "${BOOTUP:-}" = "verbose" -a -z "${LSB:-}" ] && echo -n " $base" + + # And start it up. + if [ -z "$user" ]; then + $cgroup $nice /bin/bash -c "$corelimit >/dev/null 2>&1 ; $*" + else + $cgroup $nice runuser -s /bin/bash - $user -c "$corelimit >/dev/null 2>&1 ; $*" + fi + + [ "$?" -eq 0 ] && success $"$base startup" || failure $"$base startup" +} + +# A function to stop a program. +killproc() { + local RC killlevel= base pid pid_file= delay + + RC=0; delay=3 + # Test syntax. + if [ "$#" -eq 0 ]; then + echo $"Usage: killproc [-p pidfile] [ -d delay] {program} [-signal]" + return 1 + fi + if [ "$1" = "-p" ]; then + pid_file=$2 + shift 2 + fi + if [ "$1" = "-d" ]; then + delay=$2 + shift 2 + fi + + + # check for second arg to be kill level + [ -n "${2:-}" ] && killlevel=$2 + + # Save basename. + base=${1##*/} + + # Find pid. + __pids_var_run "$1" "$pid_file" + if [ -z "$pid_file" -a -z "$pid" ]; then + pid="$(__pids_pidof "$1")" + fi + + # Kill it. + if [ -n "$pid" ] ; then + [ "$BOOTUP" = "verbose" -a -z "${LSB:-}" ] && echo -n "$base " + if [ -z "$killlevel" ] ; then + if checkpid $pid 2>&1; then + # TERM first, then KILL if not dead + kill -TERM $pid >/dev/null 2>&1 + usleep 100000 + if checkpid $pid && sleep 1 && + checkpid $pid && sleep $delay && + checkpid $pid ; then + kill -KILL $pid >/dev/null 2>&1 + usleep 100000 + fi + fi + checkpid $pid + RC=$? + [ "$RC" -eq 0 ] && failure $"$base shutdown" || success $"$base shutdown" + RC=$((! $RC)) + # use specified level only + else + if checkpid $pid; then + kill $killlevel $pid >/dev/null 2>&1 + RC=$? + [ "$RC" -eq 0 ] && success $"$base $killlevel" || failure $"$base $killlevel" + elif [ -n "${LSB:-}" ]; then + RC=7 # Program is not running + fi + fi + else + if [ -n "${LSB:-}" -a -n "$killlevel" ]; then + RC=7 # Program is not running + else + failure $"$base shutdown" + RC=0 + fi + fi + + # Remove pid file if any. + if [ -z "$killlevel" ]; then + rm -f "${pid_file:-/var/run/$base.pid}" + fi + return $RC +} + +# A function to find the pid of a program. Looks *only* at the pidfile +pidfileofproc() { + local pid + + # Test syntax. + if [ "$#" = 0 ] ; then + echo $"Usage: pidfileofproc {program}" + return 1 + fi + + __pids_var_run "$1" + [ -n "$pid" ] && echo $pid + return 0 +} + +# A function to find the pid of a program. +pidofproc() { + local RC pid pid_file= + + # Test syntax. + if [ "$#" = 0 ]; then + echo $"Usage: pidofproc [-p pidfile] {program}" + return 1 + fi + if [ "$1" = "-p" ]; then + pid_file=$2 + shift 2 + fi + fail_code=3 # "Program is not running" + + # First try "/var/run/*.pid" files + __pids_var_run "$1" "$pid_file" + RC=$? + if [ -n "$pid" ]; then + echo $pid + return 0 + fi + + [ -n "$pid_file" ] && return $RC + __pids_pidof "$1" || return $RC +} + +status() { + local base pid pid_file= + + # Test syntax. + if [ "$#" = 0 ] ; then + echo $"Usage: status [-p pidfile] {program}" + return 1 + fi + if [ "$1" = "-p" ]; then + pid_file=$2 + shift 2 + fi + base=${1##*/} + + # First try "pidof" + __pids_var_run "$1" "$pid_file" + RC=$? + if [ -z "$pid_file" -a -z "$pid" ]; then + pid="$(__pids_pidof "$1")" + fi + if [ -n "$pid" ]; then + echo $"${base} (pid $pid) is running..." + return 0 + fi + + case "$RC" in + 0) + echo $"${base} (pid $pid) is running..." + return 0 + ;; + 1) + echo $"${base} dead but pid file exists" + return 1 + ;; + esac + # See if /var/lock/subsys/${base} exists + if [ -f /var/lock/subsys/${base} ]; then + echo $"${base} dead but subsys locked" + return 2 + fi + echo $"${base} is stopped" + return 3 +} + +echo_success() { + [ "$BOOTUP" = "color" ] && $MOVE_TO_COL + echo -n "[" + [ "$BOOTUP" = "color" ] && $SETCOLOR_SUCCESS + echo -n $" OK " + [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL + echo -n "]" + echo -ne "\r" + return 0 +} + +echo_failure() { + [ "$BOOTUP" = "color" ] && $MOVE_TO_COL + echo -n "[" + [ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE + echo -n $"FAILED" + [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL + echo -n "]" + echo -ne "\r" + return 1 +} + +echo_passed() { + [ "$BOOTUP" = "color" ] && $MOVE_TO_COL + echo -n "[" + [ "$BOOTUP" = "color" ] && $SETCOLOR_WARNING + echo -n $"PASSED" + [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL + echo -n "]" + echo -ne "\r" + return 1 +} + +echo_warning() { + [ "$BOOTUP" = "color" ] && $MOVE_TO_COL + echo -n "[" + [ "$BOOTUP" = "color" ] && $SETCOLOR_WARNING + echo -n $"WARNING" + [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL + echo -n "]" + echo -ne "\r" + return 1 +} + +# Inform the graphical boot of our current state +update_boot_stage() { + if [ -x /usr/bin/plymouth ]; then + /usr/bin/plymouth --update="$1" + fi + return 0 +} + +# Log that something succeeded +success() { + [ "$BOOTUP" != "verbose" -a -z "${LSB:-}" ] && echo_success + return 0 +} + +# Log that something failed +failure() { + local rc=$? + [ "$BOOTUP" != "verbose" -a -z "${LSB:-}" ] && echo_failure + [ -x /usr/bin/plymouth ] && /usr/bin/plymouth --details + return $rc +} + +# Log that something passed, but may have had errors. Useful for fsck +passed() { + local rc=$? + [ "$BOOTUP" != "verbose" -a -z "${LSB:-}" ] && echo_passed + return $rc +} + +# Log a warning +warning() { + local rc=$? + [ "$BOOTUP" != "verbose" -a -z "${LSB:-}" ] && echo_warning + return $rc +} + +# Run some action. Log its output. +action() { + local STRING rc + + STRING=$1 + echo -n "$STRING " + shift + "$@" && success $"$STRING" || failure $"$STRING" + rc=$? + echo + return $rc +} + +# returns OK if $1 contains $2 +strstr() { + [ "${1#*$2*}" = "$1" ] && return 1 + return 0 +} + +# Confirm whether we really want to run this service +confirm() { + [ -x /usr/bin/plymouth ] && /usr/bin/plymouth --hide-splash + while : ; do + echo -n $"Start service $1 (Y)es/(N)o/(C)ontinue? [Y] " + read answer + if strstr $"yY" "$answer" || [ "$answer" = "" ] ; then + return 0 + elif strstr $"cC" "$answer" ; then + rm -f /var/run/confirm + [ -x /usr/bin/plymouth ] && /usr/bin/plymouth --show-splash + return 2 + elif strstr $"nN" "$answer" ; then + return 1 + fi + done +} + +# resolve a device node to its major:minor numbers in decimal or hex +get_numeric_dev() { +( + fmt="%d:%d" + if [ "$1" == "hex" ]; then + fmt="%x:%x" + fi + ls -lH "$2" | awk '{ sub(/,/, "", $5); printf("'"$fmt"'", $5, $6); }' +) 2>/dev/null +} + +# Check whether file $1 is a backup or rpm-generated file and should be ignored +is_ignored_file() { + case "$1" in + *~ | *.bak | *.orig | *.rpmnew | *.rpmorig | *.rpmsave) + return 0 + ;; + esac + return 1 +} +# A sed expression to filter out the files that is_ignored_file recognizes +__sed_discard_ignored_files='/\(~\|\.bak\|\.orig\|\.rpmnew\|\.rpmorig\|\.rpmsave\)$/d' diff --git a/root_image/etc/init.d/halt b/root_image/etc/init.d/halt new file mode 100755 index 0000000..aba3d3e --- /dev/null +++ b/root_image/etc/init.d/halt @@ -0,0 +1,180 @@ +#!/bin/bash +# +# halt This file is executed by init when it goes into runlevel +# 0 (halt) or runlevel 6 (reboot). It kills all processes, +# unmounts file systems and then either halts or reboots. +# +# Author: Miquel van Smoorenburg, +# Modified for RHS Linux by Damien Neil +# + +NOLOCALE=1 +. /etc/init.d/functions + +UMOUNT="umount" +[ ! -w /etc ] && UMOUNT="umount -n" + +action() { + echo -n "$1 " + shift + if [ "$BOOTUP" = "color" ]; then + "$@" && echo_success || echo_failure + else + "$@" + fi + echo +} + +halt_crypto() { + fnval=0 + while read dst src key; do + [ -z "$dst" -o "${dst#\#}" != "$dst" ] && continue + if [ -b "/dev/mapper/$dst" ]; then + if /sbin/dmsetup info "$dst" | grep -q '^Open count: *0$'; then + action $"Stopping disk encryption for $dst" /sbin/cryptsetup remove "$dst" + else + fnval=1 + fi + fi + done < /etc/crypttab + return $fnval +} + +# See how we were called. +case "$0" in + *halt) + message=$"Halting system..." + command="/sbin/halt" + ;; + *reboot) + message=$"Please stand by while rebooting the system..." + command="/sbin/reboot" + kexec_command="/sbin/kexec" + ;; + *) + echo $"$0: call me as 'halt' or 'reboot' please!" + exit 1 + ;; +esac +case "$1" in + *start) + ;; + *) + echo $"Usage: $0 {start}" + exit 1 + ;; +esac + +# Kill all processes. +[ "${BASH+bash}" = bash ] && enable kill + +action $"Sending all processes the TERM signal..." /sbin/killall5 -15 +sleep 2 +action $"Sending all processes the KILL signal..." /sbin/killall5 -9 + +# Write to wtmp file before unmounting /var +/sbin/halt -w + +# Save mixer settings, here for lack of a better place. +if [ -s /etc/alsa/alsactl.conf -a -x /sbin/alsactl ]; then + action $"Saving mixer settings" /sbin/alsactl -E ALSA_CONFIG_PATH=/etc/alsa/alsactl.conf --ignore store +fi + +# Save random seed +touch /var/lib/random-seed +chmod 600 /var/lib/random-seed +action $"Saving random seed: " dd if=/dev/urandom of=/var/lib/random-seed count=1 bs=512 2>/dev/null + +[ -x /sbin/hwclock ] && action $"Syncing hardware clock to system time" /sbin/hwclock --systohc + +# Try to unmount tmpfs filesystems to avoid swapping them in. Ignore failures. +tmpfs=$(awk '$2 ~ /^\/($|proc|dev)/ { next; } + $3 == "tmpfs" { print $2; }' /proc/mounts | sort -r) +[ -n "$tmpfs" ] && fstab-decode $UMOUNT $tmpfs 2>/dev/null + +# Turn off swap, then unmount file systems. +[ -f /proc/swaps ] && SWAPS=`awk '! /^Filename/ { print $1 }' /proc/swaps` +if [ -n "$SWAPS" ]; then + action $"Turning off swap: " swapoff $SWAPS + for dst in $SWAPS; do + if [[ "$dst" =~ ^/dev/mapper ]] \ + && [ "$(dmsetup status "$dst" | cut -d ' ' -f 3)" = crypt ]; then + backdev=$(/sbin/cryptsetup status "$dst" \ + | awk '$1 == "device:" { print $2 }') + /sbin/cryptsetup remove "$dst" + fi + done +fi + +[ -x /sbin/quotaoff ] && action $"Turning off quotas: " /sbin/quotaoff -aug + +# Unmount file systems, killing processes if we have to. +# Unmount loopback stuff first +__umount_loopback_loop + +# Unmount RPC pipe file systems +__umount_loop '$3 ~ /^rpc_pipefs$/ || $3 ~ /^rpc_svc_gss_pipefs$/ {print $2}' \ + /proc/mounts \ + $"Unmounting pipe file systems: " \ + $"Unmounting pipe file systems (retry): " \ + -f + +LANG=C __umount_loop '$2 ~ /^\/$|^\/proc|^\/dev/{next} + $3 == "tmpfs" || $3 == "proc" {print $2 ; next} + /(loopfs|autofs|nfs|cifs|smbfs|ncpfs|sysfs|^none|^\/dev\/ram|^\/dev\/root$)/ {next} + {print $2}' /proc/mounts \ + $"Unmounting file systems: " \ + $"Unmounting file systems (retry): " \ + -f + +[ -f /proc/bus/usb/devices ] && $UMOUNT /proc/bus/usb + +[ -f /etc/crypttab ] && halt_crypto + +# remove the crash indicator flag +rm -f /.autofsck + +# Try all file systems other than root, essential filesystems and RAM disks, +# one last time. +awk '$2 !~ /\/(|dev|proc|selinux|sys)$/ && $1 !~ /^\/dev\/ram/ { print $2 }' \ + /proc/mounts | sort -r | \ + while read line; do + fstab-decode $UMOUNT -f $line +done + +if [ -x /sbin/halt.local ]; then + /sbin/halt.local +fi + +# Remount read only anything that's left mounted. +# echo $"Remounting remaining filesystems readonly" +mount | awk '{ print $3 }' | while read line; do + fstab-decode mount -n -o ro,remount $line +done + +# Now halt or reboot. +echo $"$message" +if [ -f /fastboot ]; then + echo $"On the next boot fsck will be skipped." +elif [ -f /forcefsck ]; then + echo $"On the next boot fsck will be forced." +fi + +# Shutdown UPS drivers +if [ "$command" = /sbin/halt -a -f /etc/sysconfig/ups ]; then + . /etc/sysconfig/ups + if [ -z $POWERDOWNFLAG ]; then + POWERDOWNFLAG=/etc/killpower + fi + if [ "$SERVER" = "yes" -a -f $POWERDOWNFLAG ]; then + /sbin/upsdrvctl shutdown + fi +fi + +# First, try kexec. If that fails, fall back to rebooting the old way. +[ -n "$kexec_command" ] && $kexec_command -e -x >& /dev/null + +HALTARGS="-d" +[ "$INIT_HALT" != "HALT" ] && HALTARGS="$HALTARGS -p" + +exec $command $HALTARGS diff --git a/root_image/etc/init.d/network b/root_image/etc/init.d/network new file mode 100755 index 0000000..7695da4 --- /dev/null +++ b/root_image/etc/init.d/network @@ -0,0 +1,301 @@ +#! /bin/bash +# +# network Bring up/down networking +# +# chkconfig: - 10 90 +# description: Activates/Deactivates all network interfaces configured to \ +# start at boot time. +# +### BEGIN INIT INFO +# Provides: $network +# Should-Start: iptables ip6tables +# Short-Description: Bring up/down networking +# Description: Bring up/down networking +### END INIT INFO + +# Source function library. +. /etc/init.d/functions + +if [ ! -f /etc/sysconfig/network ]; then + exit 6 +fi + +. /etc/sysconfig/network + +if [ -f /etc/sysconfig/pcmcia ]; then + . /etc/sysconfig/pcmcia +fi + + +# Check that networking is up. +[ "${NETWORKING}" = "no" ] && exit 6 + +# if the ip configuration utility isn't around we can't function. +[ -x /sbin/ip ] || exit 1 + +# Even if IPX is configured, without the utilities we can't do much +[ ! -x /sbin/ipx_internal_net -o ! -x /sbin/ipx_configure ] && IPX= + +# Even if VLAN is configured, without the utility we can't do much +[ ! -x /sbin/vconfig ] && VLAN= + +CWD=`pwd` +cd /etc/sysconfig/network-scripts + +. ./network-functions + +# find all the interfaces besides loopback. +# ignore aliases, alternative configurations, and editor backup files +interfaces=$(ls ifcfg* | \ + LANG=C sed -e "$__sed_discard_ignored_files" \ + -e '/\(ifcfg-lo\|:\|ifcfg-.*-range\)/d' \ + -e '/ifcfg-[A-Za-z0-9\._-]\+$/ { s/^ifcfg-//g;s/[0-9]/ &/}' | \ + LANG=C sort -k 1,1 -k 2n | \ + LANG=C sed 's/ //') +rc=0 + +# See how we were called. +case "$1" in + start) + rc=0 + # IPv6 hook (pre IPv4 start) + if [ -x /etc/sysconfig/network-scripts/init.ipv6-global ]; then + /etc/sysconfig/network-scripts/init.ipv6-global start pre + fi + + sysctl -e -p /etc/sysctl.conf >/dev/null 2>&1 + + # bring up loopback interface + action $"Bringing up loopback interface: " ./ifup ifcfg-lo + + case "$IPX" in + yes|true) + /sbin/ipx_configure --auto_primary=$IPXAUTOPRIMARY \ + --auto_interface=$IPXAUTOFRAME + if [ "$IPXINTERNALNETNUM" != "0" ]; then + /sbin/ipx_internal_net add $IPXINTERNALNETNUM $IPXINTERNALNODENUM + fi + ;; + esac + + case "$VLAN" in + yes) + if [ -d /proc/net/vlan ] || modprobe 8021q >/dev/null 2>&1 ; then + test -z "$VLAN_NAME_TYPE" && VLAN_NAME_TYPE=DEV_PLUS_VID_NO_PAD + action $"Setting 802.1Q VLAN parameters: " /sbin/vconfig set_name_type "$VLAN_NAME_TYPE" + else + echo $"No 802.1Q VLAN support available in kernel." + fi + ;; + esac + + vlaninterfaces="" + vpninterfaces="" + xdslinterfaces="" + bridgeinterfaces="" + + # bring up all other interfaces configured to come up at boot time + for i in $interfaces; do + unset DEVICE TYPE SLAVE + eval $(LANG=C fgrep "DEVICE=" ifcfg-$i) + eval $(LANG=C fgrep "TYPE=" ifcfg-$i) + eval $(LANG=C fgrep "SLAVE=" ifcfg-$i) + + if [ -z "$DEVICE" ] ; then DEVICE="$i"; fi + + if [ "${DEVICE##cipcb}" != "$DEVICE" ] ; then + vpninterfaces="$vpninterfaces $i" + continue + fi + if [ "$TYPE" = "xDSL" ]; then + xdslinterfaces="$xdslinterfaces $i" + continue + fi + + if [ "$TYPE" = "Bridge" ]; then + bridgeinterfaces="$bridgeinterfaces $i" + continue + fi + if [ "$TYPE" = "IPSEC" ]; then + vpninterfaces="$vpninterfaces $i" + continue + fi + + if [ "${DEVICE%%.*}" != "$DEVICE" -o "${DEVICE##vlan}" != "$DEVICE" ] ; then + vlaninterfaces="$vlaninterfaces $i" + continue + fi + + if [ "$SLAVE" = "yes" ]; then + continue + fi + + if LANG=C egrep -L "^ONBOOT=['\"]?[Nn][Oo]['\"]?" ifcfg-$i > /dev/null ; then + # this loads the module, to preserve ordering + is_available $i + continue + fi + # If we're in confirmation mode, get user confirmation. + if [ -f /var/run/confirm ]; then + confirm $i + test $? = 1 && continue + fi + action $"Bringing up interface $i: " ./ifup $i boot + rc=$((rc+$?)) + done + + # Bring up xDSL and VPN interfaces + for i in $vlaninterfaces $bridgeinterfaces $xdslinterfaces $vpninterfaces ; do + if ! LANG=C egrep -L "^ONBOOT=['\"]?[Nn][Oo]['\"]?" ifcfg-$i >/dev/null 2>&1 ; then + # If we're in confirmation mode, get user confirmation. + if [ -f /var/run/confirm ]; then + confirm $i + test $? = 1 && continue + fi + action $"Bringing up interface $i: " ./ifup $i boot + rc=$((rc+$?)) + fi + done + + # Add non interface-specific static-routes. + if [ -f /etc/sysconfig/static-routes ]; then + grep "^any" /etc/sysconfig/static-routes | while read ignore args ; do + /sbin/route add -$args + done + fi + + # IPv6 hook (post IPv4 start) + if [ -x /etc/sysconfig/network-scripts/init.ipv6-global ]; then + /etc/sysconfig/network-scripts/init.ipv6-global start post + fi + # Run this again to catch any interface-specific actions + sysctl -e -p /etc/sysctl.conf >/dev/null 2>&1 + + touch /var/lock/subsys/network + + [ -n "${NETWORKDELAY}" ] && /bin/sleep ${NETWORKDELAY} + ;; + stop) + # Don't shut the network down if root is on NFS or a network + # block device. + rootfs=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/" && $3 != "rootfs") { print $3; }}' /proc/mounts) + rootopts=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $4; }}' /etc/mtab) + + if [[ "$rootfs" =~ ^nfs ]] || [[ "$rootopts" =~ "_netdev|_rnetdev" ]] ; then + exit 1 + fi + + # If this is a final shutdown/halt, check for network FS, + # and unmount them even if the user didn't turn on netfs + if [ "$RUNLEVEL" = "6" -o "$RUNLEVEL" = "0" -o "$RUNLEVEL" = "1" ]; then + NFSMTAB=`LC_ALL=C awk '$3 ~ /^nfs/ { print $2 }' /proc/mounts` + SMBMTAB=`LC_ALL=C awk '$3 == "smbfs" { print $2 }' /proc/mounts` + NCPMTAB=`LC_ALL=C awk '$3 == "ncpfs" { print $2 }' /proc/mounts` + if [ -n "$NFSMTAB" -o -n "$SMBMTAB" -o -n "$NCPMTAB" ] ; then + /etc/init.d/netfs stop + fi + fi + + # IPv6 hook (pre IPv4 stop) + if [ -x /etc/sysconfig/network-scripts/init.ipv6-global ]; then + /etc/sysconfig/network-scripts/init.ipv6-global stop pre + fi + + vlaninterfaces="" + vpninterfaces="" + xdslinterfaces="" + bridgeinterfaces="" + remaining="" + rc=0 + + # get list of bonding, vpn, and xdsl interfaces + for i in $interfaces; do + unset DEVICE TYPE + eval $(LANG=C fgrep "DEVICE=" ifcfg-$i) + eval $(LANG=C fgrep "TYPE=" ifcfg-$i) + + if [ -z "$DEVICE" ] ; then DEVICE="$i"; fi + + if [ "${DEVICE##cipcb}" != "$DEVICE" ] ; then + vpninterfaces="$vpninterfaces $i" + continue + fi + if [ "$TYPE" = "IPSEC" ]; then + vpninterfaces="$vpninterfaces $i" + continue + fi + if [ "$TYPE" = "Bridge" ]; then + bridgeinterfaces="$bridgeinterfaces $i" + continue + fi + if [ "$TYPE" = "xDSL" ]; then + xdslinterfaces="$xdslinterfaces $i" + continue + fi + + if [ "${DEVICE%%.*}" != "$DEVICE" -o "${DEVICE##vlan}" != "$DEVICE" ] ; then + vlaninterfaces="$vlaninterfaces $i" + continue + fi + remaining="$remaining $i" + done + + for i in $vpninterfaces $xdslinterfaces $bridgeinterfaces $vlaninterfaces $remaining; do + (. ./ifcfg-$i + if [ -z "$DEVICE" ] ; then DEVICE="$i"; fi + + if ! check_device_down $DEVICE; then + action $"Shutting down interface $i: " ./ifdown $i boot + rc=$((rc+$?)) + fi + ) + done + + case "$IPX" in + yes|true) + if [ "$IPXINTERNALNETNUM" != "0" ]; then + /sbin/ipx_internal_net del + fi + ;; + esac + + action $"Shutting down loopback interface: " ./ifdown ifcfg-lo + + if [ -d /proc/sys/net/ipv4 ]; then + if [ -f /proc/sys/net/ipv4/ip_forward ]; then + if [ `cat /proc/sys/net/ipv4/ip_forward` != 0 ]; then + action $"Disabling IPv4 packet forwarding: " sysctl -w net.ipv4.ip_forward=0 + fi + fi + if [ -f /proc/sys/net/ipv4/ip_always_defrag ]; then + if [ `cat /proc/sys/net/ipv4/ip_always_defrag` != 0 ]; then + action $"Disabling IPv4 automatic defragmentation: " sysctl -w net.ipv4.ip_always_defrag=0 + fi + fi + fi + + # IPv6 hook (post IPv4 stop) + if [ -x /etc/sysconfig/network-scripts/init.ipv6-global ]; then + /etc/sysconfig/network-scripts/init.ipv6-global stop post + fi + + rm -f /var/lock/subsys/network + ;; + status) + echo $"Configured devices:" + echo lo $interfaces + + echo $"Currently active devices:" + echo $(/sbin/ip -o link show up | awk -F ": " '{ print $2 }') + ;; + restart|reload) + cd "$CWD" + $0 stop + $0 start + ;; + *) + echo $"Usage: $0 {start|stop|restart|reload|status}" + exit 1 +esac + +exit $rc diff --git a/root_image/etc/init.d/primary_fb b/root_image/etc/init.d/primary_fb new file mode 100755 index 0000000..0cb2c1a --- /dev/null +++ b/root_image/etc/init.d/primary_fb @@ -0,0 +1,48 @@ +#!/bin/bash + + . /etc/init.d/functions + +fb_start () +{ + mknod /dev/fb c 29 0 + mknod /dev/systty c 4 0 + /sbin/plymouthd & + + /usr/bin/fb_test + + modprobe i2c-core + modprobe i2c-algo-bit + modprobe drm debug=255 + modprobe radeon modeset=1 + modprobe nouveau modeset=1 + modprobe i915 modeset=1 + + /lib/udev/console_init tty0 + + if [ ! -d /dev/dri ]; then + rm -f /usr/lib*/plymouth/renderers/drm.so + fi + plymouth --show-splash + plymouth message --text=Yo +} + +fb_stop() +{ + plymouth --hide-splash + /usr/bin/fb_test +} + +NORM=$(boot_parameter 'nofb') +if [ $? == 1 ]; then + case "$1" in + start) + fb_start + ;; + stop) + fb_stop + ;; + *) + fb_start + ;; + esac +fi diff --git a/root_image/etc/init.d/primary_network b/root_image/etc/init.d/primary_network new file mode 100755 index 0000000..5fe282d --- /dev/null +++ b/root_image/etc/init.d/primary_network @@ -0,0 +1,32 @@ +#!/bin/bash + +mkdir -p /etc/sysconfig +echo "NETWORKING=yes" > /etc/sysconfig/network + +FILE=/etc/sysconfig/network-scripts/ifcfg-switch +echo "DEVICE=switch" > $FILE +echo "TYPE=Bridge" >> $FILE +echo "BOOTPROTO=dhcp" >> $FILE +echo "ONBOOT=yes" >> $FILE + +# Create the /etc/sysconfig/network-scripts/ifcfg-$ +NIC=eth0 +FILE=/etc/sysconfig/network-scripts/ifcfg-$NIC +echo "DEVICE=$NIC" > $FILE +echo "ONBOOT=yes" >> $FILE +echo "BRIDGE=switch" >> $FILE + +NICS=`ls -1 /sys/class/net/ | grep -v lo | grep -v sit` +# The rest +for NIC in $NICS +do + if [ "$NIC" == "eth0" ]; then + continue; + fi + FILE=/etc/sysconfig/network-scripts/ifcfg-$NIC + echo "DEVICE=$NIC" > $FILE + echo "ONBOOT=yes" >> $FILE + echo "BOOTPROTO=dhcp" >> $FILE +done + +/etc/init.d/network start diff --git a/root_image/etc/init.d/rcS b/root_image/etc/init.d/rcS new file mode 100755 index 0000000..813a202 --- /dev/null +++ b/root_image/etc/init.d/rcS @@ -0,0 +1,70 @@ +#!/bin/bash + +. /etc/init.d/functions + +action $"Mounting directories " +/etc/init.d/core_filesystems + +echo 10 > /proc/sys/kernel/printk + + +/usr/bin/load_xen_modules + +MODULE_PATH="/lib/modules/$(uname -r)" +echo -n /sbin/udevsend > /proc/sys/kernel/hotplug + +udevd -d + +udevadm trigger + +action $"Waiting for devices" +udevadm settle + +action $"Waiting for fb" +/etc/init.d/primary_fb start + +action $"Waiting for network" + +/etc/init.d/primary_network + +#NFS enabled. +if [ -e /sbin/rpcbind ]; then + /sbin/rpcbind + mkdir -p /var/lib/nfs/statd/sm/ + rpc.statd & +fi + +if [ -x /init.custom ]; then + action $"Waiting for init.custom" + /init.custom +fi + +action $"Waiting for SSHd" +/usr/bin/sshd_server -start + +NR_CPUS=`cat /proc/cpuinfo | grep proc | wc | awk '{ print $1 }'` +if [ $NR_CPUS > 1 ]; then + /usr/sbin/irqbalance +fi + +NODMADUMP=$(boot_parameter 'nodmadump') +if [ $? == 1 ]; then + modprobe dump_dma + rmmod dump_dma +fi + +/etc/init.d/primary_fb stop + +NOIBFT=$(boot_parameter 'noibft') +if [ $? == 1 ]; then + modprobe iscsi_ibft + /sbin/iscsistart -f +fi + +/usr/bin/xen-detect -N -q || /etc/init.d/xend start & + +PATH=$PATH:/usr/bin:/usr/sbin + +lsscsi +lspci +cat /proc/interrupts diff --git a/root_image/etc/inittab b/root_image/etc/inittab new file mode 100644 index 0000000..54dc941 --- /dev/null +++ b/root_image/etc/inittab @@ -0,0 +1,6 @@ +::sysinit:/etc/init.d/rcS +::ctrlaltdel:/sbin/reboot +::shutdown:/etc/init.d/halt +tty0::respawn:-/bin/sh +tty1::respawn:-/bin/sh +ttyS0::respawn:-/bin/sh diff --git a/root_image/etc/nsswitch.conf b/root_image/etc/nsswitch.conf new file mode 100644 index 0000000..679c523 --- /dev/null +++ b/root_image/etc/nsswitch.conf @@ -0,0 +1,63 @@ +# +# /etc/nsswitch.conf +# +# An example Name Service Switch config file. This file should be +# sorted with the most-used services at the beginning. +# +# The entry '[NOTFOUND=return]' means that the search for an +# entry should stop if the search in the previous entry turned +# up nothing. Note that if the search failed due to some other reason +# (like no NIS server responding) then the search continues with the +# next entry. +# +# Legal entries are: +# +# nisplus or nis+ Use NIS+ (NIS version 3) +# nis or yp Use NIS (NIS version 2), also called YP +# dns Use DNS (Domain Name Service) +# files Use the local files +# db Use the local database (.db) files +# compat Use NIS on compat mode +# hesiod Use Hesiod for user lookups +# [NOTFOUND=return] Stop searching if not found so far +# + +# To use db, put the "db" in front of "files" for entries you want to be +# looked up first in the databases +# +# Example: +#passwd: db files nisplus nis +#shadow: db files nisplus nis +#group: db files nisplus nis + +passwd: files +shadow: files +group: files + +#hosts: db files nisplus nis dns +hosts: dns files + +# Example - obey only what nisplus tells us... +#services: nisplus [NOTFOUND=return] files +#networks: nisplus [NOTFOUND=return] files +#protocols: nisplus [NOTFOUND=return] files +#rpc: nisplus [NOTFOUND=return] files +#ethers: nisplus [NOTFOUND=return] files +#netmasks: nisplus [NOTFOUND=return] files + +bootparams: nisplus [NOTFOUND=return] files + +ethers: files +netmasks: files +networks: files +protocols: files +rpc: files +services: files + +netgroup: nisplus + +publickey: nisplus + +automount: files nisplus +aliases: files nisplus + diff --git a/root_image/etc/passwd b/root_image/etc/passwd new file mode 100644 index 0000000..9c27ad1 --- /dev/null +++ b/root_image/etc/passwd @@ -0,0 +1,5 @@ +root:x:0:0:root:/root:/bin/bash +nobody:x:99:99:Nobody:/:/bin/false +vcsa:x:69:69:virtual console memory owner:/dev:/sbin/nologin +sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin +rpc:x:32:32:Rpcbind Daemon:/var/lib/rpcbind:/sbin/nologin diff --git a/root_image/etc/rc.d/init.d b/root_image/etc/rc.d/init.d new file mode 120000 index 0000000..431b44f --- /dev/null +++ b/root_image/etc/rc.d/init.d @@ -0,0 +1 @@ +../init.d \ No newline at end of file diff --git a/root_image/ldd-check.pl b/root_image/ldd-check.pl new file mode 100755 index 0000000..9780bcb --- /dev/null +++ b/root_image/ldd-check.pl @@ -0,0 +1,294 @@ +#!/usr/bin/perl -w +################################################################### +package GBLS ; # GLOBALS +################################################################### +# +# ldd-check.pl +# +# This script +# +# Author: Joshua Nicholas +# +# This scripts ensures that any given executable library dependencies +# have been satisfied. +# + +$GBLS::scriptName = $0 ; # Acquire full, then strip off path +$GBLS::scriptName =~ s/^.*\///go ; $GBLS::scriptName =~ s/^.*\\//go ; + +# Ensure safe perl version +BEGIN # BEGIN statement always gets executed immediately before continuing +{ + my $thePerlVersionStr = $] ; + if ( $thePerlVersionStr lt "5.008" ) + { + print "\n\n" ; + print "ABORT: The version of perl you are using is too low.\n" ; + print "\n\n" ; + } + require 5.008_000; # perl internal guard v5.8.0 +} + +# Unbuffer STDERR and STDOUT +STDERR->autoflush( 1 ); select(STDERR); $| = 1; +STDOUT->autoflush( 1 ); select(STDOUT); $| = 1; + +use strict; +use English; +use FileHandle; +use File::Basename; +use Carp; +use Cwd; + +################################################################### +sub process_file +# +{ + 2==@_ or croak( "GBLS::process_file - bad num of params [" . scalar(@_) . "]" ); + my $file = shift ; + my $basedir = shift ; + + # Skip anything not executable + return 0 if (! -f $file); + return 0 if (! (-X $file || -x $file) ); + + my @file_cmd_output = `file -b $file` ; + my $file_bitness = 0 ; + + chomp( @file_cmd_output ); + + return 0 if ( $file_cmd_output[0] =~ m/Bourne shell script text/ ); + return 0 if ( $file_cmd_output[0] =~ m/Bourne-Again shell script text/ ); + return 0 if ( $file_cmd_output[0] =~ m/POSIX shell script text executable/ ); + return 0 if ( $file_cmd_output[0] =~ m/perl script text/ ); + return 0 if ( $file_cmd_output[0] =~ m/python[0-9.]* script text/ ); + + # OpenSSL + return 0 if ( $file =~ m/hmac/ && $file_cmd_output[0] =~ m/ASCII text/ ); + # Bogus but this is how Xen distributes these + return 0 if ( $file =~ m/xen\/scripts/ && $file_cmd_output[0] =~ m/ASCII English text/ ); + return 0 if ( $file =~ m/etc\/sysconfig/ && $file_cmd_output[0] =~ m/ASCII text/ ); + + # Bogus but this is how the SLES LVM RPM unpacks + return 0 if ( $file eq 'userspace/var/adm/fillup-templates/sysconfig.lvm' && $file_cmd_output[0] =~ m/ASCII news text/ ); + + $file_bitness= 32 if ( $file_cmd_output[0] =~ m/^ELF 32-bit / ); + $file_bitness= 64 if ( $file_cmd_output[0] =~ m/^ELF 64-bit / ); + $file_bitness= 64 if ( $file_cmd_output[0] =~ m/^setuid ELF 64-bit / ); + + # Skip anything not executable + if ( $file_bitness == 0 ) + { + return 0 if ( $file =~ m/\.gz$/ ); # Ignore compressed files + + printf( "\n" ); + printf( "$GBLS::scriptName :WARNING: skipping unknown type of executable '$file'\n" ); + printf( " :: " . join( "\n :: ", @file_cmd_output ) . "\n" ); + printf( "\n" ); + return 0 ; + } + + my @ldd_cmd_output = `ldd $file` ; + my $ldd_output_ref = undef ; + + chomp( @ldd_cmd_output ); + + return 0 if ( $ldd_cmd_output[0] =~ m/not a dynamic executable/ ); + return 0 if ( $ldd_cmd_output[0] =~ m/statically linked/ ); + +# if ( 0 || ( 0 && $file =~ m/myFavoriteExecutableFile/ ) ) + if ( 0 || ( 0 && $file =~ m/myFavoriteExecutableFile/ ) ) + { + printf( "\n" ); + printf( " RAW ldd '$file' output\n" ); + printf( " :: " . join( "\n :: ", @ldd_cmd_output ) . "\n" ); + printf( "\n" ); + } + + # Remove any virtual DSOs (shared objects exposed by the kernel at a fixed address in every process memory) + @ldd_cmd_output = grep !/\s=>\s*\(/, @ldd_cmd_output ; + + foreach $ldd_output_ref (@ldd_cmd_output) + { + $ldd_output_ref =~ s/^\s// ; + + # remove working dir from path. This became + # problematic when adding locale support libs + # for libvirt + my $cwd = getcwd(); + $ldd_output_ref =~ s/$cwd\/userspace// ; + + if ($ldd_output_ref =~ m/\s=>\snot found$/) + { + $ldd_output_ref =~ s/\s=>\snot found$// ; + $ldd_output_ref = "???/${ldd_output_ref}" + } + + $ldd_output_ref =~ s/^.*\s=>\s// ; + $ldd_output_ref =~ s/\s.*$// ; + } + +# if ( 0 || ( 0 && $file =~ m/myFavoriteExecutableFile/ ) ) + if ( 0 || ( 0 && $file =~ m/myFavoriteExecutableFile/ ) ) + { + printf( "\n" ); + printf( " Converted ldd '$file' output\n" ); + printf( " :: " . join( "\n :: ", @ldd_cmd_output ) . "\n" ); + printf( "\n" ); + } + + my $file_missing_components = 0 ; + my $dep_path = undef ; + + # + # Now that we have the list of dependencies, + # make sure they are all available. + # + foreach $ldd_output_ref (@ldd_cmd_output) + { + if ( $ldd_output_ref =~ s/^\?\?\?\/// ) + { # PATH is unknown + if ( $file_bitness == 64 ) + { + $dep_path = "${basedir}/lib64/${ldd_output_ref}" ; +# printf( " TRY: $dep_path | $ldd_output_ref\n" ); + next if ( -x "$dep_path" ); + next if ( -X "$dep_path" ); + + if ( -e "$dep_path" ) + { + printf( " $file ::ERROR:: $dep_path is NOT executable\n" ); + next; + } + + $dep_path = "${basedir}/usr/lib64/${ldd_output_ref}" ; +# printf( " TRY: $dep_path | $ldd_output_ref\n" ); + next if ( -x "$dep_path" ); + next if ( -X "$dep_path" ); + + if ( -e "$dep_path" ) + { + printf( " $file ::ERROR:: $dep_path is NOT executable\n" ); + next; + } + } + if ( $file_bitness == 32 ) + { + $dep_path = "${basedir}/lib/${ldd_output_ref}" ; +# printf( " TRY: $dep_path | $ldd_output_ref\n" ); + next if ( -x "$dep_path" ); + next if ( -X "$dep_path" ); + + if ( -e "$dep_path" ) + { + printf( " $file ::ERROR:: $dep_path is NOT executable\n" ); + next; + } + + $dep_path = "${basedir}/usr/lib/${ldd_output_ref}" ; +# printf( " TRY: $dep_path | $ldd_output_ref\n" ); + next if ( -x "$dep_path" ); + next if ( -X "$dep_path" ); + + if ( -e "$dep_path" ) + { + printf( " $file ::ERROR:: $dep_path is NOT executable\n" ); + next; + } + } + } + else + { # PATH is known + $dep_path = "${basedir}${ldd_output_ref}" ; +# printf( " TRY: $dep_path | $ldd_output_ref\n" ); + + next if ( -x "$dep_path" ); + next if ( -X "$dep_path" ); + + if ( -e "$dep_path" ) + { + printf( " $file ::ERROR:: $dep_path is NOT executable\n" ); + next; + } + + if ( 1 ) # HACK because Makefile.dom0 is too lame to install libs in their real location + { + my $libname = basename( $dep_path ); + + $dep_path = "${basedir}/lib64/${libname}" if ( $file_bitness == 64 ); + $dep_path = "${basedir}/lib/${libname}" if ( $file_bitness == 32 ); +# printf( " TRY: $dep_path | $ldd_output_ref\n" ); + next if ( -x "$dep_path" ); + next if ( -X "$dep_path" ); + + if ( -e "$dep_path" ) + { + printf( " $file ::ERROR:: $dep_path is NOT executable\n" ); + next; + } + + $dep_path = "${basedir}${ldd_output_ref}" ; + } + } + + printf( " $file ::MISSING:: $dep_path\n" ); + ++$file_missing_components; + } + + if ( $file_missing_components ) + { +# if ( 0 || ( 0 && $file =~ m/myFavoriteExecutableFile/ ) ) + if ( 0 || ( 0 && $file =~ m/myFavoriteExecutableFile/ ) ) + { + printf( " FULL Converted ldd '$file' output\n" ); + printf( " :: " . join( "\n :: ", @ldd_cmd_output ) . "\n" ); + printf( "\n" ); + } + + return $file_missing_components ; + } + + return 0 ; +} +################################################################### +sub main +# +{ + my @inputArgs_ARRAY = @_ ; + my $inputArg = undef ; + my $basedir = './userspace' ; + my $file_missing_components = 0 ; + my $total_missing_components = 0 ; + + while ( 1 ) + { + $inputArg = shift @inputArgs_ARRAY ; + last if ( ! defined $inputArg ) ; + + $file_missing_components = &GBLS::process_file( $inputArg, $basedir ) ; + $total_missing_components += $file_missing_components ; + } + + if ( $total_missing_components ) + { + printf( "\n" ); + printf( "$GBLS::scriptName :: **************** MISSING SHAREABLE MODULES ****************\n" ); + printf( "\n" ); + } + + return 111 if ( $total_missing_components > 111 ); + + return $total_missing_components ; +} +################################################################### +package script_main ; # Script main + +#print scalar( localtime ) . "\n" ; +my $execRetVal_main = &GBLS::main( @ARGV ) ; +#print scalar( localtime ) . "\n" ; +exit $execRetVal_main ; + +__END__ +# +# END +########## diff --git a/root_image/tools/Makefile b/root_image/tools/Makefile new file mode 100644 index 0000000..2188f48 --- /dev/null +++ b/root_image/tools/Makefile @@ -0,0 +1,23 @@ +SUBDIRS := ssh_support +SUBDIRS += load_xen_modules +SUBDIRS += iostat-2.2 +SUBDIRS += debug + +.PHONY: all +all: + @set -e; for subdir in $(SUBDIRS); do \ + if [ -f $$subdir/configure ]; then \ + (cd $$subdir;./configure); \ + fi; \ + $(MAKE) $(MFLAGS) -C $$subdir $@; \ + done + +.PHONY: distclean +distclean: clean + +.PHONY: clean +clean: + @set -e; for subdir in $(SUBDIRS); do \ + $(MAKE) $(MFLAGS) -C $$subdir $@ clean; \ + done + diff --git a/root_image/tools/debug/Makefile b/root_image/tools/debug/Makefile new file mode 100644 index 0000000..dd7fe0d --- /dev/null +++ b/root_image/tools/debug/Makefile @@ -0,0 +1,25 @@ +TARGETS-y := fbtools fb_test +TARGETS := $(TARGETS-y) + +INSTALL_BIN-y := fb_test +INSTALL_BIN := $(INSTALL_BIN-y) + + +.PHONY: all +all: build + +.PHONY: build +build: $(TARGETS) + +.PHONY: install +install: build + $(INSTALL_DIR) $(DESTDIR)$(BINDIR) + $(INSTALL_DIR) $(DESTDIR)$(SBINDIR) + +.PHONY: clean +clean: + $(RM) *.o $(TARGETS) *~ $(DEPS) + +%.o: %.c $(HDRS) Makefile + $(CC) -c $(CFLAGS) -o $@ $< + diff --git a/root_image/tools/debug/fb_test.c b/root_image/tools/debug/fb_test.c new file mode 100644 index 0000000..82a1fa1 --- /dev/null +++ b/root_image/tools/debug/fb_test.c @@ -0,0 +1,68 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static char filename[] = "/dev/fb0"; +int main(int argc, char *argv[]) +{ + struct fb_var_screeninfo screeninfo; + int fd = -1; + int rc; + unsigned char *fbuf; + struct stat buf; + int row, column; + int i; + int len; + + printf("Starting..[%s]\n", filename); + + fd = open(filename, O_RDWR); + if (fd <= 0) { + printf("Could not open; err: %d\n", errno); + return errno; + } + if (stat(filename, &buf) != 0) { + printf("Could not open; err: %d\n", errno); + return errno; + } + + printf("%s: len:%d\n", filename, buf.st_size); + rc = ioctl(fd, FBIOGET_VSCREENINFO, &screeninfo); + if (rc) { + printf("Could not do ioctl. err: %d\n", errno); + return errno; + } + printf("%s: bits/pixel%d\n", filename, screeninfo.bits_per_pixel); + len = screeninfo.xres * screeninfo.yres; + fbuf = mmap(0, len, PROT_WRITE|PROT_READ, MAP_SHARED, fd, 0); + if (fbuf == MAP_FAILED) { + printf("Could not map: error: %d\n", errno); + return errno; + } + if (argc > 1) { + int outfd; + outfd = open(argv[1], O_RDWR|O_CREAT, 0644); + if (outfd != -1) { + write(outfd, fbuf, len); + close(outfd); + } + } + printf("(%lx): Writting .. [%d:%d]\n", fbuf, screeninfo.xres,screeninfo.yres); + i = 0; + for (i = 0; i < len; i++) { + fbuf[i] = (i % 255); + } + printf("Done!\n"); + if (munmap(fbuf, len)) { + printf("Could not unmap: %d\n", errno); + return errno; + } + close(fd); + return 0; +} diff --git a/root_image/tools/debug/fbtools.c b/root_image/tools/debug/fbtools.c new file mode 100644 index 0000000..53c4a9c --- /dev/null +++ b/root_image/tools/debug/fbtools.c @@ -0,0 +1,541 @@ +/* + * some generic framebuffer device stuff + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +//#include + +#include "fbtools.h" + +/* -------------------------------------------------------------------- */ +/* exported stuff */ + +struct fb_fix_screeninfo fb_fix; +struct fb_var_screeninfo fb_var; +unsigned char *fb_mem; +int fb_mem_offset = 0; +int fb_switch_state = FB_ACTIVE; + +/* -------------------------------------------------------------------- */ +/* internal variables */ + +static int fb,tty; +#if 0 +static int bpp,black,white; +#endif + +static int orig_vt_no = 0; +static struct vt_mode vt_mode; + +static int kd_mode; +static struct vt_mode vt_omode; +static struct termios term; +static struct fb_var_screeninfo fb_ovar; +static unsigned short ored[256], ogreen[256], oblue[256]; +static struct fb_cmap ocmap = { 0, 256, ored, ogreen, oblue }; + +/* -------------------------------------------------------------------- */ +/* devices */ + +struct DEVS { + char *fb0; + char *fbnr; + char *ttynr; +}; + +struct DEVS devs_default = { + fb0: "/dev/fb0", + fbnr: "/dev/fb%d", + ttynr: "/dev/tty%d", +}; +struct DEVS devs_devfs = { + fb0: "/dev/fb/0", + fbnr: "/dev/fb/%d", + ttynr: "/dev/vc/%d", +}; +struct DEVS *devices; + +static void dev_init(void) +{ + struct stat dummy; + + if (NULL != devices) + return; + if (0 == stat("/dev/.devfsd",&dummy)) + devices = &devs_devfs; + else + devices = &devs_default; +} + +/* -------------------------------------------------------------------- */ +/* console switching */ + +extern int debug; + +static void +fb_switch_signal(int signal) +{ + if (signal == SIGUSR1) { + /* release */ + fb_switch_state = FB_REL_REQ; + if (debug) + write(2,"vt: SIGUSR1\n",12); + } + if (signal == SIGUSR2) { + /* acquisition */ + fb_switch_state = FB_ACQ_REQ; + if (debug) + write(2,"vt: SIGUSR2\n",12); + } +} + +void +fb_switch_release() +{ + ioctl(tty, VT_RELDISP, 1); + fb_switch_state = FB_INACTIVE; + if (debug) + write(2,"vt: release\n",12); +} + +void +fb_switch_acquire() +{ + ioctl(tty, VT_RELDISP, VT_ACKACQ); + fb_switch_state = FB_ACTIVE; + if (debug) + write(2,"vt: acquire\n",12); +} + +int +fb_switch_init() +{ + struct sigaction act,old; + + memset(&act,0,sizeof(act)); + act.sa_handler = fb_switch_signal; + sigemptyset(&act.sa_mask); + sigaction(SIGUSR1,&act,&old); + sigaction(SIGUSR2,&act,&old); + + if (-1 == ioctl(tty,VT_GETMODE, &vt_mode)) { + perror("ioctl VT_GETMODE"); + exit(1); + } + vt_mode.mode = VT_PROCESS; + vt_mode.waitv = 0; + vt_mode.relsig = SIGUSR1; + vt_mode.acqsig = SIGUSR2; + + if (-1 == ioctl(tty,VT_SETMODE, &vt_mode)) { + perror("ioctl VT_SETMODE"); + //exit(1); + } + return 0; +} + +/* -------------------------------------------------------------------- */ +/* initialisation & cleanup */ + +void +fb_memset (void *addr, int c, size_t len) +{ +#if 1 /* defined(__powerpc__) */ + unsigned int i, *p; + + i = (c & 0xff) << 8; + i |= i << 16; + len >>= 2; + for (p = addr; len--; p++) + *p = i; +#else + memset(addr, c, len); +#endif +} + +static int +fb_setmode(char *name) +{ + FILE *fp; + char line[80],label[32],value[16]; + int geometry=0, timings=0; + + /* load current values */ + if (-1 == ioctl(fb,FBIOGET_VSCREENINFO,&fb_var)) { + perror("ioctl FBIOGET_VSCREENINFO"); + exit(1); + } + + if (NULL == name) + return -1; + if (NULL == (fp = fopen("/etc/fb.modes","r"))) + return -1; + while (NULL != fgets(line,79,fp)) { + if (1 == sscanf(line, "mode \"%31[^\"]\"",label) && + 0 == strcmp(label,name)) { + /* fill in new values */ + fb_var.sync = 0; + fb_var.vmode = 0; + while (NULL != fgets(line,79,fp) && + NULL == strstr(line,"endmode")) { + if (5 == sscanf(line," geometry %d %d %d %d %d", + &fb_var.xres,&fb_var.yres, + &fb_var.xres_virtual,&fb_var.yres_virtual, + &fb_var.bits_per_pixel)) + geometry = 1; + if (7 == sscanf(line," timings %d %d %d %d %d %d %d", + &fb_var.pixclock, + &fb_var.left_margin, &fb_var.right_margin, + &fb_var.upper_margin, &fb_var.lower_margin, + &fb_var.hsync_len, &fb_var.vsync_len)) + timings = 1; + if (1 == sscanf(line, " hsync %15s",value) && + 0 == strcasecmp(value,"high")) + fb_var.sync |= FB_SYNC_HOR_HIGH_ACT; + if (1 == sscanf(line, " vsync %15s",value) && + 0 == strcasecmp(value,"high")) + fb_var.sync |= FB_SYNC_VERT_HIGH_ACT; + if (1 == sscanf(line, " csync %15s",value) && + 0 == strcasecmp(value,"high")) + fb_var.sync |= FB_SYNC_COMP_HIGH_ACT; + if (1 == sscanf(line, " extsync %15s",value) && + 0 == strcasecmp(value,"true")) + fb_var.sync |= FB_SYNC_EXT; + if (1 == sscanf(line, " laced %15s",value) && + 0 == strcasecmp(value,"true")) + fb_var.vmode |= FB_VMODE_INTERLACED; + if (1 == sscanf(line, " double %15s",value) && + 0 == strcasecmp(value,"true")) + fb_var.vmode |= FB_VMODE_DOUBLE; + } + /* ok ? */ + if (!geometry || !timings) + return -1; + /* set */ + fb_var.xoffset = 0; + fb_var.yoffset = 0; + if (-1 == ioctl(fb,FBIOPUT_VSCREENINFO,&fb_var)) + perror("ioctl FBIOPUT_VSCREENINFO"); + /* look what we have now ... */ + if (-1 == ioctl(fb,FBIOGET_VSCREENINFO,&fb_var)) { + perror("ioctl FBIOGET_VSCREENINFO"); + exit(1); + } + return 0; + } + } + return -1; +} + +static void +fb_setvt(int vtno) +{ + struct vt_stat vts; + char vtname[12]; + + if (vtno < 0) { + if (-1 == ioctl(tty,VT_OPENQRY, &vtno) || vtno == -1) { + perror("ioctl VT_OPENQRY"); + exit(1); + } + } + + vtno &= 0xff; + sprintf(vtname, devices->ttynr, vtno); + chown(vtname, getuid(), getgid()); + if (-1 == access(vtname, R_OK | W_OK)) { + fprintf(stderr,"access %s: %s\n",vtname,strerror(errno)); + exit(1); + } + switch (fork()) { + case 0: + break; + case -1: + perror("fork"); + exit(1); + default: + exit(0); + } + close(tty); + close(0); + close(1); + close(2); + setsid(); + open(vtname,O_RDWR); + dup(0); + dup(0); + + if (-1 == ioctl(tty,VT_GETSTATE, &vts)) { + perror("ioctl VT_GETSTATE"); + exit(1); + } + orig_vt_no = vts.v_active; + if (-1 == ioctl(tty,VT_ACTIVATE, vtno)) { + perror("ioctl VT_ACTIVATE"); + exit(1); + } + if (-1 == ioctl(tty,VT_WAITACTIVE, vtno)) { + perror("ioctl VT_WAITACTIVE"); + exit(1); + } +} + +/* Hmm. radeonfb needs this. matroxfb doesn't. */ +static int fb_activate_current(int tty) +{ + struct vt_stat vts; + + if (-1 == ioctl(tty,VT_GETSTATE, &vts)) { + perror("ioctl VT_GETSTATE"); + return -1; + } + if (-1 == ioctl(tty,VT_ACTIVATE, vts.v_active)) { + perror("ioctl VT_ACTIVATE"); + return -1; + } + if (-1 == ioctl(tty,VT_WAITACTIVE, vts.v_active)) { + perror("ioctl VT_WAITACTIVE"); + return -1; + } + return 0; +} + +int +fb_init(char *device, char *mode, int vt) +{ + char fbdev[16]; + struct vt_stat vts; + + dev_init(); + tty = 0; + if (vt != 0) + fb_setvt(vt); + + if (-1 == ioctl(tty,VT_GETSTATE, &vts)) { + fprintf(stderr,"ioctl VT_GETSTATE: %s (not a linux console?)\n", + strerror(errno)); + //exit(1); + } + + if (NULL == device) { + device = getenv("FRAMEBUFFER"); + if (NULL == device) { + struct fb_con2fbmap c2m; + if (-1 == (fb = open(devices->fb0,O_WRONLY,0))) { + fprintf(stderr,"open %s: %s\n",devices->fb0,strerror(errno)); + exit(1); + } + c2m.console = vts.v_active; + if (-1 == ioctl(fb, FBIOGET_CON2FBMAP, &c2m)) { + perror("ioctl FBIOGET_CON2FBMAP"); + exit(1); + } + close(fb); + fprintf(stderr,"map: vt%02d => fb%d\n", + c2m.console,c2m.framebuffer); + sprintf(fbdev,devices->fbnr,c2m.framebuffer); + device = fbdev; + } + } + + /* get current settings (which we have to restore) */ + if (-1 == (fb = open(device,O_RDWR /* O_WRONLY */))) { + fprintf(stderr,"open %s: %s\n",device,strerror(errno)); + exit(1); + } + if (-1 == ioctl(fb,FBIOGET_VSCREENINFO,&fb_ovar)) { + perror("ioctl FBIOGET_VSCREENINFO"); + exit(1); + } + if (-1 == ioctl(fb,FBIOGET_FSCREENINFO,&fb_fix)) { + perror("ioctl FBIOGET_FSCREENINFO"); + exit(1); + } + if (fb_ovar.bits_per_pixel == 8 || + fb_fix.visual == FB_VISUAL_DIRECTCOLOR) { + if (-1 == ioctl(fb,FBIOGETCMAP,&ocmap)) { + perror("ioctl FBIOGETCMAP"); + exit(1); + } + } + if (-1 == ioctl(tty,KDGETMODE, &kd_mode)) { + perror("ioctl KDGETMODE"); + //exit(1); + } + if (-1 == ioctl(tty,VT_GETMODE, &vt_omode)) { + perror("ioctl VT_GETMODE"); + //exit(1); + } + tcgetattr(tty, &term); + + /* switch mode */ + fb_setmode(mode); + + /* checks & initialisation */ + if (-1 == ioctl(fb,FBIOGET_FSCREENINFO,&fb_fix)) { + perror("ioctl FBIOGET_FSCREENINFO"); + exit(1); + } + if (fb_fix.type != FB_TYPE_PACKED_PIXELS) { + fprintf(stderr,"can handle only packed pixel frame buffers\n"); + goto err; + } +#if 0 + switch (fb_var.bits_per_pixel) { + case 8: + white = 255; black = 0; bpp = 1; + break; + case 15: + case 16: + if (fb_var.green.length == 6) + white = 0xffff; + else + white = 0x7fff; + black = 0; bpp = 2; + break; + case 24: + white = 0xffffff; black = 0; bpp = fb_var.bits_per_pixel/8; + break; + case 32: + white = 0xffffff; black = 0; bpp = fb_var.bits_per_pixel/8; + fb_setpixels = fb_setpixels4; + break; + default: + fprintf(stderr, "Oops: %i bit/pixel ???\n", + fb_var.bits_per_pixel); + goto err; + } +#endif + fb_mem_offset = 0;//(unsigned long)(fb_fix.smem_start) & (~PAGE_MASK); + fb_mem = mmap(NULL,fb_fix.smem_len+fb_mem_offset, + PROT_READ|PROT_WRITE,MAP_SHARED,fb,0); + if (-1L == (long)fb_mem) { + perror("mmap"); + goto err; + } + /* move viewport to upper left corner */ + if (fb_var.xoffset != 0 || fb_var.yoffset != 0) { + fb_var.xoffset = 0; + fb_var.yoffset = 0; + if (-1 == ioctl(fb,FBIOPAN_DISPLAY,&fb_var)) { + perror("ioctl FBIOPAN_DISPLAY"); + goto err; + } + } + if (-1 == ioctl(tty,KDSETMODE, KD_GRAPHICS)) { + perror("ioctl KDSETMODE"); + goto err; + } + fb_activate_current(tty); + + printf("cls\n"); + /* cls */ + fb_memset(fb_mem+fb_mem_offset,0,fb_fix.smem_len); + return fb; + + err: + fb_cleanup(); + exit(1); +} + +void +fb_cleanup(void) +{ + /* restore console */ + if (-1 == ioctl(fb,FBIOPUT_VSCREENINFO,&fb_ovar)) + perror("ioctl FBIOPUT_VSCREENINFO"); + if (-1 == ioctl(fb,FBIOGET_FSCREENINFO,&fb_fix)) + perror("ioctl FBIOGET_FSCREENINFO"); + if (fb_ovar.bits_per_pixel == 8 || + fb_fix.visual == FB_VISUAL_DIRECTCOLOR) { + if (-1 == ioctl(fb,FBIOPUTCMAP,&ocmap)) + perror("ioctl FBIOPUTCMAP"); + } + close(fb); + + if (-1 == ioctl(tty,KDSETMODE, kd_mode)) + perror("ioctl KDSETMODE"); + if (-1 == ioctl(tty,VT_SETMODE, &vt_omode)) + perror("ioctl VT_SETMODE"); + if (orig_vt_no && -1 == ioctl(tty, VT_ACTIVATE, orig_vt_no)) + perror("ioctl VT_ACTIVATE"); + if (orig_vt_no && -1 == ioctl(tty, VT_WAITACTIVE, orig_vt_no)) + perror("ioctl VT_WAITACTIVE"); + tcsetattr(tty, TCSANOW, &term); + close(tty); +} + +/* -------------------------------------------------------------------- */ +/* handle fatal errors */ + +static jmp_buf fb_fatal_cleanup; + +static void +fb_catch_exit_signal(int signal) +{ + siglongjmp(fb_fatal_cleanup,signal); +} + +void +fb_catch_exit_signals(void) +{ + struct sigaction act,old; + int termsig; + + memset(&act,0,sizeof(act)); + act.sa_handler = fb_catch_exit_signal; + sigemptyset(&act.sa_mask); + sigaction(SIGINT, &act,&old); + sigaction(SIGQUIT,&act,&old); + sigaction(SIGTERM,&act,&old); + + sigaction(SIGABRT,&act,&old); + sigaction(SIGTSTP,&act,&old); + + sigaction(SIGBUS, &act,&old); + sigaction(SIGILL, &act,&old); + sigaction(SIGSEGV,&act,&old); + + if (0 == (termsig = sigsetjmp(fb_fatal_cleanup,0))) + return; + + /* cleanup */ + fb_cleanup(); + fprintf(stderr,"Oops: %s\n",sys_siglist[termsig]); + exit(42); +} + +int main(int argc, char *argv[]) +{ + int fd = fb_init("/dev/fb0","800x600-60", 0); + int i; + + if (!fd) { + printf("No FD!\n"); + return -1; + } + while (1) + for (i = 0; i < fb_fix.smem_len; i++) { + fb_mem[i] = (i % 255); + } + close(fd); + return 0; +} diff --git a/root_image/tools/debug/fbtools.h b/root_image/tools/debug/fbtools.h new file mode 100644 index 0000000..61f47e4 --- /dev/null +++ b/root_image/tools/debug/fbtools.h @@ -0,0 +1,23 @@ +#define FB_ACTIVE 0 +#define FB_REL_REQ 1 +#define FB_INACTIVE 2 +#define FB_ACQ_REQ 3 + +/* info about videomode - yes I know, quick & dirty... */ +extern struct fb_fix_screeninfo fb_fix; +extern struct fb_var_screeninfo fb_var; +extern unsigned char *fb_mem; +extern int fb_mem_offset; +extern int fb_switch_state; +int debug; +/* init + cleanup */ +int fb_probe(void); +int fb_init(char *device, char *mode, int vt); +void fb_cleanup(void); +void fb_catch_exit_signals(void); +void fb_memset(void *addr, int c, size_t len); + +/* console switching */ +int fb_switch_init(void); +void fb_switch_release(void); +void fb_switch_acquire(void); diff --git a/root_image/tools/iostat-2.2/INSTALL b/root_image/tools/iostat-2.2/INSTALL new file mode 100644 index 0000000..3085786 --- /dev/null +++ b/root_image/tools/iostat-2.2/INSTALL @@ -0,0 +1,4 @@ +Couldn't be simpler :) + +make +make install diff --git a/root_image/tools/iostat-2.2/LICENSE b/root_image/tools/iostat-2.2/LICENSE new file mode 100644 index 0000000..d60c31a --- /dev/null +++ b/root_image/tools/iostat-2.2/LICENSE @@ -0,0 +1,340 @@ + 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. + + + Copyright (C) + + 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) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 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/root_image/tools/iostat-2.2/Makefile b/root_image/tools/iostat-2.2/Makefile new file mode 100644 index 0000000..cb50bc9 --- /dev/null +++ b/root_image/tools/iostat-2.2/Makefile @@ -0,0 +1,22 @@ +# Makefile for iostat, Linux I/O performance monitoring utility +# (C) 2002-2005 by Zlatko Calusic + +CC = gcc +CFLAGS = -g -O2 -Wall -fomit-frame-pointer +LDFLAGS = + +SRC = iostat.c +BIN = iostat + +all: $(BIN) + +$(BIN): $(SRC) + $(CC) $(CFLAGS) $(SRC) -o $@ $(LDFLAGS) + +install: $(BIN) + install -d /usr/local/bin /usr/local/man/man8 + install -o root -g root -m 755 -s iostat /usr/local/bin + install -o root -g root -m 644 iostat.8 /usr/local/man/man8 + +clean: + rm -f $(BIN) core diff --git a/root_image/tools/iostat-2.2/README b/root_image/tools/iostat-2.2/README new file mode 100644 index 0000000..14f2895 --- /dev/null +++ b/root_image/tools/iostat-2.2/README @@ -0,0 +1,8 @@ +iostat - Linux I/O performance monitoring utility + +Homepage: http://linux.inet.hr/ + +Check out the manual for more info. + +-- +Zlatko Calusic , Jan 6 2004 diff --git a/root_image/tools/iostat-2.2/iostat.8 b/root_image/tools/iostat-2.2/iostat.8 new file mode 100644 index 0000000..9f45d86 --- /dev/null +++ b/root_image/tools/iostat-2.2/iostat.8 @@ -0,0 +1,155 @@ +.TH iostat 8 "6 January 2004" "Linux 2.4" "Linux Administrator's Manual" + +.SH NAME +iostat \- report disk I/O statistics + +.SH SYNOPSIS +.B iostat +[ \fB\-cdDpPxh\fP ] [ \fIdisk\fP ...] [ \fIinterval\fP [ \fIcount\fP ]] + +.SH DESCRIPTION +\fBiostat\fP reports disk I/O statistics. The first line of a report +gives averages since the last reboot. Additional lines provide +information on a sampling period of length \fIinterval\fP. +\fBiostat\fP can also provide information about CPU activity. +.PP +For its operation \fBiostat\fP requires disk I/O statistics counters +in kernel, which were introduced in 2.4.20. It is possible to get the +utility running on 2.2 kernel, but in that case kernel must be +compiled with sard accounting patch applied. + +.SH COMMAND-LINE OPTIONS +.B +.IP c +Print CPU activity statistics. +.B +.IP d +Print terse disk I/O statistics (kps, tps, svc_t) for each disk +device. +.B +.IP D +Print terse disk utilization statistics (r/w, w/s, %busy) for each +disk device. +.B +.IP p +Print per partition statistics for each disk, in addition to per +device statistics. +.B +.IP P +Print only per partition statistics (omit per device statistics). +.B +.IP x +Print extended information. See below for more info. +.B +.IP h +Print short help information on usage. +.PP +With no options specified on command line, \fBiostat\fP defaults to +\fB\-dc 1 1\fP. +.PP +You can explicitly specify \fIdisk\fPs for which statistics are to be +reported. \fIinterval\fP specifies number of seconds between reports +(a sampling period) and \fIcount\fP specifies how many reports to +print. + +.SH FIELD DESCRIPTIONS +.B +.IP device +name of disk device/partition +.B +.IP kps +total (read + write) transfer rate in kilobytes per second +.B +.IP tps +total (read + write) number of requests per second +.B +.IP r/s +number of reads per second +.B +.IP w/s +number of writes per second +.B +.IP us +percentage of time CPU spent in user mode +.B +.IP sy +percentage of time CPU spent in system mode (in kernel) +.B +.IP id +percentage of time CPU was idle +.B +.IP mgr/s +number of read merges per second (smaller read requests that were +successfully merged into a bigger one) +.B +.IP mgw/s +number of write merges per second +.B +.IP kr/s +kilobytes read per second +.B +.IP kw/s +kilobytes written per second +.B +.IP size +average size of the requests sent to disk in kilobytes +.B +.IP queue +average number of queued requests +.B +.IP wait +average time to complete a request (includes time spent in queue and +disk service time) +.B +.IP svc_t +average disk service time in milliseconds +.B +.IP %b +disk utilization, percentage of time disk was busy serving requests + +.SH NOTES +To get I/O counters in 2.4, kernel must be compiled with +CONFIG_BLK_STATS=y. After that /proc/partitions has the counters in +the additional columns. In 2.6 counters are unconditionally available +in /proc/diskstats (and also in sysfs virtual filesystem, if you have +it mounted). +.PP +There were significant changes between 2.4 and 2.6 in the I/O +subsystem. As a result, some statistic information disappeared in +2.6. The translation from a disk address relative to a partition to +the disk address relative to the host disk happens much earlier. All +merges and timings now happen at the disk level rather than at both +the disk and partition level as in 2.4. Consequently, in 2.6 kernel +you will see only kilobytes read/written information when looking at +per partition information. To be honest, showing number of +reads/writes would be also possible, but numbers are meaningless +because data is sampled before kernel merges requests, so \fBiostat\fP +is not reporting it to avoid confusion. + +.SH EXAMPLE +.nf +iostat -x 1 +... + extended device statistics +device mgr/s mgw/s r/s w/s kr/s kw/s size queue wait svc_t %b +hde 2199 1 147.5 2.0 9378.2 11.9 62.8 1.0 6.6 2.8 42 +hda 0 2063 0.0 163.4 0.0 8669.3 53.1 90.5 711.3 6.1 100 +.fi + +.SH FILES +.nf +/proc/diskstats +/proc/partitions +/proc/stat +/proc/cpuinfo +.fi + +.SH SEE ALSO +.BR vmstat(1). + +.SH AUTHORS +.nf +Sard I/O accounting patch written by Stephen C. Tweedie. +Original \fBiostat\fP utility written by Greg Franks. +Maintenance by Zlatko Calusic +.fi diff --git a/root_image/tools/iostat-2.2/iostat.c b/root_image/tools/iostat-2.2/iostat.c new file mode 100644 index 0000000..13e2af7 --- /dev/null +++ b/root_image/tools/iostat-2.2/iostat.c @@ -0,0 +1,563 @@ +/* + * iostat.c v2.2 + * Linux I/O performance monitoring utility + * + * Special thanks to Stephen C. Tweedie's for his first version of + * "sard" I/O counters for the Linux kernel. Without his work this + * wouldn't be possible. + * + * Original iostat code by Greg Franks (Mar 10 1999) + * + * Maintenance by Zlatko Calusic + * + * v1.4 - Apr 7 2002, Zlatko Calusic , + * - SMP compatibility, other bugfixes, cleanups... + * + * v1.5 - Apr 10 2002, Zlatko Calusic + * - heavily modified & cleaned up, adapted to 2.5.8-pre3 sard patch + * + * v1.6 - Sep 24 2002, Rick Lindsley + * - modified to understand new disk stats (2.5.38) + * + * v2.0 - Jan 6 2004, Zlatko Calusic + * - major release, support for both 2.4 & 2.6 stable kernels + * + * v2.1 - Nov 25 2004, Zlatko Calusic + * - just added license info (GPL) + * + * v2.2 - Feb 14 2005, Arnaud Desitter + * Zlatko Calusic + * - adapt to in kernel scan formats, fixes to avoid overflows + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#ifndef IDE_DISK_MAJOR +#define IDE_DISK_MAJOR(M) ((M) == IDE0_MAJOR || (M) == IDE1_MAJOR || \ + (M) == IDE2_MAJOR || (M) == IDE3_MAJOR || \ + (M) == IDE4_MAJOR || (M) == IDE5_MAJOR || \ + (M) == IDE6_MAJOR || (M) == IDE7_MAJOR || \ + (M) == IDE8_MAJOR || (M) == IDE9_MAJOR) +#endif /* !IDE_DISK_MAJOR */ + +#ifndef SCSI_DISK_MAJOR +#ifndef SCSI_DISK8_MAJOR +#define SCSI_DISK8_MAJOR 128 +#endif +#ifndef SCSI_DISK15_MAJOR +#define SCSI_DISK15_MAJOR 135 +#endif +#define SCSI_DISK_MAJOR(M) ((M) == SCSI_DISK0_MAJOR || \ + ((M) >= SCSI_DISK1_MAJOR && \ + (M) <= SCSI_DISK7_MAJOR) || \ + ((M) >= SCSI_DISK8_MAJOR && \ + (M) <= SCSI_DISK15_MAJOR)) +#endif /* !SCSI_DISK_MAJOR */ + +#define MAX_PARTITIONS 64 + +struct part_info { + unsigned int major; /* Device major number */ + unsigned int minor; /* Device minor number */ + char name[32]; +} partition[MAX_PARTITIONS]; + +struct blkio_info { + unsigned int rd_ios; /* Read I/O operations */ + unsigned int rd_merges; /* Reads merged */ + unsigned long long rd_sectors; /* Sectors read */ + unsigned int rd_ticks; /* Time in queue + service for read */ + unsigned int wr_ios; /* Write I/O operations */ + unsigned int wr_merges; /* Writes merged */ + unsigned long long wr_sectors; /* Sectors written */ + unsigned int wr_ticks; /* Time in queue + service for write */ + unsigned int ticks; /* Time of requests in queue */ + unsigned int aveq; /* Average queue length */ +} new_blkio[MAX_PARTITIONS], old_blkio[MAX_PARTITIONS]; + +struct cpu_info { + unsigned long long user; + unsigned long long system; + unsigned long long idle; + unsigned long long iowait; +} new_cpu, old_cpu; + +FILE *iofp; /* /proc/diskstats or /proc/partition */ +FILE *cpufp; /* /proc/stat */ +char *opts = "cdDpPxh"; /* Options */ +char buffer[256]; /* Temporary buffer for parsing */ + +int print_cpu = 0; +int print_disk_extended = 0; +int print_disk_util = 0; +int print_partition = 0; +int print_device = 1; + +unsigned int n_partitions; /* Number of partitions */ +unsigned int ncpu; /* Number of processors */ +unsigned int kernel; /* Kernel: 4 (2.4, /proc/partitions) + or 6 (2.6, /proc/diskstats) */ + +void print_usage() +{ + fputs("iostat v2.2, (C) 1999-2005 by " + "Greg Franks, Zlatko Calusic, Rick Lindsley, Arnaud Desitter\n" + "Distributed under the terms of the GPL (see LICENSE file)\n" + "Usage: iostat [-cdDpPxh] [disks...] [interval [count]]\n" + "options:\n\n" + "\tc - print cpu usage info\n" + "\td - print basic disk info\n" + "\tD - print disk utilization info\n" + "\tp - print partition info also\n" + "\tP - print partition info only\n" + "\tx - print extended disk info\n" + "\th - this help\n\n", stderr); + exit(EXIT_SUCCESS); +} + +void handle_error(const char *string, int error) +{ + if (error) { + fputs("iostat: ", stderr); + if (errno) + perror(string); + else + fprintf(stderr, "%s\n", string); + exit(EXIT_FAILURE); + } +} + +void get_number_of_cpus() +{ + FILE *ncpufp = fopen("/proc/cpuinfo", "r"); + + handle_error("Can't open /proc/cpuinfo", !ncpufp); + while (fgets(buffer, sizeof(buffer), ncpufp)) { + if (!strncmp(buffer, "processor\t:", 11)) + ncpu++; + } + fclose(ncpufp); + handle_error("Error parsing /proc/cpuinfo", !ncpu); +} + +int printable(unsigned int major, unsigned int minor) +{ + if (IDE_DISK_MAJOR(major)) { + return (!(minor & 0x3F) && print_device) + || ((minor & 0x3F) && print_partition); + } else if (SCSI_DISK_MAJOR(major)) { + return (!(minor & 0x0F) && print_device) + || ((minor & 0x0F) && print_partition); + } else { + return 1; /* if uncertain, print it */ + } +} + +/* Get partition names. Check against match list */ +void initialize(char **match_list, int n_dev) +{ + const char *scan_fmt = NULL; + + switch (kernel) { + case 4: + scan_fmt = "%4d %4d %*d %31s %u"; + break; + case 6: + scan_fmt = "%4d %4d %31s %u"; + break; + } + handle_error("logic error in initialize()", !scan_fmt); + + while (fgets(buffer, sizeof(buffer), iofp)) { + unsigned int reads = 0; + struct part_info curr; + + if (sscanf(buffer, scan_fmt, &curr.major, &curr.minor, + curr.name, &reads) == 4) { + unsigned int p; + + for (p = 0; p < n_partitions + && (partition[p].major != curr.major + || partition[p].minor != curr.minor); + p++); + + if (p == n_partitions && p < MAX_PARTITIONS) { + if (n_dev) { + unsigned int j; + + for (j = 0; j < n_dev && match_list[j]; + j++) { + if (!strcmp(curr.name, + match_list[j])) { + partition[p] = curr; + n_partitions = p + 1; + } + } + } else if (reads && printable(curr.major, + curr.minor)) { + partition[p] = curr; + n_partitions = p + 1; + } + } + } + } +} + +void get_kernel_stats() +{ + const char *scan_fmt = NULL; + + switch (kernel) { + case 4: + scan_fmt = "%4d %4d %*d %*s %u %u %llu %u %u %u %llu %u %*u %u %u"; + break; + case 6: + scan_fmt = "%4d %4d %*s %u %u %llu %u %u %u %llu %u %*u %u %u"; + break; + } + handle_error("logic error in get_kernel_stats()", !scan_fmt); + + rewind(iofp); + while (fgets(buffer, sizeof(buffer), iofp)) { + int items; + struct part_info curr; + struct blkio_info blkio; + + items = sscanf(buffer, scan_fmt, + &curr.major, &curr.minor, + &blkio.rd_ios, &blkio.rd_merges, + &blkio.rd_sectors, &blkio.rd_ticks, + &blkio.wr_ios, &blkio.wr_merges, + &blkio.wr_sectors, &blkio.wr_ticks, + &blkio.ticks, &blkio.aveq); + + /* + * Unfortunately, we can report only transfer rates + * for partitions in 2.6 kernels, all other I/O + * statistics are unavailable. + */ + if (items == 6) { + blkio.rd_sectors = blkio.rd_merges; + blkio.wr_sectors = blkio.rd_ticks; + blkio.rd_ios = 0; + blkio.rd_merges = 0; + blkio.rd_ticks = 0; + blkio.wr_ios = 0; + blkio.wr_merges = 0; + blkio.wr_ticks = 0; + blkio.ticks = 0; + blkio.aveq = 0; + items = 12; + } + + if (items == 12) { + unsigned int p; + + /* Locate partition in data table */ + for (p = 0; p < n_partitions; p++) { + if (partition[p].major == curr.major + && partition[p].minor == curr.minor) { + new_blkio[p] = blkio; + break; + } + } + } + } + + rewind(cpufp); + while (fgets(buffer, sizeof(buffer), cpufp)) { + if (!strncmp(buffer, "cpu ", 4)) { + int items; + unsigned long long nice, irq, softirq; + + items = sscanf(buffer, + "cpu %llu %llu %llu %llu %llu %llu %llu", + &new_cpu.user, &nice, + &new_cpu.system, + &new_cpu.idle, + &new_cpu.iowait, + &irq, &softirq); + + new_cpu.user += nice; + if (items == 4) + new_cpu.iowait = 0; + if (items == 7) + new_cpu.system += irq + softirq; + + } + } +} + +void print_cpu_stats() +{ + double total; + struct cpu_info cpu; + + cpu.user = new_cpu.user - old_cpu.user; + cpu.system = new_cpu.system - old_cpu.system; + cpu.idle = new_cpu.idle - old_cpu.idle; + cpu.iowait = new_cpu.iowait - old_cpu.iowait; + total = (cpu.user + cpu.system + cpu.idle + cpu.iowait) / 100.0; + printf("%3.0f %3.0f ", cpu.user / total, cpu.system / total); + if (kernel == 6) + printf("%3.0f ", cpu.iowait / total); + printf("%3.0f", cpu.idle / total); +} + +/* + * Print out statistics. + * extended form is: + * read merges + * write merges + * read io requests + * write io requests + * kilobytes read + * kilobytes written + * average queue length + * average waiting time (queue + service) + * average service time at disk + * average disk utilization. + */ + +#define PER_SEC(x) (1000.0 * (x) / deltams) + +void print_partition_stats() +{ + unsigned int p; + double deltams = 1000.0 * + ((new_cpu.user + new_cpu.system + + new_cpu.idle + new_cpu.iowait) - + (old_cpu.user + old_cpu.system + + old_cpu.idle + old_cpu.iowait)) / ncpu / HZ; + + for (p = 0; p < n_partitions; p++) { + struct blkio_info blkio; + double n_ios; /* Number of requests */ + double n_ticks; /* Total service time */ + double n_kbytes; /* Total kbytes transferred */ + double busy; /* Utilization at disk (percent) */ + double svc_t; /* Average disk service time */ + double wait; /* Average wait */ + double size; /* Average request size */ + double queue; /* Average queue */ + + blkio.rd_ios = new_blkio[p].rd_ios + - old_blkio[p].rd_ios; + blkio.rd_merges = new_blkio[p].rd_merges + - old_blkio[p].rd_merges; + blkio.rd_sectors = new_blkio[p].rd_sectors + - old_blkio[p].rd_sectors; + blkio.rd_ticks = new_blkio[p].rd_ticks + - old_blkio[p].rd_ticks; + blkio.wr_ios = new_blkio[p].wr_ios + - old_blkio[p].wr_ios; + blkio.wr_merges = new_blkio[p].wr_merges + - old_blkio[p].wr_merges; + blkio.wr_sectors = new_blkio[p].wr_sectors + - old_blkio[p].wr_sectors; + blkio.wr_ticks = new_blkio[p].wr_ticks + - old_blkio[p].wr_ticks; + blkio.ticks = new_blkio[p].ticks + - old_blkio[p].ticks; + blkio.aveq = new_blkio[p].aveq + - old_blkio[p].aveq; + + n_ios = blkio.rd_ios + blkio.wr_ios; + n_ticks = blkio.rd_ticks + blkio.wr_ticks; + n_kbytes = (blkio.rd_sectors + blkio.wr_sectors) / 2.0; + + queue = blkio.aveq / deltams; + size = n_ios ? n_kbytes / n_ios : 0.0; + wait = n_ios ? n_ticks / n_ios : 0.0; + svc_t = n_ios ? blkio.ticks / n_ios : 0.0; + busy = 100.0 * blkio.ticks / deltams; /* percentage! */ + if (busy > 100.0) + busy = 100.0; + + if (print_disk_extended) { + printf("%-6s %5.0f %5.0f %6.1f %6.1f %7.1f " + "%7.1f %6.1f %5.1f %6.1f %5.1f %3.0f ", + partition[p].name, + PER_SEC(blkio.rd_merges), + PER_SEC(blkio.wr_merges), + PER_SEC(blkio.rd_ios), + PER_SEC(blkio.wr_ios), + PER_SEC(blkio.rd_sectors) / 2.0, + PER_SEC(blkio.wr_sectors) / 2.0, + size, queue, wait, svc_t, busy); + if (!p && print_cpu) { + print_cpu_stats(); + } + putchar('\n'); + } else if (print_disk_util) { + printf("%4.0f %4.0f %4.0f ", + PER_SEC(blkio.rd_ios), + PER_SEC(blkio.wr_ios), + busy); + } else { + printf("%5.0f %3.0f %5.1f ", + PER_SEC(n_kbytes), + PER_SEC(n_ios), + svc_t); + } + } +} + +void print_header_lines() +{ + unsigned int p; + + /* Line 1 */ + if (print_disk_extended) { + printf("%78s", + "extended device statistics "); + } else { + for (p = 0; p < n_partitions; p++) { + printf("%9s ", partition[p].name); + } + } + + if (print_cpu) + printf(" cpu"); + putchar('\n'); + + /* Line 2 */ + if (print_disk_extended) { + printf("device mgr/s mgw/s r/s w/s kr/s " + "kw/s size queue wait svc_t %%b "); + } else { + for (p = 0; p < n_partitions; p++) { + if (print_disk_util) + printf(" r/s w/s %%b "); + else + printf(" kps tps svc_t "); + } + } + if (print_cpu) { + switch (kernel) { + case 4: + printf(" us sy id"); + break; + case 6: + printf(" us sy wt id"); + break; + } + } + putchar('\n'); +} + +void process(int lineno) +{ + unsigned int p; + + get_kernel_stats(); + + if (!lineno || print_disk_extended) + print_header_lines(); + + print_partition_stats(); + + if (!print_disk_extended) { + if (print_cpu) + print_cpu_stats(); + putchar('\n'); + } + + /* Save old stats */ + for (p = 0; p < n_partitions; p++) + old_blkio[p] = new_blkio[p]; + old_cpu = new_cpu; +} + +int main(int argc, char **argv) +{ + int c, n_dev, lineno; + int interval = 1; + int count = -1; + + setlinebuf(stdout); + get_number_of_cpus(); + + iofp = fopen("/proc/diskstats", "r"); + if (iofp) { + kernel = 6; + } else { + iofp = fopen("/proc/partitions", "r"); + if (iofp) + kernel = 4; + } + handle_error("Can't get I/O statistics on this system", !iofp); + + cpufp = fopen("/proc/stat", "r"); + handle_error("Can't open /proc/stat", !cpufp); + + while ((c = getopt(argc, argv, opts)) != EOF) { + switch (c) { + case 'c': + print_cpu = 1; + break; + case 'd': + print_disk_util = 0; + break; + case 'D': + print_disk_util = 1; + break; + case 'P': + print_device = 0; + /* falldown */ + case 'p': + print_partition = 1; + break; + case 'x': + print_disk_extended = 1; + break; + case 'h': + default: + print_usage(); + } + } + + /* No options. Set defaults. */ + if (optind == 1) + print_cpu = 1; + + /* List of disks/devices [delay [count]]. */ + for (n_dev = 0; optind + n_dev < argc + && !isdigit(argv[optind + n_dev][0]); n_dev++); + + initialize(&argv[optind], n_dev); + optind += n_dev; + + /* Figure out [delay [count]]. Default is one display only */ + switch (argc - optind) { + case 2: + count = atoi(argv[optind + 1]); + /* drop down */ + case 1: + interval = atoi(argv[optind]); + break; + case 0: + count = 0; + break; + default: + print_usage(); + } + + /* Main loop */ + for (lineno = 0;; lineno = (++lineno) % 21) { + process(lineno); + if (count > 0) + count--; + if (!count) + break; + sleep(interval); + } + exit(EXIT_SUCCESS); +} diff --git a/root_image/tools/load_xen_modules/Makefile b/root_image/tools/load_xen_modules/Makefile new file mode 100644 index 0000000..fab6279 --- /dev/null +++ b/root_image/tools/load_xen_modules/Makefile @@ -0,0 +1,25 @@ +TARGETS-y := xen-detect +TARGETS := $(TARGETS-y) + +INSTALL_BIN-y := xen-detect +INSTALL_BIN := $(INSTALL_BIN-y) + + +.PHONY: all +all: build + +.PHONY: build +build: $(TARGETS) + +.PHONY: install +install: build + $(INSTALL_DIR) $(DESTDIR)$(BINDIR) + $(INSTALL_DIR) $(DESTDIR)$(SBINDIR) + +.PHONY: clean +clean: + $(RM) *.o $(TARGETS) *~ $(DEPS) + +%.o: %.c $(HDRS) Makefile + $(CC) -c $(CFLAGS) -o $@ $< + diff --git a/root_image/tools/load_xen_modules/load_xen_modules b/root_image/tools/load_xen_modules/load_xen_modules new file mode 100755 index 0000000..67b07f1 --- /dev/null +++ b/root_image/tools/load_xen_modules/load_xen_modules @@ -0,0 +1,11 @@ +#!/bin/bash + +/usr/bin/xen-detect -P +if [ $? == 0 ]; then + modprobe xenbus_probe_frontend + modprobe xen-kbdfront + modprobe xen-fbfront + modprobe xen-netfront + modprobe xen-blkfront + modprobe xen-pcifront +fi diff --git a/root_image/tools/load_xen_modules/xen-detect.c b/root_image/tools/load_xen_modules/xen-detect.c new file mode 100644 index 0000000..1a1607f --- /dev/null +++ b/root_image/tools/load_xen_modules/xen-detect.c @@ -0,0 +1,159 @@ +/****************************************************************************** + * xen_detect.c + * + * Simple GNU C / POSIX application to detect execution on Xen VMM platform. + * + * Copyright (c) 2007, XenSource Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +static void cpuid(uint32_t idx, + uint32_t *eax, + uint32_t *ebx, + uint32_t *ecx, + uint32_t *edx, + int pv_context) +{ + asm volatile ( + "test %1,%1 ; jz 1f ; ud2a ; .ascii \"xen\" ; 1: cpuid" + : "=a" (*eax), "=b" (*ebx), "=c" (*ecx), "=d" (*edx) + : "0" (idx), "1" (pv_context) ); +} + +static int check_for_xen(int pv_context) +{ + uint32_t eax, ebx, ecx, edx; + char signature[13]; + uint32_t base; + + for ( base = 0x40000000; base < 0x40010000; base += 0x100 ) + { + cpuid(base, &eax, &ebx, &ecx, &edx, pv_context); + + *(uint32_t *)(signature + 0) = ebx; + *(uint32_t *)(signature + 4) = ecx; + *(uint32_t *)(signature + 8) = edx; + signature[12] = '\0'; + + if ( !strcmp("XenVMMXenVMM", signature) && (eax >= (base + 2)) ) + goto found; + } + + return 0; + + found: + cpuid(base + 1, &eax, &ebx, &ecx, &edx, pv_context); + return 1; +} + +static jmp_buf sigill_jmp; +void sigill_handler(int sig) +{ + longjmp(sigill_jmp, 1); +} + +static void usage(void) +{ + printf("Usage: xen_detect [options]\n"); + printf("Options:\n"); + printf(" -h, --help Display this information\n"); + printf(" -q, --quiet Quiesce normal informational output\n"); + printf(" -P, --pv Exit status 1 if not running as PV guest\n"); + printf(" -H, --hvm Exit status 1 if not running as HVM guest.\n"); + printf(" -N, --none Exit status 1 if running on Xen (PV or HVM)\n"); +} + +int main(int argc, char **argv) +{ + enum { XEN_PV = 1, XEN_HVM = 2, XEN_NONE = 3 } detected = 0, expected = 0; + uint32_t version = 0; + int ch, quiet = 0; + + const static char sopts[] = "hqPHN"; + const static struct option lopts[] = { + { "help", 0, NULL, 'h' }, + { "quiet", 0, NULL, 'q' }, + { "pv", 0, NULL, 'P' }, + { "hvm", 0, NULL, 'H' }, + { "none", 0, NULL, 'N' }, + { 0, 0, 0, 0} + }; + + while ( (ch = getopt_long(argc, argv, sopts, lopts, NULL)) != -1 ) + { + switch ( ch ) + { + case 'q': + quiet = 1; + break; + case 'P': + expected = XEN_PV; + break; + case 'H': + expected = XEN_HVM; + break; + case 'N': + expected = XEN_NONE; + break; + default: + usage(); + exit(1); + } + } + + /* Check for execution in HVM context. */ + detected = XEN_HVM; + if ( (version = check_for_xen(0)) != 0 ) + goto out; + + /* + * Set up a signal handler to test the paravirtualised CPUID instruction. + * If executed outside Xen PV context, the extended opcode will fault, we + * will longjmp via the signal handler, and print "Not running on Xen". + */ + detected = XEN_PV; + if ( !setjmp(sigill_jmp) + && (signal(SIGILL, sigill_handler) != SIG_ERR) + && ((version = check_for_xen(1)) != 0) ) + goto out; + + detected = XEN_NONE; + + out: + if ( quiet ) + /* nothing */; + else if ( detected == XEN_NONE ) + printf("Not running on Xen.\n"); + else + printf("Running in %s context on Xen v%d.%d.\n", + (detected == XEN_PV) ? "PV" : "HVM", + (uint16_t)(version >> 16), (uint16_t)version); + + return expected && (expected != detected); +} diff --git a/root_image/tools/ssh_support/Makefile b/root_image/tools/ssh_support/Makefile new file mode 100644 index 0000000..53547e9 --- /dev/null +++ b/root_image/tools/ssh_support/Makefile @@ -0,0 +1,17 @@ + +TOP = ../.. + +# Supported ARCH == 'x86_32' , 'x86_64' ; ARCHbit == '32' , '64' +ARCH = $(shell uname -m | sed -e s/i.86/x86_32/) +ARCHbit = $(shell uname -m | sed -e s/i.86/x86_32/ | sed -e s/x86_//) + + +.DEFAULT_GOAL: all +.PHONY: all +all: ssh-shadowgen + +ssh-shadowgen: + $(CC) -o $@ shadowgen.c -L$(TOP)/userspace/usr/$(LIBSDIR) -lcrypt + +clean: + rm -f ssh-shadowgen diff --git a/root_image/tools/ssh_support/shadowgen.c b/root_image/tools/ssh_support/shadowgen.c new file mode 100644 index 0000000..0729b27 --- /dev/null +++ b/root_image/tools/ssh_support/shadowgen.c @@ -0,0 +1,262 @@ +// +// +// Copyright (c) 2003-2008, Virtual Iron Software, Inc. +// All Rights Reserved +// +// + + +#include +#include +#include +#include + +#include +#include +#include + +#define GEN_SIMPLErr_PASSWD 1 + +#define kPASSWD_LEN_MIN 6 +#define kPASSWD_LEN_MAX 9 + +static void setup_legal_values (void); +static char* get_input_passwd (int argc, char* argv[]); +static void generate_8_char_salt_values (char* bufToFill); + +int main( int argc, char* argv[] ) +{ + char salt[3+8+1+1]; // = 13 + char* passwd_input; + char* passwd_output; + + memcpy( salt, "$1$--------$", 12 ); + salt[12] = '\0' ; + + setup_legal_values(); + + generate_8_char_salt_values( salt + 3 ); // for_crypt_md5 glibc2 extension as per crypt man page + +#if 1 + passwd_input = get_input_passwd( argc, argv ); +#else + passwd_input = "dalek0" ; +#endif + + passwd_output = crypt( passwd_input, salt ); + +#if 0 +unsigned int dbg_i; +printf( "%s = %d =", passwd_input, (int)strlen(passwd_input) ); +for ( dbg_i=0 ; dbg_ibeg_in ;; ++curVal ) + { + legal_passwd_values[num_of_passwd_values] = curVal ; + ++num_of_passwd_values; + if ( curVal == range->end_in ) + break; + } + } + } + + if ( num_of_legal_salt_values == 0 ) + { + for ( i=0 ; ibeg_in ;; ++curVal ) + { + legal_salt_values[num_of_legal_salt_values] = curVal ; + ++num_of_legal_salt_values; + if ( curVal == range->end_in ) + break; + } + } + } +} +/**************************************************************************/ +static int is_good_pw(char* suggested_passwd, unsigned int suggested_passwd_len) +{ + unsigned int i; + unsigned int cntr; + + if ( ! isalpha( suggested_passwd[0] ) ) + return 0 ; + + if ( ! isalpha( suggested_passwd[suggested_passwd_len-1] ) ) + return 0 ; + + cntr = 0 ; + for ( i=0 ; i> 16) & 0xFFFF ; + seed[1] = tv.tv_sec & 0xFFFF ; + seed[2] = tv.tv_usec & 0xFFFF ; + + seed48( seed ); + + if (max_pw_len > kMAX_passwd_LEN) + max_pw_len = kMAX_passwd_LEN ; + + if (min_pw_len > max_pw_len) + min_pw_len = max_pw_len ; + + if ( min_pw_len == max_pw_len ) + pw_len = min_pw_len ; + else + { + randomValue = erand48( seed ); + + pw_len = min_pw_len + ( ( max_pw_len - min_pw_len + 1 ) * randomValue ) ; + } + + for (;;) + { + for ( i=0 ; i> 16) & 0xFFFF ; + seed[1] = tv.tv_sec & 0xFFFF ; + seed[2] = tv.tv_usec & 0xFFFF ; + + seed48( seed ); + + for ( i=0 ; i<8 ; ++i ) + { + randomValue = erand48( seed ); + + saltIdx = (unsigned int)( randomValue * num_of_legal_salt_values ) ; + + *bufToFill = legal_salt_values[saltIdx] ; + ++bufToFill; + } +} +/**************************************************************************/ diff --git a/root_image/tools/ssh_support/sshd_server b/root_image/tools/ssh_support/sshd_server new file mode 100755 index 0000000..15c002a --- /dev/null +++ b/root_image/tools/ssh_support/sshd_server @@ -0,0 +1,268 @@ +#!/bin/bash +################################################################### +# +# sshd_server +# +# This script manages starting and stopping ssh access to dom0 +# +# Author: Joshua Nicholas +# + +global_scriptName="${0##*\/}" +global_argv=$@ +global_argc=$# + +#echo $global_scriptName [ $global_argc : $global_argv ] +#exit 0 + +########################################################################## +do_stop_ssh() +# +{ + # Shoot down sshd AND any running clients + + sshd_pid=$(cat /var/run/sshd.pid 2>/dev/null) + if [ -n "$sshd_pid" ]; then + kill -9 $sshd_pid + sleep 1 + fi + + sshd_pid=$(pidof sshd) + if [ -n "$sshd_pid" ]; then + kill -9 $sshd_pid + sleep 1 + fi + sshd_pid=$(pidof sshd) + if [ -n "$sshd_pid" ]; then + kill -9 $sshd_pid + sleep 1 + fi + + rm -f /etc/shadow + + if [ -z "$DEVELOPER_MANAGES_SSH_KEYS" ]; then + rm -f /etc/ssh/ssh_host_key* + rm -f /etc/ssh/ssh_host_dsa_key* + rm -f /etc/ssh/ssh_host_rsa_key* + fi + + if [ -e /var/lib/empty/sshd ]; then + chmod +r /var/lib/empty/sshd + rm -rf /var/lib/empty/sshd + fi + + rm -f /var/run/sshd.pid + + return 0 +} +########################################################################## +stop_ssh() +# +{ + do_stop_ssh + + echo '' + echo '' + echo '' + echo ' SSH stopped' + echo '' + echo '' + echo '' + + return 0 +} +########################################################################## +start_ssh() +# +{ + local sshd_port=$1 + + local sshd_pid=$(cat /var/run/sshd.pid 2>/dev/null) + if [ -n "$sshd_pid" ]; then + echo "WARNING: ssh currently running [$sshd_pid] ignoring start request" + return 0 + fi + + rm -f /var/run/sshd.pid + + mkdir -p /var/lib/empty/sshd + chmod -rw /var/lib/empty/sshd + + cat /etc/passwd 2> /dev/null | grep -q '^sshd:' + if [ "$?" != '0' ]; then + echo 'sshd:x:74:74:Privilege-separated SSH:/var/lib/empty/sshd:/sbin/nologin' >> /etc/passwd + fi + + if [ -z "$DEVELOPER_MANAGES_SSH_KEYS" ] || [ ! -f /etc/ssh/ssh_host_key ]; then + + rm -f /etc/ssh/ssh_host_key* + rm -f /etc/ssh/ssh_host_dsa_key* + rm -f /etc/ssh/ssh_host_rsa_key* + + echo "Generating keys ..." + + /usr/bin/ssh-keygen -t rsa1 -b 1024 -f /etc/ssh/ssh_host_key -N '' 2>/dev/null | tail -1 + /usr/bin/ssh-keygen -t dsa -b 1024 -f /etc/ssh/ssh_host_dsa_key -N '' 2>/dev/null | tail -1 + /usr/bin/ssh-keygen -t rsa -b 1024 -f /etc/ssh/ssh_host_rsa_key -N '' 2>/dev/null | tail -1 + + rm -f /etc/ssh/ssh_host_key.pub + rm -f /etc/ssh/ssh_host_dsa_key.pub + rm -f /etc/ssh/ssh_host_rsa_key.pub + fi + + chmod 400 /etc/ssh/ssh_host_* + + rm -f /etc/shadow + touch /etc/shadow + + local passwd_recomendation='' + local MS_ss_passwd + + if [ -f /mnt/mgmt/VirtualizationManager/get_password.py ]; then + MS_ss_passwd=$(cd /mnt/mgmt/VirtualizationManager; + ./get_password.py) + fi + + if [ -n "$MS_ss_passwd" ]; then + passwd_recomendation=$MS_ss_passwd + fi + + if [ -n "$DEVELOPER_FIXED_SSH_PASSWD" ]; then + passwd_recomendation=$DEVELOPER_FIXED_SSH_PASSWD + fi + + local shadow_pair=$(/usr/sbin/ssh-shadowgen $passwd_recomendation) + + local new_root_passwd=$(echo "$shadow_pair" | head -1) + local shadow_line=$(echo "$shadow_pair" | tail -1) + + shadow_pair='' + + echo "$shadow_line" >> /etc/shadow + + echo '' + echo "Starting SSHd ..." + + if (( $sshd_port > 0 )); then + /usr/sbin/sshd -p $sshd_port + else + /usr/sbin/sshd + fi + + local itrCntr=0 + local alert_user_when_zero=3 + local timeout_in_secs=10 + local alt_sshd_pid + + while [ $itrCntr -lt $timeout_in_secs ] + do + sleep 1 + + alt_sshd_pid=$(pidof sshd) + sshd_pid=$(cat /var/run/sshd.pid 2>/dev/null) + + if [ -n "$alt_sshd_pid" ] && [ "$alt_sshd_pid" = "$sshd_pid" ]; then + itrCntr=0 + break; + fi + + let itrCntr="$itrCntr+1" + let alert_user_when_zero="$itrCntr%3" + if [ "$alert_user_when_zero" = "0" ]; then + echo "Waiting for sshd to startup" + fi + done + + echo '' + if [ $itrCntr -eq 0 ]; then + if (( $sshd_port > 0 )); then + echo " SSH started [$sshd_pid] port $sshd_port" + else + echo " SSH started [$sshd_pid]" + fi + echo '' + echo " passwd = $new_root_passwd" + else + do_stop_ssh + + echo " SSH start failed !?!" + fi + echo '' + + return 0 +} +########################################################################## +main() +# +{ + local do_ssh_start=0 + local do_ssh_stop=0 + local sshd_port=-1 # Default is port 22 + + until [ -z "$1" ] # Until all parameters used up... + do + if [ "$1" = '-start' ]; then + do_ssh_start=1 + shift + continue + fi + + if [ "$1" = '-stop' ]; then + do_ssh_stop=1 + shift + continue + fi + + if [ "$1" = '-port' ]; then + shift + sshd_port=$1 + echo "$sshd_port" | grep -q '^[[:digit:]][[:digit:]]*$' + if [ "$?" != 0 ]; then + echo "$global_scriptName :: Bad sshd_port '$sshd_port'" + exit 2 + fi + shift + continue + fi + + echo + echo "$global_scriptName :: Bad arg '$1'" + echo + exit 1 + done + + if [ $do_ssh_stop -eq 1 ]; then + + stop_ssh + if [ "$?" != '0' ]; then + echo "ERROR: stop_ssh failed !?!" + exit 111 + fi + + else + if [ $do_ssh_start -eq 1 ]; then + + start_ssh $sshd_port + if [ "$?" != '0' ]; then + echo "ERROR: start_ssh failed !?!" + exit 111 + fi + + fi + fi + + return 0 +} +########################################################################## + +#echo $global_scriptName : BEG + +main $@ + +#echo $global_scriptName : END + +exit 0 ; + +# +# END +########## diff --git a/scm.mk b/scm.mk new file mode 100644 index 0000000..be3e137 --- /dev/null +++ b/scm.mk @@ -0,0 +1,27 @@ + +.PHONY: fetch +fetch: $(REPOS:%=%-fetch) + +# First argument is the git repo, second is the name we want. +# The REPOS unrolls the names, so we to use $(2) +define GIT_REPO +.PHONY: $(2)-fetch +$(2)-fetch: + @if [ -d $(2) ]; then \ + echo "$(2) exists.. skipping"; \ + else \ + echo "Fetching $(GIT_URL)$(1)"; \ + git clone $(GIT_URL)$(1) $(2); \ + fi +endef + +define HG_REPO +.PHONY: $(2)-fetch +$(2)-fetch: + @if [ -d $(2) ]; then \ + echo "$(2) exists.. skipping"; \ + else \ + echo "Fetching $(HG_URL)$(1)"; \ + hg clone $(HG_URL)$(1) $(2); \ + fi +endef diff --git a/sources.mk b/sources.mk new file mode 100644 index 0000000..1f87057 --- /dev/null +++ b/sources.mk @@ -0,0 +1,26 @@ + + +REPOS = syslinux root_image/busybox root_image/netperf root_image/pciutils root_image/RPMs xen linux + +include scm.mk +GIT_URL=git://xenbits.xensource.com/xentesttools/ +# Unroll those defines in real $-fetch labels.. +$(eval $(call GIT_REPO,syslinux.git,syslinux)) +$(eval $(call GIT_REPO,busybox.git,root_image/busybox)) +$(eval $(call GIT_REPO,netperf.git,root_image/netperf)) +$(eval $(call GIT_REPO,pciutils.git,root_image/pciutils)) + +ifdef FC13 +GLIBC_VERSION = 2.12 +ifeq ($(shell uname -m), i686) +$(eval $(call GIT_REPO,rpms-fc13-x86.git,root_image/RPMs)) +else +$(eval $(call GIT_REPO,rpms-fc13-x86_64.git,root_image/RPMs)) +endif +endif + +GIT_URL=git://git.kernel.org/pub/scm/linux/kernel/git/jeremy/ +$(eval $(call GIT_REPO,xen.git,linux)) + +HG_URL=http://xenbits.xensource.com/ +$(eval $(call HG_REPO,xen-unstable.hg,xen)) -- 2.39.5