Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Нужна инструкция по снятию логов ядра после прошивки new-boot.img #138

Open
remittor opened this issue Nov 3, 2024 · 2 comments

Comments

@remittor
Copy link

remittor commented Nov 3, 2024

Имею на руках новый аппарат с разблокированным загрузчиком.
mt6878, Android 14, linux 6.1.75

Пробовал 0.10.7, 0.11.1-dev и самый свежак из dev ветки (собирал сам).

Похожая проблема: bmax121/APatch#688

Мои логи (свежак из dev):

> ./kptools -p --image ./kernel.img --skey "*********" --kpimg ./kernel/kpimg --out kernel2.img
[+] kernel image_size: 0x02128a00
[+] kernel uefi header: true
[+] kernel load_offset: 0x00000000
[+] kernel kernel_size: 0x021d0000
[+] kernel page_shift: 12
[+] new kernel image ...
[+] linux_banner 1: Linux version 6.1.75-android14-11-g03016a181dee-ab11856646 (build-user@build-host) (Android (10087095, +pgo, +bolt, +lto, -mlgo, based on r487747c) clang version 17.0.2 (https://android.googlesource.com/toolchain/llvm-project d9f89f4d16663d5012e5c09495f3b30ece3d2362), LLD 17.0.2) #1 SMP PREEMPT Fri May 17 10:24:48 UTC 2024
[+] linux_banner offset: 0xff0108
[+] linux_banner 2: Linux version 6.1.75-android14-11-g03016a181dee-ab11856646 (build-user@build-host) (Android (10087095, +pgo, +bolt, +lto, -mlgo, based on r487747c) clang version 17.0.2 (https://android.googlesource.com/toolchain/llvm-project d9f89f4d16663d5012e5c09495f3b30ece3d2362), LLD 17.0.2) #1 SMP PREEMPT Fri May 17 10:24:48 UTC 2024
[+] linux_banner offset: 0x1263f88
[+] kernel version major: 6, minor: 1, patch: 75
[+] kallsyms_token_table offset: 0x01459160
[+] endian: little
[+] kallsyms_token_index offset: 0x014594e8
[+] arm64 relocation kernel_va: 0xffffffffffffffff
[?] can't find arm64 relocation table
[+] kallsyms_markers range: [0x01410048, 0x0141065c), count: 0x00000184
[+] approximate kallsyms_offsets range: [0x012640d0, 0x012c4f7c) count: 0x000183ab
[+] kallsyms_names offset: 0x012c4f90
[?] can't find kallsyms_num_syms, try: 0x000183a1
[+] names table linux_banner index: 0x0000f6ee
[+] linux_banner index: 1
[+] kallsyms_offsets offset: 0x012640d0
[+] pid_vnr: type: T, offset: 0x000df914
[+] pid_vnr verfied sp_el0, insn: 0xd5384108
[+] layout kimg: 0x0,0x2128a00, kpimg: 0x2129000,0x2c110, extra: 0x2155110,0x80, end: 0x2155190, start: 0x21d0000
[+] kpimg version: b01
[+] kpimg compile time: 07:17:03 Nov  3 2024
[+] kpimg config: android, release
[+] tcp_init_sock: type: T, offset: 0x00e0ef74
[+] map_start: 0xe0ef80, max_size: 0x800
[+] kallsyms_lookup_name: type: T, offset: 0x001a6810
[?] no symbol: printk
[+] _printk: type: T, offset: 0x00fb1394
[+] memblock_reserve: type: T, offset: 0x00337ad4
[+] memblock_free: type: T, offset: 0x003378f0
[+] memblock_mark_nomap: type: T, offset: 0x00337dc8
[+] memblock_phys_alloc_try_nid: type: T, offset: 0x01b4fe78
[?] no symbol: memblock_virt_alloc_try_nid
[+] memblock_alloc_try_nid: type: T, offset: 0x01b50114
[+] panic: type: T, offset: 0x00fb100c
[+] rest_init: type: T, offset: 0x00fba60c
[+] kernel_init: type: t, offset: 0x00fba6f0
[+] report_cfi_failure: type: T, offset: 0x0029357c
[?] no symbol: __cfi_slowpath_diag
[?] no symbol: __cfi_slowpath
[+] copy_process: type: t, offset: 0x000acf28
[+] avc_denied: type: t, offset: 0x005f2700
[+] slow_avc_audit: type: T, offset: 0x005f1520
[+] input_handle_event: type: T, offset: 0x00a4ccf0
[+] superkey: **************
[+] paging_init: type: T, offset: 0x01b3af64
[+] patch done: new-boot.img

C:\android\apatch>magiskboot.exe repack boot.img
Parsing image: [boot.img]
HEADER_VER      [4]
KERNEL_SZ       [16254232]
RAMDISK_SZ      [0]
PAGESIZE        [4096]
CMDLINE         []
KERNEL_FMT      [lz4_legacy]
VBMETA
Repack to image: [new-boot.img]
HEADER_VER      [4]
KERNEL_SZ       [16314049]
RAMDISK_SZ      [0]
PAGESIZE        [4096]
CMDLINE         []

Далее стандартно:

adb reboot bootloader
fastboot flash boot boot.img
fastboot reboot

Результат: девайс не стартует.

Примечание: Если в kernel.img самому изменить 1 байтик (в тексте сообщения) и собрать из него new-boot.img, то после прошивки всё работает. Т.е. проблема не в перепаковке.

И вот теперь хочу вам помочь (даже сам могу в коде что то подправить или добавить доп. дебаг инфу), но вот затрудняюсь со снятием логов ядра.
Подскажите как отлаживать.

@Impqxr
Copy link

Impqxr commented Nov 7, 2024

Примечание: Если в kernel.img самому изменить 1 байтик (в тексте сообщения) и собрать из него new-boot.img, то после прошивки всё работает. Т.е. проблема не в перепаковке.

Can you explain this in more detail?

@XeonDead
Copy link

What he says - after patching boot.img with kpatch, the resulting boot.img refuses to be booted by the device's bootloader. He can't extract any dmesg-s as such is not available and asks if there are any other ways to check whether the resulting image is any good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants