Skip to contentSkip to conversation

kconfig: adding new config path

PATCH In review Li Wang 3 participants 5 messages Oct 20, 2022 – Oct 24, 2022 Library code

lore
Share & tools
lore

Li Wang

author
#0 lore raw

PATCH 1/1 kconfig: adding new config path

To make kconfig parsing on RHIVOS(Red Hat In-Vehicle Operating System) correctly.

Before:

  # ./sendto03
  tst_kconfig.c:65: TINFO: Couldn't locate kernel config!
  tst_kconfig.c:201: TBROK: Cannot parse kernel .config

After:

  # ./sendto03
  tst_kconfig.c:88: TINFO: Parsing kernel config '/lib/modules/5.14.0-174.137.el9iv.aarch64/config'
  tst_test.c:1526: TINFO: Timeout per run is 0h 00m 30s
  sendto03.c:91: TPASS: setsockopt(PACKET_RESERVE) value is capped: EINVAL (22)
  sendto03.c:197: TPASS: Nothing bad happened, probably
Cc Brian Grech <[email protected]>
---
 lib/tst_kconfig.c | 6 ++++++
 1 file changed, 6 insertions(+)
lib/tst_kconfig.c +6 -0
index ac13866e8..a97489564 100644
@@ -47,6 +47,12 @@ static const char *kconfig_path(char *path_buf, size_t path_buf_len)
 	/* Common install module path */
 	snprintf(path_buf, path_buf_len, "/lib/modules/%s/build/.config", un.release);
 
+	if (!access(path_buf, F_OK))
+		return path_buf;
+
+	/* RHIVOS config path */
+	snprintf(path_buf, path_buf_len, "/lib/modules/%s/config", un.release);
+
 	if (!access(path_buf, F_OK))
 		return path_buf;
 
Signature · 5 lines
2.35.3


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
Reviewed-by on v1 1/1
#1 lore raw

Hi Li

Quoted 25 lines

To make kconfig parsing on RHIVOS(Red Hat In-Vehicle Operating System) correctly.

Before:

   # ./sendto03
   tst_kconfig.c:65: TINFO: Couldn't locate kernel config!
   tst_kconfig.c:201: TBROK: Cannot parse kernel .config

After:

   # ./sendto03
   tst_kconfig.c:88: TINFO: Parsing kernel config '/lib/modules/5.14.0-174.137.el9iv.aarch64/config'
   tst_test.c:1526: TINFO: Timeout per run is 0h 00m 30s
   sendto03.c:91: TPASS: setsockopt(PACKET_RESERVE) value is capped: EINVAL (22)
   sendto03.c:197: TPASS: Nothing bad happened, probably
Cc Brian Grech <[email protected]>
---
  lib/tst_kconfig.c | 6 ++++++
  1 file changed, 6 insertions(+)
lib/tst_kconfig.c +0 -0
index ac13866e8..a97489564 100644

lib/tst_kconfig.c static const char *kconfig_path(char *path_buf, size_t path_buf_len) · line 54

Quoted 8 lines
lib/tst_kconfig.c +5 -0
@@ -47,6 +47,12 @@ static const char *kconfig_path(char *path_buf, size_t path_buf_len)
  	/* Common install module path */
  	snprintf(path_buf, path_buf_len, "/lib/modules/%s/build/.config", un.release);
 
+	if (!access(path_buf, F_OK))
+		return path_buf;
+
+	/* RHIVOS config path */
+	snprintf(path_buf, path_buf_len, "/lib/modules/%s/config", un.release);

This kconfig path is also common, so

ps: I guess RHIVOS doesn't have kconfig file in /boot directory, so it can't be parsed. Is it right?

Best Regards
Yang Xu

Quoted 4 lines
lib/tst_kconfig.c +1 -0
+
  	if (!access(path_buf, F_OK))
  		return path_buf;
 
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
author
#2 lore raw
Quoted 35 lines · On Thu, Oct 20, 2022 at 12:02 PM [email protected] <…

Hi Li

Quoted 1 line

To make kconfig parsing on RHIVOS(Red Hat In-Vehicle Operating System)

correctly.

Quoted 9 lines

Before:

   # ./sendto03
   tst_kconfig.c:65: TINFO: Couldn't locate kernel config!
   tst_kconfig.c:201: TBROK: Cannot parse kernel .config

After:

   # ./sendto03
   tst_kconfig.c:88: TINFO: Parsing kernel config

'/lib/modules/5.14.0-174.137.el9iv.aarch64/config'

Quoted 2 lines

tst_test.c:1526: TINFO: Timeout per run is 0h 00m 30s sendto03.c:91: TPASS: setsockopt(PACKET_RESERVE) value is capped:

EINVAL (22)

lib/tst_kconfig.c static const char *kconfig_path(char *path_buf,

Quoted 13 lines

sendto03.c:197: TPASS: Nothing bad happened, probably

Cc Brian Grech <[email protected]>
---
  lib/tst_kconfig.c | 6 ++++++
  1 file changed, 6 insertions(+)
lib/tst_kconfig.c +0 -0
index ac13866e8..a97489564 100644
@@ -47,6 +47,12 @@ static const char *kconfig_path(char *path_buf,

size_t path_buf_len)

lib/tst_kconfig.c static const char *kconfig_path(char *path_buf, · line 48

Quoted 2 lines
lib/tst_kconfig.c +0 -0
      /* Common install module path */
      snprintf(path_buf, path_buf_len, "/lib/modules/%s/build/.config",

un.release);

Quoted 1 line
Quoted 9 lines

lib/tst_kconfig.c static const char *kconfig_path(char *path_buf, size_t path_buf_len)

Quoted 5 lines
lib/tst_kconfig.c +5 -0
+     if (!access(path_buf, F_OK))
+             return path_buf;
+
+     /* RHIVOS config path */
+     snprintf(path_buf, path_buf_len, "/lib/modules/%s/config",

un.release);
This kconfig path is also common, so

Thanks!

Quoted 3 lines

ps: I guess RHIVOS doesn't have kconfig file in /boot directory, so it can't be parsed. Is it right?

That's right. And I would leave this patch one more day for others to review.

Signature · 2 lines
Regards,
Li Wang
Signature · 2 lines
-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
Reviewed-by
#3 lore raw

Hi Li,

+ /* RHIVOS config path */
+ snprintf(path_buf, path_buf_len, "/lib/modules/%s/config", un.release);

FYI openSUSE Tumbleweed also moved config to this path, I'd remove the comment and mentioned also openSUSE Tumbleweed. In the end we add also symlinks to /boot (the usual place) so that Tumbleweed works without this patch, but I guess it's better to mention that it's not just RHIVOS specific.

Kind regards,
Petr

Quoted 6 lines
Quoted 2 lines

ps: I guess RHIVOS doesn't have kconfig file in /boot directory, so it can't be parsed. Is it right?

That's right. And I would leave this patch one more day for others to review.

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
author
#4 lore raw
Quoted 7 lines · Petr Vorel

FYI openSUSE Tumbleweed also moved config to this path, I'd remove the comment
and mentioned also openSUSE Tumbleweed. In the end we add also symlinks to /boot
(the usual place) so that Tumbleweed works without this patch, but I guess it's
better to mention that it's not just RHIVOS specific.

Thanks for the info, very useful!
Modified and pushed.

Signature · 2 lines
Regards,
Li Wang
Signature · 2 lines
-- 
Mailing list info: https://lists.linux.it/listinfo/ltp