guino / BazzDoorbell

125 stars 22 forks source link

CW017 research #21

Open guino opened 3 years ago

guino commented 3 years ago

Here's a couple of images. Looks similar to the board in #11 from @swisslegacy

PXL_20210207_233815784.jpg

PXL_20210207_233849051.jpg

Originally posted by @parkerlreed in https://github.com/guino/BazzDoorbell/issues/2#issuecomment-774789777

parkerlreed commented 3 years ago

:+1: Thanks. Good idea keeping tracking in a separate thread (that's a pain in the ass to expand all the comments in the main)

guino commented 3 years ago

@parkerlreed yes :) similar but different hardware. The uart pads will likely be on the other side by removing the 4 silver colored screws

parkerlreed commented 3 years ago

Trying the 2.7.x files from #11 here's what I observe

2.9.x on my first try resulted in a corrupted MBR which made me think it worked but was the same result (and subsequent tries the MBR stays in tact)

parkerlreed commented 3 years ago

Inside shot

PXL_20210208_000123729.jpg

guino commented 3 years ago

There’s usually data left in the sectors of the card from before doing #11 so if you want to see if the process did anything you would have to zero out the sectors before using #11:

dd if=/dev/zero of=/dev/mmcblkX bs=512 count=32768 seek=1

guino commented 3 years ago

Serial pins should be the 4 pads on the bottom left of the picture you posted.

guino commented 3 years ago

You can use the screw hole as ground and test which is ground from the pads, then test which is 3.3v using pin 8 of the flash chip. Or you can just solder wires and swap them until you find what is rx, tx and ground (no need to connect 3.3v). Just make sure you don’t pull hard on wiring after soldering or they will come right out of the board.

guino commented 3 years ago

This should be pin 8 of the flash (3.3v) :

7BF53C1F-B857-4F6E-A5FD-C0B9068C93C9

parkerlreed commented 3 years ago

I tried zero'ing out beforehand and no difference. (Stayed blank instead of having any data)

Does the device not care that I blew out the MBR?

guino commented 3 years ago

The MBR is sector 0 (zero) the command I gave was supposed to start zeroing from sector 1 - but I realize I forgot to pass the parameter seek=1, it should have been:

dd if=/dev/zero of=/dev/mmcblkX bs=512 count=32768 seek=1

that was my bad - you would probably have to redo #11 to build a new MBR now.

parkerlreed commented 3 years ago

As for the serial, I have a couple Pi Zeros I can try and get working (They do have 3.3v UART right?)

Thanks for the tips.

guino commented 3 years ago

Yeah you could wire the serial from a pi zero directly.

guino commented 3 years ago

@parkerlreed I can’t read the numbers on the chips but based on the previous version of the board the flash may actually be the one on the other side of the board instead of the one I posted above (pin 8 3.3v marked): 9D8DBEDD-9FB3-4E4D-9F09-A43905EEEB13

Like I said before you don’t need to connect the 3.3v I only marked it as a way to try and determine which pads to use (so you don’t need to solder a wire to the 3.3v pad).

parkerlreed commented 3 years ago
U-Boot 2013.10.0-AK_V3.0.07 (Sep 19 2020 - 14:46:53)

DRAM:  64 MiB
8 MiB
ANYKA SDHC/MMC4.0: 0
PPS:Sep 19 2020 14:46:58   anyka_c3:  0 
                                        magic err
magic err
command:setenv bootargs mem=64M console=ttySAK0,115200n8 loglevel=10   mtdparts=spi0.0:256k(bld),64k(env),64k(enc),64k(sysflg),3m(sys),4032k(app),640k(cfg) ppsAppParts=5 ip=192.168.1.99:::255.255.255.0 eth=00:55:7b:b5:7d:f7
## Booting kernel from Legacy Image at 81c08000 ...
   Image Name:   Linux-3.4.35
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    2789360 Bytes = 2.7 MiB
   Load Address: 81c08000
   Entry Point:  81c08040
   Verifying Checksum ... OK
   XIP Kernel Image ... OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
