yashsingh1/xdaforums huggingface dataset:
[Android Software Development] misterhsp:
cryptsetup-static 2.7.2 (aarch64)
[Android Software Development] bibikalka:
Any chance to create these binaries for armv7 specifically? Need to use this on an older device that seems to have flash memory issues.
[Android Software Development] DualJoe:
Can't remember anymore but i guess there is no kernel 4.4 for armv7.
[Android Software Development] bibikalka:
Actually, here is what I got for this device:

Linux localhost 4.4.120+ #1 SMP PREEMPT Wed Sep 30 06:01:13 UTC 2020 armv7l

So 4.4 should work fine here!
[Android Software Development] DualJoe:
What ROM is it?
[Android Software Development] bibikalka:
This is Amazon Fire 4K 1st gen (mantis). I am actually doing this under TWRP, but the main kernel is also 4.4.

mantis:/data/local/tmp # uname -a
Linux localhost 4.4.120+ #1 SMP PREEMPT Sun Dec 12 12:21:22 EET 2021 armv7l

TWRP is from here:

[UNLOCK][ROOT][TWRP][UNBRICK] Fire TV Stick 4K (mantis)

NOTE: There have been multiple reports of devices with serial numbers containing VM190 or higher being shipped with DL-Mode disabled in BROM. These devices cannot be unlocked using kamakiri. These devices do not show up at all on USB when...

xdaforums.com
[Android Software Development] xenosaur:
fresh mmc-tools compiled for both armv7 and armv8.
[Android Software Development] DualJoe:
Here is another one for comparison. I guess xenosaurs builds are compiled against NDK/shared libs.
[Android Software Development] bibikalka:
This one always works, does not need "ld-android.so" in TWRP. I ran this version also for kernel 3.18.19 (Fire HD10 2017) - and it worked fine!

This one worked fine under Android, but in TWRP after system mount (twrp mount system) still gave me this error:

CANNOT LINK EXECUTABLE: "./mmc32": library "ld-android.so" not found

So I had to run these:

twrp mount system
LD_LIBRARY_PATH=/system/lib:$LD_LIBRARY_PATH

After these commands mmc32 also worked !

This mmc32 did not work for kernel 3.18.19:

root@suez:/data/local/tmp # ./mmc32
WARNING: linker: ./mmc32: unused DT entry: type 0x6ffffef5 arg 0x7ec
WARNING: linker: ./mmc32: unused DT entry: type 0x6ffffffe arg 0x87c
WARNING: linker: ./mmc32: unused DT entry: type 0x6fffffff arg 0x1
CANNOT LINK EXECUTABLE: empty/missing DT_HASH in "./mmc32" (built with --hash-style=gnu?)

To end the story, my fire stick that I wanted to test has this:

eMMC Pre EOL information [EXT_CSD_PRE_EOL_INFO]: 0x03

0x03 is a sign of dead eMMC. Good utility!
[Android Software Development] DualJoe:
Even works on kernel 3.4 (SG-S4). Values are ok. Nice tool indeed.

# mmc extcsd read /dev/block/mmcblk0
eMMC Life Time Estimation A [EXT_CSD_DEVICE_LIFE_TIME_EST_TYP_A]: 0x06
eMMC Pre EOL information [EXT_CSD_PRE_EOL_INFO]: 0x01
[Android Software Development] onoakino:
Hi. Sorry for asking, but I have very limited knowledge on installing binaries inside termux. Is there a "for dummies" guide on how to install this on termux? I have Android 11, rooted, and have Termux 0.118.0.

-edit-

Managed to get it to work. (Extracted the .xz file to ~/bin and chmod the binary with 777).

I don't know if this is the proper place to ask, but is it possible to create a gocrypt folder inside my external SDCARD (I have sandisk microsd) and mount it, so that putting files inside it would just be copy-paste using any third party file managers?

-2nd edit-

Got it to mount the encrypted folder from my microsd card (external storage). Posting here so I can help others who were in similar situation as I was:

1. Created a directory on your sdcard (external storage/microsdcard) and initialize it for gocryptfs. Let's say I called it "encryptedFolder"

(#gocryptfs -init "full_path_to_encryptedFolder)

It will ask you for a password twice, and then will provide you with the masterkey. Screenshot and copy the masterkey. Save it somewhere.

2. Create a mountpoint folder in the root directory of your internal storage. Let's call it "plain"

3. Mount.

#gocryptfs -allow_other -nosyslog "path-to-encryptedFolder-here" ~/plain

Following this, I can put as many files inside the "plain" directory and they will all be saved encrypted to the "encryptedFolder" in my external storage microSDcard.

Remember to unmount "plain" after you're done, to lock your encrypted folder.

On termux, just

#sudo umount ~/plain

ps: there's DroidFS in f-droid that simplifies things for us newbies. It also uses gocryptfs. The reason I wanted to do this termux way is so that I can mount the encrypted folder and use fx file explorer to manage my files that I want to save. Cheers!
[Android Software Development] xenosaur:
7zip 24.06 compiled statically with lz4/lz5/brotli/lzham support (like previous 23.01 from this thread), Added AVB and LVM support. Author implemented own zstd decoder, so existing renamed to zstd2. Statically linked for armv7 and armv8.

p.s. updated binaries to 24.06

p.p.s. if anyone wants statically compiled linux/windows binaries, message me
[Android Software Development] xenosaur:
Zstd multithreaded CLI compressor/decompressor 1.5.6 with lz4 support. Static build for both bitnesses, as usual.
[Android Software Development] xenosaur:
EroFS 1.7.1 utilities (dump, mkfs, fsck) supporting zstd, lzma, lz4, lz4hc, zlib compression statically compiled for both bitnesses. And squashfs 4.6.1 utils supporting zstd, lzma, lz4, xz.

p.s. added squashfs
[Android Software Development] xenosaur:
f2fs tools 1.9 build statically for both bitnesses
[Android Software Development] Technology geek:
so this can unpack images compressed with zstd format using zstd binary?
[Android Software Development] problemathic:
hi you have have tools for unpacking/repacking super.img? then having a modified one like use the free space to get a super.img?
[Android Software Development] xenosaur:
7zip 24.07 updated as usual. This time SFX modules were added in case anyone would like to create an SFX archive to unpack from e.g. recovery.
[Android Software Development] misterhsp:
cryptsetup-static 2.7.3 (aarch64)
[Android Software Development] mirfatif:
Also try this:

https://github.com/Abhinav1997/rsync-android?files=1
[Android Software Development] mirfatif:
[MENTION=4293606]DualJoe[/MENTION] do you find an easy way to just get rid of features tied to libc without heavily modifying source, such as NLS (locale) and NSS? They are annoying when linking statically, na? Some configure scripts allow disabling NLS, but not NSS I've seen so far. Simple programs like 'whoami' and 'id' can't show user name when run on Android because "libnss" is missing. Yesterday I noticed that 'ps' also shows only user id's because it's also dependent on nscd / nss to read user name from /etc/passwd. Busybox 'ps' and 'stat', on the other hand, work quite fine as they use different syscalls to read file permissions etc. Am I right?

PS: Does musl support all glibc function calls including those I mentioned above?
[Android Software Development] buengeut:
Try this Busybox https://github.com/meefik/busybox/releases , 'whoami' and 'id -un' can work fine.
[Android Software Development] mirfatif:
I'm already using this. But Busybox is limited, one way or other. We miss many features of Linux programs. I have to use Linux binaries at times which need to be statically compiled.
[Android Software Development] DualJoe:
I think most things should be covered when compiling against bionic. That's how they created the busybox versions you mentioned.
[Android Software Development] |pipe|:
Hello DualJoe,

your binaries are really great. Thank you very much.

But can you also build a binary for gocryptfs? ^^

nuetzlich (dot) net/gocryptfs
[Android Software Development] DualJoe:
Can't promise anything. First attempts to create the cross compiler toolchain with go language enabled were not successful. Will contact some people.
[Android Software Development] mirfatif:
@DualJoe sir with your permissions :)

EncFS is simpler, gocrptfs has complications.

Firstly, static binary is only built without_openssl. (Edit: In fact it's possible otherwise after playing with GO environment variables, but I couldn't make it work with cross-compiler. Code uses only GO compiler and not C code (i.e. libc and hence gcc) unless we build with openssl.) Secondly gocryptfs uses fusermount for mounting FUSE at runtime. So fusermount must be on $PATH. Thirdly, syslog needs to be disabled as there is no syslog on Android.

Unlike mainstream Linux, fusermount won't work without superuser privileges due to /dev/fuse permissions and other issues discussed here. Use allow_other for non-root access to mountpoint.

And obviously! Kernel should be built with FUSE (CONFIG_FUSE_FS).

~$ grep -i fuse /proc/filesystems
~$ ls /dev/fuse

