diff mbox series

kconfig: adding new config path

Message ID 20221020034140.3472638-1-liwang@redhat.com
State Accepted
Headers show
Series kconfig: adding new config path | expand

Commit Message

Li Wang Oct. 20, 2022, 3:41 a.m. UTC
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

Signed-off-by: Li Wang <liwang@redhat.com>
Cc: Brian Grech <bgrech@redhat.com>
---
 lib/tst_kconfig.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Yang Xu Oct. 20, 2022, 4:01 a.m. UTC | #1
Hi Li

> 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
> 
> Signed-off-by: Li Wang <liwang@redhat.com>
> Cc: Brian Grech <bgrech@redhat.com>
> ---
>   lib/tst_kconfig.c | 6 ++++++
>   1 file changed, 6 insertions(+)
> 
> diff --git a/lib/tst_kconfig.c b/lib/tst_kconfig.c
> index ac13866e8..a97489564 100644
> --- a/lib/tst_kconfig.c
> +++ b/lib/tst_kconfig.c
> @@ -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
Reviewed-by: Yang Xu <xuyang2018.jy@fujitsu.com>

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
> +
>   	if (!access(path_buf, F_OK))
>   		return path_buf;
>
Li Wang Oct. 20, 2022, 5:52 a.m. UTC | #2
On Thu, Oct 20, 2022 at 12:02 PM xuyang2018.jy@fujitsu.com <
xuyang2018.jy@fujitsu.com> wrote:

> Hi Li
>
> > 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
> >
> > Signed-off-by: Li Wang <liwang@redhat.com>
> > Cc: Brian Grech <bgrech@redhat.com>
> > ---
> >   lib/tst_kconfig.c | 6 ++++++
> >   1 file changed, 6 insertions(+)
> >
> > diff --git a/lib/tst_kconfig.c b/lib/tst_kconfig.c
> > index ac13866e8..a97489564 100644
> > --- a/lib/tst_kconfig.c
> > +++ b/lib/tst_kconfig.c
> > @@ -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
> Reviewed-by: Yang Xu <xuyang2018.jy@fujitsu.com>
>

Thanks!


> 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.
Petr Vorel Oct. 21, 2022, 11:17 a.m. UTC | #3
Hi Li,

Reviewed-by: Petr Vorel <pvorel@suse.cz>

+	/* 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

> > 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.
Li Wang Oct. 24, 2022, 2:53 a.m. UTC | #4
Petr Vorel <pvorel@suse.cz> wrote:


> 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.
diff mbox series

Patch

diff --git a/lib/tst_kconfig.c b/lib/tst_kconfig.c
index ac13866e8..a97489564 100644
--- a/lib/tst_kconfig.c
+++ b/lib/tst_kconfig.c
@@ -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;