anmaped / openfang

The openfang is a bootloader, kernel and toolchain for devices using Ingenic T10 and T20 SOC
GNU General Public License v3.0
184 stars 43 forks source link

Newer buildroot & toolchains #1

Closed jmtatsch closed 5 years ago

jmtatsch commented 6 years ago

Hi,

is there a reason why you are using such an old version of buildroot? Have you seen the newer toolchains at https://github.com/tssva/ingenic-toolchains?

anmaped commented 6 years ago

Hi,

is there a reason why you are using such an old version of buildroot? Have you seen the newer toolchains at https://github.com/tssva/ingenic-toolchains?

@jmtatsch I think so. First, kernel can only be compiled with gcc 4.7.x (maybe newer ports appear) and it is a good practice to use the same toolchain to compile all the distribution. Second, the toolchains you point are based on glibc and not on ulibc as we expect.

I'm currently compiling the v4l2rtspserver from scratch but I get

# v4l2rtspserver-v0.0.8 -W 1280 -H 960
log level:500

[NOTICE] /home/vm2/mipsel_uclibc_[ 2230.537843] ###### image_tuning_v4l2_open 4219 #######
toolchain/openfang/_build/buildroot-2014.08/output/build/v4l2rtspserver-v0.0.8/src/main.cpp:622
        Create V4L2 Source.../dev/video0
[ERROR] src/V4l2Device.cpp:84
        Cannot open device:/dev/video0 Operation not permitted
[ERROR] src/V4l2Device.cpp:67
        VIDIOC_STREAMOFF: Bad file descriptor
VIDIOC_REQBUFS: Bad file descriptor

It is based on https://github.com/mpromonet/v4l2rtspserver/tree/v0.0.8.

jmtatsch commented 6 years ago

I don't know. Have you tried our fork https://github.com/Dafang-Hacks/v4l2rtspserver-master ?

anmaped commented 6 years ago

I don't know. Have you tried our fork https://github.com/Dafang-Hacks/v4l2rtspserver-master ?

Yes, but it is not stable at all. There are some pre-compiled libraries which may create some problems in my case (I have to recompile them) since the server shut down sporadically.

anmaped commented 5 years ago

@jmtatsch Could you test the new rootfs? I didn't use yet the website and scripts but v4lrtspserver is now working.

jmtatsch commented 5 years ago

Awesome, will do on the weekend

tssva commented 5 years ago

Second, the toolchains you point are based on glibc and not on ulibc as we expect.

The toolchains contain both glibc and uclibc.

They also have the advantage of including support for the Ingenic MXU SIMD instruction sets which at some point may be needed. For instance Ingenic uses the MXU instruction set to improve performance of the OpenCV library included with later versions of their sdks.

anmaped commented 5 years ago

@tssva Yes, this is a good point. We will see how to solve the support for Ingenic MXU SIMD later.

Do you have some examples with OpenCV to test?

anmaped commented 5 years ago

@jmtatsch Do you have the source of autonight?

jmtatsch commented 5 years ago

https://github.com/EliasKotlyar/Xiaomi-Dafang-Software/tree/master/autonight

There is also an open pullrequest for software autonight

anmaped commented 5 years ago

https://github.com/EliasKotlyar/Xiaomi-Dafang-Software/tree/master/autonight

There is also an open pullrequest for software autonight

Thanks. I will include it inside v4lrtspserver tools. Later we could make a proper package for all the dafang tools.

anmaped commented 5 years ago

@jmtatsch The autonight tool is now working in the current build: https://github.com/anmaped/openfang/tree/master/binaries/rootfs

I don't have tested the version using camera exposure, but it's enabled there using the parameter -S.

jmtatsch commented 5 years ago

Is the v4l2rtspserver completely unpatched? Is it possible to include the stuff like auto night, motor etc as submodule? that way it would be easier to track source changes & more transparent ... in future a build job could run the buildroot script when ever something has changed in the source repo

anmaped commented 5 years ago