Natively compiled with gcc and musl libc on Void Linux.

Initial tests work. Can't rectify bugs :D

~# mkdir .encrypted mountpoint
~# gocryptfs -nosyslog -init .encrypted
~# gocryptfs -info .encrypted
~# gocryptfs -allow_other -nosyslog .encrypted mountpoint
~# touch mountpoint/testfile
~# ls .encrypted mountpoint
~# fusermount -u mountpoint

UPDATED

Built on VoidLinux ARM64 running on Android device. Linked against musl libc.

gocryptfs_static_aarch64_v2.0-beta2 (with OpenSSL (libcrypto))

fusermount3_static_aarch64_v3.10.0
[Android Software Development] mirfatif:
Yes. Because compiling with Bionic needs a lot of changes in source code and thus everything specific to glibc (or any other non-Android environment) is removed from code.
[Android Software Development] DualJoe:
Good to see you could handle it. :good:
[Android Software Development] buengeut:
Can you build for armv7.

Thanks.
[Android Software Development] |pipe|:
Thank you DualJoe and mirfatif for your work.

But like buenguet, I need it for armv7... ^^

Did you get fusermount by building from github (dot) com/fuse4x/fuse ???

Maybe, I can try this tomorrow.
[Android Software Development] DualJoe:
And please don't compress the executables.
[Android Software Development] mirfatif:
Armhf binaries attached to previous post. Hope they work for you.

I built from from https://github.com/libfuse/libfuse/tree/fuse_3_0_bugfix.

I strip, compress and disable-debug executables to save space. Because I run a RAM based (tmpfs) environment on my phone and I keep online backup of my bin directory. Anyways, compiled again for you :)
[Android Software Development] buengeut:
Thank you so much.
[Android Software Development] |pipe|:
Unfortunately, it's not working for me. My phone chrashes if I try to mount it. And I failed building fusermount myself.

Anyways, thank you for your effort. But I guess I have to stick to encfs.
[Android Software Development] mirfatif:
To help me understand why it failed, would you please reproduce this error by executing this script? It'll be more helpful if you place strace binary on your $PATH.

#!/system/bin/sh -ex

[ -z $LOG ] && export LOG=/sdcard/gocryptfs.log &&
exec $0 2>&1 | tee $LOG && exit

[ $(id -u) -eq 0 ] || exit 1

grep -i fuse /proc/filesystems
cat /proc/cpuinfo
sync

gocryptfs --version
fusermount --version
sync

mkdir -p /data/local/tmp
cd /data/local/tmp
rm -rf enc mnt
mkdir enc mnt

STRACE=$(which strace 2>/dev/null) || true

gocryptfs -nosyslog -init enc || $STRACE gocryptfs -nosyslog -init enc
sync
gocryptfs -info enc || $STRACE gocryptfs -info enc
sync
gocryptfs -allow_other -nosyslog enc mnt || $STRACE gocryptfs -allow_other -nosyslog enc mnt
sync

touch mnt/testfile
ls enc mnt
sync

fusermount -u mnt || $STRACE fusermount -u mnt

rm -rf enc mnt
sync
exit 0
[Android Software Development] |pipe|:
I tried your Script and it was working fine.

It turned out that it works with folders in /data, but not in /sdcard resp. /storage/...

I played a lil bit and it is working with folders /mnt/runtime/default/emulated, which seems to be the correct name of the mount point.

Thank you very much.
[Android Software Development] mirfatif:
SD cards are FUSE or FUSE-like (sdcardfs on newer devices) file systems with restricted permissions to control apps' access. Mounting FUSE on SD cards often fails. I mentioned this in link referenced in my post. Also it's discussed by OP somewhere in this thread.

If you want to access mountpoint from sdcard, mount at /data/media/0/<mountpoint>.
[Android Software Development] |pipe|:
Sorry, I must have missed that.

Thank you very much for all your effort.
[Android Software Development] arunsai123:
How to compile btrfs-progs for Android using android-ndk? Thanks in advance.
[Android Software Development] mirfatif:
https://developer.android.com/ndk/g...n_source_projects_using_standalone_toolchains
[Android Software Development] mirfatif:
You need to compile all dependencies listed here:

https://github.com/kdave/btrfs-progs/blob/master/INSTALL

- libuuid

- libblkid

- liblzo2

- zlib

- libzstd

- e2fsprogs

- libreiserfscore

And that too if code works with Bionic luckily. Otherwise build with glibc or musl or any other C library having required functions.

