Skip to content

Instantly share code, notes, and snippets.

@wltechblog
Last active August 22, 2024 16:32
Show Gist options
  • Save wltechblog/bcc30aca647ee8eac5cb80c6b7368b98 to your computer and use it in GitHub Desktop.
Save wltechblog/bcc30aca647ee8eac5cb80c6b7368b98 to your computer and use it in GitHub Desktop.
SD card firmware flash for Wuuk Y0510
#!/bin/sh
# WUUK Y0510 https://amzn.to/4dFlKv1
#
# Instructions
#
# Note: If we increase uboot beyond 256k this needs to be adjusted.
# Build thingino firmware, up to make pack_full, or grab full firmware file from github releases
# -- UPDATE --
# There are now 2 versions of this camera. Most use the sc4336p sensor, a few have the sc401ai sensor.
# if you install the sc4336p file and don't have video, grab the sc401ai file, rename it to autoupdate-full.bin,
# remove autoupdate-full.done, and reboot the camera to flash the new one.
# ------------
# Copy full thingio image to sd as /autoupdate-full.bin
# Put this script on sd as /FACTORY/factory_install.sh
# Insert SD card and power on camera, wait about 10 minutes, it will reboot a few times along the way.
mount -t vfat /dev/mmcblk0p1 /mnt
if [ ! -f /mnt/autoupdate-full.bin ]
then
echo "Missing update file, aborting"
exit
fi
echo "Extracing uboot"
dd if=/mnt/autoupdate-full.bin of=/mnt/u-boot-t31x.bin bs=1k count=256
if [ -f /mnt/u-boot-t31x.bin ] && [ -f /mnt/autoupdate-full.bin ]
then
rm -f /mnt/autoupdate-full.done
echo "Flashing uboot"
flashcp /mnt/u-boot-t31x.bin /dev/mtd0
echo "Rebooting"
reboot
else
echo "Files missing, not flashing"
fi
@ataa
Copy link

ataa commented May 18, 2024

Thank you for your prompt reply,
That's exactly what I have in the microSD card, I tried 3 different sandisk cards, still getting the same error. Maybe the cameras that I have is patched or has different software or bootloader on it, I am attaching full boot log.


U-Boot SPL 2013.07 (Mar 22 2023 - 10:49:33)
Timer init
CLK stop
PLL init
pll_init:366
pll_cfg.pdiv = 10, pll_cfg.h2div = 5, pll_cfg.h0div = 5, pll_cfg.cdiv = 1, pll_cfg.l2div = 2
nf=116 nr = 1 od0 = 1 od1 = 2
cppcr is 07405100
CPM_CPAPCR 0740510d
nf=100 nr = 1 od0 = 1 od1 = 2
cppcr is 06405100
CPM_CPMPCR 0640510d
nf=100 nr = 1 od0 = 1 od1 = 2
cppcr is 06405100
CPM_CPVPCR 0640510d
cppcr 0x9a7b5510
apll_freq 1392000000
mpll_freq 1200000000
vpll_freq = 1200000000
ddr sel mpll, cpu sel apll
ddrfreq 600000000
cclk  1392000000
l2clk 696000000
h0clk 240000000
h2clk 240000000
pclk  120000000
CLK init
SDRAM init
sdram init start
ddr_inno_phy_init ..!
phy reg = 0x00000007, CL = 0x00000007
ddr_inno_phy_init ..! 11:  00000004
ddr_inno_phy_init ..! 22:  00000006
ddr_inno_phy_init ..! 33:  00000006
REG_DDR_LMR: 00000210
REG_DDR_LMR: 00000310
REG_DDR_LMR: 00000110
REG_DDR_LMR, MR0: 00f73011
T31_0x5: 00000007
T31_0x15: 0000000c
T31_0x4: 00000000
T31_0x14: 00000002
INNO_TRAINING_CTRL 1: 00000000
INNO_TRAINING_CTRL 2: 000000a1
T31_cc: 00000003
INNO_TRAINING_CTRL 3: 000000a0
T31_118: 0000003c
T31_158: 0000003c
T31_190: 0000001e
T31_194: 0000001d
jz-04 :  0x00000051
jz-08 :  0x000000a0
jz-28 :  0x00000024
DDR PHY init OK
INNO_DQ_WIDTH   :00000003
INNO_PLL_FBDIV  :00000014
INNO_PLL_PDIV   :00000005
INNO_MEM_CFG    :00000051
INNO_PLL_CTRL   :00000018
INNO_CHANNEL_EN :0000000d
INNO_CWL        :00000006
INNO_CL         :00000007
DDR Controller init
DDRC_STATUS         0x80000001
DDRC_CFG            0x0aa88a42
DDRC_CTRL           0x0000011c
DDRC_LMR            0x00400008
DDRC_DLP            0x00000000
DDRC_TIMING1        0x050f0a06
DDRC_TIMING2        0x021c0a07
DDRC_TIMING3        0x200a0722
DDRC_TIMING4        0x26240031
DDRC_TIMING5        0xff060405
DDRC_TIMING6        0x321c0505
DDRC_REFCNT         0x00910503
DDRC_MMAP0          0x000020f8
DDRC_MMAP1          0x00002800
DDRC_REMAP1         0x030e0d0c
DDRC_REMAP2         0x07060504
DDRC_REMAP3         0x0b0a0908
DDRC_REMAP4         0x0f020100
DDRC_REMAP5         0x13121110
DDRC_AUTOSR_EN      0x00000000
sdram init finished
SDRAM init ok
board_init_r
image entry point: 0x80100000


