All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Millan <rmh@aybabtu.com>
To: grub-devel@gnu.org
Subject: [PATCH] framework for building modules externally
Date: Sat, 1 Nov 2008 13:32:29 +0100	[thread overview]
Message-ID: <20081101123229.GA14438@thorin> (raw)

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


Hi,

Attached patch makes it possible to build modules externally, by:

  - Installing headers in system include dir.

  - Exporting two ABI tags (a build-time macro and a run-time variable)
    for run-time comparison.

  - Exporting a makefile with COMMON_*FLAGS variables.

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."

[-- Attachment #2: external_modules.diff --]
[-- Type: text/x-diff, Size: 2750 bytes --]

2008-11-01  Robert Millan  <rmh@aybabtu.com>

	* Makefile.in (include_DATA): New variable.
	(build_flags.mk): New target.
	(pkgdata_DATA): Add `build_flags.mk'.
	(install-local): Install $(include_DATA) files in $(includedir).

	* include/grub/misc.h (GRUB_ABI): New macro (initialize as 0).
	(grub_abi): New variable prototype.
	* kern/main.c (grub_abi): New variable (initialize as GRUB_ABI).

Index: Makefile.in
===================================================================
--- Makefile.in	(revision 1889)
+++ Makefile.in	(working copy)
@@ -152,6 +152,13 @@ ifeq (, $(UNIFONT_HEX))
 else
 pkgdata_DATA += unicode.pff ascii.pff
 
+include_DATA = $(shell find $(srcdir)/include -name \*.h | sed -e 's,^$(srcdir)/,,g') \
+			$(srcdir)/include/grub/cpu
+
+pkgdata_DATA += build_flags.mk
+build_flags.mk:
+	echo -en "COMMON_ASFLAGS=$(COMMON_ASFLAGS)\nCOMMON_CFLAGS=$(COMMON_CFLAGS)\nCOMMON_LDFLAGS=$(COMMON_LDFLAGS)\n" > $@
+
 # Arrows and lines are needed to draw the menu, so we always include them
 UNICODE_ARROWS=0x2190-0x2193
 UNICODE_LINES=0x2501-0x251B
@@ -226,6 +233,19 @@ install-local: all
 	  dest="`echo $$file | sed 's,.*/,,'`"; \
 	  $(INSTALL_DATA) $$dir$$file $(DESTDIR)$(libdir)/grub/$$dest; \
 	done
+	$(mkinstalldirs) $(DESTDIR)$(includedir)
+	@list='$(include_DATA)'; \
+	for file in $$list; do \
+	  if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
+	  dest="`echo $$file | sed 's,include/,,'`"; \
+	  destdir="`echo $$dest | sed 's,\(^\|/\)[^/]*$$,,g'`"; \
+	  $(mkinstalldirs) $(DESTDIR)$(includedir)/$$destdir; \
+	  if test -f "$$dir$$file"; then \
+	    $(INSTALL_DATA) $$dir$$file $(DESTDIR)$(includedir)/$$dest; \
+	  elif test -L "$$dir$$file"; then \
+	    cp -d $$dir$$file $(DESTDIR)$(includedir)/$$dest; \
+	  fi; \
+	done
 
 install-strip:
 	$(MAKE) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" install
Index: kern/main.c
===================================================================
--- kern/main.c	(revision 1889)
+++ kern/main.c	(working copy)
@@ -28,6 +28,8 @@
 #include <grub/env.h>
 #include <grub/mm.h>
 
+grub_uint32_t grub_abi = GRUB_ABI;
+
 void
 grub_module_iterate (int (*hook) (struct grub_module_header *header))
 {
Index: include/grub/misc.h
===================================================================
--- include/grub/misc.h	(revision 1889)
+++ include/grub/misc.h	(working copy)
@@ -25,6 +25,10 @@
 #include <grub/symbol.h>
 #include <grub/err.h>
 
+/* Increase this number every time GRUB ABI is changed.  */
+#define GRUB_ABI	0
+extern grub_uint32_t EXPORT_VAR(grub_abi);
+
 #define ALIGN_UP(addr, align) (((grub_uint64_t)addr + align - 1) & ~(align - 1))
 
 #define grub_dprintf(condition, fmt, args...) grub_real_dprintf(__FILE__, __LINE__, condition, fmt, ## args);

             reply	other threads:[~2008-11-01 12:33 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-01 12:32 Robert Millan [this message]
2008-11-01 19:02 ` [PATCH] framework for building modules externally Robert Millan
2008-11-04 18:55   ` Vesa Jääskeläinen
2008-11-04 19:07     ` Robert Millan
2008-11-04 19:13       ` Vesa Jääskeläinen
2008-11-04 19:39         ` Robert Millan
2008-11-05  6:57           ` Christian Franke
2008-11-05  9:42             ` Robert Millan
2008-11-05 21:41               ` Christian Franke
2008-11-06 14:52                 ` __FILE__ (Re: [PATCH] framework for building modules externally) Robert Millan
2008-11-06 21:10                   ` Christian Franke
2008-11-07 19:02                     ` Robert Millan
2008-11-10 20:39                       ` Christian Franke
2008-11-06 14:54                 ` [PATCH] framework for building modules externally Robert Millan
2008-11-06 20:43                   ` Christian Franke
2008-11-07 19:05                     ` Robert Millan
2008-11-08 11:33                     ` Robert Millan
2008-11-10 20:44                       ` Christian Franke
2009-04-10 23:19               ` phcoder
2009-04-13 13:55                 ` Robert Millan
2008-11-05  9:51   ` Robert Millan
2008-11-08 11:29     ` Robert Millan

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=20081101123229.GA14438@thorin \
    --to=rmh@aybabtu.com \
    --cc=grub-devel@gnu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.