Skip to content

Why the kernel I compiled cannot boot? #6922

Open

Description

@dirt2022

Compile device: an android arm64 device,running chroot debian bookworm

CC=/usr/bin/clang
LD=/usr/bin/LD.lld
At=llvm-ar
(Apt install clang llvm binutils)

cd src
Make O=out pipa_user_defconfig
Make O=out -j$(nproc)
I got out/arch/arm64/boot/Image
And : out/arch/arm64/boot/dts/xxxx.dtbo

Mkdtimg create dtbo.IMG out/arch/arm64/boot/dts/*.dtbo

(I merged the device-tree into the source code.)

mkbootimg boot.IMG --kernel out/arch/arm64/boot/Image --ramdisk /root/unpacked --*** (args from boot.IMG in official firmware)

Here are the results:
Official = O
Custom= C ( built from the source code )

boot successfully=Y
boot unsuccessfully=N (stuck in the MI logo)

| DTBO.IMG | BOOT.IMG | RESULT |
| O | O | Y |
| O | C | N |
| C | O | Y |
| C | C | N |

Activity

  1. changed the title [-]Why I compiled kernel cannot boot?[/-] [+]Why the kernel I compiled cannot boot?[/+] on Feb 8, 2024
  2. dirt2022 commented on Feb 8, 2024

    @dirt2022
    Author

    I am using GSI.

    Before compiling,I edit the gsi.c
    ( Or genksyms program cannot version the function:gsi_write_channel_scratch )

    static union __packed gsi_channel_scratch __gsi_update_mhi_channel_scratch(
            unsigned long chan_hdl, struct __packed gsi_mhi_channel_scratch mscr)
    {

    Into

    static union gsi_channel_scratch __gsi_update_mhi_channel_scratch(
            unsigned long chan_hdl, struct __packed gsi_mhi_channel_scratch mscr)
    {
  3. liyafe1997 commented on Oct 10, 2024

    @liyafe1997

    The pipa kernel has a uninitialized pointer problem, which can cause kernel panic during boot.

    [    0.900473] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000020
    [    0.900477] Mem abort info:
    [    0.900480]   ESR = 0x96000005
    [    0.900483]   Exception class = DABT (current EL), IL - 32 bitq
    [    0.900485]   SET = 0, FnV = 0
    [    0.900488]   EA = 0, S1PTW = 0
    [    0.900490] Data abort info:
    [    0.900492]   ISV = 0, ISS = 0x00000005
    [    0.900495]   CM = 0, WnR = 0
    [    0.900498] [0000000000000020] user address but active_mm is swapper
    [    0.900503] Internal error: Oops: 96000005 [#1] PREEMPT SMP
    [    0.900509] Modules linked in:
    [    0.900513] Process swapper/0 (pid: 1, stack limit = 0x000000002d949a78)
    [    0.900508\ CPU: 4 PID: 1 Comm: swapper/0 Tainted: G S                4.19.318-perf+ #1
    [    0.900521] Hardware name: Qualcomm Technologies, Inc. xiaomi pipa (DT)
    [    0.900524] pstate: 00c00005 (nzcv daif +PAN +UAO)
    [    0.900538] pc : bq2597x_charger_probe+0x44/0xe3c
    [    0.900552] lr : i2c_device_probe+0x230/0x278
    [    0.900555] sp : ffffff800805ba60
    [    0.900557] x29: ffffff800805ba70 x28: 0000000000000000 
    [    0.900560] x27: 0000000000000000 x26: 0000000000000000 
    [    0.900563] x25: 0000000000000000 x24: ffffffa26c125028 
    [    0.900566] x23: ffffffa26a2116e0 x22: ffffffcb3746b404 
    [    0.900568] x21: ffffffa26b43ecf0 x20: ffffffcb3746b400 
    [    0.900571] x19: ffffffcb3746b420 x18: 0000000000000000 
    [    0.900574] x17: ffffff800805b800 x16: 0000000000000010 
    [    0.900576] x15: ffffffa26aeee488 x14: 0000000000003334 
    [    0.900579] x13: ffffff800805b3c2 x12: 0000000000000001 
    [    0.900582] x11: ffffffa26bb58b5b x10: ffffffa26bb58ba1 
    [    0.900584] x9 : 0000000000000020 x8 : 5ea38723ee3fcf00 
    [    0.900587] x7 : feff646d6e6b6063 x6 : 0000000000008080 
    [    0.900590] x5 : 0000000000000000 x4 : 8080000000000000 
    [    0.900592] x3 : 0000000000000000 x2 : 0000000000000000 
    [    0.900595] x1 : ffffffa26bb58b8b x0 : ffffffcb3746b400 
    [    0.900599] Call trace:
    [    0.900602]  bq2597x_charger_probe+0x44/0xe3c
    [    0.900605]  i2c_device_probe+0x230/0x278
    [    0.900614]  really_probe+0x270/0x2f4
    [    0.900617]  driver_probe_device+0x60/0xf8
    [    0.900620]  __driver_attach+0xe0/0x118
    [    0.900623]  bus_for_each_dev+0x7c/0xc4
    [    0.900626]  driver_attach+0x20/0x28
    [    0.900629]  bus_add_driver+0x11c/0x1fc
    [    0.900633]  driver_register+0x74/0x108
    [    0.900636]  i2c_register_driver+0x3c/0x9c
    [    0.900644]  bq2597x_charger_driver_init+0x18/0x20
    [    0.900650]  do_one_initcall+0x180/0x2dc
    [    0.900656]  do_initcall_level+0x140/0x168
    [    0.900659]  do_basic_setup+0x30/0x48
    [    0.900662]  kernel_init_freeable+0xb8/0x138
    [    0.900668]  kernel_init+0x14/0x28c
    [    0.900671]  ret_from_fork+0x10/0x18
    [     .900675\ Code: aa0003f4 f000ca21 912e2c21 f90007e8 (b9400128) 
    [    0.900681] ---[ end traCe 4fb713f1eefedda& ]---
    [    0.900703] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
    

    The fix:
    #27861

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions