diff --git a/runtime/native/dalvik_system_Zygote.cc b/runtime/native/dalvik_system_Zygote.cc
index d6cc249..4b24192 100644
--- a/runtime/native/dalvik_system_Zygote.cc
+++ b/runtime/native/dalvik_system_Zygote.cc
@@ -552,7 +552,7 @@ static pid_t ForkAndSpecializeCommon(JNIEnv* env, uid_t uid, gid_t gid, jintArra
return pid;
}
-static jint Zygote_nativeForkAndSpecialize_new(JNIEnv* env, jclass, jint uid, jint gid, jintArray gids,
+static jint Zygote_nativeForkAndSpecialize(JNIEnv* env, jclass, jint uid, jint gid, jintArray gids,
jint debug_flags, jobjectArray rlimits,
jint mount_external, jstring se_info, jstring se_name,
jintArray fdsToClose) {
@@ -560,13 +560,6 @@ static jint Zygote_nativeForkAndSpecialize_new(JNIEnv* env, jclass, jint uid, ji
se_info, se_name, false, fdsToClose);
}
-static jint Zygote_nativeForkAndSpecialize(JNIEnv* env, jclass, jint uid, jint gid, jintArray gids,
- jint debug_flags, jobjectArray rlimits,
- jint mount_external, jstring se_info, jstring se_name) {
- return ForkAndSpecializeCommon(env, uid, gid, gids, debug_flags, rlimits, 0, 0, mount_external,
- se_info, se_name, false, NULL);
-}
-
static jint Zygote_nativeForkSystemServer(JNIEnv* env, jclass, uid_t uid, gid_t gid, jintArray gids,
jint debug_flags, jobjectArray rlimits,
jlong permittedCapabilities, jlong effectiveCapabilities) {
@@ -590,8 +583,7 @@ static jint Zygote_nativeForkSystemServer(JNIEnv* env, jclass, uid_t uid, gid_t
}
static JNINativeMethod gMethods[] = {
- NATIVE_METHOD(Zygote, nativeForkAndSpecialize_new, "(II[II[[IILjava/lang/String;Ljava/lang/String;[I)I"),
- NATIVE_METHOD(Zygote, nativeForkAndSpecialize, "(II[II[[IILjava/lang/String;Ljava/lang/String;)I"),
+ NATIVE_METHOD(Zygote, nativeForkAndSpecialize, "(II[II[[IILjava/lang/String;Ljava/lang/String;[I)I"),
NATIVE_METHOD(Zygote, nativeForkSystemServer, "(II[II[[IJJ)I"),
};
Samstag, 1. Februar 2020
Fix for ART-runtime in CM-11
Montag, 29. Juli 2013
Update Nexus 7 to Android 4.3 manually without loosing data
Get the factory image from Google and extract the following files from it:
- bootloader-grouper-4.23.img
- boot.img
- system.img
- UPDATE-SuperSU-v1.51.zip
and copy it to /sdcard and be sure, that you have a custom recovery installed on your device.
Then do a nandroid backup before starting (it's always better to have it) and then do a
fastboot reboot-bootloader
fastboot flash boot boot.img
fastboot flash system system.img
reboot into recovery and flash UPDATE-SuperSU-v1.51.zip
Do a reboot system and, congrats, you should be on Android 4.3 without loosing any data.
Montag, 15. Juli 2013
Enable usbnet on ADS_Magpie / ezGingerbread
Having an USB Host mode available I was wondering how easy / complicate it would be to set up usbnet on the G1. As it turned out, it was surprisingly easy, because everything is already prepared within the kernel (which is available from Github):
Afterwards one can configure an IP address and set the link up:
ip link set usb0 up
There is only one thing to be regarded: after enabling usbnet, adb over usb will no longer work, so it's better to switch to WiFi before.
Mittwoch, 27. März 2013
Android Remote Toolkit
- CWM with nandroid is working, but stores the backup on the device itself. What's worth a backup on a device if it's later no longer accessible :(
- TWRP offered the possibility to store the nandroid files to OTG, which is much better, but still uncomfortable.
I was looking for a solution where I could save the device backups directly to my PC or NAS. I looked around, but I didn't find any toolkit which was providing this functionality, to I started to write it by myself.
Looking around a bit, I found the Googles Tradefederation Project which provides many functions related to ADB and fastboot. I had a deeper look into it and decided to write a toolkit based on this lib. Today I finished what I would call Release 0.1 alpha, a set of useful functions which are working quite well, even if providing only a command line interface.
I will improve the toolkit step by step within the following weeks. Some ideas I have in mind are:
- restore backup either using fastboot or using adb
- create flashable zip from backup
- provide a gui
- integrate drivers (like +Adam Outler's +CASUAL)
ART is written in Java, so principally it's running on Linux / iOS and Windows.The sources can be found on Github/AndDiSa/ART. Binaries are nor available yet, but I will provide a first release soon.
Samstag, 23. Februar 2013
Print current branch of each project
For me it happens often, that I do not exactly know, which project is currently checked out on which branch. If you are working on one single project, it's not a big problem. You execute
Creating a small shell script with the content shown above I can execute that script from the base directory of my projects and I am getting a full overview of the current status.
Dienstag, 19. Februar 2013
Native OTG USB disk support for Nexus 7 (WiFi) with Android 4.2.2
Since Android 4.2 the situation has become worse because of permissions and security changes and multi user support. The patch I am discribing here is not multi user compatible, i.e. all user will see all files on the external disk. So be warned if you want to use this feature.
First I want to describe a bit the modifications which need to be done to enable native OTG USB
- platform.xml is to be modified in such a way, that media_rw is allowed to access the external storage
<permission name="android.permission.WRITE_EXTERNAL_STORAGE" >
<group gid="sdcard_rw" />
<group gid="media_rw" />
</permission>
- vold.fstab is to be modified in such a way, that the usb is mounted automatically when the stick is plugged in
# Mounts the first usable partition of the specified device
dev_mount usbdisk /mnt/otg-usb auto /devices/platform/tegra-ehci.0
- init.grouper.rc is to be modified that on startup the mount directory is created
on init
...
mkdir /mnt/otg-usb 0777 sdcard_rw sdcard_rw
- storage_list.xml in framework-res.apk is to be modified that the external storage is added
<!-- external USB OTG storage -->
<storage android:mountPoint="/mnt/otg-usb"
android:storageDescription="@string/storage_usb"
android:primary="false"
android:removable="true" />
As you can see on the different files to be modified, several components of the Android system are involved, i.e.
- prepare a new ramdisk.img
- prepare a new framework-res.apk
- patch the platform.xml
I prepared an update.zip which applies the required modifications. The update.zip contains:
- a new boot.img including my kernel (based on android-tegra3-grouper-3.1-jb-mr1.1, but I've added DM9601 and KSM support) and a ramdisk.img with the required modifications for the otg-usb support.
- a patched framework-res.apk
- a modified platform.xml
This update is compatible only with stock Android 4.2.2 (JDQ39) and it will break future OTA updates!
If you want to apply this patch, so be sure you know what you are doing and do it on your own risk. I am not responsible for any bricks, data loss, etc.
Please note: I've tested this only on the Nexus 7 (WiFi) and I am not sure, whether it will work on the GSM-version, too, even if I believe it should work, it's disabled in the updater script at the moment.
Another thing to note: Currently only vFAT partitions are recognized. NTFS principially is supported, but vold is not handling NTFS correctly and displays an empty filesystem / a partition to be formatted.
Update 21.02.2013: I've added a pached vold to the new otg-usb-enable-20130221.zip. Now it's possible to mount also NTFS filesystems, but read only at the moment.
Samstag, 16. Februar 2013
Using an Davicom 9601 based USB-Ethernet-Adapter with the Nexus 7
I found out, that the USB-Adapter (JP1082) is based on the Davicom 9601 chipset, which principally is supported by the linux kernel, so I decided to build a kernel which is supporting that adapter.
I did a git clone of the nexus 7 kernel sources from https://android.googlesource.com/kernel/tegra and a checkout of the latest kernel branch
after running
to create the default nexus kernel configuration the Davicom adapter needs to be added to the configuration by opening .config and changing the line
to
CONFIG_USB_NET_DM9601=y
Now the kernel is ready to be built:
after a successfull compilation the kernel can be booted by
After booting the device and connecting the USB-ethernet adapter to the OTG-cable, you need to open a terminal window and call
to configure the ethernet link. That's all!
Samstag, 3. November 2012
anacron simulation on a Synology NAS
This is a post not directly related to Android, but to my NAS where I am storing all my personal files. I bought the Synology DS212+ some month ago and I am very happy with it. Having two 2TB hard disks build in, another external harddisk is connected via USB 3.0 for backup resons. This Harddisk I am switching on and off manually from time to time and when it is switched on, a cron job should back up all the files of the DS using rsnapshot to my backup disk.
On a first glance this should not be such a big problem, but digging into it there are some problems to be solved:
- starting the backup once via cron, the external harddisk might be switched off and no backup will be done :(
- starting the backup regularly via cron might lead to multiple backups for a single day :(
Unfortunately Synology is not providing anacron which provides the possibility to specify such "run once a period" tasks. I digged a bit around, but I couldn't find a simple suitable solution for my needs, so I wrote a small shell script which does the trick:
#!/bin/ash
#
# shell script to run a job once a period
# it takes three parameters:
# - name of the runfile
# - period definition ("1 day", "2 days", ..., "1 week", "2 weeks", ... "1 month", etc.)
# - program to be executed (i.e. backup-program / script)
#
#
# some helper functions
#
date2stamp () {
date --utc --date "$1" +%s
}
stamp2date (){
date --utc --date "1970-01-01 $1 sec" "+%Y-%m-%d %T"
}
dateDiff (){
case $1 in
-s) sec=1; shift;;
-m) sec=60; shift;;
-h) sec=3600; shift;;
-d) sec=86400; shift;;
*) sec=86400;;
esac
dte1=$(date2stamp $1)
dte2=$(date2stamp $2)
diffSec=$((dte2-dte1))
echo $((diffSec/sec))
}
###########################################################
#
#main program
###########################################################
EXECUTE="0"
RUNFILE=/var/run/$1
LOCKFILE=/var/run/"$1".lock
if [ -f $LOCKFILE ]
then
echo "other process running -> exiting" >> /var/log/runOnce.log
exit 2
fi
touch $LOCKFILE
#
# check whether runfile exists
#
NOW=`date -d 'now' --iso-8601`
if [ -f $RUNFILE ]
then
NEXTRUN=`cat $RUNFILE`
# check wether next run date is in the past
if [ `dateDiff -d "$NEXTRUN" "$NOW"` -ge 0 ]
then
EXECUTE="1"
fi
else
# did not run yet -> run forced
EXECUTE="1"
NEXTRUN=`date -d 'now' --iso-8601`
fi
if [ "$EXECUTE" == "1" ]
then
# execute (i.e. backup)
$3
STATUS_CODE=$?
if [ $STATUS_CODE -eq 0 ]
then
# set next execution date
while [ `dateDiff -d "$NEXTRUN" "$NOW"` -ge 0 ]
do
# add period
NEXTRUN=`date -d "$NEXTRUN + $2" --iso-8601`
done
# set next execution date
echo $NEXTRUN > $RUNFILE
fi
fi
rm $LOCKFILE
exit 0
This script in combination with some entries in my crontab did the trick. ;)
20 18-23 * * * root /root/runOnce.sh backupWeekly "1 week" /root/runWeeklyBackup.sh
40 18-23 * * * root /root/runOnce.sh backupMonthly "1 month" /root/runMonthlyBackup.sh
Dienstag, 23. Oktober 2012
G1 celebrates it's 4th birthday
Samstag, 20. Oktober 2012
Nexus 7 MTP automount on OpenSuse 11.4
Unfortunately Android 4.x devices cannot be mounted as a VFAT device any longer. While with 4.0 only the PTP mode is supported (which can be used to transfer photos only), on 4.1 you can switch between PTP mode and MTP mode in the settings.
While Windows has an acceptable MTP support, on Linux systems MTP is not supported out of the box, even worse if you want to automount your android device when connecting it. Looking around, I found Han-Wen Nienhuys go-mtpfs project on Github.
install mtpfs support
go-mtpfs is based on libmtp. For OpenSuse 11.4 you need to download the latest rpm from pbone.net and to install it on your system
After that, you can either checkout the go-mtpfs project from github and compile it by yourself or, probably more easy, download the binary from here.
You can install the binaries in every place you like, but it should be either on your path configuration or you need to define the full path to the binary when using it.
configure automount
Automount on current Linux systems is initiated by the udev system. In /etc/udev/rules.d/ you will find a set of rules which define what should happen when a new device is added, removed, ...
Create or modify a new ruleset, i.e./etc/udev/rules.d/50-android.rules. Here we need to add the following rules regarding the Nexus 7 device:
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e40", MODE="0666" # Bootloader
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="d001", MODE="0666" # Recovery
# Google Nexus 7 16 Gb PTP mode (camera)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e43", MODE="0666" # PTP media
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e44", MODE="0666" # PTP media with USB debug on
# Google Nexus 7 16 Gb MTP mode (multimedia device)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e41", MODE="0666" # MTP media
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e42", MODE="0666" # MTP media with USB debug on
# Google Nexus 7 MTP mode : automatic mount when plugged
ENV{ID_MODEL}=="Nexus", ENV{ID_MODEL_ID}=="4e41", ACTION=="add", RUN+="/usr/bin/sudo -u
ENV{ID_MODEL}=="Nexus", ENV{ID_MODEL_ID}=="4e42", ACTION=="add", RUN+="/usr/bin/sudo -u
# Google Nexus 7 MTP mode : automatic unmount when unplugged
ENV{ID_MODEL}=="Nexus", ENV{ID_MODEL_ID}=="4e41", ACTION=="remove", RUN+="/usr/bin/fusermount -u /media/nexus7"
ENV{ID_MODEL}=="Nexus", ENV{ID_MODEL_ID}=="4e42", ACTION=="remove", RUN+="/usr/bin/fusermount -u /media/nexus7"
Be sure, that the mount point /media/nexus7 exists and is accessable for your user.
After sudo /etc/init.d/boot.udev restart your Nexus 7 device should be mounted automatically to /media/nexus7 when plugged to your PC.
If you want to mount other devices, you only need to add the corresponding rules, i.e. you need to know the corresponding idVendor/idProduct values. Those you can figure out using the dmesg command after the device is plugged.
Freitag, 19. Oktober 2012
compile android 4.x on a 32-bit environment
Nexus 7 partition sizes (16Gb model)
| Partition Name | Partition Description | by_name | Size in Blocks | Size in MB |
|---|---|---|---|---|
| mmcblk0p1 | recovery | SOS | 12288 | 12 |
| mmcblk0p2 | boot | LNX | 8192 | 8 |
| mmcblk0p3 | system | APP | 665600 | 650 |
| mmcblk0p4 | cache | CAC | 453632 | 443 |
| mmcblk0p5 | misc | MSC | 512 | 0.5 |
| mmcblk0p6 | staging | USP | 10240 | 10 |
| mmcblk0p7 | provisioned | PER | 5120 | 5 |
| mmcblk0p8 | unknown | MDA | 512 | 0.5 |
| mmcblk0p9 | userdata | UDA | 14103552 | 13773 |
| mmcblk0boot0 | 2048 | 2 | ||
| mmcblk0boot1 | 2048 | 2 |
remote debugging over TCP/IP
You can debug your applications on your Android device not only over USB, but also over a TCP/IP (LAN / WLAN) connection. To enable tcp debugging you have to enter the following commands on your device:
stop adbd
start adbd
To start debugging enter on your PC:
adb connect <ip of device>
...
now you can debug as you are used to debugging over USB.
To disable debugging you have to enter the following commands on your device:
stop adbd
start adbd
More info can be found on Android Debug Bridge