All of lore.kernel.org
 help / color / mirror / Atom feed
* where is headers_install in KBUILD
@ 2019-02-25 11:43 YU Bo
  2019-02-25 17:54 ` valdis.kletnieks
  0 siblings, 1 reply; 3+ messages in thread
From: YU Bo @ 2019-02-25 11:43 UTC (permalink / raw)
  To: kernelnewbies

Hello,
Now i want to compile kernel and test userspace program fastly and i find
a good guide link:
https://vincent.bernat.ch/en/blog/2014-eudyptula-boot
In the article, author compile kernel with KBUILD(custom install vmlinux...)

1. export KBUILD_OPTPUT=$HOME/src/kernel-build
Is this generate a copy of linux kernel source, right?
2. edit .config and make
3. sudo make modules_install install {INSTALL_MOD_PATH,INSTALL_PATH}=$HOME/src/kernel-dev

Ok, I did it and booted a VM with qemu, it is cool.
But, my "question" is:  when i test some program which needs kernel headers,
where to install those headers file?
In Documention/kbuild/headers_install.rst, i learn it :
	make headers_install INSTALL_HDR_PATH=/usr
In my case, Is it ok to do that?I do not think it will work.
May i:
	make headers_install INSTALL_HDR_PATH=$HOME/src/kernel-headers
is it Ok?

Thank you very much!
Bo


_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: where is headers_install in KBUILD
  2019-02-25 11:43 where is headers_install in KBUILD YU Bo
@ 2019-02-25 17:54 ` valdis.kletnieks
  2019-02-26  7:40   ` Bo YU
  0 siblings, 1 reply; 3+ messages in thread
From: valdis.kletnieks @ 2019-02-25 17:54 UTC (permalink / raw)
  To: YU Bo; +Cc: kernelnewbies

On Mon, 25 Feb 2019 06:43:39 -0500, YU Bo said:

> But, my "question" is:  when i test some program which needs kernel headers,
> where to install those headers file?
> In Documention/kbuild/headers_install.rst, i learn it :
> 	make headers_install INSTALL_HDR_PATH=/usr
> In my case, Is it ok to do that?I do not think it will work.

You need to put the headers into a directory that will be accessible to your
"program that needs kernel headers" at build time. Hint: gcc has a "-I" option
for a reason, and CFLAGS is an actual thing for a reason....

Note that in general, most programs *won't* need the new kernel headers,
because glibc (or musl, or whatever your libc is) will be insulating you from
the actual syscall interface anyhow.

Also, dropping the headers into /usr/include is dangerous, as the next time
you apply software updates, they could overlay your version of the headers
with the distro's version, which will cause lots of debugging fun the next time
you rebuild your program and it builds against old headers.  If you're lucky,
the build will fail.  If you're unlucky, the program will build but fail in subtle
ways at runtime....

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: where is headers_install in KBUILD
  2019-02-25 17:54 ` valdis.kletnieks
@ 2019-02-26  7:40   ` Bo YU
  0 siblings, 0 replies; 3+ messages in thread
From: Bo YU @ 2019-02-26  7:40 UTC (permalink / raw)
  To: valdis.kletnieks; +Cc: kernelnewbies


[-- Attachment #1.1: Type: text/plain, Size: 1510 bytes --]

On Tue, Feb 26, 2019 at 1:54 AM <valdis.kletnieks@vt.edu> wrote:

> On Mon, 25 Feb 2019 06:43:39 -0500, YU Bo said:
>
> > But, my "question" is:  when i test some program which needs kernel
> headers,
> > where to install those headers file?
> > In Documention/kbuild/headers_install.rst, i learn it :
> >       make headers_install INSTALL_HDR_PATH=/usr
> > In my case, Is it ok to do that?I do not think it will work.
>
> You need to put the headers into a directory that will be accessible to
> your
> "program that needs kernel headers" at build time. Hint: gcc has a "-I"
> option
> for a reason, and CFLAGS is an actual thing for a reason....
>
> Note that in general, most programs *won't* need the new kernel headers,
> because glibc (or musl, or whatever your libc is) will be insulating you
> from
> the actual syscall interface anyhow.
>
> Also, dropping the headers into /usr/include is dangerous, as the next time
> you apply software updates, they could overlay your version of the headers
> with the distro's version, which will cause lots of debugging fun the next
> time
> you rebuild your program and it builds against old headers.  If you're
> lucky,
> the build will fail.  If you're unlucky, the program will build but fail
> in subtle
> ways at runtime....
>
Thank you for reply.I do not kow to explain the way,but i tried it.
In my case,
```bash
# cd  ~/src/kernel-dev/lib/modules/5.0.0-rc8/build
make headers_install
```
I think the way, which can effect  VM(i logged in).
Thank you :)

[-- Attachment #1.2: Type: text/html, Size: 2028 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-02-26  7:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-25 11:43 where is headers_install in KBUILD YU Bo
2019-02-25 17:54 ` valdis.kletnieks
2019-02-26  7:40   ` Bo YU

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.