2018/3/30

openwebos , test build

大概就是一些 source site 倒了,換到 github。
還有因為 使用的 openembedded 版本太舊,所以build image 時會有權限問題。要用 sudo make
但是 sanity check 又會檔...所以comment 掉 check..
diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
index e3444d1..1447a56 100644
--- a/meta/classes/sanity.bbclass
+++ b/meta/classes/sanity.bbclass
@@ -387,9 +387,6 @@ def check_sanity(sanity_data):
         print "Foo %s" % minversion
         return
 
-    if 0 == os.getuid():
-        raise_sanity_error("Do not use Bitbake as root.", sanity_data)
-
     messages = ""
 
     # Check the Python version, we now use Python 2.6 features in
因為 用 ctrl-C 中斷,所以 bitbakc.lock 沒刪除。
ref:bitbake/lib/bb/cooker.py

ERROR: Only one copy of bitbake should be run against a build directory


還是失敗,do_rootfs..
Collected errors:
 * preinst_configure: Aborting installation of connman.
 * opkg_install_cmd: Cannot install package packagegroup-webos-extended.
ERROR: Function failed: do_rootfs (see /home/charles-chang/mywebos/build-webos/BUILD/work/qemux86-webos-linux/webos-image/1.0-r2/temp/log.do_rootfs.1636 for further information)

2018/3/22

vnc player 中文方塊字

ref: vnc subtitles

內建字幕的影片播出來是方塊字。
vnc 2.2.8

是 Subtitiles/OSD 中 Encoding 和 Font 設定的關係。
Default Encoding 是Window 123 什麼的。
把他感改成 Traditional Chinese (Big5)
Font 我選了AR PL UKai TW
設完以後,關掉重開,就可以正常顯示了。

2018/3/21

使用 rename 來rename filename ..

ref:using sed to mass rename files

結果是用 rename 這個 command..
例子是想把filename 中,4個 0 改成 3 個 00
rename s/0000/000/ F0000*
還有用這一篇:
先用 -v 看看:
rename -n -v  's/^(.{5})//' *
OK 的話,就省掉 -v:
rename 's/^(.{5})//' *

2018/3/19

build 舊版 fdisk.. 2.17..

因為新版 (2.29.2) 和bsp script 用的版本(2.17.1) 語法參數不一樣。
所以拿2.17.1來 build..

fdisk 是在kernel org, util-linux-ng 這個 project。
download 後, run .configure, make fdisk 就可以了。

fdisk 目錄下的 fdisk 只是一個 wrapper,要call fdisk/.lib/fdisk 。
所以 .lib 下的才是本體,

vpn 到中國網路

差異好像越來越大,所以...
要測試app在中國的行為,就裝 Transocks 比較快。
不用設vpn 什麼的..
iOS 版本也有喔。

console mode markdown reader

像github 的 readm 是 md 格式 (README.md)。
在 console mode 的 reader..

mdr

是用 nodejs 寫得。所以用 npm install -g mdr 就可以安裝。

使用就是
mdr  README.md



另一個是grip
一樣是console mode,但是會叫 lynx 打開。

install node.js in debian 9 - stretch

ref:How to install nodejs on debian 9 (stretch)

他說 stretch 的 nodejs package 用的 nodejs 版本太舊,不建議使用。
建議自己安裝。

文章的方法是 run deb.nordesource.com 的 script,他會邦你加入 nodejs 的 source repository,
之後就可以用 apt 安裝。

## Confirming "stretch" is supported...

+ curl -sLf -o /dev/null 'https://deb.nodesource.com/node_6.x/dists/stretch/Release'

## Adding the NodeSource signing key to your keyring...

+ curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -
OK

## Creating apt sources list file for the NodeSource Node.js v6.x LTS Boron repo...

+ echo 'deb https://deb.nodesource.com/node_6.x stretch main' > /etc/apt/sources.list.d/nodesource.list
+ echo 'deb-src https://deb.nodesource.com/node_6.x stretch main' >> /etc/apt/sources.list.d/nodesource.list

...
...

## Run `apt-get install nodejs` (as root) to install Node.js v6.x LTS Boron and npm

然後 run apt-get install nodejs 就會安裝這個版本的 node.


附上其他distribution 的方法(其實一樣):nodejs package manager
在 trusty 上 run setup_6.x 的 log 中..
## Confirming "trusty" is supported...

+ curl -sLf -o /dev/null 'https://deb.nodesource.com/node_6.x/dists/trusty/Release'

## Adding the NodeSource signing key to your keyring...

+ curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -
OK

## Creating apt sources list file for the NodeSource Node.js v6.x LTS Boron repo...

+ echo 'deb https://deb.nodesource.com/node_6.x trusty main' > /etc/apt/sources.list.d/nodesource.list
+ echo 'deb-src https://deb.nodesource.com/node_6.x trusty main' >> /etc/apt/sources.list.d/nodesource.list

## Running `apt-get update` for you...
就是上面手動做的..

SoftEtnerVPN 安裝

