[RFC][PATCH 1/2] firmware, module: Keep names of firmware blobsrequired by built-in drivers

From: Ben Hutchings
Date: Sat Dec 17 2011 - 21:08:11 EST


[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: signature.asc
Description: This is a digitally signed message part