Issue while building Android_rk12.1 for Radxa ROCK 5B

Hello,

Could you please help me to fix issues I faced while building Android_rk12.1 for Radxa ROCK 5B. I am building an Android in order to get support of WiFi RTL8852BE with 10ec:b852 and custom screen resolutions.

The issues are:

  1. error: Cannot link file build/bazel/bazel.BUILD to … rock-android12/BUILD
  2. Build sandboxing disabled due to nsjail error.
  3. make[1]: *** Documentation/Kbuild: Is a directory. Stop.

#1 During a repository cloning I got “error: Cannot link file build/bazel/bazel.BUILD to … rock-android12/BUILD”:
rock-android12 % repo init -u https://github.com/radxa/manifests.git -b Android12_RK3588_Radxa_rk12 -m rockchip-s-release.xml
rock-android12 % repo sync -d --no-tags -j4
Fetching: 100% (1083/1083), done in 4m23.376s
error: Cannot link file build/bazel/bazel.BUILD to /Users/Andrei_Bryleuski/Documents/Personal/RockPI5B/rock-android12/BUILD
error: Cannot link file build/bazel/bazel.BUILD to /Users/Andrei_Bryleuski/Documents/Personal/RockPI5B/rock-android12/BUILD
Checking out: 100% (1083/1083), done in 17.691s
repo sync has finished successfully.

#2 “lunch RadxaRock5B-userdebug” & “./build.sh -UACKup” print:
Build sandboxing disabled due to nsjail error.

#3 “./build.sh -UACKup” failed with:
Build uboot ok!
Start build kernel
make[1]: *** Documentation/Kbuild: Is a directory. Stop.
Makefile:1924: recipe for target ‘_clean_Documentation’ failed
make: *** [_clean_Documentation] Error 2
#### failed to build some targets (18 seconds) ####
Build kernel failed!

I already added that wifi driver, it doesn’t work.
Are you using Windows, must be Linux.

Did you modify {“RTL8852BE”, “10ec:b852”}," in frameworks/opt/net/wifi/libwifi_hal/rk_wifi_ctrl.cpp ?
I see that driver is already included doing:

  1. insmod /vendor/lib/modules/8852be.ko
  2. stop
  3. start

make wifi working, but I would like to have WiFi working right after boot without manual operations

I use Docker under MacOS. Doing checkout inside docker fixed issues related to link files and Kbuild: Is a directory

Yes already added to my firmware.
But only the A8 from Allnet has working wifi, bluetooth.
The Lenova m2 wifi card still has no wifi, users reported even after that change.
It seems it can only work on Linux 6.x kernel with the rw89 wifi driver and not Android that uses a 5.10 kernel. I asked Realtek, Rockchip & Radxa a several weeks ago and no one came back to me so it is probably not possible to get it working.

I have RTL8852BE working in Android, but it required to manually load kernel module and do stop/start.
Currently stacked with the following error, could you please help me to find a solution for the issue below:

AR drivers/net/wireless/built-in.a
AR drivers/net/built-in.a
AR drivers/built-in.a
arch/arm64/Makefile:214: recipe for target ‘rk3588-rock-5b.img’ failed
make: *** [rk3588-rock-5b.img] Error 2

arch/arm64/Makefile:214 is:
$(Q)$(MAKE) rockchip/$*.dtb Image.lz4 modules

Looks like cpio was missed.
Currently faced with another issue:
LZ4C arch/arm64/boot/Image.lz4
Incorrect parameters
Usage :
/usr/bin/lz4 [arg] [input] [output]

input   : a filename
          with no FILE, or when FILE is - or stdin, read standard input
Arguments :
 -1     : Fast compression (default) 
 -9     : High compression 
 -d     : decompression (default for .lz4 extension)
 -z     : force compression
 -f     : overwrite output without prompting 
 -h/-H  : display help/long help and exit
arch/arm64/boot/Makefile:31: recipe for target 'arch/arm64/boot/Image.lz4' failed
make[2]: *** [arch/arm64/boot/Image.lz4] Error 1
make[2]: *** Deleting file 'arch/arm64/boot/Image.lz4'
arch/arm64/Makefile:170: recipe for target 'Image.lz4' failed
make[1]: *** [Image.lz4] Error 2
arch/arm64/Makefile:214: recipe for target 'rk3588-rock-5b.img' failed
make: *** [rk3588-rock-5b.img] Error 2

