From 4c6dd3d573dd86c4fb00c1857277effe577c6a2b Mon Sep 17 00:00:00 2001 From: Andrey Lebedev Date: Sat, 25 Jan 2020 12:43:10 +0200 Subject: [PATCH 1/4] linux-sunxi: fix compilation issue on gcc-9 Error comes in form of /tmp/ccCGMQmS.s:648: Error: .err encountered Tested on zeus branch of linux-sunxi. --- ...gcc5-fixes.patch => 0003-gcc5-fixes.patch} | 0 .../0004-arm-put-user-asm-fix.patch | 29 +++++++++++++++++++ .../linux-sunxi/0005-silence-warning.patch | 25 ++++++++++++++++ recipes-kernel/linux/linux-sunxi_3.4.bb | 5 +++- 4 files changed, 58 insertions(+), 1 deletion(-) rename recipes-kernel/linux/linux-sunxi/{0001-gcc5-fixes.patch => 0003-gcc5-fixes.patch} (100%) create mode 100644 recipes-kernel/linux/linux-sunxi/0004-arm-put-user-asm-fix.patch create mode 100644 recipes-kernel/linux/linux-sunxi/0005-silence-warning.patch diff --git a/recipes-kernel/linux/linux-sunxi/0001-gcc5-fixes.patch b/recipes-kernel/linux/linux-sunxi/0003-gcc5-fixes.patch similarity index 100% rename from recipes-kernel/linux/linux-sunxi/0001-gcc5-fixes.patch rename to recipes-kernel/linux/linux-sunxi/0003-gcc5-fixes.patch diff --git a/recipes-kernel/linux/linux-sunxi/0004-arm-put-user-asm-fix.patch b/recipes-kernel/linux/linux-sunxi/0004-arm-put-user-asm-fix.patch new file mode 100644 index 0000000..cf9305c --- /dev/null +++ b/recipes-kernel/linux/linux-sunxi/0004-arm-put-user-asm-fix.patch @@ -0,0 +1,29 @@ +From 25a7e85eb0d58479f7d8895b1b29a648bd07d60e Mon Sep 17 00:00:00 2001 +From: Andrey Lebedev +Date: Mon, 20 Jan 2020 23:19:51 +0200 +Subject: [PATCH 2/2] Fix asm error in put_user under gcc version 8 and above + +Fixes these errors during compilation of linux-sunxi-3.4 kernel: +/tmp/ccCGMQmS.s:648: Error: .err encountered + +Taken from https://patchwork.kernel.org/patch/10546809/ +--- + arch/arm/include/asm/uaccess.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h +index b04850fd..abfafbbf 100644 +--- a/arch/arm/include/asm/uaccess.h ++++ b/arch/arm/include/asm/uaccess.h +@@ -159,7 +159,7 @@ extern int __put_user_8(void *, unsigned long long); + ({ \ + unsigned long __limit = current_thread_info()->addr_limit - 1; \ + const typeof(*(p)) __user *__tmp_p = (p); \ +- register const typeof(*(p)) __r2 asm("r2") = (x); \ ++ register typeof(*(p)) __r2 asm("r2") = (x); \ + register const typeof(*(p)) __user *__p asm("r0") = __tmp_p; \ + register unsigned long __l asm("r1") = __limit; \ + register int __e asm("r0"); \ +-- +2.20.1 + diff --git a/recipes-kernel/linux/linux-sunxi/0005-silence-warning.patch b/recipes-kernel/linux/linux-sunxi/0005-silence-warning.patch new file mode 100644 index 0000000..e0c9291 --- /dev/null +++ b/recipes-kernel/linux/linux-sunxi/0005-silence-warning.patch @@ -0,0 +1,25 @@ +From 302604ee4a2011871cb26deaf69d567cf57d0fe3 Mon Sep 17 00:00:00 2001 +From: Andrey Lebedev +Date: Mon, 20 Jan 2020 23:20:07 +0200 +Subject: [PATCH 1/2] Silence annoying warning + +--- + include/linux/log2.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/linux/log2.h b/include/linux/log2.h +index fd7ff3d9..14458fdd 100644 +--- a/include/linux/log2.h ++++ b/include/linux/log2.h +@@ -18,7 +18,7 @@ + /* + * deal with unrepresentable constant logarithms + */ +-extern __attribute__((const, noreturn)) ++extern __attribute__((const)) + int ____ilog2_NaN(void); + + /* +-- +2.20.1 + diff --git a/recipes-kernel/linux/linux-sunxi_3.4.bb b/recipes-kernel/linux/linux-sunxi_3.4.bb index 69fcef2..80f32b8 100644 --- a/recipes-kernel/linux/linux-sunxi_3.4.bb +++ b/recipes-kernel/linux/linux-sunxi_3.4.bb @@ -14,9 +14,12 @@ MACHINE_KERNEL_PR_append = "a" SRC_URI += "git://github.com/linux-sunxi/linux-sunxi.git;branch=sunxi-3.4;protocol=git \ file://0001-compiler-gcc-integrate-the-various-compiler-gcc-345-.patch \ file://0002-use-static-inline-in-ARM-ftrace.patch \ - file://0001-gcc5-fixes.patch \ + file://0003-gcc5-fixes.patch \ + file://0004-arm-put-user-asm-fix.patch \ + file://0005-silence-warning.patch \ file://defconfig \ " +LIC_FILES_CHKSUM = "file://COPYING;md5=d7810fab7487fb0aad327b76f1be7cd7" S = "${WORKDIR}/git" From 3107a0c1c9a844a4866f60db692e10011f5f01a4 Mon Sep 17 00:00:00 2001 From: Andrey Lebedev Date: Sat, 25 Jan 2020 12:53:10 +0200 Subject: [PATCH 2/4] u-boot-sunxi: fix compilation under gcc, newer than 4 --- recipes-bsp/u-boot/u-boot-sunxi.bb | 5 ++-- ...gcc5-fixes.patch => 0001-gcc5-fixes.patch} | 0 ...gcc6-fixes.patch => 0002-gcc6-fixes.patch} | 0 ...003-No-gcc-version-specific-includes.patch | 24 +++++++++++++++++++ 4 files changed, 27 insertions(+), 2 deletions(-) rename recipes-bsp/u-boot/u-boot-sunxi/{0002-gcc5-fixes.patch => 0001-gcc5-fixes.patch} (100%) rename recipes-bsp/u-boot/u-boot-sunxi/{0003-gcc6-fixes.patch => 0002-gcc6-fixes.patch} (100%) create mode 100644 recipes-bsp/u-boot/u-boot-sunxi/0003-No-gcc-version-specific-includes.patch diff --git a/recipes-bsp/u-boot/u-boot-sunxi.bb b/recipes-bsp/u-boot/u-boot-sunxi.bb index e5e63ec..eb6a3fa 100644 --- a/recipes-bsp/u-boot/u-boot-sunxi.bb +++ b/recipes-bsp/u-boot/u-boot-sunxi.bb @@ -20,8 +20,9 @@ UBOOT_MACHINE_meleg = "Mele_A1000G_config" SRC_URI = " \ git://github.com/linux-sunxi/u-boot-sunxi.git;protocol=git;branch=sunxi \ - file://0002-gcc5-fixes.patch \ - file://0003-gcc6-fixes.patch \ + file://0001-gcc5-fixes.patch \ + file://0002-gcc6-fixes.patch \ + file://0003-No-gcc-version-specific-includes.patch \ " PE = "1" diff --git a/recipes-bsp/u-boot/u-boot-sunxi/0002-gcc5-fixes.patch b/recipes-bsp/u-boot/u-boot-sunxi/0001-gcc5-fixes.patch similarity index 100% rename from recipes-bsp/u-boot/u-boot-sunxi/0002-gcc5-fixes.patch rename to recipes-bsp/u-boot/u-boot-sunxi/0001-gcc5-fixes.patch diff --git a/recipes-bsp/u-boot/u-boot-sunxi/0003-gcc6-fixes.patch b/recipes-bsp/u-boot/u-boot-sunxi/0002-gcc6-fixes.patch similarity index 100% rename from recipes-bsp/u-boot/u-boot-sunxi/0003-gcc6-fixes.patch rename to recipes-bsp/u-boot/u-boot-sunxi/0002-gcc6-fixes.patch diff --git a/recipes-bsp/u-boot/u-boot-sunxi/0003-No-gcc-version-specific-includes.patch b/recipes-bsp/u-boot/u-boot-sunxi/0003-No-gcc-version-specific-includes.patch new file mode 100644 index 0000000..c0a756f --- /dev/null +++ b/recipes-bsp/u-boot/u-boot-sunxi/0003-No-gcc-version-specific-includes.patch @@ -0,0 +1,24 @@ +From bc4aa5814cbedbfaa1c79dfe7ea2571fee7f2d51 Mon Sep 17 00:00:00 2001 +From: Andrey Lebedev +Date: Wed, 22 Jan 2020 20:00:11 +0200 +Subject: [PATCH] No gcc version-specific includes + +In order to support gcc-5 and above. Fixes compilation errors like + +linux/compiler-gcc9.h: No such file or directory +--- + include/linux/compiler-gcc.h | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h +index 9896e547b9..5f0bd65f3a 100644 +--- a/include/linux/compiler-gcc.h ++++ b/include/linux/compiler-gcc.h +@@ -90,4 +90,3 @@ + #define __gcc_header(x) #x + #define _gcc_header(x) __gcc_header(linux/compiler-gcc##x.h) + #define gcc_header(x) _gcc_header(x) +-#include gcc_header(__GNUC__) +-- +2.20.1 + From b88a5c62f1d74d5551f8600e06ba1ad0a0f58f29 Mon Sep 17 00:00:00 2001 From: Andrey Lebedev Date: Sat, 25 Jan 2020 12:53:32 +0200 Subject: [PATCH 3/4] Correctly generate .config file for the compilation --- recipes-bsp/u-boot/u-boot-sunxi.bb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/recipes-bsp/u-boot/u-boot-sunxi.bb b/recipes-bsp/u-boot/u-boot-sunxi.bb index eb6a3fa..1fb17a0 100644 --- a/recipes-bsp/u-boot/u-boot-sunxi.bb +++ b/recipes-bsp/u-boot/u-boot-sunxi.bb @@ -36,3 +36,7 @@ S = "${WORKDIR}/git" PACKAGE_ARCH = "${MACHINE_ARCH}" SPL_BINARY="u-boot-sunxi-with-spl.bin" + +do_configure () { + oe_runmake -C ${S} O=${B} ${UBOOT_MACHINE} +} From 3aec777673209a27e93a005c44bd07b6dada3942 Mon Sep 17 00:00:00 2001 From: Andrey Lebedev Date: Sat, 25 Jan 2020 13:02:21 +0200 Subject: [PATCH 4/4] Mention that devicetree needs to be disabled for old kernel --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index fd6da2d..4fb1335 100644 --- a/README.md +++ b/README.md @@ -26,9 +26,10 @@ If you want to switch back to sunxi versions for some reasons (no device tree av - change the file conf/machine/include/sunxi.inc to include the following block - edit your conf/local.conf to add the following block - PREFERRED_PROVIDER_u-boot="u-boot-sunxi" - PREFERRED_PROVIDER_virtual/bootloader="u-boot-sunxi" - PREFERRED_PROVIDER_virtual/kernel="linux-sunxi" + PREFERRED_PROVIDER_u-boot="u-boot-sunxi" + PREFERRED_PROVIDER_virtual/bootloader="u-boot-sunxi" + PREFERRED_PROVIDER_virtual/kernel="linux-sunxi" + KERNEL_DEVICETREE = "" If you already have built the mainline versions it might be necessary to reset the build directories with: