How to create bare minimum Debian Wheezy rootfs from scratch

Originally posted on olimex:

debian-wheezy-download

In this post we will explain how you can create your own Debian rootfs with pre-installed packages of your choice, which to allow tiny Linux images to be created.

All steps below should work on any Debian host (Debian/Ubuntu etc) and are verified with Ubuntu 12.04LTS.

First of all you need to install the support packages on your pc

sudo apt-get install qemu-user-static debootstrap binfmt-support

Next you need to choose the version of Debian in this case we are building a wheezy image.

targetdir=rootfsdistro=wheezy

Now we will build first stage of Debian rootfs :

mkdir $targetdirsudo debootstrap --arch=armhf --foreign $distro $targetdir

Next copy the qemu-arm-static binary into the right place for the binfmt packages to find it and copy in resolv.conf from the host.

sudo cp /usr/bin/qemu-arm-static $targetdir/usr/bin/sudo cp /etc/resolv.conf $targetdir/etc

If everything is right we now have a minimal Debian Rootfs

sudo chroot $targetdir

Inside the…

View original 313 more words

Playing MIDI files in Ubuntu

sudo apt-get install timidity timidity-interfaces-extra

timidity awesometune.mid
timidity -ig

How to view the contents of an Android Application Package [APK] Certificate

Android APK packages are signed in almost the same way Java jar files are signed. Booth APK and normal jar file are a collection of files contained in a zip archives. This zip file contains a special directory called META-INF. You can list the content of an apk or jar by unzipping it.

shingu@abyss:~/workspace/apk_tool/app$ unzip -l SysScope.apk 
Archive:  SysScope.apk
  Length      Date    Time    Name
---------  ---------- -----   ----
     3912  2011-06-22 22:25   AndroidManifest.xml
    20480  2011-06-22 22:25   assets/databases/SysScope.db
    50780  2011-06-22 22:25   classes.dex
   132964  2011-06-22 22:25   lib/armeabi/libcordon.so
     3966  2011-06-22 22:25   res/drawable-hdpi/icon.png
     1537  2011-06-22 22:25   res/drawable-ldpi/icon.png
     2200  2011-06-22 22:25   res/drawable-mdpi/icon.png
     1200  2011-06-22 22:25   res/layout/main.xml
    18216  2011-06-22 22:25   resources.arsc
      722  2011-06-22 22:25   META-INF/MANIFEST.MF
      783  2011-06-22 22:25   META-INF/CERT.SF
     1772  2011-06-22 22:25   META-INF/CERT.RSA
---------                     -------
   238532                     12 files
shingu@abyss:~/workspace/apk_tool/app$ 

META-INF/MANIFEST.MF contains the list of files present in the APK and their digest of their content. The default digest used is SHA-1
it’s representation in the the manifest is the base64 encoded binary value ( unix tools like sha1sum or openssl sha1 display the hexadecimal encoded binary value)

shingu@abyss:~/workspace/apk_tool/app$ unzip -p SysScope.apk META-INF/MANIFEST.MF
Manifest-Version: 1.0
Created-By: 1.0 (Android)

Name: res/layout/main.xml
SHA1-Digest: nYLGdLfUklqrTBMXivY0tP7FmuI=

Name: res/drawable-ldpi/icon.png
SHA1-Digest: i7vxaosoiS+9HzKB7ZgIsXMYRLY=

Name: assets/databases/SysScope.db
SHA1-Digest: Pp+lZmoaigZ3Lby0SuT0A4L4agk=

Name: AndroidManifest.xml
SHA1-Digest: 27hkQcGfk0AxcQpmadjaRZzIeME=

Name: res/drawable-mdpi/icon.png
SHA1-Digest: 7Ft/Rirt+l/JRX2KjDREScdbCZk=

Name: resources.arsc
SHA1-Digest: XYx73APeTgDEHLnwBhn4K5cEdHI=

Name: lib/armeabi/libcordon.so
SHA1-Digest: QaKl9JJy03zb8M60RJHjERIZwQ0=

Name: classes.dex
SHA1-Digest: Ufn0Gq4pfRiUq30Gk7T9e3fwH88=

Name: res/drawable-hdpi/icon.png
SHA1-Digest: Vj/qhxk8ic8FE0/kT6E3vgRJ4mE=

shingu@abyss:~/workspace/apk_tool/app$ 

META-INF/CERT.SF (Signature file) In the manifest file, the SHA digest value for each source file is the digest (hash) of the binary data in the source file. In the .SF file, on the other hand, the digest value for a given source file is the hash of the three lines in the manifest file for the source file. The lines are “dos” terminated.

shingu@abyss:~/workspace/apk_tool/app$ unzip -p SysScope.apk META-INF/CERT.SF
Signature-Version: 1.0
Created-By: 1.0 (Android SignApk)
SHA1-Digest-Manifest: 5nayND/U8KFF85e23PLmiFxQYVw=

Name: res/layout/main.xml
SHA1-Digest: ZuC7g0HMvoicNdIyQPGeZFTkFJ4=

Name: AndroidManifest.xml
SHA1-Digest: sUzgN805uQc1gAvQL3jHjcd25Kc=

Name: assets/databases/SysScope.db
SHA1-Digest: CI1B8j8dBCkiWEUINw1n3qGrHMo=

Name: res/drawable-ldpi/icon.png
SHA1-Digest: Z/yxmMxGRNbFUkjqWONvJQH5rQw=

Name: res/drawable-mdpi/icon.png
SHA1-Digest: iR1AGdcgDutAX/5xyl92TWcEJuw=

Name: lib/armeabi/libcordon.so
SHA1-Digest: 2BEQBw0DTzVveHr1tqbI1LEULwY=

