Created
October 4, 2024 15:49
-
-
Save mohammedgqudah/86a70195a448a6eb79eaa74ee6d832d0 to your computer and use it in GitHub Desktop.
Compiling Linux v2.6.39 using GCC 14 and Perl v5.40.0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # A workaround I had to do while reading "Linux Kernel Development (3rd Edition)", which uses a *very* old kernel version. | |
| git checkout v2.6.39 | |
| cp include/linux/compiler-gcc4.h include/linux/compiler-gcc14.h | |
| # Make a local copy of the patch in this gist | |
| patch -p1 < v2.6-gcc-14.patch | |
| make clean | |
| make defconfig | |
| CFLAGS="-fcommon" make |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/Makefile b/Makefile | |
| index 123d858dae03..0c17d10b8887 100644 | |
| --- a/Makefile | |
| +++ b/Makefile | |
| @@ -542,6 +542,13 @@ endif # $(dot-config) | |
| # Defaults to vmlinux, but the arch makefile usually adds further targets | |
| all: vmlinux | |
| +KBUILD_CFLAGS += $(call cc-option, -fno-pie) | |
| +KBUILD_CFLAGS += $(call cc-option, -no-pie) | |
| +KBUILD_AFLAGS += $(call cc-option, -fno-pie) | |
| +KBUILD_CPPFLAGS += $(call cc-option, -fno-pie) | |
| +KBUILD_CFLAGS += $(call cc-option, -fcommon) | |
| +KBUILD_AFLAGS += $(call cc-option, -fcommon) | |
| + | |
| ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE | |
| KBUILD_CFLAGS += -Os | |
| else | |
| diff --git a/arch/x86/Makefile b/arch/x86/Makefile | |
| index b02e509072a7..d19d4ee39df7 100644 | |
| --- a/arch/x86/Makefile | |
| +++ b/arch/x86/Makefile | |
| @@ -104,6 +104,7 @@ KBUILD_AFLAGS += $(cfi) $(cfi-sigframe) $(cfi-sections) $(asinstr) | |
| KBUILD_CFLAGS += $(cfi) $(cfi-sigframe) $(cfi-sections) $(asinstr) | |
| LDFLAGS := -m elf_$(UTS_MACHINE) | |
| +LDFLAGS := --allow-multiple-definition | |
| # Speed up the build | |
| KBUILD_CFLAGS += -pipe | |
| diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c | |
| index 45ad4ffef533..8cfd997fb840 100644 | |
| --- a/drivers/acpi/osl.c | |
| +++ b/drivers/acpi/osl.c | |
| @@ -1091,7 +1091,7 @@ struct osi_setup_entry { | |
| bool enable; | |
| }; | |
| -static struct osi_setup_entry __initdata osi_setup_entries[OSI_STRING_ENTRIES_MAX]; | |
| +static struct osi_setup_entry osi_setup_entries[OSI_STRING_ENTRIES_MAX]; | |
| void __init acpi_osi_setup(char *str) | |
| { | |
| diff --git a/kernel/timeconst.pl b/kernel/timeconst.pl | |
| index eb51d76e058a..04612394c53e 100644 | |
| --- a/kernel/timeconst.pl | |
| +++ b/kernel/timeconst.pl | |
| @@ -370,7 +370,7 @@ if ($hz eq '--can') { | |
| } | |
| @val = @{$canned_values{$hz}}; | |
| - if (!defined(@val)) { | |
| + if (!@val) { | |
| @val = compute_values($hz); | |
| } | |
| output($hz, @val); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment