Notes en vrac sur le build d’une ROM Android sur une base Rockchip

construire une rom android.

___

Docs officielles android pour le build d’une ROM: https://source.android.com/source/building-running.html

Configurer l’environnement pour avoir les actions dans l’environnement.

$ . ./build/envsetup.sh
S’assurer que le device est vu par le port USB

===============================

voir les usb:

$ lsusb 

$ dmesg

Faire un udev pour avoir un nom potable dans le /dev et avoir l’adb qui le detecte vi /etc/udev/conf.d/50-custom_device.conf

ajouter la ligne suivante en faisant matcher le vendor et le product avec la sortie de lsusb (ici 04e8:6860) le group est le group (systeme) authorisé a utiliser le device, le symlink est le nom affiché SUBSYSTEM== »usb », ATTRS{idVendor}== »04e8″, ATTRS{idProduct}== »6860″, MODE= »0666″ GROUP= »my_group », SYMLINK+= »i9305″

recharger la config udev

udevadm control --reload-rules

optionnel : update adb list

$ android update adb

ajouter le product id dans la liste adbf Edit $HOME/.android/adb_usb.ini, add 0x2207 at the end of the file Restart adb server

$ adb kill-server && adb start-server

List android device

$ adb devices

lien pour la doc sur udev: http://www.reactivated.net/writing_udev_rules.html#syntax https://wiki.debian.org/udev

monter l’ensemble du systeme de fichier d’un android:

==================================

doc sur : https://github.com/spion/adbfs-rootless

adbfs /chemin_de_mount

Suivre le readme Attention il faut avoir les droit pour lancer l’outil car il lance fuse qui accede a bas niveau:

recuperer l’IMEI:

============

taper sur le tel *#06#

faire un backup

=============

backup dans le repertoire courant (cree le fichier backup.ab)

adb backup -apk -shared -all

restaurer depuis le fichier backup.ab

adb restore backup.ab

arreter le server proprement

adb kill-server
installer un recovery correct:

=====================

Telecharger recovery clockwork puis installer heimdall lancer l’installation de la recovery:

$ heimdall flash --RECOVERY /home/ow-cve/dev/RCW/recovery-clockwork-6.0.4.7-i9305.img
Extraire les données d’une img rockchip:

========================================

You’ll first need to build rk-tools:

git clone https://github.com/rk3066/rk-tools.git cd rk-tools sudo apt-get install libssl-dev libcrypto++-dev make

Then use img_unpack tools to unpack the firmware to another format:

./img_unpack update_mk908_106j2107_04.img update_mk908_106j2107_04_unpack.img rom header code: 1060000 rom version: 4.1.1 build time: 2013-09-07 10:39:22 chip: 70 checking md5sum....OK

Finally, run afptool to extract the files from the resulting file into “firmware” directory:

./afptool -unpack update_mk908_106j2107_04_unpack.img firmware Check file...OK - UNPACK - package-file 0x00000800 0x00000242 RK3188Loader(L)_V1.20.bin 0x00001000 0x0002F8AE parameter 0x00031000 0x00000264 Image/misc.img 0x00031800 0x0000C000 Image/boot.img 0x0003D800 0x00A2C000 Image/recovery.img 0x00A69800 0x00BFC000 Image/system.img 0x01665800 0x1A630000 backupimage/backup.img 0x1BC95800 0x01665004 update-script 0x1D2FB000 0x000003A5 recover-script 0x1D2FB800 0x0000010A UnPack OK!
Ajouter une app dans le framework:

==================================

copier l’app dans /packages/apps/<mon_app_dir> copier un Android.mk d’une autre app et mettre a jour les parametres de celui-ci.

Lancer la compilation d’une app:

=================================

Configurer l’environnement pour avoir les actions dans l’environnement.

$ . build/envsetup.sh

$ mmm /packages/apps/<mon_app_dir>
Faire un package d’update rockchip:

===================================

afptool et img_pack ne gere pas bien les chemin absolu donc : – faire un lien sym « tmp » dans le repertoire d’afptool qui pointe vers les img du build android

– puis creer le script suivant dans le repertoire afptool:

#!/bin/bash

set -e

cd `dirname $0`

rm -f tmp.img
rm -f update.img

# put all img in one single img
./afptool -pack tmp tmp.img

# add RockChip specific param and bootloader
./img_maker -rk31 tmp/RK3188Loader_2.16.bin 1 0 0 tmp.img update.img

rm -f tmp.img

echo "update.img is at `pwd`/update.img"

ca genere un fichier update.img dans le repertoire d’afptool.

How to disable location or telephony on android box : use the system properties

If you have the sources of your box and you want to disable permanently some services you can use system properties.

first look at there, you’ll see how services are started :

frameworks/base/services/java/com/android/server/SystemServer.java

then you’ll see that most of the services have a boolean related to a system property, for instance location :

 boolean disableLocation = SystemProperties.getBoolean("config.disable_location", false);

and deeper in the file, you’ll see that this boolean is used to disable the service :

 if (!disableLocation) {
               try {
                   Slog.i(TAG, "Location Manager");
                   location = new LocationManagerService(context);
                   ServiceManager.addService(Context.LOCATION_SERVICE, location);

so basically you just have to find your system property file in your device tree, and force the value to true. Use a « find » to get it.

On rockchip device it is easy : the file name is system.prop. This file is used to generate the build.prop in the out folder.

Another way to force system properties is to use the Android.mk and force value with this specific token:

 
 PRODUCT_PROPERTY_OVERRIDES += \
    config.disable_location = true

Enjoy!

Enregistrer la sortie audio sur debian

Installation

Installer pulseaudio et sox,

Lancer pulseaudio :

 pulseaudio start

Récupérer la liste des entrée/sortie disponibles

 pactl list

Enregistrement

Enregistrer l’entrée monitor qui est une copie de la sortie audio dans un fichier wav 44kHz, 16 bit (entier signé) sur 2 canaux

 parec -d alsa_output.pci-0000_01_00.1.hdmi-stereo.monitor |sox -t raw -r 44k -b 16 -e signed-integer -c 2 - music.wav

Pour cibler le maximum de qualité en sortie, on peut passer sur du 64bit a virgule flotante:

 
 parec -d alsa_output.pci-0000_01_00.1.hdmi-stereo.monitor |sox -t raw -r 44k -b 64 -e float -c 2 - music.wav

Enregister le flux audio et vidéo de son bureau

!!! Pré-requis

* installer pulseaudio
* installer’ libav

!!! How to

Enregistrer le son et la video dans un fichier mkv :

avconv -f x11grab -video_size 1600×900 -i :0.0 -f alsa -i pulse -c:v’ libx264 -rc-lookahead 1 -threads 4 test.mkv

{{ adapter a la taille de l’ecran et le nombre de threads }}

Pour plus d’info sur libav : [Libav|https://ibav.org/documentation/avconv.html#libx264|en]

Lancer pavucontrol pour dirigier le flux audio sur avconv. La sortie monitor » permet d’avoir une copie du flux audio de sortie dans une entrée d’enregistrement.

!!! Annexe

Vous pouvez tenter aussi recordmydesktop avec pulseaudio

recordmydesktop –device pulse

La qualité video est meilleure’

How to remove an IP from Microsoft Blacklist

Some information related to Microsoft blacklisting:

https://technet.microsoft.com/en-us/library/dn458545%28v=exchg.150%29.aspx

https://mail.live.com/mail/services.aspx

A form to declare valid IP from your domain:

https://support.microsoft.com/en-us/getsupport?oaspworkflow=start_1.0.0.0&wfname=capsub&productkey=edfsmsbl3&locale=en-us&ccsid=635786776026032458

Look at your logs

Look at the message in your mail log. You should see the email address of a contact. You can also directly send an email to delist@messaging.microsoft.com

Check with a tool

A good tool to check if you are blacklisted: http://mxtoolbox.com/blacklists.aspx

Check you DNS zone file

Once blacklisted, make sure you are correctly setup on your side and check your DNS zone file: – SPF record – PTR

Send an email to gmail.com or yahoo and check the email header, it contains details regarding SPAM detection and SPF check.

Exim4 on ubuntu : startup options and queue timing

On ubuntu, xim4′ ‘configuration is based on template stored in /etc/exim4 (splitted or one block configuration template depending on your choice).
The real configuration file s’ ‘generated on the fly in /var/lib/exim4/config.autogenerated

Instead of using generated configuration, you can copy paste the configuration file from /usr/hare’/’doc/exim4-base in /etc/exim4, or use the generated one.

More over the /etc/init.d/exim4 load additional setting that control the option used to launch xim4 that’ ‘are as important as the configuration file.

So you should have a look to /etc/default/exim4, there you can find the queue start frequency for’ instance.

How to setup 2 virtual hosts with different wildcard SSL certificates on the same apache

  • you need one dedicated IP per wildcard certificate in order to let apache route the request to the correct certificate.
  • use the NameVirtualHost option to indicate that two IPs will resolve the nameVirtualHost instead of using the classic *:443 value.: A.A.A.A:443 and B.B.B.B:443
  • setup each virtual host with the dedicated IP instead of *:443. and define the SSL certificate as usual.
  • all virtuals hosts that are under certificate A must use the IP A.A.A.A:443 and the others virtual host must use the IP B.B.B.B:443

How to setup 2 public IPs on AWS instance

In instances

Select instance and add private IP on the existing ethernet card.

In network :
  • buy 2 elastic IPs
  • attach first EIP to the existing ethernet’ card of the instance
  • attach the second EIP to the existing ethernet but select the second private IP.
Setup VIP

ssh to the instance and setup a static VIP on’ the ethernet card with the second private IP

ifup the VIP, and that’s it.

Notes

Using two ethernet cards is feasible but it implies to setup routing’ table. Using VIP avoids playing with routing tables and managing two cards.

IOS – background task and precise geolocation

When trying to work in background with IOS, things get tricky particularly when it requires a good precision update (when the significant update stuff is not enough).

first thing to do : start a background task :

- (void)applicationDidEnterBackground:(UIApplication *)application

{

    bgTask = [application beginBackgroundTaskWithName:@"MyTask" expirationHandler:^{

        // Clean up any unfinished task business by marking where you

        // stopped or ending the task outright.

        [application endBackgroundTask:bgTask];

        bgTask = UIBackgroundTaskInvalid;

    }];

 

    // Start the long-running task and return immediately.

    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{

 

        // Do the work associated with the task, preferably in chunks.

 

        [application endBackgroundTask:bgTask];

        bgTask = UIBackgroundTaskInvalid;

    });

}

Extracted from apple dev center: https://developer.apple.com/library/ios/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/BackgroundExecution/BackgroundExecution.html

while the task is running the didUpdateLocation event is correctly handle by the application.

you have only 180 seconds to finish the task before being killed by the OS. use the backgroundTimeRemaining to see how much time is left. Make sure you have finite task and you have the correct background mode setup to avoid being killed before.