ROCK 5B, 根据官方教程编译kernel 失败

环境:Ubuntu16
教程: Rock5/guide/android12 - Radxa Wiki

问题0: lunch RadxaRock5B-userdebug 有一个error
Build sandboxing disabled due to nsjail error.

PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=12
TARGET_PRODUCT=RadxaRock5B
TARGET_BUILD_VARIANT=userdebug
TARGET_BUILD_TYPE=release
TARGET_ARCH=arm64
TARGET_ARCH_VARIANT=armv8-a
TARGET_CPU_VARIANT=generic
TARGET_2ND_ARCH=arm
TARGET_2ND_ARCH_VARIANT=armv8-a
TARGET_2ND_CPU_VARIANT=generic
HOST_ARCH=x86_64
HOST_2ND_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=Linux-3.10.0-1160.83.1.el7.x86_64-x86_64-Ubuntu-16.04.7-LTS
HOST_CROSS_OS=windows
HOST_CROSS_ARCH=x86
HOST_CROSS_2ND_ARCH=x86_64
HOST_BUILD_TYPE=release
BUILD_ID=SP2A.220405.004
OUT_DIR=out




问题1:

Building kernel 中的 make $ADDON_ARGS ARCH=arm64 ${PRODUCT_KERNEL_DTS}.img -j$(nproc) 报错

下面为报错信息:
arch/arm64/Makefile:25: ld does not support --fix-cortex-a53-843419; kernel may be susceptible to erratum
arch/arm64/Makefile:33: LSE atomics not supported by binutils
arch/arm64/Makefile:44: Detected assembler with broken .inst; disassembly will be unreliable
arch/arm64/Makefile:25: ld does not support --fix-cortex-a53-843419; kernel may be susceptible to erratum
arch/arm64/Makefile:33: LSE atomics not supported by binutils
arch/arm64/Makefile:44: Detected assembler with broken .inst; disassembly will be unreliable
CC scripts/mod/empty.o
CC scripts/mod/devicetable-offsets.s
gcc: error: unrecognized command line option ‘-mlittle-endian’
gcc: error: unrecognized command line option ‘-mgeneral-regs-only’
gcc: error: unrecognized command line option ‘-mlittle-endian’
gcc: error: unrecognized command line option ‘-mgeneral-regs-only’
scripts/Makefile.build:273: recipe for target ‘scripts/mod/empty.o’ failed
make[2]: *** [scripts/mod/empty.o] Error 1
make[2]: *** Waiting for unfinished jobs…
scripts/Makefile.build:117: recipe for target ‘scripts/mod/devicetable-offsets.s’ failed
make[2]: *** [scripts/mod/devicetable-offsets.s] Error 1
Makefile:1321: recipe for target ‘prepare0’ failed
make[1]: *** [prepare0] Error 2
arch/arm64/Makefile:214: recipe for target ‘rk3588-rock-5b.img’ failed
make: *** [rk3588-rock-5b.img] Error 2




问题2:

Building AOSP 时 make -j$(nproc) 错误

以下为报错信息:
Build sandboxing disabled due to nsjail error.
build/make/core/soong_config.mk:195: warning: BOARD_PLAT_PUBLIC_SEPOLICY_DIR has been deprecated. Use SYSTEM_EXT_PUBLIC_SEPOLICY_DIRS instead.
build/make/core/soong_config.mk:196: warning: BOARD_PLAT_PRIVATE_SEPOLICY_DIR has been deprecated. Use SYSTEM_EXT_PRIVATE_SEPOLICY_DIRS instead.

