diff options
| author | Alexander Kanavin <alex.kanavin@gmail.com> | 2022-07-06 10:07:01 +0200 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-07-08 00:09:42 +0100 |
| commit | 7865eeae0633dad6500d893abcda6de2e05b7528 (patch) | |
| tree | 6673fc64ccf4101390e274fdc6311b89772f481d /meta/recipes-kernel/kmod | |
| parent | 5374f51c6b383e4d82a3d122a13ab0855e72ecc0 (diff) | |
| download | poky-7865eeae0633dad6500d893abcda6de2e05b7528.tar.gz | |
kmod: upgrade 29 -> 30
(From OE-Core rev: 3f2084c3b6f2e9b251f87339e0fd60f9b1005f8c)
Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-kernel/kmod')
| -rw-r--r-- | meta/recipes-kernel/kmod/kmod/0001-depmod-Add-support-for-excluding-a-directory.patch | 172 | ||||
| -rw-r--r-- | meta/recipes-kernel/kmod/kmod_30.bb (renamed from meta/recipes-kernel/kmod/kmod_29.bb) | 3 |
2 files changed, 1 insertions, 174 deletions
diff --git a/meta/recipes-kernel/kmod/kmod/0001-depmod-Add-support-for-excluding-a-directory.patch b/meta/recipes-kernel/kmod/kmod/0001-depmod-Add-support-for-excluding-a-directory.patch deleted file mode 100644 index ea0570af2b..0000000000 --- a/meta/recipes-kernel/kmod/kmod/0001-depmod-Add-support-for-excluding-a-directory.patch +++ /dev/null | |||
| @@ -1,172 +0,0 @@ | |||
| 1 | From f50e2d67575ac5f256fb853ca9d29aeac92d9a57 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Saul Wold <saul.wold@windriver.com> | ||
| 3 | Date: Thu, 31 Mar 2022 14:56:28 -0700 | ||
| 4 | Subject: [PATCH] depmod: Add support for excluding a directory | ||
| 5 | |||
| 6 | This adds support to depmod to enable a new exclude directive in | ||
| 7 | the depmod.d/*.conf configuration file. Currently depmod | ||
| 8 | already excludes directories named source or build. This change | ||
| 9 | will allow additional directories like .debug to be excluded also | ||
| 10 | via a new exclude directive. | ||
| 11 | |||
| 12 | depmod.d/exclude.conf example: | ||
| 13 | exclude .debug | ||
| 14 | |||
| 15 | Upstream-Status: Accepted | ||
| 16 | |||
| 17 | Signed-off-by: Saul Wold <saul.wold@windriver.com> | ||
| 18 | [ Fix warnings and make should_exclude_dir() return bool ] | ||
| 19 | Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com> | ||
| 20 | --- | ||
| 21 | man/depmod.d.xml | 14 ++++++++++ | ||
| 22 | tools/depmod.c | 66 +++++++++++++++++++++++++++++++++++++++++++++--- | ||
| 23 | 2 files changed, 76 insertions(+), 4 deletions(-) | ||
| 24 | |||
| 25 | diff --git a/man/depmod.d.xml b/man/depmod.d.xml | ||
| 26 | index b315e93..76548e9 100644 | ||
| 27 | --- a/man/depmod.d.xml | ||
| 28 | +++ b/man/depmod.d.xml | ||
| 29 | @@ -131,6 +131,20 @@ | ||
| 30 | </para> | ||
| 31 | </listitem> | ||
| 32 | </varlistentry> | ||
| 33 | + <varlistentry> | ||
| 34 | + <term>exclude <replaceable>excludedir</replaceable> | ||
| 35 | + </term> | ||
| 36 | + <listitem> | ||
| 37 | + <para> | ||
| 38 | + This specifies the trailing directories that will be excluded | ||
| 39 | + during the search for kernel modules. | ||
| 40 | + </para> | ||
| 41 | + <para> | ||
| 42 | + The <replaceable>excludedir</replaceable> is the trailing directory | ||
| 43 | + to exclude | ||
| 44 | + </para> | ||
| 45 | + </listitem> | ||
| 46 | + </varlistentry> | ||
| 47 | </variablelist> | ||
| 48 | </refsect1> | ||
| 49 | |||
| 50 | diff --git a/tools/depmod.c b/tools/depmod.c | ||
| 51 | index 07a35ba..4117dd1 100644 | ||
| 52 | --- a/tools/depmod.c | ||
| 53 | +++ b/tools/depmod.c | ||
| 54 | @@ -458,6 +458,11 @@ struct cfg_external { | ||
| 55 | char path[]; | ||
| 56 | }; | ||
| 57 | |||
| 58 | +struct cfg_exclude { | ||
| 59 | + struct cfg_exclude *next; | ||
| 60 | + char exclude_dir[]; | ||
| 61 | +}; | ||
| 62 | + | ||
| 63 | struct cfg { | ||
| 64 | const char *kversion; | ||
| 65 | char dirname[PATH_MAX]; | ||
| 66 | @@ -469,6 +474,7 @@ struct cfg { | ||
| 67 | struct cfg_override *overrides; | ||
| 68 | struct cfg_search *searches; | ||
| 69 | struct cfg_external *externals; | ||
| 70 | + struct cfg_exclude *excludes; | ||
| 71 | }; | ||
| 72 | |||
| 73 | static enum search_type cfg_define_search_type(const char *path) | ||
| 74 | @@ -580,6 +586,30 @@ static void cfg_external_free(struct cfg_external *ext) | ||
| 75 | free(ext); | ||
| 76 | } | ||
| 77 | |||
| 78 | +static int cfg_exclude_add(struct cfg *cfg, const char *path) | ||
| 79 | +{ | ||
| 80 | + struct cfg_exclude *exc; | ||
| 81 | + size_t len = strlen(path); | ||
| 82 | + | ||
| 83 | + exc = malloc(sizeof(struct cfg_exclude) + len + 1); | ||
| 84 | + if (exc == NULL) { | ||
| 85 | + ERR("exclude add: out of memory\n"); | ||
| 86 | + return -ENOMEM; | ||
| 87 | + } | ||
| 88 | + memcpy(exc->exclude_dir, path, len + 1); | ||
| 89 | + | ||
| 90 | + DBG("exclude add: %s\n", path); | ||
| 91 | + | ||
| 92 | + exc->next = cfg->excludes; | ||
| 93 | + cfg->excludes = exc; | ||
| 94 | + return 0; | ||
| 95 | +} | ||
| 96 | + | ||
| 97 | +static void cfg_exclude_free(struct cfg_exclude *exc) | ||
| 98 | +{ | ||
| 99 | + free(exc); | ||
| 100 | +} | ||
| 101 | + | ||
| 102 | static int cfg_kernel_matches(const struct cfg *cfg, const char *pattern) | ||
| 103 | { | ||
| 104 | regex_t re; | ||
| 105 | @@ -657,6 +687,11 @@ static int cfg_file_parse(struct cfg *cfg, const char *filename) | ||
| 106 | } | ||
| 107 | |||
| 108 | cfg_external_add(cfg, dir); | ||
| 109 | + } else if (streq(cmd, "exclude")) { | ||
| 110 | + const char *sp; | ||
| 111 | + while ((sp = strtok_r(NULL, "\t ", &saveptr)) != NULL) { | ||
| 112 | + cfg_exclude_add(cfg, sp); | ||
| 113 | + } | ||
| 114 | } else if (streq(cmd, "include") | ||
| 115 | || streq(cmd, "make_map_files")) { | ||
| 116 | INF("%s:%u: command %s not implemented yet\n", | ||
| 117 | @@ -857,6 +892,12 @@ static void cfg_free(struct cfg *cfg) | ||
| 118 | cfg->externals = cfg->externals->next; | ||
| 119 | cfg_external_free(tmp); | ||
| 120 | } | ||
| 121 | + | ||
| 122 | + while (cfg->excludes) { | ||
| 123 | + struct cfg_exclude *tmp = cfg->excludes; | ||
| 124 | + cfg->excludes = cfg->excludes->next; | ||
| 125 | + cfg_exclude_free(tmp); | ||
| 126 | + } | ||
| 127 | } | ||
| 128 | |||
| 129 | |||
| 130 | @@ -1229,6 +1270,25 @@ add: | ||
| 131 | return 0; | ||
| 132 | } | ||
| 133 | |||
| 134 | +static bool should_exclude_dir(const struct cfg *cfg, const char *name) | ||
| 135 | +{ | ||
| 136 | + struct cfg_exclude *exc; | ||
| 137 | + | ||
| 138 | + if (name[0] == '.' && (name[1] == '\0' || | ||
| 139 | + (name[1] == '.' && name[2] == '\0'))) | ||
| 140 | + return true; | ||
| 141 | + | ||
| 142 | + if (streq(name, "build") || streq(name, "source")) | ||
| 143 | + return true; | ||
| 144 | + | ||
| 145 | + for (exc = cfg->excludes; exc != NULL; exc = exc->next) { | ||
| 146 | + if (streq(name, exc->exclude_dir)) | ||
| 147 | + return true; | ||
| 148 | + } | ||
| 149 | + | ||
| 150 | + return false; | ||
| 151 | +} | ||
| 152 | + | ||
| 153 | static int depmod_modules_search_dir(struct depmod *depmod, DIR *d, size_t baselen, struct scratchbuf *s_path) | ||
| 154 | { | ||
| 155 | struct dirent *de; | ||
| 156 | @@ -1240,11 +1300,9 @@ static int depmod_modules_search_dir(struct depmod *depmod, DIR *d, size_t basel | ||
| 157 | size_t namelen; | ||
| 158 | uint8_t is_dir; | ||
| 159 | |||
| 160 | - if (name[0] == '.' && (name[1] == '\0' || | ||
| 161 | - (name[1] == '.' && name[2] == '\0'))) | ||
| 162 | - continue; | ||
| 163 | - if (streq(name, "build") || streq(name, "source")) | ||
| 164 | + if (should_exclude_dir(depmod->cfg, name)) | ||
| 165 | continue; | ||
| 166 | + | ||
| 167 | namelen = strlen(name); | ||
| 168 | if (scratchbuf_alloc(s_path, baselen + namelen + 2) < 0) { | ||
| 169 | err = -ENOMEM; | ||
| 170 | -- | ||
| 171 | 2.31.1 | ||
| 172 | |||
diff --git a/meta/recipes-kernel/kmod/kmod_29.bb b/meta/recipes-kernel/kmod/kmod_30.bb index 32dc49c126..8eb83efe6d 100644 --- a/meta/recipes-kernel/kmod/kmod_29.bb +++ b/meta/recipes-kernel/kmod/kmod_30.bb | |||
| @@ -15,12 +15,11 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=a6f89e2100d9b6cdffcea4f398e37343 \ | |||
| 15 | " | 15 | " |
| 16 | inherit autotools bash-completion gtk-doc pkgconfig manpages update-alternatives | 16 | inherit autotools bash-completion gtk-doc pkgconfig manpages update-alternatives |
| 17 | 17 | ||
| 18 | SRCREV = "b6ecfc916a17eab8f93be5b09f4e4f845aabd3d1" | 18 | SRCREV = "5d46434a63ae0160150a0efdde1914873697e273" |
| 19 | 19 | ||
| 20 | SRC_URI = "git://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git;branch=master \ | 20 | SRC_URI = "git://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git;branch=master \ |
| 21 | file://depmod-search.conf \ | 21 | file://depmod-search.conf \ |
| 22 | file://avoid_parallel_tests.patch \ | 22 | file://avoid_parallel_tests.patch \ |
| 23 | file://0001-depmod-Add-support-for-excluding-a-directory.patch \ | ||
| 24 | " | 23 | " |
| 25 | 24 | ||
| 26 | S = "${WORKDIR}/git" | 25 | S = "${WORKDIR}/git" |
