The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Ben Hutchings <ben@decadent.org.uk>
To: LKML <linux-kernel@vger.kernel.org>,
	David Woodhouse <dwmw2@infradead.org>
Subject: [RFC][PATCH 1/2] firmware, module: Keep names of firmware blobs required by built-in drivers
Date: Sun, 18 Dec 2011 02:07:56 +0000	[thread overview]
Message-ID: <1324174076.2844.11.camel@deadeye> (raw)
In-Reply-To: <1324173539.2844.9.camel@deadeye>

[-- Attachment #1: Type: text/plain, Size: 1676 bytes --]

[This belongs before the previous patch, which should be considered
2/2.]

Change MODULE_FIRMWARE() to include the given blob name to the object
file even when not building a module.  Discard that information when
linking vmlinux.

This will allow us to stop repeating this information in
firmware/Makefile.
---
 include/asm-generic/vmlinux.lds.h |    1 +
 include/linux/module.h            |    7 +++++++
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index b5e2e4c..7d1f1d7 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -678,6 +678,7 @@
 	EXIT_CALL							\
 	*(.discard)							\
 	*(.discard.*)							\
+	*(.firmware_wanted)						\
 	}
 
 /**
diff --git a/include/linux/module.h b/include/linux/module.h
index 3cb7839..2cc323d 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -176,7 +176,14 @@ extern const struct gtype##_id __mod_##gtype##_table		\
 /* Optional firmware file (or files) needed by the module
  * format is simply firmware file name.  Multiple firmware
  * files require multiple MODULE_FIRMWARE() specifiers */
+#ifdef MODULE
 #define MODULE_FIRMWARE(_firmware) MODULE_INFO(firmware, _firmware)
+#else
+#define MODULE_FIRMWARE(_firmware)					\
+	static const char __module_cat(firmware, __LINE__)[]		\
+	__used __attribute__((section(".firmware_wanted"), unused, aligned(1))) \
+	= _firmware
+#endif
 
 /* Given an address, look for it in the exception tables */
 const struct exception_table_entry *search_exception_tables(unsigned long add);
-- 
1.7.7.3



[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

      reply	other threads:[~2011-12-18  2:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-18  1:58 [RFC][PATCH] firmware, kbuild: Get all firmware blobs from a separate directory Ben Hutchings
2011-12-18  2:07 ` Ben Hutchings [this message]

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=1324174076.2844.11.camel@deadeye \
    --to=ben@decadent.org.uk \
    --cc=dwmw2@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    /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