[Add] 支持模块编译 Duo S环境
This commit is contained in:
75
Makefile
Normal file
75
Makefile
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
#*******************************************************************************
|
||||||
|
# HangZhou Hikvision Digital Technology Co., Ltd. All Right Reserved.
|
||||||
|
# Author :
|
||||||
|
# Version : V1.0.0 202x.01.01
|
||||||
|
# Description :
|
||||||
|
# Note : gaoyang@.com.cn Modified 2020.10.21
|
||||||
|
#*******************************************************************************
|
||||||
|
|
||||||
|
#*******************************************************************************
|
||||||
|
# Path information
|
||||||
|
#*******************************************************************************
|
||||||
|
LOCAL_DIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST))))
|
||||||
|
KERNEL_DIR ?= $(realpath $(LOCAL_DIR)/../../../linux_5.10)
|
||||||
|
|
||||||
|
# Subdirectory
|
||||||
|
|
||||||
|
OUTPUT_DIR := $(LOCAL_DIR)/output
|
||||||
|
INSTALL_DIR ?= $(LOCAL_DIR)/__install
|
||||||
|
#$(info Output directoty : $(OUTPUT_DIR))
|
||||||
|
#$(info Install directoty: $(INSTALL_DIR))
|
||||||
|
|
||||||
|
#*******************************************************************************
|
||||||
|
# Variables
|
||||||
|
#*******************************************************************************
|
||||||
|
MULTI_CORES ?= $(shell grep -c ^processor /proc/cpuinfo)
|
||||||
|
|
||||||
|
SUB_DIRS := spi/
|
||||||
|
|
||||||
|
#*******************************************************************************
|
||||||
|
# Compile configure
|
||||||
|
#*******************************************************************************
|
||||||
|
ARCH ?= riscv
|
||||||
|
CROSS_COMPILE ?= riscv64-unknown-linux-musl-
|
||||||
|
|
||||||
|
CC := $(CROSS_COMPILE)gcc
|
||||||
|
LD := $(CROSS_COMPILE)ld
|
||||||
|
AR := $(CROSS_COMPILE)ar
|
||||||
|
STRIP := $(CROSS_COMPILE)strip
|
||||||
|
|
||||||
|
export ARCH CROSS_COMPILE
|
||||||
|
#*******************************************************************************
|
||||||
|
# Targets
|
||||||
|
#*******************************************************************************
|
||||||
|
.PHONY: init all clean distclean install menuconfig
|
||||||
|
|
||||||
|
ifeq ($(KERNELRELEASE),)
|
||||||
|
all: init
|
||||||
|
@for sub in $(SUB_DIRS); do \
|
||||||
|
$(MAKE) -C $$sub; \
|
||||||
|
$(MAKE) install INSTALL_DIR=$(OUTPUT_DIR) -C $$sub || exit "$$?"; \
|
||||||
|
done;
|
||||||
|
|
||||||
|
clean:
|
||||||
|
@for sub in $(SUB_DIRS); do \
|
||||||
|
$(MAKE) clean -C $$sub || exit "$$?"; \
|
||||||
|
done;
|
||||||
|
# Directory
|
||||||
|
@if [ -d $(LOCAL_DIR)/output ]; then rm -rf $(LOCAL_DIR)/output; fi;
|
||||||
|
@if [ -d $(LOCAL_DIR)/__install ]; then rm -rf $(LOCAL_DIR)/__install; fi;
|
||||||
|
|
||||||
|
install:
|
||||||
|
@mkdir -p $(INSTALL_DIR)
|
||||||
|
@cp -arf $(OUTPUT_DIR)/. $(INSTALL_DIR)
|
||||||
|
|
||||||
|
init:
|
||||||
|
@mkdir -p $(OUTPUT_DIR);
|
||||||
|
|
||||||
|
else
|
||||||
|
# called from kernel build system: just declare what our modules are
|
||||||
|
obj-y += $(SUB_DIRS)
|
||||||
|
|
||||||
|
#INC_DIRS := $(INCLUDE_DIR)/generated
|
||||||
|
#subdir-ccflags-y += $(addprefix -I, $(INC_DIRS))
|
||||||
|
|
||||||
|
endif # ifeq ($(KERNELRELEASE),)
|
||||||
69
spi/Makefile
Normal file
69
spi/Makefile
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
#*******************************************************************************
|
||||||
|
# HangZhou Hikvision Digital Technology Co., Ltd. All Right Reserved.
|
||||||
|
# Author :
|
||||||
|
# Version : V1.0.0 202x.01.01
|
||||||
|
# Description :
|
||||||
|
# Note : gaoyang3513@163.com Modified 2020.10.21
|
||||||
|
#*******************************************************************************
|
||||||
|
|
||||||
|
#*******************************************************************************
|
||||||
|
# Path information
|
||||||
|
#*******************************************************************************
|
||||||
|
LOCAL_DIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST))))
|
||||||
|
KERNEL_DIR ?= $(realpath $(LOCAL_DIR)/../../../../linux_5.10)
|
||||||
|
|
||||||
|
# Subdirectory
|
||||||
|
|
||||||
|
OUTPUT_DIR := $(LOCAL_DIR)/output
|
||||||
|
INSTALL_DIR ?= $(LOCAL_DIR)/__install
|
||||||
|
#$(info Output directoty : $(OUTPUT_DIR))
|
||||||
|
#$(info Install directoty: $(INSTALL_DIR))
|
||||||
|
|
||||||
|
#*******************************************************************************
|
||||||
|
# Variables
|
||||||
|
#*******************************************************************************
|
||||||
|
MULTI_CORES ?= $(shell grep -c ^processor /proc/cpuinfo)
|
||||||
|
|
||||||
|
# Compile configure
|
||||||
|
#*******************************************************************************
|
||||||
|
ARCH ?= riscv
|
||||||
|
CROSS_COMPILE ?= riscv64-unknown-linux-musl-
|
||||||
|
|
||||||
|
CC := $(CROSS_COMPILE)gcc
|
||||||
|
LD := $(CROSS_COMPILE)ld
|
||||||
|
AR := $(CROSS_COMPILE)ar
|
||||||
|
STRIP := $(CROSS_COMPILE)strip
|
||||||
|
|
||||||
|
export ARCH CROSS_COMPILE
|
||||||
|
#*******************************************************************************
|
||||||
|
# Targets
|
||||||
|
#*******************************************************************************
|
||||||
|
.PHONY: init all clean distclean install menuconfig
|
||||||
|
|
||||||
|
ifeq ($(KERNELRELEASE),)
|
||||||
|
all: init
|
||||||
|
@$(MAKE) modules -C $(KERNEL_DIR) M=$(LOCAL_DIR) -j$(MULTI_CORES)
|
||||||
|
@$(MAKE) modules_install -C $(KERNEL_DIR) M=$(LOCAL_DIR) INSTALL_MOD_PATH=$(KERNEL_DIR)/_install_modules INSTALL_MOD_DIR=private
|
||||||
|
|
||||||
|
clean:
|
||||||
|
# Directory
|
||||||
|
@if [ -d $(LOCAL_DIR)/output ]; then rm -rf $(LOCAL_DIR)/output; fi;
|
||||||
|
@if [ -d $(LOCAL_DIR)/__install ]; then rm -rf $(LOCAL_DIR)/__install; fi;
|
||||||
|
@if [ -d $(LOCAL_DIR)/.tmp_versions ]; then rm -rf $(LOCAL_DIR)/.tmp_versions; fi;
|
||||||
|
# File
|
||||||
|
@for f in {Module.symvers,modules.order}; do \
|
||||||
|
if [ -e $$f ]; then rm -rf $$f; fi; \
|
||||||
|
done
|
||||||
|
|
||||||
|
install:
|
||||||
|
@mkdir -p $(INSTALL_DIR)
|
||||||
|
@cp -arf $(OUTPUT_DIR)/. $(INSTALL_DIR)
|
||||||
|
|
||||||
|
init:
|
||||||
|
@mkdir -p $(OUTPUT_DIR);
|
||||||
|
|
||||||
|
else
|
||||||
|
# called from kernel build system: just declare what our modules are
|
||||||
|
obj-m += pn5180.o
|
||||||
|
|
||||||
|
endif # ifeq ($(KERNELRELEASE),)
|
||||||
Reference in New Issue
Block a user