Page 1 of 1

Compile application for AS1002T

PostPosted: Sun Apr 25, 2021 11:58 pm
by sandro_rocha
Hello. I would like to know how to compile a program for the AS1002T, create the apk so that it can be installed on the NAS. I am in need of native versions of certain applications (Sonarr, Radarr, Bazarr, Jackett). Some have Docker versions in the store and you can install them via Docker but the Docker for my NAS (AS1002T) is not reliable and weighs heavily on the hardware. I looked at the pdf available in the development guide but it is all very confusing. I have already compiled some programs on Linux but the Asustor encapsulation system was not clear to me. Is it possible to compile the programs already with the necessary libraries and create the apk? I need help with that.

Re: Compile application for AS1002T

PostPosted: Mon Apr 26, 2021 3:34 pm
by father.mande
Hi,

You have multiple solutions ... (apkg creation is aftr the compile part)
1) use the cross-compile tools provide by Asustor (available in dev. corner web site)
... for : 100% compatible with NAS libraries and tools
... cons. : use old library (as A.D.M.) , add difficulty to cross-compile, need a complete management by user
2) use Entware (based on Openwrt) and follow documentation (how add a package)
... for : use new library (2.27) don't impact directly A.D.M. delivery, you can include start and stop WITHOUT the need to write an APKG
... cons. : local gcc, include are sometimes limited
3) use a chroot of a modern Linux (ex. Ubuntu 20.04 L.T.S.) ... build in minutes ... an easy +++ solution
... for : perhaps no need to compile ... package (ppa) can exist. Update is include and library maintains up to date (apt management tool for Ubuntu), possibility to limit access to the full NAS to prevent any access not approved.
... Cons. : ... hum! nothing, except to remember to solve miss formed kernel number (4.14.x .. so x is not accepted by some libraries and tools) workaround exist and is easy BUT 4.14.x is for x86 series
4) chroot in namespace (+ cgroup for resource management) ... it's like a container ... idem but with a more separate things like mount, ipc, etc. ... T.B.C. is possible vs. Kernel version
... idem as previous chroot but for expert possibility to go up to start systemd ... so nearest possibility for native program to a V.M. BUT complex +++
Docker can be used ... but you LOST the hands on some parts, you are dependent of the provider and NO security if for ex. cryptomining is included or malware to add bad in some file used externally to the docker
container)

APKG is easy to build, a documentation is available in "dev. corner" web site with example ... and ANY APKG installed is a good source of possibilities and configuration.

Philippe

Re: Compile application for AS1002T

PostPosted: Tue Apr 27, 2021 6:27 am
by sandro_rocha
father.mande wrote:Hi,

You have multiple solutions ... (apkg creation is aftr the compile part)
1) use the cross-compile tools provide by Asustor (available in dev. corner web site)
... for : 100% compatible with NAS libraries and tools
... cons. : use old library (as A.D.M.) , add difficulty to cross-compile, need a complete management by user
2) use Entware (based on Openwrt) and follow documentation (how add a package)
... for : use new library (2.27) don't impact directly A.D.M. delivery, you can include start and stop WITHOUT the need to write an APKG
... cons. : local gcc, include are sometimes limited
3) use a chroot of a modern Linux (ex. Ubuntu 20.04 L.T.S.) ... build in minutes ... an easy +++ solution
... for : perhaps no need to compile ... package (ppa) can exist. Update is include and library maintains up to date (apt management tool for Ubuntu), possibility to limit access to the full NAS to prevent any access not approved.
... Cons. : ... hum! nothing, except to remember to solve miss formed kernel number (4.14.x .. so x is not accepted by some libraries and tools) workaround exist and is easy BUT 4.14.x is for x86 series
4) chroot in namespace (+ cgroup for resource management) ... it's like a container ... idem but with a more separate things like mount, ipc, etc. ... T.B.C. is possible vs. Kernel version
... idem as previous chroot but for expert possibility to go up to start systemd ... so nearest possibility for native program to a V.M. BUT complex +++
Docker can be used ... but you LOST the hands on some parts, you are dependent of the provider and NO security if for ex. cryptomining is included or malware to add bad in some file used externally to the docker
container)

APKG is easy to build, a documentation is available in "dev. corner" web site with example ... and ANY APKG installed is a good source of possibilities and configuration.

Philippe

Although I have already compiled some programs on Linux, I am not knowledgeable about the system enough to try options 1 and 2 and option 4 seems confusing. However I was interested in option 3. Would it be like installing the Ubuntu package manager on Asustor? It is possible? If you can do it with apt or something, it would be of great help. How can I do this?

Re: Compile application for AS1002T

PostPosted: Tue Apr 27, 2021 4:35 pm
by father.mande
Hi,
sandro_rocha wrote:Although I have already compiled some programs on Linux, I am not knowledgeable about the system enough to try options 1 and 2 and option 4 seems confusing. However I was interested in option 3. Would it be like installing the Ubuntu package manager on Asustor? It is possible? If you can do it with apt or something, it would be of great help. How can I do this?


Hum! I don't have time to do an How-to ... but APKG using this exist, so can be used as an example
The process is :
1 using Entware or any Linux Debian/Ubuntu system (V.M., real, etc.) generate with debootstrap an Ubuntu environment (foreign with second-stage) for your CPU architecture (x86, x86_64, armhf, aarxh64 (arm64)) ... armhf for AS1002T
2 save it and transfer to the NAS then extract (if you use zip or gzip or ... ) ... and do debootstrap second-stage if require
3 create a short script to mount the minimum points require (/dev /dev/pts /sys /proc AND eventually shm and a shared resource used by A.D.M. to facilitate exchange between chroot and A.D.M.)
4 copy network env in etc of chroot (hostname, resolv.conf) ... chroot use same I.P. as A.D.M. and same ports list (so take care of already used port)
5 update the sources.list (source for Ubuntu package) if needed (get it on the Web or from a real Ubuntu system)
6 enter in the chroot and do what you want using apt, apt-get, apt-cache, etc. add also add-apt-repository in "software-properties-common" package (for external ppa)
7 integrate WHEN ALL WORKS ... in an APKG or using any autorun mechanism.

Philippe.