How to compile native C library and native C program as part of Android AOSP’s external directory using Android.mk makefile

To compile any c library inside android, we need to write an Android.mk makefile, for reference please check below, $ mkdir external/mysource $ cd external/mysource $ vim Android.mk To compile as Shared Library, LOCAL_PATH := $(call my-dir)include $(CLEAR_VARS)LOCAL_SRC_FILES := library_source.c LOCAL_C_INCLUDES :=$(LOCAL_PATH)LOCAL_CFLAGS := -O2 -g -W -Wall -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_HLOCAL_MODULE := libmylibLOCAL_MODULE_TAGS := debugLOCAL_SYSTEM_SHARED_LIBRARIES := … Read more

Monitor Memory, CPU usage, processes i.e. system resources on Linux

System administrators need to monitor their server to ensure proper functioning. The practice enables administrators to detect possible issues in advance and recover the system, before it causes any trouble. There are plenty of commands on Linux to monitor different system resources like cpu usage, memory usage, network, disk usage and so on. Popular ones … Read more

Adding a new board or platform to android source & build

add a file AndroidProducts.mk In the products directory, create an AndroidProducts.mk file that point to (and is responsible for finding) the individual product make files. # # This file should set PRODUCT_MAKEFILES to a list of product makefiles # to expose to the build system. LOCAL_DIR will already be set to # the directory containing … Read more

Solved : java.lang.OutOfMemoryError: Java heap space

When I was trying to compile latest repo sync Android source code ( Android 10 ), and tried to compile demo application, I got an error as, When tried to find out some related information, I found that this error is due to less JAVA heap memory and we need to increase that memory, so … Read more

Solved: SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode

When you are installing some package or compiling some code which is depending on “npm” , you may get an error as below, SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode at exports.runInThisContext (vm.js:53:16) at Module._compile (module.js:374:25) at Object.Module._extensions..js (module.js:417:10) at Module.load (module.js:344:32) at Function.Module._load (module.js:301:12) at Function.Module.runMain (module.js:442:10) at … Read more

How to upgrade / install latest version of npm on Ubuntu

npm is the package manager for the Node JavaScript platform. When we used installed npm on Ubuntu using following command $ sudo apt install npm By default ubuntu unstalled npm version 3.5.2, which you can check as, $ npm -version 3.5.2 But the software, we were trying to compile required npm version more than 3.5.2, … Read more

Identify memory usage in Linux, Android using “smem” memory reporting tool

smem is a tool that can give numerous reports on memory usage on Linux systems. Unlike existing tools, smem can report proportional set size (PSS), which is a more meaningful representation of the amount of memory used by libraries and applications in a virtual memory system. Because large portions of physical memory are typically shared among multiple applications, … Read more

Save vimdiff output to html

The script ( vimdiff_to_html.sh ) matches the filename from first directory to same filename from second directory and takes a difference between two files using vimdiff and saves a html of diff into output directory under the matching name of the filename for example, out put of below command, “vimdiff first/a.c second/a.c” will be saved … Read more

How to cross compile Busybox

BusyBox combines tiny versions of many common UNIX utilities / commands into a single small executable. It provides minimalist replacements for most of the utilities you usually find in GNU coreutils, util-linux, etc. The utilities in BusyBox generally have fewer options than their full-featured GNU cousins. Following steps helps to cross compile Busybox to a … Read more

How to cross compile static dtc for ARM

As we seen in our previous post, “How to Compile and Install device-tree-compiler (DTC) On Ubuntu”, we could compile DTC ( Device Tree Compiler ) for Host machine i.e. Ubuntu In this post, we will describe what changes are required to get the DTC compiled to execute on embedded targets such as ARM. Since executing … Read more