[Add] osal 模块加入编译

This commit is contained in:
gaoyang3513
2024-11-16 16:09:10 +08:00
parent 9f441d3fb6
commit ebd1227d82
3 changed files with 90 additions and 2 deletions

View File

@ -0,0 +1,87 @@
#*******************************************************************************
# HangZhou Hikvision Digital Technology Co., Ltd. All Right Reserved.
# Author :
# Version : V1.0.0 2020.10.21
# Description :
# Note : yegaoyang@hikvision.com.cn Modified 2020.10.21
#*******************************************************************************
#*******************************************************************************
# Path information
#*******************************************************************************
LOCAL_DIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST))))
KERNEL_DIR ?= /home/gaoyang3513/Source/06-SG20x/02-Projects/SDK_SG200x_V2/linux_5.10/build/sg2000_milkv_duos_glibc_arm64_sd
#KERNEL_DIR ?= $(HOME)/Source/06-SG20x/02-Projects/SDK_SG200x_V2/linux_5.10/build/sg2000_milkv_duos_glibc_arm64_sd/
# ParDirectory
LIBS_DIR :=
INCLUDE_DIR :=
# Subdirectory
# Output
OUTPUT_DIR := $(LOCAL_DIR)/output
INSTALL_DIR ?= $(LOCAL_DIR)/__install
#*******************************************************************************
# Variables
#*******************************************************************************
MULTI_CORES ?= $(shell grep -c ^processor /proc/cpuinfo)
MOD_NAME := osal
#*******************************************************************************
# Compile configure
#*******************************************************************************
ARCH ?= arm64
CROSS_COMPILE ?= ${HOME}/Source/06-SG20x/02-Projects/SDK_SG200x_V2/host-tools/gcc/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-
CC := $(CROSS_COMPILE)gcc
LD := $(CROSS_COMPILE)ld
AR := $(CROSS_COMPILE)ar
STRIP := $(CROSS_COMPILE)strip
OBJDUMP := $(CROSS_COMPILE)objdump
export ARCH CROSS_COMPILE
#*******************************************************************************
# Targets
#*******************************************************************************
.PHONY: all install clean
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
@$(OBJDUMP) -hdS $(MOD_NAME).o > $(MOD_NAME).dmp
clean:
# File
@for n in *.o *.ko *.mod.c *.mod *.cmd *.symvers *.order; do \
find $(LOCAL_DIR) -type f -name $$n -exec rm {} \;;\
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;
@if [ -d $(LOCAL_DIR)/.tmp_versions ]; then rm -rf $(LOCAL_DIR)/.tmp_versions; fi;
install:
@mkdir -p $(INSTALL_DIR)/lib/modules/private
@install -m 644 -D $(MOD_NAME).ko $(INSTALL_DIR)/lib/modules/private;
init:
@mkdir -p $(OUTPUT_DIR)
else
obj-m := $(MOD_NAME).o
$(MOD_NAME)-objs := OSAL_osdev.o
INC_DIRS :=
ccflags-y +=
EXTRA_CFLAGS += -Wno-error=date-time # Fix compile error on gcc 4.9 and later
EXTRA_CFLAGS += -Wno-date-time -g
endif # ifeq ($(KERNELRELEASE),)

View File

@ -10,6 +10,7 @@
#include <linux/device.h>
#include <linux/slab.h>
#include <linux/kernel.h>
#include <linux/kdev_t.h> // MKDEV
#include "OSAL_osdev.h"

View File

@ -30,8 +30,8 @@ export KERNEL_DIR
MULTI_CORES ?= $(shell grep -c ^processor /proc/cpuinfo)
SUB_DIRS := \
spi \
01-Debug
04-Debug \
03-Bus/01-Platform/01-osdev \
#*******************************************************************************
# Compile configure