@jmtatsch Yes I have the same ideia. The source code that is available is the one already patched. I want to create the patches from the original source of v4l2rtspserver as you propose. These changes should be tracked carefully in order to avoid future problems.

Autonight, motor, getimage, etc. are available inside the source package in the tools folder.

The idea is to use https://github.com/mpromonet/v4l2rtspserver as the build point. Everything else are modifications in form of patches. In this way, we are able to maintain the source and recheck for modifications.

anmaped commented 5 years ago

@jmtatsch Could you test if mosquito (mqtt) is working well?

jmtatsch commented 5 years ago

@anmaped I will do when i find some time, but I am quite busy with other things right now :(

jmtatsch commented 5 years ago

@anmaped what are you plans regarding motion detection? That is arguably the most important feature of these cams :) You want to got the opencv route?

jmtatsch commented 5 years ago

mqtt is working well by the way

anmaped commented 5 years ago

Good. Could you provide a small tutorial how to configure mqtt? We should also describe the configuration parameters in the Gui.

anmaped commented 5 years ago

@anmaped what are you plans regarding motion detection? That is arguably the most important feature of these cams :) You want to got the opencv route?

Yes. I think opencv is the best option.

jmtatsch commented 5 years ago

Basically I just added the configuration from dafanghacks mqtt.conf to /etc/mosquitto/mosquitto.conf

# Options for mosquitto_sub & mosquitto_pub                                    
USER=mqtt-user                                                                 
PASS=mqtt-password                                                             
HOST=my_mqtt_server_ip_adress                                                            
PORT=1883                                                                                                                                                                                                                                                     

Then you can send a test message like that mosquitto_pub -h my_mqtt_server_ip_adress -m "test" -t "mylocation/test_topic"

Sure we can create a gui to change those parameters, however we would need to give cgi script root rights to write in /etc/. Root rights for anything web serving is almost never a good idea :)

Also, do we want one single openfang.conf or do we want the configs scattered over all places such as in dafang hacks?

As we are talking about root, can we add the sudo package to buildroot?

jmtatsch commented 5 years ago

Concerning opencv motion detection, I would be thrilled if that would work out. However, i am afraid that resources are too limited for that. Ingenic wouldn't otherwise feel the need to provide highly optimised motion detection routines.

anmaped commented 5 years ago

As we are talking about root, can we add the sudo package to buildroot?

Fixed in 573788d0f31fd96255b197427aa242daa5c32194.

sh /opt/autoupdate.sh will update to the new version. But there is no exception for config files (some will be overwritten).

We should do a list of directories/files to backup and restore after the update.

jmtatsch commented 5 years ago

After the update /mnt/update somehow is still mounted, so the next update fails with: mount: mounting PPwPPw on /mnt/update failed: Device or resource busy although there is https://github.com/anmaped/openfang/blob/aeac4f0983762a0b36f3b46e339fe44b2da0ab15/fs/opt/autoupdate.sh#L20 using the same command manually works. Could this be a timing issue somehow?

jmtatsch commented 5 years ago

Oh and I seem to have lost my wpa_supplicant.conf during the update :(

anmaped commented 5 years ago

Oh and I seem to have lost my wpa_supplicant.conf during the update :(

You can put the file in the second partition. It will be used/copied automatically.

anmaped commented 5 years ago

After the update /mnt/update somehow is still mounted, so the next update fails with: mount: mounting PPwPPw on /mnt/update failed: Device or resource busy although there is

openfang/fs/opt/autoupdate.sh

Line 20 in aeac4f0 umount /mnt/update/

using the same command manually works. Could this be a timing issue somehow?

Yes. The problem is that some tools are running and we should shutdown them first. Yet, this update script is outdated, let's see the new one in the next release, which you can find here https://github.com/anmaped/openfang/releases/download/rc05_01/autoupdate.sh.

anmaped commented 5 years ago

@tssva Have you been able to compile it? Could you describe the dependencies in terms of the external environment?