aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arch/ppc/kernel-config2
-rw-r--r--defaults/busy-config747
-rwxr-xr-xdefaults/initrd.defaults83
-rwxr-xr-xdefaults/initrd.scripts1095
-rw-r--r--defaults/keymaps.tar.gzbin14071 -> 0 bytes
-rwxr-xr-xdefaults/linuxrc750
-rwxr-xr-xdefaults/modprobe144
-rwxr-xr-xdefaults/udhcpc.scripts37
-rwxr-xr-xgen_arch.sh16
-rwxr-xr-xgen_bootloader.sh11
-rwxr-xr-xgen_cmdline.sh396
-rwxr-xr-xgen_compile.sh416
-rwxr-xr-xgen_configkernel.sh2
-rwxr-xr-xgen_determineargs.sh38
-rwxr-xr-xgen_dracut.sh2
-rwxr-xr-xgen_funcs.sh17
-rwxr-xr-xgen_initramfs.sh675
-rwxr-xr-xgenkernel138
-rw-r--r--genkernel.conf72
-rw-r--r--netboot/busy-config759
-rwxr-xr-xnetboot/linuxrc.x347
-rwxr-xr-xnetboot/misc/bin/ashlogin4
-rwxr-xr-xnetboot/misc/bin/net-setup93
-rw-r--r--netboot/misc/etc/fstab10
-rw-r--r--netboot/misc/etc/group2
-rw-r--r--netboot/misc/etc/inittab15
-rw-r--r--netboot/misc/etc/passwd2
-rw-r--r--netboot/misc/etc/profile1
-rw-r--r--netboot/misc/etc/resolv.conf3
-rw-r--r--netboot/misc/etc/shadow2
-rw-r--r--netboot/misc/etc/shells2
-rw-r--r--netboot/misc/usr/share/terminfo/p/puttybin1605 -> 0 bytes
-rw-r--r--patches/busybox/1.7.4/1.7.4-ash-timeout.diff123
-rw-r--r--patches/busybox/1.7.4/1.7.4-mdadm.diff5882
-rw-r--r--patches/busybox/1.7.4/1.7.4-mdstart.diff122
-rw-r--r--patches/busybox/1.7.4/1.7.4-mount-umount-i-option.diff24
-rw-r--r--patches/busybox/1.7.4/1.7.4-openvt.diff20
-rw-r--r--patches/busybox/1.7.4/1.7.4-static-error.diff23
-rw-r--r--patches/busybox/1.7.4/README23
-rw-r--r--patches/busybox/1.7.4/busybox-1.7.4-signal-hack.patch28
40 files changed, 191 insertions, 11935 deletions
diff --git a/arch/ppc/kernel-config b/arch/ppc/kernel-config
index c62386d..898e37d 100644
--- a/arch/ppc/kernel-config
+++ b/arch/ppc/kernel-config
@@ -217,7 +217,7 @@ CONFIG_BOUNCE=y
CONFIG_VIRT_TO_BUS=y
CONFIG_PROC_DEVICETREE=y
CONFIG_CMDLINE_BOOL=y
-CONFIG_CMDLINE="console=ttyS0,115200,8n1 console=tty0 init=/linuxrc looptype=squashfs loop=/image.squashfs cdroot root=/dev/ram"
+CONFIG_CMDLINE="console=ttyS0,115200,8n1 console=tty0 init=/init looptype=squashfs loop=/image.squashfs cdroot root=/dev/ram"
CONFIG_PM=y
CONFIG_PM_LEGACY=y
# CONFIG_PM_DEBUG is not set
diff --git a/defaults/busy-config b/defaults/busy-config
deleted file mode 100644
index 51fdc8e..0000000
--- a/defaults/busy-config
+++ /dev/null
@@ -1,747 +0,0 @@
-#
-# Automatically generated make config: don't edit
-# Busybox version: 1.7.4
-# Tue Mar 11 13:29:47 2008
-#
-CONFIG_HAVE_DOT_CONFIG=y
-
-#
-# Busybox Settings
-#
-
-#
-# General Configuration
-#
-# CONFIG_NITPICK is not set
-# CONFIG_DESKTOP is not set
-# CONFIG_FEATURE_BUFFERS_USE_MALLOC is not set
-# 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 is not set
-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 is not set
-# CONFIG_FEATURE_SUID is not set
-# CONFIG_FEATURE_SUID_CONFIG is not set
-# CONFIG_FEATURE_SUID_CONFIG_QUIET is not set
-# CONFIG_SELINUX is not set
-CONFIG_FEATURE_PREFER_APPLETS=y
-CONFIG_BUSYBOX_EXEC_PATH="/proc/self/exe"
-CONFIG_FEATURE_SYSLOG=y
-CONFIG_FEATURE_HAVE_RPC=y
-
-#
-# Build Options
-#
-CONFIG_STATIC=y
-# CONFIG_BUILD_LIBBUSYBOX is not set
-# CONFIG_FEATURE_FULL_LIBBUSYBOX is not set
-# CONFIG_FEATURE_SHARED_BUSYBOX is not set
-CONFIG_LFS=y
-# CONFIG_BUILD_AT_ONCE is not set
-
-#
-# Debugging Options
-#
-# CONFIG_DEBUG 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 is not set
-
-#
-# Installation Options
-#
-# CONFIG_INSTALL_NO_USR is not set
-CONFIG_INSTALL_APPLET_SYMLINKS=y
-# CONFIG_INSTALL_APPLET_HARDLINKS is not set
-# CONFIG_INSTALL_APPLET_DONT is not set
-CONFIG_PREFIX="./_install"
-
-#
-# Busybox Library Tuning
-#
-CONFIG_PASSWORD_MINLEN=6
-CONFIG_MD5_SIZE_VS_SPEED=2
-# CONFIG_FEATURE_FAST_TOP is not set
-# CONFIG_FEATURE_ETC_NETWORKS is not set
-CONFIG_FEATURE_EDITING=y
-CONFIG_FEATURE_EDITING_MAX_LEN=1024
-# CONFIG_FEATURE_EDITING_FANCY_KEYS is not set
-# CONFIG_FEATURE_EDITING_VI is not set
-CONFIG_FEATURE_EDITING_HISTORY=15
-# CONFIG_FEATURE_EDITING_SAVEHISTORY is not set
-CONFIG_FEATURE_TAB_COMPLETION=y
-# CONFIG_FEATURE_USERNAME_COMPLETION is not set
-# CONFIG_FEATURE_EDITING_FANCY_PROMPT is not set
-CONFIG_MONOTONIC_SYSCALL=y
-CONFIG_IOCTL_HEX2STR_ERROR=y
-
-#
-# Applets
-#
-
-#
-# Archival Utilities
-#
-# CONFIG_AR is not set
-# CONFIG_FEATURE_AR_LONG_FILENAMES is not set
-# CONFIG_BUNZIP2 is not set
-# CONFIG_CPIO 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=y
-# CONFIG_FEATURE_GUNZIP_UNCOMPRESS is not set
-CONFIG_GZIP=y
-# CONFIG_RPM2CPIO is not set
-# CONFIG_RPM is not set
-# CONFIG_FEATURE_RPM_BZ2 is not set
-CONFIG_TAR=y
-CONFIG_FEATURE_TAR_CREATE=y
-CONFIG_FEATURE_TAR_BZIP2=y
-# CONFIG_FEATURE_TAR_LZMA is not set
-# CONFIG_FEATURE_TAR_FROM is not set
-CONFIG_FEATURE_TAR_GZIP=y
-# CONFIG_FEATURE_TAR_COMPRESS is not set
-# CONFIG_FEATURE_TAR_OLDGNU_COMPATIBILITY is not set
-# CONFIG_FEATURE_TAR_OLDSUN_COMPATIBILITY is not set
-CONFIG_FEATURE_TAR_GNU_EXTENSIONS=y
-# CONFIG_FEATURE_TAR_LONG_OPTIONS 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
-
-#
-# Common options for cpio and tar
-#
-# CONFIG_FEATURE_UNARCHIVE_TAPE is not set
-# CONFIG_FEATURE_DEB_TAR_GZ is not set
-# CONFIG_FEATURE_DEB_TAR_BZ2 is not set
-# CONFIG_FEATURE_DEB_TAR_LZMA is not set
-
-#
-# Coreutils
-#
-CONFIG_BASENAME=y
-# CONFIG_CAL is not set
-CONFIG_CAT=y
-# CONFIG_CATV is not set
-CONFIG_CHGRP=y
-CONFIG_CHMOD=y
-CONFIG_CHOWN=y
-CONFIG_CHROOT=y
-# CONFIG_CKSUM is not set
-# CONFIG_COMM is not set
-CONFIG_CP=y
-CONFIG_CUT=y
-CONFIG_DATE=y
-CONFIG_FEATURE_DATE_ISOFMT=y
-CONFIG_DD=y
-CONFIG_FEATURE_DD_SIGNAL_HANDLING=y
-# CONFIG_FEATURE_DD_IBS_OBS is not set
-CONFIG_DF=y
-CONFIG_DIRNAME=y
-# CONFIG_DOS2UNIX is not set
-# CONFIG_UNIX2DOS is not set
-CONFIG_DU=y
-CONFIG_FEATURE_DU_DEFAULT_BLOCKSIZE_1K=y
-CONFIG_ECHO=y
-CONFIG_FEATURE_FANCY_ECHO=y
-CONFIG_ENV=y
-# 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=y
-# CONFIG_FOLD is not set
-CONFIG_HEAD=y
-# CONFIG_FEATURE_FANCY_HEAD is not set
-# CONFIG_HOSTID is not set
-CONFIG_ID=y
-# CONFIG_INSTALL is not set
-# CONFIG_FEATURE_INSTALL_LONG_OPTIONS is not set
-# CONFIG_LENGTH is not set
-CONFIG_LN=y
-# CONFIG_LOGNAME is not set
-CONFIG_LS=y
-CONFIG_FEATURE_LS_FILETYPES=y
-CONFIG_FEATURE_LS_FOLLOWLINKS=y
-# CONFIG_FEATURE_LS_RECURSIVE is not set
-CONFIG_FEATURE_LS_SORTFILES=y
-CONFIG_FEATURE_LS_TIMESTAMPS=y
-CONFIG_FEATURE_LS_USERNAME=y
-CONFIG_FEATURE_LS_COLOR=y
-# CONFIG_FEATURE_LS_COLOR_IS_DEFAULT is not set
-# CONFIG_MD5SUM is not set
-CONFIG_MKDIR=y
-# CONFIG_FEATURE_MKDIR_LONG_OPTIONS is not set
-# CONFIG_MKFIFO is not set
-CONFIG_MKNOD=y
-CONFIG_MV=y
-# 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=y
-CONFIG_READLINK=y
-# CONFIG_FEATURE_READLINK_FOLLOW is not set
-# CONFIG_REALPATH is not set
-CONFIG_RM=y
-CONFIG_RMDIR=y
-# CONFIG_SEQ is not set
-# CONFIG_SHA1SUM is not set
-CONFIG_SLEEP=y
-# CONFIG_FEATURE_FANCY_SLEEP is not set
-CONFIG_SORT=y
-CONFIG_FEATURE_SORT_BIG=y
-# 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=y
-# CONFIG_SUM is not set
-CONFIG_SYNC=y
-CONFIG_TAIL=y
-# CONFIG_FEATURE_FANCY_TAIL is not set
-# CONFIG_TEE is not set
-# CONFIG_FEATURE_TEE_USE_BLOCK_IO is not set
-CONFIG_TEST=y
-# CONFIG_FEATURE_TEST_64 is not set
-CONFIG_TOUCH=y
-# CONFIG_TR is not set
-# CONFIG_FEATURE_TR_CLASSES is not set
-# CONFIG_FEATURE_TR_EQUIV is not set
-CONFIG_TRUE=y
-CONFIG_TTY=y
-CONFIG_UNAME=y
-# CONFIG_UNEXPAND is not set
-# CONFIG_FEATURE_UNEXPAND_LONG_OPTIONS is not set
-CONFIG_UNIQ=y
-# 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=y
-CONFIG_YES=y
-
-#
-# Common options for cp and mv
-#
-# CONFIG_FEATURE_PRESERVE_HARDLINKS is not set
-
-#
-# Common options for ls, more and telnet
-#
-CONFIG_FEATURE_AUTOWIDTH=y
-
-#
-# Common options for df, du, ls
-#
-CONFIG_FEATURE_HUMAN_READABLE=y
-# CONFIG_FEATURE_MD5_SHA1_SUM_CHECK is not set
-
-#
-# Console Utilities
-#
-CONFIG_CHVT=y
-CONFIG_CLEAR=y
-# CONFIG_DEALLOCVT is not set
-CONFIG_DUMPKMAP=y
-CONFIG_LOADFONT=y
-CONFIG_LOADKMAP=y
-# CONFIG_OPENVT is not set
-CONFIG_RESET=y
-# 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_SETKEYCODES is not set
-# CONFIG_SETLOGCONS is not set
-
-#
-# Debian Utilities
-#
-CONFIG_MKTEMP=y
-# 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=y
-
-#
-# Editors
-#
-# CONFIG_AWK is not set
-# CONFIG_FEATURE_AWK_MATH 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=y
-# CONFIG_VI is not set
-CONFIG_FEATURE_VI_MAX_LEN=
-# 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=y
-CONFIG_FEATURE_FIND_PRINT0=y
-# CONFIG_FEATURE_FIND_MTIME is not set
-CONFIG_FEATURE_FIND_MMIN=y
-# CONFIG_FEATURE_FIND_PERM is not set
-CONFIG_FEATURE_FIND_TYPE=y
-CONFIG_FEATURE_FIND_XDEV=y
-CONFIG_FEATURE_FIND_MAXDEPTH=y
-CONFIG_FEATURE_FIND_NEWER=y
-CONFIG_FEATURE_FIND_INUM=y
-CONFIG_FEATURE_FIND_EXEC=y
-CONFIG_FEATURE_FIND_USER=y
-CONFIG_FEATURE_FIND_GROUP=y
-CONFIG_FEATURE_FIND_NOT=y
-CONFIG_FEATURE_FIND_DEPTH=y
-CONFIG_FEATURE_FIND_PAREN=y
-CONFIG_FEATURE_FIND_SIZE=y
-# 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=y
-# CONFIG_FEATURE_GREP_EGREP_ALIAS is not set
-CONFIG_FEATURE_GREP_FGREP_ALIAS=y
-# CONFIG_FEATURE_GREP_CONTEXT is not set
-CONFIG_XARGS=y
-# 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_DEBUG_INIT is not set
-CONFIG_FEATURE_USE_INITTAB=y
-# CONFIG_FEATURE_INIT_SCTTY is not set
-# CONFIG_FEATURE_INIT_SYSLOG is not set
-# CONFIG_FEATURE_EXTRA_QUIET is not set
-# CONFIG_FEATURE_INIT_COREDUMPS is not set
-CONFIG_FEATURE_INITRD=y
-CONFIG_HALT=y
-CONFIG_MESG=y
-
-#
-# Login/Password Management Utilities
-#
-# CONFIG_FEATURE_SHADOWPASSWDS is not set
-# CONFIG_USE_BB_SHADOW is not set
-# CONFIG_USE_BB_PWD_GRP 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_ADDUSER 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=y
-# 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_INSMOD=y
-# 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_RMMOD=y
-CONFIG_LSMOD=y
-# CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT is not set
-CONFIG_MODPROBE=y
-CONFIG_FEATURE_MODPROBE_MULTIPLE_OPTIONS=y
-CONFIG_FEATURE_MODPROBE_FANCY_ALIAS=y
-
-#
-# Options common to multiple modutils
-#
-CONFIG_FEATURE_CHECK_TAINTED_MODULE=y
-CONFIG_FEATURE_2_4_MODULES=y
-CONFIG_FEATURE_2_6_MODULES=y
-# CONFIG_FEATURE_QUERY_MODULE_INTERFACE is not set
-
-#
-# Linux System Utilities
-#
-CONFIG_DMESG=y
-CONFIG_FEATURE_DMESG_PRETTY=y
-# 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_FREERAMDISK=y
-# CONFIG_FSCK_MINIX is not set
-# CONFIG_MKFS_MINIX is not set
-# CONFIG_FEATURE_MINIX2 is not set
-# CONFIG_GETOPT is not set
-CONFIG_HEXDUMP=y
-# 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=y
-CONFIG_MDADM=y
-CONFIG_MDEV=y
-# CONFIG_FEATURE_MDEV_CONF is not set
-# CONFIG_FEATURE_MDEV_EXEC is not set
-CONFIG_FEATURE_MDEV_LOAD_FIRMWARE=y
-CONFIG_MDSTART=y
-# CONFIG_MKSWAP is not set
-# CONFIG_FEATURE_MKSWAP_V0 is not set
-CONFIG_MORE=y
-CONFIG_FEATURE_USE_TERMIOS=y
-CONFIG_MOUNT=y
-CONFIG_FEATURE_MOUNT_NFS=y
-# CONFIG_FEATURE_MOUNT_CIFS is not set
-CONFIG_FEATURE_MOUNT_FLAGS=y
-CONFIG_FEATURE_MOUNT_FSTAB=y
-CONFIG_PIVOT_ROOT=y
-CONFIG_RDATE=y
-# CONFIG_READPROFILE is not set
-# CONFIG_SETARCH is not set
-CONFIG_SWAPONOFF=y
-CONFIG_SWITCH_ROOT=y
-CONFIG_UMOUNT=y
-# CONFIG_FEATURE_UMOUNT_ALL is not set
-
-#
-# Common options for mount/umount
-#
-CONFIG_FEATURE_MOUNT_LOOP=y
-CONFIG_FEATURE_MTAB_SUPPORT=y
-
-#
-# Miscellaneous Utilities
-#
-# CONFIG_ADJTIMEX is not set
-# CONFIG_BBCONFIG is not set
-# CONFIG_CHRT is not set
-# CONFIG_CROND is not set
-# CONFIG_DEBUG_CROND_OPTION is not set
-# CONFIG_FEATURE_CROND_CALL_SENDMAIL is not set
-# CONFIG_CRONTAB is not set
-# CONFIG_DC 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_EJECT is not set
-# CONFIG_LAST is not set
-# CONFIG_LESS is not set
-CONFIG_FEATURE_LESS_MAXLINES=
-# CONFIG_FEATURE_LESS_BRACKETS is not set
-# CONFIG_FEATURE_LESS_FLAGS is not set
-# CONFIG_FEATURE_LESS_FLAGCS is not set
-# CONFIG_FEATURE_LESS_MARKS is not set
-# CONFIG_FEATURE_LESS_REGEXP 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=y
-CONFIG_FEATURE_MAKEDEVS_LEAF=y
-# CONFIG_FEATURE_MAKEDEVS_TABLE 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_STRINGS is not set
-# CONFIG_SETSID is not set
-# CONFIG_TASKSET is not set
-# CONFIG_FEATURE_TASKSET_FANCY is not set
-# CONFIG_TIME is not set
-# CONFIG_TTYSIZE is not set
-# CONFIG_WATCHDOG is not set
-
-#
-# Networking Utilities
-#
-# CONFIG_FEATURE_IPV6 is not set
-# CONFIG_VERBOSE_RESOLUTION_ERRORS is not set
-# CONFIG_ARP is not set
-# CONFIG_ARPING is not set
-# CONFIG_DNSD is not set
-# CONFIG_ETHER_WAKE is not set
-# CONFIG_FAKEIDENTD is not set
-# CONFIG_FTPGET is not set
-# CONFIG_FTPPUT is not set
-# CONFIG_FEATURE_FTPGETPUT_LONG_OPTIONS is not set
-CONFIG_HOSTNAME=y
-# CONFIG_HTTPD is not set
-# CONFIG_FEATURE_HTTPD_USE_SENDFILE is not set
-# CONFIG_FEATURE_HTTPD_RELOAD_CONFIG_SIGHUP 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_CONFIG_WITH_MIME_TYPES 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_IFCONFIG=y
-CONFIG_FEATURE_IFCONFIG_STATUS=y
-# CONFIG_FEATURE_IFCONFIG_SLIP is not set
-# CONFIG_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ is not set
-CONFIG_FEATURE_IFCONFIG_HW=y
-# CONFIG_FEATURE_IFCONFIG_BROADCAST_PLUS is not set
-# CONFIG_IFUPDOWN is not set
-CONFIG_IFUPDOWN_IFSTATE_PATH="/var/run/ifstate"
-# 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_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_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_NSLOOKUP is not set
-CONFIG_PING=y
-# CONFIG_PING6 is not set
-# CONFIG_PSCAN is not set
-CONFIG_FEATURE_FANCY_PING=y
-CONFIG_ROUTE=y
-# 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_FEATURE_TFTP_GET is not set
-# CONFIG_FEATURE_TFTP_PUT is not set
-# CONFIG_FEATURE_TFTP_BLOCKSIZE is not set
-# CONFIG_DEBUG_TFTP 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_APP_UDHCPC=y
-# CONFIG_FEATURE_UDHCP_DEBUG is not set
-# CONFIG_FEATURE_RFC3397 is not set
-# CONFIG_VCONFIG is not set
-CONFIG_WGET=y
-# 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
-
-#
-# Process Utilities
-#
-CONFIG_FREE=y
-# CONFIG_FUSER is not set
-CONFIG_KILL=y
-CONFIG_KILLALL=y
-# CONFIG_KILLALL5 is not set
-# CONFIG_NMETER is not set
-# CONFIG_PIDOF is not set
-# CONFIG_FEATURE_PIDOF_SINGLE is not set
-# CONFIG_FEATURE_PIDOF_OMIT is not set
-CONFIG_PS=y
-# CONFIG_FEATURE_PS_WIDE 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_DECIMALS is not set
-CONFIG_UPTIME=y
-# CONFIG_WATCH is not set
-
-#
-# Shells
-#
-CONFIG_FEATURE_SH_IS_ASH=y
-# CONFIG_FEATURE_SH_IS_HUSH is not set
-# CONFIG_FEATURE_SH_IS_LASH is not set
-# CONFIG_FEATURE_SH_IS_MSH is not set
-# CONFIG_FEATURE_SH_IS_NONE is not set
-CONFIG_ASH=y
-
-#
-# Ash Shell Options
-#
-CONFIG_ASH_JOB_CONTROL=y
-# CONFIG_ASH_READ_NCHARS is not set
-CONFIG_ASH_READ_TIMEOUT=y
-CONFIG_ASH_ALIAS=y
-CONFIG_ASH_MATH_SUPPORT=y
-# CONFIG_ASH_MATH_SUPPORT_64 is not set
-# CONFIG_ASH_GETOPTS is not set
-# CONFIG_ASH_BUILTIN_ECHO is not set
-CONFIG_ASH_BUILTIN_TEST=y
-# CONFIG_ASH_CMDCMD is not set
-CONFIG_ASH_MAIL=y
-CONFIG_ASH_OPTIMIZE_FOR_SIZE=y
-# 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_LASH is not set
-# CONFIG_MSH is not set
-
-#
-# Bourne Shell Options
-#
-# CONFIG_FEATURE_SH_EXTRA_QUIET is not set
-# CONFIG_FEATURE_SH_STANDALONE 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_IPC_SYSLOG is not set
-CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE=
-# CONFIG_LOGREAD is not set
-# CONFIG_FEATURE_LOGREAD_REDUCED_LOCKING is not set
-# CONFIG_KLOGD is not set
-# CONFIG_LOGGER is not set
-
-#
-# Runit Utilities
-#
-# CONFIG_RUNSV is not set
-# CONFIG_RUNSVDIR is not set
-# CONFIG_SV is not set
-# 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
-
-#
-# ipsvd utilities
-#
-# CONFIG_TCPSVD is not set
-# CONFIG_UDPSVD is not set
diff --git a/defaults/initrd.defaults b/defaults/initrd.defaults
deleted file mode 100755
index 14a403f..0000000
--- a/defaults/initrd.defaults
+++ /dev/null
@@ -1,83 +0,0 @@
-#!/bin/ash
-
-PATH="/usr/sbin:/usr/bin:/sbin:/bin"
-
-# Insert ctrl character
-# ctrl-V then esc will print ^[
-# ctrl-V then ctrl-shift-m will print ^M
-BACK_UP="\033[1K\033[0G"
-NORMAL="\033[0m"
-WARN="\033[33;1m"
-BAD="\033[31;1m"
-BOLD="\033[1m"
-GOOD="\033[32;1m"
-
-# From KNOPPIX LINUXRC
-# Reset fb color mode
-RESET="]R"
-# ANSI COLORS
-# Erase to end of line
-CRE="
-"
-# Clear and reset Screen
-CLEAR="c"
-# Normal color
-NORMAL=""
-# RED: Failure or error message
-RED=""
-# GREEN: Success message
-GREEN=""
-# YELLOW: Descriptions
-YELLOW=""
-# BLUE: System mesages
-BLUE=""
-# MAGENTA: Found devices or drivers
-MAGENTA=""
-# CYAN: Questions
-CYAN=""
-# BOLD WHITE: Hint
-WHITE=""
-
-# Clear screen with colormode reset
-# echo "$CLEAR$RESET"
-# echo "$CLEAR"
-# Just go to the top of the screen
-# echo -n ""
-
-KV=`uname -r`
-KMAJOR=`echo $KV | cut -f1 -d.`
-KMINOR=`echo $KV | cut -f2 -d.`
-KVER="${KMAJOR}.${KMINOR}"
-MISCOPTS='debug detect'
-
-if [ "${KMAJOR}" -eq 2 -a "${KMINOR}" -ge '6' ]
-then
- KV_2_6_OR_GREATER="yes"
-fi
-
-QUIET='1'
-ROOT_LINKS='bin sbin lib lib32 lib64 boot usr opt emul'
-ROOT_TREES='etc root home var'
-INSMOD='insmod'
-if [ "${KMINOR}" -gt '4' ]
-then
- KSUFF='.ko'
-else
- KSUFF='.o'
-fi
-
-REAL_ROOT=''
-CDROOT='0'
-CDROOT_DEV=''
-CDROOT_TYPE='auto'
-NEW_ROOT='/newroot'
-CONSOLE='/dev/console'
-
-LOOPS='/livecd.loop /zisofs /livecd.squashfs /image.squashfs /livecd.gcloop'
-
-DEFAULT_NFSOPTIONS="ro,nolock,rsize=1024,wsize=1024"
-
-# Only sections that are in by default or those that
-# are not module groups need to be defined here...
-HWOPTS='keymap cache modules pata sata scsi usb firewire waitscan slowusb evms lvm dmraid mdadm fs net'
-MY_HWOPTS='modules pata sata scsi usb firewire waitscan dmraid mdadm fs net iscsi'
diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts
deleted file mode 100755
index e0710c4..0000000
--- a/defaults/initrd.scripts
+++ /dev/null
@@ -1,1095 +0,0 @@
-#!/bin/ash
-
-. /etc/initrd.defaults
-
-backup() {
- echo -ne "\033[0G\033[0K"
-}
-
-parse_opt() {
- case "$1" in
- *\=*)
- echo "$1" | cut -d= -f2-
- ;;
- esac
-}
-
-modules_load() {
- for module in $*
- do
- echo ${module} >> /etc/modules/extra_load
- done
-
- modules_scan extra_load
-}
-
-modules_scan() {
- local MODS
- [ -d "/etc/modules/${1}" ] || touch /etc/modules/${1}
-
- [ -f "/etc/modules/${1}" ] && MODS=`cat /etc/modules/${1}`
- for x in ${MODS}
- do
- MLOAD=`echo ${MLIST} | sed -e "s/.*${x}.*/${x}/"`
- if [ "${MLOAD}" = "${x}" ] # Only module to no-load
- then
- echo -e "${BOLD} ::${NORMAL} Skipping ${x}..."
- elif [ "${MLOAD}" = "${MLIST}" ] # == No change == No specified no-load
- then
- [ -n "${DEBUG}" ] && echo -ne "${BOLD} ::${NORMAL} Checking for ${x}..."
- # find -name does not work since the return status is always zero
- if find /lib/modules/${KV} | grep /"${x}${KSUFF}" >/dev/null 2>&1
- then
- echo -ne "${BOLD} ::${NORMAL} Scanning for ${x}..."
- modprobe ${x} -n
- backup
- echo -ne "${NORMAL}"
- fi
- else
- echo -e "${BOLD} ::${NORMAL} Skipping ${x}..."
- fi
- done
-}
-
-uppercase(){
- # needs tr on busybox
- echo $1 | tr 'a-z' 'A-Z'
-}
-
-
-findmediamount() {
- # $1 = mount dir name / media name
- # $2 = recognition file
- # $3 = variable to have the device path
- # $4 = directory before /mnt, like NEW_ROOT
- # args remaining are possible devices
-
- local media=$1 recon=$2 vrbl=$3
- local mntdir="${4}/mnt/${media}"
- shift 4
-
- good_msg "Looking for the ${media}" ${CRYPT_SILENT}
-
- if [ "$#" -gt "0" ]
- then
- [ ! -d "${mntdir}" ] && mkdir -p ${mntdir} 2>/dev/null >/dev/null
- if [ -n "${ISOBOOT}" ]
- then
- mntcddir="${mntdir%${media}}iso"
- if [ ! -f ${mntcddir} ]
- then
- mkdir ${mntcddir}
- fi
- else
- mntcddir=${mntdir}
- fi
-
- for x in $*
- do
- # Check for a block device to mount
- if [ -b "${x}" ]
- then
- skip=0
- bsn=`basename "${x}"`
- #
- # If disk and it has at least one partition, skip.
- # We use /sys/block/${bsn}/${bsn}[0-9]* to make sure that we
- # don't skip device mapper devices. Even the craziest scenario
- # deserves a fair chance.
- #
- for part in `ls /sys/block/${bsn}/${bsn}[0-9]* 2>/dev/null`
- do
- skip=1
- break;
- done
- if [ ${skip} -eq 1 ]
- then
- continue
- fi
- good_msg "Attempting to mount media:- ${x}" ${CRYPT_SILENT}
-
-# if [ "${media}" = "cdrom" ]; then
-# mount -r -t iso9660 ${x} ${mntdir} &>/dev/null
-# else
-# mount -r -t auto ${x} ${mntdir} &>/dev/null
-# fi
- mount -r -t ${CDROOT_TYPE} ${x} ${mntcddir} >/dev/null 2>&1
- if [ "$?" = '0' ]
- then
- if [ -n "${ISOBOOT}" ]; then
- if [ -f ${mntcddir}/${ISOBOOT} ]; then
- mount -o loop ${mntcddir}/${ISOBOOT} ${mntdir}
- if [ "$?" = "0" ]; then
- good_msg "iso mounted on ${mntdir}"
- fi
- fi
- fi
-
- # Check for the media
- if [ -f "${mntdir}/${recon}" ]
- then
- #set REAL_ROOT, CRYPT_ROOT_KEYDEV or whatever ${vrbl} is
- eval ${vrbl}'='"${x}"
- good_msg "Media found on ${x}" ${CRYPT_SILENT}
- break
- else
- umount ${mntcddir}
- fi
- fi
- fi
- done
- fi
-
- eval local result='$'${vrbl}
-
- [ -n "${result}" ] || bad_msg "Media not found" ${CRYPT_SILENT}
-}
-
-devicelist(){
- # Locate the cdrom device with our media on it.
- # CDROM DEVICES
- local DEVICES="/dev/cdroms/* /dev/ide/cd/* /dev/sr*"
- # USB Keychain/Storage
- DEVICES="$DEVICES /dev/sd*"
- # IDE devices
- DEVICES="$DEVICES /dev/hd*"
- # USB using the USB Block Driver
- DEVICES="$DEVICES /dev/ubd* /dev/ubd/*"
- # iSeries devices
- DEVICES="$DEVICES /dev/iseries/vcd*"
- echo ${DEVICES}
-}
-
-bootstrapCD() {
- local DEVICES=`devicelist`
- # The device was specified on the command line, so there's no need to scan
- # a bunch of extra devices
- [ -n "${CDROOT_DEV}" ] && DEVICES="${CDROOT_DEV}"
-
- findmediamount "cdrom" "${SUBDIR}/livecd" "REAL_ROOT" "${NEW_ROOT}" ${DEVICES}
-}
-
-bootstrapKey() {
- # $1 = ROOT/SWAP
- local KEYDEVS=`devicelist`
- eval local keyloc='"${CRYPT_'${1}'_KEY}"'
-
- findmediamount "key" "${keyloc}" "CRYPT_${1}_KEYDEV" "" ${KEYDEVS}
-}
-
-cache_cd_contents() {
- # Check loop file exists and cache to ramdisk if DO_cache is enabled
- if [ "${LOOPTYPE}" != "noloop" ] && [ "${LOOPTYPE}" != "sgimips" ]
- then
- check_loop
- if [ "${DO_cache}" ]
- then
- # TODO: Check the size of the image versus the size of our tmpfs
- # along with the amount of available RAM and increase tmpfs size
- # if necessary. (Not having awk sucks...)
- # z=0
- # for i in $(cat /proc/meminfo | grep -e ^MemFree -e ^Cached | \
- # cut -d: -f2 | cut -dk -f1 | sed -e "s/^\s*//") ; do
- # z=$(($z + $i)) ; done
- # echo $z
- good_msg "Copying loop file for caching..."
- # Verify that the needed directory exists
- mkdir -p "$(dirname ${NEW_ROOT}/mnt/${LOOP})"
- cp -a ${NEW_ROOT}/mnt/cdrom/${LOOP} ${NEW_ROOT}/mnt/${LOOP}
- if [ $? -ne 0 ]
- then
- bad_msg "Failed to cache the loop file! Lack of space?"
- rm -rf ${NEW_ROOT}/mnt/livecd.* 2>/dev/null
- rm -rf ${NEW_ROOT}/mnt/image.* 2>/dev/null
- rm -rf ${NEW_ROOT}/mnt/zisofs 2>/dev/null
- else
- LOOPEXT='../'
- fi
- fi
- fi
-}
-
-mount_sysfs() {
- mount -t sysfs /sys /sys >/dev/null 2>&1
- ret=$?
- [ "$ret" -eq '0' ] || bad_msg "Failed to mount /sys!"
-}
-
-findnfsmount() {
- if [ "${IP}" != '' ] || busybox udhcpc -n -T 15 -q
- then
- [ -e /rootpath ] && NFSROOT=`cat /rootpath`
-
- if [ "${NFSROOT}" = '' ]
- then
- # Obtain NFSIP
- OPTIONS=`busybox dmesg | grep rootserver | sed -e "s/,/ /g"`
- for OPTION in $OPTIONS
- do
- if [ `echo $OPTION | sed -e "s/=/ /g" | cut -d " " -f 1` = 'rootserver' ]
- then
- NFSIP=`echo $OPTION | sed -e "s/=/ /g" | cut -d " " -f 2`
- fi
- done
-
- # Obtain NFSPATH
- OPTIONS=`busybox dmesg | grep rootpath | sed -e "s/,/ /g"`
- for OPTION in $OPTIONS
- do
- if [ `echo $OPTION | sed -e "s/=/ /g" | cut -d " " -f 1` = 'rootpath' ]
- then
- NFSPATH=`echo $OPTION | sed -e "s/=/ /g" | cut -d " " -f 2`
- fi
- done
-
- # Setup NFSROOT
- if [ "${NFSIP}" != '' ] && [ "$NFSPATH" != '' ]
- then
- NFSROOT="${NFSIP}:${NFSPATH}"
- else
- bad_msg "The DHCP Server did not send a valid root-path."
- bad_msg "Please check your DHCP setup, or provide a nfsroot=<...> parameter."
- fi
- fi
-
- if [ "${NFSROOT}" != '' ]
- then
- NFSOPTIONS=${NFSROOT#*,}
- NFSROOT=${NFSROOT%%,*}
- if [ "${NFSOPTIONS}" = "${NFSROOT}" ]
- then
- NFSOPTIONS=$DEFAULT_NFSOPTIONS
- else
- NFSOPTIONS="${DEFAULT_NFSOPTIONS},${NFSOPTIONS}"
- fi
-
- if [ "${CDROOT}" != '0' ]
- then
- good_msg "Attempting to mount NFS CD image on ${NFSROOT} with options ${NFSOPTIONS}"
- mount -t nfs -o ${NFSOPTIONS} ${NFSROOT} ${NEW_ROOT}/mnt/cdrom
- if [ "$?" = '0' ]
- then
- REAL_ROOT="/dev/nfs"
- else
- bad_msg "NFS Mounting failed. Is the path corrent ?"
- fi
- else
- good_msg "Attempting to mount NFS root on ${NFSROOT} with options ${NFSOPTIONS}"
- mount -t nfs -o ${NFSOPTIONS} ${NFSROOT} ${NEW_ROOT}
- if [ "$?" = '0' ]
- then
- REAL_ROOT="/dev/nfs"
- else
- bad_msg "NFS Mounting failed. Is the path correct ?"
- fi
- # FIXME: Need to start portmap and the other rpc daemons in
- # order to remount rw.
- fi
-
- fi
- fi
-}
-
-check_loop() {
- if [ "${LOOP}" = '' -o ! -e "mnt/cdrom/${LOOP}" ]
- then
-
- bad_msg "Invalid loop location: ${LOOP}"
- bad_msg 'Please export LOOP with a valid location, or reboot and pass a proper loop=...'
- bad_msg 'kernel command line!'
-
- run_shell
- fi
-}
-
-run_shell() {
- /bin/ash
-}
-
-runmdev() {
- # busybox udev replacement
- mdev -s
-}
-
-test_success() {
- retcode=$?
- # If last command failed send error message and fall back to a shell
- if [ "$retcode" != '0' ]
- then
- error_string=$1
- error_string="${error_string:-run command}"
- bad_msg 'Failed to $1; failing back to the shell...'
- run_shell
- fi
-}
-
-
-# msg functions arguments
-# $1 string
-# $2 hide flag
-
-good_msg() {
- msg_string=$1
- msg_string="${msg_string:-...}"
- [ "$2" != 1 ] && echo -e "${GOOD}>>${NORMAL}${BOLD} ${msg_string} ${NORMAL}"
-}
-
-bad_msg() {
- msg_string=$1
- msg_string="${msg_string:-...}"
- if [ "$2" != 1 ]
- then
- splash 'verbose' > /dev/null &
- echo -e "${BAD}!!${NORMAL}${BOLD} ${msg_string} ${NORMAL}"
- fi
-}
-
-warn_msg() {
- msg_string=$1
- msg_string="${msg_string:-...}"
- [ "$2" != 1 ] && echo -e "${WARN}**${NORMAL}${BOLD} ${msg_string} ${NORMAL}"
-}
-
-crypt_filter() {
- if [ ${CRYPT_SILENT} -eq 1 ]
- then
- eval $1 >/dev/null 2>/dev/null
- else
- splash 'verbose' > /dev/null &
- eval $1
- if [ $? -eq 0 ]
- then
- splash set_msg 'Disk unlocked.'
- fi
- fi
-}
-
-whereis(){
- # $1 = variable whose value is the path (examples: "REAL_ROOT",
- # "LUKS_KEYDEV")
- # $2 = label
- # $3 = optional explanations for failure
-
- eval local oldvalue='$'${1}
-
- [ \( $# != 2 \) -a \( $# != 3 \) ] && \
- bad_msg "Bad invocation of function whereis, please file a bug \
- report with this message" && exit 1
- [ -n "${3}" ] && local explnt=" or : ${3}" || local explnt="."
-
- bad_msg "Could not find the ${2} in ${oldvalue}${explnt}"
- echo ' Please specify another value or: press Enter for the same, type "shell" for a shell, or "q" to skip...'
- echo -n "${2}(${oldvalue}) :: "
- read ${1}
- case `eval echo '$'${1}` in
- 'q')
- eval ${1}'='${oldvalue}
- warn_msg "Skipping step, this will likely cause a boot failure."
- break
- ;;
- 'shell')
- eval ${1}'='${oldvalue}
- echo "To leave and try again just press <Ctrl>+D"
- run_shell
- ;;
- '')
- eval ${1}'='${oldvalue}
- ;;
- esac
-}
-
-bind_mount_dev() {
- # bind-mount /dev/ so that loop devices can be found
- mount -o bind ${NEW_ROOT}/dev /dev
-}
-
-setup_hotplug() {
- if [ "${KV_2_6_OR_GREATER}" ]
- then
- echo /sbin/mdev > /proc/sys/kernel/hotplug
- fi
-}
-
-check_slowusb() {
- [ "${DO_slowusb}" ] || \
- for dir in /sys/bus/usb/drivers/usb-storage/*
- do
- [ -d "${dir}" ] && FORCE_slowusb="1"
- done
-}
-
-start_dev_mgr() {
- if [ "${KV_2_6_OR_GREATER}" ]
- then
- cd /sys
- [ "${DO_slowusb}" ] && sdelay
- check_slowusb
- [ "${FORCE_slowusb}" ] && sdelay
- good_msg 'Activating mdev'
- runmdev
- [ "${DO_slowusb}" ] || \
- [ "${FORCE_slowusb}" ] && sdelay
- cd /
- fi
-}
-
-cmdline_hwopts() {
- # Scan CMDLINE for any "doscsi" or "noscsi"-type arguments
- local FOUND
- local TMP_HWOPTS
-
- for x in $HWOPTS
- do
- for y in $CMDLINE
- do
- if [ "${y}" = "do${x}" ]
- then
- MY_HWOPTS="${MY_HWOPTS} $x"
- elif [ "${y}" = "no${x}" ]
- then
- MY_HWOPTS="`echo ${MY_HWOPTS} | sed -e \"s/${x}//g\" -`"
- fi
- if [ "$(echo ${y} | cut -b -7)" = "keymap=" ]
- then
- MY_HWOPTS="${MY_HWOPTS} dokeymap"
- fi
- done
- done
-
- # Shouldnt need to sort this as the following loop should figure out the
- # duplicates and strip them out
- #MY_HWOPTS=`echo ${MY_HWOPTS}| sort`
-
- for x in ${MY_HWOPTS}
- do
- FOUND=0
- for y in ${TMP_HWOPTS}
- do
- if [ "${y}" = "${x}" ]
- then
- continue 2
- fi
- done
- TMP_HWOPTS="${TMP_HWOPTS} ${x}"
- eval DO_`echo ${x} | sed 's/-//'`=1
- done
-
- MY_HWOPTS=${TMP_HWOPTS}
-}
-
-load_modules() {
- # Load modules listed in MY_HWOPTS if /lib/modules exists for the running
- # kernel version
- if [ -d "/lib/modules/${KV}" ]
- then
- good_msg 'Loading modules'
- # Load appropriate kernel modules
- for modules in $MY_HWOPTS
- do
- modules_scan $modules
- done
- else
- good_msg 'Skipping module load; no modules in the ramdisk!'
- fi
-}
-
-setup_keymap() {
- if [ "${DO_keymap}" ]
- then
- if [ ! -e /dev/vc/0 -a ! -e /dev/tty0 ]
- then
- DEVBIND=1
- mount -o bind ${NEW_ROOT}/dev /dev
- fi
- [ ! -e /dev/tty0 ] && ln -s /dev/tty1 /dev/tty0
-
- [ -f /lib/keymaps/keymapList ] && chooseKeymap
-
- [ "${DEVBIND}" = '1' ] && umount /dev
-
- if [ -e /etc/sysconfig/keyboard -a "${CDROOT}" -eq '1' ]
- then
- mkdir -p ${NEW_ROOT}/etc/sysconfig/
- cp /etc/sysconfig/keyboard ${NEW_ROOT}/etc/sysconfig/keyboard
- fi
- fi
-}
-
-chooseKeymap() {
- good_msg "Loading keymaps"
- if [ -z "${keymap}" ]
- then
- splash 'verbose' > /dev/null &
- cat /lib/keymaps/keymapList
- read -t 10 -p '<< Load keymap (Enter for default): ' keymap
- case ${keymap} in
- 1|azerty) keymap=azerty ;;
- 2|be) keymap=be ;;
- 3|bg) keymap=bg ;;
- 4|br-a) keymap=br-a ;;
- 5|br-l) keymap=br-l ;;
- 6|by) keymap=by ;;
- 7|cf) keymap=cf ;;
- 8|croat) keymap=croat ;;
- 9|cz) keymap=cz ;;
- 10|de) keymap=de ;;
- 11|dk) keymap=dk ;;
- 12|dvorak) keymap=dvorak ;;
- 13|es) keymap=es ;;
- 14|et) keymap=et ;;
- 15|fi) keymap=fi ;;
- 16|fr) keymap=fr ;;
- 17|gr) keymap=gr ;;
- 18|hu) keymap=hu ;;
- 19|il) keymap=il ;;
- 20|is) keymap=is ;;
- 21|it) keymap=it ;;
- 22|jp) keymap=jp ;;
- 23|la) keymap=la ;;
- 24|lt) keymap=lt ;;
- 25|mk) keymap=mk ;;
- 26|nl) keymap=nl ;;
- 27|no) keymap=no ;;
- 28|pl) keymap=pl ;;
- 29|pt) keymap=pt ;;
- 30|ro) keymap=ro ;;
- 31|ru) keymap=ru ;;
- 32|se) keymap=se ;;
- 33|sg) keymap=sg ;;
- 34|sk-y) keymap=sk-y ;;
- 35|sk-z) keymap=sk-z ;;
- 36|slovene) keymap=slovene ;;
- 37|trf) keymap=trf ;;
- 38|trq) keymap=trq ;;
- 39|ua) keymap=ua ;;
- 40|uk) keymap=uk ;;
- 41|us) keymap=us ;;
- 42|wangbe) keymap=wangbe ;;
- esac
- fi
- if [ -e /lib/keymaps/${keymap}.map ]
- then
- good_msg "Loading the ''${keymap}'' keymap"
- loadkmap < /lib/keymaps/${keymap}.map
-# xkeymap=${keymap}
-# echo ${keymap} | egrep -e "[0-9]+" >/dev/null 2>&1
-# if [ "$?" -eq '0' ]
-# then
-# xkeymap=`tail -n 7 /lib/keymaps/keymapList | grep ${keymap} | sed -r "s/.*\s+${keymap}\s+([a-z-]+).*/\1/g" | egrep -v 1`
-# fi
- mkdir -p /etc/sysconfig
-# echo "XKEYBOARD=${xkeymap}" > /etc/sysconfig/keyboard
- echo "XKEYBOARD=${keymap}" > /etc/sysconfig/keyboard
- splash set_msg "Set keymap to ${keymap}"
- elif [ -z "${keymap}" ]
- then
- echo
- good_msg "Keeping default keymap"
- splash set_msg "Keeping default keymap"
- else
- bad_msg "Sorry, but keymap ''${keymap}'' is invalid!"
- unset keymap
- chooseKeymap
- fi
-}
-
-startVolumes() {
- #good_msg 'Checking if volumes need to be started...'
-
- # Here, we check for /dev/device-mapper, and if it exists, we setup a
- # a symlink, which should hopefully fix bug #142775 and bug #147015
- if [ -e /dev/device-mapper ] && [ ! -e /dev/mapper/control ]
- then
- mkdir -p /dev/mapper
- ln -sf /dev/device-mapper /dev/mapper/control
- fi
-
- if [ "${USE_MDADM}" -eq '1' ]
- then
- if [ ! -e '/etc/mdadm.conf' ]
- then
- /sbin/mdadm --examine > /etc/mdadm.conf
- fi
- /sbin/mdadm --assemble
- fi
-
- if [ "${USE_DMRAID_NORMAL}" = '1' ]
- then
- if [ -e '/sbin/dmraid' ]
- then
- good_msg "Activating Device-Mapper RAID(s)"
- if [ '${DMRAID_OPTS}' = '' ]
- then
- /sbin/dmraid -ay
- else
- /sbin/dmraid -ay ${DMRAID_OPTS}
- fi
- fi
- fi
-
- if [ "${USE_LVM_NORMAL}" = '1' ]
- then
- if [ -e '/bin/vgscan' -a -e '/bin/vgchange' ]
- then
- for dev in ${RAID_DEVICES}
- do
- setup_md_device "${dev}"
- done
-
- good_msg "Scanning for Volume Groups"
- /bin/vgscan --ignorelockingfailure --mknodes 2>/dev/null
- sleep 2
- good_msg "Activating Volume Groups"
- /bin/vgchange -ay --ignorelockingfailure 2>/dev/null
-
- # Disable EVMS since lvm is activated and they dont work together.
- if [ "${USE_EVMS_NORMAL}" = '1' ]
- then
- bad_msg "Disabling EVMS Support because LVM started"
- bad_msg "Do not add dolvm to the cmdline if this is not what you want"
- bad_msg "LVM and EVMS do not work well together"
- USE_EVMS_NORMAL=0
- fi
- else
- bad_msg "vgscan or vgchange not found: skipping LVM volume group activation!"
- fi
- fi
-
- if [ "${USE_EVMS_NORMAL}" = '1' ]
- then
- if [ -e '/sbin/evms_activate' ]
- then
- good_msg "Activating EVMS"
- evms_activate
- fi
- fi
-}
-
-startiscsi() {
-
- if [ -n "${ISCSI_INITIATORNAME}" ] && [ -n "${ISCSI_TARGET}" ] && [ -n "${ISCSI_ADDRESS}" ]
- then
- good_msg "Activating iSCSI"
-
- if [ "${ISCSI_TGPT}" ]
- then
- ADDITIONAL="${ADDITIONAL} -g ${ISCSI_TGPT}"
- else
- ADDITIONAL="${ADDITIONAL} -g 1"
- fi
-
- if [ "${ISCSI_PORT}" ]
- then
- ADDITIONAL="${ADDITIONAL} -p ${ISCSI_PORT}"
- fi
-
- if [ "${ISCSI_USERNAME}" ]
- then
- ADDITIONAL="${ADDITIONAL} -u ${ISCSI_USERNAME}"
- fi
-
- if [ "${ISCSI_PASSWORD}" ]
- then
- ADDITIONAL="${ADDITIONAL} -w ${ISCSI_PASSWORD}"
- fi
-
- if [ "${ISCSI_USERNAME_IN}" ]
- then
- ADDITIONAL="${ADDITIONAL} -U ${ISCSI_USERNAME_IN}"
- fi
-
- if [ "${ISCSI_PASSWORD_IN}" ]
- then
- ADDITIONAL="${ADDITIONAL} -W ${ISCSI_PASSWORD_IN}"
- fi
-
- if [ "${ISCSI_DEBUG}" ]
- then
- ADDITIONAL="${ADDITIONAL} -d ${ISCSI_DEBUG}"
- fi
-
- iscsistart -i "${ISCSI_INITIATORNAME}" -t "${ISCSI_TARGET}" -a "${ISCSI_ADDRESS}" ${ADDITIONAL}
- fi
-}
-
-
-# Open a LUKS device
-# It is either the root or a swap, other devices are supported in the scripts provided with sys-fs/cryptsetup-luks
-# $1 - root/swap
-openLUKS() {
- # please use 'tr' and this line, or remove it
- # eval local TYPE=`uppercase $1`
-
- case $1 in
- root)
- local TYPE=ROOT
- ;;
- swap)
- local TYPE=SWAP
- ;;
- esac
-
- eval local LUKS_DEVICE='"${CRYPT_'${TYPE}'}"' LUKS_NAME="$1" LUKS_KEY='"${CRYPT_'${TYPE}'_KEY}"' LUKS_KEYDEV='"${CRYPT_'${TYPE}'_KEYDEV}"'
- local DEV_ERROR=0 KEY_ERROR=0 KEYDEV_ERROR=0
- local mntkey="/mnt/key/" cryptsetup_options=''
-
- [ ! -e /sbin/cryptsetup ] && bad_msg "The ramdisk does not support LUKS" && exit 1
- while [ 1 ]
- do
- # if crypt_silent=1 and some error occurs, enter shell quietly
- if [ \( ${CRYPT_SILENT} -eq 1 \) -a \( \( \( ${DEV_ERROR} -eq 1 \) -o \( ${KEY_ERROR} -eq 1 \) \) -o \( ${KEYDEV_ERROR} -eq 1 \) \) ]
- then
- run_shell
- elif [ ${DEV_ERROR} -eq 1 ]
- then
- whereis "LUKS_DEVICE" "${LUKS_NAME}"
- DEV_ERROR=0
- elif [ ${KEY_ERROR} -eq 1 ]
- then
- whereis "LUKS_KEY" "${LUKS_NAME} key"
- KEY_ERROR=0
- elif [ ${KEYDEV_ERROR} -eq 1 ]
- then
- whereis "LUKS_KEYDEV" "${LUKS_NAME} key device"
- KEYDEV_ERROR=0
- else
- setup_md_device ${LUKS_DEVICE}
- cryptsetup isLuks ${LUKS_DEVICE}
- if [ ! "$?" -eq '0' ]
- then
- bad_msg "The LUKS device ${LUKS_DEVICE} does not contain a LUKS header" ${CRYPT_SILENT}
- DEV_ERROR=1
- continue
- else
- # Handle keys
- if [ -n "${LUKS_KEY}" ]
- then
- if [ ! -e "${mntkey}${LUKS_KEY}" ]
- then
- if [ -b "${LUKS_KEYDEV}" ]
- then good_msg "Using key device ${LUKS_KEYDEV}." ${CRYPT_SILENT}
- else
- good_msg "Please insert removable device ${LUKS_KEYDEV} for ${LUKS_NAME}" ${CRYPT_SILENT}
- # abort after 10 secs
- local count=10
- while [ ${count} -gt 0 ]
- do
- count=$((count-1))
- sleep 1
- if [ -b "${LUKS_KEYDEV}" ]
- then
- good_msg "Removable device ${LUKS_KEYDEV} detected." ${CRYPT_SILENT}
- break
- fi
- done
- if [ ! -b "${LUKS_KEYDEV}" ]
- then
- eval CRYPT_${TYPE}_KEY=${LUKS_KEY}
- bootstrapKey ${TYPE}
- eval LUKS_KEYDEV='"${CRYPT_'${TYPE}'_KEYDEV}"'
- if [ ! -b "${LUKS_KEYDEV}" ]; then
- KEYDEV_ERROR=1
- bad_msg "Removable device ${LUKS_KEYDEV} not found." ${CRYPT_SILENT}
- continue
- fi
- # continue otherwise will mount keydev which is mounted by bootstrap
- continue
- fi
- fi
- # At this point a device was recognized, now let's see if the key is there
- [ ! -d "$mntkey" ] && mkdir -p ${mntkey} 2>/dev/null >/dev/null
-
- mount -n -o ro ${LUKS_KEYDEV} ${mntkey} >/dev/null 2>/dev/null
- if [ "$?" != '0' ]
- then
- KEYDEV_ERROR=1
- bad_msg "Mounting of device ${LUKS_KEYDEV} failed." ${CRYPT_SILENT}
- continue
- else
- good_msg "Removable device ${LUKS_KEYDEV} mounted." ${CRYPT_SILENT}
- sleep 2
- # keyfile exists?
- if [ ! -e "${mntkey}${LUKS_KEY}" ]; then
- umount -n ${mntkey} 2>/dev/null >/dev/null
- KEY_ERROR=1
- KEYDEV_ERROR=1
- bad_msg "Key {LUKS_KEY} on device ${LUKS_KEYDEV} not found." ${CRYPT_SILENT}
- continue
- fi
- fi
- fi
- # At this point a candidate key exists (either mounted before or not)
- good_msg "${LUKS_KEY} on device ${LUKS_KEYDEV} found" ${CRYPT_SILENT}
- cryptsetup_options="-d ${mntkey}${LUKS_KEY}"
- fi
- # At this point, keyfile or not, we're ready!
- crypt_filter "cryptsetup ${cryptsetup_options} luksOpen ${LUKS_DEVICE} ${LUKS_NAME}"
- if [ $? -eq 0 ]
- then
- good_msg "LUKS device ${LUKS_DEVICE} opened" ${CRYPT_SILENT}
- break
- else
- bad_msg "Failed to open LUKS device ${LUKS_DEVICE}" ${CRYPT_SILENT}
- DEV_ERROR=1
- KEY_ERROR=1
- KEYDEV_ERROR=1
- fi
- fi
- fi
- done
- umount ${mntkey} 2>/dev/null >/dev/null
- rmdir -p ${mntkey} 2>/dev/null >/dev/null
-}
-
-startLUKS() {
-
- # if key is set but key device isn't, find it
-
- [ -n "${CRYPT_ROOT_KEY}" ] && [ -z "${CRYPT_ROOT_KEYDEV}" ] \
- && sleep 6 && bootstrapKey "ROOT"
-
- if [ -n "${CRYPT_ROOT}" ]; then
- openLUKS "root"
- if [ -n "${REAL_ROOT}" ]
- then
- # Rescan volumes
- startVolumes
- else
- REAL_ROOT="/dev/mapper/root"
- fi
- fi
-
- # same for swap, but no need to sleep if root was unencrypted
- [ -n "${CRYPT_SWAP_KEY}" ] && [ -z "${CRYPT_SWAP_KEYDEV}" ] \
- && { [ -z "${CRYPT_ROOT}" ] && sleep 6; bootstrapKey "SWAP"; }
-
- if [ -n "${CRYPT_SWAP}" ]; then
- openLUKS "swap"
- if [ -z "${REAL_RESUME}" ]
- then
- # Resume from swap as default
- REAL_RESUME="/dev/mapper/swap"
- fi
- fi
-}
-
-sdelay() {
- # Sleep a specific number of seconds if SDELAY is set otherwise only sleep
- # 1 second
- if [ -n "${SDELAY}" ]
- then
- sleep ${SDELAY}
- else
- sleep 1
- fi
-}
-
-quiet_kmsg() {
- # if QUIET is set make the kernel less chatty
- [ -n "$QUIET" ] && echo '0' > /proc/sys/kernel/printk
-}
-
-verbose_kmsg() {
- # if QUIET is set make the kernel less chatty
- [ -n "$QUIET" ] && echo '6' > /proc/sys/kernel/printk
-}
-
-
-cdupdate() {
- if [ "${CDROOT}" = '1' ]
- then
- if [ -x /${NEW_ROOT}/mnt/cdrom/cdupdate.sh ]
- then
- good_msg "Running cdupdate.sh"
- ${NEW_ROOT}/mnt/cdrom/cdupdate.sh
- if [ "$?" != '0' ]
- then
- bad_msg "Executing cdupdate.sh failed!"
- run_shell
- fi
- else
- good_msg 'No cdupdate.sh script found, skipping...'
- fi
- fi
-}
-
-setup_md_device() {
- local device
-
- [ -z "$1" ] && device="${REAL_ROOT}" || device="$1"
- [ -z "${device}" ] && return # LiveCD
-
- if [ `echo ${device}|sed -e 's#\(luks:\)\?\(/dev/md\)[[:digit:]]\+#\2#'` = "/dev/md" ]
- then
- good_msg 'Detected real_root as a md device. Setting up the device node...'
- MD_NUMBER=`echo ${device}|sed -e 's#\(luks:\)\?/dev/md\([[:digit:]]\+\)#\2#'`
- if [ ! -e /dev/md${MD_NUMBER} ]
- then
- mknod /dev/md${MD_NUMBER} b 9 ${MD_NUMBER} >/dev/null 2>&1
- [ "$?" -ne 0 ] && bad_msg "Creation of /dev/md${MD_NUMBER} failed..."
- fi
- mdstart ${MDPART} /dev/md${MD_NUMBER}
- fi
-}
-
-rundebugshell() {
- if [ -n "$DEBUG" ]
- then
- good_msg 'Starting debug shell as requested by "debug" option.'
- good_msg 'Type "exit" to continue with normal bootup.'
- [ -x /bin/sh ] && /bin/sh || /bin/ash
- fi
-}
-
-do_resume() {
- if [ -d /proc/suspend2 -o -d /sys/power/suspend2 -o -d /sys/power/tuxonice ]; then
- tuxonice_resume
- else
- swsusp_resume
- fi
-}
-
-swsusp_resume() {
- # determine swap resume partition
- local device=$(ls -lL "${REAL_RESUME}" | sed 's/\ */ /g' | cut -d \ -f 5-6 | sed 's/,\ */:/')
- [ -f /sys/power/resume ] && echo "${device}" > /sys/power/resume
-}
-
-tuxonice_resume() {
- local splash_theme
- if grep "splash=" /proc/cmdline > /dev/null 2>&1; then
- splash_theme=$(cat /proc/cmdline | sed 's/.*splash=/splash=/' | sed 's/ .*//' | sed 's/.*theme://' | sed 's/,.*//')
- fi
-
- local tuxonice_userui_program="/sys/power/tuxonice/user_interface/program"
- local tuxonice_do_resume="/sys/power/tuxonice/do_resume"
- local tuxonice_resumedev="/sys/power/tuxonice/resume"
- local tuxonice_replace_swsusp="/sys/power/tuxonice/replace_swsusp"
-
- #
- # Backward compatibility
- #
- if [ -e /sys/power/suspend2 ]; then
- tuxonice_userui_program="/sys/power/suspend2/user_interface/program"
- tuxonice_do_resume="/sys/power/suspend2/do_resume"
- tuxonice_resumedev="/sys/power/suspend2/resume"
- tuxonice_replace_swsusp="/sys/power/suspend2/replace_swsusp"
- elif [ -e /proc/suspend2 ]; then
- tuxonice_userui_program="/proc/suspend2/userui_program"
- tuxonice_do_resume="/proc/suspend2/do_resume"
- tuxonice_resumedev="/proc/suspend2/resume"
- tuxonice_replace_swsusp="/proc/suspend2/replace_swsusp"
- fi
-
- # if 'use_swsusp' is given, use swsusp instead
- if grep "use_swsusp" /proc/cmdline > /dev/null 2>&1; then
- echo 0 > ${tuxonice_replace_swsusp}
- swsusp_resume
- return
- fi
-
- modules_scan tuxonice
-
- # we both configure tuxonice and activate resuming,
- # however the kernel will resume only if an image is found
-
- if ! grep suspend_noui /proc/cmdline > /dev/null 2>&1; then
- which suspend2ui_text > /dev/null 2>&1 && which suspend2ui_text > "${tuxonice_userui_program}"
- which tuxoniceui_text > /dev/null 2>&1 && which tuxoniceui_text > "${tuxonice_userui_program}"
-
- if [ -n "${splash_theme}" ]; then
- ln -s /etc/splash/${splash_theme} /etc/splash/suspend2
- ln -s /etc/splash/${splash_theme} /etc/splash/tuxonice
-
- which suspend2ui_fbsplash > /dev/null 2>&1 && which suspend2ui_fbsplash > "${tuxonice_userui_program}"
- which tuxoniceui_fbsplash > /dev/null 2>&1 && which tuxoniceui_fbsplash > "${tuxonice_userui_program}"
- fi
-
- fi
- echo "${REAL_RESUME}" > "${tuxonice_resumedev}"
- echo > "${tuxonice_do_resume}"
-}
-
-find_loop() {
- CDROM="${NEW_ROOT}/mnt/cdrom"
- for loop in ${LOOPS}
- do
- if [ -e "${CDROM}""${loop}" ]
- then
- LOOP="${loop}"
- fi
- done
-}
-
-find_looptype() {
- LOOPTYPE="${LOOP##*.}"
- [ "${LOOPTYPE}" == "loop" ] && LOOPTYPE="normal"
- [ "${LOOP}" == "/zisofs" ] && LOOPTYPE="${LOOP#/}"
- [ -z "${LOOPTYPE}" ] && LOOPTYPE="noloop"
-}
-
-getdvhoff() {
- echo $(( $(hexdump -n 4 -s $((316 + 12 * $2)) -e '"%i"' $1) * 512))
-}
-
-setup_unionfs() {
- local rw_dir=$1
- local ro_dir=$2
- if [ "${USE_UNIONFS_NORMAL}" = '1' ]
- then
- # Directory used for rw changes in union mount filesystem
- UNION=/union
-# MEMORY=/memory
-# if [ -z "$UID" ]
-# then
-# CHANGES=$MEMORY/unionfs_changes/default
-# else
-# CHANGES=$MEMORY/unionfs_changes/$UID
-# fi
-
-# mkdir -p ${MEMORY}
- mkdir -p ${UNION}
- good_msg "Loading fuse module"
- modprobe fuse > /dev/null 2>&1
-# if [ -n "${UNIONFS}" ]
-# then
-# CHANGESDEV=${UNIONFS}
-# good_msg "mounting $CHANGESDEV to $MEMORY for unionfs support"
-# mount -t auto $CHANGESDEV $MEMORY
-# # mount tmpfs only in the case when changes= boot parameter was
-# # empty or we were not able to mount the storage device
-# ret=$?
-# if [ "${ret}" -ne 0 ]
-# then
-# bad_msg "mount of $CHANGESDEV failed falling back to ramdisk based unionfs"
-# mount -t tmpfs tmpfs $MEMORY
-# fi
-# if [ "${CDROOT}" -eq '1' -a ! -f ${MEMORY}/livecd.unionfs ]
-# then
-# umount $MEMORY
-# bad_msg "failed to find livecd.unionfs file on $CHANGESDEV"
-# bad_msg "create a livecd.unionfs file on this device if you wish to use it for unionfs"
-# bad_msg "falling back to ramdisk based unionfs for safety"
-# mount -t tmpfs tmpfs $MEMORY
-# fi
-# else
-# good_msg "Mounting ramdisk to $MEMORY for unionfs support..."
-# mount -t tmpfs tmpfs $MEMORY
-# fi
-
- mkdir /tmp
- mkdir -p ${UNION}
-# mkdir -p $CHANGES
-# mount -t unionfs -o dirs=$CHANGES=rw unionfs ${UNION}
- good_msg "Creating union mount"
- unionfs -o allow_other,cow,noinitgroups,suid,dev,default_permissions,use_ino ${rw_dir}=RW:${ro_dir}=RO ${UNION} 2>/dev/null
- ret=$?
- if [ "${ret}" -ne 0 ]
- then
- bad_msg "Can't setup union mount!"
- USE_UNIONFS_NORMAL=0
- fi
- else
- USE_UNIONFS_NORMAL=0
- fi
-}
diff --git a/defaults/keymaps.tar.gz b/defaults/keymaps.tar.gz
deleted file mode 100644
index a490fad..0000000
--- a/defaults/keymaps.tar.gz
+++ /dev/null
Binary files differ
diff --git a/defaults/linuxrc b/defaults/linuxrc
deleted file mode 100755
index 0bf7316..0000000
--- a/defaults/linuxrc
+++ /dev/null
@@ -1,750 +0,0 @@
-#!/bin/sh
-
-. /etc/initrd.defaults
-. /etc/initrd.scripts
-
-splash() {
- return 0
-}
-
-[ -e /etc/initrd.splash ] && . /etc/initrd.splash
-
-# Clean input/output
-exec >${CONSOLE} <${CONSOLE} 2>&1
-
-if [ "$$" != '1' ]
-then
- echo '/linuxrc has to be run as the init process as the one'
- echo 'with a PID of 1. Try adding init="/linuxrc" to the'
- echo 'kernel command line or running "exec /linuxrc".'
- exit 1
-fi
-
-mount -t proc proc /proc >/dev/null 2>&1
-mount -o remount,rw / >/dev/null 2>&1
-
-# Set up symlinks
-/bin/busybox --install -s
-
-if [ "$0" = '/init' ]
-then
- [ -e /linuxrc ] && rm /linuxrc
-
- if [ -e /bin/lvm ]
- then
- ln -s /bin/lvm /bin/vgscan
- ln -s /bin/lvm /bin/vgchange
- fi
-fi
-
-quiet_kmsg
-
-CMDLINE=`cat /proc/cmdline`
-# Scan CMDLINE for any specified real_root= or cdroot arguments
-FAKE_ROOT=''
-REAL_ROOTFLAGS=''
-CRYPT_SILENT=0
-for x in ${CMDLINE}
-do
- case "${x}" in
- real_root\=*)
- REAL_ROOT=`parse_opt "${x}"`
- ;;
- root\=*)
- FAKE_ROOT=`parse_opt "${x}"`
- ;;
- subdir\=*)
- SUBDIR=`parse_opt "${x}"`
- ;;
- real_init\=*)
- REAL_INIT=`parse_opt "${x}"`
- ;;
- init_opts\=*)
- INIT_OPTS=`parse_opt "${x}"`
- ;;
- # Livecd options
- cdroot)
- CDROOT=1
- ;;
- cdroot\=*)
- CDROOT=1
- CDROOT_DEV=`parse_opt "${x}"`
- ;;
- cdroot_type\=*)
- CDROOT_TYPE=`parse_opt "${x}"`
- ;;
- # Start livecd loop, looptype options
- loop\=*)
- LOOP=`parse_opt "${x}"`
- ;;
- looptype\=*)
- LOOPTYPE=`parse_opt "${x}"`
- ;;
- isoboot\=*)
- ISOBOOT=`parse_opt "${x}"`
- ;;
- # Start Volume manager options
- dolvm)
- USE_LVM_NORMAL=1
- ;;
- dolvm2)
- bad_msg 'Using dolvm2 is deprecated, use dolvm, instead.'
- USE_LVM_NORMAL=1
- ;;
- domdadm)
- USE_MDADM=1
- ;;
- dodmraid)
- USE_DMRAID_NORMAL=1
- ;;
- dodmraid\=*)
- DMRAID_OPTS=`parse_opt "${x}"`
- USE_DMRAID_NORMAL=1
- ;;
- doevms)
- USE_EVMS_NORMAL=1
- ;;
- doevms2)
- bad_msg 'Using doevms2 is deprecated, use doevms, instead.'
- USE_EVMS_NORMAL=1
- ;;
- # Debug Options
- debug)
- DEBUG='yes'
- ;;
- # Scan delay options
- scandelay\=*)
- SDELAY=`parse_opt "${x}"`
- ;;
- scandelay)
- SDELAY=10
- ;;
- # Module no-loads
- doload\=*)
- MDOLIST=`parse_opt "${x}"`
- MDOLIST="`echo ${MDOLIST} | sed -e 's/,/ /g'`"
- ;;
- nodetect)
- NODETECT=1
- ;;
- noload\=*)
- MLIST=`parse_opt "${x}"`
- MLIST="`echo ${MLIST} | sed -e 's/,/ /g'`"
- export MLIST
- ;;
- # Redirect output to a specific tty
- CONSOLE\=*|console\=*)
- CONSOLE=`parse_opt "${x}"`
-# exec >${CONSOLE} <${CONSOLE} 2>&1
- ;;
- # /dev/md
- lvmraid\=*)
- RAID_DEVICES="`parse_opt ${x}`"
- RAID_DEVICES="`echo ${RAID_DEVICES} | sed -e 's/,/ /g'`"
- ;;
- part\=*)
- MDPART=`parse_opt "${x}"`
- ;;
- # NFS
- ip\=*)
- IP=`parse_opt "${x}"`
- ;;
- nfsroot\=*)
- NFSROOT=`parse_opt "${x}"`
- ;;
- # iSCSI
- iscsi_initiatorname\=*)
- ISCSI_INITIATORNAME=`parse_opt "${x}"`
- ;;
- iscsi_target\=*)
- ISCSI_TARGET=`parse_opt "${x}"`
- ;;
- iscsi_tgpt\=*)
- ISCSI_TGPT=`parse_opt "${x}"`
- ;;
- iscsi_address\=*)
- ISCSI_ADDRESS=`parse_opt "${x}"`
- ;;
- iscsi_port\=*)
- ISCSI_PORT=`parse_opt "${x}"`
- ;;
- iscsi_username\=*)
- ISCSI_USERNAME=`parse_opt "${x}"`
- ;;
- iscsi_password\=*)
- ISCSI_PASSWORD=`parse_opt "${x}"`
- ;;
- iscsi_username_in\=*)
- ISCSI_USERNAME_IN=`parse_opt "${x}"`
- ;;
- iscsi_password_in\=*)
- ISCSI_PASSWORD_IN=`parse_opt "${x}"`
- ;;
- iscsi_debug\=*)
- ISCSI_DEBUG=`parse_opt "${x}"`
- ;;
- # Crypto
- crypt_root\=*)
- CRYPT_ROOT=`parse_opt "${x}"`
- ;;
- crypt_swap\=*)
- CRYPT_SWAP=`parse_opt "${x}"`
- ;;
- root_key\=*)
- CRYPT_ROOT_KEY=`parse_opt "${x}"`
- ;;
- root_keydev\=*)
- CRYPT_ROOT_KEYDEV=`parse_opt "${x}"`
- ;;
- swap_key\=*)
- CRYPT_SWAP_KEY=`parse_opt "${x}"`
- ;;
- swap_keydev\=*)
- CRYPT_SWAP_KEYDEV=`parse_opt "${x}"`
- ;;
- real_resume\=*|resume\=*)
- REAL_RESUME=`parse_opt "${x}"`
- ;;
- noresume)
- NORESUME=1
- ;;
- crypt_silent)
- CRYPT_SILENT=1
- ;;
- real_rootflags\=*)
- REAL_ROOTFLAGS=`parse_opt "${x}"`
- ;;
- keymap\=*)
- keymap=`parse_opt "${x}"`
- ;;
- unionfs)
- if [ ! -x /sbin/unionfs ]
- then
- USE_UNIONFS_NORMAL=0
- bad_msg 'unionfs binary not found: aborting use of unionfs!'
- else
- USE_UNIONFS_NORMAL=1
- fi
- ;;
- nounionfs)
- USE_UNIONFS_NORMAL=0
- ;;
-# unionfs\=*)
-# if [ ! -x /sbin/unionfs ]
-# then
-# USE_UNIONFS_NORMAL=0
-# bad_msg 'unionfs binary not found: aborting use of unionfs!'
-# else
-# USE_UNIONFS_NORMAL=1
-# CMD_UNIONFS=`parse_opt "${x}"`
-# echo ${CMD_UNIONFS}|grep , >/dev/null 2>&1
-# if [ "$?" -eq '0' ]
-# then
-# UID=`echo ${CMD_UNIONFS#*,}`
-# UNIONFS=`echo ${CMD_UNIONFS%,*}`
-# else
-# UNIONFS=${CMD_UNIONFS}
-# fi
-# fi
-# ;;
- esac
-done
-
-if [ -z "${REAL_ROOT}" -a \( "${CDROOT}" -eq 0 \) -a \( "${FAKE_ROOT}" != "/dev/ram0" \) ]
-then
- REAL_ROOT="${FAKE_ROOT}"
-fi
-
-splash 'init'
-
-cmdline_hwopts
-
-# Mount sysfs
-mount_sysfs
-
-# Setup hotplugging for firmware loading
-setup_hotplug
-
-# Load modules listed in MY_HWOPTS if /lib/modules exists for the running kernel
-if [ -z "${DO_modules}" ]
-then
- good_msg 'Skipping module load; disabled via commandline'
-elif [ -d "/lib/modules/${KV}" ]
-then
- good_msg 'Loading modules'
- # Load appropriate kernel modules
- if [ "${NODETECT}" != '1' ]
- then
- for modules in ${MY_HWOPTS}
- do
- modules_scan ${modules}
- done
- fi
- # Always eval doload=...
- modules_load ${MDOLIST}
-else
- good_msg 'Skipping module load; no modules in the ramdisk!'
-fi
-
-# Delay if needed for USB hardware
-sdelay
-
-# Start device manager
-start_dev_mgr
-
-# Start iSCSI
-startiscsi
-
-# let iscsid settle - otherwise mounting the iSCSI-disk will fail (very rarely, though)
-sleep 1
-
-# Setup md device nodes if they dont exist
-setup_md_device
-
-# Scan volumes
-startVolumes
-
-setup_keymap
-
-# Initialize LUKS root device except for livecd's
-if [ "${CDROOT}" != 1 ]
-then
- startLUKS
- if [ "${NORESUME}" != '1' ] && [ -n "${REAL_RESUME}" ]
- then
- case "${REAL_RESUME}" in
- LABEL\=*|UUID\=*)
-
- RESUME_DEV=""
- retval=1
-
- if [ "${retval}" -ne '0' ]; then
- RESUME_DEV=`findfs "${REAL_RESUME}" 2>/dev/null`
- retval=$?
- fi
-
- if [ "$retval" -ne '0' ]; then
- RESUME_DEV=`busybox findfs "${REAL_RESUME}" 2>/dev/null`
- retval=$?
- fi
-
- if [ "${retval}" -ne '0' ]; then
- RESUME_DEV=`blkid -t "${REAL_RESUME}" | cut -d ":" -f 1 2>/dev/null`
- retval=$?
- fi
-
- if [ "${retval}" -eq '0' ] && [ -n "${RESUME_DEV}" ]; then
- good_msg "Detected real_resume=${RESUME_DEV}"
- REAL_RESUME="${RESUME_DEV}"
- fi
- ;;
- esac
-
- do_resume
- fi
-fi
-
-mkdir -p "${NEW_ROOT}"
-CHROOT="${NEW_ROOT}"
-
-# Run debug shell if requested
-rundebugshell
-
-if [ "${CDROOT}" = '1' ]
-then
- good_msg "Making tmpfs for ${NEW_ROOT}"
- mount -n -t tmpfs tmpfs "${NEW_ROOT}"
-
- for i in dev mnt mnt/cdrom mnt/livecd mnt/key tmp tmp/.initrd mnt/gentoo sys
- do
- mkdir -p "${NEW_ROOT}/${i}"
- chmod 755 "${NEW_ROOT}/${i}"
- done
- [ ! -e "${NEW_ROOT}/dev/null" ] && mknod "${NEW_ROOT}"/dev/null c 1 3
- [ ! -e "${NEW_ROOT}/dev/console" ] && mknod "${NEW_ROOT}"/dev/console c 5 1
-
- # For SGI LiveCDs ...
- if [ "${LOOPTYPE}" = "sgimips" ]
- then
- [ ! -e "${NEW_ROOT}/dev/sr0" ] && mknod "${NEW_ROOT}/dev/sr0" b 11 0
- [ ! -e "${NEW_ROOT}/dev/loop0" ] && mknod "${NEW_ROOT}/dev/loop0" b 7 0
- fi
-
- # Required for splash to work. Not an issue with the initrd as this
- # device isn't created there and is not needed.
- if [ -e /dev/tty1 ]
- then
- [ ! -e "${NEW_ROOT}/dev/tty1" ] && mknod "${NEW_ROOT}/dev/tty1" c 4 1
- fi
-
- if [ "${REAL_ROOT}" != "/dev/nfs" ] && [ "${LOOPTYPE}" != "sgimips" ]
- then
- bootstrapCD
- fi
-
- if [ "${REAL_ROOT}" = '' ]
- then
- echo -n -e "${WARN}>>${NORMAL}${BOLD} No bootable medium found. Waiting for new devices"
-
- COUNTER=0
- while [ ${COUNTER} -lt 3 ]; do
- sleep 3
- echo -n '.'
- let COUNTER=${COUNTER}+1
- done
-
- sleep 1
- echo -e "${NORMAL}"
- bootstrapCD
- fi
-
- if [ "${REAL_ROOT}" = '' ]
- then
- # Undo stuff
- umount "${NEW_ROOT}/dev" 2>/dev/null
- umount "${NEW_ROOT}/sys" 2>/dev/null
- umount /sys 2>/dev/null
-
- umount "${NEW_ROOT}"
- rm -rf "${NEW_ROOT}/*"
-
- bad_msg 'Could not find CD to boot, something else needed!'
- CDROOT=0
- fi
-fi
-
-# Determine root device
-good_msg 'Determining root device...'
-while true
-do
- while [ "${got_good_root}" != '1' ]
- do
- case "${REAL_ROOT}" in
- LABEL\=*|UUID\=*)
-
- ROOT_DEV=""
- retval=1
-
- if [ "${retval}" -ne '0' ]; then
- ROOT_DEV=`findfs "${REAL_ROOT}" 2>/dev/null`
- retval=$?
- fi
-
- if [ "$retval" -ne '0' ]; then
- ROOT_DEV=`busybox findfs "${REAL_ROOT}" 2>/dev/null`
- retval=$?
- fi
-
- if [ "${retval}" -ne '0' ]; then
- ROOT_DEV=`blkid -t "${REAL_ROOT}" | cut -d ":" -f 1 2>/dev/null`
- retval=$?
- fi
-
- if [ "${retval}" -eq '0' ] && [ -n "${ROOT_DEV}" ]; then
- good_msg "Detected real_root=${ROOT_DEV}"
- REAL_ROOT="${ROOT_DEV}"
- else
- whereis "REAL_ROOT" "root block device"
- got_good_root=0
- continue
- fi
- ;;
- esac
-
- if [ "${REAL_ROOT}" = '' ]
- then
- # No REAL_ROOT determined/specified. Prompt user for root block device.
- whereis "REAL_ROOT" "root block device"
- got_good_root=0
-
- # Check for a block device or /dev/nfs
- elif [ -b "${REAL_ROOT}" ] || [ "${REAL_ROOT}" = "/dev/nfs" ]
- then
- got_good_root=1
-
- else
- bad_msg "Block device ${REAL_ROOT} is not a valid root device..."
- REAL_ROOT=""
- got_good_root=0
- fi
- done
-
-
- if [ "${CDROOT}" = 1 -a "${got_good_root}" = '1' -a "${REAL_ROOT}" != "/dev/nfs" ]
- then
- # CD already mounted; no further checks necessary
- break
- elif [ "${LOOPTYPE}" = "sgimips" ]
- then
- # sgimips mounts the livecd root partition directly
- # there is no isofs filesystem to worry about
- break
- else
- good_msg "Mounting root..."
-
- # Try to mount the device as ${NEW_ROOT}
- if [ "${REAL_ROOT}" = '/dev/nfs' ]; then
- findnfsmount
- else
- # mount ro so fsck doesn't barf later
- if [ "${REAL_ROOTFLAGS}" = '' ]; then
- mount -o ro ${REAL_ROOT} ${NEW_ROOT}
- else
- good_msg "Using mount -o ro,${REAL_ROOTFLAGS}"
- mount -o ro,${REAL_ROOTFLAGS} ${REAL_ROOT} ${NEW_ROOT}
- fi
- fi
-
- # If mount is successful break out of the loop
- # else not a good root and start over.
- if [ "$?" = '0' ]
- then
- if [ -d ${NEW_ROOT}/dev -a -x ${NEW_ROOT}/sbin/init ] || [ "${REAL_ROOT}" = "/dev/nfs" ]
- then
- break
- else
- bad_msg "The filesystem mounted at ${REAL_ROOT} does not appear to be a valid /, try again"
- got_good_root=0
- REAL_ROOT=''
- fi
- else
- bad_msg "Could not mount specified ROOT, try again"
- got_good_root=0
- REAL_ROOT=''
- fi
- fi
-done
-# End determine root device
-
-#verbose_kmsg
-
-# If CD root is set determine the looptype to boot
-if [ "${CDROOT}" = '1' ]
-then
- good_msg 'Determining looptype ...'
- cd "${NEW_ROOT}"
-
- # Find loop and looptype
- [ -z "${LOOP}" ] && find_loop
- [ -z "${LOOPTYPE}" ] && find_looptype
-
- cache_cd_contents
-
- # If encrypted, find key and mount, otherwise mount as usual
- if [ -n "${CRYPT_ROOT}" ]
- then
- CRYPT_ROOT_KEY="$(head -n 1 ${NEW_ROOT}/mnt/cdrom/livecd)"
- CRYPT_ROOT='/dev/loop0'
- good_msg 'You booted an encrypted livecd' "${CRYPT_SILENT}"
-
- losetup /dev/loop0 "${NEW_ROOT}/mnt/cdrom/${LOOPEXT}${LOOP}"
- test_success 'Preparing loop filesystem'
-
- startLUKS
-
- case ${LOOPTYPE} in
- normal)
- MOUNTTYPE="ext2"
- ;;
- *)
- MOUNTTYPE="${LOOPTYPE}"
- ;;
- esac
- mount -t "${MOUNTTYPE}" -o ro /dev/mapper/root "${NEW_ROOT}/mnt/livecd"
- test_success 'Mount filesystem'
- FS_LOCATION='mnt/livecd'
- # Setup the loopback mounts, if unencrypted
- else
- if [ "${LOOPTYPE}" = 'normal' ]
- then
- good_msg 'Mounting loop filesystem'
- mount -t ext2 -o loop,ro "${NEW_ROOT}/mnt/cdrom/${LOOPEXT}${LOOP}" "${NEW_ROOT}/mnt/livecd"
- test_success 'Mount filesystem'
- FS_LOCATION='mnt/livecd'
- elif [ "${LOOPTYPE}" = 'squashfs' ]
- then
- good_msg 'Mounting squashfs filesystem'
- mount -t squashfs -o loop,ro "${NEW_ROOT}/mnt/cdrom/${LOOPEXT}${LOOP}" "${NEW_ROOT}/mnt/livecd"
- test_success 'Mount filesystem'
- FS_LOCATION='mnt/livecd'
- elif [ "${LOOPTYPE}" = 'gcloop' ]
- then
- good_msg 'Mounting gcloop filesystem'
- echo ' ' | losetup -E 19 -e ucl-0 -p0 "${NEW_ROOT}/dev/loop0" "${NEW_ROOT}/mnt/cdrom/${LOOPEXT}${LOOP}"
- test_success 'losetup the loop device'
-
- mount -t ext2 -o ro "${NEW_ROOT}/dev/loop0" "${NEW_ROOT}/mnt/livecd"
- test_success 'Mount the losetup loop device'
- FS_LOCATION='mnt/livecd'
- elif [ "${LOOPTYPE}" = 'zisofs' ]
- then
- FS_LOCATION="mnt/cdrom/${LOOPEXT}${LOOP}"
- elif [ "${LOOPTYPE}" = 'noloop' ]
- then
- FS_LOCATION='mnt/cdrom'
- elif [ "${LOOPTYPE}" = 'sgimips' ]
- then
- # getdvhoff finds the starting offset (in bytes) of the squashfs
- # partition on the cdrom and returns this offset for losetup
- #
- # All currently supported SGI Systems use SCSI CD-ROMs, so
- # so we know that the CD-ROM is usually going to be /dev/sr0.
- #
- # We use the value given to losetup to set /dev/loop0 to point
- # to the liveCD root partition, and then mount /dev/loop0 as
- # the LiveCD rootfs
- good_msg 'Locating the SGI LiveCD Root Partition'
- echo ' ' | \
- losetup -o $(getdvhoff "${NEW_ROOT}${REAL_ROOT}" 0) \
- "${NEW_ROOT}${CDROOT_DEV}" \
- "${NEW_ROOT}${REAL_ROOT}"
- test_success 'losetup /dev/sr0 /dev/loop0'
-
- good_msg 'Mounting the Root Partition'
- mount -t squashfs -o ro "${NEW_ROOT}${CDROOT_DEV}" "${NEW_ROOT}/mnt/livecd"
- test_success 'mount /dev/loop0 /'
- FS_LOCATION='mnt/livecd'
- fi
- fi
-
-
-
- # Unpacking additional packages from NFS mount
- # This is useful for adding kernel modules to /lib
- # We do this now, so that additional packages can add whereever they want.
- if [ "${REAL_ROOT}" = '/dev/nfs' ]
- then
- if [ -e "${NEW_ROOT}/mnt/cdrom/add" ]
- then
- for targz in `ls ${NEW_ROOT}/mnt/cdrom/add/*.tar.gz`
- do
- tarname=`basename ${targz}`
- good_msg "Adding additional package ${tarname}"
- (cd ${NEW_ROOT} ; /bin/tar -xzf ${targz})
- done
- fi
- fi
-
-
- if [ "${USE_UNIONFS_NORMAL}" = '1' ]
- then
- setup_unionfs ${NEW_ROOT} ${NEW_ROOT}/${FS_LOCATION}
- CHROOT=/union
- else
-
- good_msg "Copying read-write image contents to tmpfs"
- # Copy over stuff that should be writable
- (cd "${NEW_ROOT}/${FS_LOCATION}"; cp -a ${ROOT_TREES} "${NEW_ROOT}")
-
- # Now we do the links.
- for x in ${ROOT_LINKS}
- do
- if [ -L "${NEW_ROOT}/${FS_LOCATION}/${x}" ]
- then
- ln -s "`readlink ${NEW_ROOT}/${FS_LOCATION}/${x}`" "${x}" 2>/dev/null
- else
- # List all subdirectories of x
- find "${NEW_ROOT}/${FS_LOCATION}/${x}" -type d 2>/dev/null | while read directory
- do
- # Strip the prefix of the FS_LOCATION
- directory="${directory#${NEW_ROOT}/${FS_LOCATION}/}"
-
- # Skip this directory if we already linked a parent directory
- if [ "${current_parent}" != '' ]; then
- var=`echo "${directory}" | grep "^${current_parent}"`
- if [ "${var}" != '' ]; then
- continue
- fi
- fi
- # Test if the directory exists already
- if [ -e "/${NEW_ROOT}/${directory}" ]
- then
- # It does exist, link all the individual files
- for file in `ls /${NEW_ROOT}/${FS_LOCATION}/${directory}`
- do
- if [ ! -d "/${NEW_ROOT}/${FS_LOCATION}/${directory}/${file}" ] && [ ! -e "${NEW_ROOT}/${directory}/${file}" ]; then
- ln -s "/${FS_LOCATION}/${directory}/${file}" "${directory}/${file}" 2> /dev/null
- fi
- done
- else
- # It does not exist, make a link to the livecd
- ln -s "/${FS_LOCATION}/${directory}" "${directory}" 2>/dev/null
- current_parent="${directory}"
- fi
- done
- fi
- done
-
- if [ "${DO_slowusb}" ] || [ "${FORCE_slowusb}" ]
- then
- sleep 10
- fi
- mkdir initramfs proc tmp sys 2>/dev/null
- chmod 1777 tmp
-
- fi
-
- #UML=`cat /proc/cpuinfo|grep UML|sed -e 's|model name.*: ||'`
- #if [ "${UML}" = 'UML' ]
- #then
- # # UML Fixes
- # good_msg 'Updating for uml system'
- #fi
-
- # Let Init scripts know that we booted from CD
- export CDBOOT
- CDBOOT=1
- check_slowusb
- if [ "${DO_slowusb}" ] || [ "${FORCE_slowusb}" ]
- then
- sleep 10
- fi
-else
- if [ "${USE_UNIONFS_NORMAL}" = '1' ]
- then
- mkdir /union_changes
- mount -t tmpfs tmpfs /union_changes
- setup_unionfs /union_changes ${NEW_ROOT}
- mkdir -p ${UNION}/tmp/.initrd
- fi
-fi
-
-# Execute script on the cdrom just before boot to update things if necessary
-cdupdate
-
-if [ "${SUBDIR}" != '' -a -e "${CHROOT}/${SUBDIR}" ]
-then
- good_msg "Entering ${SUBDIR} to boot"
- CHROOT="${CHROOT}/${SUBDIR}"
-fi
-
-verbose_kmsg
-
-echo -ne "${GOOD}>>${NORMAL}${BOLD} Booting (initramfs)${NORMAL}"
-if [ ! -e "${CHROOT}/dev/console" ] || [ ! -e "${CHROOT}/dev/null" ]
-then
- echo -ne "${BAD}>>${NORMAL}${BOLD} ERROR: your real /dev is missing files required to boot (console and null)${NORMAL}"
-elif [ -e /etc/initrd.splash -a ! -e "${CHROOT}/dev/tty1" ]
-then
- echo -ne "${BAD}>>${NORMAL}${BOLD} ERROR: your real /dev is missing tty1, which is required for splash${NORMAL}"
-fi
-
-cd "${CHROOT}"
-mkdir "${CHROOT}/proc" "${CHROOT}/sys" 2>/dev/null
-echo -ne "${BOLD}.${NORMAL}"
-umount /sys || echo '*: Failed to unmount the ramdisk /sys!'
-umount /proc || echo '*: Failed to unmount the ramdisk /proc!'
-echo -e "${BOLD}.${NORMAL}"
-
-exec /sbin/switch_root -c "/dev/console" "${CHROOT}" "${REAL_INIT:-/sbin/init}" "${INIT_OPTS}"
-
-# If we get here, something bad has happened
-splash 'verbose'
-
-echo 'A fatal error has probably occured since /sbin/init did not'
-echo 'boot correctly. Trying to open a shell...'
-echo
-exec /bin/bash
-exec /bin/sh
-exec /bin/ash
-exec sh
diff --git a/defaults/modprobe b/defaults/modprobe
deleted file mode 100755
index 8790122..0000000
--- a/defaults/modprobe
+++ /dev/null
@@ -1,144 +0,0 @@
-#!/bin/ash
-# Apparently, this is required for proper functionality with busybox 1.1.3
-# Check out bug #197730 for more details.
-
-. /etc/initrd.defaults
-
-usage() {
- echo 'Usage:'
- echo ' modprobe moduleprefix'
- echo
- echo 'Example:'
- echo ' modprobe eepro100'
- echo
- echo 'Note: Do not pass the suffix to modprobe!'
- exit 1
-}
-
-# Pass module name to this function
-modules_dep_list() {
- if [ "$#" -lt '1' ]
- then
- echo 'modules_dep_list(): Improper usage!'
- exit 1
- fi
- cat /lib/modules/${KV}/modules.dep | grep /"${1}${KSUFF}:" | cut -d':' -f2
-}
-
-
-# Pass module deps list
-strip_mod_paths() {
- local x
- local ret
- local myret
-
- [ "$#" -lt '1' ] && return
-
- for x in ${*}
- do
- ret=`basename ${x} | cut -d. -f1`
- myret="${myret} ${ret}"
- done
- echo "${myret}"
-}
-
-LOADED_MODULES=''
-is_module_already_loaded() {
- local x
- if [ "$#" != '1' ]
- then
- echo 'is_module_already_loaded(): Improper usage!'
- fi
-
- for x in ${LOADED_MODULES}
- do
- if [ "${x}" = "${1}" ]
- then
- # Yep, module is loaded
- return 0
- fi
- done
- return 1
-}
-
-real_mod_path() {
- # Find -name is no good since the return status is always zero
- find "/lib/modules/${KV}" | grep /"${1}${KSUFF}"
-}
-
-modprobe2() {
- local x
- local deps
- local real_path
- local modlist
- local ret
-
- local echoAppend
- local echoFlags
-
- if [ "$#" -lt '1' ]
- then
- usage
- exit 1
- fi
- real_path=`real_mod_path ${1}`
- if [ "${real_path}" = '' -o "${real_path}" = ' ' ]
- then
- [ "${2}" = '-n' ] && echo -n " -> $1"
- echo ' module not found.'
- exit 2
- fi
- modlist=`modules_dep_list ${1}`
- if [ "${modlist}" != '' -a "${modlist}" != ' ' ]
- then
- deps=`strip_mod_paths ${modlist}`
- else
- deps=''
- fi
- # Make sure we don't do any endless loops!
-
- LOADED_MODULES="${LOADED_MODULES} ${1}"
- for x in ${deps}
- do
- if ! is_module_already_loaded ${x}
- then
- if [ "${x}" != '' -a "${x}" != ' ' ]
- then
- modprobe2 "${x}" -n
- fi
- else
- filler=1
- fi
- done
- ${INSMOD} ${real_path} > /dev/null 2>&1
- ret=$?
- if [ "$ret" -eq '0' ]
- then
- echoAppend=' loaded.'
- [ "${2}" = '-n' ] && echoFlags='-n' && echoAppend=', '
- echo ${echoFlags} "${1}${echoAppend}"
- fi
- return $ret
-}
-
-if [ "$#" -lt '1' ]
-then
- usage
-fi
-
-[ -f '/modules.cache' ] || touch /modules.cache
-for x in `cat /modules.cache`
-do
- LOADED_MODULES="${LOADED_MODULES} ${x}"
-done
-
-modprobe2 ${1}
-modprobe_ret=$?
-
-[ -f '/modules.cache' ] && rm -f /modules.cache > /dev/null 2>&1
-for x in ${LOADED_MODULES}
-do
- echo $x >> /modules.cache
-done
-
-exit $modprobe_ret
diff --git a/defaults/udhcpc.scripts b/defaults/udhcpc.scripts
deleted file mode 100755
index 53aa2cc..0000000
--- a/defaults/udhcpc.scripts
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/bin/sh
-
-[ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1
-
-case ${1} in
- renew|bound)
- [ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
- [ -n "$subnet" ] && NETMASK="netmask $subnet"
- [ -n "$rootpath" ] && echo "$rootpath" > /rootpath
- [ -n "$hostname" ] && hostname ${hostname}
-
- busybox ifconfig $interface $ip $BROADCAST $NETMASK
- if [ -n "${router}" ]
- then
- while route del default gw 0.0.0.0 dev $interface; do
- :
- done
-
- for i in ${router}
- do
- busybox route add default gw ${i}
- done
- fi
- [ -n "$domain" ] && echo "domain ${domain}" >> /etc/resolv.conf
- if [ -n "${dns}" ]
- then
- for i in ${dns}
- do
- echo "nameserver ${i}" >> /etc/resolv.conf
- done
- fi
- ;;
- deconfig)
- busybox ifconfig $interface 0.0.0.0
- ;;
-esac
-
diff --git a/gen_arch.sh b/gen_arch.sh
index 079edb2..f4401ca 100755
--- a/gen_arch.sh
+++ b/gen_arch.sh
@@ -27,22 +27,6 @@ get_official_arch() {
fi
fi
- if [ "${CMD_UTILS_ARCH}" != '' ]
- then
- UTILS_ARCH=${CMD_UTILS_ARCH}
- else
- if [ "${UTILS_ARCH}" != '' ]
- then
- UTILS_ARCH=${UTILS_ARCH}
- fi
- fi
-
- # sparc64 klibc is b0rked, so we force to 32
- if [ "${ARCH}" = 'sparc64' ]
- then
- UTILS_ARCH='sparc'
- fi
-
ARCH_CONFIG="${GK_SHARE}/arch/${ARCH}/config.sh"
[ -f "${ARCH_CONFIG}" ] || gen_die "${ARCH} not yet supported by genkernel. Please add the arch-specific config file, ${ARCH_CONFIG}"
}
diff --git a/gen_bootloader.sh b/gen_bootloader.sh
index 9b1deef..320685d 100755
--- a/gen_bootloader.sh
+++ b/gen_bootloader.sh
@@ -63,15 +63,10 @@ set_bootloader_grub() {
# Add grub configuration to grub.conf
echo "# Genkernel generated entry, see GRUB documentation for details" >> ${GRUB_CONF}
echo "title=Gentoo Linux ($KV)" >> ${GRUB_CONF}
- if [ "${BUILD_INITRD}" -eq '0' ]
+ echo -e "\tkernel /kernel-${KNAME}-${ARCH}-${KV} root=${GRUB_ROOTFS}" >> ${GRUB_CONF}
+ if [ "${BUILD_INITRD}" -eq '1' ]
then
- echo -e "\tkernel /kernel-${KNAME}-${ARCH}-${KV} root=${GRUB_ROOTFS}" >> ${GRUB_CONF}
- else
- echo -e "\tkernel /kernel-${KNAME}-${ARCH}-${KV} root=/dev/ram0 init=/linuxrc real_root=${GRUB_ROOTFS}" >> ${GRUB_CONF}
- if [ "${PAT}" -gt '4' ]
- then
- echo -e "\tinitrd /initramfs-${KNAME}-${ARCH}-${KV}" >> ${GRUB_CONF}
- fi
+ echo -e "\tinitrd /initramfs-${KNAME}-${ARCH}-${KV}" >> ${GRUB_CONF}
fi
echo >> ${GRUB_CONF}
else
diff --git a/gen_cmdline.sh b/gen_cmdline.sh
index d711dd8..5842246 100755
--- a/gen_cmdline.sh
+++ b/gen_cmdline.sh
@@ -38,7 +38,6 @@ longusage() {
echo " --no-install Do not install the kernel after building"
echo " --symlink Manage symlinks in /boot for installed images"
echo " --no-symlink Do not manage symlinks"
- echo " --no-ramdisk-modules Don't copy any modules to the ramdisk"
echo " --callback=<...> Run the specified arguments after the"
echo " kernel and modules have been compiled"
echo " --static Build a static (monolithic kernel)."
@@ -53,81 +52,70 @@ longusage() {
echo " --kernel-ld=<linker> Linker to use for kernel"
echo " --kernel-cross-compile=<cross var> CROSS_COMPILE kernel variable"
echo " --kernel-make=<makeprg> GNU Make to use for kernel"
- echo " --utils-cc=<compiler> Compiler to use for utilities"
- echo " --utils-as=<assembler> Assembler to use for utils"
- echo " --utils-ld=<linker> Linker to use for utils"
- echo " --utils-make=<makeprog> GNU Make to use for utils"
- echo " --utils-cross-compile=<cross var> CROSS_COMPILE utils variable"
- echo " --utils-arch=<arch> Force to arch for utils only instead of"
- echo " autodetect."
echo " --makeopts=<makeopts> Make options such as -j2, etc..."
echo " --mountboot Mount BOOTDIR automatically if mountable"
echo " --no-mountboot Don't mount BOOTDIR automatically"
echo " --bootdir=<dir> Set the location of the boot-directory, default is /boot"
echo " Initialization"
echo " --bootloader=grub Add new kernel to GRUB configuration"
- echo " --dmraid Include DMRAID support"
- echo " --iscsi Include iSCSI support"
- echo " --luks Include LUKS support"
- echo " --> 'emerge cryptsetup-luks' with USE=-dynamic"
- echo " --lvm Include LVM support"
- echo " --mdadm Copy /etc/mdadm.conf to initramfs"
- echo " (obsolete with Dracut; use --mdraid)"
- echo " --multipath Include Multipath support"
- echo " Internal engine"
- echo " --all-ramdisk-modules Copy all kernel modules to the ramdisk"
- echo " --do-keymap-auto Forces keymap selection at boot"
- echo " --no-keymap Disables keymap selection support"
- echo " --splash Enable framebuffer splash using default theme"
- echo " --splash=<theme> Enable framebuffer splash using <theme>"
- echo " --splash-res=<res> Select splash theme resolutions to install"
- echo " --no-splash Do not install framebuffer splash"
- echo " --evms Include EVMS support"
- echo " --> 'emerge evms' in the host operating system"
- echo " first"
- echo " --slowusb Enables extra pauses for slow USB CD boots"
- echo " --no-busybox Do not include busybox in the initramfs."
- echo " --unionfs Include EXPERIMENTAL support for unionfs"
- echo " --netboot Create a self-contained env in the initramfs"
- echo " --real-root=<foo> Specify a default for real_root="
- echo " --linuxrc=<file> Specifies a user created linuxrc"
- echo " --busybox-config=<file> Specifies a user created busybox config"
- echo " --disklabel Include disk label and uuid support in your"
- echo " ramdisk"
echo " Dracut engine"
- echo " --no-dracut Build system using old internal engine"
- echo " (will be removed in the future)"
+ echo " --add-modules=<modules list>"
+ echo " Additional Dracut modules;"
+ echo " see /usr/share/dracut/modules.d for possible"
+ echo " values; separate modules by space, e.g.:"
+ echo " --add-modules=\"lvm crypt nfs\""
+ echo " --auto Rely on Dracut system check instead of"
+ echo " specifying modules by hand"
+ echo " --crypt Include LUKS support"
+ echo " --> 'emerge cryptsetup-luks'"
+ echo " --no-ramdisk-modules Don't copy any modules to the ramdisk"
+ echo " --dmraid Include DMRAID support"
echo " --dracut-dir=<dir> Directory of Dracut sources; if given Dracut"
echo " is run in local mode (see description of '-l'"
echo " in 'man 8 dracut'); script changes current"
echo " directory to <dir>, so don't use relative"
echo " paths then"
- echo " --auto Rely on Dracut system check instead of"
- echo " specifying modules by hand"
- echo " --generic Build generic initramfs instead of"
- echo " default hostonly. Notice that generic => huge"
- echo " --mdraid Include RAID support via mdadm"
- echo " --gensplash Enable framebuffer splash (splashutils);"
+ echo " --evms Include EVMS support"
+ echo " --> 'emerge evms' in the host operating system"
+ echo " first"
+ echo " --extra-options=<options>"
+ echo " Pass extra options to dracut;"
+ echo " see 'man 8 dracut'"
+ echo " --fbsplash Enable framebuffer splash (splashutils);"
echo " set up in /etc/conf.d/splash"
- echo " --gensplash=<theme>[:<res>]"
+ echo " --fbsplash=<theme>[:<res>]"
echo " Enable framebuffer splash using <theme>"
echo " and optionally select splash theme resolutions"
echo " to install; <res> is comma-separated list of"
echo " resolutions"
- echo " --no-gensplash Do not install framebuffer splash"
- echo " --gensplash-no8bpp Ignore 8bpp gensplash images (can save a lot of"
+ echo " --fbsplash-no8bpp Ignore 8 bpp splash images (can save a lot of"
echo " space)"
+ echo " --fbsplash-res=<res>"
+ echo " Splash theme resolutions to install; <res> is"
+ echo " comma-separated list of resolutions"
+ echo " --firmware"
+ echo " Enable copying of firmware into initramfs"
+ echo " --firmware-dir=<dir>"
+ echo " Specify directory to copy firmware from (defaults"
+ echo " to /lib/firmware)"
+ echo " --firmware-files=<files>"
+ echo " Specifies specific firmware files to copy. This"
+ echo " overrides --firmware-dir. For multiple files,"
+ echo " separate the filenames with a comma"
+ echo " --generic Build generic initramfs instead of"
+ echo " default hostonly. Notice that generic => huge"
+ echo " --initramfs-overlay=<dir>"
+ echo " Directory structure to include in the initramfs,"
+ echo " only available on 2.6 kernels"
+ echo " --iscsi Include iSCSI support"
+ echo " --lvm Include LVM support"
+ echo " --mdraid Include RAID support via mdadm"
+ echo " --multipath Include Multipath support"
+ echo " --no-fbsplash Do not install framebuffer splash"
echo " --plymouth Enable EXPERIMENTAL Plymouth splash; set up"
echo " configuration in /etc/plymouth/plymouthd.conf"
echo " requires >=plymouth-0.8.3 to be installed"
- echo " --add-modules=<modules list>"
- echo " Additional Dracut modules;"
- echo " see /usr/share/dracut/modules.d for possible"
- echo " values; separate modules by space, e.g.:"
- echo " --add-modules=\"lvm crypt nfs\""
- echo " --extra-options=<options>"
- echo " Pass extra options to dracut;"
- echo " see 'man 8 dracut'"
+ echo " --unionfs Include EXPERIMENTAL support for unionfs"
echo " Internals"
echo " --arch-override=<arch> Force to arch instead of autodetect"
echo " --cachedir=<dir> Override the default cache location"
@@ -149,18 +137,6 @@ longusage() {
echo " --no-kernel-sources This option is only valid if kerncache is"
echo " defined. If there is a valid kerncache no checks"
echo " will be made against a kernel source tree"
- echo " --initramfs-overlay=<dir>"
- echo " Directory structure to include in the initramfs,"
- echo " only available on 2.6 kernels"
- echo " --firmware"
- echo " Enable copying of firmware into initramfs"
- echo " --firmware-dir=<dir>"
- echo " Specify directory to copy firmware from (defaults"
- echo " to /lib/firmware)"
- echo " --firmware-files=<files>"
- echo " Specifies specific firmware files to copy. This"
- echo " overrides --firmware-dir. For multiple files,"
- echo " separate the filenames with a comma"
echo " --integrated-initramfs"
echo " Build the generated initramfs into the kernel instead of"
echo " keeping it as a separate file"
@@ -206,31 +182,6 @@ parse_cmdline() {
CMD_KERNEL_CROSS_COMPILE=$(echo ${CMD_KERNEL_CROSS_COMPILE}|sed -e 's/.*[^-]$/&-/g')
print_info 2 "CMD_KERNEL_CROSS_COMPILE: ${CMD_KERNEL_CROSS_COMPILE}"
;;
- --utils-cc=*)
- CMD_UTILS_CC=`parse_opt "$*"`
- print_info 2 "CMD_UTILS_CC: ${CMD_UTILS_CC}"
- ;;
- --utils-ld=*)
- CMD_UTILS_LD=`parse_opt "$*"`
- print_info 2 "CMD_UTILS_LD: ${CMD_UTILS_LD}"
- ;;
- --utils-as=*)
- CMD_UTILS_AS=`parse_opt "$*"`
- print_info 2 "CMD_UTILS_AS: ${CMD_UTILS_AS}"
- ;;
- --utils-make=*)
- CMD_UTILS_MAKE=`parse_opt "$*"`
- print_info 2 "CMD_UTILS_MAKE: ${CMD_UTILS_MAKE}"
- ;;
- --utils-cross-compile=*)
- CMD_UTILS_CROSS_COMPILE=`parse_opt "$*"`
- CMD_UTILS_CROSS_COMPILE=$(echo ${CMD_UTILS_CROSS_COMPILE}|sed -e 's/.*[^-]$/&-/g')
- print_info 2 "CMD_UTILS_CROSS_COMPILE: ${CMD_UTILS_CROSS_COMPILE}"
- ;;
- --utils-arch=*)
- CMD_UTILS_ARCH=`parse_opt "$*"`
- print_info 2 "CMD_UTILS_ARCH: ${CMD_ARCHOVERRIDE}"
- ;;
--makeopts=*)
CMD_MAKEOPTS=`parse_opt "$*"`
print_info 2 "CMD_MAKEOPTS: ${CMD_MAKEOPTS}"
@@ -247,55 +198,11 @@ parse_cmdline() {
CMD_BOOTDIR=`parse_opt "$*"`
print_info 2 "CMD_BOOTDIR: ${CMD_BOOTDIR}"
;;
- --lvm)
- CMD_LVM=1
- print_info 2 "CMD_LVM: ${CMD_LVM}"
- ;;
- --lvm2)
- CMD_LVM=1
- print_info 2 "CMD_LVM: ${CMD_LVM}"
- echo
- print_warning 1 "Please use --lvm, as --lvm2 is deprecated."
- ;;
- --mdadm)
- if ! [[ "${CMD_DRACUT}" = '0' ]] && ! [[ $* =~ --no-dracut ]]; then
- CMD_MDRAID=1
- print_info 2 "CMD_MDRAID: $CMD_MDRAID"
- echo
- print_warning 1 "Please use --mdraid, as --mdadm is obsolete."
- else
- CMD_MDADM=1
- print_info 2 "CMD_MDADM: $CMD_MDADM"
- fi
- ;;
- --dmraid)
- if [ ! -e /usr/include/libdevmapper.h ]
- then
- echo 'Error: --dmraid requires device-mapper to be installed'
- echo ' on the host system; try "emerge device-mapper".'
- exit 1
- fi
- CMD_DMRAID=1
- print_info 2 "CMD_DMRAID: ${CMD_DMRAID}"
- ;;
- --multipath)
- if [ ! -e /usr/include/libdevmapper.h ]
- then
- echo 'Error: --multipath requires device-mapper to be installed'
- echo ' on the host;system; try "emerge device-mapper".'
- exit 1
- fi
- CMD_MULTIPATH=1
- print_info 2 "CMD_MULTIPATH: ${CMD_MULTIPATH}"
- ;;
+
--bootloader=*)
CMD_BOOTLOADER=`parse_opt "$*"`
print_info 2 "CMD_BOOTLOADER: ${CMD_BOOTLOADER}"
;;
- --iscsi)
- CMD_ISCSI=1
- print_info 2 "CMD_ISCSI: ${CMD_ISCSI}"
- ;;
--loglevel=*)
CMD_LOGLEVEL=`parse_opt "$*"`
LOGLEVEL="${CMD_LOGLEVEL}"
@@ -363,10 +270,6 @@ parse_cmdline() {
CMD_NOINSTALL=1
print_info 2 "CMD_NOINSTALL: ${CMD_NOINSTALL}"
;;
- --no-ramdisk-modules)
- CMD_NORAMDISKMODULES=1
- print_info 2 "CMD_NORAMDISKMODULES: ${CMD_NORAMDISKMODULES}"
- ;;
--callback=*)
CMD_CALLBACK=`parse_opt "$*"`
print_info 2 "CMD_CALLBACK: ${CMD_CALLBACK}/$*"
@@ -449,10 +352,6 @@ parse_cmdline() {
CMD_NO_KERNEL_SOURCES=1
print_info 2 "CMD_NO_KERNEL_SOURCES: ${CMD_NO_KERNEL_SOURCES}"
;;
- --initramfs-overlay=*)
- CMD_INITRAMFS_OVERLAY=`parse_opt "$*"`
- print_info 2 "CMD_INITRAMFS_OVERLAY: ${CMD_INITRAMFS_OVERLAY}"
- ;;
--genzimage)
KERNEL_MAKE_DIRECTIVE_2='zImage.initrd'
KERNEL_BINARY_2='arch/powerpc/boot/zImage.initrd'
@@ -460,168 +359,125 @@ parse_cmdline() {
# ENABLE_PEGASOS_HACKS="yes"
# print_info 2 "ENABLE_PEGASOS_HACKS: ${ENABLE_PEGASOS_HACKS}"
;;
- --luks)
- if ! [[ "${CMD_DRACUT}" = '0' ]] && ! [[ $* =~ --no-dracut ]]; then
- CMD_CRYPT=1
- print_info 2 "CMD_CRYPT: ${CMD_CRYPT}"
- echo
- print_warning 1 "Please use --crypt, as --luks is obsolete."
- else
- CMD_LUKS=1
- print_info 2 "CMD_LUKS: ${CMD_LUKS}"
- fi
- ;;
- --firmware)
- CMD_FIRMWARE=1
- print_info 2 "CMD_FIRMWARE: ${CMD_FIRMWARE}"
- ;;
- --firmware-dir=*)
- CMD_FIRMWARE_DIR=`parse_opt "$*"`
- CMD_FIRMWARE=1
- print_info 2 "CMD_FIRMWARE_DIR: ${CMD_FIRMWARE_DIR}"
- ;;
- --firmware-files=*)
- CMD_FIRMWARE_FILES=`parse_opt "$*"`
- CMD_FIRMWARE=1
- print_info 2 "CMD_FIRMWARE_FILES: ${CMD_FIRMWARE_FILES}"
- ;;
- --integrated-initramfs)
- CMD_INTEGRATED_INITRAMFS=1
- print_info 2 "CMD_INTEGRATED_INITRAMFS=${CMD_INTEGRATED_INITRAMFS}"
- ;;
--config=*)
print_info 2 "CMD_GK_CONFIG: `parse_opt "$*"`"
;;
--local)
;;
- # Internal engine
- --no-busybox)
- CMD_BUSYBOX=0
- print_info 2 "CMD_BUSYBOX: ${CMD_BUSYBOX}"
- ;;
- --unionfs)
- CMD_UNIONFS=1
- print_info 2 "CMD_UNIONFS: ${CMD_UNIONFS}"
- ;;
- --netboot)
- CMD_NETBOOT=1
- print_info 2 "CMD_NETBOOT: ${CMD_NETBOOT}"
- ;;
- --real-root=*)
- CMD_REAL_ROOT=`parse_opt "$*"`
- print_info 2 "CMD_REAL_ROOT: ${CMD_REAL_ROOT}"
+ # Dracut engine
+ --auto)
+ CMD_AUTO=1
+ print_info 2 "CMD_AUTO: ${CMD_AUTO}"
;;
- --slowusb)
- CMD_SLOWUSB=1
- print_info 2 "CMD_SLOWUSB: ${CMD_SLOWUSB}"
+ --crypt|--luks)
+ CMD_CRYPT=1
+ print_info 2 "CMD_CRYPT: ${CMD_CRYPT}"
;;
- --do-keymap-auto)
- CMD_DOKEYMAPAUTO=1
- CMD_KEYMAP=1
- print_info 2 "CMD_DOKEYMAPAUTO: ${CMD_DOKEYMAPAUTO}"
+ --dmraid)
+ if [ ! -e /usr/include/libdevmapper.h ]
+ then
+ echo 'Error: --dmraid requires device-mapper to be installed'
+ echo ' on the host system; try "emerge device-mapper".'
+ exit 1
+ fi
+ CMD_DMRAID=1
+ print_info 2 "CMD_DMRAID: ${CMD_DMRAID}"
;;
- --no-keymap)
- CMD_KEYMAP=0
- print_info 2 "CMD_KEYMAP: ${CMD_KEYMAP}"
+ --dracut-dir=*)
+ CMD_DRACUT_DIR=`parse_opt "$*"`
+ print_info 2 "CMD_DRACUT_DIR: ${CMD_DRACUT_DIR}"
;;
--evms)
CMD_EVMS=1
print_info 2 "CMD_EVMS: ${CMD_EVMS}"
;;
- --evms2)
- CMD_EVMS=1
- print_info 2 "CMD_EVMS: ${CMD_EVMS}"
- echo
- print_warning 1 "Please use --evms, as --evms2 is deprecated."
- ;;
- --disklabel)
- CMD_DISKLABEL=1
- print_info 2 "CMD_DISKLABEL: ${CMD_DISKLABEL}"
+ --extra-options=*)
+ CMD_EXTRA_OPTIONS=`parse_opt "$*"`
+ print_info 2 "CMD_EXTRA_OPTIONS: ${CMD_EXTRA_OPTIONS}"
;;
- --all-ramdisk-modules)
- CMD_ALLRAMDISKMODULES=1
- print_info 2 "CMD_ALLRAMDISKMODULES: ${CMD_ALLRAMDISKMODULES}"
+ --fbsplash|--gensplash|--splash)
+ CMD_GENSPLASH=1
+ print_info 2 "CMD_GENSPLASH: ${CMD_GENSPLASH}"
;;
- --linuxrc=*)
- CMD_LINUXRC=`parse_opt "$*"`
- print_info 2 "CMD_LINUXRC: ${CMD_LINUXRC}"
+ --fbsplash=*|--gensplash=*|--splash=*)
+ CMD_GENSPLASH=1
+ tmp=`parse_opt "$*"`
+ GENSPLASH_THEME=${tmp%%:*}
+ print_info 2 "GENSPLASH: ${GENSPLASH}"
+ print_info 2 "GENSPLASH_THEME: ${GENSPLASH_THEME}"
+ [[ ${tmp} =~ : ]] && {
+ GENSPLASH_RES=${tmp#*:}
+ print_info 2 "GENSPLASH_RES: ${GENSPLASH_RES}"
+ }
;;
- --busybox-config=*)
- CMD_BUSYBOX_CONFIG=`parse_opt "$*"`
- print_info 2 "CMD_BUSYBOX_CONFIG: ${CMD_BUSYBOX_CONFIG}"
+ --fbsplash-res=*|--gensplash=*|--splash=*)
+ GENSPLASH_RES=`parse_opt "$*"`
+ print_info 2 "GENSPLASH_RES: ${GENSPLASH_RES}"
;;
- --splash=*)
- CMD_SPLASH=1
- SPLASH_THEME=`parse_opt "$*"`
- print_info 2 "CMD_SPLASH: ${CMD_SPLASH}"
- print_info 2 "SPLASH_THEME: ${SPLASH_THEME}"
+ --firmware)
+ CMD_FIRMWARE=1
+ print_info 2 "CMD_FIRMWARE: ${CMD_FIRMWARE}"
;;
- --splash)
- CMD_SPLASH=1
- SPLASH_THEME='default'
- print_info 2 "CMD_SPLASH: ${CMD_SPLASH}"
+ --firmware-dir=*)
+ CMD_FIRMWARE_DIR=`parse_opt "$*"`
+ CMD_FIRMWARE=1
+ print_info 2 "CMD_FIRMWARE_DIR: ${CMD_FIRMWARE_DIR}"
;;
- --no-splash)
- CMD_SPLASH=0
- print_info 2 "CMD_SPLASH: ${CMD_SPLASH}"
+ --firmware-files=*)
+ CMD_FIRMWARE_FILES=`parse_opt "$*"`
+ CMD_FIRMWARE=1
+ print_info 2 "CMD_FIRMWARE_FILES: ${CMD_FIRMWARE_FILES}"
;;
- --splash-res=*)
- SPLASH_RES=`parse_opt "$*"`
- print_info 2 "SPLASH_RES: ${SPLASH_RES}"
+ --generic)
+ CMD_GENERIC=1
+ print_info 2 "CMD_GENERIC: ${CMD_GENERIC}"
;;
-
- # Dracut engine
- --no-dracut)
- CMD_DRACUT=0
- print_info 2 "CMD_DRACUT: ${CMD_DRACUT}"
+ --initramfs-overlay=*)
+ CMD_INITRAMFS_OVERLAY=`parse_opt "$*"`
+ print_info 2 "CMD_INITRAMFS_OVERLAY: ${CMD_INITRAMFS_OVERLAY}"
;;
- --dracut-dir=*)
- CMD_DRACUT_DIR=`parse_opt "$*"`
- print_info 2 "CMD_DRACUT_DIR: ${CMD_DRACUT_DIR}"
+ --integrated-initramfs)
+ CMD_INTEGRATED_INITRAMFS=1
+ print_info 2 "CMD_INTEGRATED_INITRAMFS=${CMD_INTEGRATED_INITRAMFS}"
;;
- --auto)
- CMD_AUTO=1
- print_info 2 "CMD_AUTO: ${CMD_AUTO}"
+ --iscsi)
+ CMD_ISCSI=1
+ print_info 2 "CMD_ISCSI: ${CMD_ISCSI}"
;;
- --generic)
- CMD_GENERIC=1
- print_info 2 "CMD_GENERIC: ${CMD_GENERIC}"
+ --lvm)
+ CMD_LVM=1
+ print_info 2 "CMD_LVM: ${CMD_LVM}"
;;
- --mdraid)
+ --mdraid|--mdadm)
CMD_MDRAID=1
print_info 2 "CMD_MDRAID: ${CMD_MDRAID}"
;;
- --crypt)
- CMD_CRYPT=1
- print_info 2 "CMD_CRYPT: ${CMD_CRYPT}"
+ --multipath)
+ if [ ! -e /usr/include/libdevmapper.h ]
+ then
+ echo 'Error: --multipath requires device-mapper to be installed'
+ echo ' on the host;system; try "emerge device-mapper".'
+ exit 1
+ fi
+ CMD_MULTIPATH=1
+ print_info 2 "CMD_MULTIPATH: ${CMD_MULTIPATH}"
;;
- --gensplash)
- CMD_GENSPLASH=1
+ --no-fbsplash|--no-gensplash|--no-splash)
+ CMD_GENSPLASH=0
print_info 2 "CMD_GENSPLASH: ${CMD_GENSPLASH}"
;;
- --gensplash=*)
- CMD_GENSPLASH=1
- tmp=`parse_opt "$*"`
- GENSPLASH_THEME=${tmp%%:*}
- print_info 2 "GENSPLASH: ${GENSPLASH}"
- print_info 2 "GENSPLASH_THEME: ${GENSPLASH_THEME}"
- [[ ${tmp} =~ : ]] && {
- GENSPLASH_RES=${tmp#*:}
- print_info 2 "GENSPLASH_RES: ${GENSPLASH_RES}"
- }
+ --no-ramdisk-modules)
+ CMD_NORAMDISKMODULES=1
+ print_info 2 "CMD_NORAMDISKMODULES: ${CMD_NORAMDISKMODULES}"
;;
--plymouth)
CMD_PLYMOUTH=1
print_info 2 "CMD_PLYMOUTH: ${CMD_PLYMOUTH}"
;;
- --add-modules=*)
- CMD_ADD_MODULES=`parse_opt "$*"`
- print_info 2 "CMD_ADD_MODULES: ${CMD_ADD_MODULES}"
- ;;
- --extra-options=*)
- CMD_EXTRA_OPTIONS=`parse_opt "$*"`
- print_info 2 "CMD_EXTRA_OPTIONS: ${CMD_EXTRA_OPTIONS}"
+ --unionfs)
+ CMD_UNIONFS=1
+ print_info 2 "CMD_UNIONFS: ${CMD_UNIONFS}"
;;
all)
diff --git a/gen_compile.sh b/gen_compile.sh
index 7bab9e1..d59fa86 100755
--- a/gen_compile.sh
+++ b/gen_compile.sh
@@ -29,82 +29,7 @@ compile_kernel_args() {
echo -n "${ARGS}"
}
-compile_utils_args()
-{
- local ARGS
- ARGS=''
-
- if [ -n "${UTILS_CROSS_COMPILE}" ]
- then
- UTILS_CC="${UTILS_CROSS_COMPILE}gcc"
- UTILS_LD="${UTILS_CROSS_COMPILE}ld"
- UTILS_AS="${UTILS_CROSS_COMPILE}as"
- fi
-
- if [ "${UTILS_ARCH}" != '' ]
- then
- ARGS="ARCH=\"${UTILS_ARCH}\""
- fi
- if [ "${UTILS_CC}" != '' ]
- then
- ARGS="CC=\"${UTILS_CC}\""
- fi
- if [ "${UTILS_LD}" != '' ]
- then
- ARGS="${ARGS} LD=\"${UTILS_LD}\""
- fi
- if [ "${UTILS_AS}" != '' ]
- then
- ARGS="${ARGS} AS=\"${UTILS_AS}\""
- fi
-
- echo -n "${ARGS}"
-}
-
-export_utils_args()
-{
- save_args
- if [ "${UTILS_ARCH}" != '' ]
- then
- export ARCH="${UTILS_ARCH}"
- fi
- if [ "${UTILS_CC}" != '' ]
- then
- export CC="${UTILS_CC}"
- fi
- if [ "${UTILS_LD}" != '' ]
- then
- export LD="${UTILS_LD}"
- fi
- if [ "${UTILS_AS}" != '' ]
- then
- export AS="${UTILS_AS}"
- fi
-}
-
-unset_utils_args()
-{
- if [ "${UTILS_ARCH}" != '' ]
- then
- unset ARCH
- fi
- if [ "${UTILS_CC}" != '' ]
- then
- unset CC
- fi
- if [ "${UTILS_LD}" != '' ]
- then
- unset LD
- fi
- if [ "${UTILS_AS}" != '' ]
- then
- unset AS
- fi
- reset_args
-}
-
-export_kernel_args()
-{
+export_kernel_args() {
if [ "${KERNEL_CC}" != '' ]
then
export CC="${KERNEL_CC}"
@@ -123,8 +48,7 @@ export_kernel_args()
fi
}
-unset_kernel_args()
-{
+unset_kernel_args() {
if [ "${KERNEL_CC}" != '' ]
then
unset CC
@@ -142,8 +66,8 @@ unset_kernel_args()
unset CROSS_COMPILE
fi
}
-save_args()
-{
+
+save_args() {
if [ "${ARCH}" != '' ]
then
export ORIG_ARCH="${ARCH}"
@@ -165,8 +89,8 @@ save_args()
export ORIG_CROSS_COMPILE="${CROSS_COMPILE}"
fi
}
-reset_args()
-{
+
+reset_args() {
if [ "${ORIG_ARCH}" != '' ]
then
export ARCH="${ORIG_ARCH}"
@@ -335,331 +259,3 @@ compile_kernel() {
fi
fi
}
-
-compile_busybox() {
- [ -f "${BUSYBOX_SRCTAR}" ] ||
- gen_die "Could not find busybox source tarball: ${BUSYBOX_SRCTAR}!"
-
- if [ -n "${BUSYBOX_CONFIG}" ]
- then
- [ -f "${BUSYBOX_CONFIG}" ] ||
- gen_die "Could not find busybox config file: ${BUSYBOX_CONFIG}"
- elif isTrue "${NETBOOT}" && [ -f "$(arch_replace "${GK_SHARE}/arch/%%ARCH%%/netboot-busy-config")" ]
- then
- BUSYBOX_CONFIG="$(arch_replace "${GK_SHARE}/arch/%%ARCH%%/netboot-busy-config")"
- elif isTrue "${NETBOOT}" && [ -f "${GK_SHARE}/netboot/busy-config" ]
- then
- BUSYBOX_CONFIG="${GK_SHARE}/netboot/busy-config"
- elif [ -f "$(arch_replace "${GK_SHARE}/arch/%%ARCH%%/busy-config")" ]
- then
- BUSYBOX_CONFIG="$(arch_replace "${GK_SHARE}/arch/%%ARCH%%/busy-config")"
- elif [ -f "${GK_SHARE}/defaults/busy-config" ]
- then
- BUSYBOX_CONFIG="${GK_SHARE}/defaults/busy-config"
- else
- gen_die "Could not find a busybox config file"
- fi
-
- # Delete cache if stored config's MD5 does not match one to be used
- if [ -f "${BUSYBOX_BINCACHE}" ]
- then
- oldconfig_md5=$(tar -xjf "${BUSYBOX_BINCACHE}" -O .config.gk_orig 2>/dev/null | md5sum)
- newconfig_md5=$(md5sum < "${BUSYBOX_CONFIG}")
- if [ "${oldconfig_md5}" != "${newconfig_md5}" ]
- then
- print_info 1 "busybox: >> Removing stale cache..."
- rm -rf "${BUSYBOX_BINCACHE}"
- else
- print_info 1 "busybox: >> Using cache"
- fi
- fi
-
- if [ ! -f "${BUSYBOX_BINCACHE}" ]
- then
- cd "${TEMP}"
- rm -rf "${BUSYBOX_DIR}" > /dev/null
- /bin/tar -jxpf ${BUSYBOX_SRCTAR} ||
- gen_die 'Could not extract busybox source tarball!'
- [ -d "${BUSYBOX_DIR}" ] ||
- gen_die 'Busybox directory ${BUSYBOX_DIR} is invalid!'
- cp "${BUSYBOX_CONFIG}" "${BUSYBOX_DIR}/.config"
- cp "${BUSYBOX_CONFIG}" "${BUSYBOX_DIR}/.config.gk_orig"
- cd "${BUSYBOX_DIR}"
- apply_patches busybox ${BUSYBOX_VER}
- print_info 1 'busybox: >> Configuring...'
- yes '' 2>/dev/null | compile_generic oldconfig utils
-
- print_info 1 'busybox: >> Compiling...'
- compile_generic all utils
- print_info 1 'busybox: >> Copying to cache...'
- [ -f "${TEMP}/${BUSYBOX_DIR}/busybox" ] ||
- gen_die 'Busybox executable does not exist!'
- strip "${TEMP}/${BUSYBOX_DIR}/busybox" ||
- gen_die 'Could not strip busybox binary!'
- tar -cj -C "${TEMP}/${BUSYBOX_DIR}" -f "${BUSYBOX_BINCACHE}" busybox .config .config.gk_orig ||
- gen_die 'Could not create the busybox bincache!'
-
- cd "${TEMP}"
- rm -rf "${BUSYBOX_DIR}" > /dev/null
- fi
-}
-
-compile_lvm() {
- compile_device_mapper
- if [ ! -f "${LVM_BINCACHE}" ]
- then
- [ -f "${LVM_SRCTAR}" ] ||
- gen_die "Could not find LVM source tarball: ${LVM_SRCTAR}! Please place it there, or place another version, changing /etc/genkernel.conf as necessary!"
- cd "${TEMP}"
- rm -rf ${LVM_DIR} > /dev/null
- /bin/tar -zxpf ${LVM_SRCTAR} ||
- gen_die 'Could not extract LVM source tarball!'
- [ -d "${LVM_DIR}" ] ||
- gen_die 'LVM directory ${LVM_DIR} is invalid!'
- rm -rf "${TEMP}/device-mapper" > /dev/null
- /bin/tar -jxpf "${DEVICE_MAPPER_BINCACHE}" -C "${TEMP}" ||
- gen_die "Could not extract device-mapper binary cache!";
-
- cd "${LVM_DIR}"
- print_info 1 'lvm: >> Configuring...'
- LDFLAGS="-L${TEMP}/device-mapper/lib" \
- CFLAGS="-I${TEMP}/device-mapper/include" \
- CPPFLAGS="-I${TEMP}/device-mapper/include" \
- ./configure --enable-static_link --prefix=${TEMP}/lvm >> ${LOGFILE} 2>&1 ||
- gen_die 'Configure of lvm failed!'
- print_info 1 'lvm: >> Compiling...'
- compile_generic '' utils
- compile_generic 'install' utils
-
- cd "${TEMP}/lvm"
- print_info 1 ' >> Copying to bincache...'
- strip "sbin/lvm.static" ||
- gen_die 'Could not strip lvm.static!'
- /bin/tar -cjf "${LVM_BINCACHE}" sbin/lvm.static ||
- gen_die 'Could not create binary cache'
-
- cd "${TEMP}"
- rm -rf "${TEMP}/device-mapper" > /dev/null
- rm -rf "${LVM_DIR}" lvm
- fi
-}
-
-compile_dmraid() {
- compile_device_mapper
- if [ ! -f "${DMRAID_BINCACHE}" ]
- then
- [ -f "${DMRAID_SRCTAR}" ] ||
- gen_die "Could not find DMRAID source tarball: ${DMRAID_SRCTAR}! Please place it there, or place another version, changing /etc/genkernel.conf as necessary!"
- cd "${TEMP}"
- rm -rf ${DMRAID_DIR} > /dev/null
- /bin/tar -jxpf ${DMRAID_SRCTAR} ||
- gen_die 'Could not extract DMRAID source tarball!'
- [ -d "${DMRAID_DIR}" ] ||
- gen_die 'DMRAID directory ${DMRAID_DIR} is invalid!'
- rm -rf "${TEMP}/device-mapper" > /dev/null
- /bin/tar -jxpf "${DEVICE_MAPPER_BINCACHE}" -C "${TEMP}" ||
- gen_die "Could not extract device-mapper binary cache!";
-
- cd "${DMRAID_DIR}"
- print_info 1 'dmraid: >> Configuring...'
-
- LDFLAGS="-L${TEMP}/device-mapper/lib" \
- CFLAGS="-I${TEMP}/device-mapper/include" \
- CPPFLAGS="-I${TEMP}/device-mapper/include" \
- ./configure --enable-static_link --prefix=${TEMP}/dmraid >> ${LOGFILE} 2>&1 ||
- gen_die 'Configure of dmraid failed!'
-
- # We dont necessarily have selinux installed yet... look into
- # selinux global support in the future.
- sed -i tools/Makefile -e "s|DMRAIDLIBS += -lselinux||g"
- ###echo "DMRAIDLIBS += -lselinux -lsepol" >> tools/Makefile
- mkdir -p "${TEMP}/dmraid"
- print_info 1 'dmraid: >> Compiling...'
- # Force dmraid to be built with -j1 for bug #188273
- MAKEOPTS=-j1 compile_generic '' utils
- #compile_generic 'install' utils
- mkdir ${TEMP}/dmraid/sbin
- install -m 0755 -s tools/dmraid "${TEMP}/dmraid/sbin/dmraid"
- print_info 1 ' >> Copying to bincache...'
- cd "${TEMP}/dmraid"
- /bin/tar -cjf "${DMRAID_BINCACHE}" sbin/dmraid ||
- gen_die 'Could not create binary cache'
-
- cd "${TEMP}"
- rm -rf "${TEMP}/device-mapper" > /dev/null
- rm -rf "${DMRAID_DIR}" dmraid
- fi
-}
-
-compile_device_mapper() {
- if [ ! -f "${DEVICE_MAPPER_BINCACHE}" ]
- then
- [ ! -f "${DEVICE_MAPPER_SRCTAR}" ] &&
- gen_die "Could not find device-mapper source tarball: ${DEVICE_MAPPER_SRCTAR}. Please place it there, or place another version, changing /etc/genkernel.conf as necessary!"
- cd "${TEMP}"
- rm -rf "${DEVICE_MAPPER_DIR}"
- /bin/tar -zxpf "${DEVICE_MAPPER_SRCTAR}"
- [ ! -d "${DEVICE_MAPPER_DIR}" ] &&
- gen_die "device-mapper directory ${DEVICE_MAPPER_DIR} invalid"
- cd "${DEVICE_MAPPER_DIR}"
- ./configure --prefix=${TEMP}/device-mapper --enable-static_link \
- --disable-selinux >> ${LOGFILE} 2>&1 ||
- gen_die 'Configuring device-mapper failed!'
- print_info 1 'device-mapper: >> Compiling...'
- compile_generic '' utils
- compile_generic 'install' utils
- print_info 1 ' >> Copying to cache...'
- cd "${TEMP}"
- rm -rf "${TEMP}/device-mapper/man" ||
- gen_die 'Could not remove manual pages!'
- strip "${TEMP}/device-mapper/sbin/dmsetup" ||
- gen_die 'Could not strip dmsetup binary!'
- /bin/tar -jcpf "${DEVICE_MAPPER_BINCACHE}" device-mapper ||
- gen_die 'Could not tar up the device-mapper binary!'
- [ -f "${DEVICE_MAPPER_BINCACHE}" ] ||
- gen_die 'device-mapper cache not created!'
- cd "${TEMP}"
- rm -rf "${DEVICE_MAPPER_DIR}" > /dev/null
- rm -rf "${TEMP}/device-mapper" > /dev/null
- fi
-}
-
-compile_e2fsprogs() {
- if [ ! -f "${BLKID_BINCACHE}" ]
- then
- [ ! -f "${E2FSPROGS_SRCTAR}" ] &&
- gen_die "Could not find e2fsprogs source tarball: ${E2FSPROGS_SRCTAR}. Please place it there, or place another version, changing /etc/genkernel.conf as necessary!"
- cd "${TEMP}"
- rm -rf "${E2FSPROGS_DIR}"
- tar -zxpf "${E2FSPROGS_SRCTAR}"
- [ ! -d "${E2FSPROGS_DIR}" ] &&
- gen_die "e2fsprogs directory ${E2FSPROGS_DIR} invalid"
- cd "${E2FSPROGS_DIR}"
- print_info 1 'e2fsprogs: >> Configuring...'
- ./configure --with-ldopts=-static >> ${LOGFILE} 2>&1 ||
- gen_die 'Configuring e2fsprogs failed!'
- print_info 1 'e2fsprogs: >> Compiling...'
- MAKE=${UTILS_MAKE} compile_generic "" ""
- print_info 1 'blkid: >> Copying to cache...'
- [ -f "${TEMP}/${E2FSPROGS_DIR}/misc/blkid" ] ||
- gen_die 'Blkid executable does not exist!'
- strip "${TEMP}/${E2FSPROGS_DIR}/misc/blkid" ||
- gen_die 'Could not strip blkid binary!'
- bzip2 "${TEMP}/${E2FSPROGS_DIR}/misc/blkid" ||
- gen_die 'bzip2 compression of blkid failed!'
- mv "${TEMP}/${E2FSPROGS_DIR}/misc/blkid.bz2" "${BLKID_BINCACHE}" ||
- gen_die 'Could not copy the blkid binary to the package directory, does the directory exist?'
-
- cd "${TEMP}"
- rm -rf "${E2FSPROGS_DIR}" > /dev/null
- fi
-}
-
-compile_fuse() {
- if [ ! -f "${FUSE_BINCACHE}" ]
- then
- [ ! -f "${FUSE_SRCTAR}" ] &&
- gen_die "Could not find fuse source tarball: ${FUSE_SRCTAR}. Please place it there, or place another version, changing /etc/genkernel.conf as necessary!"
- cd "${TEMP}"
- rm -rf "${FUSE_DIR}"
- tar -zxpf "${FUSE_SRCTAR}"
- [ ! -d "${FUSE_DIR}" ] &&
- gen_die "fuse directory ${FUSE_DIR} invalid"
- cd "${FUSE_DIR}"
- print_info 1 'fuse: >> Configuring...'
- ./configure --disable-kernel-module --disable-example >> ${LOGFILE} 2>&1 ||
- gen_die 'Configuring fuse failed!'
- print_info 1 'fuse: >> Compiling...'
- MAKE=${UTILS_MAKE} compile_generic "" ""
-
- # Since we're linking statically against libfuse, we don't need to cache the .so
-# print_info 1 'libfuse: >> Copying to cache...'
-# [ -f "${TEMP}/${FUSE_DIR}/lib/.libs/libfuse.so" ] ||
-# gen_die 'libfuse.so does not exist!'
-# strip "${TEMP}/${FUSE_DIR}/lib/.libs/libfuse.so" ||
-# gen_die 'Could not strip libfuse.so!'
-# cd "${TEMP}/${FUSE_DIR}/lib/.libs"
-# tar -cjf "${FUSE_BINCACHE}" libfuse*so* ||
-# gen_die 'Could not create fuse bincache!'
-
- cd "${TEMP}"
-# rm -rf "${FUSE_DIR}" > /dev/null
- fi
-}
-
-compile_unionfs_fuse() {
- if [ ! -f "${UNIONFS_FUSE_BINCACHE}" ]
- then
-
- # We'll call compile_fuse() from here, since it's not needed directly by anything else
- compile_fuse
-
- [ ! -f "${UNIONFS_FUSE_SRCTAR}" ] &&
- gen_die "Could not find unionfs-fuse source tarball: ${UNIONFS_FUSE_SRCTAR}. Please place it there, or place another version, changing /etc/genkernel.conf as necessary!"
- cd "${TEMP}"
- rm -rf "${UNIONFS_FUSE_DIR}"
- tar -jxpf "${UNIONFS_FUSE_SRCTAR}"
- [ ! -d "${UNIONFS_FUSE_DIR}" ] &&
- gen_die "unionfs-fuse directory ${UNIONFS_FUSE_DIR} invalid"
- cd "${UNIONFS_FUSE_DIR}"
- print_info 1 'unionfs-fuse: >> Compiling...'
- sed -i "/^\(CFLAGS\|CPPFLAGS\)/s:^\\(.*\\)$:\\1 -static -I${TEMP}/${FUSE_DIR}/include -L${TEMP}/${FUSE_DIR}/lib/.libs:" Makefile src/Makefile
- sed -i "/^LIB = /s:^LIB = \(.*\)$:LIB = -static -L${TEMP}/${FUSE_DIR}/lib/.libs \1 -ldl -lrt:" Makefile src/Makefile
- MAKE=${UTILS_MAKE} compile_generic "" ""
- print_info 1 'unionfs-fuse: >> Copying to cache...'
- [ -f "${TEMP}/${UNIONFS_FUSE_DIR}/src/unionfs" ] ||
- gen_die 'unionfs binary does not exist!'
- strip "${TEMP}/${UNIONFS_FUSE_DIR}/src/unionfs" ||
- gen_die 'Could not strip unionfs binary!'
- bzip2 "${TEMP}/${UNIONFS_FUSE_DIR}/src/unionfs" ||
- gen_die 'bzip2 compression of unionfs binary failed!'
- mv "${TEMP}/${UNIONFS_FUSE_DIR}/src/unionfs.bz2" "${UNIONFS_FUSE_BINCACHE}" ||
- gen_die 'Could not copy the unionfs binary to the package directory, does the directory exist?'
-
- cd "${TEMP}"
- rm -rf "${UNIONFS_FUSE_DIR}" > /dev/null
- fi
-}
-
-compile_iscsi() {
- if [ ! -f "${ISCSI_BINCACHE}" ]
- then
- [ ! -f "${ISCSI_SRCTAR}" ] &&
- gen_die "Could not find iSCSI source tarball: ${ISCSI_SRCTAR}. Please place it there, or place another version, changing /etc/genkernel.conf as necessary!"
- cd "${TEMP}"
- rm -rf "${ISCSI_DIR}"
- tar -zxpf "${ISCSI_SRCTAR}"
- [ ! -d "${ISCSI_DIR}" ] &&
- gen_die "ISCSI directory ${ISCSI_DIR} invalid"
- print_info 1 'iSCSI: >> Compiling...'
- cd "${TEMP}/${ISCSI_DIR}"
-
- # Only build userspace
- MAKE=${UTILS_MAKE} compile_generic "user" ""
-
- # if kernel modules exist, copy them to initramfs, otherwise it will be compiled into the kernel
- mkdir -p "${TEMP}/initramfs-iscsi-temp/lib/modules/${RELEASE}/kernel/drivers/scsi/"
- for modname in iscsi_tcp libiscsi scsi_transport_iscsi
- do
- if [ -e "${CMD_KERNEL_DIR}/drivers/scsi/${modname}.ko" ]
- then
- cp ${CMD_KERNEL_DIR}/drivers/scsi/${modname}.ko "${TEMP}/initramfs-iscsi-temp/lib/modules/${RELEASE}/kernel/drivers/scsi/"
- fi
- done
-
- cd "${TEMP}/initramfs-iscsi-temp/"
- print_info 1 'iscsistart: >> Copying to cache...'
- [ -f "${TEMP}/${ISCSI_DIR}/usr/iscsistart" ] ||
- gen_die 'iscsistart executable does not exist!'
- strip "${TEMP}/${ISCSI_DIR}/usr/iscsistart" ||
- gen_die 'Could not strip iscsistart binary!'
- bzip2 "${TEMP}/${ISCSI_DIR}/usr/iscsistart" ||
- gen_die 'bzip2 compression of iscsistart failed!'
- mv "${TEMP}/${ISCSI_DIR}/usr/iscsistart.bz2" "${ISCSI_BINCACHE}" ||
- gen_die 'Could not copy the iscsistart binary to the package directory, does the directory exist?'
-
- cd "${TEMP}"
- rm -rf "${ISCSI_DIR}" > /dev/null
- fi
-}
-
diff --git a/gen_configkernel.sh b/gen_configkernel.sh
index 8c00f8d..f86411f 100755
--- a/gen_configkernel.sh
+++ b/gen_configkernel.sh
@@ -113,7 +113,7 @@ config_kernel() {
sed -i ${KERNEL_DIR}/.config -e 's/CONFIG_SCSI_ISCSI_ATTRS=y/CONFIG_SCSI_ISCSI_ATTRS=m/g'
fi
- if isTrue ${SPLASH}
+ if isTrue ${GENSPLASH}
then
sed -i ${KERNEL_DIR}/.config -e 's/#\? \?CONFIG_FB_SPLASH is.*/CONFIG_FB_SPLASH=y/g'
fi
diff --git a/gen_determineargs.sh b/gen_determineargs.sh
index 69f0ff8..7cd27dd 100755
--- a/gen_determineargs.sh
+++ b/gen_determineargs.sh
@@ -61,6 +61,11 @@ get_KV() {
determine_real_args() {
print_info 4 "Resolving config file, command line, and arch default settings."
+ set_config_alias MDADM MDRAID
+ set_config_alias LUKS CRYPT
+ set_config_alias SPLASH GENSPLASH
+ set_config_alias FBSPLASH GENSPLASH
+
# Config File Command Line Arch Default
# ----------- ------------ ------------
set_config_with_override 2 DEBUGFILE CMD_DEBUGFILE
@@ -70,19 +75,13 @@ determine_real_args() {
set_config_with_override 2 MAKEOPTS CMD_MAKEOPTS "$DEFAULT_MAKEOPTS"
set_config_with_override 2 KERNEL_MAKE CMD_KERNEL_MAKE "$DEFAULT_KERNEL_MAKE"
- set_config_with_override 2 UTILS_MAKE CMD_UTILS_MAKE "$DEFAULT_UTILS_MAKE"
set_config_with_override 2 KERNEL_CC CMD_KERNEL_CC "$DEFAULT_KERNEL_CC"
set_config_with_override 2 KERNEL_LD CMD_KERNEL_LD "$DEFAULT_KERNEL_LD"
set_config_with_override 2 KERNEL_AS CMD_KERNEL_AS "$DEFAULT_KERNEL_AS"
- set_config_with_override 2 UTILS_CC CMD_UTILS_CC "$DEFAULT_UTILS_CC"
- set_config_with_override 2 UTILS_LD CMD_UTILS_LD "$DEFAULT_UTILS_LD"
- set_config_with_override 2 UTILS_AS CMD_UTILS_AS "$DEFAULT_UTILS_AS"
set_config_with_override 2 KERNEL_CROSS_COMPILE CMD_KERNEL_CROSS_COMPILE
- set_config_with_override 2 UTILS_CROSS_COMPILE CMD_UTILS_CROSS_COMPILE
set_config_with_override 2 BOOTDIR CMD_BOOTDIR "/boot"
- set_config_with_override 1 SPLASH CMD_SPLASH
set_config_with_override 1 POSTCLEAR CMD_POSTCLEAR
set_config_with_override 1 MRPROPER CMD_MRPROPER
set_config_with_override 1 MENUCONFIG CMD_MENUCONFIG
@@ -92,7 +91,6 @@ determine_real_args() {
set_config_with_override 2 MODULESPACKAGE CMD_MODULESPACKAGE
set_config_with_override 2 KERNCACHE CMD_KERNCACHE
set_config_with_override 1 NORAMDISKMODULES CMD_NORAMDISKMODULES
- set_config_with_override 1 ALLRAMDISKMODULES CMD_ALLRAMDISKMODULES
set_config_with_override 2 INITRAMFS_OVERLAY CMD_INITRAMFS_OVERLAY
set_config_with_override 1 MOUNTBOOT CMD_MOUNTBOOT
set_config_with_override 1 BUILD_STATIC CMD_STATIC
@@ -104,25 +102,15 @@ determine_real_args() {
set_config_with_override 1 EVMS CMD_EVMS
set_config_with_override 1 DMRAID CMD_DMRAID
set_config_with_override 1 ISCSI CMD_ISCSI
- set_config_with_override 1 BUSYBOX CMD_BUSYBOX "yes"
set_config_with_override 1 UNIONFS CMD_UNIONFS
- set_config_with_override 1 NETBOOT CMD_NETBOOT
- set_config_with_override 2 REAL_ROOT CMD_REAL_ROOT
- set_config_with_override 1 DISKLABEL CMD_DISKLABEL
- set_config_with_override 1 LUKS CMD_LUKS
- set_config_with_override 1 MDADM CMD_MDADM
set_config_with_override 1 MULTIPATH CMD_MULTIPATH
set_config_with_override 1 FIRMWARE CMD_FIRMWARE
set_config_with_override 2 FIRMWARE_DIR CMD_FIRMWARE_DIR "/lib/firmware"
set_config_with_override 2 FIRMWARE_FILES CMD_FIRMWARE_FILES
set_config_with_override 1 INTEGRATED_INITRAMFS CMD_INTEGRATED_INITRAMFS
set_config_with_override 1 GENZIMAGE CMD_GENZIMAGE
- set_config_with_override 1 KEYMAP CMD_KEYMAP "yes"
- set_config_with_override 1 DOKEYMAPAUTO CMD_DOKEYMAPAUTO
- set_config_with_override 2 BUSYBOX_CONFIG CMD_BUSYBOX_CONFIG
set_config_with_override 1 AUTO CMD_AUTO
set_config_with_override 1 GENERIC CMD_GENERIC
- set_config_with_override 1 DRACUT CMD_DRACUT "yes"
set_config_with_override 2 DRACUT_DIR CMD_DRACUT_DIR
set_config_with_override 1 MDRAID CMD_MDRAID
set_config_with_override 1 CRYPT CMD_CRYPT
@@ -135,25 +123,9 @@ determine_real_args() {
BOOTDIR=${BOOTDIR%/} # Remove any trailing slash
CACHE_DIR=`arch_replace "${CACHE_DIR}"`
- BUSYBOX_BINCACHE=`cache_replace "${BUSYBOX_BINCACHE}"`
- DEVICE_MAPPER_BINCACHE=`cache_replace "${DEVICE_MAPPER_BINCACHE}"`
- LVM_BINCACHE=`cache_replace "${LVM_BINCACHE}"`
- DMRAID_BINCACHE=`cache_replace "${DMRAID_BINCACHE}"`
- ISCSI_BINCACHE=`cache_replace "${ISCSI_BINCACHE}"`
- BLKID_BINCACHE=`cache_replace "${BLKID_BINCACHE}"`
- FUSE_BINCACHE=`cache_replace "${FUSE_BINCACHE}"`
- UNIONFS_FUSE_BINCACHE=`cache_replace "${UNIONFS_FUSE_BINCACHE}"`
DEFAULT_KERNEL_CONFIG=`arch_replace "${DEFAULT_KERNEL_CONFIG}"`
BUSYBOX_CONFIG=`arch_replace "${BUSYBOX_CONFIG}"`
- BUSYBOX_BINCACHE=`arch_replace "${BUSYBOX_BINCACHE}"`
- DEVICE_MAPPER_BINCACHE=`arch_replace "${DEVICE_MAPPER_BINCACHE}"`
- LVM_BINCACHE=`arch_replace "${LVM_BINCACHE}"`
- DMRAID_BINCACHE=`arch_replace "${DMRAID_BINCACHE}"`
- ISCSI_BINCACHE=`arch_replace "${ISCSI_BINCACHE}"`
- BLKID_BINCACHE=`arch_replace "${BLKID_BINCACHE}"`
- FUSE_BINCACHE=`arch_replace "${FUSE_BINCACHE}"`
- UNIONFS_FUSE_BINCACHE=`arch_replace "${UNIONFS_FUSE_BINCACHE}"`
if [ -n "${CMD_BOOTLOADER}" ]
then
diff --git a/gen_dracut.sh b/gen_dracut.sh
index 1f58c47..22c5741 100755
--- a/gen_dracut.sh
+++ b/gen_dracut.sh
@@ -8,7 +8,7 @@ MODULES=lvm\ dmraid\ iscsi\ mdraid\ crypt\ multipath\ plymouth\ gensplash
dracut_modules() {
local a=() o=()
- isTrue "${PLYMOUTH}" && isTrue "${GENSPLASH}" && gen_die 'Gentoo Splash and Plymouth selected! You cannot choose both splash engines.'
+ isTrue "${PLYMOUTH}" && isTrue "${GENSPLASH}" && gen_die 'Framebuffer Splash and Plymouth selected! You cannot choose both splash engines.'
isTrue "${EVMS}" && gen_die 'EVMS is no longer supported. If you *really* need it, file a bug report and we bring it back to life.'
isTrue "${UNIONFS}" && gen_die 'UnionFS not yet supported.'
diff --git a/gen_funcs.sh b/gen_funcs.sh
index e4a1c4a..2569448 100755
--- a/gen_funcs.sh
+++ b/gen_funcs.sh
@@ -444,6 +444,7 @@ set_config_with_override() {
local CfgVar=$2
local OverrideVar=$3
local Default=$4
+ local CfgOldVar=$5
local Result
#
@@ -499,14 +500,14 @@ set_config_with_override() {
eval ${CfgVar}=\"${Result}\"
}
-check_distfiles() {
- for i in $BUSYBOX_SRCTAR $DEVICE_MAPPER_SRCTAR $MULTIPATH_SRCTAR $LVM_SRCTAR $DMRAID_SRCTAR $E2FSPROGS_SRCTAR $ISCSI_SRCTAR
- do
- if [ ! -f "${i}" ]
- then
- small_die "Could not find source tarball ${i}. Please refetch."
- fi
- done
+set_config_alias() {
+ local CfgOldVar=$1
+ local CfgVar=$2
+
+ if [ -n "${CfgVar}" -a -n "${CfgOldVar}" ]
+ then
+ eval "${CfgVar}='${!CfgOldVar}'"
+ fi
}
find_kernel_binary() {
diff --git a/gen_initramfs.sh b/gen_initramfs.sh
deleted file mode 100755
index 231411e..0000000
--- a/gen_initramfs.sh
+++ /dev/null
@@ -1,675 +0,0 @@
-#!/bin/bash
-# $Id$
-
-CPIO_ARGS="--quiet -o -H newc"
-
-append_base_layout() {
- if [ -d "${TEMP}/initramfs-base-temp" ]
- then
- rm -rf "${TEMP}/initramfs-base-temp" > /dev/null
- fi
-
- mkdir -p ${TEMP}/initramfs-base-temp/dev
- mkdir -p ${TEMP}/initramfs-base-temp/bin
- mkdir -p ${TEMP}/initramfs-base-temp/etc
- mkdir -p ${TEMP}/initramfs-base-temp/usr
- mkdir -p ${TEMP}/initramfs-base-temp/proc
- mkdir -p ${TEMP}/initramfs-base-temp/temp
- mkdir -p ${TEMP}/initramfs-base-temp/sys
- mkdir -p ${TEMP}/initramfs-temp/.initrd
- mkdir -p ${TEMP}/initramfs-base-temp/var/lock/dmraid
- mkdir -p ${TEMP}/initramfs-base-temp/sbin
- mkdir -p ${TEMP}/initramfs-base-temp/usr/bin
- mkdir -p ${TEMP}/initramfs-base-temp/usr/sbin
- ln -s lib ${TEMP}/initramfs-base-temp/lib64
-
- echo "/dev/ram0 / ext2 defaults 0 0" > ${TEMP}/initramfs-base-temp/etc/fstab
- echo "proc /proc proc defaults 0 0" >> ${TEMP}/initramfs-base-temp/etc/fstab
-
- cd ${TEMP}/initramfs-base-temp/dev
- mknod -m 660 console c 5 1
- mknod -m 660 null c 1 3
- mknod -m 600 tty1 c 4 1
-
- date '+%Y%m%d' > ${TEMP}/initramfs-base-temp/etc/build_date
-
- cd "${TEMP}/initramfs-base-temp/"
- find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}"
- cd "${TEMP}"
- rm -rf "${TEMP}/initramfs-base-temp" > /dev/null
-}
-
-append_busybox() {
- if [ -d "${TEMP}/initramfs-busybox-temp" ]
- then
- rm -rf "${TEMP}/initramfs-busybox-temp" > /dev/null
- fi
-
- mkdir -p "${TEMP}/initramfs-busybox-temp/bin/"
- tar -xjf "${BUSYBOX_BINCACHE}" -C "${TEMP}/initramfs-busybox-temp/bin" busybox ||
- gen_die 'Could not extract busybox bincache!'
- chmod +x "${TEMP}/initramfs-busybox-temp/bin/busybox"
-
- mkdir -p "${TEMP}/initramfs-busybox-temp/usr/share/udhcpc/"
- cp "${GK_SHARE}/defaults/udhcpc.scripts" ${TEMP}/initramfs-busybox-temp/usr/share/udhcpc/default.script
- chmod +x "${TEMP}/initramfs-busybox-temp/usr/share/udhcpc/default.script"
-
- # Set up a few default symlinks
- for i in '[' ash sh mount uname echo cut cat; do
- rm -f ${TEMP}/initramfs-busybox-temp/bin/$i > /dev/null
- ln -s busybox ${TEMP}/initramfs-busybox-temp/bin/$i ||
- gen_die "Busybox error: could not link ${i}!"
- done
-
- cd "${TEMP}/initramfs-busybox-temp/"
- find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}"
- cd "${TEMP}"
- rm -rf "${TEMP}/initramfs-busybox-temp" > /dev/null
-}
-
-append_blkid(){
- if [ -d "${TEMP}/initramfs-blkid-temp" ]
- then
- rm -r "${TEMP}/initramfs-blkid-temp/"
- fi
- cd ${TEMP}
- mkdir -p "${TEMP}/initramfs-blkid-temp/bin/"
- [ "${DISKLABEL}" -eq '1' ] && { /bin/bzip2 -dc "${BLKID_BINCACHE}" > "${TEMP}/initramfs-blkid-temp/bin/blkid" ||
- gen_die "Could not extract blkid binary cache!"; }
- chmod a+x "${TEMP}/initramfs-blkid-temp/bin/blkid"
- cd "${TEMP}/initramfs-blkid-temp/"
- find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}"
- cd "${TEMP}"
- rm -rf "${TEMP}/initramfs-blkid-temp" > /dev/null
-}
-
-#append_fuse() {
-# if [ -d "${TEMP}/initramfs-fuse-temp" ]
-# then
-# rm -r "${TEMP}/initramfs-fuse-temp"
-# fi
-# cd ${TEMP}
-# mkdir -p "${TEMP}/initramfs-fuse-temp/lib/"
-# tar -C "${TEMP}/initramfs-fuse-temp/lib/" -xjf "${FUSE_BINCACHE}"
-# cd "${TEMP}/initramfs-fuse-temp/"
-# find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}"
-# rm -rf "${TEMP}/initramfs-fuse-temp" > /dev/null
-#}
-
-append_unionfs_fuse() {
- if [ -d "${TEMP}/initramfs-unionfs-fuse-temp" ]
- then
- rm -r "${TEMP}/initramfs-unionfs-fuse-temp"
- fi
- cd ${TEMP}
- mkdir -p "${TEMP}/initramfs-unionfs-fuse-temp/sbin/"
- bzip2 -dc "${UNIONFS_FUSE_BINCACHE}" > "${TEMP}/initramfs-unionfs-fuse-temp/sbin/unionfs" ||
- gen_die 'Could not extract unionfs-fuse binary cache!'
- chmod a+x "${TEMP}/initramfs-unionfs-fuse-temp/sbin/unionfs"
- cd "${TEMP}/initramfs-unionfs-fuse-temp/"
- find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}"
- cd "${TEMP}"
- rm -rf "${TEMP}/initramfs-unionfs-fuse-temp" > /dev/null
-}
-
-#append_suspend(){
-# if [ -d "${TEMP}/initramfs-suspend-temp" ];
-# then
-# rm -r "${TEMP}/initramfs-suspend-temp/"
-# fi
-# print_info 1 'SUSPEND: Adding support (compiling binaries)...'
-# compile_suspend
-# mkdir -p "${TEMP}/initramfs-suspend-temp/"
-# /bin/tar -jxpf "${SUSPEND_BINCACHE}" -C "${TEMP}/initramfs-suspend-temp" ||
-# gen_die "Could not extract suspend binary cache!"
-# mkdir -p "${TEMP}/initramfs-suspend-temp/etc"
-# cp -f /etc/suspend.conf "${TEMP}/initramfs-suspend-temp/etc" ||
-# gen_die 'Could not copy /etc/suspend.conf'
-# cd "${TEMP}/initramfs-suspend-temp/"
-# find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}"
-# rm -r "${TEMP}/initramfs-suspend-temp/"
-#}
-
-append_multipath(){
- if [ -d "${TEMP}/initramfs-multipath-temp" ]
- then
- rm -r "${TEMP}/initramfs-multipath-temp"
- fi
- print_info 1 ' Multipath support being added'
- mkdir -p "${TEMP}/initramfs-multipath-temp/bin/"
- mkdir -p "${TEMP}/initramfs-multipath-temp/etc/"
- mkdir -p "${TEMP}/initramfs-multipath-temp/sbin/"
- mkdir -p "${TEMP}/initramfs-multipath-temp/lib/"
-
- # Copy files to /lib
- for i in /lib/{ld-*,libc-*,libc.*,libdl-*,libdl.*,libsysfs*so*,libdevmapper*so*,libpthread*,librt*,libreadline*,libncurses*}
- do
- cp -a "${i}" "${TEMP}/initramfs-multipath-temp/lib" \
- || gen_die "Could not copy file ${i} for MULTIPATH"
- done
-
- for i in /usr/lib/libaio*
- do
- cp -a "${i}" "${TEMP}/initramfs-multipath-temp/lib" \
- || gen_die "Could not copy file ${i} for MULTIPATH"
- done
-
- # Copy files to /sbin
- for i in /sbin/{multipath,kpartx,mpath_prio_*,devmap_name,dmsetup} /lib64/udev/scsi_id
- do
- cp -a "${i}" "${TEMP}/initramfs-multipath-temp/sbin" \
- || gen_die "Could not copy file ${i} for MULTIPATH"
- done
-
- # Copy files to /bin
- for i in /bin/mountpoint
- do
- cp -a "${i}" "${TEMP}/initramfs-multipath-temp/bin" \
- || gen_die "Could not copy file ${i} for MULTIPATH"
- done
-
- if [ -x /sbin/multipath ]
- then
- cp /etc/multipath.conf "${TEMP}/initramfs-multipath-temp/etc/" || gen_die 'could not copy /etc/multipath.conf please check this'
- fi
- # /etc/scsi_id.config does not exist in newer udevs
- # copy it optionally.
- if [ -x /sbin/scsi_id -a -f /etc/scsi_id.config ]
- then
- cp /etc/scsi_id.config "${TEMP}/initramfs-multipath-temp/etc/" || gen_die 'could not copy scsi_id.config'
- fi
- cd "${TEMP}/initramfs-multipath-temp"
- find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}"
- cd "${TEMP}"
- rm -r "${TEMP}/initramfs-multipath-temp/"
-}
-
-append_dmraid(){
- if [ -d "${TEMP}/initramfs-dmraid-temp" ]
- then
- rm -r "${TEMP}/initramfs-dmraid-temp/"
- fi
- print_info 1 'DMRAID: Adding support (compiling binaries)...'
- compile_dmraid
- mkdir -p "${TEMP}/initramfs-dmraid-temp/"
- /bin/tar -jxpf "${DMRAID_BINCACHE}" -C "${TEMP}/initramfs-dmraid-temp" ||
- gen_die "Could not extract dmraid binary cache!";
- cd "${TEMP}/initramfs-dmraid-temp/"
- RAID456=`find . -type f -name raid456.ko`
- if [ -n "${RAID456}" ]
- then
- cd "${RAID456/raid456.ko/}"
- ln -sf raid456.kp raid45.ko
- cd "${TEMP}/initramfs-dmraid-temp/"
- fi
- find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}"
- cd "${TEMP}"
- rm -r "${TEMP}/initramfs-dmraid-temp/"
-}
-
-append_iscsi(){
- if [ -d "${TEMP}/initramfs-iscsi-temp" ]
- then
- rm -r "${TEMP}/initramfs-iscsi-temp/"
- fi
- print_info 1 'iSCSI: Adding support (compiling binaries)...'
- compile_iscsi
- cd ${TEMP}
- mkdir -p "${TEMP}/initramfs-iscsi-temp/bin/"
- /bin/bzip2 -dc "${ISCSI_BINCACHE}" > "${TEMP}/initramfs-iscsi-temp/bin/iscsistart" ||
- gen_die "Could not extract iscsi binary cache!"
- chmod a+x "${TEMP}/initramfs-iscsi-temp/bin/iscsistart"
- cd "${TEMP}/initramfs-iscsi-temp/"
- find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}"
- cd "${TEMP}"
- rm -rf "${TEMP}/initramfs-iscsi-temp" > /dev/null
-}
-
-append_lvm(){
- if [ -d "${TEMP}/initramfs-lvm-temp" ]
- then
- rm -r "${TEMP}/initramfs-lvm-temp/"
- fi
- cd ${TEMP}
- mkdir -p "${TEMP}/initramfs-lvm-temp/bin/"
- mkdir -p "${TEMP}/initramfs-lvm-temp/etc/lvm/"
- if [ -e '/sbin/lvm.static' ]
- then
- print_info 1 ' LVM: Adding support (using local static binaries)...'
- cp /sbin/lvm.static "${TEMP}/initramfs-lvm-temp/bin/lvm" ||
- gen_die 'Could not copy over lvm!'
- elif [ -e '/sbin/lvm' ] && LC_ALL="C" ldd /sbin/lvm|grep -q 'not a dynamic executable'
- then
- print_info 1 ' LVM: Adding support (using local static binaries)...'
- cp /sbin/lvm "${TEMP}/initramfs-lvm-temp/bin/lvm" ||
- gen_die 'Could not copy over lvm!'
- else
- print_info 1 ' LVM: Adding support (compiling binaries)...'
- compile_lvm
- /bin/tar -jxpf "${LVM_BINCACHE}" -C "${TEMP}/initramfs-lvm-temp" ||
- gen_die "Could not extract lvm binary cache!";
- mv ${TEMP}/initramfs-lvm-temp/sbin/lvm.static ${TEMP}/initramfs-lvm-temp/bin/lvm ||
- gen_die 'LVM error: Could not move lvm.static to lvm!'
- fi
- if [ -x /sbin/lvm ]
- then
-# lvm dumpconfig 2>&1 > /dev/null || gen_die 'Could not copy over lvm.conf!'
-# ret=$?
-# if [ ${ret} != 0 ]
-# then
- cp /etc/lvm/lvm.conf "${TEMP}/initramfs-lvm-temp/etc/lvm/" ||
- gen_die 'Could not copy over lvm.conf!'
-# else
-# gen_die 'Could not copy over lvm.conf!'
-# fi
- fi
- cd "${TEMP}/initramfs-lvm-temp/"
- find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}"
- cd "${TEMP}"
- rm -r "${TEMP}/initramfs-lvm-temp/"
-}
-
-append_evms(){
- if [ -d "${TEMP}/initramfs-evms-temp" ]
- then
- rm -r "${TEMP}/initramfs-evms-temp/"
- fi
- mkdir -p "${TEMP}/initramfs-evms-temp/lib/evms"
- mkdir -p "${TEMP}/initramfs-evms-temp/etc/"
- mkdir -p "${TEMP}/initramfs-evms-temp/bin/"
- mkdir -p "${TEMP}/initramfs-evms-temp/sbin/"
- if [ "${EVMS}" -eq '1' ]
- then
- print_info 1 ' EVMS: Adding support...'
- mkdir -p ${TEMP}/initramfs-evms-temp/lib
- cp -a /lib/ld-* "${TEMP}/initramfs-evms-temp/lib" \
- || gen_die 'Could not copy files for EVMS!'
- if [ -n "`ls /lib/libgcc_s*`" ]
- then
- cp -a /lib/libgcc_s* "${TEMP}/initramfs-evms-temp/lib" \
- || gen_die 'Could not copy files for EVMS!'
- fi
- cp -a /lib/libc-* /lib/libc.* "${TEMP}/initramfs-evms-temp/lib" \
- || gen_die 'Could not copy files for EVMS!'
- cp -a /lib/libdl-* /lib/libdl.* "${TEMP}/initramfs-evms-temp/lib" \
- || gen_die 'Could not copy files for EVMS!'
- cp -a /lib/libpthread* "${TEMP}/initramfs-evms-temp/lib" \
- || gen_die 'Could not copy files for EVMS!'
- cp -a /lib/libuuid*so* "${TEMP}/initramfs-evms-temp/lib" \
- || gen_die 'Could not copy files for EVMS!'
- cp -a /lib/libevms*so* "${TEMP}/initramfs-evms-temp/lib" \
- || gen_die 'Could not copy files for EVMS!'
- cp -a /lib/evms "${TEMP}/initramfs-evms-temp/lib" \
- || gen_die 'Could not copy files for EVMS!'
- cp -a /lib/evms/* "${TEMP}/initramfs-evms-temp/lib/evms" \
- || gen_die 'Could not copy files for EVMS!'
- cp -a /etc/evms.conf "${TEMP}/initramfs-evms-temp/etc" \
- || gen_die 'Could not copy files for EVMS!'
- cp /sbin/evms_activate "${TEMP}/initramfs-evms-temp/sbin" \
- || gen_die 'Could not copy over evms_activate!'
-
- # Fix EVMS complaining that it can't find the swap utilities.
- # These are not required in the initramfs
- for swap_libs in "${TEMP}/initramfs-evms-temp/lib/evms/*/swap*.so"
- do
- rm ${swap_libs}
- done
- fi
- cd "${TEMP}/initramfs-evms-temp/"
- find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}"
- cd "${TEMP}"
- rm -r "${TEMP}/initramfs-evms-temp/"
-}
-
-append_mdadm(){
- if [ -d "${TEMP}/initramfs-mdadm-temp" ]
- then
- rm -r "${TEMP}/initramfs-mdadm-temp/"
- fi
- cd ${TEMP}
- mkdir -p "${TEMP}/initramfs-mdadm-temp/etc/"
- if [ "${MDADM}" -eq '1' ]
- then
- cp -a /etc/mdadm.conf "${TEMP}/initramfs-mdadm-temp/etc" \
- || gen_die "Could not copy mdadm.conf!"
- fi
- cd "${TEMP}/initramfs-mdadm-temp/"
- find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}"
- cd "${TEMP}"
- rm -rf "${TEMP}/initramfs-mdadm-temp" > /dev/null
-}
-
-append_splash(){
- splash_geninitramfs=`which splash_geninitramfs 2>/dev/null`
- if [ -x "${splash_geninitramfs}" ]
- then
- [ -z "${SPLASH_THEME}" ] && [ -e /etc/conf.d/splash ] && source /etc/conf.d/splash
- [ -z "${SPLASH_THEME}" ] && SPLASH_THEME=default
- print_info 1 " >> Installing splash [ using the ${SPLASH_THEME} theme ]..."
- if [ -d "${TEMP}/initramfs-splash-temp" ]
- then
- rm -r "${TEMP}/initramfs-splash-temp/"
- fi
- mkdir -p "${TEMP}/initramfs-splash-temp"
- cd /
- local tmp=""
- [ -n "${SPLASH_RES}" ] && tmp="-r ${SPLASH_RES}"
- splash_geninitramfs -c "${TEMP}/initramfs-splash-temp" ${tmp} ${SPLASH_THEME} || gen_die "Could not build splash cpio archive"
- if [ -e "/usr/share/splashutils/initrd.splash" ]; then
- mkdir -p "${TEMP}/initramfs-splash-temp/etc"
- cp -f "/usr/share/splashutils/initrd.splash" "${TEMP}/initramfs-splash-temp/etc"
- fi
- cd "${TEMP}/initramfs-splash-temp/"
- find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}" \
- || gen_die "compressing splash cpio"
- cd "${TEMP}"
- rm -r "${TEMP}/initramfs-splash-temp/"
- else
- print_warning 1 ' >> No splash detected; skipping!'
- fi
-}
-
-append_overlay(){
- cd ${INITRAMFS_OVERLAY}
- find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}"
-}
-
-append_luks() {
- if [ -d "${TEMP}/initramfs-luks-temp" ]
- then
- rm -r "${TEMP}/initramfs-luks-temp/"
- fi
-
- mkdir -p "${TEMP}/initramfs-luks-temp/lib/luks/"
- mkdir -p "${TEMP}/initramfs-luks-temp/sbin"
- cd "${TEMP}/initramfs-luks-temp"
-
- if isTrue ${LUKS}
- then
- if is_static /bin/cryptsetup
- then
- print_info 1 "Including LUKS support"
- cp /bin/cryptsetup ${TEMP}/initramfs-luks-temp/sbin/cryptsetup
- chmod +x "${TEMP}/initramfs-luks-temp/sbin/cryptsetup"
- elif is_static /sbin/cryptsetup
- then
- print_info 1 "Including LUKS support"
- cp /sbin/cryptsetup ${TEMP}/initramfs-luks-temp/sbin/cryptsetup
- chmod +x "${TEMP}/initramfs-luks-temp/sbin/cryptsetup"
- else
- print_info 1 "LUKS support requires static cryptsetup at /bin/cryptsetup or /sbin/cryptsetup"
- print_info 1 "Not including LUKS support"
- fi
- fi
-
- find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}" \
- || gen_die "appending cryptsetup to cpio"
-
- cd "${TEMP}"
- rm -r "${TEMP}/initramfs-luks-temp/"
-}
-
-append_firmware() {
- if [ -z "${FIRMWARE_FILES}" -a ! -d "${FIRMWARE_DIR}" ]
- then
- gen_die "specified firmware directory (${FIRMWARE_DIR}) does not exist"
- fi
- if [ -d "${TEMP}/initramfs-firmware-temp" ]
- then
- rm -r "${TEMP}/initramfs-firmware-temp/"
- fi
- mkdir -p "${TEMP}/initramfs-firmware-temp/lib/firmware"
- cd "${TEMP}/initramfs-firmware-temp"
- if [ -n "${FIRMWARE_FILES}" ]
- then
- OLD_IFS=$IFS
- IFS=","
- for i in ${FIRMWARE_FILES}
- do
- cp -L "${i}" ${TEMP}/initramfs-firmware-temp/lib/firmware/
- done
- IFS=$OLD_IFS
- else
- cp -a "${FIRMWARE_DIR}"/* ${TEMP}/initramfs-firmware-temp/lib/firmware/
- fi
- find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}" \
- || gen_die "appending firmware to cpio"
- cd "${TEMP}"
- rm -r "${TEMP}/initramfs-firmware-temp/"
-}
-
-print_list()
-{
- local x
- for x in ${*}
- do
- echo ${x}
- done
-}
-
-append_modules() {
- local group
- local group_modules
- local MOD_EXT=".ko"
-
- print_info 2 "initramfs: >> Searching for modules..."
- if [ "${INSTALL_MOD_PATH}" != '' ]
- then
- cd ${INSTALL_MOD_PATH}
- else
- cd /
- fi
-
- if [ -d "${TEMP}/initramfs-modules-${KV}-temp" ]
- then
- rm -r "${TEMP}/initramfs-modules-${KV}-temp/"
- fi
- mkdir -p "${TEMP}/initramfs-modules-${KV}-temp/lib/modules/${KV}"
- for i in `gen_dep_list`
- do
- mymod=`find ./lib/modules/${KV} -name "${i}${MOD_EXT}" 2>/dev/null| head -n 1 `
- if [ -z "${mymod}" ]
- then
- print_warning 2 "Warning :: ${i}${MOD_EXT} not found; skipping..."
- continue;
- fi
-
- print_info 2 "initramfs: >> Copying ${i}${MOD_EXT}..."
- cp -ax --parents "${mymod}" "${TEMP}/initramfs-modules-${KV}-temp"
- done
-
- cp -ax --parents ./lib/modules/${KV}/modules* ${TEMP}/initramfs-modules-${KV}-temp 2>/dev/null
-
- mkdir -p "${TEMP}/initramfs-modules-${KV}-temp/etc/modules"
- for group_modules in ${!MODULES_*}; do
- group="$(echo $group_modules | cut -d_ -f2 | tr "[:upper:]" "[:lower:]")"
- print_list ${!group_modules} > "${TEMP}/initramfs-modules-${KV}-temp/etc/modules/${group}"
- done
- cd "${TEMP}/initramfs-modules-${KV}-temp/"
- find . | cpio ${CPIO_ARGS} --append -F "${CPIO}"
- cd "${TEMP}"
- rm -r "${TEMP}/initramfs-modules-${KV}-temp/"
-}
-
-# check for static linked file with objdump
-is_static() {
- LANG="C" LC_ALL="C" objdump -T $1 2>&1 | grep "not a dynamic object" > /dev/null
- return $?
-}
-
-append_auxilary() {
- if [ -d "${TEMP}/initramfs-aux-temp" ]
- then
- rm -r "${TEMP}/initramfs-aux-temp/"
- fi
- mkdir -p "${TEMP}/initramfs-aux-temp/etc"
- mkdir -p "${TEMP}/initramfs-aux-temp/sbin"
- if [ -f "${CMD_LINUXRC}" ]
- then
- cp "${CMD_LINUXRC}" "${TEMP}/initramfs-aux-temp/init"
- print_info 2 " >> Copying user specified linuxrc: ${CMD_LINUXRC} to init"
- else
- if isTrue ${NETBOOT}
- then
- cp "${GK_SHARE}/netboot/linuxrc.x" "${TEMP}/initramfs-aux-temp/init"
- else
- if [ -f "${GK_SHARE}/arch/${ARCH}/linuxrc" ]
- then
- cp "${GK_SHARE}/arch/${ARCH}/linuxrc" "${TEMP}/initramfs-aux-temp/init"
- else
- cp "${GK_SHARE}/defaults/linuxrc" "${TEMP}/initramfs-aux-temp/init"
- fi
- fi
- fi
-
- # Make sure it's executable
- chmod 0755 "${TEMP}/initramfs-aux-temp/init"
-
- # Make a symlink to init .. incase we are bundled inside the kernel as one
- # big cpio.
- cd ${TEMP}/initramfs-aux-temp
- ln -s init linuxrc
-# ln ${TEMP}/initramfs-aux-temp/init ${TEMP}/initramfs-aux-temp/linuxrc
-
- if [ -f "${GK_SHARE}/arch/${ARCH}/initrd.scripts" ]
- then
- cp "${GK_SHARE}/arch/${ARCH}/initrd.scripts" "${TEMP}/initramfs-aux-temp/etc/initrd.scripts"
- else
- cp "${GK_SHARE}/defaults/initrd.scripts" "${TEMP}/initramfs-aux-temp/etc/initrd.scripts"
- fi
-
- if [ -f "${GK_SHARE}/arch/${ARCH}/initrd.defaults" ]
- then
- cp "${GK_SHARE}/arch/${ARCH}/initrd.defaults" "${TEMP}/initramfs-aux-temp/etc/initrd.defaults"
- else
- cp "${GK_SHARE}/defaults/initrd.defaults" "${TEMP}/initramfs-aux-temp/etc/initrd.defaults"
- fi
-
- if [ -n "${REAL_ROOT}" ]
- then
- sed -i "s:^REAL_ROOT=.*$:REAL_ROOT='${REAL_ROOT}':" "${TEMP}/initramfs-aux-temp/etc/initrd.defaults"
- fi
-
- echo -n 'HWOPTS="$HWOPTS ' >> "${TEMP}/initramfs-aux-temp/etc/initrd.defaults"
- for group_modules in ${!MODULES_*}; do
- group="$(echo $group_modules | cut -d_ -f2 | tr "[:upper:]" "[:lower:]")"
- echo -n "${group} " >> "${TEMP}/initramfs-aux-temp/etc/initrd.defaults"
- done
- echo '"' >> "${TEMP}/initramfs-aux-temp/etc/initrd.defaults"
-
- if [ -f "${GK_SHARE}/arch/${ARCH}/modprobe" ]
- then
- cp "${GK_SHARE}/arch/${ARCH}/modprobe" "${TEMP}/initramfs-aux-temp/sbin/modprobe"
- else
- cp "${GK_SHARE}/defaults/modprobe" "${TEMP}/initramfs-aux-temp/sbin/modprobe"
- fi
- if isTrue $CMD_DOKEYMAPAUTO
- then
- echo 'MY_HWOPTS="${MY_HWOPTS} keymap"' >> ${TEMP}/initramfs-aux-temp/etc/initrd.defaults
- fi
- if isTrue $CMD_KEYMAP
- then
- mkdir -p "${TEMP}/initramfs-aux-temp/lib/keymaps"
- /bin/tar -C "${TEMP}/initramfs-aux-temp/lib/keymaps" -zxf "${GK_SHARE}/defaults/keymaps.tar.gz"
- fi
- if isTrue $CMD_SLOWUSB
- then
- echo 'MY_HWOPTS="${MY_HWOPTS} slowusb"' >> ${TEMP}/initramfs-aux-temp/etc/initrd.defaults
- fi
-
- cd ${TEMP}/initramfs-aux-temp/sbin && ln -s ../init init
- cd ${TEMP}
- chmod +x "${TEMP}/initramfs-aux-temp/init"
- chmod +x "${TEMP}/initramfs-aux-temp/etc/initrd.scripts"
- chmod +x "${TEMP}/initramfs-aux-temp/etc/initrd.defaults"
- chmod +x "${TEMP}/initramfs-aux-temp/sbin/modprobe"
-
- if isTrue ${NETBOOT}
- then
- cd "${GK_SHARE}/netboot/misc"
- cp -pPRf * "${TEMP}/initramfs-aux-temp/"
- fi
-
- cd "${TEMP}/initramfs-aux-temp/"
- find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}"
- cd "${TEMP}"
- rm -r "${TEMP}/initramfs-aux-temp/"
-}
-
-append_data() {
- local name=$1 var=$2
- local func="append_${name}"
-
- [ $# -eq 0 ] && gen_die "append_data() called with zero arguments"
- if [ $# -eq 1 ] || isTrue ${var}
- then
- print_info 1 " >> Appending ${name} cpio data..."
- ${func}
- fi
-}
-
-create_initramfs() {
- print_info 1 "initramfs: >> Initializing..."
-
- # Create empty cpio
- CPIO="${TMPDIR}/initramfs-${KV}"
- echo | cpio ${CPIO_ARGS} -F "${CPIO}" 2>/dev/null \
- || gen_die "Could not create empty cpio at ${CPIO}"
-
- append_data 'base_layout'
- append_data 'auxilary' "${BUSYBOX}"
- append_data 'busybox' "${BUSYBOX}"
- append_data 'lvm' "${LVM}"
- append_data 'dmraid' "${DMRAID}"
- append_data 'iscsi' "${ISCSI}"
- append_data 'evms' "${EVMS}"
- append_data 'mdadm' "${MDADM}"
- append_data 'luks' "${LUKS}"
- append_data 'multipath' "${MULTIPATH}"
-
- if [ "${NORAMDISKMODULES}" -eq '0' ]
- then
- append_data 'modules'
- else
- print_info 1 "initramfs: Not copying modules..."
- fi
-
- append_data 'blkid' "${DISKLABEL}"
-
- append_data 'unionfs_fuse' "${UNIONFS}"
-
- append_data 'splash' "${SPLASH}"
-
- if isTrue "${FIRMWARE}" && [ -n "${FIRMWARE_DIR}" ]
- then
- append_data 'firmware'
- fi
-
- # This should always be appended last
- if [ "${INITRAMFS_OVERLAY}" != '' ]
- then
- append_data 'overlay'
- fi
-
- gzip -9 "${CPIO}"
- mv -f "${CPIO}.gz" "${CPIO}"
-
- if isTrue "${INTEGRATED_INITRAMFS}"
- then
-# cp ${TMPDIR}/initramfs-${KV} ${KERNEL_DIR}/usr/initramfs_data.cpio.gz
- mv ${TMPDIR}/initramfs-${KV} ${TMPDIR}/initramfs-${KV}.cpio.gz
-# sed -i "s|^.*CONFIG_INITRAMFS_SOURCE=.*$|CONFIG_INITRAMFS_SOURCE=\"${TMPDIR}/initramfs-${KV}.cpio.gz\"|" ${KERNEL_DIR}/.config
- sed -i '/^.*CONFIG_INITRAMFS_SOURCE=.*$/d' ${KERNEL_DIR}/.config
- echo -e "CONFIG_INITRAMFS_SOURCE=\"${TMPDIR}/initramfs-${KV}.cpio.gz\"\nCONFIG_INITRAMFS_ROOT_UID=0\nCONFIG_INITRAMFS_ROOT_GID=0" >> ${KERNEL_DIR}/.config
- fi
-
- if ! isTrue "${CMD_NOINSTALL}"
- then
- if ! isTrue "${INTEGRATED_INITRAMFS}"
- then
- copy_image_with_preserve "initramfs" \
- "${TMPDIR}/initramfs-${KV}" \
- "initramfs-${KNAME}-${ARCH}-${KV}"
- fi
- fi
-}
diff --git a/genkernel b/genkernel
index a46d084..648c471 100755
--- a/genkernel
+++ b/genkernel
@@ -47,12 +47,7 @@ source ${GK_SHARE}/gen_arch.sh || gen_die "Could not read ${GK_SHARE}/gen_arch.s
source ${GK_SHARE}/gen_determineargs.sh || gen_die "Could not read ${GK_SHARE}/gen_determineargs.sh"
source ${GK_SHARE}/gen_compile.sh || gen_die "Could not read ${GK_SHARE}/gen_compile.sh"
source ${GK_SHARE}/gen_configkernel.sh || gen_die "Could not read ${GK_SHARE}/gen_configkernel.sh"
-if isTrue "${DRACUT}"
-then
- source ${GK_SHARE}/gen_initramfs.sh || gen_die "Could not read ${GK_SHARE}/gen_initramfs.sh"
-else
- source ${GK_SHARE}/gen_dracut.sh || gen_die "Could not read ${GK_SHARE}/gen_dracut.sh"
-fi
+source ${GK_SHARE}/gen_dracut.sh || gen_die "Could not read ${GK_SHARE}/gen_dracut.sh"
source ${GK_SHARE}/gen_moddeps.sh || gen_die "Could not read ${GK_SHARE}/gen_moddeps.sh"
source ${GK_SHARE}/gen_package.sh || gen_die "Could not read ${GK_SHARE}/gen_package.sh"
source ${GK_SHARE}/gen_bootloader.sh || gen_die "Could not read ${GK_SHARE}/gen_bootloader.sh"
@@ -66,21 +61,21 @@ trap_cleanup(){
}
cleanup(){
- if [ -n "$TEMP" -a -d "$TEMP" ]; then
- rm -rf "$TEMP"
- fi
-
- if isTrue ${POSTCLEAR}
- then
- echo
- print_info 1 'RUNNING FINAL CACHE/TMP CLEANUP'
- print_info 1 "CACHE_DIR: ${CACHE_DIR}"
- CLEAR_CACHE_DIR='yes'
- setup_cache_dir
- echo
- print_info 1 "TMPDIR: ${TMPDIR}"
- clear_tmpdir
- fi
+ if [ -n "$TEMP" -a -d "$TEMP" ]; then
+ rm -rf "$TEMP"
+ fi
+
+ if isTrue ${POSTCLEAR}
+ then
+ echo
+ print_info 1 'RUNNING FINAL CACHE/TMP CLEANUP'
+ print_info 1 "CACHE_DIR: ${CACHE_DIR}"
+ CLEAR_CACHE_DIR='yes'
+ setup_cache_dir
+ echo
+ print_info 1 "TMPDIR: ${TMPDIR}"
+ clear_tmpdir
+ fi
}
trap trap_cleanup SIGHUP SIGQUIT SIGINT SIGTERM SIGKILL
@@ -134,12 +129,6 @@ set_kernel_arch
[ ! -f "${TEMP}" ] && mkdir -p "${TEMP}"
-if ! isTrue "${DRACUT}"
-then
- setup_cache_dir
- check_distfiles
-fi
-
dump_debugcache
NORMAL=${BOLD} print_info 1 "Linux Kernel ${BOLD}${KV}${NORMAL} for ${BOLD}${ARCH}${NORMAL}..."
@@ -211,7 +200,7 @@ fi
KERNCACHE_IS_VALID=0
if [ "${KERNCACHE}" != "" ]
then
- gen_kerncache_is_valid
+ gen_kerncache_is_valid
fi
if [ ${BUILD_KERNEL} -eq '1' -a "${KERNCACHE_IS_VALID}" == "0" ]
@@ -293,22 +282,6 @@ fi
if [ "${BUILD_RAMDISK}" -eq '1' ]
then
- if ! isTrue "${DRACUT}"
- then
- [ "${DISKLABEL}" -eq '1' ] && compile_e2fsprogs
-
- if [ "${BUSYBOX}" -eq '1' ]
- then
- # Compile Busybox
- compile_busybox
- fi
-
- if isTrue "${UNIONFS}"
- then
- compile_unionfs_fuse
- fi
- fi
-
# Compile initramfs
create_initramfs
else
@@ -337,74 +310,37 @@ then
print_info 1 ''
print_info 1 "Kernel compiled successfully!"
print_info 1 ''
- if ! isTrue "${DRACUT}"
- then
- print_info 1 'Required Kernel Parameters:'
+fi
- if [ "${BUILD_RAMDISK}" -eq '0' ]
- then
- print_info 1 ' root=/dev/$ROOT'
- print_info 1 ' [ And "vga=0x317 splash=verbose" if you use a framebuffer ]'
- print_info 1 ''
- print_info 1 ' Where $ROOT is the device node for your root partition as the'
- print_info 1 ' one specified in /etc/fstab'
- else
- print_info 1 ' real_root=/dev/$ROOT'
- print_info 1 ''
- print_info 1 ' Where $ROOT is the device node for your root partition as the'
- print_info 1 ' one specified in /etc/fstab'
- print_info 1 ''
- print_info 1 "If you require Genkernel's hardware detection features; you MUST"
- print_info 1 'tell your bootloader to use the provided INITRAMFS file. Otherwise;'
- print_info 1 'substitute the root argument for the real_root argument if you are'
- print_info 1 'not planning to use the initramfs...'
- fi
- fi
+if [ "${BUILD_KERNEL}" -eq '1' ] || [ "${BUILD_RAMDISK}" -eq '1' ]; then
+ print_info 1 'Required kernel arguments:'
+ print_info 1 ''
+ print_info 1 ' root=/dev/$ROOT'
+ print_info 1 ''
+ print_info 1 ' Where $ROOT is the device node for your root partition as the'
+ print_info 1 ' one specified in /etc/fstab'
fi
if [ "${BUILD_RAMDISK}" -eq '1' ]
then
- if isTrue "${DRACUT}"
- then
- print_info 1 'Required kernel arguments:'
- print_info 1 ''
- print_info 1 ' root=/dev/$ROOT'
- print_info 1 ''
- print_info 1 ' Where $ROOT is the device node for your root partition as the'
- print_info 1 ' one specified in /etc/fstab'
- [ "${BUILD_RAMDISK}" -eq '0' ] || {
- print_info 1 ''
- print_info 1 ' resume=/dev/$SWAP'
- print_info 1 ''
- print_info 1 ' Where $SWAP is the swap device used by hibernate software of your choice.'
- print_info 1 ''
- print_info 1 ' Please consult "man 7 dracut.kernel" for additional kernel arguments.'
- }
- fi
-
echo
print_info 1 'WARNING... WARNING... WARNING...'
print_info 1 'Additional kernel cmdline arguments that *may* be required to boot properly...'
- if isTrue "${DRACUT}"
- then
- isTrue "${GENSPLASH}" && print_info 1 "add \"splash=silent,theme:${SPLASH_THEME} console=tty1 quiet\" if you use a splash framebuffer"
- else
- [ "${SPLASH}" -eq '1' ] && print_info 1 "add \"vga=791 splash=silent,theme:${SPLASH_THEME} console=tty1 quiet\" if you use a splash framebuffer ]"
- [ "${LVM}" -eq '1' ] && print_info 1 'add "dolvm" for lvm support'
- [ "${EVMS}" -eq '1' ] && print_info 1 'add "doevms" for evms support'
- [ "${DMRAID}" -eq '1' ] && print_info 1 'add "dodmraid" for dmraid support'
- [ "${DMRAID}" -eq '1' ] && print_info 1 ' or "dodmraid=<additional options>"'
- [ "${ISCSI}" -eq '1' ] && print_info 1 'add at least "iscsi_initiatorname=<initiator name> iscsi_target=<target name> and iscsi_address=<target ip>" for iscsi support'
- fi
-fi
+ echo
+ print_info 1 'If you use hibernation:'
+ print_info 1 ''
+ print_info 1 ' resume=/dev/$SWAP'
+ print_info 1 ''
+ print_info 1 ' Where $SWAP is the swap device used by hibernate software of your choice.'
+ print_info 1 ''
+ print_info 1 ' Please consult "man 7 dracut.kernel" for additional kernel arguments.'
-[ "${BOOTRW}" != '' ] && mount -o remount,ro ${BOOTDIR}
+ isTrue "${GENSPLASH}" && print_info 1 "add \"splash=silent,theme:${SPLASH_THEME} console=tty1 quiet\" if you use a splash framebuffer"
+fi
echo
-print_info 1 'Do NOT report kernel bugs as genkernel bugs unless your bug'
-print_info 1 'is about the default genkernel configuration...'
-print_info 1 ''
-print_info 1 'Make sure you have the latest genkernel before reporting bugs.'
+
+[ "${BOOTRW}" != '' ] && mount -o remount,ro ${BOOTDIR}
#Final Cleanup
cleanup
diff --git a/genkernel.conf b/genkernel.conf
index 949474c..e3bb3d0 100644
--- a/genkernel.conf
+++ b/genkernel.conf
@@ -57,7 +57,7 @@ USECOLOR="yes"
# DMRAID="no"
# Copy /etc/mdadm.conf to initramfs.
-# MDADM="no"
+#MDADM="yes"
# Add Multipath support.
# MULTIPATH="no"
@@ -75,24 +75,12 @@ USECOLOR="yes"
# Add new kernel to grub?
# BOOTLOADER="grub"
-# ==============Internal engine===============
-#
-# Enable disklabel support (copies blkid to initrd)
-DISKLABEL="yes"
-
-# Include (or suppresses the inclusion of) busybox in the initrd or initramfs.
-# If included, busybox is rebuilt if the cached copy is out of date.
-# BUSYBOX="yes"
+# ===============Dracut engine================
# Add in EVMS support from static binaries if they exist on the system: you
# should run "emerge evms" first.
# EVMS="no"
-# ===============Dracut engine================
-
-# Build system using Dracut [yes] or old internal engine [no]. "yes" is default.
-# DRACUT="yes"
-
# Include RAID support via mdadm
# MDRAID="no"
@@ -112,22 +100,6 @@ DISKLABEL="yes"
# Linker to use for the kernel. See also the --kernel-ld command line option.
# KERNEL_LD="ld"
-# GNU Make to use for the utilities. See also the --utils-make command line
-# option.
-# UTILS_MAKE="make"
-
-# Compiler to use for the utilities (e.g. distcc). See also the --utils-cc
-# command line option.
-# UTILS_CC="gcc"
-
-# Assembler to use for the utilities. See also the --utils-as command line
-# option.
-# UTILS_AS="as"
-
-# Linker to use for the utilities. See also the --utils-ld command line
-# option.
-# UTILS_LD="ld"
-
# =========GENKERNEL LOCATION CONFIGURATION============
# Variables:
# %%ARCH%% - Final determined architecture
@@ -156,43 +128,3 @@ DEFAULT_KERNEL_SOURCE="/usr/src/linux"
# Default kernel config (only use to override using
# arch/%%ARCH%%/kernel-config-${VER}.${PAT} !)
# DEFAULT_KERNEL_CONFIG="${GK_SHARE}/arch/%%ARCH%%/kernel-config"
-
-BUSYBOX_VER="VERSION_BUSYBOX"
-BUSYBOX_SRCTAR="${DISTDIR}/busybox-${BUSYBOX_VER}.tar.bz2"
-BUSYBOX_DIR="busybox-${BUSYBOX_VER}"
-BUSYBOX_BINCACHE="%%CACHE%%/busybox-${BUSYBOX_VER}-%%ARCH%%.tar.bz2"
-
-DEVICE_MAPPER_VER="VERSION_DMAP"
-DEVICE_MAPPER_DIR="device-mapper.${DEVICE_MAPPER_VER}"
-DEVICE_MAPPER_SRCTAR="${DISTDIR}/device-mapper.${DEVICE_MAPPER_VER}.tgz"
-DEVICE_MAPPER_BINCACHE="%%CACHE%%/device-mapper-${DEVICE_MAPPER_VER}-%%ARCH%%.tar.bz2"
-
-LVM_VER="VERSION_LVM"
-LVM_DIR="LVM2.${LVM_VER}"
-LVM_SRCTAR="${DISTDIR}/LVM2.${LVM_VER}.tgz"
-LVM_BINCACHE="%%CACHE%%/LVM2.${LVM_VER}-%%ARCH%%.tar.bz2"
-
-DMRAID_VER="VERSION_DMRAID"
-DMRAID_DIR="dmraid/${DMRAID_VER}"
-DMRAID_SRCTAR="${DISTDIR}/dmraid-${DMRAID_VER}.tar.bz2"
-DMRAID_BINCACHE="%%CACHE%%/dmraid-${DMRAID_VER}-%%ARCH%%.tar.bz2"
-
-ISCSI_VER="VERSION_ISCSI"
-ISCSI_DIR="open-iscsi-${ISCSI_VER}"
-ISCSI_SRCTAR="${DISTDIR}/open-iscsi-${ISCSI_VER}.tar.gz"
-ISCSI_BINCACHE="%%CACHE%%/iscsi-${ISCSI_VER}-%%ARCH%%.bz2"
-
-E2FSPROGS_VER="VERSION_E2FSPROGS"
-E2FSPROGS_DIR="e2fsprogs-${E2FSPROGS_VER}"
-E2FSPROGS_SRCTAR="${DISTDIR}/e2fsprogs-${E2FSPROGS_VER}.tar.gz"
-BLKID_BINCACHE="%%CACHE%%/blkid-${E2FSPROGS_VER}-%%ARCH%%.bz2"
-
-FUSE_VER="VERSION_FUSE"
-FUSE_DIR="fuse-${FUSE_VER}"
-FUSE_SRCTAR="${DISTDIR}/fuse-${FUSE_VER}.tar.gz"
-FUSE_BINCACHE="%%CACHE%%/fuse-${FUSE_VER}-%%ARCH%%.tar.bz2"
-
-UNIONFS_FUSE_VER="VERSION_UNIONFS_FUSE"
-UNIONFS_FUSE_DIR="unionfs-fuse-${UNIONFS_FUSE_VER}"
-UNIONFS_FUSE_SRCTAR="${DISTDIR}/unionfs-fuse-${UNIONFS_FUSE_VER}.tar.bz2"
-UNIONFS_FUSE_BINCACHE="%%CACHE%%/unionfs-fuse-${UNIONFS_FUSE_VER}-%%ARCH%%.bz2"
diff --git a/netboot/busy-config b/netboot/busy-config
deleted file mode 100644
index 0691ff0..0000000
--- a/netboot/busy-config
+++ /dev/null
@@ -1,759 +0,0 @@
-#
-# Automatically generated make config: don't edit
-# Busybox version: 1.7.4
-# Thu Apr 16 15:04:31 2009
-#
-CONFIG_HAVE_DOT_CONFIG=y
-
-#
-# Busybox Settings
-#
-
-#
-# General Configuration
-#
-CONFIG_NITPICK=y
-# CONFIG_DESKTOP is not set
-# CONFIG_FEATURE_BUFFERS_USE_MALLOC is not set
-CONFIG_FEATURE_BUFFERS_GO_ON_STACK=y
-# 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 is not set
-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=y
-CONFIG_BUSYBOX_EXEC_PATH="/proc/self/exe"
-CONFIG_FEATURE_SYSLOG=y
-CONFIG_FEATURE_HAVE_RPC=y
-
-#
-# Build Options
-#
-CONFIG_STATIC=y
-# CONFIG_BUILD_LIBBUSYBOX is not set
-# CONFIG_FEATURE_FULL_LIBBUSYBOX is not set
-# CONFIG_FEATURE_SHARED_BUSYBOX is not set
-CONFIG_LFS=y
-# CONFIG_BUILD_AT_ONCE is not set
-
-#
-# Debugging Options
-#
-# CONFIG_DEBUG 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 is not set
-
-#
-# Installation Options
-#
-# CONFIG_INSTALL_NO_USR is not set
-CONFIG_INSTALL_APPLET_SYMLINKS=y
-# CONFIG_INSTALL_APPLET_HARDLINKS is not set
-# CONFIG_INSTALL_APPLET_DONT is not set
-CONFIG_PREFIX="./_install"
-
-#
-# Busybox Library Tuning
-#
-CONFIG_PASSWORD_MINLEN=6
-CONFIG_MD5_SIZE_VS_SPEED=2
-# CONFIG_FEATURE_FAST_TOP is not set
-# CONFIG_FEATURE_ETC_NETWORKS is not set
-CONFIG_FEATURE_EDITING=y
-CONFIG_FEATURE_EDITING_MAX_LEN=1024
-# CONFIG_FEATURE_EDITING_FANCY_KEYS is not set
-# CONFIG_FEATURE_EDITING_VI is not set
-CONFIG_FEATURE_EDITING_HISTORY=15
-# CONFIG_FEATURE_EDITING_SAVEHISTORY is not set
-CONFIG_FEATURE_TAB_COMPLETION=y
-# CONFIG_FEATURE_USERNAME_COMPLETION is not set
-CONFIG_FEATURE_EDITING_FANCY_PROMPT=y
-CONFIG_MONOTONIC_SYSCALL=y
-CONFIG_IOCTL_HEX2STR_ERROR=y
-
-#
-# Applets
-#
-
-#
-# Archival Utilities
-#
-CONFIG_AR=y
-CONFIG_FEATURE_AR_LONG_FILENAMES=y
-CONFIG_BUNZIP2=y
-CONFIG_CPIO=y
-CONFIG_DPKG=y
-# CONFIG_DPKG_DEB is not set
-# CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY is not set
-CONFIG_GUNZIP=y
-CONFIG_FEATURE_GUNZIP_UNCOMPRESS=y
-CONFIG_GZIP=y
-CONFIG_RPM2CPIO=y
-CONFIG_RPM=y
-# CONFIG_FEATURE_RPM_BZ2 is not set
-CONFIG_TAR=y
-CONFIG_FEATURE_TAR_CREATE=y
-CONFIG_FEATURE_TAR_BZIP2=y
-CONFIG_FEATURE_TAR_LZMA=y
-CONFIG_FEATURE_TAR_FROM=y
-CONFIG_FEATURE_TAR_GZIP=y
-CONFIG_FEATURE_TAR_COMPRESS=y
-CONFIG_FEATURE_TAR_OLDGNU_COMPATIBILITY=y
-# CONFIG_FEATURE_TAR_OLDSUN_COMPATIBILITY is not set
-CONFIG_FEATURE_TAR_GNU_EXTENSIONS=y
-CONFIG_FEATURE_TAR_LONG_OPTIONS=y
-CONFIG_UNCOMPRESS=y
-CONFIG_UNLZMA=y
-CONFIG_FEATURE_LZMA_FAST=y
-CONFIG_UNZIP=y
-
-#
-# Common options for cpio and tar
-#
-CONFIG_FEATURE_UNARCHIVE_TAPE=y
-
-#
-# Common options for dpkg and dpkg_deb
-#
-CONFIG_FEATURE_DEB_TAR_GZ=y
-# CONFIG_FEATURE_DEB_TAR_BZ2 is not set
-# CONFIG_FEATURE_DEB_TAR_LZMA is not set
-
-#
-# Coreutils
-#
-CONFIG_BASENAME=y
-# CONFIG_CAL is not set
-CONFIG_CAT=y
-# CONFIG_CATV is not set
-CONFIG_CHGRP=y
-CONFIG_CHMOD=y
-CONFIG_CHOWN=y
-CONFIG_CHROOT=y
-# CONFIG_CKSUM is not set
-# CONFIG_COMM is not set
-CONFIG_CP=y
-CONFIG_CUT=y
-CONFIG_DATE=y
-CONFIG_FEATURE_DATE_ISOFMT=y
-CONFIG_DD=y
-CONFIG_FEATURE_DD_SIGNAL_HANDLING=y
-# CONFIG_FEATURE_DD_IBS_OBS is not set
-CONFIG_DF=y
-CONFIG_DIRNAME=y
-CONFIG_DOS2UNIX=y
-CONFIG_UNIX2DOS=y
-CONFIG_DU=y
-CONFIG_FEATURE_DU_DEFAULT_BLOCKSIZE_1K=y
-CONFIG_ECHO=y
-CONFIG_FEATURE_FANCY_ECHO=y
-CONFIG_ENV=y
-# CONFIG_FEATURE_ENV_LONG_OPTIONS is not set
-# CONFIG_EXPAND is not set
-# CONFIG_FEATURE_EXPAND_LONG_OPTIONS is not set
-CONFIG_EXPR=y
-# CONFIG_EXPR_MATH_SUPPORT_64 is not set
-CONFIG_FALSE=y
-# CONFIG_FOLD is not set
-CONFIG_HEAD=y
-CONFIG_FEATURE_FANCY_HEAD=y
-# CONFIG_HOSTID is not set
-CONFIG_ID=y
-CONFIG_INSTALL=y
-# CONFIG_FEATURE_INSTALL_LONG_OPTIONS is not set
-CONFIG_LENGTH=y
-CONFIG_LN=y
-# CONFIG_LOGNAME is not set
-CONFIG_LS=y
-CONFIG_FEATURE_LS_FILETYPES=y
-CONFIG_FEATURE_LS_FOLLOWLINKS=y
-CONFIG_FEATURE_LS_RECURSIVE=y
-CONFIG_FEATURE_LS_SORTFILES=y
-CONFIG_FEATURE_LS_TIMESTAMPS=y
-CONFIG_FEATURE_LS_USERNAME=y
-CONFIG_FEATURE_LS_COLOR=y
-# CONFIG_FEATURE_LS_COLOR_IS_DEFAULT is not set
-CONFIG_MD5SUM=y
-CONFIG_MKDIR=y
-# CONFIG_FEATURE_MKDIR_LONG_OPTIONS is not set
-CONFIG_MKFIFO=y
-CONFIG_MKNOD=y
-CONFIG_MV=y
-# CONFIG_FEATURE_MV_LONG_OPTIONS is not set
-CONFIG_NICE=y
-# CONFIG_NOHUP is not set
-# CONFIG_OD is not set
-CONFIG_PRINTENV=y
-# CONFIG_PRINTF is not set
-CONFIG_PWD=y
-CONFIG_READLINK=y
-# CONFIG_FEATURE_READLINK_FOLLOW is not set
-# CONFIG_REALPATH is not set
-CONFIG_RM=y
-CONFIG_RMDIR=y
-CONFIG_SEQ=y
-CONFIG_SHA1SUM=y
-CONFIG_SLEEP=y
-# CONFIG_FEATURE_FANCY_SLEEP is not set
-CONFIG_SORT=y
-CONFIG_FEATURE_SORT_BIG=y
-# CONFIG_SPLIT is not set
-# CONFIG_FEATURE_SPLIT_FANCY is not set
-CONFIG_STAT=y
-# CONFIG_FEATURE_STAT_FORMAT is not set
-CONFIG_STTY=y
-# CONFIG_SUM is not set
-CONFIG_SYNC=y
-CONFIG_TAIL=y
-CONFIG_FEATURE_FANCY_TAIL=y
-CONFIG_TEE=y
-CONFIG_FEATURE_TEE_USE_BLOCK_IO=y
-CONFIG_TEST=y
-# CONFIG_FEATURE_TEST_64 is not set
-CONFIG_TOUCH=y
-CONFIG_TR=y
-CONFIG_FEATURE_TR_CLASSES=y
-CONFIG_FEATURE_TR_EQUIV=y
-CONFIG_TRUE=y
-CONFIG_TTY=y
-CONFIG_UNAME=y
-# CONFIG_UNEXPAND is not set
-# CONFIG_FEATURE_UNEXPAND_LONG_OPTIONS is not set
-CONFIG_UNIQ=y
-CONFIG_USLEEP=y
-# CONFIG_UUDECODE is not set
-# CONFIG_UUENCODE is not set
-CONFIG_WC=y
-# CONFIG_FEATURE_WC_LARGE is not set
-# CONFIG_WHO is not set
-CONFIG_WHOAMI=y
-CONFIG_YES=y
-
-#
-# Common options for cp and mv
-#
-CONFIG_FEATURE_PRESERVE_HARDLINKS=y
-
-#
-# Common options for ls, more and telnet
-#
-CONFIG_FEATURE_AUTOWIDTH=y
-
-#
-# Common options for df, du, ls
-#
-CONFIG_FEATURE_HUMAN_READABLE=y
-
-#
-# Common options for md5sum, sha1sum
-#
-CONFIG_FEATURE_MD5_SHA1_SUM_CHECK=y
-
-#
-# Console Utilities
-#
-CONFIG_CHVT=y
-CONFIG_CLEAR=y
-CONFIG_DEALLOCVT=y
-CONFIG_DUMPKMAP=y
-CONFIG_LOADFONT=y
-CONFIG_LOADKMAP=y
-CONFIG_OPENVT=y
-CONFIG_RESET=y
-# CONFIG_RESIZE is not set
-# CONFIG_FEATURE_RESIZE_PRINT is not set
-CONFIG_SETCONSOLE=y
-# CONFIG_FEATURE_SETCONSOLE_LONG_OPTIONS is not set
-CONFIG_SETKEYCODES=y
-# CONFIG_SETLOGCONS is not set
-
-#
-# Debian Utilities
-#
-CONFIG_MKTEMP=y
-# 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=y
-
-#
-# Editors
-#
-# CONFIG_AWK is not set
-# CONFIG_FEATURE_AWK_MATH is not set
-CONFIG_CMP=y
-CONFIG_DIFF=y
-CONFIG_FEATURE_DIFF_BINARY=y
-CONFIG_FEATURE_DIFF_DIR=y
-# CONFIG_FEATURE_DIFF_MINIMAL is not set
-# CONFIG_ED is not set
-# CONFIG_PATCH is not set
-CONFIG_SED=y
-CONFIG_VI=y
-CONFIG_FEATURE_VI_MAX_LEN=1024
-CONFIG_FEATURE_VI_COLON=y
-CONFIG_FEATURE_VI_YANKMARK=y
-CONFIG_FEATURE_VI_SEARCH=y
-CONFIG_FEATURE_VI_USE_SIGNALS=y
-CONFIG_FEATURE_VI_DOT_CMD=y
-CONFIG_FEATURE_VI_READONLY=y
-CONFIG_FEATURE_VI_SETOPTS=y
-CONFIG_FEATURE_VI_SET=y
-CONFIG_FEATURE_VI_WIN_RESIZE=y
-CONFIG_FEATURE_VI_OPTIMIZE_CURSOR=y
-CONFIG_FEATURE_ALLOW_EXEC=y
-
-#
-# Finding Utilities
-#
-CONFIG_FIND=y
-CONFIG_FEATURE_FIND_PRINT0=y
-CONFIG_FEATURE_FIND_MTIME=y
-CONFIG_FEATURE_FIND_MMIN=y
-CONFIG_FEATURE_FIND_PERM=y
-CONFIG_FEATURE_FIND_TYPE=y
-CONFIG_FEATURE_FIND_XDEV=y
-CONFIG_FEATURE_FIND_MAXDEPTH=y
-CONFIG_FEATURE_FIND_NEWER=y
-CONFIG_FEATURE_FIND_INUM=y
-CONFIG_FEATURE_FIND_EXEC=y
-CONFIG_FEATURE_FIND_USER=y
-CONFIG_FEATURE_FIND_GROUP=y
-CONFIG_FEATURE_FIND_NOT=y
-CONFIG_FEATURE_FIND_DEPTH=y
-CONFIG_FEATURE_FIND_PAREN=y
-CONFIG_FEATURE_FIND_SIZE=y
-CONFIG_FEATURE_FIND_PRUNE=y
-# CONFIG_FEATURE_FIND_DELETE is not set
-CONFIG_FEATURE_FIND_PATH=y
-CONFIG_FEATURE_FIND_REGEX=y
-# CONFIG_FEATURE_FIND_CONTEXT is not set
-CONFIG_GREP=y
-CONFIG_FEATURE_GREP_EGREP_ALIAS=y
-CONFIG_FEATURE_GREP_FGREP_ALIAS=y
-CONFIG_FEATURE_GREP_CONTEXT=y
-CONFIG_XARGS=y
-# CONFIG_FEATURE_XARGS_SUPPORT_CONFIRMATION is not set
-CONFIG_FEATURE_XARGS_SUPPORT_QUOTES=y
-CONFIG_FEATURE_XARGS_SUPPORT_TERMOPT=y
-CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM=y
-
-#
-# Init Utilities
-#
-CONFIG_INIT=y
-# CONFIG_DEBUG_INIT is not set
-CONFIG_FEATURE_USE_INITTAB=y
-# CONFIG_FEATURE_INIT_SCTTY is not set
-# CONFIG_FEATURE_INIT_SYSLOG is not set
-CONFIG_FEATURE_EXTRA_QUIET=y
-# CONFIG_FEATURE_INIT_COREDUMPS is not set
-CONFIG_FEATURE_INITRD=y
-CONFIG_HALT=y
-CONFIG_MESG=y
-
-#
-# Login/Password Management Utilities
-#
-CONFIG_FEATURE_SHADOWPASSWDS=y
-# CONFIG_USE_BB_SHADOW is not set
-# CONFIG_USE_BB_PWD_GRP 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_ADDUSER is not set
-# CONFIG_DELUSER is not set
-CONFIG_GETTY=y
-# CONFIG_FEATURE_UTMP is not set
-# CONFIG_FEATURE_WTMP is not set
-CONFIG_LOGIN=y
-# CONFIG_PAM is not set
-# CONFIG_LOGIN_SCRIPTS is not set
-CONFIG_FEATURE_NOLOGIN=y
-# CONFIG_FEATURE_SECURETTY is not set
-CONFIG_PASSWD=y
-CONFIG_FEATURE_PASSWD_WEAK_CHECK=y
-# CONFIG_CRYPTPW is not set
-CONFIG_CHPASSWD=y
-# 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 mdadm Utilities
-#
-CONFIG_MDADM=y
-
-#
-# Linux Module Utilities
-#
-CONFIG_INSMOD=y
-# 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_RMMOD=y
-CONFIG_LSMOD=y
-CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT=y
-CONFIG_MODPROBE=y
-CONFIG_FEATURE_MODPROBE_MULTIPLE_OPTIONS=y
-CONFIG_FEATURE_MODPROBE_FANCY_ALIAS=y
-
-#
-# Options common to multiple modutils
-#
-CONFIG_FEATURE_CHECK_TAINTED_MODULE=y
-CONFIG_FEATURE_2_4_MODULES=y
-CONFIG_FEATURE_2_6_MODULES=y
-# CONFIG_FEATURE_QUERY_MODULE_INTERFACE is not set
-
-#
-# Linux System Utilities
-#
-CONFIG_DMESG=y
-CONFIG_FEATURE_DMESG_PRETTY=y
-# 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=y
-CONFIG_FDISK_SUPPORT_LARGE_DISKS=y
-CONFIG_FEATURE_FDISK_WRITABLE=y
-CONFIG_FEATURE_AIX_LABEL=y
-CONFIG_FEATURE_SGI_LABEL=y
-CONFIG_FEATURE_SUN_LABEL=y
-CONFIG_FEATURE_OSF_LABEL=y
-CONFIG_FEATURE_FDISK_ADVANCED=y
-CONFIG_FREERAMDISK=y
-# CONFIG_FSCK_MINIX is not set
-# CONFIG_MKFS_MINIX is not set
-# CONFIG_FEATURE_MINIX2 is not set
-# CONFIG_GETOPT is not set
-CONFIG_HEXDUMP=y
-# 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=y
-CONFIG_MDEV=y
-CONFIG_FEATURE_MDEV_CONF=y
-CONFIG_FEATURE_MDEV_EXEC=y
-CONFIG_FEATURE_MDEV_LOAD_FIRMWARE=y
-CONFIG_MDSTART=y
-CONFIG_MKSWAP=y
-# CONFIG_FEATURE_MKSWAP_V0 is not set
-CONFIG_MORE=y
-CONFIG_FEATURE_USE_TERMIOS=y
-CONFIG_MOUNT=y
-CONFIG_FEATURE_MOUNT_NFS=y
-CONFIG_FEATURE_MOUNT_CIFS=y
-CONFIG_FEATURE_MOUNT_FLAGS=y
-CONFIG_FEATURE_MOUNT_FSTAB=y
-CONFIG_PIVOT_ROOT=y
-CONFIG_RDATE=y
-# CONFIG_READPROFILE is not set
-# CONFIG_SETARCH is not set
-CONFIG_SWAPONOFF=y
-CONFIG_SWITCH_ROOT=y
-CONFIG_UMOUNT=y
-CONFIG_FEATURE_UMOUNT_ALL=y
-
-#
-# Common options for mount/umount
-#
-CONFIG_FEATURE_MOUNT_LOOP=y
-CONFIG_FEATURE_MTAB_SUPPORT=y
-
-#
-# Miscellaneous Utilities
-#
-# CONFIG_ADJTIMEX is not set
-CONFIG_BBCONFIG=y
-# CONFIG_CHRT is not set
-# CONFIG_CROND is not set
-# CONFIG_DEBUG_CROND_OPTION is not set
-# CONFIG_FEATURE_CROND_CALL_SENDMAIL is not set
-# CONFIG_CRONTAB is not set
-CONFIG_DC=y
-# 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_EJECT is not set
-# CONFIG_LAST is not set
-# CONFIG_LESS is not set
-CONFIG_FEATURE_LESS_MAXLINES=
-# CONFIG_FEATURE_LESS_BRACKETS is not set
-# CONFIG_FEATURE_LESS_FLAGS is not set
-# CONFIG_FEATURE_LESS_FLAGCS is not set
-# CONFIG_FEATURE_LESS_MARKS is not set
-# CONFIG_FEATURE_LESS_REGEXP 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=y
-CONFIG_FEATURE_MAKEDEVS_LEAF=y
-# CONFIG_FEATURE_MAKEDEVS_TABLE is not set
-CONFIG_MOUNTPOINT=y
-CONFIG_MT=y
-# CONFIG_RAIDAUTORUN is not set
-# CONFIG_READAHEAD is not set
-# CONFIG_RUNLEVEL is not set
-# CONFIG_RX is not set
-CONFIG_STRINGS=y
-# CONFIG_SETSID is not set
-# CONFIG_TASKSET is not set
-# CONFIG_FEATURE_TASKSET_FANCY is not set
-CONFIG_TIME=y
-# CONFIG_TTYSIZE is not set
-# CONFIG_WATCHDOG is not set
-
-#
-# Networking Utilities
-#
-# CONFIG_FEATURE_IPV6 is not set
-CONFIG_VERBOSE_RESOLUTION_ERRORS=y
-# CONFIG_ARP is not set
-# CONFIG_ARPING is not set
-# CONFIG_DNSD is not set
-# CONFIG_ETHER_WAKE is not set
-# CONFIG_FAKEIDENTD is not set
-CONFIG_FTPGET=y
-CONFIG_FTPPUT=y
-# CONFIG_FEATURE_FTPGETPUT_LONG_OPTIONS is not set
-CONFIG_HOSTNAME=y
-# CONFIG_HTTPD is not set
-# CONFIG_FEATURE_HTTPD_USE_SENDFILE is not set
-# CONFIG_FEATURE_HTTPD_RELOAD_CONFIG_SIGHUP 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_CONFIG_WITH_MIME_TYPES 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_IFCONFIG=y
-CONFIG_FEATURE_IFCONFIG_STATUS=y
-# CONFIG_FEATURE_IFCONFIG_SLIP is not set
-CONFIG_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ=y
-CONFIG_FEATURE_IFCONFIG_HW=y
-CONFIG_FEATURE_IFCONFIG_BROADCAST_PLUS=y
-# CONFIG_IFUPDOWN is not set
-CONFIG_IFUPDOWN_IFSTATE_PATH="/var/run/ifstate"
-# 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_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=y
-CONFIG_FEATURE_IPCALC_FANCY=y
-# CONFIG_FEATURE_IPCALC_LONG_OPTIONS is not set
-# CONFIG_NAMEIF is not set
-CONFIG_NC=y
-CONFIG_NC_SERVER=y
-# CONFIG_NC_EXTRA is not set
-CONFIG_NETSTAT=y
-# CONFIG_FEATURE_NETSTAT_WIDE is not set
-CONFIG_NSLOOKUP=y
-CONFIG_PING=y
-# CONFIG_PING6 is not set
-# CONFIG_PSCAN is not set
-CONFIG_FEATURE_FANCY_PING=y
-CONFIG_ROUTE=y
-# 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_FEATURE_TFTP_GET is not set
-# CONFIG_FEATURE_TFTP_PUT is not set
-# CONFIG_FEATURE_TFTP_BLOCKSIZE is not set
-# CONFIG_DEBUG_TFTP is not set
-CONFIG_TRACEROUTE=y
-CONFIG_FEATURE_TRACEROUTE_VERBOSE=y
-CONFIG_FEATURE_TRACEROUTE_SOURCE_ROUTE=y
-CONFIG_FEATURE_TRACEROUTE_USE_ICMP=y
-# 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_APP_UDHCPC=y
-# CONFIG_FEATURE_UDHCP_DEBUG is not set
-# CONFIG_FEATURE_RFC3397 is not set
-CONFIG_VCONFIG=y
-CONFIG_WGET=y
-CONFIG_FEATURE_WGET_STATUSBAR=y
-CONFIG_FEATURE_WGET_AUTHENTICATION=y
-# CONFIG_FEATURE_WGET_LONG_OPTIONS is not set
-# CONFIG_ZCIP is not set
-
-#
-# Process Utilities
-#
-CONFIG_FREE=y
-# CONFIG_FUSER is not set
-CONFIG_KILL=y
-CONFIG_KILLALL=y
-# CONFIG_KILLALL5 is not set
-# CONFIG_NMETER is not set
-CONFIG_PIDOF=y
-CONFIG_FEATURE_PIDOF_SINGLE=y
-CONFIG_FEATURE_PIDOF_OMIT=y
-CONFIG_PS=y
-CONFIG_FEATURE_PS_WIDE=y
-CONFIG_RENICE=y
-# CONFIG_BB_SYSCTL is not set
-CONFIG_TOP=y
-CONFIG_FEATURE_TOP_CPU_USAGE_PERCENTAGE=y
-CONFIG_FEATURE_TOP_CPU_GLOBAL_PERCENTS=y
-# CONFIG_FEATURE_TOP_DECIMALS is not set
-CONFIG_UPTIME=y
-# CONFIG_WATCH is not set
-
-#
-# Shells
-#
-CONFIG_FEATURE_SH_IS_ASH=y
-# CONFIG_FEATURE_SH_IS_HUSH is not set
-# CONFIG_FEATURE_SH_IS_LASH is not set
-# CONFIG_FEATURE_SH_IS_MSH is not set
-# CONFIG_FEATURE_SH_IS_NONE is not set
-CONFIG_ASH=y
-
-#
-# Ash Shell Options
-#
-CONFIG_ASH_JOB_CONTROL=y
-CONFIG_ASH_READ_NCHARS=y
-CONFIG_ASH_READ_TIMEOUT=y
-CONFIG_ASH_ALIAS=y
-CONFIG_ASH_MATH_SUPPORT=y
-# CONFIG_ASH_MATH_SUPPORT_64 is not set
-# CONFIG_ASH_GETOPTS is not set
-CONFIG_ASH_BUILTIN_ECHO=y
-CONFIG_ASH_BUILTIN_TEST=y
-# CONFIG_ASH_CMDCMD is not set
-# CONFIG_ASH_MAIL is not set
-CONFIG_ASH_OPTIMIZE_FOR_SIZE=y
-CONFIG_ASH_RANDOM_SUPPORT=y
-# 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_LASH is not set
-# CONFIG_MSH is not set
-
-#
-# Bourne Shell Options
-#
-# CONFIG_FEATURE_SH_EXTRA_QUIET is not set
-# CONFIG_FEATURE_SH_STANDALONE is not set
-# CONFIG_CTTYHACK is not set
-
-#
-# System Logging Utilities
-#
-CONFIG_SYSLOGD=y
-# CONFIG_FEATURE_ROTATE_LOGFILE is not set
-# CONFIG_FEATURE_REMOTE_LOG is not set
-CONFIG_FEATURE_IPC_SYSLOG=y
-CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE=16
-CONFIG_LOGREAD=y
-# CONFIG_FEATURE_LOGREAD_REDUCED_LOCKING is not set
-CONFIG_KLOGD=y
-CONFIG_LOGGER=y
-
-#
-# Runit Utilities
-#
-# CONFIG_RUNSV is not set
-# CONFIG_RUNSVDIR is not set
-# CONFIG_SV is not set
-# 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
-
-#
-# ipsvd utilities
-#
-# CONFIG_TCPSVD is not set
-# CONFIG_UDPSVD is not set
diff --git a/netboot/linuxrc.x b/netboot/linuxrc.x
deleted file mode 100755
index 8586ff6..0000000
--- a/netboot/linuxrc.x
+++ /dev/null
@@ -1,347 +0,0 @@
-#!/bin/ash
-
-# Copyright 2001-2007 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License, v2 or later
-
-export PATH="/usr/sbin:/usr/bin:/sbin:/bin"
-
-#// Path, basic vars
-#//--------------------------------------------------------------------------------
-
-BasicSetup() {
- #// Copyright year, Build date in YYYYMMDD format, and in MMDDYYYY to make busybox 'date' happy
- MYDATE="`/bin/cat /etc/build_date`"
- CPYYEAR="$(echo ${MYDATE} | cut -c 1-4)"
- BBDATE="$(echo ${MYDATE} | cut -c 5-8)$(echo ${MYDATE} | cut -c 1-4)"
- DISDATE="$(echo ${MYDATE} | cut -c 7-8) $(echo ${MYDATE} | cut -c 5-6) $(echo ${MYDATE} | cut -c 1-4)"
-}
-#//--------------------------------------------------------------------------------
-
-
-
-#// Startup Tasks
-#//--------------------------------------------------------------------------------
-
-StartUp() {
- if [ ! -f "/tmp/.startup" ]; then
- #// Mount proc && sys
- mount proc /proc -t proc # /proc
- mount sys /sys -t sysfs # /sys
- mount mdev /dev -t tmpfs -o size=800k # /dev for mdev
-
- #// Let busybox build its applets
- /bin/busybox --install -s
-
- #// Create additional mount points
- mkdir /dev/pts
- mkdir /dev/shm
- mkdir -p /mnt/cdrom
- mkdir /mnt/floppy
- mkdir /mnt/gentoo
- mkdir /tmp
-
- #// Mount remaining filesystems
- mount tmp /tmp -t tmpfs # /tmp
- mount devpts /dev/pts -t devpts # /dev/pts
- mount shm /dev/shm -t tmpfs -o size=512k # /dev/shm
-
- #// Create mtab
- ln -sf /proc/mounts /etc/mtab # mtab (symlink -> /proc/mounts)
-
- #// Start mdev
- echo "/sbin/mdev" > /proc/sys/kernel/hotplug # mdev handles hotplug events
- /sbin/mdev -s # have mdev populate /dev
-
- #// Create standard (non-mdev) devices
- if [ ! -e /dev/md0 ]
- then
- makedevs /dev/md b 9 0 0 7
- fi
-
- if [ ! -e /dev/tty0 ]
- then
- makedevs /dev/tty c 4 0 0 12
- fi
-
- # We probably don't need any of these anymore with mdev
-# makedevs /dev/ptyp c 2 0 0 9
-# makedevs /dev/ttyp c 3 0 0 9
-# makedevs /dev/ttyq c 3 16 0 9
-# makedevs /dev/ttyS c 4 64 0 3
-# mknod /dev/console c 5 1
-# mknod /dev/kmsg c 1 11
-# mknod /dev/null c 1 3
-# mknod /dev/tty c 5 0
-# mknod /dev/urandom c 1 9
-# ln -s /dev/urandom /dev/random
-# mknod /dev/zero c 1 5
-
- #// Create std* devices
- ln -snf /proc/self/fd /dev/fd
- ln -snf /proc/self/fd/0 /dev/stdin
- ln -snf /proc/self/fd/1 /dev/stdout
- ln -snf /proc/self/fd/2 /dev/stderr
-
- #// Make some misc directories
- mkdir /var/log
- mkdir /var/run
-
- #// Start a minimal logger
- klogd
- syslogd
-
- #// Hostname
- hostname netboot
-
- if [ -n "`which dropbear 2>/dev/null`" ]
- then
- # Setup dropbear (sshd)
- echo -e ""
- mkdir /etc/dropbear
- echo -e ">>> Generating RSA hostkey ..."
- dropbearkey -t rsa -f /etc/dropbear/dropbear_rsa_host_key
- echo -e ""
- echo -e ">>> Generating DSS hostkey ..."
- dropbearkey -t dss -f /etc/dropbear/dropbear_dss_host_key
- echo -e ""
- dropbear
- fi
-
- #// Misc tasks
- chmod +x /bin/net-setup
- chmod +x /bin/ashlogin
- fi
-}
-
-#//--------------------------------------------------------------------------------
-
-
-
-#// Informative Message (copied from Gentoo /sbin/functions.sh)
-#//--------------------------------------------------------------------------------
-
-#// show an informative message (with a newline)
-einfo() {
- echo -e " * ${*}"
- return 0
-}
-
-#//--------------------------------------------------------------------------------
-
-
-
-#// Determine Mips Machine Type
-#//--------------------------------------------------------------------------------
-
-DetectMips() {
- MYARCH="MIPS"
- MACHINFO="$(cat /proc/cpuinfo | grep "system type" | tr -d "\t" | sed -e "s/: /:/g" | cut -d":" -f2)"
- CPUINFO="$(cat /proc/cpuinfo | grep "cpu model" | tr -d "\t" | sed -e "s/: /:/g" | cut -d":" -f2)"
- case "${MACHINFO}" in
- "SGI Indy") MACHTYPE="SGI Indy" ;; # Indy R4x00/R5000
- "SGI Indigo2")
- case "${CPUINFO}" in
- R4*) MACHTYPE="SGI Indigo2" ;; # I2 R4x00
- R8*) MACHTYPE="SGI Indigo2 Power" ;; # I2 R8000
- R10*) MACHTYPE="SGI Indigo2 Impact" ;; # I2 R10000
- esac
- ;;
- "SGI O2"|"SGI IP32") MACHTYPE="SGI O2" ;; # O2 R5K/RM5K2/RM7K/R10K/R12K
- "SGI Octane"|"SGI IP30") MACHTYPE="SGI Octane" ;; # Octane R10K/R12K/R14K
- "SGI Origin"|"SGI IP27") MACHTYPE="SGI Origin" ;; # Origin 200/2000 R10K/R12K
- "MIPS Cobalt"|*RaQ*|*Qube*) MACHTYPE="Cobalt Microserver" ;; # Cobalt Qube/RaQ (1/2)
- *) MACHTYPE="Unknown MIPS" ;; # ???
- esac
-}
-
-#//--------------------------------------------------------------------------------
-
-
-
-#// Determine Sparc Machine Type
-#//--------------------------------------------------------------------------------
-
-DetectSparc() {
- MYARCH="SPARC"
- MACHINFO="$(cat /proc/cpuinfo | grep "type" | tr -d "\t" | sed -e "s/: /:/g" | cut -d":" -f2)"
-
- case "${MACHINFO}" in
- sun4u) MACHTYPE="Sun UltraSparc" ;; # Sparc64
- sun4c|sun4d|sun4m) MACHTYPE="Sun Sparc32" ;; # Sparc32
- *) MACHTYPE="Unknown SPARC" ;; # ???
- esac
-}
-
-#//--------------------------------------------------------------------------------
-
-
-
-#// Determine Ppc Machine Type
-#//--------------------------------------------------------------------------------
-
-DetectPpc() {
- MACHINFO="$(cat /proc/cpuinfo | grep "machine" | tr -d "\t" | sed -e "s/: /:/g" | cut -d":" -f2)"
-
- case "${ARCHINFO}" in
- ppc)
- MYARCH="PPC"
- case "${MACHINFO}" in
- PowerMac*) MACHTYPE="Apple PowerMac" ;; # PowerMac
- PowerBook*) MACHTYPE="Apple PowerBook" ;; # PowerBook
- "CHRP Pegasos") MACHTYPE="Pegasos" ;; # Pegasos
- CHRP*|PReP) MACHTYPE="IBM PPC-Based" ;; # IBM PPC
- Amiga) MACHTYPE="Amiga" ;; # Amiga
- *) MACHTYPE="Unknown PPC" ;; # ???
- esac
- ;;
-
- ppc64)
- MYARCH="PPC64"
- case "${MACHINFO}" in
- PowerMac*) MACHTYPE="Apple G5" ;; # Apple G5
- CHRP*|PReP) MACHTYPE="IBM PPC-Based" ;; # IBM PPC
- *iSeries*) MACHTYPE="iSeries (Old)" ;; # Old iSeries
- *) MACHTYPE="Unknown PPC64" ;; # ???
- esac
- ;;
- esac
-}
-
-#//--------------------------------------------------------------------------------
-
-
-
-#// Discover if the network is already running for us or not
-#//--------------------------------------------------------------------------------
-
-DetectNetwork() {
- if [ ! -f "/tmp/.startup" ]; then
- #// If this image is loaded via NFS Root, chances are the network is autoconfigured for us
- if [ ! -z "$(ifconfig | grep "eth0")" ]; then
- MYIP="$(ifconfig | grep "inet addr" | cut -d":" -f2 | cut -d" " -f1 | head -n 1)"
- MYGW="$(route | grep default | cut -d" " -f10)"
- fi
- fi
-}
-
-#//--------------------------------------------------------------------------------
-
-
-
-#// For those in the Church of the SubGenius...
-#//--------------------------------------------------------------------------------
-
-SubGenius() {
- BUILDDATE="Build Date: $(date -d ${BBDATE} +"%B %d, %Y")"
- for CMDLINE in $(cat /proc/cmdline); do
- if [ "${CMDLINE}" = "discord" ]; then
- BUILDDATE="$(ddate +'Built on %{%A, the %e day of %B%} in the YOLD %Y. %NCelebrate %H!' ${DISDATE})"
- fi
- done
-}
-#//--------------------------------------------------------------------------------
-
-
-
-#// Basic Startup Stuff
-#//--------------------------------------------------------------------------------
-
-GenMotd() {
- echo -e "" > /etc/motd
- echo -e "" >> /etc/motd
- echo -e "Gentoo Linux; http://www.gentoo.org/" >> /etc/motd
- echo -e " Copyright 2001-${CPYYEAR} Gentoo Foundation; Distributed under the GPL" >> /etc/motd
- echo -e "" >> /etc/motd
- echo -e " Gentoo/${MYARCH} Netboot for ${MACHTYPE} Systems" >> /etc/motd
- echo -e " ${BUILDDATE}" >> /etc/motd
- echo -e "" >> /etc/motd
-
- #// If this is the initial startup, then display some messages, otherwise just execute a shell for the user
- if [ ! -f "/tmp/.startup" ]; then
- if [ -z "${MYIP}" ]; then
- einfo "To configure networking (eth0), do the following:" > /etc/motd2
- echo -e "" >> /etc/motd2
- einfo "For Static IP:" >> /etc/motd2
- einfo "/bin/net-setup <IP Address> <Gateway Address>" >> /etc/motd2
- echo -e "" >> /etc/motd2
- einfo "For Dynamic IP:" >> /etc/motd2
- einfo "/bin/net-setup dhcp" >> /etc/motd2
- echo -e "" >> /etc/motd2
- else
- echo -e "" > /etc/motd2
- einfo "Network interface eth0 has been started:" >> /etc/motd2
- einfo " IP Address: ${MYIP}" >> /etc/motd2
- einfo " Gateway: ${MYGW}" >> /etc/motd2
- echo -e "" >> /etc/motd2
- einfo "An sshd server is available on port 22. Please set a root" >> /etc/motd2
- einfo "password via \"passwd\" before using." >> /etc/motd2
- echo -e "" >> /etc/motd2
- fi
- fi
-}
-
-#//--------------------------------------------------------------------------------
-
-
-
-#// Display Motd
-#//--------------------------------------------------------------------------------
-
-DisplayMotd() {
- cat /etc/motd
- [ -f "/etc/motd2" ] && cat /etc/motd2
-}
-
-#//--------------------------------------------------------------------------------
-
-
-
-#// Launch Shell
-#//--------------------------------------------------------------------------------
-
-LaunchShell() {
- #// Completed Startup
- touch /tmp/.startup
-
- for i in 2 3 4 5 6; do
- getty -n -l /bin/ashlogin 38400 tty${i} &
- done
-
-# # We run the getty for tty1 in the foreground so our pid 1 doesn't end
-# getty -n -l /bin/ashlogin 38400 tty1
-
- # We were running the above code, but that doesn't work well on serial. Until
- # we can autodetect a serial console and start a getty there, we'll just run
- # ash on /dev/console
- /bin/ash
-}
-
-#//--------------------------------------------------------------------------------
-
-
-
-#// Main
-#//--------------------------------------------------------------------------------
-
-BasicSetup
-StartUp
-
-#// Detect Arch
-ARCHINFO="$(uname -m)"
-case "${ARCHINFO}" in
- mips*) DetectMips ;;
- sparc*) DetectSparc
- mount -t openpromfs openprom /proc/openprom
- ;;
- ppc*) DetectPpc ;;
- *) MACHTYPE=$ARCHINFO ;;
-esac
-
-DetectNetwork
-SubGenius
-GenMotd
-DisplayMotd
-LaunchShell
-
-#//--------------------------------------------------------------------------------
-
diff --git a/netboot/misc/bin/ashlogin b/netboot/misc/bin/ashlogin
deleted file mode 100755
index 67daded..0000000
--- a/netboot/misc/bin/ashlogin
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/ash
-
-exec /bin/ash -i
-
diff --git a/netboot/misc/bin/net-setup b/netboot/misc/bin/net-setup
deleted file mode 100755
index 91c408a..0000000
--- a/netboot/misc/bin/net-setup
+++ /dev/null
@@ -1,93 +0,0 @@
-#!/bin/ash
-
-MYIP=""
-MYGW=""
-
-
-#// Modified Functions copied from Gentoo's /sbin/functions.sh
-#//--------------------------------------------------------------------------------
-
-# void einfo(char* message)
-# show an informative message (with a newline)
-einfo() {
- echo -e " * ${*}"
- return 0
-}
-
-#//--------------------------------------------------------------------------------
-
-
-
-#// Setup networking
-#//--------------------------------------------------------------------------------
-
-SetupNetwork() {
- #// DHCP or Static?
- if [ "${1}" = "dhcp" ]; then
- #// Do DHCP
- udhcpc -i eth0 -q
- else
-
- #// Check second param
- if [ -z "${2}" ]; then
- echo -e ""
- einfo "Please specify a gateway address."
- echo -e ""
- exit
- fi
-
- #// Get networking params
- BROADCAST="$(ipcalc -b ${1} | cut -d\= -f2)"
- NETMASK="$(ipcalc -m ${1} | cut -d\= -f2)"
-
- #// Enable static networking
- /sbin/ifconfig eth0 ${1} broadcast ${BROADCAST} netmask ${NETMASK}
- /sbin/route add -net default gw ${2} netmask 0.0.0.0 metric 1
- fi
-
- #// Setup the loopback
- /sbin/ifconfig lo 127.0.0.1
- /sbin/route add -net 127.0.0.0 netmask 255.0.0.0 gw 127.0.0.1 dev lo
-
- #// Finish
- MYIP="${1}"
- MYGW="${2}"
-}
-
-#//--------------------------------------------------------------------------------
-
-
-
-#// Main Function
-#//--------------------------------------------------------------------------------
-
-#// Check first param
-if [ -z "${1}" ]; then
- echo -e ""
- einfo "Please specify \"dhcp\" for setting up networking via dhcp or"
- einfo "specify an IP Address and gateway address to configure static"
- einfo "networking."
- echo -e ""
- exit 0
-fi
-
-
-#// Setup the Network
-SetupNetwork ${1} ${2} ${3}
-
-
-#// Was the network setup?
-if [ ! -z "$(ifconfig | grep "eth0")" ]; then
- echo -e ""
- einfo "Network interface eth0 has been started:"
- einfo " IP Address: ${MYIP}"
- einfo " Gateway: ${MYGW}"
- echo -e ""
- einfo "An sshd server is available on port 22. Please set a root"
- einfo "password via \"passwd\" before using."
- echo -e ""
- echo -e ""
-fi
-
-#//--------------------------------------------------------------------------------
-
diff --git a/netboot/misc/etc/fstab b/netboot/misc/etc/fstab
deleted file mode 100644
index b02d3de..0000000
--- a/netboot/misc/etc/fstab
+++ /dev/null
@@ -1,10 +0,0 @@
-# /etc/fstab: static file system information.
-# <fs> <mountpoint> <type> <opts> <dump/pass>
-
-#// Main Filesystems
-none /tmp tmpfs defaults,rw 0 0
-
-#// Miscellaneous Filesystems
-proc /proc proc defaults 0 0
-sysfs /sys sysfs defaults 0 0
-tmpfs /dev/shm tmpfs defaults 0 0
diff --git a/netboot/misc/etc/group b/netboot/misc/etc/group
deleted file mode 100644
index 63d63ab..0000000
--- a/netboot/misc/etc/group
+++ /dev/null
@@ -1,2 +0,0 @@
-root:x:0:root
-nobody:x:65534:
diff --git a/netboot/misc/etc/inittab b/netboot/misc/etc/inittab
deleted file mode 100644
index aee5028..0000000
--- a/netboot/misc/etc/inittab
+++ /dev/null
@@ -1,15 +0,0 @@
-# /etc/inittab init(8) configuration for BusyBox
-#
-# Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
-
-
-::sysinit:/linuxrc
-::askfirst:-/bin/ash
-#tty2::askfirst:-/bin/ash
-#tty3::askfirst:-/bin/ash
-#tty4::askfirst:-/bin/ash
-::restart:/sbin/init
-::ctrlaltdel:/sbin/reboot
-::shutdown:/bin/umount -a -r
-::shutdown:/sbin/swapoff -a
-
diff --git a/netboot/misc/etc/passwd b/netboot/misc/etc/passwd
deleted file mode 100644
index 394abe8..0000000
--- a/netboot/misc/etc/passwd
+++ /dev/null
@@ -1,2 +0,0 @@
-root:x:0:0:root:/root:/bin/ash
-nobody:x:65534:65534:nobody:/:/bin/false
diff --git a/netboot/misc/etc/profile b/netboot/misc/etc/profile
deleted file mode 100644
index 8825c66..0000000
--- a/netboot/misc/etc/profile
+++ /dev/null
@@ -1 +0,0 @@
-export PATH="/usr/bin:/usr/sbin:/bin:/sbin"
diff --git a/netboot/misc/etc/resolv.conf b/netboot/misc/etc/resolv.conf
deleted file mode 100644
index a3434c0..0000000
--- a/netboot/misc/etc/resolv.conf
+++ /dev/null
@@ -1,3 +0,0 @@
-nameserver 204.117.214.10
-nameserver 199.2.252.10
-nameserver 204.97.212.10
diff --git a/netboot/misc/etc/shadow b/netboot/misc/etc/shadow
deleted file mode 100644
index f3d078e..0000000
--- a/netboot/misc/etc/shadow
+++ /dev/null
@@ -1,2 +0,0 @@
-root:*:10770:0:::::
-nobody:*:9797:0:::::
diff --git a/netboot/misc/etc/shells b/netboot/misc/etc/shells
deleted file mode 100644
index 5f7a488..0000000
--- a/netboot/misc/etc/shells
+++ /dev/null
@@ -1,2 +0,0 @@
-/bin/sh
-/bin/ash
diff --git a/netboot/misc/usr/share/terminfo/p/putty b/netboot/misc/usr/share/terminfo/p/putty
deleted file mode 100644
index dd5a81a..0000000
--- a/netboot/misc/usr/share/terminfo/p/putty
+++ /dev/null
Binary files differ
diff --git a/patches/busybox/1.7.4/1.7.4-ash-timeout.diff b/patches/busybox/1.7.4/1.7.4-ash-timeout.diff
deleted file mode 100644
index 25d5338..0000000
--- a/patches/busybox/1.7.4/1.7.4-ash-timeout.diff
+++ /dev/null
@@ -1,123 +0,0 @@
-'read -t' support, forward-ported from Gentoo Busybox 1.1.3.
-Used during the LiveCD boot when prompting for a keymap.
-
-Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
-
-diff -Nuar --exclude '*.orig' busybox-1.7.4/shell/ash.c busybox-1.7.4+gentoo/shell/ash.c
---- busybox-1.7.4/shell/ash.c 2007-11-03 16:06:35.000000000 -0700
-+++ busybox-1.7.4+gentoo/shell/ash.c 2008-03-11 10:21:28.000000000 -0700
-@@ -11485,11 +11485,13 @@
- int startword;
- int status;
- int i;
-+#if ENABLE_ASH_READ_NCHARS || ENABLE_ASH_READ_TIMEOUT
-+ struct termios tty, old_tty;
-+#endif
- #if ENABLE_ASH_READ_NCHARS
- int nch_flag = 0;
- int nchars = 0;
- int silent = 0;
-- struct termios tty, old_tty;
- #endif
- #if ENABLE_ASH_READ_TIMEOUT
- fd_set set;
-@@ -11566,44 +11568,74 @@
- ifs = bltinlookup("IFS");
- if (ifs == NULL)
- ifs = defifs;
--#if ENABLE_ASH_READ_NCHARS
-+#if ENABLE_ASH_READ_NCHARS || ENABLE_ASH_READ_TIMEOUT
-+#if ENABLE_ASH_READ_NCHARS && ENABLE_ASH_READ_TIMEOUT
-+ if (nch_flag || silent || ts.tv_sec || ts.tv_usec) {
-+#elif ENABLE_ASH_READ_TIMEOUT
-+ if (ts.tv_sec || ts.tv_usec) {
-+#elif ENABLE_ASH_READ_NCHARS
- if (nch_flag || silent) {
-+#endif
- tcgetattr(0, &tty);
- old_tty = tty;
-- if (nch_flag) {
-+#if ENABLE_ASH_READ_NCHARS && ENABLE_ASH_READ_TIMEOUT
-+ if (nch_flag || ts.tv_sec || ts.tv_usec)
-+#elif ENABLE_ASH_READ_TIMEOUT
-+ if (ts.tv_sec || ts.tv_usec)
-+#elif ENABLE_ASH_READ_NCHARS
-+ if (nch_flag)
-+#endif
- tty.c_lflag &= ~ICANON;
-- tty.c_cc[VMIN] = nchars;
-- }
-- if (silent) {
-- tty.c_lflag &= ~(ECHO|ECHOK|ECHONL);
-
-- }
-+
-+#if ENABLE_ASH_READ_NCHARS
-+ if (silent)
-+ tty.c_lflag &= ~(ECHO|ECHOK|ECHONL);
-+#endif
- tcsetattr(0, TCSANOW, &tty);
- }
- #endif
-+ i = 1;
-+ STARTSTACKSTR(p);
- #if ENABLE_ASH_READ_TIMEOUT
- if (ts.tv_sec || ts.tv_usec) {
- FD_ZERO(&set);
- FD_SET(0, &set);
-
- i = select(FD_SETSIZE, &set, NULL, NULL, &ts);
-- if (!i) {
-+ if (i == 1)
-+ {
-+ read(0, &c, 1);
-+ if(c == '\n' || c == 4) /* Handle newlines and EOF */
-+ i = 0; /* Don't read further... */
-+ else
-+ STPUTC(c, p); /* Ok, keep reading... */
-+ }
- #if ENABLE_ASH_READ_NCHARS
-- if (nch_flag)
-- tcsetattr(0, TCSANOW, &old_tty);
-+ if (!silent && !nch_flag)
- #endif
-- return 1;
-+ tcsetattr(0, TCSANOW, &old_tty);
-+
-+#if ENABLE_ASH_READ_NCHARS
-+ if(i == 0)
-+ {
-+ nchars = 0;
-+ nch_flag = 1;
-+ } else
-+ {
-+ if (nch_flag)
-+ nchars--;
- }
-+#endif
- }
- #endif
- status = 0;
- startword = 1;
- backslash = 0;
-- STARTSTACKSTR(p);
- #if ENABLE_ASH_READ_NCHARS
- while (!nch_flag || nchars--)
- #else
-- for (;;)
-+ for (;i > 0;)
- #endif
- {
- if (read(0, &c, 1) != 1) {
-@@ -11640,8 +11672,10 @@
- }
- }
- #if ENABLE_ASH_READ_NCHARS
-- if (nch_flag || silent)
-+ if (silent || nch_flag)
- tcsetattr(0, TCSANOW, &old_tty);
-+ if (!silent && nch_flag)
-+ printf("\n");
- #endif
-
- STACKSTRNUL(p);
diff --git a/patches/busybox/1.7.4/1.7.4-mdadm.diff b/patches/busybox/1.7.4/1.7.4-mdadm.diff
deleted file mode 100644
index deb8993..0000000
--- a/patches/busybox/1.7.4/1.7.4-mdadm.diff
+++ /dev/null
@@ -1,5882 +0,0 @@
-Forward-port the mdadm tool from the Gentoo Busybox-1.1.3.
-Should handle all types of metadata 0.90, 1.0, 1.1, 1.2.
-If /etc/mdadm.conf does not exist in the initrd, it is created first, by
-scanning devices, and then it is used.
-
-Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
-
-diff -Nuar --exclude '*.orig' busybox-1.7.4+gentoo/Config.in busybox-1.7.4+gentoo+mdadm/Config.in
---- busybox-1.7.4+gentoo/Config.in 2007-09-03 04:48:58.000000000 -0700
-+++ busybox-1.7.4+gentoo+mdadm/Config.in 2008-03-11 10:31:00.000000000 -0700
-@@ -499,2 +499,3 @@
- source e2fsprogs/Config.in
-+source mdadm/Config.in
- source modutils/Config.in
-diff -Nuar --exclude '*.orig' busybox-1.7.4+gentoo/include/applets.h busybox-1.7.4+gentoo+mdadm/include/applets.h
---- busybox-1.7.4+gentoo/include/applets.h 2008-03-11 10:25:43.000000000 -0700
-+++ busybox-1.7.4+gentoo+mdadm/include/applets.h 2008-03-11 10:32:22.000000000 -0700
-@@ -223,2 +223,3 @@
- USE_MD5SUM(APPLET_ODDNAME(md5sum, md5_sha1_sum, _BB_DIR_USR_BIN, _BB_SUID_NEVER, md5sum))
-+USE_MDADM(APPLET(mdadm, _BB_DIR_SBIN, _BB_SUID_NEVER))
- USE_MDEV(APPLET(mdev, _BB_DIR_SBIN, _BB_SUID_NEVER))
-diff -Nuar --exclude '*.orig' busybox-1.7.4+gentoo/include/usage.h busybox-1.7.4+gentoo+mdadm/include/usage.h
---- busybox-1.7.4+gentoo/include/usage.h 2008-03-11 10:19:04.000000000 -0700
-+++ busybox-1.7.4+gentoo+mdadm/include/usage.h 2008-03-11 10:31:00.000000000 -0700
-@@ -2048,2 +2048,7 @@
-
-+#define mdadm_trivial_usage \
-+ ""
-+#define mdadm_full_usage \
-+ "Assemble or Examine the mdadm arrays."
-+
- #define mdev_trivial_usage \
-diff -Nuar --exclude '*.orig' busybox-1.7.4+gentoo/Makefile busybox-1.7.4+gentoo+mdadm/Makefile
---- busybox-1.7.4+gentoo/Makefile 2007-11-23 20:34:41.000000000 -0800
-+++ busybox-1.7.4+gentoo+mdadm/Makefile 2008-03-11 10:31:49.000000000 -0700
-@@ -442,6 +442,7 @@
- libpwdgrp/ \
- loginutils/ \
- miscutils/ \
-+ mdadm/ \
- modutils/ \
- networking/ \
- networking/libiproute/ \
-diff -Nuar --exclude '*.orig' busybox-1.7.4+gentoo/mdadm/bitmap.h busybox-1.7.4+gentoo+mdadm/mdadm/bitmap.h
---- busybox-1.7.4+gentoo/mdadm/bitmap.h 1969-12-31 16:00:00.000000000 -0800
-+++ busybox-1.7.4+gentoo+mdadm/mdadm/bitmap.h 2008-03-11 10:31:00.000000000 -0700
-@@ -0,0 +1,287 @@
-+/*
-+ * bitmap.h: Copyright (C) Peter T. Breuer (ptb@ot.uc3m.es) 2003
-+ *
-+ * additions: Copyright (C) 2003-2004, Paul Clements, SteelEye Technology, Inc.
-+ */
-+#ifndef BITMAP_H
-+#define BITMAP_H 1
-+
-+#define BITMAP_MAJOR_LO 3
-+/* version 4 insists the bitmap is in little-endian order
-+ * with version 3, it is host-endian which is non-portable
-+ */
-+#define BITMAP_MAJOR_HI 4
-+#define BITMAP_MAJOR_HOSTENDIAN 3
-+
-+#define BITMAP_MINOR 39
-+
-+/*
-+ * in-memory bitmap:
-+ *
-+ * Use 16 bit block counters to track pending writes to each "chunk".
-+ * The 2 high order bits are special-purpose, the first is a flag indicating
-+ * whether a resync is needed. The second is a flag indicating whether a
-+ * resync is active.
-+ * This means that the counter is actually 14 bits:
-+ *
-+ * +--------+--------+------------------------------------------------+
-+ * | resync | resync | counter |
-+ * | needed | active | |
-+ * | (0-1) | (0-1) | (0-16383) |
-+ * +--------+--------+------------------------------------------------+
-+ *
-+ * The "resync needed" bit is set when:
-+ * a '1' bit is read from storage at startup.
-+ * a write request fails on some drives
-+ * a resync is aborted on a chunk with 'resync active' set
-+ * It is cleared (and resync-active set) when a resync starts across all drives
-+ * of the chunk.
-+ *
-+ *
-+ * The "resync active" bit is set when:
-+ * a resync is started on all drives, and resync_needed is set.
-+ * resync_needed will be cleared (as long as resync_active wasn't already set).
-+ * It is cleared when a resync completes.
-+ *
-+ * The counter counts pending write requests, plus the on-disk bit.
-+ * When the counter is '1' and the resync bits are clear, the on-disk
-+ * bit can be cleared aswell, thus setting the counter to 0.
-+ * When we set a bit, or in the counter (to start a write), if the fields is
-+ * 0, we first set the disk bit and set the counter to 1.
-+ *
-+ * If the counter is 0, the on-disk bit is clear and the stipe is clean
-+ * Anything that dirties the stipe pushes the counter to 2 (at least)
-+ * and sets the on-disk bit (lazily).
-+ * If a periodic sweep find the counter at 2, it is decremented to 1.
-+ * If the sweep find the counter at 1, the on-disk bit is cleared and the
-+ * counter goes to zero.
-+ *
-+ * Also, we'll hijack the "map" pointer itself and use it as two 16 bit block
-+ * counters as a fallback when "page" memory cannot be allocated:
-+ *
-+ * Normal case (page memory allocated):
-+ *
-+ * page pointer (32-bit)
-+ *
-+ * [ ] ------+
-+ * |
-+ * +-------> [ ][ ]..[ ] (4096 byte page == 2048 counters)
-+ * c1 c2 c2048
-+ *
-+ * Hijacked case (page memory allocation failed):
-+ *
-+ * hijacked page pointer (32-bit)
-+ *
-+ * [ ][ ] (no page memory allocated)
-+ * counter #1 (16-bit) counter #2 (16-bit)
-+ *
-+ */
-+
-+#ifdef __KERNEL__
-+
-+#define PAGE_BITS (PAGE_SIZE << 3)
-+#define PAGE_BIT_SHIFT (PAGE_SHIFT + 3)
-+
-+typedef __u16 bitmap_counter_t;
-+#define COUNTER_BITS 16
-+#define COUNTER_BIT_SHIFT 4
-+#define COUNTER_BYTE_RATIO (COUNTER_BITS / 8)
-+#define COUNTER_BYTE_SHIFT (COUNTER_BIT_SHIFT - 3)
-+
-+#define NEEDED_MASK ((bitmap_counter_t) (1 << (COUNTER_BITS - 1)))
-+#define RESYNC_MASK ((bitmap_counter_t) (1 << (COUNTER_BITS - 2)))
-+#define COUNTER_MAX ((bitmap_counter_t) RESYNC_MASK - 1)
-+#define NEEDED(x) (((bitmap_counter_t) x) & NEEDED_MASK)
-+#define RESYNC(x) (((bitmap_counter_t) x) & RESYNC_MASK)
-+#define COUNTER(x) (((bitmap_counter_t) x) & COUNTER_MAX)
-+
-+/* how many counters per page? */
-+#define PAGE_COUNTER_RATIO (PAGE_BITS / COUNTER_BITS)
-+/* same, except a shift value for more efficient bitops */
-+#define PAGE_COUNTER_SHIFT (PAGE_BIT_SHIFT - COUNTER_BIT_SHIFT)
-+/* same, except a mask value for more efficient bitops */
-+#define PAGE_COUNTER_MASK (PAGE_COUNTER_RATIO - 1)
-+
-+#define BITMAP_BLOCK_SIZE 512
-+#define BITMAP_BLOCK_SHIFT 9
-+
-+/* how many blocks per chunk? (this is variable) */
-+#define CHUNK_BLOCK_RATIO(bitmap) ((bitmap)->chunksize >> BITMAP_BLOCK_SHIFT)
-+#define CHUNK_BLOCK_SHIFT(bitmap) ((bitmap)->chunkshift - BITMAP_BLOCK_SHIFT)
-+#define CHUNK_BLOCK_MASK(bitmap) (CHUNK_BLOCK_RATIO(bitmap) - 1)
-+
-+/* when hijacked, the counters and bits represent even larger "chunks" */
-+/* there will be 1024 chunks represented by each counter in the page pointers */
-+#define PAGEPTR_BLOCK_RATIO(bitmap) \
-+ (CHUNK_BLOCK_RATIO(bitmap) << PAGE_COUNTER_SHIFT >> 1)
-+#define PAGEPTR_BLOCK_SHIFT(bitmap) \
-+ (CHUNK_BLOCK_SHIFT(bitmap) + PAGE_COUNTER_SHIFT - 1)
-+#define PAGEPTR_BLOCK_MASK(bitmap) (PAGEPTR_BLOCK_RATIO(bitmap) - 1)
-+
-+/*
-+ * on-disk bitmap:
-+ *
-+ * Use one bit per "chunk" (block set). We do the disk I/O on the bitmap
-+ * file a page at a time. There's a superblock at the start of the file.
-+ */
-+
-+/* map chunks (bits) to file pages - offset by the size of the superblock */
-+#define CHUNK_BIT_OFFSET(chunk) ((chunk) + (sizeof(bitmap_super_t) << 3))
-+
-+#endif
-+
-+/*
-+ * bitmap structures:
-+ */
-+
-+#define BITMAP_MAGIC 0x6d746962
-+
-+/* use these for bitmap->flags and bitmap->sb->state bit-fields */
-+enum bitmap_state {
-+ BITMAP_ACTIVE = 0x001, /* the bitmap is in use */
-+ BITMAP_STALE = 0x002 /* the bitmap file is out of date or had -EIO */
-+};
-+
-+/* the superblock at the front of the bitmap file -- little endian */
-+typedef struct bitmap_super_s {
-+ __u32 magic; /* 0 BITMAP_MAGIC */
-+ __u32 version; /* 4 the bitmap major for now, could change... */
-+ __u8 uuid[16]; /* 8 128 bit uuid - must match md device uuid */
-+ __u64 events; /* 24 event counter for the bitmap (1)*/
-+ __u64 events_cleared;/*32 event counter when last bit cleared (2) */
-+ __u64 sync_size; /* 40 the size of the md device's sync range(3) */
-+ __u32 state; /* 48 bitmap state information */
-+ __u32 chunksize; /* 52 the bitmap chunk size in bytes */
-+ __u32 daemon_sleep; /* 56 seconds between disk flushes */
-+ __u32 write_behind; /* 60 number of outstanding write-behind writes */
-+
-+ __u8 pad[256 - 64]; /* set to zero */
-+} bitmap_super_t;
-+
-+/* notes:
-+ * (1) This event counter is updated before the eventcounter in the md superblock
-+ * When a bitmap is loaded, it is only accepted if this event counter is equal
-+ * to, or one greater than, the event counter in the superblock.
-+ * (2) This event counter is updated when the other one is *if*and*only*if* the
-+ * array is not degraded. As bits are not cleared when the array is degraded,
-+ * this represents the last time that any bits were cleared.
-+ * If a device is being added that has an event count with this value or
-+ * higher, it is accepted as conforming to the bitmap.
-+ * (3)This is the number of sectors represented by the bitmap, and is the range that
-+ * resync happens across. For raid1 and raid5/6 it is the size of individual
-+ * devices. For raid10 it is the size of the array.
-+ */
-+
-+#ifdef __KERNEL__
-+
-+/* the in-memory bitmap is represented by bitmap_pages */
-+struct bitmap_page {
-+ /*
-+ * map points to the actual memory page
-+ */
-+ char *map;
-+ /*
-+ * in emergencies (when map cannot be alloced), hijack the map
-+ * pointer and use it as two counters itself
-+ */
-+ unsigned int hijacked;
-+ /*
-+ * count of dirty bits on the page
-+ */
-+ int count;
-+};
-+
-+/* keep track of bitmap file pages that have pending writes on them */
-+struct page_list {
-+ struct list_head list;
-+ struct page *page;
-+};
-+
-+/* the main bitmap structure - one per mddev */
-+struct bitmap {
-+ struct bitmap_page *bp;
-+ unsigned long pages; /* total number of pages in the bitmap */
-+ unsigned long missing_pages; /* number of pages not yet allocated */
-+
-+ mddev_t *mddev; /* the md device that the bitmap is for */
-+
-+ int counter_bits; /* how many bits per block counter */
-+
-+ /* bitmap chunksize -- how much data does each bit represent? */
-+ unsigned long chunksize;
-+ unsigned long chunkshift; /* chunksize = 2^chunkshift (for bitops) */
-+ unsigned long chunks; /* total number of data chunks for the array */
-+
-+ /* We hold a count on the chunk currently being synced, and drop
-+ * it when the last block is started. If the resync is aborted
-+ * midway, we need to be able to drop that count, so we remember
-+ * the counted chunk..
-+ */
-+ unsigned long syncchunk;
-+
-+ __u64 events_cleared;
-+
-+ /* bitmap spinlock */
-+ spinlock_t lock;
-+
-+ struct file *file; /* backing disk file */
-+ struct page *sb_page; /* cached copy of the bitmap file superblock */
-+ struct page **filemap; /* list of cache pages for the file */
-+ unsigned long *filemap_attr; /* attributes associated w/ filemap pages */
-+ unsigned long file_pages; /* number of pages in the file */
-+
-+ unsigned long flags;
-+
-+ /*
-+ * the bitmap daemon - periodically wakes up and sweeps the bitmap
-+ * file, cleaning up bits and flushing out pages to disk as necessary
-+ */
-+ mdk_thread_t *daemon;
-+ unsigned long daemon_sleep; /* how many seconds between updates? */
-+
-+ /*
-+ * bitmap write daemon - this daemon performs writes to the bitmap file
-+ * this thread is only needed because of a limitation in ext3 (jbd)
-+ * that does not allow a task to have two journal transactions ongoing
-+ * simultaneously (even if the transactions are for two different
-+ * filesystems) -- in the case of bitmap, that would be the filesystem
-+ * that the bitmap file resides on and the filesystem that is mounted
-+ * on the md device -- see current->journal_info in jbd/transaction.c
-+ */
-+ mdk_thread_t *write_daemon;
-+ mdk_thread_t *writeback_daemon;
-+ spinlock_t write_lock;
-+ struct semaphore write_ready;
-+ struct semaphore write_done;
-+ unsigned long writes_pending;
-+ wait_queue_head_t write_wait;
-+ struct list_head write_pages;
-+ struct list_head complete_pages;
-+ mempool_t *write_pool;
-+};
-+
-+/* the bitmap API */
-+
-+/* these are used only by md/bitmap */
-+int bitmap_create(mddev_t *mddev);
-+void bitmap_destroy(mddev_t *mddev);
-+int bitmap_active(struct bitmap *bitmap);
-+
-+char *file_path(struct file *file, char *buf, int count);
-+void bitmap_print_sb(struct bitmap *bitmap);
-+int bitmap_update_sb(struct bitmap *bitmap);
-+
-+int bitmap_setallbits(struct bitmap *bitmap);
-+
-+/* these are exported */
-+void bitmap_startwrite(struct bitmap *bitmap, sector_t offset, unsigned long sectors);
-+void bitmap_endwrite(struct bitmap *bitmap, sector_t offset, unsigned long sectors,
-+ int success);
-+int bitmap_start_sync(struct bitmap *bitmap, sector_t offset, int *blocks);
-+void bitmap_end_sync(struct bitmap *bitmap, sector_t offset, int *blocks, int aborted);
-+void bitmap_close_sync(struct bitmap *bitmap);
-+
-+int bitmap_unplug(struct bitmap *bitmap);
-+#endif
-+
-+#endif
-diff -Nuar --exclude '*.orig' busybox-1.7.4+gentoo/mdadm/config.c busybox-1.7.4+gentoo+mdadm/mdadm/config.c
---- busybox-1.7.4+gentoo/mdadm/config.c 1969-12-31 16:00:00.000000000 -0800
-+++ busybox-1.7.4+gentoo+mdadm/mdadm/config.c 2008-03-11 10:31:00.000000000 -0700
-@@ -0,0 +1,824 @@
-+/*
-+ * mdadm - manage Linux "md" devices aka RAID arrays.
-+ *
-+ * Copyright (C) 2001-2006 Neil Brown <neilb@suse.de>
-+ *
-+ *
-+ * 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
-+ *
-+ * Author: Neil Brown
-+ * Email: <neilb@cse.unsw.edu.au>
-+ * Paper: Neil Brown
-+ * School of Computer Science and Engineering
-+ * The University of New South Wales
-+ * Sydney, 2052
-+ * Australia
-+ */
-+
-+#include "mdadm.h"
-+#include "dlink.h"
-+#include <sys/dir.h>
-+#include <glob.h>
-+#include <fnmatch.h>
-+#include <ctype.h>
-+#include <pwd.h>
-+#include <grp.h>
-+
-+mapping_t r5layout[] = {
-+ { "left-asymmetric", 0},
-+ { "right-asymmetric", 1},
-+ { "left-symmetric", 2},
-+ { "right-symmetric", 3},
-+
-+ { "default", 2},
-+ { "la", 0},
-+ { "ra", 1},
-+ { "ls", 2},
-+ { "rs", 3},
-+ { NULL, 0}
-+};
-+
-+mapping_t pers[] = {
-+ { "linear", -1},
-+ { "raid0", 0},
-+ { "0", 0},
-+ { "stripe", 0},
-+ { "raid1", 1},
-+ { "1", 1},
-+ { "mirror", 1},
-+ { "raid4", 4},
-+ { "4", 4},
-+ { "raid5", 5},
-+ { "5", 5},
-+ { "multipath", -4},
-+ { "mp", -4},
-+ { "raid6", 6},
-+ { "6", 6},
-+ { "raid10", 10},
-+ { "10", 10},
-+ { "faulty", -5},
-+ { NULL, 0}
-+};
-+/*
-+ * Read the config file
-+ *
-+ * conf_get_uuids gets a list of devicename+uuid pairs
-+ * conf_get_devs gets device names after expanding wildcards
-+ *
-+ * Each keeps the returned list and frees it when asked to make
-+ * a new list.
-+ *
-+ * The format of the config file needs to be fairly extensible.
-+ * Now, arrays only have names and uuids and devices merely are.
-+ * But later arrays might want names, and devices might want superblock
-+ * versions, and who knows what else.
-+ * I like free format, abhore backslash line continuation, adore
-+ * indentation for structure and am ok about # comments.
-+ *
-+ * So, each line that isn't blank or a #comment must either start
-+ * with a key word, and not be indented, or must start with a
-+ * non-key-word and must be indented.
-+ *
-+ * Keywords are DEVICE and ARRAY
-+ * DEV{ICE} introduces some devices that might contain raid components.
-+ * e.g.
-+ * DEV style=0 /dev/sda* /dev/hd*
-+ * DEV style=1 /dev/sd[b-f]*
-+ * ARR{AY} describes an array giving md device and attributes like uuid=whatever
-+ * e.g.
-+ * ARRAY /dev/md0 uuid=whatever name=something
-+ * Spaces separate words on each line. Quoting, with "" or '' protects them,
-+ * but may not wrap over lines
-+ *
-+ */
-+
-+#ifndef CONFFILE
-+#define CONFFILE "/etc/mdadm.conf"
-+#endif
-+#ifndef CONFFILE2
-+/* for Debian compatibility .... */
-+#define CONFFILE2 "/etc/mdadm/mdadm.conf"
-+#endif
-+char DefaultConfFile[] = CONFFILE;
-+char DefaultAltConfFile[] = CONFFILE2;
-+
-+enum linetype { Devices, Array, Mailaddr, Mailfrom, Program, CreateDev, Homehost, LTEnd };
-+char *keywords[] = {
-+ [Devices] = "devices",
-+ [Array] = "array",
-+ [Mailaddr] = "mailaddr",
-+ [Mailfrom] = "mailfrom",
-+ [Program] = "program",
-+ [CreateDev]= "create",
-+ [Homehost] = "homehost",
-+ [LTEnd] = NULL
-+};
-+
-+/*
-+ * match_keyword returns an index into the keywords array, or -1 for no match
-+ * case is ignored, and at least three characters must be given
-+ */
-+
-+int match_keyword(char *word)
-+{
-+ int len = strlen(word);
-+ int n;
-+
-+ if (len < 3) return -1;
-+ for (n=0; keywords[n]; n++) {
-+ if (strncasecmp(word, keywords[n], len)==0)
-+ return n;
-+ }
-+ return -1;
-+}
-+
-+/* conf_word gets one word from the conf file.
-+ * if "allow_key", then accept words at the start of a line,
-+ * otherwise stop when such a word is found.
-+ * We assume that the file pointer is at the end of a word, so the
-+ * next character is a space, or a newline. If not, it is the start of a line.
-+ */
-+
-+char *conf_word(FILE *file, int allow_key)
-+{
-+ int wsize = 100;
-+ int len = 0;
-+ int c;
-+ int quote;
-+ int wordfound = 0;
-+ char *word = malloc(wsize);
-+
-+ if (!word) abort();
-+
-+ while (wordfound==0) {
-+ /* at the end of a word.. */
-+ c = getc(file);
-+ if (c == '#')
-+ while (c != EOF && c != '\n')
-+ c = getc(file);
-+ if (c == EOF) break;
-+ if (c == '\n') continue;
-+
-+ if (c != ' ' && c != '\t' && ! allow_key) {
-+ ungetc(c, file);
-+ break;
-+ }
-+ /* looks like it is safe to get a word here, if there is one */
-+ quote = 0;
-+ /* first, skip any spaces */
-+ while (c == ' ' || c == '\t')
-+ c = getc(file);
-+ if (c != EOF && c != '\n' && c != '#') {
-+ /* we really have a character of a word, so start saving it */
-+ while (c != EOF && c != '\n' && (quote || (c!=' ' && c != '\t'))) {
-+ wordfound = 1;
-+ if (quote && c == quote) quote = 0;
-+ else if (quote == 0 && (c == '\'' || c == '"'))
-+ quote = c;
-+ else {
-+ if (len == wsize-1) {
-+ wsize += 100;
-+ word = realloc(word, wsize);
-+ if (!word) abort();
-+ }
-+ word[len++] = c;
-+ }
-+ c = getc(file);
-+ }
-+ }
-+ if (c != EOF) ungetc(c, file);
-+ }
-+ word[len] = 0;
-+/* printf("word is <%s>\n", word); */
-+ if (!wordfound) {
-+ free(word);
-+ word = NULL;
-+ }
-+ return word;
-+}
-+
-+/*
-+ * conf_line reads one logical line from the conffile.
-+ * It skips comments and continues until it finds a line that starts
-+ * with a non blank/comment. This character is pushed back for the next call
-+ * A doubly linked list of words is returned.
-+ * the first word will be a keyword. Other words will have had quotes removed.
-+ */
-+
-+char *conf_line(FILE *file)
-+{
-+ char *w;
-+ char *list;
-+
-+ w = conf_word(file, 1);
-+ if (w == NULL) return NULL;
-+
-+ list = dl_strdup(w);
-+ free(w);
-+ dl_init(list);
-+
-+ while ((w = conf_word(file,0))){
-+ char *w2 = dl_strdup(w);
-+ free(w);
-+ dl_add(list, w2);
-+ }
-+/* printf("got a line\n");*/
-+ return list;
-+}
-+
-+void free_line(char *line)
-+{
-+ char *w;
-+ for (w=dl_next(line); w != line; w=dl_next(line)) {
-+ dl_del(w);
-+ dl_free(w);
-+ }
-+ dl_free(line);
-+}
-+
-+
-+struct conf_dev {
-+ struct conf_dev *next;
-+ char *name;
-+} *cdevlist = NULL;
-+
-+mddev_dev_t load_partitions(void)
-+{
-+ FILE *f = fopen("/proc/partitions", "r");
-+ char buf[1024];
-+ mddev_dev_t rv = NULL;
-+ if (f == NULL) {
-+ fprintf(stderr, Name ": cannot open /proc/partitions\n");
-+ return NULL;
-+ }
-+ while (fgets(buf, 1024, f)) {
-+ int major, minor;
-+ char *name, *mp;
-+ mddev_dev_t d;
-+
-+ buf[1023] = '\0';
-+ if (buf[0] != ' ')
-+ continue;
-+ major = strtoul(buf, &mp, 10);
-+ if (mp == buf || *mp != ' ')
-+ continue;
-+ minor = strtoul(mp, NULL, 10);
-+
-+ name = map_dev(major, minor, 1);
-+ if (!name)
-+ continue;
-+ d = malloc(sizeof(*d));
-+ d->devname = strdup(name);
-+ d->next = rv;
-+ d->used = 0;
-+ rv = d;
-+ }
-+ fclose(f);
-+ return rv;
-+}
-+
-+struct createinfo createinfo = {
-+ .autof = 2, /* by default, create devices with standard names */
-+ .symlinks = 1,
-+#ifdef DEBIAN
-+ .gid = 6, /* disk */
-+ .mode = 0660,
-+#else
-+ .mode = 0600,
-+#endif
-+};
-+
-+int parse_auto(char *str, char *msg, int config)
-+{
-+ int autof;
-+ if (str == NULL || *str == 0)
-+ autof = 2;
-+ else if (strcasecmp(str,"no")==0)
-+ autof = 1;
-+ else if (strcasecmp(str,"yes")==0)
-+ autof = 2;
-+ else if (strcasecmp(str,"md")==0)
-+ autof = config?5:3;
-+ else {
-+ /* There might be digits, and maybe a hypen, at the end */
-+ char *e = str + strlen(str);
-+ int num = 4;
-+ int len;
-+ while (e > str && isdigit(e[-1]))
-+ e--;
-+ if (*e) {
-+ num = atoi(e);
-+ if (num <= 0) num = 1;
-+ }
-+ if (e > str && e[-1] == '-')
-+ e--;
-+ len = e - str;
-+ if ((len == 2 && strncasecmp(str,"md",2)==0)) {
-+ autof = config ? 5 : 3;
-+ } else if ((len == 3 && strncasecmp(str,"yes",3)==0)) {
-+ autof = 2;
-+ } else if ((len == 3 && strncasecmp(str,"mdp",3)==0)) {
-+ autof = config ? 6 : 4;
-+ } else if ((len == 1 && strncasecmp(str,"p",1)==0) ||
-+ (len >= 4 && strncasecmp(str,"part",4)==0)) {
-+ autof = 6;
-+ } else {
-+ fprintf(stderr, Name ": %s arg of \"%s\" unrecognised: use no,yes,md,mdp,part\n"
-+ " optionally followed by a number.\n",
-+ msg, str);
-+ exit(2);
-+ }
-+ autof |= num << 3;
-+ }
-+ return autof;
-+}
-+
-+static void createline(char *line)
-+{
-+ char *w;
-+ char *ep;
-+
-+ for (w=dl_next(line); w!=line; w=dl_next(w)) {
-+ if (strncasecmp(w, "auto=", 5) == 0)
-+ createinfo.autof = parse_auto(w+5, "auto=", 1);
-+ else if (strncasecmp(w, "owner=", 6) == 0) {
-+ if (w[6] == 0) {
-+ fprintf(stderr, Name ": missing owner name\n");
-+ continue;
-+ }
-+ createinfo.uid = strtoul(w+6, &ep, 10);
-+ if (*ep != 0) {
-+ struct passwd *pw;
-+ /* must be a name */
-+ pw = getpwnam(w+6);
-+ if (pw)
-+ createinfo.uid = pw->pw_uid;
-+ else
-+ fprintf(stderr, Name ": CREATE user %s not found\n", w+6);
-+ }
-+ } else if (strncasecmp(w, "group=", 6) == 0) {
-+ if (w[6] == 0) {
-+ fprintf(stderr, Name ": missing group name\n");
-+ continue;
-+ }
-+ createinfo.gid = strtoul(w+6, &ep, 10);
-+ if (*ep != 0) {
-+ struct group *gr;
-+ /* must be a name */
-+ gr = getgrnam(w+6);
-+ if (gr)
-+ createinfo.gid = gr->gr_gid;
-+ else
-+ fprintf(stderr, Name ": CREATE group %s not found\n", w+6);
-+ }
-+ } else if (strncasecmp(w, "mode=", 5) == 0) {
-+ if (w[5] == 0) {
-+ fprintf(stderr, Name ": missing CREATE mode\n");
-+ continue;
-+ }
-+ createinfo.mode = strtoul(w+5, &ep, 8);
-+ if (*ep != 0) {
-+ createinfo.mode = 0600;
-+ fprintf(stderr, Name ": unrecognised CREATE mode %s\n",
-+ w+5);
-+ }
-+ } else if (strncasecmp(w, "metadata=", 9) == 0) {
-+ /* style of metadata to use by default */
-+ int i;
-+ for (i=0; superlist[i] && !createinfo.supertype; i++)
-+ createinfo.supertype =
-+ superlist[i]->match_metadata_desc(w+9);
-+ if (!createinfo.supertype)
-+ fprintf(stderr, Name ": metadata format %s unknown, ignoring\n",
-+ w+9);
-+ } else if (strncasecmp(w, "symlinks=yes", 12) == 0)
-+ createinfo.symlinks = 1;
-+ else if (strncasecmp(w, "symlinks=no", 11) == 0)
-+ createinfo.symlinks = 0;
-+ else {
-+ fprintf(stderr, Name ": unrecognised word on CREATE line: %s\n",
-+ w);
-+ }
-+ }
-+}
-+
-+void devline(char *line)
-+{
-+ char *w;
-+ struct conf_dev *cd;
-+
-+ for (w=dl_next(line); w != line; w=dl_next(w)) {
-+ if (w[0] == '/' || strcasecmp(w, "partitions") == 0) {
-+ cd = malloc(sizeof(*cd));
-+ cd->name = strdup(w);
-+ cd->next = cdevlist;
-+ cdevlist = cd;
-+ } else {
-+ fprintf(stderr, Name ": unreconised word on DEVICE line: %s\n",
-+ w);
-+ }
-+ }
-+}
-+
-+mddev_ident_t mddevlist = NULL;
-+mddev_ident_t *mddevlp = &mddevlist;
-+
-+void arrayline(char *line)
-+{
-+ char *w;
-+
-+ struct mddev_ident_s mis;
-+ mddev_ident_t mi;
-+
-+ mis.uuid_set = 0;
-+ mis.super_minor = UnSet;
-+ mis.level = UnSet;
-+ mis.raid_disks = UnSet;
-+ mis.spare_disks = 0;
-+ mis.devices = NULL;
-+ mis.devname = NULL;
-+ mis.spare_group = NULL;
-+ mis.autof = 0;
-+ mis.next = NULL;
-+ mis.st = NULL;
-+ mis.bitmap_fd = -1;
-+ mis.bitmap_file = NULL;
-+ mis.name[0] = 0;
-+
-+ for (w=dl_next(line); w!=line; w=dl_next(w)) {
-+ if (w[0] == '/') {
-+ if (mis.devname)
-+ fprintf(stderr, Name ": only give one device per ARRAY line: %s and %s\n",
-+ mis.devname, w);
-+ else mis.devname = w;
-+ } else if (strncasecmp(w, "uuid=", 5)==0 ) {
-+ if (mis.uuid_set)
-+ fprintf(stderr, Name ": only specify uuid once, %s ignored.\n",
-+ w);
-+ else {
-+ if (parse_uuid(w+5, mis.uuid))
-+ mis.uuid_set = 1;
-+ else
-+ fprintf(stderr, Name ": bad uuid: %s\n", w);
-+ }
-+ } else if (strncasecmp(w, "super-minor=", 12)==0 ) {
-+ if (mis.super_minor != UnSet)
-+ fprintf(stderr, Name ": only specify super-minor once, %s ignored.\n",
-+ w);
-+ else {
-+ char *endptr;
-+ mis.super_minor= strtol(w+12, &endptr, 10);
-+ if (w[12]==0 || endptr[0]!=0 || mis.super_minor < 0) {
-+ fprintf(stderr, Name ": invalid super-minor number: %s\n",
-+ w);
-+ mis.super_minor = UnSet;
-+ }
-+ }
-+ } else if (strncasecmp(w, "name=", 5)==0) {
-+ if (mis.name[0])
-+ fprintf(stderr, Name ": only specify name once, %s ignored.\n",
-+ w);
-+ else if (strlen(w+5) > 32)
-+ fprintf(stderr, Name ": name too long, ignoring %s\n", w);
-+ else
-+ strcpy(mis.name, w+5);
-+
-+ } else if (strncasecmp(w, "bitmap=", 7) == 0) {
-+ if (mis.bitmap_file)
-+ fprintf(stderr, Name ": only specify bitmap file once. %s ignored\n",
-+ w);
-+ else
-+ mis.bitmap_file = strdup(w+7);
-+
-+ } else if (strncasecmp(w, "devices=", 8 ) == 0 ) {
-+ if (mis.devices)
-+ fprintf(stderr, Name ": only specify devices once (use a comma separated list). %s ignored\n",
-+ w);
-+ else
-+ mis.devices = strdup(w+8);
-+ } else if (strncasecmp(w, "spare-group=", 12) == 0 ) {
-+ if (mis.spare_group)
-+ fprintf(stderr, Name ": only specify one spare group per array. %s ignored.\n",
-+ w);
-+ else
-+ mis.spare_group = strdup(w+12);
-+ } else if (strncasecmp(w, "level=", 6) == 0 ) {
-+ /* this is mainly for compatability with --brief output */
-+ mis.level = map_name(pers, w+6);
-+ } else if (strncasecmp(w, "disks=", 6) == 0 ) {
-+ /* again, for compat */
-+ mis.raid_disks = atoi(w+6);
-+ } else if (strncasecmp(w, "num-devices=", 12) == 0 ) {
-+ /* again, for compat */
-+ mis.raid_disks = atoi(w+12);
-+ } else if (strncasecmp(w, "spares=", 7) == 0 ) {
-+ /* for warning if not all spares present */
-+ mis.spare_disks = atoi(w+7);
-+ } else if (strncasecmp(w, "metadata=", 9) == 0) {
-+ /* style of metadata on the devices. */
-+ int i;
-+
-+ for(i=0; superlist[i] && !mis.st; i++)
-+ mis.st = superlist[i]->match_metadata_desc(w+9);
-+
-+ if (!mis.st)
-+ fprintf(stderr, Name ": metadata format %s unknown, ignored.\n", w+9);
-+ } else if (strncasecmp(w, "auto=", 5) == 0 ) {
-+ /* whether to create device special files as needed */
-+ mis.autof = parse_auto(w+5, "auto type", 0);
-+ } else {
-+ fprintf(stderr, Name ": unrecognised word on ARRAY line: %s\n",
-+ w);
-+ }
-+ }
-+ if (mis.devname == NULL)
-+ fprintf(stderr, Name ": ARRAY line with no device\n");
-+ else if (mis.uuid_set == 0 && mis.devices == NULL && mis.super_minor == UnSet && mis.name[0] == 0)
-+ fprintf(stderr, Name ": ARRAY line %s has no identity information.\n", mis.devname);
-+ else {
-+ mi = malloc(sizeof(*mi));
-+ *mi = mis;
-+ mi->devname = strdup(mis.devname);
-+ mi->next = NULL;
-+ *mddevlp = mi;
-+ mddevlp = &mi->next;
-+ }
-+}
-+
-+static char *alert_email = NULL;
-+void mailline(char *line)
-+{
-+ char *w;
-+
-+ for (w=dl_next(line); w != line ; w=dl_next(w)) {
-+ if (alert_email == NULL)
-+ alert_email = strdup(w);
-+ else
-+ fprintf(stderr, Name ": excess address on MAIL line: %s - ignored\n",
-+ w);
-+ }
-+}
-+
-+static char *alert_mail_from = NULL;
-+void mailfromline(char *line)
-+{
-+ char *w;
-+
-+ for (w=dl_next(line); w != line ; w=dl_next(w)) {
-+ if (alert_mail_from == NULL)
-+ alert_mail_from = strdup(w);
-+ else {
-+ char *t= NULL;
-+ asprintf(&t, "%s %s", alert_mail_from, w);
-+ free(alert_mail_from);
-+ alert_mail_from = t;
-+ }
-+ }
-+}
-+
-+
-+static char *alert_program = NULL;
-+void programline(char *line)
-+{
-+ char *w;
-+
-+ for (w=dl_next(line); w != line ; w=dl_next(w)) {
-+ if (alert_program == NULL)
-+ alert_program = strdup(w);
-+ else
-+ fprintf(stderr, Name ": excess program on PROGRAM line: %s - ignored\n",
-+ w);
-+ }
-+}
-+
-+static char *home_host = NULL;
-+void homehostline(char *line)
-+{
-+ char *w;
-+
-+ for (w=dl_next(line); w != line ; w=dl_next(w)) {
-+ if (home_host == NULL)
-+ home_host = strdup(w);
-+ else
-+ fprintf(stderr, Name ": excess host name on HOMEHOST line: %s - ignored\n",
-+ w);
-+ }
-+}
-+
-+
-+int loaded = 0;
-+
-+static char *conffile = NULL;
-+void set_conffile(char *file)
-+{
-+ conffile = file;
-+}
-+
-+void load_conffile(void)
-+{
-+ FILE *f;
-+ char *line;
-+
-+ if (loaded) return;
-+ if (conffile == NULL)
-+ conffile = DefaultConfFile;
-+
-+ if (strcmp(conffile, "none") == 0) {
-+ loaded = 1;
-+ return;
-+ }
-+ if (strcmp(conffile, "partitions")==0) {
-+ char *list = dl_strdup("DEV");
-+ dl_init(list);
-+ dl_add(list, dl_strdup("partitions"));
-+ devline(list);
-+ free_line(list);
-+ loaded = 1;
-+ return;
-+ }
-+ f = fopen(conffile, "r");
-+ /* Debian chose to relocate mdadm.conf into /etc/mdadm/.
-+ * To allow Debian users to compile from clean source and still
-+ * have a working mdadm, we read /etc/mdadm/mdadm.conf
-+ * if /etc/mdadm.conf doesn't exist
-+ */
-+ if (f == NULL &&
-+ conffile == DefaultConfFile) {
-+ f = fopen(DefaultAltConfFile, "r");
-+ if (f)
-+ conffile = DefaultAltConfFile;
-+ }
-+ if (f == NULL)
-+ return;
-+
-+ loaded = 1;
-+ while ((line=conf_line(f))) {
-+ switch(match_keyword(line)) {
-+ case Devices:
-+ devline(line);
-+ break;
-+ case Array:
-+ arrayline(line);
-+ break;
-+ case Mailaddr:
-+ mailline(line);
-+ break;
-+ case Mailfrom:
-+ mailfromline(line);
-+ break;
-+ case Program:
-+ programline(line);
-+ break;
-+ case CreateDev:
-+ createline(line);
-+ break;
-+ case Homehost:
-+ homehostline(line);
-+ break;
-+ default:
-+ fprintf(stderr, Name ": Unknown keyword %s\n", line);
-+ }
-+ free_line(line);
-+ }
-+
-+ fclose(f);
-+
-+/* printf("got file\n"); */
-+}
-+
-+char *conf_get_mailaddr(void)
-+{
-+ load_conffile();
-+ return alert_email;
-+}
-+
-+char *conf_get_mailfrom(void)
-+{
-+ load_conffile();
-+ return alert_mail_from;
-+}
-+
-+char *conf_get_program(void)
-+{
-+ load_conffile();
-+ return alert_program;
-+}
-+
-+char *conf_get_homehost(void)
-+{
-+ load_conffile();
-+ return home_host;
-+}
-+
-+struct createinfo *conf_get_create_info(void)
-+{
-+ load_conffile();
-+ return &createinfo;
-+}
-+
-+mddev_ident_t conf_get_ident(char *dev)
-+{
-+ mddev_ident_t rv;
-+ load_conffile();
-+ rv = mddevlist;
-+ while (dev && rv && strcmp(dev, rv->devname)!=0)
-+ rv = rv->next;
-+ return rv;
-+}
-+
-+mddev_dev_t conf_get_devs()
-+{
-+ glob_t globbuf;
-+ struct conf_dev *cd;
-+ int flags = 0;
-+ static mddev_dev_t dlist = NULL;
-+ unsigned int i;
-+
-+ while (dlist) {
-+ mddev_dev_t t = dlist;
-+ dlist = dlist->next;
-+ free(t->devname);
-+ free(t);
-+ }
-+
-+ load_conffile();
-+
-+ if (cdevlist == NULL)
-+ /* default to 'partitions */
-+ dlist = load_partitions();
-+
-+ for (cd=cdevlist; cd; cd=cd->next) {
-+ if (strcasecmp(cd->name, "partitions")==0 && dlist == NULL)
-+ dlist = load_partitions();
-+ else {
-+ glob(cd->name, flags, NULL, &globbuf);
-+ flags |= GLOB_APPEND;
-+ }
-+ }
-+ if (flags & GLOB_APPEND) {
-+ for (i=0; i<globbuf.gl_pathc; i++) {
-+ mddev_dev_t t = malloc(sizeof(*t));
-+ t->devname = strdup(globbuf.gl_pathv[i]);
-+ t->next = dlist;
-+ t->used = 0;
-+ dlist = t;
-+/* printf("one dev is %s\n", t->devname);*/
-+ }
-+ globfree(&globbuf);
-+ }
-+
-+ return dlist;
-+}
-+
-+int conf_test_dev(char *devname)
-+{
-+ struct conf_dev *cd;
-+ if (cdevlist == NULL)
-+ /* allow anything by default */
-+ return 1;
-+ for (cd = cdevlist ; cd ; cd = cd->next) {
-+ if (strcasecmp(cd->name, "partitions") == 0)
-+ return 1;
-+ if (fnmatch(cd->name, devname, FNM_PATHNAME) == 0)
-+ return 1;
-+ }
-+ return 0;
-+}
-+
-+
-+int match_oneof(char *devices, char *devname)
-+{
-+ /* check if one of the comma separated patterns in devices
-+ * matches devname
-+ */
-+
-+
-+ while (devices && *devices) {
-+ char patn[1024];
-+ char *p = devices;
-+ devices = strchr(devices, ',');
-+ if (!devices)
-+ devices = p + strlen(p);
-+ if (devices-p < 1024) {
-+ strncpy(patn, p, devices-p);
-+ patn[devices-p] = 0;
-+ if (fnmatch(patn, devname, FNM_PATHNAME)==0)
-+ return 1;
-+ }
-+ if (*devices == ',')
-+ devices++;
-+ }
-+ return 0;
-+}
-diff -Nuar --exclude '*.orig' busybox-1.7.4+gentoo/mdadm/Config.in busybox-1.7.4+gentoo+mdadm/mdadm/Config.in
---- busybox-1.7.4+gentoo/mdadm/Config.in 1969-12-31 16:00:00.000000000 -0800
-+++ busybox-1.7.4+gentoo+mdadm/mdadm/Config.in 2008-03-11 10:31:00.000000000 -0700
-@@ -0,0 +1,15 @@
-+#
-+# For a description of the syntax of this configuration file,
-+# see scripts/kbuild/config-language.txt.
-+#
-+
-+menu "Linux mdadm Utilities"
-+
-+config MDADM
-+ bool "mdadm"
-+ default n
-+ help
-+ assemble or examine raid array
-+
-+endmenu
-+
-diff -Nuar --exclude '*.orig' busybox-1.7.4+gentoo/mdadm/dlink.c busybox-1.7.4+gentoo+mdadm/mdadm/dlink.c
---- busybox-1.7.4+gentoo/mdadm/dlink.c 1969-12-31 16:00:00.000000000 -0800
-+++ busybox-1.7.4+gentoo+mdadm/mdadm/dlink.c 2008-03-11 10:31:00.000000000 -0700
-@@ -0,0 +1,79 @@
-+
-+/* doubly linked lists */
-+/* This is free software. No strings attached. No copyright claimed */
-+
-+#include <unistd.h>
-+#include <stdlib.h>
-+#include <string.h>
-+#ifdef __dietlibc__
-+char *strncpy(char *dest, const char *src, size_t n) __THROW;
-+#endif
-+#include "dlink.h"
-+
-+
-+void *dl_head()
-+{
-+ void *h;
-+ h = dl_alloc(0);
-+ dl_next(h) = h;
-+ dl_prev(h) = h;
-+ return h;
-+}
-+
-+void dl_free(void *v)
-+{
-+ struct __dl_head *vv = v;
-+ free(vv-1);
-+}
-+
-+void dl_init(void *v)
-+{
-+ dl_next(v) = v;
-+ dl_prev(v) = v;
-+}
-+
-+void dl_insert(void *head, void *val)
-+{
-+ dl_next(val) = dl_next(head);
-+ dl_prev(val) = head;
-+ dl_next(dl_prev(val)) = val;
-+ dl_prev(dl_next(val)) = val;
-+}
-+
-+void dl_add(void *head, void *val)
-+{
-+ dl_prev(val) = dl_prev(head);
-+ dl_next(val) = head;
-+ dl_next(dl_prev(val)) = val;
-+ dl_prev(dl_next(val)) = val;
-+}
-+
-+void dl_del(void *val)
-+{
-+ if (dl_prev(val) == 0 || dl_next(val) == 0)
-+ return;
-+ dl_prev(dl_next(val)) = dl_prev(val);
-+ dl_next(dl_prev(val)) = dl_next(val);
-+ dl_prev(val) = dl_next(val) = 0;
-+}
-+
-+char *dl_strndup(char *s, int l)
-+{
-+ char *n;
-+ if (s == NULL)
-+ return NULL;
-+ n = dl_newv(char, l+1);
-+ if (n == NULL)
-+ return NULL;
-+ else
-+ {
-+ strncpy(n, s, l);
-+ n[l] = 0;
-+ return n;
-+ }
-+}
-+
-+char *dl_strdup(char *s)
-+{
-+ return dl_strndup(s, (int)strlen(s));
-+}
-diff -Nuar --exclude '*.orig' busybox-1.7.4+gentoo/mdadm/dlink.h busybox-1.7.4+gentoo+mdadm/mdadm/dlink.h
---- busybox-1.7.4+gentoo/mdadm/dlink.h 1969-12-31 16:00:00.000000000 -0800
-+++ busybox-1.7.4+gentoo+mdadm/mdadm/dlink.h 2008-03-11 10:31:00.000000000 -0700
-@@ -0,0 +1,25 @@
-+
-+/* doubley linked lists */
-+/* This is free software. No strings attached. No copyright claimed */
-+
-+struct __dl_head
-+{
-+ void * dh_prev;
-+ void * dh_next;
-+};
-+
-+#define dl_alloc(size) ((void*)(((char*)calloc(1,(size)+sizeof(struct __dl_head)))+sizeof(struct __dl_head)))
-+#define dl_new(t) ((t*)dl_alloc(sizeof(t)))
-+#define dl_newv(t,n) ((t*)dl_alloc(sizeof(t)*n))
-+
-+#define dl_next(p) *(&(((struct __dl_head*)(p))[-1].dh_next))
-+#define dl_prev(p) *(&(((struct __dl_head*)(p))[-1].dh_prev))
-+
-+void *dl_head(void);
-+char *dl_strdup(char *);
-+char *dl_strndup(char *, int);
-+void dl_insert(void*, void*);
-+void dl_add(void*, void*);
-+void dl_del(void*);
-+void dl_free(void*);
-+void dl_init(void*);
-diff -Nuar --exclude '*.orig' busybox-1.7.4+gentoo/mdadm/md5.h busybox-1.7.4+gentoo+mdadm/mdadm/md5.h
---- busybox-1.7.4+gentoo/mdadm/md5.h 1969-12-31 16:00:00.000000000 -0800
-+++ busybox-1.7.4+gentoo+mdadm/mdadm/md5.h 2008-03-11 10:31:00.000000000 -0700
-@@ -0,0 +1,134 @@
-+/* Declaration of functions and data types used for MD5 sum computing
-+ library functions.
-+ Copyright (C) 1995-1997,1999-2005 Free Software Foundation, Inc.
-+
-+ NOTE: The canonical source of this file is maintained with the GNU C
-+ Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu.
-+
-+ 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, 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. */
-+
-+#ifndef _MD5_H
-+#define _MD5_H 1
-+
-+#include <stdio.h>
-+
-+# include <inttypes.h>
-+#if HAVE_STDINT_H || _LIBC
-+# include <stdint.h>
-+#endif
-+
-+#ifndef __GNUC_PREREQ
-+# if defined __GNUC__ && defined __GNUC_MINOR__
-+# define __GNUC_PREREQ(maj, min) \
-+ ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
-+# else
-+# define __GNUC_PREREQ(maj, min) 0
-+# endif
-+#endif
-+
-+#ifndef __THROW
-+# if defined __cplusplus && __GNUC_PREREQ (2,8)
-+# define __THROW throw ()
-+# else
-+# define __THROW
-+# endif
-+#endif
-+
-+#ifndef __attribute__
-+# if ! __GNUC_PREREQ (2,8) || __STRICT_ANSI__
-+# define __attribute__(x)
-+# endif
-+#endif
-+
-+#ifndef _LIBC
-+# define __md5_buffer md5_buffer
-+# define __md5_finish_ctx md5_finish_ctx
-+# define __md5_init_ctx md5_init_ctx
-+# define __md5_process_block md5_process_block
-+# define __md5_process_bytes md5_process_bytes
-+# define __md5_read_ctx md5_read_ctx
-+# define __md5_stream md5_stream
-+#endif
-+
-+typedef uint32_t md5_uint32;
-+
-+/* Structure to save state of computation between the single steps. */
-+struct md5_ctx
-+{
-+ md5_uint32 A;
-+ md5_uint32 B;
-+ md5_uint32 C;
-+ md5_uint32 D;
-+
-+ md5_uint32 total[2];
-+ md5_uint32 buflen;
-+ char buffer[128] __attribute__ ((__aligned__ (__alignof__ (md5_uint32))));
-+};
-+
-+/*
-+ * The following three functions are build up the low level used in
-+ * the functions `md5_stream' and `md5_buffer'.
-+ */
-+
-+/* Initialize structure containing state of computation.
-+ (RFC 1321, 3.3: Step 3) */
-+extern void __md5_init_ctx (struct md5_ctx *ctx) __THROW;
-+
-+/* Starting with the result of former calls of this function (or the
-+ initialization function update the context for the next LEN bytes
-+ starting at BUFFER.
-+ It is necessary that LEN is a multiple of 64!!! */
-+extern void __md5_process_block (const void *buffer, size_t len,
-+ struct md5_ctx *ctx) __THROW;
-+
-+/* Starting with the result of former calls of this function (or the
-+ initialization function update the context for the next LEN bytes
-+ starting at BUFFER.
-+ It is NOT required that LEN is a multiple of 64. */
-+extern void __md5_process_bytes (const void *buffer, size_t len,
-+ struct md5_ctx *ctx) __THROW;
-+
-+/* Process the remaining bytes in the buffer and put result from CTX
-+ in first 16 bytes following RESBUF. The result is always in little
-+ endian byte order, so that a byte-wise output yields to the wanted
-+ ASCII representation of the message digest.
-+
-+ IMPORTANT: On some systems it is required that RESBUF be correctly
-+ aligned for a 32 bits value. */
-+extern void *__md5_finish_ctx (struct md5_ctx *ctx, void *resbuf) __THROW;
-+
-+
-+/* Put result from CTX in first 16 bytes following RESBUF. The result is
-+ always in little endian byte order, so that a byte-wise output yields
-+ to the wanted ASCII representation of the message digest.
-+
-+ IMPORTANT: On some systems it is required that RESBUF is correctly
-+ aligned for a 32 bits value. */
-+extern void *__md5_read_ctx (const struct md5_ctx *ctx, void *resbuf) __THROW;
-+
-+
-+/* Compute MD5 message digest for bytes read from STREAM. The
-+ resulting message digest number will be written into the 16 bytes
-+ beginning at RESBLOCK. */
-+extern int __md5_stream (FILE *stream, void *resblock) __THROW;
-+
-+/* Compute MD5 message digest for LEN bytes beginning at BUFFER. The
-+ result is always in little endian byte order, so that a byte-wise
-+ output yields to the wanted ASCII representation of the message
-+ digest. */
-+extern void *__md5_buffer (const char *buffer, size_t len,
-+ void *resblock) __THROW;
-+
-+#endif /* md5.h */
-diff -Nuar --exclude '*.orig' busybox-1.7.4+gentoo/mdadm/mdadm.c busybox-1.7.4+gentoo+mdadm/mdadm/mdadm.c
---- busybox-1.7.4+gentoo/mdadm/mdadm.c 1969-12-31 16:00:00.000000000 -0800
-+++ busybox-1.7.4+gentoo+mdadm/mdadm/mdadm.c 2008-03-11 10:31:00.000000000 -0700
-@@ -0,0 +1,18 @@
-+/*
-+ * mdadm support for busybox.
-+ * added by Alan Hourihane <alanh@fairlite.demon.co.uk>
-+ */
-+#include <string.h>
-+
-+extern int mdassemble_main(int argc, char **argv);
-+extern int mdexamine_main(int argc, char **argv);
-+
-+int mdadm_main(int argc, char **argv) {
-+ if (argc >= 2) {
-+ if (!strncmp(argv[1],"--assemble",10))
-+ return mdassemble_main(argc, argv);
-+ if (!strncmp(argv[1],"--examine",9))
-+ return mdexamine_main(argc, argv);
-+ }
-+ return 0;
-+}
-diff -Nuar --exclude '*.orig' busybox-1.7.4+gentoo/mdadm/mdadm.h busybox-1.7.4+gentoo+mdadm/mdadm/mdadm.h
---- busybox-1.7.4+gentoo/mdadm/mdadm.h 1969-12-31 16:00:00.000000000 -0800
-+++ busybox-1.7.4+gentoo+mdadm/mdadm/mdadm.h 2008-03-11 10:31:00.000000000 -0700
-@@ -0,0 +1,540 @@
-+/*
-+ * mdadm - manage Linux "md" devices aka RAID arrays.
-+ *
-+ * Copyright (C) 2001-2006 Neil Brown <neilb@suse.de>
-+ *
-+ *
-+ * 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
-+ *
-+ * Author: Neil Brown
-+ * Email: <neilb@cse.unsw.edu.au>
-+ * Paper: Neil Brown
-+ * School of Computer Science and Engineering
-+ * The University of New South Wales
-+ * Sydney, 2052
-+ * Australia
-+ */
-+
-+#include <unistd.h>
-+#ifndef __dietlibc__
-+extern __off64_t lseek64 __P ((int __fd, __off64_t __offset, int __whence));
-+#else
-+# if defined(__NO_STAT64) || __WORDSIZE != 32
-+# define lseek64 lseek
-+# endif
-+#endif
-+
-+#include <sys/types.h>
-+#include <sys/stat.h>
-+#include <stdlib.h>
-+#include <time.h>
-+#include <sys/time.h>
-+#include <getopt.h>
-+#include <fcntl.h>
-+#include <stdio.h>
-+#include <errno.h>
-+#include <string.h>
-+#include <syslog.h>
-+#ifdef __dietlibc__
-+#include <strings.h>
-+/* dietlibc has deprecated random and srandom!! */
-+#define random rand
-+#define srandom srand
-+#endif
-+
-+
-+#include <linux/kdev_t.h>
-+/*#include <linux/fs.h> */
-+#include <sys/mount.h>
-+#include <asm/types.h>
-+#include <sys/ioctl.h>
-+#define MD_MAJOR 9
-+#define MdpMinorShift 6
-+
-+#ifndef BLKGETSIZE64
-+#define BLKGETSIZE64 _IOR(0x12,114,size_t) /* return device size in bytes (u64 *arg) */
-+#endif
-+
-+#define DEFAULT_BITMAP_CHUNK 4096
-+#define DEFAULT_BITMAP_DELAY 5
-+#define DEFAULT_MAX_WRITE_BEHIND 256
-+
-+#include "md_u.h"
-+#include "md_p.h"
-+#include "bitmap.h"
-+
-+#include <endian.h>
-+/* Redhat don't like to #include <asm/byteorder.h>, and
-+ * some time include <linux/byteorder/xxx_endian.h> isn't enough,
-+ * and there is no standard conversion function so... */
-+/* And dietlibc doesn't think byteswap is ok, so.. */
-+/* #include <byteswap.h> */
-+#define bswap_16(x) (((x) & 0x00ffU) << 8 | \
-+ ((x) & 0xff00U) >> 8)
-+#define bswap_32(x) (((x) & 0x000000ffU) << 24 | \
-+ ((x) & 0xff000000U) >> 24 | \
-+ ((x) & 0x0000ff00U) << 8 | \
-+ ((x) & 0x00ff0000U) >> 8)
-+#define bswap_64(x) (((x) & 0x00000000000000ffULL) << 56 | \
-+ ((x) & 0xff00000000000000ULL) >> 56 | \
-+ ((x) & 0x000000000000ff00ULL) << 40 | \
-+ ((x) & 0x00ff000000000000ULL) >> 40 | \
-+ ((x) & 0x0000000000ff0000ULL) << 24 | \
-+ ((x) & 0x0000ff0000000000ULL) >> 24 | \
-+ ((x) & 0x00000000ff000000ULL) << 8 | \
-+ ((x) & 0x000000ff00000000ULL) >> 8)
-+
-+#if BYTE_ORDER == LITTLE_ENDIAN
-+#define __cpu_to_le16(_x) (_x)
-+#define __cpu_to_le32(_x) (_x)
-+#define __cpu_to_le64(_x) (_x)
-+#define __le16_to_cpu(_x) (_x)
-+#define __le32_to_cpu(_x) (_x)
-+#define __le64_to_cpu(_x) (_x)
-+#elif BYTE_ORDER == BIG_ENDIAN
-+#define __cpu_to_le16(_x) bswap_16(_x)
-+#define __cpu_to_le32(_x) bswap_32(_x)
-+#define __cpu_to_le64(_x) bswap_64(_x)
-+#define __le16_to_cpu(_x) bswap_16(_x)
-+#define __le32_to_cpu(_x) bswap_32(_x)
-+#define __le64_to_cpu(_x) bswap_64(_x)
-+#else
-+# error "unknown endianness."
-+#endif
-+
-+
-+
-+/* general information that might be extracted from a superblock */
-+struct mdinfo {
-+ mdu_array_info_t array;
-+ mdu_disk_info_t disk;
-+ __u64 events;
-+ int uuid[4];
-+ char name[33];
-+ unsigned long long data_offset;
-+ unsigned long long component_size;
-+ int reshape_active;
-+ unsigned long long reshape_progress;
-+ int new_level, delta_disks, new_layout, new_chunk;
-+};
-+
-+struct createinfo {
-+ int uid;
-+ int gid;
-+ int autof;
-+ int mode;
-+ int symlinks;
-+ struct supertype *supertype;
-+};
-+
-+#define Name "mdadm"
-+
-+enum mode {
-+ ASSEMBLE=1,
-+ BUILD,
-+ CREATE,
-+ MANAGE,
-+ MISC,
-+ MONITOR,
-+ GROW,
-+ INCREMENTAL,
-+ AUTODETECT,
-+};
-+
-+extern char short_options[];
-+extern char short_bitmap_auto_options[];
-+extern struct option long_options[];
-+extern char Version[], Usage[], Help[], OptionHelp[],
-+ Help_create[], Help_build[], Help_assemble[], Help_grow[],
-+ Help_incr[],
-+ Help_manage[], Help_misc[], Help_monitor[], Help_config[];
-+
-+/* for option that don't have short equivilents, we assign arbitrary
-+ * small numbers. '1' means an undecorated option, so we start at '2'.
-+ */
-+enum special_options {
-+ AssumeClean = 2,
-+ BitmapChunk,
-+ WriteBehind,
-+ ReAdd,
-+ NoDegraded,
-+ Sparc22,
-+ BackupFile,
-+ HomeHost,
-+ AutoHomeHost,
-+ Symlinks,
-+ AutoDetect,
-+};
-+
-+/* structures read from config file */
-+/* List of mddevice names and identifiers
-+ * Identifiers can be:
-+ * uuid=128-hex-uuid
-+ * super-minor=decimal-minor-number-from-superblock
-+ * devices=comma,separated,list,of,device,names,with,wildcards
-+ *
-+ * If multiple fields are present, the intersection of all matching
-+ * devices is considered
-+ */
-+#define UnSet (0xfffe)
-+typedef struct mddev_ident_s {
-+ char *devname;
-+
-+ int uuid_set;
-+ int uuid[4];
-+ char name[33];
-+
-+ unsigned int super_minor;
-+
-+ char *devices; /* comma separated list of device
-+ * names with wild cards
-+ */
-+ int level;
-+ unsigned int raid_disks;
-+ unsigned int spare_disks;
-+ struct supertype *st;
-+ int autof; /* 1 for normal, 2 for partitioned */
-+ char *spare_group;
-+ char *bitmap_file;
-+ int bitmap_fd;
-+
-+ struct mddev_ident_s *next;
-+} *mddev_ident_t;
-+
-+/* List of device names - wildcards expanded */
-+typedef struct mddev_dev_s {
-+ char *devname;
-+ char disposition; /* 'a' for add, 'r' for remove, 'f' for fail.
-+ * Not set for names read from .config
-+ */
-+ char writemostly;
-+ char re_add;
-+ char used; /* set when used */
-+ struct mddev_dev_s *next;
-+} *mddev_dev_t;
-+
-+typedef struct mapping {
-+ char *name;
-+ int num;
-+} mapping_t;
-+
-+
-+struct mdstat_ent {
-+ char *dev;
-+ int devnum;
-+ int active;
-+ char *level;
-+ char *pattern; /* U or up, _ for down */
-+ int percent; /* -1 if no resync */
-+ int resync; /* 1 if resync, 0 if recovery */
-+ struct mdstat_ent *next;
-+};
-+
-+extern struct mdstat_ent *mdstat_read(int hold, int start);
-+extern void free_mdstat(struct mdstat_ent *ms);
-+extern void mdstat_wait(int seconds);
-+extern int mddev_busy(int devnum);
-+
-+struct map_ent {
-+ struct map_ent *next;
-+ int devnum;
-+ int major,minor;
-+ int uuid[4];
-+ char *path;
-+};
-+extern int map_update(struct map_ent **mpp, int devnum, int major, int minor,
-+ int uuid[4], char *path);
-+extern struct map_ent *map_by_uuid(struct map_ent **map, int uuid[4]);
-+extern void map_read(struct map_ent **melp);
-+extern int map_write(struct map_ent *mel);
-+extern void map_delete(struct map_ent **mapp, int devnum);
-+extern void map_free(struct map_ent *map);
-+extern void map_add(struct map_ent **melp,
-+ int devnum, int major, int minor, int uuid[4], char *path);
-+
-+/* Data structure for holding info read from sysfs */
-+struct sysdev {
-+ char name[20];
-+ int role;
-+ int major, minor;
-+ unsigned long long offset, size;
-+ int state;
-+ int errors;
-+ struct sysdev *next;
-+};
-+struct sysarray {
-+ char name[20];
-+ struct sysdev *devs;
-+ int chunk;
-+ unsigned long long component_size;
-+ int layout;
-+ int level;
-+ int spares;
-+ int cache_size;
-+ int mismatch_cnt;
-+ int major_version, minor_version;
-+};
-+/* various details can be requested */
-+#define GET_LEVEL 1
-+#define GET_LAYOUT 2
-+#define GET_COMPONENT 4
-+#define GET_CHUNK 8
-+#define GET_CACHE 16
-+#define GET_MISMATCH 32
-+#define GET_VERSION 64
-+
-+#define GET_DEVS 1024 /* gets role, major, minor */
-+#define GET_OFFSET 2048
-+#define GET_SIZE 4096
-+#define GET_STATE 8192
-+#define GET_ERROR 16384
-+
-+/* If fd >= 0, get the array it is open on,
-+ * else use devnum. >=0 -> major9. <0.....
-+ */
-+extern void sysfs_free(struct sysarray *sra);
-+extern struct sysarray *sysfs_read(int fd, int devnum, unsigned long options);
-+extern int sysfs_set_str(struct sysarray *sra, struct sysdev *dev,
-+ char *name, char *val);
-+extern int sysfs_set_num(struct sysarray *sra, struct sysdev *dev,
-+ char *name, unsigned long long val);
-+extern int sysfs_get_ll(struct sysarray *sra, struct sysdev *dev,
-+ char *name, unsigned long long *val);
-+
-+
-+extern int save_stripes(int *source, unsigned long long *offsets,
-+ int raid_disks, int chunk_size, int level, int layout,
-+ int nwrites, int *dest,
-+ unsigned long long start, unsigned long long length);
-+extern int restore_stripes(int *dest, unsigned long long *offsets,
-+ int raid_disks, int chunk_size, int level, int layout,
-+ int source, unsigned long long read_offset,
-+ unsigned long long start, unsigned long long length);
-+
-+#ifndef Sendmail
-+#define Sendmail "/usr/lib/sendmail -t"
-+#endif
-+
-+#define SYSLOG_FACILITY LOG_DAEMON
-+
-+extern char *map_num(mapping_t *map, int num);
-+extern int map_name(mapping_t *map, char *name);
-+extern mapping_t r5layout[], pers[], modes[], faultylayout[];
-+
-+extern char *map_dev(int major, int minor, int create);
-+
-+
-+extern struct superswitch {
-+ void (*examine_super)(void *sbv, char *homehost);
-+ void (*brief_examine_super)(void *sbv);
-+ void (*detail_super)(void *sbv, char *homehost);
-+ void (*export_super)(void *sbv);
-+ void (*brief_detail_super)(void *sbv);
-+ void (*uuid_from_super)(int uuid[4], void *sbv);
-+ void (*getinfo_super)(struct mdinfo *info, void *sbv);
-+ int (*match_home)(void *sbv, char *homehost);
-+ int (*update_super)(struct mdinfo *info, void *sbv, char *update,
-+ char *devname, int verbose,
-+ int uuid_set, char *homehost);
-+ int (*init_super)(struct supertype *st, void **sbp, mdu_array_info_t *info, unsigned long long size, char *name, char *homehost, int *uuid);
-+ void (*add_to_super)(void *sbv, mdu_disk_info_t *dinfo);
-+ int (*store_super)(struct supertype *st, int fd, void *sbv);
-+ int (*write_init_super)(struct supertype *st, void *sbv, mdu_disk_info_t *dinfo, char *devname);
-+ int (*compare_super)(void **firstp, void *secondv);
-+ int (*load_super)(struct supertype *st, int fd, void **sbp, char *devname);
-+ struct supertype * (*match_metadata_desc)(char *arg);
-+ __u64 (*avail_size)(struct supertype *st, __u64 size);
-+ int (*add_internal_bitmap)(struct supertype *st, void *sbv, int *chunkp,
-+ int delay, int write_behind,
-+ unsigned long long size, int may_change, int major);
-+ void (*locate_bitmap)(struct supertype *st, int fd, void *sbv);
-+ int (*write_bitmap)(struct supertype *st, int fd, void *sbv);
-+ int major;
-+ int swapuuid; /* true if uuid is bigending rather than hostendian */
-+} super0, super1, *superlist[];
-+
-+struct supertype {
-+ struct superswitch *ss;
-+ int minor_version;
-+ int max_devs;
-+};
-+
-+extern struct supertype *super_by_version(int vers, int minor);
-+extern struct supertype *guess_super(int fd);
-+extern int get_dev_size(int fd, char *dname, unsigned long long *sizep);
-+extern void get_one_disk(int mdfd, mdu_array_info_t *ainf,
-+ mdu_disk_info_t *disk);
-+
-+#if __GNUC__ < 3
-+struct stat64;
-+#endif
-+
-+#define HAVE_NFTW we assume
-+#define HAVE_FTW
-+
-+#ifdef UCLIBC
-+# include <features.h>
-+# ifndef __UCLIBC_HAS_FTW__
-+# undef HAVE_FTW
-+# undef HAVE_NFTW
-+# endif
-+#endif
-+
-+#ifdef __dietlibc__
-+# undef HAVE_NFTW
-+#endif
-+
-+#ifndef HAVE_NFTW
-+# define FTW_PHYS 1
-+# ifndef HAVE_FTW
-+ struct FTW {};
-+# endif
-+#endif
-+
-+#ifdef HAVE_FTW
-+# include <ftw.h>
-+#endif
-+
-+extern int add_dev(const char *name, const struct stat *stb, int flag, struct FTW *s);
-+
-+
-+extern int Manage_ro(char *devname, int fd, int readonly);
-+extern int Manage_runstop(char *devname, int fd, int runstop, int quiet);
-+extern int Manage_resize(char *devname, int fd, long long size, int raid_disks);
-+extern int Manage_reconfig(char *devname, int fd, int layout);
-+extern int Manage_subdevs(char *devname, int fd,
-+ mddev_dev_t devlist, int verbose);
-+extern int autodetect(void);
-+extern int Grow_Add_device(char *devname, int fd, char *newdev);
-+extern int Grow_addbitmap(char *devname, int fd, char *file, int chunk, int delay, int write_behind, int force);
-+extern int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
-+ long long size,
-+ int level, int layout, int chunksize, int raid_disks);
-+extern int Grow_restart(struct supertype *st, struct mdinfo *info,
-+ int *fdlist, int cnt, char *backup_file);
-+
-+
-+extern int Assemble(struct supertype *st, char *mddev, int mdfd,
-+ mddev_ident_t ident,
-+ mddev_dev_t devlist, char *backup_file,
-+ int readonly, int runstop,
-+ char *update, char *homehost,
-+ int verbose, int force);
-+
-+extern int Build(char *mddev, int mdfd, int chunk, int level, int layout,
-+ int raiddisks,
-+ mddev_dev_t devlist, int assume_clean,
-+ char *bitmap_file, int bitmap_chunk, int write_behind, int delay, int verbose);
-+
-+
-+extern int Create(struct supertype *st, char *mddev, int mdfd,
-+ int chunk, int level, int layout, unsigned long long size, int raiddisks, int sparedisks,
-+ char *name, char *homehost, int *uuid,
-+ int subdevs, mddev_dev_t devlist,
-+ int runstop, int verbose, int force, int assume_clean,
-+ char *bitmap_file, int bitmap_chunk, int write_behind, int delay);
-+
-+extern int Detail(char *dev, int brief, int export, int test, char *homehost);
-+extern int Query(char *dev);
-+
-+extern int md_get_version(int fd);
-+extern int get_linux_version(void);
-+extern int parse_uuid(char *str, int uuid[4]);
-+extern int check_ext2(int fd, char *name);
-+extern int check_reiser(int fd, char *name);
-+extern int check_raid(int fd, char *name);
-+
-+extern int get_mdp_major(void);
-+extern int dev_open(char *dev, int flags);
-+extern int is_standard(char *dev, int *nump);
-+
-+extern int parse_auto(char *str, char *msg, int config);
-+extern mddev_ident_t conf_get_ident(char *dev);
-+extern mddev_dev_t conf_get_devs(void);
-+extern int conf_test_dev(char *devname);
-+extern struct createinfo *conf_get_create_info(void);
-+extern void set_conffile(char *file);
-+extern char *conf_get_mailaddr(void);
-+extern char *conf_get_mailfrom(void);
-+extern char *conf_get_program(void);
-+extern char *conf_get_homehost(void);
-+extern char *conf_line(FILE *file);
-+extern char *conf_word(FILE *file, int allow_key);
-+extern void free_line(char *line);
-+extern int match_oneof(char *devices, char *devname);
-+extern void uuid_from_super(int uuid[4], mdp_super_t *super);
-+extern int same_uuid(int a[4], int b[4], int swapuuid);
-+extern void copy_uuid(void *a, int b[4], int swapuuid);
-+/* extern int compare_super(mdp_super_t *first, mdp_super_t *second);*/
-+extern unsigned long calc_csum(void *super, int bytes);
-+extern int enough(int level, int raid_disks, int layout, int clean,
-+ char *avail, int avail_disks);
-+extern int ask(char *mesg);
-+extern unsigned long long get_component_size(int fd);
-+extern void remove_partitions(int fd);
-+
-+
-+extern char *human_size(long long bytes);
-+char *human_size_brief(long long bytes);
-+
-+extern void put_md_name(char *name);
-+extern char *get_md_name(int dev);
-+
-+extern char DefaultConfFile[];
-+
-+extern int open_mddev(char *dev, int autof);
-+extern int open_mddev_devnum(char *devname, int devnum, char *name,
-+ char *chosen_name);
-+
-+
-+#define LEVEL_MULTIPATH (-4)
-+#define LEVEL_LINEAR (-1)
-+#define LEVEL_FAULTY (-5)
-+
-+
-+/* faulty stuff */
-+
-+#define WriteTransient 0
-+#define ReadTransient 1
-+#define WritePersistent 2
-+#define ReadPersistent 3
-+#define WriteAll 4 /* doesn't go to device */
-+#define ReadFixable 5
-+#define Modes 6
-+
-+#define ClearErrors 31
-+#define ClearFaults 30
-+
-+#define AllPersist 100 /* internal use only */
-+#define NoPersist 101
-+
-+#define ModeMask 0x1f
-+#define ModeShift 5
-+
-+
-+#ifdef __TINYC__
-+#undef minor
-+#undef major
-+#undef makedev
-+#define minor(x) ((x)&0xff)
-+#define major(x) (((x)>>8)&0xff)
-+#define makedev(M,m) (((M)<<8) | (m))
-+#endif
-+
-+/* for raid5 */
-+#define ALGORITHM_LEFT_ASYMMETRIC 0
-+#define ALGORITHM_RIGHT_ASYMMETRIC 1
-+#define ALGORITHM_LEFT_SYMMETRIC 2
-+#define ALGORITHM_RIGHT_SYMMETRIC 3
-diff -Nuar --exclude '*.orig' busybox-1.7.4+gentoo/mdadm/mdassemble.c busybox-1.7.4+gentoo+mdadm/mdadm/mdassemble.c
---- busybox-1.7.4+gentoo/mdadm/mdassemble.c 1969-12-31 16:00:00.000000000 -0800
-+++ busybox-1.7.4+gentoo+mdadm/mdadm/mdassemble.c 2008-03-11 10:31:00.000000000 -0700
-@@ -0,0 +1,908 @@
-+/*
-+ * mdadm - manage Linux "md" devices aka RAID arrays.
-+ *
-+ * Copyright (C) 2001-2006 Neil Brown <neilb@suse.de>
-+ *
-+ *
-+ * 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
-+ *
-+ * Author: Neil Brown
-+ * Email: <neilb@cse.unsw.edu.au>
-+ * Paper: Neil Brown
-+ * School of Computer Science and Engineering
-+ * The University of New South Wales
-+ * Sydney, 2052
-+ * Australia
-+ */
-+
-+#include "mdadm.h"
-+#include <ctype.h>
-+
-+static int name_matches(char *found, char *required, char *homehost)
-+{
-+ /* See if the name found matches the required name, possibly
-+ * prefixed with 'homehost'
-+ */
-+ char fnd[33];
-+
-+ strncpy(fnd, found, 32);
-+ fnd[32] = 0;
-+ if (strcmp(found, required)==0)
-+ return 1;
-+ if (homehost) {
-+ int l = strlen(homehost);
-+ if (l < 32 && fnd[l] == ':' &&
-+ strcmp(fnd+l+1, required)==0)
-+ return 1;
-+ }
-+ return 0;
-+}
-+
-+int open_mddev(char *dev, int autof/*unused */)
-+{
-+ int mdfd = open(dev, O_RDWR, 0);
-+ if (mdfd < 0)
-+ fprintf(stderr, Name ": error opening %s: %s\n",
-+ dev, strerror(errno));
-+ else if (md_get_version(mdfd) <= 0) {
-+ fprintf(stderr, Name ": %s does not appear to be an md device\n",
-+ dev);
-+ close(mdfd);
-+ mdfd = -1;
-+ }
-+ return mdfd;
-+}
-+
-+int Assemble(struct supertype *st, char *mddev, int mdfd,
-+ mddev_ident_t ident,
-+ mddev_dev_t devlist, char *backup_file,
-+ int readonly, int runstop,
-+ char *update, char *homehost,
-+ int verbose, int force)
-+{
-+ /*
-+ * The task of Assemble is to find a collection of
-+ * devices that should (according to their superblocks)
-+ * form an array, and to give this collection to the MD driver.
-+ * In Linux-2.4 and later, this involves submitting a
-+ * SET_ARRAY_INFO ioctl with no arg - to prepare
-+ * the array - and then submit a number of
-+ * ADD_NEW_DISK ioctls to add disks into
-+ * the array. Finally RUN_ARRAY might
-+ * be submitted to start the array.
-+ *
-+ * Much of the work of Assemble is in finding and/or
-+ * checking the disks to make sure they look right.
-+ *
-+ * If mddev is not set, then scan must be set and we
-+ * read through the config file for dev+uuid mapping
-+ * We recurse, setting mddev, for each device that
-+ * - isn't running
-+ * - has a valid uuid (or any uuid if !uuidset)
-+ *
-+ * If mddev is set, we try to determine state of md.
-+ * check version - must be at least 0.90.0
-+ * check kernel version. must be at least 2.4.
-+ * If not, we can possibly fall back on START_ARRAY
-+ * Try to GET_ARRAY_INFO.
-+ * If possible, give up
-+ * If not, try to STOP_ARRAY just to make sure
-+ *
-+ * If !uuidset and scan, look in conf-file for uuid
-+ * If not found, give up
-+ * If !devlist and scan and uuidset, get list of devs from conf-file
-+ *
-+ * For each device:
-+ * Check superblock - discard if bad
-+ * Check uuid (set if we don't have one) - discard if no match
-+ * Check superblock similarity if we have a superblock - discard if different
-+ * Record events, devicenum
-+ * This should give us a list of devices for the array
-+ * We should collect the most recent event number
-+ *
-+ * Count disks with recent enough event count
-+ * While force && !enough disks
-+ * Choose newest rejected disks, update event count
-+ * mark clean and rewrite superblock
-+ * If recent kernel:
-+ * SET_ARRAY_INFO
-+ * foreach device with recent events : ADD_NEW_DISK
-+ * if runstop == 1 || "enough" disks and runstop==0 -> RUN_ARRAY
-+ * If old kernel:
-+ * Check the device numbers in superblock are right
-+ * update superblock if any changes
-+ * START_ARRAY
-+ *
-+ */
-+ int clean = 0;
-+ int old_linux = 0;
-+ int vers = 0; /* Keep gcc quite - it really is initialised */
-+ void *first_super = NULL, *super = NULL;
-+ struct {
-+ char *devname;
-+ unsigned int major, minor;
-+ unsigned int oldmajor, oldminor;
-+ long long events;
-+ int uptodate;
-+ int state;
-+ int raid_disk;
-+ int disk_nr;
-+ } *devices;
-+ int *best = NULL; /* indexed by raid_disk */
-+ unsigned int bestcnt = 0;
-+ int devcnt = 0;
-+ unsigned int okcnt, sparecnt;
-+ unsigned int req_cnt;
-+ unsigned int i;
-+ int most_recent = 0;
-+ int chosen_drive;
-+ int change = 0;
-+ int inargv = 0;
-+ int bitmap_done;
-+ int start_partial_ok = (runstop >= 0) && (force || devlist==NULL || mdfd < 0);
-+ unsigned int num_devs;
-+ mddev_dev_t tmpdev;
-+ struct mdinfo info;
-+ char *avail;
-+ int nextspare = 0;
-+
-+ if (mdfd < 0)
-+ return 2;
-+
-+ if (get_linux_version() < 2004000)
-+ old_linux = 1;
-+
-+ if (mdfd >= 0) {
-+ vers = md_get_version(mdfd);
-+ if (vers <= 0) {
-+ fprintf(stderr, Name ": %s appears not to be an md device.\n", mddev);
-+ return 1;
-+ }
-+ if (vers < 9000) {
-+ fprintf(stderr, Name ": Assemble requires driver version 0.90.0 or later.\n"
-+ " Upgrade your kernel or try --build\n");
-+ return 1;
-+ }
-+
-+ if (ioctl(mdfd, GET_ARRAY_INFO, &info.array)>=0) {
-+ fprintf(stderr, Name ": device %s already active - cannot assemble it\n",
-+ mddev);
-+ return 1;
-+ }
-+ ioctl(mdfd, STOP_ARRAY, NULL); /* just incase it was started but has no content */
-+ }
-+ /*
-+ * If any subdevs are listed, then any that don't
-+ * match ident are discarded. Remainder must all match and
-+ * become the array.
-+ * If no subdevs, then we scan all devices in the config file, but
-+ * there must be something in the identity
-+ */
-+
-+ if (!devlist &&
-+ ident->uuid_set == 0 &&
-+ ident->super_minor < 0 &&
-+ ident->devices == NULL) {
-+ fprintf(stderr, Name ": No identity information available for %s - cannot assemble.\n",
-+ mddev ? mddev : "further assembly");
-+ return 1;
-+ }
-+ if (devlist == NULL)
-+ devlist = conf_get_devs();
-+ else if (mdfd >= 0)
-+ inargv = 1;
-+
-+ tmpdev = devlist; num_devs = 0;
-+ while (tmpdev) {
-+ if (tmpdev->used)
-+ tmpdev->used = 2;
-+ else
-+ num_devs++;
-+ tmpdev = tmpdev->next;
-+ }
-+ devices = malloc(num_devs * sizeof(*devices));
-+
-+ if (!st && ident->st) st = ident->st;
-+
-+ if (verbose>0)
-+ fprintf(stderr, Name ": looking for devices for %s\n",
-+ mddev ? mddev : "further assembly");
-+
-+ /* first walk the list of devices to find a consistent set
-+ * that match the criterea, if that is possible.
-+ * We flag the one we like with 'used'.
-+ */
-+ for (tmpdev = devlist;
-+ tmpdev;
-+ tmpdev = tmpdev->next) {
-+ char *devname = tmpdev->devname;
-+ int dfd;
-+ struct stat stb;
-+ struct supertype *tst = st;
-+
-+ if (tmpdev->used > 1) continue;
-+
-+ if (ident->devices &&
-+ !match_oneof(ident->devices, devname)) {
-+ if ((inargv && verbose>=0) || verbose > 0)
-+ fprintf(stderr, Name ": %s is not one of %s\n", devname, ident->devices);
-+ continue;
-+ }
-+
-+ if (super) {
-+ free(super);
-+ super = NULL;
-+ }
-+
-+ dfd = dev_open(devname, O_RDONLY|O_EXCL);
-+ if (dfd < 0) {
-+ if ((inargv && verbose >= 0) || verbose > 0)
-+ fprintf(stderr, Name ": cannot open device %s: %s\n",
-+ devname, strerror(errno));
-+ tmpdev->used = 2;
-+ } else if (fstat(dfd, &stb)< 0) {
-+ /* Impossible! */
-+ fprintf(stderr, Name ": fstat failed for %s: %s\n",
-+ devname, strerror(errno));
-+ tmpdev->used = 2;
-+ } else if ((stb.st_mode & S_IFMT) != S_IFBLK) {
-+ fprintf(stderr, Name ": %s is not a block device.\n",
-+ devname);
-+ tmpdev->used = 2;
-+ } else if (!tst && (tst = guess_super(dfd)) == NULL) {
-+ if ((inargv && verbose >= 0) || verbose > 0)
-+ fprintf(stderr, Name ": no recogniseable superblock on %s\n",
-+ devname);
-+ tmpdev->used = 2;
-+ } else if (tst->ss->load_super(tst,dfd, &super, NULL)) {
-+ if ((inargv && verbose >= 0) || verbose > 0)
-+ fprintf( stderr, Name ": no RAID superblock on %s\n",
-+ devname);
-+ } else {
-+ tst->ss->getinfo_super(&info, super);
-+ }
-+ if (dfd >= 0) close(dfd);
-+
-+ if (ident->uuid_set && (!update || strcmp(update, "uuid")!= 0) &&
-+ (!super || same_uuid(info.uuid, ident->uuid, tst->ss->swapuuid)==0)) {
-+ if ((inargv && verbose >= 0) || verbose > 0)
-+ fprintf(stderr, Name ": %s has wrong uuid.\n",
-+ devname);
-+ continue;
-+ }
-+ if (ident->name[0] && (!update || strcmp(update, "name")!= 0) &&
-+ (!super || name_matches(info.name, ident->name, homehost)==0)) {
-+ if ((inargv && verbose >= 0) || verbose > 0)
-+ fprintf(stderr, Name ": %s has wrong name.\n",
-+ devname);
-+ continue;
-+ }
-+ if (ident->super_minor != UnSet &&
-+ (!super || ident->super_minor != info.array.md_minor)) {
-+ if ((inargv && verbose >= 0) || verbose > 0)
-+ fprintf(stderr, Name ": %s has wrong super-minor.\n",
-+ devname);
-+ continue;
-+ }
-+ if (ident->level != UnSet &&
-+ (!super|| ident->level != info.array.level)) {
-+ if ((inargv && verbose >= 0) || verbose > 0)
-+ fprintf(stderr, Name ": %s has wrong raid level.\n",
-+ devname);
-+ continue;
-+ }
-+ if (ident->raid_disks != UnSet &&
-+ (!super || ident->raid_disks!= info.array.raid_disks)) {
-+ if ((inargv && verbose >= 0) || verbose > 0)
-+ fprintf(stderr, Name ": %s requires wrong number of drives.\n",
-+ devname);
-+ continue;
-+ }
-+ if (mdfd < 0) {
-+ if (tst == NULL || super == NULL)
-+ continue;
-+ if (update == NULL &&
-+ tst->ss->match_home(super, homehost)==0) {
-+ if ((inargv && verbose >= 0) || verbose > 0)
-+ fprintf(stderr, Name ": %s is not built for host %s.\n",
-+ devname, homehost);
-+ /* Auto-assemble, and this is not a usable host */
-+ /* if update != NULL, we are updating the host
-+ * name... */
-+ continue;
-+ }
-+ }
-+ /* If we are this far, then we are nearly commited to this device.
-+ * If the super_block doesn't exist, or doesn't match others,
-+ * then we probably cannot continue
-+ * However if one of the arrays is for the homehost, and
-+ * the other isn't that can disambiguate.
-+ */
-+
-+ if (!super) {
-+ fprintf(stderr, Name ": %s has no superblock - assembly aborted\n",
-+ devname);
-+ free(first_super);
-+ return 1;
-+ }
-+
-+ if (st == NULL)
-+ st = tst;
-+ if (st->ss != tst->ss ||
-+ st->minor_version != tst->minor_version ||
-+ st->ss->compare_super(&first_super, super) != 0) {
-+ /* Some mismatch. If exactly one array matches this host,
-+ * we can resolve on that one.
-+ * Or, if we are auto assembling, we just ignore the second
-+ * for now.
-+ */
-+ if (mdfd < 0)
-+ continue;
-+ if (homehost) {
-+ int first = st->ss->match_home(first_super, homehost);
-+ int last = tst->ss->match_home(super, homehost);
-+ if (first+last == 1) {
-+ /* We can do something */
-+ if (first) {/* just ignore this one */
-+ if ((inargv && verbose >= 0) || verbose > 0)
-+ fprintf(stderr, Name ": %s misses out due to wrong homehost\n",
-+ devname);
-+ continue;
-+ } else { /* reject all those sofar */
-+ mddev_dev_t td;
-+ if ((inargv && verbose >= 0) || verbose > 0)
-+ fprintf(stderr, Name ": %s overrides previous devices due to good homehost\n",
-+ devname);
-+ for (td=devlist; td != tmpdev; td=td->next)
-+ if (td->used == 1)
-+ td->used = 0;
-+ tmpdev->used = 1;
-+ continue;
-+ }
-+ }
-+ }
-+ fprintf(stderr, Name ": superblock on %s doesn't match others - assembly aborted\n",
-+ devname);
-+ free(super);
-+ free(first_super);
-+ return 1;
-+ }
-+
-+ tmpdev->used = 1;
-+ }
-+
-+ /* Ok, no bad inconsistancy, we can try updating etc */
-+ bitmap_done = 0;
-+ for (tmpdev = devlist; tmpdev; tmpdev=tmpdev->next) if (tmpdev->used == 1) {
-+ char *devname = tmpdev->devname;
-+ struct stat stb;
-+ /* looks like a good enough match to update the super block if needed */
-+ {
-+ int dfd;
-+ dfd = dev_open(devname, O_RDWR|O_EXCL);
-+
-+ remove_partitions(dfd);
-+
-+ if (super) {
-+ free(super);
-+ super = NULL;
-+ }
-+
-+ st->ss->load_super(st, dfd, &super, NULL);
-+ st->ss->getinfo_super(&info, super);
-+ close(dfd);
-+ }
-+
-+ stat(devname, &stb);
-+
-+ if (verbose > 0)
-+ fprintf(stderr, Name ": %s is identified as a member of %s, slot %d.\n",
-+ devname, mddev, info.disk.raid_disk);
-+ devices[devcnt].devname = devname;
-+ devices[devcnt].major = major(stb.st_rdev);
-+ devices[devcnt].minor = minor(stb.st_rdev);
-+ devices[devcnt].oldmajor = info.disk.major;
-+ devices[devcnt].oldminor = info.disk.minor;
-+ devices[devcnt].events = info.events;
-+ devices[devcnt].raid_disk = info.disk.raid_disk;
-+ devices[devcnt].disk_nr = info.disk.number;
-+ devices[devcnt].uptodate = 0;
-+ devices[devcnt].state = info.disk.state;
-+ if (most_recent < devcnt) {
-+ if (devices[devcnt].events
-+ > devices[most_recent].events)
-+ most_recent = devcnt;
-+ }
-+ if (info.array.level == -4)
-+ /* with multipath, the raid_disk from the superblock is meaningless */
-+ i = devcnt;
-+ else
-+ i = devices[devcnt].raid_disk;
-+ if (i+1 == 0) {
-+ if (nextspare < info.array.raid_disks)
-+ nextspare = info.array.raid_disks;
-+ i = nextspare++;
-+ } else {
-+ if (i >= info.array.raid_disks &&
-+ i >= nextspare)
-+ nextspare = i+1;
-+ }
-+ if (i < 10000) {
-+ if (i >= bestcnt) {
-+ unsigned int newbestcnt = i+10;
-+ int *newbest = malloc(sizeof(int)*newbestcnt);
-+ unsigned int c;
-+ for (c=0; c < newbestcnt; c++)
-+ if (c < bestcnt)
-+ newbest[c] = best[c];
-+ else
-+ newbest[c] = -1;
-+ if (best)free(best);
-+ best = newbest;
-+ bestcnt = newbestcnt;
-+ }
-+ if (best[i] >=0 &&
-+ devices[best[i]].events == devices[devcnt].events &&
-+ devices[best[i]].minor != devices[devcnt].minor &&
-+ st->ss->major == 0 &&
-+ info.array.level != -4) {
-+ /* two different devices with identical superblock.
-+ * Could be a mis-detection caused by overlapping
-+ * partitions. fail-safe.
-+ */
-+ fprintf(stderr, Name ": WARNING %s and %s appear"
-+ " to have very similar superblocks.\n"
-+ " If they are really different, "
-+ "please --zero the superblock on one\n"
-+ " If they are the same or overlap,"
-+ " please remove one from %s.\n",
-+ devices[best[i]].devname, devname,
-+ inargv ? "the list" :
-+ "the\n DEVICE list in mdadm.conf"
-+ );
-+ return 1;
-+ }
-+ if (best[i] == -1
-+ || devices[best[i]].events < devices[devcnt].events)
-+ best[i] = devcnt;
-+ }
-+ devcnt++;
-+ }
-+
-+ if (super)
-+ free(super);
-+ super = NULL;
-+
-+ if (update && strcmp(update, "byteorder")==0)
-+ st->minor_version = 90;
-+
-+ if (devcnt == 0) {
-+ fprintf(stderr, Name ": no devices found for %s\n",
-+ mddev);
-+ free(first_super);
-+ return 1;
-+ }
-+
-+ st->ss->getinfo_super(&info, first_super);
-+ clean = info.array.state & 1;
-+
-+ /* now we have some devices that might be suitable.
-+ * I wonder how many
-+ */
-+ avail = malloc(info.array.raid_disks);
-+ memset(avail, 0, info.array.raid_disks);
-+ okcnt = 0;
-+ sparecnt=0;
-+ for (i=0; i< bestcnt ;i++) {
-+ int j = best[i];
-+ int event_margin = 1; /* always allow a difference of '1'
-+ * like the kernel does
-+ */
-+ if (j < 0) continue;
-+ /* note: we ignore error flags in multipath arrays
-+ * as they don't make sense
-+ */
-+ if (info.array.level != -4)
-+ if (!(devices[j].state & (1<<MD_DISK_SYNC))) {
-+ if (!(devices[j].state & (1<<MD_DISK_FAULTY)))
-+ sparecnt++;
-+ continue;
-+ }
-+ if (devices[j].events+event_margin >=
-+ devices[most_recent].events) {
-+ devices[j].uptodate = 1;
-+ if (i < info.array.raid_disks) {
-+ okcnt++;
-+ avail[i]=1;
-+ } else
-+ sparecnt++;
-+ }
-+ }
-+ while (force && !enough(info.array.level, info.array.raid_disks,
-+ info.array.layout, 1,
-+ avail, okcnt)) {
-+ /* Choose the newest best drive which is
-+ * not up-to-date, update the superblock
-+ * and add it.
-+ */
-+ int fd;
-+ long long current_events;
-+ chosen_drive = -1;
-+ for (i=0; i<info.array.raid_disks && i < bestcnt; i++) {
-+ int j = best[i];
-+ if (j>=0 &&
-+ !devices[j].uptodate &&
-+ devices[j].events > 0 &&
-+ (chosen_drive < 0 ||
-+ devices[j].events > devices[chosen_drive].events))
-+ chosen_drive = j;
-+ }
-+ if (chosen_drive < 0)
-+ break;
-+ current_events = devices[chosen_drive].events;
-+ add_another:
-+ if (verbose >= 0)
-+ fprintf(stderr, Name ": forcing event count in %s(%d) from %d upto %d\n",
-+ devices[chosen_drive].devname, devices[chosen_drive].raid_disk,
-+ (int)(devices[chosen_drive].events),
-+ (int)(devices[most_recent].events));
-+ fd = dev_open(devices[chosen_drive].devname, O_RDWR|O_EXCL);
-+ if (fd < 0) {
-+ fprintf(stderr, Name ": Couldn't open %s for write - not updating\n",
-+ devices[chosen_drive].devname);
-+ devices[chosen_drive].events = 0;
-+ continue;
-+ }
-+ if (st->ss->load_super(st,fd, &super, NULL)) {
-+ close(fd);
-+ fprintf(stderr, Name ": RAID superblock disappeared from %s - not updating.\n",
-+ devices[chosen_drive].devname);
-+ devices[chosen_drive].events = 0;
-+ continue;
-+ }
-+ info.events = devices[most_recent].events;
-+ st->ss->update_super(&info, super, "force-one",
-+ devices[chosen_drive].devname, verbose,
-+ 0, NULL);
-+
-+ if (st->ss->store_super(st, fd, super)) {
-+ close(fd);
-+ fprintf(stderr, Name ": Could not re-write superblock on %s\n",
-+ devices[chosen_drive].devname);
-+ devices[chosen_drive].events = 0;
-+ free(super);
-+ continue;
-+ }
-+ close(fd);
-+ devices[chosen_drive].events = devices[most_recent].events;
-+ devices[chosen_drive].uptodate = 1;
-+ avail[chosen_drive] = 1;
-+ okcnt++;
-+ free(super);
-+
-+ /* If there are any other drives of the same vintage,
-+ * add them in as well. We can't lose and we might gain
-+ */
-+ for (i=0; i<info.array.raid_disks && i < bestcnt ; i++) {
-+ int j = best[i];
-+ if (j >= 0 &&
-+ !devices[j].uptodate &&
-+ devices[j].events > 0 &&
-+ devices[j].events == current_events) {
-+ chosen_drive = j;
-+ goto add_another;
-+ }
-+ }
-+ }
-+
-+ /* Now we want to look at the superblock which the kernel will base things on
-+ * and compare the devices that we think are working with the devices that the
-+ * superblock thinks are working.
-+ * If there are differences and --force is given, then update this chosen
-+ * superblock.
-+ */
-+ chosen_drive = -1;
-+ super = NULL;
-+ for (i=0; chosen_drive < 0 && i<bestcnt; i++) {
-+ int j = best[i];
-+ int fd;
-+
-+ if (j<0)
-+ continue;
-+ if (!devices[j].uptodate)
-+ continue;
-+ chosen_drive = j;
-+ if ((fd=dev_open(devices[j].devname, O_RDONLY|O_EXCL))< 0) {
-+ fprintf(stderr, Name ": Cannot open %s: %s\n",
-+ devices[j].devname, strerror(errno));
-+ return 1;
-+ }
-+ if (st->ss->load_super(st,fd, &super, NULL)) {
-+ close(fd);
-+ fprintf(stderr, Name ": RAID superblock has disappeared from %s\n",
-+ devices[j].devname);
-+ return 1;
-+ }
-+ close(fd);
-+ }
-+ if (super == NULL) {
-+ fprintf(stderr, Name ": No suitable drives found for %s\n", mddev);
-+ return 1;
-+ }
-+ st->ss->getinfo_super(&info, super);
-+ for (i=0; i<bestcnt; i++) {
-+ int j = best[i];
-+ unsigned int desired_state;
-+
-+ if (i < info.array.raid_disks)
-+ desired_state = (1<<MD_DISK_ACTIVE) | (1<<MD_DISK_SYNC);
-+ else
-+ desired_state = 0;
-+
-+ if (j<0)
-+ continue;
-+ if (!devices[j].uptodate)
-+ continue;
-+ info.disk.number = devices[j].disk_nr;
-+ info.disk.raid_disk = i;
-+ info.disk.state = desired_state;
-+
-+ if (devices[j].uptodate &&
-+ st->ss->update_super(&info, super, "assemble", NULL, verbose, 0, NULL)) {
-+ if (force) {
-+ if (verbose >= 0)
-+ fprintf(stderr, Name ": "
-+ "clearing FAULTY flag for device %d in %s for %s\n",
-+ j, mddev, devices[j].devname);
-+ change = 1;
-+ } else {
-+ if (verbose >= -1)
-+ fprintf(stderr, Name ": "
-+ "device %d in %s has wrong state in superblock, but %s seems ok\n",
-+ i, mddev, devices[j].devname);
-+ }
-+ }
-+#if 0
-+ if (!devices[j].uptodate &&
-+ !(super.disks[i].state & (1 << MD_DISK_FAULTY))) {
-+ fprintf(stderr, Name ": devices %d of %s is not marked FAULTY in superblock, but cannot be found\n",
-+ i, mddev);
-+ }
-+#endif
-+ }
-+ if (force && !clean &&
-+ !enough(info.array.level, info.array.raid_disks,
-+ info.array.layout, clean,
-+ avail, okcnt)) {
-+ change += st->ss->update_super(&info, super, "force-array",
-+ devices[chosen_drive].devname, verbose,
-+ 0, NULL);
-+ clean = 1;
-+ }
-+
-+ if (change) {
-+ int fd;
-+ fd = dev_open(devices[chosen_drive].devname, O_RDWR|O_EXCL);
-+ if (fd < 0) {
-+ fprintf(stderr, Name ": Could not open %s for write - cannot Assemble array.\n",
-+ devices[chosen_drive].devname);
-+ return 1;
-+ }
-+ if (st->ss->store_super(st, fd, super)) {
-+ close(fd);
-+ fprintf(stderr, Name ": Could not re-write superblock on %s\n",
-+ devices[chosen_drive].devname);
-+ return 1;
-+ }
-+ close(fd);
-+ }
-+
-+ /* count number of in-sync devices according to the superblock.
-+ * We must have this number to start the array without -s or -R
-+ */
-+ req_cnt = info.array.working_disks;
-+
-+ /* Almost ready to actually *do* something */
-+ if (!old_linux) {
-+ int rv;
-+ if ((vers % 100) >= 1) { /* can use different versions */
-+ mdu_array_info_t inf;
-+ memset(&inf, 0, sizeof(inf));
-+ inf.major_version = st->ss->major;
-+ inf.minor_version = st->minor_version;
-+ rv = ioctl(mdfd, SET_ARRAY_INFO, &inf);
-+ } else
-+ rv = ioctl(mdfd, SET_ARRAY_INFO, NULL);
-+
-+ if (rv) {
-+ fprintf(stderr, Name ": SET_ARRAY_INFO failed for %s: %s\n",
-+ mddev, strerror(errno));
-+ return 1;
-+ }
-+ if (ident->bitmap_fd >= 0) {
-+ if (ioctl(mdfd, SET_BITMAP_FILE, ident->bitmap_fd) != 0) {
-+ fprintf(stderr, Name ": SET_BITMAP_FILE failed.\n");
-+ return 1;
-+ }
-+ } else if (ident->bitmap_file) {
-+ /* From config file */
-+ int bmfd = open(ident->bitmap_file, O_RDWR);
-+ if (bmfd < 0) {
-+ fprintf(stderr, Name ": Could not open bitmap file %s\n",
-+ ident->bitmap_file);
-+ return 1;
-+ }
-+ if (ioctl(mdfd, SET_BITMAP_FILE, bmfd) != 0) {
-+ fprintf(stderr, Name ": Failed to set bitmapfile for %s\n", mddev);
-+ close(bmfd);
-+ return 1;
-+ }
-+ close(bmfd);
-+ }
-+
-+ /* First, add the raid disks, but add the chosen one last */
-+ for (i=0; i<= bestcnt; i++) {
-+ int j;
-+ if (i < bestcnt) {
-+ j = best[i];
-+ if (j == chosen_drive)
-+ continue;
-+ } else
-+ j = chosen_drive;
-+
-+ if (j >= 0 /* && devices[j].uptodate */) {
-+ mdu_disk_info_t disk;
-+ memset(&disk, 0, sizeof(disk));
-+ disk.major = devices[j].major;
-+ disk.minor = devices[j].minor;
-+ if (ioctl(mdfd, ADD_NEW_DISK, &disk)!=0) {
-+ fprintf(stderr, Name ": failed to add %s to %s: %s\n",
-+ devices[j].devname,
-+ mddev,
-+ strerror(errno));
-+ if (i < info.array.raid_disks || i == bestcnt)
-+ okcnt--;
-+ else
-+ sparecnt--;
-+ } else if (verbose > 0)
-+ fprintf(stderr, Name ": added %s to %s as %d\n",
-+ devices[j].devname, mddev, devices[j].raid_disk);
-+ } else if (verbose > 0 && i < info.array.raid_disks)
-+ fprintf(stderr, Name ": no uptodate device for slot %d of %s\n",
-+ i, mddev);
-+ }
-+
-+ if (runstop == 1 ||
-+ (runstop <= 0 &&
-+ ( enough(info.array.level, info.array.raid_disks,
-+ info.array.layout, clean, avail, okcnt) &&
-+ (okcnt >= req_cnt || start_partial_ok)
-+ ))) {
-+ if (ioctl(mdfd, RUN_ARRAY, NULL)==0) {
-+ if (verbose >= 0) {
-+ fprintf(stderr, Name ": %s has been started with %d drive%s",
-+ mddev, okcnt, okcnt==1?"":"s");
-+ if (okcnt < info.array.raid_disks)
-+ fprintf(stderr, " (out of %d)", info.array.raid_disks);
-+ if (sparecnt)
-+ fprintf(stderr, " and %d spare%s", sparecnt, sparecnt==1?"":"s");
-+ fprintf(stderr, ".\n");
-+ }
-+ return 0;
-+ }
-+ fprintf(stderr, Name ": failed to RUN_ARRAY %s: %s\n",
-+ mddev, strerror(errno));
-+
-+ if (!enough(info.array.level, info.array.raid_disks,
-+ info.array.layout, 1, avail, okcnt))
-+ fprintf(stderr, Name ": Not enough devices to "
-+ "start the array.\n");
-+ else if (!enough(info.array.level,
-+ info.array.raid_disks,
-+ info.array.layout, clean,
-+ avail, okcnt))
-+ fprintf(stderr, Name ": Not enough devices to "
-+ "start the array while not clean "
-+ "- consider --force.\n");
-+
-+ return 1;
-+ }
-+ if (runstop == -1) {
-+ fprintf(stderr, Name ": %s assembled from %d drive%s",
-+ mddev, okcnt, okcnt==1?"":"s");
-+ if (okcnt != info.array.raid_disks)
-+ fprintf(stderr, " (out of %d)", info.array.raid_disks);
-+ fprintf(stderr, ", but not started.\n");
-+ return 0;
-+ }
-+ if (verbose >= -1) {
-+ fprintf(stderr, Name ": %s assembled from %d drive%s", mddev, okcnt, okcnt==1?"":"s");
-+ if (sparecnt)
-+ fprintf(stderr, " and %d spare%s", sparecnt, sparecnt==1?"":"s");
-+ if (!enough(info.array.level, info.array.raid_disks,
-+ info.array.layout, 1, avail, okcnt))
-+ fprintf(stderr, " - not enough to start the array.\n");
-+ else if (!enough(info.array.level,
-+ info.array.raid_disks,
-+ info.array.layout, clean,
-+ avail, okcnt))
-+ fprintf(stderr, " - not enough to start the "
-+ "array while not clean - consider "
-+ "--force.\n");
-+ else {
-+ if (req_cnt == info.array.raid_disks)
-+ fprintf(stderr, " - need all %d to start it", req_cnt);
-+ else
-+ fprintf(stderr, " - need %d of %d to start", req_cnt, info.array.raid_disks);
-+ fprintf(stderr, " (use --run to insist).\n");
-+ }
-+ }
-+ return 1;
-+ } else {
-+ /* The "chosen_drive" is a good choice, and if necessary, the superblock has
-+ * been updated to point to the current locations of devices.
-+ * so we can just start the array
-+ */
-+ unsigned long dev;
-+ dev = makedev(devices[chosen_drive].major,
-+ devices[chosen_drive].minor);
-+ if (ioctl(mdfd, START_ARRAY, dev)) {
-+ fprintf(stderr, Name ": Cannot start array: %s\n",
-+ strerror(errno));
-+ }
-+
-+ }
-+ return 0;
-+}
-+
-+int mdfd = -1;
-+int runstop = 0;
-+int readonly = 0;
-+int verbose = 0;
-+int force = 0;
-+
-+int mdassemble_main(int argc, char **argv) {
-+ mddev_ident_t array_list = conf_get_ident(NULL);
-+ int minor;
-+ if (!array_list) {
-+ fprintf(stderr, Name ": No arrays found in config file\n");
-+ return 1;
-+ } else {
-+ for (; array_list; array_list = array_list->next) {
-+ mdu_array_info_t array;
-+ if (!strncmp("/dev/md", array_list->devname, 7)) {
-+ errno = 0;
-+ minor = strtoul(array_list->devname + 7, NULL, 0);
-+ if (!errno) {
-+ mknod(array_list->devname, S_IFBLK|0600, makedev(MD_MAJOR, minor));
-+ }
-+ }
-+ mdfd = open_mddev(array_list->devname, array_list->autof);
-+ if (mdfd < 0) {
-+
-+ fprintf(stderr, Name ": failed to open array\n");
-+ continue;
-+ }
-+ if (ioctl(mdfd, GET_ARRAY_INFO, &array) < 0) {
-+ Assemble(array_list->st, array_list->devname, mdfd,
-+ array_list, NULL, NULL,
-+ readonly, runstop, NULL, NULL, verbose, force);
-+ }
-+ close(mdfd);
-+ }
-+ }
-+ return 0;
-+}
-+
-diff -Nuar --exclude '*.orig' busybox-1.7.4+gentoo/mdadm/mdexamine.c busybox-1.7.4+gentoo+mdadm/mdadm/mdexamine.c
---- busybox-1.7.4+gentoo/mdadm/mdexamine.c 1969-12-31 16:00:00.000000000 -0800
-+++ busybox-1.7.4+gentoo+mdadm/mdadm/mdexamine.c 2008-03-11 10:31:00.000000000 -0700
-@@ -0,0 +1,157 @@
-+/*
-+ * mdadm - manage Linux "md" devices aka RAID arrays.
-+ *
-+ * Copyright (C) 2001-2006 Neil Brown <neilb@suse.de>
-+ *
-+ *
-+ * 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
-+ *
-+ * Author: Neil Brown
-+ * Email: <neilb@cse.unsw.edu.au>
-+ * Paper: Neil Brown
-+ * School of Computer Science and Engineering
-+ * The University of New South Wales
-+ * Sydney, 2052
-+ * Australia
-+ */
-+
-+#include "mdadm.h"
-+#include "dlink.h"
-+
-+#if ! defined(__BIG_ENDIAN) && ! defined(__LITTLE_ENDIAN)
-+#error no endian defined
-+#endif
-+#include "md_u.h"
-+#include "md_p.h"
-+
-+static int Examine(mddev_dev_t devlist, int brief, int scan,
-+ int SparcAdjust, struct supertype *forcest,
-+ char *homehost)
-+{
-+
-+ /* Read the raid superblock from a device and
-+ * display important content.
-+ *
-+ * If cannot be found, print reason: too small, bad magic
-+ *
-+ * Print:
-+ * version, ctime, level, size, raid+spare+
-+ * prefered minor
-+ * uuid
-+ *
-+ * utime, state etc
-+ *
-+ * If (brief) gather devices for same array and just print a mdadm.conf line including devices=
-+ * if devlist==NULL, use conf_get_devs()
-+ */
-+ int fd;
-+ void *super = NULL;
-+ int rv = 0;
-+ int err = 0;
-+
-+ struct array {
-+ void *super;
-+ struct supertype *st;
-+ struct mdinfo info;
-+ void *devs;
-+ struct array *next;
-+ int spares;
-+ } *arrays = NULL;
-+
-+ for (; devlist ; devlist=devlist->next) {
-+ struct supertype *st = forcest;
-+
-+ fd = dev_open(devlist->devname, O_RDONLY);
-+ if (fd < 0) {
-+ if (!scan) {
-+ fprintf(stderr,Name ": cannot open %s: %s\n",
-+ devlist->devname, strerror(errno));
-+ rv = 1;
-+ }
-+ err = 1;
-+ }
-+ else {
-+ if (!st)
-+ st = guess_super(fd);
-+ if (st)
-+ err = st->ss->load_super(st, fd, &super, (brief||scan)?NULL:devlist->devname);
-+ else {
-+ if (!brief) {
-+ fprintf(stderr, Name ": No md superblock detected on %s.\n", devlist->devname);
-+ rv = 1;
-+ }
-+ err = 1;
-+ }
-+ close(fd);
-+ }
-+ if (err)
-+ continue;
-+
-+ if (SparcAdjust)
-+ st->ss->update_super(NULL, super, "sparc2.2", devlist->devname, 0, 0, NULL);
-+ /* Ok, its good enough to try, though the checksum could be wrong */
-+ if (brief) {
-+ struct array *ap;
-+ char *d;
-+ for (ap=arrays; ap; ap=ap->next) {
-+ if (st->ss == ap->st->ss && st->ss->compare_super(&ap->super, super)==0)
-+ break;
-+ }
-+ if (!ap) {
-+ ap = malloc(sizeof(*ap));
-+ ap->super = super;
-+ ap->devs = dl_head();
-+ ap->next = arrays;
-+ ap->spares = 0;
-+ ap->st = st;
-+ arrays = ap;
-+ st->ss->getinfo_super(&ap->info, super);
-+ } else {
-+ st->ss->getinfo_super(&ap->info, super);
-+ free(super);
-+ }
-+ if (!(ap->info.disk.state & MD_DISK_SYNC))
-+ ap->spares++;
-+ d = dl_strdup(devlist->devname);
-+ dl_add(ap->devs, d);
-+ }
-+ }
-+ if (brief) {
-+ struct array *ap;
-+ for (ap=arrays; ap; ap=ap->next) {
-+ char sep='=';
-+ char *d;
-+ ap->st->ss->brief_examine_super(ap->super);
-+ if (ap->spares) printf(" spares=%d", ap->spares);
-+ if (brief > 1) {
-+ printf(" devices");
-+ for (d=dl_next(ap->devs); d!= ap->devs; d=dl_next(d)) {
-+ printf("%c%s", sep, d);
-+ sep=',';
-+ }
-+ }
-+ free(ap->super);
-+ /* FIXME free ap */
-+ if (ap->spares || brief > 1)
-+ printf("\n");
-+ }
-+ }
-+ return rv;
-+}
-+
-+int mdexamine_main(int argc, char **argv) {
-+ return Examine(conf_get_devs(), 1, 0, 0, NULL, NULL);
-+}
-+
-diff -Nuar --exclude '*.orig' busybox-1.7.4+gentoo/mdadm/md_p.h busybox-1.7.4+gentoo+mdadm/mdadm/md_p.h
---- busybox-1.7.4+gentoo/mdadm/md_p.h 1969-12-31 16:00:00.000000000 -0800
-+++ busybox-1.7.4+gentoo+mdadm/mdadm/md_p.h 2008-03-11 10:31:00.000000000 -0700
-@@ -0,0 +1,194 @@
-+/*
-+ md_p.h : physical layout of Linux RAID devices
-+ Copyright (C) 1996-98 Ingo Molnar, Gadi Oxman
-+
-+ 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, or (at your option)
-+ any later version.
-+
-+ You should have received a copy of the GNU General Public License
-+ (for example /usr/src/linux/COPYING); if not, write to the Free
-+ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-+*/
-+
-+#ifndef _MD_P_H
-+#define _MD_P_H
-+
-+/*
-+ * RAID superblock.
-+ *
-+ * The RAID superblock maintains some statistics on each RAID configuration.
-+ * Each real device in the RAID set contains it near the end of the device.
-+ * Some of the ideas are copied from the ext2fs implementation.
-+ *
-+ * We currently use 4096 bytes as follows:
-+ *
-+ * word offset function
-+ *
-+ * 0 - 31 Constant generic RAID device information.
-+ * 32 - 63 Generic state information.
-+ * 64 - 127 Personality specific information.
-+ * 128 - 511 12 32-words descriptors of the disks in the raid set.
-+ * 512 - 911 Reserved.
-+ * 912 - 1023 Disk specific descriptor.
-+ */
-+
-+/*
-+ * If x is the real device size in bytes, we return an apparent size of:
-+ *
-+ * y = (x & ~(MD_RESERVED_BYTES - 1)) - MD_RESERVED_BYTES
-+ *
-+ * and place the 4kB superblock at offset y.
-+ */
-+#define MD_RESERVED_BYTES (64 * 1024)
-+#define MD_RESERVED_SECTORS (MD_RESERVED_BYTES / 512)
-+#define MD_RESERVED_BLOCKS (MD_RESERVED_BYTES / BLOCK_SIZE)
-+
-+#define MD_NEW_SIZE_SECTORS(x) ((x & ~(MD_RESERVED_SECTORS - 1)) - MD_RESERVED_SECTORS)
-+#define MD_NEW_SIZE_BLOCKS(x) ((x & ~(MD_RESERVED_BLOCKS - 1)) - MD_RESERVED_BLOCKS)
-+
-+#define MD_SB_BYTES 4096
-+#define MD_SB_WORDS (MD_SB_BYTES / 4)
-+#define MD_SB_BLOCKS (MD_SB_BYTES / BLOCK_SIZE)
-+#define MD_SB_SECTORS (MD_SB_BYTES / 512)
-+
-+/*
-+ * The following are counted in 32-bit words
-+ */
-+#define MD_SB_GENERIC_OFFSET 0
-+#define MD_SB_PERSONALITY_OFFSET 64
-+#define MD_SB_DISKS_OFFSET 128
-+#define MD_SB_DESCRIPTOR_OFFSET 992
-+
-+#define MD_SB_GENERIC_CONSTANT_WORDS 32
-+#define MD_SB_GENERIC_STATE_WORDS 32
-+#define MD_SB_GENERIC_WORDS (MD_SB_GENERIC_CONSTANT_WORDS + MD_SB_GENERIC_STATE_WORDS)
-+#define MD_SB_PERSONALITY_WORDS 64
-+#define MD_SB_DESCRIPTOR_WORDS 32
-+#define MD_SB_DISKS 27
-+#define MD_SB_DISKS_WORDS (MD_SB_DISKS*MD_SB_DESCRIPTOR_WORDS)
-+#define MD_SB_RESERVED_WORDS (1024 - MD_SB_GENERIC_WORDS - MD_SB_PERSONALITY_WORDS - MD_SB_DISKS_WORDS - MD_SB_DESCRIPTOR_WORDS)
-+#define MD_SB_EQUAL_WORDS (MD_SB_GENERIC_WORDS + MD_SB_PERSONALITY_WORDS + MD_SB_DISKS_WORDS)
-+
-+/*
-+ * Device "operational" state bits
-+ */
-+#define MD_DISK_FAULTY 0 /* disk is faulty / operational */
-+#define MD_DISK_ACTIVE 1 /* disk is running or spare disk */
-+#define MD_DISK_SYNC 2 /* disk is in sync with the raid set */
-+#define MD_DISK_REMOVED 3 /* disk is in sync with the raid set */
-+
-+#define MD_DISK_WRITEMOSTLY 9 /* disk is "write-mostly" is RAID1 config.
-+ * read requests will only be sent here in
-+ * dire need
-+ */
-+
-+typedef struct mdp_device_descriptor_s {
-+ __u32 number; /* 0 Device number in the entire set */
-+ __u32 major; /* 1 Device major number */
-+ __u32 minor; /* 2 Device minor number */
-+ __u32 raid_disk; /* 3 The role of the device in the raid set */
-+ __u32 state; /* 4 Operational state */
-+ __u32 reserved[MD_SB_DESCRIPTOR_WORDS - 5];
-+} mdp_disk_t;
-+
-+#define MD_SB_MAGIC 0xa92b4efc
-+
-+/*
-+ * Superblock state bits
-+ */
-+#define MD_SB_CLEAN 0
-+#define MD_SB_ERRORS 1
-+
-+#define MD_SB_BITMAP_PRESENT 8 /* bitmap may be present nearby */
-+
-+typedef struct mdp_superblock_s {
-+ /*
-+ * Constant generic information
-+ */
-+ __u32 md_magic; /* 0 MD identifier */
-+ __u32 major_version; /* 1 major version to which the set conforms */
-+ __u32 minor_version; /* 2 minor version ... */
-+ __u32 patch_version; /* 3 patchlevel version ... */
-+ __u32 gvalid_words; /* 4 Number of used words in this section */
-+ __u32 set_uuid0; /* 5 Raid set identifier */
-+ __u32 ctime; /* 6 Creation time */
-+ __u32 level; /* 7 Raid personality */
-+ __u32 size; /* 8 Apparent size of each individual disk */
-+ __u32 nr_disks; /* 9 total disks in the raid set */
-+ __u32 raid_disks; /* 10 disks in a fully functional raid set */
-+ __u32 md_minor; /* 11 preferred MD minor device number */
-+ __u32 not_persistent; /* 12 does it have a persistent superblock */
-+ __u32 set_uuid1; /* 13 Raid set identifier #2 */
-+ __u32 set_uuid2; /* 14 Raid set identifier #3 */
-+ __u32 set_uuid3; /* 15 Raid set identifier #4 */
-+ __u32 gstate_creserved[MD_SB_GENERIC_CONSTANT_WORDS - 16];
-+
-+ /*
-+ * Generic state information
-+ */
-+ __u32 utime; /* 0 Superblock update time */
-+ __u32 state; /* 1 State bits (clean, ...) */
-+ __u32 active_disks; /* 2 Number of currently active disks */
-+ __u32 working_disks; /* 3 Number of working disks */
-+ __u32 failed_disks; /* 4 Number of failed disks */
-+ __u32 spare_disks; /* 5 Number of spare disks */
-+ __u32 sb_csum; /* 6 checksum of the whole superblock */
-+#if __BYTE_ORDER == __BIG_ENDIAN
-+ __u32 events_hi; /* 7 high-order of superblock update count */
-+ __u32 events_lo; /* 8 low-order of superblock update count */
-+ __u32 cp_events_hi; /* 9 high-order of checkpoint update count */
-+ __u32 cp_events_lo; /* 10 low-order of checkpoint update count */
-+#else
-+ __u32 events_lo; /* 7 low-order of superblock update count */
-+ __u32 events_hi; /* 8 high-order of superblock update count */
-+ __u32 cp_events_lo; /* 9 low-order of checkpoint update count */
-+ __u32 cp_events_hi; /* 10 high-order of checkpoint update count */
-+#endif
-+ __u32 recovery_cp; /* 11 recovery checkpoint sector count */
-+ /* There are only valid for minor_version > 90 */
-+ __u64 reshape_position; /* 12,13 next address in array-space for reshape */
-+ __u32 new_level; /* 14 new level we are reshaping to */
-+ __u32 delta_disks; /* 15 change in number of raid_disks */
-+ __u32 new_layout; /* 16 new layout */
-+ __u32 new_chunk; /* 17 new chunk size (bytes) */
-+ __u32 gstate_sreserved[MD_SB_GENERIC_STATE_WORDS - 18];
-+
-+ /*
-+ * Personality information
-+ */
-+ __u32 layout; /* 0 the array's physical layout */
-+ __u32 chunk_size; /* 1 chunk size in bytes */
-+ __u32 root_pv; /* 2 LV root PV */
-+ __u32 root_block; /* 3 LV root block */
-+ __u32 pstate_reserved[MD_SB_PERSONALITY_WORDS - 4];
-+
-+ /*
-+ * Disks information
-+ */
-+ mdp_disk_t disks[MD_SB_DISKS];
-+
-+ /*
-+ * Reserved
-+ */
-+ __u32 reserved[MD_SB_RESERVED_WORDS];
-+
-+ /*
-+ * Active descriptor
-+ */
-+ mdp_disk_t this_disk;
-+
-+} mdp_super_t;
-+
-+#ifdef __TINYC__
-+typedef unsigned long long __u64;
-+#endif
-+
-+static inline __u64 md_event(mdp_super_t *sb) {
-+ __u64 ev = sb->events_hi;
-+ return (ev<<32)| sb->events_lo;
-+}
-+
-+#endif
-+
-diff -Nuar --exclude '*.orig' busybox-1.7.4+gentoo/mdadm/md_u.h busybox-1.7.4+gentoo+mdadm/mdadm/md_u.h
---- busybox-1.7.4+gentoo/mdadm/md_u.h 1969-12-31 16:00:00.000000000 -0800
-+++ busybox-1.7.4+gentoo+mdadm/mdadm/md_u.h 2008-03-11 10:31:00.000000000 -0700
-@@ -0,0 +1,123 @@
-+/*
-+ md_u.h : user <=> kernel API between Linux raidtools and RAID drivers
-+ Copyright (C) 1998 Ingo Molnar
-+
-+ 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, or (at your option)
-+ any later version.
-+
-+ You should have received a copy of the GNU General Public License
-+ (for example /usr/src/linux/COPYING); if not, write to the Free
-+ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-+*/
-+
-+#ifndef _MD_U_H
-+#define _MD_U_H
-+
-+/* ioctls */
-+
-+/* status */
-+#define RAID_VERSION _IOR (MD_MAJOR, 0x10, mdu_version_t)
-+#define GET_ARRAY_INFO _IOR (MD_MAJOR, 0x11, mdu_array_info_t)
-+#define GET_DISK_INFO _IOR (MD_MAJOR, 0x12, mdu_disk_info_t)
-+#define PRINT_RAID_DEBUG _IO (MD_MAJOR, 0x13)
-+#define RAID_AUTORUN _IO (MD_MAJOR, 0x14)
-+#define GET_BITMAP_FILE _IOR (MD_MAJOR, 0x15, mdu_bitmap_file_t)
-+
-+/* configuration */
-+#define CLEAR_ARRAY _IO (MD_MAJOR, 0x20)
-+#define ADD_NEW_DISK _IOW (MD_MAJOR, 0x21, mdu_disk_info_t)
-+#define HOT_REMOVE_DISK _IO (MD_MAJOR, 0x22)
-+#define SET_ARRAY_INFO _IOW (MD_MAJOR, 0x23, mdu_array_info_t)
-+#define SET_DISK_INFO _IO (MD_MAJOR, 0x24)
-+#define WRITE_RAID_INFO _IO (MD_MAJOR, 0x25)
-+#define UNPROTECT_ARRAY _IO (MD_MAJOR, 0x26)
-+#define PROTECT_ARRAY _IO (MD_MAJOR, 0x27)
-+#define HOT_ADD_DISK _IO (MD_MAJOR, 0x28)
-+#define SET_DISK_FAULTY _IO (MD_MAJOR, 0x29)
-+#define SET_BITMAP_FILE _IOW (MD_MAJOR, 0x2b, int)
-+
-+/* usage */
-+#define RUN_ARRAY _IOW (MD_MAJOR, 0x30, mdu_param_t)
-+#define START_ARRAY _IO (MD_MAJOR, 0x31)
-+#define STOP_ARRAY _IO (MD_MAJOR, 0x32)
-+#define STOP_ARRAY_RO _IO (MD_MAJOR, 0x33)
-+#define RESTART_ARRAY_RW _IO (MD_MAJOR, 0x34)
-+
-+typedef struct mdu_version_s {
-+ int major;
-+ int minor;
-+ int patchlevel;
-+} mdu_version_t;
-+
-+typedef struct mdu_array_info_s {
-+ /*
-+ * Generic constant information
-+ */
-+ int major_version;
-+ int minor_version;
-+ int patch_version;
-+ int ctime;
-+ int level;
-+ int size;
-+ int nr_disks;
-+ int raid_disks;
-+ int md_minor;
-+ int not_persistent;
-+
-+ /*
-+ * Generic state information
-+ */
-+ int utime; /* 0 Superblock update time */
-+ int state; /* 1 State bits (clean, ...) */
-+ int active_disks; /* 2 Number of currently active disks */
-+ int working_disks; /* 3 Number of working disks */
-+ int failed_disks; /* 4 Number of failed disks */
-+ int spare_disks; /* 5 Number of spare disks */
-+
-+ /*
-+ * Personality information
-+ */
-+ int layout; /* 0 the array's physical layout */
-+ int chunk_size; /* 1 chunk size in bytes */
-+
-+} mdu_array_info_t;
-+
-+typedef struct mdu_disk_info_s {
-+ /*
-+ * configuration/status of one particular disk
-+ */
-+ int number;
-+ int major;
-+ int minor;
-+ int raid_disk;
-+ int state;
-+
-+} mdu_disk_info_t;
-+
-+typedef struct mdu_start_info_s {
-+ /*
-+ * configuration/status of one particular disk
-+ */
-+ int major;
-+ int minor;
-+ int raid_disk;
-+ int state;
-+
-+} mdu_start_info_t;
-+
-+typedef struct mdu_bitmap_file_s
-+{
-+ char pathname[4096];
-+} mdu_bitmap_file_t;
-+
-+typedef struct mdu_param_s
-+{
-+ int personality; /* 1,2,3,4 */
-+ int chunk_size; /* in bytes */
-+ int max_fault; /* unused for now */
-+} mdu_param_t;
-+
-+#endif
-+
-diff -Nuar --exclude '*.orig' busybox-1.7.4+gentoo/mdadm/sha1.c busybox-1.7.4+gentoo+mdadm/mdadm/sha1.c
---- busybox-1.7.4+gentoo/mdadm/sha1.c 1969-12-31 16:00:00.000000000 -0800
-+++ busybox-1.7.4+gentoo+mdadm/mdadm/sha1.c 2008-03-11 10:31:00.000000000 -0700
-@@ -0,0 +1,423 @@
-+/* sha1.c - Functions to compute SHA1 message digest of files or
-+ memory blocks according to the NIST specification FIPS-180-1.
-+
-+ Copyright (C) 2000, 2001, 2003, 2004, 2005 Free Software Foundation, Inc.
-+
-+ This program is free software; you can redistribute it and/or modify it
-+ under the terms of the GNU General Public License as published by the
-+ Free Software Foundation; either version 2, 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. */
-+
-+/* Written by Scott G. Miller
-+ Credits:
-+ Robert Klep <robert@ilse.nl> -- Expansion function fix
-+*/
-+
-+#ifdef HAVE_CONFIG_H
-+# include <config.h>
-+#endif
-+
-+#include "sha1.h"
-+
-+#include <stddef.h>
-+#include <string.h>
-+
-+#if USE_UNLOCKED_IO
-+# include "unlocked-io.h"
-+#endif
-+
-+/* SWAP does an endian swap on architectures that are little-endian,
-+ as SHA1 needs some data in a big-endian form. */
-+
-+#ifdef WORDS_BIGENDIAN
-+# define SWAP(n) (n)
-+#else
-+# define SWAP(n) \
-+ (((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24))
-+#endif
-+
-+#define BLOCKSIZE 4096
-+#if BLOCKSIZE % 64 != 0
-+# error "invalid BLOCKSIZE"
-+#endif
-+
-+/* This array contains the bytes used to pad the buffer to the next
-+ 64-byte boundary. (RFC 1321, 3.1: Step 1) */
-+static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ };
-+
-+
-+/*
-+ Takes a pointer to a 160 bit block of data (five 32 bit ints) and
-+ intializes it to the start constants of the SHA1 algorithm. This
-+ must be called before using hash in the call to sha1_hash.
-+*/
-+void
-+sha1_init_ctx (struct sha1_ctx *ctx)
-+{
-+ ctx->A = 0x67452301;
-+ ctx->B = 0xefcdab89;
-+ ctx->C = 0x98badcfe;
-+ ctx->D = 0x10325476;
-+ ctx->E = 0xc3d2e1f0;
-+
-+ ctx->total[0] = ctx->total[1] = 0;
-+ ctx->buflen = 0;
-+}
-+
-+/* Put result from CTX in first 20 bytes following RESBUF. The result
-+ must be in little endian byte order.
-+
-+ IMPORTANT: On some systems it is required that RESBUF is correctly
-+ aligned for a 32 bits value. */
-+void *
-+sha1_read_ctx (const struct sha1_ctx *ctx, void *resbuf)
-+{
-+ ((md5_uint32 *) resbuf)[0] = SWAP (ctx->A);
-+ ((md5_uint32 *) resbuf)[1] = SWAP (ctx->B);
-+ ((md5_uint32 *) resbuf)[2] = SWAP (ctx->C);
-+ ((md5_uint32 *) resbuf)[3] = SWAP (ctx->D);
-+ ((md5_uint32 *) resbuf)[4] = SWAP (ctx->E);
-+
-+ return resbuf;
-+}
-+
-+/* Process the remaining bytes in the internal buffer and the usual
-+ prolog according to the standard and write the result to RESBUF.
-+
-+ IMPORTANT: On some systems it is required that RESBUF is correctly
-+ aligned for a 32 bits value. */
-+void *
-+sha1_finish_ctx (struct sha1_ctx *ctx, void *resbuf)
-+{
-+ /* Take yet unprocessed bytes into account. */
-+ md5_uint32 bytes = ctx->buflen;
-+ size_t pad;
-+
-+ /* Now count remaining bytes. */
-+ ctx->total[0] += bytes;
-+ if (ctx->total[0] < bytes)
-+ ++ctx->total[1];
-+
-+ pad = bytes >= 56 ? 64 + 56 - bytes : 56 - bytes;
-+ memcpy (&ctx->buffer[bytes], fillbuf, pad);
-+
-+ /* Put the 64-bit file length in *bits* at the end of the buffer. */
-+ *(md5_uint32 *) &ctx->buffer[bytes + pad + 4] = SWAP (ctx->total[0] << 3);
-+ *(md5_uint32 *) &ctx->buffer[bytes + pad] = SWAP ((ctx->total[1] << 3) |
-+ (ctx->total[0] >> 29));
-+
-+ /* Process last bytes. */
-+ sha1_process_block (ctx->buffer, bytes + pad + 8, ctx);
-+
-+ return sha1_read_ctx (ctx, resbuf);
-+}
-+
-+/* Compute SHA1 message digest for bytes read from STREAM. The
-+ resulting message digest number will be written into the 16 bytes
-+ beginning at RESBLOCK. */
-+int
-+sha1_stream (FILE *stream, void *resblock)
-+{
-+ struct sha1_ctx ctx;
-+ char buffer[BLOCKSIZE + 72];
-+ size_t sum;
-+
-+ /* Initialize the computation context. */
-+ sha1_init_ctx (&ctx);
-+
-+ /* Iterate over full file contents. */
-+ while (1)
-+ {
-+ /* We read the file in blocks of BLOCKSIZE bytes. One call of the
-+ computation function processes the whole buffer so that with the
-+ next round of the loop another block can be read. */
-+ size_t n;
-+ sum = 0;
-+
-+ /* Read block. Take care for partial reads. */
-+ while (1)
-+ {
-+ n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
-+
-+ sum += n;
-+
-+ if (sum == BLOCKSIZE)
-+ break;
-+
-+ if (n == 0)
-+ {
-+ /* Check for the error flag IFF N == 0, so that we don't
-+ exit the loop after a partial read due to e.g., EAGAIN
-+ or EWOULDBLOCK. */
-+ if (ferror (stream))
-+ return 1;
-+ goto process_partial_block;
-+ }
-+
-+ /* We've read at least one byte, so ignore errors. But always
-+ check for EOF, since feof may be true even though N > 0.
-+ Otherwise, we could end up calling fread after EOF. */
-+ if (feof (stream))
-+ goto process_partial_block;
-+ }
-+
-+ /* Process buffer with BLOCKSIZE bytes. Note that
-+ BLOCKSIZE % 64 == 0
-+ */
-+ sha1_process_block (buffer, BLOCKSIZE, &ctx);
-+ }
-+
-+ process_partial_block:;
-+
-+ /* Process any remaining bytes. */
-+ if (sum > 0)
-+ sha1_process_bytes (buffer, sum, &ctx);
-+
-+ /* Construct result in desired memory. */
-+ sha1_finish_ctx (&ctx, resblock);
-+ return 0;
-+}
-+
-+/* Compute MD5 message digest for LEN bytes beginning at BUFFER. The
-+ result is always in little endian byte order, so that a byte-wise
-+ output yields to the wanted ASCII representation of the message
-+ digest. */
-+void *
-+sha1_buffer (const char *buffer, size_t len, void *resblock)
-+{
-+ struct sha1_ctx ctx;
-+
-+ /* Initialize the computation context. */
-+ sha1_init_ctx (&ctx);
-+
-+ /* Process whole buffer but last len % 64 bytes. */
-+ sha1_process_bytes (buffer, len, &ctx);
-+
-+ /* Put result in desired memory area. */
-+ return sha1_finish_ctx (&ctx, resblock);
-+}
-+
-+void
-+sha1_process_bytes (const void *buffer, size_t len, struct sha1_ctx *ctx)
-+{
-+ /* When we already have some bits in our internal buffer concatenate
-+ both inputs first. */
-+ if (ctx->buflen != 0)
-+ {
-+ size_t left_over = ctx->buflen;
-+ size_t add = 128 - left_over > len ? len : 128 - left_over;
-+
-+ memcpy (&ctx->buffer[left_over], buffer, add);
-+ ctx->buflen += add;
-+
-+ if (ctx->buflen > 64)
-+ {
-+ sha1_process_block (ctx->buffer, ctx->buflen & ~63, ctx);
-+
-+ ctx->buflen &= 63;
-+ /* The regions in the following copy operation cannot overlap. */
-+ memcpy (ctx->buffer, &ctx->buffer[(left_over + add) & ~63],
-+ ctx->buflen);
-+ }
-+
-+ buffer = (const char *) buffer + add;
-+ len -= add;
-+ }
-+
-+ /* Process available complete blocks. */
-+ if (len >= 64)
-+ {
-+#if !_STRING_ARCH_unaligned
-+# define alignof(type) offsetof (struct { char c; type x; }, x)
-+# define UNALIGNED_P(p) (((size_t) p) % alignof (md5_uint32) != 0)
-+ if (UNALIGNED_P (buffer))
-+ while (len > 64)
-+ {
-+ sha1_process_block (memcpy (ctx->buffer, buffer, 64), 64, ctx);
-+ buffer = (const char *) buffer + 64;
-+ len -= 64;
-+ }
-+ else
-+#endif
-+ {
-+ sha1_process_block (buffer, len & ~63, ctx);
-+ buffer = (const char *) buffer + (len & ~63);
-+ len &= 63;
-+ }
-+ }
-+
-+ /* Move remaining bytes in internal buffer. */
-+ if (len > 0)
-+ {
-+ size_t left_over = ctx->buflen;
-+
-+ memcpy (&ctx->buffer[left_over], buffer, len);
-+ left_over += len;
-+ if (left_over >= 64)
-+ {
-+ sha1_process_block (ctx->buffer, 64, ctx);
-+ left_over -= 64;
-+ memcpy (ctx->buffer, &ctx->buffer[64], left_over);
-+ }
-+ ctx->buflen = left_over;
-+ }
-+}
-+
-+/* --- Code below is the primary difference between md5.c and sha1.c --- */
-+
-+/* SHA1 round constants */
-+#define K1 0x5a827999L
-+#define K2 0x6ed9eba1L
-+#define K3 0x8f1bbcdcL
-+#define K4 0xca62c1d6L
-+
-+/* Round functions. Note that F2 is the same as F4. */
-+#define F1(B,C,D) ( D ^ ( B & ( C ^ D ) ) )
-+#define F2(B,C,D) (B ^ C ^ D)
-+#define F3(B,C,D) ( ( B & C ) | ( D & ( B | C ) ) )
-+#define F4(B,C,D) (B ^ C ^ D)
-+
-+/* Process LEN bytes of BUFFER, accumulating context into CTX.
-+ It is assumed that LEN % 64 == 0.
-+ Most of this code comes from GnuPG's cipher/sha1.c. */
-+
-+void
-+sha1_process_block (const void *buffer, size_t len, struct sha1_ctx *ctx)
-+{
-+ const md5_uint32 *words = buffer;
-+ size_t nwords = len / sizeof (md5_uint32);
-+ const md5_uint32 *endp = words + nwords;
-+ md5_uint32 x[16];
-+ md5_uint32 a = ctx->A;
-+ md5_uint32 b = ctx->B;
-+ md5_uint32 c = ctx->C;
-+ md5_uint32 d = ctx->D;
-+ md5_uint32 e = ctx->E;
-+
-+ /* First increment the byte count. RFC 1321 specifies the possible
-+ length of the file up to 2^64 bits. Here we only compute the
-+ number of bytes. Do a double word increment. */
-+ ctx->total[0] += len;
-+ if (ctx->total[0] < len)
-+ ++ctx->total[1];
-+
-+#define rol(x, n) (((x) << (n)) | ((x) >> (32 - (n))))
-+
-+#define M(I) ( tm = x[I&0x0f] ^ x[(I-14)&0x0f] \
-+ ^ x[(I-8)&0x0f] ^ x[(I-3)&0x0f] \
-+ , (x[I&0x0f] = rol(tm, 1)) )
-+
-+#define R(A,B,C,D,E,F,K,M) do { E += rol( A, 5 ) \
-+ + F( B, C, D ) \
-+ + K \
-+ + M; \
-+ B = rol( B, 30 ); \
-+ } while(0)
-+
-+ while (words < endp)
-+ {
-+ md5_uint32 tm;
-+ int t;
-+ for (t = 0; t < 16; t++)
-+ {
-+ x[t] = SWAP (*words);
-+ words++;
-+ }
-+
-+ R( a, b, c, d, e, F1, K1, x[ 0] );
-+ R( e, a, b, c, d, F1, K1, x[ 1] );
-+ R( d, e, a, b, c, F1, K1, x[ 2] );
-+ R( c, d, e, a, b, F1, K1, x[ 3] );
-+ R( b, c, d, e, a, F1, K1, x[ 4] );
-+ R( a, b, c, d, e, F1, K1, x[ 5] );
-+ R( e, a, b, c, d, F1, K1, x[ 6] );
-+ R( d, e, a, b, c, F1, K1, x[ 7] );
-+ R( c, d, e, a, b, F1, K1, x[ 8] );
-+ R( b, c, d, e, a, F1, K1, x[ 9] );
-+ R( a, b, c, d, e, F1, K1, x[10] );
-+ R( e, a, b, c, d, F1, K1, x[11] );
-+ R( d, e, a, b, c, F1, K1, x[12] );
-+ R( c, d, e, a, b, F1, K1, x[13] );
-+ R( b, c, d, e, a, F1, K1, x[14] );
-+ R( a, b, c, d, e, F1, K1, x[15] );
-+ R( e, a, b, c, d, F1, K1, M(16) );
-+ R( d, e, a, b, c, F1, K1, M(17) );
-+ R( c, d, e, a, b, F1, K1, M(18) );
-+ R( b, c, d, e, a, F1, K1, M(19) );
-+ R( a, b, c, d, e, F2, K2, M(20) );
-+ R( e, a, b, c, d, F2, K2, M(21) );
-+ R( d, e, a, b, c, F2, K2, M(22) );
-+ R( c, d, e, a, b, F2, K2, M(23) );
-+ R( b, c, d, e, a, F2, K2, M(24) );
-+ R( a, b, c, d, e, F2, K2, M(25) );
-+ R( e, a, b, c, d, F2, K2, M(26) );
-+ R( d, e, a, b, c, F2, K2, M(27) );
-+ R( c, d, e, a, b, F2, K2, M(28) );
-+ R( b, c, d, e, a, F2, K2, M(29) );
-+ R( a, b, c, d, e, F2, K2, M(30) );
-+ R( e, a, b, c, d, F2, K2, M(31) );
-+ R( d, e, a, b, c, F2, K2, M(32) );
-+ R( c, d, e, a, b, F2, K2, M(33) );
-+ R( b, c, d, e, a, F2, K2, M(34) );
-+ R( a, b, c, d, e, F2, K2, M(35) );
-+ R( e, a, b, c, d, F2, K2, M(36) );
-+ R( d, e, a, b, c, F2, K2, M(37) );
-+ R( c, d, e, a, b, F2, K2, M(38) );
-+ R( b, c, d, e, a, F2, K2, M(39) );
-+ R( a, b, c, d, e, F3, K3, M(40) );
-+ R( e, a, b, c, d, F3, K3, M(41) );
-+ R( d, e, a, b, c, F3, K3, M(42) );
-+ R( c, d, e, a, b, F3, K3, M(43) );
-+ R( b, c, d, e, a, F3, K3, M(44) );
-+ R( a, b, c, d, e, F3, K3, M(45) );
-+ R( e, a, b, c, d, F3, K3, M(46) );
-+ R( d, e, a, b, c, F3, K3, M(47) );
-+ R( c, d, e, a, b, F3, K3, M(48) );
-+ R( b, c, d, e, a, F3, K3, M(49) );
-+ R( a, b, c, d, e, F3, K3, M(50) );
-+ R( e, a, b, c, d, F3, K3, M(51) );
-+ R( d, e, a, b, c, F3, K3, M(52) );
-+ R( c, d, e, a, b, F3, K3, M(53) );
-+ R( b, c, d, e, a, F3, K3, M(54) );
-+ R( a, b, c, d, e, F3, K3, M(55) );
-+ R( e, a, b, c, d, F3, K3, M(56) );
-+ R( d, e, a, b, c, F3, K3, M(57) );
-+ R( c, d, e, a, b, F3, K3, M(58) );
-+ R( b, c, d, e, a, F3, K3, M(59) );
-+ R( a, b, c, d, e, F4, K4, M(60) );
-+ R( e, a, b, c, d, F4, K4, M(61) );
-+ R( d, e, a, b, c, F4, K4, M(62) );
-+ R( c, d, e, a, b, F4, K4, M(63) );
-+ R( b, c, d, e, a, F4, K4, M(64) );
-+ R( a, b, c, d, e, F4, K4, M(65) );
-+ R( e, a, b, c, d, F4, K4, M(66) );
-+ R( d, e, a, b, c, F4, K4, M(67) );
-+ R( c, d, e, a, b, F4, K4, M(68) );
-+ R( b, c, d, e, a, F4, K4, M(69) );
-+ R( a, b, c, d, e, F4, K4, M(70) );
-+ R( e, a, b, c, d, F4, K4, M(71) );
-+ R( d, e, a, b, c, F4, K4, M(72) );
-+ R( c, d, e, a, b, F4, K4, M(73) );
-+ R( b, c, d, e, a, F4, K4, M(74) );
-+ R( a, b, c, d, e, F4, K4, M(75) );
-+ R( e, a, b, c, d, F4, K4, M(76) );
-+ R( d, e, a, b, c, F4, K4, M(77) );
-+ R( c, d, e, a, b, F4, K4, M(78) );
-+ R( b, c, d, e, a, F4, K4, M(79) );
-+
-+ a = ctx->A += a;
-+ b = ctx->B += b;
-+ c = ctx->C += c;
-+ d = ctx->D += d;
-+ e = ctx->E += e;
-+ }
-+}
-diff -Nuar --exclude '*.orig' busybox-1.7.4+gentoo/mdadm/sha1.h busybox-1.7.4+gentoo+mdadm/mdadm/sha1.h
---- busybox-1.7.4+gentoo/mdadm/sha1.h 1969-12-31 16:00:00.000000000 -0800
-+++ busybox-1.7.4+gentoo+mdadm/mdadm/sha1.h 2008-03-11 10:31:00.000000000 -0700
-@@ -0,0 +1,87 @@
-+/* Declarations of functions and data types used for SHA1 sum
-+ library functions.
-+ Copyright (C) 2000, 2001, 2003, 2005 Free Software Foundation, Inc.
-+
-+ This program is free software; you can redistribute it and/or modify it
-+ under the terms of the GNU General Public License as published by the
-+ Free Software Foundation; either version 2, 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. */
-+
-+#ifndef SHA1_H
-+# define SHA1_H 1
-+
-+# include <stdio.h>
-+# include "md5.h"
-+
-+/* Structure to save state of computation between the single steps. */
-+struct sha1_ctx
-+{
-+ md5_uint32 A;
-+ md5_uint32 B;
-+ md5_uint32 C;
-+ md5_uint32 D;
-+ md5_uint32 E;
-+
-+ md5_uint32 total[2];
-+ md5_uint32 buflen;
-+ char buffer[128] __attribute__ ((__aligned__ (__alignof__ (md5_uint32))));
-+};
-+
-+
-+/* Initialize structure containing state of computation. */
-+extern void sha1_init_ctx (struct sha1_ctx *ctx);
-+
-+/* Starting with the result of former calls of this function (or the
-+ initialization function update the context for the next LEN bytes
-+ starting at BUFFER.
-+ It is necessary that LEN is a multiple of 64!!! */
-+extern void sha1_process_block (const void *buffer, size_t len,
-+ struct sha1_ctx *ctx);
-+
-+/* Starting with the result of former calls of this function (or the
-+ initialization function update the context for the next LEN bytes
-+ starting at BUFFER.
-+ It is NOT required that LEN is a multiple of 64. */
-+extern void sha1_process_bytes (const void *buffer, size_t len,
-+ struct sha1_ctx *ctx);
-+
-+/* Process the remaining bytes in the buffer and put result from CTX
-+ in first 20 bytes following RESBUF. The result is always in little
-+ endian byte order, so that a byte-wise output yields to the wanted
-+ ASCII representation of the message digest.
-+
-+ IMPORTANT: On some systems it is required that RESBUF be correctly
-+ aligned for a 32 bits value. */
-+extern void *sha1_finish_ctx (struct sha1_ctx *ctx, void *resbuf);
-+
-+
-+/* Put result from CTX in first 20 bytes following RESBUF. The result is
-+ always in little endian byte order, so that a byte-wise output yields
-+ to the wanted ASCII representation of the message digest.
-+
-+ IMPORTANT: On some systems it is required that RESBUF is correctly
-+ aligned for a 32 bits value. */
-+extern void *sha1_read_ctx (const struct sha1_ctx *ctx, void *resbuf);
-+
-+
-+/* Compute SHA1 message digest for bytes read from STREAM. The
-+ resulting message digest number will be written into the 20 bytes
-+ beginning at RESBLOCK. */
-+extern int sha1_stream (FILE *stream, void *resblock);
-+
-+/* Compute SHA1 message digest for LEN bytes beginning at BUFFER. The
-+ result is always in little endian byte order, so that a byte-wise
-+ output yields to the wanted ASCII representation of the message
-+ digest. */
-+extern void *sha1_buffer (const char *buffer, size_t len, void *resblock);
-+
-+#endif
-diff -Nuar --exclude '*.orig' busybox-1.7.4+gentoo/mdadm/super0.c busybox-1.7.4+gentoo+mdadm/mdadm/super0.c
---- busybox-1.7.4+gentoo/mdadm/super0.c 1969-12-31 16:00:00.000000000 -0800
-+++ busybox-1.7.4+gentoo+mdadm/mdadm/super0.c 2008-03-11 10:31:00.000000000 -0700
-@@ -0,0 +1,562 @@
-+/*
-+ * mdadm - manage Linux "md" devices aka RAID arrays.
-+ *
-+ * Copyright (C) 2001-2006 Neil Brown <neilb@suse.de>
-+ *
-+ *
-+ * 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
-+ *
-+ * Author: Neil Brown
-+ * Email: <neilb@cse.unsw.edu.au>
-+ * Paper: Neil Brown
-+ * School of Computer Science and Engineering
-+ * The University of New South Wales
-+ * Sydney, 2052
-+ * Australia
-+ */
-+
-+#define HAVE_STDINT_H 1
-+#include "mdadm.h"
-+/*
-+ * All handling for the 0.90.0 version superblock is in
-+ * this file.
-+ * This includes:
-+ * - finding, loading, and writing the superblock.
-+ * - initialising a new superblock
-+ * - printing the superblock for --examine
-+ * - printing part of the superblock for --detail
-+ * .. other stuff
-+ */
-+
-+
-+static unsigned long calc_sb0_csum(mdp_super_t *super)
-+{
-+ unsigned long csum = super->sb_csum;
-+ unsigned long newcsum;
-+ super->sb_csum= 0 ;
-+ newcsum = calc_csum(super, MD_SB_BYTES);
-+ super->sb_csum = csum;
-+ return newcsum;
-+}
-+
-+
-+void super0_swap_endian(struct mdp_superblock_s *sb)
-+{
-+ /* as super0 superblocks are host-endian, it is sometimes
-+ * useful to be able to swap the endianness
-+ * as (almost) everything is u32's we byte-swap every 4byte
-+ * number.
-+ * We then also have to swap the events_hi and events_lo
-+ */
-+ char *sbc = (char *)sb;
-+ __u32 t32;
-+ int i;
-+
-+ for (i=0; i < MD_SB_BYTES ; i+=4) {
-+ char t = sbc[i];
-+ sbc[i] = sbc[i+3];
-+ sbc[i+3] = t;
-+ t=sbc[i+1];
-+ sbc[i+1]=sbc[i+2];
-+ sbc[i+2]=t;
-+ }
-+ t32 = sb->events_hi;
-+ sb->events_hi = sb->events_lo;
-+ sb->events_lo = t32;
-+
-+ t32 = sb->cp_events_hi;
-+ sb->cp_events_hi = sb->cp_events_lo;
-+ sb->cp_events_lo = t32;
-+
-+}
-+
-+static void brief_examine_super0(void *sbv)
-+{
-+ mdp_super_t *sb = sbv;
-+ char *c=map_num(pers, sb->level);
-+ char devname[20];
-+
-+ sprintf(devname, "/dev/md%d", sb->md_minor);
-+
-+ printf("ARRAY %s level=%s num-devices=%d UUID=",
-+ devname,
-+ c?c:"-unknown-", sb->raid_disks);
-+ if (sb->minor_version >= 90)
-+ printf("%08x:%08x:%08x:%08x", sb->set_uuid0, sb->set_uuid1,
-+ sb->set_uuid2, sb->set_uuid3);
-+ else
-+ printf("%08x", sb->set_uuid0);
-+ printf("\n");
-+}
-+
-+static int match_home0(void *sbv, char *homehost)
-+{
-+ mdp_super_t *sb = sbv;
-+ char buf[20];
-+ char *hash = sha1_buffer(homehost,
-+ strlen(homehost),
-+ buf);
-+
-+ return (memcmp(&sb->set_uuid2, hash, 8)==0);
-+}
-+
-+static void uuid_from_super0(int uuid[4], void * sbv)
-+{
-+ mdp_super_t *super = sbv;
-+ uuid[0] = super->set_uuid0;
-+ if (super->minor_version >= 90) {
-+ uuid[1] = super->set_uuid1;
-+ uuid[2] = super->set_uuid2;
-+ uuid[3] = super->set_uuid3;
-+ } else {
-+ uuid[1] = 0;
-+ uuid[2] = 0;
-+ uuid[3] = 0;
-+ }
-+}
-+
-+static void getinfo_super0(struct mdinfo *info, void *sbv)
-+{
-+ mdp_super_t *sb = sbv;
-+ int working = 0;
-+ int i;
-+
-+ info->array.major_version = sb->major_version;
-+ info->array.minor_version = sb->minor_version;
-+ info->array.patch_version = sb->patch_version;
-+ info->array.raid_disks = sb->raid_disks;
-+ info->array.level = sb->level;
-+ info->array.layout = sb->layout;
-+ info->array.md_minor = sb->md_minor;
-+ info->array.ctime = sb->ctime;
-+ info->array.utime = sb->utime;
-+ info->array.chunk_size = sb->chunk_size;
-+ info->array.state = sb->state;
-+ info->component_size = sb->size*2;
-+
-+ info->disk.state = sb->this_disk.state;
-+ info->disk.major = sb->this_disk.major;
-+ info->disk.minor = sb->this_disk.minor;
-+ info->disk.raid_disk = sb->this_disk.raid_disk;
-+ info->disk.number = sb->this_disk.number;
-+
-+ info->events = md_event(sb);
-+ info->data_offset = 0;
-+
-+ uuid_from_super0(info->uuid, sbv);
-+
-+ if (sb->minor_version > 90 && (sb->reshape_position+1) != 0) {
-+ info->reshape_active = 1;
-+ info->reshape_progress = sb->reshape_position;
-+ info->new_level = sb->new_level;
-+ info->delta_disks = sb->delta_disks;
-+ info->new_layout = sb->new_layout;
-+ info->new_chunk = sb->new_chunk;
-+ } else
-+ info->reshape_active = 0;
-+
-+ sprintf(info->name, "%d", sb->md_minor);
-+ /* work_disks is calculated rather than read directly */
-+ for (i=0; i < MD_SB_DISKS; i++)
-+ if ((sb->disks[i].state & (1<<MD_DISK_SYNC)) &&
-+ (sb->disks[i].raid_disk < info->array.raid_disks) &&
-+ (sb->disks[i].state & (1<<MD_DISK_ACTIVE)) &&
-+ !(sb->disks[i].state & (1<<MD_DISK_FAULTY)))
-+ working ++;
-+ info->array.working_disks = working;
-+}
-+
-+
-+static int update_super0(struct mdinfo *info, void *sbv, char *update,
-+ char *devname, int verbose,
-+ int uuid_set, char *homehost)
-+{
-+ /* NOTE: for 'assemble' and 'force' we need to return non-zero if any change was made.
-+ * For others, the return value is ignored.
-+ */
-+ int rv = 0;
-+ mdp_super_t *sb = sbv;
-+ if (strcmp(update, "sparc2.2")==0 ) {
-+ /* 2.2 sparc put the events in the wrong place
-+ * So we copy the tail of the superblock
-+ * up 4 bytes before continuing
-+ */
-+ __u32 *sb32 = (__u32*)sb;
-+ memcpy(sb32+MD_SB_GENERIC_CONSTANT_WORDS+7,
-+ sb32+MD_SB_GENERIC_CONSTANT_WORDS+7+1,
-+ (MD_SB_WORDS - (MD_SB_GENERIC_CONSTANT_WORDS+7+1))*4);
-+ if (verbose >= 0)
-+ fprintf (stderr, Name ": adjusting superblock of %s for 2.2/sparc compatability.\n",
-+ devname);
-+ }
-+ if (strcmp(update, "super-minor") ==0) {
-+ sb->md_minor = info->array.md_minor;
-+ if (verbose > 0)
-+ fprintf(stderr, Name ": updating superblock of %s with minor number %d\n",
-+ devname, info->array.md_minor);
-+ }
-+ if (strcmp(update, "summaries") == 0) {
-+ int i;
-+ /* set nr_disks, active_disks, working_disks,
-+ * failed_disks, spare_disks based on disks[]
-+ * array in superblock.
-+ * Also make sure extra slots aren't 'failed'
-+ */
-+ sb->nr_disks = sb->active_disks =
-+ sb->working_disks = sb->failed_disks =
-+ sb->spare_disks = 0;
-+ for (i=0; i < MD_SB_DISKS ; i++)
-+ if (sb->disks[i].major ||
-+ sb->disks[i].minor) {
-+ int state = sb->disks[i].state;
-+ if (state & (1<<MD_DISK_REMOVED))
-+ continue;
-+ sb->nr_disks++;
-+ if (state & (1<<MD_DISK_ACTIVE))
-+ sb->active_disks++;
-+ if (state & (1<<MD_DISK_FAULTY))
-+ sb->failed_disks++;
-+ else
-+ sb->working_disks++;
-+ if (state == 0)
-+ sb->spare_disks++;
-+ } else if (i >= sb->raid_disks && sb->disks[i].number == 0)
-+ sb->disks[i].state = 0;
-+ }
-+ if (strcmp(update, "force-one")==0) {
-+ /* Not enough devices for a working array, so
-+ * bring this one up-to-date.
-+ */
-+ __u32 ehi = sb->events_hi, elo = sb->events_lo;
-+ sb->events_hi = (info->events>>32) & 0xFFFFFFFF;
-+ sb->events_lo = (info->events) & 0xFFFFFFFF;
-+ if (sb->events_hi != ehi ||
-+ sb->events_lo != elo)
-+ rv = 1;
-+ }
-+ if (strcmp(update, "force-array")==0) {
-+ /* degraded array and 'force' requested, so
-+ * maybe need to mark it 'clean'
-+ */
-+ if ((sb->level == 5 || sb->level == 4 || sb->level == 6) &&
-+ (sb->state & (1 << MD_SB_CLEAN)) == 0) {
-+ /* need to force clean */
-+ sb->state |= (1 << MD_SB_CLEAN);
-+ rv = 1;
-+ }
-+ }
-+ if (strcmp(update, "assemble")==0) {
-+ int d = info->disk.number;
-+ int wonly = sb->disks[d].state & (1<<MD_DISK_WRITEMOSTLY);
-+ if ((sb->disks[d].state & ~(1<<MD_DISK_WRITEMOSTLY))
-+ != info->disk.state) {
-+ sb->disks[d].state = info->disk.state | wonly;
-+ rv = 1;
-+ }
-+ }
-+ if (strcmp(update, "linear-grow-new") == 0) {
-+ memset(&sb->disks[info->disk.number], 0, sizeof(sb->disks[0]));
-+ sb->disks[info->disk.number].number = info->disk.number;
-+ sb->disks[info->disk.number].major = info->disk.major;
-+ sb->disks[info->disk.number].minor = info->disk.minor;
-+ sb->disks[info->disk.number].raid_disk = info->disk.raid_disk;
-+ sb->disks[info->disk.number].state = info->disk.state;
-+ sb->this_disk = sb->disks[info->disk.number];
-+ }
-+ if (strcmp(update, "linear-grow-update") == 0) {
-+ sb->raid_disks = info->array.raid_disks;
-+ sb->nr_disks = info->array.nr_disks;
-+ sb->active_disks = info->array.active_disks;
-+ sb->working_disks = info->array.working_disks;
-+ memset(&sb->disks[info->disk.number], 0, sizeof(sb->disks[0]));
-+ sb->disks[info->disk.number].number = info->disk.number;
-+ sb->disks[info->disk.number].major = info->disk.major;
-+ sb->disks[info->disk.number].minor = info->disk.minor;
-+ sb->disks[info->disk.number].raid_disk = info->disk.raid_disk;
-+ sb->disks[info->disk.number].state = info->disk.state;
-+ }
-+ if (strcmp(update, "resync") == 0) {
-+ /* make sure resync happens */
-+ sb->state &= ~(1<<MD_SB_CLEAN);
-+ sb->recovery_cp = 0;
-+ }
-+ if (strcmp(update, "homehost") == 0 &&
-+ homehost) {
-+ uuid_set = 0;
-+ update = "uuid";
-+ info->uuid[0] = sb->set_uuid0;
-+ info->uuid[1] = sb->set_uuid1;
-+ }
-+ if (strcmp(update, "uuid") == 0) {
-+ if (!uuid_set && homehost) {
-+ char buf[20];
-+ char *hash = sha1_buffer(homehost,
-+ strlen(homehost),
-+ buf);
-+ memcpy(info->uuid+2, hash, 8);
-+ }
-+ sb->set_uuid0 = info->uuid[0];
-+ sb->set_uuid1 = info->uuid[1];
-+ sb->set_uuid2 = info->uuid[2];
-+ sb->set_uuid3 = info->uuid[3];
-+ if (sb->state & (1<<MD_SB_BITMAP_PRESENT)) {
-+ struct bitmap_super_s *bm;
-+ bm = (struct bitmap_super_s*)(sb+1);
-+ uuid_from_super0((int*)bm->uuid, sbv);
-+ }
-+ }
-+ if (strcmp(update, "_reshape_progress")==0)
-+ sb->reshape_position = info->reshape_progress;
-+
-+ sb->sb_csum = calc_sb0_csum(sb);
-+ return rv;
-+}
-+
-+static int store_super0(struct supertype *st, int fd, void *sbv)
-+{
-+ unsigned long long dsize;
-+ unsigned long long offset;
-+ mdp_super_t *super = sbv;
-+
-+ if (!get_dev_size(fd, NULL, &dsize))
-+ return 1;
-+
-+ if (dsize < MD_RESERVED_SECTORS*2*512)
-+ return 2;
-+
-+ offset = MD_NEW_SIZE_SECTORS(dsize>>9);
-+
-+ offset *= 512;
-+
-+ if (lseek64(fd, offset, 0)< 0LL)
-+ return 3;
-+
-+ if (write(fd, super, sizeof(*super)) != sizeof(*super))
-+ return 4;
-+
-+ if (super->state & (1<<MD_SB_BITMAP_PRESENT)) {
-+ struct bitmap_super_s * bm = (struct bitmap_super_s*)(super+1);
-+ if (__le32_to_cpu(bm->magic) == BITMAP_MAGIC)
-+ if (write(fd, bm, sizeof(*bm)) != sizeof(*bm))
-+ return 5;
-+ }
-+
-+ fsync(fd);
-+ return 0;
-+}
-+
-+static int compare_super0(void **firstp, void *secondv)
-+{
-+ /*
-+ * return:
-+ * 0 same, or first was empty, and second was copied
-+ * 1 second had wrong number
-+ * 2 wrong uuid
-+ * 3 wrong other info
-+ */
-+ mdp_super_t *first = *firstp;
-+ mdp_super_t *second = secondv;
-+
-+ int uuid1[4], uuid2[4];
-+ if (second->md_magic != MD_SB_MAGIC)
-+ return 1;
-+ if (!first) {
-+ first = malloc(MD_SB_BYTES + sizeof(struct bitmap_super_s));
-+ memcpy(first, second, MD_SB_BYTES + sizeof(struct bitmap_super_s));
-+ *firstp = first;
-+ return 0;
-+ }
-+
-+ uuid_from_super0(uuid1, first);
-+ uuid_from_super0(uuid2, second);
-+ if (!same_uuid(uuid1, uuid2, 0))
-+ return 2;
-+ if (first->major_version != second->major_version ||
-+ first->minor_version != second->minor_version ||
-+ first->patch_version != second->patch_version ||
-+ first->gvalid_words != second->gvalid_words ||
-+ first->ctime != second->ctime ||
-+ first->level != second->level ||
-+ first->size != second->size ||
-+ first->raid_disks != second->raid_disks )
-+ return 3;
-+
-+ return 0;
-+}
-+
-+
-+static int load_super0(struct supertype *st, int fd, void **sbp, char *devname)
-+{
-+ /* try to read in the superblock
-+ * Return:
-+ * 0 on success
-+ * 1 on cannot get superblock
-+ * 2 on superblock meaningless
-+ */
-+ unsigned long long dsize;
-+ unsigned long long offset;
-+ mdp_super_t *super;
-+ int uuid[4];
-+ struct bitmap_super_s *bsb;
-+
-+ if (!get_dev_size(fd, devname, &dsize))
-+ return 1;
-+
-+ if (dsize < MD_RESERVED_SECTORS*512 * 2) {
-+ if (devname)
-+ fprintf(stderr, Name
-+ ": %s is too small for md: size is %llu sectors.\n",
-+ devname, dsize);
-+ return 1;
-+ }
-+
-+ offset = MD_NEW_SIZE_SECTORS(dsize>>9);
-+
-+ offset *= 512;
-+
-+ ioctl(fd, BLKFLSBUF, 0); /* make sure we read current data */
-+
-+ if (lseek64(fd, offset, 0)< 0LL) {
-+ if (devname)
-+ fprintf(stderr, Name ": Cannot seek to superblock on %s: %s\n",
-+ devname, strerror(errno));
-+ return 1;
-+ }
-+
-+ super = malloc(MD_SB_BYTES + sizeof(bitmap_super_t));
-+
-+ if (read(fd, super, sizeof(*super)) != MD_SB_BYTES) {
-+ if (devname)
-+ fprintf(stderr, Name ": Cannot read superblock on %s\n",
-+ devname);
-+ free(super);
-+ return 1;
-+ }
-+
-+ if (st->ss && st->minor_version == 9)
-+ super0_swap_endian(super);
-+
-+ if (super->md_magic != MD_SB_MAGIC) {
-+ if (devname)
-+ fprintf(stderr, Name ": No super block found on %s (Expected magic %08x, got %08x)\n",
-+ devname, MD_SB_MAGIC, super->md_magic);
-+ free(super);
-+ return 2;
-+ }
-+
-+ if (super->major_version != 0) {
-+ if (devname)
-+ fprintf(stderr, Name ": Cannot interpret superblock on %s - version is %d\n",
-+ devname, super->major_version);
-+ free(super);
-+ return 2;
-+ }
-+ *sbp = super;
-+ if (st->ss == NULL) {
-+ st->ss = &super0;
-+ st->minor_version = 90;
-+ st->max_devs = MD_SB_DISKS;
-+ }
-+
-+ /* Now check on the bitmap superblock */
-+ if ((super->state & (1<<MD_SB_BITMAP_PRESENT)) == 0)
-+ return 0;
-+ /* Read the bitmap superblock and make sure it looks
-+ * valid. If it doesn't clear the bit. An --assemble --force
-+ * should get that written out.
-+ */
-+ if (read(fd, super+1, sizeof(struct bitmap_super_s))
-+ != sizeof(struct bitmap_super_s))
-+ goto no_bitmap;
-+
-+ uuid_from_super0(uuid, super);
-+ bsb = (struct bitmap_super_s *)(super+1);
-+ if (__le32_to_cpu(bsb->magic) != BITMAP_MAGIC ||
-+ memcmp(bsb->uuid, uuid, 16) != 0)
-+ goto no_bitmap;
-+ return 0;
-+
-+ no_bitmap:
-+ super->state &= ~(1<<MD_SB_BITMAP_PRESENT);
-+
-+ return 0;
-+}
-+
-+static struct supertype *match_metadata_desc0(char *arg)
-+{
-+ struct supertype *st = malloc(sizeof(*st));
-+ if (!st) return st;
-+
-+ st->ss = &super0;
-+ st->minor_version = 90;
-+ st->max_devs = MD_SB_DISKS;
-+ if (strcmp(arg, "0") == 0 ||
-+ strcmp(arg, "0.90") == 0 ||
-+ strcmp(arg, "default") == 0
-+ )
-+ return st;
-+
-+ st->minor_version = 9; /* flag for 'byte-swapped' */
-+ if (strcmp(arg, "0.swap")==0)
-+ return st;
-+
-+ free(st);
-+ return NULL;
-+}
-+
-+void locate_bitmap0(struct supertype *st, int fd, void *sbv)
-+{
-+ unsigned long long dsize;
-+ unsigned long long offset;
-+
-+ if (!get_dev_size(fd, NULL, &dsize))
-+ return;
-+
-+ if (dsize < MD_RESERVED_SECTORS*512 * 2)
-+ return;
-+
-+ offset = MD_NEW_SIZE_SECTORS(dsize>>9);
-+
-+ offset *= 512;
-+
-+ offset += MD_SB_BYTES;
-+
-+ lseek64(fd, offset, 0);
-+}
-+
-+struct superswitch super0 = {
-+ .examine_super = NULL,
-+ .brief_examine_super = brief_examine_super0,
-+ .detail_super = NULL,
-+ .brief_detail_super = NULL,
-+ .export_super = NULL,
-+ .match_home = match_home0,
-+ .uuid_from_super = uuid_from_super0,
-+ .getinfo_super = getinfo_super0,
-+ .update_super = update_super0,
-+ .init_super = NULL,
-+ .add_to_super = NULL,
-+ .store_super = store_super0,
-+ .write_init_super = NULL,
-+ .compare_super = compare_super0,
-+ .load_super = load_super0,
-+ .match_metadata_desc = match_metadata_desc0,
-+ .avail_size = NULL,
-+ .add_internal_bitmap = NULL,
-+ .locate_bitmap = locate_bitmap0,
-+ .write_bitmap = NULL,
-+ .major = 0,
-+ .swapuuid = 0,
-+};
-diff -Nuar --exclude '*.orig' busybox-1.7.4+gentoo/mdadm/super1.c busybox-1.7.4+gentoo+mdadm/mdadm/super1.c
---- busybox-1.7.4+gentoo/mdadm/super1.c 1969-12-31 16:00:00.000000000 -0800
-+++ busybox-1.7.4+gentoo+mdadm/mdadm/super1.c 2008-03-11 10:31:00.000000000 -0700
-@@ -0,0 +1,731 @@
-+/*
-+ * mdadm - manage Linux "md" devices aka RAID arrays.
-+ *
-+ * Copyright (C) 2001-2006 Neil Brown <neilb@suse.de>
-+ *
-+ *
-+ * 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
-+ *
-+ * Author: Neil Brown
-+ * Email: <neilb@cse.unsw.edu.au>
-+ * Paper: Neil Brown
-+ * School of Computer Science and Engineering
-+ * The University of New South Wales
-+ * Sydney, 2052
-+ * Australia
-+ */
-+
-+#include "mdadm.h"
-+/*
-+ * The version-1 superblock :
-+ * All numeric fields are little-endian.
-+ *
-+ * total size: 256 bytes plus 2 per device.
-+ * 1K allows 384 devices.
-+ */
-+struct mdp_superblock_1 {
-+ /* constant array information - 128 bytes */
-+ __u32 magic; /* MD_SB_MAGIC: 0xa92b4efc - little endian */
-+ __u32 major_version; /* 1 */
-+ __u32 feature_map; /* 0 for now */
-+ __u32 pad0; /* always set to 0 when writing */
-+
-+ __u8 set_uuid[16]; /* user-space generated. */
-+ char set_name[32]; /* set and interpreted by user-space */
-+
-+ __u64 ctime; /* lo 40 bits are seconds, top 24 are microseconds or 0*/
-+ __u32 level; /* -4 (multipath), -1 (linear), 0,1,4,5 */
-+ __u32 layout; /* only for raid5 currently */
-+ __u64 size; /* used size of component devices, in 512byte sectors */
-+
-+ __u32 chunksize; /* in 512byte sectors */
-+ __u32 raid_disks;
-+ __u32 bitmap_offset; /* sectors after start of superblock that bitmap starts
-+ * NOTE: signed, so bitmap can be before superblock
-+ * only meaningful of feature_map[0] is set.
-+ */
-+
-+ /* These are only valid with feature bit '4' */
-+ __u32 new_level; /* new level we are reshaping to */
-+ __u64 reshape_position; /* next address in array-space for reshape */
-+ __u32 delta_disks; /* change in number of raid_disks */
-+ __u32 new_layout; /* new layout */
-+ __u32 new_chunk; /* new chunk size (bytes) */
-+ __u8 pad1[128-124]; /* set to 0 when written */
-+
-+ /* constant this-device information - 64 bytes */
-+ __u64 data_offset; /* sector start of data, often 0 */
-+ __u64 data_size; /* sectors in this device that can be used for data */
-+ __u64 super_offset; /* sector start of this superblock */
-+ __u64 recovery_offset;/* sectors before this offset (from data_offset) have been recovered */
-+ __u32 dev_number; /* permanent identifier of this device - not role in raid */
-+ __u32 cnt_corrected_read; /* number of read errors that were corrected by re-writing */
-+ __u8 device_uuid[16]; /* user-space setable, ignored by kernel */
-+ __u8 devflags; /* per-device flags. Only one defined...*/
-+#define WriteMostly1 1 /* mask for writemostly flag in above */
-+ __u8 pad2[64-57]; /* set to 0 when writing */
-+
-+ /* array state information - 64 bytes */
-+ __u64 utime; /* 40 bits second, 24 btes microseconds */
-+ __u64 events; /* incremented when superblock updated */
-+ __u64 resync_offset; /* data before this offset (from data_offset) known to be in sync */
-+ __u32 sb_csum; /* checksum upto devs[max_dev] */
-+ __u32 max_dev; /* size of devs[] array to consider */
-+ __u8 pad3[64-32]; /* set to 0 when writing */
-+
-+ /* device state information. Indexed by dev_number.
-+ * 2 bytes per device
-+ * Note there are no per-device state flags. State information is rolled
-+ * into the 'roles' value. If a device is spare or faulty, then it doesn't
-+ * have a meaningful role.
-+ */
-+ __u16 dev_roles[0]; /* role in array, or 0xffff for a spare, or 0xfffe for faulty */
-+};
-+
-+struct misc_dev_info {
-+ __u64 device_size;
-+};
-+
-+/* feature_map bits */
-+#define MD_FEATURE_BITMAP_OFFSET 1
-+#define MD_FEATURE_RECOVERY_OFFSET 2 /* recovery_offset is present and
-+ * must be honoured
-+ */
-+#define MD_FEATURE_RESHAPE_ACTIVE 4
-+
-+#define MD_FEATURE_ALL (1|2|4)
-+
-+#ifndef offsetof
-+#define offsetof(t,f) ((size_t)&(((t*)0)->f))
-+#endif
-+static unsigned int calc_sb_1_csum(struct mdp_superblock_1 * sb)
-+{
-+ unsigned int disk_csum, csum;
-+ unsigned long long newcsum;
-+ int size = sizeof(*sb) + __le32_to_cpu(sb->max_dev)*2;
-+ unsigned int *isuper = (unsigned int*)sb;
-+ int i;
-+
-+/* make sure I can count... */
-+ if (offsetof(struct mdp_superblock_1,data_offset) != 128 ||
-+ offsetof(struct mdp_superblock_1, utime) != 192 ||
-+ sizeof(struct mdp_superblock_1) != 256) {
-+ fprintf(stderr, "WARNING - superblock isn't sized correctly\n");
-+ }
-+
-+ disk_csum = sb->sb_csum;
-+ sb->sb_csum = 0;
-+ newcsum = 0;
-+ for (i=0; size>=4; size -= 4 ) {
-+ newcsum += __le32_to_cpu(*isuper);
-+ isuper++;
-+ }
-+
-+ if (size == 2)
-+ newcsum += __le16_to_cpu(*(unsigned short*) isuper);
-+
-+ csum = (newcsum & 0xffffffff) + (newcsum >> 32);
-+ sb->sb_csum = disk_csum;
-+ return __cpu_to_le32(csum);
-+}
-+
-+static void brief_examine_super1(void *sbv)
-+{
-+ struct mdp_superblock_1 *sb = sbv;
-+ int i;
-+ unsigned long long sb_offset;
-+ char *nm;
-+ char *c=map_num(pers, __le32_to_cpu(sb->level));
-+
-+ nm = strchr(sb->set_name, ':');
-+ if (nm)
-+ nm++;
-+ else if (sb->set_name[0])
-+ nm = sb->set_name;
-+ else
-+ nm = "??";
-+
-+ printf("ARRAY /dev/md%s level=%s ", nm, c?c:"-unknown-");
-+ sb_offset = __le64_to_cpu(sb->super_offset);
-+ if (sb_offset <= 4)
-+ printf("metadata=1.1 ");
-+ else if (sb_offset <= 8)
-+ printf("metadata=1.2 ");
-+ else
-+ printf("metadata=1.0 ");
-+ printf("num-devices=%d UUID=", __le32_to_cpu(sb->raid_disks));
-+ for (i=0; i<16; i++) {
-+ if ((i&3)==0 && i != 0) printf(":");
-+ printf("%02x", sb->set_uuid[i]);
-+ }
-+ if (sb->set_name[0])
-+ printf(" name=%.32s", sb->set_name);
-+ printf("\n");
-+}
-+
-+static int match_home1(void *sbv, char *homehost)
-+{
-+ struct mdp_superblock_1 *sb = sbv;
-+ int l = homehost ? strlen(homehost) : 0;
-+
-+ return (l > 0 && l < 32 &&
-+ sb->set_name[l] == ':' &&
-+ strncmp(sb->set_name, homehost, l) == 0);
-+}
-+
-+static void uuid_from_super1(int uuid[4], void * sbv)
-+{
-+ struct mdp_superblock_1 *super = sbv;
-+ char *cuuid = (char*)uuid;
-+ int i;
-+ for (i=0; i<16; i++)
-+ cuuid[i] = super->set_uuid[i];
-+}
-+
-+static void getinfo_super1(struct mdinfo *info, void *sbv)
-+{
-+ struct mdp_superblock_1 *sb = sbv;
-+ int working = 0;
-+ int i;
-+ int role;
-+
-+ info->array.major_version = 1;
-+ info->array.minor_version = __le32_to_cpu(sb->feature_map);
-+ info->array.patch_version = 0;
-+ info->array.raid_disks = __le32_to_cpu(sb->raid_disks);
-+ info->array.level = __le32_to_cpu(sb->level);
-+ info->array.layout = __le32_to_cpu(sb->layout);
-+ info->array.md_minor = -1;
-+ info->array.ctime = __le64_to_cpu(sb->ctime);
-+ info->array.utime = __le64_to_cpu(sb->utime);
-+ info->array.chunk_size = __le32_to_cpu(sb->chunksize)*512;
-+ info->array.state =
-+ (__le64_to_cpu(sb->resync_offset) >= __le64_to_cpu(sb->size))
-+ ? 1 : 0;
-+
-+ info->data_offset = __le64_to_cpu(sb->data_offset);
-+ info->component_size = __le64_to_cpu(sb->size);
-+
-+ info->disk.major = 0;
-+ info->disk.minor = 0;
-+ info->disk.number = __le32_to_cpu(sb->dev_number);
-+ if (__le32_to_cpu(sb->dev_number) >= __le32_to_cpu(sb->max_dev) ||
-+ __le32_to_cpu(sb->max_dev) > 512)
-+ role = 0xfffe;
-+ else
-+ role = __le16_to_cpu(sb->dev_roles[__le32_to_cpu(sb->dev_number)]);
-+
-+ info->disk.raid_disk = -1;
-+ switch(role) {
-+ case 0xFFFF:
-+ info->disk.state = 2; /* spare: ACTIVE, not sync, not faulty */
-+ break;
-+ case 0xFFFE:
-+ info->disk.state = 1; /* faulty */
-+ break;
-+ default:
-+ info->disk.state = 6; /* active and in sync */
-+ info->disk.raid_disk = role;
-+ }
-+ info->events = __le64_to_cpu(sb->events);
-+
-+ memcpy(info->uuid, sb->set_uuid, 16);
-+
-+ strncpy(info->name, sb->set_name, 32);
-+ info->name[32] = 0;
-+
-+ if (sb->feature_map & __le32_to_cpu(MD_FEATURE_RESHAPE_ACTIVE)) {
-+ info->reshape_active = 1;
-+ info->reshape_progress = __le64_to_cpu(sb->reshape_position);
-+ info->new_level = __le32_to_cpu(sb->new_level);
-+ info->delta_disks = __le32_to_cpu(sb->delta_disks);
-+ info->new_layout = __le32_to_cpu(sb->new_layout);
-+ info->new_chunk = __le32_to_cpu(sb->new_chunk)<<9;
-+ } else
-+ info->reshape_active = 0;
-+
-+ for (i=0; i< __le32_to_cpu(sb->max_dev); i++) {
-+ role = __le16_to_cpu(sb->dev_roles[i]);
-+ if (/*role == 0xFFFF || */role < info->array.raid_disks)
-+ working++;
-+ }
-+
-+ info->array.working_disks = working;
-+}
-+
-+static int update_super1(struct mdinfo *info, void *sbv, char *update,
-+ char *devname, int verbose,
-+ int uuid_set, char *homehost)
-+{
-+ /* NOTE: for 'assemble' and 'force' we need to return non-zero if any change was made.
-+ * For others, the return value is ignored.
-+ */
-+ int rv = 0;
-+ struct mdp_superblock_1 *sb = sbv;
-+
-+ if (strcmp(update, "force-one")==0) {
-+ /* Not enough devices for a working array,
-+ * so bring this one up-to-date
-+ */
-+ if (sb->events != __cpu_to_le64(info->events))
-+ rv = 1;
-+ sb->events = __cpu_to_le64(info->events);
-+ }
-+ if (strcmp(update, "force-array")==0) {
-+ /* Degraded array and 'force' requests to
-+ * maybe need to mark it 'clean'.
-+ */
-+ switch(__le32_to_cpu(sb->level)) {
-+ case 5: case 4: case 6:
-+ /* need to force clean */
-+ if (sb->resync_offset != ~0ULL)
-+ rv = 1;
-+ sb->resync_offset = ~0ULL;
-+ }
-+ }
-+ if (strcmp(update, "assemble")==0) {
-+ int d = info->disk.number;
-+ int want;
-+ if (info->disk.state == 6)
-+ want = __cpu_to_le32(info->disk.raid_disk);
-+ else
-+ want = 0xFFFF;
-+ if (sb->dev_roles[d] != want) {
-+ sb->dev_roles[d] = want;
-+ rv = 1;
-+ }
-+ }
-+ if (strcmp(update, "linear-grow-new") == 0) {
-+ int i;
-+ int rfd;
-+ int max = __le32_to_cpu(sb->max_dev);
-+
-+ for (i=0 ; i < max ; i++)
-+ if (__le16_to_cpu(sb->dev_roles[i]) >= 0xfffe)
-+ break;
-+ sb->dev_number = __cpu_to_le32(i);
-+ info->disk.number = i;
-+ if (max >= __le32_to_cpu(sb->max_dev))
-+ sb->max_dev = __cpu_to_le32(max+1);
-+
-+ if ((rfd = open("/dev/urandom", O_RDONLY)) < 0 ||
-+ read(rfd, sb->device_uuid, 16) != 16) {
-+ *(__u32*)(sb->device_uuid) = random();
-+ *(__u32*)(sb->device_uuid+4) = random();
-+ *(__u32*)(sb->device_uuid+8) = random();
-+ *(__u32*)(sb->device_uuid+12) = random();
-+ }
-+
-+ sb->dev_roles[i] =
-+ __cpu_to_le16(info->disk.raid_disk);
-+ }
-+ if (strcmp(update, "linear-grow-update") == 0) {
-+ sb->raid_disks = __cpu_to_le32(info->array.raid_disks);
-+ sb->dev_roles[info->disk.number] =
-+ __cpu_to_le16(info->disk.raid_disk);
-+ }
-+ if (strcmp(update, "resync") == 0) {
-+ /* make sure resync happens */
-+ sb->resync_offset = 0ULL;
-+ }
-+ if (strcmp(update, "uuid") == 0) {
-+ copy_uuid(sb->set_uuid, info->uuid, super1.swapuuid);
-+
-+ if (__le32_to_cpu(sb->feature_map)&MD_FEATURE_BITMAP_OFFSET) {
-+ struct bitmap_super_s *bm;
-+ bm = (struct bitmap_super_s*)(sbv+1024);
-+ memcpy(bm->uuid, sb->set_uuid, 16);
-+ }
-+ }
-+ if (strcmp(update, "homehost") == 0 &&
-+ homehost) {
-+ char *c;
-+ update = "name";
-+ c = strchr(sb->set_name, ':');
-+ if (c)
-+ strncpy(info->name, c+1, 31 - (c-sb->set_name));
-+ else
-+ strncpy(info->name, sb->set_name, 32);
-+ info->name[32] = 0;
-+ }
-+ if (strcmp(update, "name") == 0) {
-+ if (info->name[0] == 0)
-+ sprintf(info->name, "%d", info->array.md_minor);
-+ memset(sb->set_name, 0, sizeof(sb->set_name));
-+ if (homehost &&
-+ strchr(info->name, ':') == NULL &&
-+ strlen(homehost)+1+strlen(info->name) < 32) {
-+ strcpy(sb->set_name, homehost);
-+ strcat(sb->set_name, ":");
-+ strcat(sb->set_name, info->name);
-+ } else
-+ strcpy(sb->set_name, info->name);
-+ }
-+ if (strcmp(update, "devicesize") == 0 &&
-+ __le64_to_cpu(sb->super_offset) <
-+ __le64_to_cpu(sb->data_offset)) {
-+ /* set data_size to device size less data_offset */
-+ struct misc_dev_info *misc = (struct misc_dev_info*)
-+ (sbv + 1024 + sizeof(struct bitmap_super_s));
-+ printf("Size was %llu\n", (unsigned long long)
-+ __le64_to_cpu(sb->data_size));
-+ sb->data_size = __cpu_to_le64(
-+ misc->device_size - __le64_to_cpu(sb->data_offset));
-+ printf("Size is %llu\n", (unsigned long long)
-+ __le64_to_cpu(sb->data_size));
-+ }
-+ if (strcmp(update, "_reshape_progress")==0)
-+ sb->reshape_position = __cpu_to_le64(info->reshape_progress);
-+
-+ sb->sb_csum = calc_sb_1_csum(sb);
-+ return rv;
-+}
-+
-+static void locate_bitmap1(struct supertype *st, int fd, void *sbv);
-+
-+static int store_super1(struct supertype *st, int fd, void *sbv)
-+{
-+ struct mdp_superblock_1 *sb = sbv;
-+ unsigned long long sb_offset;
-+ int sbsize;
-+ unsigned long long dsize;
-+
-+ if (!get_dev_size(fd, NULL, &dsize))
-+ return 1;
-+
-+ dsize >>= 9;
-+
-+ if (dsize < 24)
-+ return 2;
-+
-+ /*
-+ * Calculate the position of the superblock.
-+ * It is always aligned to a 4K boundary and
-+ * depending on minor_version, it can be:
-+ * 0: At least 8K, but less than 12K, from end of device
-+ * 1: At start of device
-+ * 2: 4K from start of device.
-+ */
-+ switch(st->minor_version) {
-+ case 0:
-+ sb_offset = dsize;
-+ sb_offset -= 8*2;
-+ sb_offset &= ~(4*2-1);
-+ break;
-+ case 1:
-+ sb_offset = 0;
-+ break;
-+ case 2:
-+ sb_offset = 4*2;
-+ break;
-+ default:
-+ return -EINVAL;
-+ }
-+
-+
-+
-+ if (sb_offset != __le64_to_cpu(sb->super_offset) &&
-+ 0 != __le64_to_cpu(sb->super_offset)
-+ ) {
-+ fprintf(stderr, Name ": internal error - sb_offset is wrong\n");
-+ abort();
-+ }
-+
-+ if (lseek64(fd, sb_offset << 9, 0)< 0LL)
-+ return 3;
-+
-+ sbsize = sizeof(*sb) + 2 * __le32_to_cpu(sb->max_dev);
-+
-+ if (write(fd, sb, sbsize) != sbsize)
-+ return 4;
-+
-+ if (sb->feature_map & __cpu_to_le32(MD_FEATURE_BITMAP_OFFSET)) {
-+ struct bitmap_super_s *bm = (struct bitmap_super_s*)
-+ (((char*)sb)+1024);
-+ if (__le32_to_cpu(bm->magic) == BITMAP_MAGIC) {
-+ locate_bitmap1(st, fd, sbv);
-+ if (write(fd, bm, sizeof(*bm)) != sizeof(*bm))
-+ return 5;
-+ }
-+ }
-+ fsync(fd);
-+ return 0;
-+}
-+
-+static int load_super1(struct supertype *st, int fd, void **sbp, char *devname);
-+
-+static int compare_super1(void **firstp, void *secondv)
-+{
-+ /*
-+ * return:
-+ * 0 same, or first was empty, and second was copied
-+ * 1 second had wrong number
-+ * 2 wrong uuid
-+ * 3 wrong other info
-+ */
-+ struct mdp_superblock_1 *first = *firstp;
-+ struct mdp_superblock_1 *second = secondv;
-+
-+ if (second->magic != __cpu_to_le32(MD_SB_MAGIC))
-+ return 1;
-+ if (second->major_version != __cpu_to_le32(1))
-+ return 1;
-+
-+ if (!first) {
-+ first = malloc(1024+sizeof(bitmap_super_t) +
-+ sizeof(struct misc_dev_info));
-+ memcpy(first, second, 1024+sizeof(bitmap_super_t) +
-+ sizeof(struct misc_dev_info));
-+ *firstp = first;
-+ return 0;
-+ }
-+ if (memcmp(first->set_uuid, second->set_uuid, 16)!= 0)
-+ return 2;
-+
-+ if (first->ctime != second->ctime ||
-+ first->level != second->level ||
-+ first->layout != second->layout ||
-+ first->size != second->size ||
-+ first->chunksize != second->chunksize ||
-+ first->raid_disks != second->raid_disks)
-+ return 3;
-+ return 0;
-+}
-+
-+static int load_super1(struct supertype *st, int fd, void **sbp, char *devname)
-+{
-+ unsigned long long dsize;
-+ unsigned long long sb_offset;
-+ struct mdp_superblock_1 *super;
-+ int uuid[4];
-+ struct bitmap_super_s *bsb;
-+ struct misc_dev_info *misc;
-+
-+
-+ if (st->ss == NULL) {
-+ int bestvers = -1;
-+ __u64 bestctime = 0;
-+ /* guess... choose latest ctime */
-+ st->ss = &super1;
-+ for (st->minor_version = 0; st->minor_version <= 2 ; st->minor_version++) {
-+ switch(load_super1(st, fd, sbp, devname)) {
-+ case 0: super = *sbp;
-+ if (bestvers == -1 ||
-+ bestctime < __le64_to_cpu(super->ctime)) {
-+ bestvers = st->minor_version;
-+ bestctime = __le64_to_cpu(super->ctime);
-+ }
-+ free(super);
-+ *sbp = NULL;
-+ break;
-+ case 1: st->ss = NULL; return 1; /*bad device */
-+ case 2: break; /* bad, try next */
-+ }
-+ }
-+ if (bestvers != -1) {
-+ int rv;
-+ st->minor_version = bestvers;
-+ st->ss = &super1;
-+ st->max_devs = 384;
-+ rv = load_super1(st, fd, sbp, devname);
-+ if (rv) st->ss = NULL;
-+ return rv;
-+ }
-+ st->ss = NULL;
-+ return 2;
-+ }
-+ if (!get_dev_size(fd, devname, &dsize))
-+ return 1;
-+ dsize >>= 9;
-+
-+ if (dsize < 24) {
-+ if (devname)
-+ fprintf(stderr, Name ": %s is too small for md: size is %llu sectors.\n",
-+ devname, dsize);
-+ return 1;
-+ }
-+
-+ /*
-+ * Calculate the position of the superblock.
-+ * It is always aligned to a 4K boundary and
-+ * depending on minor_version, it can be:
-+ * 0: At least 8K, but less than 12K, from end of device
-+ * 1: At start of device
-+ * 2: 4K from start of device.
-+ */
-+ switch(st->minor_version) {
-+ case 0:
-+ sb_offset = dsize;
-+ sb_offset -= 8*2;
-+ sb_offset &= ~(4*2-1);
-+ break;
-+ case 1:
-+ sb_offset = 0;
-+ break;
-+ case 2:
-+ sb_offset = 4*2;
-+ break;
-+ default:
-+ return -EINVAL;
-+ }
-+
-+ ioctl(fd, BLKFLSBUF, 0); /* make sure we read current data */
-+
-+
-+ if (lseek64(fd, sb_offset << 9, 0)< 0LL) {
-+ if (devname)
-+ fprintf(stderr, Name ": Cannot seek to superblock on %s: %s\n",
-+ devname, strerror(errno));
-+ return 1;
-+ }
-+
-+ super = malloc(1024 + sizeof(bitmap_super_t) +
-+ sizeof(struct misc_dev_info));
-+
-+ if (read(fd, super, 1024) != 1024) {
-+ if (devname)
-+ fprintf(stderr, Name ": Cannot read superblock on %s\n",
-+ devname);
-+ free(super);
-+ return 1;
-+ }
-+
-+ if (__le32_to_cpu(super->magic) != MD_SB_MAGIC) {
-+ if (devname)
-+ fprintf(stderr, Name ": No super block found on %s (Expected magic %08x, got %08x)\n",
-+ devname, MD_SB_MAGIC, __le32_to_cpu(super->magic));
-+ free(super);
-+ return 2;
-+ }
-+
-+ if (__le32_to_cpu(super->major_version) != 1) {
-+ if (devname)
-+ fprintf(stderr, Name ": Cannot interpret superblock on %s - version is %d\n",
-+ devname, __le32_to_cpu(super->major_version));
-+ free(super);
-+ return 2;
-+ }
-+ if (__le64_to_cpu(super->super_offset) != sb_offset) {
-+ if (devname)
-+ fprintf(stderr, Name ": No superblock found on %s (super_offset is wrong)\n",
-+ devname);
-+ free(super);
-+ return 2;
-+ }
-+ *sbp = super;
-+
-+ bsb = (struct bitmap_super_s *)(((char*)super)+1024);
-+
-+ misc = (struct misc_dev_info*) (bsb+1);
-+ misc->device_size = dsize;
-+
-+ /* Now check on the bitmap superblock */
-+ if ((__le32_to_cpu(super->feature_map)&MD_FEATURE_BITMAP_OFFSET) == 0)
-+ return 0;
-+ /* Read the bitmap superblock and make sure it looks
-+ * valid. If it doesn't clear the bit. An --assemble --force
-+ * should get that written out.
-+ */
-+ locate_bitmap1(st, fd, super);
-+ if (read(fd, ((char*)super)+1024, sizeof(struct bitmap_super_s))
-+ != sizeof(struct bitmap_super_s))
-+ goto no_bitmap;
-+
-+ uuid_from_super1(uuid, super);
-+ if (__le32_to_cpu(bsb->magic) != BITMAP_MAGIC ||
-+ memcmp(bsb->uuid, uuid, 16) != 0)
-+ goto no_bitmap;
-+ return 0;
-+
-+ no_bitmap:
-+ super->feature_map = __cpu_to_le32(__le32_to_cpu(super->feature_map) & ~1);
-+ return 0;
-+}
-+
-+
-+static struct supertype *match_metadata_desc1(char *arg)
-+{
-+ struct supertype *st = malloc(sizeof(*st));
-+ if (!st) return st;
-+
-+ st->ss = &super1;
-+ st->max_devs = 384;
-+ if (strcmp(arg, "1") == 0 ||
-+ strcmp(arg, "1.0") == 0 ||
-+ strcmp(arg, "default/large") == 0) {
-+ st->minor_version = 0;
-+ return st;
-+ }
-+ if (strcmp(arg, "1.1") == 0) {
-+ st->minor_version = 1;
-+ return st;
-+ }
-+ if (strcmp(arg, "1.2") == 0) {
-+ st->minor_version = 2;
-+ return st;
-+ }
-+
-+ free(st);
-+ return NULL;
-+}
-+
-+static void locate_bitmap1(struct supertype *st, int fd, void *sbv)
-+{
-+ unsigned long long offset;
-+ struct mdp_superblock_1 *sb;
-+ int mustfree = 0;
-+
-+ if (!sbv) {
-+ if (st->ss->load_super(st, fd, &sbv, NULL))
-+ return; /* no error I hope... */
-+ mustfree = 1;
-+ }
-+ sb = sbv;
-+
-+ offset = __le64_to_cpu(sb->super_offset);
-+ offset += (int32_t) __le32_to_cpu(sb->bitmap_offset);
-+ if (mustfree)
-+ free(sb);
-+ lseek64(fd, offset<<9, 0);
-+}
-+
-+struct superswitch super1 = {
-+ .examine_super = NULL,
-+ .brief_examine_super = brief_examine_super1,
-+ .detail_super = NULL,
-+ .brief_detail_super = NULL,
-+ .export_super = NULL,
-+ .match_home = match_home1,
-+ .uuid_from_super = uuid_from_super1,
-+ .getinfo_super = getinfo_super1,
-+ .update_super = update_super1,
-+ .init_super = NULL,
-+ .add_to_super = NULL,
-+ .store_super = store_super1,
-+ .write_init_super = NULL,
-+ .compare_super = compare_super1,
-+ .load_super = load_super1,
-+ .match_metadata_desc = match_metadata_desc1,
-+ .avail_size = NULL,
-+ .add_internal_bitmap = NULL,
-+ .locate_bitmap = locate_bitmap1,
-+ .write_bitmap = NULL,
-+ .major = 1,
-+#if __BYTE_ORDER == BIG_ENDIAN
-+ .swapuuid = 0,
-+#else
-+ .swapuuid = 1,
-+#endif
-+};
-diff -Nuar --exclude '*.orig' busybox-1.7.4+gentoo/mdadm/util.c busybox-1.7.4+gentoo+mdadm/mdadm/util.c
---- busybox-1.7.4+gentoo/mdadm/util.c 1969-12-31 16:00:00.000000000 -0800
-+++ busybox-1.7.4+gentoo+mdadm/mdadm/util.c 2008-03-11 10:31:00.000000000 -0700
-@@ -0,0 +1,652 @@
-+/*
-+ * mdadm - manage Linux "md" devices aka RAID arrays.
-+ *
-+ * Copyright (C) 2001-2006 Neil Brown <neilb@suse.de>
-+ *
-+ *
-+ * 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
-+ *
-+ * Author: Neil Brown
-+ * Email: <neilb@cse.unsw.edu.au>
-+ * Paper: Neil Brown
-+ * School of Computer Science and Engineering
-+ * The University of New South Wales
-+ * Sydney, 2052
-+ * Australia
-+ */
-+
-+#include "mdadm.h"
-+#include "md_p.h"
-+#include <sys/utsname.h>
-+#include <ctype.h>
-+
-+/*
-+ * following taken from linux/blkpg.h because they aren't
-+ * anywhere else and it isn't safe to #include linux/ * stuff.
-+ */
-+
-+#define BLKPG _IO(0x12,105)
-+
-+/* The argument structure */
-+struct blkpg_ioctl_arg {
-+ int op;
-+ int flags;
-+ int datalen;
-+ void *data;
-+};
-+
-+/* The subfunctions (for the op field) */
-+#define BLKPG_ADD_PARTITION 1
-+#define BLKPG_DEL_PARTITION 2
-+
-+/* Sizes of name fields. Unused at present. */
-+#define BLKPG_DEVNAMELTH 64
-+#define BLKPG_VOLNAMELTH 64
-+
-+/* The data structure for ADD_PARTITION and DEL_PARTITION */
-+struct blkpg_partition {
-+ long long start; /* starting offset in bytes */
-+ long long length; /* length in bytes */
-+ int pno; /* partition number */
-+ char devname[BLKPG_DEVNAMELTH]; /* partition name, like sda5 or c0d1p2,
-+ to be used in kernel messages */
-+ char volname[BLKPG_VOLNAMELTH]; /* volume label */
-+};
-+
-+/*
-+ * Parse a 128 bit uuid in 4 integers
-+ * format is 32 hexx nibbles with options :.<space> separator
-+ * If not exactly 32 hex digits are found, return 0
-+ * else return 1
-+ */
-+int parse_uuid(char *str, int uuid[4])
-+{
-+ int hit = 0; /* number of Hex digIT */
-+ int i;
-+ char c;
-+ for (i=0; i<4; i++) uuid[i]=0;
-+
-+ while ((c= *str++)) {
-+ int n;
-+ if (c>='0' && c<='9')
-+ n = c-'0';
-+ else if (c>='a' && c <= 'f')
-+ n = 10 + c - 'a';
-+ else if (c>='A' && c <= 'F')
-+ n = 10 + c - 'A';
-+ else if (strchr(":. -", c))
-+ continue;
-+ else return 0;
-+
-+ if (hit<32) {
-+ uuid[hit/8] <<= 4;
-+ uuid[hit/8] += n;
-+ }
-+ hit++;
-+ }
-+ if (hit == 32)
-+ return 1;
-+ return 0;
-+
-+}
-+
-+
-+/*
-+ * Get the md version number.
-+ * We use the RAID_VERSION ioctl if it is supported
-+ * If not, but we have a block device with major '9', we assume
-+ * 0.36.0
-+ *
-+ * Return version number as 24 but number - assume version parts
-+ * always < 255
-+ */
-+
-+int md_get_version(int fd)
-+{
-+ struct stat stb;
-+ mdu_version_t vers;
-+
-+ if (fstat(fd, &stb)<0)
-+ return -1;
-+ if ((S_IFMT&stb.st_mode) != S_IFBLK)
-+ return -1;
-+
-+ if (ioctl(fd, RAID_VERSION, &vers) == 0)
-+ return (vers.major*10000) + (vers.minor*100) + vers.patchlevel;
-+ if (errno == EACCES)
-+ return -1;
-+ if (major(stb.st_rdev) == MD_MAJOR)
-+ return (3600);
-+ return -1;
-+}
-+
-+
-+int get_linux_version()
-+{
-+ struct utsname name;
-+ char *cp;
-+ int a,b,c;
-+ if (uname(&name) <0)
-+ return -1;
-+
-+ cp = name.release;
-+ a = strtoul(cp, &cp, 10);
-+ if (*cp != '.') return -1;
-+ b = strtoul(cp+1, &cp, 10);
-+ if (*cp != '.') return -1;
-+ c = strtoul(cp+1, NULL, 10);
-+
-+ return (a*1000000)+(b*1000)+c;
-+}
-+
-+void remove_partitions(int fd)
-+{
-+ /* remove partitions from this block devices.
-+ * This is used for components added to an array
-+ */
-+#ifdef BLKPG_DEL_PARTITION
-+ struct blkpg_ioctl_arg a;
-+ struct blkpg_partition p;
-+
-+ a.op = BLKPG_DEL_PARTITION;
-+ a.data = (void*)&p;
-+ a.datalen = sizeof(p);
-+ a.flags = 0;
-+ memset(a.data, 0, a.datalen);
-+ for (p.pno=0; p.pno < 16; p.pno++)
-+ ioctl(fd, BLKPG, &a);
-+#endif
-+}
-+
-+int enough(int level, int raid_disks, int layout, int clean,
-+ char *avail, int avail_disks)
-+{
-+ int copies, first;
-+ switch (level) {
-+ case 10:
-+ /* This is the tricky one - we need to check
-+ * which actual disks are present.
-+ */
-+ copies = (layout&255)* ((layout>>8) & 255);
-+ first=0;
-+ do {
-+ /* there must be one of the 'copies' form 'first' */
-+ int n = copies;
-+ int cnt=0;
-+ while (n--) {
-+ if (avail[first])
-+ cnt++;
-+ first = (first+1) % raid_disks;
-+ }
-+ if (cnt == 0)
-+ return 0;
-+
-+ } while (first != 0);
-+ return 1;
-+
-+ case -4:
-+ return avail_disks>= 1;
-+ case -1:
-+ case 0:
-+ return avail_disks == raid_disks;
-+ case 1:
-+ return avail_disks >= 1;
-+ case 4:
-+ case 5:
-+ if (clean)
-+ return avail_disks >= raid_disks-1;
-+ else
-+ return avail_disks >= raid_disks;
-+ case 6:
-+ if (clean)
-+ return avail_disks >= raid_disks-2;
-+ else
-+ return avail_disks >= raid_disks;
-+ default:
-+ return 0;
-+ }
-+}
-+
-+int same_uuid(int a[4], int b[4], int swapuuid)
-+{
-+ if (swapuuid) {
-+ /* parse uuids are hostendian.
-+ * uuid's from some superblocks are big-ending
-+ * if there is a difference, we need to swap..
-+ */
-+ unsigned char *ac = (unsigned char *)a;
-+ unsigned char *bc = (unsigned char *)b;
-+ int i;
-+ for (i=0; i<16; i+= 4) {
-+ if (ac[i+0] != bc[i+3] ||
-+ ac[i+1] != bc[i+2] ||
-+ ac[i+2] != bc[i+1] ||
-+ ac[i+3] != bc[i+0])
-+ return 0;
-+ }
-+ return 1;
-+ } else {
-+ if (a[0]==b[0] &&
-+ a[1]==b[1] &&
-+ a[2]==b[2] &&
-+ a[3]==b[3])
-+ return 1;
-+ return 0;
-+ }
-+}
-+void copy_uuid(void *a, int b[4], int swapuuid)
-+{
-+ if (swapuuid) {
-+ /* parse uuids are hostendian.
-+ * uuid's from some superblocks are big-ending
-+ * if there is a difference, we need to swap..
-+ */
-+ unsigned char *ac = (unsigned char *)a;
-+ unsigned char *bc = (unsigned char *)b;
-+ int i;
-+ for (i=0; i<16; i+= 4) {
-+ ac[i+0] = bc[i+3];
-+ ac[i+1] = bc[i+2];
-+ ac[i+2] = bc[i+1];
-+ ac[i+3] = bc[i+0];
-+ }
-+ } else
-+ memcpy(a, b, 16);
-+}
-+
-+char *map_num(mapping_t *map, int num)
-+{
-+ while (map->name) {
-+ if (map->num == num)
-+ return map->name;
-+ map++;
-+ }
-+ return NULL;
-+}
-+
-+int map_name(mapping_t *map, char *name)
-+{
-+ while (map->name) {
-+ if (strcmp(map->name, name)==0)
-+ return map->num;
-+ map++;
-+ }
-+ return UnSet;
-+}
-+
-+
-+int is_standard(char *dev, int *nump)
-+{
-+ /* tests if dev is a "standard" md dev name.
-+ * i.e if the last component is "/dNN" or "/mdNN",
-+ * where NN is a string of digits
-+ */
-+ char *d = strrchr(dev, '/');
-+ int type=0;
-+ int num;
-+ if (!d)
-+ return 0;
-+ if (strncmp(d, "/d",2)==0)
-+ d += 2, type=1; /* /dev/md/dN{pM} */
-+ else if (strncmp(d, "/md_d", 5)==0)
-+ d += 5, type=1; /* /dev/md_dNpM */
-+ else if (strncmp(d, "/md", 3)==0)
-+ d += 3, type=-1; /* /dev/mdN */
-+ else if (d-dev > 3 && strncmp(d-2, "md/", 3)==0)
-+ d += 1, type=-1; /* /dev/md/N */
-+ else
-+ return 0;
-+ if (!*d)
-+ return 0;
-+ num = atoi(d);
-+ while (isdigit(*d))
-+ d++;
-+ if (*d)
-+ return 0;
-+ if (nump) *nump = num;
-+
-+ return type;
-+}
-+
-+
-+/*
-+ * convert a major/minor pair for a block device into a name in /dev, if possible.
-+ * On the first call, walk /dev collecting name.
-+ * Put them in a simple linked listfor now.
-+ */
-+struct devmap {
-+ int major, minor;
-+ char *name;
-+ struct devmap *next;
-+} *devlist = NULL;
-+int devlist_ready = 0;
-+
-+int add_dev(const char *name, const struct stat *stb, int flag, struct FTW *s)
-+{
-+ struct stat st;
-+ if (S_ISLNK(stb->st_mode)) {
-+ stat(name, &st);
-+ stb = &st;
-+ }
-+
-+ if ((stb->st_mode&S_IFMT)== S_IFBLK) {
-+ char *n = strdup(name);
-+ struct devmap *dm = malloc(sizeof(*dm));
-+ if (strncmp(n, "/dev/./", 7)==0)
-+ strcpy(n+4, name+6);
-+ if (dm) {
-+ dm->major = major(stb->st_rdev);
-+ dm->minor = minor(stb->st_rdev);
-+ dm->name = n;
-+ dm->next = devlist;
-+ devlist = dm;
-+ }
-+ }
-+ return 0;
-+}
-+
-+#ifndef HAVE_NFTW
-+#ifdef HAVE_FTW
-+int add_dev_1(const char *name, const struct stat *stb, int flag)
-+{
-+ return add_dev(name, stb, flag, NULL);
-+}
-+int nftw(const char *path, int (*han)(const char *name, const struct stat *stb, int flag, struct FTW *s), int nopenfd, int flags)
-+{
-+ return ftw(path, add_dev_1, nopenfd);
-+}
-+#else
-+int nftw(const char *path, int (*han)(const char *name, const struct stat *stb, int flag, struct FTW *s), int nopenfd, int flags)
-+{
-+ return 0;
-+}
-+#endif /* HAVE_FTW */
-+#endif /* HAVE_NFTW */
-+
-+/*
-+ * Find a block device with the right major/minor number.
-+ * If we find multiple names, choose the shortest.
-+ * If we find a non-standard name, it is probably there
-+ * deliberately so prefer it over a standard name.
-+ * This applies only to names for MD devices.
-+ */
-+char *map_dev(int major, int minor, int create)
-+{
-+ struct devmap *p;
-+ char *std = NULL, *nonstd=NULL;
-+ int did_check = 0;
-+
-+ if (major == 0 && minor == 0)
-+ return NULL;
-+
-+ retry:
-+ if (!devlist_ready) {
-+ char *dev = "/dev";
-+ struct stat stb;
-+ while(devlist) {
-+ struct devmap *d = devlist;
-+ devlist = d->next;
-+ free(d->name);
-+ free(d);
-+ }
-+ if (lstat(dev, &stb)==0 &&
-+ S_ISLNK(stb.st_mode))
-+ dev = "/dev/.";
-+ nftw(dev, add_dev, 10, FTW_PHYS);
-+ devlist_ready=1;
-+ did_check = 1;
-+ }
-+
-+ for (p=devlist; p; p=p->next)
-+ if (p->major == major &&
-+ p->minor == minor) {
-+ if (is_standard(p->name, NULL)) {
-+ if (std == NULL ||
-+ strlen(p->name) < strlen(std))
-+ std = p->name;
-+ } else {
-+ if (nonstd == NULL ||
-+ strlen(p->name) < strlen(nonstd))
-+ nonstd = p->name;
-+ }
-+ }
-+ if (!std && !nonstd && !did_check) {
-+ devlist_ready = 0;
-+ goto retry;
-+ }
-+ if (create && !std && !nonstd) {
-+ static char buf[30];
-+ snprintf(buf, sizeof(buf), "%d:%d", major, minor);
-+ nonstd = buf;
-+ }
-+
-+ return nonstd ? nonstd : std;
-+}
-+
-+unsigned long calc_csum(void *super, int bytes)
-+{
-+ unsigned long long newcsum = 0;
-+ int i;
-+ unsigned int csum;
-+ unsigned int *superc = (unsigned int*) super;
-+
-+ for(i=0; i<bytes/4; i++)
-+ newcsum+= superc[i];
-+ csum = (newcsum& 0xffffffff) + (newcsum>>32);
-+#ifdef __alpha__
-+/* The in-kernel checksum calculation is always 16bit on
-+ * the alpha, though it is 32 bit on i386...
-+ * I wonder what it is elsewhere... (it uses and API in
-+ * a way that it shouldn't).
-+ */
-+ csum = (csum & 0xffff) + (csum >> 16);
-+ csum = (csum & 0xffff) + (csum >> 16);
-+#endif
-+ return csum;
-+}
-+
-+char *human_size(long long bytes)
-+{
-+ static char buf[30];
-+
-+ /* We convert bytes to either centi-M{ega,ibi}bytes or
-+ * centi-G{igi,ibi}bytes, with appropriate rounding,
-+ * and then print 1/100th of those as a decimal.
-+ * We allow upto 2048Megabytes before converting to
-+ * gigabytes, as that shows more precision and isn't
-+ * too large a number.
-+ * Terrabytes are not yet handled.
-+ */
-+
-+ if (bytes < 5000*1024)
-+ buf[0]=0;
-+ else if (bytes < 2*1024LL*1024LL*1024LL) {
-+ long cMiB = (bytes / ( (1LL<<20) / 200LL ) +1) /2;
-+ long cMB = (bytes / ( 1000000LL / 200LL ) +1) /2;
-+ snprintf(buf, sizeof(buf), " (%ld.%02ld MiB %ld.%02ld MB)",
-+ cMiB/100 , cMiB % 100,
-+ cMB/100, cMB % 100);
-+ } else {
-+ long cGiB = (bytes / ( (1LL<<30) / 200LL ) +1) /2;
-+ long cGB = (bytes / (1000000000LL/200LL ) +1) /2;
-+ snprintf(buf, sizeof(buf), " (%ld.%02ld GiB %ld.%02ld GB)",
-+ cGiB/100 , cGiB % 100,
-+ cGB/100, cGB % 100);
-+ }
-+ return buf;
-+}
-+
-+char *human_size_brief(long long bytes)
-+{
-+ static char buf[30];
-+
-+
-+ if (bytes < 5000*1024)
-+ snprintf(buf, sizeof(buf), "%ld.%02ldKiB",
-+ (long)(bytes>>10), (long)(((bytes&1023)*100+512)/1024)
-+ );
-+ else if (bytes < 2*1024LL*1024LL*1024LL)
-+ snprintf(buf, sizeof(buf), "%ld.%02ldMiB",
-+ (long)(bytes>>20),
-+ (long)((bytes&0xfffff)+0x100000/200)/(0x100000/100)
-+ );
-+ else
-+ snprintf(buf, sizeof(buf), "%ld.%02ldGiB",
-+ (long)(bytes>>30),
-+ (long)(((bytes>>10)&0xfffff)+0x100000/200)/(0x100000/100)
-+ );
-+ return buf;
-+}
-+
-+int get_mdp_major(void)
-+{
-+static int mdp_major = -1;
-+ FILE *fl;
-+ char *w;
-+ int have_block = 0;
-+ int have_devices = 0;
-+ int last_num = -1;
-+
-+ if (mdp_major != -1)
-+ return mdp_major;
-+ fl = fopen("/proc/devices", "r");
-+ if (!fl)
-+ return -1;
-+ while ((w = conf_word(fl, 1))) {
-+ if (have_block && strcmp(w, "devices:")==0)
-+ have_devices = 1;
-+ have_block = (strcmp(w, "Block")==0);
-+ if (isdigit(w[0]))
-+ last_num = atoi(w);
-+ if (have_devices && strcmp(w, "mdp")==0)
-+ mdp_major = last_num;
-+ free(w);
-+ }
-+ fclose(fl);
-+ return mdp_major;
-+}
-+
-+int dev_open(char *dev, int flags)
-+{
-+ /* like 'open', but if 'dev' matches %d:%d, create a temp
-+ * block device and open that
-+ */
-+ char *e;
-+ int fd = -1;
-+ char devname[32];
-+ int major;
-+ int minor;
-+
-+ if (!dev) return -1;
-+
-+ major = strtoul(dev, &e, 0);
-+ if (e > dev && *e == ':' && e[1] &&
-+ (minor = strtoul(e+1, &e, 0)) >= 0 &&
-+ *e == 0) {
-+ snprintf(devname, sizeof(devname), "/dev/.tmp.md.%d:%d", major, minor);
-+ if (mknod(devname, S_IFBLK|0600, makedev(major, minor))==0) {
-+ fd = open(devname, flags);
-+ unlink(devname);
-+ }
-+ } else
-+ fd = open(dev, flags);
-+ return fd;
-+}
-+
-+struct superswitch *superlist[] = { &super0, &super1, NULL };
-+
-+struct supertype *super_by_version(int vers, int minor)
-+{
-+ struct supertype *st = malloc(sizeof(*st));
-+ if (!st) return st;
-+ if (vers == 0) {
-+ st->ss = &super0;
-+ st->max_devs = MD_SB_DISKS;
-+ }
-+
-+ if (vers == 1) {
-+ st->ss = &super1;
-+ st->max_devs = 384;
-+ }
-+ st->minor_version = minor;
-+ return st;
-+}
-+
-+struct supertype *guess_super(int fd)
-+{
-+ /* try each load_super to find the best match,
-+ * and return the best superswitch
-+ */
-+ struct superswitch *ss;
-+ struct supertype *st;
-+ unsigned long besttime = 0;
-+ int bestsuper = -1;
-+
-+ void *sbp = NULL;
-+ int i;
-+
-+ st = malloc(sizeof(*st));
-+ memset(st, 0, sizeof(*st));
-+ for (i=0 ; superlist[i]; i++) {
-+ int rv;
-+ ss = superlist[i];
-+ st->ss = NULL;
-+ rv = ss->load_super(st, fd, &sbp, NULL);
-+ if (rv == 0) {
-+ struct mdinfo info;
-+ ss->getinfo_super(&info, sbp);
-+ if (bestsuper == -1 ||
-+ besttime < info.array.ctime) {
-+ bestsuper = i;
-+ besttime = info.array.ctime;
-+ }
-+ free(sbp);
-+ }
-+ }
-+ if (bestsuper != -1) {
-+ int rv;
-+ st->ss = NULL;
-+ rv = superlist[bestsuper]->load_super(st, fd, &sbp, NULL);
-+ if (rv == 0) {
-+ free(sbp);
-+ return st;
-+ }
-+ }
-+ free(st);
-+ return NULL;
-+}
-+
-+/* Return size of device in bytes */
-+int get_dev_size(int fd, char *dname, unsigned long long *sizep)
-+{
-+ unsigned long long ldsize;
-+#ifdef BLKGETSIZE64
-+ if (ioctl(fd, BLKGETSIZE64, &ldsize) != 0)
-+#endif
-+ {
-+ unsigned long dsize;
-+ if (ioctl(fd, BLKGETSIZE, &dsize) == 0) {
-+ ldsize = dsize;
-+ ldsize <<= 9;
-+ } else {
-+ if (dname)
-+ fprintf(stderr, Name ": Cannot get size of %s: %s\b",
-+ dname, strerror(errno));
-+ return 0;
-+ }
-+ }
-+ *sizep = ldsize;
-+ return 1;
-+}
---- busybox-1.7.4+gentoo/mdadm/Kbuild 2008-03-01 18:44:05.526713152 -0800
-+++ busybox-1.7.4+gentoo+mdadm/mdadm/Kbuild 2008-03-11 12:19:18.000000000 -0700
-@@ -0,0 +1,9 @@
-+# Makefile for busybox
-+#
-+# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org>
-+#
-+# Licensed under the GPL v2, see the file LICENSE in this tarball.
-+
-+lib-y:=
-+MDADM-y:= config.o util.o dlink.o sha1.o super0.o super1.o mdexamine.o mdassemble.o
-+lib-$(CONFIG_MDADM) += mdadm.o $(MDADM-y)
diff --git a/patches/busybox/1.7.4/1.7.4-mdstart.diff b/patches/busybox/1.7.4/1.7.4-mdstart.diff
deleted file mode 100644
index c6a9d6d..0000000
--- a/patches/busybox/1.7.4/1.7.4-mdstart.diff
+++ /dev/null
@@ -1,122 +0,0 @@
-Forward-port the old mdstart tool from the Gentoo Busybox-1.1.3.
-Only fires the RAID_AUTORUN ioctl on existing /dev/md nodes.
-
-Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
-
-diff -Nuar --exclude '*.orig' busybox-1.7.4/include/applets.h busybox-1.7.4+gentoo/include/applets.h
---- busybox-1.7.4/include/applets.h 2007-09-03 04:48:46.000000000 -0700
-+++ busybox-1.7.4+gentoo/include/applets.h 2008-03-11 10:25:43.000000000 -0700
-@@ -222,6 +222,7 @@
- USE_MATCHPATHCON(APPLET(matchpathcon, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
- USE_MD5SUM(APPLET_ODDNAME(md5sum, md5_sha1_sum, _BB_DIR_USR_BIN, _BB_SUID_NEVER, md5sum))
- USE_MDEV(APPLET(mdev, _BB_DIR_SBIN, _BB_SUID_NEVER))
-+USE_MDSTART(APPLET(mdstart, _BB_DIR_SBIN, _BB_SUID_NEVER))
- USE_MESG(APPLET(mesg, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
- USE_MKDIR(APPLET_NOFORK(mkdir, mkdir, _BB_DIR_BIN, _BB_SUID_NEVER, mkdir))
- //USE_MKE2FS(APPLET(mke2fs, _BB_DIR_SBIN, _BB_SUID_NEVER))
-diff -Nuar --exclude '*.orig' busybox-1.7.4/include/usage.h busybox-1.7.4+gentoo/include/usage.h
---- busybox-1.7.4/include/usage.h 2007-09-03 04:48:46.000000000 -0700
-+++ busybox-1.7.4+gentoo/include/usage.h 2008-03-11 10:19:04.000000000 -0700
-@@ -2072,6 +2072,11 @@
- "the last line match .* to override this.)\n\n" \
- )
-
-+#define mdstart_trivial_usage \
-+ "{[PARTITION] MD-NODE}..."
-+#define mdstart_full_usage \
-+ "Run the RAID_AUTORUN ioctl on the given MD number"
-+
- #define mesg_trivial_usage \
- "[y|n]"
- #define mesg_full_usage \
-diff -Nuar --exclude '*.orig' busybox-1.7.4/util-linux/Config.in busybox-1.7.4+gentoo/util-linux/Config.in
---- busybox-1.7.4/util-linux/Config.in 2007-09-03 04:48:56.000000000 -0700
-+++ busybox-1.7.4+gentoo/util-linux/Config.in 2008-03-11 10:26:20.000000000 -0700
-@@ -305,6 +305,13 @@
- /lib/firmware/ and if it exists, send it to the kernel for
- loading into the hardware.
-
-+config MDSTART
-+ bool "mdstart"
-+ default n
-+ help
-+ Allows you to autostart /dev/md devices if using an initramfs to
-+ boot.
-+
- config MKSWAP
- bool "mkswap"
- default n
-diff -Nuar --exclude '*.orig' busybox-1.7.4/util-linux/Kbuild busybox-1.7.4+gentoo/util-linux/Kbuild
---- busybox-1.7.4/util-linux/Kbuild 2007-09-03 04:48:56.000000000 -0700
-+++ busybox-1.7.4+gentoo/util-linux/Kbuild 2008-03-11 10:28:47.000000000 -0700
-@@ -18,6 +18,7 @@
- lib-$(CONFIG_IPCRM) +=ipcrm.o
- lib-$(CONFIG_IPCS) +=ipcs.o
- lib-$(CONFIG_LOSETUP) +=losetup.o
-+lib-$(CONFIG_MDSTART) +=mdStart.o
- lib-$(CONFIG_MDEV) +=mdev.o
- lib-$(CONFIG_MKFS_MINIX) +=mkfs_minix.o
- lib-$(CONFIG_MKSWAP) +=mkswap.o
-diff -Nuar --exclude '*.orig' busybox-1.7.4/util-linux/mdStart.c busybox-1.7.4+gentoo/util-linux/mdStart.c
---- busybox-1.7.4/util-linux/mdStart.c 1969-12-31 16:00:00.000000000 -0800
-+++ busybox-1.7.4+gentoo/util-linux/mdStart.c 2008-03-11 10:19:04.000000000 -0700
-@@ -0,0 +1,59 @@
-+/*
-+ * Linux 2.6(+) RAID Autostarter
-+ *
-+ * Copyright (C) 2005 by Tim Yamin <plasmaroo@gentoo.org> <plasm@roo.me.uk>
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * This program is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-+ *
-+ */
-+
-+#include <sys/types.h>
-+#include <sys/stat.h>
-+#include <fcntl.h>
-+#include <sys/ioctl.h>
-+#include <linux/major.h>
-+#include <linux/raid/md_u.h>
-+
-+extern int
-+mdstart_main(int argc, char *argv[])
-+{
-+ int i, fd, part = 0, retval = 0;
-+
-+ if(argc < 2)
-+ {
-+ bb_show_usage();
-+ }
-+
-+ for(i = 1; i < argc; i++)
-+ {
-+ if(sscanf(argv[i], "%d", &part) == 1)
-+ continue;
-+
-+ fd = open(argv[i], 0, 0);
-+ if (fd >= 0)
-+ {
-+ ioctl(fd, RAID_AUTORUN, part);
-+ close(fd);
-+ } else
-+ {
-+ printf("Error: Failed to open %s!\n", argv[i]);
-+ retval=1;
-+ }
-+
-+ part = 0;
-+ }
-+
-+ return retval;
-+}
diff --git a/patches/busybox/1.7.4/1.7.4-mount-umount-i-option.diff b/patches/busybox/1.7.4/1.7.4-mount-umount-i-option.diff
deleted file mode 100644
index 1c4029e..0000000
--- a/patches/busybox/1.7.4/1.7.4-mount-umount-i-option.diff
+++ /dev/null
@@ -1,24 +0,0 @@
-diff -ru busybox-1.7.4.orig/util-linux/mount.c busybox-1.7.4/util-linux/mount.c
---- busybox-1.7.4.orig/util-linux/mount.c 2007-09-03 06:48:56.000000000 -0500
-+++ busybox-1.7.4/util-linux/mount.c 2008-11-13 21:12:06.000000000 -0600
-@@ -1554,7 +1554,7 @@
-
- // Parse remaining options
-
-- opt = getopt32(argv, "o:t:rwanfvs", &opt_o, &fstype);
-+ opt = getopt32(argv, "o:t:rwanfvsi", &opt_o, &fstype);
- if (opt & 0x1) append_mount_options(&cmdopts, opt_o); // -o
- //if (opt & 0x2) // -t
- if (opt & 0x4) append_mount_options(&cmdopts, "ro"); // -r
-diff -ru busybox-1.7.4.orig/util-linux/umount.c busybox-1.7.4/util-linux/umount.c
---- busybox-1.7.4.orig/util-linux/umount.c 2007-09-03 06:48:56.000000000 -0500
-+++ busybox-1.7.4/util-linux/umount.c 2008-11-13 16:13:03.000000000 -0600
-@@ -12,7 +12,7 @@
- #include <getopt.h>
- #include "libbb.h"
-
--#define OPTION_STRING "flDnravdt:"
-+#define OPTION_STRING "flDnravdt:i"
- #define OPT_FORCE 1
- #define OPT_LAZY 2
- #define OPT_DONTFREELOOP 4
diff --git a/patches/busybox/1.7.4/1.7.4-openvt.diff b/patches/busybox/1.7.4/1.7.4-openvt.diff
deleted file mode 100644
index aa9e77f..0000000
--- a/patches/busybox/1.7.4/1.7.4-openvt.diff
+++ /dev/null
@@ -1,20 +0,0 @@
-Allow a slightly wider range of valid vt numbers. Forward-ported from Gentoo
-Busybox 1.1.3.
-
-The previous spin of this patch on 1.1.3 had a 'wait(NULL);' right before
-return EXIT_SUCCESS. I don't think it's needed anymore, so I left it out.
-
-Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
-
-diff -Nuar --exclude '*.orig' busybox-1.7.4/console-tools/openvt.c busybox-1.7.4+gentoo/console-tools/openvt.c
---- busybox-1.7.4/console-tools/openvt.c 2007-09-03 04:48:35.000000000 -0700
-+++ busybox-1.7.4+gentoo/console-tools/openvt.c 2008-03-10 10:00:55.000000000 -0700
-@@ -21,7 +21,7 @@
- bb_show_usage();
-
- /* check for illegal vt number: < 1 or > 63 */
-- sprintf(vtname, VC_FORMAT, (int)xatou_range(argv[1], 1, 63));
-+ sprintf(vtname, VC_FORMAT, (int)xatou_range(argv[1], 0, 63));
-
- bb_daemonize_or_rexec(DAEMON_CLOSE_EXTRA_FDS, argv);
- /* grab new one */
diff --git a/patches/busybox/1.7.4/1.7.4-static-error.diff b/patches/busybox/1.7.4/1.7.4-static-error.diff
deleted file mode 100644
index 1e3b59c..0000000
--- a/patches/busybox/1.7.4/1.7.4-static-error.diff
+++ /dev/null
@@ -1,23 +0,0 @@
-diff -ur busybox-1.7.4.orig/applets/applets.c busybox-1.7.4/applets/applets.c
---- busybox-1.7.4.orig/applets/applets.c 2007-09-16 13:48:10.000000000 -0500
-+++ busybox-1.7.4/applets/applets.c 2008-03-11 13:53:18.000000000 -0500
-@@ -23,7 +23,6 @@
- #warning Note that glibc is unsuitable for static linking anyway.
- #warning If you still want to do it, remove -Wl,--gc-sections
- #warning from top-level Makefile and remove this warning.
--#error Aborting compilation.
- #endif
-
-
-diff -ur busybox-1.7.4.orig/Makefile busybox-1.7.4/Makefile
---- busybox-1.7.4.orig/Makefile 2007-11-23 22:34:41.000000000 -0600
-+++ busybox-1.7.4/Makefile 2008-03-12 06:35:25.000000000 -0500
-@@ -570,7 +570,7 @@
- quiet_cmd_busybox__ ?= LINK $@
- cmd_busybox__ ?= $(srctree)/scripts/trylink $(CC) $(LDFLAGS) \
- -o $@ -Wl,-Map -Wl,$@.map \
-- -Wl,--warn-common -Wl,--sort-common -Wl,--gc-sections \
-+ -Wl,--warn-common -Wl,--sort-common \
- -Wl,--start-group $(busybox-all) -Wl,--end-group \
- $(LDLIBS)
-
diff --git a/patches/busybox/1.7.4/README b/patches/busybox/1.7.4/README
deleted file mode 100644
index a02e17b..0000000
--- a/patches/busybox/1.7.4/README
+++ /dev/null
@@ -1,23 +0,0 @@
-1.7.4-ash-timeout.diff:
-This patch adds support for the -t option to the 'read' command in ash. It's
-used for prompting for the keymap. It originated with 1.1.3+gentoo or earlier.
-
-1.7.4-mdadm.diff:
-This adds a minimal mdadm implementation to busybox for scanning for and
-activating mdraid arrays. You can blame robbat2 for this one :)
-
-1.7.4-mdstart.diff:
-This adds a 'mdstart' command to busybox, which is used for the activation of
-individual mdraid arrays. It originated with 1.1.3+gentoo or earlier.
-
-1.7.4-openvt.diff:
-It is unknown what problem this patch fixes. It may no longer be needed.
-
-1.7.4-static-error.diff:
-This allows us to build busybox statically, even though upstream frowns upon it.
-It's important that the removal of -Wl,--gc-sections remains, or ash will be
-broken in the resulting busybox. This patch is based on the busybox ebuild.
-
-busybox-1.7.4-signal-hack.patch:
-It is unknown what this patch does. It may no longer be needed.
-
diff --git a/patches/busybox/1.7.4/busybox-1.7.4-signal-hack.patch b/patches/busybox/1.7.4/busybox-1.7.4-signal-hack.patch
deleted file mode 100644
index ba11830..0000000
--- a/patches/busybox/1.7.4/busybox-1.7.4-signal-hack.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-workaround while we get it fixed upstream
-
-http://bugs.gentoo.org/201114
-
---- libbb/u_signal_names.c
-+++ libbb/u_signal_names.c
-@@ -66,7 +66,7 @@
- #ifdef SIGTERM
- [SIGTERM ] = "TERM",
- #endif
--#ifdef SIGSTKFLT
-+#if defined(SIGSTKFLT) && SIGSTKFLT < 32
- [SIGSTKFLT] = "STKFLT",
- #endif
- #ifdef SIGCHLD
-@@ -90,10 +90,10 @
- #ifdef SIGURG
- [SIGURG ] = "URG",
- #endif
--#ifdef SIGXCPU
-+#if defined(SIGXCPU) && SIGXCPU < 32
- [SIGXCPU ] = "XCPU",
- #endif
--#ifdef SIGXFSZ
-+#if defined(SIGXFSZ) && SIGXFSZ < 32
- [SIGXFSZ ] = "XFSZ",
- #endif
- #ifdef SIGVTALRM