OpenIPC / firmware

Alternative IP Camera firmware from an open community
https://openipc.org
MIT License
1.27k stars 247 forks source link

Anyka AK3918Ev200 #207

Open ricardojlrufino opened 2 years ago

ricardojlrufino commented 2 years ago

Hi, i try boot this version. but i get no console after kernel load:

anyka$setenv loadaddr 81008000

anyka$readcfg; sf probe 0:0 ${sf_hz} 0; sf read ${loadaddr} 678000 15DC60; bootm ${loadaddr}

SF: 1432672 bytes @ 0x678000 Read: OK
## Booting kernel from Legacy Image at 81808000 ...
   Image Name:   Linux-3.4.35-ak3918ev200
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    1199088 Bytes = 1.1 MiB
   Load Address: 81008000
   Entry Point:  81008000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
Anyka Linux Kernel Version: 1.0.05

My original boot:

U-Boot 2013.10.0-AK_V2.0.04 (Apr 14 2020 - 11:47:31)

DRAM:  64 MiB
set  pin:32 i:5
set  pin:34 i:8
8 MiB
Create flash partition table init OK!
ANYKA SDHC/MMC4.0: 0
Load Env CRC OK!
In:    serial
Out:   serial
Err:   serial
Net:   AKEthernet-0

Hit any key to stop autoboot:  3                                                                                                                         0

SF: 1307448 bytes @ 0x37000 Read: OK
## Booting kernel from Legacy Image at 81808000 ...
   Image Name:   Linux-3.4.35
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    1307384 Bytes = 1.2 MiB
   Load Address: 81808000
   Entry Point:  81808040
   Verifying Checksum ... OK
   XIP Kernel Image ... OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
Anyka Linux Kernel Version: 2.5.02
Booting Linux on physical CPU 0
Linux version 3.4.35 (ma@ma-PC) (gcc version 4.8.5 (anyka (gcc-4.8.5 + binutils-2.24 + ulcibc-0.9.33.2)(20170223)) ) #5 Wed Sep 18 15:36:19 CST 2019
CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
CPU: VIVT data cache, VIVT instruction cache
Machine: Cloud39E_AK3918E+H42_V1.0.2
Memory policy: ECC disabled, Data cache writeback
ANYKA CPU AK3918 (ID 0x20150200)
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 10160
Kernel command line: console=ttySAK0,115200n8 root=/dev/mmcblk0p2 rw rootwait rootfstype=squashfs init=/init mem=64M memsize=64M
PID hash table entries: 256 (order: -2, 1024 bytes)
Geotv123 commented 2 years ago

Hi, i try boot this version. but i get no console after kernel load:

anyka$setenv loadaddr 81008000

anyka$readcfg; sf probe 0:0 ${sf_hz} 0; sf read ${loadaddr} 678000 15DC60; bootm ${loadaddr}

SF: 1432672 bytes @ 0x678000 Read: OK
## Booting kernel from Legacy Image at 81808000 ...
   Image Name:   Linux-3.4.35-ak3918ev200
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    1199088 Bytes = 1.1 MiB
   Load Address: 81008000
   Entry Point:  81008000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
Anyka Linux Kernel Version: 1.0.05

My original boot:

U-Boot 2013.10.0-AK_V2.0.04 (Apr 14 2020 - 11:47:31)

DRAM:  64 MiB
set  pin:32 i:5
set  pin:34 i:8
8 MiB
Create flash partition table init OK!
ANYKA SDHC/MMC4.0: 0
Load Env CRC OK!
In:    serial
Out:   serial
Err:   serial
Net:   AKEthernet-0

Hit any key to stop autoboot:  3                                                                                                                         0

SF: 1307448 bytes @ 0x37000 Read: OK
## Booting kernel from Legacy Image at 81808000 ...
   Image Name:   Linux-3.4.35
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    1307384 Bytes = 1.2 MiB
   Load Address: 81808000
   Entry Point:  81808040
   Verifying Checksum ... OK
   XIP Kernel Image ... OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
Anyka Linux Kernel Version: 2.5.02
Booting Linux on physical CPU 0
Linux version 3.4.35 (ma@ma-PC) (gcc version 4.8.5 (anyka (gcc-4.8.5 + binutils-2.24 + ulcibc-0.9.33.2)(20170223)) ) #5 Wed Sep 18 15:36:19 CST 2019
CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
CPU: VIVT data cache, VIVT instruction cache
Machine: Cloud39E_AK3918E+H42_V1.0.2
Memory policy: ECC disabled, Data cache writeback
ANYKA CPU AK3918 (ID 0x20150200)
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 10160
Kernel command line: console=ttySAK0,115200n8 root=/dev/mmcblk0p2 rw rootwait rootfstype=squashfs init=/init mem=64M memsize=64M
PID hash table entries: 256 (order: -2, 1024 bytes)

