Fix PR port-atari/40315: Bootloader fails on Atari TT030

Add asm sources which provide a fixed entry point for raw bootxx and bootxxx
 because modern aggressive gcc4 may reorder functions in the same source
 and the first function in a C source won't always appear at the beginning
 in its object.

Also overhaul various files in the stand directory:
- rename stand/Makefile.inc to stand/Makefile.booters and
  explicitly include it from each Makefile because the stand
  directory contains non standalone programs like installboot and
  Makefile.inc will be included implicitly from all Makefiles in SUBDIRs
- put more common options into Makefile.booters so that
  all boot programs use proper options (-Os etc.)
- make standalone boot programs compile without installed ${DESTDIR}:
  - create machine and m68k symlinks in ${.OBJDIR} in all boot programs
  - set appropriate make environments to suppress errors and warnings
  - <string.h> isn't there in _STANDALONE case
  - put #ifdef TOSTOOLS (looks equivarent with !_STANDALONE)
    to some files in stand/tostools
  - use ${LD} ${LINKFLAGS} rather than ${CC} ${LDFLAGS}
- create raw binaries on ${PROG} target rather than on beforeinstall
  and stop weird renaming on beforeinstall and afterinstall
- print proper error message if bootxx size is larger than limit
- create ${DESTDIR}/usr/mdec/{milan,std} directories on beforeinstall
  in all boot programs
  (XXX: how can we put MD /usr/mdec/foo directories into src/etc/mtree?)
- prototype warnsfy
- cleanup Makefiles for readablity and remove unnecessary rules
- no need to use daddr_t in installboot because the AHDI label doesn't
  support 64 bit block numbers

Tested by David Ross (PR submitter) on port-atari, and
finally NetBSD/atari on TT030 is now fully functional.

Should be pulled up to netbsd-4 (where gcc4 was initially imported)
and netbsd-5.
This commit is contained in:
tsutsui 2009-01-06 13:35:30 +00:00
parent a15a784800
commit fe5a481b54
17 changed files with 176 additions and 152 deletions

View File

@ -0,0 +1,23 @@
# $NetBSD: Makefile.booters,v 1.1 2009/01/06 13:35:30 tsutsui Exp $
BINDIR= /usr/mdec/${BTYPE:tl}
DBG=
COPTS= -Os -fomit-frame-pointer -fno-function-cse -fstrength-reduce
CPPFLAGS+= -D_STANDALONE -DHEAP_VARIABLE
CPPFLAGS+= -D__daddr_t=int32_t
CFLAGS+= -ffreestanding
CFLAGS+= -Wall
CFLAGS+= -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith
.if !make(obj) && !make(clean) && !make(cleandir)
.BEGIN:
@([ -h machine ] || \
ln -s ${S}/arch/${MACHINE}/include machine)
@([ -h ${MACHINE_ARCH} ] || \
ln -s ${S}/arch/${MACHINE_ARCH}/include ${MACHINE_ARCH})
.NOPATH: machine ${MACHINE_ARCH}
.endif
CLEANFILES+= machine ${MACHINE_ARCH}

View File

