Port MBR.
Patch by Antoine LECA.
This commit is contained in:
parent
6acebc04b6
commit
81d26afebe
|
@ -1,6 +1,9 @@
|
||||||
# $NetBSD: Makefile.mbr,v 1.18 2011/05/20 15:05:02 joerg Exp $
|
# $NetBSD: Makefile.mbr,v 1.17 2009/11/20 17:28:19 dsl Exp $
|
||||||
|
|
||||||
S= ${.CURDIR}/../../../../..
|
.if !defined(COMPILER_TYPE) || ${COMPILER_TYPE} != "gnu"
|
||||||
|
CC:=clang
|
||||||
|
COMPILER_TYPE:=gnu
|
||||||
|
.endif
|
||||||
|
|
||||||
NOMAN= # defined
|
NOMAN= # defined
|
||||||
|
|
||||||
|
@ -16,6 +19,8 @@ PIE_AFLAGS=
|
||||||
.include <bsd.own.mk>
|
.include <bsd.own.mk>
|
||||||
|
|
||||||
STRIPFLAG= # override
|
STRIPFLAG= # override
|
||||||
|
TOOL_SED?= sed
|
||||||
|
NM?= nm
|
||||||
|
|
||||||
SRCS?= mbr.S
|
SRCS?= mbr.S
|
||||||
|
|
||||||
|
@ -24,30 +29,33 @@ BINMODE= 444
|
||||||
|
|
||||||
.PATH: ${.CURDIR}/..
|
.PATH: ${.CURDIR}/..
|
||||||
|
|
||||||
|
LOADADDR= 0x8800
|
||||||
|
|
||||||
LDFLAGS+= -nostdlib -Wl,-e,start
|
LDFLAGS+= -nostdlib -Wl,-e,start
|
||||||
CPPFLAGS+= -I. -I${.CURDIR}/../../lib -I${S}
|
CPPFLAGS+= -I. -I${.CURDIR}/../../lib -DLOADADDR=${LOADADDR}
|
||||||
|
|
||||||
.if ${MACHINE_ARCH} == "x86_64"
|
.if ${MACHINE_ARCH} == "x86_64"
|
||||||
LDFLAGS+= -Wl,-m,elf_i386
|
LDFLAGS+= -Wl,-m,elf_i386
|
||||||
AFLAGS+= -m32
|
AFLAGS+= -m32
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
BUILDSYMLINKS+= $S/arch/i386/include machine \
|
AFLAGS+= "-Wa,--divide"
|
||||||
$S/arch/x86/include x86
|
|
||||||
|
|
||||||
DPSRCS+= machine x86
|
# NetBSD can be compiled from a foreign host, MINIX do not. So commented out.
|
||||||
|
# Make sys/ a local thing for benefit of cross-compilers
|
||||||
|
#S= ${.CURDIR}/../../../../..
|
||||||
|
#CPPFLAGS+= -I${S}
|
||||||
|
# And same for machine/; need a bit more work because of symlink
|
||||||
|
#BUILDSYMLINKS+= $S/arch/i386/include machine \
|
||||||
|
# $S/arch/x86/include x86
|
||||||
|
#DPSRCS+= machine x86
|
||||||
|
|
||||||
CLEANFILES+= ${PROG}.tmp
|
CLEANFILES+= ${PROG}.tmp
|
||||||
|
|
||||||
LOADADDR= 0x8800
|
|
||||||
|
|
||||||
AFLAGS.mbr.S= ${${ACTIVE_CC} == "clang":?-no-integrated-as:}
|
|
||||||
AFLAGS.gpt.S= ${${ACTIVE_CC} == "clang":?-no-integrated-as:}
|
|
||||||
|
|
||||||
${PROG}: ${OBJS}
|
${PROG}: ${OBJS}
|
||||||
${_MKTARGET_LINK}
|
${_MKTARGET_LINK}
|
||||||
${CC} -o ${PROG}.tmp ${LDFLAGS} -Wl,-Ttext,${LOADADDR} ${OBJS}
|
${CC} -o ${PROG}.tmp ${LDFLAGS} -Wl,-Ttext,${LOADADDR} ${OBJS}
|
||||||
@ set -- $$( ${NM} -t d ${PROG}.tmp | grep '\<mbr_space\>' \
|
@ set -- $$( ${NM} -t d ${PROG}.tmp | grep 'mbr_space' \
|
||||||
| ${TOOL_SED} 's/^0*//' ); \
|
| ${TOOL_SED} 's/^0*//' ); \
|
||||||
echo "#### There are $$1 free bytes in ${PROG}"
|
echo "#### There are $$1 free bytes in ${PROG}"
|
||||||
${OBJCOPY} -O binary ${PROG}.tmp ${PROG}
|
${OBJCOPY} -O binary ${PROG}.tmp ${PROG}
|
||||||
|
|
|
@ -4,6 +4,7 @@ PROG= gptmbr.bin
|
||||||
SRCS= gptmbr.S
|
SRCS= gptmbr.S
|
||||||
|
|
||||||
AFLAGS.gptmbr.S= ${${ACTIVE_CC} == "clang":?-no-integrated-as:}
|
AFLAGS.gptmbr.S= ${${ACTIVE_CC} == "clang":?-no-integrated-as:}
|
||||||
|
AFLAGS+= "-Wa,--divide"
|
||||||
|
|
||||||
.include <../Makefile.mbr>
|
.include <../Makefile.mbr>
|
||||||
|
|
||||||
|
|
|
@ -515,7 +515,14 @@ do_read:
|
||||||
*/
|
*/
|
||||||
movl %ebp, %esi
|
movl %ebp, %esi
|
||||||
pop %dx /* recover drive # */
|
pop %dx /* recover drive # */
|
||||||
|
#ifdef __minix
|
||||||
|
/* There some bug in MINIX tools, which causes to
|
||||||
|
* generate wrong code for "jmp BOOTADDR" (relocation issue).
|
||||||
|
*/
|
||||||
|
jmp start - LOADADDR + BOOTADDR
|
||||||
|
#else
|
||||||
jmp BOOTADDR
|
jmp BOOTADDR
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifndef NO_CHS
|
#ifndef NO_CHS
|
||||||
|
|
|
@ -5,4 +5,6 @@ AFLAGS+= -DBOOTSEL -DBOOT_EXTENDED -DCOM_PORT=0 -DCOM_BAUD=9600
|
||||||
AFLAGS+= -DTERSE_ERROR -DNO_CHS
|
AFLAGS+= -DTERSE_ERROR -DNO_CHS
|
||||||
AFLAGS+= "-DBOOTSEL_FLAGS=MBR_BS_ACTIVE|MBR_BS_EXTLBA|MBR_BS_ASCII"
|
AFLAGS+= "-DBOOTSEL_FLAGS=MBR_BS_ACTIVE|MBR_BS_EXTLBA|MBR_BS_ASCII"
|
||||||
|
|
||||||
|
AFLAGS+= "-Wa,--divide"
|
||||||
|
|
||||||
.include <../Makefile.mbr>
|
.include <../Makefile.mbr>
|
||||||
|
|
Loading…
Reference in a new issue