dirandad / lightcamera-openipc

Install OpenIPC on Light Camera (Lutec, Steinel)
15 stars 1 forks source link

Update firmware using ipctool ends in "Killed" or "Allocation error" #4

Closed waldy83 closed 1 year ago

waldy83 commented 1 year ago

Trying to update the firmware using ipctool ends always with an error:

# /tmp/mmcblock0/ipctool upgrade /tmp/mmcblock0/upgrade.hi3518ev300 --force
There was no Sofia process detected
Using '/tmp/mmcblock0/upgrade.hi3518ev300' as upgrade bundle
        boot    0xb65bb010, size: 262144 bytes
        env     0x63010, size: 65536 bytes
        kernel  0xb62ba010, size: 3145728 bytes
Killed

or

# /tmp/mmcblock0/ipctool upgrade /tmp/mmcblock0/upgrade.hi3518ev300 --force
There was no Sofia process detected
Using '/tmp/mmcblock0/upgrade.hi3518ev300' as upgrade bundle
        boot    0xb6656010, size: 262144 bytes
        env     0x63010, size: 65536 bytes
        kernel  0xb6355010, size: 3145728 bytes
Allocation error

Steinel firmware is the latest "2022-12-07"

dirandad commented 1 year ago

Hello, can you put here the output of ipctool ? /tmp/mmcblock0/ipctool

dirandad commented 1 year ago

do you use upgrade.hi3518ev300 provided in this repository or do you build it using ipctool repository script ?

waldy83 commented 1 year ago

Hello, can you put here the output of ipctool ? /tmp/mmcblock0/ipctool

# /tmp/mmcblock0/ipctool
---
chip:
  vendor: HiSilicon
  model: 3518EV300
  id: 02203986be0038d1b370030a7a5a6a1425c2831c21d139e3
board:
  vendor: Xiongmai
  param: HI3518EV300_50H20L
  cloudId: 7f693c3566c45411
  possible-IR-cut-GPIO: 3,8
ethernet:
  mac: "00:12:31:88:e3:ab"
  u-mdio-phyaddr: 1
  phy-id: 0x20669903
  d-mdio-phyaddr: 0
rom:
  - type: nor
    block: 64K
    chip:
      name: "XM_W25Q128FV, W25Q128JV"
      id: 0xef4018
    partitions:
      - name: boot
        size: 0x40000
        sha1: 43c1a4d6
        contains:
          - name: xmcrypto
            offset: 0x2fc00
          - name: uboot-env
            offset: 0x30000
      - name: romfs
        size: 0x540000
        path: /,squashfs
        sha1: b19c71af
      - name: user
        size: 0x740000
        path: /mnt/custom/data/Fonts,cramfs
        sha1: 0dc1ec6b
      - name: web
        size: 0x180000
        path: /mnt/web,cramfs
        sha1: 02ef3a0b
      - name: custom
        size: 0x80000
        path: /mnt/custom,cramfs
        sha1: c3400e52
      - name: mtd
        size: 0x140000
        path: /mnt/mtd,jffs2,rw
    size: 16M
    addr-mode: 3-byte
ram:
  total: 64M
  media: 21M
firmware:
  u-boot: "2016.11 (Oct 29 2018 - 16:06:3"
  kernel: "4.9.37 (Tue Oct 29 20:49:40 CST 2019)"
  toolchain: gcc version 6.3.0 (Heterogeneous Compiler&Codesign V100R002C00B003)
  libc: uClibc 0.9.33.2
  sdk: "Hi3516EV200_MPP_V1.0.1.2 B030 Release (Oct 18 2019, 18:21:00)"
  main-app: /usr/bin/Sofia
sensors:
- vendor: SmartSens
  model: SC2315E
  control:
    bus: 0
    type: i2c
    addr: 0x60
  data:
    type: MIPI
    input-data-type: DATA_TYPE_RAW_10BIT
    lane-id:
    - 0
    - 1
    image: 1920x1080
  clock: 27MHz
waldy83 commented 1 year ago

do you use upgrade.hi3518ev300 provided in this repository or do you build it using ipctool repository script ?