@ -1,4 +0,0 @@
# $NetBSD: Makefile.inc,v 1.2 2006/12/01 13:52:46 he Exp $
CPPFLAGS+= -D__daddr_t=int32_t
CFLAGS+= -Os

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile.bootxx,v 1.7 2008/10/19 22:05:21 apb Exp $
# $NetBSD: Makefile.bootxx,v 1.8 2009/01/06 13:35:30 tsutsui Exp $
NOMAN= # defined
@ -6,26 +6,15 @@ NOMAN= # defined
.include <bsd.own.mk>
PROG= bootxx
SRCS= bootxx.c filesystem.c
STRIPFLAG=
BINDIR= /usr/mdec/${BTYPE:tl}
BINMODE=${NONBINMODE}
# XXX SHOULD NOT NEED TO DEFINE THESE!
LIBCRT0=
DEFS= -D_STANDALONE -DHEAP_VARIABLE
INCL= -I. -I${S_LIBTOS} -I${S_MACHSA} -I${S_KERN} -I${S_SA} -I${S}
CPPFLAGS+= ${DEFS} ${INCL}
CFLAGS+= -Wall -Wno-uninitialized
CFLAGS+= -fomit-frame-pointer -fno-function-cse -fstrength-reduce
CFLAGS+= -ffreestanding
.if ${OBJECT_FMT} == "ELF"
LDFLAGS= -static -nostdlib -Wl,-x,-N,-e,bootxx,-Ttext,${LOADADDR}
.else
LDFLAGS= -static -nostdlib -Wl,-N,-Ttext,${LOADADDR}
.endif
LIBC=
LIBCRTBEGIN=
LIBCRTEND=
# logically src/sys
S=${.CURDIR}/../../../../..
@ -38,37 +27,47 @@ S_MACHSAOBJ!= cd ${S_MACHSA} && ${PRINTOBJDIR}
LIBSA=${S_MACHSAOBJ}/libsa.a
DPADD= ${LIBSA}
LDADD= ${LIBSA}
.include "../../Makefile.booters"
.include "../../xxboot/${BTYPE}_LOADADDR"
beforeinstall:
@len=`${SIZE} ${PROG} | ${TOOL_AWK} 'NR==2 { print $$1+$$2 }'`; \
if [ "$$len" -gt 6656 ]; then \
${SIZE} ${PROG}; \
exit 1; \
fi;
${OBJCOPY} -O binary ${PROG} ${PROG}XX
@${TOOL_CAT} ${PROG}XX /dev/zero | dd of=${PROG}X \
bs=1 count=6656 2>/dev/null
@mv -f ${PROG} ${PROG}XX
@mv -f ${PROG}X ${PROG};
${INSTALL_DIR} ${DESTDIR}${BINDIR}
afterinstall:
@mv -f ${PROG}XX ${PROG}
BOOTXX_MAXSIZE= 6656
.s.o: ../../xxboot/${BTYPE}_LOADADDR
${CPP} ${CPPFLAGS} ${.IMPSRC} | ${AS} ${ASFLAGS} -o ${.TARGET}
.c.o:
${CC} ${CFLAGS} ${CPPFLAGS} -c ${.IMPSRC} -o ${.TARGET}
${PROG}:
${CC} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD}
${PROG}: ../../xxboot/${BTYPE}_LOADADDR
CPPFLAGS+= -I. -I${S_LIBTOS} -I${S_MACHSA} -I${S_KERN} -I${S_SA} -I${S}
.if ${OBJECT_FMT} == "ELF"
LINKFLAGS= -static -N -e start -Ttext ${LOADADDR}
.else
LINKFLAGS= -static -N -Ttext ${LOADADDR}
.endif
.PATH: ${.CURDIR}/.. ${S_LIBTOS}
.include "../../xxboot/${BTYPE}_LOADADDR"
#
# Warning: start.S should be the first source!
#
SRCS= start.S bootxx.c filesystem.c
LIBS= ${LIBSA}
beforeinstall:
${INSTALL_DIR} ${DESTDIR}${BINDIR}
${PROG}: ${OBJS} ${LIBS}
${_MKTARGET_LINK}
${LD} ${LINKFLAGS} -o ${.TARGET}.elf ${OBJS} ${LIBS}
${OBJCOPY} -O binary ${PROG}.elf ${PROG}.bin
${SIZE} ${PROG}.elf
@len=`${SIZE} ${PROG}.elf | \
${TOOL_AWK} 'NR==2 { print $$1+$$2 }'`; \
if [ "$$len" -gt ${BOOTXX_MAXSIZE} ]; then \
echo "### ${PROG} text+data size $$len is" \
"larger than ${BOOTXX_MAXSIZE}" >&2; \
exit 1; \
fi;
${TOOL_CAT} ${PROG}.bin /dev/zero | \
dd of=${PROG}.tmp bs=1 count=6656 2>/dev/null
mv ${PROG}.tmp ${.TARGET}
CLEANFILES+= ${PROG}.elf ${PROG}.bin ${PROG}.tmp
.include <bsd.prog.mk>

View File

