From e10b60640771850d11d09090c889637fa1328fc2 Mon Sep 17 00:00:00 2001
From: Keith Thorne <keith.thorne@ligo.org>
Date: Tue, 10 Dec 2019 15:00:37 -0600
Subject: [PATCH] Restore cpu_up as EXPORT_SYMBOL_GPL fix2 Closes #15 Remove
 kernel patch changing cpu_up to EXPORT_SYMBOL Update README in
 patches/linux-4.19-cs for change Remove symbols from patched kernel in
 src/drv/ExtraSymbols.symvers Add parameter in GNUmakefile to build will
 reference Module.symvers from kernel

---
 patches/linux-4.19-cs/README              |  2 +-
 patches/linux-4.19-cs/linux-4.19-cs.patch | 18 +++---------------
 src/drv/ExtraSymbols.symvers              |  4 ----
 src/epics/util/GNUmakefile                |  2 +-
 4 files changed, 5 insertions(+), 21 deletions(-)

diff --git a/patches/linux-4.19-cs/README b/patches/linux-4.19-cs/README
index 819eb4283..49d1cdb3a 100644
--- a/patches/linux-4.19-cs/README
+++ b/patches/linux-4.19-cs/README
@@ -4,7 +4,7 @@ linux kernel 4.19 for CDS real-time.  Both the patch and config file are needed
 
 - For LIGO CDS, use the final -cs files (not -aei-cs)   
 
-- Basic CDS patch - adds CPU Shutdown, cpu_up EXPORT_SYMBOL
+- Basic CDS patch - adds CPU Shutdown only
 kernel-4.19-cs.patch
 
 - Custom kernel config file for Gentoo at AEI - creates monolithic kernel with a minimum of drivers
diff --git a/patches/linux-4.19-cs/linux-4.19-cs.patch b/patches/linux-4.19-cs/linux-4.19-cs.patch
index 206005b80..5bb1c8eef 100644
--- a/patches/linux-4.19-cs/linux-4.19-cs.patch
+++ b/patches/linux-4.19-cs/linux-4.19-cs.patch
@@ -1,6 +1,6 @@
-diff -r -u -d linux-source-4.19.orig/arch/x86/kernel/smpboot.c linux-source-4.19.cs/arch/x86/kernel/smpboot.c
---- linux-source-4.19.orig/arch/x86/kernel/smpboot.c	2019-04-27 02:36:41.000000000 -0500
-+++ linux-source-4.19.cs/arch/x86/kernel/smpboot.c	2019-09-04 10:44:14.997185804 -0500
+diff -Naur linux-source-4.19.orig/arch/x86/kernel/smpboot.c linux-source-4.19.cs/arch/x86/kernel/smpboot.c
+--- linux-source-4.19.orig/arch/x86/kernel/smpboot.c	2019-08-16 03:12:54.000000000 -0500
++++ linux-source-4.19.cs/arch/x86/kernel/smpboot.c	2019-12-02 15:39:56.407306004 -0600
 @@ -1559,6 +1559,18 @@
  	common_cpu_die(cpu);
  }
@@ -31,15 +31,3 @@ diff -r -u -d linux-source-4.19.orig/arch/x86/kernel/smpboot.c linux-source-4.19
  }
  
  static bool wakeup_cpu0(void)
-diff -r -u -d linux-source-4.19.orig/kernel/cpu.c linux-source-4.19.cs/kernel/cpu.c
---- linux-source-4.19.orig/kernel/cpu.c	2019-08-07 21:02:38.000000000 -0500
-+++ linux-source-4.19.cs/kernel/cpu.c	2019-09-04 10:44:14.997185804 -0500
-@@ -1160,7 +1160,7 @@
- {
- 	return do_cpu_up(cpu, CPUHP_ONLINE);
- }
--EXPORT_SYMBOL_GPL(cpu_up);
-+EXPORT_SYMBOL(cpu_up);
- 
- #ifdef CONFIG_PM_SLEEP_SMP
- static cpumask_var_t frozen_cpus;
diff --git a/src/drv/ExtraSymbols.symvers b/src/drv/ExtraSymbols.symvers
index d824cdc9d..ef4f8d37e 100644
--- a/src/drv/ExtraSymbols.symvers
+++ b/src/drv/ExtraSymbols.symvers
@@ -16,9 +16,5 @@
 0x00000000	sci_unexport_segment	/	EXPORT_SYMBOL
 0x00000000	sci_disconnect_segment	/	EXPORT_SYMBOL
 0x00000000	sci_unmap_segment	/	EXPORT_SYMBOL
-0x00000000	cpu_up	/	EXPORT_SYMBOL
-0x00000000	printkl	/	EXPORT_SYMBOL
-0x00000000	set_fe_code_idle	/	EXPORT_SYMBOL
-0x00000000	is_cpu_taken_by_rcg_model	/	EXPORT_SYMBOL
 0x00000000	vprintkl	/	EXPORT_SYMBOL
 0x00000000	ligo_get_gps_driver_offset	/	EXPORT_SYMBOL
diff --git a/src/epics/util/GNUmakefile b/src/epics/util/GNUmakefile
index 84a95a56e..5fa9fda15 100644
--- a/src/epics/util/GNUmakefile
+++ b/src/epics/util/GNUmakefile
@@ -4,7 +4,7 @@ PWD := $(shell pwd)
 KDIR := /lib/modules/$(shell uname -r)/build
 #include "Makefile"
 default:
-	$(MAKE) -C $(KDIR) SUBDIRS=$(shell pwd) modules
+	$(MAKE) -C $(KDIR) SUBDIRS=$(shell pwd) M=$(PWD) modules
 clean:
 	rm -f *.o *.ko Module.symvers *.mod.c .*.cmd $(MODULENAME)_test
 
-- 
GitLab