English

Fairphone 4: Kernel and GPL sources published

We are happy to announce that we have published the sources for the Fairphone 4 kernel and other GPL sources on code.fairphone.com.

You can find the kernel sources and build instructions at Fairphone 4 Kernel Source Code and the other GPL sources at Fairphone 4 Other GPL Sources.

Please feel free to discuss this release in this category of our forum!

31 Likes

Awesome, thanks for the update!

I’m trying to compile it inside a fresh Ubuntu Impish VM and I get 5 errors:

../drivers/staging/wlan-qc/qcacld-3.0/core/hdd/src/wlan_hdd_assoc.c:2135:28: error: variable 'psoc' set but not used [-Werror,-Wunused-but-set-variable]
        struct wlan_objmgr_psoc **psoc;
                                  ^
../techpack/audio/asoc/codecs/bolero/wsa-macro.c:2148:5: error: variable 'bst_state_max' set but not used [-Werror,-Wunused-but-set-variable]
        u8 bst_state_max;
           ^
../techpack/audio/asoc/codecs/bolero/wsa-macro.c:2180:5: error: variable 'bst_state_max' set but not used [-Werror,-Wunused-but-set-variable]
        u8 bst_state_max;
           ^
../techpack/audio/asoc/msm-dai-q6-v2.c:7221:17: error: variable 'len' set but not used [-Werror,-Wunused-but-set-variable]
        int rc, id, i, len;
                       ^
../techpack/audio/dsp/codecs/q6audio_v2_aio.c:175:6: error: variable 'ret' set but not used [-Werror,-Wunused-but-set-variable]
        int ret;
            ^

The VM has been set up from scratch via vagrant with ubuntu/impish64 and provisioned with sudo apt install -y make bison flex clang lld llvm repo libssl-dev gcc-aarch64-linux-gnu.

Any ideas why these errors happen and the build fails?

Thanks
Adrian

5 Likes

Thanks for trying, there is indeed an issue when using clang 13. I’ve pushed two commits to fix this issue:

Please run the “repo sync” command and try again.

11 Likes

Cool, it worked! :partying_face:

vagrant@ubuntu-impish:~/boot-fp4$ abootimg -i boot-FP4.img

Android Boot Image Info:

* file name = boot-FP4.img

* image size = 56143872 bytes (53.54 MB)
  page size  = 4096 bytes

* Boot Name = ""

* kernel size       = 44576784 bytes (42.51 MB)
  ramdisk size      = 1149710 bytes (1.10 MB)

* load addresses:
  kernel:       0x00008000
  ramdisk:      0x01000000
  tags:         0x00000100

* cmdline = console=ttyMSM0,115200,n8 earlycon=msm_geni_serial,0x888000 androidboot.hardware=qcom androidboot.console=ttyMSM0 androidboot.memcg=1 lpm_levels.sleep_disabled=1 video=vfb:640x400,bpp=32,memsize=3072000 msm_rtb.filter=0x237 service_locator.enable=1 androidboot.usbcontroller=a600000.dwc3 swiotlb=2048 cgroup.memory=nokmem,nosocket loop.max_part=7 buildvariant=user

* id = 0xb6ec92b1 0x39e4531c 0x8e066b56 0xa20eddb1 0x3d5770da 0x00000000 0x00000000 0x00000000

Now I just need the device for flashing :smiley:

7 Likes

@lucaweiss
I’m probably doing something really stupid and waste your valuable time - I have no real clue what could be causing this - my thought is maybe you see it at a glance?
If not don’t even bother!

One should be doing it like @phedoreanu with a small clean ubuntu vm anyhow I guess.
(tried it with Manjaro / Arch)

(I will be using some more time to learn about the backgrounds)

