VirtualBox

source: vbox/trunk/src/VBox/Devices/PC/Etherboot-src/arch/i386/Makefile@ 19015

Last change on this file since 19015 was 1, checked in by vboxsync, 55 years ago

import

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 11.5 KB
Line 
1ARCH_FORMAT= elf32-i386
2
3# For debugging, don't delete intermediates
4#.SECONDARY:
5
6LDSCRIPT= arch/i386/core/etherboot.lds
7PLDSCRIPT= arch/i386/core/etherboot.prefix.lds
8
9LCONFIG+= -Ui386
10
11ROMLIMIT= 524288
12CHECKSIZE= { read d1; read d1 d2 d3 size d4; [ $$size -gt $(ROMLIMIT) ] &&\
13 { $(RM) $@; echo "ERROR: code size exceeds limit!"; exit 1; }; exit 0; }
14
15START= $(BIN)/start32.o $(BIN)/linuxbios.o \
16 $(BIN)/bios.o $(BIN)/console.o $(BIN)/memsizes.o $(BIN)/basemem.o \
17 $(BIN)/hidemem.o $(BIN)/e820mangler.o \
18 $(BIN)/realmode.o $(BIN)/realmode_asm.o \
19 $(BIN)/callbacks.o $(BIN)/pxe_callbacks.o
20
21SRCS+= arch/i386/prefix/hdprefix.S
22SRCS+= arch/i386/prefix/floppyprefix.S
23SRCS+= arch/i386/prefix/unhuf.S
24SRCS+= arch/i386/prefix/unnrv2b.S
25SRCS+= arch/i386/firmware/pcbios/bios.c
26SRCS+= arch/i386/firmware/pcbios/console.c
27SRCS+= arch/i386/firmware/pcbios/memsizes.c
28SRCS+= arch/i386/firmware/pcbios/basemem.c
29SRCS+= arch/i386/firmware/pcbios/hidemem.c
30SRCS+= arch/i386/firmware/pcbios/e820mangler.S
31SRCS+= arch/i386/prefix/liloprefix.S
32SRCS+= arch/i386/prefix/elfprefix.S
33SRCS+= arch/i386/prefix/lmelf_prefix.S
34SRCS+= arch/i386/prefix/elf_dprefix.S
35SRCS+= arch/i386/prefix/lmelf_dprefix.S
36SRCS+= arch/i386/prefix/comprefix.S
37SRCS+= arch/i386/prefix/exeprefix.S
38SRCS+= arch/i386/prefix/pxeprefix.S
39SRCS+= arch/i386/prefix/romprefix.S
40
41SRCS+= arch/i386/core/init.S
42SRCS+= arch/i386/core/start32.S
43SRCS+= arch/i386/core/pci_io.c
44SRCS+= arch/i386/core/i386_timer.c
45SRCS+= arch/i386/core/elf.c
46SRCS+= arch/i386/core/cpu.c
47SRCS+= arch/i386/core/video_subr.c
48SRCS+= arch/i386/core/pic8259.c
49SRCS+= arch/i386/core/hooks.c
50SRCS+= arch/i386/core/callbacks.c
51SRCS+= arch/i386/core/realmode.c
52SRCS+= arch/i386/core/realmode_asm.S
53SRCS+= arch/i386/core/pxe_callbacks.c
54
55# ROM loaders: ISA and PCI versions
56ISAPREFIX= $(BIN)/isaprefix.o
57ISAENTRY= $(BIN)/isaprefix.entry.o
58ISAEXIT= $(BIN)/isaprefix.exit.o
59PCIPREFIX= $(BIN)/pciprefix.o
60PCIENTRY= $(BIN)/pciprefix.entry.o
61PCIEXIT= $(BIN)/pciprefix.exit.o
62# Variables xxx_ROMTYPE are defined by genrules.pl. ROMENTRY and
63# ROMEXIT will evaluate to give the correct objects to use.
64TARGETBASE=$(basename $(notdir $@))
65ROMCARD=$(firstword $(subst --, ,$(TARGETBASE)))
66ROMTYPE=$(firstword $(ROMTYPE_$(ROMCARD)) ISA)
67romENTRY=$($(ROMTYPE)ENTRY)
68romEXIT=$($(ROMTYPE)EXIT)
69
70# Target type for generic prf rules
71TARGETTYPE=$(patsubst .%,%, $(suffix $(basename $@)))
72TARGETENTRY=$($(TARGETTYPE)ENTRY)
73TARGETEXIT=$($(TARGETTYPE)EXIT)
74
75# Other real-mode entry loaders
76hdPREFIX= $(BIN)/hdprefix.o
77hdENTRY= $(BIN)/hdprefix.entry.o
78hdEXIT= $(BIN)/hdprefix.exit.o
79dskPREFIX= $(BIN)/floppyprefix.o
80dskENTRY= $(BIN)/floppyprefix.entry.o
81dskEXIT= $(BIN)/floppyprefix.exit.o
82comPREFIX= $(BIN)/comprefix.o
83comENTRY= $(BIN)/comprefix.entry.o
84comEXIT= $(BIN)/comprefix.exit.o
85exePREFIX= $(BIN)/exeprefix.o
86exeENTRY= $(BIN)/exeprefix.entry.o
87exeEXIT= $(BIN)/exeprefix.exit.o
88liloPREFIX= $(BIN)/liloprefix.o
89liloENTRY= $(BIN)/liloprefix.entry.o
90liloEXIT= $(BIN)/liloprefix.exit.o
91bImagePREFIX= $(BIN)/bImageprefix.o
92bImageENTRY= $(BIN)/bImageprefix.entry.o
93bImageEXIT= $(BIN)/bImageprefix.exit.o
94pxePREFIX= $(BIN)/pxeprefix.o
95pxeENTRY= $(BIN)/pxeprefix.entry.o
96pxeEXIT= $(BIN)/pxeprefix.exit.o
97rawPREFIX= $(BIN)/nullprefix.o
98rawENTRY= $(BIN)/nullprefix.entry.o
99rawEXIT= $(BIN)/nullprefix.exit.o
100
101# Protected mode entry loaders
102elfPREFIX= $(BIN)/elfprefix.o
103elfENTRY= $(BIN)/elfprefix.entry.o
104elfEXIT= $(BIN)/elfprefix.exit.o
105lmelfPREFIX= $(BIN)/lmelf_prefix.o
106lmelfENTRY= $(BIN)/lmelf_prefix.entry.o
107lmelfEXIT= $(BIN)/lmelf_prefix.exit.o
108elfdPREFIX= $(BIN)/elf_dprefix.o
109elfdENTRY= $(BIN)/elf_dprefix.entry.o
110elfdEXIT= $(BIN)/elf_dprefix.exit.o
111lmelfdPREFIX= $(BIN)/lmelf_dprefix.o
112lmelfdENTRY= $(BIN)/lmelf_dprefix.entry.o
113lmelfdEXIT= $(BIN)/lmelf_dprefix.exit.o
114
115include $(BIN)/Roms
116
117all: $(ROMS)
118allroms: $(ROMS)
119allzroms: $(ROMS)
120alldsks: $(EB_DSKS)
121allzdsks: $(EB_ZDSKS)
122allhds: $(EB_HDS)
123allzhds: $(EB_ZHDS)
124alllilos: $(EB_LILOS)
125allzlilos: $(EB_ZLILOS)
126allbImages: $(EB_BIMAGES)
127allbzImages: $(EB_BZIMAGES)
128allpxes: $(EB_PXES)
129allzpxes: $(EB_ZPXES)
130allelfs: $(EB_ELFS)
131allzelfs: $(EB_ZELFS)
132alllmelfs: $(EB_LMELFS)
133allzlmelfs: $(EB_ZLMELFS)
134allelfds: $(EB_ELFDS)
135allzelfds: $(EB_ZELFDS)
136alllmelfds: $(EB_LMELFDS)
137allzlmelfds: $(EB_ZLMELFDS)
138allcoms: $(EB_COMS)
139allexes: $(EB_EXES)
140allisos: $(EB_ISOS)
141alllisos: $(EB_LISOS)
142
143BOBJS+= $(BIN)/pci_io.o $(BIN)/i386_timer.o
144BOBJS+= $(BIN)/elf.o $(BIN)/cpu.o $(BIN)/video_subr.o
145BOBJS+= $(BIN)/pic8259.o $(BIN)/hooks.o
146
147# ROM loaders
148
149$(ISAPREFIX): arch/i386/prefix/romprefix.S $(MAKEDEPS)
150 $(CPP) $(CFLAGS) $(LCONFIG) -Ui386 -D ASSEMBLY $< \
151 | $(AS) $(ASFLAGS) -o $@
152
153$(PCIPREFIX): arch/i386/prefix/romprefix.S $(MAKEDEPS)
154 $(CPP) -DPCI_PNP_HEADER $(CFLAGS) $(LCONFIG) -Ui386 -D ASSEMBLY $< \
155 | $(AS) $(ASFLAGS) -o $@
156
157# Prefix splitters
158$(BIN)/%prefix.entry.o: $(BIN)/%prefix.o $(MAKEDEPS)
159 $(OBJCOPY) -R .text16 $< $@
160
161$(BIN)/%prefix.exit.o: $(BIN)/%prefix.o $(MAKEDEPS)
162 $(OBJCOPY) -R .prefix $< $@
163
164# Generic prefix objects
165PREFIXOBJS = $(BIN)/init.o
166ZPREFIXOBJS = $(BIN)/init.o $(BIN)/unnrv2b.o
167
168# Utilities
169$(BIN)/nrv2b: util/nrv2b.c
170 $(HOST_CC) -O2 -DENCODE -DDECODE -DMAIN -DVERBOSE -DNDEBUG -DBITSIZE=32 -DENDIAN=0 -o $@ $<
171
172ZFILELEN = perl util/zfilelen.pl
173
174# Pattern Rules
175
176# General for compiling/assembly source files
177
178$(BIN)/%.o: arch/i386/core/%.c $(MAKEDEPS)
179 $(CC) $(CFLAGS) -o $@ -c $<
180
181$(BIN)/%.o: arch/i386/core/%.S $(MAKEDEPS)
182 $(CPP) $(CFLAGS) -Ui386 -D ASSEMBLY $< | $(AS) $(ASFLAGS) -o $@
183
184$(BIN)/%.o: arch/i386/firmware/pcbios/%.c $(MAKEDEPS)
185 $(CC) $(CFLAGS) -o $@ -c $<
186
187$(BIN)/%.o: arch/i386/firmware/pcbios/%.S $(MAKEDEPS)
188 $(CPP) $(CFLAGS) -Ui386 -D ASSEMBLY $< | $(AS) $(ASFLAGS) -o $@
189
190$(BIN)/%.o: arch/i386/prefix/%.S $(MAKEDEPS)
191 $(CPP) $(CFLAGS) -Ui386 -D ASSEMBLY $< | $(AS) $(ASFLAGS) -o $@
192
193# general rule for 16bit .o, may be overridden
194$(BIN)/%.o: $(BIN)/%.s
195 $(AS) $(ASFLAGS) -o $@ $<
196
197# general rule for .bin (plain binary loader code), may be overridden
198$(BIN)/%.bin: $(BIN)/%.o
199 $(OBJCOPY) -O binary $< $@
200
201# general rule for .z (compressed binary code), may be overridden
202# rule for .z is in top level Makefile
203# Give the directory name, e.g. use $(BIN)/rtl8139.com as the target.
204
205$(BIN)/%.zo: $(BIN)/%.zbin arch/i386/core/prefixzdata.lds $(MAKEDEPS)
206 $(LD) -T arch/i386/core/prefixzdata.lds -b binary $< -o $@
207
208$(BIN)/%.uo: $(BIN)/%.bin arch/i386/core/prefixudata.lds $(MAKEDEPS)
209 $(LD) -T arch/i386/core/prefixudata.lds -b binary $< -o $@
210
211# Intermediate prf rules
212
213%.prf: %.rt $(PREFIXOBJS) %.rt1.uo %.rt2.uo $(MAKEDEPS)
214 $(MAKE) $(TARGETENTRY)
215 $(LD) $(LDFLAGS) -T $(PLDSCRIPT) $(TARGETENTRY) -R $(subst $(MAKEDEPS),,$^) -o $@
216
217%.zprf: %.rt $(ZPREFIXOBJS) %.rt1.uo %.rt2.zo $(MAKEDEPS)
218 $(MAKE) $(TARGETENTRY)
219 $(LD) $(LDFLAGS) -T $(PLDSCRIPT) $(TARGETENTRY) -R $(subst $(MAKEDEPS),,$^) -o $@
220
221# general rules for normal/compressed ROM images, may be overridden
222SUFFIXES += rom zrom
223
224$(BIN)/%.rom.rt: $(BIN)/%.rt.o $(ISAENTRY) $(PCIENTRY) $(ISAEXIT) $(PCIEXIT) $(LDSCRIPT) $(MAKEDEPS)
225 $(LD) $(LDFLAGS) -T $(LDSCRIPT) -o $@ $(romEXIT) $<
226 @$(SIZE) $@ | $(CHECKSIZE)
227
228$(BIN)/%.rom: $(BIN)/%.rom.prf
229 $(OBJCOPY) -O binary $< $@
230 $(MAKEROM) $(MAKEROM_FLAGS) $(MAKEROM_$(ROMCARD)) $(MAKEROM_ID_$(ROMCARD)) -i$(IDENT) $@
231
232$(BIN)/%.zrom: $(BIN)/%.rom.zprf
233 $(OBJCOPY) -O binary $< $@
234 $(MAKEROM) $(MAKEROM_FLAGS) $(MAKEROM_$(ROMCARD)) $(MAKEROM_ID_$(ROMCARD)) -i$(IDENT) $@
235
236# general rules for ELF images
237SUFFIXES += elf zelf
238$(BIN)/%.elf.rt: $(BIN)/%.rt.o $(elfENTRY) $(elfEXIT) $(LDSCRIPT) $(MAKEDEPS)
239 $(LD) $(LDFLAGS) -T $(LDSCRIPT) -o $@ $(elfEXIT) $<
240
241$(BIN)/%.elf: $(BIN)/%.elf.prf
242 $(OBJCOPY) -O binary $< $@
243
244$(BIN)/%.zelf: $(BIN)/%.elf.zprf
245 $(OBJCOPY) -O binary $< $@
246
247# general rules for Long Mode ELF images
248SUFFIXES += lmelf zlmelf
249$(BIN)/%.lmelf.rt: $(BIN)/%.rt.o $(lmelfENTRY) $(lmelfEXIT) $(LDSCRIPT) $(MAKEDEPS)
250 $(LD) $(LDFLAGS) -T $(LDSCRIPT) -o $@ $(lmelfEXIT) $<
251
252$(BIN)/%.lmelf: $(BIN)/%.lmelf.prf
253 $(OBJCOPY) -O binary $< $@
254
255$(BIN)/%.zlmelf: $(BIN)/%.lmelf.zprf
256 $(OBJCOPY) -O binary $< $@
257
258# general rules for ELF dynamic images
259SUFFIXES += elfd zelfd
260$(BIN)/%.elfd.rt: $(BIN)/%.rt.o $(elfdENTRY) $(elfdEXIT) $(LDSCRIPT) $(MAKEDEPS)
261 $(LD) $(LDFLAGS) -T $(LDSCRIPT) -o $@ $(elfdEXIT) $<
262
263$(BIN)/%.elfd: $(BIN)/%.elfd.prf
264 $(OBJCOPY) -O binary $< $@
265
266$(BIN)/%.zelfd: $(BIN)/%.elfd.zprf
267 $(OBJCOPY) -O binary $< $@
268
269# general rules for Long Mode ELF dynamic images
270SUFFIXES += lmelfd zlmelfd
271$(BIN)/%.lmelfd.rt: $(BIN)/%.rt.o $(lmelfdENTRY) $(lmelfdEXIT) $(LDSCRIPT) $(MAKEDEPS)
272 $(LD) $(LDFLAGS) -T $(LDSCRIPT) -o $@ $(lmelfdEXIT) $<
273
274$(BIN)/%.lmelfd: $(BIN)/%.lmelfd.prf
275 $(OBJCOPY) -O binary $< $@
276
277$(BIN)/%.zlmelfd: $(BIN)/%.lmelfd.zprf
278 $(OBJCOPY) -O binary $< $@
279
280# rules to generate a DOS loadable .com executable
281SUFFIXES += com
282$(BIN)/%.com.rt: $(BIN)/%.rt.o $(comENTRY) $(comEXIT) $(LDSCRIPT) $(MAKEDEPS)
283 $(LD) $(LDFLAGS) -T $(LDSCRIPT) -o $@ $< $(comEXIT)
284
285$(BIN)/%.com: $(BIN)/%.com.zprf
286 $(OBJCOPY) -O binary $< $@
287
288# rules to generate a DOS loadable .exe executable
289SUFFIXES += exe
290$(BIN)/%.exe.rt: $(BIN)/%.rt.o $(exeENTRY) $(exeEXIT) $(LDSCRIPT) $(MAKEDEPS)
291 $(LD) $(LDFLAGS) -T $(LDSCRIPT) -o $@ $< $(exeEXIT)
292 @$(SIZE) $@ | $(CHECKSIZE)
293
294$(BIN)/%.exe: $(BIN)/%.exe.prf
295 $(OBJCOPY) -O binary $< $@
296
297# rules to make a LILO loadable image
298SUFFIXES += lilo zlilo
299
300$(BIN)/%.lilo.rt: $(BIN)/%.rt.o $(liloENTRY) $(liloEXIT) $(LDSCRIPT) $(MAKEDEPS)
301 $(LD) $(LDFLAGS) -T $(LDSCRIPT) -o $@ $< $(liloEXIT)
302 @$(SIZE) $@ | $(CHECKSIZE)
303
304$(BIN)/%.lilo: $(BIN)/%.lilo.prf
305 $(OBJCOPY) -O binary $< $@
306
307$(BIN)/%.zlilo: $(BIN)/%.lilo.zprf
308 $(OBJCOPY) -O binary $< $@
309
310# rules to make big linux boot protocol image
311SUFFIXES += bImage bzImage
312
313$(BIN)/%.bImage.rt: $(BIN)/%.rt.o $(bImageENTRY) $(bImageEXIT) $(LDSCRIPT) $(MAKEDEPS)
314 $(LD) $(LDFLAGS) -T $(LDSCRIPT) -o $@ $< $(bImageEXIT)
315
316$(BIN)/%.bImage: $(BIN)/%.bImage.prf
317 $(OBJCOPY) -O binary $< $@
318
319$(BIN)/%.bzImage: $(BIN)/%.bImage.zprf
320 $(OBJCOPY) -O binary $< $@
321
322
323# rules to generate a PXE loadable image
324SUFFIXES += pxe zpxe
325
326$(BIN)/%.pxe.rt: $(BIN)/%.rt.o $(pxeENTRY) $(pxeEXIT) $(LDSCRIPT) $(MAKEDEPS)
327 $(LD) $(LDFLAGS) -T $(LDSCRIPT) -o $@ $< $(pxeEXIT)
328 @$(SIZE) $@ | $(CHECKSIZE)
329
330$(BIN)/%.pxe: $(BIN)/%.pxe.prf
331 $(OBJCOPY) -O binary $< $@
332
333$(BIN)/%.zpxe: $(BIN)/%.pxe.zprf
334 $(OBJCOPY) -O binary $< $@
335
336# rules to generate the .dsk/.zdsk floppy images
337SUFFIXES += dsk zdsk
338
339$(BIN)/%.dsk.rt: $(BIN)/%.rt.o $(dskENTRY) $(dskEXIT) $(LDSCRIPT) $(MAKEDEPS)
340 $(LD) $(LDFLAGS) -T $(LDSCRIPT) -o $@ $< $(dskEXIT)
341 @$(SIZE) $@ | $(CHECKSIZE)
342
343$(BIN)/%.dsk: $(BIN)/%.dsk.prf
344 $(OBJCOPY) -O binary $< $@
345
346$(BIN)/%.zdsk: $(BIN)/%.dsk.zprf
347 $(OBJCOPY) -O binary $< $@
348
349# rules to generate the .hd/.zhd harddisk images
350SUFFIXES += hd zhd
351
352$(BIN)/%.hd.rt: $(BIN)/%.rt.o $(hdENTRY) $(hdEXIT) $(LDSCRIPT) $(MAKEDEPS)
353 $(LD) $(LDFLAGS) -T $(LDSCRIPT) -o $@ $< $(hdEXIT)
354 @$(SIZE) $@ | $(CHECKSIZE)
355
356$(BIN)/%.hd: $(BIN)/%.hd.prf
357 $(OBJCOPY) -O binary $< $@
358
359$(BIN)/%.zhd: $(BIN)/%.hd.zprf
360 $(OBJCOPY) -O binary $< $@
361
362# rules to write the .dsk/.zdsk image onto a blank floppy
363SUFFIXES += fd0 zfd0
364%.fd0: %.dsk
365 dd if=$< bs=512 conv=sync of=/dev/fd0
366 sync
367
368%.zfd0: %.zdsk
369 dd if=$< bs=512 conv=sync of=/dev/fd0
370 sync
371
372# rules to create raw executable images
373SUFFIXES += raw zraw
374$(BIN)/%.raw.rt: $(BIN)/%.rt.o $(rawENTRY) $(rawEXIT) $(LDSCRIPT) $(MAKEDEPS)
375 $(LD) $(LDFLAGS) -T $(LDSCRIPT) -o $@ $< $(rawEXIT)
376
377$(BIN)/%.raw: $(BIN)/%.raw.prf
378 $(OBJCOPY) -O binary $< $@
379
380$(BIN)/%.zraw: $(BIN)/%.raw.zprf
381 $(OBJCOPY) -O binary $< $@
382
383# rule to make a non-emulation ISO boot image
384SUFFIXES += iso
385%.iso: util/geniso %.zlilo
386 ISOLINUX_BIN=${ISOLINUX_BIN} bash util/geniso $*.iso $*.zlilo
387
388# rule to make a floppy emulation ISO boot image
389SUFFIXES += liso
390%.liso: util/genliso %.zlilo
391 bash util/genliso $*.liso $*.zlilo
392
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette