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