U-Boot 2013.07 (Mar 22 2023 - 10:49:33)

Board: ISVP (Ingenic XBurst T31 SoC)
DRAM:  128 MiB
Top of RAM usable for U-Boot at: 84000000
Reserving 401k for U-Boot at: 83f98000
Reserving 32784k for malloc() at: 81f94000
Reserving 32 Bytes for Board Info at: 81f93fe0
Reserving 124 Bytes for Global Data at: 81f93f64
Reserving 128k for boot params() at: 81f73f64
Stack Pointer at: 81f73f48
Now running in RAM - U-Boot at: 83f98000
MMC:   msc: 0
the manufacturer a1
SF: Detected FM25Q128A

In:    serial
Out:   serial
Err:   serial
Hit any key to stop autoboot:  0
the manufacturer a1
SF: Detected FM25Q128A

===>Success to initialize SPI flash
BootConcifg: Magic[0xCBAE9527] Boot MTD[kernel:1 rootfs:2 appfs:3]
do_mmc_init start!
Interface:  MMC
  Device 0: Vendor: Man 000003 Snr 9f2d7201 Rev: 9.11 Prod: SB16G▒
            Type: Removable Hard Disk
            Capacity: 15193.5 MB = 14.8 GB (31116288 x 512)
Filesystem: FAT32 "DVR-Video  "
do_mmc_init success!
reading T31_0510.bin
Invalid firmware, size[ffffffff-f40000]
Bootargs: console=ttyS1,115200n8 mem=64M@0x0 rmem=64M@0x4000000 init=/linuxrc rootfstype=squashfs root=/dev/mtdblock2 system=/dev/mtdblock3 rw mtdparts=jz_sfc:256k(boot),1664k(kernel),1024k(root),6304k(appfs),32k(kernel2),32k(root2),6304k(appfs2),512k(param),128k(SN),-(bootconfig)
Bootcmd: sf probe;sf read 0x80600000 0x40000 0x1A0000; bootm 0x80600000
the manufacturer a1
SF: Detected FM25Q128A

--->probe spend 4 ms
SF: 1703936 bytes @ 0x40000 Read: OK
--->read spend 549 ms
## Booting kernel from Legacy Image at 80600000 ...
   Image Name:   Linux-3.10.14__isvp_swan_1.0__
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:    1573825 Bytes = 1.5 MiB
   Load Address: 80010000
   Entry Point:  80364900
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK

Starting kernel ...

