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