Tuesday, June 11, 2013

multi-tab cygwin

Check  out "Console" at

Go to Edit -> Settings, set Shell to C:\cygwin\Cygwin.bat (or wherever your Cygwin path is)


emacs: terminal type cygwin is not defined
I encounter such problem when using Console to ssh to a remote machine and emacs
export TERM=ansi


Friday, June 7, 2013

Install emacs on Solari (SunOS) without root

Finally... done installing emacs on Solari without root -- really a painful process, so I decide to write this down and hopefully it can be helpful for people in same needs.

Normally, on a Unbuntu machine, install emacs without root would be easy. Suppose we want to install it in /home/xxx/emacs folder

1. Download the emacs source from http://www.gnu.org/software/emacs/ and untar the source to a folder

2. Go to the emacs source folder, run

    ./configure --prefix=/home/xxx/emacs
  make all
  make install

    in which --prefix=/home/xxx/emacs in configure command tells emacs to install everything to that folder.

3. Finally, add /home/xxx/emacs/bin to your PATH, done.

Simple and easy, right?

However, on Solari, everything got complicated (at least for me, a guy who first time use Solari), let me list the problems I encountered during the each step numbered above

1. First problem I find is that, "tar xzvf" is not working on Solari...
    Solution: use "gtar xzvf" instead

