We have upgraded the community system as part of the upgrade a password reset is required for all users before login in.

go-udev on omega 2+



  • Hello,

    I have developed custom application for my Omega 2s+ board in the Go. For usb stuff I am using go-udev (https://github.com/pilebones/go-udev) library.
    On the latest image it seems that, the udev is not present. I read couple of threads mentioning udev is not available for openwrt. I am missing the conclusion that, whether we can use udev on Omega boards or not. If yes, I would appriciate assistance in porting it. If No, what is the alternative.

    TIA



  • @dixit udev is replaced by hotplug, you can use it to write scripts to respond to events on devices, such as insert/remove, adapter enable/disable etc.



  • @crispyoz thanks. Incase I want to use udev with mentioned go library, can I port the eudev package ? If yes, I would really appreciate any references to achieve it. Thanks



  • @dixit Anything is possible, you can check the sources on openwrt.org for earlier versions of OpenWrt and you could port the source but it seems to me you'd be making a lot of work for yourself and you'd need to maintain it going forward and OS updates would likely break it. It doesn't seem like a good strategy to implement an outdated system so you can use some API, it would make more sense to modify the API, or rewrite it, so it can support current technology.

    Perhaps you can share what you are actually trying to achieve and members here may be able to suggest another strategy.



  • @crispyoz thank you.
    I added the eudev package in to the Omega source ans recompiled the OS.
    I tried updating the OS on the board by following manual upgrade process using sysupgrade command but the board seem bricked. Because after the flash I can't see wifi AP via which I was accessing it. Any suggestions to recover the board?
    I am new to Omega so this is first time I am going through all of this.



  • @dixit Did you try a factory reset?

    https://docs.onion.io/omega2-docs/factory-reset.html

    What dock do you have?



  • @crispyoz Yes I tried, the problem is still there.
    I have expansion dock.
    Moreover I got access the board via serial console and from that I got to know that the firmware I flashed is not having all the utilities/tools that are provided with the stock Omega build(even wifisetup binary is also not there).
    The ifconfig output looks like below;

    br-lan    Link encap:Ethernet  HWaddr 40:A3:6B:C0:27:84  
              inet addr:192.168.100.1  Bcast:192.168.100.255  Mask:255.255.255.0
              inet6 addr: fd1d:48c4:7633::1/60 Scope:Global
              inet6 addr: fe80::42a3:6bff:fec0:2784/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0
              TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:0 (0.0 B)  TX bytes:1784 (1.7 KiB)
    
    eth0      Link encap:Ethernet  HWaddr 40:A3:6B:C9:09:B2  
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0
              TX packets:20 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:0 (0.0 B)  TX bytes:3413 (3.3 KiB)
              Interrupt:5 
    
    lo        Link encap:Local Loopback  
              inet addr:127.0.0.1  Mask:255.0.0.0
              inet6 addr: ::1/128 Scope:Host
              UP LOOPBACK RUNNING  MTU:65536  Metric:1
              RX packets:32 errors:0 dropped:0 overruns:0 frame:0
              TX packets:32 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:2080 (2.0 KiB)  TX bytes:2080 (2.0 KiB)
    

    In my understanding, there should have been interface for WiFi AP.
    So the issue what I think is that the .config which I built is not having all the options needed for Omega2+ to work like stock Omage build. Let me know if you think this not the actual problem.
    Can you help me how I can setup the same build as stock Omaga?

    Thanks



  • @crispyoz I followed this https://github.com/OnionIoT/source to setup the build on my Ubuntu machine and followed the make method to generate build same as it released by Onion releases.
    I did run below commands to have all the release packages in onion release in my custom release;

    python scripts/onion-setup-build.py -c .config.O2
    make clean
    make
    

    As I have Omega 2S+ board I flashed openwrt-ramips-mt76x8-omega2p-squashfs-sysupgrade.bin from bin/targets/ramips/mt76x8/ directory.

    Let me know if I missed anything to build custom OS which left me in this issue.



  • @dixit Those instructions should work for you, but easier if you download the firmware build by Onion and use that, so you know you haven't missed anything and this will get you back to a stock Omega2+ device.

    http://repo.onioniot.com.s3.amazonaws.com/omega2/images/omega2p-v0.3.3-b253.bin



  • @dixit Here are my own instructions I use to build custom firmware, it's based on the one you referred to:


    Setup firmware build environment:

    update the source

    git clone https://github.com/OnionIoT/source.git

    switch to the openwrt branch

    git checkout openwrt-18.06

    sudo apt install ncurses-dev
    sudo apt install gawk

    clean out any old LEDE related feeds

    ./scripts/feeds clean
    ./scripts/feeds update -a
    ./scripts/feeds install -a

    sh scripts/onion-feed-setup.sh
    python scripts/onion-setup-build.py

    create a symlink to the O2 .config (only relevant when building firmware b222 onwards)

    ln -s .config.O2 .config

    This cleans up the configuration so we only build packages that are included

    in the standard Onion firmware release. SAVE HOURS OF BUILD TIME!

    scripts/onion-minimal-build.sh

    build

    make -j9



  • @crispyoz Thank you! This seems similar to that standard process. I will try setup new codebase following this.



  • @crispyoz Any references of correct way to add packages in to the build and have the generated artifacts to be part of final generated .bin.?



  • @dixit To add new packages, or remove others:

    make menuconfig

    "Target Profile" Select "Multiple Devices"
    "Target Devices" select your Omega2 model nd any others you want to build for

    From the main menu you can search for any package you my want to install by using the "/" key and typing the search term, for instance if I search for udev I can see it is in "Libraries" so I need to look in that section for the package and use the space bar to select the package. "M" indicates hte module is built, "*" indicates the package is included in the built firmware image.



  • @crispyoz Thank you so much!
    I hope this one is the last query for you; I followed above steps and started the compilation.
    It failed with the below error;

    [src/util]
    make: Entering directory '/home/dixit/work/projects/omega2/local_build/source/build_dir/target-mipsel_24kc_musl/postfix-3.3.0/src/util'
    mipsel-openwrt-linux-musl-gcc -DNO_NIS -DUSE_TLS -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I/home/dixit/work/projects/omega2/local_build/source/staging_dir/target-mipsel_24kc_musl/usr/include/sasl -DHAS_LDAP -DHAS_CDB -DNO_DB -DHAS_SQLITE -I/home/dixit/work/projects/omega2/local_build/source/staging_dir/target-mipsel_24kc_musl/usr/include/ -DHAS_PCRE -I/home/dixit/work/projects/omega2/local_build/source/staging_dir/target-mipsel_24kc_musl/usr/include/ -DNO_EAI -DDEF_DB_TYPE=\"cdb\"  -g -O -I. -DLINUX5 -c alldig.c
    cc1: note: someone does not honour COPTS correctly, passed 0 times
    In file included from alldig.c:29:0:
    ./sys_defs.h:1257:2: error: #error "unsupported platform"
     #error "unsupported platform"
      ^~~~~
    ./sys_defs.h:1320:2: error: #error "define HAS_FCNTL_LOCK and/or HAS_FLOCK_LOCK"
     #error "define HAS_FCNTL_LOCK and/or HAS_FLOCK_LOCK"
      ^~~~~
    ./sys_defs.h:1324:2: error: #error "define DEF_MAILBOX_LOCK"
     #error "define DEF_MAILBOX_LOCK"
      ^~~~~
    ./sys_defs.h:1328:2: error: #error "define INTERNAL_LOCK"
     #error "define INTERNAL_LOCK"
      ^~~~~
    ./sys_defs.h:1336:2: error: #error "define USE_STATFS or USE_STATVFS"
     #error "define USE_STATFS or USE_STATVFS"
      ^~~~~
    In file included from alldig.c:29:0:
    ./sys_defs.h:1347:57: error: unknown type name 'SOCKADDR_SIZE'
     extern const char *inet_ntop(int, const void *, char *, SOCKADDR_SIZE);
                                                             ^~~~~~~~~~~~~
    Makefile:187: recipe for target 'alldig.o' failed
    make: *** [alldig.o] Error 1
    make: Leaving directory '/home/dixit/work/projects/omega2/local_build/source/build_dir/target-mipsel_24kc_musl/postfix-3.3.0/src/util'
    Makefile:92: recipe for target 'update' failed
    make[4]: *** [update] Error 1
    make[4]: Leaving directory '/home/dixit/work/projects/omega2/local_build/source/build_dir/target-mipsel_24kc_musl/postfix-3.3.0'
    Makefile:265: recipe for target '/home/dixit/work/projects/omega2/local_build/source/build_dir/target-mipsel_24kc_musl/postfix-3.3.0/.built' failed
    make[3]: *** [/home/dixit/work/projects/omega2/local_build/source/build_dir/target-mipsel_24kc_musl/postfix-3.3.0/.built] Error 2
    make[3]: Leaving directory '/home/dixit/work/projects/omega2/local_build/source/feeds/packages/mail/postfix'
    Command exited with non-zero status 2
    time: package/feeds/packages/postfix/compile#0.19#0.03#0.38
    package/Makefile:107: recipe for target 'package/feeds/packages/postfix/compile' failed
    make[2]: *** [package/feeds/packages/postfix/compile] Error 2
    make[2]: Leaving directory '/home/dixit/work/projects/omega2/local_build/source'
    package/Makefile:103: recipe for target '/home/dixit/work/projects/omega2/local_build/source/staging_dir/target-mipsel_24kc_musl/stamp/.package_compile' failed
    make[1]: *** [/home/dixit/work/projects/omega2/local_build/source/staging_dir/target-mipsel_24kc_musl/stamp/.package_compile] Error 2
    make[1]: Leaving directory '/home/dixit/work/projects/omega2/local_build/source'
    /home/dixit/work/projects/omega2/local_build/source/include/toplevel.mk:216: recipe for target 'world' failed
    make: *** [world] Error 2
    
    

    Which I think same as https://community.onion.io/topic/4568/docker-build-env-make-issues/6?_=1654410911792
    I followed those/below steps to get rid of the error but when I do that feed update & install, .config.02 gets modified where a lot of packages are removed(Means the =y gets replaced with ' is not set')

    ./scripts/feeds clean
    ./scripts/feeds update -a
    ./scripts/feeds install -a
    sh scripts/onion-feed-setup.sh
    ln -s .config.O2 .config
    make menuconfig
    In "Target System" select "MediaTek Ralink MIPS"
    In "Sub Target" select "MT76x8 based boards"
    In "Target Profile" select "Multiple Devices"
    In "Target Devices" select your Onion Omega model, or models
    
    exit and save
    
    make clean
    make -j4
    

    I believe the solution to this build error has to be something else as well apart from what is provided on that thread.

    Can you please help me get going in this!



  • @dixit it looks like it is having an issue building postfix which is a mail transport agent just remove it from your build. It's not part of the standard Omega2 build.



  • @crispyoz Thanks. removing postfix package resolved the issue. appreciate all the help.


Log in to reply
 

Looks like your connection to Community was lost, please wait while we try to reconnect.