From e5e35027d2907526e7171b9190cec11cbedc4989 Mon Sep 17 00:00:00 2001 From: Luca Weiss Date: Sun, 25 Jun 2023 11:01:27 +0200 Subject: [PATCH] main/lk2nd-msm8953: compile with -O1 to fix booting (MR 4196) Currently, at least on fairphone-fp3 doing "fastboot boot" crashes lk2nd, presumably due to some bug when compiled with a newer gcc version. Compiling with -O1 works well. [81660] booting linux @ 0x10000000, ramdisk @ 0x13600000 (3339187), tags/device tree @ 0x13400000 [81660] Jumping to kernel via monitor [81660] data abort, halting [81660] r0 0x8f7724fc r1 0x8f772504 r2 0x00000000 r3 0x00000000 [81660] r4 0x00000001 r5 0x8f7724fb r6 0x00000001 r7 0x5b080000 [81660] r8 0x00000000 r9 0x011b9000 r10 0x8f741094 r11 0x8f7725ac [81660] r12 0x00000001 usp 0x00000000 ulr 0x00000000 pc 0x8f630690 [81660] spsr 0x600001d3 [81660] fiq r13 0x8f729000 r14 0x00000000 [81660] irq r13 0x8f72d1a0 r14 0x8f620c2c [81660] *svc r13 0x8f7724f8 r14 0x8f6147b0 [81660] und r13 0x8f729000 r14 0x00000000 [81660] sys r13 0x00000000 r14 0x00000000 [81660] bottom of stack at 0x8f7724f8: 0x8f7724f8: 00726f63 824fe86d 00020000 8f7724fb |cor.m.O.......w.| 0x8f772508: 8f742c01 824fe86d 10000000 00000000 |..t.m.O.........| 0x8f772518: 13400000 00000000 8f628aa0 8f6147b0 |..........b..Ga.| 0x8f772528: 00000000 00000000 13400000 10000000 |................| 0x8f772538: 00000000 00000001 0000000f 824fe86d |............m.O.| 0x8f772548: 13400000 00000000 00000000 00000000 |................| 0x8f772558: 00000000 00000000 00000000 00000000 |................| 0x8f772568: 00000000 00000000 00000000 00000000 |................| --- main/lk2nd-msm8953/APKBUILD | 6 ++++-- main/lk2nd-msm8953/o2.patch | 13 +++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 main/lk2nd-msm8953/o2.patch diff --git a/main/lk2nd-msm8953/APKBUILD b/main/lk2nd-msm8953/APKBUILD index 31e2852f9..46fc81b39 100644 --- a/main/lk2nd-msm8953/APKBUILD +++ b/main/lk2nd-msm8953/APKBUILD @@ -1,14 +1,15 @@ # Maintainer: Alejandro Tafalla pkgname=lk2nd-msm8953 pkgver=0.3.3 -pkgrel=0 +pkgrel=1 pkgdesc="Secondary little kernel (lk) bootloader for msm8953 based devices" arch="aarch64" url="https://github.com/msm8953-mainline/lk2nd" license="MIT AND GPL-2.0-only" makedepends="dtc dtc-dev gcc-arm-none-eabi python3 py3-libfdt" builddir="$srcdir"/lk2nd-$pkgver -source="lk2nd-$pkgver.tar.gz::https://github.com/msm8953-mainline/lk2nd/archive/refs/tags/$pkgver.tar.gz" +source="lk2nd-$pkgver.tar.gz::https://github.com/msm8953-mainline/lk2nd/archive/refs/tags/$pkgver.tar.gz + o2.patch" options="!check !archcheck !tracedeps !strip pmb:cross-native" # This APKBUILD builds bare metal executable; options are very specific! # * there are no tests (how do you even test the bootloader?); @@ -43,4 +44,5 @@ package() { } sha512sums=" 9a55ebe30bfe2e232593edb2eddd7b6078980d2339131f2975e0a85545630b8d386c4af021bab488d4e098f1fb2d78b1059eea51e987490a3e1dfebd4ea11cf0 lk2nd-0.3.3.tar.gz +e4d2e116966485aca746bec5bf6ab9855514dc70dfb94ce3cdc9def01c5b36eeddc33e77bdbcfb8f6bb89bb0277fd6dd3e6f8066475dcfc5b5fcdec567af754b o2.patch " diff --git a/main/lk2nd-msm8953/o2.patch b/main/lk2nd-msm8953/o2.patch new file mode 100644 index 000000000..373050f68 --- /dev/null +++ b/main/lk2nd-msm8953/o2.patch @@ -0,0 +1,13 @@ +diff --git a/makefile b/makefile +index 437f7bcb0..51b060c9c 100644 +--- a/makefile ++++ b/makefile +@@ -53,7 +53,7 @@ ifeq ($(ENABLE_TRUSTZONE),1) + endif + + INCLUDES := -I$(BUILDDIR) -Iinclude +-CFLAGS := -O2 -g -fno-builtin -finline -Wno-multichar -Wno-unused-parameter -Wno-unused-function $(LKLE_CFLAGS) -include $(CONFIGHEADER) ++CFLAGS := -O1 -g -fno-builtin -finline -Wno-multichar -Wno-unused-parameter -Wno-unused-function $(LKLE_CFLAGS) -include $(CONFIGHEADER) + # -fcommon is needed to build this using GCC 10 + CFLAGS += -fcommon + #CFLAGS += -Werror