mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-30 02:37:28 +02:00
lkm: tweak Kbuild to work on 4.x (hardcoded fallback stack size); add linuxkm/get_thread_size.c.
This commit is contained in:
@ -20,11 +20,16 @@ ifeq "$(WOLFSSL_CFLAGS)" ""
|
||||
$(error $$WOLFSSL_CFLAGS is unset.)
|
||||
endif
|
||||
|
||||
# this mechanism only works in kernel 5.x+ (fallback to hardcoded value)
|
||||
hostprogs := linuxkm/get_thread_size
|
||||
always-y := $(hostprogs)
|
||||
HOST_EXTRACFLAGS += $(NOSTDINC_FLAGS) $(LINUXINCLUDE) $(KBUILD_CFLAGS) -static
|
||||
|
||||
# this rule is needed to get build to succeed in 4.x (get_thread_size still doesn't get built)
|
||||
$(obj)/linuxkm/get_thread_size: $(src)/linuxkm/get_thread_size.c
|
||||
|
||||
$(patsubst %, $(obj)/%, $(WOLFSSL_OBJ_FILES)): $(obj)/linuxkm/get_thread_size
|
||||
KERNEL_THREAD_STACK_SIZE=$(shell $(obj)/linuxkm/get_thread_size)
|
||||
KERNEL_THREAD_STACK_SIZE=$(shell test -x $(obj)/linuxkm/get_thread_size && $(obj)/linuxkm/get_thread_size || echo 16384)
|
||||
MAX_STACK_FRAME_SIZE=$(shell echo $$(( $(KERNEL_THREAD_STACK_SIZE) / 4)))
|
||||
|
||||
libwolfssl-y := $(WOLFSSL_OBJ_FILES)
|
||||
|
13
linuxkm/get_thread_size.c
Normal file
13
linuxkm/get_thread_size.c
Normal file
@ -0,0 +1,13 @@
|
||||
#ifndef __KERNEL__
|
||||
#define __KERNEL__
|
||||
#endif
|
||||
#include <linux/kconfig.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/kthread.h>
|
||||
|
||||
extern int dprintf(int fd, const char *format, ...);
|
||||
|
||||
int main(__maybe_unused int argc, __maybe_unused char **argv) {
|
||||
dprintf(1, "%lu\n",THREAD_SIZE);
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user