diff options
29 files changed, 3386 insertions, 70 deletions
diff --git a/conf/checksums.ini b/conf/checksums.ini index 12f0c99f4c..a69b6b03b6 100644 --- a/conf/checksums.ini +++ b/conf/checksums.ini @@ -854,6 +854,10 @@ sha256=f2f80e2a62a039e9a1ffa0fdf58707b2d12b3ff33c56472b46bb6d53f45e083e md5=e81c2f0953aa60f8062c05a4673f2be0 sha256=cf153f10ba6312a8303ceb01bed834a2786d28aa89c7d73dba64714f691628f6 +[http://www.python.org/ftp/python/2.6.2/Python-2.6.2.tar.bz2] +md5=245db9f1e0f09ab7e0faaa0cf7301011 +sha256=a1cdc4a8f6c1f947ea3b87d097af2db4371019bac941d92c3844124c5694328b + [http://jerakeen.org/files/PythonDaap-0.4.tar.gz] md5=f7672bfd563787a76fb7e9a43c062f18 sha256=5318946df77937e0b601c95a198790f9ba52d4afb4eb153480289350182bb739 @@ -11470,6 +11474,10 @@ sha256=25d45acf19e3acd09745df47581ac7a13e3694ee51fe4e642108f9f228cacca9 md5=a1d0aca33da380d6045c5c0e5002c09d sha256=9e4ab143828fefb3b67ce2bc3ad63a91cacc45d97161822915778683fb80343b +[http://ipython.scipy.org/dist/ipython-0.10.tar.gz] +md5=dd10cd1b622c16c1afca2239fcc0dfdf +sha256=60d602637dc5f078b083a4ca5ab64364ba816bd72439844012ed11a30f88228c + [http://ipython.scipy.org/dist/ipython-0.9.1.tar.gz] md5=8a1bd1a9be272f4ddf4de99e5c1ad0dc sha256=5540bc1a01f11ca66c3d7c31a43af670fd0f0044b8e38d142614872956548006 @@ -11974,6 +11982,10 @@ sha256=6a2efdfc757c518a8185f457799506086084b59498f53db37cfb6728008127e0 md5=481dfdef7273f2cc776c2637f481f017 sha256=27000ba4bc73a5977502b27d7036df24dd6ab94a1c33b8f5d6d54ba62772f0c7 +[http://kernel.org/pub/linux/libs/klibc/Testing/klibc-1.5.15.tar.bz2] +md5=db2152a8a03bd81e21a5f451f537ae3d +sha256=8b5334ef88b075f374b031695181b4302c3e5621bf2737a39fdf28262b0f80f4 + [http://downloads.sourceforge.net/klimt/klimt-src-0.6.1.zip] md5=d12f56384b4ccde11cd756db2b14065c sha256=48ae508d72e453e2a1f5748870362259786b475548c545feaec1aea71d2f8fdb diff --git a/recipes/ipython/ipython_0.10.bb b/recipes/ipython/ipython_0.10.bb new file mode 100644 index 0000000000..7ab8d724e3 --- /dev/null +++ b/recipes/ipython/ipython_0.10.bb @@ -0,0 +1,15 @@ +DESCRIPTION = "Enhanced Python Shell" +HOMEPAGE = "http://ipython.scipy.org/moin/" +SECTION = "devel/python" +LICENSE = "BSD" +DEPENDS = "less" +RDEPENDS = "python-pprint python-io python-shell python-misc python-lang \ + python-stringold python-codecs python-crypt python-threading \ + python-pydoc python-debugger python-textutils python-pickle \ + python-subprocess" + +SRC_URI = "http://ipython.scipy.org/dist/ipython-${PV}.tar.gz" + +inherit distutils + +FILES_${PN} = "/" diff --git a/recipes/klibc/files/fstype-sane-vfat-and-jffs2-for-1.5.patch b/recipes/klibc/files/fstype-sane-vfat-and-jffs2-for-1.5.patch index b52b3e309b..6eb604e45c 100644 --- a/recipes/klibc/files/fstype-sane-vfat-and-jffs2-for-1.5.patch +++ b/recipes/klibc/files/fstype-sane-vfat-and-jffs2-for-1.5.patch @@ -3,17 +3,17 @@ Index: klibc-1.5/usr/kinit/fstype/fstype.c --- klibc-1.5.orig/usr/kinit/fstype/fstype.c 2008-02-28 00:48:35.319254938 +0100 +++ klibc-1.5/usr/kinit/fstype/fstype.c 2008-02-28 00:52:20.583257793 +0100 @@ -20,7 +20,7 @@ - #include <endian.h> #include <netinet/in.h> + #include <sys/utsname.h> #include <sys/vfs.h> - +#include <linux/types.h> #define cpu_to_be32(x) __cpu_to_be32(x) /* Needed by romfs_fs.h */ #include "romfs_fs.h" -@@ -33,6 +33,12 @@ - #include "lvm2_sb.h" - #include "iso9660_sb.h" +@@ -37,6 +37,12 @@ + #include "ocfs2_fs.h" + #include "nilfs_fs.h" +#if __BYTE_ORDER == __BIG_ENDIAN +#include <linux/byteorder/big_endian.h> @@ -24,7 +24,7 @@ Index: klibc-1.5/usr/kinit/fstype/fstype.c /* * Slightly cleaned up version of jfs_superblock to * avoid pulling in other kernel header files. -@@ -54,6 +60,27 @@ +@@ -59,6 +65,27 @@ /* Swap needs the definition of block size */ #include "swap_fs.h" @@ -50,14 +50,14 @@ Index: klibc-1.5/usr/kinit/fstype/fstype.c +} + static int gzip_image(const void *buf, unsigned long long *bytes) - { + {277 304 const unsigned char *p = buf; -@@ -277,6 +304,8 @@ +@@ -490,6 +517,8 @@ {1, "ext3", ext3_image}, {1, "ext2", ext2_image}, {1, "minix", minix_image}, + {0, "jffs2", jffs2_image}, + {0, "vfat", vfat_image}, + {1, "nilfs2", nilfs2_image}, + {2, "ocfs2", ocfs2_image}, {8, "reiserfs", reiserfs_image}, - {64, "reiserfs", reiserfs_image}, - {32, "jfs", jfs_image}, diff --git a/recipes/klibc/files/modprobe.patch b/recipes/klibc/files/modprobe.patch index 074b0b6311..61ee340ff9 100644 --- a/recipes/klibc/files/modprobe.patch +++ b/recipes/klibc/files/modprobe.patch @@ -7,16 +7,16 @@ Index: klibc-1.5/usr/utils/Kbuild progs := chroot dd mkdir mkfifo mknod mount pivot_root umount -progs += true false sleep ln nuke minips cat --progs += insmod uname halt kill readlink cpio +-progs += uname halt kill readlink cpio sync dmesg +progs += true false sleep ln nuke minips cat losetup -+progs += insmod uname halt kill readlink cpio modprobe ++progs += uname halt kill readlink cpio sync dmesg modprobe static-y := $(addprefix static/, $(progs)) shared-y := $(addprefix shared/, $(progs)) -@@ -52,7 +52,10 @@ - shared/readlink-y := readlink.o - static/cpio-y := cpio.o +@@ -54,7 +54,10 @@ shared/cpio-y := cpio.o + static/sync-y := sync.o + shared/sync-y := sync.o - +static/modprobe-y := modprobe.o +shared/modprobe-y := modprobe.o diff --git a/recipes/klibc/files/staging.patch b/recipes/klibc/files/staging.patch index 215daad456..390c214f94 100644 --- a/recipes/klibc/files/staging.patch +++ b/recipes/klibc/files/staging.patch @@ -26,13 +26,13 @@ Index: klibc-1.5/scripts/Kbuild.install $(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include $(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)lib - $(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)bin - $(Q)set -e ; for d in linux scsi asm-$(KLIBCARCH) asm-generic $(ASMKLIBCARCH); do \ - mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KLIBCCROSS)include/$$d ; \ + $(Q)set -e ; for d in linux asm asm-$(KLIBCARCH) asm-generic $(ASMKLIBCARCH); do \ for r in $(KLIBCKERNELSRC)/include $(KLIBCKERNELOBJ)/include \ $(KLIBCKERNELOBJ)/include2 ; do \ - [ ! -d $$r/$$d ] || \ -- cp -rfL $$r/$$d/. \ -+ cp -rfd $$r/$$d/. \ + [ ! -d $$r/$$d ] && continue; \ + mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KLIBCCROSS)include/$$d ; \ +- cp -rfL $$r/$$d/. \ ++ cp -rfd $$r/$$d/. \ $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include/$$d/. ; \ done ; \ done @@ -116,7 +116,7 @@ Index: klibc-1.5/usr/kinit/run-init/Kbuild =================================================================== --- klibc-1.5.orig/usr/kinit/run-init/Kbuild 2007-03-04 02:52:10.000000000 +0100 +++ klibc-1.5/usr/kinit/run-init/Kbuild 2008-02-24 15:13:50.221824559 +0100 -@@ -21,5 +21,3 @@ +@@ -25,5 +25,3 @@ # Cleaning clean-dirs := static shared @@ -136,7 +136,7 @@ Index: klibc-1.5/usr/utils/Kbuild =================================================================== --- klibc-1.5.orig/usr/utils/Kbuild 2007-03-04 02:52:10.000000000 +0100 +++ klibc-1.5/usr/utils/Kbuild 2008-02-24 15:13:50.229824358 +0100 -@@ -64,5 +64,3 @@ +@@ -66,5 +66,3 @@ # Clean deletes the static and shared dir clean-dirs := static shared diff --git a/recipes/klibc/files/wc.patch b/recipes/klibc/files/wc.patch index 296a4f9d92..f54c49d3ab 100644 --- a/recipes/klibc/files/wc.patch +++ b/recipes/klibc/files/wc.patch @@ -8,7 +8,7 @@ Index: klibc-1.5/usr/utils/Kbuild progs := chroot dd mkdir mkfifo mknod mount pivot_root umount -progs += true false sleep ln nuke minips cat losetup +progs += true false sleep ln nuke minips cat losetup wc - progs += insmod uname halt kill readlink cpio modprobe + progs += uname halt kill readlink cpio sync dmesg modprobe static-y := $(addprefix static/, $(progs)) @@ -56,6 +56,9 @@ diff --git a/recipes/klibc/klibc-1.5/fstype-sane-vfat-and-jffs2-for-1.5.patch b/recipes/klibc/klibc-1.5/fstype-sane-vfat-and-jffs2-for-1.5.patch new file mode 100644 index 0000000000..2ba6d98172 --- /dev/null +++ b/recipes/klibc/klibc-1.5/fstype-sane-vfat-and-jffs2-for-1.5.patch @@ -0,0 +1,63 @@ +Index: klibc-1.5/usr/kinit/fstype/fstype.c +=================================================================== +--- klibc-1.5.orig/usr/kinit/fstype/fstype.c 2008-02-28 00:48:35.319254938 +0100 ++++ klibc-1.5/usr/kinit/fstype/fstype.c 2008-02-28 00:52:20.583257793 +0100 +@@ -20,7 +20,7 @@ + #include <endian.h> + #include <netinet/in.h> + #include <sys/vfs.h> +- ++#include <linux/types.h> + #define cpu_to_be32(x) __cpu_to_be32(x) /* Needed by romfs_fs.h */ + + #include "romfs_fs.h" +@@ -33,6 +33,12 @@ + #include "lvm2_sb.h" + #include "iso9660_sb.h" + ++#if __BYTE_ORDER == __BIG_ENDIAN ++#include <linux/byteorder/big_endian.h> ++#else ++#include <linux/byteorder/little_endian.h> ++#endif ++ + /* + * Slightly cleaned up version of jfs_superblock to + * avoid pulling in other kernel header files. +@@ -54,6 +60,27 @@ + /* Swap needs the definition of block size */ + #include "swap_fs.h" + ++static int jffs2_image(const unsigned char *buf, unsigned long *blocks) ++{ ++ // Very sloppy! ;-E ++ if (*buf == 0x85 && buf[1] == 0x19) ++ return 1; ++ ++ return 0; ++} ++ ++static int vfat_image(const unsigned char *buf, unsigned long *blocks) ++{ ++ const struct romfs_super_block *sb = ++ (const struct romfs_super_block *)buf; ++ if (!strncmp(buf + 54, "FAT12 ", 8) ++ || !strncmp(buf + 54, "FAT16 ", 8) ++ || !strncmp(buf + 82, "FAT32 ", 8)) ++ return 1; ++ ++ return 0; ++} ++ + static int gzip_image(const void *buf, unsigned long long *bytes) + { + const unsigned char *p = buf; +@@ -277,6 +304,8 @@ + {1, "ext3", ext3_image}, + {1, "ext2", ext2_image}, + {1, "minix", minix_image}, ++ {0, "jffs2", jffs2_image}, ++ {0, "vfat", vfat_image}, + {8, "reiserfs", reiserfs_image}, + {64, "reiserfs", reiserfs_image}, + {32, "jfs", jfs_image}, diff --git a/recipes/klibc/klibc-1.5/modprobe.patch b/recipes/klibc/klibc-1.5/modprobe.patch new file mode 100644 index 0000000000..dceaf6103f --- /dev/null +++ b/recipes/klibc/klibc-1.5/modprobe.patch @@ -0,0 +1,1985 @@ +Index: klibc-1.5/usr/utils/Kbuild +=================================================================== +--- klibc-1.5.orig/usr/utils/Kbuild 2008-03-07 22:01:45.223695348 +0100 ++++ klibc-1.5/usr/utils/Kbuild 2008-03-07 22:48:44.660783243 +0100 +@@ -3,8 +3,8 @@ + # + + progs := chroot dd mkdir mkfifo mknod mount pivot_root umount +-progs += true false sleep ln nuke minips cat +-progs += insmod uname halt kill readlink cpio ++progs += true false sleep ln nuke minips cat losetup ++progs += insmod uname halt kill readlink cpio modprobe + + static-y := $(addprefix static/, $(progs)) + shared-y := $(addprefix shared/, $(progs)) +@@ -52,7 +52,10 @@ + shared/readlink-y := readlink.o + static/cpio-y := cpio.o + shared/cpio-y := cpio.o +- ++static/modprobe-y := modprobe.o ++shared/modprobe-y := modprobe.o ++static/losetup-y := losetup.o ++shared/losetup-y := losetup.o + # Additionally linked targets + always := static/reboot static/poweroff shared/reboot shared/poweroff + +Index: klibc-1.5/usr/utils/list.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ klibc-1.5/usr/utils/list.h 2008-03-07 22:33:22.287688586 +0100 +@@ -0,0 +1,238 @@ ++/* Stolen from Linux Kernel Source's list.h -- GPL. */ ++#ifndef _MODINITTOOLS_LIST_H ++#define _MODINITTOOLS_LIST_H ++ ++#undef offsetof ++#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) ++ ++/** ++ * container_of - cast a member of a structure out to the containing structure ++ * ++ * @ptr: the pointer to the member. ++ * @type: the type of the container struct this is embedded in. ++ * @member: the name of the member within the struct. ++ * ++ */ ++#define container_of(ptr, type, member) ({ \ ++ const typeof( ((type *)0)->member ) *__mptr = (ptr); \ ++ (type *)( (char *)__mptr - offsetof(type,member) );}) ++ ++/* ++ * Simple doubly linked list implementation. ++ * ++ * Some of the internal functions ("__xxx") are useful when ++ * manipulating whole lists rather than single entries, as ++ * sometimes we already know the next/prev entries and we can ++ * generate better code by using them directly rather than ++ * using the generic single-entry routines. ++ */ ++ ++struct list_head { ++ struct list_head *next, *prev; ++}; ++ ++#define LIST_HEAD_INIT(name) { &(name), &(name) } ++ ++#define LIST_HEAD(name) \ ++ struct list_head name = LIST_HEAD_INIT(name) ++ ++#define INIT_LIST_HEAD(ptr) do { \ ++ (ptr)->next = (ptr); (ptr)->prev = (ptr); \ ++} while (0) ++ ++/* ++ * Insert a new entry between two known consecutive entries. ++ * ++ * This is only for internal list manipulation where we know ++ * the prev/next entries already! ++ */ ++static inline void __list_add(struct list_head *new, ++ struct list_head *prev, ++ struct list_head *next) ++{ ++ next->prev = new; ++ new->next = next; ++ new->prev = prev; ++ prev->next = new; ++} ++ ++/** ++ * list_add - add a new entry ++ * @new: new entry to be added ++ * @head: list head to add it after ++ * ++ * Insert a new entry after the specified head. ++ * This is good for implementing stacks. ++ */ ++static inline void list_add(struct list_head *new, struct list_head *head) ++{ ++ __list_add(new, head, head->next); ++} ++ ++/** ++ * list_add_tail - add a new entry ++ * @new: new entry to be added ++ * @head: list head to add it before ++ * ++ * Insert a new entry before the specified head. ++ * This is useful for implementing queues. ++ */ ++static inline void list_add_tail(struct list_head *new, struct list_head *head) ++{ ++ __list_add(new, head->prev, head); ++} ++ ++/* ++ * Delete a list entry by making the prev/next entries ++ * point to each other. ++ * ++ * This is only for internal list manipulation where we know ++ * the prev/next entries already! ++ */ ++static inline void __list_del(struct list_head * prev, struct list_head * next) ++{ ++ next->prev = prev; ++ prev->next = next; ++} ++ ++/** ++ * list_del - deletes entry from list. ++ * @entry: the element to delete from the list. ++ * Note: list_empty on entry does not return true after this, the entry is ++ * in an undefined state. ++ */ ++static inline void list_del(struct list_head *entry) ++{ ++ __list_del(entry->prev, entry->next); ++} ++ ++/** ++ * list_del_init - deletes entry from list and reinitialize it. ++ * @entry: the element to delete from the list. ++ */ ++static inline void list_del_init(struct list_head *entry) ++{ ++ __list_del(entry->prev, entry->next); ++ INIT_LIST_HEAD(entry); ++} ++ ++/** ++ * list_move - delete from one list and add as another's head ++ * @list: the entry to move ++ * @head: the head that will precede our entry ++ */ ++static inline void list_move(struct list_head *list, struct list_head *head) ++{ ++ __list_del(list->prev, list->next); ++ list_add(list, head); ++} ++ ++/** ++ * list_move_tail - delete from one list and add as another's tail ++ * @list: the entry to move ++ * @head: the head that will follow our entry ++ */ ++static inline void list_move_tail(struct list_head *list, ++ struct list_head *head) ++{ ++ __list_del(list->prev, list->next); ++ list_add_tail(list, head); ++} ++ ++/** ++ * list_empty - tests whether a list is empty ++ * @head: the list to test. ++ */ ++static inline int list_empty(struct list_head *head) ++{ ++ return head->next == head; ++} ++ ++static inline void __list_splice(struct list_head *list, ++ struct list_head *head) ++{ ++ struct list_head *first = list->next; ++ struct list_head *last = list->prev; ++ struct list_head *at = head->next; ++ ++ first->prev = head; ++ head->next = first; ++ ++ last->next = at; ++ at->prev = last; ++} ++ ++/** ++ * list_splice - join two lists ++ * @list: the new list to add. ++ * @head: the place to add it in the first list. ++ */ ++static inline void list_splice(struct list_head *list, struct list_head *head) ++{ ++ if (!list_empty(list)) ++ __list_splice(list, head); ++} ++ ++/** ++ * list_splice_init - join two lists and reinitialise the emptied list. ++ * @list: the new list to add. ++ * @head: the place to add it in the first list. ++ * ++ * The list at @list is reinitialised ++ */ ++static inline void list_splice_init(struct list_head *list, ++ struct list_head *head) ++{ ++ if (!list_empty(list)) { ++ __list_splice(list, head); ++ INIT_LIST_HEAD(list); ++ } ++} ++ ++/** ++ * list_entry - get the struct for this entry ++ * @ptr: the &struct list_head pointer. ++ * @type: the type of the struct this is embedded in. ++ * @member: the name of the list_struct within the struct. ++ */ ++#define list_entry(ptr, type, member) \ ++ container_of(ptr, type, member) ++ ++/** ++ * list_for_each - iterate over a list ++ * @pos: the &struct list_head to use as a loop counter. ++ * @head: the head for your list. ++ */ ++#define list_for_each(pos, head) \ ++ for (pos = (head)->next; pos != (head); pos = pos->next) ++ ++/** ++ * list_for_each_prev - iterate over a list backwards ++ * @pos: the &struct list_head to use as a loop counter. ++ * @head: the head for your list. ++ */ ++#define list_for_each_prev(pos, head) \ ++ for (pos = (head)->prev; pos != (head); pos = pos->prev) ++ ++/** ++ * list_for_each_safe - iterate over a list safe against removal of list entry ++ * @pos: the &struct list_head to use as a loop counter. ++ * @n: another &struct list_head to use as temporary storage ++ * @head: the head for your list. ++ */ ++#define list_for_each_safe(pos, n, head) \ ++ for (pos = (head)->next, n = pos->next; pos != (head); \ ++ pos = n, n = pos->next) ++ ++/** ++ * list_for_each_entry - iterate over list of given type ++ * @pos: the type * to use as a loop counter. ++ * @head: the head for your list. ++ * @member: the name of the list_struct within the struct. ++ */ ++#define list_for_each_entry(pos, head, member) \ ++ for (pos = list_entry((head)->next, typeof(*pos), member); \ ++ &pos->member != (head); \ ++ pos = list_entry(pos->member.next, typeof(*pos), member)) ++ ++#endif +Index: klibc-1.5/usr/utils/modprobe.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ klibc-1.5/usr/utils/modprobe.c 2008-03-08 03:05:51.847688952 +0100 +@@ -0,0 +1,1710 @@ ++/* modprobe.c: insert a module into the kernel, intelligently. ++ Copyright (C) 2001 Rusty Russell. ++ Copyright (C) 2002, 2003 Rusty Russell, IBM Corporation. ++ ++ 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 ++*/ ++#define _GNU_SOURCE /* asprintf */ ++ ++#include <sys/utsname.h> ++#include <sys/types.h> ++#include <sys/stat.h> ++#include <sys/mman.h> ++#include <fcntl.h> ++#include <stdarg.h> ++#include <stdio.h> ++#include <stdlib.h> ++#include <ctype.h> ++#include <string.h> ++#include <errno.h> ++#include <unistd.h> ++#include <dirent.h> ++#include <limits.h> ++#include <elf.h> ++#include <getopt.h> ++#include <fnmatch.h> ++#include <asm/unistd.h> ++#include <sys/wait.h> ++#include <syslog.h> ++#include <zlib.h> ++ ++#define streq(a,b) (strcmp((a),(b)) == 0) ++#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) ++ ++#include "list.h" ++static inline void try_old_version(const char *progname, char *argv[]) ++{ ++} ++extern long init_module(void *, unsigned long, const char *); ++extern long delete_module(const char *, unsigned int); ++ ++struct module { ++ struct list_head list; ++ char *modname; ++ char filename[0]; ++}; ++ ++#ifndef MODULE_DIR ++#define MODULE_DIR "/lib/modules" ++#endif ++ ++typedef void (*errfn_t)(const char *fmt, ...); ++ ++/* Do we use syslog or stderr for messages? */ ++static int log; ++ ++static void message(const char *prefix, const char *fmt, va_list *arglist) ++{ ++ char *buf, *buf2; ++ ++ vasprintf(&buf, fmt, *arglist); ++ asprintf(&buf2, "%s%s", prefix, buf); ++ ++ if (log) ++ syslog(LOG_NOTICE, "%s", buf2); ++ else ++ fprintf(stderr, "%s", buf2); ++ free(buf2); ++ free(buf); ++} ++void *grab_contents(gzFile *gzfd, unsigned long *size) ++{ ++ unsigned int max = 16384; ++ void *buffer = malloc(max); ++ int ret; ++ ++ if (!buffer) ++ return NULL; ++ ++ *size = 0; ++ while ((ret = gzread(gzfd, buffer + *size, max - *size)) > 0) { ++ *size += ret; ++ if (*size == max) { ++ buffer = realloc(buffer, max *= 2); ++ if (!buffer) ++ return NULL; ++ } ++ } ++ if (ret < 0) { ++ free(buffer); ++ buffer = NULL; ++ } ++ return buffer; ++} ++ ++void *grab_fd(int fd, unsigned long *size) ++{ ++ gzFile gzfd; ++ ++ gzfd = gzdopen(fd, "rb"); ++ if (!gzfd) ++ return NULL; ++ ++ /* gzclose(gzfd) would close fd, which would drop locks. ++ Don't blame zlib: POSIX locking semantics are so horribly ++ broken that they should be ripped out. */ ++ return grab_contents(gzfd, size); ++} ++void release_file(void *data, unsigned long size) ++{ ++ free(data); ++} ++ ++ ++static int warned = 0; ++static void warn(const char *fmt, ...) ++{ ++ va_list arglist; ++ warned++; ++ va_start(arglist, fmt); ++ message("WARNING: ", fmt, &arglist); ++ va_end(arglist); ++} ++ ++static void fatal(const char *fmt, ...) ++{ ++ va_list arglist; ++ va_start(arglist, fmt); ++ message("FATAL: ", fmt, &arglist); ++ va_end(arglist); ++ exit(1); ++} ++ ++ ++static void grammar(const char *cmd, const char *filename, unsigned int line) ++{ ++ warn("%s line %u: ignoring bad line starting with '%s'\n", ++ filename, line, cmd); ++} ++ ++static void *do_nofail(void *ptr, const char *file, int line, const char *expr) ++{ ++ if (!ptr) { ++ fatal("Memory allocation failure %s line %d: %s.\n", ++ file, line, expr); ++ } ++ return ptr; ++} ++ ++#define NOFAIL(ptr) do_nofail((ptr), __FILE__, __LINE__, #ptr) ++ ++static void print_usage(const char *progname) ++{ ++ fprintf(stderr, ++ "Usage: %s [-v] [-V] [-C config-file] [-n] [-i] [-q] [-b] [-o <modname>] <modname> [parameters...]\n" ++ "%s -r [-n] [-i] [-v] <modulename> ...\n" ++ "%s -l -t <dirname> [ -a <modulename> ...]\n", ++ progname, progname, progname); ++ exit(1); ++} ++ ++static int fgetc_wrapped(FILE *file, unsigned int *linenum) ++{ ++ for (;;) { ++ int ch = fgetc(file); ++ if (ch != '\\') ++ return ch; ++ ch = fgetc(file); ++ if (ch != '\n') ++ return ch; ++ if (linenum) ++ (*linenum)++; ++ } ++} ++ ++static char *getline_wrapped(FILE *file, unsigned int *linenum) ++{ ++ int size = 1024; ++ int i = 0; ++ char *buf = NOFAIL(malloc(size)); ++ for(;;) { ++ int ch = fgetc_wrapped(file, linenum); ++ if (i == size) { ++ size *= 2; ++ buf = NOFAIL(realloc(buf, size)); ++ } ++ if (ch < 0 && i == 0) { ++ free(buf); ++ return NULL; ++ } ++ if (ch < 0 || ch == '\n') { ++ if (linenum) ++ (*linenum)++; ++ buf[i] = '\0'; ++ return NOFAIL(realloc(buf, i+1)); ++ } ++ buf[i++] = ch; ++ } ++} ++ ++static struct module *find_module(const char *filename, struct list_head *list) ++{ ++ struct module *i; ++ ++ list_for_each_entry(i, list, list) { ++ if (strcmp(i->filename, filename) == 0) ++ return i; ++ } ++ return NULL; ++} ++ ++/* Convert filename to the module name. Works if filename == modname, too. */ ++static void filename2modname(char *modname, const char *filename) ++{ ++ const char *afterslash; ++ unsigned int i; ++ ++ afterslash = strrchr(filename, '/'); ++ if (!afterslash) ++ afterslash = filename; ++ else ++ afterslash++; ++ ++ /* Convert to underscores, stop at first . */ ++ for (i = 0; afterslash[i] && afterslash[i] != '.'; i++) { ++ if (afterslash[i] == '-') ++ modname[i] = '_'; ++ else ++ modname[i] = afterslash[i]; ++ } ++ modname[i] = '\0'; ++} ++ ++static int lock_file(const char *filename) ++{ ++ int fd = open(filename, O_RDWR, 0); ++ ++ if (fd >= 0) { ++ struct flock lock; ++ lock.l_type = F_WRLCK; ++ lock.l_whence = SEEK_SET; ++ lock.l_start = 0; ++ lock.l_len = 1; ++ fcntl(fd, F_SETLKW, &lock); ++ } else ++ /* Read-only filesystem? There goes locking... */ ++ fd = open(filename, O_RDONLY, 0); ++ return fd; ++} ++ ++static void unlock_file(int fd) ++{ ++ /* Valgrind is picky... */ ++ close(fd); ++} ++ ++static void add_module(char *filename, int namelen, struct list_head *list) ++{ ++ struct module *mod; ++ ++ /* If it's a duplicate: move it to the end, so it gets ++ inserted where it is *first* required. */ ++ mod = find_module(filename, list); ++ if (mod) ++ list_del(&mod->list); ++ else { ++ /* No match. Create a new module. */ ++ mod = NOFAIL(malloc(sizeof(struct module) + namelen + 1)); ++ memcpy(mod->filename, filename, namelen); ++ mod->filename[namelen] = '\0'; ++ mod->modname = NOFAIL(malloc(namelen + 1)); ++ filename2modname(mod->modname, mod->filename); ++ } ++ ++ list_add_tail(&mod->list, list); ++} ++ ++/* Compare len chars of a to b, with _ and - equivalent. */ ++static int modname_equal(const char *a, const char *b, unsigned int len) ++{ ++ unsigned int i; ++ ++ if (strlen(b) != len) ++ return 0; ++ ++ for (i = 0; i < len; i++) { ++ if ((a[i] == '_' || a[i] == '-') ++ && (b[i] == '_' || b[i] == '-')) ++ continue; ++ if (a[i] != b[i]) ++ return 0; ++ } ++ return 1; ++} ++ ++/* Fills in list of modules if this is the line we want. */ ++static int add_modules_dep_line(char *line, ++ const char *name, ++ struct list_head *list) ++{ ++ char *ptr; ++ int len; ++ char *modname; ++ ++ /* Ignore lines without : or which start with a # */ ++ ptr = strchr(line, ':'); ++ if (ptr == NULL || line[strspn(line, "\t ")] == '#') ++ return 0; ++ ++ /* Is this the module we are looking for? */ ++ *ptr = '\0'; ++ if (strrchr(line, '/')) ++ modname = strrchr(line, '/') + 1; ++ else ++ modname = line; ++ ++ len = strlen(modname); ++ if (strchr(modname, '.')) ++ len = strchr(modname, '.') - modname; ++ if (!modname_equal(modname, name, len)) ++ return 0; ++ ++ /* Create the list. */ ++ add_module(line, ptr - line, list); ++ ++ ptr++; ++ for(;;) { ++ char *dep_start; ++ ptr += strspn(ptr, " \t"); ++ if (*ptr == '\0') ++ break; ++ dep_start = ptr; ++ ptr += strcspn(ptr, " \t"); ++ add_module(dep_start, ptr - dep_start, list); ++ } ++ return 1; ++} ++ ++static void read_depends(const char *dirname, ++ const char *start_name, ++ struct list_head *list) ++{ ++ char *modules_dep_name; ++ char *line; ++ FILE *modules_dep; ++ int done = 0; ++ ++ asprintf(&modules_dep_name, "%s/%s", dirname, "modules.dep"); ++ modules_dep = fopen(modules_dep_name, "r"); ++ if (!modules_dep) ++ fatal("Could not load %s: %s\n", ++ modules_dep_name, strerror(errno)); ++ ++ /* Stop at first line, as we can have duplicates (eg. symlinks ++ from boot/ */ ++ while (!done && (line = getline_wrapped(modules_dep, NULL)) != NULL) { ++ done = add_modules_dep_line(line, start_name, list); ++ free(line); ++ } ++ fclose(modules_dep); ++ free(modules_dep_name); ++} ++ ++/* We use error numbers in a loose translation... */ ++static const char *insert_moderror(int err) ++{ ++ switch (err) { ++ case ENOEXEC: ++ return "Invalid module format"; ++ case ENOENT: ++ return "Unknown symbol in module, or unknown parameter (see dmesg)"; ++ case ENOSYS: ++ return "Kernel does not have module support"; ++ default: ++ return strerror(err); ++ } ++} ++ ++static const char *remove_moderror(int err) ++{ ++ switch (err) { ++ case ENOENT: ++ return "No such module"; ++ case ENOSYS: ++ return "Kernel does not have module unloading support"; ++ default: ++ return strerror(err); ++ } ++} ++ ++/* Is module in /proc/modules? If so, fill in usecount if not NULL. ++ 0 means no, 1 means yes, -1 means unknown. ++ */ ++static int module_in_kernel(const char *modname, unsigned int *usecount) ++{ ++ FILE *proc_modules; ++ char *line; ++ ++again: ++ /* Might not be mounted yet. Don't fail. */ ++ proc_modules = fopen("/proc/modules", "r"); ++ if (!proc_modules) ++ return -1; ++ ++ while ((line = getline_wrapped(proc_modules, NULL)) != NULL) { ++ char *entry = strtok(line, " \n"); ++ ++ if (entry && streq(entry, modname)) { ++ /* If it exists, usecount is the third entry. */ ++ if (!strtok(NULL, " \n")) ++ goto out; ++ ++ if (!(entry = strtok(NULL, " \n"))) /* usecount */ ++ goto out; ++ else ++ if (usecount) ++ *usecount = atoi(entry); ++ ++ /* Followed by - then status. */ ++ if (strtok(NULL, " \n") ++ && (entry = strtok(NULL, " \n")) != NULL) { ++ /* Locking will fail on ro fs, we might hit ++ * cases where module is in flux. Spin. */ ++ if (streq(entry, "Loading") ++ || streq(entry, "Unloading")) { ++ usleep(100000); ++ free(line); ++ fclose(proc_modules); ++ goto again; ++ } ++ } ++ ++ out: ++ free(line); ++ fclose(proc_modules); ++ return 1; ++ } ++ free(line); ++ } ++ fclose(proc_modules); ++ return 0; ++} ++ ++static void replace_modname(struct module *module, ++ void *mem, unsigned long len, ++ const char *oldname, const char *newname) ++{ ++ char *p; ++ ++ /* 64 - sizeof(unsigned long) - 1 */ ++ if (strlen(newname) > 55) ++ fatal("New name %s is too long\n", newname); ++ ++ /* Find where it is in the module structure. Don't assume layout! */ ++ for (p = mem; p < (char *)mem + len - strlen(oldname); p++) { ++ if (memcmp(p, oldname, strlen(oldname)) == 0) { ++ strcpy(p, newname); ++ return; ++ } ++ } ++ ++ warn("Could not find old name in %s to replace!\n", module->filename); ++} ++ ++static void *get_section32(void *file, ++ unsigned long size, ++ const char *name, ++ unsigned long *secsize) ++{ ++ Elf32_Ehdr *hdr = file; ++ Elf32_Shdr *sechdrs = file + hdr->e_shoff; ++ const char *secnames; ++ unsigned int i; ++ ++ /* Too short? */ ++ if (size < sizeof(*hdr)) ++ return NULL; ++ if (size < hdr->e_shoff + hdr->e_shnum * sizeof(sechdrs[0])) ++ return NULL; ++ if (size < sechdrs[hdr->e_shstrndx].sh_offset) ++ return NULL; ++ ++ secnames = file + sechdrs[hdr->e_shstrndx].sh_offset; ++ for (i = 1; i < hdr->e_shnum; i++) ++ if (strcmp(secnames + sechdrs[i].sh_name, name) == 0) { ++ *secsize = sechdrs[i].sh_size; ++ return file + sechdrs[i].sh_offset; ++ } ++ return NULL; ++} ++ ++static void *get_section64(void *file, ++ unsigned long size, ++ const char *name, ++ unsigned long *secsize) ++{ ++ Elf64_Ehdr *hdr = file; ++ Elf64_Shdr *sechdrs = file + hdr->e_shoff; ++ const char *secnames; ++ unsigned int i; ++ ++ /* Too short? */ ++ if (size < sizeof(*hdr)) ++ return NULL; ++ if (size < hdr->e_shoff + hdr->e_shnum * sizeof(sechdrs[0])) ++ return NULL; ++ if (size < sechdrs[hdr->e_shstrndx].sh_offset) ++ return NULL; ++ ++ secnames = file + sechdrs[hdr->e_shstrndx].sh_offset; ++ for (i = 1; i < hdr->e_shnum; i++) ++ if (strcmp(secnames + sechdrs[i].sh_name, name) == 0) { ++ *secsize = sechdrs[i].sh_size; ++ return file + sechdrs[i].sh_offset; ++ } ++ return NULL; ++} ++ ++static int elf_ident(void *mod, unsigned long size) ++{ ++ /* "\177ELF" <byte> where byte = 001 for 32-bit, 002 for 64 */ ++ char *ident = mod; ++ ++ if (size < EI_CLASS || memcmp(mod, ELFMAG, SELFMAG) != 0) ++ return ELFCLASSNONE; ++ return ident[EI_CLASS]; ++} ++ ++static void *get_section(void *file, ++ unsigned long size, ++ const char *name, ++ unsigned long *secsize) ++{ ++ switch (elf_ident(file, size)) { ++ case ELFCLASS32: ++ return get_section32(file, size, name, secsize); ++ case ELFCLASS64: ++ return get_section64(file, size, name, secsize); ++ default: ++ return NULL; ++ } ++} ++ ++static void rename_module(struct module *module, ++ void *mod, ++ unsigned long len, ++ const char *newname) ++{ ++ void *modstruct; ++ unsigned long modstruct_len; ++ ++ /* Old-style */ ++ modstruct = get_section(mod, len, ".gnu.linkonce.this_module", ++ &modstruct_len); ++ /* New-style */ ++ if (!modstruct) ++ modstruct = get_section(mod, len, "__module", &modstruct_len); ++ if (!modstruct) ++ warn("Could not find module name to change in %s\n", ++ module->filename); ++ else ++ replace_modname(module, modstruct, modstruct_len, ++ module->modname, newname); ++} ++ ++/* Kernel told to ignore these sections if SHF_ALLOC not set. */ ++static void invalidate_section32(void *mod, const char *secname) ++{ ++ Elf32_Ehdr *hdr = mod; ++ Elf32_Shdr *sechdrs = mod + hdr->e_shoff; ++ const char *secnames = mod + sechdrs[hdr->e_shstrndx].sh_offset; ++ unsigned int i; ++ ++ for (i = 1; i < hdr->e_shnum; i++) ++ if (strcmp(secnames+sechdrs[i].sh_name, secname) == 0) ++ sechdrs[i].sh_flags &= ~SHF_ALLOC; ++} ++ ++static void invalidate_section64(void *mod, const char *secname) ++{ ++ Elf64_Ehdr *hdr = mod; ++ Elf64_Shdr *sechdrs = mod + hdr->e_shoff; ++ const char *secnames = mod + sechdrs[hdr->e_shstrndx].sh_offset; ++ unsigned int i; ++ ++ for (i = 1; i < hdr->e_shnum; i++) ++ if (strcmp(secnames+sechdrs[i].sh_name, secname) == 0) ++ sechdrs[i].sh_flags &= ~(unsigned long long)SHF_ALLOC; ++} ++ ++static void strip_section(struct module *module, ++ void *mod, ++ unsigned long len, ++ const char *secname) ++{ ++ switch (elf_ident(mod, len)) { ++ case ELFCLASS32: ++ invalidate_section32(mod, secname); ++ break; ++ case ELFCLASS64: ++ invalidate_section64(mod, secname); ++ break; ++ default: ++ warn("Unknown module format in %s: not forcing version\n", ++ module->filename); ++ } ++} ++ ++static const char *next_string(const char *string, unsigned long *secsize) ++{ ++ /* Skip non-zero chars */ ++ while (string[0]) { ++ string++; ++ if ((*secsize)-- <= 1) ++ return NULL; ++ } ++ ++ /* Skip any zero padding. */ ++ while (!string[0]) { ++ string++; ++ if ((*secsize)-- <= 1) ++ return NULL; ++ } ++ return string; ++} ++ ++static void clear_magic(struct module *module, void *mod, unsigned long len) ++{ ++ const char *p; ++ unsigned long modlen; ++ ++ /* Old-style: __vermagic section */ ++ strip_section(module, mod, len, "__vermagic"); ++ ++ /* New-style: in .modinfo section */ ++ for (p = get_section(mod, len, ".modinfo", &modlen); ++ p; ++ p = next_string(p, &modlen)) { ++ if (strncmp(p, "vermagic=", strlen("vermagic=")) == 0) { ++ memset((char *)p, 0, strlen(p)); ++ return; ++ } ++ } ++} ++ ++struct module_options ++{ ++ struct module_options *next; ++ char *modulename; ++ char *options; ++}; ++ ++struct module_command ++{ ++ struct module_command *next; ++ char *modulename; ++ char *command; ++}; ++ ++struct module_alias ++{ ++ struct module_alias *next; ++ char *module; ++}; ++ ++struct module_blacklist ++{ ++ struct module_blacklist *next; ++ char *modulename; ++}; ++ ++/* Link in a new option line from the config file. */ ++static struct module_options * ++add_options(const char *modname, ++ const char *option, ++ struct module_options *options) ++{ ++ struct module_options *new; ++ char *tab; ++ ++ new = NOFAIL(malloc(sizeof(*new))); ++ new->modulename = NOFAIL(strdup(modname)); ++ new->options = NOFAIL(strdup(option)); ++ /* We can handle tabs, kernel can't. */ ++ for (tab = strchr(new->options, '\t'); tab; tab = strchr(tab, '\t')) ++ *tab = ' '; ++ new->next = options; ++ return new; ++} ++ ++/* Link in a new install line from the config file. */ ++static struct module_command * ++add_command(const char *modname, ++ const char *command, ++ struct module_command *commands) ++{ ++ struct module_command *new; ++ ++ new = NOFAIL(malloc(sizeof(*new))); ++ new->modulename = NOFAIL(strdup(modname)); ++ new->command = NOFAIL(strdup(command)); ++ new->next = commands; ++ return new; ++} ++ ++/* Link in a new alias line from the config file. */ ++static struct module_alias * ++add_alias(const char *modname, struct module_alias *aliases) ++{ ++ struct module_alias *new; ++ ++ new = NOFAIL(malloc(sizeof(*new))); ++ new->module = NOFAIL(strdup(modname)); ++ new->next = aliases; ++ return new; ++} ++ ++/* Link in a new blacklist line from the config file. */ ++static struct module_blacklist * ++add_blacklist(const char *modname, struct module_blacklist *blacklist) ++{ ++ struct module_blacklist *new; ++ ++ new = NOFAIL(malloc(sizeof(*new))); ++ new->modulename = NOFAIL(strdup(modname)); ++ new->next = blacklist; ++ return new; ++} ++ ++/* Find blacklist commands if any. */ ++static int ++find_blacklist(const char *modname, const struct module_blacklist *blacklist) ++{ ++ while (blacklist) { ++ if (strcmp(blacklist->modulename, modname) == 0) ++ return 1; ++ blacklist = blacklist->next; ++ } ++ return 0; ++} ++ ++/* return a new alias list, with backlisted elems filtered out */ ++static struct module_alias * ++apply_blacklist(const struct module_alias *aliases, ++ const struct module_blacklist *blacklist) ++{ ++ struct module_alias *result = NULL; ++ while (aliases) { ++ char *modname = aliases->module; ++ if (!find_blacklist(modname, blacklist)) ++ result = add_alias(modname, result); ++ aliases = aliases->next; ++ } ++ return result; ++} ++ ++/* Find install commands if any. */ ++static const char *find_command(const char *modname, ++ const struct module_command *commands) ++{ ++ while (commands) { ++ if (fnmatch(commands->modulename, modname, 0) == 0) ++ return commands->command; ++ commands = commands->next; ++ } ++ return NULL; ++} ++ ++static char *append_option(char *options, const char *newoption) ++{ ++ options = NOFAIL(realloc(options, strlen(options) + 1 ++ + strlen(newoption) + 1)); ++ if (strlen(options)) strcat(options, " "); ++ strcat(options, newoption); ++ return options; ++} ++ ++/* Add to options */ ++static char *add_extra_options(const char *modname, ++ char *optstring, ++ const struct module_options *options) ++{ ++ while (options) { ++ if (strcmp(options->modulename, modname) == 0) ++ optstring = append_option(optstring, options->options); ++ options = options->next; ++ } ++ return optstring; ++} ++ ++/* If we don't flush, then child processes print before we do */ ++static void verbose_printf(int verbose, const char *fmt, ...) ++{ ++ va_list arglist; ++ ++ if (verbose) { ++ va_start(arglist, fmt); ++ vprintf(fmt, arglist); ++ fflush(stdout); ++ va_end(arglist); ++ } ++} ++ ++/* Do an install/remove command: replace $CMDLINE_OPTS if it's specified. */ ++static void do_command(const char *modname, ++ const char *command, ++ int verbose, int dry_run, ++ errfn_t error, ++ const char *type, ++ const char *cmdline_opts) ++{ ++ int ret; ++ char *p, *replaced_cmd = NOFAIL(strdup(command)); ++ ++ while ((p = strstr(replaced_cmd, "$CMDLINE_OPTS")) != NULL) { ++ char *new; ++ asprintf(&new, "%.*s%s%s", ++ p - replaced_cmd, replaced_cmd, cmdline_opts, ++ p + strlen("$CMDLINE_OPTS")); ++ NOFAIL(new); ++ free(replaced_cmd); ++ replaced_cmd = new; ++ } ++ ++ verbose_printf(verbose, "%s %s\n", type, replaced_cmd); ++ if (dry_run) ++ return; ++ ++ setenv("MODPROBE_MODULE", modname, 1); ++ ret = system(replaced_cmd); ++ if (ret == -1 || WEXITSTATUS(ret)) ++ error("Error running %s command for %s\n", type, modname); ++ free(replaced_cmd); ++} ++ ++/* Actually do the insert. Frees second arg. */ ++static void insmod(struct list_head *list, ++ char *optstring, ++ const char *newname, ++ int first_time, ++ errfn_t error, ++ int dry_run, ++ int verbose, ++ const struct module_options *options, ++ const struct module_command *commands, ++ int ignore_commands, ++ int ignore_proc, ++ int strip_vermagic, ++ int strip_modversion, ++ const char *cmdline_opts) ++{ ++ int ret, fd; ++ unsigned long len; ++ void *map; ++ const char *command; ++ struct module *mod = list_entry(list->next, struct module, list); ++ ++ /* Take us off the list. */ ++ list_del(&mod->list); ++ ++ /* Do things we (or parent) depend on first, but don't die if ++ * they fail. */ ++ if (!list_empty(list)) { ++ insmod(list, NOFAIL(strdup("")), NULL, 0, warn, ++ dry_run, verbose, options, commands, 0, ignore_proc, ++ strip_vermagic, strip_modversion, cmdline_opts); ++ } ++ ++ /* Lock before we look, in case it's initializing. */ ++ fd = lock_file(mod->filename); ++ if (fd < 0) { ++ error("Could not open '%s': %s\n", ++ mod->filename, strerror(errno)); ++ goto out_optstring; ++ } ++ ++ /* Don't do ANYTHING if already in kernel. */ ++ if (!ignore_proc ++ && module_in_kernel(newname ?: mod->modname, NULL) == 1) { ++ if (first_time) ++ error("Module %s already in kernel.\n", ++ newname ?: mod->modname); ++ goto out_unlock; ++ } ++ ++ command = find_command(mod->modname, commands); ++ if (command && !ignore_commands) { ++ /* It might recurse: unlock. */ ++ unlock_file(fd); ++ do_command(mod->modname, command, verbose, dry_run, error, ++ "install", cmdline_opts); ++ goto out_optstring; ++ } ++ ++ map = grab_fd(fd, &len); ++ if (!map) { ++ error("Could not read '%s': %s\n", ++ mod->filename, strerror(errno)); ++ goto out_unlock; ++ } ++ ++ /* Rename it? */ ++ if (newname) ++ rename_module(mod, map, len, newname); ++ ++ if (strip_modversion) ++ strip_section(mod, map, len, "__versions"); ++ if (strip_vermagic) ++ clear_magic(mod, map, len); ++ ++ /* Config file might have given more options */ ++ optstring = add_extra_options(mod->modname, optstring, options); ++ ++ verbose_printf(verbose, "insmod %s %s\n", mod->filename, optstring); ++ ++ if (dry_run) ++ goto out; ++ ++ ret = init_module(map, len, optstring); ++ if (ret != 0) { ++ if (errno == EEXIST) { ++ if (first_time) ++ error("Module %s already in kernel.\n", ++ newname ?: mod->modname); ++ goto out_unlock; ++ } ++ error("Error inserting %s (%s): %s\n", ++ mod->modname, mod->filename, insert_moderror(errno)); ++ } ++ out: ++ release_file(map, len); ++ out_unlock: ++ unlock_file(fd); ++ out_optstring: ++ free(optstring); ++ return; ++} ++ ++/* Do recursive removal. */ ++static void rmmod(struct list_head *list, ++ const char *name, ++ int first_time, ++ errfn_t error, ++ int dry_run, ++ int verbose, ++ struct module_command *commands, ++ int ignore_commands, ++ int ignore_inuse, ++ const char *cmdline_opts) ++{ ++ const char *command; ++ unsigned int usecount = 0; ++ int lock; ++ struct module *mod = list_entry(list->next, struct module, list); ++ ++ /* Take first one off the list. */ ++ list_del(&mod->list); ++ ++ /* Ignore failure; it's best effort here. */ ++ lock = lock_file(mod->filename); ++ ++ if (!name) ++ name = mod->modname; ++ ++ /* Even if renamed, find commands to orig. name. */ ++ command = find_command(mod->modname, commands); ++ if (command && !ignore_commands) { ++ /* It might recurse: unlock. */ ++ unlock_file(lock); ++ do_command(mod->modname, command, verbose, dry_run, error, ++ "remove", cmdline_opts); ++ goto remove_rest_no_unlock; ++ } ++ ++ if (module_in_kernel(name, &usecount) == 0) ++ goto nonexistent_module; ++ ++ if (usecount != 0) { ++ if (!ignore_inuse) ++ error("Module %s is in use.\n", name); ++ goto remove_rest; ++ } ++ ++ verbose_printf(verbose, "rmmod %s\n", mod->filename); ++ ++ if (dry_run) ++ goto remove_rest; ++ ++ if (delete_module(name, O_EXCL) != 0) { ++ if (errno == ENOENT) ++ goto nonexistent_module; ++ error("Error removing %s (%s): %s\n", ++ name, mod->filename, ++ remove_moderror(errno)); ++ } ++ ++ remove_rest: ++ unlock_file(lock); ++ remove_rest_no_unlock: ++ /* Now do things we depend. */ ++ if (!list_empty(list)) ++ rmmod(list, NULL, 0, warn, dry_run, verbose, commands, ++ 0, 1, cmdline_opts); ++ return; ++ ++nonexistent_module: ++ if (first_time) ++ fatal("Module %s is not in kernel.\n", mod->modname); ++ goto remove_rest; ++} ++ ++/* Does path contain directory(s) subpath? */ ++static int type_matches(const char *path, const char *subpath) ++{ ++ char *subpath_with_slashes; ++ int ret; ++ ++ asprintf(&subpath_with_slashes, "/%s/", subpath); ++ NOFAIL(subpath_with_slashes); ++ ++ ret = (strstr(path, subpath_with_slashes) != NULL); ++ free(subpath_with_slashes); ++ return ret; ++} ++ ++static char *underscores(char *string) ++{ ++ if (string) { ++ unsigned int i; ++ for (i = 0; string[i]; i++) ++ if (string[i] == '-') ++ string[i] = '_'; ++ } ++ return string; ++} ++ ++static int do_wildcard(const char *dirname, ++ const char *type, ++ const char *wildcard) ++{ ++ char modules_dep_name[strlen(dirname) + sizeof("modules.dep") + 1]; ++ char *line, *wcard; ++ FILE *modules_dep; ++ ++ /* Canonicalize wildcard */ ++ wcard = strdup(wildcard); ++ underscores(wcard); ++ ++ sprintf(modules_dep_name, "%s/%s", dirname, "modules.dep"); ++ modules_dep = fopen(modules_dep_name, "r"); ++ if (!modules_dep) ++ fatal("Could not load %s: %s\n", ++ modules_dep_name, strerror(errno)); ++ ++ while ((line = getline_wrapped(modules_dep, NULL)) != NULL) { ++ char *ptr; ++ ++ /* Ignore lines without : or which start with a # */ ++ ptr = strchr(line, ':'); ++ if (ptr == NULL || line[strspn(line, "\t ")] == '#') ++ goto next; ++ *ptr = '\0'; ++ ++ /* "type" must match complete directory component(s). */ ++ if (!type || type_matches(line, type)) { ++ char modname[strlen(line)+1]; ++ ++ filename2modname(modname, line); ++ if (fnmatch(wcard, modname, 0) == 0) ++ printf("%s\n", line); ++ } ++ next: ++ free(line); ++ } ++ ++ free(wcard); ++ return 0; ++} ++ ++static char *strsep_skipspace(char **string, char *delim) ++{ ++ if (!*string) ++ return NULL; ++ *string += strspn(*string, delim); ++ return strsep(string, delim); ++} ++ ++/* Recursion */ ++static int read_config(const char *filename, ++ const char *name, ++ int dump_only, ++ int removing, ++ struct module_options **options, ++ struct module_command **commands, ++ struct module_alias **alias, ++ struct module_blacklist **blacklist); ++ ++/* FIXME: Maybe should be extended to "alias a b [and|or c]...". --RR */ ++static int read_config_file(const char *filename, ++ const char *name, ++ int dump_only, ++ int removing, ++ struct module_options **options, ++ struct module_command **commands, ++ struct module_alias **aliases, ++ struct module_blacklist **blacklist) ++{ ++ char *line; ++ unsigned int linenum = 0; ++ FILE *cfile; ++ ++ cfile = fopen(filename, "r"); ++ if (!cfile) ++ return 0; ++ ++ while ((line = getline_wrapped(cfile, &linenum)) != NULL) { ++ char *ptr = line; ++ char *cmd, *modname; ++ ++ if (dump_only) ++ printf("%s\n", line); ++ ++ cmd = strsep_skipspace(&ptr, "\t "); ++ if (cmd == NULL || cmd[0] == '#' || cmd[0] == '\0') ++ continue; ++ ++ if (strcmp(cmd, "alias") == 0) { ++ char *wildcard ++ = underscores(strsep_skipspace(&ptr, "\t ")); ++ char *realname ++ = underscores(strsep_skipspace(&ptr, "\t ")); ++ ++ if (!wildcard || !realname) ++ grammar(cmd, filename, linenum); ++ else if (fnmatch(wildcard,name,0) == 0) ++ *aliases = add_alias(realname, *aliases); ++ } else if (strcmp(cmd, "include") == 0) { ++ struct module_alias *newalias = NULL; ++ char *newfilename; ++ ++ newfilename = strsep_skipspace(&ptr, "\t "); ++ if (!newfilename) ++ grammar(cmd, filename, linenum); ++ else { ++ if (!read_config(newfilename, name, ++ dump_only, removing, ++ options, commands, &newalias, ++ blacklist)) ++ warn("Failed to open included" ++ " config file %s: %s\n", ++ newfilename, strerror(errno)); ++ ++ /* Files included override aliases, ++ etc that was already set ... */ ++ if (newalias) ++ *aliases = newalias; ++ } ++ } else if (strcmp(cmd, "options") == 0) { ++ modname = strsep_skipspace(&ptr, "\t "); ++ if (!modname || !ptr) ++ grammar(cmd, filename, linenum); ++ else { ++ ptr += strspn(ptr, "\t "); ++ *options = add_options(underscores(modname), ++ ptr, *options); ++ } ++ } else if (strcmp(cmd, "install") == 0) { ++ modname = strsep_skipspace(&ptr, "\t "); ++ if (!modname || !ptr) ++ grammar(cmd, filename, linenum); ++ else if (!removing) { ++ ptr += strspn(ptr, "\t "); ++ *commands = add_command(underscores(modname), ++ ptr, *commands); ++ } ++ } else if (strcmp(cmd, "blacklist") == 0) { ++ modname = strsep_skipspace(&ptr, "\t "); ++ if (!modname) ++ grammar(cmd, filename, linenum); ++ else if (!removing) { ++ *blacklist = add_blacklist(underscores(modname), ++ *blacklist); ++ } ++ } else if (strcmp(cmd, "remove") == 0) { ++ modname = strsep_skipspace(&ptr, "\t "); ++ if (!modname || !ptr) ++ grammar(cmd, filename, linenum); ++ else if (removing) { ++ ptr += strspn(ptr, "\t "); ++ *commands = add_command(underscores(modname), ++ ptr, *commands); ++ } ++ } else ++ grammar(cmd, filename, linenum); ++ ++ free(line); ++ } ++ fclose(cfile); ++ return 1; ++} ++ ++/* Simple format, ignore lines starting with #, one command per line. ++ Returns true or false. */ ++static int read_config(const char *filename, ++ const char *name, ++ int dump_only, ++ int removing, ++ struct module_options **options, ++ struct module_command **commands, ++ struct module_alias **aliases, ++ struct module_blacklist **blacklist) ++{ ++ DIR *dir; ++ int ret = 0; ++ ++ /* ignore everything in this directory */ ++ if (streq(filename, "/etc/modprobe.d/arch")) ++ return 1; ++ ++ /* Reiser4 has file/directory duality: treat it as both. */ ++ dir = opendir(filename); ++ if (dir) { ++ struct dirent *i; ++ while ((i = readdir(dir)) != NULL) { ++ if (!streq(i->d_name,".") && !streq(i->d_name,"..")) { ++ char sub[strlen(filename) + 1 ++ + strlen(i->d_name) + 1]; ++ ++ sprintf(sub, "%s/%s", filename, i->d_name); ++ if (!read_config(sub, name, ++ dump_only, removing, options, ++ commands, aliases, blacklist)) ++ warn("Failed to open" ++ " config file %s: %s\n", ++ sub, strerror(errno)); ++ } ++ } ++ closedir(dir); ++ ret = 1; ++ } ++ ++ if (read_config_file(filename, name, dump_only, removing, ++ options, commands, aliases, blacklist)) ++ ret = 1; ++ ++ return ret; ++} ++ ++static const char *default_configs[] = ++{ ++ "/etc/modprobe.conf", ++ "/etc/modprobe.d", ++}; ++ ++static void read_toplevel_config(const char *filename, ++ const char *name, ++ int dump_only, ++ int removing, ++ struct module_options **options, ++ struct module_command **commands, ++ struct module_alias **aliases, ++ struct module_blacklist **blacklist) ++{ ++ unsigned int i; ++ ++ if (filename) { ++ if (!read_config(filename, name, dump_only, removing, ++ options, commands, aliases, blacklist)) ++ fatal("Failed to open config file %s: %s\n", ++ filename, strerror(errno)); ++ return; ++ } ++ ++ /* Try defaults. */ ++ for (i = 0; i < ARRAY_SIZE(default_configs); i++) { ++ if (read_config(default_configs[i], name, dump_only, removing, ++ options, commands, aliases, blacklist)) ++ return; ++ } ++} ++ ++static void add_to_env_var(const char *option) ++{ ++ const char *oldenv; ++ ++ if ((oldenv = getenv("MODPROBE_OPTIONS")) != NULL) { ++ char *newenv; ++ asprintf(&newenv, "%s %s", oldenv, option); ++ setenv("MODPROBE_OPTIONS", newenv, 1); ++ } else ++ setenv("MODPROBE_OPTIONS", option, 1); ++} ++ ++/* Prepend options from environment. */ ++static char **merge_args(char *args, char *argv[], int *argc) ++{ ++ char *arg, *argstring; ++ char **newargs = NULL; ++ unsigned int i, num_env = 0; ++ ++ if (!args) ++ return argv; ++ ++ argstring = NOFAIL(strdup(args)); ++ for (arg = strtok(argstring, " "); arg; arg = strtok(NULL, " ")) { ++ num_env++; ++ newargs = NOFAIL(realloc(newargs, ++ sizeof(newargs[0]) ++ * (num_env + *argc + 1))); ++ newargs[num_env] = arg; ++ } ++ ++ /* Append commandline args */ ++ newargs[0] = argv[0]; ++ for (i = 1; i <= *argc; i++) ++ newargs[num_env+i] = argv[i]; ++ ++ *argc += num_env; ++ return newargs; ++} ++ ++static char *gather_options(char *argv[]) ++{ ++ char *optstring = NOFAIL(strdup("")); ++ ++ /* Rest is module options */ ++ while (*argv) { ++ /* Quote value if it contains spaces. */ ++ unsigned int eq = strcspn(*argv, "="); ++ ++ if (strchr(*argv+eq, ' ') && !strchr(*argv, '"')) { ++ char quoted[strlen(*argv) + 3]; ++ (*argv)[eq] = '\0'; ++ sprintf(quoted, "%s=\"%s\"", *argv, *argv+eq+1); ++ optstring = append_option(optstring, quoted); ++ } else ++ optstring = append_option(optstring, *argv); ++ argv++; ++ } ++ return optstring; ++} ++ ++static void handle_module(const char *modname, ++ struct list_head *todo_list, ++ const char *newname, ++ int remove, ++ char *options, ++ int first_time, ++ errfn_t error, ++ int dry_run, ++ int verbose, ++ struct module_options *modoptions, ++ struct module_command *commands, ++ int ignore_commands, ++ int ignore_proc, ++ int strip_vermagic, ++ int strip_modversion, ++ int unknown_silent, ++ const char *cmdline_opts) ++{ ++ if (list_empty(todo_list)) { ++ const char *command; ++ ++ /* The dependencies have to be real modules, but ++ handle case where the first is completely bogus. */ ++ command = find_command(modname, commands); ++ if (command && !ignore_commands) { ++ do_command(modname, command, verbose, dry_run, error, ++ remove ? "remove":"install", cmdline_opts); ++ return; ++ } ++ ++ if (unknown_silent) ++ exit(1); ++ error("Module %s not found.\n", modname); ++ return; ++ } ++ ++ if (remove) ++ rmmod(todo_list, newname, first_time, error, dry_run, verbose, ++ commands, ignore_commands, 0, cmdline_opts); ++ else ++ insmod(todo_list, NOFAIL(strdup(options)), newname, ++ first_time, error, dry_run, verbose, modoptions, ++ commands, ignore_commands, ignore_proc, strip_vermagic, ++ strip_modversion, cmdline_opts); ++} ++ ++static struct option options[] = { { "verbose", 0, NULL, 'v' }, ++ { "version", 0, NULL, 'V' }, ++ { "config", 1, NULL, 'C' }, ++ { "name", 1, NULL, 'o' }, ++ { "remove", 0, NULL, 'r' }, ++ { "showconfig", 0, NULL, 'c' }, ++ { "autoclean", 0, NULL, 'k' }, ++ { "quiet", 0, NULL, 'q' }, ++ { "show", 0, NULL, 'n' }, ++ { "dry-run", 0, NULL, 'n' }, ++ { "syslog", 0, NULL, 's' }, ++ { "type", 1, NULL, 't' }, ++ { "list", 0, NULL, 'l' }, ++ { "all", 0, NULL, 'a' }, ++ { "ignore-install", 0, NULL, 'i' }, ++ { "ignore-remove", 0, NULL, 'i' }, ++ { "force", 0, NULL, 'f' }, ++ { "force-vermagic", 0, NULL, 1 }, ++ { "force-modversion", 0, NULL, 2 }, ++ { "set-version", 1, NULL, 'S' }, ++ { "show-depends", 0, NULL, 'D' }, ++ { "first-time", 0, NULL, 3 }, ++ { "use-blacklist", 0, NULL, 'b' }, ++ { NULL, 0, NULL, 0 } }; ++ ++#define MODPROBE_DEVFSD_CONF "/etc/modprobe.devfs" ++ ++/* This is a horrible hack to allow devfsd, which calls modprobe with ++ -C /etc/modules.conf or /etc/modules.devfs, to work. FIXME. */ ++/* Modern devfsd or variants should use -q explicitly in 2.6. */ ++static int is_devfs_call(char *argv[]) ++{ ++ unsigned int i; ++ ++ /* Look for "/dev" arg */ ++ for (i = 1; argv[i]; i++) { ++ if (strncmp(argv[i], "/dev/", 5) == 0) ++ return 1; ++ } ++ return 0; ++} ++ ++int main(int argc, char *argv[]) ++{ ++ struct utsname buf; ++ struct stat statbuf; ++ int opt; ++ int dump_only = 0; ++ int dry_run = 0; ++ int remove = 0; ++ int verbose = 0; ++ int unknown_silent = 0; ++ int list_only = 0; ++ int all = 0; ++ int ignore_commands = 0; ++ int strip_vermagic = 0; ++ int strip_modversion = 0; ++ int ignore_proc = 0; ++ int first_time = 0; ++ int use_blacklist = 0; ++ unsigned int i, num_modules; ++ char *type = NULL; ++ const char *config = NULL; ++ char *dirname, *optstring; ++ char *newname = NULL; ++ char *aliasfilename, *symfilename; ++ errfn_t error = fatal; ++ ++ /* Prepend options from environment. */ ++ argv = merge_args(getenv("MODPROBE_OPTIONS"), argv, &argc); ++ ++ /* --set-version overrides version, and disables backwards compat. */ ++ for (opt = 1; opt < argc; opt++) ++ if (strncmp(argv[opt],"--set-version",strlen("--set-version")) ++ == 0) ++ break; ++ ++ if (opt == argc) ++ try_old_version("modprobe", argv); ++ ++ uname(&buf); ++ while ((opt = getopt_long(argc, argv, "vVC:o:rknqQsclt:aifb", options, NULL)) != -1){ ++ switch (opt) { ++ case 'v': ++ add_to_env_var("-v"); ++ verbose = 1; ++ break; ++ case 'V': ++ puts("module-init-tools version 3.2.2"); ++ exit(0); ++ case 'S': ++ strncpy(buf.release, optarg, sizeof(buf.release)); ++ buf.release[sizeof(buf.release)-1] = '\0'; ++ break; ++ case 'C': ++ if (is_devfs_call(argv)) { ++ if (streq("/etc/modules.devfs", optarg)) { ++ config = MODPROBE_DEVFSD_CONF; ++ add_to_env_var("-C"); ++ add_to_env_var(config); ++ /* Fall thru to -q */ ++ } else if (streq("/etc/modules.conf", optarg)) ++ /* Ignore config, fall thru to -q */ ++ ; ++ else { ++ /* False alarm. Treat as normal. */ ++ config = optarg; ++ add_to_env_var("-C"); ++ add_to_env_var(config); ++ break; ++ } ++ } else { ++ config = optarg; ++ add_to_env_var("-C"); ++ add_to_env_var(config); ++ break; ++ } ++ case 'q': ++ unknown_silent = 1; ++ add_to_env_var("-q"); ++ break; ++ case 'D': ++ dry_run = 1; ++ ignore_proc = 1; ++ verbose = 1; ++ add_to_env_var("-D"); ++ break; ++ case 'o': ++ newname = optarg; ++ break; ++ case 'r': ++ remove = 1; ++ break; ++ case 'c': ++ dump_only = 1; ++ break; ++ case 't': ++ type = optarg; ++ break; ++ case 'l': ++ list_only = 1; ++ break; ++ case 'a': ++ all = 1; ++ error = warn; ++ break; ++ case 'k': ++ /* FIXME: This should actually do something */ ++ break; ++ case 'n': ++ dry_run = 1; ++ break; ++ case 's': ++ add_to_env_var("-s"); ++ log = 1; ++ break; ++ case 'i': ++ ignore_commands = 1; ++ break; ++ case 'f': ++ strip_vermagic = 1; ++ strip_modversion = 1; ++ break; ++ case 'b': ++ use_blacklist = 1; ++ break; ++ case 1: ++ strip_vermagic = 1; ++ break; ++ case 2: ++ strip_modversion = 1; ++ break; ++ case 3: ++ first_time = 1; ++ break; ++ default: ++ print_usage(argv[0]); ++ } ++ } ++ ++ /* If stderr not open, go to syslog */ ++ if (log || fstat(STDERR_FILENO, &statbuf) != 0) { ++ openlog("modprobe", LOG_CONS, LOG_DAEMON); ++ log = 1; ++ } ++ ++ if (argc < optind + 1 && !dump_only && !list_only && !remove) ++ print_usage(argv[0]); ++ ++ dirname = NOFAIL(malloc(strlen(buf.release) + sizeof(MODULE_DIR) + 1)); ++ sprintf(dirname, "%s/%s", MODULE_DIR, buf.release); ++ aliasfilename = NOFAIL(malloc(strlen(dirname) ++ + sizeof("/modules.alias"))); ++ sprintf(aliasfilename, "%s/modules.alias", dirname); ++ symfilename = NOFAIL(malloc(strlen(dirname) ++ + sizeof("/modules.symbols"))); ++ sprintf(symfilename, "%s/modules.symbols", dirname); ++ ++ /* Old-style -t xxx wildcard? Only with -l. */ ++ if (list_only) { ++ if (optind+1 < argc) ++ fatal("Can't have multiple wildcards\n"); ++ /* fprintf(stderr, "man find\n"); return 1; */ ++ return do_wildcard(dirname, type, argv[optind]?:"*"); ++ } ++ if (type) ++ fatal("-t only supported with -l"); ++ ++ if (dump_only) { ++ struct module_command *commands = NULL; ++ struct module_options *modoptions = NULL; ++ struct module_alias *aliases = NULL; ++ struct module_blacklist *blacklist = NULL; ++ ++ read_toplevel_config(config, "", 1, 0, ++ &modoptions, &commands, &aliases, &blacklist); ++ read_config(aliasfilename, "", 1, 0,&modoptions, &commands, ++ &aliases, &blacklist); ++ read_config(symfilename, "", 1, 0, &modoptions, &commands, ++ &aliases, &blacklist); ++ exit(0); ++ } ++ ++ if (remove || all) { ++ num_modules = argc - optind; ++ optstring = NOFAIL(strdup("")); ++ } else { ++ num_modules = 1; ++ optstring = gather_options(argv+optind+1); ++ } ++ ++ /* num_modules is always 1 except for -r or -a. */ ++ for (i = 0; i < num_modules; i++) { ++ struct module_command *commands = NULL; ++ struct module_options *modoptions = NULL; ++ struct module_alias *aliases = NULL; ++ struct module_blacklist *blacklist = NULL; ++ LIST_HEAD(list); ++ char *modulearg = argv[optind + i]; ++ ++ /* Convert name we are looking for */ ++ underscores(modulearg); ++ ++ /* Returns the resolved alias, options */ ++ read_toplevel_config(config, modulearg, 0, ++ remove, &modoptions, &commands, &aliases, &blacklist); ++ ++ /* No luck? Try symbol names, if starts with symbol:. */ ++ if (!aliases ++ && strncmp(modulearg, "symbol:", strlen("symbol:")) == 0) ++ read_config(symfilename, modulearg, 0, ++ remove, &modoptions, &commands, ++ &aliases, &blacklist); ++ ++ if (!aliases) { ++ /* We only use canned aliases as last resort. */ ++ read_depends(dirname, modulearg, &list); ++ ++ if (list_empty(&list) ++ && !find_command(modulearg, commands)) ++ { ++ read_config(aliasfilename, modulearg, 0, ++ remove, &modoptions, &commands, ++ &aliases, &blacklist); ++ aliases = apply_blacklist(aliases, blacklist); ++ } ++ } ++ ++ if (aliases) { ++ errfn_t err = error; ++ ++ /* More than one alias? Don't bail out on failure. */ ++ if (aliases->next) ++ err = warn; ++ while (aliases) { ++ /* Add the options for this alias. */ ++ char *opts = NOFAIL(strdup(optstring)); ++ opts = add_extra_options(modulearg, ++ opts, modoptions); ++ ++ read_depends(dirname, aliases->module, &list); ++ handle_module(aliases->module, &list, newname, ++ remove, opts, first_time, err, ++ dry_run, verbose, modoptions, ++ commands, ignore_commands, ++ ignore_proc, strip_vermagic, ++ strip_modversion, ++ unknown_silent, ++ optstring); ++ ++ aliases = aliases->next; ++ INIT_LIST_HEAD(&list); ++ } ++ } else { ++ if (use_blacklist ++ && find_blacklist(modulearg, blacklist)) ++ continue; ++ ++ handle_module(modulearg, &list, newname, remove, ++ optstring, first_time, error, dry_run, ++ verbose, modoptions, commands, ++ ignore_commands, ignore_proc, ++ strip_vermagic, strip_modversion, ++ unknown_silent, optstring); ++ } ++ } ++ if (log) ++ closelog(); ++ ++ return 0; ++} diff --git a/recipes/klibc/klibc-1.5/staging.patch b/recipes/klibc/klibc-1.5/staging.patch new file mode 100644 index 0000000000..cb426ac267 --- /dev/null +++ b/recipes/klibc/klibc-1.5/staging.patch @@ -0,0 +1,144 @@ +Index: klibc-1.5/Makefile +=================================================================== +--- klibc-1.5.orig/Makefile 2007-03-04 02:52:10.000000000 +0100 ++++ klibc-1.5/Makefile 2008-02-24 15:25:15.213824149 +0100 +@@ -33,7 +33,7 @@ + export PERL := perl + + # Location for installation +-export prefix = /usr ++export prefix = $(INST) + export bindir = $(prefix)/bin + export libdir = $(prefix)/lib + export mandir = $(prefix)/man +Index: klibc-1.5/scripts/Kbuild.install +=================================================================== +--- klibc-1.5.orig/scripts/Kbuild.install 2007-03-04 02:52:10.000000000 +0100 ++++ klibc-1.5/scripts/Kbuild.install 2008-02-24 15:24:28.085825030 +0100 +@@ -88,25 +88,21 @@ + header: + $(Q)echo " INSTALL headers + man pages to $(INSTALLROOT)$(INSTALLDIR)" + $(Q)mkdir -p $(INSTALLROOT)$(bindir) +- $(Q)mkdir -p $(INSTALLROOT)$(mandir)/man1 +- $(Q)mkdir -p $(INSTALLROOT)$(SHLIBDIR) + $(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR) + $(Q)-rm -rf $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include + $(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include + $(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)lib +- $(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)bin + $(Q)set -e ; for d in linux scsi asm-$(KLIBCARCH) asm-generic $(ASMKLIBCARCH); do \ + mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KLIBCCROSS)include/$$d ; \ + for r in $(KLIBCKERNELSRC)/include $(KLIBCKERNELOBJ)/include \ + $(KLIBCKERNELOBJ)/include2 ; do \ + [ ! -d $$r/$$d ] || \ +- cp -rfL $$r/$$d/. \ ++ cp -rfd $$r/$$d/. \ + $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include/$$d/. ; \ + done ; \ + done + $(Q)cd $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include && ln -sf asm-$(KLIBCARCH) asm + $(Q)cp -rf usr/include/. $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include/. +- $(Q)$(install-data) $(srctree)/klcc/klcc.1 $(INSTALLROOT)$(mandir)/man1/$(KCROSS)klcc.1 + $(Q)$(install-bin) $(objtree)/klcc/$(KCROSS)klcc $(INSTALLROOT)$(bindir) + + footer: header +Index: klibc-1.5/usr/dash/Kbuild +=================================================================== +--- klibc-1.5.orig/usr/dash/Kbuild 2007-03-04 02:52:10.000000000 +0100 ++++ klibc-1.5/usr/dash/Kbuild 2008-02-24 15:13:50.189827040 +0100 +@@ -107,5 +107,3 @@ + $(obj)/arith.c: $(obj)/arith.h + $(Q): + +-# Targets to install +-install-y := sh.shared +Index: klibc-1.5/usr/gzip/Kbuild +=================================================================== +--- klibc-1.5.orig/usr/gzip/Kbuild 2007-03-04 02:52:10.000000000 +0100 ++++ klibc-1.5/usr/gzip/Kbuild 2008-02-24 15:13:50.197824604 +0100 +@@ -21,5 +21,3 @@ + # Cleaning + targets := gzip gzip.g gunzip zcat + +-# Targets to install +-install-y := gzip gunzip zcat +Index: klibc-1.5/usr/kinit/fstype/Kbuild +=================================================================== +--- klibc-1.5.orig/usr/kinit/fstype/Kbuild 2007-03-04 02:52:10.000000000 +0100 ++++ klibc-1.5/usr/kinit/fstype/Kbuild 2008-02-24 15:13:50.201824503 +0100 +@@ -21,5 +21,3 @@ + # Cleaning + clean-dirs := static shared + +-# install binary +-install-y := $(shared-y) +Index: klibc-1.5/usr/kinit/ipconfig/Kbuild +=================================================================== +--- klibc-1.5.orig/usr/kinit/ipconfig/Kbuild 2007-03-04 02:52:10.000000000 +0100 ++++ klibc-1.5/usr/kinit/ipconfig/Kbuild 2008-02-24 15:13:50.205824123 +0100 +@@ -27,5 +27,3 @@ + # Cleaning + clean-dirs := static shared + +-# install binary +-install-y := $(shared-y) +Index: klibc-1.5/usr/kinit/Kbuild +=================================================================== +--- klibc-1.5.orig/usr/kinit/Kbuild 2007-03-04 02:52:10.000000000 +0100 ++++ klibc-1.5/usr/kinit/Kbuild 2008-02-24 15:13:50.209824302 +0100 +@@ -33,5 +33,3 @@ + subdir- := fstype ipconfig nfsmount resume run-init + + +-# install binary +-install-y := kinit kinit.shared +Index: klibc-1.5/usr/kinit/nfsmount/Kbuild +=================================================================== +--- klibc-1.5.orig/usr/kinit/nfsmount/Kbuild 2007-03-04 02:52:10.000000000 +0100 ++++ klibc-1.5/usr/kinit/nfsmount/Kbuild 2008-02-24 15:13:50.213824201 +0100 +@@ -23,5 +23,3 @@ + + clean-dirs := static shared + +-# Install binary +-install-y := $(shared-y) +Index: klibc-1.5/usr/kinit/resume/Kbuild +=================================================================== +--- klibc-1.5.orig/usr/kinit/resume/Kbuild 2007-03-04 02:52:10.000000000 +0100 ++++ klibc-1.5/usr/kinit/resume/Kbuild 2008-02-24 15:13:50.217824380 +0100 +@@ -26,5 +26,3 @@ + # Cleaning + clean-dirs := static shared + +-# install binary +-install-y := $(shared-y) +Index: klibc-1.5/usr/kinit/run-init/Kbuild +=================================================================== +--- klibc-1.5.orig/usr/kinit/run-init/Kbuild 2007-03-04 02:52:10.000000000 +0100 ++++ klibc-1.5/usr/kinit/run-init/Kbuild 2008-02-24 15:13:50.221824559 +0100 +@@ -21,5 +21,3 @@ + # Cleaning + clean-dirs := static shared + +-# install binary +-install-y := $(shared-y) +Index: klibc-1.5/usr/klibc/Kbuild +=================================================================== +--- klibc-1.5.orig/usr/klibc/Kbuild 2007-03-04 02:52:10.000000000 +0100 ++++ klibc-1.5/usr/klibc/Kbuild 2008-02-24 15:13:50.229824358 +0100 +@@ -175,5 +175,3 @@ + $(INSTALLROOT)$(INSTALLDIR)/$(KLIBCCROSS)lib)) + $(Q)$(install-lib) $(obj)/klibc-$(SOLIBHASH).so \ + $(INSTALLROOT)$(INSTALLDIR)/$(KLIBCCROSS)lib +- $(Q)$(install-lib) $(obj)/klibc-$(SOLIBHASH).so \ +- $(INSTALLROOT)$(SHLIBDIR) +Index: klibc-1.5/usr/utils/Kbuild +=================================================================== +--- klibc-1.5.orig/usr/utils/Kbuild 2007-03-04 02:52:10.000000000 +0100 ++++ klibc-1.5/usr/utils/Kbuild 2008-02-24 15:13:50.229824358 +0100 +@@ -64,5 +64,3 @@ + # Clean deletes the static and shared dir + clean-dirs := static shared + +-# install only install the shared binaries +-install-y := $(shared-y) shared/reboot shared/poweroff diff --git a/recipes/klibc/klibc-1.5/wc.patch b/recipes/klibc/klibc-1.5/wc.patch new file mode 100644 index 0000000000..301679799f --- /dev/null +++ b/recipes/klibc/klibc-1.5/wc.patch @@ -0,0 +1,236 @@ +Index: klibc-1.5/usr/utils/Kbuild +=================================================================== +--- klibc-1.5.orig/usr/utils/Kbuild 2008-04-14 23:21:57.702294843 +0200 ++++ klibc-1.5/usr/utils/Kbuild 2008-04-14 23:24:38.817291977 +0200 +@@ -3,7 +3,7 @@ + # + + progs := chroot dd mkdir mkfifo mknod mount pivot_root umount +-progs += true false sleep ln nuke minips cat losetup ++progs += true false sleep ln nuke minips cat losetup wc + progs += insmod uname halt kill readlink cpio modprobe + + static-y := $(addprefix static/, $(progs)) +@@ -56,6 +56,9 @@ + shared/modprobe-y := modprobe.o + static/losetup-y := losetup.o + shared/losetup-y := losetup.o ++static/wc-y := wc.o ++shared/wc-y := wc.o ++ + # Additionally linked targets + always := static/reboot static/poweroff shared/reboot shared/poweroff + +Index: klibc-1.5/usr/utils/wc.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ klibc-1.5/usr/utils/wc.c 2008-04-14 23:25:15.449292711 +0200 +@@ -0,0 +1,208 @@ ++/* vi: set sw=4 ts=4: */ ++/* ++ * wc implementation for busybox ++ * ++ * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org> ++ * ++ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. ++ */ ++ ++/* BB_AUDIT SUSv3 _NOT_ compliant -- option -m is not currently supported. */ ++/* http://www.opengroup.org/onlinepubs/007904975/utilities/wc.html */ ++ ++/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org) ++ * ++ * Rewritten to fix a number of problems and do some size optimizations. ++ * Problems in the previous busybox implementation (besides bloat) included: ++ * 1) broken 'wc -c' optimization (read note below) ++ * 2) broken handling of '-' args ++ * 3) no checking of ferror on EOF returns ++ * 4) isprint() wasn't considered when word counting. ++ * ++ * TODO: ++ * ++ * When locale support is enabled, count multibyte chars in the '-m' case. ++ * ++ * NOTES: ++ * ++ * The previous busybox wc attempted an optimization using stat for the ++ * case of counting chars only. I omitted that because it was broken. ++ * It didn't take into account the possibility of input coming from a ++ * pipe, or input from a file with file pointer not at the beginning. ++ * ++ * To implement such a speed optimization correctly, not only do you ++ * need the size, but also the file position. Note also that the ++ * file position may be past the end of file. Consider the example ++ * (adapted from example in gnu wc.c) ++ * ++ * echo hello > /tmp/testfile && ++ * (dd ibs=1k skip=1 count=0 &> /dev/null; wc -c) < /tmp/testfile ++ * ++ * for which 'wc -c' should output '0'. ++ */ ++#include <stdio.h> ++#include <stdlib.h> ++#include <string.h> ++#include <unistd.h> ++#undef isspace ++#undef isprint ++#define isspace(c) ((((c) == ' ') || (((unsigned int)((c) - 9)) <= (13 - 9)))) ++#define isprint(c) (((unsigned int)((c) - 0x20)) <= (0x7e - 0x20)) ++#define isspace_given_isprint(c) ((c) == ' ') ++ ++#define COUNT_T unsigned long ++#define COUNT_FMT "u" ++#define optind 1 ++FILE *fopen_or_warn_stdin(const char *filename) ++{ ++ FILE *fp = stdin; ++ ++ if (filename[0]) { ++ fp = fopen(filename, "r"); ++ } ++ ++ return fp; ++} ++ ++enum { ++ WC_LINES = 0, ++ WC_WORDS = 1, ++ WC_CHARS = 2, ++ WC_LENGTH = 3 ++}; ++ ++int main(int argc, char **argv) ++{ ++ FILE *fp; ++ const char *s, *arg; ++ const char *start_fmt = "%9"COUNT_FMT; ++ const char *fname_fmt = " %s\n"; ++ COUNT_T *pcounts; ++ COUNT_T counts[4]; ++ COUNT_T totals[4]; ++ unsigned linepos; ++ unsigned u; ++ int num_files = 0; ++ int c; ++ signed char status = EXIT_SUCCESS; ++ signed char in_word; ++ unsigned print_type; ++ ++ print_type = getopt(argc, argv, "lwcL"); ++ ++ if (print_type == 0) { ++ print_type = (1 << WC_LINES) | (1 << WC_WORDS) | (1 << WC_CHARS); ++ } ++ ++ argv += optind; ++ if (!argv[0]) { ++ *--argv = (char *) "wc"; ++ fname_fmt = "\n"; ++ if (!((print_type-1) & print_type)) /* exactly one option? */ ++ start_fmt = "%"COUNT_FMT; ++ } ++ ++ memset(totals, 0, sizeof(totals)); ++ ++ pcounts = counts; ++ ++ while ((arg = *argv++) != 0) { ++ ++num_files; ++ fp = fopen_or_warn_stdin(arg); ++ if (!fp) { ++ status = EXIT_FAILURE; ++ continue; ++ } ++ ++ memset(counts, 0, sizeof(counts)); ++ linepos = 0; ++ in_word = 0; ++ ++ do { ++ /* Our -w doesn't match GNU wc exactly... oh well */ ++ ++ ++counts[WC_CHARS]; ++ c = getc(fp); ++ if (isprint(c)) { ++ ++linepos; ++ if (!isspace_given_isprint(c)) { ++ in_word = 1; ++ continue; ++ } ++ } else if (((unsigned int)(c - 9)) <= 4) { ++ /* \t 9 ++ * \n 10 ++ * \v 11 ++ * \f 12 ++ * \r 13 ++ */ ++ if (c == '\t') { ++ linepos = (linepos | 7) + 1; ++ } else { /* '\n', '\r', '\f', or '\v' */ ++ DO_EOF: ++ if (linepos > counts[WC_LENGTH]) { ++ counts[WC_LENGTH] = linepos; ++ } ++ if (c == '\n') { ++ ++counts[WC_LINES]; ++ } ++ if (c != '\v') { ++ linepos = 0; ++ } ++ } ++ } else if (c == EOF) { ++/* if (ferror(fp)) { ++ status = EXIT_FAILURE; ++ } ++*/ --counts[WC_CHARS]; ++ goto DO_EOF; /* Treat an EOF as '\r'. */ ++ } else { ++ continue; ++ } ++ ++ counts[WC_WORDS] += in_word; ++ in_word = 0; ++ if (c == EOF) { ++ break; ++ } ++ } while (1); ++ ++ if (totals[WC_LENGTH] < counts[WC_LENGTH]) { ++ totals[WC_LENGTH] = counts[WC_LENGTH]; ++ } ++ totals[WC_LENGTH] -= counts[WC_LENGTH]; ++ ++ if(fp != stdin) ++ fclose(fp); ++ ++ OUTPUT: ++ /* coreutils wc tries hard to print pretty columns ++ * (saves results for all files, find max col len etc...) ++ * we won't try that hard, it will bloat us too much */ ++ s = start_fmt; ++ u = 0; ++ do { ++ if (print_type & (1 << u)) { ++ printf(s, pcounts[u]); ++ s = " %9"COUNT_FMT; /* Ok... restore the leading space. */ ++ } ++ totals[u] += pcounts[u]; ++ } while (++u < 4); ++ printf(fname_fmt, arg); ++ } ++ ++ /* If more than one file was processed, we want the totals. To save some ++ * space, we set the pcounts ptr to the totals array. This has the side ++ * effect of trashing the totals array after outputting it, but that's ++ * irrelavent since we no longer need it. */ ++ if (num_files > 1) { ++ num_files = 0; /* Make sure we don't get here again. */ ++ arg = "total"; ++ pcounts = totals; ++ --argv; ++ goto OUTPUT; ++ } ++ ++ fflush(stdout); ++ exit(status); ++} diff --git a/recipes/klibc/klibc-common_1.5.15.inc b/recipes/klibc/klibc-common_1.5.15.inc new file mode 100644 index 0000000000..58ed99a2dd --- /dev/null +++ b/recipes/klibc/klibc-common_1.5.15.inc @@ -0,0 +1,42 @@ +DEPENDS = "virtual/kernel perl-native" +SECTION = "libs" +DESCRIPTION = "klibc is intended to be a minimalistic libc subset for \ +use with initramfs. It is deliberately written for small size, \ +minimal entaglement, and portability, not speed." +LICENSE = "BSD-ADV" +SRC_URI = "${KERNELORG_MIRROR}/pub/linux/libs/klibc/Testing/klibc-${PV}.tar.bz2 \ + file://fstype-sane-vfat-and-jffs2-for-1.5.patch;patch=1 \ + file://modprobe.patch;patch=1 \ + file://losetup.patch;patch=1 \ + file://dash_readopt.patch;patch=1 \ + file://wc.patch;patch=1 \ + " +S = "${WORKDIR}/klibc-${PV}" +PACKAGE_ARCH = "${MACHINE_ARCH}" + +KLIBC_ARCH = '${TARGET_ARCH}' +KLIBC_ARCH_armeb = 'arm' +KLIBC_ARCH_mipsel = 'mips' +KLIBC_ARCH_x86 = 'i386' +KLIBC_ARCH_i486 = 'i386' +KLIBC_ARCH_i586 = 'i386' +KLIBC_ARCH_i686 = 'i386' +KLIBC_ARCH_pentium = 'i386' + +# the klibc code contains ARM instructions (for ARM), this +# could be fixed, but for the moment: +ARM_INSTRUCTION_SET = "arm" + +SRC_URI_append_linux-gnueabi = "file://klibc-config-eabi.patch;patch=1 \ + " +SRC_URI_append_linux-uclibcgnueabi = "file://klibc-config-eabi.patch;patch=1 \ + " + +EXTRA_OEMAKE = "'KLIBCARCH=${KLIBC_ARCH}' \ + 'CROSS_COMPILE=${TARGET_PREFIX}' \ + " + +do_configure () { + ln -sf ${STAGING_KERNEL_DIR} linux +} + diff --git a/recipes/klibc/klibc-utils-static_1.5.15.bb b/recipes/klibc/klibc-utils-static_1.5.15.bb new file mode 100644 index 0000000000..5717886d68 --- /dev/null +++ b/recipes/klibc/klibc-utils-static_1.5.15.bb @@ -0,0 +1,98 @@ +require klibc-common_1.5.15.inc + +PR = "r1" + +# We only want the static utils. klibc build both. So we install only what we want. +do_install() { + install -d ${D}${base_bindir} + install -d ${D}${base_sbindir} + install -m 755 usr/dash/sh ${D}${base_bindir} + install -m 755 usr/gzip/gzip ${D}${base_bindir} + install -m 755 usr/kinit/kinit ${D}${base_bindir} + install -m 755 usr/kinit/fstype/static/fstype ${D}${base_bindir} + install -m 755 usr/kinit/ipconfig/static/ipconfig ${D}${base_bindir} + install -m 755 usr/kinit/nfsmount/static/nfsmount ${D}${base_bindir} + install -m 755 usr/kinit/resume/static/resume ${D}${base_bindir} + install -m 755 usr/kinit/run-init/static/run-init ${D}${base_bindir} + install -m 755 usr/utils/static/cat ${D}${base_bindir} + install -m 755 usr/utils/static/chroot ${D}${base_bindir} + install -m 755 usr/utils/static/cpio ${D}${base_bindir} + install -m 755 usr/utils/static/dd ${D}${base_bindir} + install -m 755 usr/utils/static/false ${D}${base_bindir} + install -m 755 usr/utils/static/halt ${D}${base_bindir} + install -m 755 usr/utils/static/kill ${D}${base_bindir} + install -m 755 usr/utils/static/ln ${D}${base_bindir} + install -m 755 usr/utils/static/minips ${D}${base_bindir} + install -m 755 usr/utils/static/mkdir ${D}${base_bindir} + install -m 755 usr/utils/static/mkfifo ${D}${base_bindir} + install -m 755 usr/utils/static/mknod ${D}${base_bindir} + install -m 755 usr/utils/static/mount ${D}${base_bindir} + install -m 755 usr/utils/static/nuke ${D}${base_bindir} + install -m 755 usr/utils/static/pivot_root ${D}${base_bindir} + install -m 755 usr/utils/static/poweroff ${D}${base_bindir} + install -m 755 usr/utils/static/readlink ${D}${base_bindir} + install -m 755 usr/utils/static/reboot ${D}${base_bindir} + install -m 755 usr/utils/static/sleep ${D}${base_bindir} + install -m 755 usr/utils/static/true ${D}${base_bindir} + install -m 755 usr/utils/static/umount ${D}${base_bindir} + install -m 755 usr/utils/static/uname ${D}${base_bindir} + install -m 755 usr/utils/static/modprobe ${D}${base_sbindir} + install -m 755 usr/utils/static/losetup ${D}${base_bindir} + install -m 755 usr/utils/static/wc ${D}${base_bindir} + cd ${D}${base_bindir} + ln -s gzip gunzip + ln -s gzip zcat + cd - +} + +PACKAGES = "klibc-utils-static-sh klibc-utils-static-gzip \ + klibc-utils-static-kinit klibc-utils-static-fstype \ + klibc-utils-static-ipconfig klibc-utils-static-nfsmount \ + klibc-utils-static-resume klibc-utils-static-run-init \ + klibc-utils-static-cat klibc-utils-static-chroot \ + klibc-utils-static-cpio klibc-utils-static-dd \ + klibc-utils-static-false klibc-utils-static-halt \ + klibc-utils-static-kill \ + klibc-utils-static-ln klibc-utils-static-minips \ + klibc-utils-static-mkdir klibc-utils-static-mkfifo \ + klibc-utils-static-mknod klibc-utils-static-mount \ + klibc-utils-static-nuke klibc-utils-static-pivot-root \ + klibc-utils-static-poweroff klibc-utils-static-readlink \ + klibc-utils-static-reboot klibc-utils-static-sleep \ + klibc-utils-static-true klibc-utils-static-umount \ + klibc-utils-static-uname klibc-utils-static-modprobe \ + klibc-utils-static-losetup klibc-utils-static-wc" + +FILES_klibc-utils-static-sh = "${base_bindir}/sh" +FILES_klibc-utils-static-gzip = "${base_bindir}/gzip ${base_bindir}/gunzip ${base_bindir}/zcat" +FILES_klibc-utils-static-kinit = "${base_bindir}/kinit" +FILES_klibc-utils-static-fstype = "${base_bindir}/fstype" +FILES_klibc-utils-static-ipconfig = "${base_bindir}/ipconfig" +FILES_klibc-utils-static-nfsmount = "${base_bindir}/nfsmount" +FILES_klibc-utils-static-resume = "${base_bindir}/resume" +FILES_klibc-utils-static-run-init = "${base_bindir}/run-init" +FILES_klibc-utils-static-cat = "${base_bindir}/cat" +FILES_klibc-utils-static-chroot = "${base_bindir}/chroot" +FILES_klibc-utils-static-cpio = "${base_bindir}/cpio" +FILES_klibc-utils-static-dd = "${base_bindir}/dd" +FILES_klibc-utils-static-false = "${base_bindir}/false" +FILES_klibc-utils-static-halt = "${base_bindir}/halt" +FILES_klibc-utils-static-kill = "${base_bindir}/kill" +FILES_klibc-utils-static-ln = "${base_bindir}/ln" +FILES_klibc-utils-static-minips = "${base_bindir}/minips" +FILES_klibc-utils-static-mkdir = "${base_bindir}/mkdir" +FILES_klibc-utils-static-mkfifo = "${base_bindir}/mkfifo" +FILES_klibc-utils-static-mknod = "${base_bindir}/mknod" +FILES_klibc-utils-static-mount = "${base_bindir}/mount" +FILES_klibc-utils-static-nuke = "${base_bindir}/nuke" +FILES_klibc-utils-static-pivot-root = "${base_bindir}/pivot_root" +FILES_klibc-utils-static-poweroff = "${base_bindir}/poweroff" +FILES_klibc-utils-static-readlink = "${base_bindir}/readlink" +FILES_klibc-utils-static-reboot = "${base_bindir}/reboot" +FILES_klibc-utils-static-sleep = "${base_bindir}/sleep" +FILES_klibc-utils-static-true = "${base_bindir}/true" +FILES_klibc-utils-static-umount = "${base_bindir}/umount" +FILES_klibc-utils-static-uname = "${base_bindir}/uname" +FILES_klibc-utils-static-modprobe = "${base_sbindir}/modprobe" +FILES_klibc-utils-static-losetup = "${base_bindir}/losetup" +FILES_klibc-utils-static-wc = "${base_bindir}/wc" diff --git a/recipes/klibc/klibc_1.5.15.bb b/recipes/klibc/klibc_1.5.15.bb new file mode 100644 index 0000000000..aae3e604de --- /dev/null +++ b/recipes/klibc/klibc_1.5.15.bb @@ -0,0 +1,2 @@ +require klibc_1.5.15.inc +PR = "r1" diff --git a/recipes/klibc/klibc_1.5.15.inc b/recipes/klibc/klibc_1.5.15.inc new file mode 100644 index 0000000000..a9cd2f3122 --- /dev/null +++ b/recipes/klibc/klibc_1.5.15.inc @@ -0,0 +1,146 @@ +require klibc-common_1.5.15.inc + +SRC_URI += "file://staging.patch;patch=1 \ + file://klibc_kexecsyscall.patch;patch=1 \ + " + +# we want only the shared programms and the lib so we chose them manually +do_install() { + install -d ${D}${base_bindir} + install -m 755 usr/dash/sh.shared ${D}${base_bindir}/sh + install -m 755 usr/gzip/gzip ${D}${base_bindir} + install -m 755 usr/kinit/kinit.shared ${D}${base_bindir}/kinit + install -m 755 usr/kinit/fstype/shared/fstype ${D}${base_bindir} + install -m 755 usr/kinit/ipconfig/shared/ipconfig ${D}${base_bindir} + install -m 755 usr/kinit/nfsmount/shared/nfsmount ${D}${base_bindir} + install -m 755 usr/kinit/resume/shared/resume ${D}${base_bindir} + install -m 755 usr/kinit/run-init/shared/run-init ${D}${base_bindir} + install -m 755 usr/utils/shared/cat ${D}${base_bindir} + install -m 755 usr/utils/shared/chroot ${D}${base_bindir} + install -m 755 usr/utils/shared/cpio ${D}${base_bindir} + install -m 755 usr/utils/shared/dd ${D}${base_bindir} + install -m 755 usr/utils/shared/false ${D}${base_bindir} + install -m 755 usr/utils/shared/halt ${D}${base_bindir} + install -m 755 usr/utils/shared/kill ${D}${base_bindir} + install -m 755 usr/utils/shared/ln ${D}${base_bindir} + install -m 755 usr/utils/shared/minips ${D}${base_bindir} + install -m 755 usr/utils/shared/mkdir ${D}${base_bindir} + install -m 755 usr/utils/shared/mkfifo ${D}${base_bindir} + install -m 755 usr/utils/shared/mknod ${D}${base_bindir} + install -m 755 usr/utils/shared/mount ${D}${base_bindir} + install -m 755 usr/utils/shared/nuke ${D}${base_bindir} + install -m 755 usr/utils/shared/pivot_root ${D}${base_bindir} + install -m 755 usr/utils/shared/poweroff ${D}${base_bindir} + install -m 755 usr/utils/shared/readlink ${D}${base_bindir} + install -m 755 usr/utils/shared/reboot ${D}${base_bindir} + install -m 755 usr/utils/shared/sleep ${D}${base_bindir} + install -m 755 usr/utils/shared/true ${D}${base_bindir} + install -m 755 usr/utils/shared/umount ${D}${base_bindir} + install -m 755 usr/utils/shared/uname ${D}${base_bindir} + install -m 755 usr/utils/shared/modprobe ${D}${base_bindir} + install -m 755 usr/utils/shared/losetup ${D}${base_bindir} + install -m 755 usr/utils/shared/wc ${D}${base_bindir} + + install -d ${D}${base_libdir} + install -m 755 usr/klibc/klibc-*.so ${D}${base_libdir} + cd ${D}${base_libdir} + ln -s klibc-*.so klibc.so + cd - + cd ${D}${base_bindir} + ln -s gzip gunzip + ln -s gzip zcat + cd - +} + +export INST=${STAGING_DIR_TARGET} +do_stage() { + oe_runmake install + cp '${STAGING_DIR_TARGET}/bin/klcc' '${CROSS_DIR}/bin/${TARGET_PREFIX}klcc' +} + +PACKAGES = "${PN} klibc-utils-sh klibc-utils-kinit \ + klibc-utils-fstype klibc-utils-ipconfig \ + klibc-utils-nfsmount klibc-utils-resume \ + klibc-utils-run-init klibc-utils-cat \ + klibc-utils-chroot klibc-utils-cpio \ + klibc-utils-dd klibc-utils-false \ + klibc-utils-halt \ + klibc-utils-kill klibc-utils-ln \ + klibc-utils-minips klibc-utils-mkdir \ + klibc-utils-mkfifo klibc-utils-mknod \ + klibc-utils-mount klibc-utils-nuke \ + klibc-utils-pivot-root klibc-utils-poweroff \ + klibc-utils-readlink klibc-utils-reboot \ + klibc-utils-sleep klibc-utils-true \ + klibc-utils-umount klibc-utils-uname \ + klibc-utils-gzip klibc-utils-modprobe \ + klibc-utils-losetup klibc-utils-wc" + +FILES_${PN} = "${base_libdir}/klibc*.so" +FILES_klibc-utils-sh = "${base_bindir}/sh" +FILES_klibc-utils-gzip = "${base_bindir}/gzip ${base_bindir}/gunzip ${base_bindir}/zcat" +FILES_klibc-utils-kinit = "${base_bindir}/kinit" +FILES_klibc-utils-fstype = "${base_bindir}/fstype" +FILES_klibc-utils-ipconfig = "${base_bindir}/ipconfig" +FILES_klibc-utils-nfsmount = "${base_bindir}/nfsmount" +FILES_klibc-utils-resume = "${base_bindir}/resume" +FILES_klibc-utils-run-init = "${base_bindir}/run-init" +FILES_klibc-utils-cat = "${base_bindir}/cat" +FILES_klibc-utils-chroot = "${base_bindir}/chroot" +FILES_klibc-utils-cpio = "${base_bindir}/cpio" +FILES_klibc-utils-dd = "${base_bindir}/dd" +FILES_klibc-utils-false = "${base_bindir}/false" +FILES_klibc-utils-halt = "${base_bindir}/halt" +FILES_klibc-utils-kill = "${base_bindir}/kill" +FILES_klibc-utils-ln = "${base_bindir}/ln" +FILES_klibc-utils-minips = "${base_bindir}/minips" +FILES_klibc-utils-mkdir = "${base_bindir}/mkdir" +FILES_klibc-utils-mkfifo = "${base_bindir}/mkfifo" +FILES_klibc-utils-mknod = "${base_bindir}/mknod" +FILES_klibc-utils-mount = "${base_bindir}/mount" +FILES_klibc-utils-nuke = "${base_bindir}/nuke" +FILES_klibc-utils-pivot-root = "${base_bindir}/pivot_root" +FILES_klibc-utils-poweroff = "${base_bindir}/poweroff" +FILES_klibc-utils-readlink = "${base_bindir}/readlink" +FILES_klibc-utils-reboot = "${base_bindir}/reboot" +FILES_klibc-utils-sleep = "${base_bindir}/sleep" +FILES_klibc-utils-true = "${base_bindir}/true" +FILES_klibc-utils-umount = "${base_bindir}/umount" +FILES_klibc-utils-uname = "${base_bindir}/uname" +FILES_klibc-utils-modprobe = "${base_bindir}/modprobe" +FILES_klibc-utils-losetup = "${base_bindir}/losetup" +FILES_klibc-utils-wc = "${base_bindir}/wc" + +# Yes we want exactly the klibc that was compiled with the utils +RDEPENDS_klibc-utils-sh = "${PN} (=${PV}-${PR})" +RDEPENDS_klibc-utils-kinit = "${PN} (=${PV}-${PR})" +RDEPENDS_klibc-utils-fstype = "${PN} (=${PV}-${PR})" +RDEPENDS_klibc-utils-ipconfig = "${PN} (=${PV}-${PR})" +RDEPENDS_klibc-utils-nfsmount = "${PN} (=${PV}-${PR})" +RDEPENDS_klibc-utils-resume = "${PN} (=${PV}-${PR})" +RDEPENDS_klibc-utils-run-init = "${PN} (=${PV}-${PR})" +RDEPENDS_klibc-utils-cat = "${PN} (=${PV}-${PR})" +RDEPENDS_klibc-utils-chroot = "${PN} (=${PV}-${PR})" +RDEPENDS_klibc-utils-cpio = "${PN} (=${PV}-${PR})" +RDEPENDS_klibc-utils-dd = "${PN} (=${PV}-${PR})" +RDEPENDS_klibc-utils-false = "${PN} (=${PV}-${PR})" +RDEPENDS_klibc-utils-halt = "${PN} (=${PV}-${PR})" +RDEPENDS_klibc-utils-kill = "${PN} (=${PV}-${PR})" +RDEPENDS_klibc-utils-ln = "${PN} (=${PV}-${PR})" +RDEPENDS_klibc-utils-minips = "${PN} (=${PV}-${PR})" +RDEPENDS_klibc-utils-mkdir = "${PN} (=${PV}-${PR})" +RDEPENDS_klibc-utils-mkfifo = "${PN} (=${PV}-${PR})" +RDEPENDS_klibc-utils-mknod = "${PN} (=${PV}-${PR})" +RDEPENDS_klibc-utils-mount = "${PN} (=${PV}-${PR})" +RDEPENDS_klibc-utils-nuke = "${PN} (=${PV}-${PR})" +RDEPENDS_klibc-utils-pivot-root = "${PN} (=${PV}-${PR})" +RDEPENDS_klibc-utils-poweroff = "${PN} (=${PV}-${PR})" +RDEPENDS_klibc-utils-readlink = "${PN} (=${PV}-${PR})" +RDEPENDS_klibc-utils-reboot = "${PN} (=${PV}-${PR})" +RDEPENDS_klibc-utils-sleep = "${PN} (=${PV}-${PR})" +RDEPENDS_klibc-utils-true = "${PN} (=${PV}-${PR})" +RDEPENDS_klibc-utils-umount = "${PN} (=${PV}-${PR})" +RDEPENDS_klibc-utils-uname = "${PN} (=${PV}-${PR})" +RDEPENDS_klibc-utils-modprobe = "${PN} (=${PV}-${PR})" +RDEPENDS_klibc-utils-losetup = "${PN} (=${PV}-${PR})" +RDEPENDS_klibc-utils-wc = "${PN} (=${PV}-${PR})" diff --git a/recipes/python/python-2.6-manifest.inc b/recipes/python/python-2.6-manifest.inc index b8b8d1c27c..ad1d5f6982 100644 --- a/recipes/python/python-2.6-manifest.inc +++ b/recipes/python/python-2.6-manifest.inc @@ -1,16 +1,16 @@ # WARNING: This file is AUTO GENERATED: Manual edits will be lost next time I regenerate the file. -# Generator: '../org.openembedded.dev/contrib/python/generate-manifest-2.6.py' Version 20081214 (C) 2002-2008 Michael 'Mickey' Lauer <mlauer@vanille-media.de> +# Generator: './generate-manifest-2.6.py' Version 20090425 (C) 2002-2009 Michael 'Mickey' Lauer <mlauer@vanille-media.de> # Visit the Python for Embedded Systems Site => http://www.Vanille.de/projects/python.spy -PROVIDES+="python-profile python-threading python-distutils python-doctest python-codecs python-ctypes python-pickle python-bzip2 python-datetime python-core python-io python-compiler python-compression python-re python-xmlrpc python-terminal python-email python-image python-tests python-core-dbg python-resource python-devel python-difflib python-math python-syslog python-hotshot python-unixadmin python-textutils python-tkinter python-gdbm python-elementtree python-fcntl python-netclient python-pprint python-netserver python-curses python-smtpd python-html python-readline python-subprocess python-pydoc python-logging python-mailbox python-xml python-mime python-sqlite3 python-sqlite3-tests python-unittest python-stringold python-robotparser python-compile python-debugger python-pkgutil python-shell python-bsddb python-mmap python-zlib python-db python-crypt python-idle python-lang python-audio " +PROVIDES+="python-codecs python-threading python-distutils python-textutils python-stringold python-curses python-ctypes python-pickle python-datetime python-core python-io python-compression python-re python-profile python-xmlrpc python-terminal python-dev python-email python-image python-tests python-core-dbg python-resource python-difflib python-math python-syslog python-hotshot python-unixadmin python-doctest python-tkinter python-gdbm python-elementtree python-fcntl python-netclient python-pprint python-netserver python-compiler python-smtpd python-html python-readline python-subprocess python-pydoc python-sqlite3-tests python-logging python-mailbox python-xml python-mime python-sqlite3 python-idle python-unittest python-multiprocessing python-robotparser python-compile python-debugger python-pkgutil python-shell python-bsddb python-mmap python-zlib python-db python-crypt python-bzip2 python-lang python-audio " -PACKAGES="python-profile python-threading python-distutils python-doctest python-codecs python-ctypes python-pickle python-bzip2 python-datetime python-core python-io python-compiler python-compression python-re python-xmlrpc python-terminal python-email python-image python-tests python-core-dbg python-resource python-devel python-difflib python-math python-syslog python-hotshot python-unixadmin python-textutils python-tkinter python-gdbm python-elementtree python-fcntl python-netclient python-pprint python-netserver python-curses python-smtpd python-html python-readline python-subprocess python-pydoc python-logging python-mailbox python-xml python-mime python-sqlite3 python-sqlite3-tests python-unittest python-stringold python-robotparser python-compile python-debugger python-pkgutil python-shell python-bsddb python-mmap python-zlib python-db python-crypt python-idle python-lang python-audio python-modules" +PACKAGES="python-codecs python-threading python-distutils python-textutils python-stringold python-curses python-ctypes python-pickle python-datetime python-core python-io python-compression python-re python-profile python-xmlrpc python-terminal python-dev python-email python-image python-tests python-core-dbg python-resource python-difflib python-math python-syslog python-hotshot python-unixadmin python-doctest python-tkinter python-gdbm python-elementtree python-fcntl python-netclient python-pprint python-netserver python-compiler python-smtpd python-html python-readline python-subprocess python-pydoc python-sqlite3-tests python-logging python-mailbox python-xml python-mime python-sqlite3 python-idle python-unittest python-multiprocessing python-robotparser python-compile python-debugger python-pkgutil python-shell python-bsddb python-mmap python-zlib python-db python-crypt python-bzip2 python-lang python-audio python-modules" -DESCRIPTION_python-profile="Python Basic Profiling Support" -RDEPENDS_python-profile="python-core python-textutils" -FILES_python-profile="${libdir}/python2.6/profile.* ${libdir}/python2.6/pstats.* ${libdir}/python2.6/cProfile.* ${libdir}/python2.6/lib-dynload/_lsprof.so " +DESCRIPTION_python-codecs="Python Codecs, Encodings & i18n Support" +RDEPENDS_python-codecs="python-core python-lang" +FILES_python-codecs="${libdir}/python2.6/codecs.* ${libdir}/python2.6/encodings ${libdir}/python2.6/gettext.* ${libdir}/python2.6/locale.* ${libdir}/python2.6/lib-dynload/_locale.so ${libdir}/python2.6/lib-dynload/unicodedata.so ${libdir}/python2.6/stringprep.* ${libdir}/python2.6/xdrlib.* " DESCRIPTION_python-threading="Python Threading & Synchronization Support" RDEPENDS_python-threading="python-core python-lang" @@ -20,13 +20,17 @@ DESCRIPTION_python-distutils="Python Distribution Utilities" RDEPENDS_python-distutils="python-core" FILES_python-distutils="${libdir}/python2.6/config ${libdir}/python2.6/distutils " -DESCRIPTION_python-doctest="Python framework for running examples in docstrings." -RDEPENDS_python-doctest="python-core python-lang python-io python-re python-unittest python-debugger python-difflib" -FILES_python-doctest="${libdir}/python2.6/doctest.* " +DESCRIPTION_python-textutils="Python Option Parsing, Text Wrapping and Comma-Separated-Value Support" +RDEPENDS_python-textutils="python-core python-io python-re python-stringold" +FILES_python-textutils="${libdir}/python2.6/lib-dynload/_csv.so ${libdir}/python2.6/csv.* ${libdir}/python2.6/optparse.* ${libdir}/python2.6/textwrap.* " -DESCRIPTION_python-codecs="Python Codecs, Encodings & i18n Support" -RDEPENDS_python-codecs="python-core python-lang" -FILES_python-codecs="${libdir}/python2.6/codecs.* ${libdir}/python2.6/encodings ${libdir}/python2.6/gettext.* ${libdir}/python2.6/locale.* ${libdir}/python2.6/lib-dynload/_locale.so ${libdir}/python2.6/lib-dynload/unicodedata.so ${libdir}/python2.6/stringprep.* ${libdir}/python2.6/xdrlib.* " +DESCRIPTION_python-stringold="Python String APIs [deprecated]" +RDEPENDS_python-stringold="python-core python-re" +FILES_python-stringold="${libdir}/python2.6/lib-dynload/strop.so ${libdir}/python2.6/string.* " + +DESCRIPTION_python-curses="Python Curses Support" +RDEPENDS_python-curses="python-core" +FILES_python-curses="${libdir}/python2.6/curses ${libdir}/python2.6/lib-dynload/_curses.so ${libdir}/python2.6/lib-dynload/_curses_panel.so " DESCRIPTION_python-ctypes="Python C Types Support" RDEPENDS_python-ctypes="python-core" @@ -36,10 +40,6 @@ DESCRIPTION_python-pickle="Python Persistence Support" RDEPENDS_python-pickle="python-core python-codecs python-io python-re" FILES_python-pickle="${libdir}/python2.6/pickle.* ${libdir}/python2.6/shelve.* ${libdir}/python2.6/lib-dynload/cPickle.so " -DESCRIPTION_python-bzip2="Python bzip2 support" -RDEPENDS_python-bzip2="python-core" -FILES_python-bzip2="${libdir}/python2.6/lib-dynload/bz2.so " - DESCRIPTION_python-datetime="Python Calendar and Time support" RDEPENDS_python-datetime="python-core python-codecs" FILES_python-datetime="${libdir}/python2.6/_strptime.* ${libdir}/python2.6/calendar.* ${libdir}/python2.6/lib-dynload/datetime.so " @@ -52,10 +52,6 @@ DESCRIPTION_python-io="Python Low-Level I/O" RDEPENDS_python-io="python-core python-math" FILES_python-io="${libdir}/python2.6/lib-dynload/_socket.so ${libdir}/python2.6/lib-dynload/_ssl.so ${libdir}/python2.6/lib-dynload/select.so ${libdir}/python2.6/lib-dynload/termios.so ${libdir}/python2.6/lib-dynload/cStringIO.so ${libdir}/python2.6/pipes.* ${libdir}/python2.6/socket.* ${libdir}/python2.6/tempfile.* ${libdir}/python2.6/StringIO.* " -DESCRIPTION_python-compiler="Python Compiler Support" -RDEPENDS_python-compiler="python-core" -FILES_python-compiler="${libdir}/python2.6/compiler " - DESCRIPTION_python-compression="Python High Level Compression Support" RDEPENDS_python-compression="python-core python-zlib" FILES_python-compression="${libdir}/python2.6/gzip.* ${libdir}/python2.6/zipfile.* ${libdir}/python2.6/tarfile.* " @@ -64,6 +60,10 @@ DESCRIPTION_python-re="Python Regular Expression APIs" RDEPENDS_python-re="python-core" FILES_python-re="${libdir}/python2.6/re.* ${libdir}/python2.6/sre.* ${libdir}/python2.6/sre_compile.* ${libdir}/python2.6/sre_constants* ${libdir}/python2.6/sre_parse.* " +DESCRIPTION_python-profile="Python Basic Profiling Support" +RDEPENDS_python-profile="python-core python-textutils" +FILES_python-profile="${libdir}/python2.6/profile.* ${libdir}/python2.6/pstats.* ${libdir}/python2.6/cProfile.* ${libdir}/python2.6/lib-dynload/_lsprof.so " + DESCRIPTION_python-xmlrpc="Python XMLRPC Support" RDEPENDS_python-xmlrpc="python-core python-xml python-netserver python-lang" FILES_python-xmlrpc="${libdir}/python2.6/xmlrpclib.* ${libdir}/python2.6/SimpleXMLRPCServer.* " @@ -72,9 +72,13 @@ DESCRIPTION_python-terminal="Python Terminal Controlling Support" RDEPENDS_python-terminal="python-core python-io" FILES_python-terminal="${libdir}/python2.6/pty.* ${libdir}/python2.6/tty.* " +DESCRIPTION_python-dev="Python Development Package" +RDEPENDS_python-dev="python-core" +FILES_python-dev="${includedir} ${libdir}/python2.6/config " + DESCRIPTION_python-email="Python Email Support" RDEPENDS_python-email="python-core python-io python-re python-mime python-audio python-image" -FILES_python-email="${libdir}/python2.6/email " +FILES_python-email="${libdir}/python2.6/imaplib.* ${libdir}/python2.6/email " DESCRIPTION_python-image="Python Graphical Image Handling" RDEPENDS_python-image="python-core" @@ -92,10 +96,6 @@ DESCRIPTION_python-resource="Python Resource Control Interface" RDEPENDS_python-resource="python-core" FILES_python-resource="${libdir}/python2.6/lib-dynload/resource.so " -DESCRIPTION_python-devel="Python Development Package" -RDEPENDS_python-devel="python-core" -FILES_python-devel="${includedir} ${libdir}/python2.6/config " - DESCRIPTION_python-difflib="Python helpers for computing deltas between objects." RDEPENDS_python-difflib="python-lang python-re" FILES_python-difflib="${libdir}/python2.6/difflib.* " @@ -104,7 +104,7 @@ DESCRIPTION_python-math="Python Math Support" RDEPENDS_python-math="python-core" FILES_python-math="${libdir}/python2.6/lib-dynload/cmath.so ${libdir}/python2.6/lib-dynload/math.so ${libdir}/python2.6/lib-dynload/_random.so ${libdir}/python2.6/random.* ${libdir}/python2.6/sets.* " -DESCRIPTION_python-syslog="Python's Syslog Interface" +DESCRIPTION_python-syslog="Python Syslog Interface" RDEPENDS_python-syslog="python-core" FILES_python-syslog="${libdir}/python2.6/lib-dynload/syslog.so " @@ -116,9 +116,9 @@ DESCRIPTION_python-unixadmin="Python Unix Administration Support" RDEPENDS_python-unixadmin="python-core" FILES_python-unixadmin="${libdir}/python2.6/lib-dynload/nis.so ${libdir}/python2.6/lib-dynload/grp.so ${libdir}/python2.6/lib-dynload/pwd.so ${libdir}/python2.6/getpass.* " -DESCRIPTION_python-textutils="Python Option Parsing, Text Wrapping and Comma-Separated-Value Support" -RDEPENDS_python-textutils="python-core python-io python-re python-stringold" -FILES_python-textutils="${libdir}/python2.6/lib-dynload/_csv.so ${libdir}/python2.6/csv.* ${libdir}/python2.6/optparse.* ${libdir}/python2.6/textwrap.* " +DESCRIPTION_python-doctest="Python framework for running examples in docstrings." +RDEPENDS_python-doctest="python-core python-lang python-io python-re python-unittest python-debugger python-difflib" +FILES_python-doctest="${libdir}/python2.6/doctest.* " DESCRIPTION_python-tkinter="Python Tcl/Tk Bindings" RDEPENDS_python-tkinter="python-core" @@ -148,9 +148,9 @@ DESCRIPTION_python-netserver="Python Internet Protocol Servers" RDEPENDS_python-netserver="python-core python-netclient" FILES_python-netserver="${libdir}/python2.6/cgi.* ${libdir}/python2.6/BaseHTTPServer.* ${libdir}/python2.6/SimpleHTTPServer.* ${libdir}/python2.6/SocketServer.* " -DESCRIPTION_python-curses="Python Curses Support" -RDEPENDS_python-curses="python-core" -FILES_python-curses="${libdir}/python2.6/curses ${libdir}/python2.6/lib-dynload/_curses.so ${libdir}/python2.6/lib-dynload/_curses_panel.so " +DESCRIPTION_python-compiler="Python Compiler Support" +RDEPENDS_python-compiler="python-core" +FILES_python-compiler="${libdir}/python2.6/compiler " DESCRIPTION_python-smtpd="Python Simple Mail Transport Daemon" RDEPENDS_python-smtpd="python-core python-netserver python-email python-mime" @@ -172,6 +172,10 @@ DESCRIPTION_python-pydoc="Python Interactive Help Support" RDEPENDS_python-pydoc="python-core python-lang python-stringold python-re" FILES_python-pydoc="${bindir}/pydoc ${libdir}/python2.6/pydoc.* " +DESCRIPTION_python-sqlite3-tests="Python Sqlite3 Database Support Tests" +RDEPENDS_python-sqlite3-tests="python-core python-sqlite3" +FILES_python-sqlite3-tests="${libdir}/python2.6/sqlite3/test " + DESCRIPTION_python-logging="Python Logging Support" RDEPENDS_python-logging="python-core python-io python-lang python-pickle python-stringold" FILES_python-logging="${libdir}/python2.6/logging " @@ -190,19 +194,19 @@ FILES_python-mime="${libdir}/python2.6/mimetools.* ${libdir}/python2.6/uu.* ${li DESCRIPTION_python-sqlite3="Python Sqlite3 Database Support" RDEPENDS_python-sqlite3="python-core python-datetime python-lang python-crypt python-io python-threading python-zlib" -FILES_python-sqlite3="${libdir}/python2.6/lib-dynload/_sqlite3.so ${libdir}/python2.6/sqlite3/dbapi2.* ${libdir}/python2.6/sqlite3/__init__.* " +FILES_python-sqlite3="${libdir}/python2.6/lib-dynload/_sqlite3.so ${libdir}/python2.6/sqlite3/dbapi2.* ${libdir}/python2.6/sqlite3/__init__.* ${libdir}/python2.6/sqlite3/dump.* " -DESCRIPTION_python-sqlite3-tests="Python Sqlite3 Database Support Tests" -RDEPENDS_python-sqlite3-tests="python-core python-sqlite3" -FILES_python-sqlite3-tests="${libdir}/python2.6/sqlite3/test " +DESCRIPTION_python-idle="Python Integrated Development Environment" +RDEPENDS_python-idle="python-core python-tkinter" +FILES_python-idle="${bindir}/idle ${libdir}/python2.6/idlelib " DESCRIPTION_python-unittest="Python Unit Testing Framework" RDEPENDS_python-unittest="python-core python-stringold python-lang" FILES_python-unittest="${libdir}/python2.6/unittest.* " -DESCRIPTION_python-stringold="Python String APIs [deprecated]" -RDEPENDS_python-stringold="python-core python-re" -FILES_python-stringold="${libdir}/python2.6/lib-dynload/strop.so ${libdir}/python2.6/string.* " +DESCRIPTION_python-multiprocessing="Python Multiprocessing Support" +RDEPENDS_python-multiprocessing="python-core python-io python-lang" +FILES_python-multiprocessing="${libdir}/python2.6/lib-dynload/_multiprocessing.so ${libdir}/python2.6/multiprocessing " DESCRIPTION_python-robotparser="Python robots.txt parser" RDEPENDS_python-robotparser="python-core python-netclient" @@ -244,9 +248,9 @@ DESCRIPTION_python-crypt="Python Basic Cryptographic and Hashing Support" RDEPENDS_python-crypt="python-core" FILES_python-crypt="${libdir}/python2.6/hashlib.* ${libdir}/python2.6/md5.* ${libdir}/python2.6/sha.* ${libdir}/python2.6/lib-dynload/crypt.so ${libdir}/python2.6/lib-dynload/_hashlib.so ${libdir}/python2.6/lib-dynload/_sha256.so ${libdir}/python2.6/lib-dynload/_sha512.so " -DESCRIPTION_python-idle="Python Integrated Development Environment" -RDEPENDS_python-idle="python-core python-tkinter" -FILES_python-idle="${bindir}/idle ${libdir}/python2.6/idlelib " +DESCRIPTION_python-bzip2="Python bzip2 support" +RDEPENDS_python-bzip2="python-core" +FILES_python-bzip2="${libdir}/python2.6/lib-dynload/bz2.so " DESCRIPTION_python-lang="Python Low-Level Language Support" RDEPENDS_python-lang="python-core" @@ -257,7 +261,7 @@ RDEPENDS_python-audio="python-core" FILES_python-audio="${libdir}/python2.6/wave.* ${libdir}/python2.6/chunk.* ${libdir}/python2.6/sndhdr.* ${libdir}/python2.6/lib-dynload/ossaudiodev.so ${libdir}/python2.6/lib-dynload/audioop.so " DESCRIPTION_python-modules="All Python modules" -RDEPENDS_python-modules="python-profile python-threading python-distutils python-doctest python-codecs python-ctypes python-pickle python-bzip2 python-datetime python-core python-io python-compiler python-compression python-re python-xmlrpc python-terminal python-email python-image python-tests python-resource python-devel python-difflib python-math python-syslog python-hotshot python-unixadmin python-textutils python-tkinter python-gdbm python-elementtree python-fcntl python-netclient python-pprint python-netserver python-curses python-smtpd python-html python-readline python-subprocess python-pydoc python-logging python-mailbox python-xml python-mime python-sqlite3 python-sqlite3-tests python-unittest python-stringold python-robotparser python-compile python-debugger python-pkgutil python-shell python-bsddb python-mmap python-zlib python-db python-crypt python-idle python-lang python-audio " +RDEPENDS_python-modules="python-codecs python-threading python-distutils python-textutils python-stringold python-curses python-ctypes python-pickle python-datetime python-core python-io python-compression python-re python-profile python-xmlrpc python-terminal python-dev python-email python-image python-tests python-resource python-difflib python-math python-syslog python-hotshot python-unixadmin python-doctest python-tkinter python-gdbm python-elementtree python-fcntl python-netclient python-pprint python-netserver python-compiler python-smtpd python-html python-readline python-subprocess python-pydoc python-sqlite3-tests python-logging python-mailbox python-xml python-mime python-sqlite3 python-idle python-unittest python-multiprocessing python-robotparser python-compile python-debugger python-pkgutil python-shell python-bsddb python-mmap python-zlib python-db python-crypt python-bzip2 python-lang python-audio " ALLOW_EMPTY_python-modules = "1" diff --git a/recipes/python/python-2.6.2/00-fix-bindir-libdir-for-cross.patch b/recipes/python/python-2.6.2/00-fix-bindir-libdir-for-cross.patch new file mode 100644 index 0000000000..2559e3a0e4 --- /dev/null +++ b/recipes/python/python-2.6.2/00-fix-bindir-libdir-for-cross.patch @@ -0,0 +1,20 @@ +# $(exec_prefix) points to the wrong directory, when installing +# a cross-build. @bindir@ and @libdir@ works better and doesn't +# affect the native build. +# Signed-Off: Michael 'Mickey' Lauer <mickey@vanille-media.de> + +Index: Python-2.6.1/Makefile.pre.in +=================================================================== +--- Python-2.6.1.orig/Makefile.pre.in ++++ Python-2.6.1/Makefile.pre.in +@@ -86,8 +86,8 @@ exec_prefix= @exec_prefix@ + datarootdir= @datarootdir@ + + # Expanded directories +-BINDIR= $(exec_prefix)/bin +-LIBDIR= $(exec_prefix)/lib ++BINDIR= @bindir@ ++LIBDIR= @libdir@ + MANDIR= @mandir@ + INCLUDEDIR= @includedir@ + CONFINCLUDEDIR= $(exec_prefix)/include diff --git a/recipes/python/python-2.6.2/01-use-proper-tools-for-cross-build.patch b/recipes/python/python-2.6.2/01-use-proper-tools-for-cross-build.patch new file mode 100644 index 0000000000..e89faa4fb0 --- /dev/null +++ b/recipes/python/python-2.6.2/01-use-proper-tools-for-cross-build.patch @@ -0,0 +1,116 @@ +# We need to ensure our host tools get run during build, not the freshly +# built cross-tools (this will not work), so we introduce HOSTPYTHON and HOSTPGEN. +# Signed-Off: Michael 'Mickey' Lauer <mickey@vanille-media.de> + +Index: Python-2.6.1/Makefile.pre.in +=================================================================== +--- Python-2.6.1.orig/Makefile.pre.in ++++ Python-2.6.1/Makefile.pre.in +@@ -175,6 +175,7 @@ UNICODE_OBJS= @UNICODE_OBJS@ + + PYTHON= python$(EXE) + BUILDPYTHON= python$(BUILDEXE) ++HOSTPYTHON= $(BUILDPYTHON) + + # The task to run while instrument when building the profile-opt target + PROFILE_TASK= $(srcdir)/Tools/pybench/pybench.py -n 2 --with-gc --with-syscheck +@@ -205,7 +206,7 @@ GRAMMAR_INPUT= $(srcdir)/Grammar/Grammar + ########################################################################## + # Parser + PGEN= Parser/pgen$(EXE) +- ++HOSTPGEN= $(PGEN)$(EXE) + POBJS= \ + Parser/acceler.o \ + Parser/grammar1.o \ +@@ -394,8 +395,8 @@ platform: $(BUILDPYTHON) + # Build the shared modules + sharedmods: $(BUILDPYTHON) + @case $$MAKEFLAGS in \ +- *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \ +- *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \ ++ *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(HOSTPYTHON) -E $(srcdir)/setup.py -q build;; \ ++ *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(HOSTPYTHON) -E $(srcdir)/setup.py build;; \ + esac + + # Build static library +@@ -513,7 +514,7 @@ Modules/python.o: $(srcdir)/Modules/pyth + + $(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT) + -@$(INSTALL) -d Include +- -$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C) ++ -$(HOSTPGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C) + + $(PGEN): $(PGENOBJS) + $(CC) $(OPT) $(LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN) +@@ -879,23 +880,23 @@ libinstall: build_all $(srcdir)/Lib/$(PL + done + $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt + PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ +- ./$(BUILDPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \ ++ $(HOSTPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \ + -d $(LIBDEST) -f \ + -x 'bad_coding|badsyntax|site-packages' $(DESTDIR)$(LIBDEST) + PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ +- ./$(BUILDPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \ ++ $(HOSTPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \ + -d $(LIBDEST) -f \ + -x 'bad_coding|badsyntax|site-packages' $(DESTDIR)$(LIBDEST) + -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ +- ./$(BUILDPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \ ++ $(HOSTPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \ + -d $(LIBDEST)/site-packages -f \ + -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages + -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ +- ./$(BUILDPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \ ++ $(HOSTPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \ + -d $(LIBDEST)/site-packages -f \ + -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages + -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ +- ./$(BUILDPYTHON) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()" ++ $(HOSTPYTHON) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()" + + # Create the PLATDIR source directory, if one wasn't distributed.. + $(srcdir)/Lib/$(PLATDIR): +@@ -993,7 +994,7 @@ libainstall: all + # Install the dynamically loadable modules + # This goes into $(exec_prefix) + sharedinstall: +- $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \ ++ $(RUNSHARED) $(HOSTPYTHON) -E $(srcdir)/setup.py install \ + --prefix=$(prefix) \ + --install-scripts=$(BINDIR) \ + --install-platlib=$(DESTSHARED) \ +Index: Python-2.6.1/setup.py +=================================================================== +--- Python-2.6.1.orig/setup.py ++++ Python-2.6.1/setup.py +@@ -276,6 +276,7 @@ class PyBuildExt(build_ext): + self.failed.append(ext.name) + self.announce('*** WARNING: renaming "%s" since importing it' + ' failed: %s' % (ext.name, why), level=3) ++ return + assert not self.inplace + basename, tail = os.path.splitext(ext_filename) + newname = basename + "_failed" + tail +@@ -310,8 +311,8 @@ class PyBuildExt(build_ext): + + def detect_modules(self): + # Ensure that /usr/local is always used +- add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') +- add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') ++ # add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') ++ # add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') + + # Add paths specified in the environment variables LDFLAGS and + # CPPFLAGS for header and library files. +@@ -410,6 +411,9 @@ class PyBuildExt(build_ext): + + # XXX Omitted modules: gl, pure, dl, SGI-specific modules + ++ lib_dirs = [ os.getenv( "STAGING_LIBDIR" ) ] ++ inc_dirs = [ os.getenv( "STAGING_INCDIR" ) ] ++ + # + # The following modules are all pretty straightforward, and compile + # on pretty much any POSIXish platform. diff --git a/recipes/python/python-2.6.2/02-remove-test-for-cross.patch b/recipes/python/python-2.6.2/02-remove-test-for-cross.patch new file mode 100644 index 0000000000..48386ea462 --- /dev/null +++ b/recipes/python/python-2.6.2/02-remove-test-for-cross.patch @@ -0,0 +1,94 @@ +# OpenEmbedded prepopulates the autotools site cache, so if this +# would be using AC_TRY_CACHE, we could patch it in a more sane way +# Alas, I don't have enough autotalent to do that. +# +# Signed-Off: Michael 'Mickey' Lauer <mickey@vanille-media.de> +Index: Python-2.6.1/configure.in +=================================================================== +--- Python-2.6.1.orig/configure.in ++++ Python-2.6.1/configure.in +@@ -2556,38 +2556,6 @@ AC_CHECK_LIB(c, inet_aton, [$ac_cv_prog_ + AC_CHECK_LIB(resolv, inet_aton) + ) + +-# On Tru64, chflags seems to be present, but calling it will +-# exit Python +-AC_MSG_CHECKING(for chflags) +-AC_TRY_RUN([ +-#include <sys/stat.h> +-#include <unistd.h> +-int main(int argc, char*argv[]) +-{ +- if(chflags(argv[0], 0) != 0) +- return 1; +- return 0; +-} +-],AC_DEFINE(HAVE_CHFLAGS, 1, Define to 1 if you have the `chflags' function.) +- AC_MSG_RESULT(yes), +- AC_MSG_RESULT(no) +-) +- +-AC_MSG_CHECKING(for lchflags) +-AC_TRY_RUN([ +-#include <sys/stat.h> +-#include <unistd.h> +-int main(int argc, char*argv[]) +-{ +- if(lchflags(argv[0], 0) != 0) +- return 1; +- return 0; +-} +-],AC_DEFINE(HAVE_LCHFLAGS, 1, Define to 1 if you have the `lchflags' function.) +- AC_MSG_RESULT(yes), +- AC_MSG_RESULT(no) +-) +- + dnl Check if system zlib has *Copy() functions + dnl + dnl On MacOSX the linker will search for dylibs on the entire linker path +@@ -3649,45 +3617,6 @@ else + AC_MSG_RESULT(no) + fi + +-AC_MSG_CHECKING(for %zd printf() format support) +-AC_TRY_RUN([#include <stdio.h> +-#include <stddef.h> +-#include <string.h> +- +-#ifdef HAVE_SYS_TYPES_H +-#include <sys/types.h> +-#endif +- +-#ifdef HAVE_SSIZE_T +-typedef ssize_t Py_ssize_t; +-#elif SIZEOF_VOID_P == SIZEOF_LONG +-typedef long Py_ssize_t; +-#else +-typedef int Py_ssize_t; +-#endif +- +-int main() +-{ +- char buffer[256]; +- +- if(sprintf(buffer, "%zd", (size_t)123) < 0) +- return 1; +- +- if (strcmp(buffer, "123")) +- return 1; +- +- if (sprintf(buffer, "%zd", (Py_ssize_t)-123) < 0) +- return 1; +- +- if (strcmp(buffer, "-123")) +- return 1; +- +- return 0; +-}], +-[AC_MSG_RESULT(yes) +- AC_DEFINE(PY_FORMAT_SIZE_T, "z", [Define to printf format modifier for Py_ssize_t])], +- AC_MSG_RESULT(no)) +- + AC_CHECK_TYPE(socklen_t,, + AC_DEFINE(socklen_t,int, + Define to `int' if <sys/socket.h> does not define.),[ diff --git a/recipes/python/python-2.6.2/03-fix-tkinter-detection.patch b/recipes/python/python-2.6.2/03-fix-tkinter-detection.patch new file mode 100644 index 0000000000..a1a385a07c --- /dev/null +++ b/recipes/python/python-2.6.2/03-fix-tkinter-detection.patch @@ -0,0 +1,40 @@ +# We need to supply STAGING_INCDIR here, otherwise the Tk headers +# will not be found. +# Signed-Off: Michael 'Mickey' Lauer <mickey@vanille.de> + +Index: Python-2.6.1/setup.py +=================================================================== +--- Python-2.6.1.orig/setup.py ++++ Python-2.6.1/setup.py +@@ -1543,7 +1543,7 @@ class PyBuildExt(build_ext): + dotversion = dotversion[:-1] + '.' + dotversion[-1] + tcl_include_sub = [] + tk_include_sub = [] +- for dir in inc_dirs: ++ for dir in [os.getenv("STAGING_INCDIR")]: + tcl_include_sub += [dir + os.sep + "tcl" + dotversion] + tk_include_sub += [dir + os.sep + "tk" + dotversion] + tk_include_sub += tcl_include_sub +@@ -1562,22 +1562,6 @@ class PyBuildExt(build_ext): + if dir not in include_dirs: + include_dirs.append(dir) + +- # Check for various platform-specific directories +- if platform == 'sunos5': +- include_dirs.append('/usr/openwin/include') +- added_lib_dirs.append('/usr/openwin/lib') +- elif os.path.exists('/usr/X11R6/include'): +- include_dirs.append('/usr/X11R6/include') +- added_lib_dirs.append('/usr/X11R6/lib64') +- added_lib_dirs.append('/usr/X11R6/lib') +- elif os.path.exists('/usr/X11R5/include'): +- include_dirs.append('/usr/X11R5/include') +- added_lib_dirs.append('/usr/X11R5/lib') +- else: +- # Assume default location for X11 +- include_dirs.append('/usr/X11/include') +- added_lib_dirs.append('/usr/X11/lib') +- + # If Cygwin, then verify that X is installed before proceeding + if platform == 'cygwin': + x11_inc = find_file('X11/Xlib.h', [], include_dirs) diff --git a/recipes/python/python-2.6.2/04-default-is-optimized.patch b/recipes/python/python-2.6.2/04-default-is-optimized.patch new file mode 100644 index 0000000000..805f4f696c --- /dev/null +++ b/recipes/python/python-2.6.2/04-default-is-optimized.patch @@ -0,0 +1,52 @@ +# when compiling for an embedded system, we need every bit of +# performance we can get. default to optimized with the option +# of opt-out. +# Signed-Off: Michael 'Mickey' Lauer <mickey@vanille-media.de> + +Index: Python-2.6.1/Python/compile.c +=================================================================== +--- Python-2.6.1.orig/Python/compile.c ++++ Python-2.6.1/Python/compile.c +@@ -32,7 +32,7 @@ + #include "symtable.h" + #include "opcode.h" + +-int Py_OptimizeFlag = 0; ++int Py_OptimizeFlag = 1; + + #define DEFAULT_BLOCK_SIZE 16 + #define DEFAULT_BLOCKS 8 +Index: Python-2.6.1/Modules/main.c +=================================================================== +--- Python-2.6.1.orig/Modules/main.c ++++ Python-2.6.1/Modules/main.c +@@ -40,7 +40,7 @@ static char **orig_argv; + static int orig_argc; + + /* command line options */ +-#define BASE_OPTS "3bBc:dEhiJm:OQ:sStuUvVW:xX?" ++#define BASE_OPTS "3bBc:dEhiJm:NOQ:sStuUvVW:xX?" + + #ifndef RISCOS + #define PROGRAM_OPTS BASE_OPTS +@@ -69,8 +69,7 @@ Options and arguments (and corresponding + static char *usage_2 = "\ + if stdin does not appear to be a terminal; also PYTHONINSPECT=x\n\ + -m mod : run library module as a script (terminates option list)\n\ +--O : optimize generated bytecode slightly; also PYTHONOPTIMIZE=x\n\ +--OO : remove doc-strings in addition to the -O optimizations\n\ ++-N : do NOT optimize generated bytecode\n\ + -Q arg : division options: -Qold (default), -Qwarn, -Qwarnall, -Qnew\n\ + -s : don't add user site directory to sys.path; also PYTHONNOUSERSITE\n\ + -S : don't imply 'import site' on initialization\n\ +@@ -353,8 +352,8 @@ Py_Main(int argc, char **argv) + + /* case 'J': reserved for Jython */ + +- case 'O': +- Py_OptimizeFlag++; ++ case 'N': ++ Py_OptimizeFlag=0; + break; + + case 'B': diff --git a/recipes/python/python-2.6.2/05-enable-ctypes-cross-build.patch b/recipes/python/python-2.6.2/05-enable-ctypes-cross-build.patch new file mode 100644 index 0000000000..874b8be01d --- /dev/null +++ b/recipes/python/python-2.6.2/05-enable-ctypes-cross-build.patch @@ -0,0 +1,28 @@ +# CTypes need to know the actual host we are building on. +# Signed-Off: Michael Dietrich <mdt@emdete.de> + +Index: Python-2.6.1/setup.py +=================================================================== +--- Python-2.6.1.orig/setup.py ++++ Python-2.6.1/setup.py +@@ -1656,16 +1656,16 @@ class PyBuildExt(build_ext): + ffi_configfile): + from distutils.dir_util import mkpath + mkpath(ffi_builddir) +- config_args = [] ++ config_args = ['--host=%s' % os.environ["HOST_SYS"], ] + + # Pass empty CFLAGS because we'll just append the resulting + # CFLAGS to Python's; -g or -O2 is to be avoided. +- cmd = "cd %s && env CFLAGS='' '%s/configure' %s" \ +- % (ffi_builddir, ffi_srcdir, " ".join(config_args)) ++ cmd = "(cd %s && autoconf -W cross) && (cd %s && env CFLAGS='' '%s/configure' %s)" \ ++ % (ffi_srcdir, ffi_builddir, ffi_srcdir, " ".join(config_args)) + + res = os.system(cmd) + if res or not os.path.exists(ffi_configfile): +- print "Failed to configure _ctypes module" ++ print "Failed to configure _ctypes module (ret=%d) or missing conffile=%s" % ( ret, ffi_configfile ) + return False + + fficonfig = {} diff --git a/recipes/python/python-2.6.2/99-ignore-optimization-flag.patch b/recipes/python/python-2.6.2/99-ignore-optimization-flag.patch new file mode 100644 index 0000000000..02dc44c847 --- /dev/null +++ b/recipes/python/python-2.6.2/99-ignore-optimization-flag.patch @@ -0,0 +1,19 @@ +# Reinstate the empty -O option to fix weird mixing of native and target +# binaries and libraries with LD_LIBRARY_PATH when host==target +# +# Signed-off-by: Denys Dmytriyenko <denis@denix.org> + +Index: Python-2.6.1/Modules/main.c +=================================================================== +--- Python-2.6.1-orig/Modules/main.c ++++ Python-2.6.1/Modules/main.c +@@ -352,6 +352,9 @@ Py_Main(int argc, char **argv) + + /* case 'J': reserved for Jython */ + ++ case 'O': /* ignore it */ ++ break; ++ + case 'N': + Py_OptimizeFlag=0; + break; diff --git a/recipes/python/python-2.6.2/sitecustomize.py b/recipes/python/python-2.6.2/sitecustomize.py new file mode 100644 index 0000000000..273901898a --- /dev/null +++ b/recipes/python/python-2.6.2/sitecustomize.py @@ -0,0 +1,45 @@ +# OpenEmbedded sitecustomize.py (C) 2002-2008 Michael 'Mickey' Lauer <mlauer@vanille-media.de> +# GPLv2 or later +# Version: 20081123 +# Features: +# * set proper default encoding +# * enable readline completion in the interactive interpreter +# * load command line history on startup +# * save command line history on exit + +import os + +def __exithandler(): + try: + readline.write_history_file( "%s/.python-history" % os.getenv( "HOME", "/tmp" ) ) + except IOError: + pass + +def __registerExitHandler(): + import atexit + atexit.register( __exithandler ) + +def __enableReadlineSupport(): + readline.set_history_length( 1000 ) + readline.parse_and_bind( "tab: complete" ) + try: + readline.read_history_file( "%s/.python-history" % os.getenv( "HOME", "/tmp" ) ) + except IOError: + pass + +def __enableDefaultEncoding(): + import sys + try: + sys.setdefaultencoding( "utf8" ) + except LookupError: + pass + +import sys +try: + import rlcompleter, readline +except ImportError: + pass +else: + __enableDefaultEncoding() + __registerExitHandler() + __enableReadlineSupport() diff --git a/recipes/python/python-native_2.6.1.bb b/recipes/python/python-native_2.6.1.bb index 00d87e6f59..30b97c9344 100644 --- a/recipes/python/python-native_2.6.1.bb +++ b/recipes/python/python-native_2.6.1.bb @@ -1,12 +1,12 @@ require python.inc DEPENDS = "openssl-native bzip2-full-native zlib-native readline-native" - -PR .= ".1" +PR = "${INC_PR}.2" SRC_URI = "\ http://www.python.org/ftp/python/${PV}/Python-${PV}.tar.bz2 \ file://00-fix-bindir-libdir-for-cross.patch;patch=1 \ file://04-default-is-optimized.patch;patch=1 \ + file://05-enable-ctypes-cross-build.patch;patch=1 \ file://10-distutils-fix-swig-parameter.patch;patch=1 \ file://11-distutils-never-modify-shebang-line.patch;patch=1 \ file://12-distutils-prefix-is-inside-staging-area.patch;patch=1 \ @@ -21,6 +21,7 @@ exec_prefix = "${STAGING_DIR_NATIVE}/${layout_exec_prefix}" EXTRA_OEMAKE = '\ BUILD_SYS="" \ HOST_SYS="" \ + LIBC="" \ STAGING_LIBDIR=${STAGING_LIBDIR_NATIVE} \ STAGING_INCDIR=${STAGING_INCDIR_NATIVE} \ ' diff --git a/recipes/python/python.inc b/recipes/python/python.inc index f11345192c..598d97cfd3 100644 --- a/recipes/python/python.inc +++ b/recipes/python/python.inc @@ -4,7 +4,7 @@ LICENSE = "PSF" SECTION = "devel/python" PRIORITY = "optional" # bump this on every change in contrib/python/generate-manifest-2.6.py -PR = "ml3" +INC_PR = "ml4" DEFAULT_PREFERENCE = "-26" diff --git a/recipes/python/python_2.6.2.bb b/recipes/python/python_2.6.2.bb new file mode 100644 index 0000000000..07ae6cd107 --- /dev/null +++ b/recipes/python/python_2.6.2.bb @@ -0,0 +1,130 @@ +require python.inc +DEPENDS = "python-native db gdbm openssl readline sqlite3 tcl tk zlib" +DEPENDS_sharprom = "python-native db readline zlib gdbm openssl" +PR = "${INC_PR}.1" + +SRC_URI = "\ + http://www.python.org/ftp/python/${PV}/Python-${PV}.tar.bz2 \ + file://00-fix-bindir-libdir-for-cross.patch;patch=1 \ + file://01-use-proper-tools-for-cross-build.patch;patch=1 \ + file://02-remove-test-for-cross.patch;patch=1 \ + file://03-fix-tkinter-detection.patch;patch=1 \ + file://04-default-is-optimized.patch;patch=1 \ + file://05-enable-ctypes-cross-build.patch;patch=1 \ + file://99-ignore-optimization-flag.patch;patch=1 \ + \ +# not yet pushed forward +# sitebranding + \ +# file://05-install.patch;patch=1 \ +# file://06-fix-urllib-exception.patch;patch=1 \ +# file://16-bug1179-imageop.patch;patch=1 \ +# file://13-set-wakeup-fix.patch;patch=1 \ + \ + file://sitecustomize.py \ +" +S = "${WORKDIR}/Python-${PV}" + +inherit autotools + +# The 3 lines below are copied from the libffi recipe, ctypes ships its own copy of the libffi sources +#Somehow gcc doesn't set __SOFTFP__ when passing -mfloatabi=softp :( +TARGET_CC_ARCH_append_armv6 = " -D__SOFTFP__" +TARGET_CC_ARCH_append_armv7a = " -D__SOFTFP__" + +# +# Copy config.h and an appropriate Makefile for distutils.sysconfig, +# which laters uses the information out of these to compile extensions +# +do_compile_prepend() { + install -d ${STAGING_INCDIR}/python${PYTHON_MAJMIN}/ + install -d ${STAGING_LIBDIR}/python${PYTHON_MAJMIN}/config/ + install -m 0644 pyconfig.h ${STAGING_INCDIR}/python${PYTHON_MAJMIN}/ + install -m 0644 Makefile Makefile.orig + install -m 0644 Makefile Makefile.backup + sed -e 's,${includedir},${STAGING_INCDIR},' < Makefile.backup > Makefile + install -m 0644 Makefile Makefile.backup + sed -e 's,${libdir},${STAGING_LIBDIR},' < Makefile.backup > Makefile + install -m 0644 Makefile ${STAGING_LIBDIR}/python${PYTHON_MAJMIN}/config/ +} + +do_compile() { + oe_runmake HOSTPGEN=${STAGING_BINDIR_NATIVE}/pgen \ + HOSTPYTHON=${STAGING_BINDIR_NATIVE}/python \ + STAGING_LIBDIR=${STAGING_LIBDIR} \ + STAGING_INCDIR=${STAGING_INCDIR} \ + BUILD_SYS=${BUILD_SYS} HOST_SYS=${HOST_SYS} \ + OPT="${CFLAGS}" libpython${PYTHON_MAJMIN}.so + + oe_libinstall -so libpython${PYTHON_MAJMIN} ${STAGING_LIBDIR} + + oe_runmake HOSTPGEN=${STAGING_BINDIR_NATIVE}/pgen \ + HOSTPYTHON=${STAGING_BINDIR_NATIVE}/python \ + STAGING_LIBDIR=${STAGING_LIBDIR} \ + STAGING_INCDIR=${STAGING_INCDIR} \ + BUILD_SYS=${BUILD_SYS} HOST_SYS=${HOST_SYS} \ + OPT="${CFLAGS}" +} + +do_stage() { + install -m 0644 Include/*.h ${STAGING_INCDIR}/python${PYTHON_MAJMIN}/ + oe_libinstall -a -so libpython${PYTHON_MAJMIN} ${STAGING_LIBDIR} +} + +do_install() { + install -m 0644 Makefile.orig Makefile + + oe_runmake HOSTPGEN=${STAGING_BINDIR_NATIVE}/pgen \ + HOSTPYTHON=${STAGING_BINDIR_NATIVE}/python \ + STAGING_LIBDIR=${STAGING_LIBDIR} \ + STAGING_INCDIR=${STAGING_INCDIR} \ + BUILD_SYS=${BUILD_SYS} HOST_SYS=${HOST_SYS} \ + DESTDIR=${D} LIBDIR=${libdir} install + + install -m 0644 ${WORKDIR}/sitecustomize.py ${D}/${libdir}/python${PYTHON_MAJMIN} + + # remove hardcoded ccache, see http://bugs.openembedded.net/show_bug.cgi?id=4144 + sed -i -e s,ccache,'$(CCACHE)', ${D}/${libdir}/python${PYTHON_MAJMIN}/config/Makefile +} + +require python-${PYTHON_MAJMIN}-manifest.inc + +# manual dependency additions +RPROVIDES_python-core = "python" +RRECOMMENDS_python-core = "python-readline" +RRECOMMENDS_python-crypt = "openssl" + +# add sitecustomize +FILES_python-core += "${libdir}/python${PYTHON_MAJMIN}/sitecustomize.py" +# ship 2to3 +FILES_python-core += "${bindir}/2to3" + +# package libpython2 +PACKAGES =+ "libpython2" +FILES_libpython2 = "${libdir}/libpython*.so*" + +# additional stuff -dev + +FILES_${PN}-dev = "\ + ${includedir} \ + ${libdir}/lib*${SOLIBSDEV} \ + ${libdir}/*.la \ + ${libdir}/*.a \ + ${libdir}/*.o \ + ${libdir}/pkgconfig \ + ${base_libdir}/*.a \ + ${base_libdir}/*.o \ + ${datadir}/aclocal \ + ${datadir}/pkgconfig \ +" + +# catch debug extensions (isn't that already in python-core-dbg?) +FILES_python-dbg += "${libdir}/python${PYTHON_MAJMIN}/lib-dynload/.debug" + +# catch all the rest (unsorted) +PACKAGES += "python-misc" +FILES_python-misc = "${libdir}/python${PYTHON_MAJMIN}" + +# catch manpage +PACKAGES += "python-man" +FILES_python-man = "${datadir}/man" diff --git a/recipes/uclibc/uclibc_nptl.bb b/recipes/uclibc/uclibc_nptl.bb index aae486ae91..2054580e54 100644 --- a/recipes/uclibc/uclibc_nptl.bb +++ b/recipes/uclibc/uclibc_nptl.bb @@ -7,7 +7,7 @@ # on whether the base patches apply to the selected (SRCDATE) svn release. # UCLIBC_BASE ?= "0.9.30" -SRCREV="10373d3ca64c1ec9c519933454a94b459b8fb4e7" +SRCREV="d57e6548d253a9efed91d72498aeda092fa265d2" PV = "${UCLIBC_BASE}+gitr${SRCREV}" PR = "r1" #DEFAULT_PREFERENCE = "2" diff --git a/recipes/util-linux-ng/util-linux-ng-2.16/util-linux-ng-replace-siginterrupt.patch b/recipes/util-linux-ng/util-linux-ng-2.16/util-linux-ng-replace-siginterrupt.patch new file mode 100644 index 0000000000..4b5eb73760 --- /dev/null +++ b/recipes/util-linux-ng/util-linux-ng-2.16/util-linux-ng-replace-siginterrupt.patch @@ -0,0 +1,23 @@ +Index: util-linux-ng-2.14/login-utils/login.c +=================================================================== +--- util-linux-ng-2.14.orig/login-utils/login.c 2008-05-28 16:01:02.000000000 -0700 ++++ util-linux-ng-2.14/login-utils/login.c 2009-03-04 18:31:42.000000000 -0800 +@@ -358,6 +358,7 @@ + char *childArgv[10]; + char *buff; + int childArgc = 0; ++ struct sigaction act; + #ifdef HAVE_SECURITY_PAM_MISC_H + int retcode; + pam_handle_t *pamh = NULL; +@@ -373,7 +374,9 @@ + pid = getpid(); + + signal(SIGALRM, timedout); +- siginterrupt(SIGALRM,1); /* we have to interrupt syscalls like ioclt() */ ++ (void) sigaction(SIGALRM, NULL, &act); ++ act.sa_flags &= ~SA_RESTART; ++ sigaction(SIGALRM, &act, NULL); + alarm((unsigned int)timeout); + signal(SIGQUIT, SIG_IGN); + signal(SIGINT, SIG_IGN); diff --git a/recipes/util-linux-ng/util-linux-ng_2.16.bb b/recipes/util-linux-ng/util-linux-ng_2.16.bb index c22219a816..e81ccca235 100644 --- a/recipes/util-linux-ng/util-linux-ng_2.16.bb +++ b/recipes/util-linux-ng/util-linux-ng_2.16.bb @@ -1,9 +1,10 @@ require util-linux-ng.inc -PR = "${INC_PR}.2" +PR = "${INC_PR}.3" SRC_URI += "file://uclibc-compile.patch;patch=1 \ file://tls.patch;patch=1 \ + file://util-linux-ng-replace-siginterrupt.patch;patch=1 \ " EXTRA_OECONF += " --enable-libuuid --enable-libblkid \ |