Name: resources.arsc
SHA1-Digest: SKbAH7ISHFKMDUEwYe3LDp0BYv8=

Name: classes.dex
SHA1-Digest: 74e4iOLLmlNLRgBZ7h2srgsjuBk=

Name: res/drawable-hdpi/icon.png
SHA1-Digest: 3vv9derC/UrLpiam9i2Yo16eHXw=

shingu@abyss:~/workspace/apk_tool/app$ 

META-INF/CERT.RSA The .SF file is signed and the signature is placed in the .RSA file.
The .RSA file also contains, encoded inside it, the certificate or certificate chain from
the keystore which authenticates the public key corresponding to the private key used for signing.

You can print out the certificates using the following lines of code:

openssl pkcs7 -inform DER -in CERT.RSA -noout -print_certs -text

keytool -printcert -file CERT.RSA

shingu@abyss:~/workspace/apk_tool/app$ unzip -p SysScope.apk META-INF/CERT.RSA | keytool -printcert 
Owner: EMAILADDRESS=android.os@samsung.com, CN=Samsung Cert, OU=DMC, O=Samsung Corporation, L=Suwon City, ST=South Korea, C=KR
Issuer: EMAILADDRESS=android.os@samsung.com, CN=Samsung Cert, OU=DMC, O=Samsung Corporation, L=Suwon City, ST=South Korea, C=KR
Serial number: d20995a79c0daad6
Valid from: Wed Jun 22 17:55:12 IST 2011 until: Sun Nov 07 17:55:12 IST 2038
Certificate fingerprints:
	 MD5:  D0:87:E7:29:12:FB:A0:64:CA:FA:78:DC:34:AE:A8:39
	 SHA1: 9C:A5:17:0F:38:19:19:DF:E0:44:6F:CD:AB:18:B1:9A:14:3B:31:63
	 SHA256: 34:DF:0E:7A:9F:1C:F1:89:2E:45:C0:56:B4:97:3C:D8:1C:CF:14:8A:40:50:D1:1A:EA:4A:C5:A6:5F:90:0A:42
	 Signature algorithm name: SHA1withRSA
	 Version: 3

Extensions: 

#1: ObjectId: 2.5.29.35 Criticality=false
AuthorityKeyIdentifier [
KeyIdentifier [
0000: 93 2C 3A F7 0B 62 7A 0C   76 10 B5 A0 E7 42 7D 6C  .,:..bz.v....B.l
0010: FA EA 3F 1E                                        ..?.
]
[EMAILADDRESS=android.os@samsung.com, CN=Samsung Cert, OU=DMC, O=Samsung Corporation, L=Suwon City, ST=South Korea, C=KR]
SerialNumber: [    d20995a7 9c0daad6]
]

#2: ObjectId: 2.5.29.19 Criticality=false
BasicConstraints:[
  CA:true
  PathLen:2147483647
]

#3: ObjectId: 2.5.29.14 Criticality=false
SubjectKeyIdentifier [
KeyIdentifier [
0000: 93 2C 3A F7 0B 62 7A 0C   76 10 B5 A0 E7 42 7D 6C  .,:..bz.v....B.l
0010: FA EA 3F 1E                                        ..?.
]
]

shingu@abyss:~/workspace/apk_tool/app$

Find all of the certificates and Issuer in a folder of apk’s

for filename in *; do 
    ext="${filename##*.}"
    if [ "$ext" = "apk" ]; then 
        echo $filename;
        unzip -p ${filename} META-INF/CERT.RSA | keytool -printcert | grep Issuer
    fi
done

Building Linux Kernel

1) Obtain Linux Source code
——-> 1.1) Obtain as a single file

Kernel is hosted at kernel.org. You can download the latest kernel from
ftp://ftp.kernel.org/pub/linux/kernel/

$ wget -c https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.13.5.tar.xz

——-> 1.2) Clone using git

$ git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git linux-git

2) Configure
——-> 2.1) Old Config

$ make oldconfig

——-> 2.2) Custom Config

$ make menuconfig

3) Building

$ make -j4

4) Installing

# make modules_install install

Launch other application from your application in Android

protected void launchApp(String packageName) {
	Intent mIntent = getPackageManager().getLaunchIntentForPackage(packageName);
	if (mIntent != null) {
		try {
			startActivity(mIntent);
		} catch (ActivityNotFoundException err) {
			Log.d("Shingu","App not found");
		}
	}
}

Get List of Installed packages in Android

To get the list of packages installed in the android, use below code.
More details @developer.android.com

protected void print_installed_pkgs() {
	final PackageManager pm = getPackageManager();

	//get a list of installed apps.
	List InstPackages = pm. getInstalledPackages(PackageManager.GET_META_DATA);

	for (PackageInfo packageInfo : InstPackages) {
			Log.d("Shingu", packageInfo.packageName);
	}
}

பிராத்தனை | கோடிட்ட இடங்களை நிரப்புதல் – சுமதி ராம்.

பிராத்தனை
—————
ஒரு நாளும் பள்ளி பேருந்தில்
ஏற்றி விடாத
அப்பா வாய்க்கப்பட்ட மகள்,
பார்த்து விடக்கூடாது,
பேருந்திற்காக காத்திருக்கும்
தன் மகளின் பள்ளி சீருடையை
சரி செய்து கொண்டிருக்கும்
ஏதோ ஒரு அப்பாவை.

- சுமதி ராம்.

 

Translation :

Title : Entreaty

A girl, whose father has never sent her in a school bus,
Should not see, a father who lovingly adjusts his daughters uniform,
while waiting for her school bus.

This is a poem by Sumathi Ram, Director Ram‘s Wife in her Poetry collection titled “Koditta Idangalai Niraputhal“.

Follow

Get every new post delivered to your Inbox.