@ -1,4 +1,4 @@
/* $NetBSD: bootxx.c,v 1.12 2005/12/11 12:17:00 christos Exp $ */
/* $NetBSD: bootxx.c,v 1.13 2009/01/06 13:35:30 tsutsui Exp $ */
/*
* Copyright (c) 1995 Waldi Ravens.
@ -34,7 +34,6 @@
#include <lib/libsa/stand.h>
#include <atari_stand.h>
#include <string.h>
#include <libkern.h>
#include <tosdefs.h>
#include <sys/boot_flag.h>
@ -44,6 +43,7 @@
typedef int (*bxxx_t)(void *, void *, struct osdsc *);
int bootxx(void *, void *, int);
void boot_BSD(struct kparamb *) __attribute__((noreturn));
int bootxxx(void *, void *, struct osdsc *);
int load_booter(struct osdsc *);
@ -61,7 +61,7 @@ bootxx(void *readsector, void *disklabel, int autoboot)
setheap(end, (void*)(LOADADDR3 - 4));
printf("\033v\nNetBSD/atari secondary bootloader"
" ($Revision: 1.12 $)\n\n");
" ($Revision: 1.13 $)\n\n");
if (init_dskio(readsector, disklabel, -1))
return -1;

View File

@ -0,0 +1,8 @@
/* $NetBSD: start.S,v 1.1 2009/01/06 13:35:30 tsutsui Exp $ */
#include <m68k/asm.h>
.text
ASENTRY_NOPROFILE(start)
bra _C_LABEL(bootxx) | bootxx is small enough so bra works

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile.bootxxx,v 1.3 2005/12/11 12:17:00 christos Exp $
# $NetBSD: Makefile.bootxxx,v 1.4 2009/01/06 13:35:30 tsutsui Exp $
NOMAN= # defined
@ -6,28 +6,15 @@ NOMAN= # defined
.include <bsd.own.mk>
PROG= boot.atari
#
# Warning: bootxxx.c should be the first source!
#
SRCS= bootxxx.c aout.c bsdstart.s elf.c filesystem.c sysinfo.c
STRIPFLAG=
BINDIR=/usr/mdec/${BTYPE:tl}
BINMODE=${NONBINMODE}
# XXX SHOULD NOT NEED TO DEFINE THESE!
LIBCRT0=
DEFS= -D_STANDALONE -DHEAP_VARIABLE
INCL= -I. -I${S_LIBTOS} -I${S_MACHSA} -I${S_KERN} -I${S_SA} -I${S}
CPPFLAGS+= ${DEFS} ${INCL}
CFLAGS+= -fomit-frame-pointer -Wall -fno-function-cse -fstrength-reduce
CFLAGS+= -ffreestanding
.if ${OBJECT_FMT} == "ELF"
LDFLAGS= -static -nostdlib -Wl,-x,-N,-e,bootxxx,-Ttext,${LOADADDR3}
.else
LDFLAGS= -static -nostdlib -Wl,-N,-Ttext,${LOADADDR3}
.endif
LIBC=
LIBCRTBEGIN=
LIBCRTEND=
# logically src/sys
S=${.CURDIR}/../../../../..
@ -40,31 +27,37 @@ S_MACHSAOBJ!= cd ${S_MACHSA} && ${PRINTOBJDIR}
LIBSA=${S_MACHSAOBJ}/libsa.a
DPADD= ${LIBSA}
LDADD= ${LIBSA}
.include "../../Makefile.booters"
.include "../../xxboot/${BTYPE}_LOADADDR"
CPPFLAGS+= -I. -I${S_LIBTOS} -I${S_MACHSA} -I${S_KERN} -I${S_SA} -I${S}
.if ${OBJECT_FMT} == "ELF"
LINKFLAGS= -static -N -e start -Ttext ${LOADADDR3}
.else
LINKFLAGS= -static -N -Ttext ${LOADADDR3}
.endif
.PATH: ${.CURDIR}/.. ${S_LIBTOS}
#
# Warning: start.S should be the first source!
#
SRCS= start.S bootxxx.c aout.c bsdstart.s elf.c filesystem.c sysinfo.c
LIBS= ${LIBSA}
beforeinstall:
${OBJCOPY} -O binary ${PROG} ${PROG}X
@mv -f ${PROG} ${PROG}XX
@mv -f ${PROG}X ${PROG};
${INSTALL_DIR} ${DESTDIR}${BINDIR}
afterinstall:
${INSTALL_FILE} -o root -g wheel -m 644 \
${DESTDIR}${BINDIR}/${PROG} ${DESTDIR}/
@mv -f ${PROG}XX ${PROG}
.s.o:
${CPP} ${CPPFLAGS} ${.IMPSRC} | ${AS} ${ASFLAGS} -o ${.TARGET}
${PROG}: ${OBJS} ${LIBS}
${_MKTARGET_LINK}
${LD} ${LINKFLAGS} -o ${.TARGET}.elf ${OBJS} ${LIBS}
${OBJCOPY} -O binary ${PROG}.elf ${.TARGET}
.c.o:
${CC} ${CFLAGS} ${CPPFLAGS} -c ${.IMPSRC} -o ${.TARGET}
CLEANFILES+= ${PROG}.elf
${PROG}:
${CC} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD}
${PROG}: ../../xxboot/${BTYPE}_LOADADDR
.PATH: ${.CURDIR}/.. ${S_LIBTOS}
.include "../../xxboot/${BTYPE}_LOADADDR"
.include <bsd.prog.mk>