Hi @ricardojlrufino

Did you solve the issue? Let us know how your progress is going.

ricardojlrufino commented 2 years ago

I haven't been able to run it yet...

I've been experimenting with this camera and document on my blog. https://ricardojlrufino.wordpress.com/2022/04/03/hack-ipcam-anyka-oled-display-on-cam/ https://ricardojlrufino.wordpress.com/2022/02/14/hack-ipcam-anyka-teardown-and-root-access/

leonelhs commented 2 years ago

I'm facing exactly the same problem mentioned above , no console after kernel loads. I'm using this method mentioned at this blog for upgrade my kernel https://blog.caller.xyz/v380-ipcam-firmware-patching. It basically consist in replace MTD partitions, my uImage are placed at partition MTD1. The generated openipc output rootfs.squashfs is to big for being flashed in the RFS partition so this has given to me a hint, this ak200 openipc build its for different hardware variant than mine the V380E2_C2, my variant has 8 partitions.

1.5M mtd1 KER 4.0K mtd2 MAC 4.0K mtd3 ENV 1.5M mtd4 RFS 1.6M mtd5 USR 1.2M mtd6 MVS 460K mtd7 EXT 1.5M mtd8 JFS

Does anybody available to clarify our issues @ZigFisher? Partitions are related problem? because the OEM u-boot remains, is this capable to load the new kernel? Lamobo-D1 dafault board config has some kernel features that aren’t included in this configuration like kernel params and Ram init address, shall I include some special address for my board? It could be that I have no idea what I’m doing?

I have tried this command to match my zImage load_address params whit my old uImage without succes. mkimage -A arm -O linux -T kernel -C none -a 81808000 -e 81808040 -n Linux -d zImage uImage

I'm using the ch341prog, to flash from the scratch the original firmware so I'm available to try any idea with no fear to brick my camera.

dimerr commented 2 years ago

We have discovered that sdk version in stock firmwares are significantly higher than in lamobo-d1, thus we are not sure if that lamobo-d1 is able to start at all.

I have built kernel just from their sources, with defconfig, still same thing

leonelhs commented 2 years ago

By the way I'm using the uImage produced by OpenIPC firmware repo: Linux-3.4.35-ak3918ev200 not Lamobo-D1

Piorun2002 commented 1 year ago

The anyka has dedicated /usr (C) partition when the full rootfs can be located (5M should be enough fir it)

Creating 6 MTD partitions on "spi0.0":
0x000000033000-0x0000001b3000 : "KERNEL"
0x0000001b3000-0x0000001b4000 : "MAC"
0x0000001b4000-0x0000001b5000 : "ENV"
0x0000001b5000-0x0000002af000 : "A"
0x0000002af000-0x0000002fa000 : "B"
0x0000002fa000-0x0000007e8000 : "C"

[root@camFR ~]$ df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root               896.0K    896.0K         0 100% /
/dev/mtdblock6            4.8M      4.8M         0 100% /usr
/dev/mtdblock5          300.0K    116.0K    184.0K  39% /etc/jffs2
/dev/loop0               95.0K       512     94.5K   1% /tmp/ramdisk
[root@camFR ~]$

So I thing we need to create new rootf, load it to /dev/mtdblock6 (can be done from u-boot) and change the bootargs to mount root from mtdblock6 instead of mtd4

Kernel command line: console=ttySAK0,115200n8 root=/dev/mtdblock4 rootfstype=squashfs init=/sbin/init mem=64M flash=SF device_id=00000000000 ethaddr=00:55:7b:b5:7d:11 devinfo=jcoxxx memsize=64M

Full boot log from came Sannce I41V / ANNKE I41V

[root@camFR ~]$ dmesg
Booting Linux on physical CPU 0
Linux version 3.4.35 (root@ubuntu) (gcc version 4.8.5 (anyka (gcc-4.8.5 + binutils-2.24 + ulcibc-0.9.33.2)(20170223)) ) #1 Thu Aug 29 20:35:38 CST 2019
CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
CPU: VIVT data cache, VIVT instruction cache
Machine: Cloud39EV3_AK3918E80PIN_MNBD
Memory policy: ECC disabled, Data cache writeback
ANYKA CPU AK3918 (ID 0x20160100)
On node 0 totalpages: 7680
free_area_init_node: node 0, pgdat c03d30b0, node_mem_map c03f9000
  Normal zone: 60 pages used for memmap
  Normal zone: 0 pages reserved
  Normal zone: 7620 pages, LIFO batch:0
pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
pcpu-alloc: [0] 0
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 7620
Kernel command line: console=ttySAK0,115200n8 root=/dev/mtdblock4 rootfstype=squashfs init=/sbin/init mem=64M flash=SF device_id=00000000000 ethaddr=00:55:7b:b5:7d:f7 devinfo=jcoxxx memsize=64M
PID hash table entries: 128 (order: -3, 512 bytes)
Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
Memory: 30MB = 30MB total
Memory: 26268k/26268k available, 4452k reserved, 0K highmem
Virtual kernel memory layout:
    vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
    vmalloc : 0xc2000000 - 0xff000000   ( 976 MB)
    lowmem  : 0xc0000000 - 0xc1e00000   (  30 MB)
    modules : 0xbf000000 - 0xc0000000   (  16 MB)
      .text : 0xc0008000 - 0xc0394000   (3632 kB)
      .init : 0xc0394000 - 0xc03ae000   ( 104 kB)
      .data : 0xc03ae000 - 0xc03d3e18   ( 152 kB)
       .bss : 0xc03d3e3c - 0xc03f4694   ( 131 kB)
SLUB: Genslabs=13, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
NR_IRQS:117
sched_clock: 32 bits at 100 Hz, resolution 10000000ns, wraps every 4294967286ms
AK39 console driver initial
console [ttySAK0] enabled
Calibrating delay loop... 199.06 BogoMIPS (lpj=995328)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
Setting up static identity map for 0x824cb9c8 - 0x824cba20
devtmpfs: initialized
NET: Registered protocol family 16
-- Checked Platform AK3919Ev300(V400) ---
On-chip L2 memory initialized
AK39 clocks: CPU 400MHz, MEM 400MHz, ASIC 120MHz
Anyka platform share gpio locks initialize.
bio: create slab <bio-0> at 0
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
i2c-ak39 i2c-ak39: Unable to achieve desired frequency 300KHz. Lowest achievable 312KHz
i2c-ak39 i2c-ak39: i2c-0: AK39 I2C adapter
Linux video capture interface: v2.00
cfg80211: Calling CRDA to update world regulatory domain
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 1024 (order: 1, 8192 bytes)
TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
TCP: Hash tables configured (established 1024 bind 1024)
TCP: reno registered
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
NET: Registered protocol family 1
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
squashfs: version 4.0 (2009/01/31) Phillip Lougher
exFAT: Version 1.2.9
jffs2: version 2.2. © 2001-2006 Red Hat, Inc.
msgmni has been set to 51
io scheduler noop registered
io scheduler cfq registered (default)
AK39xx uart driver init, (c) 2013 ANYKA
ak39-uart.0: ttySAK0 at MMIO 0x20130000 (irq = 10) is a AK39
ion: failed to create debug files.
brd: module loaded
loop: module loaded
AK Motor Driver (c) 2013 ANYKA
@@@ [akpcm_init:3580]: enter @@@
ak39_codec_probe enter.
@@@ [akpcm_probe:3184]: enter @@@
@@@ [akpcm_probe:3217]: akpcm initialize OK! @@@
@@@ addr=2, src=2 @@@
@@@ [set_channel_source:532]: src=2, s_dac=0, s_linein=0, s_mic=1 @@@
akpcm probe: mic on
@@@ [akpcm_probe:3397]: OK @@@
akisp_init
Start to init Anyka SPI Flash...
Start to init Anyka partition table...
AK SPI Driver, (c) 2012 ANYKA
akpi regs: SPICON:00000152, SPISTA:00000015, SPIINT:00000000.
ak-spi ak-spi: master is unqueued, this is deprecated
ak_spi setup the master.
pre-scaler=2 (wanted 20Mhz, got 20Mhz)
ak spiflash probe enter.
pre-scaler=2 (wanted 20Mhz, got 20Mhz)
ak_spi_setupxfer,con:00000252.
akspi flash ID: 0x00c84017
akspi flash VERSION: 0x53
ak-spiflash spi0.0: gd25q64 (8192 Kbytes)
FHA:partition lib version: V1.0.15
FHA:spiflash init
FHA:boot block num offset:427
FHA:Sflash_Get_Partition_Startpage g_boot_len:784
mtd_part[0]:
name = KERNEL
size = 0x180000
offset = 0x33000
mask_flags = 0x1

mtd_part[1]:
name = MAC
size = 0x1000
offset = 0x1b3000
mask_flags = 0x1

mtd_part[2]:
name = ENV
size = 0x1000
offset = 0x1b4000
mask_flags = 0x1

mtd_part[3]:
name = A
size = 0xfa000
offset = 0x1b5000
mask_flags = 0x1

mtd_part[4]:
name = B
size = 0x4b000
offset = 0x2af000
mask_flags = 0x1

mtd_part[5]:
name = C
size = 0x4ee000
offset = 0x2fa000
mask_flags = 0x1

Creating 6 MTD partitions on "spi0.0":
0x000000033000-0x0000001b3000 : "KERNEL"
0x0000001b3000-0x0000001b4000 : "MAC"
0x0000001b4000-0x0000001b5000 : "ENV"
0x0000001b5000-0x0000002af000 : "A"
0x0000002af000-0x0000002fa000 : "B"
0x0000002fa000-0x0000007e8000 : "C"
Init AK SPI Flash finish.
akspi master initialize success, use for DMA mode.
AK39E_MAC Ethernet Driver, V1.0
netdev private = c168a3a0
Allocataion gmacdev OK
Allocataion mac_info OK
Configed MAC RMII interface!
FHA:part: Sflash_Open file_num:6
FHA:open T:0, R:1, H:0, K:4, S:1781760, N:MAC
FHA:open ex_bin F:21, L:0, B:-1, C:0
Failed to read MAC addres in medium storage, use default mac
ak_ethernet ak_ethernet.0: eth%d, Invalid Ethernet address. Generate software assigned
        random Ethernet address.
