[Android Q&A, Help & Troubleshooting] coldified_:
I'm trying to compile a kernel from source for my Samsung A24 4G (SM-A245N).

However, the compilation process seems to fail even without any modifications to the source.

Here's the steps I've taken to compile the kernel and miserably fail:

Download SM-A245N_KOR_14_Opensource.zip from opensource.samsung.com

Download toolchain.tar.gz from opensource.samsung.com

Unzip so the directory looks like this:

$ tree -L 3
.
├── Kernel
│ ├── build_kernel.sh
│ ├── kernel
│ │ ├── build
│ │ ├── kernel-5.10 -> ../kernel-5.10
│ │ ├── prebuilts
│ │ └── prebuilts-master
│ ├── kernel-5.10
│ │ ├── android
│ │ ├── arch
│ │ ├── block
│ │ ├── build.config.aarch64
│ │ ├── build.config.allmodconfig
│ │ ├── build.config.allmodconfig.aarch64
│ │ ├── build.config.allmodconfig.arm
│ │ ├── build.config.allmodconfig.x86_64
│ │ ├── build.config.amlogic
│ │ ├── build.config.arm
│ │ ├── build.config.common
│ │ ├── build.config.db845c
│ │ ├── build.config.fail
│ │ ├── build.config.gki
│ │ ├── build.config.gki.aarch64
│ │ ├── build.config.gki.aarch64.fips140
│ │ ├── build.config.gki.aarch64.fips140_eval_testing
│ │ ├── build.config.gki-debug.aarch64
│ │ ├── build.config.gki-debug.x86_64
│ │ ├── build.config.gki_kasan
│ │ ├── build.config.gki_kasan.aarch64
│ │ ├── build.config.gki_kasan.x86_64
│ │ ├── build.config.gki_kprobes
│ │ ├── build.config.gki_kprobes.aarch64
│ │ ├── build.config.gki_kprobes.x86_64
│ │ ├── build.config.gki.x86_64
│ │ ├── build.config.hikey960
│ │ ├── build.config.khwasan
│ │ ├── build.config.lto_thin
│ │ ├── build.config.mtk.aarch64
│ │ ├── build.config.mtk.aarch64.gcc
│ │ ├── build.config.mtk.aarch64.kasan
│ │ ├── build.config.mtk.aarch64.ubsan
│ │ ├── build.config.mtk.arm
│ │ ├── build.config.mtk.check_gki
│ │ ├── build.config.rockchip
│ │ ├── build.config.x86_64
│ │ ├── certs
│ │ ├── COPYING
│ │ ├── CREDITS
│ │ ├── crypto
│ │ ├── Documentation
│ │ ├── drivers
│ │ ├── firmware
│ │ ├── fs
│ │ ├── include
│ │ ├── init
│ │ ├── io_uring
│ │ ├── ipc
│ │ ├── Kbuild
│ │ ├── Kconfig
│ │ ├── kenv.mk
│ │ ├── kernel
│ │ ├── lib
│ │ ├── LICENSES
│ │ ├── MAINTAINERS
│ │ ├── Makefile
│ │ ├── mm
│ │ ├── net
│ │ ├── OWNERS
│ │ ├── README
│ │ ├── README.md
│ │ ├── samples
│ │ ├── scripts
│ │ ├── security
│ │ ├── sound
│ │ ├── tools
│ │ ├── usr
│ │ └── virt
│ ├── out
│ │ └── target
│ ├── prebuilts
│ │ ├── build-tools
│ │ ├── clang
│ │ └── gcc
│ └── vendor
│ └── mediatek
├── Kernel.tar.gz
├── Platform.tar.gz
├── README_Kernel.txt
└── README_Platform.txt

41 directories, 49 files

Follow the README_Kernel.txt's instructions for building the kernel, running these commands:

cd kernel-5.10
python2 scripts/gen_build_config.py --kernel-defconfig a24_kor_00_defconfig --kernel-defconfig-overlays "entry_level.config" -m user -o ../out/target/product/a24_kor/obj/KERNEL_OBJ/build.config

export ARCH=arm64
export CROSS_COMPILE="aarch64-linux-gnu-"
export CROSS_COMPILE_COMPAT="arm-linux-gnueabi-"
export OUT_DIR="../out/target/product/a24_kor/obj/KERNEL_OBJ"
export DIST_DIR="../out/target/product/a24_kor/obj/KERNEL_OBJ"
export BUILD_CONFIG="../out/target/product/a24_kor/obj/KERNEL_OBJ/build.config"

cd ../kernel
./build/build.sh

But the make process fails at some point with the message (I've only included the last 10 lines before the error message):

CC [M] drivers/misc/mediatek/apusys/mvpu/mvpu_driver.o
CC [M] drivers/misc/mediatek/apusys/mvpu/mvpu_plat_device.o
CC [M] drivers/misc/mediatek/apusys/mvpu/mvpu_ipi.o
CC [M] drivers/misc/mediatek/apusys/mvpu/mvpu_sysfs.o
CC [M] drivers/misc/mediatek/apusys/mvpu/mvpu_sec.o
CC [M] drivers/misc/mediatek/apusys/hw_logger/hw_logger.o
CC [M] drivers/misc/mediatek/apusys/util/apusys_trace.o
AR [M] drivers/misc/mediatek/apusys/apusys.o
AR drivers/misc/built-in.a
AR drivers/built-in.a
make: *** [/home/cdf_/Downloads/SM-A245N_KOR_14_Opensource/Kernel/kernel-5.10/Makefile:192: __sub-make] Error 2

The machine I'm using:

Arch Linux x86_64
Linux 6.9.9-zen1-1-zen