[    0.000000] Initializing cgroup subsys cpu
[    0.000000] Initializing cgroup subsys cpuacct
[    0.000000] Linux version 3.10.14__isvp_swan_1.0__ (root@cp3) (gcc version 7.2.0 (Ingenic Linux-Release5.1.4.1-Default(xburst2(fp64)+glibc2.29+Go language) 2022.08-08 10:51:21) ) #1 PREEMPT Wed Mar 22 10:53:47 CST 2023
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU0 RESET ERROR PC:3F1A9713
[    0.000000] CPU0 revision is: 00d00100 (Ingenic Xburst)
[    0.000000] FPU revision is: 00b70000
[    0.000000] CCLK:1392MHz L2CLK:696Mhz H0CLK:200MHz H2CLK:200Mhz PCLK:100Mhz
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 0046b000 @ 00010000 (usable)
[    0.000000]  memory: 00035000 @ 0047b000 (usable after init)
[    0.000000] User-defined physical RAM map:
[    0.000000]  memory: 04000000 @ 00000000 (usable)
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x00000000-0x03ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x00000000-0x03ffffff]
[    0.000000] Primary instruction cache 32kB, 8-way, VIPT, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 8-way, VIPT, no aliases, linesize 32 bytes
[    0.000000] pls check processor_id[0x00d00100],sc_jz not support!
[    0.000000] MIPS secondary cache 128kB, 8-way, linesize 32 bytes.
[    0.000000] Built 1 zonelists in Zone order, mobility grouping off.  Total pages: 16256
[    0.000000] Kernel command line: console=ttyS1,115200n8 mem=64M@0x0 rmem=64M@0x4000000 init=/linuxrc rootfstype=squashfs root=/dev/mtdblock2 system=/dev/mtdblock3 rw mtdparts=jz_sfc:256k(boot),1664k(kernel),1024k(root),6304k(appfs),32k(kernel2),32k(root2),6304k(appfs2),512k(param),128k(SN),-(bootconfig)
[    0.000000] PID hash table entries: 256 (order: -2, 1024 bytes)
[    0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Memory: 59736k/65536k available (3438k kernel code, 5800k reserved, 1082k data, 212k init, 0k highmem)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] Preemptible hierarchical RCU implementation.
[    0.000000] NR_IRQS:358
[    0.000000] clockevents_config_and_register success.
[    0.000014] Calibrating delay loop... 1391.00 BogoMIPS (lpj=6955008)
[    0.087831] pid_max: default: 32768 minimum: 301
[    0.092690] Mount-cache hash table entries: 512
[    0.097597] Initializing cgroup subsys debug
[    0.101853] Initializing cgroup subsys freezer
[    0.107968] regulator-dummy: no parameters
[    0.112152] NET: Registered protocol family 16
[    0.125162] bio: create slab <bio-0> at 0
[    0.130583] jz-dma jz-dma: JZ SoC DMA initialized
[    0.135570]  (null): set:249  hold:250 dev=100000000 h=500 l=500
[    0.142941] Switching to clocksource jz_clocksource
[    0.147869] cfg80211: Calling CRDA to update world regulatory domain
[    0.154719] jz-dwc2 jz-dwc2: cgu clk gate get error
[    0.159634] DWC IN DEVICE ONLY MODE
[    0.163746] dwc2 dwc2: Keep PHY ON
[    0.167127] dwc2 dwc2: Using Buffer DMA mode
[    0.171439] dwc2 dwc2: Core Release: 3.00a
[    0.175816] dwc2 dwc2: enter dwc2_gadget_plug_change:2589: plugin = 1 pullup_on = 0 suspend = 0
[    0.184711] NET: Registered protocol family 2
[    0.189436] TCP established hash table entries: 512 (order: 0, 4096 bytes)
[    0.196382] TCP bind hash table entries: 512 (order: -1, 2048 bytes)
[    0.202785] TCP: Hash tables configured (established 512 bind 512)
[    0.209097] TCP: reno registered
[    0.212318] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.218258] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.224778] NET: Registered protocol family 1
[    0.229344] RPC: Registered named UNIX socket transport module.
[    0.235322] RPC: Registered udp transport module.
[    0.240038] RPC: Registered tcp transport module.
[    0.244815] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.251610] freq_udelay_jiffys[0].max_num = 10
[    0.256062] cpufreq  udelay  loops_per_jiffy
[    0.260448] 12000     59956   59956
[    0.263714] 24000     119913  119913
[    0.267166] 60000     299784  299784
[    0.270601] 120000    599569  599569
[    0.274133] 200000    999282  999282
[    0.277696] 300000    1498924         1498924
[    0.281373] 600000    2997848         2997848
[    0.285092] 792000    3957159         3957159
[    0.288790] 1008000   5036385         5036385
[    0.292586] 1200000   5995696         5995696
[    0.299918] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.306473] jffs2: version 2.2. © 2001-2006 Red Hat, Inc.
[    0.312202] msgmni has been set to 116
[    0.316882] io scheduler noop registered
[    0.320803] io scheduler cfq registered (default)
[    0.326652] jz-uart.1: ttyS1 at MMIO 0x10031000 (irq = 58) is a uart1
[    0.334100] console [ttyS1] enabled, bootconsole disabled
[    0.334100] console [ttyS1] enabled, bootconsole disabled
[    0.347764] brd: module loaded
[    0.352190] loop: module loaded
[    0.355939] zram: Created 2 device(s) ...
[    0.360123] logger: created 256K log 'log_main'
[    0.365261] jz TCU driver register completed
[    0.369978] the id code = a14018, the flash name is FM25Q128A
[    0.375955] JZ SFC Controller for SFC channel 0 driver register
[    0.382086] 10 cmdlinepart partitions found on MTD device jz_sfc
[    0.388302] Creating 10 MTD partitions on "jz_sfc":
[    0.393332] 0x000000000000-0x000000040000 : "boot"
[    0.398701] 0x000000040000-0x0000001e0000 : "kernel"
[    0.404168] 0x0000001e0000-0x0000002e0000 : "root"
[    0.409507] 0x0000002e0000-0x000000908000 : "appfs"
[    0.414923] 0x000000908000-0x000000910000 : "kernel2"
[    0.420469] 0x000000910000-0x000000918000 : "root2"
[    0.425906] 0x000000918000-0x000000f40000 : "appfs2"
[    0.431358] 0x000000f40000-0x000000fc0000 : "param"
[    0.436792] 0x000000fc0000-0x000000fe0000 : "SN"
[    0.441904] 0x000000fe0000-0x000001000000 : "bootconfig"
[    0.447783] SPI NOR MTD LOAD OK
[    0.451066] tun: Universal TUN/TAP device driver, 1.6
[    0.456302] tun: (C) 1999-2004 Max Krasnyansky <[email protected]>
[    0.462943] wait stable.[289][cgu_msc0]
[    0.466941] jzmmc_v1.2 jzmmc_v1.2.0: vmmc regulator missing
[    0.472916] jzmmc_v1.2 jzmmc_v1.2.0: register success!
[    0.478334] jzmmc_v1.2 jzmmc_v1.2.1: vmmc regulator missing
[    0.484250] jzmmc_v1.2 jzmmc_v1.2.1: register success!
[    0.489833] TCP: cubic registered
[    0.493252] NET: Registered protocol family 17
[    0.498422] input: gpio-keys as /devices/platform/gpio-keys/input/input0
[    0.505524] drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
[    0.515784] VFS: Mounted root (squashfs filesystem) readonly on device 31:2.
[    0.523340] Freeing unused kernel memory: 212K (8047b000 - 804b0000)
mdev is ok......
[    0.964346] jzmmc_v1.2 jzmmc_v1.2.0: card inserted, state=0
net.core.wmem_max = 26214400
net.core.wmem_default = 26214400