Anyka Linux Kernel Version: 1.1.12
parkerlreed commented 3 years ago

Also for reference here's the listing for this camera https://www.walmart.com/ip/Merkury-Innovations-Smart-Wifi-Camera-1080p-2-Way-Communication/679786717

parkerlreed commented 3 years ago

Middle two. TX on right hand side. PXL_20210210_023057636.jpg

guino commented 3 years ago

Send me an email and I can send you something to help out

parkerlreed commented 3 years ago

Sent. Thanks.

guino commented 3 years ago

Based on the bootargs shown the method used for Merkury 720p (my other repo) should work if you just adjust the load address (looks like 81c08000?)

parkerlreed commented 3 years ago

Thanks. Will give it a shot

parkerlreed commented 3 years ago

So do I do the port 80 enable first and then the rest?

guino commented 3 years ago

It should just need the commands in the env file (typed in thr uboot since you can), ideally we figure out the address so that hack would work on it.

If your port 80 is disabled be default you can use the ppsFactoryTool.txt to enable it but that’s not important for the hack to work.

parkerlreed commented 3 years ago

I'm sure I'm probably just being thick here. I am typing this correctly?

image

guino commented 3 years ago

Remove the hack= part and only do what is after the = sign .. the hack= part is to set the environment from file which is not needed in uboot.

guino commented 3 years ago

Actually nevermind that, we need to figure out where the files are loaded, can you execute printenv and post the response ?

parkerlreed commented 3 years ago

Ok so something like this?

setenv bootargs ${bootargs} '- ip=30;/mnt/mmc01/initrun.sh)&:::::;date>/tmp/hack;(sleep
ipaddr=0
bootm 0x81c08000

ipaddr is supposed to be it's own command or part of the first one? (There's a newline in the env so that's what's confusing me)

guino commented 3 years ago

Without being familiar with uboot it will be easier to just modify the hack for your camera — with the printenv output I can probably do it.

the commands from the env file would have to be like this I think:

setenv hack ‘setenv bootargs ${bootargs} \'- ip=30;/mnt/mmc01/initrun.sh)&:::::;date>/tmp/hack;(sleep’

then another command:

setenv ipaddr ‘0;run hack;bootm 0x81c08000;’

It would be nice if you execute and post the output for printenv and for help so I know what is available

parkerlreed commented 3 years ago
pps # printenv
              baudrate=115200
bootargs=mem=64 console=ttySAK0,115200n8 loglevel=10
bootcmd=loadk;bootm 0x81C08000
bootdelay=3
console=ttySAK0,115200n8 loglevel=10 
ethaddr=00:55:7b:b5:7d:f7
ipaddr=192.168.1.99
memsize=64M
netmask=255.255.255.0
serverip=192.168.1.1
setcmd=setenv bootargs console=${console}  mem=${memsize}
sf_hz=20000000
stderr=serial
stdin=serial
stdout=serial
ver=U-Boot 2013.10.0-AK_V3.0.07 (Sep 19 2020 - 14:46:53)

Environment size: 455/4088 bytes
pps # help
          ?       - alias for 'help'
auth    - encrypt product authfile
base    - print or set address offset
bootm   - boot application image from memory
clearCfg- clearCfg
cmp     - memory compare
cp      - memory copy
crc32   - checksum calculation
devmem  - read or write register, now just read
downimage- downimage   - download and write All-Image to FLASH device,partiton table from ENV partition.
downjffs2fs- load usr.jffs2 tftp
downkernel- load uImage tftp
downrootfs- load root.sqsh4 tftp
downsquashfs- load usr.sqsh4 tftp
downuboot- load uboot tftp
env     - environment handling commands
envreset- reset env para
erase   - erase FLASH memory
fatinfo - print information about filesystem
fatload - load binary file from a dos filesystem
fatls   - list files in a directory (default /)
flinfo  - print FLASH memory information
format  - erase all flash except bootloader part
go      - start application at address 'addr'
help    - print command description/usage
loadk   - load kernel to DRAM  
loop    - infinite loop on address range
md      - memory display
mm      - memory modify (auto-incrementing address)
mmc     - MMC sub system
mmcboot - from mmc start
mmcinfo - display MMC info
mw      - memory write (fill)
nm      - memory modify (constant address)
parts   - read out partitions table info.
parts_adjust- 
adjust parts info. Each part's size,offset etc.

