0%

At work my boss wanted me to add Korean input method on the current embedded Linux system for Korean customers. So, this post is about how I make it happen using ibus-hangul with Yocto Zeus release.

Goal

Users should be able to switch to Korean input method by external keyboard or onboard keyboard on embedded Yocto Linux system.

Environment

Input Method Framework

There are several input method frameworks out there, such as SCIM, IBUS, fcitx .. etc. I have worked on fcitx for traditional Chinese several years ago on my chromebook (Linux using crouton). As I remember, the experience was not good.

This time, based on our requirement/environment, I did a quick research and found out that iBus might be the easiest one to get it done, and it seems to have better support for Yocto. Also, there is someone who regularly updates ibus-hangul and libhangul github repos, which is good. At least, it should be less buggy.

Read more »

MFGTool Analysis

mksdcard.sh

mksdcard.sh is the script to create partitions, which can be found in /MfgTool/Profiles/Linux/OS Firmware/mksdcard.sh.tar

mksdcard.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/sh

# partition size in MB
BOOT_ROM_START=10
BOOT_ROM_SIZE=32
ROOTFS_START=64
ROOTFS_SIZE=2048

# wait for the SD/MMC device node ready
while [ ! -e $1 ]
do
sleep 1
echowait for $1 appear”
done

# call sfdisk to create partition table
# destroy the partition table
node=$1
dd if=/dev/zero of=${node} bs=1024 count=1

sfdisk --force ${node} << EOF
${BOOT_ROM_START}M,${BOOT_ROM_SIZE}M,0c
${ROOTFS_START}M,,83
EOF
Read more »

Prerequisites

Install open-vm-tool

1
2
sudo apt update
sudo apt install open-vm-tools

User Mode

You can actually get this done by either using kernel mode or user mode. Here we’ll go for user mode.

  • Kernel mode client file system type vmhgfs
  • User mode client FUSE file system type vmhgfs-fuse
    Read more »

Most Frequent Element in an Array

Problem Description

You are given two arrays. Assume that there are no duplicates in each of arrays.
Determine if two arrays are a rotated version of each other.

Example:

Input: A = [1, 2, 3, 4, 5, 6, 7], B = [4, 5, 6, 7, 1 ,2 ,3]
Output: True
Input: A = [1, 2, 3, 4, 5, 6, 7], B = [1, 3, 5, 7, 9, 2, 4]
Output: False
Read more »

Validate Binary Search Tree

LeetCode - 0098 Validate Binary Search Tree
https://leetcode.com/problems/validate-binary-search-tree/

Problem Description

Given a binary tree, determine if it is a valid binary search tree (BST).

Assume a BST is defined as follows:

  • The left subtree of a node contains only nodes with keys less than the node’s key.
  • The right subtree of a node contains only nodes with keys greater than the node’s key.
  • Both the left and right subtrees must also be binary search trees.

Example 1:

  2
 / \
1   3

Input: [2,1,3]
Output: true
Read more »