I tried both with the same result. But I`m not sure if the one I build myself is realy correct.

dirandad commented 1 year ago

the file in this repository should work. If you generate your bundle, you must used the following script that I commit to openipc, but that are still not validated:

https://github.com/dirandad/openipc-ipctool/blob/patch-1/tools/make_images.sh https://github.com/dirandad/openipc-ipctool/blob/patch-2/tools/upgrade_bundle.py

waldy83 commented 1 year ago

All files from the repository:

LocalHost login: root
Password:
Welcome to HiLinux.
# cd /tmp/mmcblock0/
# ls -ls
     4 drwxr-xr-x    2 root     root          4096 Mar  8  2023 System Volume Information
 16388 -rwxr-xr-x    1 root     root      16778881 Feb 27 17:42 firmwaredump.bin
   128 -rwxr-xr-x    1 root     root        127024 Feb  7 13:17 ipctool
     4 -rwxr-xr-x    1 root     root          1701 Feb 27 17:42 ipctoolbackup.txt
     4 -rwxr-xr-x    1 root     root            24 Jan  1  1970 test.txt
  9076 -rwxr-xr-x    1 root     root       9289928 Feb  7 13:17 upgrade.hi3518ev300
     4 -rwxr-xr-x    1 root     root          1956 Feb  7 13:17 xm_autorun.sh
# /tmp/mmcblock0/ipctool upgrade /tmp/mmcblock0/upgrade.hi3518ev300 --force
Sofia has been terminated, waiting for watchdog...
delete_module, errno: No such file or directory
Cannot disarm watchdog
aborting...

# /tmp/mmcblock0/ipctool upgrade /tmp/mmcblock0/upgrade.hi3518ev300 --force
There was no Sofia process detected
Unmounting /usr
Unmounting /mnt/web
Unmounting /mnt/custom
Unmounting /mnt/mtd
Unmounting /mnt/custom/data/Fonts
Using '/tmp/mmcblock0/upgrade.hi3518ev300' as upgrade bundle
        boot    0xb659e010, size: 262144 bytes
        env     0x63010, size: 65536 bytes
        kernel  0xb629d010, size: 3145728 bytes
Killed
dirandad commented 1 year ago

this is the output i get during upgrade:

Using '/tmp/mmcblock0/upgrade.hi3518ev300' as upgrade bundle
        boot    0xb662e010, size: 262144 bytes
        env     0x63010, size: 65536 bytes
        kernel  0xb642d010, size: 2097152 bytes
        rootfs  0xb5d7c010, size: 7012352 bytes

it seems your upgrade file is not well structured.

dirandad commented 1 year ago

you have test this file (to be sure :-)) ? https://github.com/dirandad/lightcamera-openipc/blob/main/L620/firmware/upgrade.hi3518ev300

waldy83 commented 1 year ago

Downloaded all files again and also tried two different sd cards but still have the same error. Any other suggestions?

dirandad commented 1 year ago

OK, may be the upgrade file on the repository is corrupted. Have you try to build your own upgrade file using the script I give you above ?

waldy83 commented 1 year ago

With my own upgrade file I have the same issue. Do you have a link to a coupler firmware version I can try? I can not find one for the device ID "F9552520"

dirandad commented 1 year ago

Coupler is a very differente approach and for Steinel L620 CAM, you can only migrate to lite version of Open-IPC. Can you give the me output of ipctool with your own upgrade file, to see partions size before the error. The value are differente from the output I get during my upgrade. I will try to create a new upgrade file next week.

waldy83 commented 1 year ago
# /tmp/mmcblock0/ipctool upgrade /tmp/mmcblock0/upgrade.hi3518ev300_waldy --forc
e
Sofia has been terminated, waiting for watchdog...
delete_module, errno: No such file or directory
Cannot disarm watchdog
aborting...
#
# /tmp/mmcblock0/ipctool upgrade /tmp/mmcblock0/upgrade.hi3518ev300_waldy --force
There was no Sofia process detected
Unmounting /usr
Unmounting /mnt/web
Unmounting /mnt/custom
Unmounting /mnt/mtd
Unmounting /mnt/custom/data/Fonts
Using '/tmp/mmcblock0/upgrade.hi3518ev300_waldy' as upgrade bundle
        boot    0xb65b9010, size: 262144 bytes
        env     0x64010, size: 65536 bytes
        kernel  0xb62b8010, size: 3145728 bytes
Allocation error
#
# /tmp/mmcblock0/ipctool upgrade /tmp/mmcblock0/upgrade.hi3518ev300_waldy --force
There was no Sofia process detected
Using '/tmp/mmcblock0/upgrade.hi3518ev300_waldy' as upgrade bundle
        boot    0xb65d8010, size: 262144 bytes
        env     0x64010, size: 65536 bytes
        kernel  0xb62d7010, size: 3145728 bytes
Allocation error
#
# /tmp/mmcblock0/ipctool upgrade /tmp/mmcblock0/upgrade.hi3518ev300_waldy --force
There was no Sofia process detected
Using '/tmp/mmcblock0/upgrade.hi3518ev300_waldy' as upgrade bundle
        boot    0xb6617010, size: 262144 bytes
        env     0x64010, size: 65536 bytes
        kernel  0xb6316010, size: 3145728 bytes
Allocation error
#

That is the output with my upgrade file. It`s not realy different than the output with your upgrade file.

