1# 2# CDDL HEADER START 3# 4# The contents of this file are subject to the terms of the 5# Common Development and Distribution License, Version 1.0 only 6# (the "License"). You may not use this file except in compliance 7# with the License. 8# 9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10# or http://www.opensolaris.org/os/licensing. 11# See the License for the specific language governing permissions 12# and limitations under the License. 13# 14# When distributing Covered Code, include this CDDL HEADER in each 15# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16# If applicable, add the following below this CDDL HEADER, with the 17# fields enclosed by brackets "[]" replaced with your own identifying 18# information: Portions Copyright [yyyy] [name of copyright owner] 19# 20# CDDL HEADER END 21# 22# 23#ident "%Z%%M% %I% %E% SMI" 24# 25# Copyright 2004 Sun Microsystems, Inc. All rights reserved. 26# Use is subject to license terms. 27# 28# psm/stand/boot/sparcv9/Makefile.com 29 30 31include $(TOPDIR)/psm/stand/boot/Makefile.boot 32 33TARG_MACH = sparcv9 34 35BOOTSRCDIR = ../.. 36 37TOP_CMN_DIR = $(SRC)/common 38CMN_DIR = $(BOOTSRCDIR)/common 39MACH_DIR = ../../sparc/common 40PLAT_DIR = . 41 42BOOT_SRC = boot.c wanboot.c 43 44CONF_SRC = ufsconf.c nfsconf.c hsfsconf.c wbfsconf.c wbcli.c 45 46TOP_CMN_C_SRC = getoptstr.c 47 48MISC_SRC = ramdisk.c 49 50CMN_C_SRC = heap_kmem.c readfile.c 51 52MACH_C_SRC = boot_plat.c bootops.c bootprop.c boot_services.c bootflags.c 53MACH_C_SRC += get.c 54 55BOOT_OBJS = $(BOOT_SRC:%.c=%.o) 56BOOT_L_OBJS = $(BOOT_OBJS:%.o=%.ln) 57 58CONF_OBJS = $(CONF_SRC:%.c=%.o) 59CONF_L_OBJS = $(CONF_OBJS:%.o=%.ln) 60 61MISC_OBJS = $(MISC_SRC:%.c=%.o) 62MISC_L_OBJS = $(MISC_OBJS:%.o=%.ln) 63 64SRT0_OBJ = $(SRT0_S:%.s=%.o) 65SRT0_L_OBJ = $(SRT0_OBJ:%.o=%.ln) 66 67C_SRC = $(TOP_CMN_C_SRC) $(CMN_C_SRC) $(MACH_C_SRC) $(ARCH_C_SRC) 68C_SRC += $(PLAT_C_SRC) 69S_SRC = $(MACH_S_SRC) $(ARCH_S_SRC) $(PLAT_S_SRC) 70 71OBJS = $(C_SRC:%.c=%.o) $(S_SRC:%.s=%.o) 72L_OBJS = $(OBJS:%.o=%.ln) 73 74CPPDEFS = $(ARCHOPTS) -D$(PLATFORM) -D_BOOT -D_KERNEL -D_MACHDEP 75CPPDEFS += -D_ELF64_SUPPORT 76CPPINCS += -I$(TOP_CMN_DIR) 77CPPINCS += -I$(SRC)/uts/common 78CPPINCS += -I$(SRC)/uts/sun 79CPPINCS += -I$(SRC)/uts/sun4 80CPPINCS += -I$(SRC)/uts/$(PLATFORM) 81CPPINCS += -I$(SRC)/uts/sparc/$(ARCHVERS) 82CPPINCS += -I$(SRC)/uts/sparc 83CPPINCS += -I$(SRC)/uts/$(ARCHMMU) 84CPPINCS += -I$(SRC)/common/net/wanboot 85CPPINCS += -I$(SRC)/common/net/wanboot/crypt 86CPPINCS += -I$(ROOT)/usr/platform/$(PLATFORM)/include 87CPPINCS += -I$(ROOT)/usr/include/$(ARCHVERS) 88CPPINCS += -I$(PSMSYSHDRDIR) 89CPPINCS += -I$(STANDDIR) 90CPPINCS += -I$(STANDDIR)/lib 91CPPINCS += -I$(STANDDIR)/lib/sa 92CPPINCS += -I$(SRC)/common/net/dhcp 93CPPFLAGS = $(CPPDEFS) $(CPPINCS) 94CPPFLAGS += $(CCYFLAG)$(STANDDIR) 95ASFLAGS += $(CPPDEFS) -P -D_ASM $(CPPINCS) 96CFLAGS64 += ../../sparc/common/sparc.il 97 98# 99# Until we are building on a MACH=sparcv9 machine, we have to override 100# where to look for libraries. 101# 102PSMNAMELIBDIR = $(PSMSTANDDIR)/lib/names/$(TARG_MACH) 103PSMPROMLIBDIR = $(PSMSTANDDIR)/lib/promif/$(TARG_MACH) 104 105# 106# The following libraries are built in LIBNAME_DIR 107# 108LIBNAME_DIR += $(PSMNAMELIBDIR)/$(PLATFORM) 109LIBNAME_LIBS += libnames.a 110 111# 112# The following libraries are built in LIBPROM_DIR 113# 114LIBPROM_DIR += $(PSMPROMLIBDIR)/$(PROMVERS)/common 115LIBPROM_LIBS += libprom.a 116 117# 118# The following libraries are built in LIBSYS_DIR 119# 120LIBSYS_DIR += $(SYSLIBDIR) 121LIBSYS_LIBS += libufs.a libhsfs.a libnfs.a libxdr.a \ 122 libsock.a libinet.a libtcp.a libtcpstubs.a libscrypt.a \ 123 libwanboot.a libsa.a libmd5.a libnvpair.a 124 125# 126# Used to convert ELF to an a.out and ensure alignment 127# 128STRIPALIGN = stripalign 129 130# 131# Program used to post-process the ELF executables 132# 133ELFCONV = ./$(STRIPALIGN) # Default value 134 135.KEEP_STATE: 136 137.PARALLEL: $(OBJS) $(CONF_OBJS) $(MISC_OBJS) $(SRT0_OBJ) $(BOOT_OBJS) 138.PARALLEL: $(L_OBJS) $(CONF_L_OBJS) $(MISC_L_OBJS) $(SRT0_L_OBJ) \ 139 $(BOOT_L_OBJS) 140.PARALLEL: $(UFSBOOT) $(HSFSBOOT) $(NFSBOOT) $(WANBOOT) 141 142all: $(ELFCONV) $(UFSBOOT) $(HSFSBOOT) $(NFSBOOT) $(WANBOOT) 143 144$(STRIPALIGN): $(CMN_DIR)/$$(@).c 145 $(NATIVECC) -o $@ $(CMN_DIR)/$@.c 146 147# 4.2 ufs filesystem booter 148# 149# Libraries used to build ufsboot 150# 151LIBUFS_LIBS = libufs.a libnames.a libsa.a libprom.a $(LIBPLAT_LIBS) 152UFS_LIBS = $(LIBUFS_LIBS:lib%.a=-l%) 153UFS_DIRS = $(LIBNAME_DIR:%=-L%) $(LIBSYS_DIR:%=-L%) 154UFS_DIRS += $(LIBPLAT_DIR:%=-L%) $(LIBPROM_DIR:%=-L%) 155 156# 157# Note that the presumption is that someone has already done a `make 158# install' from usr/src/stand/lib, such that all of the standalone 159# libraries have been built and placed in $ROOT/stand/lib. 160# 161LIBDEPS= $(LIBPROM_DIR)/libprom.a $(LIBPLAT_DEP) \ 162 $(LIBNAME_DIR)/libnames.a 163 164L_LIBDEPS= $(LIBPROM_DIR)/llib-lprom.ln $(LIBPLAT_DEP_L) \ 165 $(LIBNAME_DIR)/llib-lnames.ln 166 167# 168# Loader flags used to build ufsboot 169# 170UFS_MAPFILE = $(MACH_DIR)/mapfile 171UFS_LDFLAGS = -dn -M $(UFS_MAPFILE) -e _start $(UFS_DIRS) 172UFS_L_LDFLAGS = $(UFS_DIRS) 173 174# 175# Object files used to build ufsboot 176# 177UFS_SRT0 = $(SRT0_OBJ) 178UFS_OBJS = $(OBJS) ufsconf.o boot.o 179UFS_L_OBJS = $(UFS_SRT0:%.o=%.ln) $(UFS_OBJS:%.o=%.ln) 180 181# 182# Build rules to build ufsboot 183# 184 185$(UFSBOOT).elf: $(UFS_MAPFILE) $(UFS_SRT0) $(UFS_OBJS) $(LIBDEPS) 186 $(LD) $(UFS_LDFLAGS) -o $@ $(UFS_SRT0) $(UFS_OBJS) $(UFS_LIBS) 187 $(MCS) -d $@ 188 $(POST_PROCESS) 189 $(POST_PROCESS) 190 $(MCS) -c $@ 191 192$(UFSBOOT): $(UFSBOOT).elf 193 $(RM) $@; cp $@.elf $@ 194 $(STRIP) $@ 195 196$(UFSBOOT)_lint: $(L_LIBDEPS) $(UFS_L_OBJS) 197 @echo "" 198 @echo ufsboot lint: global crosschecks: 199 $(LINT.c) $(UFS_L_LDFLAGS) $(UFS_L_OBJS) $(UFS_LIBS) 200 201# WANboot booter 202# 203# Libraries used to build wanboot 204# 205# EXPORT DELETE START 206LIBWANBOOT = libwanboot.a 207LIBSCRYPT = libscrypt.a 208LIBSSL = libssl.a 209LIBCRYPTO = libcrypto.a 210# EXPORT DELETE END 211 212LIBWAN_LIBS = \ 213 $(LIBWANBOOT) \ 214 libnvpair.a libufs.a libhsfs.a libnfs.a \ 215 libxdr.a libnames.a libsock.a libinet.a libtcp.a \ 216 $(LIBSCRYPT) $(LIBSSL) $(LIBCRYPTO) \ 217 libmd5.a libsa.a libprom.a \ 218 $(LIBSSL) \ 219 $(LIBPLAT_LIBS) 220WAN_LIBS = $(LIBWAN_LIBS:lib%.a=-l%) 221WAN_DIRS = $(LIBNAME_DIR:%=-L%) $(LIBSYS_DIR:%=-L%) 222WAN_DIRS += $(LIBPLAT_DIR:%=-L%) $(LIBPROM_DIR:%=-L%) 223 224# 225# Loader flags used to build wanboot 226# 227WAN_MAPFILE = $(MACH_DIR)/mapfile 228WAN_LDFLAGS = -dn -M $(WAN_MAPFILE) -e _start $(WAN_DIRS) 229WAN_L_LDFLAGS = $(WAN_DIRS) 230 231# 232# Object files used to build wanboot 233# 234WAN_SRT0 = $(SRT0_OBJ) 235WAN_OBJS = $(OBJS) wbfsconf.o wbcli.o wanboot.o ramdisk.o 236WAN_L_OBJS = $(WAN_SRT0:%.o=%.ln) $(WAN_OBJS:%.o=%.ln) 237 238# 239# Build rules to build wanboot 240# 241 242$(WANBOOT).elf: $(WAN_MAPFILE) $(WAN_SRT0) $(WAN_OBJS) $(LIBDEPS) 243 $(LD) $(WAN_LDFLAGS) -o $@ $(WAN_SRT0) $(WAN_OBJS) $(WAN_LIBS) 244 $(MCS) -d $@ 245 $(POST_PROCESS) 246 $(POST_PROCESS) 247 $(MCS) -c $@ 248 249$(WANBOOT): $(WANBOOT).elf 250 $(RM) $@; cp $@.elf $@ 251 $(STRIP) $@ 252 253$(WANBOOT)_lint: $(L_LIBDEPS) $(WAN_L_OBJS) 254 @echo "" 255 @echo wanboot lint: global crosschecks: 256 $(LINT.c) $(WAN_L_LDFLAGS) $(WAN_L_OBJS) $(WAN_LIBS) 257 258# High-sierra filesystem booter. Probably doesn't work. 259 260# 261# Libraries used to build hsfsboot 262# 263LIBHSFS_LIBS = libhsfs.a libnames.a libsa.a libprom.a $(LIBPLAT_LIBS) 264HSFS_LIBS = $(LIBHSFS_LIBS:lib%.a=-l%) 265HSFS_DIRS = $(LIBNAME_DIR:%=-L%) $(LIBSYS_DIR:%=-L%) 266HSFS_DIRS += $(LIBPLAT_DIR:%=-L%) $(LIBPROM_DIR:%=-L%) 267 268# 269# Loader flags used to build hsfsboot 270# 271HSFS_MAPFILE = $(MACH_DIR)/mapfile 272HSFS_LDFLAGS = -dn -M $(HSFS_MAPFILE) -e _start $(HSFS_DIRS) 273HSFS_L_LDFLAGS = $(HSFS_DIRS) 274 275# 276# Object files used to build hsfsboot 277# 278HSFS_SRT0 = $(SRT0_OBJ) 279HSFS_OBJS = $(OBJS) hsfsconf.o boot.o 280HSFS_L_OBJS = $(HSFS_SRT0:%.o=%.ln) $(HSFS_OBJS:%.o=%.ln) 281 282$(HSFSBOOT).elf: $(HSFS_MAPFILE) $(HSFS_SRT0) $(HSFS_OBJS) $(LIBDEPS) 283 $(LD) $(HSFS_LDFLAGS) -o $@ $(HSFS_SRT0) $(HSFS_OBJS) $(HSFS_LIBS) 284 $(MCS) -d $@ 285 $(POST_PROCESS) 286 $(POST_PROCESS) 287 $(MCS) -c $@ 288 289$(HSFSBOOT): $(HSFSBOOT).elf 290 $(RM) $(@); cp $@.elf $@ 291 $(STRIP) $@ 292 293$(HSFSBOOT)_lint: $(HSFS_L_OBJS) $(L_LIBDEPS) 294 @echo "" 295 @echo hsfsboot lint: global crosschecks: 296 $(LINT.c) $(HSFS_L_LDFLAGS) $(HSFS_L_OBJS) $(HSFS_LIBS) 297 298# NFS booter 299 300# 301# Libraries used to build nfsboot 302# 303LIBNFS_LIBS = libnfs.a libxdr.a libnames.a \ 304 libsock.a libinet.a libtcp.a libsa.a libprom.a \ 305 $(LIBPLAT_LIBS) 306NFS_LIBS = $(LIBNFS_LIBS:lib%.a=-l%) 307NFS_DIRS = $(LIBNAME_DIR:%=-L%) $(LIBSYS_DIR:%=-L%) 308NFS_DIRS += $(LIBPLAT_DIR:%=-L%) $(LIBPROM_DIR:%=-L%) 309 310# 311# Loader flags used to build inetboot 312# 313NFS_MAPFILE = $(MACH_DIR)/mapfile 314NFS_LDFLAGS = -dn -M $(NFS_MAPFILE) -e _start $(NFS_DIRS) 315NFS_L_LDFLAGS = $(NFS_DIRS) 316 317# 318# Object files used to build inetboot 319# 320NFS_SRT0 = $(SRT0_OBJ) 321NFS_OBJS = $(OBJS) nfsconf.o boot.o 322NFS_L_OBJS = $(NFS_SRT0:%.o=%.ln) $(NFS_OBJS:%.o=%.ln) 323 324$(NFSBOOT).elf: $(ELFCONV) $(NFS_MAPFILE) $(NFS_SRT0) $(NFS_OBJS) $(LIBDEPS) 325 $(LD) $(NFS_LDFLAGS) -o $@ $(NFS_SRT0) $(NFS_OBJS) $(NFS_LIBS) 326 $(MCS) -d $@ 327 $(POST_PROCESS) 328 $(POST_PROCESS) 329 $(MCS) -c $@ 330 331# 332# This is a bit strange because some platforms boot elf and some don't. 333# So this rule strips the file no matter which ELFCONV is used. 334# 335$(NFSBOOT): $(NFSBOOT).elf 336 $(RM) $@.tmp; cp $@.elf $@.tmp; $(STRIP) $@.tmp 337 $(RM) $@; $(ELFCONV) $@.tmp $@; $(RM) $@.tmp 338 339$(NFSBOOT)_lint: $(NFS_L_OBJS) $(L_LIBDEPS) 340 @echo "" 341 @echo inetboot lint: global crosschecks: 342 $(LINT.c) $(NFS_L_LDFLAGS) $(NFS_L_OBJS) $(NFS_LIBS) 343 344include $(BOOTSRCDIR)/Makefile.rules 345 346install: $(ROOT_PSM_WANBOOT) 347 348clean: 349 $(RM) make.out lint.out 350 $(RM) $(OBJS) $(CONF_OBJS) $(MISC_OBJS) $(BOOT_OBJS) $(SRT0_OBJ) 351 $(RM) $(NFSBOOT).elf $(UFSBOOT).elf $(HSFSBOOT).elf $(WANBOOT).elf 352 $(RM) $(L_OBJS) $(CONF_L_OBJS) $(MISC_L_OBJS) $(BOOT_L_OBJS) \ 353 $(SRT0_L_OBJ) 354 355clobber: clean 356 $(RM) $(UFSBOOT) $(HSFSBOOT) $(NFSBOOT) $(WANBOOT) $(STRIPALIGN) 357 358lint: $(UFSBOOT)_lint $(NFSBOOT)_lint $(WANBOOT)_lint 359 360include $(BOOTSRCDIR)/Makefile.targ 361