I use Ubuntu 18.04 - it has outdated lz4 and therefore instead of doing apt-get install liblz4-tool - it is required to download sources and compile manually:
wget https://github.com/lz4/lz4/archive/refs/tags/v1.9.4.zip
unzip v1.9.4.zip
cd 1.9.4 && make && make install

It looks like I am finally stuck:

Runtime aborting...
All threads:
DALVIK THREADS (1):
"main" prio=5 tid=1 Runnable (still starting up)
  | group="" sCount=0 ucsCount=0 flags=0 obj=(nil) self=0x555556ec7760
  | sysTid=28570 nice=0 cgrp=default sched=0/0 handle=0x7ffffedf0740
  | state=R schedstat=( 190898998 68334 22 ) utm=16 stm=2 core=3 HZ=100
  | stack=0x5554ff800000-0x5554ff802000 stackSize=8192KB
  | held mutexes= "abort lock" "mutator lock"(shared held)
  native: #00 pc 0000000000da4aa8  /home/android12-docker/rock-android12/out/soong/host/linux-x86/bin/dex2oatd64 (UnwindStackCurrent::UnwindFromContext(unsigned long, void*)+88)
  (no managed stack frames)

dex2oatd E 04-24 18:08:16 28570 28570 thread-inl.h:158] holding "abort lock" at point where thread suspension is expected
Aborting thread:
"main" prio=5 tid=1 Runnable (still starting up)
  | group="" sCount=0 ucsCount=0 flags=0 obj=(nil) self=0x555556ec7760
  | sysTid=28570 nice=0 cgrp=default sched=0/0 handle=0x7ffffedf0740
  | state=R schedstat=( 268896750 83583 41 ) utm=24 stm=2 core=0 HZ=100
  | stack=0x5554ff800000-0x5554ff802000 stackSize=8192KB
  | held mutexes= "abort lock" "mutator lock"(shared held)
  native: #00 pc 0000000000da4aa8  /home/android12-docker/rock-android12/out/soong/host/linux-x86/bin/dex2oatd64 (UnwindStackCurrent::UnwindFromContext(unsigned long, void*)+88)
  native:   std::__1::__compressed_pair_elem<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__rep, 0, false>::__compressed_pair_elem()
  native:    external/libcxx/include/memory:2140
  native:   std::__1::__compressed_pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__rep, std::__1::allocator<char> >::__compressed_pair<true, void>()
  native:    external/libcxx/include/memory:2234
  native:   std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string<decltype(nullptr)>(char const*)
  native:    external/libcxx/include/string:820
  native:   UnwindStackCurrent::UnwindFromContext(unsigned long, void*)
  native:    system/unwinding/libbacktrace/UnwindStack.cpp:169
  (no managed stack frames)
Aborted
ERROR: Dex2oat failed to compile a boot image.It is likely that the boot classpath is inconsistent.Rebuild with ART_BOOT_IMAGE_EXTRA_ARGS="--runtime-arg -verbose:verifier" to see verification errors.
18:08:26 ninja failed with: exit status 1

Looks like due to:
dex2oatd I 04-24 16:44:59 26806 26806 method_verifier.cc:5171] Soft verification failures in void java.text.Bidi.(java.lang.String, int)

dex2oatd I 04-24 16:44:59 26806 26806 method_verifier.cc:5171] void java.text.Bidi.<init>(java.lang.String, int): [0x5] (possibly) illegal class access: 'Precise Reference: java.text.Bidi' -> 'Unresolved Reference: android.icu.text.Bidi'

and
dex2oatd I 04-24 16:44:59 26806 26806 method_verifier.cc:5171] Soft verification failures in int java.text.CollationElementIterator.primaryOrder(int)

dex2oatd I 04-24 16:44:59 26806 26806 method_verifier.cc:5171] int java.text.CollationElementIterator.primaryOrder(int): [0x0] (possibly) illegal class access: 'Precise Reference: java.text.CollationElementIterator' -> 'Unresolved Reference: android.icu.text.CollationElementIterator'

I was able to build working image in Ubuntu 22.04

@AndreyB how did you manage to build it ? Via this: https://stackoverflow.com/a/69225444 ? Or by downgrading your kernel to be older than 5.19 ? Could you please let me know?

Make sure you are building with Java 8.
I use Ubuntu 22.04 and installed the build packages.
Older Ubuntu might give problems or when using a VM on a MAC.