2. In the second step, first small problem is ./configure fails and says please add "--with-gif=no" option, that's  easy, just do it.

    The true problem comes when I find that typing gcc or make in terminal would result in "command not found"
    Solution: gcc is in /usr/sfw/bin or /usr/local/bin, make is in /usr/ccs/bin, add those three directory to PATH.
    Or, you can go to /usr and run
     find . -name gcc
  find . -name make
    to figure out where are those binaries then add it to PATH

    With PATH set properly, I try to make and install emacs 24.3, everything goes well. But after installing, when I try to run emacs, it won't boot and pop out an error message:
     Fatal error 6
     It turns out that the newest emacs 24 has some problem when running on older system (I don't remember the exact reason, something like emacs 24 does not support old version lisp)
     Solution: download emacs 23 instead, for me I used emacs 23.4

     Then repeat the same process. This time during make install, an error occurs:

chmod -R a+r /home/ding34/emacs/share/emacs/23.4/leim
for installuser in ${LOGNAME} ${USERNAME} ${USER} \
  `id -un 2> /dev/null`; do \
  [ -n "${installuser}" ] && break ; \
done ; \
find /home/ding34/emacs/share/emacs/23.4/leim -exec chown ${installuser} '{}' ';'
*** Error code 2
make: Fatal error: Command failed for target `install'
Current working directory /l/mobilityhome/ding34/emacs/tar/emacs-23.4/leim
*** Error code 1

     It turned out that the error is from the line
for installuser in ${LOGNAME} ${USERNAME} ${USER} \
  `id -un 2> /dev/null`; do \
     in leim/Makefile.
     The reason is the "id" command has different syntax on Solari compared to on Unbuntu, run "id -un 2" and it will tell you "id: illegal option -- u". Since the id command fails, the make will consider it as an error, report it, and exit.
     Solution: delete `id -un 2> /dev/null` part in the leim/Makefile, and re-run make install

     With one afternoon and one morning's effort, finally I got our lovely emacs working.

     Oh, one more thing, don't forget to put the emacs binary directory (which is /home/xxx/emacs/bin) into PATH!

     Set up PATH:
     Edit ~/.bash_profile file (create it if it does not exist), and put all the export statement in it. It will take effect when you launch terminal next time. (So for the current terminal, you may still need to manually run export to set up PATH)

Thursday, June 6, 2013

cannot open google.com

This morning, I find my chrome cannot visit google.com -- it always says "the website is not available", while all other websites work well

clear cookies
for Chrome, go to Settings -> Show advanced settings... -> content settings .. (under Privacy tab) -> All cookies and site data... -> remove all

And google works again.

Saturday, May 11, 2013

Friday, May 10, 2013

Missing "Developer Option" in CM 10.1

After flashing CM 10.1, find the developer option missing

Solution is here:
Settings -> About phone
click "Build number" for several times, the developer option will appear...

I know it sounds like a joke... but try it, it works...

Thursday, May 9, 2013

extract-files.sh: remote object does not exist

According to the official Cyanogenmod build guide, there is one step called "Extract Proprietary Blobs", in which you have to connect the device with USB and run "extract-file.sh" to get those "blobs" from the device.

However, in running the extract-files, it's very often to see output like
remote object '/system/lib/egl/libplayback_adreno200.so' does not exist
It didn't say it's an "Error", but actually the script will just stop there, leaving the remaining blobs unextracted.

If you thought, oh, only one file does not exists, maybe not a big deal, so you continue to build the framework, it's highly likely that the framework you build will not work properly, due to lack of blobs.

Download a released Cyanogenmod for that device (the same version with the one you are trying to compiling), unzip it to a folder, suppose the folder is "/home/cm"
Then when running the extract-file.sh, instead of connecting your device to USB and extracting from device (which is the default behavior if you don't provide any argument to the extract-files.sh), you can simply run
./extract-files.sh /home/cm
(replace /home/cm to the folder where you unzip the Cyanogenmod, of course)
Then the extract-files.sh will copy blobs from that folder.

If there is still some file missing (e.g. libpn544_fw.so for Galaxy S3), then google it, download it and put it in the right path -- in general, missing blobs is not a good thing, we should avoid it as much as we can, and that's why I commented out the text below, which is a very bad solution.

When I try to follow the wiki page to build Cyanogenmod from source, there is one step called
Extract Proprietary Blobs
in which I need to go to device/samsung/quincyatt folder and execute extract-files.sh to get those "blobs" from the device.

In executing the extract-files.sh, the script stops and says
remote object '/system/lib/egl/libplayback_adreno200.so' does not exist
Well, it's not an error, so I thought it happens to be the last file not exists, but actually it's not.
Go to the device folder, and run
grep -lr "libplayback_adreno200.so" *
I find it's in samsung/msm8660-com/com-proprietary-files.txt, so open that file, search for "libplayback_adreno200.so", and comment it out, re-execute the script, the script proceeds to extracting more files.

If similar error happens again, just repeat the same process.

Wednesday, May 8, 2013

Error: selected processor does not support ARM mode smc #0

When compiling kernel for SGH-I717, an error occurs:
Error: selected processor does not support ARM mode smc #0

It happens when
CC   arch/arm/mach-msm/scm.o

So following the post http://blog.csdn.net/gchww/article/details/7571584 and http://wakefang.blogspot.com/2011/08/error-selected-processor-does-not.html,

open scm.c (since this is the file where the compilation error occurs, as shown in the error message above. You should replace it with the appropriate file in you case, of course) and search for "asm", add the following line

asm(".arch_extension sec\n\t");

before every asm instruction.
Re-compile, it works.

P.S. if same error occurs again for another file, do the same operation for that file.

Samsung Note Model Number

When I try to get the kernel source code from http://opensource.samsung.com/, there is a full list of SGH-I717 models, like

And I'm not sure which one to get.

Google it and find that:
SGH-I717 = AT&T
SGH-I717R = Rogers
SGH-I717D = Telus
SGH-I717M = Bell

Since I'm in US and using AT&T, I should download the one for SGH-I717

Hope this helps if you have the same question : )

Get standalone ARM Toolchain for Android from NDK

This tutorial shows how to get standalone ARM toolchain for Android.

Actaully... you can get standalone ARM toolchain by
$ sudo apt-get install gcc-arm-linux-gnueabi
That's it.. no need to continue reading..

It used to be very complex procedure to build a toolchain, but luckily in NDK, google already prepare it ready for you. Follow the steps below, you will get your standalone toolchain (cross compiler) for ARM in 10min.

1. Download the Android NDK from
    and untar it

2. There is a "toolchain" folder in the ndk, but I find that if I use that directly, there will be errors like:
    stdio.h:50:23: fatal error: sys/cdefs.h: No such file or directory
    If you go to the "docs" folder in the ndk folder, in STANDALONE-TOOLCHAIN.html, it explains in detail how to get a standalone toolchain from the ndk.
    For your convenience, I post the command here:
    First go to your ndk folder
    $ ./build/tools/make-standalone-toolchain.sh --platform=android-9 --install-dir=~/my-android-toolchain-dir

    The --platform=android-9 specify the Android API level you want to support; --install-dir specifies the directory where you want to put the toolchain, if you omit the --install-dir, it will create a tar.bz2 file for you, and you can untar it anywhere you want -- which is better, i think : )
    If you are using 64bit Linux, you will have to add --system=linux_x86_64 in the command above

3. Try to compile a HelloWorld program using the new toolchain, and enjoy!