Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

[Linux] How to speed up Android Emulator

  • 0
If you are using the android AVD emulator under linux, you may have noticed that its performance is very poor. However, to speed up the android emulator you can use Intels Hardware-assisted Virtualization (hypervisor). This How-To describes the necessary steps to enable Hardware-assisted virtualization on (X)ubuntu 13.10.

First you need to install KVM:
Check if your processor actually supports hardware virtualization:
 $ egrep -c '(vmx|svm)' /proc/cpuinfo  
A return value "0" means that your processor does NOT support hardware virtualization.
Now install cpu-checker:
 $ sudo apt-get install cpu-checker  
and check if your cpu supports KVM:
 $kvm-ok  
Now you need to enable Virtualization in the BIOS setup of your machine.
Now you have all the requirements fulfilled to install KVM:
 $ sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils  
After the installation you need to add your user to the "kvm" and "libvirtd" group:
 $ sudo adduser your_user_name kvm  
 $ sudo adduser your_user_name libvirtd  
Now it's time to reboot your machine, or simple logout and login again.
Start Eclipse and create a new Virtual device. Under CPU/ABI you should now be able to select "Intel Atom (x84)". If not you may want to install the "Intel x86 Atom System Image" for your desired Android API with the Android SDK Manager in eclipse.

To start the emulator use the command:
 $ <SDK directory>/tools/emulator-x86 -avd Your_AVD_Name -qemu -m 2047 -enable-kvm  
I recommend that you create a little bash script which uses the command above to start your AVD.


Note: if you want to start the AVD from eclipse do the following:
1) In Eclipse, click your Android project folder and then select Run > Run Configurations...
2) Select your Android project run configuration or create a new configuration.
3) Click the Target tab.
4) Select your AVD device.
5) In the Additional Emulator Command Line Options field, enter:
 -qemu -m 2047 -enable-kvm  

-- Sources: Ubuntu Documentation Intel Blog Post

Making Eclipse look more beautiful on Linux

  • 0
You may have noticed that Eclipse, other than on the windows OS, looks kind of clumpsy on Linux. This is because the fonts are too heavy and big, at least for my taste.

Changing the font size via Window --> Preferences only affects the Editor font sizes. But that's not enough. So here's a workaround to change the font size of all the menus, dialogs, etc. in Eclipse on Linux.

In your home directory create a file named: ~/.gtkrc-eclipse with the following content:

 style "eclipse" {  
     font_name = "Sans Condensed 8"  
 }  
 class "GtkWidget" style "eclipse"  

Now you can start Eclipse with a this command:

 GTK2_RC_FILES=/usr/share/themes/Clearlooks/gtk-2.0/gtkrc:/home/user/.gtkrc-eclipse '<path to your eclipse bin>'  

Or if you want to create an Launcher icon use this command:

 env GTK2_RC_FILES=/usr/share/themes/Clearlooks/gtk-2.0/gtkrc:/home/user/.gtkrc-eclipse '<path to your eclipse bin>'  

Now you should see way smaller fonts in the menus and dialogs of Eclipse.
But what's with the Tabs? They have still too large fonts. In order to change the font size of tabs, we have to tweak a little more:

In your eclipse installation directory go to:
 /plugins/org.eclipse.platform_*/css  

and open e4_default_gtk.css with your text editor.
Here you can see a section similar to this:

 .MPartStack {  
      font-size: 9;  
      swt-simple: false;  
      swt-mru-visible: false;  
 }  

Simply change the font size or erase this line.
Restart eclipse and obtain the results.

--
This workaround was tested on Xubuntu 13.10 and LMDE Cinnamon with Eclipse Kepler.

[Linux] Add AVR Assembly (*.s) Syntax Highlighting to Geany

  • 0
One of my favorite Linux Text Editor is Geany. However, if you want to write avr assembler programs with Geany, you may notice that it does not support syntax highlighting for *.s assembly-files. This will show you how you can easily create your custom filetype configuration for your assembly source files in order to get full syntax highlighting support for avr assembly programs.

First copy the standard file for filetype configuration filetype_extensions.conf to your local geany config directory:
 cp /usr/share/geany/filetype_extensions.conf ~/.config/geany
To recognize the new filetype extension, add the following line to your local filetype_extensions.conf.
Avr=*.s;
Now,Arthur Artamonov contributed an improved filetypes.asm which conaints the AVR instuctions. The file is listed below:


Source: http://wiki.geany.org/config/avr_asm

Notice: You have to change the file extension format:
Just change the line:
extenstion=asm
to
extenstion=s
Right after this line you have to specify a lexer for your file format. You can use the one from ASM. so right after the above line add the following:
lexer_filetype=ASM
Save this file with filename: filetypes.Avr.conf  in ~/.config/geany/filedefs

And you are done!


(Re)Start Geany and try opening a *.s assembly source file. The content of the file should be nicely displayed with syntax highlighting.

Notice: You can do a lot moar with custom filetypes. For this, take a look at the Geany Manual.

:)