]> git.saurik.com Git - apple/boot.git/blame_incremental - i386/boot1u/Makefile
boot-132.tar.gz
[apple/boot.git] / i386 / boot1u / Makefile
... / ...
CommitLineData
1DIR = boot1u
2include ../MakePaths.dir
3
4OPTIM = -Os -Oz
5CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -Werror \
6 -fno-builtin -DSAIO_INTERNAL_USER -DBOOT1 -static \
7 -fomit-frame-pointer -mpreferred-stack-boundary=2 \
8 -fno-align-functions -mno-sse2 -mfpmath=387
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
22LD = gcc
23LIBS= -L$(SYMDIR) -lsa
24#LIBS= -L$(SYMDIR)
25
26OTHER_FILES =
27
28INSTALLDIR = $(DSTROOT)/usr/standalone/i386
29VPATH = $(SYMROOT):$(OBJROOT)
30vpath %.c ../libsaio
31vpath % $(SYMROOT)
32vpath %.h ../libsaio
33vpath % $(SYMROOT)
34
35# The ordering is important;
36# boot1u.o must be first.
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
39
40# OBJS += $(OBJROOT)/../libsa/prf.o $(OBJROOT)/../libsa/printf.o
41
42# We build the following source files from the libsaio directory:
43# ufs.o cache.o ufs_byteorder.o table.o
44# and get these object files from libsa:
45# prf.o printf.o
46# If they increase in size, or if other accidental dependencies
47# are created with other .o files in libsa.a, then boot1u can get too large.
48# Use care in changing libsaio and libsa.
49
50UTILDIR = ../util
51SFILES = boot1u.s bios.s asm.s
52CFILES = boot.c disk.c malloc.c put.c string.c \
53 ufs.c cache.c misc.c ufs_byteorder.c table.c
54HFILES =
55OTHERFILES = Makefile
56ALLSRC = $(FOREIGNSRC) $(FOREIGNBIN) $(SFILES) $(CFILES) \
57 $(HFILES) $(OTHERFILES)
58DIRS_NEEDED = $(OBJROOT) $(SYMROOT)
59BOOT1UADDR = 10200
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
66NASM = $(SYMROOT)/nasm
67
68all: $(DIRS_NEEDED) boot1u0 boot1u
69
70boot1u0: boot1u0.s Makefile $(NASM)
71 $(NASM) boot1u0.s -o $(SYMROOT)/$@
72
73boot1u: $(SYMROOT)/machOconv boot1u0 $(OBJS)
74 $(LD) -arch i386 -fno-builtin -static -Wl,-preload -Wl,-segaddr,__TEXT,$(BOOT1UADDR) -nostdlib -Wl,-segalign,20 \
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}'` ; \
80 if expr "$$size" ">" "$(MAXBOOTSIZE)" > /dev/null ;\
81 then \
82 echo "Booter executable larger than $(MAXBOOTSIZE) bytes" ;\
83 exit 1;\
84 fi)
85 cat $(SYMROOT)/boot1u0 $(SYMROOT)/$(@F).post | dd obs=7k conv=osync of=$(SYMROOT)/$(@F)
86 rm $(SYMROOT)/$(@F).post
87
88
89install_i386:: all $(INSTALLDIR)
90 cp $(SYMROOT)/boot1u $(OTHER_FILES) $(INSTALLDIR)
91 cd $(INSTALLDIR); chmod u+w boot1u $(OTHER_FILES)
92
93clean::
94 rm -f $(SYMROOT)/boot1u.sys $(SYMROOT)/boot1u $(SYMROOT)/boot1u0
95
96include ../MakeInc.dir
97
98#dependencies
99-include $(OBJROOT)/Makedep