update documentation

This commit is contained in:
Alfonso Gamboa 2022-06-13 21:10:28 -07:00
parent 3d702bf4d3
commit f8c1d30df7
4 changed files with 406 additions and 17 deletions

View File

@ -1,47 +1,66 @@
# process # wz_mini boot process
build kernel with initramfs load kernel with initramfs built in
initramfs ```/etc/init``` runs ```exec busybox switch_root /v3 /opt/wz_mini/etc/init.d/v3_init.sh``` ***initramfs***: ```/etc/init``` runs ```exec busybox switch_root /v3 /opt/wz_mini/etc/init.d/v3_init.sh```
within ```/opt/wz_mini/etc/init.d/v3_init.sh```: ***```/opt/wz_mini/etc/init.d/v3_init.sh```:***
bind replace the factory busybox, which is missing a bunch of utilities, with our own fully featured version
mount ```/configs``` to check if the model of the camera is HL_PAN2. If it is, change some variables.
mount ```/params``` if it exists, to check if the model of the camera is V2. If it is, change some variable
Check if `/opt/wz_mini/etc/.first_boot` exists, if it does, play some audio to notify the user that the first boot init is running.
bind replace ```/etc/init.d/inittab``` with our own version that has rcS located at ```/opt/wz_mini/tmp/.storage/rcS``` bind replace ```/etc/init.d/inittab``` with our own version that has rcS located at ```/opt/wz_mini/tmp/.storage/rcS```
bind replace ```/etc/profile``` with out own version with added PATH variables for the shell bind replace ```/etc/profile``` with out own version with added PATH variables for the shell
mount ```/tmp``` and ```/run``` mount ```/tmp```
mount ```/system``` mount ```/system```
bind replace ```/system/bin/factorycheck```, this stock firmware program unmounts the binds that we do later in the file, its a debug program. We don't need it. create the file `touch /tmp/usrflag` to make iCamera happy, normally created by `/system/bin/factorycheck`
bind replace ```/system/bin/factorycheck```, this factory included program unmounts the binds that we do later in the script, since its a debug program, we don't need it. Replace it with a fake.
bind replace ```/etc/fstab``` with our own version which includes ```/opt/wz_mini/tmp``` as a tmpfs path bind replace ```/etc/fstab``` with our own version which includes ```/opt/wz_mini/tmp``` as a tmpfs path
create wz_mini's workplace directory at ```/opt/wz_mini/tmp``` mount wz_mini's tmp directory at ```/opt/wz_mini/tmp```
install our `busybox`'s applets to `/opt/wz_mini/tmp/.bin`
create a workplace directory for wz_mini at `/opt/wz_mini/tmp/.storage`
copy the stock ```/etc/init.d/rcS``` to the workplace directory copy the stock ```/etc/init.d/rcS``` to the workplace directory
modify the stock rcS, add ```set -x``` debug mode, inject the following script ```/opt/wz_mini/etc/init.d/v3_post.sh``` to run, and add a section to change PATH and LD_LIBRARY if desired modify the stock rcS, add ```set -x``` debug mode, inject the following script ```/opt/wz_mini/etc/init.d/wz_post.sh``` to run, and add a section to change PATH and LD_LIBRARY if desired
bind replace ```/etc/shadow``` to change the stock password bind replace ```/etc/shadow``` to change the stock password
check to see if the swap archive is present at ```/opt/wz_mini/swap.gz```, if it is, extract it, then mkswap it, and drop the vm cache. check to see if the swap archive is present at ```/opt/wz_mini/swap.gz```, if it is, extract it, then mkswap it, and drop the vm caches.
check to see if the ```/opt/wz_mini/usr/share/terminfo``` directory is present, if not, extract the terminfo files for console programs check to see if the ```/opt/wz_mini/usr/share/terminfo``` directory is present, if not, extract the terminfo files for console programs
mount ```/configs``` to check if the ```.ssh``` dir is present, a requirement for the dropbear ssh server run the `dropbear` ssh daemon
check to see if ```/opt/wz_mini/run_mmc.sh``` has debug mode enabled, if it does, skip loading ```/system/bin/app_init.sh``` and ```/media/mmc/wz_mini/run_mmc.sh```
run ```/media/mmc/wz_mini/run_mmc.sh```, but delay execution for 30 seconds, enough time for WiFi or wired ethernet/usb to load and connect successfully to the internet check to see if ```/opt/wz_mini/wz_user.sh``` has debug mode enabled, if it does, skip loading ```/system/bin/app_init.sh``` and ```/opt/wz_mini/etc/init.d/wz_user.sh```
check to see if ```/opt/wz_mini/wz_user.sh``` has webcam mode enabled, if it does, skip loading ```/system/bin/app_init.sh``` and instead load ```/opt/wz_mini/etc/init.d/wz_cam.sh```
check to see if ```/opt/wz_mini/wz_user.sh``` has upgrade mode enabled, if it does, skip loading ```/system/bin/app_init.sh``` and instead load ```/opt/wz_mini/usr/bin/upgrade-run.sh```
run ```/linuxrc``` to kick off the stock boot process run ```/linuxrc``` to kick off the stock boot process
our modified inittab runs from ```/opt/wz_mini/tmp/.storage/rcS```, we have enabled set -x debug info, added ```/opt/wz_mini/bin``` and ```/opt/wz_mini/lib``` to the system PATH's, and added ```/opt/wz_mini/etc/init.d/v3_post.sh``` to run before ```/system/init/app_init.sh``` runs. ***inittab***:
```/opt/wz_mini/etc/init.d/v3_post.sh``` checks if ```run_mmc.sh``` has the RTSP server enabled, and if it does, we copy ```/system/bin/iCamera``` to our workplace directory at ```/opt/wz_mini/tmp/.storage/``` our modified inittab runs from ```/opt/wz_mini/tmp/.storage/rcS```, we have enabled set -x debug info, added ```/opt/wz_mini/bin``` and ```/opt/wz_mini/lib``` to the system PATH's, and added ```/opt/wz_mini/etc/init.d/wz_post.sh``` to run before ```/system/init/app_init.sh``` runs.
```/opt/wz_mini/etc/init.d/wz_post.sh``` checks if ```wz_user.sh``` has the RTSP server enabled, and if it does, we copy ```/system/bin/iCamera``` to our workplace directory at ```/opt/wz_mini/tmp/.storage/```
bind replace ```/system/bin/iCamera``` bind replace ```/system/bin/iCamera```
@ -51,7 +70,7 @@ we then load the video loopback driver from ```/opt/wz_mini/lib/modules/v4l2loop
```/system/bin/app_init.sh``` loads the stock system software ```/system/bin/app_init.sh``` loads the stock system software
During execution of ```run_mmc.sh```, if ```DISABLE_FW_UPGRADE``` is set to ```false``` we intercept the stock firmware upgrade process. We run ```inotifyd``` at startup, to observe the /tmp/Upgrade directory. During execution of ```wz_user.sh```, if ```DISABLE_FW_UPGRADE``` is set to ```false``` we intercept the stock firmware upgrade process. We run ```inotifyd``` at startup, to observe the /tmp/Upgrade directory.
Normally, ```iCamera``` downloads the firmware upgrade tar to ```/tmp/img```, renames it to ```/tmp/Upgrade.tar```, then extracts it to ```/tmp/Upgrade``` Normally, ```iCamera``` downloads the firmware upgrade tar to ```/tmp/img```, renames it to ```/tmp/Upgrade.tar```, then extracts it to ```/tmp/Upgrade```

View File

@ -0,0 +1,158 @@
# build
two environments:
## atomcam tools (first)
`git clone https://github.com/mnakada/atomcam_tools`
`cd atomcam_tools`
`make`
then wait a long time for the development environment to compile and complete.
After its complete, run `docker-compose up -d` to start the docker instance.
To resume the instance, get the container ID from `docker ps`, and use `docker exec -it <container_Id> /bin/bash`
the following is translated from: [https://github.com/mnakada/atomcam_tools/blob/71a1214f83a92704221cedcf5101e12ba40f2f38/build.md?plain=1#L200](https://github.com/mnakada/atomcam_tools/blob/71a1214f83a92704221cedcf5101e12ba40f2f38/build.md?plain=1#L200)
### Docker environment
In the Docker environment, / src is mapped to atomcam_tools /.
Below, basically the commands in Docker are executed from the following Directory.
```
root@ac0375635c01: / atomtools # cd / atomtools / build / buildroot -2016.02
```
rootfs uses gcc in Docker in a glibc environment.
Gcc is also generated during build.
gcc prefix is
** / atomtools / build / buildroot-2016.02 / output / host / usr / bin / mipsel-ingenic-linux-gnu-**
is.
ATOM Cam's original system camera app iCamera_app is built in the uClibc environment.
Therefore, uClibc environment is required to build libcallback.so for hack of iCamera_app, so it is cloned separately.
** / atomtools / build / mips-gcc472-glibc216-64bit / bin / mips-linux-uclibc-gnu-**
using.
### How to build when making various changes
When changing the config of initramfs and kernel
```
root @ ac0375635c01: / atomtools # make linux-rebuild
root@ac0375635c01: / atomtools # cp output / images / uImage.lzma /src
```
Will be built with and copied to atomcam_tools /.
---
If you modify the files in rootfs or the menuconfig of busybox
```
root@ac0375635c01: / atomtools # make
root@ac0375635c01: / atomtools # cp output / images / rootfs.ext2 /src
```
Will be built with and copied to atomcam_tools /.
Copy it to the SD Card with the names factory_t31_ZMC6tiIDQN and rootfs_hack.ext2 respectively.
---
If you change the package included in rootfs
```
root @ ac0375635c01: / atomtools # make menuconfig
root @ ac0375635c01: / atomtools # make
```
Will build rootfs.
---
For individual package rebuilds
```
root @ ac0375635c01: / atomtools # make < package > -rebuild
```
---
When changing settings such as busybox commands
```
root @ ac0375635c01: / atomtools # make busybox-menuconfig
root @ ac0375635c01: / atomtools # make
```
Will build rootfs.
---
When changing kernel settings
```
root @ ac0375635c01: / atomtools # make linux-menuconfig
root @ ac0375635c01: / atomtools # make linux-rebuild
```
Will generate uImage.lzma.
----
## buildroot (second)
download `https://buildroot.org/downloads/buildroot-2022.05.tar.xz`
run `make menuconfig`
options should be:
- Target Options:
- Target Architecture
- MIPS (little endian)
- Target Architecture Variant
- Generic MIPS32R2
- FP Mode
- 32
- Build Options:
- Strip Target Binaries [*]
- Libraries
- static only ( you can do dynamic if you like, just remember you have to copy ALL the program's required libararies to the device! )
- Toolchain
- C library:
- musl (you can also use uClibc-ng if you prefer)
- Kernel Headers
- Manually Specified Linux Version
- 3.10.98
- Custom Kernel Headers Series
- 3.10.x
- Binutils Version
- 2.36.1
- GCC Compiler Version
- gcc 9.x
- Enable C++ Support [*]
- Enable compiler link-time-optimization support [*]
- Target packages
- Whatever packages you want!
Then select exit, save changes, and then run `make` and your compiled programs should be in `output/target/usr/`

View File

@ -65,19 +65,75 @@ May 13 13:22:38 iCamera: [sdk,0205]dbg: Pin(51) Lvl(1) Dir(in)
May 13 13:22:38 iCamera: [sdk,0205]dbg: Pin(50) Lvl(0) Dir(in) May 13 13:22:38 iCamera: [sdk,0205]dbg: Pin(50) Lvl(0) Dir(in)
May 13 13:22:38 iCamera: [sdk,0205]dbg: Pin(62) Lvl(0) Dir(in) May 13 13:22:38 iCamera: [sdk,0205]dbg: Pin(62) Lvl(0) Dir(in)
``` ```
v2:
```
misc_init_r before change the wifi_enable_gpio
gpio_request lable = wifi_enable_gpio gpio = 62
misc_init_r after gpio_request the wifi_enable_gpio ret is 62
misc_init_r after change the wifi_enable_gpio ret is 0
misc_init_r before change the yellow_gpio
gpio_request lable = yellow_gpio gpio = 38
misc_init_r after gpio_request the yellow_gpio ret is 38
misc_init_r after change the yellow_gpio ret is 0
misc_init_r before change the blue_gpio
gpio_request lable = blue_gpio gpio = 39
misc_init_r after gpio_request the blue_gpio ret is 39
misc_init_r after change the blue_gpio ret is 1
gpio_request lable = night_gpio gpio = 81
misc_init_r after gpio_request the night_gpio ret is 81
misc_init_r after change the night_gpio ret is 0
gpio_request lable = night_gpio gpio = 25
misc_init_r after gpio_request the night_gpio ret is 25
misc_init_r after change the night_gpio ret is 0
gpio_request lable = night_gpio gpio = 49
misc_init_r after gpio_request the night_gpio ret is 49
misc_init_r after change the night_gpio ret is 0
gpio_request lable = USB_able_gpio gpio = 47
misc_init_r after gpio_request the USB_able_gpio ret is 47
misc_init_r after change the USB_able_gpio ret is 0
gpio_request lable = TF_able_gpio gpio = 43
misc_init_r after gpio_request the TF_able_gpio ret is 43
misc_init_r after change the TF_able_gpio ret is 1
gpio_request lable = SPK_able_gpio gpio = 63
misc_init_r after gpio_request the SPK_able_gpio ret is 63
misc_init_r after change the SPK_able_gpio ret is 0
gpio_request lable = SD_able_gpio gpio = 48
misc_init_r after gpio_request the SD_able_gpio ret is 48
misc_init_r after change the SD_able_gpio ret is 0
misc_init_r before change the wifi_enable_gpio
gpio_request lable = wifi_enable_gpio gpio = 62
misc_init_r after gpio_request the wifi_enable_gpio ret is 62
misc_init_r after change the wifi_enable_gpio ret is 1
```
```
Feb 20 02:19:27 iCamera: [SDK-GPIO]dbg: Pin(39) Lvl(1) Dir(out)
Feb 20 02:19:27 iCamera: [SDK-GPIO]dbg: Pin(38) Lvl(0) Dir(out)
Feb 20 02:19:27 iCamera: [SDK-GPIO]dbg: Pin(26) Lvl(0) Dir(out)
Feb 20 02:19:27 iCamera: [SDK-GPIO]dbg: Pin(25) Lvl(0) Dir(out)
Feb 20 02:19:27 iCamera: [SDK-GPIO]dbg: Pin(47) Lvl(1) Dir(out)
Feb 20 02:19:27 iCamera: [SDK-GPIO]dbg: Pin(48) Lvl(0) Dir(out)
Feb 20 02:19:27 iCamera: [SDK-GPIO]dbg: Pin(46) Lvl(1) Dir(in)
Feb 20 02:19:27 iCamera: [SDK-GPIO]dbg: Pin(43) Lvl(0) Dir(in)
```
--- ---
kernel command line: kernel command line:
v3: v3:
`[ 0.000000] Kernel command line: console=ttyS1,115200n8 mem=99M@0x0 rmem=29M@0x6300000 init=/linuxrc rootfstype=squashfs root=/dev/mtdblock2 rw mtdparts=jz_sfc:256K(boot),1984K(kernel),3904K(rootfs),3904K(app),1984K(kback),3904K(aback),384K(cfg),64K(para) `console=ttyS1,115200n8 mem=99M@0x0 rmem=29M@0x6300000 init=/linuxrc rootfstype=squashfs root=/dev/mtdblock2 rw mtdparts=jz_sfc:256K(boot),1984K(kernel),3904K(rootfs),3904K(app),1984K(kback),3904K(aback),384K(cfg),64K(para)`
`
panv2: panv2:
`console=ttyS1,115200n8 mem=96M@0x0 rmem=32M@0x6000000 init=/linuxrc rootfstype=squashfs root=/dev/mtdblock2 rw mtdparts=jz_sfc:256K(boot),1984K(kernel),3904K(rootfs),3904K(app),1984K(kback),3904K(aback),384K(cfg),64K(para)` `console=ttyS1,115200n8 mem=96M@0x0 rmem=32M@0x6000000 init=/linuxrc rootfstype=squashfs root=/dev/mtdblock2 rw mtdparts=jz_sfc:256K(boot),1984K(kernel),3904K(rootfs),3904K(app),1984K(kback),3904K(aback),384K(cfg),64K(para)`
v2:
`console=ttyS1,115200n8 mem=104M@0x0 ispmem=8M@0x6800000 rmem=16M@0x7000000 init=/linuxrc rootfstype=squashfs root=/dev/mtdblock2 rw mtdparts=jz_sfc:256k(boot),2048k(kernel),3392k(root),640k(driver),4736k(appfs),2048k(backupk),640k(backupd),2048k(backupa),256k(config),256k(para),-(flag)`
--- ---
v3 accessory: v3 accessory:
@ -108,6 +164,9 @@ set device mode:
`devmem 0x13500000 32 0x001100cc` `devmem 0x13500000 32 0x001100cc`
`echo connect > /sys/devices/platform/jz-dwc2/dwc2/udc/dwc2/soft_connect`
v3: v3:
set host mode: set host mode:

153
documentation/outdoor.md Normal file
View File

@ -0,0 +1,153 @@
## boot log:
```
Ver:20201017-Turret
od_cam Build:Mar 15 2022 05:01:34
----====>>>> come into od_cam:555(ms)
sensor name:gc2063
ERROR: serch the USER token failed!
ERROR: serch the USER token failed!
ERROR: serch the USER token failed!
!! The specified ScalingList is not allowed; it will be adjusted!!
!! The specified ScalingList is not allowed; it will be adjusted!!
[frame_pooling_thread--400 Channel:0 ]:585(ms)
[frame_pooling_thread--400 Channel:1 ]:683(ms)
----====>>>> first video frame time:697(ms)
[IMP_Encoder_GetStream--2150 Channel:0 ]:697(ms)
----====>>>> first video sub frame time:847(ms)
[IMP_Encoder_GetStream--2150 Channel:1 ]:847(ms)
open /sys/class/gpio/gpio60/direction error !
open /sys/class/gpio/gpio49/direction error !
----====>>>> first audio frame time:863(ms)
IVS Version:1.0.5 built: Sep 3 2020 14:15:52
ERROR: serch the WIFI token failed!
wakeupFlag : 0
cam_ev_init error:-1
ERROR: serch the USER token failed!
grid_info is not exist!
gridTempArray =ffff
gridTempArray =ffff
gridTempArray =ffff
gridTempArray =ffff
gridTempArray =ffff
gridTempArray =ffff
gridTempArray =ffff
gridTempArray =ffff
gridTempArray =ffff
gridTempFirstLine = 0
gridTempLastLine = 8
gridTempFirstRow = 0
gridTempLastRow = 15
binaryTempright = 0
binaryTempleft = 15
ZRT_POWER_WIFI:ZRT_Get_WIFI_Config error
ZRT_POWER_WIFI:ZRT_HL_Dual_Bind_TCP_sync Start
ZRT_CAM_DAEMON:[DUAL] TCP socket erro
>>>>>>>>>>>BATTERY_USAGE_EVENT_DROP old: 0, start: 1
Setting up swapspace version 1, size = 16773120 bytes
UUID=0df0afb8-3a67-464e-975b-e2a77add239c
write /sys/class/gpio/export error: Device or resource busy
z_cmd_disable_wdt()
CMD: head=c309, index=4012, index_n=bfed, end=55aa
resp:OK
WCO_V2 login: Not This File: /config/profiles/.reconnect.conf
Stream Cipher init time: 4703
[IMP_Encoder_GetStream--2150 Channel:2 ]:5064(ms)
Stream Cipher init success
check_pir: 0
check_time: 1
check_repower: 1
pir_sensitive: 128
mov_sensitive: 128
file_size_avg: 0KB trans_rate_avg: 0KB/S
alarm resolusion: 1080P
----====>>>> get first pir value:5108(ms)
Alarm analysis, moved frame num: 1, threshold num: 7
Alarm analysis not pass!
paracfg user has not inited
od_cam init done.
MCU Event Flag: 0 -> 0
firmware_version:4.48.4.124
hardware_version:0.0.0.2
hardware_ver2:D03F272EB7C9D03F272EB7C9F00A0000
[Real-time alarm] alarm start, get_alarm_video_flag: 0
Sleeping may corrupt here, So add log
_lostBeaconCount_statistics();
_lostBeaconCount_statistics quit
************* camera task: 0 -> 0 *************
notifyWyzeFlag = 0
go_sleep_immediately
mv: can't rename '/tmp/mnt/sdcard/Wyze_camera_log/wyze_camera_2*': No such file or directory
come into mcu check...
mcu version is right
[Real-time alarm] lower: 997, pir_min: 126, pir_max: 132, upper: 3098
[Real-time alarm] moved frame num: 57, threshold num: 7
[Real-time alarm] pir & moved filter pass, start alarm.
cond signa; done
[Real-time alarm]sleeping;quit
[pir_log] pir_up : 0 | pir_max : 133 | pir_min : 126
alarm file(/tmp/alarm.info) is not find
alarm file(/tmp/alarm.info) is not find
sleep,wifi hasn't keep alive
export T31_FORCE_POWER gpio59
killall: zrt_app: no process killed
rmmod: remove 'bcmdhd': No such file or directory
killall: cat: no process killed
killall: logcat: no process killed
```
## update rootfs:
```
[sd_update.sh] ROOTFS updateing...
[sd_state_wait.sh] sd_update.sh is running, exit
SystemCall_Dbus_ReadWrite_Thread 520 read socket data failed exit this thread, ret:0 errno:0 (Success)
SystemCall_Dbus_ReadWrite_Thread 521 maybe client is close
[sd_update.sh] copy failed
rmmod: remove 'cywdhd': Device or resource busy
umount: proc busy - remounted read-only
Sent SIGTERM to all processesr
Sent SIGKILL to all processes
Requesting system reboot
[ 27.797603] Restarting system.
U-Boot 2013.07 (Nov 14 2021 - 09:40:06)
Board: ISVP (Ingenic XBurst T31 SoC)
DRAM: 128 MiB
Top of RAM usable for U-Boot at: 84000000
Reserving 441k for U-Boot at: 83f90000
Reserving 32776k for malloc() at: 81f8e000
Reserving 32 Bytes for Board Info at: 81f8dfe0
Reserving 124 Bytes for Global Data at: 81f8df64
Reserving 128k for boot params() at: 81f6df64
Stack Pointer at: 81f6df48
Now running in RAM - U-Boot at: 83f90000
MMC: msc: 0
the manufacturer c8
SF: Detected GD25Q128
*** Warning - bad CRC, using default environment
In: serial
Out: serial
Err: serial
Net: ====>PHY not found!Jz4775-9161
Hit any key to stop autoboot: 0
the manufacturer c8
SF: Detected GD25Q128
--->probe spend 4 ms
SF: 2785280 bytes @ 0xa98000 Read: OK
--->read spend 894 ms
Wrong Image Format for bootm command
ERROR: can't get kernel image!
isvp_t31#
```
kernel command line:
`console=ttyS1,115200n8 mem=80M@0x0 rmem=48M@0x5000000 root=/dev/ram0 rw rdinit=/linuxrc mtdparts=jz_sfc:256K(boot),352K(tag),5M(kernel),5M(rootfs),2720K(recovery),2304K(system),512k(config),16M@0(all) lpj=6955008 quiet`