xref: /haiku/build/jam/images/FloppyBootImage (revision 9a6a20d4689307142a7ed26a1437ba47e244e73f)
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	locked_pool
70	scsi_periph
71	;
72AddFilesToFloppyBootArchive system add-ons kernel partitioning_systems :
73	intel
74	session
75	;
76AddFilesToFloppyBootArchive system add-ons kernel interrupt_controllers :
77	openpic@ppc
78	;
79
80if $(USB_BOOT) = 1 {
81	AddFilesToFloppyBootArchive system add-ons kernel busses usb
82		:
83		<usb>uhci
84		<usb>ohci
85		<usb>ehci
86		;
87}
88
89if $(TARGET_ARCH) = x86 || $(TARGET_ARCH) = x86_64 {
90	AddFilesToFloppyBootArchive system add-ons kernel cpu
91		:
92		generic_x86
93		;
94}
95
96# drivers
97AddNewDriversToFloppyBootArchive disk scsi :
98	scsi_cd
99	scsi_disk
100	;
101AddNewDriversToFloppyBootArchive disk :
102	norflash@arm
103	;
104if $(USB_BOOT) = 1 {
105	AddDriversToFloppyBootArchive disk usb
106		:
107		usb_disk
108		;
109}
110if $(NET_BOOT) = 1 {
111	AddDriversToFloppyBootArchive disk virtual
112		:
113		remote_disk
114		;
115	AddDriversToFloppyBootArchive net
116		: $(SYSTEM_ADD_ONS_DRIVERS_NET) ;
117}
118
119# kernel
120AddFilesToFloppyBootArchive system :
121	<revisioned>kernel_$(TARGET_ARCH)
122	;
123
124# scripts and data files
125
126local driverSettingsFiles = <driver-settings>kernel ;
127SEARCH on $(driverSettingsFiles)
128	= [ FDirName $(HAIKU_TOP) data settings kernel drivers ] ;
129AddFilesToFloppyBootArchive home config settings kernel drivers
130	: $(driverSettingsFiles) ;
131
132if $(NET_BOOT) = 1 {
133	# add-ons
134	AddFilesToFloppyBootArchive system add-ons kernel network
135		:
136		stack
137		socket
138		;
139	AddFilesToFloppyBootArchive
140		system add-ons kernel network devices
141		: $(SYSTEM_NETWORK_DEVICES) ;
142	AddFilesToFloppyBootArchive
143		system add-ons kernel network datalink_protocols
144		: $(SYSTEM_NETWORK_DATALINK_PROTOCOLS) ;
145	AddFilesToFloppyBootArchive
146		system add-ons kernel network ppp
147		: $(SYSTEM_NETWORK_PPP) ;
148	AddFilesToFloppyBootArchive
149		system add-ons kernel network protocols
150		: $(SYSTEM_NETWORK_PROTOCOLS) ;
151}
152
153# boot module links
154AddBootModuleSymlinksToFloppyBootArchive [ FFilterByBuildFeatures
155	$(SYSTEM_ADD_ONS_BUS_MANAGERS)
156	openpic@ppc
157	ata_adapter
158	locked_pool
159	scsi_periph
160	generic_x86@x86
161	ahci
162	generic_ide_pci
163	ide_isa@x86
164	silicon_image_3112
165	legacy_sata
166	it8211
167	$(USB_ONLY)<usb>uhci
168	$(USB_ONLY)<usb>ohci
169	$(USB_ONLY)<usb>ehci
170	scsi_cd
171	scsi_disk
172	$(USB_ONLY)usb_disk
173	norflash@arm
174	intel
175	session
176	$(SYSTEM_ADD_ONS_FILE_SYSTEMS)
177	$(BOOT_ADD_ONS_NET)
178] ;
179
180
181#pragma mark - Build The Archive
182
183# archive target
184HAIKU_FLOPPY_BOOT_ARCHIVE = haiku-floppyboot.tgz ;
185MakeLocate $(HAIKU_FLOPPY_BOOT_ARCHIVE) : $(HAIKU_OUTPUT_DIR) ;
186
187# the pseudo target all archive contents is attached to
188NotFile $(HAIKU_BOOT_FLOPPY_CONTAINER_NAME) ;
189
190# prepare the script that initializes the shell variables
191local initVarsScript = <FloppyBootArchive>haiku-floppyboot-init-vars ;
192local script = $(initVarsScript) ;
193MakeLocate $(script) : $(HAIKU_OUTPUT_DIR) ;
194Always $(script) ;
195
196AddVariableToScript $(script) : tmpDir : $(HAIKU_TMP_DIR) ;
197AddVariableToScript $(script) : addBuildCompatibilityLibDir
198	: "export $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)" ;
199AddTargetVariableToScript $(script) : <build>copyattr ;
200
201# create the other scripts
202local makeDirsScript = <FloppyBootArchive>haiku-floppyboot-make-dirs ;
203local copyFilesScript = <FloppyBootArchive>haiku-floppyboot-copy-files ;
204MakeLocate $(makeDirsScript) $(copyFilesScript) : $(HAIKU_OUTPUT_DIR) ;
205
206CreateFloppyBootArchiveMakeDirectoriesScript $(makeDirsScript) ;
207CreateFloppyBootArchiveCopyFilesScript $(copyFilesScript) ;
208
209# build the archive
210
211BuildFloppyBootArchive $(HAIKU_FLOPPY_BOOT_ARCHIVE) :
212	$(initVarsScript)
213	$(makeDirsScript)
214	$(copyFilesScript)
215;
216
217# remove the scripts we have generated
218RmTemps $(HAIKU_FLOPPY_BOOT_ARCHIVE) :
219	$(initVarsScript)
220	$(makeDirsScript)
221	$(copyFilesScript)
222;
223
224NotFile haiku-floppyboot-archive ;
225Depends haiku-floppyboot-archive : $(HAIKU_FLOPPY_BOOT_ARCHIVE) ;
226
227# floppy image target
228HAIKU_BOOT_FLOPPY = haiku-boot-floppy.image ;
229MakeLocate $(HAIKU_BOOT_FLOPPY) : $(HAIKU_OUTPUT_DIR) ;
230
231BuildFloppyBootImage $(HAIKU_BOOT_FLOPPY) : haiku_loader.$(HAIKU_KERNEL_PLATFORM)
232	: $(HAIKU_FLOPPY_BOOT_ARCHIVE) ;
233
234# remove the archive
235RmTemps $(HAIKU_BOOT_FLOPPY) : $(HAIKU_FLOPPY_BOOT_ARCHIVE) ;
236
237NotFile haiku-boot-floppy ;
238Depends haiku-boot-floppy : $(HAIKU_BOOT_FLOPPY) ;
239