Here are the compiled binaries:

btrfs-progs_static_aarch64_v4.16.1
[Android Software Development] fxsheep:
[MENTION=4293606]DualJoe[/MENTION] please add samba fuse mount
[Android Software Development] DualJoe:
Samba is quite messy. Will take a look but can't promise anything.
[Android Software Development] DualJoe:
[MENTION=8302434]fxsheep[/MENTION]:

SMBNetFS added. Samba on fusefs.
[Android Software Development] buengeut:
Does anyone have dpkg-deb (armv7) with the -b (--build) option and share it for me.

Thanks.
[Android Software Development] DualJoe:
Doesn't anything you download with that require a working (Debian) chroot as well? And if you have a working chroot the debian binary should work out of the box.

I would recommend Alpine Linux (armhf mini root filesystem) as chroot though (instead of Debian). Its just 4MB with musl, busybox and packet manager (apk).
[Android Software Development] buengeut:
Alpine Linux, that's cool. Thanks.
[Android Software Development] buengeut:
[MENTION=4293606]DualJoe[/MENTION] Please build progress for armv7.

Thanks.
[Android Software Development] DualJoe:
I've tested it just quickly with 'cp'. It didn't work though. Probably not a coreutils version. Maybe you have more luck. :)
[Android Software Development] buengeut:
Coreutils is not required, you need a hardlink.

ln -f busybox cp

cp bigfile /dev/null & progress -mq
[Android Software Development] buengeut:
[MENTION=4293606]DualJoe[/MENTION] Please help me again to build Archivemount.

Thanks.
[Android Software Development] buengeut:
Many thanks,

Archivemount is unable to mount SquashFS archives.

Please help me again to build Squashfuse.

Thanks.
[Android Software Development] buengeut:
[MENTION=4293606]DualJoe[/MENTION] Archivemount is able to mount iso files but it is very slow (slow read contents of mounted archive).

Can you help me again to build Fuseiso, hopefully Fuseiso is better than Archivemount.

Thanks.
[Android Software Development] DualJoe:
Done! :p

Edit: Patched/fixed version!
[Android Software Development] buengeut:
It doesn't work and without error messages.

Update: It works (patched/fixed).

fuseiso -n file.iso mountpoint -o allow_other
[Android Software Development] mirfatif:
If you have kernel source, simply recompile with required filesystems support for best performance.

CONFIG_SQUASHFS=m

CONFIG_ISO9660_FS=m

CONFIG_UDF_FS=m

...

etc.
[Android Software Development] DualJoe:
Probably incompatible to arm, fuse, musl, kernel or something else. Its from 2007. Probably needs patching. There are no configuration options either. There is not much i can do, sorry.
[Android Software Development] buengeut:
I found this and also this, both links contain patches that may be related to this problem.

Thanks.
[Android Software Development] buengeut:
Unfortunately I don't have that ability.
[Android Software Development] DualJoe:
Yes, looks better now. I've replaced the old file here.
[Android Software Development] buengeut:
It works, Thank you very very much.
[Android Software Development] fxsheep:
Deleted
[Android Software Development] Ultramanoid:
DualJoe, would it be possible for you to build EncFS 1.9.5 ? They don't update that often, looks like it was released back in April, not long after you posted 1.9.4, missed just by a bit.

