199767f8919635c4928607450d9e0abb932109ceToomas Soome# A value of 0x80 enables LBA support.
199767f8919635c4928607450d9e0abb932109ceToomas Soome# Decide level of UFS support.
199767f8919635c4928607450d9e0abb932109ceToomas Soome#BOOT2_UFS?= UFS2_ONLY
199767f8919635c4928607450d9e0abb932109ceToomas Soome#BOOT2_UFS?= UFS1_ONLY
199767f8919635c4928607450d9e0abb932109ceToomas Soome -Wall -Waggregate-return -Wbad-function-cast -Wcast-align \
199767f8919635c4928607450d9e0abb932109ceToomas Soome -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
199767f8919635c4928607450d9e0abb932109ceToomas Soome -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \
199767f8919635c4928607450d9e0abb932109ceToomas Soome.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} <= 40201
199767f8919635c4928607450d9e0abb932109ceToomas Soome# Pick up ../Makefile.inc early.
199767f8919635c4928607450d9e0abb932109ceToomas Soome ${LD} ${LD_FLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} boot1.o
199767f8919635c4928607450d9e0abb932109ceToomas SoomeCLEANFILES+= boot2 boot2.ld boot2.ldr boot2.bin boot2.out boot2.o \
199767f8919635c4928607450d9e0abb932109ceToomas Soome dd if=boot2.ld of=${.TARGET} obs=7680 conv=osync status=none
199767f8919635c4928607450d9e0abb932109ceToomas Soome btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l boot2.ldr \
199767f8919635c4928607450d9e0abb932109ceToomas Soome dd if=/dev/zero of=${.TARGET} bs=512 count=1 status=none
199767f8919635c4928607450d9e0abb932109ceToomas Soome ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC}
199767f8919635c4928607450d9e0abb932109ceToomas Soomeboot2.s: boot2.c boot2.h ${.CURDIR}/../../common/ufsread.c
199767f8919635c4928607450d9e0abb932109ceToomas Soome ${CC} ${CFLAGS} -S -o boot2.s.tmp ${.CURDIR}/boot2.c
199767f8919635c4928607450d9e0abb932109ceToomas Soome sed -e '/align/d' -e '/nop/d' < boot2.s.tmp > boot2.s
199767f8919635c4928607450d9e0abb932109ceToomas Soome ${NM} -t d ${.ALLSRC} | awk '/([0-9])+ T xread/ \
199767f8919635c4928607450d9e0abb932109ceToomas Soome { x = $$1 - ORG1; \
199767f8919635c4928607450d9e0abb932109ceToomas Soome printf("#define XREADORG %#x\n", REL1 + x) }' \
199767f8919635c4928607450d9e0abb932109ceToomas Soomemachine: ${.CURDIR}/../../../i386/include .NOMETA
199767f8919635c4928607450d9e0abb932109ceToomas Soome# XXX: clang integrated-as doesn't grok .codeNN directives yet