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

installing an ipk package and incompatible with the architecture error



  • @optech
    "a custom build openwrt firmware 19.07 ..Is that can be the reason"
    May be..

    You could flash the omega2 with onion build and try. I have provided my onion os version; any recent version should work.

    "/opt/chirpstack-gateway-bridge/chirpstack-gateway-bridge" is the only "arch dependent" (binary) file in the ipk.

    $ file build/chirpstack-gateway-bridge
    build/chirpstack-gateway-bridge: ELF 32-bit LSB executable, MIPS, MIPS32 version 1 (SYSV), statically linked, Go BuildID=0A8....

    You can also try running it from command prompt using the options that "/etc/init.d/chirpstack-gateway-bridge" script uses with "start" parameter.

    ("/etc/chirpstack-gateway-bridge/chirpstack-gateway-bridge.toml" contains the settings, it seems)

    Thank you.



  • @tjoseph1 thank you very much for your help.
    I loaded onion build firmware and tried it again then it works. šŸ™‚

    But it doesn't work on openwrt 19.07 custom build.. I really wonder what would be the reason of this issue?

    Here is the build which chirpstack gateway bridge doesnt work on..:
    https://drive.google.com/file/d/1i5PeBWMF-9kke3xLXnlwJIylrfxVHWhm/view?usp=sharing



  • @optech
    Can you pls replace the /opt/chirpstack-gateway-bridge/chirpstack-gateway-bridge in your openwrt 19.07 with this file:
    https://disk.yandex.com/d/C_6-fmcDtqXIGA and then try running it?

    It is a zip file, that unzips to "chirpstack-gateway-bridge" exe.

    Thank you.



  • @tjoseph1 Thank you for your help. I was on a vacation sorry for late...

    I replaced "/opt/chirpstack-gateway-bridge/chirpstack-gateway-bridge" with the file that you sent. But result is same, dont work and so no ram change(on openwrt 19.07)..
    Do you have another idea to find the reason of this issue?



  • I recompiled chirpstack gateway bridge as following the steps below:

    export GOARCH=mipsle
    export GOOS=linux
    make build
    
    root@OpenWrt:~# file /opt/chirpstack-gateway-bridge/chirpstack-gateway-bridge
    
    /opt/chirpstack-gateway-bridge/chirpstack-gateway-bridge: ELF 32-bit LSB executable, MIPS, MIPS32 version 1 (SYSV), statically linked, Go BuildID=VcvuifmDnNysO-WpZUz5/FGFca5Lt5vpptRtlLTBo/l2QuqgekGwKVygyjsXAL/6lmuYGmDGU2RDGrxxamU, stripped
    

    The result is the same doesn't work on openwrt 19.07...



  • @optech
    Ok. Let us start simple.
    Are you able to cross-compile the "hello_world.go" and run it in the 19.07 Omega2 with GOARCH,GOOS parameters set as above ?

    package main
    import "fmt"
    func main() {
    fmt.Println("Hello, World!")
    }

    If not, you may want to try GOMIPS=softfloat or some other options in addition to those two. Once that thing prints \"Hello, World!\", try the same options to build chirpstack-gateway-bridge.

    Thanks.



  • @tjoseph1 Thank you again for your help.

    I compiled the hello world go app as following...:

    export GOARCH=mipsle
    export GOOS=linux
    export GOMIPS=softfloat
    go build hello.go
    

    if i dont use "GOMIPS=softfloat", it works on openWRT 18.06 but dont work on openWRT 19.07 as giving following error:

    root@OpenWrt:~# ./hello
    Illegal instruction
    

    with "GOMIPS=softfloat" option, it works on openWRT 19.07..

    But after seeing that, i compiled chirpstack-gateway-bridge app with same options. But it still doesnt work on openWRT 19.07 šŸ˜ž

    chirpstack-gateway-bridge$ export GOARCH=mipsle
    chirpstack-gateway-bridge$ export GOOS=linux
    chirpstack-gateway-bridge$ export GOMIPS=softfloat
    chirpstack-gateway-bridge$ make build
    

    i feel near to solution but i have no idea for now.



  • @optech by the way, i first setup the chirpstack-gateway-bridge ipk file which you sent before, then i replace the exe in opt/chirpstack-gateway-bridge with i compiled. then it didnt work on openwrt 19.07



  • @optech Have you checked that the make file is not redefining those exports?



  • This post is deleted!


  • @optech

    In the Makefile, the "build" option has parameters:
    <<<
    .PHONY: build clean test package serve run-compose-test
    VERSION := $(shell git describe --always |sed -e "s/^v//")

    build:
    @echo "Compiling source"
    @mkdir -p build
    GOOS=linux GOARCH=mipsle GOMIPS=softfloat go build $(GO_EXTRA_BUILD_ARGS) -ldflags "-s -w -X main.version=$(VERSION)" -o build/chirpstack-gateway-bridge cmd/chirpstack-gateway-bridge/main.go
    <<<

    Is that how you compile?

    Try running the "chirpstack .." exe from Omega2's command line with -h or --help option under stock 19.07.
    If that runs, then try running the exe under the custom build.

    Thanks.



  • @tjoseph1 @crispyoz

    When I check makefile i see:

    .PHONY: build clean test package serve run-compose-test
    VERSION := $(shell git describe --always |sed -e "s/^v//")
    
    build:
    	@echo "Compiling source"
    	@mkdir -p build
    	go build $(GO_EXTRA_BUILD_ARGS) -ldflags "-s -w -X main.version=$(VERSION)" -o build/chirpstack-gateway-bridge cmd/chirpstack-gateway-bridge/main.go
    

    so makefile has no redefining options for "GOOS=linux GOARCH=mipsle GOMIPS=softfloat".

    when i tried stock omega 19.07 binary, it was didnt work. but after you told me about softfloat option, i tried to change some options while custom compilation of openwrt by make menuconfig. I set softfloat by default from advanced compile options and i set MIPS FPU emulator enable. after making this custom binary for openwrt, even the first chirpstack-gateway-bridge exe, that you sent me before, works well in my custom openwrt compilation šŸ™‚ I guess this way is ok, right? can i will have side effects of it for future with another app? šŸ™‚ Thank you for your all support šŸ™‚

    But i couldnt find how i can make ipk file after chirpstack-gateway-bridge compilation.. Could you inform me about it how i make ipk packages?



  • @optech If you have set chirpstack in make menuconfig to M the ipk will be in <source>/staging_dir/packages/ramips

    I would be interested to know if transferring the package to your earlier 19 system gives you the same error as I suspect this may be an issue related to the included libs.



  • @crispyoz

    There is no chirpstack option in "make menuconfig" in openwrt, maybe i couldnt see šŸ™‚

    i think go lang uses mips float point but i guess there is no hardware fpu in MT7688, so instructions doesnt work when go compile with default GOMIPS option. Then when i make chances on make menuconfig about float point options while compiling custom openwrt, it will be ok even go uses float point option.. What do you think about this explanation?



  • i compiled chirpstack-packet-multiplexer application. But i couldnt make ipk file. So i duplicated chirpstack-gateway-bridge files on working system, then i replaced with chirpstack-packet-multiplexer files šŸ™‚ and edited init.d script šŸ™‚

    Could you inform me about how can i make ipk packages after compilation of an application?



  • @optech ok sorry I thought you had added the package to menuconfig and were compiling that way. I haven't been following closely as @tjoseph1 has been doing a lot to help out.

    Making an ipk is not well documented, well not that I found when I was trying to learn how to manually make them. So I made a script to create the ipk for my custom package I build outside of the build system. I need to clean out some proprietary stuff out of my script then I will post it here in a short time.



  • @crispyoz thank you very much. i am looking forward your packaging script...



  • #!/bin/sh

    File: make_ipk.sh

    Author: Chris

    Created on 22 September 2019, 01:40:00

    while getopts "v:d:" opt;
    do
    case "${opt}" in
    v) version=${OPTARG};;
    d) directory=${OPTARG};;
    esac
    done

    if [ -z "$version" ]
    then
    echo "Version not set, use parameter -v <version>"
    exit 1;
    fi

    if [ -z "$directory" ]
    then
    echo "Output path for ipk not set, use parameter -d <path>"
    exit 1;
    fi

    mkdir $directory
    cd $directory
    mkdir -p usr/sbin
    mkdir -p etc/myapp/scripts
    mkdir -p etc/myapp/certs
    mkdir -p etc/opkg

    cp -rf /home/chris/NetBeansProjects/MyApp/dist/Release/GNU_OpenWRT-Linux/myappd usr/sbin/
    cp -rf /home/chris/source/files/www www
    cp -rf /home/chris/source/files/etc/myapp/site etc/myapp
    cp -rf /home/chris/source/files/etc/myapp/scripts etc/myapp
    cp -rf /home/chris/source/files/etc/myapp/certs etc/myapp
    cp -rf /home/chris/source/files/etc/myapp/crontab-input etc/myapp

    #cp /home/chris/update_feeds.sh etc/myapp/scripts

    copy certificates

    #cp /home/chris/source/files/etc/myapp/certs/ca.crt etc/myapp/certs
    #cp /home/chris/source/files/etc/myapp/certs/client.crt etc/myapp/certs
    #cp /home/chris/source/files/etc/myapp/certs/client.key etc/myapp/certs

    mkdir CONTROL

    echo "Package: myapp" >> CONTROL/control
    echo "Version: $version" >> CONTROL/control
    echo "Description: MyApp" >> CONTROL/control
    echo "Section: extras" >> CONTROL/control
    echo "Priority: optional" >> CONTROL/control
    echo "Maintainer: admin@myapp.com" >> CONTROL/control
    echo "License: CLOSED" >> CONTROL/control
    echo "Architecture: mipsel_24kc" >> CONTROL/control
    echo "OE: myappd" >> CONTROL/control
    echo "Homepage: www.myapp.com" >> CONTROL/control
    echo "Depends: libc, libuci, libubus, libubox, libsqlite3, libgcrypt, libgnutls" >> CONTROL/control

    echo "#!/bin/sh" >> CONTROL/preinst
    echo "#Add your scripts here" >> CONTROL/preinst
    echo "" >> CONTROL/preinst

    chmod +x CONTROL/preinst

    echo "#!/bin/sh" >> CONTROL/postinst
    echo "#Add your scripts here" >> CONTROL/postinst
    echo "cwv=$(/usr/sbin/myappd -n)" >> CONTROL/postinst
    echo "" >> CONTROL/postinst
    echo "uci set myapp.@main[0].version=$cwv" >> CONTROL/postinst
    echo "uci set myapp.@main[0].version=$(myappd -n)" >> CONTROL/postinst
    echo "ls=$(uci get myapp.@license[0].data_collection)" >> CONTROL/postinst
    echo "uci commit myapp" >> CONTROL/postinst
    echo "crontab /etc/myapp/crontab-input" >> CONTROL/postinst
    echo "rm /etc/myapp/crontab-input" >> CONTROL/postinst
    echo "/etc/init.d/cron restart" >> CONTROL/postinst
    echo "" >> CONTROL/postinst

    echo "/etc/myapp/scripts/update_banner.sh" >> CONTROL/postinst
    #echo "/etc/myapp/scripts/update_feeds.sh" >> CONTROL/postinst
    echo "/etc/init.d/myappd restart" >> CONTROL/postinst

    chmod +x CONTROL/postinst

    echo "#!/bin/sh" >> CONTROL/prerm
    echo "#Add your scripts here" >> CONTROL/prerm
    echo "" >> CONTROL/prerm
    chmod +x CONTROL/prerm

    echo "#!/bin/sh" >> CONTROL/postrm
    echo "#Add your scripts here" >> CONTROL/postrm
    echo "" >> CONTROL/postrm
    chmod +x CONTROL/postrm

    ~/source/scripts/ipkg-build ./

    Now we can create the repository files

    #*********************************************************************************************************
    export PATH="$PATH:/home/chris/source/staging_dir/host/bin"
    echo "MyApp repository: private key XXXXXXXXXXXXX" >> myapp.key
    echo "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" >> myapp.key
    #**********************************************************************************************************

    mkdir repo
    mv *.ipk repo
    cd repo
    ~/source/scripts/ipkg-make-index.sh . 2>/dev/null > Packages.manifest
    grep -vE '^(Maintainer|LicenseFiles|Source|Require)' Packages.manifest > Packages
    gzip -9nc Packages > Packages.gz
    usign -S -m Packages -s ../myapp.key

    rm Packages
    rm Packages.manifest
    rm ../myapp.key



  • @optech 2 points to note.

    1. The script uses the build system scripts to create the final package, this script just makes it easy for me to copy the required files into the correct directory structure. You can see towards the end of the scripts ~/source/scripts/ipkg-build and ~/source/scripts/ipkg-make-index.sh

    2. You need to sign your packages, so if you look at the section towards the end with ********************* this I have masked out my public and private keys. You need to create these using usign package. You can install usign like so:

    git clone https://git.openwrt.org/project/usign.git
    cd usign
    cmake .
    make
    sudo make install

    Then use usign to create your keys. I'll leave you to look at that.



  • @crispyoz even simplifying script looks complex šŸ™‚ thanks again i will try to use it šŸ™‚



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