Training courses

Kernel and Embedded Linux

Bootlin training courses

Embedded Linux, kernel,
Yocto Project, Buildroot, real-time,
graphics, boot time, debugging...

Bootlin logo

Elixir Cross Referencer

#	$NetBSD: Makefile.xxboot,v 1.20 2022/04/25 15:12:07 mlelstv Exp $

NOMAN=		# defined

.include <bsd.own.mk>

BOOT=	xxboot_$(FS)
VERSIONFILE=	${.CURDIR}/../version
VERSION!=	${TOOL_AWK} -F: '$$1 ~ /^[0-9.]*$$/ { it = $$1; } \
			END { print it }' ${VERSIONFILE}
NEWVERSWHAT=	"${BOOT}"

# text and bss addresses
TEXT=		0x003000	# Primary (me)
TEXTDATASIZE=	0x002000	# 8KB for UFS at maximum
				# 30KB (=(16-1)*2048) for ISO9660 at max.
				# but should use up to 8KB.  See boot.S
BOOT_TEXT=	0x006000	# Secondary (/boot)

PROG=		$(BOOT)
BINDIR=		/usr/mdec
STRIPFLAG=
BINMODE=	444

S=		${.CURDIR}/../../../../..
M=		$S/arch/x68k
.PATH:		${.CURDIR}/..
SRCS=	boot.S bootmain.c xx.c
SRCS+=	ashrdi3.S
SRCS+=	ashldi3.S
SRCS+=	memcpy.S
SRCS+=	memset.S
SRCS+=	memcmp.S

.include "${S}/conf/newvers_stand.mk"

CFLAGS=	-Os -fomit-frame-pointer -fno-unwind-tables -Wno-attributes
CFLAGS+= -m68020-60
#CFLAGS+= -Wall
CPPFLAGS+= -D_STANDALONE
CPPFLAGS+= -DTEXTADDR="$(TEXT)" -DBOOT_TEXTADDR="$(BOOT_TEXT)"
CPPFLAGS+= -DTDSIZE="$(TEXTDATASIZE)"
CPPFLAGS+= -DPROG=\"$(PROG)\" -DBOOT_VERS=\"$(VERSION)\"
CPPFLAGS+= -DBOOT_STAGE1 $(BOOTCPPFLAGS)
CPPFLAGS+= -DHEAP_START=0x00100000
CPPFLAGS+= -nostdinc -I${.OBJDIR} -I${S}
CPPFLAGS+= -I$M/stand/libiocs -I$M/stand/libsa -I$M/stand/common
AFLAGS=	   ${CFLAGS:M-[ID]*}
AFLAGS+=   -Wa,-l
LINKFLAGS=   -n -Bstatic -T ${.CURDIR}/../xxboot.ldscript
LINKFLAGS+=  --defsym=TEXTADDR=$(TEXT)
LINKFLAGS+=  --defsym=BOOT_TEXTADDR=$(BOOT_TEXT)
LINKFLAGS+=  --defsym=TEXTDATASIZE=$(TEXTDATASIZE)
LIBIOCS!= cd $M/stand/libiocs && ${PRINTOBJDIR}
LIBSA!=	  cd $M/stand/libsa && ${PRINTOBJDIR}
LDLIBS=	  -L ${LIBSA}/lib/kern -lkern
LDLIBS+=  -L${LIBIOCS} -liocs

.PATH: $S/lib/libsa
CPPFLAGS+= -DLIBSA_SINGLE_FILESYSTEM=$(FS)
CPPFLAGS+= -DLIBSA_SINGLE_DEVICE=xx
CPPFLAGS+= -DLIBSA_NO_FD_CHECKING
CPPFLAGS+= -DLIBSA_NO_FS_WRITE
CPPFLAGS+= -DLIBSA_NO_RAW_ACCESS
CPPFLAGS+= -DLIBSA_NO_TWIDDLE
CPPFLAGS+= -DUSTAR_SECT_PER_CYL=30
SRCS+=	open.c close.c read.c lseek.c loadfile.c loadfile_aout.c alloc.c
SRCS+=	errno.c globals.c files.c
SRCS+=  $(FS).c
SRCS+=	${BOOTSRCS}

.PATH: $M/stand/common
SRCS+=	exec_image.S

.include "${.CURDIR}/../../Makefile.booters"

CLEANFILES+=	${PROG}.map


${PROG}: $(OBJS)
	${_MKTARGET_LINK}
	$(LD) $(LINKFLAGS) -Map=${PROG}.map -o ${PROG} $(OBJS) $(LDLIBS)
	: Print some addresses for convenience
	@${TOOL_AWK} '/first_kbyte$$/ { print "\t\t" $$2 "\t" $$1 }' ${PROG}.map
	@echo "		filesize	"`${TOOL_STAT} -f %z ${PROG}`
	@if [ `${TOOL_STAT} -f %z ${PROG}` -gt 8192 ]; then \
	    echo "${PROG} filesize exceeds 8192 bytes"; \
		exit 1; \
	fi
	${TOUCHPROG}

.include <bsd.prog.mk>