[bliss@bliss-tower-linux msm-4.19]$ make CC=clang LLVM=1 -j$(nproc)
make[1]: Entering directory '/home/bliss/Desktop/fp4-kernel/kernel/msm-4.19/build'
which: no aarch64-linux-gnu-elfedit in (/usr/lib/jvm/java-16-openjdk/bin:/home/bliss/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/var/lib/snapd/snap/bin)
arch/arm64/Makefile:27: ld does not support --fix-cortex-a53-843419; kernel may be susceptible to erratum
arch/arm64/Makefile:48: Detected assembler with broken .inst; disassembly will be unreliable
which: no ld.lld in (/usr/lib/jvm/java-16-openjdk/bin:/home/bliss/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/var/lib/snapd/snap/bin)
  UPD     include/config/kernel.release
  GEN     ./Makefile
  WRAP    arch/arm64/include/generated/uapi/asm/errno.h
  WRAP    arch/arm64/include/generated/uapi/asm/ioctl.h
  WRAP    arch/arm64/include/generated/uapi/asm/kvm_para.h
  WRAP    arch/arm64/include/generated/uapi/asm/ioctls.h
  WRAP    arch/arm64/include/generated/uapi/asm/mman.h
  WRAP    arch/arm64/include/generated/uapi/asm/ipcbuf.h
  WRAP    arch/arm64/include/generated/uapi/asm/msgbuf.h
  WRAP    arch/arm64/include/generated/uapi/asm/poll.h
  WRAP    arch/arm64/include/generated/uapi/asm/resource.h
  WRAP    arch/arm64/include/generated/uapi/asm/sembuf.h
  WRAP    arch/arm64/include/generated/uapi/asm/socket.h
  WRAP    arch/arm64/include/generated/uapi/asm/shmbuf.h
  WRAP    arch/arm64/include/generated/uapi/asm/termbits.h
  WRAP    arch/arm64/include/generated/uapi/asm/termios.h
  WRAP    arch/arm64/include/generated/uapi/asm/sockios.h
  WRAP    arch/arm64/include/generated/uapi/asm/swab.h
  WRAP    arch/arm64/include/generated/uapi/asm/types.h
  UPD     include/generated/uapi/linux/version.h
  UPD     include/generated/utsrelease.h
  Using .. as source for kernel
  WRAP    arch/arm64/include/generated/asm/bugs.h
  WRAP    arch/arm64/include/generated/asm/delay.h
  WRAP    arch/arm64/include/generated/asm/div64.h
  WRAP    arch/arm64/include/generated/asm/dma.h
  WRAP    arch/arm64/include/generated/asm/dma-contiguous.h
  WRAP    arch/arm64/include/generated/asm/early_ioremap.h
  WRAP    arch/arm64/include/generated/asm/hw_irq.h
  WRAP    arch/arm64/include/generated/asm/emergency-restart.h
  WRAP    arch/arm64/include/generated/asm/kdebug.h
  WRAP    arch/arm64/include/generated/asm/irq_regs.h
  WRAP    arch/arm64/include/generated/asm/kmap_types.h
  WRAP    arch/arm64/include/generated/asm/local.h
  WRAP    arch/arm64/include/generated/asm/local64.h
  WRAP    arch/arm64/include/generated/asm/mcs_spinlock.h
  WRAP    arch/arm64/include/generated/asm/mm-arch-hooks.h
  WRAP    arch/arm64/include/generated/asm/preempt.h
  WRAP    arch/arm64/include/generated/asm/msi.h
  WRAP    arch/arm64/include/generated/asm/qrwlock.h
  WRAP    arch/arm64/include/generated/asm/rwsem.h
  WRAP    arch/arm64/include/generated/asm/qspinlock.h
  WRAP    arch/arm64/include/generated/asm/segment.h
  WRAP    arch/arm64/include/generated/asm/serial.h
  WRAP    arch/arm64/include/generated/asm/set_memory.h
  WRAP    arch/arm64/include/generated/asm/sizes.h
  WRAP    arch/arm64/include/generated/asm/switch_to.h
  WRAP    arch/arm64/include/generated/asm/trace_clock.h
  WRAP    arch/arm64/include/generated/asm/user.h
  WRAP    arch/arm64/include/generated/asm/unaligned.h
  WRAP    arch/arm64/include/generated/asm/vga.h
  WRAP    arch/arm64/include/generated/asm/xor.h
  HOSTCC  scripts/bin2c
  HOSTCC  scripts/kallsyms
  HOSTCC  scripts/sortextable
  HOSTCC  scripts/asn1_compiler
  HOSTCC  scripts/pnmtologo
  HOSTCC  scripts/sign-file
  HOSTCC  scripts/dtc/flattree.o
  HOSTCC  scripts/dtc/dtc.o
  YACC    scripts/genksyms/parse.tab.c
  YACC    scripts/genksyms/parse.tab.h
  HOSTCC  scripts/extract-cert
  HOSTCC  scripts/dtc/fstree.o
  HOSTCC  scripts/genksyms/genksyms.o
  LEX     scripts/genksyms/lex.lex.c
  HOSTCC  scripts/dtc/treesource.o
  HOSTCC  scripts/dtc/data.o
  HOSTCC  scripts/dtc/livetree.o
  HOSTCC  scripts/dtc/srcpos.o
  HOSTCC  scripts/selinux/genheaders/genheaders
  CC      scripts/mod/empty.o
  HOSTCC  scripts/selinux/mdp/mdp
  HOSTCC  scripts/dtc/checks.o
  HOSTCC  scripts/mod/mk_elfconfig
  HOSTCC  scripts/dtc/util.o