( It fixes a few problems in 1.9.4, among them :

https://github.com/vgough/encfs/issues/467 )

Thank you for this thread at any rate. 1.9.4 is so useful. Wonder why the folks at Termux still don't add EncFS to their packages.
[Android Software Development] buengeut:
[MENTION=4293606]DualJoe[/MENTION] Please build hstr

Thanks.
[Android Software Development] DualJoe:
All done and added to the 1st post. Note the infos i posted for hstr. Looks like a handy tool indeed.
[Android Software Development] buengeut:
[MENTION=4293606]DualJoe[/MENTION] Encfs 1.9.5 armv7 doesn't work

# encfs /mnt/sdcard/dir1 /mnt/sdcard/dir2
Killed
[Android Software Development] Ultramanoid:
Works fine here. I've been using it everyday with no issues.
[Android Software Development] DualJoe:
It does work here as well.

Create a strace log. Maybe something useful shows up. Binary is on the 1st post.

strace -s256 -fvtt -o /sdcard/strace.txt encfs /mnt/sdcard/dir1 /mnt/sdcard/dir2

Also check the md5 (65cbd73ee0caf3aeb6e98e60730f70a4).
[Android Software Development] DualJoe:
[MENTION=8344367]buengeut[/MENTION]:

You seem to have a kernel that is not supporting 'SYS_getrandom'.

Please try this version.

Edit: Added another candidate (compat2). I think 1st version is still buggy.
[Android Software Development] buengeut:
encfs195compat doesn't work, encfs195compat2 works fine.

Thank you very much.
[Android Software Development] XTCrefugee:
Thanks, potentially some useful stuff here. In case anyone was unaware, there are also static ARM binaries for ffmpeg, such as the ones from https://www.johnvansickle.com/ffmpeg/

Does anyone know where I can get a static ARM jpegtran binary from?
[Android Software Development] mirfatif:
I have that for arm64.
[Android Software Development] XTCrefugee:
Thanks, but unfortunately I need it for 32.
[Android Software Development] TechnoSparks:
As someone who is dumb and clueless when it comes to cross building (me), your shared work proved to be ultra helpful. I would like to say thank you so much for this thread. I am really happy after stumbling this thread on Google during my what seemed helpless searching on how to build encfs for Android

I am going to create a new Magisk module based on encfs, but I prefer not to bundle binaries. Is it okay if I pack encfs of yours as a Magisk module? The main credit goes to you by having your XDA username as author. :)

If you also have resources that would be helpful for me to learn cross building, I would also really appreciate if you could share it, since I am genuinely interested in understanding how.
[Android Software Development] TechnoSparks:
First and foremost thank you so much for this! 👼

This is very overwhelming and it also tackles the particular spots I do not understand i.e. the patching method and resources. Your particular method is extra interesting because it uses a toolchain that is not of the Android NDK. Which means building using NDK will remain a mystery to me but hey at least your method provides me a foundation to cross-build some other things!

Thank you again! :highfive:

This is the Magisk module of your built binaries of EncFS: [removed]

This is my Magisk module utilising the binaries (still a stub): [removed]

EDIT: I have removed the links from the modules. One could easily create a module folder in Magisk's folder in /data partition, and put the binaries in there themselves. A very straightforward procedure!
[Android Software Development] DualJoe:
Try searching for 'Android NDK standalone toolchain'. You'll end up with nearly the same environment as above where you can throw 'configure && make' at.
[Android Software Development] evilvoice:
Would it be possible for a curl binary and imagemagick? armv7 32 bit. Thanks in advance
[Android Software Development] xdan8r:
encfs mount accessible to all apps?

For those who have encfs working, is it possible to make an encfs mount accessible by non-root apps (on oreo)? I have the encrypted dir on my external sd and am able to mount it so that root apps can see the decrypted data, but can't figure out how to get it the final step to all apps. I've tried various mount points in /storage, /mnt, /data/media, but nothing seems to work. If someone has that working, can you please post the command lines you use to achieve this? Or if you have ecryptfs working like this, that would also be helpful. Thanks!
[Android Software Development] Ultramanoid:
Meanwhile, note that both are available through Termux.
[Android Software Development] DualJoe:
Maybe something like this and mount it on that folder:

mkdir -p /mnt/efs && chmod 000 /mnt/efs
# efs/overmount will handle chmod

Or this in init.d (my ext-sd is ext4). By this the ext-sd will be mounted before Android vold (volume daemon) and the card won't be registered in the Android eco system (but can still be accessed normally by path selection in apps). An error message also appears after boot up that the card is defect but that can be ignored as well. I actually do this to prevent Android making a sdcardfs from the ext-sd so i can use it to overmount /sdcard and obb with folders from ext-sd to maximize /data/app and /data/data (internal memory).

mkdir -p /mnt/media_rw/sdcard1
mount -t ext4 -o rw,noatime /dev/block/mmcblk1p1 /mnt/media_rw/sdcard1
chmod 755 /mnt/media_rw/sdcard1

This is how it can be mounted. Beware that its not possible to overmount/bindmount sdcardfs. Try /mnt/efs (like above) instead as target.

source="/mnt/media_rw/sdcard1/efs/efs-pics"
target="/mnt/media_rw/sdcard1/pics"
encfs --public -o nonempty,noatime,noexec,nodev,nosuid ${source} ${target}
[Android Software Development] evilvoice:
True, but I want to use the binaries for a Tasker profile I made and the binaries downloaded through Termux don't work outside.
[Android Software Development] DualJoe:
What about this?

https://github.com/termux/termux-tasker

If it doesn't work i can give it a try though.