xref: /haiku/build/jam/images/AnybootImage (revision 1e60bdeab63fa7a57bc9a55b032052e95a18bd2c)
1# Set anyboot file name and directory defaults.
2HAIKU_ANYBOOT_NAME ?= $(HAIKU_DEFAULT_ANYBOOT_NAME) ;
3HAIKU_ANYBOOT_DIR ?= $(HAIKU_DEFAULT_ANYBOOT_DIR) ;
4HAIKU_ANYBOOT = $(HAIKU_ANYBOOT_NAME) ;
5HAIKU_ANYBOOT_LABEL ?= $(HAIKU_DEFAULT_ANYBOOT_LABEL) ;
6
7rule BuildAnybootImage anybootImage : mbrPart : isoPart : imageFile {
8	local anyboot = <build>anyboot ;
9
10	Depends $(anybootImage) : $(anyboot) ;
11	Depends $(anybootImage) : $(isoPart) ;
12	Depends $(anybootImage) : $(mbrPart) ;
13	Depends $(anybootImage) : $(imageFile) ;
14
15	BuildAnybootImage1 $(anybootImage) : $(anyboot) $(mbrPart) $(isoPart) $(imageFile) ;
16}
17
18actions BuildAnybootImage1 {
19	$(2[1]) -b $(2[2]) $(2[3]) $(2[4]) $(1)
20}
21
22rule BuildAnybootImageEfi anybootImage : mbrPart : efiPart : isoPart : imageFile {
23	local anyboot = <build>anyboot ;
24
25	Depends $(anybootImage) : $(anyboot) ;
26	Depends $(anybootImage) : $(isoPart) ;
27	Depends $(anybootImage) : $(mbrPart) ;
28	Depends $(anybootImage) : $(efiPart) ;
29	Depends $(anybootImage) : $(imageFile) ;
30
31	BuildAnybootImageEfi1 $(anybootImage) : $(anyboot) $(mbrPart) $(efiPart) $(isoPart) $(imageFile) ;
32}
33
34actions BuildAnybootImageEfi1 {
35	$(2[1]) -b $(2[2]) -e $(2[3]) $(2[4]) $(2[5]) $(1)
36}
37
38local baseMBR = base_mbr.bin ;
39local mbrSource = [ FDirName $(HAIKU_TOP) src bin writembr mbr.S ] ;
40BuildMBR $(baseMBR) : $(mbrSource) ;
41MakeLocate $(baseMBR) : $(HAIKU_OUTPUT_DIR) ;
42MakeLocate $(HAIKU_ANYBOOT) : $(HAIKU_ANYBOOT_DIR) ;
43
44if $(HAIKU_ANYBOOT_LEGACY) = 1 {
45	BuildAnybootImage $(HAIKU_ANYBOOT) : $(baseMBR) : $(HAIKU_CD_BOOT_IMAGE)
46		: $(HAIKU_IMAGE_NAME) ;
47} else {
48	local efiLoader = haiku_loader.efi ;
49	local efiPartition = esp.image ;
50	MakeLocate $(efiPartition) ;
51	BuildEfiSystemPartition $(efiPartition) : $(efiLoader) ;
52	BuildAnybootImageEfi $(HAIKU_ANYBOOT) : $(baseMBR) : $(efiPartition) : $(HAIKU_CD_BOOT_IMAGE)
53		: $(HAIKU_IMAGE_NAME) ;
54}
55
56# TODO: this one seems to cause the build to fail each other run (caching?)
57#RmTemps $(HAIKU_ANYBOOT) : $(baseMBR) ;
58RmTemps $(HAIKU_ANYBOOT) : $(HAIKU_CD_BOOT_IMAGE) ;
59RmTemps $(HAIKU_ANYBOOT) : $(HAIKU_IMAGE_NAME) ;
60RmTemps $(HAIKU_ANYBOOT) : $(HAIKU_BOOT_FLOPPY) ;
61
62NotFile haiku-anyboot-image ;
63Depends haiku-anyboot-image : $(HAIKU_ANYBOOT) ;
64