pcbMenu - select Pcb
printenv- print environment variables
protect - enable or disable FLASH write protection
readcfg - read config from config.
reset   - Perform RESET of the CPU
run     - run commands in an environment variable
saveenv - save environment variables to persistent storage
setenv  - set environment variables
setloadaddr- set loadaddr to  config infor .
sf      - spi flash sub-system:
tfdownjffs2fs- load usr.jffs2TF
tfdownkernel- load uImageTF
tfdownrootfs- load root.sqsh4TF
tfdownsquashfs- load usr.sqsh4TF
tfdownuboot- load u-boot.binTF
tfupdateimage- tfupdateimage   - download and write All-Image to FLASH device
uartdown- down style 0:tftp 1:uart 2:mmc
upa     - update app image appfile
upb     - update bootloader bldfile
update  - update upgrade.bin
updatecfg- update config from config infor table.
upe     - update auth image authfile
upf     - update firmware, format and update (factory use upffile)
upk     - update uImage kernelfile
upr     - update backup.img
version - print monitor, compiler and linker version
parkerlreed commented 3 years ago

After setting those two

bootargs=mem=64 console=ttySAK0,115200n8 loglevel=10 - ip=30;/mnt/mmc01/initrun.sh)&:::::;date>/tmp/hack;(sleep
ipaddr=0;run hack;bootm 0x81c08000;

Should be good to power cycle?

guino commented 3 years ago

There’s a very good chance that if you just adjust the address in ppsMmcTool.txt and env files from the merkury 720p project to 81c08000 (instead of 81808000) you should be able to install the hack using the steps in that repo - that is what I would try first.

guino commented 3 years ago

If you executed the commands you don’t want to power cycle you want to execute loadk

guino commented 3 years ago

I doubt the commands as I posted will work - hard to tell without the device to do printenv after every change. But I am very hopeful that using the existing hack with the correct address will work.

parkerlreed commented 3 years ago

I reset the env back to original and am trying that now. Currently on that blinking blue.

parkerlreed commented 3 years ago
U-Boot 2013.10.0-AK_V3.0.07 (Sep 19 2020 - 14:46:53)

DRAM:  64 MiB
8 MiB
ANYKA SDHC/MMC4.0: 0
PPS:Sep 19 2020 14:46:58   anyka_c3:  2 

U-Boot 2013.10.0-AK_V3.0.07 (Sep 19 2020 - 14:46:53)

DRAM:  64 MiB
8 MiB
ANYKA SDHC/MMC4.0: 0
PPS:Sep 19 2020 14:46:58   anyka_c3:  0 
                                        button
cmd:fatload mmc 0 0x81c08000 ppsmmctool.txt
send cmd 8 error, status = 2004
block rw command 8 is failed!
mmc_send_if_cond, Err cnt:0
cdh:test_part_dos DOS_PART_MAGIC_OFFSET ok!
reading ppsmmctool.txt
102 bytes read in 1 ms (99.6 KiB/s)
cmdBuf:fatload mmc 0 0x81c08000 env;env import 81808000;saveenv
reading env
131 bytes read in 0 ms
## Warning: defaulting to text format
## Warning: Input data exceeds 1048576 bytes - truncated
## Info: input data size = 1048578 = 0x100002

Saving Environment to SPI Flash...
Env export buffer too small: 4088, but need 1049053
ERROR: Cannot export environment: errno = 12

at env_sf.c:443/saveenv()
size:131
error: Pack header size error!
error: upgrade.bin unpack error!
reading env
131 bytes read in 1 ms (127.9 KiB/s)
## Warning: defaulting to text format
## Warning: Input data exceeds 1048576 bytes - truncated
## Info: input data size = 1048578 = 0x100002

Saving Environment to SPI Flash...
Env export buffer too small: 4088, but need 1049053
ERROR: Cannot export environment: errno = 12

at env_sf.c:443/saveenv()
readLen:131
read err
resetting ...
heartbeat = 1
m

U-Boot 2013.10.0-AK_V3.0.07 (Sep 19 2020 - 14:46:53)

DRAM:  64 MiB
8 MiB
ANYKA SDHC/MMC4.0: 0
PPS:Sep 19 2020 14:46:58   anyka_c3:  0 
                                        magic err
magic err
command:setenv bootargs mem=64M console=ttySAK0,115200n8 loglevel=10   mtdparts=spi0.0:256k(bld),64k(env),64k(enc),64k(sysflg),3m(sys),4032k(app),640k(cfg) ppsAppParts=5 ip=192.168.1.99:::255.255.255.0 eth=00:55:7b:b5:7d:f7
## Booting kernel from Legacy Image at 81c08000 ...
   Image Name:   Linux-3.4.35
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    2789360 Bytes = 2.7 MiB
   Load Address: 81c08000
   Entry Point:  81c08040
   Verifying Checksum ... OK
   XIP Kernel Image ... OK

Starting kernel ...

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

That's what I get trying the purely SD method from Merkiry720

guino commented 3 years ago

This almost looks good but it seems you either created the env file from scratch (you should have downloaded and edited the one I made) OR you deleted the 0x00 character after the new line in the env file. Please make sure the env file has a new line and a character 0x00 at the end try again.

parkerlreed commented 3 years ago

Yeah I just edited the file in place.

Maybe nano ate something?

guino commented 3 years ago

It is possible, you may want to use a hex editor to make sure there’s a 00 at the end of the file.

parkerlreed commented 3 years ago

Ahh that's probably why. nano tends to throw on a /n. Ill make the edit to the base address in the hex editor to make sure.

guino commented 3 years ago

Give me a sec and I can post a good env file

parkerlreed commented 3 years ago

The file straight from your repo ends in 0A

image

guino commented 3 years ago

just unzip that over the SD card and overwrite it env.zip

guino commented 3 years ago

The file looks ok, but wrong address on the last image you posted.

parkerlreed commented 3 years ago

Ok about to boot this card. :crossed_fingers:

guino commented 3 years ago

post the log when it's done (please)

parkerlreed commented 3 years ago

Same thing it looks like :/ Made sure to overwrite the env that's on the card,

Type [C-a] [C-h] to see available commands
Terminal ready

U-Boot 2013.10.0-AK_V3.0.07 (Sep 19 2020 - 14:46:53)

DRAM:  64 MiB
8 MiB
ANYKA SDHC/MMC4.0: 0
PPS:Sep 19 2020 14:46:58   anyka_c3:  0 
                                        button
cmd:fatload mmc 0 0x81c08000 ppsmmctool.txt
send cmd 8 error, status = 2004
block rw command 8 is failed!
mmc_send_if_cond, Err cnt:0
cdh:test_part_dos DOS_PART_MAGIC_OFFSET ok!
reading ppsmmctool.txt
102 bytes read in 0 ms
cmdBuf:fatload mmc 0 0x81c08000 env;env import 81808000;saveenv
reading env
131 bytes read in 1 ms (127.9 KiB/s)
## Warning: defaulting to text format
## Warning: Input data exceeds 1048576 bytes - truncated
## Info: input data size = 1048578 = 0x100002
ERROR: Environment import failed: errno = 22

at cmd_nvedit.c:1076/do_env_import()

Saving Environment to SPI Flash...
Env export buffer too small: 4088, but need 520537
ERROR: Cannot export environment: errno = 12

at env_sf.c:443/saveenv()
size:131
error: Pack header size error!
error: upgrade.bin unpack error!
reading env
131 bytes read in 1 ms (127.9 KiB/s)
## Warning: defaulting to text format
## Warning: Input data exceeds 1048576 bytes - truncated
## Info: input data size = 1048578 = 0x100002
ERROR: Environment import failed: errno = 22

at cmd_nvedit.c:1076/do_env_import()

Saving Environment to SPI Flash...
Env export buffer too small: 4088, but need 520537
ERROR: Cannot export environment: errno = 12

at env_sf.c:443/saveenv()
readLen:131
read err
resetting ...
heartbeat = 1
m

U-Boot 2013.10.0-AK_V3.0.07 (Sep 19 2020 - 14:46:53)

DRAM:  64 MiB
8 MiB
ANYKA SDHC/MMC4.0: 0
PPS:Sep 19 2020 14:46:58   anyka_c3:  0 
                                        magic err
magic err
command:setenv bootargs mem=64M console=ttySAK0,115200n8 loglevel=10   mtdparts=spi0.0:256k(bld),64k(env),64k(enc),64k(sysflg),3m(sys),4032k(app),640k(cfg) ppsAppParts=5 ip=192.168.1.99:::255.255.255.0 eth=00:55:7b:b5:7d:f7
## Booting kernel from Legacy Image at 81c08000 ...
   Image Name:   Linux-3.4.35
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    2789360 Bytes = 2.7 MiB
   Load Address: 81c08000
   Entry Point:  81c08040
   Verifying Checksum ... OK
   XIP Kernel Image ... OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
Anyka Linux Kernel Version: 1.1.12
guino commented 3 years ago

ok, in the ppsMmcTool.txt file you needed to edit all addresses that were 81808000 to 81C08000 -- there's at least one address wrong in that file, please adjust and try again.

parkerlreed commented 3 years ago

OH I thought env was the only edit facepalm

Checking it. Thanks.

parkerlreed commented 3 years ago

Looks to be good. Waiting for it to boot. It still doing the blinky blue thing. I assume it's booted at that point?

Type [C-a] [C-h] to see available commands
Terminal ready

U-Boot 2013.10.0-AK_V3.0.07 (Sep 19 2020 - 14:46:53)

DRAM:  64 MiB
8 MiB
ANYKA SDHC/MMC4.0: 0
PPS:Sep 19 2020 14:46:58   anyka_c3:  0 
                                        button
cmd:fatload mmc 0 0x81c08000 ppsmmctool.txt
send cmd 8 error, status = 2004
block rw command 8 is failed!
mmc_send_if_cond, Err cnt:0
cdh:test_part_dos DOS_PART_MAGIC_OFFSET ok!
reading ppsmmctool.txt
102 bytes read in 1 ms (99.6 KiB/s)
cmdBuf:fatload mmc 0 0x81c08000 env;env import 81C08000;saveenv
reading env
131 bytes read in 0 ms
## Warning: defaulting to text format
## Info: input data size = 130 = 0x82

Saving Environment to SPI Flash...
Writing to SPI flash...Env save done OK
size:131
error: Pack header size error!
error: upgrade.bin unpack error!
reading env
131 bytes read in 0 ms
## Warning: defaulting to text format
## Info: input data size = 130 = 0x82

Saving Environment to SPI Flash...
Writing to SPI flash...Env save done OK
readLen:131
read err
resetting ...
heartbeat = 1
m

U-Boot 2013.10.0-AK_V3.0.07 (Sep 19 2020 - 14:46:53)

DRAM:  64 MiB
8 MiB
ANYKA SDHC/MMC4.0: 0
PPS:Sep 19 2020 14:46:58   anyka_c3:  0 
                                        magic err
magic err
## Booting kernel from Legacy Image at 81c08000 ...
   Image Name:   Linux-3.4.35
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    2789360 Bytes = 2.7 MiB
   Load Address: 81c08000
   Entry Point:  81c08040
   Verifying Checksum ... OK
   XIP Kernel Image ... OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
Anyka Linux Kernel Version: 1.1.12
parkerlreed commented 3 years ago

Oh or not

error: Pack header size error! error: upgrade.bin unpack error!

parkerlreed commented 3 years ago

Oh I have extra folders!