Tomahawk BIOS Upgrade Linux Boot Failure

Recently I upgraded my MSI Tomahawk B450 Max BIOS. I downloaded the latest BIOS version in Zip format and unzipped into a USB disk. After booting the system into BIOS, used the BIOS Flash option (simply choose the *.3B0 file) to upgrade and it took around 15mins (Lucky no power cut) to finish.

All went well. But when I boot the system with new BIOS, it failed to find the boot device and stuck with error message “No Boot device found..”. For a moment, I thought, I screwed up the ArchLinux Disk partition table or something. Because I never faced any issue with EFI Boot in ThinkPad BIOS upgrades.

Most of the internet search result suggested to reset the BIOS. I know, that is not going to help. After going thru the settings, I saw a EFI Shell option. Hooray!! Once you go into EFI Shell, all partitions will be listed. In Gentoo/ArchLinux, the 1st partition is always the EFI partition.

  • Mount the EFI Partition – Type > FS0:
  • Goto the EFI Folder – Type > cd EFI/GRUB/ (May be different in your system)
  • Run the EFI Binary – Type > grubx64.efi

Wala, got the Grub and able to boot 🙂

Now on to boot normally, we need to reinstall the Grub and update the UEFI Config

grub-install --efi-directory=/boot/efi --bootloader-id=GRUB


Free Pascal Setup

It is easy to setup the FPC + Lazarus IDE, if you are going to build only for native platform (ex: Linux-x86 on Linux-x86 or Win32 on Win32, ..). But if you want to add the cross compilation (ex: x86-linux to arm-linux) capability, it will become difficult and you may stuck in wired setup cycle.

1st I used codetyphon. It is a monster. Too huge to manage and to know what is going into your system. After a bit of struggle, I found FpcUpDeluxe – multi-platform, simple and useful tool. Once you fulfilled the build tool dependencies or prerequisites, FpcUpDeluxe works smoothly. I used arm tool chains from Ubuntu package and Linaro. Both are Okay.

Setting up the FPC cross compilation env (for Arm-Linux) in Windows is bit of an challenge. Still working on it. If there is any success, I will update here 🙂

SQLite, JDBC & Solaris (SPARC)

SQLite is one of simple and powerful Database engine. Recently I was doing some testing and performance check, using a Java Code and Xerial SQLite-JDBC library. As a part of this, I wanted to run this test on Solaris 11 (SPARCv9) environment.  Thats when I noticed two things:

1) Xerial SQLite JDBC Library not having the Native Library for Solaris SPARC  Architecture. JDBC Native Library is used to bridge the Java JDBC call to SQLite C Call. It is simple JNI Wrapper library.

2) My Solaris Base machine as well as the spare VM does not have the GNU Developer Tools.

I am not regularly playing with Solaris Package System and  not sure about the impact of installing the new set of libraries and tools in the base machine. So decided use the spare Oracle VM and not to touch the base machine.

Installing GNU Developer Tools in Solaris 11 SPARC:

Starts with GCC and supporting library installation. But this

# pkg install gcc or gcc-4X

Failed with message “This version is excluded by installed incorporation blah blah”. All my other tricks to install gcc also failed. But I was able to install vim  using:

# pkg install vim

This event pushed me to read about the Package Incorporation in Oracle documents:
“Every package that is part of the Oracle Solaris 11 OS has a dependency on an incorporation package. Incorporation packages constrain the versions of the their incorporated packages to help keep the system in a supportable state across updates. Some incorporated packages might be safe to downgrade or upgrade at a version different from the version specified by the incorporation”.

You have an option to relax some (version) constraints to allow the installation any package. GNU Developer tools might have some inter-dependency, I don’t want to go in this direction and decide to search list of incorporated packages. Below command listed the packages:

# pkg contents -m ips-incorporation

And following line in the output, give me a clue.

depend fmri=group/feature/developer-gnu@0.XXX type=incorporate

developer-gnu is a group package and it can install all the tools with correct dependency, in one go.

# pkg install developer-gnu