View File

@ -1,4 +1,4 @@
/* $NetBSD: bootxxx.c,v 1.3 2005/12/11 12:17:00 christos Exp $ */
/* $NetBSD: bootxxx.c,v 1.4 2009/01/06 13:35:30 tsutsui Exp $ */
/*
* Copyright (c) 2001 Leo Weppelman.
@ -35,7 +35,6 @@
#include <lib/libsa/stand.h>
#include <atari_stand.h>
#include <string.h>
#include <libkern.h>
#include <sys/boot_flag.h>
#include <sys/reboot.h>
@ -44,6 +43,7 @@
#include <libtos.h>
#include <tosdefs.h>
int bootxxx(void *, void *, osdsc_t *);
void boot_BSD __P((struct kparamb *)__attribute__((noreturn)));
int
@ -61,7 +61,7 @@ bootxxx(readsector, disklabel, od)
/* XXX: Limit should be 16MB */
setheap(end, (void*)0x1000000);
printf("\033v\nNetBSD/Atari tertiary bootloader "
"($Revision: 1.3 $)\n\n");
"($Revision: 1.4 $)\n\n");
if (init_dskio(readsector, disklabel, od->rootfs))
return(-1);

View File

@ -0,0 +1,8 @@
/* $NetBSD: start.S,v 1.1 2009/01/06 13:35:30 tsutsui Exp $ */
#include <m68k/asm.h>
.text
ASENTRY_NOPROFILE(start)
jra _C_LABEL(bootxxx)

View File