Ingenic-uc1_1 login: [    2.224339] mmc0: new SDHC card at address aaaa
[    2.232448] mmcblk0: mmc0:aaaa SB16G 14.8 GiB
[    2.242593]  mmcblk0: p1
[    4.260786] wlan.c initWlan
[    4.263700]
[    4.263700] *** _import_default_cfg, /lib/modules/ssv6x5x-wifi.cfg ***
[    4.263700]
[    4.298037] ssv6xxx_hci_init() start
[    4.303432] ssv6xxx_sdio_init
[    4.416218] wait stable.[289][cgu_msc1]
[    4.455168] mmc1: new SDIO card at address 0001
[    4.461896] =======================================
[    4.468394] ==           RUN SDIO                ==
[    4.475722] =======================================
[    4.480787] max block count: 511
[    4.484222] ssv6xxx_set_sdio_clk: set sdio clk 25000000Hz
[    4.489882] wait stable.[289][cgu_msc1]
[    4.529124] SSV6XXX_SDIO mmc1:0001:1: vendor = 0x5653 device = 0x2060
[    4.546096] ssv6xxx_sdio_power_on
[    4.564454] SSV6XXX_SDIO mmc1:0001:1: dataIOPort 0x10000 regIOPort 0x10020
[    4.571978] jzmmc_v1.2 jzmmc_v1.2.1: Error status->0x1F000960: cmd=52, state=1
[    4.616894] SSV6XXX_SDIO mmc1:0001:1: dataIOPort 0x10000 regIOPort 0x10020
[    4.624205] SSV6XXX_SDIO mmc1:0001:1: CHIP ID: SSV6020C0
[    4.630459] Attach SSV6020 family HWIF HAL function
[    4.635758] Chip type a0
[    4.638382] Load SSV6020 ASIC HAL HWIF function
[    4.643502] ssv6xxx_dev_probe(): SSV6X5X device "SSV6020C" found !
[    4.653633] SSV6020C
[    4.655967] Attach SSV6020 family HAL function
[    4.660800] Load SSV6020 common code
[    4.664531] Load SSV6020 HAL MAC function
[    4.668780] Load SSV6020 HAL PHY function
[    4.673019] Load SSV6020 HAL BB-RF function
[    4.677504] Chip type a0
[    4.680132] Load SSV6020 HAL ASIC EXT BB-RF function
[    4.687743] CHIP TAG: 2020072900201427
[    4.691732] SSV6XXX HCI TX Task started.
[    4.695997] MAC address from e-fuse
[    4.699622] EFUSE configuration
[    4.702878] Read efuse chip identity[6ff1ffff]
[    4.707513] crystal_frequency_offset- e3
[    4.711569] tx_power_index_1- 9
[    4.714846] MAC address - 20:67:e0:69:b7:8c
[    4.721350] rate_table_1- 0
[    4.724339] rate_table_2- 39
[    4.751986] flash_file /tmp/flash.bin not found
[    4.756748]  ssv6020_if_chk_mac2: is not need to check MAC addres 2 for this model
[    4.764699] freq xi/xo use value 227/227
[    4.768766] rate gain b use value 3
[    4.772378] rate gain legacy use default value
[    4.776990] rate gain ht20 use default value
[    4.781414] rate gain ht40 use value 9
[    4.785312] band gain offset 4, value 13
[    4.789379] band gain use 13
[    4.794596] ble gain use default value
[    4.798673] SSV6XXX RX Task started.
[    4.802542] ssv6xxx_sdio_irq_disable
[    4.824709] Enable HCI TX aggregation
[    4.840995] Using firmware "ssv6x5x-sw.bin".
[    4.845505] ssv6xxx_set_sdio_clk: set sdio clk 25000000Hz
[    4.955488] block_count = 0x003f008a, reg = 0x003f008a
[    5.074317] ssv6xxx_set_sdio_clk: set sdio clk 48000000Hz
[    5.079895] wait stable.[289][cgu_msc1]
[    5.119989] Firmware version 10279
[    5.234031] chan change ch 6, type 1, off_chan 0
[    5.271939] INIT SSV CONTROL GENERIC NETLINK MODULE
[    5.281169] ieee80211 phy0: SSV6X5X of iComm-semi
[    6.953886] @@@@ tx-isp-probe ok(version H20210818a), compiler date=Aug 18 2021 @@@@@
[    7.276952] jz_codec_register: probe() successful!
[    7.684514] dma dma0chan24: Channel 24 have been requested.(phy id 7,type 0x06 desc a13fa000)
[    7.693606] dma dma0chan25: Channel 25 have been requested.(phy id 6,type 0x06 desc a1292000)
[    7.702788] dma dma0chan26: Channel 26 have been requested.(phy id 5,type 0x04 desc a1293000)
1
[    7.806767] FAT-fs (mmcblk0p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
2
Factory Boot---->
[    7.840435] FAT-fs (mmcblk0p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
Missing update file, aborting
/system/init/app_init.sh: line 110: /tmp/FACTORY/factory.sh: not found
[   32.874305] jzmmc_v1.2 jzmmc_v1.2.0: card removed, state=0
[   32.880026] mmc0: card aaaa removed

@wltechblog
Copy link
Author

Script updated to fix a sanity check that wasn't sane !

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