Disallowed PATH tool “python3.5” used: []string{“python3.5”, “.repo/repo/repo”, “manifest”, “-r”, “-o”, “out/commit_id.xml”}
[100% 261/261] initializing build system …
device/rockchip/common/prebuild.mk:2: warning: Generating manifest snapshot at out/commit_id.xml…
device/rockchip/common/prebuild.mk:3: warning: You can disable this by removing this and setting BOARD_RECORD_COMMIT_ID := false in BoardConfig.mk
“python3.5” is not allowed to be used.
[ 48% 266/544] including build/make/target/board/Android.mk …
build fstab file with device/rockchip/common/scripts/fstab_tools/fstab.in…
rebuilding dtbo image with device/rockchip/rk3588/RadxaRock5B/dt-overlay.in…
build parameter.txt with device/rockchip/common/scripts/parameter_tools/parameter.in…
[ 64% 353/544] including external/rk_tee_user/v2/Android.mk …
‘building rk_tee_user v2’
[ 76% 415/544] including hardware/rockchip/camera_engine_rkisp/Android.mk …
TARGET_BOARD_PLATFORM=rk3588
[ 77% 422/544] including hardware/rockchip/libhwjpeg/Android.mk …
git-a3094bc author: Chen Jinsen 2022-03-04 [project] remove unused space blank
[ 86% 471/544] including system/sepolicy/Android.mk …
system/sepolicy/Android.mk:57: warning: BOARD_PLAT_PUBLIC_SEPOLICY_DIR has been deprecated. Use SYSTEM_EXT_PUBLIC_SEPOLICY_DIRS instead.
system/sepolicy/Android.mk:62: warning: BOARD_PLAT_PRIVATE_SEPOLICY_DIR has been deprecated. Use SYSTEM_EXT_PRIVATE_SEPOLICY_DIRS instead.
[ 99% 543/544] finishing build rules …
packages/apps/Camera2/Android.mk: warning: “Camera2 (app:platform) should not link against libjni_jpegutil (native:ndk:libc++:static)”
FAILED: ninja: ‘kernel-5.10/arch/arm64/boot/Image’, needed by ‘out/target/product/RadxaRock5B/kernel’, missing and no known rule to make it
ninja failed with: exit status 1

failed to build some targets (03:15 (mm:ss)) ####

建议使用build.sh编译,可以看下RKDocs目录下的文档

source build/envsetup.sh
unch RadxaRock5B-userdebug
./build.sh -UACKup
一样失败。
最上面会提示 Build sandboxing disabled due to nsjail error.

最下面 提示
arch/arm64/Makefile:214: recipe for target ‘rk3588-rock-5b.img’ failed
make: *** [rk3588-rock-5b.img] Error 2

failed to build some targets (04:05 (mm:ss))

Build kernel failed!

RKDocs目录 麻烦发下链接。 还没找到

更换 docker Ubuntu20 的环境, 构建还是失败。
同样会报 Build sandboxing disabled due to nsjail error 这个错误

最后 会报
make: ***【arch/arm64/Makefile:214: rk3588-rock-5b.img] error 2

build kernel failed!.

soong.log 里的报错信息为

ux.go:130: [W][2023-03-27T07:42:25+0000][62196] void cmdline::logParams(nsjconf_t *)():250 Process will be UID/EUID=0 in the global user namespace, and will have user root-level access to files

2023/03/27 07:42:25.935708 build/soong/ui/build/sandbox_linux.go:130: [W][2023-03-27T07:42:25+0000][62196] void cmdline::logParams(nsjconf_t *)():260 Process will be GID/EGID=0 in the global user namespace, and will have group root-level access to files

2023/03/27 07:42:25.935716 build/soong/ui/build/sandbox_linux.go:130: [E][2023-03-27T07:42:25+0000][62196] bool subproc::runChild(nsjconf_t *, int, int, int)():447 clone(flags=CLONE_NEWNS|CLONE_NEWUTS|CLONE_NEWIPC|CLONE_NEWUSER|CLONE_NEWPID|CLONE_NEWNET|SIGCHLD) failed. You probably need root privileges if your system doesn’t support CLONE_NEWUSER. Alternatively, you might want to recompile your kernel with support for namespaces or check the current value of the kernel.unprivileged_userns_clone sysctl: Operation not permitted

2023/03/27 07:42:25.935721 build/soong/ui/build/sandbox_linux.go:130: [E][2023-03-27T07:42:25+0000][62196] int nsjail::standaloneMode(nsjconf_t *)():146 Couldn’t launch the child process

i am bad at other languages without abc :slight_smile:

but is just realy following this guide

https://wiki.radxa.com/Rock5/guide/android12

and your toolchain is not ok , i presume your using docker ? it is a docker permission error

just do the build and dont use docker

Hello, I completely followed this guide you said, everything is fine before, and finally the error message is reported for this:

make: *** [arch/arm64/Makefile:214: rk3588-rock-5b.img] Error 2

failed to build some targets (04:00 (mm:ss)) ####

Build kernel failed!

Please check if you have kernel5.10/kernel/configs/rock5b.config