Tuesday, August 2, 2016

Add Pre-compiled aar library to Android Studio 2.1

Just add the aar-Files as Modules: File -> New -> New Module -> Import .AAR Package.

Monday, March 28, 2016

Nexus 9 Marshmallow update from Android LMY48M

Recently I wanted to update my Nexus Android OS version 5.1.1 LMY48M to Android N. I downloaded a system image from Google website and could not update since I got unlock denying error when using "fastboot oem unlock" or "fastboot flashing unlock". So I followed the instructions provided by  dsclee1 to update LMY48M to  Android N.

1. Reboot into HBOOT with "adb reboot bootloader"
2. Press Volume Down to highlight Recovery, then press the Power Button to enter it.
3. Wait until the Google logo goes away, and you should see a picture of an Android laying on it’s back. Hold down the Power Button + Volume Up (very important to hold Power FIRST)
4. Download Nexus 9 (Wi-Fi) LMY48T from LMY48M
5. If you don’t have it already, download and install “Minimal ADB and Fastboot”: when it’s installed let it run straight away, and leave the command prompt open you’ll need it in a min
6. Copy the OTA update file you downloaded to the folder that Minimal ADB was installed in (usually C:\Program Files (x86)\Minimal ADB and Fastboot\)
7. Back on your device use Volume down to get to “Wipe Cache Partition”, and press the Power Button to activate it. If you want to be really sure this will work you should do a “Wipe data/factory reset” too, but be aware you will definitely lose your data.
8. Use Volume up to go to “Apply update from ADB”, and press the Power Button to enter it
9. On your PC, in the Minimal ADB Command Prompt (that you should still have open from earlier) enter “adb sideload {NAMEOFOTAFILE}”
10. Reboot
11. Go to the Settings->About->Software Update, and the device will update it self to Android N 6.0.1.

Or in the 4 step, directly update it from MRA58K from LMY48M if we can find the OTA firmware but I did not find it.

Tuesday, March 8, 2016

CENTOS: /usr/bin/ld: cannot find -lfl

Installing the flex-devel.x86_64 package.

Wednesday, March 2, 2016

Ubuntu 12.04 (Precise Pangolin) on Beagleboard XM / Pandaboard

Downloading Ubuntu

Download the compressed image from http://cdimage.ubuntu.com/releases/12.04/

  • For BeagleBoard XM, use ubuntu-12.04-preinstalled-desktop-armhf+omap.img.gz
  • For Pandaboard, use ubuntu-12.04-preinstalled-desktop-armhf+omap4.img.gz

Writing the image

You should write the raw image to a blank SD card. Make sure you're using at least a 4G SD card (desktop image is 2G uncompressed).


  1. Place the SD card at your host computer.
  2. Make sure the SD card is not mounted (just umount it if needed)
  3. Identify the correct raw device name (like /dev/sde - not /dev/sde1)
  4. Run the following command to write it:
zcat ./ubuntu-12.04-preinstalled-desktop-armhf+omap.img.gz |sudo dd bs=4M of=/dev/sde ; sudo sync
Warning /!\ Some people have reported issues with this method. If this doesn't work, try the following commands:
  1. gunzip ubuntu-12.04-preinstalled-desktop-armhf+omap.img.gz
  2. sudo dd bs=4M if=ubuntu-12.04-preinstalled-desktop-armhf+omap.img of=/dev/sde
  3. sudo sync

MAC (OSX 10.x)

Download the image and extract it with the system archive utility, you should get a .img file if the disk is mounted disk1.. disk2.. not - disk0, unmount it with the following code.
sudo diskutil unmountDisk disk1
Then use the following code to write the image to disk1 (not - disk1s1..)
sudo dd bs=4m if=ubuntu-12.04-preinstalled-server-armhf+omap.img of=/dev/disk1
If you get any errors trying to run the following code then try reinserting the SD card and trying again after unmounting the disk, or try formatting it first with DiskUtilities

Windows (XP/Vista/7)

