From: Masahiro Yamada <masahiroy@kernel.org>
To: linux-kbuild@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
Masahiro Yamada <masahiroy@kernel.org>,
Nicolas Schier <n.schier@avm.de>,
Jonathan Corbet <corbet@lwn.net>,
Nathan Chancellor <nathan@kernel.org>,
Nicolas Schier <nicolas@fjasle.eu>,
linux-doc@vger.kernel.org
Subject: [PATCH v2 3/5] kbuild: doc: remove the description about shipped files
Date: Fri, 20 Sep 2024 02:37:16 +0900 [thread overview]
Message-ID: <20240919173740.1080501-3-masahiroy@kernel.org> (raw)
In-Reply-To: <20240919173740.1080501-1-masahiroy@kernel.org>
The use of shipped files is discouraged in the upstream kernel these
days. [1]
Downstream Makefiles have the freedom to use shipped files or other
options to handle binaries, but this should not be advertised in the
upstream document.
[1]: https://lore.kernel.org/all/CAHk-=wgSEi_ZrHdqr=20xv+d6dr5G895CbOAi8ok+7-CQUN=fQ@mail.gmail.com/
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nicolas Schier <n.schier@avm.de>
---
Changes in v2:
- Remove TODO item in makefiles.rst
Documentation/kbuild/makefiles.rst | 1 -
Documentation/kbuild/modules.rst | 35 +++---------------------------
2 files changed, 3 insertions(+), 33 deletions(-)
diff --git a/Documentation/kbuild/makefiles.rst b/Documentation/kbuild/makefiles.rst
index be43990f1e7f..7964e0c245ae 100644
--- a/Documentation/kbuild/makefiles.rst
+++ b/Documentation/kbuild/makefiles.rst
@@ -1665,6 +1665,5 @@ Credits
TODO
====
-- Describe how kbuild supports shipped files with _shipped.
- Generating offset header files.
- Add more variables to chapters 7 or 9?
diff --git a/Documentation/kbuild/modules.rst b/Documentation/kbuild/modules.rst
index c4a0598aa276..080e11372351 100644
--- a/Documentation/kbuild/modules.rst
+++ b/Documentation/kbuild/modules.rst
@@ -152,7 +152,6 @@ module 8123.ko, which is built from the following files::
8123_if.c
8123_if.h
8123_pci.c
- 8123_bin.o_shipped <= Binary blob
Shared Makefile
---------------
@@ -170,7 +169,7 @@ Shared Makefile
ifneq ($(KERNELRELEASE),)
# kbuild part of makefile
obj-m := 8123.o
- 8123-y := 8123_if.o 8123_pci.o 8123_bin.o
+ 8123-y := 8123_if.o 8123_pci.o
else
# normal makefile
@@ -179,10 +178,6 @@ Shared Makefile
default:
$(MAKE) -C $(KDIR) M=$$PWD
- # Module specific targets
- genbin:
- echo "X" > 8123_bin.o_shipped
-
endif
The check for KERNELRELEASE is used to separate the two parts
@@ -204,7 +199,7 @@ Separate Kbuild File and Makefile
--> filename: Kbuild
obj-m := 8123.o
- 8123-y := 8123_if.o 8123_pci.o 8123_bin.o
+ 8123-y := 8123_if.o 8123_pci.o
--> filename: Makefile
KDIR ?= /lib/modules/`uname -r`/build
@@ -212,35 +207,11 @@ Separate Kbuild File and Makefile
default:
$(MAKE) -C $(KDIR) M=$$PWD
- # Module specific targets
- genbin:
- echo "X" > 8123_bin.o_shipped
-
The split in example 2 is questionable due to the simplicity of
each file; however, some external modules use makefiles
consisting of several hundred lines, and here it really pays
off to separate the kbuild part from the rest.
-Binary Blobs
-------------
-
- Some external modules need to include an object file as a blob.
- kbuild has support for this, but requires the blob file to be
- named <filename>_shipped. When the kbuild rules kick in, a copy
- of <filename>_shipped is created with _shipped stripped off,
- giving us <filename>. This shortened filename can be used in
- the assignment to the module.
-
- Throughout this section, 8123_bin.o_shipped has been used to
- build the kernel module 8123.ko; it has been included as
- 8123_bin.o::
-
- 8123-y := 8123_if.o 8123_pci.o 8123_bin.o
-
- Although there is no distinction between the ordinary source
- files and the binary file, kbuild will pick up different rules
- when creating the object file for the module.
-
Building Multiple Modules
-------------------------
@@ -301,7 +272,7 @@ Single Subdirectory
obj-m := 8123.o
ccflags-y := -I $(src)/include
- 8123-y := 8123_if.o 8123_pci.o 8123_bin.o
+ 8123-y := 8123_if.o 8123_pci.o
Several Subdirectories
----------------------
--
2.43.0
next prev parent reply other threads:[~2024-09-19 17:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-19 17:37 [PATCH v2 1/5] kbuild: doc: throw out the local table of contents in modules.rst Masahiro Yamada
2024-09-19 17:37 ` [PATCH v2 2/5] kbuild: doc: drop section numbering, use references " Masahiro Yamada
2024-09-19 17:37 ` Masahiro Yamada [this message]
2024-09-19 17:37 ` [PATCH v2 4/5] kbuild: doc: describe the -C option precisely for external module builds Masahiro Yamada
2024-09-19 17:37 ` [PATCH v2 5/5] kbuild: doc: replace "gcc" in external module description Masahiro Yamada
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240919173740.1080501-3-masahiroy@kernel.org \
--to=masahiroy@kernel.org \
--cc=corbet@lwn.net \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=n.schier@avm.de \
--cc=nathan@kernel.org \
--cc=nicolas@fjasle.eu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox