xref: /haiku/build/jam/images/FloppyBootImage (revision 344ded80d400028c8f561b4b876257b94c12db4a)
1# This file defines what ends up in the floppy boot image and it executes the
2# rules building the image.
3
4
5#HACK: remove when old ide code is removed!
6
7local NET_BOOT = 0 ;
8local USB_BOOT = 1 ;
9
10local USB_ONLY = ;
11if $(USB_BOOT) = 1 {
12	USB_ONLY = "" ;
13}
14
15local BOOT_ADD_ONS_NET ;
16if $(NET_BOOT) = 1 {
17	BOOT_ADD_ONS_NET =
18		remote_disk
19		$(SYSTEM_ADD_ONS_DRIVERS_NET)
20		stack socket
21		$(SYSTEM_NETWORK_DEVICES)
22		$(SYSTEM_NETWORK_DATALINK_PROTOCOLS)
23		$(SYSTEM_NETWORK_PPP)
24		$(SYSTEM_NETWORK_PROTOCOLS)
25	;
26}
27
28SYSTEM_ADD_ONS_BUS_MANAGERS = [ FFilterByBuildFeatures
29	acpi@x86,x86_64
30	ata
31	dpc
32	pci
33	isa@x86,x86_64
34	<pci>x86@x86,x86_64
35	scsi
36	$(USB_ONLY)usb
37	fdt@arm
38] ;
39SYSTEM_ADD_ONS_FILE_SYSTEMS =
40	attribute_overlay@!m68k
41	bfs
42	iso9660@!m68k
43	packagefs
44	write_overlay@!m68k
45	;
46
47# modules
48AddFilesToFloppyBootArchive system add-ons kernel bus_managers
49	: $(SYSTEM_ADD_ONS_BUS_MANAGERS) ;
50
51AddFilesToFloppyBootArchive system add-ons kernel busses ata :
52	generic_ide_pci
53	ide_isa@x86
54	silicon_image_3112
55	legacy_sata
56	it8211
57	;
58
59AddFilesToFloppyBootArchive system add-ons kernel busses scsi :
60	ahci
61	;
62AddFilesToFloppyBootArchive system add-ons kernel console :
63	vga_text
64	;
65AddFilesToFloppyBootArchive system add-ons kernel file_systems
66	: $(SYSTEM_ADD_ONS_FILE_SYSTEMS) ;
67AddFilesToFloppyBootArchive system add-ons kernel generic :
68	ata_adapter
69	scsi_periph
70	;
71AddFilesToFloppyBootArchive system add-ons kernel partitioning_systems :
72	intel
73	session
74	;
75AddFilesToFloppyBootArchive system add-ons kernel interrupt_controllers :
76	openpic@ppc
77	;
78
79if $(USB_BOOT) = 1 {
80	AddFilesToFloppyBootArchive system add-ons kernel busses usb
81		:
82		<usb>uhci
83		<usb>ohci
84		<usb>ehci
85		;
86}
87
88if $(TARGET_ARCH) = x86 || $(TARGET_ARCH) = x86_64 {
89	AddFilesToFloppyBootArchive system add-ons kernel cpu
90		:
91		generic_x86
92		;
93}
94
95# drivers
96AddNewDriversToFloppyBootArchive disk scsi :
97	scsi_cd
98	scsi_disk
99	;
100AddNewDriversToFloppyBootArchive disk :
101	norflash@arm
102	;
103if $(USB_BOOT) = 1 {
104	AddDriversToFloppyBootArchive disk usb
105		:
106		usb_disk
107		;
108}
109if $(NET_BOOT) = 1 {
110	AddDriversToFloppyBootArchive disk virtual
111		:
112		remote_disk
113		;
114	AddDriversToFloppyBootArchive net
115		: $(SYSTEM_ADD_ONS_DRIVERS_NET) ;
116}
117
118# kernel
119AddFilesToFloppyBootArchive system :
120	<revisioned>kernel_$(TARGET_ARCH)
121	;
122
123# scripts and data files
124
125local driverSettingsFiles = <driver-settings>kernel ;
126SEARCH on $(driverSettingsFiles)
127	= [ FDirName $(HAIKU_TOP) data settings kernel drivers ] ;
128AddFilesToFloppyBootArchive home config settings kernel drivers
129	: $(driverSettingsFiles) ;
130
131if $(NET_BOOT) = 1 {
132	# add-ons
133	AddFilesToFloppyBootArchive system add-ons kernel network
134		:
135		stack
136		socket
137		;
138	AddFilesToFloppyBootArchive
139		system add-ons kernel network devices
140		: $(SYSTEM_NETWORK_DEVICES) ;
141	AddFilesToFloppyBootArchive
142		system add-ons kernel network datalink_protocols
143		: $(SYSTEM_NETWORK_DATALINK_PROTOCOLS) ;
144	AddFilesToFloppyBootArchive
145		system add-ons kernel network ppp
146		: $(SYSTEM_NETWORK_PPP) ;
147	AddFilesToFloppyBootArchive
148		system add-ons kernel network protocols
149		: $(SYSTEM_NETWORK_PROTOCOLS) ;
150}
151
152# boot module links
153AddBootModuleSymlinksToFloppyBootArchive [ FFilterByBuildFeatures
154	$(SYSTEM_ADD_ONS_BUS_MANAGERS)
155	openpic@ppc
156	ata_adapter
157	scsi_periph
158	generic_x86@x86
159	ahci
160	generic_ide_pci
161	ide_isa@x86
162	silicon_image_3112
163	legacy_sata
164	it8211
165	$(USB_ONLY)<usb>uhci
166	$(USB_ONLY)<usb>ohci
167	$(USB_ONLY)<usb>ehci
168	scsi_cd
169	scsi_disk
170	$(USB_ONLY)usb_disk
171	norflash@arm
172	intel
173	session
174	$(SYSTEM_ADD_ONS_FILE_SYSTEMS)
175	$(BOOT_ADD_ONS_NET)
176] ;
177
178
179#pragma mark - Build The Archive
180
181# archive target
182HAIKU_FLOPPY_BOOT_ARCHIVE = haiku-floppyboot.tgz ;
183MakeLocate $(HAIKU_FLOPPY_BOOT_ARCHIVE) : $(HAIKU_OUTPUT_DIR) ;
184
185# the pseudo target all archive contents is attached to
186NotFile $(HAIKU_BOOT_FLOPPY_CONTAINER_NAME) ;
187
188# prepare the script that initializes the shell variables
189local initVarsScript = <FloppyBootArchive>haiku-floppyboot-init-vars ;
190local script = $(initVarsScript) ;
191MakeLocate $(script) : $(HAIKU_OUTPUT_DIR) ;
192Always $(script) ;
193
194AddVariableToScript $(script) : tmpDir : $(HAIKU_TMP_DIR) ;
195AddVariableToScript $(script) : addBuildCompatibilityLibDir
196	: "export $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)" ;
197AddTargetVariableToScript $(script) : <build>copyattr ;
198
199# create the other scripts
200local makeDirsScript = <FloppyBootArchive>haiku-floppyboot-make-dirs ;
201local copyFilesScript = <FloppyBootArchive>haiku-floppyboot-copy-files ;
202MakeLocate $(makeDirsScript) $(copyFilesScript) : $(HAIKU_OUTPUT_DIR) ;
203
204CreateFloppyBootArchiveMakeDirectoriesScript $(makeDirsScript) ;
205CreateFloppyBootArchiveCopyFilesScript $(copyFilesScript) ;
206
207# build the archive
208
209BuildFloppyBootArchive $(HAIKU_FLOPPY_BOOT_ARCHIVE) :
210	$(initVarsScript)
211	$(makeDirsScript)
212	$(copyFilesScript)
213;
214
215# remove the scripts we have generated
216RmTemps $(HAIKU_FLOPPY_BOOT_ARCHIVE) :
217	$(initVarsScript)
218	$(makeDirsScript)
219	$(copyFilesScript)
220;
221
222NotFile haiku-floppyboot-archive ;
223Depends haiku-floppyboot-archive : $(HAIKU_FLOPPY_BOOT_ARCHIVE) ;
224
225# floppy image target
226HAIKU_BOOT_FLOPPY = haiku-boot-floppy.image ;
227MakeLocate $(HAIKU_BOOT_FLOPPY) : $(HAIKU_OUTPUT_DIR) ;
228
229BuildFloppyBootImage $(HAIKU_BOOT_FLOPPY) : haiku_loader.$(HAIKU_KERNEL_PLATFORM)
230	: $(HAIKU_FLOPPY_BOOT_ARCHIVE) ;
231
232# remove the archive
233RmTemps $(HAIKU_BOOT_FLOPPY) : $(HAIKU_FLOPPY_BOOT_ARCHIVE) ;
234
235NotFile haiku-boot-floppy ;
236Depends haiku-boot-floppy : $(HAIKU_BOOT_FLOPPY) ;
237