@ -1,4 +1,4 @@
/* $NetBSD: disklabel.c,v 1.2 1998/07/22 12:49:42 leo Exp $ */
/* $NetBSD: disklabel.c,v 1.3 2009/01/06 13:35:30 tsutsui Exp $ */
/*
* Copyright (c) 1995 Waldi Ravens
@ -57,10 +57,10 @@ struct ahdilabel {
};
u_int dkcksum __P((struct disklabel *));
daddr_t readdisklabel __P((char *, struct disklabel *));
u_int32_t readdisklabel __P((char *, struct disklabel *));
static int bsd_label __P((int, off_t, struct disklabel *));
static int ahdi_label __P((int, daddr_t *, struct disklabel *));
static int ahdi_label __P((int, u_int32_t *, struct disklabel *));
static int ahdi_getparts __P((int, daddr_t, daddr_t, struct ahdilabel *));
u_int
@ -76,13 +76,13 @@ dkcksum (dl)
return(sum);
}
daddr_t
u_int32_t
readdisklabel (fn, dl)
char *fn;
struct disklabel *dl;
{
int fd, e;
daddr_t bbsec;
u_int32_t bbsec;
memset(dl, 0, sizeof *dl);
@ -137,7 +137,7 @@ bsd_label (fd, offs, label)
static int
ahdi_label (fd, bbsec, label)
int fd;
daddr_t *bbsec;
u_int32_t *bbsec;
struct disklabel *label;
{
struct ahdilabel al;

View File

@ -1,4 +1,4 @@
/* $NetBSD: installboot.c,v 1.21 2008/11/15 21:33:12 abs Exp $ */
/* $NetBSD: installboot.c,v 1.22 2009/01/06 13:35:30 tsutsui Exp $ */
/*
* Copyright (c) 1995 Waldi Ravens
@ -59,7 +59,7 @@ static u_int abcksum __P((void *));
static void setNVpref __P((void));
static void setIDEpar __P((u_int8_t *, size_t));
static void mkahdiboot __P((struct ahdi_root *, char *,
char *, daddr_t));
char *, u_int32_t));
static void mkbootblock __P((struct bootblock *, char *,
char *, struct disklabel *, u_int));
static void install_fd __P((char *, struct disklabel *));
@ -272,7 +272,7 @@ install_sd (devnm, label)
const char *machpath;
char *xxb00t, *xxboot, *bootxx;
struct disklabel rawlabel;
daddr_t bbsec;
u_int32_t bbsec;
u_int magic;
if (label->d_partitions[0].p_size == 0)
@ -312,7 +312,7 @@ install_sd (devnm, label)
mkbootblock(&bootarea, xxboot, bootxx, label, magic);
if (!nowrite) {
off_t bbo = bbsec * AHDI_BSIZE;
off_t bbo = (off_t)bbsec * AHDI_BSIZE;
int fd;
if ((fd = open(devnm, O_WRONLY)) < 0)
@ -346,7 +346,7 @@ install_wd (devnm, label)
const char *machpath;
char *xxb00t, *xxboot, *bootxx;
struct disklabel rawlabel;
daddr_t bbsec;
u_int32_t bbsec;
u_int magic;
if (label->d_partitions[0].p_size == 0)
@ -388,7 +388,7 @@ install_wd (devnm, label)
int fd;
off_t bbo;
bbo = bbsec * AHDI_BSIZE;
bbo = (off_t)bbsec * AHDI_BSIZE;
if ((fd = open(devnm, O_WRONLY)) < 0)
err(EXIT_FAILURE, "%s", devnm);
if (lseek(fd, bbo, SEEK_SET) != bbo)
@ -418,7 +418,7 @@ mkahdiboot (newroot, xxb00t, devnm, bbsec)
struct ahdi_root *newroot;
char *xxb00t,
*devnm;
daddr_t bbsec;
u_int32_t bbsec;
{
struct ahdi_root tmproot;
struct ahdi_part *pd;

View File

@ -1,4 +1,4 @@
/* $NetBSD: installboot.h,v 1.8 2005/12/11 12:17:00 christos Exp $ */
/* $NetBSD: installboot.h,v 1.9 2009/01/06 13:35:30 tsutsui Exp $ */
/*
* Copyright (c) 1995 Waldi Ravens
@ -46,4 +46,4 @@
#define BOOTVERSION 0x03
u_int dkcksum __P((struct disklabel *));
daddr_t readdisklabel __P((char *, struct disklabel *));
u_int32_t readdisklabel __P((char *, struct disklabel *));

View File

@ -1,18 +1,26 @@
# $NetBSD: Makefile,v 1.27 2005/12/30 00:24:48 he Exp $
# $NetBSD: Makefile,v 1.28 2009/01/06 13:35:30 tsutsui Exp $
LIB= sa
NOPIC=# defined
NOPROFILE=# defined
OBJMACHINE=
NOPIC= # defined
NOPROFILE= # defined
NOLINT= # defnied
CPPFLAGS+= ${DEFS} ${INCL}
CFLAGS+= -ffreestanding
CFLAGS+= -fomit-frame-pointer -Wall -fno-function-cse -fstrength-reduce
NO_NET=
DEFS= -D_STANDALONE -DHEAP_VARIABLE
INCL= -I${S_MACHSA} -I${S_KERN} -I${S_SA} -I${S}
# Logically src/sys
S=${.CURDIR}/../../../..
S_SA=${S}/lib/libsa
S_KERN=${S}/lib/libkern
S_MACHSA=${S}/arch/atari/stand/libsa
.include "${S}/../common/lib/libc/Makefile.inc"
.include "../Makefile.booters"
CPPFLAGS+= -I. -I${S_MACHSA} -I${S_KERN} -I${S_SA} -I${S}
.PATH: ${S_SA} ${S_KERN}
#
# NetBSD/atari specific replacements: dev.c
@ -44,24 +52,6 @@ SRCS+= bootp.c rarp.c bootparam.c
# boot filesystems
SRCS+= ufs.c nfs.c
# Logically src/sys
S=${.CURDIR}/../../../..
S_SA=${S}/lib/libsa
S_KERN=${S}/lib/libkern
S_MACHSA=${S}/arch/atari/stand/libsa
.include "${S}/../common/lib/libc/Makefile.inc"
.PATH: ${S_SA} ${S_KERN}
.if !make(obj) && !make(clean) && !make(cleandir)
.BEGIN:
@([ -h machine ] || ln -s ${S}/arch/${MACHINE}/include machine)
@([ -h ${MACHINE_ARCH} ] || ln -s ${S}/arch/${MACHINE_ARCH}/include ${MACHINE_ARCH})
.NOPATH: machine m68k
.endif
CLEANFILES+= machine m68k
# only needed during build
libinstall::

View File

@ -1,4 +1,4 @@
/* $NetBSD: aout.c,v 1.10 2008/04/28 20:23:15 martin Exp $ */
/* $NetBSD: aout.c,v 1.11 2009/01/06 13:35:30 tsutsui Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -44,7 +44,6 @@
#include <lib/libsa/stand.h>
#include <atari_stand.h>
#include <string.h>
#include <libkern.h>
#include <sys/exec_aout.h>

View File

@ -1,4 +1,4 @@
/* $NetBSD: elf.c,v 1.8 2008/04/28 20:23:15 martin Exp $ */
/* $NetBSD: elf.c,v 1.9 2009/01/06 13:35:30 tsutsui Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -43,7 +43,6 @@
#include <lib/libsa/stand.h>
#include <atari_stand.h>
#include <string.h>
#include <libkern.h>
#include <sys/exec_elf.h>

View File

@ -1,4 +1,4 @@
/* $NetBSD: libtos.h,v 1.4 2002/02/24 20:51:08 leo Exp $ */
/* $NetBSD: libtos.h,v 1.5 2009/01/06 13:35:30 tsutsui Exp $ */
/*
* Copyright (c) 1995 Waldi Ravens.
@ -49,8 +49,14 @@
#endif
#endif
#ifdef TOSTOOLS
#include <sys/types.h>
#include <stdarg.h>
#define VA_LIST va_list
#else
#include <lib/libsa/stand.h>
#define VA_LIST _BSD_VA_LIST_
#endif
#ifndef int8_t
/*
@ -76,7 +82,7 @@ EXTERN void press_any_key PROTO((void));
EXTERN void redirect_output PROTO((char *));
EXTERN void set_wait_for_key PROTO((void));
EXTERN void sys_info PROTO((struct osdsc *));
EXTERN int veprintf PROTO((char *, va_list));
EXTERN int veprintf PROTO((char *, VA_LIST));
EXTERN void xexit PROTO((int)) NORETURN;
EXTERN void * xmalloc PROTO((size_t));
EXTERN void * xrealloc PROTO((void *, size_t));

View File

@ -1,4 +1,4 @@
/* $NetBSD: sysinfo.c,v 1.7 2008/04/28 20:23:15 martin Exp $ */
/* $NetBSD: sysinfo.c,v 1.8 2009/01/06 13:35:30 tsutsui Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -36,7 +36,6 @@
#include <lib/libsa/stand.h>
#include <atari_stand.h>
#include <string.h>
#include <libkern.h>
#include <machine/cpu.h>
#endif /* TOSTOOLS */

