public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Use .incbin for config_data.gz
@ 2005-09-24 18:30 Brian Gerst
  2005-09-25 10:13 ` Ingo Oeser
  0 siblings, 1 reply; 3+ messages in thread
From: Brian Gerst @ 2005-09-24 18:30 UTC (permalink / raw)
  To: Andrew Morton; +Cc: lkml

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

Instead of creating config_data.h, use .incbin in inline assembly to
directly include config_data.gz.

Signed-off-by: Brian Gerst <bgerst@didntduck.org>

[-- Attachment #2: 0002-Use-.incbin-for-config_data.gz.txt --]
[-- Type: text/plain, Size: 2211 bytes --]

Subject: [PATCH] Use .incbin for config_data.gz

Instead of creating config_data.h, use .incbin in inline assembly to
directly include config_data.gz.

Signed-off-by: Brian Gerst <bgerst@didntduck.org>

---

 kernel/Makefile  |    9 +--------
 kernel/configs.c |   18 +++++++++++++-----
 2 files changed, 14 insertions(+), 13 deletions(-)

5674a0222370187dbe3401cb7a380c491a13f167
diff --git a/kernel/Makefile b/kernel/Makefile
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -41,16 +41,9 @@ ifneq ($(CONFIG_SCHED_NO_NO_OMIT_FRAME_P
 CFLAGS_sched.o := $(PROFILING) -fno-omit-frame-pointer
 endif
 
-$(obj)/configs.o: $(obj)/config_data.h
+$(obj)/configs.o: $(obj)/config_data.gz
 
-# config_data.h contains the same information as ikconfig.h but gzipped.
 # Info from config_data can be extracted from /proc/config*
 targets += config_data.gz
 $(obj)/config_data.gz: .config FORCE
 	$(call if_changed,gzip)
-
-quiet_cmd_ikconfiggz = IKCFG   $@
-      cmd_ikconfiggz = (echo "static const char kernel_config_data[] = MAGIC_START"; cat $< | scripts/bin2c; echo "MAGIC_END;") > $@
-targets += config_data.h
-$(obj)/config_data.h: $(obj)/config_data.gz FORCE
-	$(call if_changed,ikconfiggz)
diff --git a/kernel/configs.c b/kernel/configs.c
--- a/kernel/configs.c
+++ b/kernel/configs.c
@@ -46,12 +46,20 @@
  */
 #define MAGIC_START	"IKCFG_ST"
 #define MAGIC_END	"IKCFG_ED"
-#include "config_data.h"
 
+asm(
+".data\n"
+"	.ascii \"" MAGIC_START "\"\n"
+"kernel_config_data:\n"
+"	.incbin \"kernel/config_data.gz\"\n"
+"kernel_config_data_end:\n"
+"	.ascii \"" MAGIC_END "\"\n"
+".previous\n"
+);
 
-#define MAGIC_SIZE (sizeof(MAGIC_START) - 1)
-#define kernel_config_data_size \
-	(sizeof(kernel_config_data) - 1 - MAGIC_SIZE * 2)
+extern const char kernel_config_data[], kernel_config_data_end[];
+
+#define kernel_config_data_size (kernel_config_data_end - kernel_config_data)
 
 #ifdef CONFIG_IKCONFIG_PROC
 
@@ -69,7 +77,7 @@ ikconfig_read_current(struct file *file,
 		return 0;
 
 	count = min(len, (size_t)(kernel_config_data_size - pos));
-	if (copy_to_user(buf, kernel_config_data + MAGIC_SIZE + pos, count))
+	if (copy_to_user(buf, kernel_config_data + pos, count))
 		return -EFAULT;
 
 	*offset += count;

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

* Re: [PATCH] Use .incbin for config_data.gz
  2005-09-24 18:30 [PATCH] Use .incbin for config_data.gz Brian Gerst
@ 2005-09-25 10:13 ` Ingo Oeser
  2005-09-25 13:16   ` Brian Gerst
  0 siblings, 1 reply; 3+ messages in thread
From: Ingo Oeser @ 2005-09-25 10:13 UTC (permalink / raw)
  To: linux-kernel; +Cc: Brian Gerst, Andrew Morton

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

Hi Brian,

On Saturday 24 September 2005 20:30, Brian Gerst wrote:
> Instead of creating config_data.h, use .incbin in inline assembly to
> directly include config_data.gz.

Good idea, but please make this .rodata instead of .data,
since this isn't going to be modified.

Regards

Ingo Oeser


[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [PATCH] Use .incbin for config_data.gz
  2005-09-25 10:13 ` Ingo Oeser
