From 6b703b1c319c911e2ba7b0b0323b2f6b86b5f6ab Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Tue, 9 May 2006 16:12:17 +0000 Subject: Sync kernel module utils with OE (needed for kernel.bbclass changes) git-svn-id: https://svn.o-hand.com/repos/poky/trunk@376 311d38ba-8fff-0310-9ca6-ca027cbcb966 --- .../module-init-tools/files/depmod-byteswap.patch | 288 --------------------- .../packages/module-init-tools/files/soc.patch | 97 ------- .../module-init-tools-cross_3.2.2.bb | 1 + .../module-init-tools/module-init-tools_3.2.2.bb | 8 +- .../packages/modutils/modutils-cross_2.4.27.bb | 3 +- openembedded/packages/modutils/modutils_2.4.27.bb | 4 +- 6 files changed, 9 insertions(+), 392 deletions(-) delete mode 100644 openembedded/packages/module-init-tools/files/depmod-byteswap.patch delete mode 100644 openembedded/packages/module-init-tools/files/soc.patch diff --git a/openembedded/packages/module-init-tools/files/depmod-byteswap.patch b/openembedded/packages/module-init-tools/files/depmod-byteswap.patch deleted file mode 100644 index 1b46708b30..0000000000 --- a/openembedded/packages/module-init-tools/files/depmod-byteswap.patch +++ /dev/null @@ -1,288 +0,0 @@ -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 - #include - #include -+#include - - #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"); - diff --git a/openembedded/packages/module-init-tools/files/soc.patch b/openembedded/packages/module-init-tools/files/soc.patch deleted file mode 100644 index ee5f11042f..0000000000 --- a/openembedded/packages/module-init-tools/files/soc.patch +++ /dev/null @@ -1,97 +0,0 @@ ---- 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 -+ -+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 }, - }; diff --git a/openembedded/packages/module-init-tools/module-init-tools-cross_3.2.2.bb b/openembedded/packages/module-init-tools/module-init-tools-cross_3.2.2.bb index 4bcc311709..fc8b461945 100644 --- a/openembedded/packages/module-init-tools/module-init-tools-cross_3.2.2.bb +++ b/openembedded/packages/module-init-tools/module-init-tools-cross_3.2.2.bb @@ -8,6 +8,7 @@ EXTRA_OECONF_append = " --program-prefix=${TARGET_PREFIX}" do_stage () { oe_runmake install + mv ${bindir}/${TARGET_PREFIX}depmod ${bindir}/${TARGET_PREFIX}depmod-2.6 } do_install () { diff --git a/openembedded/packages/module-init-tools/module-init-tools_3.2.2.bb b/openembedded/packages/module-init-tools/module-init-tools_3.2.2.bb index bbd8cca1bf..727bfaac1b 100644 --- a/openembedded/packages/module-init-tools/module-init-tools_3.2.2.bb +++ b/openembedded/packages/module-init-tools/module-init-tools_3.2.2.bb @@ -3,7 +3,7 @@ removing kernel modules for Linux (versions 2.5.48 and above). It serves \ the same function that the modutils package serves for Linux 2.4." LICENSE = "GPL" SECTION = "base" -PR = "r0" +PR = "r2" PACKAGES =+ "module-init-tools-insmod-static module-init-tools-depmod" RDEPENDS_${PN} += "module-init-tools-depmod" @@ -34,7 +34,7 @@ do_install() { pkg_postinst_module-init-tools() { #!/bin/sh -for f in sbin/insmod sbin/modprobe sbin/rmmod sbin/depmod sbin/modinfo; do +for f in sbin/insmod sbin/modprobe sbin/rmmod sbin/modinfo; do bn=`basename $f` update-alternatives --install /$f $bn /$f.26 60 done @@ -44,7 +44,7 @@ update-alternatives --install /sbin/lsmod lsmod /bin/lsmod.26 60 pkg_prerm_module-init-tools() { #!/bin/sh -for f in sbin/insmod sbin/modprobe sbin/rmmod sbin/depmod sbin/modinfo; do +for f in sbin/insmod sbin/modprobe sbin/rmmod sbin/modinfo; do bn=`basename $f` update-alternatives --remove $bn /$f.26 done @@ -57,7 +57,7 @@ pkg_postinst_module-init-tools-depmod() { update-alternatives --install /sbin/depmod depmod /sbin/depmod.26 60 } -pkg_prerm_module-init-tools() { +pkg_prerm_module-init-tools-depmod() { #!/bin/sh update-alternatives --remove depmod /sbin/depmod.26 } diff --git a/openembedded/packages/modutils/modutils-cross_2.4.27.bb b/openembedded/packages/modutils/modutils-cross_2.4.27.bb index 2b301d7d09..834f13adbd 100644 --- a/openembedded/packages/modutils/modutils-cross_2.4.27.bb +++ b/openembedded/packages/modutils/modutils-cross_2.4.27.bb @@ -1,6 +1,6 @@ SECTION = "base" include modutils_${PV}.bb -PR = "r6" +PR = "r8" inherit cross S = "${WORKDIR}/modutils-${PV}" DEPENDS = "" @@ -19,6 +19,7 @@ CFLAGS_prepend_mipseb = "-D__MIPSEB__" do_stage () { oe_runmake install + mv ${bindir}/${TARGET_PREFIX}depmod ${bindir}/${TARGET_PREFIX}depmod-2.4 } do_install () { diff --git a/openembedded/packages/modutils/modutils_2.4.27.bb b/openembedded/packages/modutils/modutils_2.4.27.bb index 9fa7cef105..56420f7de0 100644 --- a/openembedded/packages/modutils/modutils_2.4.27.bb +++ b/openembedded/packages/modutils/modutils_2.4.27.bb @@ -39,10 +39,10 @@ for f in sbin/insmod sbin/modprobe sbin/rmmod bin/lsmod; do done if test -n "$D"; then D="-r $D" - if test -n "`which ${TARGET_PREFIX}depmod`"; then + if test -n "`which ${TARGET_PREFIX}depmod-2.4`"; then for kerneldir in `ls -p ${IMAGE_ROOTFS}/lib/modules|grep /`; do kernelver=`basename $kerneldir` - ${TARGET_PREFIX}depmod -a -b ${IMAGE_ROOTFS} -C ${IMAGE_ROOTFS}/${sysconfdir}/modules.conf -r $kernelver + ${TARGET_PREFIX}depmod-2.4 -a -b ${IMAGE_ROOTFS} -C ${IMAGE_ROOTFS}/${sysconfdir}/modules.conf -r $kernelver done fi fi -- cgit v1.2.3-54-g00ecf