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