Writing OS from Scratch


  • Because it is fun!
  • Bottom up approach to problem solving
  • Learn and explore ​under-the-hood stuff

Getting Started

  • Architecture X86, because of availability of tools (e.g. emulators)
  • Bootloader assumed to be GRUB
  • More information on following link


Posted in Uncategorized | Leave a comment

Hackable IoT Devices

In addition to well known Raspberry-pi and arduino following are some lesser known but cheaper device for DIY hacks:

  • ESP8266 (WiFi)

Cheap WiFi module providing b/g/n connectivity using few AT commands over UART interface. It costs less than $3.5 (less than INR 300 in India). Manufactured by Espressif, which also provides IoT SDK. Also this module is currently supported in Arduino IDE as well.




  • nrf51822 (Bluetooth Smart)

The nRF51822 is a powerful, highly flexible multiprotocol SoC ideally suited for Bluetooth® Smart (previously called Bluetooth low energy) and 2.4GHz ultra low-power wireless applications. The nRF51822 is built around a 32-bit ARM® Cortex™ M0 CPU with 256kB/128kB flash + 32kB/16kB RAM.


Posted in Embedded, Technology | Tagged , | Leave a comment

IoT Device Provisioning Methods

Following are various ways in which a WiFi IoT (Internet of Things) device can be provisioned to connect with home network (Access Point/Router) in a secure way:


  • Credentials like security mode and passphrase for WiFi network needs to be secured
  • Enterprise security in WiFi network is not covered here

Micro-AP with WPA/2 Security

IoT device with micro-AP and WPA2 security mode can serve the purpose along with web/mobile application to provision device.

Pin Based Method (OPEN or Ad-hoc Mode AP)

IoT device will have some manufacturing pin printed on it and then user needs to enter this pin during provisioning on web/mobile application after associating with micro-AP started on device. Based on this pin, a common shared symmetric key will be derived which will be used to encrypt network credentials for selected scanned network list presented from device.

HTTPS Server on Device (OPEN or Ad-hoc Mode AP)

IoT device will start HTTPS server (port 443) with self signed certificate (can be modified by authentic one by OEM) and web/mobile application after associating with micro-AP started on device will provision the device from scanned network list. Since entire session is secured using TLS, no additional security is required.

WPS Method

WPS push-button or pin method to associate device with home router and in turn WiFi network.

IoT Device Sniffer Mode

Some custom protocols to sniff data from multicast packets and/or patterns over wireless channel from mobile clients to get network credentials. E.g. TI’s Smart Config

Apple Wireless Accessory Configuration

Apple custom protocol to MFI Licensees only, requires additional Authentication Coprocessor chip.


  • Simultaneous provisioning of multiple devices
  • Mobile and/or client connectivity with home network
  • Ease-of-use for end-user
  • Security (Authenticity + Privacy) (Known vulnerabilities in WPS etc.)

Reference: TI’s White Paper

Posted in Embedded, Technology | Tagged | Leave a comment

GIT Tips

  • Recovering lost commit
$ git reflog
  • Diff files on 2 branches
$ git difftool branch1:file1 branch2:file2
  • Picking a commit from one to another branch
$ git cherry-pick -x
  • Selectively adding changes from file
$ git add -p
  • Finding un-pushed commits on local branch
$ git cherry -v
  • Saving/recovering temporary local changes
$ git stash save
$ git stash pop
$ git stash list
  • Display current working branch in repo
$ export PS1='[u@h W$(declare -F __git_ps1 &>/dev/null && __git_ps1 " (%s)")]$ '
Posted in Coding | Leave a comment

Coursera — Online Education

Completed Hardware Software Interface Course on Coursera. My first online learning course, completed with distinction.


  • Great experience
  • Free knowledge sharing
  • Communitiy interaction
  • Platform for aspiring learners
  • Stuctured approach for course organization
Image | Posted on by | Leave a comment

Programming in 10 Years

Peter Norvig says this on his very-well written blog (and 10000 hours practice rule from Outliers as well),


Posted in Uncategorized | Tagged | Leave a comment

Don’t Quit (No Matter What) !

When things go wrong, as they sometimes will,
When the road you’re trudging seems all uphill,
When funds are low and the debts are high,
And you want to smile but you have to sigh,
When care is pressing you down a bit,
Rest if you must, but don’t you quit.

Life is queer with its twists and turns,
As every one of us sometimes learns,
And many a failure turns about,
When he might have won if he’d stuck it out.
Don’t give up, though the pace seems slow –
You may succeed with another blow.

Often the goal is nearer than
It seems to a faint and faltering man;
Often the struggler has given up
When he might have captured the victor’s cup,
And he learned too late, when the night slipped down,
How close he was to the golden crown.

Success is failure turned inside out –
The silver tint of the clouds of doubt,
And you never can tell how close you are –
It may be near when it seems afar;
So stick to the fight when you’re hardest hit –
It’s when things seem worst that you mustn’t quit.

— Unknown

Posted in Inspiration | Tagged | Leave a comment