From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1KwFfW-00054A-7v for mharc-grub-devel@gnu.org; Sat, 01 Nov 2008 08:33:30 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KwFfT-00053f-Lw for grub-devel@gnu.org; Sat, 01 Nov 2008 08:33:27 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KwFfR-00052p-0k for grub-devel@gnu.org; Sat, 01 Nov 2008 08:33:26 -0400 Received: from [199.232.76.173] (port=55556 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KwFfQ-00052j-Tg for grub-devel@gnu.org; Sat, 01 Nov 2008 08:33:24 -0400 Received: from aybabtu.com ([69.60.117.155]:52354) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KwFfP-0005oA-TZ for grub-devel@gnu.org; Sat, 01 Nov 2008 08:33:24 -0400 Received: from [192.168.10.10] (helo=thorin) by aybabtu.com with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1KwFep-0006xX-54 for grub-devel@gnu.org; Sat, 01 Nov 2008 13:32:47 +0100 Received: from rmh by thorin with local (Exim 4.63) (envelope-from ) id 1KwFeX-0003lk-3U for grub-devel@gnu.org; Sat, 01 Nov 2008 13:32:29 +0100 Date: Sat, 1 Nov 2008 13:32:29 +0100 From: Robert Millan To: grub-devel@gnu.org Message-ID: <20081101123229.GA14438@thorin> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="ibTvN161/egqYuK8" Content-Disposition: inline Organization: free as in freedom X-Message-Flag: Worried about Outlook viruses? Switch to Thunderbird! www.mozilla.com/thunderbird X-Debbugs-No-Ack: true User-Agent: Mutt/1.5.13 (2006-08-11) X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Subject: [PATCH] framework for building modules externally X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Nov 2008 12:33:28 -0000 --ibTvN161/egqYuK8 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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." --ibTvN161/egqYuK8 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="external_modules.diff" 2008-11-01 Robert Millan * 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 #include +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 #include +/* 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); --ibTvN161/egqYuK8--