简体   繁体   中英

Compiling android kernel from official unmodified source gives corrupted result

I have downloaded the kernel source of my Samsung Galaxy Tab A 2018 (SM-T590) from Samsung Open Source website.

I'm trying to compile the unmodified source code using the instructions given with the kernel inside the archive, however the resulting kernel file is ~28MB, while the one which can be extracted from the stock ROM's boot.img is ~13MB.

Of course, the 28MB large compiled kernel won't boot the system up, when I select reboot to system in the recovery, it goes back to download mode.

Steps I have followed:

1. How to Build
        - get Toolchain
                From android git serveru, codesourcery and etc ..
                - gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android-

        - make output folder 
                EX) OUTPUT_DIR=out
                $ mkdir out

        - edit Makefile
                edit "CROSS_COMPILE" to right toolchain path(You downloaded).
                        EX)  CROSS_COMPILE=<android platform directory you download>/android/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android-
                        Ex)  CROSS_COMPILE=/usr/local/toolchain/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android- // check the location of toolchain
        - to Build
                $ export ARCH=arm64
                $ make -C $(pwd) O=$(pwd)/out KCFLAGS=-mno-android gta2xlwifi_eur_open_defconfig
                $ make -C $(pwd) O=$(pwd)/out KCFLAGS=-mno-android

2. Output files
        - Kernel : arch/arm64/boot/Image
        - module : drivers/*/*.ko

Log from the compiler: https://pastebin.com/Fv96iAmP

Solved.

Basically the stock kernel inside boot.img is a compressed archive containing the kernel itself, that's why it was a different size.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM