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