1
2.include <bsd.init.mk>
3
4PROG=           boot1.elf
5NEWVERSWHAT=    "Open Firmware boot block" ${MACHINE_ARCH}
6INSTALLFLAGS=   -b
7
8FILES=		boot1.hfs
9SRCS=		boot1.c ashldi3.c syncicache.c
10
11CFLAGS+=-I${LDRSRC}
12# Load boot1.elf below kernel.
13#
14# Due to limitiations in the way we load stuff, we have to avoid reusing
15# memory until the kernel MMU code has taken over.
16#
17# 0x38000 is high enough to not interfere with the trap area, but low
18# enough that it doesn't bump into the kernel area starting at 0x100000,
19# even if the entire partition gets used as the load size by a buggy OFW.
20#
21# In theory 0xf0000 would work too under the current 64k size limit for
22# boot1.elf defined in the HFS template, but sometimes boot1.elf is written
23# directly to the PReP partition.
24#
25LDFLAGS=-nostdlib -static -Wl,-N -Wl,-Ttext=0x38000
26
27.PATH:  ${SYSDIR}/libkern ${SRCTOP}/lib/libc/powerpc/gen ${.CURDIR}
28
29# The following inserts out objects into a template HFS 
30# created by generate-hfs.sh
31
32.include "${.CURDIR}/Makefile.hfs"
33
34boot1.hfs: boot1.elf bootinfo.txt
35	echo ${.OBJDIR}
36	uudecode ${.CURDIR}/hfs.tmpl.bz2.uu
37	mv hfs.tmpl.bz2 ${.TARGET}.bz2
38	bzip2 -f -d ${.TARGET}.bz2
39	${DD} if=boot1.elf of=${.TARGET} seek=${BOOT1_OFFSET} conv=notrunc
40	${DD} if=${.CURDIR}/bootinfo.txt of=${.TARGET} seek=${BOOTINFO_OFFSET} \
41	    conv=notrunc
42
43CLEANFILES+= boot1.hfs
44
45MK_PIE=		no
46
47.include <bsd.prog.mk>
48
49