CDH_Success:eth0: ak39E_mac at f0230000 IRQ 16 MAC: a6:ed:5b:4e:9e:88
input: akgpio-keys as /devices/platform/akgpio-keys/input/input0
Board has not RTC support. exit ak_rtc_init
i2c /dev entries driver
AK MCI Driver (c) 2010 ANYKA
TCP: cubic registered
NET: Registered protocol family 17
lib80211: common routines for IEEE802.11 drivers
lib80211_crypt: registered algorithm 'NULL'
/usr/localext4/akv300_ipc_2/kernel/drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
SQUASHFS error: Xattrs in filesystem, these will be ignored
SQUASHFS error: unable to read xattr id index table
VFS: Mounted root (squashfs filesystem) readonly on device 31:4.
devtmpfs: mounted
Freeing init memory: 104K
SQUASHFS error: Xattrs in filesystem, these will be ignored
SQUASHFS error: unable to read xattr id index table
aksensor_module_init
soc-camera-pdrv soc-camera-pdrv: Probing soc-camera-pdrv
ak_camera ak_camera.39: AK Camera driver attached to camera 0
f22_set_power_on
gc2033_set_power_on
gc2053_set_power_on
gc2053_probe_id id:0xffff
sc2145_probe_id id:0x2238
sc2232_probe_id id:0x2238
sc2235_probe_id id:0x2238
sc4236_probe_id id:0x2238,id:0x4236
sc2232h_probe_id id:0x223820
aksensor 0-0001: probe_sensors Probing Sensor ID: 0xcb71
ak_camera ak_camera.39: AK Camera driver detached from camera 0
ak_camera ak_camera.39: AK Camera driver loaded
ak_info_dump_init
Reset MAC controller!
Reset MAC phy!
phy reset pin:0, value:0
adapter= c168a3a0 gmacdev = ffdff000 netdev = c168a000 netdev= c168a000
gmac version register f0230020
The data read from f0230020 is 00001037
netdev->dev_addr[0] = a6 and netdev->broadcast[0] = ff
netdev->dev_addr[1] = ed and netdev->broadcast[1] = ff
netdev->dev_addr[2] = 5b and netdev->broadcast[2] = ff
netdev->dev_addr[3] = 4e and netdev->broadcast[3] = ff
netdev->dev_addr[4] = 9e and netdev->broadcast[4] = ff
netdev->dev_addr[5] = 88 and netdev->broadcast[5] = ff
gpio phy reset pin:0, value:0
timeout in waiting phy to idle!
phy is idle!
cdh:gmac_phy_init,phy_wait_idle ok!
BMCR:0x1000
phy read phy id1 waiting ok,data=0x1c
phy read phy id2 waiting ok,data=0xc816
cdh:id other set!
No Link
eth0 owns a shared interrupt on line 16
rx descriptor addr[w]: 83b42000
rx descriptor addr[r]: 83b42000
Setting up the cable unplug timer
usb-host usb-host: Anyka usb host controller
usb-host usb-host: new USB bus registered, assigned bus number 1
usb-host usb-host: irq 18, io mem 0x20200000
usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
usb usb1: Product: Anyka usb host controller
usb usb1: Manufacturer: Linux 3.4.35 usb-host
usb usb1: SerialNumber: Anyka usb host controller
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
Usb otg-hs controller driver initialized
usb 1-1: new high-speed USB device number 2 using usb-host
usb 1-1: New USB device found, idVendor=0bda, idProduct=f179
usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 1-1: Product: 802.11n
usb 1-1: Manufacturer: Realtek
usb 1-1: SerialNumber: 00e04c000001
RTL871X: module init start
RTL871X: rtl8188fu v4.3.23.4_19019.20160811
RTL871X: build time: Oct 26 2018 13:54:41
RTL871X: hal_com_config_channel_plan chplan:0x23
RTL871X: rtw_ndev_init(wlan0) if1 mac_addr=9c:a3:a9:14:98:db
RTL871X: rtw_ndev_init(wlan1) if2 mac_addr=9e:a3:a9:14:98:db
usbcore: registered new interface driver rtl8188fu
RTL871X: module init ret=0
Bridge firewalling registered
dma alloc vir:0xffdf4000, phy:0x836e4000
isp_module_init: ak_isp_drv_lib V3.1.3
isp2 module init: isp_struct size=42916, dma_area=0xffdf4000, dma_bytes=12436, io_base=0xf0010000
ak_camera ak_camera.39: AK Camera driver attached to camera 0
2lane thssettle:5
reg0x00, read:0x7d
reg0x20, read:0x1f
reg0xe0, read:0xf9
reg0xe1, read:0x01
reg0x40, read:0x85
reg0x60, read:0x85
reg0x80, read:0x85
reg0xb3, read:0x02isp_>blc_mode=0
ak_camera_set_parm pcid:1
ak_camera_set_parm pcid:1, ch2w:640, ch2h:360
exp_time=2990
exp_time=2990,4294939736
aksensor_s_stream resume.
exp_time=2244
exp_time=2244,4294939746
@@@ IOC_SET_GAIN, set MIC gain: 7 @@@
@@@ [capture_ioctl:2333]: IOC_RSTBUF, reset buf @@@
@@@ [capture_resetBuffer:1949]: enter @@@
@@@ [playback_open:2880]: rt=0x0 @@@
@@@ playback rt allocate: 0xc140f240 @@@
@@@ [playback_open:2935]: OK @@@
@@@ set HP gain 5
 @@@
@@@ [playback_resetBuffer:1852]: enter @@@
exp_time=2988
exp_time=2988,4294939810
uio_vcodec_ioctl AKUIO_VIDEO_RESET
isp_>blc_mode=0exp_time=3745
exp_time=3745,4294939866
ak_isp_set_user_params_do 1458, set main osd mem attr
ak_isp_set_user_params_do 1473 chn:0, paddr:814ff540 size:49152
ak_isp_set_user_params_do 1458, set main osd mem attr
ak_isp_set_user_params_do 1473 chn:1, paddr:81511540 size:49152
ak_isp_set_user_params_do 1458, set main osd mem attr
ak_isp_set_user_params_do 1473 chn:2, paddr:81523540 size:49152
ak_isp_set_user_params_do 1509 paddr:81530940 size:10240
ak_isp_set_user_params_do 1509 paddr:81534540 size:10240
ak_isp_set_user_params_do 1509 paddr:81538140 size:10240
MAINCHN0 iomap f1731540 814f9540 size:24576
SUBCHN0 iomap f1767540 8152f540 size:5120
HiconnDiscovery uses obsolete (PF_INET,SOCK_PACKET)
RTL871X: indicate disassoc
RTL871X: set bssid:00:00:00:00:00:00
RTL871X: set ssid [CCCCCCC] fw_state=0x00000008
RTL871X: set bssid:9c:d6:43:11:11:11
RTL871X: start auth
RTL871X: auth success, start assoc
RTL871X: assoc success