From c3f478a33407cd8b1da3d2ea041d4cdd6e06d2e6 Mon Sep 17 00:00:00 2001 From: zrj Date: Sun, 20 May 2018 17:19:55 +0300 Subject: [PATCH] boot/pc32: Separate hostprog. Add guard in common sys/boot/pc32/Makefile.inc. Hostprog shall not take any of those definitions. --- sys/boot/pc32/Makefile | 2 +- sys/boot/pc32/Makefile.inc | 2 +- sys/boot/pc32/asmdef/Makefile | 15 +++++++++++++++ sys/boot/pc32/boot0/Makefile | 11 ++++++----- sys/boot/pc32/boot2/Makefile | 15 +++++++-------- 5 files changed, 30 insertions(+), 15 deletions(-) create mode 100644 sys/boot/pc32/asmdef/Makefile diff --git a/sys/boot/pc32/Makefile b/sys/boot/pc32/Makefile index 05ee6fabd6..41af2006b1 100644 --- a/sys/boot/pc32/Makefile +++ b/sys/boot/pc32/Makefile @@ -5,7 +5,7 @@ .endif # must come before boot2 -SUBDIR= btx +SUBDIR= asmdef btx SUBDIR+=boot0 boot0sio boot2 cdboot libi386 loader loader_tftp mbr diff --git a/sys/boot/pc32/Makefile.inc b/sys/boot/pc32/Makefile.inc index 3b5c550eba..19de89aa94 100644 --- a/sys/boot/pc32/Makefile.inc +++ b/sys/boot/pc32/Makefile.inc @@ -1,6 +1,6 @@ # Common defines for all of /sys/boot/i386/ -.if !target(__pc32__) +.if !target(__pc32__) && !defined(__no_pc32_defines) __pc32__: LOADER_ADDRESS?= 0x200000 diff --git a/sys/boot/pc32/asmdef/Makefile b/sys/boot/pc32/asmdef/Makefile new file mode 100644 index 0000000000..bc4105bc24 --- /dev/null +++ b/sys/boot/pc32/asmdef/Makefile @@ -0,0 +1,15 @@ +.PATH: ${.CURDIR}/.. + +PROG= bootasmdef + +CFLAGS+= -I${.CURDIR}/.. + +build-tools: bootasmdef.nx + +# this bootasmdef is used in place, it is not installed anywhere +install: + +# hint for pc32/Makefile.inc +__no_pc32_defines= + +.include diff --git a/sys/boot/pc32/boot0/Makefile b/sys/boot/pc32/boot0/Makefile index 8462ca0c48..27941bd617 100644 --- a/sys/boot/pc32/boot0/Makefile +++ b/sys/boot/pc32/boot0/Makefile @@ -57,15 +57,16 @@ CFLAGS+=-DFLAGS=${BOOT_BOOT0_FLAGS} \ # pull BOOT0_ORIGIN out of bootasm.h # -# -${PROG}: boot0.o bootasmdef.nx - @echo "boot0 origin set to `${.OBJDIR}/bootasmdef.nx BOOT0_ORIGIN`" - ${LD} ${LDFLAGS:N-Wl,*} -N -e start -Ttext `${.OBJDIR}/bootasmdef.nx BOOT0_ORIGIN` -o boot0.out boot0.o +REL0 = `${.OBJDIR}/../asmdef/bootasmdef.nx BOOT0_ORIGIN` + +${PROG}: boot0.o bootasm.h + @echo "NOTE: boot0 origin set to ${REL0}" + ${LD} ${LDFLAGS:N-Wl,*} -N -e start -Ttext ${REL0} -o boot0.out boot0.o objcopy -S -O binary boot0.out ${.TARGET} boot0.o: boot0.S ${CC} -c ${CFLAGS} ${ASSEMBLER_FLAGS} ${.IMPSRC} -o ${.TARGET} -CLEANFILES+= boot0.out boot0.o bootasmdef.nx +CLEANFILES+= boot0.out boot0.o .include diff --git a/sys/boot/pc32/boot2/Makefile b/sys/boot/pc32/boot2/Makefile index 9ad764b168..70ed7f1085 100644 --- a/sys/boot/pc32/boot2/Makefile +++ b/sys/boot/pc32/boot2/Makefile @@ -31,16 +31,16 @@ BTX= ${.CURDIR}/../btx # These origins are taken from bootasm.h. # -REL1 = `${.OBJDIR}/bootasmdef.nx BOOT1_ORIGIN` -REL1D = `${.OBJDIR}/bootasmdef.nx -d BOOT1_ORIGIN` -ORG1 = `${.OBJDIR}/bootasmdef.nx MEM_BIOS_LADDR` -ORG1D = `${.OBJDIR}/bootasmdef.nx -d MEM_BIOS_LADDR` +REL1 = `${.OBJDIR}/../asmdef/bootasmdef.nx BOOT1_ORIGIN` +REL1D = `${.OBJDIR}/../asmdef/bootasmdef.nx -d BOOT1_ORIGIN` +ORG1 = `${.OBJDIR}/../asmdef/bootasmdef.nx MEM_BIOS_LADDR` +ORG1D = `${.OBJDIR}/../asmdef/bootasmdef.nx -d MEM_BIOS_LADDR` # WARNING! The ORG2 calculation is the origin of boot2.bin relative to # the start of the BTX *USER* address space, not the start of physical # memory. # -ORG2= `${.OBJDIR}/bootasmdef.nx BOOT2_VORIGIN` +ORG2= `${.OBJDIR}/../asmdef/bootasmdef.nx BOOT2_VORIGIN` WORLD_CCOPTLEVEL= s # -Os for size constraints in boot2_32 CFLAGS= -Os \ @@ -105,7 +105,7 @@ all: boot1$s boot2$s boot1$s: boot1$s.out objcopy -S -O binary boot1$s.out ${.TARGET} -boot1$s.out: boot1$s.o bootasmdef.nx +boot1$s.out: boot1$s.o bootasm.h ${LD} ${LDFLAGS:N-Wl,*} -e start -Ttext ${ORG1} -o ${.TARGET} ${.ALLSRC:M*.o} boot1$s.o: boot1.S @@ -122,7 +122,7 @@ boot2$s.s: boot2.c boot2$s.h ufsread.c hammer2.c scrc32.c boot2$s.o: boot2$s.s ${AS} ${AFLAGS} -o ${.TARGET} boot2$s.s -boot2$s.h: boot1$s.out bootasmdef.nx +boot2$s.h: boot1$s.out bootasm.h @echo "NOTE: boot2 using xread from boot1 at ${REL1}" ${NM} -t d ${.ALLSRC:M*.out} | awk '/([0-9])+ T xread/ \ { x = $$1 - ORG1; \ @@ -149,7 +149,6 @@ boot2$s.out: boot2$s.o sio.o ${_ADDOBJS$s} CLEANFILES+= boot1$s boot1$s.out boot1$s.o \ boot2$s boot2$s.ldr boot2$s.bin \ boot2$s.ld boot2$s.out boot2$s.o boot2$s.h boot2$s.s \ - bootasmdef.nx \ ${_ADDOBJS$s} hammer2$s.o: hammer2.c -- 2.11.4.GIT