/usr/bin/as: unrecognized option '-EL'
clang-12: error: assembler command failed with exit code 1 (use -v to see invocation)
make[3]: *** [../scripts/Makefile.build:339: scripts/mod/empty.o] Error 1
make[3]: *** Waiting for unfinished jobs....
  LEX     scripts/dtc/dtc-lexer.lex.c
  CC      kernel/bounds.s
  YACC    scripts/dtc/dtc-parser.tab.h
  YACC    scripts/dtc/dtc-parser.tab.c
  UPD     include/generated/timeconst.h
make[2]: *** [../scripts/Makefile.build:642: scripts/mod] Error 2
make[2]: *** Waiting for unfinished jobs....
  HOSTCC  scripts/genksyms/lex.lex.o
  HOSTCC  scripts/genksyms/parse.tab.o
  HOSTCC  scripts/dtc/dtc-lexer.lex.o
  UPD     include/generated/bounds.h
  CC      arch/arm64/kernel/asm-offsets.s
  HOSTCC  scripts/dtc/dtc-parser.tab.o
  HOSTLD  scripts/dtc/dtc
  HOSTLD  scripts/genksyms/genksyms
make[1]: *** [/home/bliss/Desktop/fp4-kernel/kernel/msm-4.19/Makefile:1225: scripts] Error 2
make[1]: *** Waiting for unfinished jobs....
In file included from ../arch/arm64/kernel/asm-offsets.c:25:
In file included from ../include/linux/kvm_host.h:39:
In file included from ../arch/arm64/include/asm/kvm_host.h:42:
In file included from ../include/kvm/arm_pmu.h:21:
In file included from ../include/linux/perf_event.h:57:
In file included from ../include/linux/cgroup.h:28:
../include/linux/cgroup-defs.h:507:16: warning: field 'cgrp' with variable sized type 'struct cgroup' not at the end of a struct or class is a GNU extension [-Wgnu-variable-sized-type-not-at-end]
        struct cgroup cgrp;
                      ^
1 warning generated.
  UPD     include/generated/asm-offsets.h
  CALL    ../scripts/checksyscalls.sh
make[1]: Leaving directory '/home/bliss/Desktop/fp4-kernel/kernel/msm-4.19/build'
make: *** [Makefile:151: sub-make] Error 2
[bliss@bliss-tower-linux msm-4.19]$ 

I got a successful build with a clean Ubuntu.
Though also some compiler errors that are aren’t “set but not used” - idk yet if they are bad.

1 Like
$ pacman -F ld.lld
extra/lld 12.0.1-1
    usr/bin/ld.lld

So you should probably install that package :slight_smile:

2 Likes

oooof I knew I did something stupid :upside_down_face:

1 Like