1# 2# This file and its contents are supplied under the terms of the 3# Common Development and Distribution License ("CDDL"), version 1.0. 4# You may only use this file in accordance with the terms of version 5# 1.0 of the CDDL. 6# 7# A full copy of the text of the CDDL should have accompanied this 8# source. A copy of the CDDL is also available via the Internet at 9# http://www.illumos.org/license/CDDL. 10# 11 12# 13# Copyright 2015 Toomas Soome <tsoome@me.com> 14# Copyright 2016 RackTop Systems. 15# 16 17# 18 19include $(SRC)/Makefile.master 20include $(SRC)/boot/Makefile.version 21include $(SRC)/boot/Makefile.inc 22 23PROG= gptzfsboot 24MAN= gptzfsboot.8 25FILEMODE=0444 26 27BOOT_COMCONSOLE_PORT= 0x3f8 28BOOT_COMCONSOLE_SPEED= 9600 29B2SIOFMT= 0x3 30 31REL1= 0x700 32ORG1= 0x7c00 33ORG2= 0x0 34 35CPPFLAGS += -DBOOTPROG=\"gptzfsboot\" \ 36 -DGPT -DBOOT2 \ 37 -DLOADER_MBR_SUPPORT -DLOADER_GPT_SUPPORT \ 38 -DSIOPRT=$(BOOT_COMCONSOLE_PORT) \ 39 -DSIOFMT=$(B2SIOFMT) \ 40 -DSIOSPD=$(BOOT_COMCONSOLE_SPEED) \ 41 -I../../include \ 42 -I../../libsa \ 43 -I../../common \ 44 -I../common \ 45 -I$(ZFSSRC) \ 46 -I../../sys/cddl/boot/zfs \ 47 -I../btx/lib -I. \ 48 -I../../sys \ 49 -I../libi386 50 51LDSCRIPT= ../boot.ldscript 52LD_FLAGS= -static -N --gc-sections 53LIBI386= -L ../libi386 -li386 54LIBSTAND= -L ../../libsa/$(MACH) -lsa 55LIBS= $(LIBI386) $(LIBSTAND) 56DPADD= ../libi386/libi386.a ../../libsa/$(MACH)/libsa.a 57 58include ../Makefile.inc 59 60.PARALLEL: 61 62all: $(PROG) 63 64install: all $(ROOTBOOTPROG) 65 66OBJS = mb_header.o zfsboot.o sio.o cons.o devopen.o \ 67 part.o disk.o bcache.o zfs_cmd.o 68 69zfsboot.o := CPPFLAGS += -I$(SRC)/uts/common -I$(SRC)/uts/common/fs/zfs 70zfs_cmd.o := CPPFLAGS += -I$(SRC)/uts/common 71part.o := CPPFLAGS += -I$(ZLIB) 72smbios.o := CPPFLAGS += -DSMBIOS_SERIAL_NUMBERS 73smbios.o := CPPFLAGS += -DSMBIOS_LITTLE_ENDIAN_UUID 74gptldr.out := LD_FLAGS += $(GLDTARGET) 75 76CLEANFILES= gptzfsboot $(OBJS) 77 78gptzfsboot: gptldr.bin gptzfsboot.bin $(BTXKERN) 79 $(BTXLD) -E $(ORG2) -f bin -b $(BTXKERN) -V $(BOOT_VERSION) -l \ 80 gptldr.bin -o $@ gptzfsboot.bin 81 82CLEANFILES += gptldr.bin gptldr.out gptldr.o 83 84gptldr.bin: gptldr.out 85 $(OBJCOPY) -S -O binary gptldr.out $@ 86 87gptldr.out: gptldr.o 88 $(GLD) $(LD_FLAGS) -e start -Ttext $(ORG1) -o $@ gptldr.o 89 90CLEANFILES += gptzfsboot.bin gptzfsboot.out 91 92gptzfsboot.bin: gptzfsboot.out 93 $(OBJCOPY) -S -O binary gptzfsboot.out $@ 94 95gptzfsboot.out: $(BTXCRT) $(OBJS) $(DPADD) 96 $(GLD) $(LD_FLAGS) -T $(LDSCRIPT) -o $@ $(BTXCRT) $(OBJS) $(LIBS) 97 98machine: 99 $(RM) machine 100 $(SYMLINK) ../../sys/i386/include machine 101 102x86: 103 $(RM) x86 104 $(SYMLINK) ../../sys/x86/include x86 105 106$(OBJS): machine x86 107 108%.o: ../common/%.c 109 $(COMPILE.c) $< 110 111%.o: ../../common/%.c 112 $(COMPILE.c) $< 113 114%.o: ../../common/%.S 115 $(COMPILE.S) $< 116 117clobber: clean 118 119clean: 120 $(RM) $(CLEANFILES) machine x86 121