[EXE] Static Linux binaries for ARM/Android (Cryptsetup, EncFS, F2FS-Tools, Testdisk, PhotoRec,..) - Android Software Development

Native ARM/static Linux binaries
(for all ARMv7+ compatible platforms)
Open-source Linux binaries that are either not available on Android (e.g. in Termux)
or make sense to be statically compiled (e.g. to run in TWRP/recovery for data recovery).
These are root tools and might damage your device severely. Use at your own risk. I take no responsibility whatsoever. If in doubt don't use them.​
Minimum CPU: ARMv7/vfpv3-d16. Compiled against musl-libc/Android Kernel 3.4. Binaries are static, bionic/libc independent and should run on Android, TWRP, emulator or any other compatible ARM device. Musl is patched (info)(info2)(patch file: patch -p0 -u -b -i musl-android-smp.patch) to iterate CPU cores by /proc/stat instead of _SC_NPROCESSORS_CONF/sched_getaffinity to prevent false detection due to ARM cpu core powersaving (permanently turning cores on/off). This should report CPU cores more reliably to multithreading apps.
Example instructions how to build EncFS can be found here.
Some Cryptsetup compile recipes are here.
Changelog:
20190923 - f2fs-tools added
20190915 - dislocker, ntfs-3g, mount.exfat-fuse added
20190910 - VeraCrypt v1.24-b5 added
20191215 - musl smp patch added
20191224 - hstr v2.2.0 updated
20191225 - Testdisk, PhotoRec v7.2-wip-dec2019 updated
20200103 - tar v1.32 updated (with selinux, acl, xattr support)
20200513 - Cryptsetup v2.3.2 added
20200518 - fscrypt 0.2.7, strace56(aarch64) added
20200525 - p7zip v17.01 added
20200603 - parted v3.3 added
20200606 - fxz v1.1.0alpha added
20201212 - ddrescue v1.25 added
20201212 - Cryptsetup v2.3.4 updated
20210113 - f2fs-tools updated to v1.14.0
20210125 - Several tools compiled by @Borovets. See 'Misc' tools.
20210413 - Cryptsetup v2.3.5 updated
20210916 - Cryptsetup v2.4.1 updated. Thx to @misterhsp.
20211108 - rsync v3.2.3 updated
20211118 - Cryptsetup v2.4.2 updated. Thx to @misterhsp.
20220103 - mmc-utils added
20220106 - More tools from @Borovets. See spoiler.
Spoiler
bash-5.1.16-[1]-[2022.01.05].tar.gz
openssl3-3.0.1-[2021.12.14]-static.tar.gz
tree-2.0.0-[2021.12.23]-static.tar.gz
e2fsprogs-1.46.5-[2021.12.31]-static.tar.gz
openssl-1.1.1-m-[2021.12.15]-static.tar.gz
libsqlite-3.37.1-[2021.12.30]-static.tar.gz
ldns-host-1.7.1-[2021.12.30]-static.tar.gz
bootimg-info-2.0-[2021.12.18]-static.tar.gz
bc-5.2.1-[2021.12.29]-static.tar.gz
openssl3-tool-3.0.1-[2021.12.14]-static.tar.gz
openssl-tool-1.1.1-m-[2021.12.15]-static.tar.gz
sqlite-3.37.1-[2021.12.30]-static.tar.gz
stunnel-5.61-[2021.12.17]-static.tar.gz
toybox-0.8.6-borovets-295-applets-[2021.12.30]-static.tar.gz
unrar-6.10-beta-3-[2021.12.11]-static.tar.gz
zstd-1.5.1-[2021.12.22]-static.tar.gz
20220107 - parted v3.4 updated
20220113 - cryptsetup v2.4.3 updated. Thx to @misterhsp.
20220114 - gptfdisk v1.0.8 added
20220212 - tar v1.34 updated
20220622 - gptfdisk v1.0.9 (armv7) added
20220724 - dialog v1.3 added
20220728 - f2fs tools v1.15.0 updated
20220730 - cryptsetup v2.5.0 updated. Thx to @misterhsp.
20220806 - 7z-zstd v22.01 added. Thx to @xenosaur
20220910 - rsync v3.2.6 updated
20220913 - htop v3.2.1 added
20220913 - gocryptfs v2.3 updated. Thx to @misterhsp
20220922 - veracrypt v1.25.9 updated
20220924 - fdisk v2.38.1 and file v5.43 added
20221129 - cryptsetup v2.6.0 updated. Thx to @misterhsp
20221213 - f2fs tools v1.15.0 fixed (uuid.h missing)
20230215 - cryptsetup v2.6.1 updated. Thx to @misterhsp
20230307 - gocryptfs v2.3.1. Thx to @misterhsp
Data recovery tools:
- PhotoRec 7.2 - PhotoRec is file data recovery software designed to recover lost files including video, documents and archives from hard disks, CD-ROMs, and lost pictures (thus the Photo Recovery name) from digital camera memory. PhotoRec ignores the file system and goes after the underlying data, so it will still work even if your media's file system has been severely damaged or reformatted.
- Testdisk 7.2 - Recover lost partitions and partition tables. For external sdcards. Never use it on internal mmc unless you know what you're doing.
- ext4magic 0.3.2 (with supplementary gnu date binary that can handle relative time like 'date -d "-20minutes" +%s')
- fidentity - A little utility sharing PhotoRec signature database. It identifies the type of data contained in a file and reports the extension as seen by PhotoRec.
- debugfs - Might be helpful on ext2 systems or other stuff.
- strace 4.20 - For debugging. Mainly to catch syslog messages (as Android has no traditional /dev/log buffer).
- strace 5.6 - For aarch64.
- ddrescue v1.25 - Data recovery tool for block devices with errors.
Compression tools:
p7zip v17.01 (fork) - (Download) A new p7zip fork with additional codecs and improvements
pixz - Parallel, indexed xz compressor
xz - Multicore aware version of xz/lzma (use --thread=0)
tar v1.32 - Tar provides the ability to create tar archives, as well as various other kinds of manipulation. Download below. More builds from @mirfatif here.
fxz - (Download) FXZ Utils is a fork of XZ Utils. It adds a multi-threaded radix match finder and optimized encoder.
Misc:
- hexcurse v1.60.0 - Hexcurse is a curses-base hex editing utility that can open, edit, and save files, editing both the hexadecimal and decimal values. 'ncurses' ui layout depends on TERM env variable. Change temporary with eg. 'TERM=xterm-256color hexcurse <file>'. See /system/etc/terminfo for possible terminals (xterm-256color, linux..).
- nethogs v0.8.5 - ncurse/nettop-like per-app separated speedmeter and traffic counter supporting high refresh rate. Try 'nethogs -d0' (speedmeter) or 'nethogs -v1' (traffic counter).
- rsync v3.2.3 - rsync is an open source utility that provides fast incremental file transfer. (--with-rsyncd-conf=/data/etc/rsyncd.conf)
- smbnetfs v0.6.1 - SMBNetFS is a Linux/FreeBSD filesystem that allow you to use samba/microsoft network in the same manner as the network neighborhood in Microsoft Windows. More info see below.
- progress v0.14 - Linux tool to show progress for cp, mv, dd, ... (formerly known as cv). Download here.
- archivemount (20180801) - A fuse filesystem for mounting archives in formats supported by libarchive. Download here.
- squashfuse v0.1.103 - FUSE filesystem to mount squashfs archives Download here.
- FuseISO - FuseISO is a FUSE module to mount ISO filesystem images (.iso, .nrg, .bin, .mdf and .img files). It currently support plain ISO9660 Level 1 and 2, Rock Ridge, Joliet, and zisofs. Download here.
- HSTR v2.2.0 - HSTR (HiSToRy) is a command line utility that brings improved Bash/zsh command completion from the history. It aims to make completion easier and more efficient than Ctrl-r. (If history is empty try setting HISTFILE in /system/etc/bash/bashrc e.g. export HISTFILE=/data/.bash_history).
- GNU screen, tmux - Thanks to @mirfatif.
- dislocker, ntfs-3g, mount.exfat-fuse - Thanks to @mirfatif.
- f2fs-tools - Thanks to @mirfatif. Update: v1.14.0 here.
- parted v3.3 - GNU Parted (the name being the conjunction of the two words PARTition and EDitor) is a free partition editor, used for creating and deleting partitions. Note: It might be useful to partition external sdcards (e.g. to limit adoptable storage). I do not recommend to use it on internal memory. It might brick your phone.
- Several tools compiled by @Borovets
Spoiler: Borovets tools
Borovets tools 2021.01.25
arptables-0.0.5-[2021.01.17]-static.zip
autoflushtest-1.0-[2021.01.14]-static.zip
btrfs-compsize-1.3-[build-2]-[2020.12.27].zip
btyacc-3.0-[2021.01.18]-static.zip
c-blosc-1.21.1-development-[2020.12.22].zip
c-blosc2-2.0.0-beta-6-development-[2020.04.21].zip
cabextract-1.9.1-[2021.01.08]-static.zip
compsize-1.3-[2021.01.07]-static.zip
convert-color-space-0.1-[2021.01.18]-static.zip
cpustat-0.02.13-[2021.01.13]-static.zip
doxygen-1.9.2-[2021.01.17]-static.zip
ed-1.17-[2021.01.11]-static.zip
hello-2.10-[2021.01.08]-static.zip
htop-3.0.5-[2021.01.13]-static.zip
ipcalc-ng-1.0.0-[2020.12.28]-static.zip
iw-5.9-[2021.01.08]-static.zip
libsqlite-3.34.1-[2021.01.20].zip
libtar-1.2.20-[2021.01.16]-static.zip
m5-1.0-[2020.12.31]-static.zip
sqlite-3.34.1-[2021.01.20]-static.zip
Borovets tools 2021.01.27
lcab-1.0-beta-12-[2021.01.17].zip
memdump-1.01-[2021.01.25].zip
memdumper-0.4-[2021.01.25].zip
memtester-4.5.0-[2021.01.09].zip
tcpdump-4.99.0-[libcap-1.9.1]-[2021.01.05].zip
wget2-1.99.2-[2020.12.12].zip
wolfssl-4.5.0-[2020.12.12].zip
xfsprogs-5.10.0-[2021.01.01].zip
Crypttools:
(These crypttools are mostly frontend tools for the main backend that resides in the kernel. If your kernel hasn't been configured accordingly at compile time you might not be able to use all features.)
Cryptsetup v2.3.5 - (Download) Cryptsetup is an utility used to conveniently setup disk encryption based on DMCrypt kernel module. These include plain dm-crypt volumes, LUKS volumes, loop-AES and TrueCrypt (including VeraCrypt extension) format.
eCryptfs-utils v111 - Frontend tools for the enterprise cryptographic filesystem for Linux. That's what Android/Google use for encryption. It's file-based (no container) and mounting can be automated by Termux widget. Needs shared libraries but is still portable. See notes below.
EncFS v1.9.5 - EncFS provides an encrypted filesystem in user-space. It runs in userspace, using the FUSE library for the filesystem interface.
gocryptfs - An encrypted overlay filesystem written in Go. Download here. Thanks to @mirfatif.
VeraCrypt - VeraCrypt is a free open source disk encryption software. Download here. Thanks to @mirfatif.
fscrypt 0.2.7 - (Download) fscrypt is a high-level tool for the management of Linux filesystem encryption. Needs at least kernel 4.1.
Crypttools info:
Cryptsetup:
General Notes:
- Features like TrueCrypt, VeraCrypt and LUKS2 need 'userspace crypto api' enabled in kernel. Most Android kernels are probably not configured for that and you have to recompile your kernel or contact your kernel maintainer. For kernel 3.4 you need this:
Code:
CONFIG_CRYPTO_USER=y
CONFIG_CRYPTO_USER_API=y
CONFIG_CRYPTO_USER_API_HASH=y
CONFIG_CRYPTO_USER_API_SKCIPHER=y
- If 'cryptsetup benchmark' is incomplete and says 'userspace crypto api not available' you might be affected. You can still use LUKS1 though. A full benchmark looks like this:
Code:
# cryptsetup benchmark
# Tests are approximate using memory only (no storage IO).
PBKDF2-sha1 249186 iterations per second for 256-bit key
PBKDF2-sha256 327680 iterations per second for 256-bit key
PBKDF2-sha512 58829 iterations per second for 256-bit key
PBKDF2-ripemd160 227555 iterations per second for 256-bit key
PBKDF2-whirlpool 33539 iterations per second for 256-bit key
argon2i 4 iterations, 208288 memory, 4 parallel threads (CPUs) for 256-bit key (requested 2000 ms time)
argon2id 4 iterations, 207817 memory, 4 parallel threads (CPUs) for 256-bit key (requested 2000 ms time)
# Algorithm | Key | Encryption | Decryption
aes-cbc 128b 77.8 MiB/s 88.4 MiB/s
serpent-cbc 128b N/A N/A
twofish-cbc 128b 58.5 MiB/s 61.9 MiB/s
aes-cbc 256b 61.5 MiB/s 68.4 MiB/s
serpent-cbc 256b N/A N/A
twofish-cbc 256b 58.5 MiB/s 61.8 MiB/s
aes-xts 256b 95.1 MiB/s 86.9 MiB/s
serpent-xts 256b N/A N/A
twofish-xts 256b 60.0 MiB/s 61.8 MiB/s
aes-xts 512b 74.1 MiB/s 67.2 MiB/s
serpent-xts 512b N/A N/A
twofish-xts 512b 60.3 MiB/s 62.0 MiB/s
LUKS:
Code:
** 10MB test image (luks.img) **
dd if=/dev/zero of=luks.img bs=1M count 10M
cryptsetup luksFormat luks.img
cryptsetup open luks.img myluks
mke2fs -t ext4 /dev/mapper/myluks
mkdir luks
mount /dev/mapper/myluks luks
** luks folder is ready here **
umount luks
cryptsetup close myluks
- If standard luksFormat cipher (aes-xts-plain64) doesn't work (not supported by your kernel) you can try one of the more compatible ciphers:
Code:
cryptsetup luksFormat -c cbc-essiv:sha256 luks.img myluks
cryptsetup luksFormat -c aes-plain luks.img myluks
- For LUKS2 (experimental) use:
Code:
cryptsetup luksFormat --type luks2 luks.img
- Use "cryptsetup -v --debug" for more verbose output (debugging). In case of errors.
Veracrypt:
Code:
cryptsetup open --type tcrypt --veracrypt veracrypt.tc myvera
cryptsetup status myvera
mkdir /data/myvera
mount /dev/mapper/myvera /data/myvera
umount /data/myvera
cryptsetup close myvera
- Use container from desktop system (created with real Veracrypt)
- "veracrypt.tc" is the veracrypt container name
- "myvera" is an arbitrary name (handle)
- Use "cryptsetup -v --debug" for more verbose output (debugging). In case of errors.
eCryptfs-utils:
General Notes:
These tools are not built statically as they explicitly rely on 'dlopen' (plugin system). Instead they are compiled with relative rpaths (./libs). That means dependencies (libraries in subfolders) must be present in the binaries folder and you have to be in the binaries folder itself (with 'cd') before invoking any binary. By this the binaries are still portable (system independent) as long as the subfolders are present. I've put the files into a tar.gz archive so permissions should be set +x already. Extract the archive into /data/local/bin for 'Example' below.
Code:
mkdir -p /data/local/bin
cd /data/local/bin
tar xf crypttools.armv7.20180204.tar.gz
cd ecryptfs
./ecryptfs-stat --help
More info: ArchLinux Wiki
Example:
Tested on /sdcard based on FUSE filesystem. sdcardfs untested. Might need selinux permissive.
We create a folder /sdcard/pics that can be enabled (files present) or disabled (no files present) by a click on a widget button (Termux script) and entering our password. The encryption is done on a per-file basis. The actual files are stored encrypted in /sdcard/efs/pics.
- You might need SuperSU or Magisk Superuser for 'su -mm'. That makes sure that all apps can see the mounted folder (mount namespace separation).
- Busybox needed
- Install Termux and Termux:Widget from F-Droid or Playstore
- Start it and enter:
Code:
pkg upgrade
pkg install tsu
exit
- Create script /data/data/com.termux/files/home/.shortcuts/efs-pics.sh and make sure permissions(700) and owner (take from parent folder) are correct.
Code:
#!/system/xbin/bash
su -mm -c "/system/xbin/bash -c /data/local/scripts/$(basename "$0")"
- Create script /data/local/scripts/efs-pics.sh (770/root):
Code:
#!/system/xbin/bash
set -e
PATH=$PATH:/data/data/com.termux/files/usr/bin
# Necessary because rpaths are relative
cd /data/local/bin/ecryptfs
# /data/myefskey contains the salted key.
# Don't forget to make a backup.
# Without it encrypted data is lost.
function enter_passphrase {
read -p "Enter passphrase: " passphrase
sig=$(printf "%s" "$passphrase" | ./ecryptfs-insert-wrapped-passphrase-into-keyring /data/myefskey -) || exit
sig=$(echo $sig | cut -d "[" -f2 | cut -d "]" -f1)
}
CPATH1="/data/media/0/efs/pics"
CPATH2="/data/media/0/pics"
if ! mountpoint -q ${CPATH2}; then
enter_passphrase
echo ""
mount -t ecryptfs -o ecryptfs_sig=$sig,ecryptfs_fnek_sig=$sig,ecryptfs_cipher=aes,ecryptfs_key_bytes=16 ${CPATH1} ${CPATH2} || (echo "$(basename "$0") mount failed!"; exit)
./keyctl clear @u
echo "$(basename "$0") mount successful! :)"
else
umount ${CPATH2} || (echo "$(basename "$0") umount error $? :("; exit)
echo "$(basename "$0") umount successful :)"
fi
# uncomment to force-close Termux window
# killall com.termux
- If your rom uses encryption already (/data/data) beware the './keyctl clear @u' command. It might flush *all* keys in the kernel including the Android encryption one (i'm not sure). This might lead to unpredicted behavior. Either comment it out (then your once injected key remains in the kernel keystore and someone could simply remount your folder without passphrase) or make yourself familiar with the keyctl command and handle it yourself. My phone is not encrypted so i cannot help here.
- Create random keyfile (/data/myefskey) and wrap it with passphrase. This might need 1-2 minutes depending on your devices entropy pool (/dev/random). Backup this key (/data/myefskey). Without it your encrypted data is lost. And don't forget the trailing '-' (minus) at the end of the line, it's important.
Code:
cd /data/local/bin/ecryptfs
read -p "Enter passphrase: " passphrase; printf "%s\n%s" $(busybox od -x -N 100 --width=30 /dev/random | head -n 1 | busybox sed "s/^0000000//" | busybox sed "s/[[:space:]]*//g") "${passphrase}" | ./ecryptfs-wrap-passphrase /data/myefskey -
- Create folders:
Code:
mkdir -p /sdcard/efs/pics /sdcard/pics
- Create Widget (Termux) and select 'efs-pics.sh'.
- Start it and enter your passphrase (you used above). If everything goes well (it will tell you) you can place files into /sdcard/pics and scrambled files should come up in /sdcard/efs/pics. Never write into /sdcard/efs/pics directly.
- Activate widget again. /sdcard/pics should get emptied.
- Optional: You can set /data/media/0/efs/pics to 700/root so no one can access/see the encrypted data.
SMBNetFS info:
Note: The library paths are relative. You need to be in the folder (with 'cd') to spawn the executable (./smbnetfs). You can extract the archive wherever you want though as far as the file/folder structure remains intact.
Example:
Code:
mount -o remount,rw /
mkdir -p /data/local/bin /mnt/cifs
mount -o remount,ro /
tar xf smbnetfs.tar.gz -C /data/local/bin
cd /data/local/bin/smbnetfs
export HOME=/data/local/bin/smbnetfs/home
* enter your smb credentials into smbnetfs/home/.smb/smbnetfs.auth (eg. auth "192.168.1.2" "${user}" "${pass}")
./smbnetfs /mnt/cifs
cd /mnt/cifs/192.168.1.2/${share}
I think it usually should list the samba environment in /mnt/cifs but i'm not sure which prerequisites are necessary for that (edit: maybe it needs real workgroup/hostname instead of IPs). If nothing comes up this should work:
The folder 192.168.1.2/${share} is unreachable by Androids folder picker (unless you can enter the path manually). So either pre-create the folder structure beforehand (mkdir -p /mnt/cifs/192.168.1.2/${share}) and add/register the folder to your app by folder picker (eg. MXPlayer) and then overmount that with the actual ${share}. Or bindmount the folder:
Code:
mount --bind /mnt/cifs/192.168.1.2/${share} /mnt/cifs2
Edit: Another option is to let smbnetfs create a static link (actually a symbolic link) to the share in the mountpoint root (/mnt/cifs). Its not as robust as the bindmount though. MXPlayer doesn't find any files (even though the folder picker shows the folders properly).
Code:
echo "link myfiles 192.168.1.2/${share}" > /data/local/bin/smbnetfs/home/.smb/smbnetfs.host
chmod 700 /data/local/bin/smbnetfs/home/.smb/smbnetfs.host
I've noticed that MXPlayer shows the samba folders just for a glimpse of a second. But if you enter one of the local folders and then go back all samba folders are there. Not sure why this is happening or maybe its just my system.
Edit2: Not yet tested but.. check the permissions. Its possible that SMBNetFS mounts with 755 or something. That's inaccessible for Android apps. Try this:
Code:
./smbnetfs -o umask=000,noatime,noexec,nodev,nosuid /mnt/cifs
Samba 4.8.3 configuration:
Code:
_idmap_modules=idmap_rid,idmap_hash,idmap_tdb2
_pdb_modules=pdb_tdbsam,pdb_smbpasswd,pdb_wbc_sam,pdb_samba4
_auth_modules=auth_unix,auth_wbc,auth_server,auth_netlogond,auth_script,auth_samba4
waf configure --prefix=/tmp/myout \
-C \
--sysconfdir=./conf/etc/samba \
--with-configdir=./conf/etc/samba \
--localstatedir=./conf/var \
--libexecdir=./conf/usr/lib \
--enable-fhs \
--with-lockdir=./conf/var/cache/samba \
--with-piddir=./conf/run/samba \
--with-logfilebase=./conf/var/log/samba \
--without-pam \
--without-systemd \
--without-ads \
--with-shared-modules=$_idmap_modules,$_pdb_modules,$_auth_modules \
--disable-cups \
--without-gettext \
--bundled-libraries=NONE,com_err,ldb,uid_wrapper,resolv_wrapper,socket_wrapper,nss_wrapper,ntdb,roken,wind,hx509,asn1,heimbase,hcrypto,krb5,gssapi,heimntlm,hdb,kdc,cmocka,talloc,tdb,pytdb,ldb,pyldb,tevent,pytevent \
--disable-rpath-install \
--disable-python --without-ad-dc --without-acl-support --without-ldap \
--hostcc=/usr/bin/gcc \
--cross-compile --cross-execute='qemu-arm -L /media/devpart/qemu/root'
waf build -j4
waf install

Compression tools added.
Next are crypttools (ecryptfs-utils, cryptsetup).

DualJoe said:
Compression tools added.
Next are crypttools (ecryptfs-utils, cryptsetup).
Click to expand...
Click to collapse
Please add ecryptfs-simple
xyne.archlinux.ca/projects/ecryptfs-simple
Thanks.

Ecryptfs-simple is not POSIX compliant. It relies on an argv interface (to parse command-line parameters) that is a GNU extension that musl doesn't support.
The original eCryptFS is simple enough anyway (and its the upstream project). I will provide a quickstart example and a one button GUI controlled solution (Termux widget) to handle it.

Please to add gifsicle,
http://github.com/kohler/gifsicle
Thanks.

I only have gifsicle. The other ones are too complex for my setup atm.

DualJoe said:
I only have gifsicle. The other ones are too complex for my setup atm.
Click to expand...
Click to collapse
Thank you very much.

Please help me again to build giflossy (fork of gifsicle).
I really need it to compress (--lossy=N) the Gif file to be smaller.
https://github.com/kornelski/giflossy
Thanks.

Do you use them directly on your phone for web postings or something? What's your use case to not prefer a desktop system for this?

DualJoe said:
Do you use them directly on your phone for web postings or something? What's your use case to not prefer a desktop system for this?
Click to expand...
Click to collapse
I use it directly on the phone, for learning purposes.
Using it on the phone is so handy that it can be easily used anywhere.
Thanks.

Please help me again to build lbzip2
http://lbzip2.org/
Thanks.

Here it is.

DualJoe said:
Compression tools added.
Next are crypttools (ecryptfs-utils, cryptsetup).
Click to expand...
Click to collapse
When will Crypttools be released.

I've waited for the major update of cryptsetup. Its out now indeed. I should get it up this week.

Crypttools and quickstart tutorials added.

Mountpoint is not writable (eCryptfs)
DualJoe said:
Crypttools and quickstart tutorials added.
Click to expand...
Click to collapse
Can't write to mountpoint.
# touch /sdcard/pics/test
touch: /sdcard/pics/test: Permission denied
# cp file /sdcard/pics
cp: can't create '/sdcard/pics/file': Permission denied

buengeut said:
touch: /sdcard/pics/test: Permission denied
Click to expand...
Click to collapse
What are your permissions?
Code:
# stat /data/media/0/pics
Access: (775/drwxrwxr-x) Uid: (1023/media_rw) Gid: (1023/media_rw)
# stat /data/media/0/efs
Access: (775/drwxrwxr-x) Uid: (1023/media_rw) Gid: (1023/media_rw)
# stat /data/media/0/efs/pics
Access: (775/drwxrwxr-x) Uid: (1023/media_rw) Gid: (1023/media_rw)
How does your mount look like?
Code:
# mount |grep pics
/data/media/0/efs/pics on /data/media/0/pics type ecryptfs (rw,relatime,ecryptfs_fnek_sig=56b1f3c519fb3412,ecryptfs_sig=56b1f3c519fb3412,ecryptfs_cipher=aes,ecryptfs_key_bytes=16)
Is /sdcard linked?
Code:
# ls -l /sdcard
lrwxrwxrwx 1 root root 21 May 10 1973 /sdcard -> /storage/self/primary
What Android version and kernel do you have?

DualJoe said:
What are your permissions?
Code:
# stat /data/media/0/pics
Access: (775/drwxrwxr-x) Uid: (1023/media_rw) Gid: (1023/media_rw)
# stat /data/media/0/efs
Access: (775/drwxrwxr-x) Uid: (1023/media_rw) Gid: (1023/media_rw)
# stat /data/media/0/efs/pics
Access: (775/drwxrwxr-x) Uid: (1023/media_rw) Gid: (1023/media_rw)
How does your mount look like?
Code:
# mount |grep pics
/data/media/0/efs/pics on /data/media/0/pics type ecryptfs (rw,relatime,ecryptfs_fnek_sig=56b1f3c519fb3412,ecryptfs_sig=56b1f3c519fb3412,ecryptfs_cipher=aes,ecryptfs_key_bytes=16)
Is /sdcard linked?
Code:
# ls -l /sdcard
lrwxrwxrwx 1 root root 21 May 10 1973 /sdcard -> /storage/self/primary
What Android version and kernel do you have?
Click to expand...
Click to collapse
Android 6.0 kernel 3.18.14
/sdcard is symlink to /mnt/sdcard, i changed /sdcard to /mnt/sdcard
Code:
# mount -t ecryptfs
/mnt/sdcard/efs/pics on /mnt/sdcard/pics type ecryptfs (rw,relatime,ecryptfs_fnek_sig=1b77138d91206e66,ecryptfs_sig=1b77138d91206e66,ecryptfs_cipher=aes,ecryptfs_key_bytes=16)
Code:
# stat /mnt/sdcard/pics
Access: (775/drwxrwxr-x) Uid: (1000/ system) Gid: (1015/sdcard_rw)
# stat /mnt/sdcard/efs
Access: (775/drwxrwxr-x) Uid: (1000/ system) Gid: (1015/sdcard_rw)
# stat /mnt/sdcard/efs/pics
Access: (775/drwxrwxr-x) Uid: (1000/ system) Gid: (1015/sdcard_rw)
Code:
# touch /mnt/sdcard/pics/test
touch: /mnt/sdcard/pics/test: Permission denied

What about the permissions of /data/media/0 folders? That's the most important part.
If your sdcard is not at /data/media/0 you probably don't have a multiuser environment (older phone?) and /mnt/sdcard is probably a real partition. This is early Kitkat partition layout (/sdcard and /data have separate partitions). On later systems both are on /data partition and /sdcard is abstracted by a FUSE file system that would automatically set the proper permissions whenever you write something to it (even as root).
In case you are on an old layout you would need to set proper permissions to /sdcard/pics and /sdcard/efs yourself. Just take a look at the other folders with 'ls -l /mnt/sdcard' and set accordingly. You would also need to change /data/media/0 to /mnt/sdcard in the script.
What do you get with this?
Code:
# mount |grep sdcard
# mount |grep storage
What phone is it? Kernel 3.18 doesn't sound all too old.
Edit: Another theory is your internal sdcard is scardfs or something. If so, it might break "stacking" folders (mount over). Try to use /data/pics and /data/efs/pics as a test.

It works in Permissive mode (setenforce 0)
I need Busybox with SELinux-enabled and use it to set it to Permissive mode
Code:
# busybox getenforce
Enforcing
# busybox setenforce 0
# busybox getenforce
Permissive
And then execute the efs-pics.sh and test it
Code:
# cp file /mnt/sdcard/pics ; echo $?
[b]0[/b]
# ls /mnt/sdcard/pics
[b]file[/b]
Horreee.... it Works.

Related

[Android Tutorials] Getting Started, ADB, Tethering, Building system images etc...

I figured I would start a tutorial thread. If you have some tutorials or instructions you would like to share then post them. Also post links to other helpful posts and threads.
Basic instructions for building an android squashfs system image:
First you need a Linux installation. I use Ubuntu 9.04 and run as the root user.
You need to have squashfs-utils installed. I have version 3.3 installed.
You need the android version of genext2fs. You might want to chmod this to executable before using it.
Starting simple download the ion 1.5 build or any other build that works on vogue as a base.
If the base image your using is a system.img then it's cramfs. You can mount this image and pull from it. Enter android-builds directory and create a tmp directory for mounting the image and a mount point in that tmp dir.
Code:
mkdir tmp
mkdir tmp/cram-sys
mount -o loop system.img tmp/cram-sys
The system.img should be mounted on tmp/cram-sys
Now you have a base system image to grab files from.
If you have a system.sqsh then it is a little easier to do.
Put the system.sqsh in a working directory like base-rom in your android-builds directory and while in the directory from a terminal execute:
Code:
unsquashfs system.sqsh
This will create a directory called squashfs-root.
Then download a build from the dream forums on xda.
Usually they come in update.zip format. Extract the zip to a working directory like android-builds/foo
Inside you should see some directories mainly data and system is what you are after.
Look inside the data folder for any app or app_s directories. Copy those apps to the system/app directory. Leave out any unnecessary apps like wifi tether and so on.
In the system directory is another directory called lib. You need to take out libaudio.so libaudioflinger.so libgps.so. Depending upon the build the vogue specific libraries are either in /lib or /lib/donut in the rootfs. We take these out of system/lib because they cause conflicts. Another way around this is to copy the vogue specific libraries to system/lib.
In the system directory is another directory called etc. You need to replace apns.conf with the one from a working vogue android build.
Depending on the build you are porting you will need to modify system/bin and system/xbin. I usually add any missing files to the new image and base the missing files off of the ones in the android 1.5 ion build.
After this you need to edit your build.prop in the system directory. Look at the ion cupcake 1.5 or a donut build with market fix for reference depending on the build you are porting.
The last step is to put a .build file in the system directory. This depends on the build type.
donut.build
ion.build
rogers.build
hero.build
After you've modified the system directory you need to use genext2fs to create an android specific ext2 image.
for cupcake/donut images
Code:
genext2fs -d ./system -b 80000 -a system.ext2
this will make ~80mb ext2 system image.
for hero/sense ui builds a larger image is required
Code:
genext2fs -d ./system -b 160000 -a system.ext2
This system.ext2 is now bootable and you should be able to copy it to your sdcard and run it.
To turn this into a system.sqsh you need to mount it
Code:
mkdir tmp/system-ext2-mnt
mount -o loop system.ext2 tmp/system-ext2-mnt
Then make a squashfs image of the mounted directory
Code:
mksquashfs tmp/system-ext2-mnt/ system.sqsh
Build scripts/environment from loserskater:
http://forum.xda-developers.com/showthread.php?t=585452
ADB setup and Telenet via adb:
enatefox's tutorial for setting up adb and udev
enatefox's tutorial for telenet via adb
Adding a hosts file to block adds
Download this hosts file and copy it to /etc/hosts this should block most adds while browsing in android. Saving you time and bandwidth.
Using google dns servers on your phone:
(mssmision)
connect to the adb shell or from the terminal with su in android type
setprop ro.kernel.android.ndns 2
setprop net.eth0.dns1 8.8.8.8
setprop net.eth0.dns2 8.8.4.4
Basic Theming:
http://forum.xda-developers.com/showpost.php?p=3175504&postcount=1
Tethering via tetherbot and adb.
Download and install adb on your computer.
Download tetherbot and install it in android.
Connect your phone to your computer
Open tetherbot on your phone and push "Start Socks"
Open a terminal on your computer and type
Code:
adb forward tcp:1080 tcp:1080
Open firefox on your computer and type
Code:
about:config
search in the filter for
Code:
network.proxy.socks_remote_dns
change the value from true to false
Go into your network preferences settings in firefox and select manual proxy configuration
In the SOCKS host field enter localhost and TCP port 1080
Select SOCKS_v5
Click OK
Reload firefox and you should be running off your phones data network.
thank you Zen will give it a blast
oooh yeah runs faster!!!
smarty lol do you still need to keep sd card in slot after flashing?
# mkdir /mnt
# mkdir /mnt/rootfs-sd
# mkdir /mnt/rootfs-nand
# mkdir /mnt/system-sd
# mkdir /mnt/system-nand
# mkdir /mnt/data
# mkdir /mnt/sdcard
# flash_eraseall /dev/mtd/mtd1
Erasing 128 Kibyte @ d80000 -- 100 % complete.
# flash_eraseall /dev/mtd/mtd2
Erasing 128 Kibyte @ 1a20000 -- 29 % complete.
Skipping bad block at 0x01a40000
Erasing 128 Kibyte @ 5980000 -- 100 % complete.
# flash_eraseall /dev/mtd/mtd3
Erasing 128 Kibyte @ 75e0000 -- 92 % complete.
Skipping bad block at 0x07600000
Erasing 128 Kibyte @ 8000000 -- 100 % complete.
are the bad blocks there normal?
ali3nfr3ak said:
# mkdir /mnt
# mkdir /mnt/rootfs-sd
# mkdir /mnt/rootfs-nand
# mkdir /mnt/system-sd
# mkdir /mnt/system-nand
# mkdir /mnt/data
# mkdir /mnt/sdcard
# flash_eraseall /dev/mtd/mtd1
Erasing 128 Kibyte @ d80000 -- 100 % complete.
# flash_eraseall /dev/mtd/mtd2
Erasing 128 Kibyte @ 1a20000 -- 29 % complete.
Skipping bad block at 0x01a40000
Erasing 128 Kibyte @ 5980000 -- 100 % complete.
# flash_eraseall /dev/mtd/mtd3
Erasing 128 Kibyte @ 75e0000 -- 92 % complete.
Skipping bad block at 0x07600000
Erasing 128 Kibyte @ 8000000 -- 100 % complete.
are the bad blocks there normal?
Click to expand...
Click to collapse
yea thats normal
here is what i did to get it working
1. unsquashfs the system.sqsh
2. move apps folder to desktop
3. then mksquashfs system.sqsh
4. in terminal do(make sure no data.img on desktop)
Code:
dd if=/dev/zero of=./desktop/data.img bs=1048576 count=128
mke2fs -F ./desktop/data.img
sudo mkdir /mnt/data
sudo mount -o loop ./desktop/data.img /mnt/data
sudo mv ./desktop/app /mnt/data/app_s
sudo umount /mnt/data
then copy the data.img and system.sqsh to sdcard
and then make
datafstonand
and
systemfstonand
then right after it starts to boot
A N D R I O D
enabled adb bla bla
then do
adb shell stop
then
ln -s /data/app_s /system/app
then
adb shell start
you should be good if you followed this to the T
jamezelle said:
yea thats normal
here is what i did to get it working
1. unsquashfs the system.sqsh
2. move apps folder to desktop
3. then mksquashfs system.sqsh
4. in terminal do(make sure no data.img on desktop)
Code:
dd if=/dev/zero of=./desktop/data.img bs=1048576 count=128
mke2fs -F ./desktop/data.img
sudo mkdir /mnt/data
sudo mount -o loop ./desktop/data.img /mnt/data
sudo mv ./desktop/app /mnt/data/app_s
sudo umount /mnt/data
then copy the data.img and system.sqsh to sdcard
and then make
datafstonand
and
systemfstonand
then right after it starts to boot
A N D R I O D
enabled adb bla bla
then do
adb shell stop
then
ln -s /data/app_s /system/app
then
adb shell start
you should be good if you followed this to the T
Click to expand...
Click to collapse
you should put the symlink in the system folder before you squash it that way it should boot straight through.
ali3nfr3ak said:
smarty lol do you still need to keep sd card in slot after flashing?
Click to expand...
Click to collapse
if you edit init and put cache in /data you should be able to fully run from nand.
or from adb shell
Code:
cd /
umount /cache
mkdir /data/cache
mount /cache /data/cache
pull your sdcard. look ma running from nand.
zenulator said:
you should put the symlink in the system folder before you squash it that way it should boot straight through.
Click to expand...
Click to collapse
one problem i have is i dont think compcache is being enabled, becaulse im getting home reloads every(yes everytime i hit home(hold cam/redbutton))
can i just add the commands from my hero.user.conf to init or init.hero.rc, or will they not be called right?
jamezelle said:
one problem i have is i dont think compcache is being enabled, becaulse im getting home reloads every(yes everytime i hit home(hold cam/redbutton))
can i just add the commands from my hero.user.conf to init or init.hero.rc, or will they not be called right?
Click to expand...
Click to collapse
when i ran the tattoo build from nand compcache was enabled. make sure you have the config files in your android directory on your sdcard. to check if you have swap enabled go into the terminal or adb shell and type
Code:
free
and see how much ram/swap you have.
also i think
Code:
cat /proc/swaps
will show you what swap is being used.
Zen can u tell me what all the files i need on my sdcard to get this going, i tried for a couple of hours last night to get this going no luck tho, and jamezelle helped me out as well still no luck tho, all i had was on my sdcard was android folder with dzos rootfs.img, system-noapps.sqsh, VOGUIMG.nbh as i flashed from sdcard and app_s.tar.gz
[email protected]:~# adb shell
# mkdir /mnt
# mkdir /mnt/rootfs-sd
# mkdir /mnt/rootfs-nand
# mkdir /mnt/system-sd
# mkdir /mnt/system-nand
# mkdir /mnt/data
# mkdir /mnt/sdcard
# flash_eraseall /dev/mtd/mtd1
Erasing 128 Kibyte @ d80000 -- 100 % complete.
# flash_eraseall /dev/mtd/mtd2
Erasing 128 Kibyte @ 1a20000 -- 29 % complete.
Skipping bad block at 0x01a40000
Erasing 128 Kibyte @ 5980000 -- 100 % complete.
# erase_eraseall /dev/mtd/mtd3
/system/bin/sh: erase_eraseall: not found
# flash_eraseall /dev/mtd/mtd3
Erasing 128 Kibyte @ 75e0000 -- 92 % complete.
Skipping bad block at 0x07600000
Erasing 128 Kibyte @ 8000000 -- 100 % complete.
# mount -t vfat /dev/block/mmcblk0p1 /mnt/sdcard/
# losetup /dev/block/loop1 /mnt/sdcard/android/rootfs.img
# mount /dev/block/loop1 /mnt/rootfs-sd
# mount /dev/block/mtd1 /mnt/rootfs-nand/
mount: mounting /dev/block/mtd1 on /mnt/rootfs-nand/ failed: No such file or directory
i cannot get past this part, Do i need more files on sdcard to get going?
ali3nfr3ak said:
Zen can u tell me what all the files i need on my sdcard to get this going, i tried for a couple of hours last night to get this going no luck tho, and jamezelle helped me out as well still no luck tho, all i had was on my sdcard was android folder with dzos rootfs.img, system-noapps.sqsh, VOGUIMG.nbh as i flashed from sdcard and app_s.tar.gz
[email protected]:~# adb shell
# mkdir /mnt
# mkdir /mnt/rootfs-sd
# mkdir /mnt/rootfs-nand
# mkdir /mnt/system-sd
# mkdir /mnt/system-nand
# mkdir /mnt/data
# mkdir /mnt/sdcard
# flash_eraseall /dev/mtd/mtd1
Erasing 128 Kibyte @ d80000 -- 100 % complete.
# flash_eraseall /dev/mtd/mtd2
Erasing 128 Kibyte @ 1a20000 -- 29 % complete.
Skipping bad block at 0x01a40000
Erasing 128 Kibyte @ 5980000 -- 100 % complete.
# erase_eraseall /dev/mtd/mtd3
/system/bin/sh: erase_eraseall: not found
# flash_eraseall /dev/mtd/mtd3
Erasing 128 Kibyte @ 75e0000 -- 92 % complete.
Skipping bad block at 0x07600000
Erasing 128 Kibyte @ 8000000 -- 100 % complete.
# mount -t vfat /dev/block/mmcblk0p1 /mnt/sdcard/
# losetup /dev/block/loop1 /mnt/sdcard/android/rootfs.img
# mount /dev/block/loop1 /mnt/rootfs-sd
# mount /dev/block/mtd1 /mnt/rootfs-nand/
mount: mounting /dev/block/mtd1 on /mnt/rootfs-nand/ failed: No such file or directory
i cannot get past this part, Do i need more files on sdcard to get going?
Click to expand...
Click to collapse
well the last command you typed should be
Code:
mount -t yaffs2 /dev/block/mtdblock1 /mnt/rootfs-nand
also i updated the tutorial to reflect that and also a simplified version along the lines of jamezelle's method of that uses dzo's normal installer so you shouldn't have to type all those commands just use the blank files in the rootfs and make sure you have the rest in /andoroid on your sdcard.
Not sure if you've seen the thread I started on the Kaiser forums. It's really easy to run scripts that I made for building systems.
Check it out
loserskater said:
Not sure if you've seen the thread I started on the Kaiser forums. It's really easy to run scripts that I made for building systems.
Check it out
Click to expand...
Click to collapse
I added a link in the first post. great work.
Installing adb drivers on Windows [Vista,7] x64
NOTE: You don't need to disable driver signing to install! The appropriate .cat files are included in the download.
//Prep
1. Download adb2 posted by dzo. It's on the sourceforge site:
adb2
2. Unpack the zip.
3. In android, go to settings - applications - development and make sure usb debugging is selected.
//Cleanup
4. Open device manager (start - run - devmgmt.msc)
5. Plug in your phone and _watch_ for something new to show up. Might be 'Android Phone.'
6. Confirm that the new device is your phone by unplugging. The device should disappear.
7. Plug back in.
8. Right click on the device and choose 'Uninstall'
9. Check the 'delete this driver from my computer' box.
10. click ok. NOTE: It may take a loong time. Wait.
11. Unplug your phone.
12. If prompted to reboot, do so.
13. Uninstall WMDC (Windows Mobile Device Center)
14. Reboot.
//Install
15. Re-download and reinstall WMDC
16. Plug in your phone.
17. The device driver installation wizard should fail. IF IT INSTALLS THE DEVICE, go back to cleanup.
18. Open device manager.
19. Right click on 'Android Phone' and choose 'update driver.'
20. Click 'Browse my computer for driver software.'
21. Click 'let me pick'
22. Click 'next'
23. Click 'have disk'
24. Click 'browse'
25. Browse to the location where you unzipped adb2.
26. Open the Vista_x64 directory.
27. Choose androidusb.inf
28. Click ok
29. Choose 'HTC, Corporation' as the manufacturer (may not see this)
30. Choose 'My HTC' as the model
31. Click 'next'
32. Click 'yes'
DONE!
Zen, I know we were talking yesterday. Do you think you can outline in detail how to convert an EXT2 or NAND or SD Card based installed system on the vogue into something we can distribute?
I'd really like to share my customized rom with people.
Thanks again for all of your contributions
Ok finally got tattoo booting was having wakeup problems but made system .ext2 then sqsh. But audio still not playing, any ideas? Thanx I did use audio libs from donut rootfs
i thought the libs had to come from an ION build?

need write to /system or something EXEC path

I was the first person I know on the internet to compile nmap for android and this guy ( http://wjholden.com/nmap/ ) took it to the next level got a new phone ( CM6 with OC ) nbow it does not work
* can't write to /system even with rw remount
* if I boot recovery I can' write to /systm but its just a temp fs so failsause ...
* can't ADB shell (read below ) to find out where system is really mounted OR mount the real /system my self ..
* remouted / but anything I add gets wipped on reboot ...
* onlything that works is remount / , copy nmap and then add PATH hackery to EXEC nmap ... on EVERY reboot ...
NOTES BELOW:
Code:
http://forum.xda-developers.com/showthread.php?t=701589&page=4
I think its because /system is protected in CM5+ ? even with remount
command... ?
let me know what I need to copy where in recovery mode to /system to
get yours to run properly :/
you could also have your installer check for this and have notes etc ..
# uname -a
Linux localhost 2.6.29.6-cyanogenmod #1 PREEMPT Fri Sep 17 16:05:39
PDT 2010 arm v6l GNU/Linux
# ls
ls
NMAP FOR ANDROID CROSS COMPILE ARM.html
NMAP.zip
nmap
nmap-4.01-1.spec
nmap-mac-prefixes
nmap-os-fingerprints
nmap-protocols
nmap-rpc
nmap-service-probes
nmap-services
# cp * /system/bin
cp * /system/bin
cp: can't create '/system/bin/NMAP FOR ANDROID CROSS COMPILE ARM.html': Out of m
emory
cp: can't create '/system/bin/NMAP.zip': Out of memory
cp: can't create '/system/bin/nmap': Out of memory
cp: can't create '/system/bin/nmap-4.01-1.spec': Out of memory
cp: can't create '/system/bin/nmap-mac-prefixes': Out of memory
cp: can't create '/system/bin/nmap-os-fingerprints': Out of memory
cp: can't create '/system/bin/nmap-protocols': Out of memory
cp: can't create '/system/bin/nmap-rpc': Out of memory
cp: can't create '/system/bin/nmap-service-probes': Out of memory
cp: can't create '/system/bin/nmap-services': Out of memory
# df /system
df /system
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/block/mtdblock3 245760 240824 4936 98% /system
# mount
mount
...
/dev/block/mtdblock3 on /system type yaffs2 (rw)
Code:
mount -o rw,remount -t yaffs2 /
rm -Rf /nmap
mkdir /nmap
echo 'export PATH=$PATH:/nmap' > path
cd /nmap
wget http://rmccurdy.com/stuff/G1/BINS/NMAP/NMAP.zip
unzip NMAP.zip
chmod 777 /nmap/*
export PATH=$PATH:/nmap
echo run /nmap/path before you start nmap
nmap -vvv 127.0.0.1
rmccurdy.com/nmap.sh (tested on CM6 / mytouch slide )
in normal mode ..
Code:
bash
localhost / # mount -o rw,remount -t yaffs2 /system
mount -o rw,remount -t yaffs2 /system
localhost / # cd /system
cd /system
localhost system # for i in `ls` ;do mkdir $i\\nmap ;done
for i in `ls` ;do mkdir $i\\nmap ;done
mkdir: can't create directory 'app\nmap': Out of memory
mkdir: can't create directory 'bin\nmap': Out of memory
mkdir: can't create directory 'build.prop\nmap': Out of memory
mkdir: can't create directory 'etc\nmap': Out of memory
mkdir: can't create directory 'fonts\nmap': Out of memory
mkdir: can't create directory 'framework\nmap': Out of memory
mkdir: can't create directory 'lib\nmap': Out of memory
mkdir: can't create directory 'lost+found\nmap': Out of memory
mkdir: can't create directory 'media\nmap': Out of memory
mkdir: can't create directory 'usr\nmap': Out of memory
mkdir: can't create directory 'xbin\nmap': Out of memory
in "Android system recovery (2e)" :
( note: /system is also a vfs I think .. I adb push to it and reboot and the file is gone ... )
Code:
C:\Documents and Settings\Administrator\nmap>adb shell
- exec '/system/bin/sh' failed: No such file or directory (2) -
C:\Documents and Settings\Administrator\nmap>
You can't write in /system in normal boot mode as security is on (s-on), remounting rw does you no good.
In recovery you will need to mount /system from clockwork before you can do anything.
I do have Clockwork Recovery 2.5.0.1 but I am not sure how to get to a shell and or find /system mount path as I can't adb shell ( read above ) so I can't remount or mount /system
rmccurdy.com/nmap.sh * this is what I am using for nmap as of now ..
Usage:
bash -x /sdcard/nmap.sh localhost
etc ...
There's an option in clockwork under partitions to allow you to mount the system. I'm not sure why but a lot of people have an issue getting into su with adb when they are in recovery, the constant /system/bin/sh error is annoying. Also, if I remember right, yaffs2 is not what you use to mount the system when using that command. It's mtdblock3 or something like that if I'm thinking along the correct lines here.
Maybe you should try putting it in a zip file as a script and running it that way since you use a different command (and much easier) to mount the system and write to it. Then again, I'm not sure what you're trying to so so I could just be talking out of my a$$
I can't do anything usefull in recovery ... reboot and apply update.zip but I dont how how nor do I really want to make a .zip / script to mount system etc .. do you know a zip I can work from as an example
rmccurdy said:
I can't do anything usefull in recovery ... reboot and apply update.zip but I dont how how nor do I really want to make a .zip / script to mount system etc .. do you know a zip I can work from as an example
Click to expand...
Click to collapse
The slide doesn't have S-Off, most HTC phones have them now...So you have to wait for Alpharev 2.0 to be released.
Ace42 said:
The slide doesn't have S-Off, most HTC phones have them now...So you have to wait for Alpharev 2.0 to be released.
Click to expand...
Click to collapse
Yes, but in recovery we can mount the system and write to it. Phones with s-off can do that while booted normally because the NAND is unlocked and the system is no longer protected.
You can do it one of two ways. This one is easiest if you know linux commands but are unfamiliar with update-script format. Make an update script and put this in there:
Code:
show_progress 0.5 0
run_program PACKAGE:example.sh
show_progress 0.5 10
You don't have to use the show_progress line, it's just for aesthetics.
Make a .sh script, name it whatever you want and put the linux commands you want to execute in the script. For example:
Code:
#!/sbin/sh
#
##############################################
mount /system;
rm -rf /nmap
mkdir /nmap
echo 'export PATH=$PATH:/nmap' > path
cd /nmap
wget http://rmccurdy.com/stuff/G1/BINS/NMAP/NMAP.zip
unzip NMAP.zip
chmod 777 /nmap/*
export PATH=$PATH:/nmap
echo run /nmap/path before you start nmap
nmap -vvv 127.0.0.1
exit 0;
Or what ever you're trying to get done. I'll upload an example file of all this since hands on is always better. Looking at this though, you may want to have the files in the zip (in the directories they will be installed to) because wget probably wont work since the radio is off while in recovery.
interesting thanks ! ... do you have to resign it and all or can you just edit and rezip it ?
rmccurdy said:
interesting thanks ! ... do you have to resign it and all or can you just edit and rezip it ?
Click to expand...
Click to collapse
As long as you're using clockwork you just edit and zip. Might be easier to use an archive explorer to open (without uzipping it) then drag and drop, but do what's easiest for you.

[HowTo] homebrew your custom Ubuntu image for Iconia A500

I'm posting this in a new thread as requested...
There is a simple way to preapare a custom Ubuntu image file compiled for ARMEL with only the packages and functionalities you need.
For this procedure you will need
- a linux machine with working ADB (I tried it on a x64 ubuntu machine)
- a rooted Iconia A500 with busybox installed
- a little knowledge about what you're doing, but just a little.
1. Install Rootstock
on your linux machine, open up the terminal and type
Code:
sudo apt-get install rootstock
If you use at least Ubuntu Karmic, it should automatically pull all the dependencies, otherwise you'll have to manually install Qemu and a newer debootstrap.
2. Create the tarball
you're ready to download the packages and prepare the tarball.
Remember: rootstock doesn't automatically include a kernel, so you'll have to manually include it in the package list
Here's the syntax for a basic run (run "man rootstock" for all the parameters):
Code:
sudo rootstock \
--fqdn [COLOR="Red"]<YOUR_CHOSEN_HOSTNAME>[/COLOR] \
--login [COLOR="Red"]<YOUR_CHOSEN_USERNAME>[/COLOR] \
--password [COLOR="Red"]<YOUR_CHOSEN_PASSWORD>[/COLOR] \
--imagesize [COLOR="Red"]<IMAGE_SIZE_IN_GB>[/COLOR]G \
--seed [COLOR="Red"]<LIST_OF_PACKAGES_SEPARATED_BY_COMMAS>[/COLOR]
Here's an example for a 2GB image with OMAP kernel and a complete Kubuntu-desktop distribution:
Code:
sudo rootstock \
--fqdn ubuntu \
--login ubuntu \
--password ubuntu \
--imagesize 2G \
--seed linux-image-omap,kubuntu-desktop
In --seed you can specify whatever package you want. You could start with just the kernel and build-essential, then add whatever you need. A good start could be like this:
Code:
--seed linux-image-omap,build-essential,lxde,tightvncserver,openssh-server
This will give you a running ubuntu with a very light, performance-oriented desktop environment (lxde) with ssh and vnc.
Remember: It's still possible to add new packages with apt-get from chroot whenever you want.
Once you have chosen the packages you want, you just have to press enter and rootstock will automatic download the packages and prepare the tarball.
You'll end up with a file named "armel-rootfs-<TIMESTAMP>.tgz"
3. Prepare the img file
This is very easy and quick:
Code:
dd if=/dev/zero of=arm_ubuntu.img bs=1MB count=0 seek=[COLOR="Red"]<SIZE_IN_MB>[/COLOR]
The seek parameter defines the size in MB of your image. make it as large as you want, it should at least be as big as the size you selected for the tarball (2G in my example).
Remember: 1 GB = 1024 MB
Now we format the image. Since the Iconia supports ext4 file system, we can use it!
Code:
mkfs.ext4 -F arm_ubuntu.img
You may want to pass other flags to define advanced options, labels and reserved blocks, but this is the least you need to make it work.
4. Decompress
Now we have to mount the img file in a loop:
Code:
sudo mount -o loop arm_ubuntu.img /mnt
and decompress the tarball into it.
Code:
sudo tar -C /mnt -zxf armel-rootfs-<TIMESTAMP>.tgz
It's done!
[OPTIONAL]
This is the right time to put custom scripts in /mnt/usr/bin like this one to start the vnc server with the correct geometry for the A500:
Code:
#!/bin/bash
rm -fr /tmp/.X1*
vncserver -geometry 1280x752
NB: the A500 screen is 1280x800, but the honeycomb statusbar (1280x48px) is always on top. To avoid panning to show the ubuntu menu bar, we just subtract those 48 pixels from the ubuntu vertical resolution.
Now we just umount it.
Code:
sudo umount /mnt
5. Load on the tablet and get it running
The script to mount and boot is derived from the one in the Backtrack 5 Thread.
Load the img file on the tablet with
Code:
adb push arm_ubuntu.img /sdcard/ubuntu/arm_ubuntu.img
It will take a loooong time and there's no progress bar, so just have faith.
Next, we prepare the boot script. The only thing you need to do is to put your username in (the one you chose in rootstock).
Code:
perm=$(id|cut -b 5)
if [ "$perm" != "0" ];then echo "This Script Needs Root! Type : su";exit;fi
mount -o remount,rw /dev/block/mmcblk0p5 /system
export kit=/sdcard/ubuntu
export bin=/system/bin
export mnt=/data/local/mnt
mkdir -p $mnt
export PATH=$bin:/usr/bin:/usr/local/bin:/usr/sbin:/bin:/usr/local/sbin:/usr/games:$PATH
export TERM=linux
export USER=[B][COLOR="Red"]<THE_USERNAME_YOU_CHOSE_BEFORE>[/COLOR][/B]
export HOME=/home/$USER
export stor=$mnt/home/$USER/storage
export sdcard=$stor/sdcard
export extsd=$stor/external_sd
export usb=$stor/USB_storage
if [ -b /dev/loop2 ]; then
echo "Loop device exists"
else
busybox mknod /dev/loop2 b 7 0
fi
mount -o loop,rw,noatime -t ext4 $kit/arm_ubuntu.img $mnt
echo "mounting storage devices in $stor..."
mkdir -p $sdcard
mkdir -p $extsd
mkdir -p $usb
busybox mount --bind /mnt/sdcard $sdcard
busybox mount --bind /mnt/external_sd $extsd
busybox mount --bind /mnt/usb_storage $usb
mount -t devpts devpts $mnt/dev/pts
mount -t proc proc $mnt/proc
mount -t sysfs sysfs $mnt/sys
busybox sysctl -w net.ipv4.ip_forward=1
echo "nameserver 8.8.8.8" > $mnt/etc/resolv.conf
echo "127.0.0.1 localhost ubuntu" > $mnt/etc/hosts
busybox chroot $mnt /bin/bash
echo "Shutting down Ubuntu ARM for Iconia A500"
umount $sdcard
umount $extsd
umount $usb
umount $mnt/dev/pts
umount $mnt/proc
umount $mnt/sys
umount $mnt
Once done, we can save the file as startubuntu and adb push it to the tab. (the same folder as the img is fine)
Done! We run it by invoking the startubuntu script from the android terminal emulator (must be in superuser mode)
I hope you found this how-to useful.
And we use this distro via our tablets ssh client?
EDIT: sorry my bad Never read code while tired
Hi,
i am running ubuntu natty.
and i got this error:
...
Setting up wireless-crda (1.13) ...
Setting up linux-image-2.6.38-8-omap (2.6.38-8.42) ...
Running depmod.
update-initramfs: Generating /boot/initrd.img-2.6.38-8-omap
/bin/df: Warning: cannot read table of mounted file systems: No such file or directory
Not sure if it is fatal. rootstock has created successful the rootfs
reida010 said:
Hi,
i am running ubuntu natty.
and i got this error:
...
Setting up wireless-crda (1.13) ...
Setting up linux-image-2.6.38-8-omap (2.6.38-8.42) ...
Running depmod.
update-initramfs: Generating /boot/initrd.img-2.6.38-8-omap
/bin/df: Warning: cannot read table of mounted file systems: No such file or directory
Not sure if it is fatal. rootstock has created successful the rootfs
Click to expand...
Click to collapse
Same happened to me. Totally not fatal. the tarball is good.
For everyone out there:
I would like your help with testing. I have a crash on start problem with firefox in all the images I tried. Does any of you have the same issue?
Hi,
i get
Code:
Loop device exists
then i did
Code:
echo "$kit/arm_ubuntu.img"
and i get
Code:
/sdcard/ubuntu/arm_ubuntu.img
but then i get
Code:
mount: cannot setup loop device: No such file or directory
any ideas?
Because of firefox.
i read a while ago a tweet about a bug in meego and ubuntu in firefox for arm.
when it is this bug then you should try firefox trunk because it is fixed.
but i cannot refind it :-(
edit:
bugzilla.mozilla.org/show_bug.cgi?id=634594
I was searching for that today, thanks mate. Nice Tutorial =D
reida010 said:
Hi,
but then i get
Code:
mount: cannot setup loop device: No such file or directory
any ideas?
edit:
bugzilla.mozilla.org/show_bug.cgi?id=634594
Click to expand...
Click to collapse
i have the same problem. You should make loop file not in /mnt/sdcard, but in /mnt/external_sd.
Kh_Shad said:
i have the same problem. You should make loop file not in /mnt/sdcard, but in /mnt/external_sd.
Click to expand...
Click to collapse
That would apply only if you put the image file in the external MicroSD, if you have put it in the internal memory (as described in the tutorial) the path is /mnt/sdcard. Also, the speed of the internal memory is better.
Hi,
i found out how i can make it work
but it's strange.
i don't works when i do
Code:
sh ./startubuntu
but with this it works fine:
Code:
/system/bin/sh ./startubuntu
Is this maybe because i didn't use adb.
Someone told me that copy paste might change the permissions (what the ****! really?)
on my tablet startubuntu is not executable.
And it doesn't change anything when i do chmod 755 startubuntu
but after moving it to /system/bin chmod works fine.
After then i can always just run
Code:
su
startubuntu
and ubuntu is up and running.
(many thanks by the way :-D)
Sorry guys, will this method produce a native Ubuntu install similair to how Wubi works? Or is this like the chroot methods were we have to VNC into the distro from within Android?
It is native!!!
but you need vnc to access the xserver
On my n900 i used xephyr but i don't think this is working for android because afaik they don't use X. (n900 is so cool for linux geeks ;-D)
edit:
if you mean with 'native' that it will replace android -> no -> it is a chroot
Yeah that answered my question. Thank you
I'm not going to bother until there is a native distro running with full system resources. I guess with the current bootloader situation that day may never come :-(
It failed in creating the image for me... and it seems like a error in the package linux-image-2.6.38-8-omap
[TRIM]
Need to get 37.4 MB of archives.
After this operation, 98.3 MB of additional disk space will be used.
Get:1 //ports.ubuntu.com/ubuntu-ports/ natty/main wireless-crda armel 1.13 [15.0 kB]
Get:2 //ports.ubuntu.com/ubuntu-ports/ natty/main linux-image-2.6.38-8-omap armel 2.6.38-8.42 [19.8 MB]
Get:3 //ports.ubuntu.com/ubuntu-ports/ natty/main devio armel 1.2-1build1 [16.9 kB]
Get:4 //ports.ubuntu.com/ubuntu-ports/ natty/main flash-kernel armel 2.28ubuntu19 [13.1 kB]
Get:5 //ports.ubuntu.com/ubuntu-ports/ natty/universe kubuntu-mobile armel 1.218 [2720 B]
Get:6 //ports.ubuntu.com/ubuntu-ports/ natty/main linux-firmware all 1.52 [17.5 MB]
Get:7 //ports.ubuntu.com/ubuntu-ports/ natty/main linux-image-omap armel 2.6.38.8.22 [2394 B]
Fetched 37.4 MB in 5min 29s (113 kB/s)
Selecting previously deselected package wireless-crda.
(Reading database ... 9309 files and directories currently installed.)
Unpacking wireless-crda (from .../wireless-crda_1.13_armel.deb) ...
Selecting previously deselected package linux-image-2.6.38-8-omap.
Unpacking linux-image-2.6.38-8-omap (from .../linux-image-2.6.38-8-omap_2.6.38-8.42_armel.deb) ...
Done.
Selecting previously deselected package devio.
Unpacking devio (from .../devio_1.2-1build1_armel.deb) ...
Selecting previously deselected package flash-kernel.
Unpacking flash-kernel (from .../flash-kernel_2.28ubuntu19_armel.deb) ...
Selecting previously deselected package kubuntu-mobile.
Unpacking kubuntu-mobile (from .../kubuntu-mobile_1.218_armel.deb) ...
Selecting previously deselected package linux-firmware.
Unpacking linux-firmware (from .../linux-firmware_1.52_all.deb) ...
Selecting previously deselected package linux-image-omap.
Unpacking linux-image-omap (from .../linux-image-omap_2.6.38.8.22_armel.deb) ...
Setting up wireless-crda (1.13) ...
Setting up linux-image-2.6.38-8-omap (2.6.38-8.42) ...
Running depmod.
Failed to run depmod
dpkg: error processing linux-image-2.6.38-8-omap (--configure):
subprocess installed post-installation script returned error exit status 1
Setting up devio (1.2-1build1) ...
No apport report written because MaxReports is reached already
Setting up flash-kernel (2.28ubuntu19) ...
Setting up kubuntu-mobile (1.218) ...
E: Second stage build in chroot failed !
E: Please see the log to see what went wrong.
Setting up linux-firmware (1.52) ...
I: Cleaning up...
dpkg: dependency problems prevent configuration of linux-image-omap:
linux-image-omap depends on linux-image-2.6.38-8-omap; however:
Package linux-image-2.6.38-8-omap is not configured yet.
dpkg: error processing linux-image-omap (--configure):
dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
Errors were encountered while processing:
linux-image-2.6.38-8-omap
linux-image-omap
E: Sub-process /usr/bin/dpkg returned an error code (1)
I: Umounting temporary Image
I keep getting a failure also!
Ceck out both of my log files below.
tholmewood said:
Sorry guys, will this method produce a native Ubuntu install similair to how Wubi works? Or is this like the chroot methods were we have to VNC into the distro from within Android?
Click to expand...
Click to collapse
It is a chroot/vnc method, currently the only method available to run linux on this device, because of the locked bootloader... I seriously hope for a chance to dual boot in the future.
i was wondering what packages are needed in order to create an ubuntu netbook Edition? Is the A500 powerful enough for that kind of interface?
Thought you guys might be interested in this post.
http://forum.xda-developers.com/showpost.php?p=15156543&postcount=64
Have fun!
@p-ille
Have you tried firefox daily?
Did it work?
reida010 said:
@p-ille
Have you tried firefox daily?
Did it work?
Click to expand...
Click to collapse
Not really, my job is killing me these days... I'll try it asap!
sent from my Iconia A500
p-ille said:
Not really, my job is killing me these days... I'll try it asap!
sent from my Iconia A500
Click to expand...
Click to collapse
You realize what a pain that tutorial is to follow? Could you please provide a pre built image at least if asking for scripts is probably way too much?

[Q] Flashing HD2 without touch screen

Hy.
I have a HTC HD2 with a dead touch screen (I can read, but touch is not reactive). I could reset it to factory settings via buttons. So I have a Windows Welcome screen.
I can also enter HSPL.
Is it possible to flash the device, and install Android without working screen ?
Once I have Android, I can do stuff with the device, and use it as VNC client, and manage remotly via ssh. My problem is to install Android on it. Most tutos say at one step or an other to activate ActiveSync in Windows, what is not possible for me.
I am used to HTC Sensation, and to all classic Android tools (adb, fastboot). I have Windows and Linux hosts.
Classic tutos are not usable for me.
Otherwise, the device will go for sale, for peaces. 10€.
Thanks.
voldown + power --> bootloader,
fhlash hspl
flash radio 2.15.50
flash magldr
use toolkit to apply partition size and cwm
into cwm
flash rom from zip
no touchscreen necessary
the instruction about activesync is a red herring, , it doesn't refer to the app on the PC, and it doesn't require winmo to be running on the phone either, it just means get a usb connection.
however if you have trouble flashing hspl, then manually updating windowsmobiledevicecenter (find it on microsoft website) will help fix driver errors, and later, when you get into magldr and start using 'usb flasher' you may wanna install 'myphoneexplorer' for the android drivers it comes with.
^That's true, but you might have a problem with Aroma installer. I think it may work with the volume keys too, but if it doesn't then you'll have to find a ROM which doesn't use Aroma (most relatively old ROMs don't) and flash that instead.
Nigeldg said:
^That's true, but you might have a problem with Aroma installer. I think it may work with the volume keys too, but if it doesn't then you'll have to find a ROM which doesn't use Aroma (most relatively old ROMs don't) and flash that instead.
Click to expand...
Click to collapse
Aroma does work without touchscreen, buttons can be used to select the default choices, (can't recall if volume buttons can used to change selected option, so may need to edit ROM zip so the defaults are what you want). The issue I'd see is how you go about issuing commands and starting apps; it's possible of course - there are commands to simulate screen presses (monkeyrunner) and command to start apps/processes but those commands can get complicated.
If you get a VNC system set up without touchscreen then could you add your procedure?
I am stuck at almost last step: pushing CWM: I have downloaded Recovery-400 from http://www.filecrop.com/Clockworkmod-Recovery-hd2.html , but I get the RSPL error message. I have Windows XP SP3 with .NET3 SP1, so i am admin, i have EnterBootloader.exe and rapidtool.exe, and I have unticked the USB stuff in ActiveSync ... but i am still stuck at the RSPL error :/
About going further: if I have ADB access from CWM, I will just install Armel by copying from my Sensation (Debian Armel have been installed using LinuxInstaller by Galoula). If i don't have adb, I will have to pre-install it in the zip, and reflash. In short, I push a chrootable env, and find an init script that will run sshd after boot. Once I have ssh, i'm done.
I had to install RAPI.dll, and CEUTIL.dll (found in google), re-install ActiveSync, and use a very specific ROM. HD2toolkit did not work at all for me. I forgot how I installed MAGDLR, but it was PITA to install it. And once installed, I spent 2 days on trying to use it. Putting ROMs on uSD does not allow to install the from SD.
After viewing http://cdn.youtubeavi.com/view-video/0TpYHpfHW-8 (confirmed by reading http://resetguide.com/2012/05/how-to-install-android-on-hd2-nand/ ), I saw that amongst my 1GB of data downloaded in the last days, I did not have the file ANDR_install.exe; I downloaded all possible ROMs until I find one having this magic file: http://forum.xda-developers.com/showthread.php?t=893637 . Only this ROM has andr_install.exe . And when I ran it, it worked on the first time (while of course having HD with MAGLDR on option 5: USB flash).
Now, my HD2 started Android. I still can not use it at all for now, but at least, I have made a step.
adb works, so it will probably be very easy for me. From ADB, I can do almost anything: install APKs(pm install), getprop, remount /system rw, install Debian manually ... the hardest part may be to click on buttons, but I can find a WA for this: create minimal apps on my other Android phone, using Tasker with AppFactory, apps which will be able to send keystrokes, and start them as required. Long way, but should work (if I don't have CPU uncompat issues). Anyway, without touch pad, it's not gonna stay a "phone"; it will mostly be a VNC-viewer for other devices (like my RaspberryPi).
Hell I am lucky: both HTD HD2 and HTC Sensation use the exact same CPU: "ARMv7 Processor rev 2 (v7l)" . Gonna be trivial to have fun around An example to install a VNC-client:
Code:
[email protected] /tmp $ adb -s SH169V80XXXX pull /data/app/android.androidVNC-1.apk
1703 KB/s (245795 bytes in 0.140s)
[email protected] /tmp $
[email protected] /tmp $ adb -s 0123456789ABCDEF install android.androidVNC-1.apk
2015 KB/s (245795 bytes in 0.119s)
pkg: /data/local/tmp/android.androidVNC-1.apk
Success
[email protected] /tmp $
Same for server.
Like in my Sensation (definitly, I am lucky), I have a free folder in the default PATH :
Code:
localhost / # echo $PATH
/sbin:/system/sbin:/system/xbin:/system/bin
localhost / # ls /system/
app dmesg.txt framework lost+found lost+found xbin
bin etc lib lost+found media
build.prop fonts lost+found lost+found usr
localhost / #
so, let's populate it
Code:
localhost / # df -h
Filesystem Size Used Available Use% Mounted on
tmpfs 205.9M 0 205.9M 0% /dev
tmpfs 205.9M 0 205.9M 0% /mnt/asec
/dev/block/mtdblock1 127.3M 118.8M 8.5M 93% /system
/dev/block/mtdblock3 248.8M 65.2M 183.5M 26% /data
/dev/block/mtdblock2 40.0M 1.1M 38.9M 3% /cache
/dev/block/vold/179:1
3.7G 2.3G 1.4G 63% /mnt/sdcard
/dev/block/vold/179:1
3.7G 2.3G 1.4G 63% /mnt/secure/asec
localhost / # mount -o remount,rw /dev/block/mtdblock1 /system
localhost / # cd /system/
localhost system # ln -s /data/local/bin/ sbin
localhost system #
Now add my personal boot script:
Code:
localhost system # cd /etc/init.d/
localhost init.d # ls -l
-rwxrwxrwx 1 root root 365 Feb 29 2008 00banner
-rwxrwxrwx 1 root root 27 Oct 9 2010 01sysctl
-rwxrwxrwx 1 root root 229 Feb 29 2008 03firstboot
-rwxrwxrwx 1 root root 105 Feb 29 2008 04modules
-rwxrwxrwx 1 root root 1593 Feb 29 2008 05mountsd
-rwxrwxrwx 1 root root 794 Feb 29 2008 20userinit
localhost init.d # ln -s /data/local/bin/rc.local 99doublehp
localhost init.d #
and populate /data as required:
Code:
bash-3.2# tar -czf bin.tgz /data/local/bin/
tar: removing leading '/' from member names
bash-3.2#
[email protected] /tmp $ adb -s SH169V80XXXX pull /data/app/bin.tgz
3660 KB/s (411734 bytes in 0.109s)
[email protected] /tmp $
[email protected] /tmp $ adb -s 0123456789ABCDEF push bin.tgz /data/local/tmp/
1972 KB/s (411734 bytes in 0.203s)
[email protected] /tmp $
localhost / # tar -xvzf /data/local/tmp/bin.tgz
data/local/bin/
data/local/bin/cpu
data/local/bin/rc.local
data/local/bin/psa
[...]
ah ... at last, ONE difference:
Code:
localhost / # head -n1 /system/sbin/psa
#!/system/bin/bash
localhost / # which bash
/system/xbin/bash
localhost / #
localhost / # cd /system/bin/
localhost bin # ln -s ../xbin/bash .
localhost bin #
No way to edit each and every script ^^
Most important one for debugging:
Code:
localhost ~ # vibrate 100
Voltage not provided. Using default 3100 mV.
/system/sbin/vibrate: line 37: /sys/devices/virtual/timed_output/vibrator/voltage_level: No such file or directory
localhost ~ # vibrate 500
Voltage not provided. Using default 3100 mV.
/system/sbin/vibrate: line 37: /sys/devices/virtual/timed_output/vibrator/voltage_level: No such file or directory
localhost ~ #
Let's prepare the SDcard for Debian use; since CM6 does not have mkfs.ext3, I did that on my workstation.
Code:
localhost / # mkdir -p /data/local/mnt/sdcard_ext
localhost / # mount /dev/block/mmcblk0p1 /data/local/mnt/sdcard_ext/
localhost / #
I should have started by this (to help understand these logs), but it's never too late:
on HD: vi /etc/bash/bashrc
PS1='\[\033[01;31m\][email protected]\[\033[01;34m\]:\w\[\033[00m\] '
on Sensation: vi $HOME/.bashrc
PS1='\[\033[01;31m\][email protected]\[\033[01;34m\]:\w\[\033[00m\] '
This prompt is handy so that I can do copy-paste of the prompt itself for use with scp and rsync: if I am at one place in ssh, I can copy the prompt to scp a file there from an other machine.
So ... I was about to copy my Debian: I put both SDcards in the workstation.
Code:
[email protected]:~ cp -a /media/uSD_ext3/Linux /media/Hmmm/
Remove sshd keys to force regen ( /etc/ssh/ssh_host_*). Update hostname (it never properly worked in Armel).
... I'll continue overnight.
doublehp said:
I
After viewing http://cdn.youtubeavi.com/view-video/0TpYHpfHW-8 (confirmed by reading http://resetguide.com/2012/05/how-to-install-android-on-hd2-nand/ ), I saw that amongst my 1GB of data downloaded in the last days, I did not have the file ANDR_install.exe; I downloaded all possible ROMs until I find one having this magic file: http://forum.xda-developers.com/showthread.php?t=893637 . Only this ROM has andr_install.exe . And when I ran it, it worked on the first time (while of course having HD with MAGLDR on option 5: USB flash).
Click to expand...
Click to collapse
...because thats the old, outdated way of installing android,, pre-nand recovery, , and those are old, outdated android roms which is why only they have the 'magic' (now obsolete) file.
samsamuel they may be outdated, but I love CM6 (after 1h of use, I find it very good), and no other method worked (4 or 5 other different methods all ended up in the RSPL.cpp issue).
To take control of my new Android, a friend told me to try AndroidScreenCast. It's some kind of VNC, specially written for Android.
Once Android is installed, you can have fun with it, without touchpad, by using http://code.google.com/p/androidscreencast/ . I am lucky that on CM6, adb was enabled by default. Download http://androidscreencast.googlecode.com/svn/trunk/AndroidScreencast/dist/androidscreencast.jnlp and run it with
Code:
javaws androidscreencast.jnlp
I will try to not use it at all. I tried it, just so that I can tell "it works", and discard all welcome menus. Did not even configure Wifi.

[Guide] Debian on Android (rooted)

Hi, this is a guide to install a Linux image on your rooted Android phone with the debootstrap + chroot method.
In this guide, we'll install a Debian image, but the steps are practically the same, with a few tweaks.
If you need help to install a Linux image, feel free to ask on this thread.
For this guide, all credit goes to them:
http://linux-expert.net/?Trucs_et_astuces___Android___Tutoriel_%3A_Chroot_Debian (in french)
http://forum.xda-developers.com/showthread.php?p=45457799
http://forum.xda-developers.com/showthread.php?t=2312013
http://forum.xda-developers.com/showthread.php?t=631389
http://forum.xda-developers.com/showthread.php?t=1418546
http://forum.xda-developers.com/showpost.php?p=5671794&postcount=124
VNC
________________
I. On your PC
So first, you have to create the .img file that will contain the OS.
In a GNU/Linux environment (PC) and with the root permissions, type these commands:
Code:
# mkdir debian
# dd if=/dev/zero of=wheezy-armhf.img bs=1M count=0 seek=2048
[COLOR="Red"](NOTE: "of=" will be the name of our .img file and "seek=" the size of the file (MB). Here, we create a file named "wheezy-armhf.img" of 2 GB)[/COLOR]
# mkfs.ext4 -F wheezy-armhf.img
# mount -o loop wheezy-armhf.img /debian
Then we have to fill up the filesystem.
Code:
# debootstrap --foreign --arch=armhf wheezy debian/
# umount debian
Finally, move it to your SD Card. In my case, I moved it on /data/local/
II. On your phone
On your phone, in a terminal emulator and with the root permissions, type the following commands:
Code:
# mount -o rw,remount rootfs /
# export LINUXROOT=/linux
(NOTE: here we'll install Debian on the root of the internal memory, in "/", but we can also install Debian on the SD Card or in /data/loca/linux by changing the path after "LINUXROOT=")
# mkdir $LINUXROOT
# busybox mknod /dev/block/loop100 b 7 100
# losetup /dev/block/loop100 /sdcard/wheezy-armhf.img
# mount -t ext4 /dev/block/loop100 $LINUXROOT
# chroot $LINUXROOT /bin/sh
# export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
# /debootstrap/debootstrap --second-stage
The debootstrap's second part should start. Grab a cup of coffee while it's working!
When it's finish, leave the chroot by typing
Code:
# exit
# su
Let's mount the filesystem. We're close!
Code:
# mount -t proc none /proc
# mount -t sysfs none /sys
# mount -o bind /dev /dev
# mount -t devpts none /dev/pts
Now, we have to set the environment variable. Ensure that you have set the correct path of LINUXROOT in case you've chosen another path than /linux.
Code:
# export LINUXROOT=/linux
# export TMPDIR=/tmp
# export USER=root
# export HOME=/root
# export SHELL=/bin/bash
# export TERM=linux
# export LC_ALL=C
# export LANGUAGE=C
# export LANG=C
And finally, chroot.
Code:
# chroot $LINUXROOT /bin/bash
su
Welcome on Debian!
III. DNS and Mirrors
Set a DNS. We'll set the free Google DNS but you can set yours if you want.
Code:
echo -e "domain local\nsearch local\n" >> /etc/resolv.conf
echo -e "# DNS Google\nnameserver 8.8.8.8\nnameserver 8.8.4.4\n" >> /etc/resolv.conf
You can add mirrors to your sources.list if you want. I'm french so I added french mirrors:
Code:
# echo -e "## Debian Wheezy sources.list\n\n" > /etc/apt/sources.list
# echo -e "## Debian.org FR mirror\ndeb http://ftp.fr.debian.org/debian/ wheezy main contrib non-free\ndeb-src http://ftp.fr.debian.org/debian/ wheezy main contrib non-free\n\n" >> /etc/apt/sources.list
# echo -e "## Debian security updates\ndeb http://security.debian.org/ wheezy/updates main contrib non-free\ndeb-src http://security.debian.org/ wheezy/updates main contrib non-free\n >> /etc/apt/sources.list
IV. VNC
To access your Debian in a graphical environment from your PC or your phone, you have to set up a VNC Server and install a Desktop Environment. Let's install VNC and LXDE.
We'll follow the steps described on the LXDE wiki:
Code:
su
# apt-get update
# apt-get install lxde
# apt-get install tightvncserver
Set up the VNC server by typing the following command, which will ask you to set two passwords (let the second password if you want):
Code:
# vncserver
Kill the session:
Code:
# vncserver -kill :1
Go to /root/.vnc/ and edit the xstartup file: comment out #/etc/X11/xsession and add these two lines:
icewm
lxsession
Click to expand...
Click to collapse
To start a VNC session, type "vncserver -geometry x". For the Nexus 4, we would type "vncserver -geometry 1184x768"
To access your Desktop Environment from your phone, download android-vnc-viewer and launch it.
In the password field, type your password. In the address field, type "127.0.0.1", in port type "5901" and select 24-bit color (4bpp).
V. Script
I've made three scripts to mount, launch and unmount Debian. Whenever you reboot your phone, you'll have to mount Debian, set the environment variables and chroot.
VI. Credit
All credit goes to them:
http://linux-expert.net/?Trucs_et_astuces___Android___Tutoriel_%3A_Chroot_Debian (in french)
http://forum.xda-developers.com/showthread.php?t=2312013
http://forum.xda-developers.com/showthread.php?t=631389
http://forum.xda-developers.com/showthread.php?t=1418546
http://forum.xda-developers.com/showpost.php?p=5671794&postcount=124
VNC
Sorry for my bad english, I hope this will help
EDIT: Feel free to correct me!
Hi, I have 2021 updates, if someone interested. Tested with rooted LineageOS 17 (selinux permissive - not sure if required, my ROM is permissive, didn't set it explicitly):
for 32-bit ARM, ext4 created by 64-bit Linux didn't work, obviously there is some 64-bit feature that was not supported at least with my kernel (3.14). I've in the end created the FS on the Android, but using "-O '^64bit'" could be sufficient in the Linux. UPDATE: I've in the end used F2FS instead of EXT4.
above mknod+losetup+mount didn't work for me (neither 'mount -o loop -t ext4 <img>'), I've used 'mount -t ext4 $(losetup -sf /sdcard/stable-armhf.img) $LINUXROOT' in the end (obviously the device name needs to be saved somewhere if one wants to cleanly umount)
there was issue with network access denied even if you are root, see here. I've fixed it by creating the group 'inet/3003' in the chroot and issuing 'newgrp inet' inside it (more details in the link).
Anyways, thanks a lot for the above instructions, it helped me much!

Categories

Resources