summaryrefslogtreecommitdiffstats
path: root/src/tools
diff options
context:
space:
mode:
authorSebastian Schmelzer2010-09-02 17:50:49 +0200
committerSebastian Schmelzer2010-09-02 17:50:49 +0200
commit416ab8a37f1b07dc9f6c0fb3ff1a8ff2036510b5 (patch)
tree4715f7d742fec50931017f38fe6ff0a89d4ceccc /src/tools
parentFix for the problem reported on the list (sed filter forgotten for the (diff)
downloadcore-416ab8a37f1b07dc9f6c0fb3ff1a8ff2036510b5.tar.gz
core-416ab8a37f1b07dc9f6c0fb3ff1a8ff2036510b5.tar.xz
core-416ab8a37f1b07dc9f6c0fb3ff1a8ff2036510b5.zip
change dir structure
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/README.busybox10
-rwxr-xr-xsrc/tools/mksquashfsbin0 -> 88416 bytes
-rw-r--r--src/tools/mksquashfs-filter-patch201
-rwxr-xr-xsrc/tools/uclibc-wrapper28
4 files changed, 239 insertions, 0 deletions
diff --git a/src/tools/README.busybox b/src/tools/README.busybox
new file mode 100644
index 00000000..9c12a65b
--- /dev/null
+++ b/src/tools/README.busybox
@@ -0,0 +1,10 @@
+How busybox (version 1.13.2) is created:
+
+1. Get our current sources from openslx-src-tools/trunk/busybox
+2. bind mount the busybox folder to the correspoding uclibc-build-environment
+ folder (see http://www.openslx.org/wiki/openslx/GentooUclibcChroot for
+ how to create such an environment)
+3. chroot into the uclibc-build-environment
+4. cd into the bind-mounted busybox folder
+5. make oldconfig and adjust the configuration if required.
+6. build busybox (make)
diff --git a/src/tools/mksquashfs b/src/tools/mksquashfs
new file mode 100755
index 00000000..e65a35a5
--- /dev/null
+++ b/src/tools/mksquashfs
Binary files differ
diff --git a/src/tools/mksquashfs-filter-patch b/src/tools/mksquashfs-filter-patch
new file mode 100644
index 00000000..5cb4ba24
--- /dev/null
+++ b/src/tools/mksquashfs-filter-patch
@@ -0,0 +1,201 @@
+--- squashfs-tools/mksquashfs.c 2007-01-16 09:24:40.000000000 +0100
++++ squashfs-tools-vito/mksquashfs.c 2007-01-17 08:34:17.000000000 +0100
+@@ -44,6 +44,7 @@
+ #include <sys/mman.h>
+ #include <pthread.h>
+ #include <math.h>
++#include <regex.h>
+
+ #ifndef linux
+ #define __BYTE_ORDER BYTE_ORDER
+@@ -162,15 +163,19 @@
+ struct file_info *dupl[65536];
+ int dup_files = 0;
+
+-/* list of exclude dirs/files */
+-struct exclude_info {
++/* list of include/exclude files/regexes */
++struct filter_info {
+ dev_t st_dev;
+ ino_t st_ino;
++ regex_t *preg;
++ int action;
+ };
+
+-#define EXCLUDE_SIZE 8192
+-int exclude = 0;
+-struct exclude_info *exclude_paths = NULL;
++#define EXCLUDE 0
++#define INCLUDE 1
++#define FILTER_SIZE 8192
++int filter_count = 0;
++struct filter_info *filters = NULL;
+ int excluded(char *filename, struct stat *buf);
+
+ /* fragment block data structures */
+@@ -2606,20 +2611,32 @@
+ {
+ int i;
+
+- for(i = 0; i < exclude; i++)
+- if((exclude_paths[i].st_dev == buf->st_dev) && (exclude_paths[i].st_ino == buf->st_ino))
+- return TRUE;
++ for(i = 0; i < filter_count; i++) {
++ struct filter_info f = filters[i];
++
++ if(f.preg == NULL) {
++ if((f.st_dev == buf->st_dev) && (f.st_ino == buf->st_ino))
++ return TRUE;
++ } else if(regexec(f.preg, filename, (size_t)0, NULL, 0) == 0)
++ if(f.action == EXCLUDE)
++ return TRUE;
++ else
++ return FALSE;
++ }
++
+ return FALSE;
+ }
+
+
+-#define ADD_ENTRY(buf) \
+- if(exclude % EXCLUDE_SIZE == 0) {\
+- if((exclude_paths = (struct exclude_info *) realloc(exclude_paths, (exclude + EXCLUDE_SIZE) * sizeof(struct exclude_info))) == NULL)\
+- BAD_ERROR("Out of memory in exclude dir/file table\n");\
++#define ADD_ENTRY(b, a, p) \
++ if(filter_count % FILTER_SIZE == 0) {\
++ if((filters = (struct filter_info *) realloc(filters, (filter_count + FILTER_SIZE) * sizeof(struct filter_info))) == NULL)\
++ BAD_ERROR("Out of memory in the include/exclude file/regex table\n");\
+ }\
+- exclude_paths[exclude].st_dev = buf.st_dev;\
+- exclude_paths[exclude++].st_ino = buf.st_ino;
++ filters[filter_count].action = a;\
++ filters[filter_count].preg = p;\
++ filters[filter_count].st_dev = b.st_dev;\
++ filters[filter_count++].st_ino = b.st_ino;
+ int add_exclude(char *path)
+ {
+ int i;
+@@ -2632,7 +2649,7 @@
+ perror(buffer);
+ return TRUE;
+ }
+- ADD_ENTRY(buf);
++ ADD_ENTRY(buf, EXCLUDE, NULL);
+ return TRUE;
+ }
+
+@@ -2645,11 +2662,47 @@
+ }
+ continue;
+ }
+- ADD_ENTRY(buf);
++ ADD_ENTRY(buf, EXCLUDE, NULL);
+ }
+ return TRUE;
+ }
+
++void add_pattern(char *pattern)
++{
++ struct stat dummy;
++ int action = -1;
++
++ if(pattern[0] == '#')
++ return;
++
++ if(strlen(pattern) < 3)
++ goto bad_pattern;
++
++ if(strncmp(pattern, "+ ", 2) == 0)
++ action = INCLUDE;
++
++ if(strncmp(pattern, "- ", 2) == 0)
++ action = EXCLUDE;
++
++ if(action != -1) {
++ regex_t *preg = (regex_t*)malloc(sizeof(regex_t));
++ char message[1024];
++ int error = regcomp(preg, pattern+2, REG_EXTENDED|REG_NOSUB);
++ regerror(error, preg, message, 1024);
++
++ if(error) {
++ fprintf(stderr, "Ignoring invalid regex \"%s\" (%s)\n", pattern+2, message);
++ return;
++ }
++
++ ADD_ENTRY(dummy, action, preg);
++ return;
++ }
++
++bad_pattern:
++ fprintf(stderr, "Ignoring wrong filter pattern \"%s\"\n", pattern);
++}
++
+
+ void add_old_root_entry(char *name, squashfs_inode inode, int inode_number, int type)
+ {
+@@ -2849,6 +2902,11 @@
+ ERROR("%s: -ef missing filename\n", argv[0]);
+ exit(1);
+ }
++ } else if(strcmp(argv[i], "-ff") == 0) {
++ if(++i == argc) {
++ ERROR("%s: -ff missing filename\n", argv[0]);
++ exit(1);
++ }
+ } else if(strcmp(argv[i], "-no-duplicates") == 0)
+ duplicate_checking = FALSE;
+
+@@ -2991,6 +3049,10 @@
+ ERROR("\t\t\tfile or dir with priority per line. Priority -32768 to\n");
+ ERROR("\t\t\t32767, default priority 0\n");
+ ERROR("-ef <exclude_file>\tlist of exclude dirs/files. One per line\n");
++ ERROR("-ff <filter_file>\tlist of include/exclude patterns. One per line.\n");
++ ERROR("\t\t\tThe first pattern that matches a dir/file is applied.\n");
++ ERROR("\t\t\tExclude patterns are written '+ regex', include patterns\n");
++ ERROR("\t\t\tare written '- regex'. Comments start with #\n");
+ exit(1);
+ }
+ }
+@@ -3048,7 +3110,7 @@
+ signal(SIGINT, sighandler2);
+ }
+
+- /* process the exclude files - must be done afer destination file has been possibly created */
++ /* process the include/exclude files/patterns - must be done afer destination file has been possibly created */
+ for(i = source + 2; i < argc; i++)
+ if(strcmp(argv[i], "-ef") == 0) {
+ FILE *fd;
+@@ -3060,6 +3122,16 @@
+ while(fscanf(fd, "%16384[^\n]\n", filename) != EOF)
+ add_exclude(filename);
+ fclose(fd);
++ } else if(strcmp(argv[i], "-ff") == 0) {
++ FILE *fd;
++ char pattern[16385];
++ if((fd = fopen(argv[++i], "r")) == NULL) {
++ perror("Could not open filter file...");
++ EXIT_MKSQUASHFS();
++ }
++ while(fscanf(fd, "%16384[^\n]\n", pattern) != EOF)
++ add_pattern(pattern);
++ fclose(fd);
+ } else if(strcmp(argv[i], "-e") == 0)
+ break;
+ else if(strcmp(argv[i], "-b") == 0 || strcmp(argv[i], "-root-becomes") == 0 || strcmp(argv[i], "-sort") == 0)
+@@ -3073,14 +3145,14 @@
+ while(i < argc && add_exclude(argv[i++]));
+ }
+
+- /* process the sort files - must be done afer the exclude files */
++ /* process the sort files - must be done afer processing the include/exclude files/patterns */
+ for(i = source + 2; i < argc; i++)
+ if(strcmp(argv[i], "-sort") == 0) {
+ read_sort_file(argv[++i], source, source_path);
+ sorted ++;
+ } else if(strcmp(argv[i], "-e") == 0)
+ break;
+- else if(strcmp(argv[i], "-b") == 0 || strcmp(argv[i], "-root-becomes") == 0 || strcmp(argv[i], "-ef") == 0)
++ else if(strcmp(argv[i], "-b") == 0 || strcmp(argv[i], "-root-becomes") == 0 || strcmp(argv[i], "-ef") == 0 || strcmp(argv[i], "-ff") == 0)
+ i++;
+
+ initialise_threads();
diff --git a/src/tools/uclibc-wrapper b/src/tools/uclibc-wrapper
new file mode 100755
index 00000000..08934f32
--- /dev/null
+++ b/src/tools/uclibc-wrapper
@@ -0,0 +1,28 @@
+#!/bin/sh
+# Copyright (c) 2008..2009 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found under http://openslx.org
+#
+# Wrapper script for OpenSLX environments used with server and client stage4
+
+if [ -d /opt/openslx/share/uclib-rootfs ]; then
+ SLX_UCLIB_PATH=/opt/openslx/share/uclib-rootfs
+elif [ -d /opt/openslx/uclib-rootfs ]; then
+ SLX_UCLIB_PATH=/opt/openslx/uclib-rootfs
+else
+ echo "Can't find OpenSLX Environment." && exit 1
+fi
+
+[ -f /lib/ld-uClibc.so.0 ] || \
+ ln -sf $SLX_PATH/uclib-rootfs/lib/ld-uClibc.so.0 /lib/ld-uClibc.so.0
+
+PATH=$SLX_UCLIB_PATH/bin:$SLX_UCLIB_PATH/usr/bin:$SLX_UCLIB_PATH/sbin:\
+$SLX_UCLIB_PATH/usr/sbin
+LD_LIBRARY_PATH=$SLX_UCLIB_PATH/lib:$SLX_UCLIB_PATH/usr/lib
+LD_LIBRARY_PATH=$LD_LIBRARY_PATH PATH=$PATH PS1="#" $@