All GNU tools are installed with-out any issue. Ah, next..

Compile SQLite-JDBC on SPARC:

Developers didn’t compile it for the SPARC platform. But they put a place holder in the Makefile. This reduced my job to few fine tuning only. Let see thous steps:

1. Install the JDK (I used JDK 1.8) and Set the JAVA_HOME

2. Get the Xerial SQLite-JDBC library source from GitHub (I used 3.15)

3. During the compilation process, original SQLite code will be download. So target machine need to have the Internet access or you need to change the Makefile to use locally downloaded files.

3. Changes in Makefile.common:

A) Add -std=gnu99 — To support C99 Standard

SunOS-sparcv9_CCFLAGS := -I$(JAVA_HOME)/include -Ilib/inc_linux -O2 -fPIC  -m64 -std=gnu99 -fvisibility=hidden

B) For 32 bit binary, then add the following:

SunOS-sparc_CC := $(CROSS_PREFIX)gcc
SunOS-sparc_STRIP := $(CROSS_PREFIX)strip
SunOS-sparc_CCFLAGS := -I$(JAVA_HOME)/include -Ilib/inc_linux -O2 -fPIC  -m32 -std=gnu99 -fvisibility=hidden
SunOS-sparc_LINKFLAGS := -shared -static-libgcc
SunOS-sparc_LIBNAME :=

C) Added new target to known_targets:

known_targets := .. SunOS-sparc

4. Changes in Makefile:

A) For 32 bit binary, then add the following:

          $(MAKE) native OS_NAME=SunOS OS_ARCH=sparc

5. Build the native part

$ gmake sparcv9

$ gmake sparc

You can find the native library ( in the folders:
32 bit: target/sqlite-3.15.1-SunOS-sparc
64 bit: target/sqlite-3.15.1-SunOS-sparcv9

6. Rebuild the JAR:

I am not building it for multiple platforms. It is also not possible. Because the some part of the build step depends on docker images, which is not supported in my VM. So I left with only one option of manually adding this native library into the sqlite-jdbc-3.15.X.jar JAR.

A) Download the latest JAR file.
B) Extract it (JAR is simply a ZIP File)
C) Create “SunOS” folder inside the /org/sqlite/native/
D) Create “sparc” and “sparcv9” folders inside the SunOS
E) Copy the into corresponding folders (32 and 64)
F) Recreate the JAR

Now JAR ready for the Solaris SPARC platform. HTH 🙂

Interesting Hardware Issue: Photoelectric Effect on R Pi 2

Recently Raspberry Pi 2 released. One of the user trying to take a photo of his board (at that time board in running condition). When his camera flash went off, board power also went off. After testing few times, user posted this issue in the forum. R Pi team analysed and found out an interesting hardware issue – Photoelectric Effect Issue (similar to ESD in early days).

Read this blog:

Intel NUC – Tiny but powerful

Update (Mid 2016): D54250WYKH – This old (2014/2015) model has serious hardware issues related to USB, Display and SATA interfaces. Some this issues not resolved even after BIOS update. Please refer the Intel NUC forum to understand more this. To minimize the issues, you can run the unit with-out any keyboard, mouse and monitor. But still SSD/ HDD related issues might pop up.

Today I brought one Intel NUC for experiment purpose. Totel cost is ~1K SGD (NUC-i5, 16GB RAM, 250GB mSATA SSD, 1TB 2.5″ HDD).

Performance is okay. Remember not to compare the NUC processor (less speed and less cache) with regular i5 processors. Max RAM is 16GB. Tested with Win8.1, Ubuntu 14.04 and running few VMs also on it. Slit lag during heavy operations like starting VM. Otherwise okay.




Porject Ara – DevConf @ SG

Today, I manage to reach the Google Project Ara – DevConf by 10:30AM. Interesting talks and Ideas. Met interesting people like Greg Kroah-Hartman, George Grey, Ara Team. Saw interesting modules like Pluggable camera, UniPro Bridge Chip, Blood Glucometer, Water Tester, Processor module, etc. The ProjectAra DevBoard is not yet ready for pure software development. If you are a core hardware developer with interesting idea, you can apply for DevBoard loan.

