blob: 452182853564d711f38fa8bebc439ceff30b95c5 [file] [log] [blame]
#
# Copyright (c) 2014 Nest Labs, Inc.
# All rights reserved.
#
# This document is the property of Nest. It is considered
# confidential and proprietary information.
#
# This document may not be reproduced or transmitted in any form,
# in whole or in part, without the express written permission of
# Nest.
#
# Description:
# This is the makefile for building the in-tree gadget driver as an
# out-of-tree driver with the CONFIG_FSL_UTP define set. This
# define is required for the Windows DFU tool to initiate shell
# commands via the MSC gadget driver, but causes the driver's MSC
# functionality to break and presents a security vulnerability if
# used in production builds.
#
include pre.mak
CP = cp -R
BuildDir := $(call GenerateBuildPaths,src)
LinuxDir := sw/tps/linux
LinuxSourceDir := $(BuildRoot)/$(LinuxDir)/$(LinuxPackageName)
LinuxBuildDir := $(BuildRoot)/$(LinuxDir)/$(subst $(FirstMakefile),Makefile,$(BuildDirectory))
GadgetDriverSourceDir := drivers/usb/gadget
GadgetDriverConfig := CONFIG_FSL_UTP
all: $(PackageDefaultGoal)
# Make a build directory and copy the gadget driver source into it so that we can build
# it as an out-of-tree driver
$(BuildDir):
$(create-directory)
$(Verbose)$(CP) $(LinuxSourceDir)/$(GadgetDriverSourceDir)/* $(BuildDir)
# Kick off a driver build against the latest kernel build and install it to the results folder
stage: $(LinuxBuildDir) | $(BuildDir) $(ResultDirectory)
$(Verbose)KCPPFLAGS="-D$(GadgetDriverConfig)=y" \
$(MAKE) -C $(LinuxBuildDir) \
ARCH=$(LinuxProductArch) \
CROSS_COMPILE=$(ToolBinDir)/$(CROSS_COMPILE) \
M=$(CURDIR)/$(BuildDir) \
"INSTALL_MOD_DIR=kernel/$(GadgetDriverSourceDir)" \
"INSTALL_MOD_PATH=$(ResultDirectory)" \
DEPMOD=$(DEPMOD) \
modules modules_install
clean:
$(Verbose)$(RM) $(RMFLAGS) -r $(BuildDir)
$(Verbose)$(RM) $(RMFLAGS) -r $(ResultDirectory)
include post.mak