summaryrefslogtreecommitdiff
path: root/aports/busybox/0006-modinfo-add-k-option-for-kernel-version.patch
diff options
context:
space:
mode:
authorPÁLI Gábor János <pali.gabor@gmail.com>2023-08-03 10:10:44 +0200
committerPÁLI Gábor János <pali.gabor@gmail.com>2023-09-16 17:58:03 +0200
commit89279d87c5d3e0ea330be1f927e3f3bc59dbc2a7 (patch)
tree353bc9a026d0140151e760efbc4f6a6a6b24a020 /aports/busybox/0006-modinfo-add-k-option-for-kernel-version.patch
parent084335e136581edc28137b152cc559778224570e (diff)
downloadfreebsd-wifibox-alpine-89279d87c5d3e0ea330be1f927e3f3bc59dbc2a7.zip
Update to Linux 6.1 and Alpine 3.18
- Update base-layout to 3.4.3 - Update busybox to 1.36.1 - Update iptables to 1.8.9 - Update linux-lts to 6.1.53 - Update to openrc to 0.48 - Update rtl8821ce to snapshot of 20230915 - Replace rtwB88 with a third-party driver - Update rtw89 to snapshot of 20230913 - Import wpa_supplicant fixes from Arch Linux
Diffstat (limited to 'aports/busybox/0006-modinfo-add-k-option-for-kernel-version.patch')
-rw-r--r--aports/busybox/0006-modinfo-add-k-option-for-kernel-version.patch140
1 files changed, 140 insertions, 0 deletions
diff --git a/aports/busybox/0006-modinfo-add-k-option-for-kernel-version.patch b/aports/busybox/0006-modinfo-add-k-option-for-kernel-version.patch
new file mode 100644
index 0000000..51144d4
--- /dev/null
+++ b/aports/busybox/0006-modinfo-add-k-option-for-kernel-version.patch
@@ -0,0 +1,140 @@
+From 592cc544acebfb1179bf91083870a235f72f2f64 Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa@alpinelinux.org>
+Date: Thu, 28 Apr 2022 23:04:01 +0200
+Subject: [PATCH] modinfo: add -k option for kernel version
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+It is useful to be able to specify kernel version when generating
+initramfs and similar for a kernel version that might not be the running
+one.
+
+bloatcheck on x86_64:
+
+function old new delta
+packed_usage 26193 26218 +25
+modinfo_main 391 414 +23
+.rodata 80296 80298 +2
+------------------------------------------------------------------------------
+(add/remove: 0/0 grow/shrink: 3/0 up/down: 50/0) Total: 50
+bytes
+ text data bss dec hex filename
+ 834606 14124 2008 850738 cfb32 busybox_old
+ 834657 14124 2008 850789 cfb65 busybox_unstripped
+
+Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
+---
+ modutils/modinfo.c | 30 ++++++++++++++++++------------
+ 1 file changed, 18 insertions(+), 12 deletions(-)
+
+diff --git a/modutils/modinfo.c b/modutils/modinfo.c
+index 0a86c3296..53bc02880 100644
+--- a/modutils/modinfo.c
++++ b/modutils/modinfo.c
+@@ -38,17 +38,18 @@ static const char *const shortcuts[] ALIGN_PTR = {
+
+ enum {
+ OPT_0 = (1 << 0), /* \0 as separator */
+- OPT_F = (1 << 1), /* field name */
++ OPT_k = (1 << 1), /* kernel version */
++ OPT_F = (1 << 2), /* field name */
+ /* first bits are for -nadlp options, the rest are for
+ * fields not selectable with "shortcut" options
+ */
+- OPT_n = (1 << 2),
+- OPT_TAGS = ((1 << ARRAY_SIZE(shortcuts)) - 1) << 2,
++ OPT_n = (1 << 3),
++ OPT_TAGS = ((1 << ARRAY_SIZE(shortcuts)) - 1) << 3,
+ };
+
+ static void display(const char *data, const char *pattern)
+ {
+- int flag = option_mask32 >> 1; /* shift out -0 bit */
++ int flag = option_mask32 >> 2; /* shift out -0 and -k bits */
+ if (flag & (flag-1)) {
+ /* more than one field to show: print "FIELD:" pfx */
+ int n = printf("%s:", pattern);
+@@ -82,7 +83,8 @@ static void modinfo(const char *path, const char *version,
+ }
+ }
+
+- for (j = 1; (1<<j) & (OPT_TAGS|OPT_F); j++) {
++ /* skip initial -0 and -k option bits */
++ for (j = 2; (1<<j) & (OPT_TAGS|OPT_F); j++) {
+ const char *pattern;
+
+ if (!((1<<j) & tags))
+@@ -90,7 +92,7 @@ static void modinfo(const char *path, const char *version,
+
+ pattern = field;
+ if ((1<<j) & OPT_TAGS)
+- pattern = shortcuts[j-2];
++ pattern = shortcuts[j-3];
+
+ if (strcmp(pattern, shortcuts[0]) == 0) {
+ /* "-n" or "-F filename" */
+@@ -123,7 +125,7 @@ static void modinfo(const char *path, const char *version,
+ }
+
+ //usage:#define modinfo_trivial_usage
+-//usage: "[-adlpn0] [-F keyword] MODULE"
++//usage: "[-adlpn0] [-F keyword] [-k kernel] MODULE"
+ //usage:#define modinfo_full_usage "\n\n"
+ //usage: " -a Shortcut for '-F author'"
+ //usage: "\n -d Shortcut for '-F description'"
+@@ -131,6 +133,7 @@ static void modinfo(const char *path, const char *version,
+ //usage: "\n -p Shortcut for '-F parm'"
+ ////usage: "\n -n Shortcut for '-F filename'"
+ //usage: "\n -F keyword Keyword to look for"
++//usage: "\n -k kernel kernel version"
+ //usage: "\n -0 NUL terminated output"
+ //usage:#define modinfo_example_usage
+ //usage: "$ modinfo -F vermagic loop\n"
+@@ -139,6 +142,7 @@ int modinfo_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
+ int modinfo_main(int argc UNUSED_PARAM, char **argv)
+ {
+ const char *field;
++ const char *kernel;
+ char name[MODULE_NAME_LEN];
+ struct utsname uts;
+ parser_t *parser;
+@@ -147,15 +151,17 @@ int modinfo_main(int argc UNUSED_PARAM, char **argv)
+ unsigned i;
+
+ field = NULL;
+- opts = getopt32(argv, "^" "0F:nadlp" "\0" "-1"/*minimum one arg*/, &field);
++ uname(&uts);
++ kernel = uts.release;
++ opts = getopt32(argv, "^" "0k:F:nadlp" "\0" "-1"/*minimum one arg*/, &kernel, &field);
+ /* If no field selected, show all */
+ if (!(opts & (OPT_TAGS|OPT_F)))
+ option_mask32 |= OPT_TAGS;
++
+ argv += optind;
+
+- uname(&uts);
+ parser = config_open2(
+- xasprintf("%s/%s/%s", CONFIG_DEFAULT_MODULES_DIR, uts.release, CONFIG_DEFAULT_DEPMOD_FILE),
++ xasprintf("%s/%s/%s", CONFIG_DEFAULT_MODULES_DIR, kernel, CONFIG_DEFAULT_DEPMOD_FILE),
+ xfopen_for_read
+ );
+
+@@ -167,7 +173,7 @@ int modinfo_main(int argc UNUSED_PARAM, char **argv)
+ filename2modname(bb_basename(tokens[0]), name);
+ for (i = 0; argv[i]; i++) {
+ if (fnmatch(argv[i], name, 0) == 0) {
+- modinfo(tokens[0], uts.release, field);
++ modinfo(tokens[0], kernel, field);
+ argv[i] = (char *) "";
+ }
+ }
+@@ -177,7 +183,7 @@ int modinfo_main(int argc UNUSED_PARAM, char **argv)
+
+ for (i = 0; argv[i]; i++) {
+ if (argv[i][0]) {
+- modinfo(argv[i], uts.release, field);
++ modinfo(argv[i], kernel, field);
+ }
+ }
+