1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
|
# Makefile for MemTest-86
#
# Author: Chris Brady
# Created: January 1, 1996
#
# Enhancements - V1.2: May 28, 1996 by Loic Prylli
#
#
# Path for the floppy disk device
#
FDISK=/dev/fd0
#
# Comment out the following to disable testing with cache off
#
CACHE=-DCACHE
#
# Comment out the following to disable testing with long refresh timing
#
REFRESH=-DREFRESH
#
# gcc compiler options, these settings should suffice
#
CCFLAGS=-Wall -m486 -O2
# WARNING - Read the following carefully if you modify the code in any way!
#
# TXT_ADR sets the origin for the text segment. Since the code is
# relocated there are two code segments. The first must match TESTADR in
# mtest.h. The second REL_TXT_ADR must be set to (TESTADR+MAIN_SZ+RELOBASE)
# in mtest.h.
#
# DAT_ADR sets the origin for the data segment. This is is set by hand and
# will need to be adjusted if the code grows much. The current settings
# leave only a small amount of room for growth. Look at the loader map to
# check this address. The total size of the text and data segments must
# be less than MAINSZ in mtest.h. REL_DAT_ADR should be set to
# REL_TXT_ADR + (DAT_ADR - TXT_ADR)
#
TXT_ADR=0x1000
DAT_ADR=0x2600
REL_TXT_ADR=0x102800
REL_DAT_ADR=0x103e00
OBJDUMP=objdump -k -q
OBJCOPY=objcopy -O binary -R .note -R .comment -R .stab -R .stabstr
all: setup bootsect head.out relo.out build
./build bootsect setup head.out relo.out >image
mtest.o: mtest.c mtest.h
cc -c $(CCFLAGS) $(REFRESH) $(CACHE) mtest.c
head: head.o mtest.o
ld -m elf_i386 -o $@ -e do_test -Ttext $(TXT_ADR) -Tdata $(DAT_ADR) \
-Map mapfile head.o mtest.o
head.out: head
if hash encaps 2> /dev/null; then \
$(OBJDUMP) -o $(TXT_ADR) head >head.out; \
else \
$(OBJCOPY) head head.out; \
fi
relo: mtest.o
ld -m elf_i386 -o $@ -e do_test -Ttext $(REL_TXT_ADR) -Tdata \
$(REL_DAT_ADR) -Map mapfile.relo head.o mtest.o
relo.out: relo
if hash encaps 2> /dev/null; then \
$(OBJDUMP) -o $(REL_TXT_ADR) relo >relo.out; \
else \
$(OBJCOPY) relo relo.out; \
fi
head.o: head.s
as -o $@ $<
head.s: head.S mtest.h
cc -E -traditional $< -o $@
setup: setup.o
ld86 -0 -s -o $@ $<
setup.o: setup.s
as86 -a -0 -o $@ $<
setup.s: setup.S mtest.h
cc -E -traditional $< -o $@
bootsect: bootsect.o
ld86 -0 -s -o $@ $<
bootsect.o: bootsect.s
as86 -a -0 -o $@ $<
bootsect.s: bootsect.S mtest.h
cc -E -traditional $< -o $@
build: build.c
cc -DELF -o build build.c
clean:
rm -f *.o *.s build image bootsect setup head head.out mapfile relo \
relo.out mapfile.relo
install: all
dd <image >$(FDISK) bs=8192
install-bin:
dd <image.bin >$(FDISK) bs=8192
|