LDAP: Multiple Provider URLs

The LDAP service provider uses this URL to configure its connection to the directory server. Only the host, port, and dn parts of the URL are relevant in this setting. Supplying other parts of the URL results in a ConfigurationException(in the API reference documentation). Most commonly we use just one URL. But we can also supply a space-separated list of URLs. In this case, the LDAP provider will attempt to use each URL in turn until it is able to create a successful connection. How to determine, on which server, are we connected to?? The LDAP provider set Context.PROVIDER_URL property to the successful URL, so that the application can determine which URL is being used. Here is an example of how to specify a list of URLs.

Hashtable env = new Hashtable();

env.put(Context.INITIAL_CONTEXT_FACTORY, “com.sun.jndi.ldap.LdapCtxFactory”);

// Specify list of space-separated URLs
env.put(Context.PROVIDER_URL, “ldap://host1:389/o=JNDITutorial ” + “ldap://host2:389/o=JNDITutorial ” + “ldap://host3:389/o=JNDITutorial ” + “ldap://host4:389/o=JNDITutorial”);

// Create initial
context DirContext ctx = new InitialDirContext(env);

// See which server was used

For more info:

Find the Yesterday

On GNU/Linux platform finding the particular date from current date is a no brainer task. For example:

Yesterday: date –date=’yesterday’
Nextday: date –date=’next day’ OR date –date=’tomorrow’
Other Tricks:
date –date=’10 year’
date –date=’10 year ago’
date –date=’this sunday’

But on Solaris, you don’t have this luxury. So you can use the following trick:
TZ=GMT+24 date

Android Udev Rules

Linux Udev rule file to interface Android Hardware for Application/System development.

# Acer 0502
SUBSYSTEM=="usb", ATTR{idVendor}=="0502", MODE="0666", GROUP="plugdev"
# ASUS 	0b05
SUBSYSTEM=="usb", ATTR{idVendor}=="0b05", MODE="0666", GROUP="plugdev"
# Dell 	413c
SUBSYSTEM=="usb", ATTR{idVendor}=="413c", MODE="0666", GROUP="plugdev"
# Foxconn 	0489
SUBSYSTEM=="usb", ATTR{idVendor}=="0489", MODE="0666", GROUP="plugdev"
# Fujitsu 	04c5
# Fujitsu Toshiba 	04c5
SUBSYSTEM=="usb", ATTR{idVendor}=="04c5", MODE="0666", GROUP="plugdev"
# Garmin-Asus 	091e
SUBSYSTEM=="usb", ATTR{idVendor}=="091e", MODE="0666", GROUP="plugdev"
# Google 	18d1
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666", GROUP="plugdev"
# Haier 	201E
SUBSYSTEM=="usb", ATTR{idVendor}=="201e", MODE="0666", GROUP="plugdev"
# Hisense 	109b
SUBSYSTEM=="usb", ATTR{idVendor}=="109b", MODE="0666", GROUP="plugdev"
# HTC 	0bb4
SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666", GROUP="plugdev"
# Huawei 	12d1
SUBSYSTEM=="usb", ATTR{idVendor}=="12d1", MODE="0666", GROUP="plugdev"
# K-Touch 	24e3
SUBSYSTEM=="usb", ATTR{idVendor}=="24e3", MODE="0666", GROUP="plugdev"
# KT Tech 	2116
SUBSYSTEM=="usb", ATTR{idVendor}=="2116", MODE="0666", GROUP="plugdev"
# Kyocera 	0482
SUBSYSTEM=="usb", ATTR{idVendor}=="0482", MODE="0666", GROUP="plugdev"
# Lenovo 	17ef
SUBSYSTEM=="usb", ATTR{idVendor}=="17ef", MODE="0666", GROUP="plugdev"
# LG 	1004
SUBSYSTEM=="usb", ATTR{idVendor}=="1004", MODE="0666", GROUP="plugdev"
# Motorola 	22b8
SUBSYSTEM=="usb", ATTR{idVendor}=="22b8", MODE="0666", GROUP="plugdev"
# MTK 	0e8d
SUBSYSTEM=="usb", ATTR{idVendor}=="0e8d", MODE="0666", GROUP="plugdev"
# NEC 	0409
SUBSYSTEM=="usb", ATTR{idVendor}=="0409", MODE="0666", GROUP="plugdev"
# Nook 	2080
SUBSYSTEM=="usb", ATTR{idVendor}=="2080", MODE="0666", GROUP="plugdev"
# Nvidia 	0955
SUBSYSTEM=="usb", ATTR{idVendor}=="0955", MODE="0666", GROUP="plugdev"
# OTGV 	2257
SUBSYSTEM=="usb", ATTR{idVendor}=="2257", MODE="0666", GROUP="plugdev"
# Pantech 	10a9
SUBSYSTEM=="usb", ATTR{idVendor}=="10a9", MODE="0666", GROUP="plugdev"
# Pegatron 	1d4d
SUBSYSTEM=="usb", ATTR{idVendor}=="1d4d", MODE="0666", GROUP="plugdev"
# Philips 	0471
SUBSYSTEM=="usb", ATTR{idVendor}=="0471", MODE="0666", GROUP="plugdev"
# PMC-Sierra 	04da
SUBSYSTEM=="usb", ATTR{idVendor}=="04da", MODE="0666", GROUP="plugdev"
# Qualcomm 	05c6
SUBSYSTEM=="usb", ATTR{idVendor}=="05c6", MODE="0666", GROUP="plugdev"
# SK Telesys 	1f53
SUBSYSTEM=="usb", ATTR{idVendor}=="1f53", MODE="0666", GROUP="plugdev"
# Samsung 	04e8
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", MODE="0666", GROUP="plugdev"
# Sharp 	04dd
SUBSYSTEM=="usb", ATTR{idVendor}=="04dd", MODE="0666", GROUP="plugdev"
# Sony 	054c
SUBSYSTEM=="usb", ATTR{idVendor}=="054c", MODE="0666", GROUP="plugdev"
# Sony Ericsson 	0fce
SUBSYSTEM=="usb", ATTR{idVendor}=="0fce", MODE="0666", GROUP="plugdev"
# Teleepoch 	2340
SUBSYSTEM=="usb", ATTR{idVendor}=="2340", MODE="0666", GROUP="plugdev"
# Toshiba 	0930
SUBSYSTEM=="usb", ATTR{idVendor}=="0930", MODE="0666", GROUP="plugdev"
# ZTE 	19d2
SUBSYSTEM=="usb", ATTR{idVendor}=="19d2", MODE="0666", GROUP="plugdev"

Netbeans: Headers to Java File

In the Netbeans IDE, whenever you create a project/file, it adds the following header.

* To change this template, choose Tools | Templates
* and open the template in the editor.

Here we will see, how to change or customize this header to suit our needs.

  • Select Tools -> Templates -> Template Manager
  • Change the License statement
    • Select: Licenses -> Default License
    • Click the “Open in Editor” Button, Remove the existing text and add the following lines:

<#if licenseFirst??>
${licensePrefix} (c) ${date?date?string(“yyyy”)} Your/ Company Name
<#if licenseLast??>

  • Save
  • Change the Program Header
    • Java -> Java Main class
    • Click the “Open in Editor” Button
    • Replace the following lines:

* @author ${user}

  • With this lines:

* File Name:    ${nameAndExt}
* Project Name: ${}
* @since  ${date}, ${time}
* @author ${user}
* File Description:
* Provide a 2 line short description.

  • Save
  • Repeats the previous step, for the following templates also:
    • Java Class
    • Java Interface
    • Java Singleton Class
    • Java Exception
  • Set Proper User Name: In Template Manager, Click the “Settings” Button and add the following line:

   user=Your Full Name <>