diff options
| author | Michael Brown | 2005-03-08 19:53:11 +0100 |
|---|---|---|
| committer | Michael Brown | 2005-03-08 19:53:11 +0100 |
| commit | 3d6123e69ab879c72ff489afc5bf93ef0b7a94ce (patch) | |
| tree | 9f3277569153a550fa8d81ebd61bd88f266eb8da /src/Makefile.main | |
| download | ipxe-3d6123e69ab879c72ff489afc5bf93ef0b7a94ce.tar.gz ipxe-3d6123e69ab879c72ff489afc5bf93ef0b7a94ce.tar.xz ipxe-3d6123e69ab879c72ff489afc5bf93ef0b7a94ce.zip | |
Initial revision
Diffstat (limited to 'src/Makefile.main')
| -rw-r--r-- | src/Makefile.main | 450 |
1 files changed, 450 insertions, 0 deletions
diff --git a/src/Makefile.main b/src/Makefile.main new file mode 100644 index 000000000..2108db164 --- /dev/null +++ b/src/Makefile.main @@ -0,0 +1,450 @@ +# +# Makefile for Etherboot +# +# Most of the time you should edit Config +# +# Common options: +# VERSION_*=v - Set the major and minor version numbers +# +# NS8390 options: +# -DINCLUDE_NE - Include NE1000/NE2000 support +# -DNE_SCAN=list - Probe for NE base address using list of +# comma separated hex addresses +# -DINCLUDE_3C503 - Include 3c503 support +# -DT503_SHMEM - Use 3c503 shared memory mode (off by default) +# -DINCLUDE_WD - Include Western Digital/SMC support +# -DWD_DEFAULT_MEM- Default memory location for WD/SMC cards +# -DWD_790_PIO - Read/write to WD/SMC 790 cards in PIO mode (default +# is to use shared memory) Try this if you get "Bogus +# packet, ignoring" messages, common on ISA/PCI hybrid +# systems. +# -DCOMPEX_RL2000_FIX +# +# If you have a Compex RL2000 PCI 32-bit (11F6:1401), +# and the bootrom hangs in "Probing...[NE*000/PCI]", +# try enabling this fix... it worked for me :). +# In the first packet write somehow it somehow doesn't +# get back the expected data so it is stuck in a loop. +# I didn't bother to investigate what or why because it works +# when I interrupt the loop if it takes more then COMPEX_RL2000_TRIES. +# The code will notify if it does a abort. +# SomniOne - somnione@gmx.net +# +# 3C509 option: +# -DINCLUDE_3C509 - Include 3c509 support +# +# 3C90X options: +# -DINCLUDE_3C90X - Include 3c90x support +# +# Warning Warning Warning +# If you use any of the XCVR options below, please do not complain about +# the behaviour with Linux drivers to the kernel developers. You are +# on your own if you do this. Please read 3c90x.txt to understand +# what they do. If you don't understand them, ask for help on the +# Etherboot mailing list. And please document what you did to the NIC +# on the NIC so that people after you won't get nasty surprises. +# +# -DCFG_3C90X_PRESERVE_XCVR - Reset the transceiver type to the value it +# had initially just before the loaded code is started. +# -DCFG_3C90X_XCVR - Hardcode the tranceiver type Etherboot uses. +# -DCFG_3C90X_BOOTROM_FIX - If you have a 3c905B with buggy ROM +# interface, setting this option might "fix" it. Use +# with caution and read the docs in 3c90x.txt! +# +# See the documentation file 3c90x.txt for more details. +# +# CS89X0 (optional) options: +# -DINCLUDE_CS89X0- Include CS89x0 support +# -DCS_SCAN=list - Probe for CS89x0 base address using list of +# comma separated hex addresses; increasing the +# address by one (0x300 -> 0x301) will force a +# more aggressive probing algorithm. This might +# be neccessary after a soft-reset of the NIC. +# +# LANCE options: +# -DINCLUDE_NE2100- Include NE2100 support +# -DINCLUDE_NI6510- Include NI6510 support +# +# SK_G16 options: +# -DINCLUDE_SK_G16- Include SK_G16 support +# +# I82586 options: +# -DINCLUDE_3C507 - Include 3c507 support +# -DINCLUDE_NI5210- Include NI5210 support +# -DINCLUDE_EXOS205-Include EXOS205 support +# +# SMC9000 options: +# -DINCLUDE_SMC9000 - Include SMC9000 driver +# -DSMC9000_SCAN=list - List of I/O addresses to probe +# +# TIARA (Fujitsu Etherstar) options: +# -DINCLUDE_TIARA - Include Tiara support +# +# NI5010 options: +# -DINCLUDE_NI5010 - Include NI5010 support +# +# TULIP options: +# -DINCLUDE_TULIP - Include Tulip support +# +# RTL8139 options: +# -DINCLUDE_RTL8139 - Include RTL8139 support +# +# SIS900 options: +# -DINCLUDE_SIS900 - Include SIS900 support +# +# NATSEMI options: +# -DINCLUDE_NATSEMI - Include NATSEMI support +# + +SRCS:= +BOBJS:= + +MAKEROM= $(PERL) ./util/makerom.pl +VERSION_MAJOR= 5 +VERSION_MINOR= 3 +VERSION_PATCH= 14 +EXTRAVERSION= +VERSION= $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH)$(EXTRAVERSION) +MM_VERSION= $(VERSION_MAJOR).$(VERSION_MINOR) +CFLAGS+= -DVERSION_MAJOR=$(VERSION_MAJOR) \ + -DVERSION_MINOR=$(VERSION_MINOR) \ + -DVERSION=\"$(VERSION)\" $(OLDGAS) \ + -I include -I arch/$(ARCH)/include \ + -DARCH=$(ARCH) +FILO=filo +FILO_PROGRAM_NAME = FILO +FILO_PROGRAM_VERSION = 0.4.1 +FILO_BUILD_INFO = ($(shell whoami)@$(shell hostname)) $(shell LANG=C date) + +GCCINCDIR = $(shell $(CC) -print-search-dirs | head -n 1 | cut -d' ' -f2)include +CPPFLAGS = -nostdinc -imacros filo/config.h +#-Ifilo/include -I$(GCCINCDIR) -MD +ASFLAGS_X = -D__ASSEMBLY__ + +IDENT= '$(@F) $(VERSION) (GPL) etherboot.org' + +# Find out if we're using binutils 2.9.1 which uses a different syntax in some +# places (most prominently in the opcode prefix area). +OLDGAS:= $(shell $(AS) --version | grep -q '2\.9\.1' && echo -DGAS291) + +BUILD_LIBS= $(BLIB) +BUILD_IMGS= $(IMGS) + +3C503FLAGS= -DINCLUDE_3C503 # -DT503_SHMEM +# Note that the suffix to MAKEROM_ is the (mixed case) basename of the ROM file +MAKEROM_3c503= -3 +3C507FLAGS= -DINCLUDE_3C507 +3C509FLAGS= -DINCLUDE_3C509 +3C529FLAGS= -DINCLUDE_3C529 +3C595FLAGS= -DINCLUDE_3C595 +3C90XFLAGS= -DINCLUDE_3C90X +CS89X0FLAGS= -DINCLUDE_CS89X0 +EEPROFLAGS= -DINCLUDE_EEPRO +EEPRO100FLAGS= -DINCLUDE_EEPRO100 +E1000FLAGS= -DINCLUDE_E1000 +EPIC100FLAGS= -DINCLUDE_EPIC100 +EXOS205FLAGS= -DINCLUDE_EXOS205 +LANCEFLAGS= -DINCLUDE_LANCE # Lance/PCI! +NE2100FLAGS= -DINCLUDE_NE2100 +NEFLAGS= -DINCLUDE_NE -DNE_SCAN=0x300,0x280,0x320,0x340,0x380 +NS8390FLAGS= -DINCLUDE_NS8390 # NE2000/PCI! +NI5010FLAGS= -DINCLUDE_NI5010 +NI5210FLAGS= -DINCLUDE_NI5210 +NI6510FLAGS= -DINCLUDE_NI6510 +RTL8139FLAGS= -DINCLUDE_RTL8139 +SK_G16FLAGS= -DINCLUDE_SK_G16 +SIS900FLAGS= -DINCLUDE_SIS900 +NATSEMIFLAGS= -DINCLUDE_NATSEMI +SMC9000FLAGS= -DINCLUDE_SMC9000 +SUNDANCEFLAGS= -DINCLUDE_SUNDANCE +TLANFLAGS= -DINCLUDE_TLAN +TIARAFLAGS= -DINCLUDE_TIARA +DEPCAFLAGS= -DINCLUDE_DEPCA # -DDEPCA_MODEL=DEPCA -DDEPCA_RAM_BASE=0xd0000 +TULIPFLAGS= -DINCLUDE_TULIP +OTULIPFLAGS= -DINCLUDE_OTULIP +VIA_RHINEFLAGS= -DINCLUDE_VIA_RHINE +WDFLAGS= -DINCLUDE_WD -DWD_DEFAULT_MEM=0xCC000 +W89C840FLAGS= -DINCLUDE_W89C840 + +SRCS+= core/serial.c + +SRCS+= core/btext.c core/pc_kbd.c + +SRCS+= core/main.c core/pci.c core/osloader.c core/nfs.c +SRCS+= core/misc.c core/config.c core/isa_probe.c core/pci_probe.c +SRCS+= core/relocate.c core/heap.c +SRCS+= drivers/disk/floppy.c core/nic.c core/disk.c core/timer.c +SRCS+= core/proto_eth_slow.c +SRCS+= core/proto_slam.c core/proto_tftm.c core/proto_http.c +SRCS+= core/isapnp.c +SRCS+= core/pcmcia.c core/i82365.c +SRCS+= core/pxe_export.c core/dns_resolver.c + +FILO_SRCS+= $(FILO)/drivers/ide_x.c +FILO_SRCS+= $(FILO)/fs/blockdev.c $(FILO)/fs/eltorito.c $(FILO)/fs/fsys_ext2fs.c $(FILO)/fs/fsys_fat.c $(FILO)/fs/fsys_iso9660.c +FILO_SRCS+= $(FILO)/fs/fsys_reiserfs.c $(FILO)/fs/vfs.c $(FILO)/fs/fsys_jfs.c $(FILO)/fs/fsys_minix.c $(FILO)/fs/fsys_xfs.c +FILO_SRCS+= $(FILO)/main/elfload.c $(FILO)/main/elfnote.c $(FILO)/main/filo_x.c $(FILO)/main/lib.c $(FILO)/main/linuxbios_x.c +FILO_SRCS+= $(FILO)/main/pci_x.c $(FILO)/main/malloc_x.c $(FILO)/main/printf_x.c $(FILO)/main/console_x.c +FILO_SRCS+= $(FILO)/$(ARCH)/context.c $(FILO)/$(ARCH)/linux_load.c $(FILO)/$(ARCH)/segment.c $(FILO)/$(ARCH)/sys_info.c +FILO_SRCS+= $(FILO)/$(ARCH)/switch.S $(FILO)/usb/debug_x.c $(FILO)/usb/scsi_cmds.c $(FILO)/usb/uhci.c $(FILO)/usb/usb.c +FILO_SRCS+= $(FILO)/usb/ohci.c $(FILO)/usb/usb_scsi_low.c $(FILO)/usb/usb_x.c + + +BOBJS+= $(BIN)/main.o $(BIN)/osloader.o $(BIN)/nfs.o $(BIN)/misc.o +BOBJS+= $(BIN)/proto_slam.o $(BIN)/proto_tftm.o $(BIN)/proto_http.o +BOBJS+= $(BIN)/floppy.o +BOBJS+= $(BIN)/serial.o $(BIN)/timer.o $(BIN)/relocate.o $(BIN)/heap.o +BOBJS+= $(BIN)/btext.o $(BIN)/pc_kbd.o +BOBJS+= $(BIN)/nic.o $(BIN)/disk.o +BOBJS+= $(BIN)/isapnp.o +BOBJS+= $(BIN)/pci.o $(BIN)/isa_probe.o $(BIN)/pci_probe.o +BOBJS+= $(BIN)/vsprintf.o $(BIN)/string.o +BOBJS+= $(BIN)/pcmcia.o $(BIN)/i82365.o +BOBJS+= $(BIN)/pxe_export.o $(BIN)/dns_resolver.o + +FILO_OBJS+= $(BIN)/ide_x.o $(BIN)/pci_x.o +FILO_OBJS+= $(BIN)/blockdev.o $(BIN)/eltorito.o $(BIN)/fsys_ext2fs.o $(BIN)/fsys_fat.o $(BIN)/fsys_iso9660.o $(BIN)/fsys_reiserfs.o $(BIN)/vfs.o +FILO_OBJS+= $(BIN)/fsys_jfs.o $(BIN)/fsys_minix.o $(BIN)/fsys_xfs.o +FILO_OBJS+= $(BIN)/elfload.o $(BIN)/elfnote.o $(BIN)/filo_x.o $(BIN)/lib.o $(BIN)/linuxbios_x.o $(BIN)/malloc_x.o $(BIN)/printf_x.o $(BIN)/console_x.o +FILO_OBJS+= $(BIN)/context.o $(BIN)/linux_load.o $(BIN)/segment.o $(BIN)/sys_info.o $(BIN)/switch.o +FILO_OBJS+= $(BIN)/debug_x.o $(BIN)/scsi_cmds.o $(BIN)/uhci.o $(BIN)/usb.o $(BIN)/ohci.o $(BIN)/usb_scsi_low.o $(BIN)/usb_x.o + +BLIB= $(BIN)/bootlib.a +FILOLIB= $(BIN)/filolib.a +LIBS= $(BLIB) +ifdef INCLUDE_FILO +LIBS+= $(FILOLIB) +endif +UTILS+= $(BIN)/nrv2b +STDDEPS= $(START) $(UTILS) +# MAKEDEPS is the one target that is depended by all ROMs, so we check gcc here +# If you are confident that gcc 2.96 works for you, you can remove the lines +# that check gcc in the toolcheck rule +MAKEDEPS+= Makefile Makefile.main Config genrules.pl Families +MAKEDEPS+= $(BIN)/toolcheck +MAKEDEPS+= arch/$(ARCH)/Makefile arch/$(ARCH)/Config + +# Start of targets + +.PHONY: noargs +noargs: $(BIN)/toolcheck + @echo '====================================================' + @echo 'No target specified. To specify a target, do: ' + @echo + @echo ' $(MAKE) bin/<rom-name>.<output-format> ' + @echo + @echo 'where <output-format> is one of {zdsk, zrom, iso, liso, zlilo, zpxe, elf, com}' + @echo + @echo 'or: ' + @echo + @echo ' $(MAKE) all<output-format>s' + @echo + @echo 'to generate all possible images of format <output-format>' + @echo + @echo 'For example, ' + @echo + @echo ' make allzroms ' + @echo + @echo 'will generate all possible .zrom (rom burnable) images, and' + @echo + @echo ' make allzdsks' + @echo + @echo 'will generate all possible .zdsk (bootable floppy) images, or' + @echo + @echo '====================================================' + @exit 1 + +$(BIN)/toolcheck: Makefile Config + @if $(CC) -v 2>&1 | grep -is 'gcc version 2\.96' > /dev/null; \ + then \ + echo 'gcc 2.96 is unsuitable for compiling Etherboot'; \ + echo 'Use gcc 2.95 or gcc 3.x instead'; \ + exit 1; \ + else \ + touch $(BIN)/toolcheck; \ + fi; \ + if [ `perl -e 'use bytes; print chr(255)' | wc -c` = 2 ]; \ + then \ + echo 'Your Perl version has a Unicode handling bug'; \ + echo 'To workaround, execute this before compiling Etherboot:'; \ + echo 'export LANG=$${LANG%.UTF-8}'; \ + exit 1; \ + fi + +include arch/$(ARCH)/Makefile + +# Common files + +$(BLIB): $(BOBJS) + $(AR) r $@ $(BOBJS) + $(RANLIB) $@ + +$(FILOLIB): $(FILO_OBJS) + $(AR) r $@ $(FILO_OBJS) + $(RANLIB) $@ + +# LinuxBIOS support code +$(BIN)/linuxbios.o: firmware/linuxbios/linuxbios.c include/etherboot.h include/dev.h firmware/linuxbios/linuxbios_tables.h + +# Do not add driver specific dependencies here unless it's something the +# genrules.pl script *can't* deal with, i.e. if it is not C code. + +$(FILO)/config.h: $(FILO)/Config + /bin/echo -e '/* GENERATED FILE, DO NOT EDIT */\n' >$@ + sed -e 's/#.*//' -e '/=/!d' -e 's/\([^[:space:]]*\)[[:space:]]*=[[:space:]]*\(.*\).*/#define \1 \2/' -e 's/^#define \([^ ]*\) 0$$/#undef \1/' $^ >>$@ + +filo_version: $(FILO)/main/version.h + +$(FILO)/main/version.h: FORCE + echo '#define PROGRAM_NAME "$(FILO_PROGRAM_NAME)"' > $@ + echo '#define PROGRAM_VERSION "$(FILO_PROGRAM_VERSION) $(FILO_BUILD_INFO)"' >> $@ + +FORCE: + + +# Utilities + +$(BIN)/lzhuf: util/lzhuf.c + $(HOST_CC) -O2 -DENCODE -DDECODE -DMAIN -DVERBOSE -o $@ $< + +# Roms file +# Builds almost silently because this rule is triggered for just about +# every modification to sources. + +$(BIN)/Roms $(BIN)/NIC: genrules.pl Families $(SRCS) + @mkdir -p $(@D) + @echo Scanning for ROMs and dependencies... + @$(PERL) ./genrules.pl Families $(BIN)/NIC $(ARCH) $(SRCS) > $(BIN)/Roms + +# Pattern Rules + +# general rules for compiling/assembling source files +$(BIN)/%.o: core/%.c $(MAKEDEPS) + $(CC) $(CFLAGS) -o $@ -c $< + +$(BIN)/%.s: core/%.c $(MAKEDEPS) + $(CC) $(CFLAGS) -S -o $@ -c $< + +$(BIN)/%.o: drivers/disk/%.c $(MAKEDEPS) + $(CC) $(CFLAGS) -o $@ -c $< + +$(BIN)/%.o: drivers/net/%.c $(MAKEDEPS) + $(CC) $(CFLAGS) -o $@ -c $< + +$(BIN)/%.o: firmware/linuxbios/%.c $(MAKEDEPS) + $(CC) $(CFLAGS) -o $@ -c $< + +$(BIN)/%.o: $(FILO)/drivers/%.c $(MAKEDEPS) $(FILO)/config.h + $(CC) $(CFLAGS) -imacros $(FILO)/config.h -o $@ -c $< + +$(BIN)/%.o: $(FILO)/fs/%.c $(MAKEDEPS) $(FILO)/config.h + $(CC) $(CFLAGS) -imacros $(FILO)/config.h -o $@ -c $< + +$(BIN)/%.o: $(FILO)/$(ARCH)/%.c $(MAKEDEPS) $(FILO)/config.h + $(CC) $(CFLAGS) -imacros $(FILO)/config.h -o $@ -c $< + +$(BIN)/%.o: $(FILO)/$(ARCH)/%.S $(MAKEDEPS) $(FILO)/config.h + $(CC) $(ASFLAGS_X) $(CPPFLAGS) -c $< -o $@ + +$(BIN)/%.o: $(FILO)/main/%.c $(MAKEDEPS) $(FILO)/config.h filo_version + $(CC) $(CFLAGS) -imacros $(FILO)/config.h -o $@ -c $< + +$(BIN)/%.o: $(FILO)/usb/%.c $(MAKEDEPS) $(FILO)/config.h + $(CC) $(CFLAGS) -imacros $(FILO)/config.h -o $@ -c $< + +# Rule for the super etherboot image. +$(BIN)/etherboot.o: $(DOBJS) + $(LD) $(LDFLAGS) -r $(DOBJS) -o $@ + +$(BIN)/etherboot-pci.o: $(PCIOBJS) + $(LD) $(LDFLAGS) -r $(PCIOBJS) -o $@ + +# General rules for generating runtime (rt) files +$(BIN)/%.rt.o: $(BIN)/%.o $(START) $(BIN)/config.o $(LIBS) $(STDDEPS) $(MAKEDEPS) + $(LD) $(LDFLAGS) -r $(START) $(BIN)/config.o $< $(LIBS) -o $@ + +# Rule for $(BIN)/%.FORMAT.rt is architecture and target-format specific + +$(BIN)/%.rt.bin: $(BIN)/%.rt $(MAKEDEPS) + $(OBJCOPY) -O binary -R .prefix $< $@ + +$(BIN)/%.rt1.bin: $(BIN)/%.rt $(MAKEDEPS) + $(OBJCOPY) -O binary -j .text.nocompress $< $@ + +$(BIN)/%.rt2.bin: $(BIN)/%.rt $(MAKEDEPS) + $(OBJCOPY) -O binary -R .prefix -R .text.nocompress $< $@ + +# Rules for generating prefix binary files + +# Rule for $(BIN)/%.FORMAT.prf is architecture and target-format specific +$(BIN)/%.prf.bin: $(BIN)/%.prf $(MAKEDEPS) + $(OBJCOPY) -j .prefix -O binary $< $@ + +# general rule for .z (compressed binary code), may be overridden +$(BIN)/%.zbin: $(BIN)/%.bin $(BIN)/nrv2b $(MAKEDEPS) + $(BIN)/nrv2b e $< $@ + +# Housekeeping + +clean: + $(RM) $(BIN)/* + $(RM) $(FILO)/config.h $(FILO)/main/version.h + +../index.html: ../index.xhtml + (cd ..; m4 -P -DHOSTSITE=SOURCEFORGE index.xhtml > index.html) + +../index-berlios.html: ../index.xhtml + (cd ..; m4 -P -DHOSTSITE=BERLIOS index.xhtml > index-berlios.html) + +tarball: ../index.html ../index-berlios.html + (echo -n $(VERSION) ''; date -u +'%Y-%m-%d') > ../VERSION + (cd ../..; tar cf /tmp/etherboot-$(VERSION).tar --exclude CVS --exclude doc etherboot-$(VERSION)) + bzip2 -9 < /tmp/etherboot-$(VERSION).tar > /tmp/etherboot-$(VERSION).tar.bz2 + gzip -9 < /tmp/etherboot-$(VERSION).tar > /tmp/etherboot-$(VERSION).tar.gz + +# Auto-incrementing build serial number. Is auto-incremented for each +# make run that specifies a final image file (e.g. bin/undi.zpxe) as a +# target, or a target of the form "all*". Enable via -DBUILD_SERIAL +# in Config. + +ifneq ($(findstring -DBUILD_SERIAL,$(CFLAGS)),) + +# If no make goals are specified, it means "make all" +REALGOALS = $(if $(MAKECMDGOALS),$(MAKECMDGOALS),all) + +# Filter to see if there are any targets to trigger an auto-increment +BUILDGOALS = $(filter all,$(REALGOALS)) $(filter all%,$(REALGOALS)) \ + $(foreach SUFFIX,$(SUFFIXES),$(filter %.$(SUFFIX),$(REALGOALS))) + +ifneq ($(strip $(BUILDGOALS)),) +# This is an auto-incrementing build. Forcibly rebuild .buildserial.h +# and mark config.o as depending on it to force its rebuilding. +bin/config.o : include/.buildserial.h +.PHONY : include/.buildserial.h +endif # BUILDGOALS + +include/.buildserial.h : + @if [ ! -f $@ ]; then echo '#define BUILD_SERIAL_NUM 0' > $@; fi + @perl -pi -e 's/(BUILD_SERIAL_NUM)\s+(\d+)/"$${1} ".($${2}+1)/e' $@ + +buildserial : include/.buildserial.h + @perl -n -e '/BUILD_SERIAL_NUM\s+(\d+)/ && ' \ + -e 'print "Build serial number is $$1\n";' $< + +else # -DBUILD_SERIAL + +buildserial : + @echo Build serial number is disabled. Enable -DBUILD_SERIAL in Config. + +endif # -DBUILD_SERIAL + +bs : buildserial + +version: + @echo $(VERSION) + +romlimit: + @echo $(ROMLIMIT) + +sources: + @echo $(SRCS) |
