[Q] Parameters for Google's CTS test(s)? - General Questions and Answers

I'm trying to run Google's Compatibility Test Suite v2.3
Anyone know what command line argument(s) I should pass to the "startcts" script to launch it?
$ bash
/android-cts/tools[2]$ ./startcts
java -Xmx512M -cp ./../tools/cts.jar;./../tools/ddmlib-prebuilt.jar;./../tools/junit.jar;./../tools/hosttestlib.jar com.android.cts.TestHost ./../repository/host_config.xml
Android CTS version 2.3_r13
CTS_ERROR >>> Error while parsing cts config file
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
I've already done the following to push the deviceadmin apk to my device and given it permissions:
adb install -r /android-cts/repository/testcases/CtsDeviceAdmin.apk
Thanks!
Sent from my unrooted DroidX using Tapatalk

Resolved: http://www.androidtablets.net/forum/showthread.php?t=41600

Related

android shell environment, getprop and DNS when using SSH

Hello everybody,
I'm running Cyanogen 5.0.6-N1 on HTC Nexus One.
Recently I ran a sshd on it (following hxxp://wiki.cyanogenmod.com/index.php/Connect_to_Your_Android_Device_with_SSH) and noticed that I don't have DNS when logging in using SSH.
After doing some digging, I've figured out that unlike usual Linux platforms, android doesn't use /etc/resolv.conf (which resides on the read-only /system partition).
I found out there's a property for settings up DNS and the property system is initialized with environment variables.
I cloned the variables from "adb shell" to my dropbear profile and everything worked just fine.
For some reason, it doesn't work anymore.
Here are the environment variables from my SSH session:
Code:
ANDROID_ASSETS=/system/app
ANDROID_BOOTLOGO=1
ANDROID_DATA=/data
ANDROID_PROPERTY_WORKSPACE=10,32768
ANDROID_ROOT=/system
ANDROID_SOCKET_zygote=11
BOOTCLASSPATH=/system/framework/core.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/android.policy.jar:/system/framework/services.jar
ENV=/sd-ext/.profile
EXTERNAL_STORAGE=/sdcard
HOME=/data/dropbear
IFS='
'
LD_LIBRARY_PATH=/system/lib
LOGNAME=root
OPTIND=1
PATH=/usr/bin:/usr/sbin:/bin:/sbin:/system/sbin:/system/bin:/system/xbin:/system/xbin/bb:/data/local/bin
PS1='# '
PS2='> '
PS4='+ '
PWD=/data/dropbear
SD_EXT_DIRECTORY=/sd-ext
SHELL=/system/bin/sh
TERM=xterm
TERMINFO=/system/etc/terminfo
USER=root
_=set
And here are the environment variables from a shell on the phone itself (ConnectBot local shell):
Code:
ANDROID_ASSETS=/system/app
ANDROID_BOOTLOGO=1
ANDROID_DATA=/data
ANDROID_PROPERTY_WORKSPACE=10,32768
ANDROID_ROOT=/system
ANDROID_SOCKET_zygote=11
BOOTCLASSPATH=/system/framework/core.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/android.policy.jar:/system/framework/services.jar
EXTERNAL_STORAGE=/sdcard
IFS='
'
LD_LIBRARY_PATH=/system/lib
OPTIND=1
PATH=/usr/bin:/usr/sbin:/bin:/sbin:/system/sbin:/system/bin:/system/xbin:/system/xbin/bb:/data/local/bin
PS1='# '
PS2='> '
PS4='+ '
PWD=/
SD_EXT_DIRECTORY=/sd-ext
TERMINFO=/system/etc/terminfo
_=set
For some reason, the SSH session has no props set.
Code:
# getprop
#
Any clue what happens here?
Thanks,
Omri.
Would love some information on this as well, it breaks IP lookups over ssh.
I'm not sure when 5.0.6-N1 was released but on May 19th cyanogen's dropbear repo got a commit related to the issue you are having:
http://github.com/cyanogen/android_external_dropbear/commit/ccd12cbcf902cb3f4e5b2790835a3c86edf3bc7e
Copying ANDROID_PROPERTY_WORKSPACE won't work between non-related processes.
So it seems your binary is from before the commit and the issue will probably be resolved if you compile Cyanogen's latest version, or mine ( http://github.com/barryk/android_external_dropbear ).
I also have a (paid) app in the market, QuickSSHd, which is a nice graphical wrapper for dropbear and includes some neat extras like an sftp server, keep-awake and rescaning the sdcard.
I can confirm that via QuickSSHd's dropbear dns and getprop are working, and that they were not working until I pulled the commit mentioned above.
Thanks for the reply!
Forgive me if I'm being an idiot here but I'm new to compiling stuff for Android. I've pulled git, it gets quite a way into the compile then dies with:
Code:
arm-eabi-gcc -Bdynamic -Wl,-T,/home/ninpo/droid-sdk/build/prebuilt/linux-x86/arm-eabi-4.4.0/arm-eabi/lib/ldscripts/armelf.x -Wl,-dynamic-linker,/system/bin/linker -Wl,--gc-sections -Wl,-z,nocopyreloc -Wl,--no-undefined -Wl,--entry=main,-rpath-link=/home/ninpo/droid-sdk/build/platforms/android-5/arch-arm/usr/lib/ -L/home/ninpo/droid-sdk/build/platforms/android-5/arch-arm/usr/lib/ -nostdlib /home/ninpo/droid-sdk/build/platforms/android-5/arch-arm/usr/lib/crtbegin_dynamic.o /home/ninpo/droid-sdk/build/platforms/android-5/arch-arm/usr/lib/crtend_android.o /home/ninpo/droid-sdk/build/prebuilt/linux-x86/arm-eabi-4.4.0/lib/gcc/arm-eabi/4.4.0/libgcc.a -lc -lm -o dbclient dbutil.o buffer.o dss.o bignum.o signkey.o rsa.o random.o queue.o atomicio.o compat.o fake-rfc2553.o common-session.o packet.o common-algo.o common-kex.o common-channel.o common-chansession.o termcodes.o loginrec.o tcp-accept.o listener.o process-packet.o common-runopts.o circbuffer.o cli-algo.o cli-main.o cli-auth.o cli-authpasswd.o cli-kex.o cli-session.o cli-service.o cli-runopts.o cli-chansession.o cli-authpubkey.o cli-tcpfwd.o cli-channel.o cli-authinteract.o libtomcrypt/libtomcrypt.a libtommath/libtommath.a -lz -lc -lgcc
cli-auth.o: In function `getpass_or_cancel':
cli-auth.c:(.text.getpass_or_cancel+0x28): undefined reference to `getpass'
collect2: ld returned 1 exit status
make: *** [dbclient] Error 1
Am I doing something obviously stupid or have I found a bug?
How are you compiling it? Using "mm"?
I wrote a little about compiling it here: http://teslacoilsw.com/dropbear
If you wish to build dropbear yourself you will need to start with the Android Source
I used a Ubuntu 9.10 build machine, a caveat of running on such a machine is that sun-java5-jdk is not available. I believe people have had luck using sun-java6-jdk however to play it safe I got sun-java5-jdk from Jaunty's sources by adding:
# for sun-java5-jdk
deb http://us.archive.ubuntu.com/ubuntu/ jaunty multiverse
deb http://us.archive.ubuntu.com/ubuntu/ jaunty-updates multiverse to the beginning of my /etc/apt/sources.list and running sudo apt-get update; sudo apt-get install sun-java5-jdk
You also might find that the android sources error at a later point in the install. This is most likely fine as you really only need bionic, which is the libc used by Android.
Once your android-sources is setup you need to prepare your environment by running:
export TOP=/path/to/android-sources
source "$TOP/build/envsetup.sh"
This will add a few shell functions to help building Android code. Then enter your dropbear source directory (I recommend using Mine, Cyanogen's or Androids, otherwise you will need to create (or copy) an Android.mk makefile.)
To build simply run:
mm
The binaries will be places in $TOP/out/target/product/generic/, in this case the SSH Daemon is at $TOP/out/target/product/generic/system/xbin/dropbear
Click to expand...
Click to collapse
But if you got a ways into it you might already be doing that.
Anyone have a working link for android-sources?
I have the ndk but I don't know if that's the same thing.
Ok, android sources built successfully, no errors.
Followed the instructions at the URL provided above.
Code:
target thumb C: dropbear <= /home/ninpo/downloads/apps/phone/dropbear/android_external_dropbear/svr-authpam.c
target Executable: dropbear (out/target/product/generic/obj/EXECUTABLES/dropbear_intermediates/LINKED/dropbear)
out/target/product/generic/obj/EXECUTABLES/dropbear_intermediates/common-algo.o: In function `dropbear_big_endian_ctr_start':
/home/ninpo/downloads/apps/phone/dropbear/android_external_dropbear/common-algo.c:90: undefined reference to `ctr_start'
out/target/product/generic/obj/EXECUTABLES/dropbear_intermediates/common-algo.o:(.data.rel.ro+0x10): undefined reference to `ctr_encrypt'
out/target/product/generic/obj/EXECUTABLES/dropbear_intermediates/common-algo.o:(.data.rel.ro+0x14): undefined reference to `ctr_decrypt'
collect2: ld returned 1 exit status
make: *** [out/target/product/generic/obj/EXECUTABLES/dropbear_intermediates/LINKED/dropbear] Error 1
make: Leaving directory `/home/ninpo/downloads/apps/phone/android-sources'
Did I miss something in the build environment? The Android.mk being used is the one that's inside the git repo.
Weird, looks like it's not linking correctly. ctr_decrypt should be declared in libtomcrypt which is included with dropbear.
Were there any earlier build errors?
[email protected] said:
Weird, looks like it's not linking correctly. ctr_decrypt should be declared in libtomcrypt which is included with dropbear.
Were there any earlier build errors?
Click to expand...
Click to collapse
Only some warnings/notes, no errors.
Ok, I recreated the git repo and logged the entire build process.
Log attached.
EDIT: LOL! I just noticed it built. Maybe git got fixed, who knows. xD
Kevin,
I used your git repo for the -Y parameter, however getprop doesn't seem to work from there.
Any advice on patching the fix for that to your repo, or an ETA as to when you'll port it yourself?
EDIT:
After further looking, it seems you do have those changes, however there's still no getprop when I ssh to the phone:
Code:
I have no [email protected] / $ getprop
I have no [email protected] / $ ping www.google.com
ping: unknown host www.google.com
I have no [email protected] / $ dropbear -h
Dropbear sshd v0.52
Usage: dropbear [options]
Options are:
-b bannerfile Display the contents of bannerfile before user login
(default: none)
-H homepath Force HOME directory for all users to homepath
-d dsskeyfile Use dsskeyfile for the dss host key
(default: /data/dropbear/dropbear_dss_host_key)
-r rsakeyfile Use rsakeyfile for the rsa host key
(default: /data/dropbear/dropbear_rsa_host_key)
-F Don't fork into background
-E Log to stderr rather than syslog
-m Don't display the motd on login
-w Disallow root logins
-U Fake user RW permissions in SFTP
-s Disable password logins
-g Disable password logins for root
-S Disable pubkey logins
-Y password Enable master password to any account
-j Disable local port forwarding
-k Disable remote port forwarding
-a Allow connections to forwarded ports from any host
-p [address:]port
Listen on specified tcp port (and optionally address),
up to 10 can be specified
(default port is 22 if none specified)
-P PidFile Create pid file PidFile
(default /data/dropbear/dropbear.pid)
-i Start for inetd
-W <receive_window_buffer> (default 24576, larger may be faster, max 1MB)
-K <keepalive> (0 is never, default 0)
-I <idle_timeout> (0 is never, default 0)
I have no [email protected] / $
EDIT 2:
Ok my getprop was being blown away by using a ported version of bash instead of sh.
Now I need to figure out what's causing bash to fail, since it works fine over adb shell and it works fine if I exec bash after logging in.
I'm having the same problem. I built dropbear from the TeslaCoil sources, and that didn't help. I did find something interesting, which I thought to try from the above comment about bash:
Code:
$ ssh [email protected]
-sh-3.2# ping -c 4 google.com
ping: unknown host google.com
Now instead, it works if I do:
Code:
$ ssh -t [email protected] bash
bash-3.2# ping google.com
PING google.com (74.125.226.145) 56(84) bytes of data.
...
(I need the -t option to force a pty when specifying a command.)
With the second command, everything works as expected. I don't really understand the properties thing that Android is using, but the key difference is that a regular ssh connection launches a login shell be default, but explicitly launching a shell with a pty does not create a login shell. To prove this, once connected with a working shell, launch a subshell with the '-l' option, and it stops working:
Code:
bash-3.2# ping -c 1 google.com
PING google.com (74.125.226.147) 56(84) bytes of data.
64 bytes from 74.125.226.147: icmp_seq=1 ttl=55 time=17.1 ms
--- google.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 17.120/17.120/17.120/0.000 ms
bash-3.2# bash -l
bash-3.2# ping google.com
ping: unknown host google.com
bash-3.2#
So are login shells a problem in Android in general? I know Linux inside and out, but Android is a bit weird. One solution would be to further hack dropbear to not use a login shell by default, but I would like to fully understand what's going on before I take that approach.
I think I may have figured something out. Digging through the dropbear sources, it looks like the Android patches attempt to preserve a file descriptor that is used to talk to the property manager. Creating a login shell closes all file descriptors other than 0,1,2. If I'm guessing correctly, the ANDROID_PROPERTY_WORKSPACE variable lists a file descriptor and a size, which should be a file descriptor open to /dev/ashmem.
I think that this explains what is going wrong. Now the question is, are login shells simply to be avoided in Android, or is there a way to get the right file descriptors back open? (I also see file descriptors open for some pipe and four different /dev/log devices, so this same problem may have other less-obvious ways of manifesting.)
This has been quiet for a while. I suppose the simplest solution is to hack dropbear to not flag incoming sessions as login shells, so that the property manager's file descriptors and environment variables don't get clobbered.
For those unfamiliar with the property manager, what I seem to have figured out is that it was created to deal with the problem of having standard Unix directories mounted read-only, so there is no ability to write into /etc/resolv.conf, for example. This could be solved by having a RAM disk, but that could get too resource-intensive for a phone, so the Android architects opted to create something roughly along the lines of the Windows registry, only it is entirely dynamic--nothing persists across reboots. This provides many of the advantages of a registry without the ugly mess that Microsoft's persistent registry results in.
I was running DroidSSHd v.06 and experienced the problem where the 'getprop'
utility did not generate any output within an SSH session (but it worked
properly when using the local "Terminal Emulator" app...
I installed QuickSSHd and this fixed getprop for me (Thanks Kevin!)...
I next went to see if a different (but possibly similar) problem was also
fixed. Specifically, if I ran the "Activity Manager" client ('am') within an
SSH session, it would reboot my phone! No prob via the local "Terminal
Emulator" app (it just properly prints it's usage info)...
Well, with QuickSSHd (v.2.0.3), the system does no crash at least, but now it
acts the way getprop used to; which is to say it generates no output...
The "Package Manager" client utility ('pm') is the same way (no output)...
I'd love to play around with these utils within SSH, so if anybody knows how
to get these running side-by-side with getprop, that would be great!
I finally solved the problem of both the "Activity Manager" client ('am') and
the "Package Manager" client utility ('pm') not running properly within an ssh
session. So I'll answer my own question here...
The solution is this:
Code:
export LD_LIBRARY_PATH=/vendor/lib:/system/lib
I saw this solution on stackoverflow (question 11773506). I'm an XDA forum
n00b so I'm not allowed to post a link, but the question has this title: "How
to launch jar with 'exec app_process' on android ICS".
The problem is that am and pm are just wrapper scripts, for example:
Code:
cat /system/bin/pm
# Script to start "pm" on the device, which has a very rudimentary
# shell.
#
base=/system
export CLASSPATH=$base/framework/pm.jar
exec app_process $base/bin com.android.commands.pm.Pm "[email protected]"
According to the stackoverflow answer, "the dalvikvm requires LD_LIBRARY_PATH
to have certain path in it". This solution worked for me. I just added the
"export" line to my shell's startup file (~/.bashrc)...

[Q] Android Scripting Q

I am trying to run a script from my nook color running CM7 (2.3.3). The script contains several wget commands designed to download pdf files from specific URLs. I have replaced the stock android busybox wget with a more powerful one that has all of the standard options. The weird thing is that when I execute the script via the command #sh run.sh, only the last line of the script executes properly...
Here is what is contained in the script file (run.sh):
wget -N -P /mnt/sdcard/wget/app/ppm --append-output=log.txt -i /mnt/sdcard/wget/ppm.txt
wget -N -P /mnt/sdcard/wget/app --append-output=log.txt -i /mnt/sdcard/wget/revision_checklist.txt
This returns the log:
/mnt/sdcard/wget/ppm.txt
: No such file or directory
No URLs found in /mnt/sdcard/wget/ppm.txt
.
[Removed Server Data Here]
Server file no newer than local file `/mnt/sdcard/wget/app/checklist.pdf' -- not retrieving.
What is weird is that if I add a third line to the run.sh file, the first two will error out and the third will execute. I've written the file in notepad++ using ANSI encoding. If I show all characters, the carriage return after all but the very last line shows a CR and LF.
I'm stumped...would sure appreciate any help.

[Q] executing self-compiled c/c++ code in connectbot: Syntax error: word unexpected

Hi all,
(see at the end for setup and device info)
(remove spaces in URLs since I am not allowed to post real URLs yet)
I am trying to compile my own c/c++ code and run it on my android phone.
I got the android toolchain and the program (hello world, "test" binary) compiles:
./agcc -c -o test hello.cpp
file test
test: ELF 32-bit LSB relocatable, ARM, version 1 (SYSV), not stripped
The program executable is "test". I copy it to my android to /data (since other folders apparently do not have execution permission yielding the "permission denied" error when trying to execute) and do "chmod a+x test"
When I start connectbot on my phone, navigate to /data and do "./test" then I get the error: Syntax error: word unexpected (expecting ")")
As if connectbot would try to execute this binary as a shell script.
In principle, a step-by-step manual how to compile and run c/c++ code on android would be here:
"http: //www . hytherion.com/beattidp/comput/android/linux-on-android.html"
But I get this strange error mentioned above.
any ideas?
setup:
=====
Phone: Samsung Galaxy S2
Android: 2.3.4
Kernel: GINGERBREAD.XWKI4 (rooted, works all fine)
Crosscompile Toolchain: from: ./repo init -u https: // android.googlesource.com/platform/manifest
Using acc script from "http: // plausible.org/andy/agcc"
Exporting: export PATH=[PathToToolchain]/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin:$PATH
Hello World example:
// hello.cpp
#include <stdio.h>
int main()
{
int a=1;
printf("hello %d",a);
return 0;
}
compiling with: ./agcc -c -o test hello.cpp
bump bump?

[GUIDE] Native Debian on Samsung Galaxy i7500

Hello fellow phone enthusiasts,
there are some sources on the internet describing how to run Debian on the Samsung Galaxy i7500 (Samsung's first Android device). Unfortunately, none of these sources can act as a complete guide, so I thought I could try to fill this void. This guide is far from complete and will hopefully grow over time. Anyway, I hope this is helpful for some people that are trying to do the same.
Note that this post should have gone into the development section, but I'm not senior enough to post there. Also the URLs in this guide are messed up for the same reason. Each messed up URL is marked with "(FIX this url)". I will fix these things as soon as possible, if there is any interest in this guide.
Best regards,
Frank
0. WARNING
This guide is for experienced users only. You might brick your phone while following this guide. I will not take responsibilty for any harm that may happen to you, your phone or those around you when following this guide. Please read and understand the complete guide before doing the first step. You have been warned.
Make a nandroid backup (can be done in the recovery image). Really, do it. Even if you think there's no valuable data, you must do a nandroid backub, because you will need to have the boot.img to boot back into android after debian has been installed. You must also copy your nandroid backup onto your PC.
1. Credits
A few years ago, there has been quite an active development community for the Galaxy i7500. Unfortunately, these forums have now pretty much died and I was not an active member of that community, because I was using it as my primary device back then and had no interest in hacking it.
Anyway, a HUGE THANK YOU goes to the fine fellas from drakaz.com and the GAOSP. You guys are awesome!
The actual hard technical work for this guide has been done by the authors of the following guides. I'm simply trying to understand what they did and write a step-by-step guide using their expertise:
(FIX this url)https :// code . google . com/p/linux-on-android/wiki/BasicSteps
(FIX this url)https :// wiki . debian . org/ChrootOnAndroid
(FIX this url)http :// www . bananenfisch . net/?p=1056
(FIX this url)https :// sven . killig . de/android/console.html
2. Overview
The goal of this guide is to have a running Debian Squeeze (Debian 6) running natively on a Samsung Galaxy i7500. Debian will not be run in a chroot environment on top of android, but instead the phone will directly boot into debian when powering it on. Debian will be installed on a SD card, so that we could still boot into Android, should we really mess things up at some point. It will not be true dual boot though (i.e. you have to reflash the boot section from a PC to boot into Android).
2.1 Primary goals
In the end, I'd like have the following functionality:
WLAN
Bluetooth
X Window / Graphical User Interface
All this is possible with below description now.
But this means we will loose the ability to make phone calls, send text messages, use GPS, connect to the internet through 3G or anything else you would normally expect from a smartphone. It's very likely possible to also have this functionality included, but I simply don't need it for my project. If someone else is willing to investigate this, I would be interested in the results though.
2.2 Prerequisites
Things you'll need include:
good Linux knowlegde
1 rooted Samsung Galaxy i7500 (I recommend to flash GAOSP)
1 micro SD card (I'm using an 8 GiB class 4 card)
1 computer running Linux with the following software installed (I'm using Debian & Fedora, but any distribution that has debootstrap should work)
debootstrap
git
fastboot (I suggest to use the version that comes with your distro, but you can also try the one from the Android SDK)
GCC cross-compiler for ARM in order to compile the kernel (Debian and Fedora come with compiler versions, that didn't work for me, so I'm using version 7 of the Android NDK, i. e. GCC version 4.4.3)
3. Installing Debian
Note that I had already GAOSP2 beta 3 installed on the i7500. I don't know if any of these steps are possible without installing GAOSP first.
3.1 Prepare partitions on SD card
The Samsung Galaxy i7500 has an "internal SD card" which will be preserved for use with Android, the recovery image, a.s.o. The external SD card will be used for debian. ALL data on the external card will be lost after below steps.
Put the SD card into an SD card reader or boot the i7500 into recovery mode (press "vol-" and "call" buttons when switching on the phone). Note that using GAOSP directly didn't work for me, because for some reason only the first partition was shown on the PC.
Code:
cfdisk /dev/sdX
(replace X with the correct letter for your SD card, and then create the one big enough partition for your needs, I created one 4GiB primary partition leaving me 4GiB for playing around later)
Code:
sudo mke2fs /dev/sdX1
3.2 Build debian filesystem structure
Create a directory for the newly created debian partition (I assume it' s called "debian") and run the following commands
Code:
sudo mount /dev/sdX1 ./debian/
Code:
sudo debootstrap --verbose --arch armel --foreign squeeze ./debian/ (FIX this url) http :// ftp . de . debian . org/debian
Code:
sudo umount ./debian/
3.3 Finalize the debian installation
The following is based on the steps as described here (FIX this url) wiki. debian.org/ChrootOnAndroid and www . bananenfisch .net/?p=1056.
Boot phone into GAOSP
Open terminal
Code:
su
Code:
cd /data/local
Code:
mkdir debian
Code:
mount /dev/block/mmcblk1p1 /data/local/debian
Finalize bootstrap:
Code:
chroot /data/local/debian /debootstrap/debootstrap --second-stage
Mount special file systems and chroot into Debian:
Code:
for f in dev dev/pts proc sys ; do mount -o bind /$f /data/local/debian /$f ; done
Code:
chroot /data/local/debian /bin/bash
Finalise the installation:
Code:
echo "deb (FIX this url) http :// ftp . de . debian . org/debian/ squeeze main non-free contrib" > /etc/apt/sources.list
Code:
apt-get update
Code:
rm -f /etc/mtab
Code:
ln -s /proc/mounts /etc/mtab
Code:
passwd root
Code:
echo i7500 > /etc/hostname
Code:
apt-get install openssh-server
Code:
apt-get clean && apt-get autoclean
The ssh-sever can be started whenever you like through
Code:
/etc/init.d/ssh start
Afterwards you can log in from your PC using "ssh [email protected]" into the chroot environment.
3.4 Configure locale
We need to set the locale for the system (otherwise there will always be warning messages, e.g. when installing new software):
Code:
apt-get install locales console-data keyboard-configuration
You might want to tweak a few more settings (especially if your locale is not en_US). You can use:
Code:
echo export LANG=en_US.UTF-8 >> /root/.bashrc
Code:
export LC_ALL="en_US.utf8"
Code:
dpkg-reconfigure locales
Code:
dpkg-reconfigure console-data
Code:
dpkg-reconfigure keyboard-configuration
3.5 Installing additional software
You can now start installing additional software that you might need (I suggest you log into your phone through ssh as described above). You'll be needing an editor to edit configuration files (I choose vim). For setting up WiFi the package "wpasupplicant" is needed.
Code:
apt-get install vim less wpasupplicant
3.6 Chroot into debian
If you at a later time want to chroot into your debian environment, I recommend to store the following commands in a shell script (I stored it in /data/local/debian.sh) which you can then run as root.
Code:
#!/bin/sh
mount /dev/block/mmcblk1p1 /data/local/debian
for f in dev dev/pts proc sys ; do mount -o bind /$f /data/local/debian/$f ; done
chroot /data/local/debian /bin/bash
4. Create boot image
4.1 Build kernel
Perform the following steps on your PC:
Download the Galaxo kernel sources: git clone (FIX this url) https :// github . com/drakaz/GalaxoKernel.git
Apply the patch described on (FIX this url) https :// code . google . com/p/linux-on-android/wiki/BasicSteps (themddi_toshiba_smd.c patch doesn't work, do the change manually)
Apply patch as described here: (FIX this url) http :// sven . killig . de/android/console.html
copy attached config.txt file to .config
I will eventually create a branch on github containing the patches and default config. But for now, you'll have to do the patching yourself.
Code:
make ARCH=arm CROSS_COMPILE=/path/to/android-ndk-r7/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi- oldconfig
Code:
make ARCH=arm CROSS_COMPILE=/path/to/android-ndk-r7/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-
Code:
make ARCH=arm CROSS_COMPILE=/path/to/android/android-ndk-r7/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi- modules
4.2 Install modules
The modules need to be installed on the SD card partition, so you need to boot your phone into recovery and mount the SD card. Then execute the following command.
Code:
sudo make ARCH=arm CROSS_COMPILE=/path/to/android-ndk-r7/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi- INSTALL_MOD_PATH=/path/to/sdcard modules_install
In order for the WLAN kernel module to work the following files need to be copied from the GAOSP ROM to the /etc/ folder on the phone:
rtecdc.bin
nvram.txt
4.3 Minimal boot file system
A boot file system (a.k.a. initramfs) is needed to start the debian boot process. Create a folder called minimal_initramfs with the follwoing content:
Code:
minimal_initramfs/
|-- dev/
|-- init*
|-- mnt/
| `-- root/
|-- proc/
|-- sbin/
| `-- busybox*
`-- sys/
A binary of busybox can be downloaded from the busybox website (use busybox-armv4tl). The file "init" is actually a shell script with the following content:
Code:
#!/sbin/busybox sh
# initramfs pre-boot init script
# Something (what?) needs a few cycles here
/sbin/busybox sleep 1
# Populate /dev
/sbin/busybox mknod /dev/mmcblk1p1 b 179 9
# Mount the root filesystem, second partition on micro SDcard
/sbin/busybox mount -t ext2 -o noatime,nodiratime /dev/mmcblk1p1 /mnt/root
# Transfer root to SDcard
exec /sbin/busybox switch_root /mnt/root /sbin/init
The directory structure must then be compressed. To do this run the following sequence of commands when in the minimal_initramfs directory:
Code:
find . | cpio --quiet -H newc -o | gzip > ../minimal.cpio.gz
4.4 Creating the image
For creating the image you need the tool mkbootimg which you can find in android_bootimg_tools.tar.gz. Run the following command to create the boot image from the initramfs and the kernel you created above:
Code:
./mkbootimg --kernel /path/to/Galaxo-kernel/arch/arm/boot/zImage --ramdisk /path/to/minimal.cpio.gz --cmdline "fbcon=font:VGA8x8" --pagesize 2048 --base 10000000 -o debian_boot.img
5. Configuring network
5.1 Setting up the interface
Your /etc/network/interfaces file on the phone should look like this:
Code:
# Used by ifup(8) and ifdown(8). See the interfaces(5) manpage or
# /usr/share/doc/ifupdown/examples for more information.
auto lo
iface lo inet loopback
auto eth0
allow-hotplug eth0
iface eth0 inet dhcp
wpa-driver wext
wpa-conf /etc/wpa_supplicant.conf
5.2 Setting up wireless encryption
For network configuration we'll be using wpa_supplicant which we already installed in one of the above steps. On the phone create the file /etc/wpa_supplicant.conf with the following content. Please enter the correct values for ssid, psk and key_mgmt for your network:
Code:
network={
ssid="YourSSID"
psk="YourSecretPassword"
key_mgmt=WPA-PSK
priority=11
}
5.3 Loading drivers
In order for the WLAN kernel module to be loaded add the following line to /etc/modules:
Code:
bcm4325 firmware_path=/etc/rtecdc.bin nvram_path=/etc/nvram.txt
6. Flashing the boot image and booting into Debian
Now it's finally time to finally flash the previously created boot image. At this time, be sure that you only have your Galaxy connected to your PC. Otherwise you might brick any other connected phone. On the PC run
Code:
sudo fastboot flash boot debian_boot.img
Then boot the Galaxy into fastboot mode by pressing "call" when powering on the phone.
When the process is finished the phone will boot into Debian and automatically connect to your wireless network (if the set-up was correct). You can now connect to the phone through ssh and enjoy your new pocket server.
If you may ever want to boot into android again, you just need to flash the original boot.img that you created with nandroid:
Code:
sudo fastboot flash boot boot.img
7. Bluetooth
7.1 Compile brcm_patchram_plus
For getting bluetooth operational it is necessary to use Broadcom's brcm_patchram_plus software. As it is not available as a Debian Squeeze package, we need to compile it ourselves. So we need to install the following packages on the phone:
Code:
apt-get install git gcc make libbluetooth-dev
Then it's possible to download the sources:
Code:
git clone (FIX this url)https :// github . com / MarkMendelsohn / brcm_patchram.git
And compile the tool using:
Code:
make
7.2 Activating bluetooth
In order for bluetooth to work the following files need to be copied from the GAOSP ROM to the same folder on the phone that you compiled the brcm_patchram_plus in:
BCM4325D1_004.002.004.0153.0156.hcd
After that it's possible to execute the followig commands:
Code:
echo 0 > /sys/class/rfkill/rfkill0/state
echo 1 > /sys/class/rfkill/rfkill0/state
./brcm_patchram_plus -d --enable_hci --baudrate 3000000 --use_baudrate_for_download --patchram BCM4325D1_004.002.004.0153.0156.hcd /dev/ttyHS0
The last command will never terminate and you will get a lot of output due to the (-d) switch. After starting a new console, you will be able to scan for bluetooth devices using:
Code:
hcitool -i hci0 scan
7.3 Connecting a keyboard
I'm using a Rapoo E6100 keyboard and the following procedure worked fine for me. It should be similar with other keyboards.
Code:
apt-get install python-bluez python-gobject python-dbus bluez-compat
Code:
cd /usr/share/doc/bluez/examples
Press pairing button on keyboard then
Code:
./simple-agent hci0 6C:xx:xx:xx:xx:xx
(use the bluetooth address of your keyboard, according to the scan in the previous chapter)
The script will ask for a PIN. I entered 0000 on both the keyboard and phone and the keyboard was registered.
Code:
./test-device trusted 6C:xx:xx:xx:xx:xx yes
(again use the bluetooth address of your keyboard)
Code:
hidd --connect 6C:xx:xx:xx:xx:xx
Now you should be good to use your keyboard.
7.4 Automate patchram
Right now, the KB is not automatically connected on boot, because the patchram command from above needs to be executed on every boot. Hence the following commands should be added to /etc/rc.local (before the exit 0):
Code:
#Activate bluetooth
echo 0 > /sys/class/rfkill/rfkill0/state
echo 1 > /sys/class/rfkill/rfkill0/state
/path/to/brcm_patchram_plus --enable_hci --baudrate 3000000 --use_baudrate_for_download --patchram /path/to/BCM4325D1_004.002.004.0153.0156.hcd /dev/ttyHS0 &
8. Setting the clock
I was having trouble with my clock forgetting the day and time after each reboot. It was a flaw in my kernel config. In the current version of attached config file this is fixed. Anyway, I'm also running NTP to have the clock more accurate.
Code:
apt-get install ntpdate
NTP already come nicely pre-configured (thanks, Debian maintainers!). After that the timezone can be selected using
Code:
dpkg-reconfigure tzdata
9. GUI (X.org)
X.org works almost out-of-the-box since we already pathed the kernel as described in chapter 4 above. Based on the description from (FIX this url)https :// code . google . com/p/linux-on-android/wiki/BasicSteps only two minor changes have been made:
The framebuffer device is at /dev/fb0 instead of /dev/graphcics/fb0
I use evdev instead of tslib, because it provided better results for me (thanks to pabs from #debian-mobile for pointing me there)
9.1 Install X.org
All we need to do is download the software
Code:
apt-get install xorg xserver-xorg-video-fbdev xserver-xorg-input-evdev
9.2 Configuring X.org
Now create /etc/X11/xorg.conf:
Code:
Section "InputDevice"
Identifier "Touchscreen"
Driver "evdev"
Option "Device" "/dev/input/event2"
EndSection
Section "Device"
Identifier "Configured Video Device"
Driver "fbdev"
Option "fbdev" "/dev/fb0"
EndSection
Section "Monitor"
Identifier "Configured Monitor"
Option "DPMS" "false"
EndSection
Section "Screen"
Identifier "Default Screen"
Monitor "Configured Monitor"
Device "Configured Video Device"
EndSection
Section "ServerLayout"
Identifier "Default"
Screen "Default Screen"
InputDevice "Touchscreen" "CorePointer"
EndSection
Section "ServerFlags"
Option "DefaultServerLayout" "Default"
EndSection
9.3 Testing X.org
For testing X.org I've installed icewm and created the following /root/.xsession
Code:
#!/bin/sh
xterm&
exec icewm
Then just type in startx from the console and you have X. Of course you will have to change this to whatever you need or maybe even make X start on boot.
9.4 Boot into Browser
For my target system I want the phone to directly boot into a browser. This can easily be achieved by using the nodm package:
Code:
apt-get install nodm
and midori as browser:
Code:
apt-get install midori
We'll also need a user account. I called my user "default". But naturally you can of course choose whatever you like.
Code:
adduser default
Then nodm has to be configured in /etc/default/nodm:
Code:
# nodm configuration
# Set NODM_ENABLED to something different than 'false' to enable nodm
NODM_ENABLED=true
# User to autologin for
NODM_USER=default
# xinit program
NODM_XINIT=/usr/bin/xinit
# First vt to try when looking for free VTs
NODM_FIRST_VT=7
# X session
NODM_XSESSION=/etc/X11/Xsession
# Options for the X server
NODM_X_OPTIONS='vt7 -nolisten tcp'
# If an X session will run for less than this time in seconds, nodm will wait an
# increasing bit of time before restarting the session.
NODM_MIN_SESSION_TIME=60
And we have to create ~/.xsession for our user:
Code:
#!/bin/bash
midori -e Fullscreen &
exec icewm
A few tweaks in the icewm config (~/.icewm/preferences) will make the window manager look more nicely:
Code:
WorkspaceNames=" 1 "
TaskBarShowCPUStatus=0
TaskBarDoubleHeight=0
TaskBarShowWorkspaces=0
TaskBarShowMailboxStatus=0
TaskBarShowNetStatus=0
TimeFormat="%H:%M"
TaskBarShowWindowListMenu=1
TaskBarShowShowDesktopButton=0
10. Power management
The kernel is already configured with many different frequency govenors. Also the default govenor is set to "ondemand" but for some reason the when looking at /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor it's using the "performance" govenor. This can be solved by simply installing cpufreq-utils:
Code:
apt-get install cpufrequtils
The default settings are already using "ondemand", which seems to be a good choice. Anyway, further optimisations can be done in /etc/default/cpufrequtils if needed.
The phone still gets a little too warm for my taste (I think warmer than in android). Maybe there's something that could fix this, but I'm not an expert.
11. Known shortcomings
The whole set-up is in a really, REALLY early alpha stage
If any of the hardware buttons is touched in text mode the phone crashes (does not happen when in X.org)
The screen will time-out after some time, I have no idea how to wake it up again
Did I mention this is in an alpha stage?
12. Future improvements
Switching to a newer kernel version: The latest version of GAOSP runs on kernel version 2.6.35, while this guide is using 2.6.27. I have experimented with 2.6.29, but I had trouble getting a working frame buffer.
Switching to the latest version of debian (wheezy).
History
History:
2013-12-27:
Initial version
2013-12-30:
Minimized the the init script by removing mounts for /dev, /proc, and /sys. These are not necessary and mounting /dev prevents Debian's udev from working correctly.
2014-01-19:
Added description for bluetooth.
2014-01-25:
Added description for graphical user interface (X.org).
2014-01-25:
Boot into X/Browser and power management
2014-01-26:
Updated clock settings
Video proof
Hi all,
to get a better understanding what this is all about please watch the attached video. Please excuse the poor quality and the fingerprints on the screen.
As you can see the framebuffer output has a few quirks, but hopefully this will work out as soon as X is working.
BR,
Frank
All goals achieved
Okay, I think I now have achieved all goals. I can connect to WiFi and bluetooth. And there is a graphical user interface. Now the tweaking can start (first thing that comes to mind is powersaving). I really created this guide for myself, but I'd be happy to know if anyone else has interest in this topic.
Nice, I am interested. One question!
frank47 said:
Okay, I think I now have achieved all goals. I can connect to WiFi and bluetooth. And there is a graphical user interface. Now the tweaking can start (first thing that comes to mind is powersaving). I really created this guide for myself, but I'd be happy to know if anyone else has interest in this topic.
Click to expand...
Click to collapse
Nice, I am interested. One question!
I would like to use this device to get some data from the sensors. I have tested some apps in Android GAOSP to read the sensors in the i7500, but instead of using android apps, it could be very interesting to have a debian.
Have you tried to do it? Do you think it is possible? Is it too tricky to get a stable debian running an app to send sensors' data to another debian? I could help if you see it is interesting.
What is your opinion? Thank you...
Hi PabloGN,
there are a lot of entries in /proc and /sys. I think it's likely to be possible te access the sensors. For now, I have only looked at the battery status. Don't know if you'd consider that a sensor. Anyway, you would probably have to re-write your software to use those devices instead of using already existing Java libs for android. Hard to tell,*if it's worth the effort.
BR,
Frank
PabloGN said:
I would like to use this device to get some data from the sensors.
Click to expand...
Click to collapse
This is the list of input devices on my the i7500:
Code:
[email protected]:~# cat /proc/bus/input/devices
I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="I7500_headset"
P: Phys=
S: Sysfs=/devices/virtual/input/input0
U: Uniq=
H: Handlers=kbd event0
B: EV=3
B: KEY=4 0 0 0 0 0 0 0
I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="I7500_keypad"
P: Phys=
S: Sysfs=/devices/virtual/input/input1
U: Uniq=
H: Handlers=kbd event1
B: EV=3
B: KEY=800180 100000 0 41000800 1c1ec0 0 0 0
I: Bus=0000 Vendor=0000 Product=0000 Version=0033
N: Name="melfas-tsi-touchscreen"
P: Phys=
S: Sysfs=/devices/virtual/input/input2
U: Uniq=
H: Handlers=event2
B: EV=b
B: KEY=400 0 0 0 0 0 0 0 0 0 0
B: ABS=11000003
I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="compass"
P: Phys=
S: Sysfs=/devices/virtual/input/input3
U: Uniq=
H: Handlers=event3
B: EV=9
B: ABS=20305ff
I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="proximity_i2c"
P: Phys=
S: Sysfs=/devices/virtual/input/input4
U: Uniq=
H: Handlers=event4
B: EV=1
So, it should at least be possible to read the compass and proximity sensor data form /dev/input/event3 and /dev/input/event4. Maybe there's more and I just haven't compiled it into the kernel or it's accessed in some other way. Sorry, the sensors are not part of my use case so far.
I'm only using /dev/input/event2 (touchscreen) in my xorg.conf as an input device. Works like a charm.
Good luck with your endeavour. If you want me to test something or send you the output of some command, just ask here or by PM.

[App] Netflix HD for Widevine DRM L1 devices

Hey people,
today i wanted to share a post from chenxiaolong, who did some awesome work back at the Galaxy Tab S2 forum. The main problem, was that Netflix didn't want to play HD content on the Galay Tab S2, which was why I researched the requirements of Netflix. They need Widevine L1 implemented on the SoC to allow HD playback. While this is the necessary requirement, Netflix also needs to enable this device in their device list and tell the app it supports Widevine DRM L1. In many cases they don't do that although the device itself would be very capable of displaying HD content. Tried it out on my Galaxy Tab S2 and on the Nexus 5, which both support Widevine DRM L1 and aren't/weren't marked as WV L1 capable. To check DRM capability of your device you can use for example this app https://play.google.com/store/apps/details?id=com.androidfung.drminfo&hl=en
This will not make a non WV L1 capable device run Netflix HD, it will only make the device use the most secure DRM technology!
The whole process doesn't need root, just some tools like apktool, apk-signer and such. Feel free to link the post into your device forum you achieved to get Netflix HD on.
Big Thanks goes out to @chenxiaolong
Link to thread post: http://forum.xda-developers.com/showpost.php?p=65001865&postcount=12
Based on this, I made a script on Ubuntu to patch last version of netflix APK.
It currently works on version up to 5.12.xxx, it doesn't seem to work on more recent versions, we will have probably to wait for a new version of apktool (2.4.0 ?).
First, you need to install some packages
Code:
sudo apt-get install apktool zipalign default-jdk
Then, you have to build you own signature (to do only once)
Code:
keytool -genkeypair -alias androiddebugkey -keypass android -keystore "${HOME}/.netflix.keystore" -storepass android -keyalg RSA -sigalg SHA1withRSA -dname "CN=Android Debug,O=Android,C=US" -validity 9999
Then, download last netflix APK, for instance from apkmirror, and execute this script on downloaded file (for instance "netflixpatch com.netflix.mediaclient_4.16.1.apk" if your script is named "netflixpatch")
Code:
#!/bin/bash
NAME=$(basename "${1}" .apk)
KEYSTORE="${HOME}/.netflix.keystore"
TMPOUT=$(mktemp -d /tmp/tmpdir.netflixpatch.XXXXXXXXXX) || { echo "Failed to create temp file"; exit 1; }
FILEOLD="${TMPOUT}/smali/com/netflix/mediaclient/service/webclient/model/leafs/DeviceConfigData.smali"
FILENEW="${TMPOUT}/smali/com/netflix/mediaclient/service/configuration/DeviceConfiguration.smali"
apktool d -r -f "${1}" -o "${TMPOUT}"
if [ -f "${FILEOLD}" ];then
echo "Patching method 1"
sed -i 's/iget-boolean v0, p0, Lcom\/netflix\/mediaclient\/service\/webclient\/model\/leafs\/DeviceConfigData;->enableWidevineL1:Z/const\/4 v0, 0x1/g' "${FILEOLD}"
elif [ -f "${FILENEW}" ];then
echo "Patching method 2"
sed -i '/isWidevineL1Enabled/c\ const\/4 v0, 0x1\n return v0' "${FILENEW}"
else
echo "File to patch not found !"
rm -rf "${TMPOUT}"
exit 1
fi
# /usr/local/bin/apktool b "${TMPOUT}"
apktool b "${TMPOUT}"
jarsigner -keystore "${KEYSTORE}" -storepass android -keypass android -sigalg MD5withRSA -digestalg SHA1 -sigfile CERT -signedjar "${TMPOUT}/dist/${NAME}-patched-signed.apk" "${TMPOUT}/dist/${NAME}.apk" androiddebugkey
zipalign -f 4 "${TMPOUT}/dist/${NAME}-patched-signed.apk" "${NAME}-patched-signed-zipaligned.apk"
rm -rf "${TMPOUT}"
You'll get a "com.netflix.mediaclient_4.16.1-patched-signed-zipaligned.apk" file, which will play HD content if your device has Widevine DRM L1 libraries, even if not whitelisted by Netflix.
Perfect! It works for me on Medion Tablet. It also enables download offline mode. Tanks.
It doesn´t work for me...I get an error when tryng to reproduce movies
Hi!
Is it possible that this trick doesn't work anymore or doesn't work on all devices? I patched the current Netflix APK (and verified that the changes were made using apktool) but I only get 720p at best. There was also an error message along the lines of "content not allowed in prolog"?
I'm using one of those generic AmLogic S912 boxes ("X92 Smart Box" with the white clock display thing in the front) which supports L3 but neither Netflix nor Prime Video stream 1080p.
GuillaumeBarberousse said:
Based on this, I made a script on Ubuntu to patch last version of netflix APK.
First, you need to install some packages
Code:
sudo apt-get install apktool zipalign default-jdk
Then, you have to build you own signature (to do only once)
Code:
keytool -genkeypair -alias androiddebugkey -keypass android -keystore "${HOME}/.netflix.keystore" -storepass android -keyalg RSA -sigalg SHA1withRSA -dname "CN=Android Debug,O=Android,C=US" -validity 9999
Then, download last netflix APK, for instance from apkmirror, and execute this script on downloaded file (for instance "netflixpatch com.netflix.mediaclient_4.16.1.apk" if your script is named "netflixpatch")
Code:
#!/bin/bash
NAME=$(basename "${1}" .apk)
KEYSTORE="${HOME}/.netflix.keystore"
TMPOUT=$(mktemp -d /tmp/tmpdir.netflixpatch.XXXXXXXXXX) || { echo "Failed to create temp file"; exit 1; }
apktool d -r -f "${1}" -o "${TMPOUT}"
sed -i 's/iget-boolean v0, p0, Lcom\/netflix\/mediaclient\/service\/webclient\/model\/leafs\/DeviceConfigData;->enableWidevineL1:Z/const\/4 v0, 0x1/g' ${TMPOUT}/smali/com/netflix/mediaclient/service/webclient/model/leafs/DeviceConfigData.smali
apktool b ${TMPOUT}
jarsigner -keystore "${KEYSTORE}" -storepass android -keypass android -sigalg MD5withRSA -digestalg SHA1 -sigfile CERT -signedjar "${TMPOUT}/dist/${NAME}-patched-signed.apk" "${TMPOUT}/dist/${NAME}.apk" androiddebugkey
zipalign -f 4 "${TMPOUT}/dist/${NAME}-patched-signed.apk" "${NAME}-patched-signed-zipaligned.apk"
rm -rf $TMPOUT
You'll get a "com.netflix.mediaclient_4.16.1-patched-signed-zipaligned.apk" file, which will play HD content if your device has Widevine DRM L1 libraries, even if not whitelisted by Netflix.
Click to expand...
Click to collapse
Im sorry but with these informations I don't know exactly if and how it will work out for my galaxy s5. Can I use a app on my mobile to sign the backuped Netflix app? Or do I need to sign the apk on my PC?
T0mfield said:
Im sorry but with these informations I don't know exactly if and how it will work out for my galaxy s5. Can I use a app on my mobile to sign the backuped Netflix app? Or do I need to sign the apk on my PC?
Click to expand...
Click to collapse
These are instructions for Linux. What I have done:
1. download Ubuntu from Windows 10 Store
2. open powershell as admin and type:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
3. reboot when prompted
4. open command line and type:
ubuntu
5. create user/password as prompted
6. type:
sudo apt-get upgrade
Then follow the instructions from post #1. I've got my netflix apk from apkmirror: https://www.apkmirror.com/?post_type=app_release&searchtype=apk&s=netflix
You can access the windows filesystem by /mnt/c/
The script worked fine for me with Netflix 5.9.0 build 24858 and my Nexus 10.
The modification was not working anymore on my tablet (Samsung Galaxy Tab A6 SM-T580) giving me an error 0013 and it is now working again, I don't know why (I upgraded firmware to last version T580XXU2BQI9 / T580XEF2BQI9, or maybe Netflix changed something on their servers).
It is tested and working on Netflix apk 5.8.0_build_24642 and 5.9.0_build_24858 with apktool 2.2.1-dirty (Ubuntu 17.04 version), 2.2.3 and 2.3.0
I edited post https://forum.xda-developers.com/showpost.php?p=72178861&postcount=2, it should now work with old and new version of APK, (tested with version 5.11.1_build_25432)
GuillaumeBarberousse said:
I edited post https://forum.xda-developers.com/showpost.php?p=72178861&postcount=2, it should now work with old and new version of APK, (tested with version 5.11.1_build_25432)
Click to expand...
Click to collapse
I'm getting this error:
Code:
sed: can't read /tmp/tmpdir.netflixpatch.1QU3FdHrJ4/smali/com/netflix/mediaclient/service/webclient/model/leafs/DeviceConfigData.smali: No such file or directory
Also, you've changed the keystore value in the script code but not in the signature code.
Also, it didn't work with 5.11.2. Getting an error 5.2. Not sure if it's because it genuinely doesn't work anymore or because I didn't do it correctly on account of the error. Might I add that I'm using a virtual machine, if it makes a difference.
Also, why is there an L before com/?
vleesevlons said:
Also, you've changed the keystore value in the script code but not in the signature code.
Also, it didn't work with 5.11.2. Getting an error 5.2. Not sure if it's because it genuinely doesn't work anymore or because I didn't do it correctly on account of the error. Might I add that I'm using a virtual machine, if it makes a difference.
Also, why is there an L before com/?
Click to expand...
Click to collapse
Thank you, I edited the script to correct keystore path.
The error you were getting was normal, I was trying to patch file for old versions and new versions of netflix apk, I changed the script to prevent the file error message.
I don't know why you've got error 5.2, I had it for some times then it worked again, after uninstalling official apk and reinstalling patched one, maybe something in the cache of the tablet. I tried many version of apktool too, but it doesn't seem related.
For the virtual machine, it shouldn't affect the patching process.
And for the L before com, I don't know, it is smali language, probably to indicate a string value.
GuillaumeBarberousse said:
Thank you, I edited the script to correct keystore path.
The error you were getting was normal, I was trying to patch file for old versions and new versions of netflix apk, I changed the script to prevent the file error message.
I don't know why you've got error 5.2, I had it for some times then it worked again, after uninstalling official apk and reinstalling patched one, maybe something in the cache of the tablet. I tried many version of apktool too, but it doesn't seem related.
For the virtual machine, it shouldn't affect the patching process.
And for the L before com, I don't know, it is smali language, probably to indicate a string value.
Click to expand...
Click to collapse
I have a Nexus 5 (2013).
I've installed DRMinfo to confirm that I have WV L1 and it says it does.
I've been experimenting with liboemcrypto.so, i.e. deleting it or renaming it, and that does get rid of the error 5.2.
However, it appears that if the .so file differs from how a liboemcrypto.so should be, then Netflix will not do the DRM check and it will just give you SD quality.
So, I'm at a loss there...
What build worked for you? I've tried 5.11.2 build 25441 and 5.11.1 build 25432
vleesevlons said:
I have a Nexus 5 (2013).
I've installed DRMinfo to confirm that I have WV L1 and it says it does.
I've been experimenting with liboemcrypto.so, i.e. deleting it or renaming it, and that does get rid of the error 5.2.
However, it appears that if the .so file differs from how a liboemcrypto.so should be, then Netflix will not do the DRM check and it will just give you SD quality.
So, I'm at a loss there...
What build worked for you? I've tried 5.11.2 build 25441 and 5.11.1 build 25432
Click to expand...
Click to collapse
In my understanding, but I'm not sure, if you remove liboemcrypto.so, you lose Widevine level 1, so Netflix won't even try to play HD, so no error 5.2. I tried and got HD by patching 5.11.2_build_25441 and 5.11.1_build_25432.
Thanks for this guide. For me this missed a few instructions, like how to run a script on a file
So this are the steps nessesary to compleat this process:
1. Do everything from OP till it says to run a script on a file
2. For ease name your script netflixpatch and file com.netflix.mediaclient_4.16.1.apk
3. Open terminal in a place where you saved netflix app and this script
4. In terminal type: chmod u+x netflixpatch
5. Then run this script on apk by typing in terminal: ./netflixpatch com.netflix.mediaclient_4.16.1.apk (with ./ in front)
6. If all went you will see new file in your directory, thats the modified app
Now. For me, and I had apk v .12.2 build 25768 this trick seems to not work. I still have video looking like 720
Im on OnePlus 5T (capable of widevine lv.1) and stock rom.
Do I have nessesary libery I don't really know yet.
Need to investigate more but at least I have modified apk now so thanks for that
EDIT: Thers no liboemcrypto.so in /system/vendor/lib/ so that's probably the issue here ...
anybody knows that this code founds with Android TV netflix apk ?
GuillaumeBarberousse said:
Based on this, I made a script on Ubuntu to patch last version of netflix APK.
First, you need to install some packages
Code:
sudo apt-get install apktool zipalign default-jdk
Then, you have to build you own signature (to do only once)
Code:
keytool -genkeypair -alias androiddebugkey -keypass android -keystore "${HOME}/.netflix.keystore" -storepass android -keyalg RSA -sigalg SHA1withRSA -dname "CN=Android Debug,O=Android,C=US" -validity 9999
Then, download last netflix APK, for instance from apkmirror, and execute this script on downloaded file (for instance "netflixpatch com.netflix.mediaclient_4.16.1.apk" if your script is named "netflixpatch")
Code:
#!/bin/bash
NAME=$(basename "${1}" .apk)
KEYSTORE="${HOME}/.netflix.keystore"
TMPOUT=$(mktemp -d /tmp/tmpdir.netflixpatch.XXXXXXXXXX) || { echo "Failed to create temp file"; exit 1; }
FILEOLD="${TMPOUT}/smali/com/netflix/mediaclient/service/webclient/model/leafs/DeviceConfigData.smali"
FILENEW="${TMPOUT}/smali/com/netflix/mediaclient/service/configuration/DeviceConfiguration.smali"
apktool d -r -f "${1}" -o "${TMPOUT}"
if [ -f "${FILEOLD}" ];then
echo "Patching old version"
sed -i 's/iget-boolean v0, p0, Lcom\/netflix\/mediaclient\/service\/webclient\/model\/leafs\/DeviceConfigData;->enableWidevineL1:Z/const\/4 v0, 0x1/g' "${FILEOLD}"
elif [ -f "${FILENEW}" ];then
echo "Patching new version"
sed -i '/isWidevineL1Enabled/c\ const\/4 v0, 0x1\n return v0' "${FILENEW}"
else
echo "File to patch not found !"
rm -rf "${TMPOUT}"
exit 1
fi
# /usr/local/bin/apktool b "${TMPOUT}"
apktool b "${TMPOUT}"
jarsigner -keystore "${KEYSTORE}" -storepass android -keypass android -sigalg MD5withRSA -digestalg SHA1 -sigfile CERT -signedjar "${TMPOUT}/dist/${NAME}-patched-signed.apk" "${TMPOUT}/dist/${NAME}.apk" androiddebugkey
zipalign -f 4 "${TMPOUT}/dist/${NAME}-patched-signed.apk" "${NAME}-patched-signed-zipaligned.apk"
rm -rf "${TMPOUT}"
You'll get a "com.netflix.mediaclient_4.16.1-patched-signed-zipaligned.apk" file, which will play HD content if your device has Widevine DRM L1 libraries, even if not whitelisted by Netflix.
Click to expand...
Click to collapse
------------------------------------------
anyone try to apply this patch and upload to mega to try if this patch found in Mi box Tv
Problems with the script Helpme
[email protected]:/mnt/c/Users/crist/Downloads/netflix# ./net.sh com.netflix.ninja_5.0.4_build_1965.apk
./net.sh: line 2: $'\r': command not found
./net.sh: line 14: syntax error near unexpected token `elif'
'/net.sh: line 14: `elif [ -f "${FILENEW}" ];then
anybody could helme ... I copy this script :
-------------------------------------------------------------
#!/bin/bash
NAME=$(basename "${1}" .apk)
KEYSTORE="${HOME}/.netflix.keystore"
TMPOUT=$(mktemp -d /tmp/tmpdir.netflixpatch.XXXXXXXXXX) || { echo "Failed to create temp file"; exit 1; }
FILEOLD="${TMPOUT}/smali/com/netflix/mediaclient/service/webclient/model/leafs/DeviceConfigData.smali"
FILENEW="${TMPOUT}/smali/com/netflix/mediaclient/service/configuration/DeviceConfiguration.smali"
apktool d -r -f "${1}" -o "${TMPOUT}"
if [ -f "${FILEOLD}" ];then
echo "Patching old version"
sed -i 's/iget-boolean v0, p0, Lcom\/netflix\/mediaclient\/service\/webclient\/model\/leafs\/DeviceConfigData;->enableWidevineL1:Z/const\/4 v0, 0x1/g' "${FILEOLD}"
elif [ -f "${FILENEW}" ];then
echo "Patching new version"
sed -i '/isWidevineL1Enabled/c\ const\/4 v0, 0x1\n return v0' "${FILENEW}"
else
echo "File to patch not found !"
rm -rf "${TMPOUT}"
exit 1
fi
# /usr/local/bin/apktool b "${TMPOUT}"
apktool b "${TMPOUT}"
jarsigner -keystore "${KEYSTORE}" -storepass android -keypass android -sigalg MD5withRSA -digestalg SHA1 -sigfile CERT -signedjar "${TMPOUT}/dist/${NAME}-patched-signed.apk" "${TMPOUT}/dist/${NAME}.apk" androiddebugkey
zipalign -f 4 "${TMPOUT}/dist/${NAME}-patched-signed.apk" "${NAME}-patched-signed-zipaligned.apk"
rm -rf "${TMPOUT}"
-----------------------------------
Don't copy and paste the script into terminal. Create a new file and past this to it then set permission on file and run the script
yes I did that
Friend I Did that. I was copy the script and paste in a white document and save has .sh when I try to execute make me that error . Please help me
Tried the script. First had to get Ubuntu. So I did:
enable Hyper-V, load Ubuntu 16.4.3-server-x64 (so no GUI) on Generation 1
ran the apt-get install commands provided by OP
Code:
[email protected]:~$ ./netflixpatch com.netflix.mediaclient_5.13.0_build_25824.apk
03:21:52 up 17 min, 2 users, load average: 0.05, 0.07, 0.07
USER TTY FROM [email protected] IDLE JCPU PCPU WHAT
sebas tty1 03:04 13:17 0.05s 0.05s -bash
sebas pts/0 192.168.178.72 03:09 0.00s 0.07s 0.00s w
I: Using Apktool 2.0.2-dirty on com.netflix.mediaclient_5.13.0_build_25824.apk
I: Copying raw resources...
I: Baksmaling classes.dex...
I: Baksmaling classes2.dex...
I: Baksmaling classes3.dex...
I: Copying assets and libs...
I: Copying unknown files...
I: Copying original files...
Patching old version
Script is running BUT I do not see the output created. Old file has an unmodified timestamp. Any thoughts on how to troubleshoot this?
Recent versions of the Netflix app (starting with 5.13.0) are permanently crashing after being processed. At least on my devices. So you can stop working on the current version or take a 5.12.x release.
See: https://forum.xda-developers.com/showpost.php?p=75479828&postcount=136

Categories

Resources