geekman / xqrepack

patch XiaoQiang images to maintain SSH & UART access
136 stars 42 forks source link

did anyone try to repack firmwares for Redmi AC2100? #15

Closed jinglei207 closed 3 years ago

jinglei207 commented 3 years ago

I tried to repack a firmware for Redmi AC2100 and flash it, but seems that it doesn't work. The LED is always orange, doesn't even boot into the system. kernel panic...

I tried to ubinize the original rootfs.ubifs file, and the outcome is the same as the original root.ubi, so the ubi configuration is right.

cat <<CFGEND > $UBICFG
[rootfs]
mode=ubi
image=$ROOTFS
vol_id=0
vol_type=dynamic
vol_name=ubi_rootfs
CFGEND

I have already tried the flashing method, worked perfectly with original root.ubi file

The problem must lay in unsquashfs and mksquashfs. I tied to unsquashfs an mksquashfs without changing anything, but still the same, kernel_panic.

jinglei207 commented 3 years ago
[    3.600000] initramfs: Loading, /dev mount ok...
[    3.610000] initramfs: Loading, /tmp mount ok...
[    3.610000] initramfs: Loading essential drivers...
[    3.620000] initramfs: Press Ctrl+C to enter RAMFS...
[    4.660000] initramfs: Bringup the system...
[    4.680000] initramfs:  *** ubi_ec_hdr_magic=55424923
[    4.680000] initramfs: flag_boot_rootfs=1 mounting /dev/mtd11
[    4.690000] UBI: attaching mtd11 to ubi0
[    4.940000] UBI: scanning is finished
[    4.950000] UBI: attached mtd11 (name "rootfs1", size 26 MiB) to ubi0
[    4.960000] UBI: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
[    4.970000] UBI: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
[    4.970000] UBI: VID header offset: 2048 (aligned 2048), data offset: 4096
[    4.980000] UBI: good PEBs: 208, bad PEBs: 0, corrupted PEBs: 0
[    4.990000] UBI: user volume: 1, internal volumes: 1, max. volumes count: 128
[    4.990000] UBI: max/mean erase counter: 7/6, WL threshold: 4096, image sequence number: 350784284
[    5.000000] UBI: available PEBs: 84, total reserved PEBs: 124, PEBs reserved for bad PEB handling: 20
[    5.010000] UBI: background thread "ubi_bgt0d" started, PID 405
UBI device numbe[    5.020000] initramfs:  *** ubiattach done. , mtd11 attached as a new ubi_rootfs partion
r 0, total 208 LEBs (26411008 bytes, 25.1 MiB), available 84 LEB[    5.030000] initramfs:  *** initramfs proc/mtd = dev:    size   erasesize  name
[    5.030000] mtd0: 07f80000 00020000 "ALL"
[    5.030000] mtd1: 00080000 00020000 "Bootloader"
[    5.030000] mtd2: 00040000 00020000 "Config"
[    5.030000] mtd3: 00040000 00020000 "Bdata"
[    5.030000] mtd4: 00040000 00020000 "Factory"
[    5.030000] mtd5: 00040000 00020000 "crash"
[    5.030000] mtd6: 00040000 00020000 "crash_syslog"
[    5.030000] mtd7: 00040000 00020000 "cfg_bak"
[    5.030000] mtd8: 00400000 00020000 "kernel0"
[    5.030000] mtd9: 00400000 00020000 "kernel1"
[    5.030000] mtd10: 01a00000 00020000 "rootfs0"
[    5.030000] mtd11: 01a00000 00020000 "rootfs1"
[    5.030000] mtd12: 02600000 00020000 "overlay"
[    5.030000] mtd13: 01b80000 00020000 "obr"
[    5.030000] mtd14: 00c1c000 0001f000 "ubi_rootfs"
s (10665984 bytes, 10.1 MiB), LEB size 126976 bytes (124.0 KiB)
[    5.110000] CPU 1 Unable to handle kernel paging request at virtual address 00000000, epc == 81159bd0, ra == 81159754
[    5.120000] Oops[#1]:
[    5.130000] CPU: 1 PID: 416 Comm: mount Not tainted 3.10.14 #0
[    5.130000] task: 87daf440 ti: 870a6000 task.ti: 870a6000
[    5.140000] $ 0   : 00000000 00000000 81159ba4 00000000
[    5.140000] $ 4   : 814a0000 00000000 00000000 00000000
[    5.150000] $ 8   : 00000001 870ef000 00000141 81516258
[    5.150000] $12   : 00000003 8151622c 00000000 00000008
[    5.160000] $16   : 00000000 00000000 00040000 000000c0
[    5.160000] $20   : ffffffea 50e001e7 00000000 00000000
[    5.170000] $24   : 00000000 00100100
[    5.170000] $28   : 870a6000 870a7cf8 00000000 81159754
[    5.180000] Hi    : 00000a88
[    5.180000] Lo    : 0000035c
[    5.190000] epc   : 81159bd0 squashfs_xz_init+0x2c/0x25c
[    5.190000]     Not tainted
[    5.190000] ra    : 81159754 squashfs_decompressor_init+0x38/0xc4
[    5.200000] Status: 1100fc03 KERNEL EXL IE
[    5.200000] Cause : 00800008
[    5.210000] BadVA : 00000000
[    5.210000] PrId  : 0001992f (MIPS 1004Kc)
[    5.210000] epc not accessible
[    5.220000] Modules linked in:
[    5.220000] Process mount (pid: 416, threadinfo=870a6000, task=87daf440, tls=77927dc0)
[    5.230000] Stack : 00000001 00000038 000000e0 87020b00 87e23ee0 810dd224 87c02c80 000000d0
          87c64200 87c0b000 87023e80 000000c0 ffffffea 81159754 870a7d4c 816996a8
          01000060 811bdf98 81670000 814a5148 87c64200 87c0b000 00000000 000000c0
          ffffffea 50e001e7 00000000 87c64200 87c0b000 8115903c 81498058 00000000
          00008000 00000000 00000060 811d2618 87c0b1b8 810eba00 6264746d 6b636f6c
          ...
[    5.260000] Call Trace:
[    5.270000] [<81159bd0>] squashfs_xz_init+0x2c/0x25c
[    5.270000] [<81159754>] squashfs_decompressor_init+0x38/0xc4
[    5.280000] [<8115903c>] squashfs_fill_super+0x384/0x6e8
[    5.280000] [<810ebe70>] mount_bdev+0x1dc/0x210
[    5.290000] [<81158bc0>] squashfs_mount+0x1c/0x28
[    5.290000] [<810ecd88>] mount_fs+0x20/0xf8
[    5.290000] [<8110a3b4>] vfs_kern_mount.part.6+0x5c/0x118
[    5.300000] [<8110cb18>] do_mount+0x1f4/0x9cc
[    5.300000] [<8110d380>] SyS_mount+0x90/0x138
[    5.310000] [<81010bdc>] stack_done+0x20/0x44
[    5.310000]
[    5.310000]
Code: afb20028  8c920080  3c04814a <8ca20000> 94a7000a  248458f0  94a60008  8ca50004  0c4ff5da
[    5.320000] ---[ end trace 133d6925b0aaf6e5 ]---
[    5.330000] Fatal exception: panic in 5 seconds
[   10.350000] Kernel panic - not syncing: Fatal exception
[   10.350000] Trying to store crash
[   10.350000] Stop this cpu 0
[   10.350000] Stop this cpu 2
[   10.350000] Stop this cpu 3
[   10.350000] 22187 bytes dumped, 22500 bytes saved.
geekman commented 3 years ago

hi @jinglei207, did you manage to solve this issue?

jinglei207 commented 3 years ago

@geekman, Hi, i was able to solve the problem by using the squashfs from here https://github.com/squashfskit/squashfskit/releases/tag/v4.14 Took me a while to find out that openwrt uses an old/modified squashfs-tool. The kernel was outside of UBI file, so i had to flash it manually. Maybe you can add support for redmi and xiaomi ac2100?