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