I`m just wondering - the size is always the same, but the adress not!?

Many tries but once I got:

# /tmp/mmcblock0/ipctool upgrade /tmp/mmcblock0/upgrade.hi3518ev300_waldy --forc
e
There was no Sofia process detected
Using '/tmp/mmcblock0/upgrade.hi3518ev300_waldy' as upgrade bundle
        boot    0xb6618010, size: 262144 bytes
        env     0x64010, size: 65536 bytes
        kernel  0xb6317010, size: 3145728 bytes
        rootfs  0xb5916010, size: 10485760 bytes
Killed

It was the first time I saw rootfs in the output - I don`t know why.

dirandad commented 1 year ago

I propose you a new try with this new version of the script that will pack the partition: https://github.com/dirandad/openipc-ipctool/blob/patch-1/tools/make_images.sh kernel and rootfs should be smaller.

$ ./make_images.sh hi3518ev300 ultimate
FULL_PATH: ../../openipc-firmware/br-ext-chip-hisilicon/configs/hi3518ev300_ultimate_defconfig
SOC: hi3518ev300
OPENIPC_FLAVOR: ultimate
FAMILY: hi3516ev200
BOOT: hi3518ev300
FLASH: 16MB
Download bootloader
 - https://github.com/OpenIPC/firmware/releases/download/latest/u-boot-hi3518ev300-universal.bin
Download firmware
 - https://github.com/OpenIPC/firmware/releases/download/latest/openipc.hi3518ev300-nor-ultimate.tgz
Create output/upgrade.hi3518ev300 bundle using
 - /tmp/tmp.PIqAOOpzpt/u-boot-hi3518ev300-universal.bin
 - /tmp/tmp.PIqAOOpzpt/uImage.hi3518ev300
 - /tmp/tmp.PIqAOOpzpt/rootfs.squashfs.hi3518ev300
{'name': 'boot', 'payloadSize': 235915, 'sha1': '1b93257f', 'partitionSize': 262144}
{'name': 'kernel', 'payloadSize': 2053888, 'sha1': '7e277345'}
{'name': 'rootfs', 'payloadSize': 7000064, 'sha1': 'fc8fa951'}
waldy83 commented 1 year ago

That looks better for me:

# /tmp/mmcblock0/ipctool upgrade /tmp/mmcblock0/upgrade.hi3518ev300_waldy2 --for
ce
There was no Sofia process detected
Unmounting /usr
Unmounting /mnt/web
Unmounting /mnt/custom
Unmounting /mnt/mtd
Unmounting /mnt/custom/data/Fonts
Using '/tmp/mmcblock0/upgrade.hi3518ev300_waldy2' as upgrade bundle
        boot    0xb65da010, size: 262144 bytes
        env     0x64010, size: 65536 bytes
        kernel  0xb63d9010, size: 2097152 bytes
        rootfs  0xb5d28010, size: 7012352 bytes
Analyzing boot
Analyzing env
Analyzing kernel
Analyzing rootfs
Upgrading boot
Erase failed, trying XM specific algorithm...ok
Flashing [wwww]
Upgrading env
Flashing [w]
Upgrading kernel
Flashing [wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww]
Upgrading rootfs
Flashing [wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww]
set_env_param: total_mem=64M
System will be restarted...

Now I have the problem that the cam will not connect to the wlan.

The autoconfig\etc\network\interfaces is adapted.

Maybe something went wrong when flashing. I think now I have to disassemble the cam

dirandad commented 1 year ago

Hello, ok, one step more ! I sometime get format issue after migration, so that autoconfig is not well executed. So I propose you to reformat your sd card following these instructions.

You can also use the autoconfig to investiguate what is wrong in your configuration. Here is some information about all possibility of autoconfig.

You can for example create a autoconfig.sh file make to investigation and output it to a text file:

#! /bin/sh

mountdir=/mnt/mmcblk0p1

echo "script has been started" > ${mountdir}/test.txt

ifconfig > ${mountdir}/ifconfig.txt

You can then:

Disassemble the camera is a pain... keep it for the real last solution

waldy83 commented 1 year ago

Thanks for your efforts, I dont really know why but I couldnt get the autoconfig.sh running.

Now I disassembled the cam - and yes it`s not really fun.

Over a u-boot connection it was than no problem to get openipc on the cam.

dirandad commented 1 year ago

Ok, really strange story.

So, your camera is know well running on OpenIPC ?

waldy83 commented 1 year ago

The first tests look good. RTSP and snapshot are working. I think I have to play with some settings (audio activated in RTSP for example), but it`s running so far.

Thanks for all your help!

dirandad commented 1 year ago

Your are welcome

dirandad commented 1 year ago

@waldy83 if your camera is still dismounted, can you give me the reference that is written on the smal SSOP20 chip referenced U2 (20pin micro chip) that is on the extention card which manage light, détector,... ? see picture

waldy83 commented 1 year ago

I`m sorry the cam is already reassembled. I made some pictures, but the chip is not really good to see:

Something like

ABCV PG208FB 2211N

I would say???

PXL_20230311_114845467 MP Chip