summaryrefslogtreecommitdiffstats
path: root/package
diff options
context:
space:
mode:
Diffstat (limited to 'package')
-rw-r--r--package/Config.in1
-rw-r--r--package/busybox/busybox-1.16.1-sed.patch47
-rw-r--r--package/busybox/initramfs.mk141
-rw-r--r--package/cramfs/cramfs.mk8
-rw-r--r--package/makedevs/Config.in5
-rw-r--r--package/makedevs/makedevs.c535
-rw-r--r--package/makedevs/makedevs.mk35
-rw-r--r--package/mtd/Config.in4
-rw-r--r--package/portage/Config.in4
-rw-r--r--package/python/Config.in4
10 files changed, 639 insertions, 145 deletions
diff --git a/package/Config.in b/package/Config.in
index 610490342..a4ef36261 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -175,6 +175,7 @@ source "package/input-tools/Config.in"
source "package/iostat/Config.in"
source "package/lm-sensors/Config.in"
source "package/lvm2/Config.in"
+source "package/makedevs/Config.in"
source "package/mdadm/Config.in"
source "package/memtester/Config.in"
source "package/mtd/Config.in"
diff --git a/package/busybox/busybox-1.16.1-sed.patch b/package/busybox/busybox-1.16.1-sed.patch
new file mode 100644
index 000000000..56d2304d2
--- /dev/null
+++ b/package/busybox/busybox-1.16.1-sed.patch
@@ -0,0 +1,47 @@
+diff -urpN busybox-1.16.1/editors/sed.c busybox-1.16.1-sed/editors/sed.c
+--- busybox-1.16.1/editors/sed.c 2010-03-28 13:43:35.000000000 -0400
++++ busybox-1.16.1-sed/editors/sed.c 2010-04-20 13:33:26.301975462 -0400
+@@ -936,7 +936,15 @@ static void process_files(void)
+ /* Skip blocks of commands we didn't match */
+ if (sed_cmd->cmd == '{') {
+ if (sed_cmd->invert ? matched : !matched) {
+- while (sed_cmd->cmd != '}') {
++ unsigned nest_cnt = 0;
++ while (1) {
++ if (sed_cmd->cmd == '{')
++ nest_cnt++;
++ if (sed_cmd->cmd == '}') {
++ nest_cnt--;
++ if (nest_cnt == 0)
++ break;
++ }
+ sed_cmd = sed_cmd->next;
+ if (!sed_cmd)
+ bb_error_msg_and_die("unterminated {");
+@@ -1031,7 +1039,7 @@ static void process_files(void)
+ case 'c':
+ /* Only triggers on last line of a matching range. */
+ if (!sed_cmd->in_match)
+- sed_puts(sed_cmd->string, NO_EOL_CHAR);
++ sed_puts(sed_cmd->string, '\n');
+ goto discard_line;
+
+ /* Read file, append contents to output */
+diff -urpN busybox-1.16.1/testsuite/sed.tests busybox-1.16.1-sed/testsuite/sed.tests
+--- busybox-1.16.1/testsuite/sed.tests 2010-03-19 22:58:07.000000000 -0400
++++ busybox-1.16.1-sed/testsuite/sed.tests 2010-04-20 13:33:26.301975462 -0400
+@@ -248,4 +248,14 @@ testing "sed beginning (^) matches only
+ ">/usr</>lib<\n" "" \
+ "/usr/lib\n"
+
++testing "sed c" \
++ "sed 'crepl'" \
++ "repl\nrepl\n" "" \
++ "first\nsecond\n"
++
++testing "sed nested {}s" \
++ "sed '/asd/ { p; /s/ { s/s/c/ }; p; q }'" \
++ "qwe\nasd\nacd\nacd\n" "" \
++ "qwe\nasd\nzxc\n"
++
+ exit $FAILCOUNT
diff --git a/package/busybox/initramfs.mk b/package/busybox/initramfs.mk
deleted file mode 100644
index 2f1e34cdc..000000000
--- a/package/busybox/initramfs.mk
+++ /dev/null
@@ -1,141 +0,0 @@
-#############################################################
-#
-# busybox image for initramfs
-#
-#############################################################
-ifeq ($(BR2_PACKAGE_BUSYBOX_INITRAMFS),y)
-
-BUSYBOX_INITRAMFS_DIR:=$(BUSYBOX_DIR)-initramfs
-BR2_INITRAMFS_DIR:=$(BUILD_DIR)/initramfs
-BB_INITRAMFS_TARGET:=rootfs.initramfs_lst
-
-$(BUSYBOX_INITRAMFS_DIR)/.unpacked: $(DL_DIR)/$(BUSYBOX_SOURCE)
- rm -rf $(BUILD_DIR)/tmp $(BUSYBOX_INITRAMFS_DIR)
- mkdir -p $(BUILD_DIR)/tmp
- $(BUSYBOX_UNZIP) $(DL_DIR)/$(BUSYBOX_SOURCE) | tar -C $(BUILD_DIR)/tmp $(TAR_OPTIONS) -
-ifeq ($(BR2_PACKAGE_BUSYBOX_SNAPSHOT),y)
- mv $(BUILD_DIR)/tmp/busybox $(BUSYBOX_INITRAMFS_DIR)
-else
- mv $(BUILD_DIR)/tmp/busybox-$(BUSYBOX_VERSION) $(BUSYBOX_INITRAMFS_DIR)
-endif
- touch $@
-
-$(BUSYBOX_INITRAMFS_DIR)/.config $(BUSYBOX_INITRAMFS_DIR)/.configured: $(BUSYBOX_INITRAMFS_DIR)/.unpacked
- $(MAKE) CC=$(TARGET_CC) CROSS_COMPILE="$(TARGET_CROSS)" \
- CROSS="$(TARGET_CROSS)" -C $(BUSYBOX_INITRAMFS_DIR) \
- allnoconfig
- mv $(BUSYBOX_INITRAMFS_DIR)/.config $(BUSYBOX_INITRAMFS_DIR)/.config.no
- (echo CONFIG_PREFIX=\"$(BR2_INITRAMFS_DIR)\"; \
- echo CONFIG_NITPICK=y; \
- echo CONFIG_FEATURE_BUFFERS_USE_MALLOC=y; \
- echo CONFIG_INCLUDE_SUSv2=n; \
- echo CONFIG_CAT=y; \
- echo CONFIG_CHROOT=y; \
- echo CONFIG_DD=y; \
- echo CONFIG_FEATURE_DD_IBS_OBS=y; \
- echo CONFIG_FALSE=y; \
- echo CONFIG_GUNZIP=y; \
- echo CONFIG_HALT=y; \
- echo CONFIG_INIT=y; \
- echo CONFIG_INSMOD=y; \
- echo CONFIG_KILL=y; \
- echo CONFIG_LN=y; \
- echo CONFIG_MDEV=y; \
- echo CONFIG_MKDIR=y; \
- echo CONFIG_MKFIFO=y; \
- echo CONFIG_MKNOD=y; \
- echo CONFIG_MODPROBE=y; \
- echo CONFIG_FEATURE_MODPROBE_MULTIPLE_OPTIONS=y; \
- echo CONFIG_FEATURE_MODPROBE_FANCY_ALIAS=y; \
- echo CONFIG_FEATURE_CHECK_TAINTED_MODULE=n; \
- echo CONFIG_FEATURE_2_4_MODULES=n; \
- echo CONFIG_MOUNT=y; \
- echo CONFIG_MSH=y; \
- echo CONFIG_FEATURE_SH_IS_MSH=y; \
- echo CONFIG_PS=y; \
- echo CONFIG_READLINK=y; \
- echo CONFIG_RMMOD=y; \
- echo CONFIG_STATIC=y; \
- echo CONFIG_SWITCH_ROOT=y; \
- echo CONFIG_SYNC=y; \
- echo CONFIG_TFTP=y; \
- echo CONFIG_FEATURE_TFTP_GET=y; \
- echo CONFIG_FEATURE_TFTP_PUT=y; \
- echo CONFIG_TRUE=y; \
- echo CONFIG_UMOUNT=y; \
- echo CONFIG_FEATURE_UMOUNT_ALL=y; \
- echo CONFIG_UNAME=y; \
- ) > $(BUSYBOX_INITRAMFS_DIR)/.config
- cp -f $(BUSYBOX_INITRAMFS_DIR)/.config \
- $(BUSYBOX_INITRAMFS_DIR)/.config.prune
- $(SED) 's|\([^=]*\)=.*|/\1[^_]*/d|g' \
- $(BUSYBOX_INITRAMFS_DIR)/.config.prune
- $(SED) '' -f $(BUSYBOX_INITRAMFS_DIR)/.config.prune \
- $(BUSYBOX_INITRAMFS_DIR)/.config.no
- cat $(BUSYBOX_INITRAMFS_DIR)/.config.no >> \
- $(BUSYBOX_INITRAMFS_DIR)/.config
- yes "" | $(MAKE) CC=$(TARGET_CC) CROSS_COMPILE="$(TARGET_CROSS)" \
- CROSS="$(TARGET_CROSS)" -C $(BUSYBOX_INITRAMFS_DIR) \
- oldconfig
- touch $@
-
-
-$(BUSYBOX_INITRAMFS_DIR)/busybox: $(BUSYBOX_INITRAMFS_DIR)/.configured
- $(MAKE) CC=$(TARGET_CC) CROSS_COMPILE="$(TARGET_CROSS)" \
- CROSS="$(TARGET_CROSS)" PREFIX="$(TARGET_DIR)" \
- ARCH=$(KERNEL_ARCH) \
- EXTRA_CFLAGS="$(TARGET_CFLAGS)" -C $(BUSYBOX_INITRAMFS_DIR) \
- busybox.links busybox
-
-$(BR2_INITRAMFS_DIR)/bin/busybox: $(BUSYBOX_INITRAMFS_DIR)/busybox
- $(MAKE) CC=$(TARGET_CC) CROSS_COMPILE="$(TARGET_CROSS)" \
- CROSS="$(TARGET_CROSS)" \
- ARCH=$(KERNEL_ARCH) STRIP="$(STRIPCMD)" \
- EXTRA_CFLAGS="$(TARGET_CFLAGS)" -C $(BUSYBOX_INITRAMFS_DIR) \
- install
- $(STRIPCMD) $(STRIP_STRIP_ALL) $@
-
-
-$(BB_INITRAMFS_TARGET): host-fakeroot $(BR2_INITRAMFS_DIR)/bin/busybox
- ln -fs bin/busybox $(BUILD_DIR)/initramfs/init
- mkdir -p $(BUILD_DIR)/initramfs/etc
- cat target/generic/target_busybox_skeleton/etc/inittab > \
- $(BUILD_DIR)/initramfs/etc/inittab
- rm -f $(BUILD_DIR)/_fakeroot.$(notdir $(BB_INITRAMFS_TARGET))
- (echo "chown -R 0:0 $(BUILD_DIR)/initramfs"; \
- echo "$(HOST_DIR)/usr/bin/makedevs -d $(TARGET_DEVICE_TABLE) $(BUILD_DIR)/initramfs"; \
- echo "$(SHELL) target/initramfs/gen_initramfs_list.sh -u 0 -g 0 $(BUILD_DIR)/initramfs > $(BB_INITRAMFS_TARGET)"; \
- ) > $(BUILD_DIR)/_fakeroot.$(notdir $(BB_INITRAMFS_TARGET))
- chmod +x $(BUILD_DIR)/_fakeroot.$(notdir $(BB_INITRAMFS_TARGET))
- $(HOST_DIR)/usr/bin/fakeroot -- \
- $(BUILD_DIR)/_fakeroot.$(notdir $(BB_INITRAMFS_TARGET))
- rm -f $(BUILD_DIR)/_fakeroot.$(notdir $(BB_INITRAMFS_TARGET))
- touch -c $@
-
-$(BUILD_DIR)/.initramfs_done: $(BR2_INITRAMFS_DIR)/bin/busybox \
- $(BB_INITRAMFS_TARGET)
- touch $@
-
-busybox-initramfs-source:
-busybox-initramfs: $(BUILD_DIR)/.initramfs_done
-
-busybox-initramfs-menuconfig: host-sed $(BUILD_DIR) busybox-source $(BUSYBOX_INITRAMFS_DIR)/.configured
- $(MAKE) __TARGET_ARCH=$(ARCH) -C $(BUSYBOX_INITRAMFS_DIR) menuconfig
-
-busybox-initramfs-clean:
- rm -f $(BUSYBOX_INITRAMFS_DIR)/busybox $(BUILD_DIR)/.initramfs_*
- rm -rf $(BR2_INITRAMFS_DIR) $(BB_INITRAMFS_TARGET)
- -$(MAKE) -C $(BUSYBOX_INITRAMFS_DIR) clean
-
-busybox-initramfs-dirclean:
- rm -rf $(BUSYBOX_INITRAMFS_DIR) $(BR2_INITRAMFS_DIR) \
- $(BUILD_DIR)/.initramfs_*
-endif
-#############################################################
-#
-# Toplevel Makefile options
-#
-#############################################################
-ifeq ($(BR2_PACKAGE_BUSYBOX_INITRAMFS),y)
-TARGETS+=busybox-initramfs
-endif
diff --git a/package/cramfs/cramfs.mk b/package/cramfs/cramfs.mk
index 7b1924e81..9073ae542 100644
--- a/package/cramfs/cramfs.mk
+++ b/package/cramfs/cramfs.mk
@@ -16,8 +16,8 @@ define CRAMFS_BUILD_CMDS
endef
define CRAMFS_INSTALL_TARGET_CMDS
- install -m 755 $(@D)/mkcramfs $(TARGET_DIR)/usr/bin
- install -m 755 $(@D)/cramfsck $(TARGET_DIR)/usr/bin
+ install -D -m 755 $(@D)/mkcramfs $(TARGET_DIR)/usr/bin/mkcramfs
+ install -D -m 755 $(@D)/cramfsck $(TARGET_DIR)/usr/bin/cramfsck
endef
define HOST_CRAMFS_BUILD_CMDS
@@ -25,8 +25,8 @@ define HOST_CRAMFS_BUILD_CMDS
endef
define HOST_CRAMFS_INSTALL_CMDS
- install -m 755 $(@D)/mkcramfs $(HOST_DIR)/usr/bin
- install -m 755 $(@D)/cramfsck $(HOST_DIR)/usr/bin
+ install -D -m 755 $(@D)/mkcramfs $(HOST_DIR)/usr/bin/mkcramfs
+ install -D -m 755 $(@D)/cramfsck $(HOST_DIR)/usr/bin/cramfsck
endef
$(eval $(call GENTARGETS,package,cramfs))
diff --git a/package/makedevs/Config.in b/package/makedevs/Config.in
new file mode 100644
index 000000000..4f8c38d0a
--- /dev/null
+++ b/package/makedevs/Config.in
@@ -0,0 +1,5 @@
+config BR2_PACKAGE_MAKEDEVS
+ bool "makedevs"
+ help
+ The makedevs utility allows to create a set of device files
+ according to a configuration file. \ No newline at end of file
diff --git a/package/makedevs/makedevs.c b/package/makedevs/makedevs.c
new file mode 100644
index 000000000..5ca45e9ae
--- /dev/null
+++ b/package/makedevs/makedevs.c
@@ -0,0 +1,535 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library 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.
+ *
+ */
+
+#define _GNU_SOURCE
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <fcntl.h>
+#include <getopt.h>
+#include <time.h>
+#include <pwd.h>
+#include <grp.h>
+#include <unistd.h>
+#include <ctype.h>
+#include <errno.h>
+#include <libgen.h>
+#include <stdarg.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#ifndef __APPLE__
+#include <sys/sysmacros.h> /* major() and minor() */
+#endif
+
+const char *bb_applet_name;
+
+void bb_verror_msg(const char *s, va_list p)
+{
+ fflush(stdout);
+ fprintf(stderr, "%s: ", bb_applet_name);
+ vfprintf(stderr, s, p);
+}
+
+void bb_error_msg(const char *s, ...)
+{
+ va_list p;
+
+ va_start(p, s);
+ bb_verror_msg(s, p);
+ va_end(p);
+ putc('\n', stderr);
+}
+
+void bb_error_msg_and_die(const char *s, ...)
+{
+ va_list p;
+
+ va_start(p, s);
+ bb_verror_msg(s, p);
+ va_end(p);
+ putc('\n', stderr);
+ exit(1);
+}
+
+void bb_vperror_msg(const char *s, va_list p)
+{
+ int err=errno;
+ if(s == 0) s = "";
+ bb_verror_msg(s, p);
+ if (*s) s = ": ";
+ fprintf(stderr, "%s%s\n", s, strerror(err));
+}
+
+void bb_perror_msg(const char *s, ...)
+{
+ va_list p;
+
+ va_start(p, s);
+ bb_vperror_msg(s, p);
+ va_end(p);
+}
+
+void bb_perror_msg_and_die(const char *s, ...)
+{
+ va_list p;
+
+ va_start(p, s);
+ bb_vperror_msg(s, p);
+ va_end(p);
+ exit(1);
+}
+
+FILE *bb_xfopen(const char *path, const char *mode)
+{
+ FILE *fp;
+ if ((fp = fopen(path, mode)) == NULL)
+ bb_perror_msg_and_die("%s", path);
+ return fp;
+}
+
+enum {
+ FILEUTILS_PRESERVE_STATUS = 1,
+ FILEUTILS_DEREFERENCE = 2,
+ FILEUTILS_RECUR = 4,
+ FILEUTILS_FORCE = 8,
+ FILEUTILS_INTERACTIVE = 16
+};
+int bb_make_directory (char *path, long mode, int flags)
+{
+ mode_t mask;
+ const char *fail_msg;
+ char *s = path;
+ char c;
+ struct stat st;
+
+ mask = umask(0);
+ if (mode == -1) {
+ umask(mask);
+ mode = (S_IXUSR | S_IXGRP | S_IXOTH |
+ S_IWUSR | S_IWGRP | S_IWOTH |
+ S_IRUSR | S_IRGRP | S_IROTH) & ~mask;
+ } else {
+ umask(mask & ~0300);
+ }
+
+ do {
+ c = 0;
+
+ if (flags & FILEUTILS_RECUR) { /* Get the parent. */
+ /* Bypass leading non-'/'s and then subsequent '/'s. */
+ while (*s) {
+ if (*s == '/') {
+ do {
+ ++s;
+ } while (*s == '/');
+ c = *s; /* Save the current char */
+ *s = 0; /* and replace it with nul. */
+ break;
+ }
+ ++s;
+ }
+ }
+
+ if (mkdir(path, 0777) < 0) {
+ /* If we failed for any other reason than the directory
+ * already exists, output a diagnostic and return -1.*/
+ if ((errno != EEXIST && errno != EISDIR)
+ || !(flags & FILEUTILS_RECUR)
+ || (stat(path, &st) < 0 || !S_ISDIR(st.st_mode))) {
+ fail_msg = "create";
+ umask(mask);
+ break;
+ }
+ /* Since the directory exists, don't attempt to change
+ * permissions if it was the full target. Note that
+ * this is not an error conditon. */
+ if (!c) {
+ umask(mask);
+ return 0;
+ }
+ }
+
+ if (!c) {
+ /* Done. If necessary, updated perms on the newly
+ * created directory. Failure to update here _is_
+ * an error.*/
+ umask(mask);
+ if ((mode != -1) && (chmod(path, mode) < 0)){
+ fail_msg = "set permissions of";
+ break;
+ }
+ return 0;
+ }
+
+ /* Remove any inserted nul from the path (recursive mode). */
+ *s = c;
+
+ } while (1);
+
+ bb_perror_msg ("Cannot %s directory `%s'", fail_msg, path);
+ return -1;
+}
+
+const char * const bb_msg_memory_exhausted = "memory exhausted";
+
+void *xmalloc(size_t size)
+{
+ void *ptr = malloc(size);
+ if (ptr == NULL && size != 0)
+ bb_error_msg_and_die(bb_msg_memory_exhausted);
+ return ptr;
+}
+
+void *xcalloc(size_t nmemb, size_t size)
+{
+ void *ptr = calloc(nmemb, size);
+ if (ptr == NULL && nmemb != 0 && size != 0)
+ bb_error_msg_and_die(bb_msg_memory_exhausted);
+ return ptr;
+}
+
+void *xrealloc(void *ptr, size_t size)
+{
+ ptr = realloc(ptr, size);
+ if (ptr == NULL && size != 0)
+ bb_error_msg_and_die(bb_msg_memory_exhausted);
+ return ptr;
+}
+
+char *private_get_line_from_file(FILE *file, int c)
+{
+#define GROWBY (80) /* how large we will grow strings by */
+
+ int ch;
+ int idx = 0;
+ char *linebuf = NULL;
+ int linebufsz = 0;
+
+ while ((ch = getc(file)) != EOF) {
+ /* grow the line buffer as necessary */
+ if (idx > linebufsz - 2) {
+ linebuf = xrealloc(linebuf, linebufsz += GROWBY);
+ }
+ linebuf[idx++] = (char)ch;
+ if (!ch) return linebuf;
+ if (c<2 && ch == '\n') {
+ if (c) {
+ --idx;
+ }
+ break;
+ }
+ }
+ if (linebuf) {
+ if (ferror(file)) {
+ free(linebuf);
+ return NULL;
+ }
+ linebuf[idx] = 0;
+ }
+ return linebuf;
+}
+
+char *bb_get_chomped_line_from_file(FILE *file)
+{
+ return private_get_line_from_file(file, 1);
+}
+
+long my_getpwnam(const char *name)
+{
+ struct passwd *myuser;
+
+ myuser = getpwnam(name);
+ if (myuser==NULL)
+ bb_error_msg_and_die("unknown user name: %s", name);
+
+ return myuser->pw_uid;
+}
+
+long my_getgrnam(const char *name)
+{
+ struct group *mygroup;
+
+ mygroup = getgrnam(name);
+ if (mygroup==NULL)
+ bb_error_msg_and_die("unknown group name: %s", name);
+
+ return (mygroup->gr_gid);
+}
+
+unsigned long get_ug_id(const char *s, long (*my_getxxnam)(const char *))
+{
+ unsigned long r;
+ char *p;
+
+ r = strtoul(s, &p, 10);
+ if (*p || (s == p)) {
+ r = my_getxxnam(s);
+ }
+
+ return r;
+}
+
+char * last_char_is(const char *s, int c)
+{
+ char *sret = (char *)s;
+ if (sret) {
+ sret = strrchr(sret, c);
+ if(sret != NULL && *(sret+1) != 0)
+ sret = NULL;
+ }
+ return sret;
+}
+
+void bb_xasprintf(char **string_ptr, const char *format, ...)
+{
+ va_list p;
+ int r;
+
+ va_start(p, format);
+ r = vasprintf(string_ptr, format, p);
+ va_end(p);
+
+ if (r < 0) {
+ bb_perror_msg_and_die("bb_xasprintf");
+ }
+}
+
+char *concat_path_file(const char *path, const char *filename)
+{
+ char *outbuf;
+ char *lc;
+
+ if (!path)
+ path = "";
+ lc = last_char_is(path, '/');
+ while (*filename == '/')
+ filename++;
+ bb_xasprintf(&outbuf, "%s%s%s", path, (lc==NULL ? "/" : ""), filename);
+
+ return outbuf;
+}
+
+void bb_show_usage(void)
+{
+ fprintf(stderr, "%s: [-d device_table] rootdir\n\n", bb_applet_name);
+ fprintf(stderr, "Creates a batch of special files as specified in a device table.\n");
+ fprintf(stderr, "Device table entries take the form of:\n");
+ fprintf(stderr, "type mode user group major minor start increment count\n\n");
+ fprintf(stderr, "Where name is the file name, type can be one of:\n");
+ fprintf(stderr, " f A regular file\n");
+ fprintf(stderr, " d Directory\n");
+ fprintf(stderr, " c Character special device file\n");
+ fprintf(stderr, " b Block special device file\n");
+ fprintf(stderr, " p Fifo (named pipe)\n");
+ fprintf(stderr, "uid is the user id for the target file, gid is the group id for the\n");
+ fprintf(stderr, "target file. The rest of the entries (major, minor, etc) apply to\n");
+ fprintf(stderr, "to device special files. A '-' may be used for blank entries.\n\n");
+ fprintf(stderr, "For example:\n");
+ fprintf(stderr, "<name> <type> <mode> <uid> <gid> <major> <minor> <start> <inc> <count>\n");
+ fprintf(stderr, "/dev d 755 0 0 - - - - -\n");
+ fprintf(stderr, "/dev/console c 666 0 0 5 1 - - -\n");
+ fprintf(stderr, "/dev/null c 666 0 0 1 3 0 0 -\n");
+ fprintf(stderr, "/dev/zero c 666 0 0 1 5 0 0 -\n");
+ fprintf(stderr, "/dev/hda b 640 0 0 3 0 0 0 -\n");
+ fprintf(stderr, "/dev/hda b 640 0 0 3 1 1 1 15\n\n");
+ fprintf(stderr, "Will Produce:\n");
+ fprintf(stderr, "/dev\n");
+ fprintf(stderr, "/dev/console\n");
+ fprintf(stderr, "/dev/null\n");
+ fprintf(stderr, "/dev/zero\n");
+ fprintf(stderr, "/dev/hda\n");
+ fprintf(stderr, "/dev/hda[0-15]\n");
+ exit(1);
+}
+
+int main(int argc, char **argv)
+{
+ int opt;
+ FILE *table = stdin;
+ char *rootdir = NULL;
+ char *line = NULL;
+ int linenum = 0;
+ int ret = EXIT_SUCCESS;
+
+ bb_applet_name = basename(argv[0]);
+
+ while ((opt = getopt(argc, argv, "d:")) != -1) {
+ switch(opt) {
+ case 'd':
+ table = bb_xfopen((line=optarg), "r");
+ break;
+ default:
+ bb_show_usage();
+ }
+ }
+
+ if (optind >= argc || (rootdir=argv[optind])==NULL) {
+ bb_error_msg_and_die("root directory not speficied");
+ }
+
+ if (chdir(rootdir) != 0) {
+ bb_perror_msg_and_die("Couldnt chdir to %s", rootdir);
+ }
+
+ umask(0);
+
+ printf("rootdir=%s\n", rootdir);
+ if (line) {
+ printf("table='%s'\n", line);
+ } else {
+ printf("table=<stdin>\n");
+ }
+
+ while ((line = bb_get_chomped_line_from_file(table))) {
+ char type;
+ unsigned int mode = 0755;
+ unsigned int major = 0;
+ unsigned int minor = 0;
+ unsigned int count = 0;
+ unsigned int increment = 0;
+ unsigned int start = 0;
+ char name[41];
+ char user[41];
+ char group[41];
+ char *full_name;
+ uid_t uid;
+ gid_t gid;
+
+ linenum++;
+
+ if ((2 > sscanf(line, "%40s %c %o %40s %40s %u %u %u %u %u", name,
+ &type, &mode, user, group, &major,
+ &minor, &start, &increment, &count)) ||
+ ((major | minor | start | count | increment) > 255))
+ {
+ if (*line=='\0' || *line=='#' || isspace(*line))
+ continue;
+ bb_error_msg("line %d invalid: '%s'\n", linenum, line);
+ ret = EXIT_FAILURE;
+ continue;
+ }
+ if (name[0] == '#') {
+ continue;
+ }
+ if (*group) {
+ gid = get_ug_id(group, my_getgrnam);
+ } else {
+ gid = getgid();
+ }
+ if (*user) {
+ uid = get_ug_id(user, my_getpwnam);
+ } else {
+ uid = getuid();
+ }
+ full_name = concat_path_file(rootdir, name);
+
+ if (type == 'd') {
+ bb_make_directory(full_name, mode | S_IFDIR, FILEUTILS_RECUR);
+ if (chown(full_name, uid, gid) == -1) {
+ bb_perror_msg("line %d: chown failed for %s", linenum, full_name);
+ ret = EXIT_FAILURE;
+ goto loop;
+ }
+ if ((mode != -1) && (chmod(full_name, mode) < 0)){
+ bb_perror_msg("line %d: chmod failed for %s", linenum, full_name);
+ ret = EXIT_FAILURE;
+ goto loop;
+ }
+ } else if (type == 'f') {
+ struct stat st;
+ if ((stat(full_name, &st) < 0 || !S_ISREG(st.st_mode))) {
+ bb_perror_msg("line %d: regular file '%s' does not exist", linenum, full_name);
+ ret = EXIT_FAILURE;
+ goto loop;
+ }
+ if (chown(full_name, uid, gid) == -1) {
+ bb_perror_msg("line %d: chown failed for %s", linenum, full_name);
+ ret = EXIT_FAILURE;
+ goto loop;
+ }
+ if ((mode != -1) && (chmod(full_name, mode) < 0)){
+ bb_perror_msg("line %d: chmod failed for %s", linenum, full_name);
+ ret = EXIT_FAILURE;
+ goto loop;
+ }
+ } else
+ {
+ dev_t rdev;
+
+ if (type == 'p') {
+ mode |= S_IFIFO;
+ }
+ else if (type == 'c') {
+ mode |= S_IFCHR;
+ }
+ else if (type == 'b') {
+ mode |= S_IFBLK;
+ } else {
+ bb_error_msg("line %d: Unsupported file type %c", linenum, type);
+ ret = EXIT_FAILURE;
+ goto loop;
+ }
+
+ if (count > 0) {
+ int i;
+ char *full_name_inc;
+
+ full_name_inc = xmalloc(strlen(full_name) + 4);
+ for (i = start; i < count; i++) {
+ sprintf(full_name_inc, "%s%d", full_name, i);
+ rdev = makedev(major, minor + (i * increment - start));
+ if (mknod(full_name_inc, mode, rdev) == -1) {
+ bb_perror_msg("line %d: Couldnt create node %s", linenum, full_name_inc);
+ ret = EXIT_FAILURE;
+ }
+ else if (chown(full_name_inc, uid, gid) == -1) {
+ bb_perror_msg("line %d: chown failed for %s", linenum, full_name_inc);
+ ret = EXIT_FAILURE;
+ }
+ if ((mode != -1) && (chmod(full_name_inc, mode) < 0)){
+ bb_perror_msg("line %d: chmod failed for %s", linenum, full_name_inc);
+ ret = EXIT_FAILURE;
+ }
+ }
+ free(full_name_inc);
+ } else {
+ rdev = makedev(major, minor);
+ if (mknod(full_name, mode, rdev) == -1) {
+ bb_perror_msg("line %d: Couldnt create node %s", linenum, full_name);
+ ret = EXIT_FAILURE;
+ }
+ else if (chown(full_name, uid, gid) == -1) {
+ bb_perror_msg("line %d: chown failed for %s", linenum, full_name);
+ ret = EXIT_FAILURE;
+ }
+ if ((mode != -1) && (chmod(full_name, mode) < 0)){
+ bb_perror_msg("line %d: chmod failed for %s", linenum, full_name);
+ ret = EXIT_FAILURE;
+ }
+ }
+ }
+loop:
+ free(line);
+ free(full_name);
+ }
+ fclose(table);
+
+ if (system("/bin/sync"))
+ bb_error_msg("sync failed, continuing anyway");
+
+ return 0;
+}
diff --git a/package/makedevs/makedevs.mk b/package/makedevs/makedevs.mk
new file mode 100644
index 000000000..a3bb5cb54
--- /dev/null
+++ b/package/makedevs/makedevs.mk
@@ -0,0 +1,35 @@
+#############################################################
+#
+# makedevs
+#
+#############################################################
+
+MAKEDEVS_DIR=$(BUILD_DIR)/makedevs
+
+$(MAKEDEVS_DIR)/makedevs.c:
+ rm -rf $(MAKEDEVS_DIR)
+ mkdir $(MAKEDEVS_DIR)
+ cp package/makedevs/makedevs.c $(MAKEDEVS_DIR)
+
+$(MAKEDEVS_DIR)/makedevs: $(MAKEDEVS_DIR)/makedevs.c
+ $(CC) -Wall -Werror -O2 $(MAKEDEVS_DIR)/makedevs.c -o $@
+
+$(TARGET_DIR)/usr/bin/makedevs: $(MAKEDEVS_DIR)/makedevs
+ $(INSTALL) -m 755 $^ $@
+
+makedevs: $(TARGET_DIR)/usr/bin/makedevs
+
+HOST_MAKEDEVS_DIR=$(BUILD_DIR)/host-makedevs
+
+$(HOST_MAKEDEVS_DIR)/makedevs.c:
+ rm -rf $(HOST_MAKEDEVS_DIR)
+ mkdir $(HOST_MAKEDEVS_DIR)
+ cp package/makedevs/makedevs.c $(HOST_MAKEDEVS_DIR)
+
+$(HOST_MAKEDEVS_DIR)/makedevs: $(HOST_MAKEDEVS_DIR)/makedevs.c
+ $(CC) -Wall -Werror -O2 $(HOST_MAKEDEVS_DIR)/makedevs.c -o $@
+
+$(HOST_DIR)/usr/bin/makedevs: $(HOST_MAKEDEVS_DIR)/makedevs
+ $(INSTALL) -m 755 $^ $@
+
+host-makedevs: $(HOST_DIR)/usr/bin/makedevs \ No newline at end of file
diff --git a/package/mtd/Config.in b/package/mtd/Config.in
index 8e846a371..0ba71d333 100644
--- a/package/mtd/Config.in
+++ b/package/mtd/Config.in
@@ -93,6 +93,10 @@ config BR2_PACKAGE_MTD_SERVE_IMAGE
config BR2_PACKAGE_MTD_SUMTOOL
bool "sumtool"
+config BR2_PACKAGE_MTD_MTDINFO
+ bool "mtdinfo"
+ default y
+
config BR2_PACKAGE_MTD_UBIATTACH
bool "ubiattach"
default y
diff --git a/package/portage/Config.in b/package/portage/Config.in
index 27661cd92..83778ff3c 100644
--- a/package/portage/Config.in
+++ b/package/portage/Config.in
@@ -1,7 +1,11 @@
config BR2_PACKAGE_PORTAGE
bool "portage"
select BR2_PACKAGE_PYTHON
+ depends on BR2_USE_WCHAR
help
Portage, the Gentoo package management tool.
http://www.gentoo.org/
+
+comment "portage requires a toolchain with WCHAR support"
+ depends on !BR2_USE_WCHAR
diff --git a/package/python/Config.in b/package/python/Config.in
index 6931eb70f..e77d7aa40 100644
--- a/package/python/Config.in
+++ b/package/python/Config.in
@@ -1,10 +1,14 @@
config BR2_PACKAGE_PYTHON
bool "python"
+ depends on BR2_USE_WCHAR
help
The python language interpreter.
http://www.python.org/
+comment "python requires a toolchain with WCHAR support"
+ depends on !BR2_USE_WCHAR
+
config BR2_PACKAGE_PYTHON_DEV
depends on BR2_PACKAGE_PYTHON
bool "development files on target"