Initial population

git-svn-id: https://svn.o-hand.com/repos/poky@1 311d38ba-8fff-0310-9ca6-ca027cbcb966
This commit is contained in:
Richard Purdie
2005-08-31 10:45:47 +00:00
commit 4b46c1f6e8
1032 changed files with 232488 additions and 0 deletions

View File

@@ -0,0 +1,288 @@
diff -u module-init-tools-3.1/orig/depmod.c module-init-tools-3.1/depmod.c
--- module-init-tools-3.1/orig/depmod.c 2005-04-07 18:50:25.829635704 -0700
+++ module-init-tools-3.1/depmod.c 2005-04-07 19:46:43.842099752 -0700
@@ -17,6 +17,7 @@
#include <dirent.h>
#include <sys/utsname.h>
#include <sys/mman.h>
+#include <endian.h>
#include "zlibsupport.h"
#include "depmod.h"
@@ -303,16 +304,38 @@
goto fail;
}
- switch (((char *)new->data)[EI_CLASS]) {
- case ELFCLASS32:
+ switch (((char *)new->data)[EI_CLASS] + (((char *)new->data)[EI_DATA] << 8)) {
+ case ELFCLASS32 + (ELFDATA2LSB << 8): /* 32 bit little endian */
+#if __BYTE_ORDER == __LITTLE_ENDIAN
new->ops = &mod_ops32;
+#else
+ new->ops = &mod_ops32swap;
+#endif
+ break;
+ case ELFCLASS32 + (ELFDATA2MSB << 8): /* 32 bit big endian */
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ new->ops = &mod_ops32swap;
+#else
+ new->ops = &mod_ops32;
+#endif
break;
- case ELFCLASS64:
+ case ELFCLASS64 + (ELFDATA2LSB << 8): /* 64 bit little endian */
+#if __BYTE_ORDER == __LITTLE_ENDIAN
new->ops = &mod_ops64;
+#else
+ new->ops = &mod_ops64swap;
+#endif
+ break;
+ case ELFCLASS64 + (ELFDATA2MSB << 8): /* 64 bit big endian */
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ new->ops = &mod_ops64swap;
+#else
+ new->ops = &mod_ops64;
+#endif
break;
default:
- warn("Module %s has elf unknown identifier %i\n",
- new->pathname, ((char *)new->data)[EI_CLASS]);
+ warn("Module %s has elf unknown identifier %i,%i\n",
+ new->pathname, ((char *)new->data)[EI_CLASS], ((char *)new->data)[EI_DATA]);
goto fail;
}
return new;
diff -u module-init-tools-3.1/orig/moduleops.c module-init-tools-3.1/moduleops.c
--- module-init-tools-3.1/orig/moduleops.c 2005-04-07 18:50:25.829635704 -0700
+++ module-init-tools-3.1/moduleops.c 2005-04-07 19:52:11.166338904 -0700
@@ -9,15 +9,64 @@
#include "moduleops.h"
#include "tables.h"
+/* This deals with both mis-aligned reads and endianness issues,
+ * it may seem crude however the compiler knows 'size' at compile
+ * time (because it comes from sizeof) therefore generates fairly
+ * optimal code.
+ */
+static inline void read_native(const void *src, void *dest, unsigned int size)
+{
+ unsigned int i;
+ for (i = 0; i < size; i++)
+ ((unsigned char*)dest)[i] = ((unsigned char*)src)[i];
+}
+
+#define NATIVE(x)\
+({\
+ typeof(x) __x;\
+ read_native(&(x), &__x, sizeof __x);\
+ __x;\
+})
+
+static inline void read_swapped(const void *src, void *dest, unsigned int size)
+{
+ unsigned int i;
+ for (i = 0; i < size; i++)
+ ((unsigned char*)dest)[i] = ((unsigned char*)src)[size - i-1];
+}
+
+#define SWAPPED(x)\
+({\
+ typeof(x) __x;\
+ read_swapped(&(x), &__x, sizeof __x);\
+ __x;\
+})
+
+#define PERBITCOUNT(x) x##32
#define PERBIT(x) x##32
#define ElfPERBIT(x) Elf32_##x
#define ELFPERBIT(x) ELF32_##x
+#define READ(x) NATIVE(x)
+#include "moduleops_core.c"
+#undef PERBIT
+#undef READ
+#define PERBIT(x) x##32swap
+#define READ(x) SWAPPED(x)
#include "moduleops_core.c"
+#undef PERBITCOUNT
#undef PERBIT
#undef ElfPERBIT
#undef ELFPERBIT
+#undef READ
+#define PERBITCOUNT(x) x##64
#define PERBIT(x) x##64
#define ElfPERBIT(x) Elf64_##x
#define ELFPERBIT(x) ELF64_##x
+#define READ(x) NATIVE(x)
+#include "moduleops_core.c"
+#undef PERBIT
+#undef READ
+#define PERBIT(x) x##64swap
+#define READ(x) SWAPPED(x)
#include "moduleops_core.c"
diff -u module-init-tools-3.1/orig/moduleops.h module-init-tools-3.1/moduleops.h
--- module-init-tools-3.1/orig/moduleops.h 2005-04-07 18:50:25.829635704 -0700
+++ module-init-tools-3.1/moduleops.h 2005-04-07 19:36:26.184997904 -0700
@@ -24,5 +24,6 @@
};
extern struct module_ops mod_ops32, mod_ops64;
+extern struct module_ops mod_ops32swap, mod_ops64swap;
#endif /* MODINITTOOLS_MODULEOPS_H */
diff -u module-init-tools-3.1/orig/moduleops_core.c module-init-tools-3.1/moduleops_core.c
--- module-init-tools-3.1/orig/moduleops_core.c 2005-04-07 18:50:25.829635704 -0700
+++ module-init-tools-3.1/moduleops_core.c 2005-04-07 19:56:18.794693672 -0700
@@ -8,14 +8,14 @@
char *secnames;
/* Grab section headers and strings so we can tell who is who */
- sechdrs = (void *)hdr + hdr->e_shoff;
- secnames = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset;
+ sechdrs = (void *)hdr + READ(hdr->e_shoff);
+ secnames = (void *)hdr + READ(sechdrs[READ(hdr->e_shstrndx)].sh_offset);
/* Find the section they want */
- for (i = 1; i < hdr->e_shnum; i++) {
- if (strcmp(secnames+sechdrs[i].sh_name, secname) == 0) {
- *size = sechdrs[i].sh_size;
- return (void *)hdr + sechdrs[i].sh_offset;
+ for (i = 1; i < READ(hdr->e_shnum); i++) {
+ if (strcmp(secnames+READ(sechdrs[i].sh_name), secname) == 0) {
+ *size = READ(sechdrs[i].sh_size);
+ return (void *)hdr + READ(sechdrs[i].sh_offset);
}
}
*size = 0;
@@ -24,7 +24,7 @@
static void PERBIT(load_symbols)(struct module *module)
{
- struct PERBIT(kernel_symbol) *ksyms;
+ struct PERBITCOUNT(kernel_symbol) *ksyms;
char *ksymstrings;
unsigned long i, size;
@@ -58,10 +58,10 @@
/* Old-style. */
ksyms = PERBIT(load_section)(module->data, "__ksymtab", &size);
- for (i = 0; i < size / sizeof(struct PERBIT(kernel_symbol)); i++)
+ for (i = 0; i < size / sizeof(struct PERBITCOUNT(kernel_symbol)); i++)
add_symbol(ksyms[i].name, module);
ksyms = PERBIT(load_section)(module->data, "__gpl_ksymtab", &size);
- for (i = 0; i < size / sizeof(struct PERBIT(kernel_symbol)); i++)
+ for (i = 0; i < size / sizeof(struct PERBITCOUNT(kernel_symbol)); i++)
add_symbol(ksyms[i].name, module);
}
@@ -100,16 +100,16 @@
hdr = module->data;
handle_register_symbols = 0;
- if (hdr->e_machine == EM_SPARC ||
- hdr->e_machine == EM_SPARCV9)
+ if (READ(hdr->e_machine) == EM_SPARC ||
+ READ(hdr->e_machine) == EM_SPARCV9)
handle_register_symbols = 1;
module->num_deps = 0;
module->deps = NULL;
for (i = 1; i < size / sizeof(syms[0]); i++) {
- if (syms[i].st_shndx == SHN_UNDEF) {
+ if (READ(syms[i].st_shndx) == SHN_UNDEF) {
/* Look for symbol */
- const char *name = strings + syms[i].st_name;
+ const char *name = strings + READ(syms[i].st_name);
struct module *owner;
int weak;
@@ -118,11 +118,11 @@
variables, to avoid anyone else misusing
them. */
if (handle_register_symbols
- && (ELFPERBIT(ST_TYPE)(syms[i].st_info)
+ && (ELFPERBIT(ST_TYPE)(READ(syms[i].st_info))
== STT_REGISTER))
continue;
- weak = ELFPERBIT(ST_BIND)(syms[i].st_info) == STB_WEAK;
+ weak = ELFPERBIT(ST_BIND)(READ(syms[i].st_info)) == STB_WEAK;
owner = find_symbol(name, module->pathname, weak);
if (owner) {
if (verbose)
@@ -143,7 +143,7 @@
ElfPERBIT(Sym) *syms;
ElfPERBIT(Shdr) *sechdrs;
- sechdrs = (void *)hdr + hdr->e_shoff;
+ sechdrs = (void *)hdr + READ(hdr->e_shoff);
strings = PERBIT(load_section)(hdr, ".strtab", &size);
syms = PERBIT(load_section)(hdr, ".symtab", &size);
@@ -152,14 +152,14 @@
return NULL;
for (i = 0; i < size / sizeof(syms[0]); i++) {
- if (strcmp(strings + syms[i].st_name, name) == 0) {
+ if (strcmp(strings + READ(syms[i].st_name), name) == 0) {
/* In BSS? Happens for empty device tables on
* recent GCC versions. */
- if (sechdrs[syms[i].st_shndx].sh_type == SHT_NOBITS)
+ if (READ(sechdrs[READ(syms[i].st_shndx)].sh_type) == SHT_NOBITS)
return NULL;
return (void *)hdr
- + sechdrs[syms[i].st_shndx].sh_offset
- + syms[i].st_value;
+ + READ(sechdrs[READ(syms[i].st_shndx)].sh_offset)
+ + READ(syms[i].st_value);
}
}
return NULL;
@@ -168,36 +168,36 @@
/* FIXME: Check size, unless we end up using aliases anyway --RR */
static void PERBIT(fetch_tables)(struct module *module)
{
- module->pci_size = PERBIT(PCI_DEVICE_SIZE);
+ module->pci_size = PERBITCOUNT(PCI_DEVICE_SIZE);
module->pci_table = PERBIT(deref_sym)(module->data,
"__mod_pci_device_table");
- module->usb_size = PERBIT(USB_DEVICE_SIZE);
+ module->usb_size = PERBITCOUNT(USB_DEVICE_SIZE);
module->usb_table = PERBIT(deref_sym)(module->data,
"__mod_usb_device_table");
- module->ccw_size = PERBIT(CCW_DEVICE_SIZE);
+ module->ccw_size = PERBITCOUNT(CCW_DEVICE_SIZE);
module->ccw_table = PERBIT(deref_sym)(module->data,
"__mod_ccw_device_table");
- module->ieee1394_size = PERBIT(IEEE1394_DEVICE_SIZE);
+ module->ieee1394_size = PERBITCOUNT(IEEE1394_DEVICE_SIZE);
module->ieee1394_table = PERBIT(deref_sym)(module->data,
"__mod_ieee1394_device_table");
- module->pnp_size = PERBIT(PNP_DEVICE_SIZE);
+ module->pnp_size = PERBITCOUNT(PNP_DEVICE_SIZE);
module->pnp_table = PERBIT(deref_sym)(module->data,
"__mod_pnp_device_table");
- module->pnp_card_size = PERBIT(PNP_CARD_DEVICE_SIZE);
+ module->pnp_card_size = PERBITCOUNT(PNP_CARD_DEVICE_SIZE);
module->pnp_card_table = PERBIT(deref_sym)(module->data,
"__mod_pnp_card_device_table");
- module->pnp_card_offset = PERBIT(PNP_CARD_DEVICE_OFFSET);
+ module->pnp_card_offset = PERBITCOUNT(PNP_CARD_DEVICE_OFFSET);
- module->input_size = PERBIT(INPUT_DEVICE_SIZE);
+ module->input_size = PERBITCOUNT(INPUT_DEVICE_SIZE);
module->input_table = PERBIT(deref_sym)(module->data,
"__mod_input_device_table");
- module->soc_size = PERBIT(SOC_DEVICE_SIZE);
+ module->soc_size = PERBITCOUNT(SOC_DEVICE_SIZE);
module->soc_table = PERBIT(deref_sym)(module->data,
"__mod_soc_device_table");

View File

@@ -0,0 +1,25 @@
diff -ruN module-init-tools-3.1-pre6.orig/modprobe.8 module-init-tools-3.1-pre6/modprobe.8
--- module-init-tools-3.1-pre6.orig/modprobe.8 2004-10-06 02:44:43.000000000 +0200
+++ module-init-tools-3.1-pre6/modprobe.8 2004-10-09 01:39:01.000000000 +0200
@@ -30,6 +30,7 @@
the modules and other files, except for the optional
\fI/etc/modprobe.conf\fR configuration file
(see \fBmodprobe.conf\fR(5)).
+All files in the \fI/etc/modprobe.d/arch/\fR directory are ignored.
.PP
Note that this version of \fBmodprobe\fR does not
do anything to the module itself: the work of resolving symbols
diff -ruN module-init-tools-3.1-pre6.orig/modprobe.c module-init-tools-3.1-pre6/modprobe.c
--- module-init-tools-3.1-pre6.orig/modprobe.c 2004-10-09 01:40:18.000000000 +0200
+++ module-init-tools-3.1-pre6/modprobe.c 2004-10-09 01:40:11.000000000 +0200
@@ -1082,6 +1082,10 @@
{
DIR *dir;
+ /* ignore everything in this directory */
+ if (streq(filename, "/etc/modprobe.d/arch"))
+ return 1;
+
/* If it's a directory, recurse. */
dir = opendir(filename);
if (dir) {

View File

@@ -0,0 +1,39 @@
Index: module-init-tools-3.1/configure.in
===================================================================
--- module-init-tools-3.1.orig/configure.in 2004-11-12 00:05:25.000000000 -0500
+++ module-init-tools-3.1/configure.in 2005-01-20 02:23:16.409792288 -0500
@@ -41,5 +41,14 @@
fi])
AC_SUBST(MODULE_DIR)
-AC_OUTPUT([Makefile])
+AC_ARG_ENABLE(manpages,
+[ --disable-manpages Disable man page generation.],
+[if test x"$enableval" != x"no"; then
+ enable_manpages=yes
+else
+ enable_manpages=no
+fi],
+[enable_manpages=yes])
+AM_CONDITIONAL([MANPAGES], test x"$enable_manpages" = x"yes")
+AC_OUTPUT([Makefile])
Index: module-init-tools-3.1/Makefile.am
===================================================================
--- module-init-tools-3.1.orig/Makefile.am 2004-07-12 02:11:46.000000000 -0400
+++ module-init-tools-3.1/Makefile.am 2005-01-20 02:24:32.155277224 -0500
@@ -21,11 +21,12 @@
MAN5 = modprobe.conf.5 modules.dep.5
MAN8 = depmod.8 insmod.8 lsmod.8 rmmod.8 modprobe.8 modinfo.8
SGML = $(addprefix doc/, $(MAN5:%.5=%.sgml) $(MAN8:%.8=%.sgml))
-man_MANS = $(MAN5) $(MAN8)
mandir = $(shell if [ `echo $(prefix)/ | tr -s /` = / ]; then echo /usr/share/man; else echo $(prefix)/man; fi)
+if MANPAGES
+man_MANS = $(MAN5) $(MAN8)
+endif
-EXTRA_DIST = generate-modprobe.conf modprobe.devfs FAQ stress_modules.sh install-with-care $(SGML) $(man_MANS)
sbin_PROGRAMS = insmod modprobe rmmod depmod modinfo insmod.static
bin_PROGRAMS = lsmod

View File

@@ -0,0 +1,55 @@
--- module-init-tools-3.0-pre10.orig/depmod.c
+++ module-init-tools-3.0-pre10/depmod.c
@@ -217,13 +217,13 @@
{
char *sep;
char pathname[strlen(argv[0])+1];
- char oldname[strlen("depmod") + strlen(argv[0]) + sizeof(".old")];
+ char oldname[strlen("depmod") + strlen(argv[0]) + sizeof(".24")];
memset(pathname, 0, strlen(argv[0])+1);
sep = strrchr(argv[0], '/');
if (sep)
memcpy(pathname, argv[0], sep - argv[0]+1);
- sprintf(oldname, "%s%s.old", pathname, "depmod");
+ sprintf(oldname, "%s%s.24", pathname, "depmod");
/* Recursion detection: we need an env var since we can't
change argv[0] (as older modutils uses it to determine
--- module-init-tools-3.0-pre10.orig/backwards_compat.c
+++ module-init-tools-3.0-pre10/backwards_compat.c
@@ -21,13 +21,13 @@
pid_t pid;
char ascii_pid[32];
char pathname[strlen(argv[0])+1];
- char oldname[strlen(progname) + strlen(argv[0]) + sizeof(".old")];
+ char oldname[strlen(progname) + strlen(argv[0]) + sizeof(".24")];
memset(pathname, 0, strlen(argv[0])+1);
sep = strrchr(argv[0], '/');
if (sep)
memcpy(pathname, argv[0], sep - argv[0]+1);
- sprintf(oldname, "%s%s.old", pathname, progname);
+ sprintf(oldname, "%s%s.24", pathname, progname);
/* Recursion detection: we need an env var since we can't
change argv[0] (as older modutils uses it to determine
--- module-init-tools-3.0-pre10.orig/generate-modprobe.conf
+++ module-init-tools-3.0-pre10/generate-modprobe.conf
@@ -26,12 +26,12 @@
cp $TESTING_MODPROBE_CONF $MODPROBECONF
elif [ "$STDIN" = "1" ]; then
cat > $MODPROBECONF
-elif [ -x /sbin/modprobe.old ]; then
+elif [ -x /sbin/modprobe.24 ]; then
# In sbin.
- /sbin/modprobe.old -c > $MODPROBECONF
-elif modprobe.old -c >/dev/null 2>&1; then
+ /sbin/modprobe.24 -c > $MODPROBECONF
+elif modprobe.24 -c >/dev/null 2>&1; then
# Somewhere in path.
- modprobe.old -c > $MODPROBECONF
+ modprobe.24 -c > $MODPROBECONF
elif /sbin/modprobe -V 2>/dev/null | grep -q 'modprobe version'; then
# Running /sbin/modprobe gives old version.
/sbin/modprobe -c > $MODPROBECONF

View File

@@ -0,0 +1,12 @@
diff -ruN module-init-tools-3.1.orig/Makefile.in module-init-tools-3.1/Makefile.in
--- module-init-tools-3.1.orig/Makefile.in 2004-11-15 01:59:48.000000000 +0100
+++ module-init-tools-3.1/Makefile.in 2004-11-21 02:18:58.000000000 +0100
@@ -613,7 +613,7 @@
check-am: all-am
$(MAKE) $(AM_MAKEFLAGS) check-TESTS
check: check-am
-all-am: Makefile $(PROGRAMS) $(SCRIPTS) $(MANS)
+all-am: Makefile $(PROGRAMS) $(SCRIPTS) #$(MANS)
installdirs:
$(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(sbindir) $(DESTDIR)$(sbindir) $(DESTDIR)$(man5dir) $(DESTDIR)$(man8dir)

View File

@@ -0,0 +1,97 @@
--- tables.c~ 2003-12-24 05:23:38.000000000 +0000
+++ tables.c 2005-04-02 13:12:24.370140112 +0100
@@ -18,6 +18,34 @@
}
/* We set driver_data to zero */
+static void output_soc_entry(struct soc_device_id *soc, char *name, FILE *out)
+{
+ fprintf(out,
+ "%-20s 0x%08x 0x0\n",
+ name,
+ soc->id);
+}
+
+void output_soc_table(struct module *modules, FILE *out)
+{
+ struct module *i;
+
+ fprintf(out, "# soc module id driver_data\n");
+
+ for (i = modules; i; i = i->next) {
+ struct soc_device_id *e;
+ char shortname[strlen(i->pathname) + 1];
+
+ if (!i->soc_table)
+ continue;
+
+ make_shortname(shortname, i->pathname);
+ for (e = i->soc_table; e->id; e = (void *)e + i->soc_size)
+ output_soc_entry(e, shortname, out);
+ }
+}
+
+/* We set driver_data to zero */
static void output_pci_entry(struct pci_device_id *pci, char *name, FILE *out)
{
fprintf(out,
--- tables.h~ 2003-12-24 05:18:54.000000000 +0000
+++ tables.h 2005-04-02 13:05:15.269373344 +0100
@@ -116,6 +116,15 @@
#define INPUT_DEVICE_SIZE32 (4 + 4 * 2 + 4 + 16 * 4 + 4 + 2 * 4 + 4 + 4 + 4 + 4 * 4 + 4)
#define INPUT_DEVICE_SIZE64 (8 + 4 * 2 + 8 + 8 * 8 + 8 + 8 + 8 + 8 + 8 + 2 * 8 + 8)
+#include <stdint.h>
+
+typedef struct soc_device_id {
+ uint32_t id;
+} soc_device_id;
+
+#define SOC_DEVICE_SIZE32 (4 + 4)
+#define SOC_DEVICE_SIZE64 (4 + 8)
+
/* Functions provided by tables.c */
struct module;
void output_usb_table(struct module *modules, FILE *out);
@@ -124,5 +133,6 @@
void output_ccw_table(struct module *modules, FILE *out);
void output_isapnp_table(struct module *modules, FILE *out);
void output_input_table(struct module *modules, FILE *out);
+void output_soc_table(struct module *modules, FILE *out);
#endif /* MODINITTOOLS_TABLES_H */
--- moduleops_core.c~ 2004-08-12 06:08:35.000000000 +0100
+++ moduleops_core.c 2005-04-02 13:04:13.367783816 +0100
@@ -196,6 +196,11 @@
module->input_size = PERBIT(INPUT_DEVICE_SIZE);
module->input_table = PERBIT(deref_sym)(module->data,
"__mod_input_device_table");
+
+ module->soc_size = PERBIT(SOC_DEVICE_SIZE);
+ module->soc_table = PERBIT(deref_sym)(module->data,
+ "__mod_soc_device_table");
+
}
struct module_ops PERBIT(mod_ops) = {
--- depmod.h~ 2003-12-24 02:10:57.000000000 +0000
+++ depmod.h 2005-04-02 13:03:19.006048056 +0100
@@ -47,6 +47,8 @@
void *pnp_card_table;
unsigned int input_size;
void *input_table;
+ unsigned int soc_size;
+ void *soc_table;
/* File contents and length. */
void *data;
--- depmod.c~ 2005-02-14 04:50:51.744716656 +0000
+++ depmod.c 2005-04-02 13:03:37.051304760 +0100
@@ -683,6 +683,7 @@
{ "modules.ieee1394map", output_ieee1394_table },
{ "modules.isapnpmap", output_isapnp_table },
{ "modules.inputmap", output_input_table },
+ { "modules.socmap", output_soc_table },
{ "modules.alias", output_aliases },
{ "modules.symbols", output_symbols },
};