Entware [SOLUTION] Cross-Compile OnionShare Entware Package via Debian Live DVD

garycnew

Regular Contributor
NOTE: After finally being convinced by the Entware & OpenWRT Developers that neither Build Environment was meant to be Compiled Natively on a Router (Neutered C Libraries), I decided to pursue this Cross-Compile OnionShare Entware Package via Debian Live DVD solution; which, is presumably a bit slower, but ultimately successful. It wasn't too terrible after finding the right cross-compiling platform and combining a few different build references.

Requirements/Assumptions:

Cross-Compiling Host Machine:
1. Plenty of Physical Memory (RAM)
2. Debian Live (Testing) DVD
3. Flash Drive >= 32GB (Preferably USB 3.0/3.1)

OnionShare Installation Machine:
1. An Asuswrt-Merlin Compatible Router (i.e., Asus RT-AC66U)
2. Asuswrt-Merlin Compatible Firmware (i.e., 384.19)
3. Formated JFFS Partition and Enabled JFFS Custom Scripts and Configs
4. Entware installed on USB 3.0 Interface Device via Asuswrt-Merlin Terminal Menu (AMTM) with Swap File created

NOTE: Not sure if it matters... At the time of this writing, Debian Bullseye (Testing) Live DVD contained the same package versions as the current Entware repository, opposed to the Debian Buster (Stable) Live DVD, so we opted to use the Debian Bullseye (Testing) Live DVD.

### Download & Burn Debian Live (Testing) DVD ###
Code:
$ curl -L -O -C - http://cdimage.debian.org/cdimage/unofficial/non-free/cd-including-firmware/weekly-live-builds/amd64/iso-hybrid/debian-live-testing-amd64-gnome+nonfree.iso

### Boot Debian Live (Testing) DVD on the Cross-Compiling Host Machine ###
Our Cross-Compiling Host Machine required the [F12] key to be pressed during boot to enter into the Boot Menu and select the Debian Live (Testing) DVD. Make sure you setup and have Internet access on the Cross-Compiling Host Machine.

### Open Terminal ###

### Mount Flash Drive (Repeat after each DVD Boot) ###
Code:
$ mount /dev/sdb1 /media/user/SanDiskSDCZ
$ cd /media/user/SanDiskSDCZ/

### Download & Install Build System (Repeat after each DVD Boot) ###
Code:
$ sudo apt-get update
$ sudo apt-get install git-core build-essential libssl-dev libncurses5-dev unzip gawk zlib1g-dev
$ sudo apt-get install python2 wget

### Clone, Setup, & Make Entware Build Env ###
Code:
$ git clone https://github.com/Entware/Entware.git
$ cd Entware

# Update OpenWRT Feeds
$ ./scripts/feeds update -a

# Symlink Packages (Repeat after each DVD Boot)
$ make package/symlinks

# Copy the config specific to your Architecture and Kernel versions
$ cp configs/armv7-2.6.config .config

$ make tools/install && make toolchain/install && make target/compile
or
#$ make -j1 V=sc tools/install
#$ make -j1 V=sc toolchain/install
#$ make -j1 V=sc target/compile

### Download, Prepare, & Compile Test Package from OpenWRT Feed ###
Code:
#$ ./scripts/feeds install screen
or
$ make -j1 V=sc package/screen/download
$ make -j1 V=sc package/screen/check
$ find package/ -iname "*screen*"
package/feeds/packages/screen

$ make -j1 V=sc package/screen/prepare
$ make -j1 V=sc package/screen/compile
#$ make -j1 V=sc package/screen/install
#$ make package/index

$ find bin/ -iname "*screen*"
bin/targets/armv7-2.6/generic-glibc/packages/screen_4.8.0-2_armv7-2.6.ipk

### Download & Prepare OpenWRT Feed Package modified for Entware (When Available) ###
Code:
#$ ./scripts/feeds install onionshare-cli
or
$ make -j1 V=sc package/feeds/packages/onionshare-cli/download
$ make -j1 V=sc package/feeds/packages/onionshare-cli/check
$ find package/ -iname "*onionshare-cli*"
package/feeds/packages/onionshare-cli

### It is unnecessary to edit the Makefile as Entware & PYPI take care of the configuration for us ###

### Select onionshare-cli for [M]odular inclusion under the SECTION => CATEGORY => SUBMENU of menuconfig ###
Code:
$ make menuconfig
define Package/onionshare-cli
  SECTION:=net
  CATEGORY:=Network
  TITLE:=Secure chat, web and file sharing
  URL:=https://onionshare.org/
  DEPENDS:= +python3-light +python3-psutil +python3-click +python3-flask +python3-flask-httpauth +python3-flask-socketio +python3-pysocks +python3-requests +python3-stem +python3-eventlet +python3-unidecode +python3-cryptodome +python3-urllib3 +tor
endef

### Compile OpenWRT Feed Package modified for Entware ###
Code:
$ make -j1 V=sc package/feeds/packages/onionshare-cli/prepare
$ make -j1 V=sc package/feeds/packages/onionshare-cli/compile
#$ make -j1 V=sc package/feeds/packages/onionshare-cli/install
#$ make package/index

$ find bin/ -iname "*onionshare-cli*"
bin/targets/armv7-2.6/generic-glibc/packages/onionshare-cli_2.3.1-1_armv7-2.6.ipk

### SFTP & SSH OnionShare Packages & Dependencies to the Installation Machine(s) ###
Code:
$ cd bin/targets/armv7-2.6/generic-glibc/packages/
$ ls
onionshare-cli_2.3.1-1_armv7-2.6.ipk
python3-bidict_0.21.2-1_armv7-2.6.ipk
python3-click_7.1.2-1_armv7-2.6.ipk
python3-dns_1.16.0-2_armv7-2.6.ipk
python3-engineio_4.0.1-1_armv7-2.6.ipk
python3-eventlet_0.30.2-1_armv7-2.6.ipk
python3-flask-httpauth_4.2.0-1_armv7-2.6.ipk
python3-flask-socketio_5.0.1-1_armv7-2.6.ipk
python3-flask_1.1.2-1_armv7-2.6.ipk
python3-greenlet_1.0.0-2_armv7-2.6.ipk
python3-itsdangerous_1.1.0-3_armv7-2.6.ipk
python3-jinja2_2.11.2-1_armv7-2.6.ipk
python3-pysocks_1.7.1-1_armv7-2.6.ipk
python3-socketio_5.1.0-1_armv7-2.6.ipk
python3-unidecode_1.1.1-2_armv7-2.6.ipk
python3-werkzeug_1.0.1-1_armv7-2.6.ipk
$ sftp [email protected]
sftp> cd /tmp/mnt/SanDiskSDHC/onionshare-cli/
sftp> put onionshare-cli_2.3.1-1_armv7-2.6.ipk

$ ssh [email protected]
# cd /tmp/mnt/SanDiskSDHC/
# opkg install ./onionshare-cli/*

# opkg list-installed|grep -i onion
onionshare-cli - 2.3.1-1
python3-onionbalance - 0.2.1-1

# opkg files onionshare-cli
Package onionshare-cli (2.3.1-1) is installed on root and has the following files:
/opt/lib/python3.9/site-packages/onionshare_cli/resources/torrc_template-meek_lite_amazon
/opt/lib/python3.9/site-packages/onionshare_cli/onion.pyc
/opt/lib/python3.9/site-packages/onionshare_cli/resources/static/css/style.css
/opt/lib/python3.9/site-packages/onionshare_cli-2.3.1-py3.9.egg-info/PKG-INFO
/opt/lib/python3.9/site-packages/onionshare_cli/resources/templates/chat.html
/opt/lib/python3.9/site-packages/onionshare_cli/resources/static/js/jquery-3.5.1.min.js
/opt/lib/python3.9/site-packages/onionshare_cli/resources/templates/listing.html
/opt/lib/python3.9/site-packages/onionshare_cli/resources/static/img/logo.png
/opt/lib/python3.9/site-packages/onionshare_cli/resources/static/js/send.js
/opt/lib/python3.9/site-packages/onionshare_cli/common.pyc
/opt/lib/python3.9/site-packages/onionshare_cli/onionshare.pyc

# opkg info onionshare-cli
Package: onionshare-cli
Version: 2.3.1-1
Depends: libc, libssp, librt, libpthread, python3-light, python3-psutil, python3-click, python3-flask, python3-flask-httpauth, python3-flask-socketio, python3-pysocks, python3-requests, python3-stem, python3-eventlet, python3-unidecode, python3-cryptodome, python3-urllib3, tor
Status: install user installed
Architecture: armv7-2.6
Installed-Time: 1625135442

# /opt/bin/onionshare-cli -h
OnionShare 2.3.1 | https://onionshare.org/

### (Optional) Remove OnionShare & Dependencies ###
Code:
# opkg remove onionshare-cli python3-unidecode python3-pysocks python3-psutil python3-eventlet python3-greenlet python3-requests python3-certifi python3-urllib3 python3-chardet python3-flask-socketio python3-socketio python3-engineio python3-bidict python3-idna python3-cryptodome python3-flask-httpauth python3-flask python3-werkzeug python3-jinja2 python3-markupsafe python3-itsdangerous python3-click python3-dns

Congratulations! You've Cross-Compiled an OnionShare Entware Package via Debian Live (Testing) DVD! The Possibilities are Endless with Good-Times Ahead!

References:
Code:
http://bin.entware.net/armv7sf-k2.6/
http://cdimage.debian.org/cdimage/unofficial/non-free/cd-including-firmware/weekly-live-builds/amd64/iso-hybrid/
https://packages.debian.org/search?keywords=search
https://oldwiki.archive.openwrt.org/about/toolchain
https://oldwiki.archive.openwrt.org/doc/howto/buildroot.exigence
https://oldwiki.archive.openwrt.org/doc/howto/build.a.package
https://github.com/Entware/Entware/wiki/How-to-add-a-new-package
https://github.com/Entware/Entware-ng/wiki/Using-gcc-%28native-compilation%29
https://onionshare.org/
https://github.com/micahflee/onionshare
 
Last edited:

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top