Re: [PATCH 1/6] kbuild: add support for building userspace api programs

From: Randy Dunlap
Date: Sun Jul 13 2014 - 15:24:09 EST


Hi Sam,

On 07/13/14 11:42, Sam Ravnborg wrote:
>
> diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt
> index c600e2f..713ea10 100644
> --- a/Documentation/kbuild/makefiles.txt
> +++ b/Documentation/kbuild/makefiles.txt
> @@ -761,7 +763,43 @@ Both possibilities are described in the following.
> like hostprogs-y. But only hostprogs-y is recommended to be used
> when no CONFIG symbols are involved.
>
> -=== 5 Kbuild clean infrastructure
> +=== 5 Samples support (uapiprogs-y)
> +
> +Kbuild support building sample modules and sample binaries.

supports

> +To build sample modules the existing infrastructure is used, but
> +to build sample binaries kbuild adds dedicated suppport.
> +
> +The sample binaries are build for the same host and bit-size as the kernel.

built

> +
> +The samples may demonstrate facilities not yet available
> +in the installed libc therefore they are build so they include

libc; built

> +headers from the exported uapi headers before the libc headers
> +are searched.
> +
> +The sample binaries are usually placed in sub-directories
> +below samples/ and specified in samples/Makefile.
> +The directories containing sample binaries are listed using
> +subdir-y - usually like this: subdir-$(CONFIG_SAMPLES) += dir
> +
> +The individual binaries may be defined as single .c file per binary
> +or several .c files for a single binary.
> +See the following examples.
> +
> + Example:
> + # samples/hid/Makefile
> + uapiprogs-y := hid-example
> +
> + This will compile hid-example.c and create an executable named hid-example.
> +
> + Example:
> + # samples/seccomp/Makefile
> + uapiprogs-y := bpf-fancy
> + bpf-fancy-y := bpf-fancy.o bpf-helper.o
> +
> +This will compile bpf-fancy.c and bpf-helper.c, and then link the executable
> +bpf-fancy, based on bpf-fancy.o bpf-helper.o.
> +
> +=== 6 Kbuild clean infrastructure
>
> "make clean" deletes most generated files in the obj tree where the kernel
> is compiled. This includes generated files such as host programs.


--
~Randy
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/