View File

@ -1,19 +1,22 @@
# $NetBSD: Makefile.xxboot,v 1.4 2005/12/11 12:17:02 christos Exp $
# $NetBSD: Makefile.xxboot,v 1.5 2009/01/06 13:35:30 tsutsui Exp $
BINDIR= /usr/mdec/${BTYPE:tl}
BINMODE= ${NONBINMODE}
# XXX SHOULD NOT NEED TO DEFINE THESE!
LIBCRT0=
LIBC=
LIBCRTBEGIN=
LIBCRTEND=
.include "../../Makefile.booters"
.include "../${BTYPE}_LOADADDR"
STRIPFLAG=
LDFLAGS= -nostdlib -static -Wl,-x,-Ttext,0,-N
CPPFLAGS+= -I- -I${.CURDIR}/.. -I${.CURDIR}/../.. -D${BTYPE}
LINKFLAGS= -static -x -N -Ttext 0
CPPFLAGS+= -I. -I${.CURDIR}/.. -I${.CURDIR}/../.. -D${BTYPE}
beforeinstall:
${OBJCOPY} -O binary ${PROG} ${PROG}X
@mv -f ${PROG} ${PROG}XX
@mv -f ${PROG}X ${PROG}
afterinstall:
@mv -f ${PROG}XX ${PROG}
${INSTALL_DIR} ${DESTDIR}${BINDIR}
.s.o: ../${BTYPE}_LOADADDR
${CPP} ${CPPFLAGS} ${.IMPSRC} | ${AS} ${ASFLAGS} -o ${.TARGET}
@ -26,7 +29,8 @@ afterinstall:
false; \
fi
${PROG}:
${CC} ${LDFLAGS} -o ${.TARGET} ${OBJS}
${PROG}: ${OBJS}
${LD} ${LINKFLAGS} -o ${PROG}.elf ${OBJS}
${OBJCOPY} -O binary ${PROG}.elf ${.TARGET}
.include "../${BTYPE}_LOADADDR"
CLEANFILES+= ${PROG}.elf