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