@ 2005-09-25 13:16   ` Brian Gerst
  0 siblings, 0 replies; 3+ messages in thread
From: Brian Gerst @ 2005-09-25 13:16 UTC (permalink / raw)
  To: Ingo Oeser; +Cc: linux-kernel, Andrew Morton

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

Ingo Oeser wrote:
> Hi Brian,
> 
> On Saturday 24 September 2005 20:30, Brian Gerst wrote:
> 
>>Instead of creating config_data.h, use .incbin in inline assembly to
>>directly include config_data.gz.
> 
> 
> Good idea, but please make this .rodata instead of .data,
> since this isn't going to be modified.
> 
> Regards
> 
> Ingo Oeser
> 

New patch putting the config data in .rodata.


[-- Attachment #2: 0002-Use-.incbin-for-config_data.gz.txt --]
[-- Type: text/plain, Size: 2229 bytes --]

Subject: [PATCH] Use .incbin for config_data.gz

Instead of creating config_data.h, use .incbin in inline assembly to
directly include config_data.gz.

Signed-off-by: Brian Gerst <bgerst@didntduck.org>

---

 kernel/Makefile  |    9 +--------
 kernel/configs.c |   18 +++++++++++++-----
 2 files changed, 14 insertions(+), 13 deletions(-)

5674a0222370187dbe3401cb7a380c491a13f167
diff --git a/kernel/Makefile b/kernel/Makefile
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -41,16 +41,9 @@ ifneq ($(CONFIG_SCHED_NO_NO_OMIT_FRAME_P
 CFLAGS_sched.o := $(PROFILING) -fno-omit-frame-pointer
 endif
 
-$(obj)/configs.o: $(obj)/config_data.h
+$(obj)/configs.o: $(obj)/config_data.gz
 
-# config_data.h contains the same information as ikconfig.h but gzipped.
 # Info from config_data can be extracted from /proc/config*
 targets += config_data.gz
 $(obj)/config_data.gz: .config FORCE
 	$(call if_changed,gzip)
-
-quiet_cmd_ikconfiggz = IKCFG   $@
-      cmd_ikconfiggz = (echo "static const char kernel_config_data[] = MAGIC_START"; cat $< | scripts/bin2c; echo "MAGIC_END;") > $@
-targets += config_data.h
-$(obj)/config_data.h: $(obj)/config_data.gz FORCE
-	$(call if_changed,ikconfiggz)
diff --git a/kernel/configs.c b/kernel/configs.c
--- a/kernel/configs.c
+++ b/kernel/configs.c
@@ -46,12 +46,20 @@
  */
 #define MAGIC_START	"IKCFG_ST"
 #define MAGIC_END	"IKCFG_ED"
-#include "config_data.h"
 
+asm(
+".section .rodata, \"a\"\n"
+"	.ascii \"" MAGIC_START "\"\n"
+"kernel_config_data:\n"
+"	.incbin \"kernel/config_data.gz\"\n"
+"kernel_config_data_end:\n"
+"	.ascii \"" MAGIC_END "\"\n"
+".previous\n"
+);
 
-#define MAGIC_SIZE (sizeof(MAGIC_START) - 1)
-#define kernel_config_data_size \
-	(sizeof(kernel_config_data) - 1 - MAGIC_SIZE * 2)
+extern const char kernel_config_data[], kernel_config_data_end[];
+
+#define kernel_config_data_size (kernel_config_data_end - kernel_config_data)
 
 #ifdef CONFIG_IKCONFIG_PROC
 
@@ -69,7 +77,7 @@ ikconfig_read_current(struct file *file,
 		return 0;
 
 	count = min(len, (size_t)(kernel_config_data_size - pos));
-	if (copy_to_user(buf, kernel_config_data + MAGIC_SIZE + pos, count))
+	if (copy_to_user(buf, kernel_config_data + pos, count))
 		return -EFAULT;
 
 	*offset += count;

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

end of thread, other threads:[~2005-09-25 13:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-24 18:30 [PATCH] Use .incbin for config_data.gz Brian Gerst
2005-09-25 10:13 ` Ingo Oeser
2005-09-25 13:16   ` Brian Gerst

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox