HOW TO CROSSCOMPILE ELINKS AND WGET FOR THE KOBO CLARA HD (using linux desktop).
First, follow the instructions at https://yingtongli.me/blog/2018/07/30/kobo-ssh.html to determine the crosscompile tool for your device. For the Kobo Clara HD, it is gcc-linaro-7.3.1-2018.05-x86_64_arm-linux-gnueabihf.tar.xz.
Download this and source packages for openssl, elinks, and wget to $HOME/Downloads/mykobossh/.
To build OPENSSL:
(see also https://gist.github.com/gardner/ec1146f629301656c73e0904d24ff71e)
cd
cd Downloads/mykobossh/
tar xJf gcc-linaro-7.3.1-2018.05-x86_64_arm-linux-gnueabihf.tar.xz
export PATH=$PWD/gcc-linaro-7.3.1-2018.05-x86_64_arm-linux-gnueabihf/bin:$PATH
tar zxvf openssl-1.1.1s.tar.gz
cd openssl-1.1.1s/
mkdir $HOME/Downloads/mykobossh/templib
./Configure gcc -static -no-shared --prefix=$HOME/Downloads/mykobossh/templib --cross-compile-prefix=arm-linux-gnueabihf-
make
make install
cd ..
To build ELINKS:
(see also http://www.math.bas.bg/algebra/elinks/elinks-0.11.5/doc/html/manual.html-chunked/ch01s05.html)
tar zxvf elinks-0.15.1.tar.gz
cd elinks-0.15.1/
./autogen.sh
./configure --help
./configure --host=arm-linux-gnueabihf --enable-own-libc --enable-sm-scripting --disable-nls --disable-xbel --disable-ipv6 --disable-leds --disable-backtrace --with-static --without-zlib --without-bzlib --without-gnutls --with-openssl=$HOME/Downloads/mykobossh/templib CPPFLAGS="-I$HOME/Downloads/mykobossh/templib/include" LDFLAGS="-L$HOME/Downloads/mykobossh/templib/lib"
make
cp src/elinks ../elinks111s
cd ..
To build WGET:
(see also https://stackoverflow.com/questions/9817337/compiling-wget-with-static-linking-self-compiled-openssl-library-linking-issu)
tar zxvf wget-1.21.tar.gz
cd wget-1.21/
./configure --help
env CPPFLAGS="-I$HOME/Downloads/mykobossh/templib/include" LDFLAGS="-L$HOME/Downloads/mykobossh/templib/lib" ./configure --with-ssl=openssl --with-libssl-prefix=$HOME/Downloads/mykobossh/templib --target=arm-linux-gnueabihf --host=arm-linux-gnueabihf --disable-nls --disable-ipv6 --without-zlib
make CPPFLAGS="-I$HOME/Downloads/mykobossh/templib/include" LDFLAGS="-L/$HOME/Downloads/mykobossh/templib/lib -static"
cp src/wget ../wget111s
DEVICE:
Copy elinks111s and wget111s to .adds/koreader/scripts directory on Kobo Clara HD.
Run KOReader and connect to WIFI on Clara HD.
Open Terminal Emulator and you will see elinks111s and wget111s in working directory (/mnt/onboard/.adds/koreader/scripts).
chmod +x elinks111s
chmod +x wget111s
elinks111s
(enter "mobileread.mobi/forums/")
(keep pressing return key if get ssl error message)
Press Esc key and down arrow key to get menu and key codes
Press q (followed by return key) to quit
wget111s google.com
ls index.html
Here is a more sophisticated use:
***NOTE THE VERY IMPORTANT OPTION '-Q50M' WHICH LIMITS DOWNLOAD TO 50MB !!!***
(this is to keep you from inadvertently "downloading the internet")
wget111s --no-check-certificate --no-parent -k -nd -D www.mobileread.mobi -E -r -A jpg,jpeg,png,gif,htm.html -l1 -Q50M -P ./mywgets/ www.mobileread.mobi/forums/
------
THE NEXT SECTIONS ARE OPTIONAL, IF YOU WANT ASCIIVIEW IMAGE VIEWER.
To build NCURSES:
(see also https://bug-ncurses.gnu.narkive.com/6SQnIUGx/nc-get-table-error-while-cross-compiling-ncurses-5-4-for-arm)
tar zxvf ncurses-6.3.tar.gz
cd ncurses-6.3/
mkdir $HOME/Downloads/mykobossh/curselib
./configure --help
CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++ ./configure --with-static --with-shared --with-cxx-shared --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf --host=i686-pc-linux --without-ada --without-gpm --without-sysmouse --enable-widec --disable-big-core --with-build-cc=gcc --prefix=$HOME/Downloads/mykobossh/curselib
make
make install
copy libncurses.so.6.3 to libncurses.so and libncurses.so.6.
copy libncursesw.so.6.3 to libncursesw.so and libncursesw.so.6.
Copy libs to .adds/koreader/libs directory on Kobo Clara HD.
cd ..
To build AALIB:
tar zxvf aalib-1.4rc4.tar.gz
cd aalib-1.4.0/
mkdir $HOME/Downloads/mykobossh/aalib
./configure --help
CC="arm-linux-gnueabihf-gcc" CPPFLAGS="-I$HOME/Downloads/mykobossh/curselib/include/ncurses" LDFLAGS="-L$HOME/Downloads/mykobossh/curselib/lib" ./configure --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf --with-x11-driver=no --with-slang-driver=no --with-curses-driver=yes --with-ncurses=$HOME/Downloads/mykobossh/curselib --prefix=$HOME/Downloads/mykobossh/aalib
make
make install
Copy aafire, aaflip, aainfo,and aatest to .adds/koreader/scripts directory on Kobo Clara HD.
copy libaa.so.1.0.4 to libaa.so, libaa.so.1, and libaa.so.1.0.
Copy libs to .adds/koreader/libs directory on Kobo Clara HD.
cd ..
To build ASCIIVIEW:
tar zxvf aview-1.3.0rc1.tar.gz
cd aview-1.3.0/
./configure --help
CC="arm-linux-gnueabihf-gcc" CPPFLAGS="-I$HOME/Downloads/mykobossh/curselib/include/ncurses" LDFLAGS="-L$HOME/Downloads/mykobossh/curselib/lib" ./configure --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf --with-aalib-prefix=$HOME/Downloads/mykobossh/aalib
make
Copy aview and asciiview to .adds/koreader/scripts directory on Kobo Clara HD.
cd ..
To extract NETPBM:
From http://archive.debian.org/debian-archive/debian/pool/main/, download and rename extension from .deb to .tgz the following:
/x/xz-utils/liblzma5_5.1.1alpha+20120614-2_armhf.deb
/j/jbigkit/libjbig0_2.1-3.1_armhf.deb
/t/tiff/libtiff5_4.0.3-12.3+deb8u5_armhf.deb
/libp/libpng/libpng12-0_1.2.50-2+deb8u3_armhf.deb
/libj/libjpeg-turbo/libjpeg62-turbo_1.3.1-12_armhf.deb
/z/zlib/zlib1g_1.2.8.dfsg-2+b1_armhf.deb
/n/netpbm-free/libnetpbm10_10.0-15.2_armhf.deb
/n/netpbm-free/netpbm_10.0-15.2_armhf.deb
From the .tgz files, extract the following libs (replacing symlinks with actual copies of the symlinked file as in aalib example) , and copy all libs to .adds/koreader/libs directory on Kobo Clara HD:
libjbig.so.0
libjpeg.so.62, libjpeg.so.62.1.0
liblzma.so.5, liblzma.so.5.0.0
libnetpbm.so.10,libnetpbm.so.10.0
libpng12.so.0, libpng12.so.0.50.0
libtiff.so.5, libtiff.so.5.2.0
libz.so.1, libz.so.1.2.8
From the .tgz files, extract the following bins/scripts , and copy all files to .adds/koreader/scripts directory on Kobo Clara HD:
anytopnm, bmptopnm, giftopnm. jpegtopnm, pngtopnm, pnmtojpeg, pnmtopng, pnmtotiff, tifftopnm
EDIT elinks.conf FILE IN .elinks/ (TO CONFIGURE asciiview AS IMAGE VIEWER):
set mime.extension.jpg="image/jpeg"
set mime.extension.jpeg="image/jpeg"
set mime.extension.png="image/png"
set mime.extension.gif="image/gif"
set mime.extension.bmp="image/bmp"
set mime.extension.pnm="image/pnm"
set mime.handler.image_viewer.unix.ask = 1
set mime.handler.image_viewer.unix-xwin.ask = 0
set mime.handler.image_viewer.unix.block = 1
set mime.handler.image_viewer.unix-xwin.block = 0
set mime.handler.image_viewer.unix.program = "sh /mnt/onboard/.adds/koreader/scripts/asciiview %"
set mime.handler.image_viewer.unix-xwin.program = "sh /mnt/onboard/.adds/koreader/scripts/asciiview %"
set mime.type.image.jpg = "image_viewer"
set mime.type.image.jpeg = "image_viewer"
set mime.type.image.png = "image_viewer"
set mime.type.image.gif = "image_viewer"
set mime.type.image.bmp = "image_viewer"
set mime.type.image.pnm = "image_viewer"
First, follow the instructions at https://yingtongli.me/blog/2018/07/30/kobo-ssh.html to determine the crosscompile tool for your device. For the Kobo Clara HD, it is gcc-linaro-7.3.1-2018.05-x86_64_arm-linux-gnueabihf.tar.xz.
Download this and source packages for openssl, elinks, and wget to $HOME/Downloads/mykobossh/.
To build OPENSSL:
(see also https://gist.github.com/gardner/ec1146f629301656c73e0904d24ff71e)
cd
cd Downloads/mykobossh/
tar xJf gcc-linaro-7.3.1-2018.05-x86_64_arm-linux-gnueabihf.tar.xz
export PATH=$PWD/gcc-linaro-7.3.1-2018.05-x86_64_arm-linux-gnueabihf/bin:$PATH
tar zxvf openssl-1.1.1s.tar.gz
cd openssl-1.1.1s/
mkdir $HOME/Downloads/mykobossh/templib
./Configure gcc -static -no-shared --prefix=$HOME/Downloads/mykobossh/templib --cross-compile-prefix=arm-linux-gnueabihf-
make
make install
cd ..
To build ELINKS:
(see also http://www.math.bas.bg/algebra/elinks/elinks-0.11.5/doc/html/manual.html-chunked/ch01s05.html)
tar zxvf elinks-0.15.1.tar.gz
cd elinks-0.15.1/
./autogen.sh
./configure --help
./configure --host=arm-linux-gnueabihf --enable-own-libc --enable-sm-scripting --disable-nls --disable-xbel --disable-ipv6 --disable-leds --disable-backtrace --with-static --without-zlib --without-bzlib --without-gnutls --with-openssl=$HOME/Downloads/mykobossh/templib CPPFLAGS="-I$HOME/Downloads/mykobossh/templib/include" LDFLAGS="-L$HOME/Downloads/mykobossh/templib/lib"
make
cp src/elinks ../elinks111s
cd ..
To build WGET:
(see also https://stackoverflow.com/questions/9817337/compiling-wget-with-static-linking-self-compiled-openssl-library-linking-issu)
tar zxvf wget-1.21.tar.gz
cd wget-1.21/
./configure --help
env CPPFLAGS="-I$HOME/Downloads/mykobossh/templib/include" LDFLAGS="-L$HOME/Downloads/mykobossh/templib/lib" ./configure --with-ssl=openssl --with-libssl-prefix=$HOME/Downloads/mykobossh/templib --target=arm-linux-gnueabihf --host=arm-linux-gnueabihf --disable-nls --disable-ipv6 --without-zlib
make CPPFLAGS="-I$HOME/Downloads/mykobossh/templib/include" LDFLAGS="-L/$HOME/Downloads/mykobossh/templib/lib -static"
cp src/wget ../wget111s
DEVICE:
Copy elinks111s and wget111s to .adds/koreader/scripts directory on Kobo Clara HD.
Run KOReader and connect to WIFI on Clara HD.
Open Terminal Emulator and you will see elinks111s and wget111s in working directory (/mnt/onboard/.adds/koreader/scripts).
chmod +x elinks111s
chmod +x wget111s
elinks111s
(enter "mobileread.mobi/forums/")
(keep pressing return key if get ssl error message)
Press Esc key and down arrow key to get menu and key codes
Press q (followed by return key) to quit
wget111s google.com
ls index.html
Here is a more sophisticated use:
***NOTE THE VERY IMPORTANT OPTION '-Q50M' WHICH LIMITS DOWNLOAD TO 50MB !!!***
(this is to keep you from inadvertently "downloading the internet")
wget111s --no-check-certificate --no-parent -k -nd -D www.mobileread.mobi -E -r -A jpg,jpeg,png,gif,htm.html -l1 -Q50M -P ./mywgets/ www.mobileread.mobi/forums/
------
THE NEXT SECTIONS ARE OPTIONAL, IF YOU WANT ASCIIVIEW IMAGE VIEWER.
To build NCURSES:
(see also https://bug-ncurses.gnu.narkive.com/6SQnIUGx/nc-get-table-error-while-cross-compiling-ncurses-5-4-for-arm)
tar zxvf ncurses-6.3.tar.gz
cd ncurses-6.3/
mkdir $HOME/Downloads/mykobossh/curselib
./configure --help
CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++ ./configure --with-static --with-shared --with-cxx-shared --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf --host=i686-pc-linux --without-ada --without-gpm --without-sysmouse --enable-widec --disable-big-core --with-build-cc=gcc --prefix=$HOME/Downloads/mykobossh/curselib
make
make install
copy libncurses.so.6.3 to libncurses.so and libncurses.so.6.
copy libncursesw.so.6.3 to libncursesw.so and libncursesw.so.6.
Copy libs to .adds/koreader/libs directory on Kobo Clara HD.
cd ..
To build AALIB:
tar zxvf aalib-1.4rc4.tar.gz
cd aalib-1.4.0/
mkdir $HOME/Downloads/mykobossh/aalib
./configure --help
CC="arm-linux-gnueabihf-gcc" CPPFLAGS="-I$HOME/Downloads/mykobossh/curselib/include/ncurses" LDFLAGS="-L$HOME/Downloads/mykobossh/curselib/lib" ./configure --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf --with-x11-driver=no --with-slang-driver=no --with-curses-driver=yes --with-ncurses=$HOME/Downloads/mykobossh/curselib --prefix=$HOME/Downloads/mykobossh/aalib
make
make install
Copy aafire, aaflip, aainfo,and aatest to .adds/koreader/scripts directory on Kobo Clara HD.
copy libaa.so.1.0.4 to libaa.so, libaa.so.1, and libaa.so.1.0.
Copy libs to .adds/koreader/libs directory on Kobo Clara HD.
cd ..
To build ASCIIVIEW:
tar zxvf aview-1.3.0rc1.tar.gz
cd aview-1.3.0/
./configure --help
CC="arm-linux-gnueabihf-gcc" CPPFLAGS="-I$HOME/Downloads/mykobossh/curselib/include/ncurses" LDFLAGS="-L$HOME/Downloads/mykobossh/curselib/lib" ./configure --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf --with-aalib-prefix=$HOME/Downloads/mykobossh/aalib
make
Copy aview and asciiview to .adds/koreader/scripts directory on Kobo Clara HD.
cd ..
To extract NETPBM:
From http://archive.debian.org/debian-archive/debian/pool/main/, download and rename extension from .deb to .tgz the following:
/x/xz-utils/liblzma5_5.1.1alpha+20120614-2_armhf.deb
/j/jbigkit/libjbig0_2.1-3.1_armhf.deb
/t/tiff/libtiff5_4.0.3-12.3+deb8u5_armhf.deb
/libp/libpng/libpng12-0_1.2.50-2+deb8u3_armhf.deb
/libj/libjpeg-turbo/libjpeg62-turbo_1.3.1-12_armhf.deb
/z/zlib/zlib1g_1.2.8.dfsg-2+b1_armhf.deb
/n/netpbm-free/libnetpbm10_10.0-15.2_armhf.deb
/n/netpbm-free/netpbm_10.0-15.2_armhf.deb
From the .tgz files, extract the following libs (replacing symlinks with actual copies of the symlinked file as in aalib example) , and copy all libs to .adds/koreader/libs directory on Kobo Clara HD:
libjbig.so.0
libjpeg.so.62, libjpeg.so.62.1.0
liblzma.so.5, liblzma.so.5.0.0
libnetpbm.so.10,libnetpbm.so.10.0
libpng12.so.0, libpng12.so.0.50.0
libtiff.so.5, libtiff.so.5.2.0
libz.so.1, libz.so.1.2.8
From the .tgz files, extract the following bins/scripts , and copy all files to .adds/koreader/scripts directory on Kobo Clara HD:
anytopnm, bmptopnm, giftopnm. jpegtopnm, pngtopnm, pnmtojpeg, pnmtopng, pnmtotiff, tifftopnm
EDIT elinks.conf FILE IN .elinks/ (TO CONFIGURE asciiview AS IMAGE VIEWER):
set mime.extension.jpg="image/jpeg"
set mime.extension.jpeg="image/jpeg"
set mime.extension.png="image/png"
set mime.extension.gif="image/gif"
set mime.extension.bmp="image/bmp"
set mime.extension.pnm="image/pnm"
set mime.handler.image_viewer.unix.ask = 1
set mime.handler.image_viewer.unix-xwin.ask = 0
set mime.handler.image_viewer.unix.block = 1
set mime.handler.image_viewer.unix-xwin.block = 0
set mime.handler.image_viewer.unix.program = "sh /mnt/onboard/.adds/koreader/scripts/asciiview %"
set mime.handler.image_viewer.unix-xwin.program = "sh /mnt/onboard/.adds/koreader/scripts/asciiview %"
set mime.type.image.jpg = "image_viewer"
set mime.type.image.jpeg = "image_viewer"
set mime.type.image.png = "image_viewer"
set mime.type.image.gif = "image_viewer"
set mime.type.image.bmp = "image_viewer"
set mime.type.image.pnm = "image_viewer"