]>
Commit | Line | Data |
---|---|---|
f083c6c3 A |
1 | DIR = boot1u |
2 | include ../MakePaths.dir | |
3 | ||
4 | # | |
5 | # these paths are only valid in subdirectories of this directory | |
6 | # | |
7 | OBJROOT=../../obj/i386/boot1u | |
8 | SYMROOT=../../sym/i386 | |
9 | DSTROOT=../../dst/i386 | |
10 | SRCROOT=/tmp | |
11 | ||
12 | OPTIM = -Os | |
13 | CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -Werror \ | |
14 | -fno-builtin -DSAIO_INTERNAL_USER -static \ | |
15 | -fomit-frame-pointer -mpreferred-stack-boundary=2 \ | |
16 | -fno-align-functions | |
17 | DEFINES= | |
18 | CONFIG = hd | |
19 | SYMDIR = $(SYMROOT) | |
20 | LIBSADIR = ../libsa | |
21 | LIBSAIODIR = ../libsaio | |
22 | UTILDIR = ../util | |
23 | INC = -I. -I.. -I$(SYMDIR) -I$(LIBSADIR) -I$(LIBSAIODIR) -I$(UTILDIR) | |
24 | ifneq "" "$(wildcard /bin/mkdirs)" | |
25 | MKDIRS = /bin/mkdirs | |
26 | else | |
27 | MKDIRS = /bin/mkdir -p | |
28 | endif | |
29 | AS = as | |
30 | LD = ld | |
31 | LIBS= -L$(SYMDIR) -lsaio -lsa | |
32 | #LIBS= -L$(SYMDIR) | |
33 | ||
34 | OTHER_FILES = | |
35 | ||
36 | INSTALLDIR = $(DSTROOT)/usr/standalone/i386 | |
37 | VPATH = $(OBJROOT):$(SYMROOT) | |
38 | ||
39 | # The ordering is important; | |
40 | # boot1u.o must be first. | |
41 | #OBJS = $(OBJROOT)/boot1u.o $(OBJROOT)/asm.o $(OBJROOT)/bios.o $(OBJROOT)/boot.o $(OBJROOT)/string.o $(OBJROOT)/malloc.o $(OBJROOT)/disk.o $(OBJROOT)/put.o | |
42 | OBJS = boot1u.o asm.o bios.o boot.o string.o malloc.o disk.o put.o | |
43 | ||
44 | # OBJS += $(OBJROOT)/../libsaio/ufs.o \ | |
45 | # $(OBJROOT)/../libsaio/cache.o \ | |
46 | # $(OBJROOT)/../libsaio/ufs_byteorder.o \ | |
47 | # $(OBJROOT)/../libsaio/table.o \ | |
48 | # $(OBJROOT)/../libsaio/misc.o | |
49 | ||
50 | # OBJS += $(OBJROOT)/../libsa/prf.o $(OBJROOT)/../libsa/printf.o | |
51 | ||
52 | # We get the following object files out of libsaio: | |
53 | # ufs.o cache.o ufs_byteorder.o table.o | |
54 | # and these from libsa: | |
55 | # prf.o printf.o | |
56 | # If they increase in size, or if other accidental dependencies | |
57 | # are created with other .o files in libsaio.a, then boot1u can get too large. | |
58 | # Use care in changing the library. | |
59 | ||
60 | UTILDIR = ../util | |
61 | SFILES = boot1u.s bios.s asm.s | |
62 | CFILES = boot.c disk.c string.c put.c malloc.c | |
63 | HFILES = | |
64 | OTHERFILES = Makefile | |
65 | ALLSRC = $(FOREIGNSRC) $(FOREIGNBIN) $(SFILES) $(CFILES) \ | |
66 | $(HFILES) $(OTHERFILES) | |
67 | DIRS_NEEDED = $(OBJROOT) $(SYMROOT) | |
68 | BOOT1UADDR = 10200 | |
69 | MAXBOOTSIZE = 7680 | |
70 | NASM = $(SYMROOT)/nasm | |
71 | ||
72 | all: $(DIRS_NEEDED) boot1u0 boot1u | |
73 | ||
74 | boot1u0: boot1u0.s Makefile $(NASM) | |
75 | $(NASM) boot1u0.s -o $(SYMROOT)/$@ | |
76 | ||
77 | boot1u: $(SYMROOT)/machOconv $(OBJS) boot1u0 | |
78 | $(LD) -static -preload -segaddr __TEXT $(BOOT1UADDR) -segalign 20 \ | |
79 | -o $(SYMROOT)/boot1u.sys $(OBJS) $(LIBS) -lcc_kext | |
80 | size $(SYMROOT)/boot1u.sys | |
81 | $(SYMROOT)/machOconv $(SYMROOT)/boot1u.sys $(SYMROOT)/boot1u.post | |
82 | ls -l $(SYMROOT)/boot1u.post | |
83 | @( size=`ls -l $(SYMROOT)/boot1u.post | awk '{ print $$5}'` ; \ | |
84 | if expr "$$size" ">" "$(MAXBOOTSIZE)" > /dev/null ;\ | |
85 | then \ | |
86 | echo "Booter executable larger than $(MAXBOOTSIZE) bytes" ;\ | |
87 | exit 1;\ | |
88 | fi) | |
89 | cat $(SYMROOT)/boot1u0 $(SYMROOT)/boot1u.post | dd obs=8k conv=osync of=$(SYMROOT)/boot1u | |
90 | rm $(SYMROOT)/boot1u.post | |
91 | ||
92 | ||
93 | install_i386:: all $(INSTALLDIR) | |
94 | cp $(SYMROOT)/boot1u $(OTHER_FILES) $(INSTALLDIR) | |
95 | cd $(INSTALLDIR); chmod u+w boot1u $(OTHER_FILES) | |
96 | ||
97 | clean:: | |
98 | rm -f $(SYMROOT)/boot1u.sys $(SYMROOT)/boot1u | |
99 | ||
100 | include ../MakeInc.dir | |
101 | ||
102 | #dependencies | |
103 | -include $(OBJROOT)/Makedep |