您尚未登录。

#1 Re: 全志 SOC » T153M3-QCX/T153M4-QCX 简易排针开发板 » 2026-09-11 21:51:55

₩υ二胖_cf2c0d29 说:

@晕哥
实在不行就直接换个nand试试

我也觉得是w25q128 flash的问题,但是不想动烙铁,等后面换flash再来解密。

#2 Re: 全志 SOC » T153M3-QCX/T153M4-QCX 简易排针开发板 » 2026-09-11 17:34:42

奇怪有一块板启动正常,但是烧录不了:

......

[128]HELLO! BOOT0 is starting!
[131]BOOT0 commit : {0a84c8b0}
[135][pmu]: bus read error
[137]enable vdd sys auto set
[140]fdt err returned -9
[142]not find dvfs config in spl.dts, default vdd_sys set 0.95V
[148]set pll start
[150]set pll end
[152]dram para13 invalid use default para
[156]vaild para:1  select dram para0
[159]ic board init ok
[161]rtc[7] value = 0x6
[163]enable_jtag
[165]set spi freq:50000000
[169]spi sample_mode:0 sample_delay:1f
[173]spinor id is: ef 40 18, read cmd: 6b
[177]DRAM BOOT DRIVE INFO: V0.21
[180]DRAM use external ZQ
[183]DRAM CLK = 933 MHz
[185]DRAM Type = 3 (3:DDR3,4:DDR4)
[215]DRAM SIZE = 256 MBytes, para1 = 30ea, para2 = 1000001, dram_tpr13 = 8207071
[225]DRAM simple test OK.
[227]dram size = 256
[230]set spi freq:50000000
[234]spi sample_mode:0 sample_delay:1f
[238]spinor id is: ef 40 18, read cmd: 6b
[242]Succeed in reading toc file head.
[245]The size of toc is 1ac000.
[319]Entry_name        = u-boot
[328]Entry_name        = optee
[333]Jump to OPTEE: optee_base = 0x42900000, uboot_base = 0x43500000
M/TC: OP-TEE version: 807754be (gcc version 5.3.1 20160412 (Linaro GCC 5.3-2016.05)) #1 Tue Aug  5 10:07:52 UTC 2025 arm
M/TC: OP-TEE 32bit
[00.516]ns16550_serial serial@2600000: pinctrl_select_state_full: uclass_get_device_by_phandle_id: err=-19

U-Boot 2023.04-rc4 (Aug 06 2026 - 15:21:00 +0800) Allwinner Technology
U-Boot bsp (Aug 06 2026 - 15:21:00 +0800) Allwinner Technology

14/40 CPU:   SUNXI Family
Model: sun8iw22
DRAM:  256 MiB
[00.547]Relocation Offset is: 0c9a3000
Working FDT set to 4de9b310
[00.603]secure enable bit: 0
E/TC:0   fdt_getprop_u32:388 prop trace_level not found
[00.619]CPU=1008MHz, PLL6=600Mhz, AHB=200Mhz, APB1=100Mhz, MBus=480Mhz
[00.625]workmode = 0,storage type = nor
[00.631]sunxi-spif spif@2800000: frequency no in range, use default value 150000000
[00.638]sunxi-spif spif@2800000: sample_mode:aaaaffff sample_delay:aaaaffff
sunxi_get_spif_mode()222 - get dtr_mode_enable fail -13
sunxi_get_spif_mode()231 - get io_mode_enable fail -13
[00.655]sunxi-spif spif@2800000: probe succeed (Version 1.0.0)
[00.660]sunxi-spif spif@2800000: sspi->mode:0x2400  mode:0x0
[00.676]sunxi-spif spif@2800000: spi sample_mode:0 sample_delay:1f
[00.682]sunxi-spif spif@2800000: spif sspi->speed_hz:50000000
SF: Detected w25q128 with page size 256 Bytes, erase size 64 KiB, total 16 MiB
[00.695]sunxi-spif spif@2800000: sunxi_spif_release_bus()
[00.700]set_sunxi_flash_curdev...45:cur_sunxi_flash :spif-nor.sunxi_flash
Core:  165 devices, 24 uclasses, devicetree: separate
WDT:   Not starting watchdog@0x02050000
MMC:
[00.719]Loading Environment from SUNXI_FLASH... [00.747]OK
In:    serial
Out:   serial
Err:   serial
[00.752]skip update boot_param
[00.755]update bootcmd
Net:   [00.758]No ethernet found.
[00.761]do sunxi preboot
[00.763]root_partition is rootfs
[00.767]set root to /dev/mtdblock4
[00.770]update part info
bmp_name=bootlogo.bmp
[00.774]sunxi bmp info error : unable to open logo file bootlogo.bmp
[00.780]Get sunxi drm device fail!
Working FDT set to 42000000
[00.806]change working_fdt 0x4de9b310 to 0x42000000
[00.813]enable node spi0/spi_board0 error: FDT_ERR_NOTFOUND
[00.823]spinor update sample_mode:0 right_sample_mod:1f
[00.833]update dts
[00.836]Item0 (Map) magic is bad
[01.129]try to update
Hit any key to stop autoboot:  0
[01.463]do sunxi update
## Booting Android Image at 0x40007800 ...
Android's image name: sun8i_arm
Kernel load addr 0x40008000 size 5305 KiB
## Flattened Device Tree blob at 42000000
   Booting using the fdt blob at 0x42000000
Working FDT set to 42000000
   XIP Kernel Image
   Using Device Tree in place at 42000000, end 42042fff
Working FDT set to 42000000
[02.429]can`t not get hyper image base in /chosen/hyper
[02.433]Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 5.10.198 (xulu@mylinux) (arm-linux-gnueabihf-gcc (GCC) 11.3.1 20220604 [releases/gcc-11 revision 591c0f4b92548e3ae2e8173f4f93984b1c7f62bb], GNU ld (Linaro_Binutils-2022.06) 2.37.20220122) #6 SMP PREEMPT Thu Aug 6 15:25:29 CST 2026
[    0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=10c5387d
[    0.000000] CPU: div instructions available: patching division code
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] OF: fdt: Machine model: sun8iw22
[    0.000000] printk: bootconsole [earlycon0] enabled
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] Reserved memory: created DMA memory pool at 0x42100000, size 0 MiB
[    0.000000] OF: reserved mem: initialized node vdev0buffer@42100000, compatible id shared-dma-pool
[    0.000000] Reserved memory: created DMA memory pool at 0x42144000, size 0 MiB
[    0.000000] OF: reserved mem: initialized node e907_rpbuf@42144000, compatible id shared-dma-pool
[    0.000000] cma: Reserved 24 MiB at 0x4e800000
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000040000000-0x000000004fffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000040000000-0x00000000420fffff]
[    0.000000]   node   0: [mem 0x0000000042100000-0x00000000424c4fff]
[    0.000000]   node   0: [mem 0x00000000424c5000-0x000000004fffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000040000000-0x000000004fffffff]
[    0.000000] On node 0 totalpages: 65536
[    0.000000]   Normal zone: 512 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 65536 pages, LIFO batch:15
[    0.000000] psci: probing for conduit method from DT.
[    0.000000] psci: PSCIv1.0 detected in firmware.
[    0.000000] psci: Using standard PSCI v0.2 function IDs
[    0.000000] psci: MIGRATE_INFO_TYPE not supported.
[    0.000000] psci: SMC Calling Convention v1.0
[    0.000000] percpu: Embedded 15 pages/cpu s30156 r8192 d23092 u61440
[    0.000000] pcpu-alloc: s30156 r8192 d23092 u61440 alloc=15*4096
[    0.000000] pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 65024
[    0.000000] Kernel command line: earlyprintk=sunxi-uart,0x02600000 clk_ignore_unused initcall_debug=0 console=ttyAS0,115200 loglevel=8 root=/dev/mtdblock4 rootwait init=/init partitions=boot-resource@mtdblock1:env@mtdblock2:boot@mtdblock3:rootfs@mtdblock4:private@mtdblock5:rootfs_data@mtdblock6:UDISK@mtdblock7 cma=24M snum= coherent_pool=16K ion_carveout_list= boot_type=3 gpt=1 uboot_message=2023.04-rc4 mbr_offset=2080768
[    0.000000] Dentry cache hash table entries: 32768 (order: 5, 131072 bytes, linear)
[    0.000000] Inode-cache hash table entries: 16384 (order: 4, 65536 bytes, linear)
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 201196K/262144K available (7168K kernel code, 1674K rwdata, 2572K rodata, 1024K init, 245K bss, 36372K reserved, 24576K cma-reserved)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] rcu: Preemptible hierarchical RCU implementation.
[    0.000000] rcu:     RCU event tracing is enabled.
[    0.000000]  Trampoline variant of Tasks RCU enabled.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000000] AW BSP version: 4b15cb14e7, 2025-11-27 13:57:40 +0800
[    0.000000] sunxi:ccu-ng:[INFO]: ccu: sunxi ccu init OK
[    0.000000] sunxi:ccu-ng:[INFO]: sunxi ccu common driver version: 1.2.6
[    0.000000] arch_timer: cp15 timer(s) running at 24.00MHz (virt).
[    0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x588fe9dc0, max_idle_ns: 440795202592 ns
[    0.000007] sched_clock: 56 bits at 24MHz, resolution 41ns, wraps every 4398046511097ns
[    0.007973] Switching to timer-based delay loop, resolution 41ns
[    0.014363] sunxi:hstimer:[INFO]: sun50i timer init:0x7, driver version: 1.1.6
[    0.021149] clocksource: timer0: mask: 0xffffffffffffff max_cycles: 0x588fe9dc0, max_idle_ns: 440795202592 ns
[    0.032019] Calibrating delay loop (skipped), value calculated using timer frequency.. 48.00 BogoMIPS (lpj=240000)
[    0.041335] CPU: Testing write buffer coherency: ok
[    0.046208] pid_max: default: 32768 minimum: 301
[    0.050898] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.058079] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.066665] /cpus/cpu@0 missing clock-frequency property
[    0.071109] /cpus/cpu@1 missing clock-frequency property
[    0.076361] /cpus/cpu@2 missing clock-frequency property
[    0.081662] /cpus/cpu@3 missing clock-frequency property
[    0.086926] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[    0.093283] Setting up static identity map for 0x40100000 - 0x40100060
[    0.099191] rcu: Hierarchical SRCU implementation.
[    0.104748] smp: Bringing up secondary CPUs ...
[    0.109521] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
[    0.110819] CPU2: thread -1, cpu 2, socket 0, mpidr 80000002
[    0.112052] CPU3: thread -1, cpu 3, socket 0, mpidr 80000003
[    0.112167] smp: Brought up 1 node, 4 CPUs
[    0.129325] SMP: Total of 4 processors activated (192.00 BogoMIPS).
[    0.135556] CPU: All CPU(s) started in SVC mode.
[    0.140598] devtmpfs: initialized
[    0.164518] VFP support v0.3: implementor 41 architecture 2 part 30 variant 7 rev 5
[    0.166768] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.176373] futex hash table entries: 1024 (order: 4, 65536 bytes, linear)
[    0.184200] pinctrl core: initialized pinctrl subsystem
[    0.189901] NET: Registered protocol family 16
[    0.194090] DMA: preallocated 16 KiB pool for atomic coherent allocations
[    0.200500] thermal_sys: Registered thermal governor 'fair_share'
[    0.200508] thermal_sys: Registered thermal governor 'bang_bang'
[    0.205697] thermal_sys: Registered thermal governor 'step_wise'
[    0.211630] thermal_sys: Registered thermal governor 'user_space'
[    0.242327] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.255478] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.262538] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.269598] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.276658] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.283717] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.290777] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.297837] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.304896] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.311956] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.319016] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.326084] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.333144] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.340206] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.347266] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.354325] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.361386] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.368446] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.375505] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.382565] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.389625] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.396693] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.403753] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.410812] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.417872] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.424931] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.431991] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.439051] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.446110] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.453170] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.460230] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.467299] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.474359] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.481419] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.488479] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.495538] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.502598] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.509658] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.516717] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.523777] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.530837] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.537905] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.544965] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.552025] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.559084] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.566143] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.573203] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.580263] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.587323] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.594382] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.601442] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.608510] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.615570] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.622629] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.629689] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.636748] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.643808] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.650868] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.657927] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.664987] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.672047] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.679115] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.686174] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.693234] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.700294] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.707354] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.714414] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.721473] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.728533] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.735593] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.742652] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.749721] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.756781] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.763841] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.770900] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.777960] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.785020] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.792079] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.799138] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.806198] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.813258] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.820332] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.827392] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.834452] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.841512] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.848571] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.855631] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.862690] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.869750] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.876810] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.883869] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.890937] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.897997] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.905057] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.912117] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.919176] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.926237] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.933296] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.940356] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.947416] sunxi:ccu-nglosc not stable, 32K clk will use 16M as parent!
[    0.948788] sunxi:ccu-ng:[INFO]: rtc_ccu: sunxi ccu init OK
[    0.954605] sunxi:ccu-ng:[INFO]: cpupll_ccu: sunxi ccu init OK
[    0.959871] sunxi:ccu-ng:[INFO]: sunxi cpupll driver version: 0.0.1
[    0.966414] sunxi:ccu-ng:[INFO]: r_ccu: sunxi ccu init OK
[    0.971718] sunxi:ccu-ng:[INFO]: drampll_ccu: sunxi ccu init OK
[    0.977341] sun8iw22-pll-dram 3130000.drampll_ccu: sunxi:ccu-ngsun8iw22 pll clk init OK
[    1.005333] SCSI subsystem initialized
[    1.005645] usbcore: registered new interface driver usbfs
[    1.008960] usbcore: registered new interface driver hub
[    1.014242] usbcore: registered new device driver usb
[    1.019357] mc: Linux media interface: v0.10
[    1.023618] videodev: Linux video capture interface: v2.00
[    1.028985] pps_core: LinuxPPS API ver. 1 registered
[    1.033926] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    1.042993] PTP clock support registered
[    1.047182] Advanced Linux Sound Architecture Driver Initialized.
[    1.058464] sun6i-dma 3001000.dma-controller: sunxi:dmasunxi dma probed, driver version: 1.2.15
[    1.063052] sunxi:pwmcs-20a0000.pwmcs0:[INFO]: start probe
[    1.063092] sunxi:pwmcs-20a0000.pwmcs0:[INFO]: chip->pwmcs_num:0
[    1.073088] sunxi:pwmcs-20a0000.pwmcs0:[ERR]: base is 0, num is 8
[    1.079667] sunxi:pwmcs-20a0000.pwmcs0:[INFO]: pwmcschip probe success
[    1.086017] sunxi:pwmcs-20b0000.pwmcs1:[INFO]: start probe
[    1.086052] sunxi:pwmcs-20b0000.pwmcs1:[INFO]: chip->pwmcs_num:1
[    1.097115] sunxi:pwmcs-20b0000.pwmcs1:[ERR]: base is 8, num is 8
[    1.103578] sunxi:pwmcs-20b0000.pwmcs1:[INFO]: pwmcschip probe success
[    1.110096] sunxi:pwm-20c0000.pwm2:[INFO]: start probe
[    1.110139] sunxi:pwm-20c0000.pwm2:[WARN]: invalid PWM alias format: pwmcs0
[    1.121673] sunxi:pwm-20c0000.pwm2:[WARN]: invalid PWM alias format: pwmcs1
[    1.129222] sunxi:pwm-20c0000.pwm2:[INFO]: pwmchip probe success
[    1.134889] clocksource: Switched to clocksource arch_sys_counter
[    1.153444] sunxi:pin-3604000.pinctrl:[INFO]: pinctrl withstand voltage config mode=auto_hard
[    1.156379] sunxi:pin:[INFO]: sunxi pinctrl core driver version: 1.4.19
[    1.164775] sunxi:pin-7096500.pinctrl:[INFO]: pinctrl withstand voltage config mode=auto_hard
[    1.171921] NET: Registered protocol family 2
[    1.175979] IP idents hash table entries: 4096 (order: 3, 32768 bytes, linear)
[    1.183863] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 6144 bytes, linear)
[    1.191335] TCP established hash table entries: 2048 (order: 1, 8192 bytes, linear)
[    1.198927] TCP bind hash table entries: 2048 (order: 2, 16384 bytes, linear)
[    1.206200] TCP: Hash tables configured (established 2048 bind 2048)
[    1.212417] UDP hash table entries: 256 (order: 1, 8192 bytes, linear)
[    1.218884] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes, linear)
[    1.225942] NET: Registered protocol family 1
[    1.231343] workingset: timestamp_bits=30 max_order=16 bucket_order=0
[    1.240718] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    1.242311] ntfs: driver 2.1.32 [Flags: R/W].
[    1.246994] jffs2: version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
[    1.253253] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 245)
[    1.260106] io scheduler mq-deadline registered
[    1.264582] io scheduler kyber registered
[    1.277587] scsi host0: scsi_debug: version 0190 [20200710]
[    1.277587]   dev_size_mb=8, opts=0x0, submit_queues=1, statistics=0
[    1.284501] scsi 0:0:0:0: Direct-Access     Linux    scsi_debug       0190 PQ: 0 ANSI: 7
[    1.292546] sd 0:0:0:0: Power-on or device reset occurred
[    1.298676] CAN device driver interface
[    1.301777] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    1.307745] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    1.314040] usbcore: registered new interface driver uas
[    1.319284] sd 0:0:0:0: [sda] 16384 512-byte logical blocks: (8.39 MB/8.00 MiB)
[    1.326460] usbcore: registered new interface driver usb-storage
[    1.332340] usbcore: registered new interface driver ums-alauda
[    1.336429] sd 0:0:0:0: [sda] Write Protect is off
[    1.338245] usbcore: registered new interface driver ums-cypress
[    1.342970] sd 0:0:0:0: [sda] Mode Sense: 73 00 10 08
[    1.348991] usbcore: registered new interface driver ums-datafab
[    1.359997] usbcore: registered new interface driver ums_eneub6250
[    1.366149] usbcore: registered new interface driver ums-freecom
[    1.372114] usbcore: registered new interface driver ums-isd200
[    1.374074] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, supports DPO and FUA
[    1.378022] usbcore: registered new interface driver ums-jumpshot
[    1.392571] usbcore: registered new interface driver ums-karma
[    1.398407] usbcore: registered new interface driver ums-realtek
[    1.404355] usbcore: registered new interface driver ums-sddr09
[    1.410261] usbcore: registered new interface driver ums-sddr55
[    1.416156] usbcore: registered new interface driver ums-usbat
[    1.416613] sd 0:0:0:0: [sda] Optimal transfer size 524288 bytes
[    1.422207] i2c /dev entries driver
[    1.431477] usbcore: registered new interface driver uvcvideo
[    1.437109] USB Video Class driver (1.1.1)
[    1.441365] sunxi:pin-3604000.pinctrl:[INFO]: Auto power withstand voltage configuration detected, automatically exit!
[    1.452222] ledtrig-cpu: registered to indicate activity on CPUs
[    1.457985] usbcore: registered new interface driver usbhid
[    1.463346] usbhid: USB HID core driver
[    1.467224] optee: probing for conduit method.
[    1.471596] optee: revision 3.7 (807754be)
[    1.472149] optee: initialized driver
[    1.480329] uart-ng uart-ng0: supply uart not found, using dummy regulator
[    1.486353] sunxi:uart-ng-uart-ng0:[INFO]: cannot get the TX DMA channel!
[    1.492905] sunxi:uart-ng-uart-ng0:[INFO]: cannot get the RX DMA channel!
[    1.499730] sunxi:uart-ng:[INFO]: sunxi uart-ng driver version: 1.1.21
[    1.506207] uart-ng0: ttyAS0 at MMIO 0x2600000 (irq = 46, base_baud = 1500000) is a SUNXI
[    1.514326] sunxi:uart-ng-uart-ng0:[INFO]: console setup baud 115200 parity n bits 8, flow n
[    1.522834] printk: console [ttyAS0] enabled
[    1.522834] printk: console [ttyAS0] enabled
[    1.533195] printk: bootconsole [earlycon0] disabled
[    1.533195] printk: bootconsole [earlycon0] disabled
[    1.543841] sunxi:rtc:[INFO]:  Saving SoC boot-reason: OTHERS
[    1.554389] sunxi:rtc:[INFO]:  Saving SoC boot-reason: HARDREST-BOOT
[    1.561637] sunxi:rtc-7090000.rtc:[WARN]: Warning: Using internal RC 16M clock source. Time may be inaccurate!
[    1.572976] sunxi:rtc-7090000.rtc:[WARN]: Warning: Using internal RC 16M clock source. Time may be inaccurate!
[    1.584227] sunxi:rtc-7090000.rtc:[WARN]: Warning: Using internal RC 16M clock source. Time may be inaccurate!
[    1.595759] sunxi-rtc 7090000.rtc: registered as rtc0
[    1.601425] sunxi:rtc-7090000.rtc:[WARN]: Warning: Using internal RC 16M clock source. Time may be inaccurate!
[    1.612697] sunxi-rtc 7090000.rtc: setting system clock to 1970-01-01T00:03:37 UTC (217)
[    1.614030] sd 0:0:0:0: [sda] Attached SCSI disk
[    1.621793] sunxi:rtc-7090000.rtc:[INFO]: sunxi rtc probed
[    1.634104] sunxi-wdt 2050000.watchdog: Watchdog enabled (timeout=16 sec, nowayout=0), driver version: 1.0.4
[    1.646295] sunxi:sunxi_spif-2800000.spif:[INFO]: sample_mode:0 sample_delay:1f
[    1.654914] sunxi:sunxi_spif-2800000.spif:[INFO]: [spi-flash0] mclk 25000000
[    1.664478] sunxi:sunxi_spif-2800000.spif:[INFO]: [spi-flash0] working clk 80000000
[    1.674092] sunxi_spif 2800000.spif: w25q128 (16384 Kbytes)
[    1.682065] 8 sunxipart partitions found on MTD device spif
[    1.688330] Creating 8 MTD partitions on "spif":
[    1.693509] 0x000000000000-0x000000200000 : "uboot"
[    1.705812] 0x000000200000-0x000000220000 : "boot-resource"
[    1.715786] 0x000000220000-0x000000240000 : "env"
[    1.725759] 0x000000240000-0x0000007e0000 : "boot"
[    1.735748] 0x0000007e0000-0x000001070000 : "rootfs"
[    1.741320] mtd: partition "rootfs" extends beyond the end of device "spif" -- size truncated to 0x820000
[    1.755729] 0x000001070000-0x000001080000 : "private"
[    1.761395] mtd: partition "private" is out of reach -- disabled
[    1.775746] 0x000001080000-0x000001100000 : "rootfs_data"
[    1.781802] mtd: partition "rootfs_data" is out of reach -- disabled
[    1.795719] 0x000001100000-0x0000011fc000 : "UDISK"
[    1.801188] mtd: partition "UDISK" is out of reach -- disabled
[    1.815740] sunxi:sunxi_spif-2800000.spif:[INFO]: probe succeed (Version 2.0.0)
[    1.824840] sunxi:g2d_sunxi:[INFO]: [G2D]: current_thread_id=0
[    1.831513] sunxi:g2d_sunxi:[INFO]: [G2D]: rcq version initialized.major:242
[    1.839432] sunxi:g2d_sunxi:[INFO]: [G2D]: g2d_module_init
[    1.845593] [drm] [DSI-PANEL] panel_dsi_init start
[    1.851097] [drm] [DSI-PANEL] dsi driver regsiter finsh
[    1.857666] [drm] [PHY] sunxi_dsi_combophy_probe start
[    1.863790] [drm] [PHY]sunxi_dsi_combophy_probe finish
[    1.870328] [drm] sunxi_drm_platform_probe start
[    1.875533] [drm] sunxi_drm_match_add start
[    1.881185] [drm] sunxi_drm_match_add finish
[    1.886021] [drm] sunxi_drm_bind start
[    1.890567] sunxi-drm soc@3000000:sunxi-drm: bound 5507000.phy (ops sunxi_cphy_component_ops)
[    1.900160] [drm:sunxi_drm_bind] *ERROR* connector conut zero
[    1.906615] [drm:sunxi_drm_bind] *ERROR* setup bootloader connecting failed.Skip commit_init_connecting.
[    1.917546] [drm] Initialized sunxi-drm 3.0.0 20230901 for soc@3000000:sunxi-drm on minor 0
[    1.926946] [drm] sunxi_drm_bind ok
[    1.931900] awphy u2-phy0: init awphy sysfs for u2-phy0, ret: 0
[    1.938671] awphy u2-phy1: init awphy sysfs for u2-phy1, ret: 0
[    1.945339] sunxi-plat-awphy 4100000.phy: Allwinner USB2.0 PHY Version v1.0.0
[    1.953449] sunxi:gpadc:[INFO]: sunxi_gpadc_init(): 2349: gpadc class register success
[    1.963260] input: sunxi-rtp as /devices/platform/soc@3000000/208c000.rtp/input/input0
[    1.972739] sunxi_dram_info module loaded
[    1.979232] vdd_cpu: supplied by regulator-dummy
[    1.985055] sunxi:sunxi_sid:[ERR]: Fail to read 'dvfs2_ori' in dts
[    1.993420] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    2.003451] cpu cpu0: _opp_add: OPP not supported by regulators (1056000000)
[    2.011613] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    2.021604] cpu cpu0: _opp_add: OPP not supported by regulators (1152000000)
[    2.029771] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    2.039759] cpu cpu0: _opp_add: OPP not supported by regulators (1248000000)
[    2.047907] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    2.057901] cpu cpu0: _opp_add: OPP not supported by regulators (1368000000)
[    2.066048] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    2.076035] cpu cpu0: _opp_add: OPP not supported by regulators (1464000000)
[    2.084060] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    2.094049] cpu cpu0: _opp_add: OPP not supported by regulators (1512000000)
[    2.102089] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    2.112054] cpu cpu0: _opp_add: OPP not supported by regulators (1560000000)
[    2.120128] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    2.130092] cpu cpu0: _opp_add: OPP not supported by regulators (1608000000)
[    2.138151] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    2.148116] cpu cpu0: _opp_add: OPP not supported by regulators (1704000000)
[    2.156162] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    2.166124] cpu cpu0: _opp_add: OPP not supported by regulators (1752000000)
[    2.174235] sunxi:pwmcs-20a0000.pwmcs0:[ERR]: can't parse pwm device
[    2.181441] sunxi:pwmcs-20a0000.pwmcs0:[ERR]: can't parse pwm device
[    2.188586] cpu cpu0: _set_opp_voltage: failed to set voltage (1100000 1100000 1100000 mV): -19
[    2.198402] sunxi:pwmcs-20a0000.pwmcs0:[ERR]: can't parse pwm device
[    2.205565] sunxi:pwmcs-20a0000.pwmcs0:[ERR]: can't parse pwm device
[    2.212691] cpu cpu0: _set_opp_voltage: failed to set voltage (900000 900000 900000 mV): -19
[    2.222186] cpufreq: __target_index: Failed to change cpu frequency: -19
[    2.229797] sunxi:pwmcs-20a0000.pwmcs0:[ERR]: can't parse pwm device
[    2.236984] sunxi:pwmcs-20a0000.pwmcs0:[ERR]: can't parse pwm device
[    2.237342] ATF no support L3 cache partition, please check or update
[    2.244114] cpu cpu0: _set_opp_voltage: failed to set voltage (1100000 1100000 1100000 mV): -19
[    2.252018] NET: Registered protocol family 10
[    2.261146] sunxi:pwmcs-20a0000.pwmcs0:[ERR]: can't parse pwm device
[    2.267252] Segment Routing with IPv6
[    2.273244] sunxi:pwmcs-20a0000.pwmcs0:[ERR]: can't parse pwm device
[    2.277411] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[    2.284454] cpu cpu0: _set_opp_voltage: failed to set voltage (900000 900000 900000 mV): -19
[    2.291633] NET: Registered protocol family 17
[    2.300560] cpufreq: __target_index: Failed to change cpu frequency: -19
[    2.313123] NET: Registered protocol family 15
[    2.318125] can: controller area network core
[    2.323113] NET: Registered protocol family 29
[    2.328116] can: raw protocol
[    2.331443] can: broadcast manager protocol
[    2.336171] can: netlink gateway - max_hops=1
[    2.341229] Registering SWP/SWPB emulation handler
[    2.370932] sunxi:sound-common:[WARN]: 326 pacfg_level_trig_init(): pa-pin-msleep1-0 get failed, default 0
[    2.382107] sunxi:sound-aa:[WARN]: 110 sunxi_aaudio_parse_dma_param(): capture-cma missing, using default value
[    2.393447] sunxi:sound-aa:[WARN]: 132 sunxi_aaudio_parse_dma_param(): rx-fifo-size miss,using default value
[    2.404476] sunxi:sound-aa:[WARN]: 166 sunxi_aaudio_parse_dma_param(): adc-txdata miss, no aaudio platform
[    2.416259] sunxi:sound-mach:[WARN]: 372 asoc_simple_parse_ucfmt(): set data late to default
[    2.426166] debugfs: Directory 'soc@3000000:codec_plat' with parent 'audiocodec' already present!
[    2.438044] sunxi-ehci 4300000.ehci1-controller: supply hci not found, using dummy regulator
[    2.447762] sunxi-ehci 4300000.ehci1-controller: EHCI Host Controller
[    2.455020] sunxi-ehci 4300000.ehci1-controller: new USB bus registered, assigned bus number 1
[    2.464954] sunxi-ehci 4300000.ehci1-controller: irq 55, io mem 0x04300000
[    2.494913] sunxi-ehci 4300000.ehci1-controller: USB 2.0 started, EHCI 1.00
[    2.502895] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.10
[    2.512185] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    2.520292] usb usb1: Product: EHCI Host Controller
[    2.525771] usb usb1: Manufacturer: Linux 5.10.198 ehci_hcd
[    2.532016] usb usb1: SerialNumber: sunxi-ehci
[    2.537512] hub 1-0:1.0: USB hub found
[    2.541745] hub 1-0:1.0: 1 port detected
[    2.548059] sunxi-ohci 4300400.ohci1-controller: supply hci not found, using dummy regulator
[    2.557731] sunxi-ohci 4300400.ohci1-controller: OHCI Host Controller
[    2.564988] sunxi-ohci 4300400.ohci1-controller: new USB bus registered, assigned bus number 2
[    2.574858] sunxi-ohci 4300400.ohci1-controller: irq 56, io mem 0x04300400
[    2.649062] usb usb2: New USB device found, idVendor=1d6b, idProduct=0001, bcdDevice= 5.10
[    2.658346] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    2.666456] usb usb2: Product: OHCI Host Controller
[    2.671922] usb usb2: Manufacturer: Linux 5.10.198 ohci_hcd
[    2.678176] usb usb2: SerialNumber: sunxi-ohci
[    2.683617] hub 2-0:1.0: USB hub found
[    2.687866] hub 2-0:1.0: 1 port detected
[    2.693894] sunxi_usb_udc 4200000.udc-controller: sunxi:sunxi_usb_udc UDC Inner DMA Feature - wordaddr: 1, extend: enabled
[    2.706888] clk: Not disabling unused clocks
[    2.711682] ALSA device list:
[    2.715024]   #0: audiocodec
[    2.720971] VFS: Mounted root (squashfs filesystem) readonly on device 31:4.
[    2.730289] Freeing unused kernel memory: 1024K
[    2.775088] Run /init as init process
[    2.779192]   with arguments:
[    2.782513]     /init
[    2.785073]   with environment:
[    2.788589]     HOME=/
[    2.791228]     TERM=linux
[    2.794257]     partitions=boot-resource@mtdblock1:env@mtdblock2:boot@mtdblock3:rootfs@mtdblock4:private@mtdblock5:rootfs_data@mtdblock6:UDISK@mtdblock7
[    2.809566]     snum=
[    2.812108]     ion_carveout_list=
[    2.815928]     boot_type=3
[    2.819055]     uboot_message=2023.04-rc4
Starting syslogd: OK
Starting klogd: OK
Running sysctl: OK
Populating /dev using udev: [    4.002683] udevd[96]: starting version 3.2.11
[    4.035760] random: udevd: uninitialized urandom read (16 bytes read)
[    4.043239] random: udevd: uninitialized urandom read (16 bytes read)
[    4.050629] random: udevd: uninitialized urandom read (16 bytes read)
[    4.102917] udevd[96]: specified group 'input' unknown
[    4.109743] udevd[96]: specified group 'kvm' unknown
[    4.145298] udevd[97]: starting eudev-3.2.11
done
/etc/init.d/S20mdev: line 6: /proc/sys/kernel/hotplug: No such file or directory
create /dev/sda
mkdir: can't create directory '/mnt/usb/': Read-only file system
mount: mounting /dev/sda on /mnt/usb/sda failed: No such file or directory
/etc/mdev/do_mount: line 4: mount.ntfs-3g: command not found
mkdir /mnt/usb/sda
mkdir: can't create directory '/mnt/usb/sda': No such file or directory
/etc/mdev/do_mount: line 11: mount.exfat: command not found
mount: mounting /dev/sda on /mnt/usb/sda failed: No such file or directory
Saving random seed: SKIP (read-only file system detected)
usb0 current mode:
Starting adb: mkdir: can't create directory '/system/': Read-only file system
mkdir: can't create directory '/system/': Read-only file system
ln: /system/bin/sh: No such file or directory
[    5.902097] file system registered
OK
init adb main
[    5.945276] read descriptors
Handling main()
[    5.949199] read strings
/etc/init.d/S50powerkey_display: line 12: powerkey_display: command not found
/etc/init.d/S50powerkey_suspend: line 12: powerkey_suspend: command not found
Starting telnetd: OK
[    6.064532] blk_update_request: I/O error, dev mtdblock7, sector 0 op 0x0:(READ) flags 0x800 phys_seg 1 prio class 0
[    6.076416] SQUASHFS error: Failed to read block 0x0: -5
[    6.082378] unable to read squashfs_super_block
formating  /dev/by-name/UDISK to jffs2...
/etc/partition_op.sh: line 34: mkfs.jffs2: command not found
dd: can't open '/tmp/jffs2.img': No such file or directory
[    6.176455] Too few erase blocks (0)
mount: mounting /dev/by-name/UDISK on /mnt/UDISK failed: Invalid argument
[    6.285040] sunxi_usb_udc 4200000.udc-controller: supply udc not found, using dummy regulator

Welcome to Allwinner Tina5.0 Platform
Tina5.0 login: root
#
#
#
#
#

异常烧录日志:

[736]fes begin commit:{0a84c8b0}
[740][pmu]: bus read error
[743]set pll start
[744]set pll end
[746]dram para13 invalid use default para
[750]vaild para:1  select dram para0
[753]ic board init ok
[755]beign to init dram
[757]DRAM BOOT DRIVE INFO: V0.21
[760]DRAM use external ZQ
[930][AUTO DEBUG] 16bit, 1 rank training success
[991][AUTO DEBUG] row = 14, col = 10, bank = 3, bg = 0
[996][AUTO DEBUG] para1 = 0x30ea, para2 = 0x1, tpr13 = 0x8207071
[1002][SOFT TRAINING] Version: T2.5
[1005]Soft Training Version: T2.5
[1008][SOFT TRAINING] Dram Soft Training Loop1
[1247][SOFT TRAINING] Stable test, dram_clk=480,dram_tpr12=0x13131313,memtest pass
[1281][SOFT TRAINING] Start rdq vref training
[3373][SOFT TRAINING]  Highest r vref: 0x4-0x78, high=0x76(766mV), delay=31
[3380][SOFT TRAINING]  Max Vref=0x3e, Widest vref is 0x24~0x5c, center=0x40
[3387][SOFT TRAINING] After rdq00 vref training, dram_add[16] = 0x40404040
[3393][SOFT TRAINING] Start rdq vref training
[4289][SOFT TRAINING]  Highest r vref: 0x4-0x7a, high=0x78(779mV), delay=29
[4295][SOFT TRAINING]  Max Vref=0x38, Widest vref is 0x24~0x58, center=0x3e
[4302][SOFT TRAINING] After rdq01 vref training, dram_add[16] = 0x40403e40
[4309][SOFT TRAINING] Start rdq 1st training
[4328][SOFT TRAINING]  Dbyte0 rdq 1st dqs_move:0,range: 0x10~0x23,width=20,center=0x19
[4385][SOFT TRAINING]  Dbyte1 rdq 1st dqs_move:0,range: 0xc~0x23,width=24,center=0x17
[4393][SOFT TRAINING] After rdq 1st training, dram_tpr12 = 0x00001719
[4399][SOFT TRAINING] Start wdq vref training
[5872][SOFT TRAINING]  Highest w vref: 0x4-0x7c, high=0x7c(1469mV), delay=148
[5879][SOFT TRAINING]  Max vref=0x10, Widest vref is 0x4~0x20, center=0x12
[5886][SOFT TRAINING] After wdq vref training, para->dram_add[17] = 0x92
[5907][SOFT TRAINING] Start wdq 1st training
[5933][SOFT TRAINING]  Dbyte0 wdq dqs_move:0,range: 0x88~0xa1,width=26,center=0x94
[5968][SOFT TRAINING]  Dbyte1 wdq dqs_move:0,range: 0x8c~0xa1,width=22,center=0x96
[5976][SOFT TRAINING] After wdq 1st training, dram_tpr11 = 0x00009694
[5982][SOFT TRAINING] Start rdq 2nd training
[6535][SOFT TRAINING] After rdq 2nd training, dram_tpr12 = 0x00001719
[6541][SOFT TRAINING] After rdq 3th training, dram_tpr12 = 0x00001719
[6548][SOFT TRAINING] Start wdq 2nd training
[7145][SOFT TRAINING] After wdq 2nd training, dram_tpr11 = 0x00009694
[7151][SOFT TRAINING] After wdq 3th training, dram_tpr11 = 0x00009694
[7157][SOFT TRAINING] dram_add[16]=0x40403e40,tpr11=0x00009694,tpr12=0x00001719
[7190][SOFT TRAINING] CLK=933M Stable memtest pass
[7195]DRAM CLK = 933 MHz
[7197]DRAM Type = 3 (3:DDR3,4:DDR4)
[7227]DRAM SIZE = 256 MBytes, para1 = 30ea, para2 = 1000001, dram_tpr13 = 8207071
[7236]DRAM simple test OK.
[7238]rtc[7] value = 0x6
[7241]init dram ok
[11.118]ns16550_serial serial@2600000: pinctrl_select_state_full: uclass_get_device_by_phandle_id: err=-19

U-Boot 2023.04-rc4 (Aug 06 2026 - 15:20:32 +0800) Allwinner Technology
U-Boot bsp (Aug 06 2026 - 15:20:32 +0800) Allwinner Technology

14/40 CPU:   SUNXI Family
Model: sun8iw22
DRAM:  256 MiB
[11.149]Relocation Offset is: 0c928000
Working FDT set to 4de20310
[11.230]secure enable bit: 0
[11.233]CPU=1008MHz, PLL6=600Mhz, AHB=200Mhz, APB1=100Mhz, MBus=480Mhz
[11.239]workmode = 16,storage type = nand
[11.243][mmc]: mmc driver ver uboot2023:2025-04-02 14:45:00
[11.250][mmc]: get sdc_type fail and use default host:tm4.
[11.256][mmc]: Is not Boot mode!
[11.258][mmc]: SUNXI SDMMC Controller Version:0x50530
[11.266][mmc]: 200 MHz...
[11.268][mmc]: sample: 17 - 147(ps)
[11.272][mmc]: ds: 17 - 147(ps)
[11.274]set_sunxi_flash_curdev...45:cur_sunxi_flash :mmc@04022000.sunxi_flash
[11.287][mmc]: mmc 2 cmd timeout 100 status 100
[11.292][mmc]: smc 2 err, cmd 8,  RTO
[11.295][mmc]: mmc 2 close bus gating and reset
[11.300][mmc]: mmc 2 cmd timeout 100 status 100
[11.304][mmc]: smc 2 err, cmd 55,  RTO
[11.308][mmc]: mmc 2 close bus gating and reset
[11.316][mmc]: mmc 2 cmd timeout 100 status 100
[11.320][mmc]: smc 2 err, cmd 1,  RTO
[11.323][mmc]: mmc 2 close bus gating and reset
[11.328]Card did not respond to voltage select! : -110
[11.333]try emmc fail
[11.334]Invalid bus 0 (err=-19)
[11.337]spinand flash probe error
[11.340]try ubi nand fail
[11.344]sunxi-spif spif@2800000: frequency no in range, use default value 150000000
[11.352]sunxi-spif spif@2800000: sample_mode:aaaaffff sample_delay:aaaaffff
sunxi_get_spif_mode()222 - get dtr_mode_enable fail -13
sunxi_get_spif_mode()231 - get io_mode_enable fail -13
[11.368]sunxi-spif spif@2800000: probe succeed (Version 1.0.0)
[11.374]sunxi-spif spif@2800000: sspi->mode:0x2400  mode:0x0
[11.397]sunxi-spif spif@2800000: spif sspi->speed_hz:50000000
[11.794]sunxi-spif spif@2800000: spif update delay param error
[11.799]sunxi-spif spif@2800000: Sample mode:0 start:0 end:0 sample_delay:0xaaaaffff
SF: Detected w25q128 with page size 256 Bytes, erase size 64 KiB, total 16 MiB
[11.826]sunxi-spif spif@2800000: sunxi_spif_release_bus()
[11.831]set_sunxi_flash_curdev...45:cur_sunxi_flash :spif-nor.sunxi_flash
Core:  164 devices, 26 uclasses, devicetree: separate
WDT:   Not starting watchdog@0x02050000
MMC:   SUNXI SD/MMC: 0
[11.854]Loading Environment from SUNXI_FLASH... [11.858]OK
In:    serial
Out:   serial
Err:   serial
Net:   [11.864]No ethernet found.
Hit any key to stop autoboot:  0
sunxi work mode=0x10
[11.872]request gpio for led failed (-2)
run usb efex
buf queue page size = 65536
usb init ok
set address 0xd
SUNXI_EFEX_ERASE_TAG
erase_flag = 0x12
origin_erase_flag = 0x1
FEX_CMD_fes_verify_status
FEX_CMD_fes_verify last err=0
the 0 mbr table is ok
*************MBR DUMP***************
total mbr part 7

part[0] name      :boot-resource
part[0] classname :DISK
part[0] addrlo    :0x20
part[0] lenlo     :0x100
part[0] user_type :32768
part[0] keydata   :0
part[0] ro        :0

part[1] name      :env
part[1] classname :DISK
part[1] addrlo    :0x120
part[1] lenlo     :0x100
part[1] user_type :32768
part[1] keydata   :0
part[1] ro        :0

part[2] name      :boot
part[2] classname :DISK
part[2] addrlo    :0x220
part[2] lenlo     :0x2d00
part[2] user_type :32768
part[2] keydata   :0
part[2] ro        :0

part[3] name      :rootfs
part[3] classname :DISK
part[3] addrlo    :0x2f20
part[3] lenlo     :0x4480
part[3] user_type :32768
part[3] keydata   :0
part[3] ro        :0

part[4] name      :private
part[4] classname :DISK
part[4] addrlo    :0x73a0
part[4] lenlo     :0x80
part[4] user_type :32768
part[4] keydata   :0
part[4] ro        :0

part[5] name      :rootfs_data
part[5] classname :DISK
part[5] addrlo    :0x7420
part[5] lenlo     :0x400
part[5] user_type :32768
part[5] keydata   :0
part[5] ro        :0

part[6] name      :UDISK
part[6] classname :DISK
part[6] addrlo    :0x7820
part[6] lenlo     :0x0
part[6] user_type :0
part[6] keydata   :0
part[6] ro        :0

need erase flash: 18
[14.843]Item0 (Map) magic is bad
[14.847]erase secure storage: 0 ok
SUNXI_EFEX_MBR_TAG
mbr size = 0x4000
[14.853]logic size : 0x7820 sector(512 byte)
[14.857]flash size : 0x8000 sector(512 byte)
SF: write offset not multiple of erase size
[14.879]write primary GPT success
[14.882]spinor: skip backup GPT
[14.885]update partition map
FEX_CMD_fes_verify_status
FEX_CMD_fes_verify last err=0
FEX_CMD_fes_verify_value, start 0x120, size high 0x0:low 0x20000
FEX_CMD_fes_verify_value 0x6ec2fd82

这个是正常板子的烧录日志:

[837]fes begin commit:{0a84c8b0}
[841][pmu]: bus read error
[844]set pll start
[846]set pll end
[847]dram para13 invalid use default para
[851]vaild para:1  select dram para0
[854]ic board init ok
[857]beign to init dram
[859]DRAM BOOT DRIVE INFO: V0.21
[862]DRAM use external ZQ
[1031][AUTO DEBUG] 16bit, 1 rank training success
[1093][AUTO DEBUG] row = 14, col = 10, bank = 3, bg = 0
[1098][AUTO DEBUG] para1 = 0x30ea, para2 = 0x1, tpr13 = 0x8207071
[1104][SOFT TRAINING] Version: T2.5
[1107]Soft Training Version: T2.5
[1110][SOFT TRAINING] Dram Soft Training Loop1
[1349][SOFT TRAINING] Stable test, dram_clk=480,dram_tpr12=0x13131313,memtest pass
[1383][SOFT TRAINING] Start rdq vref training
[3459][SOFT TRAINING]  Highest r vref: 0x6-0x78, high=0x74(753mV), delay=31
[3466][SOFT TRAINING]  Max Vref=0x40, Widest vref is 0x24~0x62, center=0x43
[3473][SOFT TRAINING] After rdq00 vref training, dram_add[16] = 0x40404043
[3480][SOFT TRAINING] Start rdq vref training
[4331][SOFT TRAINING]  Highest r vref: 0x6-0x78, high=0x74(753mV), delay=29
[4338][SOFT TRAINING]  Max Vref=0x36, Widest vref is 0x2a~0x50, center=0x3d
[4345][SOFT TRAINING] After rdq01 vref training, dram_add[16] = 0x40403d43
[4352][SOFT TRAINING] Start rdq 1st training
[4373][SOFT TRAINING]  Dbyte0 rdq 1st dqs_move:0,range: 0x10~0x25,width=22,center=0x1a
[4427][SOFT TRAINING]  Dbyte1 rdq 1st dqs_move:0,range: 0xe~0x23,width=22,center=0x18
[4434][SOFT TRAINING] After rdq 1st training, dram_tpr12 = 0x0000181a
[4441][SOFT TRAINING] Start wdq vref training
[5876][SOFT TRAINING]  Highest w vref: 0x4-0x7c, high=0x7c(1469mV), delay=148
[5883][SOFT TRAINING]  Max vref=0x8, Widest vref is 0x4~0x24, center=0x14
[5890][SOFT TRAINING] After wdq vref training, para->dram_add[17] = 0x94
[5912][SOFT TRAINING] Start wdq 1st training
[5938][SOFT TRAINING]  Dbyte0 wdq dqs_move:0,range: 0x88~0xa1,width=26,center=0x94
[5968][SOFT TRAINING]  Dbyte1 wdq dqs_move:0,range: 0x8a~0xa1,width=24,center=0x95
[5975][SOFT TRAINING] After wdq 1st training, dram_tpr11 = 0x00009594
[5982][SOFT TRAINING] Start rdq 2nd training
[6535][SOFT TRAINING] After rdq 2nd training, dram_tpr12 = 0x0000181a
[6542][SOFT TRAINING] After rdq 3th training, dram_tpr12 = 0x0000181a
[6548][SOFT TRAINING] Start wdq 2nd training
[7136][SOFT TRAINING] After wdq 2nd training, dram_tpr11 = 0x00009594
[7142][SOFT TRAINING] After wdq 3th training, dram_tpr11 = 0x00009594
[7148][SOFT TRAINING] dram_add[16]=0x40403d43,tpr11=0x00009594,tpr12=0x0000181a
[7182][SOFT TRAINING] CLK=933M Stable memtest pass
[7186]DRAM CLK = 933 MHz
[7189]DRAM Type = 3 (3:DDR3,4:DDR4)
[7219]DRAM SIZE = 256 MBytes, para1 = 30ea, para2 = 1000001, dram_tpr13 = 8207071
[7228]DRAM simple test OK.
[7230]rtc[7] value = 0x1
[7232]init dram ok
[11.095]ns16550_serial serial@2600000: pinctrl_select_state_full: uclass_get_device_by_phandle_id: err=-19


U-Boot 2023.04-rc4 (Aug 06 2026 - 15:20:32 +0800) Allwinner Technology
U-Boot bsp (Aug 06 2026 - 15:20:32 +0800) Allwinner Technology

14/40 CPU:   SUNXI Family
Model: sun8iw22
DRAM:  256 MiB
[11.126]Relocation Offset is: 0c928000
Working FDT set to 4de20310
[11.207]secure enable bit: 0
[11.209]CPU=1008MHz, PLL6=600Mhz, AHB=200Mhz, APB1=100Mhz, MBus=480Mhz
[11.216]workmode = 16,storage type = nand
[11.220][mmc]: mmc driver ver uboot2023:2025-04-02 14:45:00
[11.227][mmc]: get sdc_type fail and use default host:tm4.
[11.232][mmc]: Is not Boot mode!
[11.235][mmc]: SUNXI SDMMC Controller Version:0x50530
[11.243][mmc]: 200 MHz...
[11.245][mmc]: sample: 17 - 147(ps)
[11.248][mmc]: ds: 17 - 147(ps)
[11.251]set_sunxi_flash_curdev...45:cur_sunxi_flash :mmc@04022000.sunxi_flash
[11.264][mmc]: mmc 2 cmd timeout 100 status 100
[11.268][mmc]: smc 2 err, cmd 8,  RTO
[11.272][mmc]: mmc 2 close bus gating and reset
[11.277][mmc]: mmc 2 cmd timeout 100 status 100
[11.281][mmc]: smc 2 err, cmd 55,  RTO
[11.284][mmc]: mmc 2 close bus gating and reset
[11.293][mmc]: mmc 2 cmd timeout 100 status 100
[11.297][mmc]: smc 2 err, cmd 1,  RTO
[11.300][mmc]: mmc 2 close bus gating and reset
[11.305]Card did not respond to voltage select! : -110
[11.309]try emmc fail
[11.311]Invalid bus 0 (err=-19)
[11.314]spinand flash probe error
[11.317]try ubi nand fail
[11.321]sunxi-spif spif@2800000: frequency no in range, use default value 150000000
[11.328]sunxi-spif spif@2800000: sample_mode:aaaaffff sample_delay:aaaaffff
sunxi_get_spif_mode()222 - get dtr_mode_enable fail -13
sunxi_get_spif_mode()231 - get io_mode_enable fail -13
[11.345]sunxi-spif spif@2800000: probe succeed (Version 1.0.0)
[11.350]sunxi-spif spif@2800000: sspi->mode:0x2400  mode:0x0
[11.880]sunxi-spif spif@2800000: spif sspi->speed_hz:50000000
[12.319]sunxi-spif spif@2800000: Sample mode:0 start:0 end:63 sample_delay:0x1f
SF: Detected w25q128 with page size 256 Bytes, erase size 64 KiB, total 16 MiB
[12.991]sunxi-spif spif@2800000: sunxi_spif_release_bus()
[12.996]set_sunxi_flash_curdev...45:cur_sunxi_flash :spif-nor.sunxi_flash
Core:  171 devices, 27 uclasses, devicetree: separate
WDT:   Not starting watchdog@0x02050000
MMC:   SUNXI SD/MMC: 0
[13.020]Loading Environment from SUNXI_FLASH... [13.024]OK
In:    serial
Out:   serial
Err:   serial
Net:   [13.030]No ethernet found.
Hit any key to stop autoboot:  0
sunxi work mode=0x10
[13.038]request gpio for led failed (-2)
run usb efex
buf queue page size = 65536
usb init ok
set address 0x14
SUNXI_EFEX_ERASE_TAG
erase_flag = 0x12
origin_erase_flag = 0x1
FEX_CMD_fes_verify_status
FEX_CMD_fes_verify last err=0
the 0 mbr table is ok
*************MBR DUMP***************
total mbr part 7

part[0] name      :boot-resource
part[0] classname :DISK
part[0] addrlo    :0x20
part[0] lenlo     :0x100
part[0] user_type :32768
part[0] keydata   :0
part[0] ro        :0

part[1] name      :env
part[1] classname :DISK
part[1] addrlo    :0x120
part[1] lenlo     :0x100
part[1] user_type :32768
part[1] keydata   :0
part[1] ro        :0

part[2] name      :boot
part[2] classname :DISK
part[2] addrlo    :0x220
part[2] lenlo     :0x2d00
part[2] user_type :32768
part[2] keydata   :0
part[2] ro        :0

part[3] name      :rootfs
part[3] classname :DISK
part[3] addrlo    :0x2f20
part[3] lenlo     :0x4480
part[3] user_type :32768
part[3] keydata   :0
part[3] ro        :0

part[4] name      :private
part[4] classname :DISK
part[4] addrlo    :0x73a0
part[4] lenlo     :0x80
part[4] user_type :32768
part[4] keydata   :0
part[4] ro        :0

part[5] name      :rootfs_data
part[5] classname :DISK
part[5] addrlo    :0x7420
part[5] lenlo     :0x400
part[5] user_type :32768
part[5] keydata   :0
part[5] ro        :0

part[6] name      :UDISK
part[6] classname :DISK
part[6] addrlo    :0x7820
part[6] lenlo     :0x0
part[6] user_type :0
part[6] keydata   :0
part[6] ro        :0

need erase flash: 18
[16.012]Item0 (Map) magic is bad
[16.015]erase secure storage: 0 ok
SUNXI_EFEX_MBR_TAG
mbr size = 0x4000
[16.021]logic size : 0x7820 sector(512 byte)
[16.025]flash size : 0x8000 sector(512 byte)
SF: write offset not multiple of erase size
[16.302]write primary GPT success
[16.305]spinor: skip backup GPT
[16.308]update partition map
FEX_CMD_fes_verify_status
FEX_CMD_fes_verify last err=0
FEX_CMD_fes_verify_value, start 0x120, size high 0x0:low 0x20000
FEX_CMD_fes_verify_value 0xf29ba354
FEX_CMD_fes_verify_value, start 0x220, size high 0x0:low 0x54d000
FEX_CMD_fes_verify_value 0x8b6d1230
FEX_CMD_fes_verify_value, start 0x2f20, size high 0x0:low 0x503000
FEX_CMD_fes_verify_value 0x1e18c8cc
bootfile_mode=4
SUNXI_EFEX_BOOT1_TAG
boot1 size = 0x1ac000, max size = 0x400000
[17.474]uboot size = 0x1ac000
[17.477]storage type = 3
SF: write offset not multiple of erase size
FEX_CMD_fes_verify_status
FEX_CMD_fes_verify last err=0
bootfile_mode=4
SUNXI_EFEX_BOOT0_TAG
boot0 size = 0x10000
[17.918]storage type = 3
boot_info->frequency:2faf080
FEX_CMD_fes_verify_status
FEX_CMD_fes_verify last err=0
sunxi_efex_next_action=2
exit usb
next work 2
SUNXI_UPDATE_NEXT_ACTION_REBOOT
......

#4 全志 SOC » T153M3-QCX/T153M4-QCX 简易排针开发板 » 2026-09-01 17:45:45

晕哥
回复: 6

T153M3-QCX/T153M4-QCX 简易排针开发板

https://item.taobao.com/item.htm?id=678080633091

就在嘉立创做了20块板,摊薄成本后,接近销售价格了。

#5 Re: 全志 SOC » 淘宝V3s摄像头(防瞌睡? 检测司机打电话?)卡在gc0403驱动,有能力继续研究的朋友送两台拆解,跟帖或者联系微信 whycan_cn » 2026-08-17 22:28:53

v3s_camera_facedetect_20260817A.tar

bash -n uvc_service/adb-uvc.sh
  先确认主机识别到的格式、分辨率和帧率:

  v4l2-ctl -d /dev/video0 --list-formats-ext

  预览 MJPEG:

  ffplay -hide_banner \
    -f v4l2 \
    -input_format mjpeg \
    -video_size 1280x720 \
    -framerate 30 \
    -i /dev/video0

  预览新增的原始 YUYV:

  ffplay -hide_banner \
    -f v4l2 \
    -input_format yuyv422 \
    -video_size 1280x720 \
    -framerate 30 \
    -i /dev/video0

#7 Re: 全志 SOC » 感谢 本站网友 @zhaoshaox 友情赠送的 V3s方案 新开普 F951 门禁机一台 » 2026-08-16 22:23:52

f951_tools_20260816A.tar

通过 调试串口 传输文件:

cd /opt/hardware_hack/v3s_xinkaipu_menjin
  python3 tools/serial_shell_push.py \
    tools/serial_qr_keypad_test.arm \
    /dev/serial_qr_keypad_test
ubuntu@ubuntu-air6:/opt/hardware_hack/v3s_xinkaipu_menjin$   cd /opt/hardware_hack/v3s_xinkaipu_menjin
  python3 tools/serial_shell_push.py \
    tools/serial_qr_keypad_test.arm \
    /dev/serial_qr_keypad_test

sent 2400/5491 compressed bytes
sent 4800/5491 compressed bytes
sent 5491/5491 compressed bytes
pushed 9388 bytes to /dev/serial_qr_keypad_test; gzip CRC and size OK
ubuntu@ubuntu-air6:/opt/hardware_hack/v3s_xinkaipu_menjin$ 

通过串口进入终端:

root@camdroid:/ # 
root@camdroid:/ # 
root@camdroid:/ # /dev/serial_qr_keypad_test --takeover-ccdr --duration 600    
serial_qr_keypad_test starting
[mono 1516.562] TAKEOVER requested: stopping ccdr now
[ 1516.736586] init: service 'ccdr' is being killed
[mono 1516.742] stop ccdr: OK
[ 1516.745430] sunxi_wdt_release: unexpected close, not stopping watchdog!
[ 1516.753142] wdt_set_tmout, write 0x00000031 to mode reg 0xf1c20cb8, actual timeout 3 sec
[ 1516.762383] wdt_enable, write reg 0xf1c20cb8 val 0x00000031
[ 1516.769236] init: waitpid returned pid 249, status = 00000009
[ 1516.775936] init: process 'ccdr', pid 249 exited
[ 1516.781226] wdt_set_tmout, write 0x00000031 to mode reg 0xf1c20cb8, actual timeout 3 sec
[mono 1516.790] watchdog ACTIVE: timeout=3s feed_interval=1000ms fd=3
[mono 1516.790] opened /dev/ttyS1 at 115200 8N1, fd=4
[mono 1516.791] opened /dev/ttyS2 at 115200 8N1, fd=5
[mono 1516.791] READY: keypad + QR capture active; Ctrl-C restores ccdr
[mono 1519.385] KEYPAD frame checksum=OK len=4 HEX=03 01 FE 02 ASCII="\x03\x01\xFE\x02"
[mono 1519.386] KEY event: raw=0xFE name=status/release (FE)
[mono 1521.353] KEYPAD frame checksum=OK len=4 HEX=03 01 34 38 ASCII="\x03\x0148"
[mono 1521.353] KEY event: raw=0x34 name=4
[mono 1522.105] KEYPAD frame checksum=OK len=4 HEX=03 01 37 3B ASCII="\x03\x017;"
[mono 1522.105] KEY event: raw=0x37 name=7

[mono 1556.854] QR raw len=32 HEX=68 74 74 70 73 3A 2F 2F 75 2E 77 65 63 68 61 74 2E 63 6F 6D 2F 4D 41 33 44 68 57 51 39 36 4C 5F ASCII="https://u.wechat.com/MA3DhWQ96L_"
[mono 1556.855] QR raw len=17 HEX=6A 56 34 6E 51 30 62 6F 6E 50 67 4D 3F 73 3D 34 0D ASCII="jV4nQ0bonPgM?s=4\r"
[mono 1556.856] QR frame end=CR len=48 HEX=68 74 74 70 73 3A 2F 2F 75 2E 77 65 63 68 61 74 2E 63 6F 6D 2F 4D 41 33 44 68 57 51 39 36 4C 5F 6A 56 34 6E 51 30 62 6F 6E 50 67 4D 3F 73 3D 34 ASCII="https://u.wechat.com/MA3DhWQ96L_jV4nQ0bonPgM?s=4"

#8 Re: 全志 SOC » 淘宝V3s摄像头(防瞌睡? 检测司机打电话?)卡在gc0403驱动,有能力继续研究的朋友送两台拆解,跟帖或者联系微信 whycan_cn » 2026-08-16 17:53:45

关闭红外LED:
adb shell 'echo 0 > /sys/devices/virtual/misc/irled_dev/irled/enable'

打开红外LED:
adb shell 'echo 1 > /sys/devices/virtual/misc/irled_dev/irled/enable'

#9 Re: 全志 SOC » 感谢 本站网友 @zhaoshaox 友情赠送的 V3s方案 新开普 F951 门禁机一台 » 2026-08-16 12:15:56

最终确认:门禁机面板是 3×4、共 12 键,不是 4×4,也不是 V3s LRADC 五键。

  ### 实体键映射

   面板丝印     下位机原始值    ccdr 分发值    原厂动作
  ━━━━━━━━━━  ━━━━━━━━━━━━━━━  ━━━━━━━━━━━━━  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   0–9         ASCII '0'–'9'           原值    输入数字;动作由当前窗口决定
  ──────────  ───────────────  ─────────────  ──────────────────────────────
   return         'R' / 0x52           0x85    清除、取消或返回
  ──────────  ───────────────  ─────────────  ──────────────────────────────
   OK             'S' / 0x53           0x83    提交或确认

  物理布局:

  1  2  3  return     -> '1' '2' '3' 'R'
  4  5  6  0          -> '4' '5' '6' '0'
  7  8  9  OK         -> '7' '8' '9' 'S'

  除 '1' 外,其余 11 个原始主值均从原厂 ccdr 内存槽直接捕获。'1' 因槽位被快速清零,只捕获到后续 0xfe 状态值;其 0x31 映射由丝印、其余完整排列以及 ccdr 的连续
  ASCII 数字分支共同确认,没有伪称为直接捕获。

  ### 硬件与软件处理链

  3×4 实体键盘
    -> 外部 Cortex-M 下位控制器扫描、消抖
    -> PB8/PB9 UART
    -> V3s uart0 / IRQ 32
    -> /dev/ttyS1
    -> ccdr fd 13
    -> UartGetKeyProc
    -> 广播 key-down 0x10 + key-up 0x12
    -> MainWindowProc
    -> 当前活动窗口的 0x9f4 / keyProc

  实机证据:

  - 第一行 4 键:IRQ 32 从 2 增到 6。
  - 第二行 4 键:IRQ 32 从 6 增到 10。
  - 第三行 4 键:IRQ 32 从 10 增到 14。
  - 第一列 1 → 4 → 7:IRQ 32 从 14 增到 17。
  - 每次实体操作恰好增加一次 UART IRQ。
  - LRADC IRQ 62 全程保持 0。
  - ccdr 的 fd 13 确认指向 /dev/ttyS1。
  - /dev/ttyS1 -> uart.0 -> IRQ 32 -> PB8/PB9。

  因此 /dev/input/event0 的 MENU/MODE/UP/DOWN/OK 五档 LRADC 只是原厂 V3s 的另一套通用输入能力,不是这块 12 键面板的来源。U/V/X/x/0xfe 也是协议或内部状态值,不是
  额外四个实体键。

  ### 原厂界面动作

  主界面:

  - 数字键:追加到当前数字或 ID 输入缓冲区。
  - OK:提交/确认当前输入,再根据状态查询记录或构造协议。
  - return:根据状态清除输入、取消当前流程或返回上一级。

  菜单:

  - 2:向上移动选择。
  - 8:向下移动选择。
  - OK:执行当前选中项。
  - return:退出、取消或返回。

  具体数字键动作仍由当前活动窗口决定,并非所有窗口都完全相同。

  ### 可修改位置

  若后续真正修改按键功能,最小切入点是:

  - 键值重映射:UartGetKeyProc 的 0x205b4..0x20686
  - 所有窗口的统一分发:0x21384 -> 0x21356
  - 主界面动作:0x22d80
  - 菜单 wrapper:0x1d5fc
  - 菜单 2/8 导航:0x1487c
  - 下位控制器扫描/消抖:zhongkong.bin,但具体 3×4 GPIO 编号尚未可靠恢复,不建议直接修改通用 8 路扫描函数

  本轮没有把任何按键补丁写入 SPI NOR。

  ### 文档与设备状态

  已更新:

  - firmware_backup/README.md:76
  - firmware_backup/20260807_20171020_QRDecode/metadata/button-handling.md:1
  - tools/arm_key_mem_poll.S:1

  验证结果:

  - git diff --check 通过。
  - 只读采集器重新汇编为 ARM EABI5 ELF 成功。
  - 原厂整片 SPI NOR 已恢复并逐字节回读校验。
  - 当前仍运行原厂 NCAP1710C、Linux 3.4.39 #801、/data/ccdr。
  - 门禁机 /dev 中的临时采集器和日志已全部删除。
  - Ubuntu 提示音已改为明确绑定内置扬声器节点,后续测试已由你确认能听到。
• ccdr 是门禁机原厂固件里的主业务程序,路径是 /data/ccdr,不是驱动。

  它负责:

  - /dev/ttyS1:读取 3×4 键盘
  - /dev/ttyS2:读取串口二维码头
  - MiniGUI 界面和门禁业务逻辑
  - 喂硬件看门狗

#10 Re: 全志 SOC » 感谢 本站网友 @zhaoshaox 友情赠送的 V3s方案 新开普 F951 门禁机一台 » 2026-08-15 16:18:09

  - 新增 UART 二维码接收程序 app/v3s_qr_uart/src/v3s_qr_uart.c
  - 新增开机服务 build/hooks/S45v3s_qr_uart
  - 最多接收 1024 字节,以 30 ms 串口静默作为一条扫码结果的结束
  - 输出文件:
      - /run/v3s_qr/last.raw
      - /run/v3s_qr/last.txt
      - /run/v3s_qr/sequence
      - /tmp/v3s_qr_uart.log

  - 停止加载无效的 H42、VFE、CCI 驱动栈,避免额外内存占用和 OOM
  - 更新中英文 README,说明真实硬件接口和使用方法
  - 主机 PTY 分包与后台服务协同测试通过
  - ARM 程序交叉编译通过,仅依赖目标系统已有的 libc.so.6

  固件已重新构建、进入 FEL、烧录并校验成功:

  - 镜像:tools/pack/sun8iw8p1_linux_v3s_xinkaipu_menjin_uart0.img
  - 大小:31,768,576 字节
  - SHA-256:ac59213c819285dc7d8274afc56a62125c8abcb23e17bbf677ef2a69d967f3f7
  - 烧录结果:Full raw image verified
  - 所有分区烧录成功并自动重启

  板端冷启动验收:

  - /usr/bin/v3s_qr_uart --quiet 正常运行,PID 142
  - /dev/ttyS2:115200、8N1、raw、无软硬流控
  - sequence=0,等待第一次扫码
  - H42/VFE/CCI 均未加载
  - 没有 /dev/video*,符合该硬件设计
  - LCD 驱动初始化成功
  - 无 OOM、kernel panic 或 undefined instruction
  - 当前空闲内存约 17.6 MiB

  真实扫码时使用:

  adb shell 'v3s_qr_uart --once --timeout-ms 30000'

  或查看后台服务保存的结果:

  adb shell 'cat /run/v3s_qr/last.txt'
  adb shell 'cat /run/v3s_qr/sequence'
  adb pull /run/v3s_qr/last.raw

  这次 45 秒真实扫码窗口内没有二维码进入模组视野,所以 sequence 仍为 0;超时和服务协同路径均正常。下次你在机器旁向模组展示二维码即可完成最后的实际载荷确认。

  Git 已提交并推送:

  - 分支:v3s_xinkaipu_menjin
  - 提交:390e7399d3233ef7a18c5101a5bc43082bc30db7
  - 标题:qr: support the Xinkaipu UART decoder
  - 已回读确认远端分支 SHA 与本地完全一致

  工作树中原有的构建库、日志、LCD/诊断工具都保留未提交,没有混入本次提交。

固件下载:sun8iw8p1_linux_v3s_xinkaipu_menjin_uart0.img

二维码放到摄像头前面:

测试方法:
adb shell 'v3s_qr_uart --once --timeout-ms 30000'

查看结果:
adb shell 'cat /run/v3s_qr/last.txt'

#11 Re: 全志 SOC » F133 eMMC支持 » 2026-08-08 21:44:01

SDC2 可以接 eMMC 用于启动。

#20 Re: 全志 SOC » 感谢 本站网友 @zhaoshaox 友情赠送的 V3s方案 新开普 F951 门禁机一台 » 2026-08-07 21:48:18

Linux系统如何进入 FEL 烧录模式:

V3S(sun8iw8p1)进入 FEL 的 RTC 参数是:

  RTC 寄存器:0x01c20508
  写入数据:  0x5AA5A55A

  在板端串口 shell 中执行:

  echo "0x01c20508 0x5AA5A55A" > /sys/class/misc/sunxi-reg/rw/write
  sync
  reboot

  重启后主机执行:

  sudo openixcli scan
  sudo openixcli flash -V /opt/s3_v3s_r11_sdk_v1.5/tools/pack/sun8iw8p1_linux_v3s_xinkaipu_menjin_uart0.img

  依据:bootloader/u-boot-2011.09/include/configs/sun8iw8p1_nor.h:107、bootloader/u-boot-2011.09/sunxi_spl/boot0/main/boot0_main.c:94、README.md:134。 boot0 检
  测到该值后会清除标志并跳转 FEL。

原理:

利用 V3S RTC 电源域里的通用寄存器作为“下一次启动模式标志”。

  启动流程大致是:

  系统运行
    |
  写入 RTC GP2 = 0x5AA5A55A
    |
  reboot,CPU 复位
    |
  Boot0 读取 RTC GP2
    |
  值匹配魔数
    |
  清除寄存器
    |
  跳转 FEL 入口 0xFFFF0020
    |
  USB 枚举为 FEL,openixcli 可以烧录

  V3S 的寄存器计算为:

  RTC_BASE = 0x01c20400
  GP2      = RTC_BASE + 0x100 + 2 * 4
           = 0x01c20508

  0x5AA5A55A 是 Allwinner boot0 约定的 FEL magic。RTC 通用寄存器在 CPU 复位后仍能保留值,所以 reboot 后 Boot0 可以看到它。Boot0 检测成功后会立即清零,因此这是一
  次性的,不会导致设备每次都进入 FEL。

  相比 reboot efex 写 misc 分区,这种方式在更早的 Boot0 阶段生效,所以通常更可靠。完全断电后寄存器是否保留则取决于具体 RTC 电源和硬件设计。

#21 Re: 全志 SOC » 感谢 本站网友 @zhaoshaox 友情赠送的 V3s方案 新开普 F951 门禁机一台 » 2026-08-07 21:48:13

关于显示屏驱动:

  1. sys_config.fex 直接配置

  firmware_backup/20260807_20171020_QRDecode/metadata/sys_config_runtime.fex:291:

  spin_scl   = PB06
  spin_sdo   = PB03
  spin_sdi   = PB07
  spin_cs    = PB05
  spin_reset = PG04

  2. GPIO 编号换算与内核反汇编一致

  全志 GPIO 每个端口 32 个编号:

  PB05 = 1*32+5 = 37
  PB07 = 1*32+7 = 39
  PB03 = 1*32+3 = 35
  PB06 = 1*32+6 = 38
  PG04 = 6*32+4 = 196

  目标内核的 spi_gpio_request() 中实际出现:

  37   -> LCD_CS
  39   -> LCD_SDI
  35   -> LCD_SDO
  38   -> LCD_SCL
  196  -> reset

  对应内核函数也固定使用这些编号:

  CS()       -> 37
  DIN()      -> 39
  Read32Bit()-> 35
  CLK()      -> 38
  RST()      -> 196

  3. 确实用于 LCD 初始化

  目标内核的 displayinit():

  - 加载字符串 spi_mn_para
  - 调用 spi_gpio_request()
  - 调用 SPI_WriteComm() / SPI_WriteData()
  - 发送面板寄存器初始化命令
  - LCD_panel_init() 和 LCD_bl_open() 都会调用它

  所以最终映射是:

   面板信号    GPIO
  ━━━━━━━━━━  ━━━━━━
   SCL/CLK     PB06
  ──────────  ──────
   SDO/读回    PB03
  ──────────  ──────
   SDI/写入    PB07
  ──────────  ──────
   CS          PB05
  ──────────  ──────
   RESET       PG04

  这里 SDI/SDO 是面板端命名:SoC 写入面板的是 PB07,从面板读回的是 PB03。这只证明固件配置和内核使用关系;PCB 上是否实际连到对应 LCD 管脚,还需要原理图或万用表连
  通性确认。
等价调用链是:

  LCD_panel_init()
      -> displayinit()
          -> SPI_WriteComm() / SPI_WriteData()
              -> WriteByte()
                  -> CS() / CLK() / DIN()

  目标内核地址:

  LCD_panel_init  c015e9e8
  displayinit     c0161360
  WriteByte       c01611a8
  SPI_WriteComm   c0161330
  SPI_WriteData   c0161348

  SPI_WriteComm() 和 SPI_WriteData() 只是传入不同标志位:

  void SPI_WriteComm(u8 value)
  {
      WriteByte(value, 0);    // command
  }

  void SPI_WriteData(u8 value)
  {
      WriteByte(value, 1);    // data
  }

  WriteByte() 的等价伪代码:

  void WriteByte(u8 value, int is_data)
  {
      CLK(1);
      CS(0);
      CLK(0);

      DIN(is_data);             // 第 1 位:命令/数据标志
      CLK(1);
      CLK(0);

      for (int bit = 7; bit >= 0; bit--) {
          CLK(0);
          DIN((value >> bit) & 1);
          CLK(1);
      }

      DIN(1);
      CS(1);
  }

  也就是 GPIO bit-bang 的 9-bit 协议:

  1 个命令/数据标志位 + 8 个 MSB-first 数据位

  LCD_panel_init() 自身不直接调用 SPI_WriteComm(),而是在 c015e9f4 跳转到 displayinit()。LCD_bl_open() 也会在背光打开流程中调用同一个 displayinit()。

  displayinit() 的实际顺序大致是:

  spi_gpio_request()
  RST(1) -> RST(0) -> RST(1)

  SPI_WriteComm(01)
  SPI_WriteComm(11)
  Read32Bit(04, &LCD_ID)

  SPI_WriteComm(36); Data(A8)
  SPI_WriteComm(2A); Data(00 00 01 3F)
  SPI_WriteComm(2B); Data(00 00 00 EF)
  SPI_WriteComm(3A); Data(66)
  SPI_WriteComm(B2); Data(0C 0C 00 33 33)
  SPI_WriteComm(B7); Data(75)
  SPI_WriteComm(BB); Data(2C)
  SPI_WriteComm(C0); Data(2C)
  SPI_WriteComm(C2); Data(01 FF)
  SPI_WriteComm(C3); Data(20)
  SPI_WriteComm(C4); Data(20)
  SPI_WriteComm(C6); Data(0F)
  SPI_WriteComm(D0); Data(A4 A1)
  SPI_WriteComm(E0); 发送正伽马表
  SPI_WriteComm(E1); 发送负伽马表
  SPI_WriteComm(E9); Data(11 11 08)
  SPI_WriteComm(B1); Data(42 05 13)
  SPI_WriteComm(B0); Data(11 F0)
  SPI_WriteComm(21)
  SPI_WriteComm(29)

  spi_gpio_free()

  其中:

  - 0x01:软件复位
  - 0x11:退出睡眠
  - 0x04:读取 LCD ID
  - 0x2A/0x2B:设置窗口
  - 0x3A:像素格式
  - 0x21:显示反色
  - 0x29:开启显示

  Read32Bit() 使用 PB03/SDO 读回 32 位 ID,所以启动日志中的:

  LCD_ID:00000000
  displayinit over

  说明初始化函数确实执行,但本次没有读到有效面板 ID。
• 最像的是 Sitronix ST7789 系列,优先候选:

  1. ST7789V
  2. ST7789V2 / ST7789H2 类兼容型号
  3. 某种 ST7789 兼容克隆芯片

  判断依据是初始化命令族高度吻合:

  0x36       MADCTL
  0x3A       COLMOD
  0x2A/0x2B CASET/RASET
  0xB2       PORCTRL
  0xB7       GCTRL
  0xBB       VCOMS
  0xC0       LCMCTRL
  0xC2/C3/C4 电压设置
  0xC6       帧率控制
  0xD0       电源控制
  0xE0/E1    正负伽马表,各 14 字节

  另外:

  - 0x2A 设置 0..319
  - 0x2B 设置 0..239
  - 0x3A = 0x66 表示 18-bit 像素模式
  - 0x21、0x29 分别是反色和开显示

  这组顺序和本地全志 SDK 的 st7789v.c、st7789v_cpu.c 使用的寄存器族基本一致,只是目标固件采用了针对该 320x240 面板调整过的参数。

  相比之下:

  - ST7796S 常见初始化包含 F0 C3/F0 96 解锁和多字节 E8 配置,目标中没有。
  - ILI9341 常见的是 CF/ED/CB/F7 等电源配置,目标序列也不匹配。

  但目前不能确认到具体型号,因为:

  LCD_ID:00000000

  目标内核虽然执行了 Read32Bit(0x04),但没有读回有效 ID。最终需要修复/确认 SDO 回读、查看 LCD 排线丝印,或用逻辑分析仪读取 0x04/0x09 返回值。

#22 Re: 全志 SOC » 感谢 本站网友 @zhaoshaox 友情赠送的 V3s方案 新开普 F951 门禁机一台 » 2026-08-07 21:48:10

运行的是全志早期的 camdroid 系统

sys_config.fex

[product]
version = "100"
machine = "ncap-Entrance"

[platform]
eraseflag = 0

[target]
boot_clock = 912
storage_type = -1

[boot_spi_board0]
boot_spi_speed_hz = 60000000
speed_mod = 1

[power_sply]
dcdc2_vol = 1100
dcdc3_vol = 3300
aldo2_vol = 2500
aldo3_vol = 3000
ldo1_vol = 3300
ldo2_vol = 3000
ldo3_vol = 3000

[card_boot]
logical_start = 40960
spinor_verify = 1
sprite_gpio0 =

[card0_boot_para]
card_ctrl = 0
card_high_speed = 1
card_line = 4
sdc_d1 = port:PF00<2><1><default><default>
sdc_d0 = port:PF01<2><1><default><default>
sdc_clk = port:PF02<2><1><default><default>
sdc_cmd = port:PF03<2><1><default><default>
sdc_d3 = port:PF04<2><1><default><default>
sdc_d2 = port:PF05<2><1><default><default>

[twi_para]
twi_port = 0
twi_scl = port:PB06<2><default><default><default>
twi_sda = port:PB07<2><default><default><default>

[uart_para]
uart_debug_port = 2
uart_debug_tx = port:PB00<2><1><default><default>
uart_debug_rx = port:PB01<2><1><default><default>

[jtag_para]
jtag_enable = 0
jtag_ms = port:PF00<3><default><default><default>
jtag_ck = port:PF05<3><default><default><default>
jtag_do = port:PF03<3><default><default><default>
jtag_di = port:PF01<3><default><default><default>

[clock]
pll3 = 297
pll4 = 300
pll6 = 600
pll8 = 360
pll9 = 480
pll10 = 297
pll_ve = 360
pll_isp = 360

[pm_para]
standby_mode = 1

[sys_pwr_dm_para]
vdd_cpua = 1
vdd_sys = 1

[dynamic_standby_para]
enable = 0
dram_selfresh_flag = 1
vdd_cpua_vol = 1200
vdd_sys_vol = 1200

[dram_para]
dram_clk = 360
dram_type = 2
dram_zq = 0x39bb
dram_odt_en = 0
dram_para1 = 283246592
dram_para2 = 0
dram_mr0 = 6208
dram_mr1 = 4
dram_mr2 = 24
dram_mr3 = 4
dram_tpr0 = 0x832087
dram_tpr1 = 0x1c24085
dram_tpr2 = 0x2a01d
dram_tpr3 = 0x0
dram_tpr4 = 0x0
dram_tpr5 = 0x0
dram_tpr6 = 0x0
dram_tpr7 = 0x0
dram_tpr8 = 0x0
dram_tpr9 = 0x0
dram_tpr10 = 0x0
dram_tpr11 = 0x220000
dram_tpr12 = 0x78
dram_tpr13 = 0xd000000

[pm_para]
standby_mode = 0

[wakeup_src_para]
cpu_en = 0
cpu_freq = 48
pll_ratio = 273
dram_selfresh_en = 1
dram_freq = 36
wakeup_src_wl = port:PL07<4><default><default><0>
wakeup_src_bt = port:PL09<4><default><default><0>
bb_wake_ap = port:PL02<4><default><default><0>

[twi0]
twi_used = 1
twi_scl = port:PB06<2><default><default><default>
twi_sda = port:PB07<2><default><default><default>

[twi1]
twi_used = 0
twi_scl = port:PB08<2><default><default><default>
twi_sda = port:PB09<2><default><default><default>

[uart0]
uart_used = 1
uart_port = 1
uart_type = 2
uart_tx = port:PB08<3><1><default><default>
uart_rx = port:PB09<3><1><default><default>

[uart1]
uart_used = 1
uart_port = 2
uart_type = 2
uart_tx = port:PE21<4><1><default><default>
uart_rx = port:PE22<4><1><default><default>

[uart2]
uart_used = 1
uart_port = 0
uart_type = 2
uart_tx = port:PB00<2><1><default><default>
uart_rx = port:PB01<2><1><default><default>

[spi0]
spi_used = 1
spi_cs_bitmap = 1
spi_mosi = port:PC03<3><default><default><default>
spi_miso = port:PC00<3><default><default><default>
spi_sclk = port:PC01<3><default><default><default>
spi_cs0 = port:PC02<3><1><default><default>

[spi_devices]
spi_dev_num = 1

[spi_board0]
modalias = "W25q128"
max_speed_hz = 60000000
bus_num = 0
chip_select = 0
mode = 0
sflash_size = 16

[ctp_para]
ctp_used = 0
ctp_name = "gt911_m785q6"
ctp_twi_id = 1
ctp_twi_addr = 0x5d
ctp_screen_max_x = 800
ctp_screen_max_y = 480
ctp_revert_x_flag = 0
ctp_revert_y_flag = 0
ctp_exchange_x_y_flag = 1
ctp_int_port =
ctp_wakeup =

[ctp_list_para]
ctp_det_used = 0
gt911_ts = 1
ft5x_ts = 1
gt82x = 1
gslX680 = 1
gt9xx_ts = 1
gt811 = 1
zet622x = 1
aw5306_ts = 1

[tkey_para]
tkey_used = 0
tkey_twi_id =
tkey_twi_addr =
tkey_int =

[motor_para]
motor_used = 0
motor_shake = port:power3<1><default><default><1>

[cooler_table]
cooler_count = 4
cooler0 = "1340000 4 4294967295 0"
cooler1 = "1200000 4 4294967295 0"
cooler2 = "1008000 4 4294967295 0"
cooler3 = "648000 4 4294967295 0"

[disp_init]
disp_init_enable = 1
disp_mode = 0
screen0_output_type = 1
screen0_output_mode = 4
screen1_output_type = 1
screen1_output_mode = 4
fb0_format = 0
fb0_pixel_sequence = 0
fb0_scaler_mode_enable = 0
fb0_width = 0
fb0_height = 0
fb1_format = 0
fb1_pixel_sequence = 0
fb1_scaler_mode_enable = 0
fb1_width = 0
fb1_height = 0
lcd0_backlight = 200
lcd1_backlight = 50
lcd0_bright = 50
lcd0_contrast = 50
lcd0_saturation = 57
lcd0_hue = 50
lcd1_bright = 50
lcd1_contrast = 50
lcd1_saturation = 57
lcd1_hue = 50

[lcd0_para]
lcd_used = 1
lcd_driver_name = "default_lcd"
lcd_if = 0
lcd_x = 320
lcd_y = 240
lcd_width = 49
lcd_height = 37
lcd_dclk_freq = 12
lcd_pwm_used = 0
lcd_pwm_ch = 0
lcd_pwm_freq = 50000
lcd_pwm_pol = 1
lcd_pwm_max_limit = 255
lcd_hbp = 30
lcd_ht = 500
lcd_hspw = 10
lcd_vbp = 10
lcd_vt = 300
lcd_vspw = 4
lcd_frm = 1
lcd_hv_clk_phase = 0
lcd_hv_sync_polarity = 0
lcd_gamma_en = 0
lcd_bright_curve_en = 1
lcd_cmap_en = 0
lcdgamma4iep = 22
lcd_bl_en = port:PB04<1><0><default><1>
lcd_power = ""
lcdd2 = port:PE04<3><0><default><default>
lcdd3 = port:PE05<3><0><default><default>
lcdd4 = port:PE06<3><0><default><default>
lcdd5 = port:PE07<3><0><default><default>
lcdd6 = port:PE08<3><0><default><default>
lcdd7 = port:PE09<3><0><default><default>
lcdd10 = port:PE10<3><0><default><default>
lcdd11 = port:PE11<3><0><default><default>
lcdd12 = port:PE12<3><0><default><default>
lcdd13 = port:PE13<3><0><default><default>
lcdd14 = port:PE14<3><0><default><default>
lcdd15 = port:PE15<3><0><default><default>
lcdd18 = port:PE16<3><0><default><default>
lcdd19 = port:PE17<3><0><default><default>
lcdd20 = port:PE18<3><0><default><default>
lcdd21 = port:PE19<3><0><default><default>
lcdd22 = port:PE23<3><0><default><default>
lcdd23 = port:PE24<3><0><default><default>
lcdclk = port:PE00<3><0><3><default>
lcdde = port:PE01<3><0><3><default>
lcdhsync = port:PE02<3><0><3><default>
lcdvsync = port:PE03<3><0><3><default>

[spi_mn_para]
spin_scl = port:PB06<1><default><default><default>
spin_sdo = port:PB03<0><default><default><default>
spin_sdi = port:PB07<1><default><default><default>
spin_cs = port:PB05<1><default><default><default>
spin_reset = port:PG04<1><default><default><default>

[pwm0_para]
pwm_used = 1
pwm_positive = port:PB04<2><0><default><default>

[pwm1_para]
pwm_used = 0
pwm_positive = port:PH01<2><0><default><default>
:       If set gamc_phy to use = 2

[gmac0]
gmac_used = 2
gmac_power1 =

[csi0]
vip_used = 0
vip_mode = 0
vip_dev_qty = 1
vip_define_sensor_list = 0
vip_csi_mck = port:PE20<3><default><default><default>
vip_csi_sck = port:PE21<2><default><default><default>
vip_csi_sda = port:PE22<2><default><default><default>
vip_dev0_mname = "h42_mipi"
vip_dev0_pos = "rear"
vip_dev0_lane = 1
vip_dev0_twi_id = 0
vip_dev0_twi_addr = 96
vip_dev0_isp_used = 1
vip_dev0_fmt = 1
vip_dev0_stby_mode = 0
vip_dev0_vflip = 1
vip_dev0_hflip = 1
vip_dev0_iovdd = ""
vip_dev0_iovdd_vol = 3000000
vip_dev0_avdd = ""
vip_dev0_avdd_vol = 2800000
vip_dev0_dvdd = ""
vip_dev0_dvdd_vol = 2800000
vip_dev0_afvdd = ""
vip_dev0_afvdd_vol = 2800000
vip_dev0_power_en =
vip_dev0_reset = port:PG00<1><default><default><0>
vip_dev0_pwdn =
vip_dev0_flash_en =
vip_dev0_flash_mode =
vip_dev0_af_pwdn =
vip_dev0_act_used = 0
vip_dev0_act_name = "dw9714_act"
vip_dev0_act_slave = 24
vip_dev1_mname = ""
vip_dev1_pos = "front"
vip_dev1_lane = 1
vip_dev1_twi_id = 0
vip_dev1_twi_addr =
vip_dev1_isp_used = 0
vip_dev1_fmt = 1
vip_dev1_stby_mode = 0
vip_dev1_vflip = 0
vip_dev1_hflip = 0
vip_dev1_iovdd = ""
vip_dev1_iovdd_vol = 2800000
vip_dev1_avdd = ""
vip_dev1_avdd_vol = 2800000
vip_dev1_dvdd = ""
vip_dev1_dvdd_vol = 1500000
vip_dev1_afvdd = ""
vip_dev1_afvdd_vol = 2800000
vip_dev1_power_en =
vip_dev1_reset =
vip_dev1_pwdn =
vip_dev1_flash_en =
vip_dev1_flash_mode =
vip_dev1_af_pwdn =

[csi1]
vip_used = 0
vip_mode = 0
vip_dev_qty = 1
vip_define_sensor_list = 0
vip_csi_pck =
vip_csi_mck =
vip_csi_hsync =
vip_csi_vsync =
vip_csi_d0 =
vip_csi_d1 =
vip_csi_d2 =
vip_csi_d3 =
vip_csi_d4 =
vip_csi_d5 =
vip_csi_d6 =
vip_csi_d7 =
vip_csi_d8 =
vip_csi_d10 = port:PE14<2><default><default><default>
vip_csi_d11 = port:PE15<2><default><default><default>
vip_csi_sck = port:PE21<2><default><default><default>
vip_csi_sda = port:PE22<2><default><default><default>
vip_dev0_mname = "ov5640"
vip_dev0_pos = "front"
vip_dev0_twi_id = 4
vip_dev0_twi_addr = 120
vip_dev0_isp_used = 0
vip_dev0_fmt = 0
vip_dev0_stby_mode = 0
vip_dev0_vflip = 0
vip_dev0_hflip = 0
vip_dev0_iovdd = ""
vip_dev0_iovdd_vol = 2800000
vip_dev0_avdd = ""
vip_dev0_avdd_vol = 2800000
vip_dev0_dvdd = ""
vip_dev0_dvdd_vol = 1500000
vip_dev0_afvdd = ""
vip_dev0_afvdd_vol = 2800000
vip_dev0_power_en =
vip_dev0_reset = port:PE23<1><default><default><default>
vip_dev0_pwdn = port:PE24<1><default><default><default>
vip_dev0_flash_en =
vip_dev0_flash_mode =
vip_dev0_af_pwdn =
vip_dev0_act_used = 0
vip_dev0_act_name = "ad5820_act"
vip_dev0_act_slave = 24
vip_dev1_mname = "gc2035"
vip_dev1_pos = "front"
vip_dev1_lane = 1
vip_dev1_twi_id = 4
vip_dev1_twi_addr = 120
vip_dev1_isp_used = 0
vip_dev1_fmt = 1
vip_dev1_stby_mode = 0
vip_dev1_vflip = 0
vip_dev1_hflip = 0
vip_dev1_iovdd = ""
vip_dev1_iovdd_vol = 2800000
vip_dev1_avdd = ""
vip_dev1_avdd_vol = 2800000
vip_dev1_dvdd = ""
vip_dev1_dvdd_vol = 1500000
vip_dev1_afvdd = ""
vip_dev1_afvdd_vol = 2800000
vip_dev1_power_en =
vip_dev1_reset =
vip_dev1_pwdn =
vip_dev1_flash_en =
vip_dev1_flash_mode =
vip_dev1_af_pwdn =

[mmc0_para]
sdc_used = 1
sdc_detmode = 3
sdc_buswidth = 4
sdc_d1 = port:PF00<2><1><2><default>
sdc_d0 = port:PF01<2><1><2><default>
sdc_clk = port:PF02<2><1><2><default>
sdc_cmd = port:PF03<2><1><2><default>
sdc_d3 = port:PF04<2><1><2><default>
sdc_d2 = port:PF05<2><1><2><default>
#sdc_det =
sdc_use_wp = 0
sdc_wp =
sdc_isio = 1
sdc_regulator = "none"

[mmc1_para]
sdc_used = 0
sdc_detmode = 4
sdc_buswidth = 4
sdc_clk = port:PG00<2><1><1><default>
sdc_cmd = port:PG01<2><1><1><default>
sdc_d0 = port:PG02<2><1><1><default>
sdc_d1 = port:PG03<2><1><1><default>
sdc_d2 = port:PG04<2><1><1><default>
sdc_d3 = port:PG05<2><1><1><default>
sdc_det =
sdc_use_wp = 0
sdc_wp =
sdc_isio = 1
sdc_regulator = "none"

[mmc2_para]
sdc_used = 0
sdc_detmode = 3
sdc_buswidth = 8
sdc_clk = port:PC00<2><1><2><default>
sdc_cmd = port:PC01<2><1><2><default>
sdc_d0 = port:PC03<2><1><2><default>
sdc_d1 = port:PC04<2><1><2><default>
sdc_d2 = port:PC05<2><1><2><default>
sdc_d3 = port:PC06<2><1><2><default>
sdc_d4 = port:PC07<2><1><2><default>
sdc_d5 = port:PC08<2><1><2><default>
sdc_d6 = port:PC09<2><1><2><default>
sdc_d7 = port:PC10<2><1><2><default>
emmc_rst = port:PC02<2><1><2><default>
sdc_det =
sdc_use_wp = 0
sdc_wp =
sdc_isio = 0
sdc_regulator = "none"

[usbc0]
usb_used = 1
usb_port_type = 0
usb_detect_type = 0
usb_id_gpio =
usb_det_vbus_gpio =
usb_drv_vbus_gpio =
usb_restrict_gpio =
usb_host_init_state = 0
usb_restric_flag = 0
usb_restric_voltage = 3550000
usb_restric_capacity = 5
usb_regulator_io = "nocare"
usb_regulator_vol = 0
usb_not_suspend = 0

[usb_feature]
vendor_id = 6353
mass_storage_id = 1
adb_id = 2
manufacturer_name = "USB Developer"
product_name = "QRDecoder"
serial_number = "20171020"

[msc_feature]
vendor_name = "USB 2.0"
product_name = "USB Flash Driver"
release = 100
luns = 1

[serial_feature]
serial_unique = 0

[gsensor_para]
gsensor_used = 0
gsensor_twi_id = 1
gsensor_twi_addr = 0x27
gsensor_int1 =
gsensor_int2 =

[gsensor_list_para]
gsensor_det_used = 0
bma250 = 1
da380 = 1
mma8452 = 1
mma7660 = 1
mma865x = 1
afa750 = 1
lis3de_acc = 1
lis3dh_acc = 1
kxtik = 1
dmard10 = 0
dmard06 = 1
mxc622x = 1
fxos8700 = 1
lsm303d = 1

[gps_para]

[wifi_para]
wifi_used = 0
wifi_sdc_id = 1
wifi_usbc_id = 1
wifi_usbc_type = 1
wifi_mod_sel = 2
wifi_power = ""
ap6xxx_wl_regon = port:PL06<1><default><default><0>
ap6xxx_wl_host_wake = port:PL07<4><default><default><0>
ap6xxx_bt_regon = port:PL08<1><default><default><0>
ap6xxx_bt_wake = port:PL10<1><default><default><0>
ap6xxx_bt_host_wake = port:PL09<4><default><default><0>
ap6xxx_lpo_use_apclk = 1

[ls_para]
ls_used = 0
ls_twi_id = 1
ls_twi_addr = 35
ls_int = port:PB07<4><1><default><default>

[ls_list_para]
ls_det_used = 0
ltr_501als = 1
jsa1212 = 1

[compass_para]
compass_used = 0
compass_twi_id = 1
compass_twi_addr = 13
compass_int =

[tdm0]
daudio_used = 0
daudio_master = 4
daudio_select = 1
audio_format = 1
signal_inversion = 1
mclk_fs = 512
sample_resolution = 16
slot_width_select = 16
pcm_lrck_period = 32
pcm_lrckr_period = 1
msb_lsb_first = 0
sign_extend = 0
slot_index = 0
slot_width = 16
frame_width = 1
tx_data_mode = 0
rx_data_mode = 0
i2s_bclk = port:PG11<2><1><default><default>
i2s_lrclk = port:PG10<2><1><default><default>
i2s_dout0 = port:PG12<2><1><default><default>
i2s_dout1 =
i2s_dout2 =
i2s_dout3 =
i2s_din = port:PG13<2><1><default><default>

[audio0]
headphone_vol = 63
cap_vol = 7
Differential_output = 1
pa_single_vol = 63
pa_double_used = 0
pa_double_vol = 31
headphone_direct_used = 0
phone_mic_vol = 6
version_v3_used = 0
headphone_mute_used = 0
audio_hp_ldo = "none"
audio_pa_ctrl = port:PB05<1><default><default><0>
adcagc_used = 0
adcdrc_used = 1
dacdrc_used = 0
adchpf_used = 1
dachpf_used = 0

[s_ir0]
ir_used = 0
ir_rx = port:PL04<2><1><default><default>

[pmu1_para]
pmu_used = 0
pmu_id = 1
pmu_twi_addr = 52
pmu_twi_id = 0
pmu_irq_id = 0
pmu_irq_gpio = port:PG05<6><default><default><default>
pmu_battery_rdc = 249
pmu_battery_cap = 183
pmu_batdeten = 1
pmu_runtime_chgcur = 150
pmu_earlysuspend_chgcur = 150
pmu_suspend_chgcur = 150
pmu_shutdown_chgcur = 150
pmu_init_chgvol = 4200
pmu_init_chgend_rate = 15
pmu_init_chg_enabled = 1
pmu_init_adc_freq = 100
pmu_init_chg_pretime = 50
pmu_init_chg_csttime = 720
pmu_battery_warning1 = 3650
pmu_battery_warning2 = 3600
pmu_bat_para1 = 0
pmu_bat_para2 = 0
pmu_bat_para3 = 0
pmu_bat_para4 = 0
pmu_bat_para5 = 8
pmu_bat_para6 = 16
pmu_bat_para7 = 25
pmu_bat_para8 = 37
pmu_bat_para9 = 47
pmu_bat_para10 = 55
pmu_bat_para11 = 61
pmu_bat_para12 = 68
pmu_bat_para13 = 79
pmu_bat_para14 = 87
pmu_bat_para15 = 94
pmu_bat_para16 = 100
pmu_usbvol_limit = 1
pmu_usbcur_limit = 0
pmu_usbvol = 4000
pmu_usbcur = 0
pmu_usbvol_pc = 4000
pmu_usbcur_pc = 0
pmu_pwroff_vol = 3300
pmu_pwron_vol = 2900
pmu_pekoff_time = 6000
pmu_pekoff_en = 1
pmu_peklong_time = 1500
pmu_pekon_time = 1000
pmu_pwrok_time = 64
pmu_pwrnoe_time = 2000
pmu_hot_shutdown = 1
pmu_suspendpwroff_vol = 3500
power_start = 1

[pmu1_regu]
regulator_count = 7
regulator1 = "axp20_dcdc2 none vdd-sys vdd-cpu vdd-ephy"
regulator2 = "axp20_dcdc3 none vcc-io hpvcc vcc-pd vcc-usb vcc-ephy vcc-mcsi vcc-lcd vcc-wifi vcc-device vcc-csi vcc-ctp"
regulator3 = "axp20_ldo1 none vcc-rtc"
regulator4 = "axp20_ldo2 none  vcc-avcc vcc-pll"
regulator5 = "axp20_ldo3 none vcc-pe csi-avdd"
regulator6 = "axp20_ldo4 none csi-dvdd"
regulator7 = "axp20_ldoio0 none"

[dvfs_table]
extremity_freq = 912000000
max_freq = 912000000
min_freq = 60000000
LV_count = 8
LV1_freq = 912000000
LV1_volt = 1100
LV2_freq = 912000000
LV2_volt = 1100
LV3_freq = 912000000
LV3_volt = 1100
LV4_freq = 912000000
LV4_volt = 1100
LV5_freq = 912000000
LV5_volt = 1100
LV6_freq = 648000000
LV6_volt = 1040
LV7_freq = 0
LV7_volt = 1040
LV8_freq = 0
LV8_volt = 1040

[Vdevice]
Vdevice_used = 1
Vdevice_0 = port:PA01<5><1><2><default>
Vdevice_1 = port:PA02<5><1><2><default>

[dram_dvfs_table]
LV_count = 3
LV1_freq = 552000000
LV1_volt = 1100
LV2_freq = 360000000
LV2_volt = 1000
LV3_freq = 0
LV3_volt = 1000

[fel_key]
fel_key_used = 0
fel_key_min = 255
fel_key_max = 255

[leds_para]
led_1 = port:PG01<1><default><default><0>
led_1_active_low = 1
led_2 = port:PG02<1><default><default><0>
led_2_active_low = 1

#25 Re: 全志 SOC » V853SDk » 2026-07-05 17:23:06

kendyChen 说:

第一次关注公众号后怎么领积分?

自动的。

#26 Re: 全志 SOC » V853SDk » 2026-07-03 10:35:18

是的,第一次关注公众号也可以。

★★★ 网站改版记录 ★★★
https://whycan.com/t_12804.html#p108225

#27 Re: 全志 SOC » 路边捡到的VIOMI云米 V3S 摄像头 » 2026-07-01 17:35:03

kendyChen 说:

@晕哥 晕哥好!求一块全志V821的板子,谢谢! qq-email:286384019@qq.com

做了一批V821的板子,现在招募有识之士一起调试开发
https://whycan.com/t_12383.html

#28 Re: 全志 SOC » 全志A20/A64/A133/D1/T113/R528/V83x/V85x/H133/H135/H136/F135/F136 文档合集 » 2026-06-30 15:51:45

F101_Brief_V0.11_Draft_Version.pdf
F101_Datasheet_V0.10_Draft_Version.pdf
F101_User Manual_V0.10_Draft_Version.pdf

F102MX_Brief_V0.11_Draft_Version.pdf
F102MX_Datasheet_V0.11_Draft_Version.pdf
F102MX_User Manual_V0.10_Draft_Version.pdf

# F101 / F102MX 芯片对比总结

已阅读资料:

- F101_Brief_V0.11_Draft_Version.pdf
- F101_Datasheet_V0.10_Draft_Version.pdf
- F101_User Manual_V0.10_Draft_Version.pdf
- F102MX_Brief_V0.11_Draft_Version.pdf
- F102MX_Datasheet_V0.11_Draft_Version.pdf
- F102MX_User Manual_V0.10_Draft_Version.pdf

## 核心结论

**F101 是低成本、小封装、内置 PSRAM 的显示控制/HMI SoC;F102MX 是外接 DDR、带 1080p 视频解码能力的多媒体 SoC。**

## 一眼选型建议

| 需求方向 | 推荐芯片 |
|---|---|
| 串口屏、工业 HMI、小家电屏、静态/轻动态 UI | F101S2 / F101S3 |
| 需要 CAN 总线 | F101S3-CXX |
| 需要 H.264/MPEG 视频播放、数字相框、视频传屏 | F102MX |
| 希望降低 PCB/BOM/封装复杂度 | F101 |
| 需要更大内存、更完整音频输入输出 | F102MX |

## 规格对比

| 项目 | F101S2 | F101S3-CXX | F102MX |
|---|---:|---:|---:|
| 定位 | 智能控制 + 显示 | 智能控制 + 显示 + CAN | 多媒体/视频解码平台 |
| CPU | XuanTie C907 RISC-V | 同左 | 同左 |
| Cache | 32 KB I-cache + 16 KB D-cache | 同左 | 同左 |
| 主内存 | SiP 16-bit 8 MB PSRAM | SiP 16-bit 16 MB PSRAM | DDR2/DDR3/DDR3L,最高 256 MB |
| 内存频率 | PSRAM up to 233 MHz | PSRAM up to 250 MHz | DDR clock up to 528 MHz |
| 启动/存储 | SPI Flash、SD/SMHC | SPI Flash、SD/SMHC | SPI Flash、SD、eMMC |
| 视频解码 | JPEG/PNG 图片解码 | 同左 | H.264 1080p@30、MPEG-4 1080p@30、MPEG-1/2 720p@30、H.263 720p@30、JPEG/PNG |
| 视频编码 | JPEG/MJPEG 1280x720@30 | 同左 | JPEG/MJPEG 1280x720@30 |
| 显示输出 | RGB888 1280x720@60、LVDS 1366x768@60、4-lane MIPI DSI 1280x800@60 | 同左 | 同左 |
| 显示处理 | DE + DI 720p@60 + G2D | 同左 | 同左 |
| 音频 | 1 DAC,I2S/PCM,OWA OUT | 同左 | 2 DAC + 1 ADC,MICIN/LINEIN/FMIN/HPOUTL/R,I2S/PCM,OWA OUT |
| 外设 | USB2.0 DRD、SPI x2、UART x6、TWI x3、PWM x4、PWM_BL x2、IR_RX、GPADC、TPADC | 同左 + CAN x2 | USB2.0 DRD、SPI x2、UART x6、TWI x3、PWM x4、PWM_BL x2、IR_RX、GPADC、TPADC |
| 安全 | Crypto Engine + 512-bit eFuse | 同左 | 同左 |
| 封装 | QFN68,7 mm x 7 mm | QFN68,7 mm x 7 mm | QFN128,12.3 mm x 12.3 mm |
| 存储等级 | MSL3,开封 floor life 168 h | 同左 | MSL3,开封 floor life 168 h |

## 详细分析

### F101

F101 更适合“屏控一体”的低成本产品,例如:

- 工业 HMI
- 串口屏
- 小家电 UI
- 简单图像显示
- 触摸屏控制

主要优势:

- SiP 集成 8 MB / 16 MB PSRAM,外围更简单
- QFN68 小封装,7 mm x 7 mm
- 支持 RGB、LVDS、MIPI DSI 显示输出
- 支持 G2D、DI、JPEG/PNG 解码
- F101S3-CXX 支持 CAN x2

主要限制:

- 内存容量只有 8 MB / 16 MB 级别
- 不支持 H.264/MPEG 视频硬解
- 更适合 UI、图片、轻量显示场景,而不是完整视频播放

### F102MX

F102MX 更适合多媒体显示和视频播放场景,例如:

- 网络视频播放器
- 数字相框
- 视频传屏
- 带音频输入/输出的显示设备

主要优势:

- 支持 DDR2/DDR3/DDR3L,最高 256 MB
- 支持 H.264 1080p@30 视频解码
- 支持 MPEG-4 1080p@30、MPEG-1/2 720p@30
- 音频模拟前端更完整:2 DAC + 1 ADC
- 支持 MICIN、LINEIN、FMIN、HPOUTL/R

主要代价:

- QFN128 封装,12.3 mm x 12.3 mm
- 外接 DDR,PCB 走线和电源设计复杂度更高
- BOM 和硬件调试成本高于 F101

## 资料差异提醒

这些 PDF 均为 Draft/Brief 资料,设计前建议找原厂 FAE 再确认以下点:

1. F102MX Brief 写 eMMC4.5/5.0/5.1,但 Datasheet/User Manual 中更明确地写到 eMMC4.41。
2. F102MX Brief 对 MPEG-1/2/4 写得较宽,Datasheet 细分为 MPEG-4 1080p、MPEG-1/2 720p。
3. F101 Brief 提到 QSPI 显示,但 Datasheet 主要落在 RGB/LVDS/MIPI DSI、SRGB/I8080 和 SPI DBI 相关能力上。

## 最终建议

- 如果产品是 **HMI、串口屏、小家电屏、工业控制屏**,优先选 **F101**。
- 如果需要 **CAN**,优先看 **F101S3-CXX**。
- 如果产品需要 **1080p 视频播放、MPEG/H.264 硬解、更大内存或音频输入**,选 **F102MX**。
- 如果硬件成本、PCB 难度、封装尺寸是关键约束,**F101 明显更友好**。

#29 Re: 全志 SOC » T113-S3: 视频播放无缝切换 (Tina Linux Video Playback Seamless Switching) » 2026-06-30 10:45:16

播放完
-> 视频层保存
-> 复制到UI,同时把UI透明度设置为0(不透明)
->播放下一个视频重置UI

#30 全志 SOC » 路边捡到的VIOMI云米 V3S 摄像头 » 2026-06-12 08:15:24

晕哥
回复: 3

此处下载:v3s_backup_20260709_231623.tgz

backups/v3s_20260709_231623/
backups/v3s_20260709_231623/proc_meminfo.txt
backups/v3s_20260709_231623/io_wiring.md
backups/v3s_20260709_231623/proc_cpuinfo.txt
backups/v3s_20260709_231623/firmware_mtd_concat.bin
backups/v3s_20260709_231623/runtime_pinmux-pins.txt
backups/v3s_20260709_231623/script_main_keys_from_source.txt
backups/v3s_20260709_231623/mtd0_uboot.bin
backups/v3s_20260709_231623/mtd1_boot.bin
backups/v3s_20260709_231623/SHA256SUMS
backups/v3s_20260709_231623/README.md
backups/v3s_20260709_231623/mtd3_cfg.bin
backups/v3s_20260709_231623/proc_mtd.txt
backups/v3s_20260709_231623/mtd2_system.bin
backups/v3s_20260709_231623/system_extract/
backups/v3s_20260709_231623/system_extract/bin/
backups/v3s_20260709_231623/system_extract/bin/iftop
backups/v3s_20260709_231623/system_extract/bin/newfs_msdos
backups/v3s_20260709_231623/system_extract/bin/fatTest
backups/v3s_20260709_231623/system_extract/bin/chmod
backups/v3s_20260709_231623/system_extract/bin/date
backups/v3s_20260709_231623/system_extract/bin/touch
backups/v3s_20260709_231623/system_extract/bin/umount
backups/v3s_20260709_231623/system_extract/bin/smd
backups/v3s_20260709_231623/system_extract/bin/app_basic
backups/v3s_20260709_231623/system_extract/bin/reboot
backups/v3s_20260709_231623/system_extract/bin/keystore_cli
backups/v3s_20260709_231623/system_extract/bin/stop
backups/v3s_20260709_231623/system_extract/bin/base_test
backups/v3s_20260709_231623/system_extract/bin/cat
backups/v3s_20260709_231623/system_extract/bin/toolbox
backups/v3s_20260709_231623/system_extract/bin/hd
backups/v3s_20260709_231623/system_extract/bin/netcfg
backups/v3s_20260709_231623/system_extract/bin/startup_music
backups/v3s_20260709_231623/system_extract/bin/gzip
backups/v3s_20260709_231623/system_extract/bin/chown
backups/v3s_20260709_231623/system_extract/bin/tinyplay
backups/v3s_20260709_231623/system_extract/bin/debuggerd
backups/v3s_20260709_231623/system_extract/bin/cdrUpdate
backups/v3s_20260709_231623/system_extract/bin/mv
backups/v3s_20260709_231623/system_extract/bin/df
backups/v3s_20260709_231623/system_extract/bin/getprop
backups/v3s_20260709_231623/system_extract/bin/watchprops
backups/v3s_20260709_231623/system_extract/bin/rmmod
backups/v3s_20260709_231623/system_extract/bin/du
backups/v3s_20260709_231623/system_extract/bin/id
backups/v3s_20260709_231623/system_extract/bin/rm
backups/v3s_20260709_231623/system_extract/bin/lsmod
backups/v3s_20260709_231623/system_extract/bin/standbyservice
backups/v3s_20260709_231623/system_extract/bin/notify
backups/v3s_20260709_231623/system_extract/bin/mount
backups/v3s_20260709_231623/system_extract/bin/mediaserver
backups/v3s_20260709_231623/system_extract/bin/sh
backups/v3s_20260709_231623/system_extract/bin/sync
backups/v3s_20260709_231623/system_extract/bin/insmod
backups/v3s_20260709_231623/system_extract/bin/netstat
backups/v3s_20260709_231623/system_extract/bin/ps
backups/v3s_20260709_231623/system_extract/bin/logwrapper
backups/v3s_20260709_231623/system_extract/bin/mkdir
backups/v3s_20260709_231623/system_extract/bin/rtwpriv
backups/v3s_20260709_231623/system_extract/bin/kill
backups/v3s_20260709_231623/system_extract/bin/tinycap
backups/v3s_20260709_231623/system_extract/bin/dd
backups/v3s_20260709_231623/system_extract/bin/servicemanager
backups/v3s_20260709_231623/system_extract/bin/ionice
backups/v3s_20260709_231623/system_extract/bin/ls
backups/v3s_20260709_231623/system_extract/bin/cmp
backups/v3s_20260709_231623/system_extract/bin/showlease
backups/v3s_20260709_231623/system_extract/bin/log
backups/v3s_20260709_231623/system_extract/bin/uptime
backups/v3s_20260709_231623/system_extract/bin/start
backups/v3s_20260709_231623/system_extract/bin/ioctl
backups/v3s_20260709_231623/system_extract/bin/lsof
backups/v3s_20260709_231623/system_extract/bin/rmdir
backups/v3s_20260709_231623/system_extract/bin/route
backups/v3s_20260709_231623/system_extract/bin/wipe
backups/v3s_20260709_231623/system_extract/bin/vold
backups/v3s_20260709_231623/system_extract/bin/logcat
backups/v3s_20260709_231623/system_extract/bin/schedtop
backups/v3s_20260709_231623/system_extract/bin/top
backups/v3s_20260709_231623/system_extract/bin/renice
backups/v3s_20260709_231623/system_extract/bin/setprop
backups/v3s_20260709_231623/system_extract/bin/linker
backups/v3s_20260709_231623/system_extract/bin/cp
backups/v3s_20260709_231623/system_extract/bin/asanwrapper
backups/v3s_20260709_231623/system_extract/bin/make_ext4fs
backups/v3s_20260709_231623/system_extract/bin/r
backups/v3s_20260709_231623/system_extract/bin/fsck_msdos
backups/v3s_20260709_231623/system_extract/bin/setconsole
backups/v3s_20260709_231623/system_extract/bin/dumpsys
backups/v3s_20260709_231623/system_extract/bin/tinymix
backups/v3s_20260709_231623/system_extract/bin/mksh
backups/v3s_20260709_231623/system_extract/bin/vmstat
backups/v3s_20260709_231623/system_extract/bin/printenv
backups/v3s_20260709_231623/system_extract/bin/ifconfig
backups/v3s_20260709_231623/system_extract/bin/sleep
backups/v3s_20260709_231623/system_extract/bin/grep
backups/v3s_20260709_231623/system_extract/bin/service
backups/v3s_20260709_231623/system_extract/bin/ln
backups/v3s_20260709_231623/system_extract/xbin/
backups/v3s_20260709_231623/system_extract/xbin/latencytop
backups/v3s_20260709_231623/system_extract/xbin/librank
backups/v3s_20260709_231623/system_extract/xbin/su
backups/v3s_20260709_231623/system_extract/xbin/rawbu
backups/v3s_20260709_231623/system_extract/xbin/showslab
backups/v3s_20260709_231623/system_extract/xbin/cpustats
backups/v3s_20260709_231623/system_extract/xbin/showmap
backups/v3s_20260709_231623/system_extract/xbin/sane_schedstat
backups/v3s_20260709_231623/system_extract/res/
backups/v3s_20260709_231623/system_extract/res/others/
backups/v3s_20260709_231623/system_extract/res/others/low_power_notice.png
backups/v3s_20260709_231623/system_extract/res/others/voice2.png
backups/v3s_20260709_231623/system_extract/res/others/playback_pause.png
backups/v3s_20260709_231623/system_extract/res/others/shutter.wav
backups/v3s_20260709_231623/system_extract/res/others/voice4.png
backups/v3s_20260709_231623/system_extract/res/others/pccam_modem.png
backups/v3s_20260709_231623/system_extract/res/others/volice_max.png
backups/v3s_20260709_231623/system_extract/res/others/left_crash_warn.jpg
backups/v3s_20260709_231623/system_extract/res/others/key.wav
backups/v3s_20260709_231623/system_extract/res/others/line_warn.mp3
backups/v3s_20260709_231623/system_extract/res/others/no_video_image.png
backups/v3s_20260709_231623/system_extract/res/others/voice_off.png
backups/v3s_20260709_231623/system_extract/res/others/right_warn.jpg
backups/v3s_20260709_231623/system_extract/res/others/playback_start.png
backups/v3s_20260709_231623/system_extract/res/others/parknotice.wav
backups/v3s_20260709_231623/system_extract/res/others/voice1.png
backups/v3s_20260709_231623/system_extract/res/others/startup.wav
backups/v3s_20260709_231623/system_extract/res/others/Warning.png
backups/v3s_20260709_231623/system_extract/res/others/back_car.png
backups/v3s_20260709_231623/system_extract/res/others/right_crash_warn.jpg
backups/v3s_20260709_231623/system_extract/res/others/voice3.png
backups/v3s_20260709_231623/system_extract/res/others/car_warn.mp3
backups/v3s_20260709_231623/system_extract/res/others/left_warn.jpg
backups/v3s_20260709_231623/system_extract/res/others/crash_warn.jpg
backups/v3s_20260709_231623/system_extract/res/others/shutdown.png
backups/v3s_20260709_231623/system_extract/res/others/usb_storage_modem.png
backups/v3s_20260709_231623/system_extract/res/cfg/
backups/v3s_20260709_231623/system_extract/res/cfg/320x480.cfg
backups/v3s_20260709_231623/system_extract/res/cfg/menu.cfg
backups/v3s_20260709_231623/system_extract/res/cfg/480x272.cfg
backups/v3s_20260709_231623/system_extract/res/cfg/320x240.cfg
backups/v3s_20260709_231623/system_extract/res/font/
backups/v3s_20260709_231623/system_extract/res/font/sxf.7z
backups/v3s_20260709_231623/system_extract/res/topbar/
backups/v3s_20260709_231623/system_extract/res/topbar/lock.png
backups/v3s_20260709_231623/system_extract/res/topbar/playback.png
backups/v3s_20260709_231623/system_extract/res/topbar/gsensor.png
backups/v3s_20260709_231623/system_extract/res/topbar/uvc.png
backups/v3s_20260709_231623/system_extract/res/topbar/compression_quality3.png
backups/v3s_20260709_231623/system_extract/res/topbar/SEAMLESS3min.png
backups/v3s_20260709_231623/system_extract/res/topbar/menu.png
backups/v3s_20260709_231623/system_extract/res/topbar/RESOLUTION_8M.png
backups/v3s_20260709_231623/system_extract/res/topbar/preview.png
backups/v3s_20260709_231623/system_extract/res/topbar/battery4.png
backups/v3s_20260709_231623/system_extract/res/topbar/windowPic_bkgroud.png
backups/v3s_20260709_231623/system_extract/res/topbar/wifi_on.png
backups/v3s_20260709_231623/system_extract/res/topbar/1min.png
backups/v3s_20260709_231623/system_extract/res/topbar/SEAMLESS1min.png
backups/v3s_20260709_231623/system_extract/res/topbar/battery1.png
backups/v3s_20260709_231623/system_extract/res/topbar/sdcard_on.png
backups/v3s_20260709_231623/system_extract/res/topbar/awmd.png
backups/v3s_20260709_231623/system_extract/res/topbar/sdcard_off.png
backups/v3s_20260709_231623/system_extract/res/topbar/battery2.png
backups/v3s_20260709_231623/system_extract/res/topbar/RESOLUTION_5M.png
backups/v3s_20260709_231623/system_extract/res/topbar/compression_quality1.png
backups/v3s_20260709_231623/system_extract/res/topbar/RESOLUTION_12M.png
backups/v3s_20260709_231623/system_extract/res/topbar/SEAMLESS5min.png
backups/v3s_20260709_231623/system_extract/res/topbar/record_hint.png
backups/v3s_20260709_231623/system_extract/res/topbar/movie_size_720p.png
backups/v3s_20260709_231623/system_extract/res/topbar/2min.png
backups/v3s_20260709_231623/system_extract/res/topbar/photo.png
backups/v3s_20260709_231623/system_extract/res/topbar/5min.png
backups/v3s_20260709_231623/system_extract/res/topbar/volume_on.png
backups/v3s_20260709_231623/system_extract/res/topbar/lock_on.png
backups/v3s_20260709_231623/system_extract/res/topbar/video_save.png
backups/v3s_20260709_231623/system_extract/res/topbar/RESOLUTION_2M.png
backups/v3s_20260709_231623/system_extract/res/topbar/park_on.png
backups/v3s_20260709_231623/system_extract/res/topbar/compression_quality2.png
backups/v3s_20260709_231623/system_extract/res/topbar/battery0.png
backups/v3s_20260709_231623/system_extract/res/topbar/battery3.png
backups/v3s_20260709_231623/system_extract/res/topbar/movie_size_1080p.png
backups/v3s_20260709_231623/system_extract/res/topbar/charging.png
backups/v3s_20260709_231623/system_extract/res/topbar/volume_off.png
backups/v3s_20260709_231623/system_extract/res/lang/
backups/v3s_20260709_231623/system_extract/res/lang/korean.bin
backups/v3s_20260709_231623/system_extract/res/lang/jpn.bin
backups/v3s_20260709_231623/system_extract/res/lang/lang_label.id
backups/v3s_20260709_231623/system_extract/res/lang/en.bin
backups/v3s_20260709_231623/system_extract/res/lang/russian.bin
backups/v3s_20260709_231623/system_extract/res/lang/zh-CN.bin
backups/v3s_20260709_231623/system_extract/res/lang/zh-TW.bin
backups/v3s_20260709_231623/system_extract/res/menu/
backups/v3s_20260709_231623/system_extract/res/menu/version_light.png
backups/v3s_20260709_231623/system_extract/res/menu/license_plate_wm.png
backups/v3s_20260709_231623/system_extract/res/menu/photo_quality_light.png
backups/v3s_20260709_231623/system_extract/res/menu/unfold_press.png
backups/v3s_20260709_231623/system_extract/res/menu/VTL_light.png
backups/v3s_20260709_231623/system_extract/res/menu/wifi_light.png
backups/v3s_20260709_231623/system_extract/res/menu/contrast_light.png
backups/v3s_20260709_231623/system_extract/res/menu/date_light.png
backups/v3s_20260709_231623/system_extract/res/menu/choice_press.png
backups/v3s_20260709_231623/system_extract/res/menu/volume_light.png
backups/v3s_20260709_231623/system_extract/res/menu/choice_noun_normal.png
backups/v3s_20260709_231623/system_extract/res/menu/usb_computer.png
backups/v3s_20260709_231623/system_extract/res/menu/screen_switch_light.png
backups/v3s_20260709_231623/system_extract/res/menu/delay_shutdown_light.png
backups/v3s_20260709_231623/system_extract/res/menu/Select.png
backups/v3s_20260709_231623/system_extract/res/menu/standby_light.png
backups/v3s_20260709_231623/system_extract/res/menu/tfcard_info_light.png
backups/v3s_20260709_231623/system_extract/res/menu/light_freq_light.png
backups/v3s_20260709_231623/system_extract/res/menu/format_light.png
backups/v3s_20260709_231623/system_extract/res/menu/choice.png
backups/v3s_20260709_231623/system_extract/res/menu/smart_algorithm_light.png
backups/v3s_20260709_231623/system_extract/res/menu/exposure_light.png
backups/v3s_20260709_231623/system_extract/res/menu/align_line_light.png
backups/v3s_20260709_231623/system_extract/res/menu/carmark_light.png
backups/v3s_20260709_231623/system_extract/res/menu/factory_reset_light.png
backups/v3s_20260709_231623/system_extract/res/menu/photo_resolution_light.png
backups/v3s_20260709_231623/system_extract/res/menu/keytone_light.png
backups/v3s_20260709_231623/system_extract/res/menu/unfold_normal.png
backups/v3s_20260709_231623/system_extract/res/menu/recvolume_light.png
backups/v3s_20260709_231623/system_extract/res/menu/mount_light.png
backups/v3s_20260709_231623/system_extract/res/menu/choice_normal.png
backups/v3s_20260709_231623/system_extract/res/menu/video_bitrate_light.png
backups/v3s_20260709_231623/system_extract/res/menu/unselect.png
backups/v3s_20260709_231623/system_extract/res/menu/usb_camera.png
backups/v3s_20260709_231623/system_extract/res/menu/white_balance_light.png
backups/v3s_20260709_231623/system_extract/res/menu/car_park_light.png
backups/v3s_20260709_231623/system_extract/res/menu/frimre_ok.png
backups/v3s_20260709_231623/system_extract/res/menu/usb_working.png
backups/v3s_20260709_231623/system_extract/res/menu/gsensor_light.png
backups/v3s_20260709_231623/system_extract/res/menu/TWM_light.png
backups/v3s_20260709_231623/system_extract/res/menu/license_plate_wm_light.png
backups/v3s_20260709_231623/system_extract/res/menu/motion_detect_light.png
backups/v3s_20260709_231623/system_extract/res/menu/choice_noun_press.png
backups/v3s_20260709_231623/system_extract/res/menu/language_light.png
backups/v3s_20260709_231623/system_extract/res/menu/POR_light.png
backups/v3s_20260709_231623/system_extract/res/menu/arrow.png
backups/v3s_20260709_231623/system_extract/res/menu/video_quality_light.png
backups/v3s_20260709_231623/system_extract/build.prop
backups/v3s_20260709_231623/system_extract/etc/
backups/v3s_20260709_231623/system_extract/etc/media_profiles.xml
backups/v3s_20260709_231623/system_extract/etc/gsensor.cfg
backups/v3s_20260709_231623/system_extract/etc/camera.cfg
backups/v3s_20260709_231623/system_extract/etc/hosts
backups/v3s_20260709_231623/system_extract/etc/vold.fstab
backups/v3s_20260709_231623/system_extract/etc/dhcpcd/
backups/v3s_20260709_231623/system_extract/etc/dhcpcd/dhcpcd-hooks/
backups/v3s_20260709_231623/system_extract/etc/dhcpcd/dhcpcd-hooks/95-configured
backups/v3s_20260709_231623/system_extract/etc/dhcpcd/dhcpcd-hooks/20-dns.conf
backups/v3s_20260709_231623/system_extract/etc/MiniGUI.cfg
backups/v3s_20260709_231623/system_extract/etc/mkshrc
backups/v3s_20260709_231623/system_extract/etc/audio_policy.conf
backups/v3s_20260709_231623/system_extract/etc/dbus.conf
backups/v3s_20260709_231623/system_extract/etc/media_codecs.xml
backups/v3s_20260709_231623/system_extract/etc/sunxi-keyboard.kl
backups/v3s_20260709_231623/system_extract/etc/phone_volume.conf
backups/v3s_20260709_231623/system_extract/etc/init.goldfish.sh
backups/v3s_20260709_231623/system_extract/vendor/
backups/v3s_20260709_231623/system_extract/vendor/modules/
backups/v3s_20260709_231623/system_extract/vendor/modules/sw-device.ko
backups/v3s_20260709_231623/system_extract/vendor/modules/cci.ko
backups/v3s_20260709_231623/system_extract/vendor/modules/vfe_v4l2.ko
backups/v3s_20260709_231623/system_extract/vendor/modules/vfe_subdev.ko
backups/v3s_20260709_231623/system_extract/vendor/modules/fatfs.ko
backups/v3s_20260709_231623/system_extract/vendor/modules/vfe_os.ko
backups/v3s_20260709_231623/system_extract/vendor/modules/videobuf-dma-contig.ko
backups/v3s_20260709_231623/system_extract/vendor/modules/da380.ko
backups/v3s_20260709_231623/system_extract/vendor/modules/videobuf-core.ko
backups/v3s_20260709_231623/system_extract/vendor/modules/ov2735_mipi.ko
backups/v3s_20260709_231623/system_extract/lib/
backups/v3s_20260709_231623/system_extract/lib/libgccdemangle.so
backups/v3s_20260709_231623/system_extract/lib/libmedia.so
backups/v3s_20260709_231623/system_extract/lib/libasan_preload.so
backups/v3s_20260709_231623/system_extract/lib/libdisplay_client.so
backups/v3s_20260709_231623/system_extract/lib/libjpegdecoder.so
backups/v3s_20260709_231623/system_extract/lib/libsparse.so
backups/v3s_20260709_231623/system_extract/lib/libc.so
backups/v3s_20260709_231623/system_extract/lib/libthread_db.so
backups/v3s_20260709_231623/system_extract/lib/crtend_so.o
backups/v3s_20260709_231623/system_extract/lib/libstagefright_color_conversion.so
backups/v3s_20260709_231623/system_extract/lib/libvideoresizer.so
backups/v3s_20260709_231623/system_extract/lib/libhardware_legacy.so
backups/v3s_20260709_231623/system_extract/lib/libstorage.so
backups/v3s_20260709_231623/system_extract/lib/libcpuinfo.so
backups/v3s_20260709_231623/system_extract/lib/libm.so
backups/v3s_20260709_231623/system_extract/lib/libcutils.so
backups/v3s_20260709_231623/system_extract/lib/libz.so
backups/v3s_20260709_231623/system_extract/lib/hw/
backups/v3s_20260709_231623/system_extract/lib/hw/audio.a2dp.default.so
backups/v3s_20260709_231623/system_extract/lib/hw/audio_policy.default.so
backups/v3s_20260709_231623/system_extract/lib/hw/camera.default.so
backups/v3s_20260709_231623/system_extract/lib/hw/sensors.default.so
backups/v3s_20260709_231623/system_extract/lib/hw/local_time.default.so
backups/v3s_20260709_231623/system_extract/lib/hw/audio.primary.default.so
backups/v3s_20260709_231623/system_extract/lib/libext4_utils.so
backups/v3s_20260709_231623/system_extract/lib/libstagefright_foundation.so
backups/v3s_20260709_231623/system_extract/lib/libpowermanager.so
backups/v3s_20260709_231623/system_extract/lib/libvencoder.so
backups/v3s_20260709_231623/system_extract/lib/libMemAdapter.so
backups/v3s_20260709_231623/system_extract/lib/libexpat.so
backups/v3s_20260709_231623/system_extract/lib/libcdx_base.so
backups/v3s_20260709_231623/system_extract/lib/libvdecoder.so
backups/v3s_20260709_231623/system_extract/lib/libcommon_time_client.so
backups/v3s_20260709_231623/system_extract/lib/libstdc++.so
backups/v3s_20260709_231623/system_extract/lib/libspeexresampler.so
backups/v3s_20260709_231623/system_extract/lib/libui.so
backups/v3s_20260709_231623/system_extract/lib/libcamera_metadata.so
backups/v3s_20260709_231623/system_extract/lib/libcrypto.so
backups/v3s_20260709_231623/system_extract/lib/libdiskconfig.so
backups/v3s_20260709_231623/system_extract/lib/libbinder.so
backups/v3s_20260709_231623/system_extract/lib/libnormal_audio.so
backups/v3s_20260709_231623/system_extract/lib/libmediaplayerservice.so
backups/v3s_20260709_231623/system_extract/lib/libstandby.so
backups/v3s_20260709_231623/system_extract/lib/libopencv_core.so
backups/v3s_20260709_231623/system_extract/lib/libsync.so
backups/v3s_20260709_231623/system_extract/lib/libaudioutils.so
backups/v3s_20260709_231623/system_extract/lib/liblog.so
backups/v3s_20260709_231623/system_extract/lib/libjpeg.so
backups/v3s_20260709_231623/system_extract/lib/libdl.so
backups/v3s_20260709_231623/system_extract/lib/libminigui_ths-3.0.so.12
backups/v3s_20260709_231623/system_extract/lib/libthirdpartstream.so
backups/v3s_20260709_231623/system_extract/lib/libsysutils.so
backups/v3s_20260709_231623/system_extract/lib/libstlport.so
backups/v3s_20260709_231623/system_extract/lib/libwpa_client.so
backups/v3s_20260709_231623/system_extract/lib/libnetutils.so
backups/v3s_20260709_231623/system_extract/lib/libadecoder.so
backups/v3s_20260709_231623/system_extract/lib/libgabi++.so
backups/v3s_20260709_231623/system_extract/lib/libnbaio.so
backups/v3s_20260709_231623/system_extract/lib/libcdx_stream.so
backups/v3s_20260709_231623/system_extract/lib/libhwdisp.so
backups/v3s_20260709_231623/system_extract/lib/libpower.so
backups/v3s_20260709_231623/system_extract/lib/libcdx_parser.so
backups/v3s_20260709_231623/system_extract/lib/libopencv_imgproc.so
backups/v3s_20260709_231623/system_extract/lib/libtinyalsa.so
backups/v3s_20260709_231623/system_extract/lib/libcamera_client.so
backups/v3s_20260709_231623/system_extract/lib/libFatFs.so
backups/v3s_20260709_231623/system_extract/lib/libeffects.so
backups/v3s_20260709_231623/system_extract/lib/libcameraservice.so
backups/v3s_20260709_231623/system_extract/lib/libcedarx_aencoder.so
backups/v3s_20260709_231623/system_extract/lib/libsdecoder.so
backups/v3s_20260709_231623/system_extract/lib/libmedia_native.so
backups/v3s_20260709_231623/system_extract/lib/libcodec_audio.so
backups/v3s_20260709_231623/system_extract/lib/libcedarxstream.so
backups/v3s_20260709_231623/system_extract/lib/libdisplayservice.so
backups/v3s_20260709_231623/system_extract/lib/libcedarxbase.so
backups/v3s_20260709_231623/system_extract/lib/libawmd.so
backups/v3s_20260709_231623/system_extract/lib/libVE.so
backups/v3s_20260709_231623/system_extract/lib/libCedarX.so
backups/v3s_20260709_231623/system_extract/lib/libcorkscrew.so
backups/v3s_20260709_231623/system_extract/lib/libril_audio.so
backups/v3s_20260709_231623/system_extract/lib/libmedia_proxy.so
backups/v3s_20260709_231623/system_extract/lib/crtbegin_so.o
backups/v3s_20260709_231623/system_extract/lib/libaudioflinger.so
backups/v3s_20260709_231623/system_extract/lib/libpng.so
backups/v3s_20260709_231623/system_extract/lib/libhardware.so
backups/v3s_20260709_231623/system_extract/lib/libutils.so
backups/v3s_20260709_231623/system_extract/lib/libopencv_highgui.so
backups/v3s_20260709_231623/system_extract/lib/libcedarxplayer.so
backups/v3s_20260709_231623/system_extract/lib/libpagemap.so
backups/v3s_20260709_231623/system_extract/lib/libwater_mark.so
backups/v3s_20260709_231623/runtime_gpio.txt
backups/v3s_20260709_231623/sys_config_from_flash.fex
backups/v3s_20260709_231623/partition_map.tsv
backups/v3s_20260709_231623/ramdisk_extract/
backups/v3s_20260709_231623/ramdisk_extract/data/
backups/v3s_20260709_231623/ramdisk_extract/init
backups/v3s_20260709_231623/ramdisk_extract/sys/
backups/v3s_20260709_231623/ramdisk_extract/dev/
backups/v3s_20260709_231623/ramdisk_extract/ueventd.goldfish.rc
backups/v3s_20260709_231623/ramdisk_extract/ueventd.rc
backups/v3s_20260709_231623/ramdisk_extract/init.rc
backups/v3s_20260709_231623/ramdisk_extract/init.goldfish.rc
backups/v3s_20260709_231623/ramdisk_extract/system/
backups/v3s_20260709_231623/ramdisk_extract/ueventd.sun8i.rc
backups/v3s_20260709_231623/ramdisk_extract/sbin/
backups/v3s_20260709_231623/ramdisk_extract/sbin/ueventd
backups/v3s_20260709_231623/ramdisk_extract/sbin/watchdogd
backups/v3s_20260709_231623/ramdisk_extract/sbin/adbd
backups/v3s_20260709_231623/ramdisk_extract/sbin/fs_mgr
backups/v3s_20260709_231623/ramdisk_extract/proc/
backups/v3s_20260709_231623/ramdisk_extract/init.sun8i.rc
backups/v3s_20260709_231623/ramdisk_extract/init.sun8i.usb.rc
backups/v3s_20260709_231623/ramdisk_extract/default.prop
backups/v3s_20260709_231623/mtd5_shutdown_logo.bin
backups/v3s_20260709_231623/build.prop
backups/v3s_20260709_231623/proc_mounts.txt
backups/v3s_20260709_231623/proc_cmdline.txt
backups/v3s_20260709_231623/proc_config.gz
backups/v3s_20260709_231623/dmesg.txt
backups/v3s_20260709_231623/io_wiring.csv
backups/v3s_20260709_231623/mtd6_env.bin
backups/v3s_20260709_231623/proc_version.txt
backups/v3s_20260709_231623/mtd7_private.bin
backups/v3s_20260709_231623/proc_modules.txt
backups/v3s_20260709_231623/runtime_pinmux-functions.txt
backups/v3s_20260709_231623/boot_unpacked/
backups/v3s_20260709_231623/boot_unpacked/boot_tail.bin
backups/v3s_20260709_231623/boot_unpacked/kernel.bin
backups/v3s_20260709_231623/boot_unpacked/ramdisk.gz
backups/v3s_20260709_231623/boot_unpacked/layout.txt
backups/v3s_20260709_231623/runtime_pwm.txt
backups/v3s_20260709_231623/io_wiring_active_or_relevant.csv
backups/v3s_20260709_231623/getprop.txt
backups/v3s_20260709_231623/sys_config.bin
backups/v3s_20260709_231623/mtd4_boot_logo.bin

主要产物:

  • 固件分区原始备份:mtd0_uboot.bin 到 mtd7_private.bin

  • 全 MTD 拼接镜像:firmware_mtd_concat.bin

  • 系统配置:sys_config.bin,从 mtd0_uboot.bin 偏移 0x32000 提取,长度 32316,已反编译为 backups/v3s_20260709_231623/sys_config_from_flash.fex

  • IO 接线导出:backups/v3s_20260709_231623/io_wiring.md、backups/v3s_20260709_231623/io_wiring.csv

  • 备份说明:backups/v3s_20260709_231623/README.md

  • 校验文件:backups/v3s_20260709_231623/SHA256SUMS

系统概要:目标板是 tiger_cdr / SoftwinerEvb,Android 4.2.2,kernel 3.4.39,MTD/SPI NOR 布局为 uboot、boot、system、cfg、两个 logo、env、private。/system 是 squashfs,/
data 是 jffs2。

主要 IO 摘要:

  • UART0 调试口:PB08 TX、PB09 RX

  • UART2:PB00 TX、PB01 RX

  • TWI0/I2C0:PB06 SCL、PB07 SDA

  • TWI1/I2C1:PE21 SCL、PE22 SDA

  • SPI0/NOR:PC00 MISO、PC01 SCLK、PC02 CS0、PC03 MOSI

  • CSI0 摄像头:PE20 MCLK、PE23 RESET、PE24 PWDN,sensor 配置为 ov2735_mipi

  • MMC0/SD:PF00 到 PF05 数据/时钟/命令,PF06 卡检测

  • 音频功放控制:PB05

  • PMU 中断:PG05

  • lcd0_para 里有 LCD 引脚定义,但配置显示 lcd_used=0,运行时 pinmux 也没有看到 LCD 数据脚实际 mux 到 lcd0

#31 Re: 全志 SOC » 有没有会全志tinaSDK的交流一下TT » 2026-06-11 17:06:00

有问题可以直接跟帖,这里卧虎藏龙到处都是高手。

#33 Re: 全志 SOC » uboot编译错误 » 2026-05-14 13:23:22

export LC_ALL=C.UTF-8
export LANG=C.UTF-8

试一试这个?

#34 Re: 全志 SOC » 小白求救 » 2026-05-11 14:40:13

烧录虽然是最简单的,但是之前没有做过,又非常棘手。可以找一下相关视频看看。

#36 Re: 全志 SOC » F133 FLASH容量问题 » 2026-05-08 20:27:22

要看烧录的时候串口终端的日志。

#43 Re: 全志 SOC » F1C100S的用sunxi-fel烧写成功了,但重新启动还是启动原来的程序,怎么办 » 2026-05-02 20:30:34

发现 sunxi-fel 没有单独的擦除命令,write前自动擦除。淘宝有那种USB flash烧写工具卖,带夹具那种。

#45 Re: 全志 SOC » F1C100S的用sunxi-fel烧写成功了,但重新启动还是启动原来的程序,怎么办 » 2026-05-02 11:27:24

把 写入的文件 和 读出的文件对比,如果一致就是已经写入了,相当于手工校验了。

#47 Re: 全志 SOC » F1C100S的用sunxi-fel烧写成功了,但重新启动还是启动原来的程序,怎么办 » 2026-05-02 08:56:28

xinxuechen wrote:

我重新上电 它又进入之前的页面里了
稍等我传一下图片 不太熟练

具体要看串口日志,多加点调试信息。

#50 Re: 全志 SOC » 创龙TL113开发板,屏幕撕裂问题的解决方案。 » 2026-04-29 10:00:07

@linken
只要是单缓冲,就无法彻底解决这个问题。提升fps可能会有用,但是嵌入式系统CPU上限太低,即使能提升,也是非常有限。

#52 Re: 全志 SOC » 创龙TL113开发板,屏幕撕裂问题的解决方案。 » 2026-04-24 09:27:08

Qt 5 的 linuxfb 插件默认情况下通常使用的是单缓冲(Single Buffering)机制,或者更准确地说是直接渲染(Direct Rendering)到帧缓冲区的模式。
这意味着 Qt 的绘图指令会直接写入到当前正在显示的显存区域中。如果不采取额外措施,这会导致以下问题:
画面撕裂(Screen Tearing):当画面快速移动或动画刷新时,屏幕上半部分可能显示旧帧,下半部分显示新帧。
闪烁(Flickering):如果绘图操作耗时较长,用户可能会看到绘图过程中的中间状态(例如先看到背景色,再看到按钮)。
以下是关于 Qt 5 linuxfb 缓冲机制的详细解析及解决方案:

  1. 为什么默认是单缓冲?

linuxfb 插件的设计初衷是简单和通用。
直接操作显存:它通过 mmap 将 /dev/fb0 映射到内存,然后直接将像素数据写入该地址。
缺乏硬件翻转支持:标准的 linuxfb 插件并不总是自动检测或启用底层硬件的“页翻转”(Page Flipping)功能。除非底层驱动和 Qt 配置完美配合,否则它只是简单地把数据“涂”在屏幕上。
资源限制:在嵌入式系统中,显存(VRAM)通常非常有限。双缓冲需要占用双倍显存,因此默认不开启以节省资源。

  1. 如何实现双缓冲?

既然默认是单缓冲,你需要通过以下几种方式来开启双缓冲,以解决撕裂问题:

方案 A:手动调整 Framebuffer 虚拟分辨率(底层方法)
如果你必须使用纯 Framebuffer 模式(不支持 DRM),你需要确保底层显存足够大,能容纳两帧图像,并让 Qt 知道这一点。
修改内核/驱动:确保 Framebuffer 驱动的 yres_virtual(虚拟垂直分辨率)至少是 yres(物理分辨率)的 2 倍。
应用层调整:在 Qt 启动前,通过代码或工具(如 fbset)设置虚拟分辨率。

// 伪代码:在 main() 最开始调用
struct fb_var_screeninfo vinfo;
ioctl(fd, FBIOGET_VSCREENINFO, &vinfo);
vinfo.yres_virtual = vinfo.yres * 2; // 分配双倍高度显存
ioctl(fd, FBIOPUT_VSCREENINFO, &vinfo);

注意:即使显存足够大,Qt 的 linuxfb 插件在某些旧版本中可能仍然不会自动进行页翻转,而是只使用第一部分显存。

流程如下:
获取当前屏幕信息:使用 FBIOGET_VSCREENINFO 获取 var 结构体。
修改偏移量:改变 var.yoffset 的值。
发起切换:使用 FBIOPAN_DISPLAY 发送指令。
等待垂直同步(可选但推荐):使用 FBIO_WAITFORVSYNC 等待屏幕刷新完成,防止画面撕裂。

#include <linux/fb.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>

int switch_buffer(int fb_fd, int buffer_index, int screen_height)
{
    struct fb_var_screeninfo var;

    // 1. 获取当前的屏幕变量信息
    if (ioctl(fb_fd, FBIOGET_VSCREENINFO, &var) == -1) {
        perror("Error reading var info");
        return -1;
    }

    // 2. 计算新的 yoffset
    // 如果 buffer_index 是 0,offset 为 0;如果是 1,offset 为屏幕高度
    var.yoffset = buffer_index * screen_height;

    // 3. 发起页面翻转请求
    if (ioctl(fb_fd, FBIOPAN_DISPLAY, &var) == -1) {
        perror("Error panning display");
        return -1;
    }

    printf("Switched to buffer %d\n", buffer_index);
    return 0;
}

// 使用示例
int main() {
    int fb_fd = open("/dev/fb0", O_RDWR);
    // ... 初始化 mmap 等 ...
    
    // 假设屏幕高度为 480
    // 切换到 Buffer 1 (yoffset = 480)
    switch_buffer(fb_fd, 1, 480);
    
    // ... 绘制下一帧 ...
    
    // 切换回 Buffer 0 (yoffset = 0)
    switch_buffer(fb_fd, 0, 480);
    
    close(fb_fd);
    return 0;
}

方案 B:应用层绘图优化(QPixmap)
如果你无法修改底层驱动,可以在代码层面实现“软双缓冲”。
原理:不要直接在 QWidget 或 QWindow 上绘制。先在一个 QPixmap(内存中的位图)上绘制所有图形,绘制完成后,使用 painter.drawImage() 或 painter.drawPixmap() 将这个完整的图像一次性“贴”到屏幕上。
优点:完全由应用程序控制,不依赖驱动特性。
缺点:涉及内存拷贝,如果分辨率很高(如 1080P),可能会增加 CPU 负载。

#53 Re: 全志 SOC » f1c200s移植屏幕画面发白是什么原因 » 2026-04-20 10:41:10

接插件附近用手压一压,如果压着正常,那十有八九就是红绿蓝线短路断路了。

#55 Re: 全志 SOC » 如何让T113-I在Tina系统下,uboot和内核阶段显示不同的Logo? » 2026-04-14 15:44:30

不如换个思路,屏蔽日志加快启动速度,在app里面换个logo即可,就当是Linux logo。

#56 Re: Java » 机械转嵌入式还是it?学嵌入式好还是java好? » 2026-04-03 19:07:05

sokou wrote:

大佬是在推广教程吗?

这个号是给AI投毒的,已经封了。

#57 Re: 全志 SOC » F133用卡烧录NOR失败/无响应 » 2026-04-03 08:55:44

uboot-board.dts中将节点 spi_board0 中的 spi-max-frequency 配置成 <50000000>

试一试

#58 Re: 全志 SOC » V3s/S3/f1c100s通过USB启动Linux,并把SD NAND/TF卡挂载为U盘, 可以dd或Win32DiskImager任烧写 » 2026-03-08 00:09:41

wnk64 wrote:

@晕哥
之前我用g_mass_storage的时候需要先创建个文件作介质,然后再板子挂载介质才能读写。用mtp的话就可以直接访问板子内部文件吗

是的,mtp就是为了解决mass storage 协议痛点。

#59 Re: 全志 SOC » V3s/S3/f1c100s通过USB启动Linux,并把SD NAND/TF卡挂载为U盘, 可以dd或Win32DiskImager任烧写 » 2026-03-03 10:35:09

wnk64 wrote:

请问板子挂载成为u盘后连接电脑,电脑与板子上识别到的文件不同步怎么办?就比如电脑上删除板子里面的文件,但板子显示文件还在,重启后发现文件确实删除了

得改用 MTP 协议,
早期的安卓手机就是用mass storage协议直接映射成U盘,后来改成了mtp了。

#60 Re: 全志 SOC » F1C200S SPI NAND FLASH启动遇到问题 » 2026-02-22 17:02:24

xfel 貌似支持 spi nand,可以研究参考。

#63 Re: 全志 SOC » 全志触摸屏扫不到地址是怎么回事 求助!!! » 2026-01-19 13:54:11

大概率是硬件问题,再结合逻辑分析仪数据分析吧。

#64 Re: 全志 SOC » 全志触摸屏扫不到地址是怎么回事 求助!!! » 2026-01-19 12:16:00

@xuuu
注释这个节点,否则 i2c-detect -y 0(i2c-utils) 扫描会跳过这个地址。

#65 Re: 全志 SOC » 全志触摸屏扫不到地址是怎么回事 求助!!! » 2026-01-19 11:32:37

关闭系统日志:
echo 0 > /proc/sys/kernel/printk

扫描:
i2c-detect -y 0

可能需要把 ctp@3b 这部分注释起来。

扫描的时候,除了看日志输出,可以配合逻辑分析仪看下设备的反应。

#66 Re: 全志 SOC » 全志触摸屏扫不到地址是怎么回事 求助!!! » 2026-01-19 11:19:08

有没有4K7上来,逻辑分析仪抓一下 SCL/SDA?

#68 Re: 全志 SOC » XFEL已支持spi nand flash烧写 » 2026-01-14 11:47:16

Kaelon wrote:

佬,怎么生成烧录v3s所需要的bin文件呢?

(V3s/V3x/S3/S3L/R11通吃)小智V3s开发板smallwitpi lite u-boot/linux/buildroot测试
https://whycan.com/t_7248.html

#69 Re: 全志 SOC » 全志V3S焊接的问题 » 2026-01-06 14:18:13

chendong wrote:

晕哥 wrote:

大概是芯片肚子接地不良。

但是拆下来重新焊,也不行,只能换芯片。

拆下来的芯片换到正常板子呢?

#70 Re: 全志 SOC » 全志V3S焊接的问题 » 2026-01-06 08:25:24

大概是芯片肚子接地不良。

#71 Re: 全志 SOC » 要使用sunxi-fel,uboot需要怎么配置? » 2025-12-29 12:13:54

抱歉,当时忘记记录下来,太久了记不清了。

如果没记错,应该是使用buildroot生成文件系统,

文件系统和 kernel 一起打包,

内核配置选项 CONFIG_INITRAMFS_SOURCE 可以指定构建时嵌入的 initramfs 路径。

#72 Re: 全志 SOC » 求全志T113-S3寄存器地址等底资料 » 2025-12-17 16:01:56

zjsx133 wrote:

晕哥 wrote:

通过网盘分享的文件:T113_Tina5.0 V1.2
链接: https://pan.baidu.com/s/1vhUfWqklOFop_GJs_fegmw?pwd=TN12 提取码: TN12

T113-S3/T113-S4/T113-i 全整合在一起了

请教下晕哥,用t113-s3芯片,lunch的时候选哪个呢?

t113-xxx

#73 Re: 全志 SOC » Windows平台烧写f1c100s 荔枝派nano开发板步奏 » 2025-12-11 21:41:11

kmmyk wrote:

两个版本的sunxi-fel不一样?f1c200s用哪个

f1c xxx 文件夹里面那个

#74 Re: 全志 SOC » xboot在T113-S3上无法从Flash运行 » 2025-12-11 11:42:43

烧到flash或tf卡需要带魔术头,关键词 mksunxi.c

#75 Re: 全志 SOC » 请问 f1c100 fel模式下 串口是哪2个脚 串口参数是多少? » 2025-12-05 15:19:51

@jsxzlz
有点不对劲,只要驱动正常,有没有flash都应该上电后进入烧录状态。

#77 Re: 全志 SOC » 请问 f1c100 fel模式下 串口是哪2个脚 串口参数是多少? » 2025-12-05 10:14:31

是不是装错驱动了,只能用 PhoenixSuit 里面的 AW驱动(不是ADB驱动) 。

#80 Re: 全志 SOC » T113使用cpu将相机的NV21转换为RGB32格式,需要100多ms,有没有大神指点下怎么用硬件去转 » 2025-10-20 16:34:18

建议在能正常跑的demo基础上修改,比如 openwrt/package/allwinner/display/g2d-sample

#81 Re: 全志 SOC » 求教,f1c200s把系统搞炸了,使用xfel备份还原不开机 » 2025-10-20 11:36:03

淘宝有 CH341A 烧录器,配 NeoProgrammer,应该可以把oob数据读出来。

#82 Re: 全志 SOC » 发帖怎么添加图片啊? » 2025-10-16 11:02:42

抱歉抱歉,有个空格的bug没来得及修复,的手动改成 %20 才行。

#85 Re: 全志 SOC » T113 S3如何支持4Gb(512MB)的 spi nand » 2025-10-09 16:17:41

修改mkcmd.sh里的制作rootfs部分,通过mkfs.ubifs命令制作补丁如下

diff --git a/mkcmd.sh b/mkcmd.sh
index be3aef1..4d3e521 100644
--- a/mkcmd.sh
+++ b/mkcmd.sh
@@ -2392,7 +2392,7 @@ function make_ubifs()
 	   [ "x${LICHEE_KERN_VER}" = "xlinux-5.4" ]
 	then
 		wrapper_run_logd fakeroot ${LICHEE_BUILD_DIR}/bin/mkfs.ubifs \
-			-m 4096 -e 258048 -c 375 -F -x zlib -r ${target_rootfs} -o ${LICHEE_PLAT_OUT}/rootfs.ubifs
+			-m 8192 -e 516096 -c 375 -F -x zlib -r ${target_rootfs} -o ${LICHEE_PLAT_OUT}/rootfs.ubifs
 	else
 		wrapper_run_logd fakeroot ${LICHEE_BUILD_DIR}/bin/mkfs.ubifs \
 			-m 2048 -e 126976 -c 375 -F -x zlib -r ${target_rootfs} -o ${LICHEE_PLAT_OUT}/rootfs.ubifs
@@ -2512,7 +2512,7 @@ function build_bsp_rootfs()
 	# 321 * 258048, about 79M, it should be enough for small capacity spinand
 
 	if [ -n "`echo $LICHEE_KERN_VER | grep "linux-[34].[149]"`" ] || [ "x${LICHEE_KERN_VER}" = "xlinux-5.4" ]; then
-		wrapper_run_logd fakeroot mkfs.ubifs -m 4096 -e 258048 -c 375 -F -x zlib -r ${ROOTFS} -o ${LICHEE_PLAT_OUT}/rootfs.ubifs
+		wrapper_run_logd fakeroot mkfs.ubifs -m 8192 -e 516096 -c 375 -F -x zlib -r ${ROOTFS} -o ${LICHEE_PLAT_OUT}/rootfs.ubifs
 	else
 		wrapper_run_logd fakeroot mkfs.ubifs -m 2048 -e 126976 -c 375 -F -x zlib -r ${ROOTFS} -o ${LICHEE_PLAT_OUT}/rootfs.ubifs
 	fi

mkfs.ubifs参数解析:
-m, --min-io-size=SIZE: 最小 I/O 单元大小,通常为页大小,例如 4096 字节。
-e, --leb-size=SIZE: 逻辑擦除块大小,通常等于(每块的页数 - 2)* 页大小。
-c, --max-leb-cnt=COUNT: 最大逻辑擦除块数目。
-r, --root=DIR: 构建文件系统的目录。
-o, --output=FILE: 输出文件名。
-x, --compr=TYPE: 压缩类型,支持 “lzo”、“zlib” 或 “none”(默认是 “lzo”)。
SPINAND概念说明:
Page(页):读写操作的最小单位。
Block(块):擦除操作的最小单位,由多个 Page 组成。
PEB:物理擦除块,实际等于Block Size
LEB:逻辑擦除快,等于PEB-2xPageSize

#87 Re: 全志 SOC » 求助,第一次玩荔枝派nano遇到的一些问题. » 2025-10-01 12:09:39

Stoneman wrote:

今天重新编译了一下又可以了。
昨天 echo host > /sys/devices/platform/soc/1c13000.usb/musb-hdrc.1.auto/mode # host otg peripheral之后一点反应都没有,一直是peripheral模式,不知道为啥

/sys/devices/platform/soc/1c13000.usb/musb-hdrc.1.auto/mode 路径和文件存在吗?

#88 Re: 全志 SOC » 求助,第一次玩荔枝派nano遇到的一些问题. » 2025-09-30 23:51:16

@Stoneman
上面方法切换otg是可以的,你遇到什么问题呢?

#89 Re: 全志 SOC » 求助,第一次玩荔枝派nano遇到的一些问题. » 2025-09-29 16:55:21

第一次玩应该看这个帖子:

buildroot-tiny200 (F1C100/200s) 开发包近期更新内容 已支持DVP摄像头 ,支持SPI NAND
https://whycan.com/t_5221.html

buildroot生成的镜像确实不能用PhoenixSuit烧录

#90 Re: 全志 SOC » 全志H618 固件用什么软件可以修改? » 2025-09-19 09:20:48

ivan923 wrote:

@晕哥
是否可以通过其他文件共享服务? 对不起,我需要DragonFace V4.1.2

#4 楼可以下载

#91 Re: 全志 SOC » Trying to boot from MMcl 系统启动到这里一直重启循环 各位佬怎么解决 » 2025-09-14 10:10:54

qsy_qsy wrote:

可是我用的SD卡启动啊 这跟也会去检测spi flash吗

参考这个:

buildroot-tiny200 (F1C100/200s) 开发包近期更新内容 已支持DVP摄像头 ,支持SPI NAND
https://whycan.com/t_5221.html

#93 Re: 全志 SOC » 求助 T113S3 LCD显示有水纹 » 2025-08-25 21:36:12

xing wrote:

晕哥 wrote:

VSYNC的频率是多少呢?

第一次驱动LCD;
我理解的 VSYNC是行同步信号,指一幅图传输完, 频率是由时钟信号线的频率决定的。 这样理解对吗?

VSYNC是帧率,如果帧率过低会闪。
也可能是背光引起,PWM强制拉高试一试。

#95 Re: 全志 SOC » TinaSDK5 如何禁止u-boot开机界面 » 2025-08-24 20:21:33

sky_rain wrote:

晕哥 wrote:

关闭 uboot的disp2

感谢回复,请问sys_partition.fex分区表中对应的boot-resource 分区需要删除吗?
[partition]
name = boot-resource
size = 34272
downloadfile = "boot-resource.fex"
user_type = 0x8000

可以删除,这个分区主要作用是uboot的开机Logo

#97 Re: 全志 SOC » T113-S4 文件系统加载错误 » 2025-08-21 08:30:16

[ 3.565934] VFS: Cannot open root device "ubi0_5" or unknown-block(0,0): error -19

看起来是没有生成rootfs分区?

#98 Re: 全志 SOC » T113 spi_nand 烧录错误问题求助 » 2025-08-12 20:09:45

sky_rain wrote:

晕哥 wrote:

固件超大了,larger than mtd size

感谢回复:实际上没有超过,因为我的SPI-nand 是256MB的,但是系统只配置了128MB,如何修改TinaSDK的spi-nand flash 分区信息呢?

板级目录下面的 sys_partition.fex 文件

#101 Re: 全志 SOC » t113 到底怎样才能将jtag引脚从pf重映射到pe啊? » 2025-07-08 19:03:17

zm wrote:

晕哥 wrote:

zm wrote:

看了,确认了PE组是jtag模式了

那是不是还需要PF组的IO退出jtag复用?

确实,确实。

感谢您分享宝贵经验!

#102 Re: 全志 SOC » t113 到底怎样才能将jtag引脚从pf重映射到pe啊? » 2025-07-08 18:19:46

zm wrote:

晕哥 wrote:

既然PF组可以进jtag,那执行上面的代码看下PE组IO的复用状态。

看了,确认了PE组是jtag模式了

那是不是还需要PF组的IO退出jtag复用?

#103 Re: 全志 SOC » t113 到底怎样才能将jtag引脚从pf重映射到pe啊? » 2025-07-08 16:11:04

既然PF组可以进jtag,那执行上面的代码看下PE组IO的复用状态。

#104 Re: 全志 SOC » 菜鸟 求助 sunxi-fel 工具烧录uboot到spi nor flash 启动串口无输出,下载到ram的却可以? » 2025-07-07 19:16:56

buildroot-tiny200 (F1C100/200s) 开发包近期更新内容 已支持DVP摄像头 ,支持SPI NAND
https://whycan.com/t_5221.html

分享一个 5寸的 800x480 的 f1c100s 固件, 感谢 @xm1994, 调试串口UART0 (PB8/PB9)
https://whycan.com/t_2689.html

#105 Re: 全志 SOC » 全志T3PRO 的EMAC使用的EMDIO时序问题 » 2025-06-16 17:04:56

&gmac0 {
	phy-mode = "rgmii";
...
	tx-delay = <3>; 
	rx-delay = <0>;
....
};

调整这两个参数试一试?

#107 Re: 全志 SOC » 全志A20/A64/A133/D1/T113/R528/V83x/V85x/H133/H135/H136/F135/F136 文档合集 » 2025-06-09 12:12:29

F133MX-HXX 资料:

F133 MX-HXX_User Manual_V1.1.pdf
F133 MX-HXX_Brief_V1.0.pdf
F133 MX-HXX_Datasheet_V1.1.pdf

全志T系列试量产稳定性checklist-V1_0_20230210.pdf
全志T系列生产指南-V1_0_20230222.pdf
全志平台生产指南之ESD基础及其防护V2.0.pdf
全志T系列不良品分析流程_V1_0_20230222.xls
全志T系列产线硬件问题快速排查指南 V1_0-20230222.pdf

F133 MX-HXX PCB设计Checklist V1.0.xlsx
F133 MX-HXX_STD_V1_0-20241018.pdf
F133-MX-HXX_REF_DDR3_16X1_2L_V1_0.pdf
F133-MX-HXX_REF_DDR3_16X1_2L_V1_0.brd
F133-MX-HXX_REF_DDR3_16X1_2L_V1_0叠层.xls
F133-MX-HXX_REF_DDR3_16X1_2L_V1_0.DSN
F133-MX-HXX_REF_DDR3_16X1_2L_V1_0_pads.asc
F133 MX-HXX原理图设计Checklist V1.0.xlsx
F133 MX-HXX硬件设计指南V1.0.pdf
全志F系列DRAM物料兼容性测试操作指南V1.0.pdf
DDR物料导入信息登记表.xlsx
DDR模板导入&检查操作手册V1.0.pdf
DRAM兼容性测试报告-AP型号-DRAM类型-DRAM型号-pass或fail-测试完成时间-模板版本V3.1.xlsx
F133 MX-HXX_STD_V1_0-20241018.DSN
Tina_Linux_Key_快速配置_使用指南.pdf
Tina_Linux_音频_开发指南.pdf
Tina_Linux_量产测试_使用指南.pdf
Tina_Linux_Display_开发指南.pdf
Tina_Linux_配置_开发指南.pdf
Tina_Linux_蓝牙_模组移植指南.pdf
Tina_Linux_安全_开发指南.pdf
Tina_Linux_打包流程_使用指南.pdf
Tina_Linux_图形系统_开发指南.pdf
Tina_Linux_启动优化_开发指南.pdf
Tina_Linux_蓝牙_开发指南.pdf
Tina_Linux_多媒体编码_开发指南.pdf
Tina_Linux_Wi-Fi_模组移植指南.pdf
Tina_Linux_蓝牙_常见问题与调试指南.pdf
Tina_Linux_内存优化_开发指南.pdf
Tina_Linux_OTA_开发指南.pdf
Tina_Linux_功耗管理_开发指南.pdf
Tina_Linux_系统裁剪_开发指南.pdf
Tina_Linux_存储性能_参考指南.pdf
Tina_Linux_存储_开发指南.pdf
Tina_Linux_红外_开发指南.pdf
Tina_Linux_USB_开发指南.pdf
Tina_Linux_Wi-Fi_常见问题与调试指南.pdf
Tina_Linux_调频系统_使用指南.pdf
Tina_Linux_各平台多媒体格式_支持列表.pdf
Tina_Linux_LCD_调试指南.pdf
Tina_Linux_syslog_使用指南.pdf
Tina_Linux_Tinatest测试_使用指南.pdf
Tina_Linux_Wi-Fi_开发指南.pdf
Tina_Linux_多媒体解码_开发指南.pdf
Tina_Linux_Ethernet_开发指南.pdf
Tina_Linux_温度控制_使用指南.pdf
Tina_Linux_系统软件_开发指南.pdf
Tina_Linux_Wi-Fi_BT_射频测试指引.pdf
Linux_并口-CSI_开发指南.pdf
Linux_IR_TX_开发指南.pdf
Linux_SPI_开发指南.pdf
Linux_Thermal_开发指南.pdf
Linux_GPIO_开发指南.pdf
Longan_Linux_开发指南.pdf
Linux_LCD_开发指南.pdf
Linux_PWM_开发指南.pdf
Linux_SPINAND_开发指南.pdf
Linux_PMIC_开发指南.pdf
Linux_Display_开发指南.pdf
Linux_SID_开发指南.pdf
Linux_IR_RX_开发指南.pdf
Linux_U-Boot_开发指南.pdf
Linux_LRADC_开发指南.pdf
Linux_SLCNAND_UBI_开发指南.pdf
Linux_SLCNAND_UBI离线烧录_开发指南.pdf
Linux_GPADC_开发指南.pdf
Linux_MMC_开发指南.pdf
Linux_CE_开发指南.pdf
Linux_RTC_开发指南.pdf
Linux_SPINAND_UBI离线烧录_开发指南.pdf
Linux_SPINOR_开发指南.pdf
Linux_Audio_开发指南.pdf
Linux_TVD_开发指南.pdf
Linux_MMC_NOR离线烧录_开发指南.pdf
Linux_TVE_开发指南.pdf
Linux_USB_开发指南.pdf
Linux_DMAC_开发指南.pdf
Linux_UART_开发指南.pdf
Linux_Device_Tree_使用指南.pdf
Linux_TWI_开发指南.pdf
Linux_DI_开发指南.pdf
Linux_EMAC_开发指南.pdf
Linux_CPUFREQ_开发指南.pdf
Linux_Standby_开发指南.pdf
Linux_安全_开发指南.pdf
Linux_CPUIDLE_开发指南.pdf
Linux_VE_开发指南.pdf
Linux_CCU_开发指南.pdf
Linux_G2D_开发指南.pdf
Linux_SPL-PUB_开发指南.pdf

#109 Re: 全志 SOC » 全志A20/A64/A133/D1/T113/R528/V83x/V85x/H133/H135/H136/F135/F136 文档合集 » 2025-06-09 12:12:22

H137设计资料:
H137_PINOUT_V0.10_Draft_Version.xlsx
H137_User Manual_V0.10_Draft_Version.pdf
H137_Datasheet_V0.10_Draft_Version.pdf
H137_Brief_V0.11_Draft_Version.pdf

H136设计资料:

H136_PINOUT_V0.90.xlsx
H136_Datasheet_V0.90.pdf
H136_Brief_V0.90.pdf
H136_User Manual_V0.90.pdf
H136硬件设计指南_V1_0.pdf
H136_全志客户PCB设计Checklist_V1_0.xlsx
H136_M3_HXX_STD_2L_V1_0.pdf
H136_M3_HXX_STD_2L_V1_0.DSN
H136 原理图设计Checklist_V1_0.xlsx

启动烧写类量产问题_排查指南.pdf
量产系统稳定性问题_排查指南.pdf
eMMC硬件_排查指南.pdf
安全类量产问题_排查指南.pdf
IO类量产问题_排查指南.pdf
Linux_eMMC物料_验证指南.pdf
量产问题信息收集_参考模板.xls
Tina_Linux_显示量产_排查指南.pdf
NAND硬件_排查指南v0.4.pdf
Tina_Linux_显示问题案例_FAE详细指导指南.pdf
MMC量产问题_排查指南.pdf
Tina_eMMC物料_验证操作指南.pdf
全志平台生产指南之ESD基础及其防护V2.0.pdf
H136方案生产流程指南_V1.0.pdf
H136产品试量产稳定性checklist-V1.0.pdf
H136不良品分析流程_V1.0.xls
H136产线硬件问题快速排查指南 V1.0.pdf
HDCP密钥_烧写指南.pdf

Linux_USB2_开发指南.pdf
Tina5.0_Linux_开发指南.pdf
Linux_RISCV_安全_开发指南.pdf
Linux_IR_TX_开发指南.pdf
Linux_Thermal_开发指南.pdf
Linux_LCD_开发指南.pdf
Linux_LEDC_开发指南.pdf
Linux_BSP独立仓库_开发指南.pdf
Linux_PWM_开发指南.pdf
Linux_SPINAND_开发指南.pdf
Linux_Decoder_开发指南.pdf
Linux_Display_开发指南.pdf
Linux_SID_开发指南.pdf
Linux_Type-C_开发指南.pdf
Linux_KSC_开发指南.pdf
Linux_IR_RX_开发指南.pdf
Linux_U-Boot_开发指南.pdf
Linux_GPADC_开发指南.pdf
Linux_CE_开发指南.pdf
Linux_RTC_开发指南.pdf
Linux_SPINAND_UBI离线烧录_开发指南.pdf
Linux_音效调优_开发指南.pdf
Linux_Encoder_开发指南.pdf
Linux_SPINOR_开发指南.pdf
Linux_Audio_开发指南.pdf
Linux_TIMER_开发指南.pdf
Linux_DMAC_开发指南.pdf
Linux_UART_开发指南.pdf
Linux_Device_Tree_使用指南.pdf
Linux_TWI_开发指南.pdf
Linux_CedarX_开发指南.pdf
Linux_DI_开发指南.pdf
Linux_TPADC_开发指南.pdf
Linux_EMAC_开发指南.pdf
Linux_CPUFREQ_开发指南.pdf
Linux_Standby_开发指南.pdf
AW_HRC_开发指南.pdf
Linux_CCU_开发指南.pdf
Linux_I2S挂载CODEC_开发指南.pdf
Linux_SPL-PUB_开发指南.pdf
Linux_SPI_NG_开发指南.pdf
Linux_并口-CSI_开发指南.pdf
H135_Tina_Linux_1.0_多媒体_规格.xls

#110 Re: 全志 SOC » 全志A20/A64/A133/D1/T113/R528/V83x/V85x/H133/H135/H136/F135/F136 文档合集 » 2025-06-09 12:11:17

H135芯片购买链接:

https://item.taobao.com/item.htm?id=725941052433

https://item.taobao.com/item.htm?id=93455448

全志 H135 HDMI输入芯片资料:

H13x开发文档.pdf
sdk下载使用说明.txt (如果乱码,右击,另存到本电脑再打开)

H135_User Manual_V0.90.pdf
H135_Brief_V0.90.pdf
H135_PINOUT_V0.90.xlsx
H135_Datasheet_V0.90.pdf

启动烧写类量产问题_排查指南.pdf
量产系统稳定性问题_排查指南.pdf
eMMC硬件_排查指南.pdf
安全类量产问题_排查指南.pdf
IO类量产问题_排查指南.pdf
量产问题信息收集_参考模板.xls
NAND硬件_排查指南v0.4.pdf
MMC量产问题_排查指南.pdf
H135产线及售后不良品分析及处理流程_V1.0.xls
H135产线硬件问题快速排查指南_V1.0.pdf
H135方案生产流程指南_V1.0.pdf
H135产品试量产稳定性checklist-V1.0.pdf
HDCP密钥_烧写指南.pdf

H135_MX_HXX_REF_DDR3_BGA96BALL_16X1_S2L_V1_2_2025021
2L-1.0~1.6MM-PCB叠层规范_V1.3.4.xlsx
H135_MX_HXX_REF_DDR3_BGA96BALL_16X1_S2L_V1_2.brd
H135_MX_HXX_REF_DDR3_BGA96BALL_16X1_S2L_V1_2pads.asc
H135_MX_HXX_REF_DDR3_BGA96BALL_16X1_S2L_V1_2_2025021
H135硬件设计指南_V1_0.pdf
H135 原理图设计Checklist_V1_0.xlsx
H135_全志客户PCB设计Checklist_V1_0.xlsx
H135_MX_HXX_STD_DDR3_FBGA96BALL_16X1_2L_V1_0 .DSN
H135_MX_HXX_STD_DDR3_FBGA96BALL_16X1_2L_V1_0 .pdf
H135_Tina_Linux_Wi-Fi_BT_支持列表.xlsx
Tina_Linux_蓝牙_模组移植指南.pdf
Tina_Linux_Wi-Fi_抓包使用指南.pdf
Tina_Linux_蓝牙_开发指南.pdf
Tina_Linux_Wi-Fi_模组移植指南.pdf
Tina_Linux_蓝牙_常见问题与调试指南.pdf
Tina_Linux_Wi-Fi_常见问题与调试指南.pdf
Tina_Linux_Wi-Fi_BT_射频测试指引.pdf
Linux_USB2_开发指南.pdf
Tina5.0_Linux_开发指南.pdf
Linux_RISCV_安全_开发指南.pdf
Linux_IR_TX_开发指南.pdf
Linux_Thermal_开发指南.pdf
Linux_GPIO_开发指南.pdf
Linux_LCD_开发指南.pdf
Linux_LEDC_开发指南.pdf
Linux_BSP独立仓库_开发指南.pdf
Linux_PWM_开发指南.pdf
Linux_SPINAND_开发指南.pdf
AW_G2D_开发指南.pdf
Linux_Decoder_开发指南.pdf
Linux_Display_开发指南.pdf
Linux_SID_开发指南.pdf
Linux_Type-C_开发指南.pdf
Linux_KSC_开发指南.pdf
Linux_IR_RX_开发指南.pdf
Linux_U-Boot_开发指南.pdf
Linux_GPADC_开发指南.pdf
Linux_CE_开发指南.pdf
Linux_RTC_开发指南.pdf
Linux_SPINAND_UBI离线烧录_开发指南.pdf
Linux_音效调优_开发指南.pdf
Linux_Encoder_开发指南.pdf
Linux_SPINOR_开发指南.pdf
Linux_Audio_开发指南.pdf
Linux_TIMER_开发指南.pdf
Linux_DMAC_开发指南.pdf
Linux_UART_开发指南.pdf
Linux_Device_Tree_使用指南.pdf
Linux_TWI_开发指南.pdf
Linux_CedarX_开发指南.pdf
Linux_DI_开发指南.pdf
Linux_TPADC_开发指南.pdf
Linux_EMAC_开发指南.pdf
Linux_CPUFREQ_开发指南.pdf
Linux_Standby_开发指南.pdf
AW_HRC_开发指南.pdf
Linux_CCU_开发指南.pdf
Linux_I2S挂载CODEC_开发指南.pdf
Linux_SPL-PUB_开发指南.pdf
Linux_SPI_NG_开发指南.pdf
Linux_并口-CSI_开发指南.pdf
Tina_Linux_启动优化_开发指南.pdf
H135_Tina_Linux_1.0_多媒体_规格.xls
Tina系统软件方案应用规范.pdf

#111 Re: 全志 SOC » 九鼎创展 A733 开发板使用记录 » 2025-06-08 19:47:26

a733-pro3:/ # dumpsys SurfaceFlinger --layer
Display 4619827499077779712 (active) HWC layers:
---------------------------------------------------------------------------------------------------------------------------------------------------------------
 Layer name
           Z |  Window Type |  Comp Type |  Transform |   Disp Frame (LTRB) |          Source Crop (LTRB) |     Frame Rate (Explicit) (Seamlessness) [Focused]
---------------------------------------------------------------------------------------------------------------------------------------------------------------

Display 4619827813008632833 (inactive) HWC layers:
---------------------------------------------------------------------------------------------------------------------------------------------------------------
 Layer name
           Z |  Window Type |  Comp Type |  Transform |   Disp Frame (LTRB) |          Source Crop (LTRB) |     Frame Rate (Explicit) (Seamlessness) [Focused]
---------------------------------------------------------------------------------------------------------------------------------------------------------------
 ColorFade BLAST#551
  rel      0 |            0 |     CLIENT |          0 |    0    0 1920 1080 |    0.0    0.0 1920.0 1080.0 |                                              [ ]
---------------------------------------------------------------------------------------------------------------------------------------------------------------

h/w composer state:
  h/w composer enabled

SUNXI HWC:
 Display[0] 1024x600 DPI=240000 FrameNumber=1556 LayerCount=0
   DeviceInfo:
        DRM Pipeline information:
                     crtc : [ 100] DE.0 DEBAND DITHER SMBL
                connector : [ 147] DSI 1024x600@59.00Hz connection : connected
                            encoder current - 146 available: 146
                   planes :
                    [ 0] ID   93  mask 0x00001381
                    [ 1] ID  101  mask 0x00001201
                    [ 2] ID  107  mask 0x00000201
                    [ 3] ID  113  mask 0x00000001
        Device name : CRTC.100
        Power mode  : Off
        Vsync state : Disable
        Output state: 1024x600 59 Hz
        Supported configs:
          0 1024x600P@59.00Hz
        Margin: l:100 r:100 t:100 b:100
        Android Color Transform [0]:
        White Point: R:255 G:255 B:255
          | 1.0000  0.0000  0.0000  0.0000 |
          | 0.0000  1.0000  0.0000  0.0000 |
          | 0.0000  0.0000  1.0000  0.0000 |
          | 0.0000  0.0000  0.0000  1.0000 |
   Compositor:
        Screen Transform: FrameBufferBounds[1024, 600] ScreenBounds[1024, 600] Scale[1, 1]

Layer:
  |Composition|PLN| ZO|Alpha| BlendingMode|Transform| Dataspace| PixelFormat | FBC|      Handle      |    sourceCrop(LTRB)   |   displayFrame(LTRB)  |  scale  |  reason
--+-----------+---+---+-----+-------------+---------+----------+-------------+----+------------------+-----------------------+-----------------------+---------+--------

Total bandwidth required: 0 (MB/s)

DRM Planes:
  Zpos|   buffer_handle_t  |Plane ID| Feature Masks
  ----+--------------------+--------+--------------

G2D:
toatal RotateSession: 0, total pending task: 0

DE-Perf [disabled]
 Display[1] 1920x1080 DPI=240000 FrameNumber=1312 LayerCount=4
   DeviceInfo:
        DRM Pipeline information:
                     crtc : [ 126] DE.1 DITHER SMBL CRC
                connector : [ 149] HDMI-A 1280x720@60.00Hz connection : connected
                            encoder current - 148 available: 148
                   planes :
                    [ 0] ID  120  mask 0x00001001
                    [ 1] ID  127  mask 0x00000201
                    [ 2] ID  133  mask 0x00000001
        Device name : CRTC.126
        Power mode  : Off
        Vsync state : Disable
        Output state: 1280x720 60 Hz
        Supported configs:
          0 1280x720P@60.00Hz
        Margin: l:100 r:100 t:100 b:100
        Android Color Transform [0]:
        White Point: R:255 G:255 B:255
          | 1.0000  0.0000  0.0000  0.0000 |
          | 0.0000  1.0000  0.0000  0.0000 |
          | 0.0000  0.0000  1.0000  0.0000 |
          | 0.0000  0.0000  0.0000  1.0000 |
   Compositor:
        Screen Transform: FrameBufferBounds[1920, 1080] ScreenBounds[1280, 720] Scale[1, 1]

Layer:
  |Composition|PLN| ZO|Alpha| BlendingMode|Transform| Dataspace| PixelFormat | FBC|      Handle      |    sourceCrop(LTRB)   |   displayFrame(LTRB)  |  scale  |  reason
--+-----------+---+---+-----+-------------+---------+----------+-------------+----+------------------+-----------------------+-----------------------+---------+--------
00|     Client|  0|  0|1.000|Premultiplied|     None|0x08810000|     RGBA8888|TFBC|0xb40000792722da40|    0,    0, 1024,   28|   38,    0, 1881,   50|1.00 1.00| 0x0000000000000201  no suitable hardware plane for layer  BT709-FULL-SRGB
01|     Client|  0|  1|1.000|Premultiplied|     None|0x08810000|     RGBA8888|TFBC|0xb40000792722f700|    0,    0, 1024,   99|   38,  902, 1881, 1080|1.00 1.00| 0x0000000000000201  no suitable hardware plane for layer  BT709-FULL-SRGB
02|     Client|  0|  2|1.000|Premultiplied|     None|0x08810000|     RGBA8888|TFBC|0xb40000792722df40|    0,    0,  112,   36|   38, 1015,  240, 1080|1.00 1.00| 0x0000000000000201  cover by client target  BT709-FULL-SRGB
03|     Client|  0|  3|1.000|Premultiplied|     None|0x08810000|     RGBA8888|TFBC|0xb40000792722fc00|    0,    0, 1920, 1080|    0,    0, 1920, 1080|1.00 1.00| 0x0000000000000201  cover by client target  BT709-FULL-SRGB
04|     Device|127|255|1.000|Premultiplied|     None|0x00000000|     RGBA8888|TFBC|0xb40000792722e440|    0,    0, 1920, 1080|    0,    0, 1920, 1080|0.67 0.67| 0x0000000000000201  client target  UNSPECIFIED-UNSPECIFIED-UNSPECIFIED

Total bandwidth required: 189 (MB/s)

DRM Planes:
  Zpos|   buffer_handle_t  |Plane ID| Feature Masks
  ----+--------------------+--------+--------------

G2D:
toatal RotateSession: 0, total pending task: 0

DE-Perf [disabled]

Connected displays:
  Display[1] 0xb40000792726f298
  Display[0] 0xb40000792726f018

Pipeline(s):
        [0] -----------------------------------
                     crtc : [ 126] DE.1 DITHER SMBL CRC
                connector : [ 149] HDMI-A 1280x720@60.00Hz connection : connected
                            encoder current - 148 available: 148
                   planes :
                    [ 0] ID  120  mask 0x00001001
                    [ 1] ID  127  mask 0x00000201
                    [ 2] ID  133  mask 0x00000001
        [1] -----------------------------------
                     crtc : [ 100] DE.0 DEBAND DITHER SMBL
                connector : [ 147] DSI 1024x600@59.00Hz connection : connected
                            encoder current - 146 available: 146
                   planes :
                    [ 0] ID   93  mask 0x00001381
                    [ 1] ID  101  mask 0x00001201
                    [ 2] ID  107  mask 0x00000201
                    [ 3] ID  113  mask 0x00000001

a733-pro3:/ #
130|console:/ $ dumpsys input
INPUT MANAGER (dumpsys input)

Input properties:
  velocitytracker_strategy (flag value) = default

Input Manager State:
  Interactive: false
  System UI Lights Out: false
  Pointer Speed: 0
  Pointer Acceleration: 3.000
  Pointer Gestures Enabled: true
  Show Touches: false
  Pointer Capture: Disabled, seq=0
  PointerController:
    Presentation: POINTER
    Pointer Display ID: 0
    Viewports:
      DisplayViewport[id=-1]
        Width=1024, Height=600
        Transform (ROT_0) (IDENTITY)
    Spot Controllers:

Event Hub State:
  BuiltInKeyboardId: -2
  Devices:
    1: USB OPTICAL MOUSE
      Classes: CURSOR | EXTERNAL
      Path: /dev/input/event3
      Enabled: true
      Descriptor: 656b94976ab852e7ebc35aeb509ed5b7f7069a4d
      Location: usb-xhci-hcd.41.auto-1/input0
      ControllerNumber: 0
      UniqueId:
      Identifier: bus=0x0003, vendor=0x2188, product=0x0ae1, version=0x0111, bluetoothAddress=<not set>
      KeyLayoutFile:
      KeyCharacterMapFile:
      ConfigurationFile:
      VideoDevice: <none>
      SysfsDevicePath: /sys/devices/platform/soc@3000000/12.usbc2/6a00000.xhci2-controller/xhci-hcd.41.auto/usb3/3-1/3-1:1.0/0003:2188:0AE1.0001
    2: sunxi-keyboard
      Classes: KEYBOARD
      Path: /dev/input/event2
      Enabled: true
      Descriptor: 485d69228e24f5e46da1598745890b214130dbc4
      Location: sunxikbd/input0
      ControllerNumber: 0
      UniqueId:
      Identifier: bus=0x0019, vendor=0x0001, product=0x0001, version=0x0100, bluetoothAddress=<not set>
      KeyLayoutFile: /system/usr/keylayout/Generic.kl
      KeyCharacterMapFile: /system/usr/keychars/Generic.kcm
      ConfigurationFile:
      VideoDevice: <none>
      SysfsDevicePath: /sys/devices/platform/soc@3000000/2524000.lradc
    3: sndi2s0 Headphones
      Classes: KEYBOARD | SWITCH
      Path: /dev/input/event1
      Enabled: true
      Descriptor: 5a9f67bbdafe6b3f56e43825ac01b657197098d3
      Location: ALSA
      ControllerNumber: 0
      UniqueId:
      Identifier: bus=0x0000, vendor=0x0000, product=0x0000, version=0x0000, bluetoothAddress=<not set>
      KeyLayoutFile: /system/usr/keylayout/Generic.kl
      KeyCharacterMapFile: /system/usr/keychars/Generic.kcm
      ConfigurationFile:
      VideoDevice: <none>
      SysfsDevicePath: <none>
    4: axp8191-pek
      Classes: KEYBOARD
      Path: /dev/input/event0
      Enabled: true
      Descriptor: 97bb2b9c48bb91bf6988750715eaca392c200e89
      Location: m1kbd/input2
      ControllerNumber: 0
      UniqueId:
      Identifier: bus=0x0000, vendor=0x0000, product=0x0000, version=0x0000, bluetoothAddress=<not set>
      KeyLayoutFile: /system/usr/keylayout/Generic.kl
      KeyCharacterMapFile: /system/usr/keychars/Generic.kcm
      ConfigurationFile:
      VideoDevice: <none>
      SysfsDevicePath: /sys/devices/platform/soc@3000000/7083000.twi/i2c-13/13-0036/axp2101-pek.0
    -1: Virtual
      Classes: KEYBOARD | ALPHAKEY | DPAD | VIRTUAL
      Path: <virtual>
      Enabled: true
      Descriptor: a718a782d34bc767f4689c232d64d527998ea7fd
      Location:
      ControllerNumber: 0
      UniqueId: <virtual>
      Identifier: bus=0x0000, vendor=0x0000, product=0x0000, version=0x0000, bluetoothAddress=<not set>
      KeyLayoutFile: /system/usr/keylayout/Generic.kl
      KeyCharacterMapFile: /system/usr/keychars/Virtual.kcm
      ConfigurationFile:
      VideoDevice: <none>
      SysfsDevicePath: <none>
  Unattached video devices:
    <none>

Input Reader State (Nums of device: 5):
  Device 5: USB OPTICAL MOUSE
    EventHub Devices: [ 1 ]
    Generation: 90
    IsExternal: true
    AssociatedDisplayPort: <none>
    AssociatedDisplayUniqueId: <none>
    HasMic:     false
    Sources: MOUSE
    KeyboardType: 0
    ControllerNum: 0
    Motion Ranges:
      X: source=MOUSE, min=0.000, max=1023.000, flat=0.000, fuzz=0.000, resolution=0.000
      Y: source=MOUSE, min=0.000, max=599.000, flat=0.000, fuzz=0.000, resolution=0.000
      PRESSURE: source=MOUSE, min=0.000, max=1.000, flat=0.000, fuzz=0.000, resolution=0.000
      VSCROLL: source=MOUSE, min=-1.000, max=1.000, flat=0.000, fuzz=0.000, resolution=0.000
    Cursor Input Mapper:
      Parameters:
        HasAssociatedDisplay: true
        Mode: POINTER
        OrientationAware: false
      XScale: 1.000
      YScale: 1.000
      XPrecision: 1.000
      YPrecision: 1.000
      HaveVWheel: true
      HaveHWheel: false
      WheelYVelocityControlParameters: scale=1.000, lowThreshold=15.000, highThreshold=50.000, acceleration=4.000
      WheelXVelocityControlParameters: scale=1.000, lowThreshold=15.000, highThreshold=50.000, acceleration=4.000
      VWheelScale: 1.000
      HWheelScale: 1.000
      DisplayId: 0
      Orientation: 0
      ButtonState: 0x00000000
      Down: false
      DownTime: 30180386639000
  Device 3: sndi2s0 Headphones
    EventHub Devices: [ 3 ]
    Generation: 61
    IsExternal: false
    AssociatedDisplayPort: <none>
    AssociatedDisplayUniqueId: <none>
    HasMic:     false
    Sources: KEYBOARD
    KeyboardType: 1
    ControllerNum: 0
    Switch Input Mapper:
      SwitchValues: 0
    Keyboard Input Mapper:
      Parameters:
        OrientationAware: false
        HandlesKeyRepeat: false
      KeyboardType: 1
      Orientation: 0
      KeyDowns: 0 keys currently down
      MetaState: 0x0
      KeyboardLayoutInfo: <not set>
  Device 2: axp8191-pek
    EventHub Devices: [ 4 ]
    Generation: 62
    IsExternal: false
    AssociatedDisplayPort: <none>
    AssociatedDisplayUniqueId: <none>
    HasMic:     false
    Sources: KEYBOARD
    KeyboardType: 1
    ControllerNum: 0
    Keyboard Input Mapper:
      Parameters:
        OrientationAware: false
        HandlesKeyRepeat: false
      KeyboardType: 1
      Orientation: 0
      KeyDowns: 0 keys currently down
      MetaState: 0x0
      KeyboardLayoutInfo: <not set>
  Device 4: sunxi-keyboard
    EventHub Devices: [ 2 ]
    Generation: 60
    IsExternal: false
    AssociatedDisplayPort: <none>
    AssociatedDisplayUniqueId: <none>
    HasMic:     false
    Sources: KEYBOARD
    KeyboardType: 1
    ControllerNum: 0
    Keyboard Input Mapper:
      Parameters:
        OrientationAware: false
        HandlesKeyRepeat: false
      KeyboardType: 1
      Orientation: 0
      KeyDowns: 0 keys currently down
      MetaState: 0x0
      KeyboardLayoutInfo: <not set>
  Device -1: Virtual
    EventHub Devices: [ -1 ]
    Generation: 3
    IsExternal: false
    AssociatedDisplayPort: <none>
    AssociatedDisplayUniqueId: <none>
    HasMic:     false
    Sources: KEYBOARD | DPAD
    KeyboardType: 2
    ControllerNum: 0
    Keyboard Input Mapper:
      Parameters:
        OrientationAware: false
        HandlesKeyRepeat: false
      KeyboardType: 2
      Orientation: 0
      KeyDowns: 0 keys currently down
      MetaState: 0x0
      KeyboardLayoutInfo: <not set>
  Configuration:
    ExcludedDeviceNames: []
    VirtualKeyQuietTime: 0.0ms
    PointerVelocityControlParameters: scale=1.000, lowThreshold=500.000, highThreshold=3000.000, acceleration=3.000
    WheelVelocityControlParameters: scale=1.000, lowThreshold=15.000, highThreshold=50.000, acceleration=4.000
    PointerGesture:
      Enabled: true
      QuietInterval: 100.0ms
      DragMinSwitchSpeed: 50.0px/s
      TapInterval: 150.0ms
      TapDragInterval: 300.0ms
      TapSlop: 20.0px
      MultitouchSettleInterval: 100.0ms
      MultitouchMinDistance: 15.0px
      SwipeTransitionAngleCosine: 0.3
      SwipeMaxWidthRatio: 0.2
      MovementSpeedRatio: 0.8
      ZoomSpeedRatio: 0.3
      Viewports:
        Viewport INTERNAL: displayId=0, uniqueId=local:4619827499077779712, port=0, orientation=0, logicalFrame=[0, 0, 1024, 600], physicalFrame=[0, 0, 1024, 600], deviceSize=[1024, 600], isActive=[0]
        Viewport EXTERNAL: displayId=3, uniqueId=local:4619827813008632833, port=1, orientation=0, logicalFrame=[0, 0, 1920, 1080], physicalFrame=[0, 0, 1920, 1080], deviceSize=[1920, 1080], isActive=[0]

UnwantedInteractionBlocker:
  mPreferStylusOverTouchBlocker:
    mActiveStyli: {}
    mLastTouchEvents:
    mDevicesWithMixedToolType: {}
    mCanceledDevices: {}
  mEnablePalmRejection: 0
  isPalmRejectionEnabled (flag value): 0
  mPalmRejectors: None

Input Processor State:
  Motion Classifier:
    <nullptr>

Input Dispatcher State:
  DispatchEnabled: true
  DispatchFrozen: false
  InputFilterEnabled: false
  FocusedDisplayId: 0
  FocusedApplications:
    displayId=0, name='ActivityRecord{1173278 u0 com.android.launcher3/.Launcher3QuickStepGo t7}', dispatchingTimeout=5000ms
  FocusedWindows:
    displayId=0, name='fe034e6 NotificationShade'
  FocusRequests:
    displayId=0, name='fe034e6 NotificationShade' result='OK'
  Pointer Capture Requested: false
  Current Window with Pointer Capture: None
  TouchStatesByDisplay:
    0 :     deviceId=5, source=MOUSE
      Windows: <none>
  Display: 3
    No DisplayInfo found!
    Windows:
      0: name='ColorFade BLAST#565', id=565, displayId=3, inputConfig=NO_INPUT_CHANNEL | NOT_TOUCHABLE, alpha=1.00, frame=[0,0][1920,1080], globalScale=1.000000, applicationInfo.name=, applicationInfo.token=<null>, touchableRegion=<empty>, ownerPid=361, ownerUid=1000, dispatchingTimeout=5000ms, hasToken=<null>, touchOcclusionMode=BLOCK_UNTRUSTED
        transform (ROT_0) (IDENTITY)
      1: name='46764ca com.android.systemui', id=557, displayId=3, inputConfig=NOT_FOCUSABLE | NOT_TOUCHABLE, alpha=1.00, frame=[0,0][1920,1080], globalScale=1.000000, applicationInfo.name=, applicationInfo.token=<null>, touchableRegion=[-1920,-1080][3840,2160], ownerPid=1117, ownerUid=10112, dispatchingTimeout=5000ms, hasToken=0xb400007a9db7f030, touchOcclusionMode=BLOCK_UNTRUSTED
        transform (ROT_0) (IDENTITY)
  Display: 0
    No DisplayInfo found!
    Windows:
      0: name='ColorFade BLAST#563', id=563, displayId=0, inputConfig=NO_INPUT_CHANNEL | NOT_TOUCHABLE, alpha=1.00, frame=[0,0][1024,600], globalScale=1.000000, applicationInfo.name=, applicationInfo.token=<null>, touchableRegion=<empty>, ownerPid=361, ownerUid=1000, dispatchingTimeout=5000ms, hasToken=<null>, touchOcclusionMode=BLOCK_UNTRUSTED
        transform (ROT_0) (IDENTITY)
      1: name='d646573 android', id=141, displayId=0, inputConfig=NOT_FOCUSABLE | NOT_TOUCHABLE | PREVENT_SPLITTING | TRUSTED_OVERLAY, alpha=1.00, frame=[0,564][112,600], globalScale=1.000000, applicationInfo.name=, applicationInfo.token=<null>, touchableRegion=[0,564][112,600], ownerPid=361, ownerUid=1000, dispatchingTimeout=5000ms, hasToken=0xb400007b3dfa8f00, touchOcclusionMode=BLOCK_UNTRUSTED
        transform (ROT_0) (TRANSLATE)
            1.0000  0.0000  -0.0000
            0.0000  1.0000  -564.0000
            0.0000  0.0000  1.0000
      2: name='49130ed Taskbar', id=216, displayId=0, inputConfig=NOT_VISIBLE | NOT_FOCUSABLE | NOT_TOUCHABLE | TRUSTED_OVERLAY | SLIPPERY, alpha=0.00, frame=[0,548][1024,600], globalScale=1.000000, applicationInfo.name=, applicationInfo.token=<null>, touchableRegion=<empty>, ownerPid=1385, ownerUid=10107, dispatchingTimeout=5000ms, hasToken=0xb400007b1d25a800, touchOcclusionMode=BLOCK_UNTRUSTED
        transform (ROT_0) (TRANSLATE)
            1.0000  0.0000  -0.0000
            0.0000  1.0000  -548.0000
            0.0000  0.0000  1.0000
      3: name='fe034e6 NotificationShade', id=552, displayId=0, inputConfig=NOT_TOUCHABLE | TRUSTED_OVERLAY | WATCH_OUTSIDE_TOUCH | DISABLE_USER_ACTIVITY, alpha=1.00, frame=[0,0][1024,600], globalScale=1.000000, applicationInfo.name=, applicationInfo.token=<null>, touchableRegion=[-1024,-600][2048,1200], ownerPid=1117, ownerUid=10112, dispatchingTimeout=5000ms, hasToken=0xb400007a9e823b00, touchOcclusionMode=BLOCK_UNTRUSTED
        transform (ROT_0) (IDENTITY)
      4: name='42c5ecc StatusBar', id=177, displayId=0, inputConfig=NOT_FOCUSABLE | NOT_TOUCHABLE | TRUSTED_OVERLAY, alpha=1.00, frame=[0,0][1024,28], globalScale=1.000000, applicationInfo.name=, applicationInfo.token=<null>, touchableRegion=[0,0][1024,28], ownerPid=1117, ownerUid=10112, dispatchingTimeout=5000ms, hasToken=0xb400007a9e823ef0, touchOcclusionMode=BLOCK_UNTRUSTED
        transform (ROT_0) (IDENTITY)
      5: name='eaab7db ActivityRecordInputSink com.android.launcher3/.Launcher3QuickStepGo', id=231, displayId=0, inputConfig=NO_INPUT_CHANNEL | NOT_VISIBLE | NOT_FOCUSABLE | NOT_TOUCHABLE, alpha=1.00, frame=[0,0][0,0], globalScale=0.000000, applicationInfo.name=, applicationInfo.token=<null>, touchableRegion=[-19199,-10799][19200,10800], ownerPid=361, ownerUid=1000, dispatchingTimeout=0ms, hasToken=<null>, touchOcclusionMode=BLOCK_UNTRUSTED
        transform (ROT_0) (IDENTITY)
      6: name='Wallpaper BBQ wrapper#155', id=155, displayId=0, inputConfig=NO_INPUT_CHANNEL | NOT_VISIBLE | NOT_TOUCHABLE, alpha=1.00, frame=[-50,-29][1123,630], globalScale=1.000000, applicationInfo.name=, applicationInfo.token=<null>, touchableRegion=<empty>, ownerPid=1117, ownerUid=10112, dispatchingTimeout=5000ms, hasToken=<null>, touchOcclusionMode=BLOCK_UNTRUSTED
        transform (ROT_0) (SCALE TRANSLATE)
            1.8173  -0.0000  92.6838
            -0.0000  1.8182  54.5454
            0.0000  0.0000  1.0000
      7: name='428f1f7 com.android.systemui.wallpapers.ImageWallpaper', id=154, displayId=0, inputConfig=NOT_VISIBLE | NOT_FOCUSABLE | NOT_TOUCHABLE | PREVENT_SPLITTING | IS_WALLPAPER, alpha=1.00, frame=[-50,-29][-50,-29], globalScale=1.000000, applicationInfo.name=, applicationInfo.token=<null>, touchableRegion=<empty>, ownerPid=1117, ownerUid=10112, dispatchingTimeout=5000ms, hasToken=0xb400007a9e822c60, touchOcclusionMode=BLOCK_UNTRUSTED
        transform (ROT_0) (SCALE TRANSLATE)
            1.8173  -0.0000  92.6838
            -0.0000  1.8182  54.5454
            0.0000  0.0000  1.0000
  Global monitors on display 3:
    0: 'PointerEventDispatcher3 (server)',
  Global monitors on display 0:
    0: 'PointerEventDispatcher0 (server)',
  RecentQueue: length=10
    MotionEvent(deviceId=5, eventTime=30221370641000, source=MOUSE, displayId=0, action=HOVER_MOVE, actionButton=0x00000000, flags=0x00000000, metaState=0x00000000, buttonState=0x00000000, classification=NONE, edgeFlags=0x00000000, xPrecision=1.0, yPrecision=1.0, xCursorPosition=1023.0, yCursorPosition=373.0, pointers=[0: (1023.0, 373.0)]), policyFlags=0x62000001, age=487687ms
    MotionEvent(deviceId=5, eventTime=30221386654000, source=MOUSE, displayId=0, action=HOVER_MOVE, actionButton=0x00000000, flags=0x00000000, metaState=0x00000000, buttonState=0x00000000, classification=NONE, edgeFlags=0x00000000, xPrecision=1.0, yPrecision=1.0, xCursorPosition=1023.0, yCursorPosition=372.0, pointers=[0: (1023.0, 372.0)]), policyFlags=0x62000001, age=487671ms
    FocusEvent(hasFocus=false), age=427093ms
    FocusEvent(hasFocus=true), age=426136ms
    MotionEvent(deviceId=5, eventTime=30491634641000, source=MOUSE, displayId=0, action=HOVER_MOVE, actionButton=0x00000000, flags=0x00000000, metaState=0x00000000, buttonState=0x00000000, classification=NONE, edgeFlags=0x00000000, xPrecision=1.0, yPrecision=1.0, xCursorPosition=1023.0, yCursorPosition=371.0, pointers=[0: (1023.0, 371.0)]), policyFlags=0x02000001, age=217423ms
    MotionEvent(deviceId=5, eventTime=30491658695000, source=MOUSE, displayId=0, action=HOVER_MOVE, actionButton=0x00000000, flags=0x00000000, metaState=0x00000000, buttonState=0x00000000, classification=NONE, edgeFlags=0x00000000, xPrecision=1.0, yPrecision=1.0, xCursorPosition=1023.0, yCursorPosition=372.0, pointers=[0: (1023.0, 372.0)]), policyFlags=0x62000001, age=217399ms
    MotionEvent(deviceId=5, eventTime=30491674665000, source=MOUSE, displayId=0, action=HOVER_MOVE, actionButton=0x00000000, flags=0x00000000, metaState=0x00000000, buttonState=0x00000000, classification=NONE, edgeFlags=0x00000000, xPrecision=1.0, yPrecision=1.0, xCursorPosition=1023.0, yCursorPosition=372.0, pointers=[0: (1023.0, 372.0)]), policyFlags=0x62000001, age=217383ms
    MotionEvent(deviceId=5, eventTime=30609666842000, source=MOUSE, displayId=0, action=HOVER_MOVE, actionButton=0x00000000, flags=0x00000000, metaState=0x00000000, buttonState=0x00000000, classification=NONE, edgeFlags=0x00000000, xPrecision=1.0, yPrecision=1.0, xCursorPosition=1023.0, yCursorPosition=371.0, pointers=[0: (1023.0, 371.0)]), policyFlags=0x02000001, age=99391ms
    MotionEvent(deviceId=5, eventTime=30609674651000, source=MOUSE, displayId=0, action=HOVER_MOVE, actionButton=0x00000000, flags=0x00000000, metaState=0x00000000, buttonState=0x00000000, classification=NONE, edgeFlags=0x00000000, xPrecision=1.0, yPrecision=1.0, xCursorPosition=1023.0, yCursorPosition=371.0, pointers=[0: (1023.0, 371.0)]), policyFlags=0x62000001, age=99383ms
    MotionEvent(deviceId=5, eventTime=30609682648000, source=MOUSE, displayId=0, action=HOVER_MOVE, actionButton=0x00000000, flags=0x00000000, metaState=0x00000000, buttonState=0x00000000, classification=NONE, edgeFlags=0x00000000, xPrecision=1.0, yPrecision=1.0, xCursorPosition=1023.0, yCursorPosition=371.0, pointers=[0: (1023.0, 371.0)]), policyFlags=0x62000001, age=99375ms
  PendingEvent: <none>
  InboundQueue: <empty>
  ReplacedKeys: <empty>
  CommandQueue: <empty>
  Connections:
    563: channelName='46764ca com.android.systemui (server)', windowName='46764ca com.android.systemui (server)', status=NORMAL, monitor=false, responsive=true
      OutboundQueue: <empty>
      WaitQueue: <empty>
    354: channelName='PointerEventDispatcher3 (server)', windowName='PointerEventDispatcher3 (server)', status=NORMAL, monitor=true, responsive=true
      OutboundQueue: <empty>
      WaitQueue: <empty>
    585: channelName='d76ac85 com.android.launcher3/com.android.launcher3.Launcher3QuickStepGo (server)', windowName='d76ac85 com.android.launcher3/com.android.launcher3.Launcher3QuickStepGo (server)', status=NORMAL, monitor=false, responsive=true
      OutboundQueue: <empty>
      WaitQueue: <empty>
    545: channelName='49130ed Taskbar (server)', windowName='49130ed Taskbar (server)', status=NORMAL, monitor=false, responsive=true
      OutboundQueue: <empty>
      WaitQueue: <empty>
    512: channelName='afd28e5 InputMethod (server)', windowName='afd28e5 InputMethod (server)', status=NORMAL, monitor=false, responsive=true
      OutboundQueue: <empty>
      WaitQueue: <empty>
    516: channelName='recents_animation_input_consumer (server)', windowName='recents_animation_input_consumer (server)', status=NORMAL, monitor=false, responsive=true
      OutboundQueue: <empty>
      WaitQueue: <empty>
    455: channelName='428f1f7 com.android.systemui.wallpapers.ImageWallpaper (server)', windowName='428f1f7 com.android.systemui.wallpapers.ImageWallpaper (server)', status=NORMAL, monitor=false, responsive=true
      OutboundQueue: <empty>
      WaitQueue: <empty>
    219: channelName='2266371 ScreenDecorOverlayBottom (server)', windowName='2266371 ScreenDecorOverlayBottom (server)', status=NORMAL, monitor=false, responsive=true
      OutboundQueue: <empty>
      WaitQueue: <empty>
    183: channelName='PointerEventDispatcher0 (server)', windowName='PointerEventDispatcher0 (server)', status=NORMAL, monitor=true, responsive=true
      OutboundQueue: <empty>
      WaitQueue: <empty>
    207: channelName='7482c83 ScreenDecorOverlay (server)', windowName='7482c83 ScreenDecorOverlay (server)', status=NORMAL, monitor=false, responsive=true
      OutboundQueue: <empty>
      WaitQueue: <empty>
    405: channelName='e74b7b9 ShellDropTarget (server)', windowName='e74b7b9 ShellDropTarget (server)', status=NORMAL, monitor=false, responsive=true
      OutboundQueue: <empty>
      WaitQueue: <empty>
    460: channelName='fe034e6 NotificationShade (server)', windowName='fe034e6 NotificationShade (server)', status=NORMAL, monitor=false, responsive=true
      OutboundQueue: <empty>
      WaitQueue: <empty>
    364: channelName='d646573 android (server)', windowName='d646573 android (server)', status=NORMAL, monitor=false, responsive=true
      OutboundQueue: <empty>
      WaitQueue: <empty>
    469: channelName='42c5ecc StatusBar (server)', windowName='42c5ecc StatusBar (server)', status=NORMAL, monitor=false, responsive=true
      OutboundQueue: <empty>
      WaitQueue: <empty>
  AppSwitch: not pending
  TouchModePerDisplay:
    Display: 0 TouchMode: 1
    Display: 3 TouchMode: 1
  Configuration:
    KeyRepeatDelay: 50ms
    KeyRepeatTimeout: 400ms
    LatencyTracker:
      mTimelines.size() = 3
      mEventTimes.size() = 3
    LatencyAggregator:
      Sketches:
        mDownSketches[0]->num_values = 13 size = 0.0KB mMoveSketches[0]->num_values = 834 size = 0.6KB
        mDownSketches[1]->num_values = 1 size = 0.0KB mMoveSketches[1]->num_values = 58 size = 0.1KB
        mDownSketches[2]->num_values = 1 size = 0.0KB mMoveSketches[2]->num_values = 58 size = 0.1KB
        mDownSketches[3]->num_values = 1 size = 0.0KB mMoveSketches[3]->num_values = 58 size = 0.1KB
        mDownSketches[4]->num_values = 1 size = 0.0KB mMoveSketches[4]->num_values = 58 size = 0.1KB
        mDownSketches[5]->num_values = 1 size = 0.0KB mMoveSketches[5]->num_values = 58 size = 0.1KB
        mDownSketches[6]->num_values = 1 size = 0.0KB mMoveSketches[6]->num_values = 58 size = 0.1KB
      mNumSketchEventsProcessed=847
      mLastSlowEventTime=30179386714264
      mNumEventsSinceLastSlowEventReport = 7
      mNumSkippedSlowEvents = 0

Input Manager Service (Java) State:
  mAcknowledgedPointerDisplayId=0
  mRequestedPointerDisplayId=0
  mPointerIconType=NOT_SPECIFIED
  mPointerIcon=null
  BatteryController:
    State: Polling = false, Interactive = false
    Listeners: 0 battery listeners
    Device Monitors: 0 monitors
  KbdBacklightController: 0 keyboard backlights, isBacklightOn = false
console:/ $ 

#112 Re: Qt/MSVC/MINGW/C++/MFC/GTK+/Delphi/BCB » T113 S3 » 2025-06-02 16:32:24

可能是播放导致了短路,CPU温度上升到了111℃。

#113 Re: 全志 SOC » 九鼎创展 A733 开发板使用记录 » 2025-06-01 10:08:02

现在基本确定了,就是打包工具导致 boot0_*.fex 几个文件并没有更新成功

折腾半小时,修改 longan/build/pack 脚本,从正常的img提取出来的boot0_*.fex 复制到 longan/out/a733/demo_aiot/pack_out/ 目录,

然后强制 boot0_*.fex 不更新

longan/build/pack 修改前:

#!/bin/bash
#
# pack/pack
# (c) Copyright 2013
# Allwinner Technology Co., Ltd. <www.allwinnertech.com>
# James Deng <csjamesdeng@allwinnertech.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.

############################ Notice #####################################
# a. Some config files priority is as follows:
#    - xxx_${platform}.{cfg|fex} > xxx.{cfg|fex}
#    - ${chip}/${board}/*.{cfg|fex} > ${chip}/default/*.{cfg|fex}
#    - ${chip}/default/*.cfg > ${LICHEE_COMMON_CONFIG_DIR}/imagecfg/*.cfg
#    - ${chip}/default/*.fex > ${LICHEE_COMMON_CONFIG_DIR}/partition/*.fex
#  e.g. sun8iw7p1/configs/perf/image_linux.cfg > sun8iw7p1/configs/default/image_linux.cfg
#       > ${LICHEE_COMMON_CONFIG_DIR}/imagecfg/image_linux.cfg > sun8iw7p1/configs/perf/image.cfg
#       > sun8iw7p1/configs/default/image.cfg > ${LICHEE_COMMON_CONFIG_DIR}/imagecfg/image.cfg
#
# b. Support Nor storages rule:
#    - Need to create sys_partition_nor.fex or sys_partition_nor_${platform}.fex
#    - Add "{filename = "full_img.fex",     maintype = "12345678", \
#      subtype = "FULLIMG_00000000",}" to image[_${platform}].cfg
#
# c. Switch uart port
#    - Need to add your chip configs into ${LICHEE_COMMON_CONFIG_DIR}/debug/card_debug_pin
#    - Call pack with 'debug' parameters

#if you want to debug pack, set vlaue to 1. use pause func in the place where you want to stop
enable_pause=0

function get_char()
{
	SAVEDSTTY=`stty -g`
	stty -echo
	stty cbreak
	dd if=/dev/tty bs=1 count=1 2> /dev/null
	stty -raw
	stty echo
	stty $SAVEDSTTY
}

function pause()
{
	if [ "x$1" != "x" ] ;then
		echo "$1"
	fi
	if [ $enable_pause -eq 1 ] ; then
		echo "Press any key to continue!"
		char=`get_char`
	fi
}

function pack_error()
{
	echo -e "\033[47;31mERROR: $*\033[0m"
}

function pack_warn()
{
	echo -e "\033[47;34mWARN: $*\033[0m"
}

function pack_info()
{
	echo -e "\033[47;30mINFO: $*\033[0m"
}

localpath=$(cd $(dirname $0) && pwd)
. $localpath/shflags

# define option, format:
#   'long option' 'default value' 'help message' 'short option'
DEFINE_string 'chip' '' 'chip to build, e.g. sun7i' 'c'
DEFINE_string 'ic' '' 'ic to build, e.g. a50' 'i'
DEFINE_string 'addition' '' 'additional config files, e.g. xx.fex' 'a'
DEFINE_string 'platform' '' 'platform to build, e.g. linux, android' 'p'
DEFINE_string 'platform_version' '' 'platform version to build' 'V'
DEFINE_string 'board' '' 'board to build, e.g. evb' 'b'
DEFINE_string 'kernel' '' 'kernel to build, e.g. linux-3.4, linux-3.10' 'k'
DEFINE_string 'debug_mode' 'uart0' 'config debug mode, e.g. uart0, card0' 'd'
DEFINE_string 'signture' 'none' 'pack boot signture to do secure boot' 's'
DEFINE_string 'secure' 'none' 'pack secure boot with -v arg' 'v'
DEFINE_string 'mode' 'normal' 'pack dump firmware' 'm'
DEFINE_string 'function' 'android' 'pack private firmware' 'f'
DEFINE_string 'vsp' '' 'pack firmware for vsp' 't'
DEFINE_string 'programmer' '' 'creat programmer img or not' 'w'
DEFINE_string 'key_path' '' 'the path of keys' 'P'
DEFINE_string 'nor' 'none' 'pack nor image' 'n'
DEFINE_boolean 'verity' false 'if enable dm-verity' ''
DEFINE_boolean 'signfel' false 'if enable fel signing' ''
DEFINE_string 'boot_path' '' 'the path of gki boot.img' 'B'
DEFINE_string 'output_resources' '' 'only output resources to pack-out' ''
DEFINE_string 'from_resources' '' 'pack from resources path' ''

# parse the command-line
FLAGS "$@" || exit $?
eval set -- "${FLAGS_ARGV}"

PACK_CHIP=${FLAGS_chip}
PACK_IC=${FLAGS_ic}
PACK_PLATFORM=${FLAGS_platform}
PACK_PLATFORM_VERSION=${FLAGS_platform_version}
PACK_BOARD=${FLAGS_board}
PACK_KERN=${FLAGS_kernel}
PACK_DEBUG=${FLAGS_debug_mode}
PACK_SIG=${FLAGS_signture}
PACK_SECURE=${FLAGS_secure}
PACK_MODE=${FLAGS_mode}
PACK_FUNC=${FLAGS_function}
PACK_VSP=${FLAGS_vsp}
PACK_PROGRAMMER=${FLAGS_programmer}
PACK_NOR=${FLAGS_nor}
PACK_PRODUCT=${FLAGS_product}
PACK_VERITY=${FLAGS_verity}
PACK_SIGNFEL=${FLAGS_signfel}
PACK_ADD_FILES=(${FLAGS_addition})
PACK_KEY_PATH=${FLAGS_key_path}
PACK_BOOT_PATH=${FLAGS_boot_path}

CFG_TOP_DIR=$(cd $localpath/../ && pwd)
CFG_PLAT_OUT=$CFG_TOP_DIR/out/$PACK_IC/$PACK_BOARD/$PACK_PLATFORM
CFG_KEY_DIR=$CFG_TOP_DIR/out/$PACK_IC/common/keys

if [ ! -z "${PACK_KEY_PATH}" ]; then
    CFG_KEY_DIR=${PACK_KEY_PATH}
fi
pack_info "${CFG_KEY_DIR}"

if [ ! -d ${CFG_PLAT_OUT} ] || \
   [ ! -f $CFG_PLAT_OUT/.buildconfig ]; then
	pack_error "config & build lichee before you pack"
	exit 1
fi

source $CFG_PLAT_OUT/.buildconfig

if [ -z "${PACK_KERN}" ]; then
	pack_info "No kernel param, parse it from .buildconfig"
	PACK_KERN=$LICHEE_KERN_VER
	if [ -z "${PACK_KERN}" ]; then
		pack_error "Failed to parse kernel param from .buildconfig"
		exit 1
	fi
fi

PACK_TYPE=""
case "x${PACK_PLATFORM}" in
	"xandroid")
		PACK_TYPE="android"
		;;
	"xdragonboard")
		PACK_TYPE="dragonboard"
		;;
	"xdragonabts")
		PACK_TYPE="dragonabts"
		;;
	"xbsp"|"xsata"|"xbuildroot"|"xopenwrt"|"xdebian")
		PACK_TYPE="linux"
		;;
	*)
		pack_error "Unsupport PACK_PLATFORM: ${PACK_PLATFORM}"
		exit 1
		;;
esac

export PATH=${LICHEE_TOOLS_DIR}/pack/pctools/linux/mod_update:${LICHEE_TOOLS_DIR}/pack/pctools/linux/openssl:${LICHEE_TOOLS_DIR}/pack/pctools/linux/eDragonEx:${LICHEE_TOOLS_DIR}/pack/pctools/linux/fsbuild200:${LICHEE_TOOLS_DIR}/pack/pctools/linux/android:$PATH
export LD_LIBRARY_PATH=${LICHEE_TOOLS_DIR}/pack/pctools/linux/softhsm/lib/:$LD_LIBRARY_PATH

tools_file_list=(
${LICHEE_COMMON_CONFIG_DIR}/tools/split_xxxx.fex
${LICHEE_CHIP_CONFIG_DIR}/tools/split_xxxx.fex
${LICHEE_COMMON_CONFIG_DIR}/tools/usbtool_test.fex
${LICHEE_COMMON_CONFIG_DIR}/tools/usbtool_crash.fex
${LICHEE_CHIP_CONFIG_DIR}/tools/usbtool_test.fex
${LICHEE_COMMON_CONFIG_DIR}/tools/cardscript.fex
${LICHEE_COMMON_CONFIG_DIR}/tools/cardscript_secure.fex
${LICHEE_CHIP_CONFIG_DIR}/tools/cardscript.fex
${LICHEE_CHIP_CONFIG_DIR}/tools/cardscript_secure.fex
${LICHEE_COMMON_CONFIG_DIR}/tools/cardtool.fex
${LICHEE_CHIP_CONFIG_DIR}/tools/cardtool.fex
${LICHEE_COMMON_CONFIG_DIR}/tools/usbtool.fex
${LICHEE_CHIP_CONFIG_DIR}/tools/usbtool.fex
${LICHEE_COMMON_CONFIG_DIR}/tools/usbtool_crash.fex
${LICHEE_CHIP_CONFIG_DIR}/tools/usbtool_crash.fex
${LICHEE_COMMON_CONFIG_DIR}/tools/aultls32.fex
${LICHEE_CHIP_CONFIG_DIR}/tools/aultls32.fex
${LICHEE_COMMON_CONFIG_DIR}/tools/aultools.fex
${LICHEE_CHIP_CONFIG_DIR}/tools/aultools.fex
)

configs_file_list=(
${LICHEE_COMMON_CONFIG_DIR}/toc/toc1.fex
${LICHEE_COMMON_CONFIG_DIR}/toc/toc0.fex
${LICHEE_COMMON_CONFIG_DIR}/toc/toc0_sdcard.fex
${LICHEE_COMMON_CONFIG_DIR}/toc/toc0_nand.fex
${LICHEE_COMMON_CONFIG_DIR}/toc/toc0_ufs.fex
${LICHEE_COMMON_CONFIG_DIR}/toc/toc0_ft.fex
${LICHEE_COMMON_CONFIG_DIR}/toc/boot_package.fex
${LICHEE_COMMON_CONFIG_DIR}/hdcp/esm.fex
${LICHEE_COMMON_CONFIG_DIR}/dtb/sunxi.fex
${LICHEE_COMMON_CONFIG_DIR}/imagecfg/*.cfg
${LICHEE_COMMON_CONFIG_DIR}/partition/sys_partition_dump.fex
${LICHEE_COMMON_CONFIG_DIR}/partition/sys_partition_private.fex
${LICHEE_COMMON_CONFIG_DIR}/version/version_base.mk
${LICHEE_CHIP_CONFIG_DIR}/configs/default/*
${LICHEE_CHIP_CONFIG_DIR}/configs/${PACK_BOARD}/*.fex
${LICHEE_CHIP_CONFIG_DIR}/configs/${PACK_BOARD}/boot_package*.cfg
${LICHEE_CHIP_CONFIG_DIR}/configs/${PACK_BOARD}/${LICHEE_KERN_VER}/*.cfg
${LICHEE_CHIP_CONFIG_DIR}/configs/default/version_base.mk
${LICHEE_CHIP_CONFIG_DIR}/dtbo/*
${LICHEE_BOARD_CONFIG_DIR}/dtbo/*
${LICHEE_CHIP_CONFIG_DIR}/${BIN_PATH}/ft_${PACK_CHIP}.bin
${LICHEE_COMMON_CONFIG_DIR}/sign_config/dragon_toc_ft.cfg
${LICHEE_CHIP_CONFIG_DIR}/configs/default/dragon_toc_ft.cfg
${LICHEE_COMMON_CONFIG_DIR}/sign_config/cnf_base.cnf
${LICHEE_PLAT_OUT}/.buildconfig
)

product_configs_file_list=(
${LICHEE_CHIP_CONFIG_DIR}/configs/${PACK_BOARD}/${PACK_PLATFORM}/*.fex
${LICHEE_CHIP_CONFIG_DIR}/configs/${PACK_BOARD}/${PACK_PLATFORM}/*.cfg
)

boot_resource_list=(
${LICHEE_CHIP_CONFIG_DIR}/boot-resource/boot-resource:${LICHEE_PACK_OUT_DIR}
${LICHEE_CHIP_CONFIG_DIR}/boot-resource/boot-resource.ini:${LICHEE_PACK_OUT_DIR}
${LICHEE_CHIP_CONFIG_DIR}/configs/${PACK_BOARD}/*.bmp:${LICHEE_PACK_OUT_DIR}/boot-resource/
${LICHEE_CHIP_CONFIG_DIR}/configs/${PACK_BOARD}/bootlogo.bmp:${LICHEE_PACK_OUT_DIR}/bootlogo.bmp
${LICHEE_CHIP_CONFIG_DIR}/configs/${PACK_BOARD}/wavefile/*:${LICHEE_PACK_OUT_DIR}/boot-resource/wavefile/
${LICHEE_CHIP_CONFIG_DIR}/configs/${PACK_BOARD}/${PACK_TYPE}/*.bmp:${LICHEE_PACK_OUT_DIR}/boot-resource/
${LICHEE_CHIP_CONFIG_DIR}/boot-resource/boot-resource/bat/bempty.bmp:${LICHEE_PACK_OUT_DIR}/bempty.bmp
${LICHEE_CHIP_CONFIG_DIR}/boot-resource/boot-resource/bat/battery_charge.bmp:${LICHEE_PACK_OUT_DIR}/battery_charge.bmp
)

boot_file_list=(
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/boot0_nand_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/boot0_nand.fex
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/boot0_sdcard_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/boot0_sdcard.fex
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/boot0_ufs_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/boot0_ufs.fex
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/boot0_${LICHEE_BOOT0_BIN_NAME}_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/boot0_${LICHEE_BOOT0_BIN_NAME}.fex
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/boot0_nandfastboot_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/boot0_nandfastboot_${PACK_CHIP}.fex
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/boot0_spinor_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/boot0_spinor.fex
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/fes1_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/fes1.fex
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/fes1_uart_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/fes1_uart.fex
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/u-boot-${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/u-boot.fex
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/u-boot-${LICHEE_EFEX_BIN_NAME}.bin:${LICHEE_PACK_OUT_DIR}/u-boot-${LICHEE_EFEX_BIN_NAME}.fex
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/u-boot-crashdump-${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/u-boot-crash.fex
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/u-boot-crashdump-spinor-${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/u-boot-spinor-crash.fex
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/bl31.bin:${LICHEE_PACK_OUT_DIR}/monitor.fex
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/bl31_${PACK_BOARD}.bin:${LICHEE_PACK_OUT_DIR}/monitor.fex
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/scp.bin:${LICHEE_PACK_OUT_DIR}/scp.fex
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/amp_dsp0.bin:${LICHEE_PACK_OUT_DIR}/amp_dsp0.fex
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/amp_dsp1.bin:${LICHEE_PACK_OUT_DIR}/amp_dsp1.fex
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/amp_arm64.bin:${LICHEE_PACK_OUT_DIR}/amp_arm64.fex
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/amp_rv0.bin:${LICHEE_PACK_OUT_DIR}/amp_rv0.fex
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/video.bin:${LICHEE_PACK_OUT_DIR}/video.fex
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/optee_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/optee.fex
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/optee_${PACK_CHIP}-monitor.bin:${LICHEE_PACK_OUT_DIR}/optee-monitor.fex
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/opensbi_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/opensbi.fex
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/u-boot-spinor-${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/u-boot-spinor.fex
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/u-boot-spinor-secure-${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/u-boot-spinor-secure.fex
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/*.fex:${LICHEE_PACK_OUT_DIR}/
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/*.dtb:${LICHEE_PACK_OUT_DIR}/
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/*.bin:${LICHEE_PACK_OUT_DIR}/
)

boot_file_list_2=(
${LICHEE_PLAT_OUT}/arisc:${LICHEE_PACK_OUT_DIR}/arisc.fex
${LICHEE_PLAT_OUT}/sunxi.dtb:${LICHEE_PACK_OUT_DIR}/sunxi.fex
${LICHEE_PLAT_OUT}/boot0_nand_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/boot0_nand.fex
${LICHEE_PLAT_OUT}/boot0_sdcard_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/boot0_sdcard.fex
${LICHEE_PLAT_OUT}/boot0_${LICHEE_BOOT0_BIN_NAME}_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/boot0_${LICHEE_BOOT0_BIN_NAME}.fex
${LICHEE_PLAT_OUT}/boot0_spinor_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/boot0_spinor.fex
${LICHEE_PLAT_OUT}/fes1_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/fes1.fex
${LICHEE_PLAT_OUT}/fes1_uart_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/fes1_uart.fex
${LICHEE_PLAT_OUT}/sboot_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/sboot.bin
${LICHEE_PLAT_OUT}/sboot_nor_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/sboot_nor.bin
${LICHEE_PLAT_OUT}/sboot_sdcard_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/sboot_sdcard.bin
${LICHEE_PLAT_OUT}/sboot_nand_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/sboot_nand.bin
${LICHEE_PLAT_OUT}/sboot_ufs_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/sboot_ufs.bin
${LICHEE_PLAT_OUT}/u-boot-${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/u-boot.fex
${LICHEE_PLAT_OUT}/u-boot-${LICHEE_EFEX_BIN_NAME}.bin:${LICHEE_PACK_OUT_DIR}/u-boot-${LICHEE_EFEX_BIN_NAME}.fex
${LICHEE_PLAT_OUT}/u-boot-crashdump-${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/u-boot-crash.fex
${LICHEE_PLAT_OUT}/u-boot-crashdump-spinor-${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/u-boot-spinor-crash.fex
${LICHEE_PLAT_OUT}/scp.bin:${LICHEE_PACK_OUT_DIR}/scp.fex
${LICHEE_PLAT_OUT}/u-boot-spinor-${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/u-boot-spinor.fex
${LICHEE_PLAT_OUT}/u-boot-spinor-secure-${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/u-boot-spinor-secure.fex
${LICHEE_PLAT_OUT}/vmlinux.tar.bz2:${LICHEE_PACK_OUT_DIR}/vmlinux.fex
)

arm_boot_file_secure=(
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/semelis_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/semelis.bin
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/optee_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/optee.fex
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/sboot_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/sboot.bin
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/sboot_nor_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/sboot_nor.bin
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/sboot_sdcard_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/sboot_sdcard.bin
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/sboot_nand_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/sboot_nand.bin
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/sboot_ufs_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/sboot_ufs.bin
${LICHEE_COMMON_CONFIG_DIR}/sign_config/dragon_toc_android.cfg:${LICHEE_PACK_OUT_DIR}/dragon_toc.cfg
${LICHEE_CHIP_CONFIG_DIR}/configs/default/dragon_toc_android.cfg:${LICHEE_PACK_OUT_DIR}/dragon_toc.cfg
)

arm64_boot_file_secure=(
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/optee_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/optee.fex
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/sboot_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/sboot.bin
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/sboot_nor_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/sboot_nor.bin
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/sboot_sdcard_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/sboot_sdcard.bin
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/sboot_nand_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/sboot_nand.bin
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/sboot_ufs_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/sboot_ufs.bin
${LICHEE_COMMON_CONFIG_DIR}/sign_config/dragon_toc_a64_android.cfg:${LICHEE_PACK_OUT_DIR}/dragon_toc.cfg
${LICHEE_CHIP_CONFIG_DIR}/configs/default/dragon_toc_android.cfg:${LICHEE_PACK_OUT_DIR}/dragon_toc.cfg
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/amp_rv0.bin:${LICHEE_PACK_OUT_DIR}/amp_rv0.fex
)

#
# This function can get the realpath between $SRC and $DST
#
function get_realpath()
{
	local src=$(cd $1; pwd);
	local dst=$(cd $2; pwd);
	local res="./";
	local tmp="$dst"

	while [ "${src##*$tmp}" == "${src}" ]; do
		tmp=${tmp%/*};
		res=$res"../"
	done
	res="$res${src#*$tmp/}"

	printf "%s" $res
}

function show_boards()
{
	printf "\nAll avaiable chips, platforms and boards:\n\n"
	printf "Chip            Board\n"
	for chipdir in $(find chips/ -mindepth 1 -maxdepth 1 -type d) ; do
		chip=`basename ${chipdir}`
		printf "${chip}\n"
		for boarddir in $(find chips/${chip}/configs/${platform} \
			-mindepth 1 -maxdepth 1 -type d) ; do
			board=`basename ${boarddir}`
			printf "                ${board}\n"
		done
	done
	printf "\nFor Usage:\n"
	printf "     $(basename $0) -h\n\n"
}

function uart_switch()
{
	rm -rf ${LICHEE_PACK_OUT_DIR}/awk_debug_card0
	touch ${LICHEE_PACK_OUT_DIR}/awk_debug_card0
	TX=`awk  '$0~"'$PACK_CHIP'"{print $2}' ${LICHEE_COMMON_CONFIG_DIR}/debug/card_debug_pin`
	RX=`awk  '$0~"'$PACK_CHIP'"{print $3}' ${LICHEE_COMMON_CONFIG_DIR}/debug/card_debug_pin`
	PORT=`awk  '$0~"'$PACK_CHIP'"{print $4}' ${LICHEE_COMMON_CONFIG_DIR}/debug/card_debug_pin`
	MS=`awk  '$0~"'$PACK_CHIP'"{print $5}' ${LICHEE_COMMON_CONFIG_DIR}/debug/card_debug_pin`
	CK=`awk  '$0~"'$PACK_CHIP'"{print $6}' ${LICHEE_COMMON_CONFIG_DIR}/debug/card_debug_pin`
	DO=`awk  '$0~"'$PACK_CHIP'"{print $7}' ${LICHEE_COMMON_CONFIG_DIR}/debug/card_debug_pin`
	DI=`awk  '$0~"'$PACK_CHIP'"{print $8}' ${LICHEE_COMMON_CONFIG_DIR}/debug/card_debug_pin`

	BOOT_UART_ST=`awk  '$0~"'$PACK_CHIP'"{print $2}' ${LICHEE_COMMON_CONFIG_DIR}/debug/card_debug_string`
	BOOT_PORT_ST=`awk  '$0~"'$PACK_CHIP'"{print $3}' ${LICHEE_COMMON_CONFIG_DIR}/debug/card_debug_string`
	BOOT_TX_ST=`awk  '$0~"'$PACK_CHIP'"{print $4}' ${LICHEE_COMMON_CONFIG_DIR}/debug/card_debug_string`
	BOOT_RX_ST=`awk  '$0~"'$PACK_CHIP'"{print $5}' ${LICHEE_COMMON_CONFIG_DIR}/debug/card_debug_string`
	UART0_ST=`awk  '$0~"'$PACK_CHIP'"{print $6}' ${LICHEE_COMMON_CONFIG_DIR}/debug/card_debug_string`
	UART0_USED_ST=`awk  '$0~"'$PACK_CHIP'"{print $7}' ${LICHEE_COMMON_CONFIG_DIR}/debug/card_debug_string`
	UART0_PORT_ST=`awk  '$0~"'$PACK_CHIP'"{print $8}' ${LICHEE_COMMON_CONFIG_DIR}/debug/card_debug_string`
	UART0_TX_ST=`awk  '$0~"'$PACK_CHIP'"{print $9}' ${LICHEE_COMMON_CONFIG_DIR}/debug/card_debug_string`
	UART0_RX_ST=`awk  '$0~"'$PACK_CHIP'"{print $10}' ${LICHEE_COMMON_CONFIG_DIR}/debug/card_debug_string`
	UART1_ST=`awk  '$0~"'$PACK_CHIP'"{print $11}' ${LICHEE_COMMON_CONFIG_DIR}/debug/card_debug_string`
	JTAG_ST=`awk  '$0~"'$PACK_CHIP'"{print $12}' ${LICHEE_COMMON_CONFIG_DIR}/debug/card_debug_string`
	MS_ST=`awk  '$0~"'$PACK_CHIP'"{print $13}' ${LICHEE_COMMON_CONFIG_DIR}/debug/card_debug_string`
	CK_ST=`awk  '$0~"'$PACK_CHIP'"{print $14}' ${LICHEE_COMMON_CONFIG_DIR}/debug/card_debug_string`
	DO_ST=`awk  '$0~"'$PACK_CHIP'"{print $15}' ${LICHEE_COMMON_CONFIG_DIR}/debug/card_debug_string`
	DI_ST=`awk  '$0~"'$PACK_CHIP'"{print $16}' ${LICHEE_COMMON_CONFIG_DIR}/debug/card_debug_string`
	MMC0_ST=`awk  '$0~"'$PACK_CHIP'"{print $17}' ${LICHEE_COMMON_CONFIG_DIR}/debug/card_debug_string`
	MMC0_USED_ST=`awk  '$0~"'$PACK_CHIP'"{print $18}' ${LICHEE_COMMON_CONFIG_DIR}/debug/card_debug_string`

	if [ -z "$TX" ] || [ -z "$BOOT_UART_ST" ]; then
		pack_error "$FUNCNAME: $PACK_CHIP not configured in card_debug_pin/card_debug_string!"
		exit 1
	fi

	echo '$0!~";" && $0~"'$BOOT_TX_ST'"{if(C)$0="'$BOOT_TX_ST' = '$TX'"} \' >> ${LICHEE_PACK_OUT_DIR}/awk_debug_card0
	echo '$0!~";" && $0~"'$BOOT_RX_ST'"{if(C)$0="'$BOOT_RX_ST' = '$RX'"} \' >> ${LICHEE_PACK_OUT_DIR}/awk_debug_card0
	echo '$0!~";" && $0~"'$BOOT_PORT_ST'"{if(C)$0="'$BOOT_PORT_ST' = '$PORT'"} \' >> ${LICHEE_PACK_OUT_DIR}/awk_debug_card0
	if [ "`grep "auto_print_used" "${LICHEE_PACK_OUT_DIR}/sys_config.fex" | grep "1"`" ]; then
		echo '$0!~";" && $0~"'$MMC0_USED_ST'"{if(A)$0="'$MMC0_USED_ST' = 1";A=0} \' >> ${LICHEE_PACK_OUT_DIR}/awk_debug_card0
	else
	echo '$0!~";" && $0~"'$MMC0_USED_ST'"{if(A)$0="'$MMC0_USED_ST' = 0";A=0} \' >> ${LICHEE_PACK_OUT_DIR}/awk_debug_card0
	fi
	echo '$0!~";" && $0~"\\['$MMC0_ST'\\]"{A=1}  \' >> ${LICHEE_PACK_OUT_DIR}/awk_debug_card0
	echo '$0!~";" && $0~"'$UART0_TX_ST'"{if(B)$0="'$UART0_TX_ST' = '$TX'"} \' >> ${LICHEE_PACK_OUT_DIR}/awk_debug_card0
	echo '$0!~";" && $0~"'$UART0_RX_ST'"{if(B)$0="'$UART0_RX_ST' = '$RX'"} \' >> ${LICHEE_PACK_OUT_DIR}/awk_debug_card0
	echo '$0!~";" && $0~"\\['$UART0_ST'\\]"{B=1} \' >> ${LICHEE_PACK_OUT_DIR}/awk_debug_card0
	echo '$0!~";" && $0~"'$UART0_USED_ST'"{if(B)$0="'$UART0_USED_ST' = 1"}  \' >> ${LICHEE_PACK_OUT_DIR}/awk_debug_card0
	echo '/^'$UART0_PORT_ST'/{next} \' >> ${LICHEE_PACK_OUT_DIR}/awk_debug_card0
	echo '$0!~";" && $0~"\\['$UART1_ST'\\]"{B=0} \' >> ${LICHEE_PACK_OUT_DIR}/awk_debug_card0
	echo '$0!~";" && $0~"\\['$BOOT_UART_ST'\\]"{C=1} \' >> ${LICHEE_PACK_OUT_DIR}/awk_debug_card0
	echo '$0!~";" && $0~"\\['$JTAG_ST'\\]"{C=0} \' >> ${LICHEE_PACK_OUT_DIR}/awk_debug_card0
	echo '$0!~";" && $0~"'$MS_ST'"{$0="'$MS_ST' = '$MS'"} \' >> ${LICHEE_PACK_OUT_DIR}/awk_debug_card0
	echo '$0!~";" && $0~"'$CK_ST'"{$0="'$CK_ST' = '$CK'"} \' >> ${LICHEE_PACK_OUT_DIR}/awk_debug_card0
	echo '$0!~";" && $0~"'$DO_ST'"{$0="'$DO_ST' = '$DO'"} \' >> ${LICHEE_PACK_OUT_DIR}/awk_debug_card0
	echo '$0!~";" && $0~"'$DI_ST'"{$0="'$DI_ST' = '$DI'"} \' >> ${LICHEE_PACK_OUT_DIR}/awk_debug_card0
	echo '1' >> ${LICHEE_PACK_OUT_DIR}/awk_debug_card0

	if [ "`grep "auto_print_used" "${LICHEE_PACK_OUT_DIR}/sys_config.fex" | grep "1"`" ]; then
		sed -i -e '/^uart0_rx/a\pinctrl-1=' ${LICHEE_PACK_OUT_DIR}/sys_config.fex
		sed -i -e '/^uart0_rx/a\pinctrl-0=' ${LICHEE_PACK_OUT_DIR}/sys_config.fex
	fi

	awk -f ${LICHEE_PACK_OUT_DIR}/awk_debug_card0 ${LICHEE_PACK_OUT_DIR}/sys_config.fex > ${LICHEE_PACK_OUT_DIR}/sys_config_debug.fex
	rm -f ${LICHEE_PACK_OUT_DIR}/sys_config.fex
	mv ${LICHEE_PACK_OUT_DIR}/sys_config_debug.fex ${LICHEE_PACK_OUT_DIR}/sys_config.fex
	echo "uart -> card0"
}

function add_lzma_header()
{
	lzma_file=$1
	original_file=$2
	file_size=$(printf "%.8x\n" `stat -c%s ${lzma_file}`)
	original_file_size=$(printf "%.8x\n" `stat -c%s ${original_file}`)

	bin_str=""

	file_size_len=${#file_size}

	#"LZMA"+size+origin_size
	bin_str="\x4c\x5a\x4d\x41\x${file_size:6:2}\x${file_size:4:2}\x${file_size:2:2}\x${file_size:0:2}"
	bin_str+="\x${original_file_size:6:2}\x${original_file_size:4:2}\x${original_file_size:2:2}\x${original_file_size:0:2}"

	printf "%b" ${bin_str} > tempbin

	cat ${lzma_file} >> tempbin

	mv tempbin "${lzma_file}.head"
}

function partition_size_handle()
{
	echo "handle partition_size"
	local filename=${LICHEE_PACK_OUT_DIR}/sys_partition.fex
	local size
	local number
	local dimension
	local blocks
	local line
	local m
	local index=0
	while read line; do
		let "index++"
		size=$(echo $line | awk -F= '/^[[:space:]]*size[[:space:]]*=/{print $2}' | sed 's|\s\+||g')
		if [ -n "$size" ]; then
			dimension=$(echo $size | sed 's|^[0-9,.]\+||g')
			[ -z "$dimension" ] && continue
			case $dimension in
				B|b)
					m=1
					;;
				K|k)
					m=1024
					;;
				M|m)
					m=1048576
					;;
				G|g)
					m=1073741824
					;;
				*)
					pack_error "ERROR Dimension($dimension)!"
					return 1
					;;
			esac
			number=$(echo $size | sed 's|[a-z,A-Z]*$||g')
			blocks=$(echo "$number * $m / 512" | bc | awk -F. '{print $1}')
			printf "sys_partition.fex: size %6s => %7d Blocks\n" "${number}${dimension}" "${blocks}"
			size="$(echo "$line" | sed "s|=.*$|= $blocks|g")"
			sed -i "${index}s|$line|$size|g" $filename
		fi
	done < $filename
	return 0
}

function do_prepare()
{
	local runinfo=($(lsof 2>/dev/null | awk '$9~"'$LICHEE_TOP_DIR/tools/build/buildserver'"{print $2}'))
	local possible_bin_path="${LICHEE_POSSIBLE_BIN_PATH}"

	if [ ${#runinfo[@]} -lt 2 ]; then
		pack_error "something is incorrect:please <./build.sh config>."
	fi

	if [ -z "${PACK_CHIP}" -o -z "${PACK_TYPE}" -o -z "${PACK_BOARD}" ] ; then
		pack_error "Invalid parameters Chip: ${PACK_CHIP}, \
			Platform: ${PACK_TYPE}, Board: ${PACK_BOARD}"
		show_boards
		exit 1
	fi

	if [ ! -d ${LICHEE_CHIP_CONFIG_DIR}/configs/${PACK_BOARD} ] ; then
		pack_error "Board's directory \
			\"${LICHEE_CHIP_CONFIG_DIR}/configs/${PACK_BOARD}\" is not exist."
		show_boards
		exit 1
	fi

	# Cleanup
	if [ "x" != "x${LICHEE_PACK_OUT_DIR}" ]; then
		rm -rf ${LICHEE_PACK_OUT_DIR}
	fi
	mkdir -p ${LICHEE_PACK_OUT_DIR}

	(
		cd $LICHEE_OUT_DIR
		if [ "${LICHEE_PACK_OUT_DIR}" != "$LICHEE_OUT_DIR/pack_out" ]; then
			rm -rf pack_out
			ln -sf ${LICHEE_IC}/${LICHEE_BOARD}/pack_out pack_out
		fi
	)

	printf "copying tools file\n"
	for file in ${tools_file_list[@]} ; do
		cp -f $file ${LICHEE_PACK_OUT_DIR} 2> /dev/null
	done

	if [ "x${PACK_KERN}" = "xlinux-3.4" ]; then
		cp -f ${LICHEE_COMMON_CONFIG_DIR}/tools/cardscript.fex ${LICHEE_PACK_OUT_DIR} 2> /dev/null
	fi

	printf "copying configs file\n"
	for file in ${configs_file_list[@]} ; do
		cp -f $file ${LICHEE_PACK_OUT_DIR} 2> /dev/null
	done

	printf "copying product configs file\n"
	for file in ${product_configs_file_list[@]}; do
		cp -f $file ${LICHEE_PACK_OUT_DIR} 2>/dev/null
	done

	if [ x"${PACK_PLATFORM}" != x"android" ]; then
		printf "linux copying boardt&linux_kernel_version configs file\n"
		local possible_env_path=(
			configs/default
			configs/${LICHEE_BOARD}
			configs/${LICHEE_BOARD}/${LICHEE_KERN_VER}
			configs/${LICHEE_BOARD}/${PACK_PLATFORM}
		)
		local possible_env_list=(
			env.cfg
			env-$(echo ${LICHEE_KERN_VER} | awk -F '-' '{print $2}').cfg
		)
		local copy_env_file=''

		for d in ${possible_env_path[@]}; do
			[ ! -d ${LICHEE_CHIP_CONFIG_DIR}/$d ] && continue
			for file in ${possible_env_list[@]} ; do
				if [ -e "${LICHEE_CHIP_CONFIG_DIR}/$d/$file" ]; then
					copy_env_file=${LICHEE_CHIP_CONFIG_DIR}/$d/$file
				fi
			done
		done
		echo "Use u-boot env file: ${copy_env_file}"
		if [[ ! -f ${copy_env_file} ]]
		then
			echo -e "\e[33mWarning: u-boot env file '${copy_env_file}' not exist! use file in default directory other than '${PACK_BOARD}' directory\e[0m"
		fi

		cp -f ${copy_env_file} ${LICHEE_PACK_OUT_DIR}/env.cfg 2>/dev/null

		cp -f ${LICHEE_CHIP_CONFIG_DIR}/configs/${PACK_BOARD}/${LICHEE_KERN_VER}/sys_* ${LICHEE_PACK_OUT_DIR} 2>/dev/null
	fi

	# If platform config files exist, we will cover the default files
	# For example, mv pack_out/image_linux.cfg pack_out/image.cfg
	if [ ${PACK_PLATFORM} != "android" ]; then
		cp -f ${LICHEE_BOARD_CONFIG_DIR}/${PACK_PLATFORM}/* ${LICHEE_PACK_OUT_DIR} 2> /dev/null
		if [ ${PACK_PLATFORM} = "bsp" -o "x${PACK_PLATFORM}" = "xsata" ] ; then
			find ${LICHEE_PACK_OUT_DIR}/* -type f -a \( -name "*.fex" -o -name "*.cfg" \) -print | \
			sed "s#\(.*\)_linux\(\..*\)#mv -fv & \1\2#e"
		else
			find ${LICHEE_PACK_OUT_DIR}/* -type f -a \( -name "*.fex" -o -name "*.cfg" \) -print | \
			sed "s#\(.*\)_${PACK_PLATFORM}\(\..*\)#mv -fv & \1\2#e"
		fi
	else
		find ${LICHEE_PACK_OUT_DIR}/* -type f -a \( -name "*.fex" -o -name "*.cfg" \) -print | \
			sed "s#\(.*\)_${PACK_TYPE}\(\..*\)#mv -fv & \1\2#e"
	fi

	if [ "x${PACK_MODE}" = "xdump" ] ; then
		cp -vf ${LICHEE_PACK_OUT_DIR}/sys_partition_dump.fex ${LICHEE_PACK_OUT_DIR}/sys_partition.fex
		cp -vf ${LICHEE_PACK_OUT_DIR}/usbtool_test.fex ${LICHEE_PACK_OUT_DIR}/usbtool.fex
	elif [ "x${PACK_FUNC}" = "xprvt" ] ; then
		cp -vf ${LICHEE_PACK_OUT_DIR}/sys_partition_private.fex ${LICHEE_PACK_OUT_DIR}/sys_partition.fex
	fi

	printf "copying boot resource\n"
	for file in ${boot_resource_list[@]} ; do
		cp -rf $(echo $file | sed -e 's/:/ /g') 2>/dev/null
	done

	# openwrt use these logo files
	if [ x"${PACK_PLATFORM}" = x"openwrt" ]; then
		rm -rf ${LICHEE_PACK_OUT_DIR}/boot-resource
		cp -rf $CFG_TOP_DIR/${PACK_PLATFORM}/target/$PACK_IC/$PACK_IC-common/boot-resource/boot-resource ${LICHEE_PACK_OUT_DIR}
		cp -rf $CFG_TOP_DIR/${PACK_PLATFORM}/target/$PACK_IC/$PACK_IC-common/boot-resource/boot-resource.ini ${LICHEE_PACK_OUT_DIR}/boot-resource.ini
	fi

	if [ ! -f ${LICHEE_PACK_OUT_DIR}/bootlogo.bmp ]; then
		cp ${LICHEE_PACK_OUT_DIR}/boot-resource/bootlogo.bmp ${LICHEE_PACK_OUT_DIR}/bootlogo.bmp
	fi

	lzma -k ${LICHEE_PACK_OUT_DIR}/bootlogo.bmp
	lzma -k ${LICHEE_PACK_OUT_DIR}/bempty.bmp
	lzma -k ${LICHEE_PACK_OUT_DIR}/battery_charge.bmp

	if [ -f ${LICHEE_PACK_OUT_DIR}/bootlogo.bmp.lzma ]; then
		add_lzma_header "${LICHEE_PACK_OUT_DIR}/bootlogo.bmp.lzma" "${LICHEE_PACK_OUT_DIR}/bootlogo.bmp"
		(cd ${LICHEE_PACK_OUT_DIR}; ln -sf bootlogo.bmp.lzma.head  bootlogo.fex)
	fi

	printf "copying boot file\n"
	for d in ${possible_bin_path[@]}; do
		[ ! -d ${LICHEE_CHIP_CONFIG_DIR}/$d ] && continue
		BIN_PATH=$d
		for file in ${boot_file_list[@]} ; do
			eval cp -v -f $(echo $file | sed -e 's/:/ /g') 2>/dev/null
		done
	done
	printf "copying boot file 2.0\n"
	for file in ${boot_file_list_2[@]} ; do
		eval cp -v -f $(echo $file | sed -e 's/:/ /g') 2>/dev/null
	done
	if [[ ${LICHEE_BOARD} == *fastboot*spinand* ]] ; then
		mv -v ${LICHEE_PACK_OUT_DIR}/boot0_nandfastboot_${PACK_CHIP}.fex ${LICHEE_PACK_OUT_DIR}/boot0_nand.fex
	fi

	if ! [ -z ${LICHEE_BOOT0_BIN_NAME} ]; then
                # nand fastboot
                cp -v -f ${LICHEE_PACK_OUT_DIR}/boot0_${LICHEE_BOOT0_BIN_NAME}.fex ${LICHEE_PACK_OUT_DIR}/boot0_nand.fex

		if [[ ${LICHEE_FLASH} == default ]] ; then
			mv -v ${LICHEE_PACK_OUT_DIR}/boot0_${LICHEE_BOOT0_BIN_NAME}.fex ${LICHEE_PACK_OUT_DIR}/boot0_sdcard.fex
		elif [[ ${LICHEE_FLASH} == nor ]] ; then
			mv -v ${LICHEE_PACK_OUT_DIR}/boot0_${LICHEE_BOOT0_BIN_NAME}.fex ${LICHEE_PACK_OUT_DIR}/boot0_spinor.fex
		else
			echo "invalid LICHEE_FLASH, default choose sdcard!"
			mv -v ${LICHEE_PACK_OUT_DIR}/boot0_${LICHEE_BOOT0_BIN_NAME}.fex ${LICHEE_PACK_OUT_DIR}/boot0_sdcard.fex
		fi
	fi

	[ -z "${BIN_PATH}" ] &&
	pack_error "No BIN_PATH found!" && exit 1

	printf "copying $LICHEE_ARCH secure boot file\n"
	for d in ${possible_bin_path[@]}; do
		[ ! -d ${LICHEE_CHIP_CONFIG_DIR}/$d ] && continue
		BIN_PATH=$d
		for file in $(eval echo '$'"{${LICHEE_ARCH}_boot_file_secure[@]}"); do
			eval cp -f $(echo $file | sed -e 's/:/ /g') 2>/dev/null
		done
	done

	# If platform config use
	if [ -f ${LICHEE_CHIP_CONFIG_DIR}/tools/plat_config.sh ] ; then
		${LICHEE_CHIP_CONFIG_DIR}/tools/plat_config.sh
	fi

	if [ "x${PACK_NOR}" = "xnor" ] ; then
		cp -vf ${LICHEE_PACK_OUT_DIR}/image_nor.cfg ${LICHEE_PACK_OUT_DIR}/image.cfg
		cp -vf ${LICHEE_PACK_OUT_DIR}/sboot_nor.bin ${LICHEE_PACK_OUT_DIR}/sboot.bin
		cp -vf ${LICHEE_PACK_OUT_DIR}/dragon_toc_nor.cfg ${LICHEE_PACK_OUT_DIR}/dragon_toc.cfg
	fi

	if [ "x${PACK_VSP}" = "xvsp" ] ; then
		printf "change usb_port_type to device...\n"
		printf "disable usb_serial_unique...\n"
		printf "change usb_serial_number to ${PACK_TYPE}_android...\n"
		sed -i 's/^usb_port_type.*/usb_port_type = 0/g' ${LICHEE_PACK_OUT_DIR}/sys_config.fex
		sed -i 's/^usb_serial_unique.*/usb_serial_unique = 0/g' ${LICHEE_PACK_OUT_DIR}/sys_config.fex
		sed -i 's/^usb_serial_number.*/usb_serial_number = "'"${PACK_CHIP}"'_android"/g' ${LICHEE_PACK_OUT_DIR}/sys_config.fex
	fi

	printf "copying additional files\n"
	for file in ${PACK_ADD_FILES[@]}; do
		cp -vf $(echo $file | sed -e 's/:/ /g') 2>/dev/null
	done

	if [ "x${PACK_PLATFORM}" == "xandroid" ] && [ "x$TARGET_BUILD_VARIANT" == "xuser" ]; then
		pack_info "change kernel loglevel to 3 for android user build"
		sed -i 's|^\s*loglevel=[0-9]\s*$|loglevel=3|g' ${LICHEE_PACK_OUT_DIR}/env.cfg
		if [ "${ENABLE_VENDOR_ADB}" == "true" ]; then
			pack_info "enable vendor adb for android user build"
			sed -i 's|^init_rc=.*$|init_rc=/vendor/etc/init/hw/init.aw.rc|g' ${LICHEE_PACK_OUT_DIR}/env.cfg
		fi
	fi

	if [ "x${PACK_PROGRAMMER}" = "xprogrammer" ]; then
		printf "add programmer img info target in sys config\n"
		sed -i -e '/^\[target\]/a\programmer=1' ${LICHEE_PACK_OUT_DIR}/sys_config.fex
	fi

	sed -i 's/\\boot-resource/\/boot-resource/g' ${LICHEE_PACK_OUT_DIR}/boot-resource.ini
	sed -i 's/\\\\/\//g' ${LICHEE_PACK_OUT_DIR}/image.cfg
	sed -i 's/^imagename/;imagename/g' ${LICHEE_PACK_OUT_DIR}/image.cfg

	prepare_mixed_androiddragonboard
	[ $? -ne 0 ] && exit 1

	partition_size_handle
	[ $? -ne 0 ] && exit 1

	if [ x"${PACK_PLATFORM}" = x"openwrt" ]; then
		cd ${LICHEE_PACK_OUT_DIR}/
		echo "vmlinux" > ${LICHEE_PACK_OUT_DIR}/vmlinux.fex
		if [ "x${PACK_NOR}" = "xnor" ] ; then
			make_user_res sys_partition_nor.fex
			make_app_res sys_partition_nor.fex
			make_data_res sys_partition_nor.fex
		else
			make_user_res sys_partition.fex
			make_app_res sys_partition.fex
			make_data_res sys_partition.fex
		fi
		cd - > /dev/null
	fi
}

function img_to_programmer()
{
	local out_img=$1
	local in_img=$2

	cd ${LICHEE_PACK_OUT_DIR}/

	if [ "x${PACK_SECURE}" = "xsecure" ]; then
		if [ -f toc0_sdcard.fex ] ; then
			programmer_img toc0_sdcard.fex toc1.fex ${out_img} > /dev/null
		elif [ -f toc0_nand.fex ] ; then
			programmer_img toc0_nand.fex toc1.fex ${out_img} > /dev/null
		else
			programmer_img toc0.fex toc1.fex ${out_img} > /dev/null
		fi
	else
		programmer_img boot0_sdcard.fex boot_package.fex ${out_img} > /dev/null
	fi

	if [ -f sunxi_gpt.fex ] ; then
		#create_img for sunxi_gpt.fex
		programmer_img sys_partition.bin sunxi_mbr.fex ${out_img} ${in_img} sunxi_gpt.fex > /dev/null
	else
		#create_img for sunxi_mbr.fex
		programmer_img sys_partition.bin sunxi_mbr.fex ${out_img} ${in_img} > /dev/null
	fi

}

function uboot_ini_to_dts()
{
	local TARGET_UBOOT
	local PLATFORM_ADDR
	local SOC_ADDR
	local DTC_FLAGS=""

	if [ x${LICHEE_BRANDY_UBOOT_VER} == x2023 ]; then
		pack_info "skip split fdt"
		return
	fi

	if [ "x${PACK_NOR}" == "xnor" ]; then
		TARGET_UBOOT=${LICHEE_PACK_OUT_DIR}/u-boot-spinor.fex
	else
		TARGET_UBOOT=${LICHEE_PACK_OUT_DIR}/u-boot.fex
	fi
	sunxi_ubootools split ${TARGET_UBOOT} > /dev/null
	if [ $? -ne 0 ]
	then
		pack_warn "split uboot and fdt failed!!"
		return
	fi

	[ "$(readlink -f .)" != "$(readlink -f ${LICHEE_PACK_OUT_DIR})" ] && {
		mv temp_fdt.dtb  ${LICHEE_PACK_OUT_DIR}
		mv temp_ubootnodtb.bin  ${LICHEE_PACK_OUT_DIR}
	}

	# to dts
	$DTC_COMPILER ${DTC_FLAGS} -I dtb -O dts -o ${LICHEE_PACK_OUT_DIR}/.uboot.dtb.dts.tmp ${LICHEE_PACK_OUT_DIR}/temp_fdt.dtb  2>/dev/null

	PLATFORM_ADDR=`grep -Po "(?<=platform@)(\w+)(?=\s*{)" ${LICHEE_PACK_OUT_DIR}/.uboot.dtb.dts.tmp | head -1`
	SOC_ADDR=`grep -Po "(?<=soc@)(\w+)(?=\s*{)" ${LICHEE_PACK_OUT_DIR}/.uboot.dtb.dts.tmp | head -1`

	if [ "x${PACK_TYPE}" = "xdragonboard" -o "x${PACK_TYPE}" = "xdragonabts" ] ; then
		cat <<- EOF >> ${LICHEE_PACK_OUT_DIR}/.uboot.dtb.dts.tmp
		/{
			soc@${SOC_ADDR} {
				platform@${PLATFORM_ADDR} {
				dragonboard_test = <1>;
				};
			};
		};
		EOF
	fi

	# to dtb
	$DTC_COMPILER ${DTC_FLAGS} -I dts -O dtb -o ${LICHEE_PACK_OUT_DIR}/temp_fdt.dtb ${LICHEE_PACK_OUT_DIR}/.uboot.dtb.dts.tmp  2>/dev/null

	# get update_to_ubootfdt value from sysconfig
	sunxi_ubootools subkey_value sys_config.bin sunxi_ubootools update_to_ubootfdt > /dev/null
	if [ $? -eq 1 ]; then
		echo "uboot ini to dts"
		$DTC_COMPILER -p 2048 ${DTC_FLAGS} -@ -O dtb -o ${LICHEE_PACK_OUT_DIR}/new_fdt.dtb	\
			-b 0			\
			-i ${LICHEE_PACK_OUT_DIR}	\
			-F $DTC_INI_FILE \
			-d ${LICHEE_PACK_OUT_DIR}/temp_fdt.dtb ${LICHEE_PACK_OUT_DIR}/.uboot.dtb.dts.tmp 2>/dev/null
	else
		mv ${LICHEE_PACK_OUT_DIR}/temp_fdt.dtb  ${LICHEE_PACK_OUT_DIR}/new_fdt.dtb
	fi

	sunxi_ubootools merge ${LICHEE_PACK_OUT_DIR}/temp_ubootnodtb.bin ${LICHEE_PACK_OUT_DIR}/new_fdt.dtb > /dev/null
	cp -vf ${LICHEE_PACK_OUT_DIR}/temp_ubootnodtb.bin ${TARGET_UBOOT}
	# .uboot.dts is the last dts of uboot
	$DTC_COMPILER ${DTC_FLAGS} -I dtb -O dts -o ${LICHEE_PACK_OUT_DIR}/.uboot.dts ${LICHEE_PACK_OUT_DIR}/new_fdt.dtb 2>/dev/null
}

function do_ini_to_dts()
{
	cd ${LICHEE_PACK_OUT_DIR}/

	maybe_busybox unix2dos sys_config.fex
	script  sys_config.fex > /dev/null

	local DTC_SRC_PATH=${LICHEE_PLAT_OUT}
	local DTC_COMPILER=${LICHEE_PLAT_OUT}/dtc
	local DTC_FLAGS=""

	uboot_ini_to_dts

	if [ "x${PACK_KERN}" == "xlinux-3.4" \
			-o "x${PACK_KERN}" == "xlinux-3.10" \
			-o "x${PACK_KERN}" == "xlinux-4.4" \
			-o "x${PACK_KERN}" == "xlinux-5.4" \
			-o "x${PACK_KERN}" == "xlinux-5.4-ansc" \
			-o "x${PACK_KERN}" == "xlinux-5.10" \
			-o "x${PACK_KERN}" == "xlinux-5.10-origin" \
			-o "x${PACK_KERN}" == "xlinux-5.15" \
			-o "x${PACK_KERN}" == "xlinux-5.15-origin" ] || [[  ${PACK_KERN/linux-} > 5.15 ]]; then
		# For debug: sunxi.dtb -> .sunxi.dts
		$DTC_COMPILER ${DTC_FLAGS} -I dtb -O dts -o ${LICHEE_PLAT_OUT}/.sunxi.dts ${LICHEE_PLAT_OUT}/sunxi.dtb 2>/dev/null
		return
	fi

	local dtc_file_list=(
		.board.dtb.d.dtc.tmp:.board.dtb.dts.tmp
		.${PACK_CHIP}-${PACK_BOARD}.dtb.d.dtc.tmp:.${PACK_CHIP}-${PACK_BOARD}.dtb.dts.tmp
		.${PACK_CHIP}-${LICHEE_BUSSINESS}.dtb.d.dtc.tmp:.${PACK_CHIP}-${LICHEE_BUSSINESS}.dtb.dts.tmp
		.${PACK_CHIP}-soc.dtb.d.dtc.tmp:.${PACK_CHIP}-soc.dtb.dts.tmp)

	local DTC_INI_FILE_BASE=${LICHEE_PACK_OUT_DIR}/sys_config.fex
	local DTC_INI_FILE=${LICHEE_PACK_OUT_DIR}/sys_config_fix.fex

	cp $DTC_INI_FILE_BASE $DTC_INI_FILE
	sed -i "s/\(\[dram\)_para\(\]\)/\1\2/g" $DTC_INI_FILE
	sed -i "s/\(\[nand[0-9]\)_para\(\]\)/\1\2/g" $DTC_INI_FILE

	if [ ! -f $DTC_COMPILER ]; then
		pack_error "Script_to_dts: Can not find dtc compiler.\n"
		exit 1
	fi

	local DTC_DEP_FILE DTC_SRC_FILE
	for e in ${dtc_file_list[@]}; do
		DTC_DEP_FILE=$DTC_SRC_PATH/${e/:*}
		if [ -f $DTC_DEP_FILE ]; then
			DTC_SRC_FILE=$DTC_SRC_PATH/${e#*:}
			break
		fi
	done

	echo "sunxi_dtb create"
	$DTC_COMPILER -p 2048 ${DTC_FLAGS} -@ -O dtb -o ${LICHEE_PLAT_OUT}/sunxi.dtb	\
		-b 0			\
		-i $DTC_SRC_PATH	\
		-F $DTC_INI_FILE	\
		-d $DTC_DEP_FILE $DTC_SRC_FILE 2>/dev/null

	if [ $? -ne 0 ]; then
		pack_error "Conver script to dts failed"
		exit 1
	fi

	#restore the orignal dtsi
	if [ "x${PACK_TYPE}" = "xdragonboard" \
		-o "x${PACK_TYPE}" = "xdragonmat" ]; then
		local DTS_PATH=${LICHEE_KERN_DIR}/arch/${LICHEE_ARCH}/boot/dts
		[ "x${LICHEE_ARCH}" = "xarm64" ] && DTS_PATH=${LICHEE_KERN_DIR}/arch/${LICHEE_ARCH}/boot/dts/sunxi
		if [ -f ${DTS_PATH}/${PACK_CHIP}_bak.dtsi ];then
			rm -f ${DTS_PATH}/${PACK_CHIP}.dtsi
			mv  ${DTS_PATH}/${PACK_CHIP}_bak.dtsi  ${DTS_PATH}/${PACK_CHIP}.dtsi
		fi
	fi

	printf "Conver script to dts ok.\n"

	# It'is used for debug dtb
	$DTC_COMPILER ${DTC_FLAGS} -I dtb -O dts -o ${LICHEE_PLAT_OUT}/.sunxi.dts ${LICHEE_PLAT_OUT}/sunxi.dtb 2>/dev/null

	return
}

function maybe_busybox()
{
	if [ "x$(which busybox)" == "x" ]; then
		pack_error "Tool busybox does not exist!"
		exit 1
	fi

	busybox $@ || $@
}

function generate_env_for_uboot()
{
	printf "$1 Conver to $2.\n"
	printf "LICHEE_BRANDY_UBOOT_VER : ${LICHEE_BRANDY_UBOOT_VER}\n"
	if [ -n "${LICHEE_BRANDY_UBOOT_VER}" ] && [ ${LICHEE_BRANDY_UBOOT_VER} -ge 2023 ]; then
		printf "create env.fex for uboot2023 or later, size 128K\n"
		# mkenvimage -p 0x00 -s 0x20000 -o env.fex env.cfg
		mkenvimage -p 0x00 -s 0x20000 -o $2 $1
	else
		# u_boot_env_gen env_nor.cfg env_nor.fex >/dev/null
		u_boot_env_gen $1 $2 >/dev/null
	fi
}

function do_common()
{
	cd ${LICHEE_PACK_OUT_DIR}/

	echo $(date -d "$ts" +"%Y-%m-%d %H:%M:%S") > ${LICHEE_PACK_OUT_DIR}/sunxi_version.fex

	# Here, we can switch uart to card or normal
	if [ "x${PACK_DEBUG}" = "xcard0" -a "x${PACK_MODE}" != "xdump" \
		-a "x${PACK_FUNC}" != "xprvt" ] ; then \
		uart_switch
	else
		sed -i -e '/^auto_print_used/s\1\0\' ${LICHEE_PACK_OUT_DIR}/sys_config.fex
	fi

	if [ "x${PACK_SECURE}" = "xsecure" ]; then
		printf "add burn_secure_mode in target in sys config\n"
		sed -i -e '/^\[target\]/a\burn_secure_mode=1' ${LICHEE_PACK_OUT_DIR}/sys_config.fex
		sed -i -e '/^\[platform\]/a\secure_without_OS=0' ${LICHEE_PACK_OUT_DIR}/sys_config.fex
		if [ -f ${LICHEE_PACK_OUT_DIR}/optee-monitor.fex ]; then
			rm -f ${LICHEE_PACK_OUT_DIR}/optee-monitor.fex
		fi
	else
		sed -i '/^burn_secure_mod/d' ${LICHEE_PACK_OUT_DIR}/sys_config.fex
		sed -i '/^secure_without_OS/d' ${LICHEE_PACK_OUT_DIR}/sys_config.fex
		if [ -f ${LICHEE_PACK_OUT_DIR}/optee-monitor.fex ]; then
			mv -v ${LICHEE_PACK_OUT_DIR}/optee-monitor.fex ${LICHEE_PACK_OUT_DIR}/optee.fex
		fi
	fi

	if [ ! -f board_config.fex ]; then
		echo "[empty]" > board_config.fex
	fi

	maybe_busybox unix2dos sys_config.fex
	maybe_busybox unix2dos board_config.fex
	script  sys_config.fex > /dev/null
	cp -f   sys_config.bin config.fex
	script  board_config.fex > /dev/null
	cp -f board_config.bin board.fex

	maybe_busybox unix2dos sys_partition.fex
	script  sys_partition.fex > /dev/null

	if [ "x${PACK_TYPE}" = "xdragonboard" ] ; then
		maybe_busybox dos2unix test_config.fex
		cp test_config.fex boot-resource/
		maybe_busybox unix2dos test_config.fex
		script test_config.fex > /dev/null
		cp test_config.bin boot-resource/
	fi

	if [ "x${PACK_TYPE}" = "xdragonabts" ] ; then
		maybe_busybox dos2unix test_config.fex
		cp test_config.fex boot-resource/
		maybe_busybox unix2dos test_config.fex
		script test_config.fex > /dev/null
		cp test_config.bin boot-resource/
	fi
	# Those files for SpiNor. We will try to find sys_partition_nor.fex
	if [ "x${PACK_NOR}" = "xnor" ] ; then

		if [ ! -f sys_partition_nor.fex ];  then
			echo "sys partition for nor not exist"
			exit 1
		fi

		if [ ! -f ${LICHEE_CHIP_CONFIG_DIR}/tools/arisc_config_parse.sh ]; then
			if [ -f "scp.fex" ]; then
				echo "update scp"
				update_scp scp.fex sunxi.fex >/dev/null
			fi
		fi

		# Here, will create sys_partition_nor.bin
		maybe_busybox unix2dos sys_partition_nor.fex
		script  sys_partition_nor.fex > /dev/null
		update_boot0 boot0_spinor.fex   sys_config.bin SPINOR_FLASH > /dev/null
		update_chip boot0_spinor.fex   > /dev/null
		update_fes1  fes1.fex           sys_config.bin > /dev/null

		if [ "x${PACK_KERN}" = "xlinux-3.4" ] ; then
			update_uboot -merge u-boot-spinor.fex  sys_config.bin > /dev/null
		else
			update_uboot -no_merge u-boot-spinor.fex  sys_config.bin > /dev/null
			update_uboot -no_merge u-boot-spinor-secure.fex  sys_config.bin > /dev/null
			[ -f u-boot-efex.fex ] && {
				update_uboot -no_merge u-boot-efex.fex  sys_config.bin > /dev/null
			}
		fi

		while read line
		do
			compress_name=(`echo $line | awk '($1 !~ ";" && ($2 ~ "lzma" || $2 ~ "lz4" || $2 ~ "gz")) {print $2}'`)
			source_name=(`echo $compress_name | cut -d \.  -f 1,2 | cut -d \  -f 2`)
			compress_type=(`echo $compress_name | cut -d \.  -f 3 | cut -d \  -f 2`)
			[ -z "$compress_name" ] && continue
			case $compress_type in
			"gz")
				[ -f $source_name ] && gzip -c $source_name > $compress_name || echo "no exist $source_name"
				echo "compress name: $compress_name"
				;;
			"lzma")
				[ -f $source_name ] && lzma -k $source_name || echo "no exist $source_name"
				mv $source_name.lzma $compress_name >/dev/null 2<&1
				echo "compress name: $compress_name"
				;;
			"lz4")
				[ -f $source_name ] && lz4 -f $source_name $compress_name || echo "no exist $source_name"
				echo "compress name: $compress_name"
				;;
			*)
				echo "no match compress type"
				;;
			esac
			echo "compress type: $compress_type"
		done < boot_package_nor.cfg

		if [ -f boot_package_nor.cfg ]; then
			mv u-boot-spinor-crash.fex u-boot-crash.fex
			echo "pack boot package"
			maybe_busybox unix2dos boot_package.cfg
			dragonsecboot -pack boot_package_nor.cfg
			cp boot_package.fex boot_package_nor.fex
		fi
		# Ugly, but I don't have a better way to change it.
		# We just set env's downloadfile name to env_nor.cfg in sys_partition_nor.fex
		# And if env_nor.cfg is not exist, we should copy one.
		if [ ! -f env_nor.cfg ]; then
			cp -f env.cfg env_nor.cfg >/dev/null 2<&1
		fi

		#card sprite
		if [ -f "boot0_sdcard.fex" ]; then
			update_boot0 boot0_sdcard.fex   sys_config.bin SDMMC_CARD > /dev/null
			update_chip boot0_sdcard.fex > /dev/null
		fi

		# Fixup boot mode for SPINor, just can bootm
		sed -i '/^boot_normal/s#\<boota\>#bootm#g' env_nor.cfg

		echo 1:LICHEE_REDUNDANT_ENV_SIZE:$LICHEE_REDUNDANT_ENV_SIZE
		if [ "x${LICHEE_REDUNDANT_ENV_SIZE}" != "x" ]; then
			echo "--mkenvimage create redundant env data!--"
			echo "--redundant nor env data size ${LICHEE_REDUNDANT_ENV_SIZE}---"
			mkenvimage -r -p 0x00 -s ${LICHEE_REDUNDANT_ENV_SIZE} -o env_nor.fex env_nor.cfg
		else
			generate_env_for_uboot env_nor.cfg env_nor.fex
		fi
	else
		update_boot0 boot0_nand.fex     sys_config.bin NAND > /dev/null
		update_boot0 boot0_sdcard.fex   sys_config.bin SDMMC_CARD > /dev/null
		update_boot0 boot0_ufs.fex   sys_config.bin UFS > /dev/null
		update_chip boot0_nand.fex >/dev/null
		update_chip boot0_sdcard.fex >/dev/null
		update_chip boot0_ufs.fex >/dev/null
	fi

	if [ ! -f "u-boot-crash.fex" ]; then
		touch "u-boot-crash.fex"
		echo "ensure u-boot-crash.fex is not empty" > u-boot-crash.fex
	fi

	if [ -f "sunxi.fex" ]; then
		update_dtb sunxi.fex 4096
	fi

	if [ ! -f ${LICHEE_CHIP_CONFIG_DIR}/tools/arisc_config_parse.sh ]; then
		if [ -f "scp.fex" ]; then
			echo "update scp"
			update_scp scp.fex sunxi.fex >/dev/null
		fi
	fi

	if [ -f "optee.fex" ]; then
		echo "update optee"
		update_optee optee.fex sunxi.fex >/dev/null
	fi

	# Those files for Nand or Card
	if [ "x${PACK_KERN}" = "xlinux-3.4" ] ; then
		update_uboot -merge u-boot.fex sys_config.bin > /dev/null
	else
		update_uboot -no_merge u-boot.fex sys_config.bin > /dev/null
		[ -f u-boot-nodtb.fex ] && {
			update_uboot -no_merge u-boot-nodtb.fex sys_config.bin > /dev/null
		}
		[ -f u-boot-efex.fex ] && {
			update_uboot -no_merge u-boot-efex.fex  sys_config.bin > /dev/null
		}
	fi

	if [ -f "fes1_uart.fex" ]; then
		update_fes1  fes1_uart.fex           sys_config.bin > /dev/null
	fi

	update_fes1  fes1.fex           sys_config.bin > /dev/null
	if [ -f ${LICHEE_TOOLS_DIR}/pack/pctools/linux/mod_update/update_sboot ];then
		update_sboot sboot.bin  sys_config.bin  > /dev/null
		if [ $? -ne 0 ]
		then
			pack_error "update sboot run error"
			exit 1
		fi
	fi
	fsbuild      boot-resource.ini  split_xxxx.fex > /dev/null

	if [ -f boot_package_uartburn.cfg ]; then
		dragonsecboot -pack boot_package_uartburn.cfg
		if [ $? -ne 0 ]
		then
			pack_error "dragon pack boot_package_uartburn run error"
			exit 1
		fi
		mv boot_package.fex boot_package_uartburn.fex
	fi

	if [ -f boot_package.cfg ]; then
		if [ "x$LINUX_DTBO_FILE" = "x" ]; then
			echo "do not set LINUX_DTBO_FILE"
			line_num=`sed -n -e "/default.dtbo/=" boot_package.cfg`
			if [ "x$line_num" != "x" ]; then
				sed -i "$line_num s/^/;/g" boot_package.cfg
			fi
		else
			if [ -f $LINUX_DTBO_FILE ]
			then
				sed -i "s/default.dtbo/$LINUX_DTBO_FILE/g" boot_package.cfg
			else
				line_num=`sed -n -e "/default.dtbo/=" boot_package.cfg`
				if [ "x$line_num" != "x" ]; then
					sed -i "$line_num s/^/;/g" boot_package.cfg
				fi
			fi
		fi

			echo "pack boot package"
			maybe_busybox unix2dos boot_package.cfg
			dragonsecboot -pack boot_package.cfg

		if [ $? -ne 0 ]
		then
			pack_error "dragon pack run error"
			exit 1
		fi
	fi

	echo 2:LICHEE_REDUNDANT_ENV_SIZE:$LICHEE_REDUNDANT_ENV_SIZE
	if [ "x${PACK_FUNC}" = "xprvt" ] ; then
		if [ "x${LICHEE_REDUNDANT_ENV_SIZE}" != "x" ]; then
			echo "--mkenvimage create redundant env data!--"
			echo "--redundant env data size ${LICHEE_REDUNDANT_ENV_SIZE}---"
			mkenvimage -r -p 0x00 -s ${LICHEE_REDUNDANT_ENV_SIZE} -o env.fex env_burn.cfg
		else
			generate_env_for_uboot env_burn.cfg env.fex
		fi
	else
		if [ "x${LICHEE_REDUNDANT_ENV_SIZE}" != "x" ]; then
			echo "--mkenvimage create redundant env data!--"
			echo "--redundant env data size ${LICHEE_REDUNDANT_ENV_SIZE}---"
			mkenvimage -r -p 0x00 -s ${LICHEE_REDUNDANT_ENV_SIZE} -o env.fex env.cfg
		else
			generate_env_for_uboot env.cfg env.fex
		fi
	fi

	dmverity_deal clean

}

function do_finish()
{
	# Yeah, it should contain all files into full_img.fex for spinor
	# Because, as usually, spinor image size is very small.
	# If fail to create full_img.fex, we should fake it empty.

	# WTF, it is so ugly!!! It must be sunxi_mbr.fex & sys_partition.bin,
	# not sunxi_mbr_xxx.fex & sys_partition_xxx.bin. In order to advoid this
	# loathsome thing, we need to backup & copy files. Check whether
	# sys_partition_nor.bin is exist, and create sunxi_mbr.fex for Nor.
	local max_toc_size=2097152

	local IMG_NAME="${PACK_IC}_${PACK_TYPE}${PACK_PLATFORM_VERSION}_${PACK_BOARD}_${PACK_DEBUG}"
	if [ "x${PACK_MODE}" = "xdump" ] ; then
		IMG_NAME="${IMG_NAME}_${PACK_MODE}"
	fi

	if [ "x${PACK_FUNC}" = "xprvt" ]; then
		IMG_NAME="${IMG_NAME}_${PACK_FUNC}"
	fi

	if [ "x${PACK_SECURE}" = "xsecure" ] ; then
		IMG_NAME="${IMG_NAME}_${PACK_SECURE}"
	fi

	if [ "x${PACK_FUNC}" = "xprev_refurbish" ] ; then
		IMG_NAME="${IMG_NAME}_${PACK_FUNC}"
	fi

	if [ "x${PACK_NOR}" = "xnor" ] ; then
		IMG_NAME="${IMG_NAME}_${PACK_NOR}"
	fi

	if [ "x${PACK_SECURE}" != "xnone" ]; then
		local MAIN_VERION=$(readcfg dragon_toc.cfg rollback_ver ver)
		if [ ! -n "${MAIN_VERION}" ]; then
			local MAIN_VERION="$(echo '__unique:;@echo ${MAIN_VERSION}' | make -f - -f ${LICHEE_PACK_OUT_DIR}/version_base.mk --no-print-directory __unique)"
		fi
		IMG_NAME="${IMG_NAME}_v${MAIN_VERION}.img"
	else
		IMG_NAME="${IMG_NAME}.img"
	fi

	local IMG_PROGRAMMER_NAME="${IMG_NAME%.*}_programmer.img"

	echo "imagename = $IMG_NAME" >> ${LICHEE_PACK_OUT_DIR}/image.cfg
	echo "" >> ${LICHEE_PACK_OUT_DIR}/image.cfg

	local imagesize
	local toc_size
	local max_toc_size=3883264

	if [ "x${PACK_SECURE}" = "xsecure" ]; then
		toc_size=`stat toc1.fex --format="%s"`
	else
		toc_size=`stat boot_package.fex --format="%s"`
	fi

	if [ "$LICHEE_CHIP" == "sun55iw3p1" ]; then
		max_toc_size=3883264
	fi

	if [ ${toc_size} -gt ${max_toc_size} ];then
		pack_error "boot_package.fex/toc1.fex More than ${max_toc_size} bytes limit too large!!!"
		exit 1
	fi

	if [ "x${PACK_NOR}" = "xnor" ] ; then
		NOR_LOGIC_START=2016
		NOR_UBOOT_START=128
		NOR_FLASH_SIZE=65536 #32M
		NOR_LOGIC_START_KB=`expr ${NOR_LOGIC_START} / 2`
		NOR_UBOOT_START_KB=`expr ${NOR_UBOOT_START} / 2`

		local uboot_dts=""
		if [ -n "${LICHEE_BRANDY_UBOOT_VER}" ] && [ ${LICHEE_BRANDY_UBOOT_VER} -ge 2023 ]; then
			uboot_dts="${LICHEE_BOARD_CONFIG_DIR}/uboot-${LICHEE_BRANDY_UBOOT_VER}/uboot-board.dts"
		else
			uboot_dts="${LICHEE_BOARD_CONFIG_DIR}/uboot-board.dts"
		fi

		if [ -f ${uboot_dts} ] && [ x"$(grep "nor_map" ${uboot_dts})" != x"" ]; then
			echo "get flashmap from ${uboot_dts}"
			NOR_FLASH_SIZE=$(awk '/nor_map {/,/}/ {print NR ": " $0}' ${uboot_dts} \
				| grep  "\bflash_size\b" | grep -oP "(?<=\<)\d+(?=\>)")

			NOR_LOGIC_START=$(awk '/nor_map {/,/}/ {print NR ": " $0}' ${uboot_dts} \
				| grep  "\blogic_offset\b" | grep -oP "(?<=\<)\d+(?=\>)")

			NOR_UBOOT_START=$(awk '/nor_map {/,/}/ {print NR ": " $0}' ${uboot_dts} \
				| grep  "\buboot_start\b" | grep -oP "(?<=\<)\d+(?=\>)")

			[ x"${NOR_FLASH_SIZE}" = x"" -o x"${NOR_LOGIC_START}" = x"" -o x"${NOR_UBOOT_START}" = x"" ] && {
				pack_warn "flash_size,logic_offset,uboot_start maybe not set in uboot-board.dts"
				NOR_LOGIC_START=2016
				NOR_UBOOT_START=128
				NOR_FLASH_SIZE=65536 #32M
			}

			NOR_LOGIC_START_KB=`expr ${NOR_LOGIC_START} / 2`
			NOR_UBOOT_START_KB=`expr ${NOR_UBOOT_START} / 2`
			echo "flash size:${NOR_FLASH_SIZE}, logic start:${NOR_LOGIC_START}, uboot start:${NOR_UBOOT_START}"
		fi

		update_mbr sys_partition_nor.bin 1 sunxi_mbr_nor.fex dlinfo.fex \
				${NOR_FLASH_SIZE} ${NOR_LOGIC_START} 1

		if [ $? -ne 0 ]; then
			pack_error "update_mbr failed"
			exit 1
		fi
		echo '----------programmer nor image is full_img.fex ----------'
		if [ "x${PACK_KERN}" = "xlinux-3.4" ] ; then
		#when use devicetree, the size of uboot+dtb is larger then 256K
			#BOOT1_FILE=u-boot-spinor.fex
			#LOGIC_START=240 #240+16=256K
			#merge_package full_img.fex boot0_spinor.fex \
			#        u-boot-spinor.fex sunxi_mbr_nor.fex sys_partition_nor.bin
			merge_full_img --out full_img.fex --boot0 boot0_spinor.fex --boot1 u-boot-spinor.fex \
							--mbr sunxi_mbr_nor.fex  --partition sys_partition_nor.bin \
							--logic_start 240 > /dev/null
		else
			merge_full_img --out full_img.fex --boot0 boot0_spinor.fex --boot1 boot_package_nor.fex \
				--mbr sunxi_gpt.fex --partition sys_partition_nor.bin \
				--logic_start ${NOR_LOGIC_START_KB} --uboot_start ${NOR_UBOOT_START_KB} > /dev/null
		fi

		if [ $? -ne 0 ]; then
			pack_error "merge_full_img failed"
			exit 1
		fi
		mv sys_partition_nor.fex sys_partition.fex
	fi

	if [ ! -f sys_partition_nor.bin ]; then
		update_mbr          sys_partition.bin 4
		if [ $? -ne 0 ]; then
			pack_error "update_mbr failed"
			exit 1
		fi

		#15269888 is from emmc datasheet, sec_count in Extended CSD is 0xe90000 = 15269888.
		#40960 is the mbr location for emmc
		#0  is emmc/nand ; 1 is spinor
		update_mbr sys_partition.bin 4 sunxi_mbr.fex dlinfo.fex 15269888 40960 0
		if [ $? -ne 0 ]; then
			pack_error "update_mbr_gpt failed"
			exit 1
		fi
	fi

	if [ x"${PACK_PLATFORM}" = x"openwrt" ]; then
		echo "===================================="
		echo "show sys_partition.fex message"
		show_partition_message sys_partition.fex
	fi

	local e cfgadd cfgget lastcfgline localfile filename
	local imgcfg_add_list=(
		# localfile             filename-in-cfg        maintype  subtype
		'vmlinux.fex            vmlinux.fex            12345678  123456789VMLINUX'
		'vendor_boot-debug.fex  vendor_boot-debug.fex  RFSFAT16  VENDOR_BOOTDEBUG'
		'dragon_toc.cfg         dragon_toc.fex         12345678  12345678DGTOCCFG'
		)

	for e in "${imgcfg_add_list[@]}"; do
		localfile="$(awk '{print $1}' <<< $e)"
		filename="$(awk '{print $2}' <<< $e)"
		maintype="$(awk '{print $3}' <<< $e)"
		subtype="$(awk '{print $4}' <<< $e)"
		cfgget="$(sed -n '/^\s*{\s*filename\s*=\s*"'$filename'"\s*,/p' image.cfg)"
		lastcfgline="$(sed -n '/^\s*{\s*filename\s*=/=' image.cfg | tail -1)"

		[ ! -f "$localfile" -o -n "$cfgget" -o -z "$lastcfgline" ] && continue
		[ "$localfile" != "$filename" ] && ln -sf $localfile $filename
		cfgadd='    {filename = "'$filename'",'
		cfgadd+='     maintype = "'$maintype'",'
		cfgadd+='     subtype  = "'$subtype'",},'
		sed -i -e  ''"${lastcfgline}"'a\' -e "$cfgadd" image.cfg
	done

	dragon image.cfg    sys_partition.fex
	if [ $? -eq 0 ]; then
		if [ -e ${IMG_NAME} ]; then
			mv ${IMG_NAME} $LICHEE_OUT_DIR/$LICHEE_IC/$LICHEE_BOARD/$LICHEE_LINUX_DEV/${IMG_NAME}
			rm -f $LICHEE_OUT_DIR/${IMG_NAME}
			ln -f $LICHEE_OUT_DIR/$LICHEE_IC/$LICHEE_BOARD/$LICHEE_LINUX_DEV/${IMG_NAME}  $LICHEE_OUT_DIR/${IMG_NAME}
			imagesize=$(du --apparent-size -sh $LICHEE_OUT_DIR/$LICHEE_IC/$LICHEE_BOARD/$LICHEE_LINUX_DEV/${IMG_NAME} | awk '{print $1}')
			echo '----------image is at----------'
			echo -e '\033[0;31;1m'
			echo -e "$imagesize\t${LICHEE_OUT_DIR}/${IMG_NAME}"
			echo -e '\033[0m'
		fi
	fi
	cd ..

	if [ "x${PACK_PROGRAMMER}" = "xprogrammer" ]; then
		if [ -f  $LICHEE_PACK_OUT_DIR/super.fex ]; then
			mv $LICHEE_PACK_OUT_DIR/super.fex $LICHEE_PACK_OUT_DIR/super.bak.fex
			simg2img  $LICHEE_PACK_OUT_DIR/super.bak.fex $LICHEE_PACK_OUT_DIR/super.fex
		fi
		echo "waiting to ceate programmer img..."
		img_to_programmer ${IMG_PROGRAMMER_NAME} $LICHEE_OUT_DIR/${LICHEE_IC}/${LICHEE_BOARD}/${LICHEE_LINUX_DEV}/${IMG_NAME}
		if [ $? -eq 0 ]; then
			if [ -e ${IMG_PROGRAMMER_NAME} ]; then
				mv $LICHEE_PACK_OUT_DIR/${IMG_PROGRAMMER_NAME} $LICHEE_OUT_DIR/${LICHEE_IC}/${LICHEE_BOARD}/${LICHEE_LINUX_DEV}/${IMG_PROGRAMMER_NAME}
				imagesize=$(du --apparent-size -sh $LICHEE_OUT_DIR/${LICHEE_IC}/${LICHEE_BOARD}/${LICHEE_LINUX_DEV}/${IMG_PROGRAMMER_NAME} | awk '{print $1}')
				echo '----------programmer image is at----------'
				echo -e '\033[0;31;1m'
				echo -e "$imagesize\t${LICHEE_OUT_DIR}/${IMG_PROGRAMMER_NAME}"
				echo -e '\033[0m'
			fi
		fi
	fi
	cd ..
	do_finish_SATA
	printf "pack finish\n"
	[ -e ${LICHEE_TOP_DIR}/build/.hooks/post-dragon ] &&
		source ${LICHEE_TOP_DIR}/build/.hooks/post-dragon
	return 0
}

function do_finish_SATA()
{
	if [ "x$BUILD_SATA" = "xtrue" ];then
		SATA_TAR=$LICHEE_TOP_DIR/SATA/linux/${LICHEE_CHIP}.tar
		if [ -f $SATA_TAR ];then
			echo '----------SATA is at----------'
			echo -e '\033[0;31;1m'
			echo $SATA_TAR
			echo -e '\033[0m'
		else
			echo PACK SATA failed!
		fi
	fi
}

function dmverity_deal()
{
	local script_name=scripts/build.sh
	local script_path=$LICHEE_KERN_DIR

	if [ ! -x $script_path/$script_name ]; then
		script_path=$LICHEE_BUILD_DIR
		script_name=mkkernel.sh
	fi

	[ ! -x $script_path/$script_name ] && return 255
	[ -z "$(grep "^\s*deal_verity)\s*$" $script_path/$script_name)" ] && return 1

	(cd $script_path && ./$script_name "deal_verity" $@)
}

function dmverity_get_blk_count()
{
	local size=`du --apparent-size -b $1 | awk '{print $1}'`
	local BLK_SIZE=$2

	if [ `expr ${size} % ${BLK_SIZE}` = "0" ]; then
			local blks=`(expr ${size} / ${BLK_SIZE})`
	else
			local blks=`(expr ${size} / ${BLK_SIZE} + 1 )`
	fi

	echo $blks
}

function dmverity_determ_blk_size()
{
	local type_info=`file -L $1`

	#check rootfs file system type to determ block size
	if [ "x""`echo ${type_info}| grep "ext4 filesystem"`" != "x" ];then
		block_size=`tune2fs -l $1|grep "Block size"|awk {'print $3'}`
		echo ${block_size}
	else
		echo "not support file system type"
		return -1
	fi

}
function dmverity_genHashTable()
{
	local fs_name=$1
	local tree_name=$2
	local table_name=$3
	local block_size=`dmverity_determ_blk_size ${fs_name}`
	if [ ${block_size} -lt 0 ];then
		return -1
	fi
	veritysetup format --data-block-size=${block_size} --hash-block-size=${block_size} ${fs_name} ${tree_name} > ${table_name}
	return $?
}

function dmverity_genDownloadFile()
{
	local fs_name=$1
	local sign_name=$2
	local table_name=$3
	local tree_name=$4
	local download_file_name=$5

	local BLK_SIZE=`dmverity_determ_blk_size ${fs_name}`
	if [ ${BLK_SIZE} -lt 0 ];then
		return -1
	fi
	local SIGN_BLK=`dmverity_get_blk_count ${sign_name} ${BLK_SIZE}`
	local TABLE_BLK=`dmverity_get_blk_count ${table_name} ${BLK_SIZE}`
	local TREE_BLK=`dmverity_get_blk_count ${tree_name} ${BLK_SIZE}`

	# 3.1 copy sign
	dd if=${sign_name} of=${download_file_name}"tmp" bs=${BLK_SIZE} count=${SIGN_BLK} >/dev/null 2>&1

	# 3.2 copy table size
	local TABLE_SIZE=`du --apparent-size -b ${table_name} | awk '{print $1}'`
	local HIGH_BYTES=`expr $TABLE_SIZE / 256 `
	local LOW_BYTES=`expr $TABLE_SIZE % 256 `
	if [ $HIGH_BYTES -gt 256 ]; then
		echo "ERROR rootfs_hash_table size should < 64KB"
		return -1
	fi
	local HIGH_BYTES_H=`echo "obase=16;ibase=10;$HIGH_BYTES" | bc`
	local LOW_BYTES_H=`echo "obase=16;ibase=10;$LOW_BYTES" | bc`
	echo -e -n "\x$LOW_BYTES_H\x$HIGH_BYTES_H" >> ${download_file_name}"tmp"

	# 3.3 copy rootfs_hash_table
	dd if=${table_name} of=${download_file_name}"tmp"  bs=${BLK_SIZE} seek=${SIGN_BLK} count=${TABLE_BLK} > /dev/null 2>&1

	# 3.4 copy rootfs_hash_tree.bin
	dd if=${tree_name} of=${download_file_name}"tmp"  bs=${BLK_SIZE} seek=`expr ${SIGN_BLK} + ${TABLE_BLK}` count=${TREE_BLK} > /dev/null 2>&1

	dd of=${download_file_name} if=${download_file_name}"tmp" bs=${BLK_SIZE} count=`expr ${SIGN_BLK} + ${TABLE_BLK} + ${TREE_BLK}`>/dev/null 2>&1
	rm ${download_file_name}"tmp"
}

function do_signature_dsp()
{
	local DSP0_BIN=${LICHEE_PACK_OUT_DIR}/amp_dsp0.fex;
	local DSP1_BIN=${LICHEE_PACK_OUT_DIR}/amp_dsp1.fex;
	local CFG_FILE=${LICHEE_CHIP_CONFIG_DIR}/configs/default/image_header_secure.cfg;

	if [ -f ${CFG_FILE} ] ; then
		cp -v ${CFG_FILE} image_header_secure.cfg
	else
		printf "can not found image_header_secure cfg\n"
		return 1
	fi

	if [ -f ${DSP0_BIN} ] ; then
		mkimage_header -C 5 -c image_header_secure.cfg -s rsa -k $CFG_KEY_DIR
		if [ $? -ne 0 ]
		then
			pack_error "mkimage_header signature dsp error\n"
			exit 1
		fi
		mv amp_dsp0.fex.pack amp_dsp0.fex
	else
		printf "can not found amp_dsp0 bin\n"
		return 3
	fi

	if [ -f ${DSP1_BIN} ] ; then
		mv amp_dsp0.fex.pack amp_dsp0.fex
	fi

}

function do_signature_riscv()
{
	local RV0_BIN=${LICHEE_PACK_OUT_DIR}/amp_rv0.fex;
	local RV1_BIN=${LICHEE_PACK_OUT_DIR}/amp_rv1.fex;
	local CFG_FILE=${LICHEE_CHIP_CONFIG_DIR}/configs/default/image_header_secure.cfg;
	local key_type=$(readcfg dragon_toc.cfg key_para key_toc1 | cut -c 1-3)
	if [ x${key_type} == "xecc" ]; then
		sign_alg=ecc
	else
		sign_alg=rsa
	fi

	if [ -f ${CFG_FILE} ] ; then
		cp -v ${CFG_FILE} image_header_secure.cfg
	else
		printf "can not found image_header_secure cfg\n"
		return 1
	fi

	if [ -f ${RV0_BIN} ] ; then
		mkimage_header -C 5 -c image_header_secure.cfg -s $sign_alg -k $CFG_KEY_DIR
		if [ $? -ne 0 ]
		then
			pack_error "mkimage_header signature rv error\n"
			exit 1
		fi
		mv amp_rv0.fex.pack amp_rv0.fex
	else
		printf "can not found amp_rv0 bin\n"
		return 3
	fi

	if [ -f ${RV1_BIN} ] ; then
		mv amp_rv1.fex.pack amp_rv1.fex
	fi

}

function do_signature_ft()
{
	if [ ! -e ${LICHEE_PACK_OUT_DIR}/ft_${PACK_CHIP}.bin ]; then
		printf "can not found ft bin\n"
		return 1
	fi

	if [ -e ${LICHEE_PACK_OUT_DIR}/dragon_toc_ft.cfg ]; then
		printf "can not found dragon_toc_ft cfg\n"
	fi

	printf "prepare for signature for ft bin\n"
	mv ${LICHEE_PACK_OUT_DIR}/ft_${PACK_CHIP}.bin ${LICHEE_PACK_OUT_DIR}/ft.bin
	dragonsecboot -toc0 dragon_toc_ft.cfg $CFG_KEY_DIR ${LICHEE_PACK_OUT_DIR}/version_base.mk > /dev/null
	if [ $? -ne 0 ]; then
		pack_error "dragon toc0_ft run error\n"
		exit 1
	fi

	mv toc0.fex toc0_ft.fex
}

function do_signature_fel()
{
	printf "prepare for signature for fex tools\n"
	local ROOT_KEY_NAME="";
	local UBOOT_NAME="u-boot";
	local sign_tools=$(readcfg dragon_toc.cfg sign_fel_tools sign_tools)

	if [ -f u-boot-efex.fex ]; then
		UBOOT_NAME="u-boot-efex"
	fi
	echo UBOOT_NAME ${UBOOT_NAME}

	if [ x${sign_tools} == "xdragonsboot" ]; then
		printf "using dragonsboot to sign fel\n"

		if [ -f ${CFG_KEY_DIR}/RootKey_Level_0.pem ]; then
			ROOT_KEY_NAME=${CFG_KEY_DIR}/RootKey_Level_0.pem
		elif [ -f ${CFG_KEY_DIR}/Trustkey.pem ]; then
			ROOT_KEY_NAME=${CFG_KEY_DIR}/Trustkey.pem
		else
			pack_error "can not found root key to sign fex tool"
			exit 1
		fi
		echo rootkeyname ${ROOT_KEY_NAME}

		dragonsecboot -sign fes1.fex ${ROOT_KEY_NAME} ${LICHEE_PACK_OUT_DIR}/version_base.mk > /dev/null
		if [ $? -eq 0 ]; then
			dragonsecboot -sign ${UBOOT_NAME}.fex ${ROOT_KEY_NAME} ${LICHEE_PACK_OUT_DIR}/version_base.mk > /dev/null
			if [ $? -ne 0 ]
			then
				pack_error "dragonsecboot uboot fail"
			fi
		fi
	else
		printf "using sig_fel_image to sign fel\n"
		if [ -f ${CFG_KEY_DIR}/RootKey_Level_0.bin ]; then
			ROOT_KEY_NAME=${CFG_KEY_DIR}/RootKey_Level_0.bin
		elif [ -f ${CFG_KEY_DIR}/Trustkey.bin ]; then
			ROOT_KEY_NAME=${CFG_KEY_DIR}/Trustkey.bin
		else
			pack_error "can not found root key to sign fex tool"
			exit 1
		fi
		echo rootkeyname ${ROOT_KEY_NAME}

		sig_fel_image --input fes1.fex --rsakey ${ROOT_KEY_NAME} --output fes1_sign.fex --version_base ${LICHEE_PACK_OUT_DIR}/version_base.mk
		if [ $? -ne 0 ]
		then
			pack_error "sig_fel_image fes fail"
			exit 1
		fi
		sig_fel_image --input ${UBOOT_NAME}.fex --rsakey ${ROOT_KEY_NAME} --output ${UBOOT_NAME}_sign.fex --version_base ${LICHEE_PACK_OUT_DIR}/version_base.mk
		if [ $? -ne 0 ]
		then
			pack_error "sig_fel_image uboot fail"
		fi
	fi

	if [ -f fes1_sign.fex ]; then
		cp fes1_sign.fex fes1.fex
	fi

	if [ -f  ${UBOOT_NAME}_sign.fex ]; then
		cp ${UBOOT_NAME}_sign.fex ${UBOOT_NAME}.fex
	fi
}

function readcfg()
{
	local fid=$1
	local section=$2
	local option=$3

	test ! -f $fid && echo "file not exits:$fid" && exit 1
	if [ $# -eq 3 ] ; then
		local src=$(cat $fid | awk '/\['$section'\]/{f=1;next} /\[*\]/{f=0} f' |
		grep ^$option |
		grep '='     |
		cut -d'=' -f2|
		cut -d'#' -f1|
		cut -d';' -f1|
		awk '{gsub(/^\s+|\s+$/, "");print}')
		echo -n $src
		test ${#src} -eq 0 && return 1 || return 0
	else
		echo "the input parameters should be 3"
		exit 1
	fi
}

function get_item_from_cfg()
{
	name=()
	bin=()
	cert=()
	counts=0

	local toc_cfg=$1
	local field=$2
	local key=$3

	toc1_item_content=$(readcfg ${toc_cfg} ${field} ${key})
	i=0
	IFS=', ' read -r -a parts <<< $toc1_item_content
	for part in "${parts[@]}"; do
		if [ $(($i % 3)) -eq 0 ]; then
			name[counts]=$part
		elif [ $(($i % 3)) -eq 1 ]; then
			bin[counts]=$part
		else
			cert[counts]=$part
			counts=$((counts + 1))
		fi
		i=$((i + 1))
	done
}

function create_toc0()
{
	local toc_cfg=$1
	local key=""
	local cert_type=""
	local key_type=""
	local psck_mode=""

	rm -rf toc0

	if [ ! -d "toc0" ]; then
		mkdir -p toc0
	fi

	if [ ! -d "temp" ]; then
		mkdir -p temp
	fi

	get_item_from_cfg ${toc_cfg} toc0 item

	key=$(readcfg ${toc_cfg} key_toc0 ${name[0]})
	cert_type=$(readcfg ${toc_cfg} cert_type cert_type_toc0)
	key_type=$(readcfg ${toc_cfg} key_para key_toc0 | cut -c 1-3)
	if [ x${key_type} == "xrsa" ]; then
		psck_mode=RSA-PKCS
	elif [ x${key_type} == "xecc" ]; then
		psck_mode=ECDSA
	else
		pack_error "key_toc0 type error"
		exit 1
	fi

	#gen sboot hash
	dragon_securetool hash --mode 256 --in ${bin[0]} --out ./temp/${bin[0]}.hash.out
	if [ $? -ne 0 ]
	then
		pack_error "gen sboot hash error"
		exit 1
	fi

	#req no sign cert, ext is sboot_hash; use pubkey
	dragon_securetool req_cert --type ${cert_type} --cfg ${toc_cfg} --pubkey ${CFG_KEY_DIR}/${key}.pem.pub --ext ./temp/${bin[0]}.hash.out --out ./temp/${name[0]}.req
	if [ $? -ne 0 ]
	then
		pack_error "req no sign cert for toc0 error"
		exit 1
	fi

	#gen no sign cert hash, witch is to be signed
	dragon_securetool hash --mode 256 --type ${cert_type} --in ./temp/${name[0]}.req --out ./temp/${name[0]}.req.hash
	if [ $? -ne 0 ]
	then
		pack_error "gen no sign cert hash for toc0 error"
		exit 1
	fi

	#sign cert(to be signed) hash
	if [ "x$SOFTHSM_FLAG" == "x1" ]; then
		local id=$(echo "$key" | md5sum | awk '{print $1}')
		pkcs11-tool --label ${key} --id ${id} -s -p ${PIN} -m ${psck_mode} --module ${MODULES} --input-file ./temp/${name[0]}.req.hash --output-file ./temp/${name[0]}.req.sign
		if [ $? -ne 0 ]
		then
			pack_error "softhsm sign cert(to be signed) hash for toc0 error"
			exit 1
		fi
	else
		dragon_securetool sign --cfg ${toc_cfg} --privatekey ${CFG_KEY_DIR}/${key}.pem --in ./temp/${name[0]}.req.hash --out ./temp/${name[0]}.req.sign
		if [ $? -ne 0 ]
		then
			pack_error "sign cert(to be signed) hash for toc0 error"
			exit 1
		fi
	fi

	#create cert with sign
	dragon_securetool create_cert --type ${cert_type} --cfg ${toc_cfg} --pubkey ${CFG_KEY_DIR}/${key}.pem.pub --reqfile ./temp/${name[0]}.req --signfile ./temp/${name[0]}.req.sign --out ./toc0/${cert[0]}
	if [ $? -ne 0 ]
	then
		pack_error "create cert with sign for toc0 error"
		exit 1
	fi

	#create toc0.fex(toc0_head + sboot.crtpt + sboot)
	dragon_securetool create_toc0 --cfg ${toc_cfg} --out ./toc0.fex
	if [ $? -ne 0 ]
	then
		pack_error "dragon toc0 run error"
		exit 1
	fi
}

function do_signature_sboot()
{
	local sboot_file=$1;
	local flash_type=$2;

	#dram_param
	if [ -f ${LICHEE_TOOLS_DIR}/pack/pctools/linux/mod_update/update_sboot ]; then
		update_sboot $sboot_file  sys_config.bin  > /dev/null
		if [ $? -ne 0 ]
		then
			pack_error "update sboot run error"
			exit 1
		fi
	fi

	update_chip $sboot_file > /dev/null

	#dragon_toc only load sboot.bin
	[ "$(readlink -f $sboot_file)" != "$(readlink -f sboot.bin)" ] && \
	mv $sboot_file sboot.bin

	#readcfg determines whether the cfg file is legacy or new
	readcfg dragon_toc.cfg key_para key > /dev/null
	if [ $? -ne 0 ]; then
		dragonsecboot -toc0 dragon_toc.cfg $CFG_KEY_DIR ${LICHEE_PACK_OUT_DIR}/version_base.mk > /dev/null
		if [ $? -ne 0 ]
		then
			pack_error "dragon toc0 run error"
			exit 1
		fi
	else
		create_toc0 dragon_toc.cfg

	fi

	update_toc0  toc0.fex           sys_config.bin
	if [ $? -ne 0 ]
	then
		pack_error "update toc0 run error"
		exit 1
	fi

	[ "$(readlink -f $sboot_file)" != "$(readlink -f sboot.bin)" ] && \
	mv sboot.bin $sboot_file
	if [ -f toc0_$flash_type.fex ]; then
		rm -rf toc0_$flash_type.fex
	fi
	mv toc0.fex toc0_$flash_type.fex
	mv toc0 toc0_$flash_type
}

function do_signature_toc0()
{
	if [ -f sboot.bin ]; then
		do_signature_sboot sboot.bin bak
		mv sboot.bin sboot_bak.bin
	fi

	if [ -f sboot_sdcard.bin ]; then
		if [ -f cardscript.fex ]; then
			sed -i "s/TOC0_00000000000/TOC0_SDCARD00000/g" cardscript.fex
		fi
		do_signature_sboot sboot_sdcard.bin sdcard
	fi

	if [ -f sboot_nand.bin ]; then
		do_signature_sboot sboot_nand.bin nand

	fi

	if [ -f sboot_ufs.bin ]; then
		do_signature_sboot sboot_ufs.bin ufs
	fi

	if [ -f sboot_nor.bin ]; then
		do_signature_sboot sboot_nor.bin nor
	fi

	mv sboot_bak.bin sboot.bin
	mv toc0_bak.fex toc0.fex
	mv toc0_bak toc0
}

function toc1_create_cert_for_per_bin()
{
	local toc_cfg=$1
	local key=""
	local cert_type=""
	local key_type=""
	local psck_mode=""

	cert_type=$(readcfg ${toc_cfg} cert_type cert_type_toc1)
	key_type=$(readcfg ${toc_cfg} key_para key_toc1 | cut -c 1-3)
	if [ x${key_type} == "xrsa" ]; then
		psck_mode=RSA-PKCS
	elif [ x${key_type} == "xecc" ]; then
		psck_mode=ECDSA
	else
		pack_error "key_toc1 type error"
		exit 1
	fi

	for ((count=0; count < counts; count++)); do
		key=$(readcfg ${toc_cfg} key_toc1 ${name[count]})
		#gen ${bin[count]} hash
		dragon_securetool hash --mode 256 --in ${bin[count]} --out temp/${name[count]}_hash.out
		if [ $? -ne 0 ]
		then
			pack_error "gen hash ${name[count]} error"
			exit 1
		fi

		#req no sign cert, ext is sboot_hash; use pubkey
		dragon_securetool req_cert --type ${cert_type} --cfg ${toc_cfg} --pubkey ${CFG_KEY_DIR}/$key.pem.pub --ext temp/${name[count]}_hash.out --out temp/${cert[count]}.req
		if [ $? -ne 0 ]
		then
			pack_error "req no sign cert ${name[count]} error"
			exit 1
		fi

		#gen no sign cert hash, witch is to be signed
		dragon_securetool hash --mode 256 --type ${cert_type} --in temp/${cert[count]}.req --out temp/to_be_signed_${name[count]}_hash.out
		if [ $? -ne 0 ]
		then
			pack_error "gen no sign cert hash ${name[count]} error"
			exit 1
		fi

		#sign cert(to be signed) hash
		if [ "x$SOFTHSM_FLAG" == "x1" ]; then
			local id=$(echo "$key" | md5sum | awk '{print $1}')
			pkcs11-tool --label ${key} --id ${id} -s -p ${PIN} -m ${psck_mode} --module ${MODULES} --input-file temp/to_be_signed_${name[count]}_hash.out --output-file temp/${name[count]}_sign.out
			if [ $? -ne 0 ]
			then
				pack_error "softhsm sign cert(to be signed) hash ${name[count]} error"
				exit 1
			fi
		else
			dragon_securetool sign --cfg ${toc_cfg} --privatekey ${CFG_KEY_DIR}/$key.pem --in temp/to_be_signed_${name[count]}_hash.out --out temp/${name[count]}_sign.out
			if [ $? -ne 0 ]
			then
				pack_error "sign cert(to be signed) hash ${name[count]} error"
				exit 1
			fi
		fi

		#create cert with sign
		dragon_securetool create_cert --type ${cert_type} --cfg ${toc_cfg} --pubkey ${CFG_KEY_DIR}/${key}.pem.pub --reqfile temp/${cert[count]}.req --signfile temp/${name[count]}_sign.out --out toc1/cert/${cert[count]}
		if [ $? -ne 0 ]
		then
			pack_error "create cert with sign ${name[count]} error"
			exit 1
		fi
	done
}

function toc1_create_cert_for_rootkey()
{
	local toc_cfg=$1
	local key=""
	local cert_type=""
	local key_type=""
	local psck_mode=""

	cert_type=$(readcfg ${toc_cfg} cert_type cert_type_toc1)
	get_item_from_cfg ${toc_cfg} toc1 rootkey
	key=$(readcfg ${toc_cfg} key_toc0 rootkey)
	key_type=$(readcfg ${toc_cfg} key_para key_toc0 | cut -c 1-3)
	if [ x${key_type} == "xrsa" ]; then
		psck_mode=RSA-PKCS
	elif [ x${key_type} == "xecc" ]; then
		psck_mode=ECDSA
	else
		pack_error "key_toc0 type error"
		exit 1
	fi

	#rootkey no sign cert
	#req no sign rootkey cert, insert extensions in the dragon_toc.cfg; use pubkey
	dragon_securetool req_rootkey_cert --type ${cert_type} --cfg ${toc_cfg} --keypath ${CFG_KEY_DIR} --pubkey ${CFG_KEY_DIR}/${key}.pem.pub
	if [ $? -ne 0 ]
	then
		pack_error "req rootkey cert error"
		exit 1
	fi

	mv toc1/cert/${cert[0]} temp/${cert[0]}.req
	#gen no sign rootkey cert hash, witch is to be signed; Non-x509 certificates do not need to skip 4 bytes
	dragon_securetool hash --mode 256 --type ${cert_type} --in temp/${cert[0]}.req --out temp/to_be_signed_${name[0]}_hash.out
	if [ $? -ne 0 ]
	then
		pack_error "gen no sign rootkey cert hash error"
		exit 1
	fi

	#sign rootkey cert(to be signed) hash
	if [ "x$SOFTHSM_FLAG" == "x1" ]; then
		local id=$(echo "$key" | md5sum | awk '{print $1}')
		pkcs11-tool --label ${key} --id ${id} -s -p ${PIN} -m ${psck_mode} --module ${MODULES} --input-file temp/to_be_signed_${name[0]}_hash.out --output-file temp/${name[0]}_sign.out
		if [ $? -ne 0 ]
		then
			pack_error "softhsm sign rootkey cert(to be signed) hash error"
			exit 1
		fi
	else
		dragon_securetool sign --cfg ${toc_cfg} --privatekey ${CFG_KEY_DIR}/${key}.pem --in temp/to_be_signed_${name[0]}_hash.out --out temp/${name[0]}_sign.out
		if [ $? -ne 0 ]
		then
			pack_error "sign rootkey cert(to be signed) hash error"
			exit 1
		fi
	fi

	#create rootkey cert with sign
	dragon_securetool create_cert --type ${cert_type} --cfg ${toc_cfg} --pubkey ${CFG_KEY_DIR}/${key}.pem.pub --reqfile temp/${cert[0]}.req --signfile temp/${name[0]}_sign.out --out toc1/cert/${cert[0]}
	if [ $? -ne 0 ]
	then
		pack_error "create rootkey cert with sign error"
		exit 1
	fi
}

function do_signature_toc1()
{
	rm -rf toc1

	if [ ! -d "toc1/cert" ]; then
		mkdir -p toc1/cert
	fi

	if [ ! -d "temp" ]; then
		mkdir -p temp
	fi

	#create cert for toc1 item
	get_item_from_cfg dragon_toc.cfg toc1 item
	toc1_create_cert_for_per_bin dragon_toc.cfg

	#create cert for toc1 onlykey
	get_item_from_cfg dragon_toc.cfg toc1 onlykey
	toc1_create_cert_for_per_bin dragon_toc.cfg

	toc1_create_cert_for_rootkey dragon_toc.cfg

	#create toc1.fex(toc1_head + rootkey.crtpt + ..)
	dragon_securetool create_toc1 --cfg dragon_toc.cfg --out toc1.fex
	if [ $? -ne 0 ]
	then
		pack_error "dragon toc1 run error"
		exit 1
	fi
}

function do_signature()
{
	printf "prepare for signature by openssl\n"
	if [ ! -d $CFG_KEY_DIR ] ; then
		pack_error "No key exist, please run './build/createkeys' to generate keys first."
		exit 1
	fi
	if [ "x${PACK_SIG}" = "xprev_refurbish" ] ; then
		if [ "x${LICHEE_ARCH}" = "xarm64" ] ; then
			cp -v ${LICHEE_COMMON_CONFIG_DIR}/sign_config/dragon_toc_a64_no_secureos.cfg dragon_toc.cfg
		else
			cp -v ${LICHEE_COMMON_CONFIG_DIR}/sign_config/dragon_toc_no_secureos.cfg dragon_toc.cfg
		fi
	else
		if [ "x${LICHEE_ARCH}" = "xarm64" ] ; then
			if [ -f ${LICHEE_CHIP_CONFIG_DIR}/configs/default/dragon_toc.cfg ] ; then
				cp -v ${LICHEE_CHIP_CONFIG_DIR}/configs/default/dragon_toc.cfg dragon_toc.cfg
			else
				cp -v ${LICHEE_COMMON_CONFIG_DIR}/sign_config/dragon_toc_a64.cfg dragon_toc.cfg
			fi
		else
			if [ -f ${LICHEE_CHIP_CONFIG_DIR}/configs/default/dragon_toc.cfg ] ; then
				cp -v ${LICHEE_CHIP_CONFIG_DIR}/configs/default/dragon_toc.cfg dragon_toc.cfg
			else
				cp -v ${LICHEE_COMMON_CONFIG_DIR}/sign_config/dragon_toc.cfg dragon_toc.cfg
			fi
		fi
	fi
	if [ "x${PACK_NOR}" = "xnor" ] ; then
		cp -vf ${LICHEE_PACK_OUT_DIR}/dragon_toc_nor.cfg ${LICHEE_PACK_OUT_DIR}/dragon_toc.cfg
	fi

	if [ -f ${CFG_KEY_DIR}/softhsm2.cfg ]; then
		# fix tokendir
		tokendir=$(grep tokendir ${CFG_KEY_DIR}/softhsm2.cfg | awk '{print $3}')
		if [ "x$tokendir" != "x${CFG_KEY_DIR}/.token" ]; then
			sed -i "s#${tokendir}#${CFG_KEY_DIR}/.token#g" ${CFG_KEY_DIR}/softhsm2.cfg
		fi

		PIN=1234
		SOPIN=12345678
		SOFTHSM_TOOLS_DIR=${LICHEE_TOOLS_DIR}/pack/pctools/linux/softhsm
		MODULES=${SOFTHSM_TOOLS_DIR}/lib/softhsm/libsofthsm2.so
		export LD_LIBRARY_PATH=${SOFTHSM_TOOLS_DIR}/lib:${SOFTHSM_TOOLS_DIR}/lib/softhsm:${LIB_LIBRARY_PATH}
		export PATH=${SOFTHSM_TOOLS_DIR}/bin:$PATH
		export SOFTHSM2_CONF=${CFG_KEY_DIR}/softhsm2.cfg

		SOFTHSM_FLAG=1
	fi

	if [ $? -ne 0 ]
	then
		pack_error "dragon toc config file is not exist"
		exit 1
	fi

	rm -f cardscript.fex
	mv cardscript_secure.fex cardscript.fex
	if [ $? -ne 0 ]
	then
		pack_error "dragon cardscript_secure.fex file is not exist"
		exit 1
	fi

	if [ ! -f ${LICHEE_PLAT_OUT}/recovery.img ]; then
		printf "recovery img is not exist, remove recovery cert from dragon_toc.cfg\n"
		sed -i '/recovery/d' dragon_toc.cfg > /dev/null
	else
		local recovery_buf=$(grep "recovery" -nr dragon_toc.cfg)
		if [ x"${recovery_buf}" = x"" ]; then
			readcfg dragon_toc.cfg key_para key > /dev/null
				if [ $? -ne 0 ]; then
					sed -i '/^onlykey=boot/a\onlykey=recovery,      recovery.fex,        SCPFirmwareContentCertPK' dragon_toc.cfg
				else
					sed -i '/^boot=/a recovery=NonTrustedFirmwareContentCertPK' dragon_toc.cfg
					sed -i '/^onlykey=boot/a\onlykey=recovery,     recovery.fex,        recovery.crtpt' dragon_toc.cfg
				fi
		fi
	fi

	if [ "x${PACK_VERITY}" = "x${FLAGS_TRUE}" ]; then
		# verity setup for squashfs type filesystem
		if [ x"${PACK_PLATFORM}" = x"openwrt" ] || [ x"${PACK_PLATFORM}" = x"bsp" ] || [ x"${PACK_PLATFORM}" = x"buildroot" ]; then
			rm -rf rootfs.fex
			local link_real_new=$(get_realpath ${LICHEE_PLAT_OUT} ./)

			if [ x"${PACK_PLATFORM}" = x"openwrt" ]; then
				cp ${link_real_new}/rootfs.img		rootfs.fex
			else
				cp ${link_real_new}/rootfs.squashfs	rootfs.fex
			fi

			if [ "x${PACK_KERN}" == "xlinux-5.4" \
					-o "x${PACK_KERN}" == "xlinux-5.4-ansc" \
					-o "x${PACK_KERN}" == "xlinux-5.10" \
					-o "x${PACK_KERN}" == "xlinux-5.10-origin" \
					-o "x${PACK_KERN}" == "xlinux-5.15" \
					-o "x${PACK_KERN}" == "xlinux-5.15-origin" ]; then

				squashfs_real_size=`hexdump -s 0x28 -n 4 -e '/4 "%d"' rootfs.fex`
				squashfs_data_blocks=`expr \( ${squashfs_real_size} + 4095 \) / 4096`

				local TEMP=${LC_ALL}
				export LC_ALL=C

				veritysetup --data-blocks=${squashfs_data_blocks} format rootfs.fex hash_tree > raw_table

				export LC_ALL=${TEMP}

				readcfg dragon_toc.cfg key_para key > /dev/null
				if [ $? -ne 0 ]; then
					sed -i '/^onlykey=boot/a\onlykey=rootfs,          hash_tree,        SCPFirmwareContentCertPK' dragon_toc.cfg
				else
					sed -i '/^boot=/a rootfs=NonTrustedFirmwareContentCertPK' dragon_toc.cfg
					sed -i '/^onlykey=boot/a\onlykey=rootfs,          hash_tree,        rootfs.crtpt' dragon_toc.cfg
				fi
			else
				# get sample from squashfs rootfs
				local rootfs_per_MB=`grep "^rootfs_per_MB=" env.cfg | awk -F = '{printf $2}'`
				if [ -z $rootfs_per_MB ]; then
					echo "rootfs_per_MB is not defined in env.cfg, use default value 4096"
					rootfs_per_MB=4096
				fi

				extract_squashfs $rootfs_per_MB rootfs.fex rootfs-extract.fex
				if [ $? -ne 0 ]; then
					echo "extract squashfs error"
					exit 1;
				fi

				readcfg dragon_toc.cfg key_para key > /dev/null
				if [ $? -ne 0 ]; then
					sed -i '/^onlykey=boot/a\onlykey=rootfs,          rootfs-extract.fex,        SCPFirmwareContentCertPK' dragon_toc.cfg
				else
					sed -i '/^boot=/a rootfs=NonTrustedFirmwareContentCertPK' dragon_toc.cfg
					sed -i '/^onlykey=boot/a\onlykey=rootfs,          rootfs-extract.fex,        rootfs.crtpt' dragon_toc.cfg
				fi
			fi
		else
			# generate verity data, suport more different filesystem in the future
			(dmverity_genHashTable rootfs.fex rootfsHashTree.fex rootfsHashTable.fex &&
			openssl dgst -sha256 -binary -sign $CFG_KEY_DIR/SCPFirmwareContentCertPK.pem rootfsHashTable.fex > rootfsHashSign.fex &&
			openssl rsa -in $CFG_KEY_DIR/SCPFirmwareContentCertPK.pem -pubout -out rootfsPubKey.pk &&
			dmverity_genDownloadFile rootfs.fex rootfsHashSign.fex rootfsHashTable.fex rootfsHashTree.fex VerityInfo.fex) ||
			{ pack_error "generate verity data failed"; exit 1; }

			# add partition for verity data
			(add_partition -2 rootfsverityInfo 4096 "VerityInfo.fex" &&
			maybe_busybox unix2dos sys_partition.fex &&
			script  sys_partition.fex > /dev/null) ||
			{ pack_error "add verity info part failed"; exit 1; }

			# add verity tools into ramdisk
			local rootfsPath=`readlink -f rootfs.fex`
			local keyPath=`readlink -f rootfsPubKey.pk`
			local blockSize=`dmverity_determ_blk_size ${rootfsPath}`
			dmverity_deal $blockSize rootfsverityInfo ext4 $keyPath ||
			{ pack_error "deal verity utils failed"; exit 1; }
		fi
	fi

	if [ "x${PACK_SIGNFEL}" = "x${FLAGS_TRUE}" ]; then
		do_signature_fel
	fi

	do_signature_ft

	do_signature_toc0

	#readcfg determines whether the cfg file is legacy or new
	readcfg dragon_toc.cfg key_para key > /dev/null
	if [ $? -ne 0 ]; then
		dragonsecboot -toc1 dragon_toc.cfg $CFG_KEY_DIR ${LICHEE_PACK_OUT_DIR}/cnf_base.cnf ${LICHEE_PACK_OUT_DIR}/version_base.mk
		if [ $? -ne 0 ]
		then
			pack_error "dragon toc1 run error"
			exit 1
		fi
		cert=".der"
	else
		do_signature_toc1
		cert=".crtpt"
	fi

	sigbootimg --image boot.fex --cert toc1/cert/boot${cert} --output boot_sig.fex
	if [ $? -ne 0 ] ; then
		pack_error "Pack cert to image error"
		exit 1
	else
		mv -f boot_sig.fex boot.fex
	fi

	do_signature_dsp

	do_signature_riscv

	if [ "x${PACK_VERITY}" = "x${FLAGS_TRUE}" ]; then
		if [ x"${PACK_PLATFORM}" = x"openwrt" ] || [ x"${PACK_PLATFORM}" = x"bsp" ] || [ x"${PACK_PLATFORM}" = x"buildroot" ]; then
			if [ "x${PACK_KERN}" == "xlinux-5.4" \
					-o "x${PACK_KERN}" == "xlinux-5.4-ansc" \
					-o "x${PACK_KERN}" == "xlinux-5.10" \
					-o "x${PACK_KERN}" == "xlinux-5.10-origin" \
					-o "x${PACK_KERN}" == "xlinux-5.15" \
					-o "x${PACK_KERN}" == "xlinux-5.15-origin" ]; then
				verity_root_hash_str=`grep "Root hash:" raw_table | awk '{print $3}'`
				verity_salt_str=`grep "Salt:" raw_table | awk '{print $2}'`

				update_squashfs_verity -f rootfs.fex -c toc1/cert/rootfs${cert} -t hash_tree -r ${verity_root_hash_str} -s ${verity_salt_str}
				if [ $? -ne 0 ]; then
					pack_error "add verity block error."
					exit 1
				fi
			else
				update_squashfs rootfs.fex toc1/cert/rootfs${cert}
				if [ $? -ne 0 ]
				then
					pack_error "signature squashfs rootfs error."
					exit 1
				fi
			fi
		fi
	fi

	local link_real=$(get_realpath ${LICHEE_PLAT_OUT} ./)
	local recovery_path=${link_real}/recovery.img

	if [ -f "$recovery_path" ]; then
		sigbootimg --image recovery.fex --cert toc1/cert/recovery${cert} --output recovery_sig.fex
		if [ $? -ne 0 ] ; then
			pack_error "Pack cert to image error"
			exit 1
		else
			mv -f recovery_sig.fex recovery.fex
		fi
	fi

	echo "secure signature ok!"
}

function do_android_signature()
{
	if [ "x$LINUX_DTBO_FILE" = "x" ]; then
		echo "do not set LINUX_DTBO_FILE"
		line_num=`sed -n -e "/default.dtbo/=" dragon_toc.cfg`
		if [ "x$line_num" != "x" ]; then
			sed -i "$line_num s/^/;/g" dragon_toc.cfg
		fi
	else
		if [ -f $LINUX_DTBO_FILE ]
		then
			sed -i "s/default.dtbo/$LINUX_DTBO_FILE/g" dragon_toc.cfg
		else
			line_num=`sed -n -e "/default.dtbo/=" dragon_toc.cfg`
			if [ "x$line_num" != "x" ]; then
				sed -i "$line_num s/^/;/g" dragon_toc.cfg
			fi
		fi
	fi

	if [ $? -ne 0 ]
	then
		pack_error "dragon toc config file is not exist"
		exit 1
	fi

	rm -f cardscript.fex
	mv cardscript_secure.fex cardscript.fex
	if [ $? -ne 0 ]
	then
		pack_error "dragon cardscript_secure.fex file is not exist"
		exit 1
	fi

	do_signature_ft

	do_signature_toc0

	#readcfg determines whether the cfg file is legacy or new
	readcfg dragon_toc.cfg key_para key > /dev/null
	if [ $? -ne 0 ]; then
		dragonsecboot -toc1 dragon_toc.cfg $CFG_KEY_DIR ${LICHEE_PACK_OUT_DIR}/cnf_base.cnf ${LICHEE_PACK_OUT_DIR}/version_base.mk
		if [ $? -ne 0 ]
		then
			pack_error "dragon toc1 run error"
			exit 1
		fi
		cert=".der"
	else
		do_signature_toc1
		cert=".crtpt"
	fi

	if [ -e dboot.fex ]; then
		local keyname=$(awk -F, '/^[[:space:]]*onlykey=boot\S*,[[:space:]]*dboot.fex,/{print $1}' dragon_toc.cfg  | awk -F= '{print $2}')
		sigbootimg --image dboot.fex --cert toc1/cert/${keyname}${cert} --output dboot_sig.fex
		[ $? -ne 0 ] && pack_error "Pack cert to image error" && exit 1
		mv -f dboot_sig.fex dboot.fex
	fi

	echo "secure android signature ok!"
}

################################ Tina func ################################
function get_partition_downfile_size()
{
    local downloadfile_name=`echo $1 | awk -F '=' '{print $2}'`
    if [ x${downloadfile_name: 0-4} != x".fex" ]; then
        pack_error "downloadfile format is wrong, it should be end with .fex"
        exit -1
    fi
    if [ ! -f ${downloadfile_name} ]; then
        echo "  file ${downloadfile_name} not find"
    else
        if [ -L ${downloadfile_name} ]; then
            local downloadfile_name_link=`readlink -f ${downloadfile_name}`
            local linkfile_name=${downloadfile_name_link##*/}
            echo "  ${downloadfile_name} -> ${downloadfile_name_link}"
            if [ ! -f ${downloadfile_name_link} ]; then
                echo "  link file ${linkfile_name} not find"
            else
                local linkfile_size=`ls -lh ${downloadfile_name_link} | awk '{print $5}'`
                echo "  ${linkfile_name} size : ${linkfile_size} byte"
            fi
        else
            local downloadfile_size=`ls -lh ${downloadfile_name} | awk '{print $5}'`
            echo "  ${downloadfile_name} size : ${downloadfile_size} byte"
        fi
    fi
}

function get_partition_mbr_size()
{
    local partition_size_name=`echo $1 | awk -F '=' '{print $1}' | sed 's/partition/mbr/g'`
    local partition_size=`echo $1 | awk -F '=' '{print $2}'`
    echo "  ${partition_size_name}  : ${partition_size} Kbyte"
}

function show_partition_message()
{
    grep -c '[mbr]' $1 > /dev/null
    if [ $? -eq 0 ]; then
        cp $1 ./show_sys_partition.tmp;
        sed -i '/^[\r;]/d' ./show_sys_partition.tmp;
        sed -i '/partition_start/d' ./show_sys_partition.tmp;
        sed -i '/user_type/d' ./show_sys_partition.tmp;
        sed -i 's/\[partition\]/------------------------------------/g' ./show_sys_partition.tmp;
        sed -i 's/[ "\r]//g' ./show_sys_partition.tmp;
        sed -i '/^[;]/d' ./show_sys_partition.tmp;
        sed -i 's/name/partition_name/g' ./show_sys_partition.tmp;
        sed -i 's/size/partition_size/g' ./show_sys_partition.tmp;
        echo "------------------------------------"
        while read line
        do
            if [ "$line" == "------------------------------------" ];then
                echo "$line"
            else
                echo "  $line" | sed 's/=/  : /g'
                echo "  $line" | grep "mbr" >> /dev/null
                if [ $? -eq 0 ]; then
                    read line
                    get_partition_mbr_size $line
                fi
                echo "$line" | grep "downloadfile" >> /dev/null
                if [ $? -eq 0 ]; then
                    get_partition_downfile_size $line
                fi
            fi
        done < ./show_sys_partition.tmp
        echo "------------------------------------"
        rm ./show_sys_partition.tmp
    else
        echo "==========input is not a partition file=========="
    fi
}

function sparse_ext4()
{
    local img=$1
    local sparse_img=$2

    if file $img | grep -q ext4 ;then
        echo "now make sparse ext4 img: $img"
    else
        echo "$img is not ext4 img"
        file $img
        return
    fi

    img2simg $img $sparse_img
}

# pack user resources to a vfat filesystem
# To use this, please add a folder "user-resource" in configs to save files, and add a partition to sys_partition.fex/sys_partition_nor.fex like this:
# [partition]
#   name         = user-res
#   size         = 1024	//size should be 32 aligned
#   downloadfile = "user-resource.fex"
#   user_type    = 0x8000
function make_user_res()
{
    printf "make user resource for : $1\n"
    local USER_RES_SYS_PARTITION=$1
    local USER_RES_PART_NAME=user-res
    local USER_RES_FILE=user-resource

    printf "handle partition ${USER_RES_PART_NAME}\n"
    local USER_RES_PART_DOWNLOAD_FILE=user-resource.fex
    local USER_RES_PART_SIZE=`sed -n "/${USER_RES_PART_NAME}/{N;p}" ${USER_RES_SYS_PARTITION} | awk '$0~"size"{print $3/2}'`
    local USER_RES_FILE_PATH=$CFG_TOP_DIR/${PACK_PLATFORM}/target/$PACK_IC/$PACK_IC-${PACK_BOARD}/configs/${USER_RES_FILE}

    if [ x"${USER_RES_PART_DOWNLOAD_FILE}" != x"" -a  x"${USER_RES_PART_SIZE}" != x"" ]; then
        rm -f ${LICHEE_PACK_OUT_DIR}/user-resource.fex
        mkfs.vfat ${LICHEE_PACK_OUT_DIR}/user-resource.fex -C ${USER_RES_PART_SIZE}
        if [ -d ${USER_RES_FILE_PATH} ]; then
            USER_RES_FILE_SIZE=`du --apparent-size --summarize "${USER_RES_FILE_PATH}" | awk '{print $1}'`
            printf "file size: ${USER_RES_FILE_SIZE}\n"
            printf "partition size: ${USER_RES_PART_SIZE}\n"
            if [ ${USER_RES_PART_SIZE} -le ${USER_RES_FILE_SIZE} ]; then
                printf "file size is larger than partition size, please check your configuration\n"
                printf "please enlarge size of ${USER_RES_PART_NAME} in sys_partition or remove some files in $USER_RES_FILE_PATH\n"
                exit -1
            fi
            mcopy -s -v -i ${LICHEE_PACK_OUT_DIR}/${USER_RES_PART_DOWNLOAD_FILE} ${USER_RES_FILE_PATH}/* ::
            if [ $? -ne 0 ]; then
                printf "mcopy file fail, exit\n"
                exit -1
            fi
        else
            printf "can not find ${USER_RES_FILE_PATH}, ignore it\n"
        fi
    else
        printf "no user resource partitions\n"
    fi
}

#[partition]
#    name         = app
#    size         = 10080
#    downloadfile = "app.fex"
#    user_type    = 0x8000
function make_app_res()
{
    local APP_PART_NAME=app
    cp $1 sys_partition_tmp_app.fex

    sed -i '/^[ \t]*downloadfile/d' sys_partition_tmp_app.fex
    maybe_busybox unix2dos sys_partition_tmp_app.fex
    script  sys_partition_tmp_app.fex > /dev/null
    update_mbr sys_partition_tmp_app.bin 1 sunxi_mbr_tmp_app.fex > /dev/null

    local APP_PART_DOWNLOAD_FILE=app.fex
    local APP_PART_FILE_PATH=$CFG_TOP_DIR/out/$PACK_IC/$PACK_BOARD/$PACK_PLATFORM/build_dir/target/app
    local APP_PART_SIZE_IN_SECTOR=`parser_mbr sunxi_mbr_tmp_app.fex get_size_by_name ${APP_PART_NAME}`
	local TINA_TOOLS_PATH=$CFG_TOP_DIR/out/$PACK_IC/$PACK_BOARD/$PACK_PLATFORM/staging_dir/host/bin

    if [ x${APP_PART_DOWNLOAD_FILE} != x'' -a  x${APP_PART_SIZE_IN_SECTOR} != x'' ]; then
        let APP_PART_SIZE_IN_K=$APP_PART_SIZE_IN_SECTOR/2
        echo "APP_PART_DOWNLOAD_FILE = ${LICHEE_PACK_OUT_DIR}/${APP_PART_DOWNLOAD_FILE}"
        rm -f ${LICHEE_PACK_OUT_DIR}/${APP_PART_DOWNLOAD_FILE}
        ${TINA_TOOLS_PATH}/make_ext4fs -l ${APP_PART_SIZE_IN_K}k -b 1024 -m 0 -j 1024 ${LICHEE_PACK_OUT_DIR}/${APP_PART_DOWNLOAD_FILE}  ${APP_PART_FILE_PATH}
    else
        printf "no app resource partitions\n"
    fi
}

#[partition]
#    name         = data
#    size         = 10080
#    downloadfile = "data.fex"
#    user_type    = 0x8000
function make_data_res()
{
    local DATA_PART_NAME=data
    cp $1 sys_partition_tmp_data.fex

    sed -i '/^[ \t]*downloadfile/d' sys_partition_tmp_data.fex
    maybe_busybox unix2dos sys_partition_tmp_data.fex
    script  sys_partition_tmp_data.fex > /dev/null
    update_mbr sys_partition_tmp_data.bin 1 sunxi_mbr_tmp_data.fex > /dev/null

    local DATA_PART_DOWNLOAD_FILE=data.fex
    local DATA_PART_DOWNLOAD_FILE_SPARSE=data_s.fex
    local DATA_PART_FILE_PATH=$CFG_TOP_DIR/out/$PACK_IC/$PACK_BOARD/$PACK_PLATFORM/build_dir/target/data
    local DATA_PART_SIZE_IN_SECTOR=`parser_mbr sunxi_mbr_tmp_data.fex get_size_by_name ${DATA_PART_NAME}`
	local TINA_TOOLS_PATH=$CFG_TOP_DIR/out/$PACK_IC/$PACK_BOARD/$PACK_PLATFORM/staging_dir/host/bin

    if [ x${DATA_PART_DOWNLOAD_FILE} != x'' -a  x${DATA_PART_SIZE_IN_SECTOR} != x'0' ]; then
        let DATA_PART_SIZE_IN_K=$DATA_PART_SIZE_IN_SECTOR/2
        echo "DATA_PART_DOWNLOAD_FILE = ${LICHEE_PACK_OUT_DIR}/${DATA_PART_DOWNLOAD_FILE}"
        rm -f ${LICHEE_PACK_OUT_DIR}/${DATA_PART_DOWNLOAD_FILE}
        rm -f ${LICHEE_PACK_OUT_DIR}/${DATA_PART_DOWNLOAD_FILE_SPARSE}
        ${TINA_TOOLS_PATH}/make_ext4fs -l ${DATA_PART_SIZE_IN_K}k -b 1024 -m 0 -j 1024 ${LICHEE_PACK_OUT_DIR}/${DATA_PART_DOWNLOAD_FILE}  ${DATA_PART_FILE_PATH}
        sparse_ext4 ${LICHEE_PACK_OUT_DIR}/${DATA_PART_DOWNLOAD_FILE} ${LICHEE_PACK_OUT_DIR}/${DATA_PART_DOWNLOAD_FILE_SPARSE}
    else
        printf "no data resource partitions\n"
    fi
}

################################ Platform func ################################
function do_pack_android()
{
	local localpath=$(readlink -f $(pwd))
	local androidout=$(readlink -f ${ANDROID_IMAGE_OUT})
	local link_real=$(get_realpath $androidout $localpath)

	printf "packing for android\n"

	if [ -z "${ANDROID_IMAGE_OUT}" ] ; then
		pack_error "please specify ANDROID_IMAGE_OUT env"
		exit 1
	fi

	local fex_list=($(\gawk '$0~"^[[:space:]]*downloadfile[[:space:]]*="{print $NF}' sys_partition.fex | sed 's/[",\r,\n]//g'))
	fex_list+=(vendor_boot-debug.fex)

	local img_name=""
	for fex_name in ${fex_list[@]}; do
		img_name=${fex_name%\.fex}.img
		if [ -f ${ANDROID_IMAGE_OUT}/${img_name} ]; then
			ln -sf ${link_real}/${img_name} ${fex_name}
			echo "link ${img_name} -> ${fex_name}"
		fi
	done

	if [ -e $androidout/vmlinux ]; then
		export PATH=$PATH:${LICHEE_TOP_DIR}/build/bin
		local vmlinuxpath=$(dirname $(readlink -f $androidout/vmlinux))
		local vmlinuxname=$(basename $(readlink -f $androidout/vmlinux))
		(cd $vmlinuxpath && tar cf $localpath/vmlinux.tar.bz2 --use-compress-prog=lbzip2 $vmlinuxname)
		rm -rf vmlinux.fex
		ln -sf vmlinux.tar.bz2 vmlinux.fex
	fi

	if [ -n "${PACK_BOOT_PATH}" ] && [ "x${PACK_BOOT_PATH}" != "xnone" ]; then
		ln -sf $PACK_BOOT_PATH boot.fex
	fi

	if [ "x${PACK_SECURE}" = "xsecure" ]; then
		echo "secure"
		do_android_signature
	else
		echo "normal"
	fi
}

function prepare_mixed_androiddragonboard()
{
	local mixed_fw_type

	if [ "${PACK_TYPE}" != "android" ] || [ -z "$PACK_MIXED_FIRMWARE" ]; then
		return 0
	fi

	case "$PACK_MIXED_FIRMWARE" in
		dragonboard|dragonabts)
			mixed_fw_type="$PACK_MIXED_FIRMWARE"
			pack_info "${FUNCNAME[0]}: mixed firmware type: $mixed_fw_type"
			;;
		*)
			echo "Unsupport mixed firmware type: $PACK_MIXED_FIRMWARE"
			return 1
	esac

	(
		cd ${LICHEE_PACK_OUT_DIR}

		local localpath=$(readlink -f $(pwd))
		local mixedboardout=$(readlink -f ${CFG_PLAT_OUT}/../$mixed_fw_type)
		if [ ! -d $mixedboardout ]; then
			pack_error "${FUNCNAME[0]}: cannot find out path for $mixed_fw_type"
			exit 1
		fi

		local envpath=($LICHEE_BOARD_CONFIG_DIR/$mixed_fw_type $LICHEE_CHIP_CONFIG_DIR/configs/default)
		local partition=(bootloader_b:boot-resource.fex env_b:denv.fex
					boot_b:dboot.fex vendor_boot_b:vendor_boot.fex media_data)

		local item name linenum nstart nend nmax file

		for item in ${partition[@]}; do
			name=${item/:*}
			linenum=$(sed -n "/^\s*name\s*=\s*$name/=" sys_partition.fex)
			if [ -z "$linenum" ]; then
				pack_error "${FUNCNAME[@]}: leak neccery partition $name in sys_partition.fex"
				exit 1
			fi
		done

		for item in ${envpath[@]}; do
			if [ -e $item/env.cfg ]; then
				cp $item/env.cfg denv.cfg
				sed -i '/^\s*boot_normal=/s/\<boot\>/boot_b/g' denv.cfg
				generate_env_for_uboot denv.cfg $mixedboardout/env.img
				rm -rf denv.cfg
				break
			fi
		done

		if  [ ! -e $mixedboardout/env.img  ] || \
			[ ! -e $mixedboardout/boot.img ] || \
			[ ! -e $mixedboardout/rootfs.ext4 ] || \
			[ ! -e $LICHEE_BOARD_CONFIG_DIR/$mixed_fw_type/test_config.fex ]; then
			pack_error "${FUNCNAME[@]}: leak neccery img/fex for $mixed_fw_type"
			exit 1
		fi

		printf "prepare for mixed android/$mixed_fw_type packing...\n"
		for item in ${partition[@]}; do
			name=${item/:*}
			linenum=$(sed -n "/^\s*name\s*=\s*$name/=" sys_partition.fex)
			nstart=$linenum
			nend=$linenum
			nmax=$(wc -l sys_partition.fex | awk '{print $1}')
			while [ $nstart -gt 1 ]; do
				nstart=$((nstart-1))
				if [ -n "$(sed -n "$nstart p" sys_partition.fex | grep "^\s*\[\S\+\]")" ]; then
					break;
				fi
			done

			while [ $nend -lt $nmax ]; do
				nend=$((nend+1))
				if [ -n "$(sed -n "$nend p" sys_partition.fex | grep "^\s*\[\S\+\]")" ]; then
					break;
				fi
			done
			[ $nend -ne $nmax ] && nend=$((nend-1))

			file="$(sed -n "${nstart},${nend}p" sys_partition.fex | \
					awk -F= '/^[[:space:]]*downloadfile[[:space:]]*=/{print $2}')"
			dlfile=${e#*:}
			case $name in
				bootloader_b|env_b|boot_b|vendor_boot_b)
					if [ -z "$file" ]; then
						sed -i "$linenum a\ \ \ \ downloadfile = \"${item#*:}\"" sys_partition.fex
					fi
					;;
				media_data)
					local cmd="$nstart i"
					local size=$(stat $mixedboardout/rootfs.ext4 --format="%s")

					size=$(((size+32*1024*1024-1)/(16*1024*1024)*16))  # at least size + 16M, and 16M align

					if [ -z "$(grep "^\s*name\s*=\s*rootfs" sys_partition.fex)" ]; then
						cmd+="[partition]\n"
						cmd+="    name         = rootfs\n"
						cmd+="    size         = ${size}M\n"
						cmd+="    downloadfile = \"drootfs.fex\"\n"
						cmd+="    user_type    = 0x8000\n"
						cmd+="\n"
					fi
					[ "$cmd" != "$nstart i" ] && sed -i "$cmd" sys_partition.fex
					;;
			esac
		done

		# Delete "^M" under Windows
		sed -i 's|
||g' sys_partition.fex

		readcfg dragon_toc.cfg key_para key > /dev/null
		if [ $? -ne 0 ]; then
			[ -z "$(grep "^\s*onlykey=boot_b,\s*dboot.fex," dragon_toc.cfg)" ] && \
			sed -i 's|^\(\s*onlykey=boot_b,\s*\)\S*,|\1dboot.fex,|g'    dragon_toc.cfg

			[ -z "$(grep "^\s*onlykey=boot_b,\s*dboot.fex," dragon_toc.cfg)" ] && \
			echo "onlykey=boot_b,dboot.fex,SCPFirmwareContentCertPK" >> dragon_toc.cfg
		else
			if [ -z "$(grep "^\s*onlykey=boot_b,\s*dboot.fex," dragon_toc.cfg)" ]; then
				sed -i '/^optee=/a boot_b=SCPFirmwareContentCertPK' dragon_toc.cfg
				sed -i '/^item=optee/a\onlykey=boot_b,dboot.fex,boot_b.crtpt' dragon_toc.cfg
			fi
		fi

		cp $LICHEE_BOARD_CONFIG_DIR/$mixed_fw_type/test_config.fex .
		maybe_busybox dos2unix test_config.fex
		cp test_config.fex boot-resource/
		script test_config.fex > /dev/null
		cp test_config.bin boot-resource/

		cp $mixedboardout/env.img denv.fex
		cp $mixedboardout/boot.img dboot.fex
		cp $mixedboardout/rootfs.ext4 drootfs.fex
		echo "android:$PACK_MIXED_FIRMWARE" > mixed-image-type.txt
	)
	if [ $? -ne 0 ]; then
		pack_error "${FUNCNAME[0]} fail"
		return 1
	fi
	return 0
}

function do_pack_dragonboard()
{
	local link_real=$(get_realpath ${LICHEE_PLAT_OUT} ./)
	printf "packing for dragonboard\n"

	ln -sf ${link_real}/boot.img boot.fex
	ln -sf ${link_real}/rootfs.ext4 rootfs.fex
	ln -sf ${link_real}/rootfs.ubifs rootfs-ubifs.fex

	if [ "x${PACK_SECURE}" = "xsecure" ]; then
		do_signature
	else
		echo "normal"
	fi
}

function do_pack_dragonabts()
{
	local link_real=$(get_realpath ${LICHEE_PLAT_OUT} ./)
	printf "packing for dragonabts\n"

	ln -sf ${link_real}/boot.img boot.fex
	ln -sf ${link_real}/rootfs.ext4 rootfs.fex
	ln -sf ${link_real}/rootfs.ubifs rootfs-ubifs.fex

	if [ "x${PACK_SECURE}" = "xsecure" ]; then
		do_signature
	else
		echo "normal"
	fi
}

function do_pack_linux()
{
	local link_real=$(get_realpath ${LICHEE_PLAT_OUT} ./)
	local recovery_path=${link_real}/recovery.img

	printf "packing for linux\n"

	do_fit_image
	if [ $? -eq 0 ]; then
		[ -f kernel.itb ] && mv kernel.itb   kernel.fex
		[ -f kernel-dtb.itb ] && mv kernel-dtb.itb   kernel-dtb.fex
	else
		[ -f ${link_real}/bootB.img ] && ln -sf ${link_real}/bootB.img bootB.fex
		ln -sf ${link_real}/boot.img        boot.fex

		# Those files is ready for SPINor.
		ln -sf ${link_real}/uImage          kernel.fex
		if [ x"${PACK_PLATFORM}" = x"openwrt" ]; then
			ln -sf ${link_real}/rootfs.img rootfs_nor.fex
		else
			ln -sf ${link_real}/rootfs.squashfs rootfs_nor.fex
		fi
	fi

	if [ x"${PACK_PLATFORM}" = x"openwrt" ]; then
		ln -sf ${link_real}/rootfs.img     rootfs.fex
	else
		ln -sf ${link_real}/rootfs.ext4     rootfs.fex
	fi

	ln -sf ${link_real}/rootfs.ubifs     rootfs-ubifs.fex

	if [ -f "$recovery_path" ]; then
		ln -sf ${recovery_path}     recovery.fex
	fi

	if [ "x${PACK_SECURE}" = "xsecure" ]; then
		echo "secure"
		do_signature
	else
		echo "normal"
	fi
}

function create_kernel_fit_image()
{
	local its_name=$1

	printf "create_kernel_fit_image\n"

	if [ ! -f ${LICHEE_PACK_OUT_DIR}/${its_name}.its ]; then
		printf "can not found ${its_name}.its\n"
		return 1
	fi

	mkimage -f ${its_name}.its ${its_name}.itb
	if [ $? -ne 0 ]; then
		pack_error "mkimage ${its_name}.itb error\n"
		exit 1
	fi
}

function do_fit_image()
{
	printf "do_fit_image\n"

	create_kernel_fit_image kernel
	if [ $? -ne 0 ]; then
		return 1
	fi

	create_kernel_fit_image kernel-dtb
	if [ $? -ne 0 ]; then
		return 1
	fi
}

function main()
{
	local output_resources=${FLAGS_output_resources:-false}
	local from_resources=${FLAGS_from_resources}

	local support_secure_type
	case x$LICHEE_PACK_SECURE_TYPE in
		xnone|xsecure|xany)
			support_secure_type=$LICHEE_PACK_SECURE_TYPE
			;;
		x)
			support_secure_type=any
			;;
		*)
			pack_error "Unsupport pack secure type: $LICHEE_PACK_SECURE_TYPE"
			return 1
			;;
	esac

	if [ "$support_secure_type" != "any" ] && [ "$support_secure_type" != "$PACK_SECURE" ]; then
		pack_error "This platform only support secure type [$support_secure_type], but current using [$PACK_SECURE], please check!!!"
		pack_error "Now, we try using secure type [$support_secure_type]!!!"
		PACK_SECURE=$support_secure_type
	fi

	if [ "$output_resources" == "false" ] && [ -z "$from_resources" ]; then
		do_prepare
		do_ini_to_dts
		do_common
		do_pack_${PACK_TYPE}
		do_finish
		return $?
	fi

	if [ "$output_resources" == "true" ]; then
		do_prepare
		do_ini_to_dts
	elif [ -n "$from_resources" ]; then
		if [ ! -d $from_resources ]; then
			pack_error "Cannot find resources path: $from_resources"
			return 1
		fi

		local count=0
		while [ -e ${LICHEE_PACK_OUT_DIR} -a  $count -lt 20 ]; do
			rm -rf ${LICHEE_PACK_OUT_DIR}
			count=$((count+1))
		done
		cp -rax $from_resources ${LICHEE_PACK_OUT_DIR}
		(
			cd $LICHEE_OUT_DIR
			if [ "${LICHEE_PACK_OUT_DIR}" != "$LICHEE_OUT_DIR/pack_out" ]; then
				rm -rf pack_out
				ln -sf ${LICHEE_IC}/${LICHEE_BOARD}/pack_out pack_out
			fi
		)

		if [ "${PACK_PLATFORM}" == "android" ] && [ -n "$PACK_MIXED_FIRMWARE" ]; then
			local resource_type="$(cat ${LICHEE_PACK_OUT_DIR}/mixed-image-type.txt)"
			local mixed_fw_type="android:$PACK_MIXED_FIRMWARE"
			if [ "$resource_type" != "android:$PACK_MIXED_FIRMWARE" ]; then
				pack_error "mixed firmware type [$mixed_fw_type] but resource type [$resource_type]"
				exit 1
			fi
			pack_info "mixed firmware type [$mixed_fw_type]"
		fi

		cd ${LICHEE_PACK_OUT_DIR}
		do_common
		do_pack_${PACK_TYPE}
		do_finish
	fi
	return $?
}

main "$@"

longan/build/pack 修改后:

#!/bin/bash
#
# pack/pack
# (c) Copyright 2013
# Allwinner Technology Co., Ltd. <www.allwinnertech.com>
# James Deng <csjamesdeng@allwinnertech.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.

############################ Notice #####################################
# a. Some config files priority is as follows:
#    - xxx_${platform}.{cfg|fex} > xxx.{cfg|fex}
#    - ${chip}/${board}/*.{cfg|fex} > ${chip}/default/*.{cfg|fex}
#    - ${chip}/default/*.cfg > ${LICHEE_COMMON_CONFIG_DIR}/imagecfg/*.cfg
#    - ${chip}/default/*.fex > ${LICHEE_COMMON_CONFIG_DIR}/partition/*.fex
#  e.g. sun8iw7p1/configs/perf/image_linux.cfg > sun8iw7p1/configs/default/image_linux.cfg
#       > ${LICHEE_COMMON_CONFIG_DIR}/imagecfg/image_linux.cfg > sun8iw7p1/configs/perf/image.cfg
#       > sun8iw7p1/configs/default/image.cfg > ${LICHEE_COMMON_CONFIG_DIR}/imagecfg/image.cfg
#
# b. Support Nor storages rule:
#    - Need to create sys_partition_nor.fex or sys_partition_nor_${platform}.fex
#    - Add "{filename = "full_img.fex",     maintype = "12345678", \
#      subtype = "FULLIMG_00000000",}" to image[_${platform}].cfg
#
# c. Switch uart port
#    - Need to add your chip configs into ${LICHEE_COMMON_CONFIG_DIR}/debug/card_debug_pin
#    - Call pack with 'debug' parameters

#if you want to debug pack, set vlaue to 1. use pause func in the place where you want to stop
enable_pause=0

function get_char()
{
	SAVEDSTTY=`stty -g`
	stty -echo
	stty cbreak
	dd if=/dev/tty bs=1 count=1 2> /dev/null
	stty -raw
	stty echo
	stty $SAVEDSTTY
}

function pause()
{
	if [ "x$1" != "x" ] ;then
		echo "$1"
	fi
	if [ $enable_pause -eq 1 ] ; then
		echo "Press any key to continue!"
		char=`get_char`
	fi
}

function pack_error()
{
	echo -e "\033[47;31mERROR: $*\033[0m"
}

function pack_warn()
{
	echo -e "\033[47;34mWARN: $*\033[0m"
}

function pack_info()
{
	echo -e "\033[47;30mINFO: $*\033[0m"
}

localpath=$(cd $(dirname $0) && pwd)
. $localpath/shflags

# define option, format:
#   'long option' 'default value' 'help message' 'short option'
DEFINE_string 'chip' '' 'chip to build, e.g. sun7i' 'c'
DEFINE_string 'ic' '' 'ic to build, e.g. a50' 'i'
DEFINE_string 'addition' '' 'additional config files, e.g. xx.fex' 'a'
DEFINE_string 'platform' '' 'platform to build, e.g. linux, android' 'p'
DEFINE_string 'platform_version' '' 'platform version to build' 'V'
DEFINE_string 'board' '' 'board to build, e.g. evb' 'b'
DEFINE_string 'kernel' '' 'kernel to build, e.g. linux-3.4, linux-3.10' 'k'
DEFINE_string 'debug_mode' 'uart0' 'config debug mode, e.g. uart0, card0' 'd'
DEFINE_string 'signture' 'none' 'pack boot signture to do secure boot' 's'
DEFINE_string 'secure' 'none' 'pack secure boot with -v arg' 'v'
DEFINE_string 'mode' 'normal' 'pack dump firmware' 'm'
DEFINE_string 'function' 'android' 'pack private firmware' 'f'
DEFINE_string 'vsp' '' 'pack firmware for vsp' 't'
DEFINE_string 'programmer' '' 'creat programmer img or not' 'w'
DEFINE_string 'key_path' '' 'the path of keys' 'P'
DEFINE_string 'nor' 'none' 'pack nor image' 'n'
DEFINE_boolean 'verity' false 'if enable dm-verity' ''
DEFINE_boolean 'signfel' false 'if enable fel signing' ''
DEFINE_string 'boot_path' '' 'the path of gki boot.img' 'B'
DEFINE_string 'output_resources' '' 'only output resources to pack-out' ''
DEFINE_string 'from_resources' '' 'pack from resources path' ''

# parse the command-line
FLAGS "$@" || exit $?
eval set -- "${FLAGS_ARGV}"

PACK_CHIP=${FLAGS_chip}
PACK_IC=${FLAGS_ic}
PACK_PLATFORM=${FLAGS_platform}
PACK_PLATFORM_VERSION=${FLAGS_platform_version}
PACK_BOARD=${FLAGS_board}
PACK_KERN=${FLAGS_kernel}
PACK_DEBUG=${FLAGS_debug_mode}
PACK_SIG=${FLAGS_signture}
PACK_SECURE=${FLAGS_secure}
PACK_MODE=${FLAGS_mode}
PACK_FUNC=${FLAGS_function}
PACK_VSP=${FLAGS_vsp}
PACK_PROGRAMMER=${FLAGS_programmer}
PACK_NOR=${FLAGS_nor}
PACK_PRODUCT=${FLAGS_product}
PACK_VERITY=${FLAGS_verity}
PACK_SIGNFEL=${FLAGS_signfel}
PACK_ADD_FILES=(${FLAGS_addition})
PACK_KEY_PATH=${FLAGS_key_path}
PACK_BOOT_PATH=${FLAGS_boot_path}

CFG_TOP_DIR=$(cd $localpath/../ && pwd)
CFG_PLAT_OUT=$CFG_TOP_DIR/out/$PACK_IC/$PACK_BOARD/$PACK_PLATFORM
CFG_KEY_DIR=$CFG_TOP_DIR/out/$PACK_IC/common/keys

if [ ! -z "${PACK_KEY_PATH}" ]; then
    CFG_KEY_DIR=${PACK_KEY_PATH}
fi
pack_info "${CFG_KEY_DIR}"

if [ ! -d ${CFG_PLAT_OUT} ] || \
   [ ! -f $CFG_PLAT_OUT/.buildconfig ]; then
	pack_error "config & build lichee before you pack"
	exit 1
fi

source $CFG_PLAT_OUT/.buildconfig

if [ -z "${PACK_KERN}" ]; then
	pack_info "No kernel param, parse it from .buildconfig"
	PACK_KERN=$LICHEE_KERN_VER
	if [ -z "${PACK_KERN}" ]; then
		pack_error "Failed to parse kernel param from .buildconfig"
		exit 1
	fi
fi

PACK_TYPE=""
case "x${PACK_PLATFORM}" in
	"xandroid")
		PACK_TYPE="android"
		;;
	"xdragonboard")
		PACK_TYPE="dragonboard"
		;;
	"xdragonabts")
		PACK_TYPE="dragonabts"
		;;
	"xbsp"|"xsata"|"xbuildroot"|"xopenwrt"|"xdebian")
		PACK_TYPE="linux"
		;;
	*)
		pack_error "Unsupport PACK_PLATFORM: ${PACK_PLATFORM}"
		exit 1
		;;
esac

export PATH=${LICHEE_TOOLS_DIR}/pack/pctools/linux/mod_update:${LICHEE_TOOLS_DIR}/pack/pctools/linux/openssl:${LICHEE_TOOLS_DIR}/pack/pctools/linux/eDragonEx:${LICHEE_TOOLS_DIR}/pack/pctools/linux/fsbuild200:${LICHEE_TOOLS_DIR}/pack/pctools/linux/android:$PATH
export LD_LIBRARY_PATH=${LICHEE_TOOLS_DIR}/pack/pctools/linux/softhsm/lib/:$LD_LIBRARY_PATH

tools_file_list=(
${LICHEE_COMMON_CONFIG_DIR}/tools/split_xxxx.fex
${LICHEE_CHIP_CONFIG_DIR}/tools/split_xxxx.fex
${LICHEE_COMMON_CONFIG_DIR}/tools/usbtool_test.fex
${LICHEE_COMMON_CONFIG_DIR}/tools/usbtool_crash.fex
${LICHEE_CHIP_CONFIG_DIR}/tools/usbtool_test.fex
${LICHEE_COMMON_CONFIG_DIR}/tools/cardscript.fex
${LICHEE_COMMON_CONFIG_DIR}/tools/cardscript_secure.fex
${LICHEE_CHIP_CONFIG_DIR}/tools/cardscript.fex
${LICHEE_CHIP_CONFIG_DIR}/tools/cardscript_secure.fex
${LICHEE_COMMON_CONFIG_DIR}/tools/cardtool.fex
${LICHEE_CHIP_CONFIG_DIR}/tools/cardtool.fex
${LICHEE_COMMON_CONFIG_DIR}/tools/usbtool.fex
${LICHEE_CHIP_CONFIG_DIR}/tools/usbtool.fex
${LICHEE_COMMON_CONFIG_DIR}/tools/usbtool_crash.fex
${LICHEE_CHIP_CONFIG_DIR}/tools/usbtool_crash.fex
${LICHEE_COMMON_CONFIG_DIR}/tools/aultls32.fex
${LICHEE_CHIP_CONFIG_DIR}/tools/aultls32.fex
${LICHEE_COMMON_CONFIG_DIR}/tools/aultools.fex
${LICHEE_CHIP_CONFIG_DIR}/tools/aultools.fex
)

configs_file_list=(
${LICHEE_COMMON_CONFIG_DIR}/toc/toc1.fex
${LICHEE_COMMON_CONFIG_DIR}/toc/toc0.fex
${LICHEE_COMMON_CONFIG_DIR}/toc/toc0_sdcard.fex
${LICHEE_COMMON_CONFIG_DIR}/toc/toc0_nand.fex
${LICHEE_COMMON_CONFIG_DIR}/toc/toc0_ufs.fex
${LICHEE_COMMON_CONFIG_DIR}/toc/toc0_ft.fex
${LICHEE_COMMON_CONFIG_DIR}/toc/boot_package.fex
${LICHEE_COMMON_CONFIG_DIR}/hdcp/esm.fex
${LICHEE_COMMON_CONFIG_DIR}/dtb/sunxi.fex
${LICHEE_COMMON_CONFIG_DIR}/imagecfg/*.cfg
${LICHEE_COMMON_CONFIG_DIR}/partition/sys_partition_dump.fex
${LICHEE_COMMON_CONFIG_DIR}/partition/sys_partition_private.fex
${LICHEE_COMMON_CONFIG_DIR}/version/version_base.mk
${LICHEE_CHIP_CONFIG_DIR}/configs/default/*
${LICHEE_CHIP_CONFIG_DIR}/configs/${PACK_BOARD}/*.fex
${LICHEE_CHIP_CONFIG_DIR}/configs/${PACK_BOARD}/boot_package*.cfg
${LICHEE_CHIP_CONFIG_DIR}/configs/${PACK_BOARD}/${LICHEE_KERN_VER}/*.cfg
${LICHEE_CHIP_CONFIG_DIR}/configs/default/version_base.mk
${LICHEE_CHIP_CONFIG_DIR}/dtbo/*
${LICHEE_BOARD_CONFIG_DIR}/dtbo/*
${LICHEE_CHIP_CONFIG_DIR}/${BIN_PATH}/ft_${PACK_CHIP}.bin
${LICHEE_COMMON_CONFIG_DIR}/sign_config/dragon_toc_ft.cfg
${LICHEE_CHIP_CONFIG_DIR}/configs/default/dragon_toc_ft.cfg
${LICHEE_COMMON_CONFIG_DIR}/sign_config/cnf_base.cnf
${LICHEE_PLAT_OUT}/.buildconfig
)

product_configs_file_list=(
${LICHEE_CHIP_CONFIG_DIR}/configs/${PACK_BOARD}/${PACK_PLATFORM}/*.fex
${LICHEE_CHIP_CONFIG_DIR}/configs/${PACK_BOARD}/${PACK_PLATFORM}/*.cfg
)

boot_resource_list=(
${LICHEE_CHIP_CONFIG_DIR}/boot-resource/boot-resource:${LICHEE_PACK_OUT_DIR}
${LICHEE_CHIP_CONFIG_DIR}/boot-resource/boot-resource.ini:${LICHEE_PACK_OUT_DIR}
${LICHEE_CHIP_CONFIG_DIR}/configs/${PACK_BOARD}/*.bmp:${LICHEE_PACK_OUT_DIR}/boot-resource/
${LICHEE_CHIP_CONFIG_DIR}/configs/${PACK_BOARD}/bootlogo.bmp:${LICHEE_PACK_OUT_DIR}/bootlogo.bmp
${LICHEE_CHIP_CONFIG_DIR}/configs/${PACK_BOARD}/wavefile/*:${LICHEE_PACK_OUT_DIR}/boot-resource/wavefile/
${LICHEE_CHIP_CONFIG_DIR}/configs/${PACK_BOARD}/${PACK_TYPE}/*.bmp:${LICHEE_PACK_OUT_DIR}/boot-resource/
${LICHEE_CHIP_CONFIG_DIR}/boot-resource/boot-resource/bat/bempty.bmp:${LICHEE_PACK_OUT_DIR}/bempty.bmp
${LICHEE_CHIP_CONFIG_DIR}/boot-resource/boot-resource/bat/battery_charge.bmp:${LICHEE_PACK_OUT_DIR}/battery_charge.bmp
)
#${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/boot0_nand_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/boot0_nand.fex
#${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/boot0_sdcard_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/boot0_sdcard.fex
#${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/boot0_ufs_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/boot0_ufs.fex
#${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/boot0_${LICHEE_BOOT0_BIN_NAME}_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/boot0_${LICHEE_BOOT0_BIN_NAME}.fex
#${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/boot0_nandfastboot_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/boot0_nandfastboot_${PACK_CHIP}.fex
#${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/boot0_spinor_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/boot0_spinor.fex
boot_file_list=(
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/fes1_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/fes1.fex
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/fes1_uart_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/fes1_uart.fex
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/u-boot-${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/u-boot.fex
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/u-boot-${LICHEE_EFEX_BIN_NAME}.bin:${LICHEE_PACK_OUT_DIR}/u-boot-${LICHEE_EFEX_BIN_NAME}.fex
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/u-boot-crashdump-${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/u-boot-crash.fex
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/u-boot-crashdump-spinor-${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/u-boot-spinor-crash.fex
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/bl31.bin:${LICHEE_PACK_OUT_DIR}/monitor.fex
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/bl31_${PACK_BOARD}.bin:${LICHEE_PACK_OUT_DIR}/monitor.fex
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/scp.bin:${LICHEE_PACK_OUT_DIR}/scp.fex
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/amp_dsp0.bin:${LICHEE_PACK_OUT_DIR}/amp_dsp0.fex
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/amp_dsp1.bin:${LICHEE_PACK_OUT_DIR}/amp_dsp1.fex
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/amp_arm64.bin:${LICHEE_PACK_OUT_DIR}/amp_arm64.fex
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/amp_rv0.bin:${LICHEE_PACK_OUT_DIR}/amp_rv0.fex
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/video.bin:${LICHEE_PACK_OUT_DIR}/video.fex
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/optee_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/optee.fex
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/optee_${PACK_CHIP}-monitor.bin:${LICHEE_PACK_OUT_DIR}/optee-monitor.fex
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/opensbi_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/opensbi.fex
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/u-boot-spinor-${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/u-boot-spinor.fex
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/u-boot-spinor-secure-${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/u-boot-spinor-secure.fex
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/*.fex:${LICHEE_PACK_OUT_DIR}/
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/*.dtb:${LICHEE_PACK_OUT_DIR}/
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/*.bin:${LICHEE_PACK_OUT_DIR}/
)

#${LICHEE_PLAT_OUT}/boot0_nand_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/boot0_nand.fex
#${LICHEE_PLAT_OUT}/boot0_sdcard_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/boot0_sdcard.fex
#${LICHEE_PLAT_OUT}/boot0_${LICHEE_BOOT0_BIN_NAME}_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/boot0_${LICHEE_BOOT0_BIN_NAME}.fex
#${LICHEE_PLAT_OUT}/boot0_spinor_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/boot0_spinor.fex
boot_file_list_2=(
${LICHEE_PLAT_OUT}/arisc:${LICHEE_PACK_OUT_DIR}/arisc.fex
${LICHEE_PLAT_OUT}/sunxi.dtb:${LICHEE_PACK_OUT_DIR}/sunxi.fex
${LICHEE_PLAT_OUT}/fes1_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/fes1.fex
${LICHEE_PLAT_OUT}/fes1_uart_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/fes1_uart.fex
${LICHEE_PLAT_OUT}/sboot_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/sboot.bin
${LICHEE_PLAT_OUT}/sboot_nor_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/sboot_nor.bin
${LICHEE_PLAT_OUT}/sboot_sdcard_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/sboot_sdcard.bin
${LICHEE_PLAT_OUT}/sboot_nand_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/sboot_nand.bin
${LICHEE_PLAT_OUT}/sboot_ufs_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/sboot_ufs.bin
${LICHEE_PLAT_OUT}/u-boot-${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/u-boot.fex
${LICHEE_PLAT_OUT}/u-boot-${LICHEE_EFEX_BIN_NAME}.bin:${LICHEE_PACK_OUT_DIR}/u-boot-${LICHEE_EFEX_BIN_NAME}.fex
${LICHEE_PLAT_OUT}/u-boot-crashdump-${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/u-boot-crash.fex
${LICHEE_PLAT_OUT}/u-boot-crashdump-spinor-${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/u-boot-spinor-crash.fex
${LICHEE_PLAT_OUT}/scp.bin:${LICHEE_PACK_OUT_DIR}/scp.fex
${LICHEE_PLAT_OUT}/u-boot-spinor-${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/u-boot-spinor.fex
${LICHEE_PLAT_OUT}/u-boot-spinor-secure-${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/u-boot-spinor-secure.fex
${LICHEE_PLAT_OUT}/vmlinux.tar.bz2:${LICHEE_PACK_OUT_DIR}/vmlinux.fex
)

arm_boot_file_secure=(
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/semelis_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/semelis.bin
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/optee_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/optee.fex
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/sboot_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/sboot.bin
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/sboot_nor_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/sboot_nor.bin
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/sboot_sdcard_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/sboot_sdcard.bin
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/sboot_nand_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/sboot_nand.bin
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/sboot_ufs_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/sboot_ufs.bin
${LICHEE_COMMON_CONFIG_DIR}/sign_config/dragon_toc_android.cfg:${LICHEE_PACK_OUT_DIR}/dragon_toc.cfg
${LICHEE_CHIP_CONFIG_DIR}/configs/default/dragon_toc_android.cfg:${LICHEE_PACK_OUT_DIR}/dragon_toc.cfg
)

arm64_boot_file_secure=(
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/optee_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/optee.fex
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/sboot_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/sboot.bin
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/sboot_nor_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/sboot_nor.bin
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/sboot_sdcard_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/sboot_sdcard.bin
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/sboot_nand_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/sboot_nand.bin
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/sboot_ufs_${PACK_CHIP}.bin:${LICHEE_PACK_OUT_DIR}/sboot_ufs.bin
${LICHEE_COMMON_CONFIG_DIR}/sign_config/dragon_toc_a64_android.cfg:${LICHEE_PACK_OUT_DIR}/dragon_toc.cfg
${LICHEE_CHIP_CONFIG_DIR}/configs/default/dragon_toc_android.cfg:${LICHEE_PACK_OUT_DIR}/dragon_toc.cfg
${LICHEE_CHIP_CONFIG_DIR}/\${BIN_PATH}/amp_rv0.bin:${LICHEE_PACK_OUT_DIR}/amp_rv0.fex
)

#
# This function can get the realpath between $SRC and $DST
#
function get_realpath()
{
	local src=$(cd $1; pwd);
	local dst=$(cd $2; pwd);
	local res="./";
	local tmp="$dst"

	while [ "${src##*$tmp}" == "${src}" ]; do
		tmp=${tmp%/*};
		res=$res"../"
	done
	res="$res${src#*$tmp/}"

	printf "%s" $res
}

function show_boards()
{
	printf "\nAll avaiable chips, platforms and boards:\n\n"
	printf "Chip            Board\n"
	for chipdir in $(find chips/ -mindepth 1 -maxdepth 1 -type d) ; do
		chip=`basename ${chipdir}`
		printf "${chip}\n"
		for boarddir in $(find chips/${chip}/configs/${platform} \
			-mindepth 1 -maxdepth 1 -type d) ; do
			board=`basename ${boarddir}`
			printf "                ${board}\n"
		done
	done
	printf "\nFor Usage:\n"
	printf "     $(basename $0) -h\n\n"
}

function uart_switch()
{
	rm -rf ${LICHEE_PACK_OUT_DIR}/awk_debug_card0
	touch ${LICHEE_PACK_OUT_DIR}/awk_debug_card0
	TX=`awk  '$0~"'$PACK_CHIP'"{print $2}' ${LICHEE_COMMON_CONFIG_DIR}/debug/card_debug_pin`
	RX=`awk  '$0~"'$PACK_CHIP'"{print $3}' ${LICHEE_COMMON_CONFIG_DIR}/debug/card_debug_pin`
	PORT=`awk  '$0~"'$PACK_CHIP'"{print $4}' ${LICHEE_COMMON_CONFIG_DIR}/debug/card_debug_pin`
	MS=`awk  '$0~"'$PACK_CHIP'"{print $5}' ${LICHEE_COMMON_CONFIG_DIR}/debug/card_debug_pin`
	CK=`awk  '$0~"'$PACK_CHIP'"{print $6}' ${LICHEE_COMMON_CONFIG_DIR}/debug/card_debug_pin`
	DO=`awk  '$0~"'$PACK_CHIP'"{print $7}' ${LICHEE_COMMON_CONFIG_DIR}/debug/card_debug_pin`
	DI=`awk  '$0~"'$PACK_CHIP'"{print $8}' ${LICHEE_COMMON_CONFIG_DIR}/debug/card_debug_pin`

	BOOT_UART_ST=`awk  '$0~"'$PACK_CHIP'"{print $2}' ${LICHEE_COMMON_CONFIG_DIR}/debug/card_debug_string`
	BOOT_PORT_ST=`awk  '$0~"'$PACK_CHIP'"{print $3}' ${LICHEE_COMMON_CONFIG_DIR}/debug/card_debug_string`
	BOOT_TX_ST=`awk  '$0~"'$PACK_CHIP'"{print $4}' ${LICHEE_COMMON_CONFIG_DIR}/debug/card_debug_string`
	BOOT_RX_ST=`awk  '$0~"'$PACK_CHIP'"{print $5}' ${LICHEE_COMMON_CONFIG_DIR}/debug/card_debug_string`
	UART0_ST=`awk  '$0~"'$PACK_CHIP'"{print $6}' ${LICHEE_COMMON_CONFIG_DIR}/debug/card_debug_string`
	UART0_USED_ST=`awk  '$0~"'$PACK_CHIP'"{print $7}' ${LICHEE_COMMON_CONFIG_DIR}/debug/card_debug_string`
	UART0_PORT_ST=`awk  '$0~"'$PACK_CHIP'"{print $8}' ${LICHEE_COMMON_CONFIG_DIR}/debug/card_debug_string`
	UART0_TX_ST=`awk  '$0~"'$PACK_CHIP'"{print $9}' ${LICHEE_COMMON_CONFIG_DIR}/debug/card_debug_string`
	UART0_RX_ST=`awk  '$0~"'$PACK_CHIP'"{print $10}' ${LICHEE_COMMON_CONFIG_DIR}/debug/card_debug_string`
	UART1_ST=`awk  '$0~"'$PACK_CHIP'"{print $11}' ${LICHEE_COMMON_CONFIG_DIR}/debug/card_debug_string`
	JTAG_ST=`awk  '$0~"'$PACK_CHIP'"{print $12}' ${LICHEE_COMMON_CONFIG_DIR}/debug/card_debug_string`
	MS_ST=`awk  '$0~"'$PACK_CHIP'"{print $13}' ${LICHEE_COMMON_CONFIG_DIR}/debug/card_debug_string`
	CK_ST=`awk  '$0~"'$PACK_CHIP'"{print $14}' ${LICHEE_COMMON_CONFIG_DIR}/debug/card_debug_string`
	DO_ST=`awk  '$0~"'$PACK_CHIP'"{print $15}' ${LICHEE_COMMON_CONFIG_DIR}/debug/card_debug_string`
	DI_ST=`awk  '$0~"'$PACK_CHIP'"{print $16}' ${LICHEE_COMMON_CONFIG_DIR}/debug/card_debug_string`
	MMC0_ST=`awk  '$0~"'$PACK_CHIP'"{print $17}' ${LICHEE_COMMON_CONFIG_DIR}/debug/card_debug_string`
	MMC0_USED_ST=`awk  '$0~"'$PACK_CHIP'"{print $18}' ${LICHEE_COMMON_CONFIG_DIR}/debug/card_debug_string`

	if [ -z "$TX" ] || [ -z "$BOOT_UART_ST" ]; then
		pack_error "$FUNCNAME: $PACK_CHIP not configured in card_debug_pin/card_debug_string!"
		exit 1
	fi

	echo '$0!~";" && $0~"'$BOOT_TX_ST'"{if(C)$0="'$BOOT_TX_ST' = '$TX'"} \' >> ${LICHEE_PACK_OUT_DIR}/awk_debug_card0
	echo '$0!~";" && $0~"'$BOOT_RX_ST'"{if(C)$0="'$BOOT_RX_ST' = '$RX'"} \' >> ${LICHEE_PACK_OUT_DIR}/awk_debug_card0
	echo '$0!~";" && $0~"'$BOOT_PORT_ST'"{if(C)$0="'$BOOT_PORT_ST' = '$PORT'"} \' >> ${LICHEE_PACK_OUT_DIR}/awk_debug_card0
	if [ "`grep "auto_print_used" "${LICHEE_PACK_OUT_DIR}/sys_config.fex" | grep "1"`" ]; then
		echo '$0!~";" && $0~"'$MMC0_USED_ST'"{if(A)$0="'$MMC0_USED_ST' = 1";A=0} \' >> ${LICHEE_PACK_OUT_DIR}/awk_debug_card0
	else
	echo '$0!~";" && $0~"'$MMC0_USED_ST'"{if(A)$0="'$MMC0_USED_ST' = 0";A=0} \' >> ${LICHEE_PACK_OUT_DIR}/awk_debug_card0
	fi
	echo '$0!~";" && $0~"\\['$MMC0_ST'\\]"{A=1}  \' >> ${LICHEE_PACK_OUT_DIR}/awk_debug_card0
	echo '$0!~";" && $0~"'$UART0_TX_ST'"{if(B)$0="'$UART0_TX_ST' = '$TX'"} \' >> ${LICHEE_PACK_OUT_DIR}/awk_debug_card0
	echo '$0!~";" && $0~"'$UART0_RX_ST'"{if(B)$0="'$UART0_RX_ST' = '$RX'"} \' >> ${LICHEE_PACK_OUT_DIR}/awk_debug_card0
	echo '$0!~";" && $0~"\\['$UART0_ST'\\]"{B=1} \' >> ${LICHEE_PACK_OUT_DIR}/awk_debug_card0
	echo '$0!~";" && $0~"'$UART0_USED_ST'"{if(B)$0="'$UART0_USED_ST' = 1"}  \' >> ${LICHEE_PACK_OUT_DIR}/awk_debug_card0
	echo '/^'$UART0_PORT_ST'/{next} \' >> ${LICHEE_PACK_OUT_DIR}/awk_debug_card0
	echo '$0!~";" && $0~"\\['$UART1_ST'\\]"{B=0} \' >> ${LICHEE_PACK_OUT_DIR}/awk_debug_card0
	echo '$0!~";" && $0~"\\['$BOOT_UART_ST'\\]"{C=1} \' >> ${LICHEE_PACK_OUT_DIR}/awk_debug_card0
	echo '$0!~";" && $0~"\\['$JTAG_ST'\\]"{C=0} \' >> ${LICHEE_PACK_OUT_DIR}/awk_debug_card0
	echo '$0!~";" && $0~"'$MS_ST'"{$0="'$MS_ST' = '$MS'"} \' >> ${LICHEE_PACK_OUT_DIR}/awk_debug_card0
	echo '$0!~";" && $0~"'$CK_ST'"{$0="'$CK_ST' = '$CK'"} \' >> ${LICHEE_PACK_OUT_DIR}/awk_debug_card0
	echo '$0!~";" && $0~"'$DO_ST'"{$0="'$DO_ST' = '$DO'"} \' >> ${LICHEE_PACK_OUT_DIR}/awk_debug_card0
	echo '$0!~";" && $0~"'$DI_ST'"{$0="'$DI_ST' = '$DI'"} \' >> ${LICHEE_PACK_OUT_DIR}/awk_debug_card0
	echo '1' >> ${LICHEE_PACK_OUT_DIR}/awk_debug_card0

	if [ "`grep "auto_print_used" "${LICHEE_PACK_OUT_DIR}/sys_config.fex" | grep "1"`" ]; then
		sed -i -e '/^uart0_rx/a\pinctrl-1=' ${LICHEE_PACK_OUT_DIR}/sys_config.fex
		sed -i -e '/^uart0_rx/a\pinctrl-0=' ${LICHEE_PACK_OUT_DIR}/sys_config.fex
	fi

	awk -f ${LICHEE_PACK_OUT_DIR}/awk_debug_card0 ${LICHEE_PACK_OUT_DIR}/sys_config.fex > ${LICHEE_PACK_OUT_DIR}/sys_config_debug.fex
	rm -f ${LICHEE_PACK_OUT_DIR}/sys_config.fex
	mv ${LICHEE_PACK_OUT_DIR}/sys_config_debug.fex ${LICHEE_PACK_OUT_DIR}/sys_config.fex
	echo "uart -> card0"
}

function add_lzma_header()
{
	lzma_file=$1
	original_file=$2
	file_size=$(printf "%.8x\n" `stat -c%s ${lzma_file}`)
	original_file_size=$(printf "%.8x\n" `stat -c%s ${original_file}`)

	bin_str=""

	file_size_len=${#file_size}

	#"LZMA"+size+origin_size
	bin_str="\x4c\x5a\x4d\x41\x${file_size:6:2}\x${file_size:4:2}\x${file_size:2:2}\x${file_size:0:2}"
	bin_str+="\x${original_file_size:6:2}\x${original_file_size:4:2}\x${original_file_size:2:2}\x${original_file_size:0:2}"

	printf "%b" ${bin_str} > tempbin

	cat ${lzma_file} >> tempbin

	mv tempbin "${lzma_file}.head"
}

function partition_size_handle()
{
	echo "handle partition_size"
	local filename=${LICHEE_PACK_OUT_DIR}/sys_partition.fex
	local size
	local number
	local dimension
	local blocks
	local line
	local m
	local index=0
	while read line; do
		let "index++"
		size=$(echo $line | awk -F= '/^[[:space:]]*size[[:space:]]*=/{print $2}' | sed 's|\s\+||g')
		if [ -n "$size" ]; then
			dimension=$(echo $size | sed 's|^[0-9,.]\+||g')
			[ -z "$dimension" ] && continue
			case $dimension in
				B|b)
					m=1
					;;
				K|k)
					m=1024
					;;
				M|m)
					m=1048576
					;;
				G|g)
					m=1073741824
					;;
				*)
					pack_error "ERROR Dimension($dimension)!"
					return 1
					;;
			esac
			number=$(echo $size | sed 's|[a-z,A-Z]*$||g')
			blocks=$(echo "$number * $m / 512" | bc | awk -F. '{print $1}')
			printf "sys_partition.fex: size %6s => %7d Blocks\n" "${number}${dimension}" "${blocks}"
			size="$(echo "$line" | sed "s|=.*$|= $blocks|g")"
			sed -i "${index}s|$line|$size|g" $filename
		fi
	done < $filename
	return 0
}

function do_prepare()
{
	local runinfo=($(lsof 2>/dev/null | awk '$9~"'$LICHEE_TOP_DIR/tools/build/buildserver'"{print $2}'))
	local possible_bin_path="${LICHEE_POSSIBLE_BIN_PATH}"

	if [ ${#runinfo[@]} -lt 2 ]; then
		pack_error "something is incorrect:please <./build.sh config>."
	fi

	if [ -z "${PACK_CHIP}" -o -z "${PACK_TYPE}" -o -z "${PACK_BOARD}" ] ; then
		pack_error "Invalid parameters Chip: ${PACK_CHIP}, \
			Platform: ${PACK_TYPE}, Board: ${PACK_BOARD}"
		show_boards
		exit 1
	fi

	if [ ! -d ${LICHEE_CHIP_CONFIG_DIR}/configs/${PACK_BOARD} ] ; then
		pack_error "Board's directory \
			\"${LICHEE_CHIP_CONFIG_DIR}/configs/${PACK_BOARD}\" is not exist."
		show_boards
		exit 1
	fi

	# Cleanup
#	if [ "x" != "x${LICHEE_PACK_OUT_DIR}" ]; then
#		rm -rf ${LICHEE_PACK_OUT_DIR}
#	fi
	mkdir -p ${LICHEE_PACK_OUT_DIR}

	(
		cd $LICHEE_OUT_DIR
		if [ "${LICHEE_PACK_OUT_DIR}" != "$LICHEE_OUT_DIR/pack_out" ]; then
#			rm -rf pack_out
			ln -sf ${LICHEE_IC}/${LICHEE_BOARD}/pack_out pack_out
		fi
	)

	printf "copying tools file\n"
	for file in ${tools_file_list[@]} ; do
		cp -f $file ${LICHEE_PACK_OUT_DIR} 2> /dev/null
	done

	if [ "x${PACK_KERN}" = "xlinux-3.4" ]; then
		cp -f ${LICHEE_COMMON_CONFIG_DIR}/tools/cardscript.fex ${LICHEE_PACK_OUT_DIR} 2> /dev/null
	fi

	printf "copying configs file\n"
	for file in ${configs_file_list[@]} ; do
		cp -f $file ${LICHEE_PACK_OUT_DIR} 2> /dev/null
	done

	printf "copying product configs file\n"
	for file in ${product_configs_file_list[@]}; do
		cp -f $file ${LICHEE_PACK_OUT_DIR} 2>/dev/null
	done

	if [ x"${PACK_PLATFORM}" != x"android" ]; then
		printf "linux copying boardt&linux_kernel_version configs file\n"
		local possible_env_path=(
			configs/default
			configs/${LICHEE_BOARD}
			configs/${LICHEE_BOARD}/${LICHEE_KERN_VER}
			configs/${LICHEE_BOARD}/${PACK_PLATFORM}
		)
		local possible_env_list=(
			env.cfg
			env-$(echo ${LICHEE_KERN_VER} | awk -F '-' '{print $2}').cfg
		)
		local copy_env_file=''

		for d in ${possible_env_path[@]}; do
			[ ! -d ${LICHEE_CHIP_CONFIG_DIR}/$d ] && continue
			for file in ${possible_env_list[@]} ; do
				if [ -e "${LICHEE_CHIP_CONFIG_DIR}/$d/$file" ]; then
					copy_env_file=${LICHEE_CHIP_CONFIG_DIR}/$d/$file
				fi
			done
		done
		echo "Use u-boot env file: ${copy_env_file}"
		if [[ ! -f ${copy_env_file} ]]
		then
			echo -e "\e[33mWarning: u-boot env file '${copy_env_file}' not exist! use file in default directory other than '${PACK_BOARD}' directory\e[0m"
		fi

		cp -f ${copy_env_file} ${LICHEE_PACK_OUT_DIR}/env.cfg 2>/dev/null

		cp -f ${LICHEE_CHIP_CONFIG_DIR}/configs/${PACK_BOARD}/${LICHEE_KERN_VER}/sys_* ${LICHEE_PACK_OUT_DIR} 2>/dev/null
	fi

	# If platform config files exist, we will cover the default files
	# For example, mv pack_out/image_linux.cfg pack_out/image.cfg
	if [ ${PACK_PLATFORM} != "android" ]; then
		cp -f ${LICHEE_BOARD_CONFIG_DIR}/${PACK_PLATFORM}/* ${LICHEE_PACK_OUT_DIR} 2> /dev/null
		if [ ${PACK_PLATFORM} = "bsp" -o "x${PACK_PLATFORM}" = "xsata" ] ; then
			find ${LICHEE_PACK_OUT_DIR}/* -type f -a \( -name "*.fex" -o -name "*.cfg" \) -print | \
			sed "s#\(.*\)_linux\(\..*\)#mv -fv & \1\2#e"
		else
			find ${LICHEE_PACK_OUT_DIR}/* -type f -a \( -name "*.fex" -o -name "*.cfg" \) -print | \
			sed "s#\(.*\)_${PACK_PLATFORM}\(\..*\)#mv -fv & \1\2#e"
		fi
	else
		find ${LICHEE_PACK_OUT_DIR}/* -type f -a \( -name "*.fex" -o -name "*.cfg" \) -print | \
			sed "s#\(.*\)_${PACK_TYPE}\(\..*\)#mv -fv & \1\2#e"
	fi

	if [ "x${PACK_MODE}" = "xdump" ] ; then
		cp -vf ${LICHEE_PACK_OUT_DIR}/sys_partition_dump.fex ${LICHEE_PACK_OUT_DIR}/sys_partition.fex
		cp -vf ${LICHEE_PACK_OUT_DIR}/usbtool_test.fex ${LICHEE_PACK_OUT_DIR}/usbtool.fex
	elif [ "x${PACK_FUNC}" = "xprvt" ] ; then
		cp -vf ${LICHEE_PACK_OUT_DIR}/sys_partition_private.fex ${LICHEE_PACK_OUT_DIR}/sys_partition.fex
	fi

	printf "copying boot resource\n"
	for file in ${boot_resource_list[@]} ; do
		cp -rf $(echo $file | sed -e 's/:/ /g') 2>/dev/null
	done

	# openwrt use these logo files
	if [ x"${PACK_PLATFORM}" = x"openwrt" ]; then
		rm -rf ${LICHEE_PACK_OUT_DIR}/boot-resource
		cp -rf $CFG_TOP_DIR/${PACK_PLATFORM}/target/$PACK_IC/$PACK_IC-common/boot-resource/boot-resource ${LICHEE_PACK_OUT_DIR}
		cp -rf $CFG_TOP_DIR/${PACK_PLATFORM}/target/$PACK_IC/$PACK_IC-common/boot-resource/boot-resource.ini ${LICHEE_PACK_OUT_DIR}/boot-resource.ini
	fi

	if [ ! -f ${LICHEE_PACK_OUT_DIR}/bootlogo.bmp ]; then
		cp ${LICHEE_PACK_OUT_DIR}/boot-resource/bootlogo.bmp ${LICHEE_PACK_OUT_DIR}/bootlogo.bmp
	fi

	lzma -k ${LICHEE_PACK_OUT_DIR}/bootlogo.bmp
	lzma -k ${LICHEE_PACK_OUT_DIR}/bempty.bmp
	lzma -k ${LICHEE_PACK_OUT_DIR}/battery_charge.bmp

	if [ -f ${LICHEE_PACK_OUT_DIR}/bootlogo.bmp.lzma ]; then
		add_lzma_header "${LICHEE_PACK_OUT_DIR}/bootlogo.bmp.lzma" "${LICHEE_PACK_OUT_DIR}/bootlogo.bmp"
		(cd ${LICHEE_PACK_OUT_DIR}; ln -sf bootlogo.bmp.lzma.head  bootlogo.fex)
	fi

	printf "copying boot file\n"
	for d in ${possible_bin_path[@]}; do
		[ ! -d ${LICHEE_CHIP_CONFIG_DIR}/$d ] && continue
		BIN_PATH=$d
		for file in ${boot_file_list[@]} ; do
			eval cp -v -f $(echo $file | sed -e 's/:/ /g') 2>/dev/null
		done
	done
	printf "copying boot file 2.0\n"
	for file in ${boot_file_list_2[@]} ; do
		eval cp -v -f $(echo $file | sed -e 's/:/ /g') 2>/dev/null
	done
	if [[ ${LICHEE_BOARD} == *fastboot*spinand* ]] ; then
		mv -v ${LICHEE_PACK_OUT_DIR}/boot0_nandfastboot_${PACK_CHIP}.fex ${LICHEE_PACK_OUT_DIR}/boot0_nand.fex
	fi

	if ! [ -z ${LICHEE_BOOT0_BIN_NAME} ]; then
	    echo 1111111111111111111111111111111111111
                # nand fastboot
#                cp -v -f ${LICHEE_PACK_OUT_DIR}/boot0_${LICHEE_BOOT0_BIN_NAME}.fex ${LICHEE_PACK_OUT_DIR}/boot0_nand.fex

#		if [[ ${LICHEE_FLASH} == default ]] ; then
#			mv -v ${LICHEE_PACK_OUT_DIR}/boot0_${LICHEE_BOOT0_BIN_NAME}.fex ${LICHEE_PACK_OUT_DIR}/boot0_sdcard.fex
#		elif [[ ${LICHEE_FLASH} == nor ]] ; then
#			mv -v ${LICHEE_PACK_OUT_DIR}/boot0_${LICHEE_BOOT0_BIN_NAME}.fex ${LICHEE_PACK_OUT_DIR}/boot0_spinor.fex
#		else
#			echo "invalid LICHEE_FLASH, default choose sdcard!"
#			mv -v ${LICHEE_PACK_OUT_DIR}/boot0_${LICHEE_BOOT0_BIN_NAME}.fex ${LICHEE_PACK_OUT_DIR}/boot0_sdcard.fex
#		fi
	fi

	[ -z "${BIN_PATH}" ] &&
	pack_error "No BIN_PATH found!" && exit 1

	printf "copying $LICHEE_ARCH secure boot file\n"
	for d in ${possible_bin_path[@]}; do
		[ ! -d ${LICHEE_CHIP_CONFIG_DIR}/$d ] && continue
		BIN_PATH=$d
		for file in $(eval echo '$'"{${LICHEE_ARCH}_boot_file_secure[@]}"); do
			eval cp -f $(echo $file | sed -e 's/:/ /g') 2>/dev/null
		done
	done

	# If platform config use
	if [ -f ${LICHEE_CHIP_CONFIG_DIR}/tools/plat_config.sh ] ; then
		${LICHEE_CHIP_CONFIG_DIR}/tools/plat_config.sh
	fi

	if [ "x${PACK_NOR}" = "xnor" ] ; then
		cp -vf ${LICHEE_PACK_OUT_DIR}/image_nor.cfg ${LICHEE_PACK_OUT_DIR}/image.cfg
		cp -vf ${LICHEE_PACK_OUT_DIR}/sboot_nor.bin ${LICHEE_PACK_OUT_DIR}/sboot.bin
		cp -vf ${LICHEE_PACK_OUT_DIR}/dragon_toc_nor.cfg ${LICHEE_PACK_OUT_DIR}/dragon_toc.cfg
	fi

	if [ "x${PACK_VSP}" = "xvsp" ] ; then
		printf "change usb_port_type to device...\n"
		printf "disable usb_serial_unique...\n"
		printf "change usb_serial_number to ${PACK_TYPE}_android...\n"
		sed -i 's/^usb_port_type.*/usb_port_type = 0/g' ${LICHEE_PACK_OUT_DIR}/sys_config.fex
		sed -i 's/^usb_serial_unique.*/usb_serial_unique = 0/g' ${LICHEE_PACK_OUT_DIR}/sys_config.fex
		sed -i 's/^usb_serial_number.*/usb_serial_number = "'"${PACK_CHIP}"'_android"/g' ${LICHEE_PACK_OUT_DIR}/sys_config.fex
	fi

	printf "copying additional files\n"
	for file in ${PACK_ADD_FILES[@]}; do
		cp -vf $(echo $file | sed -e 's/:/ /g') 2>/dev/null
	done

	if [ "x${PACK_PLATFORM}" == "xandroid" ] && [ "x$TARGET_BUILD_VARIANT" == "xuser" ]; then
		pack_info "change kernel loglevel to 3 for android user build"
		sed -i 's|^\s*loglevel=[0-9]\s*$|loglevel=3|g' ${LICHEE_PACK_OUT_DIR}/env.cfg
		if [ "${ENABLE_VENDOR_ADB}" == "true" ]; then
			pack_info "enable vendor adb for android user build"
			sed -i 's|^init_rc=.*$|init_rc=/vendor/etc/init/hw/init.aw.rc|g' ${LICHEE_PACK_OUT_DIR}/env.cfg
		fi
	fi

	if [ "x${PACK_PROGRAMMER}" = "xprogrammer" ]; then
		printf "add programmer img info target in sys config\n"
		sed -i -e '/^\[target\]/a\programmer=1' ${LICHEE_PACK_OUT_DIR}/sys_config.fex
	fi

	sed -i 's/\\boot-resource/\/boot-resource/g' ${LICHEE_PACK_OUT_DIR}/boot-resource.ini
	sed -i 's/\\\\/\//g' ${LICHEE_PACK_OUT_DIR}/image.cfg
	sed -i 's/^imagename/;imagename/g' ${LICHEE_PACK_OUT_DIR}/image.cfg

	prepare_mixed_androiddragonboard
	[ $? -ne 0 ] && exit 1

	partition_size_handle
	[ $? -ne 0 ] && exit 1

	if [ x"${PACK_PLATFORM}" = x"openwrt" ]; then
		cd ${LICHEE_PACK_OUT_DIR}/
		echo "vmlinux" > ${LICHEE_PACK_OUT_DIR}/vmlinux.fex
		if [ "x${PACK_NOR}" = "xnor" ] ; then
			make_user_res sys_partition_nor.fex
			make_app_res sys_partition_nor.fex
			make_data_res sys_partition_nor.fex
		else
			make_user_res sys_partition.fex
			make_app_res sys_partition.fex
			make_data_res sys_partition.fex
		fi
		cd - > /dev/null
	fi
}

function img_to_programmer()
{
	local out_img=$1
	local in_img=$2

	cd ${LICHEE_PACK_OUT_DIR}/

	if [ "x${PACK_SECURE}" = "xsecure" ]; then
		if [ -f toc0_sdcard.fex ] ; then
			programmer_img toc0_sdcard.fex toc1.fex ${out_img} > /dev/null
		elif [ -f toc0_nand.fex ] ; then
			programmer_img toc0_nand.fex toc1.fex ${out_img} > /dev/null
		else
			programmer_img toc0.fex toc1.fex ${out_img} > /dev/null
		fi
	else
		programmer_img boot0_sdcard.fex boot_package.fex ${out_img} > /dev/null
	fi

	if [ -f sunxi_gpt.fex ] ; then
		#create_img for sunxi_gpt.fex
		programmer_img sys_partition.bin sunxi_mbr.fex ${out_img} ${in_img} sunxi_gpt.fex > /dev/null
	else
		#create_img for sunxi_mbr.fex
		programmer_img sys_partition.bin sunxi_mbr.fex ${out_img} ${in_img} > /dev/null
	fi

}

function uboot_ini_to_dts()
{
	local TARGET_UBOOT
	local PLATFORM_ADDR
	local SOC_ADDR
	local DTC_FLAGS=""

	if [ x${LICHEE_BRANDY_UBOOT_VER} == x2023 ]; then
		pack_info "skip split fdt"
		return
	fi

	if [ "x${PACK_NOR}" == "xnor" ]; then
		TARGET_UBOOT=${LICHEE_PACK_OUT_DIR}/u-boot-spinor.fex
	else
		TARGET_UBOOT=${LICHEE_PACK_OUT_DIR}/u-boot.fex
	fi
	sunxi_ubootools split ${TARGET_UBOOT} > /dev/null
	if [ $? -ne 0 ]
	then
		pack_warn "split uboot and fdt failed!!"
		return
	fi

	[ "$(readlink -f .)" != "$(readlink -f ${LICHEE_PACK_OUT_DIR})" ] && {
		mv temp_fdt.dtb  ${LICHEE_PACK_OUT_DIR}
		mv temp_ubootnodtb.bin  ${LICHEE_PACK_OUT_DIR}
	}

	# to dts
	$DTC_COMPILER ${DTC_FLAGS} -I dtb -O dts -o ${LICHEE_PACK_OUT_DIR}/.uboot.dtb.dts.tmp ${LICHEE_PACK_OUT_DIR}/temp_fdt.dtb  2>/dev/null

	PLATFORM_ADDR=`grep -Po "(?<=platform@)(\w+)(?=\s*{)" ${LICHEE_PACK_OUT_DIR}/.uboot.dtb.dts.tmp | head -1`
	SOC_ADDR=`grep -Po "(?<=soc@)(\w+)(?=\s*{)" ${LICHEE_PACK_OUT_DIR}/.uboot.dtb.dts.tmp | head -1`

	if [ "x${PACK_TYPE}" = "xdragonboard" -o "x${PACK_TYPE}" = "xdragonabts" ] ; then
		cat <<- EOF >> ${LICHEE_PACK_OUT_DIR}/.uboot.dtb.dts.tmp
		/{
			soc@${SOC_ADDR} {
				platform@${PLATFORM_ADDR} {
				dragonboard_test = <1>;
				};
			};
		};
		EOF
	fi

	# to dtb
	$DTC_COMPILER ${DTC_FLAGS} -I dts -O dtb -o ${LICHEE_PACK_OUT_DIR}/temp_fdt.dtb ${LICHEE_PACK_OUT_DIR}/.uboot.dtb.dts.tmp  2>/dev/null

	# get update_to_ubootfdt value from sysconfig
	sunxi_ubootools subkey_value sys_config.bin sunxi_ubootools update_to_ubootfdt > /dev/null
	if [ $? -eq 1 ]; then
		echo "uboot ini to dts"
		$DTC_COMPILER -p 2048 ${DTC_FLAGS} -@ -O dtb -o ${LICHEE_PACK_OUT_DIR}/new_fdt.dtb	\
			-b 0			\
			-i ${LICHEE_PACK_OUT_DIR}	\
			-F $DTC_INI_FILE \
			-d ${LICHEE_PACK_OUT_DIR}/temp_fdt.dtb ${LICHEE_PACK_OUT_DIR}/.uboot.dtb.dts.tmp 2>/dev/null
	else
		mv ${LICHEE_PACK_OUT_DIR}/temp_fdt.dtb  ${LICHEE_PACK_OUT_DIR}/new_fdt.dtb
	fi

	sunxi_ubootools merge ${LICHEE_PACK_OUT_DIR}/temp_ubootnodtb.bin ${LICHEE_PACK_OUT_DIR}/new_fdt.dtb > /dev/null
	cp -vf ${LICHEE_PACK_OUT_DIR}/temp_ubootnodtb.bin ${TARGET_UBOOT}
	# .uboot.dts is the last dts of uboot
	$DTC_COMPILER ${DTC_FLAGS} -I dtb -O dts -o ${LICHEE_PACK_OUT_DIR}/.uboot.dts ${LICHEE_PACK_OUT_DIR}/new_fdt.dtb 2>/dev/null
}

function do_ini_to_dts()
{
	cd ${LICHEE_PACK_OUT_DIR}/

	maybe_busybox unix2dos sys_config.fex
	script  sys_config.fex > /dev/null

	local DTC_SRC_PATH=${LICHEE_PLAT_OUT}
	local DTC_COMPILER=${LICHEE_PLAT_OUT}/dtc
	local DTC_FLAGS=""

	uboot_ini_to_dts

	if [ "x${PACK_KERN}" == "xlinux-3.4" \
			-o "x${PACK_KERN}" == "xlinux-3.10" \
			-o "x${PACK_KERN}" == "xlinux-4.4" \
			-o "x${PACK_KERN}" == "xlinux-5.4" \
			-o "x${PACK_KERN}" == "xlinux-5.4-ansc" \
			-o "x${PACK_KERN}" == "xlinux-5.10" \
			-o "x${PACK_KERN}" == "xlinux-5.10-origin" \
			-o "x${PACK_KERN}" == "xlinux-5.15" \
			-o "x${PACK_KERN}" == "xlinux-5.15-origin" ] || [[  ${PACK_KERN/linux-} > 5.15 ]]; then
		# For debug: sunxi.dtb -> .sunxi.dts
		$DTC_COMPILER ${DTC_FLAGS} -I dtb -O dts -o ${LICHEE_PLAT_OUT}/.sunxi.dts ${LICHEE_PLAT_OUT}/sunxi.dtb 2>/dev/null
		return
	fi

	local dtc_file_list=(
		.board.dtb.d.dtc.tmp:.board.dtb.dts.tmp
		.${PACK_CHIP}-${PACK_BOARD}.dtb.d.dtc.tmp:.${PACK_CHIP}-${PACK_BOARD}.dtb.dts.tmp
		.${PACK_CHIP}-${LICHEE_BUSSINESS}.dtb.d.dtc.tmp:.${PACK_CHIP}-${LICHEE_BUSSINESS}.dtb.dts.tmp
		.${PACK_CHIP}-soc.dtb.d.dtc.tmp:.${PACK_CHIP}-soc.dtb.dts.tmp)

	local DTC_INI_FILE_BASE=${LICHEE_PACK_OUT_DIR}/sys_config.fex
	local DTC_INI_FILE=${LICHEE_PACK_OUT_DIR}/sys_config_fix.fex

	cp $DTC_INI_FILE_BASE $DTC_INI_FILE
	sed -i "s/\(\[dram\)_para\(\]\)/\1\2/g" $DTC_INI_FILE
	sed -i "s/\(\[nand[0-9]\)_para\(\]\)/\1\2/g" $DTC_INI_FILE

	if [ ! -f $DTC_COMPILER ]; then
		pack_error "Script_to_dts: Can not find dtc compiler.\n"
		exit 1
	fi

	local DTC_DEP_FILE DTC_SRC_FILE
	for e in ${dtc_file_list[@]}; do
		DTC_DEP_FILE=$DTC_SRC_PATH/${e/:*}
		if [ -f $DTC_DEP_FILE ]; then
			DTC_SRC_FILE=$DTC_SRC_PATH/${e#*:}
			break
		fi
	done

	echo "sunxi_dtb create"
	$DTC_COMPILER -p 2048 ${DTC_FLAGS} -@ -O dtb -o ${LICHEE_PLAT_OUT}/sunxi.dtb	\
		-b 0			\
		-i $DTC_SRC_PATH	\
		-F $DTC_INI_FILE	\
		-d $DTC_DEP_FILE $DTC_SRC_FILE 2>/dev/null

	if [ $? -ne 0 ]; then
		pack_error "Conver script to dts failed"
		exit 1
	fi

	#restore the orignal dtsi
	if [ "x${PACK_TYPE}" = "xdragonboard" \
		-o "x${PACK_TYPE}" = "xdragonmat" ]; then
		local DTS_PATH=${LICHEE_KERN_DIR}/arch/${LICHEE_ARCH}/boot/dts
		[ "x${LICHEE_ARCH}" = "xarm64" ] && DTS_PATH=${LICHEE_KERN_DIR}/arch/${LICHEE_ARCH}/boot/dts/sunxi
		if [ -f ${DTS_PATH}/${PACK_CHIP}_bak.dtsi ];then
			rm -f ${DTS_PATH}/${PACK_CHIP}.dtsi
			mv  ${DTS_PATH}/${PACK_CHIP}_bak.dtsi  ${DTS_PATH}/${PACK_CHIP}.dtsi
		fi
	fi

	printf "Conver script to dts ok.\n"

	# It'is used for debug dtb
	$DTC_COMPILER ${DTC_FLAGS} -I dtb -O dts -o ${LICHEE_PLAT_OUT}/.sunxi.dts ${LICHEE_PLAT_OUT}/sunxi.dtb 2>/dev/null

	return
}

function maybe_busybox()
{
	if [ "x$(which busybox)" == "x" ]; then
		pack_error "Tool busybox does not exist!"
		exit 1
	fi

	busybox $@ || $@
}

function generate_env_for_uboot()
{
	printf "$1 Conver to $2.\n"
	printf "LICHEE_BRANDY_UBOOT_VER : ${LICHEE_BRANDY_UBOOT_VER}\n"
	if [ -n "${LICHEE_BRANDY_UBOOT_VER}" ] && [ ${LICHEE_BRANDY_UBOOT_VER} -ge 2023 ]; then
		printf "create env.fex for uboot2023 or later, size 128K\n"
		# mkenvimage -p 0x00 -s 0x20000 -o env.fex env.cfg
		mkenvimage -p 0x00 -s 0x20000 -o $2 $1
	else
		# u_boot_env_gen env_nor.cfg env_nor.fex >/dev/null
		u_boot_env_gen $1 $2 >/dev/null
	fi
}

function do_common()
{
	cd ${LICHEE_PACK_OUT_DIR}/

	echo $(date -d "$ts" +"%Y-%m-%d %H:%M:%S") > ${LICHEE_PACK_OUT_DIR}/sunxi_version.fex

	# Here, we can switch uart to card or normal
	if [ "x${PACK_DEBUG}" = "xcard0" -a "x${PACK_MODE}" != "xdump" \
		-a "x${PACK_FUNC}" != "xprvt" ] ; then \
		uart_switch
	else
		sed -i -e '/^auto_print_used/s\1\0\' ${LICHEE_PACK_OUT_DIR}/sys_config.fex
	fi

	if [ "x${PACK_SECURE}" = "xsecure" ]; then
		printf "add burn_secure_mode in target in sys config\n"
		sed -i -e '/^\[target\]/a\burn_secure_mode=1' ${LICHEE_PACK_OUT_DIR}/sys_config.fex
		sed -i -e '/^\[platform\]/a\secure_without_OS=0' ${LICHEE_PACK_OUT_DIR}/sys_config.fex
		if [ -f ${LICHEE_PACK_OUT_DIR}/optee-monitor.fex ]; then
			rm -f ${LICHEE_PACK_OUT_DIR}/optee-monitor.fex
		fi
	else
		sed -i '/^burn_secure_mod/d' ${LICHEE_PACK_OUT_DIR}/sys_config.fex
		sed -i '/^secure_without_OS/d' ${LICHEE_PACK_OUT_DIR}/sys_config.fex
		if [ -f ${LICHEE_PACK_OUT_DIR}/optee-monitor.fex ]; then
			mv -v ${LICHEE_PACK_OUT_DIR}/optee-monitor.fex ${LICHEE_PACK_OUT_DIR}/optee.fex
		fi
	fi

	if [ ! -f board_config.fex ]; then
		echo "[empty]" > board_config.fex
	fi

	maybe_busybox unix2dos sys_config.fex
	maybe_busybox unix2dos board_config.fex
	script  sys_config.fex > /dev/null
	cp -f   sys_config.bin config.fex
	script  board_config.fex > /dev/null
	cp -f board_config.bin board.fex

	maybe_busybox unix2dos sys_partition.fex
	script  sys_partition.fex > /dev/null

	if [ "x${PACK_TYPE}" = "xdragonboard" ] ; then
		maybe_busybox dos2unix test_config.fex
		cp test_config.fex boot-resource/
		maybe_busybox unix2dos test_config.fex
		script test_config.fex > /dev/null
		cp test_config.bin boot-resource/
	fi

	if [ "x${PACK_TYPE}" = "xdragonabts" ] ; then
		maybe_busybox dos2unix test_config.fex
		cp test_config.fex boot-resource/
		maybe_busybox unix2dos test_config.fex
		script test_config.fex > /dev/null
		cp test_config.bin boot-resource/
	fi
	# Those files for SpiNor. We will try to find sys_partition_nor.fex
	if [ "x${PACK_NOR}" = "xnor" ] ; then

		if [ ! -f sys_partition_nor.fex ];  then
			echo "sys partition for nor not exist"
			exit 1
		fi

		if [ ! -f ${LICHEE_CHIP_CONFIG_DIR}/tools/arisc_config_parse.sh ]; then
			if [ -f "scp.fex" ]; then
				echo "update scp"
				update_scp scp.fex sunxi.fex >/dev/null
			fi
		fi

		# Here, will create sys_partition_nor.bin
		maybe_busybox unix2dos sys_partition_nor.fex
		script  sys_partition_nor.fex > /dev/null
		update_boot0 boot0_spinor.fex   sys_config.bin SPINOR_FLASH > /dev/null
		update_chip boot0_spinor.fex   > /dev/null
		update_fes1  fes1.fex           sys_config.bin > /dev/null

		if [ "x${PACK_KERN}" = "xlinux-3.4" ] ; then
			update_uboot -merge u-boot-spinor.fex  sys_config.bin > /dev/null
		else
			update_uboot -no_merge u-boot-spinor.fex  sys_config.bin > /dev/null
			update_uboot -no_merge u-boot-spinor-secure.fex  sys_config.bin > /dev/null
			[ -f u-boot-efex.fex ] && {
				update_uboot -no_merge u-boot-efex.fex  sys_config.bin > /dev/null
			}
		fi

		while read line
		do
			compress_name=(`echo $line | awk '($1 !~ ";" && ($2 ~ "lzma" || $2 ~ "lz4" || $2 ~ "gz")) {print $2}'`)
			source_name=(`echo $compress_name | cut -d \.  -f 1,2 | cut -d \  -f 2`)
			compress_type=(`echo $compress_name | cut -d \.  -f 3 | cut -d \  -f 2`)
			[ -z "$compress_name" ] && continue
			case $compress_type in
			"gz")
				[ -f $source_name ] && gzip -c $source_name > $compress_name || echo "no exist $source_name"
				echo "compress name: $compress_name"
				;;
			"lzma")
				[ -f $source_name ] && lzma -k $source_name || echo "no exist $source_name"
				mv $source_name.lzma $compress_name >/dev/null 2<&1
				echo "compress name: $compress_name"
				;;
			"lz4")
				[ -f $source_name ] && lz4 -f $source_name $compress_name || echo "no exist $source_name"
				echo "compress name: $compress_name"
				;;
			*)
				echo "no match compress type"
				;;
			esac
			echo "compress type: $compress_type"
		done < boot_package_nor.cfg

		if [ -f boot_package_nor.cfg ]; then
			mv u-boot-spinor-crash.fex u-boot-crash.fex
			echo "pack boot package"
			maybe_busybox unix2dos boot_package.cfg
			dragonsecboot -pack boot_package_nor.cfg
			cp boot_package.fex boot_package_nor.fex
		fi
		# Ugly, but I don't have a better way to change it.
		# We just set env's downloadfile name to env_nor.cfg in sys_partition_nor.fex
		# And if env_nor.cfg is not exist, we should copy one.
		if [ ! -f env_nor.cfg ]; then
			cp -f env.cfg env_nor.cfg >/dev/null 2<&1
		fi

		#card sprite
		if [ -f "boot0_sdcard.fex" ]; then
		    echo 22222222222222222222222222222222222222
			#update_boot0 boot0_sdcard.fex   sys_config.bin SDMMC_CARD > /dev/null
			#update_chip boot0_sdcard.fex > /dev/null
		fi

		# Fixup boot mode for SPINor, just can bootm
		sed -i '/^boot_normal/s#\<boota\>#bootm#g' env_nor.cfg

		echo 1:LICHEE_REDUNDANT_ENV_SIZE:$LICHEE_REDUNDANT_ENV_SIZE
		if [ "x${LICHEE_REDUNDANT_ENV_SIZE}" != "x" ]; then
			echo "--mkenvimage create redundant env data!--"
			echo "--redundant nor env data size ${LICHEE_REDUNDANT_ENV_SIZE}---"
			mkenvimage -r -p 0x00 -s ${LICHEE_REDUNDANT_ENV_SIZE} -o env_nor.fex env_nor.cfg
		else
			generate_env_for_uboot env_nor.cfg env_nor.fex
		fi
	else
	echo 333333333333333333333333333333333333333333
		#update_boot0 boot0_nand.fex     sys_config.bin NAND > /dev/null
		#update_boot0 boot0_sdcard.fex   sys_config.bin SDMMC_CARD > /dev/null
		#update_boot0 boot0_ufs.fex   sys_config.bin UFS > /dev/null
		#update_chip boot0_nand.fex >/dev/null
		#update_chip boot0_sdcard.fex >/dev/null
		#update_chip boot0_ufs.fex >/dev/null
	fi

	if [ ! -f "u-boot-crash.fex" ]; then
		touch "u-boot-crash.fex"
		echo "ensure u-boot-crash.fex is not empty" > u-boot-crash.fex
	fi

	if [ -f "sunxi.fex" ]; then
		update_dtb sunxi.fex 4096
	fi

	if [ ! -f ${LICHEE_CHIP_CONFIG_DIR}/tools/arisc_config_parse.sh ]; then
		if [ -f "scp.fex" ]; then
			echo "update scp"
			update_scp scp.fex sunxi.fex >/dev/null
		fi
	fi

	if [ -f "optee.fex" ]; then
		echo "update optee"
		update_optee optee.fex sunxi.fex >/dev/null
	fi

	# Those files for Nand or Card
	if [ "x${PACK_KERN}" = "xlinux-3.4" ] ; then
		update_uboot -merge u-boot.fex sys_config.bin > /dev/null
	else
		update_uboot -no_merge u-boot.fex sys_config.bin > /dev/null
		[ -f u-boot-nodtb.fex ] && {
			update_uboot -no_merge u-boot-nodtb.fex sys_config.bin > /dev/null
		}
		[ -f u-boot-efex.fex ] && {
			update_uboot -no_merge u-boot-efex.fex  sys_config.bin > /dev/null
		}
	fi

	if [ -f "fes1_uart.fex" ]; then
		update_fes1  fes1_uart.fex           sys_config.bin > /dev/null
	fi

	update_fes1  fes1.fex           sys_config.bin > /dev/null
	if [ -f ${LICHEE_TOOLS_DIR}/pack/pctools/linux/mod_update/update_sboot ];then
		update_sboot sboot.bin  sys_config.bin  > /dev/null
		if [ $? -ne 0 ]
		then
			pack_error "update sboot run error"
			exit 1
		fi
	fi
	fsbuild      boot-resource.ini  split_xxxx.fex > /dev/null

	if [ -f boot_package_uartburn.cfg ]; then
		dragonsecboot -pack boot_package_uartburn.cfg
		if [ $? -ne 0 ]
		then
			pack_error "dragon pack boot_package_uartburn run error"
			exit 1
		fi
		mv boot_package.fex boot_package_uartburn.fex
	fi

	if [ -f boot_package.cfg ]; then
		if [ "x$LINUX_DTBO_FILE" = "x" ]; then
			echo "do not set LINUX_DTBO_FILE"
			line_num=`sed -n -e "/default.dtbo/=" boot_package.cfg`
			if [ "x$line_num" != "x" ]; then
				sed -i "$line_num s/^/;/g" boot_package.cfg
			fi
		else
			if [ -f $LINUX_DTBO_FILE ]
			then
				sed -i "s/default.dtbo/$LINUX_DTBO_FILE/g" boot_package.cfg
			else
				line_num=`sed -n -e "/default.dtbo/=" boot_package.cfg`
				if [ "x$line_num" != "x" ]; then
					sed -i "$line_num s/^/;/g" boot_package.cfg
				fi
			fi
		fi

			echo "pack boot package"
			maybe_busybox unix2dos boot_package.cfg
			dragonsecboot -pack boot_package.cfg

		if [ $? -ne 0 ]
		then
			pack_error "dragon pack run error"
			exit 1
		fi
	fi

	echo 2:LICHEE_REDUNDANT_ENV_SIZE:$LICHEE_REDUNDANT_ENV_SIZE
	if [ "x${PACK_FUNC}" = "xprvt" ] ; then
		if [ "x${LICHEE_REDUNDANT_ENV_SIZE}" != "x" ]; then
			echo "--mkenvimage create redundant env data!--"
			echo "--redundant env data size ${LICHEE_REDUNDANT_ENV_SIZE}---"
			mkenvimage -r -p 0x00 -s ${LICHEE_REDUNDANT_ENV_SIZE} -o env.fex env_burn.cfg
		else
			generate_env_for_uboot env_burn.cfg env.fex
		fi
	else
		if [ "x${LICHEE_REDUNDANT_ENV_SIZE}" != "x" ]; then
			echo "--mkenvimage create redundant env data!--"
			echo "--redundant env data size ${LICHEE_REDUNDANT_ENV_SIZE}---"
			mkenvimage -r -p 0x00 -s ${LICHEE_REDUNDANT_ENV_SIZE} -o env.fex env.cfg
		else
			generate_env_for_uboot env.cfg env.fex
		fi
	fi

	dmverity_deal clean

}

function do_finish()
{
	# Yeah, it should contain all files into full_img.fex for spinor
	# Because, as usually, spinor image size is very small.
	# If fail to create full_img.fex, we should fake it empty.

	# WTF, it is so ugly!!! It must be sunxi_mbr.fex & sys_partition.bin,
	# not sunxi_mbr_xxx.fex & sys_partition_xxx.bin. In order to advoid this
	# loathsome thing, we need to backup & copy files. Check whether
	# sys_partition_nor.bin is exist, and create sunxi_mbr.fex for Nor.
	local max_toc_size=2097152

	local IMG_NAME="${PACK_IC}_${PACK_TYPE}${PACK_PLATFORM_VERSION}_${PACK_BOARD}_${PACK_DEBUG}"
	if [ "x${PACK_MODE}" = "xdump" ] ; then
		IMG_NAME="${IMG_NAME}_${PACK_MODE}"
	fi

	if [ "x${PACK_FUNC}" = "xprvt" ]; then
		IMG_NAME="${IMG_NAME}_${PACK_FUNC}"
	fi

	if [ "x${PACK_SECURE}" = "xsecure" ] ; then
		IMG_NAME="${IMG_NAME}_${PACK_SECURE}"
	fi

	if [ "x${PACK_FUNC}" = "xprev_refurbish" ] ; then
		IMG_NAME="${IMG_NAME}_${PACK_FUNC}"
	fi

	if [ "x${PACK_NOR}" = "xnor" ] ; then
		IMG_NAME="${IMG_NAME}_${PACK_NOR}"
	fi

	if [ "x${PACK_SECURE}" != "xnone" ]; then
		local MAIN_VERION=$(readcfg dragon_toc.cfg rollback_ver ver)
		if [ ! -n "${MAIN_VERION}" ]; then
			local MAIN_VERION="$(echo '__unique:;@echo ${MAIN_VERSION}' | make -f - -f ${LICHEE_PACK_OUT_DIR}/version_base.mk --no-print-directory __unique)"
		fi
		IMG_NAME="${IMG_NAME}_v${MAIN_VERION}.img"
	else
		IMG_NAME="${IMG_NAME}.img"
	fi

	local IMG_PROGRAMMER_NAME="${IMG_NAME%.*}_programmer.img"

	echo "imagename = $IMG_NAME" >> ${LICHEE_PACK_OUT_DIR}/image.cfg
	echo "" >> ${LICHEE_PACK_OUT_DIR}/image.cfg

	local imagesize
	local toc_size
	local max_toc_size=3883264

	if [ "x${PACK_SECURE}" = "xsecure" ]; then
		toc_size=`stat toc1.fex --format="%s"`
	else
		toc_size=`stat boot_package.fex --format="%s"`
	fi

	if [ "$LICHEE_CHIP" == "sun55iw3p1" ]; then
		max_toc_size=3883264
	fi

	if [ ${toc_size} -gt ${max_toc_size} ];then
		pack_error "boot_package.fex/toc1.fex More than ${max_toc_size} bytes limit too large!!!"
		exit 1
	fi

	if [ "x${PACK_NOR}" = "xnor" ] ; then
		NOR_LOGIC_START=2016
		NOR_UBOOT_START=128
		NOR_FLASH_SIZE=65536 #32M
		NOR_LOGIC_START_KB=`expr ${NOR_LOGIC_START} / 2`
		NOR_UBOOT_START_KB=`expr ${NOR_UBOOT_START} / 2`

		local uboot_dts=""
		if [ -n "${LICHEE_BRANDY_UBOOT_VER}" ] && [ ${LICHEE_BRANDY_UBOOT_VER} -ge 2023 ]; then
			uboot_dts="${LICHEE_BOARD_CONFIG_DIR}/uboot-${LICHEE_BRANDY_UBOOT_VER}/uboot-board.dts"
		else
			uboot_dts="${LICHEE_BOARD_CONFIG_DIR}/uboot-board.dts"
		fi

		if [ -f ${uboot_dts} ] && [ x"$(grep "nor_map" ${uboot_dts})" != x"" ]; then
			echo "get flashmap from ${uboot_dts}"
			NOR_FLASH_SIZE=$(awk '/nor_map {/,/}/ {print NR ": " $0}' ${uboot_dts} \
				| grep  "\bflash_size\b" | grep -oP "(?<=\<)\d+(?=\>)")

			NOR_LOGIC_START=$(awk '/nor_map {/,/}/ {print NR ": " $0}' ${uboot_dts} \
				| grep  "\blogic_offset\b" | grep -oP "(?<=\<)\d+(?=\>)")

			NOR_UBOOT_START=$(awk '/nor_map {/,/}/ {print NR ": " $0}' ${uboot_dts} \
				| grep  "\buboot_start\b" | grep -oP "(?<=\<)\d+(?=\>)")

			[ x"${NOR_FLASH_SIZE}" = x"" -o x"${NOR_LOGIC_START}" = x"" -o x"${NOR_UBOOT_START}" = x"" ] && {
				pack_warn "flash_size,logic_offset,uboot_start maybe not set in uboot-board.dts"
				NOR_LOGIC_START=2016
				NOR_UBOOT_START=128
				NOR_FLASH_SIZE=65536 #32M
			}

			NOR_LOGIC_START_KB=`expr ${NOR_LOGIC_START} / 2`
			NOR_UBOOT_START_KB=`expr ${NOR_UBOOT_START} / 2`
			echo "flash size:${NOR_FLASH_SIZE}, logic start:${NOR_LOGIC_START}, uboot start:${NOR_UBOOT_START}"
		fi

		update_mbr sys_partition_nor.bin 1 sunxi_mbr_nor.fex dlinfo.fex \
				${NOR_FLASH_SIZE} ${NOR_LOGIC_START} 1

		if [ $? -ne 0 ]; then
			pack_error "update_mbr failed"
			exit 1
		fi
		echo '----------programmer nor image is full_img.fex ----------'
		if [ "x${PACK_KERN}" = "xlinux-3.4" ] ; then
		#when use devicetree, the size of uboot+dtb is larger then 256K
			#BOOT1_FILE=u-boot-spinor.fex
			#LOGIC_START=240 #240+16=256K
			#merge_package full_img.fex boot0_spinor.fex \
			#        u-boot-spinor.fex sunxi_mbr_nor.fex sys_partition_nor.bin
			merge_full_img --out full_img.fex --boot0 boot0_spinor.fex --boot1 u-boot-spinor.fex \
							--mbr sunxi_mbr_nor.fex  --partition sys_partition_nor.bin \
							--logic_start 240 > /dev/null
		else
			merge_full_img --out full_img.fex --boot0 boot0_spinor.fex --boot1 boot_package_nor.fex \
				--mbr sunxi_gpt.fex --partition sys_partition_nor.bin \
				--logic_start ${NOR_LOGIC_START_KB} --uboot_start ${NOR_UBOOT_START_KB} > /dev/null
		fi

		if [ $? -ne 0 ]; then
			pack_error "merge_full_img failed"
			exit 1
		fi
		mv sys_partition_nor.fex sys_partition.fex
	fi

	if [ ! -f sys_partition_nor.bin ]; then
		update_mbr          sys_partition.bin 4
		if [ $? -ne 0 ]; then
			pack_error "update_mbr failed"
			exit 1
		fi

		#15269888 is from emmc datasheet, sec_count in Extended CSD is 0xe90000 = 15269888.
		#40960 is the mbr location for emmc
		#0  is emmc/nand ; 1 is spinor
		update_mbr sys_partition.bin 4 sunxi_mbr.fex dlinfo.fex 15269888 40960 0
		if [ $? -ne 0 ]; then
			pack_error "update_mbr_gpt failed"
			exit 1
		fi
	fi

	if [ x"${PACK_PLATFORM}" = x"openwrt" ]; then
		echo "===================================="
		echo "show sys_partition.fex message"
		show_partition_message sys_partition.fex
	fi

	local e cfgadd cfgget lastcfgline localfile filename
	local imgcfg_add_list=(
		# localfile             filename-in-cfg        maintype  subtype
		'vmlinux.fex            vmlinux.fex            12345678  123456789VMLINUX'
		'vendor_boot-debug.fex  vendor_boot-debug.fex  RFSFAT16  VENDOR_BOOTDEBUG'
		'dragon_toc.cfg         dragon_toc.fex         12345678  12345678DGTOCCFG'
		)

	for e in "${imgcfg_add_list[@]}"; do
		localfile="$(awk '{print $1}' <<< $e)"
		filename="$(awk '{print $2}' <<< $e)"
		maintype="$(awk '{print $3}' <<< $e)"
		subtype="$(awk '{print $4}' <<< $e)"
		cfgget="$(sed -n '/^\s*{\s*filename\s*=\s*"'$filename'"\s*,/p' image.cfg)"
		lastcfgline="$(sed -n '/^\s*{\s*filename\s*=/=' image.cfg | tail -1)"

		[ ! -f "$localfile" -o -n "$cfgget" -o -z "$lastcfgline" ] && continue
		[ "$localfile" != "$filename" ] && ln -sf $localfile $filename
		cfgadd='    {filename = "'$filename'",'
		cfgadd+='     maintype = "'$maintype'",'
		cfgadd+='     subtype  = "'$subtype'",},'
		sed -i -e  ''"${lastcfgline}"'a\' -e "$cfgadd" image.cfg
	done

	dragon image.cfg    sys_partition.fex
	if [ $? -eq 0 ]; then
		if [ -e ${IMG_NAME} ]; then
			mv ${IMG_NAME} $LICHEE_OUT_DIR/$LICHEE_IC/$LICHEE_BOARD/$LICHEE_LINUX_DEV/${IMG_NAME}
			rm -f $LICHEE_OUT_DIR/${IMG_NAME}
			ln -f $LICHEE_OUT_DIR/$LICHEE_IC/$LICHEE_BOARD/$LICHEE_LINUX_DEV/${IMG_NAME}  $LICHEE_OUT_DIR/${IMG_NAME}
			imagesize=$(du --apparent-size -sh $LICHEE_OUT_DIR/$LICHEE_IC/$LICHEE_BOARD/$LICHEE_LINUX_DEV/${IMG_NAME} | awk '{print $1}')
			echo '----------image is at----------'
			echo -e '\033[0;31;1m'
			echo -e "$imagesize\t${LICHEE_OUT_DIR}/${IMG_NAME}"
			echo -e '\033[0m'
		fi
	fi
	cd ..

	if [ "x${PACK_PROGRAMMER}" = "xprogrammer" ]; then
		if [ -f  $LICHEE_PACK_OUT_DIR/super.fex ]; then
			mv $LICHEE_PACK_OUT_DIR/super.fex $LICHEE_PACK_OUT_DIR/super.bak.fex
			simg2img  $LICHEE_PACK_OUT_DIR/super.bak.fex $LICHEE_PACK_OUT_DIR/super.fex
		fi
		echo "waiting to ceate programmer img..."
		img_to_programmer ${IMG_PROGRAMMER_NAME} $LICHEE_OUT_DIR/${LICHEE_IC}/${LICHEE_BOARD}/${LICHEE_LINUX_DEV}/${IMG_NAME}
		if [ $? -eq 0 ]; then
			if [ -e ${IMG_PROGRAMMER_NAME} ]; then
				mv $LICHEE_PACK_OUT_DIR/${IMG_PROGRAMMER_NAME} $LICHEE_OUT_DIR/${LICHEE_IC}/${LICHEE_BOARD}/${LICHEE_LINUX_DEV}/${IMG_PROGRAMMER_NAME}
				imagesize=$(du --apparent-size -sh $LICHEE_OUT_DIR/${LICHEE_IC}/${LICHEE_BOARD}/${LICHEE_LINUX_DEV}/${IMG_PROGRAMMER_NAME} | awk '{print $1}')
				echo '----------programmer image is at----------'
				echo -e '\033[0;31;1m'
				echo -e "$imagesize\t${LICHEE_OUT_DIR}/${IMG_PROGRAMMER_NAME}"
				echo -e '\033[0m'
			fi
		fi
	fi
	cd ..
	do_finish_SATA
	printf "pack finish\n"
	[ -e ${LICHEE_TOP_DIR}/build/.hooks/post-dragon ] &&
		source ${LICHEE_TOP_DIR}/build/.hooks/post-dragon
	return 0
}

function do_finish_SATA()
{
	if [ "x$BUILD_SATA" = "xtrue" ];then
		SATA_TAR=$LICHEE_TOP_DIR/SATA/linux/${LICHEE_CHIP}.tar
		if [ -f $SATA_TAR ];then
			echo '----------SATA is at----------'
			echo -e '\033[0;31;1m'
			echo $SATA_TAR
			echo -e '\033[0m'
		else
			echo PACK SATA failed!
		fi
	fi
}

function dmverity_deal()
{
	local script_name=scripts/build.sh
	local script_path=$LICHEE_KERN_DIR

	if [ ! -x $script_path/$script_name ]; then
		script_path=$LICHEE_BUILD_DIR
		script_name=mkkernel.sh
	fi

	[ ! -x $script_path/$script_name ] && return 255
	[ -z "$(grep "^\s*deal_verity)\s*$" $script_path/$script_name)" ] && return 1

	(cd $script_path && ./$script_name "deal_verity" $@)
}

function dmverity_get_blk_count()
{
	local size=`du --apparent-size -b $1 | awk '{print $1}'`
	local BLK_SIZE=$2

	if [ `expr ${size} % ${BLK_SIZE}` = "0" ]; then
			local blks=`(expr ${size} / ${BLK_SIZE})`
	else
			local blks=`(expr ${size} / ${BLK_SIZE} + 1 )`
	fi

	echo $blks
}

function dmverity_determ_blk_size()
{
	local type_info=`file -L $1`

	#check rootfs file system type to determ block size
	if [ "x""`echo ${type_info}| grep "ext4 filesystem"`" != "x" ];then
		block_size=`tune2fs -l $1|grep "Block size"|awk {'print $3'}`
		echo ${block_size}
	else
		echo "not support file system type"
		return -1
	fi

}
function dmverity_genHashTable()
{
	local fs_name=$1
	local tree_name=$2
	local table_name=$3
	local block_size=`dmverity_determ_blk_size ${fs_name}`
	if [ ${block_size} -lt 0 ];then
		return -1
	fi
	veritysetup format --data-block-size=${block_size} --hash-block-size=${block_size} ${fs_name} ${tree_name} > ${table_name}
	return $?
}

function dmverity_genDownloadFile()
{
	local fs_name=$1
	local sign_name=$2
	local table_name=$3
	local tree_name=$4
	local download_file_name=$5

	local BLK_SIZE=`dmverity_determ_blk_size ${fs_name}`
	if [ ${BLK_SIZE} -lt 0 ];then
		return -1
	fi
	local SIGN_BLK=`dmverity_get_blk_count ${sign_name} ${BLK_SIZE}`
	local TABLE_BLK=`dmverity_get_blk_count ${table_name} ${BLK_SIZE}`
	local TREE_BLK=`dmverity_get_blk_count ${tree_name} ${BLK_SIZE}`

	# 3.1 copy sign
	dd if=${sign_name} of=${download_file_name}"tmp" bs=${BLK_SIZE} count=${SIGN_BLK} >/dev/null 2>&1

	# 3.2 copy table size
	local TABLE_SIZE=`du --apparent-size -b ${table_name} | awk '{print $1}'`
	local HIGH_BYTES=`expr $TABLE_SIZE / 256 `
	local LOW_BYTES=`expr $TABLE_SIZE % 256 `
	if [ $HIGH_BYTES -gt 256 ]; then
		echo "ERROR rootfs_hash_table size should < 64KB"
		return -1
	fi
	local HIGH_BYTES_H=`echo "obase=16;ibase=10;$HIGH_BYTES" | bc`
	local LOW_BYTES_H=`echo "obase=16;ibase=10;$LOW_BYTES" | bc`
	echo -e -n "\x$LOW_BYTES_H\x$HIGH_BYTES_H" >> ${download_file_name}"tmp"

	# 3.3 copy rootfs_hash_table
	dd if=${table_name} of=${download_file_name}"tmp"  bs=${BLK_SIZE} seek=${SIGN_BLK} count=${TABLE_BLK} > /dev/null 2>&1

	# 3.4 copy rootfs_hash_tree.bin
	dd if=${tree_name} of=${download_file_name}"tmp"  bs=${BLK_SIZE} seek=`expr ${SIGN_BLK} + ${TABLE_BLK}` count=${TREE_BLK} > /dev/null 2>&1

	dd of=${download_file_name} if=${download_file_name}"tmp" bs=${BLK_SIZE} count=`expr ${SIGN_BLK} + ${TABLE_BLK} + ${TREE_BLK}`>/dev/null 2>&1
	rm ${download_file_name}"tmp"
}

function do_signature_dsp()
{
	local DSP0_BIN=${LICHEE_PACK_OUT_DIR}/amp_dsp0.fex;
	local DSP1_BIN=${LICHEE_PACK_OUT_DIR}/amp_dsp1.fex;
	local CFG_FILE=${LICHEE_CHIP_CONFIG_DIR}/configs/default/image_header_secure.cfg;

	if [ -f ${CFG_FILE} ] ; then
		cp -v ${CFG_FILE} image_header_secure.cfg
	else
		printf "can not found image_header_secure cfg\n"
		return 1
	fi

	if [ -f ${DSP0_BIN} ] ; then
		mkimage_header -C 5 -c image_header_secure.cfg -s rsa -k $CFG_KEY_DIR
		if [ $? -ne 0 ]
		then
			pack_error "mkimage_header signature dsp error\n"
			exit 1
		fi
		mv amp_dsp0.fex.pack amp_dsp0.fex
	else
		printf "can not found amp_dsp0 bin\n"
		return 3
	fi

	if [ -f ${DSP1_BIN} ] ; then
		mv amp_dsp0.fex.pack amp_dsp0.fex
	fi

}

function do_signature_riscv()
{
	local RV0_BIN=${LICHEE_PACK_OUT_DIR}/amp_rv0.fex;
	local RV1_BIN=${LICHEE_PACK_OUT_DIR}/amp_rv1.fex;
	local CFG_FILE=${LICHEE_CHIP_CONFIG_DIR}/configs/default/image_header_secure.cfg;
	local key_type=$(readcfg dragon_toc.cfg key_para key_toc1 | cut -c 1-3)
	if [ x${key_type} == "xecc" ]; then
		sign_alg=ecc
	else
		sign_alg=rsa
	fi

	if [ -f ${CFG_FILE} ] ; then
		cp -v ${CFG_FILE} image_header_secure.cfg
	else
		printf "can not found image_header_secure cfg\n"
		return 1
	fi

	if [ -f ${RV0_BIN} ] ; then
		mkimage_header -C 5 -c image_header_secure.cfg -s $sign_alg -k $CFG_KEY_DIR
		if [ $? -ne 0 ]
		then
			pack_error "mkimage_header signature rv error\n"
			exit 1
		fi
		mv amp_rv0.fex.pack amp_rv0.fex
	else
		printf "can not found amp_rv0 bin\n"
		return 3
	fi

	if [ -f ${RV1_BIN} ] ; then
		mv amp_rv1.fex.pack amp_rv1.fex
	fi

}

function do_signature_ft()
{
	if [ ! -e ${LICHEE_PACK_OUT_DIR}/ft_${PACK_CHIP}.bin ]; then
		printf "can not found ft bin\n"
		return 1
	fi

	if [ -e ${LICHEE_PACK_OUT_DIR}/dragon_toc_ft.cfg ]; then
		printf "can not found dragon_toc_ft cfg\n"
	fi

	printf "prepare for signature for ft bin\n"
	mv ${LICHEE_PACK_OUT_DIR}/ft_${PACK_CHIP}.bin ${LICHEE_PACK_OUT_DIR}/ft.bin
	dragonsecboot -toc0 dragon_toc_ft.cfg $CFG_KEY_DIR ${LICHEE_PACK_OUT_DIR}/version_base.mk > /dev/null
	if [ $? -ne 0 ]; then
		pack_error "dragon toc0_ft run error\n"
		exit 1
	fi

	mv toc0.fex toc0_ft.fex
}

function do_signature_fel()
{
	printf "prepare for signature for fex tools\n"
	local ROOT_KEY_NAME="";
	local UBOOT_NAME="u-boot";
	local sign_tools=$(readcfg dragon_toc.cfg sign_fel_tools sign_tools)

	if [ -f u-boot-efex.fex ]; then
		UBOOT_NAME="u-boot-efex"
	fi
	echo UBOOT_NAME ${UBOOT_NAME}

	if [ x${sign_tools} == "xdragonsboot" ]; then
		printf "using dragonsboot to sign fel\n"

		if [ -f ${CFG_KEY_DIR}/RootKey_Level_0.pem ]; then
			ROOT_KEY_NAME=${CFG_KEY_DIR}/RootKey_Level_0.pem
		elif [ -f ${CFG_KEY_DIR}/Trustkey.pem ]; then
			ROOT_KEY_NAME=${CFG_KEY_DIR}/Trustkey.pem
		else
			pack_error "can not found root key to sign fex tool"
			exit 1
		fi
		echo rootkeyname ${ROOT_KEY_NAME}

		dragonsecboot -sign fes1.fex ${ROOT_KEY_NAME} ${LICHEE_PACK_OUT_DIR}/version_base.mk > /dev/null
		if [ $? -eq 0 ]; then
			dragonsecboot -sign ${UBOOT_NAME}.fex ${ROOT_KEY_NAME} ${LICHEE_PACK_OUT_DIR}/version_base.mk > /dev/null
			if [ $? -ne 0 ]
			then
				pack_error "dragonsecboot uboot fail"
			fi
		fi
	else
		printf "using sig_fel_image to sign fel\n"
		if [ -f ${CFG_KEY_DIR}/RootKey_Level_0.bin ]; then
			ROOT_KEY_NAME=${CFG_KEY_DIR}/RootKey_Level_0.bin
		elif [ -f ${CFG_KEY_DIR}/Trustkey.bin ]; then
			ROOT_KEY_NAME=${CFG_KEY_DIR}/Trustkey.bin
		else
			pack_error "can not found root key to sign fex tool"
			exit 1
		fi
		echo rootkeyname ${ROOT_KEY_NAME}

		sig_fel_image --input fes1.fex --rsakey ${ROOT_KEY_NAME} --output fes1_sign.fex --version_base ${LICHEE_PACK_OUT_DIR}/version_base.mk
		if [ $? -ne 0 ]
		then
			pack_error "sig_fel_image fes fail"
			exit 1
		fi
		sig_fel_image --input ${UBOOT_NAME}.fex --rsakey ${ROOT_KEY_NAME} --output ${UBOOT_NAME}_sign.fex --version_base ${LICHEE_PACK_OUT_DIR}/version_base.mk
		if [ $? -ne 0 ]
		then
			pack_error "sig_fel_image uboot fail"
		fi
	fi

	if [ -f fes1_sign.fex ]; then
		cp fes1_sign.fex fes1.fex
	fi

	if [ -f  ${UBOOT_NAME}_sign.fex ]; then
		cp ${UBOOT_NAME}_sign.fex ${UBOOT_NAME}.fex
	fi
}

function readcfg()
{
	local fid=$1
	local section=$2
	local option=$3

	test ! -f $fid && echo "file not exits:$fid" && exit 1
	if [ $# -eq 3 ] ; then
		local src=$(cat $fid | awk '/\['$section'\]/{f=1;next} /\[*\]/{f=0} f' |
		grep ^$option |
		grep '='     |
		cut -d'=' -f2|
		cut -d'#' -f1|
		cut -d';' -f1|
		awk '{gsub(/^\s+|\s+$/, "");print}')
		echo -n $src
		test ${#src} -eq 0 && return 1 || return 0
	else
		echo "the input parameters should be 3"
		exit 1
	fi
}

function get_item_from_cfg()
{
	name=()
	bin=()
	cert=()
	counts=0

	local toc_cfg=$1
	local field=$2
	local key=$3

	toc1_item_content=$(readcfg ${toc_cfg} ${field} ${key})
	i=0
	IFS=', ' read -r -a parts <<< $toc1_item_content
	for part in "${parts[@]}"; do
		if [ $(($i % 3)) -eq 0 ]; then
			name[counts]=$part
		elif [ $(($i % 3)) -eq 1 ]; then
			bin[counts]=$part
		else
			cert[counts]=$part
			counts=$((counts + 1))
		fi
		i=$((i + 1))
	done
}

function create_toc0()
{
	local toc_cfg=$1
	local key=""
	local cert_type=""
	local key_type=""
	local psck_mode=""

	rm -rf toc0

	if [ ! -d "toc0" ]; then
		mkdir -p toc0
	fi

	if [ ! -d "temp" ]; then
		mkdir -p temp
	fi

	get_item_from_cfg ${toc_cfg} toc0 item

	key=$(readcfg ${toc_cfg} key_toc0 ${name[0]})
	cert_type=$(readcfg ${toc_cfg} cert_type cert_type_toc0)
	key_type=$(readcfg ${toc_cfg} key_para key_toc0 | cut -c 1-3)
	if [ x${key_type} == "xrsa" ]; then
		psck_mode=RSA-PKCS
	elif [ x${key_type} == "xecc" ]; then
		psck_mode=ECDSA
	else
		pack_error "key_toc0 type error"
		exit 1
	fi

	#gen sboot hash
	dragon_securetool hash --mode 256 --in ${bin[0]} --out ./temp/${bin[0]}.hash.out
	if [ $? -ne 0 ]
	then
		pack_error "gen sboot hash error"
		exit 1
	fi

	#req no sign cert, ext is sboot_hash; use pubkey
	dragon_securetool req_cert --type ${cert_type} --cfg ${toc_cfg} --pubkey ${CFG_KEY_DIR}/${key}.pem.pub --ext ./temp/${bin[0]}.hash.out --out ./temp/${name[0]}.req
	if [ $? -ne 0 ]
	then
		pack_error "req no sign cert for toc0 error"
		exit 1
	fi

	#gen no sign cert hash, witch is to be signed
	dragon_securetool hash --mode 256 --type ${cert_type} --in ./temp/${name[0]}.req --out ./temp/${name[0]}.req.hash
	if [ $? -ne 0 ]
	then
		pack_error "gen no sign cert hash for toc0 error"
		exit 1
	fi

	#sign cert(to be signed) hash
	if [ "x$SOFTHSM_FLAG" == "x1" ]; then
		local id=$(echo "$key" | md5sum | awk '{print $1}')
		pkcs11-tool --label ${key} --id ${id} -s -p ${PIN} -m ${psck_mode} --module ${MODULES} --input-file ./temp/${name[0]}.req.hash --output-file ./temp/${name[0]}.req.sign
		if [ $? -ne 0 ]
		then
			pack_error "softhsm sign cert(to be signed) hash for toc0 error"
			exit 1
		fi
	else
		dragon_securetool sign --cfg ${toc_cfg} --privatekey ${CFG_KEY_DIR}/${key}.pem --in ./temp/${name[0]}.req.hash --out ./temp/${name[0]}.req.sign
		if [ $? -ne 0 ]
		then
			pack_error "sign cert(to be signed) hash for toc0 error"
			exit 1
		fi
	fi

	#create cert with sign
	dragon_securetool create_cert --type ${cert_type} --cfg ${toc_cfg} --pubkey ${CFG_KEY_DIR}/${key}.pem.pub --reqfile ./temp/${name[0]}.req --signfile ./temp/${name[0]}.req.sign --out ./toc0/${cert[0]}
	if [ $? -ne 0 ]
	then
		pack_error "create cert with sign for toc0 error"
		exit 1
	fi

	#create toc0.fex(toc0_head + sboot.crtpt + sboot)
	dragon_securetool create_toc0 --cfg ${toc_cfg} --out ./toc0.fex
	if [ $? -ne 0 ]
	then
		pack_error "dragon toc0 run error"
		exit 1
	fi
}

function do_signature_sboot()
{
	local sboot_file=$1;
	local flash_type=$2;

	#dram_param
	if [ -f ${LICHEE_TOOLS_DIR}/pack/pctools/linux/mod_update/update_sboot ]; then
		update_sboot $sboot_file  sys_config.bin  > /dev/null
		if [ $? -ne 0 ]
		then
			pack_error "update sboot run error"
			exit 1
		fi
	fi

	update_chip $sboot_file > /dev/null

	#dragon_toc only load sboot.bin
	[ "$(readlink -f $sboot_file)" != "$(readlink -f sboot.bin)" ] && \
	mv $sboot_file sboot.bin

	#readcfg determines whether the cfg file is legacy or new
	readcfg dragon_toc.cfg key_para key > /dev/null
	if [ $? -ne 0 ]; then
		dragonsecboot -toc0 dragon_toc.cfg $CFG_KEY_DIR ${LICHEE_PACK_OUT_DIR}/version_base.mk > /dev/null
		if [ $? -ne 0 ]
		then
			pack_error "dragon toc0 run error"
			exit 1
		fi
	else
		create_toc0 dragon_toc.cfg

	fi

	update_toc0  toc0.fex           sys_config.bin
	if [ $? -ne 0 ]
	then
		pack_error "update toc0 run error"
		exit 1
	fi

	[ "$(readlink -f $sboot_file)" != "$(readlink -f sboot.bin)" ] && \
	mv sboot.bin $sboot_file
	if [ -f toc0_$flash_type.fex ]; then
		rm -rf toc0_$flash_type.fex
	fi
	mv toc0.fex toc0_$flash_type.fex
	mv toc0 toc0_$flash_type
}

function do_signature_toc0()
{
	if [ -f sboot.bin ]; then
		do_signature_sboot sboot.bin bak
		mv sboot.bin sboot_bak.bin
	fi

	if [ -f sboot_sdcard.bin ]; then
		if [ -f cardscript.fex ]; then
			sed -i "s/TOC0_00000000000/TOC0_SDCARD00000/g" cardscript.fex
		fi
		do_signature_sboot sboot_sdcard.bin sdcard
	fi

	if [ -f sboot_nand.bin ]; then
		do_signature_sboot sboot_nand.bin nand

	fi

	if [ -f sboot_ufs.bin ]; then
		do_signature_sboot sboot_ufs.bin ufs
	fi

	if [ -f sboot_nor.bin ]; then
		do_signature_sboot sboot_nor.bin nor
	fi

	mv sboot_bak.bin sboot.bin
	mv toc0_bak.fex toc0.fex
	mv toc0_bak toc0
}

function toc1_create_cert_for_per_bin()
{
	local toc_cfg=$1
	local key=""
	local cert_type=""
	local key_type=""
	local psck_mode=""

	cert_type=$(readcfg ${toc_cfg} cert_type cert_type_toc1)
	key_type=$(readcfg ${toc_cfg} key_para key_toc1 | cut -c 1-3)
	if [ x${key_type} == "xrsa" ]; then
		psck_mode=RSA-PKCS
	elif [ x${key_type} == "xecc" ]; then
		psck_mode=ECDSA
	else
		pack_error "key_toc1 type error"
		exit 1
	fi

	for ((count=0; count < counts; count++)); do
		key=$(readcfg ${toc_cfg} key_toc1 ${name[count]})
		#gen ${bin[count]} hash
		dragon_securetool hash --mode 256 --in ${bin[count]} --out temp/${name[count]}_hash.out
		if [ $? -ne 0 ]
		then
			pack_error "gen hash ${name[count]} error"
			exit 1
		fi

		#req no sign cert, ext is sboot_hash; use pubkey
		dragon_securetool req_cert --type ${cert_type} --cfg ${toc_cfg} --pubkey ${CFG_KEY_DIR}/$key.pem.pub --ext temp/${name[count]}_hash.out --out temp/${cert[count]}.req
		if [ $? -ne 0 ]
		then
			pack_error "req no sign cert ${name[count]} error"
			exit 1
		fi

		#gen no sign cert hash, witch is to be signed
		dragon_securetool hash --mode 256 --type ${cert_type} --in temp/${cert[count]}.req --out temp/to_be_signed_${name[count]}_hash.out
		if [ $? -ne 0 ]
		then
			pack_error "gen no sign cert hash ${name[count]} error"
			exit 1
		fi

		#sign cert(to be signed) hash
		if [ "x$SOFTHSM_FLAG" == "x1" ]; then
			local id=$(echo "$key" | md5sum | awk '{print $1}')
			pkcs11-tool --label ${key} --id ${id} -s -p ${PIN} -m ${psck_mode} --module ${MODULES} --input-file temp/to_be_signed_${name[count]}_hash.out --output-file temp/${name[count]}_sign.out
			if [ $? -ne 0 ]
			then
				pack_error "softhsm sign cert(to be signed) hash ${name[count]} error"
				exit 1
			fi
		else
			dragon_securetool sign --cfg ${toc_cfg} --privatekey ${CFG_KEY_DIR}/$key.pem --in temp/to_be_signed_${name[count]}_hash.out --out temp/${name[count]}_sign.out
			if [ $? -ne 0 ]
			then
				pack_error "sign cert(to be signed) hash ${name[count]} error"
				exit 1
			fi
		fi

		#create cert with sign
		dragon_securetool create_cert --type ${cert_type} --cfg ${toc_cfg} --pubkey ${CFG_KEY_DIR}/${key}.pem.pub --reqfile temp/${cert[count]}.req --signfile temp/${name[count]}_sign.out --out toc1/cert/${cert[count]}
		if [ $? -ne 0 ]
		then
			pack_error "create cert with sign ${name[count]} error"
			exit 1
		fi
	done
}

function toc1_create_cert_for_rootkey()
{
	local toc_cfg=$1
	local key=""
	local cert_type=""
	local key_type=""
	local psck_mode=""

	cert_type=$(readcfg ${toc_cfg} cert_type cert_type_toc1)
	get_item_from_cfg ${toc_cfg} toc1 rootkey
	key=$(readcfg ${toc_cfg} key_toc0 rootkey)
	key_type=$(readcfg ${toc_cfg} key_para key_toc0 | cut -c 1-3)
	if [ x${key_type} == "xrsa" ]; then
		psck_mode=RSA-PKCS
	elif [ x${key_type} == "xecc" ]; then
		psck_mode=ECDSA
	else
		pack_error "key_toc0 type error"
		exit 1
	fi

	#rootkey no sign cert
	#req no sign rootkey cert, insert extensions in the dragon_toc.cfg; use pubkey
	dragon_securetool req_rootkey_cert --type ${cert_type} --cfg ${toc_cfg} --keypath ${CFG_KEY_DIR} --pubkey ${CFG_KEY_DIR}/${key}.pem.pub
	if [ $? -ne 0 ]
	then
		pack_error "req rootkey cert error"
		exit 1
	fi

	mv toc1/cert/${cert[0]} temp/${cert[0]}.req
	#gen no sign rootkey cert hash, witch is to be signed; Non-x509 certificates do not need to skip 4 bytes
	dragon_securetool hash --mode 256 --type ${cert_type} --in temp/${cert[0]}.req --out temp/to_be_signed_${name[0]}_hash.out
	if [ $? -ne 0 ]
	then
		pack_error "gen no sign rootkey cert hash error"
		exit 1
	fi

	#sign rootkey cert(to be signed) hash
	if [ "x$SOFTHSM_FLAG" == "x1" ]; then
		local id=$(echo "$key" | md5sum | awk '{print $1}')
		pkcs11-tool --label ${key} --id ${id} -s -p ${PIN} -m ${psck_mode} --module ${MODULES} --input-file temp/to_be_signed_${name[0]}_hash.out --output-file temp/${name[0]}_sign.out
		if [ $? -ne 0 ]
		then
			pack_error "softhsm sign rootkey cert(to be signed) hash error"
			exit 1
		fi
	else
		dragon_securetool sign --cfg ${toc_cfg} --privatekey ${CFG_KEY_DIR}/${key}.pem --in temp/to_be_signed_${name[0]}_hash.out --out temp/${name[0]}_sign.out
		if [ $? -ne 0 ]
		then
			pack_error "sign rootkey cert(to be signed) hash error"
			exit 1
		fi
	fi

	#create rootkey cert with sign
	dragon_securetool create_cert --type ${cert_type} --cfg ${toc_cfg} --pubkey ${CFG_KEY_DIR}/${key}.pem.pub --reqfile temp/${cert[0]}.req --signfile temp/${name[0]}_sign.out --out toc1/cert/${cert[0]}
	if [ $? -ne 0 ]
	then
		pack_error "create rootkey cert with sign error"
		exit 1
	fi
}

function do_signature_toc1()
{
	rm -rf toc1

	if [ ! -d "toc1/cert" ]; then
		mkdir -p toc1/cert
	fi

	if [ ! -d "temp" ]; then
		mkdir -p temp
	fi

	#create cert for toc1 item
	get_item_from_cfg dragon_toc.cfg toc1 item
	toc1_create_cert_for_per_bin dragon_toc.cfg

	#create cert for toc1 onlykey
	get_item_from_cfg dragon_toc.cfg toc1 onlykey
	toc1_create_cert_for_per_bin dragon_toc.cfg

	toc1_create_cert_for_rootkey dragon_toc.cfg

	#create toc1.fex(toc1_head + rootkey.crtpt + ..)
	dragon_securetool create_toc1 --cfg dragon_toc.cfg --out toc1.fex
	if [ $? -ne 0 ]
	then
		pack_error "dragon toc1 run error"
		exit 1
	fi
}

function do_signature()
{
	printf "prepare for signature by openssl\n"
	if [ ! -d $CFG_KEY_DIR ] ; then
		pack_error "No key exist, please run './build/createkeys' to generate keys first."
		exit 1
	fi
	if [ "x${PACK_SIG}" = "xprev_refurbish" ] ; then
		if [ "x${LICHEE_ARCH}" = "xarm64" ] ; then
			cp -v ${LICHEE_COMMON_CONFIG_DIR}/sign_config/dragon_toc_a64_no_secureos.cfg dragon_toc.cfg
		else
			cp -v ${LICHEE_COMMON_CONFIG_DIR}/sign_config/dragon_toc_no_secureos.cfg dragon_toc.cfg
		fi
	else
		if [ "x${LICHEE_ARCH}" = "xarm64" ] ; then
			if [ -f ${LICHEE_CHIP_CONFIG_DIR}/configs/default/dragon_toc.cfg ] ; then
				cp -v ${LICHEE_CHIP_CONFIG_DIR}/configs/default/dragon_toc.cfg dragon_toc.cfg
			else
				cp -v ${LICHEE_COMMON_CONFIG_DIR}/sign_config/dragon_toc_a64.cfg dragon_toc.cfg
			fi
		else
			if [ -f ${LICHEE_CHIP_CONFIG_DIR}/configs/default/dragon_toc.cfg ] ; then
				cp -v ${LICHEE_CHIP_CONFIG_DIR}/configs/default/dragon_toc.cfg dragon_toc.cfg
			else
				cp -v ${LICHEE_COMMON_CONFIG_DIR}/sign_config/dragon_toc.cfg dragon_toc.cfg
			fi
		fi
	fi
	if [ "x${PACK_NOR}" = "xnor" ] ; then
		cp -vf ${LICHEE_PACK_OUT_DIR}/dragon_toc_nor.cfg ${LICHEE_PACK_OUT_DIR}/dragon_toc.cfg
	fi

	if [ -f ${CFG_KEY_DIR}/softhsm2.cfg ]; then
		# fix tokendir
		tokendir=$(grep tokendir ${CFG_KEY_DIR}/softhsm2.cfg | awk '{print $3}')
		if [ "x$tokendir" != "x${CFG_KEY_DIR}/.token" ]; then
			sed -i "s#${tokendir}#${CFG_KEY_DIR}/.token#g" ${CFG_KEY_DIR}/softhsm2.cfg
		fi

		PIN=1234
		SOPIN=12345678
		SOFTHSM_TOOLS_DIR=${LICHEE_TOOLS_DIR}/pack/pctools/linux/softhsm
		MODULES=${SOFTHSM_TOOLS_DIR}/lib/softhsm/libsofthsm2.so
		export LD_LIBRARY_PATH=${SOFTHSM_TOOLS_DIR}/lib:${SOFTHSM_TOOLS_DIR}/lib/softhsm:${LIB_LIBRARY_PATH}
		export PATH=${SOFTHSM_TOOLS_DIR}/bin:$PATH
		export SOFTHSM2_CONF=${CFG_KEY_DIR}/softhsm2.cfg

		SOFTHSM_FLAG=1
	fi

	if [ $? -ne 0 ]
	then
		pack_error "dragon toc config file is not exist"
		exit 1
	fi

	rm -f cardscript.fex
	mv cardscript_secure.fex cardscript.fex
	if [ $? -ne 0 ]
	then
		pack_error "dragon cardscript_secure.fex file is not exist"
		exit 1
	fi

	if [ ! -f ${LICHEE_PLAT_OUT}/recovery.img ]; then
		printf "recovery img is not exist, remove recovery cert from dragon_toc.cfg\n"
		sed -i '/recovery/d' dragon_toc.cfg > /dev/null
	else
		local recovery_buf=$(grep "recovery" -nr dragon_toc.cfg)
		if [ x"${recovery_buf}" = x"" ]; then
			readcfg dragon_toc.cfg key_para key > /dev/null
				if [ $? -ne 0 ]; then
					sed -i '/^onlykey=boot/a\onlykey=recovery,      recovery.fex,        SCPFirmwareContentCertPK' dragon_toc.cfg
				else
					sed -i '/^boot=/a recovery=NonTrustedFirmwareContentCertPK' dragon_toc.cfg
					sed -i '/^onlykey=boot/a\onlykey=recovery,     recovery.fex,        recovery.crtpt' dragon_toc.cfg
				fi
		fi
	fi

	if [ "x${PACK_VERITY}" = "x${FLAGS_TRUE}" ]; then
		# verity setup for squashfs type filesystem
		if [ x"${PACK_PLATFORM}" = x"openwrt" ] || [ x"${PACK_PLATFORM}" = x"bsp" ] || [ x"${PACK_PLATFORM}" = x"buildroot" ]; then
			rm -rf rootfs.fex
			local link_real_new=$(get_realpath ${LICHEE_PLAT_OUT} ./)

			if [ x"${PACK_PLATFORM}" = x"openwrt" ]; then
				cp ${link_real_new}/rootfs.img		rootfs.fex
			else
				cp ${link_real_new}/rootfs.squashfs	rootfs.fex
			fi

			if [ "x${PACK_KERN}" == "xlinux-5.4" \
					-o "x${PACK_KERN}" == "xlinux-5.4-ansc" \
					-o "x${PACK_KERN}" == "xlinux-5.10" \
					-o "x${PACK_KERN}" == "xlinux-5.10-origin" \
					-o "x${PACK_KERN}" == "xlinux-5.15" \
					-o "x${PACK_KERN}" == "xlinux-5.15-origin" ]; then

				squashfs_real_size=`hexdump -s 0x28 -n 4 -e '/4 "%d"' rootfs.fex`
				squashfs_data_blocks=`expr \( ${squashfs_real_size} + 4095 \) / 4096`

				local TEMP=${LC_ALL}
				export LC_ALL=C

				veritysetup --data-blocks=${squashfs_data_blocks} format rootfs.fex hash_tree > raw_table

				export LC_ALL=${TEMP}

				readcfg dragon_toc.cfg key_para key > /dev/null
				if [ $? -ne 0 ]; then
					sed -i '/^onlykey=boot/a\onlykey=rootfs,          hash_tree,        SCPFirmwareContentCertPK' dragon_toc.cfg
				else
					sed -i '/^boot=/a rootfs=NonTrustedFirmwareContentCertPK' dragon_toc.cfg
					sed -i '/^onlykey=boot/a\onlykey=rootfs,          hash_tree,        rootfs.crtpt' dragon_toc.cfg
				fi
			else
				# get sample from squashfs rootfs
				local rootfs_per_MB=`grep "^rootfs_per_MB=" env.cfg | awk -F = '{printf $2}'`
				if [ -z $rootfs_per_MB ]; then
					echo "rootfs_per_MB is not defined in env.cfg, use default value 4096"
					rootfs_per_MB=4096
				fi

				extract_squashfs $rootfs_per_MB rootfs.fex rootfs-extract.fex
				if [ $? -ne 0 ]; then
					echo "extract squashfs error"
					exit 1;
				fi

				readcfg dragon_toc.cfg key_para key > /dev/null
				if [ $? -ne 0 ]; then
					sed -i '/^onlykey=boot/a\onlykey=rootfs,          rootfs-extract.fex,        SCPFirmwareContentCertPK' dragon_toc.cfg
				else
					sed -i '/^boot=/a rootfs=NonTrustedFirmwareContentCertPK' dragon_toc.cfg
					sed -i '/^onlykey=boot/a\onlykey=rootfs,          rootfs-extract.fex,        rootfs.crtpt' dragon_toc.cfg
				fi
			fi
		else
			# generate verity data, suport more different filesystem in the future
			(dmverity_genHashTable rootfs.fex rootfsHashTree.fex rootfsHashTable.fex &&
			openssl dgst -sha256 -binary -sign $CFG_KEY_DIR/SCPFirmwareContentCertPK.pem rootfsHashTable.fex > rootfsHashSign.fex &&
			openssl rsa -in $CFG_KEY_DIR/SCPFirmwareContentCertPK.pem -pubout -out rootfsPubKey.pk &&
			dmverity_genDownloadFile rootfs.fex rootfsHashSign.fex rootfsHashTable.fex rootfsHashTree.fex VerityInfo.fex) ||
			{ pack_error "generate verity data failed"; exit 1; }

			# add partition for verity data
			(add_partition -2 rootfsverityInfo 4096 "VerityInfo.fex" &&
			maybe_busybox unix2dos sys_partition.fex &&
			script  sys_partition.fex > /dev/null) ||
			{ pack_error "add verity info part failed"; exit 1; }

			# add verity tools into ramdisk
			local rootfsPath=`readlink -f rootfs.fex`
			local keyPath=`readlink -f rootfsPubKey.pk`
			local blockSize=`dmverity_determ_blk_size ${rootfsPath}`
			dmverity_deal $blockSize rootfsverityInfo ext4 $keyPath ||
			{ pack_error "deal verity utils failed"; exit 1; }
		fi
	fi

	if [ "x${PACK_SIGNFEL}" = "x${FLAGS_TRUE}" ]; then
		do_signature_fel
	fi

	do_signature_ft

	do_signature_toc0

	#readcfg determines whether the cfg file is legacy or new
	readcfg dragon_toc.cfg key_para key > /dev/null
	if [ $? -ne 0 ]; then
		dragonsecboot -toc1 dragon_toc.cfg $CFG_KEY_DIR ${LICHEE_PACK_OUT_DIR}/cnf_base.cnf ${LICHEE_PACK_OUT_DIR}/version_base.mk
		if [ $? -ne 0 ]
		then
			pack_error "dragon toc1 run error"
			exit 1
		fi
		cert=".der"
	else
		do_signature_toc1
		cert=".crtpt"
	fi

	sigbootimg --image boot.fex --cert toc1/cert/boot${cert} --output boot_sig.fex
	if [ $? -ne 0 ] ; then
		pack_error "Pack cert to image error"
		exit 1
	else
		mv -f boot_sig.fex boot.fex
	fi

	do_signature_dsp

	do_signature_riscv

	if [ "x${PACK_VERITY}" = "x${FLAGS_TRUE}" ]; then
		if [ x"${PACK_PLATFORM}" = x"openwrt" ] || [ x"${PACK_PLATFORM}" = x"bsp" ] || [ x"${PACK_PLATFORM}" = x"buildroot" ]; then
			if [ "x${PACK_KERN}" == "xlinux-5.4" \
					-o "x${PACK_KERN}" == "xlinux-5.4-ansc" \
					-o "x${PACK_KERN}" == "xlinux-5.10" \
					-o "x${PACK_KERN}" == "xlinux-5.10-origin" \
					-o "x${PACK_KERN}" == "xlinux-5.15" \
					-o "x${PACK_KERN}" == "xlinux-5.15-origin" ]; then
				verity_root_hash_str=`grep "Root hash:" raw_table | awk '{print $3}'`
				verity_salt_str=`grep "Salt:" raw_table | awk '{print $2}'`

				update_squashfs_verity -f rootfs.fex -c toc1/cert/rootfs${cert} -t hash_tree -r ${verity_root_hash_str} -s ${verity_salt_str}
				if [ $? -ne 0 ]; then
					pack_error "add verity block error."
					exit 1
				fi
			else
				update_squashfs rootfs.fex toc1/cert/rootfs${cert}
				if [ $? -ne 0 ]
				then
					pack_error "signature squashfs rootfs error."
					exit 1
				fi
			fi
		fi
	fi

	local link_real=$(get_realpath ${LICHEE_PLAT_OUT} ./)
	local recovery_path=${link_real}/recovery.img

	if [ -f "$recovery_path" ]; then
		sigbootimg --image recovery.fex --cert toc1/cert/recovery${cert} --output recovery_sig.fex
		if [ $? -ne 0 ] ; then
			pack_error "Pack cert to image error"
			exit 1
		else
			mv -f recovery_sig.fex recovery.fex
		fi
	fi

	echo "secure signature ok!"
}

function do_android_signature()
{
	if [ "x$LINUX_DTBO_FILE" = "x" ]; then
		echo "do not set LINUX_DTBO_FILE"
		line_num=`sed -n -e "/default.dtbo/=" dragon_toc.cfg`
		if [ "x$line_num" != "x" ]; then
			sed -i "$line_num s/^/;/g" dragon_toc.cfg
		fi
	else
		if [ -f $LINUX_DTBO_FILE ]
		then
			sed -i "s/default.dtbo/$LINUX_DTBO_FILE/g" dragon_toc.cfg
		else
			line_num=`sed -n -e "/default.dtbo/=" dragon_toc.cfg`
			if [ "x$line_num" != "x" ]; then
				sed -i "$line_num s/^/;/g" dragon_toc.cfg
			fi
		fi
	fi

	if [ $? -ne 0 ]
	then
		pack_error "dragon toc config file is not exist"
		exit 1
	fi

	rm -f cardscript.fex
	mv cardscript_secure.fex cardscript.fex
	if [ $? -ne 0 ]
	then
		pack_error "dragon cardscript_secure.fex file is not exist"
		exit 1
	fi

	do_signature_ft

	do_signature_toc0

	#readcfg determines whether the cfg file is legacy or new
	readcfg dragon_toc.cfg key_para key > /dev/null
	if [ $? -ne 0 ]; then
		dragonsecboot -toc1 dragon_toc.cfg $CFG_KEY_DIR ${LICHEE_PACK_OUT_DIR}/cnf_base.cnf ${LICHEE_PACK_OUT_DIR}/version_base.mk
		if [ $? -ne 0 ]
		then
			pack_error "dragon toc1 run error"
			exit 1
		fi
		cert=".der"
	else
		do_signature_toc1
		cert=".crtpt"
	fi

	if [ -e dboot.fex ]; then
		local keyname=$(awk -F, '/^[[:space:]]*onlykey=boot\S*,[[:space:]]*dboot.fex,/{print $1}' dragon_toc.cfg  | awk -F= '{print $2}')
		sigbootimg --image dboot.fex --cert toc1/cert/${keyname}${cert} --output dboot_sig.fex
		[ $? -ne 0 ] && pack_error "Pack cert to image error" && exit 1
		mv -f dboot_sig.fex dboot.fex
	fi

	echo "secure android signature ok!"
}

################################ Tina func ################################
function get_partition_downfile_size()
{
    local downloadfile_name=`echo $1 | awk -F '=' '{print $2}'`
    if [ x${downloadfile_name: 0-4} != x".fex" ]; then
        pack_error "downloadfile format is wrong, it should be end with .fex"
        exit -1
    fi
    if [ ! -f ${downloadfile_name} ]; then
        echo "  file ${downloadfile_name} not find"
    else
        if [ -L ${downloadfile_name} ]; then
            local downloadfile_name_link=`readlink -f ${downloadfile_name}`
            local linkfile_name=${downloadfile_name_link##*/}
            echo "  ${downloadfile_name} -> ${downloadfile_name_link}"
            if [ ! -f ${downloadfile_name_link} ]; then
                echo "  link file ${linkfile_name} not find"
            else
                local linkfile_size=`ls -lh ${downloadfile_name_link} | awk '{print $5}'`
                echo "  ${linkfile_name} size : ${linkfile_size} byte"
            fi
        else
            local downloadfile_size=`ls -lh ${downloadfile_name} | awk '{print $5}'`
            echo "  ${downloadfile_name} size : ${downloadfile_size} byte"
        fi
    fi
}

function get_partition_mbr_size()
{
    local partition_size_name=`echo $1 | awk -F '=' '{print $1}' | sed 's/partition/mbr/g'`
    local partition_size=`echo $1 | awk -F '=' '{print $2}'`
    echo "  ${partition_size_name}  : ${partition_size} Kbyte"
}

function show_partition_message()
{
    grep -c '[mbr]' $1 > /dev/null
    if [ $? -eq 0 ]; then
        cp $1 ./show_sys_partition.tmp;
        sed -i '/^[\r;]/d' ./show_sys_partition.tmp;
        sed -i '/partition_start/d' ./show_sys_partition.tmp;
        sed -i '/user_type/d' ./show_sys_partition.tmp;
        sed -i 's/\[partition\]/------------------------------------/g' ./show_sys_partition.tmp;
        sed -i 's/[ "\r]//g' ./show_sys_partition.tmp;
        sed -i '/^[;]/d' ./show_sys_partition.tmp;
        sed -i 's/name/partition_name/g' ./show_sys_partition.tmp;
        sed -i 's/size/partition_size/g' ./show_sys_partition.tmp;
        echo "------------------------------------"
        while read line
        do
            if [ "$line" == "------------------------------------" ];then
                echo "$line"
            else
                echo "  $line" | sed 's/=/  : /g'
                echo "  $line" | grep "mbr" >> /dev/null
                if [ $? -eq 0 ]; then
                    read line
                    get_partition_mbr_size $line
                fi
                echo "$line" | grep "downloadfile" >> /dev/null
                if [ $? -eq 0 ]; then
                    get_partition_downfile_size $line
                fi
            fi
        done < ./show_sys_partition.tmp
        echo "------------------------------------"
        rm ./show_sys_partition.tmp
    else
        echo "==========input is not a partition file=========="
    fi
}

function sparse_ext4()
{
    local img=$1
    local sparse_img=$2

    if file $img | grep -q ext4 ;then
        echo "now make sparse ext4 img: $img"
    else
        echo "$img is not ext4 img"
        file $img
        return
    fi

    img2simg $img $sparse_img
}

# pack user resources to a vfat filesystem
# To use this, please add a folder "user-resource" in configs to save files, and add a partition to sys_partition.fex/sys_partition_nor.fex like this:
# [partition]
#   name         = user-res
#   size         = 1024	//size should be 32 aligned
#   downloadfile = "user-resource.fex"
#   user_type    = 0x8000
function make_user_res()
{
    printf "make user resource for : $1\n"
    local USER_RES_SYS_PARTITION=$1
    local USER_RES_PART_NAME=user-res
    local USER_RES_FILE=user-resource

    printf "handle partition ${USER_RES_PART_NAME}\n"
    local USER_RES_PART_DOWNLOAD_FILE=user-resource.fex
    local USER_RES_PART_SIZE=`sed -n "/${USER_RES_PART_NAME}/{N;p}" ${USER_RES_SYS_PARTITION} | awk '$0~"size"{print $3/2}'`
    local USER_RES_FILE_PATH=$CFG_TOP_DIR/${PACK_PLATFORM}/target/$PACK_IC/$PACK_IC-${PACK_BOARD}/configs/${USER_RES_FILE}

    if [ x"${USER_RES_PART_DOWNLOAD_FILE}" != x"" -a  x"${USER_RES_PART_SIZE}" != x"" ]; then
        rm -f ${LICHEE_PACK_OUT_DIR}/user-resource.fex
        mkfs.vfat ${LICHEE_PACK_OUT_DIR}/user-resource.fex -C ${USER_RES_PART_SIZE}
        if [ -d ${USER_RES_FILE_PATH} ]; then
            USER_RES_FILE_SIZE=`du --apparent-size --summarize "${USER_RES_FILE_PATH}" | awk '{print $1}'`
            printf "file size: ${USER_RES_FILE_SIZE}\n"
            printf "partition size: ${USER_RES_PART_SIZE}\n"
            if [ ${USER_RES_PART_SIZE} -le ${USER_RES_FILE_SIZE} ]; then
                printf "file size is larger than partition size, please check your configuration\n"
                printf "please enlarge size of ${USER_RES_PART_NAME} in sys_partition or remove some files in $USER_RES_FILE_PATH\n"
                exit -1
            fi
            mcopy -s -v -i ${LICHEE_PACK_OUT_DIR}/${USER_RES_PART_DOWNLOAD_FILE} ${USER_RES_FILE_PATH}/* ::
            if [ $? -ne 0 ]; then
                printf "mcopy file fail, exit\n"
                exit -1
            fi
        else
            printf "can not find ${USER_RES_FILE_PATH}, ignore it\n"
        fi
    else
        printf "no user resource partitions\n"
    fi
}

#[partition]
#    name         = app
#    size         = 10080
#    downloadfile = "app.fex"
#    user_type    = 0x8000
function make_app_res()
{
    local APP_PART_NAME=app
    cp $1 sys_partition_tmp_app.fex

    sed -i '/^[ \t]*downloadfile/d' sys_partition_tmp_app.fex
    maybe_busybox unix2dos sys_partition_tmp_app.fex
    script  sys_partition_tmp_app.fex > /dev/null
    update_mbr sys_partition_tmp_app.bin 1 sunxi_mbr_tmp_app.fex > /dev/null

    local APP_PART_DOWNLOAD_FILE=app.fex
    local APP_PART_FILE_PATH=$CFG_TOP_DIR/out/$PACK_IC/$PACK_BOARD/$PACK_PLATFORM/build_dir/target/app
    local APP_PART_SIZE_IN_SECTOR=`parser_mbr sunxi_mbr_tmp_app.fex get_size_by_name ${APP_PART_NAME}`
	local TINA_TOOLS_PATH=$CFG_TOP_DIR/out/$PACK_IC/$PACK_BOARD/$PACK_PLATFORM/staging_dir/host/bin

    if [ x${APP_PART_DOWNLOAD_FILE} != x'' -a  x${APP_PART_SIZE_IN_SECTOR} != x'' ]; then
        let APP_PART_SIZE_IN_K=$APP_PART_SIZE_IN_SECTOR/2
        echo "APP_PART_DOWNLOAD_FILE = ${LICHEE_PACK_OUT_DIR}/${APP_PART_DOWNLOAD_FILE}"
        rm -f ${LICHEE_PACK_OUT_DIR}/${APP_PART_DOWNLOAD_FILE}
        ${TINA_TOOLS_PATH}/make_ext4fs -l ${APP_PART_SIZE_IN_K}k -b 1024 -m 0 -j 1024 ${LICHEE_PACK_OUT_DIR}/${APP_PART_DOWNLOAD_FILE}  ${APP_PART_FILE_PATH}
    else
        printf "no app resource partitions\n"
    fi
}

#[partition]
#    name         = data
#    size         = 10080
#    downloadfile = "data.fex"
#    user_type    = 0x8000
function make_data_res()
{
    local DATA_PART_NAME=data
    cp $1 sys_partition_tmp_data.fex

    sed -i '/^[ \t]*downloadfile/d' sys_partition_tmp_data.fex
    maybe_busybox unix2dos sys_partition_tmp_data.fex
    script  sys_partition_tmp_data.fex > /dev/null
    update_mbr sys_partition_tmp_data.bin 1 sunxi_mbr_tmp_data.fex > /dev/null

    local DATA_PART_DOWNLOAD_FILE=data.fex
    local DATA_PART_DOWNLOAD_FILE_SPARSE=data_s.fex
    local DATA_PART_FILE_PATH=$CFG_TOP_DIR/out/$PACK_IC/$PACK_BOARD/$PACK_PLATFORM/build_dir/target/data
    local DATA_PART_SIZE_IN_SECTOR=`parser_mbr sunxi_mbr_tmp_data.fex get_size_by_name ${DATA_PART_NAME}`
	local TINA_TOOLS_PATH=$CFG_TOP_DIR/out/$PACK_IC/$PACK_BOARD/$PACK_PLATFORM/staging_dir/host/bin

    if [ x${DATA_PART_DOWNLOAD_FILE} != x'' -a  x${DATA_PART_SIZE_IN_SECTOR} != x'0' ]; then
        let DATA_PART_SIZE_IN_K=$DATA_PART_SIZE_IN_SECTOR/2
        echo "DATA_PART_DOWNLOAD_FILE = ${LICHEE_PACK_OUT_DIR}/${DATA_PART_DOWNLOAD_FILE}"
        rm -f ${LICHEE_PACK_OUT_DIR}/${DATA_PART_DOWNLOAD_FILE}
        rm -f ${LICHEE_PACK_OUT_DIR}/${DATA_PART_DOWNLOAD_FILE_SPARSE}
        ${TINA_TOOLS_PATH}/make_ext4fs -l ${DATA_PART_SIZE_IN_K}k -b 1024 -m 0 -j 1024 ${LICHEE_PACK_OUT_DIR}/${DATA_PART_DOWNLOAD_FILE}  ${DATA_PART_FILE_PATH}
        sparse_ext4 ${LICHEE_PACK_OUT_DIR}/${DATA_PART_DOWNLOAD_FILE} ${LICHEE_PACK_OUT_DIR}/${DATA_PART_DOWNLOAD_FILE_SPARSE}
    else
        printf "no data resource partitions\n"
    fi
}

################################ Platform func ################################
function do_pack_android()
{
	local localpath=$(readlink -f $(pwd))
	local androidout=$(readlink -f ${ANDROID_IMAGE_OUT})
	local link_real=$(get_realpath $androidout $localpath)

	printf "packing for android\n"

	if [ -z "${ANDROID_IMAGE_OUT}" ] ; then
		pack_error "please specify ANDROID_IMAGE_OUT env"
		exit 1
	fi

	local fex_list=($(\gawk '$0~"^[[:space:]]*downloadfile[[:space:]]*="{print $NF}' sys_partition.fex | sed 's/[",\r,\n]//g'))
	fex_list+=(vendor_boot-debug.fex)

	local img_name=""
	for fex_name in ${fex_list[@]}; do
		img_name=${fex_name%\.fex}.img
		if [ -f ${ANDROID_IMAGE_OUT}/${img_name} ]; then
			ln -sf ${link_real}/${img_name} ${fex_name}
			echo "link ${img_name} -> ${fex_name}"
		fi
	done

	if [ -e $androidout/vmlinux ]; then
		export PATH=$PATH:${LICHEE_TOP_DIR}/build/bin
		local vmlinuxpath=$(dirname $(readlink -f $androidout/vmlinux))
		local vmlinuxname=$(basename $(readlink -f $androidout/vmlinux))
		(cd $vmlinuxpath && tar cf $localpath/vmlinux.tar.bz2 --use-compress-prog=lbzip2 $vmlinuxname)
		rm -rf vmlinux.fex
		ln -sf vmlinux.tar.bz2 vmlinux.fex
	fi

	if [ -n "${PACK_BOOT_PATH}" ] && [ "x${PACK_BOOT_PATH}" != "xnone" ]; then
		ln -sf $PACK_BOOT_PATH boot.fex
	fi

	if [ "x${PACK_SECURE}" = "xsecure" ]; then
		echo "secure"
		do_android_signature
	else
		echo "normal"
	fi
}

function prepare_mixed_androiddragonboard()
{
	local mixed_fw_type

	if [ "${PACK_TYPE}" != "android" ] || [ -z "$PACK_MIXED_FIRMWARE" ]; then
		return 0
	fi

	case "$PACK_MIXED_FIRMWARE" in
		dragonboard|dragonabts)
			mixed_fw_type="$PACK_MIXED_FIRMWARE"
			pack_info "${FUNCNAME[0]}: mixed firmware type: $mixed_fw_type"
			;;
		*)
			echo "Unsupport mixed firmware type: $PACK_MIXED_FIRMWARE"
			return 1
	esac

	(
		cd ${LICHEE_PACK_OUT_DIR}

		local localpath=$(readlink -f $(pwd))
		local mixedboardout=$(readlink -f ${CFG_PLAT_OUT}/../$mixed_fw_type)
		if [ ! -d $mixedboardout ]; then
			pack_error "${FUNCNAME[0]}: cannot find out path for $mixed_fw_type"
			exit 1
		fi

		local envpath=($LICHEE_BOARD_CONFIG_DIR/$mixed_fw_type $LICHEE_CHIP_CONFIG_DIR/configs/default)
		local partition=(bootloader_b:boot-resource.fex env_b:denv.fex
					boot_b:dboot.fex vendor_boot_b:vendor_boot.fex media_data)

		local item name linenum nstart nend nmax file

		for item in ${partition[@]}; do
			name=${item/:*}
			linenum=$(sed -n "/^\s*name\s*=\s*$name/=" sys_partition.fex)
			if [ -z "$linenum" ]; then
				pack_error "${FUNCNAME[@]}: leak neccery partition $name in sys_partition.fex"
				exit 1
			fi
		done

		for item in ${envpath[@]}; do
			if [ -e $item/env.cfg ]; then
				cp $item/env.cfg denv.cfg
				sed -i '/^\s*boot_normal=/s/\<boot\>/boot_b/g' denv.cfg
				generate_env_for_uboot denv.cfg $mixedboardout/env.img
				rm -rf denv.cfg
				break
			fi
		done

		if  [ ! -e $mixedboardout/env.img  ] || \
			[ ! -e $mixedboardout/boot.img ] || \
			[ ! -e $mixedboardout/rootfs.ext4 ] || \
			[ ! -e $LICHEE_BOARD_CONFIG_DIR/$mixed_fw_type/test_config.fex ]; then
			pack_error "${FUNCNAME[@]}: leak neccery img/fex for $mixed_fw_type"
			exit 1
		fi

		printf "prepare for mixed android/$mixed_fw_type packing...\n"
		for item in ${partition[@]}; do
			name=${item/:*}
			linenum=$(sed -n "/^\s*name\s*=\s*$name/=" sys_partition.fex)
			nstart=$linenum
			nend=$linenum
			nmax=$(wc -l sys_partition.fex | awk '{print $1}')
			while [ $nstart -gt 1 ]; do
				nstart=$((nstart-1))
				if [ -n "$(sed -n "$nstart p" sys_partition.fex | grep "^\s*\[\S\+\]")" ]; then
					break;
				fi
			done

			while [ $nend -lt $nmax ]; do
				nend=$((nend+1))
				if [ -n "$(sed -n "$nend p" sys_partition.fex | grep "^\s*\[\S\+\]")" ]; then
					break;
				fi
			done
			[ $nend -ne $nmax ] && nend=$((nend-1))

			file="$(sed -n "${nstart},${nend}p" sys_partition.fex | \
					awk -F= '/^[[:space:]]*downloadfile[[:space:]]*=/{print $2}')"
			dlfile=${e#*:}
			case $name in
				bootloader_b|env_b|boot_b|vendor_boot_b)
					if [ -z "$file" ]; then
						sed -i "$linenum a\ \ \ \ downloadfile = \"${item#*:}\"" sys_partition.fex
					fi
					;;
				media_data)
					local cmd="$nstart i"
					local size=$(stat $mixedboardout/rootfs.ext4 --format="%s")

					size=$(((size+32*1024*1024-1)/(16*1024*1024)*16))  # at least size + 16M, and 16M align

					if [ -z "$(grep "^\s*name\s*=\s*rootfs" sys_partition.fex)" ]; then
						cmd+="[partition]\n"
						cmd+="    name         = rootfs\n"
						cmd+="    size         = ${size}M\n"
						cmd+="    downloadfile = \"drootfs.fex\"\n"
						cmd+="    user_type    = 0x8000\n"
						cmd+="\n"
					fi
					[ "$cmd" != "$nstart i" ] && sed -i "$cmd" sys_partition.fex
					;;
			esac
		done

		# Delete "^M" under Windows
		sed -i 's|
||g' sys_partition.fex

		readcfg dragon_toc.cfg key_para key > /dev/null
		if [ $? -ne 0 ]; then
			[ -z "$(grep "^\s*onlykey=boot_b,\s*dboot.fex," dragon_toc.cfg)" ] && \
			sed -i 's|^\(\s*onlykey=boot_b,\s*\)\S*,|\1dboot.fex,|g'    dragon_toc.cfg

			[ -z "$(grep "^\s*onlykey=boot_b,\s*dboot.fex," dragon_toc.cfg)" ] && \
			echo "onlykey=boot_b,dboot.fex,SCPFirmwareContentCertPK" >> dragon_toc.cfg
		else
			if [ -z "$(grep "^\s*onlykey=boot_b,\s*dboot.fex," dragon_toc.cfg)" ]; then
				sed -i '/^optee=/a boot_b=SCPFirmwareContentCertPK' dragon_toc.cfg
				sed -i '/^item=optee/a\onlykey=boot_b,dboot.fex,boot_b.crtpt' dragon_toc.cfg
			fi
		fi

		cp $LICHEE_BOARD_CONFIG_DIR/$mixed_fw_type/test_config.fex .
		maybe_busybox dos2unix test_config.fex
		cp test_config.fex boot-resource/
		script test_config.fex > /dev/null
		cp test_config.bin boot-resource/

		cp $mixedboardout/env.img denv.fex
		cp $mixedboardout/boot.img dboot.fex
		cp $mixedboardout/rootfs.ext4 drootfs.fex
		echo "android:$PACK_MIXED_FIRMWARE" > mixed-image-type.txt
	)
	if [ $? -ne 0 ]; then
		pack_error "${FUNCNAME[0]} fail"
		return 1
	fi
	return 0
}

function do_pack_dragonboard()
{
	local link_real=$(get_realpath ${LICHEE_PLAT_OUT} ./)
	printf "packing for dragonboard\n"

	ln -sf ${link_real}/boot.img boot.fex
	ln -sf ${link_real}/rootfs.ext4 rootfs.fex
	ln -sf ${link_real}/rootfs.ubifs rootfs-ubifs.fex

	if [ "x${PACK_SECURE}" = "xsecure" ]; then
		do_signature
	else
		echo "normal"
	fi
}

function do_pack_dragonabts()
{
	local link_real=$(get_realpath ${LICHEE_PLAT_OUT} ./)
	printf "packing for dragonabts\n"

	ln -sf ${link_real}/boot.img boot.fex
	ln -sf ${link_real}/rootfs.ext4 rootfs.fex
	ln -sf ${link_real}/rootfs.ubifs rootfs-ubifs.fex

	if [ "x${PACK_SECURE}" = "xsecure" ]; then
		do_signature
	else
		echo "normal"
	fi
}

function do_pack_linux()
{
	local link_real=$(get_realpath ${LICHEE_PLAT_OUT} ./)
	local recovery_path=${link_real}/recovery.img

	printf "packing for linux\n"

	do_fit_image
	if [ $? -eq 0 ]; then
		[ -f kernel.itb ] && mv kernel.itb   kernel.fex
		[ -f kernel-dtb.itb ] && mv kernel-dtb.itb   kernel-dtb.fex
	else
		[ -f ${link_real}/bootB.img ] && ln -sf ${link_real}/bootB.img bootB.fex
		ln -sf ${link_real}/boot.img        boot.fex

		# Those files is ready for SPINor.
		ln -sf ${link_real}/uImage          kernel.fex
		if [ x"${PACK_PLATFORM}" = x"openwrt" ]; then
			ln -sf ${link_real}/rootfs.img rootfs_nor.fex
		else
			ln -sf ${link_real}/rootfs.squashfs rootfs_nor.fex
		fi
	fi

	if [ x"${PACK_PLATFORM}" = x"openwrt" ]; then
		ln -sf ${link_real}/rootfs.img     rootfs.fex
	else
		ln -sf ${link_real}/rootfs.ext4     rootfs.fex
	fi

	ln -sf ${link_real}/rootfs.ubifs     rootfs-ubifs.fex

	if [ -f "$recovery_path" ]; then
		ln -sf ${recovery_path}     recovery.fex
	fi

	if [ "x${PACK_SECURE}" = "xsecure" ]; then
		echo "secure"
		do_signature
	else
		echo "normal"
	fi
}

function create_kernel_fit_image()
{
	local its_name=$1

	printf "create_kernel_fit_image\n"

	if [ ! -f ${LICHEE_PACK_OUT_DIR}/${its_name}.its ]; then
		printf "can not found ${its_name}.its\n"
		return 1
	fi

	mkimage -f ${its_name}.its ${its_name}.itb
	if [ $? -ne 0 ]; then
		pack_error "mkimage ${its_name}.itb error\n"
		exit 1
	fi
}

function do_fit_image()
{
	printf "do_fit_image\n"

	create_kernel_fit_image kernel
	if [ $? -ne 0 ]; then
		return 1
	fi

	create_kernel_fit_image kernel-dtb
	if [ $? -ne 0 ]; then
		return 1
	fi
}

function main()
{
	local output_resources=${FLAGS_output_resources:-false}
	local from_resources=${FLAGS_from_resources}

	local support_secure_type
	case x$LICHEE_PACK_SECURE_TYPE in
		xnone|xsecure|xany)
			support_secure_type=$LICHEE_PACK_SECURE_TYPE
			;;
		x)
			support_secure_type=any
			;;
		*)
			pack_error "Unsupport pack secure type: $LICHEE_PACK_SECURE_TYPE"
			return 1
			;;
	esac

	if [ "$support_secure_type" != "any" ] && [ "$support_secure_type" != "$PACK_SECURE" ]; then
		pack_error "This platform only support secure type [$support_secure_type], but current using [$PACK_SECURE], please check!!!"
		pack_error "Now, we try using secure type [$support_secure_type]!!!"
		PACK_SECURE=$support_secure_type
	fi

	if [ "$output_resources" == "false" ] && [ -z "$from_resources" ]; then
		do_prepare
		do_ini_to_dts
		do_common
		do_pack_${PACK_TYPE}
		do_finish
		return $?
	fi

	if [ "$output_resources" == "true" ]; then
		do_prepare
		do_ini_to_dts
	elif [ -n "$from_resources" ]; then
		if [ ! -d $from_resources ]; then
			pack_error "Cannot find resources path: $from_resources"
			return 1
		fi

		local count=0
		while [ -e ${LICHEE_PACK_OUT_DIR} -a  $count -lt 20 ]; do
			rm -rf ${LICHEE_PACK_OUT_DIR}
			count=$((count+1))
		done
		cp -rax $from_resources ${LICHEE_PACK_OUT_DIR}
		(
			cd $LICHEE_OUT_DIR
			if [ "${LICHEE_PACK_OUT_DIR}" != "$LICHEE_OUT_DIR/pack_out" ]; then
				rm -rf pack_out
				ln -sf ${LICHEE_IC}/${LICHEE_BOARD}/pack_out pack_out
			fi
		)

		if [ "${PACK_PLATFORM}" == "android" ] && [ -n "$PACK_MIXED_FIRMWARE" ]; then
			local resource_type="$(cat ${LICHEE_PACK_OUT_DIR}/mixed-image-type.txt)"
			local mixed_fw_type="android:$PACK_MIXED_FIRMWARE"
			if [ "$resource_type" != "android:$PACK_MIXED_FIRMWARE" ]; then
				pack_error "mixed firmware type [$mixed_fw_type] but resource type [$resource_type]"
				exit 1
			fi
			pack_info "mixed firmware type [$mixed_fw_type]"
		fi

		cd ${LICHEE_PACK_OUT_DIR}
		do_common
		do_pack_${PACK_TYPE}
		do_finish
	fi
	return $?
}

main "$@"

#114 Re: 全志 SOC » 九鼎创展 A733 开发板使用记录 » 2025-06-01 10:03:10

使用这个 img工具 解包之后,用beyondcompare比较,发现boot0*.fex 有差异

#115 Re: 全志 SOC » 九鼎创展 A733 开发板使用记录 » 2025-06-01 09:36:47

删除 longan/out/ 目录,重新编译 longan,然而,还是一样的问题

#116 Re: 全志 SOC » 九鼎创展 A733 开发板使用记录 » 2025-05-31 21:32:07

找到一个相关的问题,但是我的这个和命令长度没有关系:

【FAQ3027】 SDK所在目录路径过长引发固件异常无法启动.pdf

1.主题
SDK所在目录路径过长引发固件异常无法启动

2.问题背景
有客户反馈,sdk按如下目录放置,编译出的固件烧写后无法启动,错误如下:

/ibm/ExdroidData/workspace/mynewroot/jenkins/code/dailybuild/androidv/platform/android14

[2024-07-07 01:11:06.834698] [387]phy_dfs_clk3 = 150M
[2024-07-07 01:11:06.837708] [390]phy_dfs_clk0 = 1200M
[2024-07-07 01:11:06.841707] [392]DRAM MDFS VERSION INFO: V0.660
[2024-07-07 01:11:06.844748] [396]DRAM MDFS time =38136 ns
[2024-07-07 01:11:06.851745] [399]DRAM SIZE =4096 MBytes, para1 = 310a, para2 = 10001000, tpr13 = 6065
[2024-07-07 01:11:06.855749] [407]DRAM simple test OK.
[2024-07-07 01:11:06.857749] [410]dram size =4096
[2024-07-07 01:11:06.859749] [412]nsi init 2023-2-23
[2024-07-07 01:11:06.911773] [462]read toc1 from emmc 32800 sector
[2024-07-07 01:11:06.915730] [467]don't have rotpk, skip check
[2024-07-07 01:11:06.917719] [470]OLD version: 0.0
[2024-07-07 01:11:06.919729] [472]NEW version: 0.0
[2024-07-07 01:11:07.031703] [583]monitor entry=0x48000000
[2024-07-07 01:11:07.033702] [585]uboot entry=0x4a000000
[2024-07-07 01:11:07.036642] [588]optee entry=0x48600000
[2024-07-07 01:11:07.038641] [591]opensbi entry=0x0
[2024-07-07 01:11:07.040638] [593]no need rotpk flag
[2024-07-07 01:11:07.044622] [595]tunning data addr:0x4a0003e8
[2024-07-07 01:11:07.049625] [599]sec_mem_map[0]: addr = 0x48000000, size = 0x100000
[2024-07-07 01:11:07.055622] [604]sec_mem_map[1]: addr = 0x48600000, size = 0x100000
[2024-07-07 01:11:07.057653] [610]run out of boot0
[2024-07-07 01:11:07.067667] NOTICE:  BL31: v2.5(debug):55b180a27
[2024-07-07 01:11:07.071665] NOTICE:  BL31: Built : 11:09:52, Sep 18 2023
[2024-07-07 01:11:07.074610] NOTICE:  hardware check error1
[2024-07-07 01:11:07.077657] BACKTRACE: START: bl31_platform_setup
[2024-07-07 01:11:07.079655] 0: EL3: 0x480038a4
[2024-07-07 01:11:07.081653] 1: EL3: 0x48003b40
[2024-07-07 01:11:07.083616] 2: EL3: 0x48003a94
[2024-07-07 01:11:07.085619] 3: EL3: 0x480001e0
[2024-07-07 01:11:07.088622] BACKTRACE: END: bl31_platform_setup
[2024-07-07 01:11:07.089654] PANIC in EL3.
[2024-07-07 01:11:07.093608] x30            = 0x0000000048003b4c
[2024-07-07 01:11:07.096654] x0             = 0x0000000002500000
[2024-07-07 01:11:07.100609] x1             = 0x0000000000000060
[2024-07-07 01:11:07.103654] x2             = 0x0000000000000060
[2024-07-07 01:11:07.106609] x3             = 0x00000000ffffffc8
[2024-07-07 01:11:07.110608] x4             = 0x0000000000000034
[2024-07-07 01:11:07.113667] x5             = 0x0000000000000034
[2024-07-07 01:11:07.116619] x6             = 0x0000000000000004
[2024-07-07 01:11:07.120606] x7             = 0x0000000000000000
[2024-07-07 01:11:07.123654] x8             = 0x000000023fffffff
[2024-07-07 01:11:07.126603] x9             = 0x0000000048600000
[2024-07-07 01:11:07.130611] x10            = 0x0000000000000000
[2024-07-07 01:11:07.133654] x11            = 0x0000000000100000
[2024-07-07 01:11:07.137665] x12            = 0x0000000000000018
[2024-07-07 01:11:07.140618] x13            = 0x0000000000000000
[2024-07-07 01:11:07.143658] x14            = 0x0000000000000000
[2024-07-07 01:11:07.147657] x15            = 0x0000000000000000
[2024-07-07 01:11:07.150611] x16            = 0x0000000000000000
[2024-07-07 01:11:07.153651] x17            = 0x0000000000045400
[2024-07-07 01:11:07.157653] x18            = 0x0000000000000020
[2024-07-07 01:11:07.168273] x19            = 0x000000004800e3f6
[2024-07-07 01:11:07.168345] x20            = 0x0000000000000000
[2024-07-07 01:11:07.168360] x21            = 0x0000000000001890
[2024-07-07 01:11:07.170569] x22            = 0x0000000000000000
[2024-07-07 01:11:07.173624] x23            = 0x0000000000000000
[2024-07-07 01:11:07.177663] x24            = 0x0000000000000000
[2024-07-07 01:11:07.180668] x25            = 0x0000000000000000
[2024-07-07 01:11:07.184671] x26            = 0x0000000000000000
[2024-07-07 01:11:07.187621] x27            = 0x0000000000000000
[2024-07-07 01:11:07.190672] x28            = 0x0000000000000000
[2024-07-07 01:11:07.194658] x29            = 0x00000000480112c0
[2024-07-07 01:11:07.197625] scr_el3        = 0x0000000000000238
[2024-07-07 01:11:07.200677] sctlr_el3      = 0x0000000030cd183f
[2024-07-07 01:11:07.204676] cptr_el3       = 0x0000000000000000
[2024-07-07 01:11:07.207626] tcr_el3        = 0x000000008081351e
[2024-07-07 01:11:07.211638] daif           = 0x00000000000002c0
[2024-07-07 01:11:07.214678] mair_el3       = 0x00000000004404ff
[2024-07-07 01:11:07.217635] spsr_el3       = 0x00000000000001cd
[2024-07-07 01:11:07.221632] elr_el3        = 0x0000000000012ea4
[2024-07-07 01:11:07.224661] ttbr0_el3      = 0x000000004803e381
[2024-07-07 01:11:07.227617] esr_el3        = 0x00000000b2050b37
[2024-07-07 01:11:07.231620] far_el3        = 0x5ad7c3dbfffe3ff9
[2024-07-07 01:11:07.234664] spsr_el1       = 0x00000000000001cd
[2024-07-07 01:11:07.238658] elr_el1        = 0x0000000000000000
[2024-07-07 01:11:07.241683] spsr_abt       = 0x00000000f01f28b9
[2024-07-07 01:11:07.244659] spsr_und       = 0x00000000f0478217
[2024-07-07 01:11:07.248612] spsr_irq       = 0x00000000f00b8ebd
[2024-07-07 01:11:07.251658] spsr_fiq       = 0x00000000f40f6460
[2024-07-07 01:11:07.254613] sctlr_el1      = 0x0000000000c50838
[2024-07-07 01:11:07.258618] actlr_el1      = 0x0000000000000000
[2024-07-07 01:11:07.261660] cpacr_el1      = 0x0000000000000000
[2024-07-07 01:11:07.265661] csselr_el1     = 0x0000000000000000
[2024-07-07 01:11:07.268613] sp_el1         = 0x0000000000000000
[2024-07-07 01:11:07.271659] esr_el1        = 0x00000000b4897f9c
[2024-07-07 01:11:07.274616] ttbr0_el1      = 0x0000f63708ac0ce2
[2024-07-07 01:11:07.278663] ttbr1_el1      = 0x00000bfc5c0958d0
[2024-07-07 01:11:07.281624] mair_el1       = 0x44e048e000098aa4
[2024-07-07 01:11:07.285628] amair_el1      = 0x0000000000000000
[2024-07-07 01:11:07.288657] tcr_el1        = 0x0000000000000000
[2024-07-07 01:11:07.291610] tpidr_el1      = 0x3a0c50eb9150e67b
[2024-07-07 01:11:07.295614] tpidr_el0      = 0xdc178f81ebf9d7ff
[2024-07-07 01:11:07.298664] tpidrro_el0    = 0xfb10d70cdeff6571
[2024-07-07 01:11:07.301621] par_el1        = 0xff00000048000980
[2024-07-07 01:11:07.305628] mpidr_el1      = 0x0000000081000000
[2024-07-07 01:11:07.308625] afsr0_el1      = 0x0000000000000000
[2024-07-07 01:11:07.312624] afsr1_el1      = 0x0000000000000000
[2024-07-07 01:11:07.315625] contextidr_el1 = 0x0000000000000000
[2024-07-07 01:11:07.318667] vbar_el1       = 0x0000000000000000
[2024-07-07 01:11:07.322622] cntp_ctl_el0   = 0x0000000000000000
[2024-07-07 01:11:07.325666] cntp_cval_el0  = 0xff5f39fefd2bd7ce
[2024-07-07 01:11:07.328614] cntv_ctl_el0   = 0x0000000000000000
[2024-07-07 01:11:07.332623] cntv_cval_el0  = 0xd7f5971ac72c673d
[2024-07-07 01:11:07.335660] cntkctl_el1    = 0x0000000000000000
[2024-07-07 01:11:07.338663] sp_el0         = 0x00000000480112c0
[2024-07-07 01:11:07.342662] isr_el1        = 0x0000000000000000
[2024-07-07 01:11:07.345612] dacr32_el2     = 0x0000000000000000
[2024-07-07 01:11:07.348657] ifsr32_el2     = 0x0000000000000217
[2024-07-07 01:11:07.352666] cpuectlr_el1   = 0x000000002808bc00
[2024-07-07 01:11:07.355622] icc_hppir0_el1 = 0x00000000000003ff
[2024-07-07 01:11:07.359625] icc_hppir1_el1 = 0x00000000000003ff
[2024-07-07 01:11:07.362686] icc_ctlr_el3   = 0x0000000000028400
[2024-07-07 01:11:07.366678] gicd_ispendr regs (Offsets 0x200-0x278)
[2024-07-07 01:11:07.367626] Offset			Value
[2024-07-07 01:11:07.370673] 0x200:		 0x0000000000000000
[2024-07-07 01:11:07.373673] 0x208:		 0x0000000000000000
[2024-07-07 01:11:07.375675] 0x210:		 0x0000000000000000
[2024-07-07 01:11:07.378592] 0x218:		 0x0000000000000000
[2024-07-07 01:11:07.380634] 0x220:		 0x0000000000000000
[2024-07-07 01:11:07.383664] 0x228:		 0x0000000000000000
[2024-07-07 01:11:07.386613] 0x230:		 0x0000000000000000
[2024-07-07 01:11:07.388617] 0x238:		 0x0000000000000000
[2024-07-07 01:11:07.391612] 0x240:		 0x0000000000000000
[2024-07-07 01:11:07.394648] 0x248:		 0x0000000000000000
[2024-07-07 01:11:07.396647] 0x250:		 0x0000000000000000
[2024-07-07 01:11:07.399601] 0x258:		 0x0000000000000000
[2024-07-07 01:11:07.401601] 0x260:		 0x0000000000000000
[2024-07-07 01:11:07.404653] 0x268:		 0x0000000000000000
[2024-07-07 01:11:07.407609] 0x270:		 0x0000000000000000
[2024-07-07 01:11:07.409613] 0x278:		 0x0000000000000000

3.原因分析
当前编译工具对路径长度有要求。如果longan所在的路径过长,会引起编译时image异常。当前所支持的bsp的绝对路径长度为83个字符,如android sdk,则为包含longan目录时的长度,如:

/ibm/ExdroidData/workspace/mynewroot/jenkins/code/dailybuild/androidv/platform/android14/longan
长度以及超过83字符限制。

4.解决措施
缩短sdk所在目录长度。

#117 Re: 全志 SOC » 九鼎创展 A733 开发板使用记录 » 2025-05-31 21:24:40

烧录自己编译的固件,出现:

......

[225]HELLO! BOOT0 is starting!
[228]BOOT0 commit : {cfda5fbe}
[237]volume key pressed!
[240][mmc]: mmc driver ver 2024-03-20 10:36
[250][mmc]: Wrong media type 0x0, but host sdc2, try mmc first
[256][mmc]: ***Try MMC card 2***
[278][mmc]: RMCA OK!
[284][mmc]: MMC 5.1
[286][mmc]: HSSDR52/SDR25 8 bit
[289][mmc]: 50000000 Hz
[292][mmc]: 29880 MB
[294][mmc]: ***SD/MMC 2 init OK!!!***
[299]DRAM BOOT DRIVE INFO: V0.599
[304]DRAM_VCC set to 560 mv
[307]DRAM CLK =1800 MHZ
[309]DRAM Type =9 (8:LPDDR4,9:LPDDR5)
[435]Training result is = 7
[438]DRAM Pstate 0 training, frequency is 1800 Mhz
[447]Actual DRAM SIZE =6144 M
[449]DRAM SIZE =6144 MBytes, para1 = a10a, para2 = 18001001, dram_tpr13 = 10061
[464]DRAM simple test OK.
[505]error: dtb not found for scp
[510]tunning data addr:0x4a0003e8
[513]Jump to ATF: monitor_base = 0x48000000, uboot_base = 0x4a000000, optee_base = 0x0
NOTICE:  BL31: OP-TEE 32bit detected
NOTICE:  BL31: U-BOOT 32bit detected
NOTICE:  BL31: v2.5(debug):eec78cd3c
NOTICE:  BL31: Built : 14:02:13, Oct 29 2024
NOTICE:  hardware check error1
BACKTRACE: START: bl31_platform_setup
0: EL3: 0x48003c9c
1: EL3: 0x4800407c
2: EL3: 0x48003f78
3: EL3: 0x480001f0
BACKTRACE: END: bl31_platform_setup
PANIC in EL3.
x30            = 0x0000000048004088
x0             = 0x0000000002500000
x1             = 0x0000000000000060
x2             = 0x0000000000000060
x3             = 0x00000000ffffffc8
x4             = 0x0000000000000034
x5             = 0x0000000000000034
x6             = 0x0000000000000004
x7             = 0x0000000000000000
x8             = 0x000000023fffffff
x9             = 0x0000000048013000
x10            = 0x0000000000000000
x11            = 0x0000000000000000
x12            = 0x0000000000000010
x13            = 0x0000000000000000
x14            = 0x0000000000000000
x15            = 0x0000000000000000
x16            = 0x0000000000000000
x17            = 0x0000000000048c00
x18            = 0x0000000000000020
x19            = 0x000000004800f4b4
x20            = 0x0000000000000000
x21            = 0x0000000000001903
x22            = 0x0000000000000000
x23            = 0x0000000000000000
x24            = 0x0000000000000000
x25            = 0x0000000000000000
x26            = 0x0000000000000000
x27            = 0x0000000000000000
x28            = 0x0000000000000000
x29            = 0x0000000048014280
scr_el3        = 0x0000000000000238
sctlr_el3      = 0x0000000030cd183f
cptr_el3       = 0x0000000000000000
tcr_el3        = 0x000000008081351e
daif           = 0x00000000000002c0
mair_el3       = 0x00000000004404ff
spsr_el3       = 0x00000000000001cd
elr_el3        = 0x0000000000000000
ttbr0_el3      = 0x0000000048041001
esr_el3        = 0x0000000000000000
far_el3        = 0x0000000000000000
spsr_el1       = 0x00000000000001cd
elr_el1        = 0x0000000000000000
spsr_abt       = 0x00000000400bfc0e
spsr_und       = 0x00000000f08378cd
spsr_irq       = 0x0000000034037e06
spsr_fiq       = 0x0000000030077c14
sctlr_el1      = 0x0000000000c50838
actlr_el1      = 0x0000000000000000
cpacr_el1      = 0x0000000000000000
csselr_el1     = 0x0000000000000000
sp_el1         = 0x0000000000000000
esr_el1        = 0x00000000000c0000
ttbr0_el1      = 0x000000003a3f7f7c
ttbr1_el1      = 0x000000080c7f7f7c
mair_el1       = 0x44e048e000098aa4
amair_el1      = 0x0000000000000000
tcr_el1        = 0x0000000000000000
tpidr_el1      = 0x7f3fff00fdff7f00
tpidr_el0      = 0x7f007f8000ff0800
tpidrro_el0    = 0x00000000ff0c0080
par_el1        = 0xff00000048000980
mpidr_el1      = 0x0000000081000000
afsr0_el1      = 0x0000000000000000
afsr1_el1      = 0x0000000000000000
contextidr_el1 = 0x0000000000000000
vbar_el1       = 0x0000000000000000
cntp_ctl_el0   = 0x0000000000000000
cntp_cval_el0  = 0xf6de00005fffeeee
cntv_ctl_el0   = 0x0000000000000000
cntv_cval_el0  = 0xffde00005fffffef
cntkctl_el1    = 0x0000000000000000
sp_el0         = 0x0000000048014280
isr_el1        = 0x0000000000000000
cpuectlr_el1   = 0x000000002808bc00
icc_hppir0_el1 = 0x00000000000003ff
icc_hppir1_el1 = 0x00000000000003ff
icc_ctlr_el3   = 0x0000000000028400
gicd_ispendr regs (Offsets 0x200-0x278)
Offset                  Value
0x200:           0x0000000000000000
0x208:           0x0000000000000000
0x210:           0x0000000000000000
0x218:           0x0000000000000000
0x220:           0x0000000000000000
0x228:           0x0000000000000000
0x230:           0x0000000000000000
0x238:           0x0000000000000000
0x240:           0x0000000000000000
0x248:           0x0000000000000000
0x250:           0x0000000000000000
0x258:           0x0000000000000000
0x260:           0x0000000000000000
0x268:           0x0000000000000000
0x270:           0x0000000000000000
0x278:           0x0000000000000000

不勾选任何选项刷出厂固件,可以正常启动。

#120 Re: 全志 SOC » 九鼎创展 A733 开发板使用记录 » 2025-05-31 21:21:43

出厂固件的开机日志:

[11677]Training result is = 7
[11680]DRAM Pstate 0 training, frequency is 1800 Mhz
[11688]Actual DRAM SIZE =6144 M
[11691]DRAM SIZE =6144 MBytes, para1 = a10a, para2 = 18001001, dram_tpr13 = 10061
[11701]DRAM simple test OK.
[11704]rtc[3] value = 0xb00f
[11707]rtc[7] value = 0x2
[11709]init dram ok

U-Boot 2018.07 (Mar 31 2025 - 06:54:43 +0000) Allwinner Technology

[13.838]CPU:   Allwinner Family
[13.841]Model: sun60iw2
I2C:   ready
[13.901]DRAM:  512 MiB
[13.906]Relocation Offset is: 15dac000
[13.956]sunxi_drm_dsi_post_bind:706
[13.960]secure enable bit: 0
[13.963]PMU: AXP8191
[13.965]PMU: AXP8191 VER_A
[13.967]PMU: pmu_axp8191 found
FDT ERROR:fdt_get_regulator_name:get property handle twi-supply error:FDT_ERR_INTERNAL
[13.979]gpio_bias, pc_bias:   -1, pc_supply: not set
[13.984]gpio_bias, pl_bias:   -1, pl_supply: not set
[13.989]BMU: no found
[13.991][AXP8191] onoff status: 0x50 = 0x0, 0x51 = 0x0
[13.996][AXP8191] charge status: 0x4 = 0x0
[14.000]CPU=1014 MHz,PLL6=1200 Mhz,AHB=200 Mhz, APB1=24Mhz  MBus=600Mhz
[14.006]gic: normal mode
[14.008]sunxi flash type@0 not support fast burn key
[14.013]sunxi flash map init
[14.018]init_clocks:finish
[14.020]flash init start
[14.022]workmode = 16,storage type = 0
try card 2
set card number 2
get card number 2
[14.030][mmc]: mmc driver ver uboot2018:2024-10-18 9:01:00
[14.039][mmc]: Is not Boot mode!
[14.041][mmc]: SUNXI SDMMC Controller Version:0x50610
[14.049][mmc]: 200 MHz...
[14.051][mmc]: sample: 23 - 108(ps)
[14.054][mmc]: ds: 23 - 108(ps)
[14.061][mmc]: ************Try SD card 2************
[14.066][mmc]: mmc 2 cmd timeout 100 status 100
[14.070][mmc]: smc 2 err, cmd 8,  RTO
[14.074][mmc]: mmc 2 close bus gating and reset
[14.079][mmc]: mmc 2 cmd timeout 100 status 100
[14.083][mmc]: smc 2 err, cmd 55,  RTO
[14.086][mmc]: mmc 2 close bus gating and reset
[14.090][mmc]: ************Try MMC card 2************
[14.199][mmc]: mmc 2 cmd timeout 100 status 100
[14.203][mmc]: smc 2 err, cmd 8,  RTO
[14.206][mmc]: mmc 2 close bus gating and reset
[14.211][mmc]: mmc 2 cmd timeout 100 status 100
[14.215][mmc]: smc 2 err, cmd 55,  RTO
[14.219][mmc]: mmc 2 close bus gating and reset
[14.234][mmc]: gen_tuning_blk_bus8: total blk 10
[14.239][mmc]: gen_tuning_blk_bus4: total blk 6
[14.243][mmc]: Using 8 bit tuning now
[14.278][mmc]: write_tuning_try_freq: write ok
[14.283][mmc]: Pattern compare ok
[14.286][mmc]: Write tuning pattern ok
[14.289][mmc]: ================== HSSDR52_SDR25...
[14.294][mmc]: skip freq 400000
[14.297][mmc]: skip freq 25000000
[14.300][mmc]: freq: 2-50000000-64-4
[15.069][mmc]: [0-63|64]
[15.071][mmc]: ================== HS200_SDR104...
[15.076][mmc]: skip freq 400000
[15.078][mmc]: skip freq 25000000
[15.081][mmc]: freq: 2-50000000-64-4
[15.840][mmc]: freq: 3-100000000-64-4
[16.539][mmc]: freq: 4-150000000-64-4
[17.157][mmc]: freq: 5-200000000-64-4
[17.756][mmc]: [0-62|63]
[17.759][mmc]: [0-62|63]
[17.761][mmc]: [0-0|1] [7-62|56]
[17.764][mmc]: [0-15|16] [23-61|39]
[17.767][mmc]: ================== HSDDR52_DDR50...
[17.772][mmc]: skip freq 400000
[17.775][mmc]: freq: 1-25000000-64-4
[18.503][mmc]: freq: 2-50000000-64-4
[19.149][mmc]: [0-59|60]
[19.151][mmc]: [0-44|45] [47-59|13]
[19.154][mmc]: ================== HS400...
[19.158][mmc]: skip freq 400000
[19.161][mmc]: skip freq 25000000
[19.164][mmc]: freq: 2-50000000
[19.189][mmc]: freq: 3-100000000
[19.213][mmc]: freq: 4-150000000
[19.235][mmc]: freq: 5-200000000
[19.257][mmc]: speed mode: HS400
[19.260][mmc]: [0-63|64]
[19.262][mmc]: [0-63|64]
[19.265][mmc]: [0-3|4] [7-63|57]
[19.268][mmc]: [0-20|21] [23-63|41]
[19.271][mmc]: skip freq 400000
[19.274][mmc]: skip freq 25000000
[19.277][mmc]: freq: 2-50000000-64-4
[19.963][mmc]: freq: 3-100000000-64-4
[20.400][mmc]: freq: 4-150000000-64-4
[20.679][mmc]: freq: 5-200000000-64-4
[20.888][mmc]: [2-63|62]
[20.890][mmc]: [2-41|40]
[20.892][mmc]: [2-26|25]
[20.895][mmc]: *** hs400 200m: data win=10, delay cell = 108 ***
[20.900][mmc]: [2-19|18]
[20.903][mmc]: DS26/SDR12: 0xffffffff 0xffffffff
[20.907][mmc]: HSSDR52/SDR25: 0xff20ffff 0xffffffff
[20.912][mmc]: HSDDR52/DDR50: 0xff161eff 0xffffffff
[20.916][mmc]: HS200/SDR104: 0x1f1fffff 0xffff2a23
[20.921][mmc]: HS400: 0x1621ffff 0xffff0b0e
[20.925][mmc]: HS400: 0x2020ffff 0xffff2b23
[20.929][mmc]: Best spd md: 4-HS400, freq: 5-200000000, Bus width: 8
[20.935]Loading Environment from SUNXI_FLASH... OK
[20.940]try to burn key
[20.942]out of usb burn from boot: not boot mode
Hit any key to stop autoboot:  0
sunxi work mode=0x10
run usb efex
buf queue page size = 65536
delay time 2500
usb init ok
set address 0xe
set address 0xe ok
set address 0xf
set address 0xf ok
SUNXI_EFEX_ERASE_TAG
erase_flag = 0x12
origin_erase_flag = 0x1
FEX_CMD_fes_verify_status
FEX_CMD_fes_verify last err=0
the 0 mbr table is ok
the 1 mbr table is ok
the 2 mbr table is ok
the 3 mbr table is ok
*************MBR DUMP***************
total mbr part 29

part[0] name      :bootloader_a
part[0] classname :DISK
part[0] addrlo    :0x8000
part[0] lenlo     :0x10000
part[0] user_type :32768
part[0] keydata   :0
part[0] ro        :0

part[1] name      :bootloader_b
part[1] classname :DISK
part[1] addrlo    :0x18000
part[1] lenlo     :0x10000
part[1] user_type :32768
part[1] keydata   :0
part[1] ro        :0

part[2] name      :env_a
part[2] classname :DISK
part[2] addrlo    :0x28000
part[2] lenlo     :0x200
part[2] user_type :32768
part[2] keydata   :0
part[2] ro        :0

part[3] name      :env_b
part[3] classname :DISK
part[3] addrlo    :0x28200
part[3] lenlo     :0x200
part[3] user_type :32768
part[3] keydata   :0
part[3] ro        :0

part[4] name      :boot_a
part[4] classname :DISK
part[4] addrlo    :0x28400
part[4] lenlo     :0x20000
part[4] user_type :32768
part[4] keydata   :0
part[4] ro        :0

part[5] name      :boot_b
part[5] classname :DISK
part[5] addrlo    :0x48400
part[5] lenlo     :0x20000
part[5] user_type :32768
part[5] keydata   :0
part[5] ro        :0

part[6] name      :vendor_boot_a
part[6] classname :DISK
part[6] addrlo    :0x68400
part[6] lenlo     :0x10000
part[6] user_type :32768
part[6] keydata   :0
part[6] ro        :0

part[7] name      :vendor_boot_b
part[7] classname :DISK
part[7] addrlo    :0x78400
part[7] lenlo     :0x10000
part[7] user_type :32768
part[7] keydata   :0
part[7] ro        :0

part[8] name      :init_boot_a
part[8] classname :DISK
part[8] addrlo    :0x88400
part[8] lenlo     :0x4000
part[8] user_type :32768
part[8] keydata   :0
part[8] ro        :0

part[9] name      :init_boot_b
part[9] classname :DISK
part[9] addrlo    :0x8c400
part[9] lenlo     :0x4000
part[9] user_type :32768
part[9] keydata   :0
part[9] ro        :0

part[10] name      :super
part[10] classname :DISK
part[10] addrlo    :0x90400
part[10] lenlo     :0x700000
part[10] user_type :32768
part[10] keydata   :0
part[10] ro        :0

part[11] name      :misc
part[11] classname :DISK
part[11] addrlo    :0x790400
part[11] lenlo     :0x8000
part[11] user_type :32768
part[11] keydata   :0
part[11] ro        :0

part[12] name      :vbmeta_a
part[12] classname :DISK
part[12] addrlo    :0x798400
part[12] lenlo     :0x100
part[12] user_type :32768
part[12] keydata   :0
part[12] ro        :0

part[13] name      :vbmeta_b
part[13] classname :DISK
part[13] addrlo    :0x798500
part[13] lenlo     :0x100
part[13] user_type :32768
part[13] keydata   :0
part[13] ro        :0

part[14] name      :vbmeta_system_a
part[14] classname :DISK
part[14] addrlo    :0x798600
part[14] lenlo     :0x80
part[14] user_type :32768
part[14] keydata   :0
part[14] ro        :0

part[15] name      :vbmeta_system_b
part[15] classname :DISK
part[15] addrlo    :0x798680
part[15] lenlo     :0x80
part[15] user_type :32768
part[15] keydata   :0
part[15] ro        :0

part[16] name      :vbmeta_vendor_a
part[16] classname :DISK
part[16] addrlo    :0x798700
part[16] lenlo     :0x80
part[16] user_type :32768
part[16] keydata   :0
part[16] ro        :0

part[17] name      :vbmeta_vendor_b
part[17] classname :DISK
part[17] addrlo    :0x798780
part[17] lenlo     :0x80
part[17] user_type :32768
part[17] keydata   :0
part[17] ro        :0

part[18] name      :frp
part[18] classname :DISK
part[18] addrlo    :0x798800
part[18] lenlo     :0x400
part[18] user_type :32768
part[18] keydata   :32768
part[18] ro        :0

part[19] name      :empty
part[19] classname :DISK
part[19] addrlo    :0x798c00
part[19] lenlo     :0x7800
part[19] user_type :32768
part[19] keydata   :0
part[19] ro        :0

part[20] name      :metadata
part[20] classname :DISK
part[20] addrlo    :0x7a0400
part[20] lenlo     :0x8000
part[20] user_type :32768
part[20] keydata   :0
part[20] ro        :0

part[21] name      :treadahead
part[21] classname :DISK
part[21] addrlo    :0x7a8400
part[21] lenlo     :0x30000
part[21] user_type :32768
part[21] keydata   :0
part[21] ro        :0

part[22] name      :private
part[22] classname :DISK
part[22] addrlo    :0x7d8400
part[22] lenlo     :0x8000
part[22] user_type :32768
part[22] keydata   :0
part[22] ro        :0

part[23] name      :dtbo_a
part[23] classname :DISK
part[23] addrlo    :0x7e0400
part[23] lenlo     :0x1000
part[23] user_type :32768
part[23] keydata   :0
part[23] ro        :0

part[24] name      :dtbo_b
part[24] classname :DISK
part[24] addrlo    :0x7e1400
part[24] lenlo     :0x1000
part[24] user_type :32768
part[24] keydata   :0
part[24] ro        :0

part[25] name      :media_data
part[25] classname :DISK
part[25] addrlo    :0x7e2400
part[25] lenlo     :0x8000
part[25] user_type :32768
part[25] keydata   :0
part[25] ro        :0

part[26] name      :Reserve0
part[26] classname :DISK
part[26] addrlo    :0x7ea400
part[26] lenlo     :0x20000
part[26] user_type :32768
part[26] keydata   :0
part[26] ro        :0

part[27] name      :pstore
part[27] classname :DISK
part[27] addrlo    :0x80a400
part[27] lenlo     :0x10000
part[27] user_type :32768
part[27] keydata   :0
part[27] ro        :0

part[28] name      :UDISK
part[28] classname :DISK
part[28] addrlo    :0x81a400
part[28] lenlo     :0x0
part[28] user_type :33024
part[28] keydata   :0
part[28] ro        :0

[24.598]erase all part start
need erase flash: 18
[24.603][mmc]: erase from: 0, to: 61194239, cnt: 61194240, erase_group: 1024
[25.101][mmc]: sunxi_mmc_do_send_cmd_common: cmd 38 wait rsp busy 0x1e9 ms
[25.107]read item0 copy0
[25.117]Item0 (Map) magic is bad
[25.119]the secure storage item0 copy0 magic is bad
[25.131]Item0 (Map) magic is bad
[25.134]the secure storage item0 copy1 magic is bad
[25.138]Item0 (Map) magic is bad
[25.141]the secure storage map is empty
[25.159]erase secure storage: 0 ok
SUNXI_EFEX_MBR_TAG
mbr size = 0x10000
write primary GPT success
write Backup GPT success
[25.173]update partition map
FEX_CMD_fes_verify_status
FEX_CMD_fes_verify last err=0
******Has init
FEX_CMD_fes_verify_value, start 0x8000, size high 0x0:low 0x111d400
FEX_CMD_fes_verify_value 0xa14dbd74
FEX_CMD_fes_verify_value, start 0x28000, size high 0x0:low 0x20000
FEX_CMD_fes_verify_value 0xf00b1936
FEX_CMD_fes_verify_value, start 0x28400, size high 0x0:low 0x4000000
FEX_CMD_fes_verify_value 0x2d9ccd73
FEX_CMD_fes_verify_value, start 0x68400, size high 0x0:low 0x2000000
FEX_CMD_fes_verify_value 0x7435dd4a
FEX_CMD_fes_verify_value, start 0x88400, size high 0x0:low 0x800000
FEX_CMD_fes_verify_value 0xbad6702e
FEX_CMD_fes_verify_value, start 0x790400, size high 0x0:low 0x1000000
FEX_CMD_fes_verify_value 0xb961f417
FEX_CMD_fes_verify_value, start 0x798400, size high 0x0:low 0x2000
FEX_CMD_fes_verify_value 0x81ff878d
FEX_CMD_fes_verify_value, start 0x798600, size high 0x0:low 0x1000
FEX_CMD_fes_verify_value 0xd3178e38
FEX_CMD_fes_verify_value, start 0x798700, size high 0x0:low 0x1000
FEX_CMD_fes_verify_value 0xccfd9b0c
FEX_CMD_fes_verify_value, start 0x7e0400, size high 0x0:low 0x200000
FEX_CMD_fes_verify_value 0x9d9c6d85
FEX_CMD_fes_verify_value, start 0x7ea400, size high 0x0:low 0x1000000
FEX_CMD_fes_verify_value 0x0
bootfile_mode=4
SUNXI_EFEX_BOOT1_TAG
boot1 size = 0x13c000, max size = 0x400000
uboot size = 0x13c000
storage type = 2
FEX_CMD_fes_verify_status
FEX_CMD_fes_verify last err=0
bootfile_mode=4
SUNXI_EFEX_BOOT0_TAG
boot0 size = 0x3c000
[68.943][mmc]: write mmc 2 info ok
storage type = 2
FEX_CMD_fes_verify_status
FEX_CMD_fes_verify last err=0
sunxi_efex_next_action=2
exit usb
next work 2
SUNXI_UPDATE_NEXT_ACTION_REBOOT▒......

[176]HELLO! BOOT0 is starting!
[179]BOOT0 commit : {cfda5fbe}
[188]volume key pressed!
[190][mmc]: mmc driver ver 2024-03-20 10:36
[200][mmc]: Wrong media type 0x0, but host sdc2, try mmc first
[206][mmc]: ***Try MMC card 2***
[228][mmc]: RMCA OK!
[235][mmc]: MMC 5.1
[237][mmc]: HSSDR52/SDR25 8 bit
[240][mmc]: 50000000 Hz
[242][mmc]: 29880 MB
[244][mmc]: ***SD/MMC 2 init OK!!!***
[249]DRAM BOOT DRIVE INFO: V0.599
[254]DRAM_VCC set to 560 mv
[257]DRAM CLK =1800 MHZ
[259]DRAM Type =9 (8:LPDDR4,9:LPDDR5)
[386]Training result is = 7
[388]DRAM Pstate 0 training, frequency is 1800 Mhz
[397]Actual DRAM SIZE =6144 M
[400]DRAM SIZE =6144 MBytes, para1 = a10a, para2 = 18001001, dram_tpr13 = 10061
[414]DRAM simple test OK.
[456]error: dtb not found for scp
[461]tunning data addr:0x4a0003e8
[464]Jump to ATF: monitor_base = 0x48000000, uboot_base = 0x4a000000, optee_base = 0x0
NOTICE:  BL31: OP-TEE 32bit detected
NOTICE:  BL31: U-BOOT 32bit detected
NOTICE:  BL31: v2.5(debug):eec78cd3c
NOTICE:  BL31: Built : 14:02:13, Oct 29 2024
NOTICE:  BL31: No DTB found.
ERROR:   Error initializing runtime service opteed_fast

U-Boot 2018.07 (Mar 31 2025 - 06:54:43 +0000) Allwinner Technology

[00.511]CPU:   Allwinner Family
[00.514]Model: sun60iw2
I2C:   ready
[00.574]DRAM:  6 GiB
[00.578]Relocation Offset is: 75dac000
[00.634]secure enable bit: 0
[00.637]PMU: AXP8191
[00.639]PMU: AXP8191 VER_A
FDT ERROR:fdt_get_regulator_name:get property handle twi-supply error:FDT_ERR_INTERNAL
[00.651][AXP8191] onoff status: 0x50 = 0x0, 0x51 = 0x0
[00.656][AXP8191] charge status: 0x4 = 0x0
[00.660]CPU=1014 MHz,PLL6=1200 Mhz,AHB=200 Mhz, APB1=24Mhz  MBus=600Mhz
[00.666]gic: sec monitor mode
[00.671]flash init start
[00.673]workmode = 0,storage type = 2
[00.677][mmc]: mmc driver ver uboot2018:2024-10-18 9:01:00
[00.685][mmc]: SUNXI SDMMC Controller Version:0x50610
[00.695][mmc]: 200 MHz...
[00.697][mmc]: sample: 23 - 108(ps)
[00.700][mmc]: ds: 23 - 108(ps)
[00.718][mmc]: Best spd md: 4-HS400, freq: 5-200000000, Bus width: 8
[00.724]sunxi flash init ok
[00.740]Loading Environment from SUNXI_FLASH... [00.751]the secure storage item0 copy0 magic is bad
[00.763]the secure storage item0 copy1 magic is bad
erase secure storage failed
OK
[00.827]NOT support bridge yet
[00.829]Warn: no find panel or bridge
[00.837]failed to request regulator(avdd-supply): -22
[00.842]failed to request regulator_vol(avdd-output-voltage): -22
[00.848]failed to request regulator(avee-supply): -22
[00.852]failed to request regulator_vol(avee-output-voltage): -22
** Unrecognized filesystem type **
[00.868]get file(disp_rsl.fex) size from Reserve0 error
dsi0@5506000:  detailed mode clock 50000 kHz, flags[0]
    H: 1024 1174 1194 1344
    V: 0600 0608 0611 0635
bus_format: 0
[00.884]hdmi@5520000 disconnected
[00.887]bad framebuffer width 0
[00.904]m:6, m0:1, m1:6, m2:3, m3:12
[01.816]failed to display uboot logo for disp 64
[01.827]the secure storage item0 copy0 magic is bad
[01.838]the secure storage item0 copy1 magic is bad
[01.843]usb burn from boot
delay time 0
[01.849]usb prepare ok
[02.057]usb sof ok
[02.059]usb probe ok
[02.061]usb setup ok
set address 0x10
set address 0x10 ok
set address 0x11
set address 0x11 ok
[02.467]do_burn_from_boot usb : have no handshake
skip update boot_param
List file under ULI/factory
** Unrecognized filesystem type **
[02.481]update part info
[02.485]battery temp is -1
[02.502]update bootcmd
[02.570]change working_fdt 0xbbd5be30 to 0xbbd2be30
ret 0
[02.690]no battery, disabled battery functons
[02.696]update dts
Hit any key to stop autoboot:  0
Android's image name: arm64
kernel  addr 0x40080000 0x4289a000 exceed boot_a scope
boot_a  addr 0x4007f000 0x4289a000
ERROR: reserving fdt memory region failed (addr=bbe31000 size=258000)
[03.033]Starting kernel ...

[03.036]total: 3036 ms

[03.038][mmc]: mmc exit start
[03.055][mmc]: mmc 2 exit ok
NOTICE:  [SCP] :wait arisc ready....
NOTICE:  [SCP] :arisc version: [c82a3c8d0b638500aa1ffe037d00fa24cf20a903-dirty]
NOTICE:  [SCP] :arisc startup ready
NOTICE:  [SCP] :arisc startup notify message feedback
NOTICE:  [SCP] :sunxi-arisc driver is starting
NOTICE:  BL3-1: Next image address = 0x40080000
NOTICE:  BL3-1: Next image spsr = 0x3c5
[    0.000000][    T0] Booting Linux on physical CPU 0x0000000000 [0x412fd050]
[    0.000000][    T0] Linux version 5.15.119-gc82a3c8d0b63-dirty (xtx@ubuntu-201) (Android (8490178, based on r450784d) clang version 14.0.6 (https://android.googlesource.com/toolchain/llvm-project 4c603efb0cca074e9238af8b4106c30add4418f6), LLD 14.0.6) #13 SMP PREEMPT Mon Mar 31 06:56:51 UTC 2025
[    0.000000][    T0] Machine model: sun60iw2
[    0.000000][    T0] Stack Depot is disabled
[    0.000000][    T0] KVM is not available. Ignoring kvm-arm.mode
[    0.000000][    T0] earlycon: uart8250 at MMIO32 0x0000000002500000 (options '')
[    0.000000][    T0] printk: bootconsole [uart8250] enabled
[    0.000000][    T0] efi: UEFI not found.
[    0.000000][    T0] [Firmware Bug]: Kernel image misaligned at boot, please fix your bootloader!
[    0.000000][    T0] OF: reserved mem: 0x0000000048000000..0x0000000048ffffff (16384 KiB) map non-reusable bl31
[    0.000000][    T0] Zone ranges:
[    0.000000][    T0]   DMA32    [mem 0x0000000040000000-0x00000000ffffffff]
[    0.000000][    T0]   Normal   [mem 0x0000000100000000-0x00000001bfffffff]
[    0.000000][    T0] Movable zone start for each node
[    0.000000][    T0] Early memory node ranges
[    0.000000][    T0]   node   0: [mem 0x0000000040000000-0x00000001bfffffff]
[    0.000000][    T0] Initmem setup node 0 [mem 0x0000000040000000-0x00000001bfffffff]
[    0.000000][    T0] cma: Reserved 8 MiB at 0x00000000ff800000
[    0.000000][    T0] psci: probing for conduit method from DT.
[    0.000000][    T0] psci: PSCIv1.1 detected in firmware.
[    0.000000][    T0] psci: Using standard PSCI v0.2 function IDs
[    0.000000][    T0] psci: MIGRATE_INFO_TYPE not supported.
[    0.000000][    T0] psci: SMC Calling Convention v1.2
[    0.000000][    T0] Load bootconfig: 810 bytes 50 nodes
[    0.000000][    T0] percpu: Embedded 29 pages/cpu s81752 r8192 d28840 u118784
[    0.000000][    T0] pcpu-alloc: s81752 r8192 d28840 u118784 alloc=29*4096
[    0.000000][    T0] pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3 [0] 4 [0] 5 [0] 6 [0] 7
[    0.000000][    T0] Detected VIPT I-cache on CPU0
[    0.000000][    T0] CPU features: SYS_ID_AA64MMFR1_EL1[11:8]: forced to 0
[    0.000000][    T0] CPU features: detected: GIC system register CPU interface
[    0.000000][    T0] CPU features: kernel page table isolation forced ON by KASLR
[    0.000000][    T0] CPU features: detected: Kernel page table isolation (KPTI)
[    0.000000][    T0] CPU features: detected: Qualcomm erratum 1009, or ARM erratum 1286807, 2441009
[    0.000000][    T0] CPU features: detected: ARM errata 1165522, 1319367, or 1530923
[    0.000000][    T0] Built 1 zonelists, mobility grouping on.  Total pages: 1548288
[    0.000000][    T0] Kernel command line: stack_depot_disable=on kasan.stacktrace=off kvm-arm.mode=protected cgroup_disable=pressure rcutree.rcu_idle_gp_delay=1 cpufreq.default_governor=performance earlycon=uart8250,mmio32,0x02500000 clk_ignore_unused= initcall_debug=0 console=ttyAS0,115200 loglevel=8 root=/dev/mmcblk0p4 init=/init init_rc= cma=8M slub_min_objects=8 snum=7c00161172014741e8d mac_addr= wifi_mac= bt_mac= specialstr= gpt=1 sn2= deferred_probe_timeout=10 boot_type=2 gpt=1 uboot_message=2018.07(03/31/2025-06:54:43) bootreason=button uboot_backup=ubootA  loop.max_part=4 mmcblk.perdev_minors=16 firmware_class.path=/vendor/etc/firmware bootconfig buildvariant=userdebug
[    0.000000][    T0] cgroup: Disabling pressure control group feature
[    0.000000][    T0] Unknown kernel command line parameters "init_rc= snum=7c00161172014741e8d mac_addr= wifi_mac= bt_mac= specialstr= sn2= boot_type=2 uboot_message=2018.07(03/31/2025-06:54:43) bootreason=button uboot_backup=ubootA buildvariant=userdebug", will be passed to user space.
[    0.000000][    T0] Dentry cache hash table entries: 1048576 (order: 11, 8388608 bytes, linear)
[    0.000000][    T0] Inode-cache hash table entries: 524288 (order: 10, 4194304 bytes, linear)
[    0.000000][    T0] mem auto-init: stack:all(zero), heap alloc:on, heap free:off
[    0.000000][    T0] software IO TLB: mapped [mem 0x00000000fb800000-0x00000000ff800000] (64MB)
[    0.000000][    T0] Memory: 6008524K/6291456K available (18432K kernel code, 2214K rwdata, 18820K rodata, 1472K init, 614K bss, 274740K reserved, 8192K cma-reserved)
[    0.000000][    T0] SLUB: HWalign=64, Order=0-3, MinObjects=8, CPUs=8, Nodes=1
[    0.000000][    T0] trace event string verifier disabled
[    0.000000][    T0] rcu: Preemptible hierarchical RCU implementation.
[    0.000000][    T0] rcu:     RCU event tracing is enabled.
[    0.000000][    T0] rcu:     RCU dyntick-idle grace-period acceleration is enabled.
[    0.000000][    T0] rcu:     RCU restricting CPUs from NR_CPUS=32 to nr_cpu_ids=8.
[    0.000000][    T0] rcu:     RCU priority boosting: priority 1 delay 500 ms.
[    0.000000][    T0]  Trampoline variant of Tasks RCU enabled.
[    0.000000][    T0]  Tracing variant of Tasks RCU enabled.
[    0.000000][    T0] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies.
[    0.000000][    T0] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=8
[    0.000000][    T0] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[    0.000000][    T0] GICv3: 256 SPIs implemented
[    0.000000][    T0] GICv3: 0 Extended SPIs implemented
[    0.000000][    T0] GICv3: Distributor has no Range Selector support
[    0.000000][    T0] Root IRQ handler: gic_handle_irq.10d7cf410c142aff6d31b6303c3f9f87.cfi_jt
[    0.000000][    T0] GICv3: 16 PPIs implemented
[    0.000000][    T0] GICv3: CPU0: found redistributor 0 region 0:0x0000000003460000
[    0.000000][    T0] ITS: No ITS available, not enabling LPIs
[    0.000000][    T0] rcu:     Offload RCU callbacks from CPUs: (none).
[    0.000000][    T0] kfence: initialized - using 524288 bytes for 63 objects at 0x(____ptrval____)-0x(____ptrval____)
[    0.000000][    T0] arch_timer: cp15 timer(s) running at 24.00MHz (virt).
[    0.000000][    T0] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x588fe9dc0, max_idle_ns: 440795202592 ns
[    0.000001][    T0] sched_clock: 56 bits at 24MHz, resolution 41ns, wraps every 4398046511097ns
[    0.011206][    T0] Calibrating delay loop (skipped), value calculated using timer frequency.. 48.00 BogoMIPS (lpj=96000)
[    0.023251][    T0] pid_max: default: 32768 minimum: 301
[    0.029401][    T0] LSM: Security Framework initializing
[    0.035321][    T0] SELinux:  Initializing.
[    0.040291][    T0] Mount-cache hash table entries: 16384 (order: 5, 131072 bytes, linear)
[    0.049394][    T0] Mountpoint-cache hash table entries: 16384 (order: 5, 131072 bytes, linear)
[    0.062026][    T1] rcu: Hierarchical SRCU implementation.
[    0.069177][    T1] dyndbg: Ignore empty _ddebug table in a CONFIG_DYNAMIC_DEBUG_CORE build
[    0.079182][    T1] EFI services will not be available.
[    0.085811][    T1] smp: Bringing up secondary CPUs ...
[    0.092555][    T0] Detected VIPT I-cache on CPU1
[    0.092593][    T0] GICv3: CPU1: found redistributor 100 region 0:0x0000000003480000
[    0.092646][    T0] CPU1: Booted secondary processor 0x0000000100 [0x412fd050]
[    0.093765][    T0] Detected VIPT I-cache on CPU2
[    0.093797][    T0] GICv3: CPU2: found redistributor 200 region 0:0x00000000034a0000
[    0.093835][    T0] CPU2: Booted secondary processor 0x0000000200 [0x412fd050]
[    0.094846][    T0] Detected VIPT I-cache on CPU3
[    0.094873][    T0] GICv3: CPU3: found redistributor 300 region 0:0x00000000034c0000
[    0.094904][    T0] CPU3: Booted secondary processor 0x0000000300 [0x412fd050]
[    0.095934][    T0] Detected VIPT I-cache on CPU4
[    0.095962][    T0] GICv3: CPU4: found redistributor 400 region 0:0x00000000034e0000
[    0.095991][    T0] CPU4: Booted secondary processor 0x0000000400 [0x412fd050]
[    0.097035][    T0] Detected VIPT I-cache on CPU5
[    0.097063][    T0] GICv3: CPU5: found redistributor 500 region 0:0x0000000003500000
[    0.097091][    T0] CPU5: Booted secondary processor 0x0000000500 [0x412fd050]
[    0.098117][    T0] CPU features: detected: Spectre-v4
[    0.098122][    T0] CPU features: detected: Spectre-BHB
[    0.098126][    T0] Detected PIPT I-cache on CPU6
[    0.098142][    T0] GICv3: CPU6: found redistributor 600 region 0:0x0000000003520000
[    0.098160][    T0] CPU6: Booted secondary processor 0x0000000600 [0x414fd0b1]
[    0.099144][    T0] Detected PIPT I-cache on CPU7
[    0.099164][    T0] GICv3: CPU7: found redistributor 700 region 0:0x0000000003540000
[    0.099183][    T0] CPU7: Booted secondary processor 0x0000000700 [0x414fd0b1]
[    0.099267][    T1] smp: Brought up 1 node, 8 CPUs
[    0.266949][    T1] SMP: Total of 8 processors activated.
[    0.272877][    T1] CPU features: detected: 32-bit EL0 Support
[    0.279280][    T1] CPU features: detected: Data cache clean to the PoU not required for I/D coherence
[    0.289499][    T1] CPU features: detected: Common not Private translations
[    0.297149][    T1] CPU features: detected: CRC32 instructions
[    0.303563][    T1] CPU features: detected: RCpc load-acquire (LDAPR)
[    0.310640][    T1] CPU features: detected: LSE atomic instructions
[    0.317523][    T1] CPU features: detected: Privileged Access Never
[    0.324403][    T1] CPU features: detected: RAS Extension Support
[    0.331093][    T1] CPU features: detected: Speculative Store Bypassing Safe (SSBS)
[    0.375725][    T1] CPU: All CPU(s) started at EL1
[    0.381083][   T19] alternatives: patching kernel code
[    0.425590][    T1] Registered cp15_barrier emulation handler
[    0.431914][    T1] Registered setend emulation handler
[    0.437644][    T1] KASLR disabled due to lack of seed
[    0.443388][    T1] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[    0.454558][    T1] futex hash table entries: 2048 (order: 5, 131072 bytes, linear)
[    0.463257][    T1] pinctrl core: initialized pinctrl subsystem
[    0.470425][    T1] NET: Registered PF_NETLINK/PF_ROUTE protocol family
[    0.480071][    T1] DMA: preallocated 1024 KiB GFP_KERNEL pool for atomic allocations
[    0.489149][    T1] DMA: preallocated 1024 KiB GFP_KERNEL|GFP_DMA32 pool for atomic allocations
[    0.498686][    T1] audit: initializing netlink subsys (disabled)
[    0.505553][   T80] audit: type=2000 audit(0.328:1): state=initialized audit_enabled=0 res=1
[    0.505817][    T1] thermal_sys: Registered thermal governor 'step_wise'
[    0.514825][    T1] thermal_sys: Registered thermal governor 'user_space'
[    0.522174][    T1] thermal_sys: Registered thermal governor 'power_allocator'
[    0.530251][    T1] cpuidle: using governor menu
[    0.543389][    T1] hw-breakpoint: found 6 breakpoint and 4 watchpoint registers.
[    0.551779][    T1] ASID allocator initialised with 32768 entries
[    0.558547][    T1] Serial: AMBA PL011 UART driver
[    0.578553][    T1] platform 5501000.tcon0: Fixing up cyclic dependency with 5000000.de
[    0.587564][    T1] platform 5506000.dsi0: Fixing up cyclic dependency with 5501000.tcon0
[    0.596791][    T1] platform 5730000.tcon3: Fixing up cyclic dependency with 5000000.de
[    0.605712][    T1] platform 5731000.tcon4: Fixing up cyclic dependency with 5000000.de
[    0.614648][    T1] platform 5520000.hdmi: Fixing up cyclic dependency with 5730000.tcon3
[    0.631804][    T1] iommu: Default domain type: Translated
[    0.637948][    T1] iommu: DMA domain TLB invalidation policy: strict mode
[    0.645969][    T1] SCSI subsystem initialized
[    0.650927][    T1] usbcore: registered new interface driver usbfs
[    0.657722][    T1] usbcore: registered new interface driver hub
[    0.664321][    T1] usbcore: registered new device driver usb
[    0.670697][    T1] mc: Linux media interface: v0.10
[    0.676093][    T1] videodev: Linux video capture interface: v2.00
[    0.682916][    T1] EDAC MC: Ver: 3.0.0
[    0.687831][    T1] Advanced Linux Sound Architecture Driver Initialized.
[    0.695569][    T1] Bluetooth: Core ver 2.22
[    0.700127][    T1] NET: Registered PF_BLUETOOTH protocol family
[    0.706131][    T1] Bluetooth: HCI device and connection manager initialized
[    0.713862][    T1] Bluetooth: HCI socket layer initialized
[    0.719988][    T1] Bluetooth: L2CAP socket layer initialized
[    0.726239][    T1] Bluetooth: SCO socket layer initialized
[    0.732435][    T1] nfc: nfc_init: NFC Core ver 0.1
[    0.737798][    T1] NET: Registered PF_NFC protocol family
[    0.744146][    T1] clocksource: Switched to clocksource arch_sys_counter
[    0.773471][    T1] VFS: Disk quotas dquot_6.6.0
[    0.778592][    T1] VFS: Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
[    0.787374][    T1] NET: Registered PF_INET protocol family
[    0.793795][    T1] IP idents hash table entries: 131072 (order: 8, 1048576 bytes, linear)
[    0.805406][    T1] tcp_listen_portaddr_hash hash table entries: 4096 (order: 4, 65536 bytes, linear)
[    0.815696][    T1] Table-perturb hash table entries: 65536 (order: 6, 262144 bytes, linear)
[    0.824962][    T1] TCP established hash table entries: 65536 (order: 7, 524288 bytes, linear)
[    0.834814][    T1] TCP bind hash table entries: 65536 (order: 8, 1048576 bytes, linear)
[    0.844505][    T1] TCP: Hash tables configured (established 65536 bind 65536)
[    0.852583][    T1] UDP hash table entries: 4096 (order: 5, 131072 bytes, linear)
[    0.860990][    T1] UDP-Lite hash table entries: 4096 (order: 5, 131072 bytes, linear)
[    0.869178][    T1] NET: Registered PF_UNIX/PF_LOCAL protocol family
[    0.876174][    T1] NET: Registered PF_XDP protocol family
[    0.882197][    T1] PCI: CLS 0 bytes, default 64
[    0.887640][    T8] Trying to unpack rootfs image as initramfs...
[    0.894583][    T1] hw perfevents: enabled with armv8_pmuv3 PMU driver, 7 counters available
[    0.904250][    T1] kvm [1]: HYP mode not available
[    0.910328][    T1] Initialise system trusted keyrings
[    0.916089][    T1] workingset: timestamp_bits=46 max_order=21 bucket_order=0
[    0.928051][    T1] fuse: init (API version 7.36)
[    0.960477][    T1] Key type asymmetric registered
[    0.965693][    T1] Asymmetric key parser 'x509' registered
[    0.971889][    T1] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 241)
[    0.980720][    T1] io scheduler mq-deadline registered
[    0.986368][    T1] io scheduler kyber registered
[    0.991598][    T1] io scheduler bfq registered
[    0.999925][   T22] cacheinfo: Unable to detect cache hierarchy for CPU 0
[    1.010986][    T1] brd: module loaded
[    1.022092][    T1] loop: module loaded
[    1.028304][    T1] wireguard: WireGuard 1.0.0 loaded. See www.wireguard.com for information.
[    1.037626][    T1] wireguard: Copyright (C) 2015-2019 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
[    1.040110][    T8] Freeing initrd memory: 22396K
[    1.049267][    T1] MACsec IEEE 802.1AE
[    1.058637][    T1] tun: Universal TUN/TAP device driver, 1.6
[    1.064988][    T1] CAN device driver interface
[    1.069955][    T1] PPP generic driver version 2.4.2
[    1.075436][    T1] PPP BSD Compression module registered
[    1.081356][    T1] PPP Deflate Compression module registered
[    1.087669][    T1] PPP MPPE Compression module registered
[    1.093684][    T1] NET: Registered PF_PPPOX protocol family
[    1.099732][    T1] PPTP driver version 0.8.5
[    1.104757][    T1] usbcore: registered new interface driver rtl8150
[    1.111749][    T1] usbcore: registered new interface driver r8152
[    1.118544][    T1] usbcore: registered new interface driver asix
[    1.124655][    T1] usbcore: registered new interface driver ax88179_178a
[    1.132110][    T1] usbcore: registered new interface driver cdc_ether
[    1.139278][    T1] usbcore: registered new interface driver cdc_eem
[    1.146267][    T1] usbcore: registered new interface driver cdc_ncm
[    1.152958][    T1] usbcore: registered new interface driver aqc111
[    1.159839][    T1] usbcore: registered new interface driver r8153_ecm
[    1.167381][    T1] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    1.174594][    T1] ehci-pci: EHCI PCI platform driver
[    1.180240][    T1] ehci-platform: EHCI generic platform driver
[    1.187024][    T1] usbcore: registered new interface driver cdc_acm
[    1.193967][    T1] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
[    1.203530][    T1] usbcore: registered new interface driver uas
[    1.210138][    T1] usbcore: registered new interface driver usb-storage
[    1.217634][    T1] usbcore: registered new interface driver xpad
[    1.224279][    T1] usbcore: registered new interface driver uvcvideo
[    1.231343][    T1] gspca_main: v2.14.0 registered
[    1.236769][    T1] device-mapper: uevent: version 1.0.3
[    1.242710][    T1] device-mapper: ioctl: 4.45.0-ioctl (2021-03-22) initialised: dm-devel@redhat.com
[    1.252697][    T1] Bluetooth: HCI UART driver ver 2.3
[    1.258198][    T1] Bluetooth: HCI UART protocol H4 registered
[    1.264602][    T1] Bluetooth: HCI UART protocol LL registered
[    1.271034][    T1] Bluetooth: HCI UART protocol Broadcom registered
[    1.278008][    T1] Bluetooth: HCI UART protocol QCA registered
[    1.285541][    T1] mmcblk: using 16 minors per device
[    1.291191][    T1] sdhci: Secure Digital Host Controller Interface driver
[    1.298729][    T1] sdhci: Copyright(c) Pierre Ossman
[    1.304265][    T1] sdhci-pltfm: SDHCI platform and OF driver helper
[    1.311390][    T1] SMCCC: SOC_ID: ARCH_SOC_ID not implemented, skipping ....
[    1.319243][    T1] hid: raw HID events driver (C) Jiri Kosina
[    1.326126][    T1] usbcore: registered new interface driver usbhid
[    1.333001][    T1] usbhid: USB HID core driver
[    1.338099][    T1] ashmem: initialized
[    1.342479][    T1] gnss: GNSS driver registered with major 509
[    1.349344][    T1] usbcore: registered new interface driver snd-usb-audio
[    1.357177][    T1] GACT probability NOT on
[    1.361548][    T1] Mirror/redirect action on
[    1.366332][    T1] netem: version 1.3
[    1.370334][    T1] u32 classifier
[    1.374060][    T1]     input device check on
[    1.378836][    T1]     Actions configured
[    1.385137][    T1] xt_time: kernel timezone is -0000
[    1.390815][    T1] ipip: IPv4 and MPLS over IPv4 tunneling driver
[    1.397847][    T1] gre: GRE over IPv4 demultiplexor driver
[    1.403961][    T1] ip_gre: GRE over IPv4 tunneling driver
[    1.410455][    T1] IPv4 over IPsec tunneling driver
[    1.415866][    T1] Initializing XFRM netlink socket
[    1.421344][    T1] IPsec XFRM device driver
[    1.426317][    T1] NET: Registered PF_INET6 protocol family
[    1.433706][    T1] Segment Routing with IPv6
[    1.438519][    T1] In-situ OAM (IOAM) with IPv6
[    1.443665][    T1] mip6: Mobile IPv6
[    1.448024][    T1] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[    1.455708][    T1] ip6_gre: GRE over IPv6 tunneling driver
[    1.462024][    T1] NET: Registered PF_PACKET protocol family
[    1.468352][    T1] NET: Registered PF_KEY protocol family
[    1.474434][    T1] can: controller area network core
[    1.480042][    T1] NET: Registered PF_CAN protocol family
[    1.486074][    T1] can: raw protocol
[    1.490097][    T1] can: broadcast manager protocol
[    1.495448][    T1] can: netlink gateway - max_hops=1
[    1.501195][    T1] Bluetooth: RFCOMM TTY layer initialized
[    1.507323][    T1] Bluetooth: RFCOMM socket layer initialized
[    1.513734][    T1] Bluetooth: RFCOMM ver 1.11
[    1.518610][    T1] Bluetooth: HIDP (Human Interface Emulation) ver 1.2
[    1.525214][    T1] Bluetooth: HIDP socket layer initialized
[    1.531430][    T1] l2tp_core: L2TP core driver, V2.0
[    1.536974][    T1] l2tp_ppp: PPPoL2TP kernel driver, V2.0
[    1.542987][    T1] 8021q: 802.1Q VLAN Support v1.8
[    1.548348][    T1] tipc: Activated (version 2.0.0)
[    1.553793][    T1] NET: Registered PF_TIPC protocol family
[    1.559972][    T1] tipc: Started in single node mode
[    1.565627][    T1] NET: Registered PF_IEEE802154 protocol family
[    1.572443][    T1] NET: Registered PF_VSOCK protocol family
[    1.579433][    T1] registered taskstats version 1
[    1.584703][    T1] Loading compiled-in X.509 certificates
[    1.591081][  T108] cryptomgr_probe (108) used greatest stack depth: 14016 bytes left
[    1.592666][    T1] Loaded X.509 cert 'Build time autogenerated kernel key: ce4e882886e7b069224779dcae2c567271036ca1'
[    1.612155][    T1] page_owner is disabled
[    1.616371][    T1] Key type .fscrypt registered
[    1.621437][    T1] Key type fscrypt-provisioning registered
[    1.629066][    T1] clk: Not disabling unused clocks
[    1.634535][    T1] ALSA device list:
[    1.638551][    T1]   No soundcards found.
[    1.643107][    T1] Warning: unable to open an initial console.
[    1.650156][    T1] Freeing unused kernel memory: 1472K
[    1.660374][    T1] Run /init as init process
[    1.665171][    T1]   with arguments:
[    1.668931][    T1]     /init
[    1.672182][    T1]   with environment:
[    1.676383][    T1]     HOME=/
[    1.679645][    T1]     TERM=linux
[    1.683370][    T1]     init_rc=
[    1.686600][    T1]     snum=7c00161172014741e8d
[    1.691633][    T1]     mac_addr=
[    1.695262][    T1]     wifi_mac=
[    1.698890][    T1]     bt_mac=
[    1.702327][    T1]     specialstr=
[    1.706146][    T1]     sn2=
[    1.709280][    T1]     boot_type=2
[    1.713104][    T1]     uboot_message=2018.07(03/31/2025-06:54:43)
[    1.719879][    T1]     bootreason=button
[    1.724271][    T1]     uboot_backup=ubootA
[    1.728618][    T1]     buildvariant=userdebug
[    1.735151][    T1] init: init first stage started!
[    1.743053][  T109] init: Loading module /lib/modules/zsmalloc.ko with args ''
[    1.743112][  T112] init: Loading module /lib/modules/twi-sunxi.ko with args ''
[    1.743312][  T111] init: Loading module /lib/modules/timer-sun50i.ko with args ''
[    1.743347][  T113] init: Loading module /lib/modules/tee.ko with args ''
[    1.743400][  T110] init: Loading module /lib/modules/sunxi-uart-ng.ko with args ''
[    1.743545][  T114] init: Loading module /lib/modules/sunxi-smc.ko with args ''
[    1.743578][  T111] timer_sun50i: module verification failed: signature and/or required key missing - tainting kernel
[    1.743664][  T115] init: Loading module /lib/modules/sunxi-power-notifier.ko with args ''
[    1.744255][  T116] init: Loading module /lib/modules/sunxi_pd_test.ko with args ''
[    1.816859][  T114] init: Loaded kernel module /lib/modules/sunxi-smc.ko
[    1.831229][  T116] [drm] [DSI-PANEL] panel_dsi_init start
[    1.837444][  T116] [drm] [DSI-PANEL] dsi driver regsiter finsh
[    1.845139][  T113] i2c_dev: i2c /dev entries driver
[    1.845757][  T112] BOOTEVENT:      1845.756325: ON
[    1.846424][  T116] init (116) used greatest stack depth: 12480 bytes left
[    1.852407][  T115] init (115) used greatest stack depth: 12368 bytes left
[    1.864155][  T125] sunxi:ccu-ng:[INFO]: sunxi rtc-ccu version: 0.5.3
[    1.865025][  T124] optee: probing for conduit method.
[    1.865039][  T124] optee: api uid mismatch
[    1.865042][  T124] optee: probe of firmware:optee failed with error -22
[    1.865713][  T118] zram: Added device: zram0
[    1.879489][  T119] AW BSP version: UNKNOWN, 2025-04-28 11:18:30
[    1.883900][  T125] AW BSP version: UNKNOWN, 2025-04-28 11:18:30
[    1.890517][  T119] sunxi:ccu-ng:[INFO]: r_ccu: sunxi ccu init OK
[    1.896699][  T125] sunxi:ccu-ng:[INFO]: rtc_ccu: sunxi ccu init OK
[    1.900534][  T119] sunxi:ccu-ng:[INFO]: sunxi ccu common driver version: 1.2.4
[    1.907682][  T125] init (125) used greatest stack depth: 11920 bytes left
[    1.911549][  T117] sunxi:ccu-ng:[INFO]: cpupll_ccu: sunxi ccu init OK
[    1.911556][  T117] sunxi:ccu-ng:[INFO]: sunxi pll_cpu driver version: 0.0.3
[    1.912364][  T117] sunxi:ccu-ng:[INFO]: ccu will stop clk in init process
[    1.913991][  T119] sunxi:ccu-ng:[INFO]: sunxi ccu driver version: 0.5.4
[    1.954266][  T117] sunxi:ccu-ng:[INFO]: ccu: sunxi ccu init OK
[    1.973165][  T129] [ADDR_MGT] addr_mgt_probe: module version: v1.0.12
[    1.973567][  T133] init (133) used greatest stack depth: 11376 bytes left
[    1.978579][  T117] sunxi:ccu-ng:[INFO]: sunxi ccu driver version: 1.0.13
[    1.986218][  T129] sunxi:sunxi_sidget_soc_ver_regs() +293: Failed to find "soc_bin" in dts.
[    1.993341][  T126] [drm] [TCON] sunxi_tcon_probe start
[    1.993476][  T117] sunxi:ccu_ddr:[ERR]: dram_clk:1800
[    1.993482][  T117] sunxi:ccu_ddr:[ERR]: dram_div:0x11080503
[    1.994428][  T117] sun55iw3-timer 3009000.timer: sun50i timer init:0xffffff0000000a
[    1.994434][  T117] clocksource: timer: mask: 0xffffffffffffff max_cycles: 0x1623fa770, max_idle_ns: 440795202238 ns
[    1.995080][  T117] sunxi:pwm-2527000.pwm:[INFO]: pwmchip probe success
[    1.995431][  T117] sunxi:pwm-2528000.pwm:[INFO]: pwmchip probe success
[    1.995800][  T117] sunxi:pwm-7023000.pwm:[INFO]: pwmchip probe success
[    1.996083][  T117] sunxi iommu: irq = 19
[    1.996115][  T117] sunxi iommu: irq = 20
[    1.997464][  T117] sun6i-dma 4601000.dma-controller: sunxi dma probed, driver version: 1.2.6
[    1.997853][  T117] pwm-backlight backlight1: supply power not found, using dummy regulator
[    1.998144][  T117] sunxi:pin:[INFO]: sunxi r-pinctrl version: 0.0.2
[    1.998458][    T8] sunxi:rtc:[INFO]:  Saving SoC boot-reason: OTHERS
[    1.999302][    T8] sunxi-rtc 7090000.rtc: registered as rtc0
[    1.999311][  T117] sunxi:pin-7025000.pinctrl:[INFO]: pinctrl withstand voltage config mode=auto_hard
[    1.999314][  T117] sunxi:pin:[INFO]: sunxi pinctrl core driver version: 1.4.8
[    1.999360][    T8] sunxi-rtc 7090000.rtc: setting system clock to 2025-05-29T13:49:17 UTC (1748526557)
[    1.999389][    T8] sunxi:rtc-7090000.rtc:[INFO]: sunxi rtc probed
[    1.999439][  T117] sunxi:pin:[INFO]: sunxi pinctrl version: 0.6.7
[    2.004331][  T129] [ADDR_MGT] addr_mgt_probe: success.
[    2.009919][  T126] [drm] [SUNXI-TCON] sunxi_tcon_of_get_id 0
[    2.016490][  T117] sunxi:pin-2000000.pinctrl:[INFO]: pinctrl withstand voltage config mode=auto_hard
[    2.021296][  T126] [drm] [TCON] sunxi_tcon_probe ret = 0
[    2.028203][  T117] sunxi:pin-2000000.pinctrl:[INFO]: Auto power withstand voltage configuration detected, automatically exit!
[    2.035827][  T126] [drm] [TCON] sunxi_tcon_probe start
[    2.046908][  T117] sunxi:sunxi_mmc_host-4021000.sdmmc:[INFO]: SD/MMC/SDIO Host Controller Driver(v5.58 2024-11-11 09:32)
[    2.054231][  T126] [drm] [SUNXI-TCON] sunxi_tcon_of_get_id 4
[    2.061554][  T117] sunxi:sunxi_mmc_host-4021000.sdmmc:[INFO]: ctl-spec-caps 428
[    2.068655][  T126] [drm] [TCON] sunxi_tcon_probe ret = 0
[    2.072742][  T117] sunxi:sunxi_mmc_host-4021000.sdmmc:[INFO]: No vmmc regulator found
[    2.077255][  T126] [drm] [TCON] sunxi_tcon_probe start
[    2.086349][  T117] sunxi:sunxi_mmc_host-4021000.sdmmc:[INFO]: No vqmmc regulator found
[    2.095132][  T126] [drm] [SUNXI-TCON] sunxi_tcon_of_get_id 5
[    2.102020][  T117] sunxi:sunxi_mmc_host-4021000.sdmmc:[INFO]: No vdmmc regulator found
[    2.109197][  T126] [drm] [TCON] sunxi_tcon_probe ret = 0
[    2.115354][  T117] sunxi:sunxi_mmc_host-4021000.sdmmc:[INFO]: No vd33sw regulator found
[    2.115357][  T117] sunxi:sunxi_mmc_host-4021000.sdmmc:[INFO]: No vd18sw regulator found
[    2.115358][  T117] sunxi:sunxi_mmc_host-4021000.sdmmc:[INFO]: No vq33sw regulator found
[    2.115360][  T117] sunxi:sunxi_mmc_host-4021000.sdmmc:[INFO]: No vq18sw regulator found
[    2.125724][  T126] [drm] sunxi_drm_platform_probe start
[    2.133387][  T117] sunxi:sunxi_mmc_host-4021000.sdmmc:[ERR]: manual set ocr
[    2.133400][  T117] sunxi:sunxi_mmc_host-4021000.sdmmc:[WARN]: Cann't get uart0 pinstate,check if needed
[    2.143697][  T126] [drm] sunxi_drm_match_add start
[    2.150470][  T117] sunxi:sunxi_mmc_host-4021000.sdmmc:[WARN]: Cann't get pin bias hs pinstate,check if needed
[    2.158003][  T126] [drm] sunxi_drm_match_add finish
[    2.163578][  T117] sunxi-mmc 4021000.sdmmc: sunxi:sunxi_mmc_hostexecute tuning in kernel, retune_period=3600
[    2.371929][  T117] sunxi:sunxi_mmc_host-4021000.sdmmc:[INFO]: sdc set ios:clk 0Hz bm PP pm UP vdd 21 width 1 timing LEGACY(SDR12) dt B
[    2.396156][  T117] sunxi:sunxi_mmc_host-4021000.sdmmc:[INFO]: sdc set ios:clk 400000Hz bm PP pm ON vdd 21 width 1 timing LEGACY(SDR12) dt B
[    2.420270][  T117] sunxi:sunxi_mmc_host-4021000.sdmmc:[INFO]: detmode:manually by software
[    2.421096][    C0] sunxi:sunxi_mmc_host-4021000.sdmmc:[ERR]: smc 1 p1 err, cmd 52, RTO !!
[    2.430877][  T117] NSI_PMU 2020000.nsi-controller: Get support-ecc failed
[    2.446364][  T117] [drm] [TCON_TOP]sunxi_tcon_top_probe start
[    2.446829][    C0] sunxi:sunxi_mmc_host-4021000.sdmmc:[ERR]: smc 1 p1 err, cmd 52, RTO !!
[    2.452951][  T117] [drm] [TCON_TOP]sunxi_tcon_top_probe start
[    2.467861][   T70] sunxi:sunxi_mmc_host-4021000.sdmmc:[INFO]: sdc set ios:clk 400000Hz bm PP pm ON vdd 21 width 1 timing LEGACY(SDR12) dt B
[    2.482102][  T117] sunxi-display-engine 5000000.de: Adding to iommu group 0
[    2.484817][   T70] sunxi:sunxi_mmc_host-4021000.sdmmc:[INFO]: sdc set ios:clk 400000Hz bm PP pm ON vdd 21 width 1 timing LEGACY(SDR12) dt B
[    2.490037][  T117] [drm] de use no display sys
[    2.505297][    C0] sunxi:sunxi_mmc_host-4021000.sdmmc:[ERR]: smc 1 p1 err, cmd 5, RTO !!
[    2.508511][  T117] sunxi-display-engine 5000000.de: register iommu fault callback for sunxi-drm, master=8
[    2.517719][    C0] sunxi:sunxi_mmc_host-4021000.sdmmc:[ERR]: smc 1 p1 err, cmd 5, RTO !!
[    2.526965][  T117] [drm] [PHY] sunxi_dsi_combophy_probe start
[    2.536423][    C0] sunxi:sunxi_mmc_host-4021000.sdmmc:[ERR]: smc 1 p1 err, cmd 5, RTO !!
[    2.542302][  T117] [drm] [PHY]sunxi_dsi_combophy_probe finish
[    2.551798][    C0] sunxi:sunxi_mmc_host-4021000.sdmmc:[ERR]: smc 1 p1 err, cmd 5, RTO !!
[    2.557752][  T117] [drm] [DSI] sunxi_drm_dsi_probe start
[    2.566328][   T70] sunxi:sunxi_mmc_host-4021000.sdmmc:[INFO]: sdc set ios:clk 0Hz bm PP pm OFF vdd 0 width 1 timing LEGACY(SDR12) dt B
[    2.572439][  T117] mipi-dsi 5506000.dsi0.0: Fixing up cyclic dependency with dsi_panel@1
[    2.585102][   T70] sunxi:pin-2000000.pinctrl:[INFO]: Auto power withstand voltage configuration detected, automatically exit!
[    2.594114][  T117] [drm] [DSI]sunxi_drm_dsi_probe ok
[    2.611971][  T117] pwm-backlight backlight0: supply power not found, using dummy regulator
[    2.621384][  T117] sunxi:pin-2000000.pinctrl:[ERR]: unknown pin
[    2.621390][  T117] sunxi:pin-2000000.pinctrl:[ERR]: unknown pin
[    2.628076][  T117] uart-ng 2500000.uart: there is not valid maps for state default
[    2.643169][  T117] sunxi:pin-2000000.pinctrl:[ERR]: unknown pin
[    2.643173][  T117] sunxi:pin-2000000.pinctrl:[ERR]: unknown pin
[    2.649776][  T117] uart-ng 2500000.uart: there is not valid maps for state sleep
[    2.664893][  T117] uart-ng uart-ng0: supply uart not found, using dummy regulator
[    2.673298][  T117] sunxi:uart-ng-uart-ng0:[INFO]: cannot get the TX DMA channel!
[    2.681507][  T117] sunxi:uart-ng-uart-ng0:[INFO]: cannot get the RX DMA channel!
[    2.689761][  T117] sunxi:uart-ng:[INFO]: sunxi uart-ng driver version: 1.1.7
[    2.697391][  T117] uart-ng0: ttyAS0 at MMIO 0x2500000 (irq = 426, base_baud = 1500000) is a SUNXI
[    2.707228][  T117] sunxi:uart-ng-uart-ng0:[INFO]: console setup baud 115200 parity n bits 8, flow n
[    2.717275][  T117] printk: console [ttyAS0] enabled
[    2.717275][  T117] printk: console [ttyAS0] enabled
[    2.728254][  T117] printk: bootconsole [uart8250] disabled
[    2.728254][  T117] printk: bootconsole [uart8250] disabled
[    2.741160][  T117] uart-ng uart-ng1: supply uart not found, using dummy regulator
[    2.749734][  T117] sunxi:uart-ng-uart-ng1:[INFO]: cannot get the TX DMA channel!
[    2.758119][  T117] sunxi:uart-ng-uart-ng1:[INFO]: cannot get the RX DMA channel!
[    2.766560][  T117] uart-ng1: ttyAS1 at MMIO 0x2501000 (irq = 427, base_baud = 1500000) is a SUNXI
[    2.777071][  T117] uart-ng uart-ng4: supply uart not found, using dummy regulator
[    2.785622][  T117] sunxi:uart-ng-uart-ng4:[INFO]: cannot get the TX DMA channel!
[    2.793984][  T117] sunxi:uart-ng-uart-ng4:[INFO]: cannot get the RX DMA channel!
[    2.802402][  T117] uart-ng4: ttyAS4 at MMIO 0x2504000 (irq = 428, base_baud = 1500000) is a SUNXI
[    2.812897][  T117] sunxi-twi 7083000.twi: supply twi not found, using dummy regulator
[    2.823032][  T117] sunxi:axp2101-13-0036:[INFO]: AXP20x variant AXP8191 found
[    2.836296][  T117] axp8191-dcdc1: supplied by regulator-dummy
[    2.845230][  T117] axp8191-dcdc2: supplied by regulator-dummy
[    2.854161][  T117] axp8191-dcdc3: supplied by regulator-dummy
[    2.863079][  T117] axp8191-dcdc4: supplied by regulator-dummy
[    2.872522][  T117] axp8191-dcdc5: supplied by regulator-dummy
[    2.881923][  T117] axp8191-dcdc6: supplied by regulator-dummy
[    2.891339][  T117] axp8191-dcdc7: supplied by regulator-dummy
[    2.900781][  T117] axp8191-dcdc8: supplied by regulator-dummy
[    2.909448][  T117] axp8191-dcdc9: supplied by regulator-dummy
[    2.918401][  T117] axp8191-dc1sw1: supplied by axp8191-dcdc1
[    2.925130][  T117] axp8191-dc1sw2: supplied by axp8191-dcdc1
[    2.932227][  T117] axp8191-aldo1: supplied by regulator-dummy
[    2.942011][  T117] axp8191-aldo2: supplied by regulator-dummy
[    2.949641][  T117] axp8191-aldo3: supplied by regulator-dummy
[    2.957288][  T117] axp8191-aldo4: supplied by regulator-dummy
[    2.964899][  T117] axp8191-aldo5: supplied by regulator-dummy
[    2.972562][  T117] axp8191-aldo6: supplied by regulator-dummy
[    2.979684][  T117] axp8191-bldo1: supplied by regulator-dummy
[    2.986737][  T117] axp8191-bldo2: supplied by regulator-dummy
[    2.993767][  T117] axp8191-bldo3: supplied by regulator-dummy
[    3.000807][  T117] axp8191-bldo4: supplied by regulator-dummy
[    3.007611][  T117] axp8191-bldo5: supplied by regulator-dummy
[    3.016108][  T117] axp8191-cldo1: supplied by regulator-dummy
[    3.024910][  T117] axp8191-cldo2: supplied by regulator-dummy
[    3.031699][  T117] axp8191-cldo3: supplied by regulator-dummy
[    3.040823][  T117] axp8191-cldo4: supplied by regulator-dummy
[    3.047656][  T117] axp8191-cldo5: supplied by regulator-dummy
[    3.056289][  T117] axp8191-dldo1: supplied by regulator-dummy
[    3.065861][  T117] axp8191-dldo2: supplied by regulator-dummy
[    3.072934][  T117] axp8191-dldo3: supplied by regulator-dummy
[    3.079998][  T117] axp8191-dldo4: supplied by regulator-dummy
[    3.086762][  T117] axp8191-dldo5: Bringing 2800000uV into 3300000-3300000uV
[    3.095601][  T117] axp8191-dldo5: supplied by regulator-dummy
[    3.104259][  T117] axp8191-dldo6: supplied by regulator-dummy
[    3.113229][  T117] axp8191-eldo1: supplied by regulator-dummy
[    3.122650][  T117] axp8191-eldo2: supplied by regulator-dummy
[    3.131865][  T117] axp8191-eldo3: supplied by regulator-dummy
[    3.138958][  T117] axp8191-eldo4: supplied by regulator-dummy
[    3.146031][  T117] axp8191-eldo5: supplied by regulator-dummy
[    3.152819][  T117] axp8191-eldo6: supplied by regulator-dummy
[    3.161158][  T117] axp8191-rtcldo: supplied by regulator-dummy
[    3.168054][  T117] axp2101-pek axp2101-pek.0: DMA mask not set
[    3.179544][  T117] input: axp8191-pek as /devices/platform/soc@3000000/7083000.twi/i2c-13/13-0036/axp2101-pek.0/input/input0
[    3.192257][  T117] axp8191-temp-ctrl: Failed to locate of_node [id: 0]
[    3.199739][  T117] sunxi:axp8191_temp_ctrl:[ERR]: axp8191-temp-ctrl device is not configed
[    3.211329][  T117] reg-virt-consumer: Failed to locate of_node [id: -2]
[    3.218886][  T117] reg-virt-consumer: Failed to locate of_node [id: -2]
[    3.226423][  T117] reg-virt-consumer: Failed to locate of_node [id: -2]
[    3.233965][  T117] reg-virt-consumer: Failed to locate of_node [id: -2]
[    3.241504][  T117] reg-virt-consumer: Failed to locate of_node [id: -2]
[    3.249038][  T117] reg-virt-consumer: Failed to locate of_node [id: -2]
[    3.256568][  T117] reg-virt-consumer: Failed to locate of_node [id: -2]
[    3.264095][  T117] reg-virt-consumer: Failed to locate of_node [id: -2]
[    3.271631][  T117] reg-virt-consumer: Failed to locate of_node [id: -2]
[    3.279189][  T117] reg-virt-consumer: Failed to locate of_node [id: -2]
[    3.288979][  T117] sunxi:axp2101-13-0036:[INFO]: AXP20X driver loaded
[    3.296421][  T117] i2c 13-004e: Fixing up cyclic dependency with 10.usbc0
[    3.304232][  T117] sunxi:twi-7083000.twi:[INFO]: v2.7.4 probe success
[    3.312030][  T117] sunxi-twi 7084000.twi: supply twi not found, using dummy regulator
[    3.321798][  T117] sunxi:twi-7084000.twi:[INFO]: v2.7.4 probe success
[    3.332693][  T117] sunxi:sunxi_mmc_host-4023000.sdmmc:[INFO]: SD/MMC/SDIO Host Controller Driver(v5.58 2024-11-11 09:32)
[    3.345168][  T117] sunxi:sunxi_mmc_host-4023000.sdmmc:[INFO]: ctl-spec-caps 328
[    3.354815][  T117] sunxi:sunxi_mmc_host-4023000.sdmmc:[INFO]: No vdmmc regulator found
[    3.363796][  T117] sunxi:sunxi_mmc_host-4023000.sdmmc:[INFO]: No vd33sw regulator found
[    3.372833][  T117] sunxi:sunxi_mmc_host-4023000.sdmmc:[INFO]: No vd18sw regulator found
[    3.381871][  T117] sunxi:sunxi_mmc_host-4023000.sdmmc:[INFO]: No vq33sw regulator found
[    3.390907][  T117] sunxi:sunxi_mmc_host-4023000.sdmmc:[INFO]: No vq18sw regulator found
[    3.399962][  T117] sunxi:sunxi_mmc_host-4023000.sdmmc:[WARN]: Cann't get uart0 pinstate,check if needed
[    3.410558][  T117] sunxi:sunxi_mmc_host-4023000.sdmmc:[WARN]: Cann't get pin bias hs pinstate,check if needed
[    3.421860][  T117] sunxi:sunxi_mmc_host-4023000.sdmmc:[ERR]: Could not get store clock
[    3.431499][  T117] sunxi-mmc 4023000.sdmmc: sunxi:sunxi_mmc_host***ctl-cmdq-md*** 20
[    3.440518][  T117] sunxi:sunxi_mmc_host-4023000.sdmmc:[INFO]: cq_host:ffffff80c81d7c80, mmc:ffffff80c775d000, host:ffffff80c775d7c0
[    3.453859][  T117] mmc0: CQHCI version 0.00
[    3.458740][  T117] sunxi:sunxi_mmc_host-4023000.sdmmc:[INFO]: sdc set ios:clk 0Hz bm PP pm UP vdd 21 width 1 timing LEGACY(SDR12) dt B
[    3.485223][  T117] sunxi:sunxi_mmc_host-4023000.sdmmc:[INFO]: sdc set ios:clk 400000Hz bm PP pm ON vdd 21 width 1 timing LEGACY(SDR12) dt B
[    3.512205][   T70] sunxi:sunxi_mmc_host-4023000.sdmmc:[INFO]: sdc set ios:clk 400000Hz bm PP pm ON vdd 21 width 1 timing LEGACY(SDR12) dt B
[    3.526330][  T117] sunxi:sunxi_mmc_host-4023000.sdmmc:[INFO]: detmode:alway in(non removable)
[    3.536955][  T117] sunxi:sunxi_mmc_host-4020000.sdmmc:[INFO]: SD/MMC/SDIO Host Controller Driver(v5.58 2024-11-11 09:32)
[    3.549577][  T117] sunxi:sunxi_mmc_host-4020000.sdmmc:[INFO]: ctl-spec-caps 428
[    3.552323][   T70] sunxi:sunxi_mmc_host-4023000.sdmmc:[INFO]: sdc set ios:clk 400000Hz bm PP pm ON vdd 21 width 1 timing LEGACY(SDR12) dt B
[    3.560037][  T117] sunxi:sunxi_mmc_host-4020000.sdmmc:[INFO]: No vqmmc regulator found
[    3.573280][   T70] sunxi:sunxi_mmc_host-4023000.sdmmc:[INFO]: sdc set ios:clk 400000Hz bm OD pm ON vdd 21 width 1 timing LEGACY(SDR12) dt B
[    3.580893][  T117] sunxi:sunxi_mmc_host-4020000.sdmmc:[INFO]: No vdmmc regulator found
[    3.604593][  T117] sunxi-mmc 4020000.sdmmc: Got CD GPIO
[    3.608583][   T70] sunxi:sunxi_mmc_host-4023000.sdmmc:[INFO]: sdc set ios:clk 400000Hz bm OD pm ON vdd 21 width 1 timing LEGACY(SDR12) dt B
[    3.610575][  T117] sunxi-mmc 4020000.sdmmc: sunxi:sunxi_mmc_hostcd-set-debounce is 0x1
[    3.624695][   T70] sunxi:sunxi_mmc_host-4023000.sdmmc:[INFO]: sdc set ios:clk 400000Hz bm OD pm ON vdd 21 width 1 timing LEGACY(SDR12) dt B
[    3.647963][  T117] sunxi:sunxi_mmc_host-4020000.sdmmc:[INFO]: sdc set ios:clk 0Hz bm PP pm UP vdd 21 width 1 timing LEGACY(SDR12) dt B
[    3.650703][   T70] sunxi:sunxi_mmc_host-4023000.sdmmc:[INFO]: sdc set ios:clk 400000Hz bm OD pm ON vdd 21 width 1 timing LEGACY(SDR12) dt B
[    3.692120][   T70] sunxi:sunxi_mmc_host-4023000.sdmmc:[INFO]: sdc set ios:clk 400000Hz bm PP pm ON vdd 21 width 1 timing LEGACY(SDR12) dt B
[    3.720595][   T70] sunxi:sunxi_mmc_host-4023000.sdmmc:[ERR]: avoid to switch power_off_notification to POWERED_ON(0x01)
[    3.732777][   T70] sunxi:sunxi_mmc_host-4023000.sdmmc:[ERR]: avoid to switch power_off_notification to POWERED_ON(0x01)
[    3.744924][   T70] sunxi:sunxi_mmc_host-4023000.sdmmc:[ERR]: avoid to switch power_off_notification to POWERED_ON(0x01)
[    3.757066][   T70] sunxi:sunxi_mmc_host-4023000.sdmmc:[ERR]: avoid to switch power_off_notification to POWERED_ON(0x01)
[    3.770313][   T70] sunxi:sunxi_mmc_host-4023000.sdmmc:[INFO]: sdc set ios:clk 400000Hz bm PP pm ON vdd 21 width 8 timing LEGACY(SDR12) dt B
[    3.787946][   T70] sunxi:sunxi_mmc_host-4023000.sdmmc:[INFO]: sdc set ios:clk 400000Hz bm PP pm ON vdd 21 width 8 timing MMC-HS200 dt B
[    3.801794][   T70] sunxi:sunxi_mmc_host-4023000.sdmmc:[INFO]: sdc set ios:clk 52000000Hz bm PP pm ON vdd 21 width 8 timing MMC-HS200 dt B
[    3.815969][   T70] sunxi:sunxi_mmc_host-4023000.sdmmc:[INFO]: sdc set ios:clk 200000000Hz bm PP pm ON vdd 21 width 8 timing MMC-HS200 dt B
[    3.830148][   T70] sunxi:sunxi_mmc_host-4023000.sdmmc:[ERR]: sdc3 :the host don't support tuning in kernel
[    3.841091][   T70] sunxi:sunxi_mmc_host-4023000.sdmmc:[INFO]: sdc set ios:clk 200000000Hz bm PP pm ON vdd 21 width 8 timing MMC-HS(SDR20) dt B
[    3.855629][   T70] sunxi:sunxi_mmc_host-4023000.sdmmc:[INFO]: sdc set ios:clk 52000000Hz bm PP pm ON vdd 21 width 8 timing MMC-HS(SDR20) dt B
[    3.870252][   T70] sunxi:sunxi_mmc_host-4023000.sdmmc:[INFO]: sdc set ios:clk 50000000Hz bm PP pm ON vdd 21 width 8 timing MMC-HS400 dt B
[    3.880351][  T117] sunxi:sunxi_mmc_host-4020000.sdmmc:[INFO]: no vqmmc,Check if there is regulator
[    3.884337][   T70] sunxi:sunxi_mmc_host-4023000.sdmmc:[INFO]: sdc set ios:clk 200000000Hz bm PP pm ON vdd 21 width 8 timing MMC-HS400 dt B
[    3.906905][  T117] sunxi:sunxi_mmc_host-4020000.sdmmc:[INFO]: sdc set ios:clk 400000Hz bm PP pm ON vdd 21 width 1 timing LEGACY(SDR12) dt B
[    3.922452][   T70] mmc0: Command Queue Engine enabled
[    3.928202][   T70] mmc0: new HS400 MMC card at address 0001
[    3.935404][   T70] blk_queue_max_segment_size: set to minimum 4096
[    3.935497][   T95] sunxi:sunxi_mmc_host-4020000.sdmmc:[INFO]: sdc set ios:clk 0Hz bm PP pm OFF vdd 0 width 1 timing LEGACY(SDR12) dt B
[    3.942434][   T70] mmcblk0: mmc0:0001 MMC32G 29.2 GiB
[    3.956040][  T117] sunxi:sunxi_mmc_host-4020000.sdmmc:[INFO]: detmode:gpio irq
[    3.966283][   T70]  mmcblk0: p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 p16 p17 p18 p19 p20 p21 p22 p23 p24 p25 p26 p27 p28 p29
[    3.970902][  T117] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    3.984917][   T70] mmcblk0rpmb: mmc0:0001 MMC32G 4.00 MiB, chardev (235:0)
[    3.992948][  T168] random: fsck_msdos: uninitialized urandom read (40 bytes read)
[    3.994465][  T117] cpu cpu0: _opp_add: OPP not supported by regulators (408000000)
[    3.994665][    T1] fsck_msdos: linker: Warning: failed to find generated linker configuration from "/linkerconfig/ld.config.txt"
[    3.994680][    T1] fsck_msdos: WARNING: linker: Warning: failed to find generated linker configuration from "/linkerconfig/ld.config.txt"
[    3.998470][  T168] random: fsck_msdos: uninitialized urandom read (40 bytes read)
[    4.001284][    T1] fsck_msdos: Invalid signature in boot block: 0000
[    4.001297][    T1] fsck_msdos: /dev/block/by-name/media_data: UNEXPECTED INCONSISTENCY; RUN fsck_msdos MANUALLY.
[    4.002171][    T1] fsck_msdos: fsck_msdos terminated by exit(8)
[    4.002171][    T1]
[    4.005333][    T1] random: init: uninitialized urandom read (16 bytes read)
[    4.010791][  T117] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    4.028719][    T1] erofs: (device dm-0): mounted with root inode @ nid 65.
[    4.032349][  T117] cpu cpu0: _opp_add: OPP not supported by regulators (720000000)
[    4.032431][  T117] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    4.052039][    T1] EXT4-fs (dm-4): mounted filesystem without journal. Opts: . Quota mode: none.
[    4.054787][  T117] cpu cpu0: _opp_add: OPP not supported by regulators (792000000)
[    4.054866][  T117] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    4.063844][    T1] erofs: (device dm-1): mounted with root inode @ nid 42.
[    4.073498][  T117] cpu cpu0: _opp_add: OPP not supported by regulators (1008000000)
[    4.073591][  T117] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    4.084207][    T1] erofs: (device dm-3): mounted with root inode @ nid 39.
[    4.090603][  T117] cpu cpu0: _opp_add: OPP not supported by regulators (1104000000)
[    4.102037][    T1] erofs: (device dm-2): mounted with root inode @ nid 39.
[    4.109142][  T117] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    4.122387][    T1] newfs_msdos: executing /system/bin/newfs_msdos failed: No such file or directory
[    4.128327][  T117] cpu cpu0: _opp_add: OPP not supported by regulators (1200000000)
[    4.138262][    T1] newfs_msdos: newfs_msdos terminated by exit(255)
[    4.138262][    T1]
[    4.146866][  T117] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    4.157856][    T1] FAT-fs (mmcblk0p26): bogus number of reserved sectors
[    4.165261][  T117] cpu cpu0: _opp_add: OPP not supported by regulators (1296000000)
[    4.165345][  T117] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    4.173919][    T1] FAT-fs (mmcblk0p26): Can't find a valid FAT filesystem
[    4.175180][    T1] newfs_msdos: executing /system/bin/newfs_msdos failed: No such file or directory
[    4.184621][  T117] cpu cpu0: _opp_add: OPP not supported by regulators (1392000000)
[    4.184707][  T117] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    4.192425][    T1] newfs_msdos: newfs_msdos terminated by exit(255)
[    4.192425][    T1]
[    4.201126][  T117] cpu cpu0: _opp_add: OPP not supported by regulators (1416000000)
[    4.209321][    T1] FAT-fs (mmcblk0p27): bogus number of reserved sectors
[    4.219627][  T117] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    4.229791][    T1] FAT-fs (mmcblk0p27): Can't find a valid FAT filesystem
[    4.238414][  T117] cpu cpu0: _opp_add: OPP not supported by regulators (1512000000)
[    4.274912][    T1] printk: init: 146 output lines suppressed due to ratelimiting
[    4.285616][  T117] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    4.394547][  T117] cpu cpu0: _opp_add: OPP not supported by regulators (1608000000)
[    4.403420][  T117] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    4.410423][    T1] init: DM_DEV_STATUS failed for system_ext_a: No such device or address
[    4.414137][  T117] cpu cpu0: _opp_add: OPP not supported by regulators (1704000000)
[    4.423429][    T1] init: Could not update logical partition
[    4.433038][  T117] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    4.438435][    T1] init: Opening SELinux policy
[    4.449246][  T117] cpu cpu0: _opp_add: OPP not supported by regulators (1800000000)
[    4.454978][    T1] init: Falling back to standard signature check. TODO implementent support for fsverity SEPolicy.
[    4.463070][  T117] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    4.474709][    T1] init: Error: Apex SEPolicy failed signature check
[    4.485336][  T117] cpu cpu0: _opp_add: OPP not supported by regulators (728000000)
[    4.492569][    T1] init: Loading APEX Sepolicy from /system/etc/selinux/apex/SEPolicy.zip
[    4.501239][  T117] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    4.510367][    T1] init: Failed to open package /system/etc/selinux/apex/SEPolicy.zip: No such file or directory
[    4.521007][  T117] cpu cpu0: _opp_add: OPP not supported by regulators (1092000000)
[    4.521264][  T117] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    4.541118][    T1] init: Loading SELinux policy
[    4.556918][    T1] SELinux:  Permission bpf in class capability2 not defined in policy.
[    4.556964][  T117] cpu cpu0: _opp_add: OPP not supported by regulators (1586000000)
[    4.566030][    T1] SELinux:  Permission checkpoint_restore in class capability2 not defined in policy.
[    4.575509][  T117] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    4.585169][    T1] SELinux:  Permission bpf in class cap2_userns not defined in policy.
[    4.595849][  T117] cpu cpu6: _opp_add: OPP not supported by regulators (408000000)
[    4.595927][  T117] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    4.604905][    T1] SELinux:  Permission checkpoint_restore in class cap2_userns not defined in policy.
[    4.613450][  T117] cpu cpu6: _opp_add: OPP not supported by regulators (720000000)
[    4.613511][  T117] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    4.624210][    T1] SELinux:  Class mctp_socket not defined in policy.
[    4.634634][  T117] cpu cpu6: _opp_add: OPP not supported by regulators (792000000)
[    4.634702][  T117] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    4.643203][    T1] SELinux: the above unknown classes and permissions will be denied
[    4.653885][  T117] cpu cpu6: _opp_add: OPP not supported by regulators (1008000000)
[    4.653956][  T117] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    4.665791][    T1] SELinux:  policy capability network_peer_controls=1
[    4.669722][  T117] cpu cpu6: _opp_add: OPP not supported by regulators (1200000000)
[    4.669796][  T117] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    4.680461][    T1] SELinux:  policy capability open_perms=1
[    4.689183][  T117] cpu cpu6: _opp_add: OPP not supported by regulators (1296000000)
[    4.689247][  T117] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    4.697838][    T1] SELinux:  policy capability extended_socket_class=1
[    4.708520][  T117] cpu cpu6: _opp_add: OPP not supported by regulators (1392000000)
[    4.708593][  T117] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    4.715921][    T1] SELinux:  policy capability always_check_network=0
[    4.724559][  T117] cpu cpu6: _opp_add: OPP not supported by regulators (1512000000)
[    4.724636][  T117] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    4.735275][    T1] SELinux:  policy capability cgroup_seclabel=0
[    4.741577][  T117] cpu cpu6: _opp_add: OPP not supported by regulators (1608000000)
[    4.741634][  T117] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    4.750234][    T1] SELinux:  policy capability nnp_nosuid_transition=1
[    4.760918][  T117] cpu cpu6: _opp_add: OPP not supported by regulators (1704000000)
[    4.760991][  T117] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    4.768311][    T1] SELinux:  policy capability genfs_seclabel_symlinks=0
[    4.776956][  T117] cpu cpu6: _opp_add: OPP not supported by regulators (1800000000)
[    4.777030][  T117] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    4.787654][    T1] SELinux:  policy capability ioctl_skip_cloexec=0
[    4.794937][  T117] cpu cpu6: _opp_add: OPP not supported by regulators (1896000000)
[    4.795009][  T117] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    4.920482][  T117] cpu cpu6: _opp_add: OPP not supported by regulators (1920000000)
[    4.929331][  T117] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    4.940028][  T117] cpu cpu6: _opp_add: OPP not supported by regulators (1992000000)
[    4.948900][  T117] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    4.959595][  T117] cpu cpu6: _opp_add: OPP not supported by regulators (728000000)
[    4.968562][  T117] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    4.979262][  T117] cpu cpu6: _opp_add: OPP not supported by regulators (1300000000)
[    4.988221][  T117] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    4.998915][  T117] cpu cpu6: _opp_add: OPP not supported by regulators (1586000000)
[    5.007763][  T117] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    5.018456][  T117] cpu cpu6: _opp_add: OPP not supported by regulators (1690000000)
[    5.027527][  T117] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    5.038223][  T117] cpu cpu6: _opp_add: OPP not supported by regulators (1976000000)
[    5.047369][  T117] cpu cpu0: EM: created perf domain
[    5.058868][  T117] cpu cpu6: EM: created perf domain
[    5.064587][   T80] audit: type=1403 audit(1748526560.564:2): auid=4294967295 ses=4294967295 lsm=selinux res=1
[    5.067994][  T117] sunxi:sunxi_dsufreq:[WARN]: dsu dvfs: 26m-vf0200
[    5.070180][    T1] selinux: SELinux: Loaded file_contexts
[    5.070185][    T1] selinux:
[    5.075564][    T1] random: init: uninitialized urandom read (40 bytes read)
[    5.082221][    T1] random: init: uninitialized urandom read (40 bytes read)
[    5.082999][  T117] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    5.091100][    T1] init: init second stage started!
[    5.092311][  T117] sunxi-dsufreq 8860000.dsufreq: _opp_add: OPP not supported by regulators (288000000)
[    5.092468][  T117] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    5.145524][  T117] sunxi-dsufreq 8860000.dsufreq: _opp_add: OPP not supported by regulators (528000000)
[    5.147758][    T1] FAT-fs (mmcblk0p26): bogus number of reserved sectors
[    5.156188][  T117] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    5.163701][    T1] FAT-fs (mmcblk0p26): Can't find a valid FAT filesystem
[    5.174545][  T117] sunxi-dsufreq 8860000.dsufreq: _opp_add: OPP not supported by regulators (600000000)
[    5.182159][    T1] init: mount media_data fail*****Invalid argument
[    5.192705][  T117] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    5.210415][  T117] sunxi-dsufreq 8860000.dsufreq: _opp_add: OPP not supported by regulators (744000000)
[    5.219149][    T1] init: Using Android DT directory /proc/device-tree/firmware/android/
[    5.221086][  T117] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    5.233982][    T1] init: Couldn't load property file '/vendor/default.prop': open() failed: No such file or directory: No such file or directory
[    5.240734][  T117] sunxi-dsufreq 8860000.dsufreq: _opp_add: OPP not supported by regulators (792000000)
[    5.240807][  T117] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    5.257627][    T1] init: Couldn't load property file '/odm_dlkm/etc/build.prop': open() failed: No such file or directory: No such file or directory
[    5.265886][  T117] sunxi-dsufreq 8860000.dsufreq: _opp_add: OPP not supported by regulators (840000000)
[    5.265955][  T117] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    5.277404][    T1] init: Couldn't load property file '/oem/build.prop': open() failed: No such file or directory: No such file or directory
[    5.291526][  T117] sunxi-dsufreq 8860000.dsufreq: _opp_add: OPP not supported by regulators (888000000)
[    5.291596][  T117] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    5.302488][    T1] init: Could not set 'ro.boot.dynamic_partitions' to 'true' while loading .prop filesRead-only property was already set
[    5.312793][  T117] sunxi-dsufreq 8860000.dsufreq: _opp_add: OPP not supported by regulators (912000000)
[    5.312858][  T117] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    5.326898][    T1] init: Could not set 'ro.boot.dynamic_partitions_retrofit' to 'true' while loading .prop filesRead-only property was already set
[    5.337453][  T117] sunxi-dsufreq 8860000.dsufreq: _opp_add: OPP not supported by regulators (984000000)
[    5.337522][  T117] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    5.348750][    T1] init: Setting product property ro.product.brand to 'Allwinner' (from ro.product.product.brand)
[    5.362023][  T117] sunxi-dsufreq 8860000.dsufreq: _opp_add: OPP not supported by regulators (1032000000)
[    5.362089][  T117] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    5.372630][    T1] init: Setting product property ro.product.device to 'a733-demo-aiot' (from ro.product.product.device)
[    5.383287][  T117] sunxi-dsufreq 8860000.dsufreq: _opp_add: OPP not supported by regulators (1056000000)
[    5.383352][  T117] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    5.485850][  T117] sunxi-dsufreq 8860000.dsufreq: _opp_add: OPP not supported by regulators (1152000000)
[    5.496624][  T117] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    5.507329][  T117] sunxi-dsufreq 8860000.dsufreq: _opp_add: OPP not supported by regulators (1200000000)
[    5.511106][  T184] random: init: uninitialized urandom read (40 bytes read)
[    5.518096][  T117] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    5.536625][  T117] sunxi-dsufreq 8860000.dsufreq: _opp_add: OPP not supported by regulators (1224000000)
[    5.547448][  T117] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    5.558134][  T117] sunxi-dsufreq 8860000.dsufreq: _opp_add: OPP not supported by regulators (1296000000)
[    5.568887][  T117] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    5.579571][  T117] sunxi-dsufreq 8860000.dsufreq: _opp_add: OPP not supported by regulators (546000000)
[    5.590325][  T117] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    5.601006][  T117] sunxi-dsufreq 8860000.dsufreq: _opp_add: OPP not supported by regulators (832000000)
[    5.611878][  T117] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    5.622568][  T117] sunxi-dsufreq 8860000.dsufreq: _opp_add: OPP not supported by regulators (1196000000)
[    5.633432][  T117] core: _opp_supported_by_regulators: OPP minuV: 0 maxuV: 0, not supported by regulator
[    5.644114][  T117] sunxi-dsufreq 8860000.dsufreq: _opp_add: OPP not supported by regulators (1352000000)
[    5.654927][  T117] [drm] [DSI-PANEL] panel_dsi_probe start
[    5.661354][  T117] [drm] reset-on-sequence property not found
[    5.668136][  T117] [drm] [DSI]sunxi_drm_dsi_host_attach start
[    5.674668][  T117] [drm] [DSI]sunxi_drm_dsi_host_attach finish
[    5.681272][  T117] [drm] [DSI-PANEL] panel_dsi_probe finish
[    5.687866][  T117] [drm] sunxi_drm_bind start
[    5.692983][  T117] [drm] [TCON_TOP]sunxi_tcon_top_bind start
[    5.699517][  T117] sunxi-drm soc@3000000:sunxi-drm: bound 5500000.vo0 (ops sunxi_tcon_top_component_ops [sunxidrm])
[    5.711367][  T117] [drm] [TCON_TOP]sunxi_tcon_top_bind start
[    5.717820][  T117] sunxi-drm soc@3000000:sunxi-drm: bound 5510000.vo1 (ops sunxi_tcon_top_component_ops [sunxidrm])
[    5.729663][  T117] [drm] [SUNXI-DE] sunxi_de_bind start
[    5.735620][  T117] sunxi-drm soc@3000000:sunxi-drm: Adding to iommu group 0
[    5.743626][  T117] [drm] sunxi_de_bind crtc init for de 0 ok
[    5.750086][  T117] [drm] sunxi_de_bind crtc init for de 1 ok
[    5.757000][  T117] sunxi-drm soc@3000000:sunxi-drm: bound 5000000.de (ops sunxi_de_component_ops [sunxidrm])
[    5.768182][  T117] sunxi-drm soc@3000000:sunxi-drm: bound 5507000.phy (ops sunxi_cphy_component_ops [sunxi_drm_phy])
[    5.780041][  T117] [drm] [DSI]sunxi_drm_dsi_bind start
[    5.786045][  T117] [drm] [SUNXI-TCON] sunxi_tcon_of_get_id 0
[    5.787979][  T188] linkerconfig: Unable to access VNDK APEX at path: /apex/com.android.vndk.v33: No such file or directory
[    5.792489][  T117] sunxi-drm soc@3000000:sunxi-drm: bound 5506000.dsi0 (ops sunxi_drm_dsi_component_ops [sunxidrm])
[    5.805116][  T188] linkerconfig: Unable to access VNDK APEX at path: /apex/com.android.vndk.v33: No such file or directory
[    5.816785][  T117] [drm] [SUNXI-TCON] sunxi_tcon_of_get_id 4
[    5.831259][  T188] linkerconfig (188) used greatest stack depth: 11104 bytes left
[    5.835909][  T117] [drm] sunxi-hdmi: hdmi drv init dts done
[    5.851357][  T117] [drm] sunxi-hdmi: hdmi drv enable resource done
[    5.858364][  T117] [drm] sunxi-hdmi: hdmi drv init resource done
[    5.865265][  T117] [drm] sunxi-hdmi: hdmi drv init i2c adapter finish
[    5.865619][  T189] ueventd: ueventd started!
[    5.878252][  T117] [drm] sunxi-hdmi: drm hdmi connector create finish
[    5.879202][  T189] selinux: SELinux: Loaded file_contexts
[    5.885578][  T117] [drm] sunxi-hdmi: hdmi devices bind done <<<<<<<<<<
[    5.885578][  T117]
[    5.885591][  T117] sunxi-drm soc@3000000:sunxi-drm: bound 5520000.hdmi (ops sunxi_hdmi_compoent_ops [sunxidrm])
[    5.891794][  T189] selinux:
[    5.898693][  T190] apexd: Bootstrap subcommand detected
[    5.898765][  T190] apexd: ActivateFlattenedApex
[    5.898801][  T190] apexd: Scanning /system/apex
[    5.899419][  T190] apexd: Bind mounting /system/apex/com.android.adbd onto /apex/com.android.adbd
[    5.900047][  T190] apexd: Bind mounting /system/apex/com.android.adservices onto /apex/com.android.adservices
[    5.900637][  T190] apexd: Bind mounting /system/apex/com.android.appsearch onto /apex/com.android.appsearch
[    5.901214][  T190] apexd: Bind mounting /system/apex/com.android.art onto /apex/com.android.art
[    5.901543][  T117] sunxi-drm soc@3000000:sunxi-drm: bound 5501000.tcon0 (ops sunxi_tcon_component_ops [sunxidrm])
[    5.901818][  T190] apexd: Bind mounting /system/apex/com.android.btservices onto /apex/com.android.btservices
[    5.902431][  T190] apexd: Bind mounting /system/apex/com.android.conscrypt onto /apex/com.android.conscrypt
[    5.902952][  T190] apexd: Bind mounting /system/apex/com.android.extservices onto /apex/com.android.extservices
[    5.913451][  T189] ueventd: Parsing file /system/etc/ueventd.rc...
[    5.916216][  T117] sunxi-drm soc@3000000:sunxi-drm: bound 5730000.tcon3 (ops sunxi_tcon_component_ops [sunxidrm])
[    5.922254][  T189] ueventd: Added '/vendor/etc/ueventd.rc' to import list
[    5.923944][  T190] printk: apexd: 24 output lines suppressed due to ratelimiting
[    5.924165][  T190] apexd (190) used greatest stack depth: 10464 bytes left
[    5.927303][  T117] sunxi-drm soc@3000000:sunxi-drm: bound 5731000.tcon4 (ops sunxi_tcon_component_ops [sunxidrm])
[    5.932561][  T189] ueventd: Added '/odm/etc/ueventd.rc' to import list
[    5.942755][   T80] audit: type=1400 audit(1748526561.440:3): avc:  denied  { sys_admin } for  pid=117 comm="kworker/u16:2" capability=21  scontext=u:r:kernel:s0 tcontext=u:r:kernel:s0 tclass=capability permissive=1
[    5.945132][  T117] [drm] [SUNXI-CRTC]sunxi_crtc_atomic_enable
[    5.945137][  T117] [drm] sunxi_de_enable index 0
[    5.949771][  T117] [drm] sunxi_de_enable finish sw en=1
[    5.949787][  T117] [drm] [DSI] sunxi_drm_dsi_encoder_atomic_enable vrr_setp:0 start
[    5.949789][  T117] [drm] [DSI] sunxi_tcon_dsi_mode_init start
[    5.949909][  T117] [drm] [DSI] sunxi_lcd_pin_set_state start
[    5.954570][  T189] ueventd: Parsing file /vendor/etc/ueventd.rc...
[    6.095342][  T197] random: boringssl_self_: uninitialized urandom read (40 bytes read)
[    6.102506][  T189] ueventd: Parsing file /odm/etc/ueventd.rc...
[    6.131448][  T198] random: prng_seeder: uninitialized urandom read (40 bytes read)
[    6.135110][  T189] ueventd: Unable to read config file '/odm/etc/ueventd.rc': open() failed: No such file or directory
[    6.136105][  T199] random: boringssl_self_: uninitialized urandom read (40 bytes read)
[    6.172749][  T117] [drm] [DSI] sunxi_drm_dsi_encoder_atomic_enable finish
[    6.188569][  T198] prng_seeder: Hanging forever because setup failed: Unable to open hwrng /dev/hw_random
[    6.188569][  T198]
[    6.208178][  T117] [drm] Initialized sunxi-drm 3.0.0 20230901 for soc@3000000:sunxi-drm on minor 0
[    6.214976][  T198] Caused by:
[    6.216997][   T80] audit: type=1400 audit(1748526561.712:4): avc:  denied  { search } for  pid=184 comm="init" name="/" dev="dm-4" ino=2 scontext=u:r:vendor_init:s0 tcontext=u:object_r:system_dlkm_file:s0 tclass=dir permissive=1
[    6.224886][  T117] [drm] sunxi_drm_bind ok
[    6.226074][  T184] sunxi-rfkill soc@3000000:rfkill: module version: v1.1.4
[    6.226269][  T117] i2c i2c-2: of_i2c: modalias failure on /soc@3000000/twi@2512000/focaltech@38
[    6.226273][  T117] i2c i2c-2: Failed to create I2C device for /soc@3000000/twi@2512000/focaltech@38
[    6.226319][  T117] sunxi:twi-2512000.twi:[INFO]: v2.7.4 probe success
[    6.227254][  T117] sunxi:twi-2513000.twi:[INFO]: v2.7.4 probe success
[    6.228366][  T117] sunxi-cadence-combophy 6c00000.serdes: Sub System Version v2.0.0
[    6.228651][  T198]     No such file or directory (os error 2)
[    6.283755][  T184] sunxi-rfkill soc@3000000:rfkill: pinctrl_lookup_state(default) failed! return ffffffffffffffed
[    6.312737][  T189] ueventd: Coldboot took 0.127 seconds
[    6.320158][  T184] sunxi-rfkill soc@3000000:rfkill: get gpio chip_en failed
[    6.339567][  T184] sunxi-rfkill soc@3000000:rfkill: get gpio power_en failed
[    6.347617][  T184] sunxi-rfkill soc@3000000:rfkill: wlan_busnum (1)
[    6.355182][  T184] sunxi-rfkill soc@3000000:rfkill: wlan power[0] (axp8191-dcdc1) voltage: 3300mV
[    6.365441][  T184] sunxi-rfkill soc@3000000:rfkill: wlan power[1] (axp8191-bldo5) voltage: 1800mV
[    6.375694][  T184] sunxi-rfkill soc@3000000:rfkill: wlan power[2] (axp8191-cldo1) voltage: 1800mV
[    6.385726][  T184] sunxi-rfkill soc@3000000:rfkill: wlan_regon gpio=385 assert=1
[    6.394097][  T184] sunxi-rfkill soc@3000000:rfkill: wlan_hostwake gpio=384 assert=1
[    6.402743][  T184] sunxi-rfkill soc@3000000:rfkill: wakeup source is enabled
[    6.410703][  T184] sunxi-rfkill soc@3000000:rfkill: wlan power boot-on: 0, always-on: 0
[    6.419999][  T184] sunxi-rfkill soc@3000000:rfkill: bt power[0] (axp8191-dcdc1) voltage: 3300mV
[    6.430136][  T184] sunxi-rfkill soc@3000000:rfkill: bt power[1] (axp8191-bldo5) voltage: 1800mV
[    6.440266][  T184] sunxi-rfkill soc@3000000:rfkill: bt power[2] (axp8191-cldo1) voltage: 1800mV
[    6.450122][  T184] sunxi-rfkill soc@3000000:rfkill: bt_rst gpio=386 assert=0
[    6.458111][  T184] sunxi-rfkill soc@3000000:rfkill: bluetooth power boot-on: 0, always-on: 0
[    6.527208][    T1] Registered swp emulation handler
[    6.583577][  T184] g2d 5440000.g2d: Adding to iommu group 0
[    6.584547][  T212] logd.auditd: start
[    6.591007][  T184] sunxi:g2d_sunxi:[INFO]: [G2D]: rcq version initialized.major:505
[    6.594231][  T212] logd.klogd: 6418075835
[    6.602808][  T184] sunxi:g2d_sunxi:[INFO]: [G2D]: g2d_module_init
console:/ $ [    6.618121][  T212] logd: Loaded bug_map file: /system_ext/etc/selinux/bug_map
[    6.626659][  T212] logd: Loaded bug_map file: /vendor/etc/selinux/selinux_denial_metadata
[    6.636575][  T212] logd: Loaded bug_map file: /system/etc/selinux/bug_map
[    6.643045][  T219] treadahead: /treadahead/readahead_file_offset not exist;
[    6.652380][  T219] treadahead: go to open trace
[    6.686710][    T1] mke2fs: mke2fs 1.46.2 (28-Feb-2021)
[    6.692604][    T1] mke2fs: Discarding device blocks: done
[    6.703208][    T1] mke2fs: Creating filesystem with 4096 4k blocks and 4096 inodes
[    6.711758][    T1] mke2fs:
[    6.714970][    T1] mke2fs: Allocating group tables: done
[    6.724875][    T1] mke2fs: Writing inode tables: done
[    6.734495][    T1] mke2fs: Creating journal (1024 blocks): done
[    6.741203][    T1] mke2fs: Writing superblocks and filesystem accounting information: done
[    6.751691][    T1] mke2fs:
[    6.781266][    T1] e2fsdroid: Created filesystem with 11/4096 inodes and 1545/4096 blocks
[    6.792430][    T1] EXT4-fs (mmcblk0p21): Ignoring removed nomblk_io_submit option
[    6.803250][    T1] EXT4-fs (mmcblk0p21): mounted filesystem with ordered data mode. Opts: errors=remount-ro,nomblk_io_submit. Quota mode: none.
[    6.876619][    T1] EXT4-fs (mmcblk0p21): mounted filesystem with ordered data mode. Opts: errors=panic. Quota mode: none.
[    6.999862][    T1] EXT4-fs (mmcblk0p22): Ignoring removed nomblk_io_submit option
[    7.010725][    T1] EXT4-fs (mmcblk0p22): mounted filesystem with ordered data mode. Opts: errors=remount-ro,nomblk_io_submit. Quota mode: none.
[    7.052736][    T1] EXT4-fs (mmcblk0p22): mounted filesystem with ordered data mode. Opts: errors=panic. Quota mode: none.
[    7.098465][  T251] random: newfs_msdos: uninitialized urandom read (40 bytes read)
[    7.194125][  T229] type=1400 audit(1748526562.692:5): avc: denied { getattr } for comm="init" path="/sys/kernel/debug/devices_deferred" dev="debugfs" ino=11811 scontext=u:r:init:s0 tcontext=u:object_r:debugfs:s0 tclass=file permissive=1
[    7.218829][  T229] type=1400 audit(1748526562.692:6): avc: denied { getattr } for comm="init" path="/sys/kernel/debug/wakeup_sources" dev="debugfs" ino=1048 scontext=u:r:init:s0 tcontext=u:object_r:debugfs_wakeup_sources:s0 tclass=file permissive=1
[    7.289947][  T257] AW_keymint_2 : starting aw keymint service
[    7.290616][  T257] AW_keymint_2 : no optee, use software keymint
[    7.332656][  T257] AW_keymint_2 : adding keymint service instance: android.hardware.security.keymint.IKeyMintDevice/default
[    7.340360][  T257] AW_keymint_2 : adding keymint service instance: android.hardware.security.secureclock.ISecureClock/default
[    7.353464][  T257] AW_keymint_2 : adding keymint service instance: android.hardware.security.sharedsecret.ISharedSecret/default
[    7.366575][  T257] AW_keymint_2 : adding keymint service instance: android.hardware.security.keymint.IRemotelyProvisionedComponent/default
[    7.380207][  T257] AW_keymint_2 : start aw keymint service ok
[    9.361924][    T1] EXT4-fs (mmcblk0p29): Ignoring removed nomblk_io_submit option
[    9.381124][    T1] EXT4-fs (mmcblk0p29): mounted filesystem with ordered data mode. Opts: errors=remount-ro,nomblk_io_submit. Quota mode: journalled.
[    9.480150][    C6] random: crng init done
[    9.484731][    C6] random: 84 urandom warning(s) missed due to ratelimiting
[    9.604721][    T1] EXT4-fs (mmcblk0p29): Ignoring removed nomblk_io_submit option
[    9.613270][    T1] EXT4-fs (mmcblk0p29): Using encoding defined by superblock: utf8-12.1.0 with flags 0x0
[    9.631024][    T1] EXT4-fs (mmcblk0p29): mounted filesystem with ordered data mode. Opts: barrier=1,data=ordered,nomblk_io_submit,noauto_da_alloc,errors=panic,resuid=0,resgid=1065. Quota mode: journalled.
[    9.704261][  T184] pvrsrvkm: loading out-of-tree module taints kernel.
[    9.735350][  T184] [sunxi bxm]SysDevInit start!
[    9.740526][  T184] pvrsrvkm 1800000.gpu: sunxi_platform_init start
[    9.747581][  T184] pvrsrvkm 1800000.gpu: warning: default clk_rate is NOT set in DTS, set it to default:600000000
[    9.759138][  T184] pvrsrvkm 1800000.gpu: sunxi_parse_dts clk_rate:600000000
[    9.768272][  T184] pvrsrvkm 1800000.gpu: succeed to get gpu regulator, default volt value:800000
[    9.778315][  T184] pvrsrvkm 1800000.gpu: get opp:(400000000 hz, 800000 uv)
[    9.786097][  T184] pvrsrvkm 1800000.gpu: get opp:(600000000 hz, 800000 uv)
[    9.793865][  T184] pvrsrvkm 1800000.gpu: get opp:(800000000 hz, 840000 uv)
[    9.801636][  T184] pvrsrvkm 1800000.gpu: get opp:(1008000000 hz, 960000 uv)
[    9.809500][  T184] pvrsrvkm 1800000.gpu: opp count:4
[    9.815135][  T184] pvrsrvkm 1800000.gpu: set default clk_rate to max opp freq:1008000000
[    9.824260][  T184] pvrsrvkm 1800000.gpu: sunxi_parse_dts finished
[    9.831273][  T184] pvrsrvkm 1800000.gpu: sunxi_set_device_clk_rate:1008000000
[    9.839353][  T184] pvrsrvkm 1800000.gpu: sunxi_platform_init end
[    9.846159][  T184] [sunxi bxm]SysDevInit end!
[    9.851140][  T184] pvrsrvkm 1800000.gpu: sunxiPrePowerState ePwrFlags:1 current power status:1 1
[    9.861047][  T184] pvrsrvkm 1800000.gpu: sunxiPostPowerState ePwrFlags:1 current power status:1 1
[    9.871049][  T184] PVR_K:  184: Read BVNC 36.56.104.183 from HW device registers
[    9.879399][  T184] pvrsrvkm 1800000.gpu: sunxiPrePowerState ePwrFlags:1 current power status:1 1
[    9.889309][  T184] pvrsrvkm 1800000.gpu: sunxiPostPowerState ePwrFlags:1 current power status:1 1
[    9.899350][  T184] PVR_K:  184: RGX Device registered BVNC 36.56.104.183 with 1 core in the system
[    9.909820][  T184] pvrsrvkm 1800000.gpu: Found 4 OPP points.
[    9.916239][  T184] pvrsrvkm 1800000.gpu: opp[1/4]: (400000000 Hz, 800000 uV)
[    9.924206][  T184] pvrsrvkm 1800000.gpu: opp[2/4]: (600000000 Hz, 800000 uV)
[    9.932170][  T184] pvrsrvkm 1800000.gpu: opp[3/4]: (800000000 Hz, 840000 uV)
[    9.940133][  T184] pvrsrvkm 1800000.gpu: opp[4/4]: (1008000000 Hz, 960000 uV)
[    9.949382][  T184] [drm] Initialized pvr 24.2.6643903 20170530 for 1800000.gpu on minor 1
[   10.073537][  T226] vold: keystore2 Keystore earlyBootEnded returned service specific error: -68
[   10.096527][    T1] init: Not setting encryption policy on: /data/apex
[   10.108086][    T1] init: Inferred action different from explicit one, expected 0 but got 2
[   10.120795][    T1] init: Inferred action different from explicit one, expected 0 but got 3
[   10.121294][  T225] logd: logd reinit
[   10.131331][    T1] init: Inferred action different from explicit one, expected 0 but got 2
[   10.134684][  T225] logd: Cannot read /data/misc/logd/event-log-tags
[   10.145083][    T1] init: starting service 'apexd'...
[   10.151673][  T225] logd: FrameworkListener: read() failed (Connection reset by peer)
[   10.158952][    T1] init: Service 'logd-reinit' (pid 289) exited with status 0 oneshot service took 0.065000 seconds in background
[   10.178530][    T1] init: Sending signal 9 to service 'logd-reinit' (pid 289) process group...
[   10.186057][  T290] apexd: This device does not support updatable APEX. Exiting
[   10.188691][    T1] libprocessgroup: Successfully killed process cgroup uid 1036 pid 289 in 0ms
[   10.196399][  T290] apexd: Marking APEXd as activated
[   10.207566][    T1] init: Command 'copy /data/misc/recovery/ro.build.fingerprint /data/misc/recovery/ro.build.fingerprint.1' action=post-fs-data (/system/etc/init/hw/init.rc:754) took 0ms and failed: Could not read input file '/data/misc/recovery/ro.build.fingerprint': open() failed: No such file or directory
[   10.242371][    T1] init: Service 'apexd' (pid 290) exited with status 0 oneshot service took 0.084000 seconds in background
[   10.446885][  T295] vdc: Waited 0ms for vold
[   10.498427][  T226] vold: Failed to chmod /data/system_ce/0: No such file or directory
[   10.507563][  T226] vold: Failed to chmod /data/misc_ce/0: No such file or directory
[   10.516427][  T226] vold: Failed to chmod /data/media/0: No such file or directory
[   10.727306][  T301] apexd: This device does not support updatable APEX. Exiting
[   10.735722][  T301] apexd: Marking APEXd as ready
[   10.793386][  T184] init: Top-level directory needs encryption action, eg mkdir /data/audio_d <mode> <uid> <gid> encryption=Require
[   10.828546][  T184] init: Inferred action different from explicit one, expected 0 but got 2
[   10.841725][    T1] WARNING: Unprivileged eBPF is enabled, data leaks possible via Spectre v2 BHB attacks!
[   10.879971][  T305] bpfloader: Override /apex/com.android.tethering/etc/bpf/offload.o with /system/etc/bpf-override/offload.o
[   10.893957][  T305] LibBpfLoader: Loading critical for tethering ELF object /system/etc/bpf-override/offload.o with license Apache 2.0
[   10.907540][  T305] LibBpfLoader: Section bpfloader_min_ver value is 2 [0x2]
[   10.915478][  T305] LibBpfLoader: Section bpfloader_max_ver value is 65536 [0x10000]
[   10.924190][  T305] LibBpfLoader: Section size_of_bpf_map_def value is 116 [0x74]
[   10.932613][  T305] LibBpfLoader: Section size_of_bpf_prog_def value is 92 [0x5c]
[   10.940970][  T305] LibBpfLoader: BpfLoader version 0x00013 processing ELF object /system/etc/bpf-override/offload.o with ver [0x00002,0x10000)
[   10.958101][  T305] LibBpfLoader: Loaded code section 3 (schedcls_tether_downstream6_ether)
[   10.967725][  T305] LibBpfLoader: Loaded relo section 3 (.relschedcls/tether_downstream6_ether)
[   10.977447][  T305] LibBpfLoader: Adding section 3 to cs list
[   11.183655][  T305] printk: bpfloader: 1670 output lines suppressed due to ratelimiting
[   11.222764][  T308] update_verifier: Started with arg 1: nonencrypted
[   11.233363][  T308] update_verifier: Booting slot 0: isSlotMarkedSuccessful=1
[   11.241388][  T308] update_verifier: Leaving update_verifier.
[   11.343807][  T315] sunxi-rfkill soc@3000000:rfkill: wlan power on success
[   11.344486][  T184] [Awinic] aw87xxx_pa_init:driver version: v2.14.0
[   11.359212][  T184] [Awinic] [14-0058]aw87xxx_dtsi_parse: get det_battery_supply failed
[   11.359212][  T184]
[   11.371639][  T184] [Awinic] [14-0059]aw87xxx_dtsi_parse: get det_battery_supply failed
[   11.371639][  T184]
[   11.401134][  T184] sunxi:sound-i2s:[WARN]: 2206 snd_sunxi_dts_params_init(): clk-en-post-delay missing
[   11.411709][  T184] sunxi:sound-i2s:[WARN]: 2214 snd_sunxi_dts_params_init(): clk-keep missing
[   11.421777][  T184] sunxi:sound-i2s:[WARN]: 2206 snd_sunxi_dts_params_init(): clk-en-post-delay missing
[   11.432302][  T184] sunxi:sound-i2s:[WARN]: 2214 snd_sunxi_dts_params_init(): clk-keep missing
[   11.446002][  T184] sunxi:sound-ac101:[INFO]: 2626 ac101_i2c_probe():
[   11.451768][  T315] misc sunxi-wlan: start scan device on bus_index: 1
[   11.453414][  T184] sunxi:sound-ac101:[ERR]: 2592 ac101_set_params_from_of(): det_gpio        -> 34
[   11.460668][   T95] sunxi:sunxi_mmc_host-4021000.sdmmc:[INFO]: sdc set ios:clk 0Hz bm PP pm UP vdd 21 width 1 timing LEGACY(SDR12) dt B
[   11.470750][  T184] sunxi:sound-ac101:[ERR]: 2593 ac101_set_params_from_of(): plug_gpio        -> 313
[   11.495768][  T184] sunxi:sound-common:[INFO]: 36 snd_sunxi_pa_user_trig_init(): pa user mode -> init
[   11.496150][   T95] sunxi:sunxi_mmc_host-4021000.sdmmc:[INFO]: sdc set ios:clk 400000Hz bm PP pm ON vdd 21 width 1 timing LEGACY(SDR12) dt B
[   11.506090][  T184] sunxi:sound-common:[INFO]: 36 snd_sunxi_pa_user_trig_init(): pa user mode -> init
[   11.533005][    C0] sunxi:sunxi_mmc_host-4021000.sdmmc:[ERR]: smc 1 p1 err, cmd 52, RTO !!
[   11.543098][    C0] sunxi:sunxi_mmc_host-4021000.sdmmc:[ERR]: smc 1 p1 err, cmd 52, RTO !!
[   11.552374][   T95] sunxi:sunxi_mmc_host-4021000.sdmmc:[INFO]: sdc set ios:clk 400000Hz bm PP pm ON vdd 21 width 1 timing LEGACY(SDR12) dt B
[   11.569459][   T95] sunxi:sunxi_mmc_host-4021000.sdmmc:[INFO]: sdc set ios:clk 400000Hz bm PP pm ON vdd 21 width 1 timing LEGACY(SDR12) dt B
[   11.585843][    C0] sunxi:sunxi_mmc_host-4021000.sdmmc:[ERR]: smc 1 p1 err, cmd 11, RE !!
[   11.595029][   T95] sunxi:sunxi_mmc_host-4021000.sdmmc:[INFO]: sdc set ios:clk 0Hz bm PP pm OFF vdd 0 width 1 timing LEGACY(SDR12) dt B
[   11.610981][  T184] sunxi:sound-codec-hdmi:[ERR]: 442 sunxi_codec_dev_probe(): register codec-hdmi success
[   11.611256][   T95] sunxi:sunxi_mmc_host-4021000.sdmmc:[INFO]: sdc set ios:clk 0Hz bm PP pm UP vdd 21 width 1 timing LEGACY(SDR12) dt B
[   11.637540][  T184] sunxi:sound-mach:[WARN]: 372 asoc_simple_parse_ucfmt(): set data late to default
[   11.648055][   T95] sunxi:sunxi_mmc_host-4021000.sdmmc:[INFO]: sdc set ios:clk 400000Hz bm PP pm ON vdd 21 width 1 timing LEGACY(SDR12) dt B
[   11.662907][   T94] platform boost5v-en: deferred probe pending
[   11.689441][   T95] mmc1: queuing unknown CIS tuple 0x10 [07 00 11 00 8e] (5 bytes)
[   11.703261][   T95] sunxi:sunxi_mmc_host-4021000.sdmmc:[INFO]: sdc set ios:clk 50000000Hz bm PP pm ON vdd 21 width 1 timing LEGACY(SDR12) dt B
[   11.704497][  T184] sunxi:sound-ac101:[INFO]: 1529 ac101_probe(): wait ac101 reset successfully, need 0x101/257
[   11.717684][   T95] sunxi:sunxi_mmc_host-4021000.sdmmc:[INFO]: sdc set ios:clk 50000000Hz bm PP pm ON vdd 21 width 4 timing LEGACY(SDR12) dt B
[   11.741916][  T184] debugfs: Directory '2532000.i2s0_plat' with parent 'sndi2s0' already present!
[   11.743293][   T95] mmc1: queuing unknown CIS tuple 0x10 [07 00 31 00 32] (5 bytes)
[   11.753048][  T160] sunxi:sound-ac101:[INFO]: 531 sunxi_jack_adv_det_scan_work():
[   11.770114][  T160] [sound] jack report -> OUT
[   11.775378][   T95] mmc1: new SDIO card at address ac4d
[   11.776478][  T184] input: sndi2s0 Headphones as /devices/platform/soc@3000000/soc@3000000:i2s0_mach/sound/card0/input1
[   11.784648][  T315] sunxi-rfkill soc@3000000:rfkill: wlan power off success
[   11.793712][  T184] sunxi:sound-mach:[WARN]: 372 asoc_simple_parse_ucfmt(): set data late to default
[   11.801118][  T315] misc sunxi-wlan: start scan device on bus_index: 1
[   11.811664][  T184] debugfs: Directory '2535000.i2s3_plat' with parent 'sndhdmi' already present!
[   11.818680][    C0] sunxi:sunxi_mmc_host-4021000.sdmmc:[ERR]: smc 1 p1 err, cmd 7, RTO !!
[   11.837682][    C0] sunxi:sunxi_mmc_host-4021000.sdmmc:[ERR]: smc 1 p1 err, cmd 7, RTO !!
[   11.846907][    C0] sunxi:sunxi_mmc_host-4021000.sdmmc:[ERR]: smc 1 p1 err, cmd 7, RTO !!
[   11.856110][    C0] sunxi:sunxi_mmc_host-4021000.sdmmc:[ERR]: smc 1 p1 err, cmd 7, RTO !!
[   11.856901][  T184] npu[b8][b8] vipcore, platform driver init
[   11.871918][   T95] mmc1: card ac4d removed
[   11.872407][  T184] npu[b8][b8] vipcore, insmod param cpu_physical=0x0
[   11.876690][   T95] sunxi:sunxi_mmc_host-4021000.sdmmc:[INFO]: sdc set ios:clk 0Hz bm PP pm OFF vdd 0 width 1 timing LEGACY(SDR12) dt B
[   11.884000][  T184] npu[b8][b8] vipcore, insmod param cpu_physical=0x0
[   11.898907][   T95] sunxi:sunxi_mmc_host-4021000.sdmmc:[INFO]: sdc set ios:clk 0Hz bm PP pm UP vdd 21 width 1 timing LEGACY(SDR12) dt B
[   11.905459][  T184] npu[b8][b8] vipcore, insmod param cpu_physical=0x0
[   11.919205][  T315] aicbsp_init
[   11.926452][  T184] npu[b8][b8] vipcore, insmod param cpu_physical=0x0
[   11.929400][   T95] sunxi:sunxi_mmc_host-4021000.sdmmc:[INFO]: sdc set ios:clk 400000Hz bm PP pm ON vdd 21 width 1 timing LEGACY(SDR12) dt B
[   11.929504][  T315] aicbsp_init, Driver Release Tag: aic-bsp-compatible(sdio)-20240730-002
[   11.936851][  T184] npu[b8][b8] vipcore, platform device compatible=allwinner,npu
[   11.951401][  T315] -->aicbt_rfkill_init
[   11.951716][    C0] sunxi:sunxi_mmc_host-4021000.sdmmc:[ERR]: smc 1 p1 err, cmd 52, RTO !!
[   11.960349][  T184] npu[b8][b8] vipcore, platform driver device=0xffffff80c0b7e410
[   11.968565][  T315] <--aicbt_rfkill_init
[   11.969279][    C0] sunxi:sunxi_mmc_host-4021000.sdmmc:[ERR]: smc 1 p1 err, cmd 52, RTO !!
[   11.972957][  T184] npu[b8][b8] clock_rate: 26000000
[   11.982153][   T95] sunxi:sunxi_mmc_host-4021000.sdmmc:[INFO]: sdc set ios:clk 400000Hz bm PP pm ON vdd 21 width 1 timing LEGACY(SDR12) dt B
[   11.990777][  T184] npu[b8][b8] vipcore irq number is 463.
[   11.997953][   T95] sunxi:sunxi_mmc_host-4021000.sdmmc:[INFO]: sdc set ios:clk 400000Hz bm PP pm ON vdd 21 width 1 timing LEGACY(SDR12) dt B
[   12.004224][  T184] npu[b8][b8] npu power domains status: 0
[   12.004941][  T315] [BT_LPM] bluesleep_init: BlueSleep Mode Driver Ver 1.3.3
[   12.004949][  T315] [BT_LPM] bluesleep_init: Driver Release Tag: aic-btlpm-20220429-008
[   12.005329][  T315] [BT_LPM] bluesleep_probe: bt_hostwake gpio=388 assert=1
[   12.005329][  T315]
[   12.005333][  T315] [BT_LPM] bluesleep_probe: override host_wake assert to 1
[   12.005367][  T315] [BT_LPM] bluesleep_probe: wakeup source is disabled!
[   12.005367][  T315]
[   12.005380][  T315] [BT_LPM] bluesleep_probe: bt_wake gpio=387 assert=1
[   12.005380][  T315]
[   12.005384][  T315] [BT_LPM] bluesleep_probe: override ext_wake assert to 1
[   12.005400][  T315] [BT_LPM] bluesleep_probe: uart_index (1)
[   12.005400][  T315]
[   12.012191][    C0] sunxi:sunxi_mmc_host-4021000.sdmmc:[ERR]: smc 1 p1 err, cmd 5, RTO !!
[   12.023847][  T184] NPU AXI CLK NULL
[   12.030788][    C0] sunxi:sunxi_mmc_host-4021000.sdmmc:[ERR]: smc 1 p1 err, cmd 5, RTO !!
[   12.044049][  T184] NPU AHB CLK NULL
[   12.051092][    C0] sunxi:sunxi_mmc_host-4021000.sdmmc:[ERR]: smc 1 p1 err, cmd 5, RTO !!
[   12.058151][  T184] NPU TZMA CLK NULL
[   12.067894][    C0] sunxi:sunxi_mmc_host-4021000.sdmmc:[ERR]: smc 1 p1 err, cmd 5, RTO !!
[   12.077302][  T184] npu[b8][b8] EXTRA: 0x00005100, SID: 0x0, max_freq: 1100000000, default_freq: 1100000000
[   12.085225][   T95] sunxi:sunxi_mmc_host-4021000.sdmmc:[INFO]: sdc set ios:clk 0Hz bm PP pm OFF vdd 0 width 1 timing LEGACY(SDR12) dt B
[   12.095058][  T184] npu[b8][b8] current dvfs: 0, vf index: 0
[   12.095174][  T184] vipcore 3600000.npu: dev_pm_opp_set_regulators: no regulator (npu) found: -19
[   12.210697][  T184] npu[b8][b8] failed to set opp regulator
[   12.216944][  T184] npu[b8][b8] enable aw vip devfreq
[   12.222590][  T184] npu[b8][b8] no available freq info
[   12.228375][  T184] vipcore 3600000.npu: supply npu not found, using dummy regulator
[   12.237305][  T184] npu[b8][b8] vipcore, device_cnt=1, core_cnt=1
[   12.244308][  T184] npu[b8][b8] core_0, request irqline=463, name=vipcore_0
[   12.252171][  T184] npu[b8][b8] vipcore, allocate page for video memory, size: 0x400000 bytes
[   12.263004][  T184] npu[b8][b8] vipcore, heap_cnt=0, reserved video memory cpu_phy=0x11ac00000, vip_phy=0x11ac00000, size=0x400000
[   12.276294][  T184] npu[b8][b8] VIPLite driver version 2.0.3.0-AW-2024-05-29
[   12.308072][  T229] type=1400 audit(1748526567.804:10): avc: denied { write } for comm="init" name="discard_max_bytes" dev="sysfs" ino=39324 scontext=u:r:init:s0 tcontext=u:object_r:sysfs:s0 tclass=file permissive=1
[   12.330221][  T229] type=1400 audit(1748526567.804:11): avc: denied { open } for comm="init" path="/sys/devices/platform/soc@3000000/4023000.sdmmc/mmc_host/mmc0/mmc0:0001/block/mmcblk0/queue/discard_max_bytes" dev="sysfs" ino=39324 scontext=u:r:init:s0 tcontext=u:object_r:sysfs:s0 tclass=file permissive=1
[   12.425767][  T344] healthd: No battery devices found
[   12.433879][  T344] healthd: battery none chg=
[   12.438935][  T344] healthd: battery none chg=
[   12.444250][  T344] healthd: battery none chg=
[   12.479970][  T343] PVR_K:  343: RGX Firmware image 'rgx.fw.36.56.104.183' loaded
[   12.499008][  T343] PVR_K:  343: Shader binary image 'rgx.sh.36.56.104.183' loaded
[   12.512245][  T343] pvrsrvkm 1800000.gpu: sunxiPrePowerState ePwrFlags:1 current power status:0 1
[   12.513689][  T229] type=1400 audit(1748526568.012:12): avc: denied { read } for comm="display.output-" name="u:object_r:boot_status_prop:s0" dev="tmpfs" ino=80 scontext=u:r:hal_awdisplayoutput_default:s0 tcontext=u:object_r:boot_status_prop:s0 tclass=file permissive=1
[   12.522326][  T343] pvrsrvkm 1800000.gpu: sunxiPostPowerState ePwrFlags:1 current power status:1 1
[   12.549389][  T229] type=1400 audit(1748526568.012:13): avc: denied { open } for comm="display.output-" path="/dev/__properties__/u:object_r:boot_status_prop:s0" dev="tmpfs" ino=80 scontext=u:r:hal_awdisplayoutput_default:s0 tcontext=u:object_r:boot_status_prop:s0 tclass=file permissive=1
[   12.575490][  T343] pvrsrvkm 1800000.gpu: sunxiPrePowerState ePwrFlags:1 current power status:1 1
[   12.588254][  T229] type=1400 audit(1748526568.012:14): avc: denied { getattr } for comm="display.output-" path="/dev/__properties__/u:object_r:boot_status_prop:s0" dev="tmpfs" ino=80 scontext=u:r:hal_awdisplayoutput_default:s0 tcontext=u:object_r:boot_status_prop:s0 tclass=file permissive=1
[   12.598117][  T343] pvrsrvkm 1800000.gpu: sunxiPostPowerState ePwrFlags:1 current power status:1 1
[   12.601525][  T344] healthd: battery none chg=
[   12.625376][  T344] healthd: battery none chg=
[   12.626833][  T229] type=1400 audit(1748526568.012:15): avc: denied { map } for comm="display.output-" path="/dev/__properties__/u:object_r:boot_status_prop:s0" dev="tmpfs" ino=80 scontext=u:r:hal_awdisplayoutput_default:s0 tcontext=u:object_r:boot_status_prop:s0 tclass=file permissive=1
[   12.637247][  T362] function = msa_startup =  =  =  =  =  =  =  =  = LINE = 1043.
[   12.637765][  T343] pvrsrvkm 1800000.gpu: sunxiPrePowerState ePwrFlags:1 current power status:0 1
[   12.637837][  T343] pvrsrvkm 1800000.gpu: sunxiPostPowerState ePwrFlags:1 current power status:1 1
[   12.637843][  T343] pvrsrvkm 1800000.gpu: sunxiPrePowerState ePwrFlags:1 current power status:1 1
[   12.637845][  T343] pvrsrvkm 1800000.gpu: sunxiPostPowerState ePwrFlags:1 current power status:1 1
[   12.637882][  T344] healthd: battery none chg=
[   12.640102][  T344] healthd: battery none chg=
[   12.641800][  T229] type=1400 audit(1748526568.056:16): avc: denied { read } for comm="android.hardwar" name="thermal" dev="sysfs" ino=9141 scontext=u:r:hal_power_default:s0 tcontext=u:object_r:sysfs_thermal:s0 tclass=dir permissive=1
[   12.643025][  T344] healthd: battery none chg=
[   12.645330][  T184] file system registered
[   12.647025][  T362] msa use sepical device node name  =  msa
[   12.652935][  T184] using random self ethernet address
[   12.652944][  T184] using random host ethernet address
[   12.656841][  T343] PVR_K:  343: FTrace event from "gpu_work_period" enabled
[   12.675510][  T229] type=1400 audit(1748526568.056:17): avc: denied { open } for comm="android.hardwar" path="/sys/class/thermal" dev="sysfs" ino=9141 scontext=u:r:hal_power_default:s0 tcontext=u:object_r:sysfs_thermal:s0 tclass=dir permissive=1
[   12.685146][  T362] ERROR! get gsensor_para failed, func:sunxi_gsensor_startup, line:304
[   12.693964][  T229] type=1400 audit(1748526568.072:18): avc: denied { setattr } for comm="init" name="ext_csd" dev="debugfs" ino=11031 scontext=u:r:init:s0 tcontext=u:object_r:debugfs_mmc:s0 tclass=file permissive=1
[   12.703702][  T362] =========gsensor script_get_err============
[   12.703710][  T362] msa_startup: err.
[   12.710831][  T184] sunxi-rfkill soc@3000000:rfkill: block state already is 1
[   12.714169][  T229] type=1400 audit(1748526568.088:19): avc: denied { integrity } for comm="init" lockdown_reason="debugfs access" scontext=u:r:init:s0 tcontext=u:r:init:s0 tclass=lockdown permissive=1
[   12.735457][  T344] healthd: battery none chg=
[   12.763702][  T184] pps_core: LinuxPPS API ver. 1 registered
[   12.900186][  T184] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[   12.914661][  T362] qst-qmi8658_i2c_init(line:1046)  qmi8658 A+G driver: init
[   12.922816][  T362] function=startup=========LINE=1025.
[   12.923403][  T184] PTP clock support registered
[   12.929763][  T362] ERROR! get gsensor_para failed, func:sunxi_gsensor_startup, line:304
[   12.943343][  T362] =========gsensor script_get_err============
[   12.950007][  T362] startup: err.
[   12.955627][  T184] dwmac-sunxi 4500000.ethernet: IRQ eth_wake_irq not found
[   12.963890][  T184] sunxi:stmmac-4500000.ethernet:[INFO]: Phy use soc fanout
[   12.972399][  T184] sunxi:stmmac-4500000.ethernet:[INFO]: Not found delay-maps in dts
[   12.981662][  T184] sunxi:stmmac-4500000.ethernet:[INFO]: RGMII use external transmit clock
[   12.991313][  T184] dwmac-sunxi 4500000.ethernet: User ID: 0x20, Synopsys ID: 0x53
[   12.999835][  T184] dwmac-sunxi 4500000.ethernet:    DWMAC4/5
[   13.006089][  T184] dwmac-sunxi 4500000.ethernet: DMA HW capability register supported
[   13.008638][  T389] [drm] sunxi-hdmi: [warn] hdmi drv check old dynamic range 1 unsupport!
[   13.014951][  T184] dwmac-sunxi 4500000.ethernet: RX Checksum Offload Engine supported
[   13.014954][  T184] dwmac-sunxi 4500000.ethernet: TX Checksum insertion supported
[   13.014955][  T184] dwmac-sunxi 4500000.ethernet: Wake-Up On Lan supported
[   13.015092][  T184] dwmac-sunxi 4500000.ethernet: Enable RX Mitigation via HW Watchdog Timer
[   13.015098][  T184] dwmac-sunxi 4500000.ethernet: Enabled RFS Flow TC (entries=8)
[   13.015103][  T184] dwmac-sunxi 4500000.ethernet: Using 32 bits DMA width
[   13.025269][  T362] ERROR! get ls_para failed, func:sunxi_ls_startup, line:563
[   13.033997][  T389] [drm] sunxi-hdmi: drm hdmi detect: disconnect
[   13.041985][  T362] startup: ls_fetch_sysconfig_para err.
[   13.049853][  T389] [drm] sunxi-hdmi: [warn] hdmi drv check old dynamic range 1 unsupport!
[   13.193111][  T184] sunxi:stmmac-4500000.ethernet:[INFO]: probe success (Version 0.3.2)
[   13.196839][  T418] [drm] sunxi-hdmi: drm hdmi detect: disconnect
[   13.218417][  T418] [drm] sunxi-hdmi: [warn] hdmi drv check old dynamic range 1 unsupport!
[   13.218839][  T184] IR NEC protocol handler initialized
[   13.240427][  T184] sun60iw2-r-pinctrl 7025000.pinctrl: pin PL4 already requested by 7025000.pinctrl:356; cannot claim for 7040000.irrx
[   13.254084][  T184] sun60iw2-r-pinctrl 7025000.pinctrl: pin-356 (7040000.irrx) status -22
[   13.263233][  T184] sun60iw2-r-pinctrl 7025000.pinctrl: could not request pin 356 (PL4) from group PL4  on device 7025000.pinctrl
[   13.276254][  T184] sunxi-rc-recv 7040000.irrx: Error applying setting, reverse things back
[   13.313983][  T184] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[   13.318667][  T418] [drm] sunxi-hdmi: drm hdmi detect: disconnect
[   13.323851][  T184] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[   13.330621][  T418] [drm] sunxi-hdmi: [warn] hdmi drv check old dynamic range 1 unsupport!
[   13.338692][   T95] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
[   13.358365][   T95] cfg80211: failed to load regulatory.db
[   13.385258][  T184] deinterlace 5400000.deinterlace: Adding to iommu group 0
[   13.393262][  T184] sunxi:deinterlace:[INFO]: DI probe
[   13.403432][  T184] sunxi:ehci_sunxi:[INFO]: sunxi-ehci: EHCI SUNXI driver
[   13.417438][  T184] sunxi:sunxi_hci:[INFO]: sunxi ehci0-controller don't init wakeup source
[   13.426852][  T184] sunxi:ehci_sunxi:[INFO]: [sunxi-ehci0]: probe, pdev->name: 4101000.ehci0-controller, sunxi_ehci: 0xffffffc001df0030, 0x:ffffffc00ca4d000, irq_no:1d5
[   13.443656][  T184] sunxi:ehci_sunxi:[INFO]: [sunxi-ehci0]: Not init ehci0
[   13.451870][  T184] sunxi:sunxi_hci:[INFO]: sunxi ehci1-controller don't init wakeup source
[   13.461224][  T184] sunxi:ehci_sunxi:[INFO]: [sunxi-ehci1]: probe, pdev->name: 4200000.ehci1-controller, sunxi_ehci: 0xffffffc001df0930, 0x:ffffffc00ca65000, irq_no:1d6
[   13.478132][  T184] sunxi-ehci 4200000.ehci1-controller: supply drvvbus not found, using dummy regulator
[   13.488964][  T184] sunxi-ehci 4200000.ehci1-controller: supply hci not found, using dummy regulator
[   13.499325][  T184] sunxi-ehci 4200000.ehci1-controller: EHCI Host Controller
[   13.507340][  T184] sunxi-ehci 4200000.ehci1-controller: new USB bus registered, assigned bus number 1
[   13.517819][  T184] sunxi-ehci 4200000.ehci1-controller: irq 470, io mem 0x04200000
[   13.540163][  T184] sunxi-ehci 4200000.ehci1-controller: USB 2.0 started, EHCI 1.00
[   13.548795][  T184] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.15
[   13.558810][  T184] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[   13.567653][  T184] usb usb1: Product: EHCI Host Controller
[   13.573870][  T184] usb usb1: Manufacturer: Linux 5.15.119-gc82a3c8d0b63-dirty ehci_hcd
[   13.582807][  T184] usb usb1: SerialNumber: sunxi-ehci
[   13.588827][  T184] hub 1-0:1.0: USB hub found
[   13.593830][  T184] hub 1-0:1.0: 1 port detected
[   13.608353][  T184] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[   13.618398][  T184] ohci-pci: OHCI PCI platform driver
[   13.627014][  T184] sunxi:ohci_sunxi:[INFO]: sunxi-ohci: OHCI SUNXI driver
[   13.635291][  T184] sunxi:sunxi_hci:[INFO]: sunxi ohci0-controller don't init wakeup source
[   13.644689][  T184] sunxi:ohci_sunxi:[INFO]: [sunxi-ohci0]: probe, pdev->name: 4101400.ohci0-controller, sunxi_ohci: 0xffffffc001df04b0
[   13.658331][  T184] sunxi:ohci_sunxi:[INFO]: [sunxi-ohci0]: Not init ohci0
[   13.666544][  T184] sunxi:sunxi_hci:[INFO]: sunxi ohci1-controller don't init wakeup source
[   13.675926][  T184] sunxi:ohci_sunxi:[INFO]: [sunxi-ohci1]: probe, pdev->name: 4200400.ohci1-controller, sunxi_ohci: 0xffffffc001df0db0
[   13.689639][  T184] sunxi-ohci 4200400.ohci1-controller: supply drvvbus not found, using dummy regulator
[   13.700480][  T184] sunxi-ohci 4200400.ohci1-controller: supply hci not found, using dummy regulator
[   13.710834][  T184] sunxi-ohci 4200400.ohci1-controller: OHCI Host Controller
[   13.718846][  T184] sunxi-ohci 4200400.ohci1-controller: new USB bus registered, assigned bus number 2
[   13.729379][  T184] sunxi-ohci 4200400.ohci1-controller: irq 472, io mem 0x04200400
[   13.800390][  T184] usb usb2: New USB device found, idVendor=1d6b, idProduct=0001, bcdDevice= 5.15
[   13.810415][  T184] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[   13.819257][  T184] usb usb2: Product: OHCI Host Controller
[   13.825477][  T184] usb usb2: Manufacturer: Linux 5.15.119-gc82a3c8d0b63-dirty ohci_hcd
[   13.834416][  T184] usb usb2: SerialNumber: sunxi-ohci
[   13.840451][  T184] hub 2-0:1.0: USB hub found
[   13.845456][  T184] hub 2-0:1.0: 1 port detected
[   13.852562][   T95] usb 1-1: new high-speed USB device number 2 using sunxi-ehci
[   13.861921][  T184] sunxi:phy_sunxi_plat-6b00000.phy:[INFO]: resistance calibration supported - enabled, mode - V2
[   13.873943][  T184] sunxi:phy_sunxi_plat-6b00000.phy:[INFO]: phy provider register success
[   13.887686][  T184] sunxi:dwc3_sunxi_plat-12.usbc2:[ERR]: couldn't get drvvbus supply
[   13.897741][  T184] sunxi-cadence-combophy 6c00000.serdes: combophy1 set power ON
[   13.919545][  T441] sunxi:sound-ac101:[INFO]: 653 ac101_startup(): wait ac101 reset successfully, need 0x101/257
[   13.933017][  T184] xhci-hcd xhci-hcd.41.auto: xHCI Host Controller
[   13.935958][  T441] sunxi-ac101 14-001a: sunxi:sound-ac101ac101 sysclk source don't pll, don't need config pll
[   13.940064][  T184] xhci-hcd xhci-hcd.41.auto: new USB bus registered, assigned bus number 3
[   13.940166][  T184] xhci-hcd xhci-hcd.41.auto: hcc params 0x0118ffc5 hci version 0x120 quirks 0x0000000000010010
[   13.966260][  T441] dma dma0chan0: The timeout func is not suportted or chan->private is NULL, timeout mode not used
[   13.972188][  T184] xhci-hcd xhci-hcd.41.auto: irq 473, io mem 0x06a00000
[   13.991639][  T184] xhci-hcd xhci-hcd.41.auto: xHCI Host Controller
[   13.998683][  T184] xhci-hcd xhci-hcd.41.auto: new USB bus registered, assigned bus number 4
[   14.008116][  T184] xhci-hcd xhci-hcd.41.auto: Host supports USB 3.1 Enhanced SuperSpeed
[   14.017244][  T184] usb usb3: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.15
[   14.027289][  T184] usb usb3: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[   14.036167][  T184] usb usb3: Product: xHCI Host Controller
[   14.042403][  T184] usb usb3: Manufacturer: Linux 5.15.119-gc82a3c8d0b63-dirty xhci-hcd
[   14.051351][  T184] usb usb3: SerialNumber: xhci-hcd.41.auto
[   14.057671][   T95] usb 1-1: New USB device found, idVendor=1a40, idProduct=0101, bcdDevice= 1.11
[   14.060470][  T184] hub 3-0:1.0: USB hub found
[   14.067579][   T95] usb 1-1: New USB device strings: Mfr=0, Product=1, SerialNumber=0
[   14.067581][   T95] usb 1-1: Product: USB 2.0 Hub
[   14.068916][   T95] hub 1-1:1.0: USB hub found
[   14.072601][  T184] hub 3-0:1.0: 1 port detected
[   14.085454][   T95] hub 1-1:1.0: 4 ports detected
[   14.086840][  T184] usb usb4: We don't know the algorithms for LPM for this host, disabling LPM.
[   14.111935][  T184] usb usb4: New USB device found, idVendor=1d6b, idProduct=0003, bcdDevice= 5.15
[   14.121962][  T184] usb usb4: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[   14.130811][  T184] usb usb4: Product: xHCI Host Controller
[   14.137040][  T184] usb usb4: Manufacturer: Linux 5.15.119-gc82a3c8d0b63-dirty xhci-hcd
[   14.145986][  T184] usb usb4: SerialNumber: xhci-hcd.41.auto
[   14.152602][  T184] hub 4-0:1.0: USB hub found
[   14.157604][  T184] hub 4-0:1.0: 1 port detected
[   14.163161][  T184] sunxi:dwc3_sunxi_plat-12.usbc2:[INFO]: DesignWare USB3 Allwinner Glue Layer Driver(v1.0.22 2024-10-08 16:30)
[   14.184539][  T184] sunxi_usb_udc 4100000.udc-controller: sunxi:sunxi_usb_udc UDC Inner DMA Feature - wordaddr: 1, extend: enabled
[   14.201634][  T184] sunxi:sunxi_usbc:[INFO]: OTG can't find bcten-gpio, use default mode.
[   14.211003][  T184] sunxi:sunxi_usbc:[INFO]: get det_vbus is fail, -84
[   14.218364][  T184] sunxi:sunxi_usbc:[INFO]: get id is fail, -84
[   14.233759][  T184] usbcore: registered new interface driver option
[   14.246127][  T184] usbserial: USB Serial support registered for GSM modem (1-port)
[   14.257084][  T184] I2C functionality : OK...
[   14.262411][  T184] husb311 failed to find usb power
[   14.270733][  T184] husb311 13-004e: vbus is already Off
[   14.277974][  T184] sunxi:sunxi_usbc:[INFO]: usb role switch set null -> null
[   14.287433][  T448] husb311 13-004e: vbus is already Off
[   14.287730][  T184] husb311 13-004e: Vendor ID:0x2e99, Product ID:0x0311, probe success
[   14.294758][  T448] sunxi:sunxi_usbc:[INFO]: usb role switch set null -> null
[   14.331714][  T184] sunxi:lradc-2524000.lradc:[WARN]: get key_debounce failed, please check whether to enable key debounce
[   14.344215][  T184] sunxi:lradc-2524000.lradc:[WARN]: warn: filter_cnt not set, default value is 3
[   14.355347][  T184] input: sunxi-keyboard as /devices/platform/soc@3000000/2524000.lradc/input/input2
[   14.367079][  T184] sunxi:lradc-2524000.lradc:[INFO]: sunxi lradc init success
[   14.377856][  T184] sunxi:sunxi_smcdrm config service not available: FFFFFFFF
[   14.428922][  T184] sunxi:VE:[INFO]: 2373 sunxi_cedar_init(): sunxi cedar version 1.1
[   14.445886][  T184] sunxi-cedar 1c0e000.ve: Adding to iommu group 0
[   14.452968][  T184] sunxi:VE:[INFO]: 2295 sunxi_cedar_probe(): probe ve
[   14.460508][  T184] sunxi-cedar 1c0e000.ve: supply ve not found, using dummy regulator
[   14.469664][  T184] sunxi-cedar 1c0e000.ve: sunxi:VE no or not support operating-points-v2 node
[   14.479573][  T184] sunxi-cedar soc@3000000:ve1@1c0e000: Adding to iommu group 0
[   14.487906][  T184] sunxi:VE:[INFO]: 2298 sunxi_cedar_probe(): probe ve1
[   14.495464][  T184] sunxi-cedar 1c10000.ve2: Adding to iommu group 0
[   14.502611][  T184] sunxi:VE:[INFO]: 2301 sunxi_cedar_probe(): probe ve2
[   14.510241][  T184] sunxi-cedar 1c10000.ve2: supply ve not found, using dummy regulator
[   14.519484][  T184] sunxi-cedar 1c10000.ve2: sunxi:VE no or not support operating-points-v2 node
[   14.533175][  T184] reg-virt-consumer reg-virt-consumer.1.auto: DMA mask not set
[   14.541952][  T184] reg-virt-consumer reg-virt-consumer.2.auto: DMA mask not set
[   14.550587][  T184] reg-virt-consumer reg-virt-consumer.3.auto: DMA mask not set
[   14.559241][  T184] reg-virt-consumer reg-virt-consumer.4.auto: DMA mask not set
[   14.567912][  T184] reg-virt-consumer reg-virt-consumer.5.auto: DMA mask not set
[   14.576654][  T184] reg-virt-consumer reg-virt-consumer.6.auto: DMA mask not set
[   14.585462][  T184] reg-virt-consumer reg-virt-consumer.7.auto: DMA mask not set
[   14.594237][  T184] reg-virt-consumer reg-virt-consumer.8.auto: DMA mask not set
[   14.603129][  T184] reg-virt-consumer reg-virt-consumer.9.auto: DMA mask not set
[   14.611998][  T184] reg-virt-consumer reg-virt-consumer.10.auto: DMA mask not set
[   14.620799][  T184] reg-virt-consumer reg-virt-consumer.11.auto: DMA mask not set
[   14.629414][  T184] reg-virt-consumer reg-virt-consumer.12.auto: DMA mask not set
[   14.638020][  T184] reg-virt-consumer reg-virt-consumer.13.auto: DMA mask not set
[   14.646611][  T184] reg-virt-consumer reg-virt-consumer.14.auto: DMA mask not set
[   14.655215][  T184] reg-virt-consumer reg-virt-consumer.15.auto: DMA mask not set
[   14.663866][  T184] reg-virt-consumer reg-virt-consumer.16.auto: supply bldo1 not found, using dummy regulator
[   14.675256][  T184] reg-virt-consumer reg-virt-consumer.17.auto: supply bldo2 not found, using dummy regulator
[   14.686640][  T184] reg-virt-consumer reg-virt-consumer.18.auto: supply bldo3 not found, using dummy regulator
[   14.697990][  T184] reg-virt-consumer reg-virt-consumer.19.auto: supply bldo4 not found, using dummy regulator
[   14.709334][  T184] reg-virt-consumer reg-virt-consumer.20.auto: supply bldo5 not found, using dummy regulator
[   14.720692][  T184] reg-virt-consumer reg-virt-consumer.21.auto: supply cldo1 not found, using dummy regulator
[   14.732041][  T184] reg-virt-consumer reg-virt-consumer.22.auto: supply cldo2 not found, using dummy regulator
[   14.743409][  T184] reg-virt-consumer reg-virt-consumer.23.auto: supply cldo3 not found, using dummy regulator
[   14.754753][  T184] reg-virt-consumer reg-virt-consumer.24.auto: supply cldo4 not found, using dummy regulator
[   14.766146][  T184] reg-virt-consumer reg-virt-consumer.25.auto: supply cldo5 not found, using dummy regulator
[   14.777496][  T184] reg-virt-consumer reg-virt-consumer.26.auto: DMA mask not set
[   14.786234][  T184] reg-virt-consumer reg-virt-consumer.27.auto: DMA mask not set
[   14.794792][  T184] reg-virt-consumer reg-virt-consumer.28.auto: DMA mask not set
[   14.796543][  T317] husb311 13-004e: CC1: 0 - Open, CC2: 0 - Open
[   14.803345][  T184] reg-virt-consumer reg-virt-consumer.29.auto: DMA mask not set
[   14.810001][  T317] sunxi:sunxi_usbc:[INFO]: usb role switch set null -> null
[   14.818488][  T184] reg-virt-consumer reg-virt-consumer.30.auto: DMA mask not set
[   14.834989][  T184] reg-virt-consumer reg-virt-consumer.31.auto: DMA mask not set
[   14.843734][  T184] reg-virt-consumer reg-virt-consumer.32.auto: DMA mask not set
[   14.852624][  T184] reg-virt-consumer reg-virt-consumer.33.auto: DMA mask not set
[   14.861411][  T184] reg-virt-consumer reg-virt-consumer.34.auto: DMA mask not set
[   14.870127][  T184] reg-virt-consumer reg-virt-consumer.35.auto: DMA mask not set
[   14.878712][  T184] reg-virt-consumer reg-virt-consumer.36.auto: DMA mask not set
[   14.887398][  T184] reg-virt-consumer reg-virt-consumer.37.auto: DMA mask not set
[   14.896274][  T184] reg-virt-consumer reg-virt-consumer.38.auto: DMA mask not set
[   14.904995][  T184] reg-virt-consumer reg-virt-consumer.39.auto: DMA mask not set
[   14.913412][  T184] reg-virt-consumer reg-virt-consumer.39.auto: supply dc1sw1 not found, using dummy regulator
[   14.924909][  T184] reg-virt-consumer reg-virt-consumer.40.auto: DMA mask not set
[   14.933333][  T184] reg-virt-consumer reg-virt-consumer.40.auto: supply dc1sw2 not found, using dummy regulator
[   15.102309][    T1] init: Command 'mkdir /sys/kernel/tracing/instances/bootreceiver 0700 system system' action=bootreceiver.enable=1 && ro.product.cpu.abilist64=* (/system/etc/init/hw/init.rc:656) took 67ms and succeeded
[   15.126380][    T1] init: processing action (net.tcp_def_init_rwnd=*) from (/system/etc/init/hw/init.rc:1211)
[   15.137848][    T1] init: processing action (sys.init.perf_lsm_hooks=1) from (/system/etc/init/hw/init.rc:1222)
[   15.149422][    T1] init: processing action (security.perf_harden=1) from (/system/etc/init/hw/init.rc:1236)
[   15.160789][    T1] init: processing action (ro.debuggable=1) from (/system/etc/init/hw/init.rc:1271)
[   15.171367][    T1] init: processing action (init.svc.audioserver=running) from (/system/etc/init/audioserver.rc:38)
[   15.183165][    T1] init: service 'vendor.audio-hal' requested start, but it is already running (flags: 4)
[   15.193983][    T1] init: Command 'start vendor.audio-hal-4-0-msd' action=init.svc.audioserver=running (/system/etc/init/audioserver.rc:40) took 0ms and failed: service vendor.audio-hal-4-0-msd not found
[   15.214279][    T1] init: Command 'start audio_proxy_service' action=init.svc.audioserver=running (/system/etc/init/audioserver.rc:41) took 0ms and failed: service audio_proxy_service not found
[   15.233625][    T1] init: Command 'start vendor.audio-hal-2-0' action=init.svc.audioserver=running (/system/etc/init/audioserver.rc:43) took 0ms and failed: service vendor.audio-hal-2-0 not found
[   15.390477][  T104] sunxi:sunxi_mmc_host-4023000.sdmmc:[INFO]: have to disable cqe when send cmd with data!!!, CQHCI_CFG:2001020
[   15.404602][    C0] sunxi:sunxi_mmc_host-4023000.sdmmc:[INFO]: cmd with data done, restore cqe enable and halt:2001021,1,6,6
[   15.716746][  T337] [Awinic] [14-0059]aw_monitor_get_battery_status: get power supply failed
[   15.720789][  T536] read descriptors
[   15.726930][  T337] [Awinic] [14-0058]aw_monitor_get_battery_status: get power supply failed
[   15.736197][  T536] read strings
[   15.739980][  T337] [Awinic] aw87xxx_hal_monitor_time_get:get monitor time 3000
[   15.756692][  T317] husb311 13-004e: CC1: 3 - Rp-def, CC2: 3 - Rp-def
[   15.764332][  T317] sunxi:sunxi_usbc:[INFO]: usb role switch set null -> device
[   15.772840][  T317] sunxi:sunxi_usbc:[INFO]: auto set usb role [device]
[   15.780576][  T317] sunxi:sunxi_usbc:[INFO]: insmod_device_driver
[   15.780576][  T317]
[   15.790671][  T317] sunxi_usb_udc 4100000.udc-controller: supply udc not found, using dummy regulator
[   16.435316][  T317] sunxi:sunxi_usb_udc:[WARN]: sunxi_set_cur_vol_work()537 WARN: get power supply failed
[   16.522187][  T317] android_work: sent uevent USB_STATE=CONNECTED
[   16.687823][   T21] sunxi:sunxi_usb_udc:[WARN]: sunxi_set_cur_vol_work()537 WARN: get power supply failed
[   16.780216][  T317] sunxi:sunxi_usb_udc:[WARN]: sunxi_vbus_det_work()3728 WARN: get power supply failed
[   16.791713][  T317] android_work: sent uevent USB_STATE=DISCONNECTED
[   16.802842][  T317] android_work: sent uevent USB_STATE=CONNECTED
[   16.831884][  T317] android_work: sent uevent USB_STATE=CONFIGURED
[   18.341302][  T229] type=1400 audit(1748526573.840:54): avc: denied { open } for comm="getprop" path="/dev/__properties__/u:object_r:aac_drc_prop:s0" dev="tmpfs" ino=59 scontext=u:r:shell:s0 tcontext=u:object_r:aac_drc_prop:s0 tclass=file permissive=1
[   18.345749][  T608] audit: audit_backlog=65 > audit_backlog_limit=64
[   18.364522][  T362] audit: audit_backlog=65 > audit_backlog_limit=64
[   18.364531][  T362] audit: audit_lost=1 audit_rate_limit=0 audit_backlog_limit=64
[   18.364535][  T362] audit: backlog limit exceeded
[   18.366819][  T229] type=1400 audit(1748526573.840:55): avc: denied { getattr } for comm="getprop" path="/dev/__properties__/u:object_r:aac_drc_prop:s0" dev="tmpfs" ino=59 scontext=u:r:shell:s0 tcontext=u:object_r:aac_drc_prop:s0 tclass=file permissive=1
[   18.370523][  T344] healthd: battery none chg=
[   18.372078][  T344] healthd: battery none chg=
[   18.372476][  T344] healthd: battery none chg=
[   18.373547][  T608] audit: audit_lost=2 audit_rate_limit=0 audit_backlog_limit=64
[   18.381050][  T229] type=1400 audit(1748526573.840:56): avc: denied { map } for comm="getprop" path="/dev/__properties__/u:object_r:aac_drc_prop:s0" dev="tmpfs" ino=59 scontext=u:r:shell:s0 tcontext=u:object_r:aac_drc_prop:s0 tclass=file permissive=1
[   18.382334][  T344] healthd: battery none chg=
[   18.382911][  T344] healthd: battery none chg=
[   18.385306][  T344] healthd: battery none chg=
[   18.389152][  T608] audit: backlog limit exceeded
[   18.394629][  T229] type=1400 audit(1748526573.840:57): avc: denied { open } for comm="getprop" path="/dev/__properties__/u:object_r:ab_update_gki_prop:s0" dev="tmpfs" ino=61 scontext=u:r:shell:s0 tcontext=u:object_r:ab_update_gki_prop:s0 tclass=file permissive=1
[   18.419640][  T608] audit: audit_backlog=65 > audit_backlog_limit=64
[   18.424660][  T229] type=1400 audit(1748526573.840:58): avc: denied { getattr } for comm="getprop" path="/dev/__properties__/u:object_r:ab_update_gki_prop:s0" dev="tmpfs" ino=61 scontext=u:r:shell:s0 tcontext=u:object_r:ab_update_gki_prop:s0 tclass=file permissive=1
[   18.429511][  T608] audit: audit_lost=3 audit_rate_limit=0 audit_backlog_limit=64
[   18.434564][  T229] type=1400 audit(1748526573.840:59): avc: denied { map } for comm="getprop" path="/dev/__properties__/u:object_r:ab_update_gki_prop:s0" dev="tmpfs" ino=61 scontext=u:r:shell:s0 tcontext=u:object_r:ab_update_gki_prop:s0 tclass=file permissive=1
[   18.442787][  T608] audit: backlog limit exceeded
[   18.442899][  T608] audit: audit_backlog=65 > audit_backlog_limit=64
[   18.469395][  T229] type=1400 audit(1748526573.840:60): avc: denied { open } for comm="getprop" path="/dev/__properties__/u:object_r:adaptive_haptics_prop:s0" dev="tmpfs" ino=62 scontext=u:r:shell:s0 tcontext=u:object_r:adaptive_haptics_prop:s0 tclass=file permissive=1
[   18.620830][  T229] type=1400 audit(1748526573.840:61): avc: denied { getattr } for comm="getprop" path="/dev/__properties__/u:object_r:adaptive_haptics_prop:s0" dev="tmpfs" ino=62 scontext=u:r:shell:s0 tcontext=u:object_r:adaptive_haptics_prop:s0 tclass=file permissive=1
[   18.647877][  T229] type=1400 audit(1748526573.840:62): avc: denied { map } for comm="getprop" path="/dev/__properties__/u:object_r:adaptive_haptics_prop:s0" dev="tmpfs" ino=62 scontext=u:r:shell:s0 tcontext=u:object_r:adaptive_haptics_prop:s0 tclass=file permissive=1
[   18.674481][  T229] type=1400 audit(1748526573.840:63): avc: denied { open } for comm="getprop" path="/dev/__properties__/u:object_r:adbd_prop:s0" dev="tmpfs" ino=64 scontext=u:r:shell:s0 tcontext=u:object_r:adbd_prop:s0 tclass=file permissive=1
[   18.810467][  T344] healthd: battery none chg=
[   18.816778][  T344] healthd: battery none chg=
[   18.822488][  T344] healthd: battery none chg=
[   18.828438][  T344] healthd: battery none chg=
[   24.999219][  T441] sunxi:sound-ac101:[INFO]: 653 ac101_startup(): wait ac101 reset successfully, need 0x101/257
[   25.016396][  T441] sunxi-ac101 14-001a: sunxi:sound-ac101ac101 sysclk source don't pll, don't need config pll
[   25.172235][   T95] sunxi:sunxi_pd_test-soc@3000000:pd_pcie_test@0:[WARN]: runtime_suspend disable clock
[   25.182858][   T95] sunxi:sunxi_pd_test-soc@3000000:pd_usb2_test@0:[WARN]: runtime_suspend disable clock
[   25.193652][   T95] sunxi:sunxi_pd_test-soc@3000000:pd_de_sys_test@0:[WARN]: runtime_suspend disable clock
[   25.204584][   T95] sunxi:sunxi_pd_test-soc@3000000:pd_vo_test@0:[WARN]: runtime_suspend disable clock
[   25.215000][   T95] sunxi:sunxi_pd_test-soc@3000000:pd_vo1_test@0:[WARN]: runtime_suspend disable clock
[   28.553250][    T1] init: Sending signal 9 to service 'idmap2d' (pid 483) process group...
[   28.568012][    T1] libprocessgroup: Successfully killed process cgroup uid 1000 pid 483 in 5ms
[   28.578387][    T1] init: Control message: Processed ctl.stop for 'idmap2d' from pid: 450 (system_server)
[   28.589418][    T1] init: Service 'idmap2d' (pid 483) received signal 9
[   29.077868][  T615] read descriptors
[   29.081889][  T615] read strings
[   29.085581][  T615] read descriptors
[   29.089583][  T615] read strings
[   29.757067][  T344] healthd: battery none chg=
[   29.866566][    T1] init: starting service 'vendor.wifi_hal_legacy'...
[   29.877917][    T1] init: Control message: Processed ctl.interface_start for 'android.hardware.wifi@1.0::IWifi/default' from pid: 215 (/system/bin/hwservicemanager)
[   29.895306][    T1] init: service 'vendor.wifi_hal_legacy' requested start, but it is already running (flags: 134)
[   29.907141][    T1] init: Control message: Processed ctl.interface_start for 'android.hardware.wifi@1.0::IWifi/default' from pid: 215 (/system/bin/hwservicemanager)
[   29.997174][  T344] healthd: battery none chg=
[   30.014342][ T1002] >>> rwnx_mod_init()
[   30.018712][ T1002] rwnx 20240730-005-6.4.3.0 - - 241c091M (master)
[   30.025735][ T1002] Driver Release Tag: aic-rwnx-compatible(sdio)-20240730-005
[   30.033872][ T1002] aicbsp: aicbsp_set_subsys, subsys: AIC_WIFI, state to: 1
[   30.041778][ T1002] aicbsp: aicbsp_set_subsys, power state change to 1 dure to AIC_WIFI
[   30.050806][ T1002] aicbsp: aicbsp_platform_power_on
[   30.060502][ T1002] sunxi-rfkill soc@3000000:rfkill: bus_index: 1
[   30.067930][ T1002] aicbsp: aicbsp_platform_power_on disable MMC_CAP_UHS_DDR50 for host 00000000b1358c3e
[   30.078886][  T344] healthd: battery none chg=
[   30.089841][ T1002] sunxi-rfkill soc@3000000:rfkill: wlan power on success
[   30.147563][  T160] sunxi:sunxi_mmc_host-4021000.sdmmc:[INFO]: sdc set ios:clk 0Hz bm PP pm UP vdd 21 width 1 timing LEGACY(SDR12) dt B
[   30.164459][  T310] dwmac-sunxi 4500000.ethernet eth0: PHY [stmmac-0:01] driver [Generic PHY] (irq=POLL)
[   30.175596][  T160] sunxi:sunxi_mmc_host-4021000.sdmmc:[INFO]: sdc set ios:clk 400000Hz bm PP pm ON vdd 21 width 1 timing LEGACY(SDR12) dt B
[   30.176352][  T310] dwmac-sunxi 4500000.ethernet eth0: Register MEM_TYPE_PAGE_POOL RxQ-0
[   30.201056][    C0] sunxi:sunxi_mmc_host-4021000.sdmmc:[ERR]: smc 1 p1 err, cmd 52, RTO !!
[   30.208168][  T310] dwmac4: Master AXI performs fixed burst length
[   30.211245][    C0] sunxi:sunxi_mmc_host-4021000.sdmmc:[ERR]: smc 1 p1 err, cmd 52, RTO !!
[   30.217317][  T310] dwmac-sunxi 4500000.ethernet eth0: No Safety Features support found
[   30.226572][  T160] sunxi:sunxi_mmc_host-4021000.sdmmc:[INFO]: sdc set ios:clk 400000Hz bm PP pm ON vdd 21 width 1 timing LEGACY(SDR12) dt B
[   30.245548][  T310] dwmac-sunxi 4500000.ethernet eth0: IEEE 1588-2008 Advanced Timestamp supported
[   30.252559][  T160] sunxi:sunxi_mmc_host-4021000.sdmmc:[INFO]: sdc set ios:clk 400000Hz bm PP pm ON vdd 21 width 1 timing LEGACY(SDR12) dt B
[   30.260130][  T344] healthd: battery none chg=
[   30.275047][  T310] dwmac-sunxi 4500000.ethernet eth0: registered PTP clock
[   30.286773][  T344] healthd: battery none chg=
[   30.287964][    C0] sunxi:sunxi_mmc_host-4021000.sdmmc:[ERR]: smc 1 p1 err, cmd 11, RE !!
[   30.291883][  T310] dwmac-sunxi 4500000.ethernet eth0: configuring for phy/rgmii link mode
[   30.292309][  T344] healthd: battery none chg=
[   30.292438][  T344] healthd: battery none chg=
[   30.292564][  T344] healthd: battery none chg=
[   30.292676][  T344] healthd: battery none chg=
[   30.292784][  T344] healthd: battery none chg=
[   30.300905][  T160] sunxi:sunxi_mmc_host-4021000.sdmmc:[INFO]: sdc set ios:clk 0Hz bm PP pm OFF vdd 0 width 1 timing LEGACY(SDR12) dt B
[   30.303531][  T160] sunxi:sunxi_mmc_host-4021000.sdmmc:[INFO]: sdc set ios:clk 0Hz bm PP pm UP vdd 21 width 1 timing LEGACY(SDR12) dt B
[   30.310683][  T310] 8021q: adding VLAN 0 to HW filter on device eth0
[   30.327762][  T160] sunxi:sunxi_mmc_host-4021000.sdmmc:[INFO]: sdc set ios:clk 400000Hz bm PP pm ON vdd 21 width 1 timing LEGACY(SDR12) dt B
[   30.413655][  T160] mmc1: queuing unknown CIS tuple 0x10 [07 00 11 00 8e] (5 bytes)
[   30.427681][  T160] sunxi:sunxi_mmc_host-4021000.sdmmc:[INFO]: sdc set ios:clk 50000000Hz bm PP pm ON vdd 21 width 1 timing LEGACY(SDR12) dt B
[   30.442190][  T160] sunxi:sunxi_mmc_host-4021000.sdmmc:[INFO]: sdc set ios:clk 50000000Hz bm PP pm ON vdd 21 width 4 timing LEGACY(SDR12) dt B
[   30.456687][  T160] mmc1: queuing unknown CIS tuple 0x10 [07 00 31 00 32] (5 bytes)
[   30.466396][  T160] mmc1: new SDIO card at address 96ec
[   30.489266][ T1002] aicbsp: aicbsp_sdio_probe:2
[   30.494361][ T1002] aicbsp: aicbsp_sdio_probe:2, matched chip: aic8800d
[   30.501775][ T1002] aicbsp: aicbsp_sdio_probe after replace:1
[   30.508193][ T1002] aicbsp: aicbsp_sdio_probe host max clock frequecy: 208000000
[   30.516459][ T1002] aicbsp: aicwf_sdio_reg_init
[   30.521609][ T1002] sunxi:sunxi_mmc_host-4021000.sdmmc:[INFO]: sdc set ios:clk 70000000Hz bm PP pm ON vdd 21 width 4 timing LEGACY(SDR12) dt B
[   30.535990][ T1002] aicbsp: Set SDIO Clock 66 MHz
[   30.543179][ T1002] aicbsp: aicbsp_8800d_fw_init, rev id: 0x7, subrev id: 0x20
[   30.554646][ T1002] rwnx_request_firmware, name: fw_patch_table_u03.bin
[   30.562083][ T1002] aicbt_patch_info_unpack bt patch version: - Jun 24 2024 21:01:47 - git 0bcba10
[   30.572099][ T1002] aicbt_init no patch info found in bt fw
[   30.578885][ T1002] rwnx_request_firmware, name: fw_adid_u03.bin
[   30.587722][ T1002] rwnx_request_firmware, name: fw_patch_u03.bin
[   30.610188][ T1002] aicbt_patch_table_load bt uart baud: 1500000, flowctrl: 1, lpm_enable: 1, tx_pwr: 24608, bt mode:255.
[   30.655276][ T1002] rwnx_request_firmware, name: fmacfw.bin
[   30.731715][ T1002] rwnx_request_firmware, name: fmacfw_patch.bin
[   30.748002][ T1002] aicbsp: crypto data BBAD831C477E445AC3A462102C50D125
[   30.755693][ T1002] aicbsp: verify data 52C1C402DC4E526F51C01D59442A8008
[   30.764406][ T1002] aicsdio: aicwf_sdio_probe:1
[   30.769617][ T1002] aicsdio: aicwf_sdio_reg_init
[   30.775410][ T1002] sunxi:sunxi_mmc_host-4021000.sdmmc:[INFO]: sdc set ios:clk 70000000Hz bm PP pm ON vdd 21 width 4 timing LEGACY(SDR12) dt B
[   30.790214][ T1002] aicsdio: Set SDIO Clock 66 MHz
[   30.796167][    C7] aicbsp: err:<aicwf_sdio_bus_pwrctl,1257>: bus down
[   30.806825][ T1002] aicbsp: aicbsp_resv_mem_alloc_skb, alloc resv_mem_txdata succuss, id: 0, size: 98304
[   30.818886][ T1002] >>> rwnx_platform_init()
[   30.824712][ T1002] >>> rwnx_cfg80211_init()
[   30.829988][ T1002] rwnx_cfg80211_init sizeof(struct rwnx_hw):47616
[   30.839359][ T1002] >>> rwnx_init_aic()
[   30.843701][ T1002] >>> rwnx_cmd_mgr_init()
[   30.852307][ T1002] tcp_ack_init
[   30.856650][ T1002] >>> rwnx_send_set_stack_start_req()
[   30.865250][ T1002] is 5g support = 1, vendor_info = 0x21
[   30.871750][ T1002] Firmware Version: di Nov 14 2024 17:34:41 - g9aed4718
[   30.871769][ T1002] >>> rwnx_platform_on()
[   30.884313][ T1002] >>> rwnx_plat_fmac_load()
[   30.889578][ T1002] userconfig file path:aic_userconfig.txt
[   30.897883][ T1002] rwnx_plat_userconfig_parsing, enable = 1
[   30.908928][ T1002] rwnx_plat_userconfig_parsing, dsss = 10
[   30.915284][ T1002] rwnx_plat_userconfig_parsing, ofdmlowrate_2g4 = 11
[   30.922595][ T1002] rwnx_plat_userconfig_parsing, ofdm64qam_2g4 = 10
[   30.930072][ T1002] rwnx_plat_userconfig_parsing, ofdm256qam_2g4 = 10
[   30.937650][ T1002] rwnx_plat_userconfig_parsing, ofdm1024qam_2g4 = 9
[   30.945329][ T1002] rwnx_plat_userconfig_parsing, ofdmlowrate_5g = 11
[   30.953537][ T1002] rwnx_plat_userconfig_parsing, ofdm64qam_5g = 10
[   30.961230][ T1002] rwnx_plat_userconfig_parsing, ofdm256qam_5g = 10
[   30.968681][ T1002] rwnx_plat_userconfig_parsing, ofdm1024qam_5g = 9
[   30.977630][ T1002] rwnx_plat_userconfig_parsing, ofst_enable = 1
[   30.984742][ T1002] rwnx_plat_userconfig_parsing, ofst_chan_1_4 = -5
[   30.992222][ T1002] rwnx_plat_userconfig_parsing, ofst_chan_5_9 = -2
[   31.002539][ T1002] rwnx_plat_userconfig_parsing, ofst_chan_10_13 = -2
[   31.010779][ T1002] rwnx_plat_userconfig_parsing, ofst_chan_36_64 = -5
[   31.018437][ T1002] rwnx_plat_userconfig_parsing, ofst_chan_100_120 = -6
[   31.026217][ T1002] rwnx_plat_userconfig_parsing, ofst_chan_122_140 = -6
[   31.033983][ T1002] rwnx_plat_userconfig_parsing, ofst_chan_142_165 = 4
[   31.041585][ T1002] >>> rwnx_send_txpwr_idx_req()
[   31.048236][ T1002] >>> rwnx_send_txpwr_ofst_req()
[   31.054049][ T1002] >>> rwnx_send_rf_calib_req()
[   31.390545][ T1002] get macaddr: 94:ff:6e:cd:1f:cc
[   31.396015][ T1002] >>> rwnx_send_reset()
[   31.401929][ T1002] >>> rwnx_send_version_req()
[   31.407285][ T1002] >>> rwnx_set_vers()
[   31.411583][ T1002] >>> rwnx_send_me_config_req()
[   31.416835][ T1002] ieee80211 phy0: HT supp 1, VHT supp 1, HE supp 1
[   31.424666][ T1002] >>> rwnx_send_me_chan_config_req()
[   31.431003][ T1002] >>> rwnx_send_me_chan_config_req()
[   31.437213][ T1002] >>> rwnx_dbgfs_register()
[   31.442192][ T1002] rwnx_interface_add: wlan%d, 2, 10
[   31.442226][ T1002] interface add:94 ff 6e cd 1f cc
[   31.460241][ T1002] ieee80211 phy0: New interface create wlan0
[   31.500677][ T1002] >>> rwnx_open()
[   31.504653][ T1002] >>> rwnx_send_me_set_lp_level()
[   31.510152][ T1002] rwnx_send_me_set_lp_level 1 1
[   31.518129][ T1002] >>> rwnx_send_start()
[   31.524513][ T1002] >>> rwnx_send_coex_req()
[   31.529878][ T1002] rwnx_open rwnx_vif->drv_flags:4
[   31.535501][ T1002] >>> rwnx_send_add_if()
[   31.548562][  T229] type=1107 audit(1748526587.044:313): uid=0 auid=4294967295 ses=4294967295 subj=u:r:init:s0 msg='avc: denied { set } for property=vendor.wlan.firmware.version pid=1002 uid=1010 gid=1010 scontext=u:r:hal_wifi_default:s0 tcontext=u:object_r:vendor_default_prop:s0 tclass=property_service permissive=1'
[   31.653165][    T1] init: starting service 'wpa_supplicant'...
[   31.660385][    T1] init: Created socket '/dev/socket/wpa_wlan0', mode 660, user 1010, group 1010
[   31.749168][ T1190] capability: warning: `wpa_supplicant' uses 32-bit capabilities (legacy support in use)
[   31.920048][ T1190] rwnx_virtual_interface_add: 10, p2p-dev-wlan0
[   31.926970][ T1190] rwnx_virtual_interface_add, ifname=p2p-dev-wlan0, wdev=00000000670e1c4a, vif_idx=1
[   31.937393][ T1190] p2p dev addr=94 ff 6e cd 1f cd
[   31.945929][ T1190] P2P interface started
[   32.009541][ T1190] IOCTL PRIVATE
[   32.013322][ T1190] android_priv_cmd: Android private cmd "COUNTRY CN" on wlan0
[   32.021779][ T1190] wrong cmd:(null) in handle_private_cmd
[   32.045484][ T1190] IOCTL PRIVATE
[   32.049702][ T1190] android_priv_cmd: Android private cmd "SETSUSPENDMODE 1" on wlan0
[   32.058898][ T1190] >>> rwnx_send_me_set_lp_level()
[   32.064553][ T1190] rwnx_send_me_set_lp_level 1 0
[   32.067369][  T229] type=1400 audit(1748526587.564:314): avc: granted { read } for comm="rkstack.process" name="psched" dev="proc" ino=4026531986 scontext=u:r:network_stack:s0 tcontext=u:object_r:proc_net:s0 tclass=file
[   32.072791][ T1190] set suspend mode 1
[   32.093242][  T229] type=1400 audit(1748526587.564:315): avc: granted { read open } for comm="rkstack.process" path="/proc/1204/net/psched" dev="proc" ino=4026531986 scontext=u:r:network_stack:s0 tcontext=u:object_r:proc_net:s0 tclass=file
[   32.120002][  T229] type=1400 audit(1748526587.564:316): avc: granted { getattr } for comm="rkstack.process" path="/proc/1204/net/psched" dev="proc" ino=4026531986 scontext=u:r:network_stack:s0 tcontext=u:object_r:proc_net:s0 tclass=file
[   33.059997][  T338] aicbt_set_power: start_block=1
[   33.065431][  T338] aicbsp: aicbsp_set_subsys, subsys: AIC_BLUETOOTH, state to: 0
[   33.074320][  T338] aicbsp: aicbsp_set_subsys, power state no need to change, current: 1
[   33.083431][  T338] aicbt_set_power: end_block=1
[   33.088950][  T338] aicbt_set_power: start_block=0
[   33.094393][  T338] aicbsp: aicbsp_set_subsys, subsys: AIC_BLUETOOTH, state to: 1
[   33.102957][  T338] aicbsp: aicbsp_set_subsys, power state no need to change, current: 1
[   33.112201][  T338] aicbt_set_power: end_block=0
[   33.127845][ T1002] >>> rwnx_close()
[   33.131914][ T1002] aicwf_sdio mmc1:96ec:1 wlan0: CLOSE
[   33.137906][    T8] >>> rwnx_cfg80211_del_key()
[   33.138859][ T1002] >>> rwnx_send_remove_if()
[   33.142993][    T8] >>> rwnx_send_key_del()
[   33.145537][    T8] >>> rwnx_cfg80211_del_key()
[   33.148618][ T1002] >>> rwnx_send_msg1()
[   33.152573][    T8] >>> rwnx_send_key_del()
[   33.153485][    T8] >>> rwnx_cfg80211_del_key()
[   33.158626][ T1002] >>> rwnx_send_coex_req()
[   33.163220][    T8] >>> rwnx_send_key_del()
[   33.167525][ T1002] >>> rwnx_send_reset()
[   33.172234][    T8] >>> rwnx_cfg80211_del_key()
[   33.178309][ T1002] >>> rwnx_send_me_config_req()
[   33.181730][    T8] >>> rwnx_send_key_del()
[   33.185845][ T1002] ieee80211 phy0: HT supp 1, VHT supp 1, HE supp 1
[   33.186282][ T1002] >>> rwnx_send_me_chan_config_req()
[   33.191582][    T8] >>> rwnx_cfg80211_del_key()
[   33.196765][ T1002] rwnx_close rwnx_vif->drv_flags:0
[   33.201120][    T8] >>> rwnx_send_key_del()
[   33.229682][    T8] >>> rwnx_cfg80211_del_key()
[   33.234761][    T8] >>> rwnx_send_key_del()
[   33.240302][ T1002] >>> rwnx_open()
[   33.244215][ T1002] >>> rwnx_send_me_set_lp_level()
[   33.249663][ T1002] rwnx_send_me_set_lp_level 1 1
[   33.255483][ T1002] >>> rwnx_send_start()
[   33.260675][ T1002] >>> rwnx_send_coex_req()
[   33.265850][ T1002] rwnx_open rwnx_vif->drv_flags:4
[   33.271416][ T1002] >>> rwnx_send_add_if()
[   33.276561][  T160] >>> rwnx_send_me_chan_config_req()
[   33.282716][  T160] >>> rwnx_send_me_chan_config_req()
[   33.320559][  T338] [BT_LPM] bluesleep_get_uart_port: bluesleep_get_uart_port get uart_port from blusleep_uart_dev: 2501000.uart, port irq: 427
[   33.368684][ T1190] IOCTL PRIVATE
[   33.372412][ T1190] android_priv_cmd: Android private cmd "BTCOEXSCAN-STOP" on wlan0
[   33.381074][ T1190] wrong cmd:(null) in handle_private_cmd
[   33.387730][ T1190] IOCTL PRIVATE
[   33.391588][ T1190] android_priv_cmd: Android private cmd "RXFILTER-STOP" on wlan0
[   33.400173][ T1190] wrong cmd:(null) in handle_private_cmd
[   33.406901][ T1190] IOCTL PRIVATE
[   33.410622][ T1190] android_priv_cmd: Android private cmd "RXFILTER-ADD 2" on wlan0
[   33.419192][ T1190] wrong cmd:(null) in handle_private_cmd
[   33.425748][ T1190] IOCTL PRIVATE
[   33.429483][ T1190] android_priv_cmd: Android private cmd "RXFILTER-START" on wlan0
[   33.438041][ T1190] wrong cmd:(null) in handle_private_cmd
[   33.444459][ T1190] IOCTL PRIVATE
[   33.448179][ T1190] android_priv_cmd: Android private cmd "RXFILTER-STOP" on wlan0
[   33.456642][ T1190] wrong cmd:(null) in handle_private_cmd
[   33.463066][ T1190] IOCTL PRIVATE
[   33.466800][ T1190] android_priv_cmd: Android private cmd "RXFILTER-ADD 3" on wlan0
[   33.475373][ T1190] wrong cmd:(null) in handle_private_cmd
[   33.481777][ T1190] IOCTL PRIVATE
[   33.485498][ T1190] android_priv_cmd: Android private cmd "RXFILTER-START" on wlan0
[   33.494062][ T1190] wrong cmd:(null) in handle_private_cmd
[   33.500593][ T1190] IOCTL PRIVATE
[   33.504314][ T1190] android_priv_cmd: Android private cmd "SETSUSPENDMODE 1" on wlan0
[   33.513079][ T1190] >>> rwnx_send_me_set_lp_level()
[   33.518526][ T1190] rwnx_send_me_set_lp_level 1 0
[   33.524545][ T1190] set suspend mode 1
[   33.579613][ T1190] IOCTL PRIVATE
[   33.583365][ T1190] android_priv_cmd: Android private cmd "SETSUSPENDMODE 0" on wlan0
[   33.592132][ T1190] >>> rwnx_send_me_set_lp_level()
[   33.597578][ T1190] rwnx_send_me_set_lp_level 1 1
[   33.603637][ T1190] set suspend mode 0
[   34.132751][    T1] init: starting service 'idmap2d'...
[   34.142467][    T1] init: Control message: Processed ctl.start for 'idmap2d' from pid: 450 (system_server)
[   34.348171][    C7] [BT_LPM] bluesleep_rx_timer_expire: bluesleep_rx_timer_expire
[   35.326899][    T1] init: processing action (sys.boot_completed=1) from (/system/etc/init/hw/init.rc:1193)
[   35.339953][    T1] init: starting service 'exec 19 (/bin/rm -rf /data/per_boot)'...
[   35.354540][    T1] init: SVC_EXEC service 'exec 19 (/bin/rm -rf /data/per_boot)' pid 1584 (uid 1000 gid 1000+0 context default) started; waiting...
[   35.370880][    T1] init: Service 'exec 19 (/bin/rm -rf /data/per_boot)' (pid 1584) exited with status 0 waiting took 0.018000 seconds
[   35.374592][  T500] >>> rwnx_cfg80211_scan()
[   35.384489][    C7] [BT_LPM] bluesleep_rx_timer_expire: bluesleep_rx_timer_expire
[   35.384773][    T1] init: Sending signal 9 to service 'exec 19 (/bin/rm -rf /data/per_boot)' (pid 1584) process group...
[   35.389347][  T500] >>> rwnx_send_scanu_req()
[   35.398294][    T1] libprocessgroup: Successfully killed process cgroup uid 1000 pid 1584 in 0ms
[   35.426295][    T1] init: processing action (sys.boot_completed=1) from (/vendor/etc/init/hw/init.sun60iw2p1.rc:138)
[   35.438798][    T1] init: Command 'insmod /vendor/lib/modules/kheaders.ko' action=sys.boot_completed=1 (/vendor/etc/init/hw/init.sun60iw2p1.rc:139) took 0ms and failed: open("/vendor/lib/modules/kheaders.ko") failed: No such file or directory
[   35.754224][  T184] init (184): drop_caches: 3
[   35.754822][  T344] healthd: battery none chg=
[   35.788907][    T1] zram0: detected capacity change from 0 to 9060872
[   35.846457][    T1] mkswap: Swapspace size: 4530432k, UUID=aa727031-8a5d-4aba-ae20-95608634a812
[   35.858906][    T1] Adding 4530432k swap on /dev/block/zram0.  Priority:-2 extents:1 across:4530432k SS
[   35.893905][  T229] type=1400 audit(1748526591.392:317): avc: denied { entrypoint } for comm="init" path="/system/bin/fix_traceing" dev="dm-0" ino=8778258 scontext=u:r:shell:s0 tcontext=u:object_r:system_file:s0 tclass=file permissive=1
[   35.955090][  T229] type=1400 audit(1748526591.452:318): avc: denied { dac_read_search } for comm="runin.sh" capability=2 scontext=u:r:shell:s0 tcontext=u:r:shell:s0 tclass=capability permissive=1
[   35.989174][  T229] type=1400 audit(1748526591.484:319): avc: denied { search } for comm="treadahead" name="/" dev="mmcblk0p22" ino=2 scontext=u:r:vendor_init:s0 tcontext=u:object_r:unlabeled:s0 tclass=dir permissive=1
[   35.989614][ T1658] treadahead: /treadahead/readahead_file_offset not exist;
[   36.021142][ T1658] treadahead: go to read trace
[   36.226833][  T344] healthd: battery none chg=
[   36.233557][  T344] healthd: battery none chg=
[   36.242210][  T184] get ctp_power is fail, -22
[   36.247556][  T184] get ctp_power_ldo_vol is fail, -22
[   36.255059][  T184] sunxi_ctp_startup: ctp_power_io is invalid.
[   36.261894][  T184] get ctp_gesture_wakeup fail, no gesture wakeup
[   36.270165][  T184] i2c 2-0040: supply ctp not found, using dummy regulator
[   36.287139][  T344] healthd: battery none chg=
[   36.318690][  T184] can not get fw from file gsl_firmware/gsl1680_7inch.bin
[   36.328547][  T184] input: gslX680 as /devices/platform/soc@3000000/2512000.twi/i2c-2/2-0040/input/input3
[   36.328604][  T344] healthd: battery none chg=
[   36.344913][  T344] healthd: battery none chg=
[   36.346238][  T184] ERROR! get hall_para failed, func:switch_init, line:236
[   36.350540][  T344] healthd: battery none chg=
[   36.363209][  T344] healthd: battery none chg=
[   36.363377][  T229] type=1400 audit(1748526591.860:320): avc: denied { read } for comm="InputReader" name="u:object_r:vendor_awdisplayoutput_prop:s0" dev="tmpfs" ino=301 scontext=u:r:system_server:s0 tcontext=u:object_r:vendor_awdisplayoutput_prop:s0 tclass=file permissive=1
[   36.371924][  T344] healthd: battery none chg=
[   36.397127][  T229] type=1400 audit(1748526591.860:321): avc: denied { open } for comm="InputReader" path="/dev/__properties__/u:object_r:vendor_awdisplayoutput_prop:s0" dev="tmpfs" ino=301 scontext=u:r:system_server:s0 tcontext=u:object_r:vendor_awdisplayoutput_prop:s0 tclass=file permissive=1
[   36.400495][    C7] [BT_LPM] bluesleep_rx_timer_expire: bluesleep_rx_timer_expire
[   36.404502][  T344] healthd: battery none chg=
[   36.431874][  T229] type=1400 audit(1748526591.860:322): avc: denied { getattr } for comm="InputReader" path="/dev/__properties__/u:object_r:vendor_awdisplayoutput_prop:s0" dev="tmpfs" ino=301 scontext=u:r:system_server:s0 tcontext=u:object_r:vendor_awdisplayoutput_prop:s0 tclass=file permissive=1
[   36.553997][ T1104] >>> rwnx_rx_scanu_start_cfm()
[   36.575575][  T229] type=1400 audit(1748526592.072:324): avc: denied { write } for comm="HwBinder:346_2" name="property_service" dev="tmpfs" ino=335 scontext=u:r:mediacodec:s0 tcontext=u:object_r:property_socket:s0 tclass=sock_file permissive=1
[   36.600890][  T229] type=1400 audit(1748526592.072:325): avc: denied { connectto } for comm="HwBinder:346_2" path="/dev/socket/property_service" scontext=u:r:mediacodec:s0 tcontext=u:r:init:s0 tclass=unix_stream_socket permissive=1
[   36.624583][  T229] type=1107 audit(1748526592.072:326): uid=0 auid=4294967295 ses=4294967295 subj=u:r:init:s0 msg='avc: denied { set } for property=vendor.display.codec2_aisr_process pid=346 uid=1046 gid=1006 scontext=u:r:mediacodec:s0 tcontext=u:object_r:vendor_default_prop:s0 tclass=property_service permissive=1'
[   36.849265][ T1450] [BT_LPM] bluesleep_tx_allow_sleep: Tx has been idle
[   36.849265][ T1450]
[   36.964510][ T1919] audit_log_lost: 503 callbacks suppressed
[   36.964516][ T1919] audit: audit_lost=172 audit_rate_limit=5 audit_backlog_limit=64
[   36.967844][  T229] type=1400 audit(1748526592.460:327): avc: denied { setattr } for comm="chmod" name="/" dev="tracefs" ino=1 scontext=u:r:shell:s0 tcontext=u:object_r:debugfs_tracing_debug:s0 tclass=dir permissive=1
[   36.971757][ T1919] audit: rate limit exceeded
[   37.158118][ T1309] BOOTEVENT:     37158.117399: OFF
[   37.369794][  T338] [BT_LPM] bluesleep_outgoing_data: tx was sleeping, wakeup it
[   37.417090][  T229] type=1400 audit(1748526592.916:330): avc: denied { read } for comm="binder:254_2" name="event_count" dev="sysfs" ino=46443 scontext=u:r:system_suspend:s0 tcontext=u:object_r:sysfs:s0 tclass=file permissive=1
[   37.447404][  T229] type=1400 audit(1748526592.916:331): avc: denied { open } for comm="binder:254_2" path="/sys/devices/platform/soc@3000000/7083000.twi/i2c-13/13-004e/wakeup/wakeup12/event_count" dev="sysfs" ino=46443 scontext=u:r:system_suspend:s0 tcontext=u:object_r:sysfs:s0 tclass=file permissive=1
[   37.477822][  T229] type=1400 audit(1748526592.916:332): avc: denied { getattr } for comm="binder:254_2" path="/sys/devices/platform/soc@3000000/7083000.twi/i2c-13/13-004e/wakeup/wakeup12/event_count" dev="sysfs" ino=46443 scontext=u:r:system_suspend:s0 tcontext=u:object_r:sysfs:s0 tclass=file permissive=1
[   37.636006][  T229] type=1400 audit(1748526593.132:333): avc: denied { search } for comm="android.hardwar" name="1" dev="proc" ino=30 scontext=u:r:hal_power_default:s0 tcontext=u:r:init:s0 tclass=dir permissive=1
[   37.657750][  T229] type=1400 audit(1748526593.132:334): avc: denied { read } for comm="android.hardwar" name="cmdline" dev="proc" ino=23769 scontext=u:r:hal_power_default:s0 tcontext=u:r:init:s0 tclass=file permissive=1
[   37.868174][    C1] [BT_LPM] bluesleep_rx_timer_expire: bluesleep_rx_timer_expire
[   38.027515][ T1658] treadahead: getpartitiondev /system= 254:0
[   38.036843][ T1658] treadahead: getpartitiondev /product= 254:2
[   38.045477][ T1658] treadahead: getpartitiondev /vendor= 254:1
[   38.053325][ T1658] treadahead: getpartitiondev /vendor_dlkm= 254:3
[   38.092516][ T1658] audit: audit_lost=277 audit_rate_limit=5 audit_backlog_limit=64
[   38.101804][ T1658] audit: rate limit exceeded
[   38.108677][ T1658] treadahead:  begain fgets_alloc ======== 254:0   254:2
[   38.892175][    C1] [BT_LPM] bluesleep_rx_timer_expire: bluesleep_rx_timer_expire
[   39.916177][    C1] [BT_LPM] bluesleep_rx_timer_expire: bluesleep_rx_timer_expire
[   40.401219][ T1450] [BT_LPM] bluesleep_tx_allow_sleep: Tx has been idle
[   40.401219][ T1450]
[   41.420174][    C5] [BT_LPM] bluesleep_rx_timer_expire: bluesleep_rx_timer_expire
[   41.435573][   T79] [BT_LPM] bluesleep_sleep_work: going to sleep...
[   42.390131][ T1658] treadahead: treadahead read-trace over 327701  345525
[   42.505827][    T1] init: starting service 'vendor.drm-clearkey-service'...
[   42.518906][    T1] init: Control message: Processed ctl.interface_start for 'aidl/android.hardware.drm.IDrmFactory/clearkey' from pid: 214 (/system/bin/servicemanager)
[   42.565481][    T1] init: starting service 'vendor.drm-widevine-hal'...
[   42.579417][    T1] init: Control message: Processed ctl.interface_start for 'aidl/android.hardware.drm.IDrmFactory/widevine' from pid: 214 (/system/bin/servicemanager)
[   42.733367][ T1658] treadahead: treadahead write trace end
[   42.990365][    T1] init: processing action (persist.service.dragon.start=1) from (/system/etc/init/dragonservice.rc:1)
[   43.004493][    T1] init: starting service 'dragonservice'...
[   43.104392][    T1] init: processing action (persist.service.dragon.start=0) from (/system/etc/init/dragonservice.rc:4)
[   43.116584][    T1] init: Sending signal 9 to service 'dragonservice' (pid 2469) process group...
[   43.132631][    T1] libprocessgroup: Successfully killed process cgroup uid 0 pid 2469 in 5ms
[   43.143970][    T1] init: Service 'dragonservice' (pid 2469) received signal 9
[   51.168801][ T1658] treadahead: read trace end
[   51.476065][ T1658] treadahead: begin match traceinfo
[   51.483300][  T229] type=1400 audit(1748526606.980:443): avc: denied { search } for comm="treadahead" name="/" dev="mmcblk0p22" ino=2 scontext=u:r:vendor_init:s0 tcontext=u:object_r:unlabeled:s0 tclass=dir permissive=1
[   51.505850][  T229] type=1400 audit(1748526606.980:444): avc: denied { write } for comm="treadahead" name="/" dev="mmcblk0p22" ino=2 scontext=u:r:vendor_init:s0 tcontext=u:object_r:unlabeled:s0 tclass=dir permissive=1
[   51.529592][  T229] type=1400 audit(1748526606.980:445): avc: denied { add_name } for comm="treadahead" name="readahead_file_offset" scontext=u:r:vendor_init:s0 tcontext=u:object_r:unlabeled:s0 tclass=dir permissive=1
[   51.551336][  T229] type=1400 audit(1748526606.980:446): avc: denied { create } for comm="treadahead" name="readahead_file_offset" scontext=u:r:vendor_init:s0 tcontext=u:object_r:unlabeled:s0 tclass=file permissive=1
[   51.573015][  T229] type=1400 audit(1748526606.980:447): avc: denied { read write open } for comm="treadahead" path="/treadahead/readahead_file_offset" dev="mmcblk0p22" ino=15 scontext=u:r:vendor_init:s0 tcontext=u:object_r:unlabeled:s0 tclass=file permissive=1
[   51.602351][    T1] init: Service 'vendor.drm-clearkey-service' (pid 2434) exited with status 0 oneshot service took 9.086000 seconds in background
[   51.617399][    T1] init: Sending signal 9 to service 'vendor.drm-clearkey-service' (pid 2434) process group...
[   51.629259][    T1] libprocessgroup: Successfully killed process cgroup uid 1013 pid 2434 in 0ms
[   51.652328][    T1] init: Service 'vendor.drm-widevine-hal' (pid 2437) exited with status 0 oneshot service took 9.077000 seconds in background
[   51.667180][    T1] init: Sending signal 9 to service 'vendor.drm-widevine-hal' (pid 2437) process group...
[   51.678647][    T1] libprocessgroup: Successfully killed process cgroup uid 1013 pid 2437 in 0ms
[   51.948662][ T1658] audit: audit_lost=282 audit_rate_limit=5 audit_backlog_limit=64
[   51.957280][ T1658] audit: rate limit exceeded
[   52.019280][ T1658] treadahead: trace readahead complete
[   52.019840][    T1] init: processing action (persist.device_config.runtime_native_boot.iorap_perfetto_enable=true && persist.sys.without.treadahead=1 && ro.iorapd.enable=true) from (/system/etc/init/iorapd.rc:34)
[   52.047472][    T1] init: starting service 'iorapd'...
[   52.060493][    T1] init: Service 'treadahead_trace' (pid 1658) exited with status 0 oneshot service took 16.128000 seconds in background
[   52.074782][    T1] init: Sending signal 9 to service 'treadahead_trace' (pid 1658) process group...
[   55.383165][  T500] >>> rwnx_cfg80211_scan()
[   55.388008][  T500] >>> rwnx_send_scanu_req()
[   56.542667][ T1104] >>> rwnx_rx_scanu_start_cfm()

console:/ $
console:/ $
console:/ $

#122 Re: 全志 SOC » t113 xplayerdemo抖动,显示缓冲区挂掉的问题 » 2025-05-10 21:32:44

用tplayerdemo测试看看,估计效果也差不多,可能是CPU占用率高的时候丢帧了。

#123 Re: 全志 SOC » 哪位成功配置了MIPI ILI9881的吗? » 2025-05-10 18:33:18

memory wrote:

lanlanzhilian wrote:

现在好多屏幕都是直接29 11就显示了

屏组装厂固化参数的才行,大部分厂家都没固化。

是不显示吗?找显示屏厂商要初始化参数。

#125 Re: 全志 SOC » 【视频分享】制作荔枝派Zero开发板(全志V3s) TF/SD卡启动盘 » 2025-05-04 17:53:23

ryanpham wrote:

/files/members/16486/Untitled.jpegHello I create the image as guideline from but I met a problem as image bellow:
Could you please help me

(V3s/V3x/S3/S3L/R11通吃)小智V3x开发板smallwitpi lite u-boot/linux/buildroot测试
https://whycan.com/t_7248.html

#126 Re: 全志 SOC » 求全志T113-S3寄存器地址等底资料 » 2025-04-24 10:54:30

通过网盘分享的文件:T113_Tina5.0 V1.2
链接: https://pan.baidu.com/s/1vhUfWqklOFop_GJs_fegmw?pwd=TN12 提取码: TN12

T113-S3/T113-S4/T113-i 全整合在一起了

#128 Re: 全志 SOC » 求助F1C100S裸机连接J-LINK后如何单步调试 » 2025-03-27 11:06:42

@kingfa025
可以,KEIL工程配置可以设置初始化脚本文件,这个脚本可以配置DDR控制器,配好就能访问整块DDR了,前提是JTAG能正常访问ARM9 CORE

#130 Re: 全志 SOC » 45块顺丰包邮买到的10.1寸保资LCD价签F1C200S 值不值 » 2025-03-22 16:58:59

li6848 wrote:

只能看到#210楼。新的回复都看不到……是灌水评论被管理删了吗?

是的,都是一些垃圾帖。

#131 Re: 全志 SOC » 新人求教!关于T113-S3 SMHC1能否连接到SD卡的问题 » 2025-03-22 09:41:07

SDC1可以接TF卡,改下board.dts里面的驱动即可,但是SDC1不能引导系统。

另一种方案:
设计一片 SD NAND + JTAG(全志soc) 转接板 [切记切记0.8mm厚度]
https://whycan.com/t_2025.html

#134 Re: 全志 SOC » 如何破解一块串口屏当开发板 » 2025-02-20 09:17:54

yin wrote:

请教一个问题,我看串口屏用的是PE9 PE10作为I2C引脚,但是实际引脚复用里面这两个引脚是没有I2C复用功能的,你用的是软件I2C吗?谢谢,在这个屏上刷了linux,但是发现触摸屏用的I2C总线的引脚不具有硬件I2C复用功能。

用逻辑分析仪抓包,用io程序回放即可。
linux也有一个gpio的i2c驱动。

#135 Re: 全志 SOC » XFEL已支持spi nand flash烧写 » 2025-02-17 10:54:04

KoGu wrote:

请问一下,我在linux下clone了源码,然后我添加里的自己板子上的flash型号,我要怎么编译出win10下使用的exe呢?

用 MSVC2017 编译 XFEL 项目
https://whycan.com/t_6660.html

#136 Re: GM8135s/GM8136s/GM8135/GM8136/GM8125/GM8126 » GM8135s入坑记录 » 2025-02-05 10:43:48

舟渡 wrote:

不知道大佬们是否能看到,我这刚拆了一个1516年的安防网络摄像头,不知道怎么烧录,求大佬帮助

https://item.taobao.com/item.htm?id=710573620450

配套④编程器+SOP8测试线+200mil烧录座

#138 Re: 全志 SOC » 45块顺丰包邮买到的10.1寸保资LCD价签F1C200S 值不值 » 2024-12-26 20:04:38

18578292200 wrote:

新回复的内容好像看不到了?

没有营养的跟帖不显示

#139 Re: 全志 SOC » 初学者小白的第一点疑问 » 2024-12-16 11:21:54

XBOOT只要能编译出固件,用 sunxi-fel 烧录到SPI FLASH就可以运行了。

细节问题XBOOT已经处理好了。

#140 Re: 全志 SOC » 初学者小白的第一点疑问 » 2024-12-16 10:37:08

淘宝搜下 小淘气

他们的SDK可以用MDK开发

#142 Re: 全志 SOC » 全志H3要用qt该怎么做? » 2024-12-09 08:49:24

zyz_432 wrote:

楼主,问题解决了吗我也遇到了同样问题,交叉编译编译不过,在板子上H3编译编几个小时后也报错,快奔溃了

用buildroot,配置为h3 sdk里面相同的toolchain就可以顺利编译。

#143 Re: 全志 SOC » f1c200(板子widora tiny200-r3)的lvgl7.11.0移植例程(屏是800x480的电容屏) » 2024-11-25 20:45:44

KingDong wrote:

你好,我自己做的板子 也是Tina系统,编译出了出来的LVGL 运行不起来,提示我

root@TinaLinux:~# ls
demo
root@TinaLinux:~# ./demo 1
-/bin/sh: ./demo: not found

编译命令行加静态链接参数, -static

#144 Re: 全志 SOC » T113-I ddr初始化失败[悬赏200块] » 2024-11-18 09:42:52

suibian wrote:

哈哈,200要归我了。
找到全志的参考原理图调整数据线的线序,你这个线序不对。

@aeo1234 请问楼主你的问题解决了吗?

已给楼主发 email

#146 Re: DIY/综合/Arduino/写字机/3D打印机/智能小车/平衡车/四轴飞行/MQTT/物联网 » Linux 开发板选择。 » 2024-10-29 17:20:32

GGDuck wrote:

新手小白最近想入手泰山派学linux,请问一下他的生态比树莓派好吗?

入门建议 树莓派,文字教程视频教程都比较多,
也可以选 百问网韦老师,正点原子或者野火等教程多的开发板,
泰山派建议有一定基础再入手。

#147 Re: 全志 SOC » T113-i spi nand 启动失败 » 2024-10-27 20:38:27

@zx2132

[    2.397788] 0x000000500000-0x000008000000 : "sys"
[    2.465305] sunxi-spinand-phy: phy blk 245 is bad
[    2.528048] sunxi-spinand-phy: phy blk 440 is bad
[    2.589057] sunxi-spinand-phy: phy blk 635 is bad
[    2.648875] sunxi-spinand-phy: phy blk 830 is bad

[    6.117168] VFS: Cannot open root device "ubi0_3" or unknown-block(0,0): error -19
[    6.125666] Please append a correct "root=" boot option; here are the available partitions:
[    6.135105] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)

换片 flash 试一试

#148 Re: 全志 SOC » T113使用gpadc去采集电压。不知道是不是设置有问题,不能读取 » 2024-10-11 06:58:26

无情一刀 wrote:

哇酷小二 wrote:

不能用这个驱动,貌似有另外一个读adc值驱动。

或者直接在用户层devmem读取/dev/mem adc寄存器。

现在就是不知道这个读取adc值的驱动是那个 ,可能驱动不对,我的dev下没有这个mem的寄存器值

https://cn.bing.com/search?q=devmem%20site:whycan.com

#150 Re: 全志 SOC » 用什么工具开发基于开发板的应用比较方便 » 2024-09-30 09:54:28

mobaxterm ssh 终端勾上 X11-Forwarding 可以直接显示基于SDL的LVGL app窗口

#152 Re: 全志 SOC » V3s buildroot 一键生成打包生成32M spi flash 镜像, jffs2 文件系统, 默认启动 Qt 模拟时钟demo, » 2024-09-23 17:07:53

lsknife wrote:

路人 wrote:

@晕哥
env.bin文件没有自动生成,这文件是什么?

同意遇到这个问题了,env.bin生产失败是什么原因呢

建议移步到:
(V3s/V3x/S3/S3L/R11通吃)小智V3x开发板smallwitpi lite u-boot/linux/buildroot测试

#153 Re: 全志 SOC » 请问有没有大神搞定了f1c100s的主线kernel4.19下的声卡驱动?[13楼@wammaw1314搞定声卡驱动,欢迎测试] » 2024-09-18 11:00:43

retroman wrote:

有人试过6.6内核吗, 现在用6.6别的都正常, 就差声卡了. 打了Mesih Kilinc的补丁, 声卡设备是认了, 但是没有声音出, 没有头绪了.

buildroot-tiny200 (F1C100/200s) 开发包近期更新内容 已支持DVP摄像头 ,支持SPI NAND
https://whycan.com/t_5221.html

可以先用这个测试

#154 Re: 全志 SOC » V3s 应用程序 segmentation fatult » 2024-09-12 17:36:45

netonet88 wrote:

内存泄漏会把整个文件系统都破坏掉吗?但系统看上去都正常,文件也都在,就是应用程序运时就报错

比较一下可执行文件和依赖的so文件的md5码

#156 Re: 全志 SOC » 全志分区的解打包 » 2024-09-09 17:26:10

试一试通过uboot或者linux命令替换上面的 bootlogo.bmp文件

#159 Re: 全志 SOC » 使用T113S3 tina linux驱动ST7701S RGB长条屏幕,显示lvgl demo分两半问题 » 2024-08-30 10:35:56

我翻了一下 →→→ST7701S手册←←←

支持以下分辨率

Display Resolution
- 480*RGB (H) *960(V) (FWVGA)
- 480*RGB (H) *864(V) (WVGA)
- 480*RGB (H) *854(V)
- 480*RGB (H) *800(V)
- 480*RGB (H) *720(V)
- 480*RGB (H) *640(V) (VGA)
- 480*RGB (H) *360(V)

如果没猜错的话,接受分辨率应该是480RGB (H) 960(V) (FWVGA)

实际面板被剪裁到了 400*960,你问下供应商是不是这样?

#160 Re: 全志 SOC » 小白自制Linux开发板(F1C200s)整理系列,持续更新中 » 2024-08-29 16:44:15

姓名死机了 wrote:

最近开始对开发板感兴趣了,向大佬学习一下

请发这种帖:

老树也能开新花,A20都用上linux6了
https://whycan.com/t_11345.html

#161 Re: 全志 SOC » 准备把Qt5.9.2运行在AllWinner全志V3s荔枝派zero板子上 » 2024-08-29 15:07:15

范特西 wrote:

请问这个平台能把opengl编进去吗?

V3s没有GPU不支持OpenGL,A33/A133支持OpenGL。

#163 Re: 全志 SOC » ubuntu 22.03不能显示中文是哪里不对啊? » 2024-08-28 20:14:23

ubuntu@ubuntu:/opt$ 
ubuntu@ubuntu:/opt$ cat /etc/issue
Ubuntu 22.04.3 LTS \n \l

ubuntu@ubuntu:/opt$ 
ubuntu@ubuntu:/opt$ 
ubuntu@ubuntu:/opt$ export |grep UTF-8
declare -x LANG="en_US.UTF-8"
declare -x LC_ADDRESS="zh_CN.UTF-8"
declare -x LC_IDENTIFICATION="zh_CN.UTF-8"
declare -x LC_MEASUREMENT="zh_CN.UTF-8"
declare -x LC_MONETARY="zh_CN.UTF-8"
declare -x LC_NAME="zh_CN.UTF-8"
declare -x LC_NUMERIC="zh_CN.UTF-8"
declare -x LC_PAPER="zh_CN.UTF-8"
declare -x LC_TELEPHONE="zh_CN.UTF-8"
declare -x LC_TIME="zh_CN.UTF-8"
ubuntu@ubuntu:/opt$ 
ubuntu@ubuntu:/opt$ 
ubuntu@ubuntu:/opt$ 
ubuntu@ubuntu:/opt$ ls /mnt/hgfs/D/*.txt -l
-rwxrwxrwx 1 root root  6853  8月 14 21:51  /mnt/hgfs/D/1.txt
-rwxrwxrwx 1 root root 27295  8月 14 21:52  /mnt/hgfs/D/2.txt
-rwxrwxrwx 1 root root  2348  8月 14 22:02  /mnt/hgfs/D/3.txt
-rwxrwxrwx 1 root root  3317  8月 14 22:02  /mnt/hgfs/D/4.txt
-rwxrwxrwx 1 root root 16537  8月 13 09:17  /mnt/hgfs/D/5.txt
-rwxrwxrwx 1 root root 66847  7月 14 21:09  /mnt/hgfs/D/t113_i_nezha_error.txt
-rwxrwxrwx 1 root root 34186  7月 14 20:51  /mnt/hgfs/D/t113_s3_sw113_error.txt
-rwxrwxrwx 1 root root 39927  7月 14 20:53  /mnt/hgfs/D/t113_s3_sw113_ok.txt
-rwxrwxrwx 1 root root   923  7月 13 15:56  /mnt/hgfs/D/test.txt
-rwxrwxrwx 1 root root     0  6月  3 17:21  /mnt/hgfs/D/中国.txt
-rwxrwxrwx 1 root root 13826  8月  5 11:27 '/mnt/hgfs/D/新文件 24.txt'
-rwxrwxrwx 1 root root 35635  8月  5 11:27 '/mnt/hgfs/D/新文件 25.txt'
-rwxrwxrwx 1 root root 37255  8月  5 11:36 '/mnt/hgfs/D/新文件 26.txt'
-rwxrwxrwx 1 root root 87707  8月  5 11:55 '/mnt/hgfs/D/新文件 27.txt'
-rwxrwxrwx 1 root root 93467  8月  5 11:57 '/mnt/hgfs/D/新文件 28.txt'
-rwxrwxrwx 1 root root 35862  8月  5 12:21 '/mnt/hgfs/D/新文件 29.txt'
ubuntu@ubuntu:/opt$ 
ubuntu@ubuntu:/opt$ 

"en_US.UTF-8" 不应该是 "zh_CN.UTF-8" 吗?

#164 Re: 全志 SOC » T113的tina编译gtk报错 » 2024-08-24 06:58:59

s45123456789 wrote:

晕哥 wrote:

@s45123456789
T113不支持,A133支持wayland。

哦哦,这样呀。大佬,那T113有什么办法编译出gtk的webkit来用吗?

不建议,估计得卡成ppt

#165 Re: 全志 SOC » T113的tina编译gtk报错 » 2024-08-23 19:09:17

@s45123456789
T113不支持,A133支持wayland。

#166 Re: 全志 SOC » 开源个 D1 / D1-H核心板 » 2024-08-23 13:57:41

arychen wrote:

这个跟T113-I pin2pin吗

是的,但是T113-i缺HDMI功能。

#167 Re: 全志 SOC » 全志H6的USB0 OTG模式连接电脑没有任何反应 » 2024-08-22 17:02:44

剑圣UZI wrote:

应该是主线linux吧,uname -a 的output:
Linux orangepi3-lts 5.10.75-sun50iw6 #2.2.2 SMP Wed Apr 20 09:45:07 CST 2022 aarch64 aarch64 aarch64 GNU/Linux

参考这个看看:请问下主线 V3s Linux 如何在程序运行中自动切换USB模式: otg/host/peripheral

#169 Re: 全志 SOC » T113-S3 对比 v3s » 2024-08-21 15:40:27

wonrowl wrote:

V3S经常抽风,感觉是个半成品,我的板子就是莫名其妙的问题,我都放弃V3S了,

V3S的编解码器也没用起来过😞

V3S芯片没有问题的,这个芯片出货量挺大。

#170 Re: 全志 SOC » T113-S3 对比 v3s » 2024-08-21 15:39:25

chendong wrote:

晕哥 wrote:

V3s有mipi camera和h264 encoder,T113-S3没有。

T113-S3外设更丰富,内存128M。

晕哥,哪里能下下到最新的版本的v3s的声卡驱动,我现在内核是3.4 的,播放网络音乐时不时出现xrun, 不知道是不是驱动问题。

是不是没有建缓冲区?凡数字方式传播音乐,都要在接收端建缓冲区。

#171 Re: 全志 SOC » T113-S3 对比 v3s » 2024-08-21 15:37:37

wonrowl wrote:

大佬,这论坛有没有改版的计划啊,发个图片什么都麻烦的要死😰

晕哥 wrote:

V3s有mipi camera和h264 encoder,T113-S3没有。

T113-S3外设更丰富,内存128M。

感谢您的建议,其实计划早就有了,只是缺money。

一定改,只是时间问题,谢谢支持。

#173 Re: 全志 SOC » 有没有tf卡座接口的sd芯片啊? » 2024-08-18 23:01:08

8p是啥?我记得tf卡座是9p的吧,也许我记错了

8p是指sdnand芯片封装

#174 Re: 全志 SOC » 有没有tf卡座接口的sd芯片啊? » 2024-08-18 23:00:29

我说的就是这意思啊,为啥不把tf卡芯片封装成卡座那种9针的,直接往卡座上一焊就行了,这些厂家非要自己搞个两排八脚的封装出来,通用性差了十万八千里,搞成通用封装所有的产品只要把卡座拆掉,都不用改板子

每个用户需求不同,可以考虑自己做一个转接板,类似这种:

设计一片 SD NAND + JTAG(全志soc) 转接板 [切记切记0.8mm厚度]
https://whycan.com/t_2025.html

改成半孔的

#175 Re: 全志 SOC » 有没有tf卡座接口的sd芯片啊? » 2024-08-18 22:57:56

echo wrote:

晕哥 wrote:

用TF卡直接做产品基本没有,因为那个接插口太不可靠了。

米兔故事机内部就是TF卡槽+TF卡存储当内置存储用。

消费电子产品这样用,问题也不大.

但是如果是类工业设备,经过一个春夏秋冬触点大概就氧化差不多了.即使不氧化,运输途中的颠簸就够喝一壶.

#176 Re: 全志 SOC » 有没有tf卡座接口的sd芯片啊? » 2024-08-18 22:55:47

microxp wrote:

晕哥 wrote:

用TF卡直接做产品基本没有,因为那个接插口太不可靠了。

我说的就是这意思啊,为啥不把tf卡封装成卡座那种9针的,直接往卡座上一焊就行了

啊这,8p不是更好吗?

#177 Re: 全志 SOC » v3s 如何在线更新内核。 » 2024-08-18 22:54:16

chendong wrote:

用的正是spi nand。歇菜了。

也可以刷,命令不同,应该是用ubi相关命令.

#178 Re: 全志 SOC » 有没有tf卡座接口的sd芯片啊? » 2024-08-18 21:22:57

用TF卡直接做产品基本没有,因为那个接插口太不可靠了。

#179 Re: 全志 SOC » v3s 如何在线更新内核。 » 2024-08-18 20:28:09

emmc tf卡 可以用dd,

spi nor和spi nand不行

#180 Re: 全志 SOC » 拜求大佬帮我看看我编译f1c200s的uboot遇到的问题 » 2024-08-18 16:54:04

arch/arm/dts/suniv-f1c100s-licheepi-nano.dts

59行有语法错误

#181 Re: 全志 SOC » T113-S3 对比 v3s » 2024-08-17 22:09:33

V3s有mipi camera和h264 encoder,T113-S3没有。

T113-S3外设更丰富,内存128M。

#182 Re: 全志 SOC » 全职v3s 换到I2C出现GPIO报错问题有谁知道! » 2024-08-17 21:08:44

hai2599 wrote:

全志v3s TWI1 能PB8 PB9 也能 PE21 PE22的吗??

串口已经用PB8 PB9了

内核是用5.2的。。

没有这么用过,感觉不行,或许可以。

#185 Re: 全志 SOC » t113i + openwrt tina » 2024-08-10 19:38:07

这是A523 ddr调整方法:

  1. 查看DDR频点
    a523-pro:/ # cat /sys/class/devfreq/3120000.dmcfreq/available_frequencies
    154000000 528000000 739200000 924000000

  2. 查看实时频率参数的节点
    echo 1 > /sys/module/sun55iw3_devfreq/parameters/dbg_level
    或者
    echo > 1 /sys/module/ccu_ddr/parameters/dbg_level
    如果还是找不到,就到/sys/module/下find -name dbg_level找到具体的路径执行echo 1即可
    响应的串口打印

[ 434.856467][ T496] drate:154M load:57 rw:705M total:1232M
[ 434.870411][ T496] drate:154M load:55 rw:684M total:1232M
[ 434.889498][ T496] drate:154M load:42 rw:521M total:1232M
[ 434.899553][ T496] drate:154M load:62 rw:771M total:1232M
[ 434.909495][ T496] drate:154M load:41 rw:506M total:1232M
可以看到当前的DDR频率是154MHz

T113芯片可能不支持

#186 Re: 全志 SOC » D1s调试lvds,求解? » 2024-08-09 14:06:16

@ghosoft
把正常的文件和不正常的文件都发上来看看

#187 Re: 全志 SOC » t113i + openwrt tina » 2024-08-09 10:51:18

1、CPU 频率可以再现有系统调整,DDR有类似方法吗?还是必须配置内核,重新编译烧录?

这句没看懂

#188 Re: 全志 SOC » D1s调试lvds,求解? » 2024-08-08 16:32:55

退回去再一步一步修改,看改到哪一步的时候触发Unhandled exception: Load access fault

#190 Re: 全志 SOC » 求助! 全志H133录音是能正常录进去声音 但是伴随有哒哒哒的杂音 » 2024-08-06 14:20:32

是麦克风录音吗,检查一下麦克风周边电路。

还有检查一下采集的录音数据是否完整,如果丢了一些数据可能也会有杂音。

#191 Re: 全志 SOC » 哪一个是最新的BuildRoot合适F1C100s? » 2024-08-06 11:50:30

可能是编译环境的问题,我这边用Ubuntu18.04 编译 aodzip/buildroot-tiny200 正常。

#192 Re: 全志 SOC » f1c100s如何设置root开机免密自动登陆 » 2024-08-05 18:19:21

晕哥 wrote:

https://whycan.cn/t_542.html#p12585

找到 /etc/inittab 文件的

console::respawn:/sbin/getty -L console 0 vt100 # GENERIC_SERIAL

修改为:

console::respawn:-/bin/sh

重启后就没有恼人的 login 提示了.

这里有个问题,会导致没有加载用户配置,没有$HOME 环境变量。

改成这样:
console::respawn:/bin/login -f root

解决$HOME环境变量问题。

# export
export EDITOR='/bin/vi'
export HOME='/root'
export LOGNAME='root'
export PATH='/bin:/sbin:/usr/bin:/usr/sbin'
export PS1='# '
export PWD='/root'
export SHELL='/bin/sh'
export SHLVL='1'
export TERM='vt102'
export USER='root'
#

#193 Re: 全志 SOC » 有没有在全志 V3s下用过Spi nand flash的朋友? » 2024-08-04 16:30:53

hdlazyhy wrote:

我的开发板上就是这个nand flash芯片。是不是需要在sunxi-tools中添加支持。正好找到这。

xfel 支持spi nand读写

#194 Re: 全志 SOC » 请教V3S驱动1024分辨率屏的问题 » 2024-08-04 15:42:08

可能在 uboot 里面有个显存大小配置不够大,导致初始化失败

#195 Re: 全志 SOC » 荔枝派nano f1c100s开发板连接JLink调试器分享 » 2024-08-04 11:01:25

袜裤够穿吗 wrote:

晕哥,jlink可以固化程序到flash吗?还是只能在内存中调试呢?

单步调试必须在内存,加魔术头之后可以固化到flash,参考 mksunxi.c

#196 Re: 全志 SOC » t113i + openwrt tina » 2024-08-01 22:11:34

CPU和DDR降频排除硬件问题

#197 Re: 全志 SOC » V3s/S3/f1c100s通过USB启动Linux,并把SD NAND/TF卡挂载为U盘, 可以dd或Win32DiskImager任烧写 » 2024-07-28 13:02:02

海石生风 wrote:

提示出错的语句为f'{x}'语法,这是python3.6起才支持的语法,很可能反而是python3没有安装。

有道理,不过我看了早期的uboot版本里面binman确实用的是Python2.7

#198 Re: 全志 SOC » V3s/S3/f1c100s通过USB启动Linux,并把SD NAND/TF卡挂载为U盘, 可以dd或Win32DiskImager任烧写 » 2024-07-28 11:05:48

田维龙 wrote:

/files/members/14964/sshot-1.png
晕哥编译v3s的uboot的时候有遇到过這个问题吗?

没记错的话,binman 是一个 python2.x 版本,先检查一下 python2.7 有没有安装?或者看下 /usr/bin/python 是不是软链接到 python3.x 了?

#199 Re: 全志 SOC » 全志a133支持同时控制多个屏幕吗 » 2024-07-14 18:41:28

那可以,只要CPU,DRAM和网络带宽允许,跑多少个都不是问题。

#200 Re: 全志 SOC » 全志a133支持同时控制多个屏幕吗 » 2024-07-14 18:00:48

A133只支持一个显示屏

D1-H,H133 支持一个HDMI(或CVBS) + 一个LCD
D1s,T113-S3,T113-S4,T113-i 支持一个 CVBS + 一个LCD

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn


东莞哇酷科技有限公司开发