diff options
-rw-r--r-- | mk/linux-ver.mk | 8 | ||||
-rw-r--r-- | target/linux/Config.in.kernelversion | 4 | ||||
-rw-r--r-- | target/linux/patches/5.10.30/mipsr6.patch | 113 | ||||
-rw-r--r-- | target/linux/patches/5.10.66/arc.patch (renamed from target/linux/patches/5.10.30/arc.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/5.10.66/darwin-dtc.patch (renamed from target/linux/patches/5.10.30/darwin-dtc.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/5.10.66/darwin-file2alias.patch (renamed from target/linux/patches/5.10.30/darwin-file2alias.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/5.10.66/dtc-noyaml.patch (renamed from target/linux/patches/5.10.30/dtc-noyaml.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/5.10.66/or1k-more-ram.patch (renamed from target/linux/patches/5.10.30/or1k-more-ram.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/5.10.66/relocs.patch (renamed from target/linux/patches/5.10.30/relocs.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/5.10.66/startup.patch (renamed from target/linux/patches/5.10.30/startup.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/5.4.147/arc.patch (renamed from target/linux/patches/5.4.99/arc.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/5.4.147/darwin-dtc.patch (renamed from target/linux/patches/5.4.99/darwin-dtc.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/5.4.147/darwin-file2alias.patch (renamed from target/linux/patches/5.4.99/darwin-file2alias.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/5.4.147/dtc-noyaml.patch (renamed from target/linux/patches/5.4.99/dtc-noyaml.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/5.4.147/or1k-more-ram.patch (renamed from target/linux/patches/5.4.99/or1k-more-ram.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/5.4.147/relocs.patch (renamed from target/linux/patches/5.4.99/relocs.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/5.4.147/sh4.patch (renamed from target/linux/patches/5.4.99/sh4.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/5.4.147/startup.patch | 34 | ||||
-rw-r--r-- | target/linux/patches/5.4.99/arm-thumb2.patch | 11 | ||||
-rw-r--r-- | target/linux/patches/5.4.99/mipsr6.patch | 113 | ||||
-rw-r--r-- | target/linux/patches/5.4.99/startup.patch | 1265 |
21 files changed, 40 insertions, 1508 deletions
diff --git a/mk/linux-ver.mk b/mk/linux-ver.mk index a16533af0..bf5a76f98 100644 --- a/mk/linux-ver.mk +++ b/mk/linux-ver.mk @@ -16,16 +16,16 @@ KERNEL_RELEASE:= 1 KERNEL_VERSION:= $(ADK_TARGET_LINUX_KERNEL_GIT_VER)-$(KERNEL_RELEASE) endif ifeq ($(ADK_TARGET_LINUX_KERNEL_VERSION_5_10),y) -KERNEL_FILE_VER:= 5.10.30 +KERNEL_FILE_VER:= 5.10.66 KERNEL_RELEASE:= 1 KERNEL_VERSION:= $(KERNEL_FILE_VER)-$(KERNEL_RELEASE) -KERNEL_HASH:= d40269b5ac5c8424ec808f4484c7f80947f8f2d549b1ef1a5149aec5b6a20640 +KERNEL_HASH:= 5dfa06bbbbd164b9ea669ec637b1e6d05fb5fea8ef3aeb6729f2cbcd0dfcc8a7 endif ifeq ($(ADK_TARGET_LINUX_KERNEL_VERSION_5_4),y) -KERNEL_FILE_VER:= 5.4.99 +KERNEL_FILE_VER:= 5.4.147 KERNEL_RELEASE:= 1 KERNEL_VERSION:= $(KERNEL_FILE_VER)-$(KERNEL_RELEASE) -KERNEL_HASH:= 5bdad12c69253d30d836dd51e0b2a9a04a6749cc6b4b2412561a1efcb1351a27 +KERNEL_HASH:= f6c004359241877e24606a1e9ef832b54a7646d46de4d89c1b4713d7a915441c endif ifeq ($(ADK_TARGET_LINUX_KERNEL_VERSION_4_19),y) KERNEL_FILE_VER:= 4.19.176 diff --git a/target/linux/Config.in.kernelversion b/target/linux/Config.in.kernelversion index 992666748..e071019e9 100644 --- a/target/linux/Config.in.kernelversion +++ b/target/linux/Config.in.kernelversion @@ -38,7 +38,7 @@ config ADK_TARGET_LINUX_KERNEL_VERSION_GIT select ADK_TARGET_LINUX_KERNEL_IMAGE if ADK_TARGET_SYSTEM_BEAGLEBONE_BLACK config ADK_TARGET_LINUX_KERNEL_VERSION_5_10 - bool "5.10.30" + bool "5.10.66" depends on !ADK_TARGET_ARCH_AVR32 depends on !ADK_TARGET_ARCH_BFIN depends on !ADK_TARGET_ARCH_CRIS @@ -48,7 +48,7 @@ config ADK_TARGET_LINUX_KERNEL_VERSION_5_10 depends on !ADK_TARGET_CPU_ARM_CORTEX_A53 config ADK_TARGET_LINUX_KERNEL_VERSION_5_4 - bool "5.4.99" + bool "5.4.147" depends on !ADK_TARGET_ARCH_AVR32 depends on !ADK_TARGET_ARCH_BFIN depends on !ADK_TARGET_ARCH_CRIS diff --git a/target/linux/patches/5.10.30/mipsr6.patch b/target/linux/patches/5.10.30/mipsr6.patch deleted file mode 100644 index b8574797e..000000000 --- a/target/linux/patches/5.10.30/mipsr6.patch +++ /dev/null @@ -1,113 +0,0 @@ -diff -Nur linux-5.10.17.orig/arch/mips/include/asm/vdso/gettimeofday.h linux-5.10.17/arch/mips/include/asm/vdso/gettimeofday.h ---- linux-5.10.17.orig/arch/mips/include/asm/vdso/gettimeofday.h 2021-02-17 11:02:30.000000000 +0100 -+++ linux-5.10.17/arch/mips/include/asm/vdso/gettimeofday.h 2021-04-09 15:24:43.613709753 +0200 -@@ -30,12 +30,21 @@ - register long nr asm("v0") = __NR_gettimeofday; - register long error asm("a3"); - -+#if MIPS_ISA_REV >= 6 -+ asm volatile( -+ " syscall\n" -+ : "=r" (ret), "=r" (error) -+ : "r" (tv), "r" (tz), "r" (nr) -+ : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", -+ "$14", "$15", "$24", "$25", "memory"); -+#else - asm volatile( - " syscall\n" - : "=r" (ret), "=r" (error) - : "r" (tv), "r" (tz), "r" (nr) - : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", - "$14", "$15", "$24", "$25", "hi", "lo", "memory"); -+#endif - - return error ? -ret : ret; - } -@@ -54,12 +63,21 @@ - #endif - register long error asm("a3"); - -+#if MIPS_ISA_REV >= 6 -+ asm volatile( -+ " syscall\n" -+ : "=r" (ret), "=r" (error) -+ : "r" (clkid), "r" (ts), "r" (nr) -+ : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", -+ "$14", "$15", "$24", "$25", "memory"); -+#else - asm volatile( - " syscall\n" - : "=r" (ret), "=r" (error) - : "r" (clkid), "r" (ts), "r" (nr) - : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", - "$14", "$15", "$24", "$25", "hi", "lo", "memory"); -+#endif - - return error ? -ret : ret; - } -@@ -78,12 +96,21 @@ - #endif - register long error asm("a3"); - -+#if MIPS_ISA_REV >= 6 -+ asm volatile( -+ " syscall\n" -+ : "=r" (ret), "=r" (error) -+ : "r" (clkid), "r" (ts), "r" (nr) -+ : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", -+ "$14", "$15", "$24", "$25", "memory"); -+#else - asm volatile( - " syscall\n" - : "=r" (ret), "=r" (error) - : "r" (clkid), "r" (ts), "r" (nr) - : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", - "$14", "$15", "$24", "$25", "hi", "lo", "memory"); -+#endif - - return error ? -ret : ret; - } -@@ -100,12 +127,21 @@ - register long nr asm("v0") = __NR_clock_gettime; - register long error asm("a3"); - -+#if MIPS_ISA_REV >= 6 -+ asm volatile( -+ " syscall\n" -+ : "=r" (ret), "=r" (error) -+ : "r" (clkid), "r" (ts), "r" (nr) -+ : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", -+ "$14", "$15", "$24", "$25", "memory"); -+#else - asm volatile( - " syscall\n" - : "=r" (ret), "=r" (error) - : "r" (clkid), "r" (ts), "r" (nr) - : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", - "$14", "$15", "$24", "$25", "hi", "lo", "memory"); -+#endif - - return error ? -ret : ret; - } -@@ -120,12 +156,21 @@ - register long nr asm("v0") = __NR_clock_getres; - register long error asm("a3"); - -+#if MIPS_ISA_REV >= 6 -+ asm volatile( -+ " syscall\n" -+ : "=r" (ret), "=r" (error) -+ : "r" (clkid), "r" (ts), "r" (nr) -+ : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", -+ "$14", "$15", "$24", "$25", "memory"); -+#else - asm volatile( - " syscall\n" - : "=r" (ret), "=r" (error) - : "r" (clkid), "r" (ts), "r" (nr) - : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", - "$14", "$15", "$24", "$25", "hi", "lo", "memory"); -+#endif - - return error ? -ret : ret; - } diff --git a/target/linux/patches/5.10.30/arc.patch b/target/linux/patches/5.10.66/arc.patch index 20810ce64..20810ce64 100644 --- a/target/linux/patches/5.10.30/arc.patch +++ b/target/linux/patches/5.10.66/arc.patch diff --git a/target/linux/patches/5.10.30/darwin-dtc.patch b/target/linux/patches/5.10.66/darwin-dtc.patch index 0cdc23ab4..0cdc23ab4 100644 --- a/target/linux/patches/5.10.30/darwin-dtc.patch +++ b/target/linux/patches/5.10.66/darwin-dtc.patch diff --git a/target/linux/patches/5.10.30/darwin-file2alias.patch b/target/linux/patches/5.10.66/darwin-file2alias.patch index fdbc598a8..fdbc598a8 100644 --- a/target/linux/patches/5.10.30/darwin-file2alias.patch +++ b/target/linux/patches/5.10.66/darwin-file2alias.patch diff --git a/target/linux/patches/5.10.30/dtc-noyaml.patch b/target/linux/patches/5.10.66/dtc-noyaml.patch index 759bb01f7..759bb01f7 100644 --- a/target/linux/patches/5.10.30/dtc-noyaml.patch +++ b/target/linux/patches/5.10.66/dtc-noyaml.patch diff --git a/target/linux/patches/5.10.30/or1k-more-ram.patch b/target/linux/patches/5.10.66/or1k-more-ram.patch index de848c838..de848c838 100644 --- a/target/linux/patches/5.10.30/or1k-more-ram.patch +++ b/target/linux/patches/5.10.66/or1k-more-ram.patch diff --git a/target/linux/patches/5.10.30/relocs.patch b/target/linux/patches/5.10.66/relocs.patch index 5bcd974c7..5bcd974c7 100644 --- a/target/linux/patches/5.10.30/relocs.patch +++ b/target/linux/patches/5.10.66/relocs.patch diff --git a/target/linux/patches/5.10.30/startup.patch b/target/linux/patches/5.10.66/startup.patch index 26583ff21..26583ff21 100644 --- a/target/linux/patches/5.10.30/startup.patch +++ b/target/linux/patches/5.10.66/startup.patch diff --git a/target/linux/patches/5.4.99/arc.patch b/target/linux/patches/5.4.147/arc.patch index 20810ce64..20810ce64 100644 --- a/target/linux/patches/5.4.99/arc.patch +++ b/target/linux/patches/5.4.147/arc.patch diff --git a/target/linux/patches/5.4.99/darwin-dtc.patch b/target/linux/patches/5.4.147/darwin-dtc.patch index 0cdc23ab4..0cdc23ab4 100644 --- a/target/linux/patches/5.4.99/darwin-dtc.patch +++ b/target/linux/patches/5.4.147/darwin-dtc.patch diff --git a/target/linux/patches/5.4.99/darwin-file2alias.patch b/target/linux/patches/5.4.147/darwin-file2alias.patch index fdbc598a8..fdbc598a8 100644 --- a/target/linux/patches/5.4.99/darwin-file2alias.patch +++ b/target/linux/patches/5.4.147/darwin-file2alias.patch diff --git a/target/linux/patches/5.4.99/dtc-noyaml.patch b/target/linux/patches/5.4.147/dtc-noyaml.patch index 759bb01f7..759bb01f7 100644 --- a/target/linux/patches/5.4.99/dtc-noyaml.patch +++ b/target/linux/patches/5.4.147/dtc-noyaml.patch diff --git a/target/linux/patches/5.4.99/or1k-more-ram.patch b/target/linux/patches/5.4.147/or1k-more-ram.patch index de848c838..de848c838 100644 --- a/target/linux/patches/5.4.99/or1k-more-ram.patch +++ b/target/linux/patches/5.4.147/or1k-more-ram.patch diff --git a/target/linux/patches/5.4.99/relocs.patch b/target/linux/patches/5.4.147/relocs.patch index 5bcd974c7..5bcd974c7 100644 --- a/target/linux/patches/5.4.99/relocs.patch +++ b/target/linux/patches/5.4.147/relocs.patch diff --git a/target/linux/patches/5.4.99/sh4.patch b/target/linux/patches/5.4.147/sh4.patch index 8ae79d49d..8ae79d49d 100644 --- a/target/linux/patches/5.4.99/sh4.patch +++ b/target/linux/patches/5.4.147/sh4.patch diff --git a/target/linux/patches/5.4.147/startup.patch b/target/linux/patches/5.4.147/startup.patch new file mode 100644 index 000000000..348cded65 --- /dev/null +++ b/target/linux/patches/5.4.147/startup.patch @@ -0,0 +1,34 @@ +diff -Nur linux-5.4.147.orig/init/initramfs.c linux-5.4.147/init/initramfs.c +--- linux-5.4.147.orig/init/initramfs.c 2021-09-16 12:56:14.000000000 +0200 ++++ linux-5.4.147/init/initramfs.c 2021-09-16 16:11:25.493140211 +0200 +@@ -674,6 +674,9 @@ + initrd_start = 0; + initrd_end = 0; + ++#ifdef CONFIG_DEVTMPFS_MOUNT ++ devtmpfs_mount("dev"); ++#endif + flush_delayed_fput(); + return 0; + } +diff -Nur linux-5.4.147.orig/init/main.c linux-5.4.147/init/main.c +--- linux-5.4.147.orig/init/main.c 2021-09-16 12:56:14.000000000 +0200 ++++ linux-5.4.147/init/main.c 2021-09-16 16:11:25.497140211 +0200 +@@ -1198,6 +1198,8 @@ + if (ksys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0) + pr_err("Warning: unable to open an initial console.\n"); + ++ printk(KERN_WARNING "Starting Linux (built with OpenADK).\n"); ++ + (void) ksys_dup(0); + (void) ksys_dup(0); + /* +@@ -1206,7 +1208,7 @@ + */ + + if (!ramdisk_execute_command) +- ramdisk_execute_command = "/init"; ++ ramdisk_execute_command = "/sbin/init"; + + if (ksys_access((const char __user *) + ramdisk_execute_command, 0) != 0) { diff --git a/target/linux/patches/5.4.99/arm-thumb2.patch b/target/linux/patches/5.4.99/arm-thumb2.patch deleted file mode 100644 index 351fa35c7..000000000 --- a/target/linux/patches/5.4.99/arm-thumb2.patch +++ /dev/null @@ -1,11 +0,0 @@ -diff -Nur linux-5.4.92.orig/arch/arm/vfp/vfphw.S linux-5.4.92/arch/arm/vfp/vfphw.S ---- linux-5.4.92.orig/arch/arm/vfp/vfphw.S 2021-01-23 15:58:01.000000000 +0100 -+++ linux-5.4.92/arch/arm/vfp/vfphw.S 2021-01-28 02:56:42.871473417 +0100 -@@ -81,6 +81,7 @@ - ldr r3, [sp, #S_PSR] @ Neither lazy restore nor FP exceptions - and r3, r3, #MODE_MASK @ are supported in kernel mode - teq r3, #USR_MODE -+THUMB( it ne ) - bne vfp_kmode_exception @ Returns through lr - - VFPFMRX r1, FPEXC @ Is the VFP enabled? diff --git a/target/linux/patches/5.4.99/mipsr6.patch b/target/linux/patches/5.4.99/mipsr6.patch deleted file mode 100644 index b8574797e..000000000 --- a/target/linux/patches/5.4.99/mipsr6.patch +++ /dev/null @@ -1,113 +0,0 @@ -diff -Nur linux-5.10.17.orig/arch/mips/include/asm/vdso/gettimeofday.h linux-5.10.17/arch/mips/include/asm/vdso/gettimeofday.h ---- linux-5.10.17.orig/arch/mips/include/asm/vdso/gettimeofday.h 2021-02-17 11:02:30.000000000 +0100 -+++ linux-5.10.17/arch/mips/include/asm/vdso/gettimeofday.h 2021-04-09 15:24:43.613709753 +0200 -@@ -30,12 +30,21 @@ - register long nr asm("v0") = __NR_gettimeofday; - register long error asm("a3"); - -+#if MIPS_ISA_REV >= 6 -+ asm volatile( -+ " syscall\n" -+ : "=r" (ret), "=r" (error) -+ : "r" (tv), "r" (tz), "r" (nr) -+ : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", -+ "$14", "$15", "$24", "$25", "memory"); -+#else - asm volatile( - " syscall\n" - : "=r" (ret), "=r" (error) - : "r" (tv), "r" (tz), "r" (nr) - : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", - "$14", "$15", "$24", "$25", "hi", "lo", "memory"); -+#endif - - return error ? -ret : ret; - } -@@ -54,12 +63,21 @@ - #endif - register long error asm("a3"); - -+#if MIPS_ISA_REV >= 6 -+ asm volatile( -+ " syscall\n" -+ : "=r" (ret), "=r" (error) -+ : "r" (clkid), "r" (ts), "r" (nr) -+ : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", -+ "$14", "$15", "$24", "$25", "memory"); -+#else - asm volatile( - " syscall\n" - : "=r" (ret), "=r" (error) - : "r" (clkid), "r" (ts), "r" (nr) - : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", - "$14", "$15", "$24", "$25", "hi", "lo", "memory"); -+#endif - - return error ? -ret : ret; - } -@@ -78,12 +96,21 @@ - #endif - register long error asm("a3"); - -+#if MIPS_ISA_REV >= 6 -+ asm volatile( -+ " syscall\n" -+ : "=r" (ret), "=r" (error) -+ : "r" (clkid), "r" (ts), "r" (nr) -+ : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", -+ "$14", "$15", "$24", "$25", "memory"); -+#else - asm volatile( - " syscall\n" - : "=r" (ret), "=r" (error) - : "r" (clkid), "r" (ts), "r" (nr) - : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", - "$14", "$15", "$24", "$25", "hi", "lo", "memory"); -+#endif - - return error ? -ret : ret; - } -@@ -100,12 +127,21 @@ - register long nr asm("v0") = __NR_clock_gettime; - register long error asm("a3"); - -+#if MIPS_ISA_REV >= 6 -+ asm volatile( -+ " syscall\n" -+ : "=r" (ret), "=r" (error) -+ : "r" (clkid), "r" (ts), "r" (nr) -+ : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", -+ "$14", "$15", "$24", "$25", "memory"); -+#else - asm volatile( - " syscall\n" - : "=r" (ret), "=r" (error) - : "r" (clkid), "r" (ts), "r" (nr) - : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", - "$14", "$15", "$24", "$25", "hi", "lo", "memory"); -+#endif - - return error ? -ret : ret; - } -@@ -120,12 +156,21 @@ - register long nr asm("v0") = __NR_clock_getres; - register long error asm("a3"); - -+#if MIPS_ISA_REV >= 6 -+ asm volatile( -+ " syscall\n" -+ : "=r" (ret), "=r" (error) -+ : "r" (clkid), "r" (ts), "r" (nr) -+ : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", -+ "$14", "$15", "$24", "$25", "memory"); -+#else - asm volatile( - " syscall\n" - : "=r" (ret), "=r" (error) - : "r" (clkid), "r" (ts), "r" (nr) - : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", - "$14", "$15", "$24", "$25", "hi", "lo", "memory"); -+#endif - - return error ? -ret : ret; - } diff --git a/target/linux/patches/5.4.99/startup.patch b/target/linux/patches/5.4.99/startup.patch deleted file mode 100644 index e2f2ae65a..000000000 --- a/target/linux/patches/5.4.99/startup.patch +++ /dev/null @@ -1,1265 +0,0 @@ -diff -Nur linux-5.4.69.orig/init/initramfs.c linux-5.4.69/init/initramfs.c ---- linux-5.4.69.orig/init/initramfs.c 2020-10-01 13:19:27.000000000 +0200 -+++ linux-5.4.69/init/initramfs.c 2020-10-31 02:34:40.814412219 +0100 -@@ -674,6 +674,9 @@ - initrd_start = 0; - initrd_end = 0; - -+#ifdef CONFIG_DEVTMPFS_MOUNT -+ devtmpfs_mount("dev"); -+#endif - flush_delayed_fput(); - return 0; - } -diff -Nur linux-5.4.69.orig/init/main.c linux-5.4.69/init/main.c ---- linux-5.4.69.orig/init/main.c 2020-10-01 13:19:27.000000000 +0200 -+++ linux-5.4.69/init/main.c 2020-10-31 02:32:35.699678836 +0100 -@@ -1198,6 +1198,8 @@ - if (ksys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0) - pr_err("Warning: unable to open an initial console.\n"); - -+ printk(KERN_WARNING "Starting Linux (built with OpenADK).\n"); -+ - (void) ksys_dup(0); - (void) ksys_dup(0); - /* -@@ -1206,7 +1208,7 @@ - */ - - if (!ramdisk_execute_command) -- ramdisk_execute_command = "/init"; -+ ramdisk_execute_command = "/sbin/init"; - - if (ksys_access((const char __user *) - ramdisk_execute_command, 0) != 0) { -diff -Nur linux-5.4.69.orig/init/main.c.orig linux-5.4.69/init/main.c.orig ---- linux-5.4.69.orig/init/main.c.orig 1970-01-01 01:00:00.000000000 +0100 -+++ linux-5.4.69/init/main.c.orig 2020-10-01 13:19:27.000000000 +0200 -@@ -0,0 +1,1227 @@ -+// SPDX-License-Identifier: GPL-2.0-only -+/* -+ * linux/init/main.c -+ * -+ * Copyright (C) 1991, 1992 Linus Torvalds -+ * -+ * GK 2/5/95 - Changed to support mounting root fs via NFS -+ * Added initrd & change_root: Werner Almesberger & Hans Lermen, Feb '96 -+ * Moan early if gcc is old, avoiding bogus kernels - Paul Gortmaker, May '96 -+ * Simplified starting of init: Michael A. Griffith <grif@acm.org> -+ */ -+ -+#define DEBUG /* Enable initcall_debug */ -+ -+#include <linux/types.h> -+#include <linux/extable.h> -+#include <linux/module.h> -+#include <linux/proc_fs.h> -+#include <linux/binfmts.h> -+#include <linux/kernel.h> -+#include <linux/syscalls.h> -+#include <linux/stackprotector.h> -+#include <linux/string.h> -+#include <linux/ctype.h> -+#include <linux/delay.h> -+#include <linux/ioport.h> -+#include <linux/init.h> -+#include <linux/initrd.h> -+#include <linux/memblock.h> -+#include <linux/acpi.h> -+#include <linux/console.h> -+#include <linux/nmi.h> -+#include <linux/percpu.h> -+#include <linux/kmod.h> -+#include <linux/kprobes.h> -+#include <linux/vmalloc.h> -+#include <linux/kernel_stat.h> -+#include <linux/start_kernel.h> -+#include <linux/security.h> -+#include <linux/smp.h> -+#include <linux/profile.h> -+#include <linux/rcupdate.h> -+#include <linux/moduleparam.h> -+#include <linux/kallsyms.h> -+#include <linux/writeback.h> -+#include <linux/cpu.h> -+#include <linux/cpuset.h> -+#include <linux/cgroup.h> -+#include <linux/efi.h> -+#include <linux/tick.h> -+#include <linux/sched/isolation.h> -+#include <linux/interrupt.h> -+#include <linux/taskstats_kern.h> -+#include <linux/delayacct.h> -+#include <linux/unistd.h> -+#include <linux/utsname.h> -+#include <linux/rmap.h> -+#include <linux/mempolicy.h> -+#include <linux/key.h> -+#include <linux/buffer_head.h> -+#include <linux/page_ext.h> -+#include <linux/debug_locks.h> -+#include <linux/debugobjects.h> -+#include <linux/lockdep.h> -+#include <linux/kmemleak.h> -+#include <linux/pid_namespace.h> -+#include <linux/device.h> -+#include <linux/kthread.h> -+#include <linux/sched.h> -+#include <linux/sched/init.h> -+#include <linux/signal.h> -+#include <linux/idr.h> -+#include <linux/kgdb.h> -+#include <linux/ftrace.h> -+#include <linux/async.h> -+#include <linux/sfi.h> -+#include <linux/shmem_fs.h> -+#include <linux/slab.h> -+#include <linux/perf_event.h> -+#include <linux/ptrace.h> -+#include <linux/pti.h> -+#include <linux/blkdev.h> -+#include <linux/elevator.h> -+#include <linux/sched/clock.h> -+#include <linux/sched/task.h> -+#include <linux/sched/task_stack.h> -+#include <linux/context_tracking.h> -+#include <linux/random.h> -+#include <linux/list.h> -+#include <linux/integrity.h> -+#include <linux/proc_ns.h> -+#include <linux/io.h> -+#include <linux/cache.h> -+#include <linux/rodata_test.h> -+#include <linux/jump_label.h> -+#include <linux/mem_encrypt.h> -+ -+#include <asm/io.h> -+#include <asm/bugs.h> -+#include <asm/setup.h> -+#include <asm/sections.h> -+#include <asm/cacheflush.h> -+ -+#define CREATE_TRACE_POINTS -+#include <trace/events/initcall.h> -+ -+static int kernel_init(void *); -+ -+extern void init_IRQ(void); -+extern void radix_tree_init(void); -+ -+/* -+ * Debug helper: via this flag we know that we are in 'early bootup code' -+ * where only the boot processor is running with IRQ disabled. This means -+ * two things - IRQ must not be enabled before the flag is cleared and some -+ * operations which are not allowed with IRQ disabled are allowed while the -+ * flag is set. -+ */ -+bool early_boot_irqs_disabled __read_mostly; -+ -+enum system_states system_state __read_mostly; -+EXPORT_SYMBOL(system_state); -+ -+/* -+ * Boot command-line arguments -+ */ -+#define MAX_INIT_ARGS CONFIG_INIT_ENV_ARG_LIMIT -+#define MAX_INIT_ENVS CONFIG_INIT_ENV_ARG_LIMIT -+ -+extern void time_init(void); -+/* Default late time init is NULL. archs can override this later. */ -+void (*__initdata late_time_init)(void); -+ -+/* Untouched command line saved by arch-specific code. */ -+char __initdata boot_command_line[COMMAND_LINE_SIZE]; -+/* Untouched saved command line (eg. for /proc) */ -+char *saved_command_line; -+/* Command line for parameter parsing */ -+static char *static_command_line; -+/* Command line for per-initcall parameter parsing */ -+static char *initcall_command_line; -+ -+static char *execute_command; -+static char *ramdisk_execute_command; -+ -+/* -+ * Used to generate warnings if static_key manipulation functions are used -+ * before jump_label_init is called. -+ */ -+bool static_key_initialized __read_mostly; -+EXPORT_SYMBOL_GPL(static_key_initialized); -+ -+/* -+ * If set, this is an indication to the drivers that reset the underlying -+ * device before going ahead with the initialization otherwise driver might -+ * rely on the BIOS and skip the reset operation. -+ * -+ * This is useful if kernel is booting in an unreliable environment. -+ * For ex. kdump situation where previous kernel has crashed, BIOS has been -+ * skipped and devices will be in unknown state. -+ */ -+unsigned int reset_devices; -+EXPORT_SYMBOL(reset_devices); -+ -+static int __init set_reset_devices(char *str) -+{ -+ reset_devices = 1; -+ return 1; -+} -+ -+__setup("reset_devices", set_reset_devices); -+ -+static const char *argv_init[MAX_INIT_ARGS+2] = { "init", NULL, }; -+const char *envp_init[MAX_INIT_ENVS+2] = { "HOME=/", "TERM=linux", NULL, }; -+static const char *panic_later, *panic_param; -+ -+extern const struct obs_kernel_param __setup_start[], __setup_end[]; -+ -+static bool __init obsolete_checksetup(char *line) -+{ -+ const struct obs_kernel_param *p; -+ bool had_early_param = false; -+ -+ p = __setup_start; -+ do { -+ int n = strlen(p->str); -+ if (parameqn(line, p->str, n)) { -+ if (p->early) { -+ /* Already done in parse_early_param? -+ * (Needs exact match on param part). -+ * Keep iterating, as we can have early -+ * params and __setups of same names 8( */ -+ if (line[n] == '\0' || line[n] == '=') -+ had_early_param = true; -+ } else if (!p->setup_func) { -+ pr_warn("Parameter %s is obsolete, ignored\n", -+ p->str); -+ return true; -+ } else if (p->setup_func(line + n)) -+ return true; -+ } -+ p++; -+ } while (p < __setup_end); -+ -+ return had_early_param; -+} -+ -+/* -+ * This should be approx 2 Bo*oMips to start (note initial shift), and will -+ * still work even if initially too large, it will just take slightly longer -+ */ -+unsigned long loops_per_jiffy = (1<<12); -+EXPORT_SYMBOL(loops_per_jiffy); -+ -+static int __init debug_kernel(char *str) -+{ -+ console_loglevel = CONSOLE_LOGLEVEL_DEBUG; -+ return 0; -+} -+ -+static int __init quiet_kernel(char *str) -+{ -+ console_loglevel = CONSOLE_LOGLEVEL_QUIET; -+ return 0; -+} -+ -+early_param("debug", debug_kernel); -+early_param("quiet", quiet_kernel); -+ -+static int __init loglevel(char *str) -+{ -+ int newlevel; -+ -+ /* -+ * Only update loglevel value when a correct setting was passed, -+ * to prevent blind crashes (when loglevel being set to 0) that -+ * are quite hard to debug -+ */ -+ if (get_option(&str, &newlevel)) { -+ console_loglevel = newlevel; -+ return 0; -+ } -+ -+ return -EINVAL; -+} -+ -+early_param("loglevel", loglevel); -+ -+/* Change NUL term back to "=", to make "param" the whole string. */ -+static int __init repair_env_string(char *param, char *val, -+ const char *unused, void *arg) -+{ -+ if (val) { -+ /* param=val or param="val"? */ -+ if (val == param+strlen(param)+1) -+ val[-1] = '='; -+ else if (val == param+strlen(param)+2) { -+ val[-2] = '='; -+ memmove(val-1, val, strlen(val)+1); -+ val--; -+ } else -+ BUG(); -+ } -+ return 0; -+} -+ -+/* Anything after -- gets handed straight to init. */ -+static int __init set_init_arg(char *param, char *val, -+ const char *unused, void *arg) -+{ -+ unsigned int i; -+ -+ if (panic_later) -+ return 0; -+ -+ repair_env_string(param, val, unused, NULL); -+ -+ for (i = 0; argv_init[i]; i++) { -+ if (i == MAX_INIT_ARGS) { -+ panic_later = "init"; -+ panic_param = param; -+ return 0; -+ } -+ } -+ argv_init[i] = param; -+ return 0; -+} -+ -+/* -+ * Unknown boot options get handed to init, unless they look like -+ * unused parameters (modprobe will find them in /proc/cmdline). -+ */ -+static int __init unknown_bootoption(char *param, char *val, -+ const char *unused, void *arg) -+{ -+ repair_env_string(param, val, unused, NULL); -+ -+ /* Handle obsolete-style parameters */ -+ if (obsolete_checksetup(param)) -+ return 0; -+ -+ /* Unused module parameter. */ -+ if (strchr(param, '.') && (!val || strchr(param, '.') < val)) -+ return 0; -+ -+ if (panic_later) -+ return 0; -+ -+ if (val) { -+ /* Environment option */ -+ unsigned int i; -+ for (i = 0; envp_init[i]; i++) { -+ if (i == MAX_INIT_ENVS) { -+ panic_later = "env"; -+ panic_param = param; -+ } -+ if (!strncmp(param, envp_init[i], val - param)) -+ break; -+ } -+ envp_init[i] = param; -+ } else { -+ /* Command line option */ -+ unsigned int i; -+ for (i = 0; argv_init[i]; i++) { -+ if (i == MAX_INIT_ARGS) { -+ panic_later = "init"; -+ panic_param = param; -+ } -+ } -+ argv_init[i] = param; -+ } -+ return 0; -+} -+ -+static int __init init_setup(char *str) -+{ -+ unsigned int i; -+ -+ execute_command = str; -+ /* -+ * In case LILO is going to boot us with default command line, -+ * it prepends "auto" before the whole cmdline which makes -+ * the shell think it should execute a script with such name. -+ * So we ignore all arguments entered _before_ init=... [MJ] -+ */ -+ for (i = 1; i < MAX_INIT_ARGS; i++) -+ argv_init[i] = NULL; -+ return 1; -+} -+__setup("init=", init_setup); -+ -+static int __init rdinit_setup(char *str) -+{ -+ unsigned int i; -+ -+ ramdisk_execute_command = str; -+ /* See "auto" comment in init_setup */ -+ for (i = 1; i < MAX_INIT_ARGS; i++) -+ argv_init[i] = NULL; -+ return 1; -+} -+__setup("rdinit=", rdinit_setup); -+ -+#ifndef CONFIG_SMP -+static const unsigned int setup_max_cpus = NR_CPUS; -+static inline void setup_nr_cpu_ids(void) { } -+static inline void smp_prepare_cpus(unsigned int maxcpus) { } -+#endif -+ -+/* -+ * We need to store the untouched command line for future reference. -+ * We also need to store the touched command line since the parameter -+ * parsing is performed in place, and we should allow a component to -+ * store reference of name/value for future reference. -+ */ -+static void __init setup_command_line(char *command_line) -+{ -+ size_t len = strlen(boot_command_line) + 1; -+ -+ saved_command_line = memblock_alloc(len, SMP_CACHE_BYTES); -+ if (!saved_command_line) -+ panic("%s: Failed to allocate %zu bytes\n", __func__, len); -+ -+ initcall_command_line = memblock_alloc(len, SMP_CACHE_BYTES); -+ if (!initcall_command_line) -+ panic("%s: Failed to allocate %zu bytes\n", __func__, len); -+ -+ static_command_line = memblock_alloc(len, SMP_CACHE_BYTES); -+ if (!static_command_line) -+ panic("%s: Failed to allocate %zu bytes\n", __func__, len); -+ -+ strcpy(saved_command_line, boot_command_line); -+ strcpy(static_command_line, command_line); -+} -+ -+/* -+ * We need to finalize in a non-__init function or else race conditions -+ * between the root thread and the init thread may cause start_kernel to -+ * be reaped by free_initmem before the root thread has proceeded to -+ * cpu_idle. -+ * -+ * gcc-3.4 accidentally inlines this function, so use noinline. -+ */ -+ -+static __initdata DECLARE_COMPLETION(kthreadd_done); -+ -+noinline void __ref rest_init(void) -+{ -+ struct task_struct *tsk; -+ int pid; -+ -+ rcu_scheduler_starting(); -+ /* -+ * We need to spawn init first so that it obtains pid 1, however -+ * the init task will end up wanting to create kthreads, which, if -+ * we schedule it before we create kthreadd, will OOPS. -+ */ -+ pid = kernel_thread(kernel_init, NULL, CLONE_FS); -+ /* -+ * Pin init on |