沒有 package,所以要從 source..
git clone https://github.com/SoftEtherVPN/SoftEtherVPN.git
cd SoftEtherVPN
./configure
---------------------------------------------------------------------
SoftEther VPN for Unix

Copyright (c) SoftEther VPN Project at University of Tsukuba, Japan.
Copyright (c) Daiyuu Nobori. All Rights Reserved.

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
version 2 as published by the Free Software Foundation.

Read and understand README.TXT, LICENSE.TXT and WARNING.TXT before use.
---------------------------------------------------------------------

Welcome to the corner-cutting configure script !

The Makefile is generated. Run 'make' to build SoftEther VPN.

看一下 Makefile...
安裝位置..
INSTALL_BINDIR=/usr/bin/
INSTALL_VPNSERVER_DIR=/usr/vpnserver/
INSTALL_VPNBRIDGE_DIR=/usr/vpnbridge/
INSTALL_VPNCLIENT_DIR=/usr/vpnclient/
INSTALL_VPNCMD_DIR=/usr/vpncmd/

2018/3/17

把google photo 中高解析的照片換成低解析不,不佔空間

How to Convert Full Resolution Photos to Free Unlimited?
有一個 Recover storage 的 button..
按下去,等一下..(好幾小時) 到 google driver 去看 storage quota, google photo 佔的就變成 0 了。

2018/3/16

couldn't mount RDWR because of unsupported optional features (400)

linux-couldnt-mount-rdwr-because-of-unsupported-optional-features-400

所以 follow 這一篇...
用 tune2fs -l 列出用 prebuilt/linux-x86/mkfs/make_ext4s 和 系統 mkfs.ext4 format 過得 block deviice, feature 部份...
make_ext4fs:
Filesystem volume name:   
Last mounted on:          
Filesystem UUID:          57f8f4bc-abf4-0000-675f-946fc0f9f25b
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal resize_inode filetype extent sparse_super large_file
Default mount options:    (none)
Filesystem state:         clean
Errors behavior:          Remount read-only
Filesystem OS type:       Linux
Inode count:              6400
Block count:              25600
Reserved block count:     0
Free blocks:              24162
Free inodes:              6389
First block:              0
Block size:               4096
Fragment size:            4096
Reserved GDT blocks:      7
Blocks per group:         32768
Fragments per group:      32768
Inodes per group:         6400
Inode blocks per group:   400
Last mount time:          n/a
Last write time:          Thu Jan  1 08:00:00 1970
Mount count:              0
Maximum mount count:      -1
Last checked:             Thu Jan  1 08:00:00 1970
Check interval:           0 ()
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:           256
Required extra isize:     28
Desired extra isize:      28
Journal inode:            8
Default directory hash:   tea
Journal backup:           inode blocks

mkfs.ext4:
Filesystem volume name:   
Last mounted on:          
Filesystem UUID:          b4eaefc3-2856-4c9f-9abd-4b65a2fbd6f0
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype extent 64bit flex_bg sparse_super large_file huge_file dir_nlink extra_isize metadata_csum
Filesystem flags:         signed_directory_hash 
Default mount options:    user_xattr acl
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              64000
Block count:              256000
Reserved block count:     12800
Free blocks:              247252
Free inodes:              63989
First block:              0
Block size:               4096
Fragment size:            4096
Group descriptor size:    64
Reserved GDT blocks:      124
Blocks per group:         32768
Fragments per group:      32768
Inodes per group:         8000
Inode blocks per group:   500
Flex block group size:    16
Filesystem created:       Fri Mar 16 18:35:45 2018
Last mount time:          n/a
Last write time:          Fri Mar 16 18:35:45 2018
Mount count:              0
Maximum mount count:      -1
Last checked:             Fri Mar 16 18:35:45 2018
Check interval:           0 ()
Lifetime writes:          17 MB
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:           256
Required extra isize:     32
Desired extra isize:      32
Journal inode:            8
Default directory hash:   half_md4
Directory Hash Seed:      0a08ac54-71c0-4329-93b6-8830d536aaba
Journal backup:           inode blocks
Checksum type:            crc32c
Checksum:                 0x9b3ce51d
果然 filesystem feature 部份差異很多..

2018/3/14

refcode, dump_sector..

void dump_sector(unsigned char *buf, int len)
{
        int i, j;

        printk(KERN_ERR " Sector Dump \n");

        for (i = 0 ; i < len ; i += 16) {
                printk(KERN_ERR "%04d: ", i);

                for (j = 0 ; j < 16 ; j++) {
                        unsigned char c = buf[i+j];
                        if (c >= 0x20 && c < 0x7e)
                                printk(" %c ", buf[i+j]);  // 如果不用印出 ascii 的話,就不用這個判斷..
                        else
                                printk("%02x ", buf[i+j]);
                }

                printk("\n");
        }
}
常常會用到...

sudo PATH

ref:How to make sudo preserve $PATH

sudo 的 PATH 和user 不一樣。
設定在 /etc/sudoers :
Defaults    secure_path = /sbin:/bin:/usr/sbin:/usr/bin
所以要改的話....