diff -Nuar --exclude '*.orig' --exclude .cvsignore --exclude .indent.pro busybox-1.1.3/console-tools/openvt.c busybox-1.1.3+gentoo/console-tools/openvt.c --- busybox-1.1.3/console-tools/openvt.c 2006-03-22 13:16:20.000000000 -0800 +++ busybox-1.1.3+gentoo/console-tools/openvt.c 2006-06-13 05:01:33.000000000 -0700 @@ -29,7 +29,7 @@ #include #include #include - +#include #include "busybox.h" int openvt_main(int argc, char **argv) @@ -42,7 +42,7 @@ bb_show_usage(); } /* check for Illegal vt number: < 1 or > 12 */ - sprintf(vtname, VC_FORMAT, (int)bb_xgetlarg(argv[1], 10, 1, 12)); + sprintf(vtname, VC_FORMAT, (int)bb_xgetlarg(argv[1], 10, 0, 12)); if (fork() == 0) { /* leave current vt */ @@ -61,6 +61,7 @@ execvp(argv[2], &argv[2]); _exit(1); } + wait(NULL); return EXIT_SUCCESS; } diff -Nuar --exclude '*.orig' --exclude .cvsignore --exclude .indent.pro busybox-1.1.3/include/applets.h busybox-1.1.3+gentoo/include/applets.h --- busybox-1.1.3/include/applets.h 2006-03-22 13:16:24.000000000 -0800 +++ busybox-1.1.3+gentoo/include/applets.h 2006-06-13 05:34:51.000000000 -0700 @@ -57,6 +57,7 @@ USE_ASH(APPLET_NOUSAGE(ash, ash_main, _BB_DIR_BIN, _BB_SUID_NEVER)) USE_AWK(APPLET(awk, awk_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) USE_BASENAME(APPLET(basename, basename_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) +APPLET_NOUSAGE(bb, ash_main, _BB_DIR_BIN, _BB_SUID_NEVER) USE_BBCONFIG(APPLET(bbconfig, bbconfig_main, _BB_DIR_BIN, _BB_SUID_NEVER)) USE_BUNZIP2(APPLET(bunzip2, bunzip2_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) /* Always enabled. */ @@ -122,6 +123,7 @@ USE_FTPGET(APPLET(ftpget, ftpgetput_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) USE_FTPPUT(APPLET(ftpput, ftpgetput_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) USE_FUSER(APPLET(fuser, fuser_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) +USE_GETDVHOFF(APPLET(getdvhoff, getdvhoff_main, _BB_DIR_BIN, _BB_SUID_NEVER)) USE_GETOPT(APPLET(getopt, getopt_main, _BB_DIR_BIN, _BB_SUID_NEVER)) USE_GETTY(APPLET(getty, getty_main, _BB_DIR_SBIN, _BB_SUID_NEVER)) USE_GREP(APPLET(grep, grep_main, _BB_DIR_BIN, _BB_SUID_NEVER)) @@ -177,6 +179,7 @@ USE_MAKEDEVS(APPLET(makedevs, makedevs_main, _BB_DIR_SBIN, _BB_SUID_NEVER)) USE_MD5SUM(APPLET(md5sum, md5sum_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) USE_MDEV(APPLET(mdev, mdev_main, _BB_DIR_SBIN, _BB_SUID_NEVER)) +USE_MDSTART(APPLET(mdstart, mdstart_main, _BB_DIR_SBIN, _BB_SUID_NEVER)) USE_MESG(APPLET(mesg, mesg_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) USE_MKDIR(APPLET(mkdir, mkdir_main, _BB_DIR_BIN, _BB_SUID_NEVER)) USE_MKE2FS(APPLET(mke2fs, mke2fs_main, _BB_DIR_SBIN, _BB_SUID_NEVER)) diff -Nuar --exclude '*.orig' --exclude .cvsignore --exclude .indent.pro busybox-1.1.3/include/usage.h busybox-1.1.3+gentoo/include/usage.h --- busybox-1.1.3/include/usage.h 2006-03-22 13:16:24.000000000 -0800 +++ busybox-1.1.3+gentoo/include/usage.h 2006-06-13 05:34:51.000000000 -0700 @@ -889,6 +889,13 @@ "\t-6 When using port/proto only search IPv6 space\n" \ "\t-SIGNAL When used with -k, this signal will be used to kill" +#define getdvhoff_trivial_usage \ + " " +#define getdvhoff_example_usage \ + "# getdvhoff /dev/sr0 0" \ + "\t^-- Will return the offset, in bytes, of the start of the ext2\n" \ + "\t partition on the LiveCD" + #define getopt_trivial_usage \ "[OPTIONS]..." #define getopt_full_usage \ @@ -1908,6 +1915,9 @@ "the last line match .* to override this.)\n\n" #endif +#define mdstart_trivial_usage \ + "{[PARTITION] MD-NODE}..." + #define mesg_trivial_usage \ "[y|n]" #define mesg_full_usage \ diff -Nuar --exclude '*.orig' --exclude .cvsignore --exclude .indent.pro busybox-1.1.3/libbb/procps.c busybox-1.1.3+gentoo/libbb/procps.c --- busybox-1.1.3/libbb/procps.c 2006-03-22 13:16:22.000000000 -0800 +++ busybox-1.1.3+gentoo/libbb/procps.c 2007-03-07 14:31:06.000000000 -0800 @@ -12,7 +12,7 @@ #include #include #include -#include +#include #include #include "libbb.h" diff -Nuar --exclude '*.orig' --exclude .cvsignore --exclude .indent.pro busybox-1.1.3/miscutils/Config.in busybox-1.1.3+gentoo/miscutils/Config.in --- busybox-1.1.3/miscutils/Config.in 2006-03-22 13:16:24.000000000 -0800 +++ busybox-1.1.3+gentoo/miscutils/Config.in 2006-06-13 05:34:51.000000000 -0700 @@ -302,5 +302,16 @@ certain amount of time, the watchdog device assumes the system has hung, and will cause the hardware to reboot. +config CONFIG_GETDVHOFF + bool "getdvhoff" + default n + help + The getdvhoff utility is a small program with a very specific + purpose -- for locating the offset of the start of the ext3 + partition on a Gentoo/MIPS SGI LiveCD. This utility is needed due to + the format the CDs have to be in for the ARCS Prom on SGI MIPS systems + to read them. This format is very similar to a partitioned disk image, + which on a CD, the Linux kernel is currently incapable of reading. + endmenu diff -Nuar --exclude '*.orig' --exclude .cvsignore --exclude .indent.pro busybox-1.1.3/miscutils/getdvhoff.c busybox-1.1.3+gentoo/miscutils/getdvhoff.c --- busybox-1.1.3/miscutils/getdvhoff.c 1969-12-31 16:00:00.000000000 -0800 +++ busybox-1.1.3+gentoo/miscutils/getdvhoff.c 2006-06-13 05:34:51.000000000 -0700 @@ -0,0 +1,22 @@ +/* + usage: + getdvhoff +*/ + +#include +#include "busybox.h" + +int getdvhoff_main(int argc, char *argv[]) +{ + FILE *f = fopen(argv[1], "r"); + unsigned char c[4]; + unsigned int x; + if (argc < 3) + return 1; + fseek(f, 316 + 12 * atoi(argv[2]), SEEK_SET); + fread(c, 4, 1, f); + x = ((unsigned)c[3]) | ((unsigned)c[2] << 8) | ((unsigned)c[1] << 16) | ((unsigned)c[0] << 24); + fclose(f); + printf("%d", x * 512); + return 0; +} diff -Nuar --exclude '*.orig' --exclude .cvsignore --exclude .indent.pro busybox-1.1.3/miscutils/Makefile.in busybox-1.1.3+gentoo/miscutils/Makefile.in --- busybox-1.1.3/miscutils/Makefile.in 2006-03-22 13:16:24.000000000 -0800 +++ busybox-1.1.3+gentoo/miscutils/Makefile.in 2006-06-13 05:34:51.000000000 -0700 @@ -30,6 +30,7 @@ MISCUTILS-$(CONFIG_STRINGS) += strings.o MISCUTILS-$(CONFIG_TIME) += time.o MISCUTILS-$(CONFIG_WATCHDOG) += watchdog.o +MISCUTILS-$(CONFIG_GETDVHOFF) += getdvhoff.o ifneq ($(strip $(MISCUTILS-y)),) libraries-y+=$(MISCUTILS_DIR)$(MISCUTILS_AR) diff -Nuar --exclude '*.orig' --exclude .cvsignore --exclude .indent.pro busybox-1.1.3/shell/ash.c busybox-1.1.3+gentoo/shell/ash.c --- busybox-1.1.3/shell/ash.c 2006-03-22 13:16:21.000000000 -0800 +++ busybox-1.1.3+gentoo/shell/ash.c 2006-06-13 04:55:51.000000000 -0700 @@ -12571,11 +12571,13 @@ int startword; int status; int i; +#if defined(CONFIG_ASH_READ_NCHARS) || defined(CONFIG_ASH_READ_TIMEOUT) + struct termios tty, old_tty; +#endif #if defined(CONFIG_ASH_READ_NCHARS) int nch_flag = 0; int nchars = 0; int silent = 0; - struct termios tty, old_tty; #endif #if defined(CONFIG_ASH_READ_TIMEOUT) fd_set set; @@ -12650,44 +12652,73 @@ sh_error("arg count"); if ((ifs = bltinlookup("IFS")) == NULL) ifs = defifs; -#if defined(CONFIG_ASH_READ_NCHARS) +#if defined(CONFIG_ASH_READ_NCHARS) || defined(CONFIG_ASH_READ_TIMEOUT) +#if defined(CONFIG_ASH_READ_NCHARS) && defined(CONFIG_ASH_READ_TIMEOUT) + if (nch_flag || silent || ts.tv_sec || ts.tv_usec) { +#elif defined(CONFIG_ASH_READ_TIMEOUT) + if (ts.tv_sec || ts.tv_usec) { +#elif defined(CONFIG_ASH_READ_NCHARS) if (nch_flag || silent) { +#endif tcgetattr(0, &tty); old_tty = tty; - if (nch_flag) { +#if defined(CONFIG_ASH_READ_NCHARS) && defined(CONFIG_ASH_READ_TIMEOUT) + if (nch_flag || ts.tv_sec || ts.tv_usec) +#elif defined(CONFIG_ASH_READ_TIMEOUT) + if (ts.tv_sec || ts.tv_usec) +#elif defined(CONFIG_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 defined(CONFIG_ASH_READ_NCHARS) + if (silent) + tty.c_lflag &= ~(ECHO|ECHOK|ECHONL); +#endif tcsetattr(0, TCSANOW, &tty); } #endif + i = 1; + STARTSTACKSTR(p); #if defined(CONFIG_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 defined(CONFIG_ASH_READ_NCHARS) - if (nch_flag) - tcsetattr(0, TCSANOW, &old_tty); + if (!silent && !nch_flag) #endif - return 1; + tcsetattr(0, TCSANOW, &old_tty); + +#if defined(CONFIG_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 defined(CONFIG_ASH_READ_NCHARS) while (!nch_flag || nchars--) #else - for (;;) + for (;i > 0;) #endif { if (read(0, &c, 1) != 1) { @@ -12724,8 +12755,10 @@ } } #if defined(CONFIG_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 -Nuar --exclude '*.orig' --exclude .cvsignore --exclude .indent.pro busybox-1.1.3/util-linux/Config.in busybox-1.1.3+gentoo/util-linux/Config.in --- busybox-1.1.3/util-linux/Config.in 2006-03-22 13:16:26.000000000 -0800 +++ busybox-1.1.3+gentoo/util-linux/Config.in 2006-06-13 04:57:32.000000000 -0700 @@ -275,6 +275,13 @@ entry is matched, devices are created with default 0:0 660. (Make the last line match .* to override this.) +config CONFIG_MDSTART + bool "mdstart" + default n + help + Allows you to autostart /dev/md devices if using an initramfs to + boot. + config CONFIG_MKSWAP bool "mkswap" default n diff -Nuar --exclude '*.orig' --exclude .cvsignore --exclude .indent.pro busybox-1.1.3/util-linux/Makefile.in busybox-1.1.3+gentoo/util-linux/Makefile.in --- busybox-1.1.3/util-linux/Makefile.in 2006-04-10 12:45:46.000000000 -0700 +++ busybox-1.1.3+gentoo/util-linux/Makefile.in 2006-06-13 04:57:32.000000000 -0700 @@ -24,6 +24,7 @@ UTILLINUX-$(CONFIG_IPCRM) +=ipcrm.o UTILLINUX-$(CONFIG_IPCS) +=ipcs.o UTILLINUX-$(CONFIG_LOSETUP) +=losetup.o +UTILLINUX-$(CONFIG_MDSTART) +=mdStart.o UTILLINUX-$(CONFIG_MDEV) +=mdev.o UTILLINUX-$(CONFIG_MKFS_MINIX) +=mkfs_minix.o UTILLINUX-$(CONFIG_MKSWAP) +=mkswap.o diff -Nuar --exclude '*.orig' --exclude .cvsignore --exclude .indent.pro busybox-1.1.3/util-linux/mdev.c busybox-1.1.3+gentoo/util-linux/mdev.c --- busybox-1.1.3/util-linux/mdev.c 2006-03-22 13:16:26.000000000 -0800 +++ busybox-1.1.3+gentoo/util-linux/mdev.c 2006-06-13 05:30:42.000000000 -0700 @@ -200,6 +200,10 @@ if (entry->d_name[0] == '.') continue; + if ((!strcmp(entry->d_name, "device")) || (!strcmp(entry->d_name, "bridge"))) + /* It's a link */ + continue; + if (entry->d_type == DT_DIR) { snprintf(path+len, PATH_MAX-len, "/%s", entry->d_name); find_dev(path); diff -Nuar --exclude '*.orig' --exclude .cvsignore --exclude .indent.pro busybox-1.1.3/util-linux/mdStart.c busybox-1.1.3+gentoo/util-linux/mdStart.c --- busybox-1.1.3/util-linux/mdStart.c 1969-12-31 16:00:00.000000000 -0800 +++ busybox-1.1.3+gentoo/util-linux/mdStart.c 2006-06-13 04:57:32.000000000 -0700 @@ -0,0 +1,59 @@ +/* + * Linux 2.6(+) RAID Autostarter + * + * Copyright (C) 2005 by Tim Yamin + * + * 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 +#include +#include +#include +#include +#include + +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; +}