From 837091258d7e9f4af3cc333ec775271f1b767d11 Mon Sep 17 00:00:00 2001 From: okuji Date: Tue, 18 Apr 2006 06:18:15 +0000 Subject: [PATCH] 2006-04-18 Yoshinori K. Okuji * DISTLIST: Added conf/i386-efi.mk, conf/i386-efi.rmk, include/grub/efi/api.h, include/grub/efi/console_control.h, include/grub/efi/efi.h, include/grub/efi/pe32.h, include/grub/i386/efi/time.h, kern/efi/efi.c, kern/i386/efi/init.c, kern/i386/efi/startup.S, and util/i386/efi/grub-mkimage.c. * Makefile.in (RMKFILES): Added i386-efi.rmk. * genmk.rb (PModule#rule): Do not export symbols if #{prefix}_EXPORTS is set to "no". * conf/i386-efi.mk: New file. * conf/i386-efi.rmk: Likewise. * include/grub/efi/api.h: Likewise. * include/grub/efi/console_control.h: Likewise. * include/grub/efi/efi.h: Likewise. * include/grub/efi/pe32.h: Likewise. * include/grub/i386/efi/time.h: Likewise. * kern/efi/efi.c: Likewise. * kern/i386/efi/init.c: Likewise. * kern/i386/efi/startup.S: Likewise. * util/i386/efi/grub-mkimage.c: Likewise. --- ChangeLog | 28 +- DISTLIST | 11 + Makefile.in | 2 +- conf/common.mk | 306 +++++++--- conf/i386-efi.mk | 880 +++++++++++++++++++++++++++ conf/i386-efi.rmk | 107 ++++ conf/i386-pc.mk | 144 ++++- conf/powerpc-ieee1275.mk | 54 +- conf/sparc64-ieee1275.mk | 297 +++++++-- genmk.rb | 9 +- include/grub/efi/api.h | 653 ++++++++++++++++++++ include/grub/efi/console_control.h | 56 ++ include/grub/efi/efi.h | 39 ++ include/grub/efi/pe32.h | 199 ++++++ include/grub/i386/efi/time.h | 31 + kern/efi/efi.c | 97 +++ kern/i386/efi/init.c | 69 +++ kern/i386/efi/startup.S | 65 ++ util/i386/efi/grub-mkimage.c | 939 +++++++++++++++++++++++++++++ 19 files changed, 3804 insertions(+), 182 deletions(-) create mode 100644 conf/i386-efi.mk create mode 100644 conf/i386-efi.rmk create mode 100644 include/grub/efi/api.h create mode 100644 include/grub/efi/console_control.h create mode 100644 include/grub/efi/efi.h create mode 100644 include/grub/efi/pe32.h create mode 100644 include/grub/i386/efi/time.h create mode 100644 kern/efi/efi.c create mode 100644 kern/i386/efi/init.c create mode 100644 kern/i386/efi/startup.S create mode 100644 util/i386/efi/grub-mkimage.c diff --git a/ChangeLog b/ChangeLog index 3968b8dc4..7c6b1ccd6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,30 @@ -2006-17-04 Marco Gerards +2006-04-18 Yoshinori K. Okuji + + * DISTLIST: Added conf/i386-efi.mk, conf/i386-efi.rmk, + include/grub/efi/api.h, include/grub/efi/console_control.h, + include/grub/efi/efi.h, include/grub/efi/pe32.h, + include/grub/i386/efi/time.h, kern/efi/efi.c, + kern/i386/efi/init.c, kern/i386/efi/startup.S, + and util/i386/efi/grub-mkimage.c. + + * Makefile.in (RMKFILES): Added i386-efi.rmk. + + * genmk.rb (PModule#rule): Do not export symbols if + #{prefix}_EXPORTS is set to "no". + + * conf/i386-efi.mk: New file. + * conf/i386-efi.rmk: Likewise. + * include/grub/efi/api.h: Likewise. + * include/grub/efi/console_control.h: Likewise. + * include/grub/efi/efi.h: Likewise. + * include/grub/efi/pe32.h: Likewise. + * include/grub/i386/efi/time.h: Likewise. + * kern/efi/efi.c: Likewise. + * kern/i386/efi/init.c: Likewise. + * kern/i386/efi/startup.S: Likewise. + * util/i386/efi/grub-mkimage.c: Likewise. + +2006-04-17 Marco Gerards * include/grub/script.h: Include and "grub_script.tab.h". diff --git a/DISTLIST b/DISTLIST index 0deb9be73..adf6f88cb 100644 --- a/DISTLIST +++ b/DISTLIST @@ -52,6 +52,8 @@ commands/ieee1275/reboot.c commands/ieee1275/suspend.c conf/common.mk conf/common.rmk +conf/i386-efi.mk +conf/i386-efi.rmk conf/i386-pc.mk conf/i386-pc.rmk conf/powerpc-ieee1275.mk @@ -109,8 +111,13 @@ include/grub/terminfo.h include/grub/tparm.h include/grub/types.h include/grub/video.h +include/grub/efi/api.h +include/grub/efi/console_control.h +include/grub/efi/efi.h +include/grub/efi/pe32.h include/grub/i386/setjmp.h include/grub/i386/types.h +include/grub/i386/efi/time.h include/grub/i386/pc/biosdisk.h include/grub/i386/pc/boot.h include/grub/i386/pc/chainloader.h @@ -166,7 +173,10 @@ kern/parser.c kern/partition.c kern/rescue.c kern/term.c +kern/efi/efi.c kern/i386/dl.c +kern/i386/efi/init.c +kern/i386/efi/startup.S kern/i386/pc/init.c kern/i386/pc/lzo1x.S kern/i386/pc/startup.S @@ -225,6 +235,7 @@ util/grub-emu.c util/misc.c util/resolve.c util/unifont2pff.rb +util/i386/efi/grub-mkimage.c util/i386/pc/biosdisk.c util/i386/pc/getroot.c util/i386/pc/grub-install.in diff --git a/Makefile.in b/Makefile.in index 7c95dcf9c..5e8b0e05c 100644 --- a/Makefile.in +++ b/Makefile.in @@ -73,7 +73,7 @@ YACC = @YACC@ ### General variables. RMKFILES = $(addprefix conf/,common.rmk i386-pc.rmk powerpc-ieee1275.rmk \ - sparc64-ieee1275.rmk) + sparc64-ieee1275.rmk i386-efi.rmk) MKFILES = $(patsubst %.rmk,%.mk,$(RMKFILES)) DATA = $(pkgdata_IMAGES) $(pkgdata_MODULES) $(pkgdata_PROGRAMS) \ diff --git a/conf/common.mk b/conf/common.mk index 2cd9eb09e..db6f26c57 100644 --- a/conf/common.mk +++ b/conf/common.mk @@ -26,9 +26,12 @@ pkgdata_MODULES += fshelp.mod fat.mod ufs.mod ext2.mod \ # For fshelp.mod. fshelp_mod_SOURCES = fs/fshelp.c -CLEANFILES += fshelp.mod mod-fshelp.o mod-fshelp.c pre-fshelp.o fshelp_mod-fs_fshelp.o def-fshelp.lst und-fshelp.lst -MOSTLYCLEANFILES += fshelp_mod-fs_fshelp.d +CLEANFILES += fshelp.mod mod-fshelp.o mod-fshelp.c pre-fshelp.o fshelp_mod-fs_fshelp.o und-fshelp.lst +ifneq ($(fshelp_mod_EXPORTS),no) +CLEANFILES += def-fshelp.lst DEFSYMFILES += def-fshelp.lst +endif +MOSTLYCLEANFILES += fshelp_mod-fs_fshelp.d UNDSYMFILES += und-fshelp.lst fshelp.mod: pre-fshelp.o mod-fshelp.o @@ -46,8 +49,10 @@ mod-fshelp.o: mod-fshelp.c mod-fshelp.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'fshelp' $< > $@ || (rm -f $@; exit 1) +ifneq ($(fshelp_mod_EXPORTS),no) def-fshelp.lst: pre-fshelp.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 fshelp/' > $@ +endif und-fshelp.lst: pre-fshelp.o echo 'fshelp' > $@ @@ -77,9 +82,12 @@ fshelp_mod_LDFLAGS = $(COMMON_LDFLAGS) # For fat.mod. fat_mod_SOURCES = fs/fat.c -CLEANFILES += fat.mod mod-fat.o mod-fat.c pre-fat.o fat_mod-fs_fat.o def-fat.lst und-fat.lst -MOSTLYCLEANFILES += fat_mod-fs_fat.d +CLEANFILES += fat.mod mod-fat.o mod-fat.c pre-fat.o fat_mod-fs_fat.o und-fat.lst +ifneq ($(fat_mod_EXPORTS),no) +CLEANFILES += def-fat.lst DEFSYMFILES += def-fat.lst +endif +MOSTLYCLEANFILES += fat_mod-fs_fat.d UNDSYMFILES += und-fat.lst fat.mod: pre-fat.o mod-fat.o @@ -97,8 +105,10 @@ mod-fat.o: mod-fat.c mod-fat.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'fat' $< > $@ || (rm -f $@; exit 1) +ifneq ($(fat_mod_EXPORTS),no) def-fat.lst: pre-fat.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 fat/' > $@ +endif und-fat.lst: pre-fat.o echo 'fat' > $@ @@ -128,9 +138,12 @@ fat_mod_LDFLAGS = $(COMMON_LDFLAGS) # For ufs.mod. ufs_mod_SOURCES = fs/ufs.c -CLEANFILES += ufs.mod mod-ufs.o mod-ufs.c pre-ufs.o ufs_mod-fs_ufs.o def-ufs.lst und-ufs.lst -MOSTLYCLEANFILES += ufs_mod-fs_ufs.d +CLEANFILES += ufs.mod mod-ufs.o mod-ufs.c pre-ufs.o ufs_mod-fs_ufs.o und-ufs.lst +ifneq ($(ufs_mod_EXPORTS),no) +CLEANFILES += def-ufs.lst DEFSYMFILES += def-ufs.lst +endif +MOSTLYCLEANFILES += ufs_mod-fs_ufs.d UNDSYMFILES += und-ufs.lst ufs.mod: pre-ufs.o mod-ufs.o @@ -148,8 +161,10 @@ mod-ufs.o: mod-ufs.c mod-ufs.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'ufs' $< > $@ || (rm -f $@; exit 1) +ifneq ($(ufs_mod_EXPORTS),no) def-ufs.lst: pre-ufs.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 ufs/' > $@ +endif und-ufs.lst: pre-ufs.o echo 'ufs' > $@ @@ -179,9 +194,12 @@ ufs_mod_LDFLAGS = $(COMMON_LDFLAGS) # For ext2.mod. ext2_mod_SOURCES = fs/ext2.c -CLEANFILES += ext2.mod mod-ext2.o mod-ext2.c pre-ext2.o ext2_mod-fs_ext2.o def-ext2.lst und-ext2.lst -MOSTLYCLEANFILES += ext2_mod-fs_ext2.d +CLEANFILES += ext2.mod mod-ext2.o mod-ext2.c pre-ext2.o ext2_mod-fs_ext2.o und-ext2.lst +ifneq ($(ext2_mod_EXPORTS),no) +CLEANFILES += def-ext2.lst DEFSYMFILES += def-ext2.lst +endif +MOSTLYCLEANFILES += ext2_mod-fs_ext2.d UNDSYMFILES += und-ext2.lst ext2.mod: pre-ext2.o mod-ext2.o @@ -199,8 +217,10 @@ mod-ext2.o: mod-ext2.c mod-ext2.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'ext2' $< > $@ || (rm -f $@; exit 1) +ifneq ($(ext2_mod_EXPORTS),no) def-ext2.lst: pre-ext2.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 ext2/' > $@ +endif und-ext2.lst: pre-ext2.o echo 'ext2' > $@ @@ -230,9 +250,12 @@ ext2_mod_LDFLAGS = $(COMMON_LDFLAGS) # For minix.mod. minix_mod_SOURCES = fs/minix.c -CLEANFILES += minix.mod mod-minix.o mod-minix.c pre-minix.o minix_mod-fs_minix.o def-minix.lst und-minix.lst -MOSTLYCLEANFILES += minix_mod-fs_minix.d +CLEANFILES += minix.mod mod-minix.o mod-minix.c pre-minix.o minix_mod-fs_minix.o und-minix.lst +ifneq ($(minix_mod_EXPORTS),no) +CLEANFILES += def-minix.lst DEFSYMFILES += def-minix.lst +endif +MOSTLYCLEANFILES += minix_mod-fs_minix.d UNDSYMFILES += und-minix.lst minix.mod: pre-minix.o mod-minix.o @@ -250,8 +273,10 @@ mod-minix.o: mod-minix.c mod-minix.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'minix' $< > $@ || (rm -f $@; exit 1) +ifneq ($(minix_mod_EXPORTS),no) def-minix.lst: pre-minix.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 minix/' > $@ +endif und-minix.lst: pre-minix.o echo 'minix' > $@ @@ -281,9 +306,12 @@ minix_mod_LDFLAGS = $(COMMON_LDFLAGS) # For hfs.mod. hfs_mod_SOURCES = fs/hfs.c -CLEANFILES += hfs.mod mod-hfs.o mod-hfs.c pre-hfs.o hfs_mod-fs_hfs.o def-hfs.lst und-hfs.lst -MOSTLYCLEANFILES += hfs_mod-fs_hfs.d +CLEANFILES += hfs.mod mod-hfs.o mod-hfs.c pre-hfs.o hfs_mod-fs_hfs.o und-hfs.lst +ifneq ($(hfs_mod_EXPORTS),no) +CLEANFILES += def-hfs.lst DEFSYMFILES += def-hfs.lst +endif +MOSTLYCLEANFILES += hfs_mod-fs_hfs.d UNDSYMFILES += und-hfs.lst hfs.mod: pre-hfs.o mod-hfs.o @@ -301,8 +329,10 @@ mod-hfs.o: mod-hfs.c mod-hfs.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'hfs' $< > $@ || (rm -f $@; exit 1) +ifneq ($(hfs_mod_EXPORTS),no) def-hfs.lst: pre-hfs.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 hfs/' > $@ +endif und-hfs.lst: pre-hfs.o echo 'hfs' > $@ @@ -332,9 +362,12 @@ hfs_mod_LDFLAGS = $(COMMON_LDFLAGS) # For jfs.mod. jfs_mod_SOURCES = fs/jfs.c -CLEANFILES += jfs.mod mod-jfs.o mod-jfs.c pre-jfs.o jfs_mod-fs_jfs.o def-jfs.lst und-jfs.lst -MOSTLYCLEANFILES += jfs_mod-fs_jfs.d +CLEANFILES += jfs.mod mod-jfs.o mod-jfs.c pre-jfs.o jfs_mod-fs_jfs.o und-jfs.lst +ifneq ($(jfs_mod_EXPORTS),no) +CLEANFILES += def-jfs.lst DEFSYMFILES += def-jfs.lst +endif +MOSTLYCLEANFILES += jfs_mod-fs_jfs.d UNDSYMFILES += und-jfs.lst jfs.mod: pre-jfs.o mod-jfs.o @@ -352,8 +385,10 @@ mod-jfs.o: mod-jfs.c mod-jfs.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'jfs' $< > $@ || (rm -f $@; exit 1) +ifneq ($(jfs_mod_EXPORTS),no) def-jfs.lst: pre-jfs.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 jfs/' > $@ +endif und-jfs.lst: pre-jfs.o echo 'jfs' > $@ @@ -383,9 +418,12 @@ jfs_mod_LDFLAGS = $(COMMON_LDFLAGS) # For iso9660.mod. iso9660_mod_SOURCES = fs/iso9660.c -CLEANFILES += iso9660.mod mod-iso9660.o mod-iso9660.c pre-iso9660.o iso9660_mod-fs_iso9660.o def-iso9660.lst und-iso9660.lst -MOSTLYCLEANFILES += iso9660_mod-fs_iso9660.d +CLEANFILES += iso9660.mod mod-iso9660.o mod-iso9660.c pre-iso9660.o iso9660_mod-fs_iso9660.o und-iso9660.lst +ifneq ($(iso9660_mod_EXPORTS),no) +CLEANFILES += def-iso9660.lst DEFSYMFILES += def-iso9660.lst +endif +MOSTLYCLEANFILES += iso9660_mod-fs_iso9660.d UNDSYMFILES += und-iso9660.lst iso9660.mod: pre-iso9660.o mod-iso9660.o @@ -403,8 +441,10 @@ mod-iso9660.o: mod-iso9660.c mod-iso9660.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'iso9660' $< > $@ || (rm -f $@; exit 1) +ifneq ($(iso9660_mod_EXPORTS),no) def-iso9660.lst: pre-iso9660.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 iso9660/' > $@ +endif und-iso9660.lst: pre-iso9660.o echo 'iso9660' > $@ @@ -434,9 +474,12 @@ iso9660_mod_LDFLAGS = $(COMMON_LDFLAGS) # For xfs.mod. xfs_mod_SOURCES = fs/xfs.c -CLEANFILES += xfs.mod mod-xfs.o mod-xfs.c pre-xfs.o xfs_mod-fs_xfs.o def-xfs.lst und-xfs.lst -MOSTLYCLEANFILES += xfs_mod-fs_xfs.d +CLEANFILES += xfs.mod mod-xfs.o mod-xfs.c pre-xfs.o xfs_mod-fs_xfs.o und-xfs.lst +ifneq ($(xfs_mod_EXPORTS),no) +CLEANFILES += def-xfs.lst DEFSYMFILES += def-xfs.lst +endif +MOSTLYCLEANFILES += xfs_mod-fs_xfs.d UNDSYMFILES += und-xfs.lst xfs.mod: pre-xfs.o mod-xfs.o @@ -454,8 +497,10 @@ mod-xfs.o: mod-xfs.c mod-xfs.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'xfs' $< > $@ || (rm -f $@; exit 1) +ifneq ($(xfs_mod_EXPORTS),no) def-xfs.lst: pre-xfs.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 xfs/' > $@ +endif und-xfs.lst: pre-xfs.o echo 'xfs' > $@ @@ -485,9 +530,12 @@ xfs_mod_LDFLAGS = $(COMMON_LDFLAGS) # For affs.mod. affs_mod_SOURCES = fs/affs.c -CLEANFILES += affs.mod mod-affs.o mod-affs.c pre-affs.o affs_mod-fs_affs.o def-affs.lst und-affs.lst -MOSTLYCLEANFILES += affs_mod-fs_affs.d +CLEANFILES += affs.mod mod-affs.o mod-affs.c pre-affs.o affs_mod-fs_affs.o und-affs.lst +ifneq ($(affs_mod_EXPORTS),no) +CLEANFILES += def-affs.lst DEFSYMFILES += def-affs.lst +endif +MOSTLYCLEANFILES += affs_mod-fs_affs.d UNDSYMFILES += und-affs.lst affs.mod: pre-affs.o mod-affs.o @@ -505,8 +553,10 @@ mod-affs.o: mod-affs.c mod-affs.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'affs' $< > $@ || (rm -f $@; exit 1) +ifneq ($(affs_mod_EXPORTS),no) def-affs.lst: pre-affs.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 affs/' > $@ +endif und-affs.lst: pre-affs.o echo 'affs' > $@ @@ -536,9 +586,12 @@ affs_mod_LDFLAGS = $(COMMON_LDFLAGS) # For sfs.mod. sfs_mod_SOURCES = fs/sfs.c -CLEANFILES += sfs.mod mod-sfs.o mod-sfs.c pre-sfs.o sfs_mod-fs_sfs.o def-sfs.lst und-sfs.lst -MOSTLYCLEANFILES += sfs_mod-fs_sfs.d +CLEANFILES += sfs.mod mod-sfs.o mod-sfs.c pre-sfs.o sfs_mod-fs_sfs.o und-sfs.lst +ifneq ($(sfs_mod_EXPORTS),no) +CLEANFILES += def-sfs.lst DEFSYMFILES += def-sfs.lst +endif +MOSTLYCLEANFILES += sfs_mod-fs_sfs.d UNDSYMFILES += und-sfs.lst sfs.mod: pre-sfs.o mod-sfs.o @@ -556,8 +609,10 @@ mod-sfs.o: mod-sfs.c mod-sfs.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'sfs' $< > $@ || (rm -f $@; exit 1) +ifneq ($(sfs_mod_EXPORTS),no) def-sfs.lst: pre-sfs.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 sfs/' > $@ +endif und-sfs.lst: pre-sfs.o echo 'sfs' > $@ @@ -587,9 +642,12 @@ sfs_mod_LDFLAGS = $(COMMON_LDFLAGS) # For hfsplus.mod. hfsplus_mod_SOURCES = fs/hfsplus.c -CLEANFILES += hfsplus.mod mod-hfsplus.o mod-hfsplus.c pre-hfsplus.o hfsplus_mod-fs_hfsplus.o def-hfsplus.lst und-hfsplus.lst -MOSTLYCLEANFILES += hfsplus_mod-fs_hfsplus.d +CLEANFILES += hfsplus.mod mod-hfsplus.o mod-hfsplus.c pre-hfsplus.o hfsplus_mod-fs_hfsplus.o und-hfsplus.lst +ifneq ($(hfsplus_mod_EXPORTS),no) +CLEANFILES += def-hfsplus.lst DEFSYMFILES += def-hfsplus.lst +endif +MOSTLYCLEANFILES += hfsplus_mod-fs_hfsplus.d UNDSYMFILES += und-hfsplus.lst hfsplus.mod: pre-hfsplus.o mod-hfsplus.o @@ -607,8 +665,10 @@ mod-hfsplus.o: mod-hfsplus.c mod-hfsplus.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'hfsplus' $< > $@ || (rm -f $@; exit 1) +ifneq ($(hfsplus_mod_EXPORTS),no) def-hfsplus.lst: pre-hfsplus.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 hfsplus/' > $@ +endif und-hfsplus.lst: pre-hfsplus.o echo 'hfsplus' > $@ @@ -641,9 +701,12 @@ pkgdata_MODULES += amiga.mod apple.mod pc.mod sun.mod acorn.mod gpt.mod # For amiga.mod amiga_mod_SOURCES = partmap/amiga.c -CLEANFILES += amiga.mod mod-amiga.o mod-amiga.c pre-amiga.o amiga_mod-partmap_amiga.o def-amiga.lst und-amiga.lst -MOSTLYCLEANFILES += amiga_mod-partmap_amiga.d +CLEANFILES += amiga.mod mod-amiga.o mod-amiga.c pre-amiga.o amiga_mod-partmap_amiga.o und-amiga.lst +ifneq ($(amiga_mod_EXPORTS),no) +CLEANFILES += def-amiga.lst DEFSYMFILES += def-amiga.lst +endif +MOSTLYCLEANFILES += amiga_mod-partmap_amiga.d UNDSYMFILES += und-amiga.lst amiga.mod: pre-amiga.o mod-amiga.o @@ -661,8 +724,10 @@ mod-amiga.o: mod-amiga.c mod-amiga.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'amiga' $< > $@ || (rm -f $@; exit 1) +ifneq ($(amiga_mod_EXPORTS),no) def-amiga.lst: pre-amiga.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 amiga/' > $@ +endif und-amiga.lst: pre-amiga.o echo 'amiga' > $@ @@ -692,9 +757,12 @@ amiga_mod_LDFLAGS = $(COMMON_LDFLAGS) # For apple.mod apple_mod_SOURCES = partmap/apple.c -CLEANFILES += apple.mod mod-apple.o mod-apple.c pre-apple.o apple_mod-partmap_apple.o def-apple.lst und-apple.lst -MOSTLYCLEANFILES += apple_mod-partmap_apple.d +CLEANFILES += apple.mod mod-apple.o mod-apple.c pre-apple.o apple_mod-partmap_apple.o und-apple.lst +ifneq ($(apple_mod_EXPORTS),no) +CLEANFILES += def-apple.lst DEFSYMFILES += def-apple.lst +endif +MOSTLYCLEANFILES += apple_mod-partmap_apple.d UNDSYMFILES += und-apple.lst apple.mod: pre-apple.o mod-apple.o @@ -712,8 +780,10 @@ mod-apple.o: mod-apple.c mod-apple.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'apple' $< > $@ || (rm -f $@; exit 1) +ifneq ($(apple_mod_EXPORTS),no) def-apple.lst: pre-apple.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 apple/' > $@ +endif und-apple.lst: pre-apple.o echo 'apple' > $@ @@ -743,9 +813,12 @@ apple_mod_LDFLAGS = $(COMMON_LDFLAGS) # For pc.mod pc_mod_SOURCES = partmap/pc.c -CLEANFILES += pc.mod mod-pc.o mod-pc.c pre-pc.o pc_mod-partmap_pc.o def-pc.lst und-pc.lst -MOSTLYCLEANFILES += pc_mod-partmap_pc.d +CLEANFILES += pc.mod mod-pc.o mod-pc.c pre-pc.o pc_mod-partmap_pc.o und-pc.lst +ifneq ($(pc_mod_EXPORTS),no) +CLEANFILES += def-pc.lst DEFSYMFILES += def-pc.lst +endif +MOSTLYCLEANFILES += pc_mod-partmap_pc.d UNDSYMFILES += und-pc.lst pc.mod: pre-pc.o mod-pc.o @@ -763,8 +836,10 @@ mod-pc.o: mod-pc.c mod-pc.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'pc' $< > $@ || (rm -f $@; exit 1) +ifneq ($(pc_mod_EXPORTS),no) def-pc.lst: pre-pc.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 pc/' > $@ +endif und-pc.lst: pre-pc.o echo 'pc' > $@ @@ -794,9 +869,12 @@ pc_mod_LDFLAGS = $(COMMON_LDFLAGS) # For sun.mod sun_mod_SOURCES = partmap/sun.c -CLEANFILES += sun.mod mod-sun.o mod-sun.c pre-sun.o sun_mod-partmap_sun.o def-sun.lst und-sun.lst -MOSTLYCLEANFILES += sun_mod-partmap_sun.d +CLEANFILES += sun.mod mod-sun.o mod-sun.c pre-sun.o sun_mod-partmap_sun.o und-sun.lst +ifneq ($(sun_mod_EXPORTS),no) +CLEANFILES += def-sun.lst DEFSYMFILES += def-sun.lst +endif +MOSTLYCLEANFILES += sun_mod-partmap_sun.d UNDSYMFILES += und-sun.lst sun.mod: pre-sun.o mod-sun.o @@ -814,8 +892,10 @@ mod-sun.o: mod-sun.c mod-sun.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'sun' $< > $@ || (rm -f $@; exit 1) +ifneq ($(sun_mod_EXPORTS),no) def-sun.lst: pre-sun.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 sun/' > $@ +endif und-sun.lst: pre-sun.o echo 'sun' > $@ @@ -845,9 +925,12 @@ sun_mod_LDFLAGS = $(COMMON_LDFLAGS) # For acorn.mod acorn_mod_SOURCES = partmap/acorn.c -CLEANFILES += acorn.mod mod-acorn.o mod-acorn.c pre-acorn.o acorn_mod-partmap_acorn.o def-acorn.lst und-acorn.lst -MOSTLYCLEANFILES += acorn_mod-partmap_acorn.d +CLEANFILES += acorn.mod mod-acorn.o mod-acorn.c pre-acorn.o acorn_mod-partmap_acorn.o und-acorn.lst +ifneq ($(acorn_mod_EXPORTS),no) +CLEANFILES += def-acorn.lst DEFSYMFILES += def-acorn.lst +endif +MOSTLYCLEANFILES += acorn_mod-partmap_acorn.d UNDSYMFILES += und-acorn.lst acorn.mod: pre-acorn.o mod-acorn.o @@ -865,8 +948,10 @@ mod-acorn.o: mod-acorn.c mod-acorn.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'acorn' $< > $@ || (rm -f $@; exit 1) +ifneq ($(acorn_mod_EXPORTS),no) def-acorn.lst: pre-acorn.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 acorn/' > $@ +endif und-acorn.lst: pre-acorn.o echo 'acorn' > $@ @@ -896,9 +981,12 @@ acorn_mod_LDFLAGS = $(COMMON_LDFLAGS) # For gpt.mod gpt_mod_SOURCES = partmap/gpt.c -CLEANFILES += gpt.mod mod-gpt.o mod-gpt.c pre-gpt.o gpt_mod-partmap_gpt.o def-gpt.lst und-gpt.lst -MOSTLYCLEANFILES += gpt_mod-partmap_gpt.d +CLEANFILES += gpt.mod mod-gpt.o mod-gpt.c pre-gpt.o gpt_mod-partmap_gpt.o und-gpt.lst +ifneq ($(gpt_mod_EXPORTS),no) +CLEANFILES += def-gpt.lst DEFSYMFILES += def-gpt.lst +endif +MOSTLYCLEANFILES += gpt_mod-partmap_gpt.d UNDSYMFILES += und-gpt.lst gpt.mod: pre-gpt.o mod-gpt.o @@ -916,8 +1004,10 @@ mod-gpt.o: mod-gpt.c mod-gpt.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'gpt' $< > $@ || (rm -f $@; exit 1) +ifneq ($(gpt_mod_EXPORTS),no) def-gpt.lst: pre-gpt.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 gpt/' > $@ +endif und-gpt.lst: pre-gpt.o echo 'gpt' > $@ @@ -954,9 +1044,12 @@ pkgdata_MODULES += hello.mod boot.mod terminal.mod ls.mod \ # For hello.mod. hello_mod_SOURCES = hello/hello.c -CLEANFILES += hello.mod mod-hello.o mod-hello.c pre-hello.o hello_mod-hello_hello.o def-hello.lst und-hello.lst -MOSTLYCLEANFILES += hello_mod-hello_hello.d +CLEANFILES += hello.mod mod-hello.o mod-hello.c pre-hello.o hello_mod-hello_hello.o und-hello.lst +ifneq ($(hello_mod_EXPORTS),no) +CLEANFILES += def-hello.lst DEFSYMFILES += def-hello.lst +endif +MOSTLYCLEANFILES += hello_mod-hello_hello.d UNDSYMFILES += und-hello.lst hello.mod: pre-hello.o mod-hello.o @@ -974,8 +1067,10 @@ mod-hello.o: mod-hello.c mod-hello.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'hello' $< > $@ || (rm -f $@; exit 1) +ifneq ($(hello_mod_EXPORTS),no) def-hello.lst: pre-hello.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 hello/' > $@ +endif und-hello.lst: pre-hello.o echo 'hello' > $@ @@ -1005,9 +1100,12 @@ hello_mod_LDFLAGS = $(COMMON_LDFLAGS) # For boot.mod. boot_mod_SOURCES = commands/boot.c -CLEANFILES += boot.mod mod-boot.o mod-boot.c pre-boot.o boot_mod-commands_boot.o def-boot.lst und-boot.lst -MOSTLYCLEANFILES += boot_mod-commands_boot.d +CLEANFILES += boot.mod mod-boot.o mod-boot.c pre-boot.o boot_mod-commands_boot.o und-boot.lst +ifneq ($(boot_mod_EXPORTS),no) +CLEANFILES += def-boot.lst DEFSYMFILES += def-boot.lst +endif +MOSTLYCLEANFILES += boot_mod-commands_boot.d UNDSYMFILES += und-boot.lst boot.mod: pre-boot.o mod-boot.o @@ -1025,8 +1123,10 @@ mod-boot.o: mod-boot.c mod-boot.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'boot' $< > $@ || (rm -f $@; exit 1) +ifneq ($(boot_mod_EXPORTS),no) def-boot.lst: pre-boot.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 boot/' > $@ +endif und-boot.lst: pre-boot.o echo 'boot' > $@ @@ -1056,9 +1156,12 @@ boot_mod_LDFLAGS = $(COMMON_LDFLAGS) # For terminal.mod. terminal_mod_SOURCES = commands/terminal.c -CLEANFILES += terminal.mod mod-terminal.o mod-terminal.c pre-terminal.o terminal_mod-commands_terminal.o def-terminal.lst und-terminal.lst -MOSTLYCLEANFILES += terminal_mod-commands_terminal.d +CLEANFILES += terminal.mod mod-terminal.o mod-terminal.c pre-terminal.o terminal_mod-commands_terminal.o und-terminal.lst +ifneq ($(terminal_mod_EXPORTS),no) +CLEANFILES += def-terminal.lst DEFSYMFILES += def-terminal.lst +endif +MOSTLYCLEANFILES += terminal_mod-commands_terminal.d UNDSYMFILES += und-terminal.lst terminal.mod: pre-terminal.o mod-terminal.o @@ -1076,8 +1179,10 @@ mod-terminal.o: mod-terminal.c mod-terminal.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'terminal' $< > $@ || (rm -f $@; exit 1) +ifneq ($(terminal_mod_EXPORTS),no) def-terminal.lst: pre-terminal.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 terminal/' > $@ +endif und-terminal.lst: pre-terminal.o echo 'terminal' > $@ @@ -1107,9 +1212,12 @@ terminal_mod_LDFLAGS = $(COMMON_LDFLAGS) # For ls.mod. ls_mod_SOURCES = commands/ls.c -CLEANFILES += ls.mod mod-ls.o mod-ls.c pre-ls.o ls_mod-commands_ls.o def-ls.lst und-ls.lst -MOSTLYCLEANFILES += ls_mod-commands_ls.d +CLEANFILES += ls.mod mod-ls.o mod-ls.c pre-ls.o ls_mod-commands_ls.o und-ls.lst +ifneq ($(ls_mod_EXPORTS),no) +CLEANFILES += def-ls.lst DEFSYMFILES += def-ls.lst +endif +MOSTLYCLEANFILES += ls_mod-commands_ls.d UNDSYMFILES += und-ls.lst ls.mod: pre-ls.o mod-ls.o @@ -1127,8 +1235,10 @@ mod-ls.o: mod-ls.c mod-ls.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'ls' $< > $@ || (rm -f $@; exit 1) +ifneq ($(ls_mod_EXPORTS),no) def-ls.lst: pre-ls.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 ls/' > $@ +endif und-ls.lst: pre-ls.o echo 'ls' > $@ @@ -1158,9 +1268,12 @@ ls_mod_LDFLAGS = $(COMMON_LDFLAGS) # For cmp.mod. cmp_mod_SOURCES = commands/cmp.c -CLEANFILES += cmp.mod mod-cmp.o mod-cmp.c pre-cmp.o cmp_mod-commands_cmp.o def-cmp.lst und-cmp.lst -MOSTLYCLEANFILES += cmp_mod-commands_cmp.d +CLEANFILES += cmp.mod mod-cmp.o mod-cmp.c pre-cmp.o cmp_mod-commands_cmp.o und-cmp.lst +ifneq ($(cmp_mod_EXPORTS),no) +CLEANFILES += def-cmp.lst DEFSYMFILES += def-cmp.lst +endif +MOSTLYCLEANFILES += cmp_mod-commands_cmp.d UNDSYMFILES += und-cmp.lst cmp.mod: pre-cmp.o mod-cmp.o @@ -1178,8 +1291,10 @@ mod-cmp.o: mod-cmp.c mod-cmp.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'cmp' $< > $@ || (rm -f $@; exit 1) +ifneq ($(cmp_mod_EXPORTS),no) def-cmp.lst: pre-cmp.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 cmp/' > $@ +endif und-cmp.lst: pre-cmp.o echo 'cmp' > $@ @@ -1209,9 +1324,12 @@ cmp_mod_LDFLAGS = $(COMMON_LDFLAGS) # For cat.mod. cat_mod_SOURCES = commands/cat.c -CLEANFILES += cat.mod mod-cat.o mod-cat.c pre-cat.o cat_mod-commands_cat.o def-cat.lst und-cat.lst -MOSTLYCLEANFILES += cat_mod-commands_cat.d +CLEANFILES += cat.mod mod-cat.o mod-cat.c pre-cat.o cat_mod-commands_cat.o und-cat.lst +ifneq ($(cat_mod_EXPORTS),no) +CLEANFILES += def-cat.lst DEFSYMFILES += def-cat.lst +endif +MOSTLYCLEANFILES += cat_mod-commands_cat.d UNDSYMFILES += und-cat.lst cat.mod: pre-cat.o mod-cat.o @@ -1229,8 +1347,10 @@ mod-cat.o: mod-cat.c mod-cat.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'cat' $< > $@ || (rm -f $@; exit 1) +ifneq ($(cat_mod_EXPORTS),no) def-cat.lst: pre-cat.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 cat/' > $@ +endif und-cat.lst: pre-cat.o echo 'cat' > $@ @@ -1260,9 +1380,12 @@ cat_mod_LDFLAGS = $(COMMON_LDFLAGS) # For help.mod. help_mod_SOURCES = commands/help.c -CLEANFILES += help.mod mod-help.o mod-help.c pre-help.o help_mod-commands_help.o def-help.lst und-help.lst -MOSTLYCLEANFILES += help_mod-commands_help.d +CLEANFILES += help.mod mod-help.o mod-help.c pre-help.o help_mod-commands_help.o und-help.lst +ifneq ($(help_mod_EXPORTS),no) +CLEANFILES += def-help.lst DEFSYMFILES += def-help.lst +endif +MOSTLYCLEANFILES += help_mod-commands_help.d UNDSYMFILES += und-help.lst help.mod: pre-help.o mod-help.o @@ -1280,8 +1403,10 @@ mod-help.o: mod-help.c mod-help.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'help' $< > $@ || (rm -f $@; exit 1) +ifneq ($(help_mod_EXPORTS),no) def-help.lst: pre-help.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 help/' > $@ +endif und-help.lst: pre-help.o echo 'help' > $@ @@ -1311,9 +1436,12 @@ help_mod_LDFLAGS = $(COMMON_LDFLAGS) # For font.mod. font_mod_SOURCES = font/manager.c -CLEANFILES += font.mod mod-font.o mod-font.c pre-font.o font_mod-font_manager.o def-font.lst und-font.lst -MOSTLYCLEANFILES += font_mod-font_manager.d +CLEANFILES += font.mod mod-font.o mod-font.c pre-font.o font_mod-font_manager.o und-font.lst +ifneq ($(font_mod_EXPORTS),no) +CLEANFILES += def-font.lst DEFSYMFILES += def-font.lst +endif +MOSTLYCLEANFILES += font_mod-font_manager.d UNDSYMFILES += und-font.lst font.mod: pre-font.o mod-font.o @@ -1331,8 +1459,10 @@ mod-font.o: mod-font.c mod-font.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'font' $< > $@ || (rm -f $@; exit 1) +ifneq ($(font_mod_EXPORTS),no) def-font.lst: pre-font.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 font/' > $@ +endif und-font.lst: pre-font.o echo 'font' > $@ @@ -1362,9 +1492,12 @@ font_mod_LDFLAGS = $(COMMON_LDFLAGS) # For search.mod. search_mod_SOURCES = commands/search.c -CLEANFILES += search.mod mod-search.o mod-search.c pre-search.o search_mod-commands_search.o def-search.lst und-search.lst -MOSTLYCLEANFILES += search_mod-commands_search.d +CLEANFILES += search.mod mod-search.o mod-search.c pre-search.o search_mod-commands_search.o und-search.lst +ifneq ($(search_mod_EXPORTS),no) +CLEANFILES += def-search.lst DEFSYMFILES += def-search.lst +endif +MOSTLYCLEANFILES += search_mod-commands_search.d UNDSYMFILES += und-search.lst search.mod: pre-search.o mod-search.o @@ -1382,8 +1515,10 @@ mod-search.o: mod-search.c mod-search.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'search' $< > $@ || (rm -f $@; exit 1) +ifneq ($(search_mod_EXPORTS),no) def-search.lst: pre-search.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 search/' > $@ +endif und-search.lst: pre-search.o echo 'search' > $@ @@ -1413,9 +1548,12 @@ search_mod_LDFLAGS = $(COMMON_LDFLAGS) # For test.mod. test_mod_SOURCES = commands/test.c -CLEANFILES += test.mod mod-test.o mod-test.c pre-test.o test_mod-commands_test.o def-test.lst und-test.lst -MOSTLYCLEANFILES += test_mod-commands_test.d +CLEANFILES += test.mod mod-test.o mod-test.c pre-test.o test_mod-commands_test.o und-test.lst +ifneq ($(test_mod_EXPORTS),no) +CLEANFILES += def-test.lst DEFSYMFILES += def-test.lst +endif +MOSTLYCLEANFILES += test_mod-commands_test.d UNDSYMFILES += und-test.lst test.mod: pre-test.o mod-test.o @@ -1433,8 +1571,10 @@ mod-test.o: mod-test.c mod-test.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'test' $< > $@ || (rm -f $@; exit 1) +ifneq ($(test_mod_EXPORTS),no) def-test.lst: pre-test.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 test/' > $@ +endif und-test.lst: pre-test.o echo 'test' > $@ @@ -1464,9 +1604,12 @@ test_mod_LDFLAGS = $(COMMON_LDFLAGS) # For loopback.mod loopback_mod_SOURCES = disk/loopback.c -CLEANFILES += loopback.mod mod-loopback.o mod-loopback.c pre-loopback.o loopback_mod-disk_loopback.o def-loopback.lst und-loopback.lst -MOSTLYCLEANFILES += loopback_mod-disk_loopback.d +CLEANFILES += loopback.mod mod-loopback.o mod-loopback.c pre-loopback.o loopback_mod-disk_loopback.o und-loopback.lst +ifneq ($(loopback_mod_EXPORTS),no) +CLEANFILES += def-loopback.lst DEFSYMFILES += def-loopback.lst +endif +MOSTLYCLEANFILES += loopback_mod-disk_loopback.d UNDSYMFILES += und-loopback.lst loopback.mod: pre-loopback.o mod-loopback.o @@ -1484,8 +1627,10 @@ mod-loopback.o: mod-loopback.c mod-loopback.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'loopback' $< > $@ || (rm -f $@; exit 1) +ifneq ($(loopback_mod_EXPORTS),no) def-loopback.lst: pre-loopback.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 loopback/' > $@ +endif und-loopback.lst: pre-loopback.o echo 'loopback' > $@ @@ -1515,9 +1660,12 @@ loopback_mod_LDFLAGS = $(COMMON_LDFLAGS) # For default.mod default_mod_SOURCES = commands/default.c -CLEANFILES += default.mod mod-default.o mod-default.c pre-default.o default_mod-commands_default.o def-default.lst und-default.lst -MOSTLYCLEANFILES += default_mod-commands_default.d +CLEANFILES += default.mod mod-default.o mod-default.c pre-default.o default_mod-commands_default.o und-default.lst +ifneq ($(default_mod_EXPORTS),no) +CLEANFILES += def-default.lst DEFSYMFILES += def-default.lst +endif +MOSTLYCLEANFILES += default_mod-commands_default.d UNDSYMFILES += und-default.lst default.mod: pre-default.o mod-default.o @@ -1535,8 +1683,10 @@ mod-default.o: mod-default.c mod-default.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'default' $< > $@ || (rm -f $@; exit 1) +ifneq ($(default_mod_EXPORTS),no) def-default.lst: pre-default.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 default/' > $@ +endif und-default.lst: pre-default.o echo 'default' > $@ @@ -1566,9 +1716,12 @@ default_mod_LDFLAGS = $(COMMON_LDFLAGS) # For timeout.mod timeout_mod_SOURCES = commands/timeout.c -CLEANFILES += timeout.mod mod-timeout.o mod-timeout.c pre-timeout.o timeout_mod-commands_timeout.o def-timeout.lst und-timeout.lst -MOSTLYCLEANFILES += timeout_mod-commands_timeout.d +CLEANFILES += timeout.mod mod-timeout.o mod-timeout.c pre-timeout.o timeout_mod-commands_timeout.o und-timeout.lst +ifneq ($(timeout_mod_EXPORTS),no) +CLEANFILES += def-timeout.lst DEFSYMFILES += def-timeout.lst +endif +MOSTLYCLEANFILES += timeout_mod-commands_timeout.d UNDSYMFILES += und-timeout.lst timeout.mod: pre-timeout.o mod-timeout.o @@ -1586,8 +1739,10 @@ mod-timeout.o: mod-timeout.c mod-timeout.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'timeout' $< > $@ || (rm -f $@; exit 1) +ifneq ($(timeout_mod_EXPORTS),no) def-timeout.lst: pre-timeout.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 timeout/' > $@ +endif und-timeout.lst: pre-timeout.o echo 'timeout' > $@ @@ -1617,9 +1772,12 @@ timeout_mod_LDFLAGS = $(COMMON_LDFLAGS) # For configfile.mod configfile_mod_SOURCES = commands/configfile.c -CLEANFILES += configfile.mod mod-configfile.o mod-configfile.c pre-configfile.o configfile_mod-commands_configfile.o def-configfile.lst und-configfile.lst -MOSTLYCLEANFILES += configfile_mod-commands_configfile.d +CLEANFILES += configfile.mod mod-configfile.o mod-configfile.c pre-configfile.o configfile_mod-commands_configfile.o und-configfile.lst +ifneq ($(configfile_mod_EXPORTS),no) +CLEANFILES += def-configfile.lst DEFSYMFILES += def-configfile.lst +endif +MOSTLYCLEANFILES += configfile_mod-commands_configfile.d UNDSYMFILES += und-configfile.lst configfile.mod: pre-configfile.o mod-configfile.o @@ -1637,8 +1795,10 @@ mod-configfile.o: mod-configfile.c mod-configfile.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'configfile' $< > $@ || (rm -f $@; exit 1) +ifneq ($(configfile_mod_EXPORTS),no) def-configfile.lst: pre-configfile.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 configfile/' > $@ +endif und-configfile.lst: pre-configfile.o echo 'configfile' > $@ @@ -1668,9 +1828,12 @@ configfile_mod_LDFLAGS = $(COMMON_LDFLAGS) # For terminfo.mod. terminfo_mod_SOURCES = term/terminfo.c term/tparm.c -CLEANFILES += terminfo.mod mod-terminfo.o mod-terminfo.c pre-terminfo.o terminfo_mod-term_terminfo.o terminfo_mod-term_tparm.o def-terminfo.lst und-terminfo.lst -MOSTLYCLEANFILES += terminfo_mod-term_terminfo.d terminfo_mod-term_tparm.d +CLEANFILES += terminfo.mod mod-terminfo.o mod-terminfo.c pre-terminfo.o terminfo_mod-term_terminfo.o terminfo_mod-term_tparm.o und-terminfo.lst +ifneq ($(terminfo_mod_EXPORTS),no) +CLEANFILES += def-terminfo.lst DEFSYMFILES += def-terminfo.lst +endif +MOSTLYCLEANFILES += terminfo_mod-term_terminfo.d terminfo_mod-term_tparm.d UNDSYMFILES += und-terminfo.lst terminfo.mod: pre-terminfo.o mod-terminfo.o @@ -1688,8 +1851,10 @@ mod-terminfo.o: mod-terminfo.c mod-terminfo.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'terminfo' $< > $@ || (rm -f $@; exit 1) +ifneq ($(terminfo_mod_EXPORTS),no) def-terminfo.lst: pre-terminfo.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 terminfo/' > $@ +endif und-terminfo.lst: pre-terminfo.o echo 'terminfo' > $@ @@ -1742,9 +1907,12 @@ pkgdata_MODULES += gzio.mod # For gzio.mod. gzio_mod_SOURCES = io/gzio.c -CLEANFILES += gzio.mod mod-gzio.o mod-gzio.c pre-gzio.o gzio_mod-io_gzio.o def-gzio.lst und-gzio.lst -MOSTLYCLEANFILES += gzio_mod-io_gzio.d +CLEANFILES += gzio.mod mod-gzio.o mod-gzio.c pre-gzio.o gzio_mod-io_gzio.o und-gzio.lst +ifneq ($(gzio_mod_EXPORTS),no) +CLEANFILES += def-gzio.lst DEFSYMFILES += def-gzio.lst +endif +MOSTLYCLEANFILES += gzio_mod-io_gzio.d UNDSYMFILES += und-gzio.lst gzio.mod: pre-gzio.o mod-gzio.o @@ -1762,8 +1930,10 @@ mod-gzio.o: mod-gzio.c mod-gzio.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'gzio' $< > $@ || (rm -f $@; exit 1) +ifneq ($(gzio_mod_EXPORTS),no) def-gzio.lst: pre-gzio.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 gzio/' > $@ +endif und-gzio.lst: pre-gzio.o echo 'gzio' > $@ diff --git a/conf/i386-efi.mk b/conf/i386-efi.mk new file mode 100644 index 000000000..9f0fbde72 --- /dev/null +++ b/conf/i386-efi.mk @@ -0,0 +1,880 @@ +# -*- makefile -*- + +COMMON_ASFLAGS = -nostdinc -fno-builtin -m32 +COMMON_CFLAGS = -fno-builtin -m32 +COMMON_LDFLAGS = -melf_i386 + +# Utilities. +bin_UTILITIES = grub-mkimage +#sbin_UTILITIES = grub-setup grub-emu grub-mkdevicemap grub-probefs +noinst_UTILITIES = genmoddep + +# For grub-mkimage. +grub_mkimage_SOURCES = util/i386/efi/grub-mkimage.c util/misc.c \ + util/resolve.c +CLEANFILES += grub-mkimage grub_mkimage-util_i386_efi_grub_mkimage.o grub_mkimage-util_misc.o grub_mkimage-util_resolve.o +MOSTLYCLEANFILES += grub_mkimage-util_i386_efi_grub_mkimage.d grub_mkimage-util_misc.d grub_mkimage-util_resolve.d + +grub-mkimage: grub_mkimage-util_i386_efi_grub_mkimage.o grub_mkimage-util_misc.o grub_mkimage-util_resolve.o + $(BUILD_CC) -o $@ $^ $(BUILD_LDFLAGS) $(grub_mkimage_LDFLAGS) + +grub_mkimage-util_i386_efi_grub_mkimage.o: util/i386/efi/grub-mkimage.c + $(BUILD_CC) -Iutil/i386/efi -I$(srcdir)/util/i386/efi $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_mkimage_CFLAGS) -c -o $@ $< + +grub_mkimage-util_i386_efi_grub_mkimage.d: util/i386/efi/grub-mkimage.c + set -e; $(BUILD_CC) -Iutil/i386/efi -I$(srcdir)/util/i386/efi $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_mkimage_CFLAGS) -M $< | sed 's,grub\-mkimage\.o[ :]*,grub_mkimage-util_i386_efi_grub_mkimage.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ + +-include grub_mkimage-util_i386_efi_grub_mkimage.d + +grub_mkimage-util_misc.o: util/misc.c + $(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_mkimage_CFLAGS) -c -o $@ $< + +grub_mkimage-util_misc.d: util/misc.c + set -e; $(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_mkimage_CFLAGS) -M $< | sed 's,misc\.o[ :]*,grub_mkimage-util_misc.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ + +-include grub_mkimage-util_misc.d + +grub_mkimage-util_resolve.o: util/resolve.c + $(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_mkimage_CFLAGS) -c -o $@ $< + +grub_mkimage-util_resolve.d: util/resolve.c + set -e; $(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_mkimage_CFLAGS) -M $< | sed 's,resolve\.o[ :]*,grub_mkimage-util_resolve.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ + +-include grub_mkimage-util_resolve.d + + +# For grub-setup. +#grub_setup_SOURCES = util/i386/pc/grub-setup.c util/i386/pc/biosdisk.c \ +# util/misc.c util/i386/pc/getroot.c kern/device.c kern/disk.c \ +# kern/err.c kern/misc.c fs/fat.c fs/ext2.c fs/xfs.c fs/affs.c \ +# fs/sfs.c kern/parser.c kern/partition.c partmap/pc.c \ +# fs/ufs.c fs/minix.c fs/hfs.c fs/jfs.c fs/hfsplus.c kern/file.c \ +# kern/fs.c kern/env.c fs/fshelp.c + +# For grub-mkdevicemap. +#grub_mkdevicemap_SOURCES = util/i386/pc/grub-mkdevicemap.c util/misc.c + +# For grub-probefs. +#grub_probefs_SOURCES = util/i386/pc/grub-probefs.c \ +# util/i386/pc/biosdisk.c util/misc.c util/i386/pc/getroot.c \ +# kern/device.c kern/disk.c kern/err.c kern/misc.c fs/fat.c \ +# fs/ext2.c kern/parser.c kern/partition.c partmap/pc.c fs/ufs.c \ +# fs/minix.c fs/hfs.c fs/jfs.c kern/fs.c kern/env.c fs/fshelp.c \ +# fs/xfs.c fs/affs.c fs/sfs.c fs/hfsplus.c + +# For grub-emu. +grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c \ + commands/configfile.c commands/default.c commands/help.c \ + commands/terminal.c commands/ls.c commands/test.c \ + commands/search.c commands/timeout.c \ + commands/i386/pc/halt.c commands/i386/pc/reboot.c \ + disk/loopback.c \ + fs/affs.c fs/ext2.c fs/fat.c fs/fshelp.c fs/hfs.c fs/iso9660.c \ + fs/jfs.c fs/minix.c fs/sfs.c fs/ufs.c fs/xfs.c fs/hfsplus.c \ + io/gzio.c \ + kern/device.c kern/disk.c kern/dl.c kern/env.c kern/err.c \ + normal/execute.c kern/file.c kern/fs.c normal/lexer.c \ + kern/loader.c kern/main.c kern/misc.c kern/parser.c \ + grub_script.tab.c kern/partition.c kern/rescue.c kern/term.c \ + normal/arg.c normal/cmdline.c normal/command.c normal/function.c\ + normal/completion.c normal/context.c normal/main.c \ + normal/menu.c normal/menu_entry.c normal/misc.c normal/script.c \ + partmap/amiga.c partmap/apple.c partmap/pc.c partmap/sun.c \ + partmap/acorn.c partmap/gpt.c \ + util/console.c util/grub-emu.c util/misc.c \ + util/i386/pc/biosdisk.c util/i386/pc/getroot.c \ + util/i386/pc/misc.c grub_emu_init.c + +grub_emu_LDFLAGS = $(LIBCURSES) + +# For genmoddep. +genmoddep_SOURCES = util/genmoddep.c +CLEANFILES += genmoddep genmoddep-util_genmoddep.o +MOSTLYCLEANFILES += genmoddep-util_genmoddep.d + +genmoddep: genmoddep-util_genmoddep.o + $(BUILD_CC) -o $@ $^ $(BUILD_LDFLAGS) $(genmoddep_LDFLAGS) + +genmoddep-util_genmoddep.o: util/genmoddep.c + $(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(genmoddep_CFLAGS) -c -o $@ $< + +genmoddep-util_genmoddep.d: util/genmoddep.c + set -e; $(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(genmoddep_CFLAGS) -M $< | sed 's,genmoddep\.o[ :]*,genmoddep-util_genmoddep.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ + +-include genmoddep-util_genmoddep.d + + +# Scripts. +#sbin_SCRIPTS = grub-install + +# For grub-install. +#grub_install_SOURCES = util/efi/pc/grub-install.in + +# Modules. +pkgdata_MODULES = kernel.mod normal.mod + +# For kernel.mod. +kernel_mod_EXPORTS = no +kernel_mod_SOURCES = kern/i386/efi/startup.S kern/main.c kern/device.c \ + kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \ + kern/misc.c kern/mm.c kern/loader.c kern/rescue.c kern/term.c \ + kern/i386/dl.c kern/i386/efi/init.c kern/parser.c kern/partition.c \ + kern/env.c symlist.c kern/efi/efi.c +CLEANFILES += kernel.mod mod-kernel.o mod-kernel.c pre-kernel.o kernel_mod-kern_i386_efi_startup.o kernel_mod-kern_main.o kernel_mod-kern_device.o kernel_mod-kern_disk.o kernel_mod-kern_dl.o kernel_mod-kern_file.o kernel_mod-kern_fs.o kernel_mod-kern_err.o kernel_mod-kern_misc.o kernel_mod-kern_mm.o kernel_mod-kern_loader.o kernel_mod-kern_rescue.o kernel_mod-kern_term.o kernel_mod-kern_i386_dl.o kernel_mod-kern_i386_efi_init.o kernel_mod-kern_parser.o kernel_mod-kern_partition.o kernel_mod-kern_env.o kernel_mod-symlist.o kernel_mod-kern_efi_efi.o und-kernel.lst +ifneq ($(kernel_mod_EXPORTS),no) +CLEANFILES += def-kernel.lst +DEFSYMFILES += def-kernel.lst +endif +MOSTLYCLEANFILES += kernel_mod-kern_i386_efi_startup.d kernel_mod-kern_main.d kernel_mod-kern_device.d kernel_mod-kern_disk.d kernel_mod-kern_dl.d kernel_mod-kern_file.d kernel_mod-kern_fs.d kernel_mod-kern_err.d kernel_mod-kern_misc.d kernel_mod-kern_mm.d kernel_mod-kern_loader.d kernel_mod-kern_rescue.d kernel_mod-kern_term.d kernel_mod-kern_i386_dl.d kernel_mod-kern_i386_efi_init.d kernel_mod-kern_parser.d kernel_mod-kern_partition.d kernel_mod-kern_env.d kernel_mod-symlist.d kernel_mod-kern_efi_efi.d +UNDSYMFILES += und-kernel.lst + +kernel.mod: pre-kernel.o mod-kernel.o + -rm -f $@ + $(LD) $(kernel_mod_LDFLAGS) $(LDFLAGS) -r -d -o $@ $^ + $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@ + +pre-kernel.o: kernel_mod-kern_i386_efi_startup.o kernel_mod-kern_main.o kernel_mod-kern_device.o kernel_mod-kern_disk.o kernel_mod-kern_dl.o kernel_mod-kern_file.o kernel_mod-kern_fs.o kernel_mod-kern_err.o kernel_mod-kern_misc.o kernel_mod-kern_mm.o kernel_mod-kern_loader.o kernel_mod-kern_rescue.o kernel_mod-kern_term.o kernel_mod-kern_i386_dl.o kernel_mod-kern_i386_efi_init.o kernel_mod-kern_parser.o kernel_mod-kern_partition.o kernel_mod-kern_env.o kernel_mod-symlist.o kernel_mod-kern_efi_efi.o + -rm -f $@ + $(LD) $(kernel_mod_LDFLAGS) -r -d -o $@ $^ + +mod-kernel.o: mod-kernel.c + $(CC) $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -c -o $@ $< + +mod-kernel.c: moddep.lst genmodsrc.sh + sh $(srcdir)/genmodsrc.sh 'kernel' $< > $@ || (rm -f $@; exit 1) + +ifneq ($(kernel_mod_EXPORTS),no) +def-kernel.lst: pre-kernel.o + $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 kernel/' > $@ +endif + +und-kernel.lst: pre-kernel.o + echo 'kernel' > $@ + $(NM) -u -P -p $< | cut -f1 -d' ' >> $@ + +kernel_mod-kern_i386_efi_startup.o: kern/i386/efi/startup.S + $(CC) -Ikern/i386/efi -I$(srcdir)/kern/i386/efi $(CPPFLAGS) $(ASFLAGS) $(kernel_mod_ASFLAGS) -c -o $@ $< + +kernel_mod-kern_i386_efi_startup.d: kern/i386/efi/startup.S + set -e; $(CC) -Ikern/i386/efi -I$(srcdir)/kern/i386/efi $(CPPFLAGS) $(ASFLAGS) $(kernel_mod_ASFLAGS) -M $< | sed 's,startup\.o[ :]*,kernel_mod-kern_i386_efi_startup.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ + +-include kernel_mod-kern_i386_efi_startup.d + +CLEANFILES += cmd-kernel_mod-kern_i386_efi_startup.lst fs-kernel_mod-kern_i386_efi_startup.lst +COMMANDFILES += cmd-kernel_mod-kern_i386_efi_startup.lst +FSFILES += fs-kernel_mod-kern_i386_efi_startup.lst + +cmd-kernel_mod-kern_i386_efi_startup.lst: kern/i386/efi/startup.S gencmdlist.sh + set -e; $(CC) -Ikern/i386/efi -I$(srcdir)/kern/i386/efi $(CPPFLAGS) $(ASFLAGS) $(kernel_mod_ASFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh kernel > $@ || (rm -f $@; exit 1) + +fs-kernel_mod-kern_i386_efi_startup.lst: kern/i386/efi/startup.S genfslist.sh + set -e; $(CC) -Ikern/i386/efi -I$(srcdir)/kern/i386/efi $(CPPFLAGS) $(ASFLAGS) $(kernel_mod_ASFLAGS) -E $< | sh $(srcdir)/genfslist.sh kernel > $@ || (rm -f $@; exit 1) + + +kernel_mod-kern_main.o: kern/main.c + $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -c -o $@ $< + +kernel_mod-kern_main.d: kern/main.c + set -e; $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -M $< | sed 's,main\.o[ :]*,kernel_mod-kern_main.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ + +-include kernel_mod-kern_main.d + +CLEANFILES += cmd-kernel_mod-kern_main.lst fs-kernel_mod-kern_main.lst +COMMANDFILES += cmd-kernel_mod-kern_main.lst +FSFILES += fs-kernel_mod-kern_main.lst + +cmd-kernel_mod-kern_main.lst: kern/main.c gencmdlist.sh + set -e; $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh kernel > $@ || (rm -f $@; exit 1) + +fs-kernel_mod-kern_main.lst: kern/main.c genfslist.sh + set -e; $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh kernel > $@ || (rm -f $@; exit 1) + + +kernel_mod-kern_device.o: kern/device.c + $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -c -o $@ $< + +kernel_mod-kern_device.d: kern/device.c + set -e; $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -M $< | sed 's,device\.o[ :]*,kernel_mod-kern_device.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ + +-include kernel_mod-kern_device.d + +CLEANFILES += cmd-kernel_mod-kern_device.lst fs-kernel_mod-kern_device.lst +COMMANDFILES += cmd-kernel_mod-kern_device.lst +FSFILES += fs-kernel_mod-kern_device.lst + +cmd-kernel_mod-kern_device.lst: kern/device.c gencmdlist.sh + set -e; $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh kernel > $@ || (rm -f $@; exit 1) + +fs-kernel_mod-kern_device.lst: kern/device.c genfslist.sh + set -e; $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh kernel > $@ || (rm -f $@; exit 1) + + +kernel_mod-kern_disk.o: kern/disk.c + $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -c -o $@ $< + +kernel_mod-kern_disk.d: kern/disk.c + set -e; $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -M $< | sed 's,disk\.o[ :]*,kernel_mod-kern_disk.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ + +-include kernel_mod-kern_disk.d + +CLEANFILES += cmd-kernel_mod-kern_disk.lst fs-kernel_mod-kern_disk.lst +COMMANDFILES += cmd-kernel_mod-kern_disk.lst +FSFILES += fs-kernel_mod-kern_disk.lst + +cmd-kernel_mod-kern_disk.lst: kern/disk.c gencmdlist.sh + set -e; $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh kernel > $@ || (rm -f $@; exit 1) + +fs-kernel_mod-kern_disk.lst: kern/disk.c genfslist.sh + set -e; $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh kernel > $@ || (rm -f $@; exit 1) + + +kernel_mod-kern_dl.o: kern/dl.c + $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -c -o $@ $< + +kernel_mod-kern_dl.d: kern/dl.c + set -e; $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -M $< | sed 's,dl\.o[ :]*,kernel_mod-kern_dl.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ + +-include kernel_mod-kern_dl.d + +CLEANFILES += cmd-kernel_mod-kern_dl.lst fs-kernel_mod-kern_dl.lst +COMMANDFILES += cmd-kernel_mod-kern_dl.lst +FSFILES += fs-kernel_mod-kern_dl.lst + +cmd-kernel_mod-kern_dl.lst: kern/dl.c gencmdlist.sh + set -e; $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh kernel > $@ || (rm -f $@; exit 1) + +fs-kernel_mod-kern_dl.lst: kern/dl.c genfslist.sh + set -e; $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh kernel > $@ || (rm -f $@; exit 1) + + +kernel_mod-kern_file.o: kern/file.c + $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -c -o $@ $< + +kernel_mod-kern_file.d: kern/file.c + set -e; $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -M $< | sed 's,file\.o[ :]*,kernel_mod-kern_file.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ + +-include kernel_mod-kern_file.d + +CLEANFILES += cmd-kernel_mod-kern_file.lst fs-kernel_mod-kern_file.lst +COMMANDFILES += cmd-kernel_mod-kern_file.lst +FSFILES += fs-kernel_mod-kern_file.lst + +cmd-kernel_mod-kern_file.lst: kern/file.c gencmdlist.sh + set -e; $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh kernel > $@ || (rm -f $@; exit 1) + +fs-kernel_mod-kern_file.lst: kern/file.c genfslist.sh + set -e; $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh kernel > $@ || (rm -f $@; exit 1) + + +kernel_mod-kern_fs.o: kern/fs.c + $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -c -o $@ $< + +kernel_mod-kern_fs.d: kern/fs.c + set -e; $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -M $< | sed 's,fs\.o[ :]*,kernel_mod-kern_fs.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ + +-include kernel_mod-kern_fs.d + +CLEANFILES += cmd-kernel_mod-kern_fs.lst fs-kernel_mod-kern_fs.lst +COMMANDFILES += cmd-kernel_mod-kern_fs.lst +FSFILES += fs-kernel_mod-kern_fs.lst + +cmd-kernel_mod-kern_fs.lst: kern/fs.c gencmdlist.sh + set -e; $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh kernel > $@ || (rm -f $@; exit 1) + +fs-kernel_mod-kern_fs.lst: kern/fs.c genfslist.sh + set -e; $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh kernel > $@ || (rm -f $@; exit 1) + + +kernel_mod-kern_err.o: kern/err.c + $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -c -o $@ $< + +kernel_mod-kern_err.d: kern/err.c + set -e; $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -M $< | sed 's,err\.o[ :]*,kernel_mod-kern_err.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ + +-include kernel_mod-kern_err.d + +CLEANFILES += cmd-kernel_mod-kern_err.lst fs-kernel_mod-kern_err.lst +COMMANDFILES += cmd-kernel_mod-kern_err.lst +FSFILES += fs-kernel_mod-kern_err.lst + +cmd-kernel_mod-kern_err.lst: kern/err.c gencmdlist.sh + set -e; $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh kernel > $@ || (rm -f $@; exit 1) + +fs-kernel_mod-kern_err.lst: kern/err.c genfslist.sh + set -e; $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh kernel > $@ || (rm -f $@; exit 1) + + +kernel_mod-kern_misc.o: kern/misc.c + $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -c -o $@ $< + +kernel_mod-kern_misc.d: kern/misc.c + set -e; $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -M $< | sed 's,misc\.o[ :]*,kernel_mod-kern_misc.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ + +-include kernel_mod-kern_misc.d + +CLEANFILES += cmd-kernel_mod-kern_misc.lst fs-kernel_mod-kern_misc.lst +COMMANDFILES += cmd-kernel_mod-kern_misc.lst +FSFILES += fs-kernel_mod-kern_misc.lst + +cmd-kernel_mod-kern_misc.lst: kern/misc.c gencmdlist.sh + set -e; $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh kernel > $@ || (rm -f $@; exit 1) + +fs-kernel_mod-kern_misc.lst: kern/misc.c genfslist.sh + set -e; $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh kernel > $@ || (rm -f $@; exit 1) + + +kernel_mod-kern_mm.o: kern/mm.c + $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -c -o $@ $< + +kernel_mod-kern_mm.d: kern/mm.c + set -e; $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -M $< | sed 's,mm\.o[ :]*,kernel_mod-kern_mm.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ + +-include kernel_mod-kern_mm.d + +CLEANFILES += cmd-kernel_mod-kern_mm.lst fs-kernel_mod-kern_mm.lst +COMMANDFILES += cmd-kernel_mod-kern_mm.lst +FSFILES += fs-kernel_mod-kern_mm.lst + +cmd-kernel_mod-kern_mm.lst: kern/mm.c gencmdlist.sh + set -e; $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh kernel > $@ || (rm -f $@; exit 1) + +fs-kernel_mod-kern_mm.lst: kern/mm.c genfslist.sh + set -e; $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh kernel > $@ || (rm -f $@; exit 1) + + +kernel_mod-kern_loader.o: kern/loader.c + $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -c -o $@ $< + +kernel_mod-kern_loader.d: kern/loader.c + set -e; $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -M $< | sed 's,loader\.o[ :]*,kernel_mod-kern_loader.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ + +-include kernel_mod-kern_loader.d + +CLEANFILES += cmd-kernel_mod-kern_loader.lst fs-kernel_mod-kern_loader.lst +COMMANDFILES += cmd-kernel_mod-kern_loader.lst +FSFILES += fs-kernel_mod-kern_loader.lst + +cmd-kernel_mod-kern_loader.lst: kern/loader.c gencmdlist.sh + set -e; $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh kernel > $@ || (rm -f $@; exit 1) + +fs-kernel_mod-kern_loader.lst: kern/loader.c genfslist.sh + set -e; $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh kernel > $@ || (rm -f $@; exit 1) + + +kernel_mod-kern_rescue.o: kern/rescue.c + $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -c -o $@ $< + +kernel_mod-kern_rescue.d: kern/rescue.c + set -e; $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -M $< | sed 's,rescue\.o[ :]*,kernel_mod-kern_rescue.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ + +-include kernel_mod-kern_rescue.d + +CLEANFILES += cmd-kernel_mod-kern_rescue.lst fs-kernel_mod-kern_rescue.lst +COMMANDFILES += cmd-kernel_mod-kern_rescue.lst +FSFILES += fs-kernel_mod-kern_rescue.lst + +cmd-kernel_mod-kern_rescue.lst: kern/rescue.c gencmdlist.sh + set -e; $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh kernel > $@ || (rm -f $@; exit 1) + +fs-kernel_mod-kern_rescue.lst: kern/rescue.c genfslist.sh + set -e; $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh kernel > $@ || (rm -f $@; exit 1) + + +kernel_mod-kern_term.o: kern/term.c + $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -c -o $@ $< + +kernel_mod-kern_term.d: kern/term.c + set -e; $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -M $< | sed 's,term\.o[ :]*,kernel_mod-kern_term.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ + +-include kernel_mod-kern_term.d + +CLEANFILES += cmd-kernel_mod-kern_term.lst fs-kernel_mod-kern_term.lst +COMMANDFILES += cmd-kernel_mod-kern_term.lst +FSFILES += fs-kernel_mod-kern_term.lst + +cmd-kernel_mod-kern_term.lst: kern/term.c gencmdlist.sh + set -e; $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh kernel > $@ || (rm -f $@; exit 1) + +fs-kernel_mod-kern_term.lst: kern/term.c genfslist.sh + set -e; $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh kernel > $@ || (rm -f $@; exit 1) + + +kernel_mod-kern_i386_dl.o: kern/i386/dl.c + $(CC) -Ikern/i386 -I$(srcdir)/kern/i386 $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -c -o $@ $< + +kernel_mod-kern_i386_dl.d: kern/i386/dl.c + set -e; $(CC) -Ikern/i386 -I$(srcdir)/kern/i386 $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -M $< | sed 's,dl\.o[ :]*,kernel_mod-kern_i386_dl.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ + +-include kernel_mod-kern_i386_dl.d + +CLEANFILES += cmd-kernel_mod-kern_i386_dl.lst fs-kernel_mod-kern_i386_dl.lst +COMMANDFILES += cmd-kernel_mod-kern_i386_dl.lst +FSFILES += fs-kernel_mod-kern_i386_dl.lst + +cmd-kernel_mod-kern_i386_dl.lst: kern/i386/dl.c gencmdlist.sh + set -e; $(CC) -Ikern/i386 -I$(srcdir)/kern/i386 $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh kernel > $@ || (rm -f $@; exit 1) + +fs-kernel_mod-kern_i386_dl.lst: kern/i386/dl.c genfslist.sh + set -e; $(CC) -Ikern/i386 -I$(srcdir)/kern/i386 $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh kernel > $@ || (rm -f $@; exit 1) + + +kernel_mod-kern_i386_efi_init.o: kern/i386/efi/init.c + $(CC) -Ikern/i386/efi -I$(srcdir)/kern/i386/efi $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -c -o $@ $< + +kernel_mod-kern_i386_efi_init.d: kern/i386/efi/init.c + set -e; $(CC) -Ikern/i386/efi -I$(srcdir)/kern/i386/efi $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -M $< | sed 's,init\.o[ :]*,kernel_mod-kern_i386_efi_init.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ + +-include kernel_mod-kern_i386_efi_init.d + +CLEANFILES += cmd-kernel_mod-kern_i386_efi_init.lst fs-kernel_mod-kern_i386_efi_init.lst +COMMANDFILES += cmd-kernel_mod-kern_i386_efi_init.lst +FSFILES += fs-kernel_mod-kern_i386_efi_init.lst + +cmd-kernel_mod-kern_i386_efi_init.lst: kern/i386/efi/init.c gencmdlist.sh + set -e; $(CC) -Ikern/i386/efi -I$(srcdir)/kern/i386/efi $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh kernel > $@ || (rm -f $@; exit 1) + +fs-kernel_mod-kern_i386_efi_init.lst: kern/i386/efi/init.c genfslist.sh + set -e; $(CC) -Ikern/i386/efi -I$(srcdir)/kern/i386/efi $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh kernel > $@ || (rm -f $@; exit 1) + + +kernel_mod-kern_parser.o: kern/parser.c + $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -c -o $@ $< + +kernel_mod-kern_parser.d: kern/parser.c + set -e; $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -M $< | sed 's,parser\.o[ :]*,kernel_mod-kern_parser.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ + +-include kernel_mod-kern_parser.d + +CLEANFILES += cmd-kernel_mod-kern_parser.lst fs-kernel_mod-kern_parser.lst +COMMANDFILES += cmd-kernel_mod-kern_parser.lst +FSFILES += fs-kernel_mod-kern_parser.lst + +cmd-kernel_mod-kern_parser.lst: kern/parser.c gencmdlist.sh + set -e; $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh kernel > $@ || (rm -f $@; exit 1) + +fs-kernel_mod-kern_parser.lst: kern/parser.c genfslist.sh + set -e; $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh kernel > $@ || (rm -f $@; exit 1) + + +kernel_mod-kern_partition.o: kern/partition.c + $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -c -o $@ $< + +kernel_mod-kern_partition.d: kern/partition.c + set -e; $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -M $< | sed 's,partition\.o[ :]*,kernel_mod-kern_partition.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ + +-include kernel_mod-kern_partition.d + +CLEANFILES += cmd-kernel_mod-kern_partition.lst fs-kernel_mod-kern_partition.lst +COMMANDFILES += cmd-kernel_mod-kern_partition.lst +FSFILES += fs-kernel_mod-kern_partition.lst + +cmd-kernel_mod-kern_partition.lst: kern/partition.c gencmdlist.sh + set -e; $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh kernel > $@ || (rm -f $@; exit 1) + +fs-kernel_mod-kern_partition.lst: kern/partition.c genfslist.sh + set -e; $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh kernel > $@ || (rm -f $@; exit 1) + + +kernel_mod-kern_env.o: kern/env.c + $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -c -o $@ $< + +kernel_mod-kern_env.d: kern/env.c + set -e; $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -M $< | sed 's,env\.o[ :]*,kernel_mod-kern_env.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ + +-include kernel_mod-kern_env.d + +CLEANFILES += cmd-kernel_mod-kern_env.lst fs-kernel_mod-kern_env.lst +COMMANDFILES += cmd-kernel_mod-kern_env.lst +FSFILES += fs-kernel_mod-kern_env.lst + +cmd-kernel_mod-kern_env.lst: kern/env.c gencmdlist.sh + set -e; $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh kernel > $@ || (rm -f $@; exit 1) + +fs-kernel_mod-kern_env.lst: kern/env.c genfslist.sh + set -e; $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh kernel > $@ || (rm -f $@; exit 1) + + +kernel_mod-symlist.o: symlist.c + $(CC) -I. -I$(srcdir)/. $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -c -o $@ $< + +kernel_mod-symlist.d: symlist.c + set -e; $(CC) -I. -I$(srcdir)/. $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -M $< | sed 's,symlist\.o[ :]*,kernel_mod-symlist.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ + +-include kernel_mod-symlist.d + +CLEANFILES += cmd-kernel_mod-symlist.lst fs-kernel_mod-symlist.lst +COMMANDFILES += cmd-kernel_mod-symlist.lst +FSFILES += fs-kernel_mod-symlist.lst + +cmd-kernel_mod-symlist.lst: symlist.c gencmdlist.sh + set -e; $(CC) -I. -I$(srcdir)/. $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh kernel > $@ || (rm -f $@; exit 1) + +fs-kernel_mod-symlist.lst: symlist.c genfslist.sh + set -e; $(CC) -I. -I$(srcdir)/. $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh kernel > $@ || (rm -f $@; exit 1) + + +kernel_mod-kern_efi_efi.o: kern/efi/efi.c + $(CC) -Ikern/efi -I$(srcdir)/kern/efi $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -c -o $@ $< + +kernel_mod-kern_efi_efi.d: kern/efi/efi.c + set -e; $(CC) -Ikern/efi -I$(srcdir)/kern/efi $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -M $< | sed 's,efi\.o[ :]*,kernel_mod-kern_efi_efi.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ + +-include kernel_mod-kern_efi_efi.d + +CLEANFILES += cmd-kernel_mod-kern_efi_efi.lst fs-kernel_mod-kern_efi_efi.lst +COMMANDFILES += cmd-kernel_mod-kern_efi_efi.lst +FSFILES += fs-kernel_mod-kern_efi_efi.lst + +cmd-kernel_mod-kern_efi_efi.lst: kern/efi/efi.c gencmdlist.sh + set -e; $(CC) -Ikern/efi -I$(srcdir)/kern/efi $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh kernel > $@ || (rm -f $@; exit 1) + +fs-kernel_mod-kern_efi_efi.lst: kern/efi/efi.c genfslist.sh + set -e; $(CC) -Ikern/efi -I$(srcdir)/kern/efi $(CPPFLAGS) $(CFLAGS) $(kernel_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh kernel > $@ || (rm -f $@; exit 1) + + +kernel_mod_HEADERS = arg.h boot.h device.h disk.h dl.h elf.h env.h err.h \ + file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h partition.h \ + pc_partition.h rescue.h symbol.h term.h types.h \ + i386/efi/time.h efi/efi.h +kernel_mod_CFLAGS = $(COMMON_CFLAGS) +kernel_mod_ASFLAGS = $(COMMON_ASFLAGS) +kernel_mod_LDFLAGS = $(COMMON_LDFLAGS) + +MOSTLYCLEANFILES += symlist.c +MOSTLYCLEANFILES += symlist.c kernel_syms.lst +DEFSYMFILES += kernel_syms.lst + +symlist.c: $(addprefix include/grub/,$(kernel_mod_HEADERS)) gensymlist.sh + sh $(srcdir)/gensymlist.sh $(filter %.h,$^) > $@ + +kernel_syms.lst: $(addprefix include/grub/,$(kernel_mod_HEADERS)) genkernsyms.sh + sh $(srcdir)/genkernsyms.sh $(filter %.h,$^) > $@ + +# For normal.mod. +normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c \ + normal/completion.c normal/context.c normal/execute.c \ + normal/function.c normal/lexer.c normal/main.c normal/menu.c \ + normal/menu_entry.c normal/misc.c grub_script.tab.c \ + normal/script.c normal/i386/setjmp.S +CLEANFILES += normal.mod mod-normal.o mod-normal.c pre-normal.o normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_completion.o normal_mod-normal_context.o normal_mod-normal_execute.o normal_mod-normal_function.o normal_mod-normal_lexer.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_menu_entry.o normal_mod-normal_misc.o normal_mod-grub_script_tab.o normal_mod-normal_script.o normal_mod-normal_i386_setjmp.o und-normal.lst +ifneq ($(normal_mod_EXPORTS),no) +CLEANFILES += def-normal.lst +DEFSYMFILES += def-normal.lst +endif +MOSTLYCLEANFILES += normal_mod-normal_arg.d normal_mod-normal_cmdline.d normal_mod-normal_command.d normal_mod-normal_completion.d normal_mod-normal_context.d normal_mod-normal_execute.d normal_mod-normal_function.d normal_mod-normal_lexer.d normal_mod-normal_main.d normal_mod-normal_menu.d normal_mod-normal_menu_entry.d normal_mod-normal_misc.d normal_mod-grub_script_tab.d normal_mod-normal_script.d normal_mod-normal_i386_setjmp.d +UNDSYMFILES += und-normal.lst + +normal.mod: pre-normal.o mod-normal.o + -rm -f $@ + $(LD) $(normal_mod_LDFLAGS) $(LDFLAGS) -r -d -o $@ $^ + $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@ + +pre-normal.o: normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_completion.o normal_mod-normal_context.o normal_mod-normal_execute.o normal_mod-normal_function.o normal_mod-normal_lexer.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_menu_entry.o normal_mod-normal_misc.o normal_mod-grub_script_tab.o normal_mod-normal_script.o normal_mod-normal_i386_setjmp.o + -rm -f $@ + $(LD) $(normal_mod_LDFLAGS) -r -d -o $@ $^ + +mod-normal.o: mod-normal.c + $(CC) $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -c -o $@ $< + +mod-normal.c: moddep.lst genmodsrc.sh + sh $(srcdir)/genmodsrc.sh 'normal' $< > $@ || (rm -f $@; exit 1) + +ifneq ($(normal_mod_EXPORTS),no) +def-normal.lst: pre-normal.o + $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 normal/' > $@ +endif + +und-normal.lst: pre-normal.o + echo 'normal' > $@ + $(NM) -u -P -p $< | cut -f1 -d' ' >> $@ + +normal_mod-normal_arg.o: normal/arg.c + $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -c -o $@ $< + +normal_mod-normal_arg.d: normal/arg.c + set -e; $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -M $< | sed 's,arg\.o[ :]*,normal_mod-normal_arg.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ + +-include normal_mod-normal_arg.d + +CLEANFILES += cmd-normal_mod-normal_arg.lst fs-normal_mod-normal_arg.lst +COMMANDFILES += cmd-normal_mod-normal_arg.lst +FSFILES += fs-normal_mod-normal_arg.lst + +cmd-normal_mod-normal_arg.lst: normal/arg.c gencmdlist.sh + set -e; $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh normal > $@ || (rm -f $@; exit 1) + +fs-normal_mod-normal_arg.lst: normal/arg.c genfslist.sh + set -e; $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh normal > $@ || (rm -f $@; exit 1) + + +normal_mod-normal_cmdline.o: normal/cmdline.c + $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -c -o $@ $< + +normal_mod-normal_cmdline.d: normal/cmdline.c + set -e; $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -M $< | sed 's,cmdline\.o[ :]*,normal_mod-normal_cmdline.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ + +-include normal_mod-normal_cmdline.d + +CLEANFILES += cmd-normal_mod-normal_cmdline.lst fs-normal_mod-normal_cmdline.lst +COMMANDFILES += cmd-normal_mod-normal_cmdline.lst +FSFILES += fs-normal_mod-normal_cmdline.lst + +cmd-normal_mod-normal_cmdline.lst: normal/cmdline.c gencmdlist.sh + set -e; $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh normal > $@ || (rm -f $@; exit 1) + +fs-normal_mod-normal_cmdline.lst: normal/cmdline.c genfslist.sh + set -e; $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh normal > $@ || (rm -f $@; exit 1) + + +normal_mod-normal_command.o: normal/command.c + $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -c -o $@ $< + +normal_mod-normal_command.d: normal/command.c + set -e; $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -M $< | sed 's,command\.o[ :]*,normal_mod-normal_command.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ + +-include normal_mod-normal_command.d + +CLEANFILES += cmd-normal_mod-normal_command.lst fs-normal_mod-normal_command.lst +COMMANDFILES += cmd-normal_mod-normal_command.lst +FSFILES += fs-normal_mod-normal_command.lst + +cmd-normal_mod-normal_command.lst: normal/command.c gencmdlist.sh + set -e; $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh normal > $@ || (rm -f $@; exit 1) + +fs-normal_mod-normal_command.lst: normal/command.c genfslist.sh + set -e; $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh normal > $@ || (rm -f $@; exit 1) + + +normal_mod-normal_completion.o: normal/completion.c + $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -c -o $@ $< + +normal_mod-normal_completion.d: normal/completion.c + set -e; $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -M $< | sed 's,completion\.o[ :]*,normal_mod-normal_completion.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ + +-include normal_mod-normal_completion.d + +CLEANFILES += cmd-normal_mod-normal_completion.lst fs-normal_mod-normal_completion.lst +COMMANDFILES += cmd-normal_mod-normal_completion.lst +FSFILES += fs-normal_mod-normal_completion.lst + +cmd-normal_mod-normal_completion.lst: normal/completion.c gencmdlist.sh + set -e; $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh normal > $@ || (rm -f $@; exit 1) + +fs-normal_mod-normal_completion.lst: normal/completion.c genfslist.sh + set -e; $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh normal > $@ || (rm -f $@; exit 1) + + +normal_mod-normal_context.o: normal/context.c + $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -c -o $@ $< + +normal_mod-normal_context.d: normal/context.c + set -e; $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -M $< | sed 's,context\.o[ :]*,normal_mod-normal_context.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ + +-include normal_mod-normal_context.d + +CLEANFILES += cmd-normal_mod-normal_context.lst fs-normal_mod-normal_context.lst +COMMANDFILES += cmd-normal_mod-normal_context.lst +FSFILES += fs-normal_mod-normal_context.lst + +cmd-normal_mod-normal_context.lst: normal/context.c gencmdlist.sh + set -e; $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh normal > $@ || (rm -f $@; exit 1) + +fs-normal_mod-normal_context.lst: normal/context.c genfslist.sh + set -e; $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh normal > $@ || (rm -f $@; exit 1) + + +normal_mod-normal_execute.o: normal/execute.c + $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -c -o $@ $< + +normal_mod-normal_execute.d: normal/execute.c + set -e; $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -M $< | sed 's,execute\.o[ :]*,normal_mod-normal_execute.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ + +-include normal_mod-normal_execute.d + +CLEANFILES += cmd-normal_mod-normal_execute.lst fs-normal_mod-normal_execute.lst +COMMANDFILES += cmd-normal_mod-normal_execute.lst +FSFILES += fs-normal_mod-normal_execute.lst + +cmd-normal_mod-normal_execute.lst: normal/execute.c gencmdlist.sh + set -e; $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh normal > $@ || (rm -f $@; exit 1) + +fs-normal_mod-normal_execute.lst: normal/execute.c genfslist.sh + set -e; $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh normal > $@ || (rm -f $@; exit 1) + + +normal_mod-normal_function.o: normal/function.c + $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -c -o $@ $< + +normal_mod-normal_function.d: normal/function.c + set -e; $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -M $< | sed 's,function\.o[ :]*,normal_mod-normal_function.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ + +-include normal_mod-normal_function.d + +CLEANFILES += cmd-normal_mod-normal_function.lst fs-normal_mod-normal_function.lst +COMMANDFILES += cmd-normal_mod-normal_function.lst +FSFILES += fs-normal_mod-normal_function.lst + +cmd-normal_mod-normal_function.lst: normal/function.c gencmdlist.sh + set -e; $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh normal > $@ || (rm -f $@; exit 1) + +fs-normal_mod-normal_function.lst: normal/function.c genfslist.sh + set -e; $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh normal > $@ || (rm -f $@; exit 1) + + +normal_mod-normal_lexer.o: normal/lexer.c + $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -c -o $@ $< + +normal_mod-normal_lexer.d: normal/lexer.c + set -e; $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -M $< | sed 's,lexer\.o[ :]*,normal_mod-normal_lexer.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ + +-include normal_mod-normal_lexer.d + +CLEANFILES += cmd-normal_mod-normal_lexer.lst fs-normal_mod-normal_lexer.lst +COMMANDFILES += cmd-normal_mod-normal_lexer.lst +FSFILES += fs-normal_mod-normal_lexer.lst + +cmd-normal_mod-normal_lexer.lst: normal/lexer.c gencmdlist.sh + set -e; $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh normal > $@ || (rm -f $@; exit 1) + +fs-normal_mod-normal_lexer.lst: normal/lexer.c genfslist.sh + set -e; $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh normal > $@ || (rm -f $@; exit 1) + + +normal_mod-normal_main.o: normal/main.c + $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -c -o $@ $< + +normal_mod-normal_main.d: normal/main.c + set -e; $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -M $< | sed 's,main\.o[ :]*,normal_mod-normal_main.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ + +-include normal_mod-normal_main.d + +CLEANFILES += cmd-normal_mod-normal_main.lst fs-normal_mod-normal_main.lst +COMMANDFILES += cmd-normal_mod-normal_main.lst +FSFILES += fs-normal_mod-normal_main.lst + +cmd-normal_mod-normal_main.lst: normal/main.c gencmdlist.sh + set -e; $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh normal > $@ || (rm -f $@; exit 1) + +fs-normal_mod-normal_main.lst: normal/main.c genfslist.sh + set -e; $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh normal > $@ || (rm -f $@; exit 1) + + +normal_mod-normal_menu.o: normal/menu.c + $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -c -o $@ $< + +normal_mod-normal_menu.d: normal/menu.c + set -e; $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -M $< | sed 's,menu\.o[ :]*,normal_mod-normal_menu.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ + +-include normal_mod-normal_menu.d + +CLEANFILES += cmd-normal_mod-normal_menu.lst fs-normal_mod-normal_menu.lst +COMMANDFILES += cmd-normal_mod-normal_menu.lst +FSFILES += fs-normal_mod-normal_menu.lst + +cmd-normal_mod-normal_menu.lst: normal/menu.c gencmdlist.sh + set -e; $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh normal > $@ || (rm -f $@; exit 1) + +fs-normal_mod-normal_menu.lst: normal/menu.c genfslist.sh + set -e; $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh normal > $@ || (rm -f $@; exit 1) + + +normal_mod-normal_menu_entry.o: normal/menu_entry.c + $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -c -o $@ $< + +normal_mod-normal_menu_entry.d: normal/menu_entry.c + set -e; $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -M $< | sed 's,menu_entry\.o[ :]*,normal_mod-normal_menu_entry.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ + +-include normal_mod-normal_menu_entry.d + +CLEANFILES += cmd-normal_mod-normal_menu_entry.lst fs-normal_mod-normal_menu_entry.lst +COMMANDFILES += cmd-normal_mod-normal_menu_entry.lst +FSFILES += fs-normal_mod-normal_menu_entry.lst + +cmd-normal_mod-normal_menu_entry.lst: normal/menu_entry.c gencmdlist.sh + set -e; $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh normal > $@ || (rm -f $@; exit 1) + +fs-normal_mod-normal_menu_entry.lst: normal/menu_entry.c genfslist.sh + set -e; $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh normal > $@ || (rm -f $@; exit 1) + + +normal_mod-normal_misc.o: normal/misc.c + $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -c -o $@ $< + +normal_mod-normal_misc.d: normal/misc.c + set -e; $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -M $< | sed 's,misc\.o[ :]*,normal_mod-normal_misc.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ + +-include normal_mod-normal_misc.d + +CLEANFILES += cmd-normal_mod-normal_misc.lst fs-normal_mod-normal_misc.lst +COMMANDFILES += cmd-normal_mod-normal_misc.lst +FSFILES += fs-normal_mod-normal_misc.lst + +cmd-normal_mod-normal_misc.lst: normal/misc.c gencmdlist.sh + set -e; $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh normal > $@ || (rm -f $@; exit 1) + +fs-normal_mod-normal_misc.lst: normal/misc.c genfslist.sh + set -e; $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh normal > $@ || (rm -f $@; exit 1) + + +normal_mod-grub_script_tab.o: grub_script.tab.c + $(CC) -I. -I$(srcdir)/. $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -c -o $@ $< + +normal_mod-grub_script_tab.d: grub_script.tab.c + set -e; $(CC) -I. -I$(srcdir)/. $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -M $< | sed 's,grub_script\.tab\.o[ :]*,normal_mod-grub_script_tab.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ + +-include normal_mod-grub_script_tab.d + +CLEANFILES += cmd-normal_mod-grub_script_tab.lst fs-normal_mod-grub_script_tab.lst +COMMANDFILES += cmd-normal_mod-grub_script_tab.lst +FSFILES += fs-normal_mod-grub_script_tab.lst + +cmd-normal_mod-grub_script_tab.lst: grub_script.tab.c gencmdlist.sh + set -e; $(CC) -I. -I$(srcdir)/. $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh normal > $@ || (rm -f $@; exit 1) + +fs-normal_mod-grub_script_tab.lst: grub_script.tab.c genfslist.sh + set -e; $(CC) -I. -I$(srcdir)/. $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh normal > $@ || (rm -f $@; exit 1) + + +normal_mod-normal_script.o: normal/script.c + $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -c -o $@ $< + +normal_mod-normal_script.d: normal/script.c + set -e; $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -M $< | sed 's,script\.o[ :]*,normal_mod-normal_script.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ + +-include normal_mod-normal_script.d + +CLEANFILES += cmd-normal_mod-normal_script.lst fs-normal_mod-normal_script.lst +COMMANDFILES += cmd-normal_mod-normal_script.lst +FSFILES += fs-normal_mod-normal_script.lst + +cmd-normal_mod-normal_script.lst: normal/script.c gencmdlist.sh + set -e; $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh normal > $@ || (rm -f $@; exit 1) + +fs-normal_mod-normal_script.lst: normal/script.c genfslist.sh + set -e; $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh normal > $@ || (rm -f $@; exit 1) + + +normal_mod-normal_i386_setjmp.o: normal/i386/setjmp.S + $(CC) -Inormal/i386 -I$(srcdir)/normal/i386 $(CPPFLAGS) $(ASFLAGS) $(normal_mod_ASFLAGS) -c -o $@ $< + +normal_mod-normal_i386_setjmp.d: normal/i386/setjmp.S + set -e; $(CC) -Inormal/i386 -I$(srcdir)/normal/i386 $(CPPFLAGS) $(ASFLAGS) $(normal_mod_ASFLAGS) -M $< | sed 's,setjmp\.o[ :]*,normal_mod-normal_i386_setjmp.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ + +-include normal_mod-normal_i386_setjmp.d + +CLEANFILES += cmd-normal_mod-normal_i386_setjmp.lst fs-normal_mod-normal_i386_setjmp.lst +COMMANDFILES += cmd-normal_mod-normal_i386_setjmp.lst +FSFILES += fs-normal_mod-normal_i386_setjmp.lst + +cmd-normal_mod-normal_i386_setjmp.lst: normal/i386/setjmp.S gencmdlist.sh + set -e; $(CC) -Inormal/i386 -I$(srcdir)/normal/i386 $(CPPFLAGS) $(ASFLAGS) $(normal_mod_ASFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh normal > $@ || (rm -f $@; exit 1) + +fs-normal_mod-normal_i386_setjmp.lst: normal/i386/setjmp.S genfslist.sh + set -e; $(CC) -Inormal/i386 -I$(srcdir)/normal/i386 $(CPPFLAGS) $(ASFLAGS) $(normal_mod_ASFLAGS) -E $< | sh $(srcdir)/genfslist.sh normal > $@ || (rm -f $@; exit 1) + + +normal_mod_CFLAGS = $(COMMON_CFLAGS) +normal_mod_ASFLAGS = $(COMMON_ASFLAGS) +normal_mod_LDFLAGS = $(COMMON_LDFLAGS) + +include $(srcdir)/conf/common.mk diff --git a/conf/i386-efi.rmk b/conf/i386-efi.rmk new file mode 100644 index 000000000..6805a3ad5 --- /dev/null +++ b/conf/i386-efi.rmk @@ -0,0 +1,107 @@ +# -*- makefile -*- + +COMMON_ASFLAGS = -nostdinc -fno-builtin -m32 +COMMON_CFLAGS = -fno-builtin -m32 +COMMON_LDFLAGS = -melf_i386 + +# Utilities. +bin_UTILITIES = grub-mkimage +#sbin_UTILITIES = grub-setup grub-emu grub-mkdevicemap grub-probefs +noinst_UTILITIES = genmoddep + +# For grub-mkimage. +grub_mkimage_SOURCES = util/i386/efi/grub-mkimage.c util/misc.c \ + util/resolve.c + +# For grub-setup. +#grub_setup_SOURCES = util/i386/pc/grub-setup.c util/i386/pc/biosdisk.c \ +# util/misc.c util/i386/pc/getroot.c kern/device.c kern/disk.c \ +# kern/err.c kern/misc.c fs/fat.c fs/ext2.c fs/xfs.c fs/affs.c \ +# fs/sfs.c kern/parser.c kern/partition.c partmap/pc.c \ +# fs/ufs.c fs/minix.c fs/hfs.c fs/jfs.c fs/hfsplus.c kern/file.c \ +# kern/fs.c kern/env.c fs/fshelp.c + +# For grub-mkdevicemap. +#grub_mkdevicemap_SOURCES = util/i386/pc/grub-mkdevicemap.c util/misc.c + +# For grub-probefs. +#grub_probefs_SOURCES = util/i386/pc/grub-probefs.c \ +# util/i386/pc/biosdisk.c util/misc.c util/i386/pc/getroot.c \ +# kern/device.c kern/disk.c kern/err.c kern/misc.c fs/fat.c \ +# fs/ext2.c kern/parser.c kern/partition.c partmap/pc.c fs/ufs.c \ +# fs/minix.c fs/hfs.c fs/jfs.c kern/fs.c kern/env.c fs/fshelp.c \ +# fs/xfs.c fs/affs.c fs/sfs.c fs/hfsplus.c + +# For grub-emu. +grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c \ + commands/configfile.c commands/default.c commands/help.c \ + commands/terminal.c commands/ls.c commands/test.c \ + commands/search.c commands/timeout.c \ + commands/i386/pc/halt.c commands/i386/pc/reboot.c \ + disk/loopback.c \ + fs/affs.c fs/ext2.c fs/fat.c fs/fshelp.c fs/hfs.c fs/iso9660.c \ + fs/jfs.c fs/minix.c fs/sfs.c fs/ufs.c fs/xfs.c fs/hfsplus.c \ + io/gzio.c \ + kern/device.c kern/disk.c kern/dl.c kern/env.c kern/err.c \ + normal/execute.c kern/file.c kern/fs.c normal/lexer.c \ + kern/loader.c kern/main.c kern/misc.c kern/parser.c \ + grub_script.tab.c kern/partition.c kern/rescue.c kern/term.c \ + normal/arg.c normal/cmdline.c normal/command.c normal/function.c\ + normal/completion.c normal/context.c normal/main.c \ + normal/menu.c normal/menu_entry.c normal/misc.c normal/script.c \ + partmap/amiga.c partmap/apple.c partmap/pc.c partmap/sun.c \ + partmap/acorn.c partmap/gpt.c \ + util/console.c util/grub-emu.c util/misc.c \ + util/i386/pc/biosdisk.c util/i386/pc/getroot.c \ + util/i386/pc/misc.c grub_emu_init.c + +grub_emu_LDFLAGS = $(LIBCURSES) + +# For genmoddep. +genmoddep_SOURCES = util/genmoddep.c + +# Scripts. +#sbin_SCRIPTS = grub-install + +# For grub-install. +#grub_install_SOURCES = util/efi/pc/grub-install.in + +# Modules. +pkgdata_MODULES = kernel.mod normal.mod + +# For kernel.mod. +kernel_mod_EXPORTS = no +kernel_mod_SOURCES = kern/i386/efi/startup.S kern/main.c kern/device.c \ + kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \ + kern/misc.c kern/mm.c kern/loader.c kern/rescue.c kern/term.c \ + kern/i386/dl.c kern/i386/efi/init.c kern/parser.c kern/partition.c \ + kern/env.c symlist.c kern/efi/efi.c +kernel_mod_HEADERS = arg.h boot.h device.h disk.h dl.h elf.h env.h err.h \ + file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h partition.h \ + pc_partition.h rescue.h symbol.h term.h types.h \ + i386/efi/time.h efi/efi.h +kernel_mod_CFLAGS = $(COMMON_CFLAGS) +kernel_mod_ASFLAGS = $(COMMON_ASFLAGS) +kernel_mod_LDFLAGS = $(COMMON_LDFLAGS) + +MOSTLYCLEANFILES += symlist.c +MOSTLYCLEANFILES += symlist.c kernel_syms.lst +DEFSYMFILES += kernel_syms.lst + +symlist.c: $(addprefix include/grub/,$(kernel_mod_HEADERS)) gensymlist.sh + sh $(srcdir)/gensymlist.sh $(filter %.h,$^) > $@ + +kernel_syms.lst: $(addprefix include/grub/,$(kernel_mod_HEADERS)) genkernsyms.sh + sh $(srcdir)/genkernsyms.sh $(filter %.h,$^) > $@ + +# For normal.mod. +normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c \ + normal/completion.c normal/context.c normal/execute.c \ + normal/function.c normal/lexer.c normal/main.c normal/menu.c \ + normal/menu_entry.c normal/misc.c grub_script.tab.c \ + normal/script.c normal/i386/setjmp.S +normal_mod_CFLAGS = $(COMMON_CFLAGS) +normal_mod_ASFLAGS = $(COMMON_ASFLAGS) +normal_mod_LDFLAGS = $(COMMON_LDFLAGS) + +include $(srcdir)/conf/common.mk diff --git a/conf/i386-pc.mk b/conf/i386-pc.mk index 8b711936c..18b5bc319 100644 --- a/conf/i386-pc.mk +++ b/conf/i386-pc.mk @@ -1374,9 +1374,12 @@ pkgdata_MODULES = _chain.mod _linux.mod linux.mod normal.mod \ # For _chain.mod. _chain_mod_SOURCES = loader/i386/pc/chainloader.c -CLEANFILES += _chain.mod mod-_chain.o mod-_chain.c pre-_chain.o _chain_mod-loader_i386_pc_chainloader.o def-_chain.lst und-_chain.lst -MOSTLYCLEANFILES += _chain_mod-loader_i386_pc_chainloader.d +CLEANFILES += _chain.mod mod-_chain.o mod-_chain.c pre-_chain.o _chain_mod-loader_i386_pc_chainloader.o und-_chain.lst +ifneq ($(_chain_mod_EXPORTS),no) +CLEANFILES += def-_chain.lst DEFSYMFILES += def-_chain.lst +endif +MOSTLYCLEANFILES += _chain_mod-loader_i386_pc_chainloader.d UNDSYMFILES += und-_chain.lst _chain.mod: pre-_chain.o mod-_chain.o @@ -1394,8 +1397,10 @@ mod-_chain.o: mod-_chain.c mod-_chain.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh '_chain' $< > $@ || (rm -f $@; exit 1) +ifneq ($(_chain_mod_EXPORTS),no) def-_chain.lst: pre-_chain.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 _chain/' > $@ +endif und-_chain.lst: pre-_chain.o echo '_chain' > $@ @@ -1425,9 +1430,12 @@ _chain_mod_LDFLAGS = $(COMMON_LDFLAGS) # For chain.mod. chain_mod_SOURCES = loader/i386/pc/chainloader_normal.c -CLEANFILES += chain.mod mod-chain.o mod-chain.c pre-chain.o chain_mod-loader_i386_pc_chainloader_normal.o def-chain.lst und-chain.lst -MOSTLYCLEANFILES += chain_mod-loader_i386_pc_chainloader_normal.d +CLEANFILES += chain.mod mod-chain.o mod-chain.c pre-chain.o chain_mod-loader_i386_pc_chainloader_normal.o und-chain.lst +ifneq ($(chain_mod_EXPORTS),no) +CLEANFILES += def-chain.lst DEFSYMFILES += def-chain.lst +endif +MOSTLYCLEANFILES += chain_mod-loader_i386_pc_chainloader_normal.d UNDSYMFILES += und-chain.lst chain.mod: pre-chain.o mod-chain.o @@ -1445,8 +1453,10 @@ mod-chain.o: mod-chain.c mod-chain.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'chain' $< > $@ || (rm -f $@; exit 1) +ifneq ($(chain_mod_EXPORTS),no) def-chain.lst: pre-chain.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 chain/' > $@ +endif und-chain.lst: pre-chain.o echo 'chain' > $@ @@ -1476,9 +1486,12 @@ chain_mod_LDFLAGS = $(COMMON_LDFLAGS) # For _linux.mod. _linux_mod_SOURCES = loader/i386/pc/linux.c -CLEANFILES += _linux.mod mod-_linux.o mod-_linux.c pre-_linux.o _linux_mod-loader_i386_pc_linux.o def-_linux.lst und-_linux.lst -MOSTLYCLEANFILES += _linux_mod-loader_i386_pc_linux.d +CLEANFILES += _linux.mod mod-_linux.o mod-_linux.c pre-_linux.o _linux_mod-loader_i386_pc_linux.o und-_linux.lst +ifneq ($(_linux_mod_EXPORTS),no) +CLEANFILES += def-_linux.lst DEFSYMFILES += def-_linux.lst +endif +MOSTLYCLEANFILES += _linux_mod-loader_i386_pc_linux.d UNDSYMFILES += und-_linux.lst _linux.mod: pre-_linux.o mod-_linux.o @@ -1496,8 +1509,10 @@ mod-_linux.o: mod-_linux.c mod-_linux.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh '_linux' $< > $@ || (rm -f $@; exit 1) +ifneq ($(_linux_mod_EXPORTS),no) def-_linux.lst: pre-_linux.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 _linux/' > $@ +endif und-_linux.lst: pre-_linux.o echo '_linux' > $@ @@ -1527,9 +1542,12 @@ _linux_mod_LDFLAGS = $(COMMON_LDFLAGS) # For linux.mod. linux_mod_SOURCES = loader/i386/pc/linux_normal.c -CLEANFILES += linux.mod mod-linux.o mod-linux.c pre-linux.o linux_mod-loader_i386_pc_linux_normal.o def-linux.lst und-linux.lst -MOSTLYCLEANFILES += linux_mod-loader_i386_pc_linux_normal.d +CLEANFILES += linux.mod mod-linux.o mod-linux.c pre-linux.o linux_mod-loader_i386_pc_linux_normal.o und-linux.lst +ifneq ($(linux_mod_EXPORTS),no) +CLEANFILES += def-linux.lst DEFSYMFILES += def-linux.lst +endif +MOSTLYCLEANFILES += linux_mod-loader_i386_pc_linux_normal.d UNDSYMFILES += und-linux.lst linux.mod: pre-linux.o mod-linux.o @@ -1547,8 +1565,10 @@ mod-linux.o: mod-linux.c mod-linux.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'linux' $< > $@ || (rm -f $@; exit 1) +ifneq ($(linux_mod_EXPORTS),no) def-linux.lst: pre-linux.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 linux/' > $@ +endif und-linux.lst: pre-linux.o echo 'linux' > $@ @@ -1582,9 +1602,12 @@ normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c \ normal/function.c normal/lexer.c normal/main.c normal/menu.c \ normal/menu_entry.c normal/misc.c grub_script.tab.c \ normal/script.c normal/i386/setjmp.S -CLEANFILES += normal.mod mod-normal.o mod-normal.c pre-normal.o normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_completion.o normal_mod-normal_context.o normal_mod-normal_execute.o normal_mod-normal_function.o normal_mod-normal_lexer.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_menu_entry.o normal_mod-normal_misc.o normal_mod-grub_script_tab.o normal_mod-normal_script.o normal_mod-normal_i386_setjmp.o def-normal.lst und-normal.lst -MOSTLYCLEANFILES += normal_mod-normal_arg.d normal_mod-normal_cmdline.d normal_mod-normal_command.d normal_mod-normal_completion.d normal_mod-normal_context.d normal_mod-normal_execute.d normal_mod-normal_function.d normal_mod-normal_lexer.d normal_mod-normal_main.d normal_mod-normal_menu.d normal_mod-normal_menu_entry.d normal_mod-normal_misc.d normal_mod-grub_script_tab.d normal_mod-normal_script.d normal_mod-normal_i386_setjmp.d +CLEANFILES += normal.mod mod-normal.o mod-normal.c pre-normal.o normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_completion.o normal_mod-normal_context.o normal_mod-normal_execute.o normal_mod-normal_function.o normal_mod-normal_lexer.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_menu_entry.o normal_mod-normal_misc.o normal_mod-grub_script_tab.o normal_mod-normal_script.o normal_mod-normal_i386_setjmp.o und-normal.lst +ifneq ($(normal_mod_EXPORTS),no) +CLEANFILES += def-normal.lst DEFSYMFILES += def-normal.lst +endif +MOSTLYCLEANFILES += normal_mod-normal_arg.d normal_mod-normal_cmdline.d normal_mod-normal_command.d normal_mod-normal_completion.d normal_mod-normal_context.d normal_mod-normal_execute.d normal_mod-normal_function.d normal_mod-normal_lexer.d normal_mod-normal_main.d normal_mod-normal_menu.d normal_mod-normal_menu_entry.d normal_mod-normal_misc.d normal_mod-grub_script_tab.d normal_mod-normal_script.d normal_mod-normal_i386_setjmp.d UNDSYMFILES += und-normal.lst normal.mod: pre-normal.o mod-normal.o @@ -1602,8 +1625,10 @@ mod-normal.o: mod-normal.c mod-normal.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'normal' $< > $@ || (rm -f $@; exit 1) +ifneq ($(normal_mod_EXPORTS),no) def-normal.lst: pre-normal.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 normal/' > $@ +endif und-normal.lst: pre-normal.o echo 'normal' > $@ @@ -1900,9 +1925,12 @@ normal_mod_LDFLAGS = $(COMMON_LDFLAGS) # For reboot.mod. reboot_mod_SOURCES = commands/i386/pc/reboot.c -CLEANFILES += reboot.mod mod-reboot.o mod-reboot.c pre-reboot.o reboot_mod-commands_i386_pc_reboot.o def-reboot.lst und-reboot.lst -MOSTLYCLEANFILES += reboot_mod-commands_i386_pc_reboot.d +CLEANFILES += reboot.mod mod-reboot.o mod-reboot.c pre-reboot.o reboot_mod-commands_i386_pc_reboot.o und-reboot.lst +ifneq ($(reboot_mod_EXPORTS),no) +CLEANFILES += def-reboot.lst DEFSYMFILES += def-reboot.lst +endif +MOSTLYCLEANFILES += reboot_mod-commands_i386_pc_reboot.d UNDSYMFILES += und-reboot.lst reboot.mod: pre-reboot.o mod-reboot.o @@ -1920,8 +1948,10 @@ mod-reboot.o: mod-reboot.c mod-reboot.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'reboot' $< > $@ || (rm -f $@; exit 1) +ifneq ($(reboot_mod_EXPORTS),no) def-reboot.lst: pre-reboot.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 reboot/' > $@ +endif und-reboot.lst: pre-reboot.o echo 'reboot' > $@ @@ -1951,9 +1981,12 @@ reboot_mod_LDFLAGS = $(COMMON_LDFLAGS) # For halt.mod. halt_mod_SOURCES = commands/i386/pc/halt.c -CLEANFILES += halt.mod mod-halt.o mod-halt.c pre-halt.o halt_mod-commands_i386_pc_halt.o def-halt.lst und-halt.lst -MOSTLYCLEANFILES += halt_mod-commands_i386_pc_halt.d +CLEANFILES += halt.mod mod-halt.o mod-halt.c pre-halt.o halt_mod-commands_i386_pc_halt.o und-halt.lst +ifneq ($(halt_mod_EXPORTS),no) +CLEANFILES += def-halt.lst DEFSYMFILES += def-halt.lst +endif +MOSTLYCLEANFILES += halt_mod-commands_i386_pc_halt.d UNDSYMFILES += und-halt.lst halt.mod: pre-halt.o mod-halt.o @@ -1971,8 +2004,10 @@ mod-halt.o: mod-halt.c mod-halt.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'halt' $< > $@ || (rm -f $@; exit 1) +ifneq ($(halt_mod_EXPORTS),no) def-halt.lst: pre-halt.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 halt/' > $@ +endif und-halt.lst: pre-halt.o echo 'halt' > $@ @@ -2007,9 +2042,12 @@ serial_mod_LDFLAGS = $(COMMON_LDFLAGS) # For _multiboot.mod. _multiboot_mod_SOURCES = loader/i386/pc/multiboot.c -CLEANFILES += _multiboot.mod mod-_multiboot.o mod-_multiboot.c pre-_multiboot.o _multiboot_mod-loader_i386_pc_multiboot.o def-_multiboot.lst und-_multiboot.lst -MOSTLYCLEANFILES += _multiboot_mod-loader_i386_pc_multiboot.d +CLEANFILES += _multiboot.mod mod-_multiboot.o mod-_multiboot.c pre-_multiboot.o _multiboot_mod-loader_i386_pc_multiboot.o und-_multiboot.lst +ifneq ($(_multiboot_mod_EXPORTS),no) +CLEANFILES += def-_multiboot.lst DEFSYMFILES += def-_multiboot.lst +endif +MOSTLYCLEANFILES += _multiboot_mod-loader_i386_pc_multiboot.d UNDSYMFILES += und-_multiboot.lst _multiboot.mod: pre-_multiboot.o mod-_multiboot.o @@ -2027,8 +2065,10 @@ mod-_multiboot.o: mod-_multiboot.c mod-_multiboot.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh '_multiboot' $< > $@ || (rm -f $@; exit 1) +ifneq ($(_multiboot_mod_EXPORTS),no) def-_multiboot.lst: pre-_multiboot.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 _multiboot/' > $@ +endif und-_multiboot.lst: pre-_multiboot.o echo '_multiboot' > $@ @@ -2058,9 +2098,12 @@ _multiboot_mod_LDFLAGS = $(COMMON_LDFLAGS) # For multiboot.mod. multiboot_mod_SOURCES = loader/i386/pc/multiboot_normal.c -CLEANFILES += multiboot.mod mod-multiboot.o mod-multiboot.c pre-multiboot.o multiboot_mod-loader_i386_pc_multiboot_normal.o def-multiboot.lst und-multiboot.lst -MOSTLYCLEANFILES += multiboot_mod-loader_i386_pc_multiboot_normal.d +CLEANFILES += multiboot.mod mod-multiboot.o mod-multiboot.c pre-multiboot.o multiboot_mod-loader_i386_pc_multiboot_normal.o und-multiboot.lst +ifneq ($(multiboot_mod_EXPORTS),no) +CLEANFILES += def-multiboot.lst DEFSYMFILES += def-multiboot.lst +endif +MOSTLYCLEANFILES += multiboot_mod-loader_i386_pc_multiboot_normal.d UNDSYMFILES += und-multiboot.lst multiboot.mod: pre-multiboot.o mod-multiboot.o @@ -2078,8 +2121,10 @@ mod-multiboot.o: mod-multiboot.c mod-multiboot.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'multiboot' $< > $@ || (rm -f $@; exit 1) +ifneq ($(multiboot_mod_EXPORTS),no) def-multiboot.lst: pre-multiboot.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 multiboot/' > $@ +endif und-multiboot.lst: pre-multiboot.o echo 'multiboot' > $@ @@ -2110,9 +2155,12 @@ multiboot_mod_LDFLAGS = $(COMMON_LDFLAGS) # For vbe.mod. vbe_mod_SOURCES = video/i386/pc/vbe.c video/i386/pc/vbeblit.c \ video/i386/pc/vbefill.c -CLEANFILES += vbe.mod mod-vbe.o mod-vbe.c pre-vbe.o vbe_mod-video_i386_pc_vbe.o vbe_mod-video_i386_pc_vbeblit.o vbe_mod-video_i386_pc_vbefill.o def-vbe.lst und-vbe.lst -MOSTLYCLEANFILES += vbe_mod-video_i386_pc_vbe.d vbe_mod-video_i386_pc_vbeblit.d vbe_mod-video_i386_pc_vbefill.d +CLEANFILES += vbe.mod mod-vbe.o mod-vbe.c pre-vbe.o vbe_mod-video_i386_pc_vbe.o vbe_mod-video_i386_pc_vbeblit.o vbe_mod-video_i386_pc_vbefill.o und-vbe.lst +ifneq ($(vbe_mod_EXPORTS),no) +CLEANFILES += def-vbe.lst DEFSYMFILES += def-vbe.lst +endif +MOSTLYCLEANFILES += vbe_mod-video_i386_pc_vbe.d vbe_mod-video_i386_pc_vbeblit.d vbe_mod-video_i386_pc_vbefill.d UNDSYMFILES += und-vbe.lst vbe.mod: pre-vbe.o mod-vbe.o @@ -2130,8 +2178,10 @@ mod-vbe.o: mod-vbe.c mod-vbe.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'vbe' $< > $@ || (rm -f $@; exit 1) +ifneq ($(vbe_mod_EXPORTS),no) def-vbe.lst: pre-vbe.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 vbe/' > $@ +endif und-vbe.lst: pre-vbe.o echo 'vbe' > $@ @@ -2199,9 +2249,12 @@ vbe_mod_LDFLAGS = $(COMMON_LDFLAGS) # For vbeinfo.mod. vbeinfo_mod_SOURCES = commands/i386/pc/vbeinfo.c -CLEANFILES += vbeinfo.mod mod-vbeinfo.o mod-vbeinfo.c pre-vbeinfo.o vbeinfo_mod-commands_i386_pc_vbeinfo.o def-vbeinfo.lst und-vbeinfo.lst -MOSTLYCLEANFILES += vbeinfo_mod-commands_i386_pc_vbeinfo.d +CLEANFILES += vbeinfo.mod mod-vbeinfo.o mod-vbeinfo.c pre-vbeinfo.o vbeinfo_mod-commands_i386_pc_vbeinfo.o und-vbeinfo.lst +ifneq ($(vbeinfo_mod_EXPORTS),no) +CLEANFILES += def-vbeinfo.lst DEFSYMFILES += def-vbeinfo.lst +endif +MOSTLYCLEANFILES += vbeinfo_mod-commands_i386_pc_vbeinfo.d UNDSYMFILES += und-vbeinfo.lst vbeinfo.mod: pre-vbeinfo.o mod-vbeinfo.o @@ -2219,8 +2272,10 @@ mod-vbeinfo.o: mod-vbeinfo.c mod-vbeinfo.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'vbeinfo' $< > $@ || (rm -f $@; exit 1) +ifneq ($(vbeinfo_mod_EXPORTS),no) def-vbeinfo.lst: pre-vbeinfo.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 vbeinfo/' > $@ +endif und-vbeinfo.lst: pre-vbeinfo.o echo 'vbeinfo' > $@ @@ -2250,9 +2305,12 @@ vbeinfo_mod_LDFLAGS = $(COMMON_LDFLAGS) # For vbetest.mod. vbetest_mod_SOURCES = commands/i386/pc/vbetest.c -CLEANFILES += vbetest.mod mod-vbetest.o mod-vbetest.c pre-vbetest.o vbetest_mod-commands_i386_pc_vbetest.o def-vbetest.lst und-vbetest.lst -MOSTLYCLEANFILES += vbetest_mod-commands_i386_pc_vbetest.d +CLEANFILES += vbetest.mod mod-vbetest.o mod-vbetest.c pre-vbetest.o vbetest_mod-commands_i386_pc_vbetest.o und-vbetest.lst +ifneq ($(vbetest_mod_EXPORTS),no) +CLEANFILES += def-vbetest.lst DEFSYMFILES += def-vbetest.lst +endif +MOSTLYCLEANFILES += vbetest_mod-commands_i386_pc_vbetest.d UNDSYMFILES += und-vbetest.lst vbetest.mod: pre-vbetest.o mod-vbetest.o @@ -2270,8 +2328,10 @@ mod-vbetest.o: mod-vbetest.c mod-vbetest.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'vbetest' $< > $@ || (rm -f $@; exit 1) +ifneq ($(vbetest_mod_EXPORTS),no) def-vbetest.lst: pre-vbetest.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 vbetest/' > $@ +endif und-vbetest.lst: pre-vbetest.o echo 'vbetest' > $@ @@ -2301,9 +2361,12 @@ vbetest_mod_LDFLAGS = $(COMMON_LDFLAGS) # For play.mod. play_mod_SOURCES = commands/i386/pc/play.c -CLEANFILES += play.mod mod-play.o mod-play.c pre-play.o play_mod-commands_i386_pc_play.o def-play.lst und-play.lst -MOSTLYCLEANFILES += play_mod-commands_i386_pc_play.d +CLEANFILES += play.mod mod-play.o mod-play.c pre-play.o play_mod-commands_i386_pc_play.o und-play.lst +ifneq ($(play_mod_EXPORTS),no) +CLEANFILES += def-play.lst DEFSYMFILES += def-play.lst +endif +MOSTLYCLEANFILES += play_mod-commands_i386_pc_play.d UNDSYMFILES += und-play.lst play.mod: pre-play.o mod-play.o @@ -2321,8 +2384,10 @@ mod-play.o: mod-play.c mod-play.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'play' $< > $@ || (rm -f $@; exit 1) +ifneq ($(play_mod_EXPORTS),no) def-play.lst: pre-play.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 play/' > $@ +endif und-play.lst: pre-play.o echo 'play' > $@ @@ -2352,9 +2417,12 @@ play_mod_LDFLAGS = $(COMMON_LDFLAGS) # For video.mod. video_mod_SOURCES = video/video.c -CLEANFILES += video.mod mod-video.o mod-video.c pre-video.o video_mod-video_video.o def-video.lst und-video.lst -MOSTLYCLEANFILES += video_mod-video_video.d +CLEANFILES += video.mod mod-video.o mod-video.c pre-video.o video_mod-video_video.o und-video.lst +ifneq ($(video_mod_EXPORTS),no) +CLEANFILES += def-video.lst DEFSYMFILES += def-video.lst +endif +MOSTLYCLEANFILES += video_mod-video_video.d UNDSYMFILES += und-video.lst video.mod: pre-video.o mod-video.o @@ -2372,8 +2440,10 @@ mod-video.o: mod-video.c mod-video.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'video' $< > $@ || (rm -f $@; exit 1) +ifneq ($(video_mod_EXPORTS),no) def-video.lst: pre-video.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 video/' > $@ +endif und-video.lst: pre-video.o echo 'video' > $@ @@ -2403,9 +2473,12 @@ video_mod_LDFLAGS = $(COMMON_LDFLAGS) # For gfxterm.mod. gfxterm_mod_SOURCES = term/gfxterm.c -CLEANFILES += gfxterm.mod mod-gfxterm.o mod-gfxterm.c pre-gfxterm.o gfxterm_mod-term_gfxterm.o def-gfxterm.lst und-gfxterm.lst -MOSTLYCLEANFILES += gfxterm_mod-term_gfxterm.d +CLEANFILES += gfxterm.mod mod-gfxterm.o mod-gfxterm.c pre-gfxterm.o gfxterm_mod-term_gfxterm.o und-gfxterm.lst +ifneq ($(gfxterm_mod_EXPORTS),no) +CLEANFILES += def-gfxterm.lst DEFSYMFILES += def-gfxterm.lst +endif +MOSTLYCLEANFILES += gfxterm_mod-term_gfxterm.d UNDSYMFILES += und-gfxterm.lst gfxterm.mod: pre-gfxterm.o mod-gfxterm.o @@ -2423,8 +2496,10 @@ mod-gfxterm.o: mod-gfxterm.c mod-gfxterm.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'gfxterm' $< > $@ || (rm -f $@; exit 1) +ifneq ($(gfxterm_mod_EXPORTS),no) def-gfxterm.lst: pre-gfxterm.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 gfxterm/' > $@ +endif und-gfxterm.lst: pre-gfxterm.o echo 'gfxterm' > $@ @@ -2454,9 +2529,12 @@ gfxterm_mod_LDFLAGS = $(COMMON_LDFLAGS) # For videotest.mod. videotest_mod_SOURCES = commands/videotest.c -CLEANFILES += videotest.mod mod-videotest.o mod-videotest.c pre-videotest.o videotest_mod-commands_videotest.o def-videotest.lst und-videotest.lst -MOSTLYCLEANFILES += videotest_mod-commands_videotest.d +CLEANFILES += videotest.mod mod-videotest.o mod-videotest.c pre-videotest.o videotest_mod-commands_videotest.o und-videotest.lst +ifneq ($(videotest_mod_EXPORTS),no) +CLEANFILES += def-videotest.lst DEFSYMFILES += def-videotest.lst +endif +MOSTLYCLEANFILES += videotest_mod-commands_videotest.d UNDSYMFILES += und-videotest.lst videotest.mod: pre-videotest.o mod-videotest.o @@ -2474,8 +2552,10 @@ mod-videotest.o: mod-videotest.c mod-videotest.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'videotest' $< > $@ || (rm -f $@; exit 1) +ifneq ($(videotest_mod_EXPORTS),no) def-videotest.lst: pre-videotest.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 videotest/' > $@ +endif und-videotest.lst: pre-videotest.o echo 'videotest' > $@ diff --git a/conf/powerpc-ieee1275.mk b/conf/powerpc-ieee1275.mk index 5ba5ba692..9727a8c55 100644 --- a/conf/powerpc-ieee1275.mk +++ b/conf/powerpc-ieee1275.mk @@ -888,9 +888,12 @@ pkgdata_MODULES = halt.mod \ # For _linux.mod. _linux_mod_SOURCES = loader/powerpc/ieee1275/linux.c -CLEANFILES += _linux.mod mod-_linux.o mod-_linux.c pre-_linux.o _linux_mod-loader_powerpc_ieee1275_linux.o def-_linux.lst und-_linux.lst -MOSTLYCLEANFILES += _linux_mod-loader_powerpc_ieee1275_linux.d +CLEANFILES += _linux.mod mod-_linux.o mod-_linux.c pre-_linux.o _linux_mod-loader_powerpc_ieee1275_linux.o und-_linux.lst +ifneq ($(_linux_mod_EXPORTS),no) +CLEANFILES += def-_linux.lst DEFSYMFILES += def-_linux.lst +endif +MOSTLYCLEANFILES += _linux_mod-loader_powerpc_ieee1275_linux.d UNDSYMFILES += und-_linux.lst _linux.mod: pre-_linux.o mod-_linux.o @@ -908,8 +911,10 @@ mod-_linux.o: mod-_linux.c mod-_linux.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh '_linux' $< > $@ || (rm -f $@; exit 1) +ifneq ($(_linux_mod_EXPORTS),no) def-_linux.lst: pre-_linux.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 _linux/' > $@ +endif und-_linux.lst: pre-_linux.o echo '_linux' > $@ @@ -938,9 +943,12 @@ _linux_mod_CFLAGS = $(COMMON_CFLAGS) # For linux.mod. linux_mod_SOURCES = loader/powerpc/ieee1275/linux_normal.c -CLEANFILES += linux.mod mod-linux.o mod-linux.c pre-linux.o linux_mod-loader_powerpc_ieee1275_linux_normal.o def-linux.lst und-linux.lst -MOSTLYCLEANFILES += linux_mod-loader_powerpc_ieee1275_linux_normal.d +CLEANFILES += linux.mod mod-linux.o mod-linux.c pre-linux.o linux_mod-loader_powerpc_ieee1275_linux_normal.o und-linux.lst +ifneq ($(linux_mod_EXPORTS),no) +CLEANFILES += def-linux.lst DEFSYMFILES += def-linux.lst +endif +MOSTLYCLEANFILES += linux_mod-loader_powerpc_ieee1275_linux_normal.d UNDSYMFILES += und-linux.lst linux.mod: pre-linux.o mod-linux.o @@ -958,8 +966,10 @@ mod-linux.o: mod-linux.c mod-linux.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'linux' $< > $@ || (rm -f $@; exit 1) +ifneq ($(linux_mod_EXPORTS),no) def-linux.lst: pre-linux.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 linux/' > $@ +endif und-linux.lst: pre-linux.o echo 'linux' > $@ @@ -992,9 +1002,12 @@ normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c \ normal/function.c normal/lexer.c normal/main.c normal/menu.c \ normal/menu_entry.c normal/misc.c grub_script.tab.c \ normal/script.c normal/powerpc/setjmp.S -CLEANFILES += normal.mod mod-normal.o mod-normal.c pre-normal.o normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_completion.o normal_mod-normal_context.o normal_mod-normal_execute.o normal_mod-normal_function.o normal_mod-normal_lexer.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_menu_entry.o normal_mod-normal_misc.o normal_mod-grub_script_tab.o normal_mod-normal_script.o normal_mod-normal_powerpc_setjmp.o def-normal.lst und-normal.lst -MOSTLYCLEANFILES += normal_mod-normal_arg.d normal_mod-normal_cmdline.d normal_mod-normal_command.d normal_mod-normal_completion.d normal_mod-normal_context.d normal_mod-normal_execute.d normal_mod-normal_function.d normal_mod-normal_lexer.d normal_mod-normal_main.d normal_mod-normal_menu.d normal_mod-normal_menu_entry.d normal_mod-normal_misc.d normal_mod-grub_script_tab.d normal_mod-normal_script.d normal_mod-normal_powerpc_setjmp.d +CLEANFILES += normal.mod mod-normal.o mod-normal.c pre-normal.o normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_completion.o normal_mod-normal_context.o normal_mod-normal_execute.o normal_mod-normal_function.o normal_mod-normal_lexer.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_menu_entry.o normal_mod-normal_misc.o normal_mod-grub_script_tab.o normal_mod-normal_script.o normal_mod-normal_powerpc_setjmp.o und-normal.lst +ifneq ($(normal_mod_EXPORTS),no) +CLEANFILES += def-normal.lst DEFSYMFILES += def-normal.lst +endif +MOSTLYCLEANFILES += normal_mod-normal_arg.d normal_mod-normal_cmdline.d normal_mod-normal_command.d normal_mod-normal_completion.d normal_mod-normal_context.d normal_mod-normal_execute.d normal_mod-normal_function.d normal_mod-normal_lexer.d normal_mod-normal_main.d normal_mod-normal_menu.d normal_mod-normal_menu_entry.d normal_mod-normal_misc.d normal_mod-grub_script_tab.d normal_mod-normal_script.d normal_mod-normal_powerpc_setjmp.d UNDSYMFILES += und-normal.lst normal.mod: pre-normal.o mod-normal.o @@ -1012,8 +1025,10 @@ mod-normal.o: mod-normal.c mod-normal.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'normal' $< > $@ || (rm -f $@; exit 1) +ifneq ($(normal_mod_EXPORTS),no) def-normal.lst: pre-normal.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 normal/' > $@ +endif und-normal.lst: pre-normal.o echo 'normal' > $@ @@ -1309,9 +1324,12 @@ normal_mod_ASFLAGS = $(COMMON_ASFLAGS) # For suspend.mod suspend_mod_SOURCES = commands/ieee1275/suspend.c -CLEANFILES += suspend.mod mod-suspend.o mod-suspend.c pre-suspend.o suspend_mod-commands_ieee1275_suspend.o def-suspend.lst und-suspend.lst -MOSTLYCLEANFILES += suspend_mod-commands_ieee1275_suspend.d +CLEANFILES += suspend.mod mod-suspend.o mod-suspend.c pre-suspend.o suspend_mod-commands_ieee1275_suspend.o und-suspend.lst +ifneq ($(suspend_mod_EXPORTS),no) +CLEANFILES += def-suspend.lst DEFSYMFILES += def-suspend.lst +endif +MOSTLYCLEANFILES += suspend_mod-commands_ieee1275_suspend.d UNDSYMFILES += und-suspend.lst suspend.mod: pre-suspend.o mod-suspend.o @@ -1329,8 +1347,10 @@ mod-suspend.o: mod-suspend.c mod-suspend.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'suspend' $< > $@ || (rm -f $@; exit 1) +ifneq ($(suspend_mod_EXPORTS),no) def-suspend.lst: pre-suspend.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 suspend/' > $@ +endif und-suspend.lst: pre-suspend.o echo 'suspend' > $@ @@ -1359,9 +1379,12 @@ suspend_mod_CFLAGS = $(COMMON_CFLAGS) # For reboot.mod reboot_mod_SOURCES = commands/ieee1275/reboot.c -CLEANFILES += reboot.mod mod-reboot.o mod-reboot.c pre-reboot.o reboot_mod-commands_ieee1275_reboot.o def-reboot.lst und-reboot.lst -MOSTLYCLEANFILES += reboot_mod-commands_ieee1275_reboot.d +CLEANFILES += reboot.mod mod-reboot.o mod-reboot.c pre-reboot.o reboot_mod-commands_ieee1275_reboot.o und-reboot.lst +ifneq ($(reboot_mod_EXPORTS),no) +CLEANFILES += def-reboot.lst DEFSYMFILES += def-reboot.lst +endif +MOSTLYCLEANFILES += reboot_mod-commands_ieee1275_reboot.d UNDSYMFILES += und-reboot.lst reboot.mod: pre-reboot.o mod-reboot.o @@ -1379,8 +1402,10 @@ mod-reboot.o: mod-reboot.c mod-reboot.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'reboot' $< > $@ || (rm -f $@; exit 1) +ifneq ($(reboot_mod_EXPORTS),no) def-reboot.lst: pre-reboot.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 reboot/' > $@ +endif und-reboot.lst: pre-reboot.o echo 'reboot' > $@ @@ -1409,9 +1434,12 @@ reboot_mod_CFLAGS = $(COMMON_CFLAGS) # For halt.mod halt_mod_SOURCES = commands/ieee1275/halt.c -CLEANFILES += halt.mod mod-halt.o mod-halt.c pre-halt.o halt_mod-commands_ieee1275_halt.o def-halt.lst und-halt.lst -MOSTLYCLEANFILES += halt_mod-commands_ieee1275_halt.d +CLEANFILES += halt.mod mod-halt.o mod-halt.c pre-halt.o halt_mod-commands_ieee1275_halt.o und-halt.lst +ifneq ($(halt_mod_EXPORTS),no) +CLEANFILES += def-halt.lst DEFSYMFILES += def-halt.lst +endif +MOSTLYCLEANFILES += halt_mod-commands_ieee1275_halt.d UNDSYMFILES += und-halt.lst halt.mod: pre-halt.o mod-halt.o @@ -1429,8 +1457,10 @@ mod-halt.o: mod-halt.c mod-halt.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'halt' $< > $@ || (rm -f $@; exit 1) +ifneq ($(halt_mod_EXPORTS),no) def-halt.lst: pre-halt.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 halt/' > $@ +endif und-halt.lst: pre-halt.o echo 'halt' > $@ diff --git a/conf/sparc64-ieee1275.mk b/conf/sparc64-ieee1275.mk index ef1d4127f..e1fef81b5 100644 --- a/conf/sparc64-ieee1275.mk +++ b/conf/sparc64-ieee1275.mk @@ -293,9 +293,12 @@ pkgdata_MODULES = fat.mod ufs.mod ext2.mod minix.mod \ # For fshelp.mod. fshelp_mod_SOURCES = fs/fshelp.c -CLEANFILES += fshelp.mod mod-fshelp.o mod-fshelp.c pre-fshelp.o fshelp_mod-fs_fshelp.o def-fshelp.lst und-fshelp.lst -MOSTLYCLEANFILES += fshelp_mod-fs_fshelp.d +CLEANFILES += fshelp.mod mod-fshelp.o mod-fshelp.c pre-fshelp.o fshelp_mod-fs_fshelp.o und-fshelp.lst +ifneq ($(fshelp_mod_EXPORTS),no) +CLEANFILES += def-fshelp.lst DEFSYMFILES += def-fshelp.lst +endif +MOSTLYCLEANFILES += fshelp_mod-fs_fshelp.d UNDSYMFILES += und-fshelp.lst fshelp.mod: pre-fshelp.o mod-fshelp.o @@ -313,8 +316,10 @@ mod-fshelp.o: mod-fshelp.c mod-fshelp.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'fshelp' $< > $@ || (rm -f $@; exit 1) +ifneq ($(fshelp_mod_EXPORTS),no) def-fshelp.lst: pre-fshelp.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 fshelp/' > $@ +endif und-fshelp.lst: pre-fshelp.o echo 'fshelp' > $@ @@ -344,9 +349,12 @@ fshelp_mod_LDFLAGS = $(COMMON_LDFLAGS) # For fat.mod. fat_mod_SOURCES = fs/fat.c -CLEANFILES += fat.mod mod-fat.o mod-fat.c pre-fat.o fat_mod-fs_fat.o def-fat.lst und-fat.lst -MOSTLYCLEANFILES += fat_mod-fs_fat.d +CLEANFILES += fat.mod mod-fat.o mod-fat.c pre-fat.o fat_mod-fs_fat.o und-fat.lst +ifneq ($(fat_mod_EXPORTS),no) +CLEANFILES += def-fat.lst DEFSYMFILES += def-fat.lst +endif +MOSTLYCLEANFILES += fat_mod-fs_fat.d UNDSYMFILES += und-fat.lst fat.mod: pre-fat.o mod-fat.o @@ -364,8 +372,10 @@ mod-fat.o: mod-fat.c mod-fat.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'fat' $< > $@ || (rm -f $@; exit 1) +ifneq ($(fat_mod_EXPORTS),no) def-fat.lst: pre-fat.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 fat/' > $@ +endif und-fat.lst: pre-fat.o echo 'fat' > $@ @@ -395,9 +405,12 @@ fat_mod_LDFLAGS = $(COMMON_LDFLAGS) # For ext2.mod. ext2_mod_SOURCES = fs/ext2.c -CLEANFILES += ext2.mod mod-ext2.o mod-ext2.c pre-ext2.o ext2_mod-fs_ext2.o def-ext2.lst und-ext2.lst -MOSTLYCLEANFILES += ext2_mod-fs_ext2.d +CLEANFILES += ext2.mod mod-ext2.o mod-ext2.c pre-ext2.o ext2_mod-fs_ext2.o und-ext2.lst +ifneq ($(ext2_mod_EXPORTS),no) +CLEANFILES += def-ext2.lst DEFSYMFILES += def-ext2.lst +endif +MOSTLYCLEANFILES += ext2_mod-fs_ext2.d UNDSYMFILES += und-ext2.lst ext2.mod: pre-ext2.o mod-ext2.o @@ -415,8 +428,10 @@ mod-ext2.o: mod-ext2.c mod-ext2.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'ext2' $< > $@ || (rm -f $@; exit 1) +ifneq ($(ext2_mod_EXPORTS),no) def-ext2.lst: pre-ext2.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 ext2/' > $@ +endif und-ext2.lst: pre-ext2.o echo 'ext2' > $@ @@ -446,9 +461,12 @@ ext2_mod_LDFLAGS = $(COMMON_LDFLAGS) # For ufs.mod. ufs_mod_SOURCES = fs/ufs.c -CLEANFILES += ufs.mod mod-ufs.o mod-ufs.c pre-ufs.o ufs_mod-fs_ufs.o def-ufs.lst und-ufs.lst -MOSTLYCLEANFILES += ufs_mod-fs_ufs.d +CLEANFILES += ufs.mod mod-ufs.o mod-ufs.c pre-ufs.o ufs_mod-fs_ufs.o und-ufs.lst +ifneq ($(ufs_mod_EXPORTS),no) +CLEANFILES += def-ufs.lst DEFSYMFILES += def-ufs.lst +endif +MOSTLYCLEANFILES += ufs_mod-fs_ufs.d UNDSYMFILES += und-ufs.lst ufs.mod: pre-ufs.o mod-ufs.o @@ -466,8 +484,10 @@ mod-ufs.o: mod-ufs.c mod-ufs.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'ufs' $< > $@ || (rm -f $@; exit 1) +ifneq ($(ufs_mod_EXPORTS),no) def-ufs.lst: pre-ufs.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 ufs/' > $@ +endif und-ufs.lst: pre-ufs.o echo 'ufs' > $@ @@ -497,9 +517,12 @@ ufs_mod_LDFLAGS = $(COMMON_LDFLAGS) # For minix.mod. minix_mod_SOURCES = fs/minix.c -CLEANFILES += minix.mod mod-minix.o mod-minix.c pre-minix.o minix_mod-fs_minix.o def-minix.lst und-minix.lst -MOSTLYCLEANFILES += minix_mod-fs_minix.d +CLEANFILES += minix.mod mod-minix.o mod-minix.c pre-minix.o minix_mod-fs_minix.o und-minix.lst +ifneq ($(minix_mod_EXPORTS),no) +CLEANFILES += def-minix.lst DEFSYMFILES += def-minix.lst +endif +MOSTLYCLEANFILES += minix_mod-fs_minix.d UNDSYMFILES += und-minix.lst minix.mod: pre-minix.o mod-minix.o @@ -517,8 +540,10 @@ mod-minix.o: mod-minix.c mod-minix.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'minix' $< > $@ || (rm -f $@; exit 1) +ifneq ($(minix_mod_EXPORTS),no) def-minix.lst: pre-minix.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 minix/' > $@ +endif und-minix.lst: pre-minix.o echo 'minix' > $@ @@ -548,9 +573,12 @@ minix_mod_LDFLAGS = $(COMMON_LDFLAGS) # For hfs.mod. hfs_mod_SOURCES = fs/hfs.c -CLEANFILES += hfs.mod mod-hfs.o mod-hfs.c pre-hfs.o hfs_mod-fs_hfs.o def-hfs.lst und-hfs.lst -MOSTLYCLEANFILES += hfs_mod-fs_hfs.d +CLEANFILES += hfs.mod mod-hfs.o mod-hfs.c pre-hfs.o hfs_mod-fs_hfs.o und-hfs.lst +ifneq ($(hfs_mod_EXPORTS),no) +CLEANFILES += def-hfs.lst DEFSYMFILES += def-hfs.lst +endif +MOSTLYCLEANFILES += hfs_mod-fs_hfs.d UNDSYMFILES += und-hfs.lst hfs.mod: pre-hfs.o mod-hfs.o @@ -568,8 +596,10 @@ mod-hfs.o: mod-hfs.c mod-hfs.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'hfs' $< > $@ || (rm -f $@; exit 1) +ifneq ($(hfs_mod_EXPORTS),no) def-hfs.lst: pre-hfs.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 hfs/' > $@ +endif und-hfs.lst: pre-hfs.o echo 'hfs' > $@ @@ -599,9 +629,12 @@ hfs_mod_LDFLAGS = $(COMMON_LDFLAGS) # For jfs.mod. jfs_mod_SOURCES = fs/jfs.c -CLEANFILES += jfs.mod mod-jfs.o mod-jfs.c pre-jfs.o jfs_mod-fs_jfs.o def-jfs.lst und-jfs.lst -MOSTLYCLEANFILES += jfs_mod-fs_jfs.d +CLEANFILES += jfs.mod mod-jfs.o mod-jfs.c pre-jfs.o jfs_mod-fs_jfs.o und-jfs.lst +ifneq ($(jfs_mod_EXPORTS),no) +CLEANFILES += def-jfs.lst DEFSYMFILES += def-jfs.lst +endif +MOSTLYCLEANFILES += jfs_mod-fs_jfs.d UNDSYMFILES += und-jfs.lst jfs.mod: pre-jfs.o mod-jfs.o @@ -619,8 +652,10 @@ mod-jfs.o: mod-jfs.c mod-jfs.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'jfs' $< > $@ || (rm -f $@; exit 1) +ifneq ($(jfs_mod_EXPORTS),no) def-jfs.lst: pre-jfs.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 jfs/' > $@ +endif und-jfs.lst: pre-jfs.o echo 'jfs' > $@ @@ -655,9 +690,12 @@ iso9660_mod_LDFLAGS = $(COMMON_LDFLAGS) # For xfs.mod. xfs_mod_SOURCES = fs/xfs.c -CLEANFILES += xfs.mod mod-xfs.o mod-xfs.c pre-xfs.o xfs_mod-fs_xfs.o def-xfs.lst und-xfs.lst -MOSTLYCLEANFILES += xfs_mod-fs_xfs.d +CLEANFILES += xfs.mod mod-xfs.o mod-xfs.c pre-xfs.o xfs_mod-fs_xfs.o und-xfs.lst +ifneq ($(xfs_mod_EXPORTS),no) +CLEANFILES += def-xfs.lst DEFSYMFILES += def-xfs.lst +endif +MOSTLYCLEANFILES += xfs_mod-fs_xfs.d UNDSYMFILES += und-xfs.lst xfs.mod: pre-xfs.o mod-xfs.o @@ -675,8 +713,10 @@ mod-xfs.o: mod-xfs.c mod-xfs.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'xfs' $< > $@ || (rm -f $@; exit 1) +ifneq ($(xfs_mod_EXPORTS),no) def-xfs.lst: pre-xfs.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 xfs/' > $@ +endif und-xfs.lst: pre-xfs.o echo 'xfs' > $@ @@ -706,9 +746,12 @@ xfs_mod_LDFLAGS = $(COMMON_LDFLAGS) # For affs.mod. affs_mod_SOURCES = fs/affs.c -CLEANFILES += affs.mod mod-affs.o mod-affs.c pre-affs.o affs_mod-fs_affs.o def-affs.lst und-affs.lst -MOSTLYCLEANFILES += affs_mod-fs_affs.d +CLEANFILES += affs.mod mod-affs.o mod-affs.c pre-affs.o affs_mod-fs_affs.o und-affs.lst +ifneq ($(affs_mod_EXPORTS),no) +CLEANFILES += def-affs.lst DEFSYMFILES += def-affs.lst +endif +MOSTLYCLEANFILES += affs_mod-fs_affs.d UNDSYMFILES += und-affs.lst affs.mod: pre-affs.o mod-affs.o @@ -726,8 +769,10 @@ mod-affs.o: mod-affs.c mod-affs.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'affs' $< > $@ || (rm -f $@; exit 1) +ifneq ($(affs_mod_EXPORTS),no) def-affs.lst: pre-affs.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 affs/' > $@ +endif und-affs.lst: pre-affs.o echo 'affs' > $@ @@ -757,9 +802,12 @@ affs_mod_LDFLAGS = $(COMMON_LDFLAGS) # For sfs.mod. sfs_mod_SOURCES = fs/sfs.c -CLEANFILES += sfs.mod mod-sfs.o mod-sfs.c pre-sfs.o sfs_mod-fs_sfs.o def-sfs.lst und-sfs.lst -MOSTLYCLEANFILES += sfs_mod-fs_sfs.d +CLEANFILES += sfs.mod mod-sfs.o mod-sfs.c pre-sfs.o sfs_mod-fs_sfs.o und-sfs.lst +ifneq ($(sfs_mod_EXPORTS),no) +CLEANFILES += def-sfs.lst DEFSYMFILES += def-sfs.lst +endif +MOSTLYCLEANFILES += sfs_mod-fs_sfs.d UNDSYMFILES += und-sfs.lst sfs.mod: pre-sfs.o mod-sfs.o @@ -777,8 +825,10 @@ mod-sfs.o: mod-sfs.c mod-sfs.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'sfs' $< > $@ || (rm -f $@; exit 1) +ifneq ($(sfs_mod_EXPORTS),no) def-sfs.lst: pre-sfs.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 sfs/' > $@ +endif und-sfs.lst: pre-sfs.o echo 'sfs' > $@ @@ -823,9 +873,12 @@ normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c \ normal/menu_entry.c normal/misc.c normal/script.c \ normal/sparc64/setjmp.S \ grub_script.tab.c -CLEANFILES += normal.mod mod-normal.o mod-normal.c pre-normal.o normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_completion.o normal_mod-normal_context.o normal_mod-normal_execute.o normal_mod-normal_function.o normal_mod-normal_lexer.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_menu_entry.o normal_mod-normal_misc.o normal_mod-normal_script.o normal_mod-normal_sparc64_setjmp.o normal_mod-grub_script_tab.o def-normal.lst und-normal.lst -MOSTLYCLEANFILES += normal_mod-normal_arg.d normal_mod-normal_cmdline.d normal_mod-normal_command.d normal_mod-normal_completion.d normal_mod-normal_context.d normal_mod-normal_execute.d normal_mod-normal_function.d normal_mod-normal_lexer.d normal_mod-normal_main.d normal_mod-normal_menu.d normal_mod-normal_menu_entry.d normal_mod-normal_misc.d normal_mod-normal_script.d normal_mod-normal_sparc64_setjmp.d normal_mod-grub_script_tab.d +CLEANFILES += normal.mod mod-normal.o mod-normal.c pre-normal.o normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_completion.o normal_mod-normal_context.o normal_mod-normal_execute.o normal_mod-normal_function.o normal_mod-normal_lexer.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_menu_entry.o normal_mod-normal_misc.o normal_mod-normal_script.o normal_mod-normal_sparc64_setjmp.o normal_mod-grub_script_tab.o und-normal.lst +ifneq ($(normal_mod_EXPORTS),no) +CLEANFILES += def-normal.lst DEFSYMFILES += def-normal.lst +endif +MOSTLYCLEANFILES += normal_mod-normal_arg.d normal_mod-normal_cmdline.d normal_mod-normal_command.d normal_mod-normal_completion.d normal_mod-normal_context.d normal_mod-normal_execute.d normal_mod-normal_function.d normal_mod-normal_lexer.d normal_mod-normal_main.d normal_mod-normal_menu.d normal_mod-normal_menu_entry.d normal_mod-normal_misc.d normal_mod-normal_script.d normal_mod-normal_sparc64_setjmp.d normal_mod-grub_script_tab.d UNDSYMFILES += und-normal.lst normal.mod: pre-normal.o mod-normal.o @@ -843,8 +896,10 @@ mod-normal.o: mod-normal.c mod-normal.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'normal' $< > $@ || (rm -f $@; exit 1) +ifneq ($(normal_mod_EXPORTS),no) def-normal.lst: pre-normal.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 normal/' > $@ +endif und-normal.lst: pre-normal.o echo 'normal' > $@ @@ -1141,9 +1196,12 @@ normal_mod_LDFLAGS = $(COMMON_LDFLAGS) # For hello.mod. hello_mod_SOURCES = hello/hello.c -CLEANFILES += hello.mod mod-hello.o mod-hello.c pre-hello.o hello_mod-hello_hello.o def-hello.lst und-hello.lst -MOSTLYCLEANFILES += hello_mod-hello_hello.d +CLEANFILES += hello.mod mod-hello.o mod-hello.c pre-hello.o hello_mod-hello_hello.o und-hello.lst +ifneq ($(hello_mod_EXPORTS),no) +CLEANFILES += def-hello.lst DEFSYMFILES += def-hello.lst +endif +MOSTLYCLEANFILES += hello_mod-hello_hello.d UNDSYMFILES += und-hello.lst hello.mod: pre-hello.o mod-hello.o @@ -1161,8 +1219,10 @@ mod-hello.o: mod-hello.c mod-hello.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'hello' $< > $@ || (rm -f $@; exit 1) +ifneq ($(hello_mod_EXPORTS),no) def-hello.lst: pre-hello.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 hello/' > $@ +endif und-hello.lst: pre-hello.o echo 'hello' > $@ @@ -1192,9 +1252,12 @@ hello_mod_LDFLAGS = $(COMMON_LDFLAGS) # For boot.mod. boot_mod_SOURCES = commands/boot.c -CLEANFILES += boot.mod mod-boot.o mod-boot.c pre-boot.o boot_mod-commands_boot.o def-boot.lst und-boot.lst -MOSTLYCLEANFILES += boot_mod-commands_boot.d +CLEANFILES += boot.mod mod-boot.o mod-boot.c pre-boot.o boot_mod-commands_boot.o und-boot.lst +ifneq ($(boot_mod_EXPORTS),no) +CLEANFILES += def-boot.lst DEFSYMFILES += def-boot.lst +endif +MOSTLYCLEANFILES += boot_mod-commands_boot.d UNDSYMFILES += und-boot.lst boot.mod: pre-boot.o mod-boot.o @@ -1212,8 +1275,10 @@ mod-boot.o: mod-boot.c mod-boot.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'boot' $< > $@ || (rm -f $@; exit 1) +ifneq ($(boot_mod_EXPORTS),no) def-boot.lst: pre-boot.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 boot/' > $@ +endif und-boot.lst: pre-boot.o echo 'boot' > $@ @@ -1243,9 +1308,12 @@ boot_mod_LDFLAGS = $(COMMON_LDFLAGS) # For terminal.mod. terminal_mod_SOURCES = commands/terminal.c -CLEANFILES += terminal.mod mod-terminal.o mod-terminal.c pre-terminal.o terminal_mod-commands_terminal.o def-terminal.lst und-terminal.lst -MOSTLYCLEANFILES += terminal_mod-commands_terminal.d +CLEANFILES += terminal.mod mod-terminal.o mod-terminal.c pre-terminal.o terminal_mod-commands_terminal.o und-terminal.lst +ifneq ($(terminal_mod_EXPORTS),no) +CLEANFILES += def-terminal.lst DEFSYMFILES += def-terminal.lst +endif +MOSTLYCLEANFILES += terminal_mod-commands_terminal.d UNDSYMFILES += und-terminal.lst terminal.mod: pre-terminal.o mod-terminal.o @@ -1263,8 +1331,10 @@ mod-terminal.o: mod-terminal.c mod-terminal.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'terminal' $< > $@ || (rm -f $@; exit 1) +ifneq ($(terminal_mod_EXPORTS),no) def-terminal.lst: pre-terminal.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 terminal/' > $@ +endif und-terminal.lst: pre-terminal.o echo 'terminal' > $@ @@ -1294,9 +1364,12 @@ terminal_mod_LDFLAGS = $(COMMON_LDFLAGS) # For ls.mod. ls_mod_SOURCES = commands/ls.c -CLEANFILES += ls.mod mod-ls.o mod-ls.c pre-ls.o ls_mod-commands_ls.o def-ls.lst und-ls.lst -MOSTLYCLEANFILES += ls_mod-commands_ls.d +CLEANFILES += ls.mod mod-ls.o mod-ls.c pre-ls.o ls_mod-commands_ls.o und-ls.lst +ifneq ($(ls_mod_EXPORTS),no) +CLEANFILES += def-ls.lst DEFSYMFILES += def-ls.lst +endif +MOSTLYCLEANFILES += ls_mod-commands_ls.d UNDSYMFILES += und-ls.lst ls.mod: pre-ls.o mod-ls.o @@ -1314,8 +1387,10 @@ mod-ls.o: mod-ls.c mod-ls.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'ls' $< > $@ || (rm -f $@; exit 1) +ifneq ($(ls_mod_EXPORTS),no) def-ls.lst: pre-ls.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 ls/' > $@ +endif und-ls.lst: pre-ls.o echo 'ls' > $@ @@ -1345,9 +1420,12 @@ ls_mod_LDFLAGS = $(COMMON_LDFLAGS) # For cmp.mod. cmp_mod_SOURCES = commands/cmp.c -CLEANFILES += cmp.mod mod-cmp.o mod-cmp.c pre-cmp.o cmp_mod-commands_cmp.o def-cmp.lst und-cmp.lst -MOSTLYCLEANFILES += cmp_mod-commands_cmp.d +CLEANFILES += cmp.mod mod-cmp.o mod-cmp.c pre-cmp.o cmp_mod-commands_cmp.o und-cmp.lst +ifneq ($(cmp_mod_EXPORTS),no) +CLEANFILES += def-cmp.lst DEFSYMFILES += def-cmp.lst +endif +MOSTLYCLEANFILES += cmp_mod-commands_cmp.d UNDSYMFILES += und-cmp.lst cmp.mod: pre-cmp.o mod-cmp.o @@ -1365,8 +1443,10 @@ mod-cmp.o: mod-cmp.c mod-cmp.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'cmp' $< > $@ || (rm -f $@; exit 1) +ifneq ($(cmp_mod_EXPORTS),no) def-cmp.lst: pre-cmp.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 cmp/' > $@ +endif und-cmp.lst: pre-cmp.o echo 'cmp' > $@ @@ -1396,9 +1476,12 @@ cmp_mod_LDFLAGS = $(COMMON_LDFLAGS) # For cat.mod. cat_mod_SOURCES = commands/cat.c -CLEANFILES += cat.mod mod-cat.o mod-cat.c pre-cat.o cat_mod-commands_cat.o def-cat.lst und-cat.lst -MOSTLYCLEANFILES += cat_mod-commands_cat.d +CLEANFILES += cat.mod mod-cat.o mod-cat.c pre-cat.o cat_mod-commands_cat.o und-cat.lst +ifneq ($(cat_mod_EXPORTS),no) +CLEANFILES += def-cat.lst DEFSYMFILES += def-cat.lst +endif +MOSTLYCLEANFILES += cat_mod-commands_cat.d UNDSYMFILES += und-cat.lst cat.mod: pre-cat.o mod-cat.o @@ -1416,8 +1499,10 @@ mod-cat.o: mod-cat.c mod-cat.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'cat' $< > $@ || (rm -f $@; exit 1) +ifneq ($(cat_mod_EXPORTS),no) def-cat.lst: pre-cat.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 cat/' > $@ +endif und-cat.lst: pre-cat.o echo 'cat' > $@ @@ -1447,9 +1532,12 @@ cat_mod_LDFLAGS = $(COMMON_LDFLAGS) # For font.mod. font_mod_SOURCES = font/manager.c -CLEANFILES += font.mod mod-font.o mod-font.c pre-font.o font_mod-font_manager.o def-font.lst und-font.lst -MOSTLYCLEANFILES += font_mod-font_manager.d +CLEANFILES += font.mod mod-font.o mod-font.c pre-font.o font_mod-font_manager.o und-font.lst +ifneq ($(font_mod_EXPORTS),no) +CLEANFILES += def-font.lst DEFSYMFILES += def-font.lst +endif +MOSTLYCLEANFILES += font_mod-font_manager.d UNDSYMFILES += und-font.lst font.mod: pre-font.o mod-font.o @@ -1467,8 +1555,10 @@ mod-font.o: mod-font.c mod-font.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'font' $< > $@ || (rm -f $@; exit 1) +ifneq ($(font_mod_EXPORTS),no) def-font.lst: pre-font.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 font/' > $@ +endif und-font.lst: pre-font.o echo 'font' > $@ @@ -1498,9 +1588,12 @@ font_mod_LDFLAGS = $(COMMON_LDFLAGS) # For amiga.mod amiga_mod_SOURCES = partmap/amiga.c -CLEANFILES += amiga.mod mod-amiga.o mod-amiga.c pre-amiga.o amiga_mod-partmap_amiga.o def-amiga.lst und-amiga.lst -MOSTLYCLEANFILES += amiga_mod-partmap_amiga.d +CLEANFILES += amiga.mod mod-amiga.o mod-amiga.c pre-amiga.o amiga_mod-partmap_amiga.o und-amiga.lst +ifneq ($(amiga_mod_EXPORTS),no) +CLEANFILES += def-amiga.lst DEFSYMFILES += def-amiga.lst +endif +MOSTLYCLEANFILES += amiga_mod-partmap_amiga.d UNDSYMFILES += und-amiga.lst amiga.mod: pre-amiga.o mod-amiga.o @@ -1518,8 +1611,10 @@ mod-amiga.o: mod-amiga.c mod-amiga.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'amiga' $< > $@ || (rm -f $@; exit 1) +ifneq ($(amiga_mod_EXPORTS),no) def-amiga.lst: pre-amiga.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 amiga/' > $@ +endif und-amiga.lst: pre-amiga.o echo 'amiga' > $@ @@ -1549,9 +1644,12 @@ amiga_mod_LDFLAGS = $(COMMON_LDFLAGS) # For apple.mod apple_mod_SOURCES = partmap/apple.c -CLEANFILES += apple.mod mod-apple.o mod-apple.c pre-apple.o apple_mod-partmap_apple.o def-apple.lst und-apple.lst -MOSTLYCLEANFILES += apple_mod-partmap_apple.d +CLEANFILES += apple.mod mod-apple.o mod-apple.c pre-apple.o apple_mod-partmap_apple.o und-apple.lst +ifneq ($(apple_mod_EXPORTS),no) +CLEANFILES += def-apple.lst DEFSYMFILES += def-apple.lst +endif +MOSTLYCLEANFILES += apple_mod-partmap_apple.d UNDSYMFILES += und-apple.lst apple.mod: pre-apple.o mod-apple.o @@ -1569,8 +1667,10 @@ mod-apple.o: mod-apple.c mod-apple.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'apple' $< > $@ || (rm -f $@; exit 1) +ifneq ($(apple_mod_EXPORTS),no) def-apple.lst: pre-apple.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 apple/' > $@ +endif und-apple.lst: pre-apple.o echo 'apple' > $@ @@ -1600,9 +1700,12 @@ apple_mod_LDFLAGS = $(COMMON_LDFLAGS) # For pc.mod pc_mod_SOURCES = partmap/pc.c -CLEANFILES += pc.mod mod-pc.o mod-pc.c pre-pc.o pc_mod-partmap_pc.o def-pc.lst und-pc.lst -MOSTLYCLEANFILES += pc_mod-partmap_pc.d +CLEANFILES += pc.mod mod-pc.o mod-pc.c pre-pc.o pc_mod-partmap_pc.o und-pc.lst +ifneq ($(pc_mod_EXPORTS),no) +CLEANFILES += def-pc.lst DEFSYMFILES += def-pc.lst +endif +MOSTLYCLEANFILES += pc_mod-partmap_pc.d UNDSYMFILES += und-pc.lst pc.mod: pre-pc.o mod-pc.o @@ -1620,8 +1723,10 @@ mod-pc.o: mod-pc.c mod-pc.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'pc' $< > $@ || (rm -f $@; exit 1) +ifneq ($(pc_mod_EXPORTS),no) def-pc.lst: pre-pc.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 pc/' > $@ +endif und-pc.lst: pre-pc.o echo 'pc' > $@ @@ -1651,9 +1756,12 @@ pc_mod_LDFLAGS = $(COMMON_LDFLAGS) # For sun.mod sun_mod_SOURCES = partmap/sun.c -CLEANFILES += sun.mod mod-sun.o mod-sun.c pre-sun.o sun_mod-partmap_sun.o def-sun.lst und-sun.lst -MOSTLYCLEANFILES += sun_mod-partmap_sun.d +CLEANFILES += sun.mod mod-sun.o mod-sun.c pre-sun.o sun_mod-partmap_sun.o und-sun.lst +ifneq ($(sun_mod_EXPORTS),no) +CLEANFILES += def-sun.lst DEFSYMFILES += def-sun.lst +endif +MOSTLYCLEANFILES += sun_mod-partmap_sun.d UNDSYMFILES += und-sun.lst sun.mod: pre-sun.o mod-sun.o @@ -1671,8 +1779,10 @@ mod-sun.o: mod-sun.c mod-sun.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'sun' $< > $@ || (rm -f $@; exit 1) +ifneq ($(sun_mod_EXPORTS),no) def-sun.lst: pre-sun.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 sun/' > $@ +endif und-sun.lst: pre-sun.o echo 'sun' > $@ @@ -1702,9 +1812,12 @@ sun_mod_LDFLAGS = $(COMMON_LDFLAGS) # For acorn.mod acorn_mod_SOURCES = partmap/acorn.c -CLEANFILES += acorn.mod mod-acorn.o mod-acorn.c pre-acorn.o acorn_mod-partmap_acorn.o def-acorn.lst und-acorn.lst -MOSTLYCLEANFILES += acorn_mod-partmap_acorn.d +CLEANFILES += acorn.mod mod-acorn.o mod-acorn.c pre-acorn.o acorn_mod-partmap_acorn.o und-acorn.lst +ifneq ($(acorn_mod_EXPORTS),no) +CLEANFILES += def-acorn.lst DEFSYMFILES += def-acorn.lst +endif +MOSTLYCLEANFILES += acorn_mod-partmap_acorn.d UNDSYMFILES += und-acorn.lst acorn.mod: pre-acorn.o mod-acorn.o @@ -1722,8 +1835,10 @@ mod-acorn.o: mod-acorn.c mod-acorn.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'acorn' $< > $@ || (rm -f $@; exit 1) +ifneq ($(acorn_mod_EXPORTS),no) def-acorn.lst: pre-acorn.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 acorn/' > $@ +endif und-acorn.lst: pre-acorn.o echo 'acorn' > $@ @@ -1752,9 +1867,12 @@ acorn_mod_CFLAGS = $(COMMON_CFLAGS) # For loopback.mod loopback_mod_SOURCES = disk/loopback.c -CLEANFILES += loopback.mod mod-loopback.o mod-loopback.c pre-loopback.o loopback_mod-disk_loopback.o def-loopback.lst und-loopback.lst -MOSTLYCLEANFILES += loopback_mod-disk_loopback.d +CLEANFILES += loopback.mod mod-loopback.o mod-loopback.c pre-loopback.o loopback_mod-disk_loopback.o und-loopback.lst +ifneq ($(loopback_mod_EXPORTS),no) +CLEANFILES += def-loopback.lst DEFSYMFILES += def-loopback.lst +endif +MOSTLYCLEANFILES += loopback_mod-disk_loopback.d UNDSYMFILES += und-loopback.lst loopback.mod: pre-loopback.o mod-loopback.o @@ -1772,8 +1890,10 @@ mod-loopback.o: mod-loopback.c mod-loopback.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'loopback' $< > $@ || (rm -f $@; exit 1) +ifneq ($(loopback_mod_EXPORTS),no) def-loopback.lst: pre-loopback.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 loopback/' > $@ +endif und-loopback.lst: pre-loopback.o echo 'loopback' > $@ @@ -1803,9 +1923,12 @@ loopback_mod_LDFLAGS = $(COMMON_LDFLAGS) # For suspend.mod suspend_mod_SOURCES = commands/ieee1275/suspend.c -CLEANFILES += suspend.mod mod-suspend.o mod-suspend.c pre-suspend.o suspend_mod-commands_ieee1275_suspend.o def-suspend.lst und-suspend.lst -MOSTLYCLEANFILES += suspend_mod-commands_ieee1275_suspend.d +CLEANFILES += suspend.mod mod-suspend.o mod-suspend.c pre-suspend.o suspend_mod-commands_ieee1275_suspend.o und-suspend.lst +ifneq ($(suspend_mod_EXPORTS),no) +CLEANFILES += def-suspend.lst DEFSYMFILES += def-suspend.lst +endif +MOSTLYCLEANFILES += suspend_mod-commands_ieee1275_suspend.d UNDSYMFILES += und-suspend.lst suspend.mod: pre-suspend.o mod-suspend.o @@ -1823,8 +1946,10 @@ mod-suspend.o: mod-suspend.c mod-suspend.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'suspend' $< > $@ || (rm -f $@; exit 1) +ifneq ($(suspend_mod_EXPORTS),no) def-suspend.lst: pre-suspend.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 suspend/' > $@ +endif und-suspend.lst: pre-suspend.o echo 'suspend' > $@ @@ -1854,9 +1979,12 @@ suspend_mod_LDFLAGS = $(COMMON_LDFLAGS) # For reboot.mod reboot_mod_SOURCES = commands/ieee1275/reboot.c -CLEANFILES += reboot.mod mod-reboot.o mod-reboot.c pre-reboot.o reboot_mod-commands_ieee1275_reboot.o def-reboot.lst und-reboot.lst -MOSTLYCLEANFILES += reboot_mod-commands_ieee1275_reboot.d +CLEANFILES += reboot.mod mod-reboot.o mod-reboot.c pre-reboot.o reboot_mod-commands_ieee1275_reboot.o und-reboot.lst +ifneq ($(reboot_mod_EXPORTS),no) +CLEANFILES += def-reboot.lst DEFSYMFILES += def-reboot.lst +endif +MOSTLYCLEANFILES += reboot_mod-commands_ieee1275_reboot.d UNDSYMFILES += und-reboot.lst reboot.mod: pre-reboot.o mod-reboot.o @@ -1874,8 +2002,10 @@ mod-reboot.o: mod-reboot.c mod-reboot.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'reboot' $< > $@ || (rm -f $@; exit 1) +ifneq ($(reboot_mod_EXPORTS),no) def-reboot.lst: pre-reboot.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 reboot/' > $@ +endif und-reboot.lst: pre-reboot.o echo 'reboot' > $@ @@ -1905,9 +2035,12 @@ reboot_mod_LDFLAGS = $(COMMON_LDFLAGS) # For halt.mod halt_mod_SOURCES = commands/ieee1275/halt.c -CLEANFILES += halt.mod mod-halt.o mod-halt.c pre-halt.o halt_mod-commands_ieee1275_halt.o def-halt.lst und-halt.lst -MOSTLYCLEANFILES += halt_mod-commands_ieee1275_halt.d +CLEANFILES += halt.mod mod-halt.o mod-halt.c pre-halt.o halt_mod-commands_ieee1275_halt.o und-halt.lst +ifneq ($(halt_mod_EXPORTS),no) +CLEANFILES += def-halt.lst DEFSYMFILES += def-halt.lst +endif +MOSTLYCLEANFILES += halt_mod-commands_ieee1275_halt.d UNDSYMFILES += und-halt.lst halt.mod: pre-halt.o mod-halt.o @@ -1925,8 +2058,10 @@ mod-halt.o: mod-halt.c mod-halt.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'halt' $< > $@ || (rm -f $@; exit 1) +ifneq ($(halt_mod_EXPORTS),no) def-halt.lst: pre-halt.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 halt/' > $@ +endif und-halt.lst: pre-halt.o echo 'halt' > $@ @@ -1956,9 +2091,12 @@ halt_mod_LDFLAGS = $(COMMON_LDFLAGS) # For help.mod. help_mod_SOURCES = commands/help.c -CLEANFILES += help.mod mod-help.o mod-help.c pre-help.o help_mod-commands_help.o def-help.lst und-help.lst -MOSTLYCLEANFILES += help_mod-commands_help.d +CLEANFILES += help.mod mod-help.o mod-help.c pre-help.o help_mod-commands_help.o und-help.lst +ifneq ($(help_mod_EXPORTS),no) +CLEANFILES += def-help.lst DEFSYMFILES += def-help.lst +endif +MOSTLYCLEANFILES += help_mod-commands_help.d UNDSYMFILES += und-help.lst help.mod: pre-help.o mod-help.o @@ -1976,8 +2114,10 @@ mod-help.o: mod-help.c mod-help.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'help' $< > $@ || (rm -f $@; exit 1) +ifneq ($(help_mod_EXPORTS),no) def-help.lst: pre-help.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 help/' > $@ +endif und-help.lst: pre-help.o echo 'help' > $@ @@ -2007,9 +2147,12 @@ help_mod_LDFLAGS = $(COMMON_LDFLAGS) # For default.mod default_mod_SOURCES = commands/default.c -CLEANFILES += default.mod mod-default.o mod-default.c pre-default.o default_mod-commands_default.o def-default.lst und-default.lst -MOSTLYCLEANFILES += default_mod-commands_default.d +CLEANFILES += default.mod mod-default.o mod-default.c pre-default.o default_mod-commands_default.o und-default.lst +ifneq ($(default_mod_EXPORTS),no) +CLEANFILES += def-default.lst DEFSYMFILES += def-default.lst +endif +MOSTLYCLEANFILES += default_mod-commands_default.d UNDSYMFILES += und-default.lst default.mod: pre-default.o mod-default.o @@ -2027,8 +2170,10 @@ mod-default.o: mod-default.c mod-default.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'default' $< > $@ || (rm -f $@; exit 1) +ifneq ($(default_mod_EXPORTS),no) def-default.lst: pre-default.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 default/' > $@ +endif und-default.lst: pre-default.o echo 'default' > $@ @@ -2058,9 +2203,12 @@ default_mod_LDFLAGS = $(COMMON_LDFLAGS) # For timeout.mod timeout_mod_SOURCES = commands/timeout.c -CLEANFILES += timeout.mod mod-timeout.o mod-timeout.c pre-timeout.o timeout_mod-commands_timeout.o def-timeout.lst und-timeout.lst -MOSTLYCLEANFILES += timeout_mod-commands_timeout.d +CLEANFILES += timeout.mod mod-timeout.o mod-timeout.c pre-timeout.o timeout_mod-commands_timeout.o und-timeout.lst +ifneq ($(timeout_mod_EXPORTS),no) +CLEANFILES += def-timeout.lst DEFSYMFILES += def-timeout.lst +endif +MOSTLYCLEANFILES += timeout_mod-commands_timeout.d UNDSYMFILES += und-timeout.lst timeout.mod: pre-timeout.o mod-timeout.o @@ -2078,8 +2226,10 @@ mod-timeout.o: mod-timeout.c mod-timeout.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'timeout' $< > $@ || (rm -f $@; exit 1) +ifneq ($(timeout_mod_EXPORTS),no) def-timeout.lst: pre-timeout.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 timeout/' > $@ +endif und-timeout.lst: pre-timeout.o echo 'timeout' > $@ @@ -2109,9 +2259,12 @@ timeout_mod_LDFLAGS = $(COMMON_LDFLAGS) # For configfile.mod configfile_mod_SOURCES = commands/configfile.c -CLEANFILES += configfile.mod mod-configfile.o mod-configfile.c pre-configfile.o configfile_mod-commands_configfile.o def-configfile.lst und-configfile.lst -MOSTLYCLEANFILES += configfile_mod-commands_configfile.d +CLEANFILES += configfile.mod mod-configfile.o mod-configfile.c pre-configfile.o configfile_mod-commands_configfile.o und-configfile.lst +ifneq ($(configfile_mod_EXPORTS),no) +CLEANFILES += def-configfile.lst DEFSYMFILES += def-configfile.lst +endif +MOSTLYCLEANFILES += configfile_mod-commands_configfile.d UNDSYMFILES += und-configfile.lst configfile.mod: pre-configfile.o mod-configfile.o @@ -2129,8 +2282,10 @@ mod-configfile.o: mod-configfile.c mod-configfile.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'configfile' $< > $@ || (rm -f $@; exit 1) +ifneq ($(configfile_mod_EXPORTS),no) def-configfile.lst: pre-configfile.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 configfile/' > $@ +endif und-configfile.lst: pre-configfile.o echo 'configfile' > $@ @@ -2160,9 +2315,12 @@ configfile_mod_LDFLAGS = $(COMMON_LDFLAGS) # For search.mod. search_mod_SOURCES = commands/search.c -CLEANFILES += search.mod mod-search.o mod-search.c pre-search.o search_mod-commands_search.o def-search.lst und-search.lst -MOSTLYCLEANFILES += search_mod-commands_search.d +CLEANFILES += search.mod mod-search.o mod-search.c pre-search.o search_mod-commands_search.o und-search.lst +ifneq ($(search_mod_EXPORTS),no) +CLEANFILES += def-search.lst DEFSYMFILES += def-search.lst +endif +MOSTLYCLEANFILES += search_mod-commands_search.d UNDSYMFILES += und-search.lst search.mod: pre-search.o mod-search.o @@ -2180,8 +2338,10 @@ mod-search.o: mod-search.c mod-search.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'search' $< > $@ || (rm -f $@; exit 1) +ifneq ($(search_mod_EXPORTS),no) def-search.lst: pre-search.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 search/' > $@ +endif und-search.lst: pre-search.o echo 'search' > $@ @@ -2211,9 +2371,12 @@ search_mod_LDFLAGS = $(COMMON_LDFLAGS) # For gzio.mod. gzio_mod_SOURCES = io/gzio.c -CLEANFILES += gzio.mod mod-gzio.o mod-gzio.c pre-gzio.o gzio_mod-io_gzio.o def-gzio.lst und-gzio.lst -MOSTLYCLEANFILES += gzio_mod-io_gzio.d +CLEANFILES += gzio.mod mod-gzio.o mod-gzio.c pre-gzio.o gzio_mod-io_gzio.o und-gzio.lst +ifneq ($(gzio_mod_EXPORTS),no) +CLEANFILES += def-gzio.lst DEFSYMFILES += def-gzio.lst +endif +MOSTLYCLEANFILES += gzio_mod-io_gzio.d UNDSYMFILES += und-gzio.lst gzio.mod: pre-gzio.o mod-gzio.o @@ -2231,8 +2394,10 @@ mod-gzio.o: mod-gzio.c mod-gzio.c: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh 'gzio' $< > $@ || (rm -f $@; exit 1) +ifneq ($(gzio_mod_EXPORTS),no) def-gzio.lst: pre-gzio.o $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 gzio/' > $@ +endif und-gzio.lst: pre-gzio.o echo 'gzio' > $@ diff --git a/genmk.rb b/genmk.rb index 3471f1436..45202fcf4 100644 --- a/genmk.rb +++ b/genmk.rb @@ -111,9 +111,12 @@ class PModule mod_name = File.basename(@name, '.mod') symbolic_name = mod_name.sub(/\.[^\.]*$/, '') - "CLEANFILES += #{@name} #{mod_obj} #{mod_src} #{pre_obj} #{objs_str} #{defsym} #{undsym} -MOSTLYCLEANFILES += #{deps_str} + "CLEANFILES += #{@name} #{mod_obj} #{mod_src} #{pre_obj} #{objs_str} #{undsym} +ifneq ($(#{prefix}_EXPORTS),no) +CLEANFILES += #{defsym} DEFSYMFILES += #{defsym} +endif +MOSTLYCLEANFILES += #{deps_str} UNDSYMFILES += #{undsym} #{@name}: #{pre_obj} #{mod_obj} @@ -131,8 +134,10 @@ UNDSYMFILES += #{undsym} #{mod_src}: moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh '#{mod_name}' $< > $@ || (rm -f $@; exit 1) +ifneq ($(#{prefix}_EXPORTS),no) #{defsym}: #{pre_obj} $(NM) -g --defined-only -P -p $< | sed 's/^\\([^ ]*\\).*/\\1 #{mod_name}/' > $@ +endif #{undsym}: #{pre_obj} echo '#{mod_name}' > $@ diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h new file mode 100644 index 000000000..ef44b9d4c --- /dev/null +++ b/include/grub/efi/api.h @@ -0,0 +1,653 @@ +/* efi.h - declare EFI types and functions */ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2006 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef GRUB_EFI_API_HEADER +#define GRUB_EFI_API_HEADER 1 + +#include + +/* For consistency and safety, we name the EFI-defined types differently. + All names are transformed into lower case, _t appended, and + grub_efi_ prepended. */ + +/* Constants. */ +#define GRUB_EFI_EVT_TIMER 0x80000000 +#define GRUB_EFI_EVT_RUNTIME 0x40000000 +#define GRUB_EFI_EVT_RUNTIME_CONTEXT 0x20000000 +#define GRUB_EFI_EVT_NOTIFY_WAIT 0x00000100 +#define GRUB_EFI_EVT_NOTIFY_SIGNAL 0x00000200 +#define GRUB_EFI_EVT_SIGNAL_EXIT_BOOT_SERVICES 0x00000201 +#define GRUB_EFI_EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE 0x60000202 + +#define GRUB_EFI_TPL_APPLICATION 4 +#define GRUB_EFI_TPL_CALLBACK 8 +#define GRUB_EFI_TPL_NOTIFY 16 +#define GRUB_EFI_TPL_HIGH_LEVEL 31 + +#define GRUB_EFI_MEMORY_UC 0x0000000000000001 +#define GRUB_EFI_MEMORY_WC 0x0000000000000002 +#define GRUB_EFI_MEMORY_WT 0x0000000000000004 +#define GRUB_EFI_MEMORY_WB 0x0000000000000008 +#define GRUB_EFI_MEMORY_UCE 0x0000000000000010 +#define GRUB_EFI_MEMORY_WP 0x0000000000001000 +#define GRUB_EFI_MEMORY_RP 0x0000000000002000 +#define GRUB_EFI_MEMORY_XP 0x0000000000004000 +#define GRUB_EFI_MEMORY_RUNTIME 0x8000000000000000 + +#define GRUB_EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL 0x00000001 +#define GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL 0x00000002 +#define GRUB_EFI_OPEN_PROTOCOL_TEST_PROTOCOL 0x00000004 +#define GRUB_EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER 0x00000008 +#define GRUB_EFI_OPEN_PROTOCOL_BY_DRIVER 0x00000010 +#define GRUB_EFI_OPEN_PROTOCOL_BY_EXCLUSIVE 0x00000020 + +#define GRUB_EFI_VARIABLE_NON_VOLATILE 0x0000000000000001 +#define GRUB_EFI_VARIABLE_BOOTSERVICE_ACCESS 0x0000000000000002 +#define GRUB_EFI_VARIABLE_RUNTIME_ACCESS 0x0000000000000004 + +#define GRUB_EFI_TIME_ADJUST_DAYLIGHT 0x01 +#define GRUB_EFI_TIME_IN_DAYLIGHT 0x02 + +#define GRUB_EFI_UNSPECIFIED_TIMEZONE 0x07FF + +#define GRUB_EFI_OPTIONAL_PTR 0x00000001 + +/* Enumerations. */ +enum grub_efi_timer_delay + { + GRUB_EFI_TIMER_CANCEL, + GRUB_EFI_TIMER_PERIODIC, + GRUB_EFI_TIMER_RELATIVE + }; +typedef enum grub_efi_timer_delay grub_efi_timer_delay_t; + +enum grub_efi_allocate_type + { + GRUB_EFI_ALLOCATE_ANY_PAGES, + GRUB_EFI_ALLOCATE_MAX_ADDRESS, + GRUB_EFI_ALLOCATE_ADDRESS, + GRUB_EFI_MAX_ALLOCATION_TYPE + }; +typedef enum grub_efi_allocate_type grub_efi_allocate_type_t; + +enum grub_efi_memory_type + { + GRUB_EFI_RESERVED_MEMORY_TYPE, + GRUB_EFI_LOADER_CODE, + GRUB_EFI_LOADER_DATA, + GRUB_EFI_BOOT_SERVICES_CODE, + GRUB_EFI_BOOT_SERVICES_DATA, + GRUB_EFI_RUNTIME_SERVICES_CODE, + GRUB_EFI_RUNTIME_SERVICES_DATA, + GRUB_EFI_CONVENTIONAL_MEMORY, + GRUB_EFI_UNUSABLE_MEMORY, + GRUB_EFI_ACPI_RECLAIM_MEMORY, + GRUB_EFI_ACPI_MEMORY_NVS, + GRUB_EFI_MEMORY_MAPPED_IO, + GRUB_EFI_MEMORY_MAPPED_IO_PORT_SPACE, + GRUB_EFI_PAL_CODE, + GRUB_EFI_MAX_MEMORY_TYPE + }; +typedef enum grub_efi_memory_type grub_efi_memory_type_t; + +enum grub_efi_interface_type + { + GRUB_EFI_NATIVE_INTERFACE + }; +typedef enum grub_efi_interface_type grub_efi_interface_type_t; + +enum grub_efi_locate_search_type + { + GRUB_EFI_ALL_HANDLES, + GRUB_EFI_BY_REGISTER_NOTIFY, + GRUB_EFI_BY_PROTOCOL + }; +typedef enum grub_efi_locate_search_type grub_efi_locate_search_type_t; + +enum grub_efi_reset_type + { + GRUB_EFI_RESET_COLD, + GRUB_EFI_RESET_WARM, + GRUB_EFI_RESET_SHUTDOWN + }; +typedef enum grub_efi_reset_type grub_efi_reset_type_t; + +/* Types. */ +typedef char grub_efi_boolean_t; +typedef long grub_efi_intn_t; +typedef unsigned long grub_efi_uintn_t; +typedef grub_int8_t grub_efi_int8_t; +typedef grub_uint8_t grub_efi_uint8_t; +typedef grub_int16_t grub_efi_int16_t; +typedef grub_uint16_t grub_efi_uint16_t; +typedef grub_int32_t grub_efi_int32_t; +typedef grub_uint32_t grub_efi_uint32_t; +typedef grub_int64_t grub_efi_int64_t; +typedef grub_uint64_t grub_efi_uint64_t; +typedef grub_uint8_t grub_efi_char8_t; +typedef grub_uint16_t grub_efi_char16_t; + +typedef grub_efi_intn_t grub_efi_status_t; + +#define GRUB_EFI_ERROR_CODE(value) \ + ((1 << (sizeof (grub_efi_status_t) * 8 - 1)) | (value)) + +#define GRUB_EFI_WARNING_CODE(value) (value) + +#define GRUB_EFI_SUCCESS 0 + +#define GRUB_EFI_LOAD_ERROR GRUB_EFI_ERROR_CODE (1) +#define GRUB_EFI_INVALID_PARAMETER GRUB_EFI_ERROR_CODE (2) +#define GRUB_EFI_UNSUPPORTED GRUB_EFI_ERROR_CODE (3) +#define GRUB_EFI_BAD_BUFFER_SIZE GRUB_EFI_ERROR_CODE (4) +#define GRUB_EFI_BUFFER_TOO_SMALL GRUB_EFI_ERROR_CODE (5) +#define GRUB_EFI_NOT_READY GRUB_EFI_ERROR_CODE (6) +#define GRUB_EFI_DEVICE_ERROR GRUB_EFI_ERROR_CODE (7) +#define GRUB_EFI_WRITE_PROTECTED GRUB_EFI_ERROR_CODE (8) +#define GRUB_EFI_OUT_OF_RESOURCES GRUB_EFI_ERROR_CODE (9) +#define GRUB_EFI_VOLUME_CORRUPTED GRUB_EFI_ERROR_CODE (10) +#define GRUB_EFI_VOLUME_FULL GRUB_EFI_ERROR_CODE (11) +#define GRUB_EFI_NO_MEDIA GRUB_EFI_ERROR_CODE (12) +#define GRUB_EFI_MEDIA_CHANGED GRUB_EFI_ERROR_CODE (13) +#define GRUB_EFI_NOT_FOUND GRUB_EFI_ERROR_CODE (14) +#define GRUB_EFI_ACCESS_DENIED GRUB_EFI_ERROR_CODE (15) +#define GRUB_EFI_NO_RESPONSE GRUB_EFI_ERROR_CODE (16) +#define GRUB_EFI_NO_MAPPING GRUB_EFI_ERROR_CODE (17) +#define GRUB_EFI_TIMEOUT GRUB_EFI_ERROR_CODE (18) +#define GRUB_EFI_NOT_STARTED GRUB_EFI_ERROR_CODE (19) +#define GRUB_EFI_ALREADY_STARTED GRUB_EFI_ERROR_CODE (20) +#define GRUB_EFI_ABORTED GRUB_EFI_ERROR_CODE (21) +#define GRUB_EFI_ICMP_ERROR GRUB_EFI_ERROR_CODE (22) +#define GRUB_EFI_TFTP_ERROR GRUB_EFI_ERROR_CODE (23) +#define GRUB_EFI_PROTOCOL_ERROR GRUB_EFI_ERROR_CODE (24) +#define GRUB_EFI_INCOMPATIBLE_VERSION GRUB_EFI_ERROR_CODE (25) +#define GRUB_EFI_SECURITY_VIOLATION GRUB_EFI_ERROR_CODE (26) +#define GRUB_EFI_CRC_ERROR GRUB_EFI_ERROR_CODE (27) + +#define GRUB_EFI_WARN_UNKNOWN_GLYPH GRUB_EFI_WARNING_CODE (1) +#define GRUB_EFI_WARN_DELETE_FAILURE GRUB_EFI_WARNING_CODE (2) +#define GRUB_EFI_WARN_WRITE_FAILURE GRUB_EFI_WARNING_CODE (3) +#define GRUB_EFI_WARN_BUFFER_TOO_SMALL GRUB_EFI_WARNING_CODE (4) + +typedef void *grub_efi_handle_t; +typedef void *grub_efi_event_t; +typedef grub_efi_uint64_t grub_efi_lba_t; +typedef grub_efi_uintn_t grub_efi_tpl_t; +typedef grub_uint8_t grub_efi_mac_address_t[32]; +typedef grub_uint8_t grub_efi_ipv4_address_t[4]; +typedef grub_uint8_t grub_efi_ipv6_address_t[8]; +typedef grub_uint8_t grub_efi_ip_address_t[8] __attribute__ ((aligned(4))); +typedef grub_efi_uint64_t grub_efi_physical_address_t; +typedef grub_efi_uint64_t grub_efi_virtual_address_t; + +struct grub_efi_guid +{ + grub_uint32_t data1; + grub_uint16_t data2; + grub_uint16_t data3; + grub_uint8_t data4; + grub_uint8_t data5; + grub_uint8_t data6; + grub_uint8_t data7; + grub_uint8_t data8; + grub_uint8_t data9; + grub_uint8_t data10; + grub_uint8_t data11; +} __attribute__ ((aligned(8))); +typedef struct grub_efi_guid grub_efi_guid_t; + +struct grub_efi_memory_descriptor +{ + grub_efi_uint32_t type; + grub_efi_physical_address_t physical_start; + grub_efi_virtual_address_t virtual_start; + grub_efi_uint64_t num_pages; + grub_efi_uint64_t attribute; +}; +typedef struct grub_efi_memory_descriptor grub_efi_memory_descriptor_t; + +struct grub_efi_device_path +{ + grub_efi_uint8_t type; + grub_efi_uint8_t sub_type; + grub_efi_uint8_t length[2]; +}; +typedef struct grub_efi_device_path grub_efi_device_path_t; +/* XXX EFI does not define EFI_DEVICE_PATH_PROTOCOL but uses it. + It seems to be identical to EFI_DEVICE_PATH. */ +typedef struct grub_efi_device_path grub_efi_device_path_protocol_t; + +struct grub_efi_open_protocol_information_entry +{ + grub_efi_handle_t agent_handle; + grub_efi_handle_t controller_handle; + grub_efi_uint32_t attributes; + grub_efi_uint32_t open_count; +}; +typedef struct grub_efi_open_protocol_information_entry grub_efi_open_protocol_information_entry_t; + +struct grub_efi_time +{ + grub_efi_uint16_t year; + grub_efi_uint8_t month; + grub_efi_uint8_t day; + grub_efi_uint8_t hour; + grub_efi_uint8_t minute; + grub_efi_uint8_t second; + grub_efi_uint8_t pad1; + grub_efi_uint32_t nanosecond; + grub_efi_int16_t time_zone; + grub_efi_uint8_t daylight; + grub_efi_uint8_t pad2; +}; +typedef struct grub_efi_time grub_efi_time_t; + +struct grub_efi_time_capabilities +{ + grub_efi_uint32_t resolution; + grub_efi_uint32_t accuracy; + grub_efi_boolean_t sets_to_zero; +}; +typedef struct grub_efi_time_capabilities grub_efi_time_capabilities_t; + +struct grub_efi_input_key +{ + grub_efi_uint16_t scan_code; + grub_efi_char16_t unicode_char; +}; +typedef struct grub_efi_input_key grub_efi_input_key_t; + +struct grub_efi_simple_text_output_mode +{ + grub_efi_int32_t max_mode; + grub_efi_int32_t mode; + grub_efi_int32_t attribute; + grub_efi_int32_t cursor_column; + grub_efi_int32_t cursor_row; + grub_efi_boolean_t cursor_visible; +}; +typedef struct grub_efi_simple_text_output_mode grub_efi_simple_text_output_mode_t; + +/* Tables. */ +struct grub_efi_table_header +{ + grub_efi_uint64_t signature; + grub_efi_uint32_t revision; + grub_efi_uint32_t header_size; + grub_efi_uint32_t crc32; + grub_efi_uint32_t reserved; +}; +typedef struct grub_efi_table_header grub_efi_table_header_t; + +struct grub_efi_boot_services +{ + grub_efi_table_header_t hdr; + + grub_efi_tpl_t + (*raise_tpl) (grub_efi_tpl_t new_tpl); + + void + (*restore_tpl) (grub_efi_tpl_t old_tpl); + + grub_efi_status_t + (*allocate_pages) (grub_efi_allocate_type_t type, + grub_efi_memory_type_t memory_type, + grub_efi_uintn_t pages, + grub_efi_physical_address_t *memory); + + grub_efi_status_t + (*free_pages) (grub_efi_physical_address_t memory, + grub_efi_uintn_t pages); + + grub_efi_status_t + (*get_memory_map) (grub_efi_uintn_t *memory_map_size, + grub_efi_memory_descriptor_t *memory_map, + grub_efi_uintn_t *map_key, + grub_efi_uintn_t *descriptor_size, + grub_efi_uint32_t *descriptor_version); + + grub_efi_status_t + (*allocate_pool) (grub_efi_memory_type_t pool_type, + grub_efi_uintn_t size, + void **buffer); + + grub_efi_status_t + (*free_pool) (void *buffer); + + grub_efi_status_t + (*create_event) (grub_efi_uint32_t type, + grub_efi_tpl_t notify_tpl, + void (*notify_function) (grub_efi_event_t event, + void *context), + void *notify_context, + grub_efi_event_t *event); + + grub_efi_status_t + + (*set_timer) (grub_efi_event_t event, + grub_efi_timer_delay_t type, + grub_efi_uint64_t trigger_time); + + grub_efi_status_t + (*wait_for_event) (grub_efi_uintn_t num_events, + grub_efi_event_t *event, + grub_efi_uintn_t *index); + + grub_efi_status_t + (*signal_event) (grub_efi_event_t event); + + grub_efi_status_t + (*close_event) (grub_efi_event_t event); + + grub_efi_status_t + (*check_event) (grub_efi_event_t event); + + grub_efi_status_t + (*install_protocol_interface) (grub_efi_handle_t *handle, + grub_efi_guid_t *protocol, + grub_efi_interface_type_t interface_type, + void *interface); + + grub_efi_status_t + (*reinstall_protocol_interface) (grub_efi_handle_t handle, + grub_efi_guid_t *protocol, + void *old_interface, + void *new_inteface); + + grub_efi_status_t + (*uninstall_protocol_interface) (grub_efi_handle_t handle, + grub_efi_guid_t *protocol, + void *interface); + + grub_efi_status_t + (*handle_protocol) (grub_efi_handle_t handle, + grub_efi_guid_t *protocol, + void **interface); + + void *reserved; + + grub_efi_status_t + (*register_protocol_notify) (grub_efi_guid_t *protocol, + grub_efi_event_t event, + void **registration); + + grub_efi_status_t + (*locate_handle) (grub_efi_locate_search_type_t search_type, + grub_efi_guid_t *protocol, + void *search_key, + grub_efi_uintn_t *buffer_size, + grub_efi_handle_t *buffer); + + grub_efi_status_t + (*locate_device_path) (grub_efi_guid_t *protocol, + grub_efi_device_path_t **device_path, + grub_efi_handle_t *device); + + grub_efi_status_t + (*install_configuration_table) (grub_efi_guid_t *guid, void *table); + + grub_efi_status_t + (*load_image) (grub_efi_boolean_t boot_policy, + grub_efi_handle_t parent_image_handle, + grub_efi_device_path_t *file_path, + void *source_buffer, + grub_efi_uintn_t source_size, + grub_efi_handle_t *image_handle); + + grub_efi_status_t + (*start_image) (grub_efi_handle_t image_handle, + grub_efi_uintn_t *exit_data_size, + grub_efi_char16_t **exit_data); + + grub_efi_status_t + (*exit) (grub_efi_handle_t image_handle, + grub_efi_status_t exit_status, + grub_efi_uintn_t exit_data_size, + grub_efi_char16_t *exit_data) __attribute__((noreturn)); + + grub_efi_status_t + (*unload_image) (grub_efi_handle_t image_handle); + + grub_efi_status_t + (*exit_boot_services) (grub_efi_handle_t image_handle, + grub_efi_uintn_t map_key); + + grub_efi_status_t + (*get_next_monotonic_count) (grub_efi_uint64_t *count); + + grub_efi_status_t + (*stall) (grub_efi_uintn_t microseconds); + + grub_efi_status_t + (*set_watchdog_timer) (grub_efi_uintn_t timeout, + grub_efi_uint64_t watchdog_code, + grub_efi_uintn_t data_size, + grub_efi_char16_t *watchdog_data); + + grub_efi_status_t + (*connect_controller) (grub_efi_handle_t controller_handle, + grub_efi_handle_t *driver_image_handle, + grub_efi_device_path_protocol_t *remaining_device_path, + grub_efi_boolean_t recursive); + + grub_efi_status_t + (*disconnect_controller) (grub_efi_handle_t controller_handle, + grub_efi_handle_t driver_image_handle, + grub_efi_handle_t child_handle); + + grub_efi_status_t + (*open_protocol) (grub_efi_handle_t handle, + grub_efi_guid_t *protocol, + void **interface, + grub_efi_handle_t agent_handle, + grub_efi_handle_t controller_handle, + grub_efi_uint32_t attributes); + + grub_efi_status_t + (*close_protocol) (grub_efi_handle_t handle, + grub_efi_guid_t *protocol, + grub_efi_handle_t agent_handle, + grub_efi_handle_t controller_handle); + + grub_efi_status_t + (*open_protocol_information) (grub_efi_handle_t handle, + grub_efi_guid_t *protocol, + grub_efi_open_protocol_information_entry_t **entry_buffer, + grub_efi_uintn_t *entry_count); + + grub_efi_status_t + (*protocols_per_handle) (grub_efi_handle_t handle, + grub_efi_guid_t ***protocol_buffer, + grub_efi_uintn_t *protocol_buffer_count); + + grub_efi_status_t + (*locate_handle_buffer) (grub_efi_locate_search_type_t search_type, + grub_efi_guid_t *protocol, + void *search_key, + grub_efi_uintn_t *no_handles, + grub_efi_handle_t **buffer); + + grub_efi_status_t + (*locate_protocol) (grub_efi_guid_t *protocol, + void *registration, + void **interface); + + grub_efi_status_t + (*install_multiple_protocol_interfaces) (grub_efi_handle_t *handle, ...); + + grub_efi_status_t + (*uninstall_multiple_protocol_interfaces) (grub_efi_handle_t handle, ...); + + grub_efi_status_t + (*calculate_crc32) (void *data, + grub_efi_uintn_t data_size, + grub_efi_uint32_t *crc32); + + void + (*copy_mem) (void *destination, void *source, grub_efi_uintn_t length); + + void + (*set_mem) (void *buffer, grub_efi_uintn_t size, grub_efi_uint8_t value); +}; +typedef struct grub_efi_boot_services grub_efi_boot_services_t; + +struct grub_efi_runtime_services +{ + grub_efi_table_header_t hdr; + + grub_efi_status_t + (*get_time) (grub_efi_time_t *time, + grub_efi_time_capabilities_t *capabilities); + + grub_efi_status_t + (*set_time) (grub_efi_time_t *time); + + grub_efi_status_t + (*get_wakeup_time) (grub_efi_boolean_t *enabled, + grub_efi_boolean_t *pending, + grub_efi_time_t *time); + + grub_efi_status_t + (*set_wakeup_time) (grub_efi_boolean_t enabled, + grub_efi_time_t *time); + + grub_efi_status_t + (*set_virtual_address_map) (grub_efi_uintn_t memory_map_size, + grub_efi_uintn_t descriptor_size, + grub_efi_uint32_t descriptor_version, + grub_efi_memory_descriptor_t *virtual_map); + + grub_efi_status_t + (*convert_pointer) (grub_efi_uintn_t debug_disposition, void **address); + + grub_efi_status_t + (*get_variable) (grub_efi_char16_t *variable_name, + grub_efi_guid_t *vendor_guid, + grub_efi_uint32_t *attributes, + grub_efi_uintn_t *data_size, + void *data); + + grub_efi_status_t + (*get_next_variable_name) (grub_efi_uintn_t *variable_name_size, + grub_efi_char16_t *variable_name, + grub_efi_guid_t *vendor_guid); + + grub_efi_status_t + (*set_variable) (grub_efi_char16_t *variable_name, + grub_efi_guid_t *vendor_guid, + grub_efi_uint32_t attributes, + grub_efi_uintn_t data_size, + void *data); + + grub_efi_status_t + (*get_next_high_monotonic_count) (grub_efi_uint32_t *high_count); + + void + (*reset_system) (grub_efi_reset_type_t reset_type, + grub_efi_status_t reset_status, + grub_efi_uintn_t data_size, + grub_efi_char16_t *reset_data); +}; +typedef struct grub_efi_runtime_services grub_efi_runtime_services_t; + +struct grub_efi_configuration_table +{ + grub_efi_guid_t vendor_guid; + void *vendor_table; +}; +typedef struct grub_efi_configuration_table grub_efi_configuration_table_t; + +struct grub_efi_simple_input_interface +{ + grub_efi_status_t + (*reset) (struct grub_efi_simple_input_interface *this, + grub_efi_boolean_t extended_verification); + + grub_efi_status_t + (*read_key_stroke) (struct grub_efi_simple_input_interface *this, + grub_efi_input_key_t *key); + + grub_efi_event_t wait_for_key; +}; +typedef struct grub_efi_simple_input_interface grub_efi_simple_input_interface_t; + +struct grub_efi_simple_text_output_interface +{ + grub_efi_status_t + (*reset) (struct grub_efi_simple_text_output_interface *this, + grub_efi_boolean_t extended_verification); + + grub_efi_status_t + (*output_string) (struct grub_efi_simple_text_output_interface *this, + grub_efi_char16_t *string); + + grub_efi_status_t + (*test_string) (struct grub_efi_simple_text_output_interface *this, + grub_efi_char16_t *string); + + grub_efi_status_t + (*query_mode) (struct grub_efi_simple_text_output_interface *this, + grub_efi_uintn_t mode_number, + grub_efi_uintn_t *columns, + grub_efi_uintn_t *rows); + + grub_efi_status_t + (*set_mode) (struct grub_efi_simple_text_output_interface *this, + grub_efi_uintn_t mode_number); + + grub_efi_status_t + (*set_attributes) (struct grub_efi_simple_text_output_interface *this, + grub_efi_uintn_t attribute); + + grub_efi_status_t + (*clear_screen) (struct grub_efi_simple_text_output_interface *this); + + grub_efi_status_t + (*set_cursor_position) (struct grub_efi_simple_text_output_interface *this, + grub_efi_uintn_t column, + grub_efi_uintn_t row); + + grub_efi_status_t + (*enable_cursor) (struct grub_efi_simple_text_output_interface *this, + grub_efi_boolean_t visible); + + grub_efi_simple_text_output_mode_t *mode; +}; +typedef struct grub_efi_simple_text_output_interface grub_efi_simple_text_output_interface_t; + +struct grub_efi_system_table +{ + grub_efi_table_header_t hdr; + grub_efi_char16_t *firmware_vendor; + grub_efi_uint32_t firmware_revision; + grub_efi_handle_t console_in_handler; + grub_efi_simple_input_interface_t *con_in; + grub_efi_handle_t console_out_handler; + grub_efi_simple_text_output_interface_t *con_out; + grub_efi_handle_t standard_error_handle; + grub_efi_simple_text_output_interface_t *std_err; + grub_efi_runtime_services_t *runtime_services; + grub_efi_boot_services_t *boot_services; + grub_efi_uintn_t num_table_entries; + grub_efi_configuration_table_t *configuration_table; +}; +typedef struct grub_efi_system_table grub_efi_system_table_t; + +#endif /* ! GRUB_EFI_API_HEADER */ diff --git a/include/grub/efi/console_control.h b/include/grub/efi/console_control.h new file mode 100644 index 000000000..0c0fb6397 --- /dev/null +++ b/include/grub/efi/console_control.h @@ -0,0 +1,56 @@ +/* console_control.h - definitions of the console control protocol */ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2006 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* The console control protocol is not a part of the EFI spec, + but defined in Intel's Sample Implementation. */ + +#ifndef GRUB_EFI_CONSOLE_CONTROL_HEADER +#define GRUB_EFI_CONSOLE_CONTROL_HEADER 1 + +#define GRUB_EFI_CONSOLE_CONTROL_GUID \ + { 0xf42f7782, 0x12e, 0x4c12, 0x99, 0x56, 0x49, 0xf9, 0x43, 0x4, 0xf7, 0x21 } + +enum grub_efi_screen_mode + { + GRUB_EFI_SCREEN_TEXT, + GRUB_EFI_SCREEN_GRAPHICS, + GRUB_EFI_SCREEN_TEXT_MAX_VALUE + }; +typedef enum grub_efi_screen_mode grub_efi_screen_mode_t; + +struct grub_efi_console_control_protocol +{ + grub_efi_status_t + (*get_mode) (struct grub_efi_console_control_protocol *this, + grub_efi_screen_mode_t *mode, + grub_efi_boolean_t *uga_exists, + grub_efi_boolean_t *std_in_locked); + + grub_efi_status_t + (*set_mode) (struct grub_efi_console_control_protocol *this, + grub_efi_screen_mode_t mode); + + grub_efi_status_t + (*lock_std_in) (struct grub_efi_console_control_protocol *this, + grub_efi_char16_t *password); +}; +typedef struct grub_efi_console_control_protocol grub_efi_console_control_protocol_t; + +#endif /* ! GRUB_EFI_CONSOLE_CONTROL_HEADER */ diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h new file mode 100644 index 000000000..d07ed7d72 --- /dev/null +++ b/include/grub/efi/efi.h @@ -0,0 +1,39 @@ +/* efi.h - declare variables and functions for EFI support */ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2006 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef GRUB_EFI_EFI_HEADER +#define GRUB_EFI_EFI_HEADER 1 + +#include +#include +#include + +/* Functions. */ +void *EXPORT_FUNC(grub_efi_locate_protocol) (grub_efi_guid_t *protocol, + void *registration); +int EXPORT_FUNC(grub_efi_set_text_mode) (int on); +void EXPORT_FUNC(grub_efi_exit) (void) __attribute__((noreturn)); +int EXPORT_FUNC(grub_efi_output_string) (const char *str); + +/* Variables. */ +extern grub_efi_system_table_t *EXPORT_VAR(grub_efi_system_table); +extern grub_efi_handle_t EXPORT_VAR(grub_efi_image_handle); + +#endif /* ! GRUB_EFI_EFI_HEADER */ diff --git a/include/grub/efi/pe32.h b/include/grub/efi/pe32.h new file mode 100644 index 000000000..8eec1fdc6 --- /dev/null +++ b/include/grub/efi/pe32.h @@ -0,0 +1,199 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2006 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef GRUB_EFI_PE32_HEADER +#define GRUB_EFI_PE32_HEADER 1 + +#include + +/* The MSDOS compatibility stub. This was copied from the output of + objcopy, and it is not necessary to care about what this means. */ +#define GRUB_PE32_MSDOS_STUB \ + { \ + 0x4d, 0x5a, 0x90, 0x00, 0x03, 0x00, 0x00, 0x00, \ + 0x04, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, \ + 0xb8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, \ + 0x0e, 0x1f, 0xba, 0x0e, 0x00, 0xb4, 0x09, 0xcd, \ + 0x21, 0xb8, 0x01, 0x4c, 0xcd, 0x21, 0x54, 0x68, \ + 0x69, 0x73, 0x20, 0x70, 0x72, 0x6f, 0x67, 0x72, \ + 0x61, 0x6d, 0x20, 0x63, 0x61, 0x6e, 0x6e, 0x6f, \ + 0x74, 0x20, 0x62, 0x65, 0x20, 0x72, 0x75, 0x6e, \ + 0x20, 0x69, 0x6e, 0x20, 0x44, 0x4f, 0x53, 0x20, \ + 0x6d, 0x6f, 0x64, 0x65, 0x2e, 0x0d, 0x0d, 0x0a, \ + 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 \ + } + +#define GRUB_PE32_MSDOS_STUB_SIZE 0x80 + +/* According to the spec, the minimal alignment is 512 bytes... + But some examples (such as EFI drivers in the Intel + Sample Implementation) use 32 bytes (0x20) instead, and it seems + to be working. For now, GRUB uses 512 bytes for safety. */ +#define GRUB_PE32_SECTION_ALIGNMENT 0x200 +#define GRUB_PE32_FILE_ALIGNMENT GRUB_PE32_SECTION_ALIGNMENT + +struct grub_pe32_coff_header +{ + grub_uint16_t machine; + grub_uint16_t num_sections; + grub_uint32_t time; + grub_uint32_t symtab_offset; + grub_uint32_t num_symbols; + grub_uint16_t optional_header_size; + grub_uint16_t characteristics; +}; + +#define GRUB_PE32_MACHINE_I386 0x14c + +#define GRUB_PE32_RELOCS_STRIPPED 0x0001 +#define GRUB_PE32_EXECUTABLE_IMAGE 0x0002 +#define GRUB_PE32_LINE_NUMS_STRIPPED 0x0004 +#define GRUB_PE32_LOCAL_SYMS_STRIPPED 0x0008 +#define GRUB_PE32_AGGRESSIVE_WS_TRIM 0x0010 +#define GRUB_PE32_LARGE_ADDRESS_AWARE 0x0020 +#define GRUB_PE32_16BIT_MACHINE 0x0040 +#define GRUB_PE32_BYTES_REVERSED_LO 0x0080 +#define GRUB_PE32_32BIT_MACHINE 0x0100 +#define GRUB_PE32_DEBUG_STRIPPED 0x0200 +#define GRUB_PE32_REMOVABLE_RUN_FROM_SWAP 0x0400 +#define GRUB_PE32_SYSTEM 0x1000 +#define GRUB_PE32_DLL 0x2000 +#define GRUB_PE32_UP_SYSTEM_ONLY 0x4000 +#define GRUB_PE32_BYTES_REVERSED_HI 0x8000 + +struct grub_pe32_data_directory +{ + grub_uint32_t rva; + grub_uint32_t size; +}; + +struct grub_pe32_optional_header +{ + grub_uint16_t magic; + grub_uint8_t major_linker_version; + grub_uint8_t minor_linker_version; + grub_uint32_t code_size; + grub_uint32_t data_size; + grub_uint32_t bss_size; + grub_uint32_t entry_addr; + grub_uint32_t code_base; + + grub_uint32_t data_base; + + grub_uint32_t image_base; + grub_uint32_t section_alignment; + grub_uint32_t file_alignment; + grub_uint16_t major_os_version; + grub_uint16_t minor_os_version; + grub_uint16_t major_image_version; + grub_uint16_t minor_image_version; + grub_uint16_t major_subsystem_version; + grub_uint16_t minor_subsystem_version; + grub_uint32_t reserved; + grub_uint32_t image_size; + grub_uint32_t header_size; + grub_uint32_t checksum; + grub_uint16_t subsystem; + grub_uint16_t dll_characteristics; + grub_uint32_t stack_reserve_size; + grub_uint32_t stack_commit_size; + grub_uint32_t heap_reserve_size; + grub_uint32_t heap_commit_size; + grub_uint32_t loader_flags; + grub_uint32_t num_data_directories; + + /* Data directories. */ + struct grub_pe32_data_directory export_table; + struct grub_pe32_data_directory import_table; + struct grub_pe32_data_directory resource_table; + struct grub_pe32_data_directory exception_table; + struct grub_pe32_data_directory certificate_table; + struct grub_pe32_data_directory base_relocation_table; + struct grub_pe32_data_directory debug; + struct grub_pe32_data_directory architecture; + struct grub_pe32_data_directory global_ptr; + struct grub_pe32_data_directory tls_table; + struct grub_pe32_data_directory load_config_table; + struct grub_pe32_data_directory bound_import; + struct grub_pe32_data_directory iat; + struct grub_pe32_data_directory delay_import_descriptor; + struct grub_pe32_data_directory com_runtime_header; + struct grub_pe32_data_directory reserved_entry; +}; + +#define GRUB_PE32_PE32_MAGIC 0x10b + +#define GRUB_PE32_SUBSYSTEM_EFI_APPLICATION 10 + +#define GRUB_PE32_NUM_DATA_DIRECTORIES 16 + +struct grub_pe32_section_table +{ + char name[8]; + grub_uint32_t virtual_size; + grub_uint32_t virtual_address; + grub_uint32_t raw_data_size; + grub_uint32_t raw_data_offset; + grub_uint32_t relocations_offset; + grub_uint32_t line_numbers_offset; + grub_uint16_t num_relocations; + grub_uint16_t num_line_numbers; + grub_uint32_t characteristics; +}; + +#define GRUB_PE32_SCN_CNT_CODE 0x00000020 +#define GRUB_PE32_SCN_CNT_INITIALIZED_DATA 0x00000040 +#define GRUB_PE32_SCN_MEM_DISCARDABLE 0x02000000 +#define GRUB_PE32_SCN_MEM_EXECUTE 0x20000000 +#define GRUB_PE32_SCN_MEM_READ 0x40000000 +#define GRUB_PE32_SCN_MEM_WRITE 0x80000000 + +struct grub_pe32_header +{ + /* This should be filled in with GRUB_PE32_MSDOS_STUB. */ + grub_uint8_t msdos_stub[GRUB_PE32_MSDOS_STUB_SIZE]; + + /* This is always PE\0\0. */ + char signature[4]; + + /* The COFF file header. */ + struct grub_pe32_coff_header coff_header; + + /* The Optional header. */ + struct grub_pe32_optional_header optional_header; +}; + +struct grub_pe32_fixup_block +{ + grub_uint32_t page_rva; + grub_uint32_t block_size; + grub_uint16_t entries[0]; +}; + +#define GRUB_PE32_FIXUP_ENTRY(type, offset) (((type) << 12) | (offset)) + +#define GRUB_PE32_REL_BASED_ABSOLUTE 0 +#define GRUB_PE32_REL_BASED_HIGHLOW 3 + +#endif /* ! GRUB_EFI_PE32_HEADER */ diff --git a/include/grub/i386/efi/time.h b/include/grub/i386/efi/time.h new file mode 100644 index 000000000..885ad498d --- /dev/null +++ b/include/grub/i386/efi/time.h @@ -0,0 +1,31 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2006 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + */ + +#ifndef KERNEL_TIME_HEADER +#define KERNEL_TIME_HEADER 1 + +#include + +#define GRUB_TICKS_PER_SECOND 1193 + +/* Return the real time in ticks. */ +grub_uint32_t EXPORT_FUNC (grub_get_rtc) (void); + +#endif /* ! KERNEL_TIME_HEADER */ diff --git a/kern/efi/efi.c b/kern/efi/efi.c new file mode 100644 index 000000000..228ded759 --- /dev/null +++ b/kern/efi/efi.c @@ -0,0 +1,97 @@ +/* efi.c - generic EFI support */ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2006 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include + +/* The handle of GRUB itself. Filled in by the startup code. */ +grub_efi_handle_t grub_efi_image_handle; + +/* The pointer to a system table. Filled in by the startup code. */ +grub_efi_system_table_t *grub_efi_system_table; + +static grub_efi_guid_t grub_efi_console_control_guid = GRUB_EFI_CONSOLE_CONTROL_GUID; + +void * +grub_efi_locate_protocol (grub_efi_guid_t *protocol, void *registration) +{ + void *interface; + grub_efi_status_t status; + + status = grub_efi_system_table->boot_services->locate_protocol (protocol, + registration, + &interface); + if (status != GRUB_EFI_SUCCESS) + return 0; + + return interface; +} + +int +grub_efi_set_text_mode (int on) +{ + grub_efi_console_control_protocol_t *c; + grub_efi_screen_mode_t mode, new_mode; + + c = grub_efi_locate_protocol (&grub_efi_console_control_guid, 0); + if (! c) + return 0; + + if (c->get_mode (c, &mode, 0, 0) != GRUB_EFI_SUCCESS) + return 0; + + new_mode = on ? GRUB_EFI_SCREEN_TEXT : GRUB_EFI_SCREEN_GRAPHICS; + if (mode != new_mode) + if (c->set_mode (c, new_mode) != GRUB_EFI_SUCCESS) + return 0; + + return 1; +} + +void +grub_efi_exit (void) +{ + grub_efi_system_table->boot_services->exit (grub_efi_image_handle, + GRUB_EFI_SUCCESS, + 0, 0); +} + +int +grub_efi_output_string (const char *str) +{ + grub_efi_simple_text_output_interface_t *o; + grub_size_t len = grub_strlen (str); + grub_efi_char16_t utf16_str[len + 1]; + grub_efi_status_t status; + + /* XXX Assume that STR is all ASCII characters. */ + do + { + utf16_str[len] = str[len]; + } + while (len--); + + o = grub_efi_system_table->con_out; + status = o->output_string (o, utf16_str); + return status >= 0; +} + diff --git a/kern/i386/efi/init.c b/kern/i386/efi/init.c new file mode 100644 index 000000000..c19262208 --- /dev/null +++ b/kern/i386/efi/init.c @@ -0,0 +1,69 @@ +/* init.c - initialize an x86-based EFI system */ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2006 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +void +grub_stop (void) +{ + grub_efi_exit (); +} + +grub_uint32_t +grub_get_rtc (void) +{ + return 0; /* FIXME */ +} + +void +grub_machine_init (void) +{ + grub_efi_set_text_mode (1); + grub_efi_output_string ("test!\r\n"); + + /* Stop immediately at the moment... */ + grub_stop (); +} + +void +grub_machine_fini (void) +{ +} + +void +grub_arch_sync_caches (void *address __attribute__ ((unused)), + grub_size_t len __attribute__ ((unused))) +{ +} + +grub_addr_t +grub_arch_modules_addr (void) +{ + return 0; +} diff --git a/kern/i386/efi/startup.S b/kern/i386/efi/startup.S new file mode 100644 index 000000000..6326ba5b7 --- /dev/null +++ b/kern/i386/efi/startup.S @@ -0,0 +1,65 @@ +/* startup.S - bootstrap GRUB itself */ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2006 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include + + .file "startup.S" + .text + .globl start, _start +start: +_start: + jmp codestart + + /* + * Compatibility version number + * + * These MUST be at byte offset 6 and 7 of the executable + * DO NOT MOVE !!! + */ + . = EXT_C(start) + 0x6 + .byte GRUB_BOOT_VERSION_MAJOR, GRUB_BOOT_VERSION_MINOR + + /* + * This is a special data area 8 bytes from the beginning. + */ + + . = EXT_C(start) + 0x8 + +VARIABLE(grub_prefix) + .string "/boot/grub" + + /* + * Leave some breathing room for the prefix. + */ + + . = EXT_C(start) + 0x50 + +codestart: + /* + * EFI_SYSTEM_TABLE * and EFI_HANDLE are passed on the stack. + */ + movl 4(%esp), %eax + movl %eax, EXT_C(grub_efi_image_handle) + movl 8(%esp), %eax + movl %eax, EXT_C(grub_efi_system_table) + call EXT_C(grub_main) + ret diff --git a/util/i386/efi/grub-mkimage.c b/util/i386/efi/grub-mkimage.c new file mode 100644 index 000000000..72abda64e --- /dev/null +++ b/util/i386/efi/grub-mkimage.c @@ -0,0 +1,939 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2004,2005,2006 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static const grub_uint8_t stub[] = GRUB_PE32_MSDOS_STUB; + +static inline Elf32_Addr +align_address (Elf32_Addr addr, unsigned alignment) +{ + return (addr + alignment - 1) & ~(alignment - 1); +} + +static inline Elf32_Addr +align_pe32_section (Elf32_Addr addr) +{ + return align_address (addr, GRUB_PE32_SECTION_ALIGNMENT); +} + +/* Read the whole kernel image. Return the pointer to a read image, + and store the size in bytes in *SIZE. */ +static char * +read_kernel_module (const char *dir, size_t *size) +{ + char *kernel_image; + char *kernel_path; + + kernel_path = grub_util_get_path (dir, "kernel.mod"); + *size = grub_util_get_image_size (kernel_path); + kernel_image = grub_util_read_image (kernel_path); + free (kernel_path); + + return kernel_image; +} + +/* Return if the ELF header is valid. */ +static int +check_elf_header (Elf32_Ehdr *e, size_t size) +{ + if (size < sizeof (*e) + || e->e_ident[EI_MAG0] != ELFMAG0 + || e->e_ident[EI_MAG1] != ELFMAG1 + || e->e_ident[EI_MAG2] != ELFMAG2 + || e->e_ident[EI_MAG3] != ELFMAG3 + || e->e_ident[EI_VERSION] != EV_CURRENT + || e->e_version != grub_cpu_to_le32 (EV_CURRENT) + || e->e_ident[EI_CLASS] != ELFCLASS32 + || e->e_ident[EI_DATA] != ELFDATA2LSB + || e->e_machine != grub_cpu_to_le16 (EM_386)) + return 0; + + return 1; +} + +/* Return the starting address right after the header, + aligned by the section alignment. Allocate 4 section tables for + .text, .data, .reloc, and mods. */ +static Elf32_Addr +get_starting_section_address (void) +{ + return align_pe32_section (sizeof (struct grub_pe32_header) + + 4 * sizeof (struct grub_pe32_section_table)); +} + +/* Determine if this section is a text section. Return false if this + section is not allocated. */ +static int +is_text_section (Elf32_Shdr *s) +{ + return ((s->sh_flags & grub_cpu_to_le32 (SHF_EXECINSTR | SHF_ALLOC)) + == grub_cpu_to_le32 (SHF_EXECINSTR | SHF_ALLOC)); +} + +/* Determine if this section is a data section. This assumes that + BSS is also a data section, since the converter initializes BSS + when producing PE32 to avoid a bug in EFI implementations. */ +static int +is_data_section (Elf32_Shdr *s) +{ + return (s->sh_flags & grub_cpu_to_le32 (SHF_ALLOC) + && ! (s->sh_flags & grub_cpu_to_le32 (SHF_EXECINSTR))); +} + +/* Locate section addresses by merging code sections and data sections + into .text and .data, respectively. Return the array of section + addresses. */ +static Elf32_Addr * +locate_sections (Elf32_Shdr *sections, Elf32_Half section_entsize, + Elf32_Half num_sections, const char *strtab) +{ + int i; + Elf32_Addr current_address; + Elf32_Addr *section_addresses; + Elf32_Shdr *s; + + section_addresses = xmalloc (sizeof (*section_addresses) * num_sections); + memset (section_addresses, 0, sizeof (*section_addresses) * num_sections); + + current_address = get_starting_section_address (); + + /* .text */ + for (i = 0, s = sections; + i < num_sections; + i++, s = (Elf32_Shdr *) ((char *) s + section_entsize)) + if (is_text_section (s)) + { + Elf32_Word align = grub_le_to_cpu32 (s->sh_addralign); + const char *name = strtab + grub_le_to_cpu32 (s->sh_name); + + if (align) + current_address = align_address (current_address, align); + + grub_util_info ("locating the section %s at 0x%x", + name, current_address); + section_addresses[i] = current_address; + current_address += grub_le_to_cpu32 (s->sh_size); + } + + current_address = align_pe32_section (current_address); + + /* .data */ + for (i = 0, s = sections; + i < num_sections; + i++, s = (Elf32_Shdr *) ((char *) s + section_entsize)) + if (is_data_section (s)) + { + Elf32_Word align = grub_le_to_cpu32 (s->sh_addralign); + const char *name = strtab + grub_le_to_cpu32 (s->sh_name); + + if (align) + current_address = align_address (current_address, align); + + grub_util_info ("locating the section %s at 0x%x", + name, current_address); + section_addresses[i] = current_address; + current_address += grub_le_to_cpu32 (s->sh_size); + } + + return section_addresses; +} + +/* Return the symbol table section, if any. */ +static Elf32_Shdr * +find_symtab_section (Elf32_Shdr *sections, + Elf32_Half section_entsize, Elf32_Half num_sections) +{ + int i; + Elf32_Shdr *s; + + for (i = 0, s = sections; + i < num_sections; + i++, s = (Elf32_Shdr *) ((char *) s + section_entsize)) + if (s->sh_type == grub_cpu_to_le32 (SHT_SYMTAB)) + return s; + + return 0; +} + +/* Return the address of the string table. */ +static const char * +find_strtab (Elf32_Ehdr *e, Elf32_Shdr *sections, Elf32_Half section_entsize) +{ + Elf32_Shdr *s; + char *strtab; + + s = (Elf32_Shdr *) ((char *) sections + + grub_le_to_cpu16 (e->e_shstrndx) * section_entsize); + strtab = (char *) e + grub_le_to_cpu32 (s->sh_offset); + return strtab; +} + +/* Relocate symbols; note that this function overwrites the symbol table. + Return the address of a start symbol. */ +static Elf32_Addr +relocate_symbols (Elf32_Ehdr *e, Elf32_Shdr *sections, + Elf32_Shdr *symtab_section, Elf32_Addr *section_addresses, + Elf32_Half section_entsize, Elf32_Half num_sections) +{ + Elf32_Word symtab_size, sym_size, num_syms; + Elf32_Off symtab_offset; + Elf32_Addr start_address = 0; + Elf32_Sym *sym; + Elf32_Word i; + Elf32_Shdr *strtab_section; + const char *strtab; + + strtab_section + = (Elf32_Shdr *) ((char *) sections + + (grub_le_to_cpu32 (symtab_section->sh_link) + * section_entsize)); + strtab = (char *) e + grub_le_to_cpu32 (strtab_section->sh_offset); + + symtab_size = grub_le_to_cpu32 (symtab_section->sh_size); + sym_size = grub_le_to_cpu32 (symtab_section->sh_entsize); + symtab_offset = grub_le_to_cpu32 (symtab_section->sh_offset); + num_syms = symtab_size / sym_size; + + for (i = 0, sym = (Elf32_Sym *) ((char *) e + symtab_offset); + i < num_syms; + i++, sym = (Elf32_Sym *) ((char *) sym + sym_size)) + { + Elf32_Section index; + const char *name; + + name = strtab + grub_le_to_cpu32 (sym->st_name); + + index = grub_le_to_cpu16 (sym->st_shndx); + if (index == STN_UNDEF) + { + if (sym->st_name) + grub_util_error ("undefined symbol %s", name); + else + continue; + } + else if (index >= num_sections) + grub_util_error ("section %d does not exist", index); + + sym->st_value = (grub_le_to_cpu32 (sym->st_value) + + section_addresses[index]); + grub_util_info ("locating %s at 0x%x", name, sym->st_value); + + if (! start_address) + if (strcmp (name, "_start") == 0 || strcmp (name, "start") == 0) + start_address = sym->st_value; + } + + return start_address; +} + +/* Return the address of a symbol at the index I in the section S. */ +static Elf32_Addr +get_symbol_address (Elf32_Ehdr *e, Elf32_Shdr *s, Elf32_Word i) +{ + Elf32_Sym *sym; + + sym = (Elf32_Sym *) ((char *) e + + grub_le_to_cpu32 (s->sh_offset) + + i * grub_le_to_cpu32 (s->sh_entsize)); + return sym->st_value; +} + +/* Return the address of a modified value. */ +static Elf32_Addr +get_target_address (Elf32_Ehdr *e, Elf32_Shdr *s, Elf32_Addr offset) +{ + return (Elf32_Addr) e + grub_le_to_cpu32 (s->sh_offset) + offset; +} + +/* Deal with relocation information. This function relocates addresses + within the virtual address space starting from 0. So only relative + addresses can be fully resolved. Absolute addresses must be relocated + again by a PE32 relocator when loaded. */ +static void +relocate_addresses (Elf32_Ehdr *e, Elf32_Shdr *sections, + Elf32_Addr *section_addresses, + Elf32_Half section_entsize, Elf32_Half num_sections, + const char *strtab) +{ + Elf32_Half i; + Elf32_Shdr *s; + + for (i = 0, s = sections; + i < num_sections; + i++, s = (Elf32_Shdr *) ((char *) s + section_entsize)) + if (s->sh_type == grub_cpu_to_le32 (SHT_REL)) + { + Elf32_Rel *r; + Elf32_Word rtab_size, r_size, num_rs; + Elf32_Off rtab_offset; + Elf32_Shdr *symtab_section; + Elf32_Word target_section_index; + Elf32_Addr target_section_addr; + Elf32_Shdr *target_section; + Elf32_Word j; + + symtab_section = (Elf32_Shdr *) ((char *) sections + + (grub_le_to_cpu32 (s->sh_link) + * section_entsize)); + target_section_index = grub_le_to_cpu32 (s->sh_info); + target_section_addr = section_addresses[target_section_index]; + target_section = (Elf32_Shdr *) ((char *) sections + + (target_section_index + * section_entsize)); + + grub_util_info ("dealing with the relocation section %s for %s", + strtab + grub_le_to_cpu32 (s->sh_name), + strtab + grub_le_to_cpu32 (target_section->sh_name)); + + rtab_size = grub_le_to_cpu32 (s->sh_size); + r_size = grub_le_to_cpu32 (s->sh_entsize); + rtab_offset = grub_le_to_cpu32 (s->sh_offset); + num_rs = rtab_size / r_size; + + for (j = 0, r = (Elf32_Rel *) ((char *) e + rtab_offset); + j < num_rs; + j++, r = (Elf32_Rel *) ((char *) r + r_size)) + { + Elf32_Word info; + Elf32_Addr offset; + Elf32_Addr sym_addr; + Elf32_Addr *target; + + offset = grub_le_to_cpu32 (r->r_offset); + target = (Elf32_Addr *) get_target_address (e, target_section, + offset); + info = grub_le_to_cpu32 (r->r_info); + sym_addr = get_symbol_address (e, symtab_section, + ELF32_R_SYM (info)); + + switch (ELF32_R_TYPE (info)) + { + case R_386_NONE: + break; + + case R_386_32: + /* This is absolute. */ + *target = grub_cpu_to_le32 (grub_le_to_cpu32 (*target) + + sym_addr); + grub_util_info ("relocating an R_386_32 entry to 0x%x at the offset 0x%x", + *target, offset); + break; + + case R_386_PC32: + /* This is relative. */ + *target = grub_cpu_to_le32 (grub_le_to_cpu32 (*target) + + sym_addr + - target_section_addr - offset); + grub_util_info ("relocating an R_386_PC32 entry to 0x%x at the offset 0x%x", + *target, offset); + break; + + default: + grub_util_error ("unknown relocation type %d", + ELF32_R_TYPE (info)); + break; + } + } + } +} + +void +write_padding (FILE *out, size_t size) +{ + size_t i; + + for (i = 0; i < size; i++) + if (fputc (0, out) == EOF) + grub_util_error ("padding failed"); +} + +/* Add a PE32's fixup entry for a relocation. Return the resulting address + after having written to the file OUT. */ +Elf32_Addr +add_fixup_entry (struct grub_pe32_fixup_block **block, grub_uint16_t type, + Elf32_Addr addr, int flush, Elf32_Addr current_address, + FILE *out) +{ + struct grub_pe32_fixup_block *b = *block; + + /* First, check if it is necessary to write out the current block. */ + if (b) + { + if (flush || addr < b->page_rva || b->page_rva + 0x1000 <= addr) + { + grub_uint32_t size; + + if (flush) + { + /* Add as much padding as necessary to align the address + with a section boundary. */ + Elf32_Addr next_address; + unsigned padding_size; + size_t index; + + next_address = current_address + b->block_size; + padding_size = ((align_pe32_section (next_address) + - next_address) + >> 1); + index = ((b->block_size - sizeof (*b)) >> 1); + grub_util_info ("adding %d padding fixup entries", padding_size); + while (padding_size--) + { + b->entries[index++] = 0; + b->block_size += 2; + } + } + else if (b->block_size & (8 - 1)) + { + /* If not aligned with a 32-bit boundary, add + a padding entry. */ + size_t index; + + grub_util_info ("adding a padding fixup entry"); + index = ((b->block_size - sizeof (*b)) >> 1); + b->entries[index] = 0; + b->block_size += 2; + } + + /* Flush it. */ + grub_util_info ("writing %d bytes of a fixup block starting at 0x%x", + b->block_size, b->page_rva); + size = b->block_size; + current_address += size; + b->page_rva = grub_cpu_to_le32 (b->page_rva); + b->block_size = grub_cpu_to_le32 (b->block_size); + if (fwrite (b, size, 1, out) != 1) + grub_util_error ("write failed"); + free (b); + *block = b = 0; + } + } + + if (! flush) + { + grub_uint16_t entry; + size_t index; + + /* If not allocated yet, allocate a block with enough entries. */ + if (! b) + { + *block = b = xmalloc (sizeof (*b) + 2 * 0x1000); + + /* The spec does not mention the requirement of a Page RVA. + Here, align the address with a 4K boundary for safety. */ + b->page_rva = (addr & ~(0x1000 - 1)); + b->block_size = sizeof (*b); + } + + /* Sanity check. */ + if (b->block_size >= sizeof (*b) + 2 * 0x1000) + grub_util_error ("too many fixup entries"); + + /* Add a new entry. */ + index = ((b->block_size - sizeof (*b)) >> 1); + entry = GRUB_PE32_FIXUP_ENTRY (type, addr - b->page_rva); + b->entries[index] = grub_cpu_to_le16 (entry); + b->block_size += 2; + } + + return current_address; +} + +/* Write out zeros to make space for the header. */ +static Elf32_Addr +make_header_space (FILE *out) +{ + Elf32_Addr addr; + + addr = get_starting_section_address (); + write_padding (out, addr); + + return addr; +} + +/* Write text sections. */ +static Elf32_Addr +write_text_sections (FILE *out, Elf32_Addr current_address, + Elf32_Ehdr *e, Elf32_Shdr *sections, + Elf32_Half section_entsize, Elf32_Half num_sections, + const char *strtab) +{ + Elf32_Half i; + Elf32_Shdr *s; + Elf32_Addr addr; + + for (i = 0, s = sections; + i < num_sections; + i++, s = (Elf32_Shdr *) ((char *) s + section_entsize)) + if (is_text_section (s)) + { + Elf32_Word align = grub_le_to_cpu32 (s->sh_addralign); + Elf32_Off offset = grub_le_to_cpu32 (s->sh_offset); + Elf32_Word size = grub_le_to_cpu32 (s->sh_size); + const char *name = strtab + grub_le_to_cpu32 (s->sh_name); + + if (align) + { + addr = align_address (current_address, align); + if (current_address != addr) + { + grub_util_info ("padding %d bytes for the ELF section alignment", + addr - current_address); + write_padding (out, addr - current_address); + current_address = addr; + } + } + + grub_util_info ("writing the text section %s at 0x%x", + name, current_address); + + if (fwrite ((char *) e + offset, size, 1, out) != 1) + grub_util_error ("write failed"); + + current_address += size; + } + + addr = align_pe32_section (current_address); + if (addr != current_address) + { + grub_util_info ("padding %d bytes for the PE32 section alignment", + addr - current_address); + write_padding (out, addr - current_address); + } + + return addr; +} + +/* Write data sections. */ +static Elf32_Addr +write_data_sections (FILE *out, Elf32_Addr current_address, + Elf32_Ehdr *e, Elf32_Shdr *sections, + Elf32_Half section_entsize, Elf32_Half num_sections, + const char *strtab) +{ + Elf32_Half i; + Elf32_Shdr *s; + Elf32_Addr addr; + + for (i = 0, s = sections; + i < num_sections; + i++, s = (Elf32_Shdr *) ((char *) s + section_entsize)) + if (is_data_section (s)) + { + Elf32_Word align = grub_le_to_cpu32 (s->sh_addralign); + Elf32_Off offset = grub_le_to_cpu32 (s->sh_offset); + Elf32_Word size = grub_le_to_cpu32 (s->sh_size); + const char *name = strtab + grub_le_to_cpu32 (s->sh_name); + + if (align) + { + addr = align_address (current_address, align); + if (current_address != addr) + { + grub_util_info ("padding %d bytes for the ELF section alignment", + addr - current_address); + write_padding (out, addr - current_address); + current_address = addr; + } + } + + grub_util_info ("writing the data section %s at 0x%x", + name, current_address); + + if (s->sh_type == grub_cpu_to_le32 (SHT_NOBITS)) + write_padding (out, size); + else + if (fwrite ((char *) e + offset, size, 1, out) != 1) + grub_util_error ("write failed"); + + current_address += size; + } + + addr = align_pe32_section (current_address); + if (addr != current_address) + { + grub_util_info ("padding %d bytes for the PE32 section alignment", + addr - current_address); + write_padding (out, addr - current_address); + } + + return addr; +} + +/* Write modules. */ +static Elf32_Addr +make_mods_section (FILE *out, Elf32_Addr current_address, char *mods[]) +{ + /* FIXME: not implemented yet. */ + (void) mods; + write_padding (out, GRUB_PE32_SECTION_ALIGNMENT); + current_address += GRUB_PE32_SECTION_ALIGNMENT; + + return current_address; +} + +/* Make a .reloc section. */ +static Elf32_Addr +make_reloc_section (FILE *out, Elf32_Addr current_address, Elf32_Ehdr *e, + Elf32_Addr *section_addresses, Elf32_Shdr *sections, + Elf32_Half section_entsize, Elf32_Half num_sections, + const char *strtab) +{ + Elf32_Half i; + Elf32_Shdr *s; + struct grub_pe32_fixup_block *fixup_block = 0; + + for (i = 0, s = sections; + i < num_sections; + i++, s = (Elf32_Shdr *) ((char *) s + section_entsize)) + if (s->sh_type == grub_cpu_to_le32 (SHT_REL)) + { + Elf32_Rel *r; + Elf32_Word rtab_size, r_size, num_rs; + Elf32_Off rtab_offset; + Elf32_Addr section_address; + Elf32_Word j; + + grub_util_info ("translating the relocation section %s", + strtab + grub_le_to_cpu32 (s->sh_name)); + + rtab_size = grub_le_to_cpu32 (s->sh_size); + r_size = grub_le_to_cpu32 (s->sh_entsize); + rtab_offset = grub_le_to_cpu32 (s->sh_offset); + num_rs = rtab_size / r_size; + + section_address = section_addresses[grub_le_to_cpu32 (s->sh_info)]; + + for (j = 0, r = (Elf32_Rel *) ((char *) e + rtab_offset); + j < num_rs; + j++, r = (Elf32_Rel *) ((char *) r + r_size)) + { + Elf32_Word info; + Elf32_Addr offset; + + offset = grub_le_to_cpu32 (r->r_offset); + info = grub_le_to_cpu32 (r->r_info); + + /* Necessary to relocate only absolute addresses. */ + if (ELF32_R_TYPE (info) == R_386_32) + { + Elf32_Addr addr; + + addr = section_address + offset; + grub_util_info ("adding a relocation entry for 0x%x", addr); + current_address = add_fixup_entry (&fixup_block, + GRUB_PE32_REL_BASED_HIGHLOW, + addr, 0, current_address, + out); + } + } + } + + current_address = add_fixup_entry (&fixup_block, 0, 0, 1, + current_address, out); + + return current_address; +} + +/* Create the header. */ +static void +make_header (FILE *out, Elf32_Addr text_address, Elf32_Addr data_address, + Elf32_Addr mods_address, Elf32_Addr reloc_address, + Elf32_Addr end_address, Elf32_Addr start_address) +{ + struct grub_pe32_header header; + struct grub_pe32_coff_header *c; + struct grub_pe32_optional_header *o; + struct grub_pe32_section_table text_section, data_section; + struct grub_pe32_section_table mods_section, reloc_section; + + /* The magic. */ + memset (&header, 0, sizeof (header)); + memcpy (header.msdos_stub, stub, sizeof (header.msdos_stub)); + memcpy (header.signature, "PE\0\0", sizeof (header.signature)); + + /* The COFF file header. */ + c = &header.coff_header; + c->machine = grub_cpu_to_le16 (GRUB_PE32_MACHINE_I386); + c->num_sections = grub_cpu_to_le16 (4); + c->time = grub_cpu_to_le32 (time (0)); + c->optional_header_size = grub_cpu_to_le16 (sizeof (header.optional_header)); + c->characteristics = grub_cpu_to_le16 (GRUB_PE32_EXECUTABLE_IMAGE + | GRUB_PE32_LINE_NUMS_STRIPPED + | GRUB_PE32_LOCAL_SYMS_STRIPPED + | GRUB_PE32_32BIT_MACHINE); + + /* The PE Optional header. */ + o = &header.optional_header; + o->magic = grub_cpu_to_le16 (GRUB_PE32_PE32_MAGIC); + o->code_size = grub_cpu_to_le32 (data_address - text_address); + o->data_size = grub_cpu_to_le32 (reloc_address - data_address); + o->bss_size = 0; + o->entry_addr = grub_cpu_to_le32 (start_address); + o->code_base = grub_cpu_to_le32 (text_address); + o->data_base = grub_cpu_to_le32 (data_address); + o->image_base = 0; + o->section_alignment = grub_cpu_to_le32 (GRUB_PE32_SECTION_ALIGNMENT); + o->file_alignment = grub_cpu_to_le32 (GRUB_PE32_FILE_ALIGNMENT); + o->image_size = grub_cpu_to_le32 (end_address); + o->header_size = grub_cpu_to_le32 (text_address); + o->subsystem = grub_cpu_to_le16 (GRUB_PE32_SUBSYSTEM_EFI_APPLICATION); + + /* Do these really matter? */ + o->stack_reserve_size = grub_cpu_to_le32 (0x10000); + o->stack_commit_size = grub_cpu_to_le32 (0x10000); + o->heap_reserve_size = grub_cpu_to_le32 (0x10000); + o->heap_commit_size = grub_cpu_to_le32 (0x10000); + + o->num_data_directories = grub_cpu_to_le32 (GRUB_PE32_NUM_DATA_DIRECTORIES); + + o->base_relocation_table.rva = grub_cpu_to_le32 (reloc_address); + o->base_relocation_table.size = grub_cpu_to_le32 (end_address + - reloc_address); + + /* The sections. */ + memset (&text_section, 0, sizeof (text_section)); + strcpy (text_section.name, ".text"); + text_section.virtual_size = grub_cpu_to_le32 (data_address - text_address); + text_section.virtual_address = grub_cpu_to_le32 (text_address); + text_section.raw_data_size = grub_cpu_to_le32 (data_address - text_address); + text_section.raw_data_offset = grub_cpu_to_le32 (text_address); + text_section.characteristics = grub_cpu_to_le32 (GRUB_PE32_SCN_CNT_CODE + | GRUB_PE32_SCN_MEM_EXECUTE + | GRUB_PE32_SCN_MEM_READ); + + memset (&data_section, 0, sizeof (data_section)); + strcpy (data_section.name, ".data"); + data_section.virtual_size = grub_cpu_to_le32 (mods_address - data_address); + data_section.virtual_address = grub_cpu_to_le32 (data_address); + data_section.raw_data_size = grub_cpu_to_le32 (mods_address - data_address); + data_section.raw_data_offset = grub_cpu_to_le32 (data_address); + data_section.characteristics + = grub_cpu_to_le32 (GRUB_PE32_SCN_CNT_INITIALIZED_DATA + | GRUB_PE32_SCN_MEM_READ + | GRUB_PE32_SCN_MEM_WRITE); + + memset (&mods_section, 0, sizeof (mods_section)); + strcpy (mods_section.name, "mods"); + mods_section.virtual_size = grub_cpu_to_le32 (reloc_address - mods_address); + mods_section.virtual_address = grub_cpu_to_le32 (mods_address); + mods_section.raw_data_size = grub_cpu_to_le32 (reloc_address - mods_address); + mods_section.raw_data_offset = grub_cpu_to_le32 (mods_address); + mods_section.characteristics + = grub_cpu_to_le32 (GRUB_PE32_SCN_CNT_INITIALIZED_DATA + | GRUB_PE32_SCN_MEM_READ + | GRUB_PE32_SCN_MEM_WRITE); + + memset (&reloc_section, 0, sizeof (reloc_section)); + strcpy (reloc_section.name, ".reloc"); + reloc_section.virtual_size = grub_cpu_to_le32 (end_address - reloc_address); + reloc_section.virtual_address = grub_cpu_to_le32 (reloc_address); + reloc_section.raw_data_size = grub_cpu_to_le32 (end_address - reloc_address); + reloc_section.raw_data_offset = grub_cpu_to_le32 (reloc_address); + reloc_section.characteristics + = grub_cpu_to_le32 (GRUB_PE32_SCN_CNT_INITIALIZED_DATA + | GRUB_PE32_SCN_MEM_DISCARDABLE + | GRUB_PE32_SCN_MEM_READ); + + /* Write them out. */ + if (fseek (out, 0, SEEK_SET) < 0) + grub_util_error ("seek failed"); + + if (fwrite (&header, sizeof (header), 1, out) != 1 + || fwrite (&text_section, sizeof (text_section), 1, out) != 1 + || fwrite (&data_section, sizeof (data_section), 1, out) != 1 + || fwrite (&mods_section, sizeof (mods_section), 1, out) != 1 + || fwrite (&reloc_section, sizeof (reloc_section), 1, out) != 1) + grub_util_error ("write failed"); +} + +/* Convert an ELF relocatable object into an EFI Application (PE32). */ +void +convert_elf (const char *dir, FILE *out, char *mods[]) +{ + char *kernel_image; + size_t kernel_size; + const char *strtab; + Elf32_Ehdr *e; + Elf32_Shdr *sections; + Elf32_Off section_offset; + Elf32_Half section_entsize; + Elf32_Half num_sections; + Elf32_Addr *section_addresses; + Elf32_Shdr *symtab_section; + Elf32_Addr start_address; + Elf32_Addr text_address, data_address, reloc_address, mods_address; + Elf32_Addr end_address; + + /* Get the kernel image and check the format. */ + kernel_image = read_kernel_module (dir, &kernel_size); + e = (Elf32_Ehdr *) kernel_image; + if (! check_elf_header (e, kernel_size)) + grub_util_error ("invalid ELF header"); + + section_offset = grub_cpu_to_le32 (e->e_shoff); + section_entsize = grub_cpu_to_le16 (e->e_shentsize); + num_sections = grub_cpu_to_le16 (e->e_shnum); + if (kernel_size < section_offset + section_entsize * num_sections) + grub_util_error ("invalid ELF format"); + + sections = (Elf32_Shdr *) (kernel_image + section_offset); + strtab = find_strtab (e, sections, section_entsize); + + /* Relocate sections then symbols in the virtual address space. */ + section_addresses = locate_sections (sections, section_entsize, + num_sections, strtab); + + symtab_section = find_symtab_section (sections, + section_entsize, num_sections); + if (! symtab_section) + grub_util_error ("no symbol table"); + + start_address = relocate_symbols (e, sections, symtab_section, + section_addresses, section_entsize, + num_sections); + if (start_address == 0) + grub_util_error ("start symbol is not defined"); + + /* Resolve addresses in the virtual address space. */ + relocate_addresses (e, sections, section_addresses, section_entsize, + num_sections, strtab); + + /* Generate a PE32 image file. The strategy is to dump binary data first, + then fill up the header. */ + text_address = make_header_space (out); + data_address = write_text_sections (out, text_address, e, sections, + section_entsize, num_sections, + strtab); + mods_address = write_data_sections (out, data_address, e, sections, + section_entsize, num_sections, + strtab); + reloc_address = make_mods_section (out, mods_address, mods); + end_address = make_reloc_section (out, reloc_address, e, section_addresses, + sections, section_entsize, num_sections, + strtab); + make_header (out, text_address, data_address, mods_address, + reloc_address, end_address, start_address); + + /* Clean up. */ + free (section_addresses); + free (kernel_image); +} + +static struct option options[] = + { + {"directory", required_argument, 0, 'd'}, + {"output", required_argument, 0, 'o'}, + {"help", no_argument, 0, 'h'}, + {"version", no_argument, 0, 'V'}, + {"verbose", no_argument, 0, 'v'}, + { 0, 0, 0, 0 } + }; + +static void +usage (int status) +{ + if (status) + fprintf (stderr, "Try ``grub-mkimage --help'' for more information.\n"); + else + printf ("\ +Usage: grub-mkimage -o FILE [OPTION]... [MODULES]\n\ +\n\ +Make a bootable image of GRUB.\n\ +\n\ +-d, --directory=DIR use images and modules under DIR [default=%s]\n\ +-o, --output=FILE output a generated image to FILE\n\ +-h, --help display this message and exit\n\ +-V, --version print version information and exit\n\ +-v, --verbose print verbose messages\n\ +\n\ +Report bugs to <%s>.\n\ +", GRUB_DATADIR, PACKAGE_BUGREPORT); + + exit (status); +} + +int +main (int argc, char *argv[]) +{ + FILE *fp; + char *output = NULL; + char *dir = NULL; + + progname = "grub-mkimage"; + + while (1) + { + int c = getopt_long (argc, argv, "d:o:hVv", options, 0); + if (c == -1) + break; + + switch (c) + { + case 'd': + if (dir) + free (dir); + dir = xstrdup (optarg); + break; + case 'h': + usage (0); + break; + case 'o': + if (output) + free (output); + output = xstrdup (optarg); + break; + case 'V': + printf ("grub-mkimage (%s) %s\n", PACKAGE_NAME, PACKAGE_VERSION); + return 0; + case 'v': + verbosity++; + break; + default: + usage (1); + break; + } + } + + if (! output) + usage (1); + + fp = fopen (output, "wb"); + if (! fp) + grub_util_error ("cannot open %s", output); + + convert_elf (dir ? : GRUB_DATADIR, fp, argv + optind); + + fclose (fp); + + return 0; +}