Download the image and extract it using WinZip or some other archive utility. Then use Win32ImageWriter to write the unzipped img file to your flash device.
This is a Windows program for saving and restoring images from removable drives (USB drives, SD Memory cards, etc). It can be used to write boot images (i.e. ubuntu-12.04-preinstalled-desktop-armhf+omap.img) to a SD Flash device or USB flash device, making it bootable.
Win32DiskImager supports writing an ISO image to USB too, which is very valuable right now with the Ubuntu releases 14.04 LTS - 15.10, because there are problems with the Ubuntu Startup Disk Creator.
The program and source code can be downloaded from here.
This tutorial subpage with screenshots illustrates how to create a USB boot drive from a Lubuntu ISO file. It works in the same way for all current Ubuntu family iso files including the Ubuntu mini.iso version 14.04 LTS (but mini.iso version 12.04 LTS is the only exception).

Booting the image

On Pandaboard and BeagleXM just switch on the board with the SD card inserted.

Thursday, December 10, 2015

Avoiding Duplicate File / Symbol Issues Linking 3rd Party Library on iOS

1. File Name Conflicts or Same Duplicated Symbols

$ lipo -info libTest.a
Architectures in the fat file: libTest.a are: armv7 i386
Then to extract just armv7, for example:
$ lipo -extract_family armv7 -output libTest-armv7.a libTest.a
$ mkdir armv7
$ cd armv7
$ ar -x ../libTest-armv7.a
You can then extract the same architecture from the other library into the same directory, change file names, and then recombine them like so:
$ libtool -static -o ../libTest-armv7.a *.o
And then finally, after you've done this with each architecture, you can combine them again with lipo:
$ cd ..
$ lipo -create -output lib.a libTest-armv7.a libTest-i386.a
This should get rid of any duplicate symbols if we can assume the 3rd party libraries are the same between two libraries, when combining the two libraries into one. If you want to keep them separate, or just delete the duplicate from one library, you can modify the process accordingly.

2. Not Many Symbols Conflicts

Michael Tyson mentioned to use the preprocessor to rename the symbols automatically during the build phase.

This is done by adding a series of -DOldSymbol=NewSymbol flags to the ‘Other C Flags’ build setting – like -DTPCircularBuffer=ABCircularBuffer, for instance in XCode.

3. Many Symbols Conflicts

We may need prefix other static libraries to use a two-pass compilation process:

  • The first pass builds the dependent project and runs nm to dump all symbols into a header file.
  • The second pass builds the dependent project again, but this time with the generated prefix header file imported in the precompiled header. This prefix header must be used anywhere you reference symbols from the dependency in your framework in order to properly refer to the renamed symbols.
 Kamil Burczyk gave a very good tutorial, "Avoiding dependency collisions in iOS static library managed by CocoaPods". For example, to get a TEST symbols in lib.a :

$ nm lib.a | grep TEST
You will get a list of all symbols of TEST. Then use a script to add a prefix to all of the symbols in final .a file so that e.g. TEST becomes NEW_TEST under a #ifdef. Your version of dependency is not connected to version used by developer and no collisions occurs.

Wednesday, December 9, 2015

XCode 7 Link Errors for Simulator "Building for iOS simulator, but linking in object file built for OSX, for architecture ..."

Recently I encountered XCode 7 link error when compiling iOS simulator.  The error was "Building for iOS simulator, but linking in object file built for OSX, for architecture i386". After adding "-O2 -m32 -miphoneos-version-min=5.0" to the compiler switch, the problem went away.

Friday, October 30, 2015

ffmpeg supports both x265 and Kvazaar HEVC encoder

Tampere University of Technology has developed Kvazaar HEVC encoder since 2014. as LGPLv2.1-licensed open-source HEVC encoder. Their goals are
  1. Coding efficiency close to HEVC reference encoder (HM)
  2. Modular encoder structure to simplify its data flow modeling
  3. Efficient support for different parallelization approaches
  4. Easy portability to different platforms
  5. Optimized encoding speed without sacrificing its coding efficiency, modularity, or portability
  6. Reduced computation and memory resources without sacrificing its coding efficiency, modularity, or portability
  7. Excellent software readability and implementation documentation
Like x265 being used in FFmpeg,

FFmpeg can make use of the kvazaar library for HEVC encoding.
Go to https://github.com/ultravideo/kvazaar and follow the instructions for installing the library. Then pass --enable-libkvazaar to configure to enable it.
It is also added in the Libav FFmpeg fork. It could be interesting to compare this to x265.


About Me

My photo
HD Multimedia Technology player