AnybootImage revision 59bba8b9
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	Echo "HAIKU_ANYBOOT_LEGACY defined so anyboot is MBR only" ;
46	BuildAnybootImage $(HAIKU_ANYBOOT) : $(baseMBR) : $(HAIKU_CD_BOOT_IMAGE)
47		: $(HAIKU_IMAGE_NAME) ;
48} else {
49	local efiLoader = haiku_loader.efi ;
50	local efiPartition = esp.image ;
51	MakeLocate $(efiPartition) ;
52	BuildEfiSystemPartition $(efiPartition) : $(efiLoader) ;
53	BuildAnybootImageEfi $(HAIKU_ANYBOOT) : $(baseMBR) : $(efiPartition) : $(HAIKU_CD_BOOT_IMAGE)
54		: $(HAIKU_IMAGE_NAME) ;
55}
56
57# TODO: this one seems to cause the build to fail each other run (caching?)
58#RmTemps $(HAIKU_ANYBOOT) : $(baseMBR) ;
59RmTemps $(HAIKU_ANYBOOT) : $(HAIKU_CD_BOOT_IMAGE) ;
60RmTemps $(HAIKU_ANYBOOT) : $(HAIKU_IMAGE_NAME) ;
61RmTemps $(HAIKU_ANYBOOT) : $(HAIKU_BOOT_FLOPPY) ;
62
63NotFile haiku-anyboot-image ;
64Depends haiku-anyboot-image : $(HAIKU_ANYBOOT) ;
65